Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MultiTransport.h
Go to the documentation of this file.
1 /**
2  * @file MultiTransport.h
3  * Interface for class MultiTransport
4  */
5 
6 // Copyright 2001 California Institute of Technology
7 
8 #ifndef CT_MULTITRAN_H
9 #define CT_MULTITRAN_H
10 
11 // Cantera includes
12 #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  if (m_mode == CK_Mode) {
37  return CK_Multicomponent;
38  } else {
39  return cMulticomponent;
40  }
41  }
42 
43  //! Return the thermal diffusion coefficients (kg/m/s)
44  /*!
45  * Eqn. (12.126) displays how they are calculated. The reference work is from
46  * Dixon-Lewis.
47  *
48  * Eqns. (12.168) shows how they are used in an expression for the species flux.
49  *
50  * @param dt Vector of thermal diffusion coefficients. Units = kg/m/s
51  */
52  virtual void getThermalDiffCoeffs(doublereal* const dt);
53 
54  virtual doublereal thermalConductivity();
55 
56  virtual void getMultiDiffCoeffs(const size_t ld, doublereal* const d);
57 
58  //! Get the species diffusive mass fluxes wrt to the mass averaged velocity,
59  //! given the gradients in mole fraction and temperature
60  /*!
61  * Units for the returned fluxes are kg m-2 s-1.
62  *
63  * @param ndim Number of dimensions in the flux expressions
64  * @param grad_T Gradient of the temperature
65  * (length = ndim)
66  * @param ldx Leading dimension of the grad_X array
67  * (usually equal to m_nsp but not always)
68  * @param grad_X Gradients of the mole fraction
69  * Flat vector with the m_nsp in the inner loop.
70  * length = ldx * ndim
71  * @param ldf Leading dimension of the fluxes array
72  * (usually equal to m_nsp but not always)
73  * @param fluxes Output of the diffusive mass fluxes
74  * Flat vector with the m_nsp in the inner loop.
75  * length = ldx * ndim
76  */
77  virtual void getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
78  size_t ldx, const doublereal* const grad_X,
79  size_t ldf, doublereal* const fluxes);
80 
81  //! Get the molar diffusional fluxes [kmol/m^2/s] of the species, given the thermodynamic
82  //! state at two nearby points.
83  /*!
84  * The molar diffusional fluxes are calculated with reference to the mass averaged
85  * velocity. This is a one-dimensional vector
86  *
87  * @param state1 Array of temperature, density, and mass
88  * fractions for state 1.
89  * @param state2 Array of temperature, density, and mass
90  * fractions for state 2.
91  * @param delta Distance from state 1 to state 2 (m).
92  * @param fluxes Output molar fluxes of the species.
93  * (length = m_nsp)
94  */
95  virtual void getMolarFluxes(const doublereal* const state1,
96  const doublereal* const state2,
97  const doublereal delta,
98  doublereal* const fluxes);
99 
100  //! Get the mass diffusional fluxes [kg/m^2/s] of the species, given the
101  //! thermodynamic state at two nearby points.
102  /*!
103  * The specific diffusional fluxes are calculated with reference to the
104  * mass averaged velocity. This is a one-dimensional vector
105  *
106  * @param state1 Array of temperature, density, and mass
107  * fractions for state 1.
108  * @param state2 Array of temperature, density, and mass
109  * fractions for state 2.
110  * @param delta Distance from state 1 to state 2 (m).
111  * @param fluxes Output mass fluxes of the species.
112  * (length = m_nsp)
113  */
114  virtual void getMassFluxes(const doublereal* state1,
115  const doublereal* state2, doublereal delta,
116  doublereal* fluxes);
117 
118  virtual void init(ThermoPhase* thermo, int mode=0, int log_level=0);
119 
120 protected:
121  //! Update basic temperature-dependent quantities if the temperature has changed.
122  void update_T();
123 
124  //! Update basic concentration-dependent quantities if the concentrations have changed.
125  void update_C();
126 
127  //! Update the temperature-dependent terms needed to compute the thermal
128  //! conductivity and thermal diffusion coefficients.
129  void updateThermal_T();
130 
131  doublereal m_thermal_tlast;
132 
133  //! Dense matrix for astar
135 
136  //! Dense matrix for bstar
138 
139  //! Dense matrix for cstar
141 
142  //! Dense matrix for omega22
144 
145  vector_fp m_cinternal;
146 
147  vector_fp m_sqrt_eps_k;
148  DenseMatrix m_log_eps_k;
149  vector_fp m_frot_298;
150  vector_fp m_rotrelax;
151 
152  doublereal m_lambda;
153 
154  // L matrix quantities
155  DenseMatrix m_Lmatrix;
156  SquareMatrix m_aa;
157  //DenseMatrix m_Lmatrix;
158  vector_fp m_a;
159  vector_fp m_b;
160 
161  // work space
162  vector_fp m_spwork1, m_spwork2, m_spwork3;
163 
164  //! Mole fraction vector from last L-matrix evaluation
166 
167  void correctBinDiffCoeffs();
168 
169  //! Boolean indicating viscosity is up to date
170  bool m_abc_ok;
171  bool m_l0000_ok;
172  bool m_lmatrix_soln_ok;
173 
174  //! Evaluate the L0000 matrices
175  /*!
176  * Evaluate the upper-left block of the L matrix.
177  * @param x vector of species mole fractions
178  */
179  void eval_L0000(const doublereal* const x);
180 
181  //! Evaluate the L0010 matrices
182  /*!
183  * @param x vector of species mole fractions
184  */
185  void eval_L0010(const doublereal* const x);
186 
187  //! Evaluate the L1000 matrices
188  void eval_L1000();
189 
190  void eval_L0100();
191  void eval_L0001();
192  void eval_L1010(const doublereal* x);
193  void eval_L1001(const doublereal* x);
194  void eval_L0110();
195  void eval_L0101(const doublereal* x);
196  bool hasInternalModes(size_t j);
197 
198  doublereal pressure_ig() {
200  }
201 
202  virtual void solveLMatrixEquation();
203  DenseMatrix incl;
204  bool m_debug;
205 };
206 }
207 #endif
virtual doublereal thermalConductivity()
Returns the mixture thermal conductivity in W/m/K.
void eval_L1000()
Evaluate the L1000 matrices.
Dense, Square (not sparse) matrices.
DenseMatrix m_bstar
Dense matrix for bstar.
virtual void getThermalDiffCoeffs(doublereal *const dt)
Return the thermal diffusion coefficients (kg/m/s)
virtual int model() const
Transport model.
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
DenseMatrix m_cstar
Dense matrix for cstar.
void update_T()
Update basic temperature-dependent quantities if the temperature has changed.
doublereal molarDensity() const
Molar density (kmol/m^3).
Definition: Phase.cpp:663
MultiTransport(thermo_t *thermo=0)
default constructor
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
virtual void init(ThermoPhase *thermo, int mode=0, int log_level=0)
Initialize a transport manager.
vector_fp m_molefracs_last
Mole fraction vector from last L-matrix evaluation.
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].
A class for full (non-sparse) matrices with Fortran-compatible data storage.
Definition: SquareMatrix.h:26
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...
doublereal temperature() const
Temperature (K).
Definition: Phase.h:602
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.
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:71
Class GasTransport implements some functions and properties that are shared by the MixTransport and M...
Definition: GasTransport.h:19
void update_C()
Update basic concentration-dependent quantities if the concentrations have changed.