Skip to content

Commit 6adccdb

Browse files
Cristopher-Moralesbigfootedpcarruscag
authored
Adding inlet markers for turbulent intensity and viscosity ratio for SST Model (#1843)
* adding inlet Turbulent options * adding inlets turbulent intensities * addding set functions * filling up marker_inlet_turb * adding error messages * spelling fix * small cleaning up * adding test case * Update Common/include/CConfig.hpp Co-authored-by: Nijso <bigfootedrockmidget@hotmail.com> * addressing comment and adding default values in GetInlet_TurbVal * updating residuals parallel regression * fix logic for returning freestream values * fix * Update Common/include/CConfig.hpp Co-authored-by: Nijso <bigfootedrockmidget@hotmail.com> * Update Common/include/CConfig.hpp Co-authored-by: Nijso <bigfootedrockmidget@hotmail.com> * Update TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.cfg Co-authored-by: Nijso <bigfootedrockmidget@hotmail.com> * Update TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.cfg Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * updating residuals Co-authored-by: Nijso <bigfootedrockmidget@hotmail.com> Co-authored-by: Pedro Gomes <pcarruscag@gmail.com> Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com>
1 parent 2514914 commit 6adccdb

6 files changed

Lines changed: 223 additions & 12 deletions

File tree

Common/include/CConfig.hpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ class CConfig {
194194
nMarker_Inlet, /*!< \brief Number of inlet flow markers. */
195195
nMarker_Inlet_Species, /*!< \brief Number of inlet species markers. */
196196
nSpecies_per_Inlet, /*!< \brief Number of species defined per inlet markers. */
197+
nMarker_Inlet_Turb, /*!< \brief Number of inlet turbulent markers. */
198+
nTurb_Properties, /*!< \brief Number of turbulent properties per inlet markers. */
197199
nMarker_Riemann, /*!< \brief Number of Riemann flow markers. */
198200
nMarker_Giles, /*!< \brief Number of Giles flow markers. */
199201
nRelaxFactor_Giles, /*!< \brief Number of relaxation factors for Giles markers. */
@@ -244,6 +246,7 @@ class CConfig {
244246
*Marker_ActDiskOutlet, /*!< \brief Actuator disk outlet markers. */
245247
*Marker_Inlet, /*!< \brief Inlet flow markers. */
246248
*Marker_Inlet_Species, /*!< \brief Inlet species markers. */
249+
*Marker_Inlet_Turb, /*!< \brief Inlet turbulent markers. */
247250
*Marker_Riemann, /*!< \brief Riemann markers. */
248251
*Marker_Giles, /*!< \brief Giles markers. */
249252
*Marker_Shroud, /*!< \brief Shroud markers. */
@@ -283,6 +286,7 @@ class CConfig {
283286
su2double **Inlet_Velocity; /*!< \brief Specified flow velocity vectors for supersonic inlet boundaries. */
284287
su2double **Inlet_MassFrac; /*!< \brief Specified Mass fraction vectors for supersonic inlet boundaries (NEMO solver). */
285288
su2double **Inlet_SpeciesVal; /*!< \brief Specified species vector for inlet boundaries. */
289+
su2double **Inlet_TurbVal; /*!< \brief Specified turbulent intensity and viscosity ratio for inlet boundaries. */
286290
su2double *EngineInflow_Target; /*!< \brief Specified fan face targets for nacelle boundaries. */
287291
su2double *Inflow_Mach; /*!< \brief Specified fan face mach for nacelle boundaries. */
288292
su2double *Inflow_Pressure; /*!< \brief Specified fan face pressure for nacelle boundaries. */
@@ -848,6 +852,7 @@ class CConfig {
848852
array<su2double, N_POLY_COEFFS> CpPolyCoefficientsND{{0.0}}; /*!< \brief Definition of the non-dimensional temperature polynomial coefficients for specific heat Cp. */
849853
array<su2double, N_POLY_COEFFS> MuPolyCoefficientsND{{0.0}}; /*!< \brief Definition of the non-dimensional temperature polynomial coefficients for viscosity. */
850854
array<su2double, N_POLY_COEFFS> KtPolyCoefficientsND{{0.0}}; /*!< \brief Definition of the non-dimensional temperature polynomial coefficients for thermal conductivity. */
855+
su2double TurbIntensityAndViscRatioFreeStream[2]; /*!< \brief Freestream turbulent intensity and viscosity ratio for turbulence and transition models. */
851856
su2double Energy_FreeStream, /*!< \brief Free-stream total energy of the fluid. */
852857
ModVel_FreeStream, /*!< \brief Magnitude of the free-stream velocity of the fluid. */
853858
ModVel_FreeStreamND, /*!< \brief Non-dimensional magnitude of the free-stream velocity of the fluid. */
@@ -856,8 +861,6 @@ class CConfig {
856861
Tke_FreeStream, /*!< \brief Total turbulent kinetic energy of the fluid. */
857862
Intermittency_FreeStream, /*!< \brief Freestream intermittency (for sagt transition model) of the fluid. */
858863
ReThetaT_FreeStream, /*!< \brief Freestream Transition Momentum Thickness Reynolds Number (for LM transition model) of the fluid. */
859-
TurbulenceIntensity_FreeStream, /*!< \brief Freestream turbulent intensity (for sagt transition model) of the fluid. */
860-
Turb2LamViscRatio_FreeStream, /*!< \brief Ratio of turbulent to laminar viscosity. */
861864
NuFactor_FreeStream, /*!< \brief Ratio of turbulent to laminar viscosity. */
862865
NuFactor_Engine, /*!< \brief Ratio of turbulent to laminar viscosity at the engine. */
863866
SecondaryFlow_ActDisk, /*!< \brief Ratio of turbulent to laminar viscosity at the actuator disk. */
@@ -1307,6 +1310,9 @@ class CConfig {
13071310
void addInletSpeciesOption(const string name, unsigned short & nMarker_Inlet_Species, string * & Marker_Inlet_Species,
13081311
su2double** & inlet_species_val, unsigned short & nSpecies_per_Inlet);
13091312

1313+
void addInletTurbOption(const string name, unsigned short& nMarker_Inlet_Turb, string*& Marker_Inlet_Turb,
1314+
su2double** & Turb_Properties, unsigned short & nTurb_Properties);
1315+
13101316
template <class Tenum>
13111317
void addRiemannOption(const string name, unsigned short & nMarker_Riemann, string * & Marker_Riemann, unsigned short* & option_field, const map<string, Tenum> & enum_map,
13121318
su2double* & var1, su2double* & var2, su2double** & FlowDir);
@@ -1944,7 +1950,7 @@ class CConfig {
19441950
* \brief Get the value of the non-dimensionalized freestream turbulence intensity.
19451951
* \return Non-dimensionalized freestream intensity.
19461952
*/
1947-
su2double GetTurbulenceIntensity_FreeStream(void) const { return TurbulenceIntensity_FreeStream; }
1953+
su2double GetTurbulenceIntensity_FreeStream(void) const { return TurbIntensityAndViscRatioFreeStream[0]; }
19481954

19491955
/*!
19501956
* \brief Get the value of the non-dimensionalized freestream turbulence intensity.
@@ -1980,7 +1986,7 @@ class CConfig {
19801986
* \brief Get the value of the turbulent to laminar viscosity ratio.
19811987
* \return Ratio of turbulent to laminar viscosity ratio.
19821988
*/
1983-
su2double GetTurb2LamViscRatio_FreeStream(void) const { return Turb2LamViscRatio_FreeStream;}
1989+
su2double GetTurb2LamViscRatio_FreeStream(void) const { return TurbIntensityAndViscRatioFreeStream[1]; }
19841990

19851991
/*!
19861992
* \brief Get the value of the Reynolds length.
@@ -6670,6 +6676,13 @@ class CConfig {
66706676
*/
66716677
const su2double* GetInlet_SpeciesVal(string val_index) const;
66726678

6679+
/*!
6680+
* \brief Get the turbulent properties values at an inlet boundary
6681+
* \param[in] val_index - Index corresponding to the inlet boundary.
6682+
* \return The inlet turbulent values.
6683+
*/
6684+
const su2double* GetInlet_TurbVal(string val_index) const;
6685+
66736686
/*!
66746687
* \brief Get the total pressure at an nacelle boundary.
66756688
* \param[in] val_index - Index corresponding to the inlet boundary.

Common/src/CConfig.cpp

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,15 @@ void CConfig::addInletSpeciesOption(const string name, unsigned short & nMarker_
493493
option_map.insert(pair<string, COptionBase *>(name, val));
494494
}
495495

496+
void CConfig::addInletTurbOption(const string name, unsigned short& nMarker_Inlet_Turb, string*& Marker_Inlet_Turb,
497+
su2double**& Turb_Properties_val, unsigned short& nTurb_Properties) {
498+
assert(option_map.find(name) == option_map.end());
499+
all_options.insert(pair<string, bool>(name, true));
500+
COptionBase* val = new COptionStringValuesList<su2double*>(name, nMarker_Inlet_Turb, Marker_Inlet_Turb,
501+
Turb_Properties_val, nTurb_Properties);
502+
option_map.insert(pair<string, COptionBase*>(name, val));
503+
}
504+
496505
template <class Tenum>
497506
void CConfig::addRiemannOption(const string name, unsigned short & nMarker_Riemann, string * & Marker_Riemann, unsigned short* & option_field, const map<string, Tenum> & enum_map,
498507
su2double* & var1, su2double* & var2, su2double** & FlowDir) {
@@ -839,7 +848,7 @@ void CConfig::SetPointersNull(void) {
839848

840849
Marker_Euler = nullptr; Marker_FarField = nullptr; Marker_Custom = nullptr;
841850
Marker_SymWall = nullptr; Marker_PerBound = nullptr;
842-
Marker_PerDonor = nullptr; Marker_NearFieldBound = nullptr;
851+
Marker_PerDonor = nullptr; Marker_NearFieldBound = nullptr; Marker_Inlet_Turb = nullptr;
843852
Marker_Deform_Mesh = nullptr; Marker_Deform_Mesh_Sym_Plane= nullptr; Marker_Fluid_Load = nullptr;
844853
Marker_Inlet = nullptr; Marker_Outlet = nullptr; Marker_Inlet_Species = nullptr;
845854
Marker_Supersonic_Inlet = nullptr; Marker_Supersonic_Outlet = nullptr; Marker_Smoluchowski_Maxwell= nullptr;
@@ -866,7 +875,7 @@ void CConfig::SetPointersNull(void) {
866875
Inlet_Ttotal = nullptr; Inlet_Ptotal = nullptr;
867876
Inlet_FlowDir = nullptr; Inlet_Temperature = nullptr; Inlet_Pressure = nullptr;
868877
Inlet_Velocity = nullptr;
869-
Outlet_Pressure = nullptr; Inlet_SpeciesVal = nullptr;
878+
Outlet_Pressure = nullptr; Inlet_SpeciesVal = nullptr; Inlet_TurbVal = nullptr;
870879

871880
/*--- Engine Boundary Condition settings ---*/
872881

@@ -1354,7 +1363,7 @@ void CConfig::SetConfig_Options() {
13541363
/* DESCRIPTION: */
13551364
addDoubleOption("FREESTREAM_INTERMITTENCY", Intermittency_FreeStream, 1.0);
13561365
/* DESCRIPTION: */
1357-
addDoubleOption("FREESTREAM_TURBULENCEINTENSITY", TurbulenceIntensity_FreeStream, 0.05);
1366+
addDoubleOption("FREESTREAM_TURBULENCEINTENSITY", TurbIntensityAndViscRatioFreeStream[0], 0.05);
13581367
/* DESCRIPTION: */
13591368
addDoubleOption("FREESTREAM_NU_FACTOR", NuFactor_FreeStream, 3.0);
13601369
/* DESCRIPTION: */
@@ -1364,7 +1373,7 @@ void CConfig::SetConfig_Options() {
13641373
/* DESCRIPTION: */
13651374
addDoubleOption("INITIAL_BCTHRUST", Initial_BCThrust, 4000.0);
13661375
/* DESCRIPTION: */
1367-
addDoubleOption("FREESTREAM_TURB2LAMVISCRATIO", Turb2LamViscRatio_FreeStream, 10.0);
1376+
addDoubleOption("FREESTREAM_TURB2LAMVISCRATIO", TurbIntensityAndViscRatioFreeStream[1], 10.0);
13681377
/* DESCRIPTION: Side-slip angle (degrees, only for compressible flows) */
13691378
addDoubleOption("SIDESLIP_ANGLE", AoS, 0.0);
13701379
/*!\brief AOA \n DESCRIPTION: Angle of attack (degrees, only for compressible flows) \ingroup Config*/
@@ -1509,7 +1518,10 @@ void CConfig::SetConfig_Options() {
15091518
/*!\brief MARKER_INLET_SPECIES \n DESCRIPTION: Inlet Species boundary marker(s) with the following format
15101519
Inlet Species: (inlet_marker, Species1, Species2, ..., SpeciesN-1, inlet_marker2, Species1, Species2, ...) */
15111520
addInletSpeciesOption("MARKER_INLET_SPECIES",nMarker_Inlet_Species, Marker_Inlet_Species, Inlet_SpeciesVal, nSpecies_per_Inlet);
1512-
1521+
/*!\brief MARKER_INLET_TURBULENT \n DESCRIPTION: Inlet Turbulence boundary marker(s) with the following format
1522+
Inlet Turbulent: (inlet_marker, TurbulentIntensity1, ViscosityRatio1, inlet_marker2, TurbulentIntensity2,
1523+
ViscosityRatio2, ...) */
1524+
addInletTurbOption("MARKER_INLET_TURBULENT", nMarker_Inlet_Turb, Marker_Inlet_Turb, Inlet_TurbVal, nTurb_Properties);
15131525
/*!\brief MARKER_RIEMANN \n DESCRIPTION: Riemann boundary marker(s) with the following formats, a unit vector.
15141526
* \n OPTIONS: See \link Riemann_Map \endlink. The variables indicated by the option and the flow direction unit vector must be specified. \ingroup Config*/
15151527
addRiemannOption("MARKER_RIEMANN", nMarker_Riemann, Marker_Riemann, Kind_Data_Riemann, Riemann_Map, Riemann_Var1, Riemann_Var2, Riemann_FlowDir);
@@ -4772,7 +4784,7 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
47724784
SU2_TYPE::SetDerivative(Reynolds, 1.0);
47734785
break;
47744786
case D_TURB2LAM:
4775-
SU2_TYPE::SetDerivative(Turb2LamViscRatio_FreeStream, 1.0);
4787+
SU2_TYPE::SetDerivative(TurbIntensityAndViscRatioFreeStream[1], 1.0);
47764788
break;
47774789
default:
47784790
/*--- All other cases are handled in the specific solver ---*/
@@ -5344,6 +5356,14 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
53445356
case TURB_FAMILY::KW:
53455357
nTurbVar = 2; break;
53465358
}
5359+
/*--- Check whether the number of entries of the MARKER_INLET_TURBULENT equals the number of turbulent properties
5360+
used for the respective turbulent model. nTurb_Properties must be equal to 1 or 2 depending on whether SA or
5361+
SST model are used.--- */
5362+
if (Marker_Inlet_Turb != nullptr && Kind_Turb_Model == TURB_MODEL::SST && nTurb_Properties != 2)
5363+
SU2_MPI::Error(
5364+
"The use of MARKER_INLET_TURBULENT requires the number of entries when SST Model is used \n"
5365+
"to be equal to 2 : Turbulent intensity and ratio turbulent to laminar viscosity",
5366+
CURRENT_FUNCTION);
53475367

53485368
/*--- Checks for additional species transport. ---*/
53495369
if (Kind_Species_Model == SPECIES_MODEL::SPECIES_TRANSPORT) {
@@ -8803,6 +8823,14 @@ const su2double* CConfig::GetInlet_SpeciesVal(string val_marker) const {
88038823
return Inlet_SpeciesVal[iMarker_Inlet_Species];
88048824
}
88058825

8826+
const su2double* CConfig::GetInlet_TurbVal(string val_marker) const {
8827+
/*--- If Turbulent Inlet is not provided for the marker, return free stream values. ---*/
8828+
for (auto iMarker = 0u; iMarker < nMarker_Inlet_Turb; iMarker++) {
8829+
if (Marker_Inlet_Turb[iMarker] == val_marker) return Inlet_TurbVal[iMarker];
8830+
}
8831+
return TurbIntensityAndViscRatioFreeStream;
8832+
}
8833+
88068834
su2double CConfig::GetOutlet_Pressure(string val_marker) const {
88078835
unsigned short iMarker_Outlet;
88088836
for (iMarker_Outlet = 0; iMarker_Outlet < nMarker_Outlet; iMarker_Outlet++)

SU2_CFD/src/solvers/CTurbSSTSolver.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,9 @@ void CTurbSSTSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, C
579579
Density_Inlet = FluidModel->GetDensity();
580580
}
581581
const su2double Laminar_Viscosity_Inlet = FluidModel->GetLaminarViscosity();
582-
const su2double Intensity = config->GetTurbulenceIntensity_FreeStream();
583-
const su2double viscRatio = config->GetTurb2LamViscRatio_FreeStream();
582+
const su2double* Turb_Properties = config->GetInlet_TurbVal(config->GetMarker_All_TagBound(val_marker));
583+
const su2double Intensity = Turb_Properties[0];
584+
const su2double viscRatio = Turb_Properties[1];
584585
const su2double VelMag2 = GeometryToolbox::SquaredNorm(nDim, Velocity_Inlet);
585586

586587
Inlet_Vars[0] = 3.0 / 2.0 * (VelMag2 * pow(Intensity, 2));

TestCases/parallel_regression.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,18 @@ def main():
14011401
species_primitiveVenturi_boundedscalar.test_vals = [-5.297585, -4.397797, -4.377086, -5.593131, -1.011782, -5.623540, 5.000000, -1.775123, 5.000000, -4.086339, 5.000000, -2.080187, 0.000424, 0.000424, 0.000000, 0.000000]
14021402
species_primitiveVenturi_boundedscalar.new_output = True
14031403
test_list.append(species_primitiveVenturi_boundedscalar)
1404+
1405+
# 2 species (1 eq) primitive venturi mixing using mixing model including inlet markers for turbulent intensity and viscosity ratios
1406+
species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS = TestCase('species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.cfg')
1407+
species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.cfg_dir = "species_transport/venturi_primitive_3species"
1408+
species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.cfg_file = "species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.cfg"
1409+
species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.test_iter = 50
1410+
species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.test_vals = [-4.019621, -1.652733, -1.414138, -0.971744, 1.590456, -3.762843, 23.000000, -5.066221, 12.000000, -5.359931, 4.000000, -6.078888, 2.000000, 1.000000, 0.000000, 1.000000]
1411+
species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.su2_exec = "mpirun -n 2 SU2_CFD"
1412+
species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.timeout = 1600
1413+
species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.new_output = True
1414+
species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.tol = 0.00001
1415+
test_list.append(species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS)
14041416

14051417
# 3 species (2 eq) primitive venturi mixing with inlet files.
14061418
# Note that the residuals are exactly the same as for the non-inlet case which should be the case for a fresh inlet file.

0 commit comments

Comments
 (0)