ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_Constants.H
Go to the documentation of this file.
1 #ifndef ERF_CONSTANTS_H_
2 #define ERF_CONSTANTS_H_
3 
4 #include <cmath>
5 #include <limits>
6 #include <AMReX_REAL.H>
8 
9 // Safe overly large value to fill data so that it is not uninitialized
10 // but we can easily identify if the value is used in a computation
11 // Would like to use the following but std::sqrt will not be allowable
12 // in constexpr until C++26
13 // const amrex::Real bogus_large_value = std::sqrt(std::numeric_limits<amrex::Real>::max());
14 #ifdef AMREX_USE_FLOAT
15 constexpr amrex::Real bogus_large_value = amrex::Real(1.e18);
16 #else
18 #endif
19 
20 // lsm_undefined: sentinel written into the LSM MultiFabs for cells
21 // the land model did NOT process (e.g. sea-ice / open-water points, where Noah-MP returns the
22 // -9999 fill value instead of a computed flux). The surface layer detects this
23 // and falls back to the Monin-Obukhov (MOST) flux for those cells -- analogous
24 // to how WRF computes the atmospheric surface flux from a skin temperature via
25 // the surface-layer scheme rather than taking an undefined LSM flux.
27 
28 // Physical ceiling [mm] on interval precip handed to Noah-MP over one land call.
29 // 500 mm is far above any real rate, so a larger value signals noisy IC/BC or a
30 // corrupt accumulator snapshot; the coupling clamps to this and warns (ERF_NOAHMP.cpp).
32 
33 // Physical Constants
34 constexpr amrex::Real R_d = amrex::Real(287.0); // dry air constant for dry air [J/(kg-K)]
35 constexpr amrex::Real R_v = amrex::Real(461.505); // water vapor constant for water vapor [J/(kg-K)]
36 constexpr amrex::Real Cp_d = amrex::Real(1004.5); // We have set this so that with qv=0 we get identically gamma = amrex::Real(1.4)
37 constexpr amrex::Real Cp_v = amrex::Real(1859.0);
38 constexpr amrex::Real Cp_l = amrex::Real(4200.0);
39 
40 constexpr amrex::Real epsv = R_v / R_d - one;
41 constexpr amrex::Real RdoCp = R_d / Cp_d;
42 constexpr amrex::Real CpoRd = Cp_d / R_d;
43 constexpr amrex::Real RvoRd = R_v / R_d;
44 constexpr amrex::Real RdoRv = R_d / R_v;
45 
46 // epsilo / omeps are the CAM spellings of RdoRv and its complement; they appear
47 // in the saturation-vapor-pressure formulas in Utils/ERF_SatMethods.H.
48 constexpr amrex::Real epsilo = RdoRv;
49 constexpr amrex::Real omeps = one - epsilo;
50 
51 constexpr amrex::Real L_v = amrex::Real(2.5e6); // latent heat of vaporization (J / kg)
52 
53 constexpr amrex::Real p_0 = amrex::Real(1.0e5); // reference surface pressure [Pa]
54 constexpr amrex::Real Gamma = amrex::Real(1.4); // c_p / c_v [-]
55 constexpr amrex::Real KAPPA = amrex::Real(0.41); // von Karman constant
57 
58 // Derived Constants
59 constexpr amrex::Real ip_0 = one/p_0;
60 constexpr amrex::Real iR_d = one/R_d;
62 
63 // Molecular / kinetic-theory constants.
64 constexpr amrex::Real boltz = amrex::Real(1.38065e-23);
65 constexpr amrex::Real avogadro = amrex::Real(6.02214e26);
66 constexpr amrex::Real mwdair = amrex::Real(28.966);
67 
68 static constexpr int ORB_UNDEF_INT = 2000000000; // undefined int
69 #endif
constexpr amrex::Real epsv
Definition: ERF_Constants.H:40
constexpr amrex::Real R_v
Definition: ERF_Constants.H:35
constexpr amrex::Real KAPPA
Definition: ERF_Constants.H:55
constexpr amrex::Real Cp_d
Definition: ERF_Constants.H:36
constexpr amrex::Real iR_d
Definition: ERF_Constants.H:60
constexpr amrex::Real bogus_large_value
Definition: ERF_Constants.H:17
constexpr amrex::Real avogadro
Definition: ERF_Constants.H:65
static constexpr int ORB_UNDEF_INT
Definition: ERF_Constants.H:68
constexpr amrex::Real epsilo
Definition: ERF_Constants.H:48
constexpr amrex::Real mwdair
Definition: ERF_Constants.H:66
constexpr amrex::Real boltz
Definition: ERF_Constants.H:64
constexpr amrex::Real ip_0
Definition: ERF_Constants.H:59
constexpr amrex::Real p_0
Definition: ERF_Constants.H:53
constexpr amrex::Real lsm_max_precip_interval
Definition: ERF_Constants.H:31
constexpr amrex::Real RvoRd
Definition: ERF_Constants.H:43
constexpr amrex::Real iGamma
Definition: ERF_Constants.H:61
constexpr amrex::Real CpoRd
Definition: ERF_Constants.H:42
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:56
constexpr amrex::Real Cp_l
Definition: ERF_Constants.H:38
constexpr amrex::Real Cp_v
Definition: ERF_Constants.H:37
constexpr amrex::Real R_d
Definition: ERF_Constants.H:34
constexpr amrex::Real lsm_undefined
Definition: ERF_Constants.H:26
constexpr amrex::Real L_v
Definition: ERF_Constants.H:51
constexpr amrex::Real omeps
Definition: ERF_Constants.H:49
constexpr amrex::Real RdoCp
Definition: ERF_Constants.H:41
constexpr amrex::Real RdoRv
Definition: ERF_Constants.H:44
constexpr amrex::Real Gamma
Definition: ERF_Constants.H:54
Dimensionless numeric literals and pure mathematical constants.
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:30
amrex::Real Real
Definition: ERF_ShocInterface.H:19