ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_ForceRestoreHydrology.H
Go to the documentation of this file.
1 #ifndef ERF_FORCE_RESTORE_HYDROLOGY_H_
2 #define ERF_FORCE_RESTORE_HYDROLOGY_H_
3 
4 #include <AMReX_Algorithm.H>
5 #include <AMReX_GpuQualifiers.H>
6 #include <AMReX_Math.H>
7 #include <AMReX_REAL.H>
8 #include <cmath>
9 
10 #include <ERF_MicrophysicsConstants.H> // rhor, the density of water
11 #include <ERF_NumericalConstants.H> // zero, one
12 
13 /**
14  * @file ERF_ForceRestoreHydrology.H
15  * @brief Water of the two-stream force-restore surface: rain in, runoff, a prognostic deep
16  * reservoir with gravitational drainage, and a prognostic deep temperature.
17  *
18  * The force-restore balance (ERF_SimplifiedSEB.H) carries q_s, the volumetric water content
19  * [m^3/m^3] of a surface layer d_s deep (erf.radiation.seb_moisture_layer_depth_m), restored
20  * toward q_deep over tau_q. These functions add the terms of Noilhan and Planton (1989,
21  * "NP89") and Mahfouf and Noilhan (1996, "MN96") that it leaves out, each behind its own
22  * input:
23  *
24  * - Rain (erf.radiation.seb_precipitation_source = microphysics). P [kg/m^2/s] enters the
25  * surface layer as in NP89 Eq. (11) and Deardorff (1978) Eq. (12), with depth d_1 = d_s:
26  * dq_s/dt += P / (rho_w d_s).
27  * NP89 Eq. (11) multiplies (P - E) by one coefficient C1. The existing balance takes E out
28  * of q_s with C1 = 1 (prognostic_dqs_dt), so rain uses C1 = 1 too. NP89 Eq. (19) and Table 2
29  * give C1 = 0.08-0.34 at saturation, rising as the soil dries, and D78 Eq. (13) gives
30  * C1 = 0.5-14. With C1 = 1 the 10 cm layer fills faster than with NP89's C1 near saturation,
31  * so heavy rain runs off sooner than in NP89.
32  * - Runoff (with rain). Water above the porosity w_sat runs off (NP89 Sec. 4a: "Runoff occurs
33  * when w_g or w_2 exceeds the saturation value w_sat"). The surface layer's runoff that
34  * leaves the column is at most this step's rain: water above w_sat that was already in q_s
35  * (a restore overshoot, or a restart from a run without hydrology) is clamped off q_s and
36  * does not come out of the column.
37  * - Deep reservoir (erf.radiation.seb_deep_prognostic_enable). q_deep becomes w_2, the mean
38  * water content of the soil column of depth d_2 (erf.radiation.seb_deep_layer_depth_m),
39  * which contains the surface layer (NP89 Eq. 12, MN96 Eq. 4):
40  * dq_deep/dt = (P - E) / (rho_w d_2).
41  * Since w_2 is the mean of the whole column, the restore term of q_s moves water within the
42  * column and does not appear here; the column's water is rho_w d_2 q_deep.
43  * - Deep temperature (with the deep reservoir). T_2 relaxes toward T_s over tau
44  * (erf.radiation.seb_restore_timescale_s), NP89 Eq. (6):
45  * dT_2/dt = (T_s - T_2) / tau.
46  * - Gravitational drainage (erf.radiation.seb_drainage_enable). Water above field capacity
47  * w_fc leaves the bottom of the column, MN96 Eq. (4):
48  * dq_deep/dt += -(C_3 / tau_1d) max(0, q_deep - w_fc),
49  * with C_3 = (C_3 d_2) / d_2 (MN96 Eq. 16 and Table 1, which tabulates C_3 for d_2 = 1 m).
50  * MN96 Eq. (15) makes C_3 proportional to tau, and Table 1 is computed with tau = 1 day
51  * (MN96 appendix), so the drainage uses tau_1d = 86400 s, not seb_restore_timescale_s. The
52  * drainage rate then does not depend on that input.
53  *
54  * The relaxation terms (drainage, deep temperature) are linear in the state, so each is
55  * integrated exactly over the step, x_new - x_eq = (x_old - x_eq) exp(-k dt); the update
56  * cannot overshoot whatever the step. The source terms (rain, evaporation) are forward Euler,
57  * as the existing balance is.
58  *
59  * References:
60  * - Deardorff, J. W., 1978: Efficient prediction of ground surface temperature and moisture,
61  * with inclusion of a layer of vegetation. J. Geophys. Res., 83, 1889-1903.
62  * - Noilhan, J., and S. Planton, 1989: A simple parameterization of land surface processes
63  * for meteorological models. Mon. Wea. Rev., 117, 536-549.
64  * - Mahfouf, J.-F., and J. Noilhan, 1996: Inclusion of gravitational drainage in a land
65  * surface scheme based on the force-restore method. J. Appl. Meteor., 35, 987-992.
66  */
67 
68 /**
69  * @brief Parameters of one force-restore hydrology step (from erf.radiation.seb_*).
70  */
71 /// The restore period [s] with which MN96 Table 1 and Eq. (16) give C_3 (MN96 appendix).
72 constexpr amrex::Real force_restore_c3_tau = 86400.0;
73 
75 {
76  amrex::Real d_s = 0.1; ///< Surface layer depth d_1 [m] (seb_moisture_layer_depth_m)
77  amrex::Real d_2 = 1.0; ///< Column depth d_2 [m] (seb_deep_layer_depth_m)
78  amrex::Real tau = 86400.0; ///< Restore period of T_2 [s] (seb_restore_timescale_s)
79  amrex::Real w_fc = 0.0; ///< Field capacity [m^3/m^3] (seb_soil_moisture_fc)
80  amrex::Real w_sat = 1.0; ///< Porosity [m^3/m^3] (seb_soil_porosity)
81  amrex::Real c3 = 0.0; ///< Drainage coefficient C_3 at depth d_2 [-] (seb_drainage_c3_m / d_2)
82  amrex::Real q_min = 0.0; ///< Lower bound of q_s (seb_prognostic_q_min)
83  amrex::Real q_max = 1.0; ///< Upper bound of q_s (seb_prognostic_q_max)
84  bool rain = false; ///< seb_precipitation_source != none
85  bool deep = false; ///< seb_deep_prognostic_enable
86  bool drain = false; ///< seb_drainage_enable (needs deep)
87 };
88 
89 /**
90  * @brief Water that left a column during one step [kg/m^2].
91  */
93 {
94  amrex::Real runoff = 0.0; ///< Above-porosity water that left the column: rain that did not infiltrate, and column excess
95  amrex::Real drainage = 0.0; ///< Gravitational drainage out of the column bottom
96  amrex::Real deficit = 0.0; ///< Water the column lacked when evaporation would take q_deep below 0
97 };
98 
99 /**
100  * @brief Rain rate [kg/m^2/s] from the change of the surface precipitation accumulation over
101  * one step.
102  *
103  * @param[in] accum_end accumulation at the end of the step [kg/m^2]
104  * @param[in] accum_start accumulation at the start of the step [kg/m^2]
105  * @param[in] dt the step [s]
106  * @return (end - start) / dt; zero for a non-positive step, a non-positive change (round-off
107  * or a reset accumulator) and any non-finite input.
108  */
109 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
110 amrex::Real force_restore_rain_rate (amrex::Real accum_end, amrex::Real accum_start,
111  amrex::Real dt) noexcept
112 {
113  if (!(dt > amrex::Real(0.0))) { return amrex::Real(0.0); }
114  const amrex::Real d = accum_end - accum_start;
115  if (!(d > amrex::Real(0.0)) || !amrex::Math::isfinite(d)) { return amrex::Real(0.0); }
116  return d / dt;
117 }
118 
119 /**
120  * @brief One step of the force-restore hydrology for one column, after the balance has
121  * updated T_s and q_s (prognostic_dTs_dt, prognostic_dqs_dt).
122  *
123  * In order: rain into the surface layer and the surface runoff above the porosity (at most
124  * the step's rain: water that never infiltrates); the infiltrated rain minus the evaporation
125  * into the column, then its drainage; the deep temperature toward the updated T_s; runoff of
126  * the column above the porosity; the bounds of q_s and q_deep. The surface runoff is taken
127  * before the drainage, so water that never entered the soil does not drain.
128  *
129  * With the deep reservoir, the column then satisfies exactly
130  * rho_w d_2 (q_deep_new - q_deep_old) = (P - E) dt - drainage - runoff + deficit.
131  *
132  * @param[in,out] q_s surface-layer water content [m^3/m^3]
133  * @param[in,out] q_deep column water content [m^3/m^3]; changed only with prm.deep
134  * @param[in,out] t_deep deep temperature [K]; changed only with prm.deep
135  * @param[in] t_s surface temperature after this step's update [K]
136  * @param[in] p rain reaching the soil [kg/m^2/s]; used only with prm.rain
137  * @param[in] e evaporation LE / L_v [kg/m^2/s], positive upward
138  * @param[in] dt the step [s]
139  * @param[in] prm parameters
140  * @return the water that left the column, and any deficit
141  */
142 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
144 force_restore_hydrology_step (amrex::Real& q_s, amrex::Real& q_deep, amrex::Real& t_deep,
145  amrex::Real t_s, amrex::Real p, amrex::Real e, amrex::Real dt,
146  const ForceRestoreHydrologyParams& prm) noexcept
147 {
149  if (!prm.rain) { p = zero; }
150  if (!amrex::Math::isfinite(p)) { p = zero; }
151  if (!amrex::Math::isfinite(e)) { e = zero; }
152 
153  // Rain into the surface layer: NP89 Eq. (11), first term, with C1 = 1 and d_1 = d_s.
154  // (The balance already removed E from q_s in prognostic_dqs_dt.)
155  // Runoff above saturation (NP89 Sec. 4a) from the surface layer: at most this step's rain
156  // runs off there, since that water never infiltrated. Water above w_sat that q_s held
157  // before the rain is clamped off q_s and stays in the column.
158  amrex::Real surface_runoff = zero;
159  if (prm.rain) {
160  q_s += dt * p / (rhor * prm.d_s);
161  if (q_s > prm.w_sat) {
162  surface_runoff = amrex::min(rhor * prm.d_s * (q_s - prm.w_sat), p * dt);
163  q_s = prm.w_sat;
164  out.runoff += surface_runoff;
165  }
166  }
167 
168  if (prm.deep) {
169  // The column's water: NP89 Eq. (12), MN96 Eq. (4), first term, with the rain that
170  // infiltrated.
171  q_deep += (dt * (p - e) - surface_runoff) / (rhor * prm.d_2);
172 
173  // Gravitational drainage toward field capacity: MN96 Eq. (4), second term, exact
174  // over the step for the linear relaxation.
175  if (prm.drain && q_deep > prm.w_fc) {
176  const amrex::Real removed = (q_deep - prm.w_fc) *
177  (one - std::exp(-prm.c3 * dt / force_restore_c3_tau));
178  q_deep -= removed;
179  out.drainage = rhor * prm.d_2 * removed;
180  }
181 
182  // Deep temperature: NP89 Eq. (6), exact over the step.
183  t_deep += (t_s - t_deep) * (one - std::exp(-dt / prm.tau));
184 
185  // Runoff of the column above saturation.
186  if (q_deep > prm.w_sat) {
187  out.runoff += rhor * prm.d_2 * (q_deep - prm.w_sat);
188  q_deep = prm.w_sat;
189  }
190  }
191 
192  // NP89 Eq. (12): 0 < w_2. An evaporation the column cannot supply is recorded, not hidden:
193  // the latent heat flux has already taken it, so a deficit is water the coupled system did
194  // not conserve (LE is not limited by q_deep).
195  if (prm.deep && q_deep < zero) {
196  out.deficit = -rhor * prm.d_2 * q_deep;
197  q_deep = zero;
198  }
199 
200  q_s = amrex::max(prm.q_min, amrex::min(prm.q_max, q_s));
201  return out;
202 }
203 
204 #endif // ERF_FORCE_RESTORE_HYDROLOGY_H_
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real force_restore_rain_rate(amrex::Real accum_end, amrex::Real accum_start, amrex::Real dt) noexcept
Rain rate [kg/m^2/s] from the change of the surface precipitation accumulation over one step.
Definition: ERF_ForceRestoreHydrology.H:110
constexpr amrex::Real force_restore_c3_tau
Parameters of one force-restore hydrology step (from erf.radiation.seb_*).
Definition: ERF_ForceRestoreHydrology.H:72
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ForceRestoreHydrologyFluxes force_restore_hydrology_step(amrex::Real &q_s, amrex::Real &q_deep, amrex::Real &t_deep, amrex::Real t_s, amrex::Real p, amrex::Real e, amrex::Real dt, const ForceRestoreHydrologyParams &prm) noexcept
One step of the force-restore hydrology for one column, after the balance has updated T_s and q_s (pr...
Definition: ERF_ForceRestoreHydrology.H:144
Physical constants and tuning parameters used only by the moisture and cloud-physics code.
constexpr amrex::Real rhor
Definition: ERF_MicrophysicsConstants.H:39
Dimensionless numeric literals and pure mathematical constants.
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
@ p
Definition: ERF_WSM6.H:303
Water that left a column during one step [kg/m^2].
Definition: ERF_ForceRestoreHydrology.H:93
amrex::Real deficit
Water the column lacked when evaporation would take q_deep below 0.
Definition: ERF_ForceRestoreHydrology.H:96
amrex::Real runoff
Above-porosity water that left the column: rain that did not infiltrate, and column excess.
Definition: ERF_ForceRestoreHydrology.H:94
amrex::Real drainage
Gravitational drainage out of the column bottom.
Definition: ERF_ForceRestoreHydrology.H:95
Definition: ERF_ForceRestoreHydrology.H:75
amrex::Real q_min
Lower bound of q_s (seb_prognostic_q_min)
Definition: ERF_ForceRestoreHydrology.H:82
amrex::Real q_max
Upper bound of q_s (seb_prognostic_q_max)
Definition: ERF_ForceRestoreHydrology.H:83
bool rain
seb_precipitation_source != none
Definition: ERF_ForceRestoreHydrology.H:84
amrex::Real tau
Restore period of T_2 [s] (seb_restore_timescale_s)
Definition: ERF_ForceRestoreHydrology.H:78
bool deep
seb_deep_prognostic_enable
Definition: ERF_ForceRestoreHydrology.H:85
amrex::Real w_sat
Porosity [m^3/m^3] (seb_soil_porosity)
Definition: ERF_ForceRestoreHydrology.H:80
amrex::Real w_fc
Field capacity [m^3/m^3] (seb_soil_moisture_fc)
Definition: ERF_ForceRestoreHydrology.H:79
bool drain
seb_drainage_enable (needs deep)
Definition: ERF_ForceRestoreHydrology.H:86
amrex::Real c3
Drainage coefficient C_3 at depth d_2 -
Definition: ERF_ForceRestoreHydrology.H:81
amrex::Real d_s
Surface layer depth d_1 [m] (seb_moisture_layer_depth_m)
Definition: ERF_ForceRestoreHydrology.H:76
amrex::Real d_2
Column depth d_2 [m] (seb_deep_layer_depth_m)
Definition: ERF_ForceRestoreHydrology.H:77