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

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

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


Revision 1.3 - (show annotations) (download) (as text)
Sat Oct 16 03:40:13 2004 UTC (20 years, 9 months ago) by edhill
Branch: MAIN
CVS Tags: checkpoint57l_post
Changes since 1.2: +3 -0 lines
File MIME type: application/x-tex
 o add HTML comments as a step towards "URL permanence" which will help
   solve:
   - stale links from the CMI web site
   - rotten indexing by bonniefy.pl
 o also cleanup a merge-mangle in diagnostics.tex

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