LandscapeDNDC 1.37.0
pnet.h
1
8#ifndef LM_PHYSIOLOGY_PNET_H_
9#define LM_PHYSIOLOGY_PNET_H_
10
11
12#include "mbe_legacymodel.h"
13#include "state/mbe_state.h"
14#include "ld_shared.h"
15#include "physiology/ld_plantfunctions.h"
16#include "physiology/ld_treedyn.h"
17
18#include <logging/cbm_logging.h>
19
20namespace ldndc {
21
22extern cbm::logger_t * PhysiologyPNETLogger;
23
32class LDNDC_API PhysiologyPNET : public MBE_LegacyModel
33{
34 LMOD_EXPORT_MODULE_INFO(PhysiologyPNET,"physiology:pnet","Physiology PNET");
35
36 /*** module specific constants ***/
37
39 static const double TMIN_NUP;
40
42 static const double TMAX_NUP;
43
45 static const double KM_NO3;
46
48 static const double KM_NH4;
49
51 static const double SRATEMAX;
52
54 static const double C;
55
57 static const double K;
58
60 static const double P;
61
63 static const double BETA;
64
66 static const double TEQ;
67
69 static const double TRANGE;
70
72 static const double NUPTAIR;
73
75 static const double GROWMAX;
76
77
78 public:
80 MoBiLE_State *,
81 cbm::io_kcomm_t *,
82 timemode_e);
83
85
86 lerr_t register_ports( cbm::io_kcomm_t * );
87 lerr_t unregister_ports( cbm::io_kcomm_t * );
88
89 lerr_t configure( ldndc::config_file_t const *);
90
91 lerr_t initialize();
92
93 lerr_t solve();
94
95 lerr_t finalize() { return LDNDC_ERR_OK; }
96
105 lerr_t sleep() { return LDNDC_ERR_OK; }
106 lerr_t wake() { return LDNDC_ERR_OK; }
107
108 cbm::string_t branchfraction_opt;
109 cbm::string_t crownlength_opt;
110 bool competition_opt;
111 bool rootgrowth_opt;
112
113 private:
114
115 cbm::io_kcomm_t * io_kcomm;
116
117 input_class_soillayers_t const & sl_;
118 input_class_setup_t const & m_setup;
119 input_class_siteparameters_t const * m_sipar;
120 input_class_species_t const * m_species;
121
122 substate_airchemistry_t const & ac_;
123 substate_microclimate_t const & mc_;
124 substate_physiology_t & ph_;
125 substate_soilchemistry_t & sc_;
126 substate_watercycle_t & wc_;
127
128 MoBiLE_PlantVegetation * m_veg;
129
130 LD_PlantFunctions m_pf;
131 TreeDynamics m_treedyn;
132
133 SubscribedEvent<LD_EventHandlerQueue> m_HarvestEvents;
134 SubscribedEvent<LD_EventHandlerQueue> m_PlantEvents;
135
136 lvector_t< double > no3_sl;
137 lvector_t< double > nh4_sl;
138
139 double latitude;
140
141 double FolNCon;
142 double accumulated_transpiration_old;
143
144 unsigned int year_start_, year_end_;
145
146 lvector_t< double > LayerGrossPsn; // for putting into layer specific assimilation variable
147 template < typename _E >
148 struct scalar_with_array_look_and_feel_t
149 {
150 _E value;
151 _E & operator=( _E const & _value)
152 { this->value = _value; return this->value; }
153 _E & operator[]( size_t)
154 { return this->value; }
155 _E & operator[]( MoBiLE_Plant *)
156 { return this->value; }
157 };
158
159 /* NOTE change this as soon as PNET becomes multi-species capable */
160 scalar_with_array_look_and_feel_t< double > mFolOld_vt; // saved initial foliage biomass for new nitrogen concentration calculations
161 scalar_with_array_look_and_feel_t< double > mFrtOld_vt; // saved initial fine root biomass for new nitrogen concentration calculations
162 scalar_with_array_look_and_feel_t< double > mBudOld_vt; // saved initial bud (reserve) biomass for new nitrogen concentration calculations
163 scalar_with_array_look_and_feel_t< double > mSapOld_vt; // saved initial sapwood biomass for new nitrogen concentration calculations
164 scalar_with_array_look_and_feel_t< double > mCorOld_vt; // saved initial core wood biomass for new nitrogen concentration calculations
165
166 lvector_t< double > mBudLoss_vt;
167 lvector_t< double > mSapLoss_vt;
168
169 double c_begin; // carbon balance variables
170 double n_begin; // nitrogen balance variables
171
172 // - water balance variables
173 double DWater; // average relative water availability (drought) during an integration step (mm)
174 double FolLitSum; // litterfall (gDW m-2)
175
176 double tra; // transpiration
177 double uptNAir;
178
179 // - physical environment variables (representing the average day of the integration timestep (day or month))
180
181 double Dvpd; // Gradient on vapour pressure deficit (?)
182 double DayResp; // Respiration during daytime (?)
183 double NightResp; // Respiration during nighttime (?)
184 double CanopyNetPsn; // Canopy net photosynthesis (?)
185 double CanopyGrossPsn; // Canopy gross photosynthesis (?)
186 double FolProdCMo; // foliage carbon production over the integration timestep (day or month) (?)
187 double FolGRespMo; // foliage growth respiration over the integration timestep (day or month) (?)
188 double NetPsnMo; // net photosynthesis over the integration timestep (day or month) (?)
189 double CanopyGrossPsnMo; // canopy gross photosynthesis over the integration timestep (day or month) (?)
190 double RootCAddMo; // fine root growth over the integration timestep (day or month)
191
192 // - allocation and mass variables
193 double qwodfolact; // relation between wood and foliage biomass at the start of the year
194 double transfDWbs; // annual mass transfer from reserves (buds) to (sap)wood (gC m-2)
195 double transfDWsb; // annual mass transfer from (sap)wood to reserves (buds) (gC m-2)
196 double WoodC; // living wood carbon (gC m-2)
197 double BudC; // reserve carbon for future foliage (gC m-2)
198 double RootC; // fine root carbon (gC m-2)
199 double FolMass; // foliage biomass (gDW m-2)
200 double FolMassMax; // maximum summer foliar biomass (gDW m-2) (not really a parameter)
201 double FolMassMin; // minimum summer foliar biomass (gDW m-2) (not really a parameter)
202 double FolReten; // foliage retention time (yr) (not really a parameter)
203
204 double WoodMRespMo; // daily maintanance respiration of the wood
205 double WoodGRespMo; // daily growth respiration of the wood
206 double RootMRespMo; // daily maintanance root respiration
207 double RootGRespMo; // daily root growth respiration
208 double WoodProdCMo; // daily wood production
209 double RootProdCMo; // daily carbon loss form the root system other than respiration;
210
211 double PosCBalMass;
212 double PosCBalMassTot;
213 double PosCBalMassIx;
214
215 double LightEffMin;
216 double WoodCStart;
217 double BudCStart;
218
219 // other variables
220 double fFrost;
221 bool mature;
222
223 /*** methods ***/
224
225 lerr_t step_init();
226
227 lerr_t step_out();
228
229 void balance_check( MoBiLE_Plant *p, unsigned int _i);
230
231// sk:unused /*! CalcFrostDamage
232// sk:unused *
233// sk:unused */
234// sk:unused double CalcFrostDamage();
235
239 void update_nitrogen_concentration( MoBiLE_Plant *);
240
244 void YearlyReset( MoBiLE_Plant *);
245
249 void Phenology(
250 MoBiLE_Plant *,
251 int /*GrowthPhase*/,
252 double /*DWater*/);
253
257 void Photosyn( MoBiLE_Plant *);
258
262 void AllocateMo( MoBiLE_Plant *);
263
267 void AllocateYr( MoBiLE_Plant *);
268
272 void N_uptake( MoBiLE_Plant *, double &);
273
277 void Update( MoBiLE_Plant *, double /*upt1_vt*/, double /*upt2_vt*/);
278
282 void TransformPhysiology( MoBiLE_Plant *);
283
284 lerr_t CalcVegStructure();
285
289 size_t get_na_max_pnet();
290
291};
292} /*namespace ldndc*/
293
294#endif /* !LM_PHYSIOLOGY_PNET_H_ */
295
Vegetation model PNET.
Definition: pnet.h:33
lerr_t sleep()
Definition: pnet.h:105
void AllocateMo(MoBiLE_Plant *)
static const double C
Definition: pnet.h:54
static const double NUPTAIR
Definition: pnet.h:72
static const double TMIN_NUP
Definition: pnet.h:39
static const double SRATEMAX
Definition: pnet.h:51
static const double GROWMAX
Definition: pnet.h:75
static const double TMAX_NUP
Definition: pnet.h:42
static const double KM_NO3
Definition: pnet.h:45
static const double KM_NH4
Definition: pnet.h:48
Spatially explicit groundwater model.
Definition: airchemistryput.h:15