LandscapeDNDC 1.37.0
canopyecm.h
1
11#ifndef LM_MICROCLIMATE_CANOPY_ECM_H_
12#define LM_MICROCLIMATE_CANOPY_ECM_H_
13
14#include "mbe_legacymodel.h"
15#include "state/mbe_state.h"
16
17namespace ldndc {
18
19
20class LDNDC_API MicroClimateCanopyECM : public MBE_LegacyModel
21{
22 LMOD_EXPORT_MODULE_INFO(MicroClimateCanopyECM,"microclimate:canopyecm","Microclimate CanopyECM");
23
27 static const double QMASSAREA;
29 static const double EXPW;
31 static const double ROUGH;
33 static const double FEXT_W;
34
36 static const double FLITALB;
37
39 static const double HLMIN;
41 static const double HBASE;
43 static const double SDAMP;
44
45public:
46 MicroClimateCanopyECM(
47 MoBiLE_State *,
48 cbm::io_kcomm_t *,
49 timemode_e);
50
51 ~MicroClimateCanopyECM();
52
53
54 lerr_t configure( ldndc::config_file_t const *);
55
56 lerr_t initialize();
57
58 lerr_t solve();
59
60 lerr_t finalize() { return LDNDC_ERR_OK; }
61
62 lerr_t sleep() { return LDNDC_ERR_OK; }
63 lerr_t wake() { return LDNDC_ERR_OK; }
64
65private:
66 input_class_setup_t const & se_;
67 substate_watercycle_t const & wc_;
68 substate_microclimate_t & mc_;
69 substate_physiology_t const & ph_;
70
71 MoBiLE_PlantVegetation * m_veg;
72
73 input_class_climate_t const & climate_;
74 input_class_soillayers_t const & sl_;
75 substate_soilchemistry_t const & sc_;
76
77 substate_surfacebulk_t & sbl_;
78
79 solver_tridiagonal_t tdma_solver_;
80
81 /* pointer to daily or subdaily state items */
82 /* radiation per canopy layer (temporarly unit-converted) [W m-2] */
83 lvector_t< double > loc_lw_rad_down_fl;
84 lvector_t< double > loc_lw_rad_up_fl;
85 lvector_t< double > loc_sw_rad_fl;
86 lvector_t< double > loc_sw_rad_refl_fl;
87 double loc_sw_rad_refl_a;
88 lvector_t< double > f_area_fl;
89 lvector_t< double > lai_fl;
90 lvector_t< double > loc_temp_fl;
91 lvector_t< double > loc_fsun_fl;
92 lvector_t< double > loc_parshd_fl;
93 lvector_t< double > loc_parsun_fl;
94 lvector_t< double > loc_vpd_fl;
95 lvector_t< double > loc_rh_fl;
96 lvector_t< double > loc_win_fl;
97
98 bool al_new; // if additional layers above soil occur the first time ala_new is true, else false;
99
100 double * temp_old_sl; // old soil temperature for soil layers
101 double * temp_old_sbl; // old soil temperature for bulk surface layers (snow or water)
102
103 double * hcap_sl; // volumetric heat capacity of the soil layer (J K-1 m-2)
104 double * lambda_sl; // heat conductivity (J K-1 m-1 s-1)
105
106 double * h_extended_sl; // extends the last soil layer for more realistic lower boundary condition of constant annual temp
107 double * som_extended_sl;
108 double * min_extended_sl;
109
110 // depth of soil layer (m)
111 double * dsl;
112 // volumetric heat capacity of the soil layer (J K-1 m-2)
113 double * hcap;
114 // heat conductivity (J K-1 m-1 s-1)
115 double * lambda;
116 // soil temperature to start with (oC)
117 double * tempOld_sl;
118
119 bool dirichletboundarycondition;
120 double annual_average_temperature;
121
122 double domainextension;
123 bool energybalance;
124
126 cbm::string_t soiltemperature_method;
127
128 double accumulated_evapotranspiration_canopy;
129 double accumulated_evapotranspiration_soil;
130
131 /* outgoing (reflected) short wave radiation [W m-2] */
132 double loc_sw_rad_out;
133
134 /* outgoing long wave radiation [W m-2] */
135 double loc_lw_rad_out;
136
137 /* outgoing sensible heat [W m-2] */
138 double loc_sensible_heat_out_top;
139 double loc_sensible_heat_out_bottom;
140
141 /* radiation above litter [W m-2] */
142 double loc_rad_a;
143 double loc_temp_a;
144 double loc_rad_sw;
145 double loc_rad_lw;
146 double loc_temp;
147 double loc_win;
148 double loc_vpd;
149 double loc_fdif;
150 double loc_sinb;
151
153 double lai_sum;
154
155 // parameter aggregation
156 double fdrag;
157
158
159 lerr_t CanopyECM_step_init();
160 lerr_t CanopyECM_step_out();
161
162 void CalcTemperature();
163
169 lerr_t CalcSoilTemperature_implicite(
170 lvector_t< double > & /*soil temperatures*/,
171 double /*average temperature above canopy*/,
172 double &/*average temperature above litter*/);
173
174 lerr_t CalcSoilTemperature_implicite_extended(
175 lvector_t< double > & /*soil temperatures*/,
176 double /*average temperature above canopy*/,
177 double &/*average temperature above litter*/);
178
179 lerr_t CalcSoilTemperature_explicite(
180 lvector_t< double > & /*soil temperatures*/,
181 double /*average temperature above litter*/);
182
183
194 void CalcShortwaveRadiation();
195
196
204 void CalcHumidity();
205
215 void CalcWindspeed();
216
222 void CalcAlbedo();
223
229 double foliage_layer_heat_capacity( size_t /* foliage layer*/);
230
236 double get_canopy_energy();
237
238 double get_surface_bulk_energy();
239
240 double get_soil_energy( lvector_t< double > & /* soil temperature */);
241
247 double get_lai_fraction( size_t /* foliage layer */,
248 size_t /* no of foliage layer */);
249
255 double get_sky_view( double const & /* lai*/);
256
262 double get_lw_radiation_down( double const & /* open area fraction top */,
263 double const & /* open area fraction */,
264 double const & /* leaf area index */,
265 double const & /* incoming longwave radiation */);
266};
267} /*namespace ldndc*/
268
269#endif /* !LDNDC_MOD_MICROCLIMATE_CANOPY_ECM_H_ */
270
Spatially explicit groundwater model.
Definition: airchemistryput.h:15