Documentation 6b54b78464
Loading...
Searching...
No Matches
CSU2TCLib.hpp
Go to the documentation of this file.
1/*!
2 * \file CSU2TCLib.hpp
3 * \brief Defines the classes for different user defined ThermoChemistry libraries.
4 * \author C. Garbacz, W. Maier, S. R. Copeland
5 * \version 8.5.0 "Harrier"
6 *
7 * SU2 Project Website: https://su2code.github.io
8 *
9 * The SU2 Project is maintained by the SU2 Foundation
10 * (http://su2foundation.org)
11 *
12 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
13 *
14 * SU2 is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * SU2 is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26 */
27
28#pragma once
29
30#include "CNEMOGas.hpp"
31
32/*!
33 * \derived class CSU2TCLib
34 * \brief Child class for user defined nonequilibrium gas model.
35 * \author: C. Garbacz, W. Maier, S. R. Copeland
36 */
37class CSU2TCLib : public CNEMOGas {
38
39private:
40
41 unsigned short nReactions, /*!< \brief Number of reactions in chemical model. */
42 iEl; /*!< \brief Common iteration counter for electrons */
43
44 vector<unsigned short> nElStates; /*!< \brief Number of electron states. */
45
46 C3DIntMatrix Reactions; /*!</brief reaction map for chemically reacting flows */
47
48 vector<su2double>
49 ArrheniusCoefficient, /*!< \brief Arrhenius reaction coefficient */
50 ArrheniusEta, /*!< \brief Arrhenius reaction temperature exponent */
51 ArrheniusTheta, /*!< \brief Arrhenius reaction characteristic temperature */
52 CharVibTemp, /*!< \brief Characteristic vibrational temperature for e_vib */
53 RotationModes, /*!< \brief Rotational modes of energy storage */
54 Tcf_a, /*!< \brief Rate controlling temperature exponent (fwd) */
55 Tcf_b, /*!< \brief Rate controlling temperature exponent (fwd) */
56 Tcb_a, /*!< \brief Rate controlling temperature exponent (bkw) */
57 Tcb_b, /*!< \brief Rate controlling temperature exponent (bkw) */
58 taus, /*!< \brief Relaxtion time scales */
59 Diss, /*!< \brief Dissociation potential. */
60 MassFrac_FreeStream, /*!< \brief Mixture mass fractions of the fluid. */
61 Wall_Catalycity, /*!< \brief Specified wall species mass-fractions for catalytic boundaries. */
62 Particle_Mass, /*!< \brief Mass of all particles present in the plasma */
63 MolarFracWBE, /*!< \brief Molar fractions to be used in Wilke/Blottner/Eucken model */
64 phis, mus, /*!< \brief Auxiliary vectors to be used in Wilke/Blottner/Eucken model */
65 A; /*!< \brief Auxiliary vector to be used in net production rate computation */
66
67 std::array<su2double,1> mu_ref; /*!< \brief Vector containing reference viscosity for Sutherland's law */
68 std::array<su2double,1> k_ref; /*!< \brief Vector containing reference thermal conducivities for Sutherland's law */
69 std::array<su2double,1> Sm_ref; /*!< \brief Vector containing Sutherland's constant for viscosity */
70 std::array<su2double,1> Sk_ref; /*!< \brief Vector containing Sutherland's constant for thermal conductivities */
71
72 const su2double T_ref_suth = 273.15; /*!<\brief Reference temperature for Sutherland's model [K] */
73
74 // Coulomb potential constant values source: Scalabrin, NUMERICAL SIMULATION OF WEAKLY IONIZED HYPERSONIC
75 // FLOW OVER REENTRY CAPSULES, 2007.
76 /*--- Attractive Coulombic potential constants ---*/
77 const su2double D1_a = 0.784;
78 const su2double C1_a = -0.476;
79 const su2double c1_a = 0.0313;
80 const su2double D2_a = 1.262;
81 const su2double C2_a = -0.146;
82 const su2double c2_a = 0.0377;
83
84 /*--- Repulsive Coulombic potential constants ---*/
85 const su2double D1_r = 0.765;
86 const su2double C1_r = 0.138;
87 const su2double c1_r = 0.0106;
88 const su2double D2_r = 1.235;
89 const su2double C2_r = 0.157;
90 const su2double c2_r = 0.0274;
91
92 su2activematrix CharElTemp, /*!< \brief Characteristic temperature of electron states. */
93 ElDegeneracy, /*!< \brief Degeneracy of electron states. */
94 RxnConstantTable, /*!< \brief Table of chemical equiibrium reaction constants */
95 Blottner, /*!< \brief Blottner viscosity coefficients */
96 Dij; /*!< \brief Binary diffusion coefficients. */
97
98 C3DDoubleMatrix Omega11, /*!< \brief Collision integrals (Omega^(1,1)) */
99 Omega22; /*!< \brief Collision integrals (Omega^(2,2)) */
100
101 /*--- Implicit variables ---*/
102 su2double /*!< \brief Derivatives w.r.t. conservative variables */
103 *dPdU, *dTdU, *dTvedU;
104
105 su2double fwdRxn, bkwRxn,
106 kf,kfb,kb,
107 coeff, eta, epsilon, T_min,
108 Trxnf, Trxnb,
109 Thf, Thb, dThf, dThb,
110 theta, af, bf, ab, bb;
111
112 vector<su2double>
113 dkf, dkb,
114 dRfok, dRbok,
115 eve, eve_eq, cvve, cvve_eq;
116
117 vector<int>
118 alphak, betak;
119
120public:
121
122 /*!
123 * \brief Constructor of the class.
124 */
125 CSU2TCLib(const CConfig* config, unsigned short val_nDim, bool val_viscous);
126
127 /*!
128 * \brief Destructor of the class.
129 */
130 virtual ~CSU2TCLib(void);
131
132 /*!
133 * \brief Set mixture thermodynamic state.
134 * \param[in] rhos - Species partial densities.
135 * \param[in] T - Translational/Rotational temperature.
136 * \param[in] Tve - Vibrational/Electronic temperature.
137 */
138 void SetTDStateRhosTTv(vector<su2double>& val_rhos, su2double val_temperature, su2double val_temperature_ve) final;
139
140 /*!
141 * \brief Get species molar mass.
142 */
143 vector<su2double>& GetSpeciesMolarMass() final { return MolarMass; }
144
145 /*!
146 * \brief Get species T-R specific heats at constant volume.
147 */
148 vector<su2double>& GetSpeciesCvTraRot() final;
149
150 /*!
151 * \brief Compute species V-E specific heats at constant volume.
152 */
153 vector<su2double>& ComputeSpeciesCvVibEle(su2double val_T) final;
154
155 /*!
156 * \brief Compute mixture energies (total internal energy and vibrational energy).
157 */
158 vector<su2double>& ComputeMixtureEnergies() final;
159
160 /*!
161 * \brief Compute species V-E energy.
162 */
163 vector<su2double>& ComputeSpeciesEve(su2double val_T, bool vibe_only = false) final;
164
165 /*!
166 * \brief Compute species net production rates.
167 */
168 vector<su2double>& ComputeNetProductionRates(bool implicit, const su2double *V, const su2double* eve,
169 const su2double* cvve, const su2double* dTdU, const su2double* dTvedU,
170 su2double **val_jacobian) final;
171
172 /*!
173 * \brief Compute chemical source term jacobian.
174 */
175 void ChemistryJacobian(unsigned short iReaction, const su2double *V, const su2double* eve,
176 const su2double* cvve, const su2double* dTdU, const su2double* dTvedU,
177 su2double **val_jacobian) final;
178
179 /*!
180 * \brief Compute vibrational energy source term.
181 */
183
184 /*!
185 * \brief Compute relaxation source term jacobian.
186 */
187 void GetEveSourceTermJacobian(const su2double *V, const su2double *eve, const su2double *cvve,
188 const su2double *dTdU, const su2double* dTvedU,
189 su2double **val_jacobian) final;
190
191 /*!
192 * \brief Compute species enthalpies.
193 */
194 vector<su2double>& ComputeSpeciesEnthalpy(su2double val_T, su2double val_Tve, su2double *val_eves) final;
195
196 /*!
197 * \brief Get species diffusion coefficients.
198 */
199 vector<su2double>& GetDiffusionCoeff() final;
200
201 /*!
202 * \brief Get viscosity.
203 */
204 su2double GetViscosity() final;
205
206 /*!
207 * \brief Get T-R and V-E thermal conductivities vector.
208 */
209 vector<su2double>& GetThermalConductivities() final;
210
211 /*!
212 * \brief Compute translational and vibrational temperatures vector.
213 */
214 vector<su2double>& ComputeTemperatures(vector<su2double>& val_rhos, su2double rhoEmix, su2double rhoEve, su2double rhoEvel, su2double Tve_old) final;
215
216 private:
217
218 /*!
219 * \brief Set equilibrium reaction constants for finite-rate chemistry
220 */
221 void GetChemistryEquilConstants(unsigned short iReaction);
222
223 /*!
224 * \brief Calculates constants used for Keq correlation.
225 * \param[out] A - Reference to coefficient array.
226 * \param[in] val_reaction - Reaction number indicator.
227 */
228 void ComputeKeqConstants(unsigned short val_Reaction);
229
230 /*!
231 * \brief Calculate species diffusion coefficients with Wilke/Blottner/Eucken transport model.
232 */
233 void DiffusionCoeffWBE();
234
235 /*!
236 * \brief Calculate viscosity with Wilke/Blottner/Eucken transport model.
237 */
238 void ViscosityWBE();
239
240 /*!
241 * \brief Calculate T-R and V-E thermal conductivities vector with Wilke/Blottner/Eucken transport model.
242 */
243 void ThermalConductivitiesWBE();
244
245 /*!
246 * \brief Calculate species diffusion coefficients with Gupta-Yos transport model.
247 */
248 void DiffusionCoeffGY();
249
250 /*!
251 * \brief Calculate viscosity with Gupta-Yos transport model.
252 */
253 void ViscosityGY();
254
255 /*!
256 * \brief Calculate T-R and V-E thermal conductivities vector with Gupta-Yos transport model.
257 */
258 void ThermalConductivitiesGY();
259
260 /*!
261 * \brief Calculate viscosity with Sutherland's transport model.
262 */
263 void ViscositySuth();
264
265 /*!
266 * \brief Calculate T-R and V-E thermal conductivities vector with Sutherland's transport model.
267 */
268 void ThermalConductivitiesSuth();
269
270 /*!
271 *\brief Compute the collision terms (deltas)
272 *\param[in] iSpecies - Species of gas
273 *\param[in] jSpecies - Collision partner of species i
274 *\param[in] Mi - Molar mass of species i
275 *\param[in] Mj - Molar mass of species j
276 *\param[in] T - Temperature of gas
277 *\param[in] d1 - Whether delta_1 or delta_2 is computed
278 *\param[out] Delta_1 or Delta_2 - Collision term between species i and j
279 */
280 su2double ComputeCollisionDelta(unsigned iSpecies, unsigned jSpecies, su2double Mi, su2double Mj, su2double T, bool d1);
281
282 /*!
283 *\brief Compute the collision cross section
284 *\param[in] iSpecies - Species of gas
285 *\param[in] jSpecies - Collision partner of species i
286 *\param[in] T - Temperature of gas
287 *\param[in] d1 - Whether omega^(1,1) or omega^(2,2)
288 *\param[in] coulomb - Whether to use Coulomb potential
289 *\param[out] Omega_ij - collision cross section
290 */
291 su2double ComputeCollisionCrossSection(unsigned iSpecies, unsigned jSpecies, su2double T, bool d1, bool coulomb);
292
293 /*!
294 * \brief Get reference temperature.
295 */
296 vector<su2double>& GetRefTemperature() final { return Ref_Temperature; }
297
298 /*!
299 * \brief Get species formation enthalpy.
300 */
301 vector<su2double>& GetSpeciesFormationEnthalpy() final { return Enthalpy_Formation; }
302
303 };
304
Defines the nonequilibrium gas model.
A templated matrix/vector-like object.
Definition C2DContainer.hpp:374
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Class for defining the 2T (trans-rotational and vibro-electronic) nonequilibrium gas model.
Definition CNEMOGas.hpp:38
vector< su2double > MolarMass
Species molar mass.
Definition CNEMOGas.hpp:70
unsigned jSpecies
Common iteration counter for species.
Definition CNEMOGas.hpp:55
vector< su2double > Enthalpy_Formation
Enthalpy of formation.
Definition CNEMOGas.hpp:84
su2double T
Translational temperature.
Definition CNEMOGas.hpp:60
unsigned iSpecies
Common iteration counter for species.
Definition CNEMOGas.hpp:54
vector< su2double > Ref_Temperature
Reference temperature for thermodynamic relations.
Definition CNEMOGas.hpp:85
Child class for user defined nonequilibrium gas model.
Definition CSU2TCLib.hpp:37
vector< su2double > & ComputeSpeciesEnthalpy(su2double val_T, su2double val_Tve, su2double *val_eves) final
Compute species enthalpies.
Definition CSU2TCLib.cpp:1726
vector< su2double > & GetSpeciesMolarMass() final
Get species molar mass.
Definition CSU2TCLib.hpp:143
vector< su2double > & ComputeSpeciesEve(su2double val_T, bool vibe_only=false) final
Compute species V-E energy.
Definition CSU2TCLib.cpp:1315
su2double ComputeEveSourceTerm() final
Compute vibrational energy source term.
Definition CSU2TCLib.cpp:1627
void SetTDStateRhosTTv(vector< su2double > &val_rhos, su2double val_temperature, su2double val_temperature_ve) final
Set mixture thermodynamic state.
Definition CSU2TCLib.cpp:1185
virtual ~CSU2TCLib(void)
Destructor of the class.
void ChemistryJacobian(unsigned short iReaction, const su2double *V, const su2double *eve, const su2double *cvve, const su2double *dTdU, const su2double *dTvedU, su2double **val_jacobian) final
Compute chemical source term jacobian.
Definition CSU2TCLib.cpp:1449
vector< su2double > & ComputeMixtureEnergies() final
Compute mixture energies (total internal energy and vibrational energy).
Definition CSU2TCLib.cpp:1262
void GetEveSourceTermJacobian(const su2double *V, const su2double *eve, const su2double *cvve, const su2double *dTdU, const su2double *dTvedU, su2double **val_jacobian) final
Compute relaxation source term jacobian.
Definition CSU2TCLib.cpp:1705
vector< su2double > & GetDiffusionCoeff() final
Get species diffusion coefficients.
Definition CSU2TCLib.cpp:1741
su2double GetViscosity() final
Get viscosity.
Definition CSU2TCLib.cpp:1754
vector< su2double > & ComputeSpeciesCvVibEle(su2double val_T) final
Compute species V-E specific heats at constant volume.
Definition CSU2TCLib.cpp:1209
vector< su2double > & GetThermalConductivities() final
Get T-R and V-E thermal conductivities vector.
Definition CSU2TCLib.cpp:1767
vector< su2double > & ComputeTemperatures(vector< su2double > &val_rhos, su2double rhoEmix, su2double rhoEve, su2double rhoEvel, su2double Tve_old) final
Compute translational and vibrational temperatures vector.
Definition CSU2TCLib.cpp:2129
vector< su2double > & GetSpeciesCvTraRot() final
Get species T-R specific heats at constant volume.
Definition CSU2TCLib.cpp:1199
vector< su2double > & ComputeNetProductionRates(bool implicit, const su2double *V, const su2double *eve, const su2double *cvve, const su2double *dTdU, const su2double *dTvedU, su2double **val_jacobian) final
Compute species net production rates.
Definition CSU2TCLib.cpp:1357
passivedouble su2double
Definition code_config.hpp:181
@ V
Menter k-w SST model with vorticity production terms.