Fixed refinement levels break AMR

Issue #1417 closed
Cutter Coryell created an issue

CarpetRegrid2's "fixed box" functionality apparently prevents adaptive mesh refinement from occurring. When the parameter CarpetRegrid2::num_centres is set to 1, refined levels near increased level_mask do not appear, but they do if num_centres is set to 0. I have included a modified version of the AMRToy thorn whose only purpose in these tests is to set the level_mask in an annulus shape with larger radius than that of the fixed box. I have also included three parameter files, one in which there is only fixed-box refinement, one in where there is only AMR, and one in which there is both. In the test where there is both, I only observe the fixed-boxes showing up. The resolution of these parameter files can be increased to get better-defined AMR, but this low resolution still demonstrates the problem.

Keyword: CarpetRegrid2

Comments (6)

  1. Cutter Coryell reporter
    • removed comment

    Additional debugging information: The grid structure before and after the AMR step occurs (line 302 in CarpetRegrid2/src/regrid.cc)

    Fixed-boxes only:

    Before AMR: Refinement level 0: regions are bboxset<CCTK_INT4,3>:{size=97336,setsize=1,set=[([0,0,0]:[360,360,360]:[8,8,8]/[0,0,0]:[45,45,45]/[46,46,46]/97336)]} Before AMR: Refinement level 1: regions are bboxset<CCTK_INT4,3>:{size=512,setsize=1,set=[([166,166,166]:[194,194,194]:[4,4,4]/[41,41,41]:[48,48,48]/[8,8,8]/512)]} < AMR does not occur > After AMR: Refinement level 0: regions are bboxset<CCTK_INT4,3>:{size=97336,setsize=1,set=[([0,0,0]:[360,360,360]:[8,8,8]/[0,0,0]:[45,45,45]/[46,46,46]/97336)]} After AMR: Refinement level 1: regions are bboxset<CCTK_INT4,3>:{size=512,setsize=1,set=[([166,166,166]:[194,194,194]:[4,4,4]/[41,41,41]:[48,48,48]/[8,8,8]/512)]}

    AMR only:

    Before AMR: Refinement level 0: regions are bboxset<CCTK_INT4,3>:{size=97336,setsize=1,set=[([0,0,0]:[360,360,360]:[8,8,8]/[0,0,0]:[45,45,45]/[46,46,46]/97336)]} <AMR occurs > After AMR: Refinement level 0: regions are bboxset<CCTK_INT4,3>:{size=97336,setsize=1,set=[([0,0,0]:[360,360,360]:[8,8,8]/[0,0,0]:[45,45,45]/[46,46,46]/97336)]} After AMR: Refinement level 1: regions are bboxset<CCTK_INT4,3>:{size=32768,setsize=1,set=[([118,118,118]:[242,242,242]:[4,4,4]/[29,29,29]:[60,60,60]/[32,32,32]/32768)]}

    Both fixed-boxes and AMR:

    Before AMR: Refinement level 0: regions are bboxset<CCTK_INT4,3>:{size=97336,setsize=1,set=[([0,0,0]:[360,360,360]:[8,8,8]/[0,0,0]:[45,45,45]/[46,46,46]/97336)]} Before AMR: Refinement level 1: regions are bboxset<CCTK_INT4,3>:{size=512,setsize=1,set=[([166,166,166]:[194,194,194]:[4,4,4]/[41,41,41]:[48,48,48]/[8,8,8]/512)]} < AMR occurs > After AMR: Refinement level 0: regions are bboxset<CCTK_INT4,3>:{size=97336,setsize=1,set=[([0,0,0]:[360,360,360]:[8,8,8]/[0,0,0]:[45,45,45]/[46,46,46]/97336)]} After AMR: Refinement level 1: regions are bboxset<CCTK_INT4,3>:{size=512,setsize=1,set=[([166,166,166]:[194,194,194]:[4,4,4]/[41,41,41]:[48,48,48]/[8,8,8]/512)]}

  2. Roland Haas
    • changed status to open
    • removed comment

    Turns out the reason for this behaviour was the skipping of the recompose step "Refined regions have not changed sufficiently; skipping regridding" which did overwrite the do_recompose setting from AMR. The attached patch simply skips this test when AMR is active.

  3. Erik Schnetter
    • changed status to resolved
    • removed comment

    The patch is almost correct.

    The for loop after the statement

          if (adaptive_refinement) do_recompose = true;
    

    has the sole purpose to determine whether recomposing is required. If adaptive_refinement is true, then the whole for loop should be skipped.

    Implemented this. Please test.

  4. Roland Haas
    • removed comment

    Works for me, both codes seem to be functionally identical. The modified code still regrids and passes all tests. I actually had something similar to what is now implemented as a first try but thought that proposing

    do_recompose = false;
    if (adaptive_refinement) do_recompose = true;
    else
    for (int n = 0; n < num_centres; ++ n) {
    ...69 lines of code...
    }
    

    likely would have had me scolded for not indenting the loop :-). The current code is obviously closer in style to what is used in the file otherwise.

    Thank you for reviewing and committing the patch.

  5. Log in to comment