ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_NumericalConstants.H
Go to the documentation of this file.
1 /*! @file ERF_NumericalConstants.H
2  * \brief Dimensionless numeric literals and pure mathematical constants.
3  *
4  * Nothing in this file is physics. These are spelling aids that let the code
5  * write `myhalf` instead of `amrex::Real(0.5)` and so stay precision-agnostic
6  * between double and single (AMREX_USE_FLOAT) builds, plus the mathematical
7  * constant pi and the two combinations of it that recur often enough to be
8  * worth naming.
9  *
10  * Kept separate from ERF_Constants.H so that a file needing only numeric
11  * literals does not have to pull in the thermodynamic constants, and so that
12  * ERF_Constants.H reads as a list of physical constants. ERF_Constants.H
13  * includes this header, so every existing consumer keeps compiling unchanged.
14  */
15 
16 #ifndef ERF_NUMERICAL_CONSTANTS_H_
17 #define ERF_NUMERICAL_CONSTANTS_H_
18 
19 #include <limits>
20 
21 #include <AMReX_REAL.H>
22 
23 //! Roundoff floor of the working precision: 2.22e-16 in a double build, 1.19e-07
24 //! under AMREX_USE_FLOAT. Write a tolerance as a multiple of this rather than as
25 //! a hard-wired literal such as amrex::Real(1.e-16), which in a single-precision
26 //! build sits far below the noise floor and so never fires.
28 
29 constexpr amrex::Real zero = amrex::Real(0.0);
30 constexpr amrex::Real one = amrex::Real(1.0);
31 constexpr amrex::Real two = amrex::Real(2.0);
32 constexpr amrex::Real three = amrex::Real(3.0);
33 constexpr amrex::Real four = amrex::Real(4.0);
34 constexpr amrex::Real myhalf = amrex::Real(0.5);
35 constexpr amrex::Real fourth = amrex::Real(0.25);
36 constexpr amrex::Real third = amrex::Real(1.0/3.0);
37 constexpr amrex::Real eightthirds = amrex::Real(8.0/3.0);
38 
39 constexpr amrex::Real PI = amrex::Real(3.14159265358979323846264338327950288);
40 constexpr amrex::Real PIoTwo = PI/two;
42 
43 #endif
constexpr amrex::Real three
Definition: ERF_NumericalConstants.H:32
constexpr amrex::Real four
Definition: ERF_NumericalConstants.H:33
constexpr amrex::Real real_eps
Definition: ERF_NumericalConstants.H:27
constexpr amrex::Real two
Definition: ERF_NumericalConstants.H:31
constexpr amrex::Real eightthirds
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:30
constexpr amrex::Real fourth
Definition: ERF_NumericalConstants.H:35
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:29
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:34
constexpr amrex::Real PI
Definition: ERF_NumericalConstants.H:39
constexpr amrex::Real PIoTwo
Definition: ERF_NumericalConstants.H:40
constexpr amrex::Real third
Definition: ERF_NumericalConstants.H:36
constexpr amrex::Real four_thirds_pi
Definition: ERF_NumericalConstants.H:41
amrex::Real Real
Definition: ERF_ShocInterface.H:19
real(c_double), parameter epsilon
Definition: ERF_module_model_constants.F90:12