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

Fixed EB data for anisotropic grids: boundary centroid, normal vector (backward compatible) #4357

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

skang67
Copy link

@skang67 skang67 commented Feb 27, 2025

Summary

  1. This PR corrects two EB data quantities: the boundary centroid (bcent) in set_eb_data called within build_cells, and the normal vector (normal) in EBToPVD::EBToPolygon.
  2. This correction only affects anisotropic grids (dx != dy != dz) and does not affect computations for isotropic grids (dx==dy==dz).

Additional background

  1. The current bcent, normalized using a single parameter ((nx*dx[0])*(nx*dx[0]) + (ny*dx[1])*(ny*dx[1]) + (nz*dx[2])*(nz*dx[2])) for all x-, y-, and z-components, results in inappropriate non-dimensional values. The proper physical coordinates can be calculated in user-end code (e.g. ERF) by re-normalizing the bcent parameters.
  2. However, when constructing multilevel EB data by coarsening the finest EB data in Level::coarsenFromFine, the bcent from the finest grid is used to construct coarse EB data. This process produces incorrect bcent on coarse grids, which cannot be recovered in user-end code. Therefore, I propose this PR.

@nataraj2 I am submitting a PR to fix normalization of bcent for anisotropic grids. So far, I have used the bcent as it is, by renormalizing it in ERF. However, I encountered an issue that cannot be fixed from ERF when coarsening the EB data from the fine grid to coarse grids. I discussed this issue with @WeiqunZhang.

Checklist

The proposed changes:

  • fix a bug or incorrect behavior in AMReX
  • add new capabilities to AMReX
  • changes answers in the test suite to more than roundoff level
  • are likely to significantly affect the results of downstream AMReX users
  • include documentation in the code and/or rst files, if appropriate

@nataraj2
Copy link
Contributor

Sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants