Skip to content

Commit ead83fe

Browse files
authored
Merge pull request #1646 from su2code/sa_options
New SA version/correction combinations and new way of specifying them in the config (SA_OPTIONS=...)
2 parents 0e7844e + 3fa7b8a commit ead83fe

27 files changed

+383
-344
lines changed

Common/include/CConfig.hpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -699,10 +699,12 @@ class CConfig {
699699
*Marker_WallFunctions, /*!< \brief Markers for which wall functions must be applied. */
700700
*Marker_SobolevBC; /*!< \brief Markers in the gradient solver */
701701

702-
unsigned short nConfig_Files; /*!< \brief Number of config files for multiphysics problems. */
703-
string *Config_Filenames; /*!< \brief List of names for configuration files. */
704-
SST_OPTIONS *SST_Options; /*!< \brief List of modifications/corrections/versions of SST turbulence model.*/
705-
unsigned short nSST_Options; /*!< \brief number of SST options specified. */
702+
unsigned short nConfig_Files; /*!< \brief Number of config files for multiphysics problems. */
703+
string *Config_Filenames; /*!< \brief List of names for configuration files. */
704+
SST_OPTIONS *SST_Options; /*!< \brief List of modifications/corrections/versions of SST turbulence model.*/
705+
SA_OPTIONS *SA_Options; /*!< \brief List of modifications/corrections/versions of SA turbulence model.*/
706+
unsigned short nSST_Options; /*!< \brief Number of SST options specified. */
707+
unsigned short nSA_Options; /*!< \brief Number of SA options specified. */
706708
WALL_FUNCTIONS *Kind_WallFunctions; /*!< \brief The kind of wall function to use for the corresponding markers. */
707709
unsigned short **IntInfo_WallFunctions; /*!< \brief Additional integer information for the wall function markers. */
708710
su2double **DoubleInfo_WallFunctions; /*!< \brief Additional double information for the wall function markers. */
@@ -1015,7 +1017,6 @@ class CConfig {
10151017
WINDOW_FUNCTION Kind_WindowFct; /*!< \brief Type of window (weight) function for objective functional. */
10161018
unsigned short Kind_HybridRANSLES; /*!< \brief Kind of Hybrid RANS/LES. */
10171019
unsigned short Kind_RoeLowDiss; /*!< \brief Kind of Roe scheme with low dissipation for unsteady flows. */
1018-
bool QCR; /*!< \brief Spalart-Allmaras with Quadratic Constitutive Relation, 2000 version (SA-QCR2000) . */
10191020

10201021
unsigned short nSpanWiseSections; /*!< \brief number of span-wise sections */
10211022
unsigned short nSpanMaxAllZones; /*!< \brief number of maximum span-wise sections for all zones */
@@ -1137,7 +1138,8 @@ class CConfig {
11371138
unsigned short nScreenOutput, /*!< \brief Number of screen output variables (max: 6). */
11381139
nHistoryOutput, nVolumeOutput; /*!< \brief Number of variables printed to the history file. */
11391140
bool Multizone_Residual; /*!< \brief Determines if memory should be allocated for the multizone residual. */
1140-
SST_ParsedOptions sstParsedOptions; /*!< \brief additional parameters for the SST turbulence model */
1141+
SST_ParsedOptions sstParsedOptions; /*!< \brief Additional parameters for the SST turbulence model. */
1142+
SA_ParsedOptions saParsedOptions; /*!< \brief Additional parameters for the SA turbulence model. */
11411143
su2double uq_delta_b; /*!< \brief Parameter used to perturb eigenvalues of Reynolds Stress Matrix */
11421144
unsigned short eig_val_comp; /*!< \brief Parameter used to determine type of eigenvalue perturbation */
11431145
su2double uq_urlx; /*!< \brief Under-relaxation factor */
@@ -9058,11 +9060,6 @@ class CConfig {
90589060
*/
90599061
su2double GetConst_DES(void) const { return Const_DES; }
90609062

9061-
/*!
9062-
* \brief Get QCR (SA-QCR2000).
9063-
*/
9064-
bool GetQCR(void) const { return QCR;}
9065-
90669063
/*!
90679064
* \brief Get if AD preaccumulation should be performed.
90689065
*/
@@ -9629,4 +9626,10 @@ class CConfig {
96299626
*/
96309627
SST_ParsedOptions GetSSTParsedOptions() const { return sstParsedOptions; }
96319628

9629+
/*!
9630+
* \brief Get parsed SA option data structure.
9631+
* \return SA option data structure.
9632+
*/
9633+
SA_ParsedOptions GetSAParsedOptions() const { return saParsedOptions; }
9634+
96329635
};

Common/include/option_structure.hpp

Lines changed: 100 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -912,19 +912,11 @@ static const MapType<std::string, LIMITER> Limiter_Map = {
912912
enum class TURB_MODEL {
913913
NONE, /*!< \brief No turbulence model. */
914914
SA, /*!< \brief Kind of Turbulent model (Spalart-Allmaras). */
915-
SA_NEG, /*!< \brief Kind of Turbulent model (Negative Spalart-Allmaras). */
916-
SA_E, /*!< \brief Kind of Turbulent model (Spalart-Allmaras Edwards). */
917-
SA_COMP, /*!< \brief Kind of Turbulent model (Spalart-Allmaras Compressibility Correction). */
918-
SA_E_COMP, /*!< \brief Kind of Turbulent model (Spalart-Allmaras Edwards with Compressibility Correction). */
919915
SST, /*!< \brief Kind of Turbulence model (Menter SST). */
920916
};
921917
static const MapType<std::string, TURB_MODEL> Turb_Model_Map = {
922918
MakePair("NONE", TURB_MODEL::NONE)
923919
MakePair("SA", TURB_MODEL::SA)
924-
MakePair("SA_NEG", TURB_MODEL::SA_NEG)
925-
MakePair("SA_E", TURB_MODEL::SA_E)
926-
MakePair("SA_COMP", TURB_MODEL::SA_COMP)
927-
MakePair("SA_E_COMP", TURB_MODEL::SA_E_COMP)
928920
MakePair("SST", TURB_MODEL::SST)
929921
};
930922

@@ -944,10 +936,6 @@ inline TURB_FAMILY TurbModelFamily(TURB_MODEL model) {
944936
case TURB_MODEL::NONE:
945937
return TURB_FAMILY::NONE;
946938
case TURB_MODEL::SA:
947-
case TURB_MODEL::SA_NEG:
948-
case TURB_MODEL::SA_E:
949-
case TURB_MODEL::SA_COMP:
950-
case TURB_MODEL::SA_E_COMP:
951939
return TURB_FAMILY::SA;
952940
case TURB_MODEL::SST:
953941
return TURB_FAMILY::KW;
@@ -998,6 +986,7 @@ struct SST_ParsedOptions {
998986
* \param[in] SST_Options - Selected SST option from config.
999987
* \param[in] nSST_Options - Number of options selected.
1000988
* \param[in] rank - MPI rank.
989+
* \return Struct with SST options.
1001990
*/
1002991
inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigned short nSST_Options, int rank) {
1003992
SST_ParsedOptions SSTParsedOptions;
@@ -1056,18 +1045,115 @@ inline SST_ParsedOptions ParseSSTOptions(const SST_OPTIONS *SST_Options, unsigne
10561045
return SSTParsedOptions;
10571046
}
10581047

1048+
/*!
1049+
* \brief SA Options
1050+
*/
1051+
enum class SA_OPTIONS {
1052+
NONE, /*!< \brief No option / default. */
1053+
NEG, /*!< \brief Negative SA. */
1054+
EDW, /*!< \brief Edwards version. */
1055+
FT2, /*!< \brief Use FT2 term. */
1056+
QCR2000, /*!< \brief Quadratic constitutive relation. */
1057+
COMP, /*!< \brief Compressibility correction. */
1058+
ROT, /*!< \brief Rotation correction. */
1059+
BC, /*!< \brief Bas-Cakmakcioclu transition. */
1060+
EXP, /*!< \brief Allow experimental combinations of options (according to TMR). */
1061+
};
1062+
static const MapType<std::string, SA_OPTIONS> SA_Options_Map = {
1063+
MakePair("NONE", SA_OPTIONS::NONE)
1064+
MakePair("NEGATIVE", SA_OPTIONS::NEG)
1065+
MakePair("EDWARDS", SA_OPTIONS::EDW)
1066+
MakePair("WITHFT2", SA_OPTIONS::FT2)
1067+
MakePair("QCR2000", SA_OPTIONS::QCR2000)
1068+
MakePair("COMPRESSIBILITY", SA_OPTIONS::COMP)
1069+
MakePair("ROTATION", SA_OPTIONS::ROT)
1070+
MakePair("BCM", SA_OPTIONS::BC)
1071+
MakePair("EXPERIMENTAL", SA_OPTIONS::EXP)
1072+
};
1073+
1074+
/*!
1075+
* \brief Structure containing parsed SA options.
1076+
*/
1077+
struct SA_ParsedOptions {
1078+
SA_OPTIONS version = SA_OPTIONS::NONE; /*!< \brief SA base model. */
1079+
bool ft2 = false; /*!< \brief Use ft2 term. */
1080+
bool qcr2000 = false; /*!< \brief Use QCR-2000. */
1081+
bool comp = false; /*!< \brief Use compressibility correction. */
1082+
bool rot = false; /*!< \brief Use rotation correction. */
1083+
bool bc = false; /*!< \brief BC transition. */
1084+
};
1085+
1086+
/*!
1087+
* \brief Function to parse SA options.
1088+
* \param[in] SA_Options - Selected SA option from config.
1089+
* \param[in] nSA_Options - Number of options selected.
1090+
* \param[in] rank - MPI rank.
1091+
* \return Struct with SA options.
1092+
*/
1093+
inline SA_ParsedOptions ParseSAOptions(const SA_OPTIONS *SA_Options, unsigned short nSA_Options, int rank) {
1094+
SA_ParsedOptions SAParsedOptions;
1095+
1096+
auto IsPresent = [&](SA_OPTIONS option) {
1097+
const auto sa_options_end = SA_Options + nSA_Options;
1098+
return std::find(SA_Options, sa_options_end, option) != sa_options_end;
1099+
};
1100+
1101+
const bool found_neg = IsPresent(SA_OPTIONS::NEG);
1102+
const bool found_edw = IsPresent(SA_OPTIONS::EDW);
1103+
const bool found_bsl = !found_neg && !found_edw;
1104+
1105+
if (found_neg && found_edw) {
1106+
SU2_MPI::Error("Two versions (Negative and Edwards) selected for SA_OPTIONS. Please choose only one.", CURRENT_FUNCTION);
1107+
}
1108+
1109+
if (found_bsl) {
1110+
SAParsedOptions.version = SA_OPTIONS::NONE;
1111+
} else if (found_neg) {
1112+
SAParsedOptions.version = SA_OPTIONS::NEG;
1113+
} else {
1114+
SAParsedOptions.version = SA_OPTIONS::EDW;
1115+
}
1116+
SAParsedOptions.ft2 = IsPresent(SA_OPTIONS::FT2);
1117+
SAParsedOptions.qcr2000 = IsPresent(SA_OPTIONS::QCR2000);
1118+
SAParsedOptions.comp = IsPresent(SA_OPTIONS::COMP);
1119+
SAParsedOptions.rot = IsPresent(SA_OPTIONS::ROT);
1120+
SAParsedOptions.bc = IsPresent(SA_OPTIONS::BC);
1121+
1122+
/*--- Validate user settings when not in experimental mode. ---*/
1123+
if (!IsPresent(SA_OPTIONS::EXP)) {
1124+
const bool any_but_bc = SAParsedOptions.ft2 || SAParsedOptions.qcr2000 || SAParsedOptions.comp || SAParsedOptions.rot;
1125+
1126+
switch (SAParsedOptions.version) {
1127+
case SA_OPTIONS::NEG:
1128+
if (!SAParsedOptions.ft2 || SAParsedOptions.bc)
1129+
SU2_MPI::Error("A non-standard version of SA-neg was requested (see https://turbmodels.larc.nasa.gov/spalart.html).\n"
1130+
"If you want to continue, add EXPERIMENTAL to SA_OPTIONS.", CURRENT_FUNCTION);
1131+
break;
1132+
case SA_OPTIONS::EDW:
1133+
if (any_but_bc || SAParsedOptions.bc)
1134+
SU2_MPI::Error("A non-standard version of SA-noft2-Edwards was requested (see https://turbmodels.larc.nasa.gov/spalart.html).\n"
1135+
"If you want to continue, add EXPERIMENTAL to SA_OPTIONS.", CURRENT_FUNCTION);
1136+
break;
1137+
default:
1138+
if (SAParsedOptions.bc && any_but_bc)
1139+
SU2_MPI::Error("A non-standard version of SA-BCM was requested (see https://turbmodels.larc.nasa.gov/spalart.html).\n"
1140+
"If you want to continue, add EXPERIMENTAL to SA_OPTIONS.", CURRENT_FUNCTION);
1141+
break;
1142+
}
1143+
}
1144+
return SAParsedOptions;
1145+
}
1146+
10591147
/*!
10601148
* \brief Types of transition models
10611149
*/
10621150
enum class TURB_TRANS_MODEL {
10631151
NONE, /*!< \brief No transition model. */
10641152
LM, /*!< \brief Kind of transition model (Langtry-Menter (LM) for SST and Spalart-Allmaras). */
1065-
BC /*!< \brief Kind of transition model (BAS-CAKMAKCIOGLU (BC) for Spalart-Allmaras). */
10661153
};
10671154
static const MapType<std::string, TURB_TRANS_MODEL> Trans_Model_Map = {
10681155
MakePair("NONE", TURB_TRANS_MODEL::NONE)
10691156
MakePair("LM", TURB_TRANS_MODEL::LM)
1070-
MakePair("BC", TURB_TRANS_MODEL::BC)
10711157
};
10721158

10731159
/*!

Common/src/CConfig.cpp

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,8 @@ void CConfig::SetConfig_Options() {
10911091
addEnumOption("KIND_TURB_MODEL", Kind_Turb_Model, Turb_Model_Map, TURB_MODEL::NONE);
10921092
/*!\brief SST_OPTIONS \n DESCRIPTION: Specify SST turbulence model options/corrections. \n Options: see \link SST_Options_Map \endlink \n DEFAULT: NONE \ingroup Config*/
10931093
addEnumListOption("SST_OPTIONS", nSST_Options, SST_Options, SST_Options_Map);
1094+
/*!\brief SST_OPTIONS \n DESCRIPTION: Specify SA turbulence model options/corrections. \n Options: see \link SA_Options_Map \endlink \n DEFAULT: NONE \ingroup Config*/
1095+
addEnumListOption("SA_OPTIONS", nSA_Options, SA_Options, SA_Options_Map);
10941096

10951097
/*!\brief KIND_TRANS_MODEL \n DESCRIPTION: Specify transition model OPTIONS: see \link Trans_Model_Map \endlink \n DEFAULT: NONE \ingroup Config*/
10961098
addEnumOption("KIND_TRANS_MODEL", Kind_Trans_Model, Trans_Model_Map, TURB_TRANS_MODEL::NONE);
@@ -2767,9 +2769,6 @@ void CConfig::SetConfig_Options() {
27672769
/* DESCRIPTION: Roe with low dissipation for unsteady flows */
27682770
addEnumOption("ROE_LOW_DISSIPATION", Kind_RoeLowDiss, RoeLowDiss_Map, NO_ROELOWDISS);
27692771

2770-
/* DESCRIPTION: Activate SA Quadratic Constitutive Relation, 2000 version */
2771-
addBoolOption("SA_QCR", QCR, false);
2772-
27732772
/* DESCRIPTION: Compute Average for unsteady simulations */
27742773
addBoolOption("COMPUTE_AVERAGE", Compute_Average, false);
27752774

@@ -2996,6 +2995,8 @@ void CConfig::SetConfig_Parsing(istream& config_buffer){
29962995
newString.append("SOLID_DENSITY is deprecated. Use MATERIAL_DENSITY instead.\n\n");
29972996
else if (!option_name.compare("SOLID_TEMPERATURE_INIT"))
29982997
newString.append("SOLID_TEMPERATURE_INIT is deprecated. Use FREESTREAM_TEMPERATURE instead.\n\n");
2998+
else if (!option_name.compare("SA_QCR"))
2999+
newString.append("SA_QCR is deprecated. Use SA_OPTIONS=QCR2000 instead.\n\n");
29993000
else {
30003001
/*--- Find the most likely candidate for the unrecognized option, based on the length
30013002
of start and end character sequences shared by candidates and the option. ---*/
@@ -3054,9 +3055,21 @@ void CConfig::SetConfig_Parsing(istream& config_buffer){
30543055
string out = option_map[option_name]->SetValue(option_value);
30553056
if (out.compare("") != 0) {
30563057
/*--- valid option, but deprecated value ---*/
3057-
if ((!option_name.compare("KIND_TURB_MODEL")) && (option_value[0]=="SST_SUST"))
3058-
errorString.append("Option KIND_TURB_MODEL=SST_SUST is deprecated. Use KIND_TURB_MODEL=SST, SST_OPTIONS=SUSTAINING instead.\n");
3059-
3058+
if (!option_name.compare("KIND_TURB_MODEL")) {
3059+
if (option_value[0] == "SST_SUST")
3060+
errorString.append("Option KIND_TURB_MODEL=SST_SUST is deprecated. Use KIND_TURB_MODEL=SST, SST_OPTIONS=SUSTAINING instead.\n");
3061+
else if (option_value[0] == "SA_NEG")
3062+
errorString.append("Option KIND_TURB_MODEL=SA_NEG is deprecated. Use KIND_TURB_MODEL=SA, SA_OPTIONS=NEGATIVE instead.\n");
3063+
else if (option_value[0] == "SA_E")
3064+
errorString.append("Option KIND_TURB_MODEL=SA_E is deprecated. Use KIND_TURB_MODEL=SA, SA_OPTIONS=EDWARDS instead.\n");
3065+
else if (option_value[0] == "SA_COMP")
3066+
errorString.append("Option KIND_TURB_MODEL=SA_COMP is deprecated. Use KIND_TURB_MODEL=SA, SA_OPTIONS=COMPRESSIBILITY instead.\n");
3067+
else if (option_value[0] == "SA_E_COMP")
3068+
errorString.append("Option KIND_TURB_MODEL=SA_E_COMP is deprecated. Use KIND_TURB_MODEL=SA, SA_OPTIONS=EDWARDS,COMPRESSIBILITY instead.\n");
3069+
} else if (!option_name.compare("KIND_TRANS_MODEL")) {
3070+
if (option_value[0] == "BC")
3071+
errorString.append("Option KIND_TRANS_MODEL=BC is deprecated. Use KIND_TURB_MODEL=SA, SA_OPTIONS=BCM instead.\n");
3072+
}
30603073
errorString.append(out);
30613074
errorString.append("\n");
30623075
err_count++;
@@ -3399,8 +3412,10 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
33993412
}
34003413

34013414
/*--- Postprocess SST_OPTIONS into structure. ---*/
3402-
if (Kind_Turb_Model==TURB_MODEL::SST) {
3415+
if (Kind_Turb_Model == TURB_MODEL::SST) {
34033416
sstParsedOptions = ParseSSTOptions(SST_Options, nSST_Options, rank);
3417+
} else if (Kind_Turb_Model == TURB_MODEL::SA) {
3418+
saParsedOptions = ParseSAOptions(SA_Options, nSA_Options, rank);
34043419
}
34053420

34063421
/*--- Check if turbulence model can be used for AXISYMMETRIC case---*/
@@ -4588,10 +4603,6 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
45884603
for (int i=0; i<7; ++i) eng_cyl[i] /= 12.0;
45894604
}
45904605

4591-
if ((Kind_Turb_Model != TURB_MODEL::SA) && (Kind_Trans_Model == TURB_TRANS_MODEL::BC)){
4592-
SU2_MPI::Error("BC transition model currently only available in combination with SA turbulence model!", CURRENT_FUNCTION);
4593-
}
4594-
45954606
if (Kind_Trans_Model == TURB_TRANS_MODEL::LM) {
45964607
SU2_MPI::Error("The LM transition model is under maintenance.", CURRENT_FUNCTION);
45974608
}
@@ -5861,11 +5872,26 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
58615872
cout << "Turbulence model: ";
58625873
switch (Kind_Turb_Model) {
58635874
case TURB_MODEL::NONE: break;
5864-
case TURB_MODEL::SA: cout << "Spalart Allmaras" << endl; break;
5865-
case TURB_MODEL::SA_NEG: cout << "Negative Spalart Allmaras" << endl; break;
5866-
case TURB_MODEL::SA_E: cout << "Edwards Spalart Allmaras" << endl; break;
5867-
case TURB_MODEL::SA_COMP: cout << "Compressibility Correction Spalart Allmaras" << endl; break;
5868-
case TURB_MODEL::SA_E_COMP: cout << "Compressibility Correction Edwards Spalart Allmaras" << endl; break;
5875+
case TURB_MODEL::SA:
5876+
switch (saParsedOptions.version) {
5877+
case SA_OPTIONS::NEG:
5878+
cout << "Negative-";
5879+
break;
5880+
case SA_OPTIONS::EDW:
5881+
cout << "Edwards-";
5882+
break;
5883+
default:
5884+
break;
5885+
}
5886+
cout << "Spalart-Allmaras";
5887+
5888+
if (!saParsedOptions.ft2) cout << "-noft2";
5889+
if (saParsedOptions.rot) cout << "-R";
5890+
if (saParsedOptions.comp) cout << "-comp";
5891+
if (saParsedOptions.qcr2000) cout << "-QCR2000";
5892+
if (saParsedOptions.bc) cout << "-BCM";
5893+
cout << endl;
5894+
break;
58695895
case TURB_MODEL::SST:
58705896
cout << "Menter's k-omega SST";
58715897
if (sstParsedOptions.version == SST_OPTIONS::V1994) cout << "-1994";
@@ -5891,11 +5917,9 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
58915917
cout << "." << endl;
58925918
break;
58935919
}
5894-
if (QCR) cout << "Using Quadratic Constitutive Relation, 2000 version (QCR2000)" << endl;
5895-
if (Kind_Trans_Model == TURB_TRANS_MODEL::BC) cout << "Using the revised BC transition model (2020)" << endl;
58965920
cout << "Hybrid RANS/LES: ";
5897-
switch (Kind_HybridRANSLES){
5898-
case NO_HYBRIDRANSLES: cout << "No Hybrid RANS/LES" << endl; break;
5921+
switch (Kind_HybridRANSLES) {
5922+
case NO_HYBRIDRANSLES: cout << "No Hybrid RANS/LES" << endl; break;
58995923
case SA_DES: cout << "Detached Eddy Simulation (DES97) " << endl; break;
59005924
case SA_DDES: cout << "Delayed Detached Eddy Simulation (DDES) with Standard SGS" << endl; break;
59015925
case SA_ZDES: cout << "Delayed Detached Eddy Simulation (DDES) with Vorticity-based SGS" << endl; break;

0 commit comments

Comments
 (0)