Skip to content

Commit 2f10b41

Browse files
authored
use abs for spherical 2d area (AMReX-Codes#4256)
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.
1 parent 81cc845 commit 2f10b41

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Src/Base/AMReX_COORDSYS_2D_C.H

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ amrex_setarea (Box const& bx, Array4<Real> const& area,
118118
AMREX_PRAGMA_SIMD
119119
for (int i = lo.x; i <= hi.x; ++i) {
120120
Real ri = offset[0] + dx[0]*(i);
121-
Real a = tmp*ri*ri;
121+
Real a = std::abs(tmp*ri*ri);
122122
area(i,j,0) = a;
123123
}
124124
}
@@ -132,7 +132,7 @@ amrex_setarea (Box const& bx, Array4<Real> const& area,
132132
for (int i = lo.x; i <= hi.x; ++i) {
133133
Real ri = offset[0] + dx[0]*(i);
134134
Real ro = ri + dx[0];
135-
Real a = tmp*(ro-ri)*(ro+ri);
135+
Real a = std::abs(tmp*(ro-ri)*(ro+ri));
136136
area(i,j,0) = a;
137137
}
138138
}

0 commit comments

Comments
 (0)