LandscapeDNDC 1.37.0
Loading...
Searching...
No Matches
echy.h
1
2#ifndef MOBILE_MODULE_ECHY_H_
3#define MOBILE_MODULE_ECHY_H_
4
5#include "mbe_legacymodel.h"
6#include "state/mbe_state.h"
7#include "ld_shared.h"
8#include "ld_eventqueue.h"
9#include "eventhandler/flood/flood.h"
10#include "watercycle/ld_icesnow.h"
11
12namespace ldndc {
13
14class substate_microclimate_t;
15class substate_soilchemistry_t;
16class substate_watercycle_t;
17
26class LDNDC_API EcHy : public MBE_LegacyModel
27{
28 LMOD_EXPORT_MODULE_INFO(EcHy, "watercycle:echy", "EcHy");
29
30public:
31 EcHy( MoBiLE_State *,
32 cbm::io_kcomm_t *, timemode_e);
33 ~EcHy();
34
35 lerr_t configure( ldndc::config_file_t const *);
36 lerr_t register_ports( cbm::io_kcomm_t *);
37 lerr_t initialize();
38
39 lerr_t solve();
40 lerr_t unregister_ports( cbm::io_kcomm_t *);
41 lerr_t finalize();
42
43 lerr_t sleep();
44 lerr_t wake();
45
46private:
47
48 cbm::io_kcomm_t * io_kcomm;
49
50 input_class_groundwater_t const * gw_;
51 input_class_climate_t const * m_climate;
52 input_class_setup_t const * m_setup;
53 input_class_soillayers_t const * soillayers_in;
54 input_class_siteparameters_t const * m_param;
55
56 substate_soilchemistry_t const & sc_;
57 substate_microclimate_t & mc_;
58 substate_watercycle_t & wc_;
59 substate_physiology_t & ph_;
60 MoBiLE_PlantVegetation * m_veg;
61
62 EventHandlerFlood m_eventflood;
63 WaterCycleSnowDNDC m_snowdndc;
64
65 SubscribedEvent<LD_EventHandlerQueue> m_ManureEvents;
66 SubscribedEvent<LD_EventHandlerQueue> m_IrrigationEvents;
67
69 double kst_bottom;
70 double kst_bottom_gw_lateral;
71 double kst_bottom_gw_vertical;
72
75 double gw_depth_static_old;
76 double gw_recharge_mean;
77
80
83
85 lvector< double > trwl_sl;
86
93 lvector< double > wlfl_sl;
94
96 lvector< double > cr_fill_sl;
97 lvector< double > cr_up_sl;
98 lvector< double > cr_down_sl;
99
101 lvector< double > gw_fill_sl;
102
104 lvector< double > bypass_fill_sl;
105
108
110 lvector< double > evsws_sl;
111
113 lvector< double > kst_sl;
114 lvector< double > kst_eq_sl;
115
117 lvector< double > wl_sl;
118
120 lvector< double > wlfc_sl;
121
123 lvector< double > wlwp_sl;
124
126 double ev_leaf;
127
130
133
135 double runoff;
136
139
142
145 double surface_snowmelt;
146
149 double canopy_snow;
150
153
156
159
162
165
166 /* minimum height of surface watertable during flooding event (m) */
167 double minimum_watertable_height;
168
169 /* bund height during flooding event (m) */
170 double bund_height;
171
172 /* total amount of irrigation water applied including e.g., flooding (m) */
173 double irrigation;
174
175 /* irrigation by irrigation event (m) */
176 double irrigation_event;
177
178 enum irrigation_e
179 {
180 NONE,
181 CONSTANT_POSITIVE_WATER_TABLE,
182 CONSTANT_NEGATIVE_WATER_TABLE
183 };
184 irrigation_e irrigation_switch;
185
186 /* Depth of ponded water at soil surface (mm) */
187 double surface_water;
188
189 /* Snow [m] */
190 double surface_snow;
191
193 WaterCycleSnowDNDC::IceContentStateIn m_icecontent_in;
194 WaterCycleSnowDNDC::IceContentStateOut m_icecontent_out;
195
198
200 cbm::string_t runoff_method;
201
202 cbm::string_t groundwater_percolation_method;
203
204 bool have_capillary_flow;
205 bool have_capillary_rise;
206
207private:
208
212 lerr_t
214
221 lerr_t
222 EcHyFlood();
223
228 lerr_t
230 size_t /* integration step */,
231 size_t /* soil layer */);
232
233 double
234 EcHyRunoff( double /* potential infiltration */);
235
240 lerr_t
241 EcHyBypassFlow( double /* depth */,
242 double /* bypassing water */);
243
248 lerr_t
250
255 lerr_t
257 double const &,
258 double const &,
259 size_t const &,
260 double const &,
261 double &);
262
267 lerr_t
269 double &);
270
275 void
276 EcHyreset();
277
282 lerr_t
284
289 lerr_t
291
296 lerr_t
297 EcHyStepInit();
298
303 lerr_t
304 EcHyStepExit();
305
310 double
312
317 lerr_t
319 lvector_t< double > &/* leaf water */,
320 lvector_t< double > &/* leaf snow */);
321
327 lerr_t
329
335 lerr_t
336 EcHySnowIce();
337
342 double
344 size_t /* soil layer */);
345
350 double
352 size_t /* soil layer */);
353
358 double
360 size_t /* soil layer */);
361
366 double
368 size_t /* soil layer */);
369
370 double
371 EcHyGetDepthLimitation(
372 double _depth /* soil depth [m] */);
373
378 double
380 size_t _sl,
381 double /* dry weight fine roots [kg:m^-2] */);
382
387 double
388 EcHyGetWaterLimitationTranspiration(
389 double /* available water */,
390 size_t /* soil layer */);
391
396 double
397 EcHyGetWaterLimitationEvaporation(
398 double /* available water */,
399 size_t /* soil layer */);
400
405 double
407 size_t /* soil layer */);
408
413 lerr_t
414 EcHy_check_for_negative_value(
415 char const * /* position */);
416
421 inline double
422 pore_space( size_t _sl) const
423 {
424 return sc_.poro_sl[_sl] * sc_.h_sl[_sl];
425 }
426};
427
428} /*namespace ldndc*/
429
430#endif /* !MOBILE_MODULE_ECHY_H_ */
double gw_fill_surface
Definition echy.h:129
lvector< double > wlfc_sl
Definition echy.h:120
lvector< double > bypass_fill_sl
Definition echy.h:104
lvector< double > wl_sl
Definition echy.h:117
double EcHyGetInterceptionCapacity()
...
Definition echy.cpp:448
double daily_potential_soil_evaporation
Definition echy.h:161
double accumulated_irrigation_old
Definition echy.h:82
double thornthwaite_heat_index
Definition echy.h:152
double runoff
Definition echy.h:135
double ev_surfacewater
Definition echy.h:107
double throughfall_water
Definition echy.h:141
lerr_t EcHyPercolation(size_t, size_t)
Calculates water percolation within the soil profile.
double canopy_snowmelt
Definition echy.h:144
double daily_potential_leaf_evaporation
Definition echy.h:158
lerr_t EcHySnowIce()
Calls SnowDNDC for the calculation of snowpack and soil ice formation.
Definition echy-snow.cpp:21
lerr_t EcHyFlood()
sets hydrologic conditions during flooding events, e.g.,
Definition echy-management.cpp:17
double EcHyGetRootLimitation(size_t _sl, double)
...
Definition echy-evapotranspiration.cpp:468
double EcHyGetAvailableWaterTranspiration(size_t)
...
Definition echy-evapotranspiration.cpp:392
double daily_potential_transpiration
Definition echy.h:164
double daily_potential_evapotranspiration
Definition echy.h:155
lerr_t EcHyStepInit()
...
Definition echy.cpp:244
lerr_t EcHyEvapotranspiration()
Calculates evapotranspiration within the soil profile.
double cr_fill_groundwater
Definition echy.h:132
lvector< double > evsws_sl
Definition echy.h:110
lvector< double > kst_sl
Definition echy.h:113
double throughfall_snow
Definition echy.h:138
lvector< double > trwl_sl
Definition echy.h:85
lerr_t EcHyCapillaryRise(double const &, double const &, size_t const &, double const &, double &)
...
Definition echy-groundwater.cpp:275
lerr_t EcHyGroundwater()
...
Definition echy-groundwater.cpp:19
lerr_t EcHyBalanceCheck(double &)
...
Definition echy.cpp:568
WaterCycleSnowDNDC::IceContentStateIn m_icecontent_in
Definition echy.h:193
cbm::string_t evapotranspiration_method
Definition echy.h:197
lerr_t EcHyIrrigation()
Irrigation.
Definition echy-management.cpp:91
lerr_t EcHyCalculateLeafWaterDistribution(lvector_t< double > &, lvector_t< double > &)
...
Definition echy.cpp:461
double EcHyGetMinimumWater(size_t)
...
Definition echy-evapotranspiration.cpp:441
void EcHyreset()
...
Definition echy.cpp:210
double EcHyGetAvailableWaterEvaporation(size_t)
...
Definition echy-evapotranspiration.cpp:433
lerr_t EcHyPotentialEvapotranspiration()
Calculates potential evapotranspiration. Specific concept can be given as model option.
Definition echy-evapotranspiration.cpp:30
lerr_t EcHyBypassFlow(double, double)
Calculates water percolation within the soil profile.
lerr_t EcHyIntegration()
...
Definition echy.cpp:523
double canopy_water
Definition echy.h:148
double EcHyGetWiltingPoint(size_t)
...
Definition echy-evapotranspiration.cpp:449
lerr_t solve()
Definition echy.cpp:39
lerr_t EcHyStepExit()
...
Definition echy.cpp:383
double ev_leaf
Definition echy.h:126
lvector< double > gw_fill_sl
Definition echy.h:101
lvector< double > wlwp_sl
Definition echy.h:123
double EcHySoilWaterChange(size_t)
Definition echy.cpp:511
double accumulated_potentialtranspiration_old
Definition echy.h:79
lvector< double > cr_fill_sl
Definition echy.h:96
double kst_bottom
Definition echy.h:69
double gw_depth_static
Definition echy.h:74
cbm::string_t runoff_method
Definition echy.h:200
lvector< double > wlfl_sl
Definition echy.h:93
Spatially explicit groundwater model.
Definition airchemistryput.h:15