Cantera  3.1.0
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. 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=-7) override;
104
105 void invalidateCache() override;
106
107protected:
108 //! Update basic temperature-dependent quantities if the temperature has
109 //! changed.
110 void update_T() override;
111
112 //! Update basic concentration-dependent quantities if the concentrations
113 //! have changed.
114 void update_C() override;
115
116 //! Update the temperature-dependent terms needed to compute the thermal
117 //! conductivity and thermal diffusion coefficients.
118 void updateThermal_T();
119
120 double m_thermal_tlast;
121
122 //! Dense matrix for astar
124
125 //! Dense matrix for bstar
127
128 //! Dense matrix for cstar
130
131 vector<double> m_cinternal;
132
133 vector<double> m_sqrt_eps_k;
134 DenseMatrix m_log_eps_k;
135 vector<double> m_frot_298;
136 vector<double> m_rotrelax;
137
138 double m_lambda;
139
140 // L matrix quantities
141 DenseMatrix m_Lmatrix;
142 DenseMatrix m_aa;
143 vector<double> m_a;
144 vector<double> m_b;
145
146 // work space
147 vector<double> m_spwork1, m_spwork2, m_spwork3;
148
149 //! Mole fraction vector from last L-matrix evaluation
150 vector<double> m_molefracs_last;
151
152 //! Boolean indicating viscosity is up to date
154 bool m_lmatrix_soln_ok;
155
156 //! Evaluate the L0000 matrices
157 /*!
158 * Evaluate the upper-left block of the L matrix.
159 * @param x vector of species mole fractions
160 */
161 void eval_L0000(const double* const x);
162
163 //! Evaluate the L0010 matrices
164 /*!
165 * @param x vector of species mole fractions
166 */
167 void eval_L0010(const double* const x);
168
169 //! Evaluate the L1000 matrices
170 void eval_L1000();
171
172 void eval_L0100();
173 void eval_L0001();
174 void eval_L1010(const double* x);
175 void eval_L1001(const double* x);
176 void eval_L0110();
177 void eval_L0101(const double* x);
178 bool hasInternalModes(size_t j);
179
180 double pressure_ig();
181
182 virtual void solveLMatrixEquation();
183 bool m_debug;
184};
185}
186#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^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.
void init(ThermoPhase *thermo, int mode=0, int log_level=-7) 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. Units: [m^2/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