|
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real | calc_psi_m2 (amrex::Real zeta) const |
| |
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real | calc_psi_h2 (amrex::Real zeta) const |
| |
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real | calc_psi_m (amrex::Real zeta) const |
| |
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real | calc_psi_h (amrex::Real zeta) const |
| |
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real | calc_phi_m (amrex::Real zeta) const |
| |
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real | calc_phi_h (amrex::Real zeta) const |
| |
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real | calc_zeta_fold (amrex::Real C) const |
| |
| AMREX_GPU_HOST_DEVICE void | set_stable_functions (bool use_qnse, amrex::Real am, amrex::Real bm, amrex::Real ah, amrex::Real bh) |
| |
| AMREX_GPU_HOST_DEVICE bool | uses_qnse () const |
| |
Structure of similarity functions for Moeng formulation.
The unstable side is Businger-Dyer. The stable side is Businger-Dyer (the default, phi = 1 + beta zeta, psi = -beta zeta) or, after set_stable_functions, the QNSE form phi = (1 + a zeta)/(1 + b zeta), psi = -((a - b)/b) ln(1 + b zeta) of Sukoriansky, Galperin and Perov (2005), with its own coefficients for momentum and heat (most.stable_functions, read by read_most_similarity_funs). The Jimenez (2012) pair (calc_psi_m2, calc_psi_h2) is not affected by the choice.
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real similarity_funs::calc_phi_m |
( |
amrex::Real |
zeta | ) |
const |
|
inline |
Compute the momentum gradient function (Businger-Dyer, or QNSE on the stable side).
This is the exact companion of calc_psi_m: the two are tied by psi_m(zeta) = int_0^zeta (1 - phi_m(x))/x dx, so differentiating the MOST wind profile u(z) = (u_star/kappa)[ln(z/z0) - psi_m(z/L)] gives du/dz = u_* phi_m(zeta) / (kappa z).
NOTE: the surface_temp* flux calculators use the Jimenez psi pair (calc_psi_m2/calc_psi_h2) rather than this one; their companions are not implemented yet, so a prescribed-surface-temperature run gets the Businger-Dyer gradient here.
- Parameters
-
| [in] | zeta | stability coordinate z/L |
amrex::Real beta_m
Constants from Dyer, BLM, 1974.
Definition: ERF_MOSTUtils.H:355
amrex::Real m_qnse_bm
QNSE b_m.
Definition: ERF_MOSTUtils.H:361
amrex::Real m_qnse_am
QNSE a_m (Sukoriansky et al. 2005)
Definition: ERF_MOSTUtils.H:360
amrex::Real gamma_m
Definition: ERF_MOSTUtils.H:357
Referenced by ApplySurfaceLayerGradientsPBL(), and ComputeQKESourceTerms().
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real similarity_funs::calc_zeta_fold |
( |
amrex::Real |
C | ) |
const |
|
inline |
Stable z/L at which the prescribed-flux problem folds.
With L fixed by u* and the flux, the wind a given u* supports is u* max(C - psi_m, b) / kappa, with b = most_bracket_floor(C). Below the smallest such wind the prescribed stable flux has no solution with z/L below most_zeta_lim (Basu et al., BLM 2008; with QNSE the supported wind rises again past its first minimum to a local maximum at the second zero of f below, at z/L of order 1e3 to 1e4, and only then tends to zero with u*; the kernels never reach that range). The physical (large u*) branch has z/L below this value, so bounding z/L by it leaves every point that has a solution unchanged. The result is positive for every C.
Businger-Dyer (psi_m = -beta_m z/L): for C > 0 the minimum is at z/L = C / (2 beta_m); for small or negative C (z0 near or above zref) the floor binds first and the minimum is at the kink z/L = (b - C) / beta_m.
QNSE (psi_m = -c ln(1 + b_m z/L), c = (a_m - b_m)/b_m): with u* proportional to (z/L)^(-1/3), the supported wind falls with z/L while f(z/L) = C + c ln(1 + b_m z/L) - 3 c b_m (z/L) / (1 + b_m z/L) is positive, and f falls from C at z/L = 0 to its minimum at z/L = 2 / b_m and rises without bound after it. The fold is the first zero of f beyond the kink where the floor stops binding (C - psi_m = b), found by Newton's method on the bracket [kink, 2 / b_m] where f is convex and decreasing (f' = c b_m (b_m z/L - 2) / (1 + b_m z/L)^2 < 0, f'' > 0 for b_m z/L < 5): after the first step the iterates approach the root from the left, a step that would leave the bracket is replaced by its midpoint, and the iteration stops at a relative change of 1e-10 (a handful of steps against the 60 passes of a bisection to the same precision; the roughness kernels call this once per u* iteration). It is the kink itself when f is already negative there, and most_zeta_lim when f has no zero (C > c (2 - ln 3), 10.4 with the default coefficients): the wind then falls monotonically with z/L up to the bound, where the kernels hold z/L and reduce the flux as at a fold. Every return value is at most most_zeta_lim.
- Parameters
-
272 if (!amrex::Math::isfinite(C)) {
return C; }
277 amrex::Real
lo = (C < bf) ? (std::exp((bf - C) / c) -
one) / b :
zero;
278 auto f = [&] (amrex::Real
z) {
279 const amrex::Real s =
one + b *
z;
280 return C + c * std::log(s) -
three * c * b *
z / s;
282 auto df = [&] (amrex::Real
z) {
283 const amrex::Real s =
one + b *
z;
284 return c * b * (b *
z -
two) / (s * s);
287 if (f(
lo) <=
zero) {
return amrex::min(
lo, zlim); }
288 amrex::Real
hi =
two / b;
289 if (
lo >=
hi || f(
hi) >=
zero) {
return zlim; }
294 constexpr amrex::Real rtol = amrex::Real(1.0e-10);
295 for (
int n = 0; n < 30; ++n) {
296 const amrex::Real fz = f(
z);
297 if (fz >
zero) {
lo =
z; }
else if (fz <
zero) {
hi =
z; }
else {
break; }
298 const amrex::Real d = df(
z);
301 const bool done = std::abs(zn -
z) <= rtol * zn;
305 return amrex::min(
z, zlim);
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real most_bracket_floor(amrex::Real C)
Definition: ERF_MOSTUtils.H:61
constexpr amrex::Real most_zeta_lim
Definition: ERF_MOSTUtils.H:71
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
Referenced by surface_flux_charnock::iterate_flux(), surface_flux_mod_charnock::iterate_flux(), surface_flux_donelan::iterate_flux(), surface_flux_wave_coupled::iterate_flux(), surface_flux::iterate_flux(), and surface_flux_eb::iterate_flux().
| AMREX_GPU_HOST_DEVICE void similarity_funs::set_stable_functions |
( |
bool |
use_qnse, |
|
|
amrex::Real |
am, |
|
|
amrex::Real |
bm, |
|
|
amrex::Real |
ah, |
|
|
amrex::Real |
bh |
|
) |
| |
|
inline |
Select the QNSE stable-side functions phi = (1 + a zeta)/(1 + b zeta) for momentum (a_m, b_m) and heat (a_h, b_h), or return to Businger-Dyer (use_qnse false, the coefficients then unused). read_most_similarity_funs checks the inputs: b_m, b_h > 0 and a_m > b_m, a_h > b_h.
- Parameters
-
| [in] | use_qnse | whether the stable side is QNSE |
| [in] | am | a_m |
| [in] | bm | b_m |
| [in] | ah | a_h |
| [in] | bh | b_h |
Referenced by read_most_similarity_funs().