Skip to content

Commit 8f633e5

Browse files
committed
Fix issues about rough SST BCs formulations
1 parent e517e4d commit 8f633e5

3 files changed

Lines changed: 21 additions & 22 deletions

File tree

Common/include/option_structure.hpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,9 +1105,9 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne
11051105
* \brief SST rough-wall boundary conditions Options
11061106
*/
11071107
enum class ROUGHSST_OPTIONS {
1108-
NONE, /*!< \brief No option / default. */
1109-
WILCOX1998, /*!< \brief Wilcox 1998 boundary conditions for rough walls / default. */
1110-
WILCOX2006, /*!< \brief Wilcox 2006 boundary conditions for rough walls. */
1108+
NONE, /*!< \brief No option / default no surface roughness applied. */
1109+
WILCOX1998, /*!< \brief Wilcox 1998 boundary conditions for rough walls. */
1110+
WILCOX2006, /*!< \brief Wilcox 2006 boundary conditions for rough walls / default version if roughness is applied. */
11111111
LIMITER_KNOPP, /*!< \brief Knopp eddy viscosity limiter. */
11121112
LIMITER_AUPOIX, /*!< \brief Aupoix eddy viscosity limiter. */
11131113
};
@@ -1135,22 +1135,21 @@ struct ROUGH_SST_ParsedOptions {
11351135
* \param[in] ROUGHSST_Options - Selected SST rough-wall boundary conditions option from config.
11361136
* \param[in] nROUGHSST_Options - Number of options selected.
11371137
* \param[in] rank - MPI rank.
1138-
* \return Struct with SA options.
1138+
* \return Struct with SST options.
11391139
*/
1140-
inline ROUGH_SST_ParsedOptions ParseROUGHSSTOptions(const ROUGHSST_OPTIONS *ROUGHSST_Options, unsigned short nROUGHSST_Options, int rank) {
1141-
ROUGH_SST_ParsedOptions ROUGHSSTParsedOptions;
1142-
1143-
auto IsPresent = [&](ROUGHSST_OPTIONS option) {
1144-
const auto roughsst_options_end = ROUGHSST_Options + nROUGHSST_Options;
1145-
return std::find(ROUGHSST_Options, roughsst_options_end, option) != roughsst_options_end;
1146-
};
1147-
1148-
ROUGHSSTParsedOptions.wilcox2006 = IsPresent(ROUGHSST_OPTIONS::WILCOX2006);
1149-
ROUGHSSTParsedOptions.limiter_knopp = IsPresent(ROUGHSST_OPTIONS::LIMITER_KNOPP);
1150-
ROUGHSSTParsedOptions.limiter_aupoix = IsPresent(ROUGHSST_OPTIONS::LIMITER_AUPOIX);
1140+
inline ROUGH_SST_ParsedOptions ParseROUGHSSTOptions(ROUGHSST_OPTIONS sstbcs_option) {
1141+
ROUGH_SST_ParsedOptions opts;
1142+
opts.version = sstbcs_option;
11511143

1144+
switch(sstbcs_option) {
1145+
case ROUGHSST_OPTIONS::WILCOX1998: opts.wilcox1998 = true; break;
1146+
case ROUGHSST_OPTIONS::WILCOX2006: opts.wilcox2006 = true; break;
1147+
case ROUGHSST_OPTIONS::LIMITER_KNOPP: opts.limiter_knopp = true; break;
1148+
case ROUGHSST_OPTIONS::LIMITER_AUPOIX: opts.limiter_aupoix = true; break;
1149+
default: break;
1150+
}
11521151

1153-
return ROUGHSSTParsedOptions;
1152+
return opts;
11541153
}
11551154

11561155

Common/src/CConfig.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3579,7 +3579,7 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
35793579
/*--- Postprocess SST_OPTIONS into structure. ---*/
35803580
if (Kind_Turb_Model == TURB_MODEL::SST) {
35813581
sstParsedOptions = ParseSSTOptions(SST_Options, nSST_Options, rank);
3582-
roughsstParsedOptions = ParseROUGHSSTOptions(ROUGHSST_Options, nROUGHSST_Options, rank);
3582+
roughsstParsedOptions = ParseROUGHSSTOptions(ROUGHSST_Options[0]);
35833583
} else if (Kind_Turb_Model == TURB_MODEL::SA) {
35843584
saParsedOptions = ParseSAOptions(SA_Options, nSA_Options, rank);
35853585
}

SU2_CFD/src/solvers/CTurbSSTSolver.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,8 @@ void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont
444444
su2double kPlus = FrictionVel*Roughness_Height*density/laminar_viscosity;
445445

446446
su2double S_R= 0.0;
447-
448-
su2double solution[2];
447+
su2double solution[2] = {};
448+
449449
/*--- Modify the omega and k to account for a rough wall. ---*/
450450

451451
/*--- Reference 1 original Wilcox (1998) ---*/
@@ -461,9 +461,9 @@ void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont
461461
else if (roughsstParsedOptions.wilcox2006) {
462462
/*--- Reference 2 from D.C. Wilcox Turbulence Modeling for CFD (2006) ---*/
463463
if (kPlus <= 5)
464-
S_R = (200/(kPlus+EPS))*(200/(kPlus+EPS));
464+
S_R = pow(200/(kPlus+EPS),2);
465465
else
466-
S_R = 100/(kPlus+EPS) + ((200/(kPlus+EPS))*(200/(kPlus+EPS)) - 100/(kPlus+EPS))*exp(5-kPlus);
466+
S_R = 100/(kPlus+EPS) + (pow(200/(kPlus+EPS),2) - 100/(kPlus+EPS))*exp(5-kPlus);
467467

468468
solution[0] = 0.0;
469469
solution[1] = FrictionVel*FrictionVel*S_R/(laminar_viscosity/density);
@@ -481,7 +481,7 @@ void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont
481481
/*--- Aupoix eddy viscosity limiter ---*/
482482
else if (roughsstParsedOptions.limiter_aupoix) {
483483

484-
su2double k0Plus = ( 1.0 /sqrt( constants[6])) * tanh(((log((kPlus +EPS ) / 30.0) / log(10.0)) + 1.0 - 1.0*tanh( (kPlus + EPS) / 125.0))*tanh((kPlus + EPS) / 125.0));
484+
su2double k0Plus = ( 1.0 /sqrt( constants[6])) * tanh((log10((kPlus +EPS ) / 30.0) + 1.0 - 1.0*tanh( (kPlus + EPS) / 125.0))*tanh((kPlus + EPS) / 125.0));
485485
su2double kwallPlus = max(0.0, k0Plus);
486486
su2double kwall = kwallPlus*FrictionVel*FrictionVel;
487487

0 commit comments

Comments
 (0)