Skip to content
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

[WIP] Inconsistencies and improvements to SST model #2329

Open
wants to merge 45 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
45 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
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
13 changes: 12 additions & 1 deletion Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,8 @@ class CConfig {
nMu_Temperature_Ref, /*!< \brief Number of species reference temperature for Sutherland model. */
nMu_S, /*!< \brief Number of species reference S for Sutherland model. */
nThermal_Conductivity_Constant,/*!< \brief Number of species constant thermal conductivity. */
nPrandtl_Lam, /*!< \brief Number of species laminar Prandtl number. */
nPrandtl_Lam, /*!< \brief Number of species
addDoubleOption("FREESTREAM_TURB2LAMVISCRATIO", TurbIntensityAndViscRatioFreeStream[1], 10.0); Prandtl number. */
Copy link
Contributor

@bigfooted bigfooted Jul 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this intentionally commented, or...? If it is used, I guess this should go to line 872

Suggested change
nPrandtl_Lam, /*!< \brief Number of species
addDoubleOption("FREESTREAM_TURB2LAMVISCRATIO", TurbIntensityAndViscRatioFreeStream[1], 10.0); Prandtl number. */
nPrandtl_Lam, /*!< \brief Number of species laminar Prandtl number. */
addDoubleOption("FREESTREAM_TURB2LAMVISCRATIO", TurbIntensityAndViscRatioFreeStream[1], 10.0); /*!<\brief Freestream mu_turb to mu_lam viscosity ratio */

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a wrong copy-paste from me. It should not be there in the first place.

nPrandtl_Turb, /*!< \brief Number of species turbulent Prandtl number. */
nConstant_Lewis_Number; /*!< \brief Number of species Lewis Number. */
su2double Diffusivity_Constant; /*!< \brief Constant mass diffusivity for scalar transport. */
Expand All @@ -868,6 +869,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 @@ -1165,6 +1167,10 @@ 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 lowerLimitTKE,
lowerLimitDissipation;
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 @@ -9847,6 +9853,11 @@ class CConfig {
*/
SST_ParsedOptions GetSSTParsedOptions() const { return sstParsedOptions; }

su2double GetLowerLimitTKE() const { return lowerLimitTKE; }
su2double GetLowerLimitDissipation() const { return lowerLimitDissipation; }
su2double GetProdLimConst() const { return prodLimConst; }
su2double GetLDomain() const { return LDomain; }

/*!
* \brief Get parsed SA option data structure.
* \return SA option data structure.
Expand Down
25 changes: 23 additions & 2 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -990,18 +990,26 @@ enum class SST_OPTIONS {
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. */
FULLPROD, /*!< \brief Menter k-w SST model with full production term. */
LLT, /*!< \brief Menter k-w SST model with Lower Limits Treatments. */
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("FULLPROD", SST_OPTIONS::FULLPROD)
MakePair("LLT", SST_OPTIONS::LLT)
MakePair("PRODLIM", SST_OPTIONS::PRODLIM)
MakePair("NEWBC", SST_OPTIONS::NEWBC)
};

/*!
Expand All @@ -1013,6 +1021,10 @@ struct SST_ParsedOptions {
bool sust = false; /*!< \brief Bool for SST model with sustaining terms. */
bool uq = false; /*!< \brief Bool for using uncertainty quantification. */
bool modified = false; /*!< \brief Bool for modified (m) SST model. */
bool fullProd = false; /*!< \brief Bool for full production term. */
bool llt = false; /*!< \brief Bool for Lower Limits Treatment. */
bool prodLim = false; /*!< \brief Bool for user-defined production limiter constant. */
bool newBC = false; /*!< \brief Bool for new boundary conditions. */
};

/*!
Expand All @@ -1030,6 +1042,11 @@ 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_llt = IsPresent(SST_OPTIONS::LLT);
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 Down Expand Up @@ -1071,6 +1088,10 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne
SSTParsedOptions.sust = sst_sust;
SSTParsedOptions.modified = sst_m;
SSTParsedOptions.uq = sst_uq;
SSTParsedOptions.fullProd = found_fullProd;
SSTParsedOptions.llt = found_llt;
SSTParsedOptions.prodLim = found_prodLim;
SSTParsedOptions.newBC = found_newBC;
return SSTParsedOptions;
}

Expand Down
9 changes: 9 additions & 0 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,11 @@ 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("LOWER_LIMIT_TKE", lowerLimitTKE, 1e-20);
addDoubleOption("LOWER_LIMIT_DISSIPATION", lowerLimitDissipation, 1e-6);
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 @@ -6175,6 +6180,10 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
break;
}
cout << "." << endl;

if (sstParsedOptions.prodLim) cout << "Changing the value of the TKE production limiter constant to " << prodLimConst << endl;
if (sstParsedOptions.llt) cout << "Changing the value of the lower limits of TKE and Omega " << 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
22 changes: 20 additions & 2 deletions SU2_CFD/include/numerics/turbulent/turb_sources.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,8 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
/*--- 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 @@ -805,6 +807,11 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
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.modified) P -= Eddy_Viscosity_i * diverg*diverg * 2.0/3.0;
if (sstParsedOptions.fullProd) 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;
Expand Down Expand Up @@ -843,18 +850,28 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
}

/*--- 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 ---*/
const su2double CrossDiffusionTerm = CDkw_i < 0.0 ? -min(Pw, abs(CrossDiffusionTerm)) : CrossDiffusionTerm;
Residual[1] += (1.0 - F1_i) * CrossDiffusionTerm * Volume;

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

Expand All @@ -863,6 +880,7 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
/*--- Implicit part ---*/

Jacobian_i[0][0] = -beta_star * ScalarVar_i[1] * Volume;
if (sstParsedOptions.fullProd) Jacobian_i[0][0] -= diverg * Volume*2.0/3.0;
Jacobian_i[0][1] = -beta_star * ScalarVar_i[0] * Volume;
Jacobian_i[1][0] = 0.0;
Jacobian_i[1][1] = -2.0 * beta_blended * ScalarVar_i[1] * Volume;
Expand Down
38 changes: 38 additions & 0 deletions SU2_CFD/include/variables/CTurbVariable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ class CTurbVariable : public CScalarVariable {
static constexpr size_t MAXNVAR = 2;
VectorType turb_index;
VectorType intermittency; /*!< \brief Value of the intermittency for the trans. model. */
VectorType Pk;
VectorType Pw;
VectorType Dk;
VectorType Dw;
VectorType PkLim;

/*!
* \brief Constructor of the class.
Expand Down Expand Up @@ -100,5 +105,38 @@ class CTurbVariable : public CScalarVariable {
*/
inline void SetIntermittency(unsigned long iPoint, su2double val_intermittency) final { intermittency(iPoint) = val_intermittency; }

/*!
* \brief Set the intermittency of the transition model.
* \param[in] iPoint - Point index.
* \param[in] val_intermittency - New value of the intermittency.
*/
inline void SetProdDestr(unsigned long iPoint, su2double* val_ProdDestr) final {
Pk(iPoint) = val_ProdDestr[0];
Dk(iPoint) = val_ProdDestr[1];
Pw(iPoint) = val_ProdDestr[2];
Dw(iPoint) = val_ProdDestr[3];
PkLim(iPoint) = val_ProdDestr[4];
}

/*!
* \brief Set the intermittency of the transition model.
* \param[in] iPoint - Point index.
* \param[in] val_intermittency - New value of the intermittency.
*/
inline su2double GetProdTKE(unsigned long iPoint) const final {
return Pk(iPoint);
}
inline su2double GetDestrTKE(unsigned long iPoint) const final {
return Dk(iPoint);
}
inline su2double GetProdW(unsigned long iPoint) const final {
return Pw(iPoint);
}
inline su2double GetDestrW(unsigned long iPoint) const final {
return Dw(iPoint);
}
inline su2double GetPkLim(unsigned long iPoint) const final {
return PkLim(iPoint);
}
};

7 changes: 7 additions & 0 deletions SU2_CFD/include/variables/CVariable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2340,4 +2340,11 @@ class CVariable {

inline virtual const su2double *GetScalarSources(unsigned long iPoint) const { return nullptr; }
inline virtual const su2double *GetScalarLookups(unsigned long iPoint) const { return nullptr; }

inline virtual void SetProdDestr(unsigned long iPoint, su2double* val_ProdDestr) { }
inline virtual su2double GetProdTKE(unsigned long iPoint) const { return 0.0; }
inline virtual su2double GetDestrTKE(unsigned long iPoint) const { return 0.0; }
inline virtual su2double GetProdW(unsigned long iPoint) const { return 0.0; }
inline virtual su2double GetDestrW(unsigned long iPoint) const { return 0.0; }
inline virtual su2double GetPkLim(unsigned long iPoint) const { return 0.0; }
};
18 changes: 18 additions & 0 deletions SU2_CFD/src/output/CFlowOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,13 @@ void CFlowOutput::SetVolumeOutputFieldsScalarSolution(const CConfig* config){
case TURB_FAMILY::KW:
AddVolumeOutput("TKE", "Turb_Kin_Energy", "SOLUTION", "Turbulent kinetic energy");
AddVolumeOutput("DISSIPATION", "Omega", "SOLUTION", "Rate of dissipation");
AddVolumeOutput("PROD_TKE", "Prod_TKE", "SOLUTION", "Production of turbulent kinetic energy");
AddVolumeOutput("DESTR_TKE", "Destr_TKE", "SOLUTION", "Destruction of turbulent kinetic energy");
AddVolumeOutput("PROD_TKE_LIM", "Prod_TKE_Lim", "SOLUTION", "Check if production limiter has been used for TKE");
AddVolumeOutput("PROD_W", "Prod_W", "SOLUTION", "Production of rate of dissipation");
AddVolumeOutput("DESTR_W", "Destr_W", "SOLUTION", "Destruction of rate of dissipation");
AddVolumeOutput("CDkw", "CDkw", "SOLUTION", "Cross-Diffusion term");
AddVolumeOutput("F1", "F1", "SOLUTION", "F1 blending function");
break;

case TURB_FAMILY::NONE:
Expand Down Expand Up @@ -1479,6 +1486,8 @@ void CFlowOutput::SetVolumeOutputFieldsScalarMisc(const CConfig* config) {
AddVolumeOutput("VORTICITY", "Vorticity", "VORTEX_IDENTIFICATION", "Value of the vorticity");
}
AddVolumeOutput("Q_CRITERION", "Q_Criterion", "VORTEX_IDENTIFICATION", "Value of the Q-Criterion");
AddVolumeOutput("WALL_DISTANCE", "Wall_Distance", "MISC", "Wall distance value");
AddVolumeOutput("STRAIN_MAG", "Strain_Magnitude", "MISC", "Strain magnitude value");
}

// Timestep info
Expand Down Expand Up @@ -1512,6 +1521,8 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con
SetVolumeOutputValue("VORTICITY", iPoint, Node_Flow->GetVorticity(iPoint)[2]);
}
SetVolumeOutputValue("Q_CRITERION", iPoint, GetQCriterion(Node_Flow->GetVelocityGradient(iPoint)));
SetVolumeOutputValue("WALL_DISTANCE", iPoint, Node_Geo->GetWall_Distance(iPoint));
SetVolumeOutputValue("STRAIN_MAG", iPoint, Node_Turb->GetStrainMag(iPoint));
}

const bool limiter = (config->GetKind_SlopeLimit_Turb() != LIMITER::NONE);
Expand All @@ -1528,6 +1539,13 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con
case TURB_FAMILY::KW:
SetVolumeOutputValue("TKE", iPoint, Node_Turb->GetSolution(iPoint, 0));
SetVolumeOutputValue("DISSIPATION", iPoint, Node_Turb->GetSolution(iPoint, 1));
SetVolumeOutputValue("PROD_TKE", iPoint, Node_Turb->GetProdTKE(iPoint));
SetVolumeOutputValue("DESTR_TKE", iPoint, Node_Turb->GetDestrTKE(iPoint));
SetVolumeOutputValue("PROD_TKE_LIM", iPoint, Node_Turb->GetPkLim(iPoint));
SetVolumeOutputValue("PROD_W", iPoint, Node_Turb->GetProdW(iPoint));
SetVolumeOutputValue("DESTR_W", iPoint, Node_Turb->GetDestrW(iPoint));
SetVolumeOutputValue("CDkw", iPoint, Node_Turb->GetCrossDiff(iPoint));
SetVolumeOutputValue("F1", iPoint, Node_Turb->GetF1blending(iPoint));
SetVolumeOutputValue("RES_TKE", iPoint, turb_solver->LinSysRes(iPoint, 0));
SetVolumeOutputValue("RES_DISSIPATION", iPoint, turb_solver->LinSysRes(iPoint, 1));
if (limiter) {
Expand Down
21 changes: 17 additions & 4 deletions SU2_CFD/src/solvers/CEulerSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4768,6 +4768,8 @@ void CEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container,
bool implicit = config->GetKind_TimeIntScheme() == EULER_IMPLICIT;
bool viscous = config->GetViscous();
bool tkeNeeded = config->GetKind_Turb_Model() == TURB_MODEL::SST;
CVariable* turbNodes = nullptr;
if (tkeNeeded) turbNodes = solver_container[TURB_SOL]->GetNodes();

auto *Normal = new su2double[nDim];

Expand Down Expand Up @@ -4917,7 +4919,8 @@ void CEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container,
}
Pressure = Density*SoundSpeed*SoundSpeed/Gamma;
Energy = Pressure/(Gamma_Minus_One*Density) + 0.5*Velocity2;
if (tkeNeeded) Energy += GetTke_Inf();
// if (tkeNeeded) Energy += GetTke_Inf();

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
if (tkeNeeded) Energy += turbNodes->GetSolution(iPoint,0);

/*--- Store new primitive state for computing the flux. ---*/

Expand Down Expand Up @@ -5011,6 +5014,8 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container,
implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT),
gravity = config->GetGravityForce(),
tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST);
CVariable* turbNodes = nullptr;
if (tkeNeeded) turbNodes = solver_container[TURB_SOL]->GetNodes();

su2double **P_Tensor = new su2double*[nVar],
**invP_Tensor = new su2double*[nVar];
Expand Down Expand Up @@ -5110,7 +5115,8 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container,
Density_e = GetFluidModel()->GetDensity();
StaticEnergy_e = GetFluidModel()->GetStaticEnergy();
Energy_e = StaticEnergy_e + 0.5 * Velocity2_e;
if (tkeNeeded) Energy_e += GetTke_Inf();
// if (tkeNeeded) Energy_e += GetTke_Inf();

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
if (tkeNeeded) Energy_e += turbNodes->GetSolution(iPoint,0);
break;

case STATIC_SUPERSONIC_INFLOW_PT:
Expand Down Expand Up @@ -7176,6 +7182,9 @@ void CEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
bool gravity = (config->GetGravityForce());
bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST);

CVariable* turbNodes = nullptr;
if (tkeNeeded) turbNodes = solver_container[TURB_SOL]->GetNodes();

auto *Normal = new su2double[nDim];

/*--- Loop over all the vertices on this boundary marker ---*/
Expand Down Expand Up @@ -7258,6 +7267,7 @@ void CEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
}
Energy = P_Exit/(Density*Gamma_Minus_One) + 0.5*Velocity2;
if (tkeNeeded) Energy += GetTke_Inf();
// if (tkeNeeded) Energy += turbNodes->GetSolution(iPoint,0);
Fixed Show fixed Hide fixed

/*--- Conservative variables, using the derived quantities ---*/
V_outlet[0] = Pressure / ( Gas_Constant * Density);
Expand Down Expand Up @@ -7341,6 +7351,8 @@ void CEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_con
const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
const auto Marker_Tag = config->GetMarker_All_TagBound(val_marker);
const bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST);
CVariable* turbNodes = nullptr;
if (tkeNeeded) turbNodes = solver_container[TURB_SOL]->GetNodes();

/*--- Supersonic inlet flow: there are no outgoing characteristics,
so all flow variables can be imposed at the inlet.
Expand All @@ -7361,14 +7373,15 @@ void CEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_con
/*--- Compute the energy from the specified state ---*/

const su2double Velocity2 = GeometryToolbox::SquaredNorm(int(MAXNDIM), Velocity);
su2double Energy = Pressure / (Density * Gamma_Minus_One) + 0.5 * Velocity2;
if (tkeNeeded) Energy += GetTke_Inf();
const su2double Energy_woTKE = Pressure / (Density * Gamma_Minus_One) + 0.5 * Velocity2;
su2double Energy = Energy_woTKE;

/*--- Loop over all the vertices on this boundary marker ---*/

SU2_OMP_FOR_DYN(OMP_MIN_SIZE)
for (auto iVertex = 0ul; iVertex < geometry->nVertex[val_marker]; iVertex++) {
const auto iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
if (tkeNeeded) Energy = Energy_woTKE + turbNodes->GetSolution(iPoint,0);

if (!geometry->nodes->GetDomain(iPoint)) continue;

Expand Down
Loading