next up previous
Next: Grid Functions Up: Program Structure Previous: Coordinate Systems

Grids

 

Grids define the spatial regions over which the grid functions will be defined as well as their storage. A grid declaration can take one of several forms, the longest of which would be something like:

uniform rect[x,z] grid g1 [1:Nx][1:Nz] {xmin:xmax}{zmin:zmax}

The first word can be uniform or nonuniform, though only the former is currently defined. Next comes the name of the coordinate system followed by a list of coordinates on which the grid is defined. The above grid is two dimensional with coordinates x and z. After the coordinate system comes the reserved word grid followed by the grid name. Next comes the index region. In this example, the first index starts at 1 and goes to Nx, while the second starts at 1 and goes to Nz. Nx and Nz must be defined elsewhere. The index regions can contain arbitrary expressions such as [A*B+C-2:4*Nx-5/a], however, as discussed in section 2.2, it is best to keep to forms like [1:Nx] and [0:Nx-1], where Nx has been declared as a parameter. Finally, comes the coordinate region which gives the actual spatial ranges of the coordinates. In the example, we have and . Coordinate regions must be of the form {name1:name2}, where name1 and name2 have been declared as parameters.

Other forms of the grid declaration leave out one or more of the above parts. The minimum allowable declaration is:

uniform rect grid g2

This declaration (along with the example coordinate declaration in section 1.3) declares g2 to be a three dimensional grid with coordinates x, y and z. The index region will be [0:Nx-1][0:Ny-1][0:Nz-1] for C output and [1:Nx][1:Ny][1:Nz] for FORTRAN output. The coordinate region will be {xmin:xmax}{ymin:ymax}{zmin:zmax}



Robert Marsa
Thu Jun 1 09:34:30 CDT 1995