LandscapeDNDC 1.37.0
Loading...
Searching...
No Matches
arable-dndc.h
1/*
2 * SPDX-FileCopyrightText: Karlsruhe Institute of Technology (KIT)
3 * SPDX-License-Identifier: LicenseRef-LandscapeDNDC
4 * This file is part of LandscapeDNDC. See LICENSE.
5 */
13
14#ifndef LM_PHYSIOLOGY_ARABLE_DNDC_H_
15#define LM_PHYSIOLOGY_ARABLE_DNDC_H_
16
17
18#include "mbe_legacymodel.h"
19#include "state/mbe_state.h"
20#include "ld_shared.h"
21
22#include "physiology/ld_plantfunctions.h"
23#include "eventhandler/graze/graze.h"
24#include "eventhandler/cut/cut.h"
25
26#include <containers/lgrowarray.h>
27#include <utils/cbm_utils.h>
28
29namespace ldndc {
30
31 struct BaseRootSystemDNDC;
32 class LDNDC_API PhysiologyArableDNDC : public MBE_LegacyModel
33 {
34 LMOD_EXPORT_MODULE_INFO(PhysiologyArableDNDC,"physiology:arabledndc","ArableDNDC");
35
36 /*** module specific constants ***/
37
39 static double const GROWTH_RESPIRATION_FRACTION;
40
42 static const double INITIAL_BIOMASS;
43
45 static const double S_TLIMIT;
46
47 public:
48 PhysiologyArableDNDC( MoBiLE_State *,
49 cbm::io_kcomm_t *, timemode_e);
50 ~PhysiologyArableDNDC();
51
52 lerr_t configure( ldndc::config_file_t const *);
53 lerr_t register_ports( cbm::io_kcomm_t *);
54 lerr_t initialize();
55
56 lerr_t solve();
57 lerr_t unregister_ports( cbm::io_kcomm_t *);
58 lerr_t finalize() { return LDNDC_ERR_OK; }
59
60 lerr_t sleep() { return LDNDC_ERR_OK; }
61 lerr_t wake() { return LDNDC_ERR_OK; }
62
63 private:
64 MoBiLE_State * m_state;
65 cbm::io_kcomm_t * io_kcomm;
66
67 /* required input classes */
68 input_class_setup_t const & m_setup;
69 input_class_soillayers_t const & sl_;
70 input_class_siteparameters_t const * m_sipar;
71 input_class_species_t const * m_species;
72 input_class_speciesparameters_t const * m_speciesparameters;
73
74 /* required state components */
75 substate_airchemistry_t const & ac_;
76 substate_microclimate_t & mc_;
77 substate_physiology_t & ph_;
78 substate_soilchemistry_t & sc_;
79 substate_watercycle_t & wc_;
80
81 MoBiLE_PlantVegetation * m_veg;
82
83 SubscribedEvent<LD_EventHandlerQueue> m_HarvestEvents;
84 SubscribedEvent<LD_EventHandlerQueue> m_PlantEvents;
85
86 ldndc::growable_array < BaseRootSystemDNDC*, 1000, 1 > root_system;
87
88 double const *mc_temp;
89
90 double const FTS_TOT_;
91
96 LD_PlantFunctions m_pf;
97
98 double tot_c_;
99 double tot_n_;
100
101 lvector_t< double > n_demand_vt_;
102 lvector_t< double > n_uptake_vt_;
103 lvector_t< double > n_avail_tot_vt_;
104 lvector_t< double > n_plant_vt_;
105
106 lvector_t< double > dw_fol_old_vt;
107 lvector_t< double > dw_frt_old_vt;
108 lvector_t< double > dw_lst_old_vt;
109 lvector_t< double > dw_bud_old_vt;
110
115 lvector_t< double > chill_factor;
116
121 lvector_t< double > chill_units;
122
127 lvector_t< unsigned int > root_q_vt_;
128
129 lvector_t< double > temp_sl;
130
131 /*** methods ***/
132
137 lerr_t ArableDNDC_step_init();
138 lerr_t ArableDNDC_step_out();
139 lerr_t ArableDNDC_resize();
140
145 void update_species_related_state_items( MoBiLE_Plant *);
146
163 lerr_t ArableDNDC_event_plant( MoBiLE_Plant *, EventAttributes const &);
164
182 lerr_t event_harvest( MoBiLE_Plant *, EventAttributes const &);
183
199 lerr_t development_stage( MoBiLE_Plant *);
200
201 void growth_respiration( MoBiLE_Plant *, double);
202
243 void maintenance_respiration( MoBiLE_Plant *);
244
275 double nitrogen_demand( MoBiLE_Plant *);
276
291 void nitrogen_uptake();
292
307 double nitrogen_fixation( MoBiLE_Plant *, double, double);
308 double total_fixed_nitrogen( MoBiLE_Plant const *, double) const;
309
351 void biomass_partition( MoBiLE_Plant *, double);
352
382 void senescence( MoBiLE_Plant *);
383
384 /* coverage */
385 void update_canopy_coverage( MoBiLE_Plant *);
386
387 /* plant height */
388 void update_canopy_height( MoBiLE_Plant *);
389
390 /* canopy structure */
391 void update_canopy_items( MoBiLE_Plant *);
392
393 /* C & N balance checker */
394 void balance_check( int /*stage*/);
395 };
396} /*namespace ldndc*/
397
398#endif /* !LM_PHYSIOLOGY_ARABLE_DNDC_H_ */
399
Spatially explicit groundwater model.
Definition airchemistryput.h:21
Interface of the fine root system of a plant: rooting depth, distribution of fine root mass and lengt...
Definition ld_rootsystem.h:34