From eabb46b9e78fbd3a659274aaeac6c4ccd275768a Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 6 Sep 2012 19:55:40 +0000 Subject: [PATCH] Added physical constants to the new Python module --- interfaces/cython/cantera/__init__.py | 1 + interfaces/cython/cantera/constants.pyx | 49 +++++++++++++++++++++++++ interfaces/cython/setup.py.in | 1 + 3 files changed, 51 insertions(+) create mode 100644 interfaces/cython/cantera/constants.pyx diff --git a/interfaces/cython/cantera/__init__.py b/interfaces/cython/cantera/__init__.py index 7a493060d..aeb237c7f 100644 --- a/interfaces/cython/cantera/__init__.py +++ b/interfaces/cython/cantera/__init__.py @@ -1 +1,2 @@ from .solution import * +from .constants import * diff --git a/interfaces/cython/cantera/constants.pyx b/interfaces/cython/cantera/constants.pyx new file mode 100644 index 000000000..6fcde141e --- /dev/null +++ b/interfaces/cython/cantera/constants.pyx @@ -0,0 +1,49 @@ +cdef extern from "cantera/base/ct_defs.h" namespace "Cantera": + cdef double CxxAvogadro "Cantera::Avogadro" + cdef double CxxGasConstant "Cantera::GasConstant" + cdef double CxxOneAtm "Cantera::OneAtm" + cdef double CxxBoltzmann "Cantera::Boltzmann" + cdef double CxxPlanck "Cantera::Planck" + cdef double CxxStefanBoltz "Cantera::StefanBoltz" + cdef double CxxFaraday "Cantera::Faraday" + cdef double CxxElectronCharge "Cantera::ElectronCharge" + cdef double CxxElectronMass "Cantera::ElectronMass" + cdef double CxxLightSpeed "Cantera::lightSpeed" + cdef double CxxPermeability_0 "Cantera::permeability_0" + cdef double CxxEpsilon_0 "Cantera::epsilon_0" + +#: Avogadro's Number, /kmol +Avogadro = CxxAvogadro + +#: The ideal gas constant in J/kmo-K +GasConstant = CxxGasConstant + +#: One atmosphere in Pascals +OneAtm = CxxOneAtm + +#: Boltzmann constant +Boltzmann = CxxBoltzmann + +#: Planck constant (J/s) +Planck = CxxPlanck + +#: The Stefan-Boltzmann constant, W/m^2K^4 +StefanBoltz = CxxStefanBoltz + +#: The charge on an electron (C) +ElectronCharge = CxxElectronCharge + +#: The mass of an electron (kg) +ElectronMass = CxxElectronMass + +#: Faraday constant, C/kmol +Faraday = CxxFaraday + +#: Speed of Light (m/s). +lightSpeed = CxxLightSpeed + +#: Permeability of free space :math:`\mu_0` in N/A^2. +permeability_0 = CxxPermeability_0 + +#: Permittivity of free space (Farads/m = C^2/N/m^2) +epsilon_0 = CxxEpsilon_0 diff --git a/interfaces/cython/setup.py.in b/interfaces/cython/setup.py.in index 668bb21e0..15c843c8b 100644 --- a/interfaces/cython/setup.py.in +++ b/interfaces/cython/setup.py.in @@ -22,6 +22,7 @@ def addExtension(name): addExtension('solution') addExtension('utils') +addExtension('constants') setup(name="Cantera", version="@cantera_version@",