Skip to content

Commit d037e59

Browse files
author
rois1995
committed
- Added SLA DDES formulation to SST
1 parent d377903 commit d037e59

File tree

6 files changed

+144
-66
lines changed

6 files changed

+144
-66
lines changed

Common/include/option_structure.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,8 @@ enum ENUM_HYBRIDRANSLES {
14501450
SA_EDDES = 4, /*!< \brief Kind of Hybrid RANS/LES (SA - Delayed DES (DDES) with Shear Layer Adapted SGS: Enhanced DDES). */
14511451
SST_DDES = 5, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): DDES). */
14521452
SST_IDDES = 6, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Improved DDES). */
1453-
SST_SIDDES = 7 /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Simplified Improved DDES). */
1453+
SST_SIDDES = 7, /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Simplified Improved DDES). */
1454+
SST_EDDES = 8 /*!< \brief Kind of Hybrid RANS/LES (SST - Delayed DES (DDES): Enhanced (SLA) DDES). */
14541455
};
14551456
static const MapType<std::string, ENUM_HYBRIDRANSLES> HybridRANSLES_Map = {
14561457
MakePair("NONE", NO_HYBRIDRANSLES)
@@ -1461,6 +1462,7 @@ static const MapType<std::string, ENUM_HYBRIDRANSLES> HybridRANSLES_Map = {
14611462
MakePair("SST_DDES", SST_DDES)
14621463
MakePair("SST_IDDES", SST_IDDES)
14631464
MakePair("SST_SIDDES", SST_SIDDES)
1465+
MakePair("SST_EDDES", SST_EDDES)
14641466
};
14651467

14661468
/*!

SU2_CFD/include/variables/CTurbSAVariable.hpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
class CTurbSAVariable final : public CTurbVariable {
4040

4141
private:
42-
VectorType Vortex_Tilting;
4342

4443
VectorType k, Omega; /*!< \brief SST variables as computed through SA solution. */
4544

@@ -61,18 +60,4 @@ class CTurbSAVariable final : public CTurbVariable {
6160
*/
6261
~CTurbSAVariable() override = default;
6362

64-
/*!
65-
* \brief Set the vortex tilting measure for computation of the EDDES length scale
66-
* \param[in] iPoint - Point index.
67-
*/
68-
void SetVortex_Tilting(unsigned long iPoint, CMatrixView<const su2double>,
69-
const su2double* Vorticity, su2double LaminarViscosity) override;
70-
71-
/*!
72-
* \brief Get the vortex tilting measure for computation of the EDDES length scale
73-
* \param[in] iPoint - Point index.
74-
* \return Value of the DES length Scale
75-
*/
76-
inline su2double GetVortex_Tilting(unsigned long iPoint) const override { return Vortex_Tilting(iPoint); }
77-
7863
};

SU2_CFD/include/variables/CTurbVariable.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class CTurbVariable : public CScalarVariable {
4545
VectorType turb_index; /*!< \brief Value of the turbulence index for transition simulations. */
4646
VectorType intermittency; /*!< \brief Value of the intermittency for the transition model. */
4747
VectorType SRSGridSize; /*!< \brief alue of the desired grid size for Scale Resolving Simulations. */
48+
VectorType Vortex_Tilting;
4849

4950
/*!
5051
* \brief Constructor of the class.
@@ -129,5 +130,18 @@ class CTurbVariable : public CScalarVariable {
129130
*/
130131
inline void SetDES_LengthScale(unsigned long iPoint, su2double val_des_lengthscale) override { DES_LengthScale(iPoint) = val_des_lengthscale; }
131132

133+
/*!
134+
* \brief Set the vortex tilting measure for computation of the EDDES length scale
135+
* \param[in] iPoint - Point index.
136+
*/
137+
void SetVortex_Tilting(unsigned long iPoint, CMatrixView<const su2double>,
138+
const su2double* Vorticity, su2double LaminarViscosity) override;
139+
140+
/*!
141+
* \brief Get the vortex tilting measure for computation of the EDDES length scale
142+
* \param[in] iPoint - Point index.
143+
* \return Value of the DES length Scale
144+
*/
145+
inline su2double GetVortex_Tilting(unsigned long iPoint) const override { return Vortex_Tilting(iPoint); }
132146
};
133147

SU2_CFD/src/solvers/CTurbSSTSolver.cpp

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,21 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain
205205

206206
if (kind_hybridRANSLES != NO_HYBRIDRANSLES) {
207207

208+
/*--- Set the vortex tilting coefficient at every node if required ---*/
209+
210+
if (kind_hybridRANSLES == SST_EDDES){
211+
auto* flowNodes = su2staticcast_p<CFlowVariable*>(solver_container[FLOW_SOL]->GetNodes());
212+
213+
SU2_OMP_FOR_STAT(omp_chunk_size)
214+
for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){
215+
auto Vorticity = flowNodes->GetVorticity(iPoint);
216+
auto PrimGrad_Flow = flowNodes->GetGradient_Primitive(iPoint);
217+
auto Laminar_Viscosity = flowNodes->GetLaminarViscosity(iPoint);
218+
nodes->SetVortex_Tilting(iPoint, PrimGrad_Flow, Vorticity, Laminar_Viscosity);
219+
}
220+
END_SU2_OMP_FOR
221+
}
222+
208223
/*--- Compute the DES length scale ---*/
209224

210225
SetDES_LengthScale(solver_container, geometry, config);
@@ -1154,7 +1169,8 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C
11541169
for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){
11551170

11561171
const su2double StrainMag = max(flowNodes->GetStrainMag(iPoint), 1e-12);
1157-
const su2double VortMag = max(GeometryToolbox::Norm(3, flowNodes->GetVorticity(iPoint)), 1e-12);
1172+
const auto Vorticity = flowNodes->GetVorticity(iPoint);
1173+
const su2double VortMag = max(GeometryToolbox::Norm(3, Vorticity), 1e-12);
11581174

11591175
const su2double KolmConst2 = 0.41*0.41;
11601176
const su2double wallDist2 = geometry->nodes->GetWall_Distance(iPoint)*geometry->nodes->GetWall_Distance(iPoint);
@@ -1242,6 +1258,65 @@ void CTurbSSTSolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, C
12421258

12431259
break;
12441260
}
1261+
case SST_EDDES: {
1262+
1263+
// Improved DDES version with the Shear-Layer-Adapted augmentation
1264+
// found in Detached Eddy Simulation: Recent Development and Application to Compressor Tip Leakage Flow, Xiao He, Fanzhou Zhao, Mehdi Vahdati
1265+
// originally from Application of SST-Based SLA-DDES Formulation to Turbomachinery Flows, Guoping Xia, Zifei Yin and Gorazd Medic
1266+
// I could be naming it either as SST_EDDES to follow the same notation as for the SA model or as SST_SLA_DDES to follow the paper notation
1267+
1268+
const su2double f_max = 1.0, f_min = 0.1, a1 = 0.15, a2 = 0.3;
1269+
1270+
const auto nNeigh = geometry->nodes->GetnPoint(iPoint);
1271+
1272+
su2double vortexTiltingMeasure = nodes->GetVortex_Tilting(iPoint);
1273+
1274+
su2double deltaOmega = -1;
1275+
su2double vorticityDir[MAXNDIM] = {};
1276+
1277+
for (auto iDim = 0; iDim < 3; iDim++){
1278+
vorticityDir[iDim] = Vorticity[iDim]/VortMag;
1279+
}
1280+
1281+
for (const auto jPoint : geometry->nodes->GetPoints(iPoint)){
1282+
const auto coord_j = geometry->nodes->GetCoord(jPoint);
1283+
1284+
for (const auto kPoint : geometry->nodes->GetPoints(iPoint)){
1285+
const auto coord_k = geometry->nodes->GetCoord(kPoint);
1286+
1287+
su2double delta[3];
1288+
for (auto iDim = 0u; iDim < nDim; iDim++){
1289+
delta[iDim] = (coord_j[iDim] - coord_k[iDim])/2.0; // Should I divide by 2 as I am interested in the dual volume?
1290+
}
1291+
su2double l_n_minus_m[3];
1292+
GeometryToolbox::CrossProduct(delta, vorticityDir, l_n_minus_m);
1293+
deltaOmega = max(deltaOmega, GeometryToolbox::Norm(nDim, l_n_minus_m));
1294+
}
1295+
1296+
// Add to VTM(iPoint) to perform the average
1297+
vortexTiltingMeasure += nodes->GetVortex_Tilting(jPoint);
1298+
}
1299+
deltaOmega /= (1/sqrt(3));
1300+
vortexTiltingMeasure /= (nNeigh+1);
1301+
1302+
const su2double f_kh = max(f_min,
1303+
min(f_max,
1304+
f_min + ((f_max - f_min)/(a2 - a1)) * (vortexTiltingMeasure - a1)));
1305+
1306+
const su2double r_d = (eddyVisc + lamVisc) / max((KolmConst2*wallDist2 * sqrt(0.5 * (StrainMag*StrainMag + VortMag*VortMag))), 1e-10);
1307+
const su2double C_d1 = 20.0;
1308+
const su2double C_d2 = 3.0;
1309+
1310+
const su2double f_d = 1 - tanh(pow(C_d1 * r_d, C_d2));
1311+
1312+
su2double delta = deltaOmega * f_kh;
1313+
if (f_d < 0.99){
1314+
delta = h_max;
1315+
}
1316+
1317+
const su2double l_LES = C_DES * delta;
1318+
DES_lengthScale = l_RANS - f_d * max(0.0, l_RANS - l_LES);
1319+
}
12451320
}
12461321

12471322
nodes->SetDES_LengthScale(iPoint, DES_lengthScale);

SU2_CFD/src/variables/CTurbSAVariable.cpp

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -46,55 +46,7 @@ CTurbSAVariable::CTurbSAVariable(su2double val_nu_tilde, su2double val_muT, unsi
4646
Solution_time_n1 = Solution;
4747
}
4848

49-
Vortex_Tilting.resize(nPoint);
5049

5150
k.resize(nPoint) = su2double(0.0);
5251
Omega.resize(nPoint) = su2double(0.0);
53-
}
54-
55-
void CTurbSAVariable::SetVortex_Tilting(unsigned long iPoint, CMatrixView<const su2double> PrimGrad_Flow,
56-
const su2double* Vorticity, su2double LaminarViscosity) {
57-
58-
su2double Strain[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}}, Omega, StrainDotVort[3], numVecVort[3];
59-
su2double numerator, trace0, trace1, denominator;
60-
61-
AD::StartPreacc();
62-
AD::SetPreaccIn(PrimGrad_Flow, nDim+1, nDim);
63-
AD::SetPreaccIn(Vorticity, 3);
64-
/*--- Eddy viscosity ---*/
65-
AD::SetPreaccIn(muT(iPoint));
66-
/*--- Laminar viscosity --- */
67-
AD::SetPreaccIn(LaminarViscosity);
68-
69-
Strain[0][0] = PrimGrad_Flow[1][0];
70-
Strain[1][0] = 0.5*(PrimGrad_Flow[2][0] + PrimGrad_Flow[1][1]);
71-
Strain[0][1] = 0.5*(PrimGrad_Flow[1][1] + PrimGrad_Flow[2][0]);
72-
Strain[1][1] = PrimGrad_Flow[2][1];
73-
if (nDim == 3){
74-
Strain[0][2] = 0.5*(PrimGrad_Flow[3][0] + PrimGrad_Flow[1][2]);
75-
Strain[1][2] = 0.5*(PrimGrad_Flow[3][1] + PrimGrad_Flow[2][2]);
76-
Strain[2][0] = 0.5*(PrimGrad_Flow[1][2] + PrimGrad_Flow[3][0]);
77-
Strain[2][1] = 0.5*(PrimGrad_Flow[2][2] + PrimGrad_Flow[3][1]);
78-
Strain[2][2] = PrimGrad_Flow[3][2];
79-
}
80-
81-
Omega = sqrt(Vorticity[0]*Vorticity[0] + Vorticity[1]*Vorticity[1]+ Vorticity[2]*Vorticity[2]);
82-
83-
StrainDotVort[0] = Strain[0][0]*Vorticity[0]+Strain[0][1]*Vorticity[1]+Strain[0][2]*Vorticity[2];
84-
StrainDotVort[1] = Strain[1][0]*Vorticity[0]+Strain[1][1]*Vorticity[1]+Strain[1][2]*Vorticity[2];
85-
StrainDotVort[2] = Strain[2][0]*Vorticity[0]+Strain[2][1]*Vorticity[1]+Strain[2][2]*Vorticity[2];
86-
87-
numVecVort[0] = StrainDotVort[1]*Vorticity[2] - StrainDotVort[2]*Vorticity[1];
88-
numVecVort[1] = StrainDotVort[2]*Vorticity[0] - StrainDotVort[0]*Vorticity[2];
89-
numVecVort[2] = StrainDotVort[0]*Vorticity[1] - StrainDotVort[1]*Vorticity[0];
90-
91-
numerator = sqrt(6.0) * sqrt(numVecVort[0]*numVecVort[0] + numVecVort[1]*numVecVort[1] + numVecVort[2]*numVecVort[2]);
92-
trace0 = 3.0*(pow(Strain[0][0],2.0) + pow(Strain[1][1],2.0) + pow(Strain[2][2],2.0));
93-
trace1 = pow(Strain[0][0] + Strain[1][1] + Strain[2][2],2.0);
94-
denominator = pow(Omega, 2.0) * sqrt(trace0-trace1);
95-
96-
Vortex_Tilting(iPoint) = (numerator/denominator) * max(1.0,0.2*LaminarViscosity/muT(iPoint));
97-
98-
AD::SetPreaccOut(Vortex_Tilting(iPoint));
99-
AD::EndPreacc();
100-
}
52+
}

SU2_CFD/src/variables/CTurbVariable.cpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,55 @@ CTurbVariable::CTurbVariable(unsigned long npoint, unsigned long ndim, unsigned
3737

3838
DES_LengthScale.resize(nPoint) = su2double(0.0);
3939
SRSGridSize.resize(nPoint) = su2double(0.0);
40+
41+
Vortex_Tilting.resize(nPoint);
4042

4143
}
44+
45+
46+
void CTurbVariable::SetVortex_Tilting(unsigned long iPoint, CMatrixView<const su2double> PrimGrad_Flow,
47+
const su2double* Vorticity, su2double LaminarViscosity) {
48+
49+
su2double Strain[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}}, Omega, StrainDotVort[3], numVecVort[3];
50+
su2double numerator, trace0, trace1, denominator;
51+
52+
AD::StartPreacc();
53+
AD::SetPreaccIn(PrimGrad_Flow, nDim+1, nDim);
54+
AD::SetPreaccIn(Vorticity, 3);
55+
/*--- Eddy viscosity ---*/
56+
AD::SetPreaccIn(muT(iPoint));
57+
/*--- Laminar viscosity --- */
58+
AD::SetPreaccIn(LaminarViscosity);
59+
60+
Strain[0][0] = PrimGrad_Flow[1][0];
61+
Strain[1][0] = 0.5*(PrimGrad_Flow[2][0] + PrimGrad_Flow[1][1]);
62+
Strain[0][1] = 0.5*(PrimGrad_Flow[1][1] + PrimGrad_Flow[2][0]);
63+
Strain[1][1] = PrimGrad_Flow[2][1];
64+
if (nDim == 3){
65+
Strain[0][2] = 0.5*(PrimGrad_Flow[3][0] + PrimGrad_Flow[1][2]);
66+
Strain[1][2] = 0.5*(PrimGrad_Flow[3][1] + PrimGrad_Flow[2][2]);
67+
Strain[2][0] = 0.5*(PrimGrad_Flow[1][2] + PrimGrad_Flow[3][0]);
68+
Strain[2][1] = 0.5*(PrimGrad_Flow[2][2] + PrimGrad_Flow[3][1]);
69+
Strain[2][2] = PrimGrad_Flow[3][2];
70+
}
71+
72+
Omega = sqrt(Vorticity[0]*Vorticity[0] + Vorticity[1]*Vorticity[1]+ Vorticity[2]*Vorticity[2]);
73+
74+
StrainDotVort[0] = Strain[0][0]*Vorticity[0]+Strain[0][1]*Vorticity[1]+Strain[0][2]*Vorticity[2];
75+
StrainDotVort[1] = Strain[1][0]*Vorticity[0]+Strain[1][1]*Vorticity[1]+Strain[1][2]*Vorticity[2];
76+
StrainDotVort[2] = Strain[2][0]*Vorticity[0]+Strain[2][1]*Vorticity[1]+Strain[2][2]*Vorticity[2];
77+
78+
numVecVort[0] = StrainDotVort[1]*Vorticity[2] - StrainDotVort[2]*Vorticity[1];
79+
numVecVort[1] = StrainDotVort[2]*Vorticity[0] - StrainDotVort[0]*Vorticity[2];
80+
numVecVort[2] = StrainDotVort[0]*Vorticity[1] - StrainDotVort[1]*Vorticity[0];
81+
82+
numerator = sqrt(6.0) * sqrt(numVecVort[0]*numVecVort[0] + numVecVort[1]*numVecVort[1] + numVecVort[2]*numVecVort[2]);
83+
trace0 = 3.0*(pow(Strain[0][0],2.0) + pow(Strain[1][1],2.0) + pow(Strain[2][2],2.0));
84+
trace1 = pow(Strain[0][0] + Strain[1][1] + Strain[2][2],2.0);
85+
denominator = pow(Omega, 2.0) * sqrt(trace0-trace1);
86+
87+
Vortex_Tilting(iPoint) = (numerator/denominator) * max(1.0,0.2*LaminarViscosity/muT(iPoint));
88+
89+
AD::SetPreaccOut(Vortex_Tilting(iPoint));
90+
AD::EndPreacc();
91+
}

0 commit comments

Comments
 (0)