Home Contact Us Site Map  
 
       
    next up previous contents
Next: 7.5.2 Example Grids Up: 7.5 Grid Generation Previous: 7.5 Grid Generation   Contents

Subsections

7.5.1 Using SPGrid

The SPGrid software is not a single program. Rather, it is a collection of C++ code and MatLAB scripts that can be used as a framework or library for grid generation and manipulation. Currently, grid creation is accomplished by either directly running matlab scripts or by writing a C++ ``driver'' program. The matlab scripts are suitable for grids composed of a single ``face'' (that is, a single logically rectangular region on the surface of a sphere). The C++ driver programs are appropriate for grids composed of multiple connected logically rectangular patches. Each driver is program is written to specify the shape and connectivity of tiles and the preferred grid density (that is, the number of grid cells in each logical direction) and edge locations of the cells where they meet the edges of each face. The driver programs pass this information to the SPGrid library which generates the actual grid and produces the output files that describe it.

Currently, driver programs are available for a few examples including cubes, ``lat-lon caps'' (cube topologies that have conformal caps at the poles and are exactly lat-lon channels for the remainder of the domain), and some simple ``embedded'' regions that are meant to be used within typical cubes or traditional lat-lon grids.

To create new grids, one may start with an existing driver program and modify it to describe a domain that has a different arrangement. The number, location, size, and connectivity of grid ``faces'' (the name used for the logically rectangular regions) can be readily changed. Further, the number of grid cells within faces and the location of the grid cells at the face edges can also be specified.

7.5.1.1 SPGrid Requirements

The following programs and libraries are required to build and/or run the SPGrid suite:

  • MatLAB is a run-time requirement since many of the generation algorithms have been written as MatLAB scripts:
    http://www.mathworks.com

  • the Wild Magic graphics engine (a C++ library) is needed for the main ``driver'' code:
    http://geometrictools.com/

  • the NetCDF library is needed for file I/O:
    http://www.mathworks.com

  • the BOOST Serialization library is used for I/O:
    http://www.boost.org

  • a typical Linux/Unix build environment including the make utility (preferably Gnu Make) and a C++ compiler (SPGrid was developed with g++ v4.x).

7.5.1.2 Obtaining SPGrid

The latest version can be obtained from:

7.5.1.3 Building SPGrid

The procedure for building is similar to many open source projects:

     tar -xf spgrid-0.9.4.tar.gz
     cd spgrid-0.9.4
     export CPPFLAGS="-I/usr/include/netcdf-3"
     export LDFLAGS="-L/usr/lib/netcdf-3"
     ./configure
     make
where the CPPFLAGS and LDFLAGS environment variables can be edited to reflect the locations of all the necessary dependencies. SPGrid is known to work on Fedora Core Linux (versions 4 and 5) and is likely to work on most any Linux distribution that provides the needed dependencies.

7.5.1.4 Running SPGrid

Within the src sub-directory, various example driver programs exist. These examples describe small, simple domains and can generate the input files (formatted as either binary *.mitgrid or netCDF) used by MITgcm.

One such example is called ``SpF_test_cube_cap'' and it can be run with the following sequence of commands:

     cd spgrid-0.9.4/src
     make SpF_test_cube_cap
     mkdir SpF_test_cube_cap.d
     ( cd SpF_test_cube_cap.d && ln -s ../../scripts/*.m . )
     ./SpF_test_cube_cap
which should create a series of output files:
     SpF_test_cube_cap.d/grid_*.mitgrid
     SpF_test_cube_cap.d/grid_*.nc
     SpF_test_cube_cap.d/std_topology.nc
where the grid_*.mitgrid and grid_*.nc files contain the grid information in binary and netCDF formats and the std_topology.nc file contains the information describing the connectivity (both edge-edge and corner-corner contacts) between all the faces.


next up previous contents
Next: 7.5.2 Example Grids Up: 7.5 Grid Generation Previous: 7.5 Grid Generation   Contents
mitgcm-support@mitgcm.org
Copyright © 2006 Massachusetts Institute of Technology Last update 2018-01-23