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

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

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


Revision 1.5 - (hide annotations) (download) (as text)
Sat Apr 15 14:43:59 2006 UTC (18 years, 1 month ago) by jmc
Branch: MAIN
Changes since 1.4: +2 -3 lines
File MIME type: application/x-tex
fix units for bottom drag (linear, quadratic) that were wrong.

1 cnh 1.1 \section[Customizing MITgcm]{Doing it yourself: customizing the code}
2 molod 1.4 \label{sect:customize}
3 edhill 1.3 \begin{rawhtml}
4     <!-- CMIREDIR:customizing_mitgcm: -->
5     \end{rawhtml}
6 cnh 1.1
7     When you are ready to run the model in the configuration you want, the
8     easiest thing is to use and adapt the setup of the case studies
9     experiment (described previously) that is the closest to your
10     configuration. Then, the amount of setup will be minimized. In this
11     section, we focus on the setup relative to the ``numerical model''
12     part of the code (the setup relative to the ``execution environment''
13     part is covered in the parallel implementation section) and on the
14     variables and parameters that you are likely to change.
15    
16 cnh 1.2
17     \subsection{Building/compiling the code elsewhere}
18    
19     In the example above (section \ref{sect:buildingCode}) we built the
20     executable in the {\em input} directory of the experiment for
21     convenience. You can also configure and compile the code in other
22     locations, for example on a scratch disk with out having to copy the
23     entire source tree. The only requirement to do so is you have {\tt
24     genmake2} in your path or you know the absolute path to {\tt
25     genmake2}.
26    
27     The following sections outline some possible methods of organizing
28     your source and data.
29    
30     \subsubsection{Building from the {\em ../code directory}}
31    
32     This is just as simple as building in the {\em input/} directory:
33     \begin{verbatim}
34     % cd verification/exp2/code
35     % ../../../tools/genmake2
36     % make depend
37     % make
38     \end{verbatim}
39     However, to run the model the executable ({\em mitgcmuv}) and input
40     files must be in the same place. If you only have one calculation to make:
41     \begin{verbatim}
42     % cd ../input
43     % cp ../code/mitgcmuv ./
44     % ./mitgcmuv > output.txt
45     \end{verbatim}
46     or if you will be making multiple runs with the same executable:
47     \begin{verbatim}
48     % cd ../
49     % cp -r input run1
50     % cp code/mitgcmuv run1
51     % cd run1
52     % ./mitgcmuv > output.txt
53     \end{verbatim}
54    
55     \subsubsection{Building from a new directory}
56    
57     Since the {\em input} directory contains input files it is often more
58     useful to keep {\em input} pristine and build in a new directory
59     within {\em verification/exp2/}:
60     \begin{verbatim}
61     % cd verification/exp2
62     % mkdir build
63     % cd build
64     % ../../../tools/genmake2 -mods=../code
65     % make depend
66     % make
67     \end{verbatim}
68     This builds the code exactly as before but this time you need to copy
69     either the executable or the input files or both in order to run the
70     model. For example,
71     \begin{verbatim}
72     % cp ../input/* ./
73     % ./mitgcmuv > output.txt
74     \end{verbatim}
75     or if you tend to make multiple runs with the same executable then
76     running in a new directory each time might be more appropriate:
77     \begin{verbatim}
78     % cd ../
79     % mkdir run1
80     % cp build/mitgcmuv run1/
81     % cp input/* run1/
82     % cd run1
83     % ./mitgcmuv > output.txt
84     \end{verbatim}
85    
86     \subsubsection{Building on a scratch disk}
87    
88     Model object files and output data can use up large amounts of disk
89     space so it is often the case that you will be operating on a large
90     scratch disk. Assuming the model source is in {\em ~/MITgcm} then the
91     following commands will build the model in {\em /scratch/exp2-run1}:
92     \begin{verbatim}
93     % cd /scratch/exp2-run1
94     % ~/MITgcm/tools/genmake2 -rootdir=~/MITgcm \
95     -mods=~/MITgcm/verification/exp2/code
96     % make depend
97     % make
98     \end{verbatim}
99     To run the model here, you'll need the input files:
100     \begin{verbatim}
101     % cp ~/MITgcm/verification/exp2/input/* ./
102     % ./mitgcmuv > output.txt
103     \end{verbatim}
104    
105     As before, you could build in one directory and make multiple runs of
106     the one experiment:
107     \begin{verbatim}
108     % cd /scratch/exp2
109     % mkdir build
110     % cd build
111     % ~/MITgcm/tools/genmake2 -rootdir=~/MITgcm \
112     -mods=~/MITgcm/verification/exp2/code
113     % make depend
114     % make
115     % cd ../
116     % cp -r ~/MITgcm/verification/exp2/input run2
117     % cd run2
118     % ./mitgcmuv > output.txt
119     \end{verbatim}
120    
121    
122     \subsection{Using \texttt{genmake2}}
123     \label{sect:genmake}
124    
125     To compile the code, first use the program \texttt{genmake2} (located
126     in the \texttt{tools} directory) to generate a Makefile.
127     \texttt{genmake2} is a shell script written to work with all
128     ``sh''--compatible shells including bash v1, bash v2, and Bourne.
129     Internally, \texttt{genmake2} determines the locations of needed
130     files, the compiler, compiler options, libraries, and Unix tools. It
131     relies upon a number of ``optfiles'' located in the
132     \texttt{tools/build\_options} directory.
133    
134     The purpose of the optfiles is to provide all the compilation options
135     for particular ``platforms'' (where ``platform'' roughly means the
136     combination of the hardware and the compiler) and code configurations.
137     Given the combinations of possible compilers and library dependencies
138     ({\it eg.} MPI and NetCDF) there may be numerous optfiles available
139     for a single machine. The naming scheme for the majority of the
140     optfiles shipped with the code is
141     \begin{center}
142     {\bf OS\_HARDWARE\_COMPILER }
143     \end{center}
144     where
145     \begin{description}
146     \item[OS] is the name of the operating system (generally the
147     lower-case output of the {\tt 'uname'} command)
148     \item[HARDWARE] is a string that describes the CPU type and
149     corresponds to output from the {\tt 'uname -m'} command:
150     \begin{description}
151     \item[ia32] is for ``x86'' machines such as i386, i486, i586, i686,
152     and athlon
153     \item[ia64] is for Intel IA64 systems (eg. Itanium, Itanium2)
154     \item[amd64] is AMD x86\_64 systems
155     \item[ppc] is for Mac PowerPC systems
156     \end{description}
157     \item[COMPILER] is the compiler name (generally, the name of the
158     FORTRAN executable)
159     \end{description}
160    
161     In many cases, the default optfiles are sufficient and will result in
162     usable Makefiles. However, for some machines or code configurations,
163     new ``optfiles'' must be written. To create a new optfile, it is
164     generally best to start with one of the defaults and modify it to suit
165     your needs. Like \texttt{genmake2}, the optfiles are all written
166     using a simple ``sh''--compatible syntax. While nearly all variables
167     used within \texttt{genmake2} may be specified in the optfiles, the
168     critical ones that should be defined are:
169    
170     \begin{description}
171     \item[FC] the FORTRAN compiler (executable) to use
172     \item[DEFINES] the command-line DEFINE options passed to the compiler
173     \item[CPP] the C pre-processor to use
174     \item[NOOPTFLAGS] options flags for special files that should not be
175     optimized
176     \end{description}
177    
178     For example, the optfile for a typical Red Hat Linux machine (``ia32''
179     architecture) using the GCC (g77) compiler is
180     \begin{verbatim}
181     FC=g77
182     DEFINES='-D_BYTESWAPIO -DWORDLENGTH=4'
183     CPP='cpp -traditional -P'
184     NOOPTFLAGS='-O0'
185     # For IEEE, use the "-ffloat-store" option
186     if test "x$IEEE" = x ; then
187     FFLAGS='-Wimplicit -Wunused -Wuninitialized'
188     FOPTIM='-O3 -malign-double -funroll-loops'
189     else
190     FFLAGS='-Wimplicit -Wunused -ffloat-store'
191     FOPTIM='-O0 -malign-double'
192     fi
193     \end{verbatim}
194    
195     If you write an optfile for an unrepresented machine or compiler, you
196     are strongly encouraged to submit the optfile to the MITgcm project
197     for inclusion. Please send the file to the
198     \begin{rawhtml} <A href="mail-to:MITgcm-support@mitgcm.org"> \end{rawhtml}
199     \begin{center}
200     MITgcm-support@mitgcm.org
201     \end{center}
202     \begin{rawhtml} </A> \end{rawhtml}
203     mailing list.
204    
205     In addition to the optfiles, \texttt{genmake2} supports a number of
206     helpful command-line options. A complete list of these options can be
207     obtained from:
208     \begin{verbatim}
209     % genmake2 -h
210     \end{verbatim}
211    
212     The most important command-line options are:
213     \begin{description}
214    
215     \item[\texttt{--optfile=/PATH/FILENAME}] specifies the optfile that
216     should be used for a particular build.
217    
218     If no "optfile" is specified (either through the command line or the
219     MITGCM\_OPTFILE environment variable), genmake2 will try to make a
220     reasonable guess from the list provided in {\em
221     tools/build\_options}. The method used for making this guess is
222     to first determine the combination of operating system and hardware
223     (eg. "linux\_ia32") and then find a working FORTRAN compiler within
224     the user's path. When these three items have been identified,
225     genmake2 will try to find an optfile that has a matching name.
226    
227     \item[\texttt{--pdefault='PKG1 PKG2 PKG3 ...'}] specifies the default
228     set of packages to be used. The normal order of precedence for
229     packages is as follows:
230     \begin{enumerate}
231     \item If available, the command line (\texttt{--pdefault}) settings
232     over-rule any others.
233    
234     \item Next, \texttt{genmake2} will look for a file named
235     ``\texttt{packages.conf}'' in the local directory or in any of the
236     directories specified with the \texttt{--mods} option.
237    
238     \item Finally, if neither of the above are available,
239     \texttt{genmake2} will use the \texttt{/pkg/pkg\_default} file.
240     \end{enumerate}
241    
242     \item[\texttt{--pdepend=/PATH/FILENAME}] specifies the dependency file
243     used for packages.
244    
245     If not specified, the default dependency file {\em pkg/pkg\_depend}
246     is used. The syntax for this file is parsed on a line-by-line basis
247     where each line containes either a comment ("\#") or a simple
248     "PKGNAME1 (+|-)PKGNAME2" pairwise rule where the "+" or "-" symbol
249     specifies a "must be used with" or a "must not be used with"
250     relationship, respectively. If no rule is specified, then it is
251     assumed that the two packages are compatible and will function
252     either with or without each other.
253    
254     \item[\texttt{--adof=/path/to/file}] specifies the "adjoint" or
255     automatic differentiation options file to be used. The file is
256     analogous to the ``optfile'' defined above but it specifies
257     information for the AD build process.
258    
259     The default file is located in {\em
260     tools/adjoint\_options/adjoint\_default} and it defines the "TAF"
261     and "TAMC" compilers. An alternate version is also available at
262     {\em tools/adjoint\_options/adjoint\_staf} that selects the newer
263     "STAF" compiler. As with any compilers, it is helpful to have their
264     directories listed in your {\tt \$PATH} environment variable.
265    
266     \item[\texttt{--mods='DIR1 DIR2 DIR3 ...'}] specifies a list of
267     directories containing ``modifications''. These directories contain
268     files with names that may (or may not) exist in the main MITgcm
269     source tree but will be overridden by any identically-named sources
270     within the ``MODS'' directories.
271    
272     The order of precedence for this "name-hiding" is as follows:
273     \begin{itemize}
274     \item ``MODS'' directories (in the order given)
275     \item Packages either explicitly specified or provided by default
276     (in the order given)
277     \item Packages included due to package dependencies (in the order
278     that that package dependencies are parsed)
279     \item The "standard dirs" (which may have been specified by the
280     ``-standarddirs'' option)
281     \end{itemize}
282    
283     \item[\texttt{--mpi}] This option enables certain MPI features (using
284     CPP \texttt{\#define}s) within the code and is necessary for MPI
285     builds (see Section \ref{sect:mpi-build}).
286    
287     \item[\texttt{--make=/path/to/gmake}] Due to the poor handling of
288     soft-links and other bugs common with the \texttt{make} versions
289     provided by commercial Unix vendors, GNU \texttt{make} (sometimes
290     called \texttt{gmake}) should be preferred. This option provides a
291     means for specifying the make executable to be used.
292    
293     \item[\texttt{--bash=/path/to/sh}] On some (usually older UNIX)
294     machines, the ``bash'' shell is unavailable. To run on these
295     systems, \texttt{genmake2} can be invoked using an ``sh'' (that is,
296     a Bourne, POSIX, or compatible) shell. The syntax in these
297     circumstances is:
298     \begin{center}
299     \texttt{\% /bin/sh genmake2 -bash=/bin/sh [...options...]}
300     \end{center}
301     where \texttt{/bin/sh} can be replaced with the full path and name
302     of the desired shell.
303    
304     \end{description}
305    
306    
307     \subsection{Building with MPI}
308     \label{sect:mpi-build}
309    
310     Building MITgcm to use MPI libraries can be complicated due to the
311     variety of different MPI implementations available, their dependencies
312     or interactions with different compilers, and their often ad-hoc
313     locations within file systems. For these reasons, its generally a
314     good idea to start by finding and reading the documentation for your
315     machine(s) and, if necessary, seeking help from your local systems
316     administrator.
317    
318     The steps for building MITgcm with MPI support are:
319     \begin{enumerate}
320    
321     \item Determine the locations of your MPI-enabled compiler and/or MPI
322     libraries and put them into an options file as described in Section
323     \ref{sect:genmake}. One can start with one of the examples in:
324     \begin{rawhtml} <A
325     href="http://mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/tools/build_options/">
326     \end{rawhtml}
327     \begin{center}
328     \texttt{MITgcm/tools/build\_options/}
329     \end{center}
330     \begin{rawhtml} </A> \end{rawhtml}
331     such as \texttt{linux\_ia32\_g77+mpi\_cg01} or
332     \texttt{linux\_ia64\_efc+mpi} and then edit it to suit the machine at
333     hand. You may need help from your user guide or local systems
334     administrator to determine the exact location of the MPI libraries.
335     If libraries are not installed, MPI implementations and related
336     tools are available including:
337     \begin{itemize}
338     \item \begin{rawhtml} <A
339     href="http://www-unix.mcs.anl.gov/mpi/mpich/">
340     \end{rawhtml}
341     MPICH
342     \begin{rawhtml} </A> \end{rawhtml}
343    
344     \item \begin{rawhtml} <A
345     href="http://www.lam-mpi.org/">
346     \end{rawhtml}
347     LAM/MPI
348     \begin{rawhtml} </A> \end{rawhtml}
349    
350     \item \begin{rawhtml} <A
351     href="http://www.osc.edu/~pw/mpiexec/">
352     \end{rawhtml}
353     MPIexec
354     \begin{rawhtml} </A> \end{rawhtml}
355     \end{itemize}
356    
357     \item Build the code with the \texttt{genmake2} \texttt{-mpi} option
358     (see Section \ref{sect:genmake}) using commands such as:
359     {\footnotesize \begin{verbatim}
360     % ../../../tools/genmake2 -mods=../code -mpi -of=YOUR_OPTFILE
361     % make depend
362     % make
363     \end{verbatim} }
364    
365     \item Run the code with the appropriate MPI ``run'' or ``exec''
366     program provided with your particular implementation of MPI.
367     Typical MPI packages such as MPICH will use something like:
368     \begin{verbatim}
369     % mpirun -np 4 -machinefile mf ./mitgcmuv
370     \end{verbatim}
371     Sightly more complicated scripts may be needed for many machines
372     since execution of the code may be controlled by both the MPI
373     library and a job scheduling and queueing system such as PBS,
374     LoadLeveller, Condor, or any of a number of similar tools. A few
375     example scripts (those used for our \begin{rawhtml} <A
376     href="http://mitgcm.org/testing.html"> \end{rawhtml}regular
377     verification runs\begin{rawhtml} </A> \end{rawhtml}) are available
378     at:
379     \begin{rawhtml} <A
380     href="http://mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm_contrib/test_scripts/">
381     \end{rawhtml}
382     {\footnotesize \tt
383     http://mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm\_contrib/test\_scripts/ }
384     \begin{rawhtml} </A> \end{rawhtml}
385    
386     \end{enumerate}
387    
388     An example of the above process on the MITgcm cluster (``cg01'') using
389     the GNU g77 compiler and the mpich MPI library is:
390    
391     {\footnotesize \begin{verbatim}
392     % cd MITgcm/verification/exp5
393     % mkdir build
394     % cd build
395     % ../../../tools/genmake2 -mpi -mods=../code \
396     -of=../../../tools/build_options/linux_ia32_g77+mpi_cg01
397     % make depend
398     % make
399     % cd ../input
400     % /usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/g77/bin/mpirun.ch_gm \
401     -machinefile mf --gm-kill 5 -v -np 2 ../build/mitgcmuv
402     \end{verbatim} }
403    
404 cnh 1.1 \subsection{Configuration and setup}
405    
406     The CPP keys relative to the ``numerical model'' part of the code are
407     all defined and set in the file \textit{CPP\_OPTIONS.h }in the
408     directory \textit{ model/inc }or in one of the \textit{code
409     }directories of the case study experiments under
410     \textit{verification.} The model parameters are defined and declared
411     in the file \textit{model/inc/PARAMS.h }and their default values are
412     set in the routine \textit{model/src/set\_defaults.F. }The default
413     values can be modified in the namelist file \textit{data }which needs
414     to be located in the directory where you will run the model. The
415     parameters are initialized in the routine
416     \textit{model/src/ini\_parms.F}. Look at this routine to see in what
417     part of the namelist the parameters are located.
418    
419     In what follows the parameters are grouped into categories related to
420     the computational domain, the equations solved in the model, and the
421     simulation controls.
422    
423     \subsection{Computational domain, geometry and time-discretization}
424    
425     \begin{description}
426     \item[dimensions] \
427    
428     The number of points in the x, y, and r directions are represented
429     by the variables \textbf{sNx}, \textbf{sNy} and \textbf{Nr}
430     respectively which are declared and set in the file
431     \textit{model/inc/SIZE.h}. (Again, this assumes a mono-processor
432     calculation. For multiprocessor calculations see the section on
433     parallel implementation.)
434    
435     \item[grid] \
436    
437     Three different grids are available: cartesian, spherical polar, and
438     curvilinear (which includes the cubed sphere). The grid is set
439     through the logical variables \textbf{usingCartesianGrid},
440     \textbf{usingSphericalPolarGrid}, and \textbf{usingCurvilinearGrid}.
441     In the case of spherical and curvilinear grids, the southern
442     boundary is defined through the variable \textbf{phiMin} which
443     corresponds to the latitude of the southern most cell face (in
444     degrees). The resolution along the x and y directions is controlled
445     by the 1D arrays \textbf{delx} and \textbf{dely} (in meters in the
446     case of a cartesian grid, in degrees otherwise). The vertical grid
447     spacing is set through the 1D array \textbf{delz} for the ocean (in
448     meters) or \textbf{delp} for the atmosphere (in Pa). The variable
449     \textbf{Ro\_SeaLevel} represents the standard position of Sea-Level
450     in ``R'' coordinate. This is typically set to 0m for the ocean
451     (default value) and 10$^{5}$Pa for the atmosphere. For the
452     atmosphere, also set the logical variable \textbf{groundAtK1} to
453     \texttt{'.TRUE.'} which puts the first level (k=1) at the lower
454     boundary (ground).
455    
456     For the cartesian grid case, the Coriolis parameter $f$ is set
457     through the variables \textbf{f0} and \textbf{beta} which correspond
458     to the reference Coriolis parameter (in s$^{-1}$) and
459     $\frac{\partial f}{ \partial y}$(in m$^{-1}$s$^{-1}$) respectively.
460     If \textbf{beta } is set to a nonzero value, \textbf{f0} is the
461     value of $f$ at the southern edge of the domain.
462    
463     \item[topography - full and partial cells] \
464    
465     The domain bathymetry is read from a file that contains a 2D (x,y)
466     map of depths (in m) for the ocean or pressures (in Pa) for the
467     atmosphere. The file name is represented by the variable
468     \textbf{bathyFile}. The file is assumed to contain binary numbers
469     giving the depth (pressure) of the model at each grid cell, ordered
470     with the x coordinate varying fastest. The points are ordered from
471     low coordinate to high coordinate for both axes. The model code
472     applies without modification to enclosed, periodic, and double
473     periodic domains. Periodicity is assumed by default and is
474     suppressed by setting the depths to 0m for the cells at the limits
475     of the computational domain (note: not sure this is the case for the
476     atmosphere). The precision with which to read the binary data is
477     controlled by the integer variable \textbf{readBinaryPrec} which can
478     take the value \texttt{32} (single precision) or \texttt{64} (double
479     precision). See the matlab program \textit{gendata.m} in the
480     \textit{input} directories under \textit{verification} to see how
481     the bathymetry files are generated for the case study experiments.
482    
483     To use the partial cell capability, the variable \textbf{hFacMin}
484     needs to be set to a value between 0 and 1 (it is set to 1 by
485     default) corresponding to the minimum fractional size of the cell.
486     For example if the bottom cell is 500m thick and \textbf{hFacMin} is
487     set to 0.1, the actual thickness of the cell (i.e. used in the code)
488     can cover a range of discrete values 50m apart from 50m to 500m
489     depending on the value of the bottom depth (in \textbf{bathyFile})
490     at this point.
491    
492     Note that the bottom depths (or pressures) need not coincide with
493     the models levels as deduced from \textbf{delz} or \textbf{delp}.
494     The model will interpolate the numbers in \textbf{bathyFile} so that
495     they match the levels obtained from \textbf{delz} or \textbf{delp}
496     and \textbf{hFacMin}.
497    
498     (Note: the atmospheric case is a bit more complicated than what is
499     written here I think. To come soon...)
500    
501     \item[time-discretization] \
502    
503     The time steps are set through the real variables \textbf{deltaTMom}
504     and \textbf{deltaTtracer} (in s) which represent the time step for
505     the momentum and tracer equations, respectively. For synchronous
506     integrations, simply set the two variables to the same value (or you
507     can prescribe one time step only through the variable
508     \textbf{deltaT}). The Adams-Bashforth stabilizing parameter is set
509     through the variable \textbf{abEps} (dimensionless). The stagger
510     baroclinic time stepping can be activated by setting the logical
511     variable \textbf{staggerTimeStep} to \texttt{'.TRUE.'}.
512    
513     \end{description}
514    
515    
516     \subsection{Equation of state}
517    
518     First, because the model equations are written in terms of
519     perturbations, a reference thermodynamic state needs to be specified.
520     This is done through the 1D arrays \textbf{tRef} and \textbf{sRef}.
521     \textbf{tRef} specifies the reference potential temperature profile
522     (in $^{o}$C for the ocean and $^{o}$K for the atmosphere) starting
523     from the level k=1. Similarly, \textbf{sRef} specifies the reference
524     salinity profile (in ppt) for the ocean or the reference specific
525     humidity profile (in g/kg) for the atmosphere.
526    
527     The form of the equation of state is controlled by the character
528     variables \textbf{buoyancyRelation} and \textbf{eosType}.
529     \textbf{buoyancyRelation} is set to \texttt{'OCEANIC'} by default and
530     needs to be set to \texttt{'ATMOSPHERIC'} for atmosphere simulations.
531     In this case, \textbf{eosType} must be set to \texttt{'IDEALGAS'}.
532     For the ocean, two forms of the equation of state are available:
533     linear (set \textbf{eosType} to \texttt{'LINEAR'}) and a polynomial
534     approximation to the full nonlinear equation ( set \textbf{eosType} to
535     \texttt{'POLYNOMIAL'}). In the linear case, you need to specify the
536     thermal and haline expansion coefficients represented by the variables
537     \textbf{tAlpha} (in K$^{-1}$) and \textbf{sBeta} (in ppt$^{-1}$). For
538     the nonlinear case, you need to generate a file of polynomial
539     coefficients called \textit{POLY3.COEFFS}. To do this, use the program
540     \textit{utils/knudsen2/knudsen2.f} under the model tree (a Makefile is
541     available in the same directory and you will need to edit the number
542     and the values of the vertical levels in \textit{knudsen2.f} so that
543     they match those of your configuration).
544    
545     There there are also higher polynomials for the equation of state:
546     \begin{description}
547     \item[\texttt{'UNESCO'}:] The UNESCO equation of state formula of
548     Fofonoff and Millard \cite{fofonoff83}. This equation of state
549     assumes in-situ temperature, which is not a model variable; {\em its
550     use is therefore discouraged, and it is only listed for
551     completeness}.
552     \item[\texttt{'JMD95Z'}:] A modified UNESCO formula by Jackett and
553     McDougall \cite{jackett95}, which uses the model variable potential
554     temperature as input. The \texttt{'Z'} indicates that this equation
555     of state uses a horizontally and temporally constant pressure
556     $p_{0}=-g\rho_{0}z$.
557     \item[\texttt{'JMD95P'}:] A modified UNESCO formula by Jackett and
558     McDougall \cite{jackett95}, which uses the model variable potential
559     temperature as input. The \texttt{'P'} indicates that this equation
560     of state uses the actual hydrostatic pressure of the last time
561     step. Lagging the pressure in this way requires an additional pickup
562     file for restarts.
563     \item[\texttt{'MDJWF'}:] The new, more accurate and less expensive
564     equation of state by McDougall et~al. \cite{mcdougall03}. It also
565     requires lagging the pressure and therefore an additional pickup
566     file for restarts.
567     \end{description}
568     For none of these options an reference profile of temperature or
569     salinity is required.
570    
571     \subsection{Momentum equations}
572    
573     In this section, we only focus for now on the parameters that you are
574     likely to change, i.e. the ones relative to forcing and dissipation
575     for example. The details relevant to the vector-invariant form of the
576     equations and the various advection schemes are not covered for the
577     moment. We assume that you use the standard form of the momentum
578     equations (i.e. the flux-form) with the default advection scheme.
579     Also, there are a few logical variables that allow you to turn on/off
580     various terms in the momentum equation. These variables are called
581     \textbf{momViscosity, momAdvection, momForcing, useCoriolis,
582     momPressureForcing, momStepping} and \textbf{metricTerms }and are
583     assumed to be set to \texttt{'.TRUE.'} here. Look at the file
584     \textit{model/inc/PARAMS.h }for a precise definition of these
585     variables.
586    
587     \begin{description}
588     \item[initialization] \
589    
590     The velocity components are initialized to 0 unless the simulation
591     is starting from a pickup file (see section on simulation control
592     parameters).
593    
594     \item[forcing] \
595    
596     This section only applies to the ocean. You need to generate
597     wind-stress data into two files \textbf{zonalWindFile} and
598     \textbf{meridWindFile} corresponding to the zonal and meridional
599     components of the wind stress, respectively (if you want the stress
600     to be along the direction of only one of the model horizontal axes,
601     you only need to generate one file). The format of the files is
602     similar to the bathymetry file. The zonal (meridional) stress data
603     are assumed to be in Pa and located at U-points (V-points). As for
604     the bathymetry, the precision with which to read the binary data is
605     controlled by the variable \textbf{readBinaryPrec}. See the matlab
606     program \textit{gendata.m} in the \textit{input} directories under
607     \textit{verification} to see how simple analytical wind forcing data
608     are generated for the case study experiments.
609    
610     There is also the possibility of prescribing time-dependent periodic
611     forcing. To do this, concatenate the successive time records into a
612     single file (for each stress component) ordered in a (x,y,t) fashion
613     and set the following variables: \textbf{periodicExternalForcing }to
614     \texttt{'.TRUE.'}, \textbf{externForcingPeriod }to the period (in s)
615     of which the forcing varies (typically 1 month), and
616     \textbf{externForcingCycle} to the repeat time (in s) of the forcing
617     (typically 1 year -- note: \textbf{ externForcingCycle} must be a
618     multiple of \textbf{externForcingPeriod}). With these variables set
619     up, the model will interpolate the forcing linearly at each
620     iteration.
621    
622     \item[dissipation] \
623    
624     The lateral eddy viscosity coefficient is specified through the
625     variable \textbf{viscAh} (in m$^{2}$s$^{-1}$). The vertical eddy
626     viscosity coefficient is specified through the variable
627     \textbf{viscAz} (in m$^{2}$s$^{-1}$) for the ocean and
628     \textbf{viscAp} (in Pa$^{2}$s$^{-1}$) for the atmosphere. The
629     vertical diffusive fluxes can be computed implicitly by setting the
630     logical variable \textbf{implicitViscosity }to \texttt{'.TRUE.'}.
631     In addition, biharmonic mixing can be added as well through the
632     variable \textbf{viscA4} (in m$^{4}$s$^{-1}$). On a spherical polar
633     grid, you might also need to set the variable \textbf{cosPower}
634     which is set to 0 by default and which represents the power of
635     cosine of latitude to multiply viscosity. Slip or no-slip conditions
636     at lateral and bottom boundaries are specified through the logical
637     variables \textbf{no\_slip\_sides} and \textbf{no\_slip\_bottom}. If
638     set to \texttt{'.FALSE.'}, free-slip boundary conditions are
639     applied. If no-slip boundary conditions are applied at the bottom, a
640     bottom drag can be applied as well. Two forms are available: linear
641 jmc 1.5 (set the variable \textbf{bottomDragLinear} in m/s) and
642     quadratic (set the variable \textbf{bottomDragQuadratic}, dimensionless).
643 cnh 1.1
644     The Fourier and Shapiro filters are described elsewhere.
645    
646     \item[C-D scheme] \
647    
648     If you run at a sufficiently coarse resolution, you will need the
649     C-D scheme for the computation of the Coriolis terms. The
650     variable\textbf{\ tauCD}, which represents the C-D scheme coupling
651     timescale (in s) needs to be set.
652    
653     \item[calculation of pressure/geopotential] \
654    
655     First, to run a non-hydrostatic ocean simulation, set the logical
656     variable \textbf{nonHydrostatic} to \texttt{'.TRUE.'}. The pressure
657     field is then inverted through a 3D elliptic equation. (Note: this
658     capability is not available for the atmosphere yet.) By default, a
659     hydrostatic simulation is assumed and a 2D elliptic equation is used
660     to invert the pressure field. The parameters controlling the
661     behaviour of the elliptic solvers are the variables
662     \textbf{cg2dMaxIters} and \textbf{cg2dTargetResidual } for
663     the 2D case and \textbf{cg3dMaxIters} and
664     \textbf{cg3dTargetResidual} for the 3D case. You probably won't need to
665     alter the default values (are we sure of this?).
666    
667     For the calculation of the surface pressure (for the ocean) or
668     surface geopotential (for the atmosphere) you need to set the
669     logical variables \textbf{rigidLid} and \textbf{implicitFreeSurface}
670     (set one to \texttt{'.TRUE.'} and the other to \texttt{'.FALSE.'}
671     depending on how you want to deal with the ocean upper or atmosphere
672     lower boundary).
673    
674     \end{description}
675    
676     \subsection{Tracer equations}
677    
678     This section covers the tracer equations i.e. the potential
679     temperature equation and the salinity (for the ocean) or specific
680     humidity (for the atmosphere) equation. As for the momentum equations,
681     we only describe for now the parameters that you are likely to change.
682     The logical variables \textbf{tempDiffusion} \textbf{tempAdvection}
683     \textbf{tempForcing}, and \textbf{tempStepping} allow you to turn
684     on/off terms in the temperature equation (same thing for salinity or
685     specific humidity with variables \textbf{saltDiffusion},
686     \textbf{saltAdvection} etc.). These variables are all assumed here to
687     be set to \texttt{'.TRUE.'}. Look at file \textit{model/inc/PARAMS.h}
688     for a precise definition.
689    
690     \begin{description}
691     \item[initialization] \
692    
693     The initial tracer data can be contained in the binary files
694     \textbf{hydrogThetaFile} and \textbf{hydrogSaltFile}. These files
695     should contain 3D data ordered in an (x,y,r) fashion with k=1 as the
696     first vertical level. If no file names are provided, the tracers
697     are then initialized with the values of \textbf{tRef} and
698     \textbf{sRef} mentioned above (in the equation of state section). In
699     this case, the initial tracer data are uniform in x and y for each
700     depth level.
701    
702     \item[forcing] \
703    
704     This part is more relevant for the ocean, the procedure for the
705     atmosphere not being completely stabilized at the moment.
706    
707     A combination of fluxes data and relaxation terms can be used for
708     driving the tracer equations. For potential temperature, heat flux
709     data (in W/m$ ^{2}$) can be stored in the 2D binary file
710     \textbf{surfQfile}. Alternatively or in addition, the forcing can
711     be specified through a relaxation term. The SST data to which the
712     model surface temperatures are restored to are supposed to be stored
713     in the 2D binary file \textbf{thetaClimFile}. The corresponding
714     relaxation time scale coefficient is set through the variable
715     \textbf{tauThetaClimRelax} (in s). The same procedure applies for
716     salinity with the variable names \textbf{EmPmRfile},
717     \textbf{saltClimFile}, and \textbf{tauSaltClimRelax} for freshwater
718     flux (in m/s) and surface salinity (in ppt) data files and
719     relaxation time scale coefficient (in s), respectively. Also for
720     salinity, if the CPP key \textbf{USE\_NATURAL\_BCS} is turned on,
721     natural boundary conditions are applied i.e. when computing the
722     surface salinity tendency, the freshwater flux is multiplied by the
723     model surface salinity instead of a constant salinity value.
724    
725     As for the other input files, the precision with which to read the
726     data is controlled by the variable \textbf{readBinaryPrec}.
727     Time-dependent, periodic forcing can be applied as well following
728     the same procedure used for the wind forcing data (see above).
729    
730     \item[dissipation] \
731    
732     Lateral eddy diffusivities for temperature and salinity/specific
733     humidity are specified through the variables \textbf{diffKhT} and
734     \textbf{diffKhS} (in m$^{2}$/s). Vertical eddy diffusivities are
735     specified through the variables \textbf{diffKzT} and
736     \textbf{diffKzS} (in m$^{2}$/s) for the ocean and \textbf{diffKpT
737     }and \textbf{diffKpS} (in Pa$^{2}$/s) for the atmosphere. The
738     vertical diffusive fluxes can be computed implicitly by setting the
739     logical variable \textbf{implicitDiffusion} to \texttt{'.TRUE.'}.
740     In addition, biharmonic diffusivities can be specified as well
741     through the coefficients \textbf{diffK4T} and \textbf{diffK4S} (in
742     m$^{4}$/s). Note that the cosine power scaling (specified through
743     \textbf{cosPower}---see the momentum equations section) is applied to
744     the tracer diffusivities (Laplacian and biharmonic) as well. The
745     Gent and McWilliams parameterization for oceanic tracers is
746     described in the package section. Finally, note that tracers can be
747     also subject to Fourier and Shapiro filtering (see the corresponding
748     section on these filters).
749    
750     \item[ocean convection] \
751    
752     Two options are available to parameterize ocean convection: one is
753     to use the convective adjustment scheme. In this case, you need to
754     set the variable \textbf{cadjFreq}, which represents the frequency
755     (in s) with which the adjustment algorithm is called, to a non-zero
756     value (if set to a negative value by the user, the model will set it
757     to the tracer time step). The other option is to parameterize
758     convection with implicit vertical diffusion. To do this, set the
759     logical variable \textbf{implicitDiffusion} to \texttt{'.TRUE.'}
760     and the real variable \textbf{ivdc\_kappa} to a value (in m$^{2}$/s)
761     you wish the tracer vertical diffusivities to have when mixing
762     tracers vertically due to static instabilities. Note that
763     \textbf{cadjFreq} and \textbf{ivdc\_kappa}can not both have non-zero
764     value.
765    
766     \end{description}
767    
768     \subsection{Simulation controls}
769    
770     The model ''clock'' is defined by the variable \textbf{deltaTClock}
771     (in s) which determines the IO frequencies and is used in tagging
772     output. Typically, you will set it to the tracer time step for
773     accelerated runs (otherwise it is simply set to the default time step
774     \textbf{deltaT}). Frequency of checkpointing and dumping of the model
775     state are referenced to this clock (see below).
776    
777     \begin{description}
778     \item[run duration] \
779    
780     The beginning of a simulation is set by specifying a start time (in
781     s) through the real variable \textbf{startTime} or by specifying an
782     initial iteration number through the integer variable
783     \textbf{nIter0}. If these variables are set to nonzero values, the
784     model will look for a ''pickup'' file \textit{pickup.0000nIter0} to
785     restart the integration. The end of a simulation is set through the
786     real variable \textbf{endTime} (in s). Alternatively, you can
787     specify instead the number of time steps to execute through the
788     integer variable \textbf{nTimeSteps}.
789    
790     \item[frequency of output] \
791    
792     Real variables defining frequencies (in s) with which output files
793     are written on disk need to be set up. \textbf{dumpFreq} controls
794     the frequency with which the instantaneous state of the model is
795     saved. \textbf{chkPtFreq} and \textbf{pchkPtFreq} control the output
796     frequency of rolling and permanent checkpoint files, respectively.
797     See section 1.5.1 Output files for the definition of model state and
798     checkpoint files. In addition, time-averaged fields can be written
799     out by setting the variable \textbf{taveFreq} (in s). The precision
800     with which to write the binary data is controlled by the integer
801     variable w\textbf{riteBinaryPrec} (set it to \texttt{32} or
802     \texttt{64}).
803    
804     \end{description}
805    
806    
807     %%% Local Variables:
808     %%% mode: latex
809     %%% TeX-master: t
810     %%% End:

  ViewVC Help
Powered by ViewVC 1.1.22