Skip to content

Commit eac088b

Browse files
committed
fix race condition
1 parent 10f2e15 commit eac088b

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

SU2_CFD/src/solvers/CNSSolver.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ void CNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, C
101101
unsigned long InnerIter = config->GetInnerIter();
102102
bool cont_adjoint = config->GetContinuous_Adjoint();
103103
bool limiter_flow = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter());
104-
bool limiter_turb = (config->GetKind_SlopeLimit_Turb() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter());
105104
bool limiter_adjflow = (cont_adjoint && (config->GetKind_SlopeLimit_AdjFlow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter()));
106105
bool van_albada = config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE;
107106
bool wall_functions = config->GetWall_Functions();
@@ -114,7 +113,12 @@ void CNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, C
114113
turbulence solver) only density and velocity are needed ---*/
115114

116115
const auto nPrimVarGrad_bak = nPrimVarGrad;
117-
if (Output) nPrimVarGrad = 1+nDim;
116+
if (Output) {
117+
SU2_OMP_BARRIER
118+
SU2_OMP_MASTER
119+
nPrimVarGrad = 1+nDim;
120+
SU2_OMP_BARRIER
121+
}
118122

119123
if (config->GetReconstructionGradientRequired() && (iMesh == MESH_0)) {
120124
switch (config->GetKind_Gradient_Method_Recon()) {
@@ -136,12 +140,16 @@ void CNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, C
136140
SetPrimitive_Gradient_LS(geometry, config);
137141
}
138142

139-
nPrimVarGrad = nPrimVarGrad_bak;
143+
if (Output) {
144+
SU2_OMP_MASTER
145+
nPrimVarGrad = nPrimVarGrad_bak;
146+
SU2_OMP_BARRIER
147+
}
140148

141149
/*--- Compute the limiter in case we need it in the turbulence model or to limit the
142150
* viscous terms (check this logic with JST and 2nd order turbulence model) ---*/
143151

144-
if ((iMesh == MESH_0) && (limiter_flow || limiter_turb || limiter_adjflow) && !Output && !van_albada) {
152+
if ((iMesh == MESH_0) && (limiter_flow || limiter_adjflow) && !Output && !van_albada) {
145153
SetPrimitive_Limiter(geometry, config);
146154
}
147155

0 commit comments

Comments
 (0)