xx CarpetXRegrid

CarpetXRegrid

Steven R. Brandt <sbrandt@cct.lsu.edu> Roland Haas <rhaas@illinois.edu>

July 30 2024

Abstract

Provide a grid function, regridxerror, to the CarpetX driver. This grid function is used by CarpetX and AMReX to determine where to refine the grid.

1 Introduction

AMReXx[1] and thus CarpetX implement Berger-Oligerx[2] type structured mesh refinement. Grid cells are tagged for refinement in CarpetX using the overloaded virtual function AmrCore::ErrorEst.

This thorn, in combination with CarpetX, provides a covenient way for Cactus thorns to label cells needed refinement via a cell centered grid function regridxerror whose value controls if a cell is marked for refinement or not.

A cell is marked for refinement if the value found in regridxerror exceeds the threshold in parameter CarpetX::regridxerrorxthreshold and marked as not requiring refinement otherwise.

A client thorn wishing to control refinement should schedule a function in schedule bins POSTINITIAL and

POSTSTEP. See thorn ErrorEstimator for an example.

2 Numerical Implementation

This thorn only provides access to the tagging grid function regridxerror and initializes it to zero at the beginning of the simulation.

3 Using This Thorn

To use this thorn, make sure to inherit from CarpetXRegrid to gain access to the public grid function regridxerror. A client thorn wishing to control refinement should then schedule a function in schedule bins POSTINITIAL and POSTSTEP which should loop over the interior of cell centered grid function regridxerror marking each cell for refinement or no refinement as needed. See thorn ErrorEstimator for an example.

In the future, to allow multiple independent regridding criteria to contribute to mesh refinement, grid function regridxerror may be interpreted as a boolean flag with true / false indicated by values of and (and all other values considered invalid). In the future this will require that a thorn should never reset non-zero value back to zero.

3.1 Obtaining This Thorn

This thorn is included in the CarpetX arrangement which is part of the Einstein Toolkit.

3.2 Special Behaviour This thorn will initialize the error estimator grid function regridxerror to zero at the beginning of a simulation but does not change or use its values otherwise. In the future it may reset the error estimator grid function before client thorns mark cells for refinement.

3.3 Interaction With Other Thorns This thorn only provides access to regridxerror, while the actual regrid happens inside of CarpetX and

AMReX.

3.4 Examples Please consult thorn ErrorEstimator for an example on how to use this thorn.

externx"C"xvoidxMyRegrid_EstError(CCTK_ARGUMENTS)x{
xxDECLARE_CCTK_ARGUMENTSX_MyRegrid_EstError;
xxDECLARE_CCTK_PARAMETERS;
xxgrid.loop_all_device<1,x1,x1>(
xxxxxxgrid.nghostzones,
xxxxxx[=]xCCTK_DEVICE(constxLoop::PointDescx&p)
xxxxxxxxxxCCTK_ATTRIBUTE_ALWAYS_INLINEx{
xxxxxxxxxxxxxxregrid_error(p.I)x=xfabs(p.x)x<x42.x?x1.0x:x0.0;
xxxxxx}
xx);
}

3.5 Support and Feedback

For questions and bug reports please use the Einstein Toolkit users mailing list users@einsteintoolkit.org

and bug tracker https://trac.einsteintoolkit.org.

References

[1]xxxZhang, W., Almgren, A., Beckner, V., Bell, J., Blaschke, J., Chan, C., Day, M., Friesen, B., Gott, K., Graves, D., Katz, M., Myers, A., Nguyen, T., Nonaka, A., Rosso, M., Williams, S. & Zingale, M. AMReX: a framework for block-structured adaptive mesh refinement. Journal Of Open Source Software. 4, 1370 (2019,5), https://doi.org/10.21105/joss.01370 [2]xxxM.xJ.xBerger and J.xOliger, “Adaptive Mesh Refinement for Hyperbolic Partial Differential

Equations,” J. Comput. Phys. 53 (1984), 484 doi:10.1016/0021-9991(84)90073-1

4 Parameters

5 Interfaces

General Implements: carpetxregrid

Grid Variables

5.0.1 PUBLIC GROUPS

11 x Group Names x 10 x Variable Names x01 Details x 11 x
11  regridxerror  10                    01  centering 11 centering={1 1 1}
11                    10  regridxerror  01  compact 11 0
11                    10                    01 description 11 Regridding condition
11                    10                    01 dimensions 11 3
11                    10                    01 distribution 11 DEFAULT
11                    10                    01 group type 11 GF
11                    10                    01  tags 11 checkpoint=”no”
11                    10                    01 timelevels 11 1
11                    10                    01 variable type 11 REAL

6 Schedule This section lists all the variables which are assigned storage by thorn CarpetX/CarpetXRegrid. Storage can either last for the duration of the run (Always means that if this thorn is activated storage will be assigned, Conditional means that if this thorn is activated storage will be assigned for the duration of the run if some condition is met), or can be turned on for the duration of a schedule function.

Storage NONE

Scheduled Functions

CCTKxBASEGRID x carpetxregridxiniterror x initialize regridding error to zero x

11 x 11 Language: 11 c
11 x 11 Type:  11 function
11 x 11 Writes: 11 carpetxregrid::regridxerror(everywhere)