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_LBC.tex in trunk/DOC/TexFiles/Chapters – NEMO

source: trunk/DOC/TexFiles/Chapters/Chap_LBC.tex @ 998

Last change on this file since 998 was 998, checked in by gm, 16 years ago

trunk - DOC - update .tex due to the change in position of NEMO_book

  • Property svn:executable set to *
File size: 44.0 KB
Line 
1% ================================================================
2% Chapter Ñ Lateral Boundary Condition (LBC)
3% ================================================================
4\chapter{Lateral Boundary Condition (LBC) }
5\label{LBC}
6\minitoc
7
8%gm% add here introduction to this chapter
9
10% ================================================================
11% Boundary Condition at the Coast
12% ================================================================
13\section{Boundary Condition at the Coast (\np{shlat})}
14\label{LBC_coast}
15%--------------------------------------------nam_lbc-------------------------------------------------------
16\namdisplay{nam_lbc} 
17%--------------------------------------------------------------------------------------------------------------
18
19%The lateral ocean boundary conditions contiguous to coastlines are Neumann conditions for heat and salt (no flux across boundaries) and Dirichlet conditions for momentum (ranging from free-slip to "strong" no-slip). They are handled automatically by the mask system (see \S\ref{DOM_msk}).
20
21%OPA allows land and topography grid points in the computational domain due to the presence of continents or islands, and includes the use of a full or partial step representation of bottom topography. The computation is performed over the whole domain, i.e. we do not try to restrict the computation to ocean-only points. This choice has two motivations. Firstly, working on ocean only grid points overloads the code and harms the code readability. Secondly, and more importantly, it drastically reduces the vector portion of the computation, leading to a dramatic increase of CPU time requirement on vector computers.  The current section describes how the masking affects the computation of the various terms of the equations with respect to the boundary condition at solid walls. The process of defining which areas are to be masked is described in \S\ref{DOM_msk}.
22
23The discrete representation of a domain with complex boundaries (coastlines and
24bottom topography) leads to arrays that include large portions where a computation
25is not required as the model variables remain at zero. Nevertheless, vectorial
26supercomputers are far more efficient when computing over a whole array, and the
27readability of a code is greatly improved when boundary conditions are applied in
28an automatic way rather than by a specific computation before or after each
29computational loop. An efficient way to work over the whole domain while specifying
30the boundary conditions, is to use multiplication by mask arrays in the computation.
31A mask array is a matrix whose elements are $1$ in the ocean domain and $0$ 
32elsewhere. A simple multiplication of a variable by its own mask ensures that it will
33remain zero over land areas. Since most of the boundary conditions consist of a
34zero flux across the solid boundaries, they can be simply applied by multiplying
35variables by the correct mask arrays, $i.e.$ the mask array of the grid point where
36the flux is evaluated. For example, the heat flux in the \textbf{i}-direction is evaluated
37at $u$-points. Evaluating this quantity as,
38
39\begin{equation} \label{Eq_lbc_aaaa}
40\frac{A^{lT} }{e_1 }\frac{\partial T}{\partial i}\equiv \frac{A_u^{lT} 
41}{e_{1u} } \; \delta _{i+1 / 2} \left[ T \right]\;\;mask_u
42\end{equation}
43(where mask$_{u}$ is the mask array at a $u$-point) ensures that the heat flux is
44zero inside land and at the boundaries, since mask$_{u}$ is zero at solid boundaries
45which in this case are defined at $u$-points (normal velocity $u$ remains zero at
46the coast) (Fig.~\ref{Fig_LBC_uv}).
47
48%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
49\begin{figure}[!t] \label{Fig_LBC_uv}  \begin{center}
50\includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_LBC_uv.pdf}
51\caption {Lateral boundary (thick line) at T-level. The velocity normal to the
52       boundary is set to zero.}
53\end{center}   \end{figure}
54%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
55
56For momentum the situation is a bit more complex as two boundary conditions
57must be provided along the coast (one each for the normal and tangential velocities).
58The boundary of the ocean in the C-grid is defined by the velocity-faces.
59For example, at a given $T$-level, the lateral boundary (a coastline or an intersection
60with the bottom topography) is made of segments joining $f$-points, and normal
61velocity points are located between two $f-$points (Fig.~\ref{Fig_LBC_uv}).
62The boundary condition on the normal velocity (no flux through solid boundaries)
63can thus be easily implemented using the mask system. The boundary condition
64on the tangential velocity requires a more specific treatment. This boundary
65condition influences the relative vorticity and momentum diffusive trends, and is
66required in order to compute the vorticity at the coast. Four different types of
67lateral boundary condition are available, controlled by the value of the \np{shlat} 
68namelist parameter. (The value of the mask$_{f}$ array along the coastline is set
69equal to this parameter.) These are:
70
71%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
72\begin{figure}[!p] \label{Fig_LBC_shlat}  \begin{center}
73\includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_LBC_shlat.pdf}
74\caption {lateral boundary condition (a) free-slip ($shlat=0$) ; (b) no-slip ($shlat=2$)
75; (c) "partial" free-slip ($0<shlat<2$) and (d) "strong" no-slip ($2<shlat$).
76Implied "ghost" velocity inside land area is display in grey. }
77\end{center}   \end{figure}
78%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
79
80\begin{description}
81
82\item[free-slip boundary condition (\np{shlat}=0): ]  the tangential velocity at the
83coastline is equal to the offshore velocity, $i.e.$ the normal derivative of the
84tangential velocity is zero at the coast, so the vorticity: mask$_{f}$ array is set
85to zero inside the land and just at the coast (Fig.~\ref{Fig_LBC_shlat}-a).
86
87\item[no-slip boundary condition (\np{shlat}=2): ] the tangential velocity vanishes
88at the coastline. Assuming that the tangential velocity decreases linearly from
89the closest ocean velocity grid point to the coastline, the normal derivative is
90evaluated as if the velocities at the closest land velocity gridpoint and the closest
91ocean velocity gridpoint were of the same magnitude but in the opposite direction
92(Fig.~\ref{Fig_LBC_shlat}-b). Therefore, the vorticity along the coastlines is given by:
93
94\begin{equation*}
95\zeta \equiv 2 \left(\delta_{i+1/2} \left[e_{2v} v \right] - \delta_{j+1/2} \left[e_{1u} u \right] \right) / \left(e_{1f} e_{2f} \right) \ ,
96\end{equation*}
97where $u$ and $v$ are masked fields. Setting the mask$_{f}$ array to $2$ along
98the coastline provides a vorticity field computed with the no-slip boundary condition,
99simply by multiplying it by the mask$_{f}$ :
100\begin{equation} \label{Eq_lbc_bbbb}
101\zeta \equiv \frac{1}{e_{1f} {\kern 1pt}e_{2f} }\left( {\delta _{i+1/2} 
102\left[ {e_{2v} \,v} \right]-\delta _{j+1/2} \left[ {e_{1u} \,u} \right]} 
103\right)\;\mbox{mask}_f
104\end{equation}
105
106\item["partial" free-slip boundary condition (0$<$\np{shlat}$<$2): ] the tangential
107velocity at the coastline is smaller than the offshore velocity, $i.e.$ there is a lateral
108friction but not strong enough to make the tangential velocity at the coast vanish
109(Fig.~\ref{Fig_LBC_shlat}-c). This can be selected by providing a value of mask$_{f}$ 
110strictly inbetween $0$ and $2$.
111
112\item["strong" no-slip boundary condition (2$<$\np{shlat}): ] the viscous boundary
113layer is assumed to be smaller than half the grid size (Fig.~\ref{Fig_LBC_shlat}-d).
114The friction is thus larger than in the no-slip case.
115
116\end{description}
117
118Note that when the bottom topography is entirely represented by the $s$-coor-dinates
119(pure $s$-coordinate), the lateral boundary condition on tangential velocity is of much
120less importance as it is only applied next to the coast where the minimum water depth
121can be quite shallow.
122
123The alternative numerical implementation of the no-slip boundary conditions for an
124arbitrary coast line of \citet{Shchepetkin1996} is also available through the
125\key{noslip\_accurate} CPP key. It is based on a fourth order evaluation of the shear at the
126coast which, in turn, allows a true second order scheme in the interior of the domain
127($i.e.$ the numerical boundary scheme simulates the truncation error of the numerical
128scheme used in the interior of the domain). \citet{Shchepetkin1996} found that such a
129technique considerably improves the quality of the numerical solution. In \NEMO, such
130spectacular improvements have not been found in the half-degree global ocean
131(ORCA05), but significant reductions of numerically induced coastal upwellings were
132found in an eddy resolving simulation of the Alboran Sea \citep{OlivierPh2001}.
133Nevertheless, since a no-slip boundary condition is not recommended in an eddy
134permitting or resolving simulation \citep{Penduff2007}, the use of this option is also
135not recommended.
136
137In practice, the no-slip accurate option changes the way the curl is evaluated at the
138coast (see \mdl{divcur} module), and requires the nature of each coastline grid point
139(convex or concave corners, straight north-south or east-west coast) to be specified. 
140This is performed in routine \rou{dom\_msk\_nsa} in the \mdl{domask} module.
141
142% ================================================================
143% Boundary Condition around the Model Domain
144% ================================================================
145\section{Model Domain Boundary Condition (\jp{jperio})}
146\label{LBC_jperio}
147
148At the model domain boundaries several choices are offered: closed, cyclic east-west, south symmetric across the equator, a north-fold, and combination closed-north fold or cyclic-north-fold. The north-fold boundary condition is associated with the 3-pole ORCA mesh.
149
150% -------------------------------------------------------------------------------------------------------------
151%        Closed, cyclic, south symmetric (\jp{jperio} = 0, 1 or 2)
152% -------------------------------------------------------------------------------------------------------------
153\subsection{Closed, cyclic, south symmetric (\jp{jperio} = 0, 1 or 2)}
154\label{LBC_jperio012}
155
156The choice of closed, cyclic or symmetric model domain boundary condition is made
157by setting \jp{jperio} to 0, 1 or 2 in file \mdl{par\_oce}. Each time such a boundary
158condition is needed, it is set by a call to routine \mdl{lbclnk}. The computation of
159momentum and tracer trends proceeds from $i=2$ to $i=jpi-1$ and from $j=2$ to
160$j=jpj-1$, $i.e.$ in the model interior. To choose a lateral model boundary condition
161is to specify the first and last rows and columns of the model variables.
162
163\begin{description}
164
165\item[For closed boundary (\textit{jperio=0})], solid walls are imposed at all model
166boundaries: first and last rows and columns are set to zero.
167
168\item[For cyclic east-west boundary (\textit{jperio=1})], first and last rows are set
169to zero (closed) whilst the first column is set to the value of the last-but-one column
170and the last column to the value of the second one (Fig.~\ref{Fig_LBC_jperio}-a).
171Whatever flows out of the eastern (western) end of the basin enters the western
172(eastern) end. Note that there is no option for north-south cyclic or for doubly
173cyclic cases.
174
175\item[For symmetric boundary condition across the equator (\textit{jperio=2})],
176last rows, and first and last columns are set to zero (closed). The row of symmetry
177is chosen to be the $u$- and $T-$points equator line ($j=2$, i.e. at the southern
178end of the domain). For arrays defined at $u-$ or $T-$points, the first row is set
179to the value of the third row while for most of $v$- and $f$-point arrays ($v$, $\zeta$,
180$j\psi$, but \gmcomment{not sure why this is "but"} scalar arrays such as eddy coefficients)
181the first row is set to minus the value of the second row (Fig.~\ref{Fig_LBC_jperio}-b).
182Note that this boundary condition is not yet available for the case of a massively
183parallel computer (\textbf{key{\_}mpp} defined).
184
185\end{description}
186
187%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
188\begin{figure}[!t] \label{Fig_LBC_jperio}  \begin{center}
189\includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_LBC_jperio.pdf}
190\caption {setting of (a) east-west cyclic  (b) symmetric across the equator boundary conditions.}
191\end{center}   \end{figure}
192%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
193
194% -------------------------------------------------------------------------------------------------------------
195%        North fold (\textit{jperio = 3 }to $6)$
196% -------------------------------------------------------------------------------------------------------------
197\subsection{North-fold (\textit{jperio = 3 }to $6)$ }
198\label{LBC_north_fold}
199
200The north fold boundary condition has been introduced in order to handle the north boundary of a three-polar ORCA grid. Such a grid has two poles in the northern hemisphere. \colorbox{yellow}{to be completed...}
201
202%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
203\begin{figure}[!t] \label{Fig_North_Fold_T}  \begin{center}
204\includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_North_Fold_T.pdf}
205\caption {North fold boundary with a $T$-point pivot and cyclic east-west boundary condition ($jperio=4$), as used in ORCA 2, 1/4, and 1/12. Pink shaded area corresponds to the inner domain mask (see text). }
206\end{center}   \end{figure}
207%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
208
209% ====================================================================
210% Exchange with neighbouring processors
211% ====================================================================
212\section  [Exchange with neighbouring processors (\textit{lbclnk}, \textit{lib\_mpp})]
213      {Exchange with neighbouring processors (\mdl{lbclnk}, \mdl{lib\_mpp})}
214\label{LBC_mpp}
215
216For massively parallel processing (mpp), a domain decomposition method is used.
217The basic idea of the method is to split the large computation domain of a numerical
218experiment into several smaller domains and solve the set of equations by addressing
219independent local problems. Each processor has its own local memory and computes
220the model equation over a subdomain of the whole model domain. The subdomain
221boundary conditions are specified through communications between processors
222which are organized by explicit statements (message passing method).
223
224A big advantage is that the method does not need many modifications of the initial
225FORTRAN code. From the modeller's point of view, each sub domain running on
226a processor is identical to the "mono-domain" code. In addition, the programmer
227manages the communications between subdomains, and the code is faster when
228the number of processors is increased. The porting of OPA code on an iPSC860
229was achieved during Guyon's PhD [Guyon et al. 1994, 1995] in collaboration with
230CETIIS and ONERA. The implementation in the operational context and the studies
231of performance on a T3D and T3E Cray computers have been made in collaboration
232with IDRIS and CNRS. The present implementation is largely inspired by Guyon's
233work  [Guyon 1995].
234
235The parallelization strategy is defined by the physical characteristics of the
236ocean model. Second order finite difference schemes lead to local discrete
237operators that depend at the very most on one neighbouring point. The only
238non-local computations concern the vertical physics (implicit diffusion, 1.5
239turbulent closure scheme, ...) (delocalization over the whole water column),
240and the solving of the elliptic equation associated with the surface pressure
241gradient computation (delocalization over the whole horizontal domain).
242Therefore, a pencil strategy is used for the data sub-structuration \gmcomment{no
243idea what this means!}: the 3D initial domain is laid out on local processor
244memories following a 2D horizontal topological splitting. Each sub-domain
245computes its own surface and bottom boundary conditions and has a side
246wall overlapping interface which defines the lateral boundary conditions for
247computations in the inner sub-domain. The overlapping area consists of the
248two rows at each edge of the sub-domain. After a computation, a communication
249phase starts: each processor sends to its neighbouring processors the update
250values of the points corresponding to the interior overlapping area to its
251neighbouring sub-domain (i.e. the innermost of the two overlapping rows). The communication is done through message passing. Usually the parallel virtual
252language, PVM, is used as it is a standard language available on  nearly  all
253MPP computers. More specific languages (i.e. computer dependant languages)
254can be easily used to speed up the communication, such as SHEM on a T3E
255computer. The data exchanges between processors are required at the very
256place where lateral domain boundary conditions are set in the mono-domain
257computation (\S III.10-c): the lbc\_lnk routine which manages such conditions
258is substituted by mpplnk.F or mpplnk2.F routine when running on an MPP
259computer (\key{mpp\_mpi} defined). It has to be pointed out that when using
260the MPP version of the model, the east-west cyclic boundary condition is done
261implicitly, whilst the south-symmetric boundary condition option is not available.
262
263%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
264\begin{figure}[!t] \label{Fig_mpp}  \begin{center}
265\includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_mpp.pdf}
266\caption {Positioning of a sub-domain when massively parallel processing is used. }
267\end{center}   \end{figure}
268%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
269
270In the standard version of the OPA model, the splitting is regular and arithmetic.
271 the i-axis is divided by \jp{jpni} and the j-axis by \jp{jpnj} for a number of processors
272 \jp{jpnij} most often equal to $jpni \times jpnj$ (model parameters set in
273 \mdl{par\_oce}). Each processor is independent and without message passing
274 or synchronous process \gmcomment{how does a synchronous process relate to this?},
275 programs run alone and access just its own local memory. For this reason, the
276 main model dimensions are now the local dimensions of the subdomain (pencil)
277 that are named \jp{jpi}, \jp{jpj}, \jp{jpk}. These dimensions include the internal
278 domain and the overlapping rows. The number of rows to exchange (known as
279 the halo) is usually set to one (\jp{jpreci}=1, in \mdl{par\_oce}). The whole domain
280 dimensions are named \jp{jpiglo}, \jp{jpjglo} and \jp{jpk}. The relationship between
281 the whole domain and a sub-domain is:
282\begin{eqnarray} 
283      jpi & = & ( jpiglo-2*jpreci + (jpni-1) ) / jpni + 2*jpreci  \nonumber \\
284      jpj & = & ( jpjglo-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj  \label{Eq_lbc_jpi}
285\end{eqnarray}
286where \jp{jpni}, \jp{jpnj} are the number of processors following the i- and j-axis.
287
288\colorbox{yellow}{Figure IV.3: example of a domain splitting with 9 processors and no east-west cyclic boundary conditions.}
289
290One also defines variables nldi and nlei which correspond to the internal
291domain bounds, and the variables nimpp and njmpp which are the position
292of the (1,1) grid-point in the global domain. An element of $T_{l}$, a local array
293(subdomain) corresponds to an element of $T_{g}$, a global array
294(whole domain) by the relationship:
295\begin{equation} \label{Eq_lbc_nimpp}
296T_{g} (i+nimpp-1,j+njmpp-1,k) = T_{l} (i,j,k),
297\end{equation}
298with  $1 \leq i \leq jpi$, $1  \leq j \leq jpj $ , and  $1  \leq k \leq jpk$.
299
300Processors are numbered from 0 to $jpnij-1$, the number is saved in the variable
301nproc. In the standard version, a processor has no more than four neighbouring
302processors named nono (for north), noea (east), noso (south) and nowe (west)
303and two variables, nbondi and nbondj, indicate the relative position of the processor
304\colorbox{yellow}{(see Fig.IV.3)}:
305\begin{itemize}
306\item       nbondi = -1    an east neighbour, no west processor,
307\item       nbondi =  0 an east neighbour, a west neighbour,
308\item       nbondi =  1    no east processor, a west neighbour,
309\item       nbondi =  2    no splitting following the i-axis.
310\end{itemize}
311   During the simulation, processors exchange data with their neighbours. If there is effectively a neighbour, the processor receives variables from this processor on its overlapping row, and sends the data issued from internal domain corresponding to the overlapping row of the other processor.
312       
313
314\colorbox{yellow}{Figure IV.4: pencil splitting with the additional outer halos }
315
316
317
318The OPA model computes equation terms with the help of mask arrays (0 on land
319points and 1 on sea points). It is easily readable and very efficient in the context of
320a computer with vectorial architecture. However, in the case of a scalar processor,
321computations over the land regions become more expensive in terms of CPU time.
322It is worse when we use a complex configuration with a realistic bathymetry like the
323global ocean where more than 50 \% of points are land points. For this reason, a
324pre-processing tool can be used to choose the mpp domain decomposition with a
325maximum number of only land points processors, which can then be eliminated.
326(For example, the mpp\_optimiz tools, available from the DRAKKAR web site.)
327This optimisation is dependent on the specific bathymetry employed. The user
328then chooses optimal parameters \jp{jpni}, \jp{jpnj} and \jp{jpnij} with
329$jpnij < jpni \times jpnj$, leading to the elimination of $jpni \times jpnj - jpnij$ 
330land processors. When those parameters are specified in module \mdl{par\_oce},
331the algorithm in the \rou{inimpp2} routine sets each processor's parameters (nbound,
332nono, noea,...) so that the land-only processors are not taken into account.
333
334\colorbox{yellow}{Note that the inimpp2 routine is general so that the original inimpp routine should be suppressed from the code.}
335
336When land processors are eliminated, the value corresponding to these locations in the model output files is zero. Note that this is a problem for a mesh output file written by such a model configuration, because model users often divide by the scale factors ($e1t$, $e2t$, etc) and do not expect the grid size to be zero, even on land. It may be best not to eliminate land processors when running the model especially to write the mesh files as outputs (when \np{nmsh} namelist parameter differs from 0).
337\gmcomment{Steven : dont understand this, no land processor means no output file covering this part of globe; its only when files are stitched together into one that you can leave a hole}
338
339%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
340\begin{figure}[!ht] \label{Fig_mppini2}  \begin{center}
341\includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_mppini2.pdf}
342\caption {Example of Atlantic domain defined for the CLIPPER projet. Initial grid is
343composed of 773 x 1236 horizontal points. (a) the domain is split onto 9 \time 20
344subdomains (jpni=9, jpnj=20). 52 subdomains are land areas. (b) 52 subdomains
345are eliminated (white rectangles) and the resulting number of processors really
346used during the computation is jpnij=128.}
347\end{center}   \end{figure}
348%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
349
350
351% ================================================================
352% Open Boundary Conditions
353% ================================================================
354\section{Open Boundary Conditions (\key{obc})}
355\label{LBC_obc}
356%-----------------------------------------nam_obc  -------------------------------------------
357%-    nobc_dta    =    0     !  = 0 the obc data are equal to the initial state
358%-                           !  = 1 the obc data are read in 'obc   .dta' files
359%-    rdpein      =    1.    !  ???
360%-    rdpwin      =    1.    !  ???
361%-    rdpnin      =   30.    !  ???
362%-    rdpsin      =    1.    !  ???
363%-    rdpeob      = 1500.    !  time relaxation (days) for the east  open boundary
364%-    rdpwob      =   15.    !    "        "           for the west  open boundary
365%-    rdpnob      =  150.    !    "        "           for the north open boundary
366%-    rdpsob      =   15.    !    "        "           for the south open boundary
367%-    zbsic1      =  140.e+6 !  barotropic stream function on first  isolated coastline
368%-    zbsic2      =    1.e+6 !    "                   "    on second isolated coastline
369%-    zbsic3      =    0.    !    "                   "    on thrid  isolated coastline
370%-    ln_obc_clim = .true.   !  climatological obc data files (default T)
371%-    ln_vol_cst  = .true.   !  total volume conserved
372\namdisplay{namobc} 
373
374It is often necessary to implement a model configuration limited to an oceanic
375region or a basin, which communicates with the rest of the global ocean through
376''open boundaries''. As stated by \citet{Roed1986}, an open boundary is a
377computational border where the aim of the calculations is to allow the perturbations
378generated inside the computational domain to leave it without deterioration of the
379inner model solution. However, an open boundary also has to let information from
380the outer ocean enter the model and should support inflow and outflow conditions.
381
382The open boundary package OBC is the first open boundary option developed in
383NEMO (originally in OPA8.2). It allows the user to
384\begin{itemize}
385\item tell the model that a boundary is ''open'' and not closed by a wall, for example by modifying the calculation of the divergence of velocity there;
386\item impose values of tracers and velocities at that boundary (values which may be taken from a climatology): this is the``fixed OBC'' option.
387\item calculate boundary values by a sophisticated algorithm combining radiation and relaxation (``radiative OBC'' option)
388\end{itemize}
389
390The package resides in the OBC directory. It is described here in four parts: the
391boundary geometry (parameters to be set in \mdl{obc\_par}), the forcing data at
392the boundaries (module \mdl{obcdta}),  the radiation algorithm involving the
393namelist and module \mdl{obcrad}, and a brief presentation of boundary update
394and restart files.
395
396%----------------------------------------------
397\subsection{Boundary geometry}
398\label{OBC_geom}
399%
400First one has to realize that open boundaries may not necessarily be located
401at the extremities of the computational domain. They may exist in the middle
402of the domain, for example at Gibraltar Straits if one wants to avoid including
403the Mediterranean in an Atlantic domain. This flexibility has been found necessary
404for the CLIPPER project \citep{Treguier2001}. Because of the complexity of the
405geometry of ocean basins, it may even be necessary to have more than one
406''west'' open boundary, more than one ''north'', etc. This is not possible with
407the OBC option: only one open boundary of each kind, west, east, south and
408north is allowed; these names refer to the grid geometry (not to the direction
409of the geographical ''west'', ''east'', etc).
410
411The open boundary geometry is set by a series of parameters in the module
412\mdl{obc\_par}. For an eastern open boundary, parameters are \jp{lp\_obc\_east} 
413(true if an east open boundary exists), \jp{jpieob} the $i$-index along which
414the eastern open boundary (eob) is located, \jp{jpjed} the $j$-index at which
415it starts, and \jp{jpjef} the $j$-index where it ends (note $d$ is for ''d\'{e}but''
416and $f$ for ''fin'' in French). Similar parameters exist for the west, south and
417north cases (Table~\ref{Tab_obc_param}).
418
419
420%--------------------------------------------------TABLE--------------------------------------------------
421
422\begin{table}[htbp]  \label{Tab_obc_param}
423\begin{center}
424\begin{tabular}{|l|c|c|c|}
425\hline
426Boundary and  & Constant index  & Starting index (d\'{e}but) & Ending index (fin) \\
427Logical flag  &                 &                            &                     \\
428\hline
429West          & \jp{jpiwob} $>= 2$         &  \jp{jpjwd}$>= 2$          &  \jp{jpjwf}<= \jp{jpjglo}-1 \\
430lp\_obc\_west & $i$-index of a $u$ point   & $j$ of a $T$ point   &$j$ of a $T$ point \\
431\hline
432East            & \jp{jpieob}$<=$\jp{jpiglo}-2&\jp{jpjed} $>= 2$         & \jp{jpjef}$<=$ \jp{jpjglo}-1 \\
433 lp\_obc\_east  & $i$-index of a $u$ point    & $j$ of a $T$ point & $j$ of a $T$ point \\
434\hline
435South           & \jp{jpjsob} $>= 2$         & \jp{jpisd} $>= 2$          & \jp{jpisf}$<=$\jp{jpiglo}-1 \\
436lp\_obc\_south  & $j$-index of a $v$ point   & $i$ of a $T$ point   & $i$ of a $T$ point \\
437\hline
438North           & \jp{jpjnob} $<=$ \jp{jpjglo}-2& \jp{jpind} $>= 2$        & \jp{jpinf}$<=$\jp{jpiglo}-1 \\
439lp\_obc\_north  & $j$-index of a $v$ point      & $i$  of a $T$ point & $i$ of a $T$ point \\
440\hline
441\end{tabular}
442\end{center}
443\caption{Names of different indices relating to the open boundaries. In the case
444of a completely open ocean domain with four ocean boundaries, the parameters
445take exactly the values indicated.}
446\end{table}
447
448The open boundaries must be along coordinate lines. On the C-grid, the boundary
449itself is along a line of normal velocity points: $v$ points for a zonal open boundary
450(the south or north one), and $u$ points for a meridional open boundary (the west
451or east one). Another constraint is that there still must be a row of masked points
452all around the domain, as if the domain were a closed basin (unless periodic conditions
453are used together with open boundary conditions). Therefore, an open boundary
454cannot be located at the first/last index, namely, 1, \jp{jpiglo} or \jp{jpjglo}. Also,
455the open boundary algorithm involves calculating the normal velocity points situated
456just on the boundary, as well as the tangential velocity and temperature and salinity
457just outside the boundary. This means that for a west/south boundary, normal
458velocities and temperature are calculated at the same index \jp{jpiwob} and
459\jp{jpjsob}, respectively. For an east/north boundary, the normal velocity is
460calculated at index \jp{jpieob} and \jp{jpjnob}, but the ``outside'' temperature is
461at index \jp{jpieob}+1 and \jp{jpjnob}+1. This means that \jp{jpieob}, \jp{jpjnob} 
462cannot be bigger than \jp{jpiglo}-2, \jp{jpjglo}-2.
463
464
465The starting and ending indices are to be thought of as $T$ point indices: in many
466cases they indicate the first land $T$-point, at the extremity of an open boundary
467(the coast line follows the $f$ grid points, see Fig.~\ref{Fig_obc_north} for an example
468of a northern open boundary). All indices are relative to the global domain. In the
469free surface case it is possible to have ``ocean corners'', that is, an open boundary
470starting and ending in the ocean.
471
472%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
473\begin{figure}[!t] \label{Fig_obc_north}  \begin{center}
474\includegraphics[width=0.70\textwidth]{./TexFiles/Figures/Fig_obc_north.pdf}
475\caption {Localization of the North open boundary points.}
476\end{center} 
477\end{figure}
478%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
479
480Although not compulsory, it is highly recommended that the bathymetry in the
481vicinity of an open boundary follows the following rule: in the direction perpendicular
482to the open line, the water depth should be constant for 4 grid points. This is in
483order to ensure that the radiation condition, which involves model variables next
484to the boundary, is calculated in a consistent way. On Fig.\ref{Fig_obc_north} we
485indicate by an $=$ symbol, the points which should have the same depth. It means
486that at the 4 points near the boundary, the bathymetry is cylindrical \gmcomment{not sure
487why cylindrical}. The line behind the open $T$-line must be 0 in the bathymetry file
488(as shown on Fig.\ref{Fig_obc_north} for example).
489
490%----------------------------------------------
491\subsection{Boundary data}
492\label{OBC_data}
493
494It is necessary to provide information at the boundaries. The simplest case is
495when this information does not change in time and is equal to the initial conditions
496(namelist variable \np{nobc\_dta}=0). This is the case for the standard configuration
497EEL5 with open boundaries. When (\np{nobc\_dta}=1), open boundary information
498is read from netcdf files. For convenience the input files are supposed to be similar
499to the ''history'' NEMO output files, for dimension names and variable names.
500Open boundary arrays must be dimensioned according to the parameters of table~
501\ref{Tab_obc_param}: for example, at the western boundary, arrays have a
502dimension of \jp{jpwf}-\jp{jpwd}+1 in the horizontal and \jp{jpk} in the vertical.
503
504When ocean observations are used to generate the boundary data (a hydrographic
505section for example, as in \citet{Treguier2001}) it happens often that only the velocity
506normal to the boundary is known, which is the reason why the initial OBC code
507assumes that only $T$, $S$, and the normal velocity ($u$ or $v$) needs to be
508specified. As more and more global model solutions and ocean analysis products
509become available, it will be possible to provide information about all the variables
510(including the tangential velocity) so that the specification of four variables at each
511boundaries will become standard. For the sea surface height, one must distinguish
512between the filtered free surface case and the time-splitting or explicit treatment of
513the free surface.
514 In the first case, it is assumed that the user does not wish to represent high
515 frequency motions such as tides. The boundary condition is thus one of zero
516 normal gradient of sea surface height at the open boundaries, following \citet{Marchesiello2001}.
517No information other than the total velocity needs to be provided at the open
518boundaries in that case. In the other two cases (time splitting or explicit free surface),
519the user must provide barotropic information (sea surface height and barotropic
520velocities) and the use of the Flather algorithm for barotropic variables is
521recommanded. However, this algorithm has not yet been fully tested and bugs
522remain in NEMO v2.3. Users should read the code carefully before using it. Finally,
523in the case of the rigid lid approximation the barotropic streamfunction must be
524provided, as documented in \citet{Treguier2001}). This option is no longer
525recommended but remains in NEMO V2.3.
526
527One frequently encountered case is when an open boundary domain is constructed
528from a global or larger scale NEMO configuration. Assuming the domain corresponds
529to indices $ib:ie$, $jb:je$ of the global domain, the bathymetry and forcing of the
530small domain can be created by using the following netcdf utility on the global files:
531ncks -F $-d\;x,ib,ie$ $-d\;y,jb,je$ (part of the nco series of utilities, see http://nco.sourceforge.net). The open boundary files can be constructed using ncks
532commands, following table~\ref{Tab_obc_ind}.
533
534%--------------------------------------------------TABLE--------------------------------------------------
535
536\begin{table}[htbp]  \label{Tab_obc_ind}
537\begin{center}
538\begin{tabular}{|l|c|c|c|c|c|}
539\hline
540OBC  & Variable   & file name      & Index  & Start  & end  \\
541West &  T,S       &   obcwest\_TS.nc &  $ib$+1     &   $jb$+1 &  $je-1$  \\
542     &    U       &   obcwest\_U.nc  &  $ib$+1     &   $jb$+1 &  $je-1$  \\ 
543     &    V       &   obcwest\_V.nc  &  $ib$+1     &   $jb$+1 &  $je-1$  \\       
544\hline
545East &  T,S       &   obceast\_TS.nc &  $ie$-1     &   $jb$+1 &  $je-1$  \\
546     &    U       &   obceast\_U.nc  &  $ie$-2     &   $jb$+1 &  $je-1$  \\ 
547     &    V       &   obceast\_V.nc  &  $ie$-1     &   $jb$+1 &  $je-1$  \\       
548\hline         
549South &  T,S      &   obcsouth\_TS.nc &  $jb$+1     &  $ib$+1 &  $ie-1$  \\
550      &    U      &   obcsouth\_U.nc  &  $jb$+1     &  $ib$+1 &  $ie-1$  \\ 
551      &    V      &   obcsouth\_V.nc  &  $jb$+1     &  $ib$+1 &  $ie-1$  \\   
552\hline
553North &  T,S      &   obcnorth\_TS.nc &  $je$-1     &  $ib$+1 &  $ie-1$  \\
554      &    U      &   obcnorth\_U.nc  &  $je$-1     &  $ib$+1 &  $ie-1$  \\ 
555      &    V      &   obcnorth\_V.nc  &  $je$-2     &  $ib$+1 &  $ie-1$  \\ 
556\hline
557\end{tabular}
558\end{center}
559\caption{Requirements for creating open boundary files from a global configuration,
560appropriate for the subdomain of indices $ib:ie$, $jb:je$. ``Index'' designates the
561$i$ or $j$ index along which the $u$ of $v$ boundary point is situated in the global
562configuration, starting and ending with the $j$ or $i$ indices indicated.
563For example, to generate file obcnorth\_V.nc, use the command ncks
564$-F$ $-d\;y,je-2$  $-d\;x,ib+1,ie-1$ } 
565\end{table}
566
567It is assumed that the open boundary files contain the variables for the period of
568the model integration. If the boundary files contain one time frame, the boundary
569data is held fixed in time. If the files contain 12 values, it is assumed that the input
570is a climatology for a repeated annual cycle (corresponding to the case \np{ln\_obc\_clim} 
571= .True.). The case of an arbitrary number of time frames is not yet implemented
572correctly; the user is required to write his own code in the module \mdl{obc\_dta} 
573to deal with this situation.
574
575\subsection{Radiation algorithm}
576\label{OBC_rad}
577
578The art of open boundary management consists in applying a constraint strong
579enough that the inner domain "feels" the rest of the ocean, but weak enough
580that perturbations are allowed to leave the domain with minimum false reflections
581of energy. The constraints are specified separately at each boundary as time
582scales for ''inflow'' and ''outflow'' as defined below. The time scales are set (in days)
583by namelist parameters such as \np{rdpein}, \np{rdpeob} for the eastern open
584boundary for example. When both time scales are zero for a given boundary
585($e.g.$ for the western boundary, \jp{lp\_obc\_west}=.True., \np{rdpwob}=0 and
586\np{rdpwin}=0) this means that the boundary in question is a ''fixed '' boundary
587where the solution is set exactly by the boundary data. This is not recommended,
588except in combination with increased viscosity in a ''sponge'' layer next to the
589boundary in order to avoid spurious reflections. 
590
591
592The radiation\/relaxation \gmcomment{the / doesnt seem to appear in the output} 
593algorithm is applied when either relaxation time (for ''inflow'' or ''outflow'') is
594non-zero. It has been developed and tested in the SPEM model and its
595successor ROMS \citep{Barnier1996, Marchesiello2001}, which is an
596$s$-coordinate model on an Arakawa C-grid. Although the algorithm has
597been numerically successful in the CLIPPER Atlantic models, the physics
598do not work as expected \citep{Treguier2001}. Users are invited to consider
599open boundary conditions (OBC hereafter) with some scepticism
600\citep{Durran2001, Blayo2005}.
601
602The first part of the algorithm calculates a phase velocity to determine
603whether perturbations tend to propagate toward, or away from, the
604boundary. Let us consider a model variable $\phi$.
605The phase velocities ($C_{\phi x}$,$C_{\phi y}$) for the variable $\phi$,
606in the directions normal and tangential to the boundary are
607\begin{equation} \label{Eq_obc_cphi}
608C_{\phi x} = \frac{ -\phi_{t} }{ ( \phi_{x}^{2} + \phi_{y}^{2}) } \phi_{x} 
609\;\;\;\;\; \;\;\; 
610C_{\phi y} = \frac{ -\phi_{t} }{ ( \phi_{x}^{2} + \phi_{y}^{2}) } \phi_{y}.
611\end{equation}
612Following \citet{Treguier2001} and \citet{Marchesiello2001} we retain only
613the normal component of the velocity, $C_{\phi x}$, setting $C_{\phi y} =0$ 
614(but unlike the original Orlanski radiation algorithm we retain $\phi_{y}$ in
615the expression for $C_{\phi x}$). 
616
617The discrete form of (\ref{Eq_obc_cphi}), described by \citet{Barnier1998},
618takes into account the two rows of grid points situated inside the domain
619next to the boundary, and the three previous time steps ($n$, $n-1$,
620and $n-2$). The same equation can then be discretized at the boundary at
621time steps $n-1$, $n$ and $n+1$ \gmcomment{since the original was three time-level} 
622in order to extrapolate for the new boundary value $\phi^{n+1}$.
623
624In the open boundary algorithm as implemented in NEMO v2.3, the new boundary
625values are updated differently depending on the sign of $C_{\phi x}$. Let us take
626an eastern boundary as an example. The solution for variable $\phi$ at the
627boundary is given by a generalized wave equation with phase velocity $C_{\phi}$,
628with the addition of a relaxation term, as:
629\begin{eqnarray}
630\phi_{t} &  =  & -C_{\phi x} \phi_{x} + \frac{1}{\tau_{o}} (\phi_{c}-\phi)
631                        \;\;\; \;\;\; \;\;\; (C_{\phi x} > 0), \label{Eq_obc_rado} \\
632\phi_{t} &  =  & \frac{1}{\tau_{i}} (\phi_{c}-\phi)
633\;\;\; \;\;\; \;\;\;\;\;\; (C_{\phi x} < 0), \label{Eq_obc_radi}
634\end{eqnarray}
635where $\phi_{c}$ is the estimate of $\phi$ at the boundary, provided as boundary
636data. Note that in (\ref{Eq_obc_rado}), $C_{\phi x}$ is bounded by the ratio
637$\delta x/\delta t$ for stability reasons. When $C_{\phi x}$ is eastward (outward
638propagation), the radiation condition (\ref{Eq_obc_rado}) is used.
639When  $C_{\phi x}$ is westward (inward propagation), (\ref{Eq_obc_radi}) is
640used with a strong relaxation to climatology (usually $\tau_{i}=\np{rdpein}=$1~day).
641Equation (\ref{Eq_obc_radi}) is solved with a Euler time-stepping scheme. As a
642consequence, setting $\tau_{i}$ smaller than, or equal to the time step is equivalent
643to a fixed boundary condition. A time scale of one day is usually a good compromise
644which guarantees that the inflow conditions remain close to climatology while ensuring
645numerical stability.
646
647In  the case of a western boundary located in the Eastern Atlantic, \citet{Penduff2000} 
648have been able to implement the radiation algorithm without any boundary data,
649using persistence from the previous time step instead. This solution has not worked
650in other cases \citep{Treguier2001}, so that the use of boundary data is recommended.
651Even in the outflow condition (\ref{Eq_obc_rado}), we have found it desirable to
652maintain a weak relaxation to climatology. The time step is usually chosen so as to
653be larger than typical turbulent scales (of order 1000~days \gmcomment{or maybe seconds?}).
654
655The radiation condition is applied to the model variables: temperature, salinity,
656tangential and normal velocities. For normal and tangential velocities, $u$ and $v$,
657radiation is applied with phase velocities calculated from $u$ and $v$ respectively. 
658For the radiation of tracers, we use the phase velocity calculated from the tangential
659velocity in order to avoid calculating too many independent radiation velocities and
660because tangential velocities and tracers have the same position along the boundary
661on a C-grid. 
662
663\subsection{Domain decomposition (\key{mpp\_mpi})}
664\label{OBC_mpp}
665When \key{mpp\_mpi} is active in the code, the computational domain is divided
666into rectangles that are attributed each to a different processor. The open boundary
667code is ``mpp-compatible'' up to a certain point. The radiation algorithm will not
668work if there is an mpp subdomain boundary parallel to the open boundary at the
669index of the boundary, or the grid point after (outside), or three grid points before
670(inside). On the other hand, there is no problem if an mpp subdomain boundary
671cuts the open boundary perpendicularly. These geometrical limitations must be
672checked for by the user (there is no safeguard in the code). 
673The general principle for the open boundary mpp code is that loops over the open
674boundaries {not sure what this means} are performed on local indices (nie0,
675nie1, nje0, nje1 for an eastern boundary for instance) that are initialized in module
676\mdl{obc\_ini}. Those indices have relevant values on the processors that contain
677a segment of an open boundary. For processors that do not include an open
678boundary segment, the indices are such that the calculations within the loops are
679not performed.
680\gmcomment{I dont understand most of the last few sentences}
681 
682Arrays of climatological data that are read from files are seen by all processors
683and have the same dimensions for all (for instance, for the eastern boundary,
684uedta(jpjglo,jpk,2)). On the other hand, the arrays for the calculation of radiation
685are local to each processor (uebnd(jpj,jpk,3,3) for instance).  This allowed the
686CLIPPER model for example, to save on memory where the eastern boundary
687crossed 8 processors so that \jp{jpj} was much smaller than (\jp{jpjef}-\jp{jpjed}+1).
688
689\subsection{Volume conservation}
690\label{OBC_vol}
691
692It is necessary to control the volume inside a domain when using open boundaries.
693With fixed boundaries, it is enough to ensure that the total inflow/outflow has
694reasonable values (either zero or a value compatible with an observed volume
695balance). When using radiative boundary conditions it is necessary to have a
696volume constraint because each open boundary works independently from the
697others. The methodology used to control this volume is identical to the one
698coded in the ROMS model \citep{Marchesiello2001}.
699
700
701%---------------------------------------- EXTRAS
702\colorbox{yellow}{Explain obc\_vol{\ldots}}
703
704\colorbox{yellow}{OBC algorithm for update, OBC restart, list of routines where obc key appears{\ldots}}
705
706\colorbox{yellow}{OBC rigid lid? {\ldots}}
707
708
709
710
711% ====================================================================
712% Flow Relaxation Scheme
713% ====================================================================
714\section{Flow Relaxation Scheme (???)}
715\label{LBC_bdy}
716
717%gm% to be updated by Met Office
Note: See TracBrowser for help on using the repository browser.