Skip to content

Commit

Permalink
EB Boundary Area: Fix issues for anisotropic cell size
Browse files Browse the repository at this point in the history
* In 2D, the scaling in incorrect. For example, if dx >> dy and the boundary
  is parallel to the x-direction, it would produce inf for the scaled
  boundary area.

* In 3D, the scaling has been modified so that it's easy to convert from the
  dimensionless boundary area to physical units.
  • Loading branch information
WeiqunZhang committed Sep 5, 2024
1 parent 216ce6f commit bca5c05
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions Src/EB/AMReX_EB2_2D_C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ void set_eb_data (const int i, const int j,
const Real apnorm = std::hypot(daxp,dayp) + 1.e-30_rt*std::sqrt(dx[0]*dx[1]);
const Real nx = daxp * (1.0_rt/apnorm);
const Real ny = dayp * (1.0_rt/apnorm);
const Real bareascaling = std::sqrt( (nx*dx[0])*(nx*dx[0]) +
(ny*dx[1])*(ny*dx[1]) );
const Real bareascaling = std::sqrt(amrex::powi<2>(nx*dx[1]) + amrex::powi<2>(ny*dx[0]));

const Real nxabs = std::abs(nx);
const Real nyabs = std::abs(ny);
Expand Down
4 changes: 3 additions & 1 deletion Src/EB/AMReX_EB2_3D_C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ void set_eb_data (const int i, const int j, const int k,
bnorm(i,j,k,0) = nx;
bnorm(i,j,k,1) = ny;
bnorm(i,j,k,2) = nz;
barea(i,j,k) = (nx*dapx/(dx[1]*dx[2]) + ny*dapy/(dx[0]*dx[2]) + nz*dapz/(dx[0]*dx[1]));
barea(i,j,k) = (nx*dapx + ny*dapy + nz*dapz) / (amrex::powi<2>(nx*dx[1]*dx[2]) +
amrex::powi<2>(ny*dx[0]*dx[2]) +
amrex::powi<2>(nz*dx[0]*dx[1]));

Real aax = 0.5_rt*(axm+axp);
Real aay = 0.5_rt*(aym+ayp);
Expand Down

0 comments on commit bca5c05

Please sign in to comment.