Skip to content

Commit db4958f

Browse files
committed
centered sensor also needed for JST-KE
1 parent 574c286 commit db4958f

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
@@ -379,6 +379,7 @@ class CEulerSolver : public CSolver {
379379
*/
380380
void ReadActDisk_InputFile(CGeometry *geometry, CSolver **solver_container,
381381
CConfig *config, unsigned short iMesh, bool Output);
382+
382383
/*!
383384
* \brief Compute the max eigenvalue.
384385
* \param[in] geometry - Geometrical definition of the problem.
@@ -387,13 +388,18 @@ class CEulerSolver : public CSolver {
387388
void SetMax_Eigenvalue(CGeometry *geometry, CConfig *config);
388389

389390
/*!
390-
* \brief Compute the undivided laplacian for the solution and the
391-
* dissipation sensor for centered schemes.
391+
* \brief Compute the undivided laplacian for the solution.
392+
* \param[in] geometry - Geometrical definition of the problem.
393+
* \param[in] config - Definition of the particular problem.
394+
*/
395+
void SetUndivided_Laplacian(CGeometry *geometry, const CConfig *config);
396+
397+
/*!
398+
* \brief Compute the dissipation sensor for centered schemes.
392399
* \param[in] geometry - Geometrical definition of the problem.
393400
* \param[in] config - Definition of the particular problem.
394401
*/
395-
void SetUndivided_Laplacian_And_Centered_Dissipation_Sensor(CGeometry *geometry,
396-
CConfig *config);
402+
void SetCentered_Dissipation_Sensor(CGeometry *geometry, const CConfig *config);
397403

398404
/*!
399405
* \brief A virtual member.

SU2_CFD/src/solvers/CEulerSolver.cpp

Lines changed: 56 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2528,6 +2528,7 @@ void CEulerSolver::CommonPreprocessing(CGeometry *geometry, CSolver **solver_con
25282528
bool center = (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED) ||
25292529
(cont_adjoint && config->GetKind_ConvNumScheme_AdjFlow() == SPACE_CENTERED);
25302530
bool center_jst = (config->GetKind_Centered_Flow() == JST) && (iMesh == MESH_0);
2531+
bool center_jst_ke = (config->GetKind_Centered_Flow() == JST_KE) && (iMesh == MESH_0);
25312532
bool engine = ((config->GetnMarker_EngineInflow() != 0) || (config->GetnMarker_EngineExhaust() != 0));
25322533
bool actuator_disk = ((config->GetnMarker_ActDiskInlet() != 0) || (config->GetnMarker_ActDiskOutlet() != 0));
25332534
bool nearfield = (config->GetnMarker_NearFieldBound() != 0);
@@ -2598,8 +2599,8 @@ void CEulerSolver::CommonPreprocessing(CGeometry *geometry, CSolver **solver_con
25982599

25992600
if (center && !Output) {
26002601
SetMax_Eigenvalue(geometry, config);
2601-
if (center_jst)
2602-
SetUndivided_Laplacian_And_Centered_Dissipation_Sensor(geometry, config);
2602+
if (center_jst) SetUndivided_Laplacian(geometry, config);
2603+
if (center_jst || center_jst_ke) SetCentered_Dissipation_Sensor(geometry, config);
26032604
}
26042605

26052606
/*--- Roe Low Dissipation Sensor ---*/
@@ -2946,6 +2947,7 @@ void CEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_conta
29462947

29472948
const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
29482949
const bool jst_scheme = (config->GetKind_Centered_Flow() == JST) && (iMesh == MESH_0);
2950+
const bool jst_ke_scheme = (config->GetKind_Centered_Flow() == JST_KE) && (iMesh == MESH_0);
29492951

29502952
/*--- Pick one numerics object per thread. ---*/
29512953
CNumerics* numerics = numerics_container[CONV_TERM + omp_get_thread_num()*MAX_TERMS];
@@ -2980,8 +2982,9 @@ void CEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_conta
29802982
if (jst_scheme) {
29812983
numerics->SetUndivided_Laplacian(nodes->GetUndivided_Laplacian(iPoint),
29822984
nodes->GetUndivided_Laplacian(jPoint));
2983-
numerics->SetSensor(nodes->GetSensor(iPoint),
2984-
nodes->GetSensor(jPoint));
2985+
}
2986+
if (jst_scheme || jst_ke_scheme) {
2987+
numerics->SetSensor(nodes->GetSensor(iPoint), nodes->GetSensor(jPoint));
29852988
}
29862989

29872990
/*--- Grid movement ---*/
@@ -3657,11 +3660,7 @@ void CEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) {
36573660

36583661
}
36593662

3660-
void CEulerSolver::SetUndivided_Laplacian_And_Centered_Dissipation_Sensor(CGeometry *geometry, CConfig *config) {
3661-
3662-
/*--- We can access memory more efficiently if there are no periodic boundaries. ---*/
3663-
3664-
const bool isPeriodic = (config->GetnMarker_Periodic() > 0);
3663+
void CEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, const CConfig *config) {
36653664

36663665
/*--- Loop domain points. ---*/
36673666

@@ -3675,9 +3674,6 @@ void CEulerSolver::SetUndivided_Laplacian_And_Centered_Dissipation_Sensor(CGeome
36753674
for (unsigned short iVar = 0; iVar < nVar; iVar++)
36763675
nodes->SetUnd_Lapl(iPoint, iVar, 0.0);
36773676

3678-
iPoint_UndLapl[iPoint] = 0.0;
3679-
jPoint_UndLapl[iPoint] = 0.0;
3680-
36813677
/*--- Loop over the neighbors of point i. ---*/
36823678
for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh)
36833679
{
@@ -3694,23 +3690,66 @@ void CEulerSolver::SetUndivided_Laplacian_And_Centered_Dissipation_Sensor(CGeome
36943690

36953691
su2double Pressure_j = nodes->GetPressure(jPoint);
36963692
nodes->AddUnd_Lapl(iPoint, nVar-1, Pressure_j-Pressure_i);
3693+
}
3694+
}
3695+
3696+
/*--- Correct the Laplacian across any periodic boundaries. ---*/
3697+
3698+
for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) {
3699+
InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_LAPLACIAN);
3700+
CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_LAPLACIAN);
3701+
}
3702+
3703+
/*--- MPI parallelization ---*/
3704+
3705+
InitiateComms(geometry, config, UNDIVIDED_LAPLACIAN);
3706+
CompleteComms(geometry, config, UNDIVIDED_LAPLACIAN);
3707+
3708+
}
3709+
3710+
void CEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, const CConfig *config) {
3711+
3712+
/*--- We can access memory more efficiently if there are no periodic boundaries. ---*/
3713+
3714+
const bool isPeriodic = (config->GetnMarker_Periodic() > 0);
3715+
3716+
/*--- Loop domain points. ---*/
3717+
3718+
SU2_OMP_FOR_DYN(omp_chunk_size)
3719+
for (unsigned long iPoint = 0; iPoint < nPointDomain; ++iPoint) {
3720+
3721+
const bool boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint);
3722+
const su2double Pressure_i = nodes->GetPressure(iPoint);
3723+
3724+
/*--- Initialize. ---*/
3725+
iPoint_UndLapl[iPoint] = 0.0;
3726+
jPoint_UndLapl[iPoint] = 0.0;
3727+
3728+
/*--- Loop over the neighbors of point i. ---*/
3729+
for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh)
3730+
{
3731+
auto jPoint = geometry->nodes->GetPoint(iPoint, iNeigh);
3732+
bool boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint);
3733+
3734+
/*--- If iPoint is boundary it only takes contributions from other boundary points. ---*/
3735+
if (boundary_i && !boundary_j) continue;
3736+
3737+
su2double Pressure_j = nodes->GetPressure(jPoint);
36973738

36983739
/*--- Dissipation sensor, add pressure difference and pressure sum. ---*/
36993740
iPoint_UndLapl[iPoint] += Pressure_j - Pressure_i;
37003741
jPoint_UndLapl[iPoint] += Pressure_j + Pressure_i;
37013742
}
37023743

3703-
if (!isPeriodic)
3744+
if (!isPeriodic) {
37043745
nodes->SetSensor(iPoint, fabs(iPoint_UndLapl[iPoint]) / jPoint_UndLapl[iPoint]);
3746+
}
37053747
}
37063748

37073749
if (isPeriodic) {
3708-
/*--- Correct the Laplacian and sensor values across any periodic boundaries. ---*/
3750+
/*--- Correct the sensor values across any periodic boundaries. ---*/
37093751

37103752
for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) {
3711-
InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_LAPLACIAN);
3712-
CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_LAPLACIAN);
3713-
37143753
InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_SENSOR);
37153754
CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_SENSOR);
37163755
}
@@ -3724,9 +3763,6 @@ void CEulerSolver::SetUndivided_Laplacian_And_Centered_Dissipation_Sensor(CGeome
37243763

37253764
/*--- MPI parallelization ---*/
37263765

3727-
InitiateComms(geometry, config, UNDIVIDED_LAPLACIAN);
3728-
CompleteComms(geometry, config, UNDIVIDED_LAPLACIAN);
3729-
37303766
InitiateComms(geometry, config, SENSOR);
37313767
CompleteComms(geometry, config, SENSOR);
37323768

0 commit comments

Comments
 (0)