In a discrete grid point model each vertical level of a 3D field needs to be stored in a logically rectangular 2D data structure. Furthermore, we want the closest physical neighbors of a given grid point on the geodesic grid to also be the closest neighbors in index space in computer memory. We will describe how to construct a 2D data structure with this property.


Consider, for example, the geodesic grid with 642 cells as shown in figure 1.a. The spherical geodesic grid can be covered with 20 spherical triangles. The vertices of the triangles are the centers of the pentagons. Suppose the 20 spherical triangles are partitioned into five sets of four triangles. The five sets are denoted with red, yellow, green, blue and magenta. Each of the five sets has the same structure and can be made coincident with any other set through rotation about the axes defined by the north and south pole. Hence, each set has one vertex coincident with both the north and south pole. To better visualize the sets, we can break the grid into five pieces by moving each set of triangles radially outward away from the axes of rotation. This is shown in figure 1.b. The cells associated with a particular color come along for the ride. However, in this figure, the cells at the north and south pole remain fixed in place.


Suppose the pieces in figure 1.b are rolled out and stretched out so that they are flat as shown in figure 2. We have arbitrarily connected the cell at the north pole with the red set and the cell at the south pole with the magenta set. From figure 1.b we can see that the vertices of the spherical triangles are associated with the mid-latitude pentagons. However, the corresponding vertices in figure 2 lie on top of hexagons. This is somewhat deceptive. Even though these cells are depicted as hexagons in figure 2, they are really pentagons. The same thing is true for the cells at the north and south pole.


Now, suppose the five pieces in figure 2 are further twisted and rearranged so they appear as in figure 3. If you count the number of gray vertical lines in figure 3, you will find that there are 90, and there are 10 horizontal lines. Each intersection of gray lines corresponds to a position in computer memory. So, one level of a 3D field with horizontal resolution of 642 cells can be stored in a 2D array with dimension 90 by 10. The array depicted in figure 3 has five major pieces. One of the pieces is shown by itself in figure 4. We will define these pieces as panels. The first panel includes the north pole and the last panel includes the south pole. The additional row and column of memory surrounding each panel is for wrapping. These locations store the so-called ghost values. For example, suppose you wish to compute a finite-difference Laplacian at an actual grid point which is on the edge of a panel. This calculation will require information from a neighboring panel, and the information is stored in the ghost grid points. The ghost grid points are filled by the subroutine called wrap.


We denote the horizontal extent of the array depicted in figure 3 with the integer im and the vertical extent with the integer jm. For this example, im=90 and jm=10. These numbers are dependent on horizontal resolution as shown in the following table:


Not all of the locations in the array are used. The cells not used are called dead cells. Figure 4 shows one panel. The locations with red spots are the dead cells. The four remaining panels not shown have dead cells in the same locations. The numbers stored in these locations should in no way affect the results. There is an option in the subroutine wrap to set these cells to equal to zero.