54 #ifndef CONSTANTS_IN_ARTS_H 55 #define CONSTANTS_IN_ARTS_H 112 3.141592653589793238462643383279502884197169399375105820974944592307816406286;
115 static constexpr
Numeric inv_pi =
116 0.3183098861837906715377675267450287240689192914809128974953346881177935952685;
119 static constexpr
Numeric two_pi =
120 6.283185307179586476925286766559005768394338798750211641949889184615632812572;
123 static constexpr
Numeric inv_two_pi =
124 0.1591549430918953357688837633725143620344596457404564487476673440588967976342;
127 static constexpr
Numeric sqrt_pi =
128 1.772453850905516027298167483341145182797549456122387128213807789852911284591;
131 static constexpr
Numeric inv_sqrt_pi =
132 0.5641895835477562869480794515607725858440506293289988568440857217106424684415;
135 static constexpr
Numeric euler =
136 2.718281828459045235360287471352662497757247093699959574966967627724076630354;
139 static constexpr
Numeric inv_euler =
140 0.3678794411714423215955237701614608674458111310317678345078368016974614957448;
143 static constexpr
Numeric log10_euler =
144 0.4342944819032518276511289189166050822943970058036665661144537831658646492089;
147 static constexpr
Numeric ln_10 =
148 2.302585092994045684017991454684364207601101488628772976033327900967572609677;
151 static constexpr
Numeric sqrt_2 =
152 1.414213562373095048801688724209698078569671875376948073176679737990732478462;
155 static constexpr
Numeric inv_sqrt_2 =
156 0.7071067811865475244008443621048490392848359376884740365883398689953662392311;
159 static constexpr
Numeric ln_2 =
160 0.6931471805599453094172321214581765680755001343602552541206800094933936219697;
163 static constexpr
Numeric inv_ln_2 =
164 1.442695040888963407359924681001892137426645954152985934135449406931109219181;
167 static constexpr
Numeric sqrt_ln_2 =
168 0.8325546111576977563531646448952010476305888522644407291668291172340794351973;
171 static constexpr
Numeric inv_sqrt_ln_2 =
172 1.201122408786449794857803286095221722566764028068699423868879896733837175546;
178 static constexpr
Numeric Delta_nu_Cs = 9192631770;
184 static constexpr
Numeric speed_of_light = 299792458;
187 static constexpr
Numeric c = speed_of_light;
193 static constexpr
Numeric planck_constant = 6.62607015e-34;
196 static constexpr
Numeric h = planck_constant;
199 static constexpr
Numeric reduced_planck_constant = h * inv_two_pi;
202 static constexpr
Numeric h_bar = reduced_planck_constant;
208 static constexpr
Numeric elementary_charge = 1.602176634e-19;
211 static constexpr
Numeric e = elementary_charge;
217 static constexpr
Numeric boltzmann_constant = 1.380649e-23;
220 static constexpr
Numeric k = boltzmann_constant;
226 static constexpr
Numeric avogadro_constant = 6.02214076e23;
229 static constexpr
Numeric NA = avogadro_constant;
235 static constexpr
Numeric K_cd = 683;
242 static constexpr
Numeric fine_structure_constant = 7.2973525693e-3;
245 static constexpr
Numeric alpha = fine_structure_constant;
252 static constexpr
Numeric rydberg_constant = 10973731.568160;
255 static constexpr
Numeric R_inf = rydberg_constant;
258 static constexpr
Numeric magnetic_constant = 2 * h * alpha / (c *
pow2(e));
261 static constexpr
Numeric mu_0 = magnetic_constant;
264 static constexpr
Numeric vacuum_permittivity =
pow2(e) / (2 * h * c * alpha);
267 static constexpr
Numeric epsilon_0 = vacuum_permittivity;
270 static constexpr
Numeric electron_mass = 2 * h * R_inf / (c *
pow2(alpha));
273 static constexpr
Numeric m_e = electron_mass;
280 static constexpr
Numeric unified_atomic_mass_unit = 1.66053906660e-27;
283 static constexpr
Numeric m_u = unified_atomic_mass_unit;
290 static constexpr
Numeric mass_ratio_electrons_per_proton = 1
'836.152'673
'43; 293 static constexpr Numeric proton_mass = electron_mass * mass_ratio_electrons_per_proton; 300 static constexpr Numeric mass_ratio_electrons_per_neutron = 1'838.683
'661'73;
303 static constexpr
Numeric neutron_mass = electron_mass * mass_ratio_electrons_per_neutron;
306 static constexpr
Numeric bohr_magneton = e * h_bar / (2 * m_e);
309 static constexpr
Numeric ideal_gas_constant = k * NA;
312 static constexpr
Numeric R = ideal_gas_constant;
315 static constexpr
Numeric doppler_broadening_const_squared = 2000 * R /
pow2(c);
374 template <
class T1,
class T2>
376 return rad2deg(std::atan2(y, x));
380 static constexpr
Numeric KAYCM2FREQ = 100 * c;
381 static constexpr
Numeric FREQ2KAYCM = 1 / KAYCM2FREQ;
384 return x * KAYCM2FREQ;
388 return x * FREQ2KAYCM;
392 static constexpr
Numeric ANGCM2FREQ = KAYCM2FREQ * inv_two_pi;
393 static constexpr
Numeric FREQ2ANGCM = 1 / ANGCM2FREQ;
396 return x * ANGCM2FREQ;
400 return x * FREQ2ANGCM;
406 return x * inv_two_pi;
437 static constexpr
Numeric PA2TORR = 1 / TORR2PA;
448 static constexpr
Numeric CEL2KEL = 273.15;
459 static constexpr
Numeric HITRAN2ARTS_LS = KAYCM2FREQ * 1e-4;
460 static constexpr
Numeric ARTS2HITRAN_LS = 1 / HITRAN2ARTS_LS;
463 return x * HITRAN2ARTS_LS;
467 return x * ARTS2HITRAN_LS;
471 static constexpr
Numeric HITRAN2ARTS_GAMMA = KAYCM2FREQ /
ATM2PA;
472 static constexpr
Numeric ARTS2HITRAN_GAMMA = 1 / HITRAN2ARTS_GAMMA;
475 return x * HITRAN2ARTS_GAMMA;
479 return x * ARTS2HITRAN_GAMMA;
483 static constexpr
Numeric HITRAN2ARTS_ENERGY = h * KAYCM2FREQ;
484 static constexpr
Numeric ARTS2HITRAN_ENERGY = 1 / HITRAN2ARTS_ENERGY;
487 return x * HITRAN2ARTS_ENERGY;
491 return x * ARTS2HITRAN_ENERGY;
Namespace containing several constants, physical and mathematical.
constexpr Numeric wavelen2freq(T x)
Conversion wavelength to frequency and back.
constexpr T hitran2arts_linestrength(T x)
constexpr Numeric atm2pa(T x)
constexpr T hitran2arts_broadening(T x)
constexpr T hitran2arts_energy(T x)
constexpr Numeric freq2wavelen(T x)
constexpr Numeric deg2rad(T x)
Converts degrees to radians.
constexpr Numeric pa2torr(T x)
constexpr T arts2hitran_linestrength(T x)
Numeric atand(T x)
Returns rad2deg of the arc-tangent of the input.
Numeric atan2d(T1 y, T2 x)
Returns rad2deg of the arc-tangent of inputs #T1/#T2.
constexpr Numeric pa2atm(T x)
const Numeric TORR2PA
Global constant, converts torr to Pa.
constexpr Numeric angfreq2freq(T x)
Conversion constant Angular frequency to frequency and back.
constexpr T pow2(T x)
power of two
constexpr Numeric torr2pa(T x)
constexpr T pow4(T x)
power of four
constexpr T meter2angstrom(T x)
Numeric sind(T x)
Returns the sine of the deg2rad of the input.
Numeric cosd(T x)
Returns the cosine of the deg2rad of the input.
constexpr Numeric angcm2freq(T x)
constexpr T arts2hitran_energy(T x)
constexpr Numeric rad2deg(T x)
Converts radians to degrees.
constexpr Numeric freq2angcm(T x)
constexpr Numeric kelvin2celsius(T x)
constexpr Numeric kaycm2freq(T x)
constexpr T arts2hitran_broadening(T x)
NUMERIC Numeric
The type to use for all floating point numbers.
Numeric tand(T x)
Returns the tangent of the deg2rad of the input.
constexpr T pow3(T x)
power of three
Numeric asind(T x)
Returns rad2deg of the arc-sine of the input.
const Numeric DEG2RAD
Global constant, conversion from degrees to radians.
Numeric acosd(T x)
Returns rad2deg of the arc-cosine of the input.
Namespace containing several practical unit conversions, physical and mathematical.
constexpr Numeric freq2angfreq(T x)
constexpr Numeric freq2kaycm(T x)
constexpr T angstrom2meter(T x)
const Numeric ATM2PA
Global constant, converts atm to Pa.
const Numeric RAD2DEG
Global constant, conversion from radians to degrees.
constexpr Numeric celsius2kelvin(T x)