Skip to content

Commit

Permalink
fix an FPE in the shock detection (#2710)
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored Jan 12, 2024
1 parent d0b4d6a commit 44d0e55
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Source/hydro/advection_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,12 @@ Castro::shock(const Box& bx,
q_arr(i,j,k,QV) * q_arr(i,j,k,QV) +
q_arr(i,j,k,QW) * q_arr(i,j,k,QW));

Real gradPdx_over_P = std::abs(dP_x * q_arr(i,j,k,QU) +
dP_y * q_arr(i,j,k,QV) +
dP_z * q_arr(i,j,k,QW)) / vel;
Real gradPdx_over_P{0.0_rt};
if (vel != 0.0) {
gradPdx_over_P = std::abs(dP_x * q_arr(i,j,k,QU) +
dP_y * q_arr(i,j,k,QV) +
dP_z * q_arr(i,j,k,QW)) / vel;
}
gradPdx_over_P /= (q_arr(i,j,k,QPRES) / std::max(dx[0], std::max(dx[1], dx[2])));

if (gradPdx_over_P > castro::shock_detection_threshold && div_u < 0.0_rt) {
Expand Down

0 comments on commit 44d0e55

Please sign in to comment.