rizer.cantera_ext
C++ Cantera 1-D plasma extension (custom Domain1D models and solvers)
Loading...
Searching...
No Matches
units.h File Reference

Physical constants and unit conversions, in SI by default. More...

#include <cmath>

Go to the source code of this file.

Namespaces

namespace  rizer
namespace  rizer::units

Variables

constexpr double rizer::units::e = 1.602'176'634e-19
 Elementary charge [C]. Exact (CODATA).
constexpr double rizer::units::k_b = 1.380'649e-23
 Boltzmann constant [J/K]. Exact (CODATA).
constexpr double rizer::units::N_a = 6.022'140'76e23
 Avogadro's number [1/mol]. Exact (CODATA).
constexpr double rizer::units::c = 299'792'458.0
 Speed of light [m/s]. Exact (CODATA).
constexpr double rizer::units::h = 6.626'070'15e-34
 Planck constant [J s]. Exact (CODATA).
constexpr double rizer::units::m_e = 9.109'383'713'9e-31
 Electron mass [kg] (CODATA 2022).
constexpr double rizer::units::M_e = m_e * N_a
 Electron molar mass [kg/mol].
constexpr double rizer::units::Da = 1.660'539'068'92e-27
 Dalton / atomic mass constant [kg] (CODATA 2022).
constexpr double rizer::units::epsilon_0 = 8.854'187'818'8e-12
 Vacuum permittivity [F/m] (CODATA 2022).
constexpr double rizer::units::stefan_boltzmann = 5.670'374'419e-8
 Stefan-Boltzmann constant [W/(m^2 K^4)] (CODATA).
constexpr double rizer::units::bohr_radius_m = 5.291'772'105'44e-11
 Bohr radius [m] (CODATA).
constexpr double rizer::units::rydberg_energy_eV = 13.605'693'122'990
 Rydberg energy [eV] (CODATA).
constexpr double rizer::units::pi = 3.141'592'653'589'793'238'46
 pi (matches numpy's np.pi used in units.py).
constexpr double rizer::units::hbar = h / (2.0 * pi)
 Reduced Planck constant [J s].
constexpr double rizer::units::R = k_b * N_a
 Ideal gas constant [J/(mol K)].
constexpr double rizer::units::R_kmol = R * 1e3
 Ideal gas constant [J/(kmol K)] (matches Cantera's GasConstant).
constexpr double rizer::units::m_N2 = 28.013'4 * Da
 N2 mass [kg].
constexpr double rizer::units::P_1_bar = 1e5
 1 bar [Pa].
constexpr double rizer::units::eV_to_K = e / k_b
 eV -> K.
constexpr double rizer::units::K_to_eV = k_b / e
 K -> eV.
constexpr double rizer::units::eV_to_J = e
 eV -> J.
constexpr double rizer::units::J_to_eV = 1.0 / e
 J -> eV.
constexpr double rizer::units::K_to_J = k_b
 K -> J.
constexpr double rizer::units::J_to_K = 1.0 / k_b
 J -> K.
constexpr double rizer::units::kJ_per_mol_to_J_per_particle = 1e3 / N_a
 kJ/mol -> J/particle.
constexpr double rizer::units::invcm_to_joule = h * c * 100.0
 inverse cm -> J.
const double rizer::units::spitzer_constant
 Spitzer conductivity constant [Ohm^-1 m^-1 K^-3/2]:

Detailed Description

Physical constants and unit conversions, in SI by default.

These mirror rizer/misc/units.py exactly so the compiled C++ physics (collision model, two-temperature reactor RHS, plasma rates) reproduces the Python reference (PlasmaExtension, ConstantMassPlasmaReactorOde) to interpolation error rather than to a constants mismatch. Keep the two files in sync: any value changed here must change in units.py, and vice versa.

This is a pure C++ core header (no Cantera, no pybind11). Prefer these over Cantera::Boltzmann / ElectronCharge / ... inside rizer physics: Cantera ships CODATA-2018 values, whereas units.py (and therefore the Python reference) uses CODATA-2022 for m_e and epsilon_0.

Definition in file units.h.