next up previous contents
Next: Cactus Data Types Up: What the Flesh Provides Previous: Specifically for C Programmers   Contents


Cactus Variables

The Cactus variables which are passed through the macro CCTK_ARGUMENTS are

cctkGH
A C pointer identifying the grid hierarchy.
cctk_dim
An integer with the number of dimensions used for this grid hierarchy.
cctk_lsh
An array of cctk_dim integers with the local grid size on this processor.
cctk_gsh
An array of cctk_dim integers with the global grid size.
cctk_iteration
The current iteration number.
cctk_delta_time
A CCTK_REAL with the timestep.
cctk_time
A CCTK_REAL with the current time.
cctk_delta_space
An array of cctk_dim CCTK_REALs with the grid spacing in each direction.
cctk_nghostzones
An array of cctk_dim integers with the number of ghostzones used in each direction.
cctk_origin_space
An array of cctk_dim CCTK_REALs with the spatial coordinates of the global origin of the grid.
cctk_lssh
This is an internal array used to hold array extents for staggering. One should use the macro CCTK_LSSH(,) to access its elements.

The following variables describe the location of the local grid (e.g. the grid treated on a given processor) within the global grid.

cctk_lbnd
An array of cctk_dim integers containing the lowest index (in each direction) of the local grid, as seen on the global grid. Note that these indices start from zero, so you need to add one when using them in Fortran thorns.
cctk_ubnd
An array of cctk_dim integers containing the largest index (in each direction) of the local grid, as seen on the global grid. Note that these indices start from zero, so you need to add one when using them in Fortran thorns.
cctk_bbox
An array of 221#21cctk_dim integers (in the order 22#22), which indicate whether the boundaries are internal boundaries (e.g. between processors), or physical boundaries. A value of 1 indicates a physical (outer) boundary at the edge of the computational grid, and 0 indicates an internal boundary.

The following variable is needed for grid refinement methods

cctk_levfac
An array of cctk_dim integer factors by which the local grid is refined in the corresponding direction with respect to the base grid.
cctk_levoff
and cctk_levoffdenom Two arrays of cctk_dim integers describing the distance by which the local grid is offset with respect to the base grid, measured in local grid spacings. The distance in direction dir is given by 1.0 * cctk_levoff[dir] / cctk_levoffdenom[dir].
cctk_timefac
The integer factor by which the time step size is reduced with respect to the base grid.

The following variables are used for identifying convergence levels.

cctk_convlevel
The convergence level of this grid hierarchy. The base level is 23#23, and every level above that is coarsened by a factor of cctk_convfac.
cctk_convfac
The factor between convergence levels. The relation between the resolutions of different convergence levels is 24#24, where 25#25 is the convergence level and 26#26 is the convergence factor. The convergence factor defaults to 27#27.

The variables cctk_delta_space, cctk_delta_time, and cctk_origin_space denote the grid spacings, time step size, and spatial origin on the base grid. If you are using a grid refinement method, you need to calculate these quantities on the grid you are on. There are Cactus macros provided for this, with the syntax CCTK_DELTA_SPACE(dir), CCTK_ORIGIN_SPACE(dir), and CCTK_DELTA_TIME for both C and Fortran. It is recommended that these macros are always used to provide the grid spacings, time step sizes, and spatial origins in your thorns. In doing so, you incorporate the effects of cctk_levfac, cctk_levoff, cctk_levoffdenom, and cctk_timefac, so that you do not explicitly have to take them into account.

Putting the above information together, Figure B7.1 shows two different ways to compute the global Cactus 1#1 coordinates of the current grid point. Because the ``alternate calculation'' (the one using Grid::x, Grid::y, and Grid::z) gives the true global 1#1 coordinates even in a multipatch/multiblock context, this is generally the preferred form for general use.

Figure B7.1: This figure shows two different ways to compute the global Cactus 1#1 coordinates of the current grid point. Because the ``alternate calculation'' (the one one using Grid::x, Grid::y, and Grid::z) gives the true global 1#1 coordinates even in a multipatch/multiblock context, this is generally the preferred form for general use.
28#28


next up previous contents
Next: Cactus Data Types Up: What the Flesh Provides Previous: Specifically for C Programmers   Contents