@@ -149,6 +149,8 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned
149149
150150 Allocate (*config);
151151
152+ NonPhysicalEdgeCounter.resize (geometry->GetnEdge ()) = 0 ;
153+
152154 /* --- MPI + OpenMP initialization. ---*/
153155
154156 HybridParallelInitialization (*config, *geometry);
@@ -471,7 +473,7 @@ void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short i
471473
472474 case INC_IDEAL_GAS:
473475 fluidModel = new CIncIdealGas (Specific_Heat_CpND, Gas_ConstantND, Pressure_ThermodynamicND);
474- fluidModel->SetTDState_T (Temperature_FreeStreamND);
476+ fluidModel->SetTDState_T (Temperature_FreeStreamND);
475477 break ;
476478
477479 case FLUID_MIXTURE:
@@ -490,7 +492,7 @@ void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short i
490492 }
491493 fluidModel->SetTDState_T (Temperature_FreeStreamND);
492494 break ;
493-
495+
494496 }
495497
496498 if (viscous) {
@@ -1254,36 +1256,27 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont
12541256 checked. Pressure is the dynamic pressure (can be negative). ---*/
12551257
12561258 if (config->GetEnergy_Equation ()) {
1257- bool neg_temperature_i = (Primitive_i[prim_idx.Temperature ()] < 0.0 );
1258- bool neg_temperature_j = (Primitive_j[prim_idx.Temperature ()] < 0.0 );
1259-
1260- bool neg_density_i = (Primitive_i[prim_idx.Density ()] < 0.0 );
1261- bool neg_density_j = (Primitive_j[prim_idx.Density ()] < 0.0 );
1262-
1263- auto update_nonphysical = [&](){
1264- nodes->SetNon_Physical (iPoint, neg_density_i || neg_temperature_i);
1265- nodes->SetNon_Physical (jPoint, neg_density_j || neg_temperature_j);
1266-
1267- /* Lastly, check for existing first-order points still active from previous iterations. */
1259+ const bool neg_temperature_i = (Primitive_i[prim_idx.Temperature ()] < 0.0 );
1260+ const bool neg_temperature_j = (Primitive_j[prim_idx.Temperature ()] < 0.0 );
1261+
1262+ const bool neg_density_i = (Primitive_i[prim_idx.Density ()] < 0.0 );
1263+ const bool neg_density_j = (Primitive_j[prim_idx.Density ()] < 0.0 );
1264+
1265+ bool bad_recon = neg_temperature_i || neg_temperature_j || neg_density_i || neg_density_j;
1266+ if (bad_recon) {
1267+ /* --- Force 1st order for this edge for at least 20 iterations. ---*/
1268+ NonPhysicalEdgeCounter[iEdge] = 20 ;
1269+ } else if (NonPhysicalEdgeCounter[iEdge] > 0 ) {
1270+ --NonPhysicalEdgeCounter[iEdge];
1271+ bad_recon = true ;
1272+ }
1273+ counter_local += bad_recon;
12681274
1269- if (nodes->GetNon_Physical (iPoint)) {
1270- counter_local++;
1271- for (iVar = 0 ; iVar < nPrimVar; iVar++)
1272- Primitive_i[iVar] = V_i[iVar];
1273- }
1274- if (nodes->GetNon_Physical (jPoint)) {
1275- counter_local++;
1276- for (iVar = 0 ; iVar < nPrimVar; iVar++)
1277- Primitive_j[iVar] = V_j[iVar];
1275+ if (bad_recon) {
1276+ for (iVar = 0 ; iVar < nPrimVar; iVar++) {
1277+ Primitive_i[iVar] = V_i[iVar];
1278+ Primitive_j[iVar] = V_j[iVar];
12781279 }
1279- };
1280-
1281- if (ReducerStrategy){
1282- SU2_OMP_CRITICAL
1283- update_nonphysical ();
1284- END_SU2_OMP_CRITICAL
1285- } else {
1286- update_nonphysical ();
12871280 }
12881281 }
12891282
@@ -2235,7 +2228,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
22352228 Flow_Dir = Inlet_FlowDir[val_marker][iVertex];
22362229 Flow_Dir_Mag = GeometryToolbox::Norm (nDim, Flow_Dir);
22372230
2238- /* --- Store the unit flow direction vector.
2231+ /* --- Store the unit flow direction vector.
22392232 If requested, use the local boundary normal (negative),
22402233 instead of the prescribed flow direction in the config. ---*/
22412234
@@ -2352,7 +2345,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
23522345 V_inlet[iDim+prim_idx.Velocity ()] = nodes->GetVelocity (iPoint,iDim);
23532346 /* pressure obtained from interior */
23542347 V_inlet[prim_idx.Pressure ()] = nodes->GetPressure (iPoint);
2355- }
2348+ }
23562349
23572350 /* --- Access density at the node. This is either constant by
23582351 construction, or will be set fixed implicitly by the temperature
0 commit comments