Skip to content

Commit d8cfe78

Browse files
authored
Merge pull request #1404 from su2code/minor_chores
Minor chores: TURB_MODEL now enum class.
2 parents 680fb8b + b423073 commit d8cfe78

42 files changed

Lines changed: 388 additions & 384 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Common/include/CConfig.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ class CConfig {
554554
STRUCT_DEFORMATION Kind_Struct_Solver; /*!< \brief Determines the geometric condition (small or large deformations) for structural analysis. */
555555
unsigned short Kind_DV_FEA; /*!< \brief Kind of Design Variable for FEA problems.*/
556556

557-
unsigned short Kind_Turb_Model; /*!< \brief Turbulent model definition. */
557+
TURB_MODEL Kind_Turb_Model; /*!< \brief Turbulent model definition. */
558558
unsigned short Kind_SGS_Model; /*!< \brief LES SGS model definition. */
559559
unsigned short Kind_Trans_Model, /*!< \brief Transition model definition. */
560560
Kind_ActDisk, Kind_Engine_Inflow,
@@ -4162,7 +4162,7 @@ class CConfig {
41624162
* \brief Get the kind of the turbulence model.
41634163
* \return Kind of the turbulence model.
41644164
*/
4165-
unsigned short GetKind_Turb_Model(void) const { return Kind_Turb_Model; }
4165+
TURB_MODEL GetKind_Turb_Model(void) const { return Kind_Turb_Model; }
41664166

41674167
/*!
41684168
* \brief Get the kind of the transition model.

Common/include/option_structure.hpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -888,25 +888,25 @@ static const MapType<std::string, ENUM_LIMITER> Limiter_Map = {
888888
/*!
889889
* \brief Types of turbulent models
890890
*/
891-
enum ENUM_TURB_MODEL {
892-
NO_TURB_MODEL = 0, /*!< \brief No turbulence model. */
893-
SA = 1, /*!< \brief Kind of Turbulent model (Spalart-Allmaras). */
894-
SA_NEG = 2, /*!< \brief Kind of Turbulent model (Spalart-Allmaras). */
895-
SA_E = 3, /*!< \brief Kind of Turbulent model (Spalart-Allmaras Edwards). */
896-
SA_COMP = 4, /*!< \brief Kind of Turbulent model (Spalart-Allmaras Compressibility Correction). */
897-
SA_E_COMP = 5, /*!< \brief Kind of Turbulent model (Spalart-Allmaras Edwards with Compressibility Correction). */
898-
SST = 6, /*!< \brief Kind of Turbulence model (Menter SST). */
899-
SST_SUST = 7 /*!< \brief Kind of Turbulence model (Menter SST with sustaining terms for free-stream preservation). */
900-
};
901-
static const MapType<std::string, ENUM_TURB_MODEL> Turb_Model_Map = {
902-
MakePair("NONE", NO_TURB_MODEL)
903-
MakePair("SA", SA)
904-
MakePair("SA_NEG", SA_NEG)
905-
MakePair("SA_E", SA_E)
906-
MakePair("SA_COMP", SA_COMP)
907-
MakePair("SA_E_COMP", SA_E_COMP)
908-
MakePair("SST", SST)
909-
MakePair("SST_SUST", SST_SUST)
891+
enum class TURB_MODEL {
892+
NONE, /*!< \brief No turbulence model. */
893+
SA, /*!< \brief Kind of Turbulent model (Spalart-Allmaras). */
894+
SA_NEG, /*!< \brief Kind of Turbulent model (Spalart-Allmaras). */
895+
SA_E, /*!< \brief Kind of Turbulent model (Spalart-Allmaras Edwards). */
896+
SA_COMP, /*!< \brief Kind of Turbulent model (Spalart-Allmaras Compressibility Correction). */
897+
SA_E_COMP, /*!< \brief Kind of Turbulent model (Spalart-Allmaras Edwards with Compressibility Correction). */
898+
SST, /*!< \brief Kind of Turbulence model (Menter SST). */
899+
SST_SUST /*!< \brief Kind of Turbulence model (Menter SST with sustaining terms for free-stream preservation). */
900+
};
901+
static const MapType<std::string, TURB_MODEL> Turb_Model_Map = {
902+
MakePair("NONE", TURB_MODEL::NONE)
903+
MakePair("SA", TURB_MODEL::SA)
904+
MakePair("SA_NEG", TURB_MODEL::SA_NEG)
905+
MakePair("SA_E", TURB_MODEL::SA_E)
906+
MakePair("SA_COMP", TURB_MODEL::SA_COMP)
907+
MakePair("SA_E_COMP", TURB_MODEL::SA_E_COMP)
908+
MakePair("SST", TURB_MODEL::SST)
909+
MakePair("SST_SUST", TURB_MODEL::SST_SUST)
910910
};
911911

912912
/*!

Common/include/option_structure.inl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,7 +1889,7 @@ public:
18891889
this->doubleInfo[i] = new su2double[1];
18901890

18911891
/* Check for a valid RANS turbulence model. */
1892-
map<string, ENUM_TURB_MODEL>::const_iterator iit;
1892+
map<string, TURB_MODEL>::const_iterator iit;
18931893
iit = Turb_Model_Map.find(option_value[counter++]);
18941894
if(iit == Turb_Model_Map.end()) {
18951895
string newstring;
@@ -1904,8 +1904,6 @@ public:
19041904
return newstring;
19051905
}
19061906

1907-
this->intInfo[i][0] = iit->second;
1908-
19091907
/* Extract the exchange distance. */
19101908
istringstream ss_1st(option_value[counter++]);
19111909
if (!(ss_1st >> this->doubleInfo[i][0])) {

Common/src/CConfig.cpp

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ void CConfig::SetConfig_Options() {
10761076
/*!\brief MATH_PROBLEM \n DESCRIPTION: Mathematical problem \n Options: DIRECT, ADJOINT \ingroup Config*/
10771077
addMathProblemOption("MATH_PROBLEM", ContinuousAdjoint, false, DiscreteAdjoint, discAdjDefault, Restart_Flow, discAdjDefault);
10781078
/*!\brief KIND_TURB_MODEL \n DESCRIPTION: Specify turbulence model \n Options: see \link Turb_Model_Map \endlink \n DEFAULT: NO_TURB_MODEL \ingroup Config*/
1079-
addEnumOption("KIND_TURB_MODEL", Kind_Turb_Model, Turb_Model_Map, NO_TURB_MODEL);
1079+
addEnumOption("KIND_TURB_MODEL", Kind_Turb_Model, Turb_Model_Map, TURB_MODEL::NONE);
10801080
/*!\brief KIND_TRANS_MODEL \n DESCRIPTION: Specify transition model OPTIONS: see \link Trans_Model_Map \endlink \n DEFAULT: NO_TRANS_MODEL \ingroup Config*/
10811081
addEnumOption("KIND_TRANS_MODEL", Kind_Trans_Model, Trans_Model_Map, NO_TRANS_MODEL);
10821082

@@ -3273,16 +3273,16 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
32733273
}
32743274
}
32753275

3276-
if (Kind_Solver == NAVIER_STOKES && Kind_Turb_Model != NONE){
3276+
if (Kind_Solver == NAVIER_STOKES && Kind_Turb_Model != TURB_MODEL::NONE){
32773277
SU2_MPI::Error("KIND_TURB_MODEL must be NONE if SOLVER= NAVIER_STOKES", CURRENT_FUNCTION);
32783278
}
3279-
if (Kind_Solver == INC_NAVIER_STOKES && Kind_Turb_Model != NONE){
3279+
if (Kind_Solver == INC_NAVIER_STOKES && Kind_Turb_Model != TURB_MODEL::NONE){
32803280
SU2_MPI::Error("KIND_TURB_MODEL must be NONE if SOLVER= INC_NAVIER_STOKES", CURRENT_FUNCTION);
32813281
}
3282-
if (Kind_Solver == RANS && Kind_Turb_Model == NONE){
3282+
if (Kind_Solver == RANS && Kind_Turb_Model == TURB_MODEL::NONE){
32833283
SU2_MPI::Error("A turbulence model must be specified with KIND_TURB_MODEL if SOLVER= RANS", CURRENT_FUNCTION);
32843284
}
3285-
if (Kind_Solver == INC_RANS && Kind_Turb_Model == NONE){
3285+
if (Kind_Solver == INC_RANS && Kind_Turb_Model == TURB_MODEL::NONE){
32863286
SU2_MPI::Error("A turbulence model must be specified with KIND_TURB_MODEL if SOLVER= INC_RANS", CURRENT_FUNCTION);
32873287
}
32883288

@@ -4043,18 +4043,18 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
40434043
if (MGCycle == FULLMG_CYCLE) FinestMesh = nMGLevels;
40444044

40454045
if ((Kind_Solver == NAVIER_STOKES) &&
4046-
(Kind_Turb_Model != NONE))
4046+
(Kind_Turb_Model != TURB_MODEL::NONE))
40474047
Kind_Solver = RANS;
40484048

40494049
if ((Kind_Solver == INC_NAVIER_STOKES) &&
4050-
(Kind_Turb_Model != NONE))
4050+
(Kind_Turb_Model != TURB_MODEL::NONE))
40514051
Kind_Solver = INC_RANS;
40524052

40534053
if (Kind_Solver == EULER ||
40544054
Kind_Solver == INC_EULER ||
40554055
Kind_Solver == NEMO_EULER ||
40564056
Kind_Solver == FEM_EULER)
4057-
Kind_Turb_Model = NONE;
4057+
Kind_Turb_Model = TURB_MODEL::NONE;
40584058

40594059
Kappa_2nd_Flow = jst_coeff[0];
40604060
Kappa_4th_Flow = jst_coeff[1];
@@ -4435,7 +4435,7 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
44354435
for (int i=0; i<7; ++i) eng_cyl[i] /= 12.0;
44364436
}
44374437

4438-
if ((Kind_Turb_Model != SA) && (Kind_Trans_Model == BC)){
4438+
if ((Kind_Turb_Model != TURB_MODEL::SA) && (Kind_Trans_Model == BC)){
44394439
SU2_MPI::Error("BC transition model currently only available in combination with SA turbulence model!", CURRENT_FUNCTION);
44404440
}
44414441

@@ -4533,7 +4533,7 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
45334533

45344534
/* --- Throw error if UQ used for any turbulence model other that SST --- */
45354535

4536-
if (Kind_Solver == RANS && Kind_Turb_Model != SST && Kind_Turb_Model != SST_SUST && using_uq){
4536+
if (Kind_Solver == RANS && Kind_Turb_Model != TURB_MODEL::SST && Kind_Turb_Model != TURB_MODEL::SST_SUST && using_uq){
45374537
SU2_MPI::Error("UQ capabilities only implemented for NAVIER_STOKES solver SST turbulence model", CURRENT_FUNCTION);
45384538
}
45394539

@@ -5620,13 +5620,14 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
56205620
if (Kind_Regime == ENUM_REGIME::INCOMPRESSIBLE) cout << "Incompressible RANS equations." << endl;
56215621
cout << "Turbulence model: ";
56225622
switch (Kind_Turb_Model) {
5623-
case SA: cout << "Spalart Allmaras" << endl; break;
5624-
case SA_NEG: cout << "Negative Spalart Allmaras" << endl; break;
5625-
case SA_E: cout << "Edwards Spalart Allmaras" << endl; break;
5626-
case SA_COMP: cout << "Compressibility Correction Spalart Allmaras" << endl; break;
5627-
case SA_E_COMP: cout << "Compressibility Correction Edwards Spalart Allmaras" << endl; break;
5628-
case SST: cout << "Menter's SST" << endl; break;
5629-
case SST_SUST: cout << "Menter's SST with sustaining terms" << endl; break;
5623+
case TURB_MODEL::NONE: break;
5624+
case TURB_MODEL::SA: cout << "Spalart Allmaras" << endl; break;
5625+
case TURB_MODEL::SA_NEG: cout << "Negative Spalart Allmaras" << endl; break;
5626+
case TURB_MODEL::SA_E: cout << "Edwards Spalart Allmaras" << endl; break;
5627+
case TURB_MODEL::SA_COMP: cout << "Compressibility Correction Spalart Allmaras" << endl; break;
5628+
case TURB_MODEL::SA_E_COMP: cout << "Compressibility Correction Edwards Spalart Allmaras" << endl; break;
5629+
case TURB_MODEL::SST: cout << "Menter's SST" << endl; break;
5630+
case TURB_MODEL::SST_SUST: cout << "Menter's SST with sustaining terms" << endl; break;
56305631
}
56315632
if (QCR) cout << "Using Quadratic Constitutive Relation, 2000 version (QCR2000)" << endl;
56325633
if (Kind_Trans_Model == BC) cout << "Using the revised BC transition model (2020)" << endl;

SU2_CFD/include/output/CAdjFlowCompOutput.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CAdjFlowCompOutput final: public COutput {
3939

4040
bool cont_adj; /*!< \brief Boolean indicating whether we run a cont. adjoint problem */
4141
bool frozen_visc; /*!< \brief Boolean indicating whether frozen viscosity/turbulence is used. */
42-
unsigned short turb_model; /*!< \brief The kind of turbulence model*/
42+
TURB_MODEL turb_model; /*!< \brief The kind of turbulence model*/
4343

4444
public:
4545

SU2_CFD/include/output/CAdjFlowIncOutput.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
class CAdjFlowIncOutput final: public COutput {
3838
private:
3939

40-
unsigned short turb_model; /*!< \brief The kind of turbulence model*/
40+
TURB_MODEL turb_model; /*!< \brief The kind of turbulence model*/
4141
RADIATION_MODEL rad_model; /*!< \brief The kind of radiation model */
4242
bool heat; /*!< \brief Boolean indicating whether have a heat problem*/
4343
bool weakly_coupled_heat; /*!< \brief Boolean indicating whether have a weakly coupled heat equation*/

SU2_CFD/include/output/CFlowCompFEMOutput.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CVariable;
3939
class CFlowCompFEMOutput final: public CFlowOutput {
4040
private:
4141

42-
unsigned short turb_model; //!< Kind of turbulence model
42+
TURB_MODEL turb_model; //!< Kind of turbulence model
4343

4444
public:
4545

SU2_CFD/include/output/CFlowCompOutput.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CVariable;
3939
class CFlowCompOutput final: public CFlowOutput {
4040
private:
4141

42-
unsigned short turb_model; //!< Kind of turbulence model
42+
TURB_MODEL turb_model; //!< Kind of turbulence model
4343

4444
public:
4545

SU2_CFD/include/output/CFlowIncOutput.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CVariable;
3939
class CFlowIncOutput final: public CFlowOutput {
4040
private:
4141

42-
unsigned short turb_model; /*!< \brief The kind of turbulence model*/
42+
TURB_MODEL turb_model; /*!< \brief The kind of turbulence model*/
4343
bool heat; /*!< \brief Boolean indicating whether have a heat problem*/
4444
bool weakly_coupled_heat; /*!< \brief Boolean indicating whether have a weakly coupled heat equation*/
4545
unsigned short streamwisePeriodic; /*!< \brief Boolean indicating whether it is a streamwise periodic simulation. */

SU2_CFD/include/output/CNEMOCompOutput.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class CVariable;
3838
class CNEMOCompOutput final: public CFlowOutput {
3939
private:
4040

41-
unsigned short turb_model, /*!< \brief Kind of turbulence model */
42-
iSpecies, /*!< \brief Species index */
43-
nSpecies; /*!< \brief Number of species */
41+
TURB_MODEL turb_model; /*!< \brief Kind of turbulence model */
42+
unsigned short iSpecies, /*!< \brief Species index */
43+
nSpecies; /*!< \brief Number of species */
4444
public:
4545

4646
/*!

0 commit comments

Comments
 (0)