Skip to content

Commit fa96e09

Browse files
authored
Merge pull request #2670 from su2code/pedro/smooth_the_roughness
smooth the SST roughness implementation
2 parents 5efe817 + 945c18b commit fa96e09

File tree

6 files changed

+62
-104
lines changed

6 files changed

+62
-104
lines changed

Common/include/CConfig.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,6 @@ class CConfig {
12271227
SST_ParsedOptions sstParsedOptions; /*!< \brief Additional parameters for the SST turbulence model. */
12281228
SA_ParsedOptions saParsedOptions; /*!< \brief Additional parameters for the SA turbulence model. */
12291229
LM_ParsedOptions lmParsedOptions; /*!< \brief Additional parameters for the LM transition model. */
1230-
ROUGH_SST_ParsedOptions roughsstParsedOptions; /*!< \brief Additional parameters for the boundary conditions for rough walls for the SST turbulence model. */
12311230
su2double uq_delta_b; /*!< \brief Parameter used to perturb eigenvalues of Reynolds Stress Matrix */
12321231
unsigned short eig_val_comp; /*!< \brief Parameter used to determine type of eigenvalue perturbation */
12331232
su2double uq_urlx; /*!< \brief Under-relaxation factor */
@@ -10176,10 +10175,9 @@ class CConfig {
1017610175
LM_ParsedOptions GetLMParsedOptions() const { return lmParsedOptions; }
1017710176

1017810177
/*!
10179-
* \brief Get parsed rough-wall boundary conditions for SST option data structure.
10180-
* \return Rough-wall SST option data structure.
10178+
* \brief Get rough-wall boundary conditions for SST.
1018110179
*/
10182-
ROUGH_SST_ParsedOptions GetROUGHSSTParsedOptions() const { return roughsstParsedOptions; }
10180+
ROUGHSST_MODEL GetKindRoughSSTModel() const { return Kind_RoughSST_Model; }
1018310181

1018410182
/*!
1018510183
* \brief Get parsed option data structure for data-driven fluid model.

Common/include/option_structure.hpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,54 +1105,18 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne
11051105
* \brief SST rough-wall boundary conditions Options
11061106
*/
11071107
enum class ROUGHSST_MODEL {
1108-
NONE, /*!< \brief No option / default no surface roughness applied. */
11091108
WILCOX1998, /*!< \brief Wilcox 1998 boundary conditions for rough walls. */
11101109
WILCOX2006, /*!< \brief Wilcox 2006 boundary conditions for rough walls / default version if roughness is applied. */
11111110
LIMITER_KNOPP, /*!< \brief Knopp eddy viscosity limiter. */
11121111
LIMITER_AUPOIX, /*!< \brief Aupoix eddy viscosity limiter. */
11131112
};
11141113
static const MapType<std::string, ROUGHSST_MODEL> RoughSST_Model_Map = {
1115-
MakePair("NONE", ROUGHSST_MODEL::NONE)
11161114
MakePair("WILCOX1998", ROUGHSST_MODEL::WILCOX1998)
11171115
MakePair("WILCOX2006", ROUGHSST_MODEL::WILCOX2006)
11181116
MakePair("LIMITER_KNOPP", ROUGHSST_MODEL::LIMITER_KNOPP)
11191117
MakePair("LIMITER_AUPOIX", ROUGHSST_MODEL::LIMITER_AUPOIX)
11201118
};
11211119

1122-
/*!
1123-
* \brief Structure containing parsed SST rough-wall boundary conditions options.
1124-
*/
1125-
struct ROUGH_SST_ParsedOptions {
1126-
ROUGHSST_MODEL version = ROUGHSST_MODEL::NONE; /*!< \brief KWBC base model. */
1127-
bool wilcox1998 = false; /*!< \brief Use Wilcox boundary conditions for rough walls (1998). */
1128-
bool wilcox2006 = false; /*!< \brief Use Wilcox boundary conditions for rough walls (2006). */
1129-
bool limiter_knopp = false; /*!< \brief Use Knopp eddy viscosity limiter. */
1130-
bool limiter_aupoix = false; /*!< \brief Use Aupoix eddy viscosity limiter. */
1131-
};
1132-
1133-
/*!
1134-
* \brief Function to parse SST rough-wall boundary conditions options.
1135-
* \param[in] ROUGHSST_Options - Selected SST rough-wall boundary conditions option from config.
1136-
* \param[in] nROUGHSST_Options - Number of options selected.
1137-
* \param[in] rank - MPI rank.
1138-
* \return Struct with SST options.
1139-
*/
1140-
inline ROUGH_SST_ParsedOptions ParseROUGHSSTOptions(ROUGHSST_MODEL sstbcs_option) {
1141-
ROUGH_SST_ParsedOptions opts;
1142-
opts.version = sstbcs_option;
1143-
1144-
switch(sstbcs_option) {
1145-
case ROUGHSST_MODEL::WILCOX1998: opts.wilcox1998 = true; break;
1146-
case ROUGHSST_MODEL::WILCOX2006: opts.wilcox2006 = true; break;
1147-
case ROUGHSST_MODEL::LIMITER_KNOPP: opts.limiter_knopp = true; break;
1148-
case ROUGHSST_MODEL::LIMITER_AUPOIX: opts.limiter_aupoix = true; break;
1149-
default: break;
1150-
}
1151-
1152-
return opts;
1153-
}
1154-
1155-
11561120
/*!
11571121
* \brief SA Options
11581122
*/

Common/src/CConfig.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ void CConfig::SetConfig_Options() {
11411141
addEnumListOption("SA_OPTIONS", nSA_Options, SA_Options, SA_Options_Map);
11421142

11431143
/*!\brief ROUGHSST_OPTIONS \n DESCRIPTION: Specify type of boundary condition for rough walls for SST turbulence model. \n Options: see \link ROUGHSST_Options_Map \endlink \n DEFAULT: wilcox1998 \ingroup Config*/
1144-
addEnumOption("KIND_ROUGHSST_MODEL", Kind_RoughSST_Model, RoughSST_Model_Map, ROUGHSST_MODEL::NONE);
1144+
addEnumOption("KIND_ROUGHSST_MODEL", Kind_RoughSST_Model, RoughSST_Model_Map, ROUGHSST_MODEL::WILCOX1998);
11451145
/*!\brief KIND_TRANS_MODEL \n DESCRIPTION: Specify transition model OPTIONS: see \link Trans_Model_Map \endlink \n DEFAULT: NONE \ingroup Config*/
11461146
addEnumOption("KIND_TRANS_MODEL", Kind_Trans_Model, Trans_Model_Map, TURB_TRANS_MODEL::NONE);
11471147
/*!\brief SST_OPTIONS \n DESCRIPTION: Specify LM transition model options/correlations. \n Options: see \link LM_Options_Map \endlink \n DEFAULT: NONE \ingroup Config*/
@@ -3600,7 +3600,6 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
36003600
/*--- Postprocess SST_OPTIONS into structure. ---*/
36013601
if (Kind_Turb_Model == TURB_MODEL::SST) {
36023602
sstParsedOptions = ParseSSTOptions(SST_Options, nSST_Options, rank);
3603-
roughsstParsedOptions = ParseROUGHSSTOptions(Kind_RoughSST_Model);
36043603
} else if (Kind_Turb_Model == TURB_MODEL::SA) {
36053604
saParsedOptions = ParseSAOptions(SA_Options, nSA_Options, rank);
36063605
}

SU2_CFD/include/solvers/CTurbSSTSolver.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class CTurbSSTSolver final : public CTurbSolver {
3939
private:
4040
su2double constants[11] = {0.0}; /*!< \brief Constants for the model. */
4141
SST_ParsedOptions sstParsedOptions;
42-
ROUGH_SST_ParsedOptions roughsstParsedOptions;
4342

4443
/*!
4544
* \brief Compute nu tilde from the wall functions.
@@ -54,13 +53,13 @@ class CTurbSSTSolver final : public CTurbSolver {
5453
CSolver **solver_container,
5554
const CConfig *config,
5655
unsigned short val_marker);
57-
56+
5857
/*!
5958
* \brief Compute a suitable under-relaxation parameter to limit the change in the solution variables over
6059
* a nonlinear iteration for stability.
6160
* \param[in] config - Definition of the particular problem.
6261
*/
63-
void ComputeUnderRelaxationFactor(const CConfig *config);
62+
void ComputeUnderRelaxationFactor(const CConfig *config) override;
6463

6564
public:
6665
/*!

SU2_CFD/src/solvers/CTurbSSTSolver.cpp

Lines changed: 54 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -405,11 +405,10 @@ void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont
405405

406406
const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
407407

408-
bool rough_wall = false;
409408
string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
410409
WALL_TYPE WallType; su2double Roughness_Height;
411410
tie(WallType, Roughness_Height) = config->GetWallRoughnessProperties(Marker_Tag);
412-
if (WallType == WALL_TYPE::ROUGH) rough_wall = true;
411+
const bool rough_wall = WallType == WALL_TYPE::ROUGH && Roughness_Height > 0;
413412

414413
/*--- Evaluate nu tilde at the closest point to the surface using the wall functions. ---*/
415414

@@ -424,94 +423,90 @@ void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont
424423
const auto iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
425424

426425
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
427-
if (geometry->nodes->GetDomain(iPoint)) {
428-
const auto options = config->GetROUGHSSTParsedOptions();
426+
if (!geometry->nodes->GetDomain(iPoint)) continue;
427+
428+
/*--- distance to closest neighbor ---*/
429+
su2double wall_dist = geometry->vertex[val_marker][iVertex]->GetNearestNeighborDistance();
429430

430-
/*--- distance to closest neighbor ---*/
431-
su2double wall_dist = geometry->vertex[val_marker][iVertex]->GetNearestNeighborDistance();
431+
su2double solution[MAXNVAR];
432432

433-
if (rough_wall) {
434-
/*--- Set wall values ---*/
435-
su2double density = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint);
436-
su2double laminar_viscosity = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint);
437-
su2double WallShearStress = solver_container[FLOW_SOL]->GetWallShearStress(val_marker, iVertex);
433+
if (rough_wall) {
434+
/*--- Set wall values ---*/
435+
su2double density = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint);
436+
su2double laminar_viscosity = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint);
437+
su2double WallShearStress = solver_container[FLOW_SOL]->GetWallShearStress(val_marker, iVertex);
438438

439-
/*--- Compute non-dimensional velocity ---*/
440-
su2double FrictionVel = sqrt(fabs(WallShearStress)/density);
439+
/*--- Compute non-dimensional velocity ---*/
440+
su2double FrictionVel = sqrt(fabs(WallShearStress)/density);
441441

442-
/*--- Compute roughness in wall units. ---*/
443-
//su2double Roughness_Height = config->GetWall_RoughnessHeight(Marker_Tag);
444-
su2double kPlus = FrictionVel*Roughness_Height*density/laminar_viscosity;
442+
/*--- Compute roughness in wall units. ---*/
443+
su2double kPlus = FrictionVel*Roughness_Height*density/laminar_viscosity;
445444

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

450-
/*--- Reference 1 original Wilcox (1998) ---*/
451-
if (options.wilcox1998) {
447+
switch (config->GetKindRoughSSTModel()) {
448+
/*--- Reference 1 original Wilcox (1998). ---*/
449+
case ROUGHSST_MODEL::WILCOX1998: {
450+
su2double S_R = 0.0;
452451
if (kPlus <= 25)
453-
S_R = (50/(kPlus+EPS))*(50/(kPlus+EPS));
452+
S_R = pow(50/(kPlus+EPS), 2);
454453
else
455-
S_R = 100/(kPlus+EPS);
456-
454+
S_R = 100/(kPlus+EPS);
455+
457456
solution[0] = 0.0;
458-
solution[1] = FrictionVel*FrictionVel*S_R/(laminar_viscosity/density);
459-
}
460-
else if (options.wilcox2006) {
457+
solution[1] = FrictionVel*FrictionVel*S_R/(laminar_viscosity/density);
458+
} break;
461459
/*--- Reference 2 from D.C. Wilcox Turbulence Modeling for CFD (2006) ---*/
460+
case ROUGHSST_MODEL::WILCOX2006: {
461+
su2double S_R = 0.0;
462462
if (kPlus <= 5)
463463
S_R = pow(200/(kPlus+EPS),2);
464464
else
465465
S_R = 100/(kPlus+EPS) + (pow(200/(kPlus+EPS),2) - 100/(kPlus+EPS))*exp(5-kPlus);
466-
466+
467467
solution[0] = 0.0;
468468
solution[1] = FrictionVel*FrictionVel*S_R/(laminar_viscosity/density);
469-
}
469+
} break;
470470
/*--- Knopp eddy viscosity limiter ---*/
471-
else if (options.limiter_knopp) {
471+
case ROUGHSST_MODEL::LIMITER_KNOPP: {
472472
su2double d0 = 0.03*Roughness_Height*min(1.0, pow((kPlus + EPS )/30.0, 2.0/3.0))*min(1.0, pow((kPlus + EPS)/45.0, 0.25))*min(1.0, pow((kPlus + EPS) /60, 0.25));
473473
solution[0] = (FrictionVel*FrictionVel / sqrt(constants[6]))*min(1.0, kPlus / 90.0);
474474

475475
const su2double kappa = config->GetwallModel_Kappa();
476476
su2double beta_1 = constants[4];
477-
solution[1] = min( FrictionVel/(sqrt(constants[6])*d0*kappa), 60.0*laminar_viscosity/(density*beta_1*pow(wall_dist,2)));
478-
}
479-
/*--- Aupoix eddy viscosity limiter ---*/
480-
else if (options.limiter_aupoix) {
477+
solution[1] = min( FrictionVel/(sqrt(constants[6])*d0*kappa), 60.0*laminar_viscosity/(density*beta_1*pow(wall_dist,2)));
478+
} break;
479+
/*--- Aupoix eddy viscosity limiter ---*/
480+
case (ROUGHSST_MODEL::LIMITER_AUPOIX): {
481481
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));
482482
su2double kwallPlus = max(0.0, k0Plus);
483483
su2double kwall = kwallPlus*FrictionVel*FrictionVel;
484-
484+
485485
su2double omegawallPlus = (300.0 / pow(kPlus + EPS, 2.0)) * pow(tanh(15.0 / (4.0*kPlus)), -1.0) + (191.0 / (kPlus + EPS))*(1.0 - exp(-kPlus / 250.0));
486486

487487
solution[0] = kwall;
488488
solution[1] = omegawallPlus*FrictionVel*FrictionVel*density/laminar_viscosity;
489-
}
490-
/*--- Set the solution values and zero the residual ---*/
491-
nodes->SetSolution_Old(iPoint,solution);
492-
nodes->SetSolution(iPoint,solution);
493-
LinSysRes.SetBlock_Zero(iPoint);
494-
} else { // smooth wall
495-
/*--- Set wall values ---*/
496-
su2double density = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint);
497-
su2double laminar_viscosity = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint);
498-
499-
su2double beta_1 = constants[4];
500-
su2double solution[MAXNVAR];
501-
solution[0] = 0.0;
502-
solution[1] = 60.0*laminar_viscosity/(density*beta_1*pow(wall_dist,2));
503-
504-
/*--- Set the solution values and zero the residual ---*/
505-
nodes->SetSolution_Old(iPoint,solution);
506-
nodes->SetSolution(iPoint,solution);
507-
LinSysRes.SetBlock_Zero(iPoint);
489+
} break;
508490
}
491+
} else { // smooth wall
492+
/*--- Set wall values ---*/
493+
su2double density = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint);
494+
su2double laminar_viscosity = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint);
495+
496+
su2double beta_1 = constants[4];
497+
solution[0] = 0.0;
498+
solution[1] = 60.0*laminar_viscosity/(density*beta_1*pow(wall_dist,2));
499+
}
509500

510-
if (implicit) {
511-
/*--- Change rows of the Jacobian (includes 1 in the diagonal) ---*/
512-
Jacobian.DeleteValsRowi(iPoint*nVar);
513-
Jacobian.DeleteValsRowi(iPoint*nVar+1);
514-
}
501+
/*--- Set the solution values and zero the residual ---*/
502+
nodes->SetSolution_Old(iPoint, solution);
503+
nodes->SetSolution(iPoint, solution);
504+
LinSysRes.SetBlock_Zero(iPoint);
505+
506+
if (implicit) {
507+
/*--- Change rows of the Jacobian (includes 1 in the diagonal) ---*/
508+
Jacobian.DeleteValsRowi(iPoint*nVar);
509+
Jacobian.DeleteValsRowi(iPoint*nVar+1);
515510
}
516511
}
517512
END_SU2_OMP_FOR

config_template.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,9 @@ MARKER_DISPLACEMENT= ( NONE )
13621362
% This is a list of (string, double) each element corresponding to the MARKER defined in WALL_TYPE.
13631363
WALL_ROUGHNESS = (wall1, ks1, wall2, ks2)
13641364
%WALL_ROUGHNESS = (wall1, ks1, wall2, 0.0) %is also allowed
1365+
%
1366+
% Roughness model used for SST (WILCOX1998, WILCOX2006, LIMITER_KNOPP, LIMITER_AUPOIX).
1367+
KIND_ROUGHSST_MODEL = WILCOX1998
13651368

13661369
% ------------------------ WALL FUNCTION DEFINITION --------------------------%
13671370
%

0 commit comments

Comments
 (0)