ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_ImmersedWallCell.H
Go to the documentation of this file.
1 #ifndef ERF_IMMERSED_WALL_CELL_H_
2 #define ERF_IMMERSED_WALL_CELL_H_
3 
4 #include <cmath>
5 #include <limits>
6 
7 #include <AMReX_REAL.H>
8 #include <AMReX_GpuQualifiers.H>
9 #include <AMReX_Algorithm.H>
10 
11 #include "ERF_Constants.H"
12 #include "ERF_MOSTUtils.H"
13 
14 /**
15  * The wall cell of immersed-forcing terrain and the fraction-stress wall law
16  * (erf.if_wall_form = fraction_stress), shared by the momentum sources, the wall-face
17  * masks of the diffusion and the RANS wall distance so they cannot disagree.
18  *
19  * A column of solid fractions beta (terrain_blanking) meets the air in its WALL CELL: a
20  * partial cell with fluid above it, or a fluid cell sitting on a solid cell. The surface is
21  * at h = z_bot + beta dz of that cell (beta = 0 for the fluid cell), the wall cell's fluid
22  * centroid at d1 = (1 - beta) dz / 2 above it and the center of the cell above at
23  * d2 = (3/2 - beta) dz. The fraction-stress law takes the friction velocity
24  * u*^2 = (1 - beta) u*_own^2 + beta u*_ref^2,
25  * u*_own = kappa |u_t| / ln(d1/z0), u*_ref = kappa |u_t,ref| / ln(d2/z0),
26  * so a nearly full fluid cell uses its own velocity (on a face-aligned surface, beta = 0,
27  * that is the plain surface-layer law of flat ground at dz/2) and a thin fluid sliver the
28  * better resolved cell above, and applies it as a wall stress spread over the cell height,
29  * integrated exactly over the step:
30  * F = -rho C u_t, C = (1 - exp(-r dt)) / dt, r = u*^2 / (dz |u_t|).
31  * The resolved diffusive flux through the wall face (the bottom face of the wall cell) is
32  * switched off, so the column loses exactly u*^2 through the wall. This is form 7 of the
33  * kynema-sgf immersed terrain, written for the vertical columns of ERF's immersed forcing
34  * (horizontal velocity, vertical distances) and neutral stratification.
35  */
36 namespace ib_wall {
37 
38 /** A cell whose solid fraction is below small counts as fluid */
39 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
40 bool is_fluid (amrex::Real beta, amrex::Real small) noexcept
41 {
42  return beta < small;
43 }
44 
45 /** A cell whose solid fraction is within small of one counts as solid */
46 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
47 bool is_solid (amrex::Real beta, amrex::Real small) noexcept
48 {
49  return beta >= amrex::Real(1.0) - small;
50 }
51 
52 /**
53  * Cell k, with solid fractions b_km1, b_k, b_kp1 in cells k-1, k, k+1, is the wall cell:
54  * a partial cell with fluid above it, or a fluid cell on top of a solid cell.
55  */
56 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
57 bool is_wall_cell (amrex::Real b_km1, amrex::Real b_k, amrex::Real b_kp1, amrex::Real small) noexcept
58 {
59  const bool partial = !is_fluid(b_k, small) && !is_solid(b_k, small);
60  return (partial && is_fluid(b_kp1, small)) || (is_fluid(b_k, small) && is_solid(b_km1, small));
61 }
62 
63 /** Solid fraction of a wall cell as the wall law uses it (zero for a fluid wall cell) */
64 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
65 amrex::Real wall_beta (amrex::Real b_k, amrex::Real small) noexcept
66 {
67  return is_fluid(b_k, small) ? amrex::Real(0.0) : amrex::min(b_k, amrex::Real(1.0));
68 }
69 
70 /**
71  * Friction velocity of the fraction-stress law.
72  * @param ut horizontal speed in the wall cell
73  * @param ut_ref horizontal speed in the cell above
74  * @param beta wall_beta of the wall cell
75  * @param dz cell height
76  * @param z0 roughness length
77  * The distances are floored at 2 z0 so that ln(d/z0) stays above ln 2 in a thin sliver,
78  * where the (1 - beta) weight of the own estimate is small anyway.
79  */
80 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
81 amrex::Real friction_velocity (amrex::Real ut, amrex::Real ut_ref, amrex::Real beta,
82  amrex::Real dz, amrex::Real z0) noexcept
83 {
84  const amrex::Real d_min = amrex::Real(2.0) * z0;
85  const amrex::Real d1 = amrex::max(amrex::Real(0.5) * (amrex::Real(1.0) - beta) * dz, d_min);
86  const amrex::Real d2 = amrex::max((amrex::Real(1.5) - beta) * dz, d1);
87  const amrex::Real us_own = KAPPA * ut / std::log(d1 / z0);
88  const amrex::Real us_ref = KAPPA * ut_ref / std::log(d2 / z0);
89  return std::sqrt((amrex::Real(1.0) - beta) * us_own * us_own + beta * us_ref * us_ref);
90 }
91 
92 
93 /**
94  * Factor on the diffusive coupling through the face above the wall cell (the face between the
95  * wall cell, whose fluid centroid sits d1 = (1-beta) dz/2 above the surface, and the cell above,
96  * at d2 = (3/2-beta) dz). The solver differences across that face over dz; the factor dz/dz_eff
97  * replaces dz by
98  * spacing = 0 (grid): dz (factor 1)
99  * spacing = 1 (physical): d2 - d1 = (1 - beta/2) dz
100  * spacing = 2 (log): (d1 + d2) ln(d2/d1) / (2 ln 3), the spacing that gives the face flux,
101  * with the face viscosity the mean of the two cells' kappa u* z, the
102  * same relative error for a log profile as the first interior face of
103  * flat ground (d1 = dz/2, d2 = 3 dz/2), where it equals dz: ln 3 u*^2
104  * for every beta
105  * All three are 1 for beta = 0, so a surface on a cell face stays flat ground. The factor is
106  * bounded only while z0 < dz/4 (d2 > d1 for every beta): the inputs require that.
107  */
108 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
109 amrex::Real face_above_factor (amrex::Real beta, amrex::Real dz, amrex::Real z0, int spacing) noexcept
110 {
111  const amrex::Real d1 = amrex::max(amrex::Real(0.5) * (amrex::Real(1.0) - beta) * dz, amrex::Real(2.0) * z0);
112  const amrex::Real d2 = amrex::max((amrex::Real(1.5) - beta) * dz, d1);
113  const amrex::Real dz_phys = d2 - d1;
114  const amrex::Real dz_log = (d1 + d2) * std::log(d2 / d1) / (amrex::Real(2.0) * amrex::Real(1.0986122886681098));
115  const amrex::Real dz_eff = (spacing == 1) ? dz_phys : ((spacing == 2) ? dz_log : dz);
116  return dz / amrex::max(dz_eff, std::numeric_limits<amrex::Real>::min());
117 }
118 
119 /** Surface condition of the fraction-stress law (erf.if_* inputs of the terrain immersed forcing) */
120 struct WallCond
121 {
122  static constexpr int neutral = 0; //!< no heat exchange, neutral stability functions
123  static constexpr int heat_flux = 1; //!< given kinematic surface heat flux q [K m/s]
124  static constexpr int surface_temp = 2; //!< given surface potential temperature theta_s [K]
125  static constexpr int obukhov = 3; //!< given Obukhov length (inverse Linv) [1/m]
126  int type{neutral};
127  amrex::Real q{0.0};
128  amrex::Real theta_s{0.0};
129  amrex::Real Linv{0.0};
130  similarity_funs sfuns{}; //!< the similarity functions (erf.most.stable_functions)
131  // Surface moisture condition (a moisture model with water vapor): none, a given kinematic
132  // moisture flux, or a given surface mixing ratio
133  static constexpr int moist_none = 0; //!< no moisture exchange, q* = 0
134  static constexpr int moist_flux = 1; //!< given kinematic surface moisture flux [kg/kg m/s]
135  static constexpr int surface_moist = 2; //!< given surface mixing ratio q_s [kg/kg]
137  amrex::Real qflux{0.0};
138  amrex::Real q_s{0.0};
139  //! a moisture model is active: the Obukhov length is formed from the virtual potential
140  //! temperature and its scale theta_v*, as the flat surface layer forms it
141  bool moist{false};
142 };
143 
144 /** Friction velocity, temperature and moisture scales and inverse Obukhov length of a wall cell */
145 struct WallState
146 {
147  amrex::Real ustar{0.0};
148  amrex::Real thetastar{0.0};
149  amrex::Real qstar{0.0};
150  amrex::Real Linv{0.0};
151 };
152 
153 /**
154  * Virtual potential temperature of the wall law, theta (1 + epsv q), water vapor only (the flat
155  * surface layer's plane average subtracts rain water too; the two agree without rain)
156  */
157 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
158 amrex::Real virtual_theta (amrex::Real theta, amrex::Real q) noexcept
159 {
160  return theta * (amrex::Real(1.0) + epsv * q);
161 }
162 
163 /**
164  * Scale of the virtual heat flux, theta_v* = theta* (1 + epsv q) + epsv theta q*, so that
165  * -u* theta_v* = (1 + epsv q) <w'theta'> + epsv theta <w'q'> is the buoyancy flux (the flat
166  * surface layer's tstv)
167  */
168 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
169 amrex::Real virtual_thetastar (const WallState& w, amrex::Real theta, amrex::Real q) noexcept
170 {
171  return w.thetastar * (amrex::Real(1.0) + epsv * q) + epsv * theta * w.qstar;
172 }
173 
174 /** ln(d/z0) - psi, floored at ln 2 (the value the 2 z0 distance floor gives in neutral air) */
175 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
176 amrex::Real phi (amrex::Real d, amrex::Real z0, amrex::Real psi) noexcept
177 {
178  return amrex::max(std::log(d / z0) - psi, amrex::Real(0.6931471805599453));
179 }
180 
181 /**
182  * Wall state of the fraction-stress law with MOST stability functions (the functions of the
183  * flat surface layer, similarity_funs::calc_psi_m / calc_psi_h with Dyer's or QNSE's stable
184  * side as erf.most.stable_functions says, zeta clamped to +-100):
185  * u*^2 = (1-b) (kappa ut / phi_m(d1))^2 + b (kappa ut_ref / phi_m(d2))^2
186  * theta* = -q / u* (heat_flux)
187  * = (1-b) kappa (theta - theta_s) / phi_h(d1)
188  * + b kappa (theta_ref - theta_s) / phi_h(d2) (surface_temp)
189  * = theta u*^2 / (kappa g L) (obukhov)
190  * q* = -F_q / u* (moist_flux)
191  * = (1-b) kappa (q - q_s) / phi_h(d1)
192  * + b kappa (q_ref - q_s) / phi_h(d2) (surface_moist)
193  * 1/L = kappa g theta* / (u*^2 theta) (heat_flux, surface_temp: iterated)
194  * = kappa g theta_v* / (u*^2 theta_v) (the same with a moisture model, c.moist:
195  * theta_v = theta (1 + epsv q),
196  * theta_v* = theta* (1 + epsv q) + epsv theta q*,
197  * iterated also for a moisture condition alone)
198  * with d1 = (1-b) dz/2, d2 = (3/2-b) dz floored at 2 z0 and phi_{m,h}(d) = ln(d/z0) - psi(d/L).
199  * With c.moist a given L (obukhov) sets theta_v*, and theta* = (theta_v* - epsv theta q*) / (1 + epsv q).
200  * q and q_ref are the water vapor mixing ratios of the wall cell and the cell above (ignored
201  * without c.moist). The iteration starts from neutral and runs a fixed number of passes, so it is
202  * deterministic and has no data-dependent trip count.
203  */
204 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
205 WallState wall_state (amrex::Real ut, amrex::Real ut_ref, amrex::Real theta, amrex::Real theta_ref,
206  amrex::Real q, amrex::Real q_ref,
207  amrex::Real beta, amrex::Real dz, amrex::Real z0, const WallCond& c) noexcept
208 {
209  const similarity_funs& sfuns = c.sfuns;
210  const amrex::Real one_r = amrex::Real(1.0);
211  const amrex::Real d_min = amrex::Real(2.0) * z0;
212  const amrex::Real d1 = amrex::max(amrex::Real(0.5) * (one_r - beta) * dz, d_min);
213  const amrex::Real d2 = amrex::max((amrex::Real(1.5) - beta) * dz, d1);
214  const amrex::Real zmax = amrex::Real(100.0);
215  const amrex::Real us_min = amrex::Real(1.0e-3);
216  const amrex::Real kg = KAPPA * CONST_GRAV;
217  // 1/L is solved for (iterated) with a heat condition that is not a given length, and with a
218  // moisture condition alone when the moisture enters the buoyancy
219  const bool moist_cond = c.moist && (c.moist_type != WallCond::moist_none);
220  const bool solve_L = (c.type == WallCond::heat_flux || c.type == WallCond::surface_temp ||
221  (moist_cond && c.type != WallCond::obukhov));
222  const int n_iter = solve_L ? 12 : 1;
223 
224  WallState w;
225  w.Linv = (c.type == WallCond::obukhov) ? c.Linv : amrex::Real(0.0);
226  // 1/L is kept where d1/L stays within the zeta clamp: the stable given-flux problem has no
227  // solution below a wind threshold (about 3 m/s at q = -0.02 K m/s, d1 = 10 m, z0 = 0.1 m)
228  // and the iteration would otherwise run 1/L away while u* collapses to the floor
229  const amrex::Real Linv_max = zmax / d1;
230  for (int it = 0; it < n_iter; ++it) {
231  w.Linv = amrex::max(amrex::min(w.Linv, Linv_max), -Linv_max);
232  const amrex::Real z1 = amrex::max(amrex::min(d1 * w.Linv, zmax), -zmax);
233  const amrex::Real z2 = amrex::max(amrex::min(d2 * w.Linv, zmax), -zmax);
234  const amrex::Real us_own = KAPPA * ut / phi(d1, z0, sfuns.calc_psi_m(z1));
235  const amrex::Real us_ref = KAPPA * ut_ref / phi(d2, z0, sfuns.calc_psi_m(z2));
236  w.ustar = std::sqrt((one_r - beta) * us_own * us_own + beta * us_ref * us_ref);
237  const amrex::Real us_f = amrex::max(w.ustar, us_min);
238  if (c.moist_type == WallCond::moist_flux) {
239  w.qstar = -c.qflux / us_f;
240  } else if (c.moist_type == WallCond::surface_moist) {
241  w.qstar = (one_r - beta) * KAPPA * (q - c.q_s) / phi(d1, z0, sfuns.calc_psi_h(z1))
242  + beta * KAPPA * (q_ref - c.q_s) / phi(d2, z0, sfuns.calc_psi_h(z2));
243  } else {
244  w.qstar = amrex::Real(0.0);
245  }
246  if (c.type == WallCond::heat_flux) {
247  w.thetastar = -c.q / us_f;
248  } else if (c.type == WallCond::surface_temp) {
249  w.thetastar = (one_r - beta) * KAPPA * (theta - c.theta_s) / phi(d1, z0, sfuns.calc_psi_h(z1))
250  + beta * KAPPA * (theta_ref - c.theta_s) / phi(d2, z0, sfuns.calc_psi_h(z2));
251  } else if (c.type == WallCond::obukhov) {
252  if (c.moist) {
253  // the given length sets theta_v*; theta* is what is left after the moisture part
254  const amrex::Real thv_star = virtual_theta(theta, q) * us_f * us_f * c.Linv / kg;
255  w.thetastar = (thv_star - epsv * theta * w.qstar) / (one_r + epsv * q);
256  } else {
257  w.thetastar = theta * us_f * us_f * c.Linv / kg;
258  }
259  } else {
260  w.thetastar = amrex::Real(0.0);
261  }
262  if (solve_L) {
263  w.Linv = c.moist ? kg * virtual_thetastar(w, theta, q) / (us_f * us_f * virtual_theta(theta, q))
264  : kg * w.thetastar / (us_f * us_f * theta);
265  }
266  }
267  // the stress uses the same floored u* as theta* and 1/L
268  w.ustar = amrex::max(w.ustar, us_min);
269  w.Linv = amrex::max(amrex::min(w.Linv, Linv_max), -Linv_max);
270  return w;
271 }
272 
273 /** The wall state without moisture (q = q_ref = 0; c.moist and c.moist_type are expected unset) */
274 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
275 WallState wall_state (amrex::Real ut, amrex::Real ut_ref, amrex::Real theta, amrex::Real theta_ref,
276  amrex::Real beta, amrex::Real dz, amrex::Real z0, const WallCond& c) noexcept
277 {
278  return wall_state(ut, ut_ref, theta, theta_ref, amrex::Real(0.0), amrex::Real(0.0), beta, dz, z0, c);
279 }
280 
281 /**
282  * A wall flux (per unit mass, already divided by the cell height) that is proportional to
283  * delta = value - surface value, integrated exactly over dt as a decay so the cell cannot
284  * overshoot the surface value; a flux that is not a decay (rate <= 0) is applied as it stands.
285  */
286 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
287 amrex::Real decay_toward (amrex::Real flux, amrex::Real delta, amrex::Real dt) noexcept
288 {
289  const amrex::Real eps = std::numeric_limits<amrex::Real>::epsilon();
290  const amrex::Real rate = -flux / (delta + std::copysign(eps, delta));
291  const amrex::Real dt_safe = amrex::max(dt, std::numeric_limits<amrex::Real>::min());
292  // a decay (rate > 0) is integrated exactly; anything else is applied as it stands
293  const amrex::Real exact = std::expm1(-amrex::max(rate, amrex::Real(0.0)) * dt_safe) / dt_safe * delta;
294  return (rate > amrex::Real(0.0) && std::abs(delta) > eps) ? exact : flux;
295 }
296 
297 /**
298  * Source of the wall heat flux in the wall cell, per unit mass (d theta / dt): the kinematic
299  * flux -u* theta* spread over the cell height. With a given surface temperature theta* is
300  * proportional to theta - theta_s and the term is a decay, integrated exactly over dt so it
301  * cannot overshoot the surface temperature; otherwise the flux is applied as it stands.
302  */
303 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
304 amrex::Real heat_source (const WallState& w, amrex::Real theta, const WallCond& c,
305  amrex::Real dz, amrex::Real dt) noexcept
306 {
307  const amrex::Real flux = -w.ustar * w.thetastar / dz;
308  if (c.type != WallCond::surface_temp) { return flux; }
309  return decay_toward(flux, theta - c.theta_s, dt);
310 }
311 
312 /**
313  * Source of the wall moisture flux in the wall cell, per unit mass (d q / dt): the kinematic
314  * flux -u* q* spread over the cell height; with a given surface mixing ratio the term is a
315  * decay toward q_s, integrated exactly as heat_source does toward theta_s (as there, the
316  * reference-cell part of a partial cell's q* is folded into the decay rate, so the wall cell
317  * never passes q_s). Zero without a moisture condition (q* = 0).
318  */
319 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
320 amrex::Real moist_source (const WallState& w, amrex::Real q, const WallCond& c,
321  amrex::Real dz, amrex::Real dt) noexcept
322 {
323  const amrex::Real flux = -w.ustar * w.qstar / dz;
324  if (c.moist_type != WallCond::surface_moist) { return flux; }
325  return decay_toward(flux, q - c.q_s, dt);
326 }
327 
328 /**
329  * Effective rate C of the wall stress u*^2 spread over the cell height dz, integrated exactly
330  * over dt: the momentum source is -rho C u_t.
331  */
332 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
333 amrex::Real stress_rate (amrex::Real ustar, amrex::Real ut, amrex::Real dz, amrex::Real dt) noexcept
334 {
335  // dt is floored rather than branched on, so no guarded 0/0 can be speculated (FPE traps);
336  // (1 - exp(-r dt)) / dt tends to r as dt -> 0
337  const amrex::Real r = ustar * ustar / (dz * (ut + std::numeric_limits<amrex::Real>::epsilon()));
338  const amrex::Real dt_safe = amrex::max(dt, std::numeric_limits<amrex::Real>::min());
339  return -std::expm1(-r * dt_safe) / dt_safe;
340 }
341 
342 /**
343  * Wall value of the k-eqn TKE in the wall cell (erf.if_wall_tke), the value erf.dirichlet_k holds in
344  * the first cell over flat ground (Axell & Liungman 2001, Eq. 16):
345  * k = (u*^3 + kappa B d1)^(2/3) / Cmu0^2, B = -g u* bstar / btheta (unstable only),
346  * with u* from the wall state, the buoyancy scale bstar and its temperature btheta (theta* and
347  * theta; with a moisture model theta_v* and theta_v, see virtual_thetastar) and d1 the
348  * fluid-centroid height of the wall cell (floored at 2 z0, as the wall state does). kynema-sgf
349  * relaxes its immersed wall cells toward the same value.
350  */
351 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
352 amrex::Real wall_tke (const WallState& w, amrex::Real beta, amrex::Real dz, amrex::Real z0,
353  amrex::Real Cmu0, amrex::Real bstar, amrex::Real btheta) noexcept
354 {
355  const amrex::Real d1 = amrex::max(amrex::Real(0.5) * (amrex::Real(1.0) - beta) * dz,
356  amrex::Real(2.0) * z0);
357  const amrex::Real B = (bstar < amrex::Real(-1.e-8))
358  ? -CONST_GRAV * w.ustar * bstar / btheta : amrex::Real(0.0);
359  return std::pow(w.ustar * w.ustar * w.ustar + KAPPA * B * d1, amrex::Real(2.0) / amrex::Real(3.0))
360  / (Cmu0 * Cmu0);
361 }
362 
363 /** The dry wall value: B from theta* and theta */
364 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
365 amrex::Real wall_tke (const WallState& w, amrex::Real beta, amrex::Real dz, amrex::Real z0,
366  amrex::Real theta, amrex::Real Cmu0) noexcept
367 {
368  return wall_tke(w, beta, dz, z0, Cmu0, w.thetastar, theta);
369 }
370 
371 } // namespace ib_wall
372 
373 #endif
constexpr amrex::Real epsv
Definition: ERF_Constants.H:56
constexpr amrex::Real KAPPA
Definition: ERF_Constants.H:71
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:72
Real z0
Definition: ERF_InitCustomPertVels_ScalarAdvDiff.H:12
@ ustar
Definition: ERF_SLM.H:30
@ theta
Definition: ERF_Kessler.H:26
@ beta
Definition: ERF_SLM.H:154
@ dz
Definition: ERF_AdvanceWDM6.cpp:273
@ q
Definition: ERF_WSM6.H:296
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real eps()
Definition: ERF_ShocMoments.cpp:19
Definition: ERF_ImmersedWallCell.H:36
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real wall_tke(const WallState &w, amrex::Real beta, amrex::Real dz, amrex::Real z0, amrex::Real Cmu0, amrex::Real bstar, amrex::Real btheta) noexcept
Definition: ERF_ImmersedWallCell.H:352
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool is_wall_cell(amrex::Real b_km1, amrex::Real b_k, amrex::Real b_kp1, amrex::Real small) noexcept
Definition: ERF_ImmersedWallCell.H:57
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real face_above_factor(amrex::Real beta, amrex::Real dz, amrex::Real z0, int spacing) noexcept
Definition: ERF_ImmersedWallCell.H:109
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real wall_beta(amrex::Real b_k, amrex::Real small) noexcept
Definition: ERF_ImmersedWallCell.H:65
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE WallState wall_state(amrex::Real ut, amrex::Real ut_ref, amrex::Real theta, amrex::Real theta_ref, amrex::Real q, amrex::Real q_ref, amrex::Real beta, amrex::Real dz, amrex::Real z0, const WallCond &c) noexcept
Definition: ERF_ImmersedWallCell.H:205
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real virtual_thetastar(const WallState &w, amrex::Real theta, amrex::Real q) noexcept
Definition: ERF_ImmersedWallCell.H:169
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool is_fluid(amrex::Real beta, amrex::Real small) noexcept
Definition: ERF_ImmersedWallCell.H:40
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real phi(amrex::Real d, amrex::Real z0, amrex::Real psi) noexcept
Definition: ERF_ImmersedWallCell.H:176
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real virtual_theta(amrex::Real theta, amrex::Real q) noexcept
Definition: ERF_ImmersedWallCell.H:158
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real decay_toward(amrex::Real flux, amrex::Real delta, amrex::Real dt) noexcept
Definition: ERF_ImmersedWallCell.H:287
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real friction_velocity(amrex::Real ut, amrex::Real ut_ref, amrex::Real beta, amrex::Real dz, amrex::Real z0) noexcept
Definition: ERF_ImmersedWallCell.H:81
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real moist_source(const WallState &w, amrex::Real q, const WallCond &c, amrex::Real dz, amrex::Real dt) noexcept
Definition: ERF_ImmersedWallCell.H:320
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real stress_rate(amrex::Real ustar, amrex::Real ut, amrex::Real dz, amrex::Real dt) noexcept
Definition: ERF_ImmersedWallCell.H:333
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool is_solid(amrex::Real beta, amrex::Real small) noexcept
Definition: ERF_ImmersedWallCell.H:47
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real heat_source(const WallState &w, amrex::Real theta, const WallCond &c, amrex::Real dz, amrex::Real dt) noexcept
Definition: ERF_ImmersedWallCell.H:304
real(c_double), parameter epsilon
Definition: ERF_module_model_constants.F90:12
Definition: ERF_ImmersedWallCell.H:121
static constexpr int heat_flux
given kinematic surface heat flux q [K m/s]
Definition: ERF_ImmersedWallCell.H:123
amrex::Real Linv
Definition: ERF_ImmersedWallCell.H:129
static constexpr int obukhov
given Obukhov length (inverse Linv) [1/m]
Definition: ERF_ImmersedWallCell.H:125
static constexpr int surface_moist
given surface mixing ratio q_s [kg/kg]
Definition: ERF_ImmersedWallCell.H:135
int type
Definition: ERF_ImmersedWallCell.H:126
static constexpr int surface_temp
given surface potential temperature theta_s [K]
Definition: ERF_ImmersedWallCell.H:124
int moist_type
Definition: ERF_ImmersedWallCell.H:136
amrex::Real q
Definition: ERF_ImmersedWallCell.H:127
amrex::Real qflux
Definition: ERF_ImmersedWallCell.H:137
amrex::Real theta_s
Definition: ERF_ImmersedWallCell.H:128
similarity_funs sfuns
the similarity functions (erf.most.stable_functions)
Definition: ERF_ImmersedWallCell.H:130
amrex::Real q_s
Definition: ERF_ImmersedWallCell.H:138
static constexpr int moist_flux
given kinematic surface moisture flux [kg/kg m/s]
Definition: ERF_ImmersedWallCell.H:134
static constexpr int neutral
no heat exchange, neutral stability functions
Definition: ERF_ImmersedWallCell.H:122
bool moist
Definition: ERF_ImmersedWallCell.H:141
static constexpr int moist_none
no moisture exchange, q* = 0
Definition: ERF_ImmersedWallCell.H:133
Definition: ERF_ImmersedWallCell.H:146
amrex::Real thetastar
Definition: ERF_ImmersedWallCell.H:148
amrex::Real Linv
Definition: ERF_ImmersedWallCell.H:150
amrex::Real ustar
Definition: ERF_ImmersedWallCell.H:147
amrex::Real qstar
Definition: ERF_ImmersedWallCell.H:149
Definition: ERF_MOSTUtils.H:84
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real calc_psi_m(amrex::Real zeta) const
Definition: ERF_MOSTUtils.H:149
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real calc_psi_h(amrex::Real zeta) const
Definition: ERF_MOSTUtils.H:168
Definition: ERF_MOSTStress.H:1254