Cantera  2.3.0
MultiTransport.h
Go to the documentation of this file.
1 /**
2  * @file MultiTransport.h
3  * Interface for class MultiTransport
4  */
5 
6 // This file is part of Cantera. See License.txt in the top-level directory or
7 // at http://www.cantera.org/license.txt for license and copyright information.
8 
9 #ifndef CT_MULTITRAN_H
10 #define CT_MULTITRAN_H
11 
12 // Cantera includes
13 #include "GasTransport.h"
14 
15 namespace Cantera
16 {
17 //! Class MultiTransport implements multicomponent transport properties for
18 //! ideal gas mixtures.
19 /*!
20  * The implementation generally follows the procedure outlined in: R. J. Kee, M.
21  * J. Coltrin, and P. Glarborg, "Chemically Reacting Flow: Theory & Practice",
22  * John Wiley & Sons, 2003.
23  *
24  * @ingroup tranprops
25  */
27 {
28 public:
29  //! default constructor
30  /*!
31  * @param thermo Optional parameter for the pointer to the ThermoPhase object
32  */
34 
35  virtual int model() const {
36  warn_deprecated("MultiTransport::model",
37  "To be removed after Cantera 2.3.");
38  if (m_mode == CK_Mode) {
39  return CK_Multicomponent;
40  } else {
41  return cMulticomponent;
42  }
43  }
44 
45  virtual std::string transportType() const {
46  return "Multi";
47  }
48 
49  //! Return the thermal diffusion coefficients (kg/m/s)
50  /*!
51  * Eqn. (12.126) displays how they are calculated. The reference work is
52  * from Dixon-Lewis.
53  *
54  * Eqns. (12.168) shows how they are used in an expression for the species
55  * flux.
56  *
57  * @param dt Vector of thermal diffusion coefficients. Units = kg/m/s
58  */
59  virtual void getThermalDiffCoeffs(doublereal* const dt);
60 
61  virtual doublereal thermalConductivity();
62 
63  virtual void getMultiDiffCoeffs(const size_t ld, doublereal* const d);
64 
65  //! Get the species diffusive mass fluxes wrt to the mass averaged velocity,
66  //! given the gradients in mole fraction and temperature
67  /*!
68  * Units for the returned fluxes are kg m-2 s-1.
69  *
70  * @param ndim Number of dimensions in the flux expressions
71  * @param grad_T Gradient of the temperature (length = ndim)
72  * @param ldx Leading dimension of the grad_X array. (usually equal to
73  * m_nsp but not always)
74  * @param grad_X Gradients of the mole fraction. Flat vector with the
75  * m_nsp in the inner loop. length = ldx * ndim
76  * @param ldf Leading dimension of the fluxes array. (usually equal to
77  * m_nsp but not always)
78  * @param fluxes Output of the diffusive mass fluxes. Flat vector with the
79  * m_nsp in the inner loop. length = ldx * ndim
80  */
81  virtual void getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
82  size_t ldx, const doublereal* const grad_X,
83  size_t ldf, doublereal* const fluxes);
84 
85  //! Get the molar diffusional fluxes [kmol/m^2/s] of the species, given the
86  //! thermodynamic state at two nearby points.
87  /*!
88  * The molar diffusional fluxes are calculated with reference to the mass
89  * averaged velocity. This is a one-dimensional vector
90  *
91  * @param state1 Array of temperature, density, and mass
92  * fractions for state 1.
93  * @param state2 Array of temperature, density, and mass
94  * fractions for state 2.
95  * @param delta Distance from state 1 to state 2 (m).
96  * @param fluxes Output molar fluxes of the species. (length = m_nsp)
97  */
98  virtual void getMolarFluxes(const doublereal* const state1,
99  const doublereal* const state2,
100  const doublereal delta,
101  doublereal* const fluxes);
102 
103  //! Get the mass diffusional fluxes [kg/m^2/s] of the species, given the
104  //! thermodynamic state at two nearby points.
105  /*!
106  * The specific diffusional fluxes are calculated with reference to the
107  * mass averaged velocity. This is a one-dimensional vector
108  *
109  * @param state1 Array of temperature, density, and mass
110  * fractions for state 1.
111  * @param state2 Array of temperature, density, and mass
112  * fractions for state 2.
113  * @param delta Distance from state 1 to state 2 (m).
114  * @param fluxes Output mass fluxes of the species. (length = m_nsp)
115  */
116  virtual void getMassFluxes(const doublereal* state1,
117  const doublereal* state2, doublereal delta,
118  doublereal* fluxes);
119 
120  virtual void init(ThermoPhase* thermo, int mode=0, int log_level=0);
121 
122 protected:
123  //! Update basic temperature-dependent quantities if the temperature has
124  //! changed.
125  void update_T();
126 
127  //! Update basic concentration-dependent quantities if the concentrations
128  //! have changed.
129  void update_C();
130 
131  //! Update the temperature-dependent terms needed to compute the thermal
132  //! conductivity and thermal diffusion coefficients.
133  void updateThermal_T();
134 
135  doublereal m_thermal_tlast;
136 
137  //! Dense matrix for astar
139 
140  //! Dense matrix for bstar
142 
143  //! Dense matrix for cstar
145 
146  //! Dense matrix for omega22
148 
149  vector_fp m_cinternal;
150 
151  vector_fp m_sqrt_eps_k;
152  DenseMatrix m_log_eps_k;
153  vector_fp m_frot_298;
154  vector_fp m_rotrelax;
155 
156  doublereal m_lambda;
157 
158  // L matrix quantities
159  DenseMatrix m_Lmatrix;
160  DenseMatrix m_aa;
161  vector_fp m_a;
162  vector_fp m_b;
163 
164  // work space
165  vector_fp m_spwork1, m_spwork2, m_spwork3;
166 
167  //! Mole fraction vector from last L-matrix evaluation
169 
170  void correctBinDiffCoeffs();
171 
172  //! Boolean indicating viscosity is up to date
173  bool m_abc_ok;
174  bool m_l0000_ok;
175  bool m_lmatrix_soln_ok;
176 
177  //! Evaluate the L0000 matrices
178  /*!
179  * Evaluate the upper-left block of the L matrix.
180  * @param x vector of species mole fractions
181  */
182  void eval_L0000(const doublereal* const x);
183 
184  //! Evaluate the L0010 matrices
185  /*!
186  * @param x vector of species mole fractions
187  */
188  void eval_L0010(const doublereal* const x);
189 
190  //! Evaluate the L1000 matrices
191  void eval_L1000();
192 
193  void eval_L0100();
194  void eval_L0001();
195  void eval_L1010(const doublereal* x);
196  void eval_L1001(const doublereal* x);
197  void eval_L0110();
198  void eval_L0101(const doublereal* x);
199  bool hasInternalModes(size_t j);
200 
201  doublereal pressure_ig() {
203  }
204 
205  virtual void solveLMatrixEquation();
206  DenseMatrix incl;
207  bool m_debug;
208 };
209 }
210 #endif
virtual doublereal thermalConductivity()
Returns the mixture thermal conductivity in W/m/K.
void eval_L1000()
Evaluate the L1000 matrices.
DenseMatrix m_bstar
Dense matrix for bstar.
virtual void getThermalDiffCoeffs(doublereal *const dt)
Return the thermal diffusion coefficients (kg/m/s)
doublereal temperature() const
Temperature (K).
Definition: Phase.h:601
DenseMatrix m_astar
Dense matrix for astar.
virtual void getMassFluxes(const doublereal *state1, const doublereal *state2, doublereal delta, doublereal *fluxes)
Get the mass diffusional fluxes [kg/m^2/s] of the species, given the thermodynamic state at two nearb...
thermo_t * m_thermo
pointer to the object representing the phase
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
DenseMatrix m_cstar
Dense matrix for cstar.
void update_T()
Update basic temperature-dependent quantities if the temperature has changed.
virtual int model() const
Transport model.
MultiTransport(thermo_t *thermo=0)
default constructor
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:93
int m_mode
Type of the polynomial fits to temperature.
Definition: GasTransport.h:259
virtual void init(ThermoPhase *thermo, int mode=0, int log_level=0)
Initialize a transport manager.
doublereal molarDensity() const
Molar density (kmol/m^3).
Definition: Phase.cpp:666
vector_fp m_molefracs_last
Mole fraction vector from last L-matrix evaluation.
virtual std::string transportType() const
Identifies the Transport object type.
virtual void getMolarFluxes(const doublereal *const state1, const doublereal *const state2, const doublereal delta, doublereal *const fluxes)
Get the molar diffusional fluxes [kmol/m^2/s] of the species, given the thermodynamic state at two ne...
void eval_L0000(const doublereal *const x)
Evaluate the L0000 matrices.
virtual void getMultiDiffCoeffs(const size_t ld, doublereal *const d)
Return the Multicomponent diffusion coefficients. Units: [m^2/s].
void updateThermal_T()
Update the temperature-dependent terms needed to compute the thermal conductivity and thermal diffusi...
thermo_t & thermo()
Class MultiTransport implements multicomponent transport properties for ideal gas mixtures...
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
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:64
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 ...
bool m_abc_ok
Boolean indicating viscosity is up to date.
void eval_L0010(const doublereal *const x)
Evaluate the L0010 matrices.
Namespace for the Cantera kernel.
Definition: application.cpp:29
DenseMatrix m_om22
Dense matrix for omega22.
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
Definition: DenseMatrix.h:72
Class GasTransport implements some functions and properties that are shared by the MixTransport and M...
Definition: GasTransport.h:22
void update_C()
Update basic concentration-dependent quantities if the concentrations have changed.