Documentation 6b54b78464
Loading...
Searching...
No Matches
turb_sources.hpp
Go to the documentation of this file.
1/*!
2 * \file turb_sources.hpp
3 * \brief Numerics classes for integration of source terms in turbulence problems.
4 * \version 8.5.0 "Harrier"
5 *
6 * SU2 Project Website: https://su2code.github.io
7 *
8 * The SU2 Project is maintained by the SU2 Foundation
9 * (http://su2foundation.org)
10 *
11 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
12 *
13 * SU2 is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
17 *
18 * SU2 is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
25 */
26
27#pragma once
28
29#include "../../../../Common/include/toolboxes/geometry_toolbox.hpp"
30#include "../scalar/scalar_sources.hpp"
31
32/*!
33 * \class CSAVariables
34 * \ingroup SourceDiscr
35 * \brief Structure with SA common auxiliary functions and constants.
36 */
38 /*--- List of constants ---*/
39 const su2double cv1_3 = pow(7.1, 3);
40 const su2double k2 = pow(0.41, 2);
41 const su2double cb1 = 0.1355;
42 const su2double cw2 = 0.3;
43 const su2double ct3 = 1.2;
44 const su2double ct4 = 0.5;
45 const su2double cw3_6 = pow(2, 6);
46 const su2double sigma = 2.0 / 3.0;
47 const su2double cb2 = 0.622;
49 const su2double cw1 = cb1 / k2 + (1 + cb2) / sigma;
50 const su2double cr1 = 0.5;
51 const su2double CRot = 2.0;
52 const su2double c2 = 0.7, c3 = 0.9;
53
54 /*--- List of auxiliary functions ---*/
56
57 /*--- List of helpers ---*/
59
61};
62
63/*!
64 * \class CSourceBase_TurbSA
65 * \ingroup SourceDiscr
66 * \brief Class for integrating the source terms of the Spalart-Allmaras turbulence model equation.
67 * The variables that are subject to change in each variation/correction have their own class.
68 * \note Additional source terms (e.g. compressibility) are implemented as decorators.
69 */
70template <class FlowIndices, class Omega, class ft2, class ModVort, class rFunc, class SourceTerms>
72 protected:
73
74 /*--- Residual and Jacobian ---*/
75 su2double Residual[4], *Jacobian_i[4]; /*!< \brief Increase the size of residual and Jacobian for Langevin equations (Stochastic Backscatter Model).*/
76 su2double Jacobian_Buffer[16]; /*!< \brief Static storage for the Jacobian (which needs to be pointer for return type). */
77
78 const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */
79 const SA_ParsedOptions options; /*!< \brief Struct with SA options. */
80 const bool axisymmetric = false;
81
83
84 /*!
85 * \brief Add contribution from diffusion due to axisymmetric formulation to 2D residual
86 */
88 if (Coord_i[1] < EPS) return;
89
90 const su2double yinv = 1.0 / Coord_i[1];
91 const su2double& nue = ScalarVar_i[0];
92
93 const auto& density = V_i[idx.Density()];
94 const auto& laminar_viscosity = V_i[idx.LaminarViscosity()];
95
96 const su2double nu = laminar_viscosity/density;
97
98 su2double nu_e;
99
100 if (options.version == SA_OPTIONS::NEG && nue < 0.0) {
101 const su2double cn1 = 16.0;
102 const su2double Xi = nue / nu;
103 const su2double fn = (cn1 + Xi*Xi*Xi) / (cn1 - Xi*Xi*Xi);
104 nu_e = nu + fn * nue;
105 } else {
106 nu_e = nu + nue;
107 }
108
109 /* Diffusion source term */
110 const su2double dv_axi = (1.0/sigma)*nu_e*ScalarVar_Grad_i[0][1];
111
112 Residual[0] += yinv * dv_axi * Volume;
113 }
114
115 /*!
116 * \brief Include source-term residuals for Langevin equations (Stochastic Backscatter Model)
117 */
118 inline void ResidualStochEquations(su2double timeStep, const su2double ct,
119 su2double lengthScale, su2double DES_const,
120 const CSAVariables& var, TIME_MARCHING time_marching,
121 su2double threshold) {
122
123 const su2double& nue = ScalarVar_i[0];
124 const su2double nut = max(nue*var.fv1, 1e-10);
125 const su2double delta = lengthScale/DES_const;
126
127 if (delta > 1e-10) {
128
129 su2double tTurb = ct*pow(delta, 2)/nut;
130 su2double tRat = timeStep / tTurb;
131
132 su2double corrFac = 1.0;
133 if (time_marching == TIME_MARCHING::DT_STEPPING_2ND) {
134 corrFac = sqrt(0.5*(1.0+tRat)*(4.0+tRat)/(2.0+tRat));
135 } else if (time_marching == TIME_MARCHING::DT_STEPPING_1ST) {
136 corrFac = sqrt(1.0+0.5*tRat);
137 }
138
139 su2double scaleFactor = 0.0;
140 if (lesMode_i > threshold)
141 scaleFactor = 1.0/tTurb * sqrt(2.0/tRat) * corrFac;
142 else
143 tTurb = min(tTurb, 10.0*timeStep);
144
145 for (unsigned short iVar = 1; iVar < nVar; iVar++) {
146 Residual[iVar] = scaleFactor * stochSource[iVar-1] - 1.0/tTurb * ScalarVar_i[iVar];
147 Residual[iVar] *= Volume;
148 }
149
150 for (unsigned short iVar = 1; iVar < nVar; iVar++ )
151 Jacobian_i[iVar][iVar] = -1.0/tTurb * Volume;
152
153 }
154
155 }
156
157 /*!
158 * \brief Include stochastic source term in the Spalart-Allmaras turbulence model equation (Stochastic Backscatter Model).
159 */
160 inline void AddStochSource(const CConfig* config, CSAVariables& var, su2double& prod) {
161
162 su2double Cmag = ComputeStochRelaxFactor(config);
163 su2double threshold = config->GetSBSParam().stochFdThreshold;
164
165 su2double nut = ScalarVar_i[0] * var.fv1;
166 su2double tke = 0.0;
167 const su2double limiter = 5.0;
168 if (lesMode_i > threshold) tke = pow(nut/dist_i, 2);
169
170 su2double R12 = - Cmag * tke * ScalarVar_i[3];
171 su2double R13 = + Cmag * tke * ScalarVar_i[2];
172 su2double R23 = - Cmag * tke * ScalarVar_i[1];
173
174 su2double RGradU = R12*Vorticity_i[2] - R13*Vorticity_i[1] + R23*Vorticity_i[0];
175
176 su2double Ji_3 = pow(var.Ji, 3);
177 su2double Dfv1Dnut = 3.0 * var.fv1 * var.cv1_3 / (var.cv1_3 + Ji_3);
178 su2double fac = 1.0 / (var.fv1 + ScalarVar_i[0]*Dfv1Dnut);
179 su2double stochProdNut = RGradU * dist_i*dist_i/(2.0*ScalarVar_i[0]) * fac;
180 stochProdNut *= sbsInBox_i;
181 stochProdNut = max(-limiter*prod, min(limiter*prod, stochProdNut));
182
183 prod += stochProdNut;
184
185 }
186
187 public:
188 /*!
189 * \brief Constructor of the class.
190 * \param[in] nDim - Number of dimensions of the problem.
191 * \param[in] config - Definition of the particular problem.
192 */
193 CSourceBase_TurbSA(unsigned short nDim, const CConfig* config)
194 : CNumerics(nDim, (config->GetSBSParam().StochasticBackscatter && config->GetSBSParam().SBS_Ctau > 0.0) ? 4 : 1, config),
195 idx(nDim, config->GetnSpecies()),
196 options(config->GetSAParsedOptions()),
197 axisymmetric(config->GetAxisymmetric()),
198 transition_LM(config->GetKind_Trans_Model() == TURB_TRANS_MODEL::LM) {
199 /*--- Setup the Jacobian pointer, we need to return su2double** but we know
200 * the Jacobian is 1x1 so we use this trick to avoid heap allocation. ---*/
201 /*--- Setup the Jacobian pointer (size increased for Stochastic Backscatter Model). ---*/
202 for (unsigned short iVar = 0; iVar < 4; iVar++)
203 Jacobian_i[iVar] = Jacobian_Buffer + 4*iVar;
204 }
205
206 /*!
207 * \brief Residual for source term integration.
208 * \param[in] config - Definition of the particular problem.
209 * \return A lightweight const-view (read-only) of the residual/flux and Jacobians.
210 */
211 ResidualType<> ComputeResidual(const CConfig* config) override {
212 const auto& density = V_i[idx.Density()];
213 const auto& laminar_viscosity = V_i[idx.LaminarViscosity()];
214
216 AD::SetPreaccIn(density, laminar_viscosity, StrainMag_i, Volume, dist_i, roughness_i);
222
223 /*--- Common auxiliary variables and constants of the model. ---*/
224 CSAVariables var;
225
226 for (unsigned short iVar = 0; iVar < 4; iVar++) {
227 Residual[iVar] = 0.0;
228 for (unsigned short jVar = 0; jVar < 4; jVar++) {
229 Jacobian_i[iVar][jVar] = 0.0;
230 }
231 }
232
233 if (dist_i > 1e-10) {
234
235 var.dist_i_2 = pow(dist_i, 2);
236 const su2double nu = laminar_viscosity / density;
237 var.inv_k2_d2 = 1.0 / (var.k2 * var.dist_i_2);
238
239 /*--- Modified values for roughness, roughness_i = 0 for smooth walls and Ji remains the same.
240 * Ref: Aupoix, B. and Spalart, P. R., "Extensions of the Spalart-Allmaras Turbulence Model to Account for Wall
241 * Roughness," International Journal of Heat and Fluid Flow, Vol. 24, 2003, pp. 454-462.
242 * See https://turbmodels.larc.nasa.gov/spalart.html#sarough for detailed explanation. ---*/
243 var.Ji = ScalarVar_i[0] / nu + var.cr1 * (roughness_i / (dist_i + EPS));
244 var.d_Ji = 1.0 / nu;
245
246 const su2double Ji_2 = pow(var.Ji, 2);
247 const su2double Ji_3 = Ji_2 * var.Ji;
248
249 if (config->GetSBSParam().StochasticBackscatter && lesMode_i > config->GetSBSParam().stochFdThreshold) {
250 var.fv1 = 1.0;
251 var.d_fv1 = 0.0;
252 } else {
253 var.fv1 = Ji_3 / (Ji_3 + var.cv1_3);
254 var.d_fv1 = 3 * Ji_2 * var.cv1_3 / (nu * pow(Ji_3 + var.cv1_3, 2));
255 }
256
257 /*--- Using a modified relation so as to not change the Shat that depends on fv2.
258 * From NASA turb modeling resource and 2003 paper. ---*/
259 if (config->GetSBSParam().StochasticBackscatter && lesMode_i > config->GetSBSParam().stochFdThreshold) {
260 var.fv2 = 0.0;
261 var.d_fv2 = 0.0;
262 } else {
263 var.fv2 = 1 - ScalarVar_i[0] / (nu + ScalarVar_i[0] * var.fv1);
264 var.d_fv2 = -(1 / nu - Ji_2 * var.d_fv1) / pow(1 + var.Ji * var.fv1, 2);
265 }
266
267 /*--- Evaluate Omega with a rotational correction term. ---*/
268
269 Omega::get(Vorticity_i, nDim, PrimVar_Grad_i + idx.Velocity(), var);
270
271 /*--- Compute modified vorticity ---*/
272 ModVort::get(ScalarVar_i[0], nu, var);
273 var.inv_Shat = 1.0 / var.Shat;
274 var.Prod = var.Shat;
275
276 /*--- Dacles-Mariani et. al. rotation correction ("-R"). ---*/
277 if (options.rot) {
278 var.Prod += var.CRot * min(0.0, StrainMag_i - var.Omega);
279 /*--- Do not allow negative production for SA-neg. ---*/
280 if (ScalarVar_i[0] < 0) var.Prod = abs(var.Prod);
281 }
282
283 /*--- Compute ft2 term ---*/
284 ft2::get(var);
285
286 /*--- Compute auxiliary function r ---*/
287 rFunc::get(ScalarVar_i[0], var);
288
289 if (config->GetSBSParam().StochasticBackscatter && lesMode_i > config->GetSBSParam().stochFdThreshold) {
290 var.fw = 0.0;
291 var.d_fw = 0.0;
292 } else {
293 var.g = var.r + var.cw2 * (pow(var.r, 6) - var.r);
294 var.g_6 = pow(var.g, 6);
295 var.glim = pow((1 + var.cw3_6) / (var.g_6 + var.cw3_6), 1.0 / 6.0);
296 var.fw = var.g * var.glim;
297 var.d_g = var.d_r * (1 + var.cw2 * (6 * pow(var.r, 5) - 1));
298 var.d_fw = var.d_g * var.glim * (1 - var.g_6 / (var.g_6 + var.cw3_6));
299 }
300
302
303 if (options.bc) {
304 /*--- BC transition model (2020 revision). This should only be used with SA-noft2.
305 * TODO: Consider making this part of the "SourceTerms" template. ---*/
306 const su2double chi_1 = 0.002;
307 const su2double chi_2 = 50.0;
308
309 /*--- Turbulence intensity is u'/U so we multiply by 100 to get percentage. ---*/
310 const su2double tu = 100.0 * config->GetTurbulenceIntensity_FreeStream();
311 const su2double nu_t = ScalarVar_i[0] * var.fv1;
312
313 const su2double re_v = density * var.dist_i_2 / laminar_viscosity * var.Omega;
314 const su2double re_theta = re_v / 2.193;
315 /*--- Menter correlation. ---*/
316 const su2double re_theta_t = 803.73 * pow(tu + 0.6067, -1.027);
317
318 const su2double term1 = sqrt(max(re_theta - re_theta_t, 0.0) / (chi_1 * re_theta_t));
319 const su2double term2 = sqrt(max((nu_t * chi_2) / nu, 0.0));
320 const su2double term_exponential = (term1 + term2);
321
322 intermittency_eff_i = 1.0 - exp(-term_exponential);
324 var.interDestrFactor = 1;
325
326 } else if (transition_LM){
327
329 // Is wrong the reference from NASA?
330 // Original max(min(gamma, 0.5), 1.0) always gives 1 as result.
331 var.interDestrFactor = min(max(intermittency_i, 0.5), 1.0);
332
333 } else {
334 /*--- Do not modify the production. ---*/
335 var.intermittency = 1.0;
336 var.interDestrFactor = 1.0;
337 }
338
339 /*--- Compute production, destruction and jacobian ---*/
340 su2double Production = 0.0, Destruction = 0.0;
341 SourceTerms::get(ScalarVar_i[0], var, Production, Destruction, Jacobian_i[0][0]);
342
343 if (config->GetSBSParam().StochasticBackscatter && config->GetSBSParam().stochSourceNu)
344 AddStochSource(config, var, Production);
345
346 Residual[0] = (Production - Destruction) * Volume;
347
349
350 Jacobian_i[0][0] *= Volume;
351
352 /*--- Compute residual for Langevin equations (Stochastic Backscatter Model). ---*/
353
354 if (config->GetSBSParam().StochasticBackscatter && config->GetSBSParam().SBS_Ctau > 0.0) {
355 const su2double DES_const = config->GetConst_DES();
356 ResidualStochEquations(config->GetDelta_UnstTime(), config->GetSBSParam().SBS_Ctau, dist_i, DES_const,
357 var, config->GetTime_Marching(), config->GetSBSParam().stochFdThreshold);
358 }
359 }
360
363
364 return ResidualType<>(Residual, Jacobian_i, nullptr);
365 }
366};
367
368namespace detail {
369
370/* =============================================================================
371 * SPALART-ALLMARAS VARIATIONS AND CORRECTIONS
372 * ============================================================================*/
373
374/*!
375 * \brief SA strain rate classes.
376 * \ingroup SourceDiscr
377 * \param[in] vorticity: Vorticity array.
378 * \param[in] nDim: Problem dimension.
379 * \param[in] velocity_grad: Velocity gradients.
380 * \param[out] var: Common SA variables struct (to set Omega).
381 */
382struct Omega {
383
384/*! \brief Baseline. */
385struct Bsl {
386 template <class MatrixType>
387 static void get(const su2double* vorticity, unsigned short, const MatrixType&, CSAVariables& var) {
388 var.Omega = GeometryToolbox::Norm(3, vorticity);
389 }
390};
391
392/*! \brief Edward. Here Omega is the Strain Rate. */
393struct Edw {
394 template <class MatrixType>
395 static void get(const su2double*, unsigned short nDim, const MatrixType& velocity_grad, CSAVariables& var) {
396 su2double Sbar = 0.0;
397 for (unsigned short iDim = 0; iDim < nDim; ++iDim) {
398 for (unsigned short jDim = 0; jDim < nDim; ++jDim) {
399 Sbar += (velocity_grad[iDim][jDim] + velocity_grad[jDim][iDim]) * velocity_grad[iDim][jDim];
400 }
401 }
402 for (unsigned short iDim = 0; iDim < nDim; ++iDim) {
403 Sbar -= (2.0 / 3.0) * pow(velocity_grad[iDim][iDim], 2);
404 }
405 var.Omega = sqrt(max(Sbar, 0.0));
406 }
407};
408};
409
410/*!
411 * \brief SA classes to set the ft2 term and its derivative.
412 * \ingroup SourceDiscr
413 * \param[in,out] var: Common SA variables struct.
414 */
415struct ft2 {
416
417/*! \brief No-ft2 term. */
418struct Zero {
419 static void get(CSAVariables& var) {
420 var.ft2 = 0.0;
421 var.d_ft2 = 0.0;
422 }
423};
424
425/*! \brief Non-zero ft2 term according to the literature. */
426struct Nonzero {
427 static void get(CSAVariables& var) {
428 const su2double xsi2 = pow(var.Ji, 2);
429 var.ft2 = var.ct3 * exp(-var.ct4 * xsi2);
430 var.d_ft2 = -2.0 * var.ct4 * var.Ji * var.ft2 * var.d_Ji;
431 }
432};
433};
434
435/*!
436 * \brief SA classes to compute the modified vorticity (\tilde{S}) and its derivative.
437 * \ingroup SourceDiscr
438 * \param[in] nue: SA variable.
439 * \param[in] nu: Laminar viscosity.
440 * \param[in,out] var: Common SA variables struct.
441 */
442struct ModVort {
443
444/*! \brief Baseline. */
445struct Bsl {
446 static void get(const su2double& nue, const su2double& nu, CSAVariables& var) {
447 const su2double Sbar = nue * var.fv2 * var.inv_k2_d2;
448 const su2double c2 = 0.7, c3 = 0.9;
449
450 /*--- Limiting of \hat{S} based on "Modifications and Clarifications for the Implementation of the Spalart-Allmaras Turbulence Model"
451 * Note 1 option c in https://turbmodels.larc.nasa.gov/spalart.html ---*/
452 const su2double d_Sbar = (var.fv2 + nue * var.d_fv2) * var.inv_k2_d2;
453 if (Sbar >= - c2 * var.Omega) {
454 var.Shat = var.Omega + Sbar;
455 var.d_Shat = d_Sbar;
456 } else {
457 const su2double Num = var.Omega * (c2 * c2 * var.Omega + c3 * Sbar);
458 const su2double Den = (c3 - 2 * c2) * var.Omega - Sbar;
459 var.Shat = var.Omega + Num / Den;
460 var.d_Shat = d_Sbar * (c3 * var.Omega + Num / Den) / Den;
461 }
462 if (var.Shat <= 1e-10) {
463 var.Shat = 1e-10;
464 var.d_Shat = 0.0;
465 }
466 }
467};
468
469/*! \brief Edward. */
470struct Edw {
471 static void get(const su2double& nue, const su2double& nu, CSAVariables& var) {
472 var.Shat = max(var.Omega * ((1.0 / max(var.Ji, 1.0e-16)) + var.fv1), 1.0e-16);
473 var.Shat = max(var.Shat, 1.0e-10);
474 if (var.Shat <= 1.0e-10) {
475 var.d_Shat = 0.0;
476 } else {
477 var.d_Shat = -var.Omega * pow(var.Ji, -2) / nu + var.Omega * var.d_fv1;
478 }
479 }
480};
481
482/*! \brief Negative. */
483struct Neg {
484 static void get(const su2double& nue, const su2double& nu, CSAVariables& var) {
485 if (nue > 0.0) {
486 // Baseline solution
487 Bsl::get(nue, nu, var);
488 } else {
489 var.Shat = var.Omega;
490 var.d_Shat = 0.0;
491 }
492 /*--- Don't check whether Sbar <>= -cv2*S.
493 * Steven R. Allmaras, Forrester T. Johnson and Philippe R. Spalart -
494 * "Modifications and Clarifications for the Implementation of the Spalart-Allmaras Turbulence Model" eq. 12
495 * No need for Sbar ---*/
496 }
497};
498};
499
500/*!
501 * \brief SA auxiliary function r and its derivative.
502 * \ingroup SourceDiscr
503 * \param[in] nue: SA variable.
504 * \param[in,out] var: Common SA variables struct.
505 */
506struct r {
507
508/*! \brief Baseline. */
509struct Bsl {
510 static void get(const su2double& nue, CSAVariables& var) {
511 var.r = min(nue * var.inv_Shat * var.inv_k2_d2, 10.0);
512 var.d_r = (var.Shat - nue * var.d_Shat) * pow(var.inv_Shat, 2) * var.inv_k2_d2;
513 if (var.r >= 10.0) var.d_r = 0.0;
514 }
515};
516
517/*! \brief Edward. */
518struct Edw {
519 static void get(const su2double& nue, CSAVariables& var) {
520 var.r = min(nue * var.inv_Shat * var.inv_k2_d2, 10.0);
521 var.r = tanh(var.r) / tanh(1.0);
522
523 var.d_r = (var.Shat - nue * var.d_Shat) * pow(var.inv_Shat, 2) * var.inv_k2_d2;
524 var.d_r = (1 - pow(tanh(var.r), 2.0)) * (var.d_r) / tanh(1.0);
525 }
526};
527};
528
529/*!
530 * \brief SA source terms classes: production and destruction term and their derivative.
531 * \note Quadratic diffusion is included in the viscous fluxes.
532 * \ingroup SourceDiscr
533 * \param[in] nue: SA variable.
534 * \param[in] var: Common SA variables struct.
535 * \param[out] production: Production term.
536 * \param[out] destruction: Destruction term.
537 * \param[out] jacobian: Derivative of the combined source term wrt nue.
538 */
540
541/*! \brief Baseline (Original SA model). */
542struct Bsl {
543 static void get(const su2double& nue, const CSAVariables& var, su2double& production, su2double& destruction,
544 su2double& jacobian) {
545 ComputeProduction(nue, var, production, jacobian);
546 ComputeDestruction(nue, var, destruction, jacobian);
547 }
548
549 static void ComputeProduction(const su2double& nue, const CSAVariables& var, su2double& production,
550 su2double& jacobian) {
551 const su2double factor = var.intermittency * var.cb1;
552 production = factor * (1.0 - var.ft2) * var.Prod * nue;
553 jacobian += factor * (-var.Prod * nue * var.d_ft2 + (1.0 - var.ft2) * (nue * var.d_Shat + var.Prod));
554 }
555
556 static void ComputeDestruction(const su2double& nue, const CSAVariables& var, su2double& destruction,
557 su2double& jacobian) {
558 const su2double cb1_k2 = var.cb1 / var.k2;
559 const su2double factor = var.cw1 * var.fw - cb1_k2 * var.ft2;
560 destruction = var.interDestrFactor * factor * pow(nue, 2) / var.dist_i_2;
561 jacobian -= var.interDestrFactor * ((var.cw1 * var.d_fw - cb1_k2 * var.d_ft2) * pow(nue, 2) + factor * 2 * nue) / var.dist_i_2;
562 }
563
564};
565
566/*! \brief Negative. */
567struct Neg {
568 static void get(const su2double& nue, const CSAVariables& var, su2double& production, su2double& destruction,
569 su2double& jacobian) {
570 if (nue > 0.0) {
571 Bsl::get(nue, var, production, destruction, jacobian);
572 } else {
573 ComputeProduction(nue, var, production, jacobian);
574 ComputeDestruction(nue, var, destruction, jacobian);
575 }
576 }
577
578 static void ComputeProduction(const su2double& nue, const CSAVariables& var, su2double& production,
579 su2double& jacobian) {
580 const su2double dP_dnu = var.intermittency * var.cb1 * (1.0 - var.ct3) * var.Prod;
581 production = dP_dnu * nue;
582 jacobian += dP_dnu;
583 }
584
585 static void ComputeDestruction(const su2double& nue, const CSAVariables& var, su2double& destruction,
586 su2double& jacobian) {
587 /*--- The destruction when nue < 0 is added instead of the usual subtraction, hence the negative sign. ---*/
588 const su2double dD_dnu = -var.cw1 * nue / var.dist_i_2;
589 destruction = dD_dnu * nue * var.interDestrFactor;
590 jacobian -= 2 * dD_dnu * var.interDestrFactor;
591 }
592
593};
594};
595
596/* =============================================================================
597 * SPALART-ALLMARAS ADDITIONAL SOURCE TERMS DECORATORS
598 * ============================================================================*/
599
600/*!
601 * \class CCompressibilityCorrection
602 * \ingroup SourceDiscr
603 * \brief Mixing Layer Compressibility Correction (SA-comp).
604 */
605template <class ParentClass>
606class CCompressibilityCorrection final : public ParentClass {
607 private:
608 using ParentClass::Gamma;
609 using ParentClass::idx;
610 using ParentClass::nDim;
611 using ParentClass::PrimVar_Grad_i;
612 using ParentClass::ScalarVar_i;
613 using ParentClass::V_i;
614 using ParentClass::Volume;
615
616 using ResidualType = typename ParentClass::template ResidualType<>;
617
618 const su2double c5 = 3.5;
619
620 public:
621 /*!
622 * \brief Constructor of the class.
623 * \param[in] nDim - Number of dimensions of the problem.
624 * \param[in] config - Definition of the particular problem.
625 */
626 CCompressibilityCorrection(unsigned short nDim, const CConfig* config)
627 : ParentClass(nDim, config) {}
628
629 /*!
630 * \brief Residual for source term integration.
631 * \param[in] config - Definition of the particular problem.
632 * \return A lightweight const-view (read-only) of the residual/flux and Jacobians.
633 */
634 ResidualType ComputeResidual(const CConfig* config) override {
635 /*--- Residual from standard SA ---*/
636 ParentClass::ComputeResidual(config);
637
638 /*--- Compressibility Correction term ---*/
639 const auto& pressure = V_i[idx.Pressure()];
640 const auto& density = V_i[idx.Density()];
641 const su2double sound_speed = sqrt(pressure * Gamma / density);
642 su2double aux_cc = 0;
643 for (unsigned short iDim = 0; iDim < nDim; ++iDim) {
644 for (unsigned short jDim = 0; jDim < nDim; ++jDim) {
645 aux_cc += pow(PrimVar_Grad_i[idx.Velocity() + iDim][jDim], 2);
646 }
647 }
648 const su2double d_CompCorrection = 2.0 * c5 * ScalarVar_i[0] / pow(sound_speed, 2) * aux_cc * Volume;
649 const su2double CompCorrection = 0.5 * ScalarVar_i[0] * d_CompCorrection;
650
651 /*--- Axisymmetric contribution ---*/
652 if (this->axisymmetric && this->Coord_i[1] > EPS) {
653 const su2double yinv = 1.0 / this->Coord_i[1];
654 const su2double nue = ScalarVar_i[0];
655 const su2double v = V_i[idx.Velocity() + 1];
656
657 const su2double d_axiCorrection = 2.0 * c5 * nue * pow(v * yinv / sound_speed, 2) * Volume;
658 const su2double axiCorrection = 0.5 * nue * d_axiCorrection;
659
660 this->Residual[0] -= axiCorrection;
661 this->Jacobian_i[0][0] -= d_axiCorrection;
662 }
663
664 this->Residual[0] -= CompCorrection;
665 this->Jacobian_i[0][0] -= d_CompCorrection;
666
667 return ResidualType(this->Residual, this->Jacobian_i, nullptr);
668 }
669};
670
671/* =============================================================================
672 * HELPERS TO INSTANTIATE THE SA BASE CLASS
673 * ============================================================================*/
674
675template <class FlowIndices>
680
681template <class FlowIndices>
686
687template <class FlowIndices>
692
693template <class BaseType, class... Ts>
694CNumerics* AddCompressibilityCorrection(bool use_comp, Ts... args) {
695 if (use_comp) {
697 } else {
698 return new BaseType(args...);
699 }
700}
701
702template <class BaseType, class... Ts>
703CNumerics* SAFactoryImpl(bool use_ft2, Ts... args) {
704 if (use_ft2) {
705 return AddCompressibilityCorrection<typename BaseType::template type<ft2::Nonzero>>(args...);
706 } else {
707 return AddCompressibilityCorrection<typename BaseType::template type<ft2::Zero>>(args...);
708 }
709}
710
711} // namespace detail
712
713/*!
714 * \brief Creates an SA source based on the version and modifications/correction in the config.
715 * \ingroup SourceDiscr
716 */
717template <class FlowIndices>
718CNumerics* SAFactory(unsigned short nDim, const CConfig* config) {
719 const auto options = config->GetSAParsedOptions();
720
721 switch (options.version) {
722 case SA_OPTIONS::NONE:
723 return detail::SAFactoryImpl<detail::BaselineSA<FlowIndices>>(options.ft2, options.comp, nDim, config);
724 case SA_OPTIONS::NEG:
725 return detail::SAFactoryImpl<detail::NegativeSA<FlowIndices>>(options.ft2, options.comp, nDim, config);
726 case SA_OPTIONS::EDW:
727 return detail::SAFactoryImpl<detail::EdwardsSA<FlowIndices>>(options.ft2, options.comp, nDim, config);
728 default:
729 break;
730 }
731 return nullptr;
732}
733
734/*!
735 * \class CSourcePieceWise_TurbSST
736 * \ingroup SourceDiscr
737 * \brief Class for integrating the source terms of the Menter SST turbulence model equations.
738 */
739template <class FlowIndices>
741 private:
742 const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */
743 const bool sustaining_terms = false;
744 const bool axisymmetric = false;
745
746 /*--- Closure constants ---*/
747 const su2double sigma_k_1, sigma_k_2, sigma_w_1, sigma_w_2, beta_1, beta_2, beta_star, a1, alfa_1, alfa_2;
748 const su2double prod_lim_const;
749
750 /*--- Ambient values for SST-SUST. ---*/
751 const su2double kAmb, omegaAmb;
752
753 su2double F1_i, F2_i, CDkw_i;
754 su2double Residual[2];
755 su2double* Jacobian_i[2];
756 su2double Jacobian_Buffer[4]; /// Static storage for the Jacobian (which needs to be pointer for return type).
757
758 /*!
759 * \brief Get strain magnitude based on perturbed reynolds stress matrix.
760 * \param[in] turb_ke: turbulent kinetic energy of the node.
761 */
762 inline su2double PerturbedStrainMag(su2double turb_ke) const {
763 /*--- Compute norm of perturbed strain rate tensor. ---*/
764
765 su2double perturbedStrainMag = 0;
766 for (unsigned short iDim = 0; iDim < nDim; iDim++) {
767 for (unsigned short jDim = 0; jDim < nDim; jDim++) {
768 su2double StrainRate_ij = MeanPerturbedRSM[iDim][jDim] - TWO3 * turb_ke * delta[iDim][jDim];
769 StrainRate_ij = -StrainRate_ij * Density_i / (2 * Eddy_Viscosity_i);
770
771 perturbedStrainMag += pow(StrainRate_ij, 2.0);
772 }
773 }
774 return sqrt(2.0 * perturbedStrainMag);
775 }
776
777 /*!
778 * \brief Add contribution from convection and diffusion due to axisymmetric formulation to 2D residual
779 */
780 inline void ResidualAxisymmetricConvectionDiffusion(su2double alfa_blended, su2double zeta) {
781 if (Coord_i[1] < EPS) return;
782
783 const su2double yinv = 1.0 / Coord_i[1];
784 const su2double rhov = Density_i * V_i[idx.Velocity() + 1];
785 const su2double& k = ScalarVar_i[0];
786 const su2double& w = ScalarVar_i[1];
787
788 /*--- Compute blended constants ---*/
789 const su2double sigma_k_i = F1_i * sigma_k_1 + (1.0 - F1_i) * sigma_k_2;
790 const su2double sigma_w_i = F1_i * sigma_w_1 + (1.0 - F1_i) * sigma_w_2;
791
792 /*--- Convection-Diffusion ---*/
793 const su2double cdk_axi = rhov * k - (Laminar_Viscosity_i + sigma_k_i * Eddy_Viscosity_i) * ScalarVar_Grad_i[0][1];
794 const su2double cdw_axi = rhov * w - (Laminar_Viscosity_i + sigma_w_i * Eddy_Viscosity_i) * ScalarVar_Grad_i[1][1];
795
796 /*--- Add terms to the residuals ---*/
797
798 Residual[0] -= yinv * Volume * cdk_axi;
799 Residual[1] -= yinv * Volume * cdw_axi;
800
801 Jacobian_i[0][0] -= yinv * Volume * rhov;
802 Jacobian_i[0][1] -= 0.0;
803 Jacobian_i[1][0] -= 0.0;
804 Jacobian_i[1][1] -= yinv * Volume * rhov;
805
806 }
807
808 public:
809 /*!
810 * \brief Constructor of the class.
811 * \param[in] val_nDim - Number of dimensions of the problem.
812 * \param[in] constants - SST model constants.
813 * \param[in] val_kine_Inf - Freestream k, for SST with sustaining terms.
814 * \param[in] val_omega_Inf - Freestream w, for SST with sustaining terms.
815 * \param[in] config - Definition of the particular problem.
816 */
817 CSourcePieceWise_TurbSST(unsigned short val_nDim, unsigned short, const su2double* constants, su2double val_kine_Inf,
818 su2double val_omega_Inf, const CConfig* config)
819 : CNumerics(val_nDim, 2, config),
820 idx(val_nDim, config->GetnSpecies()),
821 axisymmetric(config->GetAxisymmetric()),
822 sigma_k_1(constants[0]),
823 sigma_k_2(constants[1]),
824 sigma_w_1(constants[2]),
825 sigma_w_2(constants[3]),
826 beta_1(constants[4]),
827 beta_2(constants[5]),
828 beta_star(constants[6]),
829 a1(constants[7]),
830 alfa_1(constants[8]),
831 alfa_2(constants[9]),
832 prod_lim_const(constants[10]),
833 kAmb(val_kine_Inf),
834 omegaAmb(val_omega_Inf) {
835 /*--- "Allocate" the Jacobian using the static buffer. ---*/
836 Jacobian_i[0] = Jacobian_Buffer;
837 Jacobian_i[1] = Jacobian_Buffer + 2;
838 }
839
840 /*!
841 * \brief Set the value of the first blending function.
842 * \param[in] val_F1_i - Value of the first blending function at point i.
843 * \param[in] Not used.
844 */
845 inline void SetF1blending(su2double val_F1_i, su2double) override {
846 F1_i = val_F1_i;
847 }
848
849 /*!
850 * \brief Set the value of the second blending function.
851 * \param[in] val_F2_i - Value of the second blending function at point i.
852 */
853 inline void SetF2blending(su2double val_F2_i) override {
854 F2_i = val_F2_i;
855 }
856
857 /*!
858 * \brief Set the value of the cross diffusion for the SST model.
859 * \param[in] val_CDkw_i - Value of the cross diffusion at point i.
860 */
861 inline void SetCrossDiff(su2double val_CDkw_i) override {
862 CDkw_i = val_CDkw_i;
863 }
864
865 /*!
866 * \brief Residual for source term integration.
867 * \param[in] config - Definition of the particular problem.
868 * \return A lightweight const-view (read-only) of the residual/flux and Jacobians.
869 */
870 ResidualType<> ComputeResidual(const CConfig* config) override {
877 AD::SetPreaccIn(F1_i);
878 AD::SetPreaccIn(F2_i);
879 AD::SetPreaccIn(PrimVar_Grad_i, nDim + idx.Velocity(), nDim);
881 AD::SetPreaccIn(V_i[idx.Density()], V_i[idx.LaminarViscosity()], V_i[idx.EddyViscosity()]);
882 AD::SetPreaccIn(V_i[idx.Velocity() + 1]);
883 AD::SetPreaccIn(V_i[idx.SoundSpeed()]);
884
885 Density_i = V_i[idx.Density()];
886 Laminar_Viscosity_i = V_i[idx.LaminarViscosity()];
887 Eddy_Viscosity_i = V_i[idx.EddyViscosity()];
888
889 Residual[0] = 0.0;
890 Residual[1] = 0.0;
891 Jacobian_i[0][0] = 0.0;
892 Jacobian_i[0][1] = 0.0;
893 Jacobian_i[1][0] = 0.0;
894 Jacobian_i[1][1] = 0.0;
895
896 /*--- Computation of blended constants for the source terms ---*/
897
898 const su2double alfa_blended = F1_i * alfa_1 + (1.0 - F1_i) * alfa_2;
899 const su2double beta_blended = F1_i * beta_1 + (1.0 - F1_i) * beta_2;
900
901 su2double eff_intermittency = 1.0;
902
903 if (config->GetKind_Trans_Model() == TURB_TRANS_MODEL::LM) {
905 eff_intermittency = intermittency_eff_i;
906 }
907
908 if (dist_i > 1e-10) {
909
910 su2double diverg = 0.0;
911 for (unsigned short iDim = 0; iDim < nDim; iDim++)
912 diverg += PrimVar_Grad_i[iDim + idx.Velocity()][iDim];
913 if (axisymmetric && Coord_i[1] > EPS) {
915 diverg += V_i[idx.Velocity() + 1] / Coord_i[1];
916 }
917
918 /*--- If using UQ methodolgy, calculate production using perturbed Reynolds stress matrix ---*/
919
920 const su2double VorticityMag = GeometryToolbox::Norm(3, Vorticity_i);
921 su2double P_Base = 0;
922 su2double zetaFMt = 0.0;
923 const su2double Mt = sqrt(2.0 * ScalarVar_i[0]) / V_i[idx.SoundSpeed()];
924
925 /*--- Apply production term modifications ---*/
927 case SST_OPTIONS::UQ:
930 P_Base = PerturbedStrainMag(ScalarVar_i[0]);
931 break;
932
933 case SST_OPTIONS::V:
934 P_Base = VorticityMag;
935 break;
936
937 case SST_OPTIONS::KL:
938 P_Base = sqrt(StrainMag_i*VorticityMag);
939 break;
940
942 P_Base = StrainMag_i;
943 if (Mt >= 0.25) {
944 zetaFMt = 2.0 * (Mt * Mt - 0.25 * 0.25);
945 }
946 break;
947
949 P_Base = StrainMag_i;
950 if (Mt >= 0.25) {
951 zetaFMt = 0.5 * (Mt * Mt);
952 }
953 break;
954
955 default:
956 /*--- Base production term for SST-1994 and SST-2003 ---*/
957 P_Base = StrainMag_i;
958 break;
959 }
960
961 /*--- Production limiter. ---*/
962 const su2double prod_limit = prod_lim_const * beta_star * Density_i * ScalarVar_i[1] * ScalarVar_i[0];
963
964 su2double P = Eddy_Viscosity_i * pow(P_Base, 2);
965 su2double pk = max(0.0, min(P, prod_limit));
966
967 const auto& eddy_visc_var = sstParsedOptions.version == SST_OPTIONS::V1994 ? VorticityMag : StrainMag_i;
968 const su2double zeta = max(ScalarVar_i[1], eddy_visc_var * F2_i / a1);
969
970 /*--- Production limiter only for V2003, recompute for V1994. ---*/
971 su2double pw;
973 pw = alfa_blended * Density_i * pow(P_Base, 2);
974 } else {
975 pw = (alfa_blended * Density_i / Eddy_Viscosity_i) * pk;
976 }
977
978 /*--- Sustaining terms, if desired. Note that if the production terms are
979 larger equal than the sustaining terms, the original formulation is
980 obtained again. This is in contrast to the version in literature
981 where the sustaining terms are simply added. This latter approach could
982 lead to problems for very big values of the free-stream turbulence
983 intensity. ---*/
985 const su2double sust_k = beta_star * Density_i * kAmb * omegaAmb;
986 const su2double sust_w = beta_blended * Density_i * omegaAmb * omegaAmb;
987 pk = max(pk, sust_k);
988 pw = max(pw, sust_w);
989 }
990
992 const su2double Dilatation_Sarkar = -0.15 * pk * Mt + 0.2 * beta_star * (1.0 +zetaFMt) * Density_i * ScalarVar_i[1] * ScalarVar_i[0] * Mt * Mt;
993 pk += Dilatation_Sarkar;
994 }
995
996 /*--- Dissipation ---*/
997
998 su2double dk = beta_star * Density_i * ScalarVar_i[1] * ScalarVar_i[0] * (1.0 + zetaFMt);
999 su2double dw = beta_blended * Density_i * ScalarVar_i[1] * ScalarVar_i[1] * (1.0 - 0.09/beta_blended * zetaFMt);
1000
1001 /*--- LM model coupling with production and dissipation term for k transport equation---*/
1002 if (config->GetKind_Trans_Model() == TURB_TRANS_MODEL::LM) {
1003 pk = pk * eff_intermittency;
1004 dk = min(max(eff_intermittency, 0.1), 1.0) * dk;
1005 }
1006
1007 /*--- Add the production terms to the residuals. ---*/
1008
1009 Residual[0] += pk * Volume;
1010 Residual[1] += pw * Volume;
1011
1012 /*--- Add the dissipation terms to the residuals.---*/
1013
1014 Residual[0] -= dk * Volume;
1015 Residual[1] -= dw * Volume;
1016
1017 /*--- Cross diffusion is included in the viscous fluxes, not this source term. ---*/
1018
1019 /*--- Contribution due to 2D axisymmetric formulation ---*/
1020
1021 if (axisymmetric) ResidualAxisymmetricConvectionDiffusion(alfa_blended, zeta);
1022
1023 /*--- Implicit part ---*/
1024
1025 Jacobian_i[0][0] = -beta_star * ScalarVar_i[1] * Volume * (1.0 + zetaFMt);
1026 Jacobian_i[0][1] = -beta_star * ScalarVar_i[0] * Volume * (1.0 + zetaFMt);
1027 Jacobian_i[1][0] = 0.0;
1028 Jacobian_i[1][1] = -2.0 * beta_blended * ScalarVar_i[1] * Volume * (1.0 - 0.09/beta_blended * zetaFMt);
1029 }
1030
1031 AD::SetPreaccOut(Residual, nVar);
1032 AD::EndPreacc();
1033
1034 return ResidualType<>(Residual, Jacobian_i, nullptr);
1035 }
1036};
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
SA_ParsedOptions GetSAParsedOptions() const
Get parsed SA option data structure.
Definition CConfig.hpp:10377
const CStochBackScatParam & GetSBSParam(void) const
Get the Stochastic BackScatter (SBS) model parameters.
Definition CConfig.hpp:9766
su2double GetConst_DES(void) const
Get the DES Constant.
Definition CConfig.hpp:9772
su2double GetDelta_UnstTime(void) const
If we are prforming an unsteady simulation, there is only one value of the time step for the complete...
Definition CConfig.hpp:6201
TURB_TRANS_MODEL GetKind_Trans_Model(void) const
Get the kind of the transition model.
Definition CConfig.hpp:4699
su2double GetTurbulenceIntensity_FreeStream(void) const
Get the value of the non-dimensionalized freestream turbulence intensity.
Definition CConfig.hpp:2143
TIME_MARCHING GetTime_Marching() const
Provides information about the time integration, and change the write in the output files information...
Definition CConfig.hpp:5648
Class for defining the numerical methods.
Definition CNumerics.hpp:48
su2double Eddy_Viscosity_i
Eddy viscosity at point i.
Definition CNumerics.hpp:77
unsigned short nVar
Number of dimensions and variables.
Definition CNumerics.hpp:52
CMatrixView< const su2double > ScalarVar_Grad_i
Gradient of scalar variables at point i.
Definition CNumerics.hpp:151
su2double roughness_i
Roughness of the wall nearest to point i.
Definition CNumerics.hpp:183
su2double StrainMag_i
Definition CNumerics.hpp:180
su2double MeanPerturbedRSM[3][3]
Perturbed Reynolds stress tensor
Definition CNumerics.hpp:186
su2double Volume
Volume of the control volume around point i.
Definition CNumerics.hpp:173
su2double Density_i
Density at point i.
Definition CNumerics.hpp:89
const su2double * Vorticity_i
Definition CNumerics.hpp:179
const su2double * ScalarVar_i
Vector of scalar variables at point i.
Definition CNumerics.hpp:131
su2double Laminar_Viscosity_i
Laminar viscosity at point i.
Definition CNumerics.hpp:67
su2double lesMode_i
LES sensor at point i for hybrid RANS-LES methods.
Definition CNumerics.hpp:193
su2double stochSource[3]
Source term for Langevin equations in Stochastic Backscatter Model.
Definition CNumerics.hpp:188
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
bool uq_permute
Flag for eigenvector permutation.
Definition CNumerics.hpp:201
CMatrixView< const su2double > PrimVar_Grad_i
Gradient of primitive variables at point i.
Definition CNumerics.hpp:147
const su2double * V_i
Vector of primitive variables at point i.
Definition CNumerics.hpp:122
SST_ParsedOptions sstParsedOptions
additional options for the SST turbulence model
Definition CNumerics.hpp:197
su2double intermittency_i
intermittency at point i.
Definition CNumerics.hpp:84
su2double uq_delta_b
Magnitude of perturbation.
Definition CNumerics.hpp:199
su2double dist_i
Distance of point i to the nearest wall.
Definition CNumerics.hpp:107
unsigned short nDim
Definition CNumerics.hpp:52
su2double intermittency_eff_i
effective intermittency at point i.
Definition CNumerics.hpp:83
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
const su2double delta[3][3]
Identity matrix.
Definition CNumerics.hpp:62
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 * Coord_i
Cartesians coordinates of point i.
Definition CNumerics.hpp:163
Class for integrating the source terms of the Spalart-Allmaras turbulence model equation....
Definition turb_sources.hpp:71
const FlowIndices idx
Object to manage the access to the flow primitives.
Definition turb_sources.hpp:78
su2double Residual[4]
Definition turb_sources.hpp:75
CSourceBase_TurbSA(unsigned short nDim, const CConfig *config)
Constructor of the class.
Definition turb_sources.hpp:193
void AddStochSource(const CConfig *config, CSAVariables &var, su2double &prod)
Include stochastic source term in the Spalart-Allmaras turbulence model equation (Stochastic Backscat...
Definition turb_sources.hpp:160
const SA_ParsedOptions options
Struct with SA options.
Definition turb_sources.hpp:79
su2double Jacobian_Buffer[16]
Static storage for the Jacobian (which needs to be pointer for return type).
Definition turb_sources.hpp:76
ResidualType ComputeResidual(const CConfig *config) override
Residual for source term integration.
Definition turb_sources.hpp:211
su2double * Jacobian_i[4]
Increase the size of residual and Jacobian for Langevin equations (Stochastic Backscatter Model).
Definition turb_sources.hpp:75
void ResidualStochEquations(su2double timeStep, const su2double ct, su2double lengthScale, su2double DES_const, const CSAVariables &var, TIME_MARCHING time_marching, su2double threshold)
Include source-term residuals for Langevin equations (Stochastic Backscatter Model)
Definition turb_sources.hpp:118
void ResidualAxisymmetricDiffusion(su2double sigma)
Add contribution from diffusion due to axisymmetric formulation to 2D residual.
Definition turb_sources.hpp:87
bool transition_LM
Definition turb_sources.hpp:82
const bool axisymmetric
Definition turb_sources.hpp:80
Class for integrating the source terms of the Menter SST turbulence model equations.
Definition turb_sources.hpp:740
void SetCrossDiff(su2double val_CDkw_i) override
Set the value of the cross diffusion for the SST model.
Definition turb_sources.hpp:861
ResidualType ComputeResidual(const CConfig *config) override
Residual for source term integration.
Definition turb_sources.hpp:870
CSourcePieceWise_TurbSST(unsigned short val_nDim, unsigned short, const su2double *constants, su2double val_kine_Inf, su2double val_omega_Inf, const CConfig *config)
Constructor of the class.
Definition turb_sources.hpp:817
void SetF1blending(su2double val_F1_i, su2double) override
Set the value of the first blending function.
Definition turb_sources.hpp:845
void SetF2blending(su2double val_F2_i) override
Set the value of the second blending function.
Definition turb_sources.hpp:853
Mixing Layer Compressibility Correction (SA-comp).
Definition turb_sources.hpp:606
CCompressibilityCorrection(unsigned short nDim, const CConfig *config)
Constructor of the class.
Definition turb_sources.hpp:626
ResidualType ComputeResidual(const CConfig *config) override
Residual for source term integration.
Definition turb_sources.hpp:634
passivedouble su2double
Definition code_config.hpp:181
T SquaredNorm(Int nDim, const T *a)
Definition geometry_toolbox.hpp:73
T Norm(Int nDim, const T *a)
Definition geometry_toolbox.hpp:79
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
FORCEINLINE ARRAY_T abs(const ARRAY_T &x)
Definition special_vectorization.hpp:117
CNumerics * SAFactory(unsigned short nDim, const CConfig *config)
Creates an SA source based on the version and modifications/correction in the config.
Definition turb_sources.hpp:718
void StartPreacc()
Starts a new preaccumulation section and sets the input variables.
Definition ad_structure.hpp:215
void EndPreacc()
Ends a preaccumulation section and computes the local Jacobi matrix of a code section using the varia...
Definition ad_structure.hpp:243
void SetPreaccOut(Ts &&... data)
Sets the scalar outputs of a preaccumulation section.
Definition ad_structure.hpp:222
void SetPreaccIn(Ts &&... data)
Sets the scalar inputs of a preaccumulation section.
Definition ad_structure.hpp:186
Definition computeGradientsGreenGauss.hpp:37
CNumerics * AddCompressibilityCorrection(bool use_comp, Ts... args)
Definition turb_sources.hpp:694
CNumerics * SAFactoryImpl(bool use_ft2, Ts... args)
Definition turb_sources.hpp:703
@ NEG
Negative SA.
@ NONE
No option / default.
@ EDW
Edwards version.
@ COMP_Wilcox
Menter k-w SST model with Compressibility correction of Wilcox.
@ V
Menter k-w SST model with vorticity production terms.
@ KL
Menter k-w SST model with Kato-Launder production terms.
@ V1994
1994 Menter k-w SST model.
@ UQ
Menter k-w SST model with uncertainty quantification modifications.
@ COMP_Sarkar
Menter k-w SST model with Compressibility correction of Sarkar.
TIME_MARCHING
Types of schemes for unsteady computations.
Definition option_structure.hpp:2725
@ DT_STEPPING_1ST
Use a dual time stepping strategy for unsteady computations (1st order).
@ DT_STEPPING_2ND
Use a dual time stepping strategy for unsteady computations (2nd order).
constexpr passivedouble EPS
Error scale.
Definition option_structure.hpp:100
constexpr passivedouble TWO3
Two divided by three.
Definition option_structure.hpp:105
TURB_TRANS_MODEL
Types of transition models.
Definition option_structure.hpp:1363
@ LM
Kind of transition model (Langtry-Menter (LM) for SST and Spalart-Allmaras).
Return type used in some "ComputeResidual" overloads to give a const-view of the internally stored fl...
Definition CNumerics.hpp:218
Structure with SA common auxiliary functions and constants.
Definition turb_sources.hpp:37
const su2double CRot
Definition turb_sources.hpp:51
su2double fv2
Definition turb_sources.hpp:55
su2double d_g
Definition turb_sources.hpp:55
su2double glim
Definition turb_sources.hpp:55
const su2double sigma
Definition turb_sources.hpp:46
su2double d_fw
Definition turb_sources.hpp:55
su2double Ji
Definition turb_sources.hpp:55
const su2double cb2_sigma
Definition turb_sources.hpp:48
const su2double c2
Definition turb_sources.hpp:52
const su2double cr1
Definition turb_sources.hpp:50
const su2double cv1_3
Definition turb_sources.hpp:39
su2double Omega
Definition turb_sources.hpp:58
su2double inv_k2_d2
Definition turb_sources.hpp:58
su2double g_6
Definition turb_sources.hpp:58
const su2double cb1
Definition turb_sources.hpp:41
su2double Prod
Definition turb_sources.hpp:55
su2double ft2
Definition turb_sources.hpp:55
su2double g
Definition turb_sources.hpp:55
su2double fv1
Definition turb_sources.hpp:55
su2double d_Shat
Definition turb_sources.hpp:55
su2double intermittency
Definition turb_sources.hpp:60
su2double d_fv1
Definition turb_sources.hpp:55
const su2double k2
Definition turb_sources.hpp:40
su2double norm2_Grad
Definition turb_sources.hpp:58
su2double inv_Shat
Definition turb_sources.hpp:58
su2double d_Ji
Definition turb_sources.hpp:55
const su2double ct4
Definition turb_sources.hpp:44
su2double Shat
Definition turb_sources.hpp:55
su2double fw
Definition turb_sources.hpp:55
const su2double cw1
Definition turb_sources.hpp:49
const su2double cw3_6
Definition turb_sources.hpp:45
su2double d_r
Definition turb_sources.hpp:55
su2double d_fv2
Definition turb_sources.hpp:55
const su2double c3
Definition turb_sources.hpp:52
su2double r
Definition turb_sources.hpp:55
su2double d_ft2
Definition turb_sources.hpp:55
su2double interDestrFactor
Definition turb_sources.hpp:60
const su2double cw2
Definition turb_sources.hpp:42
const su2double ct3
Definition turb_sources.hpp:43
const su2double cb2
Definition turb_sources.hpp:47
su2double dist_i_2
Definition turb_sources.hpp:58
Structure containing parsed SA options.
Definition option_structure.hpp:1290
bool bc
BC transition.
Definition option_structure.hpp:1296
SA_OPTIONS version
SA base model.
Definition option_structure.hpp:1291
bool rot
Use rotation correction.
Definition option_structure.hpp:1295
SST_OPTIONS production
Enum for production corrections/modifiers for SST model.
Definition option_structure.hpp:1138
SST_OPTIONS version
Enum SST base model.
Definition option_structure.hpp:1137
bool sust
Bool for SST model with sustaining terms.
Definition option_structure.hpp:1139
Definition turb_sources.hpp:676
Definition turb_sources.hpp:688
Baseline.
Definition turb_sources.hpp:445
static void get(const su2double &nue, const su2double &nu, CSAVariables &var)
Definition turb_sources.hpp:446
Edward.
Definition turb_sources.hpp:470
static void get(const su2double &nue, const su2double &nu, CSAVariables &var)
Definition turb_sources.hpp:471
Negative.
Definition turb_sources.hpp:483
static void get(const su2double &nue, const su2double &nu, CSAVariables &var)
Definition turb_sources.hpp:484
SA classes to compute the modified vorticity (\tilde{S}) and its derivative.
Definition turb_sources.hpp:442
Definition turb_sources.hpp:682
Baseline.
Definition turb_sources.hpp:385
static void get(const su2double *vorticity, unsigned short, const MatrixType &, CSAVariables &var)
Definition turb_sources.hpp:387
Edward. Here Omega is the Strain Rate.
Definition turb_sources.hpp:393
static void get(const su2double *, unsigned short nDim, const MatrixType &velocity_grad, CSAVariables &var)
Definition turb_sources.hpp:395
SA strain rate classes.
Definition turb_sources.hpp:382
Baseline (Original SA model).
Definition turb_sources.hpp:542
static void ComputeDestruction(const su2double &nue, const CSAVariables &var, su2double &destruction, su2double &jacobian)
Definition turb_sources.hpp:556
static void ComputeProduction(const su2double &nue, const CSAVariables &var, su2double &production, su2double &jacobian)
Definition turb_sources.hpp:549
static void get(const su2double &nue, const CSAVariables &var, su2double &production, su2double &destruction, su2double &jacobian)
Definition turb_sources.hpp:543
Negative.
Definition turb_sources.hpp:567
static void ComputeDestruction(const su2double &nue, const CSAVariables &var, su2double &destruction, su2double &jacobian)
Definition turb_sources.hpp:585
static void get(const su2double &nue, const CSAVariables &var, su2double &production, su2double &destruction, su2double &jacobian)
Definition turb_sources.hpp:568
static void ComputeProduction(const su2double &nue, const CSAVariables &var, su2double &production, su2double &jacobian)
Definition turb_sources.hpp:578
SA source terms classes: production and destruction term and their derivative.
Definition turb_sources.hpp:539
Non-zero ft2 term according to the literature.
Definition turb_sources.hpp:426
static void get(CSAVariables &var)
Definition turb_sources.hpp:427
No-ft2 term.
Definition turb_sources.hpp:418
static void get(CSAVariables &var)
Definition turb_sources.hpp:419
SA classes to set the ft2 term and its derivative.
Definition turb_sources.hpp:415
Baseline.
Definition turb_sources.hpp:509
static void get(const su2double &nue, CSAVariables &var)
Definition turb_sources.hpp:510
Edward.
Definition turb_sources.hpp:518
static void get(const su2double &nue, CSAVariables &var)
Definition turb_sources.hpp:519
SA auxiliary function r and its derivative.
Definition turb_sources.hpp:506