1 |
% $Header: /u/gcmpack/mitgcmdoc/part3/getting_started.tex,v 1.1.1.1 2001/08/08 16:15:31 adcroft Exp $ |
2 |
% $Name: $ |
3 |
|
4 |
\section{Getting started} |
5 |
|
6 |
In this part, we describe how to use the model. In the first section, we |
7 |
provide enough information to help you get started with the model. We |
8 |
believe the best way to familiarize yourself with the model is to run the |
9 |
case study examples provided with the base version. Information on how to |
10 |
obtain, compile, and run the code is found there as well as a brief |
11 |
description of the model structure directory and the case study examples. |
12 |
The latter and the code structure are described more fully in sections 2 and |
13 |
3, respectively. In section 4, we provide information on how to customize |
14 |
the code when you are ready to try implementing the configuration you have |
15 |
in mind. |
16 |
|
17 |
\subsection{Obtaining the code} |
18 |
|
19 |
The reference web site for the model is: |
20 |
\begin{verbatim} |
21 |
http://mitgcm.org |
22 |
\end{verbatim} |
23 |
|
24 |
On this site, you can download the model as well as find useful information, |
25 |
some of which might overlap with what is written here. There is also a |
26 |
support news group for the model located at (send your message to \texttt{% |
27 |
support@mitgcm.org}): |
28 |
\begin{verbatim} |
29 |
news://mitgcm.org/mitgcm.support |
30 |
\end{verbatim} |
31 |
|
32 |
If CVS is available on your system, we strongly encourage you to use it. CVS |
33 |
provides an efficient and elegant way of organizing your code and keeping |
34 |
track of your changes. If CVS is not available on your machine, you can also |
35 |
download a tar file. |
36 |
|
37 |
\subsubsection{using CVS} |
38 |
|
39 |
Before you can use CVS, the following environment variable has to be set in |
40 |
your .cshrc or .tcshrc: |
41 |
\begin{verbatim} |
42 |
% setenv CVSROOT :pserver:cvsanon@mitgcm.org:/u/u0/gcmpack |
43 |
% cvs login ( CVS password: cvsanon ) |
44 |
\end{verbatim} |
45 |
|
46 |
You only need to do ``cvs login'' once. To obtain the latest source: |
47 |
\begin{verbatim} |
48 |
% cvs co -d directory models/MITgcmUV |
49 |
\end{verbatim} |
50 |
|
51 |
This creates a directory called \textit{directory}. If \textit{directory} |
52 |
exists this command updates your code based on the repository. Each |
53 |
directory in the source tree contains a directory \textit{CVS}. This |
54 |
information is required by CVS to keep track of your file versions with |
55 |
respect to the repository. Don't edit the files in \textit{CVS}! To obtain a |
56 |
specific \textit{version} that is not the latest source: |
57 |
\begin{verbatim} |
58 |
% cvs co -d directory -r version models/MITgcmUV |
59 |
\end{verbatim} |
60 |
|
61 |
\subsubsection{other methods} |
62 |
|
63 |
You can download the model as a tar file from the reference web site at: |
64 |
\begin{verbatim} |
65 |
http://mitgcm.org/download/ |
66 |
\end{verbatim} |
67 |
|
68 |
\subsection{Model and directory structure} |
69 |
|
70 |
The ``numerical'' model is contained within a execution environment support |
71 |
wrapper. This wrapper is designed to provide a general framework for |
72 |
grid-point models. MITgcmUV is a specific numerical model that uses the |
73 |
framework. Under this structure the model is split into execution |
74 |
environment support code and conventional numerical model code. The |
75 |
execution environment support code is held under the \textit{eesupp} |
76 |
directory. The grid point model code is held under the \textit{model} |
77 |
directory. Code execution actually starts in the \textit{eesupp} routines |
78 |
and not in the \textit{model} routines. For this reason the top-level |
79 |
\textit{MAIN.F} is in the \textit{eesupp/src} directory. In general, |
80 |
end-users should not need to worry about this level. The top-level routine |
81 |
for the numerical part of the code is in \textit{model/src/THE\_MODEL\_MAIN.F% |
82 |
}. Here is a brief description of the directory structure of the model under |
83 |
the root tree (a detailed description is given in section 3: Code structure). |
84 |
|
85 |
\begin{itemize} |
86 |
\item \textit{bin}: this directory is initially empty. It is the default |
87 |
directory in which to compile the code. |
88 |
|
89 |
\item \textit{diags}: contains the code relative to time-averaged |
90 |
diagnostics. It is subdivided into two subdirectories \textit{inc} and |
91 |
\textit{src} that contain include files (*.\textit{h} files) and fortran |
92 |
subroutines (*.\textit{F} files), respectively. |
93 |
|
94 |
\item \textit{doc}: contains brief documentation notes. |
95 |
|
96 |
\item \textit{eesupp}: contains the execution environment source code. Also |
97 |
subdivided into two subdirectories \textit{inc} and \textit{src}. |
98 |
|
99 |
\item \textit{exe}: this directory is initially empty. It is the default |
100 |
directory in which to execute the code. |
101 |
|
102 |
\item \textit{model}: this directory contains the main source code. Also |
103 |
subdivided into two subdirectories \textit{inc} and \textit{src}. |
104 |
|
105 |
\item \textit{pkg}: contains the source code for the packages. Each package |
106 |
corresponds to a subdirectory. For example, \textit{gmredi} contains the |
107 |
code related to the Gent-McWilliams/Redi scheme, \textit{aim} the code |
108 |
relative to the atmospheric intermediate physics. The packages are described |
109 |
in detail in section 3. |
110 |
|
111 |
\item \textit{tools}: this directory contains various useful tools. For |
112 |
example, \textit{genmake} is a script written in csh (C-shell) that should |
113 |
be used to generate your makefile. The directory \textit{adjoint} contains |
114 |
the makefile specific to the Tangent linear and Adjoint Compiler (TAMC) that |
115 |
generates the adjoint code. The latter is described in details in part V. |
116 |
|
117 |
\item \textit{utils}: this directory contains various utilities. The |
118 |
subdirectory \textit{knudsen2} contains code and a makefile that compute |
119 |
coefficients of the polynomial approximation to the knudsen formula for an |
120 |
ocean nonlinear equation of state. The \textit{matlab} subdirectory contains |
121 |
matlab scripts for reading model output directly into matlab. \textit{scripts% |
122 |
} contains C-shell post-processing scripts for joining processor-based and |
123 |
tiled-based model output. |
124 |
|
125 |
\item \textit{verification}: this directory contains the model examples. See |
126 |
below. |
127 |
\end{itemize} |
128 |
|
129 |
\subsection{Model examples} |
130 |
|
131 |
Now that you have successfully downloaded the model code we recommend that |
132 |
you first try to run the examples provided with the base version. You will |
133 |
probably want to run the example that is the closest to the configuration |
134 |
you will use eventually. The examples are located in subdirectories under |
135 |
the directory \textit{verification} and are briefly described below (a full |
136 |
description is given in section 2): |
137 |
|
138 |
\subsubsection{List of model examples} |
139 |
|
140 |
\begin{itemize} |
141 |
\item \textit{exp0} - single layer, ocean double gyre (barotropic with |
142 |
free-surface). |
143 |
|
144 |
\item \textit{exp1} - 4 layers, ocean double gyre. |
145 |
|
146 |
\item \textit{exp2} - 4x4 degree global ocean simulation with steady |
147 |
climatological forcing. |
148 |
|
149 |
\item \textit{exp4} - flow over a Gaussian bump in open-water or channel |
150 |
with open boundaries. |
151 |
|
152 |
\item \textit{exp5} - inhomogenously forced ocean convection in a doubly |
153 |
periodic box. |
154 |
|
155 |
\item \textit{front\_relax} - relaxation of an ocean thermal front (test for |
156 |
Gent/McWilliams scheme). 2D (Y-Z). |
157 |
|
158 |
\item \textit{internal wave} - ocean internal wave forced by open boundary |
159 |
conditions. |
160 |
|
161 |
\item \textit{natl\_box} - eastern subtropical North Atlantic with KPP |
162 |
scheme; 1 month integration |
163 |
|
164 |
\item \textit{hs94.1x64x5} - zonal averaged atmosphere using Held and Suarez |
165 |
'94 forcing. |
166 |
|
167 |
\item \textit{hs94.128x64x5} - 3D atmosphere dynamics using Held and Suarez |
168 |
'94 forcing. |
169 |
|
170 |
\item \textit{hs94.cs-32x32x5} - 3D atmosphere dynamics using Held and |
171 |
Suarez '94 forcing on the cubed sphere. |
172 |
|
173 |
\item \textit{aim.5l\_zon-ave} - Intermediate Atmospheric physics, 5 layers |
174 |
Molteni physics package. Global Zonal Mean configuration, 1x64x5 resolution. |
175 |
|
176 |
\item \textit{aim.5l\_XZ\_Equatorial\_Slice} - Intermediate Atmospheric |
177 |
physics, 5 layers Molteni physics package. Equatorial Slice configuration. |
178 |
2D (X-Z). |
179 |
|
180 |
\item \textit{aim.5l\_Equatorial\_Channel} - Intermediate Atmospheric |
181 |
physics, 5 layers Molteni physics package. 3D Equatorial Channel |
182 |
configuration (not completely tested). |
183 |
|
184 |
\item \textit{aim.5l\_LatLon} - Intermediate Atmospheric physics, 5 layers |
185 |
Molteni physics package. Global configuration, 128x64x5 resolution. |
186 |
|
187 |
\item \textit{adjustment.128x64x1} |
188 |
|
189 |
\item \textit{adjustment.cs-32x32x1} |
190 |
\end{itemize} |
191 |
|
192 |
\subsubsection{Directory structure of model examples} |
193 |
|
194 |
Each example directory has the following subdirectories: |
195 |
|
196 |
\begin{itemize} |
197 |
\item \textit{code}: contains the code particular to the example. At a |
198 |
minimum, this directory includes the following files: |
199 |
|
200 |
\begin{itemize} |
201 |
\item \textit{code/CPP\_EEOPTIONS.h}: declares CPP keys relative to the |
202 |
``execution environment'' part of the code. The default version is located |
203 |
in \textit{eesupp/inc}. |
204 |
|
205 |
\item \textit{code/CPP\_OPTIONS.h}: declares CPP keys relative to the |
206 |
``numerical model'' part of the code. The default version is located in |
207 |
\textit{model/inc}. |
208 |
|
209 |
\item \textit{code/SIZE.h}: declares size of underlying computational grid. |
210 |
The default version is located in \textit{model/inc}. |
211 |
\end{itemize} |
212 |
|
213 |
In addition, other include files and subroutines might be present in \textit{% |
214 |
code} depending on the particular experiment. See section 2 for more details. |
215 |
|
216 |
\item \textit{input}: contains the input data files required to run the |
217 |
example. At a mimimum, the \textit{input} directory contains the following |
218 |
files: |
219 |
|
220 |
\begin{itemize} |
221 |
\item \textit{input/data}: this file, written as a namelist, specifies the |
222 |
main parameters for the experiment. |
223 |
|
224 |
\item \textit{input/data.pkg}: contains parameters relative to the packages |
225 |
used in the experiment. |
226 |
|
227 |
\item \textit{input/eedata}: this file contains ``execution environment'' |
228 |
data. At present, this consists of a specification of the number of threads |
229 |
to use in $X$ and $Y$ under multithreaded execution. |
230 |
\end{itemize} |
231 |
|
232 |
In addition, you will also find in this directory the forcing and topography |
233 |
files as well as the files describing the initial state of the experiment. |
234 |
This varies from experiment to experiment. See section 2 for more details. |
235 |
|
236 |
\item \textit{results}: this directory contains the output file \textit{% |
237 |
output.txt} produced by the simulation example. This file is useful for |
238 |
comparison with your own output when you run the experiment. |
239 |
\end{itemize} |
240 |
|
241 |
Once you have chosen the example you want to run, you are ready to compile |
242 |
the code. |
243 |
|
244 |
\subsection{Compiling the code} |
245 |
|
246 |
\subsubsection{The script \textit{genmake}} |
247 |
|
248 |
To compile the code, use the script \textit{genmake} located in the \textit{% |
249 |
tools} directory. \textit{genmake} is a script that generates the makefile. |
250 |
It has been written so that the code can be compiled on a wide diversity of |
251 |
machines and systems. However, if it doesn't work the first time on your |
252 |
platform, you might need to edit certain lines of \textit{genmake} in the |
253 |
section containing the setups for the different machines. The file is |
254 |
structured like this: |
255 |
\begin{verbatim} |
256 |
. |
257 |
. |
258 |
. |
259 |
general instructions (machine independent) |
260 |
. |
261 |
. |
262 |
. |
263 |
- setup machine 1 |
264 |
- setup machine 2 |
265 |
- setup machine 3 |
266 |
- setup machine 4 |
267 |
etc |
268 |
. |
269 |
. |
270 |
. |
271 |
\end{verbatim} |
272 |
|
273 |
For example, the setup corresponding to a DEC alpha machine is reproduced |
274 |
here: |
275 |
\begin{verbatim} |
276 |
case OSF1+mpi: |
277 |
echo "Configuring for DEC Alpha" |
278 |
set CPP = ( '/usr/bin/cpp -P' ) |
279 |
set DEFINES = ( ${DEFINES} '-DTARGET_DEC -DWORDLENGTH=1' ) |
280 |
set KPP = ( 'kapf' ) |
281 |
set KPPFILES = ( 'main.F' ) |
282 |
set KFLAGS1 = ( '-scan=132 -noconc -cmp=' ) |
283 |
set FC = ( 'f77' ) |
284 |
set FFLAGS = ( '-convert big_endian -r8 -extend_source -automatic -call_shared -notransform_loops -align dcommons' ) |
285 |
set FOPTIM = ( '-O5 -fast -tune host -inline all' ) |
286 |
set NOOPTFLAGS = ( '-O0' ) |
287 |
set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' ) |
288 |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') |
289 |
set RMFILES = ( '*.p.out' ) |
290 |
breaksw |
291 |
\end{verbatim} |
292 |
|
293 |
Typically, these are the lines that you might need to edit to make \textit{% |
294 |
genmake} work on your platform if it doesn't work the first time. \textit{% |
295 |
genmake} understands several options that are described here: |
296 |
|
297 |
\begin{itemize} |
298 |
\item -rootdir=dir |
299 |
|
300 |
indicates where the model root directory is relative to the directory where |
301 |
you are compiling. This option is not needed if you compile in the \textit{% |
302 |
bin} directory (which is the default compilation directory) or within the |
303 |
\textit{verification} tree. |
304 |
|
305 |
\item -mods=dir1,dir2,... |
306 |
|
307 |
indicates the relative or absolute paths directories where the sources |
308 |
should take precedence over the default versions (located in \textit{model}, |
309 |
\textit{eesupp},...). Typically, this option is used when running the |
310 |
examples, see below. |
311 |
|
312 |
\item -enable=pkg1,pkg2,... |
313 |
|
314 |
enables packages source code \textit{pkg1}, \textit{pkg2},... when creating |
315 |
the makefile. |
316 |
|
317 |
\item -disable=pkg1,pkg2,... |
318 |
|
319 |
disables packages source code \textit{pkg1}, \textit{pkg2},... when creating |
320 |
the makefile. |
321 |
|
322 |
\item -platform=machine |
323 |
|
324 |
specifies the platform for which you want the makefile. In general, you |
325 |
won't need this option. \textit{genmake} will select the right machine for |
326 |
you (the one you're working on!). However, this option is useful if you have |
327 |
a choice of several compilers on one machine and you want to use the one |
328 |
that is not the default (ex: \texttt{pgf77} instead of \texttt{f77} under |
329 |
Linux). |
330 |
|
331 |
\item -mpi |
332 |
|
333 |
this is used when you want to run the model in parallel processing mode |
334 |
under mpi (see section on parallel computation for more details). |
335 |
|
336 |
\item -jam |
337 |
|
338 |
this is used when you want to run the model in parallel processing mode |
339 |
under jam (see section on parallel computation for more details). |
340 |
\end{itemize} |
341 |
|
342 |
For some of the examples, there is a file called \textit{.genmakerc} in the |
343 |
\textit{input} directory that has the relevant \textit{genmake} options for |
344 |
that particular example. In this way you don't need to type the options when |
345 |
invoking \textit{genmake}. |
346 |
|
347 |
\subsubsection{Compiling} |
348 |
|
349 |
Let's assume that you want to run, say, example \textit{exp2} in the \textit{% |
350 |
input} directory. To compile the code, type the following commands from the |
351 |
model root tree: |
352 |
\begin{verbatim} |
353 |
% cd verification/exp2/input |
354 |
% ../../../tools/genmake |
355 |
% make depend |
356 |
% make |
357 |
\end{verbatim} |
358 |
|
359 |
If there is no \textit{.genmakerc} in the \textit{input} directory, you have |
360 |
to use the following options when invoking \textit{genmake}: |
361 |
\begin{verbatim} |
362 |
% ../../../tools/genmake -mods=../code |
363 |
\end{verbatim} |
364 |
|
365 |
In addition, you will probably want to disable some of the packages. Taking |
366 |
again the case of \textit{exp2}, the full \textit{genmake} command will |
367 |
probably look like this: |
368 |
\begin{verbatim} |
369 |
% ../../../tools/genmake -mods=../code -disable=kpp,gmredi,aim,... |
370 |
\end{verbatim} |
371 |
|
372 |
The make command creates an executable called \textit{mitgcmuv}. |
373 |
|
374 |
Note that you can compile and run the code in another directory than \textit{% |
375 |
input}. You just need to make sure that you copy the input data files into |
376 |
the directory where you want to run the model. For example to compile from |
377 |
\textit{code}: |
378 |
\begin{verbatim} |
379 |
% cd verification/exp2/code |
380 |
% ../../../tools/genmake |
381 |
% make depend |
382 |
% make |
383 |
\end{verbatim} |
384 |
|
385 |
\subsection{Running the model} |
386 |
|
387 |
The first thing to do is to run the code by typing \textit{mitgcmuv} and see |
388 |
what happens. You can compare what you get with what is in the \textit{% |
389 |
results} directory. Unless noted otherwise, most examples are set up to run |
390 |
for a few time steps only so that you can quickly figure out whether the |
391 |
model is working or not. |
392 |
|
393 |
\subsubsection{Output files} |
394 |
|
395 |
The model produces various output files. At a minimum, the instantaneous |
396 |
``state'' of the model is written out, which is made of the following files: |
397 |
|
398 |
\begin{itemize} |
399 |
\item \textit{U.00000nIter} - zonal component of velocity field (m/s and $> |
400 |
0 $ eastward). |
401 |
|
402 |
\item \textit{V.00000nIter} - meridional component of velocity field (m/s |
403 |
and $> 0$ northward). |
404 |
|
405 |
\item \textit{W.00000nIter} - vertical component of velocity field (ocean: |
406 |
m/s and $> 0$ upward, atmosphere: Pa/s and $> 0$ towards increasing pressure |
407 |
i.e. downward). |
408 |
|
409 |
\item \textit{T.00000nIter} - potential temperature (ocean: $^{0}$C, |
410 |
atmosphere: $^{0}$K). |
411 |
|
412 |
\item \textit{S.00000nIter} - ocean: salinity (psu), atmosphere: water vapor |
413 |
(g/kg). |
414 |
|
415 |
\item \textit{Eta.00000nIter} - ocean: surface elevation (m), atmosphere: |
416 |
surface pressure anomaly (Pa). |
417 |
\end{itemize} |
418 |
|
419 |
The chain \textit{00000nIter} consists of ten figures that specify the |
420 |
iteration number at which the output is written out. For example, \textit{% |
421 |
U.0000000300} is the zonal velocity at iteration 300. |
422 |
|
423 |
In addition, a ``pickup'' or ``checkpoint'' file called: |
424 |
|
425 |
\begin{itemize} |
426 |
\item \textit{pickup.00000nIter} |
427 |
\end{itemize} |
428 |
|
429 |
is written out. This file represents the state of the model in a condensed |
430 |
form and is used for restarting the integration. If the C-D scheme is used, |
431 |
there is an additional ``pickup'' file: |
432 |
|
433 |
\begin{itemize} |
434 |
\item \textit{pickup\_cd.00000nIter} |
435 |
\end{itemize} |
436 |
|
437 |
containing the D-grid velocity data and that has to be written out as well |
438 |
in order to restart the integration. Rolling checkpoint files are the same |
439 |
as the pickup files but are named differently. Their name contain the chain |
440 |
\textit{ckptA} or \textit{ckptB} instead of \textit{00000nIter}. They can be |
441 |
used to restart the model but are overwritten every other time they are |
442 |
output to save disk space during long integrations. |
443 |
|
444 |
\subsubsection{Looking at the output} |
445 |
|
446 |
All the model data are written according to a ``meta/data'' file format. |
447 |
Each variable is associated with two files with suffix names \textit{.data} |
448 |
and \textit{.meta}. The \textit{.data} file contains the data written in |
449 |
binary form (big\_endian by default). The \textit{.meta} file is a |
450 |
``header'' file that contains information about the size and the structure |
451 |
of the \textit{.data} file. This way of organizing the output is |
452 |
particularly useful when running multi-processors calculations. The base |
453 |
version of the model includes a few matlab utilities to read output files |
454 |
written in this format. The matlab scripts are located in the directory |
455 |
\textit{utils/matlab} under the root tree. The script \textit{rdmds.m} reads |
456 |
the data. Look at the comments inside the script to see how to use it. |
457 |
|
458 |
\section{Code structure} |
459 |
|
460 |
\section{Doing it yourself: customizing the code} |
461 |
|
462 |
\subsection{\protect\bigskip Configuration and setup} |
463 |
|
464 |
When you are ready to run the model in the configuration you want, the |
465 |
easiest thing is to use and adapt the setup of the case studies experiment |
466 |
(described previously) that is the closest to your configuration. Then, the |
467 |
amount of setup will be minimized. In this section, we focus on the setup |
468 |
relative to the ''numerical model'' part of the code (the setup relative to |
469 |
the ''execution environment'' part is covered in the parallel implementation |
470 |
section) and on the variables and parameters that you are likely to change. |
471 |
|
472 |
The CPP keys relative to the ''numerical model'' part of the code are all |
473 |
defined and set in the file \textit{CPP\_OPTIONS.h }in the directory \textit{% |
474 |
model/inc }or in one of the \textit{code }directories of the case study |
475 |
experiments under \textit{verification.} The model parameters are defined |
476 |
and declared in the file \textit{model/inc/PARAMS.h }and their default |
477 |
values are set in the routine \textit{model/src/set\_defaults.F. }The |
478 |
default values can be modified in the namelist file \textit{data }which |
479 |
needs to be located in the directory where you will run the model. The |
480 |
parameters are initialized in the routine \textit{model/src/ini\_parms.F}. |
481 |
Look at this routine to see in what part of the namelist the parameters are |
482 |
located. |
483 |
|
484 |
In what follows the parameters are grouped into categories related to the |
485 |
computational domain, the equations solved in the model, and the simulation |
486 |
controls. |
487 |
|
488 |
\subsubsection{Computational domain, geometry and time-discretization} |
489 |
|
490 |
\begin{itemize} |
491 |
\item dimensions |
492 |
\end{itemize} |
493 |
|
494 |
The number of points in the x, y,\textit{\ }and r\textit{\ }directions are |
495 |
represented by the variables \textbf{sNx}\textit{, }\textbf{sNy}\textit{, }% |
496 |
and \textbf{Nr}\textit{\ }respectively which are declared and set in the |
497 |
file \textit{model/inc/SIZE.h. }(Again, this assumes a mono-processor |
498 |
calculation. For multiprocessor calculations see section on parallel |
499 |
implementation.) |
500 |
|
501 |
\begin{itemize} |
502 |
\item grid |
503 |
\end{itemize} |
504 |
|
505 |
Three different grids are available: cartesian, spherical polar, and |
506 |
curvilinear (including the cubed sphere). The grid is set through the |
507 |
logical variables \textbf{usingCartesianGrid}\textit{, }\textbf{% |
508 |
usingSphericalPolarGrid}\textit{, }and \textit{\ }\textbf{% |
509 |
usingCurvilinearGrid}\textit{. }In the case of spherical and curvilinear |
510 |
grids, the southern boundary is defined through the variable \textbf{phiMin}% |
511 |
\textit{\ }which corresponds to the latitude of the southern most cell face |
512 |
(in degrees). The resolution along the x and y directions is controlled by |
513 |
the 1D arrays \textbf{delx}\textit{\ }and \textbf{dely}\textit{\ }(in meters |
514 |
in the case of a cartesian grid, in degrees otherwise). The vertical grid |
515 |
spacing is set through the 1D array \textbf{delz }for the ocean (in meters) |
516 |
or \textbf{delp}\textit{\ }for the atmosphere (in Pa). The variable \textbf{% |
517 |
Ro\_SeaLevel} represents the standard position of Sea-Level in ''R'' |
518 |
coordinate. This is typically set to 0m for the ocean (default value) and 10$% |
519 |
^{5}$Pa for the atmosphere. For the atmosphere, also set the logical |
520 |
variable \textbf{groundAtK1} to '.\texttt{TRUE}.'. which put the first level |
521 |
(k=1) at the lower boundary (ground). |
522 |
|
523 |
For the cartesian grid case, the Coriolis parameter $f$ is set through the |
524 |
variables \textbf{f0}\textit{\ }and \textbf{beta}\textit{\ }which correspond |
525 |
to the reference Coriolis parameter (in s$^{-1}$) and $\frac{\partial f}{% |
526 |
\partial y}$(in m$^{-1}$s$^{-1}$) respectively. If \textbf{beta }\textit{\ }% |
527 |
is set to a nonzero value, \textbf{f0}\textit{\ }is the value of $f$ at the |
528 |
southern edge of the domain. |
529 |
|
530 |
\begin{itemize} |
531 |
\item topography - full and partial cells |
532 |
\end{itemize} |
533 |
|
534 |
The domain bathymetry is read from a file that contains a 2D (x,y) map of |
535 |
depths (in m) for the ocean or pressures (in Pa) for the atmosphere. The |
536 |
file name is represented by the variable \textbf{bathyFile}\textit{. }The |
537 |
file is assumed to contain binary numbers giving the depth (pressure) of the |
538 |
model at each grid cell, ordered with the x coordinate varying fastest. The |
539 |
points are ordered from low coordinate to high coordinate for both axes. The |
540 |
model code applies without modification to enclosed, periodic, and double |
541 |
periodic domains. Periodicity is assumed by default and is suppressed by |
542 |
setting the depths to 0m for the cells at the limits of the computational |
543 |
domain (note: not sure this is the case for the atmosphere). The precision |
544 |
with which to read the binary data is controlled by the integer variable |
545 |
\textbf{readBinaryPrec }which can take the value \texttt{32} (single |
546 |
precision) or \texttt{64} (double precision). See the matlab program \textit{% |
547 |
gendata.m }in the \textit{input }directories under \textit{verification }to |
548 |
see how the bathymetry files are generated for the case study experiments. |
549 |
|
550 |
To use the partial cell capability, the variable \textbf{hFacMin}\textit{\ }% |
551 |
needs to be set to a value between 0 and 1 (it is set to 1 by default) |
552 |
corresponding to the minimum fractional size of the cell. For example if the |
553 |
bottom cell is 500m thick and \textbf{hFacMin}\textit{\ }is set to 0.1, the |
554 |
actual thickness of the cell (i.e. used in the code) can cover a range of |
555 |
discrete values 50m apart from 50m to 500m depending on the value of the |
556 |
bottom depth (in \textbf{bathyFile}) at this point. |
557 |
|
558 |
Note that the bottom depths (or pressures) need not coincide with the models |
559 |
levels as deduced from \textbf{delz}\textit{\ }or\textit{\ }\textbf{delp}% |
560 |
\textit{. }The model will interpolate the numbers in \textbf{bathyFile}% |
561 |
\textit{\ }so that they match the levels obtained from \textbf{delz}\textit{% |
562 |
\ }or\textit{\ }\textbf{delp}\textit{\ }and \textbf{hFacMin}\textit{. } |
563 |
|
564 |
(Note: the atmospheric case is a bit more complicated than what is written |
565 |
here I think. To come soon...) |
566 |
|
567 |
\begin{itemize} |
568 |
\item time-discretization |
569 |
\end{itemize} |
570 |
|
571 |
The time steps are set through the real variables \textbf{deltaTMom }and |
572 |
\textbf{deltaTtracer }(in s) which represent the time step for the momentum |
573 |
and tracer equations, respectively. For synchronous integrations, simply set |
574 |
the two variables to the same value (or you can prescribe one time step only |
575 |
through the variable \textbf{deltaT}). The Adams-Bashforth stabilizing |
576 |
parameter is set through the variable \textbf{abEps }(dimensionless). The |
577 |
stagger baroclinic time stepping can be activated by setting the logical |
578 |
variable \textbf{staggerTimeStep }to '.\texttt{TRUE}.'. |
579 |
|
580 |
\subsubsection{Equation of state} |
581 |
|
582 |
First, because the model equations are written in terms of perturbations, a |
583 |
reference thermodynamic state needs to be specified. This is done through |
584 |
the 1D arrays \textbf{tRef}\textit{\ }and \textbf{sRef}. \textbf{tRef }% |
585 |
specifies the reference potential temperature profile (in $^{o}$C for |
586 |
the ocean and $^{o}$K for the atmosphere) starting from the level |
587 |
k=1. Similarly, \textbf{sRef}\textit{\ }specifies the reference salinity |
588 |
profile (in ppt) for the ocean or the reference specific humidity profile |
589 |
(in g/kg) for the atmosphere. |
590 |
|
591 |
The form of the equation of state is controlled by the character variables |
592 |
\textbf{buoyancyRelation}\textit{\ }and \textbf{eosType}\textit{. }\textbf{% |
593 |
buoyancyRelation}\textit{\ }is set to '\texttt{OCEANIC}' by default and |
594 |
needs to be set to '\texttt{ATMOSPHERIC}' for atmosphere simulations. In |
595 |
this case, \textbf{eosType}\textit{\ }must be set to '\texttt{IDEALGAS}'. |
596 |
For the ocean, two forms of the equation of state are available: linear (set |
597 |
\textbf{eosType}\textit{\ }to '\texttt{LINEAR}') and a polynomial |
598 |
approximation to the full nonlinear equation ( set \textbf{eosType}\textit{\ |
599 |
}to '\texttt{POLYNOMIAL}'). In the linear case, you need to specify the |
600 |
thermal and haline expansion coefficients represented by the variables |
601 |
\textbf{tAlpha}\textit{\ }(in K$^{-1}$) and \textbf{sBeta}\textit{\ }(in ppt$% |
602 |
^{-1}$). For the nonlinear case, you need to generate a file of polynomial |
603 |
coefficients called \textit{POLY3.COEFFS. }To do this, use the program |
604 |
\textit{utils/knudsen2/knudsen2.f }under the model tree (a Makefile is |
605 |
available in the same directory and you will need to edit the number and the |
606 |
values of the vertical levels in \textit{knudsen2.f }so that they match |
607 |
those of your configuration). \textit{\ } |
608 |
|
609 |
\subsubsection{Momentum equations} |
610 |
|
611 |
In this section, we only focus for now on the parameters that you are likely |
612 |
to change, i.e. the ones relative to forcing and dissipation for example. |
613 |
The details relevant to the vector-invariant form of the equations and the |
614 |
various advection schemes are not covered for the moment. We assume that you |
615 |
use the standard form of the momentum equations (i.e. the flux-form) with |
616 |
the default advection scheme. Also, there are a few logical variables that |
617 |
allow you to turn on/off various terms in the momentum equation. These |
618 |
variables are called \textbf{momViscosity, momAdvection, momForcing, |
619 |
useCoriolis, momPressureForcing, momStepping}\textit{, }and \textit{\ }% |
620 |
\textbf{metricTerms }and are assumed to be set to '.\texttt{TRUE}.' here. |
621 |
Look at the file \textit{model/inc/PARAMS.h }for a precise definition of |
622 |
these variables. |
623 |
|
624 |
\begin{itemize} |
625 |
\item initialization |
626 |
\end{itemize} |
627 |
|
628 |
The velocity components are initialized to 0 unless the simulation is |
629 |
starting from a pickup file (see section on simulation control parameters). |
630 |
|
631 |
\begin{itemize} |
632 |
\item forcing |
633 |
\end{itemize} |
634 |
|
635 |
This section only applies to the ocean. You need to generate wind-stress |
636 |
data into two files \textbf{zonalWindFile}\textit{\ }and \textbf{% |
637 |
meridWindFile }corresponding to the zonal and meridional components of the |
638 |
wind stress, respectively (if you want the stress to be along the direction |
639 |
of only one of the model horizontal axes, you only need to generate one |
640 |
file). The format of the files is similar to the bathymetry file. The zonal |
641 |
(meridional) stress data are assumed to be in Pa and located at U-points |
642 |
(V-points). As for the bathymetry, the precision with which to read the |
643 |
binary data is controlled by the variable \textbf{readBinaryPrec}.\textbf{\ } |
644 |
See the matlab program \textit{gendata.m }in the \textit{input }directories |
645 |
under \textit{verification }to see how simple analytical wind forcing data |
646 |
are generated for the case study experiments. |
647 |
|
648 |
There is also the possibility of prescribing time-dependent periodic |
649 |
forcing. To do this, concatenate the successive time records into a single |
650 |
file (for each stress component) ordered in a (x, y, t) fashion and set the |
651 |
following variables: \textbf{periodicExternalForcing }to '.\texttt{TRUE}.', |
652 |
\textbf{externForcingPeriod }to the period (in s) of which the forcing |
653 |
varies (typically 1 month), and \textbf{externForcingCycle }to the repeat |
654 |
time (in s) of the forcing (typically 1 year -- note: \textbf{% |
655 |
externForcingCycle }must be a multiple of \textbf{externForcingPeriod}). |
656 |
With these variables set up, the model will interpolate the forcing linearly |
657 |
at each iteration. |
658 |
|
659 |
\begin{itemize} |
660 |
\item dissipation |
661 |
\end{itemize} |
662 |
|
663 |
The lateral eddy viscosity coefficient is specified through the variable |
664 |
\textbf{viscAh}\textit{\ }(in m$^{2}$s$^{-1}$). The vertical eddy viscosity |
665 |
coefficient is specified through the variable \textbf{viscAz }(in m$^{2}$s$% |
666 |
^{-1}$) for the ocean and \textbf{viscAp}\textit{\ }(in Pa$^{2}$s$^{-1}$) |
667 |
for the atmosphere. The vertical diffusive fluxes can be computed implicitly |
668 |
by setting the logical variable \textbf{implicitViscosity }to '.\texttt{TRUE}% |
669 |
.'. In addition, biharmonic mixing can be added as well through the variable |
670 |
\textbf{viscA4}\textit{\ }(in m$^{4}$s$^{-1}$). On a spherical polar grid, |
671 |
you might also need to set the variable \textbf{cosPower} which is set to 0 |
672 |
by default and which represents the power of cosine of latitude to multiply |
673 |
viscosity. Slip or no-slip conditions at lateral and bottom boundaries are |
674 |
specified through the logical variables \textbf{no\_slip\_sides}\textit{\ }% |
675 |
and \textbf{no\_slip\_bottom}. If set to '\texttt{.FALSE.}', free-slip |
676 |
boundary conditions are applied. If no-slip boundary conditions are applied |
677 |
at the bottom, a bottom drag can be applied as well. Two forms are |
678 |
available: linear (set the variable \textbf{bottomDragLinear}\textit{\ }in s$% |
679 |
^{-1}$) and quadratic (set the variable \textbf{bottomDragQuadratic}\textit{% |
680 |
\ }in m$^{-1}$). |
681 |
|
682 |
The Fourier and Shapiro filters are described elsewhere. |
683 |
|
684 |
\begin{itemize} |
685 |
\item C-D scheme |
686 |
\end{itemize} |
687 |
|
688 |
If you run at a sufficiently coarse resolution, you will need the C-D scheme |
689 |
for the computation of the Coriolis terms. The variable\textbf{\ tauCD}, |
690 |
which represents the C-D scheme coupling timescale (in s) needs to be set. |
691 |
|
692 |
\begin{itemize} |
693 |
\item calculation of pressure/geopotential |
694 |
\end{itemize} |
695 |
|
696 |
First, to run a non-hydrostatic ocean simulation, set the logical variable |
697 |
\textbf{nonHydrostatic} to '.\texttt{TRUE}.'. The pressure field is then |
698 |
inverted through a 3D elliptic equation. (Note: this capability is not |
699 |
available for the atmosphere yet.) By default, a hydrostatic simulation is |
700 |
assumed and a 2D elliptic equation is used to invert the pressure field. The |
701 |
parameters controlling the behaviour of the elliptic solvers are the |
702 |
variables \textbf{cg2dMaxIters}\textit{\ }and \textbf{cg2dTargetResidual }% |
703 |
for the 2D case and \textbf{cg3dMaxIters}\textit{\ }and \textbf{% |
704 |
cg3dTargetResidual }for the 3D case. You probably won't need to alter the |
705 |
default values (are we sure of this?). |
706 |
|
707 |
For the calculation of the surface pressure (for the ocean) or surface |
708 |
geopotential (for the atmosphere) you need to set the logical variables |
709 |
\textbf{rigidLid} and \textbf{implicitFreeSurface}\textit{\ }(set one to '.% |
710 |
\texttt{TRUE}.' and the other to '.\texttt{FALSE}.' depending on how you |
711 |
want to deal with the ocean upper or atmosphere lower boundary). |
712 |
|
713 |
\subsubsection{Tracer equations} |
714 |
|
715 |
This section covers the tracer equations i.e. the potential temperature |
716 |
equation and the salinity (for the ocean) or specific humidity (for the |
717 |
atmosphere) equation. As for the momentum equations, we only describe for |
718 |
now the parameters that you are likely to change. The logical variables |
719 |
\textbf{tempDiffusion}\textit{, }\textbf{tempAdvection}\textit{, }\textbf{% |
720 |
tempForcing}\textit{,} and \textbf{tempStepping} allow you to turn on/off |
721 |
terms in the temperature equation (same thing for salinity or specific |
722 |
humidity with variables \textbf{saltDiffusion}\textit{, }\textbf{% |
723 |
saltAdvection}\textit{\ }etc). These variables are all assumed here to be |
724 |
set to '.\texttt{TRUE}.'. Look at file \textit{model/inc/PARAMS.h }for a |
725 |
precise definition. |
726 |
|
727 |
\begin{itemize} |
728 |
\item initialization |
729 |
\end{itemize} |
730 |
|
731 |
The initial tracer data can be contained in the binary files \textbf{% |
732 |
hydrogThetaFile }and \textbf{hydrogSaltFile}. These files should contain 3D |
733 |
data ordered in an (x, y, r) fashion with k=1 as the first vertical level. |
734 |
If no file names are provided, the tracers are then initialized with the |
735 |
values of \textbf{tRef }and \textbf{sRef }mentioned above (in the equation |
736 |
of state section). In this case, the initial tracer data are uniform in x |
737 |
and y for each depth level. |
738 |
|
739 |
\begin{itemize} |
740 |
\item forcing |
741 |
\end{itemize} |
742 |
|
743 |
This part is more relevant for the ocean, the procedure for the atmosphere |
744 |
not being completely stabilized at the moment. |
745 |
|
746 |
A combination of fluxes data and relaxation terms can be used for driving |
747 |
the tracer equations. \ For potential temperature, heat flux data (in W/m$% |
748 |
^{2}$) can be stored in the 2D binary file \textbf{surfQfile}\textit{. }% |
749 |
Alternatively or in addition, the forcing can be specified through a |
750 |
relaxation term. The SST data to which the model surface temperatures are |
751 |
restored to are supposed to be stored in the 2D binary file \textbf{% |
752 |
thetaClimFile}\textit{. }The corresponding relaxation time scale coefficient |
753 |
is set through the variable \textbf{tauThetaClimRelax}\textit{\ }(in s). The |
754 |
same procedure applies for salinity with the variable names \textbf{EmPmRfile% |
755 |
}\textit{, }\textbf{saltClimFile}\textit{, }and \textbf{tauSaltClimRelax}% |
756 |
\textit{\ }for freshwater flux (in m/s) and surface salinity (in ppt) data |
757 |
files and relaxation time scale coefficient (in s), respectively. Also for |
758 |
salinity, if the CPP key \textbf{USE\_NATURAL\_BCS} is turned on, natural |
759 |
boundary conditions are applied i.e. when computing the surface salinity |
760 |
tendency, the freshwater flux is multiplied by the model surface salinity |
761 |
instead of a constant salinity value. |
762 |
|
763 |
As for the other input files, the precision with which to read the data is |
764 |
controlled by the variable \textbf{readBinaryPrec}. Time-dependent, periodic |
765 |
forcing can be applied as well following the same procedure used for the |
766 |
wind forcing data (see above). |
767 |
|
768 |
\begin{itemize} |
769 |
\item dissipation |
770 |
\end{itemize} |
771 |
|
772 |
Lateral eddy diffusivities for temperature and salinity/specific humidity |
773 |
are specified through the variables \textbf{diffKhT }and \textbf{diffKhS }% |
774 |
(in m$^{2}$/s). Vertical eddy diffusivities are specified through the |
775 |
variables \textbf{diffKzT }and \textbf{diffKzS }(in m$^{2}$/s) for the ocean |
776 |
and \textbf{diffKpT }and \textbf{diffKpS }(in Pa$^{2}$/s) for the |
777 |
atmosphere. The vertical diffusive fluxes can be computed implicitly by |
778 |
setting the logical variable \textbf{implicitDiffusion }to '.\texttt{TRUE}% |
779 |
.'. In addition, biharmonic diffusivities can be specified as well through |
780 |
the coefficients \textbf{diffK4T }and \textbf{diffK4S }(in m$^{4}$/s). Note |
781 |
that the cosine power scaling (specified through \textbf{cosPower }- see the |
782 |
momentum equations section) is applied to the tracer diffusivities |
783 |
(Laplacian and biharmonic) as well. The Gent and McWilliams parameterization |
784 |
for oceanic tracers is described in the package section. Finally, note that |
785 |
tracers can be also subject to Fourier and Shapiro filtering (see the |
786 |
corresponding section on these filters). |
787 |
|
788 |
\begin{itemize} |
789 |
\item ocean convection |
790 |
\end{itemize} |
791 |
|
792 |
Two options are available to parameterize ocean convection: one is to use |
793 |
the convective adjustment scheme. In this case, you need to set the variable |
794 |
\textbf{cadjFreq}, which represents the frequency (in s) with which the |
795 |
adjustment algorithm is called, to a non-zero value (if set to a negative |
796 |
value by the user, the model will set it to the tracer time step). The other |
797 |
option is to parameterize convection with implicit vertical diffusion. To do |
798 |
this, set the logical variable \textbf{implicitDiffusion }to '.\texttt{TRUE}% |
799 |
.' and the real variable \textbf{ivdc\_kappa }to a value (in m$^{2}$/s) you |
800 |
wish the tracer vertical diffusivities to have when mixing tracers |
801 |
vertically due to static instabilities. Note that \textbf{cadjFreq }and |
802 |
\textbf{ivdc\_kappa }can not both have non-zero value. |
803 |
|
804 |
\subsubsection{Simulation controls} |
805 |
|
806 |
The model ''clock'' is defined by the variable \textbf{deltaTClock }(in s) |
807 |
which determines the IO frequencies and is used in tagging output. |
808 |
Typically, you will set it to the tracer time step for accelerated runs |
809 |
(otherwise it is simply set to the default time step \textbf{deltaT}). |
810 |
Frequency of checkpointing and dumping of the model state are referenced to |
811 |
this clock (see below). |
812 |
|
813 |
\begin{itemize} |
814 |
\item run duration |
815 |
\end{itemize} |
816 |
|
817 |
The beginning of a simulation is set by specifying a start time (in s) |
818 |
through the real variable \textbf{startTime }or by specifying an initial |
819 |
iteration number through the integer variable \textbf{nIter0}. If these |
820 |
variables are set to nonzero values, the model will look for a ''pickup'' |
821 |
file \textit{pickup.0000nIter0 }to restart the integration\textit{. }The end |
822 |
of a simulation is set through the real variable \textbf{endTime }(in s). |
823 |
Alternatively, you can specify instead the number of time steps to execute |
824 |
through the integer variable \textbf{nTimeSteps}. |
825 |
|
826 |
\begin{itemize} |
827 |
\item frequency of output |
828 |
\end{itemize} |
829 |
|
830 |
Real variables defining frequencies (in s) with which output files are |
831 |
written on disk need to be set up. \textbf{dumpFreq }controls the frequency |
832 |
with which the instantaneous state of the model is saved. \textbf{chkPtFreq }% |
833 |
and \textbf{pchkPtFreq }control the output frequency of rolling and |
834 |
permanent checkpoint files, respectively. See section 1.5.1 Output files for the |
835 |
definition of model state and checkpoint files. In addition, time-averaged |
836 |
fields can be written out by setting the variable \textbf{taveFreq} (in s). |
837 |
The precision with which to write the binary data is controlled by the |
838 |
integer variable w\textbf{riteBinaryPrec }(set it to \texttt{32} or \texttt{% |
839 |
64}). |