Cantera  2.0
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 // STL includes
14 #include <vector>
15 #include <string>
16 #include <map>
17 #include <numeric>
18 #include <algorithm>
19 
20 // Cantera includes
21 #include "GasTransport.h"
23 
24 namespace Cantera
25 {
26 
27 class GasTransportParams;
28 
29 //! Class MixTransport implements mixture-averaged transport properties for ideal gas mixtures.
30 /*!
31  * The model is based on that described by Kee, Coltrin, and Glarborg, "Theoretical and
32  * Practical Aspects of Chemically Reacting Flow Modeling."
33  *
34  *
35  * The viscosity is computed using the Wilke mixture rule (kg /m /s)
36  *
37  * \f[
38  * \mu = \sum_k \frac{\mu_k X_k}{\sum_j \Phi_{k,j} X_j}.
39  * \f]
40  *
41  * Here \f$ \mu_k \f$ is the viscosity of pure species \e k, and
42  *
43  * \f[
44  * \Phi_{k,j} = \frac{\left[1
45  * + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_k}}\right)}\right]^2}
46  * {\sqrt{8}\sqrt{1 + M_k/M_j}}
47  * \f]
48  *
49  *
50  * The thermal conductivity is computed from the following mixture rule:
51  * \f[
52  * \lambda = 0.5 \left( \sum_k X_k \lambda_k + \frac{1}{\sum_k X_k/\lambda_k} \right)
53  * \f]
54  *
55  * It's used to compute the flux of energy due to a thermal gradient
56  *
57  * \f[
58  * j_T = - \lambda \nabla T
59  * \f]
60  *
61  * The flux of energy has units of energy (kg m2 /s2) per second per area.
62  *
63  * The units of lambda are W / m K which is equivalent to kg m / s^3 K.
64  *
65  *
66  */
67 class MixTransport : public GasTransport
68 {
69 
70 protected:
71 
72  //! Default constructor.
73  MixTransport();
74 
75 public:
76 
77  //!Copy Constructor for the %MixTransport object.
78  /*!
79  * @param right %LiquidTransport to be copied
80  */
81  MixTransport(const MixTransport& right);
82 
83  //! Assignment operator
84  /*!
85  * This is NOT a virtual function.
86  *
87  * @param right Reference to %LiquidTransport object to be copied
88  * into the current one.
89  */
90  MixTransport& operator=(const MixTransport& right);
91 
92  //! Duplication routine for objects which inherit from
93  //! %Transport
94  /*!
95  * This virtual routine can be used to duplicate %Transport objects
96  * inherited from %Transport even if the application only has
97  * a pointer to %Transport to work with.
98  *
99  * These routines are basically wrappers around the derived copy
100  * constructor.
101  */
102  virtual Transport* duplMyselfAsTransport() const;
103 
104  //! Destructor
105  virtual ~MixTransport() {}
106 
107  //! Return the model id for transport
108  /*!
109  * @return cMixtureAverage
110  */
111  virtual int model() const {
112  return cMixtureAveraged;
113  }
114 
115  //! Return the thermal diffusion coefficients
116  /*!
117  * For this approximation, these are all zero.
118  *
119  * Eqns. (12.168) shows how they are used in an expression for the species flux.
120  *
121  * @param dt Vector of thermal diffusion coefficients. Units = kg/m/s
122  */
123  virtual void getThermalDiffCoeffs(doublereal* const dt);
124 
125  //! Returns the mixture thermal conductivity (W/m /K)
126  /*!
127  * The thermal conductivity is computed from the following mixture rule:
128  * \f[
129  * \lambda = 0.5 \left( \sum_k X_k \lambda_k + \frac{1}{\sum_k X_k/\lambda_k} \right)
130  * \f]
131  *
132  * It's used to compute the flux of energy due to a thermal gradient
133  *
134  * \f[
135  * j_T = - \lambda \nabla T
136  * \f]
137  *
138  * The flux of energy has units of energy (kg m2 /s2) per second per area.
139  *
140  * The units of lambda are W / m K which is equivalent to kg m / s^3 K.
141  *
142  * @return Returns the mixture thermal conductivity, with units of W/m/K
143  */
144  virtual doublereal thermalConductivity();
145 
146  //! Get the Electrical mobilities (m^2/V/s).
147  /*!
148  * This function returns the mobilities. In some formulations
149  * this is equal to the normal mobility multiplied by Faraday's constant.
150  *
151  * Here, the mobility is calculated from the diffusion coefficient using the Einstein relation
152  *
153  * \f[
154  * \mu^e_k = \frac{F D_k}{R T}
155  * \f]
156  *
157  * @param mobil Returns the mobilities of the species in array \c mobil. The array must be
158  * dimensioned at least as large as the number of species.
159  */
160  virtual void getMobilities(doublereal* const mobil);
161 
162  //! Update the internal parameters whenever the temperature has changed
163  /*!
164  * @internal
165  * This is called whenever a transport property is requested if the temperature has changed
166  * since the last call to update_T().
167  */
168  virtual void update_T();
169 
170  //! Update the internal parameters whenever the concentrations have changed
171  /*!
172  * @internal
173  * This is called whenever a transport property is requested if the concentrations have changed
174  * since the last call to update_C().
175  */
176  virtual void update_C();
177 
178  //! Get the species diffusive mass fluxes wrt to the mass averaged velocity,
179  //! given the gradients in mole fraction and temperature
180  /*!
181  * Units for the returned fluxes are kg m-2 s-1.
182  *
183  *
184  * The diffusive mass flux of species \e k is computed from
185  * \f[
186  * \vec{j}_k = -n M_k D_k \nabla X_k.
187  * \f]
188  *
189  * @param ndim Number of dimensions in the flux expressions
190  * @param grad_T Gradient of the temperature
191  * (length = ndim)
192  * @param ldx Leading dimension of the grad_X array
193  * (usually equal to m_nsp but not always)
194  * @param grad_X Gradients of the mole fraction
195  * Flat vector with the m_nsp in the inner loop.
196  * length = ldx * ndim
197  * @param ldf Leading dimension of the fluxes array
198  * (usually equal to m_nsp but not always)
199  * @param fluxes Output of the diffusive mass fluxes
200  * Flat vector with the m_nsp in the inner loop.
201  * length = ldx * ndim
202  */
203  virtual void getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
204  size_t ldx, const doublereal* const grad_X,
205  size_t ldf, doublereal* const fluxes);
206 
207  //! Initialize the transport object
208  /*!
209  * Here we change all of the internal dimensions to be sufficient.
210  * We get the object ready to do property evaluations.
211  *
212  * @param tr Transport parameters for all of the species
213  * in the phase.
214  */
215  virtual bool initGas(GasTransportParams& tr);
216 
217  friend class TransportFactory;
218 
219  //! Return a structure containing all of the pertinent parameters about a species that was
220  //! used to construct the Transport properties in this object.
221  /*!
222  * @param kspec Species number to obtain the properties from.
223  *
224  * @return GasTransportData returned structure.
225  * @deprecated
226  */
227  DEPRECATED(struct GasTransportData getGasTransportData(int kspec) const);
228 
229 private:
230 
231  //! Calculate the pressure from the ideal gas law
232  doublereal pressure_ig() const {
233  return (m_thermo->molarDensity() * GasConstant *
234  m_thermo->temperature());
235  }
236 
237  //! Update the temperature dependent parts of the species thermal conductivities
238  /*!
239  * These are evaluated from the polynomial fits of the temperature and are assumed to be
240  * independent of pressure
241  */
242  void updateCond_T();
243 
244  // --------- Member Data -------------
245 private:
246 
247  //! Polynomial fits to the thermal conductivity of each species
248  /*!
249  * m_condcoeffs[k] is vector of polynomial coefficients for species k
250  * that fits the thermal conductivity
251  */
252  std::vector<vector_fp> m_condcoeffs;
253 
254  //! vector of species thermal conductivities (W/m /K)
255  /*!
256  * These are used in wilke's rule to calculate the viscosity of the solution
257  * units = W /m /K = kg m /s^3 /K.
258  * length = m_kk
259  */
261 
262  //! Internal storage for the calculated mixture thermal conductivity
263  /*!
264  * Units = W /m /K
265  */
266  doublereal m_lambda;
267 
268  //! Update boolean for the species thermal conductivities
270 
271  //! Update boolean for the mixture rule for the mixture thermal conductivity
273 
274  //! Lennard-Jones well-depth of the species in the current phase
275  /*!
276  * Not used in this routine -> just a passthrough
277  *
278  * length is the number of species in the phase
279  * Units are Joules (Note this is not Joules/kmol) (note, no kmol -> this is a per molecule amount)
280  */
282 
283  //! hard-sphere diameter for (i,j) collision
284  /*!
285  * Not used in this routine -> just a passthrough
286  *
287  * diam(i,j) = 0.5*(tr.sigma[i] + tr.sigma[j]);
288  * Units are m (note, no kmol -> this is a per molecule amount)
289  *
290  * Length nsp * nsp. This is a symmetric matrix.
291  */
293 
294  //! The effective dipole moment for (i,j) collisions
295  /*!
296  * tr.dipoleMoment has units of Debye's. A Debye is 10-18 cm3/2 erg1/2
297  *
298  * Not used in this routine -> just a passthrough
299  *
300  * tr.dipole(i,i) = 1.e-25 * SqrtTen * trdat.dipoleMoment;
301  * tr.dipole(i,j) = sqrt(tr.dipole(i,i)*tr.dipole(j,j));
302  * Units are in Debye (note, no kmol -> this is a per molecule amount)
303  *
304  * Length nsp. We store only the diagonal component here.
305  */
307 
308  //! Polarizability of each species in the phase
309  /*!
310  * Not used in this routine -> just a passthrough
311  *
312  * Length = nsp
313  * Units = m^3
314  */
316 
317  //! Dimensionless rotational heat capacity of the species in the current phase
318  /*!
319  * Not used in this routine -> just a passthrough
320  *
321  * These values are 0, 1 and 1.5 for single-molecule, linear, and nonlinear species respectively
322  * length is the number of species in the phase
323  * units are dimensionless (Cr / R)
324  */
326 
327  //! Rotational relaxation number for the species in the current phase
328  /*!
329  * Not used in this routine -> just a passthrough
330  *
331  * length is the number of species in the phase
332  * units are dimensionless
333  */
335 
336  //! Debug flag - turns on more printing
337  bool m_debug;
338 };
339 }
340 #endif