LandscapeDNDC 1.37.0
Loading...
Searching...
No Matches
ldndc::PhysiologyPNET Class Reference

Vegetation model PNET. More...

#include <models/physiology/pnet/pnet.h>

Public Member Functions

lerr_t sleep ()
 

Private Member Functions

void daily_to_subdaily ()
 Moves daily values into time step values (accumulated to daily values again by the subdaily finalizer). Growth and litter are accounted for in the first time step of the day, carbon uptake, respiration and potential transpiration are stored as daily totals and distributed by distribute_subdaily().
 
lerr_t step_init ()
 
lerr_t step_out ()
 
void balance_check (MoBiLE_Plant *p, unsigned int _i)
 
double sapwood_foliage_ratio (MoBiLE_Plant *)
 
double functional_sapwood (MoBiLE_Plant *)
 
void update_nitrogen_concentration (MoBiLE_Plant *)
 
void YearlyReset (MoBiLE_Plant *)
 
void Phenology (MoBiLE_Plant *, int, double)
 
void Photosyn (MoBiLE_Plant *)
 
void AllocateDay (MoBiLE_Plant *)
 
void AllocateYr (MoBiLE_Plant *)
 
void N_uptake (MoBiLE_Plant *, double &)
 
void Update (MoBiLE_Plant *, double, double)
 
void TransformPhysiology (MoBiLE_Plant *)
 
lerr_t CalcVegStructure ()
 
size_t get_na_max_pnet ()
 

Static Private Attributes

static const double SRATEMAX = 0.01
 
static const double NUPTAIR = 0.0
 
static const double FDON_AVAILABLE = 0.1
 
static const double GROWMAX = 0.95
 

Detailed Description

Vegetation model PNET.

Author
Ruediger Grote

Member Function Documentation

◆ AllocateDay()

void ldndc::PhysiologyPNET::AllocateDay ( MoBiLE_Plant * p)
private

wood and fine root growth and fine root turnover of the day (see Wood and fine root growth)

1154{
1155 WoodMRespDay = CanopyGrossPsnDay * (*p)->WOODMRESPA();
1156
1157 if ( p->growing_degree_days >= (*p)->GDDWODSTART())
1158 {
1159 double const dvsWoodNew( cbm::bound(0.0, (p->growing_degree_days - (*p)->GDDWODSTART()) / ((*p)->GDDWODEND() - (*p)->GDDWODSTART()), 1.0));
1160 double const delta_dvsWood( dvsWoodNew - p->dvsWood);
1161 p->dvsWood = dvsWoodNew;
1162
1163 WoodProdCDay = (WoodCStart * delta_dvsWood);
1164 WoodGRespDay = (WoodProdCDay * (*p)->FYIELD());
1165 }
1166 else
1167 {
1168 WoodProdCDay = 0.0;
1169 WoodGRespDay = 0.0;
1170 }
1171
1172 // root growth
1173 // rg 19.10.11 complemented with density and size dependent factor
1174 RootCAddDay = (((*p)->FRTALLOC_BASE() * (1.0 / (double)lclock()->days_in_year()) + (*p)->FRTALLOC_REL() * FolProdCDay)
1175 * p->mFolMax / (*p)->MFOLOPT());
1176
1177 // carbon allocation out of roots (respiration and senescence)
1178 double const fact_temp( exp( 0.1 * (mc_.nd_airtemperature - 7.1)) * 0.68);
1179 double const RootAllocCDay( cbm::bound_max( fact_temp * (*p)->TOFRTBAS() * (*p)->FRTLOSS_SCALE(), 0.99) * RootC);
1180 RootProdCDay = RootAllocCDay / (1.0 + (*p)->ROOTMRESPFRAC() + (*p)->FYIELD());
1181 RootMRespDay = RootProdCDay * (*p)->ROOTMRESPFRAC();
1182 RootGRespDay = RootProdCDay * (*p)->FYIELD();
1183}

References AllocateDay().

Referenced by AllocateDay().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AllocateYr()

void ldndc::PhysiologyPNET::AllocateYr ( MoBiLE_Plant * p)
private

annual allocation at the last day of the year (see Annual allocation)

1211{
1212 // only the functional sapwood (see functional_sapwood) takes part in the redistribution
1213 double scale_ay( cbm::KG_IN_G / cbm::CCDM); // gC in kgDW
1214 double const WoodCStruct( WoodC - functional_sapwood( p) / scale_ay);
1215 double fratio( (*p)->QWODFOLMIN() / (1.0 + (*p)->QWODFOLMIN()));
1216 double TotalC( WoodC - WoodCStruct + BudC + FolMass * cbm::CCDM);
1217 WoodC = TotalC * fratio;
1218 BudC = TotalC - WoodC - FolMass * cbm::CCDM;
1219
1220 double mSapSum( 0.0);
1221 double mBudSum( 0.0);
1222 mSapSum += functional_sapwood( p);
1223 mBudSum += p->mBud;
1224
1225 // transfer of dry matter between buds and sapwood according to the new carbon distribution
1226 transfDWbs = 0.0;
1227 transfDWsb = 0.0;
1228 // shift from buds to sapwood tissue
1229 double freeBudDW( 0.0);
1230 double requBudDW(0.0);
1231 if (mBudSum > 0.0)
1232 {
1233 double fm_vt( p->mBud / mBudSum);
1234 freeBudDW = std::max(0.0, p->mBud - BudC * scale_ay * fm_vt);
1235 requBudDW = std::max(0.0, BudC * scale_ay * fm_vt - p->mBud);
1236 }
1237 else
1238 {
1239 requBudDW = BudC * scale_ay / double( m_veg->size());
1240 }
1241
1242 transfDWbs += freeBudDW;
1243
1244 // shift from sapwood to buds
1245 double freeSapDW( 0.0);
1246 if (mSapSum > 0.0)
1247 {
1248 freeSapDW = std::max(0.0, mSapSum - WoodC * scale_ay);
1249 }
1250 transfDWsb += std::min(freeSapDW, requBudDW);
1251
1252 // new bud and wood compartments
1253 BudC += (transfDWsb - transfDWbs) / scale_ay;
1254 WoodC += (transfDWbs - transfDWsb) / scale_ay + WoodCStruct;
1255 if (BudC < 0.0) BudC = 0.0;
1256 if (WoodC < 0.0) WoodC = 0.0;
1257
1258 // determination of maximum foliage growth next year
1259 double FolMassMaxOld( FolMassMax);
1260 FolMassMax = FolMass + BudC / cbm::CCDM;
1261
1262 // limitation of maximum foliage growth by the relative crown cover
1263 double vegRelGrow( 0.0);
1264 vegRelGrow += GROWMAX * p->f_area;
1265
1266 // limitation of maximum foliage growth by the optimum foliage biomass (rg 03.02.11), including height and density impact (rg 19.10.11)
1267 double FolMassOpt( 0.0);
1268 FolMassOpt += m_pf.get_optimum_foliage_biomass_trees( p) * cbm::G_IN_KG;
1269
1270 // excess bud carbon is transferred to sapwood (rg 15.05.11: maximum density effect considered)
1271 if ( FolMassMax > std::min(FolMassOpt, FolMassMaxOld * (1.0 + vegRelGrow * LightEffMin) * 1.0/p->f_area))
1272 {
1273 // (not more than the available bud carbon)
1274 double const excessDW( std::min( FolMassMax - std::min(FolMassOpt, FolMassMaxOld * (1.0 + vegRelGrow * LightEffMin)/p->f_area),
1275 BudC / cbm::CCDM));
1276 BudC -= (excessDW * cbm::CCDM);
1277 FolMassMax = std::min(FolMassOpt, FolMassMaxOld * (1.0 + vegRelGrow * LightEffMin)/p->f_area);
1278 transfDWbs += excessDW * cbm::KG_IN_G;
1279 }
1280
1281 // determination of minimum foliage in the next year
1282 if (FolReten > 0.0)
1283 {
1284 FolMassMin = FolMassMax * (1.0 - 1.0 / FolReten);
1285 }
1286 else
1287 {
1288 FolMassMin = 0.0;
1289 }
1290
1291 // stand death
1292 if (FolMassMax < 0.0)
1293 {
1294 p->mCor += p->mSap;
1295 p->mSap = 0.0;
1296 p->mBud = 0.0;
1297 p->mFrt = 0.0;
1298 }
1299}
static const double GROWMAX
Definition pnet.h:53
double functional_sapwood(MoBiLE_Plant *)
Definition pnet.cpp:638

References AllocateYr(), functional_sapwood(), and GROWMAX.

Referenced by AllocateYr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ balance_check()

void ldndc::PhysiologyPNET::balance_check ( MoBiLE_Plant * p,
unsigned int _i )
private

checks plant carbon and nitrogen balance (_i = 1: start, _i = 2: end of the day)

749{
750 if (_i == 1)
751 {
752 c_begin = cbm::CCDM * (p->mFol + p->mFrt + p->mSap + p->mCor + p->mBud);
753 n_begin = p->mFol * p->ncFol
754 + p->mFrt * p->ncFrt
755 + p->mSap * p->ncSap
756 + p->mCor * p->ncCor
757 + p->mBud * p->ncBud;
758 for ( size_t sl = 0; sl < sl_.soil_layer_cnt(); ++sl)
759 {
760 n_begin += no3_sl[sl] + sc_.nh4_sl[sl];
761 if ( don_uptake_opt)
762 {
763 n_begin += sc_.don_sl[sl];
764 }
765 }
766 }
767 else
768 {
769 double const c_end( cbm::CCDM * (p->mFol + p->mFrt + p->mSap + p->mCor + p->mBud));
770 double n_end( p->mFol * p->ncFol
771 + p->mFrt * p->ncFrt
772 + p->mSap * p->ncSap
773 + p->mCor * p->ncCor
774 + p->mBud * p->ncBud);
775 for ( size_t sl = 0; sl < sl_.soil_layer_cnt(); ++sl)
776 {
777 n_end += no3_sl[sl] + sc_.nh4_sl[sl];
778 if ( don_uptake_opt)
779 {
780 n_end += sc_.don_sl[sl];
781 }
782 }
783 double const c_gains( cbm::sum( p->d_carbonuptake_fl, p->nb_foliagelayers()));
784 double const c_losses( cbm::CCDM * (p->d_sFol +
785 cbm::sum( p->d_sFrt_sl, sl_.soil_layer_cnt()) +
786 mSapTurnover_vt[p->slot] * p->f_branch)
787 + p->d_rRes + p->d_rTra + p->d_rGro);
788 double const n_losses( p->d_nLitFol + cbm::sum( p->d_nLitFrt_sl, sl_.soil_layer_cnt()) + p->d_nLitBud + p->d_nLitWoodAbove);
789
790 double const c_diff( c_begin - c_end + c_gains - c_losses);
791 double const n_diff( n_begin - n_end - n_losses);
792
793
794 if ( std::abs(c_diff) > 1e-10)
795 {
796 KLOGWARN( "C-leak in PNET [time=",lclock_ref().now(),",value=",c_diff,"]");
797 }
798 if ( std::abs(n_diff) > 1e-10)
799 {
800 KLOGWARN( "N-leak in PNET [time=",lclock_ref().now(),",value=",n_diff,"]");
801 }
802 }
803}

References balance_check().

Referenced by balance_check().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CalcVegStructure()

lerr_t ldndc::PhysiologyPNET::CalcVegStructure ( )
private

tree dimensions, mortality and management events (see Stand structure and management)

2064{
2065 lerr_t rc = LDNDC_ERR_OK;
2066
2067 for ( TreeIterator w = m_veg->groupbegin< species::wood >(); w != m_veg->groupend< species::wood >(); ++w)
2068 {
2069 MoBiLE_Plant *p = *w;
2070
2071 // sapwood exceeding the structural demand becomes core wood of the stem without changing the
2072 // crown, i.e., it is subtracted from the sapwood growth instead of being treated as senescence
2073 rc = m_treedyn.Growth( p,
2074 p->d_dcSap - mSapExcess_vt[p->slot] * cbm::CCDM, // daily net sapwood growth (kgC m-2)
2075 mSapTurnover_vt[p->slot], // daily sapwood senescence (kgDW m-2)
2076 competition_opt,
2077 0.0);
2078 if ( rc)
2079 { return LDNDC_ERR_FAIL; }
2080
2081 rc = m_treedyn.OnStructureChange( p);
2082 if ( rc)
2083 { return LDNDC_ERR_FAIL; }
2084
2085 rc = m_treedyn.Mortality(p,
2086 p->d_sWoodAbove, p->d_nLitWoodAbove,
2087 p->d_sWoodBelow_sl, p->d_nLitWoodBelow_sl);
2088 if (rc)
2089 {
2090 return LDNDC_ERR_FAIL;
2091 }
2092
2093 rc = m_treedyn.OnStructureChange(p);
2094 if (rc)
2095 {
2096 return LDNDC_ERR_FAIL;
2097 }
2098
2099 if ( (this->lclock()->day()==1) && (this->lclock()->month()==1))
2100 {
2101 rc = m_treedyn.Crowding( p, crownlength_opt);
2102 if ( rc)
2103 { return LDNDC_ERR_FAIL; }
2104
2105 rc = m_treedyn.OnStructureChange( p);
2106 if ( rc)
2107 { return LDNDC_ERR_FAIL; }
2108 }
2109 }
2110
2111 for ( TreeIterator w = m_veg->groupbegin< species::wood >(); w != m_veg->groupend< species::wood >(); ++w)
2112 {
2113 MoBiLE_Plant *p = *w;
2114 int nb_events = m_treedyn.HandleDisturbanceEvents(
2115 io_kcomm,
2116 crownlength_opt,
2117 p->d_sFol, p->d_nLitFol,
2118 p->d_sBud, p->d_nLitBud,
2119 p->d_sWoodAbove, p->d_nLitWoodAbove,
2120 p->d_sWoodBelow_sl, p->d_nLitWoodBelow_sl,
2121 p->d_sFrt_sl, p->d_nLitFrt_sl);
2122
2123 // note: daily litter variables, since only these are transferred to the soil (see step_out)
2124 nb_events += m_treedyn.HandleEventsHarvest( io_kcomm,
2125 p->d_sFol, p->d_nLitFol, p->d_sBud,
2126 p->d_sWoodAbove, p->d_nLitWoodAbove,
2127 p->d_sWoodBelow_sl, p->d_nLitWoodBelow_sl,
2128 p->d_sFrt_sl, p->d_nLitFrt_sl);
2129 if ( nb_events > 0)
2130 {
2131 return m_treedyn.OnStructureChange( p);
2132 }
2133 else if ( nb_events == -1){ return LDNDC_ERR_FAIL; }
2134 else { /* no op */}
2135 }
2136
2137 return rc;
2138}

References CalcVegStructure().

Referenced by CalcVegStructure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ functional_sapwood()

double ldndc::PhysiologyPNET::functional_sapwood ( MoBiLE_Plant * p)
private

sapwood used for the carbon allocation of PnET (at most QWODFOLMIN times foliage and bud biomass)

639{
640 return std::min( p->mSap, (*p)->QWODFOLMIN() * ( p->mFol + p->mBud));
641}

References functional_sapwood().

Referenced by AllocateYr(), and functional_sapwood().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_na_max_pnet()

size_t ldndc::PhysiologyPNET::get_na_max_pnet ( )
private

number of foliage age classes used by PnET (square root of the total number, rounded up)

736{
737 size_t nb_ageclasses_total( 0.0);
738 for ( PlantIterator vt = m_veg->begin(); vt != m_veg->end(); ++vt)
739 {
740 nb_ageclasses_total += (*vt)->nb_ageclasses();
741 }
742 return (int)ceil(sqrt((double)nb_ageclasses_total));
743}

References get_na_max_pnet().

Referenced by get_na_max_pnet(), TransformPhysiology(), and YearlyReset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ N_uptake()

void ldndc::PhysiologyPNET::N_uptake ( MoBiLE_Plant * p,
double & _n_uptake )
private

nitrogen uptake from the soil (see Nitrogen uptake)

1322{
1323 // nitrogen demand
1324 double nopt( 0.0);
1325 double nact( 0.0);
1326
1327 double nFolOpt_vt( m_pf.optimum_nitrogen_content_foliage( p));
1328 double nBudOpt_vt( m_pf.optimum_nitrogen_content_buds( p));
1329
1330 nopt += nFolOpt_vt + nBudOpt_vt
1331 + p->mFrt * (*p)->NC_FINEROOTS_MAX()
1332 + p->mSap * (*p)->NCSAPOPT();
1333
1334 nact += p->mFol * p->ncFol
1335 + p->mFrt * p->ncFrt
1336 + p->mSap * p->ncSap
1337 + p->mBud * p->ncBud;
1338
1339 double n_demand( cbm::bound_min(0.0, nopt - nact));
1340
1341 // total nitrogen availability
1342 double n_avail( 0.0);
1343 for ( size_t sl = 0; sl < sl_.soil_layer_cnt(); ++sl)
1344 {
1345 if ( cbm::flt_less_equal( sc_.depth_sl[sl], p->rooting_depth))
1346 {
1347 n_avail += (*p)->EXPL_NO3() * no3_sl[sl] +
1348 (*p)->EXPL_NH4() * sc_.nh4_sl[sl];
1349 if ( don_uptake_opt)
1350 {
1351 n_avail += (*p)->EXPL_DON() * FDON_AVAILABLE * sc_.don_sl[sl];
1352 }
1353 }
1354 }
1355
1356 // nitrogen uptake
1357 double n_fact( 0.0);
1358 double const transpiration( wc_.accumulated_wateruptake_sl.sum() - accumulated_transpiration_old);
1359 accumulated_transpiration_old = wc_.accumulated_wateruptake_sl.sum();
1360 if ( cbm::flt_greater_zero( n_avail) &&
1361 cbm::flt_greater_zero( transpiration))
1362 {
1363 n_fact = cbm::bound( 0.0, n_demand / n_avail, 1.0);
1364 }
1365
1366 for ( size_t sl = 0; sl < sl_.soil_layer_cnt(); ++sl)
1367 {
1368 n_avail = no3_sl[sl] + sc_.nh4_sl[sl];
1369 if ( don_uptake_opt)
1370 {
1371 n_avail += FDON_AVAILABLE * sc_.don_sl[sl];
1372 }
1373
1374 double layer_ava_no3( 0.0);
1375 double layer_ava_nh4( 0.0);
1376 double layer_ava_don( 0.0);
1377 if ( cbm::flt_less_equal( sc_.depth_sl[sl], p->rooting_depth) &&
1378 cbm::flt_greater_zero( n_avail) &&
1379 cbm::flt_greater( wc_.wc_sl[sl], wc_.wc_wp_sl[sl]))
1380 {
1381 layer_ava_no3 = (*p)->EXPL_NO3() * no3_sl[sl] * n_fact;
1382 layer_ava_nh4 = (*p)->EXPL_NH4() * sc_.nh4_sl[sl] * n_fact;
1383 if ( don_uptake_opt)
1384 {
1385 layer_ava_don = (*p)->EXPL_DON() * FDON_AVAILABLE * sc_.don_sl[sl] * n_fact;
1386 }
1387 }
1388
1389 double const mfrt_veg_sl( ph_.mfrt_sl(m_veg, sl));
1390 if ( cbm::flt_greater_zero( mfrt_veg_sl))
1391 {
1392 double const fm_vt( p->fFrt_sl[sl] * p->mFrt / mfrt_veg_sl);
1393 _n_uptake += layer_ava_no3 * fm_vt;
1394 _n_uptake += layer_ava_nh4 * fm_vt;
1395
1396 ph_.accumulated_no3_uptake_sl[sl] += layer_ava_no3 * fm_vt;
1397 ph_.accumulated_nh4_uptake_sl[sl] += layer_ava_nh4 * fm_vt;
1398
1399 no3_sl[sl] = cbm::bound_min( 0.0, no3_sl[sl] - layer_ava_no3 * fm_vt);
1400 sc_.nh4_sl[sl] = cbm::bound_min( 0.0, sc_.nh4_sl[sl] - layer_ava_nh4 * fm_vt);
1401
1402 if ( don_uptake_opt)
1403 {
1404 _n_uptake += layer_ava_don * fm_vt;
1405 ph_.accumulated_don_uptake_sl[sl] += layer_ava_don * fm_vt;
1406 sc_.don_sl[sl] = cbm::bound_min( 0.0, sc_.don_sl[sl] - layer_ava_don * fm_vt);
1407 }
1408 }
1409 }
1410}
static const double FDON_AVAILABLE
Definition pnet.h:50

References FDON_AVAILABLE, and N_uptake().

Referenced by N_uptake().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Phenology()

void ldndc::PhysiologyPNET::Phenology ( MoBiLE_Plant * p,
int _GrowthPhase,
double _DWater )
private

foliage flushing (growth phase 1) and senescence (growth phase 2) (see Phenology)

848{
849 if ( _GrowthPhase == 1)
850 {
851 if ( _DWater >= ((*p)->H2OREF_A()*0.5))
852 {
853 p->growing_degree_days += cbm::bound_min( 0.0, mc_.nd_airtemperature);
854 }
855
856 if (( p->growing_degree_days >= (*p)->GDDFOLSTART()) && ( lclock_ref().yearday() >= year_start_) && ( _DWater >= (*p)->H2OREF_A()*0.5))
857 {
858 p->dvsFlushOld = p->dvsFlush;
859 p->dvsFlush = cbm::bound(0.0, (p->growing_degree_days - (*p)->GDDFOLSTART()) / ((*p)->GDDFOLEND() - (*p)->GDDFOLSTART()), 1.0);
860 double const delta_dvsFlush( p->dvsFlush - p->dvsFlushOld);
861
862 if ( p->dvsFlushOld < 0.99)
863 {
864 mature = false;
865 }
866
867 double gFolC( std::min(BudCStart * delta_dvsFlush, BudC));
868 double const OldFolMass( FolMass);
869 FolMass += (gFolC / cbm::CCDM);
870 FolProdCDay = ((FolMass - OldFolMass) * cbm::CCDM);
871 FolGRespDay = (FolProdCDay * (*p)->FYIELD());
872 }
873 else
874 {
875 FolProdCDay = 0.0;
876 FolGRespDay = 0.0;
877 }
878 }
879 else if ( _GrowthPhase == 2)
880 {
881 FolLitSum = 0.0;
882
883 if (( PosCBalMass < FolMass) && mature
884 && (( lclock_ref().yearday() > (unsigned int)((*p)->SENESCSTART()+year_start_-1)) || ( lclock_ref().yearday() < year_start_))
885 && ( lclock_ref().yearday() != year_end_))
886 {
887 // rg 28.03.12 stand density already considered in annual update of foliage values
888 double const FolMassNew( std::max( PosCBalMass, FolMassMin));
889 if (FolMassNew < FolMass)
890 {
891 FolLitSum = FolMass - FolMassNew;
892 }
893
894 if ( FolMassNew > 0.000001)
895 {
896 FolMass = std::min( FolMass, FolMassNew);
897 }
898 else
899 {
900 // remaining foliage is shed completely
901 FolLitSum = FolMass;
902 FolMass = 0.0;
903 }
904 }
905
906 // at the end of the year, foliage exceeding the minimum foliage biomass is shed (also if the carbon
907 // balance of the foliage was never negative)
908 if ( lclock_ref().yearday() == year_end_)
909 {
910 FolLitSum = std::max( 0.0, FolMass - FolMassMin);
911 FolMass = std::min( FolMass, FolMassMin);
912 }
913 }
914 else
915 {
916 KLOGFATAL( "unknown growth phase");
917 }
918}

References Phenology().

Referenced by Phenology().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Photosyn()

void ldndc::PhysiologyPNET::Photosyn ( MoBiLE_Plant * p)
private

canopy photosynthesis and foliage respiration (see Photosynthesis)

980{
981 double Amax(0.0); // foliage nitrogen related maximum net photosynthesis rate (nmol gDW-1 s-1)
982 double BaseFolResp(0.0);
983 double GrossAmax(0.0);
984 double LightEff(0.0);
985 double LayerResp(0.0);
986 double DTemp(0.0);
987 double Il(0.0); // photosynthetic active radiation within the canopy (umol m-2 s-1)
988 double LayerGrossPsnRate(0.0);
989 double LayerNetPsn(0.0);
990 double LayerGrossPsn_i(0.0);
991 double laiEst(0.0); // cumulative leaf area index from the top of the canopy (m2 m-2)
992 double sla(0.0); // specific leaf area (m2 kgDW-1)
993
994 double ten9 = 1000000000.0;
995
996 double const Tnight( (mc_.nd_minimumairtemperature + mc_.nd_airtemperature) * 0.5);
997 double const Tday( (mc_.nd_maximumairtemperature + mc_.nd_airtemperature) * 0.5);
998
999
1000 // relative temperature impact on photosynthesis (daytime temperature)
1001 DTemp = (((*p)->PSNTMAX() - Tday) * (Tday - (*p)->PSNTMIN())) / ( pow((((*p)->PSNTMAX() - (*p)->PSNTMIN()) / 2.0), 2));
1002
1003 // considering frost effects empirically
1004 if (mc_.nd_minimumairtemperature < 6.0 && DTemp > 0.0 && p->growing_degree_days >= (*p)->GDDFOLEND())
1005 {
1006 DTemp *= (1.0 - ((6.0 - mc_.nd_minimumairtemperature) / 6.0) * (1.0 / 30.0));
1007 }
1008
1009 double const daylength_h( ldndc::meteo::daylength( latitude, lclock_ref().yearday()));
1010 double const DayLength = daylength_h * cbm::SEC_IN_HR;
1011 double const NightLength = cbm::SEC_IN_DAY - DayLength;
1012
1013 DTemp = std::max( 0.0, DTemp);
1014
1015 // relative vapour pressure deficit impact on photosynthesis
1016 Dvpd = 1.0 - (*p)->DVPD1() * ( pow( mc_.nd_watervaporsaturationdeficit,(*p)->DVPD2()));
1017
1018 // photosynthesis response to foliage nitrogen
1019 Amax = std::max( 0.0, (*p)->AMAXA() + (*p)->AMAXB() * FolNCon);
1020
1021 // base foliage respiration in relation to photosynthesis
1022 BaseFolResp = (*p)->BASEFOLRESPFRAC() * Amax;
1023
1024 // gross photosynthesis of the day (gC gDW-1)
1025 GrossAmax = (Amax * (*p)->AMAXFRAC() + BaseFolResp) * Dvpd * DTemp * DayLength * 12.0 / ten9;
1026 if (GrossAmax < 0.0) GrossAmax = 0.0;
1027
1028 // foliage respiration during daytime (gC gDW-1)
1029 DayResp = (BaseFolResp * (pow((*p)->RESPQ10(),((Tday - (*p)->PSNTOPT()) / 10.0)))
1030 * DayLength * 12.0) / ten9;
1031
1032 // foliage respiration during nighttime (gC gDW-1)
1033 NightResp = (BaseFolResp * (pow((*p)->RESPQ10(),((Tnight - (*p)->PSNTOPT()) / 10.0)))
1034 * NightLength * 12.0) / ten9;
1035
1036 if ( FolMass > 0.0)
1037 {
1038 PosCBalMass = FolMass;
1039
1040 // initializations
1041 laiEst = 0.0;
1042 double fiCum( 0.0);
1043 CanopyNetPsn = 0.0;
1044 CanopyGrossPsn = 0.0;
1045 size_t flMin( 0);
1046
1047 size_t fl_cnt( m_veg->canopy_layers_used());
1048 // lowest canopy layer with foliage (canopy layer 0 included)
1049 for ( int fl = (int)(fl_cnt-1); fl >= 0; --fl)
1050 {
1051 LayerGrossPsn[fl] = 0.0;
1052 if ( p->fFol_fl[fl] * FolMass > 0.0)
1053 {
1054 flMin = fl;
1055 }
1056 }
1057
1058 bool const growing_season( DTemp > 0.0 && p->growing_degree_days > (*p)->GDDFOLEND()
1059 && lclock_ref().yearday() < (*p)->SENESCSTART()+year_start_-1);
1060
1061 // number of sublayers per canopy layer (about 50 in total)
1062 size_t ifl( cbm::bound_min( (size_t)1, (size_t)( 50.0 / double( fl_cnt - flMin))));
1063
1064 // photosynthetic active radiation above the canopy, daytime mean (umol m-2 s-1)
1065 // (no radiation without daylight, e.g., during polar night)
1066 double const par( cbm::flt_greater_zero( daylength_h) ?
1067 mc_.nd_shortwaveradiation_in * cbm::FPAR * cbm::UMOL_IN_W * cbm::HR_IN_DAY / daylength_h
1068 : 0.0);
1069
1070
1071 // calculations per canopy layer
1072 for ( int fl = (int)(fl_cnt-1); fl >= (int)flMin; --fl)
1073 {
1074 // foliage mass and specific leaf area for each layer
1075 // from the vegetation structure instead of an equal mass distribution
1076 sla = p->sla_fl[fl];
1077 double const fi(( p->fFol_fl[fl] * FolMass) / double(ifl));
1078
1079 // photosynthesis and respiration in each sublayer
1080 for ( size_t i = 0; i < ifl; i++)
1081 {
1082 // cumulative foliage biomass and leaf area
1083 fiCum += fi;
1084 laiEst += (fi * sla * cbm::KG_IN_G);
1085
1086 Il = par * exp(-(*p)->EXT() * laiEst);
1087 LightEff = std::max(0.0, (1.0 - exp(-Il * log(2.0) / (*p)->HALFSAT())));
1088 LayerGrossPsnRate = GrossAmax * LightEff * DWater;
1089 LayerGrossPsn_i = LayerGrossPsnRate * fi;
1090 LayerGrossPsn[fl] += LayerGrossPsn_i;
1091 LayerResp = (DayResp + NightResp) * fi;
1092 LayerNetPsn = LayerGrossPsn_i - LayerResp;
1093 CanopyNetPsn += LayerNetPsn;
1094 CanopyGrossPsn += LayerGrossPsn_i;
1095
1096 if ((LayerNetPsn <= 0.0) && cbm::flt_equal( PosCBalMass, FolMass))
1097 {
1098 PosCBalMass = fiCum;
1099 }
1100
1101 // minimum light efficiency only within the main growing season
1102 // (as for PosCBalMass), not on dark days outside the season
1103 if ( growing_season && ( LightEff < LightEffMin))
1104 {
1105 LightEffMin = LightEff;
1106 }
1107 }
1108 }
1109
1110 if ( growing_season)
1111 {
1112 PosCBalMassTot += ( PosCBalMass);
1113 PosCBalMassIx += 1.0;
1114 }
1115 } // End if FolMass > 0.0
1116 else
1117 {
1118 PosCBalMass = 0.0;
1119 CanopyNetPsn = 0.0;
1120 CanopyGrossPsn = 0.0;
1121 DayResp = 0.0;
1122 NightResp = 0.0;
1123 }
1124
1125 CanopyGrossPsnDay = CanopyGrossPsn;
1126 NetPsnDay = (CanopyGrossPsnDay - (DayResp + NightResp) * FolMass);
1127}

References Photosyn().

Referenced by Photosyn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sapwood_foliage_ratio()

double ldndc::PhysiologyPNET::sapwood_foliage_ratio ( MoBiLE_Plant * p)
private

ratio of the structural sapwood demand to foliage and bud biomass: max(QWODFOLMIN, qsfm)

632{
633 return std::max( (*p)->QWODFOLMIN(), p->qsfm);
634}

References sapwood_foliage_ratio().

Referenced by sapwood_foliage_ratio(), and TransformPhysiology().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sleep()

lerr_t ldndc::PhysiologyPNET::sleep ( )
inline
Note
it is sadly wrong to assume that you can put me to sleep during times when multiple species exist: in general, i cannot handle the resulting slot layout. if you do, i also have no way of knowing .. so beware!
83{ return LDNDC_ERR_OK; }

◆ step_init()

lerr_t ldndc::PhysiologyPNET::step_init ( )
private

handles planting events and copies nitrate of the soil (see Planting)

1929{
1930 for ( size_t sl = 0; sl < sl_.soil_layer_cnt(); ++sl)
1931 {
1932 no3_sl[sl] = sc_.no3_sl[sl] + sc_.an_no3_sl[sl];
1933 }
1934
1935 size_t const slot_cnt = m_veg->slot_cnt();
1936
1937 mBudLoss_vt.resize_and_preserve( slot_cnt, 0.0); // dry matter transferred from buds to foliage
1938 mBudLoss_vt = 0.0;
1939 mSapLoss_vt.resize_and_preserve( slot_cnt, 0.0); // dry matter transferred from sapwood to core wood
1940 mSapLoss_vt = 0.0;
1941 mSapTurnover_vt.resize_and_preserve( slot_cnt, 0.0);
1942 mSapTurnover_vt = 0.0;
1943 mSapExcess_vt.resize_and_preserve( slot_cnt, 0.0);
1944 mSapExcess_vt = 0.0;
1945
1946 year_end_ = lclock_ref().days_in_year();
1947
1948 EventAttributes const * ev_plant = NULL;
1949 while (( ev_plant = this->m_PlantEvents.pop()) != NULL)
1950 {
1951 char const * group = ev_plant->get( "/group", "?");
1952 if ( cbm::is_equal( group, "wood")) // TODO could be done at "push-time"
1953 {
1954 // TODO create plant..
1955 MoBiLE_Plant * vt = this->m_veg->get_plant( ev_plant->get( "/name", "?"));
1956 if ( !vt)
1957 { return LDNDC_ERR_RUNTIME_ERROR; }
1958 CBM_LogDebug( "Seed plant '",vt->name(),"'");
1959
1960 species_t const * sp = NULL;
1961 if ( m_species)
1962 {
1963 sp = m_species->get_species( vt->cname());
1964 }
1965
1966 lerr_t rc_plant = m_pf.initialize_tree( vt, sp->wood(), crownlength_opt, competition_opt);
1967 if ( rc_plant)
1968 {
1969 KLOGERROR( "Handling plant event failed [species=", vt->name(),"]");
1970 return LDNDC_ERR_FAIL;
1971 }
1972 }
1973 }
1974
1975 return LDNDC_ERR_OK;
1976}

References step_init().

Referenced by step_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ step_out()

lerr_t ldndc::PhysiologyPNET::step_out ( )
private

transfers litter and nitrate to soil chemistry (see Transfer to soil chemistry)

1991{
1992 for ( size_t sl = 0; sl < sl_.soil_layer_cnt(); ++sl)
1993 {
1994 double const no3_before( sc_.no3_sl[sl] + sc_.an_no3_sl[sl]);
1995 if ( cbm::flt_greater_zero( no3_before))
1996 {
1997 sc_.no3_sl[sl] = sc_.no3_sl[sl] / no3_before * no3_sl[sl];
1998 sc_.an_no3_sl[sl] = cbm::bound_min( 0.0, no3_sl[sl] - sc_.no3_sl[sl]);
1999 }
2000 else
2001 {
2002 sc_.no3_sl[sl] = 0.0;
2003 sc_.an_no3_sl[sl] = 0.0;
2004 }
2005 }
2006
2007 for ( PlantIterator vt = this->m_veg->begin(); vt != this->m_veg->end(); ++vt)
2008 {
2009 MoBiLE_Plant *p = *vt;
2010
2011 /* Aboveground litter*/
2012 sc_.c_raw_lit_1_above += ((p->d_sFol + p->d_sBud) * (1.0 - vt->CELLULOSE() - vt->LIGNIN())) * cbm::CCDM;
2013 sc_.c_raw_lit_2_above += ((p->d_sFol + p->d_sBud) * vt->CELLULOSE()) * cbm::CCDM;
2014 sc_.c_raw_lit_3_above += ((p->d_sFol + p->d_sBud) * vt->LIGNIN()) * cbm::CCDM;
2015
2016 sc_.n_raw_lit_1_above += (p->d_nLitFol + p->d_nLitBud) * (1.0 - vt->CELLULOSE() - vt->LIGNIN());
2017 sc_.n_raw_lit_2_above += (p->d_nLitFol + p->d_nLitBud) * vt->CELLULOSE();
2018 sc_.n_raw_lit_3_above += (p->d_nLitFol + p->d_nLitBud) * vt->LIGNIN();
2019
2020 sc_.accumulated_c_litter_above += (p->d_sFol + p->d_sBud) * cbm::CCDM;
2021 sc_.accumulated_n_litter_above += (p->d_nLitFol + p->d_nLitBud);
2022
2023 sc_.c_wood += p->d_sWoodAbove * cbm::CCDM;
2024 sc_.accumulated_c_litter_wood_above += p->d_sWoodAbove * cbm::CCDM;
2025
2026 sc_.n_wood += p->d_nLitWoodAbove;
2027 sc_.accumulated_n_litter_wood_above += p->d_nLitWoodAbove;
2028
2029 /* Belowground wood and fine roots */
2030 for ( size_t sl = 0; sl < sl_.soil_layer_cnt(); sl++)
2031 {
2032 sc_.c_wood_sl[sl] += p->d_sWoodBelow_sl[sl] * cbm::CCDM;
2033 sc_.accumulated_c_litter_wood_below_sl[sl] += p->d_sWoodBelow_sl[sl] * cbm::CCDM;
2034
2035 sc_.n_wood_sl[sl] += p->d_nLitWoodBelow_sl[sl];
2036 sc_.accumulated_n_litter_wood_below_sl[sl] += p->d_nLitWoodBelow_sl[sl];
2037
2038 sc_.c_raw_lit_1_sl[sl] += p->d_sFrt_sl[sl] * (1.0 - vt->CELLULOSE() - vt->LIGNIN()) * cbm::CCDM;
2039 sc_.c_raw_lit_2_sl[sl] += p->d_sFrt_sl[sl] * vt->CELLULOSE() * cbm::CCDM;
2040 sc_.c_raw_lit_3_sl[sl] += p->d_sFrt_sl[sl] * vt->LIGNIN() * cbm::CCDM;
2041 sc_.accumulated_c_litter_below_sl[sl] += p->d_sFrt_sl[sl] * cbm::CCDM;
2042
2043 sc_.n_raw_lit_1_sl[sl] += p->d_nLitFrt_sl[sl] * (1.0 - vt->CELLULOSE() - vt->LIGNIN());
2044 sc_.n_raw_lit_2_sl[sl] += p->d_nLitFrt_sl[sl] * vt->CELLULOSE();
2045 sc_.n_raw_lit_3_sl[sl] += p->d_nLitFrt_sl[sl] * vt->LIGNIN();
2046 sc_.accumulated_n_litter_below_sl[sl] += p->d_nLitFrt_sl[sl];
2047 }
2048 }
2049
2050 return LDNDC_ERR_OK;
2051}

References step_out().

Referenced by step_out().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TransformPhysiology()

void ldndc::PhysiologyPNET::TransformPhysiology ( MoBiLE_Plant * p)
private

carbon balance, respiration, litter and biomass update (see Carbon balance and biomass update)

1443{
1444 double mSum(0.0),maintResp(0.0),fResp(0.0);
1445 double dcTot(0.0),dcSapC(0.0),dcBudC(0.0),dcFrtC(0.0),dBudY(0.0),dSapY(0.0);
1446 double fm_vt(0.0),fwood(0.0);
1447
1448 // carbon available for growth: gross photosynthesis minus maintenance and growth respiration
1449 // (fine root growth is subtracted below)
1450 dcTot = (CanopyGrossPsnDay
1451 - (CanopyGrossPsnDay - NetPsnDay) - WoodMRespDay - RootMRespDay
1452 - FolGRespDay - WoodGRespDay - RootGRespDay);
1453
1454 // reduction of maintenance respiration if the carbon balance is negative
1455 // (introduced for Eucalyptus plantations under severe drought)
1456 if (dcTot < 0.0)
1457 {
1458 maintResp = WoodMRespDay + RootMRespDay + (CanopyGrossPsnDay - NetPsnDay);
1459 if (maintResp > 0.0)
1460 {
1461 fResp = (maintResp + dcTot) / maintResp;
1462 }
1463
1464 if (fResp < 0.0)
1465 {
1466 fResp = 0.0;
1467 }
1468
1469 WoodMRespDay *= fResp;
1470 RootMRespDay *= fResp;
1471
1472 NetPsnDay = CanopyGrossPsnDay - fResp * (CanopyGrossPsnDay - NetPsnDay);
1473 dcTot = (CanopyGrossPsnDay
1474 - (CanopyGrossPsnDay - NetPsnDay) - WoodMRespDay - RootMRespDay
1475 - FolGRespDay - WoodGRespDay - RootGRespDay);
1476
1477 // a negative balance is taken from buds and sapwood (see below); if it exceeds the sapwood,
1478 // growth respiration and the remaining maintenance respiration are omitted
1479 if (dcTot < 0.0 && std::abs(dcTot) > WoodC)
1480 {
1481 FolGRespDay = 0.0;
1482 WoodMRespDay = 0.0;
1483 WoodGRespDay = 0.0;
1484 RootMRespDay = 0.0;
1485 RootGRespDay = 0.0;
1486
1487 dcTot = (CanopyGrossPsnDay
1488 - (CanopyGrossPsnDay - NetPsnDay) - WoodMRespDay - RootMRespDay
1489 - FolGRespDay - WoodGRespDay - RootGRespDay);
1490 }
1491 }
1492
1493 // wood and reserve change
1494 /* If growth is negative, it is taken only from free available tissue. This is
1495 assumed to be the whole labile reserve pool and 20 percent of woody tissue. */
1496 if (dcTot > 0.0 && p->dvsFlushOld >= 1.0) // positive gain, after flushing
1497 {
1498 fwood = (*p)->QWODFOLMIN() / (1.0 + (*p)->QWODFOLMIN());
1499 }
1500 else if (BudC + WoodC * 0.2 > 0.0 && p->dvsFlushOld >= 1.0) // negative gain, after flushing
1501 {
1502 fwood = WoodC * 0.2 / (BudC + WoodC * 0.2);
1503 }
1504 else // before flushing
1505 {
1506 fwood = 1.0;
1507 }
1508
1509 dcFrtC = std::max(0.0, std::min(dcTot, RootCAddDay)); // root growth has priority, but is limited by availability
1510 dcSapC = (dcTot-dcFrtC) * fwood;
1511 dcBudC = (dcTot-dcFrtC) * (1.0 - fwood);
1512
1513 mSum = 0.0;
1514 mSum += (p->mFol + p->mFrt + p->mSap + p->mBud);
1515 p->mFolMax = 0.0;
1516 p->mFolMin = 0.0;
1517
1518 // biomass fraction of the species (1 for a single species) including the conversion from g to kg
1519 if (mSum > 0.0)
1520 {
1521 fm_vt = ((p->mFol + p->mFrt + p->mSap + p->mBud) / mSum);
1522
1523 if (fm_vt > 1.0)
1524 {
1525 fm_vt = 1.0;
1526 }
1527
1528 fm_vt *= cbm::KG_IN_G;
1529 }
1530 else
1531 {
1532 fm_vt = 0.0;
1533 }
1534
1535 // growth
1536 p->d_dcFol = FolProdCDay * fm_vt; // shift from buds to foliage
1537 mBudLoss_vt[p->slot] = p->d_dcFol / cbm::CCDM;
1538 p->d_dcFrt = dcFrtC * fm_vt; // growth from assimilated carbon
1539 p->d_dcSap = dcSapC * fm_vt;
1540 p->d_dcBud = dcBudC * fm_vt;
1541
1542 // respiration
1543 double const sap_wood_frac( 1.0 - p->fraction_aboveground().living);
1544 double const dc_sum( std::max( 0.0, p->d_dcFol)
1545 + std::max( 0.0, p->d_dcFrt)
1546 + std::max( 0.0, p->d_dcSap)
1547 + std::max( 0.0, p->d_dcBud));
1548 double const dc_below( std::max( 0.0, p->d_dcFrt) + std::max( 0.0, p->d_dcSap * sap_wood_frac));
1549
1550 p->d_rFol = (CanopyGrossPsnDay - NetPsnDay) * fm_vt;
1551 p->d_rFrt = RootMRespDay * fm_vt;
1552 p->d_rSap = WoodMRespDay * fm_vt;
1553 p->d_rSapBelow = (p->d_rSap * sap_wood_frac);
1554 p->d_rBud = 0.0;
1555 p->d_rRes = p->d_rFol + p->d_rFrt + p->d_rSap + p->d_rBud;
1556 p->d_rTra = 0.0;
1557 p->d_rGro = (WoodGRespDay + RootGRespDay + FolGRespDay) * fm_vt;
1558 p->d_rGroBelow = ((dc_sum > 0.0) ? p->d_rGro * dc_below / dc_sum : 0.0);
1559
1560 // senescence
1561 p->d_sFol = FolLitSum * fm_vt;
1562 for ( size_t sl = 0; sl < sl_.soil_layer_cnt(); ++sl)
1563 {
1564 p->d_sFrt_sl[sl] += RootProdCDay / cbm::CCDM * fm_vt * p->fFrt_sl[sl];
1565 }
1566
1567 // sapwood senescence: age related loss of sapwood area (TOSAP per day, as in PSIM, only for trees
1568 // taller than HREF), which raises the crown base in the tree dynamics; the branch fraction becomes
1569 // aboveground wood litter
1570 mSapTurnover_vt[p->slot] = 0.0;
1571 if (( p->height_max - cbm::HLIMIT) > (*p)->HREF())
1572 {
1573 double const area_loss( p->sap_area * (*p)->TOSAP());
1574 double const sSap_tree( (*p)->DSAP() * cbm::DM3_IN_M3 * area_loss
1575 * ( p->h_trunk + p->h_crown / 3.0 * (1.0 + (*p)->FBRA()) + p->h_depth / 3.0 * (1.0 + p->fcrt_eff())));
1576 mSapTurnover_vt[p->slot] = cbm::bound( 0.0, sSap_tree * p->tree_number * cbm::HA_IN_M2, p->mSap);
1577 }
1578
1579 // sapwood exceeding the structural sapwood demand is turned into core wood of the stem (heartwood
1580 // formation), which does not change the crown
1581 mSapExcess_vt[p->slot] = 0.0;
1582 double const mSapMax( (p->mFol + p->mBud) * sapwood_foliage_ratio( p));
1583 if ((( p->mSap - mSapTurnover_vt[p->slot]) * 0.99999) > mSapMax)
1584 {
1585 mSapExcess_vt[p->slot] = std::max( 0.0, std::min( SRATEMAX * p->mSap, p->mSap - mSapTurnover_vt[p->slot] - mSapMax));
1586 }
1587 mSapLoss_vt[p->slot] = mSapTurnover_vt[p->slot] + mSapExcess_vt[p->slot];
1588 p->d_sWoodAbove = mSapTurnover_vt[p->slot] * p->f_branch;
1589
1590 // senescence due to annual shift between biomasses (transfDWsb, transfDWbs in kgDW m-2)
1591 double const f_vt( fm_vt * cbm::G_IN_KG);
1592 dBudY = transfDWsb * f_vt;
1593 dSapY = transfDWbs * f_vt;
1594
1595 // no transfer of more biomass than available after growth and losses of the day
1596 // (avoids negative biomass, which would be set to zero and violate the carbon balance)
1597 dBudY = std::max( 0.0, std::min( dBudY, p->mSap + p->d_dcSap / cbm::CCDM - mSapLoss_vt[p->slot]));
1598 dSapY = std::max( 0.0, std::min( dSapY, p->mBud + p->d_dcBud / cbm::CCDM - mBudLoss_vt[p->slot] + dBudY));
1599
1600 // biomass update
1601 p->mFol = FolMass * fm_vt;
1602 p->mFrt += ((p->d_dcFrt / cbm::CCDM - cbm::sum( p->d_sFrt_sl, sl_.soil_layer_cnt())));
1603 p->mSap += ((p->d_dcSap / cbm::CCDM - mSapLoss_vt[p->slot]) - dBudY);
1604 p->mBud += ((p->d_dcBud / cbm::CCDM - mBudLoss_vt[p->slot]) + dBudY - dSapY);
1605 p->mCor += (mSapLoss_vt[p->slot] - mSapTurnover_vt[p->slot] * p->f_branch + dSapY);
1606
1607 // foliage biomass in age classes (rg 08.06.10)
1608 p->mFol_na[0] += p->d_dcFol;
1609 if ( get_na_max_pnet() > 0)
1610 {
1611 p->mFol_na[get_na_max_pnet()-1] -= p->d_sFol;
1612 for ( size_t na = 0; na < get_na_max_pnet(); ++na)
1613 {
1614 if ( p->mFol_na[na] < 0.0)
1615 {
1616 p->mFol_na[na] = 0.0;
1617 }
1618 }
1619 }
1620
1621 // control values for next year
1622 p->mBudStart = p->mBud;
1623 p->mFolMax += (FolMassMax * fm_vt);
1624 p->mFolMin += (FolMassMin * fm_vt);
1625
1626 /* Note that if one of the following equations applies, the carbon balance is not closed any more */
1627 if ( p->mFrt < 0.0)
1628 {
1629 if (( p->mFrt > 1e-7) || (-1 * p->mFrt > 1e-7))
1630 {
1631 KLOGWARN(" mFrt-C-leak in PNET [day=",lclock_ref().now().to_string(),",mFrt=",p->mFrt,"]");
1632 }
1633 p->mFrt = 0.0;
1634 }
1635
1636 if ( p->mSap < 0.0)
1637 {
1638 if (p->mSap > 1e-7 || -1 * p->mSap > 1e-7)
1639 {
1640 KLOGWARN(" mSap-C-leak in PNET [day=",lclock_ref().now().to_string(),",mSap=",p->mSap,"]");
1641 }
1642 p->mSap = 0.0;
1643 }
1644
1645 if ( p->mBud < 0.0)
1646 {
1647 if (p->mBud > 1e-7 || -1 * p->mBud > 1e-7)
1648 {
1649 KLOGWARN(" mBud-C-leak in PNET [day=",lclock_ref().now().to_string(),",mBud=",p->mBud,"]");
1650 }
1651 p->mBud = 0.0;
1652 }
1653
1654 if (( p->growing_degree_days >= (*p)->GDDFOLSTART()) && ( p->dEmerg == 0))
1655 {
1656 p->dEmerg = lclock_ref().yearday();
1657 }
1658
1659
1660 if ( mature
1661 && ( p->f_area > 0.0)
1662 && (lclock_ref().yearday() > (unsigned int)((*p)->SENESCSTART()+year_start_-1)
1663 || lclock_ref().yearday() < year_start_)
1664 && lclock_ref().yearday() != lclock_ref().days_in_year())
1665 {
1666 // rg 08.06.10 (no senescence at the last day of the year)
1667 p->dvsMort = 1.0 - (FolMass / p->f_area - FolMassMin) / ( std::max(FolMass / p->f_area, FolMassMax) - FolMassMin);
1668 }
1669 else
1670 {
1671 p->dvsMort = 0.0;
1672 }
1673
1674
1675 if (p->dvsMort < 0.0)
1676 {
1677 p->dvsMort = 0.0;
1678 }
1679 else if (p->dvsMort > 1.0)
1680 {
1681 p->dvsMort = 1.0;
1682 }
1683
1684 size_t fl_cnt( p->nb_foliagelayers());
1685 m_pf.update_foliage_layer_biomass_and_lai( p, fl_cnt, 0.001);
1686
1687 // gross carbon uptake per canopy layer (distributed over the time steps with timemode "subdaily")
1688 for ( size_t fl = 0; fl < fl_cnt; ++fl)
1689 {
1690 p->d_carbonuptake_fl[fl] = LayerGrossPsn[fl] * cbm::KG_IN_G;
1691 }
1692}
double sapwood_foliage_ratio(MoBiLE_Plant *)
Definition pnet.cpp:631
static const double SRATEMAX
Definition pnet.h:44
size_t get_na_max_pnet()
Definition pnet.cpp:735

References get_na_max_pnet(), sapwood_foliage_ratio(), SRATEMAX, and TransformPhysiology().

Referenced by TransformPhysiology().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Update()

void ldndc::PhysiologyPNET::Update ( MoBiLE_Plant * _vt,
double _upt1_vt,
double _upt2_vt )
private

nitrogen allocation and concentrations (see Nitrogen allocation)

1712{
1713 // component demand
1714 double nFolOpt_vt( m_pf.optimum_nitrogen_content_foliage( _vt));
1715 double nBudOpt_vt( m_pf.optimum_nitrogen_content_buds( _vt));
1716
1717 // optimum nitrogen contents
1718 double ncFolOpt( (_vt->mFol > 0.0) ? nFolOpt_vt/_vt->mFol : 0.0);
1719 double ncBudOpt( (_vt->mBud > 0.0) ? nBudOpt_vt/_vt->mBud : 0.0);
1720
1721
1722 // component demand of compartments
1723 double demFol( std::max(0.0, (ncFolOpt - _vt->ncFol) * mFolOld_vt[_vt]
1724 + ncFolOpt * (_vt->mFol - mFolOld_vt[_vt])));
1725 double demFrt( std::max(0.0, ((*_vt)->NC_FINEROOTS_MAX() - _vt->ncFrt) * mFrtOld_vt[_vt]
1726 + (*_vt)->NC_FINEROOTS_MAX() * (_vt->mFrt - mFrtOld_vt[_vt])));
1727 double demSap( std::max(0.0, ((*_vt)->NCSAPOPT() - _vt->ncSap) * mSapOld_vt[_vt]
1728 + (*_vt)->NCSAPOPT() * (_vt->mSap - mSapOld_vt[_vt])));
1729 double demBud( std::max(0.0, (ncBudOpt - _vt->ncBud) * mBudOld_vt[_vt]
1730 + ncBudOpt * (_vt->mBud - mBudOld_vt[_vt])));
1731 double demTot = (demFol + demFrt + demSap + demBud);
1732
1733
1734 // accounting for biomass shifts at the end of a year
1735 double transfBud( (transfDWbs > 0.0) ?
1736 std::max(0.0,
1737 (mBudOld_vt[_vt] - mBudLoss_vt[_vt->slot] + _vt->d_dcBud/cbm::CCDM
1738 - _vt->mBud) * _vt->ncBud)
1739 : 0.0);
1740
1741 double transfSap( (transfDWsb > 0.0) ?
1742 std::max(0.0,
1743 (mSapOld_vt[_vt] - mSapLoss_vt[_vt->slot] + _vt->d_dcSap/cbm::CCDM
1744 - _vt->mSap) * _vt->ncSap)
1745 : 0.0);
1746
1747
1748 // element losses // rg 08.12.10 simplified
1749 // the minimum function is needed to guarantee mass conservation.
1750 // there is no more nitrogen loss allowed than present at the beginning of the time step
1751 double xlossFol( std::min(_vt->d_sFol, mFolOld_vt[_vt]) * _vt->ncFol);
1752 double xlossFrt( std::min(cbm::sum(_vt->d_sFrt_sl, sl_.soil_layer_cnt()), mFrtOld_vt[_vt]) * _vt->ncFrt);
1753 double xlossBud( std::min(mBudLoss_vt[_vt->slot], mBudOld_vt[_vt]) * _vt->ncBud);
1754 double xlossSap( std::min(mSapLoss_vt[_vt->slot], mSapOld_vt[_vt]) * _vt->ncSap);
1755
1756
1757 // nitrogen uptake
1758 double xdist_up( _upt1_vt + _upt2_vt);
1759
1760
1761 // nitrogen retention
1762 // note: elements are principally neither retranslocated from sapwood
1763 // when turned into corewood nor from fine roots (Gordon and Jackson 2000)
1764 _vt->d_n_retention = ( xlossFol * (*_vt)->FRET_N());
1765
1766
1767 // total nitrogen availability for distribution
1768 double xdistTot( xdist_up + _vt->d_n_retention);
1769
1770
1771 // correct nitrogen retention in case exceeding demand
1772 if (demTot < xdistTot)
1773 {
1774 // reduced nitrogen retention
1775 double const xret_reduced( std::max(demTot - xdist_up, 0.0));
1776 _vt->d_n_retention = xret_reduced;
1777 xdistTot = (xdist_up + xret_reduced);
1778 }
1779
1780
1781 // components from uptake and retranslocation to be distributed between plant tissues
1782 // by internal translocation from sapwood to corewood
1783 double const fLitSap( cbm::flt_greater_zero( mSapLoss_vt[_vt->slot]) ?
1784 mSapTurnover_vt[_vt->slot] * _vt->f_branch / mSapLoss_vt[_vt->slot] : 0.0);
1785 double xdistCor( xlossSap * (1.0 - fLitSap));
1786
1787
1788 // by internal translocation from buds to foliage
1789 double xlitBud( 0.0);
1790 double xfolBud( xlossBud);
1791 if (xlossBud < demFol)
1792 {
1793 demFol -= xlossBud;
1794 demTot -= xlossBud;
1795 }
1796 else
1797 {
1798 xlitBud = xlossBud;
1799 xfolBud = 0.0;
1800 }
1801
1802
1803 // nitrogen distribution to components
1804 double xdistFol( 0.0);
1805 double xdistFrt( 0.0);
1806 double xdistSap( 0.0);
1807 double xdistBud( 0.0);
1808 double xrest( 0.0);
1809
1810 if (demTot > xdistTot) // any available element is taken up
1811 {
1812 xdistFol = xdistTot * demFol / demTot;
1813 xdistFrt = xdistTot * demFrt / demTot;
1814 xdistSap = xdistTot * demSap / demTot;
1815 xdistBud = xdistTot * demBud / demTot;
1816 xrest = 0.0;
1817 }
1818 else if (xdistTot > 0.0) // every element demand is saturated
1819 {
1820 xdistFol = demFol;
1821 xdistFrt = demFrt;
1822 xdistSap = demSap;
1823 xdistBud = demBud;
1824 xrest = xdistTot - demTot;
1825 }
1826
1827
1828 // not needed elements are distributed to litter
1829 if ( xrest > 0.0)
1830 {
1831 double const m_tot( mFolOld_vt[_vt]+mBudOld_vt[_vt]+mFrtOld_vt[_vt]+mSapOld_vt[_vt]);
1832 if (cbm::flt_equal_zero( m_tot))
1833 {
1834 KLOGWARN("No more living biomass for species ", _vt->name());
1835 }
1836 else
1837 {
1838 _vt->d_nLitFol += (xrest * mFolOld_vt[_vt] / m_tot);
1839 _vt->d_nLitWoodAbove += (xrest * mSapOld_vt[_vt] / m_tot);
1840 _vt->d_nLitBud += (xrest * mBudOld_vt[_vt] / m_tot);
1841 for ( size_t sl = 0; sl < sl_.soil_layer_cnt(); ++sl)
1842 {
1843 _vt->d_nLitFrt_sl[sl] += (xrest * mFrtOld_vt[_vt] / m_tot * _vt->fFrt_sl[sl]);
1844 }
1845 }
1846 }
1847
1848 _vt->d_nLitBud += xlitBud;
1849 _vt->d_nLitFol += (xlossFol - _vt->d_n_retention);
1850 _vt->d_nLitWoodAbove += (xlossSap * fLitSap);
1851 for ( size_t sl = 0; sl < sl_.soil_layer_cnt(); ++sl)
1852 {
1853 _vt->d_nLitFrt_sl[sl] += xlossFrt * _vt->fFrt_sl[sl];
1854 }
1855
1856 // new concentrations
1857 // (nitrogen of compartments without biomass is transferred to litter to close the nitrogen balance)
1858 double const nFol( std::max(0., mFolOld_vt[_vt] * _vt->ncFol + xdistFol + xfolBud - xlossFol));
1859 double const nBud( std::max(0., mBudOld_vt[_vt] * _vt->ncBud + xdistBud - xlossBud - transfBud + transfSap));
1860 double const nFrt( std::max(0., mFrtOld_vt[_vt] * _vt->ncFrt + xdistFrt - xlossFrt));
1861 double const nCor( std::max(0., mCorOld_vt[_vt] * _vt->ncCor + xdistCor + transfBud));
1862 double const nSap( std::max(0., mSapOld_vt[_vt] * _vt->ncSap + xdistSap - xlossSap - transfSap));
1863
1864 if (_vt->mFol > 1.0e-9)
1865 {
1866 _vt->ncFol = nFol / _vt->mFol;
1867 }
1868 else
1869 {
1870 _vt->ncFol = 0.0;
1871 _vt->d_nLitFol += nFol;
1872 }
1873
1874 if (_vt->mBud > 1.0e-9)
1875 {
1876 _vt->ncBud = nBud / _vt->mBud;
1877 }
1878 else
1879 {
1880 _vt->ncBud = 0.0;
1881 _vt->d_nLitBud += nBud;
1882 }
1883
1884 if (_vt->mFrt > 1.0e-9)
1885 {
1886 _vt->ncFrt = nFrt / _vt->mFrt;
1887 }
1888 else
1889 {
1890 _vt->ncFrt = 0.0;
1891 double const fFrt_sum( cbm::sum( _vt->fFrt_sl, sl_.soil_layer_cnt()));
1892 for ( size_t sl = 0; sl < sl_.soil_layer_cnt(); ++sl)
1893 {
1894 _vt->d_nLitFrt_sl[sl] += ( cbm::flt_greater_zero( fFrt_sum) ?
1895 nFrt * _vt->fFrt_sl[sl] / fFrt_sum : (( sl == 0) ? nFrt : 0.0));
1896 }
1897 }
1898
1899 if (_vt->mCor > 1.0e-9)
1900 {
1901 _vt->ncCor = nCor / _vt->mCor;
1902 }
1903 else
1904 {
1905 _vt->ncCor = 0.0;
1906 _vt->d_nLitWoodAbove += nCor;
1907 }
1908
1909 if (_vt->mSap > 1.0e-9)
1910 {
1911 _vt->ncSap = nSap / _vt->mSap;
1912 }
1913 else
1914 {
1915 _vt->ncSap = 0.0;
1916 _vt->d_nLitWoodAbove += nSap;
1917 }
1918}

References Update().

Referenced by Update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_nitrogen_concentration()

void ldndc::PhysiologyPNET::update_nitrogen_concentration ( MoBiLE_Plant * p)
private

foliage nitrogen concentration for photosynthesis, limited to the optimum

809{
810 double const nFolOpt( m_pf.optimum_nitrogen_content_foliage( p));
811
812 FolNCon = 0.0;
813 double FolNConOpt( 0.0);
814 if (p->mFol > 0.0)
815 {
816 FolNCon += (p->ncFol * cbm::PRO_IN_GG * p->mFol / p->mFol);
817 FolNConOpt += (nFolOpt / p->mFol * cbm::PRO_IN_GG * p->mFol / p->mFol);
818 }
819
820 FolNCon = std::min( FolNCon, FolNConOpt);
821}

References update_nitrogen_concentration().

Referenced by update_nitrogen_concentration().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ YearlyReset()

void ldndc::PhysiologyPNET::YearlyReset ( MoBiLE_Plant * p)
private

resets phenology and foliage age classes at the start of the vegetation year (see Start of the vegetation year)

683{
684 if ( lclock_ref().yearday() != year_start_)
685 {
686 return;
687 }
688
689 p->dEmerg = 0;
690 p->growing_degree_days = 0.0;
691 p->dvsFlush = 0.0;
692 p->dvsFlushOld = 0.0;
693 p->dvsWood = 0.0;
694
695 /* rg 24.02.11
696 * (re-initialization of biomass according foliage longvity based on the expected maximum foliage mFolMax)
697 * rg 20.01.12
698 * (shift from calculating only once to calculating every year start
699 * (account for new initialization after regeneration)
700 * rg 28.03.12
701 * (considering new nitrogen concentrations after adjustment of biomasses, including an adjustment factor)
702 */
703 if ( get_na_max_pnet() > 1)
704 {
705 double mFolNew = p->mFolMax * (1.0 - 1.0 / double(get_na_max_pnet()));
706 double mBudNew = mFolNew / double(get_na_max_pnet()-1);//assuming no flush of foliage
707 double mSapNew = p->mSap - (mFolNew + mBudNew - p->mFol - p->mBud);
708 double dnfol = (p->mFol - mFolNew) * p->ncFol;
709 // without (new) biomass the concentrations are kept (avoids 0/0 for stands without foliage)
710 double ncFolNew = (mFolNew > 0.0) ? (p->mFol * p->ncFol - dnfol) / mFolNew : p->ncFol;
711 double ncBudNew = (mBudNew > 0.0) ? (p->mBud * p->ncBud + dnfol) / mBudNew : p->ncBud;
712 double ncSapNew = (mSapNew > 0.0) ? (p->mSap * p->ncSap) / mSapNew : p->ncSap;
713
714 p->ncFol = ncFolNew;
715 p->ncBud = ncBudNew;
716 p->ncSap = ncSapNew;
717 p->mFol = mFolNew;
718 p->mBud = mBudNew;
719 p->mSap = mSapNew;
720 p->mBudStart = p->mBud;
721 p->mFolMin = p->mFol;
722 }
723
724 double const mfol_va( p->mFolMax - p->mFolMin);
725 p->mFol_na[0] = 0.0;
726 for ( size_t na = 1; na < get_na_max_pnet(); ++na)
727 {
728 p->mFol_na[na] = mfol_va;
729 }
730}

References get_na_max_pnet(), and YearlyReset().

Referenced by YearlyReset().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ FDON_AVAILABLE

double const ldndc::PhysiologyPNET::FDON_AVAILABLE = 0.1
staticprivate

plant available fraction of dissolved organic nitrogen (option "donuptake")

Referenced by N_uptake().

◆ GROWMAX

double const ldndc::PhysiologyPNET::GROWMAX = 0.95
staticprivate

fraction of uncovered area that can be reoccupied in one year

Referenced by AllocateYr().

◆ NUPTAIR

double const ldndc::PhysiologyPNET::NUPTAIR = 0.0
staticprivate

fraction of nitrogen from total deposition that is taken up by the canopy (currently not used)

◆ SRATEMAX

double const ldndc::PhysiologyPNET::SRATEMAX = 0.01
staticprivate

maximum fraction of sapwood that is turned into core wood per day (-)

Referenced by TransformPhysiology().