A general method for modeling on irregular grids
For simulation on a spherical surface, such as global numerical weather prediction, icosahedral grids are superior to their competitors in uniformity of grid mesh distance across the entire globe and lack of neighboring grid cells that share only a single vertex. Use of such a grid presents unique programming challenges related to iteration across grid cells and location of neighboring cells. Here we describe an icosahedral grid with a one-dimensional vector loop structure, table specified memory order, and an indirect addressing scheme that yields very compact code despite the complexities of this grid. This approach allows the same model code to be used for many grid structures. Indirect addressing also allows grid cells to be stored in any order, selectable at run time. This permits easy implementation of different memory layouts for cache blocking, distributed-memory parallelism, and static load balancing. Since indirect addressing can adversely affect execution time we organize arrays to place a directly addressable index innermost. We also describe experiments designed to measure any performance penalties accrued from use of indirect addressing.