Documentation 6b54b78464
Loading...
Searching...
No Matches
CNEMONumerics.hpp
Go to the documentation of this file.
1/*!
2 * \file CNEMONumerics.hpp
3 * \brief Base class template NEMO numerics.
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 "../CNumerics.hpp"
31#include "../../fluid/CNEMOGas.hpp"
32#include "../../fluid/CMutationTCLib.hpp"
33#include "../../fluid/CSU2TCLib.hpp"
34#include "../../../../Common/include/toolboxes/geometry_toolbox.hpp"
35
36/*!
37 * \class CNEMONumerics
38 * \brief Base class template NEMO numerics.
39 * \author C. Garbacz., W. Maier
40 */
41class CNEMONumerics : public CNumerics {
42public:
50 unsigned short nPrimVar, nPrimVarGrad;
51
52 su2double* Flux = nullptr; /*!< \brief The flux / residual across the edge. */
53 su2double** Jacobian_i = nullptr;
54 su2double** Jacobian_j = nullptr;
55
56 unsigned short nSpecies, nHeavy, nEl; /*!< \brief Number of species present in plasma */
57
58 /*--- Graidents w.r.t. conservative variables. ---*/
63
65
69
71
72 /*!
73 * \brief Constructor of the class.
74 * \param[in] val_nDim - Number of dimensions of the problem.
75 * \param[in] val_nVar - Number of variables of the problem.
76 * \param[in] val_nPrimVar - Number of primitive variables of the problem.
77 * \param[in] val_nPrimVarGrad - Number of primitive grad. variables of the problem.
78 * \param[in] config - Definition of the particular problem.
79 */
80 CNEMONumerics(unsigned short val_nDim, unsigned short val_nVar,
81 unsigned short val_nPrimVar,
82 unsigned short val_nPrimVarGrad,
83 const CConfig* config);
84
85 /*!
86 * \brief Destructor of the class.
87 */
88 ~CNEMONumerics(void);
89
90 /*!
91 * \Overload
92 * \brief Compute the projected inviscid flux vector.
93 * \param[in] val_U - Pointer to the conserved variables.
94 * \param[in] val_V - Pointer to the primitive variables.
95 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
96 * \param[out] val_Proj_Flux - Pointer to the projected flux.
97 */
98 void GetInviscidProjFlux(const su2double *val_U, const su2double *val_V,
99 const su2double *val_normal, su2double *val_Proj_Flux);
100
101 /*!
102 * \overload
103 * \brief Compute the projection of the inviscid Jacobian matrices for the two-temperature model.
104 * \param[in] val_U - Vector conserved variables.
105 * \param[in] val_V - Vector of primitive variables.
106 * \param[in] val_dPdU - Vector of partial derivatives of pressure w.r.t. conserved vars.
107 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
108 * \param[in] val_scale - Scale of the projection.
109 * \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian.
110 */
111 void GetInviscidProjJac(const su2double *val_U, const su2double *val_V, const su2double *val_dPdU,
112 const su2double *val_normal, const su2double val_scale,
113 su2double **val_Proj_Jac_Tensor);
114
115 /*!
116 * \brief Compute the projection of the viscous fluxes into a direction.
117 * \param[in] val_primvar - Primitive variables.
118 * \param[in] val_gradprimvar - Gradient of Primitive Variables.
119 * \param[in] val_eve - Virbational-Electronical Energy.
120 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
121 * \param[in] val_diffusioncoeff - Disffusion Coefficient.
122 * \param[in] val_lam_viscosity - Laminar Viscosity
123 * \param[in] val_eddy_viscosity - Eddy Viscosity
124 * \param[in] val_thermal_conductivity - Thermal conductivity.
125 * \param[in] val_thermal_conductivity_ve - Thermal conductivity of Vibe-Elec modes.
126 * \param[in] config - Definition of the particular problem.
127 */
128 void GetViscousProjFlux(const su2double *val_primvar,
129 const su2double* const* val_gradprimvar,
130 su2double *val_eve,
131 const su2double *val_normal,
132 const su2double *val_diffusioncoeff,
133 su2double val_lam_viscosity,
134 su2double val_eddy_viscosity,
135 su2double val_therm_conductivity,
136 su2double val_therm_conductivity_ve,
137 const CConfig *config);
138
139 /*!
140 * \brief Staging function to compute viscous Jacobians.
141 * \param[in] val_Mean_PrimVar - Mean value of the primitive variables.
142 * \param[in] val_Mean_SecVar - Mean value of the secondary variables.
143 * \param[in] val_laminar_viscosity - Value of the laminar viscosity.
144 * \param[in] val_eddy_viscosity - Value of the eddy viscosity.
145 * \param[in] val_thermal_conductivity - Value of the thermal conductivity.
146 * \param[in] val_heat_capacity_cp - Value of the specific heat at constant pressure.
147 * \param[in] val_dist_ij - Distance between the points.
148 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
149 * \param[in] val_dS - Area of the face between two nodes.
150 * \param[in] val_Proj_Visc_Flux - Pointer to the projected viscous flux.
151 * \param[out] val_Proj_Jac_Tensor_i - Pointer to the projected viscous Jacobian at point i.
152 * \param[out] val_Proj_Jac_Tensor_j - Pointer to the projected viscous Jacobian at point j.
153 */
154 void GetViscousProjJacs(const su2double *val_Mean_PrimVar,
155 su2double *val_Mean_Eve, const su2double *val_Mean_Cvve,
156 const su2double *val_diffusion_coeff, su2double val_laminar_viscosity,
157 su2double val_eddy_viscosity, su2double val_thermal_conductivity,
158 su2double val_thermal_conductivity_ve,
159 su2double val_dist_ij,
160 const su2double *val_normal,
161 su2double val_dS, const su2double *val_Fv,
162 su2double **val_Jac_i, su2double **val_Jac_j,
163 const CConfig *config);
164
165 /*!
166 * \brief TSL-Approximation of Viscous NS Jacobians for arbitrary equations of state.
167 */
168 template <unsigned short NVAR, unsigned short NSPECIES>
169 void ComputeViscousJacs_impl(const su2double *val_Mean_PrimVar,
170 su2double *val_Mean_Eve,
171 const su2double *val_Mean_Cvve,
172 const su2double *val_diffusion_coeff,
173 su2double val_laminar_viscosity,
174 su2double val_eddy_viscosity,
175 su2double val_thermal_conductivity,
176 su2double val_thermal_conductivity_ve,
177 su2double val_dist_ij, const su2double *val_normal,
178 su2double val_dS, const su2double *val_Fv,
179 su2double **val_Jac_i, su2double **val_Jac_j,
180 const CConfig *config){
181
182 /*--- Initialize matrices ---*/
183 Matrix<NVAR, NVAR> dFdVi, dFdVj, dVdUi, dVdUj;
184
185 /*--- Need to avoid size of 1 otherwise the type becomes a vector (without [i][j]). ---*/
186 constexpr unsigned short nSpeciesDummy = (NSPECIES == 1) ? 2 : NSPECIES;
188 Matrix<1,NSPECIES> Ys, Ys_i, Ys_j;
189
190 /*--- Play tricks on the compiler, in static mode use NVAR from the template, in dynamic mode
191 use nVar from the class or from the arguments. ---*/
192 const auto nVar = (NVAR != DynamicSize) ? NVAR : this->nVar;
193 const auto nSpecies = (NSPECIES != DynamicSize) ? NSPECIES : this->nSpecies;
194
195 /*--- Deduce nDim from the other variables to allow the compiler to also unroll the loops over nDim. ---*/
196 const auto nDim = nVar - nSpecies - 2;
197
198 // Allocate and initialize, for the static case the compiler optimizes this away.
199 dFdVi.resize(nVar, nVar) = su2double(0.0);
200 dFdVj.resize(nVar, nVar) = su2double(0.0);
201 dVdUi.resize(nVar, nVar) = su2double(0.0);
202 dVdUj.resize(nVar, nVar) = su2double(0.0);
203 if (NSPECIES == DynamicSize) {
204 dJdr_i.resize(nSpecies,nSpecies) = su2double(0.0);
205 dJdr_j.resize(nSpecies,nSpecies) = su2double(0.0);
206 Ys.resize(1,nSpecies) = su2double(0.0);
207 Ys_i.resize(1,nSpecies) = su2double(0.0);
208 Ys_j.resize(1,nSpecies) = su2double(0.0);
209 }
210
211 /*--- Calculate preliminary geometric quantities ---*/
212 su2double dij = val_dist_ij;
213 su2double theta = GeometryToolbox::SquaredNorm(nDim, val_normal);
214
215 /*--- Rename for convenience ---*/
216 su2double rho_i = V_i[RHO_INDEX];
217 su2double rho_j = V_j[RHO_INDEX];
218 su2double T = val_Mean_PrimVar[T_INDEX];
219 su2double Tve = val_Mean_PrimVar[TVE_INDEX];
220 su2double mu = val_laminar_viscosity;
221 su2double ktr = val_thermal_conductivity;
222 su2double kve = val_thermal_conductivity_ve;
224 su2double Ru = 1000.0*RuSI;
225 const auto& Ds = val_diffusion_coeff;
226 const auto& hs = fluidmodel->ComputeSpeciesEnthalpy(T, Tve, val_Mean_Eve);
227 const auto& Cvtr = fluidmodel->GetSpeciesCvTraRot();
228 const auto& Ms = fluidmodel->GetSpeciesMolarMass();
229
230 /*--- Calculate useful diffusion parameters ---*/
231 // Mass fraction and summation of diffusion fluxes
232 su2double sumY = 0.0;
233 su2double sumY_i = 0.0;
234 su2double sumY_j = 0.0;
235 for (auto iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
236 Ys[iSpecies] = val_Mean_PrimVar[RHOS_INDEX+iSpecies];
237 Ys_i[iSpecies] = V_i[RHOS_INDEX+iSpecies]/V_i[RHO_INDEX];
238 Ys_j[iSpecies] = V_j[RHOS_INDEX+iSpecies]/V_j[RHO_INDEX];
239
240 sumY_i += Ds[iSpecies]*theta/dij*Ys_i[iSpecies];
241 sumY_j += Ds[iSpecies]*theta/dij*Ys_j[iSpecies];
242 sumY += Ds[iSpecies]*theta/dij*(Ys_j[iSpecies]-Ys_i[iSpecies]);
243 }
244
245 su2double vel[MAXNDIM];
246 for (auto iDim = 0; iDim < nDim; iDim++)
247 vel[iDim] = val_Mean_PrimVar[VEL_INDEX+iDim];
248
249 for (auto iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
250 for (auto jSpecies = 0; jSpecies < nSpecies; jSpecies++) {
251
252 // first term
253 dJdr_j[iSpecies][jSpecies] += 0.5*(Ds[iSpecies]*theta/dij *
254 (Ys_j[iSpecies]*rho_i/rho_j +
255 Ys_i[iSpecies]));
256 dJdr_i[iSpecies][jSpecies] += -0.5*(Ds[iSpecies]*theta/dij *
257 (Ys_j[iSpecies] +
258 Ys_i[iSpecies]*rho_j/rho_i));
259
260 // second term
261 dJdr_j[iSpecies][jSpecies] +=
262 0.25*(Ys_i[iSpecies] - rho_i/rho_j*Ys_j[iSpecies])*sumY
263 + 0.25*(Ys_i[iSpecies]+Ys_j[iSpecies])*(rho_i+rho_j)*Ds[jSpecies]*theta/(dij*rho_j)
264 - 0.25*(Ys_i[iSpecies]+Ys_j[iSpecies])*(rho_i+rho_j)*sumY_j/rho_j;
265
266 dJdr_i[iSpecies][jSpecies] +=
267 0.25*(-rho_j/rho_i*Ys_i[iSpecies]+Ys_j[iSpecies])*sumY
268 - 0.25*(Ys_i[iSpecies]+Ys_j[iSpecies])*(rho_i+rho_j)*Ds[jSpecies]*theta/(dij*rho_i)
269 + 0.25*(Ys_i[iSpecies]+Ys_j[iSpecies])*(rho_i+rho_j)*sumY_i/rho_i;
270 }
271
272 // first term
273 dJdr_j[iSpecies][iSpecies] += -0.5*Ds[iSpecies]*theta/dij*(1+rho_i/rho_j);
274 dJdr_i[iSpecies][iSpecies] += 0.5*Ds[iSpecies]*theta/dij*(1+rho_j/rho_i);
275
276 // second term
277 dJdr_j[iSpecies][iSpecies] += 0.25*(1.0+rho_i/rho_j)*sumY;
278 dJdr_i[iSpecies][iSpecies] += 0.25*(1.0+rho_j/rho_i)*sumY;
279 }
280
281 /*--- Calculate transformation matrix ---*/
282 for (auto iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
283 dVdUi[iSpecies][iSpecies] = 1.0;
284 dVdUj[iSpecies][iSpecies] = 1.0;
285 }
286 for (auto iDim = 0; iDim < nDim; iDim++) {
287 for (auto iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
288 dVdUi[nSpecies+iDim][iSpecies] = -V_i[VEL_INDEX+iDim]/V_i[RHO_INDEX];
289 dVdUj[nSpecies+iDim][iSpecies] = -V_j[VEL_INDEX+iDim]/V_j[RHO_INDEX];
290 }
291 dVdUi[nSpecies+iDim][nSpecies+iDim] = 1.0/V_i[RHO_INDEX];
292 dVdUj[nSpecies+iDim][nSpecies+iDim] = 1.0/V_j[RHO_INDEX];
293 }
294 for (auto iVar = 0; iVar < nVar; iVar++) {
295 dVdUi[nSpecies+nDim][iVar] = dTdU_i[iVar];
296 dVdUj[nSpecies+nDim][iVar] = dTdU_j[iVar];
297 dVdUi[nSpecies+nDim+1][iVar] = dTvedU_i[iVar];
298 dVdUj[nSpecies+nDim+1][iVar] = dTvedU_j[iVar];
299 }
300
301 if (nDim == 2) {
302
303 /*--- Geometry parameters ---*/
304 su2double thetax = theta + val_normal[0]*val_normal[0]/3.0;
305 su2double thetay = theta + val_normal[1]*val_normal[1]/3.0;
306 su2double etaz = val_normal[0]*val_normal[1]/3.0;
307 su2double pix = mu/dij * (thetax*vel[0] + etaz*vel[1] );
308 su2double piy = mu/dij * (etaz*vel[0] + thetay*vel[1]);
309
310 /*--- Populate primitive Jacobian ---*/
311
312 // X-momentum
313 dFdVj[nSpecies][nSpecies] = mu*thetax/dij*val_dS;
314 dFdVj[nSpecies][nSpecies+1] = mu*etaz/dij*val_dS;
315
316 // Y-momentum
317 dFdVj[nSpecies+1][nSpecies] = mu*etaz/dij*val_dS;
318 dFdVj[nSpecies+1][nSpecies+1] = mu*thetay/dij*val_dS;
319
320 // Energy
321 dFdVj[nSpecies+2][nSpecies] = pix*val_dS;
322 dFdVj[nSpecies+2][nSpecies+1] = piy*val_dS;
323 dFdVj[nSpecies+2][nSpecies+2] = ktr*theta/dij*val_dS;
324 dFdVj[nSpecies+2][nSpecies+3] = kve*theta/dij*val_dS;
325
326 // Vib-el Energy
327 dFdVj[nSpecies+3][nSpecies+3] = kve*theta/dij*val_dS;
328
329 for (auto iVar = 0; iVar < nVar; iVar++)
330 for (auto jVar = 0; jVar < nVar; jVar++)
331 dFdVi[iVar][jVar] = -dFdVj[iVar][jVar];
332
333 // Common terms
334 dFdVi[nSpecies+2][nSpecies] += 0.5*val_Fv[nSpecies];
335 dFdVj[nSpecies+2][nSpecies] += 0.5*val_Fv[nSpecies];
336 dFdVi[nSpecies+2][nSpecies+1] += 0.5*val_Fv[nSpecies+1];
337 dFdVj[nSpecies+2][nSpecies+1] += 0.5*val_Fv[nSpecies+1];
338 for (auto iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
339 dFdVi[nSpecies+2][nSpecies+2] += 0.5*val_Fv[iSpecies]*(Ru/Ms[iSpecies] +
340 Cvtr[iSpecies] );
341 dFdVj[nSpecies+2][nSpecies+2] += 0.5*val_Fv[iSpecies]*(Ru/Ms[iSpecies] +
342 Cvtr[iSpecies] );
343 dFdVi[nSpecies+2][nSpecies+3] += 0.5*val_Fv[iSpecies]*val_Mean_Cvve[iSpecies];
344 dFdVj[nSpecies+2][nSpecies+3] += 0.5*val_Fv[iSpecies]*val_Mean_Cvve[iSpecies];
345 dFdVi[nSpecies+3][nSpecies+3] += 0.5*val_Fv[iSpecies]*val_Mean_Cvve[iSpecies];
346 dFdVj[nSpecies+3][nSpecies+3] += 0.5*val_Fv[iSpecies]*val_Mean_Cvve[iSpecies];
347 }
348
349 // Unique terms
350 for (auto iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
351 for (auto jSpecies = 0; jSpecies < nSpecies; jSpecies++) {
352 dFdVj[iSpecies][jSpecies] += -dJdr_j[iSpecies][jSpecies]*val_dS;
353 dFdVi[iSpecies][jSpecies] += -dJdr_i[iSpecies][jSpecies]*val_dS;
354 dFdVj[nSpecies+2][iSpecies] += -dJdr_j[jSpecies][iSpecies]*hs[jSpecies]*val_dS;
355 dFdVi[nSpecies+2][iSpecies] += -dJdr_i[jSpecies][iSpecies]*hs[jSpecies]*val_dS;
356 dFdVj[nSpecies+3][iSpecies] += -dJdr_j[jSpecies][iSpecies]*val_Mean_Eve[jSpecies]*val_dS;
357 dFdVi[nSpecies+3][iSpecies] += -dJdr_i[jSpecies][iSpecies]*val_Mean_Eve[jSpecies]*val_dS;
358 }
359 }
360
361 } //nDim == 2
362 else {
363
364 /*--- Geometry parameters ---*/
365 su2double thetax = theta + val_normal[0]*val_normal[0]/3.0;
366 su2double thetay = theta + val_normal[1]*val_normal[1]/3.0;
367 su2double thetaz = theta + val_normal[2]*val_normal[2]/3.0;
368 su2double etax = val_normal[1]*val_normal[2]/3.0;
369 su2double etay = val_normal[0]*val_normal[2]/3.0;
370 su2double etaz = val_normal[0]*val_normal[1]/3.0;
371 su2double pix = mu/dij * (thetax*vel[0] + etaz*vel[1] + etay*vel[2] );
372 su2double piy = mu/dij * (etaz*vel[0] + thetay*vel[1] + etax*vel[2] );
373 su2double piz = mu/dij * (etay*vel[0] + etax*vel[1] + thetaz*vel[2]);
374
375 /*--- Populate primitive Jacobian ---*/
376
377 // X-momentum
378 dFdVj[nSpecies][nSpecies] = mu*thetax/dij*val_dS;
379 dFdVj[nSpecies][nSpecies+1] = mu*etaz/dij*val_dS;
380 dFdVj[nSpecies][nSpecies+2] = mu*etay/dij*val_dS;
381
382 // Y-momentum
383 dFdVj[nSpecies+1][nSpecies] = mu*etaz/dij*val_dS;
384 dFdVj[nSpecies+1][nSpecies+1] = mu*thetay/dij*val_dS;
385 dFdVj[nSpecies+1][nSpecies+2] = mu*etax/dij*val_dS;
386
387 // Z-momentum
388 dFdVj[nSpecies+2][nSpecies] = mu*etay/dij*val_dS;
389 dFdVj[nSpecies+2][nSpecies+1] = mu*etax/dij*val_dS;
390 dFdVj[nSpecies+2][nSpecies+2] = mu*thetaz/dij*val_dS;
391
392 // Energy
393 dFdVj[nSpecies+3][nSpecies] = pix*val_dS;
394 dFdVj[nSpecies+3][nSpecies+1] = piy*val_dS;
395 dFdVj[nSpecies+3][nSpecies+2] = piz*val_dS;
396 dFdVj[nSpecies+3][nSpecies+3] = ktr*theta/dij*val_dS;
397 dFdVj[nSpecies+3][nSpecies+4] = kve*theta/dij*val_dS;
398
399 // Vib.-el energy
400 dFdVj[nSpecies+4][nSpecies+4] = kve*theta/dij*val_dS;
401
402 for (auto iVar = 0; iVar < nVar; iVar++)
403 for (auto jVar = 0; jVar < nVar; jVar++)
404 dFdVi[iVar][jVar] = -dFdVj[iVar][jVar];
405
406 // Common terms
407 for (auto iDim = 0; iDim < nDim; iDim++) {
408 dFdVi[nSpecies+3][nSpecies+iDim] += 0.5*val_Fv[nSpecies+iDim];
409 dFdVj[nSpecies+3][nSpecies+iDim] += 0.5*val_Fv[nSpecies+iDim];
410 }
411 for (auto iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
412 dFdVi[nSpecies+3][nSpecies+3] += 0.5*val_Fv[iSpecies]*(Ru/Ms[iSpecies] +
413 Cvtr[iSpecies] );
414 dFdVj[nSpecies+3][nSpecies+3] += 0.5*val_Fv[iSpecies]*(Ru/Ms[iSpecies] +
415 Cvtr[iSpecies] );
416 dFdVi[nSpecies+3][nSpecies+4] += 0.5*val_Fv[iSpecies]*val_Mean_Cvve[iSpecies];
417 dFdVj[nSpecies+3][nSpecies+4] += 0.5*val_Fv[iSpecies]*val_Mean_Cvve[iSpecies];
418 dFdVi[nSpecies+4][nSpecies+4] += 0.5*val_Fv[iSpecies]*val_Mean_Cvve[iSpecies];
419 dFdVj[nSpecies+4][nSpecies+4] += 0.5*val_Fv[iSpecies]*val_Mean_Cvve[iSpecies];
420 }
421
422 // Unique terms
423 for (auto iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
424 for (auto jSpecies = 0; jSpecies < nSpecies; jSpecies++) {
425 dFdVj[iSpecies][jSpecies] += -dJdr_j[iSpecies][jSpecies]*val_dS;
426 dFdVi[iSpecies][jSpecies] += -dJdr_i[iSpecies][jSpecies]*val_dS;
427 dFdVj[nSpecies+3][iSpecies] += -dJdr_j[jSpecies][iSpecies]*hs[jSpecies]*val_dS;
428 dFdVi[nSpecies+3][iSpecies] += -dJdr_i[jSpecies][iSpecies]*hs[jSpecies]*val_dS;
429 dFdVj[nSpecies+4][iSpecies] += -dJdr_j[jSpecies][iSpecies]*val_Mean_Eve[jSpecies]*val_dS;
430 dFdVi[nSpecies+4][iSpecies] += -dJdr_i[jSpecies][iSpecies]*val_Mean_Eve[jSpecies]*val_dS;
431 }
432 }
433
434 } // nDim == 3
435
436 /*--- dFv/dUij = dFv/dVij * dVij/dUij ---*/
437 for (auto iVar = 0; iVar < nVar; iVar++)
438 for (auto jVar = 0; jVar < nVar; jVar++)
439 for (auto kVar = 0; kVar < nVar; kVar++) {
440 val_Jac_i[iVar][jVar] += dFdVi[iVar][kVar]*dVdUi[kVar][jVar];
441 val_Jac_j[iVar][jVar] += dFdVj[iVar][kVar]*dVdUj[kVar][jVar];
442 }
443 }
444 /*--- Template matrix creation for code optimization ---*/
445 template <int nRows, int nCols>
447
448 /*!
449 * \overload
450 * \brief Computation of the matrix P, this matrix diagonalizes the conservative Jacobians
451 * in the form $P^{-1}(A.Normal)P=Lambda$.
452 * \param[in] U - Vector of conserved variables (really only need rhoEve)
453 * \param[in] V - Vector of primitive variables
454 * \param[in] val_dPdU - Vector of derivatives of pressure w.r.t. conserved vars.
455 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
456 * \param[in] l - Tangential vector to face.
457 * \param[in] m - Tangential vector to face (mutually orthogonal to val_normal & l).
458 * \param[out] val_invp_tensor - Pointer to inverse of the P matrix.
459 */
460 void GetPMatrix(const su2double *U, const su2double *V, const su2double *val_dPdU,
461 const su2double *val_normal, const su2double *l, const su2double *m,
462 su2double **val_p_tensor) const;
463
464 /*!
465 * \overload
466 * \brief Computation of the matrix P^{-1}, this matrix diagonalizes the conservative Jacobians
467 * in the form $P^{-1}(A.Normal)P=Lambda$.
468 * \param[in] U - Vector of conserved variables.
469 * \param[in] V - Vector of primitive variables.
470 * \param[in] val_dPdU - Vector of derivatives of pressure w.r.t. conserved variables
471 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
472 * \param[in] l - Tangential vector to face.
473 * \param[in] m - Tangential vector to face (mutually orthogonal to val_normal & l).
474 * \param[out] val_invp_tensor - Pointer to inverse of the P matrix.
475 */
476 void GetPMatrix_inv(const su2double *U, const su2double *V, const su2double *val_dPdU,
477 const su2double *val_normal, const su2double *l, const su2double *m,
478 su2double **val_invp_tensor) const;
479
480
481 /*!
482 * \brief Set the pressure derivatives.
483 * \param[in] val_dPdU_i - pressure derivatives at i.
484 * \param[in] val_dPdU_j - pressure derivatives at j.
485 */
486 inline void SetdPdU(su2double *val_dPdU_i, su2double *val_dPdU_j) final { dPdU_i = val_dPdU_i; dPdU_j = val_dPdU_j; }
487
488 /*!
489 * \brief Set the temperature derivatives.
490 * \param[in] val_dTdU_i - temperature derivatives at i.
491 * \param[in] val_dTdU_j - temperature derivatives at j.
492 */
493 inline void SetdTdU(su2double *val_dTdU_i, su2double *val_dTdU_j) final { dTdU_i = val_dTdU_i; dTdU_j = val_dTdU_j; }
494
495 /*!
496 * \brief Set the vib-el temperature derivatives.
497 * \param[in] val_dTvedU_i - t_ve derivatives at i.
498 * \param[in] val_dTvedU_j - t_ve derivatives at j.
499 */
500 inline void SetdTvedU(su2double *val_dTvedU_i, su2double *val_dTvedU_j) final { dTvedU_i = val_dTvedU_i; dTvedU_j = val_dTvedU_j; }
501
502 /*!
503 * \brief Set the vib-el energy.
504 * \param[in] val_Eve_i - vib-el energy at i.
505 * \param[in] val_Eve_j - vib-el energy at j.
506 */
507 inline void SetEve(su2double *val_Eve_i, su2double *val_Eve_j) final {eve_i = val_Eve_i; eve_j = val_Eve_j; }
508
509 /*!
510 * \brief Set the Cvve.
511 * \param[in] val_Cvve_i - cvve at i.
512 * \param[in] val_Cvve_j - cvve at j.
513 */
514 inline void SetCvve(su2double *val_Cvve_i, su2double *val_Cvve_j) final {Cvve_i = val_Cvve_i; Cvve_j = val_Cvve_j; }
515
516 /*!
517 * \brief Set the ratio of specific heats.
518 * \param[in] val_Gamma_i - Gamma at i.
519 * \param[in] val_Gamma_j - Gamma at j.
520 */
521 inline void SetGamma(su2double val_Gamma_i, su2double val_Gamma_j) final {Gamma_i = val_Gamma_i; Gamma_j = val_Gamma_j; }
522
523};
A templated matrix/vector-like object.
Definition C2DContainer.hpp:374
C2DContainer & resize(const Index_t size1, const Index_t size2=1) noexcept
Request a change of size.
Definition C2DContainer.hpp:541
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
virtual vector< su2double > & ComputeSpeciesEnthalpy(su2double val_T, su2double val_Tve, su2double *val_eves)=0
Compute species enthalpies.
virtual const vector< su2double > & GetSpeciesCvTraRot()=0
Get species T-R specific heats at constant volume.
virtual const vector< su2double > & GetSpeciesMolarMass()=0
Get species molar mass.
Base class template NEMO numerics.
Definition CNEMONumerics.hpp:41
void GetInviscidProjFlux(const su2double *val_U, const su2double *val_V, const su2double *val_normal, su2double *val_Proj_Flux)
Compute the projected inviscid flux vector.
Definition CNEMONumerics.cpp:83
unsigned short P_INDEX
Definition CNEMONumerics.hpp:66
void SetdTdU(su2double *val_dTdU_i, su2double *val_dTdU_j) final
Set the temperature derivatives.
Definition CNEMONumerics.hpp:493
unsigned short A_INDEX
Definition CNEMONumerics.hpp:67
unsigned short H_INDEX
Definition CNEMONumerics.hpp:67
su2double rhoCvtr_i
Definition CNEMONumerics.hpp:47
su2double rhoCvve_j
Definition CNEMONumerics.hpp:48
su2double * eve_j
Definition CNEMONumerics.hpp:64
unsigned short LAM_VISC_INDEX
Definition CNEMONumerics.hpp:68
su2double * dTvedU_j
Definition CNEMONumerics.hpp:61
su2double Velocity_j[MAXNDIM]
Definition CNEMONumerics.hpp:45
su2double e_ve_i
Definition CNEMONumerics.hpp:46
su2double * Cvve_i
Definition CNEMONumerics.hpp:64
CNEMOGas * fluidmodel
Definition CNEMONumerics.hpp:70
su2double ** Jacobian_i
Definition CNEMONumerics.hpp:53
su2double ProjVelocity_i
Definition CNEMONumerics.hpp:49
unsigned short nPrimVarGrad
Definition CNEMONumerics.hpp:50
void GetPMatrix_inv(const su2double *U, const su2double *V, const su2double *val_dPdU, const su2double *val_normal, const su2double *l, const su2double *m, su2double **val_invp_tensor) const
Computation of the matrix P^{-1}, this matrix diagonalizes the conservative Jacobians in the form $P^...
Definition CNEMONumerics.cpp:451
unsigned short nSpecies
Definition CNEMONumerics.hpp:56
unsigned short RHOCVTR_INDEX
Definition CNEMONumerics.hpp:67
su2double * Flux
The flux / residual across the edge.
Definition CNEMONumerics.hpp:52
su2double * dTvedU_i
Definition CNEMONumerics.hpp:61
bool ionization
Definition CNEMONumerics.hpp:43
void SetGamma(su2double val_Gamma_i, su2double val_Gamma_j) final
Set the ratio of specific heats.
Definition CNEMONumerics.hpp:521
void GetViscousProjJacs(const su2double *val_Mean_PrimVar, su2double *val_Mean_Eve, const su2double *val_Mean_Cvve, const su2double *val_diffusion_coeff, su2double val_laminar_viscosity, su2double val_eddy_viscosity, su2double val_thermal_conductivity, su2double val_thermal_conductivity_ve, su2double val_dist_ij, const su2double *val_normal, su2double val_dS, const su2double *val_Fv, su2double **val_Jac_i, su2double **val_Jac_j, const CConfig *config)
Staging function to compute viscous Jacobians.
Definition CNEMONumerics.cpp:309
void ComputeViscousJacs_impl(const su2double *val_Mean_PrimVar, su2double *val_Mean_Eve, const su2double *val_Mean_Cvve, const su2double *val_diffusion_coeff, su2double val_laminar_viscosity, su2double val_eddy_viscosity, su2double val_thermal_conductivity, su2double val_thermal_conductivity_ve, su2double val_dist_ij, const su2double *val_normal, su2double val_dS, const su2double *val_Fv, su2double **val_Jac_i, su2double **val_Jac_j, const CConfig *config)
TSL-Approximation of Viscous NS Jacobians for arbitrary equations of state.
Definition CNEMONumerics.hpp:169
su2double ProjVelocity_j
Definition CNEMONumerics.hpp:49
su2double * dTdU_j
Definition CNEMONumerics.hpp:60
su2double rhoCvtr_j
Definition CNEMONumerics.hpp:47
unsigned short EDDY_VISC_INDEX
Definition CNEMONumerics.hpp:68
su2double * rhos_j
Definition CNEMONumerics.hpp:44
su2double * Cvve_j
Definition CNEMONumerics.hpp:64
void SetCvve(su2double *val_Cvve_i, su2double *val_Cvve_j) final
Set the Cvve.
Definition CNEMONumerics.hpp:514
su2double Gamma_i
Definition CNEMONumerics.hpp:62
unsigned short RHO_INDEX
Definition CNEMONumerics.hpp:67
void GetViscousProjFlux(const su2double *val_primvar, const su2double *const *val_gradprimvar, su2double *val_eve, const su2double *val_normal, const su2double *val_diffusioncoeff, su2double val_lam_viscosity, su2double val_eddy_viscosity, su2double val_therm_conductivity, su2double val_therm_conductivity_ve, const CConfig *config)
Compute the projection of the viscous fluxes into a direction.
Definition CNEMONumerics.cpp:218
su2double ** Jacobian_j
Definition CNEMONumerics.hpp:54
unsigned short RHOCVVE_INDEX
Definition CNEMONumerics.hpp:67
void GetInviscidProjJac(const su2double *val_U, const su2double *val_V, const su2double *val_dPdU, const su2double *val_normal, const su2double val_scale, su2double **val_Proj_Jac_Tensor)
Compute the projection of the inviscid Jacobian matrices for the two-temperature model.
Definition CNEMONumerics.cpp:153
unsigned short RHOS_INDEX
Definition CNEMONumerics.hpp:66
su2double rhoCvve_i
Definition CNEMONumerics.hpp:48
su2double * dPdU_i
Definition CNEMONumerics.hpp:59
su2double e_ve_j
Definition CNEMONumerics.hpp:46
void GetPMatrix(const su2double *U, const su2double *V, const su2double *val_dPdU, const su2double *val_normal, const su2double *l, const su2double *m, su2double **val_p_tensor) const
Computation of the matrix P, this matrix diagonalizes the conservative Jacobians in the form $P^{-1}(...
Definition CNEMONumerics.cpp:355
su2double Gamma_j
Definition CNEMONumerics.hpp:62
unsigned short nPrimVar
Definition CNEMONumerics.hpp:50
su2double Velocity_i[MAXNDIM]
Definition CNEMONumerics.hpp:45
su2double * eve_i
Definition CNEMONumerics.hpp:64
su2double * rhos_i
Definition CNEMONumerics.hpp:44
~CNEMONumerics(void)
Destructor of the class.
Definition CNEMONumerics.cpp:78
unsigned short TVE_INDEX
Definition CNEMONumerics.hpp:66
unsigned short T_INDEX
Definition CNEMONumerics.hpp:66
void SetEve(su2double *val_Eve_i, su2double *val_Eve_j) final
Set the vib-el energy.
Definition CNEMONumerics.hpp:507
void SetdTvedU(su2double *val_dTvedU_i, su2double *val_dTvedU_j) final
Set the vib-el temperature derivatives.
Definition CNEMONumerics.hpp:500
su2double * dTdU_i
Definition CNEMONumerics.hpp:60
bool implicit
Definition CNEMONumerics.hpp:43
unsigned short VEL_INDEX
Definition CNEMONumerics.hpp:66
su2double * dPdU_j
Definition CNEMONumerics.hpp:59
unsigned short nEl
Number of species present in plasma.
Definition CNEMONumerics.hpp:56
void SetdPdU(su2double *val_dPdU_i, su2double *val_dPdU_j) final
Set the pressure derivatives.
Definition CNEMONumerics.hpp:486
unsigned short nHeavy
Definition CNEMONumerics.hpp:56
Class for defining the numerical methods.
Definition CNumerics.hpp:48
unsigned short nVar
Number of dimensions and variables.
Definition CNumerics.hpp:52
static constexpr size_t MAXNDIM
Max number of space dimensions, used in some static arrays.
Definition CNumerics.hpp:50
const su2double * V_i
Vector of primitive variables at point i.
Definition CNumerics.hpp:122
unsigned short nDim
Definition CNumerics.hpp:52
const su2double * V_j
Vector of primitive variables at point j.
Definition CNumerics.hpp:123
passivedouble su2double
Definition code_config.hpp:181
@ DynamicSize
Definition C2DContainer.hpp:51
T SquaredNorm(Int nDim, const T *a)
Definition geometry_toolbox.hpp:73
@ V
Menter k-w SST model with vorticity production terms.
constexpr passivedouble UNIVERSAL_GAS_CONSTANT
Universal gas constant in J/(mol*K)
Definition option_structure.hpp:95