Skip to content

Commit 32df281

Browse files
committed
Add SST Limiter Output
1 parent ff1965d commit 32df281

File tree

5 files changed

+45
-16
lines changed

5 files changed

+45
-16
lines changed

SU2_CFD/include/variables/CTurbSSTVariable.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ class CTurbSSTVariable final : public CTurbVariable {
4141
su2double sigma_om2;
4242
su2double beta_star;
4343
su2double prod_lim_const;
44+
su2double a1;
4445
VectorType F1;
4546
VectorType F2; /*!< \brief Menter blending function for blending of k-w and k-eps. */
4647
VectorType CDkw; /*!< \brief Cross-diffusion. */
48+
VectorType SST_Limiter;
4749
SST_ParsedOptions sstParsedOptions;
4850
public:
4951
/*!
@@ -71,7 +73,7 @@ class CTurbSSTVariable final : public CTurbVariable {
7173
* \param[in] val_dist - Value of the distance to the wall.
7274
* \param[in] val_density - Value of the density.
7375
*/
74-
void SetBlendingFunc(unsigned long iPoint, su2double val_viscosity, su2double val_dist, su2double val_density, TURB_TRANS_MODEL trans_model) override;
76+
void SetBlendingFunc(unsigned long iPoint, su2double val_viscosity, su2double val_dist, su2double val_density, su2double vorticity_mag, TURB_TRANS_MODEL trans_model) override;
7577

7678
/*!
7779
* \brief Get the first blending function.
@@ -87,4 +89,9 @@ class CTurbSSTVariable final : public CTurbVariable {
8789
* \brief Get the value of the cross diffusion of tke and omega.
8890
*/
8991
inline su2double GetCrossDiff(unsigned long iPoint) const override { return CDkw(iPoint); }
92+
/*!
93+
* \brief Get the value of the SST Limiter.
94+
*/
95+
inline su2double GetSSTLimiter(unsigned long iPoint) const { return SST_Limiter[iPoint]; }
96+
9097
};

SU2_CFD/include/variables/CVariable.hpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1656,7 +1656,7 @@ class CVariable {
16561656
* \param[in] val_density - Value of the density.
16571657
* \param[in] val_dist - Value of the distance to the wall.
16581658
*/
1659-
inline virtual void SetBlendingFunc(unsigned long iPoint, su2double val_viscosity, su2double val_dist, su2double val_density, TURB_TRANS_MODEL trans_model) {}
1659+
inline virtual void SetBlendingFunc(unsigned long iPoint, su2double val_viscosity, su2double val_dist, su2double val_density, su2double vorticity_mag, TURB_TRANS_MODEL trans_model) {}
16601660

16611661
/*!
16621662
* \brief Get the first blending function of the SST model.
@@ -1673,6 +1673,17 @@ class CVariable {
16731673
*/
16741674
inline virtual su2double GetCrossDiff(unsigned long iPoint) const { return 0.0; }
16751675

1676+
/*!
1677+
* \brief Get the value of the SST Limiter.
1678+
*/
1679+
inline virtual su2double GetSSTLimiter(unsigned long iPoint) const { return 0.0; }
1680+
1681+
1682+
/*!
1683+
* \brief Set the value of the SST Limiter.
1684+
*/
1685+
inline virtual su2double SetSSTLimiter(unsigned long iPoint) const { return 0.0; }
1686+
16761687
/*!
16771688
* \brief Get the value of the eddy viscosity.
16781689
* \return the value of the eddy viscosity.

SU2_CFD/src/output/CFlowOutput.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,10 @@ void CFlowOutput::SetVolumeOutputFieldsScalarPrimitive(const CConfig* config) {
14221422

14231423
if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) {
14241424
AddVolumeOutput("EDDY_VISCOSITY", "Eddy_Viscosity", "PRIMITIVE", "Turbulent eddy viscosity");
1425+
/*--- SST Limiter ---*/
1426+
if (config->GetKind_Turb_Model() == TURB_MODEL::SST) {
1427+
AddVolumeOutput("SST_LIMITER", "SST_Limiter", "PRIMITIVE", "SST viscosity limiter");
1428+
}
14251429
}
14261430

14271431
}
@@ -1559,6 +1563,11 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con
15591563
SetVolumeOutputValue("EDDY_VISCOSITY", iPoint, Node_Flow->GetEddyViscosity(iPoint));
15601564
SetVolumeOutputValue("TURB_DELTA_TIME", iPoint, Node_Turb->GetDelta_Time(iPoint));
15611565
SetVolumeOutputValue("TURB_CFL", iPoint, Node_Turb->GetLocalCFL(iPoint));
1566+
/*--- SST Limiter ---*/
1567+
if (config->GetKind_Turb_Model() == TURB_MODEL::SST) {
1568+
SetVolumeOutputValue("SST_LIMITER", iPoint, Node_Turb->GetSSTLimiter(iPoint));
1569+
su2double sst_lim = Node_Turb->GetSSTLimiter(iPoint);
1570+
}
15621571
}
15631572

15641573
if (config->GetSAParsedOptions().bc) {

SU2_CFD/src/solvers/CTurbSSTSolver.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai
233233

234234
const su2double VorticityMag = max(GeometryToolbox::Norm(3, flowNodes->GetVorticity(iPoint)), 1e-12);
235235
const su2double StrainMag = max(flowNodes->GetStrainMag(iPoint), 1e-12);
236-
nodes->SetBlendingFunc(iPoint, mu, dist, rho, config->GetKind_Trans_Model());
236+
nodes->SetBlendingFunc(iPoint, mu, dist, rho, VorticityMag, config->GetKind_Trans_Model());
237237

238238
const su2double F2 = nodes->GetF2blending(iPoint);
239239

@@ -425,12 +425,12 @@ void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont
425425

426426
/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
427427
if (geometry->nodes->GetDomain(iPoint)) {
428+
const auto options = config->GetROUGHSSTParsedOptions();
428429

429430
/*--- distance to closest neighbor ---*/
430431
su2double wall_dist = geometry->vertex[val_marker][iVertex]->GetNearestNeighborDistance();
431432

432433
if (rough_wall) {
433-
434434
/*--- Set wall values ---*/
435435
su2double density = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint);
436436
su2double laminar_viscosity = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint);
@@ -445,11 +445,10 @@ void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont
445445

446446
su2double S_R= 0.0;
447447
su2double solution[2] = {};
448-
449448
/*--- Modify the omega and k to account for a rough wall. ---*/
450449

451450
/*--- Reference 1 original Wilcox (1998) ---*/
452-
if (roughsstParsedOptions.wilcox1998) {
451+
if (options.wilcox1998) {
453452
if (kPlus <= 25)
454453
S_R = (50/(kPlus+EPS))*(50/(kPlus+EPS));
455454
else
@@ -458,7 +457,7 @@ void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont
458457
solution[0] = 0.0;
459458
solution[1] = FrictionVel*FrictionVel*S_R/(laminar_viscosity/density);
460459
}
461-
else if (roughsstParsedOptions.wilcox2006) {
460+
else if (options.wilcox2006) {
462461
/*--- Reference 2 from D.C. Wilcox Turbulence Modeling for CFD (2006) ---*/
463462
if (kPlus <= 5)
464463
S_R = pow(200/(kPlus+EPS),2);
@@ -469,8 +468,7 @@ void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont
469468
solution[1] = FrictionVel*FrictionVel*S_R/(laminar_viscosity/density);
470469
}
471470
/*--- Knopp eddy viscosity limiter ---*/
472-
else if (roughsstParsedOptions.limiter_knopp) {
473-
471+
else if (options.limiter_knopp) {
474472
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));
475473
solution[0] = (FrictionVel*FrictionVel / sqrt(constants[6]))*min(1.0, kPlus / 90.0);
476474

@@ -479,8 +477,7 @@ void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont
479477
solution[1] = min( FrictionVel/(sqrt(constants[6])*d0*kappa), 60.0*laminar_viscosity/(density*beta_1*pow(wall_dist,2)));
480478
}
481479
/*--- Aupoix eddy viscosity limiter ---*/
482-
else if (roughsstParsedOptions.limiter_aupoix) {
483-
480+
else if (options.limiter_aupoix) {
484481
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));
485482
su2double kwallPlus = max(0.0, k0Plus);
486483
su2double kwall = kwallPlus*FrictionVel*FrictionVel;
@@ -489,16 +486,13 @@ void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont
489486

490487
solution[0] = kwall;
491488
solution[1] = omegawallPlus*FrictionVel*FrictionVel*density/laminar_viscosity;
492-
493489
}
494-
495490
/*--- Set the solution values and zero the residual ---*/
496491
nodes->SetSolution_Old(iPoint,solution);
497492
nodes->SetSolution(iPoint,solution);
498493
LinSysRes.SetBlock_Zero(iPoint);
499494

500495
} else { // smooth wall
501-
502496
/*--- Set wall values ---*/
503497
su2double density = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint);
504498
su2double laminar_viscosity = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint);

SU2_CFD/src/variables/CTurbSSTVariable.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,18 @@ CTurbSSTVariable::CTurbSSTVariable(su2double kine, su2double omega, su2double mu
4545
sigma_om2 = constants[3];
4646
beta_star = constants[6];
4747
prod_lim_const = constants[10];
48+
a1 = constants[7];
4849

4950
F1.resize(nPoint) = su2double(1.0);
5051
F2.resize(nPoint) = su2double(0.0);
5152
CDkw.resize(nPoint) = su2double(0.0);
53+
SST_Limiter.resize(nPoint, 1.0);
5254

5355
muT.resize(nPoint) = mut;
5456
}
5557

5658
void CTurbSSTVariable::SetBlendingFunc(unsigned long iPoint, su2double val_viscosity,
57-
su2double val_dist, su2double val_density, TURB_TRANS_MODEL trans_model) {
59+
su2double val_dist, su2double val_density, su2double vorticity_mag, TURB_TRANS_MODEL trans_model) {
5860
su2double arg2, arg2A, arg2B, arg1;
5961

6062
AD::StartPreacc();
@@ -91,7 +93,13 @@ void CTurbSSTVariable::SetBlendingFunc(unsigned long iPoint, su2double val_visco
9193
F1(iPoint) = max(F1(iPoint), F3);
9294
}
9395

94-
AD::SetPreaccOut(F1(iPoint)); AD::SetPreaccOut(F2(iPoint)); AD::SetPreaccOut(CDkw(iPoint));
96+
/*--- SST Limiter ---*/
97+
98+
su2double limiter = a1*Solution(iPoint,1) / (F2(iPoint)*vorticity_mag + EPS);
99+
limiter = min(1.0, limiter);
100+
SST_Limiter(iPoint) = limiter;
101+
102+
AD::SetPreaccOut(F1(iPoint)); AD::SetPreaccOut(F2(iPoint)); AD::SetPreaccOut(CDkw(iPoint)); AD::SetPreaccOut(SST_Limiter(iPoint));
95103
AD::EndPreacc();
96104

97105
}

0 commit comments

Comments
 (0)