LandscapeDNDC 1.37.0
arable-dndc.h
1
9#ifndef LM_PHYSIOLOGY_ARABLE_DNDC_H_
10#define LM_PHYSIOLOGY_ARABLE_DNDC_H_
11
12
13#include "mbe_legacymodel.h"
14#include "state/mbe_state.h"
15#include "ld_shared.h"
16
17#include "physiology/ld_plantfunctions.h"
18#include "eventhandler/graze/graze.h"
19#include "eventhandler/cut/cut.h"
20
21#include <containers/lgrowarray.h>
22#include <utils/cbm_utils.h>
23
24namespace ldndc {
25
26 struct BaseRootSystemDNDC;
27 class LDNDC_API PhysiologyArableDNDC : public MBE_LegacyModel
28 {
29 LMOD_EXPORT_MODULE_INFO(PhysiologyArableDNDC,"physiology:arabledndc","ArableDNDC");
30
31 /*** module specific constants ***/
32
34 static double const GROWTH_RESPIRATION_FRACTION;
35
37 static const double INITIAL_BIOMASS;
38
40 static const double S_TLIMIT;
41
42 public:
43 PhysiologyArableDNDC( MoBiLE_State *,
44 cbm::io_kcomm_t *, timemode_e);
45 ~PhysiologyArableDNDC();
46
47 lerr_t configure( ldndc::config_file_t const *);
48 lerr_t register_ports( cbm::io_kcomm_t *);
49 lerr_t initialize();
50
51 lerr_t solve();
52 lerr_t unregister_ports( cbm::io_kcomm_t *);
53 lerr_t finalize() { return LDNDC_ERR_OK; }
54
55 lerr_t sleep() { return LDNDC_ERR_OK; }
56 lerr_t wake() { return LDNDC_ERR_OK; }
57
58 private:
59 MoBiLE_State * m_state;
60 cbm::io_kcomm_t * io_kcomm;
61
62 /* required input classes */
63 input_class_setup_t const & m_setup;
64 input_class_soillayers_t const & sl_;
65 input_class_siteparameters_t const * m_sipar;
66 input_class_species_t const * m_species;
67 input_class_speciesparameters_t const * m_speciesparameters;
68
69 /* required state components */
70 substate_airchemistry_t const & ac_;
71 substate_microclimate_t & mc_;
72 substate_physiology_t & ph_;
73 substate_soilchemistry_t & sc_;
74 substate_watercycle_t & wc_;
75
76 MoBiLE_PlantVegetation * m_veg;
77
78 SubscribedEvent<LD_EventHandlerQueue> m_HarvestEvents;
79 SubscribedEvent<LD_EventHandlerQueue> m_PlantEvents;
80
81 ldndc::growable_array < BaseRootSystemDNDC*, 1000, 1 > root_system;
82
83 double const *mc_temp;
84
85 double const FTS_TOT_;
86
91 LD_PlantFunctions m_pf;
92
93 double tot_c_;
94 double tot_n_;
95
96 lvector_t< double > n_demand_vt_;
97 lvector_t< double > n_uptake_vt_;
98 lvector_t< double > n_avail_tot_vt_;
99 lvector_t< double > n_plant_vt_;
100
101 lvector_t< double > dw_fol_old_vt;
102 lvector_t< double > dw_frt_old_vt;
103 lvector_t< double > dw_lst_old_vt;
104 lvector_t< double > dw_bud_old_vt;
105
110 lvector_t< double > chill_factor;
111
116 lvector_t< double > chill_units;
117
126 lvector_t< unsigned int > root_q_vt_;
127
128 lvector_t< double > temp_sl;
129
130 /*** methods ***/
131
136 lerr_t ArableDNDC_step_init();
137 lerr_t ArableDNDC_step_out();
138 lerr_t ArableDNDC_resize();
139
144 void update_species_related_state_items( MoBiLE_Plant *);
145
162 lerr_t ArableDNDC_event_plant( MoBiLE_Plant *, EventAttributes const &);
163
181 lerr_t event_harvest( MoBiLE_Plant *, EventAttributes const &);
182
198 lerr_t development_stage( MoBiLE_Plant *);
199
200 void growth_respiration( MoBiLE_Plant *, double);
201
242 void maintenance_respiration( MoBiLE_Plant *);
243
274 double nitrogen_demand( MoBiLE_Plant *);
275
290 void nitrogen_uptake();
291
306 double nitrogen_fixation( MoBiLE_Plant *, double, double);
307 double total_fixed_nitrogen( MoBiLE_Plant const *, double) const;
308
350 void biomass_partition( MoBiLE_Plant *, double);
351
381 void senescence( MoBiLE_Plant *);
382
383 /* coverage */
384 void update_canopy_coverage( MoBiLE_Plant *);
385
386 /* plant height */
387 void update_canopy_height( MoBiLE_Plant *);
388
389 /* canopy structure */
390 void update_canopy_items( MoBiLE_Plant *);
391
392 /* C & N balance checker */
393 void balance_check( int /*stage*/);
394 };
395} /*namespace ldndc*/
396
397#endif /* !LM_PHYSIOLOGY_ARABLE_DNDC_H_ */
398
Spatially explicit groundwater model.
Definition: airchemistryput.h:15