Skip to content

Commit 6a680ec

Browse files
committed
work around some forward mode issues
1 parent 1166497 commit 6a680ec

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

  • SU2_CFD/include/numerics_simd/flow/convection

‎SU2_CFD/include/numerics_simd/flow/convection/common.hpp‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,12 @@ FORCEINLINE CPair<ReconVarType> reconstructPrimitives(Int iEdge, Int iPoint, Int
132132
break;
133133
}
134134
/*--- Detect a non-physical reconstruction based on negative pressure or density. ---*/
135-
const Double neg_p_or_rho = fmax(fmin(V.i.pressure(), V.j.pressure()) < 0.0,
136-
fmin(V.i.density(), V.j.density()) < 0.0);
135+
/*--- Some weird issues with forward AD if this is all done in one line. ---*/
136+
const Double neg_p = fmin(V.i.pressure(), V.j.pressure()) < 0.0;
137+
const Double neg_rho = fmin(V.i.density(), V.j.density()) < 0.0;
138+
const Double neg_p_or_rho = fmax(neg_p, neg_rho);
137139
/*--- Test the sign of the Roe-averaged speed of sound. ---*/
138-
const Double R = sqrt(V.j.density() / V.i.density());
140+
const Double R = sqrt(abs(V.j.density() / V.i.density()));
139141
/*--- Delay dividing by R+1 until comparing enthalpy and velocity magnitude. ---*/
140142
const Double enthalpy = R*V.j.enthalpy() + V.i.enthalpy();
141143
Double v_squared = 0.0;

0 commit comments

Comments
 (0)