Cantera  2.1.2
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 
19 class GasTransportParams;
20 
21 //! Class MixTransport implements mixture-averaged transport properties for ideal gas mixtures.
22 /*!
23  * The model is based on that described by Kee, Coltrin, and Glarborg,
24  * "Theoretical and Practical Aspects of Chemically Reacting Flow Modeling."
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 protected:
59 
60  //! Default constructor.
61  MixTransport();
62 
63 public:
64 
65  MixTransport(const MixTransport& right);
66  MixTransport& operator=(const MixTransport& right);
67  virtual Transport* duplMyselfAsTransport() const;
68 
69  //! Return the model id for transport
70  /*!
71  * @return cMixtureAverage
72  */
73  virtual int model() const {
74  return cMixtureAveraged;
75  }
76 
77  //! Return the thermal diffusion coefficients
78  /*!
79  * For this approximation, these are all zero.
80  *
81  * Eqns. (12.168) shows how they are used in an expression for the species flux.
82  *
83  * @param dt Vector of thermal diffusion coefficients. Units = kg/m/s
84  */
85  virtual void getThermalDiffCoeffs(doublereal* const dt);
86 
87  //! Returns the mixture thermal conductivity (W/m /K)
88  /*!
89  * The thermal conductivity is computed from the following mixture rule:
90  * \f[
91  * \lambda = 0.5 \left( \sum_k X_k \lambda_k + \frac{1}{\sum_k X_k/\lambda_k} \right)
92  * \f]
93  *
94  * It's used to compute the flux of energy due to a thermal gradient
95  *
96  * \f[
97  * j_T = - \lambda \nabla T
98  * \f]
99  *
100  * The flux of energy has units of energy (kg m2 /s2) per second per area.
101  *
102  * The units of lambda are W / m K which is equivalent to kg m / s^3 K.
103  *
104  * @return Returns the mixture thermal conductivity, with units of W/m/K
105  */
106  virtual doublereal thermalConductivity();
107 
108  //! Get the Electrical mobilities (m^2/V/s).
109  /*!
110  * This function returns the mobilities. In some formulations
111  * this is equal to the normal mobility multiplied by Faraday's constant.
112  *
113  * Here, the mobility is calculated from the diffusion coefficient using the Einstein relation
114  *
115  * \f[
116  * \mu^e_k = \frac{F D_k}{R T}
117  * \f]
118  *
119  * @param mobil Returns the mobilities of the species in array \c mobil. The array must be
120  * dimensioned at least as large as the number of species.
121  */
122  virtual void getMobilities(doublereal* const mobil);
123 
124  //! Update the internal parameters whenever the temperature has changed
125  /*!
126  * This is called whenever a transport property is requested if
127  * the temperature has changed since the last call to update_T().
128  */
129  virtual void update_T();
130 
131  //! Update the internal parameters whenever the concentrations have changed
132  /*!
133  * This is called whenever a transport property is requested if the
134  * concentrations have changed since the last call to update_C().
135  */
136  virtual void update_C();
137 
138  //! Get the species diffusive mass fluxes wrt to the mass averaged velocity,
139  //! given the gradients in mole fraction and temperature
140  /*!
141  * Units for the returned fluxes are kg m-2 s-1.
142  *
143  * The diffusive mass flux of species \e k is computed from
144  * \f[
145  * \vec{j}_k = -n M_k D_k \nabla X_k.
146  * \f]
147  *
148  * @param ndim Number of dimensions in the flux expressions
149  * @param grad_T Gradient of the temperature
150  * (length = ndim)
151  * @param ldx Leading dimension of the grad_X array
152  * (usually equal to m_nsp but not always)
153  * @param grad_X Gradients of the mole fraction
154  * Flat vector with the m_nsp in the inner loop.
155  * length = ldx * ndim
156  * @param ldf Leading dimension of the fluxes array
157  * (usually equal to m_nsp but not always)
158  * @param fluxes Output of the diffusive mass fluxes
159  * Flat vector with the m_nsp in the inner loop.
160  * length = ldx * ndim
161  */
162  virtual void getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
163  size_t ldx, const doublereal* const grad_X,
164  size_t ldf, doublereal* const fluxes);
165 
166  //! Initialize the transport object
167  /*!
168  * Here we change all of the internal dimensions to be sufficient.
169  * We get the object ready to do property evaluations.
170  *
171  * @param tr Transport parameters for all of the species
172  * in the phase.
173  */
174  virtual bool initGas(GasTransportParams& tr);
175 
176  friend class TransportFactory;
177 
178 private:
179 
180  //! Calculate the pressure from the ideal gas law
181  doublereal pressure_ig() const {
182  return (m_thermo->molarDensity() * GasConstant *
183  m_thermo->temperature());
184  }
185 
186  //! Update the temperature dependent parts of the species thermal conductivities
187  /*!
188  * These are evaluated from the polynomial fits of the temperature and are
189  * assumed to be independent of pressure
190  */
191  void updateCond_T();
192 
193 private:
194  //! Polynomial fits to the thermal conductivity of each species
195  /*!
196  * m_condcoeffs[k] is vector of polynomial coefficients for species k
197  * that fits the thermal conductivity
198  */
199  std::vector<vector_fp> m_condcoeffs;
200 
201  //! vector of species thermal conductivities (W/m /K)
202  /*!
203  * These are used in wilke's rule to calculate the viscosity of the
204  * solution. units = W /m /K = kg m /s^3 /K. length = m_kk.
205  */
207 
208  //! Internal storage for the calculated mixture thermal conductivity
209  /*!
210  * Units = W /m /K
211  */
212  doublereal m_lambda;
213 
214  //! Update boolean for the species thermal conductivities
216 
217  //! Update boolean for the mixture rule for the mixture thermal conductivity
219 public:
220  vector_fp m_eps;
221  vector_fp m_sigma;
222  vector_fp m_alpha;
223  DenseMatrix m_dipole;
224  vector_fp m_zrot;
225  vector_fp m_crot;
226 private:
227  //! Debug flag - turns on more printing
228  bool m_debug;
229 };
230 }
231 #endif
std::vector< vector_fp > m_condcoeffs
Polynomial fits to the thermal conductivity of each species.
Definition: MixTransport.h:199
This structure holds transport model parameters relevant to transport in ideal gases with a kinetic t...
vector_fp m_cond
vector of species thermal conductivities (W/m /K)
Definition: MixTransport.h:206
virtual int model() const
Return the model id for transport.
Definition: MixTransport.h:73
bool m_condmix_ok
Update boolean for the mixture rule for the mixture thermal conductivity.
Definition: MixTransport.h:218
Factory class for creating new instances of classes derived from Transport.
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:597
bool m_spcond_ok
Update boolean for the species thermal conductivities.
Definition: MixTransport.h:215
virtual void getMobilities(doublereal *const mobil)
Get the Electrical mobilities (m^2/V/s).
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.
virtual bool initGas(GasTransportParams &tr)
Initialize the transport object.
MixTransport()
Default constructor.
doublereal m_lambda
Internal storage for the calculated mixture thermal conductivity.
Definition: MixTransport.h:212
doublereal temperature() const
Temperature (K).
Definition: Phase.h:528
bool m_debug
Debug flag - turns on more printing.
Definition: MixTransport.h:228
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:165
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:66
virtual void getThermalDiffCoeffs(doublereal *const dt)
Return the thermal diffusion coefficients.
Class MixTransport implements mixture-averaged transport properties for ideal gas mixtures...
Definition: MixTransport.h:56
virtual doublereal thermalConductivity()
Returns the mixture thermal conductivity (W/m /K)
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
Definition: DenseMatrix.h:70
Class GasTransport implements some functions and properties that are shared by the MixTransport and M...
Definition: GasTransport.h:16
doublereal pressure_ig() const
Calculate the pressure from the ideal gas law.
Definition: MixTransport.h:181