LandscapeDNDC 1.37.0
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
78
81
83 lvector< double > trwl_sl;
84
91 lvector< double > wlfl_sl;
92
94 lvector< double > cr_fill_sl;
95
97 lvector< double > gw_fill_sl;
98
100 lvector< double > bypass_fill_sl;
101
104
106 lvector< double > evsws_sl;
107
109 lvector< double > kst_sl;
110 lvector< double > kst_eq_sl;
111
113 lvector< double > wl_sl;
114
116 lvector< double > wlfc_sl;
117
119 lvector< double > wlwp_sl;
120
122 double ev_leaf;
123
126
129
131 double runoff;
132
135
138
141 double surface_snowmelt;
142
145 double canopy_snow;
146
149
152
155
158
161
162 /* minimum height of surface watertable during flooding event (m) */
163 double minimum_watertable_height;
164
165 /* bund height during flooding event (m) */
166 double bund_height;
167
168 /* total amount of irrigation water applied including e.g., flooding (m) */
169 double irrigation;
170
171 /* irrigation by irrigation event (m) */
172 double irrigation_event;
173
174 enum irrigation_e
175 {
176 NONE,
177 CONSTANT_POSITIVE_WATER_TABLE,
178 CONSTANT_NEGATIVE_WATER_TABLE
179 };
180 irrigation_e irrigation_switch;
181
182 /* Depth of ponded water at soil surface (mm) */
183 double surface_water;
184
185 /* Snow [m] */
186 double surface_snow;
187
189 WaterCycleSnowDNDC::IceContentStateIn m_icecontent_in;
190 WaterCycleSnowDNDC::IceContentStateOut m_icecontent_out;
191
194
196 cbm::string_t runoff_method;
197
198 bool have_capillary_rise;
199
200private:
201
205 lerr_t
206 EcHyIrrigation();
207
214 lerr_t
215 EcHyFlood();
216
221 lerr_t
223 size_t /* integration step */,
224 size_t /* soil layer */);
225
230 lerr_t
232 double,
233 double &/* bypassing water */);
234
239 lerr_t
241
246 lerr_t
247 EcHyCapillaryRise(
248 double const &,
249 double const &,
250 size_t const &,
251 double const &,
252 double &);
253
258 lerr_t
259 EcHyBalanceCheck(
260 double &);
261
266 void
267 EcHyreset();
268
273 lerr_t
274 EcHyGroundwater();
275
280 lerr_t
281 EcHyIntegration();
282
287 lerr_t
288 EcHyStepInit();
289
294 lerr_t
295 EcHyStepExit();
296
301 double
302 EcHyGetInterceptionCapacity();
303
308 lerr_t
309 EcHyCalculateLeafWaterDistribution(
310 lvector_t< double > &/* leaf water */,
311 lvector_t< double > &/* leaf snow */);
312
318 lerr_t
319 EcHyPotentialEvapotranspiration();
320
326 lerr_t
327 EcHySnowIce();
328
333 double
334 EcHyGetMinimumWater(
335 size_t /* soil layer */);
336
341 double
342 EcHyGetWiltingPoint(
343 size_t /* soil layer */);
344
349 double
350 EcHyGetAvailableWaterTranspiration(
351 size_t /* soil layer */);
352
357 double
358 EcHyGetAvailableWaterEvaporation(
359 size_t /* soil layer */);
360
361 double
362 EcHyGetDepthLimitation(
363 double _depth /* soil depth [m] */);
364
369 double
370 EcHyGetRootLimitation(
371 size_t _sl,
372 double /* dry weight fine roots [kg:m^-2] */);
373
378 double
379 EcHyGetWaterLimitationTranspiration(
380 double /* available water */,
381 size_t /* soil layer */);
382
387 double
388 EcHyGetWaterLimitationEvaporation(
389 double /* available water */,
390 size_t /* soil layer */);
391
396 double
397 EcHySoilWaterChange(
398 size_t /* soil layer */);
399
404 lerr_t
405 EcHy_check_for_negative_value(
406 char const * /* position */);
407
412 inline double
413 pore_space( size_t _sl) const
414 {
415 return sc_.poro_sl[_sl] * sc_.h_sl[_sl];
416 }
417};
418
419} /*namespace ldndc*/
420
421#endif /* !MOBILE_MODULE_ECHY_H_ */
Hydrology model EcHy.
Definition: echy.h:27
double gw_fill_surface
Definition: echy.h:125
lvector< double > wlfc_sl
Definition: echy.h:116
lerr_t EcHyBypassFlow(double, double &)
Calculates water percolation within the soil profile.
lvector< double > bypass_fill_sl
Definition: echy.h:100
lvector< double > wl_sl
Definition: echy.h:113
double daily_potential_soil_evaporation
Definition: echy.h:157
double accumulated_irrigation_old
Definition: echy.h:80
double thornthwaite_heat_index
Definition: echy.h:148
double runoff
Definition: echy.h:131
double ev_surfacewater
Definition: echy.h:103
double throughfall_water
Definition: echy.h:137
lerr_t EcHyPercolation(size_t, size_t)
Calculates water percolation within the soil profile.
double canopy_snowmelt
Definition: echy.h:140
double daily_potential_leaf_evaporation
Definition: echy.h:154
double daily_potential_transpiration
Definition: echy.h:160
double daily_potential_evapotranspiration
Definition: echy.h:151
lerr_t EcHyEvapotranspiration()
Calculates evapotranspiration within the soil profile.
double cr_fill_groundwater
Definition: echy.h:128
lvector< double > evsws_sl
Definition: echy.h:106
lvector< double > kst_sl
Definition: echy.h:109
double throughfall_snow
Definition: echy.h:134
lvector< double > trwl_sl
Definition: echy.h:83
WaterCycleSnowDNDC::IceContentStateIn m_icecontent_in
Definition: echy.h:189
cbm::string_t evapotranspiration_method
Definition: echy.h:193
double canopy_water
Definition: echy.h:144
double ev_leaf
Definition: echy.h:122
lvector< double > gw_fill_sl
Definition: echy.h:97
lvector< double > wlwp_sl
Definition: echy.h:119
double accumulated_potentialtranspiration_old
Definition: echy.h:77
lvector< double > cr_fill_sl
Definition: echy.h:94
double kst_bottom
Definition: echy.h:69
double gw_depth_static
Definition: echy.h:74
cbm::string_t runoff_method
Definition: echy.h:196
lvector< double > wlfl_sl
Definition: echy.h:91
Spatially explicit groundwater model.
Definition: airchemistryput.h:15