Cantera  3.2.0a2
Loading...
Searching...
No Matches
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
15namespace 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{
27public:
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.
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 [kg/m²/s] with respect to the mass
52 //! averaged velocity, given the gradients in mole fraction and temperature
53 /*!
54 * @param ndim Number of dimensions in the flux expressions
55 * @param[in] grad_T Gradient of the temperature (length `ndim`)
56 * @param ldx Leading dimension of the `grad_X` array (usually equal to the number
57 * of species)
58 * @param[in] grad_X Gradients of the mole fractions; flattened matrix such that
59 * @f$ dX_k/dx_n = \tt{ grad\_X[n*ldx+k]} @f$ is the gradient of species *k*
60 * in dimension *n*. Length is `ldx` * `ndim`.
61 * @param ldf Leading dimension of the `fluxes` array (usually equal to the number
62 * of species)
63 * @param[out] fluxes The diffusive mass fluxes; flattened matrix such that
64 * @f$ j_{kn} = \tt{ fluxes[n*ldf+k]} @f$ is the flux of species *k*
65 * in dimension *n*. Length is `ldf` * `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²/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 Array containing the diffusive molar fluxes of species from
83 * `state1` to `state2`; Length is number of species.
84 */
85 void getMolarFluxes(const double* const state1, const double* const state2,
86 const double delta, double* const fluxes) override;
87
88 //! Get the mass diffusional fluxes [kg/m²/s] of the species, given the
89 //! thermodynamic state at two nearby points.
90 /*!
91 * The specific diffusional fluxes are calculated with reference to the
92 * mass averaged velocity. This is a one-dimensional vector
93 *
94 * @param state1 Array of temperature, density, and mass
95 * fractions for state 1.
96 * @param state2 Array of temperature, density, and mass
97 * fractions for state 2.
98 * @param delta Distance from state 1 to state 2 [m].
99 * @param fluxes Array containing the diffusive mass fluxes of species from
100 * `state1` to `state2`; length is number of species.
101 */
102 void getMassFluxes(const double* state1, const double* state2, double delta,
103 double* fluxes) override;
104
105 void init(ThermoPhase* thermo, int mode=0) override;
106
107 void invalidateCache() override;
108
109protected:
110 //! Update basic temperature-dependent quantities if the temperature has
111 //! changed.
112 void update_T() override;
113
114 //! Update basic concentration-dependent quantities if the concentrations
115 //! have changed.
116 void update_C() override;
117
118 //! Update the temperature-dependent terms needed to compute the thermal
119 //! conductivity and thermal diffusion coefficients.
120 void updateThermal_T();
121
122 double m_thermal_tlast;
123
124 //! Dense matrix for astar
126
127 //! Dense matrix for bstar
129
130 //! Dense matrix for cstar
132
133 vector<double> m_cinternal;
134
135 vector<double> m_sqrt_eps_k;
136 DenseMatrix m_log_eps_k;
137 vector<double> m_frot_298;
138 vector<double> m_rotrelax;
139
140 double m_lambda;
141
142 // L matrix quantities
143 DenseMatrix m_Lmatrix;
144 DenseMatrix m_aa;
145 vector<double> m_a;
146 vector<double> m_b;
147
148 // work space
149 vector<double> m_spwork1, m_spwork2, m_spwork3;
150
151 //! Mole fraction vector from last L-matrix evaluation
152 vector<double> m_molefracs_last;
153
154 //! Boolean indicating viscosity is up to date
156 bool m_lmatrix_soln_ok;
157
158 //! Evaluate the L0000 matrices
159 /*!
160 * Evaluate the upper-left block of the L matrix.
161 * @param x vector of species mole fractions
162 */
163 void eval_L0000(const double* const x);
164
165 //! Evaluate the L0010 matrices
166 /*!
167 * @param x vector of species mole fractions
168 */
169 void eval_L0010(const double* const x);
170
171 //! Evaluate the L1000 matrices
172 void eval_L1000();
173
174 void eval_L0100();
175 void eval_L0001();
176 void eval_L1010(const double* x);
177 void eval_L1001(const double* x);
178 void eval_L0110();
179 void eval_L0101(const double* x);
180 bool hasInternalModes(size_t j);
181
182 double pressure_ig();
183
184 virtual void solveLMatrixEquation();
185 bool m_debug;
186};
187}
188#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...
int m_mode
Type of the polynomial fits to temperature.
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²/s] of the species, given the thermodynamic state at two nearby...
void getMolarFluxes(const double *const state1, const double *const state2, const double delta, double *const fluxes) override
Get the molar diffusional fluxes [kmol/m²/s] of the species, given the thermodynamic state at two nea...
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
Get the mixture thermal conductivity [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 [kg/m²/s] with respect to the mass averaged velocity,...
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.
void init(ThermoPhase *thermo, int mode=0) override
Initialize a transport manager.
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 invalidateCache() override
Invalidate any cached values which are normally updated only when a change in state is detected.
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 [m²/s].
DenseMatrix m_bstar
Dense matrix for bstar.
void eval_L1000()
Evaluate the L1000 matrices.
Base class for a phase with thermodynamic properties.
ThermoPhase & thermo()
Phase object.
Definition Transport.h:103
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595