-
Notifications
You must be signed in to change notification settings - Fork 438
Description
Recently I am using the InterpFromCoarseLevel & FillPatchTwoLevels near the wall (not periodic). And I have write a small testing code as attached, which is a simplifed version from the tutorial codes.
test_interp.zip
In this testing case, I have two levels of mesh. The lev 0 mesh is a 32x32 squre, while lev=1 is a small squre close to the j=0 wall, since the ErrorEst function's kernel is:
amrex::ParallelFor(bx,
[=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
{
if (i > 14 && i < 18 && j < 4)
tagfab(i, j, k) = tagval;
else
tagfab(i, j, k) = clearval;
});
In the InitData function, I only initialize the lev=0 data (with ghost cells), so that the lev=0 are all 1, while the lev=1 data will print as nan at all cells.
Then the FillCoarsePatch() is called with cell_bilinear_interp interpolator in the Evolve function. If the bndry_func is provided as nullptr or a dummy empty function, as the present status in the code, the lev=1 data will be printed as:
j=-1:nannannannannannannannannannannannannannan
j= 0:nannannannannannannannannannannannannannan
j= 1: 1 1 1 1 1 1 1 1 1 1 1 1 1 1
j= 2: 1 1 1 1 1 1 1 1 1 1 1 1 1 1
j= 3: 1 1 1 1 1 1 1 1 1 1 1 1 1 1
j= 4: 1 1 1 1 1 1 1 1 1 1 1 1 1 1
j= 5: 1 1 1 1 1 1 1 1 1 1 1 1 1 1
j= 6: 1 1 1 1 1 1 1 1 1 1 1 1 1 1
j= 7: 1 1 1 1 1 1 1 1 1 1 1 1 1 1
j= 8: 1 1 1 1 1 1 1 1 1 1 1 1 1 1
j= 9: 1 1 1 1 1 1 1 1 1 1 1 1 1 1
j=10: 1 1 1 1 1 1 1 1 1 1 1 1 1 1
j=11: 1 1 1 1 1 1 1 1 1 1 1 1 1 1
j=12: 1 1 1 1 1 1 1 1 1 1 1 1 1 1
We can see that the j=0 cells are still nan after interpolation. With the bilinear algorithm, if j=-1 and j=0 have values on lev=0, the j=0 of lev=1 should be a valid value after interp. However, right now it seems that the only way to fix this issue is to provide a effective bndry_func, as what has been commented in the functor.
I am wondering whether there is a way to fix this, so that the j=0 cells on lev=1 can get a wanted value. The reason is, usually we need to determine the j=-1 values by using the j=0 cells, other than set it with an explicit value. This problem should also exist in the :FillPatchTwoLevel() function.