LandscapeDNDC 1.37.0
ldndc::EcHy Class Reference

Hydrology model EcHy. More...

#include <models/watercycle/echy/echy.h>

Inherits ldndc::MBE_LegacyModel.

Public Member Functions

lerr_t solve ()
 

Private Member Functions

lerr_t EcHyIrrigation ()
 Irrigation.
 
lerr_t EcHyFlood ()
 sets hydrologic conditions during flooding events, e.g., More...
 
lerr_t EcHyPercolation (size_t, size_t)
 Calculates water percolation within the soil profile.
 
lerr_t EcHyBypassFlow (double, double &)
 Calculates water percolation within the soil profile.
 
lerr_t EcHyEvapotranspiration ()
 Calculates evapotranspiration within the soil profile.
 
lerr_t EcHyCapillaryRise (double const &, double const &, size_t const &, double const &, double &)
 ... More...
 
lerr_t EcHyBalanceCheck (double &)
 ... More...
 
void EcHyreset ()
 ...
 
lerr_t EcHyGroundwater ()
 ... More...
 
lerr_t EcHyIntegration ()
 ... More...
 
lerr_t EcHyStepInit ()
 ...
 
lerr_t EcHyStepExit ()
 ...
 
double EcHyGetInterceptionCapacity ()
 ...
 
lerr_t EcHyCalculateLeafWaterDistribution (lvector_t< double > &, lvector_t< double > &)
 ...
 
lerr_t EcHyPotentialEvapotranspiration ()
 Calculates potential evapotranspiration. Specific concept can be given as model option.
 
lerr_t EcHySnowIce ()
 Calls SnowDNDC for the calculation of snowpack and soil ice formation.
 
double EcHyGetMinimumWater (size_t)
 ...
 
double EcHyGetWiltingPoint (size_t)
 ...
 
double EcHyGetAvailableWaterTranspiration (size_t)
 ...
 
double EcHyGetAvailableWaterEvaporation (size_t)
 ...
 
double EcHyGetRootLimitation (size_t _sl, double)
 ...
 
double EcHySoilWaterChange (size_t)
 

Private Attributes

double kst_bottom
 
double gw_depth_static
 
double accumulated_potentialtranspiration_old
 
double accumulated_irrigation_old
 
lvector< double > trwl_sl
 
lvector< double > wlfl_sl
 
lvector< double > cr_fill_sl
 
lvector< double > gw_fill_sl
 
lvector< double > bypass_fill_sl
 
double ev_surfacewater
 
lvector< double > evsws_sl
 
lvector< double > kst_sl
 
lvector< double > wl_sl
 
lvector< double > wlfc_sl
 
lvector< double > wlwp_sl
 
double ev_leaf
 
double gw_fill_surface
 
double cr_fill_groundwater
 
double runoff
 
double throughfall_snow
 
double throughfall_water
 
double canopy_snowmelt
 
double canopy_water
 
double thornthwaite_heat_index
 
double daily_potential_evapotranspiration
 
double daily_potential_leaf_evaporation
 
double daily_potential_soil_evaporation
 
double daily_potential_transpiration
 
WaterCycleSnowDNDC::IceContentStateIn m_icecontent_in
 
cbm::string_t evapotranspiration_method
 
cbm::string_t runoff_method
 

Detailed Description

Hydrology model EcHy.

Author
David Kraus

Member Function Documentation

◆ EcHyBalanceCheck()

lerr_t ldndc::EcHy::EcHyBalanceCheck ( double &  _balance)
private

...

Checks balance between all incoming and outgoing water fluxes.

487{
488 double balance( canopy_water + surface_water + canopy_snow + surface_snow);
489 for ( size_t sl = 0; sl < soillayers_in->soil_layer_cnt(); ++sl)
490 {
491 balance += wl_sl[sl] + wc_.ice_sl[sl] * sc_.h_sl[sl];
492 }
493
494 if ( _balance > 0.0)
495 {
496 balance += wlfl_sl[soillayers_in->soil_layer_cnt()]
497 + ev_leaf + ev_surfacewater + evsws_sl.sum() + trwl_sl.sum() + runoff
499 - irrigation - throughfall_water - throughfall_snow;
500
501 double const balance_delta( std::abs( _balance - balance));
502 if ( cbm::flt_greater( balance_delta, 1.0e-4))
503 {
504 KLOGWARN( "Water leakage in: ", name(),
505 " Difference: ", balance - _balance);
506 return LDNDC_ERR_FAIL;
507 }
508 }
509 else
510 {
511 _balance = balance;
512 }
513
514 return LDNDC_ERR_OK;
515}
double gw_fill_surface
Definition: echy.h:125
lvector< double > wl_sl
Definition: echy.h:113
double runoff
Definition: echy.h:131
double ev_surfacewater
Definition: echy.h:103
double throughfall_water
Definition: echy.h:137
double cr_fill_groundwater
Definition: echy.h:128
lvector< double > evsws_sl
Definition: echy.h:106
double throughfall_snow
Definition: echy.h:134
lvector< double > trwl_sl
Definition: echy.h:83
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 > wlfl_sl
Definition: echy.h:91

References canopy_water, cr_fill_groundwater, ev_leaf, ev_surfacewater, evsws_sl, gw_fill_sl, gw_fill_surface, runoff, throughfall_snow, throughfall_water, trwl_sl, wl_sl, and wlfl_sl.

Referenced by solve().

Here is the caller graph for this function:

◆ EcHyCapillaryRise()

lerr_t ldndc::EcHy::EcHyCapillaryRise ( double const &  _cp,
double const &  _delta_z,
size_t const &  _sl,
double const &  _saturation,
double &  _flow 
)
private

...

This routine calculates the rate of capillary flow or percolation between groundwater table and root zone. The stationary flow is found by integration of dZL = K.d(MH)/(K + FLW), where Z= height above groundwater, MH= matric head, K= conductivity and FLW= chosen flow. In an iteration loop the correct flow is found. The integration goes at most over four intervals: [0,45], [45,170], [170,330] and [330,MH-rootzone] (last one on logarithmic scale).

Author
C. Rappoldt M. Wopereis
Date
January 1986, revised June 1990

@documentation Chapter 15 in documentation WOFOST Version 4.1 (1988)

259{
260 //calculation of pf from matrix head
261 double pf( std::log10( _cp));
262
263 //in case of small matric head (high water contents)
264 if ( cbm::flt_greater( 1.0, pf))
265 {
266 _flow = 0.0;
267 return LDNDC_ERR_OK;
268 }
269
270 double elog10( 2.302585);
271 double logst4( 2.518514);
272
273 double start[4] = {0.0, 45.0, 170.0, 330.0};
274
275 //number and width of integration intervals
276 int iint( 0);
277 double del[4] = { 0.0, 0.0, 0.0, 0.0};
278 for (int i1 = 0; i1 < 4; i1++)
279 {
280 if (i1 < 3)
281 {
282 del[i1] = std::min( start[i1+1], _cp) - start[i1];
283 }
284 else
285 {
286 del[i1] = pf - logst4;
287 }
288 if (del[i1] <= 0.0)
289 {
290 break;
291 }
292 iint += 1;
293 }
294
295 //preparation of three-point gaussian integration
296 double hulp[12] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
297 double conduc[12] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
298 for (int i1 = 0; i1 < iint; i1++)
299 {
300 for (int i2 = 0; i2 < 3; i2++)
301 {
302 double pgau[3] = {0.1127016654, 0.5, 0.8872983346};
303 double wgau[3] = {0.2777778, 0.4444444, 0.2777778};
304
305 int i3( 3 * i1 + i2);
306
307 //the three points in the full-width intervals are standard
308 double pfstan[9] = {0.705143, 1.352183, 1.601282, 1.771497, 2.031409, 2.192880, 2.274233, 2.397940, 2.494110};
309 double pfgau( pfstan[i3]);
310
311 //the three points in the last interval are calculated
312 if ( i1 == (iint-1))
313 {
314 if ( iint < 4)
315 {
316 pfgau = std::log10( start[iint-1] + pgau[i2] * del[iint-1]);
317 }
318 else
319 {
320 pfgau = logst4 + pgau[i2] * del[iint-1];
321 }
322 }
323
324 double const wcl_loc( ldndc::hydrology::water_content( std::exp(elog10 * pfgau), wc_.vga_sl[_sl], wc_.vgn_sl[_sl], wc_.vgm_sl[_sl], _saturation, 0.1));
325 conduc[i3] = ldndc::hydraulic_conductivity( wcl_loc, wc_.vgm_sl[_sl], wc_.mvg_tau_sl[_sl],
326 _saturation, wc_.wc_wp_sl[_sl], kst_sl[_sl] * cbm::CM_IN_M);
327 hulp[i3] = del[i1] * wgau[i2] * conduc[i3];
328 if (i3 > 8)
329 {
330 hulp[i3] = hulp[i3] * elog10 * std::exp( elog10 * pfgau);
331 }
332 }
333 }
334
335 //setting upper and lower limit
336 double const wcl_loc( ldndc::hydrology::water_content( _cp, wc_.vga_sl[_sl], wc_.vgn_sl[_sl], wc_.vgm_sl[_sl], _saturation, 0.1));
337 double const kms( ldndc::hydraulic_conductivity( wcl_loc, wc_.vgm_sl[_sl], wc_.mvg_tau_sl[_sl],
338 _saturation, wc_.wc_wp_sl[_sl], kst_sl[_sl] * cbm::CM_IN_M));
339 double fu( (_cp <= _delta_z) ? 0.0 : 1.27);
340 double fl( (_cp >= _delta_z) ? 0.0 : -kms);
341
342 if ( !cbm::flt_equal( _cp, _delta_z))
343 {
344 //iteration loop
345 int imax( 3 * iint);
346 for ( int i1 = 0; i1 < 14; i1++)
347 {
348 double flw( (fu + fl) / 2.0);
349 double df( (fu - fl) / 2.0);
350 if ( (df < 0.01) &&
351 ((df / std::abs(flw)) < 0.1))
352 {
353 break;
354 }
355
356 double z( 0.0);
357 for ( int i2 = 0; i2 < imax; i2++)
358 {
359 z = z + hulp[i2] / (conduc[i2] + flw);
360 }
361 if (z >= _delta_z)
362 {
363 fl = flw;
364 }
365 if (z <= _delta_z)
366 {
367 fu = flw;
368 }
369 }
370 }
371
372 //flow output in mm
373 _flow = 10.0 * (fu + fl) / 2.0;
374
375 return LDNDC_ERR_OK;
376}
lvector< double > kst_sl
Definition: echy.h:109

References kst_sl.

◆ EcHyFlood()

lerr_t ldndc::EcHy::EcHyFlood ( )
private

sets hydrologic conditions during flooding events, e.g.,

Flooding.

  • surface water table
  • bund height
18{
19 lerr_t rc = m_eventflood.solve();
20 if ( rc != LDNDC_ERR_OK){ return rc; }
21
22 bund_height = m_eventflood.get_bund_height();
23
24 /* todo */
25 //irrigation_amount = m_eventflood.get_irrigation_amount();
26
27 /* todo */
28 //double const irrigation_height = m_eventflood.get_irrigation_height();
29 double const max_percolation = m_eventflood.get_maximum_percolation();
30 double const water_table_flooding = m_eventflood.get_water_table();
31
32 irrigation_switch = NONE;
33 minimum_watertable_height = 0.0;
34 if ( cbm::is_valid( water_table_flooding))
35 {
36 if ( cbm::flt_greater_zero( water_table_flooding))
37 {
38 irrigation_switch = CONSTANT_POSITIVE_WATER_TABLE;
39 minimum_watertable_height = water_table_flooding;
40 bund_height = water_table_flooding;
41 }
42 else
43 {
44 irrigation_switch = CONSTANT_NEGATIVE_WATER_TABLE;
45 minimum_watertable_height = water_table_flooding;
46 bund_height = 0.0;
47 }
48 }
49
50 bool cracked( false);
51 for (size_t sl = 0; sl < soillayers_in->soil_layer_cnt()-1; sl++)
52 {
53 if ( cbm::flt_greater_equal( sc_.depth_sl[sl], 0.3))
54 {
55 if ( cbm::is_valid( max_percolation))
56 {
57 if ((kst_eq_sl[sl] > max_percolation / lclock()->time_resolution()))
58 {
59
60 kst_sl[sl] = cbm::bound_min( 0.0,
61 kst_eq_sl[sl] -
62 (kst_eq_sl[sl] - max_percolation / lclock()->time_resolution()) *
63 (sc_.depth_sl[sl] - 0.2) / (sc_.depth_sl[soillayers_in->soil_layer_cnt()-1] - 0.2));
64 }
65 kst_sl[sl] = max_percolation / lclock()->time_resolution();
66 }
67 else if ( wl_sl[sl] < -0.8 * pore_space( sl))
68 {
69 cracked = true;
70 }
71
72 if ( cracked)
73 {
74 double const time_rate( 0.1 / lclock()->time_resolution());
75 kst_sl[sl] = cbm::bound_min( 0.0,
76 kst_sl[sl] - (kst_sl[sl] - kst_eq_sl[sl]) * time_rate);
77 }
78 break;
79 }
80 }
81
82 return LDNDC_ERR_OK;
83}

References kst_sl, and wl_sl.

Referenced by solve().

Here is the caller graph for this function:

◆ EcHyGroundwater()

lerr_t ldndc::EcHy::EcHyGroundwater ( )
private

...

Negative groundwater table represents water on the soil surface

Negative groundwater table represents water on the soil surface

20{
21 cbm::invalidate( kst_bottom_gw_vertical);
22 if ( cbm::flt_greater( sc_.depth_sl[soillayers_in->soil_layer_cnt()-1], gw_depth_static))
23 {
28 if ( cbm::flt_greater( -gw_depth_static, surface_water))
29 {
30 gw_fill_surface = -gw_depth_static - surface_water;
31 }
32
33 //groundwater access
34 {
35 size_t sl( 0);
36 double const layer_midpoint_depth( 0.5 * sc_.h_sl[sl]);
37 if ( cbm::flt_greater_equal( layer_midpoint_depth, gw_depth_static))
38 {
39 gw_fill_sl[sl] = cbm::bound_min( 0.0,
40 0.999 * pore_space( sl) - wc_.ice_sl[sl] * sc_.h_sl[sl]
41 - (wl_sl[sl] + EcHySoilWaterChange( sl)));
42 wc_.accumulated_groundwater_access += gw_fill_sl[sl];
43 }
44 else
45 {
46 double const wl_new( wl_sl[sl] + EcHySoilWaterChange( sl));
47 double const wc_new( cbm::bound( wc_.wc_res_sl[sl], wl_new / sc_.h_sl[sl], wc_.wc_sat_sl[sl]));
48 kst_bottom_gw_vertical = cbm::bound_min( 0.0,
49 ldndc::hydraulic_conductivity(
50 wc_new,
51 wc_.vgm_sl[sl],
52 wc_.mvg_tau_sl[sl],
53 wc_.wc_sat_sl[sl],
54 wc_.wc_res_sl[sl],
55 kst_sl[sl]));
56 gw_fill_sl[sl] = 0.0;
57 }
58 }
59
60 for (size_t sl = 1; sl < soillayers_in->soil_layer_cnt()-1; sl++)
61 {
62 double const layer_midpoint_depth( sc_.depth_sl[sl] - 0.5 * sc_.h_sl[sl]);
63 if ( cbm::flt_greater_equal( layer_midpoint_depth, gw_depth_static))
64 {
65 gw_fill_sl[sl] = cbm::bound_min( 0.0,
66 0.999 * pore_space( sl) - wc_.ice_sl[sl] * sc_.h_sl[sl]
67 - (wl_sl[sl] + EcHySoilWaterChange( sl)));
68 wc_.accumulated_groundwater_access += gw_fill_sl[sl];
69 }
70 else
71 {
72 double const wl_new( wl_sl[sl] + EcHySoilWaterChange( sl));
73 double const wc_new( cbm::bound( wc_.wc_res_sl[sl], wl_new / sc_.h_sl[sl], wc_.wc_sat_sl[sl]));
74 kst_bottom_gw_vertical = cbm::bound_min( 0.0,
75 ldndc::hydraulic_conductivity(
76 wc_new,
77 wc_.vgm_sl[sl],
78 wc_.mvg_tau_sl[sl],
79 wc_.wc_sat_sl[sl],
80 wc_.wc_res_sl[sl],
81 kst_sl[sl]));
82 gw_fill_sl[sl] = 0.0;
83 }
84 }
85
86 {
87 size_t sl( soillayers_in->soil_layer_cnt()-1);
88 double const layer_midpoint_depth( sc_.depth_sl[sl] - 0.5 * sc_.h_sl[sl]);
89 if ( cbm::flt_greater_equal( layer_midpoint_depth, gw_depth_static))
90 {
91 gw_fill_sl[sl] = cbm::bound_min( 0.0,
92 0.999 * pore_space( sl) - wc_.ice_sl[sl] * sc_.h_sl[sl]
93 - (wl_sl[sl] + EcHySoilWaterChange( sl)));
94 wc_.accumulated_groundwater_access += gw_fill_sl[sl];
95 }
96 else
97 {
98 double const wl_new( wl_sl[sl] + EcHySoilWaterChange( sl));
99 double const wc_new( cbm::bound( wc_.wc_res_sl[sl], wl_new / sc_.h_sl[sl], wc_.wc_sat_sl[sl]));
100 kst_bottom_gw_vertical = cbm::bound_min( 0.0,
101 ldndc::hydraulic_conductivity(
102 wc_new,
103 wc_.vgm_sl[sl],
104 wc_.mvg_tau_sl[sl],
105 wc_.wc_sat_sl[sl],
106 wc_.wc_res_sl[sl],
107 kst_sl[sl]));
108 gw_fill_sl[sl] = 0.0;
109 }
110 }
111 }
112
113 //capillary rise
114 if ( have_capillary_rise)
115 {
116 size_t const STEPS( 10);
117 for (size_t steps = 0; steps < STEPS; steps++)
118 {
119 for (size_t sl = 0; sl < soillayers_in->soil_layer_cnt()-1; sl++)
120 {
121 double const layer_midpoint_depth( sc_.depth_sl[sl] - 0.5 * sc_.h_sl[sl]);
122 if ( cbm::flt_greater_equal( layer_midpoint_depth, gw_depth_static))
123 {
124 break;
125 }
126
127 /* Water contents with until now calculated water balance */
128 double const wl_new_0( wl_sl[sl] + EcHySoilWaterChange( sl));
129 double const wl_new_1( wl_sl[sl+1] + EcHySoilWaterChange( sl+1));
130
131 double const wc_vg_0( cbm::bound( wc_.wc_res_sl[sl], wl_new_0 / sc_.h_sl[sl], wc_.wc_sat_sl[sl]));
132 double const wc_vg_1( cbm::bound( wc_.wc_res_sl[sl+1], wl_new_1 / sc_.h_sl[sl+1], wc_.wc_sat_sl[sl+1]));
133
134 /* Unsaturated hydraulic conductivity with until now calculated water balance */
135 double const kust_0( cbm::bound_min( 0.0,
136 ldndc::hydraulic_conductivity(
137 wc_vg_0, wc_.vgm_sl[sl], wc_.mvg_tau_sl[sl],
138 wc_.wc_sat_sl[sl], wc_.wc_res_sl[sl],
139 1.0/double(STEPS)*kst_sl[sl])));
140 double const kust_1( cbm::bound_min( 0.0,
141 ldndc::hydraulic_conductivity(
142 wc_vg_1, wc_.vgm_sl[sl+1], wc_.mvg_tau_sl[sl],
143 wc_.wc_sat_sl[sl+1], wc_.wc_res_sl[sl+1],
144 1.0/double(STEPS)*kst_sl[sl+1])));
145
146 double const capillary_pressure_0( ldndc::capillary_pressure(
147 wl_new_0/sc_.h_sl[sl], wc_.vga_sl[sl],
148 wc_.vgn_sl[sl], wc_.vgm_sl[sl],
149 wc_.wc_sat_sl[sl], wc_.wc_res_sl[sl]));
150 double const capillary_pressure_1( ldndc::capillary_pressure(
151 wl_new_1/sc_.h_sl[sl+1], wc_.vga_sl[sl+1],
152 wc_.vgn_sl[sl+1], wc_.vgm_sl[sl+1],
153 wc_.wc_sat_sl[sl], wc_.wc_res_sl[sl+1]));
154
155 double const kust( cbm::flt_greater( capillary_pressure_0, capillary_pressure_1) ? kust_1 : kust_0 );
156 double const flow( (capillary_pressure_1 - capillary_pressure_0) / (0.5 * (sc_.h_sl[sl] + sc_.h_sl[sl+1])) * kust);
157
158 /* downward flow*/
159 if ( cbm::flt_greater_zero( flow))
160 {
161 double const left( wl_sl[sl] + EcHySoilWaterChange( sl) - (wc_.wc_res_sl[sl] * sc_.h_sl[sl]));
162 double const space( 0.999 * pore_space( sl+1) - wc_.ice_sl[sl+1] * sc_.h_sl[sl+1]
163 - (wl_sl[sl+1] + EcHySoilWaterChange( sl+1)));
164
165 if ( cbm::flt_greater_zero( left) &&
166 cbm::flt_greater_zero( space))
167 {
168 double const bound_flow( cbm::bound_max( flow, std::min( left, space)) / static_cast<double>(STEPS));
169 cr_fill_sl[sl] -= bound_flow;
170 cr_fill_sl[sl+1] += bound_flow;
171 }
172 }
173 /* upward flow */
174 else if ( cbm::flt_less( flow, 0.0))
175 {
176 double const left( wl_sl[sl+1] + EcHySoilWaterChange( sl+1) - (wc_.wc_res_sl[sl+1] * sc_.h_sl[sl+1]));
177 double const space( 0.999 * pore_space( sl) - wc_.ice_sl[sl] * sc_.h_sl[sl]
178 - (wl_sl[sl] + EcHySoilWaterChange( sl)));
179
180 if ( cbm::flt_greater_zero( left) &&
181 cbm::flt_greater_zero( space))
182 {
183 double const bound_flow( cbm::bound_max( -flow, std::min( left, space)) / static_cast<double>(STEPS));
184 cr_fill_sl[sl] += bound_flow;
185 cr_fill_sl[sl+1] -= bound_flow;
186 }
187 }
188 }
189
190 size_t sl( soillayers_in->soil_layer_cnt()-1);
191 double const layer_midpoint_depth( sc_.depth_sl[sl] - 0.5 * sc_.h_sl[sl]);
192 if ( cbm::flt_greater( gw_depth_static, layer_midpoint_depth))
193 {
194 /* Water contents with until now calculated water balance */
195 double const wl_new( wl_sl[sl] + EcHySoilWaterChange( sl));
196
197 double const wc_vg( cbm::bound( wc_.wc_res_sl[sl], wl_new / sc_.h_sl[sl], wc_.wc_sat_sl[sl]));
198
199 /* Unsaturated hydraulic conductivity with until now calculated water balance */
200 double const kust( cbm::bound_min( 0.0,
201 ldndc::hydraulic_conductivity(
202 wc_vg, wc_.vgm_sl[sl], wc_.mvg_tau_sl[sl],
203 wc_.wc_sat_sl[sl], wc_.wc_res_sl[sl],
204 1.0/double(STEPS)*kst_sl[sl])));
205
206 double const capillary_pressure( ldndc::capillary_pressure(
207 wl_new/sc_.h_sl[sl], wc_.vga_sl[sl],
208 wc_.vgn_sl[sl], wc_.vgm_sl[sl],
209 wc_.wc_sat_sl[sl], wc_.wc_res_sl[sl]));
210
211 /* upward flow */
212 double const flow( -capillary_pressure / (gw_depth_static - layer_midpoint_depth) * kust);
213 if ( cbm::flt_less( flow, 0.0))
214 {
215 double const space( 0.999 * pore_space( sl) - wc_.ice_sl[sl] * sc_.h_sl[sl]
216 - (wl_sl[sl] + EcHySoilWaterChange( sl)));
217 if ( cbm::flt_greater_zero( space))
218 {
219 double const bound_flow( cbm::bound_max( -flow, 1.0 / static_cast<double>(STEPS) * space));
220 cr_fill_sl[sl] += bound_flow;
221 cr_fill_groundwater += bound_flow;
222 }
223 }
224 }
225 }
226 }
227
228 return LDNDC_ERR_OK;
229}
double EcHySoilWaterChange(size_t)
Definition: echy.cpp:439
lvector< double > cr_fill_sl
Definition: echy.h:94
double gw_depth_static
Definition: echy.h:74

References cr_fill_groundwater, cr_fill_sl, EcHySoilWaterChange(), gw_depth_static, gw_fill_sl, gw_fill_surface, kst_sl, and wl_sl.

Referenced by solve().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EcHyIntegration()

lerr_t ldndc::EcHy::EcHyIntegration ( )
private

...

Integrates all water state variables.

452{
453 canopy_snow = cbm::bound_min( 0.0,
454 canopy_snow - canopy_snowmelt);
455 surface_snow = cbm::bound_min( 0.0,
456 surface_snow
458 - surface_snowmelt);
459
460 canopy_water = cbm::bound_min( 0.0,
463 surface_water = cbm::bound_min( 0.0,
464 surface_water
465 + throughfall_water + surface_snowmelt + gw_fill_surface + irrigation
467
468 for (size_t sl = 0; sl < soillayers_in->soil_layer_cnt(); sl++)
469 {
470 wl_sl[sl] = cbm::bound_min( 0.0, wl_sl[sl] + EcHySoilWaterChange( sl));
471 wc_.mskpa_sl[sl] = ldndc::hydrology::capillary_pressure( wl_sl[sl]/sc_.h_sl[sl], wc_.vga_sl[sl],
472 wc_.vgn_sl[sl], wc_.vgm_sl[sl],
473 wc_.wc_sat_sl[sl], wc_.wc_res_sl[sl]);
474 }
475
476 return LDNDC_ERR_OK;
477}
lvector< double > bypass_fill_sl
Definition: echy.h:100
double canopy_snowmelt
Definition: echy.h:140

References bypass_fill_sl, canopy_snowmelt, canopy_water, EcHySoilWaterChange(), ev_surfacewater, gw_fill_surface, runoff, throughfall_snow, throughfall_water, wl_sl, and wlfl_sl.

Referenced by solve().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EcHySoilWaterChange()

double ldndc::EcHy::EcHySoilWaterChange ( size_t  _sl)
private

Integrates all water state variables.

441{
442 return wlfl_sl[_sl] - wlfl_sl[_sl+1] + cr_fill_sl[_sl] - trwl_sl[_sl] - evsws_sl[_sl] + gw_fill_sl[_sl];
443}

References cr_fill_sl, evsws_sl, gw_fill_sl, trwl_sl, and wlfl_sl.

Referenced by EcHyGetAvailableWaterEvaporation(), EcHyGetAvailableWaterTranspiration(), EcHyGroundwater(), EcHyIntegration(), and EcHyIrrigation().

Here is the caller graph for this function:

◆ solve()

lerr_t ldndc::EcHy::solve ( )

Kicks off computation for one time step.

36{
37 /* reset of all fluxes */
38 EcHyreset();
39
40 /* flooding events */
41 lerr_t rc = EcHyFlood();
42 if ( rc != LDNDC_ERR_OK)
43 {
44 KLOGERROR("Handling flooding event failed in: ", name());
45 return rc;
46 }
47
48 /* tasks:
49 * - update internal state (e.g., throughfall_water, ...)
50 * - calculate evapotranspiration on demand
51 */
52 rc = EcHyStepInit();
53 if ( rc != LDNDC_ERR_OK)
54 { return rc; }
55
56 /* begin water balance */
57 double balance( -1.0);
58 EcHyBalanceCheck( balance);
59
60 /* snow and ice calculated */
62
63 /*
64 * apply irrigation triggered by
65 * - irrigation events
66 * - flooding events
67 */
69
70 double const potential_infiltration( surface_water + irrigation + throughfall_water + surface_snowmelt);
71 double bypass_flow( m_param->CRACK_FRACTION() * potential_infiltration);
72
73 /* bypass flow */
74 EcHyBypassFlow( m_param->CRACK_DEPTH(), bypass_flow);
75 double const infiltration( potential_infiltration - bypass_flow);
76
77 /* downward water flow */
78 wlfl_sl[0] = cbm::bound_max( infiltration, kst_sl[0]);
79 for ( size_t sl = 0; sl < soillayers_in->soil_layer_cnt(); ++sl)
80 {
81 EcHyPercolation( 1, sl);
82 }
83
84 if ( cbm::is_valid( kst_bottom))
85 {
86 wlfl_sl[soillayers_in->soil_layer_cnt()] = cbm::bound_max( wlfl_sl[soillayers_in->soil_layer_cnt()],
88 }
89 if ( cbm::is_valid( kst_bottom_gw_lateral))
90 {
91 wlfl_sl[soillayers_in->soil_layer_cnt()] = cbm::bound_max( wlfl_sl[soillayers_in->soil_layer_cnt()],
92 kst_bottom_gw_lateral);
93 }
94 if ( cbm::is_valid( kst_bottom_gw_vertical))
95 {
96 wlfl_sl[soillayers_in->soil_layer_cnt()] = cbm::bound_max( wlfl_sl[soillayers_in->soil_layer_cnt()],
97 kst_bottom_gw_vertical);
98 }
99
101
102 /* upward water flow */
103 for ( size_t sl = soillayers_in->soil_layer_cnt(); sl-- > 0; )
104 {
105 EcHyPercolation( 2, sl);
106 }
107
108 /* runoff */
109 if ( runoff_method == "curvenumber")
110 {
111 double const surface_water_in_mm( surface_water * cbm::MM_IN_M);
112 double const curvenumber( 70.0);
113
114 //retention parameter [mm]
115 double const retention_factor( 25.4 * (1000.0 / curvenumber - 10));
116
117 //runoff [mm]
118 double const q_surf( cbm::sqr( surface_water_in_mm) /
119 ((surface_water_in_mm + retention_factor) * lclock()->time_resolution()));
120
121 runoff = cbm::bound( 0.0,
122 q_surf * cbm::M_IN_MM,
123 0.99 * (surface_water + irrigation + throughfall_water + surface_snowmelt
124 - wlfl_sl[0] - bypass_flow));
125 }
126 else
127 {
128 double const f_runoff( cbm::bound_max( m_param->FRUNOFF() / lclock()->time_resolution(), 1.0));
129 runoff = cbm::bound_min( 0.0, f_runoff * (surface_water + irrigation + throughfall_water + surface_snowmelt
130 - wlfl_sl[0] - bypass_flow - bund_height));
131 }
132
133 /* groundwater interaction:
134 * - set soil layers water-saturated
135 * - capillary rise
136 */
138
139 /* integration of state variables */
141
142 /* update external state */
143 EcHyStepExit();
144
145 /* perform water balance */
146 rc = EcHyBalanceCheck( balance);
147 if ( rc){ return rc; }
148
149 rc = EcHy_check_for_negative_value("exit");
150 if ( rc){ return rc; }
151
152 return LDNDC_ERR_OK;
153}
lerr_t EcHyBypassFlow(double, double &)
Calculates water percolation within the soil profile.
lerr_t EcHyPercolation(size_t, size_t)
Calculates water percolation within the soil profile.
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
lerr_t EcHyStepInit()
...
Definition: echy.cpp:193
lerr_t EcHyEvapotranspiration()
Calculates evapotranspiration within the soil profile.
lerr_t EcHyGroundwater()
...
Definition: echy-groundwater.cpp:19
lerr_t EcHyBalanceCheck(double &)
...
Definition: echy.cpp:485
lerr_t EcHyIrrigation()
Irrigation.
Definition: echy-management.cpp:91
void EcHyreset()
...
Definition: echy.cpp:161
lerr_t EcHyIntegration()
...
Definition: echy.cpp:451
lerr_t EcHyStepExit()
...
Definition: echy.cpp:320
double kst_bottom
Definition: echy.h:69
cbm::string_t runoff_method
Definition: echy.h:196

References EcHyBalanceCheck(), EcHyBypassFlow(), EcHyEvapotranspiration(), EcHyFlood(), EcHyGroundwater(), EcHyIntegration(), EcHyIrrigation(), EcHyPercolation(), EcHyreset(), EcHySnowIce(), EcHyStepExit(), EcHyStepInit(), kst_bottom, kst_sl, runoff, runoff_method, throughfall_water, and wlfl_sl.

Here is the call graph for this function:

Member Data Documentation

◆ accumulated_irrigation_old

double ldndc::EcHy::accumulated_irrigation_old
private

Accumulated irrigation of last time step [m]

Referenced by EcHyIrrigation().

◆ accumulated_potentialtranspiration_old

double ldndc::EcHy::accumulated_potentialtranspiration_old
private

Accumulated potential transpiration of last time step [m]

Referenced by EcHyPotentialEvapotranspiration().

◆ bypass_fill_sl

lvector< double > ldndc::EcHy::bypass_fill_sl
private

Soillayer water input due to bypass flow

Referenced by EcHyIntegration(), and EcHyreset().

◆ canopy_snowmelt

double ldndc::EcHy::canopy_snowmelt
private

Snow melting

Referenced by EcHyIntegration(), and EcHySnowIce().

◆ canopy_water

double ldndc::EcHy::canopy_water
private

◆ cr_fill_groundwater

double ldndc::EcHy::cr_fill_groundwater
private

Water addition to last soil layer from groundwater water by cappillary rise (only used for water balance calculation)

Referenced by EcHyBalanceCheck(), EcHyGroundwater(), and EcHyreset().

◆ cr_fill_sl

lvector< double > ldndc::EcHy::cr_fill_sl
private

Soillayer water input due to capillary rise

Referenced by EcHyGroundwater(), EcHyreset(), and EcHySoilWaterChange().

◆ daily_potential_evapotranspiration

double ldndc::EcHy::daily_potential_evapotranspiration
private

◆ daily_potential_leaf_evaporation

double ldndc::EcHy::daily_potential_leaf_evaporation
private

◆ daily_potential_soil_evaporation

double ldndc::EcHy::daily_potential_soil_evaporation
private

◆ daily_potential_transpiration

double ldndc::EcHy::daily_potential_transpiration
private

◆ ev_leaf

double ldndc::EcHy::ev_leaf
private

Evaporation from plant surface

Referenced by EcHyBalanceCheck(), and EcHyStepExit().

◆ ev_surfacewater

double ldndc::EcHy::ev_surfacewater
private

Evaporation from surface water

Referenced by EcHyBalanceCheck(), EcHyIntegration(), and EcHyreset().

◆ evapotranspiration_method

cbm::string_t ldndc::EcHy::evapotranspiration_method
private

◆ evsws_sl

lvector< double > ldndc::EcHy::evsws_sl
private

Evaporation from soil layer

Referenced by EcHyBalanceCheck(), EcHyreset(), EcHySoilWaterChange(), and EcHyStepExit().

◆ gw_depth_static

double ldndc::EcHy::gw_depth_static
private

Depth of groundwater table [m]

Referenced by EcHyGroundwater(), and EcHyStepInit().

◆ gw_fill_sl

lvector< double > ldndc::EcHy::gw_fill_sl
private

Soillayer water input due to groundwater flow

Referenced by EcHyBalanceCheck(), EcHyGroundwater(), EcHyreset(), and EcHySoilWaterChange().

◆ gw_fill_surface

double ldndc::EcHy::gw_fill_surface
private

Water addition to surface water from groundwater water boundary condition

Referenced by EcHyBalanceCheck(), EcHyGroundwater(), EcHyIntegration(), and EcHyreset().

◆ kst_bottom

double ldndc::EcHy::kst_bottom
private

Saturated hydraulic conductivity below last soil layer [cm:min-1]

Referenced by EcHyStepInit(), and solve().

◆ kst_sl

lvector< double > ldndc::EcHy::kst_sl
private

Saturated hydraulic conductivity

Referenced by EcHyCapillaryRise(), EcHyFlood(), EcHyGroundwater(), and solve().

◆ m_icecontent_in

WaterCycleSnowDNDC::IceContentStateIn ldndc::EcHy::m_icecontent_in
private

...

Referenced by EcHySnowIce().

◆ runoff

double ldndc::EcHy::runoff
private

Lateral surface runoff

Referenced by EcHyBalanceCheck(), EcHyIntegration(), EcHyreset(), EcHyStepExit(), and solve().

◆ runoff_method

cbm::string_t ldndc::EcHy::runoff_method
private

...

Referenced by solve().

◆ thornthwaite_heat_index

double ldndc::EcHy::thornthwaite_heat_index
private

◆ throughfall_snow

double ldndc::EcHy::throughfall_snow
private

◆ throughfall_water

double ldndc::EcHy::throughfall_water
private

◆ trwl_sl

lvector< double > ldndc::EcHy::trwl_sl
private

Water withdrawl by transpiration [m d−1]

Referenced by EcHyBalanceCheck(), EcHyreset(), EcHySoilWaterChange(), and EcHyStepExit().

◆ wl_sl

◆ wlfc_sl

lvector< double > ldndc::EcHy::wlfc_sl
private

Amount of water in soil layer at field capacity

Referenced by EcHyIrrigation().

◆ wlfl_sl

lvector< double > ldndc::EcHy::wlfl_sl
private

Water flux at boundaries of soil layer [m d-1] the flux of water between soil layer is tracked by wlfl (mm d−1). in total, there are nl+1 flow rates, where nl is the number of soil layers, wlfl[1] is the flow rate between the ponded water layer and the soil surface, wlfl[2] is the flow rate between soil layer 1 and soil layer 2, etc.

Referenced by EcHyBalanceCheck(), EcHyIntegration(), EcHyreset(), EcHySoilWaterChange(), EcHyStepExit(), and solve().

◆ wlwp_sl

lvector< double > ldndc::EcHy::wlwp_sl
private

Amount of water in soil layer at wilting point

Referenced by EcHyGetWiltingPoint().