ARTS 2.5.10 (git: 2f1c442c)
arts_constants.h
Go to the documentation of this file.
1/* Copyright (C) 2019
2 * Richard Larsson <ric.larsson@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2, or (at your option) any
7 * later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 * USA. */
18
54#ifndef CONSTANTS_IN_ARTS_H
55#define CONSTANTS_IN_ARTS_H
56
57#include <numbers>
58
59#include "arts_constexpr_math.h"
60#include "matpack.h"
61
63namespace Constant {
75inline constexpr Numeric pi = std::numbers::pi;
76
78inline constexpr Numeric inv_pi = std::numbers::inv_pi;
79
81inline constexpr Numeric two_pi = 2 * pi;
82
84inline constexpr Numeric inv_two_pi = 0.5 * inv_pi;
85
87inline constexpr Numeric sqrt_pi = 1.0/std::numbers::inv_sqrtpi;
88
90inline constexpr Numeric inv_sqrt_pi = std::numbers::inv_sqrtpi;
91
93inline constexpr Numeric euler = std::numbers::e;
94
96inline constexpr Numeric inv_euler = 1.0 / euler;
97
99inline constexpr Numeric log10_euler = std::numbers::log10e;
100
102inline constexpr Numeric ln_10 = std::numbers::ln10;
103
105inline constexpr Numeric sqrt_2 = std::numbers::sqrt2;
106
108inline constexpr Numeric inv_sqrt_2 = 1.0 / sqrt_2;
109
111inline constexpr Numeric ln_2 = std::numbers::ln2;
112
114inline constexpr Numeric inv_ln_2 = 1.0 / ln_2;
115
117inline constexpr Numeric sqrt_ln_2 =
118 0.8325546111576977563531646448952010476305888522644407291668291172340794351973;
119
121inline constexpr Numeric inv_sqrt_ln_2 =
122 1.201122408786449794857803286095221722566764028068699423868879896733837175546;
123
128inline constexpr Numeric Delta_nu_Cs = 9192631770;
129
134inline constexpr Numeric speed_of_light = 299792458;
135
137inline constexpr Numeric c = speed_of_light;
138
143inline constexpr Numeric planck_constant = 6.62607015e-34;
144
146inline constexpr Numeric h = planck_constant;
147
150
153
158inline constexpr Numeric elementary_charge = 1.602176634e-19;
159
161inline constexpr Numeric e = elementary_charge;
162
167inline constexpr Numeric boltzmann_constant = 1.380649e-23;
168
170inline constexpr Numeric k = boltzmann_constant;
171
176inline constexpr Numeric avogadro_constant = 6.02214076e23;
177
179inline constexpr Numeric NA = avogadro_constant;
180
185inline constexpr Numeric K_cd = 683;
186
192inline constexpr Numeric fine_structure_constant = 7.2973525693e-3;
193
196
202inline constexpr Numeric rydberg_constant = 10973731.568160;
203
205inline constexpr Numeric R_inf = rydberg_constant;
206
208inline constexpr Numeric magnetic_constant = 2 * h * alpha / (c * Math::pow2(e));
209
211inline constexpr Numeric mu_0 = magnetic_constant;
212
214inline constexpr Numeric vacuum_permittivity = Math::pow2(e) / (2 * h * c * alpha);
215
218
220inline constexpr Numeric electron_mass = 2 * h * R_inf / (c * Math::pow2(alpha));
221
223inline constexpr Numeric m_e = electron_mass;
224
230inline constexpr Numeric unified_atomic_mass_unit = 1.66053906660e-27;
231
234
240inline constexpr Numeric mass_ratio_electrons_per_proton = 1'836.152'673'43;
241
243inline constexpr Numeric proton_mass =
245
251inline constexpr Numeric mass_ratio_electrons_per_neutron = 1'838.683'661'73;
252
254inline constexpr Numeric neutron_mass =
256
258inline constexpr Numeric bohr_magneton = e * h_bar / (2 * m_e);
259
261inline constexpr Numeric ideal_gas_constant = k * NA;
262
264inline constexpr Numeric R = ideal_gas_constant;
265
268
270inline constexpr Numeric one_degree_in_radians = pi / 180;
271
275
278
284inline constexpr Numeric density_of_ice_at_0c = 0.9167e3;
285
291inline constexpr Numeric denity_of_water_at_4c = 1e3;
292
298
303inline constexpr Numeric earth_radius = 6.3781e6;
304
309inline constexpr Numeric temperature_at_0c = 273.15;
310}; // namespace Constant
311
312#endif
Simple constexpr math that we can make use of in Arts.
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
Namespace containing several constants, physical and mathematical.
constexpr Numeric unified_atomic_mass_unit
Unified atomic mass unit [kg] From: https://physics.nist.gov/cgi-bin/cuu/Value?ukg Date: 2020-02-18 R...
constexpr Numeric R_inf
Rydberg constant convenience name [1/m].
constexpr Numeric log10_euler
Ten's logarithm of Euler's number.
constexpr Numeric bohr_magneton
Bohr magneton [J/T].
constexpr Numeric one_degree_in_radians
One degree in radians.
constexpr Numeric inv_two_pi
Inverse of two pi.
constexpr Numeric inv_sqrt_pi
Inverse of the square root of pi.
constexpr Numeric m_e
Mass of resting electron convenience name [kg].
constexpr Numeric Delta_nu_Cs
Cesium-133 Unperturbed ground-state hyperfine transition frequency [Hz] From: https://en....
constexpr Numeric cosmic_microwave_background_temperature
Global constant, Planck temperature for cosmic background radiation [K].
constexpr Numeric fine_structure_constant
Fine structure constant [-] From: https://physics.nist.gov/cgi-bin/cuu/Value?alph Date: 2019-06-18 Re...
constexpr Numeric h_bar
Reduced planck constant convenience name [J s].
constexpr Numeric doppler_broadening_const_squared
Doppler broadening constant squared [kg/T]^2.
constexpr Numeric boltzmann_constant
Boltzmann constant [J/K] From: https://en.wikipedia.org/wiki/2019_redefinition_of_SI_base_units Date:...
constexpr Numeric sqrt_ln_2
Square root of natural logarithm of 2.
constexpr Numeric pi
The following mathematical constants are generated in python Decimal package by the code:
constexpr Numeric vacuum_permittivity
Vacuum permittivity [F/m].
constexpr Numeric euler
Euler's number.
constexpr Numeric electron_mass
Mass of resting electron [kg].
constexpr Numeric stefan_boltzmann_constant
Stefan-Boltzmann constant [W/(K^4*m^2)].
constexpr Numeric ln_2
Natural logarithm of 2.
constexpr Numeric inv_ln_2
Inverse of the natural logarithm of 2.
constexpr Numeric ideal_gas_constant
Ideal gas constant [J/mol K].
constexpr Numeric neutron_mass
Mass of a neutron [kg].
constexpr Numeric ln_10
Natural logarithm of 10.
constexpr Numeric two_pi
Two times pi.
constexpr Numeric inv_sqrt_ln_2
Inverse of the square root of the natural logarithm of 2.
constexpr Numeric R
Ideal gas constant convenience name [J/mol K].
constexpr Numeric K_cd
Luminous efficacy of monochromatic 540 THz radiation [lm / W] From: https://en.wikipedia....
constexpr Numeric k
Boltzmann constant convenience name [J/K].
constexpr Numeric mass_ratio_electrons_per_neutron
Mass ratio of electrons to protons [-] From: https://physics.nist.gov/cgi-bin/cuu/Value?...
constexpr Numeric speed_of_light
Speed of light [m/s] From: https://en.wikipedia.org/wiki/2019_redefinition_of_SI_base_units Date: 201...
constexpr Numeric reduced_planck_constant
Reduced planck constant [J s].
constexpr Numeric rydberg_constant
Rydberg constant [1/m] From: https://physics.nist.gov/cgi-bin/cuu/Value?ryd Date: 2016-06-18 Reported...
constexpr Numeric inv_euler
Inverse of Euler's number.
constexpr Numeric earth_radius
Global constant, the radius of the Earth [m].
constexpr Numeric inv_sqrt_2
Inverse of the square root of 2.
constexpr Numeric planck_constant
Planck constant [J s] From: https://en.wikipedia.org/wiki/2019_redefinition_of_SI_base_units Date: 20...
constexpr Numeric NA
Avogadro constant convenience name [1/mol].
constexpr Numeric sigma
Stefan-Boltzmann constant convenience name [W/(K^4*m^2)].
constexpr Numeric sqrt_pi
Square root of pi.
constexpr Numeric c
Speed of light convenience name [m/s].
constexpr Numeric magnetic_constant
Magnetic constant [H/m].
constexpr Numeric avogadro_constant
Avogadro constant [1/mol] From: https://en.wikipedia.org/wiki/2019_redefinition_of_SI_base_units Date...
constexpr Numeric e
Elementary charge convenience name [C].
constexpr Numeric temperature_at_0c
Global constant, Temperature in Celsius of 0 Kelvin.
constexpr Numeric inv_pi
Inverse of pi.
constexpr Numeric elementary_charge
Elementary charge [C] From: https://en.wikipedia.org/wiki/2019_redefinition_of_SI_base_units Date: 20...
constexpr Numeric h
Planck constant convenience name [J s].
constexpr Numeric proton_mass
Mass of a proton [kg].
constexpr Numeric density_of_ice_at_0c
Global constant, Density of water ice at 0C [kg/m3] source: http://en.wikipedia.org/wiki/Ice.
constexpr Numeric mass_ratio_electrons_per_proton
Mass ratio of electrons to protons [-] From: https://physics.nist.gov/cgi-bin/cuu/Value?...
constexpr Numeric alpha
Fine structure constant convenience name [-].
constexpr Numeric mu_0
Magnetic constant convenience name [H/m].
constexpr Numeric sqrt_2
Square root of 2.
constexpr Numeric denity_of_water_at_4c
Global constant, Density of liquid water +4C [kg/m3] source: http://en.wikipedia.org/wiki/Water.
constexpr Numeric epsilon_0
Vacuum permittivity convenience name [F/m].
constexpr Numeric m_u
Unified atomic mass unit convenience name [kg].
constexpr auto pow3(auto x) noexcept
power of three
constexpr auto pow4(auto x) noexcept
power of four
constexpr auto pow2(auto x) noexcept
power of two