LandscapeDNDC 1.37.0
Loading...
Searching...
No Matches
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:
79 PhysiologyPNET(
80 MoBiLE_State *,
81 cbm::io_kcomm_t *,
82 timemode_e);
83
84 ~PhysiologyPNET();
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
138 double latitude;
139
140 double FolNCon;
141 double accumulated_transpiration_old;
142
143 unsigned int year_start_, year_end_;
144
145 lvector_t< double > LayerGrossPsn; // for putting into layer specific assimilation variable
146 template < typename _E >
147 struct scalar_with_array_look_and_feel_t
148 {
149 _E value;
150 _E & operator=( _E const & _value)
151 { this->value = _value; return this->value; }
152 _E & operator[]( size_t)
153 { return this->value; }
154 _E & operator[]( MoBiLE_Plant *)
155 { return this->value; }
156 };
157
158 /* NOTE change this as soon as PNET becomes multi-species capable */
159 scalar_with_array_look_and_feel_t< double > mFolOld_vt; // saved initial foliage biomass for new nitrogen concentration calculations
160 scalar_with_array_look_and_feel_t< double > mFrtOld_vt; // saved initial fine root biomass for new nitrogen concentration calculations
161 scalar_with_array_look_and_feel_t< double > mBudOld_vt; // saved initial bud (reserve) biomass for new nitrogen concentration calculations
162 scalar_with_array_look_and_feel_t< double > mSapOld_vt; // saved initial sapwood biomass for new nitrogen concentration calculations
163 scalar_with_array_look_and_feel_t< double > mCorOld_vt; // saved initial core wood biomass for new nitrogen concentration calculations
164
165 lvector_t< double > mBudLoss_vt;
166 lvector_t< double > mSapLoss_vt;
167
168 double c_begin; // carbon balance variables
169 double n_begin; // nitrogen balance variables
170
171 // - water balance variables
172 double DWater; // average relative water availability (drought) during an integration step (mm)
173 double FolLitSum; // litterfall (gDW m-2)
174
175 double tra; // transpiration
176 double uptNAir;
177
178 // - physical environment variables (representing the average day of the integration timestep (day or month))
179
180 double Dvpd; // Gradient on vapour pressure deficit (?)
181 double DayResp; // Respiration during daytime (?)
182 double NightResp; // Respiration during nighttime (?)
183 double CanopyNetPsn; // Canopy net photosynthesis (?)
184 double CanopyGrossPsn; // Canopy gross photosynthesis (?)
185 double FolProdCMo; // foliage carbon production over the integration timestep (day or month) (?)
186 double FolGRespMo; // foliage growth respiration over the integration timestep (day or month) (?)
187 double NetPsnMo; // net photosynthesis over the integration timestep (day or month) (?)
188 double CanopyGrossPsnMo; // canopy gross photosynthesis over the integration timestep (day or month) (?)
189 double RootCAddMo; // fine root growth over the integration timestep (day or month)
190
191 // - allocation and mass variables
192 double qwodfolact; // relation between wood and foliage biomass at the start of the year
193 double transfDWbs; // annual mass transfer from reserves (buds) to (sap)wood (gC m-2)
194 double transfDWsb; // annual mass transfer from (sap)wood to reserves (buds) (gC m-2)
195 double WoodC; // living wood carbon (gC m-2)
196 double BudC; // reserve carbon for future foliage (gC m-2)
197 double RootC; // fine root carbon (gC m-2)
198 double FolMass; // foliage biomass (gDW m-2)
199 double FolMassMax; // maximum summer foliar biomass (gDW m-2) (not really a parameter)
200 double FolMassMin; // minimum summer foliar biomass (gDW m-2) (not really a parameter)
201 double FolReten; // foliage retention time (yr) (not really a parameter)
202
203 double WoodMRespMo; // daily maintanance respiration of the wood
204 double WoodGRespMo; // daily growth respiration of the wood
205 double RootMRespMo; // daily maintanance root respiration
206 double RootGRespMo; // daily root growth respiration
207 double WoodProdCMo; // daily wood production
208 double RootProdCMo; // daily carbon loss form the root system other than respiration;
209
210 double PosCBalMass;
211 double PosCBalMassTot;
212 double PosCBalMassIx;
213
214 double LightEffMin;
215 double WoodCStart;
216 double BudCStart;
217
218 // other variables
219 double fFrost;
220 bool mature;
221
222 /*** methods ***/
223
224 lerr_t step_init();
225
226 lerr_t step_out();
227
228 void balance_check( MoBiLE_Plant *p, unsigned int _i);
229
230// sk:unused /*! CalcFrostDamage
231// sk:unused *
232// sk:unused */
233// sk:unused double CalcFrostDamage();
234
238 void update_nitrogen_concentration( MoBiLE_Plant *);
239
243 void YearlyReset( MoBiLE_Plant *);
244
248 void Phenology(
249 MoBiLE_Plant *,
250 int /*GrowthPhase*/,
251 double /*DWater*/);
252
256 void Photosyn( MoBiLE_Plant *);
257
261 void AllocateMo( MoBiLE_Plant *);
262
266 void AllocateYr( MoBiLE_Plant *);
267
271 void N_uptake( MoBiLE_Plant *, double &);
272
276 void Update( MoBiLE_Plant *, double /*upt1_vt*/, double /*upt2_vt*/);
277
281 void TransformPhysiology( MoBiLE_Plant *);
282
283 lerr_t CalcVegStructure();
284
288 size_t get_na_max_pnet();
289
290};
291} /*namespace ldndc*/
292
293#endif /* !LM_PHYSIOLOGY_PNET_H_ */
294
lerr_t sleep()
Definition pnet.h:105
void TransformPhysiology(MoBiLE_Plant *)
Definition pnet.cpp:1135
void AllocateMo(MoBiLE_Plant *)
static const double C
Definition pnet.h:54
lerr_t solve()
Definition pnet.cpp:196
static const double NUPTAIR
Definition pnet.h:72
void N_uptake(MoBiLE_Plant *, double &)
Definition pnet.cpp:975
static const double TMIN_NUP
Definition pnet.h:39
static const double SRATEMAX
Definition pnet.h:51
void Update(MoBiLE_Plant *, double, double)
Definition pnet.cpp:1393
static const double GROWMAX
Definition pnet.h:75
static const double TMAX_NUP
Definition pnet.h:42
size_t get_na_max_pnet()
Definition pnet.cpp:452
void AllocateYr(MoBiLE_Plant *)
Definition pnet.cpp:859
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