From aab72379fea2261e9f5dfd519e438a687279cda3 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Tue, 12 Jun 2012 22:48:32 +0000 Subject: [PATCH] Updated physical constants to be consistent with 2010 CODATA recommendations --- include/cantera/base/ct_defs.h | 57 +++++++++++-------------- interfaces/matlab/toolbox/constants.m | 3 +- interfaces/matlab/toolbox/gasconstant.m | 2 +- interfaces/python/Cantera/constants.py | 30 ++++++------- 4 files changed, 42 insertions(+), 50 deletions(-) diff --git a/include/cantera/base/ct_defs.h b/include/cantera/base/ct_defs.h index d2dd162da..66faf6441 100644 --- a/include/cantera/base/ct_defs.h +++ b/include/cantera/base/ct_defs.h @@ -53,16 +53,16 @@ namespace Cantera * @defgroup physConstants Physical Constants * %Cantera uses the MKS system of units. The unit for moles * is defined to be the kmol. All values of physical constants - * are consistent with the 2006 CODATA recommendations. + * are consistent with the 2010 CODATA recommendations. * @ingroup globalData * @{ */ + //! Pi -const doublereal Pi = 3.1415926; +const doublereal Pi = 3.14159265358979323846; //! sqrt(Pi) const doublereal SqrtPi = std::sqrt(Pi); - /*! * @name Variations of the Gas Constant * %Cantera uses the MKS system of units. The unit for moles @@ -70,61 +70,52 @@ const doublereal SqrtPi = std::sqrt(Pi); */ //@{ -//! Avogadro's Number -/*! - * Units are number/kmol - */ -const doublereal Avogadro = 6.02214179e26; +//! Avogadro's Number [number/kmol] +const doublereal Avogadro = 6.02214129e26; -/// Universal Gas Constant. 2006 CODATA value. -const doublereal GasConstant = 8314.47215; // J/kmol/K +/// Universal Gas Constant. [J/kmol/K] +const doublereal GasConstant = 8314.4621; -const doublereal logGasConstant = 9.025752908; +const doublereal logGasConstant = std::log(GasConstant); -//! One atmosphere -/*! - * Units are Pa - */ +//! One atmosphere [Pa] const doublereal OneAtm = 1.01325e5; //! Universal gas constant in cal/mol/K -const doublereal GasConst_cal_mol_K = 1.987; +const doublereal GasConst_cal_mol_K = GasConstant / 4184.0; -//! Boltzmann's constant -/*! - * Units are J/K - */ +//! Boltzmann's constant [J/K] const doublereal Boltzmann = GasConstant / Avogadro; -/// Planck's constant. Units of J-s -const doublereal Planck = 6.62606896e-34; // J-s -const doublereal Planck_bar = 1.05457162853e-34; // m2-kg/s +/// Planck's constant. [J-s] +const doublereal Planck = 6.62607009e-34; // J-s +const doublereal Planck_bar = Planck / (2 * Pi); // m2-kg/s /// log(k/h) -const doublereal logBoltz_Planck = 23.7599032; // ln(k_B/h) +const doublereal logBoltz_Planck = std::log(Boltzmann / Planck); // ln(k_B/h) /// Stefan-Boltzmann constant -const doublereal StefanBoltz = 5.6704004e-8; +const doublereal StefanBoltz = 5.670373e-8; //@} /// @name Electron Properties //@{ -const doublereal ElectronCharge = 1.60217648740e-19; // C -const doublereal ElectronMass = 9.1093821545e-31; // kg -const doublereal Faraday = ElectronCharge* Avogadro; +const doublereal ElectronCharge = 1.602176565e-19; // C +const doublereal ElectronMass = 9.10938291e-31; // kg +const doublereal Faraday = ElectronCharge * Avogadro; //@} /// @name Electromagnetism /// %Cantera uses the MKS unit system. //@{ -/// Permittivity of free space \f$ \epsilon_0 \f$ in F/m. -const doublereal epsilon_0 = 8.85417817e-12; // Farads/m = C^2/N/m^2 +/// Speed of Light (m/s). +const doublereal lightSpeed = 299792458.0; /// Permeability of free space \f$ \mu_0 \f$ in N/A^2. -const doublereal permeability_0 = 4.0e-7*Pi; // N/A^2 +const doublereal permeability_0 = 4.0e-7*Pi; -/// Speed of Light (m/s). -const doublereal lightSpeed = 1.0/std::sqrt(epsilon_0* permeability_0); +/// Permittivity of free space \f$ \epsilon_0 \f$ in F/m. +const doublereal epsilon_0 = 1.0 / (lightSpeed*lightSpeed*permeability_0); //@} //@} diff --git a/interfaces/matlab/toolbox/constants.m b/interfaces/matlab/toolbox/constants.m index ecf8aeb02..719c5e6e1 100755 --- a/interfaces/matlab/toolbox/constants.m +++ b/interfaces/matlab/toolbox/constants.m @@ -1,3 +1,4 @@ function [atm,r] = constants atm = 101325.0; -r = 8314.0; +r = 8314.4621; + diff --git a/interfaces/matlab/toolbox/gasconstant.m b/interfaces/matlab/toolbox/gasconstant.m index 909e9aeb3..ed5c9a294 100755 --- a/interfaces/matlab/toolbox/gasconstant.m +++ b/interfaces/matlab/toolbox/gasconstant.m @@ -1,3 +1,3 @@ function r = gasconstant % GASCONSTANT The universal gas constant in J/kmol-K. -r = 8314.0; +r = 8314.4621; diff --git a/interfaces/python/Cantera/constants.py b/interfaces/python/Cantera/constants.py index 5a4a51df2..0ae67d7a2 100755 --- a/interfaces/python/Cantera/constants.py +++ b/interfaces/python/Cantera/constants.py @@ -11,39 +11,39 @@ import math OneAtm = 101325.0 #: The ideal gas constant in J/kmo-K -GasConstant = 8314.47215 +GasConstant = 8314.4621 #: Avogadro's Number, /kmol -Avogadro = 6.02214179e26 +Avogadro = 6.02214129e26 #: The ideal gas constant in cal/mol-K -GasConst_cal_mol_K = 1.987 +GasConst_cal_mol_K = GasConstant / 4184.0 #: Boltzmann-s constant Boltzmann = GasConstant / Avogadro #: The Stefan-Boltzmann constant, W/m^2K^4 -StefanBoltz = 5.6704004e-8 +StefanBoltz = 5.670373e-8 #: The charge on an electron (C) -ElectronCharge = 1.60217648740e-19 +ElectronCharge = 1.602176565e-19 #: The mass of an electron (kg) -ElectronMass = 9.1093821545e-31 +ElectronMass = 9.10938291e-31 -Pi = 3.1415926 +Pi = math.pi #: Faraday's constant, C/kmol Faraday = ElectronCharge * Avogadro #: Planck's constant (J/s) -Planck = 6.6262e-34 - -#: Permittivity of free space -epsilon_0 = 8.85417817e-12 ## Farads/m = C^2/N/m^2 - -#: Permeability of free space :math:`\mu_0` in N/A^2. -permeability_0 = 4.0e-7*Pi; ## N/A^2 +Planck = 6.62607009e-34 #: Speed of Light (m/s). -lightSpeed = 1.0/math.sqrt(epsilon_0 * permeability_0); +lightSpeed = 299792458.0 + +#: Permeability of free space :math:`\mu_0` in N/A^2. +permeability_0 = 4.0e-7*Pi ## N/A^2 + +#: Permittivity of free space +epsilon_0 = 1.0 / (lightSpeed*lightSpeed*permeability_0) ## Farads/m = C^2/N/m^2