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