Documentation 6b54b78464
Loading...
Searching...
No Matches
CNumerics.hpp
Go to the documentation of this file.
1/*!
2 * \file CNumerics.hpp
3 * \brief Declaration of the base numerics class, the
4 * implementation is in the CNumerics.cpp file.
5 * \author F. Palacios, T. Economon
6 * \version 8.5.0 "Harrier"
7 *
8 * SU2 Project Website: https://su2code.github.io
9 *
10 * The SU2 Project is maintained by the SU2 Foundation
11 * (http://su2foundation.org)
12 *
13 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
14 *
15 * SU2 is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2.1 of the License, or (at your option) any later version.
19 *
20 * SU2 is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
27 */
28
29#pragma once
30
31#include <cmath>
32#include <iostream>
33#include <limits>
34#include <cstdlib>
35
36#include "../../../Common/include/CConfig.hpp"
37#include "../../../Common/include/linear_algebra/blas_structure.hpp"
38#include "../../../Common/include/toolboxes/geometry_toolbox.hpp"
39
40class CElement;
41class CFluidModel;
42
43/*!
44 * \class CNumerics
45 * \brief Class for defining the numerical methods.
46 * \author F. Palacios, T. Economon
47 */
48class CNumerics {
49protected:
50 static constexpr size_t MAXNDIM = 3; /*!< \brief Max number of space dimensions, used in some static arrays. */
51
52 unsigned short nDim, nVar; /*!< \brief Number of dimensions and variables. */
53 su2double Gamma; /*!< \brief Fluid's Gamma constant (ratio of specific heats). */
54 su2double Gamma_Minus_One; /*!< \brief Fluids's Gamma - 1.0 . */
55 su2double Minf; /*!< \brief Free stream Mach number . */
56 su2double Gas_Constant; /*!< \brief Gas constant. */
57 su2double Prandtl_Turb; /*!< \brief Turbulent Prandtl's number. */
58 su2double MassFlux; /*!< \brief Mass flux across edge. */
60 *Proj_Flux_Tensor; /*!< \brief Flux tensor projected in a direction. */
61 su2double **tau; /*!< \brief Viscous stress tensor. */
62 const su2double delta [3][3] = {{1.0, 0.0, 0.0},{0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}; /*!< \brief Identity matrix. */
63 const su2double
64 *Diffusion_Coeff_i, /*!< \brief Species diffusion coefficients at point i. */
65 *Diffusion_Coeff_j; /*!< \brief Species diffusion coefficients at point j. */
67 Laminar_Viscosity_i, /*!< \brief Laminar viscosity at point i. */
68 Laminar_Viscosity_j; /*!< \brief Laminar viscosity at point j. */
70 Thermal_Conductivity_i, /*!< \brief Thermal conductivity at point i. */
71 Thermal_Conductivity_j, /*!< \brief Thermal conductivity at point j. */
72 Thermal_Conductivity_ve_i, /*!< \brief vibrational-electronic Thermal conductivity at point i. */
73 Thermal_Conductivity_ve_j, /*!< \brief vibrational-electronic Thermal conductivity at point j. */
74 Cp_i, /*!< \brief Cp at point i. */
75 Cp_j; /*!< \brief Cp at point j. */
77 Eddy_Viscosity_i, /*!< \brief Eddy viscosity at point i. */
78 Eddy_Viscosity_j; /*!< \brief Eddy viscosity at point j. */
80 turb_ke_i, /*!< \brief Turbulent kinetic energy at point i. */
81 turb_ke_j; /*!< \brief Turbulent kinetic energy at point j. */
83 intermittency_eff_i, /*!< \brief effective intermittency at point i. */
84 intermittency_i; /*!< \brief intermittency at point i. */
86 Pressure_i, /*!< \brief Pressure at point i. */
87 Pressure_j; /*!< \brief Pressure at point j. */
89 Density_i, /*!< \brief Density at point i. */
90 Density_j; /*!< \brief Density at point j. */
92 DensityInc_i, /*!< \brief Incompressible density at point i. */
93 DensityInc_j; /*!< \brief Incompressible density at point j. */
95 BetaInc2_i, /*!< \brief Beta incompressible at point i. */
96 BetaInc2_j; /*!< \brief Beta incompressible at point j. */
98 Lambda_i, /*!< \brief Spectral radius at point i. */
99 Lambda_j; /*!< \brief Spectral radius at point j. */
101 SoundSpeed_i, /*!< \brief Sound speed at point i. */
102 SoundSpeed_j; /*!< \brief Sound speed at point j. */
104 Enthalpy_i, /*!< \brief Enthalpy at point i. */
105 Enthalpy_j; /*!< \brief Enthalpy at point j. */
107 dist_i, /*!< \brief Distance of point i to the nearest wall. */
108 dist_j; /*!< \brief Distance of point j to the nearest wall. */
109 const su2double
110 *Und_Lapl_i, /*!< \brief Undivided laplacians at point i. */
111 *Und_Lapl_j; /*!< \brief Undivided laplacians at point j. */
113 Sensor_i, /*!< \brief Pressure sensor at point i. */
114 Sensor_j; /*!< \brief Pressure sensor at point j. */
115 const su2double
116 *GridVel_i, /*!< \brief Grid velocity at point i. */
117 *GridVel_j; /*!< \brief Grid velocity at point j. */
118 const su2double
119 *U_i, /*!< \brief Vector of conservative variables at point i. */
120 *U_j; /*!< \brief Vector of conservative variables at point j. */
121 const su2double
122 *V_i, /*!< \brief Vector of primitive variables at point i. */
123 *V_j; /*!< \brief Vector of primitive variables at point j. */
124 const su2double
125 *S_i, /*!< \brief Vector of secondary variables at point i. */
126 *S_j; /*!< \brief Vector of secondary variables at point j. */
127 const su2double
128 *Psi_i, /*!< \brief Vector of adjoint variables at point i. */
129 *Psi_j; /*!< \brief Vector of adjoint variables at point j. */
130 const su2double
131 *ScalarVar_i, /*!< \brief Vector of scalar variables at point i. */
132 *ScalarVar_j; /*!< \brief Vector of scalar variables at point j. */
134 HeatFluxDiffusion; /*!< \brief Heat flux due to enthalpy diffusion for multicomponent. */
136 JacHeatFluxDiffusion; /*!< \brief Heat flux jacobian due to enthalpy diffusion for multicomponent. */
137 const su2double
138 *TransVar_i, /*!< \brief Vector of turbulent variables at point i. */
139 *TransVar_j; /*!< \brief Vector of turbulent variables at point j. */
140 const su2double
141 *TurbPsi_i, /*!< \brief Vector of adjoint turbulent variables at point i. */
142 *TurbPsi_j; /*!< \brief Vector of adjoint turbulent variables at point j. */
144 ConsVar_Grad_i, /*!< \brief Gradient of conservative variables at point i. */
145 ConsVar_Grad_j, /*!< \brief Gradient of conservative variables at point j. */
146 ConsVar_Grad, /*!< \brief Gradient of conservative variables which is a scalar. */
147 PrimVar_Grad_i, /*!< \brief Gradient of primitive variables at point i. */
148 PrimVar_Grad_j, /*!< \brief Gradient of primitive variables at point j. */
149 PsiVar_Grad_i, /*!< \brief Gradient of adjoint variables at point i. */
150 PsiVar_Grad_j, /*!< \brief Gradient of adjoint variables at point j. */
151 ScalarVar_Grad_i, /*!< \brief Gradient of scalar variables at point i. */
152 ScalarVar_Grad_j, /*!< \brief Gradient of scalar variables at point j. */
153 TransVar_Grad_i, /*!< \brief Gradient of turbulent variables at point i. */
154 TransVar_Grad_j, /*!< \brief Gradient of turbulent variables at point j. */
155 TurbPsi_Grad_i, /*!< \brief Gradient of adjoint turbulent variables at point i. */
156 TurbPsi_Grad_j, /*!< \brief Gradient of adjoint turbulent variables at point j. */
157 AuxVar_Grad_i, /*!< \brief Gradient of an auxiliary variable at point i. */
158 AuxVar_Grad_j; /*!< \brief Gradient of an auxiliary variable at point i. */
160 LocalGridLength_i; /*!< \brief Local grid length at point i. */
161 const su2double *RadVar_Source; /*!< \brief Source term from the radiative heat transfer equation. */
162 const su2double
163 *Coord_i, /*!< \brief Cartesians coordinates of point i. */
164 *Coord_j; /*!< \brief Cartesians coordinates of point j. */
165 unsigned short
166 Neighbor_i, /*!< \brief Number of neighbors of the point i. */
167 Neighbor_j; /*!< \brief Number of neighbors of the point j. */
168 const su2double *Normal = nullptr; /*!< \brief Normal vector, its norm is the area of the face. */
169 su2double UnitNormal[MAXNDIM] = {0.0}; /*!< \brief Unitary normal vector. */
171 TimeStep, /*!< \brief Time step useful in dual time method. */
172 Area, /*!< \brief Area of the face i-j. */
173 Volume, /*!< \brief Volume of the control volume around point i. */
174 AvgVolume; /*!< \brief Average of the control Volume around point i for vorticity confinement parameter correction */
175 su2double vel2_inf; /*!< \brief value of the square of freestream speed. */
176 const su2double
177 *WindGust_i, /*!< \brief Wind gust at point i. */
178 *WindGust_j; /*!< \brief Wind gust at point j. */
179 const su2double *Vorticity_i, *Vorticity_j; /*!< \brief Vorticity. */
180 su2double StrainMag_i, StrainMag_j; /*!< \brief Strain rate magnitude. */
181 su2double Dissipation_i, Dissipation_j; /*!< \brief Dissipation. */
183 su2double roughness_i = 0.0, /*!< \brief Roughness of the wall nearest to point i. */
184 roughness_j = 0.0; /*!< \brief Roughness of the wall nearest to point j. */
185
186 su2double MeanPerturbedRSM[3][3]; /*!< \brief Perturbed Reynolds stress tensor */
187 su2double stochReynStress[3][3] = {{0.0}}; /*!< \brief Stochastic contribution to Reynolds stress tensor for Backscatter Model. */
188 su2double stochSource[3] = {0.0}; /*!< \brief Source term for Langevin equations in Stochastic Backscatter Model. */
190 stochVar_i[3] = {0.0}, /*!< \brief Stochastic variables at point i for Stochastic Backscatter Model. */
191 stochVar_j[3] = {0.0}; /*!< \brief Stochastic variables at point j for Stochastic Backscatter Model. */
193 lesMode_i = 0.0, /*!< \brief LES sensor at point i for hybrid RANS-LES methods. */
194 lesMode_j = 0.0; /*!< \brief LES sensor at point j for hybrid RANS-LES methods. */
195 int8_t
196 sbsInBox_i = 0; /*!< \brief Sensor to assess if point i lies inside the box where the Stochastic Backscatter Model is active. */
197 SST_ParsedOptions sstParsedOptions; /*!< \brief additional options for the SST turbulence model */
198 unsigned short Eig_Val_Comp; /*!< \brief Component towards which perturbation is perfromed */
199 su2double uq_delta_b; /*!< \brief Magnitude of perturbation */
200 su2double uq_urlx; /*!< \brief Under-relaxation factor for numerical stability */
201 bool uq_permute; /*!< \brief Flag for eigenvector permutation */
202
203 bool nemo; /*!< \brief Flag for NEMO problems */
204
205 bool energy_multicomponent = false; /*!< \brief Flag for multicomponent and reacting flow */
206
207 bool bounded_scalar = false; /*!< \brief Flag for bounded scalar problem */
208
209public:
210 /*!
211 * \brief Return type used in some "ComputeResidual" overloads to give a
212 * const-view of the internally stored flux vector and Jacobians to the outside.
213 * \note The default template params make this an "all const" object, it cannot
214 * change after instantiation, nor can it be used to change the data.
215 */
216 template<class Vector_t = const su2double*,
217 class Matrix_t = const Vector_t*>
219 const Vector_t residual;
220 const Matrix_t jacobian_i;
221 const Matrix_t jacobian_j;
222
223 ResidualType() = delete;
224
225 ResidualType(const Vector_t& res, const Matrix_t& jac_i, const Matrix_t& jac_j) :
226 residual(res), jacobian_i(jac_i), jacobian_j(jac_j) { }
227
228 /*!
229 * \brief The object can be directly cast to the vector type, this
230 * allows discarding the Jacobians when they are not needed.
231 */
232 operator Vector_t() { return residual; }
233
234 su2double operator[] (unsigned long idx) const { return residual[idx]; }
235 };
236
237 /*!
238 * \brief Constructor of the class.
239 */
240 CNumerics(void);
241
242 /*!
243 * \overload
244 * \param[in] val_nDim - Number of dimensions of the problem.
245 * \param[in] val_nVar - Number of variables of the problem.
246 * \param[in] config - Definition of the particular problem.
247 */
248 CNumerics(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);
249
250 /*!
251 * \brief Destructor of the class.
252 */
253 virtual ~CNumerics(void);
254
255 /*!
256 * \brief Set the time step.
257 * \param[in] val_timestep - Value of the time step.
258 */
259 inline void SetTimeStep(su2double val_timestep) { TimeStep = val_timestep;}
260
261 /*!
262 * \brief Set the freestream velocity square.
263 * \param[in] SetVelocity2_Inf - Value of the square of the freestream velocity.
264 */
265 inline void SetVelocity2_Inf(su2double val_velocity2) { vel2_inf = val_velocity2; }
266
267 /*!
268 * \brief Set the value of the vorticity
269 * \param[in] val_vorticity - Value of the vorticity.
270 */
271 void SetVorticity(const su2double *val_vorticity_i, const su2double *val_vorticity_j) {
272 Vorticity_i = val_vorticity_i;
273 Vorticity_j = val_vorticity_j;
274 }
275
276 /*!
277 * \brief Set the value of the rate of strain magnitude.
278 * \param[in] val_StrainMag_i - Value of the magnitude of rate of strain at point i.
279 * \param[in] val_StrainMag_j - Value of the magnitude of rate of strain at point j.
280 */
281 void SetStrainMag(su2double val_strainmag_i, su2double val_strainmag_j) {
282 StrainMag_i = val_strainmag_i;
283 StrainMag_j = val_strainmag_j;
284 }
285
286 /*!
287 * \brief Set the value of the conservative variables.
288 * \param[in] val_u_i - Value of the conservative variable at point i.
289 * \param[in] val_u_j - Value of the conservative variable at point j.
290 */
291 inline void SetConservative(const su2double *val_u_i, const su2double *val_u_j) {
292 U_i = val_u_i;
293 U_j = val_u_j;
294 }
295
296 /*!
297 * \brief Set the value of the primitive variables.
298 * \param[in] val_v_i - Value of the primitive variable at point i.
299 * \param[in] val_v_j - Value of the primitive variable at point j.
300 */
301 inline void SetPrimitive(const su2double *val_v_i, const su2double *val_v_j) {
302 V_i = val_v_i;
303 V_j = val_v_j;
304 }
305
306 /*!
307 * \brief Set the value of the primitive variables.
308 * \param[in] val_v_i - Value of the primitive variable at point i.
309 * \param[in] val_v_j - Value of the primitive variable at point j.
310 */
311 inline void SetSecondary(const su2double *val_s_i, const su2double *val_s_j) {
312 S_i = val_s_i;
313 S_j = val_s_j;
314 }
315
316 /*!
317 * \brief Set the gradient of the conservative variables.
318 * \param[in] val_consvar_grad_i - Gradient of the conservative variable at point i.
319 * \param[in] val_consvar_grad_j - Gradient of the conservative variable at point j.
320 */
321 inline void SetConsVarGradient(CMatrixView<const su2double> val_consvar_grad_i,
322 CMatrixView<const su2double> val_consvar_grad_j) {
323 ConsVar_Grad_i = val_consvar_grad_i;
324 ConsVar_Grad_j = val_consvar_grad_j;
325 }
326
327 /*!
328 * \brief Set the gradient of the conservative variables.
329 * \param[in] val_consvar_grad - Gradient of the conservative variable which is a scalar.
330 */
331 inline void SetConsVarGradient(CMatrixView<const su2double> val_consvar_grad) { ConsVar_Grad = val_consvar_grad; }
332
333 /*!
334 * \brief Set the gradient of the primitive variables.
335 * \param[in] val_primvar_grad_i - Gradient of the primitive variable at point i.
336 * \param[in] val_primvar_grad_j - Gradient of the primitive variable at point j.
337 */
339 CMatrixView<const su2double> val_primvar_grad_j) {
340 PrimVar_Grad_i = val_primvar_grad_i;
341 PrimVar_Grad_j = val_primvar_grad_j;
342 }
343
344 /*!
345 * \brief Set the value of the adjoint variable.
346 * \param[in] val_psi_i - Value of the adjoint variable at point i.
347 * \param[in] val_psi_j - Value of the adjoint variable at point j.
348 */
349 inline void SetAdjointVar(const su2double *val_psi_i, const su2double *val_psi_j) {
350 Psi_i = val_psi_i;
351 Psi_j = val_psi_j;
352 }
353
354 /*!
355 * \brief Set the gradient of the adjoint variables.
356 * \param[in] val_psivar_grad_i - Gradient of the adjoint variable at point i.
357 * \param[in] val_psivar_grad_j - Gradient of the adjoint variable at point j.
358 */
360 CMatrixView<const su2double> val_psivar_grad_j) {
361 PsiVar_Grad_i = val_psivar_grad_i;
362 PsiVar_Grad_j = val_psivar_grad_j;
363 }
364
365 /*!
366 * \brief Set the value of the scalar variable.
367 * \param[in] val_scalarvar_i - Value of the scalar variable at point i.
368 * \param[in] val_scalarvar_j - Value of the scalar variable at point j.
369 */
370 inline void SetScalarVar(const su2double *val_scalarvar_i, const su2double *val_scalarvar_j) {
371 ScalarVar_i = val_scalarvar_i;
372 ScalarVar_j = val_scalarvar_j;
373 }
374
375 /*!
376 * \brief Set the value of the turbulent variable.
377 * \param[in] val_transvar_i - Value of the turbulent variable at point i.
378 * \param[in] val_transvar_j - Value of the turbulent variable at point j.
379 */
380 inline void SetTransVar(const su2double *val_transvar_i, const su2double *val_transvar_j) {
381 TransVar_i = val_transvar_i;
382 TransVar_j = val_transvar_j;
383 }
384
385 /*!
386 * \brief Set the gradient of the scalar variables.
387 * \param[in] val_scalarvar_grad_i - Gradient of the scalar variable at point i.
388 * \param[in] val_scalarvar_grad_j - Gradient of the scalar variable at point j.
389 */
390 inline void SetScalarVarGradient(CMatrixView<const su2double> val_scalarvar_grad_i,
391 CMatrixView<const su2double> val_scalarvar_grad_j) {
392 ScalarVar_Grad_i = val_scalarvar_grad_i;
393 ScalarVar_Grad_j = val_scalarvar_grad_j;
394 }
395
396 /*!
397 * \brief Set the gradient of the turbulent variables.
398 * \param[in] val_turbvar_grad_i - Gradient of the turbulent variable at point i.
399 * \param[in] val_turbvar_grad_j - Gradient of the turbulent variable at point j.
400 */
401 inline void SetTransVarGradient(CMatrixView<const su2double> val_transvar_grad_i,
402 CMatrixView<const su2double> val_transvar_grad_j) {
403 TransVar_Grad_i = val_transvar_grad_i;
404 TransVar_Grad_j = val_transvar_grad_j;
405 }
406
407 /*!
408 * \brief Set the value of the turbulent variable.
409 * \param[in] val_transvar_i - Value of the turbulent variable at point i.
410 */
411 inline void SetLocalGridLength(const su2double val_localGridLength_i) {
412 LocalGridLength_i = val_localGridLength_i;
413 }
414
415 /*!
416 * \brief Set the value of the adjoint turbulent variable.
417 * \param[in] val_turbpsivar_i - Value of the adjoint turbulent variable at point i.
418 * \param[in] val_turbpsivar_j - Value of the adjoint turbulent variable at point j.
419 */
420 inline void SetTurbAdjointVar(const su2double *val_turbpsivar_i, const su2double *val_turbpsivar_j) {
421 TurbPsi_i = val_turbpsivar_i;
422 TurbPsi_j = val_turbpsivar_j;
423 }
424
425 /*!
426 * \brief Set the gradient of the adjoint turbulent variables.
427 * \param[in] val_turbpsivar_grad_i - Gradient of the adjoint turbulent variable at point i.
428 * \param[in] val_turbpsivar_grad_j - Gradient of the adjoint turbulent variable at point j.
429 */
430 inline void SetTurbAdjointGradient(CMatrixView<const su2double> val_turbpsivar_grad_i,
431 CMatrixView<const su2double> val_turbpsivar_grad_j) {
432 TurbPsi_Grad_i = val_turbpsivar_grad_i;
433 TurbPsi_Grad_j = val_turbpsivar_grad_j;
434 }
435
436 /*!
437 * \brief Compute the mean rate of strain matrix.
438 * \details The parameter primvargrad can be e.g. PrimVar_Grad_i or Mean_GradPrimVar.
439 * \param[in] nDim - 2 or 3
440 * \param[out] rateofstrain - Rate of strain matrix
441 * \param[in] velgrad - A velocity gradient matrix.
442 * \tparam Mat1 - any type that supports the [][] interface
443 * \tparam Mat2 - any type that supports the [][] interface
444 */
445 template<class Mat1, class Mat2>
446 FORCEINLINE static void ComputeMeanRateOfStrainMatrix(size_t nDim, Mat1& rateofstrain, const Mat2& velgrad){
447
448 /* --- Calculate the rate of strain tensor, using mean velocity gradients --- */
449
450 if (nDim == 3) {
451 rateofstrain[0][0] = velgrad[0][0];
452 rateofstrain[1][1] = velgrad[1][1];
453 rateofstrain[2][2] = velgrad[2][2];
454 rateofstrain[0][1] = 0.5 * (velgrad[0][1] + velgrad[1][0]);
455 rateofstrain[0][2] = 0.5 * (velgrad[0][2] + velgrad[2][0]);
456 rateofstrain[1][2] = 0.5 * (velgrad[1][2] + velgrad[2][1]);
457 rateofstrain[1][0] = rateofstrain[0][1];
458 rateofstrain[2][1] = rateofstrain[1][2];
459 rateofstrain[2][0] = rateofstrain[0][2];
460 }
461 else { // nDim==2
462 rateofstrain[0][0] = velgrad[0][0];
463 rateofstrain[1][1] = velgrad[1][1];
464 rateofstrain[2][2] = 0.0;
465 rateofstrain[0][1] = 0.5 * (velgrad[0][1] + velgrad[1][0]);
466 rateofstrain[0][2] = 0.0;
467 rateofstrain[1][2] = 0.0;
468 rateofstrain[1][0] = rateofstrain[0][1];
469 rateofstrain[2][1] = rateofstrain[1][2];
470 rateofstrain[2][0] = rateofstrain[0][2];
471 }
472 }
473
474 /*!
475 * \brief Compute the stress tensor from the velocity gradients.
476 * \details To obtain the Reynolds stress tensor +(u_i' u_j')~, divide the result
477 * of this function by (-rho). The argument density is only used if turb_ke is not 0.
478 * To select the velocity gradient components from a primitive variable gradient PrimVar_Grad_i,
479 * write PrimVar_Grad_i+1.
480 * If <code>nDim==2</code>, we use the same formula but only only access the entries [0][0]..[1][1] of
481 * stress and velgrad. If <code>reynolds3x3</code> is true, the other non-diagonal entries of stress
482 * set to zero, and <code>stress[2][2]</code> to some value.
483 * \param[in] nDim - Dimension of the flow problem, 2 or 3
484 * \param[out] stress - Stress tensor
485 * \param[in] velgrad - A velocity gradient matrix.
486 * \param[in] viscosity - Viscosity
487 * \param[in] density - Density
488 * \param[in] turb_ke - Turbulent kinetic energy, for the turbulent stress tensor
489 * \param[in] reynolds3x3 - If true, write to the third row and column of stress even if nDim==2.
490 * \tparam Mat1 - any type that supports the [][] interface
491 * \tparam Mat2 - any type that supports the [][] interface
492 */
493 template<class Mat1, class Mat2, class Scalar>
494 FORCEINLINE static void ComputeStressTensor(size_t nDim, Mat1& stress, const Mat2& velgrad,
495 Scalar viscosity, Scalar density=0.0,
496 Scalar turb_ke=0.0, bool reynolds3x3=false){
497 Scalar divVel = 0.0;
498 for (size_t iDim = 0; iDim < nDim; iDim++) {
499 divVel += velgrad[iDim][iDim];
500 }
501 Scalar pTerm = 2./3. * (divVel * viscosity + density * turb_ke);
502
503 for (size_t iDim = 0; iDim < nDim; iDim++){
504 for (size_t jDim = 0; jDim < nDim; jDim++){
505 stress[iDim][jDim] = viscosity * (velgrad[iDim][jDim]+velgrad[jDim][iDim]);
506 }
507 stress[iDim][iDim] -= pTerm;
508 }
509
510 if(reynolds3x3 && nDim==2) { // fill the third row and column of Reynolds stress matrix
511 stress[0][2] = stress[1][2] = stress[2][0] = stress[2][1] = 0.0;
512 stress[2][2] = -pTerm;
513 }
514 }
515
516 /*!
517 * \brief Add a correction using a Quadratic Constitutive Relation to the stress tensor.
518 *
519 * See: Spalart, P. R., "Strategies for Turbulence Modelling and Simulation",
520 * International Journal of Heat and Fluid Flow, Vol. 21, 2000, pp. 252-263
521 *
522 * The QCR correction applies to the turbulent (Boussinesq) stresses only.
523 * When tau is the total (laminar + turbulent) stress tensor, which is
524 * proportional to the total viscosity, the turbulent part is recovered by
525 * scaling the correction with turb_fraction = mu_t / (mu_l + mu_t); at a
526 * no-slip wall (mu_t = 0) the correction vanishes. Pass 1 only if tau is
527 * already the turbulent stress tensor.
528 *
529 * \param[in] nDim: 2D or 3D.
530 * \param[in] gradvel: Velocity gradients.
531 * \param[in,out] tau: Shear stress tensor.
532 * \param[in] turb_fraction: Turbulent share of the viscosity in tau.
533 */
534 template <class Mat1, class Mat2, class Scalar2>
535 FORCEINLINE static void AddQCR(size_t nDim, const Mat1& gradvel, Mat2& tau, Scalar2 turb_fraction) {
536 using Scalar = typename std::decay<decltype(gradvel[0][0])>::type;
537
538 const Scalar c_cr1 = 0.3;
539
540 /*--- Denominator Antisymmetric normalized rotation tensor ---*/
541
542 Scalar factor = 0.0;
543 for (size_t iDim = 0; iDim < nDim; iDim++)
544 for (size_t jDim = 0; jDim < nDim; jDim++)
545 factor += gradvel[iDim][jDim] * gradvel[iDim][jDim];
546 factor = 1.0 / sqrt(max(factor,1E-10));
547
548 /*--- Adding the QCR contribution ---*/
549
550 Scalar tauQCR[MAXNDIM][MAXNDIM] = {{0.0}};
551
552 for (size_t iDim = 0; iDim < nDim; iDim++){
553 for (size_t jDim = 0; jDim < nDim; jDim++){
554 for (size_t kDim = 0; kDim < nDim; kDim++){
555 Scalar O_ik = (gradvel[iDim][kDim] - gradvel[kDim][iDim]) * factor;
556 Scalar O_jk = (gradvel[jDim][kDim] - gradvel[kDim][jDim]) * factor;
557 tauQCR[iDim][jDim] += O_ik * tau[jDim][kDim] + O_jk * tau[iDim][kDim];
558 }
559 }
560 }
561
562 for (size_t iDim = 0; iDim < nDim; iDim++)
563 for (size_t jDim = 0; jDim < nDim; jDim++)
564 tau[iDim][jDim] -= turb_fraction * c_cr1 * tauQCR[iDim][jDim];
565 }
566
567 /*!
568 * \brief Perturb the Reynolds stress tensor based on parameters.
569 * \param[in] nDim - Dimension of the flow problem, 2 or 3.
570 * \param[in] uq_eigval_comp - Component 1C 2C 3C.
571 * \param[in] uq_permute - Whether to swap order of eigen vectors.
572 * \param[in] uq_delta_b - Delta_b parameter.
573 * \param[in] uq_urlx - Relaxation factor.
574 * \param[in] velgrad - A velocity gradient matrix.
575 * \param[in] density - Density.
576 * \param[in] viscosity - Eddy viscosity.
577 * \param[in] turb_ke: Turbulent kinetic energy.
578 * \param[out] MeanPerturbedRSM - Perturbed stress tensor.
579 */
580 template<class Mat1, class Mat2, class Scalar>
581 NEVERINLINE static void ComputePerturbedRSM(size_t nDim, size_t uq_eigval_comp, bool uq_permute, su2double uq_delta_b,
582 su2double uq_urlx, const Mat1& velgrad, Scalar density,
583 Scalar viscosity, Scalar turb_ke, Mat2& MeanPerturbedRSM) {
584 Scalar MeanReynoldsStress[3][3] = {{}};
585 ComputeStressTensor(nDim, MeanReynoldsStress, velgrad, viscosity, density, turb_ke, true);
586 for (size_t iDim = 0; iDim < 3; iDim++)
587 for (size_t jDim = 0; jDim < 3; jDim++)
588 MeanReynoldsStress[iDim][jDim] /= -density;
589
590 /* --- Calculate anisotropic part of Reynolds Stress tensor --- */
591
592 Scalar A_ij[3][3];
593 for (size_t iDim = 0; iDim < 3; iDim++) {
594 for (size_t jDim = 0; jDim < 3; jDim++) {
595 A_ij[iDim][jDim] = .5 * MeanReynoldsStress[iDim][jDim] / turb_ke;
596 }
597 A_ij[iDim][iDim] -= 1.0/3.0;
598 }
599
600 /* --- Get ordered eigenvectors and eigenvalues of A_ij --- */
601
602 Scalar work[3], Eig_Vec[3][3], Eig_Val[3];
603 CBlasStructure::EigenDecomposition(A_ij, Eig_Vec, Eig_Val, 3, work);
604
605 /* compute convex combination coefficients */
606 Scalar c1c = Eig_Val[2] - Eig_Val[1];
607 Scalar c2c = 2.0 * (Eig_Val[1] - Eig_Val[0]);
608 Scalar c3c = 3.0 * Eig_Val[0] + 1.0;
609
610 /* define barycentric traingle corner points */
611 Scalar Corners[3][2];
612 Corners[0][0] = 1.0;
613 Corners[0][1] = 0.0;
614 Corners[1][0] = 0.0;
615 Corners[1][1] = 0.0;
616 Corners[2][0] = 0.5;
617 Corners[2][1] = 0.866025;
618
619 /* define barycentric coordinates */
620 Scalar Barycentric_Coord[2];
621 Barycentric_Coord[0] = Corners[0][0] * c1c + Corners[1][0] * c2c + Corners[2][0] * c3c;
622 Barycentric_Coord[1] = Corners[0][1] * c1c + Corners[1][1] * c2c + Corners[2][1] * c3c;
623
624 /* component 1C, 2C, 3C, converted to index of the "corners" */
625 Scalar New_Coord[2];
626 New_Coord[0] = Corners[uq_eigval_comp-1][0];
627 New_Coord[1] = Corners[uq_eigval_comp-1][1];
628
629 /* calculate perturbed barycentric coordinates */
630 Barycentric_Coord[0] = Barycentric_Coord[0] + (uq_delta_b) * (New_Coord[0] - Barycentric_Coord[0]);
631 Barycentric_Coord[1] = Barycentric_Coord[1] + (uq_delta_b) * (New_Coord[1] - Barycentric_Coord[1]);
632
633 /* rebuild c1c,c2c,c3c based on perturbed barycentric coordinates */
634 c3c = Barycentric_Coord[1] / Corners[2][1];
635 c1c = Barycentric_Coord[0] - Corners[2][0] * c3c;
636 c2c = 1 - c1c - c3c;
637
638 /* build new anisotropy eigenvalues */
639 Eig_Val[0] = (c3c - 1) / 3.0;
640 Eig_Val[1] = 0.5 *c2c + Eig_Val[0];
641 Eig_Val[2] = c1c + Eig_Val[1];
642
643 /* permute eigenvectors if required */
644 if (uq_permute) {
645 for (size_t jDim = 0; jDim < 3; jDim++)
646 swap(Eig_Vec[0][jDim], Eig_Vec[2][jDim]);
647 }
648
649 CBlasStructure::EigenRecomposition(A_ij, Eig_Vec, Eig_Val, 3);
650
651 /* compute perturbed Reynolds stress matrix; using under-relaxation factor (uq_urlx)*/
652 for (size_t iDim = 0; iDim < 3; iDim++) {
653 for (size_t jDim = 0; jDim < 3; jDim++) {
654 auto delta_ij = (jDim==iDim)? 1.0 : 0.0;
655 MeanPerturbedRSM[iDim][jDim] = 2.0 * turb_ke * (A_ij[iDim][jDim] + 1.0/3.0 * delta_ij);
656 MeanPerturbedRSM[iDim][jDim] = MeanReynoldsStress[iDim][jDim] +
657 uq_urlx*(MeanPerturbedRSM[iDim][jDim] - MeanReynoldsStress[iDim][jDim]);
658 }
659 }
660 }
661
662 /*!
663 * \brief Compute a random contribution to the Reynolds stress tensor (Stochastic Backscatter Model).
664 * \details See: Kok, Johan C. "A stochastic backscatter model for grey-area mitigation in detached
665 * eddy simulations." Flow, Turbulence and Combustion 99.1 (2017): 119-150.
666 * \param[in] nDim - Dimension of the flow problem, 2 or 3.
667 * \param[in] density - Density.
668 * \param[in] tke - Turbulent kinetic energy.
669 * \param[in] rndVec - Vector of stochastic variables from Langevin equations.
670 * \param[in] Cmag - Stochastic backscatter intensity coefficient.
671 * \param[out] stochReynStress - Stochastic tensor (to be added to the Reynolds stress tensor).
672 */
673 template<class Vec, class Mat>
674 inline void ComputeStochReynStress(su2double density, su2double tke, const Vec& rndVec,
675 su2double Cmag, Mat& stochReynStress) {
676
677 /* --- Calculate stochastic tensor --- */
678
679 su2double stochLim = 3.0;
680
681 stochReynStress[0][0] = 0.0;
682 stochReynStress[1][1] = 0.0;
683 stochReynStress[2][2] = 0.0;
684 stochReynStress[0][1] = - Cmag * density * tke * max(-stochLim, min(stochLim, rndVec[2]));
685 stochReynStress[0][2] = + Cmag * density * tke * max(-stochLim, min(stochLim, rndVec[1]));
686 stochReynStress[1][2] = - Cmag * density * tke * max(-stochLim, min(stochLim, rndVec[0]));
687 stochReynStress[1][0] = - stochReynStress[0][1];
688 stochReynStress[2][0] = - stochReynStress[0][2];
689 stochReynStress[2][1] = - stochReynStress[1][2];
690
691 }
692
693 /*!
694 * \brief Compute relaxation factor for stochastic source term in momentum equations (Stochastic Backscatter Model).
695 * \param[in] config - Definition of the particular problem.
696 * \param[out] intensityCoeff - Relaxation factor for backscatter intensity.
697 */
699
700 su2double SBS_Cmag = config->GetSBSParam().SBS_Cmag;
701 su2double intensityCoeff = SBS_Cmag;
702 su2double SBS_RelaxFactor = config->GetSBSParam().stochSourceRelax;
703 if (SBS_RelaxFactor > 0.0) {
704 su2double FS_Vel = config->GetModVel_FreeStream();
705 su2double ReynoldsLength = config->GetLength_Reynolds();
706 su2double timeScale = ReynoldsLength / FS_Vel;
707 unsigned long timeIter = config->GetTimeIter();
708 unsigned long restartIter = config->GetRestart_Iter();
709 su2double timeStep = config->GetTime_Step();
710 su2double currentTime = (timeIter - restartIter) * timeStep;
711 intensityCoeff = SBS_Cmag * (1.0 - exp(- currentTime / (timeScale*SBS_RelaxFactor)));
712 }
713 return intensityCoeff;
714
715 }
716
717 /*!
718 * \brief Project average gradient onto normal (with or w/o correction) for viscous fluxes of scalar quantities.
719 * \param[in] nDim - Dimension of the flow problem, 2 or 3.
720 * \param[in] nVar - Number of variables.
721 * \param[in] normal - Area vector.
722 * \param[in] coord_i - Coordinate of point i.
723 * \param[in] coord_j - Coordinate of point j.
724 * \param[in] grad_i - Gradient at point i.
725 * \param[in] grad_j - Gradient at point j.
726 * \param[in] correct - Correct
727 * \param[in] var_i - Variable at point i.
728 * \param[in] var_j - Variable at point j.
729 * \param[out] projNormal - Average gradient projected on normal.
730 * \param[out] projCorrected - Corrected gradient projected on normal.
731 * \return (Edge_Vector DOT normal) / |Edge_Vector|^2.
732 */
733 template<class Vec1, class Vec2, class Mat>
734 FORCEINLINE static su2double ComputeProjectedGradient(int nDim, int nVar, const Vec1& normal,
735 const Vec1& coord_i, const Vec1& coord_j,
736 const Mat& grad_i, const Mat& grad_j,
737 bool correct,
738 const Vec2& var_i, const Vec2& var_j,
739 su2double* projNormal,
740 su2double* projCorrected) {
741 assert(nDim == 2 || nDim == 3);
742 nDim = (nDim > 2)? 3 : 2;
743 su2double edgeVec[MAXNDIM], dist_ij_2 = 0.0, proj_vector_ij = 0.0;
744
745 for (int iDim = 0; iDim < nDim; iDim++) {
746 edgeVec[iDim] = coord_j[iDim] - coord_i[iDim];
747 dist_ij_2 += pow(edgeVec[iDim], 2);
748 proj_vector_ij += edgeVec[iDim] * normal[iDim];
749 }
750 proj_vector_ij /= max(dist_ij_2,EPS);
751
752 /*--- Mean gradient approximation. ---*/
753 for (int iVar = 0; iVar < nVar; iVar++) {
754 projNormal[iVar] = 0.0;
755 su2double edgeProj = 0.0;
756
757 for (int iDim = 0; iDim < nDim; iDim++) {
758 su2double meanGrad = 0.5 * (grad_i[iVar][iDim] + grad_j[iVar][iDim]);
759 projNormal[iVar] += meanGrad * normal[iDim];
760 if (correct) edgeProj += meanGrad * edgeVec[iDim];
761 }
762
763 projCorrected[iVar] = projNormal[iVar];
764 if (correct) projCorrected[iVar] -= (edgeProj - (var_j[iVar]-var_i[iVar])) * proj_vector_ij;
765 }
766
767 return proj_vector_ij;
768 }
769
770 /*!
771 * \brief Set the value of the first blending function.
772 * \param[in] val_F1_i - Value of the first Menter blending function at point i.
773 * \param[in] val_F1_j - Value of the first Menter blending function at point j.
774 */
775 virtual void SetF1blending(su2double val_F1_i, su2double val_F1_j) {/* empty */};
776
777 /*!
778 * \brief Set the value of the second blending function.
779 * \param[in] val_F2_i - Value of the second Menter blending function at point i.
780 */
781 virtual void SetF2blending(su2double val_F2_i) {/* empty */};
782
783 /*!
784 * \brief Set the value of the cross diffusion for the SST model.
785 * \param[in] val_CDkw_i - Value of the cross diffusion at point i.
786 */
787 virtual void SetCrossDiff(su2double val_CDkw_i) {/* empty */};
788
789 /*!
790 * \brief Set the value of the effective intermittency for the LM model.
791 * \param[in] intermittency_eff_i - Value of the effective intermittency at point i.
792 */
793 void SetIntermittencyEff(su2double val_intermittency_eff_i) {
794 intermittency_eff_i = val_intermittency_eff_i;
795 }
796
797 /*!
798 * \brief Set the value of the intermittency for the LM model.
799 * \param[in] intermittency_i - Value of the intermittency at point i.
800 */
801 void SetIntermittency(su2double val_intermittency_i) {
802 intermittency_i = val_intermittency_i;
803 }
804
805 /*!
806 * \brief Get the value of the effective intermittency for the transition model.
807 * \param[in] intermittency_eff_i - Value of the effective intermittency at point i.
808 */
810
811 /*!
812 * \brief Set the gradient of the auxiliary variables.
813 * \param[in] val_auxvar_grad_i - Gradient of the auxiliary variable at point i.
814 * \param[in] val_auxvar_grad_j - Gradient of the auxiliary variable at point j.
815 */
816 inline void SetAuxVarGrad(CMatrixView<const su2double> val_auxvar_grad_i,
817 CMatrixView<const su2double> val_auxvar_grad_j) {
818 AuxVar_Grad_i = val_auxvar_grad_i;
819 AuxVar_Grad_j = val_auxvar_grad_j;
820 }
821
822 /*!
823 * \brief Set the diffusion coefficient
824 * \param[in] val_diffusioncoeff_i - Value of the diffusion coefficients at i.
825 * \param[in] val_diffusioncoeff_j - Value of the diffusion coefficients at j
826 */
827 inline void SetDiffusionCoeff(const su2double* val_diffusioncoeff_i,
828 const su2double* val_diffusioncoeff_j) {
829 Diffusion_Coeff_i = val_diffusioncoeff_i;
830 Diffusion_Coeff_j = val_diffusioncoeff_j;
831 }
832
833 /*!
834 * \brief Set the heat flux due to enthalpy diffusion
835 * \param[in] val_heatfluxdiffusion - Value of the heat flux due to enthalpy diffusion.
836 */
837 inline void SetHeatFluxDiffusion(su2double val_heatfluxdiffusion) { HeatFluxDiffusion = val_heatfluxdiffusion; }
838
839 /*!
840 * \brief Set Jacobian of the heat flux due to enthalpy diffusion
841 * \param[in] val_jacheatfluxdiffusion - Value of the heat flux jacobian due to enthalpy diffusion.
842 */
843 inline void SetJacHeatFluxDiffusion(su2double val_jacheatfluxdiffusion) {
844 JacHeatFluxDiffusion = val_jacheatfluxdiffusion;
845 }
846
847 /*!
848 * \brief Set the laminar viscosity.
849 * \param[in] val_laminar_viscosity_i - Value of the laminar viscosity at point i.
850 * \param[in] val_laminar_viscosity_j - Value of the laminar viscosity at point j.
851 */
852 inline void SetLaminarViscosity(su2double val_laminar_viscosity_i,
853 su2double val_laminar_viscosity_j) {
854 Laminar_Viscosity_i = val_laminar_viscosity_i;
855 Laminar_Viscosity_j = val_laminar_viscosity_j;
856 }
857
858 /*!
859 * \brief Set the thermal conductivity (translational/rotational)
860 * \param[in] val_thermal_conductivity_i - Value of the thermal conductivity at point i.
861 * \param[in] val_thermal_conductivity_j - Value of the thermal conductivity at point j.
862 * \param[in] iSpecies - Value of the species.
863 */
864 inline void SetThermalConductivity(su2double val_thermal_conductivity_i,
865 su2double val_thermal_conductivity_j) {
866 Thermal_Conductivity_i = val_thermal_conductivity_i;
867 Thermal_Conductivity_j = val_thermal_conductivity_j;
868 }
869
870 /*!
871 * \brief Set the thermal conductivity (translational/rotational)
872 * \param[in] val_thermal_conductivity_i - Value of the thermal conductivity at point i.
873 * \param[in] val_thermal_conductivity_j - Value of the thermal conductivity at point j.
874 * \param[in] iSpecies - Value of the species.
875 */
876 inline void SetThermalConductivity_ve(su2double val_thermal_conductivity_ve_i,
877 su2double val_thermal_conductivity_ve_j) {
878 Thermal_Conductivity_ve_i = val_thermal_conductivity_ve_i;
879 Thermal_Conductivity_ve_j = val_thermal_conductivity_ve_j;
880 }
881
882 /*!
883 * \brief Set the specifc heat c_p.
884 * \param[in] val_specific_heat_i - Value of the specific heat at point i.
885 * \param[in] val_specific_heat_j - Value of the specific heat at point j.
886 */
887 inline void SetSpecificHeat(su2double val_specific_heat_i,
888 su2double val_specific_heat_j) {
889 Cp_i = val_specific_heat_i;
890 Cp_j = val_specific_heat_j;
891 }
892
893 /*!
894 * \brief Set the eddy viscosity.
895 * \param[in] val_eddy_viscosity_i - Value of the eddy viscosity at point i.
896 * \param[in] val_eddy_viscosity_j - Value of the eddy viscosity at point j.
897 */
898 inline void SetEddyViscosity(su2double val_eddy_viscosity_i,
899 su2double val_eddy_viscosity_j) {
900 Eddy_Viscosity_i = val_eddy_viscosity_i;
901 Eddy_Viscosity_j = val_eddy_viscosity_j;
902 }
903
904 /*!
905 * \brief Set the turbulent kinetic energy.
906 * \param[in] val_turb_ke_i - Value of the turbulent kinetic energy at point i.
907 * \param[in] val_turb_ke_j - Value of the turbulent kinetic energy at point j.
908 */
909 inline void SetTurbKineticEnergy(su2double val_turb_ke_i, su2double val_turb_ke_j) {
910 turb_ke_i = val_turb_ke_i;
911 turb_ke_j = val_turb_ke_j;
912 }
913
914 /*!
915 * \brief Set the stochastic variables from Langevin equations (Stochastic Backscatter Model).
916 * \param[in] val_stochvar_i - Value of the stochastic variable at point i.
917 * \param[in] val_stochvar_j - Value of the stochastic variable at point j.
918 * \param[in] iDim - Index of Langevin equation.
919 */
920 inline void SetStochVar(unsigned short iDim, su2double val_stochvar_i, su2double val_stochvar_j) {
921 stochVar_i[iDim] = val_stochvar_i;
922 stochVar_j[iDim] = val_stochvar_j;
923 }
924
925 /*!
926 * \brief Set the sensor to locate the box where the Stochastic Backscatter Model is active.
927 * \param[in] val_sbsInBox_i - 1 if point i lies inside the box where the model is active.
928 */
929 inline void SetSbsInBoxSensor(int8_t val_sbsInBox_i) {
930 sbsInBox_i = val_sbsInBox_i;
931 }
932
933 /*!
934 * \brief Set the LES sensor for hybrid RANS-LES methods.
935 * \param[in] val_lesMode_i - Value of the LES sensor at point i.
936 * \param[in] val_lesMode_j - Value of the LES sensor at point j.
937 */
938 inline void SetLES_Mode(su2double val_lesMode_i, su2double val_lesMode_j) {
939 lesMode_i = val_lesMode_i;
940 lesMode_j = val_lesMode_j;
941 }
942
943 /*!
944 * \brief Set the value of the distance from the nearest wall.
945 * \param[in] val_dist_i - Value of of the distance from point i to the nearest wall.
946 * \param[in] val_dist_j - Value of of the distance from point j to the nearest wall.
947 */
948 void SetDistance(su2double val_dist_i, su2double val_dist_j) {
949 dist_i = val_dist_i;
950 dist_j = val_dist_j;
951 }
952
953 /*!
954 * \brief Set the stochastic source term for the Langevin equations (Backscatter Model).
955 * \param[in] val_stoch_source - Value of stochastic source term.
956 * \param[in] iDim - Index of Langevin equation.
957 */
958 void SetStochSource(su2double val_stoch_source, unsigned short iDim) {
959 stochSource[iDim] = val_stoch_source;
960 }
961
962 /*!
963 * \brief Set the value of the roughness from the nearest wall.
964 * \param[in] val_dist_i - Value of of the roughness of the nearest wall from point i
965 * \param[in] val_dist_j - Value of of the roughness of the nearest wall from point j
966 */
967 void SetRoughness(su2double val_roughness_i, su2double val_roughness_j) {
968 roughness_i = val_roughness_i;
969 roughness_j = val_roughness_j;
970 }
971
972 /*!
973 * \brief Set coordinates of the points.
974 * \param[in] val_coord_i - Coordinates of the point i.
975 * \param[in] val_coord_j - Coordinates of the point j.
976 */
977 inline void SetCoord(const su2double *val_coord_i, const su2double *val_coord_j) {
978 Coord_i = val_coord_i;
979 Coord_j = val_coord_j;
980 }
981
982 /*!
983 * \brief Set the velocity of the computational grid.
984 * \param[in] val_gridvel_i - Grid velocity of the point i.
985 * \param[in] val_gridvel_j - Grid velocity of the point j.
986 */
987 inline void SetGridVel(const su2double *val_gridvel_i, const su2double *val_gridvel_j) {
988 GridVel_i = val_gridvel_i;
989 GridVel_j = val_gridvel_j;
990 }
991
992 /*!
993 * \brief Set the value of the pressure.
994 * \param[in] val_pressure_i - Value of the pressure at point i.
995 * \param[in] val_pressure_j - Value of the pressure at point j.
996 */
997 void SetPressure(su2double val_pressure_i, su2double val_pressure_j) {
998 Pressure_i = val_pressure_i;
999 Pressure_j = val_pressure_j;
1000 }
1001
1002 /*!
1003 * \brief Set the value of the density for the incompressible solver.
1004 * \param[in] val_densityinc_i - Value of the pressure at point i.
1005 * \param[in] val_densityinc_j - Value of the pressure at point j.
1006 */
1007 void SetDensity(su2double val_densityinc_i, su2double val_densityinc_j) {
1008 DensityInc_i = val_densityinc_i;
1009 DensityInc_j = val_densityinc_j;
1010 }
1011
1012 /*!
1013 * \brief Set the value of the beta for incompressible flows.
1014 * \param[in] val_betainc2_i - Value of beta for incompressible flows at point i.
1015 * \param[in] val_betainc2_j - Value of beta for incompressible flows at point j.
1016 */
1017 inline void SetBetaInc2(su2double val_betainc2_i, su2double val_betainc2_j) {
1018 BetaInc2_i = val_betainc2_i;
1019 BetaInc2_j = val_betainc2_j;
1020 }
1021
1022 /*!
1023 * \brief Set the value of the sound speed.
1024 * \param[in] val_soundspeed_i - Value of the sound speed at point i.
1025 * \param[in] val_soundspeed_j - Value of the sound speed at point j.
1026 */
1027 inline void SetSoundSpeed(su2double val_soundspeed_i, su2double val_soundspeed_j) {
1028 SoundSpeed_i = val_soundspeed_i;
1029 SoundSpeed_j = val_soundspeed_j;
1030 }
1031
1032 /*!
1033 * \brief Set the value of the enthalpy.
1034 * \param[in] val_enthalpy_i - Value of the enthalpy at point i.
1035 * \param[in] val_enthalpy_j - Value of the enthalpy at point j.
1036 */
1037 inline void SetEnthalpy(su2double val_enthalpy_i, su2double val_enthalpy_j) {
1038 Enthalpy_i = val_enthalpy_i;
1039 Enthalpy_j = val_enthalpy_j;
1040 }
1041
1042 /*!
1043 * \brief Set the value of the spectral radius.
1044 * \param[in] val_lambda_i - Value of the spectral radius at point i.
1045 * \param[in] val_lambda_j - Value of the spectral radius at point j.
1046 */
1047 inline void SetLambda(su2double val_lambda_i, su2double val_lambda_j) {
1048 Lambda_i = val_lambda_i;
1049 Lambda_j = val_lambda_j;
1050 }
1051
1052 /*!
1053 * \brief Set the value of undivided laplacian.
1054 * \param[in] val_und_lapl_i Undivided laplacian at point i.
1055 * \param[in] val_und_lapl_j Undivided laplacian at point j.
1056 */
1057 inline void SetUndivided_Laplacian(const su2double *val_und_lapl_i, const su2double *val_und_lapl_j) {
1058 Und_Lapl_i = val_und_lapl_i;
1059 Und_Lapl_j = val_und_lapl_j;
1060 }
1061
1062 /*!
1063 * \brief Set the value of the pressure sensor.
1064 * \param[in] val_sensor_i Pressure sensor at point i.
1065 * \param[in] val_sensor_j Pressure sensor at point j.
1066 */
1067 inline void SetSensor(su2double val_sensor_i, su2double val_sensor_j) {
1068 Sensor_i = val_sensor_i;
1069 Sensor_j = val_sensor_j;
1070 }
1071
1072 /*!
1073 * \brief Set the number of neighbor to a point.
1074 * \param[in] val_neighbor_i - Number of neighbor to point i.
1075 * \param[in] val_neighbor_j - Number of neighbor to point j.
1076 */
1077 inline void SetNeighbor(unsigned short val_neighbor_i, unsigned short val_neighbor_j) {
1078 Neighbor_i = val_neighbor_i;
1079 Neighbor_j = val_neighbor_j;
1080 }
1081
1082 /*!
1083 * \brief Set the value of the normal vector to the face between two points.
1084 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
1085 */
1086 inline void SetNormal(const su2double *val_normal) { Normal = val_normal; }
1087
1088 /*!
1089 * \brief Set the value of the volume of the control volume.
1090 * \param[in] val_volume Volume of the control volume.
1091 */
1092 inline void SetVolume(su2double val_volume) { Volume = val_volume; }
1093
1094 /*!
1095 * \brief Set the value of AvgVolume Variable.
1096 * \param[in] val_avgvolume AvgVolume Variable.
1097 */
1098 inline void SetAvgVolume(su2double val_avgvolume) { AvgVolume = val_avgvolume; }
1099
1100 /*!
1101 * \brief Sets the values of the roe dissipation.
1102 * \param[in] diss_i - Dissipation value at node i
1103 * \param[in] diss_j - Dissipation value at node j
1104 */
1105 inline void SetDissipation(su2double diss_i, su2double diss_j) {
1106 Dissipation_i = diss_i;
1107 Dissipation_j = diss_j;
1108 }
1109
1110 /*!
1111 * \brief Get the final Roe dissipation factor.
1112 */
1113 inline su2double GetDissipation() const { return Dissipation_ij; }
1114
1115 /*!
1116 * \brief Compute the projected inviscid flux vector.
1117 * \param[in] val_density - Pointer to the density.
1118 * \param[in] val_velocity - Pointer to the velocity.
1119 * \param[in] val_pressure - Pointer to the pressure.
1120 * \param[in] val_enthalpy - Pointer to the enthalpy.
1121 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
1122 * \param[out] val_Proj_Flux - Pointer to the projected flux.
1123 */
1124 void GetInviscidProjFlux(const su2double *val_density, const su2double *val_velocity,
1125 const su2double *val_pressure, const su2double *val_enthalpy,
1126 const su2double *val_normal, su2double *val_Proj_Flux) const;
1127
1128 /*!
1129 * \brief Compute the projected inviscid flux vector for incompresible simulations
1130 * \param[in] val_density - Pointer to the density.
1131 * \param[in] val_velocity - Pointer to the velocity.
1132 * \param[in] val_pressure - Pointer to the pressure.
1133 * \param[in] val_betainc2 - Value of the artificial compresibility factor.
1134 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
1135 * \param[out] val_Proj_Flux - Pointer to the projected flux.
1136 */
1137 void GetInviscidIncProjFlux(const su2double *val_density, const su2double *val_velocity,
1138 const su2double *val_pressure, const su2double *val_betainc2,
1139 const su2double *val_enthalpy, const su2double *val_normal,
1140 su2double *val_Proj_Flux) const;
1141
1142 /*!
1143 * \brief Compute the projection of the inviscid Jacobian matrices.
1144 * \param[in] val_velocity Pointer to the velocity.
1145 * \param[in] val_energy Value of the energy.
1146 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
1147 * \param[in] val_scale - Scale of the projection.
1148 * \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian.
1149 */
1150 void GetInviscidProjJac(const su2double *val_velocity, const su2double *val_energy,
1151 const su2double *val_normal, su2double val_scale,
1152 su2double **val_Proj_Jac_tensor) const;
1153
1154 /*!
1155 * \brief Compute the projection of the inviscid Jacobian matrices (incompressible).
1156 * \param[in] val_density - Value of the density.
1157 * \param[in] val_velocity - Pointer to the velocity.
1158 * \param[in] val_betainc2 - Value of the artificial compresibility factor.
1159 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
1160 * \param[in] val_scale - Scale of the projection.
1161 * \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian.
1162 */
1163 void GetInviscidIncProjJac(const su2double *val_density, const su2double *val_velocity,
1164 const su2double *val_betainc2, const su2double *val_normal,
1165 su2double val_scale,
1166 su2double **val_Proj_Jac_tensor);
1167
1168 /*!
1169 * \brief Compute the projection of the inviscid Jacobian matrices (overload for low speed preconditioner version).
1170 * \param[in] val_density - Value of the density.
1171 * \param[in] val_velocity - Pointer to the velocity.
1172 * \param[in] val_betainc2 - Value of the artificial compresibility factor.
1173 * \param[in] val_enthalpy - Value of the enthalpy.
1174 * \param[in] val_dRhodh - Value of the derivative of density w.r.t. enthalpy.
1175 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
1176 * \param[in] val_scale - Scale of the projection.
1177 * \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian.
1178 */
1179 void GetInviscidIncProjJac(const su2double *val_density,
1180 const su2double *val_velocity,
1181 const su2double *val_betainc2,
1182 const su2double *val_enthalpy,
1183 const su2double *val_dRhodh,
1184 const su2double *val_normal,
1185 su2double val_scale,
1186 su2double **val_Proj_Jac_Tensor) const;
1187
1188 /*!
1189 * \brief Compute the low speed preconditioning matrix.
1190 * \param[in] val_density - Value of the density.
1191 * \param[in] val_velocity - Pointer to the velocity.
1192 * \param[in] val_betainc2 - Value of the artificial compresibility factor.
1193 * \param[in] val_enthalpy - Value of the enthalpy.
1194 * \param[in] val_dRhodh - Value of the derivative of density w.r.t. enthalpy.
1195 * \param[out] val_Precon - Pointer to the preconditioning matrix.
1196 */
1197 void GetPreconditioner(const su2double *val_density,
1198 const su2double *val_velocity,
1199 const su2double *val_betainc2,
1200 const su2double *val_enthalpy,
1201 const su2double *val_drhodh,
1202 su2double **val_Precon) const;
1203
1204 /*!
1205 * \brief Compute the projection of the preconditioned inviscid Jacobian matrices.
1206 * \param[in] val_density - Value of the density.
1207 * \param[in] val_velocity - Pointer to the velocity.
1208 * \param[in] val_betainc2 - Value of the artificial compresibility factor.
1209 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
1210 * \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian.
1211 */
1212 void GetPreconditionedProjJac(const su2double *val_density,
1213 const su2double *val_velocity,
1214 const su2double *val_betainc2,
1215 const su2double *val_normal,
1216 su2double **val_Proj_Jac_Tensor) const;
1217
1218 /*!
1219 * \brief Compute the projection of the inviscid Jacobian matrices for general fluid model.
1220 * \param[in] val_velocity Pointer to the velocity.
1221 * \param[in] val_energy Value of the energy.
1222 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
1223 * \param[in] val_scale - Scale of the projection.
1224 * \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian.
1225 */
1226 void GetInviscidProjJac(const su2double *val_velocity, const su2double *val_enthalphy,
1227 const su2double *val_chi, const su2double *val_kappa,
1228 const su2double *val_normal, su2double val_scale,
1229 su2double **val_Proj_Jac_tensor) const;
1230
1231 /*!
1232 * \brief Mapping between primitives variables P and conservatives variables C.
1233 * \param[in] val_Mean_PrimVar - Mean value of the primitive variables.
1234 * \param[in] val_Mean_PrimVar - Mean Value of the secondary variables.
1235 * \param[out] val_Jac_PC - Pointer to the Jacobian dPdC.
1236 */
1237 void GetPrimitive2Conservative (const su2double *val_Mean_PrimVar,
1238 const su2double *val_Mean_SecVar,
1239 su2double **val_Jac_PC) const;
1240
1241 /*!
1242 * \overload
1243 * \brief Computation of the matrix P for a generic fluid model
1244 * \param[in] val_density - Value of the density.
1245 * \param[in] val_velocity - Value of the velocity.
1246 * \param[in] val_soundspeed - Value of the sound speed.
1247 * \param[in] val_enthalpy - Value of the Enthalpy
1248 * \param[in] val_chi - Value of the derivative of Pressure with respect to the Density.
1249 * \param[in] val_kappa - Value of the derivative of Pressure with respect to the volume specific Static Energy.
1250 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
1251 * \param[out] val_p_tensor - Pointer to the P matrix.
1252 */
1253 void GetPMatrix(const su2double *val_density, const su2double *val_velocity,
1254 const su2double *val_soundspeed, const su2double *val_enthalpy,
1255 const su2double *val_chi, const su2double *val_kappa,
1256 const su2double *val_normal, su2double **val_p_tensor) const;
1257
1258 /*!
1259 * \brief Computation of the matrix P, this matrix diagonalize the conservative Jacobians in
1260 * the form $P^{-1}(A.Normal)P=Lambda$.
1261 * \param[in] density - Value of the density.
1262 * \param[in] velocity - Velocity vector.
1263 * \param[in] soundspeed - Value of the sound speed.
1264 * \param[in] normal - Normal vector, the norm of the vector is the area of the face.
1265 * \param[out] p_tensor - P matrix.
1266 */
1267 template <typename Matrix>
1268 void GetPMatrix(const su2double& density, const su2double* velocity,
1269 const su2double& soundspeed, const su2double* normal,
1270 Matrix& p_tensor) const {
1271 const su2double rhooc = density / soundspeed;
1272 const su2double rhoxc = density * soundspeed;
1273
1274 if (nDim == 2) {
1275 const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(2, velocity);
1276 const su2double projvel = GeometryToolbox::DotProduct(2, velocity, normal);
1277
1278 p_tensor[0][0] = 1.0;
1279 p_tensor[0][1] = 0.0;
1280 p_tensor[0][2] = 0.5 * rhooc;
1281 p_tensor[0][3] = 0.5 * rhooc;
1282
1283 p_tensor[1][0] = velocity[0];
1284 p_tensor[1][1] = density * normal[1];
1285 p_tensor[1][2] = 0.5 * (velocity[0] * rhooc + normal[0] * density);
1286 p_tensor[1][3] = 0.5 * (velocity[0] * rhooc - normal[0] * density);
1287
1288 p_tensor[2][0] = velocity[1];
1289 p_tensor[2][1] = -density * normal[0];
1290 p_tensor[2][2] = 0.5 * (velocity[1] * rhooc + normal[1] * density);
1291 p_tensor[2][3] = 0.5 * (velocity[1] * rhooc - normal[1] * density);
1292
1293 p_tensor[3][0] = ke;
1294 p_tensor[3][1] = density * (velocity[0] * normal[1] - velocity[1] * normal[0]);
1295 p_tensor[3][2] = 0.5 * (ke * rhooc + density * projvel + rhoxc / Gamma_Minus_One);
1296 p_tensor[3][3] = 0.5 * (ke * rhooc - density * projvel + rhoxc / Gamma_Minus_One);
1297 } else {
1298 const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(3, velocity);
1299 const su2double projvel = GeometryToolbox::DotProduct(3, velocity, normal);
1300
1301 p_tensor[0][0] = normal[0];
1302 p_tensor[0][1] = normal[1];
1303 p_tensor[0][2] = normal[2];
1304 p_tensor[0][3] = 0.5 * rhooc;
1305 p_tensor[0][4] = 0.5 * rhooc;
1306
1307 p_tensor[1][0] = velocity[0] * normal[0];
1308 p_tensor[1][1] = velocity[0] * normal[1] - density * normal[2];
1309 p_tensor[1][2] = velocity[0] * normal[2] + density * normal[1];
1310 p_tensor[1][3] = 0.5 * (velocity[0] * rhooc + density * normal[0]);
1311 p_tensor[1][4] = 0.5 * (velocity[0] * rhooc - density * normal[0]);
1312
1313 p_tensor[2][0] = velocity[1] * normal[0] + density * normal[2];
1314 p_tensor[2][1] = velocity[1] * normal[1];
1315 p_tensor[2][2] = velocity[1] * normal[2] - density * normal[0];
1316 p_tensor[2][3] = 0.5 * (velocity[1] * rhooc + density * normal[1]);
1317 p_tensor[2][4] = 0.5 * (velocity[1] * rhooc - density * normal[1]);
1318
1319 p_tensor[3][0] = velocity[2] * normal[0] - density * normal[1];
1320 p_tensor[3][1] = velocity[2] * normal[1] + density * normal[0];
1321 p_tensor[3][2] = velocity[2] * normal[2];
1322 p_tensor[3][3] = 0.5 * (velocity[2] * rhooc + density * normal[2]);
1323 p_tensor[3][4] = 0.5 * (velocity[2] * rhooc - density * normal[2]);
1324
1325 p_tensor[4][0] = ke * normal[0] + density * (velocity[1] * normal[2] - velocity[2] * normal[1]);
1326 p_tensor[4][1] = ke * normal[1] + density * (velocity[2] * normal[0] - velocity[0] * normal[2]);
1327 p_tensor[4][2] = ke * normal[2] + density * (velocity[0] * normal[1] - velocity[1] * normal[0]);
1328 p_tensor[4][3] = 0.5 * (ke * rhooc + density * projvel + rhoxc / Gamma_Minus_One);
1329 p_tensor[4][4] = 0.5 * (ke * rhooc - density * projvel + rhoxc / Gamma_Minus_One);
1330 }
1331 }
1332
1333 /*!
1334 * \brief Computation of the matrix Rinv*Pe.
1335 * \param[in] Beta2 - A variable in used to define Pe matrix.
1336 * \param[in] val_enthalpy - value of the enthalpy.
1337 * \param[in] val_soundspeed - value of the sound speed.
1338 * \param[in] val_density - value of the density.
1339 * \param[in] val_velocity - value of the velocity.
1340 * \param[out] val_invR_invPe - Pointer to the matrix of conversion from entropic to conserved variables.
1341 */
1342 void GetinvRinvPe(su2double Beta2, su2double val_enthalpy, su2double val_soundspeed,
1343 su2double val_density, const su2double* val_velocity,
1344 su2double** val_invR_invPe) const;
1345
1346 /*!
1347 * \brief Computation of the matrix R.
1348 * \param[in] val_pressure - value of the pressure.
1349 * \param[in] val_soundspeed - value of the sound speed.
1350 * \param[in] val_density - value of the density.
1351 * \param[in] val_velocity - value of the velocity.
1352 * \param[out] val_invR_invPe - Pointer to the matrix of conversion from entropic to conserved variables.
1353 */
1354 void GetRMatrix(su2double val_pressure, su2double val_soundspeed,
1355 su2double val_density, const su2double* val_velocity,
1356 su2double** val_invR_invPe) const;
1357 /*!
1358 * \brief Computation of the matrix R.
1359 * \param[in] val_soundspeed - value of the sound speed.
1360 * \param[in] val_density - value of the density.
1361 * \param[out] R_Matrix - Pointer to the matrix of conversion from entropic to conserved variables.
1362 */
1363 void GetRMatrix(su2double val_soundspeed, su2double val_density, su2double **R_Matrix) const;
1364
1365 /*!
1366 * \brief Computation of the matrix R.
1367 * \param[in] val_soundspeed - value of the sound speed.
1368 * \param[in] val_density - value of the density.
1369 * \param[out] L_Matrix - Pointer to the matrix of conversion from conserved to entropic variables.
1370 */
1371 void GetLMatrix(su2double val_soundspeed, su2double val_density, su2double **L_Matrix) const;
1372
1373 /*!
1374 * \brief Computation of the flow Residual Jacobian Matrix for Non Reflecting BC.
1375 * \param[in] val_soundspeed - value of the sound speed.
1376 * \param[in] val_density - value of the density.
1377 * \param[out] R_c - Residual Jacoboan Matrix
1378 * \param[out] R_c_inv- inverse of the Residual Jacobian Matrix .
1379 */
1380 void ComputeResJacobianGiles(CFluidModel *FluidModel, su2double pressure, su2double density, const su2double *turboVel,
1381 su2double alphaInBC, su2double gammaInBC, su2double **R_c, su2double **R_c_inv);
1382
1383 /*!
1384 * \brief Computate the inverse of a 3x3 matrix
1385 * \param[in] matrix - the matrix to invert
1386 * \param[out] invMatrix - inverse matrix.
1387 */
1388 void InvMatrix3D(su2double **matrix, su2double **invMatrix);
1389
1390 /*!
1391 * \brief Computate the inverse of a 4x4 matrix
1392 * \param[in] matrix - the matrix to invert
1393 * \param[out] invMatrix - inverse matrix.
1394 */
1395 void InvMatrix4D(su2double **matrix, su2double **invMatrix);
1396
1397 /*!
1398 * \brief Computation of the matrix R.
1399 * \param[in] val_soundspeed - value of the sound speed.
1400 * \param[in] val_density - value of the density.
1401 * \param[in] prim_jump - pointer to the vector containing the primitive variable jump (drho, dV, dp).
1402 * \param[out] char_jump - pointer to the vector containing the characteristic variable jump.
1403 */
1404 void GetCharJump(su2double val_soundspeed, su2double val_density, const su2double *prim_jump, su2double *char_jump) const;
1405
1406 /*!
1407 * \brief Computation of the matrix Td, this matrix diagonalize the preconditioned conservative Jacobians
1408 * in the form $Tg |Lambda| Td = Pc{-1}|Pc (A.Normal)|$.
1409 * \param[in] Beta2 - A variable in used to define absPeJacobian matrix.
1410 * \param[in] r_hat - A variable in used to define absPeJacobian matrix.
1411 * \param[in] s_hat - A variable in used to define absPeJacobian matrix.
1412 * \param[in] t_hat - A variable in used to define absPeJacobian matrix.
1413 * \param[in] rB2a2 - A variable in used to define absPeJacobian matrix.
1414 * \param[in] val_Lambda - Eigenvalues of the Preconditioned Jacobian.
1415 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
1416 * \param[out] val_absPeJac - Pointer to the Preconditioned Jacobian matrix.
1417 */
1418 void GetPrecondJacobian(su2double Beta2, su2double r_hat, su2double s_hat, su2double t_hat,
1419 su2double rB2a2, const su2double* val_Lambda, const su2double* val_normal, su2double** val_absPeJac) const;
1420
1421 /*!
1422 * \brief Computation of the matrix P^{-1}, this matrix diagonalize the conservative Jacobians
1423 * in the form $P^{-1}(A.Normal)P=Lambda$.
1424 * \param[in] val_density - Value of the density.
1425 * \param[in] val_velocity - Value of the velocity.
1426 * \param[in] val_soundspeed - Value of the sound speed.
1427 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
1428 * \param[out] val_invp_tensor - Pointer to inverse of the P matrix.
1429 */
1430 void GetPMatrix_inv(su2double **val_invp_tensor, const su2double *val_density,
1431 const su2double *val_velocity, const su2double *val_soundspeed,
1432 const su2double *val_chi, const su2double *val_kappa,
1433 const su2double *val_normal) const;
1434
1435 /*!
1436 * \brief Computation of the matrix P^{-1}, this matrix diagonalize the conservative Jacobians
1437 * in the form $P^{-1}(A.Normal)P=Lambda$.
1438 * \param[in] density - Value of the density.
1439 * \param[in] velocity - Velocity vector.
1440 * \param[in] soundspeed - Value of the sound speed.
1441 * \param[in] normal - Normal vector, the norm of the vector is the area of the face.
1442 * \param[out] inv_p_tensor - Pointer to inverse of the P matrix.
1443 */
1444 template <typename Matrix>
1445 void GetPMatrix_inv(const su2double& density, const su2double* velocity,
1446 const su2double& soundspeed, const su2double* normal,
1447 Matrix& inv_p_tensor) const {
1448 const su2double rhoxc = density * soundspeed;
1449 const su2double c2 = pow(soundspeed, 2);
1450 const su2double gm1 = Gamma_Minus_One;
1451 const su2double k0orho = normal[0] / density;
1452 const su2double k1orho = normal[1] / density;
1453 const su2double gm1_o_c2 = gm1 / c2;
1454 const su2double gm1_o_rhoxc = gm1 / rhoxc;
1455
1456 if (nDim == 3) {
1457 const su2double k2orho = normal[2] / density;
1458 const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(3, velocity);
1459 const su2double projvel_o_rho = GeometryToolbox::DotProduct(3, velocity, normal) / density;
1460
1461 inv_p_tensor[0][0] = normal[0] + k1orho * velocity[2] - k2orho * velocity[1] - normal[0] * gm1_o_c2 * ke;
1462 inv_p_tensor[0][1] = normal[0] * gm1_o_c2 * velocity[0];
1463 inv_p_tensor[0][2] = k2orho + normal[0] * gm1_o_c2 * velocity[1];
1464 inv_p_tensor[0][3] = -k1orho + normal[0] * gm1_o_c2 * velocity[2];
1465 inv_p_tensor[0][4] = -normal[0] * gm1_o_c2;
1466
1467 inv_p_tensor[1][0] = normal[1] + k2orho * velocity[0] - k0orho * velocity[2] - normal[1] * gm1_o_c2 * ke;
1468 inv_p_tensor[1][1] = -k2orho + normal[1] * gm1_o_c2 * velocity[0];
1469 inv_p_tensor[1][2] = normal[1] * gm1_o_c2 * velocity[1];
1470 inv_p_tensor[1][3] = k0orho + normal[1] * gm1_o_c2 * velocity[2];
1471 inv_p_tensor[1][4] = -normal[1] * gm1_o_c2;
1472
1473 inv_p_tensor[2][0] = normal[2] + k0orho * velocity[1] - k1orho * velocity[0] - normal[2] * gm1_o_c2 * ke;
1474 inv_p_tensor[2][1] = k1orho + normal[2] * gm1_o_c2 * velocity[0];
1475 inv_p_tensor[2][2] = -k0orho + normal[2] * gm1_o_c2 * velocity[1];
1476 inv_p_tensor[2][3] = normal[2] * gm1_o_c2 * velocity[2];
1477 inv_p_tensor[2][4] = -normal[2] * gm1_o_c2;
1478
1479 inv_p_tensor[3][0] = -projvel_o_rho + gm1_o_rhoxc * ke;
1480 inv_p_tensor[3][1] = k0orho - gm1_o_rhoxc * velocity[0];
1481 inv_p_tensor[3][2] = k1orho - gm1_o_rhoxc * velocity[1];
1482 inv_p_tensor[3][3] = k2orho - gm1_o_rhoxc * velocity[2];
1483 inv_p_tensor[3][4] = gm1_o_rhoxc;
1484
1485 inv_p_tensor[4][0] = projvel_o_rho + gm1_o_rhoxc * ke;
1486 inv_p_tensor[4][1] = -k0orho - gm1_o_rhoxc * velocity[0];
1487 inv_p_tensor[4][2] = -k1orho - gm1_o_rhoxc * velocity[1];
1488 inv_p_tensor[4][3] = -k2orho - gm1_o_rhoxc * velocity[2];
1489 inv_p_tensor[4][4] = gm1_o_rhoxc;
1490 } else {
1491 const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(2, velocity);
1492 const su2double projvel_o_rho = GeometryToolbox::DotProduct(2, velocity, normal) / density;
1493
1494 inv_p_tensor[0][0] = 1 - gm1_o_c2 * ke;
1495 inv_p_tensor[0][1] = gm1_o_c2 * velocity[0];
1496 inv_p_tensor[0][2] = gm1_o_c2 * velocity[1];
1497 inv_p_tensor[0][3] = -gm1_o_c2;
1498
1499 inv_p_tensor[1][0] = -k1orho * velocity[0] + k0orho * velocity[1];
1500 inv_p_tensor[1][1] = k1orho;
1501 inv_p_tensor[1][2] = -k0orho;
1502 inv_p_tensor[1][3] = 0;
1503
1504 inv_p_tensor[2][0] = -projvel_o_rho + gm1_o_rhoxc * ke;
1505 inv_p_tensor[2][1] = k0orho - gm1_o_rhoxc * velocity[0];
1506 inv_p_tensor[2][2] = k1orho - gm1_o_rhoxc * velocity[1];
1507 inv_p_tensor[2][3] = gm1_o_rhoxc;
1508
1509 inv_p_tensor[3][0] = projvel_o_rho + gm1_o_rhoxc * ke;
1510 inv_p_tensor[3][1] = -k0orho - gm1_o_rhoxc * velocity[0];
1511 inv_p_tensor[3][2] = -k1orho - gm1_o_rhoxc * velocity[1];
1512 inv_p_tensor[3][3] = gm1_o_rhoxc;
1513 }
1514 }
1515
1516 /*!
1517 * \brief Compute viscous residual and jacobian.
1518 */
1520 su2double ViscDens_i, su2double ViscDens_j, const su2double *Velocity_i, const su2double *Velocity_j,
1521 su2double sq_vel_i, su2double sq_vel_j,
1522 su2double XiDens_i, su2double XiDens_j, su2double **Mean_GradPhi, const su2double *Mean_GradPsiE,
1523 su2double dPhiE_dn, const su2double *Normal, const su2double *Edge_Vector, su2double dist_ij_2,
1524 su2double *val_residual_i, su2double *val_residual_j,
1525 su2double **val_Jacobian_ii, su2double **val_Jacobian_ij,
1526 su2double **val_Jacobian_ji, su2double **val_Jacobian_jj, bool implicit) const;
1527
1528 /*!
1529 * \brief Computation of the projected inviscid lambda (eingenvalues).
1530 * \param[in] val_velocity - Value of the velocity.
1531 * \param[in] val_soundspeed - Value of the sound speed.
1532 * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
1533 * \param[in] val_Lambda_Vector - Pointer to Lambda matrix.
1534 */
1535 void GetJacInviscidLambda_fabs(const su2double *val_velocity, su2double val_soundspeed,
1536 const su2double *val_normal, su2double *val_Lambda_Vector) const;
1537
1538 /*!
1539 * \brief Compute the numerical residual.
1540 * \param[out] val_residual - Pointer to the total residual.
1541 * \param[in] config - Definition of the particular problem.
1542 */
1543 inline virtual void ComputeResidual(su2double *val_residual, CConfig* config) { }
1544
1545 /*!
1546 * \overload
1547 * \param[out] val_residual - Pointer to the total residual.
1548 * \param[out] val_Jacobian_i - Jacobian of the numerical method at node i (implicit computation).
1549 * \param[out] val_Jacobian_j - Jacobian of the numerical method at node j (implicit computation).
1550 * \param[in] config - Definition of the particular problem.
1551 */
1552 inline virtual void ComputeResidual(su2double *val_residual, su2double **val_Jacobian_i,
1553 su2double **val_Jacobian_j, CConfig* config) { }
1554
1555 /*!
1556 * \overload For numerics classes that store the residual/flux and Jacobians internally.
1557 * \param[in] config - Definition of the particular problem.
1558 * \return A lightweight const-view (read-only) of the residual/flux and Jacobians.
1559 */
1560 inline virtual ResidualType<> ComputeResidual(const CConfig* config) { return ResidualType<>(nullptr,nullptr,nullptr); }
1561
1562 /*!
1563 * \overload
1564 * \param[out] val_residual_i - Pointer to the total residual at point i.
1565 * \param[out] val_residual_j - Pointer to the total viscosity residual at point j.
1566 * \param[out] val_Jacobian_ii - Jacobian of the numerical method at node i (implicit computation) from node i.
1567 * \param[out] val_Jacobian_ij - Jacobian of the numerical method at node i (implicit computation) from node j.
1568 * \param[out] val_Jacobian_ji - Jacobian of the numerical method at node j (implicit computation) from node i.
1569 * \param[out] val_Jacobian_jj - Jacobian of the numerical method at node j (implicit computation) from node j.
1570 * \param[in] config - Definition of the particular problem.
1571 */
1572 inline virtual void ComputeResidual(su2double *val_residual_i,
1573 su2double *val_residual_j,
1574 su2double **val_Jacobian_ii,
1575 su2double **val_Jacobian_ij,
1576 su2double **val_Jacobian_ji,
1577 su2double **val_Jacobian_jj, CConfig* config) { }
1578
1579 /*!
1580 * \overload
1581 * \param[out] val_resconv_i - Pointer to the convective residual at point i.
1582 * \param[out] val_resvisc_i - Pointer to the artificial viscosity residual at point i.
1583 * \param[out] val_resconv_j - Pointer to the convective residual at point j.
1584 * \param[out] val_resvisc_j - Pointer to the artificial viscosity residual at point j.
1585 * \param[out] val_Jacobian_ii - Jacobian of the numerical method at node i (implicit computation) from node i.
1586 * \param[out] val_Jacobian_ij - Jacobian of the numerical method at node i (implicit computation) from node j.
1587 * \param[out] val_Jacobian_ji - Jacobian of the numerical method at node j (implicit computation) from node i.
1588 * \param[out] val_Jacobian_jj - Jacobian of the numerical method at node j (implicit computation) from node j.
1589 * \param[in] config - Definition of the particular problem.
1590 */
1591 inline virtual void ComputeResidual(su2double *val_resconv_i, su2double *val_resvisc_i,
1592 su2double *val_resconv_j, su2double *val_resvisc_j,
1593 su2double **val_Jacobian_ii,
1594 su2double **val_Jacobian_ij,
1595 su2double **val_Jacobian_ji,
1596 su2double **val_Jacobian_jj, CConfig* config) { }
1597
1598 /*!
1599 * \overload
1600 * \param[out] val_resconv - Pointer to the convective residual.
1601 * \param[out] val_resvisc - Pointer to the artificial viscosity residual.
1602 * \param[out] val_Jacobian_i - Jacobian of the numerical method at node i (implicit computation).
1603 * \param[out] val_Jacobian_j - Jacobian of the numerical method at node j (implicit computation).
1604 * \param[in] config - Definition of the particular problem.
1605 */
1606 inline virtual void ComputeResidual(su2double *val_resconv, su2double *val_resvisc,
1607 su2double **val_Jacobian_i, su2double **val_Jacobian_j,
1608 CConfig *config) {}
1609
1610 /*!
1611 * \overload
1612 * \param[in] config - Definition of the particular problem.
1613 * \param[out] val_residual - residual of the source terms
1614 * \param[out] val_Jacobian_i - Jacobian of the source terms
1615 */
1616 inline virtual void ComputeResidual(su2double *val_residual, su2double **val_Jacobian_i, CConfig* config) { }
1617
1618 /*!
1619 * \brief Residual for transition problems.
1620 * \param[out] val_residual - Pointer to the total residual.
1621 * \param[out] val_Jacobian_i - Jacobian of the numerical method at node i (implicit computation).
1622 * \param[out] val_Jacobian_j - Jacobian of the numerical method at node j (implicit computation).
1623 * \param[in] config - Definition of the particular problem.
1624 * \param[out] gamma_sep
1625 */
1626 inline virtual void ComputeResidual_TransLM(su2double *val_residual,
1627 su2double **val_Jacobian_i,
1628 su2double **val_Jacobian_j, CConfig* config,
1629 su2double &gamma_sep) { }
1630
1631 /*!
1632 * \brief Residual for source term integration.
1633 * \param[out] val_residual - Pointer to the source residual containing chemistry terms.
1634 * \param[in] config - Definition of the particular problem.
1635 */
1636 inline virtual ResidualType<> ComputeAxisymmetric(const CConfig* config) { return ResidualType<>(nullptr,nullptr,nullptr); }
1637
1638 /*!
1639 * \overload For numerics classes that store the residual/flux and Jacobians internally.
1640 * \param[in] config - Definition of the particular problem.
1641 * \return A lightweight const-view (read-only) of the residual/flux and Jacobians.
1642 */
1643 inline virtual ResidualType<> ComputeVibRelaxation(const CConfig* config) { return ResidualType<>(nullptr,nullptr,nullptr); }
1644
1645 /*!
1646 * \brief Calculation of the chemistry source term
1647 * \param[in] config - Definition of the particular problem.
1648 * \param[out] val_residual - residual of the source terms
1649 * \param[out] val_Jacobian_i - Jacobian of the source terms
1650 */
1651 inline virtual ResidualType<> ComputeChemistry(const CConfig* config) { return ResidualType<>(nullptr,nullptr,nullptr); }
1652
1653 /*!
1654 * \brief Check if residual constains a NaN value
1655 * \param[in] config - Definition of the particular problem.
1656 * \param[in] val_residual - residual of the numeric function.
1657 * \param[out] ERR - Presencse of NaN in vector
1658 */
1659 static bool CheckResidualNaNs(bool implicit, int nVar, const ResidualType<> residual) {
1660
1661 bool ERR = false;
1662 const bool jac_j = residual.jacobian_j != nullptr;
1663
1664 for (auto iVar = 0; iVar<nVar; iVar++){
1665 if (std::isnan(SU2_TYPE::GetValue(residual[iVar]))) ERR = true;
1666
1667 if (implicit) {
1668 for (auto jVar = 0; jVar < nVar; jVar++){
1669 if (std::isnan(SU2_TYPE::GetValue(residual.jacobian_i[iVar][jVar]))) ERR = true;
1670 if ((jac_j) && (std::isnan(SU2_TYPE::GetValue(residual.jacobian_j[iVar][jVar])))) ERR = true;
1671 }
1672 }
1673 }
1674 return ERR;
1675 }
1676
1677 /*!
1678 * \brief A virtual member.
1679 */
1680 inline virtual su2double GetGammaBC(void) const { return 0.0; }
1681
1682 /*!
1683 * \brief A virtual member to compute the tangent matrix in structural problems
1684 * \param[in] element_container - Element structure for the particular element integrated.
1685 */
1686 inline virtual void Compute_Tangent_Matrix(CElement *element_container, const CConfig* config) { }
1687
1688 /*!
1689 * \brief A virtual member to compute the nodal stress term in non-linear structural problems
1690 * \param[in] element_container - Definition of the particular element integrated.
1691 */
1692 inline virtual void Compute_NodalStress_Term(CElement *element_container, const CConfig* config) { }
1693
1694 /*!
1695 * \brief Set the element-based local Young's modulus in mesh problems
1696 * \param[in] iElem - Element index.
1697 * \param[in] val_E - Value of elasticity modulus.
1698 */
1699 inline virtual void SetMeshElasticProperties(unsigned long iElem, su2double val_E) { }
1700
1701 /*!
1702 * \brief A virtual member to set the value of the design variables
1703 * \param[in] i_DV - Index of the design variable.
1704 * \param[in] val_DV - Value of the design variable
1705 */
1706 inline virtual void Set_DV_Val(unsigned short i_DV, su2double val_DV) { }
1707
1708 /*!
1709 * \brief A virtual member to retrieve the value of the design variables
1710 * \param[in] i_DV - Index of the design variable.
1711 */
1712 inline virtual su2double Get_DV_Val(unsigned short i_DV) const { return 0.0; }
1713
1714 /*!
1715 * \brief A virtual member to set the electric field
1716 * \param[in] EField_DV - New electric field computed by adjoint methods.
1717 */
1718 inline virtual void Set_ElectricField(unsigned short i_DV, su2double val_EField) { }
1719
1720 /*!
1721 * \brief A virtual member to set the material properties
1722 * \param[in] iVal - Index of the region of concern
1723 * \param[in] val_E - Value of the Young Modulus.
1724 * \param[in] val_Nu - Value of the Poisson's ratio.
1725 */
1726 inline virtual void SetMaterial_Properties(unsigned short iVal, su2double val_E, su2double val_Nu) { }
1727
1728 /*!
1729 * \brief A virtual member to set the material properties
1730 * \param[in] iVal - Index of the region of concern
1731 * \param[in] val_Rho - Value of the density (inertial effects).
1732 * \param[in] val_Rho_DL - Value of the density (dead load effects).
1733 */
1734 inline virtual void SetMaterial_Density(unsigned short iVal, su2double val_Rho, su2double val_Rho_DL) { }
1735
1736 /*!
1737 * \brief A virtual member to compute the mass matrix
1738 * \param[in] element_container - Element structure for the particular element integrated.
1739 */
1740 inline virtual void Compute_Mass_Matrix(CElement *element_container, const CConfig* config) { }
1741
1742 /*!
1743 * \brief A virtual member to compute the residual component due to body forces.
1744 * \param[in] element_container - Element structure for the particular element integrated.
1745 */
1746 inline virtual void Compute_Body_Forces(CElement *element_container, const CConfig* config) { }
1747
1748 /*!
1749 * \brief A virtual member to compute the averaged nodal stresses
1750 * \param[in] element_container - Element structure for the particular element integrated.
1751 */
1752 inline virtual su2double Compute_Averaged_NodalStress(CElement *element_container, const CConfig* config) { return 0; }
1753
1754 /*!
1755 * \brief Computes a basis of orthogonal vectors from a supplied vector
1756 * \param[in] config - Normal vector
1757 */
1758 void CreateBasis(const su2double *val_Normal, su2double* l, su2double* m);
1759
1760 /*!
1761 * \brief Set the value of the Tauwall
1762 * \param[in] val_tauwall_i - Tauwall at point i
1763 * \param[in] val_tauwall_j - Tauwall at point j
1764 */
1765 inline virtual void SetTau_Wall(su2double val_tauwall_i, su2double val_tauwall_j) { }
1766
1767 /*!
1768 * \brief - Calculate the central/upwind blending function for a face
1769 *
1770 * At its simplest level, this function will calculate the average
1771 * value of the "Roe dissipation" or central/upwind blending function
1772 * at a face. If Ducros shock sensors are used, then this method will
1773 * also adjust the central/upwind blending to account for shocks.
1774 *
1775 * \param[in] Dissipation_i - Value of the blending function at point i
1776 * \param[in] Dissipation_j - Value of the bledning function at point j
1777 * \param[in] Sensor_i - Shock sensor at point i
1778 * \param[in] Sensor_j - Shock sensor at point j
1779 * \param[in] config - The configuration of the problem
1780 * \return Dissipation_ij - Blending parameter at face
1781 */
1783 const su2double Sensor_i, const su2double Sensor_j, const CConfig* config) const;
1784
1785 /*!
1786 * \brief Set the value of the radiation variable.
1787 * \param[in] val_radvar_i - Value of the turbulent variable at point i.
1788 * \param[in] val_radvar_j - Value of the turbulent variable at point j.
1789 */
1790 inline virtual void SetRadVar(const su2double *val_radvar_i, const su2double *val_radvar_j) { }
1791
1792 /*!
1793 * \brief Set the gradient of the radiation variables.
1794 * \param[in] val_radvar_grad_i - Gradient of the turbulent variable at point i.
1795 * \param[in] val_radvar_grad_j - Gradient of the turbulent variable at point j.
1796 */
1797 inline virtual void SetRadVarGradient(CMatrixView<const su2double> val_radvar_grad_i,
1798 CMatrixView<const su2double> val_radvar_grad_j) { }
1799
1800 /*!
1801 * \brief Set the gradient of the radiation variables.
1802 * \param[in] val_radvar_source - Source term (and jacobian term) of the radiative heat transfer.
1803 */
1804 inline void SetRadVarSource(const su2double *val_radvar_source) { RadVar_Source = val_radvar_source; }
1805
1806 /*!
1807 * \brief Set the pressure derivatives.
1808 * \param[in] val_dPdU_i - pressure derivatives at i.
1809 * \param[in] val_dPdU_j - pressure derivatives at j.
1810 */
1811 virtual inline void SetdPdU(su2double *val_dPdU_i, su2double *val_dPdU_j) { }
1812
1813 /*!
1814 * \brief Set the temperature derivatives.
1815 * \param[in] val_dTdU_i - temperature derivatives at i.
1816 * \param[in] val_dTdU_j - temperature derivatives at j.
1817 */
1818 virtual inline void SetdTdU(su2double *val_dTdU_i, su2double *val_dTdU_j) { }
1819
1820 /*!
1821 * \brief Set the vib-el temperture derivatives.
1822 * \param[in] val_dTvedU_i - t_ve derivatives at i.
1823 * \param[in] val_dTvedU_j - t_ve derivatives at j.
1824 */
1825 virtual inline void SetdTvedU(su2double *val_dTvedU_i, su2double *val_dTvedU_j) { }
1826
1827 /*!
1828 * \brief Set the vib-elec energy.
1829 * \param[in] val_Eve_i - vib-el energy at i.
1830 * \param[in] val_Eve_j - vib-el energy at j.
1831 */
1832 virtual inline void SetEve(su2double *val_Eve_i, su2double *val_Eve_j) { }
1833
1834 /*!
1835 * \brief Set the vib-elec specific heat.
1836 * \param[in] val_Cvve_i - Cvve at i.
1837 * \param[in] val_Cvve_j - Cvve at j.
1838 */
1839 virtual inline void SetCvve(su2double *val_Cvve_i, su2double *val_Cvve_j) { }
1840
1841 /*!
1842 * \brief Set the ratio of specific heats.
1843 * \param[in] val_Gamma_i - Gamma at i.
1844 * \param[in] val_Gamma_j - Gamma at j.
1845 */
1846 virtual inline void SetGamma(su2double val_Gamma_i, su2double val_Gamma_j) { }
1847
1848 /*!
1849 * \brief Set massflow, heatflow & inlet temperature for streamwise periodic flow.
1850 * \param[in] SolverSPvals - Struct holding the values.
1851 */
1852 virtual void SetStreamwisePeriodicValues(const StreamwisePeriodicValues SolverSPvals) { }
1853
1854 /*!
1855 * \brief SetMassFlux
1856 * \param[in] val_MassFlux: Mass flux across the edge
1857 */
1858 inline void SetMassFlux(const su2double val_MassFlux) { MassFlux = val_MassFlux; }
1859
1860 /*!
1861 * \brief Obtain information on bounded scalar problem
1862 * \return is_bounded_scalar : scalar solver uses bounded scalar convective transport
1863 */
1864 inline bool GetBoundedScalar() const { return bounded_scalar;}
1865};
1866
1867/*!
1868 * /brief Alias for a "do nothing" source term class
1869 */
CNewtonIntegration::Scalar Scalar
Definition CNewtonIntegration.cpp:31
A templated matrix/vector-like object.
Definition C2DContainer.hpp:374
static void EigenDecomposition(const Mat &A_ij, Mat &Eig_Vec, Vec &Eig_Val, int n, W &e)
Decomposes the symmetric matrix A_ij, into eigenvectors and eigenvalues.
Definition blas_structure.hpp:439
static void EigenRecomposition(Mat &A_ij, const Mat &Eig_Vec, const Vec &Eig_Val, int n)
Recomposes the eigenvectors and eigenvalues into a matrix.
Definition blas_structure.hpp:458
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
const CStochBackScatParam & GetSBSParam(void) const
Get the Stochastic BackScatter (SBS) model parameters.
Definition CConfig.hpp:9766
su2double GetLength_Reynolds(void) const
Get the value of the Reynolds length.
Definition CConfig.hpp:2203
su2double GetTime_Step(void) const
Get the time step for multizone problems.
Definition CConfig.hpp:9918
su2double GetModVel_FreeStream(void) const
Get the magnitude of the free-stream velocity of the fluid.
Definition CConfig.hpp:1882
unsigned long GetTimeIter() const
Get the current time iteration number.
Definition CConfig.hpp:3387
unsigned long GetRestart_Iter(void) const
Get the restart iteration.
Definition CConfig.hpp:9912
Abstract class for defining finite elements.
Definition CElement.hpp:58
Main class for defining the Thermo-Physical Model.
Definition CFluidModel.hpp:47
Class to represent a matrix (without owning the data, this just wraps a pointer).
Definition container_decorators.hpp:40
Class for defining the numerical methods.
Definition CNumerics.hpp:48
void SetDensity(su2double val_densityinc_i, su2double val_densityinc_j)
Set the value of the density for the incompressible solver.
Definition CNumerics.hpp:1007
void SetVelocity2_Inf(su2double val_velocity2)
Set the freestream velocity square.
Definition CNumerics.hpp:265
void GetinvRinvPe(su2double Beta2, su2double val_enthalpy, su2double val_soundspeed, su2double val_density, const su2double *val_velocity, su2double **val_invR_invPe) const
Computation of the matrix Rinv*Pe.
Definition CNumerics.cpp:526
void SetPrimitive(const su2double *val_v_i, const su2double *val_v_j)
Set the value of the primitive variables.
Definition CNumerics.hpp:301
const su2double * Coord_j
Cartesians coordinates of point j.
Definition CNumerics.hpp:164
su2double Eddy_Viscosity_i
Eddy viscosity at point i.
Definition CNumerics.hpp:77
CMatrixView< const su2double > ConsVar_Grad
Gradient of conservative variables which is a scalar.
Definition CNumerics.hpp:146
void SetLambda(su2double val_lambda_i, su2double val_lambda_j)
Set the value of the spectral radius.
Definition CNumerics.hpp:1047
su2double MassFlux
Mass flux across edge.
Definition CNumerics.hpp:58
su2double Gas_Constant
Gas constant.
Definition CNumerics.hpp:56
void GetPMatrix(const su2double *val_density, const su2double *val_velocity, const su2double *val_soundspeed, const su2double *val_enthalpy, const su2double *val_chi, const su2double *val_kappa, const su2double *val_normal, su2double **val_p_tensor) const
Computation of the matrix P for a generic fluid model.
Definition CNumerics.cpp:380
CMatrixView< const su2double > TransVar_Grad_j
Gradient of turbulent variables at point j.
Definition CNumerics.hpp:154
void SetLaminarViscosity(su2double val_laminar_viscosity_i, su2double val_laminar_viscosity_j)
Set the laminar viscosity.
Definition CNumerics.hpp:852
virtual void Set_DV_Val(unsigned short i_DV, su2double val_DV)
A virtual member to set the value of the design variables.
Definition CNumerics.hpp:1706
virtual ResidualType ComputeResidual(const CConfig *config)
Definition CNumerics.hpp:1560
unsigned short nVar
Number of dimensions and variables.
Definition CNumerics.hpp:52
virtual void SetdTvedU(su2double *val_dTvedU_i, su2double *val_dTvedU_j)
Set the vib-el temperture derivatives.
Definition CNumerics.hpp:1825
void SetSecondary(const su2double *val_s_i, const su2double *val_s_j)
Set the value of the primitive variables.
Definition CNumerics.hpp:311
const su2double * Diffusion_Coeff_j
Species diffusion coefficients at point j.
Definition CNumerics.hpp:65
CMatrixView< const su2double > ConsVar_Grad_j
Gradient of conservative variables at point j.
Definition CNumerics.hpp:145
su2double DensityInc_j
Incompressible density at point j.
Definition CNumerics.hpp:93
static void ComputeStressTensor(size_t nDim, Mat1 &stress, const Mat2 &velgrad, Scalar viscosity, Scalar density=0.0, Scalar turb_ke=0.0, bool reynolds3x3=false)
Compute the stress tensor from the velocity gradients.
Definition CNumerics.hpp:494
CMatrixView< const su2double > ScalarVar_Grad_i
Gradient of scalar variables at point i.
Definition CNumerics.hpp:151
virtual ~CNumerics(void)
Destructor of the class.
Definition CNumerics.cpp:78
const su2double * ScalarVar_j
Vector of scalar variables at point j.
Definition CNumerics.hpp:132
su2double roughness_i
Roughness of the wall nearest to point i.
Definition CNumerics.hpp:183
bool GetBoundedScalar() const
Obtain information on bounded scalar problem.
Definition CNumerics.hpp:1864
su2double Pressure_j
Pressure at point j.
Definition CNumerics.hpp:87
su2double StrainMag_i
Definition CNumerics.hpp:180
virtual void SetF1blending(su2double val_F1_i, su2double val_F1_j)
Set the value of the first blending function.
Definition CNumerics.hpp:775
CMatrixView< const su2double > TurbPsi_Grad_j
Gradient of adjoint turbulent variables at point j.
Definition CNumerics.hpp:156
su2double Thermal_Conductivity_ve_j
vibrational-electronic Thermal conductivity at point j.
Definition CNumerics.hpp:73
void SetAdjointVarGradient(CMatrixView< const su2double > val_psivar_grad_i, CMatrixView< const su2double > val_psivar_grad_j)
Set the gradient of the adjoint variables.
Definition CNumerics.hpp:359
su2double Lambda_j
Spectral radius at point j.
Definition CNumerics.hpp:99
const su2double * GridVel_i
Grid velocity at point i.
Definition CNumerics.hpp:116
su2double Dissipation_i
Definition CNumerics.hpp:181
su2double Area
Area of the face i-j.
Definition CNumerics.hpp:172
void InvMatrix4D(su2double **matrix, su2double **invMatrix)
Computate the inverse of a 4x4 matrix.
Definition CNumerics.cpp:869
void SetJacHeatFluxDiffusion(su2double val_jacheatfluxdiffusion)
Set Jacobian of the heat flux due to enthalpy diffusion.
Definition CNumerics.hpp:843
su2double MeanPerturbedRSM[3][3]
Perturbed Reynolds stress tensor
Definition CNumerics.hpp:186
virtual void SetTau_Wall(su2double val_tauwall_i, su2double val_tauwall_j)
Set the value of the Tauwall.
Definition CNumerics.hpp:1765
const su2double * Diffusion_Coeff_i
Species diffusion coefficients at point i.
Definition CNumerics.hpp:64
CMatrixView< const su2double > TransVar_Grad_i
Gradient of turbulent variables at point i.
Definition CNumerics.hpp:153
su2double GetDissipation() const
Get the final Roe dissipation factor.
Definition CNumerics.hpp:1113
virtual su2double Compute_Averaged_NodalStress(CElement *element_container, const CConfig *config)
A virtual member to compute the averaged nodal stresses.
Definition CNumerics.hpp:1752
su2double Volume
Volume of the control volume around point i.
Definition CNumerics.hpp:173
void CreateBasis(const su2double *val_Normal, su2double *l, su2double *m)
Computes a basis of orthogonal vectors from a supplied vector.
Definition CNumerics.cpp:1454
su2double Thermal_Conductivity_ve_i
vibrational-electronic Thermal conductivity at point i.
Definition CNumerics.hpp:72
void SetConservative(const su2double *val_u_i, const su2double *val_u_j)
Set the value of the conservative variables.
Definition CNumerics.hpp:291
su2double StrainMag_j
Strain rate magnitude.
Definition CNumerics.hpp:180
void SetUndivided_Laplacian(const su2double *val_und_lapl_i, const su2double *val_und_lapl_j)
Set the value of undivided laplacian.
Definition CNumerics.hpp:1057
su2double Cp_j
Cp at point j.
Definition CNumerics.hpp:75
su2double Density_i
Density at point i.
Definition CNumerics.hpp:89
CMatrixView< const su2double > ConsVar_Grad_i
Gradient of conservative variables at point i.
Definition CNumerics.hpp:144
void SetLES_Mode(su2double val_lesMode_i, su2double val_lesMode_j)
Set the LES sensor for hybrid RANS-LES methods.
Definition CNumerics.hpp:938
void SetTurbAdjointGradient(CMatrixView< const su2double > val_turbpsivar_grad_i, CMatrixView< const su2double > val_turbpsivar_grad_j)
Set the gradient of the adjoint turbulent variables.
Definition CNumerics.hpp:430
void SetRadVarSource(const su2double *val_radvar_source)
Set the gradient of the radiation variables.
Definition CNumerics.hpp:1804
su2double SoundSpeed_i
Sound speed at point i.
Definition CNumerics.hpp:101
su2double SoundSpeed_j
Sound speed at point j.
Definition CNumerics.hpp:102
CMatrixView< const su2double > TurbPsi_Grad_i
Gradient of adjoint turbulent variables at point i.
Definition CNumerics.hpp:155
virtual ResidualType ComputeChemistry(const CConfig *config)
Calculation of the chemistry source term.
Definition CNumerics.hpp:1651
su2double BetaInc2_j
Beta incompressible at point j.
Definition CNumerics.hpp:96
void GetCharJump(su2double val_soundspeed, su2double val_density, const su2double *prim_jump, su2double *char_jump) const
Computation of the matrix R.
Definition CNumerics.cpp:905
void SetNeighbor(unsigned short val_neighbor_i, unsigned short val_neighbor_j)
Set the number of neighbor to a point.
Definition CNumerics.hpp:1077
void GetInviscidIncProjJac(const su2double *val_density, const su2double *val_velocity, const su2double *val_betainc2, const su2double *val_normal, su2double val_scale, su2double **val_Proj_Jac_tensor)
Compute the projection of the inviscid Jacobian matrices (incompressible).
void SetRoughness(su2double val_roughness_i, su2double val_roughness_j)
Set the value of the roughness from the nearest wall.
Definition CNumerics.hpp:967
void GetPreconditioner(const su2double *val_density, const su2double *val_velocity, const su2double *val_betainc2, const su2double *val_enthalpy, const su2double *val_drhodh, su2double **val_Precon) const
Compute the low speed preconditioning matrix.
Definition CNumerics.cpp:321
CMatrixView< const su2double > AuxVar_Grad_i
Gradient of an auxiliary variable at point i.
Definition CNumerics.hpp:157
virtual void SetStreamwisePeriodicValues(const StreamwisePeriodicValues SolverSPvals)
Set massflow, heatflow & inlet temperature for streamwise periodic flow.
Definition CNumerics.hpp:1852
void SetGridVel(const su2double *val_gridvel_i, const su2double *val_gridvel_j)
Set the velocity of the computational grid.
Definition CNumerics.hpp:987
bool nemo
Flag for NEMO problems
Definition CNumerics.hpp:203
void GetRMatrix(su2double val_pressure, su2double val_soundspeed, su2double val_density, const su2double *val_velocity, su2double **val_invR_invPe) const
Computation of the matrix R.
Definition CNumerics.cpp:596
const su2double * Psi_j
Vector of adjoint variables at point j.
Definition CNumerics.hpp:129
static su2double ComputeProjectedGradient(int nDim, int nVar, const Vec1 &normal, const Vec1 &coord_i, const Vec1 &coord_j, const Mat &grad_i, const Mat &grad_j, bool correct, const Vec2 &var_i, const Vec2 &var_j, su2double *projNormal, su2double *projCorrected)
Project average gradient onto normal (with or w/o correction) for viscous fluxes of scalar quantities...
Definition CNumerics.hpp:734
virtual void SetMaterial_Density(unsigned short iVal, su2double val_Rho, su2double val_Rho_DL)
A virtual member to set the material properties.
Definition CNumerics.hpp:1734
virtual void Set_ElectricField(unsigned short i_DV, su2double val_EField)
A virtual member to set the electric field.
Definition CNumerics.hpp:1718
void SetPrimVarGradient(CMatrixView< const su2double > val_primvar_grad_i, CMatrixView< const su2double > val_primvar_grad_j)
Set the gradient of the primitive variables.
Definition CNumerics.hpp:338
const su2double * Vorticity_i
Definition CNumerics.hpp:179
void SetThermalConductivity(su2double val_thermal_conductivity_i, su2double val_thermal_conductivity_j)
Set the thermal conductivity (translational/rotational)
Definition CNumerics.hpp:864
static void ComputeMeanRateOfStrainMatrix(size_t nDim, Mat1 &rateofstrain, const Mat2 &velgrad)
Compute the mean rate of strain matrix.
Definition CNumerics.hpp:446
su2double GetRoe_Dissipation(const su2double Dissipation_i, const su2double Dissipation_j, const su2double Sensor_i, const su2double Sensor_j, const CConfig *config) const
Calculate the central/upwind blending function for a face
Definition CNumerics.cpp:1512
void SetStochVar(unsigned short iDim, su2double val_stochvar_i, su2double val_stochvar_j)
Set the stochastic variables from Langevin equations (Stochastic Backscatter Model).
Definition CNumerics.hpp:920
const su2double * ScalarVar_i
Vector of scalar variables at point i.
Definition CNumerics.hpp:131
su2double Dissipation_ij
Definition CNumerics.hpp:182
virtual void ComputeResidual(su2double *val_resconv, su2double *val_resvisc, su2double **val_Jacobian_i, su2double **val_Jacobian_j, CConfig *config)
Definition CNumerics.hpp:1606
su2double Laminar_Viscosity_i
Laminar viscosity at point i.
Definition CNumerics.hpp:67
su2double Enthalpy_i
Enthalpy at point i.
Definition CNumerics.hpp:104
su2double lesMode_i
LES sensor at point i for hybrid RANS-LES methods.
Definition CNumerics.hpp:193
void SetVolume(su2double val_volume)
Set the value of the volume of the control volume.
Definition CNumerics.hpp:1092
su2double stochSource[3]
Source term for Langevin equations in Stochastic Backscatter Model.
Definition CNumerics.hpp:188
CMatrixView< const su2double > AuxVar_Grad_j
Gradient of an auxiliary variable at point i.
Definition CNumerics.hpp:158
su2double UnitNormal[MAXNDIM]
Unitary normal vector.
Definition CNumerics.hpp:169
void GetPMatrix_inv(const su2double &density, const su2double *velocity, const su2double &soundspeed, const su2double *normal, Matrix &inv_p_tensor) const
Computation of the matrix P^{-1}, this matrix diagonalize the conservative Jacobians in the form $P^{...
Definition CNumerics.hpp:1445
void SetSensor(su2double val_sensor_i, su2double val_sensor_j)
Set the value of the pressure sensor.
Definition CNumerics.hpp:1067
const su2double * Normal
Normal vector, its norm is the area of the face.
Definition CNumerics.hpp:168
bool energy_multicomponent
Flag for multicomponent and reacting flow
Definition CNumerics.hpp:205
su2double Gamma
Fluid's Gamma constant (ratio of specific heats).
Definition CNumerics.hpp:53
CMatrixView< const su2double > PrimVar_Grad_j
Gradient of primitive variables at point j.
Definition CNumerics.hpp:148
su2double * Proj_Flux_Tensor
Flux tensor projected in a direction.
Definition CNumerics.hpp:60
virtual su2double Get_DV_Val(unsigned short i_DV) const
A virtual member to retrieve the value of the design variables.
Definition CNumerics.hpp:1712
su2double lesMode_j
LES sensor at point j for hybrid RANS-LES methods.
Definition CNumerics.hpp:194
virtual void ComputeResidual(su2double *val_residual_i, su2double *val_residual_j, su2double **val_Jacobian_ii, su2double **val_Jacobian_ij, su2double **val_Jacobian_ji, su2double **val_Jacobian_jj, CConfig *config)
Definition CNumerics.hpp:1572
virtual void SetdPdU(su2double *val_dPdU_i, su2double *val_dPdU_j)
Set the pressure derivatives.
Definition CNumerics.hpp:1811
virtual ResidualType ComputeAxisymmetric(const CConfig *config)
Residual for source term integration.
Definition CNumerics.hpp:1636
static void ComputePerturbedRSM(size_t nDim, size_t uq_eigval_comp, bool uq_permute, su2double uq_delta_b, su2double uq_urlx, const Mat1 &velgrad, Scalar density, Scalar viscosity, Scalar turb_ke, Mat2 &MeanPerturbedRSM)
Perturb the Reynolds stress tensor based on parameters.
Definition CNumerics.hpp:581
su2double ComputeStochRelaxFactor(const CConfig *config)
Compute relaxation factor for stochastic source term in momentum equations (Stochastic Backscatter Mo...
Definition CNumerics.hpp:698
su2double roughness_j
Roughness of the wall nearest to point j.
Definition CNumerics.hpp:184
su2double stochVar_j[3]
Stochastic variables at point j for Stochastic Backscatter Model.
Definition CNumerics.hpp:191
su2double Prandtl_Turb
Turbulent Prandtl's number.
Definition CNumerics.hpp:57
void GetPMatrix_inv(su2double **val_invp_tensor, const su2double *val_density, const su2double *val_velocity, const su2double *val_soundspeed, const su2double *val_chi, const su2double *val_kappa, const su2double *val_normal) const
Computation of the matrix P^{-1}, this matrix diagonalize the conservative Jacobians in the form $P^{...
Definition CNumerics.cpp:453
virtual void SetMaterial_Properties(unsigned short iVal, su2double val_E, su2double val_Nu)
A virtual member to set the material properties.
Definition CNumerics.hpp:1726
su2double TimeStep
Time step useful in dual time method.
Definition CNumerics.hpp:171
void SetCoord(const su2double *val_coord_i, const su2double *val_coord_j)
Set coordinates of the points.
Definition CNumerics.hpp:977
const su2double * Und_Lapl_j
Undivided laplacians at point j.
Definition CNumerics.hpp:111
su2double dist_j
Distance of point j to the nearest wall.
Definition CNumerics.hpp:108
void SetScalarVar(const su2double *val_scalarvar_i, const su2double *val_scalarvar_j)
Set the value of the scalar variable.
Definition CNumerics.hpp:370
void SetConsVarGradient(CMatrixView< const su2double > val_consvar_grad)
Set the gradient of the conservative variables.
Definition CNumerics.hpp:331
bool bounded_scalar
Flag for bounded scalar problem.
Definition CNumerics.hpp:207
su2double stochVar_i[3]
Stochastic variables at point i for Stochastic Backscatter Model.
Definition CNumerics.hpp:190
su2double Sensor_i
Pressure sensor at point i.
Definition CNumerics.hpp:113
const su2double * S_i
Vector of secondary variables at point i.
Definition CNumerics.hpp:125
void InvMatrix3D(su2double **matrix, su2double **invMatrix)
Computate the inverse of a 3x3 matrix.
Definition CNumerics.cpp:847
const su2double * WindGust_j
Wind gust at point j.
Definition CNumerics.hpp:178
CMatrixView< const su2double > PsiVar_Grad_j
Gradient of adjoint variables at point j.
Definition CNumerics.hpp:150
su2double stochReynStress[3][3]
Stochastic contribution to Reynolds stress tensor for Backscatter Model.
Definition CNumerics.hpp:187
su2double GetIntermittencyEff() const
Get the value of the effective intermittency for the transition model.
Definition CNumerics.hpp:809
void SetAdjointVar(const su2double *val_psi_i, const su2double *val_psi_j)
Set the value of the adjoint variable.
Definition CNumerics.hpp:349
virtual void ComputeResidual(su2double *val_residual, su2double **val_Jacobian_i, CConfig *config)
Definition CNumerics.hpp:1616
const su2double * RadVar_Source
Source term from the radiative heat transfer equation.
Definition CNumerics.hpp:161
bool uq_permute
Flag for eigenvector permutation.
Definition CNumerics.hpp:201
void SetVorticity(const su2double *val_vorticity_i, const su2double *val_vorticity_j)
Set the value of the vorticity.
Definition CNumerics.hpp:271
CMatrixView< const su2double > PrimVar_Grad_i
Gradient of primitive variables at point i.
Definition CNumerics.hpp:147
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
virtual void SetdTdU(su2double *val_dTdU_i, su2double *val_dTdU_j)
Set the temperature derivatives.
Definition CNumerics.hpp:1818
su2double AvgVolume
Average of the control Volume around point i for vorticity confinement parameter correction.
Definition CNumerics.hpp:174
const su2double * TransVar_i
Vector of turbulent variables at point i.
Definition CNumerics.hpp:138
void SetEnthalpy(su2double val_enthalpy_i, su2double val_enthalpy_j)
Set the value of the enthalpy.
Definition CNumerics.hpp:1037
const su2double * Vorticity_j
Vorticity.
Definition CNumerics.hpp:179
void SetAuxVarGrad(CMatrixView< const su2double > val_auxvar_grad_i, CMatrixView< const su2double > val_auxvar_grad_j)
Set the gradient of the auxiliary variables.
Definition CNumerics.hpp:816
void SetBetaInc2(su2double val_betainc2_i, su2double val_betainc2_j)
Set the value of the beta for incompressible flows.
Definition CNumerics.hpp:1017
void SetThermalConductivity_ve(su2double val_thermal_conductivity_ve_i, su2double val_thermal_conductivity_ve_j)
Set the thermal conductivity (translational/rotational)
Definition CNumerics.hpp:876
void SetScalarVarGradient(CMatrixView< const su2double > val_scalarvar_grad_i, CMatrixView< const su2double > val_scalarvar_grad_j)
Set the gradient of the scalar variables.
Definition CNumerics.hpp:390
unsigned short Neighbor_j
Number of neighbors of the point j.
Definition CNumerics.hpp:167
virtual void ComputeResidual(su2double *val_residual, su2double **val_Jacobian_i, su2double **val_Jacobian_j, CConfig *config)
Definition CNumerics.hpp:1552
void GetJacInviscidLambda_fabs(const su2double *val_velocity, su2double val_soundspeed, const su2double *val_normal, su2double *val_Lambda_Vector) const
Computation of the projected inviscid lambda (eingenvalues).
Definition CNumerics.cpp:991
CMatrixView< const su2double > PsiVar_Grad_i
Gradient of adjoint variables at point i.
Definition CNumerics.hpp:149
void SetSpecificHeat(su2double val_specific_heat_i, su2double val_specific_heat_j)
Set the specifc heat c_p.
Definition CNumerics.hpp:887
su2double Gamma_Minus_One
Fluids's Gamma - 1.0 .
Definition CNumerics.hpp:54
void SetNormal(const su2double *val_normal)
Set the value of the normal vector to the face between two points.
Definition CNumerics.hpp:1086
virtual void Compute_Tangent_Matrix(CElement *element_container, const CConfig *config)
A virtual member to compute the tangent matrix in structural problems.
Definition CNumerics.hpp:1686
su2double DensityInc_i
Incompressible density at point i.
Definition CNumerics.hpp:92
virtual void ComputeResidual(su2double *val_resconv_i, su2double *val_resvisc_i, su2double *val_resconv_j, su2double *val_resvisc_j, su2double **val_Jacobian_ii, su2double **val_Jacobian_ij, su2double **val_Jacobian_ji, su2double **val_Jacobian_jj, CConfig *config)
Definition CNumerics.hpp:1591
su2double Density_j
Density at point j.
Definition CNumerics.hpp:90
void SetIntermittency(su2double val_intermittency_i)
Set the value of the intermittency for the LM model.
Definition CNumerics.hpp:801
SST_ParsedOptions sstParsedOptions
additional options for the SST turbulence model
Definition CNumerics.hpp:197
void SetDistance(su2double val_dist_i, su2double val_dist_j)
Set the value of the distance from the nearest wall.
Definition CNumerics.hpp:948
static void AddQCR(size_t nDim, const Mat1 &gradvel, Mat2 &tau, Scalar2 turb_fraction)
Add a correction using a Quadratic Constitutive Relation to the stress tensor.
Definition CNumerics.hpp:535
virtual void ComputeResidual_TransLM(su2double *val_residual, su2double **val_Jacobian_i, su2double **val_Jacobian_j, CConfig *config, su2double &gamma_sep)
Residual for transition problems.
Definition CNumerics.hpp:1626
su2double Dissipation_j
Dissipation.
Definition CNumerics.hpp:181
void ComputeStochReynStress(su2double density, su2double tke, const Vec &rndVec, su2double Cmag, Mat &stochReynStress)
Compute a random contribution to the Reynolds stress tensor (Stochastic Backscatter Model).
Definition CNumerics.hpp:674
virtual void ComputeResidual(su2double *val_residual, CConfig *config)
Compute the numerical residual.
Definition CNumerics.hpp:1543
su2double Cp_i
Cp at point i.
Definition CNumerics.hpp:74
static bool CheckResidualNaNs(bool implicit, int nVar, const ResidualType<> residual)
Check if residual constains a NaN value.
Definition CNumerics.hpp:1659
const su2double * WindGust_i
Wind gust at point i.
Definition CNumerics.hpp:177
void GetInviscidProjJac(const su2double *val_velocity, const su2double *val_energy, const su2double *val_normal, su2double val_scale, su2double **val_Proj_Jac_tensor) const
Compute the projection of the inviscid Jacobian matrices.
Definition CNumerics.cpp:175
virtual void SetEve(su2double *val_Eve_i, su2double *val_Eve_j)
Set the vib-elec energy.
Definition CNumerics.hpp:1832
su2double ** tau
Viscous stress tensor.
Definition CNumerics.hpp:61
const su2double * S_j
Vector of secondary variables at point j.
Definition CNumerics.hpp:126
su2double intermittency_i
intermittency at point i.
Definition CNumerics.hpp:84
unsigned short Neighbor_i
Number of neighbors of the point i.
Definition CNumerics.hpp:166
virtual void SetGamma(su2double val_Gamma_i, su2double val_Gamma_j)
Set the ratio of specific heats.
Definition CNumerics.hpp:1846
void SetTurbAdjointVar(const su2double *val_turbpsivar_i, const su2double *val_turbpsivar_j)
Set the value of the adjoint turbulent variable.
Definition CNumerics.hpp:420
void SetConsVarGradient(CMatrixView< const su2double > val_consvar_grad_i, CMatrixView< const su2double > val_consvar_grad_j)
Set the gradient of the conservative variables.
Definition CNumerics.hpp:321
CMatrixView< const su2double > ScalarVar_Grad_j
Gradient of scalar variables at point j.
Definition CNumerics.hpp:152
su2double vel2_inf
value of the square of freestream speed.
Definition CNumerics.hpp:175
su2double Eddy_Viscosity_j
Eddy viscosity at point j.
Definition CNumerics.hpp:78
void SetSbsInBoxSensor(int8_t val_sbsInBox_i)
Set the sensor to locate the box where the Stochastic Backscatter Model is active.
Definition CNumerics.hpp:929
void SetAvgVolume(su2double val_avgvolume)
Set the value of AvgVolume Variable.
Definition CNumerics.hpp:1098
su2double Laminar_Viscosity_j
Laminar viscosity at point j.
Definition CNumerics.hpp:68
void SetMassFlux(const su2double val_MassFlux)
SetMassFlux.
Definition CNumerics.hpp:1858
void SetIntermittencyEff(su2double val_intermittency_eff_i)
Set the value of the effective intermittency for the LM model.
Definition CNumerics.hpp:793
su2double uq_delta_b
Magnitude of perturbation.
Definition CNumerics.hpp:199
void GetLMatrix(su2double val_soundspeed, su2double val_density, su2double **L_Matrix) const
Computation of the matrix R.
Definition CNumerics.cpp:729
void GetInviscidProjFlux(const su2double *val_density, const su2double *val_velocity, const su2double *val_pressure, const su2double *val_enthalpy, const su2double *val_normal, su2double *val_Proj_Flux) const
Compute the projected inviscid flux vector.
Definition CNumerics.cpp:90
const su2double * TurbPsi_j
Vector of adjoint turbulent variables at point j.
Definition CNumerics.hpp:142
void SetHeatFluxDiffusion(su2double val_heatfluxdiffusion)
Set the heat flux due to enthalpy diffusion.
Definition CNumerics.hpp:837
su2double BetaInc2_i
Beta incompressible at point i.
Definition CNumerics.hpp:95
void GetPrimitive2Conservative(const su2double *val_Mean_PrimVar, const su2double *val_Mean_SecVar, su2double **val_Jac_PC) const
Mapping between primitives variables P and conservatives variables C.
Definition CNumerics.cpp:1365
void ComputeResJacobianGiles(CFluidModel *FluidModel, su2double pressure, su2double density, const su2double *turboVel, su2double alphaInBC, su2double gammaInBC, su2double **R_c, su2double **R_c_inv)
Computation of the flow Residual Jacobian Matrix for Non Reflecting BC.
Definition CNumerics.cpp:792
su2double Minf
Free stream Mach number .
Definition CNumerics.hpp:55
void SetEddyViscosity(su2double val_eddy_viscosity_i, su2double val_eddy_viscosity_j)
Set the eddy viscosity.
Definition CNumerics.hpp:898
void SetTransVarGradient(CMatrixView< const su2double > val_transvar_grad_i, CMatrixView< const su2double > val_transvar_grad_j)
Set the gradient of the turbulent variables.
Definition CNumerics.hpp:401
void SetSoundSpeed(su2double val_soundspeed_i, su2double val_soundspeed_j)
Set the value of the sound speed.
Definition CNumerics.hpp:1027
su2double dist_i
Distance of point i to the nearest wall.
Definition CNumerics.hpp:107
void SetTimeStep(su2double val_timestep)
Set the time step.
Definition CNumerics.hpp:259
su2double JacHeatFluxDiffusion
Heat flux jacobian due to enthalpy diffusion for multicomponent.
Definition CNumerics.hpp:136
su2double Pressure_i
Pressure at point i.
Definition CNumerics.hpp:86
const su2double * Psi_i
Vector of adjoint variables at point i.
Definition CNumerics.hpp:128
su2double HeatFluxDiffusion
Heat flux due to enthalpy diffusion for multicomponent.
Definition CNumerics.hpp:134
virtual void Compute_NodalStress_Term(CElement *element_container, const CConfig *config)
A virtual member to compute the nodal stress term in non-linear structural problems.
Definition CNumerics.hpp:1692
virtual void SetRadVar(const su2double *val_radvar_i, const su2double *val_radvar_j)
Set the value of the radiation variable.
Definition CNumerics.hpp:1790
su2double Sensor_j
Pressure sensor at point j.
Definition CNumerics.hpp:114
const su2double * Und_Lapl_i
Undivided laplacians at point i.
Definition CNumerics.hpp:110
unsigned short nDim
Definition CNumerics.hpp:52
const su2double * GridVel_j
Grid velocity at point j.
Definition CNumerics.hpp:117
su2double Thermal_Conductivity_j
Thermal conductivity at point j.
Definition CNumerics.hpp:71
void GetInviscidIncProjFlux(const su2double *val_density, const su2double *val_velocity, const su2double *val_pressure, const su2double *val_betainc2, const su2double *val_enthalpy, const su2double *val_normal, su2double *val_Proj_Flux) const
Compute the projected inviscid flux vector for incompresible simulations.
Definition CNumerics.cpp:143
su2double intermittency_eff_i
effective intermittency at point i.
Definition CNumerics.hpp:83
virtual void SetMeshElasticProperties(unsigned long iElem, su2double val_E)
Set the element-based local Young's modulus in mesh problems.
Definition CNumerics.hpp:1699
void SetPressure(su2double val_pressure_i, su2double val_pressure_j)
Set the value of the pressure.
Definition CNumerics.hpp:997
CNumerics(void)
Constructor of the class.
Definition CNumerics.cpp:34
void SetTurbKineticEnergy(su2double val_turb_ke_i, su2double val_turb_ke_j)
Set the turbulent kinetic energy.
Definition CNumerics.hpp:909
void SetDissipation(su2double diss_i, su2double diss_j)
Sets the values of the roe dissipation.
Definition CNumerics.hpp:1105
const su2double * TransVar_j
Vector of turbulent variables at point j.
Definition CNumerics.hpp:139
virtual su2double GetGammaBC(void) const
A virtual member.
Definition CNumerics.hpp:1680
void GetAdjViscousFlux_Jac(su2double Pressure_i, su2double Pressure_j, su2double Density_i, su2double Density_j, su2double ViscDens_i, su2double ViscDens_j, const su2double *Velocity_i, const su2double *Velocity_j, su2double sq_vel_i, su2double sq_vel_j, su2double XiDens_i, su2double XiDens_j, su2double **Mean_GradPhi, const su2double *Mean_GradPsiE, su2double dPhiE_dn, const su2double *Normal, const su2double *Edge_Vector, su2double dist_ij_2, su2double *val_residual_i, su2double *val_residual_j, su2double **val_Jacobian_ii, su2double **val_Jacobian_ij, su2double **val_Jacobian_ji, su2double **val_Jacobian_jj, bool implicit) const
Compute viscous residual and jacobian.
Definition CNumerics.cpp:1013
int8_t sbsInBox_i
Sensor to assess if point i lies inside the box where the Stochastic Backscatter Model is active.
Definition CNumerics.hpp:196
void SetTransVar(const su2double *val_transvar_i, const su2double *val_transvar_j)
Set the value of the turbulent variable.
Definition CNumerics.hpp:380
su2double Lambda_i
Spectral radius at point i.
Definition CNumerics.hpp:98
su2double LocalGridLength_i
Local grid length at point i.
Definition CNumerics.hpp:160
void GetPrecondJacobian(su2double Beta2, su2double r_hat, su2double s_hat, su2double t_hat, su2double rB2a2, const su2double *val_Lambda, const su2double *val_normal, su2double **val_absPeJac) const
Computation of the matrix Td, this matrix diagonalize the preconditioned conservative Jacobians in th...
Definition CNumerics.cpp:924
const su2double delta[3][3]
Identity matrix.
Definition CNumerics.hpp:62
virtual void SetRadVarGradient(CMatrixView< const su2double > val_radvar_grad_i, CMatrixView< const su2double > val_radvar_grad_j)
Set the gradient of the radiation variables.
Definition CNumerics.hpp:1797
const su2double * V_j
Vector of primitive variables at point j.
Definition CNumerics.hpp:123
void GetPreconditionedProjJac(const su2double *val_density, const su2double *val_velocity, const su2double *val_betainc2, const su2double *val_normal, su2double **val_Proj_Jac_Tensor) const
Compute the projection of the preconditioned inviscid Jacobian matrices.
Definition CNumerics.cpp:347
const su2double * TurbPsi_i
Vector of adjoint turbulent variables at point i.
Definition CNumerics.hpp:141
su2double turb_ke_j
Turbulent kinetic energy at point j.
Definition CNumerics.hpp:81
su2double Enthalpy_j
Enthalpy at point j.
Definition CNumerics.hpp:105
void SetLocalGridLength(const su2double val_localGridLength_i)
Set the value of the turbulent variable.
Definition CNumerics.hpp:411
virtual ResidualType ComputeVibRelaxation(const CConfig *config)
Definition CNumerics.hpp:1643
virtual void SetCvve(su2double *val_Cvve_i, su2double *val_Cvve_j)
Set the vib-elec specific heat.
Definition CNumerics.hpp:1839
su2double uq_urlx
Under-relaxation factor for numerical stability.
Definition CNumerics.hpp:200
unsigned short Eig_Val_Comp
Component towards which perturbation is perfromed.
Definition CNumerics.hpp:198
const su2double * U_i
Vector of conservative variables at point i.
Definition CNumerics.hpp:119
virtual void Compute_Body_Forces(CElement *element_container, const CConfig *config)
A virtual member to compute the residual component due to body forces.
Definition CNumerics.hpp:1746
void GetPMatrix(const su2double &density, const su2double *velocity, const su2double &soundspeed, const su2double *normal, Matrix &p_tensor) const
Computation of the matrix P, this matrix diagonalize the conservative Jacobians in the form $P^{-1}(A...
Definition CNumerics.hpp:1268
void SetStrainMag(su2double val_strainmag_i, su2double val_strainmag_j)
Set the value of the rate of strain magnitude.
Definition CNumerics.hpp:281
const su2double * U_j
Vector of conservative variables at point j.
Definition CNumerics.hpp:120
su2double turb_ke_i
Turbulent kinetic energy at point i.
Definition CNumerics.hpp:80
void SetDiffusionCoeff(const su2double *val_diffusioncoeff_i, const su2double *val_diffusioncoeff_j)
Set the diffusion coefficient.
Definition CNumerics.hpp:827
const su2double * Coord_i
Cartesians coordinates of point i.
Definition CNumerics.hpp:163
virtual void SetCrossDiff(su2double val_CDkw_i)
Set the value of the cross diffusion for the SST model.
Definition CNumerics.hpp:787
su2double Thermal_Conductivity_i
Thermal conductivity at point i.
Definition CNumerics.hpp:70
virtual void Compute_Mass_Matrix(CElement *element_container, const CConfig *config)
A virtual member to compute the mass matrix.
Definition CNumerics.hpp:1740
void SetStochSource(su2double val_stoch_source, unsigned short iDim)
Set the stochastic source term for the Langevin equations (Backscatter Model).
Definition CNumerics.hpp:958
virtual void SetF2blending(su2double val_F2_i)
Set the value of the second blending function.
Definition CNumerics.hpp:781
#define NEVERINLINE
Definition code_config.hpp:50
#define FORCEINLINE
Definition code_config.hpp:44
passivedouble su2double
Definition code_config.hpp:181
T DotProduct(Int nDim, const T *a, const T *b)
Definition geometry_toolbox.hpp:65
T SquaredNorm(Int nDim, const T *a)
Definition geometry_toolbox.hpp:73
FORCEINLINE ARRAY_T exp(const ARRAY_T &x)
Definition special_vectorization.hpp:156
FORCEINLINE ARRAY_T sqrt(const ARRAY_T &x)
Definition special_vectorization.hpp:116
FORCEINLINE ARRAY_T pow(const ARRAY_T &a, const ARRAY_T &b)
Definition special_vectorization.hpp:179
passivedouble GetValue(const su2double &data)
Get the (primitive) value of the datatype (needs to be specialized for active types).
Definition datatype_structure.hpp:113
constexpr passivedouble EPS
Error scale.
Definition option_structure.hpp:100
Return type used in some "ComputeResidual" overloads to give a const-view of the internally stored fl...
Definition CNumerics.hpp:218
const Matrix_t jacobian_i
Definition CNumerics.hpp:220
const Vector_t residual
Definition CNumerics.hpp:219
su2double operator[](unsigned long idx) const
Definition CNumerics.hpp:234
const Matrix_t jacobian_j
Definition CNumerics.hpp:221
ResidualType(const Vector_t &res, const Matrix_t &jac_i, const Matrix_t &jac_j)
Definition CNumerics.hpp:225
Structure containing parsed SST options.
Definition option_structure.hpp:1136
Container to hold Variables for streamwise Periodic flow as they are often used together in places.
Definition option_structure.hpp:3003