Cantera  2.1.2
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GasTransport Class Referenceabstract

Class GasTransport implements some functions and properties that are shared by the MixTransport and MultiTransport classes. More...

#include <GasTransport.h>

Inheritance diagram for GasTransport:
[legend]
Collaboration diagram for GasTransport:
[legend]

Public Member Functions

 GasTransport (const GasTransport &right)
 
GasTransportoperator= (const GasTransport &right)
 
virtual doublereal viscosity ()
 Viscosity of the mixture (kg /m /s) More...
 
virtual void getSpeciesViscosities (doublereal *const visc)
 Get the pure-species viscosities. More...
 
virtual void getBinaryDiffCoeffs (const size_t ld, doublereal *const d)
 Returns the matrix of binary diffusion coefficients. More...
 
virtual void getMixDiffCoeffs (doublereal *const d)
 Returns the Mixture-averaged diffusion coefficients [m^2/s]. More...
 
virtual void getMixDiffCoeffsMole (doublereal *const d)
 Returns the mixture-averaged diffusion coefficients [m^2/s]. More...
 
virtual void getMixDiffCoeffsMass (doublereal *const d)
 Returns the mixture-averaged diffusion coefficients [m^2/s]. More...
 
- Public Member Functions inherited from Transport
 Transport (thermo_t *thermo=0, size_t ndim=1)
 Constructor. More...
 
 Transport (const Transport &right)
 
Transportoperator= (const Transport &right)
 
virtual TransportduplMyselfAsTransport () const
 Duplication routine for objects which inherit from Transport. More...
 
virtual int model () const
 Transport model. More...
 
thermo_tthermo ()
 
bool ready ()
 
void setNDim (const int ndim)
 Set the number of dimensions to be expected in flux expressions. More...
 
size_t nDim () const
 Return the number of dimensions in flux expressions. More...
 
void checkSpeciesIndex (size_t k) const
 Check that the specified species index is in range Throws an exception if k is greater than nSpecies() More...
 
void checkSpeciesArraySize (size_t kk) const
 Check that an array size is at least nSpecies() Throws an exception if kk is less than nSpecies(). More...
 
virtual doublereal getElectricConduct ()
 Compute the mixture electrical conductivity (S m-1) at the current conditions of the phase (Siemens m-1) More...
 
virtual void getElectricCurrent (int ndim, const doublereal *grad_T, int ldx, const doublereal *grad_X, int ldf, const doublereal *grad_V, doublereal *current)
 Compute the electric current density in A/m^2. More...
 
virtual void getSpeciesFluxes (size_t ndim, const doublereal *const grad_T, size_t ldx, const doublereal *const grad_X, size_t ldf, doublereal *const fluxes)
 Get the species diffusive mass fluxes wrt to the specified solution averaged velocity, given the gradients in mole fraction and temperature. More...
 
virtual void getSpeciesFluxesES (size_t ndim, const doublereal *grad_T, size_t ldx, const doublereal *grad_X, size_t ldf, const doublereal *grad_Phi, doublereal *fluxes)
 Get the species diffusive mass fluxes wrt to the mass averaged velocity, given the gradients in mole fraction, temperature and electrostatic potential. More...
 
virtual void getSpeciesVdiff (size_t ndim, const doublereal *grad_T, int ldx, const doublereal *grad_X, int ldf, doublereal *Vdiff)
 Get the species diffusive velocities wrt to the mass averaged velocity, given the gradients in mole fraction and temperature. More...
 
virtual void getSpeciesVdiffES (size_t ndim, const doublereal *grad_T, int ldx, const doublereal *grad_X, int ldf, const doublereal *grad_Phi, doublereal *Vdiff)
 Get the species diffusive velocities wrt to the mass averaged velocity, given the gradients in mole fraction, temperature, and electrostatic potential. More...
 
virtual void getMolarFluxes (const doublereal *const state1, const doublereal *const state2, const doublereal delta, doublereal *const cfluxes)
 Get the molar fluxes [kmol/m^2/s], given the thermodynamic state at two nearby points. More...
 
virtual void getMassFluxes (const doublereal *state1, const doublereal *state2, doublereal delta, doublereal *mfluxes)
 Get the mass fluxes [kg/m^2/s], given the thermodynamic state at two nearby points. More...
 
virtual void getThermalDiffCoeffs (doublereal *const dt)
 Return a vector of Thermal diffusion coefficients [kg/m/sec]. More...
 
virtual void getMultiDiffCoeffs (const size_t ld, doublereal *const d)
 Return the Multicomponent diffusion coefficients. Units: [m^2/s]. More...
 
virtual void setParameters (const int type, const int k, const doublereal *const p)
 Set model parameters for derived classes. More...
 
void setVelocityBasis (VelocityBasis ivb)
 Sets the velocity basis. More...
 
VelocityBasis getVelocityBasis () const
 Gets the velocity basis. More...
 
virtual doublereal bulkViscosity ()
 The bulk viscosity in Pa-s. More...
 
virtual doublereal ionConductivity ()
 The ionic conductivity in 1/ohm/m. More...
 
virtual void getSpeciesIonConductivity (doublereal *const ionCond)
 Returns the pure species ionic conductivity. More...
 
virtual void mobilityRatio (double *mobRat)
 Returns the pointer to the mobility ratios of the species in the phase. More...
 
virtual void getSpeciesMobilityRatio (double **mobRat)
 Returns the pure species limit of the mobility ratios. More...
 
virtual void selfDiffusion (doublereal *const selfDiff)
 Returns the self diffusion coefficients of the species in the phase. More...
 
virtual void getSpeciesSelfDiffusion (double **selfDiff)
 Returns the pure species self diffusion in solution of each species. More...
 
virtual doublereal thermalConductivity ()
 Returns the mixture thermal conductivity in W/m/K. More...
 
virtual doublereal electricalConductivity ()
 
virtual void getMobilities (doublereal *const mobil_e)
 Get the Electrical mobilities (m^2/V/s). More...
 
virtual void getFluidMobilities (doublereal *const mobil_f)
 Get the fluid mobilities (s kmol/kg). More...
 
virtual bool initSolid (SolidTransportData &tr)
 Called by TransportFactory to set parameters. More...
 
virtual void setThermo (thermo_t &thermo)
 Specifies the ThermoPhase object. More...
 

Protected Member Functions

 GasTransport (ThermoPhase *thermo=0)
 
virtual bool initGas (GasTransportParams &tr)
 Called by TransportFactory to set parameters. More...
 
virtual void update_T ()
 
virtual void update_C ()=0
 
virtual void updateViscosity_T ()
 Update the temperature-dependent viscosity terms. More...
 
virtual void updateSpeciesViscosities ()
 Update the pure-species viscosities. More...
 
virtual void updateDiff_T ()
 Update the binary diffusion coefficients. More...
 
- Protected Member Functions inherited from Transport
virtual bool initLiquid (LiquidTransportParams &tr)
 Called by TransportFactory to set parameters. More...
 
void finalize ()
 Enable the transport object for use. More...
 

Protected Attributes

vector_fp m_molefracs
 Vector of species mole fractions. More...
 
doublereal m_viscmix
 Internal storage for the viscosity of the mixture (kg /m /s) More...
 
bool m_visc_ok
 Update boolean for mixture rule for the mixture viscosity. More...
 
bool m_viscwt_ok
 Update boolean for the weighting factors for the mixture viscosity. More...
 
bool m_spvisc_ok
 Update boolean for the species viscosities. More...
 
bool m_bindiff_ok
 Update boolean for the binary diffusivities at unit pressure. More...
 
int m_mode
 Type of the polynomial fits to temperature. More...
 
DenseMatrix m_phi
 m_phi is a Viscosity Weighting Function. size = m_nsp * n_nsp More...
 
vector_fp m_spwork
 work space length = m_kk More...
 
vector_fp m_visc
 vector of species viscosities (kg /m /s). More...
 
std::vector< vector_fpm_visccoeffs
 Polynomial fits to the viscosity of each species. More...
 
vector_fp m_mw
 Local copy of the species molecular weights. More...
 
DenseMatrix m_wratjk
 Holds square roots of molecular weight ratios. More...
 
DenseMatrix m_wratkj1
 Holds square roots of molecular weight ratios. More...
 
vector_fp m_sqvisc
 vector of square root of species viscosities sqrt(kg /m /s). More...
 
vector_fp m_polytempvec
 Powers of the ln temperature, up to fourth order. More...
 
doublereal m_temp
 Current value of the temperature at which the properties in this object are calculated (Kelvin). More...
 
doublereal m_kbt
 Current value of Boltzman's constant times the temperature (Joules) More...
 
doublereal m_sqrt_kbt
 current value of Boltzman's constant times the temperature. More...
 
doublereal m_sqrt_t
 current value of temperature to 1/2 power More...
 
doublereal m_logt
 Current value of the log of the temperature. More...
 
doublereal m_t14
 Current value of temperature to 1/4 power. More...
 
doublereal m_t32
 Current value of temperature to the 3/2 power. More...
 
std::vector< vector_fpm_diffcoeffs
 Polynomial fits to the binary diffusivity of each species. More...
 
DenseMatrix m_bdiff
 Matrix of binary diffusion coefficients at the reference pressure and the current temperature Size is nsp x nsp. More...
 
- Protected Attributes inherited from Transport
thermo_tm_thermo
 pointer to the object representing the phase More...
 
bool m_ready
 true if finalize has been called More...
 
size_t m_nsp
 Number of species. More...
 
size_t m_nDim
 Number of dimensions used in flux expressions. More...
 
int m_velocityBasis
 Velocity basis from which diffusion velocities are computed. More...
 

Detailed Description

Class GasTransport implements some functions and properties that are shared by the MixTransport and MultiTransport classes.

Definition at line 16 of file GasTransport.h.

Member Function Documentation

doublereal viscosity ( )
virtual

Viscosity of the mixture (kg /m /s)

The viscosity is computed using the Wilke mixture rule (kg /m /s)

\[ \mu = \sum_k \frac{\mu_k X_k}{\sum_j \Phi_{k,j} X_j}. \]

Here \( \mu_k \) is the viscosity of pure species k, and

\[ \Phi_{k,j} = \frac{\left[1 + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_k}}\right)}\right]^2} {\sqrt{8}\sqrt{1 + M_k/M_j}} \]

Returns
Returns the viscosity of the mixture ( units = Pa s = kg /m /s)
See Also
updateViscosity_T();

Reimplemented from Transport.

Definition at line 169 of file GasTransport.cpp.

References DATA_PTR, GasTransport::m_molefracs, Transport::m_nsp, GasTransport::m_phi, GasTransport::m_spwork, GasTransport::m_visc, GasTransport::m_visc_ok, GasTransport::m_viscmix, GasTransport::m_viscwt_ok, Cantera::multiply(), and GasTransport::updateViscosity_T().

virtual void getSpeciesViscosities ( doublereal *const  visc)
inlinevirtual

Get the pure-species viscosities.

Reimplemented from Transport.

Definition at line 45 of file GasTransport.h.

References GasTransport::m_visc, and GasTransport::updateViscosity_T().

void getBinaryDiffCoeffs ( const size_t  ld,
doublereal *const  d 
)
virtual

Returns the matrix of binary diffusion coefficients.

d[ld*j + i] = rp * m_bdiff(i,j);

Parameters
ldoffset of rows in the storage
doutput vector of diffusion coefficients. Units of m**2 / s

Reimplemented from Transport.

Definition at line 260 of file GasTransport.cpp.

References GasTransport::m_bdiff, GasTransport::m_bindiff_ok, Transport::m_nsp, Transport::m_thermo, ThermoPhase::pressure(), and GasTransport::updateDiff_T().

void getMixDiffCoeffs ( doublereal *const  d)
virtual

Returns the Mixture-averaged diffusion coefficients [m^2/s].

Returns the mixture averaged diffusion coefficients for a gas, appropriate for calculating the mass averaged diffusive flux with respect to the mass averaged velocity using gradients of the mole fraction. Note, for the single species case or the pure fluid case the routine returns the self-diffusion coefficient. This is needed to avoid a Nan result in the formula below.

This is Eqn. 12.180 from "Chemically Reacting Flow"

\[ D_{km}' = \frac{\left( \bar{M} - X_k M_k \right)}{ \bar{\qquad M \qquad } } {\left( \sum_{j \ne k} \frac{X_j}{D_{kj}} \right) }^{-1} \]

Parameters
[out]dVector of mixture diffusion coefficients, \( D_{km}' \) , for each species (m^2/s). length m_nsp

Reimplemented from Transport.

Definition at line 277 of file GasTransport.cpp.

References GasTransport::m_bdiff, GasTransport::m_bindiff_ok, GasTransport::m_molefracs, GasTransport::m_mw, Transport::m_nsp, Transport::m_thermo, Phase::meanMolecularWeight(), ThermoPhase::pressure(), and GasTransport::updateDiff_T().

Referenced by MixTransport::getMobilities(), and MixTransport::getSpeciesFluxes().

void getMixDiffCoeffsMole ( doublereal *const  d)
virtual

Returns the mixture-averaged diffusion coefficients [m^2/s].

These are the coefficients for calculating the molar diffusive fluxes from the species mole fraction gradients, computed according to Eq. 12.176 in "Chemically Reacting Flow":

\[ D_{km}^* = \frac{1-X_k}{\sum_{j \ne k}^K X_j/\mathcal{D}_{kj}} \]

Parameters
[out]dvector of mixture-averaged diffusion coefficients for each species, length m_nsp.

Reimplemented from Transport.

Definition at line 312 of file GasTransport.cpp.

References GasTransport::m_bdiff, GasTransport::m_bindiff_ok, GasTransport::m_molefracs, Transport::m_nsp, Transport::m_thermo, ThermoPhase::pressure(), and GasTransport::updateDiff_T().

void getMixDiffCoeffsMass ( doublereal *const  d)
virtual

Returns the mixture-averaged diffusion coefficients [m^2/s].

These are the coefficients for calculating the diffusive mass fluxes from the species mass fraction gradients, computed according to Eq. 12.178 in "Chemically Reacting Flow":

\[ \frac{1}{D_{km}} = \sum_{j \ne k}^K \frac{X_j}{\mathcal{D}_{kj}} + \frac{X_k}{1-Y_k} \sum_{j \ne k}^K \frac{Y_j}{\mathcal{D}_{kj}} \]

Parameters
[out]dvector of mixture-averaged diffusion coefficients for each species, length m_nsp.

Reimplemented from Transport.

Definition at line 342 of file GasTransport.cpp.

References GasTransport::m_bdiff, GasTransport::m_bindiff_ok, GasTransport::m_molefracs, GasTransport::m_mw, Transport::m_nsp, Transport::m_thermo, Phase::meanMolecularWeight(), ThermoPhase::pressure(), and GasTransport::updateDiff_T().

bool initGas ( GasTransportParams tr)
protectedvirtual
void updateViscosity_T ( )
protectedvirtual

Update the temperature-dependent viscosity terms.

Updates the array of pure species viscosities, and the weighting functions in the viscosity mixture rule. The flag m_visc_ok is set to true.

The formula for the weighting function is from Poling and Prausnitz, Eq. (9-5.14):

\[ \phi_{ij} = \frac{ \left[ 1 + \left( \mu_i / \mu_j \right)^{1/2} \left( M_j / M_i \right)^{1/4} \right]^2 } {\left[ 8 \left( 1 + M_i / M_j \right) \right]^{1/2}} \]

Definition at line 193 of file GasTransport.cpp.

References GasTransport::m_mw, Transport::m_nsp, GasTransport::m_phi, GasTransport::m_spvisc_ok, GasTransport::m_sqvisc, GasTransport::m_visc, GasTransport::m_viscwt_ok, GasTransport::m_wratjk, GasTransport::m_wratkj1, Cantera::SqrtEight, and GasTransport::updateSpeciesViscosities().

Referenced by GasTransport::getSpeciesViscosities(), and GasTransport::viscosity().

void updateSpeciesViscosities ( )
protectedvirtual

Update the pure-species viscosities.

These are evaluated from the polynomial fits of the temperature and are assumed to be independent of pressure.

Definition at line 216 of file GasTransport.cpp.

References Cantera::dot4(), Cantera::dot5(), GasTransport::m_mode, Transport::m_nsp, GasTransport::m_polytempvec, GasTransport::m_spvisc_ok, GasTransport::m_sqvisc, GasTransport::m_t14, GasTransport::m_visc, and GasTransport::m_visccoeffs.

Referenced by MultiTransport::updateThermal_T(), and GasTransport::updateViscosity_T().

void updateDiff_T ( )
protectedvirtual

Member Data Documentation

vector_fp m_molefracs
protected
doublereal m_viscmix
protected

Internal storage for the viscosity of the mixture (kg /m /s)

Definition at line 144 of file GasTransport.h.

Referenced by GasTransport::viscosity().

bool m_visc_ok
protected

Update boolean for mixture rule for the mixture viscosity.

Definition at line 147 of file GasTransport.h.

Referenced by GasTransport::initGas(), MixTransport::update_C(), and GasTransport::viscosity().

bool m_viscwt_ok
protected

Update boolean for the weighting factors for the mixture viscosity.

Definition at line 150 of file GasTransport.h.

Referenced by GasTransport::initGas(), GasTransport::updateViscosity_T(), and GasTransport::viscosity().

bool m_spvisc_ok
protected

Update boolean for the species viscosities.

Definition at line 153 of file GasTransport.h.

Referenced by GasTransport::initGas(), GasTransport::updateSpeciesViscosities(), and GasTransport::updateViscosity_T().

bool m_bindiff_ok
protected
int m_mode
protected

Type of the polynomial fits to temperature.

CK_Mode means Chemkin mode. Currently CA_Mode is used which are different types of fits to temperature.

Definition at line 160 of file GasTransport.h.

Referenced by GasTransport::initGas(), MultiTransport::model(), MixTransport::updateCond_T(), GasTransport::updateDiff_T(), GasTransport::updateSpeciesViscosities(), and MultiTransport::updateThermal_T().

DenseMatrix m_phi
protected

m_phi is a Viscosity Weighting Function. size = m_nsp * n_nsp

Definition at line 163 of file GasTransport.h.

Referenced by GasTransport::initGas(), GasTransport::updateViscosity_T(), and GasTransport::viscosity().

vector_fp m_spwork
protected
vector_fp m_visc
protected

vector of species viscosities (kg /m /s).

These are used in Wilke's rule to calculate the viscosity of the solution. length = m_kk.

Definition at line 170 of file GasTransport.h.

Referenced by GasTransport::getSpeciesViscosities(), GasTransport::initGas(), GasTransport::updateSpeciesViscosities(), MultiTransport::updateThermal_T(), GasTransport::updateViscosity_T(), and GasTransport::viscosity().

std::vector<vector_fp> m_visccoeffs
protected

Polynomial fits to the viscosity of each species.

m_visccoeffs[k] is the vector of polynomial coefficients for species k that fits the viscosity as a function of temperature.

Definition at line 175 of file GasTransport.h.

Referenced by GasTransport::initGas(), and GasTransport::updateSpeciesViscosities().

vector_fp m_mw
protected
DenseMatrix m_wratjk
protected

Holds square roots of molecular weight ratios.

m_wratjk(j,k) = sqrt(mw[j]/mw[k]) j < k
m_wratjk(k,j) = sqrt(sqrt(mw[j]/mw[k])) j < k

Definition at line 187 of file GasTransport.h.

Referenced by GasTransport::initGas(), and GasTransport::updateViscosity_T().

DenseMatrix m_wratkj1
protected

Holds square roots of molecular weight ratios.

m_wratjk1(j,k) = sqrt(1.0 + mw[k]/mw[j]) j < k

Definition at line 193 of file GasTransport.h.

Referenced by GasTransport::initGas(), and GasTransport::updateViscosity_T().

vector_fp m_sqvisc
protected

vector of square root of species viscosities sqrt(kg /m /s).

These are used in Wilke's rule to calculate the viscosity of the solution. length = m_kk.

Definition at line 198 of file GasTransport.h.

Referenced by GasTransport::initGas(), GasTransport::updateSpeciesViscosities(), and GasTransport::updateViscosity_T().

vector_fp m_polytempvec
protected

Powers of the ln temperature, up to fourth order.

Definition at line 201 of file GasTransport.h.

Referenced by MixTransport::updateCond_T(), GasTransport::updateDiff_T(), and GasTransport::updateSpeciesViscosities().

doublereal m_temp
protected
doublereal m_kbt
protected

Current value of Boltzman's constant times the temperature (Joules)

Definition at line 208 of file GasTransport.h.

Referenced by MultiTransport::updateThermal_T().

doublereal m_sqrt_kbt
protected

current value of Boltzman's constant times the temperature.

(Joules) to 1/2 power

Definition at line 212 of file GasTransport.h.

doublereal m_sqrt_t
protected

current value of temperature to 1/2 power

Definition at line 215 of file GasTransport.h.

Referenced by MixTransport::updateCond_T(), GasTransport::updateDiff_T(), and MultiTransport::updateThermal_T().

doublereal m_logt
protected

Current value of the log of the temperature.

Definition at line 218 of file GasTransport.h.

Referenced by MultiTransport::updateThermal_T().

doublereal m_t14
protected

Current value of temperature to 1/4 power.

Definition at line 221 of file GasTransport.h.

Referenced by GasTransport::updateSpeciesViscosities().

doublereal m_t32
protected

Current value of temperature to the 3/2 power.

Definition at line 224 of file GasTransport.h.

std::vector<vector_fp> m_diffcoeffs
protected

Polynomial fits to the binary diffusivity of each species.

m_diffcoeff[ic] is vector of polynomial coefficients for species i species j that fits the binary diffusion coefficient. The relationship between i j and ic is determined from the following algorithm:

int ic = 0;
for (i = 0; i < m_nsp; i++) {
   for (j = i; j < m_nsp; j++) {
     ic++;
   }

Definition at line 239 of file GasTransport.h.

Referenced by GasTransport::initGas(), and GasTransport::updateDiff_T().

DenseMatrix m_bdiff
protected

The documentation for this class was generated from the following files: