1 |
\section[Customizing MITgcm]{Doing it yourself: customizing the model configuration} |
2 |
\label{sect:customize} |
3 |
\begin{rawhtml} |
4 |
<!-- CMIREDIR:customizing_mitgcm: --> |
5 |
\end{rawhtml} |
6 |
|
7 |
When you are ready to run the model in the configuration you want, the |
8 |
easiest thing is to use and adapt the setup of the case studies |
9 |
experiment (described previously) that is the closest to your |
10 |
configuration. Then, the amount of setup will be minimized. In this |
11 |
section, we focus on the setup relative to the ``numerical model'' |
12 |
part of the code (the setup relative to the ``execution environment'' |
13 |
part is covered in the parallel implementation section) and on the |
14 |
variables and parameters that you are likely to change. |
15 |
|
16 |
The CPP keys relative to the ``numerical model'' part of the code are |
17 |
all defined and set in the file \textit{CPP\_OPTIONS.h }in the |
18 |
directory \textit{ model/inc }or in one of the \textit{code |
19 |
}directories of the case study experiments under |
20 |
\textit{verification.} The model parameters are defined and declared |
21 |
in the file \textit{model/inc/PARAMS.h }and their default values are |
22 |
set in the routine \textit{model/src/set\_defaults.F. }The default |
23 |
values can be modified in the namelist file \textit{data }which needs |
24 |
to be located in the directory where you will run the model. The |
25 |
parameters are initialized in the routine |
26 |
\textit{model/src/ini\_parms.F}. Look at this routine to see in what |
27 |
part of the namelist the parameters are located. Here is a complete list |
28 |
of the model parameters related to the main model (namelist parameters |
29 |
for the packages are located in the package descriptions), their meaning, |
30 |
and their default values: |
31 |
|
32 |
{\footnotesize \begin{verbatim} |
33 |
|
34 |
\end{verbatim} } |
35 |
|
36 |
In what follows the parameters are grouped into categories related to |
37 |
the computational domain, the equations solved in the model, and the |
38 |
simulation controls. |
39 |
|
40 |
\subsection{Parameters: Computational domain, geometry and time-discretization} |
41 |
|
42 |
\begin{description} |
43 |
\item[dimensions] \ |
44 |
|
45 |
The number of points in the x, y, and r directions are represented |
46 |
by the variables \textbf{sNx}, \textbf{sNy} and \textbf{Nr} |
47 |
respectively which are declared and set in the file |
48 |
\textit{model/inc/SIZE.h}. (Again, this assumes a mono-processor |
49 |
calculation. For multiprocessor calculations see the section on |
50 |
parallel implementation.) |
51 |
|
52 |
\item[grid] \ |
53 |
|
54 |
Three different grids are available: cartesian, spherical polar, and |
55 |
curvilinear (which includes the cubed sphere). The grid is set |
56 |
through the logical variables \textbf{usingCartesianGrid}, |
57 |
\textbf{usingSphericalPolarGrid}, and \textbf{usingCurvilinearGrid}. |
58 |
In the case of spherical and curvilinear grids, the southern |
59 |
boundary is defined through the variable \textbf{phiMin} which |
60 |
corresponds to the latitude of the southern most cell face (in |
61 |
degrees). The resolution along the x and y directions is controlled |
62 |
by the 1D arrays \textbf{delx} and \textbf{dely} (in meters in the |
63 |
case of a cartesian grid, in degrees otherwise). The vertical grid |
64 |
spacing is set through the 1D array \textbf{delz} for the ocean (in |
65 |
meters) or \textbf{delp} for the atmosphere (in Pa). The variable |
66 |
\textbf{Ro\_SeaLevel} represents the standard position of Sea-Level |
67 |
in ``R'' coordinate. This is typically set to 0m for the ocean |
68 |
(default value) and 10$^{5}$Pa for the atmosphere. For the |
69 |
atmosphere, also set the logical variable \textbf{groundAtK1} to |
70 |
\texttt{'.TRUE.'} which puts the first level (k=1) at the lower |
71 |
boundary (ground). |
72 |
|
73 |
For the cartesian grid case, the Coriolis parameter $f$ is set |
74 |
through the variables \textbf{f0} and \textbf{beta} which correspond |
75 |
to the reference Coriolis parameter (in s$^{-1}$) and |
76 |
$\frac{\partial f}{ \partial y}$(in m$^{-1}$s$^{-1}$) respectively. |
77 |
If \textbf{beta } is set to a nonzero value, \textbf{f0} is the |
78 |
value of $f$ at the southern edge of the domain. |
79 |
|
80 |
\item[topography - full and partial cells] \ |
81 |
|
82 |
The domain bathymetry is read from a file that contains a 2D (x,y) |
83 |
map of depths (in m) for the ocean or pressures (in Pa) for the |
84 |
atmosphere. The file name is represented by the variable |
85 |
\textbf{bathyFile}. The file is assumed to contain binary numbers |
86 |
giving the depth (pressure) of the model at each grid cell, ordered |
87 |
with the x coordinate varying fastest. The points are ordered from |
88 |
low coordinate to high coordinate for both axes. The model code |
89 |
applies without modification to enclosed, periodic, and double |
90 |
periodic domains. Periodicity is assumed by default and is |
91 |
suppressed by setting the depths to 0m for the cells at the limits |
92 |
of the computational domain (note: not sure this is the case for the |
93 |
atmosphere). The precision with which to read the binary data is |
94 |
controlled by the integer variable \textbf{readBinaryPrec} which can |
95 |
take the value \texttt{32} (single precision) or \texttt{64} (double |
96 |
precision). See the matlab program \textit{gendata.m} in the |
97 |
\textit{input} directories under \textit{verification} to see how |
98 |
the bathymetry files are generated for the case study experiments. |
99 |
|
100 |
To use the partial cell capability, the variable \textbf{hFacMin} |
101 |
needs to be set to a value between 0 and 1 (it is set to 1 by |
102 |
default) corresponding to the minimum fractional size of the cell. |
103 |
For example if the bottom cell is 500m thick and \textbf{hFacMin} is |
104 |
set to 0.1, the actual thickness of the cell (i.e. used in the code) |
105 |
can cover a range of discrete values 50m apart from 50m to 500m |
106 |
depending on the value of the bottom depth (in \textbf{bathyFile}) |
107 |
at this point. |
108 |
|
109 |
Note that the bottom depths (or pressures) need not coincide with |
110 |
the models levels as deduced from \textbf{delz} or \textbf{delp}. |
111 |
The model will interpolate the numbers in \textbf{bathyFile} so that |
112 |
they match the levels obtained from \textbf{delz} or \textbf{delp} |
113 |
and \textbf{hFacMin}. |
114 |
|
115 |
(Note: the atmospheric case is a bit more complicated than what is |
116 |
written here I think. To come soon...) |
117 |
|
118 |
\item[time-discretization] \ |
119 |
|
120 |
The time steps are set through the real variables \textbf{deltaTMom} |
121 |
and \textbf{deltaTtracer} (in s) which represent the time step for |
122 |
the momentum and tracer equations, respectively. For synchronous |
123 |
integrations, simply set the two variables to the same value (or you |
124 |
can prescribe one time step only through the variable |
125 |
\textbf{deltaT}). The Adams-Bashforth stabilizing parameter is set |
126 |
through the variable \textbf{abEps} (dimensionless). The stagger |
127 |
baroclinic time stepping can be activated by setting the logical |
128 |
variable \textbf{staggerTimeStep} to \texttt{'.TRUE.'}. |
129 |
|
130 |
\end{description} |
131 |
|
132 |
|
133 |
\subsection{Parameters: Equation of state} |
134 |
|
135 |
First, because the model equations are written in terms of |
136 |
perturbations, a reference thermodynamic state needs to be specified. |
137 |
This is done through the 1D arrays \textbf{tRef} and \textbf{sRef}. |
138 |
\textbf{tRef} specifies the reference potential temperature profile |
139 |
(in $^{o}$C for the ocean and $^{o}$K for the atmosphere) starting |
140 |
from the level k=1. Similarly, \textbf{sRef} specifies the reference |
141 |
salinity profile (in ppt) for the ocean or the reference specific |
142 |
humidity profile (in g/kg) for the atmosphere. |
143 |
|
144 |
The form of the equation of state is controlled by the character |
145 |
variables \textbf{buoyancyRelation} and \textbf{eosType}. |
146 |
\textbf{buoyancyRelation} is set to \texttt{'OCEANIC'} by default and |
147 |
needs to be set to \texttt{'ATMOSPHERIC'} for atmosphere simulations. |
148 |
In this case, \textbf{eosType} must be set to \texttt{'IDEALGAS'}. |
149 |
For the ocean, two forms of the equation of state are available: |
150 |
linear (set \textbf{eosType} to \texttt{'LINEAR'}) and a polynomial |
151 |
approximation to the full nonlinear equation ( set \textbf{eosType} to |
152 |
\texttt{'POLYNOMIAL'}). In the linear case, you need to specify the |
153 |
thermal and haline expansion coefficients represented by the variables |
154 |
\textbf{tAlpha} (in K$^{-1}$) and \textbf{sBeta} (in ppt$^{-1}$). For |
155 |
the nonlinear case, you need to generate a file of polynomial |
156 |
coefficients called \textit{POLY3.COEFFS}. To do this, use the program |
157 |
\textit{utils/knudsen2/knudsen2.f} under the model tree (a Makefile is |
158 |
available in the same directory and you will need to edit the number |
159 |
and the values of the vertical levels in \textit{knudsen2.f} so that |
160 |
they match those of your configuration). |
161 |
|
162 |
There there are also higher polynomials for the equation of state: |
163 |
\begin{description} |
164 |
\item[\texttt{'UNESCO'}:] The UNESCO equation of state formula of |
165 |
Fofonoff and Millard \cite{fofonoff83}. This equation of state |
166 |
assumes in-situ temperature, which is not a model variable; {\em its |
167 |
use is therefore discouraged, and it is only listed for |
168 |
completeness}. |
169 |
\item[\texttt{'JMD95Z'}:] A modified UNESCO formula by Jackett and |
170 |
McDougall \cite{jackett95}, which uses the model variable potential |
171 |
temperature as input. The \texttt{'Z'} indicates that this equation |
172 |
of state uses a horizontally and temporally constant pressure |
173 |
$p_{0}=-g\rho_{0}z$. |
174 |
\item[\texttt{'JMD95P'}:] A modified UNESCO formula by Jackett and |
175 |
McDougall \cite{jackett95}, which uses the model variable potential |
176 |
temperature as input. The \texttt{'P'} indicates that this equation |
177 |
of state uses the actual hydrostatic pressure of the last time |
178 |
step. Lagging the pressure in this way requires an additional pickup |
179 |
file for restarts. |
180 |
\item[\texttt{'MDJWF'}:] The new, more accurate and less expensive |
181 |
equation of state by McDougall et~al. \cite{mcdougall03}. It also |
182 |
requires lagging the pressure and therefore an additional pickup |
183 |
file for restarts. |
184 |
\end{description} |
185 |
For none of these options an reference profile of temperature or |
186 |
salinity is required. |
187 |
|
188 |
\subsection{Parameters: Momentum equations} |
189 |
|
190 |
In this section, we only focus for now on the parameters that you are |
191 |
likely to change, i.e. the ones relative to forcing and dissipation |
192 |
for example. The details relevant to the vector-invariant form of the |
193 |
equations and the various advection schemes are not covered for the |
194 |
moment. We assume that you use the standard form of the momentum |
195 |
equations (i.e. the flux-form) with the default advection scheme. |
196 |
Also, there are a few logical variables that allow you to turn on/off |
197 |
various terms in the momentum equation. These variables are called |
198 |
\textbf{momViscosity, momAdvection, momForcing, useCoriolis, |
199 |
momPressureForcing, momStepping} and \textbf{metricTerms }and are |
200 |
assumed to be set to \texttt{'.TRUE.'} here. Look at the file |
201 |
\textit{model/inc/PARAMS.h }for a precise definition of these |
202 |
variables. |
203 |
|
204 |
\begin{description} |
205 |
\item[initialization] \ |
206 |
|
207 |
The velocity components are initialized to 0 unless the simulation |
208 |
is starting from a pickup file (see section on simulation control |
209 |
parameters). |
210 |
|
211 |
\item[forcing] \ |
212 |
|
213 |
This section only applies to the ocean. You need to generate |
214 |
wind-stress data into two files \textbf{zonalWindFile} and |
215 |
\textbf{meridWindFile} corresponding to the zonal and meridional |
216 |
components of the wind stress, respectively (if you want the stress |
217 |
to be along the direction of only one of the model horizontal axes, |
218 |
you only need to generate one file). The format of the files is |
219 |
similar to the bathymetry file. The zonal (meridional) stress data |
220 |
are assumed to be in Pa and located at U-points (V-points). As for |
221 |
the bathymetry, the precision with which to read the binary data is |
222 |
controlled by the variable \textbf{readBinaryPrec}. See the matlab |
223 |
program \textit{gendata.m} in the \textit{input} directories under |
224 |
\textit{verification} to see how simple analytical wind forcing data |
225 |
are generated for the case study experiments. |
226 |
|
227 |
There is also the possibility of prescribing time-dependent periodic |
228 |
forcing. To do this, concatenate the successive time records into a |
229 |
single file (for each stress component) ordered in a (x,y,t) fashion |
230 |
and set the following variables: \textbf{periodicExternalForcing }to |
231 |
\texttt{'.TRUE.'}, \textbf{externForcingPeriod }to the period (in s) |
232 |
of which the forcing varies (typically 1 month), and |
233 |
\textbf{externForcingCycle} to the repeat time (in s) of the forcing |
234 |
(typically 1 year -- note: \textbf{ externForcingCycle} must be a |
235 |
multiple of \textbf{externForcingPeriod}). With these variables set |
236 |
up, the model will interpolate the forcing linearly at each |
237 |
iteration. |
238 |
|
239 |
\item[dissipation] \ |
240 |
|
241 |
The lateral eddy viscosity coefficient is specified through the |
242 |
variable \textbf{viscAh} (in m$^{2}$s$^{-1}$). The vertical eddy |
243 |
viscosity coefficient is specified through the variable |
244 |
\textbf{viscAz} (in m$^{2}$s$^{-1}$) for the ocean and |
245 |
\textbf{viscAp} (in Pa$^{2}$s$^{-1}$) for the atmosphere. The |
246 |
vertical diffusive fluxes can be computed implicitly by setting the |
247 |
logical variable \textbf{implicitViscosity }to \texttt{'.TRUE.'}. |
248 |
In addition, biharmonic mixing can be added as well through the |
249 |
variable \textbf{viscA4} (in m$^{4}$s$^{-1}$). On a spherical polar |
250 |
grid, you might also need to set the variable \textbf{cosPower} |
251 |
which is set to 0 by default and which represents the power of |
252 |
cosine of latitude to multiply viscosity. Slip or no-slip conditions |
253 |
at lateral and bottom boundaries are specified through the logical |
254 |
variables \textbf{no\_slip\_sides} and \textbf{no\_slip\_bottom}. If |
255 |
set to \texttt{'.FALSE.'}, free-slip boundary conditions are |
256 |
applied. If no-slip boundary conditions are applied at the bottom, a |
257 |
bottom drag can be applied as well. Two forms are available: linear |
258 |
(set the variable \textbf{bottomDragLinear} in m/s) and |
259 |
quadratic (set the variable \textbf{bottomDragQuadratic}, dimensionless). |
260 |
|
261 |
The Fourier and Shapiro filters are described elsewhere. |
262 |
|
263 |
\item[C-D scheme] \ |
264 |
|
265 |
If you run at a sufficiently coarse resolution, you will need the |
266 |
C-D scheme for the computation of the Coriolis terms. The |
267 |
variable\textbf{\ tauCD}, which represents the C-D scheme coupling |
268 |
timescale (in s) needs to be set. |
269 |
|
270 |
\item[calculation of pressure/geopotential] \ |
271 |
|
272 |
First, to run a non-hydrostatic ocean simulation, set the logical |
273 |
variable \textbf{nonHydrostatic} to \texttt{'.TRUE.'}. The pressure |
274 |
field is then inverted through a 3D elliptic equation. (Note: this |
275 |
capability is not available for the atmosphere yet.) By default, a |
276 |
hydrostatic simulation is assumed and a 2D elliptic equation is used |
277 |
to invert the pressure field. The parameters controlling the |
278 |
behaviour of the elliptic solvers are the variables |
279 |
\textbf{cg2dMaxIters} and \textbf{cg2dTargetResidual } for |
280 |
the 2D case and \textbf{cg3dMaxIters} and |
281 |
\textbf{cg3dTargetResidual} for the 3D case. You probably won't need to |
282 |
alter the default values (are we sure of this?). |
283 |
|
284 |
For the calculation of the surface pressure (for the ocean) or |
285 |
surface geopotential (for the atmosphere) you need to set the |
286 |
logical variables \textbf{rigidLid} and \textbf{implicitFreeSurface} |
287 |
(set one to \texttt{'.TRUE.'} and the other to \texttt{'.FALSE.'} |
288 |
depending on how you want to deal with the ocean upper or atmosphere |
289 |
lower boundary). |
290 |
|
291 |
\end{description} |
292 |
|
293 |
\subsection{Parameters: Tracer equations} |
294 |
|
295 |
This section covers the tracer equations i.e. the potential |
296 |
temperature equation and the salinity (for the ocean) or specific |
297 |
humidity (for the atmosphere) equation. As for the momentum equations, |
298 |
we only describe for now the parameters that you are likely to change. |
299 |
The logical variables \textbf{tempDiffusion} \textbf{tempAdvection} |
300 |
\textbf{tempForcing}, and \textbf{tempStepping} allow you to turn |
301 |
on/off terms in the temperature equation (same thing for salinity or |
302 |
specific humidity with variables \textbf{saltDiffusion}, |
303 |
\textbf{saltAdvection} etc.). These variables are all assumed here to |
304 |
be set to \texttt{'.TRUE.'}. Look at file \textit{model/inc/PARAMS.h} |
305 |
for a precise definition. |
306 |
|
307 |
\begin{description} |
308 |
\item[initialization] \ |
309 |
|
310 |
The initial tracer data can be contained in the binary files |
311 |
\textbf{hydrogThetaFile} and \textbf{hydrogSaltFile}. These files |
312 |
should contain 3D data ordered in an (x,y,r) fashion with k=1 as the |
313 |
first vertical level. If no file names are provided, the tracers |
314 |
are then initialized with the values of \textbf{tRef} and |
315 |
\textbf{sRef} mentioned above (in the equation of state section). In |
316 |
this case, the initial tracer data are uniform in x and y for each |
317 |
depth level. |
318 |
|
319 |
\item[forcing] \ |
320 |
|
321 |
This part is more relevant for the ocean, the procedure for the |
322 |
atmosphere not being completely stabilized at the moment. |
323 |
|
324 |
A combination of fluxes data and relaxation terms can be used for |
325 |
driving the tracer equations. For potential temperature, heat flux |
326 |
data (in W/m$ ^{2}$) can be stored in the 2D binary file |
327 |
\textbf{surfQfile}. Alternatively or in addition, the forcing can |
328 |
be specified through a relaxation term. The SST data to which the |
329 |
model surface temperatures are restored to are supposed to be stored |
330 |
in the 2D binary file \textbf{thetaClimFile}. The corresponding |
331 |
relaxation time scale coefficient is set through the variable |
332 |
\textbf{tauThetaClimRelax} (in s). The same procedure applies for |
333 |
salinity with the variable names \textbf{EmPmRfile}, |
334 |
\textbf{saltClimFile}, and \textbf{tauSaltClimRelax} for freshwater |
335 |
flux (in m/s) and surface salinity (in ppt) data files and |
336 |
relaxation time scale coefficient (in s), respectively. Also for |
337 |
salinity, if the CPP key \textbf{USE\_NATURAL\_BCS} is turned on, |
338 |
natural boundary conditions are applied i.e. when computing the |
339 |
surface salinity tendency, the freshwater flux is multiplied by the |
340 |
model surface salinity instead of a constant salinity value. |
341 |
|
342 |
As for the other input files, the precision with which to read the |
343 |
data is controlled by the variable \textbf{readBinaryPrec}. |
344 |
Time-dependent, periodic forcing can be applied as well following |
345 |
the same procedure used for the wind forcing data (see above). |
346 |
|
347 |
\item[dissipation] \ |
348 |
|
349 |
Lateral eddy diffusivities for temperature and salinity/specific |
350 |
humidity are specified through the variables \textbf{diffKhT} and |
351 |
\textbf{diffKhS} (in m$^{2}$/s). Vertical eddy diffusivities are |
352 |
specified through the variables \textbf{diffKzT} and |
353 |
\textbf{diffKzS} (in m$^{2}$/s) for the ocean and \textbf{diffKpT |
354 |
}and \textbf{diffKpS} (in Pa$^{2}$/s) for the atmosphere. The |
355 |
vertical diffusive fluxes can be computed implicitly by setting the |
356 |
logical variable \textbf{implicitDiffusion} to \texttt{'.TRUE.'}. |
357 |
In addition, biharmonic diffusivities can be specified as well |
358 |
through the coefficients \textbf{diffK4T} and \textbf{diffK4S} (in |
359 |
m$^{4}$/s). Note that the cosine power scaling (specified through |
360 |
\textbf{cosPower}---see the momentum equations section) is applied to |
361 |
the tracer diffusivities (Laplacian and biharmonic) as well. The |
362 |
Gent and McWilliams parameterization for oceanic tracers is |
363 |
described in the package section. Finally, note that tracers can be |
364 |
also subject to Fourier and Shapiro filtering (see the corresponding |
365 |
section on these filters). |
366 |
|
367 |
\item[ocean convection] \ |
368 |
|
369 |
Two options are available to parameterize ocean convection: one is |
370 |
to use the convective adjustment scheme. In this case, you need to |
371 |
set the variable \textbf{cadjFreq}, which represents the frequency |
372 |
(in s) with which the adjustment algorithm is called, to a non-zero |
373 |
value (if set to a negative value by the user, the model will set it |
374 |
to the tracer time step). The other option is to parameterize |
375 |
convection with implicit vertical diffusion. To do this, set the |
376 |
logical variable \textbf{implicitDiffusion} to \texttt{'.TRUE.'} |
377 |
and the real variable \textbf{ivdc\_kappa} to a value (in m$^{2}$/s) |
378 |
you wish the tracer vertical diffusivities to have when mixing |
379 |
tracers vertically due to static instabilities. Note that |
380 |
\textbf{cadjFreq} and \textbf{ivdc\_kappa}can not both have non-zero |
381 |
value. |
382 |
|
383 |
\end{description} |
384 |
|
385 |
\subsection{Parameters: Simulation controls} |
386 |
|
387 |
The model ''clock'' is defined by the variable \textbf{deltaTClock} |
388 |
(in s) which determines the IO frequencies and is used in tagging |
389 |
output. Typically, you will set it to the tracer time step for |
390 |
accelerated runs (otherwise it is simply set to the default time step |
391 |
\textbf{deltaT}). Frequency of checkpointing and dumping of the model |
392 |
state are referenced to this clock (see below). |
393 |
|
394 |
\begin{description} |
395 |
\item[run duration] \ |
396 |
|
397 |
The beginning of a simulation is set by specifying a start time (in |
398 |
s) through the real variable \textbf{startTime} or by specifying an |
399 |
initial iteration number through the integer variable |
400 |
\textbf{nIter0}. If these variables are set to nonzero values, the |
401 |
model will look for a ''pickup'' file \textit{pickup.0000nIter0} to |
402 |
restart the integration. The end of a simulation is set through the |
403 |
real variable \textbf{endTime} (in s). Alternatively, you can |
404 |
specify instead the number of time steps to execute through the |
405 |
integer variable \textbf{nTimeSteps}. |
406 |
|
407 |
\item[frequency of output] \ |
408 |
|
409 |
Real variables defining frequencies (in s) with which output files |
410 |
are written on disk need to be set up. \textbf{dumpFreq} controls |
411 |
the frequency with which the instantaneous state of the model is |
412 |
saved. \textbf{chkPtFreq} and \textbf{pchkPtFreq} control the output |
413 |
frequency of rolling and permanent checkpoint files, respectively. |
414 |
See section 1.5.1 Output files for the definition of model state and |
415 |
checkpoint files. In addition, time-averaged fields can be written |
416 |
out by setting the variable \textbf{taveFreq} (in s). The precision |
417 |
with which to write the binary data is controlled by the integer |
418 |
variable w\textbf{riteBinaryPrec} (set it to \texttt{32} or |
419 |
\texttt{64}). |
420 |
|
421 |
\end{description} |
422 |
|
423 |
|
424 |
%%% Local Variables: |
425 |
%%% mode: latex |
426 |
%%% TeX-master: t |
427 |
%%% End: |