From e9b49e3bb0e3edf9726722b22c0c3e2435fa2e27 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 6 Sep 2012 19:57:38 +0000 Subject: [PATCH] Added partial molar / non-dimensional thermo properties --- interfaces/cython/cantera/_cantera.pxd | 7 ++++ interfaces/cython/cantera/thermo.pyx | 49 ++++++++++++++++++++++++++ interfaces/cython/cantera/wrappers.h | 5 +++ 3 files changed, 61 insertions(+) diff --git a/interfaces/cython/cantera/_cantera.pxd b/interfaces/cython/cantera/_cantera.pxd index b980e8ab9..1e1ab2bee 100644 --- a/interfaces/cython/cantera/_cantera.pxd +++ b/interfaces/cython/cantera/_cantera.pxd @@ -120,6 +120,13 @@ cdef extern from "wrappers.h": cdef void thermo_getPartialMolarCp(CxxThermoPhase*, double*) except + cdef void thermo_getPartialMolarVolumes(CxxThermoPhase*, double*) except + + # ThermoPhase partial non-dimensional properties + void thermo_getEnthalpy_RT(CxxThermoPhase*, double*) except + + void thermo_getEntropy_R(CxxThermoPhase*, double*) except + + void thermo_getIntEnergy_RT(CxxThermoPhase*, double*) except + + void thermo_getGibbs_RT(CxxThermoPhase*, double*) except + + void thermo_getCp_R(CxxThermoPhase*, double*) except + + # other ThermoPhase methods cdef void thermo_getMolecularWeights(CxxThermoPhase*, double*) except + diff --git a/interfaces/cython/cantera/thermo.pyx b/interfaces/cython/cantera/thermo.pyx index b8cd0aa1d..74ff2d684 100644 --- a/interfaces/cython/cantera/thermo.pyx +++ b/interfaces/cython/cantera/thermo.pyx @@ -323,6 +323,55 @@ cdef class ThermoPhase(_SolutionBase): self.Y = values[2] self.SP = values[:2] + # partial molar / non-dimensional properties + property partial_molar_enthalpies: + def __get__(self): + return self._getArray1(thermo_getPartialMolarEnthalpies) + + property partial_molar_entropies: + def __get__(self): + return self._getArray1(thermo_getPartialMolarEntropies) + + property partial_molar_int_energies: + def __get__(self): + return self._getArray1(thermo_getPartialMolarIntEnergies) + + property chem_potentials: + def __get__(self): + return self._getArray1(thermo_getChemPotentials) + + property electrochem_potentials: + def __get__(self): + return self._getArray1(thermo_getElectrochemPotentials) + + property partial_molar_cp: + def __get__(self): + return self._getArray1(thermo_getPartialMolarCp) + + property partial_molar_volumes: + def __get__(self): + return self._getArray1(thermo_getPartialMolarVolumes) + + property standard_enthalpies_RT: + def __get__(self): + return self._getArray1(thermo_getEnthalpy_RT) + + property standard_entropies_R: + def __get__(self): + return self._getArray1(thermo_getEntropy_R) + + property standard_intEnergies_RT: + def __get__(self): + return self._getArray1(thermo_getIntEnergy_RT) + + property standard_gibbs_RT: + def __get__(self): + return self._getArray1(thermo_getGibbs_RT) + + property standard_cp_R: + def __get__(self): + return self._getArray1(thermo_getCp_R) + cdef class InterfacePhase(ThermoPhase): cdef CxxSurfPhase* surf diff --git a/interfaces/cython/cantera/wrappers.h b/interfaces/cython/cantera/wrappers.h index 2f74b428f..2fe779d95 100644 --- a/interfaces/cython/cantera/wrappers.h +++ b/interfaces/cython/cantera/wrappers.h @@ -21,3 +21,8 @@ THERMO_1D(getPartialMolarEntropies) THERMO_1D(getPartialMolarIntEnergies) THERMO_1D(getPartialMolarCp) THERMO_1D(getPartialMolarVolumes) +THERMO_1D(getEnthalpy_RT) +THERMO_1D(getEntropy_R) +THERMO_1D(getIntEnergy_RT) +THERMO_1D(getGibbs_RT) +THERMO_1D(getCp_R)