New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Chap_MISC.tex in branches/nemo_v3_3_beta/DOC/TexFiles/Chapters – NEMO

source: branches/nemo_v3_3_beta/DOC/TexFiles/Chapters/Chap_MISC.tex @ 2366

Last change on this file since 2366 was 2364, checked in by acc, 14 years ago

Added basic NetCDF4 chunking and compression support (key_netcdf4). See ticket #754

  • Property svn:executable set to *
File size: 63.8 KB
Line 
1% ================================================================
2% Chapter Ñ Miscellaneous Topics
3% ================================================================
4\chapter{Miscellaneous Topics}
5\label{MISC}
6\minitoc
7
8\newpage
9$\ $\newline    % force a new ligne
10
11% ================================================================
12% Representation of Unresolved Straits
13% ================================================================
14\section{Representation of Unresolved Straits}
15\label{MISC_strait}
16
17In climate modeling, it often occurs that a crucial connections between water masses
18is broken as the grid mesh is too coarse to resolve narrow straits. For example, coarse
19grid spacing typically closes off the Mediterranean from the Atlantic at the Strait of
20Gibraltar. In this case, it is important for climate models to include the effects of salty
21water entering the Atlantic from the Mediterranean. Likewise, it is important for the
22Mediterranean to replenish its supply of water from the Atlantic to balance the net
23evaporation occurring over the Mediterranean region. This problem occurs even in
24eddy permitting simulations. For example, in ORCA 1/4\deg several straits of the Indonesian
25archipelago (Ombai, Lombok...) are much narrow than even a single ocean grid-point.
26
27We describe briefly here the three methods that can be used in \NEMO to handle
28such improperly resolved straits. The first two consist of opening the strait by hand
29while ensuring that the mass exchanges through the strait are not too large by
30either artificially reducing the surface of the strait grid-cells or, locally increasing
31the lateral friction. In the third one, the strait is closed but exchanges of mass,
32heat and salt across the land are allowed.
33Note that such modifications are so specific to a given configuration that no attempt
34has been made to set them in a generic way. However, examples of how
35they can be set up is given in the ORCA 2\deg and 0.5\deg configurations (search for
36\key{orca\_r2} or \key{orca\_r05} in the code).
37
38% -------------------------------------------------------------------------------------------------------------
39%       Hand made geometry changes
40% -------------------------------------------------------------------------------------------------------------
41\subsection{Hand made geometry changes}
42\label{MISC_strait_hand}
43
44$\bullet$ reduced scale factor in the cross-strait direction to a value in better agreement
45with the true mean width of the strait. (Fig.~\ref{Fig_MISC_strait_hand}).
46This technique is sometime called "partially open face" or "partially closed cells".
47The key issue here is only to reduce the faces of $T$-cell ($i.e.$ change the value
48of the horizontal scale factors at $u$- or $v$-point) but not the volume of the $T$-cell.
49Indeed, reducing the volume of strait $T$-cell can easily produce a numerical
50instability at that grid point that would require a reduction of the model time step.
51The changes associated with strait management are done in \mdl{domhgr},
52just after the definition or reading of the horizontal scale factors.
53
54$\bullet$ increase of the viscous boundary layer thickness by local increase of the
55fmask value at the coast (Fig.~\ref{Fig_MISC_strait_hand}). This is done in
56\mdl{dommsk} together with the setting of the coastal value of fmask
57(see Section \ref{LBC_coast})
58
59%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
60\begin{figure}[!tbp] \label{Fig_MISC_strait_hand}  \begin{center}
61\includegraphics[width=0.80\textwidth]{./TexFiles/Figures/Fig_Gibraltar.pdf}
62\includegraphics[width=0.80\textwidth]{./TexFiles/Figures/Fig_Gibraltar2.pdf}
63\caption {Example of the Gibraltar strait defined in a $1\deg \times 1\deg$ mesh.
64\textit{Top}: using partially open cells. The meridional scale factor at $v$-point
65is reduced on both sides of the strait to account for the real width of the strait
66(about 20 km). Note that the scale factors of the strait $T$-point remains unchanged.
67\textit{Bottom}: using viscous boundary layers. The four fmask parameters
68along the strait coastlines are set to a value larger than 4, $i.e.$ "strong" no-slip
69case (see Fig.\ref{Fig_LBC_shlat}) creating a large viscous boundary layer
70that allows a reduced transport through the strait.}
71\end{center}   \end{figure}
72%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
73
74% -------------------------------------------------------------------------------------------------------------
75% Cross Land Advection
76% -------------------------------------------------------------------------------------------------------------
77\subsection{Cross Land Advection (\mdl{tracla})}
78\label{MISC_strait_cla}
79%--------------------------------------------namcla--------------------------------------------------------
80\namdisplay{namcla} 
81%--------------------------------------------------------------------------------------------------------------
82
83\colorbox{yellow}{Add a short description of CLA staff here or in lateral boundary condition chapter?}
84
85%The problem is resolved here by allowing the mixing of tracers and mass/volume between non-adjacent water columns at nominated regions within the model. Momentum is not mixed. The scheme conserves total tracer content, and total volume (the latter in $z*$- or $s*$-coordinate), and maintains compatibility between the tracer and mass/volume budgets. 
86
87% ================================================================
88% Closed seas
89% ================================================================
90\section{Closed seas (\mdl{closea})}
91\label{MISC_closea}
92
93\colorbox{yellow}{Add here a short description of the way closed seas are managed}
94
95
96% ================================================================
97% Sub-Domain Functionality (\textit{nizoom, njzoom}, namelist parameters)
98% ================================================================
99\section{Sub-Domain Functionality (\jp{jpizoom}, \jp{jpjzoom})}
100\label{MISC_zoom}
101
102The sub-domain functionality, also improperly called the zoom option
103(improperly because it is not associated with a change in model resolution)
104is a quite simple function that allows a simulation over a sub-domain of an
105already defined configuration ($i.e.$ without defining a new mesh, initial
106state and forcings). This option can be useful for testing the user settings
107of surface boundary conditions, or the initial ocean state of a huge ocean
108model configuration while having a small computer memory requirement.
109It can also be used to easily test specific physics in a sub-domain (for example,
110see \citep{Madec_al_JPO96} for a test of the coupling used in the global ocean
111version of OPA between sea-ice and ocean model over the Arctic or Antarctic
112ocean, using a sub-domain). In the standard model, this option does not
113include any specific treatment for the ocean boundaries of the sub-domain:
114they are considered as artificial vertical walls. Nevertheless, it is quite easy
115to add a restoring term toward a climatology in the vicinity of such boundaries
116(see \S\ref{TRA_dmp}).
117
118In order to easily define a sub-domain over which the computation can be
119performed, the dimension of all input arrays (ocean mesh, bathymetry,
120forcing, initial state, ...) are defined as \jp{jpidta}, \jp{jpjdta} and \jp{jpkdta} 
121(\mdl{par\_oce} module), while the computational domain is defined through
122\jp{jpiglo}, \jp{jpjglo} and \jp{jpk} (\mdl{par\_oce} module). When running the
123model over the whole domain, the user sets \jp{jpiglo}=\jp{jpidta} \jp{jpjglo}=\jp{jpjdta} 
124and \jp{jpk}=\jp{jpkdta}. When running the model over a sub-domain, the user
125has to provide the size of the sub-domain, (\jp{jpiglo}, \jp{jpjglo}, \jp{jpkglo}),
126and the indices of the south western corner as \jp{jpizoom} and \jp{jpjzoom} in
127the \mdl{par\_oce} module (Fig.~\ref{Fig_LBC_zoom}).
128
129Note that a third set of dimensions exist, \jp{jpi}, \jp{jpj} and \jp{jpk} which is
130actually used to perform the computation. It is set by default to \jp{jpi}=\jp{jpjglo} 
131and \jp{jpj}=\jp{jpjglo}, except for massively parallel computing where the
132computational domain is laid out on local processor memories following a 2D
133horizontal splitting. % (see {\S}IV.2-c) ref to the section to be updated
134
135%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
136\begin{figure}[!ht] \label{Fig_LBC_zoom}  \begin{center}
137\includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_LBC_zoom.pdf}
138\caption {Position of a model domain compared to the data input domain when the zoom functionality is used.}
139\end{center}   \end{figure}
140%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
141
142
143% ================================================================
144% 1D model functionality
145% ================================================================
146\section{Water column model: 1D model (\key{c1d})}
147\label{MISC_1D}
148
149The 1D model option simulates a stand alone water column within the 3D \NEMO system.
150It can be applied to the ocean alone or to the ocean-ice system and can include passive tracers
151or a biogeochemical model. It is set up by defining the \key{c1d} CPP key.
152The 1D model is a very useful tool 
153\textit{(a)} to learn about the physics and numerical treatment of vertical mixing processes ;
154\textit{(b)} to investigate suitable parameterisations of unresolved turbulence (wind steering,
155langmuir circulation, skin layers) ;
156\textit{(c)} to compare the behaviour of different vertical mixing schemes  ;
157\textit{(d)} to perform sensitivity studies on the vertical diffusion at a particular point of an ocean domain ;
158\textit{(d)} to produce extra diagnostics, without the large memory requirement of the full 3D model.
159
160The methodology is based on the use of the zoom functionality over the smallest possible
161domain : a 3 x 3 domain centred on the grid point of interest (see \S\ref{MISC_zoom}),
162with some extra routines. There is no need to define a new mesh, bathymetry,
163initial state or forcing, since the 1D model will use those of the configuration it is a zoom of.
164The chosen grid point is set in par\_oce.F90 module by setting the jpizoom and jpjzoom
165parameters to the indices of the location of the chosen grid point.
166
167% ================================================================
168% Accelerating the Convergence
169% ================================================================
170\section{Accelerating the Convergence (\np{nn\_acc} = 1)}
171\label{MISC_acc}
172%--------------------------------------------namdom-------------------------------------------------------
173\namdisplay{namdom} 
174%--------------------------------------------------------------------------------------------------------------
175
176Searching an equilibrium state with an global ocean model requires a very long time
177integration period (a few thousand years for a global model). Due to the size of
178the time step required for numerical stability (less than a few hours),
179this usually requires a large elapsed time. In order to overcome this problem,
180\citet{Bryan1984} introduces a technique that is intended to accelerate
181the spin up to equilibrium. It uses a larger time step in
182the tracer evolution equations than in the momentum evolution
183equations. It does not affect the equilibrium solution but modifies the
184trajectory to reach it.
185
186The acceleration of convergence option is used when \np{nn\_acc}=1. In that case,
187$\rdt=rn\_rdt$ is the time step of dynamics while $\widetilde{\rdt}=rdttra$ is the
188tracer time-step. the former is set from the \np{rn\_rdt} namelist parameter while the latter
189is computed using a hyperbolic tangent profile and the following namelist parameters :
190\np{rn\_rdtmin}, \np{rn\_rdtmax} and \np{rn\_rdth}. Those three parameters correspond
191to the surface value the deep ocean value and the depth at which the transition occurs, respectively.
192The set of prognostic equations to solve becomes:
193\begin{equation} \label{Eq_acc}
194\begin{split}
195\frac{\partial \textbf{U}_h }{\partial t} 
196   &\equiv \frac{\textbf{U}_h ^{t+1}-\textbf{U}_h^{t-1} }{2\rdt} = \ldots \\ 
197\frac{\partial T}{\partial t} &\equiv \frac{T^{t+1}-T^{t-1}}{2 \widetilde{\rdt}} = \ldots \\ 
198\frac{\partial S}{\partial t} &\equiv \frac{S^{t+1} -S^{t-1}}{2 \widetilde{\rdt}} = \ldots \\ 
199\end{split}
200\end{equation}
201
202\citet{Bryan1984} has examined the consequences of this distorted physics.
203Free waves have a slower phase speed, their meridional structure is slightly
204modified, and the growth rate of baroclinically unstable waves is reduced
205but with a wider range of instability. This technique is efficient for
206searching for an equilibrium state in coarse resolution models. However its
207application is not suitable for many oceanic problems: it cannot be used for
208transient or time evolving problems (in particular, it is very questionable
209to use this technique when there is a seasonal cycle in the forcing fields),
210and it cannot be used in high-resolution models where baroclinically
211unstable processes are important. Moreover, the vertical variation of
212$\widetilde{ \rdt}$ implies that the heat and salt contents are no longer
213conserved due to the vertical coupling of the ocean level through both
214advection and diffusion. Therefore \np{rn\_rdtmin} = \np{rn\_rdtmax} should be
215a more clever choice.
216
217% ================================================================
218% Model optimisation, Control Print and Benchmark
219% ================================================================
220\section{Model Optimisation, Control Print and Benchmark}
221\label{MISC_opt}
222%--------------------------------------------namctl-------------------------------------------------------
223\namdisplay{namctl} 
224%--------------------------------------------------------------------------------------------------------------
225
226% \gmcomment{why not make these bullets into subsections?}
227
228
229$\bullet$ Vector optimisation:
230
231\key{vectopt\_loop} enables the internal loops to collapse. This is very
232a very efficient way to increase the length of vector calculations and thus
233to speed up the model on vector computers.
234 
235% Add here also one word on NPROMA technique that has been found useless, since compiler have made significant progress during the last decade.
236 
237% Add also one word on NEC specific optimisation (Novercheck option for example)
238 
239$\bullet$ Control print %: describe here 4 things:
240
2411- \np{ln\_ctl} : compute and print the trends averaged over the interior domain
242in all TRA, DYN, LDF and ZDF modules. This option is very helpful when
243diagnosing the origin of an undesired change in model results.
244
2452- also \np{ln\_ctl} but using the nictl and njctl namelist parameters to check
246the source of differences between mono and multi processor runs.
247
2483- \key{esopa} (to be rename key\_nemo) : which is another option for model
249management. When defined, this key forces the activation of all options and
250CPP keys. For example, all tracer and momentum advection schemes are called!
251Therefore the model results have no physical meaning.
252However, this option forces both the compiler and the model to run through
253all the \textsc{Fortran} lines of the model. This allows the user to check for obvious
254compilation or execution errors with all CPP options, and errors in namelist options.
255
2564- last digit comparison (\np{nn\_bit\_cmp}). In an MPP simulation, the computation of
257a sum over the whole domain is performed as the summation over all processors of
258each of their sums over their interior domains. This double sum never gives exactly
259the same result as a single sum over the whole domain, due to truncation differences.
260The "bit comparison" option has been introduced in order to be able to check that
261mono-processor and multi-processor runs give exactly the same results.
262
263$\bullet$  Benchmark (\np{nn\_bench}). This option defines a benchmark run based on
264a GYRE configuration in which the resolution remains the same whatever the domain
265size. This allows a very large model domain to be used, just by changing the domain
266size (\jp{jpiglo}, \jp{jpjglo}) and without adjusting either the time-step or the physical
267parameterisations.
268
269
270% ================================================================
271% Elliptic solvers (SOL)
272% ================================================================
273\section{Elliptic solvers (SOL)}
274\label{MISC_sol}
275%--------------------------------------------namdom-------------------------------------------------------
276\namdisplay{namsol} 
277%--------------------------------------------------------------------------------------------------------------
278
279When the filtered sea surface height option is used, the surface pressure gradient is
280computed in \mdl{dynspg\_flt}. The force added in the momentum equation is solved implicitely.
281It is thus solution of an elliptic equation \eqref{Eq_PE_flt} for which two solvers are available:
282a Successive-Over-Relaxation scheme (SOR) and a preconditioned conjugate gradient
283scheme(PCG) \citep{Madec_al_OM88, Madec_PhD90}. The solver is selected trough the
284the value of \np{nn\_solv} (namelist parameter).
285
286The PCG is a very efficient method for solving elliptic equations on vector computers.
287It is a fast and rather easy method to use; which are attractive features for a large
288number of ocean situations (variable bottom topography, complex coastal geometry,
289variable grid spacing, islands, open or cyclic boundaries, etc ...). It does not require
290a search for an optimal parameter as in the SOR method. However, the SOR has
291been retained because it is a linear solver, which is a very useful property when
292using the adjoint model of \NEMO.
293
294At each time step, the time derivative of the sea surface height at time step $t+1$ 
295(or equivalently the divergence of the \textit{after} barotropic transport) that appears
296in the filtering forced is the solution of the elliptic equation obtained from the horizontal
297divergence of the vertical summation of \eqref{Eq_PE_flt}.
298Introducing the following coefficients:
299\begin{equation}  \label{Eq_sol_matrix}
300\begin{aligned}
301&c_{i,j}^{NS}  &&= {2 \rdt }^2 \; \frac{H_v (i,j) \; e_{1v} (i,j)}{e_{2v}(i,j)}              \\
302&c_{i,j}^{EW} &&= {2 \rdt }^2 \; \frac{H_u (i,j) \; e_{2u} (i,j)}{e_{1u}(i,j)}            \\
303&b_{i,j} &&= \delta_i \left[ e_{2u}M_u \right] - \delta_j \left[ e_{1v}M_v \right]\ ,   \\
304\end{aligned}
305\end{equation}
306the five-point finite difference equation \eqref{Eq_psi_total} can be rewritten as:
307\begin{equation}  \label{Eq_solmat}
308\begin{split}
309       c_{i+1,j}^{NS} D_{i+1,j}  + \;  c_{i,j+1}^{EW} D_{i,j+1}   
310  +   c_{i,j}    ^{NS} D_{i-1,j}   + \;  c_{i,j}    ^{EW} D_{i,j-1}                                          &    \\
311  -    \left(c_{i+1,j}^{NS} + c_{i,j+1}^{EW} + c_{i,j}^{NS} + c_{i,j}^{EW} \right)   D_{i,j}  &=  b_{i,j}
312\end{split}
313\end{equation}
314\eqref{Eq_solmat} is a linear symmetric system of equations. All the elements of
315the corresponding matrix \textbf{A} vanish except those of five diagonals. With
316the natural ordering of the grid points (i.e. from west to east and from
317south to north), the structure of \textbf{A} is block-tridiagonal with
318tridiagonal or diagonal blocks. \textbf{A} is a positive-definite symmetric
319matrix of size $(jpi \cdot jpj)^2$, and \textbf{B}, the right hand side of
320\eqref{Eq_solmat}, is a vector.
321
322Note that in the linear free surface case, the depth that appears in \eqref{Eq_sol_matrix}
323does not vary with time, and thus the matrix can be computed once for all. In non-linear free surface
324(\key{vvl} defined) the matrix have to be updated at each time step.
325
326% -------------------------------------------------------------------------------------------------------------
327%       Successive Over Relaxation
328% -------------------------------------------------------------------------------------------------------------
329\subsection{Successive Over Relaxation (\np{nn\_solv}=2, \mdl{solsor})}
330\label{MISC_solsor}
331
332Let us introduce the four cardinal coefficients:
333\begin{align*}
334a_{i,j}^S &= c_{i,j    }^{NS}/d_{i,j}     &\qquad  a_{i,j}^W &= c_{i,j}^{EW}/d_{i,j}       \\
335a_{i,j}^E &= c_{i,j+1}^{EW}/d_{i,j}    &\qquad   a_{i,j}^N &= c_{i+1,j}^{NS}/d_{i,j}   
336\end{align*}
337where $d_{i,j} = c_{i,j}^{NS}+ c_{i+1,j}^{NS} + c_{i,j}^{EW} + c_{i,j+1}^{EW}$ 
338(i.e. the diagonal of the matrix). \eqref{Eq_solmat} can be rewritten as:
339\begin{equation}  \label{Eq_solmat_p}
340\begin{split}
341a_{i,j}^{N}  D_{i+1,j} +\,a_{i,j}^{E}  D_{i,j+1} +\, a_{i,j}^{S}  D_{i-1,j} +\,a_{i,j}^{W} D_{i,j-1}  -  D_{i,j} = \tilde{b}_{i,j}
342\end{split}
343\end{equation}
344with $\tilde b_{i,j} = b_{i,j}/d_{i,j}$. \eqref{Eq_solmat_p} is the equation actually solved
345with the SOR method. This method used is an iterative one. Its algorithm can be
346summarised as follows (see \citet{Haltiner1980} for a further discussion):
347
348initialisation (evaluate a first guess from previous time step computations)
349\begin{equation}
350D_{i,j}^0 = 2 \, D_{i,j}^t - D_{i,j}^{t-1}
351\end{equation}
352iteration $n$, from $n=0$ until convergence, do :
353\begin{equation} \label{Eq_sor_algo}
354\begin{split}
355R_{i,j}^n  = &a_{i,j}^{N} D_{i+1,j}^n       +\,a_{i,j}^{E}  D_{i,j+1} ^n         
356         +\, a_{i,j}^{S}  D_{i-1,j} ^{n+1}+\,a_{i,j}^{W} D_{i,j-1} ^{n+1}
357                 -  D_{i,j}^n - \tilde{b}_{i,j}                                           \\
358D_{i,j} ^{n+1}  = &D_{i,j} ^{n}   + \omega \;R_{i,j}^n     
359\end{split}
360\end{equation}
361where \textit{$\omega $ }satisfies $1\leq \omega \leq 2$. An optimal value exists for
362\textit{$\omega$} which significantly accelerates the convergence, but it has to be
363adjusted empirically for each model domain (except for a uniform grid where an
364analytical expression for \textit{$\omega$} can be found \citep{Richtmyer1967}).
365The value of $\omega$ is set using \np{rn\_sor}, a \textbf{namelist} parameter.
366The convergence test is of the form:
367\begin{equation}
368\delta = \frac{\sum\limits_{i,j}{R_{i,j}^n}{R_{i,j}^n}}
369                    {\sum\limits_{i,j}{ \tilde{b}_{i,j}^n}{\tilde{b}_{i,j}^n}} \leq \epsilon
370\end{equation}
371where $\epsilon$ is the absolute precision that is required. It is recommended
372that a value smaller or equal to $10^{-6}$ is used for $\epsilon$ since larger
373values may lead to numerically induced basin scale barotropic oscillations.
374The precision is specified by setting \np{rn\_eps} (\textbf{namelist} parameter).
375In addition, two other tests are used to halt the iterative algorithm. They involve
376the number of iterations and the modulus of the right hand side. If the former
377exceeds a specified value, \np{nn\_max} (\textbf{namelist} parameter),
378or the latter is greater than $10^{15}$, the whole model computation is stopped
379and the last computed time step fields are saved in a abort.nc NetCDF file.
380In both cases, this usually indicates that there is something wrong in the model
381configuration (an error in the mesh, the initial state, the input forcing,
382or the magnitude of the time step or of the mixing coefficients). A typical value of
383$nn\_max$ is a few hundred when $\epsilon = 10^{-6}$, increasing to a few
384thousand when $\epsilon = 10^{-12}$.
385The vectorization of the SOR algorithm is not straightforward. The scheme
386contains two linear recurrences on $i$ and $j$. This inhibits the vectorisation.
387\eqref{Eq_sor_algo} can be been rewritten as:
388\begin{equation} 
389\begin{split}
390R_{i,j}^n
391= &a_{i,j}^{N}  D_{i+1,j}^n +\,a_{i,j}^{E}  D_{i,j+1} ^n
392 +\,a_{i,j}^{S}  D_{i-1,j} ^{n}+\,_{i,j}^{W} D_{i,j-1} ^{n} -  D_{i,j}^n - \tilde{b}_{i,j}      \\
393R_{i,j}^n = &R_{i,j}^n - \omega \;a_{i,j}^{S}\; R_{i,j-1}^n                                             \\
394R_{i,j}^n = &R_{i,j}^n - \omega \;a_{i,j}^{W}\; R_{i-1,j}^n
395\end{split}
396\end{equation}
397This technique slightly increases the number of iteration required to reach the convergence,
398but this is largely compensated by the gain obtained by the suppression of the recurrences.
399
400Another technique have been chosen, the so-called red-black SOR. It consist in solving successively
401\eqref{Eq_sor_algo} for odd and even grid points. It also slightly reduced the convergence rate
402but allows the vectorisation. In addition, and this is the reason why it has been chosen, it is able to handle the north fold boundary condition used in ORCA configuration ($i.e.$ tri-polar global ocean mesh).
403
404The SOR method is very flexible and can be used under a wide range of conditions,
405including irregular boundaries, interior boundary points, etc. Proofs of convergence, etc.
406may be found in the standard numerical methods texts for partial differential equations.
407
408% -------------------------------------------------------------------------------------------------------------
409%       Preconditioned Conjugate Gradient
410% -------------------------------------------------------------------------------------------------------------
411\subsection{Preconditioned Conjugate Gradient  (\np{nn\_solv}=1, \mdl{solpcg}) }
412\label{MISC_solpcg}
413
414\textbf{A} is a definite positive symmetric matrix, thus solving the linear
415system \eqref{Eq_solmat} is equivalent to the minimisation of a quadratic
416functional:
417\begin{equation*}
418\textbf{Ax} = \textbf{b} \leftrightarrow \textbf{x} =\text{inf}_{y} \,\phi (\textbf{y})
419\quad , \qquad
420\phi (\textbf{y}) = 1/2 \langle \textbf{Ay},\textbf{y}\rangle - \langle \textbf{b},\textbf{y} \rangle 
421\end{equation*}
422where $\langle , \rangle$ is the canonical dot product. The idea of the
423conjugate gradient method is to search for the solution in the following
424iterative way: assuming that $\textbf{x}^n$ has been obtained, $\textbf{x}^{n+1}$ 
425is found from $\textbf {x}^{n+1}={\textbf {x}}^n+\alpha^n{\textbf {d}}^n$ which satisfies:
426\begin{equation*}
427{\textbf{ x}}^{n+1}=\text{inf} _{{\textbf{ y}}={\textbf{ x}}^n+\alpha^n \,{\textbf{ d}}^n} \,\phi ({\textbf{ y}})\;\;\Leftrightarrow \;\;\frac{d\phi }{d\alpha}=0
428\end{equation*}
429and expressing $\phi (\textbf{y})$ as a function of \textit{$\alpha $}, we obtain the
430value that minimises the functional:
431\begin{equation*}
432\alpha ^n = \langle{ \textbf{r}^n , \textbf{r}^n} \rangle  / \langle {\textbf{ A d}^n, \textbf{d}^n} \rangle
433\end{equation*}
434where $\textbf{r}^n = \textbf{b}-\textbf{A x}^n = \textbf{A} (\textbf{x}-\textbf{x}^n)$ 
435is the error at rank $n$. The descent vector $\textbf{d}^n$ s chosen to be dependent
436on the error: $\textbf{d}^n = \textbf{r}^n + \beta^n \,\textbf{d}^{n-1}$. $\beta ^n$ 
437is searched such that the descent vectors form an orthogonal basis for the dot
438product linked to \textbf{A}. Expressing the condition
439$\langle \textbf{A d}^n, \textbf{d}^{n-1} \rangle = 0$ the value of $\beta ^n$ is found:
440 $\beta ^n = \langle{ \textbf{r}^n , \textbf{r}^n} \rangle  / \langle {\textbf{r}^{n-1}, \textbf{r}^{n-1}} \rangle$.
441 As a result, the errors $ \textbf{r}^n$ form an orthogonal
442base for the canonic dot product while the descent vectors $\textbf{d}^n$ form
443an orthogonal base for the dot product linked to \textbf{A}. The resulting
444algorithm is thus the following one:
445
446initialisation :
447\begin{equation*} 
448\begin{split}
449\textbf{x}^0 &= D_{i,j}^0   = 2 D_{i,j}^t - D_{i,j}^{t-1}       \quad, \text{the initial guess }     \\
450\textbf{r}^0 &= \textbf{d}^0 = \textbf{b} - \textbf{A x}^0       \\
451\gamma_0 &= \langle{ \textbf{r}^0 , \textbf{r}^0} \rangle
452\end{split}
453\end{equation*}
454
455iteration $n,$ from $n=0$ until convergence, do :
456\begin{equation} 
457\begin{split}
458\text{z}^n& = \textbf{A d}^n \\
459\alpha_n &= \gamma_n /  \langle{ \textbf{z}^n , \textbf{d}^n} \rangle \\
460\textbf{x}^{n+1} &= \textbf{x}^n + \alpha_n \,\textbf{d}^n \\
461\textbf{r}^{n+1} &= \textbf{r}^n - \alpha_n \,\textbf{z}^n \\
462\gamma_{n+1} &= \langle{ \textbf{r}^{n+1} , \textbf{r}^{n+1}} \rangle \\
463\beta_{n+1} &= \gamma_{n+1}/\gamma_{n}  \\
464\textbf{d}^{n+1} &= \textbf{r}^{n+1} + \beta_{n+1}\; \textbf{d}^{n}\\
465\end{split}
466\end{equation}
467
468
469The convergence test is:
470\begin{equation}
471\delta = \gamma_{n}\; / \langle{ \textbf{b} , \textbf{b}} \rangle \leq \epsilon
472\end{equation}
473where $\epsilon $ is the absolute precision that is required. As for the SOR algorithm,
474the whole model computation is stopped when the number of iterations, \np{nn\_max}, or
475the modulus of the right hand side of the convergence equation exceeds a
476specified value (see \S\ref{MISC_solsor} for a further discussion). The required
477precision and the maximum number of iterations allowed are specified by setting
478\np{rn\_eps} and \np{nn\_max} (\textbf{namelist} parameters).
479
480It can be demonstrated that the above algorithm is optimal, provides the exact
481solution in a number of iterations equal to the size of the matrix, and that
482the convergence rate is faster as the matrix is closer to the identity matrix,
483$i.e.$ its eigenvalues are closer to 1. Therefore, it is more efficient to solve
484a better conditioned system which has the same solution. For that purpose,
485we introduce a preconditioning matrix \textbf{Q} which is an approximation
486of \textbf{A} but much easier to invert than \textbf{A}, and solve the system:
487\begin{equation} \label{Eq_pmat}
488\textbf{Q}^{-1} \textbf{A x} = \textbf{Q}^{-1} \textbf{b}
489\end{equation}
490
491The same algorithm can be used to solve \eqref{Eq_pmat} if instead of the
492canonical dot product the following one is used:
493${\langle{ \textbf{a} , \textbf{b}} \rangle}_Q = \langle{ \textbf{a} , \textbf{Q b}} \rangle$, and
494if $\textbf{\~{b}} = \textbf{Q}^{-1}\;\textbf{b}$ and $\textbf{\~{A}} = \textbf{Q}^{-1}\;\textbf{A}$ 
495are substituted to \textbf{b} and \textbf{A} \citep{Madec_al_OM88}.
496In \NEMO, \textbf{Q} is chosen as the diagonal of \textbf{ A}, i.e. the simplest form for
497\textbf{Q} so that it can be easily inverted. In this case, the discrete formulation of
498\eqref{Eq_pmat} is in fact given by \eqref{Eq_solmat_p} and thus the matrix and
499right hand side are computed independently from the solver used.
500
501% ================================================================
502% Diagnostics
503% ================================================================
504\section{Diagnostics (DIA, IOM, TRD, FLO)}
505\label{MISC_diag}
506
507% -------------------------------------------------------------------------------------------------------------
508%       Standard Model Output
509% -------------------------------------------------------------------------------------------------------------
510\subsection{Model Output (default or \key{iomput} or \key{dimgout} or \key{netcdf4})}
511\label{MISC_iom}
512
513%to be updated with Seb documentation on the IO
514
515The model outputs are of three types: the restart file, the output listing,
516and the output file(s). The restart file is used internally by the code when
517the user wants to start the model with initial conditions defined by a
518previous simulation. It contains all the information that is necessary in
519order for there to be no changes in the model results (even at the computer
520precision) between a run performed with several restarts and the same run
521performed in one step. It should be noted that this requires that the restart file
522contain two consecutive time steps for all the prognostic variables, and
523that it is saved in the same binary format as the one used by the computer
524that is to read it (in particular, 32 bits binary IEEE format must not be used for
525this file). The output listing and file(s) are predefined but should be checked
526and eventually adapted to the user's needs. The output listing is stored in
527the $ocean.output$ file. The information is printed from within the code on the
528logical unit $numout$. To locate these prints, use the UNIX command
529"\textit{grep -i numout}" in the source code directory.
530
531In the standard configuration, the user will find the model results in
532NetCDF files containing mean values (or instantaneous values if
533\key{diainstant} is defined) for every time-step where output is demanded.
534These outputs are defined in the \mdl{diawri} module.
535When defining \key{dimgout}, the output are written in DIMG format,
536an IEEE output format.
537
538Since version 3.3, support for NetCDF4 chunking and (loss-less) compression has
539been included.  These options build on the standard NetCDF output and allow
540the user control over the size of the chunks via namelist settings. Chunking
541and compression can lead to significant reductions in file sizes for a small
542runtime overhead. For a fuller discussion on chunking and other performance
543issues the reader is referred to the NetCDF4 documentation:
544http://www.unidata.ucar.edu/software/netcdf/docs/netcdf.html\#Chunking
545
546The new features are only available when the code has been linked with a
547NetCDF4 library (version 4.1 onwards, recommended) which has been built
548with HDF5 support (version 1.8.4 onwards, recommended). Datasets created
549with chunking and compression are not backwards compatible with NetCDF3
550"classic" format but most analysis codes can be relinked simply with the
551new libraries and will then read both NetCDF3 and NetCDF4 files. NEMO
552executables linked with NetCDF4 libraries can be made to produce NetCDF3
553files by setting the \np{ln\_nc4zip} logical to false in the \np{namnc4} 
554namelist:
555
556%------------------------------------------namnc4----------------------------------------------------
557\namdisplay{namnc4}
558%-------------------------------------------------------------------------------------------------------------
559
560If \key{netcdf4} has not been defined, these namelist parameters are not read.
561In this case, \np{ln\_nc4zip} is set false and dummy routines for a few
562NetCDF4-specific functions are defined. These functions will not be used but
563need to be included so that compilation is possible with NetCDF3 libraries.
564
565When using NetCDF4 libraries, \key{netcdf4} should be defined even if the
566intention is to create only NetCDF3-compatible files. This is necessary to
567avoid duplication between the dummy routines and the actual routines present
568in the library. Most compilers will fail at compile time when faced with
569such duplication. Thus when linking with NetCDF4 libraries the user must
570define \key{netcdf4} and control the type of NetCDF file produced via the
571namelist parameter.
572
573Chunking and compression is applied only to 4D fields and there is no
574advantage in chunking across more than one time dimension since previously
575written chunks would have to be read back and decompressed before being
576added to. Therefore, user control over chunk sizes is provided only for the
577three space dimensions. The user sets an approximate number of chunks along
578each spatial axis. The actual size of the chunks will depend on global domain
579size for mono-processors or, more likely, the local processor domain size for
580distributed processing. The derived values are subject to practical minimum
581values (to avoid wastefully small chunk sizes) and cannot be greater than the
582domain size in any dimension. The algorithm used is:
583
584\begin{alltt}  {{\tiny 
585\begin{verbatim}
586     ichunksz(1) = MIN( idomain_size,MAX( (idomain_size-1)/nn_nchunks_i + 1 ,16 ) )
587     ichunksz(2) = MIN( jdomain_size,MAX( (jdomain_size-1)/nn_nchunks_j + 1 ,16 ) )
588     ichunksz(3) = MIN( kdomain_size,MAX( (kdomain_size-1)/nn_nchunks_k + 1 , 1 ) )
589     ichunksz(4) = 1
590\end{verbatim}
591}}\end{alltt} 
592
593\noindent As an example, setting:
594\vspace{-20pt}
595\begin{alltt}  {{\tiny
596\begin{verbatim}
597     nn_nchunks_i=4, nn_nchunks_j=4 and nn_nchunks_k=31
598\end{verbatim}
599}}\end{alltt} \vspace{-10pt}
600
601\noindent for a standard ORCA2\_LIM configuration gives chunksizes of {\small\tt 46x38x1}
602respectively in the mono-processor case (i.e. global domain of {\small\tt 182x149x31}).
603An illustration of the potential space savings that NetCDF4 chunking and compression
604provides is given in table \ref{Tab_NC4} which compares the results of two short
605runs of the ORCA2\_LIM reference configuration with a 4x2 mpi partitioning. Note
606the variation in the compression ratio achieved which reflects chiefly the dry to wet
607volume ratio of each processing region.
608
609\begin{table} 
610\begin{tabular}{lrrr}
611Filename & NetCDF3 & NetCDF4 & Reduction\\
612         &filesize & filesize & \% \\
613         &(KB)     & (KB)     & \\
614ORCA2\_restart\_0000.nc & 16420 & 8860 & 47\%\\
615ORCA2\_restart\_0001.nc & 16064 & 11456 & 29\%\\
616ORCA2\_restart\_0002.nc & 16064 & 9744 & 40\%\\
617ORCA2\_restart\_0003.nc & 16420 & 9404 & 43\%\\
618ORCA2\_restart\_0004.nc & 16200 & 5844 & 64\%\\
619ORCA2\_restart\_0005.nc & 15848 & 8172 & 49\%\\
620ORCA2\_restart\_0006.nc & 15848 & 8012 & 50\%\\
621ORCA2\_restart\_0007.nc & 16200 & 5148 & 69\%\\
622ORCA2\_2d\_grid\_T\_0000.nc & 2200 & 1504 & 32\%\\
623ORCA2\_2d\_grid\_T\_0001.nc & 2200 & 1748 & 21\%\\
624ORCA2\_2d\_grid\_T\_0002.nc & 2200 & 1592 & 28\%\\
625ORCA2\_2d\_grid\_T\_0003.nc & 2200 & 1540 & 30\%\\
626ORCA2\_2d\_grid\_T\_0004.nc & 2200 & 1204 & 46\%\\
627ORCA2\_2d\_grid\_T\_0005.nc & 2200 & 1444 & 35\%\\
628ORCA2\_2d\_grid\_T\_0006.nc & 2200 & 1428 & 36\%\\
629ORCA2\_2d\_grid\_T\_0007.nc & 2200 & 1148 & 48\%\\
630             ...            &  ... &  ... & ..  \\
631ORCA2\_2d\_grid\_W\_0000.nc & 4416 & 2240 & 50\%\\
632ORCA2\_2d\_grid\_W\_0001.nc & 4416 & 2924 & 34\%\\
633ORCA2\_2d\_grid\_W\_0002.nc & 4416 & 2512 & 44\%\\
634ORCA2\_2d\_grid\_W\_0003.nc & 4416 & 2368 & 47\%\\
635ORCA2\_2d\_grid\_W\_0004.nc & 4416 & 1432 & 68\%\\
636ORCA2\_2d\_grid\_W\_0005.nc & 4416 & 1972 & 56\%\\
637ORCA2\_2d\_grid\_W\_0006.nc & 4416 & 2028 & 55\%\\
638ORCA2\_2d\_grid\_W\_0007.nc & 4416 & 1368 & 70\%\\
639\end{tabular}
640\caption{\label{Tab_NC4} Filesize comparison between NetCDF3 and NetCDF4
641with chunking and compression}
642\end{table}
643
644Since version 3.2, an I/O server has been added which provides more
645flexibility in the choice of the fields to be output as well as how the
646writing work is distributed over the processors in massively parallel
647computing. It is activated when \key{iomput} is defined.
648
649When \key{iomput} is activated with \key{netcdf4} chunking and
650compression parameters for fields produced via \np{iom\_put} calls are
651set via an equivalent and identically named namelist to \np{namnc4} in
652\np{xmlio\_server.def}. Typically this namelist serves the mean files
653whilst the \np{ namnc4} in the main namelist file continues to serve the
654restart files. This duplication is unfortunate but appropriate since, if
655using io\_servers, the domain sizes of the individual files produced by the
656io\_server processes may be different to those produced by the invidual
657processing regions and different chunking choices may be desired.
658{ 
659
660% -------------------------------------------------------------------------------------------------------------
661%       Tracer/Dynamics Trends
662% -------------------------------------------------------------------------------------------------------------
663\subsection[Tracer/Dynamics Trends (TRD)]
664                  {Tracer/Dynamics Trends (\key{trdmld}, \key{trdtra}, \key{trddyn}, \key{trdmld\_trc})}
665\label{MISC_tratrd}
666
667%------------------------------------------namtrd----------------------------------------------------
668\namdisplay{namtrd} 
669%-------------------------------------------------------------------------------------------------------------
670
671When \key{trddyn} and/or \key{trddyn} CPP variables are defined, each
672trend of the dynamics and/or temperature and salinity time evolution equations
673is stored in three-dimensional arrays just after their computation ($i.e.$ at the end
674of each $dyn\cdots.F90$ and/or $tra\cdots.F90$ routines). These trends are then
675used in \mdl{trdmod} (see TRD directory) every \textit{nn\_trd } time-steps.
676
677What is done depends on the CPP keys defined:
678\begin{description}
679\item[\key{trddyn}, \key{trdtra}] : a check of the basin averaged properties of the momentum
680and/or tracer equations is performed ;
681\item[\key{trdvor}] : a vertical summation of the moment tendencies is performed,
682then the curl is computed to obtain the barotropic vorticity tendencies which are output ;
683\item[\key{trdmld}] : output of the tracer tendencies averaged vertically 
684either over the mixed layer (\np{nn\_ctls}=0),
685or       over a fixed number of model levels (\np{nn\_ctls}$>$1 provides the number of level),
686or       over a spatially varying but temporally fixed number of levels (typically the base
687of the winter mixed layer) read in \ifile{ctlsurf\_idx} (\np{nn\_ctls}=1).
688\end{description}
689
690The units in the output file can be changed using the \np{nn\_ucf} namelist parameter.
691For example, in case of salinity tendency the units are given by PSU/s/\np{nn\_ucf}.
692Setting \np{nn\_ucf}=86400 provides the tendencies in PSU/d.
693
694When \key{trdmld} is defined, two time averaging procedure are proposed.
695Setting \np{ln\_trdmld\_instant} to \textit{true}, a simple time averaging is performed,
696so that the resulting tendency is the contribution to the change of a quantity between
697the two instantaneous values taken at the extremities of the time averaging period.
698Setting \np{ln\_trdmld\_instant} to \textit{false}, a double time averaging is performed,
699so that the resulting tendency is the contribution to the change of a quantity between
700two \textit{time mean} values. The later option requires the use of an extra file, \ifile{restart\_mld} 
701(\np{ln\_trdmld\_restart}=true), to restart a run.
702
703
704Note that the mixed layer tendency diagnostic can also be used on biogeochemical models
705via Êthe \key{trdtrc} and \key{trdmld\_trc} CPP keys.
706
707% -------------------------------------------------------------------------------------------------------------
708%       On-line Floats trajectories
709% -------------------------------------------------------------------------------------------------------------
710\subsection{On-line Floats trajectories (FLO) (\key{floats}}
711\label{FLO}
712%--------------------------------------------namflo-------------------------------------------------------
713\namdisplay{namflo} 
714%--------------------------------------------------------------------------------------------------------------
715
716The on-line computation of floats advected either by the three dimensional velocity
717field or constraint to remain at a given depth ($w = 0$ in the computation) have been
718introduced in the system during the CLIPPER project. The algorithm used is based
719either on the work of \cite{Blanke_Raynaud_JPO97} (default option), or on a $4^th$
720Runge-Hutta algorithm (\np{ln\_flork4}=true). Note that the \cite{Blanke_Raynaud_JPO97} 
721algorithm have the advantage of providing trajectories which are consistent with the
722numeric of the code, so that the trajectories never intercept the bathymetry.
723
724See also the web site describing the off-line use of this marvellous diagnostic tool
725(http://stockage.univ-brest.fr/~grima/Ariane/).
726
727% -------------------------------------------------------------------------------------------------------------
728%       Other Diagnostics
729% -------------------------------------------------------------------------------------------------------------
730\subsection{Other Diagnostics (\key{diahth}, \key{diaar5})}
731\label{MISC_diag_others}
732
733
734Aside from the standard model variables, other diagnostics can be computed
735on-line. The available ready-to-add diagnostics routines can be found in directory DIA.
736Among the available diagnostics the following ones are obtained when defining
737the \key{diahth} CPP key:
738
739- the mixed layer depth (based on a density criterion, \citet{de_Boyer_Montegut_al_JGR04}) (\mdl{diahth})
740
741- the turbocline depth (based on a turbulent mixing coefficient criterion) (\mdl{diahth})
742
743- the depth of the 20\deg C isotherm (\mdl{diahth})
744
745- the depth of the thermocline (maximum of the vertical temperature gradient) (\mdl{diahth})
746
747The poleward heat and salt transports, their advective and diffusive component, and
748the meriodional stream function can be computed on-line in \mdl{diaptr} by setting
749\np{ln\_diaptr} to true (see the \textit{namptr} namelist below). 
750When \np{ln\_subbas}~=~true, transports and stream function are computed
751for the Atlantic, Indian, Pacific and Indo-Pacific Oceans (defined north of 30\deg S)
752as well as for the World Ocean. The sub-basin decomposition requires an input file
753(\ifile{subbasins}) which contains three 2D mask arrays, the Indo-Pacific mask
754been deduced from the sum of the Indian and Pacific mask (Fig~\ref{Fig_mask_subasins}).
755
756%------------------------------------------namptr----------------------------------------------------
757\namdisplay{namptr} 
758%-------------------------------------------------------------------------------------------------------------
759%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
760\begin{figure}[!t] \label{Fig_mask_subasins}  \begin{center}
761\includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_mask_subasins.pdf}
762\caption {Decomposition of the World Ocean (here ORCA2) into sub-basin used in to compute
763the heat and salt transports as well as the meridional stream-function: Atlantic basin (red),
764Pacific basin (green), Indian basin (bleue), Indo-Pacific basin (bleue+green).
765Note that semi-enclosed seas (Red, Med and Baltic seas) as well as Hudson Bay
766are removed from the sub-basin. Note also that the Arctic Ocean has been split
767into Atlantic and Pacific basins along the North fold line.  }
768\end{center}   \end{figure}
769%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
770
771In addition, a series of diagnostics has been added in the \mdl{diaar5}.
772They corresponds to outputs that are required for AR5 simulations
773(see Section \ref{MISC_steric} below for one of them).
774Activating those outputs requires to define the \key{diaar5} CPP key.
775
776
777
778% ================================================================
779% Steric effect in sea surface height
780% ================================================================
781\section{Steric effect in sea surface height}
782\label{MISC_steric}
783
784
785Changes in steric sea level are caused when changes in the density of the water
786column imply an expansion or contraction of the column. It is essentially produced
787through surface heating/cooling and to a lesser extent through non-linear effects of
788the equation of state (cabbeling, thermobaricity...).
789Non-Boussinesq models contain all ocean effects within the ocean acting
790on the sea level. In particular, they include the steric effect. In contrast,
791Boussinesq models, such as \NEMO, conserve volume, rather than mass,
792and so do not properly represent expansion or contraction. The steric effect is
793therefore not explicitely represented.
794This approximation does not represent a serious error with respect to the flow field
795calculated by the model \citep{Greatbatch_JGR94}, but extra attention is required
796when investigating sea level, as steric changes are an important
797contribution to local changes in sea level on seasonal and climatic time scales.
798This is especially true for investigation into sea level rise due to global warming.
799
800Fortunately, the steric contribution to the sea level consists of a spatially uniform
801component that can be diagnosed by considering the mass budget of the world
802ocean \citep{Greatbatch_JGR94}.
803In order to better understand how global mean sea level evolves and thus how
804the steric sea level can be diagnosed, we compare, in the following, the
805non-Boussinesq and Boussinesq cases.
806
807Let denote
808$\mathcal{M}$ the total mass of liquid seawater ($\mathcal{M}=\int_D \rho dv$),
809$\mathcal{V}$ the total volume of seawater ($\mathcal{V}=\int_D dv$),
810$\mathcal{A}$ the total surface of the ocean ($\mathcal{A}=\int_S ds$),
811$\bar{\rho}$ the global mean seawater (\textit{in situ}) density ($\bar{\rho}= 1/\mathcal{V} \int_D \rho \,dv$), and
812$\bar{\eta}$ the global mean sea level ($\bar{\eta}=1/\mathcal{A}\int_S \eta \,ds$).
813
814A non-Boussinesq fluid conserves mass. It satisfies the following relations:
815\begin{equation} \label{Eq_MV_nBq} 
816\begin{split} 
817\mathcal{M} &\mathcal{V}  \;\bar{\rho}       \\
818\mathcal{V} &\mathcal{A}  \;\bar{\eta} 
819\end{split}
820\end{equation}
821Temporal changes in total mass is obtained from the density conservation equation :
822\begin{equation}  \label{Eq_Co_nBq}
823\frac{1}{e_3} \partial_t ( e_3\,\rho) + \nabla( \rho \, \textbf{U} ) = \left. \frac{\textit{emp}}{e_3}\right|_\textit{surface}
824\end{equation}
825where $\rho$ is the \textit{in situ} density, and \textit{emp} the surface mass
826exchanges with the other media of the Earth system (atmosphere, sea-ice, land).
827Its global averaged leads to the total mass change
828\begin{equation}  \label{Eq_Mass_nBq}
829\partial_t \mathcal{M} = \mathcal{A} \;\overline{\textit{emp}}
830\end{equation}
831where $\overline{\textit{emp}}=\int_S \textit{emp}\,ds$ is the net mass flux
832through the ocean surface.
833Bringing \eqref{Eq_Mass_nBq} and the time derivative of \eqref{Eq_MV_nBq} 
834together leads to the evolution equation of the mean sea level
835\begin{equation} \label{Eq_ssh_nBq}
836  \partial_t \bar{\eta} =  \frac{\overline{\textit{emp}}}{ \bar{\rho}} 
837               - \frac{\mathcal{V}}{\mathcal{A}}  \;\frac{\partial_t \bar{\rho} }{\bar{\rho}}
838\end{equation}
839The first term in equation \eqref{Eq_ssh_nBq} alters sea level by adding or
840subtracting mass from the ocean.
841The second term arises from temporal changes in the global mean
842density; $i.e.$ from steric effects.
843
844In a Boussinesq fluid, $\rho$ is replaced by $\rho_o$ in all the equation except when $\rho$ 
845appears multiplied by the gravity ($i.e.$ in the hydrostatic balance of the primitive Equations).
846In particular, the mass conservation equation, \eqref{Eq_Co_nBq}, degenerates into
847the incompressibility equation:
848\begin{equation}  \label{Eq_Co_Bq}
849\frac{1}{e_3} \partial_t ( e_3 ) + \nabla( \textbf{U} ) =  \left. \frac{\textit{emp}}{\rho_o \,e_3}\right|_ \textit{surface}
850\end{equation}
851and the global average of this equation now gives the temporal change of the total volume,
852\begin{equation}  \label{Eq_V_Bq}
853  \partial_t \mathcal{V} =   \mathcal{A} \;\frac{\overline{\textit{emp}}}{\rho_o} 
854\end{equation}
855Only the volume is conserved, not mass, or, more precisely, the mass which is conserved is the
856Boussinesq mass, $\mathcal{M}_o = \rho_o \mathcal{V}$. The total volume (or equivalently 
857the global mean sea level) is altered only by net volume fluxes across the ocean surface, 
858not by changes in mean mass of the ocean: the steric effect is missing in a Boussinesq fluid.
859 
860Nevertheless, following \citep{Greatbatch_JGR94}, the steric effect on the volume can be
861diagnosed by considering the mass budget of the ocean.
862The apparent changes in $\mathcal{M}$, mass of the ocean, which are not induced by surface
863mass flux must be compensated by a spatially uniform change in the mean sea level due to
864expansion/contraction of the ocean \citep{Greatbatch_JGR94}. In others words, the Boussinesq
865mass, $\mathcal{M}_o$, can be related to $\mathcal{M}$, the  total mass of the ocean seen
866by the Boussinesq model, via the steric contribution to the sea level, $\eta_s$, a spatially
867uniform variable, as follows:
868\begin{equation}  \label{Eq_M_Bq}
869   \mathcal{M}_o  =  \mathcal{M} + \rho_o \,\eta_s \,\mathcal{A} 
870\end{equation}
871Any change in $\mathcal{M}$ which cannot be explained by the net mass flux through
872the ocean surface is converted into a mean change in sea level. Introducing the total density
873anomaly, $\mathcal{D}= \int_D d_a \,dv$, where $d_a= (\rho -\rho_o ) / \rho_o$ 
874is the density anomaly used in \NEMO (cf. \S\ref{TRA_eos}) in \eqref{Eq_M_Bq}
875leads to a very simple form for the steric height:
876\begin{equation}  \label{Eq_steric_Bq}
877   \eta_s = - \frac{1}{\mathcal{A}} \mathcal{D} 
878\end{equation}
879
880The above formulation of the steric height of a Boussinesq ocean requires four remarks.
881First, one can be tempted to define $\rho_o$ as the initial value of $\mathcal{M}/\mathcal{V}$,
882$i.e.$ set $\mathcal{D}_{t=0}=0$, so that the initial steric height is zero. We do not
883recommend that. Indeed, in this case $\rho_o$ depends on the initial state of the ocean.
884Since $\rho_o$ has a direct effect on the dynamics of the ocean (it appears in the pressure
885gradient term of the momentum equation) it is definitively not a good idea when
886inter-comparing experiments.
887We better recommend to fixe once for all $\rho_o$ to $1035\;Kg\,m^{-3}$. This value is a
888sensible choice for the reference density used in a Boussinesq ocean climate model since,
889with the exception of only a small percentage of the ocean, density in the World Ocean
890varies by no more than 2$\%$ from this value (\cite{Gill1982}, page 47).
891
892Second, we have assumed here that the total ocean surface, $\mathcal{A}$, does not
893change when the sea level is changing as it is the case in all global ocean GCMs
894(wetting and drying of grid point is not allowed).
895 
896Third, the discretisation of \eqref{Eq_steric_Bq} depends on the type of free surface
897which is considered. In the non linear free surface case, $i.e.$ \key{vvl} defined, it is
898given by
899\begin{equation}  \label{Eq_discrete_steric_Bq}
900   \eta_s =  - \frac{ \sum_{i,\,j,\,k} d_a\; e_{1t} e_{2t} e_{3t} }
901                  { \sum_{i,\,j,\,k}         e_{1t} e_{2t} e_{3t} } 
902\end{equation}
903whereas in the linear free surface, the volume above the \textit{z=0} surface must be explicitly taken
904into account to better approximate the total ocean mass and thus the steric sea level:
905\begin{equation}  \label{Eq_discrete_steric_Bq}
906   \eta_s =  - \frac{ \sum_{i,\,j,\,k} d_a\; e_{1t}e_{2t}e_{3t} + \sum_{i,\,j} d_a\; e_{1t}e_{2t} \eta }
907                     {\sum_{i,\,j,\,k} e_{1t}e_{2t}e_{3t} + \sum_{i,\,j}           e_{1t}e_{2t} \eta } 
908\end{equation}
909
910The fourth and last remark concerns the effective sea level and the presence of sea-ice.
911In the real ocean, sea ice (and snow above it)  depresses the liquid seawater through
912its mass loading. This depression is a result of the mass of sea ice/snow system acting
913on the liquid ocean. There is, however, no dynamical effect associated with these depressions
914in the liquid ocean sea level, so that there are no associated ocean currents. Hence, the
915dynamically relevant sea level is the effective sea level, $i.e.$ the sea level as if sea ice
916(and snow) were converted to liquid seawater \citep{Campin_al_OM08}. However,
917in the current version of \NEMO the sea-ice is levitating above the ocean without
918mass exchanges between ice and ocean. Therefore the model effective sea level
919is always given by $\eta + \eta_s$, whether or not there is sea ice present.
920
921In AR5 outputs, the thermosteric sea level is demanded. It is steric sea level due to
922changes in ocean density arising just from changes in temperature. It is given by:
923\begin{equation}  \label{Eq_thermosteric_Bq}
924   \eta_s = - \frac{1}{\mathcal{A}} \int_D d_a(T,S_o,p_o) \,dv
925\end{equation}
926where $S_o$ and $p_o$ are the initial salinity and pressure, respectively.
927
928Both steric and thermosteric sea level are computed in \mdl{diaar5} which needs
929the \key{diaar5} defined to be called.
930
931
932% ================================================================
933% predefined configurations
934% ================================================================
935\section{predefined configurations}
936\label{MISC_config}
937
938There is several predefined ocean configuration which use is controlled by a specific CPP key.
939
940The key set the domain sizes (\jp{jpiglo}, \jp{jpjglo}, \jp{jpk}), the mesh and the bathymetry,
941and, in some cases, add to the model physics some specific treatments.
942
943% -------------------------------------------------------------------------------------------------------------
944%       ORCA family configurations
945% -------------------------------------------------------------------------------------------------------------
946\subsection{ORCA family: global ocean with tripolar grid}
947\label{MISC_config_orca}
948
949The NEMO system is provided with four built-in ORCA configurations which differ in the
950horizontal resolution used:
951\begin{description}
952\item[\key{orca\_r4}]  \jp{cp\_cfg}~=~orca ; \jp{jp\_cfg}~=~4
953\item[\key{orca\_r2}]  \jp{cp\_cfg}~=~orca ; \jp{jp\_cfg}~=~2
954\item[\key{orca\_r1}]  \jp{cp\_cfg}~=~orca ; \jp{jp\_cfg}~=~1
955\item[\key{orca\_r05}]  \jp{cp\_cfg}~=~orca ; \jp{jp\_cfg}~=~05
956\item[\key{orca\_r025}]  \jp{cp\_cfg}~=~orca ; \jp{jp\_cfg}~=~025
957\end{description}
958
959\subsubsection{ORCA mesh}
960
961%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
962\begin{figure}[!t] \label{Fig_MISC_ORCA_msh}  \begin{center}
963\includegraphics[width=0.98\textwidth]{./TexFiles/Figures/Fig_ORCA_NH_mesh.pdf}
964\caption {ORCA mesh conception. The departure from an isotropic Mercator grid start poleward of 20\deg N.
965The two "north pole" are the foci of a series of embedded ellipses (blue curves)
966which are determined analytically and form the i-lines of the ORCA mesh (pseudo latitudes).
967Then, following \citet{Madec_Imbard_CD96}, the normal to the series of ellipses (red curves) is computed
968which provide the j-lines of the mesh (pseudo longitudes).
969 }
970\end{center}   \end{figure}
971%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
972
973
974%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
975\begin{figure}[!tbp] \label{Fig_MISC_ORCA_e1e2}  \begin{center}
976\includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_ORCA_NH_msh05_e1_e2.pdf}
977\includegraphics[width=0.80\textwidth]{./TexFiles/Figures/Fig_ORCA_aniso.pdf}
978\caption {\textit{Top}: Horizontal scale factors ($e_1$, $e_2$) and
979\textit{Bottom}: ratio of anisotropy ($e_1 / e_2$)
980for ORCA 0.5\deg ~mesh. South of 20\deg N a Mercator grid is used ($e_1 = e_2$)
981so that the anisotropy ratio is 1. Poleward of 20\deg N, the two "north pole"
982introduce a weak anisotropy over the ocean areas ($< 1.2$) except in vicinity of Victoria Island
983(Canadian Arctic Archipelago). }
984\end{center}   \end{figure}
985%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
986
987%--------------------------------------------------TABLE--------------------------------------------------
988\begin{table}[htbp]  \label{Tab_ORCA}
989\begin{center}
990\begin{tabular}{ccccc}
991key                         & \jp{jp\_cfg} &  \jp{jpiglo} & \jp{jpiglo} &       \\ 
992\hline  \hline
993\key{orca\_r4}        &        4         &         92     &      76      &       \\
994\key{orca\_r2}       &        2         &       182     &    149      &        \\
995%\key{orca\_r1}       &        1         &       362     &     511     &        \\
996\key{orca\_r05}     &        05       &       722     &     261     &        \\
997\key{orca\_r025}   &        025     &      1442    &   1021     &        \\
998%\key{orca\_r8}       &        8         &      2882    &   2042     &        \\
999%\key{orca\_r12}     &      12         &      4322    &   3062      &       \\
1000\hline
1001\hline
1002\end{tabular}
1003\caption {Set of predefined ORCA parameters. }
1004\end{center}
1005\end{table}
1006%--------------------------------------------------------------------------------------------------------------
1007
1008The tripolar grid used in ORCA configuration ....
1009
1010NB: the two north poles position has been chosen to minimise the anisotropy ratio in
1011the Gulf Stream and kuroshio areas, two highly turbulent regions.
1012
1013ORCA~2 : a $2\deg$ zonal resolution, and a meridional resolution varying from $0.5\deg$ at the
1014equator to $2\deg cos\phi$ south of $20\deg$S (Fig. 1). The grid features two points of convergence in the
1015Northern Hemisphere, both situated on continents. Minimum resolution in high latitudes is about
101665~km in the Arctic and 50~km in the Antarctic. Local mesh refinements are applied to the
1017Mediterranean, Red, Black and Caspian Seas. None of them appears to be of particular
1018importance for the study of high latitude climate, but the fine resolution is needed in order to have
1019their local circulation and their role in the World Ocean's circulation considered correctly.
1020
1021
1022 
1023ORCA2-LIM (global ocean sea-ice configuration \citep{Timmermann_al_OM05}.
1024The horizontal mesh is based on a $2\deg \times 2\deg$ Mercator grid ($i.e.$ same zonal and
1025meridional grid spacing) which has been modified poleward 
1026of $20\deg$N in order to include two numerical inland poles \citep{Murray_JCP96}.
1027This modification is semi-analytical \citep{Madec_Imbard_CD96} 
1028and based on a series of embedded ellipses. It insures that the mesh remains
1029close to isotropy and that the smallest grid cell is along Antarctica.
1030In order to refine the meridional resolution up to $0.5\deg$ at the equator,
1031additional local transformations were applied with in the Tropics.
1032Local mesh refinements are also applied to the Mediterranean, Red, Black
1033and Caspian Seas so that the resolution is $1\deg \time 1\deg$ there.
1034There are 31 levels in the vertical, with the highest resolution (10m)
1035in the upper 150m. The bottom topography and the coastlines are derived
1036from the global atlas of Smith and Sandwell (1997).
1037
1038\key{orca\_lev10} 10 time more vertical levels
1039
1040\key{agrif}  : ORCA2-LIM plus an AGRIF zoom over the Agulhas current area
1041
1042\key{arctic}, \key{antarctic}  (not used in ORCA\_R4)
1043
1044
1045We thus only provide a brief introduction in this chapter.
1046The global coupled ocean-ice configuration is very similar to that used as part of the climate
1047model developed at GFDL for the 4th IPCC assessment of climate change (Griffies et al., 2005;
1048Gnanadesikan et al., 2006).
1049The ORCA2-LIM configuration is also the basis for the \NEMO contribution to the
1050Coordinate Ocean-ice Reference Experiments (COREs) documented in \citet{Griffies_al_OM09}.
1051These experiments employ the boundary forcing from \citet{Large_Yeager_Rep04} (see \S\ref{SBC_blk_core}),
1052which was developed for the purpose of running global coupled ocean-ice simulations without an
1053interactive atmosphere. This \citet{Large_Yeager_Rep04} dataset is available through the GFDL web
1054site \footnote{http://nomads.gfdl.noaa.gov/nomads/forms/mom4/CORE.html}.
1055The "normal year" of \citet{Large_Yeager_Rep04} has been chosen of the \NEMO distribution
1056since release v3.3.
1057
1058% -------------------------------------------------------------------------------------------------------------
1059%       GYRE family configuration
1060% -------------------------------------------------------------------------------------------------------------
1061\subsection{GYRE family: double gyre basin (\key{gyre})}
1062\label{MISC_config_gyre}
1063
1064The GYRE configuration \citep{Levy_al_OM10} have been built to simulated
1065the seasonal cycle of a double-gyre box model. It consist in an idealized domain
1066similar to that used in the studies of \citet{Drijfhout_JPO94} and \citet{Hazeleger_Drijfhout_JPO98,
1067Hazeleger_Drijfhout_JPO99, Hazeleger_Drijfhout_JGR00, Hazeleger_Drijfhout_JPO00},
1068over which an analytical seasonal forcing is applied. This allows to investigate the
1069spontaneous generation of a large number of interacting, transient mesoscale eddies
1070and their contribution to the large scale circulation.
1071
1072The domain geometry is a closed rectangular basin on the $\beta$-plane centred
1073at $\sim 30\deg$N and rotated by 45\deg, 3180~km long, 2120~km wide
1074and 4~km deep (Fig.~\ref{Fig_MISC_strait_hand}).
1075The domain is bounded by vertical walls and by a ßat bottom. The configuration is
1076meant to represent an idealized North Atlantic or North Pacific basin.
1077The circulation is forced by analytical profiles of wind and buoyancy ßuxes.
1078The applied forcings vary seasonally in a sinusoidal manner between winter
1079and summer extrema \citep{Levy_al_OM10}.
1080The wind stress is zonal and its curl changes sign at 22\deg N and 36\deg N.
1081It forces a subpolar gyre in the north, a subtropical gyre in the wider part of the domain
1082and a small recirculation gyre in the southern corner.
1083The net heat ßux takes the form of a restoring toward a zonal apparent air
1084temperature profile. A portion of the net heat ßux which comes from the solar radiation
1085is allowed to penetrate within the water column.
1086The fresh water ßux is also prescribed and varies zonally.
1087It is determined such as, at each time step, the basin-integrated ßux is zero.
1088The basin is initialised at rest with vertical profiles of temperature and salinity
1089uniformly applied to the whole domain.
1090
1091The GYRE configuration is set through the \key{gyre} CPP key. Its horizontal resolution
1092(and thus the size of the domain) is determined by setting \jp{jp\_cfg} in \hf{par\_GYRE} file: \\
1093\jp{jpiglo} $= 30 \times$ \jp{jp\_cfg} + 2   \\
1094\jp{jpjglo} $= 20 \times$ \jp{jp\_cfg} + 2   \\
1095Obviously, the namelist parameters have to be adjusted to the chosen resolution.
1096In the vertical, GYRE uses the default 30 ocean levels (\jp{jpk}=31) (Fig.~\ref{Fig_zgr}).
1097
1098The GYRE configuration is also used in benchmark test as it is very simple to increase
1099its resolution and as it does not requires any input file. For example, keeping a same model size
1100on each processor while increasing the number of processor used is very easy, even though the
1101physical integrity of the solution can be compromised.
1102
1103%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1104\begin{figure}[!t] \label{Fig_GYRE}  \begin{center}
1105\includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_GYRE.pdf}
1106\caption {Snapshot of relative vorticity at the surface of the model domain
1107in GYRE R9, R27 and R54. From \citet{Levy_al_OM10}.}
1108\end{center}   \end{figure}
1109%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1110
1111% -------------------------------------------------------------------------------------------------------------
1112%       EEL family configuration
1113% -------------------------------------------------------------------------------------------------------------
1114\subsection{EEL family: periodic channel}
1115\label{MISC_config_EEL}
1116
1117\begin{description}
1118\item[\key{eel\_r2}] 
1119\item[\key{eel\_r5}] 
1120\item[\key{eel\_r6}] 
1121\end{description}
1122
1123% -------------------------------------------------------------------------------------------------------------
1124%       POMME configuration
1125% -------------------------------------------------------------------------------------------------------------
1126\subsection{POMME: mid-latitude sub-domain}
1127\label{MISC_config_POMME}
1128
1129
1130\key{pomme\_r025} 
1131
1132
1133
Note: See TracBrowser for help on using the repository browser.