Skip to content

Example 1: Sample Glint2 Setup: ModelE

Bob Fischer edited this page Jun 19, 2014 · 21 revisions

Special Build Instructions

To check out:

 git clone -b examples git://github.com/citibob/glint2.git examples

Create an appropriate configuration file in configme/ directory for your system. Make sure that '--with-pism' is NOT used, but '--with-galahad' is. Other than that, follow standard build instructions.

Generating Grids

The first step is to generate grid files for the GCM and ice grids. Grid definitions are stored in NetCDF format, and are generated by small C++ programs. Grid definition generation programs are provided for grids used at GISS; others may be easily added. For now, we will use the ones provided.

Ice Grid

The program searise_g.cpp may be used to generate the grid used in the SeaRISE Assessment. To generate the standard 5km SeaRISE grid, it may be run as follows:

 > searise_g 5

The generated file describes all aspects of the grid in question, including the polygonal outline of every grid cell. This is not very interesting for a simple Cartesian grid; however, Glint2 is designed to be compatible with any type of grid, including unstructured meshes. The resulting grid file may be inspected via:

> ncdump -h searise_g5.nc 
netcdf searise_g5 {
dimensions:
	one = 1 ;
	grid.vertices.num_realized = 169724 ;
	grid.cells.num_realized = 168861 ;
	grid.cells.num_realized_plus1 = 168862 ;
	grid.cells.num_vertex_refs = 675444 ;
	two = 2 ;
	three = 3 ;
	grid.x_boundaries.length = 302 ;
	grid.y_boundaries.length = 562 ;
variables:
	int grid.info(one) ;
		grid.info:version = 1 ;
		grid.info:name = "searise" ;
		grid.info:type = "XY" ;
		grid.info:type.comment = "\n",
			"The overall type of grid, controlling the C++ class\n",
			"used to represent the grid.  See Grid::Type in\n",
			"slib/glint2/Grid.hpp" ;
		grid.info:coordinates = "XY" ;
		grid.info:coordinates.comment = "\n",
			"The coordinate system used to represent grid vertices\n",
			"(See Grid::Coordinates in slib/glint2/Grid.hpp.  May be\n",
			"either XY or LONLAT (longitude comes before latitude). \n",
			"Note that this is different from grid.info.type.  A\n",
			"GENERIC grid, for example, could be expressed in either\n",
			"XY or LONLAT coordinates." ;
		grid.info:parameterization = "L0" ;
		grid.info:parameterization.comment = "\n",
			"Indicates how values are interpolated between grid\n",
			"points (See Grid::Parameterization in \n",
			"slib/glint2/Grid.hpp).  Most finite difference models\n",
			"will use L0, while finite element models would use L1\n",
			"or something else." ;
		grid.info:projection = "+proj=stere +lon_0=-39 +lat_0=90 +lat_ts=71.0 +ellps=WGS84" ;
		grid.info:projection.comment = "\n",
			"If grid.info.coordinates = XY, this indicates the\n",
			"projection used to convert local XY coordinates to\n",
			"LONLAT coordinates on the surface of the earth.  See\n",
			"http://trac.osgeo.org/proj/ Proj.4 for format of these\n",
			"strings." ;
		grid.info:cells.num_full = "168861" ;
		grid.info:cells.num_full.comment = "\n",
			"The total theoretical number of grid cells (polygons)\n",
			"in this grid.  Depending on grid.info:parameterization,\n",
			"either cells or vertices will correspond to the\n",
			"dimensionality of the grid\'s vector space." ;
		grid.info:vertices.num_full = 169724 ;
		grid.info:vertices.num_full.comment = "\n",
			"The total theoretical of vertices (of polygons) on\n",
			"this grid." ;
		grid.info:grid.vertices.num_realized.comment = "\n",
			"The number of \'realized\' cells in this grid.  Only the\n",
			"outlines of realized cells are computed and stored. \n",
			"not all cells need to be realized.  For example, a grid\n",
			"file representing a GCM grid, in preparation for use\n",
			"with ice models, would only need to realize GCM grid\n",
			"cells that are close to the relevant ice sheets.  In\n",
			"this case, all grid cells are realized." ;
	int grid.vertices.index(grid.vertices.num_realized) ;
		grid.vertices.index:comment = "\n",
			"For grids that index on cells (eg, L0): a dense,\n",
			"zero-based 1D index used to identify each realized\n",
			"cell.  This will be used for vectors representing\n",
			"fields on the grid." ;
	double grid.vertices.xy(grid.vertices.num_realized, two) ;
	int grid.cells.index(grid.cells.num_realized) ;
		grid.cells.index:comment = "\n",
			"For grids that index on vertices (eg, L1): a dense,\n",
			"zero-based 1D index used to identify each realized\n",
			"vertex.  This will be used for vectors representing\n",
			"fields on the grid." ;
	int grid.cells.ijk(grid.cells.num_realized, three) ;
		grid.cells.ijk:comment = "\n",
			"OPTIONAL: Up to 3 dimensions can be used to assign a\n",
			"\'real-world\' index to each grid cell.  If\n",
			"grid.info:type = EXCHANGE, then i and j correspond to\n",
			"grid.vertices.index of the two overlapping source\n",
			"cells." ;
	double grid.cells.area(grid.cells.num_realized) ;
	int grid.cells.vertex_refs(grid.cells.num_vertex_refs) ;
	int grid.cells.vertex_refs_start(grid.cells.num_realized_plus1) ;
	double grid.x_boundaries(grid.x_boundaries.length) ;
	double grid.y_boundaries(grid.y_boundaries.length) ;
}
grid.info.type
The overall type of grid, controlling the C++ class used to represent the grid. See Grid::Type in Grid.hpp.
grid.info.coordinates
The coordinate system used to represent grid vertices (See Grid::Coordinates in Grid.hpp). May be either XY or LONLAT (longitude comes before latitude). Note that this is different from grid.info.type. A GENERIC grid, for example, could be expressed in either XY or LONLAT coordinates.
grid.info.parametrization
Indicates how values are interpolated between grid points (See Grid::Parameterization in Grid.hpp). Most finite difference models will use L0, while finite element models would use L1 or something else.
grid.info.projection
If grid.info.coordinates =XY, this indicates the projection used to convert local XY coordinates to LONLAT coordinates on the surface of the earth. See Proj.4 for format of these strings.
grid.info:cells.num_full
The total theoretical number of grid cells (polygons) in this grid.
grid.info:verties.num_full
The total theoretical of vertices (of polygons) on this grid.
grid.cells.num_realized
The number of realized cells in this grid. Only the outlines of realized cells are computed and stored. not all cells need to be realized. For example, a grid file representing a GCM grid, in preparation for use with ice models, would only need to realize GCM grid cells that are close to the relevant ice sheets. In this case, all grid cells are realized.
Clone this wiki locally