Carpet always calls POSTREGRID on the finest level

Create issue
Issue #966 closed
Roland Haas created an issue

While looking at #965 Christian Reisswig and I noticed that Carpet seems to call the routines on the finest level whenever any recompose happened. This is ok to ensure that global (also global-late) routines are called but also means that local routines are called. In cases where the finest level did not actually change (happens in core collapses we believe), this causes unnecessary calls to eg. MoL_PostStep with its attending SYNC calls. This might be candidate for optimization.

Keyword:

Comments (10)

  1. Erik Schnetter
    • removed comment

    It is difficult to judge whether the finest level "changed". For example, if a coarser level changed, then the finest level's prolongation data may change. Internally, Carpet assumes that a regridding operation always changes "level N and all finer levels".

  2. Roland Haas reporter
    • removed comment

    I see. That certainly makes sense (in particular taking the view of prolongation as a projection into account). In that case, should one change lines 311 in Evolve.cc from

    Do not omit the global mode call when the finest level does not change: if (did_recompose or (did_remove_level and rl == reflevels - 1)) { if (did_recompose or ((did_remove_level or did_any_recompose) and rl == reflevels - 1)) to

    Carpet assumes that a regridding operation always changes "level N and all finer levels" so we should call POSTREGRID on all finer levels if (did_any_recompose) ?

  3. Erik Schnetter
    • removed comment

    This will also change the condition. For example, the check for did_remove_level would be removed. Also, the global mode calls should only be executed on the finest level.

    However, it is okay to change the comment.

  4. Roland Haas reporter
    • removed comment

    I should have posted more context I think. This lines are the ones deciding whether to call any routine on this level at all. The GLOBAL-late routines would still execute only on the last level. I had assumed without checking that did_any_recompose would imply did_remove_level which is not true as you point out. The check for did_remove level was clearly missing. So instead how about:

    Carpet assumes that a regridding operation always changes "level N and all finer levels" so we should call POSTREGRID on all finer levels if (did_any_recompose or (did_remove_level and rl == reflevels - 1)) which should trigger on all levels with rl larger or equal to the first one that was recomposed as well as on the finest one when a level was removed.

    This would actually call POSTREGRID more often, since it would enter not only on levels that were recomposed or on the finest one if a level was removed so is not quite in keeping with what we originally would have liked. So I am not averse to not changing anything.

    The proposed check assumes that we want to call POSTREGRID whenever a level might be affected by recomposing and that once a coarse level is recomposed, all finer levels also are affected. Or do we want the distinction between regrid and recompose?

  5. Erik Schnetter
    • changed status to open
    • removed comment

    In Carpet, "recomposing" is changing the (abstract) grid structure, and "regrid" is updating the grid functions to conform to this grid structure. Recomposing is a global operation, regridding is a per-level operation.

    I believe that the new test as you suggest above is correct, and the current test is wrong. However, if there is "sufficient proper nesting", there should be no difference. Please apply your change as of comment 5.

  6. Log in to comment