Add cython func defn to expose species viscosity & test equivalence to single-species species viscosity
This commit is contained in:
parent
b1a010e3a3
commit
cc93ce62ca
4 changed files with 22 additions and 0 deletions
|
|
@ -111,6 +111,7 @@ TRANSPORT_1D(getMixDiffCoeffs)
|
|||
TRANSPORT_1D(getMixDiffCoeffsMass)
|
||||
TRANSPORT_1D(getMixDiffCoeffsMole)
|
||||
TRANSPORT_1D(getThermalDiffCoeffs)
|
||||
TRANSPORT_1D(getSpeciesViscosities)
|
||||
|
||||
TRANSPORT_2D(getMultiDiffCoeffs)
|
||||
TRANSPORT_2D(getBinaryDiffCoeffs)
|
||||
|
|
|
|||
|
|
@ -388,6 +388,7 @@ cdef extern from "cantera/transport/TransportBase.h" namespace "Cantera":
|
|||
double viscosity() except +translate_exception
|
||||
double thermalConductivity() except +translate_exception
|
||||
double electricalConductivity() except +translate_exception
|
||||
void getSpeciesViscosities(double*) except +translate_exception
|
||||
|
||||
|
||||
cdef extern from "cantera/transport/DustyGasTransport.h" namespace "Cantera":
|
||||
|
|
@ -856,6 +857,7 @@ cdef extern from "cantera/cython/wrappers.h":
|
|||
cdef void tran_getMixDiffCoeffsMass(CxxTransport*, double*) except +translate_exception
|
||||
cdef void tran_getMixDiffCoeffsMole(CxxTransport*, double*) except +translate_exception
|
||||
cdef void tran_getThermalDiffCoeffs(CxxTransport*, double*) except +translate_exception
|
||||
cdef void tran_getSpeciesViscosities(CxxTransport*, double*) except +translate_exception
|
||||
|
||||
cdef void tran_getMultiDiffCoeffs(CxxTransport*, size_t, double*) except +translate_exception
|
||||
cdef void tran_getBinaryDiffCoeffs(CxxTransport*, size_t, double*) except +translate_exception
|
||||
|
|
|
|||
|
|
@ -88,6 +88,20 @@ class TestTransport(utilities.CanteraTest):
|
|||
self.assertNear(gas1.thermal_conductivity, gas2.thermal_conductivity)
|
||||
self.assertArrayNear(gas1.multi_diff_coeffs, gas2.multi_diff_coeffs)
|
||||
|
||||
def test_species_visosities(self):
|
||||
for species_name in self.phase.species_names:
|
||||
# check that species viscosity matches overall for single-species
|
||||
# state
|
||||
self.phase.X = {species_name: 1}
|
||||
self.phase.TP = 800, 2*ct.one_atm
|
||||
visc = self.phase.viscosity
|
||||
self.assertNear(self.phase[species_name].species_viscosities[0],
|
||||
visc)
|
||||
# and ensure it doesn't change with pressure
|
||||
self.phase.TP = 800, 5*ct.one_atm
|
||||
self.assertNear(self.phase[species_name].species_viscosities[0],
|
||||
visc)
|
||||
|
||||
|
||||
class TestTransportGeometryFlags(utilities.CanteraTest):
|
||||
phase_data = """
|
||||
|
|
|
|||
|
|
@ -147,6 +147,11 @@ cdef class Transport(_SolutionBase):
|
|||
def __get__(self):
|
||||
return self.transport.viscosity()
|
||||
|
||||
property species_viscosities:
|
||||
"""Pure species viscosities [Pa-s]"""
|
||||
def __get__(self):
|
||||
return get_transport_1d(self, tran_getSpeciesViscosities)
|
||||
|
||||
property electrical_conductivity:
|
||||
"""Electrical conductivity. [S/m]."""
|
||||
def __get__(self):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue