1 #ifndef ERF_SIMPLIFIED_SEB_H_
2 #define ERF_SIMPLIFIED_SEB_H_
4 #include <AMReX_GpuControl.H>
5 #include <AMReX_Math.H>
6 #include <AMReX_FArrayBox.H>
67 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
75 if (!amrex::Math::isfinite(sw_net) || !amrex::Math::isfinite(lw_net) ||
76 !amrex::Math::isfinite(hfx) || !amrex::Math::isfinite(lh) || !amrex::Math::isfinite(grdflx)) {
81 amrex::Real r_net = sw_net + lw_net;
84 amrex::Real seb_residual = r_net - hfx - lh - grdflx;
113 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
121 if (!amrex::Math::isfinite(seb_residual) || !amrex::Math::isfinite(t_s) ||
122 !amrex::Math::isfinite(t_deep) || !amrex::Math::isfinite(c_s) || !amrex::Math::isfinite(tau)) {
127 if (c_s <= 0.0 || tau <= 0.0) {
132 amrex::Real seb_term = seb_residual / c_s;
133 amrex::Real restore_term = (2.0 *
PI / tau) * (t_s - t_deep);
134 amrex::Real dt_s_dt = seb_term - restore_term;
168 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
176 if (!amrex::Math::isfinite(le) || !amrex::Math::isfinite(q_s) ||
177 !amrex::Math::isfinite(q_deep) || !amrex::Math::isfinite(d_s) || !amrex::Math::isfinite(tau_q)) {
182 if (d_s <= 0.0 || tau_q <= 0.0) {
190 amrex::Real le_term = -(le / (
L_v *
rhor * d_s));
191 amrex::Real restore_term = (1.0 / tau_q) * (q_s - q_deep);
192 amrex::Real dq_s_dt = le_term - restore_term;
217 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
222 if (!amrex::Math::isfinite(q_s) || !amrex::Math::isfinite(q_wilt) ||
223 !amrex::Math::isfinite(q_fc) || !(q_fc > q_wilt)) {
224 return amrex::Real(0.0);
226 const amrex::Real
beta = (q_s - q_wilt) / (q_fc - q_wilt);
227 return amrex::max(amrex::Real(0.0), amrex::min(amrex::Real(1.0),
beta));
253 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
255 amrex::Real rgl, amrex::Real t_opt,
256 amrex::Real
lai, amrex::Real sw_down,
257 amrex::Real t_canopy, amrex::Real soil_factor)
259 constexpr amrex::Real no_transpiration = amrex::Real(1.0e6);
260 if (!amrex::Math::isfinite(rs_min) || !amrex::Math::isfinite(rs_max) ||
261 !amrex::Math::isfinite(rgl) || !amrex::Math::isfinite(t_opt) ||
262 !amrex::Math::isfinite(
lai) || !amrex::Math::isfinite(sw_down) ||
263 !amrex::Math::isfinite(t_canopy) || !amrex::Math::isfinite(soil_factor) ||
264 !(
lai > amrex::Real(0.0)) || !(rgl > amrex::Real(0.0)) || !(rs_max > amrex::Real(0.0))) {
265 return no_transpiration;
267 const amrex::Real f = amrex::Real(0.55) * amrex::Real(2.0) *
268 amrex::max(amrex::Real(0.0), sw_down) / (rgl *
lai);
269 const amrex::Real f_sw = amrex::max(amrex::Real(1.0e-4), (f + rs_min / rs_max) / (amrex::Real(1.0) + f));
270 const amrex::Real dt = t_opt - t_canopy;
271 const amrex::Real f_t = amrex::max(amrex::Real(1.0e-4), amrex::Real(1.0) - amrex::Real(0.0016) * dt * dt);
272 const amrex::Real f_soil = amrex::max(amrex::Real(1.0e-6), soil_factor);
273 return amrex::min(no_transpiration, rs_min / (
lai * f_sw * f_t * f_soil));
287 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
289 amrex::Real theta_wilt, amrex::Real b,
290 amrex::Real d1, amrex::Real
p)
292 constexpr amrex::Real no_evaporation = amrex::Real(1.0e6);
293 if (!amrex::Math::isfinite(
theta) || !(
theta >= amrex::Real(0.01)) ||
294 !(theta_sat > amrex::Real(0.0)) || !(b > amrex::Real(0.0)) || !(d1 > amrex::Real(0.0)) ||
295 !(theta_wilt < theta_sat)) {
296 return no_evaporation;
298 const amrex::Real dry = amrex::Real(1.0) - amrex::min(amrex::Real(1.0),
theta / theta_sat);
299 const amrex::Real d_dry = d1 * (std::exp(std::pow(dry,
p)) - amrex::Real(1.0)) /
300 (amrex::Real(2.71828) - amrex::Real(1.0));
301 const amrex::Real diffusivity = amrex::Real(2.2e-5) * theta_sat * theta_sat *
302 std::pow(amrex::Real(1.0) - theta_wilt / theta_sat, amrex::Real(2.0) + amrex::Real(3.0) / b);
303 return amrex::min(no_evaporation, d_dry / diffusivity);
317 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
319 amrex::Real psi_sat, amrex::Real b,
320 amrex::Real t_ground)
322 if (!amrex::Math::isfinite(
theta) || !amrex::Math::isfinite(t_ground) ||
323 !(theta_sat > amrex::Real(0.0)) || !(psi_sat > amrex::Real(0.0)) ||
324 !(b > amrex::Real(0.0)) || !(t_ground > amrex::Real(0.0))) {
325 return amrex::Real(1.0);
327 const amrex::Real psi = -psi_sat * std::pow(amrex::max(amrex::Real(0.01),
theta) / theta_sat, -b);
328 return std::exp(psi * amrex::Real(9.80616) / (amrex::Real(461.269) * t_ground));
337 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
340 return theta * amrex::Real(4.188e6) + (amrex::Real(1.0) - theta_sat) * c_soil +
341 amrex::max(amrex::Real(0.0), theta_sat -
theta) * amrex::Real(1004.64);
351 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
354 const amrex::Real lambda_solid = std::pow(amrex::Real(7.7), quartz) *
355 std::pow(amrex::Real(2.0), amrex::Real(1.0) - quartz);
356 const amrex::Real lambda_sat = std::pow(lambda_solid, amrex::Real(1.0) - theta_sat) *
357 std::pow(amrex::Real(0.57), theta_sat);
358 const amrex::Real
gamma = (amrex::Real(1.0) - theta_sat) * amrex::Real(2700.0);
359 const amrex::Real lambda_dry = (amrex::Real(0.135) *
gamma + amrex::Real(64.7)) /
360 (amrex::Real(2700.0) - amrex::Real(0.947) *
gamma);
361 const amrex::Real sat_ratio =
theta / theta_sat;
362 const amrex::Real kersten = (sat_ratio > amrex::Real(0.1))
363 ? std::log10(sat_ratio) + amrex::Real(1.0) : amrex::Real(0.0);
364 return kersten * (lambda_sat - lambda_dry) + lambda_dry;
373 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
376 return amrex::Real(0.5) * std::sqrt(lambda * c * tau / amrex::Real(3.14159265358979323846));
constexpr amrex::Real L_v
Definition: ERF_Constants.H:67
amrex::Real gamma
Definition: ERF_InitCustomPert_DataAssimilation_ISV.H:9
Physical constants and tuning parameters used only by the moisture and cloud-physics code.
constexpr amrex::Real rhor
Definition: ERF_MicrophysicsConstants.H:39
constexpr amrex::Real PI
Definition: ERF_NumericalConstants.H:46
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real seb_soil_thermal_conductivity(amrex::Real theta, amrex::Real theta_sat, amrex::Real quartz)
Thermal conductivity of unfrozen soil [W/m/K], Noah-MP's Johansen form (SoilThermalPropertyMod): soli...
Definition: ERF_SimplifiedSEB.H:352
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real seb_soil_evaporation_resistance(amrex::Real theta, amrex::Real theta_sat, amrex::Real theta_wilt, amrex::Real b, amrex::Real d1, amrex::Real p)
Resistance of bare soil to evaporation [s/m], Noah-MP's ground-evaporation option 1 (Sakaguchi and Ze...
Definition: ERF_SimplifiedSEB.H:288
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real seb_moisture_availability(amrex::Real q_s, amrex::Real q_wilt, amrex::Real q_fc)
Moisture availability beta of the force-restore surface, from its water content.
Definition: ERF_SimplifiedSEB.H:218
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real seb_soil_surface_relative_humidity(amrex::Real theta, amrex::Real theta_sat, amrex::Real psi_sat, amrex::Real b, amrex::Real t_ground)
Relative humidity of the air in the top soil's pores, Noah-MP's for bare ground (ResistanceGroundEvap...
Definition: ERF_SimplifiedSEB.H:318
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real diagnose_seb_residual(amrex::Real sw_net, amrex::Real lw_net, amrex::Real hfx, amrex::Real lh, amrex::Real grdflx)
Diagnose the surface energy balance residual.
Definition: ERF_SimplifiedSEB.H:68
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real prognostic_dqs_dt(amrex::Real le, amrex::Real q_s, amrex::Real q_deep, amrex::Real d_s, amrex::Real tau_q)
Compute prognostic surface moisture tendency using force-restore formulation.
Definition: ERF_SimplifiedSEB.H:169
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real seb_canopy_resistance_without_vpd(amrex::Real rs_min, amrex::Real rs_max, amrex::Real rgl, amrex::Real t_opt, amrex::Real lai, amrex::Real sw_down, amrex::Real t_canopy, amrex::Real soil_factor)
Canopy resistance to transpiration [s/m] without its vapor-deficit factor.
Definition: ERF_SimplifiedSEB.H:254
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real seb_force_restore_heat_capacity(amrex::Real lambda, amrex::Real c, amrex::Real tau)
Surface heat capacity [J/m^2/K] of the force-restore balance for a soil of volumetric heat capacity c...
Definition: ERF_SimplifiedSEB.H:374
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real seb_soil_heat_capacity(amrex::Real theta, amrex::Real theta_sat, amrex::Real c_soil)
Volumetric heat capacity of unfrozen soil [J/m^3/K], as Noah-MP forms it (SoilThermalPropertyMod): wa...
Definition: ERF_SimplifiedSEB.H:338
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real prognostic_dTs_dt(amrex::Real seb_residual, amrex::Real t_s, amrex::Real t_deep, amrex::Real c_s, amrex::Real tau)
Compute prognostic surface temperature tendency using force-restore formulation.
Definition: ERF_SimplifiedSEB.H:114
@ lai
Definition: ERF_SLM.H:78
@ theta
Definition: ERF_Kessler.H:26
@ beta
Definition: ERF_SLM.H:154
@ p
Definition: ERF_WSM6.H:303