diff --git a/amr-wind/immersed_boundary/bluff_body/box_ops.H b/amr-wind/immersed_boundary/bluff_body/box_ops.H index 4c2175f7a0..11567c6366 100644 --- a/amr-wind/immersed_boundary/bluff_body/box_ops.H +++ b/amr-wind/immersed_boundary/bluff_body/box_ops.H @@ -76,21 +76,23 @@ struct InitDataOp const amrex::Real y = problo[1] + (j + 0.5) * dx[1]; const amrex::Real z = problo[2] + (k + 0.5) * dx[2]; + amrex::Real phi_loc = 0; if ((std::abs(x - x0) <= 0.5 * l) && (std::abs(y - y0) <= 0.5 * w) && (std::abs(z - z0) <= 0.5 * h)) { - phi(i, j, k) = std::max( + phi_loc = std::max( std::abs(x - x0) - 0.5 * l, std::max( std::abs(y - y0) - 0.5 * w, std::abs(z - z0) - 0.5 * h)); } else { - phi(i, j, k) = std::min( + phi_loc = std::min( std::abs(std::abs(x - x0) - 0.5 * l), std::min( std::abs(std::abs(y - y0) - 0.5 * w), std::abs(std::abs(z - z0) - 0.5 * h))); } + phi(i, j, k) = std::min(phi_loc, phi(i, j, k)); }); const auto& nbx = mfi.nodaltilebox(); amrex::ParallelFor(