-
Notifications
You must be signed in to change notification settings - Fork 200
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
Adding support for pml in domain for multiple patches #4632
Adding support for pml in domain for multiple patches #4632
Conversation
} | ||
if (do_pml_Hi[idim]){ | ||
domain0.growHi(idim, -ncell); | ||
BoxList bl = grid_ba.boxList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also use simplified_list()
instead of boxList
here. That way, it's less likely to hit the assert failure below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Weiqun for the suggestions!
Done
// ncell is divided by refinement ratio to ensure that the | ||
// physical width of the PML region is equal in fine and coarse patch | ||
cdomain.growHi(idim, -ncell/ref_ratio[idim]); | ||
BoxList bl = grid_cba.boxList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we can use simplified_list as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussed offline, switched back to boxList due to failing CI
Source/BoundaryConditions/PML.cpp
Outdated
@@ -565,35 +565,43 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& gri | |||
// In order to implement this, a reduced domain is created here (decreased by ncells in all direction) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the term "reduced domain" is not appropriate anymore in this comment, since it is not a single contiguous domain anymore.
for (auto& b : bl) { | ||
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { | ||
if (do_pml_Lo[idim]) { | ||
Box const& bb = amrex::adjCellLo(b, idim); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment to explains what this code (the call to adjCellLo
and the subsequent intersects
) does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added comments to clarify
if (do_pml_Hi[idim]){ | ||
domain0.growHi(idim, -ncell); | ||
BoxList bl = grid_ba.boxList(); | ||
for (auto& b : bl) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment to explain what this for
loop does?
(In my understanding, it loops over the box at this level, and whenever a box touches a PML, it reduces the box by ncell
, since this is where the surrounding "in-domain" PML will be created.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added comments to clarify
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR!
Could you add an automated test for this?
Also: could you confirm that this feature still work nicely with do_similar_dm_pml
?
@@ -760,24 +768,28 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& gri | |||
BoxArray grid_cba = grid_ba; | |||
grid_cba.coarsen(ref_ratio); | |||
|
|||
// assuming that the bounding box around grid_cba is a single patch, and not disjoint patches, similar to fine patch. | |||
amrex::Box cdomain = grid_cba.minimalBox(); | |||
BoxArray grid_cba_reduced = grid_cba; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code below duplicates the above code.
Maybe it would be good, in a separate follow-up PR, to create a separate function for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. I ll do this in a separate PR
for more information, see https://pre-commit.ci
Thanks to @WeiqunZhang for the discussion and prototype!!!
The current implementation for
pml_in_domain
only works for a single patchThis PR adds capability to support 'pml_in_domain' for multiple distinct mesh-refinement patches
without the support for this feature : (PML in domain only on the left most edge of the left patch and right edge of the right patch) - i.e., the interiors edges dont apply PML correctly

With this PR :
