Skip to content

Commit

Permalink
use abs for spherical 2d area (#4256)
Browse files Browse the repository at this point in the history
2d area in theta direction goes negative at theta=0 symmetry axis due to
negative theta. But when we integrate from 0 to 2pi in phi, area
orientation is the same regardless of +/- theta.
  • Loading branch information
zhichen3 authored Dec 3, 2024
1 parent 81cc845 commit 2f10b41
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Src/Base/AMReX_COORDSYS_2D_C.H
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ amrex_setarea (Box const& bx, Array4<Real> const& area,
AMREX_PRAGMA_SIMD
for (int i = lo.x; i <= hi.x; ++i) {
Real ri = offset[0] + dx[0]*(i);
Real a = tmp*ri*ri;
Real a = std::abs(tmp*ri*ri);
area(i,j,0) = a;
}
}
Expand All @@ -132,7 +132,7 @@ amrex_setarea (Box const& bx, Array4<Real> const& area,
for (int i = lo.x; i <= hi.x; ++i) {
Real ri = offset[0] + dx[0]*(i);
Real ro = ri + dx[0];
Real a = tmp*(ro-ri)*(ro+ri);
Real a = std::abs(tmp*(ro-ri)*(ro+ri));
area(i,j,0) = a;
}
}
Expand Down

0 comments on commit 2f10b41

Please sign in to comment.