Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EB Boundary Area: Fix issues for anisotropic cell size #4131

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Docs/sphinx_documentation/source/EB.rst
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ following data:
// embedded boundary centroid
const MultiCutFab& getBndryCent () const;

// embedded boundary normal direction
const MultiCutFab& getBndryNormal () const;

// embedded boundary surface area
const MultiCutFab& getBndryArea () const;

// area fractions
Array<const MultiCutFab*,AMREX_SPACEDIM> getAreaFrac () const;

Expand All @@ -291,6 +297,17 @@ following data:
of the data is in the range of :math:`[-0.5,0.5]`, based on each
cell's local coordinates with respect to the regular cell's center.

- **Boundary normal** is in a :cpp:`MultiCutFab` with ``AMREX_SPACEDIM``
components representing the unit vector pointing toward the covered part.

- **Boundary area** is in a :cpp:`MultiCutFab` with a single component
representing the dimensionless boundary area. When the cell is isotropic
(i.e., :math:`\Delta x = \Delta y = \Delta z`), it's trivial to convert it
to physical units. If the cell size is anisotropic, the conversion
requires multiplying by a factor of :math:`\sqrt{(n_x \Delta y \Delta
z)^2 + (n_y \Delta x \Delta z)^2 + (n_z \Delta x \Delta y)^2}`, where
:math:`n` is the boundary normal vector.

- **Face centroid** is in a :cpp:`MultiCutFab` with ``AMREX_SPACEDIM`` components.
Each component of the data is in the range of :math:`[-0.5,0.5]`, based on
each cell's local coordinates with respect to the embedded boundary.
Expand Down
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(Math::powi<2>(nx*dx[1]) + Math::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) / (Math::powi<2>(nx*dx[1]*dx[2]) +
Math::powi<2>(ny*dx[0]*dx[2]) +
Math::powi<2>(nz*dx[0]*dx[1]));

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