Cantera  2.5.1
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 https://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 std::string transportType() const {
36  return (m_mode == CK_Mode) ? "CK_Multi" : "Multi";
37  }
38 
39  //! Return the thermal diffusion coefficients (kg/m/s)
40  /*!
41  * Eqn. (12.126) displays how they are calculated. The reference work is
42  * from Dixon-Lewis.
43  *
44  * Eqns. (12.168) shows how they are used in an expression for the species
45  * flux.
46  *
47  * @param dt Vector of thermal diffusion coefficients. Units = kg/m/s
48  */
49  virtual void getThermalDiffCoeffs(doublereal* const dt);
50 
51  virtual doublereal thermalConductivity();
52 
53  virtual void getMultiDiffCoeffs(const size_t ld, doublereal* const d);
54 
55  //! Get the species diffusive mass fluxes wrt to the mass averaged velocity,
56  //! given the gradients in mole fraction and temperature
57  /*!
58  * Units for the returned fluxes are kg m-2 s-1.
59  *
60  * @param ndim Number of dimensions in the flux expressions
61  * @param grad_T Gradient of the temperature (length = ndim)
62  * @param ldx Leading dimension of the grad_X array. (usually equal to
63  * m_nsp but not always)
64  * @param grad_X Gradients of the mole fraction. Flat vector with the
65  * m_nsp in the inner loop. length = ldx * ndim
66  * @param ldf Leading dimension of the fluxes array. (usually equal to
67  * m_nsp but not always)
68  * @param fluxes Output of the diffusive mass fluxes. Flat vector with the
69  * m_nsp in the inner loop. length = ldx * ndim
70  */
71  virtual void getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
72  size_t ldx, const doublereal* const grad_X,
73  size_t ldf, doublereal* const fluxes);
74 
75  //! Get the molar diffusional fluxes [kmol/m^2/s] of the species, given the
76  //! thermodynamic state at two nearby points.
77  /*!
78  * The molar diffusional fluxes are calculated with reference to the mass
79  * averaged velocity. This is a one-dimensional vector
80  *
81  * @param state1 Array of temperature, density, and mass
82  * fractions for state 1.
83  * @param state2 Array of temperature, density, and mass
84  * fractions for state 2.
85  * @param delta Distance from state 1 to state 2 (m).
86  * @param fluxes Output molar fluxes of the species. (length = m_nsp)
87  */
88  virtual void getMolarFluxes(const doublereal* const state1,
89  const doublereal* const state2,
90  const doublereal delta,
91  doublereal* const fluxes);
92 
93  //! Get the mass diffusional fluxes [kg/m^2/s] of the species, given the
94  //! thermodynamic state at two nearby points.
95  /*!
96  * The specific diffusional fluxes are calculated with reference to the
97  * mass averaged velocity. This is a one-dimensional vector
98  *
99  * @param state1 Array of temperature, density, and mass
100  * fractions for state 1.
101  * @param state2 Array of temperature, density, and mass
102  * fractions for state 2.
103  * @param delta Distance from state 1 to state 2 (m).
104  * @param fluxes Output mass fluxes of the species. (length = m_nsp)
105  */
106  virtual void getMassFluxes(const doublereal* state1,
107  const doublereal* state2, doublereal delta,
108  doublereal* fluxes);
109 
110  virtual void init(ThermoPhase* thermo, int mode=0, int log_level=0);
111 
112 protected:
113  //! Update basic temperature-dependent quantities if the temperature has
114  //! changed.
115  void update_T();
116 
117  //! Update basic concentration-dependent quantities if the concentrations
118  //! have changed.
119  void update_C();
120 
121  //! Update the temperature-dependent terms needed to compute the thermal
122  //! conductivity and thermal diffusion coefficients.
123  void updateThermal_T();
124 
125  doublereal m_thermal_tlast;
126 
127  //! Dense matrix for astar
129 
130  //! Dense matrix for bstar
132 
133  //! Dense matrix for cstar
135 
136  //! Dense matrix for omega22
138 
139  vector_fp m_cinternal;
140 
141  vector_fp m_sqrt_eps_k;
142  DenseMatrix m_log_eps_k;
143  vector_fp m_frot_298;
144  vector_fp m_rotrelax;
145 
146  doublereal m_lambda;
147 
148  // L matrix quantities
149  DenseMatrix m_Lmatrix;
150  DenseMatrix m_aa;
151  vector_fp m_a;
152  vector_fp m_b;
153 
154  // work space
155  vector_fp m_spwork1, m_spwork2, m_spwork3;
156 
157  //! Mole fraction vector from last L-matrix evaluation
159 
160  void correctBinDiffCoeffs();
161 
162  //! Boolean indicating viscosity is up to date
163  bool m_abc_ok;
164  bool m_l0000_ok;
165  bool m_lmatrix_soln_ok;
166 
167  //! Evaluate the L0000 matrices
168  /*!
169  * Evaluate the upper-left block of the L matrix.
170  * @param x vector of species mole fractions
171  */
172  void eval_L0000(const doublereal* const x);
173 
174  //! Evaluate the L0010 matrices
175  /*!
176  * @param x vector of species mole fractions
177  */
178  void eval_L0010(const doublereal* const x);
179 
180  //! Evaluate the L1000 matrices
181  void eval_L1000();
182 
183  void eval_L0100();
184  void eval_L0001();
185  void eval_L1010(const doublereal* x);
186  void eval_L1001(const doublereal* x);
187  void eval_L0110();
188  void eval_L0101(const doublereal* x);
189  bool hasInternalModes(size_t j);
190 
191  doublereal pressure_ig() {
193  }
194 
195  virtual void solveLMatrixEquation();
196  DenseMatrix incl;
197  bool m_debug;
198 };
199 }
200 #endif
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
Definition: DenseMatrix.h:51
Class GasTransport implements some functions and properties that are shared by the MixTransport and M...
Definition: GasTransport.h:31
int m_mode
Type of the polynomial fits to temperature.
Definition: GasTransport.h:271
Class MultiTransport implements multicomponent transport properties for ideal gas mixtures.
virtual void getThermalDiffCoeffs(doublereal *const dt)
Return the thermal diffusion coefficients (kg/m/s)
void eval_L0000(const doublereal *const x)
Evaluate the L0000 matrices.
virtual doublereal thermalConductivity()
Returns the mixture thermal conductivity in W/m/K.
virtual void getMultiDiffCoeffs(const size_t ld, doublereal *const d)
Return the Multicomponent diffusion coefficients. Units: [m^2/s].
void update_T()
Update basic temperature-dependent quantities if the temperature has changed.
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...
vector_fp m_molefracs_last
Mole fraction vector from last L-matrix evaluation.
DenseMatrix m_om22
Dense matrix for omega22.
DenseMatrix m_astar
Dense matrix for astar.
void updateThermal_T()
Update the temperature-dependent terms needed to compute the thermal conductivity and thermal diffusi...
DenseMatrix m_cstar
Dense matrix for cstar.
virtual void init(ThermoPhase *thermo, int mode=0, int log_level=0)
Initialize a transport manager.
virtual std::string transportType() const
Identifies the Transport object type.
void update_C()
Update basic concentration-dependent quantities if the concentrations have changed.
void eval_L0010(const doublereal *const x)
Evaluate the L0010 matrices.
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.
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...
DenseMatrix m_bstar
Dense matrix for bstar.
void eval_L1000()
Evaluate the L1000 matrices.
MultiTransport(thermo_t *thermo=0)
default constructor
double molarDensity() const
Molar density (kmol/m^3).
Definition: Phase.cpp:700
doublereal temperature() const
Temperature (K).
Definition: Phase.h:667
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:102
thermo_t & thermo()
thermo_t * m_thermo
pointer to the object representing the phase
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:180
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition: ct_defs.h:109
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264