Added docstrings for Cython Transport class

This commit is contained in:
Ray Speth 2012-09-06 19:59:58 +00:00
parent 777d10ddb8
commit 4ff9e61e0d
3 changed files with 52 additions and 0 deletions

View file

@ -8,3 +8,4 @@ Contents:
thermo
kinetics
transport

View file

@ -0,0 +1,7 @@
.. py:currentmodule:: cantera
Transport Properties
====================
.. autoclass:: Transport
.. autoclass:: DustyGasTransport

View file

@ -20,12 +20,23 @@ cdef np.ndarray get_transport_2d(Transport tran, transportMethod2d method):
cdef class Transport(_SolutionBase):
"""
This class is used to compute transport properties for a phase of matter.
Not all transport properties are implemented in all transport models.
"""
def __init__(self, *args, **kwargs):
if self.transport == NULL:
self.transport = newDefaultTransportMgr(self.thermo)
super().__init__(*args, **kwargs)
property transportModel:
"""
Get/Set the transport model associated with this transport model.
Setting a new transport model deletes the underlying C++ Transport
object and replaces it with a new one implementing the specified model.
"""
def __get__(self):
return pystr(transportModelName(self.transport.model()))
@ -35,59 +46,92 @@ cdef class Transport(_SolutionBase):
del old # only if the new transport manager was successfully created
property viscosity:
"""Viscosity [Pa-s]"""
def __get__(self):
return self.transport.viscosity()
property thermalConductivity:
"""Thermal conductivity. [W/m/K]"""
def __get__(self):
return self.transport.thermalConductivity()
property mixDiffCoeffs:
"""
Mixture-averaged diffusion coefficients [m^2/s] relating the
mass-averaged diffusive fluxes (with respect to the mass averaged
velocity) to gradients in the species mole fractions.
"""
def __get__(self):
return get_transport_1d(self, tran_getMixDiffCoeffs)
property mixDiffCoeffsMass:
"""
Mixture-averaged diffusion coefficients [m^2/s] relating the
diffusive mass fluxes to gradients in the species mass fractions.
"""
def __get__(self):
return get_transport_1d(self, tran_getMixDiffCoeffsMass)
property mixDiffCoeffsMole:
"""
Mixture-averaged diffusion coefficients [m^2/s] relating the
molar diffusive fluxes to gradients in the species mole fractions.
"""
def __get__(self):
return get_transport_1d(self, tran_getMixDiffCoeffsMole)
property thermalDiffCoeffs:
"""
Return a one-dimensional array of the species thermal diffusion
coefficients [kg/m/s].
"""
def __get__(self):
return get_transport_1d(self, tran_getThermalDiffCoeffs)
property multiDiffCoeffs:
"""Multicomponent diffusion coefficients [m^2/s]"""
def __get__(self):
return get_transport_2d(self, tran_getMultiDiffCoeffs)
property binaryDiffCoeffs:
"""Binary diffusion coefficients [m^2/s]"""
def __get__(self):
return get_transport_2d(self, tran_getBinaryDiffCoeffs)
cdef class DustyGasTransport(Transport):
"""
Implements the "dusty gas" model for transport in porous media.
As implemented here, only species transport (`~Transport.multiDiffCoeffs`)
is handled. The viscosity, thermal conductivity, and thermal diffusion
coefficients are not implemented.
"""
def __init__(self, *args, **kwargs):
self.transport = newTransportMgr(stringify("DustyGas"), self.thermo)
super().__init__(*args, **kwargs)
property porosity:
"""Porosity of the porous medium [dimensionless]"""
def __set__(self, value):
(<CxxDustyGasTransport*>self.transport).setPorosity(value)
property tortuosity:
"""Tortuosity of the porous medium [dimensionless]"""
def __set__(self, value):
(<CxxDustyGasTransport*>self.transport).setTortuosity(value)
property meanPoreRadius:
"""Mean pore radius of the porous medium [m]"""
def __set__(self, value):
(<CxxDustyGasTransport*>self.transport).setMeanPoreRadius(value)
property meanParticleDiameter:
"""Mean particle diameter of the porous medium [m]"""
def __set__(self, value):
(<CxxDustyGasTransport*>self.transport).setMeanParticleDiameter(value)
property permeability:
"""Permeability of the porous medium [m^2]"""
def __set__(self, value):
(<CxxDustyGasTransport*>self.transport).setPermeability(value)