Location
Source/BoundaryConditions/ERF_FillPatcher.cpp:126-156
Source/BoundaryConditions/ERF_FillPatcher.cpp:165-196
Problem
BuildMask augments the fine-grid box list with periodic images by shifting each box along one periodic dimension at a time:
if (m_fgeom.isPeriodic(dim)) {
...
bb_lo.shift(dim,n);
...
bb_hi.shift(dim,-n);
}
It never generates combined shifts such as (+Lx,+Ly) or (-Lx,+Ly).
Why this is a bug
In doubly or triply periodic cases, a fine patch touching a periodic corner should also mask out its diagonal periodic image. Without those combined corner
images, complementIn can classify periodic-corner cells as uncovered coarse/fine-boundary cells, and the patcher can incorrectly interpolate over data t
hat should be treated as fine-covered.
That is most likely to show up near periodic corners in relaxation/set regions.
Suggested patch
Generate periodic image boxes for all combinations of periodic shifts, not only single-axis shifts. One simple approach is to iterate over the 3^N shift
combinations (-1, 0, +1 in each periodic dimension), skip the all-zero shift, and add each shifted image that intersects the bounding box.
--- a/Source/BoundaryConditions/ERF_FillPatcher.cpp
+++ b/Source/BoundaryConditions/ERF_FillPatcher.cpp
@@
- for (auto& b : bl_mf) {
- for (int dim = 0; dim < AMREX_SPACEDIM; dim++) {
- if (m_fgeom.isPeriodic(dim)) {
- ...
- }
- }
- }
+ for (auto& b : bl_mf) {
+ for (all periodic shift combinations in {-1,0,+1}^N, excluding the zero shift) {
+ Box bb = b;
+ shift bb by +/- domain length in every selected periodic dimension;
+ bb.enclosedCells();
+ bb.setType(b.ixType());
+ bb &= fba_bnd;
+ if (bb.ok()) { bl_mf_new.push_back(bb); }
+ }
+ }
Location
Source/BoundaryConditions/ERF_FillPatcher.cpp:126-156Source/BoundaryConditions/ERF_FillPatcher.cpp:165-196Problem
BuildMaskaugments the fine-grid box list with periodic images by shifting each box along one periodic dimension at a time:It never generates combined shifts such as
(+Lx,+Ly)or(-Lx,+Ly).Why this is a bug
In doubly or triply periodic cases, a fine patch touching a periodic corner should also mask out its diagonal periodic image. Without those combined corner
images,
complementIncan classify periodic-corner cells as uncovered coarse/fine-boundary cells, and the patcher can incorrectly interpolate over data that should be treated as fine-covered.
That is most likely to show up near periodic corners in relaxation/set regions.
Suggested patch
Generate periodic image boxes for all combinations of periodic shifts, not only single-axis shifts. One simple approach is to iterate over the
3^Nshiftcombinations (
-1, 0, +1in each periodic dimension), skip the all-zero shift, and add each shifted image that intersects the bounding box.