Skip to content

[WIP] Inconsistencies and improvements to SST model #2329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 75 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
2a66c54
- Added TKE production limiter constant to config
rois1995 Jun 10, 2024
7582590
- Added Production and Destruction terms of SST to output
rois1995 Jun 17, 2024
edce8ee
- Added user-defined lower limits of TKE and W
rois1995 Jul 19, 2024
41c61ca
- Changed the Cross-Diffusion term in F1 computations
rois1995 Jul 22, 2024
7b11baa
- Removed obsolete changes to TKE prod limiter
rois1995 Jul 22, 2024
9482f51
- Modified the config output
rois1995 Jul 22, 2024
38a02d6
- Added lower limit changes for SST in config output
rois1995 Jul 22, 2024
c3e0d4b
- Added wall distance output for mesh adaptation
rois1995 Jul 22, 2024
0f7558b
- Added strain magnitude as output
rois1995 Jul 22, 2024
3be370d
- added production limiter flag to output
rois1995 Jul 22, 2024
125fd6d
- Changed the Cross-Diffusion term in the residual of Omega
rois1995 Jul 24, 2024
91cc3b8
- Added clipping of the cross-diffusion term in SST residual
rois1995 Jul 24, 2024
7b78756
- changed cross diffusion term clipping in Omega residual
rois1995 Jul 24, 2024
076d471
- Added CDkw and F1 as output
rois1995 Jul 24, 2024
2e73f77
- Fixed Supersonic inlet BC inclusion of TKE
rois1995 Jul 25, 2024
c662daf
- Corrected Riemann BC for TKE
rois1995 Jul 25, 2024
41e1c16
- Fixed more BCs
rois1995 Jul 25, 2024
e9dfc27
- Fixed bug with Cross diffusion in W residual
rois1995 Jul 26, 2024
9a6fc06
- changed default for cross diffusion
rois1995 Jul 26, 2024
251ae27
- Restored old computation of Cross-Diffusion terms in the source res…
rois1995 Aug 12, 2024
9c7c950
Added BCs for SST-SUST
rois1995 Aug 30, 2024
2042017
Merge branch 'develop' into feature_SSTMod
rois1995 Aug 30, 2024
9d82d51
- Removed duplicate SST options
rois1995 Aug 30, 2024
c10b006
- Removed not used config variables
rois1995 Aug 30, 2024
be98cdd
- fixed merge error
rois1995 Aug 30, 2024
fc30f5d
- Include full production and SSTm into the computation of the Stress…
rois1995 Sep 2, 2024
a957ec7
Updated the freestream values for the print out
rois1995 Sep 3, 2024
5546936
- Removed unused variables in turb_sources
rois1995 Sep 3, 2024
1b8ee5b
- Added F2 blending function as output
rois1995 Sep 3, 2024
6d3586f
- Restore previously removed variables
rois1995 Sep 3, 2024
f27a7cb
- clean up of variables for Reynolds Stress Tensor computation
rois1995 Sep 4, 2024
448a532
- Use full tke production term in Pw instead of only P_base
rois1995 Sep 4, 2024
e9fa4e7
- Fixed Errors in AD compiling
rois1995 Sep 6, 2024
c2462e8
- added tke to the numerics simd computations
rois1995 Sep 9, 2024
51112fe
- Fixed UQ problem
rois1995 Sep 9, 2024
576e8ee
- fix UQ implementation
rois1995 Sep 9, 2024
acc21ec
- Removed unused variables
rois1995 Sep 9, 2024
b5ca6ea
Merge branch 'develop' into feature_SSTMod
rois1995 Sep 11, 2024
c6376cd
- Started including tke when computing the speed of sound
rois1995 Sep 12, 2024
27175f8
Merge branch 'develop' into feature_SSTMod
rois1995 Sep 16, 2024
d54cd39
Merge branch 'feature_SSTMod' of https://github.com/su2code/SU2 into …
rois1995 Sep 16, 2024
c5aeb5a
- Start to include tke only when not m version of SST is used
rois1995 Sep 16, 2024
6441eb8
Merge branch 'tmp' into HEAD
rois1995 Sep 16, 2024
317f563
- Fixed tke integration in thermodynamic variables
rois1995 Sep 20, 2024
d6af702
- Code improvements
rois1995 Oct 2, 2024
8f97a16
- minor changes
rois1995 Oct 11, 2024
fd43746
Merge branch 'develop' into feature_SSTMod
rois1995 Oct 11, 2024
a8a603e
- update externals
rois1995 Oct 11, 2024
340faa4
- Fixed inlet BCs when new BCs are used
rois1995 Oct 11, 2024
f4cb207
Merge branch 'develop' into feature_SSTMod
rois1995 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
rois1995 Mar 4, 2025
3ca65bf
Merge branch 'develop' into feature_SSTMod
rois1995 Mar 4, 2025
32a6eea
- Fix output GetStrainMag bug
rois1995 Mar 4, 2025
89a559a
- Try fixing output bug again
rois1995 Mar 4, 2025
d4ee84b
same fix
rois1995 Mar 4, 2025
4162c72
go back to Jacobian modification but fix order of matrix multiplication
pcarruscag Apr 4, 2025
8a1b3da
something else we dont need?
pcarruscag Apr 4, 2025
0e1d5f9
update serial
bigfooted Apr 4, 2025
b2ae9e7
pressure forces
pcarruscag Apr 5, 2025
ac30740
Merge remote-tracking branch 'origin/symmetry_jacobian' into symmetry…
pcarruscag Apr 5, 2025
5fc0979
some updates and codeql
pcarruscag Apr 6, 2025
f81e979
more updates
pcarruscag Apr 6, 2025
5a40f57
- Added Shuzen and Hoffmann compressibility correction
rois1995 Apr 10, 2025
c370f41
Merge branch 'feature_SSTMod' of https://github.com/su2code/SU2 into …
rois1995 Apr 10, 2025
e9eb7ad
Merge remote-tracking branch 'origin/develop' into feature_SSTMod
rois1995 Apr 10, 2025
e8d4bf3
- changed output for debug variables
rois1995 Apr 10, 2025
4d2aba5
- Added term to jacobian of w
rois1995 Apr 10, 2025
e4ceb0e
- Add neighbor wall distance as debug output
rois1995 Apr 11, 2025
0d75465
- Remove Jacobian changes
rois1995 Apr 11, 2025
f159412
- Add grad vel as output
rois1995 Apr 11, 2025
939faa1
- add upper bound into BCs
rois1995 Apr 11, 2025
99ac333
Merge remote-tracking branch 'origin/symmetry_jacobian' into feature_…
rois1995 Apr 11, 2025
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
6 changes: 6 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,7 @@ class CConfig {
array<su2double, N_POLY_COEFFS> MuPolyCoefficientsND{{0.0}}; /*!< \brief Definition of the non-dimensional temperature polynomial coefficients for viscosity. */
array<su2double, N_POLY_COEFFS> KtPolyCoefficientsND{{0.0}}; /*!< \brief Definition of the non-dimensional temperature polynomial coefficients for thermal conductivity. */
su2double TurbIntensityAndViscRatioFreeStream[2]; /*!< \brief Freestream turbulent intensity and viscosity ratio for turbulence and transition models. */

su2double Energy_FreeStream, /*!< \brief Free-stream total energy of the fluid. */
ModVel_FreeStream, /*!< \brief Magnitude of the free-stream velocity of the fluid. */
ModVel_FreeStreamND, /*!< \brief Non-dimensional magnitude of the free-stream velocity of the fluid. */
Expand Down Expand Up @@ -1178,6 +1179,8 @@ 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 prodLimConst;
su2double LDomain;
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 @@ -9781,6 +9784,9 @@ class CConfig {
*/
SST_ParsedOptions GetSSTParsedOptions() const { return sstParsedOptions; }

su2double GetProdLimConst() const { return prodLimConst; }
su2double GetLDomain() const { return LDomain; }

/*!
* \brief Get parsed SA option data structure.
* \return SA option data structure.
Expand Down
54 changes: 38 additions & 16 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,33 +983,40 @@ 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. */
COMP_ShuzHoff, /*!< \brief Menter k-w SST model with Compressibility correction of Shuzen and Hoffmann. */
DLL, /*!< \brief Menter k-w SST model with dimensionless lower limit clipping of turbulence variables. */
FULLPROD, /*!< \brief Menter k-w SST model with full production term. */
PRODLIM, /*!< \brief Menter k-w SST model with user-defined production limiter constant. */
NEWBC, /*!< \brief Menter k-w SST model with new boundary conditions. */
};
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("COMPRESSIBILITY-SH", SST_OPTIONS::COMP_ShuzHoff)
MakePair("DIMENSIONLESS_LIMIT", SST_OPTIONS::DLL)
MakePair("FULLPROD", SST_OPTIONS::FULLPROD)
MakePair("PRODLIM", SST_OPTIONS::PRODLIM)
MakePair("NEWBC", SST_OPTIONS::NEWBC)
};

/*!
Expand All @@ -1023,7 +1030,11 @@ struct SST_ParsedOptions {
bool modified = false; /*!< \brief Bool for modified (m) SST model. */
bool compWilcox = false; /*!< \brief Bool for compressibility correction of Wilcox. */
bool compSarkar = false; /*!< \brief Bool for compressibility correction of Sarkar. */
bool compSH = false; /*!< \brief Bool for compressibility correction of Shuzen and Hoffmann. */
bool dll = false; /*!< \brief Bool dimensionless lower limit. */
bool fullProd = false; /*!< \brief Bool for full production term. */
bool prodLim = false; /*!< \brief Bool for user-defined production limiter constant. */
bool newBC = false; /*!< \brief Bool for new boundary conditions. */
};

/*!
Expand All @@ -1041,6 +1052,10 @@ 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_fullProd = IsPresent(SST_OPTIONS::FULLPROD);
const bool found_prodLim = IsPresent(SST_OPTIONS::PRODLIM);
const bool found_newBC = IsPresent(SST_OPTIONS::NEWBC);

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 All @@ -1061,6 +1076,7 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne
const bool sst_uq = IsPresent(SST_OPTIONS::UQ);
const bool sst_compWilcox = IsPresent(SST_OPTIONS::COMP_Wilcox);
const bool sst_compSarkar = IsPresent(SST_OPTIONS::COMP_Sarkar);
const bool sst_compSH = IsPresent(SST_OPTIONS::COMP_ShuzHoff);
const bool sst_dll = IsPresent(SST_OPTIONS::DLL);

if (sst_1994 && sst_2003) {
Expand All @@ -1083,21 +1099,27 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne
}

// Parse compressibility options
if (sst_compWilcox && sst_compSarkar) {
if (sst_compWilcox + sst_compSarkar + sst_compSH > 1) {
SU2_MPI::Error("Please select only one compressibility correction (COMPRESSIBILITY-WILCOX or COMPRESSIBILITY-SARKAR).", CURRENT_FUNCTION);
} else if (sst_compWilcox) {
SSTParsedOptions.production = SST_OPTIONS::COMP_Wilcox;
} else if (sst_compSarkar) {
SSTParsedOptions.production = SST_OPTIONS::COMP_Sarkar;
} else if (sst_compSH) {
SSTParsedOptions.production = SST_OPTIONS::COMP_ShuzHoff;
}

SSTParsedOptions.sust = sst_sust;
SSTParsedOptions.modified = sst_m;
SSTParsedOptions.uq = sst_uq;
SSTParsedOptions.compWilcox = sst_compWilcox;
SSTParsedOptions.compSarkar = sst_compSarkar;
SSTParsedOptions.compSH = sst_compSH;
SSTParsedOptions.dll = sst_dll;

SSTParsedOptions.fullProd = found_fullProd;
SSTParsedOptions.prodLim = found_prodLim;
SSTParsedOptions.newBC = found_newBC;
return SSTParsedOptions;
}

Expand Down
6 changes: 6 additions & 0 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,9 @@ 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);

addDoubleOption("PROD_LIM_CONST", prodLimConst, 20.0);
addDoubleOption("L_DOMAIN", LDomain, 1.0);

/*!\brief KIND_TRANS_MODEL \n DESCRIPTION: Specify transition model OPTIONS: see \link Trans_Model_Map \endlink \n DEFAULT: NONE \ingroup Config*/
addEnumOption("KIND_TRANS_MODEL", Kind_Trans_Model, Trans_Model_Map, TURB_TRANS_MODEL::NONE);
/*!\brief SST_OPTIONS \n DESCRIPTION: Specify LM transition model options/correlations. \n Options: see \link LM_Options_Map \endlink \n DEFAULT: NONE \ingroup Config*/
Expand Down Expand Up @@ -6307,6 +6310,9 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
else cout << "\nusing default hard coded lower limit clipping";

cout << "." << endl;

if (sstParsedOptions.prodLim) cout << "Changing the value of the TKE production limiter constant to " << prodLimConst << endl;

break;
}
switch (Kind_Trans_Model) {
Expand Down
4 changes: 4 additions & 0 deletions SU2_CFD/include/numerics/CNumerics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ class CNumerics {

bool bounded_scalar = false; /*!< \brief Flag for bounded scalar problem */

su2double ProdDistr[5];

public:
/*!
* \brief Return type used in some "ComputeResidual" overloads to give a
Expand Down Expand Up @@ -1605,6 +1607,8 @@ class CNumerics {
* \return is_bounded_scalar : scalar solver uses bounded scalar convective transport
*/
inline bool GetBoundedScalar() const { return bounded_scalar;}

inline su2double GetProdDest(int index) const {return ProdDistr[index];}
};

/*!
Expand Down
60 changes: 55 additions & 5 deletions SU2_CFD/include/numerics/turbulent/turb_sources.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,8 @@
/*--- Ambient values for SST-SUST. ---*/
const su2double kAmb, omegaAmb;

su2double Pk, Dk, Pw, Dw;

su2double F1_i, F2_i, CDkw_i;
su2double Residual[2];
su2double* Jacobian_i[2];
Expand Down Expand Up @@ -829,6 +831,8 @@
su2double P_Base = 0;
su2double zetaFMt = 0.0;
const su2double Mt = sqrt(2.0 * ScalarVar_i[0]) / V_i[idx.SoundSpeed()];
su2double PDTerm = 0.0;
const su2double alpha1 = 1.0;

/*--- Apply production term modifications ---*/
switch (sstParsedOptions.production) {
Expand Down Expand Up @@ -860,6 +864,25 @@
}
break;

case SST_OPTIONS::COMP_ShuzHoff:{

// su2double MeanReynoldsStress[3][3];
// ComputeStressTensor(nDim, MeanReynoldsStress, PrimVar_Grad_i + idx.Velocity(), Eddy_Viscosity_i,
// Density_i, ScalarVar_i[0]);
Comment on lines +869 to +871

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI about 2 months ago

The best way to fix the problem is to remove the commented-out code entirely. This will make the code cleaner and easier to read, and it will eliminate any potential confusion about the commented-out sections. If the code is needed for future reference, it should be documented separately or added to version control comments.

  • Remove the commented-out code from lines 869 to 879.
  • Ensure that the remaining code is properly formatted and that no functionality is lost.
Suggested changeset 1
SU2_CFD/include/numerics/turbulent/turb_sources.hpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp
--- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp
+++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp
@@ -867,16 +867,3 @@
         case SST_OPTIONS::COMP_ShuzHoff:{
-        
-          // su2double MeanReynoldsStress[3][3];
-          // ComputeStressTensor(nDim, MeanReynoldsStress, PrimVar_Grad_i + idx.Velocity(), Eddy_Viscosity_i, 
-          //                     Density_i, ScalarVar_i[0]);
-
-          // for (size_t iDim = 0.0; iDim < nDim; iDim++){
-          //   for (size_t jDim = 0.0; jDim < nDim; jDim++){
-          //     PDTerm += MeanReynoldsStress[iDim][jDim] * PrimVar_Grad_i[idx.Velocity() + iDim][jDim];
-          //   }
-          // }
-          // PDTerm = (-alpha2*PDTerm + alpha3 * epsilon * Density_i)*Mt*Mt;
-
           zetaFMt = alpha1 * Mt*Mt * (1-F1_i);
-          
           P_Base = StrainMag_i;
EOF
@@ -867,16 +867,3 @@
case SST_OPTIONS::COMP_ShuzHoff:{

// su2double MeanReynoldsStress[3][3];
// ComputeStressTensor(nDim, MeanReynoldsStress, PrimVar_Grad_i + idx.Velocity(), Eddy_Viscosity_i,
// Density_i, ScalarVar_i[0]);

// for (size_t iDim = 0.0; iDim < nDim; iDim++){
// for (size_t jDim = 0.0; jDim < nDim; jDim++){
// PDTerm += MeanReynoldsStress[iDim][jDim] * PrimVar_Grad_i[idx.Velocity() + iDim][jDim];
// }
// }
// PDTerm = (-alpha2*PDTerm + alpha3 * epsilon * Density_i)*Mt*Mt;

zetaFMt = alpha1 * Mt*Mt * (1-F1_i);

P_Base = StrainMag_i;
Copilot is powered by AI and may make mistakes. Always verify output.

// for (size_t iDim = 0.0; iDim < nDim; iDim++){
// for (size_t jDim = 0.0; jDim < nDim; jDim++){
// PDTerm += MeanReynoldsStress[iDim][jDim] * PrimVar_Grad_i[idx.Velocity() + iDim][jDim];
// }
// }
// PDTerm = (-alpha2*PDTerm + alpha3 * epsilon * Density_i)*Mt*Mt;
Comment on lines +873 to +878

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI about 2 months ago

To fix the problem, we should remove the commented-out code entirely. This will make the code cleaner and easier to read, and it will eliminate any potential confusion about whether the commented-out code is meant to be re-enabled or not.

  • Locate the commented-out code block starting at line 869 and ending at line 878.
  • Remove the entire block of commented-out code.
  • Ensure that the remaining code is properly formatted and that no functionality is lost.
Suggested changeset 1
SU2_CFD/include/numerics/turbulent/turb_sources.hpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp
--- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp
+++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp
@@ -867,16 +867,3 @@
         case SST_OPTIONS::COMP_ShuzHoff:{
-        
-          // su2double MeanReynoldsStress[3][3];
-          // ComputeStressTensor(nDim, MeanReynoldsStress, PrimVar_Grad_i + idx.Velocity(), Eddy_Viscosity_i, 
-          //                     Density_i, ScalarVar_i[0]);
-
-          // for (size_t iDim = 0.0; iDim < nDim; iDim++){
-          //   for (size_t jDim = 0.0; jDim < nDim; jDim++){
-          //     PDTerm += MeanReynoldsStress[iDim][jDim] * PrimVar_Grad_i[idx.Velocity() + iDim][jDim];
-          //   }
-          // }
-          // PDTerm = (-alpha2*PDTerm + alpha3 * epsilon * Density_i)*Mt*Mt;
-
           zetaFMt = alpha1 * Mt*Mt * (1-F1_i);
-          
           P_Base = StrainMag_i;
EOF
@@ -867,16 +867,3 @@
case SST_OPTIONS::COMP_ShuzHoff:{

// su2double MeanReynoldsStress[3][3];
// ComputeStressTensor(nDim, MeanReynoldsStress, PrimVar_Grad_i + idx.Velocity(), Eddy_Viscosity_i,
// Density_i, ScalarVar_i[0]);

// for (size_t iDim = 0.0; iDim < nDim; iDim++){
// for (size_t jDim = 0.0; jDim < nDim; jDim++){
// PDTerm += MeanReynoldsStress[iDim][jDim] * PrimVar_Grad_i[idx.Velocity() + iDim][jDim];
// }
// }
// PDTerm = (-alpha2*PDTerm + alpha3 * epsilon * Density_i)*Mt*Mt;

zetaFMt = alpha1 * Mt*Mt * (1-F1_i);

P_Base = StrainMag_i;
Copilot is powered by AI and may make mistakes. Always verify output.

zetaFMt = alpha1 * Mt*Mt * (1-F1_i);

P_Base = StrainMag_i;
}
break;

default:
/*--- Base production term for SST-1994 and SST-2003 ---*/
P_Base = StrainMag_i;
Expand All @@ -870,15 +893,28 @@
const su2double prod_limit = prod_lim_const * beta_star * Density_i * ScalarVar_i[1] * ScalarVar_i[0];

su2double P = Eddy_Viscosity_i * pow(P_Base, 2);
if (sstParsedOptions.fullProd) P -= Eddy_Viscosity_i * diverg*diverg * 2.0/3.0;
if (!sstParsedOptions.modified) P -= Density_i * ScalarVar_i[0] * diverg * 2.0/3.0;

su2double PLim = 0.0;
if ( P > prod_limit ) PLim = 1.0;
su2double pk = max(0.0, min(P, prod_limit));

const auto& eddy_visc_var = sstParsedOptions.version == SST_OPTIONS::V1994 ? VorticityMag : StrainMag_i;
if (sstParsedOptions.production == SST_OPTIONS::COMP_ShuzHoff) {
const su2double alpha2 = 0.4;
const su2double alpha3 = 0.2;
const su2double epsilon = beta_star * ScalarVar_i[1] * ScalarVar_i[0];

PDTerm = (-alpha2*pk + alpha3*Density_i*epsilon)*Mt*Mt;
}

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);
pw = alfa_blended * Density_i * P / Eddy_Viscosity_i;
} else {
pw = (alfa_blended * Density_i / Eddy_Viscosity_i) * pk;
}
Expand All @@ -901,10 +937,14 @@
pk += Dilatation_Sarkar;
}

if (sstParsedOptions.production == SST_OPTIONS::COMP_ShuzHoff) {
pk += (1-F1_i)*PDTerm;
}

/*--- 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 @@ -913,18 +953,27 @@
}

/*--- Add the production terms to the residuals. ---*/
Pk = pk;
Pw = pw;

Residual[0] += pk * Volume;
Residual[1] += pw * Volume;

/*--- Add the dissipation terms to the residuals.---*/
Dk = dk;
Dw = dw;

Residual[0] -= dk * Volume;
Residual[1] -= dw * Volume;

/*--- Cross diffusion ---*/
ProdDistr[0] = Pk;
ProdDistr[1] = Dk;
ProdDistr[2] = Pw;
ProdDistr[3] = Dw;
ProdDistr[4] = PLim;

Residual[1] += (1.0 - F1_i) * CDkw_i * Volume;
/*--- Cross diffusion ---*/
Residual[1] += (1.0 - F1_i) * (CDkw_i - PDTerm / Eddy_Viscosity_i) * Volume;

/*--- Contribution due to 2D axisymmetric formulation ---*/

Expand All @@ -933,6 +982,7 @@
/*--- Implicit part ---*/

Jacobian_i[0][0] = -beta_star * ScalarVar_i[1] * Volume * (1.0 + zetaFMt);
if (!sstParsedOptions.modified) Jacobian_i[0][0] -= diverg * 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);
Expand Down
11 changes: 11 additions & 0 deletions SU2_CFD/include/numerics_simd/flow/convection/centered.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class CCenteredBase : public Base {
const bool dynamicGrid;
const su2double stretchParam = 0.3;

using Base::turbVars;

/*!
* \brief Constructor, store some constants and forward args to base.
*/
Expand Down Expand Up @@ -96,6 +98,8 @@ class CCenteredBase : public Base {
const bool implicit = (config.GetKind_TimeIntScheme() == EULER_IMPLICIT);
const auto& solution = static_cast<const CEulerVariable&>(solution_);

const bool tkeNeeded = config.GetKind_Turb_Model() == TURB_MODEL::SST;

const auto iPoint = geometry.edges->GetNode(iEdge,0);
const auto jPoint = geometry.edges->GetNode(iEdge,1);

Expand All @@ -119,6 +123,13 @@ class CCenteredBase : public Base {
avgV.all(iVar) = 0.5 * (V.i.all(iVar) + V.j.all(iVar));
}

if (tkeNeeded) {
V.i.allTurb = gatherVariables<1>(iPoint, turbVars->GetSolution());
V.j.allTurb = gatherVariables<1>(jPoint, turbVars->GetSolution());

avgV.allTurb(0) = 0.5*(V.i.allTurb(0)+V.j.allTurb(0));
}

/*--- Compute conservative variables. ---*/

CPair<CCompressibleConservatives<nDim> > U;
Expand Down
8 changes: 7 additions & 1 deletion SU2_CFD/include/numerics_simd/flow/convection/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ FORCEINLINE CPair<ReconVarType> reconstructPrimitives(Int iEdge, Int iPoint, Int
bool muscl, LIMITER limiterType,
const CPair<PrimVarType>& V1st,
const VectorDbl<nDim>& vector_ij,
const VariableType& solution) {
const VariableType& solution,
const bool tkeNeeded) {
static_assert(ReconVarType::nVar <= PrimVarType::nVar,"");

const auto& gradients = solution.GetGradient_Reconstruction();
Expand All @@ -125,6 +126,11 @@ FORCEINLINE CPair<ReconVarType> reconstructPrimitives(Int iEdge, Int iPoint, Int
V.i.all(iVar) = V1st.i.all(iVar);
V.j.all(iVar) = V1st.j.all(iVar);
}
// Only first order for turbulence
if (tkeNeeded) {
V.i.allTurb(0) = V1st.i.allTurb(0);
V.j.allTurb(0) = V1st.j.allTurb(0);
}

if (muscl) {
/*--- Recompute density and enthalpy instead of reconstructing. ---*/
Expand Down
Loading
Loading