[Python] Make activity coefficients and activities accessible
This commit is contained in:
parent
90d18dd337
commit
a5b0bdf695
4 changed files with 26 additions and 0 deletions
|
|
@ -85,6 +85,8 @@ THERMO_1D(getEntropy_R)
|
|||
THERMO_1D(getIntEnergy_RT)
|
||||
THERMO_1D(getGibbs_RT)
|
||||
THERMO_1D(getCp_R)
|
||||
THERMO_1D(getActivities)
|
||||
THERMO_1D(getActivityCoefficients)
|
||||
|
||||
KIN_1D(getFwdRatesOfProgress)
|
||||
KIN_1D(getRevRatesOfProgress)
|
||||
|
|
|
|||
|
|
@ -823,6 +823,8 @@ cdef extern from "cantera/cython/wrappers.h":
|
|||
void thermo_getIntEnergy_RT(CxxThermoPhase*, double*) except +translate_exception
|
||||
void thermo_getGibbs_RT(CxxThermoPhase*, double*) except +translate_exception
|
||||
void thermo_getCp_R(CxxThermoPhase*, double*) except +translate_exception
|
||||
void thermo_getActivities(CxxThermoPhase*, double*) except +translate_exception
|
||||
void thermo_getActivityCoefficients(CxxThermoPhase*, double*) except +translate_exception
|
||||
|
||||
# other ThermoPhase methods
|
||||
cdef void thermo_getMolecularWeights(CxxThermoPhase*, double*) except +translate_exception
|
||||
|
|
|
|||
|
|
@ -566,6 +566,13 @@ class TestThermoPhase(utilities.CanteraTest):
|
|||
cp = sum(self.phase.standard_cp_R * self.phase.X) * ct.gas_constant
|
||||
self.assertNear(cp, self.phase.cp_mole)
|
||||
|
||||
def test_activities(self):
|
||||
self.phase.TDY = 850.0, 0.2, 'H2:0.1, H2O:0.6, AR:0.3'
|
||||
self.assertArrayNear(self.phase.X, self.phase.activities)
|
||||
|
||||
self.assertArrayNear(self.phase.activity_coefficients,
|
||||
np.ones(self.phase.n_species))
|
||||
|
||||
def test_isothermal_compressibility(self):
|
||||
self.assertNear(self.phase.isothermal_compressibility, 1.0/self.phase.P)
|
||||
|
||||
|
|
|
|||
|
|
@ -1216,6 +1216,21 @@ cdef class ThermoPhase(_SolutionBase):
|
|||
def __get__(self):
|
||||
return self._getArray1(thermo_getCp_R)
|
||||
|
||||
property activities:
|
||||
"""
|
||||
Array of nondimensional activities. Returns either molar or molal
|
||||
activities depending on the convention of the thermodynamic model.
|
||||
"""
|
||||
def __get__(self):
|
||||
return self._getArray1(thermo_getActivities)
|
||||
|
||||
property activity_coefficients:
|
||||
"""
|
||||
Array of nondimensional, molar activity coefficients.
|
||||
"""
|
||||
def __get__(self):
|
||||
return self._getArray1(thermo_getActivityCoefficients)
|
||||
|
||||
######## Miscellaneous properties ########
|
||||
property isothermal_compressibility:
|
||||
"""Isothermal compressibility [1/Pa]."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue