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. The coordinates of the 21#21th local grid point in the 16#16 direction can e.g. in C be calculated by x = CCTK_ORIGIN_SPACE(0) + (cctk_lsh[0] + i) * CCTK_DELTA_SPACE(0).
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 222#22cctk_dim integers (in the order 23#23), 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. NOTE: Convergence is not currently implemented by Cactus, so that cctk_convlevel is currently always 24#24.

  • cctk_convlevel The convergence level of this grid hierarchy. The base level is 24#24, 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 25#25, where 26#26 is the convergence level and 27#27 is the convergence factor. The convergence factor defaults to 28#28.

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.


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