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