TagBoxArray in ErrorEst function has wrong shape

Issue #1 resolved
Roland Haas created an issue

AMReX allows mixing FABs of different shape and currently the CarpetAmrCore::ErrorEst functions assumes that the tags array it is passed by AMReX has the same shape as the grid functions. This is however not correct as adding a

cerr << grid << " on level " << level << "\n";
cerr << "offset: " << grid.cactus_offset.x << " " << grid.cactus_offset.y << " " << grid.cactus_offset.z << "\n";
cerr << "box: " << tags.get(mfi).box() << "\n"

shows which (for a test case with 3 ghost zones, run on 1 MPI rank and 1 thread) shows:

GridDescBase{gsh:[14,14,14],lbnd:[0,0,0],ubnd:[13,13,13],lsh:[14,14,14],bbox:[1,1,1,1,1,1],nghostzones:[3,3,3],tmin:[0,0,0],tmax:[14,14,14]} on level 0
offset: -3 -3 -3
box: ((-1,-1,-1) (8,8,8) (0,0,0))

This leads to AMReX aborting the run due to an out of bounds access:

terminate called after throwing an instance of 'std::runtime_error'
  what():   (-3,-3,-3,0) is out of bound (-1:8,-1:8,-1:8,0:0)

Comments (4)

  1. Erik Schnetter repo owner

    AMReX allows grid functions to have different number of ghost zones. I think that the error grid function is cell centred and has no ghost zones, while the Cactus grid functions have ghost zones. The indexing in the schedule uses AMReX’s indexing functions that take this into account. I’ll run your parameter file to see whether I can reproduce this.

  2. Roland Haas reporter

    You may need to check out rhaas/testprolongate to get the thorn though I would guess that any parfile setting up a similar grid should do.

  3. Log in to comment