1 |
% $Header: $ |
2 |
% $Name: $ |
3 |
|
4 |
\section{Grid Generation} |
5 |
\label{sec:pkg:grid_gen} |
6 |
\begin{rawhtml} |
7 |
<!-- CMIREDIR:package_grid_gen: --> |
8 |
\end{rawhtml} |
9 |
|
10 |
|
11 |
The horizontal discretizations within MITgcm have been written to work |
12 |
with many different grid types including: |
13 |
\begin{itemize} |
14 |
\item cartesian coordinates |
15 |
\item spherical polar (``latitude-longitude'') coordinates |
16 |
\item general curvilinear orthogonal coordinates |
17 |
\end{itemize} |
18 |
The last of these, especially when combined with the domain |
19 |
decomposition capabilities of MITgcm, allows a great degree of grid |
20 |
flexibility. To date, general curvilinear orthogonal coordinates have |
21 |
been used primarily (in fact, almost exclusively) in conjunction with |
22 |
so-called ``cube-sphere'' grids. However, it is important to observe |
23 |
that cube-sphere arrangements are only one example of what is possible |
24 |
with domain-decomposed logically rectangular tiles each containing |
25 |
curvilinear orthogonal coordinate systems. Much more sophisticated |
26 |
domains can be imagined and constructed. |
27 |
|
28 |
In order to explore the possibilities of domain-decomposed curvilinear |
29 |
orthogonal coordinate systems, a suite of grid generation software |
30 |
called ``SPGrid'' (for SPherical Gridding) has developed. SPGrid is a |
31 |
relatively new facility and papers detailing its algorithms are in |
32 |
preparation. Althogh SPGrid is new and still rapidly developing, it |
33 |
has already demonstrated the ability to generate some useful and |
34 |
interesting grids. |
35 |
|
36 |
This section provides a very brief introduction to SPGrid and shows |
37 |
some early results. For further information, please contact the |
38 |
MITgcm support list: |
39 |
\begin{center} |
40 |
\begin{rawhtml} <A href="mailto:MITgcm-support@mitgcm.org"> \end{rawhtml} |
41 |
MITgcm-support@mitgcm.org |
42 |
\begin{rawhtml} </A> \end{rawhtml} |
43 |
\end{center} |
44 |
|
45 |
|
46 |
\subsection{Using SPGrid} |
47 |
|
48 |
The SPGrid software is not a single program. Rather, it is a |
49 |
collection of \CC code and MatLAB scripts that can be used as a |
50 |
framework or library for grid generation. Currently, grid creation is |
51 |
accomplished by writing a \CC ``driver'' program that specifies the |
52 |
shape and connectivity of tiles and the preferred grid sizes (in the |
53 |
sense of the number of grid cells) and edge locations of the cells at |
54 |
the edges of grid faces. The driver program then passes this |
55 |
information to the SPGrid library which generates the actual grid and |
56 |
produces the output files that describe it. |
57 |
|
58 |
Currently, driver programs are available for a few examples including |
59 |
cubes, ``lat-lon caps'' (cube topologies that have conformal caps at |
60 |
the poles and are exactly lat-lon channels for the remainder of the |
61 |
domain), and some simple ``embedded'' regions that are meant to be |
62 |
used within typical cubes or traditional lat-lon grids. |
63 |
|
64 |
To create new grids, one may start with an existing driver program and |
65 |
modify it to describe a domain that has a different arrangement. The |
66 |
number, location, size, and connectivity of grid ``faces'' (the name |
67 |
used for the logically rectangular regions) can be readily changed. |
68 |
Further, the number of grid cells within faces and the location of |
69 |
the grid cells at the face edges can also be specified. |
70 |
|
71 |
|
72 |
\subsubsection{SPGrid Requirements} |
73 |
|
74 |
The following programs and libraries are required to build and/or run |
75 |
the SPGrid suite: |
76 |
\begin{itemize} |
77 |
\item MatLAB is a run-time requirement since many of the generation |
78 |
algorithms have been written as MatLAB scripts: \\ |
79 |
\begin{rawhtml} <A href="http://www.mathworks.com"> \end{rawhtml} |
80 |
\texttt{http://www.mathworks.com} |
81 |
\begin{rawhtml} </A> \end{rawhtml} |
82 |
|
83 |
\item the Wild Magic graphics engine (a \CC library) is needed for the |
84 |
main ``driver'' code: \\ |
85 |
\begin{rawhtml} <A href="http://geometrictools.com/"> \end{rawhtml} |
86 |
\texttt{http://geometrictools.com/} |
87 |
\begin{rawhtml} </A> \end{rawhtml} |
88 |
|
89 |
\item the NetCDF library is needed for file I/O: \\ |
90 |
\begin{rawhtml} <A href="http://www.mathworks.com"> \end{rawhtml} |
91 |
\texttt{http://www.mathworks.com} |
92 |
\begin{rawhtml} </A> \end{rawhtml} |
93 |
|
94 |
\item the BOOST Serialization library is used for I/O: \\ |
95 |
\begin{rawhtml} <A href="http://www.boost.org"> \end{rawhtml} |
96 |
\texttt{http://www.boost.org} |
97 |
\begin{rawhtml} </A> \end{rawhtml} |
98 |
|
99 |
\item a typical Unix/Linux build environment including the make |
100 |
utility (preferably Gnu Make) and a \CC compiler (SPGrid was |
101 |
developed with g++ v3.x and v4.x). |
102 |
\end{itemize} |
103 |
|
104 |
|
105 |
\subsubsection{Obtaining SPGrid} |
106 |
|
107 |
The latest version can be obtained from: |
108 |
\begin{center} |
109 |
\begin{rawhtml} <A href="http://mitgcm.org/eh3/grids/spgrid_releases/> |
110 |
\end{rawhtml} |
111 |
\texttt{http://mitgcm.org/eh3/grids/spgrid\_releases/} |
112 |
\begin{rawhtml} </A> \end{rawhtml} |
113 |
\end{center} |
114 |
|
115 |
|
116 |
\subsubsection{Building SPGrid} |
117 |
|
118 |
The procedure for building is similar to many open source projects: |
119 |
\begin{verbatim} |
120 |
tar -xf spgrid-0.9.4.tar.gz |
121 |
cd spgrid-0.9.4 |
122 |
export CPPFLAGS="-I/usr/include/netcdf-3" |
123 |
export LDFLAGS="-L/usr/lib/netcdf-3" |
124 |
./configure |
125 |
make |
126 |
\end{verbatim} |
127 |
where the \texttt{CPPFLAGS} and\texttt{LDFLAGS} environment variables |
128 |
can be edited to reflect the locations of all the necessary |
129 |
dependencies. SPGrid is known to work on Fedora Core Linux and is |
130 |
likely to work on most any Linux distribution that provides the needed |
131 |
dependencies. |
132 |
|
133 |
|
134 |
\subsubsection{Using SPGrid} |
135 |
|
136 |
Within the \texttt{src} sub-directory, various example programs |
137 |
exist. These example programs describe small but complete domains and |
138 |
can generate the input (formatted as either binary ``mitgrid'' or |
139 |
netCDF) files required by MITgcm. |
140 |
|
141 |
One such example is called ``SpF\_test\_cube\_cap'' and it can be run |
142 |
with the following sequence of commands: |
143 |
\begin{verbatim} |
144 |
cd spgrid-0.9.4/src |
145 |
mkdir SpF_test_cube_cap.d |
146 |
( cd SpF_test_cube_cap.d && ln -s ../../scripts/*.m . ) |
147 |
./SpF_test_cube_cap |
148 |
\end{verbatim} |
149 |
which should create a series of output files of the form |
150 |
\begin{verbatim} |
151 |
SpF_test_cube_cap.d/grid_*.mitgrid |
152 |
SpF_test_cube_cap.d/grid_*.nc |
153 |
SpF_test_cube_cap.d/std_topology.nc |
154 |
\end{verbatim} |
155 |
which describe each face of the domain and how the faces are |
156 |
connected. |
157 |
|
158 |
|
159 |
\subsection{Example Grids} |
160 |
|
161 |
The following grids are various examples created with SPGrid. |