Skip to content

Commit

Permalink
absolute value distance to fix fpe error
Browse files Browse the repository at this point in the history
  • Loading branch information
zhichen3 committed Nov 13, 2024
1 parent 76380d9 commit 942be8a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Source/driver/Castro_util.H
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Real distance(GeometryData const& geomdata, GpuArray<Real, 3>& loc)
return std::sqrt(loc[0]*loc[0] + loc[1]*loc[1]);
}

return loc[0];
return std::abs(loc[0]);
}


Expand Down
2 changes: 1 addition & 1 deletion Source/driver/Derive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ extern "C"
der(i,j,k,0) = (-dat(i,j,k,1)*loc[1] + dat(i,j,k,2)*loc[0]) / (dat(i,j,k,0)*r);
#endif
} else {
Real r = distance(geomdata, loc);
Real r = distance(geomdata, loc);

// we really mean just the velocity component that is
// perpendicular to radial, and in general 3-d (e.g. a
Expand Down

0 comments on commit 942be8a

Please sign in to comment.