Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 2 additions & 5 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1216,13 +1216,10 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne
SSTParsedOptions.production = SST_OPTIONS::UQ;
}

// Parse compressibility options
// Parse compressibility options, stored in compWilcox and compSarkar so that they can be combined with a
// production modifier
if (sst_compWilcox && sst_compSarkar) {
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;
}

SSTParsedOptions.sust = sst_sust;
Expand Down
16 changes: 10 additions & 6 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5116,6 +5116,14 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
Kind_Solver == MAIN_SOLVER::FEM_EULER)
Kind_Turb_Model = TURB_MODEL::NONE;

/*--- SST has no engine or actuator-disk boundary conditions: the faces would get no turbulence flux at all.
Checked after the turbulence model of Euler zones is cleared (multizone). ---*/
if (Kind_Turb_Model == TURB_MODEL::SST &&
(nMarker_EngineInflow + nMarker_EngineExhaust + nMarker_ActDiskInlet + nMarker_ActDiskOutlet) > 0) {
SU2_MPI::Error("MARKER_ENGINE_INFLOW, MARKER_ENGINE_EXHAUST and MARKER_ACTDISK are not supported with the SST model.",
CURRENT_FUNCTION);
}

Kappa_2nd_Flow = jst_coeff[0];
Kappa_4th_Flow = jst_coeff[1];
Kappa_2nd_AdjFlow = jst_adj_coeff[0];
Expand Down Expand Up @@ -6829,16 +6837,12 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
cout << "\nperturbing the Reynold's Stress Matrix towards " << eig_val_comp << " component turbulence";
if (uq_permute) cout << " (permuting eigenvectors)";
break;
case SST_OPTIONS::COMP_Wilcox:
cout << " with compressibility correction of Wilcox";
break;
case SST_OPTIONS::COMP_Sarkar:
cout << " with compressibility correction of Sarkar";
break;
default:
cout << " with no production modification";
break;
}
if (sstParsedOptions.compWilcox) cout << ", with compressibility correction of Wilcox";
if (sstParsedOptions.compSarkar) cout << ", with compressibility correction of Sarkar";

if (sstParsedOptions.dll){
cout << "\nusing non dimensional lower limits relative to infinity values clipping by Coefficients:" ;
Expand Down
32 changes: 32 additions & 0 deletions Docs/SSTEnergy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# SST turbulent kinetic energy in the compressible solver

The compressible SST solver stores total energy per unit mass as
`E = e + |u|²/2 + k`. Thermodynamic pressure and temperature use `e`;
total enthalpy and its convective flux include `k`. Flow Jacobians hold `k`
fixed because it is advanced by the separate turbulence solver.

This energy convention does not imply that every term of the full
Favre-averaged energy equation is modeled. The current SSTm formulation:

- omits the isotropic `-2 rho k I/3` term from turbulent stress;
- uses approximate strain-based production `P = mu_t 2S:S` before applying
the production limiter (other production options modify this expression);
- omits molecular diffusion and turbulent transport of `k` from the total
energy flux. Temperature heat conduction is still present.

These are modeling approximations, distinct from interpreting `k` as
thermal energy inside a numerical flux or its Jacobian. The
[Turbulence Modeling Resource SST definitions](https://tmbwg.github.io/turbmodels/sst.html)
explicitly describe the SSTm production approximation, and its
[compressible RANS implementation notes](https://tmbwg.github.io/turbmodels/implementrans.html)
allow omission of the energy transport term involving the gradient of `k`.

For unmodified strain production, its difference from the contraction of
SU2's deviatoric turbulent stress with the velocity gradient is
`2 mu_t (div u)²/3`, before limiting. At fixed total energy, additional
production of `k` reduces thermal energy. This difference vanishes for
incompressible flow and can matter in shocks and strong expansions. The
production limiter, sustaining terms, transition coupling, and production
modifiers prevent interpreting this expression as the actual production
excess in every configuration. Changing these approximations requires
choosing and validating a different SST formulation.
24 changes: 14 additions & 10 deletions SU2_CFD/include/numerics/CNumerics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1160,10 +1160,11 @@ class CNumerics {
* \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
* \param[in] val_scale - Scale of the projection.
* \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian.
* \param[in] val_tke - Turbulent kinetic energy contained in the total energy (SST), held fixed.
*/
void GetInviscidProjJac(const su2double *val_velocity, const su2double *val_energy,
const su2double *val_normal, su2double val_scale,
su2double **val_Proj_Jac_tensor) const;
su2double **val_Proj_Jac_tensor, su2double val_tke = 0.0) const;

/*!
* \brief Compute the projection of the inviscid Jacobian matrices (incompressible).
Expand Down Expand Up @@ -1236,11 +1237,12 @@ class CNumerics {
* \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
* \param[in] val_scale - Scale of the projection.
* \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian.
* \param[in] val_tke - Turbulent kinetic energy contained in the total energy (SST), held fixed.
*/
void GetInviscidProjJac(const su2double *val_velocity, const su2double *val_enthalphy,
const su2double *val_chi, const su2double *val_kappa,
const su2double *val_normal, su2double val_scale,
su2double **val_Proj_Jac_tensor) const;
su2double **val_Proj_Jac_tensor, su2double val_tke = 0.0) const;

/*!
* \brief Mapping between primitives variables P and conservatives variables C.
Expand All @@ -1267,7 +1269,7 @@ class CNumerics {
void GetPMatrix(const su2double *val_density, const su2double *val_velocity,
const su2double *val_soundspeed, const su2double *val_enthalpy,
const su2double *val_chi, const su2double *val_kappa,
const su2double *val_normal, su2double **val_p_tensor) const;
const su2double *val_normal, su2double **val_p_tensor, su2double val_tke = 0.0) const;

/*!
* \brief Computation of the matrix P, this matrix diagonalize the conservative Jacobians in
Expand All @@ -1281,12 +1283,13 @@ class CNumerics {
template <typename Matrix>
void GetPMatrix(const su2double& density, const su2double* velocity,
const su2double& soundspeed, const su2double* normal,
Matrix& p_tensor) const {
Matrix& p_tensor, su2double tke = 0.0) const {
/*--- With SST the total energy contains k (tke): it is added to the kinetic energy of the energy row. ---*/
const su2double rhooc = density / soundspeed;
const su2double rhoxc = density * soundspeed;

if (nDim == 2) {
const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(2, velocity);
const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(2, velocity) + tke;
const su2double projvel = GeometryToolbox::DotProduct(2, velocity, normal);

p_tensor[0][0] = 1.0;
Expand All @@ -1309,7 +1312,7 @@ class CNumerics {
p_tensor[3][2] = 0.5 * (ke * rhooc + density * projvel + rhoxc / Gamma_Minus_One);
p_tensor[3][3] = 0.5 * (ke * rhooc - density * projvel + rhoxc / Gamma_Minus_One);
} else {
const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(3, velocity);
const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(3, velocity) + tke;
const su2double projvel = GeometryToolbox::DotProduct(3, velocity, normal);

p_tensor[0][0] = normal[0];
Expand Down Expand Up @@ -1444,7 +1447,7 @@ class CNumerics {
void GetPMatrix_inv(su2double **val_invp_tensor, const su2double *val_density,
const su2double *val_velocity, const su2double *val_soundspeed,
const su2double *val_chi, const su2double *val_kappa,
const su2double *val_normal) const;
const su2double *val_normal, su2double val_tke = 0.0) const;

/*!
* \brief Computation of the matrix P^{-1}, this matrix diagonalize the conservative Jacobians
Expand All @@ -1458,7 +1461,8 @@ class CNumerics {
template <typename Matrix>
void GetPMatrix_inv(const su2double& density, const su2double* velocity,
const su2double& soundspeed, const su2double* normal,
Matrix& inv_p_tensor) const {
Matrix& inv_p_tensor, su2double tke = 0.0) const {
/*--- With SST the total energy contains k (tke), dp/drho = (gamma-1) (|u|^2/2 - k). ---*/
const su2double rhoxc = density * soundspeed;
const su2double c2 = pow(soundspeed, 2);
const su2double gm1 = Gamma_Minus_One;
Expand All @@ -1469,7 +1473,7 @@ class CNumerics {

if (nDim == 3) {
const su2double k2orho = normal[2] / density;
const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(3, velocity);
const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(3, velocity) - tke;
const su2double projvel_o_rho = GeometryToolbox::DotProduct(3, velocity, normal) / density;

inv_p_tensor[0][0] = normal[0] + k1orho * velocity[2] - k2orho * velocity[1] - normal[0] * gm1_o_c2 * ke;
Expand Down Expand Up @@ -1502,7 +1506,7 @@ class CNumerics {
inv_p_tensor[4][3] = -k2orho - gm1_o_rhoxc * velocity[2];
inv_p_tensor[4][4] = gm1_o_rhoxc;
} else {
const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(2, velocity);
const su2double ke = 0.5 * GeometryToolbox::SquaredNorm(2, velocity) - tke;
const su2double projvel_o_rho = GeometryToolbox::DotProduct(2, velocity, normal) / density;

inv_p_tensor[0][0] = 1 - gm1_o_c2 * ke;
Expand Down
1 change: 1 addition & 0 deletions SU2_CFD/include/numerics/flow/convection/roe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class CUpwRoeBase_Flow : public CNumerics {
su2double *ProjFlux_j = nullptr, *Conservatives_j = nullptr;
su2double **P_Tensor = nullptr, **invP_Tensor = nullptr;
su2double RoeDensity, RoeEnthalpy, RoeSoundSpeed, ProjVelocity, RoeSoundSpeed2, kappa;
su2double RoeTke = 0.0; /*!< \brief Roe-averaged k (SST, contained in the total energy). */

su2double* Flux = nullptr; /*!< \brief The flux accross the face. */
su2double** Jacobian_i = nullptr; /*!< \brief The Jacobian w.r.t. point i after computation. */
Expand Down
3 changes: 2 additions & 1 deletion SU2_CFD/include/numerics/flow/flow_sources.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ class CSourceBase_Flow : public CNumerics {
*/
class CSourceAxisymmetric_Flow : public CSourceBase_Flow {
protected:
bool implicit, viscous, rans;
bool implicit, viscous;
bool tkeInEnergy; /*!< \brief SST: k is part of the total energy (turb_ke_i is set by the solver). */
su2double yinv{0.0};

/*!
Expand Down
31 changes: 13 additions & 18 deletions SU2_CFD/include/numerics/turbulent/turb_sources.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,33 +939,27 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
P_Base = sqrt(StrainMag_i*VorticityMag);
break;

case SST_OPTIONS::COMP_Wilcox:
P_Base = StrainMag_i;
if (Mt >= 0.25) {
zetaFMt = 2.0 * (Mt * Mt - 0.25 * 0.25);
}
break;

case SST_OPTIONS::COMP_Sarkar:
P_Base = StrainMag_i;
if (Mt >= 0.25) {
zetaFMt = 0.5 * (Mt * Mt);
}
break;

default:
/*--- Base production term for SST-1994 and SST-2003 ---*/
P_Base = StrainMag_i;
break;
}

/*--- Compressibility corrections, independent of the production modifier. ---*/
if (sstParsedOptions.compWilcox && Mt >= 0.25) {
zetaFMt = 2.0 * (Mt * Mt - 0.25 * 0.25);
}
if (sstParsedOptions.compSarkar && Mt >= 0.25) {
zetaFMt = 0.5 * (Mt * Mt);
}

/*--- Production limiter. ---*/
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);
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. ---*/
Expand All @@ -989,15 +983,15 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
pw = max(pw, sust_w);
}

if (sstParsedOptions.production == SST_OPTIONS::COMP_Sarkar) {
if (sstParsedOptions.compSarkar) {
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;
pk += Dilatation_Sarkar;
}

/*--- 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 @@ -1022,7 +1016,8 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
Jacobian_i[0][0] = -beta_star * ScalarVar_i[1] * Volume * (1.0 + zetaFMt);
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);


/*--- Contribution due to 2D axisymmetric formulation, after the implicit part since it
* adds to the Jacobian (which the assignments above would otherwise overwrite). ---*/
Expand Down
Loading