Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
2a66c54
- Added TKE production limiter constant to config
Jun 10, 2024
7582590
- Added Production and Destruction terms of SST to output
Jun 17, 2024
edce8ee
- Added user-defined lower limits of TKE and W
Jul 19, 2024
41c61ca
- Changed the Cross-Diffusion term in F1 computations
Jul 22, 2024
7b11baa
- Removed obsolete changes to TKE prod limiter
Jul 22, 2024
9482f51
- Modified the config output
Jul 22, 2024
38a02d6
- Added lower limit changes for SST in config output
Jul 22, 2024
c3e0d4b
- Added wall distance output for mesh adaptation
Jul 22, 2024
0f7558b
- Added strain magnitude as output
Jul 22, 2024
3be370d
- added production limiter flag to output
Jul 22, 2024
125fd6d
- Changed the Cross-Diffusion term in the residual of Omega
Jul 24, 2024
91cc3b8
- Added clipping of the cross-diffusion term in SST residual
Jul 24, 2024
7b78756
- changed cross diffusion term clipping in Omega residual
Jul 24, 2024
076d471
- Added CDkw and F1 as output
Jul 24, 2024
2e73f77
- Fixed Supersonic inlet BC inclusion of TKE
Jul 25, 2024
c662daf
- Corrected Riemann BC for TKE
Jul 25, 2024
41e1c16
- Fixed more BCs
Jul 25, 2024
e9dfc27
- Fixed bug with Cross diffusion in W residual
Jul 26, 2024
9a6fc06
- changed default for cross diffusion
Jul 26, 2024
251ae27
- Restored old computation of Cross-Diffusion terms in the source res…
Aug 12, 2024
9c7c950
Added BCs for SST-SUST
Aug 30, 2024
2042017
Merge branch 'develop' into feature_SSTMod
Aug 30, 2024
9d82d51
- Removed duplicate SST options
Aug 30, 2024
c10b006
- Removed not used config variables
Aug 30, 2024
be98cdd
- fixed merge error
Aug 30, 2024
fc30f5d
- Include full production and SSTm into the computation of the Stress…
Sep 2, 2024
a957ec7
Updated the freestream values for the print out
Sep 3, 2024
5546936
- Removed unused variables in turb_sources
Sep 3, 2024
1b8ee5b
- Added F2 blending function as output
Sep 3, 2024
6d3586f
- Restore previously removed variables
Sep 3, 2024
f27a7cb
- clean up of variables for Reynolds Stress Tensor computation
Sep 4, 2024
448a532
- Use full tke production term in Pw instead of only P_base
Sep 4, 2024
e9fa4e7
- Fixed Errors in AD compiling
Sep 6, 2024
c2462e8
- added tke to the numerics simd computations
Sep 9, 2024
51112fe
- Fixed UQ problem
Sep 9, 2024
576e8ee
- fix UQ implementation
Sep 9, 2024
acc21ec
- Removed unused variables
Sep 9, 2024
b5ca6ea
Merge branch 'develop' into feature_SSTMod
Sep 11, 2024
c6376cd
- Started including tke when computing the speed of sound
Sep 12, 2024
27175f8
Merge branch 'develop' into feature_SSTMod
Sep 16, 2024
d54cd39
Merge branch 'feature_SSTMod' of https://github.com/su2code/SU2 into …
Sep 16, 2024
c5aeb5a
- Start to include tke only when not m version of SST is used
Sep 16, 2024
6441eb8
Merge branch 'tmp' into HEAD
Sep 16, 2024
317f563
- Fixed tke integration in thermodynamic variables
Sep 20, 2024
d6af702
- Code improvements
Oct 2, 2024
8f97a16
- minor changes
Oct 11, 2024
fd43746
Merge branch 'develop' into feature_SSTMod
Oct 11, 2024
a8a603e
- update externals
Oct 11, 2024
340faa4
- Fixed inlet BCs when new BCs are used
Oct 11, 2024
f4cb207
Merge branch 'develop' into feature_SSTMod
Oct 22, 2024
16cac0a
Merge branch 'develop' into feature_SSTMod
bigfooted Oct 30, 2024
c4f10fe
Update Common/include/CConfig.hpp
rois1995 Oct 31, 2024
6eb02da
Merge branch 'develop' into feature_SSTMod
bigfooted Feb 3, 2025
f0e280a
changes to MLPCpp
Mar 4, 2025
3ca65bf
Merge branch 'develop' into feature_SSTMod
Mar 4, 2025
32a6eea
- Fix output GetStrainMag bug
Mar 4, 2025
89a559a
- Try fixing output bug again
Mar 4, 2025
d4ee84b
same fix
Mar 4, 2025
5a40f57
- Added Shuzen and Hoffmann compressibility correction
Apr 10, 2025
c370f41
Merge branch 'feature_SSTMod' of https://github.com/su2code/SU2 into …
Apr 10, 2025
e9eb7ad
Merge remote-tracking branch 'origin/develop' into feature_SSTMod
Apr 10, 2025
e8d4bf3
- changed output for debug variables
Apr 10, 2025
4d2aba5
- Added term to jacobian of w
Apr 10, 2025
e4ceb0e
- Add neighbor wall distance as debug output
Apr 11, 2025
0d75465
- Remove Jacobian changes
Apr 11, 2025
f159412
- Add grad vel as output
Apr 11, 2025
939faa1
- add upper bound into BCs
Apr 11, 2025
99ac333
Merge remote-tracking branch 'origin/symmetry_jacobian' into feature_…
Apr 11, 2025
ee1d5fa
Merge branch 'develop' into feature_SSTMod
Sep 23, 2026
0b1cf18
Fix the build after merging develop
Sep 23, 2026
5630863
Reset the SST production and destruction outputs at every point
Sep 23, 2026
5c65018
Divide the Suzen-Hoffmann omega correction by the kinematic eddy visc…
Sep 23, 2026
9aa1e80
Leave k out of the energy of the modified SST versions everywhere
Sep 23, 2026
db13b53
Register the NEIGHBORDIST output for all the flow solvers
Sep 23, 2026
ae4c9fb
Add options for the ambient values of the SST sustaining terms
Sep 24, 2026
d1fe4b2
Avoid 0/0 in the omega production of SST-1994 where mu_t = 0
Sep 24, 2026
fd1bbbd
Keep the k Jacobian of the non-modified SST versions diagonally dominant
Sep 24, 2026
16b44bc
Remove the Suzen-Hoffmann compressibility correction from this branch
Sep 24, 2026
b6f221e
Keep k in the energy of all SST versions and impose it consistently a…
Sep 25, 2026
9ebd5e6
Use the exact production for the standard SST versions and remove FUL…
Sep 25, 2026
8c18e3e
Document the SST versions, NEWBC and the TMR far-field viscosity ratio
Sep 25, 2026
8e37635
Make the clipping of the omega wall value an SST option, off by default
Sep 25, 2026
3fccc07
Move the changes that are not alignment with the NASA TMR out of this…
Sep 25, 2026
184fe00
Remove comment-only changes and unused variables
Sep 25, 2026
444eeeb
Keep the rounding of the SIMD stress tensor when k is not included
Sep 25, 2026
d1c4d35
Keep develop's SIMD stress tensor and add 2/3 rho k separately
Sep 25, 2026
d5f040e
Use the k of the boundary node in the energy of all flow boundary sta…
Sep 25, 2026
89c7aaa
Update the reference values of the SST regression tests
Sep 25, 2026
81739de
Merge branch 'develop' into feature_SSTMod
Sep 25, 2026
95de110
Rename the SST option NEWBC to TMRBC
Sep 25, 2026
3b6ab82
Keep the develop stress tensor call for models without the k term, cl…
Sep 25, 2026
38c2696
Update the reference values of the regression tests from CI
Sep 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,9 @@ class CConfig {
nHistoryOutput, nVolumeOutput; /*!< \brief Number of variables printed to the history file. */
bool Multizone_Residual; /*!< \brief Determines if memory should be allocated for the multizone residual. */
SST_ParsedOptions sstParsedOptions; /*!< \brief Additional parameters for the SST turbulence model. */
su2double LDomain; /*!< \brief Approximate length of the domain, for the far-field omega of TMRBC. */
su2double sstSustTkeAmb; /*!< \brief Ambient k of the SST sustaining terms (dimensional), <= 0 for the default. */
su2double sstSustOmegaAmb; /*!< \brief Ambient omega of the SST sustaining terms (dimensional), <= 0 for the default. */
SA_ParsedOptions saParsedOptions; /*!< \brief Additional parameters for the SA turbulence model. */
LM_ParsedOptions lmParsedOptions; /*!< \brief Additional parameters for the LM transition model. */
su2double uq_delta_b; /*!< \brief Parameter used to perturb eigenvalues of Reynolds Stress Matrix */
Expand Down Expand Up @@ -10360,6 +10363,27 @@ class CConfig {
*/
SST_ParsedOptions GetSSTParsedOptions() const { return sstParsedOptions; }

su2double GetLDomain() const { return LDomain; }

/*!
* \brief Ambient (free-stream) k of the SST sustaining terms, dimensional.
* \note Default of Spalart and Rumsey (AIAA J 45(10), 2007), as in the NASA TMR SST-sust: 1e-6 U^2.
* \param[in] velMag - Free-stream velocity magnitude (dimensional).
*/
su2double GetSSTSust_TkeAmb(su2double velMag) const {
return sstSustTkeAmb > 0.0 ? sstSustTkeAmb : 1e-6 * velMag * velMag;
}

/*!
* \brief Ambient (free-stream) omega of the SST sustaining terms, dimensional.
* \note Default of Spalart and Rumsey (AIAA J 45(10), 2007), as in the NASA TMR SST-sust: 5 U / L, with L the
* defining length of the problem, taken as REYNOLDS_LENGTH.
* \param[in] velMag - Free-stream velocity magnitude (dimensional).
*/
su2double GetSSTSust_OmegaAmb(su2double velMag) const {
return sstSustOmegaAmb > 0.0 ? sstSustOmegaAmb : 5.0 * velMag / Length_Reynolds;
}

/*!
* \brief Get parsed SA option data structure.
* \return SA option data structure.
Expand Down
40 changes: 25 additions & 15 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1101,33 +1101,36 @@ inline TURB_FAMILY TurbModelFamily(TURB_MODEL model) {
* \brief SST Options
*/
enum class SST_OPTIONS {
NONE, /*!< \brief No SST Turb model. */
V1994, /*!< \brief 1994 Menter k-w SST model. */
V2003, /*!< \brief 2003 Menter k-w SST model. */
V1994m, /*!< \brief 1994m Menter k-w SST model. */
V2003m, /*!< \brief 2003m Menter k-w SST model. */
SUST, /*!< \brief Menter k-w SST model with sustaining terms. */
V, /*!< \brief Menter k-w SST model with vorticity production terms. */
KL, /*!< \brief Menter k-w SST model with Kato-Launder production terms. */
UQ, /*!< \brief Menter k-w SST model with uncertainty quantification modifications. */
COMP_Wilcox, /*!< \brief Menter k-w SST model with Compressibility correction of Wilcox. */
COMP_Sarkar, /*!< \brief Menter k-w SST model with Compressibility correction of Sarkar. */
DLL, /*!< \brief Menter k-w SST model with dimensionless lower limit clipping of turbulence variables. */
NONE, /*!< \brief No SST Turb model. */
V1994, /*!< \brief 1994 Menter k-w SST model. */
V2003, /*!< \brief 2003 Menter k-w SST model. */
V1994m, /*!< \brief 1994m Menter k-w SST model. */
V2003m, /*!< \brief 2003m Menter k-w SST model. */
SUST, /*!< \brief Menter k-w SST model with sustaining terms. */
V, /*!< \brief Menter k-w SST model with vorticity production terms. */
KL, /*!< \brief Menter k-w SST model with Kato-Launder production terms. */
UQ, /*!< \brief Menter k-w SST model with uncertainty quantification modifications. */
COMP_Wilcox, /*!< \brief Menter k-w SST model with Compressibility correction of Wilcox. */
COMP_Sarkar, /*!< \brief Menter k-w SST model with Compressibility correction of Sarkar. */
DLL, /*!< \brief Menter k-w SST model with dimensionless lower limit clipping of turbulence variables. */
WALL_OMEGA_LIMIT, /*!< \brief Clip the omega wall value to the upper limit of omega. */
TMRBC, /*!< \brief Far-field omega = 10 U / L_DOMAIN, original reference of the NASA TMR SST page. */
};
static const MapType<std::string, SST_OPTIONS> SST_Options_Map = {
MakePair("NONE", SST_OPTIONS::NONE)
MakePair("V1994m", SST_OPTIONS::V1994m)
MakePair("V2003m", SST_OPTIONS::V2003m)
/// TODO: For now we do not support "unmodified" versions of SST.
//MakePair("V1994", SST_OPTIONS::V1994)
//MakePair("V2003", SST_OPTIONS::V2003)
MakePair("V1994", SST_OPTIONS::V1994)
MakePair("V2003", SST_OPTIONS::V2003)
MakePair("SUSTAINING", SST_OPTIONS::SUST)
MakePair("VORTICITY", SST_OPTIONS::V)
MakePair("KATO-LAUNDER", SST_OPTIONS::KL)
MakePair("UQ", SST_OPTIONS::UQ)
MakePair("COMPRESSIBILITY-WILCOX", SST_OPTIONS::COMP_Wilcox)
MakePair("COMPRESSIBILITY-SARKAR", SST_OPTIONS::COMP_Sarkar)
MakePair("DIMENSIONLESS_LIMIT", SST_OPTIONS::DLL)
MakePair("TMRBC", SST_OPTIONS::TMRBC)
MakePair("WALL_OMEGA_LIMIT", SST_OPTIONS::WALL_OMEGA_LIMIT)
};

/*!
Expand All @@ -1142,6 +1145,8 @@ struct SST_ParsedOptions {
bool compWilcox = false; /*!< \brief Bool for compressibility correction of Wilcox. */
bool compSarkar = false; /*!< \brief Bool for compressibility correction of Sarkar. */
bool dll = false; /*!< \brief Bool dimensionless lower limit. */
bool wallOmegaLimit = false; /*!< \brief Bool for clipping the omega wall value (WALL_OMEGA_LIMIT). */
bool tmrBC = false; /*!< \brief Bool for the far-field values of the NASA TMR (TMRBC). */
};

/*!
Expand All @@ -1159,6 +1164,9 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne
return std::find(SST_Options, sst_options_end, option) != sst_options_end;
};

const bool found_tmrBC = IsPresent(SST_OPTIONS::TMRBC);
const bool found_wallOmegaLimit = IsPresent(SST_OPTIONS::WALL_OMEGA_LIMIT);

const bool found_1994 = IsPresent(SST_OPTIONS::V1994);
const bool found_2003 = IsPresent(SST_OPTIONS::V2003);
const bool found_1994m = IsPresent(SST_OPTIONS::V1994m);
Expand Down Expand Up @@ -1216,6 +1224,8 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne
SSTParsedOptions.compSarkar = sst_compSarkar;
SSTParsedOptions.dll = sst_dll;

SSTParsedOptions.tmrBC = found_tmrBC;
SSTParsedOptions.wallOmegaLimit = found_wallOmegaLimit;
return SSTParsedOptions;
}

Expand Down
7 changes: 7 additions & 0 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,13 @@ void CConfig::SetConfig_Options() {
/*!\brief SST_OPTIONS \n DESCRIPTION: Specify SA turbulence model options/corrections. \n Options: see \link SA_Options_Map \endlink \n DEFAULT: NONE \ingroup Config*/
addEnumListOption("SA_OPTIONS", nSA_Options, SA_Options, SA_Options_Map);

/*!\brief L_DOMAIN \n DESCRIPTION: Approximate length of the computational domain, for the far-field omega of SST_OPTIONS= TMRBC (NASA TMR). \ingroup Config*/
addDoubleOption("L_DOMAIN", LDomain, 1.0);
/*!\brief SST_SUST_TKE_AMB \n DESCRIPTION: Ambient k of the SST sustaining terms (m^2/s^2), <= 0 for 1e-6 U^2. \ingroup Config*/
addDoubleOption("SST_SUST_TKE_AMB", sstSustTkeAmb, 0.0);
/*!\brief SST_SUST_OMEGA_AMB \n DESCRIPTION: Ambient omega of the SST sustaining terms (1/s), <= 0 for 5 U / REYNOLDS_LENGTH. \ingroup Config*/
addDoubleOption("SST_SUST_OMEGA_AMB", sstSustOmegaAmb, 0.0);

/*!\brief KIND_INCOMP_SYSTEM \n DESCRIPTION: Incomp type \n OPTIONS: see \link Incomp_Map \endlink DEFAULT: NONE \ingroup Config*/
addEnumOption("KIND_INCOMP_SYSTEM", Kind_Incomp_System, Incomp_Map, INCOMP_SYSTEM::DENSITY_BASED);
/*!\brief KIND_PB_ITER \n DESCRIPTION: Kind_PBIter \n OPTIONS: see \link PBIter_Map \endlink \ingroup Config*/
Expand Down
28 changes: 24 additions & 4 deletions SU2_CFD/include/numerics/turbulent/turb_sources.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -961,16 +961,33 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
/*--- Production limiter. ---*/
const su2double prod_limit = prod_lim_const * beta_star * Density_i * ScalarVar_i[1] * ScalarVar_i[0];

/*--- The modified (m) versions use P = mu_t S^2 (NASA TMR). The standard versions use the exact production,
P = tau_ij du_i/dx_j = mu_t (S^2 - 2/3 div(u)^2) - 2/3 rho k div(u); with the vorticity (V) and Kato-Launder (KL)
forms of mu_t S^2 only the -2/3 rho k div(u) term is added. ---*/
const bool strainProduction = sstParsedOptions.production != SST_OPTIONS::V &&
sstParsedOptions.production != SST_OPTIONS::KL;
su2double P = Eddy_Viscosity_i * pow(P_Base, 2);
if (!sstParsedOptions.modified) {
if (strainProduction) P -= Eddy_Viscosity_i * diverg * diverg * 2.0/3.0;
P -= Density_i * ScalarVar_i[0] * diverg * 2.0/3.0;
}

su2double pk = max(0.0, min(P, prod_limit));

const auto& eddy_visc_var = sstParsedOptions.version == SST_OPTIONS::V1994 ? VorticityMag : StrainMag_i;
const su2double eddy_visc_var = sstParsedOptions.version == SST_OPTIONS::V1994 ? VorticityMag : StrainMag_i;
const su2double zeta = max(ScalarVar_i[1], eddy_visc_var * F2_i / a1);

/*--- Production limiter only for V2003, recompute for V1994. ---*/
su2double pw;
if (sstParsedOptions.version == SST_OPTIONS::V1994) {
pw = alfa_blended * Density_i * pow(P_Base, 2);
/*--- gamma/nu_t * P, with P/mu_t expanded so that it is defined where mu_t = 0. The last term,
* rho k / mu_t, is bounded since mu_t is proportional to k (it vanishes with k). ---*/
su2double P_over_muT = pow(P_Base, 2);
if (!sstParsedOptions.modified) {
if (strainProduction) P_over_muT -= diverg * diverg * 2.0/3.0;
P_over_muT -= Density_i * ScalarVar_i[0] * diverg * 2.0/3.0 / max(Eddy_Viscosity_i, EPS);
}
pw = alfa_blended * Density_i * P_over_muT;
} else {
pw = (alfa_blended * Density_i / Eddy_Viscosity_i) * pk;
}
Expand All @@ -996,7 +1013,7 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
/*--- Dissipation ---*/

su2double dk = beta_star * Density_i * ScalarVar_i[1] * ScalarVar_i[0] * (1.0 + zetaFMt);
su2double dw = beta_blended * Density_i * ScalarVar_i[1] * ScalarVar_i[1] * (1.0 - 0.09/beta_blended * zetaFMt);
su2double dw = beta_blended * Density_i * ScalarVar_i[1] * ScalarVar_i[1] * (1.0 - beta_star/beta_blended * zetaFMt);

/*--- LM model coupling with production and dissipation term for k transport equation---*/
if (config->GetKind_Trans_Model() == TURB_TRANS_MODEL::LM) {
Expand All @@ -1023,9 +1040,12 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
/*--- Implicit part ---*/

Jacobian_i[0][0] = -beta_star * ScalarVar_i[1] * Volume * (1.0 + zetaFMt);
/*--- Derivative of -2/3 rho k div(u), only where it adds to the diagonal (compression is left out
* of the Jacobian but kept in the residual, so that the linear system does not lose diagonal dominance). ---*/
if (!sstParsedOptions.modified) Jacobian_i[0][0] -= max(diverg, 0.0) * Volume*2.0/3.0;
Jacobian_i[0][1] = -beta_star * ScalarVar_i[0] * Volume * (1.0 + zetaFMt);
Jacobian_i[1][0] = 0.0;
Jacobian_i[1][1] = -2.0 * beta_blended * ScalarVar_i[1] * Volume * (1.0 - 0.09/beta_blended * zetaFMt);
Jacobian_i[1][1] = -2.0 * beta_blended * ScalarVar_i[1] * Volume * (1.0 - beta_star/beta_blended * zetaFMt);
}

AD::SetPreaccOut(Residual, nVar);
Expand Down
11 changes: 11 additions & 0 deletions SU2_CFD/include/numerics_simd/flow/diffusion/viscous_fluxes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class CCompressibleViscousFluxBase : public CNumericsSIMD {
const bool useSA_QCR;
const bool wallFun;
const bool uq;
const bool tkeInStress; /*!< \brief 2/3 rho k in the stress tensor (standard, non-m, SST versions). */
const bool uq_permute;
const size_t uq_eigval_comp;
const su2double uq_delta_b;
Expand All @@ -100,6 +101,8 @@ class CCompressibleViscousFluxBase : public CNumericsSIMD {
useSA_QCR(config.GetSAParsedOptions().qcr2000),
wallFun(config.GetWall_Functions()),
uq(config.GetSSTParsedOptions().uq),
tkeInStress(config.GetKind_Turb_Model() == TURB_MODEL::SST && !config.GetSSTParsedOptions().modified &&
!config.GetSSTParsedOptions().uq),
uq_permute(config.GetUQ_Permute()),
uq_eigval_comp(config.GetEig_Val_Comp()),
uq_delta_b(config.GetUQ_Delta_B()),
Expand Down Expand Up @@ -152,6 +155,14 @@ class CCompressibleViscousFluxBase : public CNumericsSIMD {
const Double eddyVisc = uq? Double(0.0) : avgV.eddyVisc();
auto tau = stressTensor(avgV.laminarVisc() + eddyVisc, avgGrad);
if(useSA_QCR) addQCR(avgGrad, tau, eddyVisc / (avgV.laminarVisc() + eddyVisc));
if(tkeInStress) {
/*--- 2/3 rho k term of the Boussinesq approximation, ignored by the modified (m) SST versions (with UQ it is
* part of the perturbed Reynolds stress). ---*/
const Double turb_ke = 0.5*(gatherVariables(iPoint, turbVars->GetSolution()) +
gatherVariables(jPoint, turbVars->GetSolution()));
const Double kTerm = 2.0/3.0 * avgV.density() * turb_ke;
for (size_t iDim = 0; iDim < nDim; ++iDim) tau(iDim,iDim) -= kTerm;
}
if(uq) {
Double turb_ke = 0.5*(gatherVariables(iPoint, turbVars->GetSolution()) +
gatherVariables(jPoint, turbVars->GetSolution()));
Expand Down
11 changes: 9 additions & 2 deletions SU2_CFD/src/numerics/flow/flow_diffusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,22 @@ void CAvgGrad_Base::SetStressTensor(const su2double *val_primvar,

if (sstParsedOptions.uq) {
// laminar part
// the 2/3 rho k term is already in the perturbed Reynolds stress
ComputeStressTensor(nDim, tau, val_gradprimvar+1, val_laminar_viscosity);
// add turbulent part which was perturbed
for (unsigned short iDim = 0 ; iDim < nDim; iDim++)
for (unsigned short jDim = 0 ; jDim < nDim; jDim++)
tau[iDim][jDim] += (-Density) * MeanPerturbedRSM[iDim][jDim];
} else {
const su2double total_viscosity = val_laminar_viscosity + val_eddy_viscosity;
// turb_ke is not considered in the stress tensor, see #797
ComputeStressTensor(nDim, tau, val_gradprimvar+1, total_viscosity, Density, su2double(0.0));
/*--- 2/3 rho k only for the standard (non-m) SST versions, see #797. The other models call the function
* without it, so that their results do not change with how the compiler rounds a zero k term. ---*/
const bool tkeInStress = config->GetKind_Turb_Model() == TURB_MODEL::SST && !sstParsedOptions.modified;
if (tkeInStress) {
ComputeStressTensor(nDim, tau, val_gradprimvar+1, total_viscosity, Density, val_turb_ke);
} else {
ComputeStressTensor(nDim, tau, val_gradprimvar+1, total_viscosity, Density, su2double(0.0));
}
}

/* --- If the Stochastic Backscatter Model is active, add random contribution to stress tensor ---*/
Expand Down
5 changes: 5 additions & 0 deletions SU2_CFD/src/solvers/CAdjNSSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,10 @@ void CAdjNSSolver::Viscous_Sensitivity(CGeometry *geometry, CSolver **solver_con
dp_drv, dp_drw, dp_drE, dH_dr, dH_dru, dH_drv, dH_drw, dH_drE, H, D[3][3], Dd[3], Mach_Inf, eps, scale = 1.0,
RefVel2, RefDensity, Mach2Vel, *Velocity_Inf, factor;

const bool SSTm = config->GetSSTParsedOptions().modified;
const bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST) && !SSTm;
const auto* Node_Turb = (tkeNeeded) ? solver_container[TURB_SOL]->GetNodes() : nullptr;

auto *USens = new su2double[nVar];
auto *UnitNormal = new su2double[nDim];
auto *normal_grad_vel = new su2double[nDim];
Expand Down Expand Up @@ -766,6 +770,7 @@ void CAdjNSSolver::Viscous_Sensitivity(CGeometry *geometry, CSolver **solver_con
/*--- Turbulent kinetic energy ---*/
// turb_ke is not considered in the stress tensor, see #797
val_turb_ke = 0.0;
if (tkeNeeded) val_turb_ke = Node_Turb->GetSolution(iPoint, 0);
CNumerics::ComputeStressTensor(nDim, tau, PrimVar_Grad+1, Laminar_Viscosity, Density, val_turb_ke);

/*--- Form normal_grad_gridvel = \partial_n (u_omega) ---*/
Expand Down
Loading
Loading