/[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.6 - (hide annotations) (download) (as text)
Thu Oct 18 18:44:14 2001 UTC (23 years, 8 months ago) by adcroft
Branch: MAIN
Changes since 1.5: +7 -2 lines
File MIME type: application/x-tex
Clarified environment...

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

  ViewVC Help
Powered by ViewVC 1.1.22