Cantera  2.5.1
MixTransport.h
Go to the documentation of this file.
1 /**
2  * @file MixTransport.h
3  * Headers for the MixTransport object, which models transport properties
4  * in ideal gas solutions using a mixture averaged approximation
5  * (see \ref tranprops and \link Cantera::MixTransport MixTransport \endlink) .
6  */
7 
8 // This file is part of Cantera. See License.txt in the top-level directory or
9 // at https://cantera.org/license.txt for license and copyright information.
10 
11 #ifndef CT_MIXTRAN_H
12 #define CT_MIXTRAN_H
13 
14 #include "GasTransport.h"
16 
17 namespace Cantera
18 {
19 //! Class MixTransport implements mixture-averaged transport properties for
20 //! ideal gas mixtures.
21 /*!
22  * The model is based on that described in: R. J. Kee, M. J. Coltrin, and P.
23  * Glarborg, "Chemically Reacting Flow: Theory & Practice", John Wiley & Sons,
24  * 2003.
25  *
26  * The viscosity is computed using the Wilke mixture rule (kg /m /s)
27  *
28  * \f[
29  * \mu = \sum_k \frac{\mu_k X_k}{\sum_j \Phi_{k,j} X_j}.
30  * \f]
31  *
32  * Here \f$ \mu_k \f$ is the viscosity of pure species \e k, and
33  *
34  * \f[
35  * \Phi_{k,j} = \frac{\left[1
36  * + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_k}}\right)}\right]^2}
37  * {\sqrt{8}\sqrt{1 + M_k/M_j}}
38  * \f]
39  *
40  * The thermal conductivity is computed from the following mixture rule:
41  * \f[
42  * \lambda = 0.5 \left( \sum_k X_k \lambda_k + \frac{1}{\sum_k X_k/\lambda_k} \right)
43  * \f]
44  *
45  * It's used to compute the flux of energy due to a thermal gradient
46  *
47  * \f[
48  * j_T = - \lambda \nabla T
49  * \f]
50  *
51  * The flux of energy has units of energy (kg m2 /s2) per second per area.
52  *
53  * The units of lambda are W / m K which is equivalent to kg m / s^3 K.
54  * @ingroup tranprops
55  */
56 class MixTransport : public GasTransport
57 {
58 public:
59  //! Default constructor.
60  MixTransport();
61 
62  virtual std::string transportType() const {
63  return (m_mode == CK_Mode) ? "CK_Mix" : "Mix";
64  }
65 
66  //! Return the thermal diffusion coefficients
67  /*!
68  * For this approximation, these are all zero.
69  *
70  * @param dt Vector of thermal diffusion coefficients. Units = kg/m/s
71  */
72  virtual void getThermalDiffCoeffs(doublereal* const dt);
73 
74  //! Returns the mixture thermal conductivity (W/m /K)
75  /*!
76  * The thermal conductivity is computed from the following mixture rule:
77  * \f[
78  * \lambda = 0.5 \left( \sum_k X_k \lambda_k + \frac{1}{\sum_k X_k/\lambda_k} \right)
79  * \f]
80  *
81  * It's used to compute the flux of energy due to a thermal gradient
82  *
83  * \f[
84  * j_T = - \lambda \nabla T
85  * \f]
86  *
87  * The flux of energy has units of energy (kg m2 /s2) per second per area.
88  *
89  * The units of lambda are W / m K which is equivalent to kg m / s^3 K.
90  *
91  * @returns the mixture thermal conductivity, with units of W/m/K
92  */
93  virtual doublereal thermalConductivity();
94 
95  //! Get the Electrical mobilities (m^2/V/s).
96  /*!
97  * This function returns the mobilities. In some formulations this is equal
98  * to the normal mobility multiplied by Faraday's constant.
99  *
100  * Here, the mobility is calculated from the diffusion coefficient using the
101  * Einstein relation
102  *
103  * \f[
104  * \mu^e_k = \frac{F D_k}{R T}
105  * \f]
106  *
107  * @param mobil Returns the mobilities of the species in array \c mobil.
108  * The array must be dimensioned at least as large as the
109  * number of species.
110  */
111  virtual void getMobilities(doublereal* const mobil);
112 
113  //! Update the internal parameters whenever the temperature has changed
114  /*!
115  * This is called whenever a transport property is requested if the
116  * temperature has changed since the last call to update_T().
117  */
118  virtual void update_T();
119 
120  //! Update the internal parameters whenever the concentrations have changed
121  /*!
122  * This is called whenever a transport property is requested if the
123  * concentrations have changed since the last call to update_C().
124  */
125  virtual void update_C();
126 
127  //! Get the species diffusive mass fluxes wrt to the mass averaged velocity,
128  //! given the gradients in mole fraction and temperature
129  /*!
130  * Units for the returned fluxes are kg m-2 s-1.
131  *
132  * The diffusive mass flux of species \e k is computed from
133  * \f[
134  * \vec{j}_k = -n M_k D_k \nabla X_k.
135  * \f]
136  *
137  * @param ndim Number of dimensions in the flux expressions
138  * @param grad_T Gradient of the temperature (length = ndim)
139  * @param ldx Leading dimension of the grad_X array
140  * (usually equal to m_nsp but not always)
141  * @param grad_X Gradients of the mole fraction. Flat vector with the
142  * m_nsp in the inner loop. length = ldx * ndim
143  * @param ldf Leading dimension of the fluxes array
144  * (usually equal to m_nsp but not always)
145  * @param fluxes Output of the diffusive mass fluxes. Flat vector with
146  * the m_nsp in the inner loop. length = ldx * ndim
147  */
148  virtual void getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
149  size_t ldx, const doublereal* const grad_X,
150  size_t ldf, doublereal* const fluxes);
151 
152  virtual void init(thermo_t* thermo, int mode=0, int log_level=0);
153 
154 protected:
155  //! Calculate the pressure from the ideal gas law
156  doublereal pressure_ig() const {
157  return (m_thermo->molarDensity() * GasConstant *
158  m_thermo->temperature());
159  }
160 
161  //! Update the temperature dependent parts of the species thermal
162  //! conductivities
163  /*!
164  * These are evaluated from the polynomial fits of the temperature and are
165  * assumed to be independent of pressure
166  */
167  void updateCond_T();
168 
169  //! vector of species thermal conductivities (W/m /K)
170  /*!
171  * These are used in wilke's rule to calculate the viscosity of the
172  * solution. units = W /m /K = kg m /s^3 /K. length = m_kk.
173  */
175 
176  //! Internal storage for the calculated mixture thermal conductivity
177  /*!
178  * Units = W /m /K
179  */
180  doublereal m_lambda;
181 
182  //! Update boolean for the species thermal conductivities
184 
185  //! Update boolean for the mixture rule for the mixture thermal conductivity
187 };
188 }
189 #endif
Headers for the DenseMatrix object, which deals with dense rectangular matrices and description of th...
Class GasTransport implements some functions and properties that are shared by the MixTransport and M...
Definition: GasTransport.h:31
int m_mode
Type of the polynomial fits to temperature.
Definition: GasTransport.h:271
Class MixTransport implements mixture-averaged transport properties for ideal gas mixtures.
Definition: MixTransport.h:57
virtual void getThermalDiffCoeffs(doublereal *const dt)
Return the thermal diffusion coefficients.
virtual doublereal thermalConductivity()
Returns the mixture thermal conductivity (W/m /K)
virtual void update_T()
Update the internal parameters whenever the temperature has changed.
vector_fp m_cond
vector of species thermal conductivities (W/m /K)
Definition: MixTransport.h:174
doublereal pressure_ig() const
Calculate the pressure from the ideal gas law.
Definition: MixTransport.h:156
bool m_spcond_ok
Update boolean for the species thermal conductivities.
Definition: MixTransport.h:183
virtual void init(thermo_t *thermo, int mode=0, int log_level=0)
Initialize a transport manager.
virtual void getMobilities(doublereal *const mobil)
Get the Electrical mobilities (m^2/V/s).
void updateCond_T()
Update the temperature dependent parts of the species thermal conductivities.
MixTransport()
Default constructor.
doublereal m_lambda
Internal storage for the calculated mixture thermal conductivity.
Definition: MixTransport.h:180
virtual std::string transportType() const
Identifies the Transport object type.
Definition: MixTransport.h:62
virtual void update_C()
Update the internal parameters whenever the concentrations have changed.
bool m_condmix_ok
Update boolean for the mixture rule for the mixture thermal conductivity.
Definition: MixTransport.h:186
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 mass averaged velocity, given the gradients in mole ...
double molarDensity() const
Molar density (kmol/m^3).
Definition: Phase.cpp:700
doublereal temperature() const
Temperature (K).
Definition: Phase.h:667
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:102
thermo_t & thermo()
thermo_t * m_thermo
pointer to the object representing the phase
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:180
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition: ct_defs.h:109
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264