Skip to content

Commit 86bf2fb

Browse files
committed
try to simplify limiter,center,muscl logic
1 parent 1454ec1 commit 86bf2fb

2 files changed

Lines changed: 17 additions & 22 deletions

File tree

SU2_CFD/src/solvers/CEulerSolver.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,8 +2223,7 @@ void CEulerSolver::CommonPreprocessing(CGeometry *geometry, CSolver **solver_con
22232223
bool cont_adjoint = config->GetContinuous_Adjoint();
22242224
bool disc_adjoint = config->GetDiscrete_Adjoint();
22252225
bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
2226-
bool center = (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED) ||
2227-
(cont_adjoint && config->GetKind_ConvNumScheme_AdjFlow() == SPACE_CENTERED);
2226+
bool center = (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED);
22282227
bool center_jst = (config->GetKind_Centered_Flow() == JST) && (iMesh == MESH_0);
22292228
bool center_jst_ke = (config->GetKind_Centered_Flow() == JST_KE) && (iMesh == MESH_0);
22302229
bool center_jst_mat = (config->GetKind_Centered_Flow() == JST_MAT) && (iMesh == MESH_0);
@@ -2327,20 +2326,19 @@ void CEulerSolver::CommonPreprocessing(CGeometry *geometry, CSolver **solver_con
23272326
void CEulerSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh,
23282327
unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) {
23292328

2330-
unsigned long InnerIter = config->GetInnerIter();
2331-
bool cont_adjoint = config->GetContinuous_Adjoint();
2332-
bool muscl = (config->GetMUSCL_Flow() || (cont_adjoint && config->GetKind_ConvNumScheme_AdjFlow() == ROE));
2333-
bool limiter = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter());
2334-
bool center = (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED) || (cont_adjoint && config->GetKind_ConvNumScheme_AdjFlow() == SPACE_CENTERED);
2335-
bool van_albada = config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE;
2329+
const auto InnerIter = config->GetInnerIter();
2330+
const bool muscl = config->GetMUSCL_Flow() && (iMesh == MESH_0);
2331+
const bool center = (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED);
2332+
const bool limiter = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter());
2333+
const bool van_albada = (config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE);
23362334

23372335
/*--- Common preprocessing steps. ---*/
23382336

23392337
CommonPreprocessing(geometry, solver_container, config, iMesh, iRKStep, RunTime_EqSystem, Output);
23402338

23412339
/*--- Upwind second order reconstruction ---*/
23422340

2343-
if ((muscl && !center) && (iMesh == MESH_0) && !Output) {
2341+
if (!Output && muscl && !center) {
23442342

23452343
/*--- Gradient computation for MUSCL reconstruction. ---*/
23462344

@@ -2355,10 +2353,8 @@ void CEulerSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container
23552353

23562354
/*--- Limiter computation ---*/
23572355

2358-
if (limiter && (iMesh == MESH_0) && !Output && !van_albada)
2359-
SetPrimitive_Limiter(geometry, config);
2356+
if (limiter && !van_albada) SetPrimitive_Limiter(geometry, config);
23602357
}
2361-
23622358
}
23632359

23642360
unsigned long CEulerSolver::SetPrimitive_Variables(CSolver **solver_container, CConfig *config, bool Output) {

SU2_CFD/src/solvers/CNSSolver.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ CNSSolver::~CNSSolver(void) {
9898
void CNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh,
9999
unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) {
100100

101-
unsigned long InnerIter = config->GetInnerIter();
102-
bool cont_adjoint = config->GetContinuous_Adjoint();
103-
bool limiter_flow = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter());
104-
bool limiter_adjflow = (cont_adjoint && (config->GetKind_SlopeLimit_AdjFlow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter()));
105-
bool van_albada = config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE;
106-
bool wall_functions = config->GetWall_Functions();
101+
const auto InnerIter = config->GetInnerIter();
102+
const bool muscl = config->GetMUSCL_Flow() && (iMesh == MESH_0);
103+
const bool center = (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED);
104+
const bool limiter = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter());
105+
const bool van_albada = (config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE);
106+
const bool wall_functions = config->GetWall_Functions();
107107

108108
/*--- Common preprocessing steps (implemented by CEulerSolver) ---*/
109109

@@ -120,7 +120,7 @@ void CNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, C
120120
SU2_OMP_BARRIER
121121
}
122122

123-
if (config->GetReconstructionGradientRequired() && (iMesh == MESH_0)) {
123+
if (config->GetReconstructionGradientRequired() && muscl && !center) {
124124
switch (config->GetKind_Gradient_Method_Recon()) {
125125
case GREEN_GAUSS:
126126
SetPrimitive_Gradient_GG(geometry, config, true); break;
@@ -146,10 +146,9 @@ void CNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, C
146146
SU2_OMP_BARRIER
147147
}
148148

149-
/*--- Compute the limiter in case we need it in the turbulence model or to limit the
150-
* viscous terms (check this logic with JST and 2nd order turbulence model) ---*/
149+
/*--- Compute the limiters ---*/
151150

152-
if ((iMesh == MESH_0) && (limiter_flow || limiter_adjflow) && !Output && !van_albada) {
151+
if (muscl && !center && limiter && !van_albada && !Output) {
153152
SetPrimitive_Limiter(geometry, config);
154153
}
155154

0 commit comments

Comments
 (0)