/[MITgcm]/manual/s_getstarted/text/getting_started.tex
ViewVC logotype

Annotation of /manual/s_getstarted/text/getting_started.tex

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.15 - (hide annotations) (download) (as text)
Wed Jan 28 20:50:14 2004 UTC (21 years, 5 months ago) by edhill
Branch: MAIN
Changes since 1.14: +165 -125 lines
File MIME type: application/x-tex
 o update web site description

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

  ViewVC Help
Powered by ViewVC 1.1.22