Cantera  2.1.2
PecosTransport.h
Go to the documentation of this file.
1 /**
2  * @file PecosTransport.h
3  * Header file defining class PecosTransport
4  */
5
6 // Copyright 2001 California Institute of Technology
7
8 #ifndef CT_PECOSTRAN_H
9 #define CT_PECOSTRAN_H
10
11 #include "TransportBase.h"
13
14 namespace Cantera
15 {
16
17 class GasTransportParams;
18
19 /**
20  * Class PecosTransport implements mixture-averaged transport
21  * properties for ideal gas mixtures.
22  */
23 class PecosTransport : public Transport
24 {
25
26 public:
27  virtual int model() const {
28  return cPecosTransport;
29  }
30
31  //! Viscosity of the mixture
32  /*!
33  * The viscosity is computed using the Wilke mixture rule.
34  * \f[
35  * \mu = \sum_k \frac{\mu_k X_k}{\sum_j \Phi_{k,j} X_j}.
36  * \f]
37  * Here \f$\mu_k \f$ is the viscosity of pure species \e k,
38  * and
39  * \f[
40  * \Phi_{k,j} = \frac{\left[1
41  * + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_k}}\right)}\right]^2}
42  * {\sqrt{8}\sqrt{1 + M_k/M_j}}
43  * \f]
44  * @see updateViscosity_T();
45  */
46  virtual doublereal viscosity();
47
48  virtual void getSpeciesViscosities(doublereal* const visc) {
49  update_T();
51  copy(m_visc.begin(), m_visc.end(), visc);
52  }
53
54  //! Return the thermal diffusion coefficients
55  /*!
56  * For this approximation, these are all zero.
57  */
58  virtual void getThermalDiffCoeffs(doublereal* const dt);
59
60  //! Returns the mixture thermal conductivity
61  /*!
62  * This is computed using the lumped model,
63  * \f[
64  * k = k^{tr} + k^{ve}
65  * \f]
66  * where,
67  * \f[
68  * k^{tr}= 5/2 \mu_s C_{v,s}^{trans} + \mu_s C_{v,s}^{rot}
69  * \f]
70  * and,
71  * \f[
72  * k^{ve}= \mu_s C_{v,s}^{vib} + \mu_s C_{v,s}^{elec}
73  * \f]
74  *
75  * The thermal conductivity is computed using the Wilke mixture rule.
76  * \f[
77  * k = \sum_s \frac{k_s X_s}{\sum_j \Phi_{s,j} X_j}.
78  * \f]
79  * Here \f$k_s \f$ is the conductivity of pure species \e s,
80  * and
81  * \f[
82  * \Phi_{s,j} = \frac{\left[1
83  * + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_s}}\right)}\right]^2}
84  * {\sqrt{8}\sqrt{1 + M_s/M_j}}
85  * \f]
86  * @see updateCond_T();
87  * @todo Reconcile these these formulas with the implementation
88  */
89  virtual doublereal thermalConductivity();
90
91  //! binary diffusion coefficients
92  /*!
93  * Using Ramshaw's self-consistent Effective Binary Diffusion
94  * (1990, J. Non-Equilib. Thermo)
95  */
96  virtual void getBinaryDiffCoeffs(const size_t ld, doublereal* const d);
97
98  //! Mixture-averaged diffusion coefficients [m^2/s].
99  /*!
100  * For the single species case or the pure fluid case the routine returns
101  * the self-diffusion coefficient. This is need to avoid a NaN result.
102  */
103  virtual void getMixDiffCoeffs(doublereal* const d);
104
105  //! Returns the mixture-averaged diffusion coefficients [m^2/s].
106  //! These are the coefficients for calculating the molar diffusive fluxes
107  //! from the species mole fraction gradients, computed according to
108  //! Eq. 12.176 in "Chemically Reacting Flow":
109  //!
110  //! \f[ D_{km}^* = \frac{1-X_k}{\sum_{j \ne k}^K X_j/\mathcal{D}_{kj}} \f]
111  //!
112  //! @param[out] d vector of mixture-averaged diffusion coefficients for
113  //! each species, length m_nsp.
114  void getMixDiffCoeffsMole(doublereal* const d);
115
116  //! Returns the mixture-averaged diffusion coefficients [m^2/s].
117  //! These are the coefficients for calculating the diffusive mass fluxes
118  //! from the species mass fraction gradients, computed according to
119  //! Eq. 12.178 in "Chemically Reacting Flow":
120  //!
121  //! \f[ \frac{1}{D_{km}} = \sum_{j \ne k}^K \frac{X_j}{\mathcal{D}_{kj}} +
122  //! \frac{X_k}{1-Y_k} \sum_{j \ne k}^K \frac{Y_j}{\mathcal{D}_{kj}} \f]
123  //!
124  //! @param[out] d vector of mixture-averaged diffusion coefficients for
125  //! each species, length m_nsp.
126  void getMixDiffCoeffsMass(doublereal* const d);
127
128  virtual void getMobilities(doublereal* const mobil);
129  virtual void update_T();
130
131  /**
132  * This is called the first time any transport property is requested from
133  * Mixture after the concentrations have changed.
134  */
135  virtual void update_C();
136
137  //! Get the species diffusive mass fluxes wrt to the mass averaged
138  //! velocity, given the gradients in mole fraction and temperature
139  /*!
140  * The diffusive mass flux of species \e k is computed from
141  * \f[
142  * \vec{j}_k = -n M_k D_k \nabla X_k + \frac{\rho_k}{\rho} \sum_r n M_r D_r \nabla X_r
143  * \f]
144  * This neglects pressure, forced and thermal diffusion.
145  * Units for the returned fluxes are kg m-2 s-1.
146  *
147  * @param ndim Number of dimensions in the flux expressions
149  * (length = ndim)
151  * (usually equal to m_nsp but not always)
153  * Flat vector with the m_nsp in the inner loop.
154  * length = ldx * ndim
155  * @param ldf Leading dimension of the fluxes array
156  * (usually equal to m_nsp but not always)
157  * @param fluxes Output of the diffusive mass fluxes
158  * Flat vector with the m_nsp in the inner loop.
159  * length = ldx * ndim
160  */
161  virtual void getSpeciesFluxes(size_t ndim,
163  size_t ldx,
165  size_t ldf, doublereal* const fluxes);
166
167  //! Initialize the transport object
168  /*!
169  * Here we change all of the internal dimensions to be sufficient.
170  * We get the object ready to do property evaluations.
171  *
172  * @param tr Transport parameters for all of the species in the phase.
173  */
174  virtual bool initGas(GasTransportParams& tr);
175
176  /**
177  * Reads the transport table specified (currently defaults to internal file)
178  *
179  * Reads the user-specified transport table, appending new species
180  * data and/or replacing default species data.
181  */
183
184  friend class TransportFactory;
185
186 protected:
187  PecosTransport();
188
189 private:
190
191  //! Calculate the pressure from the ideal gas law
192  doublereal pressure_ig() const {
193  return (m_thermo->molarDensity() * GasConstant *
194  m_thermo->temperature());
195  }
196
197  // mixture attributes
198  int m_nsp;
199  vector_fp m_mw;
200
201  // polynomial fits
202  std::vector<vector_fp> m_visccoeffs;
203  std::vector<vector_fp> m_condcoeffs;
204  std::vector<vector_fp> m_diffcoeffs;
205  vector_fp m_polytempvec;
206
207  // blottner fits
208  //int species = 20;
209  double a[500], b[500], c[500];
210
211  // property values
212  DenseMatrix m_bdiff;
213  vector_fp m_visc;
214  vector_fp m_sqvisc;
215  vector_fp m_cond;
216
217  vector_fp m_molefracs;
218
219  std::vector<std::vector<int> > m_poly;
220  std::vector<vector_fp> m_astar_poly;
221  std::vector<vector_fp> m_bstar_poly;
222  std::vector<vector_fp> m_cstar_poly;
223  std::vector<vector_fp> m_om22_poly;
224  DenseMatrix m_astar;
225  DenseMatrix m_bstar;
226  DenseMatrix m_cstar;
227  DenseMatrix m_om22;
228
229  DenseMatrix m_phi; // viscosity weighting functions
230  DenseMatrix m_wratjk, m_wratkj1;
231
232  vector_fp m_zrot;
233  vector_fp m_crot;
234  vector_fp m_cinternal;
235  vector_fp m_eps;
236  vector_fp m_alpha;
237  vector_fp m_dipoleDiag;
238
239  doublereal m_temp, m_logt, m_kbt, m_t14, m_t32;
240  doublereal m_sqrt_kbt, m_sqrt_t;
241
242  vector_fp m_sqrt_eps_k;
243  DenseMatrix m_log_eps_k;
244  vector_fp m_frot_298;
245  vector_fp m_rotrelax;
246
247  doublereal m_lambda;
248  doublereal m_viscmix;
249
250  // work space
251  vector_fp m_spwork;
252
253  void updateThermal_T();
254
255  /**
256  * Update the temperature-dependent viscosity terms. Updates the array of
257  * pure species viscosities, and the weighting functions in the viscosity
258  * mixture rule. The flag m_visc_ok is set to true.
259  */
260  void updateViscosity_T();
261
262  /**
263  * Update the temperature-dependent parts of the mixture-averaged
264  * thermal conductivity.
265  *
266  * Calculated as,
267  * \f[
268  * k= \mu_s (5/2 * C_{v,s}^{trans} + C_{v,s}^{rot} + C_{v,s}^{vib}
269  * \f]
270  */
271  void updateCond_T();
272
273  /**
274  * Update the pure-species viscosities. (Pa-s) = (kg/m/sec)
275  *
276  * Using Blottner fit for viscosity. Defines kinematic viscosity
277  * of the form
278  * \f[
279  * \mu_s\left(T\right) = 0.10 \exp\left(A_s\left(\log T\right)^2 + B_s\log T + C_s\right)
280  * \f]
281  * where \f$A_s \f$, \f$B_s \f$, and \f$C_s \f$ are constants.
282  */
284
285  /**
286  * Update the binary diffusion coefficients. These are evaluated
287  * from the polynomial fits at unit pressure (1 Pa).
288  */
289  void updateDiff_T();
290  void correctBinDiffCoeffs();
291  bool m_viscmix_ok;
292  bool m_viscwt_ok;
293  bool m_spvisc_ok;
294  bool m_diffmix_ok;
295  bool m_bindiff_ok;
296  bool m_abc_ok;
297  bool m_spcond_ok;
298  bool m_condmix_ok;
299
300  int m_mode;
301
302  DenseMatrix m_epsilon;
303  DenseMatrix m_diam;
304  DenseMatrix incl;
305  bool m_debug;
306
307  // specific heats
308  vector_fp cv_rot;
309  vector_fp cp_R;
310  vector_fp cv_int;
311
312 };
313 }
314 #endif
Class PecosTransport implements mixture-averaged transport properties for ideal gas mixtures...
virtual doublereal thermalConductivity()
Returns the mixture thermal conductivity.
This structure holds transport model parameters relevant to transport in ideal gases with a kinetic t...
virtual void getThermalDiffCoeffs(doublereal *const dt)
Return the thermal diffusion coefficients.
Factory class for creating new instances of classes derived from Transport.
virtual void getSpeciesViscosities(doublereal *const visc)
Returns the pure species viscosities.
Headers for the Transport object, which is the virtual base class for all transport property evaluato...
thermo_t * m_thermo
pointer to the object representing the phase
Base class for transport property managers.
virtual doublereal viscosity()
Viscosity of the mixture.
doublereal molarDensity() const
Molar density (kmol/m^3).
Definition: Phase.cpp:597
Reads the transport table specified (currently defaults to internal file)
virtual int model() const
Transport model.
virtual void update_C()
This is called the first time any transport property is requested from Mixture after the concentratio...
virtual void getMixDiffCoeffs(doublereal *const d)
Mixture-averaged diffusion coefficients [m^2/s].
void getMixDiffCoeffsMass(doublereal *const d)
Returns the mixture-averaged diffusion coefficients [m^2/s].
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 ...
virtual void getMobilities(doublereal *const mobil)
Get the Electrical mobilities (m^2/V/s).
void updateDiff_T()
Update the binary diffusion coefficients.
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal *const d)
binary diffusion coefficients
Update the pure-species viscosities.
doublereal pressure_ig() const
Calculate the pressure from the ideal gas law.
void updateCond_T()
Update the temperature-dependent parts of the mixture-averaged thermal conductivity.
doublereal temperature() const
Temperature (K).
Definition: Phase.h:528
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...
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:66
void updateViscosity_T()
Update the temperature-dependent viscosity terms.
void getMixDiffCoeffsMole(doublereal *const d)
Returns the mixture-averaged diffusion coefficients [m^2/s].
virtual bool initGas(GasTransportParams &tr)
Initialize the transport object.
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
Definition: DenseMatrix.h:70