MeteoIODoc 20240429.aefd3c94
Meteoconst.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2/***********************************************************************************/
3/* Copyright 2009 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
4/***********************************************************************************/
5/* This file is part of MeteoIO.
6 MeteoIO is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 MeteoIO is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef METEOCONST_H
20#define METEOCONST_H
21
22#include <cfloat>
23
28#ifndef MIO_VERSION
29 //here below, the double-expansion stringification macro trick...
30 #define STR1(x) #x
31 #define STR2(x) STR1(x)
32 #define MIO_VERSION STR2( _VERSION )
33#endif
34
35namespace mio {
36
37namespace Cst {
38 static const double stefan_boltzmann = 5.670373e-8; // (W m-2 K-4)
39 static const double gravity = 9.80665; // (m s-2)
40 static const double std_press = 101325.; // (Pa) at sea level
41 static const double std_temp = 288.15; // (K) at sea level
42 static const double mean_adiabatique_lapse_rate = 0.0065; // (K/m)
43 static const double dry_adiabatique_lapse_rate = 0.0098; // (K/m)
44
45 static const double gaz_constant_dry_air = 287.058; // (J kg-1 K-1)
46 static const double gaz_constant_water_vapor = 461.9; // (J kg-1 K-1)
47 static const double gaz_constant = 8.31451; // (J mol-1 K-1)
48
49 static const double p_water_triple_pt = 611.73; // (Pa)
50 static const double t_water_freezing_pt = 273.15; // (K)
51 static const double t_water_triple_pt = 273.16; // (K)
52 static const double l_water_sublimation = 2.838e6; // (J kg-1)
53 static const double l_water_vaporization = 2.504e6; // (J kg-1)
54 static const double l_water_fusion = 3.34e5; // (J Kg-1)
55 static const double water_molecular_mass = 18.0153e-3; // (kg)
56 static const double dry_air_mol_mass = 0.0289644; // (kg/mol)
57
58 static const double specific_heat_ice = 2100.0; // (J K-1), at 0C
59 static const double specific_heat_water = 4190.0; // (J K-1) at 0C
60 static const double specific_heat_air = 1004.67; // (J K-1), see Stull "Meteorology for scientists and engineers" p44
61
62 static const double earth_R0 = 6356766.0; // (m)
63
64 static const double solcon = 1366.1; // (W/m^2)
65
66 //Math constants
67 static const double phi = (1.+sqrt(5)) / 2.; //golden ratio
68 static const double e = 2.71828182845904523536; // e
69 static const double Log2e = 1.44269504088896340736; // log2(e)
70 static const double Log10e = 0.434294481903251827651; // log10(e)
71 static const double Ln2 = 0.693147180559945309417; // ln(2)
72 static const double Ln10 = 2.30258509299404568402; // ln(10)
73 static const double PI = 3.14159265358979323846; // pi
74 static const double PI2 = 1.57079632679489661923; // pi/2
75 static const double PI4 = 0.785398163397448309616; // pi/4
76 static const double InvPI = 0.318309886183790671538; // 1/pi
77 static const double TwoOverPI = 0.636619772367581343076; // 2/pi
78 static const double TwoOverSqrtPI = 1.12837916709551257390; // 2/sqrt(pi)
79 static const double Sqrt2 = 1.41421356237309504880; // sqrt(2)
80 static const double InvSqrt2 = 0.707106781186547524401; // 1/sqrt(2)
81 static const double to_rad = PI/180.; // conversion factor from deg to rad
82 static const double to_deg = 180./PI; // conversion factor from rad to deg
83
84 static const double dbl_max = DBL_MAX;
85 static const double dbl_min = -DBL_MAX;
86} //end CST namespace
87
88} //end namespace
89
90#endif
static const double specific_heat_air
Definition: Meteoconst.h:60
static const double to_rad
Definition: Meteoconst.h:81
static const double t_water_freezing_pt
Definition: Meteoconst.h:50
static const double PI
Definition: Meteoconst.h:73
static const double mean_adiabatique_lapse_rate
Definition: Meteoconst.h:42
static const double specific_heat_ice
Definition: Meteoconst.h:58
static const double phi
Definition: Meteoconst.h:67
static const double e
Definition: Meteoconst.h:68
static const double dry_air_mol_mass
Definition: Meteoconst.h:56
static const double std_press
Definition: Meteoconst.h:40
static const double TwoOverPI
Definition: Meteoconst.h:77
static const double l_water_vaporization
Definition: Meteoconst.h:53
static const double gaz_constant_water_vapor
Definition: Meteoconst.h:46
static const double l_water_fusion
Definition: Meteoconst.h:54
static const double PI4
Definition: Meteoconst.h:75
static const double gaz_constant
Definition: Meteoconst.h:47
static const double l_water_sublimation
Definition: Meteoconst.h:52
static const double water_molecular_mass
Definition: Meteoconst.h:55
static const double Ln10
Definition: Meteoconst.h:72
static const double stefan_boltzmann
Definition: Meteoconst.h:38
static const double Log2e
Definition: Meteoconst.h:69
static const double dbl_max
Definition: Meteoconst.h:84
static const double earth_R0
Definition: Meteoconst.h:62
static const double p_water_triple_pt
Definition: Meteoconst.h:49
static const double gravity
Definition: Meteoconst.h:39
static const double InvSqrt2
Definition: Meteoconst.h:80
static const double solcon
Definition: Meteoconst.h:64
static const double PI2
Definition: Meteoconst.h:74
static const double Ln2
Definition: Meteoconst.h:71
static const double specific_heat_water
Definition: Meteoconst.h:59
static const double dry_adiabatique_lapse_rate
Definition: Meteoconst.h:43
static const double InvPI
Definition: Meteoconst.h:76
static const double Log10e
Definition: Meteoconst.h:70
static const double TwoOverSqrtPI
Definition: Meteoconst.h:78
static const double to_deg
Definition: Meteoconst.h:82
static const double gaz_constant_dry_air
Definition: Meteoconst.h:45
static const double t_water_triple_pt
Definition: Meteoconst.h:51
static const double std_temp
Definition: Meteoconst.h:41
static const double Sqrt2
Definition: Meteoconst.h:79
static const double dbl_min
Definition: Meteoconst.h:85
Definition: Config.cc:31