Cantera  2.2.1
GasTransport.h
Go to the documentation of this file.
1 /**
2  * @file GasTransport.h
3  */
4
5 #ifndef CT_GAS_TRANSPORT_H
6 #define CT_GAS_TRANSPORT_H
7
8 #include "TransportBase.h"
10
11 namespace Cantera
12 {
13
14 class MMCollisionInt;
15
16 //! Class GasTransport implements some functions and properties that are
17 //! shared by the MixTransport and MultiTransport classes.
18 //! @ingroup tranprops
19 class GasTransport : public Transport
20 {
21 public:
22  GasTransport(const GasTransport& right);
23  GasTransport& operator=(const GasTransport& right);
24
25  //! Viscosity of the mixture (kg /m /s)
26  /*!
27  * The viscosity is computed using the Wilke mixture rule (kg /m /s)
28  *
29  * \f[
30  * \mu = \sum_k \frac{\mu_k X_k}{\sum_j \Phi_{k,j} X_j}.
31  * \f]
32  *
33  * Here \f$\mu_k \f$ is the viscosity of pure species \e k, and
34  *
35  * \f[
36  * \Phi_{k,j} = \frac{\left[1
37  * + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_k}}\right)}\right]^2}
38  * {\sqrt{8}\sqrt{1 + M_k/M_j}}
39  * \f]
40  *
41  * @return Returns the viscosity of the mixture ( units = Pa s = kg /m /s)
42  *
43  * @see updateViscosity_T();
44  */
45  virtual doublereal viscosity();
46
47  //! Get the pure-species viscosities
48  virtual void getSpeciesViscosities(doublereal* const visc) {
49  update_T();
51  std::copy(m_visc.begin(), m_visc.end(), visc);
52  }
53
54  //! Returns the matrix of binary diffusion coefficients.
55  /*!
56  * d[ld*j + i] = rp * m_bdiff(i,j);
57  *
58  * @param ld offset of rows in the storage
59  * @param d output vector of diffusion coefficients. Units of m**2 / s
60  */
61  virtual void getBinaryDiffCoeffs(const size_t ld, doublereal* const d);
62
63  //! Returns the Mixture-averaged diffusion coefficients [m^2/s].
64  /*!
65  * Returns the mixture averaged diffusion coefficients for a gas,
66  * appropriate for calculating the mass averaged diffusive flux with respect
67  * to the mass averaged velocity using gradients of the mole fraction.
68  * Note, for the single species case or the pure fluid case the routine
69  * returns the self-diffusion coefficient. This is needed to avoid a Nan
70  * result in the formula below.
71  *
72  * This is Eqn. 12.180 from "Chemically Reacting Flow"
73  *
74  * \f[
75  * 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}
76  * \f]
77  *
78  * @param[out] d Vector of mixture diffusion coefficients, \f$D_{km}' \f$ ,
79  * for each species (m^2/s). length m_nsp
80  */
81  virtual void getMixDiffCoeffs(doublereal* const d);
82
83  //! Returns the mixture-averaged diffusion coefficients [m^2/s].
84  //! These are the coefficients for calculating the molar diffusive fluxes
85  //! from the species mole fraction gradients, computed according to
86  //! Eq. 12.176 in "Chemically Reacting Flow":
87  //!
88  //! \f[ D_{km}^* = \frac{1-X_k}{\sum_{j \ne k}^K X_j/\mathcal{D}_{kj}} \f]
89  //!
90  //! @param[out] d vector of mixture-averaged diffusion coefficients for
91  //! each species, length m_nsp.
92  virtual void getMixDiffCoeffsMole(doublereal* const d);
93
94  //! Returns the mixture-averaged diffusion coefficients [m^2/s].
95  /*!
96  * These are the coefficients for calculating the diffusive mass fluxes
97  * from the species mass fraction gradients, computed according to
98  * Eq. 12.178 in "Chemically Reacting Flow":
99  *
100  * \f[
101  * \frac{1}{D_{km}} = \sum_{j \ne k}^K \frac{X_j}{\mathcal{D}_{kj}} +
102  * \frac{X_k}{1-Y_k} \sum_{j \ne k}^K \frac{Y_j}{\mathcal{D}_{kj}}
103  * \f]
104  *
105  * @param[out] d vector of mixture-averaged diffusion coefficients for
106  * each species, length m_nsp.
107  */
108  virtual void getMixDiffCoeffsMass(doublereal* const d);
109
110  virtual void init(thermo_t* thermo, int mode=0, int log_level=0);
111
112 protected:
114
115  virtual void update_T();
116  virtual void update_C() = 0;
117
118  //! Update the temperature-dependent viscosity terms.
119  /**
120  * Updates the array of pure species viscosities, and the weighting
121  * functions in the viscosity mixture rule. The flag m_visc_ok is set to true.
122  *
123  * The formula for the weighting function is from Poling and Prausnitz,
124  * Eq. (9-5.14):
125  * \f[
126  * \phi_{ij} = \frac{ \left[ 1 + \left( \mu_i / \mu_j \right)^{1/2} \left( M_j / M_i \right)^{1/4} \right]^2 }
127  * {\left[ 8 \left( 1 + M_i / M_j \right) \right]^{1/2}}
128  * \f]
129  */
130  virtual void updateViscosity_T();
131
132  //! Update the pure-species viscosities. These are evaluated from the
133  //! polynomial fits of the temperature and are assumed to be independent
134  //! of pressure.
136
137  //! Update the binary diffusion coefficients
138  /*!
139  * These are evaluated from the polynomial fits of the temperature at the
140  * unit pressure of 1 Pa.
141  */
142  virtual void updateDiff_T();
143
144  //! @name Initialization
145  //! @{
146
147  //! Prepare to build a new kinetic-theory-based transport manager for
148  //! low-density gases
149  /*!
150  * Uses polynomial fits to Monchick & Mason collision integrals.
151  */
152  void setupMM();
153
154  //! Read the transport database
155  /*!
156  * Read transport property data from a file for a list of species. Given the
157  * name of a file containing transport property parameters and a list of
158  * species names.
159  */
160  void getTransportData();
161
162  //! Corrections for polar-nonpolar binary diffusion coefficients
163  /*!
164  * Calculate corrections to the well depth parameter and the diameter for
165  * use in computing the binary diffusion coefficient of polar-nonpolar
167  * Royal Society (1968).
168  *
169  * @param i Species one - this is a bimolecular correction routine
170  * @param j species two - this is a bimolecular correction routine
171  * @param f_eps Multiplicative correction factor to be applied to epsilon(i,j)
172  * @param f_sigma Multiplicative correction factor to be applied to diam(i,j)
173  */
174  void makePolarCorrections(size_t i, size_t j, doublereal& f_eps,
175  doublereal& f_sigma);
176
177  //! Generate polynomial fits to collision integrals
178  /*!
179  * @param integrals interpolator for the collision integrals
180  */
181  void fitCollisionIntegrals(MMCollisionInt& integrals);
182
183  //! Generate polynomial fits to the viscosity, conductivity, and
184  //! the binary diffusion coefficients
185  /*!
186  * If CK_mode, then the fits are of the form
187  * \f[
188  * \log(\eta(i)) = \sum_{n = 0}^3 a_n(i) (\log T)^n
189  * \f]
190  * and
191  * \f[
192  * \log(D(i,j)) = \sum_{n = 0}^3 a_n(i,j) (\log T)^n
193  * \f]
194  * Otherwise the fits are of the form
195  * \f[
196  * \eta(i)/sqrt(k_BT) = \sum_{n = 0}^4 a_n(i) (\log T)^n
197  * \f]
198  * and
199  * \f[
200  * D(i,j)/sqrt(k_BT)) = \sum_{n = 0}^4 a_n(i,j) (\log T)^n
201  * \f]
202  *
203  * @param integrals interpolator for the collision integrals
204  */
205  void fitProperties(MMCollisionInt& integrals);
206
207  //! Second-order correction to the binary diffusion coefficients
208  /*!
209  * Calculate second-order corrections to binary diffusion coefficient pair
210  * (dkj, djk). At first order, the binary diffusion coefficients are
211  * independent of composition, and d(k,j) = d(j,k). But at second order,
212  * there is a weak dependence on composition, with the result that d(k,j) !=
213  * d(j,k). This method computes the multiplier by which the first-order
214  * binary diffusion coefficient should be multiplied to produce the value
215  * correct to second order. The expressions here are taken from Marerro and
216  * Mason, J. Phys. Chem. Ref. Data, vol. 1, p. 3 (1972).
217  *
218  * @param t Temperature (K)
219  * @param integrals interpolator for the collision integrals
220  * @param k index of first species
221  * @param j index of second species
222  * @param xk Mole fraction of species k
223  * @param xj Mole fraction of species j
224  * @param fkj multiplier for d(k,j)
225  * @param fjk multiplier for d(j,k)
226  *
227  * @note This method is not used currently.
228  */
229  void getBinDiffCorrection(doublereal t, MMCollisionInt& integrals, size_t k,
230  size_t j, doublereal xk, doublereal xj,
231  doublereal& fkj, doublereal& fjk);
232
233  //! @}
234
235  //! Vector of species mole fractions. These are processed so that all mole
236  //! fractions are >= *Tiny*. Length = m_kk.
238
239  //! Internal storage for the viscosity of the mixture (kg /m /s)
240  doublereal m_viscmix;
241
242  //! Update boolean for mixture rule for the mixture viscosity
243  bool m_visc_ok;
244
245  //! Update boolean for the weighting factors for the mixture viscosity
247
248  //! Update boolean for the species viscosities
250
251  //! Update boolean for the binary diffusivities at unit pressure
253
254  //! Type of the polynomial fits to temperature. CK_Mode means Chemkin mode.
255  //! Currently CA_Mode is used which are different types of fits to temperature.
256  int m_mode;
257
258  //! m_phi is a Viscosity Weighting Function. size = m_nsp * n_nsp
260
261  //! work space length = m_kk
263
264  //! vector of species viscosities (kg /m /s). These are used in Wilke's
265  //! rule to calculate the viscosity of the solution. length = m_kk.
267
268  //! Polynomial fits to the viscosity of each species. m_visccoeffs[k] is
269  //! the vector of polynomial coefficients for species k that fits the
270  //! viscosity as a function of temperature.
271  std::vector<vector_fp> m_visccoeffs;
272
273  //! Local copy of the species molecular weights.
275
276  //! Holds square roots of molecular weight ratios
277  /*!
278  * @code
279  * m_wratjk(j,k) = sqrt(mw[j]/mw[k]) j < k
280  * m_wratjk(k,j) = sqrt(sqrt(mw[j]/mw[k])) j < k
281  * @endcode
282  */
284
285  //! Holds square roots of molecular weight ratios
286  /*!
287  * m_wratjk1(j,k) = sqrt(1.0 + mw[k]/mw[j]) j < k
288  */
290
291  //! vector of square root of species viscosities sqrt(kg /m /s). These are
292  //! used in Wilke's rule to calculate the viscosity of the solution.
293  //! length = m_kk.
295
296  //! Powers of the ln temperature, up to fourth order
298
299  //! Current value of the temperature at which the properties in this object
300  //! are calculated (Kelvin).
301  doublereal m_temp;
302
303  //! Current value of Boltzmann constant times the temperature (Joules)
304  doublereal m_kbt;
305
306  //! current value of Boltzmann constant times the temperature.
307  //! (Joules) to 1/2 power
308  doublereal m_sqrt_kbt;
309
310  //! current value of temperature to 1/2 power
311  doublereal m_sqrt_t;
312
313  //! Current value of the log of the temperature
314  doublereal m_logt;
315
316  //! Current value of temperature to 1/4 power
317  doublereal m_t14;
318
319  //! Current value of temperature to the 3/2 power
320  doublereal m_t32;
321
322  //! Polynomial fits to the binary diffusivity of each species
323  /*!
324  * m_diffcoeff[ic] is vector of polynomial coefficients for species i
325  * species j that fits the binary diffusion coefficient. The relationship
326  * between i j and ic is determined from the following algorithm:
327  *
328  * int ic = 0;
329  * for (i = 0; i < m_nsp; i++) {
330  * for (j = i; j < m_nsp; j++) {
331  * ic++;
332  * }
333  * }
334  */
335  std::vector<vector_fp> m_diffcoeffs;
336
337  //! Matrix of binary diffusion coefficients at the reference pressure and
338  //! the current temperature Size is nsp x nsp.
340
341  //! temperature fits of the heat conduction
342  /*!
343  * Dimensions are number of species (nsp) polynomial order of the collision
344  * integral fit (degree+1).
345  */
346  std::vector<vector_fp> m_condcoeffs;
347
348  //! Indices for the (i,j) interaction in collision integral fits
349  /*!
350  * m_poly[i][j] contains the index for (i,j) interactions in
351  * #m_omega22_poly, #m_astar_poly, #m_bstar_poly, and #m_cstar_poly.
352  */
353  std::vector<vector_int> m_poly;
354
355  //! Fit for omega22 collision integral
356  /*!
357  * m_omega22_poly[m_poly[i][j]] is the vector of polynomial coefficients
358  * (length degree+1) for the collision integral fit for the species pair
359  * (i,j).
360  */
361  std::vector<vector_fp> m_omega22_poly;
362
363  //! Fit for astar collision integral
364  /*!
365  * m_astar_poly[m_poly[i][j]] is the vector of polynomial coefficients
366  * (length degree+1) for the collision integral fit for the species pair
367  * (i,j).
368  */
369  std::vector<vector_fp> m_astar_poly;
370
371  //! Fit for bstar collision integral
372  /*!
373  * m_bstar_poly[m_poly[i][j]] is the vector of polynomial coefficients
374  * (length degree+1) for the collision integral fit for the species pair
375  * (i,j).
376  */
377  std::vector<vector_fp> m_bstar_poly;
378
379  //! Fit for cstar collision integral
380  /*!
381  * m_bstar_poly[m_poly[i][j]] is the vector of polynomial coefficients
382  * (length degree+1) for the collision integral fit for the species pair
383  * (i,j).
384  */
385  std::vector<vector_fp> m_cstar_poly;
386
387  //! Rotational relaxation number for each species
388  /*!
389  * length is the number of species in the phase. units are dimensionless
390  */
392
393  //! Dimensionless rotational heat capacity of each species
394  /*!
395  * These values are 0, 1 and 1.5 for single-molecule, linear, and nonlinear
396  * species respectively length is the number of species in the phase.
397  * Dimensionless (Cr / R)
398  */
400
401  //! Vector of booleans indicating whether a species is a polar molecule
402  /*!
403  * Length is nsp
404  */
405  std::vector<bool> m_polar;
406
407  //! Polarizability of each species in the phase
408  /*!
409  * Length = nsp. Units = m^3
410  */
412
413  //! Lennard-Jones well-depth of the species in the current phase
414  /*!
415  * length is the number of species in the phase. Units are Joules (Note this
416  * is not Joules/kmol) (note, no kmol -> this is a per molecule amount)
417  */
419
420  //! Lennard-Jones diameter of the species in the current phase
421  /*!
422  * length is the number of species in the phase
423  * units are in meters.
424  */
426
427  //! This is the reduced mass of the interaction between species i and j
428  /*!
429  * reducedMass(i,j) = mw[i] * mw[j] / (Avogadro * (mw[i] + mw[j]));
430  *
431  * Units are kg (note, no kmol -> this is a per molecule amount)
432  *
433  * Length nsp * nsp. This is a symmetric matrix
434  */
436
437  //! hard-sphere diameter for (i,j) collision
438  /*!
439  * diam(i,j) = 0.5*(sigma[i] + sigma[j]);
440  * Units are m (note, no kmol -> this is a per molecule amount)
441  *
442  * Length nsp * nsp. This is a symmetric matrix.
443  */
445
446  //! The effective well depth for (i,j) collisions
447  /*!
448  * epsilon(i,j) = sqrt(eps[i]*eps[j]);
449  * Units are Joules (note, no kmol -> this is a per molecule amount)
450  *
451  * Length nsp * nsp. This is a symmetric matrix.
452  */
454
455  //! The effective dipole moment for (i,j) collisions
456  /*!
457  * Given dipoleMoment in Debye (a Debye is 3.335e-30 C-m):
458  *
459  * dipole(i,i) = 1.e-21 / lightSpeed * dipoleMoment;
460  * dipole(i,j) = sqrt(dipole(i,i) * dipole(j,j));
461  * (note, no kmol -> this is a per molecule amount)
462  *
463  * Length nsp * nsp. This is a symmetric matrix.
464  */
466
467  //! Reduced dipole moment of the interaction between two species
468  /*!
469  * This is the reduced dipole moment of the interaction between two species
470  * 0.5 * dipole(i,j)^2 / (4 * Pi * epsilon_0 * epsilon(i,j) * d^3);
471  *
472  * Length nsp * nsp .This is a symmetric matrix
473  */
475
476  //! Pitzer acentric factor
477  /*!
478  * Length is the number of species in the phase. Dimensionless.
479  */
481
482  //! Level of verbose printing during initialization
484 };
485
486 } // namespace Cantera
487
488 #endif
Update the pure-species viscosities.
void fitProperties(MMCollisionInt &integrals)
Generate polynomial fits to the viscosity, conductivity, and the binary diffusion coefficients...
DenseMatrix m_dipole
The effective dipole moment for (i,j) collisions.
Definition: GasTransport.h:465
bool m_visc_ok
Update boolean for mixture rule for the mixture viscosity.
Definition: GasTransport.h:243
std::vector< bool > m_polar
Vector of booleans indicating whether a species is a polar molecule.
Definition: GasTransport.h:405
std::vector< vector_fp > m_diffcoeffs
Polynomial fits to the binary diffusivity of each species.
Definition: GasTransport.h:335
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal *const d)
Returns the matrix of binary diffusion coefficients.
Headers for the Transport object, which is the virtual base class for all transport property evaluato...
bool m_bindiff_ok
Update boolean for the binary diffusivities at unit pressure.
Definition: GasTransport.h:252
Base class for transport property managers.
DenseMatrix m_wratjk
Holds square roots of molecular weight ratios.
Definition: GasTransport.h:283
DenseMatrix m_bdiff
Matrix of binary diffusion coefficients at the reference pressure and the current temperature Size is...
Definition: GasTransport.h:339
doublereal m_temp
Current value of the temperature at which the properties in this object are calculated (Kelvin)...
Definition: GasTransport.h:301
std::vector< vector_fp > m_cstar_poly
Fit for cstar collision integral.
Definition: GasTransport.h:385
virtual void updateViscosity_T()
Update the temperature-dependent viscosity terms.
void setupMM()
Prepare to build a new kinetic-theory-based transport manager for low-density gases.
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:97
int m_mode
Type of the polynomial fits to temperature.
Definition: GasTransport.h:256
std::vector< vector_fp > m_omega22_poly
Fit for omega22 collision integral.
Definition: GasTransport.h:361
doublereal m_sqrt_kbt
current value of Boltzmann constant times the temperature.
Definition: GasTransport.h:308
virtual void updateDiff_T()
Update the binary diffusion coefficients.
virtual void init(thermo_t *thermo, int mode=0, int log_level=0)
Initialize a transport manager.
vector_fp m_visc
vector of species viscosities (kg /m /s).
Definition: GasTransport.h:266
vector_fp m_spwork
work space length = m_kk
Definition: GasTransport.h:262
virtual void getMixDiffCoeffs(doublereal *const d)
Returns the Mixture-averaged diffusion coefficients [m^2/s].
std::vector< vector_fp > m_bstar_poly
Fit for bstar collision integral.
Definition: GasTransport.h:377
vector_fp m_sigma
Lennard-Jones diameter of the species in the current phase.
Definition: GasTransport.h:425
std::vector< vector_fp > m_astar_poly
Fit for astar collision integral.
Definition: GasTransport.h:369
vector_fp m_eps
Lennard-Jones well-depth of the species in the current phase.
Definition: GasTransport.h:418
vector_fp m_polytempvec
Powers of the ln temperature, up to fourth order.
Definition: GasTransport.h:297
bool m_spvisc_ok
Update boolean for the species viscosities.
Definition: GasTransport.h:249
virtual void getMixDiffCoeffsMole(doublereal *const d)
Returns the mixture-averaged diffusion coefficients [m^2/s].
std::vector< vector_int > m_poly
Indices for the (i,j) interaction in collision integral fits.
Definition: GasTransport.h:353
bool m_viscwt_ok
Update boolean for the weighting factors for the mixture viscosity.
Definition: GasTransport.h:246
DenseMatrix m_phi
m_phi is a Viscosity Weighting Function. size = m_nsp * n_nsp
Definition: GasTransport.h:259
virtual void getSpeciesViscosities(doublereal *const visc)
Get the pure-species viscosities.
Definition: GasTransport.h:48
doublereal m_t14
Current value of temperature to 1/4 power.
Definition: GasTransport.h:317
virtual void getMixDiffCoeffsMass(doublereal *const d)
Returns the mixture-averaged diffusion coefficients [m^2/s].
thermo_t & thermo()
DenseMatrix m_reducedMass
This is the reduced mass of the interaction between species i and j.
Definition: GasTransport.h:435
void fitCollisionIntegrals(MMCollisionInt &integrals)
Generate polynomial fits to collision integrals.
vector_fp m_zrot
Rotational relaxation number for each species.
Definition: GasTransport.h:391
void getBinDiffCorrection(doublereal t, MMCollisionInt &integrals, size_t k, size_t j, doublereal xk, doublereal xj, doublereal &fkj, doublereal &fjk)
Second-order correction to the binary diffusion coefficients.
vector_fp m_sqvisc
vector of square root of species viscosities sqrt(kg /m /s).
Definition: GasTransport.h:294
DenseMatrix m_epsilon
The effective well depth for (i,j) collisions.
Definition: GasTransport.h:453
vector_fp m_crot
Dimensionless rotational heat capacity of each species.
Definition: GasTransport.h:399
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
vector_fp m_w_ac
Pitzer acentric factor.
Definition: GasTransport.h:480
doublereal m_sqrt_t
current value of temperature to 1/2 power
Definition: GasTransport.h:311
DenseMatrix m_diam
hard-sphere diameter for (i,j) collision
Definition: GasTransport.h:444
Headers for the DenseMatrix object, which deals with dense rectangular matrices and description of th...
doublereal m_logt
Current value of the log of the temperature.
Definition: GasTransport.h:314
DenseMatrix m_wratkj1
Holds square roots of molecular weight ratios.
Definition: GasTransport.h:289
void getTransportData()
void makePolarCorrections(size_t i, size_t j, doublereal &f_eps, doublereal &f_sigma)
Corrections for polar-nonpolar binary diffusion coefficients.
Calculation of Collision integrals.
DenseMatrix m_delta
Reduced dipole moment of the interaction between two species.
Definition: GasTransport.h:474
doublereal m_viscmix
Internal storage for the viscosity of the mixture (kg /m /s)
Definition: GasTransport.h:240
std::vector< vector_fp > m_condcoeffs
temperature fits of the heat conduction
Definition: GasTransport.h:346
doublereal m_kbt
Current value of Boltzmann constant times the temperature (Joules)
Definition: GasTransport.h:304
doublereal m_t32
Current value of temperature to the 3/2 power.
Definition: GasTransport.h:320
virtual doublereal viscosity()
Viscosity of the mixture (kg /m /s)
std::vector< vector_fp > m_visccoeffs
Polynomial fits to the viscosity of each species.
Definition: GasTransport.h:271
int m_log_level
Level of verbose printing during initialization.
Definition: GasTransport.h:483
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
Definition: DenseMatrix.h:71
vector_fp m_molefracs
Vector of species mole fractions.
Definition: GasTransport.h:237
Class GasTransport implements some functions and properties that are shared by the MixTransport and M...
Definition: GasTransport.h:19
vector_fp m_alpha
Polarizability of each species in the phase.
Definition: GasTransport.h:411
vector_fp m_mw
Local copy of the species molecular weights.
Definition: GasTransport.h:274