/[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.2 - (show annotations) (download) (as text)
Thu Oct 14 14:54:24 2004 UTC (20 years, 9 months ago) by cnh
Branch: MAIN
Changes since 1.1: +388 -0 lines
File MIME type: application/x-tex
More text moving to put advanced pieces after examples

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

  ViewVC Help
Powered by ViewVC 1.1.22