next up previous contents
Next: Parallelisation Up: Staggering Previous: Indexing, ghostzones, etc.   Contents

Staggertypes

The string specifying the staggering is encoded in a number called the staggerindex. With the 3 supported staggerings, the string is converted into a base 3 number. Several routines exist to extract the staggering in a specific direction, called directional staggerindex. For example, stagger = MCM: staggerindex = 3, in the 17#17-direction: directional staggerindex = CCTK_STAGGER_M (value 0), in the 20#20-direction: directional staggerindex = CCTK_STAGGER_C (value 1).

CCTK_STAGGER_M
value used for M-type staggering
CCTK_STAGGER_C
value used for C-type staggering
CCTK_STAGGER_P
value used for P-type staggering
CCTK_NO_STAGGER
value to indicate no staggering
CCTK_STAGGER
value to indicate staggering
CCTK_NSTAGGER
number of coded staggerings (3)

Figure: Unstaggered and center-staggered gridpoints with ghostzone size of one (above) and two (below). The points are distributed across three processors. Note that the number of center staggered gridpoints (fat crosses) is one less on the outermost grid. How to treat this case in an easy way is explained in the text.
[angle=0,width=10cm]staggering2

When a thorn programmer uses staggered gridpoints, he has to be aware of this gridpoint anomaly. This can be done most easily by using the CCTK_LSSH(<dir_staggertype>,<direction>) macro. For a given staggertype and direction, this 2D array returns the local number of gridpoints, including ghostzones and the necessary change for the staggering on the outermost processor.

CCTK_LSSH(<dir_staggertype>,<direction>)
for a given staggertype and a direction, this macro returns the number of processor local gridpoints, including ghostzones.

  • For Fortran users, the macro has to be in capital letters
  • This macro is C/Fortran indexing aware: can specify the dimension in C ranging from 29#29 and in Fortran ranging from 30#30.

Several functions exist to derive the staggertype for a given group and for a certain direction.

int CCTK_GroupStaggerIndexGI(int group_index)
call CCTK_GroupStaggerIndexGI(int staggerindex, int group_index)
returns the staggerindex for a given group index.

int CCTK_GroupStaggerIndexGN(char *group_name)
call CCTK_GroupStaggerIndexGN(int staggerindex, char *group_name)
returns the staggerindex for a given group name.

int CCTK_StaggerIndex(char *stagger_string)
call CCTK_StaggerIndex(int staggerindex, char *stagger_string)
return the staggerindex for a given stagger string.

int CCTK_DirStaggerIndex(int direction, char *stagger_string)
call CCTK_DirStaggerIndex(int dir_staggerindex, int direction, char *stagger_string)
returns the directional staggerindex for a given direction and stagger string.

int CCTK_DirStaggerIndexI(int direction, char *stagger_type)
call CCTK_DirStaggerIndexI(int dir_direction, char *stagger_type)
returns the directional staggerindex for a given direction and staggerindex.


next up previous contents
Next: Parallelisation Up: Staggering Previous: Indexing, ghostzones, etc.   Contents