|
ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
|
#include <AMReX_GpuQualifiers.H>#include <AMReX_REAL.H>#include <cmath>#include "ERF_Constants.H"#include "ERF_IndexDefines.H"#include "ERF_DataStruct.H"#include "ERF_MoistUtils.H"

Go to the source code of this file.
Functions | |
| AMREX_GPU_DEVICE AMREX_FORCE_INLINE bool | IsSaturated (int i, int j, int k, const amrex::Array4< const amrex::Real > &cell_data, int qc_index) |
| AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real | ComputeN2 (int i, int j, int k, amrex::Real dzInv, amrex::Real const_grav, const amrex::Array4< const amrex::Real > &cell_data, const MoistureComponentIndices &moisture_indices) |
| AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real | ComputeVerticalShear2 (int i, int j, int k, amrex::Real dzInv, const amrex::Array4< const amrex::Real > &u, const amrex::Array4< const amrex::Real > &v) |
| AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real | ComputeRichardson (amrex::Real N2_moist, amrex::Real S2_vert) |
| AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real | StabilityFunction (amrex::Real Ri, amrex::Real Ri_crit) |
Functions for computing moist Richardson number and Mason (1989) stability function for Smagorinsky turbulence closure with conditional instability correction.
In cloud-resolving simulations, standard Smagorinsky models overpredict turbulent mixing in conditionally unstable regions (cloud updrafts) where buoyancy-driven instability occurs. This module implements the moist Richardson number correction following Mason (1989) and Stevens et al. (2005) for marine stratocumulus.
| AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real ComputeN2 | ( | int | i, |
| int | j, | ||
| int | k, | ||
| amrex::Real | dzInv, | ||
| amrex::Real | const_grav, | ||
| const amrex::Array4< const amrex::Real > & | cell_data, | ||
| const MoistureComponentIndices & | moisture_indices | ||
| ) |
Compute moist Brunt-Väisälä frequency squared (N²_moist).
| [in] | i,j,k | cell indices |
| [in] | dzInv | inverse vertical grid spacing (1/Δz) [1/m] |
| [in] | const_grav | gravitational acceleration g [m/s²] |
| [in] | cell_data | conserved state |
| [in] | moisture_indices | moisture species indices |
Uses centered finite differences: ∂/∂z ≈ (f_{k+1} - f_{k-1}) / (2Δz)
Unsaturated: N² = (g/θ_v) · ∂θ_v/∂z where θ_v = θ(1 + 0.61q_v - q_c) accounts for vapor buoyancy and condensate loading
Saturated: N² = (g/θ_l) · ∂θ_l/∂z where θ_l = θ - (L_v/c_p·Π)·q_c is the liquid water potential temperature
In cloud updrafts, ∂θ_l/∂z can be negative due to release of latent heat during ascent. This gives N² < 0, which is physically correct for convective instability and should enhance (not suppress) mixing.
Input: dzInv [1/m], const_grav [m/s²], θ [K] Output: N² [1/s²]
Referenced by ComputeTurbulentViscosityLES().


| AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real ComputeRichardson | ( | amrex::Real | N2_moist, |
| amrex::Real | S2_vert | ||
| ) |
Compute moist Richardson number.
| [in] | N2_moist | moist Brunt-Väisälä frequency squared [1/s²] |
| [in] | S2_vert | vertical wind shear squared [1/s²] |
Referenced by ComputeTurbulentViscosityLES().

| AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real ComputeVerticalShear2 | ( | int | i, |
| int | j, | ||
| int | k, | ||
| amrex::Real | dzInv, | ||
| const amrex::Array4< const amrex::Real > & | u, | ||
| const amrex::Array4< const amrex::Real > & | v | ||
| ) |
Compute vertical shear squared (S²_vert).
| [in] | i,j,k | cell indices |
| [in] | dzInv | inverse vertical grid spacing (1/Δz) [1/m] |
| [in] | u | face-centered x-velocity (u) array with ngrow≥1 in z |
| [in] | v | face-centered y-velocity (v) array with ngrow≥1 in z |
ERF uses Arakawa C-grid: u defined at (i+1/2, j, k) (x-faces) v defined at (i, j+1/2, k) (y-faces) w defined at (i, j, k+1/2) (z-faces) cell centers at (i, j, k)
To get shear at cell center (i,j,k), interpolate velocities to center then difference: ∂u/∂z|_{i,j,k} ≈ (u_{i,j,k+1} - u_{i,j,k-1}) / (2Δz) where u_{i,j,k} = 0.5 * (u_{i-1/2,j,k} + u_{i+1/2,j,k})
Input: dzInv [1/m], u, v [m/s] Output: S²_vert [1/s²]
Referenced by ComputeTurbulentViscosityLES().

| AMREX_GPU_DEVICE AMREX_FORCE_INLINE bool IsSaturated | ( | int | i, |
| int | j, | ||
| int | k, | ||
| const amrex::Array4< const amrex::Real > & | cell_data, | ||
| int | qc_index | ||
| ) |
Check if grid cell is saturated based on cloud liquid water content.
| [in] | i,j,k | cell indices |
| [in] | cell_data | conserved state (ρ, ρθ, ρq_v, ρq_c, etc.) |
| [in] | moisture_indices | indices for moisture species |
PHYSICAL JUSTIFICATION: Threshold of 1e-8 kg/kg (0.01 g/kg) is typical for distinguishing cloudy from clear regions in LES. Below this threshold, condensate is negligible and air is effectively unsaturated.
Referenced by ComputeN2().

| AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real StabilityFunction | ( | amrex::Real | Ri, |
| amrex::Real | Ri_crit | ||
| ) |
Mason (1989) stability function for turbulent mixing suppression.
| [in] | Ri | gradient Richardson number [dimensionless] |
| [in] | Ri_crit | critical Richardson number (default 0.25) |
Referenced by ComputeTurbulentViscosityLES().
