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/DEV_r1826_DOC/DOC/TexFiles/Chapters – NEMO

source: branches/DEV_r1826_DOC/DOC/TexFiles/Chapters/Chap_MISC.tex @ 1831

Last change on this file since 1831 was 1831, checked in by gm, 14 years ago

cover, namelist, rigid-lid, e3t, appendices, see ticket: #658

  • Property svn:executable set to *
File size: 44.5 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\r{} 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\r{} and 0.5\r{} 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\r{} x 1\r{} 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{cfg\_1d})}
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{cfg\_1d} 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$\Delta t=rn\_rdt$ is the time step of dynamics while $\widetilde{\Delta t}=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\Delta t} = \ldots \\ 
197\frac{\partial T}{\partial t} &\equiv \frac{T^{t+1}-T^{t-1}}{2 \widetilde{\Delta t}} = \ldots \\ 
198\frac{\partial S}{\partial t} &\equiv \frac{S^{t+1} -S^{t-1}}{2 \widetilde{\Delta t}} = \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{ \Delta t}$ 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
228Three issues to be described here:
229
230$\bullet$ Vector and memory optimisation:
231
232\key{vectopt\_loop} enables the internal loops to collapse. This is very
233a very efficient way to increase the length of vector calculations and thus
234to speed up the model on vector computers.
235 
236% Add here also one word on NPROMA technique that has been found useless, since compiler have made significant progress during the last decade.
237 
238% Add also one word on NEC specific optimisation (Novercheck option for example)
239
240\key{vectopt\_memory} is an obsolescent option. It has been introduced in order
241to reduce the memory requirement of the model at a time when in-core memory
242were rather limited. This is obviously done at the cost of increasing the CPU
243time requirement, since it suppress intermediate computations which would have
244been saved in in-core memory. Currently it is only used in the old implementation
245of the TKE physics (\key{tke\_old}) where,  when \key{vectopt\_memory} 
246is defined, the coefficients used for horizontal smoothing of $A_v^T$ and $A_v^m$ 
247are no longer computed once and for all. This reduces the memory requirement by three
2483D arrays. This option will disappear in the next \NEMO release.
249
250 
251$\bullet$ Control print %: describe here 4 things:
252
2531- \np{ln\_ctl} : compute and print the trends averaged over the interior domain
254in all TRA, DYN, LDF and ZDF modules. This option is very helpful when
255diagnosing the origin of an undesired change in model results.
256
2572- also \np{ln\_ctl} but using the nictl and njctl namelist parameters to check
258the source of differences between mono and multi processor runs.
259
2603- \key{esopa} (to be rename key\_nemo) : which is another option for model
261management. When defined, this key forces the activation of all options and
262CPP keys. For example, all tracer and momentum advection schemes are called!
263Therefore the model results have no physical meaning.
264However, this option forces both the compiler and the model to run through
265all the \textsc{Fortran} lines of the model. This allows the user to check for obvious
266compilation or execution errors with all CPP options, and errors in namelist options.
267
2684- last digit comparison (\np{nn\_bit\_cmp}). In an MPP simulation, the computation of
269a sum over the whole domain is performed as the summation over all processors of
270each of their sums over their interior domains. This double sum never gives exactly
271the same result as a single sum over the whole domain, due to truncation differences.
272The "bit comparison" option has been introduced in order to be able to check that
273mono-processor and multi-processor runs give exactly the same results.
274
275$\bullet$  Benchmark (\np{nn\_bench}). This option defines a benchmark run based on
276a GYRE configuration in which the resolution remains the same whatever the domain
277size. This allows a very large model domain to be used, just by changing the domain
278size (\jp{jpiglo}, \jp{jpjglo}) and without adjusting either the time-step or the physical
279parameterisations.
280
281
282% ================================================================
283% Elliptic solvers (SOL)
284% ================================================================
285\section{Elliptic solvers (SOL)}
286\label{MISC_sol}
287%--------------------------------------------namdom-------------------------------------------------------
288\namdisplay{namsol} 
289%--------------------------------------------------------------------------------------------------------------
290
291When the filtered sea surface height option is used, the surface pressure gradient is
292computed in \mdl{dynspg\_flt}. The force added in the momentum equation is solved implicitely.
293It is thus solution of an elliptic equation \eqref{Eq_PE_flt} for which two solvers are available:
294a Successive-Over-Relaxation scheme (SOR) and a preconditioned conjugate gradient
295scheme(PCG) \citep{Madec_al_OM88, Madec_PhD90}. The solver is selected trough the
296the value of \np{nn\_solv} (namelist parameter).
297
298The PCG is a very efficient method for solving elliptic equations on vector computers.
299It is a fast and rather easy method to use; which are attractive features for a large
300number of ocean situations (variable bottom topography, complex coastal geometry,
301variable grid spacing, islands, open or cyclic boundaries, etc ...). It does not require
302a search for an optimal parameter as in the SOR method. However, the SOR has
303been retained because it is a linear solver, which is a very useful property when
304using the adjoint model of \NEMO.
305
306At each time step, the time derivative of the sea surface height at time step $t+1$ 
307(or equivalently the divergence of the \textit{after} barotropic transport) that appears
308in the filtering forced is the solution of the elliptic equation obtained from the horizontal
309divergence of the vertical summation of \eqref{Eq_PE_flt}.
310Introducing the following coefficients:
311\begin{equation}  \label{Eq_sol_matrix}
312\begin{aligned}
313&c_{i,j}^{NS}  &&= {2 \Delta t }^2 \; \frac{H_v (i,j) \; e_{1v} (i,j)}{e_{2v}(i,j)}              \\
314&c_{i,j}^{EW} &&= {2 \Delta t }^2 \; \frac{H_u (i,j) \; e_{2u} (i,j)}{e_{1u}(i,j)}            \\
315&b_{i,j} &&= \delta_i \left[ e_{2u}M_u \right] - \delta_j \left[ e_{1v}M_v \right]\ ,   \\
316\end{aligned}
317\end{equation}
318the five-point finite difference equation \eqref{Eq_psi_total} can be rewritten as:
319\begin{equation}  \label{Eq_solmat}
320\begin{split}
321       c_{i+1,j}^{NS} D_{i+1,j}  + \;  c_{i,j+1}^{EW} D_{i,j+1}   
322  +   c_{i,j}    ^{NS} D_{i-1,j}   + \;  c_{i,j}    ^{EW} D_{i,j-1}                                          &    \\
323  -    \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}
324\end{split}
325\end{equation}
326\eqref{Eq_solmat} is a linear symmetric system of equations. All the elements of
327the corresponding matrix \textbf{A} vanish except those of five diagonals. With
328the natural ordering of the grid points (i.e. from west to east and from
329south to north), the structure of \textbf{A} is block-tridiagonal with
330tridiagonal or diagonal blocks. \textbf{A} is a positive-definite symmetric
331matrix of size $(jpi \cdot jpj)^2$, and \textbf{B}, the right hand side of
332\eqref{Eq_solmat}, is a vector.
333
334Note that in the linear free surface case, the depth that appears in \eqref{Eq_sol_matrix}
335does not vary with time, and thus the matrix can be computed once for all. In non-linear free surface
336(\key{vvl} defined) the matrix have to be updated at each time step.
337
338% -------------------------------------------------------------------------------------------------------------
339%       Successive Over Relaxation
340% -------------------------------------------------------------------------------------------------------------
341\subsection{Successive Over Relaxation (\np{nn\_solv}=2, \mdl{solsor})}
342\label{MISC_solsor}
343
344Let us introduce the four cardinal coefficients:
345\begin{align*}
346a_{i,j}^S &= c_{i,j    }^{NS}/d_{i,j}     &\qquad  a_{i,j}^W &= c_{i,j}^{EW}/d_{i,j}       \\
347a_{i,j}^E &= c_{i,j+1}^{EW}/d_{i,j}    &\qquad   a_{i,j}^N &= c_{i+1,j}^{NS}/d_{i,j}   
348\end{align*}
349where $d_{i,j} = c_{i,j}^{NS}+ c_{i+1,j}^{NS} + c_{i,j}^{EW} + c_{i,j+1}^{EW}$ 
350(i.e. the diagonal of the matrix). \eqref{Eq_solmat} can be rewritten as:
351\begin{equation}  \label{Eq_solmat_p}
352\begin{split}
353a_{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}
354\end{split}
355\end{equation}
356with $\tilde b_{i,j} = b_{i,j}/d_{i,j}$. \eqref{Eq_solmat_p} is the equation actually solved
357with the SOR method. This method used is an iterative one. Its algorithm can be
358summarised as follows (see \citet{Haltiner1980} for a further discussion):
359
360initialisation (evaluate a first guess from previous time step computations)
361\begin{equation}
362D_{i,j}^0 = 2 \, D_{i,j}^t - D_{i,j}^{t-1}
363\end{equation}
364iteration $n$, from $n=0$ until convergence, do :
365\begin{equation} \label{Eq_sor_algo}
366\begin{split}
367R_{i,j}^n  = &a_{i,j}^{N} D_{i+1,j}^n       +\,a_{i,j}^{E}  D_{i,j+1} ^n         
368         +\, a_{i,j}^{S}  D_{i-1,j} ^{n+1}+\,a_{i,j}^{W} D_{i,j-1} ^{n+1}
369                 -  D_{i,j}^n - \tilde{b}_{i,j}                                           \\
370D_{i,j} ^{n+1}  = &D_{i,j} ^{n}   + \omega \;R_{i,j}^n     
371\end{split}
372\end{equation}
373where \textit{$\omega $ }satisfies $1\leq \omega \leq 2$. An optimal value exists for
374\textit{$\omega$} which significantly accelerates the convergence, but it has to be
375adjusted empirically for each model domain (except for a uniform grid where an
376analytical expression for \textit{$\omega$} can be found \citep{Richtmyer1967}).
377The value of $\omega$ is set using \np{rn\_sor}, a \textbf{namelist} parameter.
378The convergence test is of the form:
379\begin{equation}
380\delta = \frac{\sum\limits_{i,j}{R_{i,j}^n}{R_{i,j}^n}}
381                    {\sum\limits_{i,j}{ \tilde{b}_{i,j}^n}{\tilde{b}_{i,j}^n}} \leq \epsilon
382\end{equation}
383where $\epsilon$ is the absolute precision that is required. It is recommended
384that a value smaller or equal to $10^{-6}$ is used for $\epsilon$ since larger
385values may lead to numerically induced basin scale barotropic oscillations.
386The precision is specified by setting \np{rn\_eps} (\textbf{namelist} parameter).
387In addition, two other tests are used to halt the iterative algorithm. They involve
388the number of iterations and the modulus of the right hand side. If the former
389exceeds a specified value, \np{nn\_max} (\textbf{namelist} parameter),
390or the latter is greater than $10^{15}$, the whole model computation is stopped
391and the last computed time step fields are saved in a abort.nc NetCDF file.
392In both cases, this usually indicates that there is something wrong in the model
393configuration (an error in the mesh, the initial state, the input forcing,
394or the magnitude of the time step or of the mixing coefficients). A typical value of
395$nn\_max$ is a few hundred when $\epsilon = 10^{-6}$, increasing to a few
396thousand when $\epsilon = 10^{-12}$.
397The vectorization of the SOR algorithm is not straightforward. The scheme
398contains two linear recurrences on $i$ and $j$. This inhibits the vectorisation.
399\eqref{Eq_sor_algo} can be been rewritten as:
400\begin{equation} 
401\begin{split}
402R_{i,j}^n
403= &a_{i,j}^{N}  D_{i+1,j}^n +\,a_{i,j}^{E}  D_{i,j+1} ^n
404 +\,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}      \\
405R_{i,j}^n = &R_{i,j}^n - \omega \;a_{i,j}^{S}\; R_{i,j-1}^n                                             \\
406R_{i,j}^n = &R_{i,j}^n - \omega \;a_{i,j}^{W}\; R_{i-1,j}^n
407\end{split}
408\end{equation}
409This technique slightly increases the number of iteration required to reach the convergence,
410but this is largely compensated by the gain obtained by the suppression of the recurrences.
411
412Another technique have been chosen, the so-called red-black SOR. It consist in solving successively
413\eqref{Eq_sor_algo} for odd and even grid points. It also slightly reduced the convergence rate
414but 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).
415
416The SOR method is very flexible and can be used under a wide range of conditions,
417including irregular boundaries, interior boundary points, etc. Proofs of convergence, etc.
418may be found in the standard numerical methods texts for partial differential equations.
419
420% -------------------------------------------------------------------------------------------------------------
421%       Preconditioned Conjugate Gradient
422% -------------------------------------------------------------------------------------------------------------
423\subsection{Preconditioned Conjugate Gradient  (\np{nn\_solv}=1, \mdl{solpcg}) }
424\label{MISC_solpcg}
425
426\textbf{A} is a definite positive symmetric matrix, thus solving the linear
427system \eqref{Eq_solmat} is equivalent to the minimisation of a quadratic
428functional:
429\begin{equation*}
430\textbf{Ax} = \textbf{b} \leftrightarrow \textbf{x} =\text{inf}_{y} \,\phi (\textbf{y})
431\quad , \qquad
432\phi (\textbf{y}) = 1/2 \langle \textbf{Ay},\textbf{y}\rangle - \langle \textbf{b},\textbf{y} \rangle 
433\end{equation*}
434where $\langle , \rangle$ is the canonical dot product. The idea of the
435conjugate gradient method is to search for the solution in the following
436iterative way: assuming that $\textbf{x}^n$ has been obtained, $\textbf{x}^{n+1}$ 
437is found from $\textbf {x}^{n+1}={\textbf {x}}^n+\alpha^n{\textbf {d}}^n$ which satisfies:
438\begin{equation*}
439{\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
440\end{equation*}
441and expressing $\phi (\textbf{y})$ as a function of \textit{$\alpha $}, we obtain the
442value that minimises the functional:
443\begin{equation*}
444\alpha ^n = \langle{ \textbf{r}^n , \textbf{r}^n} \rangle  / \langle {\textbf{ A d}^n, \textbf{d}^n} \rangle
445\end{equation*}
446where $\textbf{r}^n = \textbf{b}-\textbf{A x}^n = \textbf{A} (\textbf{x}-\textbf{x}^n)$ 
447is the error at rank $n$. The descent vector $\textbf{d}^n$ s chosen to be dependent
448on the error: $\textbf{d}^n = \textbf{r}^n + \beta^n \,\textbf{d}^{n-1}$. $\beta ^n$ 
449is searched such that the descent vectors form an orthogonal basis for the dot
450product linked to \textbf{A}. Expressing the condition
451$\langle \textbf{A d}^n, \textbf{d}^{n-1} \rangle = 0$ the value of $\beta ^n$ is found:
452 $\beta ^n = \langle{ \textbf{r}^n , \textbf{r}^n} \rangle  / \langle {\textbf{r}^{n-1}, \textbf{r}^{n-1}} \rangle$.
453 As a result, the errors $ \textbf{r}^n$ form an orthogonal
454base for the canonic dot product while the descent vectors $\textbf{d}^n$ form
455an orthogonal base for the dot product linked to \textbf{A}. The resulting
456algorithm is thus the following one:
457
458initialisation :
459\begin{equation*} 
460\begin{split}
461\textbf{x}^0 &= D_{i,j}^0   = 2 D_{i,j}^t - D_{i,j}^{t-1}       \quad, \text{the initial guess }     \\
462\textbf{r}^0 &= \textbf{d}^0 = \textbf{b} - \textbf{A x}^0       \\
463\gamma_0 &= \langle{ \textbf{r}^0 , \textbf{r}^0} \rangle
464\end{split}
465\end{equation*}
466
467iteration $n,$ from $n=0$ until convergence, do :
468\begin{equation} 
469\begin{split}
470\text{z}^n& = \textbf{A d}^n \\
471\alpha_n &= \gamma_n /  \langle{ \textbf{z}^n , \textbf{d}^n} \rangle \\
472\textbf{x}^{n+1} &= \textbf{x}^n + \alpha_n \,\textbf{d}^n \\
473\textbf{r}^{n+1} &= \textbf{r}^n - \alpha_n \,\textbf{z}^n \\
474\gamma_{n+1} &= \langle{ \textbf{r}^{n+1} , \textbf{r}^{n+1}} \rangle \\
475\beta_{n+1} &= \gamma_{n+1}/\gamma_{n}  \\
476\textbf{d}^{n+1} &= \textbf{r}^{n+1} + \beta_{n+1}\; \textbf{d}^{n}\\
477\end{split}
478\end{equation}
479
480
481The convergence test is:
482\begin{equation}
483\delta = \gamma_{n}\; / \langle{ \textbf{b} , \textbf{b}} \rangle \leq \epsilon
484\end{equation}
485where $\epsilon $ is the absolute precision that is required. As for the SOR algorithm,
486the whole model computation is stopped when the number of iterations, \np{nn\_max}, or
487the modulus of the right hand side of the convergence equation exceeds a
488specified value (see \S\ref{MISC_solsor} for a further discussion). The required
489precision and the maximum number of iterations allowed are specified by setting
490\np{rn\_eps} and \np{nn\_max} (\textbf{namelist} parameters).
491
492It can be demonstrated that the above algorithm is optimal, provides the exact
493solution in a number of iterations equal to the size of the matrix, and that
494the convergence rate is faster as the matrix is closer to the identity matrix,
495$i.e.$ its eigenvalues are closer to 1. Therefore, it is more efficient to solve
496a better conditioned system which has the same solution. For that purpose,
497we introduce a preconditioning matrix \textbf{Q} which is an approximation
498of \textbf{A} but much easier to invert than \textbf{A}, and solve the system:
499\begin{equation} \label{Eq_pmat}
500\textbf{Q}^{-1} \textbf{A x} = \textbf{Q}^{-1} \textbf{b}
501\end{equation}
502
503The same algorithm can be used to solve \eqref{Eq_pmat} if instead of the
504canonical dot product the following one is used:
505${\langle{ \textbf{a} , \textbf{b}} \rangle}_Q = \langle{ \textbf{a} , \textbf{Q b}} \rangle$, and
506if $\textbf{\~{b}} = \textbf{Q}^{-1}\;\textbf{b}$ and $\textbf{\~{A}} = \textbf{Q}^{-1}\;\textbf{A}$ 
507are substituted to \textbf{b} and \textbf{A} \citep{Madec_al_OM88}.
508In \NEMO, \textbf{Q} is chosen as the diagonal of \textbf{ A}, i.e. the simplest form for
509\textbf{Q} so that it can be easily inverted. In this case, the discrete formulation of
510\eqref{Eq_pmat} is in fact given by \eqref{Eq_solmat_p} and thus the matrix and
511right hand side are computed independently from the solver used.
512
513% ================================================================
514% Diagnostics
515% ================================================================
516\section{Diagnostics (DIA, IOM)}
517\label{MISC_diag}
518
519% -------------------------------------------------------------------------------------------------------------
520%       Standard Model Output
521% -------------------------------------------------------------------------------------------------------------
522\subsection{Standard Model Output (default option or \key{dimg})}
523\label{MISC_iom}
524
525%to be updated with Seb documentation on the IO
526
527The model outputs are of three types: the restart file, the output listing,
528and the output file(s). The restart file is used internally by the code when
529the user wants to start the model with initial conditions defined by a
530previous simulation. It contains all the information that is necessary in
531order for there to be no changes in the model results (even at the computer
532precision) between a run performed with several restarts and the same run
533performed in one step. It should be noted that this requires that the restart file
534contain two consecutive time steps for all the prognostic variables, and
535that it is saved in the same binary format as the one used by the computer
536that is to read it (in particular, 32 bits binary IEEE format must not be used for
537this file). The output listing and file(s) are predefined but should be checked
538and eventually adapted to the user's needs. The output listing is stored in
539the $ocean.output$ file. The information is printed from within the code on the
540logical unit $numout$. To locate these prints, use the UNIX command
541"\textit{grep -i numout}" in the source code directory.
542
543In the standard configuration, the user will find the model results in
544NetCDF files containing mean values (or instantaneous values if
545\key{diainstant} is defined) for every time-step where output is demanded.
546These outputs are defined in the \mdl{diawri} module.
547When defining \key{dimgout}, the output are written in DIMG format,
548an IEEE output format.
549
550Since version 3.2, an I/O server has been added which provides more
551flexibility in the choice of the fields to be output as well as how the
552writing work is distributed over the processors in massively parallel
553computing. It is activated when \key{dimgout} is defined.
554
555% -------------------------------------------------------------------------------------------------------------
556%       Tracer/Dynamics Trends
557% -------------------------------------------------------------------------------------------------------------
558\subsection[Tracer/Dynamics Trends (\key{trdlmd}, \textbf{key\_diatrd...})]
559                  {Tracer/Dynamics Trends (\key{trdlmd}, \key{diatrdtra}, \key{diatrddyn})}
560\label{MISC_tratrd}
561
562%to be udated this corresponds to OPA8
563When \key{diatrddyn} and/or \key{diatrddyn} cpp variables are defined, each
564trend of the dynamics and/or temperature and salinity time evolution equations
565is stored in three-dimensional arrays just after their computation ($i.e.$ at the end
566of each $dyn\cdots .F90$ and/or $tra\cdots .F90$ routine). These trends are then
567used in diagnostic routines $diadyn.F90$ and $diatra.F90$ respectively.
568In the standard model, these routines check the basin averaged properties of
569the momentum and tracer equations every \textit{ntrd } time-steps (\textbf{namelist
570parameter}). These routines are supplied as an example; they must be adapted by
571the user to his/her requirements.
572
573These two options imply the creation of several extra arrays in the in-core
574memory, increasing quite seriously the code memory requirements.
575
576% -------------------------------------------------------------------------------------------------------------
577%       On-line Floats trajectories
578% -------------------------------------------------------------------------------------------------------------
579\subsection{On-line Floats trajectories (FLO)}
580\label{FLO}
581%--------------------------------------------namflo-------------------------------------------------------
582\namdisplay{namflo} 
583%--------------------------------------------------------------------------------------------------------------
584
585The on-line computation of floats adevected either by the three dimensional velocity
586field or constraint to remain at a given depth ($w = 0$ in the computation) have been
587introduced in the system during the CLIPPER project. The algorithm used is based on
588the work of \cite{Blanke_Raynaud_JPO97}. (see also the web site describing the off-line
589use of this marvellous diagnostic tool (http://stockage.univ-brest.fr/~grima/Ariane/).
590
591% -------------------------------------------------------------------------------------------------------------
592%       Other Diagnostics
593% -------------------------------------------------------------------------------------------------------------
594\subsection{Other Diagnostics}
595\label{MISC_diag_others}
596
597%To be updated  this mainly corresponds to OPA 8
598
599Aside from the standard model variables, other diagnostics can be computed
600on-line or can be added to the model. The available ready-to-add diagnostics
601routines can be found in directory DIA. Among the available diagnostics are:
602
603- the mixed layer depth (based on a density criterion) (\mdl{diamxl})
604
605- the turbocline depth (based on a turbulent mixing coefficient criterion) (\mdl{diamxl})
606
607- the depth of the 20\r{}C isotherm (\mdl{diahth})
608
609- the depth of the thermocline (maximum of the vertical temperature gradient) (\mdl{diahth})
610
611- the meridional heat and salt transports and their decomposition (\mdl{diamfl})
612
613In addition, a series of diagnostics has been added in the \mdl{diaar5}.
614They corresponds to outputs that are required for AR5 simulations
615(see Section \ref{MISC_steric} below for one of them).
616Activating those outputs requires to define the \key{diaar5} CPP key.
617
618
619
620% ================================================================
621% Steric effect in sea surface height
622% ================================================================
623\section{Steric effect in sea surface height}
624\label{MISC_steric}
625
626
627Changes in steric sea level are caused when changes in the density of the water
628column imply an expansion or contraction of the column. It is essentially produced
629through surface heating/cooling and to a lesser extent through non-linear effects of
630the equation of state (cabbeling, thermobaricity...).
631Non-Boussinesq models contain all ocean effects within the ocean acting
632on the sea level. In particular, they include the steric effect. In contrast,
633Boussinesq models, such as \NEMO, conserve volume, rather than mass,
634and so do not properly represent expansion or contraction. The steric effect is
635therefore not explicitely represented.
636This approximation does not represent a serious error with respect to the flow field
637calculated by the model \citep{Greatbatch_JGR94}, but extra attention is required
638when investigating sea level, as steric changes are an important
639contribution to local changes in sea level on seasonal and climatic time scales.
640This is especially true for investigation into sea level rise due to global warming.
641
642Fortunately, the steric contribution to the sea level consists of a spatially uniform
643component that can be diagnosed by considering the mass budget of the world
644ocean \citep{Greatbatch_JGR94}.
645In order to better understand how global mean sea level evolves and thus how
646the steric sea level can be diagnosed, we compare, in the following, the
647non-Boussinesq and Boussinesq cases.
648
649Let denote
650$\mathcal{M}$ the total mass of liquid seawater ($\mathcal{M}=\int_D \rho dv$),
651$\mathcal{V}$ the total volume of seawater ($\mathcal{V}=\int_D dv$),
652$\mathcal{A}$ the total surface of the ocean ($\mathcal{A}=\int_S ds$),
653$\bar{\rho}$ the global mean seawater (\textit{in situ}) density ($\bar{\rho}= 1/\mathcal{V} \int_D \rho \,dv$), and
654$\bar{\eta}$ the global mean sea level ($\bar{\eta}=1/\mathcal{A}\int_S \eta \,ds$).
655
656A non-Boussinesq fluid conserves mass. It satisfies the following relations:
657\begin{equation} \label{Eq_MV_nBq} 
658\begin{split} 
659\mathcal{M} &\mathcal{V}  \;\bar{\rho}       \\
660\mathcal{V} &\mathcal{A}  \;\bar{\eta} 
661\end{split}
662\end{equation}
663Temporal changes in total mass is obtained from the density conservation equation :
664\begin{equation}  \label{Eq_Co_nBq}
665\frac{1}{e_3} \partial_t ( e_3\,\rho) + \nabla( \rho \, \textbf{U} ) = \left. \frac{\textit{emp}}{e_3}\right|_\textit{surface}
666\end{equation}
667where $\rho$ is the \textit{in situ} density, and \textit{emp} the surface mass
668exchanges with the other media of the Earth system (atmosphere, sea-ice, land).
669Its global averaged leads to the total mass change
670\begin{equation}  \label{Eq_Mass_nBq}
671\partial_t \mathcal{M} = \mathcal{A} \;\overline{\textit{emp}}
672\end{equation}
673where $\overline{\textit{emp}}=\int_S \textit{emp}\,ds$ is the net mass flux
674through the ocean surface.
675Bringing \eqref{Eq_Mass_nBq} and the time derivative of \eqref{Eq_MV_nBq} 
676together leads to the evolution equation of the mean sea level
677\begin{equation} \label{Eq_ssh_nBq}
678  \partial_t \bar{\eta} =  \frac{\overline{\textit{emp}}}{ \bar{\rho}} 
679               - \frac{\mathcal{V}}{\mathcal{A}}  \;\frac{\partial_t \bar{\rho} }{\bar{\rho}}
680\end{equation}
681The first term in equation \eqref{Eq_ssh_nBq} alters sea level by adding or
682subtracting mass from the ocean.
683The second term arises from temporal changes in the global mean
684density; $i.e.$ from steric effects.
685
686In a Boussinesq fluid, $\rho$ is replaced by $\rho_o$ in all the equation except when $\rho$ 
687appears multiplied by the gravity ($i.e.$ in the hydrostatic balance of the primitive Equations).
688In particular, the mass conservation equation, \eqref{Eq_Co_nBq}, degenerates into
689the incompressibility equation:
690\begin{equation}  \label{Eq_Co_Bq}
691\frac{1}{e_3} \partial_t ( e_3 ) + \nabla( \textbf{U} ) =  \left. \frac{\textit{emp}}{\rho_o \,e_3}\right|_ \textit{surface}
692\end{equation}
693and the global average of this equation now gives the temporal change of the total volume,
694\begin{equation}  \label{Eq_V_Bq}
695  \partial_t \mathcal{V} =   \mathcal{A} \;\frac{\overline{\textit{emp}}}{\rho_o} 
696\end{equation}
697Only the volume is conserved, not mass, or, more precisely, the mass which is conserved is the
698Boussinesq mass, $\mathcal{M}_o = \rho_o \mathcal{V}$. The total volume (or equivalently 
699the global mean sea level) is altered only by net volume fluxes across the ocean surface, 
700not by changes in mean mass of the ocean: the steric effect is missing in a Boussinesq fluid.
701 
702Nevertheless, following \citep{Greatbatch_JGR94}, the steric effect on the volume can be
703diagnosed by considering the mass budget of the ocean.
704The apparent changes in $\mathcal{M}$, mass of the ocean, which are not induced by surface
705mass flux must be compensated by a spatially uniform change in the mean sea level due to
706expansion/contraction of the ocean \citep{Greatbatch_JGR94}. In others words, the Boussinesq
707mass, $\mathcal{M}_o$, can be related to $\mathcal{M}$, the  total mass of the ocean seen
708by the Boussinesq model, via the steric contribution to the sea level, $\eta_s$, a spatially
709uniform variable, as follows:
710\begin{equation}  \label{Eq_M_Bq}
711   \mathcal{M}_o  =  \mathcal{M} + \rho_o \,\eta_s \,\mathcal{A} 
712\end{equation}
713Any change in $\mathcal{M}$ which cannot be explained by the net mass flux through
714the ocean surface is converted into a mean change in sea level. Introducing the total density
715anomaly, $\mathcal{D}= \int_D d_a \,dv$, where $d_a= (\rho -\rho_o ) / \rho_o$ 
716is the density anomaly used in \NEMO (cf. \S\ref{TRA_eos}) in \eqref{Eq_M_Bq}
717leads to a very simple form for the steric height:
718\begin{equation}  \label{Eq_steric_Bq}
719   \eta_s = - \frac{1}{\mathcal{A}} \mathcal{D} 
720\end{equation}
721
722The above formulation of the steric height of a Boussinesq ocean requires four remarks.
723First, one can be tempted to define $\rho_o$ as the initial value of $\mathcal{M}/\mathcal{V}$,
724$i.e.$ set $\mathcal{D}_{t=0}=0$, so that the initial steric height is zero. We do not
725recommend that. Indeed, in this case $\rho_o$ depends on the initial state of the ocean.
726Since $\rho_o$ has a direct effect on the dynamics of the ocean (it appears in the pressure
727gradient term of the momentum equation) it is definitively not a good idea when
728inter-comparing experiments.
729We better recommend to fixe once for all $\rho_o$ to $1035\;Kg\,m^{-3}$. This value is a
730sensible choice for the reference density used in a Boussinesq ocean climate model since,
731with the exception of only a small percentage of the ocean, density in the World Ocean
732varies by no more than 2$\%$ from this value (\cite{Gill1982}, page 47).
733
734Second, we have assumed here that the total ocean surface, $\mathcal{A}$, does not
735change when the sea level is changing as it is the case in all global ocean GCMs
736(wetting and drying of grid point is not allowed).
737 
738Third, the discretisation of \eqref{Eq_steric_Bq} depends on the type of free surface
739which is considered. In the non linear free surface case, $i.e.$ \key{vvl} defined, it is
740given by
741\begin{equation}  \label{Eq_discrete_steric_Bq}
742   \eta_s =  - \frac{ \sum_{i,\,j,\,k} d_a\; e_{1t} e_{2t} e_{3t} }
743                  { \sum_{i,\,j,\,k}         e_{1t} e_{2t} e_{3t} } 
744\end{equation}
745whereas in the linear free surface, the volume above the \textit{z=0} surface must be explicitly taken
746into account to better approximate the total ocean mass and thus the steric sea level:
747\begin{equation}  \label{Eq_discrete_steric_Bq}
748   \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 }
749                     {\sum_{i,\,j,\,k} e_{1t}e_{2t}e_{3t} + \sum_{i,\,j}           e_{1t}e_{2t} \eta } 
750\end{equation}
751
752The fourth and last remark concerns the effective sea level and the presence of sea-ice.
753In the real ocean, sea ice (and snow above it)  depresses the liquid seawater through
754its mass loading. This depression is a result of the mass of sea ice/snow system acting
755on the liquid ocean. There is, however, no dynamical effect associated with these depressions
756in the liquid ocean sea level, so that there are no associated ocean currents. Hence, the
757dynamically relevant sea level is the effective sea level, $i.e.$ the sea level as if sea ice
758(and snow) were converted to liquid seawater \citep{Campin_al_OM08}. However,
759in the current version of \NEMO the sea-ice is levitating above the ocean without
760mass exchanges between ice and ocean. Therefore the model effective sea level
761is always given by $\eta + \eta_s$, whether or not there is sea ice present.
762
763In AR5 outputs, the thermosteric sea level is demanded. It is steric sea level due to
764changes in ocean density arising just from changes in temperature. It is given by:
765\begin{equation}  \label{Eq_thermosteric_Bq}
766   \eta_s = - \frac{1}{\mathcal{A}} \int_D d_a(T,S_o,p_o) \,dv
767\end{equation}
768where $S_o$ and $p_o$ are the initial salinity and pressure, respectively.
769
770Both steric and thermosteric sea level are computed in \mdl{diaar5} which needs
771the \key{diaar5} defined to be called.
772
Note: See TracBrowser for help on using the repository browser.