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

source: trunk/DOC/TexFiles/Chapters/Chap_MISC.tex @ 1225

Last change on this file since 1225 was 1225, checked in by gm, 15 years ago

phase the namelist with NEMO v3 + update the references & figures see ticket #284

  • Property svn:executable set to *
File size: 39.0 KB
Line 
1% ================================================================
2% Chapter Ñ Miscellaneous Topics
3% ================================================================
4\chapter{Miscellaneous Topics (xxx)}
5\label{MISC}
6\minitoc
7
8% ================================================================
9% Representation of Unresolved Straits
10% ================================================================
11\section{Representation of Unresolved Straits}
12\label{MISC_strait}
13
14% In climate modeling, it is often necessary to allow water masses that are separated by land to exchange properties. This situation arises in models when the grid mesh is too coarse to resolve narrow passageways that in reality provide crucial connections between water masses. For example, coarse grid spacing typically closes off the Mediterranean from the Atlantic at the Straits of Gibraltar. In this case, it is important for climate models to include the effects of salty water entering the Atlantic from the Mediterranean. Likewise, it is important for the Mediterranean to replenish its supply of water from the Atlantic to balance the net evaporation occurring over the Mediterranean region.
15% Same problem occurs as soon as important straits are not properly resolved by the mesh. For example it arises in ORCA 1/4\r{} in several straits of the Indonesian archipelago (Ombai, Lombok...).
16% We describe here the three methods that can be used in \NEMO to handle such improperly resolved straits.
17%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. 
18
19% Note: such changes are so specific to a given configuration that no attempt has been made to set them in a generic way. Nevertheless, an example of how they can be set up is given in the ORCA2 configuration (\key{ORCA_R2}).
20
21% -------------------------------------------------------------------------------------------------------------
22%       Hand made geometry changes
23% -------------------------------------------------------------------------------------------------------------
24\subsection{Hand made geometry changes}
25\label{MISC_strait_hand}
26
27$\bullet$ reduced scale factor, also called partially open face (Hallberg, personnal communication 2006)
28%also called partially open cell  or partial closed cells
29
30$\bullet$ increase of the viscous boundary layer thickness by local increase of the fmask value at the coast
31
32\colorbox{yellow}{Add a short description of scale factor changes staff and fmask increase}
33
34
35%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
36\begin{figure}[!tbp] \label{Fig_MISC_strait_hand}  \begin{center}
37\includegraphics[width=0.80\textwidth]{./TexFiles/Figures/Fig_Gibraltar.pdf}
38\includegraphics[width=0.80\textwidth]{./TexFiles/Figures/Fig_Gibraltar2.pdf}
39\caption {Example of the Gibraltar strait defined in a 1\r{} x 1\r{} mesh.
40\textit{Top}: using partially open cells. The meridional scale factor at $v$-point
41is reduced on both sides of the strait to account for the real width of the strait
42(about 20 km). Note that the scale factors of the strait $T$-point remains unchanged.
43\textit{Bottom}: using viscous boundary layers. The four fmask parameters
44along the strait coastlines are set to a value larger than 4, $i.e.$ "strong" no-slip
45case (see Fig.\ref{Fig_LBC_shlat}) creating a large viscous boundary layer
46that allows a reduced transport through the strait.}
47\end{center}   \end{figure}
48%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
49
50% -------------------------------------------------------------------------------------------------------------
51% Cross Land Advection
52% -------------------------------------------------------------------------------------------------------------
53\subsection{Cross Land Advection (\textit{tracla} module)}
54\label{MISC_strait_cla}
55
56%--------------------------------------------namcla--------------------------------------------------------
57\namdisplay{namcla} 
58%--------------------------------------------------------------------------------------------------------------
59
60\colorbox{yellow}{Add a short description of CLA staff here or in lateral boundary condition chapter?}
61
62% ================================================================
63% Closed seas
64% ================================================================
65\section{Closed seas}
66\label{MISC_closea}
67
68
69% ================================================================
70% Sub-Domain Functionality (\textit{nizoom, njzoom}, namelist parameters)
71% ================================================================
72\section{Sub-Domain Functionality (\jp{jpizoom}, \jp{jpjzoom})}
73\label{MISC_zoom}
74
75The sub-domain functionality, also improperly called the zoom option
76(improperly because it is not associated with a change in model resolution)
77is a quite simple function that allows a simulation over a sub-domain of an
78already defined configuration ($i.e.$ without defining a new mesh, initial
79state and forcings). This option can be useful for testing the user settings
80of surface boundary conditions, or the initial ocean state of a huge ocean
81model configuration while having a small computer memory requirement.
82It can also be used to easily test specific physics in a sub-domain (for example,
83see \citep{Madec1996} for a test of the coupling used in the global ocean
84version of OPA between sea-ice and ocean model over the Arctic or Antarctic
85ocean, using a sub-domain). In the standard model, this option does not
86include any specific treatment for the ocean boundaries of the sub-domain:
87they are considered as artificial vertical walls. Nevertheless, it is quite easy
88to add a restoring term toward a climatology in the vicinity of such boundaries
89(see \S\ref{TRA_dmp}).
90
91In order to easily define a sub-domain over which the computation can be
92performed, the dimension of all input arrays (ocean mesh, bathymetry,
93forcing, initial state, ...) are defined as \jp{jpidta}, \jp{jpjdta} and \jp{jpkdta} 
94(\mdl{par\_oce} module), while the computational domain is defined through
95\jp{jpiglo}, \jp{jpjglo} and \jp{jpk} (\mdl{par\_oce} module). When running the
96model over the whole domain, the user sets \jp{jpiglo}=\jp{jpidta} \jp{jpjglo}=\jp{jpjdta} 
97and \jp{jpk}=\jp{jpkdta}. When running the model over a sub-domain, the user
98has to provide the size of the sub-domain, (\jp{jpiglo}, \jp{jpjglo}, \jp{jpkglo}),
99and the indices of the south western corner as \jp{jpizoom} and \jp{jpjzoom} in
100the \mdl{par\_oce} module (Fig.~\ref{Fig_LBC_zoom}).
101
102Note that a third set of dimensions exist, \jp{jpi}, \jp{jpj} and \jp{jpk} which is
103actually used to perform the computation. It is set by default to \jp{jpi}=\jp{jpjglo} 
104and \jp{jpj}=\jp{jpjglo}, except for massively parallel computing where the
105computational domain is laid out on local processor memories following a 2D
106horizontal splitting. % (see {\S}IV.2-c) ref to the section to be updated
107
108%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
109\begin{figure}[!ht] \label{Fig_LBC_zoom}  \begin{center}
110\includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_LBC_zoom.pdf}
111\caption {Position of a model domain compared to the data input domain when the zoom functionality is used.}
112\end{center}   \end{figure}
113%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
114
115
116% ================================================================
117% 1D model functionality
118% ================================================================
119\section{Water column model: 1D model (\key{cfg\_1d})}
120\label{MISC_1D}
121
122The 1D model option simulates a stand alone water column within the 3D \NEMO 
123system. It can be applied to the ocean alone or to the ocean-ice system and can
124include passive tracers or a biogeochemical model. It is set up by defining the
125\key{cfg\_1d} CPP key. This 1D model is a very useful tool  \textit{(a)} to learn
126about the physics and numerical treatment of vertical mixing processes ; \textit{(b)} 
127to investigate suitable parameterisations of unresolved turbulence (wind steering,
128langmuir circulation, skin layers) ; \textit{(c)} to compare the behaviour of different
129vertical mixing schemes  ; \textit{(d)} to perform sensitivity studies on the vertical
130diffusion at a particular point of the ocean global domain ; \textit{(d)} to produce
131extra diagnostics, without the large memory requirement of the full 3D model.
132
133The methodology is based on the use of the zoom functionality (see
134\S\ref{MISC_zoom}), with some extra routines. There is no need to define a new
135mesh, bathymetry, initial state or forcing, since the 1D model will use those of the
136configuration it is a zoom of.
137
138% ================================================================
139% Accelerating the Convergence
140% ================================================================
141\section{Accelerating the Convergence (\np{nn\_acc} = 1)}
142\label{MISC_acc}
143%--------------------------------------------namdom-------------------------------------------------------
144\namdisplay{namdom} 
145%--------------------------------------------------------------------------------------------------------------
146
147% Steven update just bellow...   not sure it  is what I vant to say
148%Searching an equilibrium state with an ocean model requires repeated very long time
149%integrations (each of a few thousand years for a global model). Due to the size of
150Searching an equilibrium state with an ocean model requires very long time
151integration (a few thousand years for a global model). Due to the size of
152the time step required for numerical stability (less than a
153few hours), this usually requires a large elapsed time. In order to overcome
154this problem, \citet{Bryan1984} introduces a technique that is intended to accelerate
155the spin up to equilibrium. It uses a larger time step in
156the thermodynamic evolution equations than in the dynamic evolution
157equations. It does not affect the equilibrium solution but modifies the
158trajectory to reach it.
159
160The acceleration of convergence option is used when \np{nn\_acc}=1. In that case,
161$\Delta t=rdt$ is the time step of dynamics while $\widetilde{\Delta t}=rdttra$ is the
162tracer time-step. Their values are set from the \np{rdt} and \np{rdttra}  namelist
163parameters. The set of prognostic equations to solve becomes:
164\begin{equation} \label{Eq_acc}
165\begin{split}
166\frac{\partial \textbf{U}_h }{\partial t} 
167   &\equiv \frac{\textbf{U}_h ^{t+1}-\textbf{U}_h^{t-1} }{2\Delta t} = \ldots \\ 
168\frac{\partial T}{\partial t} &\equiv \frac{T^{t+1}-T^{t-1}}{2 \widetilde{\Delta t}} = \ldots \\ 
169\frac{\partial S}{\partial t} &\equiv \frac{S^{t+1} -S^{t-1}}{2 \widetilde{\Delta t}} = \ldots \\ 
170\end{split}
171\end{equation}
172
173\citet{Bryan1984} has examined the consequences of this distorted physics.
174Free waves have a slower phase speed, their meridional structure is slightly
175modified, and the growth rate of baroclinically unstable waves is reduced
176but with a wider range of instability. This technique is efficient for
177searching for an equilibrium state in coarse resolution models. However its
178application is not suitable for many oceanic problems: it cannot be used for
179transient or time evolving problems (in particular, it is very questionable
180to use this technique when there is a seasonal cycle in the forcing fields),
181and it cannot be used in high-resolution models where baroclinically
182unstable processes are important. Moreover, the vertical variation of
183$\widetilde{ \Delta t}$ implies that the heat and salt contents are no longer
184conserved due to the vertical coupling of the ocean level through both
185advection and diffusion.
186% first mention of depth varying tilda-delta-t!   and namelist parameter associated to that are to be described
187
188
189% ================================================================
190% Model optimisation, Control Print and Benchmark
191% ================================================================
192\section{Model Optimisation, Control Print and Benchmark}
193\label{MISC_opt}
194%--------------------------------------------namctl-------------------------------------------------------
195\namdisplay{namctl} 
196%--------------------------------------------------------------------------------------------------------------
197
198% \gmcomment{why not make these bullets into subsections?}
199
200Three issues to be described here:
201
202$\bullet$ Vector and memory optimisation:
203
204\key{vectopt\_loop} enables internal loop collapse, a very efficient way to increase
205the length of vector calculations and thus speed up the model on vector computers.
206 
207% Add here also one word on NPROMA technique that has been found useless, since compiler have made significant progress during the last decade.
208 
209% Add also one word on NEC specific optimisation (Novercheck option for example)
210
211\key{vectopt\_memory} has been introduced in order to reduce the memory
212requirement of the model. This is obviously done at the cost of increasing the
213CPU time requirement, since it suppress intermediate computations which would
214have been saved in in-core memory. This feature has not been intensively used.
215In fact, currently it is only implemented for the TKE physics, in which,  when
216\key{vectopt\_memory} is defined, the coefficients used for horizontal smoothing
217of $A_v^T$ and $A_v^m$ are no longer computed once and for all. This reduces
218the memory requirement by three 2D arrays.
219
220 
221$\bullet$ Control print %: describe here 4 things:
222
2231- \np{ln\_ctl} : compute and print the trends averaged over the interior domain
224in all TRA, DYN, LDF and ZDF modules. This option is very helpful when
225diagnosing the origin of an undesired change in model results.
226
2272- also \np{ln\_ctl} but using the nictl and njctl namelist parameters to check
228the source of differences between mono and multi processor runs.
229
2303- \key{esopa} (to be rename key\_nemo) : which is another option for model
231management. When defined, this key forces the activation of all options and
232CPP keys. For example, all tracer and momentum advection schemes are called!
233There is therefore no physical meaning associated with the model results.
234However, this option forces both the compiler and the model to run through
235all the \textsc{Fortran} lines of the model. This allows the user to check for obvious
236compilation or execution errors with all CPP options, and errors in namelist options.
237
2383- \key{esopa} (to be rename key\_nemo) : which is another option for model
239management. When defined, this key forces the activation of all options and CPP keys.
240For example, all tracer and momentum advection schemes are called! There is
241therefore no physical meaning associated with the model results. However, this option
242forces both the compiler and the model to run through all the Fortran lines of the model.
243This allows the user to check for obvious compilation or execution errors with all CPP
244options, and errors in namelist options.
245
2464- last digit comparison (\np{nbit\_cmp}). In an MPP simulation, the computation of
247a sum over the whole domain is performed as the summation over all processors of
248each of their sums over their interior domains. This double sum never gives exactly
249the same result as a single sum over the whole domain, due to truncation differences.
250The "bit comparison" option has been introduced in order to be able to check that
251mono-processor and multi-processor runs give exactly the same results.
252
253$\bullet$  Benchmark (\np{nbench}). This option defines a benchmark run based on
254a GYRE configuration in which the resolution remains the same whatever the domain
255size. This allows a very large model domain to be used, just by changing the domain
256size (\jp{jpiglo}, \jp{jpjglo}) and without adjusting either the time-step or the physical
257parameterisations.
258
259
260% ================================================================
261% Elliptic solvers (SOL)
262% ================================================================
263\section{Elliptic solvers (SOL directory)}
264\label{MISC_sol}
265%--------------------------------------------namdom-------------------------------------------------------
266\namdisplay{namsol} 
267%--------------------------------------------------------------------------------------------------------------
268
269The computation of the surface pressure gradient with a rigid lid assumption
270requires the computation of $\partial_t \psi$, the time evolution of the
271barotropic streamfunction. $\partial_t \psi$ is the solution of an elliptic
272equation \eqref{Eq_PE_psi} for which three solvers are available: a
273Successive-Over-Relaxation scheme (SOR), a preconditioned conjugate gradient
274scheme(PCG) \citep{Madec1988, Madec1990} and a Finite Elements Tearing and
275Interconnecting scheme (FETI) \citep{Guyon_al_EP99, Guyon_al_CalPar99}.
276The PCG is a very efficient method for solving elliptic equations on vector computers.
277It is a fast and rather easy method to use; which are attractive features for a large
278number of ocean situations (variable bottom topography, complex coastal geometry,
279variable grid spacing, islands, open or cyclic boundaries, etc ...). It does not require
280a search for an optimal parameter as in the SOR method. However, the SOR has
281been retained because it is a linear solver, which is a very useful property when
282using the adjoint model of \NEMO. The FETI solver is a very efficient method on
283massively parallel computers. However, it has never been used since OPA 8.0.
284The current version in \NEMO should not even successfully go through the
285compilation phase.
286
287The surface pressure gradient is computed in \mdl{dynspg}. The solver used
288(PCG or SOR) depending on the value of \np{nsolv} (namelist parameter).
289At each time step the time derivative of the barotropic streamfunction is
290the solution of \eqref{Eq_psi_total}. Introducing the following coefficients:
291
292\begin{equation} 
293\begin{aligned}
294&C_{i,j}^{NS} &&= \frac{e_{2v}(i,j)}{\left( H_v (i,j) e_{1v} (i,j)\right)}\\
295&C_{i,j}^{EW} &&= \frac{e_{1u}(i,j)}{\left( H_u (i,j) e_{2u} (i,j)\right)}\\
296&B_{i,j} &&= \delta_i \left( e_{2v}M_v \right) - \delta_j \left( e_{1u}M_u \right)\\
297\end{aligned}
298\end{equation}
299
300the five-point finite difference equation \eqref{Eq_psi_total} can be rewritten as:
301
302\begin{multline} \label{Eq_solmat}
303C_{i+1,j}^{NS} {   \left\frac{\partial \psi}{\partial t } \right)    }_{i+1,j} + \;
304C_{i,j+1}^{EW}{   \left\frac{\partial \psi}{\partial t } \right)    }_{i,j+1} + \;
305C_{i,j}    ^{NS} {   \left\frac{\partial \psi}{\partial t } \right)    }_{i-1,j} + \;
306C_{i,j}    ^{EW}{   \left\frac{\partial \psi}{\partial t } \right)    }_{i,j-1}\\
307-\left(C_{i+1,j}^{NS} + C_{i,j+1}^{EW} + C_{i,j}^{NS} + C_{i,j}^{EW} \right)   {   \left\frac{\partial \psi}{\partial t } \right)    }_{i,j}  =  B_{i,j}
308\end{multline}
309\eqref{Eq_solmat} is a linear symmetric system of equations. All the elements of
310the corresponding matrix \textbf{A} vanish except those of five diagonals. With
311the natural ordering of the grid points (i.e. from west to east and from
312south to north), the structure of \textbf{A} is block-tridiagonal with
313tridiagonal or diagonal blocks. \textbf{A} is a positive-definite symmetric
314matrix of size $(jpi \cdot jpj)^2$, and \textbf{B}, the right hand side of
315\eqref{Eq_solmat}, is a vector.
316
317% -------------------------------------------------------------------------------------------------------------
318%       Successive Over Relaxation
319% -------------------------------------------------------------------------------------------------------------
320\subsection{Successive Over Relaxation \np{nsolv}=2}
321\label{MISC_solsor}
322
323Let us introduce the four cardinal coefficients: $A_{i,j}^S = C_{i,j}^{NS}/D_{i,j}\,$,
324$A_{i,j}^W = C_{i,j}^{EW}/D_{i,j}\,$, $A_{i,j}^E = C_{i,j+1}^{EW}/D_{i,j}\,$ and $A_{i,j}^N = C_{i+1,j}^{NS}/D_{i,j}\,$, and define
325$\tilde B_{i,j} = B_{i,j}/D_{i,j}\,$, where $D_{i,j} = C_{i,j}^{NS}+ C_{i+1,j}^{NS} + C_{i,j}^{EW} + C_{i,j+1}^{EW} $ (i.e. the diagonal of
326\textbf{A}). (VII.5.1) can be rewritten as:
327
328\begin{multline} \label{Eq_solmat_p}
329    A_{i,j}^{N}  {   \left\frac{\partial \psi}{\partial t } \right)    }_{i+1,j   } 
330+\,A_{i,j}^{E}  {   \left\frac{\partial \psi}{\partial t } \right)    }_{i    ,j+1}       \\
331+\,A_{i,j}^{S}  {   \left\frac{\partial \psi}{\partial t } \right)    }_{i-1 ,j    } 
332+\,A_{i,j}^{W} {   \left\frac{\partial \psi}{\partial t } \right)    }_{i    ,j-1} 
333               -  {   \left\frac{\partial \psi}{\partial t } \right)    }_{i,j} = \tilde B_{i,j}
334\end{multline}
335
336The SOR method used is an iterative method. Its algorithm can be summarised
337as follows [see \citet{Haltiner1980} for a further discussion]:
338
339initialisation (evaluate a first guess from previous time step computations)
340\begin{equation}
341\left\frac{\partial \psi}{\partial t } \right)_{i,j}^0 = 2{\left\frac{\partial \psi}{\partial t } \right)_{i,j}^t} - {\left\frac{\partial \psi}{\partial t } \right)_{i,j}^{t-1}}
342\end{equation}
343iteration $n$, from $n=0$ until convergence, do :
344\begin{multline} 
345R_{i,j}^n
346= A_{i,j}^{N}  {   \left\frac{\partial \psi}{\partial t } \right)    }_{i+1,j}^n
347+\,A_{i,j}^{E}  {   \left\frac{\partial \psi}{\partial t } \right)    }_{i,j+1} ^n     \\
348+\,A_{i,j}^{S}  {   \left\frac{\partial \psi}{\partial t } \right)    }_{i-1,j} ^{n+1}
349+\,A_{i,j}^{W} {   \left\frac{\partial \psi}{\partial t } \right)    }_{i,j-1} ^{n+1} 
350                   -  {   \left\frac{\partial \psi}{\partial t } \right)    }_{i,j}^n - \tilde B_{i,j}
351\end{multline}
352\begin{equation} 
353     {   \left\frac{\partial \psi}{\partial t } \right)    }_{i,j} ^{n+1}
354  = {   \left\frac{\partial \psi}{\partial t } \right)    }_{i,j} ^{n}
355  + \omega \;R_{i,j}^n
356\end{equation}
357where \textit{$\omega $ }satisfies $1\leq \omega \leq 2$. An optimal value exists for
358\textit{$\omega$} which significantly accelerates the convergence, but it has to be
359adjusted empirically for each model domain (except for a uniform grid where an
360analytical expression for \textit{$\omega$} can be found \citep{Richtmyer1967}).
361The value of $\omega$ is set using \textit{sor}, a \textbf{namelist} parameter.
362The convergence test is of the form:
363\begin{equation}
364\delta = \frac{\sum\limits_{i,j}{R_{i,j}^n}{R_{i,j}^n}}{\sum\limits_{i,j}{ \tilde B_{i,j}^n}{\tilde B_{i,j}^n}} \leq \epsilon
365\end{equation}
366where $\epsilon$ is the absolute precision that is required. It is recommended
367that a value smaller or equal to $10^{-3}$ is used for $\epsilon$ since larger
368values may lead to numerically induced basin scale barotropic oscillations. In fact,
369for an eddy resolving configuration or in a filtered free surface case, a value three
370orders of magnitude smaller than this should be used. The precision is specified by
371setting \textit{eps} (\textbf{namelist parameter}). In addition, two other tests are
372used to halt the iterative algorithm. They involve the number of iterations and the
373modulus of the right hand side. If the former exceeds a specified value, \textit{nmax} 
374(\textbf{namelist parameter}), or the latter is greater than $10^{15}$, the whole
375model computation is stopped and the last computed time step fields are saved
376in the standard output file. In both cases, this usually indicates that there is something
377wrong in the model configuration (an error in the mesh, the initial state, the input forcing,
378or the magnitude of the time step or of the mixing coefficients). A typical value of
379$nmax$ is a few hundred when $\epsilon = 10^{-6}$, increasing to a few
380thousand when $\epsilon = 10^{-12}$.
381The vectorization of the SOR algorithm is not straightforward. The scheme
382contains two linear recurrences on $i$ and $j$. This inhibits the vectorisation.
383Therefore it has been rewritten as:
384
385\begin{multline} 
386R_{i,j}^n
387= A_{i,j}^{N}  {   \left\frac{\partial \psi}{\partial t } \right)    }_{i+1,j}^n
388+\,A_{i,j}^{E}  {   \left\frac{\partial \psi}{\partial t } \right)    }_{i,j+1} ^n     \\
389+\,A_{i,j}^{S}  {   \left\frac{\partial \psi}{\partial t } \right)    }_{i-1,j} ^{n}
390+\,A_{i,j}^{W} {   \left\frac{\partial \psi}{\partial t } \right)    }_{i,j-1} ^{n} 
391                   -  {   \left\frac{\partial \psi}{\partial t } \right)    }_{i,j}^n - \tilde B_{i,j}
392\end{multline}
393
394\begin{equation}
395R_{i,j}^n = R_{i,j}^n - \omega \;A_{i,j}^{S}\; R_{i,j-1}^n
396\end{equation}
397
398\begin{equation}
399R_{i,j}^n = R_{i,j}^n - \omega \;A_{i,j}^{W}\; R_{i-1,j}^n
400\end{equation}
401
402The SOR method is very flexible and can be used under a wide
403range of conditions, including irregular boundaries, interior boundary
404points, etc. Proofs of convergence, etc. may be found in the standard
405numerical methods texts for partial differential equations.
406
407% -------------------------------------------------------------------------------------------------------------
408%       Preconditioned Conjugate Gradient
409% -------------------------------------------------------------------------------------------------------------
410\subsection{Preconditioned Conjugate Gradient}
411\label{MISC_solpcg}
412
413\begin{flushright}
414(\textit{nbsfs=1}, \textbf{namelist parameter})
415\end{flushright}
416
417\textbf{A} is a definite positive symmetric matrix, thus solving the linear
418system \eqref{Eq_solmat} is equivalent to the minimisation of a quadratic
419functional:
420\begin{equation*}
421\textbf{Ax} = \textbf{b} \leftrightarrow \textbf{x} =\text{inf}_{y} \,\phi (\textbf{y})
422\quad , \qquad
423\phi (\textbf{y}) = 1/2 \langle \textbf{Ay},\textbf{y}\rangle - \langle \textbf{b},\textbf{y} \rangle 
424\end{equation*}
425where $\langle , \rangle$ is the canonical dot product. The idea of the
426conjugate gradient method is to search for the solution in the following
427iterative way: assuming that $\textbf{x}^n$ has been obtained, $\textbf{x}^{n+1}$ 
428is found from $\textbf {x}^{n+1}={\textbf {x}}^n+\alpha^n{\textbf {d}}^n$ which satisfies:
429\begin{equation*}
430{\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
431\end{equation*}
432and expressing $\phi (\textbf{y})$ as a function of \textit{$\alpha $}, we obtain the
433value that minimises the functional:
434\begin{equation*}
435\alpha ^n = \langle{ \textbf{r}^n , \textbf{r}^n} \rangle  / \langle {\textbf{ A d}^n, \textbf{d}^n} \rangle
436\end{equation*}
437where $\textbf{r}^n = \textbf{b}-\textbf{A x}^n = \textbf{A} (\textbf{x}-\textbf{x}^n)$ 
438is the error at rank $n$. The descent vector $\textbf{d}^n$ s chosen to be dependent
439on the error: $\textbf{d}^n = \textbf{r}^n + \beta^n \,\textbf{d}^{n-1}$. $\beta ^n$ 
440is searched such that the descent vectors form an orthogonal basis for the dot
441product linked to \textbf{A}. Expressing the condition
442$\langle \textbf{A d}^n, \textbf{d}^{n-1} \rangle = 0$ the value of $\beta ^n$ is found:
443 $\beta ^n = \langle{ \textbf{r}^n , \textbf{r}^n} \rangle  / \langle {\textbf{r}^{n-1}, \textbf{r}^{n-1}} \rangle$.
444 As a result, the errors $ \textbf{r}^n$ form an orthogonal
445base for the canonic dot product while the descent vectors $\textbf{d}^n$ form
446an orthogonal base for the dot product linked to \textbf{A}. The resulting
447algorithm is thus the following one:
448
449initialisation :
450
451\begin{equation*} 
452\textbf{x}^0 = \left\frac{\partial \psi}{\partial t } \right)_{i,j}^0 = 2{\left\frac{\partial \psi}{\partial t } \right)_{i,j}^t} - {\left\frac{\partial \psi}{\partial t } \right)_{i,j}^{t-1}}
453, \text{the initial guess }
454\end{equation*}
455
456\begin{equation*}
457\textbf{r}^0 = \textbf{d}^0 = \textbf{b} - \textbf{A x}^0
458\end{equation*}
459\begin{equation*}
460\gamma_0 = \langle{ \textbf{r}^0 , \textbf{r}^0} \rangle
461\end{equation*}
462iteration $n,$ from $n=0$ until convergence, do :
463
464\begin{equation} 
465\begin{split}
466\text{z}^n& = \textbf{A d}^n \\
467\alpha_n &= \gamma_\langle{ \textbf{z}^n , \textbf{d}^n} \rangle \\
468\textbf{x}^{n+1} &= \textbf{x}^n + \alpha_n \,\textbf{d}^n \\
469\textbf{r}^{n+1} &= \textbf{r}^n - \alpha_n \,\textbf{z}^n \\
470\gamma_{n+1} &= \langle{ \textbf{r}^{n+1} , \textbf{r}^{n+1}} \rangle \\
471\beta_{n+1} &= \gamma_{n+1}/\gamma_{n}  \\
472\textbf{d}^{n+1} &= \textbf{r}^{n+1} + \beta_{n+1}\; \textbf{d}^{n}\\
473\end{split}
474\end{equation}
475
476
477The convergence test is:
478
479\begin{equation}
480\delta = \gamma_{n}\; / \langle{ \textbf{b} , \textbf{b}} \rangle \leq \epsilon
481\end{equation}
482where $\epsilon $ is the absolute precision that is required. As for the SOR algorithm,
483the whole model computation is stopped when the number of iterations, $nmax$, or
484the modulus of the right hand side of the convergence equation exceeds a
485specified value (see \S\ref{MISC_solsor} for a further discussion). The required
486precision and the maximum number of iterations allowed are specified by setting
487$eps$ and $nmax$ (\textbf{namelist parameters}).
488
489It can be demonstrated that the above algorithm is optimal, provides the exact
490solution in a number of iterations equal to the size of the matrix, and that
491the convergence rate is faster as the matrix is closer to the identity matrix,
492$i.e.$ its eigenvalues are closer to 1. Therefore, it is more efficient to solve a
493better conditioned system which has the same solution. For that purpose, we
494introduce a preconditioning matrix \textbf{Q} which is an approximation of
495\textbf{A} but much easier to invert than \textbf{A}, and solve the system:
496\begin{equation} \label{Eq_pmat}
497\textbf{Q}^{-1} \textbf{A x} = \textbf{Q}^{-1} \textbf{b}
498\end{equation}
499
500The same algorithm can be used to solve \eqref{Eq_pmat} if instead of the
501canonical dot product the following one is used:
502${\langle{ \textbf{a} , \textbf{b}} \rangle}_Q = \langle{ \textbf{a} , \textbf{Q b}} \rangle$, and
503if $\textbf{\~{b}} = \textbf{Q}^{-1}\;\textbf{b}$ and $\textbf{\~{A}} = \textbf{Q}^{-1}\;\textbf{A}$ 
504are substituted to \textbf{b} and \textbf{A} \citep{Madec1988}.
505In \NEMO, \textbf{Q} is chosen as the diagonal of \textbf{ A}, i.e. the simplest form for
506\textbf{Q} so that it can be easily inverted. In this case, the discrete formulation of
507\eqref{Eq_pmat} is in fact given by \eqref{Eq_solmat_p} and thus the matrix and
508right hand side are computed independently from the solver used.
509
510% -------------------------------------------------------------------------------------------------------------
511%       FETI
512% -------------------------------------------------------------------------------------------------------------
513\subsection{FETI}
514\label{MISC_solfeti}
515
516FETI is a powerful solver that was developed by Marc Guyon  \citep{Guyon_al_EP99,
517Guyon_al_CalPar99}. It has been converted from Fortan 77 to 90, but never
518successfully tested after that.
519
520Its main advantage is to save a lot of CPU time when compared to the SOR or PCG
521algorithms. However, its main drawback is that the solution is dependent on the
522domain decomposition chosen. Using a different number of processors, the solution
523is the same at the precision required, but not the same at the computer precision.
524This make it hard to debug. 
525
526% -------------------------------------------------------------------------------------------------------------
527%       Boundary Conditions --- Islands
528% -------------------------------------------------------------------------------------------------------------
529\subsection{Boundary Conditions --- Islands (\key{islands})}
530\label{MISC_solisl}
531
532The boundary condition used for both recommended solvers is that the time
533derivative of the barotropic streamfunction is zero along all the coastlines.
534When islands are present in the model domain, additional computations must
535be performed to determine the barotropic streamfunction with the correct boundary
536conditions. This is detailed below.
537
538The model does not have specialised code for islands. They must instead be
539identified to the solvers by the user via bathymetry information, i.e. the $mbathy$ 
540array should equal $-1$ over the first island, $-2$ over the second, ... , $-N$ over
541the $N^{th}$ island. The model determines the position of island grid-points and
542defines a closed contour around each island which is used to compute the circulation
543around each one. The closed contour is formed from the ocean grid-points which
544are the closest to the island.
545
546First, the island barotropic streamfunctions $\psi_n$ are computed using the SOR
547or PCG scheme (they are solutions of \eqref{Eq_solmat} with the right-hand side
548equal to zero and with $\psi_n = 1$ along the island $n$ and $\psi_n = 0$ along
549the other coastlines) (Note that specifying $1$ as boundary condition on an island
550for $\psi$ is equivalent to defining a specific right hand side for \eqref{Eq_solmat}).
551The requested precision of this computation can be very high since it is only
552performed once. The absolute precision, $epsisl$, and the maximum number of
553iterations allowed, $nmisl$, are the \textbf{namelist parameters} used for this
554computation. Their typical values are $epsisl = 10^{-10}$ and $nmisl = 4000$.
555Then the island matrix A is computed from \eqref{Eq_PE_psi_isl_matrix} and
556inverted. At each time step, $\psi_0$, the solution of \eqref{Eq_solmat} with $\psi = 0$ 
557along all coastlines, is computed using either SOR or PCG. (It should
558be noted that the first guess of this computation remains as usual except that
559$\partial_t \psi_0$ is used, instead of $\partial_t \psi$. Indeed we are
560computing $\partial_t \psi_0$ which is usually very different from $\partial_t \psi$.)
561Then, it is easy to find the time evolution of the barotropic streamfunction on each
562island and to deduce $\partial_t \psi$, and to use it to compute the surface pressure
563gradient. Note that the value of the barotropic streamfunction itself is also computed
564as the time integration of $\partial_t \psi$ for further diagnostics.
565
566% ================================================================
567% Diagnostics
568% ================================================================
569\section{Diagnostics }
570\label{MISC_diag}
571
572% -------------------------------------------------------------------------------------------------------------
573%       Standard Model Output
574% -------------------------------------------------------------------------------------------------------------
575\subsection{Standard Model Output (default option or \key{dimg})}
576\label{MISC_iom}
577
578%to be updated with Seb documentation on the IO
579\amtcomment{ 
580The model outputs are of three types: the restart file, the output listing,
581and the output file(s). The restart file is used internally by the code when
582the user wants to start the model with initial conditions defined by a
583previous simulation. It contains all the information that is necessary in
584order for there to be no changes in the model results (even at the computer
585precision) between a run performed with several restarts and the same run
586performed in one step. It should be noted that this requires that the restart file
587contain two consecutive time steps for all the prognostic variables, and
588that it is saved in the same binary format as the one used by the computer
589that is to read it (in particular, 32 bits binary IEEE format must not be used for
590this file). The output listing and file(s) are predefined but should be checked
591and eventually adapted to the user's needs. The output listing is stored in
592the $ocean.output$ file. The information is printed from within the code on the
593logical unit $numout$. To locate these prints, use the UNIX command
594"$grep -i numout^*$" in the source code directory.
595
596In the standard configuration, the user will find the model results in two
597output files containing values for every time-step where output is demanded:
598a \textbf{VO} file containing all the three dimensional fields in logical unit
599$numwvo$, and a \textbf{SO} file containing all the two dimensional (horizontal)
600fields in logical unit $numwso$. These outputs are defined in the $diawri.F$ 
601routine. The default and user-selectable diagnostics are described in {\S}III-12-c.
602
603The default output (for all output files apart from the restart file) is 32 bits binary
604IEEE format, compatible with the Vairmer software (see the Climate Modelling
605and global Change team WEB server at CERFACS: http://www.cerfacs.fr).
606The model's reference directory also contains a visualisation tool based on
607\textbf{NCAR Graphics} (http://ngwww.ucar.edu). If a user has access to the
608NCAR software, he or she can copy the \textbf{LODMODEL/UTILS/OPADRA} 
609directory from the reference and, following the \textbf{README}, create
610graphical outputs from the model's results.
611}
612
613% -------------------------------------------------------------------------------------------------------------
614%       Tracer/Dynamics Trends
615% -------------------------------------------------------------------------------------------------------------
616\subsection[Tracer/Dynamics Trends (\key{trdlmd}, \textbf{key\_diatrd...})]
617                  {Tracer/Dynamics Trends (\key{trdlmd}, \key{diatrdtra}, \key{diatrddyn})}
618\label{MISC_tratrd}
619
620%to be udated this corresponds to OPA8
621When \key{diatrddyn} and/or \key{diatrddyn} cpp variables are defined, each
622trend of the dynamics and/or temperature and salinity time evolution equations
623is stored in three-dimensional arrays just after their computation ($i.e.$ at the end
624of each $dyn\cdots .F90$ and/or $tra\cdots .F90$ routine). These trends are then
625used in diagnostic routines $diadyn.F90$ and $diatra.F90$ respectively.
626In the standard model, these routines check the basin averaged properties of
627the momentum and tracer equations every \textit{ntrd } time-steps (\textbf{namelist
628parameter}). These routines are supplied as an example; they must be adapted by
629the user to his/her requirements.
630
631These two options imply the creation of several extra arrays in the in-core
632memory, increasing quite seriously the code memory requirements.
633
634% -------------------------------------------------------------------------------------------------------------
635%       On-line Floats trajectories
636% -------------------------------------------------------------------------------------------------------------
637\subsection{On-line Floats trajectories}
638\label{FLO}
639%--------------------------------------------namflo-------------------------------------------------------
640\namdisplay{namflo} 
641%--------------------------------------------------------------------------------------------------------------
642
643The on-line computation of floats adevected either by the three dimensional velocity
644field or constraint to remain at a given depth ($w = 0$ in the computation) have been
645introduced in the system during the CLIPPER project. The algorithm used is based on
646the work of \cite{Blanke_Raynaud_JPO97}. (see also the web site describing the off-line
647use of this marvellous diagnostic tool (http://stockage.univ-brest.fr/~grima/Ariane/).
648
649% -------------------------------------------------------------------------------------------------------------
650%       Other Diagnostics
651% -------------------------------------------------------------------------------------------------------------
652\subsection{Other Diagnostics}
653\label{MISC_diag_others}
654
655%To be updated  this mainly corresponds to OPA 8
656
657Aside from the standard model variables, other diagnostics can be computed
658on-line or can be added to the model. The available ready-to-add diagnostics
659routines can be found in directory DIA. Among the available diagnostics are:
660
661- the mixed layer depth (based on a density criterion) (\mdl{diamxl})
662
663- the turbocline depth (based on a turbulent mixing coefficient criterion) (\mdl{diamxl})
664
665- the depth of the 20\r{}C isotherm (\mdl{diahth})
666
667- the depth of the thermocline (maximum of the vertical temperature gradient) (\mdl{diahth})
668
669- the meridional heat and salt transports and their decomposition (\mdl{diamfl})
670
671- the surface pressure (\mdl{diaspr})
Note: See TracBrowser for help on using the repository browser.