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