Skip to content

Commit a2da75e

Browse files
authored
Merge pull request #1052 from su2code/fix_jst_ke
Fix JST-KE
2 parents 183da05 + 842585f commit a2da75e

2 files changed

Lines changed: 66 additions & 24 deletions

File tree

SU2_CFD/include/solvers/CEulerSolver.hpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ class CEulerSolver : public CFVMFlowSolverBase<CEulerVariable, COMPRESSIBLE> {
240240
*/
241241
void ReadActDisk_InputFile(CGeometry *geometry, CSolver **solver_container,
242242
CConfig *config, unsigned short iMesh, bool Output);
243+
243244
/*!
244245
* \brief Compute the max eigenvalue.
245246
* \param[in] geometry - Geometrical definition of the problem.
@@ -248,13 +249,18 @@ class CEulerSolver : public CFVMFlowSolverBase<CEulerVariable, COMPRESSIBLE> {
248249
void SetMax_Eigenvalue(CGeometry *geometry, CConfig *config);
249250

250251
/*!
251-
* \brief Compute the undivided laplacian for the solution and the
252-
* dissipation sensor for centered schemes.
252+
* \brief Compute the undivided laplacian for the solution.
253+
* \param[in] geometry - Geometrical definition of the problem.
254+
* \param[in] config - Definition of the particular problem.
255+
*/
256+
void SetUndivided_Laplacian(CGeometry *geometry, const CConfig *config);
257+
258+
/*!
259+
* \brief Compute the dissipation sensor for centered schemes.
253260
* \param[in] geometry - Geometrical definition of the problem.
254261
* \param[in] config - Definition of the particular problem.
255262
*/
256-
void SetUndivided_Laplacian_And_Centered_Dissipation_Sensor(CGeometry *geometry,
257-
CConfig *config);
263+
void SetCentered_Dissipation_Sensor(CGeometry *geometry, const CConfig *config);
258264

259265
/*!
260266
* \brief A virtual member.

SU2_CFD/src/solvers/CEulerSolver.cpp

Lines changed: 56 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,6 +2204,7 @@ void CEulerSolver::CommonPreprocessing(CGeometry *geometry, CSolver **solver_con
22042204
bool center = (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED) ||
22052205
(cont_adjoint && config->GetKind_ConvNumScheme_AdjFlow() == SPACE_CENTERED);
22062206
bool center_jst = (config->GetKind_Centered_Flow() == JST) && (iMesh == MESH_0);
2207+
bool center_jst_ke = (config->GetKind_Centered_Flow() == JST_KE) && (iMesh == MESH_0);
22072208
bool engine = ((config->GetnMarker_EngineInflow() != 0) || (config->GetnMarker_EngineExhaust() != 0));
22082209
bool actuator_disk = ((config->GetnMarker_ActDiskInlet() != 0) || (config->GetnMarker_ActDiskOutlet() != 0));
22092210
bool nearfield = (config->GetnMarker_NearFieldBound() != 0);
@@ -2274,8 +2275,8 @@ void CEulerSolver::CommonPreprocessing(CGeometry *geometry, CSolver **solver_con
22742275

22752276
if (center && !Output) {
22762277
SetMax_Eigenvalue(geometry, config);
2277-
if (center_jst)
2278-
SetUndivided_Laplacian_And_Centered_Dissipation_Sensor(geometry, config);
2278+
if (center_jst) SetUndivided_Laplacian(geometry, config);
2279+
if (center_jst || center_jst_ke) SetCentered_Dissipation_Sensor(geometry, config);
22792280
}
22802281

22812282
/*--- Roe Low Dissipation Sensor ---*/
@@ -2622,6 +2623,7 @@ void CEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_conta
26222623

26232624
const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
26242625
const bool jst_scheme = (config->GetKind_Centered_Flow() == JST) && (iMesh == MESH_0);
2626+
const bool jst_ke_scheme = (config->GetKind_Centered_Flow() == JST_KE) && (iMesh == MESH_0);
26252627

26262628
/*--- Pick one numerics object per thread. ---*/
26272629
CNumerics* numerics = numerics_container[CONV_TERM + omp_get_thread_num()*MAX_TERMS];
@@ -2656,8 +2658,9 @@ void CEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_conta
26562658
if (jst_scheme) {
26572659
numerics->SetUndivided_Laplacian(nodes->GetUndivided_Laplacian(iPoint),
26582660
nodes->GetUndivided_Laplacian(jPoint));
2659-
numerics->SetSensor(nodes->GetSensor(iPoint),
2660-
nodes->GetSensor(jPoint));
2661+
}
2662+
if (jst_scheme || jst_ke_scheme) {
2663+
numerics->SetSensor(nodes->GetSensor(iPoint), nodes->GetSensor(jPoint));
26612664
}
26622665

26632666
/*--- Grid movement ---*/
@@ -3333,11 +3336,7 @@ void CEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) {
33333336

33343337
}
33353338

3336-
void CEulerSolver::SetUndivided_Laplacian_And_Centered_Dissipation_Sensor(CGeometry *geometry, CConfig *config) {
3337-
3338-
/*--- We can access memory more efficiently if there are no periodic boundaries. ---*/
3339-
3340-
const bool isPeriodic = (config->GetnMarker_Periodic() > 0);
3339+
void CEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, const CConfig *config) {
33413340

33423341
/*--- Loop domain points. ---*/
33433342

@@ -3351,9 +3350,6 @@ void CEulerSolver::SetUndivided_Laplacian_And_Centered_Dissipation_Sensor(CGeome
33513350
for (unsigned short iVar = 0; iVar < nVar; iVar++)
33523351
nodes->SetUnd_Lapl(iPoint, iVar, 0.0);
33533352

3354-
iPoint_UndLapl[iPoint] = 0.0;
3355-
jPoint_UndLapl[iPoint] = 0.0;
3356-
33573353
/*--- Loop over the neighbors of point i. ---*/
33583354
for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh)
33593355
{
@@ -3370,23 +3366,66 @@ void CEulerSolver::SetUndivided_Laplacian_And_Centered_Dissipation_Sensor(CGeome
33703366

33713367
su2double Pressure_j = nodes->GetPressure(jPoint);
33723368
nodes->AddUnd_Lapl(iPoint, nVar-1, Pressure_j-Pressure_i);
3369+
}
3370+
}
3371+
3372+
/*--- Correct the Laplacian across any periodic boundaries. ---*/
3373+
3374+
for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) {
3375+
InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_LAPLACIAN);
3376+
CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_LAPLACIAN);
3377+
}
3378+
3379+
/*--- MPI parallelization ---*/
3380+
3381+
InitiateComms(geometry, config, UNDIVIDED_LAPLACIAN);
3382+
CompleteComms(geometry, config, UNDIVIDED_LAPLACIAN);
3383+
3384+
}
3385+
3386+
void CEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, const CConfig *config) {
3387+
3388+
/*--- We can access memory more efficiently if there are no periodic boundaries. ---*/
3389+
3390+
const bool isPeriodic = (config->GetnMarker_Periodic() > 0);
3391+
3392+
/*--- Loop domain points. ---*/
3393+
3394+
SU2_OMP_FOR_DYN(omp_chunk_size)
3395+
for (unsigned long iPoint = 0; iPoint < nPointDomain; ++iPoint) {
3396+
3397+
const bool boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint);
3398+
const su2double Pressure_i = nodes->GetPressure(iPoint);
3399+
3400+
/*--- Initialize. ---*/
3401+
iPoint_UndLapl[iPoint] = 0.0;
3402+
jPoint_UndLapl[iPoint] = 0.0;
3403+
3404+
/*--- Loop over the neighbors of point i. ---*/
3405+
for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh)
3406+
{
3407+
auto jPoint = geometry->nodes->GetPoint(iPoint, iNeigh);
3408+
bool boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint);
3409+
3410+
/*--- If iPoint is boundary it only takes contributions from other boundary points. ---*/
3411+
if (boundary_i && !boundary_j) continue;
3412+
3413+
su2double Pressure_j = nodes->GetPressure(jPoint);
33733414

33743415
/*--- Dissipation sensor, add pressure difference and pressure sum. ---*/
33753416
iPoint_UndLapl[iPoint] += Pressure_j - Pressure_i;
33763417
jPoint_UndLapl[iPoint] += Pressure_j + Pressure_i;
33773418
}
33783419

3379-
if (!isPeriodic)
3420+
if (!isPeriodic) {
33803421
nodes->SetSensor(iPoint, fabs(iPoint_UndLapl[iPoint]) / jPoint_UndLapl[iPoint]);
3422+
}
33813423
}
33823424

33833425
if (isPeriodic) {
3384-
/*--- Correct the Laplacian and sensor values across any periodic boundaries. ---*/
3426+
/*--- Correct the sensor values across any periodic boundaries. ---*/
33853427

33863428
for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) {
3387-
InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_LAPLACIAN);
3388-
CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_LAPLACIAN);
3389-
33903429
InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_SENSOR);
33913430
CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_SENSOR);
33923431
}
@@ -3400,9 +3439,6 @@ void CEulerSolver::SetUndivided_Laplacian_And_Centered_Dissipation_Sensor(CGeome
34003439

34013440
/*--- MPI parallelization ---*/
34023441

3403-
InitiateComms(geometry, config, UNDIVIDED_LAPLACIAN);
3404-
CompleteComms(geometry, config, UNDIVIDED_LAPLACIAN);
3405-
34063442
InitiateComms(geometry, config, SENSOR);
34073443
CompleteComms(geometry, config, SENSOR);
34083444

0 commit comments

Comments
 (0)