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_DOM.tex in branches/2017/dev_merge_2017/DOC/tex_sub – NEMO

source: branches/2017/dev_merge_2017/DOC/tex_sub/chap_DOM.tex @ 9407

Last change on this file since 9407 was 9407, checked in by nicolasmartin, 6 years ago

Complete refactoring of cross-referencing

  • Use of \autoref instead of simple \ref for contextual text depending on target type
  • creation of few prefixes for marker to identify the type reference: apdx|chap|eq|fig|sec|subsec|tab
File size: 52.8 KB
RevLine 
[9389]1\documentclass[../tex_main/NEMO_manual]{subfiles}
[6997]2\begin{document}
[707]3% ================================================================
[6140]4% Chapter 2 ——— Space and Time Domain (DOM)
[707]5% ================================================================
[9393]6\chapter{Space Domain (DOM)}
[9407]7\label{chap:DOM}
[707]8\minitoc
9
10% Missing things:
[817]11%  - istate: description of the initial state   ==> this has to be put elsewhere..
12%                  perhaps in MISC ?  By the way the initialisation of T S and dynamics
13%                  should be put outside of DOM routine (better with TRC staff and off-line
14%                  tracers)
[707]15%  -geo2ocean:  how to switch from geographic to mesh coordinate
[2282]16%     - domclo:  closed sea and lakes.... management of closea sea area : specific to global configuration, both forced and coupled
[707]17
18
[817]19\newpage
[7705]20$\ $\newline    % force a new line
[707]21
[9407]22Having defined the continuous equations in \autoref{chap:PE} and chosen a time
23discretization \autoref{chap:STP}, we need to choose a discretization on a grid,
[2282]24and numerical algorithms. In the present chapter, we provide a general description
25of the staggered grid used in \NEMO, and other information relevant to the main
26directory routines as well as the DOM (DOMain) directory.
[707]27
[7705]28$\ $\newline    % force a new line
[707]29
30% ================================================================
31% Fundamentals of the Discretisation
32% ================================================================
[9393]33\section{Fundamentals of the discretisation}
[9407]34\label{sec:DOM_basics}
[707]35
36% -------------------------------------------------------------------------------------------------------------
37%        Arrangement of Variables
38% -------------------------------------------------------------------------------------------------------------
[9393]39\subsection{Arrangement of variables}
[9407]40\label{subsec:DOM_cell}
[707]41
42%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[2376]43\begin{figure}[!tb]    \begin{center}
[6997]44\includegraphics[width=0.90\textwidth]{Fig_cell}
[9407]45\caption{ \protect\label{fig:cell}   
[2376]46Arrangement of variables. $t$ indicates scalar points where temperature,
[817]47salinity, density, pressure and horizontal divergence are defined. ($u$,$v$,$w$)
48indicates vector points, and $f$ indicates vorticity points where both relative and
49planetary vorticities are defined}
[707]50\end{center}   \end{figure}
51%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
52
[817]53The numerical techniques used to solve the Primitive Equations in this model are
54based on the traditional, centred second-order finite difference approximation.
55Special attention has been given to the homogeneity of the solution in the three
56space directions. The arrangement of variables is the same in all directions.
[2282]57It consists of cells centred on scalar points ($t$, $S$, $p$, $\rho$) with vector
[9407]58points $(u, v, w)$ defined in the centre of each face of the cells (\autoref{fig:cell}).
[817]59This is the generalisation to three dimensions of the well-known ``C'' grid in
60Arakawa's classification \citep{Mesinger_Arakawa_Bk76}. The relative and
61planetary vorticity, $\zeta$ and $f$, are defined in the centre of each vertical edge
62and the barotropic stream function $\psi$ is defined at horizontal points overlying
63the $\zeta$ and $f$-points.
[707]64
[817]65The ocean mesh ($i.e.$ the position of all the scalar and vector points) is defined
66by the transformation that gives ($\lambda$ ,$\varphi$ ,$z$) as a function of $(i,j,k)$.
67The grid-points are located at integer or integer and a half value of $(i,j,k)$ as
[9407]68indicated on \autoref{tab:cell}. In all the following, subscripts $u$, $v$, $w$,
[817]69$f$, $uw$, $vw$ or $fw$ indicate the position of the grid-point where the scale
70factors are defined. Each scale factor is defined as the local analytical value
[9407]71provided by \autoref{eq:scale_factors}. As a result, the mesh on which partial
[817]72derivatives $\frac{\partial}{\partial \lambda}, \frac{\partial}{\partial \varphi}$, and
[1224]73$\frac{\partial}{\partial z} $ are evaluated is a uniform mesh with a grid size of unity.
74Discrete partial derivatives are formulated by the traditional, centred second order
[817]75finite difference approximation while the scale factors are chosen equal to their
76local analytical value. An important point here is that the partial derivative of the
77scale factors must be evaluated by centred finite difference approximation, not
78from their analytical expression. This preserves the symmetry of the discrete set
79of equations and therefore satisfies many of the continuous properties (see
[9407]80\autoref{apdx:C}). A similar, related remark can be made about the domain
[817]81size: when needed, an area, volume, or the total ocean depth must be evaluated
[9407]82as the sum of the relevant scale factors (see \autoref{eq:DOM_bar}) in the next section).
[707]83
[2376]84%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[3294]85\begin{table}[!tb]
[707]86\begin{center} \begin{tabular}{|p{46pt}|p{56pt}|p{56pt}|p{56pt}|}
87\hline
88&$i$     & $j$    & $k$     \\ \hline
89& $i+1/2$   & $j$    & $k$    \\ \hline
90& $i$    & $j+1/2$   & $k$    \\ \hline
91& $i$    & $j$    & $k+1/2$   \\ \hline
92& $i+1/2$   & $j+1/2$   & $k$    \\ \hline
93uw & $i+1/2$   & $j$    & $k+1/2$   \\ \hline
94vw & $i$    & $j+1/2$   & $k+1/2$   \\ \hline
95fw & $i+1/2$   & $j+1/2$   & $k+1/2$   \\ \hline
96\end{tabular}
[9407]97\caption{ \protect\label{tab:cell}
[2376]98Location of grid-points as a function of integer or integer and a half value of the column,
99line or level. This indexing is only used for the writing of the semi-discrete equation.
100In the code, the indexing uses integer values only and has a reverse direction
[9407]101in the vertical (see \autoref{subsec:DOM_Num_Index})}
[707]102\end{center}
103\end{table}
[2376]104%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[707]105
106% -------------------------------------------------------------------------------------------------------------
107%        Vector Invariant Formulation
108% -------------------------------------------------------------------------------------------------------------
[9393]109\subsection{Discrete operators}
[9407]110\label{subsec:DOM_operators}
[707]111
[817]112Given the values of a variable $q$ at adjacent points, the differencing and
113averaging operators at the midpoint between them are:
[9407]114\begin{subequations} \label{eq:di_mi}
[707]115\begin{align}
[817]116 \delta _i [q]       &\  \    q(i+1/2)  - q(i-1/2)    \\
117 \overline q^{\,i} &= \left\{ q(i+1/2) + q(i-1/2) \right\} \; / \; 2
[707]118\end{align}
119\end{subequations}
120
[817]121Similar operators are defined with respect to $i+1/2$, $j$, $j+1/2$, $k$, and
[9407]122$k+1/2$. Following \autoref{eq:PE_grad} and \autoref{eq:PE_lap}, the gradient of a
[2282]123variable $q$ defined at a $t$-point has its three components defined at $u$-, $v$-
124and $w$-points while its Laplacien is defined at $t$-point. These operators have
[817]125the following discrete forms in the curvilinear $s$-coordinate system:
[9407]126\begin{equation} \label{eq:DOM_grad}
[3294]127\nabla q\equiv    \frac{1}{e_{1u} } \delta _{i+1/2 } [q] \;\,\mathbf{i}
128      +  \frac{1}{e_{2v} } \delta _{j+1/2 } [q] \;\,\mathbf{j}
129      +  \frac{1}{e_{3w}} \delta _{k+1/2} [q] \;\,\mathbf{k}
[707]130\end{equation}
[9407]131\begin{multline} \label{eq:DOM_lap}
[3294]132\Delta q\equiv \frac{1}{e_{1t}\,e_{2t}\,e_{3t} }
[2282]133       \;\left(          \delta_\left[ \frac{e_{2u}\,e_{3u}} {e_{1u}} \;\delta_{i+1/2} [q] \right]
134+                        \delta_\left[ \frac{e_{1v}\,e_{3v}}  {e_{2v}} \;\delta_{j+1/2} [q] \right] \;  \right)      \\
135+\frac{1}{e_{3t}} \delta_k \left[ \frac{1}{e_{3w} }                     \;\delta_{k+1/2} [q] \right]
[707]136\end{multline}
137
[9407]138Following \autoref{eq:PE_curl} and \autoref{eq:PE_div}, a vector ${\rm {\bf A}}=\left( a_1,a_2,a_3\right)$ 
[2282]139defined at vector points $(u,v,w)$ has its three curl components defined at $vw$-, $uw$,
140and $f$-points, and its divergence defined at $t$-points:
[9407]141\begin{eqnarray}  \label{eq:DOM_curl}
[6289]142 \nabla \times {\rm{\bf A}}\equiv &
[3294]143      \frac{1}{e_{2v}\,e_{3vw} } \ \left( \delta_{j +1/2} \left[e_{3w}\,a_3 \right] -\delta_{k+1/2} \left[e_{2v} \,a_2 \right] \right&\ \mathbf{i} \\ 
144 +& \frac{1}{e_{2u}\,e_{3uw}} \ \left( \delta_{k+1/2} \left[e_{1u}\,a_1  \right] -\delta_{i +1/2} \left[e_{3w}\,a_3 \right] \right&\ \mathbf{j} \\
145 +& \frac{1}{e_{1f} \,e_{2f}    } \ \left( \delta_{i +1/2} \left[e_{2v}\,a_2  \right] -\delta_{j +1/2} \left[e_{1u}\,a_1 \right] \right&\ \mathbf{k}
[2282]146 \end{eqnarray}
[9407]147\begin{eqnarray} \label{eq:DOM_div}
[6289]148\nabla \cdot \rm{\bf A} \equiv 
149    \frac{1}{e_{1t}\,e_{2t}\,e_{3t}} \left( \delta_i \left[e_{2u}\,e_{3u}\,a_1 \right]
150                                           +\delta_j \left[e_{1v}\,e_{3v}\,a_2 \right] \right)+\frac{1}{e_{3t} }\delta_k \left[a_3 \right]
151\end{eqnarray}
[707]152
[817]153The vertical average over the whole water column denoted by an overbar becomes
154for a quantity $q$ which is a masked field (i.e. equal to zero inside solid area):
[9407]155\begin{equation} \label{eq:DOM_bar}
[2282]156\bar q   =         \frac{1}{H}    \int_{k^b}^{k^o} {q\;e_{3q} \,dk} 
[707]157      \equiv \frac{1}{H_q }\sum\limits_k {q\;e_{3q} }
158\end{equation}
[817]159where $H_q$  is the ocean depth, which is the masked sum of the vertical scale
160factors at $q$ points, $k^b$ and $k^o$ are the bottom and surface $k$-indices,
161and the symbol $k^o$ refers to a summation over all grid points of the same type
162in the direction indicated by the subscript (here $k$).
[707]163
[817]164In continuous form, the following properties are satisfied:
[9407]165\begin{equation} \label{eq:DOM_curl_grad}
[707]166\nabla \times \nabla q ={\rm {\bf {0}}}
167\end{equation}
[9407]168\begin{equation} \label{eq:DOM_div_curl}
[707]169\nabla \cdot \left( {\nabla \times {\rm {\bf A}}} \right)=0
170\end{equation}
171
[817]172It is straightforward to demonstrate that these properties are verified locally in
[2282]173discrete form as soon as the scalar $q$ is taken at $t$-points and the vector
[817]174\textbf{A} has its components defined at vector points $(u,v,w)$.
[707]175
[817]176Let $a$ and $b$ be two fields defined on the mesh, with value zero inside
177continental area. Using integration by parts it can be shown that the differencing
[6289]178operators ($\delta_i$, $\delta_j$ and $\delta_k$) are skew-symmetric linear operators,
179and further that the averaging operators $\overline{\,\cdot\,}^{\,i}$,
[817]180$\overline{\,\cdot\,}^{\,k}$ and $\overline{\,\cdot\,}^{\,k}$) are symmetric linear
181operators, $i.e.$
182\begin{align} 
[9407]183\label{eq:DOM_di_adj}
[817]184\sum\limits_i { a_i \;\delta _i \left[ b \right]} 
185   &\equiv -\sum\limits_i {\delta _{i+1/2} \left[ a \right]\;b_{i+1/2} }      \\
[9407]186\label{eq:DOM_mi_adj}
[817]187\sum\limits_i { a_i \;\overline b^{\,i}} 
188   & \equiv \quad \sum\limits_i {\overline a ^{\,i+1/2}\;b_{i+1/2} } 
189\end{align}
[707]190
[817]191In other words, the adjoint of the differencing and averaging operators are
192$\delta_i^*=\delta_{i+1/2}$ and
193${(\overline{\,\cdot \,}^{\,i})}^*= \overline{\,\cdot\,}^{\,i+1/2}$, respectively.
[9407]194These two properties will be used extensively in the \autoref{apdx:C} to
[707]195demonstrate integral conservative properties of the discrete formulation chosen.
196
197% -------------------------------------------------------------------------------------------------------------
[817]198%        Numerical Indexing
[707]199% -------------------------------------------------------------------------------------------------------------
[9393]200\subsection{Numerical indexing}
[9407]201\label{subsec:DOM_Num_Index}
[707]202
203%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[2376]204\begin{figure}[!tb]  \begin{center}
[6997]205\includegraphics[width=0.90\textwidth]{Fig_index_hor}
[9407]206\caption{   \protect\label{fig:index_hor}   
[2376]207Horizontal integer indexing used in the \textsc{Fortran} code. The dashed area indicates
208the cell in which variables contained in arrays have the same $i$- and $j$-indices}
[707]209\end{center}   \end{figure}
210%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
211
[817]212The array representation used in the \textsc{Fortran} code requires an integer
[9407]213indexing while the analytical definition of the mesh (see \autoref{subsec:DOM_cell}) is
[2282]214associated with the use of integer values for $t$-points and both integer and
[817]215integer and a half values for all the other points. Therefore a specific integer
[2282]216indexing must be defined for points other than $t$-points ($i.e.$ velocity and
[817]217vorticity grid-points). Furthermore, the direction of the vertical indexing has
218been changed so that the surface level is at $k=1$.
[707]219
220% -----------------------------------
[817]221%        Horizontal Indexing
[707]222% -----------------------------------
[9393]223\subsubsection{Horizontal indexing}
[9407]224\label{subsec:DOM_Num_Index_hor}
[707]225
[9407]226The indexing in the horizontal plane has been chosen as shown in \autoref{fig:index_hor}.
[2282]227For an increasing $i$ index ($j$ index), the $t$-point and the eastward $u$-point
[9407]228(northward $v$-point) have the same index (see the dashed area in \autoref{fig:index_hor}).
[2282]229A $t$-point and its nearest northeast $f$-point have the same $i$-and $j$-indices.
[707]230
231% -----------------------------------
[817]232%        Vertical indexing
[707]233% -----------------------------------
[9393]234\subsubsection{Vertical indexing}
[9407]235\label{subsec:DOM_Num_Index_vertical}
[707]236
[817]237In the vertical, the chosen indexing requires special attention since the
238$k$-axis is re-orientated downward in the \textsc{Fortran} code compared
[9407]239to the indexing used in the semi-discrete equations and given in \autoref{subsec:DOM_cell}.
[817]240The sea surface corresponds to the $w$-level $k=1$ which is the same index
[9407]241as $t$-level just below (\autoref{fig:index_vert}). The last $w$-level ($k=jpk$)
[817]242either corresponds to the ocean floor or is inside the bathymetry while the last
[9407]243$t$-level is always inside the bathymetry (\autoref{fig:index_vert}). Note that
[2282]244for an increasing $k$ index, a $w$-point and the $t$-point just below have the
[817]245same $k$ index, in opposition to what is done in the horizontal plane where
[2282]246it is the $t$-point and the nearest velocity points in the direction of the horizontal
[1224]247axis that have the same $i$ or $j$ index (compare the dashed area in
[9407]248\autoref{fig:index_hor} and \autoref{fig:index_vert}). Since the scale factors are
[1224]249chosen to be strictly positive, a \emph{minus sign} appears in the \textsc{Fortran} 
250code \emph{before all the vertical derivatives} of the discrete equations given in
251this documentation.
[707]252
253%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[2376]254\begin{figure}[!pt]    \begin{center}
[6997]255\includegraphics[width=.90\textwidth]{Fig_index_vert}
[9407]256\caption{ \protect\label{fig:index_vert}     
[2376]257Vertical integer indexing used in the \textsc{Fortran } code. Note that
[817]258the $k$-axis is orientated downward. The dashed area indicates the cell in
259which variables contained in arrays have the same $k$-index.}
[707]260\end{center}   \end{figure}
261%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
262
263% -----------------------------------
[817]264%        Domain Size
[707]265% -----------------------------------
[9393]266\subsubsection{Domain size}
[9407]267\label{subsec:DOM_size}
[707]268
[4147]269The total size of the computational domain is set by the parameters \np{jpiglo},
[9019]270\np{jpjglo} and \np{jpkglo} in the $i$, $j$ and $k$ directions respectively.
[7705]271%%%
272%%%
273%%%
274Parameters $jpi$ and $jpj$ refer to the size of each processor subdomain when the code is
[9407]275run in parallel using domain decomposition (\key{mpp\_mpi} defined, see \autoref{sec:LBC_mpp}).
[4147]276
[707]277
[7705]278$\ $\newline    % force a new line
[2282]279
[707]280% ================================================================
[7705]281% Domain: List of fields needed
282% ================================================================
[9393]283\section{Needed fields}
[9407]284\label{sec:DOM_fields}
[7705]285The ocean mesh ($i.e.$ the position of all the scalar and vector points) is defined
286by the transformation that gives $(\lambda,\varphi,z)$ as a function of $(i,j,k)$.
287The grid-points are located at integer or integer and a half values of as indicated
[9407]288in \autoref{tab:cell}. The associated scale factors are defined using the 
289analytical first derivative of the transformation \autoref{eq:scale_factors}.
[9019]290Necessary fields for configuration definition are: \\
291Geographic position :
[7705]292
293longitude : glamt , glamu , glamv and glamf  (at T, U, V and F point)
294
[9019]295latitude : gphit , gphiu , gphiv and gphif (at T, U, V and F point)\\
296Coriolis parameter (if domain not on the sphere):
[7705]297
[9019]298 ff\_f  and  ff\_t (at T and F point)\\
299Scale factors :
300 
301 e1t, e1u, e1v and e1f (on i direction),
[7705]302
[9019]303 e2t, e2u, e2v and e2f (on j direction)
[7705]304
[9019]305 and ie1e2u\_v, e1e2u , e1e2v   
306 
307e1e2u , e1e2v are u and v surfaces (if gridsize reduction in some straits)\\
308ie1e2u\_v is a flag to flag set u and  v surfaces are neither read nor computed.\\
309 
[9393]310These fields can be read in an domain input file which name is setted in \np{cn\_domcfg} parameter specified in \ngn{namcfg}.
[9388]311\forfile{../namelists/namcfg}
[9019]312or they can be defined in an analytical way in MY\_SRC directory of the configuration.
313For Reference Configurations of NEMO input domain files are supplied by NEMO System Team. For analytical definition of input fields two routines are supplied: \mdl{userdef\_hgr} and \mdl{userdef\_zgr}. They are an example of GYRE configuration parameters, and they are available in NEMO/OPA\_SRC/USR directory, they provide the horizontal and vertical mesh.
[7705]314% -------------------------------------------------------------------------------------------------------------
315%        Needed fields
316% -------------------------------------------------------------------------------------------------------------
317%\subsection{List of needed fields to build DOMAIN}
[9407]318%\label{subsec:DOM_fields_list}
[7705]319
320
321% ================================================================
[707]322% Domain: Horizontal Grid (mesh)
323% ================================================================
[9393]324\section{Horizontal grid mesh (\protect\mdl{domhgr})}
[9407]325\label{sec:DOM_hgr}
[707]326
327% -------------------------------------------------------------------------------------------------------------
328%        Coordinates and scale factors
329% -------------------------------------------------------------------------------------------------------------
330\subsection{Coordinates and scale factors}
[9407]331\label{subsec:DOM_hgr_coord_e}
[707]332
[817]333The ocean mesh ($i.e.$ the position of all the scalar and vector points) is defined
334by the transformation that gives $(\lambda,\varphi,z)$ as a function of $(i,j,k)$.
335The grid-points are located at integer or integer and a half values of as indicated
[9407]336in \autoref{tab:cell}. The associated scale factors are defined using the
337analytical first derivative of the transformation \autoref{eq:scale_factors}. These
[817]338definitions are done in two modules, \mdl{domhgr} and \mdl{domzgr}, which
339provide the horizontal and vertical meshes, respectively. This section deals with
340the horizontal mesh parameters.
[707]341
[817]342In a horizontal plane, the location of all the model grid points is defined from the
343analytical expressions of the longitude $\lambda$ and  latitude $\varphi$ as a
344function of  $(i,j)$. The horizontal scale factors are calculated using
[9407]345\autoref{eq:scale_factors}. For example, when the longitude and latitude are
[817]346function of a single value ($i$ and $j$, respectively) (geographical configuration
347of the mesh), the horizontal mesh definition reduces to define the wanted
348$\lambda(i)$, $\varphi(j)$, and their derivatives $\lambda'(i)$ $\varphi'(j)$ in the
349\mdl{domhgr} module. The model computes the grid-point positions and scale
350factors in the horizontal plane as follows:
[707]351\begin{flalign*}
[2282]352\lambda_t &\equiv \text{glamt}= \lambda(i)     & \varphi_t &\equiv \text{gphit} = \varphi(j)\\
[817]353\lambda_u &\equiv \text{glamu}= \lambda(i+1/2)& \varphi_u &\equiv \text{gphiu}= \varphi(j)\\
354\lambda_v &\equiv \text{glamv}= \lambda(i)       & \varphi_v &\equiv \text{gphiv} = \varphi(j+1/2)\\
355\lambda_f &\equiv \text{glamf }= \lambda(i+1/2)& \varphi_f &\equiv \text{gphif }= \varphi(j+1/2)
[707]356\end{flalign*}
357\begin{flalign*}
[2282]358e_{1t} &\equiv \text{e1t} = r_a |\lambda'(i)    \; \cos\varphi(j)  |&
359e_{2t} &\equiv \text{e2t} = r_a |\varphi'(j)|  \\
[707]360e_{1u} &\equiv \text{e1t} = r_a |\lambda'(i+1/2)   \; \cos\varphi(j)  |&
361e_{2u} &\equiv \text{e2t} = r_a |\varphi'(j)|\\
362e_{1v} &\equiv \text{e1t} = r_a |\lambda'(i)    \; \cos\varphi(j+1/2)  |&
363e_{2v} &\equiv \text{e2t} = r_a |\varphi'(j+1/2)|\\
364e_{1f} &\equiv \text{e1t} = r_a |\lambda'(i+1/2)\; \cos\varphi(j+1/2)  |&
365e_{2f} &\equiv \text{e2t} = r_a |\varphi'(j+1/2)|
366\end{flalign*}
[817]367where the last letter of each computational name indicates the grid point
368considered and $r_a$ is the earth radius (defined in \mdl{phycst} along with
369all universal constants). Note that the horizontal position of and scale factors
[2282]370at $w$-points are exactly equal to those of $t$-points, thus no specific arrays
[817]371are defined at $w$-points.
[707]372
[817]373Note that the definition of the scale factors ($i.e.$ as the analytical first derivative
374of the transformation that gives $(\lambda,\varphi,z)$ as a function of $(i,j,k)$) is
[2282]375specific to the \NEMO model \citep{Marti_al_JGR92}. As an example, $e_{1t}$ is defined
376locally at a $t$-point, whereas many other models on a C grid choose to define
[817]377such a scale factor as the distance between the $U$-points on each side of the
[2282]378$t$-point. Relying on an analytical transformation has two advantages: firstly, there
[817]379is no ambiguity in the scale factors appearing in the discrete equations, since they
380are first introduced in the continuous equations; secondly, analytical transformations
381encourage good practice by the definition of smoothly varying grids (rather than
382allowing the user to set arbitrary jumps in thickness between adjacent layers)
383\citep{Treguier1996}. An example of the effect of such a choice is shown in
[9407]384\autoref{fig:zgr_e3}.
[707]385%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[2376]386\begin{figure}[!t]     \begin{center}
[6997]387\includegraphics[width=0.90\textwidth]{Fig_zgr_e3}
[9407]388\caption{ \protect\label{fig:zgr_e3}   
[2376]389Comparison of (a) traditional definitions of grid-point position and grid-size in the vertical,
390and (b) analytically derived grid-point position and scale factors.
391For both grids here,  the same $w$-point depth has been chosen but in (a) the
[2282]392$t$-points are set half way between $w$-points while in (b) they are defined from
[6140]393an analytical function: $z(k)=5\,(k-1/2)^3 - 45\,(k-1/2)^2 + 140\,(k-1/2) - 150$.
[817]394Note the resulting difference between the value of the grid-size $\Delta_k$ and
395those of the scale factor $e_k$. }
[707]396\end{center}   \end{figure}
397%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
398
399% -------------------------------------------------------------------------------------------------------------
[817]400%        Choice of horizontal grid
[707]401% -------------------------------------------------------------------------------------------------------------
[817]402\subsection{Choice of horizontal grid}
[9407]403\label{subsec:DOM_hgr_msh_choice}
[707]404
405
406% -------------------------------------------------------------------------------------------------------------
407%        Grid files
408% -------------------------------------------------------------------------------------------------------------
[9393]409\subsection{Output grid files}
[9407]410\label{subsec:DOM_hgr_files}
[707]411
[817]412All the arrays relating to a particular ocean model configuration (grid-point
[9393]413position, scale factors, masks) can be saved in files if \np{nn\_msh} $\not= 0$ 
[4147]414(namelist variable in \ngn{namdom}). This can be particularly useful for plots and off-line
[817]415diagnostics. In some cases, the user may choose to make a local modification
416of a scale factor in the code. This is the case in global configurations when
417restricting the width of a specific strait (usually a one-grid-point strait that
418happens to be too wide due to insufficient model resolution). An example
419is Gibraltar Strait in the ORCA2 configuration. When such modifications are done,
[9393]420the output grid written when \np{nn\_msh} $\not= 0$ is no more equal to the input grid.
[707]421
[7705]422$\ $\newline    % force a new line
[2282]423
[707]424% ================================================================
425% Domain: Vertical Grid (domzgr)
426% ================================================================
[9393]427\section{Vertical grid (\protect\mdl{domzgr})}
[9407]428\label{sec:DOM_zgr}
[707]429%-----------------------------------------nam_zgr & namdom-------------------------------------------
[9388]430%\forfile{../namelists/namzgr}
431\forfile{../namelists/namdom} 
[707]432%-------------------------------------------------------------------------------------------------------------
433
[4147]434Variables are defined through the \ngn{namzgr} and \ngn{namdom} namelists.
[817]435In the vertical, the model mesh is determined by four things:
436(1) the bathymetry given in meters ;
437(2) the number of levels of the model (\jp{jpk}) ;
438(3) the analytical transformation $z(i,j,k)$ and the vertical scale factors
439(derivatives of the transformation) ;
440and (4) the masking system, $i.e.$ the number of wet model levels at each
441$(i,j)$ column of points.
[707]442
443%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[2376]444\begin{figure}[!tb]    \begin{center}
[6997]445\includegraphics[width=1.0\textwidth]{Fig_z_zps_s_sps}
[9407]446\caption{  \protect\label{fig:z_zps_s_sps}   
[2376]447The ocean bottom as seen by the model:
[817]448(a) $z$-coordinate with full step,
449(b) $z$-coordinate with partial step,
450(c) $s$-coordinate: terrain following representation,
451(d) hybrid $s-z$ coordinate,
452(e) hybrid $s-z$ coordinate with partial step, and
[9407]453(f) same as (e) but in the non-linear free surface (\protect\np{ln\_linssh}\forcode{ = .false.}).
[6140]454Note that the non-linear free surface can be used with any of the
[817]4555 coordinates (a) to (e).}
[707]456\end{center}   \end{figure}
457%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
458
[6140]459The choice of a vertical coordinate, even if it is made through \ngn{namzgr} namelist parameters,
[817]460must be done once of all at the beginning of an experiment. It is not intended as an
461option which can be enabled or disabled in the middle of an experiment. Three main
[9407]462choices are offered (\autoref{fig:z_zps_s_sps}a to c): $z$-coordinate with full step
[9393]463bathymetry (\np{ln\_zco}\forcode{ = .true.}), $z$-coordinate with partial step bathymetry
464(\np{ln\_zps}\forcode{ = .true.}), or generalized, $s$-coordinate (\np{ln\_sco}\forcode{ = .true.}).
[817]465Hybridation of the three main coordinates are available: $s-z$ or $s-zps$ coordinate
[9407]466(\autoref{fig:z_zps_s_sps}d and \autoref{fig:z_zps_s_sps}e). By default a non-linear free surface is used:
[6140]467the coordinate follow the time-variation of the free surface so that the transformation is time dependent:
[9407]468$z(i,j,k,t)$ (\autoref{fig:z_zps_s_sps}f). When a linear free surface is assumed (\np{ln\_linssh}\forcode{ = .true.}),
[6140]469the vertical coordinate are fixed in time, but the seawater can move up and down across the z=0 surface
470(in other words, the top of the ocean in not a rigid-lid).
471The last choice in terms of vertical coordinate concerns the presence (or not) in the model domain
[9393]472of ocean cavities beneath ice shelves. Setting \np{ln\_isfcav} to true allows to manage ocean cavities,
[6497]473otherwise they are filled in. This option is currently only available in $z$- or $zps$-coordinate,
474and partial step are also applied at the ocean/ice shelf interface.
[707]475
[817]476Contrary to the horizontal grid, the vertical grid is computed in the code and no
477provision is made for reading it from a file. The only input file is the bathymetry
[6140]478(in meters) (\ifile{bathy\_meter}).
[2282]479\footnote{N.B. in full step $z$-coordinate, a \ifile{bathy\_level} file can replace the
480\ifile{bathy\_meter} file, so that the computation of the number of wet ocean point
481in each water column is by-passed}.
[9393]482If \np{ln\_isfcav}\forcode{ = .true.}, an extra file input file describing the ice shelf draft
[6320]483(in meters) (\ifile{isf\_draft\_meter}) is needed.
[6140]484
[2282]485After reading the bathymetry, the algorithm for vertical grid definition differs
486between the different options:
[707]487\begin{description}
488\item[\textit{zco}] set a reference coordinate transformation $z_0 (k)$, and set $z(i,j,k,t)=z_0 (k)$.
489\item[\textit{zps}] set a reference coordinate transformation $z_0 (k)$, and
[817]490calculate the thickness of the deepest level at each $(i,j)$ point using the
491bathymetry, to obtain the final three-dimensional depth and scale factor arrays.
492\item[\textit{sco}] smooth the bathymetry to fulfil the hydrostatic consistency
493criteria and set the three-dimensional transformation.
494\item[\textit{s-z} and \textit{s-zps}] smooth the bathymetry to fulfil the hydrostatic
495consistency criteria and set the three-dimensional transformation $z(i,j,k)$, and
496possibly introduce masking of extra land points to better fit the original bathymetry file
[707]497\end{description}
[817]498%%%
499\gmcomment{   add the description of the smoothing:  envelop topography...}
500%%%
[707]501
[9393]502Unless a linear free surface is used (\np{ln\_linssh}\forcode{ = .false.}), the arrays describing
[6140]503the grid point depths and vertical scale factors are three set of three dimensional arrays $(i,j,k)$ 
504defined at \textit{before}, \textit{now} and \textit{after} time step. The time at which they are
505defined is indicated by a suffix:$\_b$, $\_n$, or $\_a$, respectively. They are updated at each model time step
506using a fixed reference coordinate system which computer names have a $\_0$ suffix.
[9393]507When the linear free surface option is used (\np{ln\_linssh}\forcode{ = .true.}), \textit{before}, \textit{now} 
[6140]508and \textit{after} arrays are simply set one for all to their reference counterpart.
[707]509
[6140]510
[707]511% -------------------------------------------------------------------------------------------------------------
512%        Meter Bathymetry
513% -------------------------------------------------------------------------------------------------------------
[9393]514\subsection{Meter bathymetry}
[9407]515\label{subsec:DOM_bathy}
[707]516
517Three options are possible for defining the bathymetry, according to the
[9393]518namelist variable \np{nn\_bathy} (found in \ngn{namdom} namelist):
[707]519\begin{description}
[9393]520\item[\np{nn\_bathy}\forcode{ = 0}]: a flat-bottom domain is defined. The total depth $z_w (jpk)$ 
[817]521is given by the coordinate transformation. The domain can either be a closed
[4147]522basin or a periodic channel depending on the parameter \np{jperio}.
[9393]523\item[\np{nn\_bathy}\forcode{ = -1}]: a domain with a bump of topography one third of the
[817]524domain width at the central latitude. This is meant for the "EEL-R5" configuration,
525a periodic or open boundary channel with a seamount.
[9393]526\item[\np{nn\_bathy}\forcode{ = 1}]: read a bathymetry and ice shelf draft (if needed).
[6320]527 The \ifile{bathy\_meter} file (Netcdf format) provides the ocean depth (positive, in meters)
528 at each grid point of the model grid. The bathymetry is usually built by interpolating a standard bathymetry product
[817]529($e.g.$ ETOPO2) onto the horizontal ocean mesh. Defining the bathymetry also
530defines the coastline: where the bathymetry is zero, no model levels are defined
531(all levels are masked).
[6320]532
533The \ifile{isfdraft\_meter} file (Netcdf format) provides the ice shelf draft (positive, in meters)
[9393]534 at each grid point of the model grid. This file is only needed if \np{ln\_isfcav}\forcode{ = .true.}.
[6320]535Defining the ice shelf draft will also define the ice shelf edge and the grounding line position.
[707]536\end{description}
537
[817]538When a global ocean is coupled to an atmospheric model it is better to represent
[707]539all large water bodies (e.g, great lakes, Caspian sea...) even if the model
[817]540resolution does not allow their communication with the rest of the ocean.
541This is unnecessary when the ocean is forced by fixed atmospheric conditions,
542so these seas can be removed from the ocean domain. The user has the option
[9407]543to set the bathymetry in closed seas to zero (see \autoref{sec:MISC_closea}), but the
[817]544code has to be adapted to the user's configuration.
[707]545
546% -------------------------------------------------------------------------------------------------------------
547%        z-coordinate  and reference coordinate transformation
548% -------------------------------------------------------------------------------------------------------------
[9393]549\subsection[$Z$-coordinate (\protect\np{ln\_zco}\forcode{ = .true.}) and ref. coordinate]
550            {$Z$-coordinate (\protect\np{ln\_zco}\forcode{ = .true.}) and reference coordinate}
[9407]551\label{subsec:DOM_zco}
[707]552
553%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[2376]554\begin{figure}[!tb]    \begin{center}
[6997]555\includegraphics[width=0.90\textwidth]{Fig_zgr}
[9407]556\caption{ \protect\label{fig:zgr}   
[2376]557Default vertical mesh for ORCA2: 30 ocean levels (L30). Vertical level functions for
558(a) T-point depth and (b) the associated scale factor as computed
[9407]559from \autoref{eq:DOM_zgr_ana} using \autoref{eq:DOM_zgr_coef} in $z$-coordinate.}
[707]560\end{center}   \end{figure}
561%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
562
[817]563The reference coordinate transformation $z_0 (k)$ defines the arrays $gdept_0$ 
[2282]564and $gdepw_0$ for $t$- and $w$-points, respectively. As indicated on
[9407]565\autoref{fig:index_vert} \jp{jpk} is the number of $w$-levels. $gdepw_0(1)$ is the
[2282]566ocean surface. There are at most \jp{jpk}-1 $t$-points inside the ocean, the
567additional $t$-point at $jk=jpk$ is below the sea floor and is not used.
568The vertical location of $w$- and $t$-levels is defined from the analytic expression
[817]569of the depth $z_0(k)$ whose analytical derivative with respect to $k$ provides the
570vertical scale factors. The user must provide the analytical expression of both
571$z_0$ and its first derivative with respect to $k$. This is done in routine \mdl{domzgr} 
[4147]572through statement functions, using parameters provided in the \ngn{namcfg} namelist.
[707]573
[4147]574It is possible to define a simple regular vertical grid by giving zero stretching (\np{ppacr=0}).
575In that case, the parameters \jp{jpk} (number of $w$-levels) and \np{pphmax} 
[1224]576(total ocean depth in meters) fully define the grid.
[707]577
[817]578For climate-related studies it is often desirable to concentrate the vertical resolution
[1224]579near the ocean surface. The following function is proposed as a standard for a
580$z$-coordinate (with either full or partial steps):
[9407]581\begin{equation} \label{eq:DOM_zgr_ana}
[707]582\begin{split}
583 z_0 (k)    &= h_{sur} -h_0 \;k-\;h_1 \;\log \left[ {\,\cosh \left( {{(k-h_{th} )} / {h_{cr} }} \right)\,} \right] \\ 
584 e_3^0 (k)  &= \left| -h_0 -h_1 \;\tanh \left( {{(k-h_{th} )} / {h_{cr} }} \right) \right|
585\end{split}
586\end{equation}
[817]587where $k=1$ to \jp{jpk} for $w$-levels and $k=1$ to $k=1$ for $T-$levels. Such an
588expression allows us to define a nearly uniform vertical location of levels at the
589ocean top and bottom with a smooth hyperbolic tangent transition in between
[9407]590(\autoref{fig:zgr}).
[707]591
[9393]592If the ice shelf cavities are opened (\np{ln\_isfcav}\forcode{ = .true.}), the definition of $z_0$ is the same.
[6320]593However, definition of $e_3^0$ at $t$- and $w$-points is respectively changed to:
[9407]594\begin{equation} \label{eq:DOM_zgr_ana}
[6320]595\begin{split}
596 e_3^T(k) &= z_W (k+1) - z_W (k)   \\
597 e_3^W(k) &= z_T (k)   - z_T (k-1) \\
598\end{split}
599\end{equation}
600This formulation decrease the self-generated circulation into the ice shelf cavity
601(which can, in extreme case, leads to blow up).\\
602
603 
[817]604The most used vertical grid for ORCA2 has $10~m$ ($500~m)$ resolution in the
605surface (bottom) layers and a depth which varies from 0 at the sea surface to a
606minimum of $-5000~m$. This leads to the following conditions:
[9407]607\begin{equation} \label{eq:DOM_zgr_coef}
[707]608\begin{split}
609 e_3 (1+1/2)      &=10. \\ 
610 e_3 (jpk-1/2) &=500. \\ 
611 z(1)       &=0. \\ 
612 z(jpk)        &=-5000. \\ 
613\end{split}
614\end{equation}
615
[817]616With the choice of the stretching $h_{cr} =3$ and the number of levels
617\jp{jpk}=$31$, the four coefficients $h_{sur}$, $h_{0}$, $h_{1}$, and $h_{th}$ in
[9407]618\autoref{eq:DOM_zgr_ana} have been determined such that \autoref{eq:DOM_zgr_coef} is
[817]619satisfied, through an optimisation procedure using a bisection method. For the first
620standard ORCA2 vertical grid this led to the following values: $h_{sur} =4762.96$,
621$h_0 =255.58, h_1 =245.5813$, and $h_{th} =21.43336$. The resulting depths and
[9407]622scale factors as a function of the model levels are shown in \autoref{fig:zgr} and
623given in \autoref{tab:orca_zgr}. Those values correspond to the parameters
[4147]624\np{ppsur}, \np{ppa0}, \np{ppa1}, \np{ppkth} in \ngn{namcfg} namelist.
[707]625
626Rather than entering parameters $h_{sur}$, $h_{0}$, and $h_{1}$ directly, it is
627possible to recalculate them. In that case the user sets
[9393]628\np{ppsur}\forcode{ = }\np{ppa0}\forcode{ = }\np{ppa1}\forcode{ = 999999}., in \ngn{namcfg} namelist,
[817]629and specifies instead the four following parameters:
[707]630\begin{itemize}
[4147]631\item    \np{ppacr}=$h_{cr} $: stretching factor (nondimensional). The larger
632\np{ppacr}, the smaller the stretching. Values from $3$ to $10$ are usual.
633\item    \np{ppkth}=$h_{th} $: is approximately the model level at which maximum
[817]634stretching occurs (nondimensional, usually of order 1/2 or 2/3 of \jp{jpk})
[4147]635\item    \np{ppdzmin}: minimum thickness for the top layer (in meters)
636\item    \np{pphmax}: total depth of the ocean (meters).
[707]637\end{itemize}
[817]638As an example, for the $45$ layers used in the DRAKKAR configuration those
[9393]639parameters are: \jp{jpk}\forcode{ = 46}, \np{ppacr}\forcode{ = 9}, \np{ppkth}\forcode{ = 23.563}, \np{ppdzmin}\forcode{ = 6}m, \np{pphmax}\forcode{ = 5750}m.
[707]640
641%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[2376]642\begin{table}     \begin{center} \begin{tabular}{c||r|r|r|r}
[707]643\hline
[9019]644\textbf{LEVEL}& \textbf{gdept\_1d}& \textbf{gdepw\_1d}& \textbf{e3t\_1d }& \textbf{e3w\_1d  } \\ \hline
[707]645&  \textbf{  5.00}   &       0.00 & \textbf{ 10.00} &  10.00 \\   \hline
646&  \textbf{15.00} &    10.00 &   \textbf{ 10.00} &  10.00 \\   \hline
647&  \textbf{25.00} &    20.00 &   \textbf{ 10.00} &     10.00 \\   \hline
648&  \textbf{35.01} &    30.00 &   \textbf{ 10.01} &     10.00 \\   \hline
649&  \textbf{45.01} &    40.01 &   \textbf{ 10.01} &  10.01 \\   \hline
650&  \textbf{55.03} &    50.02 &   \textbf{ 10.02} &     10.02 \\   \hline
651&  \textbf{65.06} &    60.04 &   \textbf{ 10.04} &  10.03 \\   \hline
652&  \textbf{75.13} &    70.09 &   \textbf{ 10.09} &  10.06 \\   \hline
653&  \textbf{85.25} &    80.18 &   \textbf{ 10.17} &  10.12 \\   \hline
65410 &  \textbf{95.49} &    90.35 &   \textbf{ 10.33} &  10.24 \\   \hline
65511 &  \textbf{105.97}   &   100.69 &   \textbf{ 10.65} &  10.47 \\   \hline
65612 &  \textbf{116.90}   &   111.36 &   \textbf{ 11.27} &  10.91 \\   \hline
65713 &  \textbf{128.70}   &   122.65 &   \textbf{ 12.47} &  11.77 \\   \hline
65814 &  \textbf{142.20}   &   135.16 &   \textbf{ 14.78} &  13.43 \\   \hline
65915 &  \textbf{158.96}   &   150.03 &   \textbf{ 19.23} &  16.65 \\   \hline
66016 &  \textbf{181.96}   &   169.42 &   \textbf{ 27.66} &  22.78 \\   \hline
66117 &  \textbf{216.65}   &   197.37 &   \textbf{ 43.26} &  34.30 \\ \hline
66218 &  \textbf{272.48}   &   241.13 &   \textbf{ 70.88} &  55.21 \\ \hline
66319 &  \textbf{364.30}   &   312.74 &   \textbf{116.11} &  90.99 \\ \hline
66420 &  \textbf{511.53}   &   429.72 &   \textbf{181.55} &    146.43 \\ \hline
66521 &  \textbf{732.20}   &   611.89 &   \textbf{261.03} &    220.35 \\ \hline
66622 &  \textbf{1033.22}&  872.87 &   \textbf{339.39} &    301.42 \\ \hline
[817]66723 &  \textbf{1405.70}& 1211.59 & \textbf{402.26} &   373.31 \\ \hline
66824 &  \textbf{1830.89}& 1612.98 & \textbf{444.87} &   426.00 \\ \hline
66925 &  \textbf{2289.77}& 2057.13 & \textbf{470.55} &   459.47 \\ \hline
67026 &  \textbf{2768.24}& 2527.22 & \textbf{484.95} &   478.83 \\ \hline
67127 &  \textbf{3257.48}& 3011.90 & \textbf{492.70} &   489.44 \\ \hline
67228 &  \textbf{3752.44}& 3504.46 & \textbf{496.78} &   495.07 \\ \hline
67329 &  \textbf{4250.40}& 4001.16 & \textbf{498.90} &   498.02 \\ \hline
67430 &  \textbf{4749.91}& 4500.02 & \textbf{500.00} &   499.54 \\ \hline
[707]67531 &  \textbf{5250.23}& 5000.00 &   \textbf{500.56} & 500.33 \\ \hline
676\end{tabular} \end{center} 
[9407]677\caption{ \protect\label{tab:orca_zgr}   
[2376]678Default vertical mesh in $z$-coordinate for 30 layers ORCA2 configuration as computed
[9407]679from \autoref{eq:DOM_zgr_ana} using the coefficients given in \autoref{eq:DOM_zgr_coef}}
[707]680\end{table}
681%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
682
683% -------------------------------------------------------------------------------------------------------------
684%        z-coordinate with partial step
685% -------------------------------------------------------------------------------------------------------------
[9393]686\subsection{$Z$-coordinate with partial step (\protect\np{ln\_zps}\forcode{ = .true.})}
[9407]687\label{subsec:DOM_zps}
[817]688%--------------------------------------------namdom-------------------------------------------------------
[9388]689\forfile{../namelists/namdom} 
[707]690%--------------------------------------------------------------------------------------------------------------
691
[817]692In $z$-coordinate partial step, the depths of the model levels are defined by the
[707]693reference analytical function $z_0 (k)$ as described in the previous
[817]694section, \emph{except} in the bottom layer. The thickness of the bottom layer is
[707]695allowed to vary as a function of geographical location $(\lambda,\varphi)$ to allow a
696better representation of the bathymetry, especially in the case of small
697slopes (where the bathymetry varies by less than one level thickness from
698one grid point to the next). The reference layer thicknesses $e_{3t}^0$ have been
699defined in the absence of bathymetry. With partial steps, layers from 1 to
[1224]700\jp{jpk}-2 can have a thickness smaller than $e_{3t}(jk)$. The model deepest layer (\jp{jpk}-1)
701is allowed to have either a smaller or larger thickness than $e_{3t}(jpk)$: the
[707]702maximum thickness allowed is $2*e_{3t}(jpk-1)$. This has to be kept in mind when
[4147]703specifying values in \ngn{namdom} namelist, as the maximum depth \np{pphmax} 
704in partial steps: for example, with
705\np{pphmax}$=5750~m$ for the DRAKKAR 45 layer grid, the maximum ocean depth
[1224]706allowed is actually $6000~m$ (the default thickness $e_{3t}(jpk-1)$ being $250~m$).
707Two variables in the namdom namelist are used to define the partial step
[707]708vertical grid. The mimimum water thickness (in meters) allowed for a cell
[9393]709partially filled with bathymetry at level jk is the minimum of \np{rn\_e3zps\_min} 
710(thickness in meters, usually $20~m$) or $e_{3t}(jk)*$\np{rn\_e3zps\_rat} (a fraction,
[707]711usually 10\%, of the default thickness $e_{3t}(jk)$).
712
[6289]713\gmcomment{ \colorbox{yellow}{Add a figure here of pstep especially at last ocean level }  }
[707]714
715% -------------------------------------------------------------------------------------------------------------
716%        s-coordinate
717% -------------------------------------------------------------------------------------------------------------
[9393]718\subsection{$S$-coordinate (\protect\np{ln\_sco}\forcode{ = .true.})}
[9407]719\label{subsec:DOM_sco}
[817]720%------------------------------------------nam_zgr_sco---------------------------------------------------
[9388]721%\forfile{../namelists/namzgr_sco}
[707]722%--------------------------------------------------------------------------------------------------------------
[4147]723Options are defined in \ngn{namzgr\_sco}.
[9393]724In $s$-coordinate (\np{ln\_sco}\forcode{ = .true.}), the depth and thickness of the model
[817]725levels are defined from the product of a depth field and either a stretching
726function or its derivative, respectively:
[3680]727
[9407]728\begin{equation} \label{eq:DOM_sco_ana}
[707]729\begin{split}
[817]730 z(k)       &= h(i,j) \; z_0(k)  \\
[707]731 e_3(k)  &= h(i,j) \; z_0'(k)
732\end{split}
733\end{equation}
[3680]734
[2282]735where $h$ is the depth of the last $w$-level ($z_0(k)$) defined at the $t$-point
[817]736location in the horizontal and $z_0(k)$ is a function which varies from $0$ at the sea
[707]737surface to $1$ at the ocean bottom. The depth field $h$ is not necessary the ocean
[817]738depth, since a mixed step-like and bottom-following representation of the
[9407]739topography can be used (\autoref{fig:z_zps_s_sps}d-e) or an envelop bathymetry can be defined (\autoref{fig:z_zps_s_sps}f).
[9393]740The namelist parameter \np{rn\_rmax} determines the slope at which the terrain-following coordinate intersects
[6289]741the sea bed and becomes a pseudo z-coordinate.
[9393]742The coordinate can also be hybridised by specifying \np{rn\_sbot\_min} and \np{rn\_sbot\_max} 
[6289]743as the minimum and maximum depths at which the terrain-following vertical coordinate is calculated.
[707]744
[6289]745Options for stretching the coordinate are provided as examples, but care must be taken to ensure
746that the vertical stretch used is appropriate for the application.
[3680]747
[6289]748The original default NEMO s-coordinate stretching is available if neither of the other options
[9393]749are specified as true (\np{ln\_s\_SH94}\forcode{ = .false.} and \np{ln\_s\_SF12}\forcode{ = .false.}).
[6289]750This uses a depth independent $\tanh$ function for the stretching \citep{Madec_al_JPO96}:
[3680]751
752\begin{equation}
753  z = s_{min}+C\left(s\right)\left(H-s_{min}\right)
754  \label{eq:SH94_1}
755\end{equation}
756
[6497]757where $s_{min}$ is the depth at which the $s$-coordinate stretching starts and
758allows a $z$-coordinate to placed on top of the stretched coordinate,
759and $z$ is the depth (negative down from the asea surface).
[3680]760
761\begin{equation}
762  s = -\frac{k}{n-1} \quad \text{ and } \quad 0 \leq k \leq n-1
763  \label{eq:s}
764\end{equation}
765
[9407]766\begin{equation} \label{eq:DOM_sco_function}
[707]767\begin{split}
[3680]768C(s)  &\frac{ \left[   \tanh{ \left( \theta \, (s+b) \right)} 
[707]769               - \tanh{ \left\theta \, b      \right)}  \right]}
770            {2\;\sinh \left( \theta \right)}
771\end{split}
772\end{equation}
773
[6289]774A stretching function, modified from the commonly used \citet{Song_Haidvogel_JCP94} 
[9393]775stretching (\np{ln\_s\_SH94}\forcode{ = .true.}), is also available and is more commonly used for shelf seas modelling:
[3680]776
777\begin{equation}
778  C\left(s\right) =   \left(1 - b \right)\frac{ \sinh\left( \theta s\right)}{\sinh\left(\theta\right)} +      \\
779  b\frac{ \tanh \left[ \theta \left(s + \frac{1}{2} \right)\right] - \tanh\left(\frac{\theta}{2}\right)}{ 2\tanh\left (\frac{\theta}{2}\right)}
780  \label{eq:SH94_2}
781\end{equation}
782
[707]783%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[3680]784\begin{figure}[!ht]    \begin{center}
[6997]785\includegraphics[width=1.0\textwidth]{Fig_sco_function}
[9407]786\caption{  \protect\label{fig:sco_function}   
[3680]787Examples of the stretching function applied to a seamount; from left to right:
[1224]788surface, surface and bottom, and bottom intensified resolutions}
[707]789\end{center}   \end{figure}
790%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
791
[9393]792where $H_c$ is the critical depth (\np{rn\_hc}) at which the coordinate transitions from
793pure $\sigma$ to the stretched coordinate,  and $\theta$ (\np{rn\_theta}) and $b$ (\np{rn\_bb})
[6289]794are the surface and bottom control parameters such that $0\leqslant \theta \leqslant 20$, and
[3680]795$0\leqslant b\leqslant 1$. $b$ has been designed to allow surface and/or bottom
[9407]796increase of the vertical resolution (\autoref{fig:sco_function}).
[3680]797
[9393]798Another example has been provided at version 3.5 (\np{ln\_s\_SF12}) that allows
[6289]799a fixed surface resolution in an analytical terrain-following stretching \citet{Siddorn_Furner_OM12}.
800In this case the a stretching function $\gamma$ is defined such that:
[3680]801
802\begin{equation}
803z = -\gamma h \quad \text{ with } \quad 0 \leq \gamma \leq 1
804\label{eq:z}
805\end{equation}
806
807The function is defined with respect to $\sigma$, the unstretched terrain-following coordinate:
808
[9407]809\begin{equation} \label{eq:DOM_gamma_deriv}
[3680]810\gamma= A\left(\sigma-\frac{1}{2}\left(\sigma^{2}+f\left(\sigma\right)\right)\right)+B\left(\sigma^{3}-f\left(\sigma\right)\right)+f\left(\sigma\right)
811\end{equation}
812
813Where:
[9407]814\begin{equation} \label{eq:DOM_gamma}
[3680]815f\left(\sigma\right)=\left(\alpha+2\right)\sigma^{\alpha+1}-\left(\alpha+1\right)\sigma^{\alpha+2} \quad \text{ and } \quad \sigma = \frac{k}{n-1} 
816\end{equation}
817
[6289]818This gives an analytical stretching of $\sigma$ that is solvable in $A$ and $B$ as a function of
[9393]819the user prescribed stretching parameter $\alpha$ (\np{rn\_alpha}) that stretches towards
820the surface ($\alpha > 1.0$) or the bottom ($\alpha < 1.0$) and user prescribed surface (\np{rn\_zs})
[6289]821and bottom depths. The bottom cell depth in this example is given as a function of water depth:
[3680]822
[9407]823\begin{equation} \label{eq:DOM_zb}
[3680]824Z_b= h a + b
825\end{equation}
826
[9393]827where the namelist parameters \np{rn\_zb\_a} and \np{rn\_zb\_b} are $a$ and $b$ respectively.
[3680]828
829%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
830\begin{figure}[!ht]
[6997]831   \includegraphics[width=1.0\textwidth]{FIG_DOM_compare_coordinates_surface}
[3680]832        \caption{A comparison of the \citet{Song_Haidvogel_JCP94} $S$-coordinate (solid lines), a 50 level $Z$-coordinate (contoured surfaces) and the \citet{Siddorn_Furner_OM12} $S$-coordinate (dashed lines) in the surface 100m for a idealised bathymetry that goes from 50m to 5500m depth. For clarity every third coordinate surface is shown.}
[9407]833    \label{fig:fig_compare_coordinates_surface}
[3680]834\end{figure}
835%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
836
837This gives a smooth analytical stretching in computational space that is constrained to given specified surface and bottom grid cell thicknesses in real space. This is not to be confused with the hybrid schemes that superimpose geopotential coordinates on terrain following coordinates thus creating a non-analytical vertical coordinate that therefore may suffer from large gradients in the vertical resolutions. This stretching is less straightforward to implement than the \citet{Song_Haidvogel_JCP94} stretching, but has the advantage of resolving diurnal processes in deep water and has generally flatter slopes.
838
[9393]839As with the \citet{Song_Haidvogel_JCP94} stretching the stretch is only applied at depths greater than the critical depth $h_c$. In this example two options are available in depths shallower than $h_c$, with pure sigma being applied if the \np{ln\_sigcrit} is true and pure z-coordinates if it is false (the z-coordinate being equal to the depths of the stretched coordinate at $h_c$.
[3680]840
841Minimising the horizontal slope of the vertical coordinate is important in terrain-following systems as large slopes lead to hydrostatic consistency. A hydrostatic consistency parameter diagnostic following \citet{Haney1991} has been implemented, and is output as part of the model mesh file at the start of the run.
842
[707]843% -------------------------------------------------------------------------------------------------------------
844%        z*- or s*-coordinate
845% -------------------------------------------------------------------------------------------------------------
[9393]846\subsection{$Z^*$- or $S^*$-coordinate (\protect\np{ln\_linssh}\forcode{ = .false.}) }
[9407]847\label{subsec:DOM_zgr_star}
[707]848
[6289]849This option is described in the Report by Levier \textit{et al.} (2007), available on the \NEMO web site.
[707]850
851%gm% key advantage: minimise the diffusion/dispertion associated with advection in response to high frequency surface disturbances
852
853% -------------------------------------------------------------------------------------------------------------
854%        level bathymetry and mask
855% -------------------------------------------------------------------------------------------------------------
[9393]856\subsection{Level bathymetry and mask}
[9407]857\label{subsec:DOM_msk}
[707]858
859Whatever the vertical coordinate used, the model offers the possibility of
860representing the bottom topography with steps that follow the face of the
[2282]861model cells (step like topography) \citep{Madec_al_JPO96}. The distribution of
[707]862the steps in the horizontal is defined in a 2D integer array, mbathy, which
863gives the number of ocean levels ($i.e.$ those that are not masked) at each
[2282]864$t$-point. mbathy is computed from the meter bathymetry using the definiton of
[6320]865gdept as the number of $t$-points which gdept $\leq$ bathy.
[707]866
867Modifications of the model bathymetry are performed in the \textit{bat\_ctl} 
[817]868routine (see \mdl{domzgr} module) after mbathy is computed. Isolated grid points
869that do not communicate with another ocean point at the same level are eliminated.
[707]870
[6497]871As for the representation of bathymetry, a 2D integer array, misfdep, is created.
872misfdep defines the level of the first wet $t$-point. All the cells between $k=1$ and $misfdep(i,j)-1$ are masked.
873By default, misfdep(:,:)=1 and no cells are masked.
874
875In case of ice shelf cavities, modifications of the model bathymetry and ice shelf draft into
[6320]876the cavities are performed in the \textit{zgr\_isf} routine. The compatibility between ice shelf draft and bathymetry is checked.
[9393]877All the locations where the isf cavity is thinnest than \np{rn\_isfhmin} meters are grounded ($i.e.$ masked).
[6320]878If only one cell on the water column is opened at $t$-, $u$- or $v$-points, the bathymetry or the ice shelf draft is dug to fit this constrain.
879If the incompatibility is too strong (need to dig more than 1 cell), the cell is masked.\\ 
880
881From the \textit{mbathy} and \textit{misfdep} array, the mask fields are defined as follows:
[707]882\begin{align*}
[6320]883tmask(i,j,k) &= \begin{cases}   \; 0&   \text{ if $k < misfdep(i,j) $ } \\
884                                \; 1&   \text{ if $misfdep(i,j) \leq k\leq mbathy(i,j)$  }    \\
885                                \; 0&   \text{ if $k > mbathy(i,j)$  }    \end{cases}     \\
[817]886umask(i,j,k) &=         \; tmask(i,j,k) \ * \ tmask(i+1,j,k)   \\
[994]887vmask(i,j,k) &=         \; tmask(i,j,k) \ * \ tmask(i,j+1,k)   \\
888fmask(i,j,k) &=         \; tmask(i,j,k) \ * \ tmask(i+1,j,k)   \\
[6497]889             &    \ \ \, * tmask(i,j,k) \ * \ tmask(i+1,j,k) \\
[6320]890wmask(i,j,k) &=         \; tmask(i,j,k) \ * \ tmask(i,j,k-1) \text{ with } wmask(i,j,1) = tmask(i,j,1)
[707]891\end{align*}
892
[6497]893Note that, without ice shelves cavities, masks at $t-$ and $w-$points are identical with
[9407]894the numerical indexing used (\autoref{subsec:DOM_Num_Index}). Nevertheless, $wmask$ are required
[6497]895with oceean cavities to deal with the top boundary (ice shelf/ocean interface)
896exactly in the same way as for the bottom boundary.
[6320]897
898The specification of closed lateral boundaries requires that at least the first and last
[817]899rows and columns of the \textit{mbathy} array are set to zero. In the particular
900case of an east-west cyclical boundary condition, \textit{mbathy} has its last
901column equal to the second one and its first column equal to the last but one
[9407]902(and so too the mask arrays) (see \autoref{fig:LBC_jperio}).
[707]903
[3294]904
905% ================================================================
906% Domain: Initial State (dtatsd & istate)
907% ================================================================
[9393]908\section{Initial state (\protect\mdl{istate} and \protect\mdl{dtatsd})}
[9407]909\label{sec:DTA_tsd}
[3294]910%-----------------------------------------namtsd-------------------------------------------
[9388]911\forfile{../namelists/namtsd} 
[3294]912%------------------------------------------------------------------------------------------
913
[4147]914Options are defined in \ngn{namtsd}.
[3294]915By default, the ocean start from rest (the velocity field is set to zero) and the initialization of
[9393]916temperature and salinity fields is controlled through the \np{ln\_tsd\_ini} namelist parameter.
[3294]917\begin{description}
[9393]918\item[\np{ln\_tsd\_init}\forcode{ = .true.}] use a T and S input files that can be given on the model grid itself or
[3294]919on their native input data grid. In the latter case, the data will be interpolated on-the-fly both in the
[9407]920horizontal and the vertical to the model grid (see \autoref{subsec:SBC_iof}). The information relative to the
[9393]921input files are given in the \np{sn\_tem} and \np{sn\_sal} structures.
[3294]922The computation is done in the \mdl{dtatsd} module.
[9393]923\item[\np{ln\_tsd\_init}\forcode{ = .false.}] use constant salinity value of 35.5 psu and an analytical profile of temperature
[3294]924(typical of the tropical ocean), see \rou{istate\_t\_s} subroutine called from \mdl{istate} module.
925\end{description}
[6997]926\end{document}
Note: See TracBrowser for help on using the repository browser.