Subversion Repositories public iLand

Rev

Rev 697 | Rev 723 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 697 Rev 720
Line 113... Line 113...
113
{
113
{
114
    mLAINeedle=mLAIBroadleaved=0.;
114
    mLAINeedle=mLAIBroadleaved=0.;
115
    mCanopyConductance=0.;
115
    mCanopyConductance=0.;
116
    const double ground_vegetationCC = 0.02;
116
    const double ground_vegetationCC = 0.02;
117
    double lai;
117
    double lai;
118
    foreach(ResourceUnitSpecies *rus, mRU->ruSpecies()) {
-
 
-
 
118
    foreach(const ResourceUnitSpecies *rus, mRU->ruSpecies()) {
119
        lai = rus->constStatistics().leafAreaIndex();
119
        lai = rus->constStatistics().leafAreaIndex();
120
        if (rus->species()->isConiferous())
120
        if (rus->species()->isConiferous())
121
            mLAINeedle+=lai;
121
            mLAINeedle+=lai;
122
        else
122
        else
123
            mLAIBroadleaved+=lai;
123
            mLAIBroadleaved+=lai;
Line 165... Line 165...
165
inline double WaterCycle::calculateSoilAtmosphereResponse(const double psi_kpa, const double vpd_kpa)
165
inline double WaterCycle::calculateSoilAtmosphereResponse(const double psi_kpa, const double vpd_kpa)
166
{
166
{
167
    double min_response;
167
    double min_response;
168
    double total_response = 0; // LAI weighted minimum response for all speices on the RU
168
    double total_response = 0; // LAI weighted minimum response for all speices on the RU
169
    double total_lai_factor = 0.;
169
    double total_lai_factor = 0.;
170
    foreach(ResourceUnitSpecies *rus, mRU->ruSpecies()) {
-
 
171
        if (rus->LAIfactor()>0) {
-
 
-
 
170
    foreach(const ResourceUnitSpecies *rus, mRU->ruSpecies()) {
-
 
171
        if (rus->LAIfactor()>0.) {
172
            // retrieve the minimum of VPD / soil water response for that species
172
            // retrieve the minimum of VPD / soil water response for that species
173
            rus->speciesResponse()->soilAtmosphereResponses(psi_kpa, vpd_kpa, min_response);
173
            rus->speciesResponse()->soilAtmosphereResponses(psi_kpa, vpd_kpa, min_response);
174
            total_response += min_response * rus->LAIfactor();
174
            total_response += min_response * rus->LAIfactor();
175
            total_lai_factor += rus->LAIfactor();
175
            total_lai_factor += rus->LAIfactor();
176
        }
176
        }
Line 186... Line 186...
186
    if (total_lai_factor==1.)
186
    if (total_lai_factor==1.)
187
        total_response *= mRU->averageAging(); // no ground cover: use aging value for all LA
187
        total_response *= mRU->averageAging(); // no ground cover: use aging value for all LA
188
    else if (total_lai_factor>0. && mRU->averageAging()>0.)
188
    else if (total_lai_factor>0. && mRU->averageAging()>0.)
189
        total_response *= (1.-total_lai_factor)*1. + (total_lai_factor * mRU->averageAging()); // between 0..1: a part of the LAI is "ground cover" (aging=1)
189
        total_response *= (1.-total_lai_factor)*1. + (total_lai_factor * mRU->averageAging()); // between 0..1: a part of the LAI is "ground cover" (aging=1)
190
190
191
    DBGMODE( if (mRU->averageAging()>1. || mRU->averageAging()<0. || total_response<0 || total_response>1.)
-
 
192
        qDebug() << "water cycle: average aging invalid. aging:" << mRU->averageAging() << "total response" << total_response;
-
 
-
 
191
    DBGMODE(
-
 
192
          if (mRU->averageAging()>1. || mRU->averageAging()<0. || total_response<0 || total_response>1.)
-
 
193
             qDebug() << "water cycle: average aging invalid. aging:" << mRU->averageAging() << "total response" << total_response << "total lai factor:" << total_lai_factor;
193
    );
194
    );
194
195
195
    //DBG_IF(mRU->averageAging()>1. || mRU->averageAging()<0.,"water cycle", "average aging invalid!" );
196
    //DBG_IF(mRU->averageAging()>1. || mRU->averageAging()<0.,"water cycle", "average aging invalid!" );
196
    return total_response;
197
    return total_response;
197
}
198
}