ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_WallGradientCoeffs.H
Go to the documentation of this file.
1 #ifndef ERF_WALL_GRADIENT_COEFFS_H_
2 #define ERF_WALL_GRADIENT_COEFFS_H_
3 
4 #include <AMReX_REAL.H>
5 #include <AMReX_GpuQualifiers.H>
7 
8 /**
9  * Coefficients of the one-sided z-gradient of a cell-centered velocity at a Dirichlet
10  * (no-slip) z wall,
11  *
12  * du/dz|wall = (c_wall * u_wall + c_0 * u_0 + c_1 * u_1) / dz0,
13  *
14  * where u_wall is the wall value, u_0 and u_1 are the first and second cells off the wall,
15  * and dz0 and dz1 are their heights. This is the stencil ComputeStrain_S and
16  * ComputeStrain_T use for the wall stress, with the same arithmetic; on a uniform mesh it
17  * reduces to (-8/3, 3, -1/3), the stencil of ComputeStrain_N. It is second order, so it
18  * is exact for a quadratic profile. The coefficients sum to zero.
19  *
20  * The implicit vertical momentum solve closes its wall row with this same gradient: the
21  * solve removes the explicit wall stress (from tau_corr) and puts back its own, so any
22  * other wall stencil changes the operator by implicit_fac * (L_solve - L_explicit) at the
23  * wall, and moves the steady state of a wall-bounded flow.
24  */
29 };
30 
31 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
33 WallGradientCoeffs (const amrex::Real dz0, const amrex::Real dz1) noexcept
34 {
35  const amrex::Real f = (dz1 / dz0) + two;
36  const amrex::Real f2 = f*f;
37  const amrex::Real c3 = two / (f - f2);
38  const amrex::Real c2 = -f2*c3;
39  const amrex::Real c1 = -(one-f2)*c3;
40  return {c1, c2, c3};
41 }
42 
43 /** The uniform-mesh stencil, with the constants ComputeStrain_N uses. */
44 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
47 {
48  return {-eightthirds, three, -third};
49 }
50 
51 #endif
Dimensionless numeric literals and pure mathematical constants.
constexpr amrex::Real three
Definition: ERF_NumericalConstants.H:39
constexpr amrex::Real two
Definition: ERF_NumericalConstants.H:38
constexpr amrex::Real eightthirds
Definition: ERF_NumericalConstants.H:44
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real third
Definition: ERF_NumericalConstants.H:43
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE WallGradCoeffs WallGradientCoeffsUniform() noexcept
Definition: ERF_WallGradientCoeffs.H:46
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE WallGradCoeffs WallGradientCoeffs(const amrex::Real dz0, const amrex::Real dz1) noexcept
Definition: ERF_WallGradientCoeffs.H:33
real(c_double), parameter c2
Definition: ERF_module_model_constants.F90:35
real(c_double), private c1
Definition: ERF_module_mp_morr_two_moment.F90:212
Definition: ERF_WallGradientCoeffs.H:25
amrex::Real c_0
Definition: ERF_WallGradientCoeffs.H:27
amrex::Real c_wall
Definition: ERF_WallGradientCoeffs.H:26
amrex::Real c_1
Definition: ERF_WallGradientCoeffs.H:28