Reduction weight for periodic domains.

Issue #1222 closed
Eloisa Bentivegna created an issue

The reduction weight of the internal points neighboring the outer boundaries is currently set in a "trapezoidal-rule" manner (1/2 on the box faces, 1/4 on the edges, 1/8 on the vertices, in 3D), regardless of the nature of the boundaries. In the case of periodic boundaries with a Coordbase::boundary_shiftout_* parameter of zero, this leads to the assignment of a non-zero weight to some of the boundary points. This only yields the correct result if boundary conditions have been applied, which sometimes isn't possible/necessary.

The attached patch introduces some logic in CarpetReduce to take care of this case. This may not be the best way to attack the problem though. One could tackle the way weight is assigned to zero-shiftout boundaries. Perhaps this issue is related to #1221.

Keyword:

Comments (12)

  1. Erik Schnetter
    • removed comment

    When vertex centering is used, then each of the boundary points contributes with weight 1/2 to the reduction, as explained above. If I interpret the patch correctly, then it essentially shifts the domain by 1/2 grid point in the periodic directions, so that one boundary point contributes with weight 1 and the other with weight 0. Given that one boundary point has a shiftout of 0 and the other has a shiftout of 1, this will then use exactly the interior points and ignore all points set by the periodic boundary condition.

    I wonder what this domain-shifting does when several refinement levels are used, since each level would be shifted by a different amount, depending on the grid spacing. With many refinement levels, there can be many finest grid points in the region where the coarsest grid has been shifted.

    Another way of obtaining the same effect would be to use cell-centred refinement. In this case, there are no grid cells with weight 1/2; all cells have either weight 0 or weight 1.

  2. Eloisa Bentivegna reporter
    • removed comment

    What do you mean by shifting the domain? The patch shouldn't do anything to the domain coordinates, it merely changes the weight assignment so that, like you mention, only interior points are (fully) counted. If a finer level overlaps the boundaries, then the coarse level underneath should have zero weight in the area, and the finer level would have a weight of one in the interior points and zero otherwise (as if it were the coarsest level itself). If a finer level does not overlap the periodic boundaries, it shouldn't see any modification at all.

  3. Erik Schnetter
    • removed comment

    With "domain" I refer to the region that has a non-zero weight. If you count only the interior points, then this domain will have different coordinates on different levels, i.e. it will be shifted by 1/2 grid spacing on each level. One way to view this is to draw a cell around each grid point, with radius dx/2 (i.e. cell size dx), so that the cells don't overlap. The region defined by all cells will then be different on each level.

  4. Eloisa Bentivegna reporter
    • removed comment

    If I understand your argument correctly, I do not agree. Let's say we have a periodic domain where we identify x=+1 with x=-1; we cover this with two grids, one with spacing dx=0.2 and one with dx/2, and with a lower shiftout of 1 and an upper shiftout of 0. With three boundary points, this will look like this:

               -1                                      +1
                |                                       |
                |                                       |
                |                                       |
    B   B   B   I   I   I   I   I   I   I   I   I   I   B   B   B
          b b b i i i i i i i i i i i i i i i i i i i i b b b
    

    The coordinate of the last internal point will indeed be different on the two levels (0.8 on the coarse and 0.9 on the fine), but things like the volume of the two levels (assigning weight of 1 to the interior points and 0 otherwise) is the same:

    C: #Idx=100.2=2 F: #idx/2=200.1=2

    Notice that the volume of the two levels is the same with the current weight assignment too -- the patched code produces identical results as the current one, when the boundaries have been correctly set. It only makes a difference when the boundaries are junk, in which case it prevents this junk from polluting the reduction operations.

  5. Erik Schnetter
    • removed comment

    I now think that adding a special case for periodic boundaries makes sense, along the lines you suggest.

  6. Erik Schnetter
    • removed comment

    I have applied the patch (slightly modified).

    Eloisa, could you create a test case for this?

  7. Frank Löffler
    • changed status to open
    • removed milestone
    • removed comment

    Bumping, because the test case isn't going to make it, but (un)luckily the change at least did.

  8. Log in to comment