LandscapeDNDC 1.37.0
Loading...
Searching...
No Matches
echy.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 */
6
7#ifndef MOBILE_MODULE_ECHY_H_
8#define MOBILE_MODULE_ECHY_H_
9
10#include "mbe_legacymodel.h"
11#include "state/mbe_state.h"
12#include "ld_shared.h"
13#include "ld_eventqueue.h"
14#include "eventhandler/flood/flood.h"
15#include "watercycle/ld_icesnow.h"
16
17namespace ldndc {
18
19class substate_microclimate_t;
20class substate_soilchemistry_t;
21class substate_watercycle_t;
22
31class LDNDC_API EcHy : public MBE_LegacyModel
32{
33 LMOD_EXPORT_MODULE_INFO(EcHy, "watercycle:echy", "EcHy");
34
35public:
36 EcHy( MoBiLE_State *,
37 cbm::io_kcomm_t *, timemode_e);
38 ~EcHy();
39
40 lerr_t configure( ldndc::config_file_t const *);
41 lerr_t register_ports( cbm::io_kcomm_t *);
42 lerr_t initialize();
43
44 lerr_t solve();
45 lerr_t unregister_ports( cbm::io_kcomm_t *);
46 lerr_t finalize();
47
48 lerr_t sleep();
49 lerr_t wake();
50
51private:
52
53 cbm::io_kcomm_t * io_kcomm;
54
55 input_class_groundwater_t const * gw_;
56 input_class_climate_t const * m_climate;
57 input_class_setup_t const * m_setup;
58 input_class_soillayers_t const * soillayers_in;
59 input_class_siteparameters_t const * m_param;
60
61 substate_soilchemistry_t const & sc_;
62 substate_microclimate_t & mc_;
63 substate_watercycle_t & wc_;
64 substate_physiology_t & ph_;
65 MoBiLE_PlantVegetation * m_veg;
66
67 EventHandlerFlood m_eventflood;
68 WaterCycleSnowDNDC m_snowdndc;
69
70 SubscribedEvent<LD_EventHandlerQueue> m_ManureEvents;
71 SubscribedEvent<LD_EventHandlerQueue> m_IrrigationEvents;
72
74 double kst_bottom;
75 double kst_bottom_gw_lateral;
76 double kst_bottom_gw_vertical;
77
80 double gw_depth_static_old;
81 double gw_recharge_mean;
84
87
90
92 lvector< double > trwl_sl;
93
100 lvector< double > wlfl_sl;
101
103 lvector< double > cr_fill_sl;
104 lvector< double > cr_up_sl;
105 lvector< double > cr_down_sl;
106
108 lvector< double > gw_fill_sl;
109
111 lvector< double > bypass_fill_sl;
112
115
117 lvector< double > evsws_sl;
118
120 lvector< double > kst_sl;
121 lvector< double > kst_eq_sl;
122
124 lvector< double > wl_sl;
125
127 lvector< double > wlfc_sl;
128
130 lvector< double > wlwp_sl;
131
133 double ev_leaf;
134
137
140
142 double runoff;
143
146
149
152 double surface_snowmelt;
153
156 double canopy_snow;
157
160
163
166
169
172
180 lvector< double > rad_pet_ts;
181
183 lvector< double > f_pet_ts;
184
185
188
192
193 /* minimum height of surface watertable during flooding event (m) */
194 double minimum_watertable_height;
195
196 /* bund height during flooding event (m) */
197 double bund_height;
198
199 /* total amount of irrigation water applied including e.g., flooding (m) */
200 double irrigation;
201
202 /* irrigation by irrigation event (m) */
203 double irrigation_event;
204
205 enum irrigation_e
206 {
207 NONE,
208 CONSTANT_POSITIVE_WATER_TABLE,
209 CONSTANT_NEGATIVE_WATER_TABLE
210 };
211 irrigation_e irrigation_switch;
212
213 /* Depth of ponded water at soil surface (mm) */
214 double surface_water;
215
216 /* Snow [m] */
217 double surface_snow;
218
220 WaterCycleSnowDNDC::IceContentStateIn m_icecontent_in;
221 WaterCycleSnowDNDC::IceContentStateOut m_icecontent_out;
222
225 bool longwaveradiation_from_input; // incoming long-wave radiation from the climate input
226
228 cbm::string_t runoff_method;
229
230 cbm::string_t groundwater_percolation_method;
231
232 bool have_capillary_flow;
233 bool have_capillary_rise;
234
241
243
244private:
245
249 lerr_t
251
258 lerr_t
259 EcHyFlood();
260
265 lerr_t
267 size_t /* integration step */,
268 size_t /* soil layer */);
269
270 double
271 EcHyRunoff( double /* potential infiltration */);
272
277 lerr_t
278 EcHyBypassFlow( double /* depth */,
279 double /* bypassing water */);
280
285 lerr_t
287
292 lerr_t
294 double const &,
295 double const &,
296 size_t const &,
297 double const &,
298 double &);
299
304 lerr_t
306 double &);
307
312 void
313 EcHyreset();
314
319 lerr_t
321
326 lerr_t
328
333 lerr_t
334 EcHyStepInit();
335
340 lerr_t
341 EcHyStepExit();
342
347 double
349
354 lerr_t
356 lvector_t< double > &/* leaf water */,
357 lvector_t< double > &/* leaf snow */);
358
364 lerr_t
366
372 lerr_t
373 EcHySnowIce();
374
379 double
381 size_t /* soil layer */);
382
387 double
389 size_t /* soil layer */);
390
395 double
397 size_t /* soil layer */);
398
403 double
405 size_t /* soil layer */);
406
407 double
408 EcHyGetDepthLimitation(
409 double _depth /* soil depth [m] */);
410
415 double
417
423 double
425 double /* uptake target [m] */);
426
431 double
432 EcHyGetWaterLimitationEvaporation(
433 double /* available water */,
434 size_t /* soil layer */);
435
440 double
442 size_t /* soil layer */);
443
448 lerr_t
449 EcHy_check_for_negative_value(
450 char const * /* position */);
451
456 inline double
457 pore_space( size_t _sl) const
458 {
459 return sc_.poro_sl[_sl] * sc_.h_sl[_sl];
460 }
461};
462
463} /*namespace ldndc*/
464
465#endif /* !MOBILE_MODULE_ECHY_H_ */
double gw_fill_surface
Definition echy.h:136
lvector< double > wlfc_sl
Definition echy.h:127
lvector< double > f_pet_ts
Definition echy.h:183
bool have_gw_exchange_layerwise
Definition echy.h:238
lvector< double > bypass_fill_sl
Definition echy.h:111
lvector< double > wl_sl
Definition echy.h:124
double gw_exchange_tau
Definition echy.h:240
double EcHyGetInterceptionCapacity()
...
Definition echy.cpp:494
double accumulated_irrigation_old
Definition echy.h:89
double potential_evapotranspiration_ts
Definition echy.h:171
double thornthwaite_heat_index
Definition echy.h:159
double runoff
Definition echy.h:142
double ev_surfacewater
Definition echy.h:114
double throughfall_water
Definition echy.h:148
bool have_gw_exchange_storage
Definition echy.h:236
double potential_transpiration_ts
Definition echy.h:187
lerr_t EcHyPercolation(size_t, size_t)
Calculates water percolation within the soil profile.
lerr_t EcHyGroundwaterStorageExchange()
Exchange with a prescribed groundwater table based on profile water storage.
Definition echy-groundwater.cpp:308
double canopy_snowmelt
Definition echy.h:151
lerr_t EcHySnowIce()
Calls SnowDNDC for the calculation of snowpack and soil ice formation.
Definition echy-snow.cpp:26
lerr_t EcHyFlood()
sets hydrologic conditions during flooding events, e.g.,
Definition echy-management.cpp:22
double EcHyGetAvailableWaterTranspiration(size_t)
...
Definition echy-evapotranspiration.cpp:551
double daily_potential_evapotranspiration
Definition echy.h:162
lerr_t EcHyStepInit()
...
Definition echy.cpp:277
lerr_t EcHyEvapotranspiration()
Calculates evapotranspiration within the soil profile.
Definition echy-evapotranspiration.cpp:257
double cr_fill_groundwater
Definition echy.h:139
lvector< double > evsws_sl
Definition echy.h:117
lvector< double > kst_sl
Definition echy.h:120
double throughfall_snow
Definition echy.h:145
double EcHyDistributeWaterUptake(double)
Distributes the water uptake target across the rooted soil layers (trwl_sl), limited by the available...
Definition echy-evapotranspiration.cpp:415
lvector< double > trwl_sl
Definition echy.h:92
lerr_t EcHyCapillaryRise(double const &, double const &, size_t const &, double const &, double &)
...
Definition echy-groundwater.cpp:424
lerr_t EcHyGroundwater()
...
Definition echy-groundwater.cpp:24
bool pet_limit_daily
Definition echy.h:165
lvector< double > rad_pet_ts
Definition echy.h:180
lerr_t EcHyBalanceCheck(double &)
...
Definition echy.cpp:614
WaterCycleSnowDNDC::IceContentStateIn m_icecontent_in
Definition echy.h:220
cbm::string_t evapotranspiration_method
Definition echy.h:224
lerr_t EcHyIrrigation()
Irrigation.
Definition echy-management.cpp:97
double pet_day_remaining
Definition echy.h:168
lerr_t EcHyCalculateLeafWaterDistribution(lvector_t< double > &, lvector_t< double > &)
...
Definition echy.cpp:507
double EcHyGetMinimumWater(size_t)
...
Definition echy-evapotranspiration.cpp:596
double transpiration_ts
Definition echy.h:191
void EcHyreset()
...
Definition echy.cpp:243
double EcHyGetAvailableWaterEvaporation(size_t)
...
Definition echy-evapotranspiration.cpp:588
lerr_t EcHyPotentialEvapotranspiration()
Calculates potential evapotranspiration. Specific concept can be given as model option.
lerr_t EcHyBypassFlow(double, double)
Calculates water percolation within the soil profile.
double gw_recharge_potential
Definition echy.h:83
lerr_t EcHyIntegration()
...
Definition echy.cpp:569
double canopy_water
Definition echy.h:155
double EcHyGetWiltingPoint(size_t)
...
Definition echy-evapotranspiration.cpp:604
lerr_t EcHyStepExit()
...
Definition echy.cpp:416
double ev_leaf
Definition echy.h:133
lvector< double > gw_fill_sl
Definition echy.h:108
lvector< double > wlwp_sl
Definition echy.h:130
double EcHyGetGroundRadiationFraction()
Fraction of shortwave radiation absorbed at the ground surface (below the canopy)
Definition echy-evapotranspiration.cpp:505
double EcHySoilWaterChange(size_t)
Definition echy.cpp:557
double accumulated_potentialtranspiration_old
Definition echy.h:86
lvector< double > cr_fill_sl
Definition echy.h:103
double kst_bottom
Definition echy.h:74
double gw_depth_static
Definition echy.h:79
cbm::string_t runoff_method
Definition echy.h:228
lvector< double > wlfl_sl
Definition echy.h:100
Spatially explicit groundwater model.
Definition airchemistryput.h:21