| 1 | 
edhill | 
1.16 | 
% $Header: /u/u3/gcmpack/manual/part3/getting_started.tex,v 1.15 2004/01/28 20:50:14 edhill Exp $ | 
| 2 | 
adcroft | 
1.2 | 
% $Name:  $ | 
| 3 | 
adcroft | 
1.1 | 
 | 
| 4 | 
adcroft | 
1.4 | 
%\section{Getting started} | 
| 5 | 
adcroft | 
1.1 | 
 | 
| 6 | 
adcroft | 
1.4 | 
In this section, we describe how to use the model. In the first | 
| 7 | 
  | 
  | 
section, we provide enough information to help you get started with | 
| 8 | 
  | 
  | 
the model. We believe the best way to familiarize yourself with the | 
| 9 | 
  | 
  | 
model is to run the case study examples provided with the base | 
| 10 | 
  | 
  | 
version. Information on how to obtain, compile, and run the code is | 
| 11 | 
  | 
  | 
found there as well as a brief description of the model structure | 
| 12 | 
  | 
  | 
directory and the case study examples.  The latter and the code | 
| 13 | 
  | 
  | 
structure are described more fully in chapters | 
| 14 | 
  | 
  | 
\ref{chap:discretization} and \ref{chap:sarch}, respectively. Here, in | 
| 15 | 
  | 
  | 
this section, we provide information on how to customize the code when | 
| 16 | 
  | 
  | 
you are ready to try implementing the configuration you have in mind. | 
| 17 | 
  | 
  | 
 | 
| 18 | 
  | 
  | 
\section{Where to find information} | 
| 19 | 
  | 
  | 
\label{sect:whereToFindInfo} | 
| 20 | 
  | 
  | 
 | 
| 21 | 
edhill | 
1.15 | 
A web site is maintained for release 2 (``Pelican'') of MITgcm: | 
| 22 | 
  | 
  | 
\begin{rawhtml} <A href=http://mitgcm.org/pelican/ target="idontexist"> \end{rawhtml} | 
| 23 | 
adcroft | 
1.4 | 
\begin{verbatim} | 
| 24 | 
edhill | 
1.15 | 
http://mitgcm.org/pelican | 
| 25 | 
adcroft | 
1.4 | 
\end{verbatim} | 
| 26 | 
edhill | 
1.15 | 
\begin{rawhtml} </A> \end{rawhtml} | 
| 27 | 
adcroft | 
1.4 | 
Here you will find an on-line version of this document, a | 
| 28 | 
  | 
  | 
``browsable'' copy of the code and a searchable database of the model | 
| 29 | 
  | 
  | 
and site, as well as links for downloading the model and | 
| 30 | 
edhill | 
1.15 | 
documentation, to data-sources, and other related sites. | 
| 31 | 
adcroft | 
1.4 | 
 | 
| 32 | 
edhill | 
1.15 | 
There is also a web-archived support mailing list for the model that | 
| 33 | 
  | 
  | 
you can email at \texttt{MITgcm-support@mitgcm.org} or browse at: | 
| 34 | 
  | 
  | 
\begin{rawhtml} <A href=http://mitgcm.org/mailman/listinfo/mitgcm-support/ target="idontexist"> \end{rawhtml} | 
| 35 | 
  | 
  | 
\begin{verbatim} | 
| 36 | 
  | 
  | 
http://mitgcm.org/mailman/listinfo/mitgcm-support/ | 
| 37 | 
  | 
  | 
http://mitgcm.org/pipermail/mitgcm-support/ | 
| 38 | 
  | 
  | 
\end{verbatim} | 
| 39 | 
  | 
  | 
\begin{rawhtml} </A> \end{rawhtml} | 
| 40 | 
  | 
  | 
Essentially all of the MITgcm web pages can be searched using a | 
| 41 | 
  | 
  | 
popular web crawler such as Google or through our own search facility: | 
| 42 | 
edhill | 
1.16 | 
\begin{rawhtml} <A href=http://mitgcm.org/mailman/htdig/ target="idontexist"> \end{rawhtml} | 
| 43 | 
adcroft | 
1.1 | 
\begin{verbatim} | 
| 44 | 
edhill | 
1.15 | 
http://mitgcm.org/htdig/ | 
| 45 | 
adcroft | 
1.1 | 
\end{verbatim} | 
| 46 | 
edhill | 
1.15 | 
\begin{rawhtml} </A> \end{rawhtml} | 
| 47 | 
  | 
  | 
%%% http://www.google.com/search?q=hydrostatic+site%3Amitgcm.org | 
| 48 | 
  | 
  | 
 | 
| 49 | 
  | 
  | 
 | 
| 50 | 
adcroft | 
1.4 | 
 | 
| 51 | 
  | 
  | 
\section{Obtaining the code} | 
| 52 | 
  | 
  | 
\label{sect:obtainingCode} | 
| 53 | 
adcroft | 
1.1 | 
 | 
| 54 | 
cnh | 
1.7 | 
MITgcm can be downloaded from our system by following | 
| 55 | 
  | 
  | 
the instructions below. As a courtesy we ask that you send e-mail to us at | 
| 56 | 
edhill | 
1.14 | 
\begin{rawhtml} <A href=mailto:MITgcm-support@mitgcm.org> \end{rawhtml} | 
| 57 | 
  | 
  | 
MITgcm-support@mitgcm.org | 
| 58 | 
cnh | 
1.7 | 
\begin{rawhtml} </A> \end{rawhtml} | 
| 59 | 
  | 
  | 
to enable us to keep track of who's using the model and in what application. | 
| 60 | 
  | 
  | 
You can download the model two ways: | 
| 61 | 
  | 
  | 
 | 
| 62 | 
  | 
  | 
\begin{enumerate} | 
| 63 | 
cnh | 
1.9 | 
\item Using CVS software. CVS is a freely available source code management | 
| 64 | 
cnh | 
1.7 | 
tool. To use CVS you need to have the software installed. Many systems | 
| 65 | 
  | 
  | 
come with CVS pre-installed, otherwise good places to look for | 
| 66 | 
  | 
  | 
the software for a particular platform are | 
| 67 | 
  | 
  | 
\begin{rawhtml} <A href=http://www.cvshome.org/ target="idontexist"> \end{rawhtml} | 
| 68 | 
  | 
  | 
cvshome.org | 
| 69 | 
  | 
  | 
\begin{rawhtml} </A> \end{rawhtml} | 
| 70 | 
  | 
  | 
and | 
| 71 | 
  | 
  | 
\begin{rawhtml} <A href=http://www.wincvs.org/ target="idontexist"> \end{rawhtml} | 
| 72 | 
  | 
  | 
wincvs.org | 
| 73 | 
  | 
  | 
\begin{rawhtml} </A> \end{rawhtml} | 
| 74 | 
  | 
  | 
. | 
| 75 | 
  | 
  | 
 | 
| 76 | 
  | 
  | 
\item Using a tar file. This method is simple and does not | 
| 77 | 
  | 
  | 
require any special software. However, this method does not | 
| 78 | 
  | 
  | 
provide easy support for maintenance updates. | 
| 79 | 
  | 
  | 
 | 
| 80 | 
  | 
  | 
\end{enumerate} | 
| 81 | 
  | 
  | 
 | 
| 82 | 
adcroft | 
1.1 | 
If CVS is available on your system, we strongly encourage you to use it. CVS | 
| 83 | 
  | 
  | 
provides an efficient and elegant way of organizing your code and keeping | 
| 84 | 
  | 
  | 
track of your changes. If CVS is not available on your machine, you can also | 
| 85 | 
  | 
  | 
download a tar file. | 
| 86 | 
  | 
  | 
 | 
| 87 | 
edhill | 
1.15 | 
Before you can use CVS, the following environment variable(s) should | 
| 88 | 
  | 
  | 
be set within your shell.  For a csh or tcsh shell, put the following  | 
| 89 | 
  | 
  | 
\begin{verbatim} | 
| 90 | 
  | 
  | 
% setenv CVSROOT :pserver:cvsanon@mitgcm.org:/u/gcmpack | 
| 91 | 
  | 
  | 
\end{verbatim} | 
| 92 | 
  | 
  | 
in your .cshrc or .tcshrc file.  For bash or sh shells, put: | 
| 93 | 
adcroft | 
1.1 | 
\begin{verbatim} | 
| 94 | 
edhill | 
1.15 | 
% export CVSROOT=':pserver:cvsanon@mitgcm.org:/u/gcmpack' | 
| 95 | 
adcroft | 
1.6 | 
\end{verbatim} | 
| 96 | 
edhill | 
1.15 | 
in your .profile or .bashrc file. | 
| 97 | 
adcroft | 
1.6 | 
 | 
| 98 | 
edhill | 
1.15 | 
 | 
| 99 | 
  | 
  | 
To get MITgcm through CVS, first register with the MITgcm CVS server | 
| 100 | 
  | 
  | 
using command: | 
| 101 | 
adcroft | 
1.6 | 
\begin{verbatim} | 
| 102 | 
adcroft | 
1.1 | 
% cvs login ( CVS password: cvsanon ) | 
| 103 | 
  | 
  | 
\end{verbatim} | 
| 104 | 
edhill | 
1.15 | 
You only need to do a ``cvs login'' once. | 
| 105 | 
adcroft | 
1.1 | 
 | 
| 106 | 
edhill | 
1.15 | 
To obtain the latest sources type: | 
| 107 | 
  | 
  | 
\begin{verbatim} | 
| 108 | 
  | 
  | 
% cvs co MITgcm | 
| 109 | 
  | 
  | 
\end{verbatim} | 
| 110 | 
  | 
  | 
or to get a specific release type: | 
| 111 | 
adcroft | 
1.1 | 
\begin{verbatim} | 
| 112 | 
edhill | 
1.16 | 
% cvs co -P -r checkpoint52i_post  MITgcm | 
| 113 | 
adcroft | 
1.1 | 
\end{verbatim} | 
| 114 | 
edhill | 
1.15 | 
The MITgcm web site contains further directions concerning the source | 
| 115 | 
  | 
  | 
code and CVS.  It also contains a web interface to our CVS archive so | 
| 116 | 
  | 
  | 
that one may easily view the state of files, revisions, and other | 
| 117 | 
  | 
  | 
development milestones: | 
| 118 | 
  | 
  | 
\begin{rawhtml} <A href=http://mitgcm.org/download target="idontexist"> \end{rawhtml} | 
| 119 | 
  | 
  | 
\begin{verbatim} | 
| 120 | 
edhill | 
1.16 | 
http://mitgcm.org/source\_code.html | 
| 121 | 
edhill | 
1.15 | 
\end{verbatim} | 
| 122 | 
  | 
  | 
\begin{rawhtml} </A> \end{rawhtml} | 
| 123 | 
adcroft | 
1.1 | 
 | 
| 124 | 
edhill | 
1.15 | 
 | 
| 125 | 
  | 
  | 
The checkout process creates a directory called \textit{MITgcm}. If | 
| 126 | 
  | 
  | 
the directory \textit{MITgcm} exists this command updates your code | 
| 127 | 
  | 
  | 
based on the repository. Each directory in the source tree contains a | 
| 128 | 
  | 
  | 
directory \textit{CVS}. This information is required by CVS to keep | 
| 129 | 
  | 
  | 
track of your file versions with respect to the repository. Don't edit | 
| 130 | 
  | 
  | 
the files in \textit{CVS}!  You can also use CVS to download code | 
| 131 | 
  | 
  | 
updates.  More extensive information on using CVS for maintaining | 
| 132 | 
  | 
  | 
MITgcm code can be found | 
| 133 | 
cnh | 
1.7 | 
\begin{rawhtml} <A href=http://mitgcm.org/usingcvstoget.html target="idontexist"> \end{rawhtml} | 
| 134 | 
  | 
  | 
here | 
| 135 | 
  | 
  | 
\begin{rawhtml} </A> \end{rawhtml}  | 
| 136 | 
  | 
  | 
. | 
| 137 | 
  | 
  | 
 | 
| 138 | 
adcroft | 
1.1 | 
 | 
| 139 | 
adcroft | 
1.4 | 
\paragraph*{Conventional download method} | 
| 140 | 
  | 
  | 
\label{sect:conventionalDownload} | 
| 141 | 
adcroft | 
1.1 | 
 | 
| 142 | 
adcroft | 
1.4 | 
If you do not have CVS on your system, you can download the model as a | 
| 143 | 
edhill | 
1.15 | 
tar file from the web site at: | 
| 144 | 
cnh | 
1.7 | 
\begin{rawhtml} <A href=http://mitgcm.org/download target="idontexist"> \end{rawhtml} | 
| 145 | 
adcroft | 
1.1 | 
\begin{verbatim} | 
| 146 | 
  | 
  | 
http://mitgcm.org/download/ | 
| 147 | 
  | 
  | 
\end{verbatim} | 
| 148 | 
cnh | 
1.7 | 
\begin{rawhtml} </A> \end{rawhtml} | 
| 149 | 
adcroft | 
1.4 | 
The tar file still contains CVS information which we urge you not to | 
| 150 | 
  | 
  | 
delete; even if you do not use CVS yourself the information can help | 
| 151 | 
edhill | 
1.15 | 
us if you should need to send us your copy of the code.  If a recent | 
| 152 | 
  | 
  | 
tar file does not exist, then please contact the developers through | 
| 153 | 
  | 
  | 
the MITgcm-support list. | 
| 154 | 
adcroft | 
1.1 | 
 | 
| 155 | 
adcroft | 
1.12 | 
\paragraph*{Upgrading from an earlier version} | 
| 156 | 
  | 
  | 
 | 
| 157 | 
  | 
  | 
If you already have an earlier version of the code you can ``upgrade'' | 
| 158 | 
  | 
  | 
your copy instead of downloading the entire repository again. First, | 
| 159 | 
  | 
  | 
``cd'' (change directory) to the top of your working copy: | 
| 160 | 
  | 
  | 
\begin{verbatim} | 
| 161 | 
  | 
  | 
% cd MITgcm | 
| 162 | 
  | 
  | 
\end{verbatim} | 
| 163 | 
edhill | 
1.15 | 
and then issue the cvs update command such as: | 
| 164 | 
adcroft | 
1.12 | 
\begin{verbatim} | 
| 165 | 
edhill | 
1.16 | 
% cvs -q update -r checkpoint52i_post -d -P | 
| 166 | 
adcroft | 
1.12 | 
\end{verbatim} | 
| 167 | 
edhill | 
1.16 | 
This will update the ``tag'' to ``checkpoint52i\_post'', add any new | 
| 168 | 
adcroft | 
1.12 | 
directories (-d) and remove any empty directories (-P). The -q option | 
| 169 | 
  | 
  | 
means be quiet which will reduce the number of messages you'll see in | 
| 170 | 
  | 
  | 
the terminal. If you have modified the code prior to upgrading, CVS | 
| 171 | 
  | 
  | 
will try to merge your changes with the upgrades. If there is a | 
| 172 | 
  | 
  | 
conflict between your modifications and the upgrade, it will report | 
| 173 | 
  | 
  | 
that file with a ``C'' in front, e.g.: | 
| 174 | 
  | 
  | 
\begin{verbatim} | 
| 175 | 
  | 
  | 
C model/src/ini_parms.F | 
| 176 | 
  | 
  | 
\end{verbatim} | 
| 177 | 
  | 
  | 
If the list of conflicts scrolled off the screen, you can re-issue the | 
| 178 | 
  | 
  | 
cvs update command and it will report the conflicts. Conflicts are | 
| 179 | 
edhill | 
1.15 | 
indicated in the code by the delimites ``$<<<<<<<$'', ``======='' and | 
| 180 | 
  | 
  | 
``$>>>>>>>$''. For example, | 
| 181 | 
adcroft | 
1.12 | 
\begin{verbatim} | 
| 182 | 
  | 
  | 
<<<<<<< ini_parms.F | 
| 183 | 
  | 
  | 
     & bottomDragLinear,myOwnBottomDragCoefficient, | 
| 184 | 
  | 
  | 
======= | 
| 185 | 
  | 
  | 
     & bottomDragLinear,bottomDragQuadratic, | 
| 186 | 
  | 
  | 
>>>>>>> 1.18 | 
| 187 | 
  | 
  | 
\end{verbatim} | 
| 188 | 
  | 
  | 
means that you added ``myOwnBottomDragCoefficient'' to a namelist at | 
| 189 | 
  | 
  | 
the same time and place that we added ``bottomDragQuadratic''. You | 
| 190 | 
  | 
  | 
need to resolve this conflict and in this case the line should be | 
| 191 | 
  | 
  | 
changed to: | 
| 192 | 
  | 
  | 
\begin{verbatim} | 
| 193 | 
  | 
  | 
     & bottomDragLinear,bottomDragQuadratic,myOwnBottomDragCoefficient, | 
| 194 | 
  | 
  | 
\end{verbatim} | 
| 195 | 
edhill | 
1.15 | 
and the lines with the delimiters ($<<<<<<$,======,$>>>>>>$) be deleted. | 
| 196 | 
adcroft | 
1.12 | 
Unless you are making modifications which exactly parallel | 
| 197 | 
  | 
  | 
developments we make, these types of conflicts should be rare. | 
| 198 | 
  | 
  | 
 | 
| 199 | 
  | 
  | 
\paragraph*{Upgrading to the current pre-release version} | 
| 200 | 
  | 
  | 
 | 
| 201 | 
  | 
  | 
We don't make a ``release'' for every little patch and bug fix in | 
| 202 | 
  | 
  | 
order to keep the frequency of upgrades to a minimum. However, if you | 
| 203 | 
  | 
  | 
have run into a problem for which ``we have already fixed in the | 
| 204 | 
  | 
  | 
latest code'' and we haven't made a ``tag'' or ``release'' since that | 
| 205 | 
  | 
  | 
patch then you'll need to get the latest code: | 
| 206 | 
  | 
  | 
\begin{verbatim} | 
| 207 | 
  | 
  | 
% cvs -q update -A -d -P | 
| 208 | 
  | 
  | 
\end{verbatim} | 
| 209 | 
  | 
  | 
Unlike, the ``check-out'' and ``update'' procedures above, there is no | 
| 210 | 
  | 
  | 
``tag'' or release name. The -A tells CVS to upgrade to the | 
| 211 | 
  | 
  | 
very latest version. As a rule, we don't recommend this since you | 
| 212 | 
  | 
  | 
might upgrade while we are in the processes of checking in the code so | 
| 213 | 
  | 
  | 
that you may only have part of a patch. Using this method of updating | 
| 214 | 
  | 
  | 
also means we can't tell what version of the code you are working | 
| 215 | 
  | 
  | 
with. So please be sure you understand what you're doing. | 
| 216 | 
  | 
  | 
 | 
| 217 | 
adcroft | 
1.4 | 
\section{Model and directory structure} | 
| 218 | 
adcroft | 
1.1 | 
 | 
| 219 | 
adcroft | 
1.12 | 
The ``numerical'' model is contained within a execution environment | 
| 220 | 
  | 
  | 
support wrapper. This wrapper is designed to provide a general | 
| 221 | 
  | 
  | 
framework for grid-point models. MITgcmUV is a specific numerical | 
| 222 | 
  | 
  | 
model that uses the framework. Under this structure the model is split | 
| 223 | 
  | 
  | 
into execution environment support code and conventional numerical | 
| 224 | 
  | 
  | 
model code. The execution environment support code is held under the | 
| 225 | 
  | 
  | 
\textit{eesupp} directory. The grid point model code is held under the | 
| 226 | 
  | 
  | 
\textit{model} directory. Code execution actually starts in the | 
| 227 | 
  | 
  | 
\textit{eesupp} routines and not in the \textit{model} routines. For | 
| 228 | 
  | 
  | 
this reason the top-level | 
| 229 | 
adcroft | 
1.1 | 
\textit{MAIN.F} is in the \textit{eesupp/src} directory. In general, | 
| 230 | 
  | 
  | 
end-users should not need to worry about this level. The top-level routine | 
| 231 | 
  | 
  | 
for the numerical part of the code is in \textit{model/src/THE\_MODEL\_MAIN.F% | 
| 232 | 
  | 
  | 
}. Here is a brief description of the directory structure of the model under | 
| 233 | 
  | 
  | 
the root tree (a detailed description is given in section 3: Code structure). | 
| 234 | 
  | 
  | 
 | 
| 235 | 
  | 
  | 
\begin{itemize} | 
| 236 | 
  | 
  | 
\item \textit{bin}: this directory is initially empty. It is the default | 
| 237 | 
  | 
  | 
directory in which to compile the code. | 
| 238 | 
  | 
  | 
 | 
| 239 | 
  | 
  | 
\item \textit{diags}: contains the code relative to time-averaged | 
| 240 | 
  | 
  | 
diagnostics. It is subdivided into two subdirectories \textit{inc} and  | 
| 241 | 
cnh | 
1.9 | 
\textit{src} that contain include files (*.\textit{h} files) and Fortran | 
| 242 | 
adcroft | 
1.1 | 
subroutines (*.\textit{F} files), respectively. | 
| 243 | 
  | 
  | 
 | 
| 244 | 
  | 
  | 
\item \textit{doc}: contains brief documentation notes. | 
| 245 | 
  | 
  | 
 | 
| 246 | 
  | 
  | 
\item \textit{eesupp}: contains the execution environment source code. Also | 
| 247 | 
  | 
  | 
subdivided into two subdirectories \textit{inc} and \textit{src}. | 
| 248 | 
  | 
  | 
 | 
| 249 | 
  | 
  | 
\item \textit{exe}: this directory is initially empty. It is the default | 
| 250 | 
  | 
  | 
directory in which to execute the code. | 
| 251 | 
  | 
  | 
 | 
| 252 | 
  | 
  | 
\item \textit{model}: this directory contains the main source code. Also | 
| 253 | 
  | 
  | 
subdivided into two subdirectories \textit{inc} and \textit{src}. | 
| 254 | 
  | 
  | 
 | 
| 255 | 
  | 
  | 
\item \textit{pkg}: contains the source code for the packages. Each package | 
| 256 | 
  | 
  | 
corresponds to a subdirectory. For example, \textit{gmredi} contains the | 
| 257 | 
  | 
  | 
code related to the Gent-McWilliams/Redi scheme, \textit{aim} the code | 
| 258 | 
  | 
  | 
relative to the atmospheric intermediate physics. The packages are described | 
| 259 | 
  | 
  | 
in detail in section 3. | 
| 260 | 
  | 
  | 
 | 
| 261 | 
  | 
  | 
\item \textit{tools}: this directory contains various useful tools. For | 
| 262 | 
edhill | 
1.15 | 
example, \textit{genmake2} is a script written in csh (C-shell) that should | 
| 263 | 
adcroft | 
1.1 | 
be used to generate your makefile. The directory \textit{adjoint} contains | 
| 264 | 
  | 
  | 
the makefile specific to the Tangent linear and Adjoint Compiler (TAMC) that | 
| 265 | 
  | 
  | 
generates the adjoint code. The latter is described in details in part V. | 
| 266 | 
  | 
  | 
 | 
| 267 | 
  | 
  | 
\item \textit{utils}: this directory contains various utilities. The | 
| 268 | 
adcroft | 
1.4 | 
subdirectory \textit{knudsen2} contains code and a makefile that | 
| 269 | 
  | 
  | 
compute coefficients of the polynomial approximation to the knudsen | 
| 270 | 
  | 
  | 
formula for an ocean nonlinear equation of state. The \textit{matlab} | 
| 271 | 
  | 
  | 
subdirectory contains matlab scripts for reading model output directly | 
| 272 | 
  | 
  | 
into matlab. \textit{scripts} contains C-shell post-processing | 
| 273 | 
  | 
  | 
scripts for joining processor-based and tiled-based model output. | 
| 274 | 
adcroft | 
1.1 | 
 | 
| 275 | 
  | 
  | 
\item \textit{verification}: this directory contains the model examples. See | 
| 276 | 
adcroft | 
1.4 | 
section \ref{sect:modelExamples}. | 
| 277 | 
adcroft | 
1.1 | 
\end{itemize} | 
| 278 | 
  | 
  | 
 | 
| 279 | 
adcroft | 
1.4 | 
\section{Example experiments} | 
| 280 | 
  | 
  | 
\label{sect:modelExamples} | 
| 281 | 
adcroft | 
1.1 | 
 | 
| 282 | 
edhill | 
1.15 | 
%% a set of twenty-four pre-configured numerical experiments | 
| 283 | 
  | 
  | 
 | 
| 284 | 
  | 
  | 
The MITgcm distribution comes with more than a dozen pre-configured | 
| 285 | 
  | 
  | 
numerical experiments. Some of these example experiments are tests of | 
| 286 | 
  | 
  | 
individual parts of the model code, but many are fully fledged | 
| 287 | 
  | 
  | 
numerical simulations. A few of the examples are used for tutorial | 
| 288 | 
  | 
  | 
documentation in sections \ref{sect:eg-baro} - \ref{sect:eg-global}. | 
| 289 | 
  | 
  | 
The other examples follow the same general structure as the tutorial | 
| 290 | 
  | 
  | 
examples. However, they only include brief instructions in a text file | 
| 291 | 
  | 
  | 
called {\it README}.  The examples are located in subdirectories under | 
| 292 | 
  | 
  | 
the directory \textit{verification}. Each example is briefly described | 
| 293 | 
  | 
  | 
below. | 
| 294 | 
adcroft | 
1.1 | 
 | 
| 295 | 
cnh | 
1.8 | 
\subsection{Full list of model examples} | 
| 296 | 
adcroft | 
1.1 | 
 | 
| 297 | 
cnh | 
1.8 | 
\begin{enumerate} | 
| 298 | 
adcroft | 
1.1 | 
\item \textit{exp0} - single layer, ocean double gyre (barotropic with | 
| 299 | 
edhill | 
1.15 | 
  free-surface). This experiment is described in detail in section | 
| 300 | 
  | 
  | 
  \ref{sect:eg-baro}. | 
| 301 | 
adcroft | 
1.1 | 
 | 
| 302 | 
edhill | 
1.15 | 
\item \textit{exp1} - Four layer, ocean double gyre. This experiment | 
| 303 | 
  | 
  | 
  is described in detail in section \ref{sect:eg-baroc}. | 
| 304 | 
  | 
  | 
   | 
| 305 | 
adcroft | 
1.1 | 
\item \textit{exp2} - 4x4 degree global ocean simulation with steady | 
| 306 | 
edhill | 
1.15 | 
  climatological forcing. This experiment is described in detail in | 
| 307 | 
  | 
  | 
  section \ref{sect:eg-global}. | 
| 308 | 
  | 
  | 
   | 
| 309 | 
  | 
  | 
\item \textit{exp4} - Flow over a Gaussian bump in open-water or | 
| 310 | 
  | 
  | 
  channel with open boundaries. | 
| 311 | 
  | 
  | 
   | 
| 312 | 
  | 
  | 
\item \textit{exp5} - Inhomogenously forced ocean convection in a | 
| 313 | 
  | 
  | 
  doubly periodic box. | 
| 314 | 
adcroft | 
1.1 | 
 | 
| 315 | 
cnh | 
1.8 | 
\item \textit{front\_relax} - Relaxation of an ocean thermal front (test for | 
| 316 | 
adcroft | 
1.1 | 
Gent/McWilliams scheme). 2D (Y-Z). | 
| 317 | 
  | 
  | 
 | 
| 318 | 
edhill | 
1.15 | 
\item \textit{internal wave} - Ocean internal wave forced by open | 
| 319 | 
  | 
  | 
  boundary conditions. | 
| 320 | 
  | 
  | 
   | 
| 321 | 
cnh | 
1.8 | 
\item \textit{natl\_box} - Eastern subtropical North Atlantic with KPP | 
| 322 | 
edhill | 
1.15 | 
  scheme; 1 month integration | 
| 323 | 
  | 
  | 
   | 
| 324 | 
  | 
  | 
\item \textit{hs94.1x64x5} - Zonal averaged atmosphere using Held and | 
| 325 | 
  | 
  | 
  Suarez '94 forcing. | 
| 326 | 
  | 
  | 
   | 
| 327 | 
  | 
  | 
\item \textit{hs94.128x64x5} - 3D atmosphere dynamics using Held and | 
| 328 | 
  | 
  | 
  Suarez '94 forcing. | 
| 329 | 
  | 
  | 
   | 
| 330 | 
adcroft | 
1.1 | 
\item \textit{hs94.cs-32x32x5} - 3D atmosphere dynamics using Held and | 
| 331 | 
edhill | 
1.15 | 
  Suarez '94 forcing on the cubed sphere. | 
| 332 | 
  | 
  | 
   | 
| 333 | 
  | 
  | 
\item \textit{aim.5l\_zon-ave} - Intermediate Atmospheric physics. | 
| 334 | 
  | 
  | 
  Global Zonal Mean configuration, 1x64x5 resolution. | 
| 335 | 
  | 
  | 
   | 
| 336 | 
  | 
  | 
\item \textit{aim.5l\_XZ\_Equatorial\_Slice} - Intermediate | 
| 337 | 
  | 
  | 
  Atmospheric physics, equatorial Slice configuration.  2D (X-Z). | 
| 338 | 
  | 
  | 
   | 
| 339 | 
adcroft | 
1.1 | 
\item \textit{aim.5l\_Equatorial\_Channel} - Intermediate Atmospheric | 
| 340 | 
edhill | 
1.15 | 
  physics. 3D Equatorial Channel configuration. | 
| 341 | 
  | 
  | 
   | 
| 342 | 
cnh | 
1.8 | 
\item \textit{aim.5l\_LatLon} - Intermediate Atmospheric physics. | 
| 343 | 
edhill | 
1.15 | 
  Global configuration, on latitude longitude grid with 128x64x5 grid | 
| 344 | 
  | 
  | 
  points ($2.8^\circ{\rm degree}$ resolution). | 
| 345 | 
  | 
  | 
   | 
| 346 | 
  | 
  | 
\item \textit{adjustment.128x64x1} Barotropic adjustment problem on | 
| 347 | 
  | 
  | 
  latitude longitude grid with 128x64 grid points ($2.8^\circ{\rm | 
| 348 | 
  | 
  | 
    degree}$ resolution). | 
| 349 | 
  | 
  | 
   | 
| 350 | 
  | 
  | 
\item \textit{adjustment.cs-32x32x1} Barotropic adjustment problem on | 
| 351 | 
  | 
  | 
  cube sphere grid with 32x32 points per face ( roughly $2.8^\circ{\rm | 
| 352 | 
  | 
  | 
    degree}$ resolution). | 
| 353 | 
  | 
  | 
   | 
| 354 | 
cnh | 
1.8 | 
\item \textit{advect\_cs} Two-dimensional passive advection test on | 
| 355 | 
edhill | 
1.15 | 
  cube sphere grid. | 
| 356 | 
  | 
  | 
   | 
| 357 | 
  | 
  | 
\item \textit{advect\_xy} Two-dimensional (horizontal plane) passive | 
| 358 | 
  | 
  | 
  advection test on Cartesian grid. | 
| 359 | 
  | 
  | 
   | 
| 360 | 
  | 
  | 
\item \textit{advect\_yz} Two-dimensional (vertical plane) passive | 
| 361 | 
  | 
  | 
  advection test on Cartesian grid. | 
| 362 | 
  | 
  | 
   | 
| 363 | 
  | 
  | 
\item \textit{carbon} Simple passive tracer experiment. Includes | 
| 364 | 
  | 
  | 
  derivative calculation. Described in detail in section | 
| 365 | 
  | 
  | 
  \ref{sect:eg-carbon-ad}. | 
| 366 | 
cnh | 
1.8 | 
 | 
| 367 | 
  | 
  | 
\item \textit{flt\_example} Example of using float package. | 
| 368 | 
edhill | 
1.15 | 
   | 
| 369 | 
  | 
  | 
\item \textit{global\_ocean.90x40x15} Global circulation with GM, flux | 
| 370 | 
  | 
  | 
  boundary conditions and poles. | 
| 371 | 
cnh | 
1.8 | 
 | 
| 372 | 
mlosch | 
1.13 | 
\item \textit{global\_ocean\_pressure} Global circulation in pressure | 
| 373 | 
  | 
  | 
  coordinate (non-Boussinesq ocean model). Described in detail in | 
| 374 | 
  | 
  | 
  section \ref{sect:eg-globalpressure}. | 
| 375 | 
edhill | 
1.15 | 
   | 
| 376 | 
  | 
  | 
\item \textit{solid-body.cs-32x32x1} Solid body rotation test for cube | 
| 377 | 
  | 
  | 
  sphere grid. | 
| 378 | 
cnh | 
1.8 | 
 | 
| 379 | 
  | 
  | 
\end{enumerate} | 
| 380 | 
adcroft | 
1.1 | 
 | 
| 381 | 
adcroft | 
1.4 | 
\subsection{Directory structure of model examples} | 
| 382 | 
adcroft | 
1.1 | 
 | 
| 383 | 
  | 
  | 
Each example directory has the following subdirectories: | 
| 384 | 
  | 
  | 
 | 
| 385 | 
  | 
  | 
\begin{itemize} | 
| 386 | 
  | 
  | 
\item \textit{code}: contains the code particular to the example. At a | 
| 387 | 
edhill | 
1.16 | 
  minimum, this directory includes the following files: | 
| 388 | 
adcroft | 
1.1 | 
 | 
| 389 | 
edhill | 
1.16 | 
  \begin{itemize} | 
| 390 | 
  | 
  | 
  \item \textit{code/CPP\_EEOPTIONS.h}: declares CPP keys relative to | 
| 391 | 
  | 
  | 
    the ``execution environment'' part of the code. The default | 
| 392 | 
  | 
  | 
    version is located in \textit{eesupp/inc}. | 
| 393 | 
  | 
  | 
   | 
| 394 | 
  | 
  | 
  \item \textit{code/CPP\_OPTIONS.h}: declares CPP keys relative to | 
| 395 | 
  | 
  | 
    the ``numerical model'' part of the code. The default version is | 
| 396 | 
  | 
  | 
    located in \textit{model/inc}. | 
| 397 | 
  | 
  | 
   | 
| 398 | 
  | 
  | 
  \item \textit{code/SIZE.h}: declares size of underlying | 
| 399 | 
  | 
  | 
    computational grid.  The default version is located in | 
| 400 | 
  | 
  | 
    \textit{model/inc}. | 
| 401 | 
  | 
  | 
  \end{itemize} | 
| 402 | 
  | 
  | 
   | 
| 403 | 
  | 
  | 
  In addition, other include files and subroutines might be present in | 
| 404 | 
  | 
  | 
  \textit{code} depending on the particular experiment. See Section 2 | 
| 405 | 
  | 
  | 
  for more details. | 
| 406 | 
edhill | 
1.15 | 
   | 
| 407 | 
  | 
  | 
\item \textit{input}: contains the input data files required to run | 
| 408 | 
  | 
  | 
  the example. At a minimum, the \textit{input} directory contains the | 
| 409 | 
  | 
  | 
  following files: | 
| 410 | 
adcroft | 
1.1 | 
 | 
| 411 | 
edhill | 
1.16 | 
  \begin{itemize} | 
| 412 | 
  | 
  | 
  \item \textit{input/data}: this file, written as a namelist, | 
| 413 | 
  | 
  | 
    specifies the main parameters for the experiment. | 
| 414 | 
  | 
  | 
   | 
| 415 | 
  | 
  | 
  \item \textit{input/data.pkg}: contains parameters relative to the | 
| 416 | 
  | 
  | 
    packages used in the experiment. | 
| 417 | 
  | 
  | 
   | 
| 418 | 
  | 
  | 
  \item \textit{input/eedata}: this file contains ``execution | 
| 419 | 
  | 
  | 
    environment'' data. At present, this consists of a specification | 
| 420 | 
  | 
  | 
    of the number of threads to use in $X$ and $Y$ under multithreaded | 
| 421 | 
  | 
  | 
    execution. | 
| 422 | 
  | 
  | 
  \end{itemize} | 
| 423 | 
  | 
  | 
 | 
| 424 | 
  | 
  | 
In addition, you will also find in this directory the forcing and | 
| 425 | 
  | 
  | 
topography files as well as the files describing the initial state of | 
| 426 | 
  | 
  | 
the experiment.  This varies from experiment to experiment. See | 
| 427 | 
  | 
  | 
section 2 for more details. | 
| 428 | 
  | 
  | 
 | 
| 429 | 
  | 
  | 
\item \textit{results}: this directory contains the output file | 
| 430 | 
  | 
  | 
  \textit{output.txt} produced by the simulation example. This file is | 
| 431 | 
  | 
  | 
  useful for comparison with your own output when you run the | 
| 432 | 
  | 
  | 
  experiment. | 
| 433 | 
adcroft | 
1.1 | 
\end{itemize} | 
| 434 | 
  | 
  | 
 | 
| 435 | 
  | 
  | 
Once you have chosen the example you want to run, you are ready to compile | 
| 436 | 
  | 
  | 
the code. | 
| 437 | 
  | 
  | 
 | 
| 438 | 
adcroft | 
1.4 | 
\section{Building the code} | 
| 439 | 
  | 
  | 
\label{sect:buildingCode} | 
| 440 | 
  | 
  | 
 | 
| 441 | 
  | 
  | 
To compile the code, we use the {\em make} program. This uses a file | 
| 442 | 
  | 
  | 
({\em Makefile}) that allows us to pre-process source files, specify | 
| 443 | 
  | 
  | 
compiler and optimization options and also figures out any file | 
| 444 | 
edhill | 
1.16 | 
dependencies. We supply a script ({\em genmake2}), described in | 
| 445 | 
  | 
  | 
section \ref{sect:genmake}, that automatically creates the {\em | 
| 446 | 
  | 
  | 
  Makefile} for you. You then need to build the dependencies and | 
| 447 | 
  | 
  | 
compile the code. | 
| 448 | 
adcroft | 
1.4 | 
 | 
| 449 | 
  | 
  | 
As an example, let's assume that you want to build and run experiment | 
| 450 | 
edhill | 
1.16 | 
\textit{verification/exp2}. The are multiple ways and places to | 
| 451 | 
  | 
  | 
actually do this but here let's build the code in | 
| 452 | 
adcroft | 
1.4 | 
\textit{verification/exp2/input}: | 
| 453 | 
  | 
  | 
\begin{verbatim} | 
| 454 | 
  | 
  | 
% cd verification/exp2/input | 
| 455 | 
  | 
  | 
\end{verbatim} | 
| 456 | 
  | 
  | 
First, build the {\em Makefile}: | 
| 457 | 
  | 
  | 
\begin{verbatim} | 
| 458 | 
edhill | 
1.16 | 
% ../../../tools/genmake2 -mods=../code | 
| 459 | 
adcroft | 
1.4 | 
\end{verbatim} | 
| 460 | 
  | 
  | 
The command line option tells {\em genmake} to override model source | 
| 461 | 
  | 
  | 
code with any files in the directory {\em ./code/}. | 
| 462 | 
  | 
  | 
 | 
| 463 | 
edhill | 
1.16 | 
On many systems, the {\em genmake2} program will be able to | 
| 464 | 
  | 
  | 
automatically recognize the hardware, find compilers and other tools | 
| 465 | 
  | 
  | 
within the user's path (``echo \$PATH''), and then choose an | 
| 466 | 
  | 
  | 
appropriate set of options from the files contained in the {\em | 
| 467 | 
  | 
  | 
  tools/build\_options} directory.  Under some circumstances, a user | 
| 468 | 
  | 
  | 
may have to create a new ``optfile'' in order to specify the exact | 
| 469 | 
  | 
  | 
combination of compiler, compiler flags, libraries, and other options | 
| 470 | 
  | 
  | 
necessary to build a particular configuration of MITgcm.  In such | 
| 471 | 
  | 
  | 
cases, it is generally helpful to read the existing ``optfiles'' and | 
| 472 | 
  | 
  | 
mimic their syntax. | 
| 473 | 
  | 
  | 
 | 
| 474 | 
  | 
  | 
Through the MITgcm-support list, the MITgcm developers are willing to | 
| 475 | 
  | 
  | 
provide help writing or modifing ``optfiles''.  And we encourage users | 
| 476 | 
  | 
  | 
to post new ``optfiles'' (particularly ones for new machines or | 
| 477 | 
  | 
  | 
architectures) to the MITgcm-support list. | 
| 478 | 
  | 
  | 
 | 
| 479 | 
  | 
  | 
To specify an optfile to {\em genmake2}, the syntax is: | 
| 480 | 
adcroft | 
1.4 | 
\begin{verbatim} | 
| 481 | 
edhill | 
1.16 | 
% ../../../tools/genmake2 -mods=../code -of /path/to/optfile | 
| 482 | 
adcroft | 
1.4 | 
\end{verbatim} | 
| 483 | 
  | 
  | 
 | 
| 484 | 
edhill | 
1.16 | 
Once a {\em Makefile} has been generated, we create the dependencies: | 
| 485 | 
adcroft | 
1.4 | 
\begin{verbatim} | 
| 486 | 
  | 
  | 
% make depend | 
| 487 | 
  | 
  | 
\end{verbatim} | 
| 488 | 
edhill | 
1.16 | 
This modifies the {\em Makefile} by attaching a [long] list of files | 
| 489 | 
  | 
  | 
upon which other files depend. The purpose of this is to reduce | 
| 490 | 
  | 
  | 
re-compilation if and when you start to modify the code. The {\tt make | 
| 491 | 
  | 
  | 
  depend} command also creates links from the model source to this | 
| 492 | 
  | 
  | 
directory. | 
| 493 | 
adcroft | 
1.1 | 
 | 
| 494 | 
edhill | 
1.16 | 
Next compile the code: | 
| 495 | 
adcroft | 
1.4 | 
\begin{verbatim} | 
| 496 | 
  | 
  | 
% make | 
| 497 | 
  | 
  | 
\end{verbatim} | 
| 498 | 
  | 
  | 
The {\tt make} command creates an executable called \textit{mitgcmuv}. | 
| 499 | 
edhill | 
1.16 | 
Additional make ``targets'' are defined within the makefile to aid in | 
| 500 | 
  | 
  | 
the production of adjoint and other versions of MITgcm. | 
| 501 | 
adcroft | 
1.4 | 
 | 
| 502 | 
  | 
  | 
Now you are ready to run the model. General instructions for doing so are | 
| 503 | 
  | 
  | 
given in section \ref{sect:runModel}. Here, we can run the model with: | 
| 504 | 
  | 
  | 
\begin{verbatim} | 
| 505 | 
  | 
  | 
./mitgcmuv > output.txt | 
| 506 | 
  | 
  | 
\end{verbatim} | 
| 507 | 
  | 
  | 
where we are re-directing the stream of text output to the file {\em | 
| 508 | 
  | 
  | 
output.txt}. | 
| 509 | 
  | 
  | 
 | 
| 510 | 
  | 
  | 
 | 
| 511 | 
  | 
  | 
\subsection{Building/compiling the code elsewhere} | 
| 512 | 
  | 
  | 
 | 
| 513 | 
  | 
  | 
In the example above (section \ref{sect:buildingCode}) we built the | 
| 514 | 
  | 
  | 
executable in the {\em input} directory of the experiment for | 
| 515 | 
  | 
  | 
convenience. You can also configure and compile the code in other | 
| 516 | 
  | 
  | 
locations, for example on a scratch disk with out having to copy the | 
| 517 | 
  | 
  | 
entire source tree. The only requirement to do so is you have {\tt | 
| 518 | 
edhill | 
1.16 | 
  genmake2} in your path or you know the absolute path to {\tt | 
| 519 | 
  | 
  | 
  genmake2}. | 
| 520 | 
adcroft | 
1.4 | 
 | 
| 521 | 
edhill | 
1.16 | 
The following sections outline some possible methods of organizing | 
| 522 | 
  | 
  | 
your source and data. | 
| 523 | 
adcroft | 
1.4 | 
 | 
| 524 | 
  | 
  | 
\subsubsection{Building from the {\em ../code directory}} | 
| 525 | 
  | 
  | 
 | 
| 526 | 
  | 
  | 
This is just as simple as building in the {\em input/} directory: | 
| 527 | 
  | 
  | 
\begin{verbatim} | 
| 528 | 
  | 
  | 
% cd verification/exp2/code | 
| 529 | 
edhill | 
1.16 | 
% ../../../tools/genmake2 | 
| 530 | 
adcroft | 
1.4 | 
% make depend | 
| 531 | 
  | 
  | 
% make | 
| 532 | 
  | 
  | 
\end{verbatim} | 
| 533 | 
  | 
  | 
However, to run the model the executable ({\em mitgcmuv}) and input | 
| 534 | 
  | 
  | 
files must be in the same place. If you only have one calculation to make: | 
| 535 | 
  | 
  | 
\begin{verbatim} | 
| 536 | 
  | 
  | 
% cd ../input | 
| 537 | 
  | 
  | 
% cp ../code/mitgcmuv ./ | 
| 538 | 
  | 
  | 
% ./mitgcmuv > output.txt | 
| 539 | 
  | 
  | 
\end{verbatim} | 
| 540 | 
cnh | 
1.9 | 
or if you will be making multiple runs with the same executable: | 
| 541 | 
adcroft | 
1.4 | 
\begin{verbatim} | 
| 542 | 
  | 
  | 
% cd ../ | 
| 543 | 
  | 
  | 
% cp -r input run1 | 
| 544 | 
  | 
  | 
% cp code/mitgcmuv run1 | 
| 545 | 
  | 
  | 
% cd run1 | 
| 546 | 
  | 
  | 
% ./mitgcmuv > output.txt | 
| 547 | 
  | 
  | 
\end{verbatim} | 
| 548 | 
  | 
  | 
 | 
| 549 | 
  | 
  | 
\subsubsection{Building from a new directory} | 
| 550 | 
  | 
  | 
 | 
| 551 | 
  | 
  | 
Since the {\em input} directory contains input files it is often more | 
| 552 | 
cnh | 
1.9 | 
useful to keep {\em input} pristine and build in a new directory | 
| 553 | 
adcroft | 
1.4 | 
within {\em verification/exp2/}: | 
| 554 | 
  | 
  | 
\begin{verbatim} | 
| 555 | 
  | 
  | 
% cd verification/exp2 | 
| 556 | 
  | 
  | 
% mkdir build | 
| 557 | 
  | 
  | 
% cd build | 
| 558 | 
edhill | 
1.16 | 
% ../../../tools/genmake2 -mods=../code | 
| 559 | 
adcroft | 
1.4 | 
% make depend | 
| 560 | 
  | 
  | 
% make | 
| 561 | 
  | 
  | 
\end{verbatim} | 
| 562 | 
  | 
  | 
This builds the code exactly as before but this time you need to copy | 
| 563 | 
  | 
  | 
either the executable or the input files or both in order to run the | 
| 564 | 
  | 
  | 
model. For example, | 
| 565 | 
  | 
  | 
\begin{verbatim} | 
| 566 | 
  | 
  | 
% cp ../input/* ./ | 
| 567 | 
  | 
  | 
% ./mitgcmuv > output.txt | 
| 568 | 
  | 
  | 
\end{verbatim} | 
| 569 | 
  | 
  | 
or if you tend to make multiple runs with the same executable then | 
| 570 | 
  | 
  | 
running in a new directory each time might be more appropriate: | 
| 571 | 
  | 
  | 
\begin{verbatim} | 
| 572 | 
  | 
  | 
% cd ../ | 
| 573 | 
  | 
  | 
% mkdir run1 | 
| 574 | 
  | 
  | 
% cp build/mitgcmuv run1/ | 
| 575 | 
  | 
  | 
% cp input/* run1/ | 
| 576 | 
  | 
  | 
% cd run1 | 
| 577 | 
  | 
  | 
% ./mitgcmuv > output.txt | 
| 578 | 
  | 
  | 
\end{verbatim} | 
| 579 | 
  | 
  | 
 | 
| 580 | 
edhill | 
1.16 | 
\subsubsection{Building on a scratch disk} | 
| 581 | 
adcroft | 
1.4 | 
 | 
| 582 | 
  | 
  | 
Model object files and output data can use up large amounts of disk | 
| 583 | 
  | 
  | 
space so it is often the case that you will be operating on a large | 
| 584 | 
  | 
  | 
scratch disk. Assuming the model source is in {\em ~/MITgcm} then the | 
| 585 | 
  | 
  | 
following commands will build the model in {\em /scratch/exp2-run1}: | 
| 586 | 
  | 
  | 
\begin{verbatim} | 
| 587 | 
  | 
  | 
% cd /scratch/exp2-run1 | 
| 588 | 
edhill | 
1.16 | 
% ~/MITgcm/tools/genmake2 -rootdir=~/MITgcm \ | 
| 589 | 
  | 
  | 
  -mods=~/MITgcm/verification/exp2/code | 
| 590 | 
adcroft | 
1.4 | 
% make depend | 
| 591 | 
  | 
  | 
% make | 
| 592 | 
  | 
  | 
\end{verbatim} | 
| 593 | 
  | 
  | 
To run the model here, you'll need the input files: | 
| 594 | 
  | 
  | 
\begin{verbatim} | 
| 595 | 
  | 
  | 
% cp ~/MITgcm/verification/exp2/input/* ./ | 
| 596 | 
  | 
  | 
% ./mitgcmuv > output.txt | 
| 597 | 
  | 
  | 
\end{verbatim} | 
| 598 | 
  | 
  | 
 | 
| 599 | 
  | 
  | 
As before, you could build in one directory and make multiple runs of | 
| 600 | 
  | 
  | 
the one experiment: | 
| 601 | 
  | 
  | 
\begin{verbatim} | 
| 602 | 
  | 
  | 
% cd /scratch/exp2 | 
| 603 | 
  | 
  | 
% mkdir build | 
| 604 | 
  | 
  | 
% cd build | 
| 605 | 
edhill | 
1.16 | 
% ~/MITgcm/tools/genmake2 -rootdir=~/MITgcm \ | 
| 606 | 
  | 
  | 
  -mods=~/MITgcm/verification/exp2/code | 
| 607 | 
adcroft | 
1.4 | 
% make depend | 
| 608 | 
  | 
  | 
% make | 
| 609 | 
  | 
  | 
% cd ../ | 
| 610 | 
  | 
  | 
% cp -r ~/MITgcm/verification/exp2/input run2 | 
| 611 | 
  | 
  | 
% cd run2 | 
| 612 | 
  | 
  | 
% ./mitgcmuv > output.txt | 
| 613 | 
  | 
  | 
\end{verbatim} | 
| 614 | 
  | 
  | 
 | 
| 615 | 
  | 
  | 
 | 
| 616 | 
  | 
  | 
 | 
| 617 | 
edhill | 
1.16 | 
\subsection{Using \textit{genmake2}} | 
| 618 | 
adcroft | 
1.4 | 
\label{sect:genmake} | 
| 619 | 
adcroft | 
1.1 | 
 | 
| 620 | 
edhill | 
1.16 | 
To compile the code, first use the program \texttt{genmake2} (located | 
| 621 | 
  | 
  | 
in the \textit{tools} directory) to generate a Makefile. | 
| 622 | 
  | 
  | 
\texttt{genmake2} is a shell script written to work with all | 
| 623 | 
  | 
  | 
``sh''--compatible shells including bash v1, bash v2, and Bourne. | 
| 624 | 
  | 
  | 
Internally, \texttt{genmake2} determines the locations of needed | 
| 625 | 
  | 
  | 
files, the compiler, compiler options, libraries, and Unix tools.  It | 
| 626 | 
  | 
  | 
relies upon a number of ``optfiles'' located in the {\em | 
| 627 | 
  | 
  | 
  tools/build\_options} directory. | 
| 628 | 
  | 
  | 
 | 
| 629 | 
  | 
  | 
The purpose of the optfiles is to provide all the compilation options | 
| 630 | 
  | 
  | 
for particular ``platforms'' (where ``platform'' roughly means the | 
| 631 | 
  | 
  | 
combination of the hardware and the compiler) and code configurations. | 
| 632 | 
  | 
  | 
Given the combinations of possible compilers and library dependencies | 
| 633 | 
  | 
  | 
({\it eg.}  MPI and NetCDF) there may be numerous optfiles available | 
| 634 | 
  | 
  | 
for a single machine.  The naming scheme for the majority of the | 
| 635 | 
  | 
  | 
optfiles shipped with the code is | 
| 636 | 
  | 
  | 
\begin{center} | 
| 637 | 
  | 
  | 
  {\bf OS\_HARDWARE\_COMPILER } | 
| 638 | 
  | 
  | 
\end{center} | 
| 639 | 
  | 
  | 
where | 
| 640 | 
  | 
  | 
\begin{description} | 
| 641 | 
  | 
  | 
\item[OS] is the name of the operating system (generally the | 
| 642 | 
  | 
  | 
  lower-case output of the {\tt 'uname'} command) | 
| 643 | 
  | 
  | 
\item[HARDWARE] is a string that describes the CPU type and | 
| 644 | 
  | 
  | 
  corresponds to output from the  {\tt 'uname -m'} command: | 
| 645 | 
  | 
  | 
  \begin{description} | 
| 646 | 
  | 
  | 
  \item[ia32] is for ``x86'' machines such as i386, i486, i586, i686, | 
| 647 | 
  | 
  | 
    and athlon | 
| 648 | 
  | 
  | 
  \item[ia64] is for Intel IA64 systems (eg. Itanium, Itanium2) | 
| 649 | 
  | 
  | 
  \item[amd64] is AMD x86\_64 systems | 
| 650 | 
  | 
  | 
  \item[ppc] is for Mac PowerPC systems | 
| 651 | 
  | 
  | 
  \end{description} | 
| 652 | 
  | 
  | 
\item[COMPILER] is the compiler name (generally, the name of the | 
| 653 | 
  | 
  | 
  FORTRAN executable) | 
| 654 | 
  | 
  | 
\end{description} | 
| 655 | 
  | 
  | 
 | 
| 656 | 
  | 
  | 
In many cases, the default optfiles are sufficient and will result in | 
| 657 | 
  | 
  | 
usable Makefiles.  However, for some machines or code configurations, | 
| 658 | 
  | 
  | 
new ``optfiles'' must be written. To create a new optfile, it is | 
| 659 | 
  | 
  | 
generally best to start with one of the defaults and modify it to suit | 
| 660 | 
  | 
  | 
your needs.  Like \texttt{genmake2}, the optfiles are all written | 
| 661 | 
  | 
  | 
using a simple ``sh''--compatible syntax.  While nearly all variables | 
| 662 | 
  | 
  | 
used within \texttt{genmake2} may be specified in the optfiles, the | 
| 663 | 
  | 
  | 
critical ones that should be defined are: | 
| 664 | 
  | 
  | 
 | 
| 665 | 
  | 
  | 
\begin{description} | 
| 666 | 
  | 
  | 
\item[FC] the FORTRAN compiler (executable) to use | 
| 667 | 
  | 
  | 
\item[DEFINES] the command-line DEFINE options passed to the compiler | 
| 668 | 
  | 
  | 
\item[CPP] the C pre-processor to use | 
| 669 | 
  | 
  | 
\item[NOOPTFLAGS] options flags for special files that should not be | 
| 670 | 
  | 
  | 
  optimized | 
| 671 | 
  | 
  | 
\end{description} | 
| 672 | 
  | 
  | 
 | 
| 673 | 
  | 
  | 
For example, the optfile for a typical Red Hat Linux machine (``ia32'' | 
| 674 | 
  | 
  | 
architecture) using the GCC (g77) compiler is | 
| 675 | 
  | 
  | 
\begin{verbatim} | 
| 676 | 
  | 
  | 
FC=g77 | 
| 677 | 
  | 
  | 
DEFINES='-D_BYTESWAPIO -DWORDLENGTH=4' | 
| 678 | 
  | 
  | 
CPP='cpp  -traditional -P' | 
| 679 | 
  | 
  | 
NOOPTFLAGS='-O0' | 
| 680 | 
  | 
  | 
#  For IEEE, use the "-ffloat-store" option | 
| 681 | 
  | 
  | 
if test "x$IEEE" = x ; then | 
| 682 | 
  | 
  | 
    FFLAGS='-Wimplicit -Wunused -Wuninitialized' | 
| 683 | 
  | 
  | 
    FOPTIM='-O3 -malign-double -funroll-loops' | 
| 684 | 
  | 
  | 
else | 
| 685 | 
  | 
  | 
    FFLAGS='-Wimplicit -Wunused -ffloat-store' | 
| 686 | 
  | 
  | 
    FOPTIM='-O0 -malign-double' | 
| 687 | 
  | 
  | 
fi | 
| 688 | 
  | 
  | 
\end{verbatim} | 
| 689 | 
  | 
  | 
 | 
| 690 | 
  | 
  | 
If you write an optfile for an unrepresented machine or compiler, you | 
| 691 | 
  | 
  | 
are strongly encouraged to submit the optfile to the MITgcm project | 
| 692 | 
  | 
  | 
for inclusion.  Please send the file to the | 
| 693 | 
  | 
  | 
\begin{rawhtml} <A href="mail-to:MITgcm-support@mitgcm.org"> \end{rawhtml} | 
| 694 | 
  | 
  | 
\begin{center} | 
| 695 | 
  | 
  | 
  MITgcm-support@mitgcm.org | 
| 696 | 
  | 
  | 
\end{center} | 
| 697 | 
  | 
  | 
\begin{rawhtml} </A> \end{rawhtml} | 
| 698 | 
  | 
  | 
mailing list. | 
| 699 | 
adcroft | 
1.1 | 
 | 
| 700 | 
edhill | 
1.16 | 
In addition to the optfiles, \texttt{genmake2} supports a number of | 
| 701 | 
  | 
  | 
helpful command-line options.  A complete list of these options can be | 
| 702 | 
  | 
  | 
obtained from: | 
| 703 | 
  | 
  | 
\begin{verbatim} | 
| 704 | 
  | 
  | 
% genmake2 -h | 
| 705 | 
  | 
  | 
\end{verbatim} | 
| 706 | 
  | 
  | 
 | 
| 707 | 
  | 
  | 
The most important command-line options are: | 
| 708 | 
  | 
  | 
\begin{description} | 
| 709 | 
  | 
  | 
   | 
| 710 | 
  | 
  | 
\item[--optfile=/PATH/FILENAME] specifies the optfile that should be | 
| 711 | 
  | 
  | 
  used for a particular build. | 
| 712 | 
  | 
  | 
   | 
| 713 | 
  | 
  | 
  If no "optfile" is specified (either through the command line or the | 
| 714 | 
  | 
  | 
  MITGCM\_OPTFILE environment variable), genmake2 will try to make a | 
| 715 | 
  | 
  | 
  reasonable guess from the list provided in {\em | 
| 716 | 
  | 
  | 
    tools/build\_options}.  The method used for making this guess is | 
| 717 | 
  | 
  | 
  to first determine the combination of operating system and hardware | 
| 718 | 
  | 
  | 
  (eg. "linux\_ia32") and then find a working FORTRAN compiler within | 
| 719 | 
  | 
  | 
  the user's path.  When these three items have been identified, | 
| 720 | 
  | 
  | 
  genmake2 will try to find an optfile that has a matching name. | 
| 721 | 
  | 
  | 
   | 
| 722 | 
  | 
  | 
\item[--pdepend=/PATH/FILENAME] specifies the dependency file used for | 
| 723 | 
  | 
  | 
  packages. | 
| 724 | 
  | 
  | 
   | 
| 725 | 
  | 
  | 
  If not specified, the default dependency file {\em pkg/pkg\_depend} | 
| 726 | 
  | 
  | 
  is used.  The syntax for this file is parsed on a line-by-line basis | 
| 727 | 
  | 
  | 
  where each line containes either a comment ("\#") or a simple | 
| 728 | 
  | 
  | 
  "PKGNAME1 (+|-)PKGNAME2" pairwise rule where the "+" or "-" symbol | 
| 729 | 
  | 
  | 
  specifies a "must be used with" or a "must not be used with" | 
| 730 | 
  | 
  | 
  relationship, respectively.  If no rule is specified, then it is | 
| 731 | 
  | 
  | 
  assumed that the two packages are compatible and will function | 
| 732 | 
  | 
  | 
  either with or without each other. | 
| 733 | 
  | 
  | 
   | 
| 734 | 
  | 
  | 
\item[--pdefault='PKG1 PKG2 PKG3 ...'] specifies the default set of | 
| 735 | 
  | 
  | 
  packages to be used. | 
| 736 | 
  | 
  | 
   | 
| 737 | 
  | 
  | 
  If not set, the default package list will be read from {\em | 
| 738 | 
  | 
  | 
    pkg/pkg\_default} | 
| 739 | 
  | 
  | 
   | 
| 740 | 
  | 
  | 
\item[--adof=/path/to/file] specifies the "adjoint" or automatic | 
| 741 | 
  | 
  | 
  differentiation options file to be used.  The file is analogous to | 
| 742 | 
  | 
  | 
  the ``optfile'' defined above but it specifies information for the | 
| 743 | 
  | 
  | 
  AD build process. | 
| 744 | 
  | 
  | 
   | 
| 745 | 
  | 
  | 
  The default file is located in {\em | 
| 746 | 
  | 
  | 
    tools/adjoint\_options/adjoint\_default} and it defines the "TAF" | 
| 747 | 
  | 
  | 
  and "TAMC" compilers.  An alternate version is also available at | 
| 748 | 
  | 
  | 
  {\em tools/adjoint\_options/adjoint\_staf} that selects the newer | 
| 749 | 
  | 
  | 
  "STAF" compiler.  As with any compilers, it is helpful to have their | 
| 750 | 
  | 
  | 
  directories listed in your {\tt \$PATH} environment variable. | 
| 751 | 
  | 
  | 
   | 
| 752 | 
  | 
  | 
\item[--mods='DIR1 DIR2 DIR3 ...'] specifies a list of directories | 
| 753 | 
  | 
  | 
  containing ``modifications''.  These directories contain files with | 
| 754 | 
  | 
  | 
  names that may (or may not) exist in the main MITgcm source tree but | 
| 755 | 
  | 
  | 
  will be overridden by any identically-named sources within the | 
| 756 | 
  | 
  | 
  ``MODS'' directories. | 
| 757 | 
  | 
  | 
   | 
| 758 | 
  | 
  | 
  The order of precedence for this "name-hiding" is as follows: | 
| 759 | 
  | 
  | 
  \begin{itemize} | 
| 760 | 
  | 
  | 
  \item ``MODS'' directories (in the order given) | 
| 761 | 
  | 
  | 
  \item Packages either explicitly specified or provided by default | 
| 762 | 
  | 
  | 
    (in the order given) | 
| 763 | 
  | 
  | 
  \item Packages included due to package dependencies (in the order | 
| 764 | 
  | 
  | 
    that that package dependencies are parsed) | 
| 765 | 
  | 
  | 
  \item The "standard dirs" (which may have been specified by the | 
| 766 | 
  | 
  | 
    ``-standarddirs'' option) | 
| 767 | 
  | 
  | 
  \end{itemize} | 
| 768 | 
  | 
  | 
   | 
| 769 | 
  | 
  | 
\item[--make=/path/to/gmake] Due to the poor handling of soft-links and | 
| 770 | 
  | 
  | 
  other bugs common with the \texttt{make} versions provided by | 
| 771 | 
  | 
  | 
  commercial Unix vendors, GNU \texttt{make} (sometimes called | 
| 772 | 
  | 
  | 
  \texttt{gmake}) should be preferred.  This option provides a means | 
| 773 | 
  | 
  | 
  for specifying the make executable to be used. | 
| 774 | 
adcroft | 
1.1 | 
 | 
| 775 | 
edhill | 
1.16 | 
\end{description} | 
| 776 | 
adcroft | 
1.1 | 
 | 
| 777 | 
  | 
  | 
 | 
| 778 | 
  | 
  | 
 | 
| 779 | 
adcroft | 
1.4 | 
\section{Running the model} | 
| 780 | 
  | 
  | 
\label{sect:runModel} | 
| 781 | 
  | 
  | 
 | 
| 782 | 
  | 
  | 
If compilation finished succesfuully (section \ref{sect:buildModel}) | 
| 783 | 
  | 
  | 
then an executable called {\em mitgcmuv} will now exist in the local | 
| 784 | 
  | 
  | 
directory. | 
| 785 | 
adcroft | 
1.1 | 
 | 
| 786 | 
adcroft | 
1.4 | 
To run the model as a single process (ie. not in parallel) simply | 
| 787 | 
  | 
  | 
type: | 
| 788 | 
adcroft | 
1.1 | 
\begin{verbatim} | 
| 789 | 
adcroft | 
1.4 | 
% ./mitgcmuv | 
| 790 | 
adcroft | 
1.1 | 
\end{verbatim} | 
| 791 | 
adcroft | 
1.4 | 
The ``./'' is a safe-guard to make sure you use the local executable | 
| 792 | 
  | 
  | 
in case you have others that exist in your path (surely odd if you | 
| 793 | 
  | 
  | 
do!). The above command will spew out many lines of text output to | 
| 794 | 
  | 
  | 
your screen.  This output contains details such as parameter values as | 
| 795 | 
  | 
  | 
well as diagnostics such as mean Kinetic energy, largest CFL number, | 
| 796 | 
  | 
  | 
etc. It is worth keeping this text output with the binary output so we | 
| 797 | 
  | 
  | 
normally re-direct the {\em stdout} stream as follows: | 
| 798 | 
adcroft | 
1.1 | 
\begin{verbatim} | 
| 799 | 
adcroft | 
1.4 | 
% ./mitgcmuv > output.txt | 
| 800 | 
adcroft | 
1.1 | 
\end{verbatim} | 
| 801 | 
  | 
  | 
 | 
| 802 | 
adcroft | 
1.4 | 
For the example experiments in {\em vericication}, an example of the | 
| 803 | 
  | 
  | 
output is kept in {\em results/output.txt} for comparison. You can compare | 
| 804 | 
  | 
  | 
your {\em output.txt} with this one to check that the set-up works. | 
| 805 | 
adcroft | 
1.1 | 
 | 
| 806 | 
  | 
  | 
 | 
| 807 | 
  | 
  | 
 | 
| 808 | 
adcroft | 
1.4 | 
\subsection{Output files} | 
| 809 | 
adcroft | 
1.1 | 
 | 
| 810 | 
  | 
  | 
The model produces various output files. At a minimum, the instantaneous | 
| 811 | 
  | 
  | 
``state'' of the model is written out, which is made of the following files: | 
| 812 | 
  | 
  | 
 | 
| 813 | 
  | 
  | 
\begin{itemize} | 
| 814 | 
  | 
  | 
\item \textit{U.00000nIter} - zonal component of velocity field (m/s and $> | 
| 815 | 
  | 
  | 
0 $ eastward). | 
| 816 | 
  | 
  | 
 | 
| 817 | 
  | 
  | 
\item \textit{V.00000nIter} - meridional component of velocity field (m/s | 
| 818 | 
  | 
  | 
and $> 0$ northward). | 
| 819 | 
  | 
  | 
 | 
| 820 | 
  | 
  | 
\item \textit{W.00000nIter} - vertical component of velocity field (ocean: | 
| 821 | 
  | 
  | 
m/s and $> 0$ upward, atmosphere: Pa/s and $> 0$ towards increasing pressure | 
| 822 | 
  | 
  | 
i.e. downward). | 
| 823 | 
  | 
  | 
 | 
| 824 | 
  | 
  | 
\item \textit{T.00000nIter} - potential temperature (ocean: $^{0}$C, | 
| 825 | 
  | 
  | 
atmosphere: $^{0}$K). | 
| 826 | 
  | 
  | 
 | 
| 827 | 
  | 
  | 
\item \textit{S.00000nIter} - ocean: salinity (psu), atmosphere: water vapor | 
| 828 | 
  | 
  | 
(g/kg). | 
| 829 | 
  | 
  | 
 | 
| 830 | 
  | 
  | 
\item \textit{Eta.00000nIter} - ocean: surface elevation (m), atmosphere: | 
| 831 | 
  | 
  | 
surface pressure anomaly (Pa). | 
| 832 | 
  | 
  | 
\end{itemize} | 
| 833 | 
  | 
  | 
 | 
| 834 | 
  | 
  | 
The chain \textit{00000nIter} consists of ten figures that specify the | 
| 835 | 
  | 
  | 
iteration number at which the output is written out. For example, \textit{% | 
| 836 | 
  | 
  | 
U.0000000300} is the zonal velocity at iteration 300. | 
| 837 | 
  | 
  | 
 | 
| 838 | 
  | 
  | 
In addition, a ``pickup'' or ``checkpoint'' file called: | 
| 839 | 
  | 
  | 
 | 
| 840 | 
  | 
  | 
\begin{itemize} | 
| 841 | 
  | 
  | 
\item \textit{pickup.00000nIter} | 
| 842 | 
  | 
  | 
\end{itemize} | 
| 843 | 
  | 
  | 
 | 
| 844 | 
  | 
  | 
is written out. This file represents the state of the model in a condensed | 
| 845 | 
  | 
  | 
form and is used for restarting the integration. If the C-D scheme is used, | 
| 846 | 
  | 
  | 
there is an additional ``pickup'' file: | 
| 847 | 
  | 
  | 
 | 
| 848 | 
  | 
  | 
\begin{itemize} | 
| 849 | 
  | 
  | 
\item \textit{pickup\_cd.00000nIter} | 
| 850 | 
  | 
  | 
\end{itemize} | 
| 851 | 
  | 
  | 
 | 
| 852 | 
  | 
  | 
containing the D-grid velocity data and that has to be written out as well | 
| 853 | 
  | 
  | 
in order to restart the integration. Rolling checkpoint files are the same | 
| 854 | 
  | 
  | 
as the pickup files but are named differently. Their name contain the chain  | 
| 855 | 
  | 
  | 
\textit{ckptA} or \textit{ckptB} instead of \textit{00000nIter}. They can be | 
| 856 | 
  | 
  | 
used to restart the model but are overwritten every other time they are | 
| 857 | 
  | 
  | 
output to save disk space during long integrations. | 
| 858 | 
  | 
  | 
 | 
| 859 | 
adcroft | 
1.4 | 
\subsection{Looking at the output} | 
| 860 | 
adcroft | 
1.1 | 
 | 
| 861 | 
  | 
  | 
All the model data are written according to a ``meta/data'' file format. | 
| 862 | 
  | 
  | 
Each variable is associated with two files with suffix names \textit{.data} | 
| 863 | 
  | 
  | 
and \textit{.meta}. The \textit{.data} file contains the data written in | 
| 864 | 
  | 
  | 
binary form (big\_endian by default). The \textit{.meta} file is a | 
| 865 | 
  | 
  | 
``header'' file that contains information about the size and the structure | 
| 866 | 
  | 
  | 
of the \textit{.data} file. This way of organizing the output is | 
| 867 | 
  | 
  | 
particularly useful when running multi-processors calculations. The base | 
| 868 | 
  | 
  | 
version of the model includes a few matlab utilities to read output files | 
| 869 | 
  | 
  | 
written in this format. The matlab scripts are located in the directory  | 
| 870 | 
  | 
  | 
\textit{utils/matlab} under the root tree. The script \textit{rdmds.m} reads | 
| 871 | 
  | 
  | 
the data. Look at the comments inside the script to see how to use it. | 
| 872 | 
  | 
  | 
 | 
| 873 | 
adcroft | 
1.4 | 
Some examples of reading and visualizing some output in {\em Matlab}: | 
| 874 | 
  | 
  | 
\begin{verbatim} | 
| 875 | 
  | 
  | 
% matlab | 
| 876 | 
  | 
  | 
>> H=rdmds('Depth'); | 
| 877 | 
  | 
  | 
>> contourf(H');colorbar; | 
| 878 | 
  | 
  | 
>> title('Depth of fluid as used by model'); | 
| 879 | 
  | 
  | 
 | 
| 880 | 
  | 
  | 
>> eta=rdmds('Eta',10); | 
| 881 | 
  | 
  | 
>> imagesc(eta');axis ij;colorbar; | 
| 882 | 
  | 
  | 
>> title('Surface height at iter=10'); | 
| 883 | 
  | 
  | 
 | 
| 884 | 
  | 
  | 
>> eta=rdmds('Eta',[0:10:100]); | 
| 885 | 
  | 
  | 
>> for n=1:11; imagesc(eta(:,:,n)');axis ij;colorbar;pause(.5);end | 
| 886 | 
  | 
  | 
\end{verbatim} | 
| 887 | 
adcroft | 
1.1 | 
 | 
| 888 | 
  | 
  | 
\section{Doing it yourself: customizing the code} | 
| 889 | 
  | 
  | 
 | 
| 890 | 
  | 
  | 
When you are ready to run the model in the configuration you want, the | 
| 891 | 
  | 
  | 
easiest thing is to use and adapt the setup of the case studies experiment | 
| 892 | 
  | 
  | 
(described previously) that is the closest to your configuration. Then, the | 
| 893 | 
  | 
  | 
amount of setup will be minimized. In this section, we focus on the setup | 
| 894 | 
  | 
  | 
relative to the ''numerical model'' part of the code (the setup relative to | 
| 895 | 
  | 
  | 
the ''execution environment'' part is covered in the parallel implementation | 
| 896 | 
  | 
  | 
section) and on the variables and parameters that you are likely to change. | 
| 897 | 
  | 
  | 
 | 
| 898 | 
adcroft | 
1.5 | 
\subsection{Configuration and setup} | 
| 899 | 
adcroft | 
1.4 | 
 | 
| 900 | 
adcroft | 
1.1 | 
The CPP keys relative to the ''numerical model'' part of the code are all | 
| 901 | 
  | 
  | 
defined and set in the file \textit{CPP\_OPTIONS.h }in the directory \textit{% | 
| 902 | 
  | 
  | 
model/inc }or in one of the \textit{code }directories of the case study | 
| 903 | 
  | 
  | 
experiments under \textit{verification.} The model parameters are defined | 
| 904 | 
  | 
  | 
and declared in the file \textit{model/inc/PARAMS.h }and their default | 
| 905 | 
  | 
  | 
values are set in the routine \textit{model/src/set\_defaults.F. }The | 
| 906 | 
  | 
  | 
default values can be modified in the namelist file \textit{data }which | 
| 907 | 
  | 
  | 
needs to be located in the directory where you will run the model. The | 
| 908 | 
  | 
  | 
parameters are initialized in the routine \textit{model/src/ini\_parms.F}. | 
| 909 | 
  | 
  | 
Look at this routine to see in what part of the namelist the parameters are | 
| 910 | 
  | 
  | 
located. | 
| 911 | 
  | 
  | 
 | 
| 912 | 
  | 
  | 
In what follows the parameters are grouped into categories related to the | 
| 913 | 
  | 
  | 
computational domain, the equations solved in the model, and the simulation | 
| 914 | 
  | 
  | 
controls. | 
| 915 | 
  | 
  | 
 | 
| 916 | 
adcroft | 
1.4 | 
\subsection{Computational domain, geometry and time-discretization} | 
| 917 | 
adcroft | 
1.1 | 
 | 
| 918 | 
  | 
  | 
\begin{itemize} | 
| 919 | 
  | 
  | 
\item dimensions | 
| 920 | 
  | 
  | 
\end{itemize} | 
| 921 | 
  | 
  | 
 | 
| 922 | 
  | 
  | 
The number of points in the x, y,\textit{\ }and r\textit{\ }directions are | 
| 923 | 
  | 
  | 
represented by the variables \textbf{sNx}\textit{, }\textbf{sNy}\textit{, }% | 
| 924 | 
  | 
  | 
and \textbf{Nr}\textit{\ }respectively which are declared and set in the | 
| 925 | 
  | 
  | 
file \textit{model/inc/SIZE.h. }(Again, this assumes a mono-processor | 
| 926 | 
  | 
  | 
calculation. For multiprocessor calculations see section on parallel | 
| 927 | 
  | 
  | 
implementation.) | 
| 928 | 
  | 
  | 
 | 
| 929 | 
  | 
  | 
\begin{itemize} | 
| 930 | 
  | 
  | 
\item grid | 
| 931 | 
  | 
  | 
\end{itemize} | 
| 932 | 
  | 
  | 
 | 
| 933 | 
  | 
  | 
Three different grids are available: cartesian, spherical polar, and | 
| 934 | 
  | 
  | 
curvilinear (including the cubed sphere). The grid is set through the | 
| 935 | 
  | 
  | 
logical variables \textbf{usingCartesianGrid}\textit{, }\textbf{% | 
| 936 | 
  | 
  | 
usingSphericalPolarGrid}\textit{, }and \textit{\ }\textbf{% | 
| 937 | 
  | 
  | 
usingCurvilinearGrid}\textit{. }In the case of spherical and curvilinear | 
| 938 | 
  | 
  | 
grids, the southern boundary is defined through the variable \textbf{phiMin}% | 
| 939 | 
  | 
  | 
\textit{\ }which corresponds to the latitude of the southern most cell face | 
| 940 | 
  | 
  | 
(in degrees). The resolution along the x and y directions is controlled by | 
| 941 | 
  | 
  | 
the 1D arrays \textbf{delx}\textit{\ }and \textbf{dely}\textit{\ }(in meters | 
| 942 | 
  | 
  | 
in the case of a cartesian grid, in degrees otherwise). The vertical grid | 
| 943 | 
  | 
  | 
spacing is set through the 1D array \textbf{delz }for the ocean (in meters) | 
| 944 | 
  | 
  | 
or \textbf{delp}\textit{\ }for the atmosphere (in Pa). The variable \textbf{% | 
| 945 | 
  | 
  | 
Ro\_SeaLevel} represents the standard position of Sea-Level in ''R'' | 
| 946 | 
  | 
  | 
coordinate. This is typically set to 0m for the ocean (default value) and 10$% | 
| 947 | 
  | 
  | 
^{5}$Pa for the atmosphere. For the atmosphere, also set the logical | 
| 948 | 
  | 
  | 
variable \textbf{groundAtK1} to '.\texttt{TRUE}.'. which put the first level | 
| 949 | 
  | 
  | 
(k=1) at the lower boundary (ground). | 
| 950 | 
  | 
  | 
 | 
| 951 | 
  | 
  | 
For the cartesian grid case, the Coriolis parameter $f$ is set through the | 
| 952 | 
  | 
  | 
variables \textbf{f0}\textit{\ }and \textbf{beta}\textit{\ }which correspond | 
| 953 | 
  | 
  | 
to the reference Coriolis parameter (in s$^{-1}$) and $\frac{\partial f}{% | 
| 954 | 
  | 
  | 
\partial y}$(in m$^{-1}$s$^{-1}$) respectively. If \textbf{beta }\textit{\ }% | 
| 955 | 
  | 
  | 
is set to a nonzero value, \textbf{f0}\textit{\ }is the value of $f$ at the | 
| 956 | 
  | 
  | 
southern edge of the domain. | 
| 957 | 
  | 
  | 
 | 
| 958 | 
  | 
  | 
\begin{itemize} | 
| 959 | 
  | 
  | 
\item topography - full and partial cells | 
| 960 | 
  | 
  | 
\end{itemize} | 
| 961 | 
  | 
  | 
 | 
| 962 | 
  | 
  | 
The domain bathymetry is read from a file that contains a 2D (x,y) map of | 
| 963 | 
  | 
  | 
depths (in m) for the ocean or pressures (in Pa) for the atmosphere. The | 
| 964 | 
  | 
  | 
file name is represented by the variable \textbf{bathyFile}\textit{. }The | 
| 965 | 
  | 
  | 
file is assumed to contain binary numbers giving the depth (pressure) of the | 
| 966 | 
  | 
  | 
model at each grid cell, ordered with the x coordinate varying fastest. The | 
| 967 | 
  | 
  | 
points are ordered from low coordinate to high coordinate for both axes. The | 
| 968 | 
  | 
  | 
model code applies without modification to enclosed, periodic, and double | 
| 969 | 
  | 
  | 
periodic domains. Periodicity is assumed by default and is suppressed by | 
| 970 | 
  | 
  | 
setting the depths to 0m for the cells at the limits of the computational | 
| 971 | 
  | 
  | 
domain (note: not sure this is the case for the atmosphere). The precision | 
| 972 | 
  | 
  | 
with which to read the binary data is controlled by the integer variable  | 
| 973 | 
  | 
  | 
\textbf{readBinaryPrec }which can take the value \texttt{32} (single | 
| 974 | 
  | 
  | 
precision) or \texttt{64} (double precision). See the matlab program \textit{% | 
| 975 | 
  | 
  | 
gendata.m }in the \textit{input }directories under \textit{verification }to | 
| 976 | 
  | 
  | 
see how the bathymetry files are generated for the case study experiments. | 
| 977 | 
  | 
  | 
 | 
| 978 | 
  | 
  | 
To use the partial cell capability, the variable \textbf{hFacMin}\textit{\ }% | 
| 979 | 
  | 
  | 
needs to be set to a value between 0 and 1 (it is set to 1 by default) | 
| 980 | 
  | 
  | 
corresponding to the minimum fractional size of the cell. For example if the | 
| 981 | 
  | 
  | 
bottom cell is 500m thick and \textbf{hFacMin}\textit{\ }is set to 0.1, the | 
| 982 | 
  | 
  | 
actual thickness of the cell (i.e. used in the code) can cover a range of | 
| 983 | 
  | 
  | 
discrete values 50m apart from 50m to 500m depending on the value of the | 
| 984 | 
  | 
  | 
bottom depth (in \textbf{bathyFile}) at this point. | 
| 985 | 
  | 
  | 
 | 
| 986 | 
  | 
  | 
Note that the bottom depths (or pressures) need not coincide with the models | 
| 987 | 
  | 
  | 
levels as deduced from \textbf{delz}\textit{\ }or\textit{\ }\textbf{delp}% | 
| 988 | 
  | 
  | 
\textit{. }The model will interpolate the numbers in \textbf{bathyFile}% | 
| 989 | 
  | 
  | 
\textit{\ }so that they match the levels obtained from \textbf{delz}\textit{% | 
| 990 | 
  | 
  | 
\ }or\textit{\ }\textbf{delp}\textit{\ }and \textbf{hFacMin}\textit{. } | 
| 991 | 
  | 
  | 
 | 
| 992 | 
  | 
  | 
(Note: the atmospheric case is a bit more complicated than what is written | 
| 993 | 
  | 
  | 
here I think. To come soon...) | 
| 994 | 
  | 
  | 
 | 
| 995 | 
  | 
  | 
\begin{itemize} | 
| 996 | 
  | 
  | 
\item time-discretization | 
| 997 | 
  | 
  | 
\end{itemize} | 
| 998 | 
  | 
  | 
 | 
| 999 | 
mlosch | 
1.13 | 
The time steps are set through the real variables \textbf{deltaTMom} | 
| 1000 | 
  | 
  | 
and \textbf{deltaTtracer} (in s) which represent the time step for the | 
| 1001 | 
  | 
  | 
momentum and tracer equations, respectively. For synchronous | 
| 1002 | 
  | 
  | 
integrations, simply set the two variables to the same value (or you | 
| 1003 | 
  | 
  | 
can prescribe one time step only through the variable | 
| 1004 | 
  | 
  | 
\textbf{deltaT}). The Adams-Bashforth stabilizing parameter is set | 
| 1005 | 
  | 
  | 
through the variable \textbf{abEps} (dimensionless). The stagger | 
| 1006 | 
  | 
  | 
baroclinic time stepping can be activated by setting the logical | 
| 1007 | 
  | 
  | 
variable \textbf{staggerTimeStep} to '.\texttt{TRUE}.'. | 
| 1008 | 
adcroft | 
1.1 | 
 | 
| 1009 | 
adcroft | 
1.4 | 
\subsection{Equation of state} | 
| 1010 | 
adcroft | 
1.1 | 
 | 
| 1011 | 
mlosch | 
1.13 | 
First, because the model equations are written in terms of | 
| 1012 | 
  | 
  | 
perturbations, a reference thermodynamic state needs to be specified. | 
| 1013 | 
  | 
  | 
This is done through the 1D arrays \textbf{tRef} and \textbf{sRef}. | 
| 1014 | 
  | 
  | 
\textbf{tRef} specifies the reference potential temperature profile | 
| 1015 | 
  | 
  | 
(in $^{o}$C for the ocean and $^{o}$K for the atmosphere) starting | 
| 1016 | 
  | 
  | 
from the level k=1. Similarly, \textbf{sRef} specifies the reference | 
| 1017 | 
  | 
  | 
salinity profile (in ppt) for the ocean or the reference specific | 
| 1018 | 
  | 
  | 
humidity profile (in g/kg) for the atmosphere. | 
| 1019 | 
  | 
  | 
 | 
| 1020 | 
  | 
  | 
The form of the equation of state is controlled by the character | 
| 1021 | 
  | 
  | 
variables \textbf{buoyancyRelation} and \textbf{eosType}. | 
| 1022 | 
  | 
  | 
\textbf{buoyancyRelation} is set to '\texttt{OCEANIC}' by default and | 
| 1023 | 
  | 
  | 
needs to be set to '\texttt{ATMOSPHERIC}' for atmosphere simulations. | 
| 1024 | 
  | 
  | 
In this case, \textbf{eosType} must be set to '\texttt{IDEALGAS}'. | 
| 1025 | 
  | 
  | 
For the ocean, two forms of the equation of state are available: | 
| 1026 | 
  | 
  | 
linear (set \textbf{eosType} to '\texttt{LINEAR}') and a polynomial | 
| 1027 | 
  | 
  | 
approximation to the full nonlinear equation ( set | 
| 1028 | 
  | 
  | 
\textbf{eosType}\textit{\ }to '\texttt{POLYNOMIAL}'). In the linear | 
| 1029 | 
  | 
  | 
case, you need to specify the thermal and haline expansion | 
| 1030 | 
  | 
  | 
coefficients represented by the variables \textbf{tAlpha}\textit{\  | 
| 1031 | 
  | 
  | 
  }(in K$^{-1}$) and \textbf{sBeta} (in ppt$^{-1}$). For the nonlinear | 
| 1032 | 
  | 
  | 
case, you need to generate a file of polynomial coefficients called | 
| 1033 | 
  | 
  | 
\textit{POLY3.COEFFS}. To do this, use the program | 
| 1034 | 
  | 
  | 
\textit{utils/knudsen2/knudsen2.f} under the model tree (a Makefile is | 
| 1035 | 
  | 
  | 
available in the same directory and you will need to edit the number | 
| 1036 | 
  | 
  | 
and the values of the vertical levels in \textit{knudsen2.f} so that | 
| 1037 | 
  | 
  | 
they match those of your configuration). | 
| 1038 | 
  | 
  | 
 | 
| 1039 | 
  | 
  | 
There there are also higher polynomials for the equation of state: | 
| 1040 | 
  | 
  | 
\begin{description} | 
| 1041 | 
  | 
  | 
\item['\texttt{UNESCO}':] The UNESCO equation of state formula of | 
| 1042 | 
  | 
  | 
  Fofonoff and Millard \cite{fofonoff83}. This equation of state | 
| 1043 | 
  | 
  | 
  assumes in-situ temperature, which is not a model variable; \emph{its use | 
| 1044 | 
  | 
  | 
  is therefore discouraged, and it is only listed for completeness}. | 
| 1045 | 
  | 
  | 
\item['\texttt{JMD95Z}':] A modified UNESCO formula by Jackett and | 
| 1046 | 
  | 
  | 
  McDougall \cite{jackett95}, which uses the model variable potential | 
| 1047 | 
  | 
  | 
  temperature as input. The '\texttt{Z}' indicates that this equation | 
| 1048 | 
  | 
  | 
  of state uses a horizontally and temporally constant pressure | 
| 1049 | 
  | 
  | 
  $p_{0}=-g\rho_{0}z$.  | 
| 1050 | 
  | 
  | 
\item['\texttt{JMD95P}':] A modified UNESCO formula by Jackett and | 
| 1051 | 
  | 
  | 
  McDougall \cite{jackett95}, which uses the model variable potential | 
| 1052 | 
  | 
  | 
  temperature as input. The '\texttt{P}' indicates that this equation | 
| 1053 | 
  | 
  | 
  of state uses the actual hydrostatic pressure of the last time | 
| 1054 | 
  | 
  | 
  step. Lagging the pressure in this way requires an additional pickup | 
| 1055 | 
  | 
  | 
  file for restarts. | 
| 1056 | 
  | 
  | 
\item['\texttt{MDJWF}':] The new, more accurate and less expensive | 
| 1057 | 
  | 
  | 
  equation of state by McDougall et~al. \cite{mcdougall03}. It also | 
| 1058 | 
  | 
  | 
  requires lagging the pressure and therefore an additional pickup | 
| 1059 | 
  | 
  | 
  file for restarts. | 
| 1060 | 
  | 
  | 
\end{description} | 
| 1061 | 
  | 
  | 
For none of these options an reference profile of temperature or | 
| 1062 | 
  | 
  | 
salinity is required. | 
| 1063 | 
adcroft | 
1.1 | 
 | 
| 1064 | 
adcroft | 
1.4 | 
\subsection{Momentum equations} | 
| 1065 | 
adcroft | 
1.1 | 
 | 
| 1066 | 
  | 
  | 
In this section, we only focus for now on the parameters that you are likely | 
| 1067 | 
  | 
  | 
to change, i.e. the ones relative to forcing and dissipation for example. | 
| 1068 | 
  | 
  | 
The details relevant to the vector-invariant form of the equations and the | 
| 1069 | 
  | 
  | 
various advection schemes are not covered for the moment. We assume that you | 
| 1070 | 
  | 
  | 
use the standard form of the momentum equations (i.e. the flux-form) with | 
| 1071 | 
  | 
  | 
the default advection scheme. Also, there are a few logical variables that | 
| 1072 | 
  | 
  | 
allow you to turn on/off various terms in the momentum equation. These | 
| 1073 | 
  | 
  | 
variables are called \textbf{momViscosity, momAdvection, momForcing, | 
| 1074 | 
  | 
  | 
useCoriolis, momPressureForcing, momStepping}\textit{, }and \textit{\ }% | 
| 1075 | 
  | 
  | 
\textbf{metricTerms }and are assumed to be set to '.\texttt{TRUE}.' here. | 
| 1076 | 
  | 
  | 
Look at the file \textit{model/inc/PARAMS.h }for a precise definition of | 
| 1077 | 
  | 
  | 
these variables. | 
| 1078 | 
  | 
  | 
 | 
| 1079 | 
  | 
  | 
\begin{itemize} | 
| 1080 | 
  | 
  | 
\item initialization | 
| 1081 | 
  | 
  | 
\end{itemize} | 
| 1082 | 
  | 
  | 
 | 
| 1083 | 
  | 
  | 
The velocity components are initialized to 0 unless the simulation is | 
| 1084 | 
  | 
  | 
starting from a pickup file (see section on simulation control parameters). | 
| 1085 | 
  | 
  | 
 | 
| 1086 | 
  | 
  | 
\begin{itemize} | 
| 1087 | 
  | 
  | 
\item forcing | 
| 1088 | 
  | 
  | 
\end{itemize} | 
| 1089 | 
  | 
  | 
 | 
| 1090 | 
  | 
  | 
This section only applies to the ocean. You need to generate wind-stress | 
| 1091 | 
  | 
  | 
data into two files \textbf{zonalWindFile}\textit{\ }and \textbf{% | 
| 1092 | 
  | 
  | 
meridWindFile }corresponding to the zonal and meridional components of the | 
| 1093 | 
  | 
  | 
wind stress, respectively (if you want the stress to be along the direction | 
| 1094 | 
  | 
  | 
of only one of the model horizontal axes, you only need to generate one | 
| 1095 | 
  | 
  | 
file). The format of the files is similar to the bathymetry file. The zonal | 
| 1096 | 
  | 
  | 
(meridional) stress data are assumed to be in Pa and located at U-points | 
| 1097 | 
  | 
  | 
(V-points). As for the bathymetry, the precision with which to read the | 
| 1098 | 
  | 
  | 
binary data is controlled by the variable \textbf{readBinaryPrec}.\textbf{\ } | 
| 1099 | 
  | 
  | 
See the matlab program \textit{gendata.m }in the \textit{input }directories | 
| 1100 | 
  | 
  | 
under \textit{verification }to see how simple analytical wind forcing data | 
| 1101 | 
  | 
  | 
are generated for the case study experiments.  | 
| 1102 | 
  | 
  | 
 | 
| 1103 | 
  | 
  | 
There is also the possibility of prescribing time-dependent periodic | 
| 1104 | 
  | 
  | 
forcing. To do this, concatenate the successive time records into a single | 
| 1105 | 
  | 
  | 
file (for each stress component) ordered in a (x, y, t) fashion and set the | 
| 1106 | 
  | 
  | 
following variables: \textbf{periodicExternalForcing }to '.\texttt{TRUE}.',  | 
| 1107 | 
  | 
  | 
\textbf{externForcingPeriod }to the period (in s) of which the forcing | 
| 1108 | 
  | 
  | 
varies (typically 1 month), and \textbf{externForcingCycle }to the repeat | 
| 1109 | 
  | 
  | 
time (in s) of the forcing (typically 1 year -- note: \textbf{% | 
| 1110 | 
  | 
  | 
externForcingCycle }must be a multiple of \textbf{externForcingPeriod}). | 
| 1111 | 
  | 
  | 
With these variables set up, the model will interpolate the forcing linearly | 
| 1112 | 
  | 
  | 
at each iteration. | 
| 1113 | 
  | 
  | 
 | 
| 1114 | 
  | 
  | 
\begin{itemize} | 
| 1115 | 
  | 
  | 
\item dissipation | 
| 1116 | 
  | 
  | 
\end{itemize} | 
| 1117 | 
  | 
  | 
 | 
| 1118 | 
  | 
  | 
The lateral eddy viscosity coefficient is specified through the variable  | 
| 1119 | 
  | 
  | 
\textbf{viscAh}\textit{\ }(in m$^{2}$s$^{-1}$). The vertical eddy viscosity | 
| 1120 | 
  | 
  | 
coefficient is specified through the variable \textbf{viscAz }(in m$^{2}$s$% | 
| 1121 | 
  | 
  | 
^{-1}$) for the ocean and \textbf{viscAp}\textit{\ }(in Pa$^{2}$s$^{-1}$) | 
| 1122 | 
  | 
  | 
for the atmosphere. The vertical diffusive fluxes can be computed implicitly | 
| 1123 | 
  | 
  | 
by setting the logical variable \textbf{implicitViscosity }to '.\texttt{TRUE}% | 
| 1124 | 
  | 
  | 
.'. In addition, biharmonic mixing can be added as well through the variable  | 
| 1125 | 
  | 
  | 
\textbf{viscA4}\textit{\ }(in m$^{4}$s$^{-1}$). On a spherical polar grid, | 
| 1126 | 
  | 
  | 
you might also need to set the variable \textbf{cosPower} which is set to 0 | 
| 1127 | 
  | 
  | 
by default and which represents the power of cosine of latitude to multiply | 
| 1128 | 
  | 
  | 
viscosity. Slip or no-slip conditions at lateral and bottom boundaries are | 
| 1129 | 
  | 
  | 
specified through the logical variables \textbf{no\_slip\_sides}\textit{\ }% | 
| 1130 | 
  | 
  | 
and \textbf{no\_slip\_bottom}. If set to '\texttt{.FALSE.}', free-slip | 
| 1131 | 
  | 
  | 
boundary conditions are applied. If no-slip boundary conditions are applied | 
| 1132 | 
  | 
  | 
at the bottom, a bottom drag can be applied as well. Two forms are | 
| 1133 | 
  | 
  | 
available: linear (set the variable \textbf{bottomDragLinear}\textit{\ }in s$% | 
| 1134 | 
  | 
  | 
^{-1}$) and quadratic (set the variable \textbf{bottomDragQuadratic}\textit{% | 
| 1135 | 
  | 
  | 
\ }in m$^{-1}$). | 
| 1136 | 
  | 
  | 
 | 
| 1137 | 
  | 
  | 
The Fourier and Shapiro filters are described elsewhere. | 
| 1138 | 
  | 
  | 
 | 
| 1139 | 
  | 
  | 
\begin{itemize} | 
| 1140 | 
  | 
  | 
\item C-D scheme | 
| 1141 | 
  | 
  | 
\end{itemize} | 
| 1142 | 
  | 
  | 
 | 
| 1143 | 
  | 
  | 
If you run at a sufficiently coarse resolution, you will need the C-D scheme | 
| 1144 | 
  | 
  | 
for the computation of the Coriolis terms. The variable\textbf{\ tauCD}, | 
| 1145 | 
  | 
  | 
which represents the C-D scheme coupling timescale (in s) needs to be set. | 
| 1146 | 
  | 
  | 
 | 
| 1147 | 
  | 
  | 
\begin{itemize}  | 
| 1148 | 
  | 
  | 
\item calculation of pressure/geopotential | 
| 1149 | 
  | 
  | 
\end{itemize}  | 
| 1150 | 
  | 
  | 
 | 
| 1151 | 
  | 
  | 
First, to run a non-hydrostatic ocean simulation, set the logical variable  | 
| 1152 | 
  | 
  | 
\textbf{nonHydrostatic} to '.\texttt{TRUE}.'. The pressure field is then | 
| 1153 | 
  | 
  | 
inverted through a 3D elliptic equation. (Note: this capability is not | 
| 1154 | 
  | 
  | 
available for the atmosphere yet.) By default, a hydrostatic simulation is | 
| 1155 | 
  | 
  | 
assumed and a 2D elliptic equation is used to invert the pressure field. The | 
| 1156 | 
  | 
  | 
parameters controlling the behaviour of the elliptic solvers are the | 
| 1157 | 
  | 
  | 
variables \textbf{cg2dMaxIters}\textit{\ }and \textbf{cg2dTargetResidual }% | 
| 1158 | 
  | 
  | 
for the 2D case and \textbf{cg3dMaxIters}\textit{\ }and \textbf{% | 
| 1159 | 
  | 
  | 
cg3dTargetResidual }for the 3D case. You probably won't need to alter the | 
| 1160 | 
  | 
  | 
default values (are we sure of this?). | 
| 1161 | 
  | 
  | 
 | 
| 1162 | 
  | 
  | 
For the calculation of the surface pressure (for the ocean) or surface | 
| 1163 | 
  | 
  | 
geopotential (for the atmosphere) you need to set the logical variables  | 
| 1164 | 
  | 
  | 
\textbf{rigidLid} and \textbf{implicitFreeSurface}\textit{\ }(set one to '.% | 
| 1165 | 
  | 
  | 
\texttt{TRUE}.' and the other to '.\texttt{FALSE}.' depending on how you | 
| 1166 | 
  | 
  | 
want to deal with the ocean upper or atmosphere lower boundary). | 
| 1167 | 
  | 
  | 
 | 
| 1168 | 
adcroft | 
1.4 | 
\subsection{Tracer equations} | 
| 1169 | 
adcroft | 
1.1 | 
 | 
| 1170 | 
  | 
  | 
This section covers the tracer equations i.e. the potential temperature | 
| 1171 | 
  | 
  | 
equation and the salinity (for the ocean) or specific humidity (for the | 
| 1172 | 
  | 
  | 
atmosphere) equation. As for the momentum equations, we only describe for | 
| 1173 | 
  | 
  | 
now the parameters that you are likely to change. The logical variables  | 
| 1174 | 
  | 
  | 
\textbf{tempDiffusion}\textit{, }\textbf{tempAdvection}\textit{, }\textbf{% | 
| 1175 | 
  | 
  | 
tempForcing}\textit{,} and \textbf{tempStepping} allow you to turn on/off | 
| 1176 | 
  | 
  | 
terms in the temperature equation (same thing for salinity or specific | 
| 1177 | 
  | 
  | 
humidity with variables \textbf{saltDiffusion}\textit{, }\textbf{% | 
| 1178 | 
  | 
  | 
saltAdvection}\textit{\ }etc). These variables are all assumed here to be | 
| 1179 | 
  | 
  | 
set to '.\texttt{TRUE}.'. Look at file \textit{model/inc/PARAMS.h }for a | 
| 1180 | 
  | 
  | 
precise definition. | 
| 1181 | 
  | 
  | 
 | 
| 1182 | 
  | 
  | 
\begin{itemize} | 
| 1183 | 
  | 
  | 
\item initialization | 
| 1184 | 
  | 
  | 
\end{itemize} | 
| 1185 | 
  | 
  | 
 | 
| 1186 | 
  | 
  | 
The initial tracer data can be contained in the binary files \textbf{% | 
| 1187 | 
  | 
  | 
hydrogThetaFile }and \textbf{hydrogSaltFile}. These files should contain 3D | 
| 1188 | 
  | 
  | 
data ordered in an (x, y, r) fashion with k=1 as the first vertical level. | 
| 1189 | 
  | 
  | 
If no file names are provided, the tracers are then initialized with the | 
| 1190 | 
  | 
  | 
values of \textbf{tRef }and \textbf{sRef }mentioned above (in the equation | 
| 1191 | 
  | 
  | 
of state section). In this case, the initial tracer data are uniform in x | 
| 1192 | 
  | 
  | 
and y for each depth level. | 
| 1193 | 
  | 
  | 
 | 
| 1194 | 
  | 
  | 
\begin{itemize}  | 
| 1195 | 
  | 
  | 
\item forcing | 
| 1196 | 
  | 
  | 
\end{itemize} | 
| 1197 | 
  | 
  | 
 | 
| 1198 | 
  | 
  | 
This part is more relevant for the ocean, the procedure for the atmosphere | 
| 1199 | 
  | 
  | 
not being completely stabilized at the moment. | 
| 1200 | 
  | 
  | 
 | 
| 1201 | 
  | 
  | 
A combination of fluxes data and relaxation terms can be used for driving | 
| 1202 | 
  | 
  | 
the tracer equations. \ For potential temperature, heat flux data (in W/m$% | 
| 1203 | 
  | 
  | 
^{2}$) can be stored in the 2D binary file \textbf{surfQfile}\textit{. }% | 
| 1204 | 
  | 
  | 
Alternatively or in addition, the forcing can be specified through a | 
| 1205 | 
  | 
  | 
relaxation term. The SST data to which the model surface temperatures are | 
| 1206 | 
  | 
  | 
restored to are supposed to be stored in the 2D binary file \textbf{% | 
| 1207 | 
  | 
  | 
thetaClimFile}\textit{. }The corresponding relaxation time scale coefficient | 
| 1208 | 
  | 
  | 
is set through the variable \textbf{tauThetaClimRelax}\textit{\ }(in s). The | 
| 1209 | 
  | 
  | 
same procedure applies for salinity with the variable names \textbf{EmPmRfile% | 
| 1210 | 
  | 
  | 
}\textit{, }\textbf{saltClimFile}\textit{, }and \textbf{tauSaltClimRelax}% | 
| 1211 | 
  | 
  | 
\textit{\ }for freshwater flux (in m/s) and surface salinity (in ppt) data | 
| 1212 | 
  | 
  | 
files and relaxation time scale coefficient (in s), respectively. Also for | 
| 1213 | 
  | 
  | 
salinity, if the CPP key \textbf{USE\_NATURAL\_BCS} is turned on, natural | 
| 1214 | 
  | 
  | 
boundary conditions are applied i.e. when computing the surface salinity | 
| 1215 | 
  | 
  | 
tendency, the freshwater flux is multiplied by the model surface salinity | 
| 1216 | 
  | 
  | 
instead of a constant salinity value. | 
| 1217 | 
  | 
  | 
 | 
| 1218 | 
  | 
  | 
As for the other input files, the precision with which to read the data is | 
| 1219 | 
  | 
  | 
controlled by the variable \textbf{readBinaryPrec}. Time-dependent, periodic | 
| 1220 | 
  | 
  | 
forcing can be applied as well following the same procedure used for the | 
| 1221 | 
  | 
  | 
wind forcing data (see above). | 
| 1222 | 
  | 
  | 
 | 
| 1223 | 
  | 
  | 
\begin{itemize} | 
| 1224 | 
  | 
  | 
\item dissipation | 
| 1225 | 
  | 
  | 
\end{itemize} | 
| 1226 | 
  | 
  | 
 | 
| 1227 | 
  | 
  | 
Lateral eddy diffusivities for temperature and salinity/specific humidity | 
| 1228 | 
  | 
  | 
are specified through the variables \textbf{diffKhT }and \textbf{diffKhS }% | 
| 1229 | 
  | 
  | 
(in m$^{2}$/s). Vertical eddy diffusivities are specified through the | 
| 1230 | 
  | 
  | 
variables \textbf{diffKzT }and \textbf{diffKzS }(in m$^{2}$/s) for the ocean | 
| 1231 | 
  | 
  | 
and \textbf{diffKpT }and \textbf{diffKpS }(in Pa$^{2}$/s) for the | 
| 1232 | 
  | 
  | 
atmosphere. The vertical diffusive fluxes can be computed implicitly by | 
| 1233 | 
  | 
  | 
setting the logical variable \textbf{implicitDiffusion }to '.\texttt{TRUE}% | 
| 1234 | 
  | 
  | 
.'. In addition, biharmonic diffusivities can be specified as well through | 
| 1235 | 
  | 
  | 
the coefficients \textbf{diffK4T }and \textbf{diffK4S }(in m$^{4}$/s). Note | 
| 1236 | 
  | 
  | 
that the cosine power scaling (specified through \textbf{cosPower }- see the | 
| 1237 | 
  | 
  | 
momentum equations section) is applied to the tracer diffusivities | 
| 1238 | 
  | 
  | 
(Laplacian and biharmonic) as well. The Gent and McWilliams parameterization | 
| 1239 | 
  | 
  | 
for oceanic tracers is described in the package section. Finally, note that | 
| 1240 | 
  | 
  | 
tracers can be also subject to Fourier and Shapiro filtering (see the | 
| 1241 | 
  | 
  | 
corresponding section on these filters). | 
| 1242 | 
  | 
  | 
 | 
| 1243 | 
  | 
  | 
\begin{itemize} | 
| 1244 | 
  | 
  | 
\item ocean convection | 
| 1245 | 
  | 
  | 
\end{itemize} | 
| 1246 | 
  | 
  | 
 | 
| 1247 | 
  | 
  | 
Two options are available to parameterize ocean convection: one is to use | 
| 1248 | 
  | 
  | 
the convective adjustment scheme. In this case, you need to set the variable  | 
| 1249 | 
  | 
  | 
\textbf{cadjFreq}, which represents the frequency (in s) with which the | 
| 1250 | 
  | 
  | 
adjustment algorithm is called, to a non-zero value (if set to a negative | 
| 1251 | 
  | 
  | 
value by the user, the model will set it to the tracer time step). The other | 
| 1252 | 
  | 
  | 
option is to parameterize convection with implicit vertical diffusion. To do | 
| 1253 | 
  | 
  | 
this, set the logical variable \textbf{implicitDiffusion }to '.\texttt{TRUE}% | 
| 1254 | 
  | 
  | 
.' and the real variable \textbf{ivdc\_kappa }to a value (in m$^{2}$/s) you | 
| 1255 | 
  | 
  | 
wish the tracer vertical diffusivities to have when mixing tracers | 
| 1256 | 
  | 
  | 
vertically due to static instabilities. Note that \textbf{cadjFreq }and  | 
| 1257 | 
  | 
  | 
\textbf{ivdc\_kappa }can not both have non-zero value. | 
| 1258 | 
  | 
  | 
 | 
| 1259 | 
adcroft | 
1.4 | 
\subsection{Simulation controls} | 
| 1260 | 
adcroft | 
1.1 | 
 | 
| 1261 | 
  | 
  | 
The model ''clock'' is defined by the variable \textbf{deltaTClock }(in s) | 
| 1262 | 
  | 
  | 
which determines the IO frequencies and is used in tagging output. | 
| 1263 | 
  | 
  | 
Typically, you will set it to the tracer time step for accelerated runs | 
| 1264 | 
  | 
  | 
(otherwise it is simply set to the default time step \textbf{deltaT}). | 
| 1265 | 
  | 
  | 
Frequency of checkpointing and dumping of the model state are referenced to | 
| 1266 | 
  | 
  | 
this clock (see below). | 
| 1267 | 
  | 
  | 
 | 
| 1268 | 
  | 
  | 
\begin{itemize} | 
| 1269 | 
  | 
  | 
\item run duration | 
| 1270 | 
  | 
  | 
\end{itemize} | 
| 1271 | 
  | 
  | 
 | 
| 1272 | 
  | 
  | 
The beginning of a simulation is set by specifying a start time (in s) | 
| 1273 | 
  | 
  | 
through the real variable \textbf{startTime }or by specifying an initial | 
| 1274 | 
  | 
  | 
iteration number through the integer variable \textbf{nIter0}. If these | 
| 1275 | 
  | 
  | 
variables are set to nonzero values, the model will look for a ''pickup'' | 
| 1276 | 
  | 
  | 
file \textit{pickup.0000nIter0 }to restart the integration\textit{. }The end | 
| 1277 | 
  | 
  | 
of a simulation is set through the real variable \textbf{endTime }(in s). | 
| 1278 | 
  | 
  | 
Alternatively, you can specify instead the number of time steps to execute | 
| 1279 | 
  | 
  | 
through the integer variable \textbf{nTimeSteps}.  | 
| 1280 | 
  | 
  | 
 | 
| 1281 | 
  | 
  | 
\begin{itemize} | 
| 1282 | 
  | 
  | 
\item frequency of output | 
| 1283 | 
  | 
  | 
\end{itemize} | 
| 1284 | 
  | 
  | 
 | 
| 1285 | 
  | 
  | 
Real variables defining frequencies (in s) with which output files are | 
| 1286 | 
  | 
  | 
written on disk need to be set up. \textbf{dumpFreq }controls the frequency | 
| 1287 | 
  | 
  | 
with which the instantaneous state of the model is saved. \textbf{chkPtFreq }% | 
| 1288 | 
  | 
  | 
and \textbf{pchkPtFreq }control the output frequency of rolling and | 
| 1289 | 
  | 
  | 
permanent checkpoint files, respectively. See section 1.5.1 Output files for the | 
| 1290 | 
  | 
  | 
definition of model state and checkpoint files. In addition, time-averaged | 
| 1291 | 
  | 
  | 
fields can be written out by setting the variable \textbf{taveFreq} (in s). | 
| 1292 | 
  | 
  | 
The precision with which to write the binary data is controlled by the | 
| 1293 | 
  | 
  | 
integer variable w\textbf{riteBinaryPrec }(set it to \texttt{32} or \texttt{% | 
| 1294 | 
  | 
  | 
64}). | 
| 1295 | 
mlosch | 
1.13 | 
 | 
| 1296 | 
  | 
  | 
%%% Local Variables:  | 
| 1297 | 
  | 
  | 
%%% mode: latex | 
| 1298 | 
  | 
  | 
%%% TeX-master: t | 
| 1299 | 
  | 
  | 
%%% End:  |