1 /*!
2  * \file   include/TFEL/PhysicalConstants.hxx
3  * \brief
4  * \author Thomas Helfer
5  * \date   18 août 2017
6  * \copyright Copyright (C) 2006-2018 CEA/DEN, EDF R&D. All rights
7  * reserved.
8  * This project is publicly released under either the GNU GPL Licence
9  * or the CECILL-A licence. A copy of thoses licences are delivered
10  * with the sources of TFEL. CEA or EDF may also distribute this
11  * project under specific licensing conditions.
12  */
13 
14 #ifndef LIB_TFEL_PHYSICALCONSTANTS_HXX
15 #define LIB_TFEL_PHYSICALCONSTANTS_HXX
16 
17 #include "TFEL/Config/TFELConfig.hxx"
18 
19 namespace tfel {
20 
21 #if __cplusplus >= 201703L
22 
23   template <typename real = double>
24   struct PhysicalConstants {
25     //! Atomic mass constant (kg)
26     static constexpr const real AtomicMassConstant = real(1.66054e-27);
27     //! Atomic mass constant (kg)
28     static constexpr const real mu = real(1.66054e-27);
29     //! Avogadro constant (mol-1)
30     static constexpr const real AvogadroConstant = real(6.02214e+23);
31     //! Avogadro constant (mol-1)
32     static constexpr const real Na = real(6.02214e+23);
33     //! Boltzmann constant (J.K-1)
34     static constexpr const real BoltzmannConstant = real(1.38065e-23);
35     //! Boltzmann constant (J.K-1)
36     static constexpr const real kb = real(1.38065e-23);
37     //! Conductance quantum (S)
38     static constexpr const real ConductanceQuantum = real(7.74809e-05);
39     //! Conductance quantum (S)
40     static constexpr const real G0 = real(7.74809e-05);
41     //! Electric constant (F.m-1)
42     static constexpr const real ElectricConstant = real(8.85419e-12);
43     //! Electric constant (F.m-1)
44     static constexpr const real e0 = real(8.85419e-12);
45     //! Electron mass (kg)
46     static constexpr const real ElectronMass = real(9.10938e-31);
47     //! Electron mass (kg)
48     static constexpr const real me = real(9.10938e-31);
49     //! Electron volt (J)
50     static constexpr const real ElectronVolt = real(1.60218e-19);
51     //! Electron volt (J)
52     static constexpr const real eV = real(1.60218e-19);
53     //! Elementary charge (C)
54     static constexpr const real ElementaryCharge = real(1.60218e-19);
55     //! Elementary charge (C)
56     static constexpr const real e = real(1.60218e-19);
57     //! Faraday constant (C.mol-1)
58     static constexpr const real FaradayConstant = real(96485.3);
59     //! Faraday constant (C.mol-1)
60     static constexpr const real F = real(96485.3);
61     //! Fine-structure constant
62     static constexpr const real FineStructureConstant = real(0.00729735);
63     //! Fine-structure constant
64     static constexpr const real a = real(0.00729735);
65     //! Molar gas constant (J.mol-1.K-1)
66     static constexpr const real MolarGasConstant = real(8.31446);
67     //! Molar gas constant (J.mol-1.K-1)
68     static constexpr const real R = real(8.31446);
69     //! Stefan-Boltzmann constant (W.m-2.K-4)
70     static constexpr const real StefanBoltzmannConstant = real(5.67037e-08);
71     //! Stefan-Boltzmann constant (W.m-2.K-4)
72     static constexpr const real s = real(5.67037e-08);
73   };  // end of PhysicalConstants
74 
75   namespace constants {
76 
77     //! Atomic mass constant (kg)
78     template <typename real>
79     inline constexpr const real AtomicMassConstant = real(1.66054e-27);
80     //! Atomic mass constant (kg)
81     template <typename real = double>
82     inline constexpr const real mu = real(1.66054e-27);
83     //! Avogadro constant (mol-1)
84     template <typename real>
85     inline constexpr const real AvogadroConstant = real(6.02214e+23);
86     //! Avogadro constant (mol-1)
87     template <typename real = double>
88     inline constexpr const real Na = real(6.02214e+23);
89     //! Boltzmann constant (J.K-1)
90     template <typename real>
91     inline constexpr const real BoltzmannConstant = real(1.38065e-23);
92     //! Boltzmann constant (J.K-1)
93     template <typename real = double>
94     inline constexpr const real kb = real(1.38065e-23);
95     //! Conductance quantum (S)
96     template <typename real>
97     inline constexpr const real ConductanceQuantum = real(7.74809e-05);
98     //! Conductance quantum (S)
99     template <typename real = double>
100     inline constexpr const real G0 = real(7.74809e-05);
101     //! Electric constant (F.m-1)
102     template <typename real>
103     inline constexpr const real ElectricConstant = real(8.85419e-12);
104     //! Electric constant (F.m-1)
105     template <typename real = double>
106     inline constexpr const real e0 = real(8.85419e-12);
107     //! Electron mass (kg)
108     template <typename real>
109     inline constexpr const real ElectronMass = real(9.10938e-31);
110     //! Electron mass (kg)
111     template <typename real = double>
112     inline constexpr const real me = real(9.10938e-31);
113     //! Electron volt (J)
114     template <typename real>
115     inline constexpr const real ElectronVolt = real(1.60218e-19);
116     //! Electron volt (J)
117     template <typename real = double>
118     inline constexpr const real eV = real(1.60218e-19);
119     //! Elementary charge (C)
120     template <typename real>
121     inline constexpr const real ElementaryCharge = real(1.60218e-19);
122     //! Elementary charge (C)
123     template <typename real = double>
124     inline constexpr const real e = real(1.60218e-19);
125     //! Faraday constant (C.mol-1)
126     template <typename real>
127     inline constexpr const real FaradayConstant = real(96485.3);
128     //! Faraday constant (C.mol-1)
129     template <typename real = double>
130     inline constexpr const real F = real(96485.3);
131     //! Fine-structure constant
132     template <typename real>
133     inline constexpr const real FineStructureConstant = real(0.00729735);
134     //! Fine-structure constant
135     template <typename real = double>
136     inline constexpr const real a = real(0.00729735);
137     //! Molar gas constant (J.mol-1.K-1)
138     template <typename real>
139     inline constexpr const real MolarGasConstant = real(8.31446);
140     //! Molar gas constant (J.mol-1.K-1)
141     template <typename real = double>
142     inline constexpr const real R = real(8.31446);
143     //! Stefan-Boltzmann constant (W.m-2.K-4)
144     template <typename real>
145     inline constexpr const real StefanBoltzmannConstant = real(5.67037e-08);
146     //! Stefan-Boltzmann constant (W.m-2.K-4)
147     template <typename real = double>
148     inline constexpr const real s = real(5.67037e-08);
149 
150   }  // end of namespace constants
151 
152 #else  /* __cplusplus >= 201703L */
153 
154   template <typename real = double>
155   struct TFELPHYSICALCONSTANTS_VISIBILITY_EXPORT PhysicalConstants {
156     //! Atomic mass constant (kg)
157     static const real AtomicMassConstant;
158     //! Atomic mass constant (kg)
159     static const real mu;
160     //! Avogadro constant (mol-1)
161     static const real AvogadroConstant;
162     //! Avogadro constant (mol-1)
163     static const real Na;
164     //! Boltzmann constant (J.K-1)
165     static const real BoltzmannConstant;
166     //! Boltzmann constant (J.K-1)
167     static const real kb;
168     //! Conductance quantum (S)
169     static const real ConductanceQuantum;
170     //! Conductance quantum (S)
171     static const real G0;
172     //! Electric constant (F.m-1)
173     static const real ElectricConstant;
174     //! Electric constant (F.m-1)
175     static const real e0;
176     //! Electron mass (kg)
177     static const real ElectronMass;
178     //! Electron mass (kg)
179     static const real me;
180     //! Electron volt (J)
181     static const real ElectronVolt;
182     //! Electron volt (J)
183     static const real eV;
184     //! Elementary charge (C)
185     static const real ElementaryCharge;
186     //! Elementary charge (C)
187     static const real e;
188     //! Faraday constant (C.mol-1)
189     static const real FaradayConstant;
190     //! Faraday constant (C.mol-1)
191     static const real F;
192     //! Fine-structure constant
193     static const real FineStructureConstant;
194     //! Fine-structure constant
195     static const real a;
196     //! Molar gas constant (J.mol-1.K-1)
197     static const real MolarGasConstant;
198     //! Molar gas constant (J.mol-1.K-1)
199     static const real R;
200     //! Stefan-Boltzmann constant (W.m-2.K-4)
201     static const real StefanBoltzmannConstant;
202     //! Stefan-Boltzmann constant (W.m-2.K-4)
203     static const real s;
204   };  // end of PhysicalConstants
205 #endif /* __cplusplus >= 201703L */
206 
207 }  // end of namespace tfel
208 
209 #endif /* LIB_TFEL_PHYSICALCONSTANTS_HXX */
210