LandscapeDNDC 1.37.0
Loading...
Searching...
No Matches
plamox.h
1
10
11#ifndef LM_PHYSIOLOGY_PLAMOX_H_
12#define LM_PHYSIOLOGY_PLAMOX_H_
13
14#include "mbe_legacymodel.h"
15#include "state/mbe_state.h"
16#include "ld_shared.h"
17
18#include <input/remotesensing/remotesensing.h>
19
20#include "physiology/ld_plantfunctions.h"
21#include "physiology/ld_rootsystem.h"
22#include "physiology/ld_nitrogenfixation.h"
23#include "physiology/ld_transpiration.h"
24#include "physiology/ld_vernalization.h"
25#include "watercycle/ld_droughtstress.h"
26#include "physiology/ld_stomatalconductance.h"
27#include "physiology/photofarquhar/berryball.h"
28
29#include "eventhandler/graze/graze.h"
30#include "eventhandler/cut/cut.h"
31
32
33namespace ldndc {
34
35#define ON_ENTRY 1
36#define ON_EXIT 2
37
38extern cbm::logger_t * PhysiologyPlaMoxLogger;
39
40struct BaseRootSystemDNDC;
41class NitrogenFixation;
42
51class LDNDC_API PhysiologyPlaMox : public MBE_LegacyModel
52{
53 LMOD_EXPORT_MODULE_INFO(PhysiologyPlaMox,"physiology:plamox","Physiology PlaMox");
54
55 enum plant_life_cycle_e
56 {
57 ANNUAL = 0,
58 BIENNIAL,
59 PLURIENNIAL,
60 PERENNIAL
61 };
62
63public:
64
65 PhysiologyPlaMox(
66 MoBiLE_State *,
67 cbm::io_kcomm_t *,
68 timemode_e);
69
74 ~PhysiologyPlaMox();
75
76 lerr_t configure( ldndc::config_file_t const *);
77 lerr_t register_ports( cbm::io_kcomm_t *);
78 lerr_t initialize();
79
80 lerr_t solve();
81 lerr_t unregister_ports( cbm::io_kcomm_t *);
82 lerr_t finalize() { return LDNDC_ERR_OK; }
83
84 lerr_t sleep() { return LDNDC_ERR_OK; }
85 lerr_t wake() { return LDNDC_ERR_OK; }
86
87private:
88
89 MoBiLE_State * m_state;
90 cbm::io_kcomm_t * io_kcomm;
91
92 /* required input classes */
93 input_class_climate_t const & cl_;
94 input_class_setup_t const * m_setup;
95 input_class_soillayers_t const & sl_;
96 input_class_species_t const * m_species;
97 input_class_speciesparameters_t const * m_speciesparameters;
98 input_class_siteparameters_t const * m_siteparameters;
99 remotesensing::input_class_remotesensing_t const * rm_;
100
101 MoBiLE_PlantVegetation * m_veg;
102
103 /* required state components */
104 substate_airchemistry_t & ac_;
105 substate_microclimate_t & mc_;
106 substate_physiology_t & ph_;
107 substate_soilchemistry_t & sc_;
108 substate_watercycle_t & wc_;
109
110 /* management handling */
111 SubscribedEvent<LD_EventHandlerQueue> m_HarvestEvents;
112 SubscribedEvent<LD_EventHandlerQueue> m_PlantEvents;
113
114 PublishedField<double> aboveground_biomass;
115 PublishedField<double> maturity_status;
116 PublishedField<double> growing_degree_days_maturity;
117 PublishedField<double> dEmerg;
118
119 PublishedField<double> carbon_plant_biomass_total_exported_from_field;
120 PublishedField<double> carbon_plant_biomass_fruit_exported_from_field;
121 PublishedField<double> nitrogen_plant_biomass_total_exported_from_field;
122 PublishedField<double> nitrogen_plant_biomass_fruit_exported_from_field;
123
124 EventHandlerGraze m_eventgraze;
125 EventHandlerCut m_eventcut;
126
132
137 NitrogenFixation *plamox_nitrogen_fixation;
138
145 ldndc::growable_array < BaseRootSystemDNDC*, 1000, 1 > plamox_root_system;
146
151 LD_PlantFunctions m_pf;
152
153 lvector_t< double > no3_sl;
154 lvector_t< double > nh4_sl;
155 lvector_t< double > don_sl;
156
171 cbm::string_t droughtstress_method;
172
177 cbm::string_t::cbmstring_array_t plantfamilies;
178
184 double const FTS_TOT_;
185
186 /***********************************/
187 /* Mobile state exchange variables */
188 /***********************************/
189
190 lvector_t< long long int > seconds_crop_planting;
191
192 lvector_t< double > gdd_grain_filling;
193
194 lvector_t< double > hypoxia;
195
196 lvector_t< int > days_after_emergence;
197
198 lvector_t< std::string > location;
199 lvector_t< double > dw_retranslocation_stem;
200 lvector_t< double > dw_retranslocation_foliage;
201 lvector_t< double > dw_fol_old;
202 lvector_t< double > lai_dynamic;
203
204 /*************************/
205 /* PlaMox only variables */
206 /*************************/
207
208 std::map< std::string, double > gdd_target;
209
210 /*---------------*/
211 /* model options */
212
216 bool have_automatic_nitrogen;
217
221 double automatic_nitrogen_uptake;
222
223 /*-----------------------------*/
224 /* carbon and nitrogen balance */
225
226 double photoperiod_min;
227 double photoperiod_max;
228 double tot_c_;
229 double tot_n_;
230
231 double timestep_c_assi;
232
236 double n_at_planting;
237
238 /*-----------------*/
239 /* state variables */
240
244 lvector_t< double > transplanting_shock_vt;
245
249 lvector_t< int > yearly_cuts;
250
254 lvector_t< bool > reset_phenology;
255
259 lvector_t< double > n_plant;
260
265 lvector_t< double > allocation_factor_leafs;
266
271 lvector_t< double > allocation_factor_stems;
272
277 lvector_t< double > allocation_factor_fruit;
278
283 lvector_t< double > allocation_factor_roots;
284
290 lvector_t< double > lai_min;
291
296 lvector_t< double > fractional_cover;
297
302 lvector_t< double > chill_units;
303
308 lvector_t< double > m_fruit_maximum;
309
314 lvector_t< double > spikelets_sterility;
315
320 lvector_t< double > nc_fol_opt;
321
326 lvector_t< unsigned int > root_q_vt_;
327
332 lvector_t< double > daytime_temperatures;
333
338 lvector_t< double > influence_heat_daily;
339
345
346
351
356 //double timing_heatshock;
361 //double duration_heatshock;
362
367 double Tcrit;
372 double Tzero;
373
374 double c_total_exported;
375 double c_fruit_exported;
376 double n_total_exported;
377 double n_fruit_exported;
378
379
380 /********************/
381 /* function members */
382 /********************/
383
388 lerr_t
390
395 lerr_t
401 lerr_t
402 PlaMox_step_out();
403
408 lerr_t
410
415 lerr_t
416 PlaMox_planting();
417
431 lerr_t
432 PlaMox_event_plant( MoBiLE_Plant *, EventAttributes const &);
433
438 lerr_t
439 PlaMox_harvest();
440
454 lerr_t
455 PlaMox_event_harvest( MoBiLE_Plant *, EventAttributes const &);
456
457 lerr_t
458 PlaMox_reset_phenology( MoBiLE_Plant * /* plant species */);
459
464 lerr_t
465 PlaMox_photosynthesis( MoBiLE_Plant * /* plant species */);
466
471 void
472 PlaMox_vernalization( MoBiLE_Plant * /* plant species */);
473
479 void
480 PlaMox_growing_degree_days( MoBiLE_Plant * /* plant species */);
481
486 void
487 PlaMox_heat_stress_limitation(MoBiLE_Plant* _vt /* plant species */);
488
493 void
494 PlaMox_plant_development_crop( MoBiLE_Plant * /* plant species */);
495
500 lerr_t
501 PlaMox_allocation_grass( MoBiLE_Plant * /* plant species */);
502
507 lerr_t
508 PlaMox_bud_burst( MoBiLE_Plant * /* plant species */);
509
514 lerr_t
515 PlaMox_redistribution( MoBiLE_Plant * /* plant species */);
516
521 void
522 PlaMox_respiration( MoBiLE_Plant * /* plant species */);
523
528 void
529 PlaMox_exsudation( MoBiLE_Plant * /* plant species */);
530
535 void
536 PlaMox_nitrogen_uptake( MoBiLE_Plant * /* plant species */);
537
542 lerr_t
543 PlaMox_nitrogen_fixation( MoBiLE_Plant * /* plant species */);
544
549 lerr_t
550 PlaMox_senescence( MoBiLE_Plant * /* plant species */);
551
552 /* senescence */
553 lerr_t
554 PlaMox_abscission( MoBiLE_Plant * /* plant species */);
555
560 void
561 PlaMox_drought( MoBiLE_Plant * /* plant species */);
562
567 void
568 PlaMox_transpiration( MoBiLE_Plant * /* plant species */);
569
577 void
579 double);
580
586 void
587 PlaMox_update_height( MoBiLE_Plant *);
588
594 void
596
606 void
607 PlaMox_update_foliage_structure( MoBiLE_Plant *);
608
615 void
616 PlaMox_update_specific_leaf_area( MoBiLE_Plant *);
617
623 void
625
631 double
632 PlaMox_get_nitrogen_deficiency( MoBiLE_Plant * /* plant species */);
633
639 double
641
648 double
649 PlaMox_get_age_factor( MoBiLE_Plant * /* plant species */);
650
659 double
660 PlaMox_get_frost_factor( MoBiLE_Plant *,
661 double);
662
667 double
668 PlaMox_get_hypoxia_factor( MoBiLE_Plant * /* plant species */);
669
674 double
675 PlaMox_get_heat_factor( MoBiLE_Plant * /* plant species */);
676
681 double
682 PlaMox_get_foliage_nitrogen_concentration( MoBiLE_Plant * /* plant species */);
683
688 double
689 PlaMox_n_opt( MoBiLE_Plant * /* plant species */);
690
695 void
696 PlaMox_balance_check( int /*stage*/);
697
701 lerr_t PLAMOX_CHECK_FOR_NEGATIVE_VALUE( char const * /*name*/);
702
703
704 /*****************/
705 /* class members */
706 /*****************/
707
712 class PlaMoxIterator
713 {
714 public:
715
716 PlaMoxIterator(MoBiLE_PlantVegetation *_vg,
717 cbm::string_t::cbmstring_array_t &_f,
718 PlantIterator const &_it) :
719 vegetation( _vg),
720 plantfamilies( _f),
721 iterator( _it)
722 {
723 if ( this->vegetation && this->not_my_family())
724 {
725 this->find_next();
726 }
727 }
728 ~PlaMoxIterator(){}
729
730 private:
731
732 bool not_my_family()
733 {
734 if ( this->iterator != this->vegetation->end())
735 {
736 for (size_t i = 0; i < this->plantfamilies.size(); ++i)
737 {
738 cbm::string_t family = ":";
739 family << this->plantfamilies[i] <<":";
740 if ( this->vegetation->is_family( this->iterator, family.c_str()))
741 {
742 return false;
743 }
744 }
745 }
746 return true;
747 }
748
749 void find_next()
750 {
751 while ( ++this->iterator != this->vegetation->end() && not_my_family())
752 {}
753 }
754
755 public:
756
757 PlaMoxIterator operator++()
758 {
759 this->find_next();
760 return *this;
761 }
762
763 MoBiLE_Plant * operator*()
764 {
765 return this->iterator.operator*();
766 }
767
768 bool operator==(const PlaMoxIterator &_it) const
769 {
770 return this->iterator.operator==( _it.iterator);
771 }
772
773 bool operator!=(const PlaMoxIterator &_it) const
774 {
775 return this->iterator.operator!=( _it.iterator);
776 }
777
778 private:
779 MoBiLE_PlantVegetation *vegetation;
780 cbm::string_t::cbmstring_array_t plantfamilies;
781 PlantIterator iterator;
782 };
783
784 PlaMoxIterator begin();
785
786 PlaMoxIterator end();
787
788 plant_life_cycle_e
789 PlaMox_get_life_cycle( MoBiLE_Plant *);
790};
791} /*namespace ldndc*/
792
793#endif /* !LM_PHYSIOLOGY_PLAMOX_H_ */
void PlaMox_nitrogen_uptake(MoBiLE_Plant *)
Calculates plant nitrogen uptake based on daily demand.
double PlaMox_get_foliage_nitrogen_concentration(MoBiLE_Plant *)
Calculates optimum foliage nitrogen concentration.
Definition plamox.cpp:3644
lvector_t< double > allocation_factor_stems
Allocation factor of daily assimilated carbon to stem growth [-].
Definition plamox.h:271
double influence_heat_reduction_grainfilling
Resulting impact factor of the heat stress influence on grain yield.
Definition plamox.h:344
void PlaMox_update_root_structure(MoBiLE_Plant *, double)
Updates all relevant root structural matters.
double PlaMox_get_heat_factor(MoBiLE_Plant *)
Calculates a temperature factor.
Definition plamox.cpp:3502
lerr_t PlaMox_step_init()
pre-run initialization each time step
Definition plamox.cpp:159
lvector_t< double > allocation_factor_fruit
Allocation factor of daily assimilated carbon to fruit growth [-].
Definition plamox.h:277
void PlaMox_update_specific_leaf_area(MoBiLE_Plant *)
Calculates specific leaf area (sla) in each canopy layer.
Definition plamox.cpp:3162
double PlaMox_get_age_factor(MoBiLE_Plant *)
Calculates an age factor.
Definition plamox.cpp:3608
BerryBall plamox_berryball
Photosynthesis.
Definition plamox.h:131
double PlaMox_n_opt(MoBiLE_Plant *)
Determines optimum nitrogen concentration.
Definition plamox.cpp:3247
double PlaMox_get_biomass_induced_downregulation(MoBiLE_Plant *)
Definition plamox.cpp:3569
ldndc::growable_array< BaseRootSystemDNDC *, 1000, 1 > plamox_root_system
Root system.
Definition plamox.h:145
lerr_t PlaMox_management()
Applies grazing and cutting.
Definition plamox.cpp:1096
double const FTS_TOT_
Time resolution factor: .
Definition plamox.h:184
double day_of_flowering
day after emergence where flowering is onset
Definition plamox.h:350
void PlaMox_heat_stress_limitation(MoBiLE_Plant *_vt)
Limits pod filling due to heat stress around anthesis.
Definition plamox.cpp:3394
void PlaMox_growing_degree_days(MoBiLE_Plant *)
Calculates growing degree days depending on daily average temperature.
lerr_t PlaMox_step_resize()
resize plant species vector
Definition plamox-setting.cpp:493
void PlaMox_exsudation(MoBiLE_Plant *)
Determines root exsudation as fraction of root growth respiration.
Definition plamox.cpp:2465
lvector_t< double > influence_heat_daily
store daily impact factor of heat stress on grain yield;
Definition plamox.h:338
lerr_t PlaMox_allocation_grass(MoBiLE_Plant *)
Allocation metrics for grass species.
lvector_t< double > daytime_temperatures
store daytime temperature for heat stress analysis
Definition plamox.h:332
void PlaMox_update_nitrogen_concentrations(MoBiLE_Plant *)
Definition plamox.cpp:3263
bool have_drought_stress
Consider drought stress yes/no.
Definition plamox.h:161
double PlaMox_get_hypoxia_factor(MoBiLE_Plant *)
Calculates a temperature factor.
Definition plamox.cpp:3343
void PlaMox_update_foliage_structure(MoBiLE_Plant *)
Calculation of canopy layer properties:
Definition plamox.cpp:3099
void PlaMox_respiration(MoBiLE_Plant *)
Calculates maintenance/residual and growth respiration.
lvector_t< double > allocation_factor_roots
Allocation factor of daily assimilated carbon to root growth [-].
Definition plamox.h:283
double PlaMox_get_nitrogen_deficiency(MoBiLE_Plant *)
Definition plamox.cpp:3536
LD_PlantFunctions m_pf
All kind of plant related functions.
Definition plamox.h:151
NitrogenFixation * plamox_nitrogen_fixation
Nitrogen fixation.
Definition plamox.h:137
lvector_t< double > fractional_cover
Density of seeded plants with regard to optimum (full area) seeding (-).
Definition plamox.h:296
bool have_heat_stress
Consider heat stress yes/no.
Definition plamox.h:166
void PlaMox_transpiration(MoBiLE_Plant *)
Calculates potential transpiration.
Definition plamox.cpp:2908
double PlaMox_get_frost_factor(MoBiLE_Plant *, double)
Calculates a temperature factor.
Definition plamox.cpp:3321
lerr_t PlaMox_event_harvest(MoBiLE_Plant *, EventAttributes const &)
handle harvest event
Definition plamox.cpp:755
lvector_t< double > lai_min
Minimum value of üplamt leaf area index (m^2:m^-2). For crops, this value is fixed until between sowi...
Definition plamox.h:290
lvector_t< double > allocation_factor_leafs
Allocation factor of daily assimilated carbon to leaf growth [-].
Definition plamox.h:265
double Tzero
The temperature at which there is zero pod-set (°C)
Definition plamox.h:372
lvector_t< unsigned int > root_q_vt_
Largest soil layer index where roots exist [-].
Definition plamox.h:326
void PlaMox_update_height(MoBiLE_Plant *)
lerr_t PlaMox_event_plant(MoBiLE_Plant *, EventAttributes const &)
handle plant event
Definition plamox.cpp:461
void PlaMox_vernalization(MoBiLE_Plant *)
Determines the growing degree days and the plant development stage based on if vernalization requirem...
void PlaMox_update_ground_cover(MoBiLE_Plant *)
cbm::string_t droughtstress_method
Transpiration method used by PlaMox.
Definition plamox.h:171
void PlaMox_drought(MoBiLE_Plant *)
Calculates drought stress.
Definition plamox.cpp:2870
cbm::string_t::cbmstring_array_t plantfamilies
Plant families that are considered by PlaMox.
Definition plamox.h:177
lerr_t PlaMox_redistribution(MoBiLE_Plant *)
Redistribution of reserves.
Definition plamox.cpp:1857
double Tcrit
the timing of the episode of high temperatures relative to flowering
Definition plamox.h:367
lerr_t PlaMox_bud_burst(MoBiLE_Plant *)
Burst of buds.
Definition plamox.cpp:1831
lerr_t PlaMox_nitrogen_fixation(MoBiLE_Plant *)
Calculates plant nitrogen fixation.
lvector_t< double > chill_units
Accumulated chilling units for vernalization;.
Definition plamox.h:302
lerr_t PlaMox_senescence(MoBiLE_Plant *)
Calculates aboveground and belowground plant senecsence.
lerr_t PlaMox_photosynthesis(MoBiLE_Plant *)
Update of information needed by photofarquhar.
Definition plamox.cpp:1946
Spatially explicit groundwater model.
Definition airchemistryput.h:15