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.
Changeset 11564 for NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex – NEMO

Ignore:
Timestamp:
2019-09-18T16:11:52+02:00 (5 years ago)
Author:
jchanut
Message:

#2199, merged with trunk

Location:
NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc
Files:
37 deleted
26 edited
8 copied

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc

    • Property svn:ignore deleted
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex

    • Property svn:ignore
      •  

        old new  
        1 *.aux 
        2 *.bbl 
        3 *.blg 
        4 *.dvi 
        5 *.fdb* 
        6 *.fls 
        7 *.idx 
        8 *.ilg 
        9 *.ind 
        10 *.log 
        11 *.maf 
        12 *.mtc* 
        13 *.out 
        14 *.pdf 
        15 *.toc 
        16 _minted-* 
         1figures 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/HTML_latex2html.sh

    r10146 r11564  
    11#!/bin/bash 
    22 
    3 ./inc/clean.sh 
    4 ./inc/build.sh 
     3#./inc/clean.sh 
     4#./inc/build.sh 
    55 
    6 cd tex_main 
    7 sed -i -e 's#\\documentclass#%\\documentclass#' -e '/{document}/ s/^/%/' \ 
    8    ../tex_sub/*.tex 
    9 sed -i    's#\\subfile{#\\include{#g' \ 
    10    NEMO_manual.tex 
    11 latex2html -local_icons -no_footnode -split 4 -link 2 -mkdir -dir ../html_LaTeX2HTML   \ 
    12             $*                                                                         \ 
    13    NEMO_manual 
    14 sed -i -e 's#%\\documentclass#\\documentclass#' -e '/{document}/ s/^%//' \ 
    15    ../tex_sub/*.tex 
    16 sed -i    's#\\include{#\\subfile{#g' \ 
    17    NEMO_manual.tex 
     6sed -i -e 's#utf8#latin1#'                                 \ 
     7       -e 's#\[outputdir=../build\]{minted}#\[\]{minted}#' \ 
     8       -e '/graphicspath/ s#{../#{../../#g'                \ 
     9          global/packages.tex 
     10 
     11cd ./NEMO/main 
     12sed -i -e 's#\\documentclass#%\\documentclass#' -e '/{document}/ s#^#%#'   ../subfiles/*.tex 
     13sed -i    's#\\subfile{#\\input{#'                                         chapters.tex appendices.tex 
     14 
     15#latex2html                                   -noimages -local_icons -no_footnode -split 4 -link 2 -dir ../html_LaTeX2HTML $* NEMO_manual 
     16latex2html -debug -noreuse -init_file ../../l2hconf.pm -local_icons                               -dir ../build/html               NEMO_manual 
     17 
     18sed -i -e 's#%\\documentclass#\\documentclass#' -e '/{document}/ s#^%##'   ../subfiles/*.tex 
     19sed -i    's#\\input{#\\subfile{#'                                         chapters.tex appendices.tex 
    1820cd - 
    1921 
     22sed -i -e 's#latin1#utf8#'                                 \ 
     23       -e 's#\[\]{minted}#\[outputdir=../build\]{minted}#' \ 
     24       -e '/graphicspath/ s#{../../#{../#g'                \ 
     25     global/packages.tex 
     26 
    2027exit 0 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO

    • Property svn:ignore deleted
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/main

    • Property svn:ignore
      •  

        old new  
        1 *.aux 
        2 *.bbl 
        3 *.blg 
        4 *.dvi 
        5 *.fdb* 
        6 *.fls 
        7 *.idx 
        81*.ilg 
        92*.ind 
        10 *.log 
        11 *.maf 
        12 *.mtc* 
        13 *.out 
        14 *.pdf 
        15 *.toc 
        16 _minted-* 
    • Property svn:externals set to
      ^/utils/dev/bibtool.rsc bibtool.rsc
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_ASM.tex

    r10442 r11564  
    88\label{chap:ASM} 
    99 
    10 Authors: D. Lea,  M. Martin, K. Mogensen, A. Weaver, ...   % do we keep 
    11  
    12 \minitoc 
     10\chaptertoc 
     11 
     12\vfill 
     13\begin{figure}[b] 
     14\subsubsection*{Changes record} 
     15\begin{tabular}{l||l|m{0.65\linewidth}} 
     16    Release   & Author        & Modifications \\ 
     17    {\em 4.0} & {\em D. J. Lea} & {\em \NEMO\ 4.0 updates}  \\ 
     18    {\em 3.4} & {\em D. J. Lea, M. Martin, K. Mogensen, A. Weaver} & {\em Initial version}  \\ 
     19\end{tabular} 
     20\end{figure} 
    1321 
    1422\newpage 
    1523 
    1624The ASM code adds the functionality to apply increments to the model variables: temperature, salinity, 
    17 sea surface height, velocity and sea ice concentration.  
     25sea surface height, velocity and sea ice concentration. 
    1826These are read into the model from a NetCDF file which may be produced by separate data assimilation code. 
    1927The code can also output model background fields which are used as an input to data assimilation code. 
    20 This is all controlled by the namelist \textit{\ngn{nam\_asminc} }. 
     28This is all controlled by the namelist \nam{\_asminc}. 
    2129There is a brief description of all the namelist options provided. 
    2230To build the ASM code \key{asminc} must be set. 
     
    3745it may be preferable to introduce the increment gradually into the ocean model in order to 
    3846minimize spurious adjustment processes. 
    39 This technique is referred to as Incremental Analysis Updates (IAU) \citep{Bloom_al_MWR96}. 
     47This technique is referred to as Incremental Analysis Updates (IAU) \citep{bloom.takacs.ea_MWR96}. 
    4048IAU is a common technique used with 3D assimilation methods such as 3D-Var or OI. 
    4149IAU is used when \np{ln\_asmiau} is set to true. 
    4250 
    43 With IAU, the model state trajectory ${\bf x}$ in the assimilation window ($t_{0} \leq t_{i} \leq t_{N}$) 
     51With IAU, the model state trajectory ${\mathbf x}$ in the assimilation window ($t_{0} \leq t_{i} \leq t_{N}$) 
    4452is corrected by adding the analysis increments for temperature, salinity, horizontal velocity and SSH as 
    4553additional tendency terms to the prognostic equations: 
    4654\begin{align*} 
    47   % \label{eq:wa_traj_iau} 
    48   {\bf x}^{a}(t_{i}) = M(t_{i}, t_{0})[{\bf x}^{b}(t_{0})] \; + \; F_{i} \delta \tilde{\bf x}^{a} 
     55  % \label{eq:ASM_wa_traj_iau} 
     56  {\mathbf x}^{a}(t_{i}) = M(t_{i}, t_{0})[{\mathbf x}^{b}(t_{0})] \; + \; F_{i} \delta \tilde{\mathbf x}^{a} 
    4957\end{align*} 
    50 where $F_{i}$ is a weighting function for applying the increments $\delta\tilde{\bf x}^{a}$ defined such that 
     58where $F_{i}$ is a weighting function for applying the increments $\delta\tilde{\mathbf x}^{a}$ defined such that 
    5159$\sum_{i=1}^{N} F_{i}=1$. 
    52 ${\bf x}^b$ denotes the model initial state and ${\bf x}^a$ is the model state after the increments are applied. 
     60${\mathbf x}^b$ denotes the model initial state and ${\mathbf x}^a$ is the model state after the increments are applied. 
    5361To control the adjustment time of the model to the increment, 
    5462the increment can be applied over an arbitrary sub-window, $t_{m} \leq t_{i} \leq t_{n}$, 
     
    5664Typically the increments are spread evenly over the full window. 
    5765In addition, two different weighting functions have been implemented. 
    58 The first function employs constant weights,  
     66The first function (namelist option \np{niaufn}=0) employs constant weights, 
    5967\begin{align} 
    60   \label{eq:F1_i} 
     68  \label{eq:ASM_F1_i} 
    6169  F^{(1)}_{i} 
    6270  =\left\{ 
    6371  \begin{array}{ll} 
    64     0     &    {\rm if} \; \; \; t_{i} < t_{m}                \\ 
    65     1/M &    {\rm if} \; \; \; t_{m} < t_{i} \leq t_{n} \\ 
    66     0     &    {\rm if} \; \; \; t_{i} > t_{n} 
     72    0     &    {\mathrm if} \; \; \; t_{i} < t_{m}                \\ 
     73    1/M &    {\mathrm if} \; \; \; t_{m} < t_{i} \leq t_{n} \\ 
     74    0     &    {\mathrm if} \; \; \; t_{i} > t_{n} 
    6775  \end{array} 
    68             \right.  
     76            \right. 
    6977\end{align} 
    7078where $M = m-n$. 
    71 The second function employs peaked hat-like weights in order to give maximum weight in the centre of the sub-window, 
     79The second function (namelist option \np{niaufn}=1) employs peaked hat-like weights in order to give maximum weight in the centre of the sub-window, 
    7280with the weighting reduced linearly to a small value at the window end-points: 
    7381\begin{align} 
    74   \label{eq:F2_i} 
     82  \label{eq:ASM_F2_i} 
    7583  F^{(2)}_{i} 
    7684  =\left\{ 
    7785  \begin{array}{ll} 
    78     0                           &    {\rm if} \; \; \; t_{i}       <     t_{m}                        \\ 
    79     \alpha \, i               &    {\rm if} \; \; \; t_{m}    \leq t_{i}    \leq   t_{M/2}   \\ 
    80     \alpha \, (M - i +1) &    {\rm if} \; \; \; t_{M/2}  <    t_{i}    \leq   t_{n}       \\ 
    81     0                            &   {\rm if} \; \; \; t_{i}        >    t_{n} 
     86    0                           &    {\mathrm if} \; \; \; t_{i}       <     t_{m}                        \\ 
     87    \alpha \, i               &    {\mathrm if} \; \; \; t_{m}    \leq t_{i}    \leq   t_{M/2}   \\ 
     88    \alpha \, (M - i +1) &    {\mathrm if} \; \; \; t_{M/2}  <    t_{i}    \leq   t_{n}       \\ 
     89    0                            &   {\mathrm if} \; \; \; t_{i}        >    t_{n} 
    8290  \end{array} 
    8391                                   \right. 
    8492\end{align} 
    85 where $\alpha^{-1} = \sum_{i=1}^{M/2} 2i$ and $M$ is assumed to be even.  
    86 The weights described by \autoref{eq:F2_i} provide a smoother transition of the analysis trajectory from 
    87 one assimilation cycle to the next than that described by \autoref{eq:F1_i}. 
     93where $\alpha^{-1} = \sum_{i=1}^{M/2} 2i$ and $M$ is assumed to be even. 
     94The weights described by \autoref{eq:ASM_F2_i} provide a smoother transition of the analysis trajectory from 
     95one assimilation cycle to the next than that described by \autoref{eq:ASM_F1_i}. 
    8896 
    8997%========================================================================== 
     
    92100\label{sec:ASM_div_dmp} 
    93101 
    94 The velocity increments may be initialized by the iterative application of a divergence damping operator. 
    95 In iteration step $n$ new estimates of velocity increments $u^{n}_I$ and $v^{n}_I$ are updated by: 
     102It is quite challenging for data assimilation systems to provide non-divergent velocity increments. 
     103Applying divergent velocity increments will likely cause spurious vertical velocities in the model. This section describes a method to take velocity increments provided to \NEMO\ ($u^0_I$ and $v^0_I$) and adjust them by the iterative application of a divergence damping operator. The method is also described in \citet{dobricic.pinardi.ea_OS07}. 
     104 
     105In iteration step $n$ (starting at $n=1$) new estimates of velocity increments $u^{n}_I$ and $v^{n}_I$ are updated by: 
     106 
    96107\begin{equation} 
    97   \label{eq:asm_dmp} 
     108  \label{eq:ASM_dmp} 
    98109  \left\{ 
    99110    \begin{aligned} 
     
    105116  \right., 
    106117\end{equation} 
    107 where 
     118 
     119where the divergence is defined as 
     120 
    108121\[ 
    109   % \label{eq:asm_div} 
     122  % \label{eq:ASM_div} 
    110123  \chi^{n-1}_I = \frac{1}{e_{1t}\,e_{2t}\,e_{3t} } 
    111124  \left( {\delta_i \left[ {e_{2u}\,e_{3u}\,u^{n-1}_I} \right] 
    112125      +\delta_j \left[ {e_{1v}\,e_{3v}\,v^{n-1}_I} \right]} \right). 
    113126\] 
    114 By the application of \autoref{eq:asm_dmp} and \autoref{eq:asm_dmp} the divergence is filtered in each iteration, 
     127 
     128By the application of \autoref{eq:ASM_dmp} the divergence is filtered in each iteration, 
    115129and the vorticity is left unchanged. 
    116130In the presence of coastal boundaries with zero velocity increments perpendicular to the coast 
     
    118132This type of the initialisation reduces the vertical velocity magnitude and 
    119133alleviates the problem of the excessive unphysical vertical mixing in the first steps of the model integration 
    120 \citep{Talagrand_JAS72, Dobricic_al_OS07}. 
     134\citep{talagrand_JAS72, dobricic.pinardi.ea_OS07}. 
    121135Diffusion coefficients are defined as $A_D = \alpha e_{1t} e_{2t}$, where $\alpha = 0.2$. 
    122 The divergence damping is activated by assigning to \np{nn\_divdmp} in the \textit{nam\_asminc} namelist 
     136The divergence damping is activated by assigning to \np{nn\_divdmp} in the \nam{\_asminc} namelist 
    123137a value greater than zero. 
    124 By choosing this value to be of the order of 100 the increments in 
    125 the vertical velocity will be significantly reduced. 
     138This specifies the number of iterations of the divergence damping. Setting a value of the order of 100 will result in a significant reduction in the vertical velocity induced by the increments. 
    126139 
    127140 
     
    131144\label{sec:ASM_details} 
    132145 
    133 Here we show an example \ngn{namasm} namelist and the header of an example assimilation increments file on 
     146Here we show an example \nam{\_asminc} namelist and the header of an example assimilation increments file on 
    134147the ORCA2 grid. 
    135148 
    136 %------------------------------------------namasm----------------------------------------------------- 
     149%------------------------------------------nam_asminc----------------------------------------------------- 
    137150% 
    138 \nlst{nam_asminc} 
     151\begin{listing} 
     152  \nlst{nam_asminc} 
     153  \caption{\texttt{nam\_asminc}} 
     154  \label{lst:nam_asminc} 
     155\end{listing} 
    139156%------------------------------------------------------------------------------------------------------------- 
    140157 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_DIA.tex

    r10509 r11564  
    88\label{chap:DIA} 
    99 
    10 \minitoc 
     10\chaptertoc 
     11 
     12\vfill 
     13\begin{figure}[b] 
     14\subsubsection*{Changes record} 
     15\begin{tabular}{l||l|m{0.65\linewidth}} 
     16    Release   & Author        & Modifications \\ 
     17    {\em 4.0} & {\em Mirek Andrejczuk, Massimiliano Drudi} & {\em }  \\ 
     18    {\em }      & {\em Dorotea Iovino, Nicolas Martin} & {\em }  \\ 
     19    {\em 3.6} & {\em Gurvan Madec, Sebastien Masson } & {\em }  \\ 
     20    {\em 3.4} & {\em Gurvan Madec, Rachid Benshila, Andrew Coward } & {\em }  \\ 
     21    {\em }      & {\em Christian Ethe, Sebastien Masson } & {\em }  \\ 
     22\end{tabular} 
     23\end{figure} 
    1124 
    1225\newpage 
    1326 
    1427% ================================================================ 
    15 %       Old Model Output  
     28%       Old Model Output 
    1629% ================================================================ 
    17 \section{Old model output (default)} 
     30\section{Model output} 
    1831\label{sec:DIA_io_old} 
    1932 
     
    2538the same run performed in one step. 
    2639It should be noted that this requires that the restart file contains two consecutive time steps for 
    27 all the prognostic variables, and that it is saved in the same binary format as the one used by the computer that 
    28 is to read it (in particular, 32 bits binary IEEE format must not be used for this file). 
     40all the prognostic variables. 
    2941 
    3042The output listing and file(s) are predefined but should be checked and eventually adapted to the user's needs. 
    31 The output listing is stored in the $ocean.output$ file. 
    32 The information is printed from within the code on the logical unit $numout$. 
     43The output listing is stored in the \textit{ocean.output} file. 
     44The information is printed from within the code on the logical unit \texttt{numout}. 
    3345To locate these prints, use the UNIX command "\textit{grep -i numout}" in the source code directory. 
    3446 
     
    3951A complete description of the use of this I/O server is presented in the next section. 
    4052 
    41 By default, \key{iomput} is not defined, 
    42 NEMO produces NetCDF with the old IOIPSL library which has been kept for compatibility and its easy installation. 
    43 However, the IOIPSL library is quite inefficient on parallel machines and, since version 3.2, 
    44 many diagnostic options have been added presuming the use of \key{iomput}. 
    45 The usefulness of the default IOIPSL-based option is expected to reduce with each new release. 
    46 If \key{iomput} is not defined, output files and content are defined in the \mdl{diawri} module and 
    47 contain mean (or instantaneous if \key{diainstant} is defined) values over a regular period of 
    48 nn\_write time-steps (namelist parameter).  
    49  
    5053%\gmcomment{                    % start of gmcomment 
    5154 
     
    5659\label{sec:DIA_iom} 
    5760 
    58 Since version 3.2, iomput is the NEMO output interface of choice. 
     61Since version 3.2, iomput is the \NEMO\ output interface of choice. 
    5962It has been designed to be simple to use, flexible and efficient. 
    60 The two main purposes of iomput are:  
     63The two main purposes of iomput are: 
    6164 
    6265\begin{enumerate} 
     
    6972\end{enumerate} 
    7073 
    71 The first functionality allows the user to specify, without code changes or recompilation,  
     74The first functionality allows the user to specify, without code changes or recompilation, 
    7275aspects of the diagnostic output stream, such as: 
    7376 
     
    9194in a very easy way. 
    9295All details of iomput functionalities are listed in the following subsections. 
    93 Examples of the XML files that control the outputs can be found in: \path{NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef.xml}, 
    94 \path{NEMOGCM/CONFIG/SHARED/field_def.xml} and \path{NEMOGCM/CONFIG/SHARED/domain_def.xml}. \\ 
     96Examples of the XML files that control the outputs can be found in: 
     97\path{cfgs/ORCA2_ICE_PISCES/EXPREF/iodef.xml}, 
     98\path{cfgs/SHARED/field_def_nemo-oce.xml}, 
     99\path{cfgs/SHARED/field_def_nemo-pisces.xml}, 
     100\path{cfgs/SHARED/field_def_nemo-ice.xml} and \path{cfgs/SHARED/domain_def_nemo.xml}. \\ 
    95101 
    96102The second functionality targets output performance when running in parallel (\key{mpp\_mpi}). 
    97 Iomput provides the possibility to specify N dedicated I/O processes (in addition to the NEMO processes) 
     103Iomput provides the possibility to specify N dedicated I/O processes (in addition to the \NEMO\ processes) 
    98104to collect and write the outputs. 
    99105With an appropriate choice of N by the user, the bottleneck associated with the writing of 
    100106the output files can be greatly reduced. 
    101107 
    102 In version 3.6, the iom\_put interface depends on 
    103 an external code called \href{https://forge.ipsl.jussieu.fr/ioserver/browser/XIOS/branchs/xios-1.0}{XIOS-1.0}  
    104 (use of revision 618 or higher is required). 
     108In version 3.6, the \rou{iom\_put} interface depends on 
     109an external code called \href{https://forge.ipsl.jussieu.fr/ioserver/browser/XIOS/branchs/xios-2.5}{XIOS-2.5} 
     110%(use of revision 618 or higher is required). 
    105111This new IO server can take advantage of the parallel I/O functionality of NetCDF4 to 
    106112create a single output file and therefore to bypass the rebuilding phase. 
    107113Note that writing in parallel into the same NetCDF files requires that your NetCDF4 library is linked to 
    108 an HDF5 library that has been correctly compiled (\ie with the configure option $--$enable-parallel). 
     114an HDF5 library that has been correctly compiled (\ie\ with the configure option $--$enable-parallel). 
    109115Note that the files created by iomput through XIOS are incompatible with NetCDF3. 
    110116All post-processsing and visualization tools must therefore be compatible with NetCDF4 and not only NetCDF3. 
    111117 
    112118Even if not using the parallel I/O functionality of NetCDF4, using N dedicated I/O servers, 
    113 where N is typically much less than the number of NEMO processors, will reduce the number of output files created. 
    114 This can greatly reduce the post-processing burden usually associated with using large numbers of NEMO processors. 
     119where N is typically much less than the number of \NEMO\ processors, will reduce the number of output files created. 
     120This can greatly reduce the post-processing burden usually associated with using large numbers of \NEMO\ processors. 
    115121Note that for smaller configurations, the rebuilding phase can be avoided, 
    116122even without a parallel-enabled NetCDF4 library, simply by employing only one dedicated I/O server. 
     
    118124\subsection{XIOS: Reading and writing restart file} 
    119125 
    120 XIOS may be used to read single file restart produced by NEMO. Currently only the variables written to  
    121 file \forcode{numror} can be handled by XIOS. To activate restart reading using XIOS, set \np{ln\_xios\_read}\forcode{ = .true. } 
    122 in \textit{namelist\_cfg}. This setting will be ignored when multiple restart files are present, and default NEMO  
    123 functionality will be used for reading. There is no need to change iodef.xml file to use XIOS to read  
    124 restart, all definitions are done within the NEMO code. For high resolution configuration, however,  
     126XIOS may be used to read single file restart produced by \NEMO. Currently only the variables written to 
     127file \forcode{numror} can be handled by XIOS. To activate restart reading using XIOS, set \np{ln\_xios\_read}\forcode{=.true. } 
     128in \textit{namelist\_cfg}. This setting will be ignored when multiple restart files are present, and default \NEMO 
     129functionality will be used for reading. There is no need to change iodef.xml file to use XIOS to read 
     130restart, all definitions are done within the \NEMO\ code. For high resolution configuration, however, 
    125131there may be a need to add the following line in iodef.xml (xios context): 
    126132 
     
    129135\end{xmllines} 
    130136 
    131 This variable sets timeout for reading.  
    132  
    133 If XIOS is to be used to read restart from file generated with an earlier NEMO version (3.6 for instance), 
     137This variable sets timeout for reading. 
     138 
     139If XIOS is to be used to read restart from file generated with an earlier \NEMO\ version (3.6 for instance), 
    134140dimension \forcode{z} defined in restart file must be renamed to \forcode{nav_lev}.\\ 
    135141 
    136 XIOS can also be used to write NEMO restart. A namelist parameter \np{nn\_wxios} is used to determine the  
    137 type of restart NEMO will write. If it is set to 0, default NEMO functionality will be used - each  
    138 processor writes its own restart file; if it is set to 1 XIOS will write restart into a single file;  
    139 for \np{nn\_wxios = 2} the restart will be written by XIOS into multiple files, one for each XIOS server.  
    140 Note, however, that \textbf{NEMO will not read restart generated by XIOS when \np{nn\_wxios = 2}}. The restart will  
    141 have to be rebuild before continuing the run. This option aims to reduce number of restart files generated by NEMO only,  
    142 and may be useful when there is a need to change number of processors used to run simulation.  
     142XIOS can also be used to write \NEMO\ restart. A namelist parameter \np{nn\_wxios} is used to determine the 
     143type of restart \NEMO\ will write. If it is set to 0, default \NEMO\ functionality will be used - each 
     144processor writes its own restart file; if it is set to 1 XIOS will write restart into a single file; 
     145for \np{nn\_wxios}\forcode{=2} the restart will be written by XIOS into multiple files, one for each XIOS server. 
     146Note, however, that \textbf{\NEMO\ will not read restart generated by XIOS when \np{nn\_wxios}\forcode{=2}}. The restart will 
     147have to be rebuild before continuing the run. This option aims to reduce number of restart files generated by \NEMO\ only, 
     148and may be useful when there is a need to change number of processors used to run simulation. 
    143149 
    144150If an additional variable must be written to a restart file, the following steps are needed: 
    145151\begin{description} 
    146    \item[step 1:] add variable name to a list of restart variables (in subroutine \rou{iom\_set\_rst\_vars,} \mdl{iom}) and  
    147 define correct grid for the variable (\forcode{grid_N_3D} - 3D variable, \forcode{grid_N} - 2D variable, \forcode{grid_vector} -  
     152   \item[step 1:] add variable name to a list of restart variables (in subroutine \rou{iom\_set\_rst\_vars,} \mdl{iom}) and 
     153define correct grid for the variable (\forcode{grid_N_3D} - 3D variable, \forcode{grid_N} - 2D variable, \forcode{grid_vector} - 
    1481541D variable, \forcode{grid_scalar} - scalar), 
    149    \item[step 2:] add variable to the list of fields written by restart.  This can be done either in subroutine  
    150 \rou{iom\_set\_rstw\_core} (\mdl{iom}) or by calling  \rou{iom\_set\_rstw\_active} (\mdl{iom}) with the name of a variable  
    151 as an argument. This convention follows approach for writing restart using iom, where variables are  
     155   \item[step 2:] add variable to the list of fields written by restart.  This can be done either in subroutine 
     156\rou{iom\_set\_rstw\_core} (\mdl{iom}) or by calling  \rou{iom\_set\_rstw\_active} (\mdl{iom}) with the name of a variable 
     157as an argument. This convention follows approach for writing restart using iom, where variables are 
    152158written either by \rou{rst\_write} or by calling \rou{iom\_rstput} from individual routines. 
    153159\end{description} 
     
    168174\xmlline|<variable id="using_server" type="bool"></variable>| 
    169175 
    170 The {\tt using\_server} setting determines whether or not the server will be used in \textit{attached mode} 
    171 (as a library) [{\tt> false <}] or in \textit{detached mode} 
    172 (as an external executable on N additional, dedicated cpus) [{\tt > true <}]. 
    173 The \textit{attached mode} is simpler to use but much less efficient for massively parallel applications. 
     176The \texttt{using\_server} setting determines whether or not the server will be used in 
     177\textit{attached mode} 
     178(as a library) [\texttt{> false <}] or in \textit{detached mode} 
     179(as an external executable on N additional, dedicated cpus) [\texttt{ > true <}]. 
     180The \textit{attached mode} is simpler to use but much less efficient for 
     181massively parallel applications. 
    174182The type of each file can be either ''multiple\_file'' or ''one\_file''. 
    175183 
    176184In \textit{attached mode} and if the type of file is ''multiple\_file'', 
    177 then each NEMO process will also act as an IO server and produce its own set of output files. 
     185then each \NEMO\ process will also act as an IO server and produce its own set of output files. 
    178186Superficially, this emulates the standard behaviour in previous versions. 
    179187However, the subdomain written out by each process does not correspond to 
     
    187195write to its own set of output files. 
    188196If the ''one\_file'' option is chosen then all XIOS processes will collect their longitudinal strips and 
    189 write (in parallel) to a single output file.  
     197write (in parallel) to a single output file. 
    190198Note running in detached mode requires launching a Multiple Process Multiple Data (MPMD) parallel job. 
    191199The following subsection provides a typical example but the syntax will vary in different MPP environments. 
     
    194202 
    195203The number of cores used by the XIOS is specified when launching the model. 
    196 The number of cores dedicated to XIOS should be from \texttildelow1/10 to \texttildelow1/50 of the number of  
    197 cores dedicated to NEMO. 
     204The number of cores dedicated to XIOS should be from \texttildelow1/10 to \texttildelow1/50 of the number of 
     205cores dedicated to \NEMO. 
    198206Some manufacturers suggest using O($\sqrt{N}$) dedicated IO processors for N processors but 
    199 this is a general recommendation and not specific to NEMO. 
     207this is a general recommendation and not specific to \NEMO. 
    200208It is difficult to provide precise recommendations because the optimal choice will depend on 
    201 the particular hardware properties of the target system  
     209the particular hardware properties of the target system 
    202210(parallel filesystem performance, available memory, memory bandwidth etc.) 
    203211and the volume and frequency of data to be created. 
     
    207215\subsubsection{Control of XIOS: the context in iodef.xml} 
    208216 
    209 As well as the {\tt using\_server} flag, other controls on the use of XIOS are set in the XIOS context in iodef.xml. 
     217As well as the \texttt{using\_server} flag, other controls on the use of XIOS are set in 
     218the XIOS context in \textit{iodef.xml}. 
    210219See the XML basics section below for more details on XML syntax and rules. 
    211220 
    212221\begin{table} 
    213   \scriptsize 
    214222  \begin{tabularx}{\textwidth}{|lXl|} 
    215223    \hline 
     
    220228    \hline 
    221229    buffer\_size                                                            & 
    222     buffer size used by XIOS to send data from NEMO to XIOS. 
     230    buffer size used by XIOS to send data from \NEMO\ to XIOS. 
    223231    Larger is more efficient. 
    224232    Note that needed/used buffer sizes are summarized at the end of the job & 
     
    226234    \hline 
    227235    buffer\_server\_factor\_size                                            & 
    228     ratio between NEMO and XIOS buffer size. 
     236    ratio between \NEMO\ and XIOS buffer size. 
    229237    Should be 2.                                                            & 
    230238    2        \\ 
     
    243251    \hline 
    244252    oasis\_codes\_id                                                        & 
    245     when using oasis, define the identifier of NEMO in the namcouple. 
     253    when using oasis, define the identifier of \NEMO\ in the namcouple. 
    246254    Note that the identifier of XIOS is xios.x                              & 
    247255    oceanx   \\ 
     
    254262\subsubsection{Installation} 
    255263 
    256 As mentioned, XIOS is supported separately and must be downloaded and compiled before it can be used with NEMO. 
     264As mentioned, XIOS is supported separately and must be downloaded and compiled before it can be used with \NEMO. 
    257265See the installation guide on the \href{http://forge.ipsl.jussieu.fr/ioserver/wiki}{XIOS} wiki for help and guidance. 
    258 NEMO will need to link to the compiled XIOS library. 
    259 The \href{https://forge.ipsl.jussieu.fr/nemo/wiki/Users/ModelInterfacing/InputsOutputs#Inputs-OutputsusingXIOS} 
    260 {XIOS with NEMO} guide provides an example illustration of how this can be achieved. 
     266\NEMO\ will need to link to the compiled XIOS library. 
     267The \href{https://forge.ipsl.jussieu.fr/nemo/chrome/site/doc/NEMO/guide/html/install.html#extract-and-install-xios} 
     268{Extract and install XIOS} guide provides an example illustration of how this can be achieved. 
    261269 
    262270\subsubsection{Add your own outputs} 
     
    269277\begin{enumerate} 
    270278\item[1.] 
    271   in NEMO code, add a \forcode{CALL iom\_put( 'identifier', array )} where you want to output a 2D or 3D array. 
     279  in \NEMO\ code, add a \forcode{CALL iom_put( 'identifier', array )} where you want to output a 2D or 3D array. 
    272280\item[2.] 
    273281  If necessary, add \forcode{USE iom ! I/O manager library} to the list of used modules in 
     
    282290   <field_group id="grid_T" grid_ref="grid_T_3D"> <!-- T grid --> 
    283291   ... 
    284       <field id="identifier" long_name="blabla" ... />    
     292      <field id="identifier" long_name="blabla" ... /> 
    285293      ... 
    286 </field_definition>  
     294</field_definition> 
    287295\end{xmllines} 
    288296 
     
    307315 
    308316\begin{xmllines} 
    309 <file id="file1" .../>    
     317<file id="file1" .../> 
    310318... 
    311    <field field_ref="identifier" />    
     319   <field field_ref="identifier" /> 
    312320   ... 
    313 </file>    
     321</file> 
    314322\end{xmllines} 
    315323 
     
    327335See \href{http://www.xmlnews.org/docs/xml-basics.html}{here} for more details. 
    328336 
    329 \subsubsection{Structure of the XML file used in NEMO} 
     337\subsubsection{Structure of the XML file used in \NEMO} 
    330338 
    331339The XML file used in XIOS is structured by 7 families of tags: 
     
    334342 
    335343\begin{table} 
    336   \scriptsize 
    337344  \begin{tabular*}{\textwidth}{|p{0.15\textwidth}p{0.4\textwidth}p{0.35\textwidth}|} 
    338345    \hline 
     
    366373 
    367374\begin{table} 
    368   \scriptsize 
    369375  \begin{tabular}{|p{0.15\textwidth}p{0.4\textwidth}p{0.35\textwidth}|} 
    370376    \hline 
     
    376382                                                                                                     \xmlcode{<context id="xios" ... >}   \\ 
    377383    \hline 
    378     context nemo    &   context containing IO information for NEMO (mother grid when using AGRIF)  &  
     384    context nemo    &   context containing IO information for \NEMO\ (mother grid when using AGRIF)  & 
    379385                                                                                                     \xmlcode{<context id="nemo" ... >}   \\ 
    380386    \hline 
    381     context 1\_nemo &   context containing IO information for NEMO child grid 1 (when using AGRIF) &  
     387    context 1\_nemo &   context containing IO information for \NEMO\ child grid 1 (when using AGRIF) & 
    382388                                                                                                     \xmlcode{<context id="1_nemo" ... >} \\ 
    383389    \hline 
    384     context n\_nemo &   context containing IO information for NEMO child grid n (when using AGRIF) &  
     390    context n\_nemo &   context containing IO information for \NEMO\ child grid n (when using AGRIF) & 
    385391                                                                                                     \xmlcode{<context id="n_nemo" ... >} \\ 
    386392    \hline 
     
    391397 
    392398\begin{table} 
    393   \scriptsize 
    394399  \begin{tabular}{|p{0.15\textwidth}p{0.4\textwidth}p{0.35\textwidth}|} 
    395400    \hline 
     
    407412\end{table} 
    408413 
    409 \noindent Each context tag related to NEMO (mother or child grids) is divided into 5 parts  
     414\noindent Each context tag related to \NEMO\ (mother or child grids) is divided into 5 parts 
    410415(that can be defined in any order): 
    411416 
    412417\begin{table} 
    413   \scriptsize 
    414418  \begin{tabular}{|p{0.15\textwidth}p{0.4\textwidth}p{0.35\textwidth}|} 
    415419    \hline 
     
    441445The inclusion of XML files into the main XML file can be done through the attribute src: 
    442446\xmlline|<context src="./nemo_def.xml" />| 
    443   
    444 \noindent In NEMO, by default, the field and domain definition is done in 2 separate files: 
    445 \path{NEMOGCM/CONFIG/SHARED/field_def.xml} and \path{NEMOGCM/CONFIG/SHARED/domain_def.xml} that 
     447 
     448\noindent In \NEMO, by default, the field definition is done in 3 separate files ( 
     449\path{cfgs/SHARED/field_def_nemo-oce.xml}, 
     450\path{cfgs/SHARED/field_def_nemo-pisces.xml} and 
     451\path{cfgs/SHARED/field_def_nemo-ice.xml} ) and the  domain definition is done in another file ( \path{cfgs/SHARED/domain_def_nemo.xml} ) 
     452that 
    446453are included in the main iodef.xml file through the following commands: 
    447454\begin{xmllines} 
    448 <field_definition src="./field_def.xml" /> 
    449 <domain_definition src="./domain_def.xml" /> 
     455<context id="nemo" src="./context_nemo.xml"/> 
    450456\end{xmllines} 
    451457 
     
    462468\begin{xmllines} 
    463469<field_definition operation="average" > 
    464    <field id="sst"                    />   <!-- averaged      sst -->  
    465    <field id="sss" operation="instant"/>   <!-- instantaneous sss -->  
    466 </field_definition>  
     470   <field id="sst"                    />   <!-- averaged      sst --> 
     471   <field id="sss" operation="instant"/>   <!-- instantaneous sss --> 
     472</field_definition> 
    467473\end{xmllines} 
    468474 
     
    481487</field_definition> 
    482488<file_definition> 
    483    <file id="myfile" output_freq="1d" />    
     489   <file id="myfile" output_freq="1d" /> 
    484490      <field field_ref="sst"                            />  <!-- default def --> 
    485491      <field field_ref="sss" long_name="my description" />  <!-- overwrite   --> 
    486492   </file> 
    487 </file_definition>  
     493</file_definition> 
    488494\end{xmllines} 
    489495 
     
    508514 
    509515Secondly, the group can be used to replace a list of elements. 
    510 Several examples of groups of fields are proposed at the end of the file \path{CONFIG/SHARED/field_def.xml}. 
     516Several examples of groups of fields are proposed at the end of the XML field files ( 
     517\path{cfgs/SHARED/field_def_nemo-oce.xml}, 
     518\path{cfgs/SHARED/field_def_nemo-pisces.xml} and 
     519\path{cfgs/SHARED/field_def_nemo-ice.xml} ) . 
    511520For example, a short list of the usual variables related to the U grid: 
    512521 
     
    514523<field_group id="groupU" > 
    515524   <field field_ref="uoce"  /> 
    516    <field field_ref="suoce" /> 
     525   <field field_ref="ssu" /> 
    517526   <field field_ref="utau"  /> 
    518527</field_group> 
     
    525534   <field_group group_ref="groupU" /> 
    526535   <field field_ref="uocetr_eff"   />  <!-- add another field --> 
    527 </file>    
     536</file> 
    528537\end{xmllines} 
    529538 
     
    537546Horizontal subdomains are defined through the attributs zoom\_ibegin, zoom\_jbegin, zoom\_ni, zoom\_nj of 
    538547the tag family domain. 
    539 It must therefore be done in the domain part of the XML file.  
    540 For example, in \path{CONFIG/SHARED/domain_def.xml}, we provide the following example of a definition of  
     548It must therefore be done in the domain part of the XML file. 
     549For example, in \path{cfgs/SHARED/domain_def.xml}, we provide the following example of a definition of 
    541550a 5 by 5 box with the bottom left corner at point (10,10). 
    542551 
    543552\begin{xmllines} 
    544 <domain_group id="grid_T"> 
    545    <domain id="myzoom" zoom_ibegin="10" zoom_jbegin="10" zoom_ni="5" zoom_nj="5" /> 
     553<domain id="myzoomT" domain_ref="grid_T"> 
     554   <zoom_domain ibegin="10" jbegin="10" ni="5" nj="5" /> 
    546555\end{xmllines} 
    547556 
     
    551560\begin{xmllines} 
    552561<file id="myfile_vzoom" output_freq="1d" > 
    553    <field field_ref="toce" domain_ref="myzoom"/> 
     562   <field field_ref="toce" domain_ref="myzoomT"/> 
    554563</file> 
    555564\end{xmllines} 
    556565 
    557 Moorings are seen as an extrem case corresponding to a 1 by 1 subdomain.  
     566Moorings are seen as an extrem case corresponding to a 1 by 1 subdomain. 
    558567The Equatorial section, the TAO, RAMA and PIRATA moorings are already registered in the code and 
    559568can therefore be outputted without taking care of their (i,j) position in the grid. 
     
    568577\end{xmllines} 
    569578 
    570 Note that if the domain decomposition used in XIOS cuts the subdomain in several parts and if  
    571 you use the ''multiple\_file'' type for your output files,  
    572 you will endup with several files you will need to rebuild using unprovided tools (like ncpdq and ncrcat,  
     579Note that if the domain decomposition used in XIOS cuts the subdomain in several parts and if 
     580you use the ''multiple\_file'' type for your output files, 
     581you will endup with several files you will need to rebuild using unprovided tools (like ncpdq and ncrcat, 
    573582\href{http://nco.sourceforge.net/nco.html#Concatenation}{see nco manual}). 
    574583We are therefore advising to use the ''one\_file'' type in this case. 
     
    576585\subsubsection{Define vertical zooms} 
    577586 
    578 Vertical zooms are defined through the attributs zoom\_begin and zoom\_end of the tag family axis. 
     587Vertical zooms are defined through the attributs zoom\_begin and zoom\_n of the tag family axis. 
    579588It must therefore be done in the axis part of the XML file. 
    580 For example, in \path{NEMOGCM/CONFIG/ORCA2_LIM/iodef_demo.xml}, we provide the following example: 
    581  
    582 \begin{xmllines} 
    583 <axis_group id="deptht" long_name="Vertical T levels" unit="m" positive="down" > 
    584    <axis id="deptht" /> 
    585    <axis id="deptht_myzoom" zoom_begin="1" zoom_end="10" /> 
     589For example, in \path{cfgs/ORCA2_ICE_PISCES/EXPREF/iodef_demo.xml}, we provide the following example: 
     590 
     591\begin{xmllines} 
     592<axis_definition> 
     593   <axis id="deptht" long_name="Vertical T levels" unit="m" positive="down" /> 
     594   <axis id="deptht_zoom" azix_ref="deptht" > 
     595      <zoom_axis zoom_begin="1" zoom_n="10" /> 
     596   </axis> 
    586597\end{xmllines} 
    587598 
     
    601612 
    602613\begin{xmllines} 
    603 <file_group id="1d" output_freq="1d" name="myfile_1d" >  
     614<file_group id="1d" output_freq="1d" name="myfile_1d" > 
    604615   <file id="myfileA" name_suffix="_AAA" > <!-- will create file "myfile_1d_AAA"  --> 
    605616      ... 
     
    620631 
    621632\begin{table} 
    622   \scriptsize 
    623633  \begin{tabularx}{\textwidth}{|lX|} 
    624634    \hline 
     
    656666\end{table} 
    657667 
    658 \noindent For example,  
     668\noindent For example, 
    659669\xmlline|<file id="myfile_hzoom" name="myfile_@expname@_@startdate@_freq@freq@" output_freq="1d" >| 
    660670 
     
    668678\noindent will give the following file name radical: \ifile{myfile\_ORCA2\_19891231\_freq1d} 
    669679 
    670 \subsubsection{Other controls of the XML attributes from NEMO} 
    671  
    672 The values of some attributes are defined by subroutine calls within NEMO  
     680\subsubsection{Other controls of the XML attributes from \NEMO} 
     681 
     682The values of some attributes are defined by subroutine calls within \NEMO 
    673683(calls to iom\_set\_domain\_attr, iom\_set\_axis\_attr and iom\_set\_field\_attr in \mdl{iom}). 
    674684Any definition given in the XML file will be overwritten. 
     
    681691 
    682692\begin{table} 
    683   \scriptsize 
    684   \begin{tabularx}{\textwidth}{|X|c|c|c|} 
     693  \begin{tabular}{|l|c|c|} 
    685694    \hline 
    686695    tag ids affected by automatic definition of some of their attributes & 
    687696    name attribute                                                       & 
    688     attribute value                      \\ 
     697    attribute value                                                      \\ 
    689698    \hline 
    690699    \hline 
    691700    field\_definition                                                    & 
    692701    freq\_op                                                             & 
    693     \np{rn\_rdt}                         \\ 
     702    \np{rn\_rdt}                                                         \\ 
    694703    \hline 
    695704    SBC                                                                  & 
    696705    freq\_op                                                             & 
    697     \np{rn\_rdt} $\times$ \np{nn\_fsbc}  \\ 
     706    \np{rn\_rdt} $\times$ \np{nn\_fsbc}                                  \\ 
    698707    \hline 
    699708    ptrc\_T                                                              & 
    700709    freq\_op                                                             & 
    701     \np{rn\_rdt} $\times$ \np{nn\_dttrc} \\ 
     710    \np{rn\_rdt} $\times$ \np{nn\_dttrc}                                 \\ 
    702711    \hline 
    703712    diad\_T                                                              & 
    704713    freq\_op                                                             & 
    705     \np{rn\_rdt} $\times$ \np{nn\_dttrc} \\ 
     714    \np{rn\_rdt} $\times$ \np{nn\_dttrc}                                 \\ 
    706715    \hline 
    707716    EqT, EqU, EqW                                                        & 
    708717    jbegin, ni,                                                          & 
    709     according to the grid                \\ 
    710     & 
     718    according to the grid                                                \\ 
     719                                                                         & 
    711720    name\_suffix                                                         & 
    712     \\ 
     721                                                                         \\ 
    713722    \hline 
    714723    TAO, RAMA and PIRATA moorings                                        & 
    715724    zoom\_ibegin, zoom\_jbegin,                                          & 
    716     according to the grid                \\ 
    717     & 
     725    according to the grid                                                \\ 
     726                                                                         & 
    718727    name\_suffix                                                         & 
    719     \\ 
    720     \hline 
    721   \end{tabularx} 
     728                                                                         \\ 
     729    \hline 
     730  \end{tabular} 
    722731\end{table} 
    723732 
     
    725734 
    726735\subsection{XML reference tables} 
    727 \label{subsec:IOM_xmlref} 
     736\label{subsec:DIA_IOM_xmlref} 
    728737 
    729738\begin{enumerate} 
     
    765774\end{xmllines} 
    766775 
    767 Note that, then the code is crashing, writting real4 variables forces a numerical convection from  
     776Note that, then the code is crashing, writting real4 variables forces a numerical conversion from 
    768777real8 to real4 which will create an internal error in NetCDF and will avoid the creation of the output files. 
    769778Forcing double precision outputs with prec="8" (for example in the field\_definition) will avoid this problem. 
     
    773782 
    774783\begin{xmllines} 
    775 <file_group id="1d" output_freq="1d" output_level="10" enabled=".true."> <!-- 1d files -->  
     784<file_group id="1d" output_freq="1d" output_level="10" enabled=".true."> <!-- 1d files --> 
    776785   <file id="file1" name_suffix="_grid_T" description="ocean T grid variables" > 
    777786      <field field_ref="sst" name="tos" > 
     
    782791      <variable id="my_global_attribute" type="string" > blabla_global </variable> 
    783792   </file> 
    784 </file_group>  
     793</file_group> 
    785794\end{xmllines} 
    786795 
     
    797806 
    798807\begin{xmllines} 
    799 <file_group id="5d" output_freq="5d"  output_level="10" enabled=".true." >  <!-- 5d files -->   
     808<file_group id="5d" output_freq="5d"  output_level="10" enabled=".true." >  <!-- 5d files --> 
    800809   <file id="file1" name_suffix="_grid_T" description="ocean T grid variables" > 
    801810      <field field_ref="toce" operation="instant" freq_op="5d" > @toce_e3t / @e3t </field> 
    802811   </file> 
    803 </file_group>  
     812</file_group> 
    804813\end{xmllines} 
    805814 
     
    826835 
    827836\begin{xmllines} 
    828 <file_group id="1m" output_freq="1m"  output_level="10" enabled=".true." >  <!-- 1m files -->   
     837<file_group id="1m" output_freq="1m"  output_level="10" enabled=".true." >  <!-- 1m files --> 
    829838   <file id="file1" name_suffix="_grid_T" description="ocean T grid variables" > 
    830       <field field_ref="ssh" name="sshstd" long_name="sea_surface_temperature_standard_deviation"  
     839      <field field_ref="ssh" name="sshstd" long_name="sea_surface_temperature_standard_deviation" 
    831840      operation="instant" freq_op="1m" > 
    832841         sqrt( @ssh2 - @ssh * @ssh ) 
    833842      </field> 
    834843   </file> 
    835 </file_group>  
     844</file_group> 
    836845\end{xmllines} 
    837846 
     
    840849here we use the default, average. 
    841850So, in the above case, @ssh2 will do the monthly mean of ssh*ssh. 
    842 Operation="instant" refers to the temporal operation to be performed on the field ''sqrt( @ssh2 - @ssh * @ssh )'':  
     851Operation="instant" refers to the temporal operation to be performed on the field ''sqrt( @ssh2 - @ssh * @ssh )'': 
    843852here the temporal average is alreday done by the ``@'' function so we just use instant. 
    844853field\_ref="ssh" means that attributes not explicitely defined, are inherited from ssh field. 
     
    858867 
    859868\begin{xmllines} 
    860 <file_group id="1m" output_freq="1m"  output_level="10" enabled=".true." >  <!-- 1m files -->   
     869<file_group id="1m" output_freq="1m"  output_level="10" enabled=".true." >  <!-- 1m files --> 
    861870   <file id="file1" name_suffix="_grid_T" description="ocean T grid variables" > 
    862871      <field field_ref="sst" name="sstdcy" long_name="amplitude of sst diurnal cycle" operation="average" freq_op="1d" > 
     
    864873      </field> 
    865874   </file> 
    866 </file_group>  
     875</file_group> 
    867876\end{xmllines} 
    868877 
     
    880889 
    881890\begin{table} 
    882   \scriptsize 
    883891  \begin{tabularx}{\textwidth}{|l|X|X|l|X|} 
    884892    \hline 
     
    903911    \hline 
    904912  \end{tabularx} 
    905   \caption{Context tags} 
     913  \caption{XIOS: context tags} 
    906914\end{table} 
    907915 
    908916\begin{table} 
    909   \scriptsize 
    910917  \begin{tabularx}{\textwidth}{|l|X|X|X|l|} 
    911918    \hline 
     
    938945    \hline 
    939946  \end{tabularx} 
    940   \caption{Field tags ("\tt{field\_*}")} 
     947  \caption{XIOS: field tags ("\texttt{field\_*}")} 
    941948\end{table} 
    942949 
    943950\begin{table} 
    944   \scriptsize 
    945951  \begin{tabularx}{\textwidth}{|l|X|X|X|l|} 
    946952    \hline 
     
    974980    \hline 
    975981  \end{tabularx} 
    976   \caption{File tags ("\tt{file\_*}")} 
     982  \caption{XIOS: file tags ("\texttt{file\_*}")} 
    977983\end{table} 
    978984 
    979985\begin{table} 
    980   \scriptsize 
    981986  \begin{tabularx}{\textwidth}{|l|X|X|X|X|} 
    982987    \hline 
     
    10071012    \hline 
    10081013  \end{tabularx} 
    1009   \caption{Axis tags ("\tt{axis\_*}")} 
     1014  \caption{XIOS: axis tags ("\texttt{axis\_*}")} 
    10101015\end{table} 
    10111016 
    10121017\begin{table} 
    1013   \scriptsize 
    10141018  \begin{tabularx}{\textwidth}{|l|X|X|X|X|} 
    10151019    \hline 
     
    10401044    \hline 
    10411045  \end{tabularx} 
    1042   \caption{Domain tags ("\tt{domain\_*)}"} 
     1046  \caption{XIOS: domain tags ("\texttt{domain\_*)}"} 
    10431047\end{table} 
    10441048 
    10451049\begin{table} 
    1046   \scriptsize 
    10471050  \begin{tabularx}{\textwidth}{|l|X|X|X|X|} 
    10481051    \hline 
     
    10731076    \hline 
    10741077  \end{tabularx} 
    1075   \caption{Grid tags ("\tt{grid\_*}")} 
     1078  \caption{XIOS: grid tags ("\texttt{grid\_*}")} 
    10761079\end{table} 
    10771080 
     
    10791082 
    10801083\begin{table} 
    1081   \scriptsize 
    10821084  \begin{tabularx}{\textwidth}{|l|X|l|l|} 
    10831085    \hline 
     
    11141116    \hline 
    11151117  \end{tabularx} 
    1116   \caption{Reference attributes ("\tt{*\_ref}")} 
     1118  \caption{XIOS: reference attributes ("\texttt{*\_ref}")} 
    11171119\end{table} 
    11181120 
    11191121\begin{table} 
    1120   \scriptsize 
    11211122  \begin{tabularx}{\textwidth}{|l|X|l|l|} 
    11221123    \hline 
     
    11501151    \hline 
    11511152  \end{tabularx} 
    1152   \caption{Domain attributes ("\tt{zoom\_*}")} 
     1153  \caption{XIOS: domain attributes ("\texttt{zoom\_*}")} 
    11531154\end{table} 
    11541155 
    11551156\begin{table} 
    1156   \scriptsize 
    11571157  \begin{tabularx}{\textwidth}{|l|X|l|l|} 
    11581158    \hline 
     
    12051205    \hline 
    12061206  \end{tabularx} 
    1207   \caption{File attributes} 
     1207  \caption{XIOS: file attributes} 
    12081208\end{table} 
    12091209 
    12101210\begin{table} 
    1211   \scriptsize 
    12121211  \begin{tabularx}{\textwidth}{|l|X|l|l|} 
    12131212    \hline 
     
    12541253    \hline 
    12551254  \end{tabularx} 
    1256   \caption{Field attributes} 
     1255  \caption{XIOS: field attributes} 
    12571256\end{table} 
    12581257 
    12591258\begin{table} 
    1260   \scriptsize 
    12611259  \begin{tabularx}{\textwidth}{|l|X|X|X|} 
    12621260    \hline 
     
    13131311    \hline 
    13141312  \end{tabularx} 
    1315   \caption{Miscellaneous attributes} 
     1313  \caption{XIOS: miscellaneous attributes} 
    13161314\end{table} 
    13171315 
    13181316\subsection{CF metadata standard compliance} 
    13191317 
    1320 Output from the XIOS-1.0 IO server is compliant with  
     1318Output from the XIOS IO server is compliant with 
    13211319\href{http://cfconventions.org/Data/cf-conventions/cf-conventions-1.5/build/cf-conventions.html}{version 1.5} of 
    1322 the CF metadata standard.  
     1320the CF metadata standard. 
    13231321Therefore while a user may wish to add their own metadata to the output files (as demonstrated in example 4 of 
    1324 section \autoref{subsec:IOM_xmlref}) the metadata should, for the most part, comply with the CF-1.5 standard. 
     1322section \autoref{subsec:DIA_IOM_xmlref}) the metadata should, for the most part, comply with the CF-1.5 standard. 
    13251323 
    13261324Some metadata that may significantly increase the file size (horizontal cell areas and vertices) are controlled by 
    1327 the namelist parameter \np{ln\_cfmeta} in the \ngn{namrun} namelist. 
     1325the namelist parameter \np{ln\_cfmeta} in the \nam{run} namelist. 
    13281326This must be set to true if these metadata are to be included in the output files. 
    13291327 
     
    13321330%       NetCDF4 support 
    13331331% ================================================================ 
    1334 \section{NetCDF4 support (\protect\key{netcdf4})} 
     1332\section[NetCDF4 support (\texttt{\textbf{key\_netcdf4}})] 
     1333{NetCDF4 support (\protect\key{netcdf4})} 
    13351334\label{sec:DIA_nc4} 
    13361335 
     
    13401339Chunking and compression can lead to significant reductions in file sizes for a small runtime overhead. 
    13411340For a fuller discussion on chunking and other performance issues the reader is referred to 
    1342 the NetCDF4 documentation found \href{http://www.unidata.ucar.edu/software/netcdf/docs/netcdf.html#Chunking}{here}. 
     1341the NetCDF4 documentation found \href{https://www.unidata.ucar.edu/software/netcdf/docs/netcdf_perf_chunking.html}{here}. 
    13431342 
    13441343The new features are only available when the code has been linked with a NetCDF4 library 
     
    13461345Datasets created with chunking and compression are not backwards compatible with NetCDF3 "classic" format but 
    13471346most analysis codes can be relinked simply with the new libraries and will then read both NetCDF3 and NetCDF4 files. 
    1348 NEMO executables linked with NetCDF4 libraries can be made to produce NetCDF3 files by 
    1349 setting the \np{ln\_nc4zip} logical to false in the \textit{namnc4} namelist: 
     1347\NEMO\ executables linked with NetCDF4 libraries can be made to produce NetCDF3 files by 
     1348setting the \np{ln\_nc4zip} logical to false in the \nam{nc4} namelist: 
    13501349 
    13511350%------------------------------------------namnc4---------------------------------------------------- 
    13521351 
    1353 \nlst{namnc4} 
     1352\begin{listing} 
     1353  \nlst{namnc4} 
     1354  \caption{\texttt{namnc4}} 
     1355  \label{lst:namnc4} 
     1356\end{listing} 
    13541357%------------------------------------------------------------------------------------------------------------- 
    13551358 
     
    13891392\end{forlines} 
    13901393 
    1391 \noindent for a standard ORCA2\_LIM configuration gives chunksizes of {\small\tt 46x38x1} respectively in 
    1392 the mono-processor case (\ie global domain of {\small\tt 182x149x31}). 
    1393 An illustration of the potential space savings that NetCDF4 chunking and compression provides is given in  
    1394 table \autoref{tab:NC4} which compares the results of two short runs of the ORCA2\_LIM reference configuration with 
     1394\noindent for a standard ORCA2\_LIM configuration gives chunksizes of {\small\texttt 46x38x1} respectively in 
     1395the mono-processor case (\ie\ global domain of {\small\texttt 182x149x31}). 
     1396An illustration of the potential space savings that NetCDF4 chunking and compression provides is given in 
     1397table \autoref{tab:DIA_NC4} which compares the results of two short runs of the ORCA2\_LIM reference configuration with 
    13951398a 4x2 mpi partitioning. 
    13961399Note the variation in the compression ratio achieved which reflects chiefly the dry to wet volume ratio of 
     
    13991402%------------------------------------------TABLE---------------------------------------------------- 
    14001403\begin{table} 
    1401   \scriptsize 
    14021404  \centering 
    14031405  \begin{tabular}{lrrr} 
     
    14311433    ORCA2\_2d\_grid\_W\_0007.nc & 4416    & 1368     & 70\%      \\ 
    14321434  \end{tabular} 
    1433   \caption{ 
    1434     \protect\label{tab:NC4} 
    1435     Filesize comparison between NetCDF3 and NetCDF4 with chunking and compression 
    1436   } 
     1435  \caption{Filesize comparison between NetCDF3 and NetCDF4 with chunking and compression} 
     1436  \label{tab:DIA_NC4} 
    14371437\end{table} 
    14381438%---------------------------------------------------------------------------------------------------- 
    14391439 
    14401440When \key{iomput} is activated with \key{netcdf4} chunking and compression parameters for fields produced via 
    1441 \np{iom\_put} calls are set via an equivalent and identically named namelist to \textit{namnc4} in 
    1442 \np{xmlio\_server.def}. 
    1443 Typically this namelist serves the mean files whilst the \ngn{ namnc4} in the main namelist file continues to 
     1441\rou{iom\_put} calls are set via an equivalent and identically named namelist to \nam{nc4} in 
     1442\textit{xmlio\_server.def}. 
     1443Typically this namelist serves the mean files whilst the \nam{nc4} in the main namelist file continues to 
    14441444serve the restart files. 
    14451445This duplication is unfortunate but appropriate since, if using io\_servers, the domain sizes of 
    14461446the individual files produced by the io\_server processes may be different to those produced by 
    14471447the invidual processing regions and different chunking choices may be desired. 
    1448   
     1448 
    14491449% ------------------------------------------------------------------------------------------------------------- 
    14501450%       Tracer/Dynamics Trends 
    14511451% ------------------------------------------------------------------------------------------------------------- 
    1452 \section{Tracer/Dynamics trends  (\protect\ngn{namtrd})} 
     1452\section[Tracer/Dynamics trends (\texttt{namtrd})] 
     1453{Tracer/Dynamics trends (\protect\nam{trd})} 
    14531454\label{sec:DIA_trd} 
    14541455 
    14551456%------------------------------------------namtrd---------------------------------------------------- 
    14561457 
    1457 \nlst{namtrd}  
     1458\begin{listing} 
     1459  \nlst{namtrd} 
     1460  \caption{\texttt{namtrd}} 
     1461  \label{lst:namtrd} 
     1462\end{listing} 
    14581463%------------------------------------------------------------------------------------------------------------- 
    14591464 
    14601465Each trend of the dynamics and/or temperature and salinity time evolution equations can be send to 
    14611466\mdl{trddyn} and/or \mdl{trdtra} modules (see TRD directory) just after their computation 
    1462 (\ie at the end of each $dyn\cdots.F90$ and/or $tra\cdots.F90$ routines). 
    1463 This capability is controlled by options offered in \ngn{namtrd} namelist. 
    1464 Note that the output are done with xIOS, and therefore the \key{IOM} is required. 
    1465  
    1466 What is done depends on the \ngn{namtrd} logical set to \forcode{.true.}: 
     1467(\ie\ at the end of each \textit{dyn....F90} and/or \textit{tra....F90} routines). 
     1468This capability is controlled by options offered in \nam{trd} namelist. 
     1469Note that the output are done with XIOS, and therefore the \key{iomput} is required. 
     1470 
     1471What is done depends on the \nam{trd} logical set to \forcode{.true.}: 
    14671472 
    14681473\begin{description} 
     
    14871492\end{description} 
    14881493 
    1489 Note that the mixed layer tendency diagnostic can also be used on biogeochemical models via  
    1490 the \key{trdtrc} and \key{trdmld\_trc} CPP keys. 
     1494Note that the mixed layer tendency diagnostic can also be used on biogeochemical models via 
     1495the \key{trdtrc} and \key{trdmxl\_trc} CPP keys. 
    14911496 
    14921497\textbf{Note that} in the current version (v3.6), many changes has been introduced but not fully tested. 
    14931498In particular, options associated with \np{ln\_dyn\_mxl}, \np{ln\_vor\_trd}, and \np{ln\_tra\_mxl} are not working, 
    1494 and none of the options have been tested with variable volume (\ie \key{vvl} defined). 
     1499and none of the options have been tested with variable volume (\ie\ \np{ln\_linssh}\forcode{=.true.}). 
    14951500 
    14961501% ------------------------------------------------------------------------------------------------------------- 
    14971502%       On-line Floats trajectories 
    14981503% ------------------------------------------------------------------------------------------------------------- 
    1499 \section{FLO: On-Line Floats trajectories (\protect\key{floats})} 
    1500 \label{sec:FLO} 
     1504\section[FLO: On-Line Floats trajectories (\texttt{\textbf{key\_floats}})] 
     1505{FLO: On-Line Floats trajectories (\protect\key{floats})} 
     1506\label{sec:DIA_FLO} 
    15011507%--------------------------------------------namflo------------------------------------------------------- 
    15021508 
    1503 \nlst{namflo}  
     1509\begin{listing} 
     1510  \nlst{namflo} 
     1511  \caption{\texttt{namflo}} 
     1512  \label{lst:namflo} 
     1513\end{listing} 
    15041514%-------------------------------------------------------------------------------------------------------------- 
    15051515 
    15061516The on-line computation of floats advected either by the three dimensional velocity field or constraint to 
    15071517remain at a given depth ($w = 0$ in the computation) have been introduced in the system during the CLIPPER project. 
    1508 Options are defined by \ngn{namflo} namelis variables. 
    1509 The algorithm used is based either on the work of \cite{Blanke_Raynaud_JPO97} (default option), 
    1510 or on a $4^th$ Runge-Hutta algorithm (\np{ln\_flork4}\forcode{ = .true.}). 
    1511 Note that the \cite{Blanke_Raynaud_JPO97} algorithm have the advantage of providing trajectories which 
     1518Options are defined by \nam{flo} namelist variables. 
     1519The algorithm used is based either on the work of \cite{blanke.raynaud_JPO97} (default option), 
     1520or on a $4^th$ Runge-Hutta algorithm (\np{ln\_flork4}\forcode{=.true.}). 
     1521Note that the \cite{blanke.raynaud_JPO97} algorithm have the advantage of providing trajectories which 
    15121522are consistent with the numeric of the code, so that the trajectories never intercept the bathymetry. 
    15131523 
     
    15151525 
    15161526Initial coordinates can be given with Ariane Tools convention 
    1517 (IJK coordinates, (\np{ln\_ariane}\forcode{ = .true.}) ) or with longitude and latitude. 
    1518  
    1519 In case of Ariane convention, input filename is \np{init\_float\_ariane}. 
     1527(IJK coordinates, (\np{ln\_ariane}\forcode{=.true.}) ) or with longitude and latitude. 
     1528 
     1529In case of Ariane convention, input filename is \textit{init\_float\_ariane}. 
    15201530Its format is: \\ 
    1521 {\scriptsize \texttt{I J K nisobfl itrash itrash}} 
     1531{ \texttt{I J K nisobfl itrash}} 
    15221532 
    15231533\noindent with: 
     
    15251535 - I,J,K  : indexes of initial position 
    15261536 
    1527  - nisobfl: 0 for an isobar float, 1 for a float following the w velocity   
     1537 - nisobfl: 0 for an isobar float, 1 for a float following the w velocity 
    15281538 
    15291539 - itrash : set to zero; it is a dummy variable to respect Ariane Tools convention 
     
    15311541\noindent Example: \\ 
    15321542\noindent 
    1533 {\scriptsize 
     1543{ 
    15341544  \texttt{ 
    15351545    100.00000  90.00000  -1.50000 1.00000   0.00000   \\ 
     
    15421552In the other case (longitude and latitude), input filename is init\_float. 
    15431553Its format is: \\ 
    1544 {\scriptsize \texttt{Long Lat depth nisobfl ngrpfl itrash}} 
     1554{ \texttt{Long Lat depth nisobfl ngrpfl itrash}} 
    15451555 
    15461556\noindent with: 
     
    15561566\noindent Example: \\ 
    15571567\noindent 
    1558 {\scriptsize 
     1568{ 
    15591569  \texttt{ 
    15601570    20.0 0.0 0.0 0 1 1    \\ 
     
    15661576 
    15671577\np{jpnfl} is the total number of floats during the run. 
    1568 When initial positions are read in a restart file (\np{ln\_rstflo}\forcode{ = .true.} ), 
     1578When initial positions are read in a restart file (\np{ln\_rstflo}\forcode{=.true.} ), 
    15691579\np{jpnflnewflo} can be added in the initialization file. 
    15701580 
     
    15741584creation of the float restart file. 
    15751585 
    1576 Output data can be written in ascii files (\np{ln\_flo\_ascii}\forcode{ = .true.}). 
     1586Output data can be written in ascii files (\np{ln\_flo\_ascii}\forcode{=.true.}). 
    15771587In that case, output filename is trajec\_float. 
    15781588 
    1579 Another possiblity of writing format is Netcdf (\np{ln\_flo\_ascii}\forcode{ = .false.}). 
    1580 There are 2 possibilities: 
    1581  
    1582 - if (\key{iomput}) is used, outputs are selected in  iodef.xml. 
     1589Another possiblity of writing format is Netcdf (\np{ln\_flo\_ascii}\forcode{=.false.}) with 
     1590\key{iomput} and outputs selected in iodef.xml. 
    15831591Here it is an example of specification to put in files description section: 
    15841592 
     
    15971605\end{xmllines} 
    15981606 
    1599  -  if (\key{iomput}) is not used, a file called \ifile{trajec\_float} will be created by IOIPSL library. 
    1600  
    1601  See also \href{http://stockage.univ-brest.fr/~grima/Ariane/}{here} the web site describing the off-line use of 
    1602  this marvellous diagnostic tool. 
    16031607 
    16041608% ------------------------------------------------------------------------------------------------------------- 
    16051609%       Harmonic analysis of tidal constituents 
    16061610% ------------------------------------------------------------------------------------------------------------- 
    1607 \section{Harmonic analysis of tidal constituents (\protect\key{diaharm}) } 
     1611\section[Harmonic analysis of tidal constituents (\texttt{\textbf{key\_diaharm}})] 
     1612{Harmonic analysis of tidal constituents (\protect\key{diaharm})} 
    16081613\label{sec:DIA_diag_harm} 
    16091614 
    1610 %------------------------------------------namdia_harm---------------------------------------------------- 
     1615%------------------------------------------nam_diaharm---------------------------------------------------- 
    16111616% 
    1612 \nlst{nam_diaharm} 
     1617\begin{listing} 
     1618  \nlst{nam_diaharm} 
     1619  \caption{\texttt{nam\_diaharm}} 
     1620  \label{lst:nam_diaharm} 
     1621\end{listing} 
    16131622%---------------------------------------------------------------------------------------------------------- 
    16141623 
     
    16161625This on-line Harmonic analysis is actived with \key{diaharm}. 
    16171626 
    1618 Some parameters are available in namelist \ngn{namdia\_harm}: 
     1627Some parameters are available in namelist \nam{\_diaharm}: 
    16191628 
    16201629 - \np{nit000\_han} is the first time step used for harmonic analysis 
     
    16241633 - \np{nstep\_han}  is the  time step frequency for harmonic analysis 
    16251634 
    1626  - \np{nb\_ana}     is the number of harmonics to analyse 
     1635% - \np{nb\_ana}     is the number of harmonics to analyse 
    16271636 
    16281637 - \np{tname}       is an array with names of tidal constituents to analyse 
     
    16521661%       Sections transports 
    16531662% ------------------------------------------------------------------------------------------------------------- 
    1654 \section{Transports across sections (\protect\key{diadct}) } 
     1663\section[Transports across sections (\texttt{\textbf{key\_diadct}})] 
     1664{Transports across sections (\protect\key{diadct})} 
    16551665\label{sec:DIA_diag_dct} 
    16561666 
    1657 %------------------------------------------namdct---------------------------------------------------- 
    1658  
    1659 \nlst{namdct} 
     1667%------------------------------------------nam_diadct---------------------------------------------------- 
     1668 
     1669\begin{listing} 
     1670  \nlst{nam_diadct} 
     1671  \caption{\texttt{nam\_diadct}} 
     1672  \label{lst:nam_diadct} 
     1673\end{listing} 
    16601674%------------------------------------------------------------------------------------------------------------- 
    16611675 
     
    16641678 
    16651679Each section is defined by the coordinates of its 2 extremities. 
    1666 The pathways between them are contructed using tools which can be found in \texttt{NEMOGCM/TOOLS/SECTIONS\_DIADCT} 
    1667 and are written in a binary file \texttt{section\_ijglobal.diadct\_ORCA2\_LIM} which is later read in by 
    1668 NEMO to compute on-line transports. 
     1680The pathways between them are contructed using tools which can be found in \texttt{tools/SECTIONS\_DIADCT} 
     1681and are written in a binary file \texttt{section\_ijglobal.diadct} which is later read in by 
     1682\NEMO\ to compute on-line transports. 
    16691683 
    16701684The on-line transports module creates three output ascii files: 
     
    16761690- \texttt{salt\_transport}   for   salt transports (unit: $10^{9}Kg s^{-1}$) \\ 
    16771691 
    1678 Namelist variables in \ngn{namdct} control how frequently the flows are summed and the time scales over which 
     1692Namelist variables in \nam{\_diadct} control how frequently the flows are summed and the time scales over which 
    16791693they are averaged, as well as the level of output for debugging: 
    16801694\np{nn\_dct}   : frequency of instantaneous transports computing 
     
    16841698\subsubsection{Creating a binary file containing the pathway of each section} 
    16851699 
    1686 In \texttt{NEMOGCM/TOOLS/SECTIONS\_DIADCT/run}, 
     1700In \texttt{tools/SECTIONS\_DIADCT/run}, 
    16871701the file \textit{ {list\_sections.ascii\_global}} contains a list of all the sections that are to be computed 
    16881702(this list of sections is based on MERSEA project metrics). 
     
    16911705 
    16921706Each section is defined by: \\ 
    1693 \noindent {\scriptsize \texttt{long1 lat1 long2 lat2 nclass (ok/no)strpond (no)ice section\_name}} \\ 
     1707\noindent { \texttt{long1 lat1 long2 lat2 nclass (ok/no)strpond (no)ice section\_name}} \\ 
    16941708with: 
    16951709 
     
    16981712 - \texttt{long2 lat2}, coordinates of the second extremity of the section; 
    16991713 
    1700  - \texttt{nclass}    the number of bounds of your classes (\eg bounds for 2 classes); 
     1714 - \texttt{nclass}    the number of bounds of your classes (\eg\ bounds for 2 classes); 
    17011715 
    17021716 - \texttt{okstrpond} to compute    heat and       salt transports, \texttt{nostrpond} if no; 
     
    17081722 
    17091723\noindent If nclass $\neq$ 0, the next lines contain the class type and the nclass bounds: \\ 
    1710 {\scriptsize 
     1724{ 
    17111725  \texttt{ 
    17121726    long1 lat1 long2 lat2 nclass (ok/no)strpond (no)ice section\_name \\ 
     
    17311745 
    17321746 - \texttt{zsigp} for potential density classes \\ 
    1733    
     1747 
    17341748 The script \texttt{job.ksh} computes the pathway for each section and creates a binary file 
    1735  \texttt{section\_ijglobal.diadct\_ORCA2\_LIM} which is read by NEMO. \\ 
     1749 \texttt{section\_ijglobal.diadct} which is read by \NEMO. \\ 
    17361750 
    17371751 It is possible to use this tools for new configuations: \texttt{job.ksh} has to be updated with 
     
    17411755 and the ATL\_Cuba\_Florida with 4 temperature clases (5 class bounds), are shown: \\ 
    17421756 \noindent 
    1743  {\scriptsize 
     1757 { 
    17441758   \texttt{ 
    17451759     -68.    -54.5   -60.    -64.7  00 okstrpond noice ACC\_Drake\_Passage \\ 
     
    17561770 
    17571771The output format is: \\ 
    1758 {\scriptsize 
     1772{ 
    17591773  \texttt{ 
    17601774    date, time-step number, section number,                \\ 
     
    17781792 
    17791793\begin{table} 
    1780   \scriptsize 
    17811794  \begin{tabular}{|l|l|l|l|l|} 
    17821795    \hline 
     
    18091822The steric effect is therefore not explicitely represented. 
    18101823This approximation does not represent a serious error with respect to the flow field calculated by the model 
    1811 \citep{Greatbatch_JGR94}, but extra attention is required when investigating sea level, 
     1824\citep{greatbatch_JGR94}, but extra attention is required when investigating sea level, 
    18121825as steric changes are an important contribution to local changes in sea level on seasonal and climatic time scales. 
    18131826This is especially true for investigation into sea level rise due to global warming. 
    18141827 
    18151828Fortunately, the steric contribution to the sea level consists of a spatially uniform component that 
    1816 can be diagnosed by considering the mass budget of the world ocean \citep{Greatbatch_JGR94}. 
     1829can be diagnosed by considering the mass budget of the world ocean \citep{greatbatch_JGR94}. 
    18171830In order to better understand how global mean sea level evolves and thus how the steric sea level can be diagnosed, 
    18181831we compare, in the following, the non-Boussinesq and Boussinesq cases. 
    18191832 
    18201833Let denote 
    1821 $\mathcal{M}$ the total mass    of liquid seawater ($\mathcal{M} = \int_D \rho dv$),  
    1822 $\mathcal{V}$ the total volume  of        seawater      ($\mathcal{V} = \int_D dv$),  
    1823 $\mathcal{A}$ the total surface of       the ocean      ($\mathcal{A} = \int_S ds$),  
    1824 $\bar{\rho}$ the global mean  seawater (\textit{in situ}) density  
     1834$\mathcal{M}$ the total mass    of liquid seawater ($\mathcal{M} = \int_D \rho dv$), 
     1835$\mathcal{V}$ the total volume  of        seawater      ($\mathcal{V} = \int_D dv$), 
     1836$\mathcal{A}$ the total surface of       the ocean      ($\mathcal{A} = \int_S ds$), 
     1837$\bar{\rho}$ the global mean  seawater (\textit{in situ}) density 
    18251838($\bar{\rho} = 1/\mathcal{V} \int_D \rho \,dv$), and 
    1826 $\bar{\eta}$ the global mean sea level  
     1839$\bar{\eta}$ the global mean sea level 
    18271840($\bar{\eta} = 1/\mathcal{A} \int_S \eta \,ds$). 
    18281841 
     
    18341847    \mathcal{V} &=  \mathcal{A}  \;\bar{\eta} 
    18351848  \end{split} 
    1836   \label{eq:MV_nBq} 
     1849  \label{eq:DIA_MV_nBq} 
    18371850\end{equation} 
    18381851 
     
    18421855  \frac{1}{e_3} \partial_t ( e_3\,\rho) + \nabla( \rho \, \textbf{U} ) 
    18431856  = \left. \frac{\textit{emp}}{e_3}\right|_\textit{surface} 
    1844   \label{eq:Co_nBq} 
     1857  \label{eq:DIA_Co_nBq} 
    18451858\end{equation} 
    18461859 
    18471860where $\rho$ is the \textit{in situ} density, and \textit{emp} the surface mass exchanges with the other media of 
    18481861the Earth system (atmosphere, sea-ice, land). 
    1849 Its global averaged leads to the total mass change  
     1862Its global averaged leads to the total mass change 
    18501863 
    18511864\begin{equation} 
    18521865  \partial_t \mathcal{M} = \mathcal{A} \;\overline{\textit{emp}} 
    1853   \label{eq:Mass_nBq} 
     1866  \label{eq:DIA_Mass_nBq} 
    18541867\end{equation} 
    18551868 
    18561869where $\overline{\textit{emp}} = \int_S \textit{emp}\,ds$ is the net mass flux through the ocean surface. 
    1857 Bringing \autoref{eq:Mass_nBq} and the time derivative of \autoref{eq:MV_nBq} together leads to 
     1870Bringing \autoref{eq:DIA_Mass_nBq} and the time derivative of \autoref{eq:DIA_MV_nBq} together leads to 
    18581871the evolution equation of the mean sea level 
    18591872 
     
    18611874  \partial_t \bar{\eta} = \frac{\overline{\textit{emp}}}{ \bar{\rho}} 
    18621875  - \frac{\mathcal{V}}{\mathcal{A}} \;\frac{\partial_t \bar{\rho} }{\bar{\rho}} 
    1863   \label{eq:ssh_nBq} 
     1876  \label{eq:DIA_ssh_nBq} 
    18641877\end{equation} 
    18651878 
    1866 The first term in equation \autoref{eq:ssh_nBq} alters sea level by adding or subtracting mass from the ocean.  
    1867 The second term arises from temporal changes in the global mean density; \ie from steric effects. 
     1879The first term in equation \autoref{eq:DIA_ssh_nBq} alters sea level by adding or subtracting mass from the ocean. 
     1880The second term arises from temporal changes in the global mean density; \ie\ from steric effects. 
    18681881 
    18691882In a Boussinesq fluid, $\rho$ is replaced by $\rho_o$ in all the equation except when $\rho$ appears multiplied by 
    1870 the gravity (\ie in the hydrostatic balance of the primitive Equations). 
    1871 In particular, the mass conservation equation, \autoref{eq:Co_nBq}, degenerates into the incompressibility equation: 
     1883the gravity (\ie\ in the hydrostatic balance of the primitive Equations). 
     1884In particular, the mass conservation equation, \autoref{eq:DIA_Co_nBq}, degenerates into the incompressibility equation: 
    18721885 
    18731886\[ 
    18741887  \frac{1}{e_3} \partial_t ( e_3 ) + \nabla( \textbf{U} ) = \left. \frac{\textit{emp}}{\rho_o \,e_3}\right|_ \textit{surface} 
    1875   % \label{eq:Co_Bq} 
     1888  % \label{eq:DIA_Co_Bq} 
    18761889\] 
    18771890 
     
    18801893\[ 
    18811894  \partial_t \mathcal{V} = \mathcal{A} \;\frac{\overline{\textit{emp}}}{\rho_o} 
    1882   % \label{eq:V_Bq} 
     1895  % \label{eq:DIA_V_Bq} 
    18831896\] 
    18841897 
     
    18881901the ocean surface, not by changes in mean mass of the ocean: the steric effect is missing in a Boussinesq fluid. 
    18891902 
    1890 Nevertheless, following \citep{Greatbatch_JGR94}, the steric effect on the volume can be diagnosed by 
    1891 considering the mass budget of the ocean.  
     1903Nevertheless, following \citep{greatbatch_JGR94}, the steric effect on the volume can be diagnosed by 
     1904considering the mass budget of the ocean. 
    18921905The apparent changes in $\mathcal{M}$, mass of the ocean, which are not induced by surface mass flux 
    18931906must be compensated by a spatially uniform change in the mean sea level due to expansion/contraction of the ocean 
    1894 \citep{Greatbatch_JGR94}. 
     1907\citep{greatbatch_JGR94}. 
    18951908In others words, the Boussinesq mass, $\mathcal{M}_o$, can be related to $\mathcal{M}$, 
    18961909the total mass of the ocean seen by the Boussinesq model, via the steric contribution to the sea level, 
     
    18991912\begin{equation} 
    19001913  \mathcal{M}_o = \mathcal{M} + \rho_o \,\eta_s \,\mathcal{A} 
    1901   \label{eq:M_Bq} 
     1914  \label{eq:DIA_M_Bq} 
    19021915\end{equation} 
    19031916 
     
    19051918is converted into a mean change in sea level. 
    19061919Introducing the total density anomaly, $\mathcal{D}= \int_D d_a \,dv$, 
    1907 where $d_a = (\rho -\rho_o ) / \rho_o$ is the density anomaly used in \NEMO (cf. \autoref{subsec:TRA_eos}) 
    1908 in \autoref{eq:M_Bq} leads to a very simple form for the steric height: 
     1920where $d_a = (\rho -\rho_o ) / \rho_o$ is the density anomaly used in \NEMO\ (cf. \autoref{subsec:TRA_eos}) 
     1921in \autoref{eq:DIA_M_Bq} leads to a very simple form for the steric height: 
    19091922 
    19101923\begin{equation} 
    19111924  \eta_s = - \frac{1}{\mathcal{A}} \mathcal{D} 
    1912   \label{eq:steric_Bq} 
     1925  \label{eq:DIA_steric_Bq} 
    19131926\end{equation} 
    19141927 
    19151928The above formulation of the steric height of a Boussinesq ocean requires four remarks. 
    19161929First, one can be tempted to define $\rho_o$ as the initial value of $\mathcal{M}/\mathcal{V}$, 
    1917 \ie set $\mathcal{D}_{t=0}=0$, so that the initial steric height is zero. 
     1930\ie\ set $\mathcal{D}_{t=0}=0$, so that the initial steric height is zero. 
    19181931We do not recommend that. 
    19191932Indeed, in this case $\rho_o$ depends on the initial state of the ocean. 
     
    19241937This value is a sensible choice for the reference density used in a Boussinesq ocean climate model since, 
    19251938with the exception of only a small percentage of the ocean, density in the World Ocean varies by no more than 
    1926 2$\%$ from this value (\cite{Gill1982}, page 47). 
     19392$\%$ from this value (\cite{gill_bk82}, page 47). 
    19271940 
    19281941Second, we have assumed here that the total ocean surface, $\mathcal{A}$, 
    19291942does not change when the sea level is changing as it is the case in all global ocean GCMs 
    19301943(wetting and drying of grid point is not allowed). 
    1931    
    1932 Third, the discretisation of \autoref{eq:steric_Bq} depends on the type of free surface which is considered. 
    1933 In the non linear free surface case, \ie \key{vvl} defined, it is given by 
     1944 
     1945Third, the discretisation of \autoref{eq:DIA_steric_Bq} depends on the type of free surface which is considered. 
     1946In the non linear free surface case, \ie\ \np{ln\_linssh}\forcode{=.true.}, it is given by 
    19341947 
    19351948\[ 
    19361949  \eta_s = - \frac{ \sum_{i,\,j,\,k} d_a\; e_{1t} e_{2t} e_{3t} }{ \sum_{i,\,j,\,k}       e_{1t} e_{2t} e_{3t} } 
    1937   % \label{eq:discrete_steric_Bq_nfs} 
     1950  % \label{eq:DIA_discrete_steric_Bq_nfs} 
    19381951\] 
    19391952 
     
    19451958  \eta_s = - \frac{ \sum_{i,\,j,\,k} d_a\; e_{1t}e_{2t}e_{3t} + \sum_{i,\,j} d_a\; e_{1t}e_{2t} \eta } 
    19461959                  { \sum_{i,\,j,\,k}       e_{1t}e_{2t}e_{3t} + \sum_{i,\,j}       e_{1t}e_{2t} \eta } 
    1947   % \label{eq:discrete_steric_Bq_fs} 
     1960  % \label{eq:DIA_discrete_steric_Bq_fs} 
    19481961\] 
    19491962 
     
    19541967so that there are no associated ocean currents. 
    19551968Hence, the dynamically relevant sea level is the effective sea level, 
    1956 \ie the sea level as if sea ice (and snow) were converted to liquid seawater \citep{Campin_al_OM08}. 
    1957 However, in the current version of \NEMO the sea-ice is levitating above the ocean without mass exchanges between 
     1969\ie\ the sea level as if sea ice (and snow) were converted to liquid seawater \citep{campin.marshall.ea_OM08}. 
     1970However, in the current version of \NEMO\ the sea-ice is levitating above the ocean without mass exchanges between 
    19581971ice and ocean. 
    19591972Therefore the model effective sea level is always given by $\eta + \eta_s$, whether or not there is sea ice present. 
     
    19651978\[ 
    19661979  \eta_s = - \frac{1}{\mathcal{A}} \int_D d_a(T,S_o,p_o) \,dv 
    1967   % \label{eq:thermosteric_Bq} 
     1980  % \label{eq:DIA_thermosteric_Bq} 
    19681981\] 
    19691982 
    19701983where $S_o$ and $p_o$ are the initial salinity and pressure, respectively. 
    19711984 
    1972 Both steric and thermosteric sea level are computed in \mdl{diaar5} which needs the \key{diaar5} defined to 
    1973 be called. 
     1985Both steric and thermosteric sea level are computed in \mdl{diaar5}. 
    19741986 
    19751987% ------------------------------------------------------------------------------------------------------------- 
    19761988%       Other Diagnostics 
    19771989% ------------------------------------------------------------------------------------------------------------- 
    1978 \section{Other diagnostics (\protect\key{diahth}, \protect\key{diaar5})} 
     1990\section[Other diagnostics] 
     1991{Other diagnostics} 
    19791992\label{sec:DIA_diag_others} 
    19801993 
     
    19821995The available ready-to-add diagnostics modules can be found in directory DIA. 
    19831996 
    1984 \subsection{Depth of various quantities (\protect\mdl{diahth})} 
     1997\subsection[Depth of various quantities (\textit{diahth.F90})] 
     1998{Depth of various quantities (\protect\mdl{diahth})} 
    19851999 
    19862000Among the available diagnostics the following ones are obtained when defining the \key{diahth} CPP key: 
    19872001 
    1988 - the mixed layer depth (based on a density criterion \citep{de_Boyer_Montegut_al_JGR04}) (\mdl{diahth}) 
     2002- the mixed layer depth (based on a density criterion \citep{de-boyer-montegut.madec.ea_JGR04}) (\mdl{diahth}) 
    19892003 
    19902004- the turbocline depth (based on a turbulent mixing coefficient criterion) (\mdl{diahth}) 
     
    19942008- the depth of the thermocline (maximum of the vertical temperature gradient) (\mdl{diahth}) 
    19952009 
     2010 
     2011%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     2012\begin{figure}[!t] 
     2013  \centering 
     2014  \includegraphics[width=\textwidth]{Fig_mask_subasins} 
     2015  \caption[Decomposition of the World Ocean to compute transports as well as 
     2016  the meridional stream-function]{ 
     2017    Decomposition of the World Ocean (here ORCA2) into sub-basin used in to 
     2018    compute the heat and salt transports as well as the meridional stream-function: 
     2019    Atlantic basin (red), Pacific basin (green), 
     2020    Indian basin (blue), Indo-Pacific basin (blue+green). 
     2021    Note that semi-enclosed seas (Red, Med and Baltic seas) as well as 
     2022    Hudson Bay are removed from the sub-basins. 
     2023    Note also that the Arctic Ocean has been split into Atlantic and 
     2024    Pacific basins along the North fold line. 
     2025  } 
     2026  \label{fig:DIA_mask_subasins} 
     2027\end{figure} 
     2028%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     2029 
    19962030% ----------------------------------------------------------- 
    1997 %     Poleward heat and salt transports 
     2031%       CMIP specific diagnostics 
    19982032% ----------------------------------------------------------- 
    1999  
    2000 \subsection{Poleward heat and salt transports (\protect\mdl{diaptr})} 
    2001  
    2002 %------------------------------------------namptr----------------------------------------- 
    2003  
    2004 \nlst{namptr}  
    2005 %----------------------------------------------------------------------------------------- 
    2006  
    2007 The poleward heat and salt transports, their advective and diffusive component, 
    2008 and the meriodional stream function can be computed on-line in \mdl{diaptr} \np{ln\_diaptr} to true 
    2009 (see the \textit{\ngn{namptr} } namelist below). 
    2010 When \np{ln\_subbas}\forcode{ = .true.}, transports and stream function are computed for the Atlantic, Indian, 
     2033\subsection[CMIP specific diagnostics (\textit{diaar5.F90}, \textit{diaptr.F90})] 
     2034{CMIP specific diagnostics (\protect\mdl{diaar5})} 
     2035 
     2036A series of diagnostics has been added in the \mdl{diaar5} and \mdl{diaptr}. 
     2037In \mdl{diaar5} they correspond to outputs that are required for AR5 simulations (CMIP5) 
     2038(see also \autoref{sec:DIA_steric} for one of them). 
     2039The module \mdl{diaar5} is active when one of the following outputs is required : 
     2040global total volume (voltot), global mean ssh (sshtot), global total mass (masstot), global mean temperature (temptot), 
     2041global mean ssh steric (sshsteric), global mean ssh thermosteric (sshthster), global mean salinity (saltot), 
     2042sea water pressure at sea floor (botpres), dynamic sea surface height (sshdyn). 
     2043 
     2044In \mdl{diaptr} when \np{ln\_diaptr}\forcode{=.true.} 
     2045(see the \nam{ptr} namelist below) can be computed on-line the poleward heat and salt transports, 
     2046their advective and diffusive component, and the meriodional stream function . 
     2047When \np{ln\_subbas}\forcode{=.true.}, transports and stream function are computed for the Atlantic, Indian, 
    20112048Pacific and Indo-Pacific Oceans (defined north of 30\deg{S}) as well as for the World Ocean. 
    20122049The sub-basin decomposition requires an input file (\ifile{subbasins}) which contains three 2D mask arrays, 
    2013 the Indo-Pacific mask been deduced from the sum of the Indian and Pacific mask (\autoref{fig:mask_subasins}). 
    2014  
    2015 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    2016 \begin{figure}[!t] 
    2017   \begin{center} 
    2018     \includegraphics[width=1.0\textwidth]{Fig_mask_subasins} 
    2019     \caption{ 
    2020       \protect\label{fig:mask_subasins} 
    2021       Decomposition of the World Ocean (here ORCA2) into sub-basin used in to 
    2022       compute the heat and salt transports as well as the meridional stream-function: 
    2023       Atlantic basin (red), Pacific basin (green), Indian basin (bleue), Indo-Pacific basin (bleue+green). 
    2024       Note that semi-enclosed seas (Red, Med and Baltic seas) as well as Hudson Bay are removed from the sub-basins. 
    2025       Note also that the Arctic Ocean has been split into Atlantic and Pacific basins along the North fold line. 
    2026     } 
    2027   \end{center} 
    2028 \end{figure}   
    2029 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     2050the Indo-Pacific mask been deduced from the sum of the Indian and Pacific mask (\autoref{fig:DIA_mask_subasins}). 
     2051 
     2052%------------------------------------------namptr----------------------------------------- 
     2053 
     2054\begin{listing} 
     2055  \nlst{namptr} 
     2056  \caption{\texttt{namptr}} 
     2057  \label{lst:namptr} 
     2058\end{listing} 
     2059%----------------------------------------------------------------------------------------- 
    20302060 
    20312061% ----------------------------------------------------------- 
    2032 %       CMIP specific diagnostics  
    2033 % ----------------------------------------------------------- 
    2034 \subsection{CMIP specific diagnostics (\protect\mdl{diaar5})} 
    2035  
    2036 A series of diagnostics has been added in the \mdl{diaar5}. 
    2037 They corresponds to outputs that are required for AR5 simulations (CMIP5) 
    2038 (see also \autoref{sec:DIA_steric} for one of them). 
    2039 Activating those outputs requires to define the \key{diaar5} CPP key. 
    2040  
    2041 % ----------------------------------------------------------- 
    2042 %       25 hour mean and hourly Surface, Mid and Bed  
     2062%       25 hour mean and hourly Surface, Mid and Bed 
    20432063% ----------------------------------------------------------- 
    20442064\subsection{25 hour mean output for tidal models} 
     
    20462066%------------------------------------------nam_dia25h------------------------------------- 
    20472067 
    2048 \nlst{nam_dia25h} 
     2068\begin{listing} 
     2069  \nlst{nam_dia25h} 
     2070  \caption{\texttt{nam\_dia25h}} 
     2071  \label{lst:nam_dia25h} 
     2072\end{listing} 
    20492073%----------------------------------------------------------------------------------------- 
    20502074 
     
    20612085%------------------------------------------nam_diatmb----------------------------------------------------- 
    20622086 
    2063 \nlst{nam_diatmb} 
     2087\begin{listing} 
     2088  \nlst{nam_diatmb} 
     2089  \caption{\texttt{nam\_diatmb}} 
     2090  \label{lst:nam_diatmb} 
     2091\end{listing} 
    20642092%---------------------------------------------------------------------------------------------------------- 
    20652093 
     
    20802108\[ 
    20812109  C_u = |u|\frac{\rdt}{e_{1u}}, \quad C_v = |v|\frac{\rdt}{e_{2v}}, \quad C_w = |w|\frac{\rdt}{e_{3w}} 
    2082   % \label{eq:CFL} 
     2110  % \label{eq:DIA_CFL} 
    20832111\] 
    20842112 
     
    20892117Values greater than 1 indicate that information is propagated across more than one grid cell in a single time step. 
    20902118 
    2091 The variables can be activated by setting the \np{nn\_diacfl} namelist parameter to 1 in the \ngn{namctl} namelist. 
     2119The variables can be activated by setting the \np{nn\_diacfl} namelist parameter to 1 in the \nam{ctl} namelist. 
    20922120The diagnostics will be written out to an ascii file named cfl\_diagnostics.ascii. 
    20932121In this file the maximum value of $C_u$, $C_v$, and $C_w$ are printed at each timestep along with the coordinates of 
     
    20952123At the end of the model run the maximum value of $C_u$, $C_v$, and $C_w$ for the whole model run is printed along 
    20962124with the coordinates of each. 
    2097 The maximum values from the run are also copied to the ocean.output file.  
     2125The maximum values from the run are also copied to the ocean.output file. 
    20982126 
    20992127% ================================================================ 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_DIU.tex

    r10442 r11564  
    99\label{chap:DIU} 
    1010 
    11 \minitoc 
     11\chaptertoc 
    1212 
    1313 
     
    1616 
    1717Code to produce an estimate of the diurnal warming and cooling of the sea surface skin 
    18 temperature (skin SST) is found in the DIU directory.   
     18temperature (skin SST) is found in the DIU directory. 
    1919The skin temperature can be split into three parts: 
    2020\begin{itemize} 
     
    3030 
    3131Models are provided for both the warm layer, \mdl{diurnal\_bulk}, and the cool skin, \mdl{cool\_skin}. 
    32 Foundation SST is not considered as it can be obtained either from the main NEMO model 
    33 (\ie from the temperature of the top few model levels) or from some other source.   
     32Foundation SST is not considered as it can be obtained either from the main \NEMO\ model 
     33(\ie\ from the temperature of the top few model levels) or from some other source. 
    3434It must be noted that both the cool skin and warm layer models produce estimates of the change in temperature 
    35 ($\Delta T_{\rm{cs}}$ and $\Delta T_{\rm{wl}}$) and 
     35($\Delta T_{\mathrm{cs}}$ and $\Delta T_{\mathrm{wl}}$) and 
    3636both must be added to a foundation SST to obtain the true skin temperature. 
    3737 
    38 Both the cool skin and warm layer models are controlled through the namelist \ngn{namdiu}: 
     38Both the cool skin and warm layer models are controlled through the namelist \nam{diu}: 
    3939 
    40 \nlst{namdiu} 
     40\begin{listing} 
     41  \nlst{namdiu} 
     42  \caption{\texttt{namdiu}} 
     43  \label{lst:namdiu} 
     44\end{listing} 
     45 
    4146This namelist contains only two variables: 
    4247\begin{description} 
     
    4449  A logical switch for turning on/off both the cool skin and warm layer. 
    4550\item[\np{ln\_diurnal\_only}] 
    46   A logical switch which if \forcode{.true.} will run the diurnal model without the other dynamical parts of NEMO. 
     51  A logical switch which if \forcode{.true.} will run the diurnal model without the other dynamical parts of \NEMO. 
    4752  \np{ln\_diurnal\_only} must be \forcode{.false.} if \np{ln\_diurnal} is \forcode{.false.}. 
    4853\end{description} 
     
    5358Initialisation is through the restart file. 
    5459Specifically the code will expect the presence of the 2-D variable ``Dsst'' to initialise the warm layer. 
    55 The cool skin model, which is determined purely by the instantaneous fluxes, has no initialisation variable.   
     60The cool skin model, which is determined purely by the instantaneous fluxes, has no initialisation variable. 
    5661 
    5762%=============================================================== 
    5863\section{Warm layer model} 
    59 \label{sec:warm_layer_sec} 
     64\label{sec:DIU_warm_layer_sec} 
    6065%=============================================================== 
    6166 
    62 The warm layer is calculated using the model of \citet{Takaya_al_JGR10} (TAKAYA10 model hereafter). 
     67The warm layer is calculated using the model of \citet{takaya.bidlot.ea_JGR10} (TAKAYA10 model hereafter). 
    6368This is a simple flux based model that is defined by the equations 
    6469\begin{align} 
    65 \frac{\partial{\Delta T_{\rm{wl}}}}{\partial{t}}&=&\frac{Q(\nu+1)}{D_T\rho_w c_p 
     70\frac{\partial{\Delta T_{\mathrm{wl}}}}{\partial{t}}&=&\frac{Q(\nu+1)}{D_T\rho_w c_p 
    6671\nu}-\frac{(\nu+1)ku^*_{w}f(L_a)\Delta T}{D_T\Phi\!\left(\frac{D_T}{L}\right)} \mbox{,} 
    67 \label{eq:ecmwf1} \\ 
    68 L&=&\frac{\rho_w c_p u^{*^3}_{w}}{\kappa g \alpha_w Q }\mbox{,}\label{eq:ecmwf2} 
     72\label{eq:DIU_ecmwf1} \\ 
     73L&=&\frac{\rho_w c_p u^{*^3}_{w}}{\kappa g \alpha_w Q }\mbox{,}\label{eq:DIU_ecmwf2} 
    6974\end{align} 
    70 where $\Delta T_{\rm{wl}}$ is the temperature difference between the top of the warm layer and the depth $D_T=3$\,m at which there is assumed to be no diurnal signal. 
    71 In equation (\autoref{eq:ecmwf1}) $\alpha_w=2\times10^{-4}$ is the thermal expansion coefficient of water, 
     75where $\Delta T_{\mathrm{wl}}$ is the temperature difference between the top of the warm layer and the depth $D_T=3$\,m at which there is assumed to be no diurnal signal. 
     76In equation (\autoref{eq:DIU_ecmwf1}) $\alpha_w=2\times10^{-4}$ is the thermal expansion coefficient of water, 
    7277$\kappa=0.4$ is von K\'{a}rm\'{a}n's constant, $c_p$ is the heat capacity at constant pressure of sea water, 
    7378$\rho_w$ is the water density, and $L$ is the Monin-Obukhov length. 
    7479The tunable variable $\nu$ is a shape parameter that defines the expected subskin temperature profile via 
    75 $T(z) = T(0) - \left( \frac{z}{D_T} \right)^\nu \Delta T_{\rm{wl}}$, 
     80$T(z) = T(0) - \left( \frac{z}{D_T} \right)^\nu \Delta T_{\mathrm{wl}}$, 
    7681where $T$ is the absolute temperature and $z\le D_T$ is the depth below the top of the warm layer. 
    7782The influence of wind on TAKAYA10 comes through the magnitude of the friction velocity of the water $u^*_{w}$, 
     
    7984the relationship $u^*_{w} = u_{10}\sqrt{\frac{C_d\rho_a}{\rho_w}}$, where $C_d$ is the drag coefficient, 
    8085and $\rho_a$ is the density of air. 
    81 The symbol $Q$ in equation (\autoref{eq:ecmwf1}) is the instantaneous total thermal energy flux into 
     86The symbol $Q$ in equation (\autoref{eq:DIU_ecmwf1}) is the instantaneous total thermal energy flux into 
    8287the diurnal layer, \ie 
    8388\[ 
    84   Q = Q_{\rm{sol}} + Q_{\rm{lw}} + Q_{\rm{h}}\mbox{,} 
    85   % \label{eq:e_flux_eqn} 
     89  Q = Q_{\mathrm{sol}} + Q_{\mathrm{lw}} + Q_{\mathrm{h}}\mbox{,} 
     90  % \label{eq:DIU_e_flux_eqn} 
    8691\] 
    87 where $Q_{\rm{h}}$ is the sensible and latent heat flux, $Q_{\rm{lw}}$ is the long wave flux, 
    88 and $Q_{\rm{sol}}$ is the solar flux absorbed within the diurnal warm layer. 
    89 For $Q_{\rm{sol}}$ the 9 term representation of \citet{Gentemann_al_JGR09} is used. 
    90 In equation \autoref{eq:ecmwf1} the function $f(L_a)=\max(1,L_a^{\frac{2}{3}})$, 
     92where $Q_{\mathrm{h}}$ is the sensible and latent heat flux, $Q_{\mathrm{lw}}$ is the long wave flux, 
     93and $Q_{\mathrm{sol}}$ is the solar flux absorbed within the diurnal warm layer. 
     94For $Q_{\mathrm{sol}}$ the 9 term representation of \citet{gentemann.minnett.ea_JGR09} is used. 
     95In equation \autoref{eq:DIU_ecmwf1} the function $f(L_a)=\max(1,L_a^{\frac{2}{3}})$, 
    9196where $L_a=0.3$\footnote{ 
    9297  This is a global average value, more accurately $L_a$ could be computed as $L_a=(u^*_{w}/u_s)^{\frac{1}{2}}$, 
     
    991044\zeta^2}{1+3\zeta+0.25\zeta^2} &(\zeta \ge 0) \\ 
    100105                                    (1 - 16\zeta)^{-\frac{1}{2}} & (\zeta < 0) \mbox{,} 
    101                                     \end{array} \right. \label{eq:stab_func_eqn} 
     106                                    \end{array} \right. \label{eq:DIU_stab_func_eqn} 
    102107\end{equation} 
    103 where $\zeta=\frac{D_T}{L}$.  It is clear that the first derivative of (\autoref{eq:stab_func_eqn}), 
    104 and thus of (\autoref{eq:ecmwf1}), is discontinuous at $\zeta=0$ (\ie $Q\rightarrow0$ in 
    105 equation (\autoref{eq:ecmwf2})). 
     108where $\zeta=\frac{D_T}{L}$.  It is clear that the first derivative of (\autoref{eq:DIU_stab_func_eqn}), 
     109and thus of (\autoref{eq:DIU_ecmwf1}), is discontinuous at $\zeta=0$ (\ie\ $Q\rightarrow0$ in 
     110equation (\autoref{eq:DIU_ecmwf2})). 
    106111 
    107 The two terms on the right hand side of (\autoref{eq:ecmwf1}) represent different processes. 
     112The two terms on the right hand side of (\autoref{eq:DIU_ecmwf1}) represent different processes. 
    108113The first term is simply the diabatic heating or cooling of the diurnal warm layer due to 
    109114thermal energy fluxes into and out of the layer. 
     
    114119 
    115120\section{Cool skin model} 
    116 \label{sec:cool_skin_sec} 
     121\label{sec:DIU_cool_skin_sec} 
    117122 
    118123%=============================================================== 
    119124 
    120 The cool skin is modelled using the framework of \citet{Saunders_JAS82} who used a formulation of the near surface temperature difference based upon the heat flux and the friction velocity $u^*_{w}$. 
    121 As the cool skin is so thin (~1\,mm) we ignore the solar flux component to the heat flux and the Saunders equation for the cool skin temperature difference $\Delta T_{\rm{cs}}$ becomes 
     125The cool skin is modelled using the framework of \citet{saunders_JAS67} who used a formulation of the near surface temperature difference based upon the heat flux and the friction velocity $u^*_{w}$. 
     126As the cool skin is so thin (~1\,mm) we ignore the solar flux component to the heat flux and the Saunders equation for the cool skin temperature difference $\Delta T_{\mathrm{cs}}$ becomes 
    122127\[ 
    123   % \label{eq:sunders_eqn} 
    124   \Delta T_{\rm{cs}}=\frac{Q_{\rm{ns}}\delta}{k_t} \mbox{,} 
     128  % \label{eq:DIU_sunders_eqn} 
     129  \Delta T_{\mathrm{cs}}=\frac{Q_{\mathrm{ns}}\delta}{k_t} \mbox{,} 
    125130\] 
    126 where $Q_{\rm{ns}}$ is the, usually negative, non-solar heat flux into the ocean and 
     131where $Q_{\mathrm{ns}}$ is the, usually negative, non-solar heat flux into the ocean and 
    127132$k_t$ is the thermal conductivity of sea water. 
    128133$\delta$ is the thickness of the skin layer and is given by 
    129134\begin{equation} 
    130 \label{eq:sunders_thick_eqn} 
     135\label{eq:DIU_sunders_thick_eqn} 
    131136\delta=\frac{\lambda \mu}{u^*_{w}} \mbox{,} 
    132137\end{equation} 
    133138where $\mu$ is the kinematic viscosity of sea water and $\lambda$ is a constant of proportionality which 
    134 \citet{Saunders_JAS82} suggested varied between 5 and 10. 
     139\citet{saunders_JAS67} suggested varied between 5 and 10. 
    135140 
    136 The value of $\lambda$ used in equation (\autoref{eq:sunders_thick_eqn}) is that of \citet{Artale_al_JGR02}, 
    137 which is shown in \citet{Tu_Tsuang_GRL05} to outperform a number of other parametrisations at 
     141The value of $\lambda$ used in equation (\autoref{eq:DIU_sunders_thick_eqn}) is that of \citet{artale.iudicone.ea_JGR02}, 
     142which is shown in \citet{tu.tsuang_GRL05} to outperform a number of other parametrisations at 
    138143both low and high wind speeds. 
    139144Specifically, 
    140145\[ 
    141   % \label{eq:artale_lambda_eqn} 
     146  % \label{eq:DIU_artale_lambda_eqn} 
    142147  \lambda = \frac{ 8.64\times10^4 u^*_{w} k_t }{ \rho c_p h \mu \gamma }\mbox{,} 
    143148\] 
     
    145150$\gamma$ is a dimensionless function of wind speed $u$: 
    146151\[ 
    147   % \label{eq:artale_gamma_eqn} 
     152  % \label{eq:DIU_artale_gamma_eqn} 
    148153  \gamma = 
    149154  \begin{cases} 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_DOM.tex

    r10502 r11564  
    88\label{chap:DOM} 
    99 
    10 \minitoc 
     10\chaptertoc 
    1111 
    1212% Missing things: 
    1313%  - istate: description of the initial state   ==> this has to be put elsewhere.. 
    14 %                  perhaps in MISC ?  By the way the initialisation of T S and dynamics  
     14%                  perhaps in MISC ?  By the way the initialisation of T S and dynamics 
    1515%                  should be put outside of DOM routine (better with TRC staff and off-line 
    1616%                  tracers) 
     
    1818%     - domclo:  closed sea and lakes.... management of closea sea area : specific to global configuration, both forced and coupled 
    1919 
     20\vfill 
     21 
     22\begin{table}[b] 
     23  \footnotesize 
     24  \caption*{Changes record} 
     25  \begin{tabularx}{\textwidth}{l||X|X} 
     26    Release & Author(s) & Modifications                                                          \\ 
     27    \hline 
     28    {\em 4.0} & {\em Simon M\"{u}ller \& Andrew Coward} & 
     29    {\em 
     30      Compatibility changes Major simplification has moved many of the options to external domain configuration tools. 
     31      (see \autoref{apdx:DOMCFG}) 
     32    }                                                                                            \\ 
     33    {\em 3.x} & {\em Rachid Benshila, Gurvan Madec \& S\'{e}bastien Masson} & 
     34    {\em First version}                                                                          \\ 
     35  \end{tabularx} 
     36\end{table} 
     37 
    2038\newpage 
    2139 
    22 Having defined the continuous equations in \autoref{chap:PE} and chosen a time discretization \autoref{chap:STP}, 
    23 we need to choose a discretization on a grid, and numerical algorithms. 
     40Having defined the continuous equations in \autoref{chap:MB} and chosen a time discretisation \autoref{chap:TD}, 
     41we need to choose a grid for spatial discretisation and related numerical algorithms. 
    2442In the present chapter, we provide a general description of the staggered grid used in \NEMO, 
    25 and other information relevant to the main directory routines as well as the DOM (DOMain) directory. 
     43and other relevant information about the DOM (DOMain) source code modules. 
    2644 
    2745% ================================================================ 
     
    3250 
    3351% ------------------------------------------------------------------------------------------------------------- 
    34 %        Arrangement of Variables  
     52%        Arrangement of Variables 
    3553% ------------------------------------------------------------------------------------------------------------- 
    3654\subsection{Arrangement of variables} 
     
    3957%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    4058\begin{figure}[!tb] 
    41   \begin{center} 
    42     \includegraphics[]{Fig_cell} 
    43     \caption{ 
    44       \protect\label{fig:cell} 
    45       Arrangement of variables. 
    46       $t$ indicates scalar points where temperature, salinity, density, pressure and 
    47       horizontal divergence are defined. 
    48       $(u,v,w)$ indicates vector points, and $f$ indicates vorticity points where both relative and 
    49       planetary vorticities are defined. 
    50     } 
    51   \end{center} 
     59  \centering 
     60  \includegraphics[width=\textwidth]{Fig_cell} 
     61  \caption[Arrangement of variables in the unit cell of space domain]{ 
     62    Arrangement of variables in the unit cell of space domain. 
     63    $t$ indicates scalar points where 
     64    temperature, salinity, density, pressure and horizontal divergence are defined. 
     65    $(u,v,w)$ indicates vector points, 
     66    and $f$ indicates vorticity points where 
     67    both relative and planetary vorticities are defined.} 
     68  \label{fig:DOM_cell} 
    5269\end{figure} 
    5370%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    5572The numerical techniques used to solve the Primitive Equations in this model are based on the traditional, 
    5673centred second-order finite difference approximation. 
    57 Special attention has been given to the homogeneity of the solution in the three space directions. 
     74Special attention has been given to the homogeneity of the solution in the three spatial directions. 
    5875The arrangement of variables is the same in all directions. 
    5976It consists of cells centred on scalar points ($t$, $S$, $p$, $\rho$) with vector points $(u, v, w)$ defined in 
    60 the centre of each face of the cells (\autoref{fig:cell}). 
     77the centre of each face of the cells (\autoref{fig:DOM_cell}). 
    6178This is the generalisation to three dimensions of the well-known ``C'' grid in Arakawa's classification 
    62 \citep{Mesinger_Arakawa_Bk76}. 
     79\citep{mesinger.arakawa_bk76}. 
    6380The relative and planetary vorticity, $\zeta$ and $f$, are defined in the centre of each vertical edge and 
    6481the barotropic stream function $\psi$ is defined at horizontal points overlying the $\zeta$ and $f$-points. 
    6582 
    66 The ocean mesh (\ie the position of all the scalar and vector points) is defined by the transformation that 
     83The ocean mesh (\ie\ the position of all the scalar and vector points) is defined by the transformation that 
    6784gives $(\lambda,\varphi,z)$ as a function of $(i,j,k)$. 
    68 The grid-points are located at integer or integer and a half value of $(i,j,k)$ as indicated on \autoref{tab:cell}. 
     85The grid-points are located at integer or integer and a half value of $(i,j,k)$ as indicated on \autoref{tab:DOM_cell}. 
    6986In all the following, subscripts $u$, $v$, $w$, $f$, $uw$, $vw$ or $fw$ indicate the position of 
    7087the grid-point where the scale factors are defined. 
    71 Each scale factor is defined as the local analytical value provided by \autoref{eq:scale_factors}. 
     88Each scale factor is defined as the local analytical value provided by \autoref{eq:MB_scale_factors}. 
    7289As a result, the mesh on which partial derivatives $\pd[]{\lambda}$, $\pd[]{\varphi}$ and 
    73 $\pd[]{z}$ are evaluated in a uniform mesh with a grid size of unity. 
     90$\pd[]{z}$ are evaluated is a uniform mesh with a grid size of unity. 
    7491Discrete partial derivatives are formulated by the traditional, centred second order finite difference approximation 
    7592while the scale factors are chosen equal to their local analytical value. 
     
    7794centred finite difference approximation, not from their analytical expression. 
    7895This preserves the symmetry of the discrete set of equations and therefore satisfies many of 
    79 the continuous properties (see \autoref{apdx:C}). 
     96the continuous properties (see \autoref{apdx:INVARIANTS}). 
    8097A similar, related remark can be made about the domain size: 
    81 when needed, an area, volume, or the total ocean depth must be evaluated as the sum of the relevant scale factors 
     98when needed, an area, volume, or the total ocean depth must be evaluated as the product or sum of the relevant scale factors 
    8299(see \autoref{eq:DOM_bar} in the next section). 
    83100 
    84101%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    85102\begin{table}[!tb] 
    86   \begin{center} 
    87     \begin{tabular}{|p{46pt}|p{56pt}|p{56pt}|p{56pt}|} 
    88       \hline 
    89       T  & $i      $ & $j      $ & $k      $ \\ 
    90       \hline 
    91       u  & $i + 1/2$ & $j      $ & $k      $ \\ 
    92       \hline 
    93       v  & $i      $ & $j + 1/2$ & $k      $ \\ 
    94       \hline 
    95       w  & $i      $ & $j      $ & $k + 1/2$ \\ 
    96       \hline 
    97       f  & $i + 1/2$ & $j + 1/2$ & $k      $ \\ 
    98       \hline 
    99       uw & $i + 1/2$ & $j      $ & $k + 1/2$ \\ 
    100       \hline 
    101       vw & $i      $ & $j + 1/2$ & $k + 1/2$ \\ 
    102       \hline 
    103       fw & $i + 1/2$ & $j + 1/2$ & $k + 1/2$ \\ 
    104       \hline 
    105     \end{tabular} 
    106     \caption{ 
    107       \protect\label{tab:cell} 
    108       Location of grid-points as a function of integer or integer and a half value of the column, line or level. 
    109       This indexing is only used for the writing of the semi -discrete equation. 
    110       In the code, the indexing uses integer values only and has a reverse direction in the vertical 
    111       (see \autoref{subsec:DOM_Num_Index}) 
    112     } 
    113   \end{center} 
     103  \centering 
     104  \begin{tabular}{|p{46pt}|p{56pt}|p{56pt}|p{56pt}|} 
     105    \hline 
     106    t & $i      $ & $j      $ & $k      $ \\ 
     107    \hline 
     108    u & $i + 1/2$ & $j      $ & $k      $ \\ 
     109    \hline 
     110    v & $i      $ & $j + 1/2$ & $k      $ \\ 
     111    \hline 
     112    w & $i      $ & $j      $ & $k + 1/2$ \\ 
     113    \hline 
     114    f & $i + 1/2$ & $j + 1/2$ & $k      $ \\ 
     115    \hline 
     116    uw   & $i + 1/2$ & $j      $ & $k + 1/2$ \\ 
     117    \hline 
     118    vw   & $i      $ & $j + 1/2$ & $k + 1/2$ \\ 
     119    \hline 
     120    fw   & $i + 1/2$ & $j + 1/2$ & $k + 1/2$ \\ 
     121    \hline 
     122  \end{tabular} 
     123  \caption[Location of grid-points]{ 
     124    Location of grid-points as a function of integer or 
     125    integer and a half value of the column, line or level. 
     126    This indexing is only used for the writing of the semi -discrete equations. 
     127    In the code, the indexing uses integer values only and 
     128    is positive downwards in the vertical with $k=1$ at the surface. 
     129    (see \autoref{subsec:DOM_Num_Index})} 
     130  \label{tab:DOM_cell} 
    114131\end{table} 
    115132%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    116133 
    117 % ------------------------------------------------------------------------------------------------------------- 
    118 %        Vector Invariant Formulation  
     134Note that the definition of the scale factors 
     135(\ie\ as the analytical first derivative of the transformation that 
     136results in $(\lambda,\varphi,z)$ as a function of $(i,j,k)$) 
     137is specific to the \NEMO\ model \citep{marti.madec.ea_JGR92}. 
     138As an example, a scale factor in the $i$ direction is defined locally at a $t$-point, 
     139whereas many other models on a C grid choose to define such a scale factor as 
     140the distance between the $u$-points on each side of the $t$-point. 
     141Relying on an analytical transformation has two advantages: 
     142firstly, there is no ambiguity in the scale factors appearing in the discrete equations, 
     143since they are first introduced in the continuous equations; 
     144secondly, analytical transformations encourage good practice by the definition of smoothly varying grids 
     145(rather than allowing the user to set arbitrary jumps in thickness between adjacent layers) \citep{treguier.dukowicz.ea_JGR96}. 
     146An example of the effect of such a choice is shown in \autoref{fig:DOM_zgr_e3}. 
     147%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     148\begin{figure}[!t] 
     149  \centering 
     150  \includegraphics[width=\textwidth]{Fig_zgr_e3} 
     151  \caption[Comparison of grid-point position, vertical grid-size and scale factors]{ 
     152    Comparison of (a) traditional definitions of grid-point position and grid-size in the vertical, 
     153    and (b) analytically derived grid-point position and scale factors. 
     154    For both grids here, the same $w$-point depth has been chosen but 
     155    in (a) the $t$-points are set half way between $w$-points while 
     156    in (b) they are defined from an analytical function: 
     157    $z(k) = 5 \, (k - 1/2)^3 - 45 \, (k - 1/2)^2 + 140 \, (k - 1/2) - 150$. 
     158    Note the resulting difference between the value of the grid-size $\Delta_k$ and 
     159    those of the scale factor $e_k$.} 
     160  \label{fig:DOM_zgr_e3} 
     161\end{figure} 
     162%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     163 
     164% ------------------------------------------------------------------------------------------------------------- 
     165%        Vector Invariant Formulation 
    119166% ------------------------------------------------------------------------------------------------------------- 
    120167\subsection{Discrete operators} 
     
    124171the midpoint between them are: 
    125172\begin{alignat*}{2} 
    126   % \label{eq:di_mi} 
     173  % \label{eq:DOM_di_mi} 
    127174  \delta_i [q]      &= &       &q (i + 1/2) - q (i - 1/2) \\ 
    128175  \overline q^{\, i} &= &\big\{ &q (i + 1/2) + q (i - 1/2) \big\} / 2 
     
    130177 
    131178Similar operators are defined with respect to $i + 1/2$, $j$, $j + 1/2$, $k$, and $k + 1/2$. 
    132 Following \autoref{eq:PE_grad} and \autoref{eq:PE_lap}, the gradient of a variable $q$ defined at 
    133 a $t$-point has its three components defined at $u$-, $v$- and $w$-points while 
    134 its Laplacian is defined at $t$-point. 
     179Following \autoref{eq:MB_grad} and \autoref{eq:MB_lap}, the gradient of a variable $q$ defined at a $t$-point has 
     180its three components defined at $u$-, $v$- and $w$-points while its Laplacian is defined at the $t$-point. 
    135181These operators have the following discrete forms in the curvilinear $s$-coordinates system: 
    136182\[ 
     
    149195\end{multline*} 
    150196 
    151 Following \autoref{eq:PE_curl} and \autoref{eq:PE_div}, a vector $\vect A = (a_1,a_2,a_3)$ defined at 
     197Following \autoref{eq:MB_curl} and \autoref{eq:MB_div}, a vector $\vect A = (a_1,a_2,a_3)$ defined at 
    152198vector points $(u,v,w)$ has its three curl components defined at $vw$-, $uw$, and $f$-points, and 
    153199its divergence defined at $t$-points: 
     
    171217\end{equation} 
    172218 
    173 The vertical average over the whole water column denoted by an overbar becomes for a quantity $q$ which 
    174 is a masked field (i.e. equal to zero inside solid area): 
     219The vertical average over the whole water column is denoted by an overbar and is for 
     220a masked field $q$ (\ie\ a quantity that is equal to zero inside solid areas): 
    175221\begin{equation} 
    176222  \label{eq:DOM_bar} 
     
    178224\end{equation} 
    179225where $H_q$  is the ocean depth, which is the masked sum of the vertical scale factors at $q$ points, 
    180 $k^b$ and $k^o$ are the bottom and surface $k$-indices, and the symbol $k^o$ refers to a summation over 
     226$k^b$ and $k^o$ are the bottom and surface $k$-indices, and the symbol $\sum \limits_k$ refers to a summation over 
    181227all grid points of the same type in the direction indicated by the subscript (here $k$). 
    182228 
     
    193239vector points $(u,v,w)$. 
    194240 
    195 Let $a$ and $b$ be two fields defined on the mesh, with value zero inside continental area. 
    196 Using integration by parts it can be shown that the differencing operators ($\delta_i$, $\delta_j$ and $\delta_k$) 
     241Let $a$ and $b$ be two fields defined on the mesh, with a value of zero inside continental areas. 
     242It can be shown that the differencing operators ($\delta_i$, $\delta_j$ and $\delta_k$) 
    197243are skew-symmetric linear operators, and further that the averaging operators $\overline{\cdots}^{\, i}$, 
    198244$\overline{\cdots}^{\, j}$ and $\overline{\cdots}^{\, k}$) are symmetric linear operators, \ie 
     
    204250\end{alignat} 
    205251 
    206 In other words, the adjoint of the differencing and averaging operators are $\delta_i^* = \delta_{i + 1/2}$ and  
     252In other words, the adjoint of the differencing and averaging operators are $\delta_i^* = \delta_{i + 1/2}$ and 
    207253$(\overline{\cdots}^{\, i})^* = \overline{\cdots}^{\, i + 1/2}$, respectively. 
    208 These two properties will be used extensively in the \autoref{apdx:C} to 
     254These two properties will be used extensively in the \autoref{apdx:INVARIANTS} to 
    209255demonstrate integral conservative properties of the discrete formulation chosen. 
    210256 
    211257% ------------------------------------------------------------------------------------------------------------- 
    212 %        Numerical Indexing  
     258%        Numerical Indexing 
    213259% ------------------------------------------------------------------------------------------------------------- 
    214260\subsection{Numerical indexing} 
     
    217263%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    218264\begin{figure}[!tb] 
    219   \begin{center} 
    220     \includegraphics[]{Fig_index_hor} 
    221     \caption{ 
    222       \protect\label{fig:index_hor} 
    223       Horizontal integer indexing used in the \fortran code. 
    224       The dashed area indicates the cell in which variables contained in arrays have the same $i$- and $j$-indices 
    225     } 
    226   \end{center} 
     265  \centering 
     266  \includegraphics[width=\textwidth]{Fig_index_hor} 
     267  \caption[Horizontal integer indexing]{ 
     268    Horizontal integer indexing used in the \fortran\ code. 
     269    The dashed area indicates the cell in which 
     270    variables contained in arrays have the same $i$- and $j$-indices} 
     271  \label{fig:DOM_index_hor} 
    227272\end{figure} 
    228273%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    229274 
    230 The array representation used in the \fortran code requires an integer indexing while 
    231 the analytical definition of the mesh (see \autoref{subsec:DOM_cell}) is associated with the use of 
    232 integer values for $t$-points and both integer and integer and a half values for all the other points. 
    233 Therefore a specific integer indexing must be defined for points other than $t$-points 
    234 (\ie velocity and vorticity grid-points). 
    235 Furthermore, the direction of the vertical indexing has been changed so that the surface level is at $k = 1$. 
     275The array representation used in the \fortran\ code requires an integer indexing. 
     276However, the analytical definition of the mesh (see \autoref{subsec:DOM_cell}) is associated with the use of 
     277integer values for $t$-points only while all the other points involve integer and a half values. 
     278Therefore, a specific integer indexing has been defined for points other than $t$-points 
     279(\ie\ velocity and vorticity grid-points). 
     280Furthermore, the direction of the vertical indexing has been reversed and the surface level set at $k = 1$. 
    236281 
    237282% ----------------------------------- 
    238 %        Horizontal Indexing  
     283%        Horizontal Indexing 
    239284% ----------------------------------- 
    240285\subsubsection{Horizontal indexing} 
    241286\label{subsec:DOM_Num_Index_hor} 
    242287 
    243 The indexing in the horizontal plane has been chosen as shown in \autoref{fig:index_hor}. 
     288The indexing in the horizontal plane has been chosen as shown in \autoref{fig:DOM_index_hor}. 
    244289For an increasing $i$ index ($j$ index), 
    245290the $t$-point and the eastward $u$-point (northward $v$-point) have the same index 
    246 (see the dashed area in \autoref{fig:index_hor}). 
    247 A $t$-point and its nearest northeast $f$-point have the same $i$-and $j$-indices. 
     291(see the dashed area in \autoref{fig:DOM_index_hor}). 
     292A $t$-point and its nearest north-east $f$-point have the same $i$-and $j$-indices. 
    248293 
    249294% ----------------------------------- 
    250 %        Vertical indexing  
     295%        Vertical indexing 
    251296% ----------------------------------- 
    252297\subsubsection{Vertical indexing} 
    253298\label{subsec:DOM_Num_Index_vertical} 
    254299 
    255 In the vertical, the chosen indexing requires special attention since the $k$-axis is re-orientated downward in 
    256 the \fortran code compared to the indexing used in the semi -discrete equations and 
     300In the vertical, the chosen indexing requires special attention since the direction of the $k$-axis in 
     301the \fortran\ code is the reverse of that used in the semi -discrete equations and 
    257302given in \autoref{subsec:DOM_cell}. 
    258 The sea surface corresponds to the $w$-level $k = 1$ which is the same index as $t$-level just below 
    259 (\autoref{fig:index_vert}). 
    260 The last $w$-level ($k = jpk$) either corresponds to the ocean floor or is inside the bathymetry while 
    261 the last $t$-level is always inside the bathymetry (\autoref{fig:index_vert}). 
    262 Note that for an increasing $k$ index, a $w$-point and the $t$-point just below have the same $k$ index, 
    263 in opposition to what is done in the horizontal plane where 
    264 it is the $t$-point and the nearest velocity points in the direction of the horizontal axis that 
    265 have the same $i$ or $j$ index 
    266 (compare the dashed area in \autoref{fig:index_hor} and \autoref{fig:index_vert}). 
     303The sea surface corresponds to the $w$-level $k = 1$, which is the same index as the $t$-level just below 
     304(\autoref{fig:DOM_index_vert}). 
     305The last $w$-level ($k = jpk$) either corresponds to or is below the ocean floor while 
     306the last $t$-level is always outside the ocean domain (\autoref{fig:DOM_index_vert}). 
     307Note that a $w$-point and the directly underlaying $t$-point have a common $k$ index 
     308(\ie\ $t$-points and their nearest $w$-point neighbour in negative index direction), 
     309in contrast to the indexing on the horizontal plane where the $t$-point has the same index as 
     310the nearest velocity points in the positive direction of the respective horizontal axis index 
     311(compare the dashed area in \autoref{fig:DOM_index_hor} and \autoref{fig:DOM_index_vert}). 
    267312Since the scale factors are chosen to be strictly positive, 
    268 a \textit{minus sign} appears in the \fortran code \textit{before all the vertical derivatives} of 
    269 the discrete equations given in this documentation. 
     313a \textit{minus sign} is included in the \fortran\ implementations of 
     314\textit{all the vertical derivatives} of the discrete equations given in this manual in order to 
     315accommodate the opposing vertical index directions in implementation and documentation. 
    270316 
    271317%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    272318\begin{figure}[!pt] 
    273   \begin{center} 
    274     \includegraphics[]{Fig_index_vert} 
    275     \caption{ 
    276       \protect\label{fig:index_vert} 
    277       Vertical integer indexing used in the \fortran code. 
    278       Note that the $k$-axis is orientated downward. 
    279       The dashed area indicates the cell in which variables contained in arrays have the same $k$-index. 
    280     } 
    281   \end{center} 
     319  \centering 
     320  \includegraphics[width=\textwidth]{Fig_index_vert} 
     321  \caption[Vertical integer indexing]{ 
     322    Vertical integer indexing used in the \fortran\ code. 
     323    Note that the $k$-axis is oriented downward. 
     324    The dashed area indicates the cell in which 
     325    variables contained in arrays have a common $k$-index.} 
     326  \label{fig:DOM_index_vert} 
    282327\end{figure} 
    283328%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     329 
     330% ------------------------------------------------------------------------------------------------------------- 
     331%        Domain configuration 
     332% ------------------------------------------------------------------------------------------------------------- 
     333\section{Spatial domain configuration} 
     334\label{subsec:DOM_config} 
     335 
     336Two typical methods are available to specify the spatial domain configuration; 
     337they can be selected using parameter \np{ln\_read\_cfg} parameter in namelist \nam{cfg}. 
     338 
     339If \np{ln\_read\_cfg} is set to \forcode{.true.}, 
     340the domain-specific parameters and fields are read from a netCDF input file, 
     341whose name (without its .nc suffix) can be specified as the value of the \np{cn\_domcfg} parameter in namelist \nam{cfg}. 
     342 
     343If \np{ln\_read\_cfg} is set to \forcode{.false.}, 
     344the domain-specific parameters and fields can be provided (\eg\ analytically computed) by 
     345subroutines \mdl{usrdef\_hgr} and \mdl{usrdef\_zgr}. 
     346These subroutines can be supplied in the \path{MY_SRC} directory of the configuration, 
     347and default versions that configure the spatial domain for the GYRE reference configuration are present in 
     348the \path{./src/OCE/USR} directory. 
     349 
     350In version 4.0 there are no longer any options for reading complex bathymetries and 
     351performing a vertical discretisation at run-time. 
     352Whilst it is occasionally convenient to have a common bathymetry file and, for example, 
     353to run similar models with and without partial bottom boxes and/or sigma-coordinates, 
     354supporting such choices leads to overly complex code. 
     355Worse still is the difficulty of ensuring the model configurations intended to be identical are indeed so when 
     356the model domain itself can be altered by runtime selections. 
     357The code previously used to perform vertical discretisation has been incorporated into an external tool 
     358(\path{./tools/DOMAINcfg}) which is briefly described in \autoref{apdx:DOMCFG}. 
     359 
     360The next subsections summarise the parameter and fields related to the configuration of the whole model domain. 
     361These represent the minimum information that must be provided either via the \np{cn\_domcfg} file or set by code 
     362inserted into user-supplied versions of the \texttt{usrdef\_*} subroutines. 
     363The requirements are presented in three sections: 
     364the domain size (\autoref{subsec:DOM_size}), the horizontal mesh (\autoref{subsec:DOM_hgr}), 
     365and the vertical grid (\autoref{subsec:DOM_zgr}). 
    284366 
    285367% ----------------------------------- 
    286368%        Domain Size 
    287369% ----------------------------------- 
    288 \subsubsection{Domain size} 
     370\subsection{Domain size} 
    289371\label{subsec:DOM_size} 
    290372 
    291 The total size of the computational domain is set by the parameters \np{jpiglo}, 
    292 \np{jpjglo} and \np{jpkglo} in the $i$, $j$ and $k$ directions respectively. 
    293 Parameters $jpi$ and $jpj$ refer to the size of each processor subdomain when 
     373The total size of the computational domain is set by the parameters \jp{jpiglo}, \jp{jpjglo} and \jp{jpkglo} for 
     374the $i$, $j$ and $k$ directions, respectively. 
     375Note, that the variables \texttt{jpi} and \texttt{jpj} refer to the size of each processor subdomain when 
    294376the code is run in parallel using domain decomposition (\key{mpp\_mpi} defined, 
    295377see \autoref{sec:LBC_mpp}). 
    296378 
    297 % ================================================================ 
    298 % Domain: List of fields needed 
    299 % ================================================================ 
    300 \section{Needed fields} 
    301 \label{sec:DOM_fields} 
    302 The ocean mesh (\ie the position of all the scalar and vector points) is defined by the transformation that 
    303 gives $(\lambda,\varphi,z)$ as a function of $(i,j,k)$. 
    304 The grid-points are located at integer or integer and a half values of as indicated in \autoref{tab:cell}. 
    305 The associated scale factors are defined using the analytical first derivative of the transformation 
    306 \autoref{eq:scale_factors}. 
    307 Necessary fields for configuration definition are: 
     379The name of the configuration is set through parameter \np{cn\_cfg}, 
     380and the nominal resolution through parameter \np{nn\_cfg} 
     381(unless in the input file both of variables \texttt{ORCA} and \texttt{ORCA\_index} are present, 
     382in which case \np{cn\_cfg} and \np{nn\_cfg} are set from these values accordingly). 
     383 
     384The global lateral boundary condition type is selected from 8 options using parameter \jp{jperio}. 
     385See \autoref{sec:LBC_jperio} for details on the available options and the corresponding values for \jp{jperio}. 
     386 
     387% ================================================================ 
     388% Domain: Horizontal Grid (mesh) 
     389% ================================================================ 
     390\subsection{Horizontal grid mesh (\protect\mdl{domhgr})} 
     391\label{subsec:DOM_hgr} 
     392 
     393% ================================================================ 
     394% Domain: List of hgr-related fields needed 
     395% ================================================================ 
     396\subsubsection{Required fields} 
     397\label{sec:DOM_hgr_fields} 
     398 
     399The explicit specification of a range of mesh-related fields are required for the definition of a configuration. 
     400These include: 
     401 
     402\begin{clines} 
     403int    jpiglo, jpjglo, jpkglo            /* global domain sizes                                          */ 
     404int    jperio                            /* lateral global domain b.c.                                   */ 
     405double glamt, glamu, glamv, glamf        /* geographic longitude (t,u,v and f points respectively)       */ 
     406double gphit, gphiu, gphiv, gphif        /* geographic latitude                                          */ 
     407double e1t, e1u, e1v, e1f                /* horizontal scale factors                                     */ 
     408double e2t, e2u, e2v, e2f                /* horizontal scale factors                                     */ 
     409\end{clines} 
     410 
     411The values of the geographic longitude and latitude arrays at indices $i,j$ correspond to 
     412the analytical expressions of the longitude $\lambda$ and latitude $\varphi$ as a function of $(i,j)$, 
     413evaluated at the values as specified in \autoref{tab:DOM_cell} for the respective grid-point position. 
     414The calculation of the values of the horizontal scale factor arrays in general additionally involves 
     415partial derivatives of $\lambda$ and $\varphi$ with respect to $i$ and $j$, 
     416evaluated for the same arguments as $\lambda$ and $\varphi$. 
     417 
     418\subsubsection{Optional fields} 
     419 
     420\begin{clines} 
     421                                         /* Optional:                                                    */ 
     422int    ORCA, ORCA_index                  /* configuration name, configuration resolution                 */ 
     423double e1e2u, e1e2v                      /* U and V surfaces (if grid size reduction in some straits)    */ 
     424double ff_f, ff_t                        /* Coriolis parameter (if not on the sphere)                    */ 
     425\end{clines} 
     426 
     427\NEMO\ can support the local reduction of key strait widths by 
     428altering individual values of e2u or e1v at the appropriate locations. 
     429This is particularly useful for locations such as Gibraltar or Indonesian Throughflow pinch-points 
     430(see \autoref{sec:MISC_strait} for illustrated examples). 
     431The key is to reduce the faces of $T$-cell (\ie\ change the value of the horizontal scale factors at $u$- or $v$-point) but 
     432not the volume of the cells. 
     433Doing otherwise can lead to numerical instability issues. 
     434In normal operation the surface areas are computed from $e1u * e2u$ and $e1v * e2v$ but 
     435in cases where a gridsize reduction is required, 
     436the unaltered surface areas at $u$ and $v$ grid points (\texttt{e1e2u} and \texttt{e1e2v}, respectively) must be read or 
     437pre-computed in \mdl{usrdef\_hgr}. 
     438If these arrays are present in the \np{cn\_domcfg} file they are read and the internal computation is suppressed. 
     439Versions of \mdl{usrdef\_hgr} which set their own values of \texttt{e1e2u} and \texttt{e1e2v} should set 
     440the surface-area computation flag: 
     441\texttt{ie1e2u\_v} to a non-zero value to suppress their re-computation. 
     442 
     443\smallskip 
     444Similar logic applies to the other optional fields: 
     445\texttt{ff\_f} and \texttt{ff\_t} which can be used to provide the Coriolis parameter at F- and T-points respectively if 
     446the mesh is not on a sphere. 
     447If present these fields will be read and used and the normal calculation ($2 * \Omega * \sin(\varphi)$) suppressed. 
     448Versions of \mdl{usrdef\_hgr} which set their own values of \texttt{ff\_f} and \texttt{ff\_t} should set 
     449the Coriolis computation flag: 
     450\texttt{iff} to a non-zero value to suppress their re-computation. 
     451 
     452Note that longitudes, latitudes, and scale factors at $w$ points are exactly equal to those of $t$ points, 
     453thus no specific arrays are defined at $w$ points. 
     454 
     455 
     456% ================================================================ 
     457% Domain: Vertical Grid (domzgr) 
     458% ================================================================ 
     459\subsection[Vertical grid (\textit{domzgr.F90})] 
     460{Vertical grid (\protect\mdl{domzgr})} 
     461\label{subsec:DOM_zgr} 
     462%-----------------------------------------namdom------------------------------------------- 
     463\begin{listing} 
     464  \nlst{namdom} 
     465  \caption{\texttt{namdom}} 
     466  \label{lst:namdom} 
     467\end{listing} 
     468%------------------------------------------------------------------------------------------------------------- 
     469 
     470In the vertical, the model mesh is determined by four things: 
     471\begin{enumerate} 
     472  \item the bathymetry given in meters; 
     473  \item the number of levels of the model (\jp{jpk}); 
     474  \item the analytical transformation $z(i,j,k)$ and the vertical scale factors (derivatives of the transformation); and 
     475  \item the masking system, \ie\ the number of wet model levels at each 
     476$(i,j)$ location of the horizontal grid. 
     477\end{enumerate} 
     478 
     479%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     480\begin{figure}[!tb] 
     481  \centering 
     482  \includegraphics[width=\textwidth]{Fig_z_zps_s_sps} 
     483  \caption[Ocean bottom regarding coordinate systems ($z$, $s$ and hybrid $s-z$)]{ 
     484    The ocean bottom as seen by the model: 
     485    (a) $z$-coordinate with full step, 
     486    (b) $z$-coordinate with partial step, 
     487    (c) $s$-coordinate: terrain following representation, 
     488    (d) hybrid $s-z$ coordinate, 
     489    (e) hybrid $s-z$ coordinate with partial step, and 
     490    (f) same as (e) but in the non-linear free surface (\protect\np{ln\_linssh}\forcode{=.false.}). 
     491    Note that the non-linear free surface can be used with any of the 5 coordinates (a) to (e).} 
     492  \label{fig:DOM_z_zps_s_sps} 
     493\end{figure} 
     494%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     495 
     496The choice of a vertical coordinate is made when setting up the configuration; 
     497it is not intended to be an option which can be changed in the middle of an experiment. 
     498The one exception to this statement being the choice of linear or non-linear free surface. 
     499In v4.0 the linear free surface option is implemented as a special case of the non-linear free surface. 
     500This is computationally wasteful since it uses the structures for time-varying 3D metrics 
     501for fields that (in the linear free surface case) are fixed. 
     502However, the linear free-surface is rarely used and implementing it this way means 
     503a single configuration file can support both options. 
     504 
     505By default a non-linear free surface is used (\np{ln\_linssh} set to \forcode{=.false.} in \nam{dom}): 
     506the coordinate follow the time-variation of the free surface so that the transformation is time dependent: 
     507$z(i,j,k,t)$ (\eg\ \autoref{fig:DOM_z_zps_s_sps}f). 
     508When a linear free surface is assumed (\np{ln\_linssh} set to \forcode{=.true.} in \nam{dom}), 
     509the vertical coordinates are fixed in time, but the seawater can move up and down across the $z_0$ surface 
     510(in other words, the top of the ocean in not a rigid lid). 
     511 
     512Note that settings: 
     513\np{ln\_zco}, \np{ln\_zps}, \np{ln\_sco} and \np{ln\_isfcav} mentioned in the following sections 
     514appear to be namelist options but they are no longer truly namelist options for \NEMO. 
     515Their value is written to and read from the domain configuration file and 
     516they should be treated as fixed parameters for a particular configuration. 
     517They are namelist options for the \texttt{DOMAINcfg} tool that can be used to build the configuration file and 
     518serve both to provide a record of the choices made whilst building the configuration and 
     519to trigger appropriate code blocks within \NEMO. 
     520These values should not be altered in the \np{cn\_domcfg} file. 
     521 
     522\medskip 
     523The decision on these choices must be made when the \np{cn\_domcfg} file is constructed. 
     524Three main choices are offered (\autoref{fig:DOM_z_zps_s_sps}a-c): 
    308525 
    309526\begin{itemize} 
    310 \item 
    311   Geographic position: 
    312   longitude with \texttt{glamt}, \texttt{glamu}, \texttt{glamv}, \texttt{glamf} and 
    313   latitude  with \texttt{gphit}, \texttt{gphiu}, \texttt{gphiv}, \texttt{gphif} 
    314   (all respectively at T, U, V and F point) 
    315 \item 
    316   Coriolis parameter (if domain not on the sphere): \texttt{ff\_f} and \texttt{ff\_t} 
    317   (at T and F point) 
    318 \item 
    319   Scale factors: 
    320   \texttt{e1t}, \texttt{e1u}, \texttt{e1v} and \texttt{e1f} (on i direction), 
    321   \texttt{e2t}, \texttt{e2u}, \texttt{e2v} and \texttt{e2f} (on j direction) and 
    322   \texttt{ie1e2u\_v}, \texttt{e1e2u}, \texttt{e1e2v}. \\ 
    323   \texttt{e1e2u}, \texttt{e1e2v} are u and v surfaces (if gridsize reduction in some straits),  
    324   \texttt{ie1e2u\_v} is to flag set u and v surfaces are neither read nor computed. 
     527\item $z$-coordinate with full step bathymetry (\np{ln\_zco}\forcode{=.true.}), 
     528\item $z$-coordinate with partial step ($zps$) bathymetry (\np{ln\_zps}\forcode{=.true.}), 
     529\item Generalized, $s$-coordinate (\np{ln\_sco}\forcode{=.true.}). 
    325530\end{itemize} 
    326   
    327 These fields can be read in an domain input file which name is setted in \np{cn\_domcfg} parameter specified in 
    328 \ngn{namcfg}. 
    329  
    330 \nlst{namcfg} 
    331  
    332 Or they can be defined in an analytical way in \path{MY_SRC} directory of the configuration. 
    333 For Reference Configurations of NEMO input domain files are supplied by NEMO System Team. 
    334 For analytical definition of input fields two routines are supplied: \mdl{usrdef\_hgr} and \mdl{usrdef\_zgr}. 
    335 They are an example of GYRE configuration parameters, and they are available in \path{src/OCE/USR} directory, 
    336 they provide the horizontal and vertical mesh. 
    337 % ------------------------------------------------------------------------------------------------------------- 
    338 %        Needed fields  
    339 % ------------------------------------------------------------------------------------------------------------- 
    340 %\subsection{List of needed fields to build DOMAIN} 
    341 %\label{subsec:DOM_fields_list} 
    342  
    343  
    344 % ================================================================ 
    345 % Domain: Horizontal Grid (mesh)  
    346 % ================================================================ 
    347 \section{Horizontal grid mesh (\protect\mdl{domhgr})} 
    348 \label{sec:DOM_hgr} 
    349  
    350 % ------------------------------------------------------------------------------------------------------------- 
    351 %        Coordinates and scale factors  
    352 % ------------------------------------------------------------------------------------------------------------- 
    353 \subsection{Coordinates and scale factors} 
    354 \label{subsec:DOM_hgr_coord_e} 
    355  
    356 The ocean mesh (\ie the position of all the scalar and vector points) is defined by 
    357 the transformation that gives $(\lambda,\varphi,z)$ as a function of $(i,j,k)$. 
    358 The grid-points are located at integer or integer and a half values of as indicated in \autoref{tab:cell}. 
    359 The associated scale factors are defined using the analytical first derivative of the transformation 
    360 \autoref{eq:scale_factors}. 
    361 These definitions are done in two modules, \mdl{domhgr} and \mdl{domzgr}, 
    362 which provide the horizontal and vertical meshes, respectively. 
    363 This section deals with the horizontal mesh parameters. 
    364  
    365 In a horizontal plane, the location of all the model grid points is defined from 
    366 the analytical expressions of the longitude $\lambda$ and latitude $\varphi$ as a function of $(i,j)$. 
    367 The horizontal scale factors are calculated using \autoref{eq:scale_factors}. 
    368 For example, when the longitude and latitude are function of a single value 
    369 ($i$ and $j$, respectively) (geographical configuration of the mesh), 
    370 the horizontal mesh definition reduces to define the wanted $\lambda(i)$, $\varphi(j)$, 
    371 and their derivatives $\lambda'(i) \ \varphi'(j)$ in the \mdl{domhgr} module. 
    372 The model computes the grid-point positions and scale factors in the horizontal plane as follows: 
    373 \begin{align*} 
    374    \lambda_t &\equiv \text{glamt} =      \lambda (i      ) 
    375   &\varphi_t &\equiv \text{gphit} =      \varphi (j      ) \\ 
    376    \lambda_u &\equiv \text{glamu} =      \lambda (i + 1/2) 
    377   &\varphi_u &\equiv \text{gphiu} =      \varphi (j      ) \\ 
    378    \lambda_v &\equiv \text{glamv} =      \lambda (i      ) 
    379   &\varphi_v &\equiv \text{gphiv} =      \varphi (j + 1/2) \\ 
    380    \lambda_f &\equiv \text{glamf} =      \lambda (i + 1/2) 
    381   &\varphi_f &\equiv \text{gphif} =      \varphi (j + 1/2) \\ 
    382    e_{1t}    &\equiv \text{e1t}   = r_a |\lambda'(i      ) \; \cos\varphi(j      ) | 
    383   &e_{2t}    &\equiv \text{e2t}   = r_a |\varphi'(j      )                         | \\ 
    384    e_{1u}    &\equiv \text{e1t}   = r_a |\lambda'(i + 1/2) \; \cos\varphi(j      ) | 
    385   &e_{2u}    &\equiv \text{e2t}   = r_a |\varphi'(j      )                         | \\ 
    386    e_{1v}    &\equiv \text{e1t}   = r_a |\lambda'(i      ) \; \cos\varphi(j + 1/2) | 
    387   &e_{2v}    &\equiv \text{e2t}   = r_a |\varphi'(j + 1/2)                         | \\ 
    388    e_{1f}    &\equiv \text{e1t}   = r_a |\lambda'(i + 1/2) \; \cos\varphi(j + 1/2) | 
    389   &e_{2f}    &\equiv \text{e2t}   = r_a |\varphi'(j + 1/2)                         | 
    390 \end{align*} 
    391 where the last letter of each computational name indicates the grid point considered and 
    392 $r_a$ is the earth radius (defined in \mdl{phycst} along with all universal constants). 
    393 Note that the horizontal position of and scale factors at $w$-points are exactly equal to those of $t$-points, 
    394 thus no specific arrays are defined at $w$-points. 
    395  
    396 Note that the definition of the scale factors 
    397 (\ie as the analytical first derivative of the transformation that 
    398 gives $(\lambda,\varphi,z)$ as a function of $(i,j,k)$) 
    399 is specific to the \NEMO model \citep{Marti_al_JGR92}. 
    400 As an example, $e_{1t}$ is defined locally at a $t$-point, 
    401 whereas many other models on a C grid choose to define such a scale factor as 
    402 the distance between the $U$-points on each side of the $t$-point. 
    403 Relying on an analytical transformation has two advantages: 
    404 firstly, there is no ambiguity in the scale factors appearing in the discrete equations, 
    405 since they are first introduced in the continuous equations; 
    406 secondly, analytical transformations encourage good practice by the definition of smoothly varying grids 
    407 (rather than allowing the user to set arbitrary jumps in thickness between adjacent layers) \citep{Treguier1996}. 
    408 An example of the effect of such a choice is shown in \autoref{fig:zgr_e3}. 
    409 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    410 \begin{figure}[!t] 
    411   \begin{center} 
    412     \includegraphics[]{Fig_zgr_e3} 
    413     \caption{ 
    414       \protect\label{fig:zgr_e3} 
    415       Comparison of (a) traditional definitions of grid-point position and grid-size in the vertical, 
    416       and (b) analytically derived grid-point position and scale factors. 
    417       For both grids here, the same $w$-point depth has been chosen but 
    418       in (a) the $t$-points are set half way between $w$-points while 
    419       in (b) they are defined from an analytical function: 
    420       $z(k) = 5 \, (k - 1/2)^3 - 45 \, (k - 1/2)^2 + 140 \, (k - 1/2) - 150$. 
    421       Note the resulting difference between the value of the grid-size $\Delta_k$ and 
    422       those of the scale factor $e_k$. 
    423     } 
    424   \end{center} 
    425 \end{figure} 
    426 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    427  
    428 % ------------------------------------------------------------------------------------------------------------- 
    429 %        Choice of horizontal grid 
    430 % ------------------------------------------------------------------------------------------------------------- 
    431 \subsection{Choice of horizontal grid} 
    432 \label{subsec:DOM_hgr_msh_choice} 
    433  
    434 % ------------------------------------------------------------------------------------------------------------- 
    435 %        Grid files 
    436 % ------------------------------------------------------------------------------------------------------------- 
    437 \subsection{Output grid files} 
    438 \label{subsec:DOM_hgr_files} 
    439  
    440 All the arrays relating to a particular ocean model configuration (grid-point position, scale factors, masks) 
    441 can be saved in files if \np{nn\_msh} $\not = 0$ (namelist variable in \ngn{namdom}). 
    442 This can be particularly useful for plots and off-line diagnostics. 
    443 In some cases, the user may choose to make a local modification of a scale factor in the code. 
    444 This is the case in global configurations when restricting the width of a specific strait 
    445 (usually a one-grid-point strait that happens to be too wide due to insufficient model resolution). 
    446 An example is Gibraltar Strait in the ORCA2 configuration. 
    447 When such modifications are done, 
    448 the output grid written when \np{nn\_msh} $\not = 0$ is no more equal to the input grid. 
    449  
    450 % ================================================================ 
    451 % Domain: Vertical Grid (domzgr) 
    452 % ================================================================ 
    453 \section{Vertical grid (\protect\mdl{domzgr})} 
    454 \label{sec:DOM_zgr} 
    455 %-----------------------------------------nam_zgr & namdom------------------------------------------- 
    456 % 
    457 %\nlst{namzgr}  
    458  
    459 \nlst{namdom}  
    460 %------------------------------------------------------------------------------------------------------------- 
    461  
    462 Variables are defined through the \ngn{namzgr} and \ngn{namdom} namelists. 
    463 In the vertical, the model mesh is determined by four things:  
    464 (1) the bathymetry given in meters;  
    465 (2) the number of levels of the model (\jp{jpk});  
    466 (3) the analytical transformation $z(i,j,k)$ and the vertical scale factors (derivatives of the transformation); and 
    467 (4) the masking system, \ie the number of wet model levels at each  
    468 $(i,j)$ column of points. 
    469  
    470 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    471 \begin{figure}[!tb] 
    472   \begin{center} 
    473     \includegraphics[]{Fig_z_zps_s_sps} 
    474     \caption{ 
    475       \protect\label{fig:z_zps_s_sps} 
    476       The ocean bottom as seen by the model: 
    477       (a) $z$-coordinate with full step, 
    478       (b) $z$-coordinate with partial step, 
    479       (c) $s$-coordinate: terrain following representation, 
    480       (d) hybrid $s-z$ coordinate, 
    481       (e) hybrid $s-z$ coordinate with partial step, and 
    482       (f) same as (e) but in the non-linear free surface (\protect\np{ln\_linssh}~\forcode{= .false.}). 
    483       Note that the non-linear free surface can be used with any of the 5 coordinates (a) to (e). 
    484     } 
    485   \end{center} 
    486 \end{figure} 
    487 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    488  
    489 The choice of a vertical coordinate, even if it is made through \ngn{namzgr} namelist parameters,  
    490 must be done once of all at the beginning of an experiment. 
    491 It is not intended as an option which can be enabled or disabled in the middle of an experiment. 
    492 Three main choices are offered (\autoref{fig:z_zps_s_sps}): 
    493 $z$-coordinate with full step bathymetry (\np{ln\_zco}~\forcode{= .true.}), 
    494 $z$-coordinate with partial step bathymetry (\np{ln\_zps}~\forcode{= .true.}), 
    495 or generalized, $s$-coordinate (\np{ln\_sco}~\forcode{= .true.}). 
    496 Hybridation of the three main coordinates are available: 
    497 $s-z$ or $s-zps$ coordinate (\autoref{fig:z_zps_s_sps} and \autoref{fig:z_zps_s_sps}). 
    498 By default a non-linear free surface is used: the coordinate follow the time-variation of the free surface so that 
    499 the transformation is time dependent: $z(i,j,k,t)$ (\autoref{fig:z_zps_s_sps}). 
    500 When a linear free surface is assumed (\np{ln\_linssh}~\forcode{= .true.}), 
    501 the vertical coordinate are fixed in time, but the seawater can move up and down across the $z_0$ surface 
    502 (in other words, the top of the ocean in not a rigid-lid). 
    503 The last choice in terms of vertical coordinate concerns the presence (or not) in 
    504 the model domain of ocean cavities beneath ice shelves. 
    505 Setting \np{ln\_isfcav} to true allows to manage ocean cavities, otherwise they are filled in. 
    506 This option is currently only available in $z$- or $zps$-coordinate, 
    507 and partial step are also applied at the ocean/ice shelf interface. 
    508  
    509 Contrary to the horizontal grid, the vertical grid is computed in the code and no provision is made for 
    510 reading it from a file. 
    511 The only input file is the bathymetry (in meters) (\ifile{bathy\_meter}) 
    512 \footnote{ 
    513   N.B. in full step $z$-coordinate, a \ifile{bathy\_level} file can replace the \ifile{bathy\_meter} file, 
    514   so that the computation of the number of wet ocean point in each water column is by-passed}. 
    515 If \np{ln\_isfcav}~\forcode{= .true.}, an extra file input file (\ifile{isf\_draft\_meter}) describing 
    516 the ice shelf draft (in meters) is needed. 
    517  
    518 After reading the bathymetry, the algorithm for vertical grid definition differs between the different options: 
    519 \begin{description} 
    520 \item[\textit{zco}] 
    521   set a reference coordinate transformation $z_0(k)$, and set $z(i,j,k,t) = z_0(k)$. 
    522 \item[\textit{zps}] 
    523   set a reference coordinate transformation $z_0(k)$, and calculate the thickness of the deepest level at 
    524   each $(i,j)$ point using the bathymetry, to obtain the final three-dimensional depth and scale factor arrays. 
    525 \item[\textit{sco}] 
    526   smooth the bathymetry to fulfill the hydrostatic consistency criteria and 
    527   set the three-dimensional transformation. 
    528 \item[\textit{s-z} and \textit{s-zps}] 
    529   smooth the bathymetry to fulfill the hydrostatic consistency criteria and 
    530   set the three-dimensional transformation $z(i,j,k)$, 
    531   and possibly introduce masking of extra land points to better fit the original bathymetry file. 
    532 \end{description} 
    533 %%% 
    534 \gmcomment{   add the description of the smoothing:  envelop topography...} 
    535 %%% 
    536  
    537 Unless a linear free surface is used (\np{ln\_linssh}~\forcode{= .false.}), 
    538 the arrays describing the grid point depths and vertical scale factors are three set of 
     531 
     532Additionally, hybrid combinations of the three main coordinates are available: 
     533$s-z$ or $s-zps$ coordinate (\autoref{fig:DOM_z_zps_s_sps}d and \autoref{fig:DOM_z_zps_s_sps}e). 
     534 
     535A further choice related to vertical coordinate concerns 
     536the presence (or not) of ocean cavities beneath ice shelves within the model domain. 
     537A setting of \np{ln\_isfcav} as \forcode{.true.} indicates that the domain contains ocean cavities, 
     538otherwise the top, wet layer of the ocean will always be at the ocean surface. 
     539This option is currently only available for $z$- or $zps$-coordinates. 
     540In the latter case, partial steps are also applied at the ocean/ice shelf interface. 
     541 
     542Within the model, the arrays describing the grid point depths and vertical scale factors are three set of 
    539543three dimensional arrays $(i,j,k)$ defined at \textit{before}, \textit{now} and \textit{after} time step. 
    540544The time at which they are defined is indicated by a suffix: $\_b$, $\_n$, or $\_a$, respectively. 
    541 They are updated at each model time step using a fixed reference coordinate system which 
    542 computer names have a $\_0$ suffix. 
    543 When the linear free surface option is used (\np{ln\_linssh}~\forcode{= .true.}), \textit{before}, 
    544 \textit{now} and \textit{after} arrays are simply set one for all to their reference counterpart. 
    545  
    546 % ------------------------------------------------------------------------------------------------------------- 
    547 %        Meter Bathymetry 
    548 % ------------------------------------------------------------------------------------------------------------- 
    549 \subsection{Meter bathymetry} 
    550 \label{subsec:DOM_bathy} 
    551  
    552 Three options are possible for defining the bathymetry, according to the namelist variable \np{nn\_bathy} 
    553 (found in \ngn{namdom} namelist):  
    554 \begin{description} 
    555 \item[\np{nn\_bathy}~\forcode{= 0}]: 
    556   a flat-bottom domain is defined. 
    557   The total depth $z_w (jpk)$ is given by the coordinate transformation. 
    558   The domain can either be a closed basin or a periodic channel depending on the parameter \np{jperio}. 
    559 \item[\np{nn\_bathy}~\forcode{= -1}]: 
    560   a domain with a bump of topography one third of the domain width at the central latitude. 
    561   This is meant for the "EEL-R5" configuration, a periodic or open boundary channel with a seamount. 
    562 \item[\np{nn\_bathy}~\forcode{= 1}]: 
    563   read a bathymetry and ice shelf draft (if needed). 
    564   The \ifile{bathy\_meter} file (Netcdf format) provides the ocean depth (positive, in meters) at 
    565   each grid point of the model grid. 
    566   The bathymetry is usually built by interpolating a standard bathymetry product (\eg ETOPO2) onto 
    567   the horizontal ocean mesh. 
    568   Defining the bathymetry also defines the coastline: where the bathymetry is zero, 
    569   no model levels are defined (all levels are masked). 
    570  
    571   The \ifile{isfdraft\_meter} file (Netcdf format) provides the ice shelf draft (positive, in meters) at 
    572   each grid point of the model grid. 
    573   This file is only needed if \np{ln\_isfcav}~\forcode{= .true.}. 
    574   Defining the ice shelf draft will also define the ice shelf edge and the grounding line position. 
    575 \end{description} 
    576  
    577 When a global ocean is coupled to an atmospheric model it is better to represent all large water bodies 
    578 (\eg great lakes, Caspian sea...) even if the model resolution does not allow their communication with 
    579 the rest of the ocean. 
    580 This is unnecessary when the ocean is forced by fixed atmospheric conditions, 
    581 so these seas can be removed from the ocean domain. 
    582 The user has the option to set the bathymetry in closed seas to zero (see \autoref{sec:MISC_closea}), 
    583 but the code has to be adapted to the user's configuration. 
    584  
    585 % ------------------------------------------------------------------------------------------------------------- 
    586 %        z-coordinate  and reference coordinate transformation 
    587 % ------------------------------------------------------------------------------------------------------------- 
    588 \subsection[$Z$-coordinate (\protect\np{ln\_zco}~\forcode{= .true.}) and ref. coordinate] 
    589             {$Z$-coordinate (\protect\np{ln\_zco}~\forcode{= .true.}) and reference coordinate} 
    590 \label{subsec:DOM_zco} 
    591  
    592 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    593 \begin{figure}[!tb] 
    594   \begin{center} 
    595     \includegraphics[]{Fig_zgr} 
    596     \caption{ 
    597       \protect\label{fig:zgr} 
    598       Default vertical mesh for ORCA2: 30 ocean levels (L30). 
    599       Vertical level functions for (a) T-point depth and (b) the associated scale factor as computed from 
    600       \autoref{eq:DOM_zgr_ana_1} using \autoref{eq:DOM_zgr_coef} in $z$-coordinate. 
    601     } 
    602   \end{center} 
    603 \end{figure} 
    604 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    605  
    606 The reference coordinate transformation $z_0(k)$ defines the arrays $gdept_0$ and $gdepw_0$ for $t$- and $w$-points, 
    607 respectively. 
    608 As indicated on \autoref{fig:index_vert} \jp{jpk} is the number of $w$-levels. 
    609 $gdepw_0(1)$ is the ocean surface. 
    610 There are at most \jp{jpk}-1 $t$-points inside the ocean, 
    611 the additional $t$-point at $jk = jpk$ is below the sea floor and is not used. 
    612 The vertical location of $w$- and $t$-levels is defined from the analytic expression of the depth $z_0(k)$ whose 
    613 analytical derivative with respect to $k$ provides the vertical scale factors. 
    614 The user must provide the analytical expression of both $z_0$ and its first derivative with respect to $k$. 
    615 This is done in routine \mdl{domzgr} through statement functions, 
    616 using parameters provided in the \ngn{namcfg} namelist. 
    617  
    618 It is possible to define a simple regular vertical grid by giving zero stretching (\np{ppacr}~\forcode{= 0}). 
    619 In that case, the parameters \jp{jpk} (number of $w$-levels) and 
    620 \np{pphmax} (total ocean depth in meters) fully define the grid. 
    621  
    622 For climate-related studies it is often desirable to concentrate the vertical resolution near the ocean surface. 
    623 The following function is proposed as a standard for a $z$-coordinate (with either full or partial steps):  
    624 \begin{gather} 
    625   \label{eq:DOM_zgr_ana_1} 
    626     z_0  (k) = h_{sur} - h_0 \; k - \; h_1 \; \log  \big[ \cosh ((k - h_{th}) / h_{cr}) \big] \\ 
    627     e_3^0(k) = \lt|    - h_0      -    h_1 \; \tanh \big[        (k - h_{th}) / h_{cr}  \big] \rt| 
    628 \end{gather} 
    629 where $k = 1$ to \jp{jpk} for $w$-levels and $k = 1$ to $k = 1$ for $T-$levels. 
    630 Such an expression allows us to define a nearly uniform vertical location of levels at the ocean top and bottom with 
    631 a smooth hyperbolic tangent transition in between (\autoref{fig:zgr}). 
    632  
    633 If the ice shelf cavities are opened (\np{ln\_isfcav}~\forcode{= .true.}), the definition of $z_0$ is the same. 
    634 However, definition of $e_3^0$ at $t$- and $w$-points is respectively changed to: 
    635 \begin{equation} 
    636   \label{eq:DOM_zgr_ana_2} 
    637   \begin{split} 
    638     e_3^T(k) &= z_W (k + 1) - z_W (k    ) \\ 
    639     e_3^W(k) &= z_T (k    ) - z_T (k - 1) 
    640   \end{split} 
    641 \end{equation} 
    642 This formulation decrease the self-generated circulation into the ice shelf cavity  
    643 (which can, in extreme case, leads to blow up).\\ 
    644   
    645 The most used vertical grid for ORCA2 has $10~m$ ($500~m$) resolution in the surface (bottom) layers and 
    646 a depth which varies from 0 at the sea surface to a minimum of $-5000~m$. 
    647 This leads to the following conditions: 
    648 \begin{equation} 
    649   \label{eq:DOM_zgr_coef} 
    650   \begin{array}{ll} 
    651     e_3 (1   + 1/2) =  10. & z(1  ) =     0. \\ 
    652     e_3 (jpk - 1/2) = 500. & z(jpk) = -5000. 
    653   \end{array} 
    654 \end{equation} 
    655  
    656 With the choice of the stretching $h_{cr} = 3$ and the number of levels \jp{jpk}~$= 31$, 
    657 the four coefficients $h_{sur}$, $h_0$, $h_1$, and $h_{th}$ in 
    658 \autoref{eq:DOM_zgr_ana_2} have been determined such that 
    659 \autoref{eq:DOM_zgr_coef} is satisfied, through an optimisation procedure using a bisection method. 
    660 For the first standard ORCA2 vertical grid this led to the following values: 
    661 $h_{sur} = 4762.96$, $h_0 = 255.58, h_1 = 245.5813$, and $h_{th} = 21.43336$. 
    662 The resulting depths and scale factors as a function of the model levels are shown in 
    663 \autoref{fig:zgr} and given in \autoref{tab:orca_zgr}. 
    664 Those values correspond to the parameters \np{ppsur}, \np{ppa0}, \np{ppa1}, \np{ppkth} in \ngn{namcfg} namelist. 
    665  
    666 Rather than entering parameters $h_{sur}$, $h_0$, and $h_1$ directly, it is possible to recalculate them. 
    667 In that case the user sets \np{ppsur}~$=$~\np{ppa0}~$=$~\np{ppa1}~$= 999999$., 
    668 in \ngn{namcfg} namelist, and specifies instead the four following parameters: 
    669 \begin{itemize} 
    670 \item 
    671   \np{ppacr}~$= h_{cr}$: stretching factor (nondimensional). 
    672   The larger \np{ppacr}, the smaller the stretching. 
    673   Values from $3$ to $10$ are usual. 
    674 \item 
    675   \np{ppkth}~$= h_{th}$: is approximately the model level at which maximum stretching occurs 
    676   (nondimensional, usually of order 1/2 or 2/3 of \jp{jpk}) 
    677 \item 
    678   \np{ppdzmin}: minimum thickness for the top layer (in meters). 
    679 \item 
    680   \np{pphmax}: total depth of the ocean (meters). 
    681 \end{itemize} 
    682 As an example, for the $45$ layers used in the DRAKKAR configuration those parameters are: 
    683 \jp{jpk}~$= 46$, \np{ppacr}~$= 9$, \np{ppkth}~$= 23.563$, \np{ppdzmin}~$= 6~m$, \np{pphmax}~$= 5750~m$. 
    684  
    685 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    686 \begin{table} 
    687   \begin{center} 
    688     \begin{tabular}{c||r|r|r|r} 
    689       \hline 
    690       \textbf{LEVEL} & \textbf{gdept\_1d} & \textbf{gdepw\_1d} & \textbf{e3t\_1d } & \textbf{e3w\_1d} \\ 
    691       \hline 
    692       1              & \textbf{     5.00} &               0.00 & \textbf{   10.00} &            10.00 \\ 
    693       \hline 
    694       2              & \textbf{    15.00} &              10.00 & \textbf{   10.00} &            10.00 \\ 
    695       \hline 
    696       3              & \textbf{    25.00} &              20.00 & \textbf{   10.00} &            10.00 \\ 
    697       \hline 
    698       4              & \textbf{    35.01} &              30.00 & \textbf{   10.01} &            10.00 \\ 
    699       \hline 
    700       5              & \textbf{    45.01} &              40.01 & \textbf{   10.01} &            10.01 \\ 
    701       \hline 
    702       6              & \textbf{    55.03} &              50.02 & \textbf{   10.02} &            10.02 \\ 
    703       \hline 
    704       7              & \textbf{    65.06} &              60.04 & \textbf{   10.04} &            10.03 \\ 
    705       \hline 
    706       8              & \textbf{    75.13} &              70.09 & \textbf{   10.09} &            10.06 \\ 
    707       \hline 
    708       9              & \textbf{    85.25} &              80.18 & \textbf{   10.17} &            10.12 \\ 
    709       \hline 
    710       10             & \textbf{    95.49} &              90.35 & \textbf{   10.33} &            10.24 \\ 
    711       \hline 
    712       11             & \textbf{   105.97} &             100.69 & \textbf{   10.65} &            10.47 \\ 
    713       \hline 
    714       12             & \textbf{   116.90} &             111.36 & \textbf{   11.27} &            10.91 \\ 
    715       \hline 
    716       13             & \textbf{   128.70} &             122.65 & \textbf{   12.47} &            11.77 \\ 
    717       \hline 
    718       14             & \textbf{   142.20} &             135.16 & \textbf{   14.78} &            13.43 \\ 
    719       \hline 
    720       15             & \textbf{   158.96} &             150.03 & \textbf{   19.23} &            16.65 \\ 
    721       \hline 
    722       16             & \textbf{   181.96} &             169.42 & \textbf{   27.66} &            22.78 \\ 
    723       \hline 
    724       17             & \textbf{   216.65} &             197.37 & \textbf{   43.26} &            34.30 \\ 
    725       \hline 
    726       18             & \textbf{   272.48} &             241.13 & \textbf{   70.88} &            55.21 \\ 
    727       \hline 
    728       19             & \textbf{   364.30} &             312.74 & \textbf{  116.11} &            90.99 \\ 
    729       \hline 
    730       20             & \textbf{   511.53} &             429.72 & \textbf{  181.55} &           146.43 \\ 
    731       \hline 
    732       21             & \textbf{   732.20} &             611.89 & \textbf{  261.03} &           220.35 \\ 
    733       \hline 
    734       22             & \textbf{  1033.22} &             872.87 & \textbf{  339.39} &           301.42 \\ 
    735       \hline 
    736       23             & \textbf{  1405.70} &            1211.59 & \textbf{  402.26} &           373.31 \\ 
    737       \hline 
    738       24             & \textbf{  1830.89} &            1612.98 & \textbf{  444.87} &           426.00 \\ 
    739       \hline 
    740       25             & \textbf{  2289.77} &            2057.13 & \textbf{  470.55} &           459.47 \\ 
    741       \hline 
    742       26             & \textbf{  2768.24} &            2527.22 & \textbf{  484.95} &           478.83 \\ 
    743       \hline 
    744       27             & \textbf{  3257.48} &            3011.90 & \textbf{  492.70} &           489.44 \\ 
    745       \hline 
    746       28             & \textbf{  3752.44} &            3504.46 & \textbf{  496.78} &           495.07 \\ 
    747       \hline 
    748       29             & \textbf{  4250.40} &            4001.16 & \textbf{  498.90} &           498.02 \\ 
    749       \hline 
    750       30             & \textbf{  4749.91} &            4500.02 & \textbf{  500.00} &           499.54 \\ 
    751       \hline 
    752       31             & \textbf{  5250.23} &            5000.00 & \textbf{  500.56} &           500.33 \\ 
    753       \hline 
    754     \end{tabular} 
    755   \end{center} 
    756   \caption{ 
    757     \protect\label{tab:orca_zgr} 
    758     Default vertical mesh in $z$-coordinate for 30 layers ORCA2 configuration as computed from 
    759     \autoref{eq:DOM_zgr_ana_2} using the coefficients given in \autoref{eq:DOM_zgr_coef} 
    760   } 
    761 \end{table} 
    762 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    763  
    764 % ------------------------------------------------------------------------------------------------------------- 
    765 %        z-coordinate with partial step 
    766 % ------------------------------------------------------------------------------------------------------------- 
    767 \subsection{$Z$-coordinate with partial step (\protect\np{ln\_zps}~\forcode{= .true.})} 
    768 \label{subsec:DOM_zps} 
    769 %--------------------------------------------namdom------------------------------------------------------- 
    770  
    771 \nlst{namdom}  
    772 %-------------------------------------------------------------------------------------------------------------- 
    773  
    774 In $z$-coordinate partial step, 
    775 the depths of the model levels are defined by the reference analytical function $z_0(k)$ as described in 
    776 the previous section, \textit{except} in the bottom layer. 
    777 The thickness of the bottom layer is allowed to vary as a function of geographical location $(\lambda,\varphi)$ to 
    778 allow a better representation of the bathymetry, especially in the case of small slopes 
    779 (where the bathymetry varies by less than one level thickness from one grid point to the next). 
    780 The reference layer thicknesses $e_{3t}^0$ have been defined in the absence of bathymetry. 
    781 With partial steps, layers from 1 to \jp{jpk}-2 can have a thickness smaller than $e_{3t}(jk)$. 
    782 The model deepest layer (\jp{jpk}-1) is allowed to have either a smaller or larger thickness than $e_{3t}(jpk)$: 
    783 the maximum thickness allowed is $2*e_{3t}(jpk - 1)$. 
    784 This has to be kept in mind when specifying values in \ngn{namdom} namelist, 
    785 as the maximum depth \np{pphmax} in partial steps: 
    786 for example, with \np{pphmax}~$= 5750~m$ for the DRAKKAR 45 layer grid, 
    787 the maximum ocean depth allowed is actually $6000~m$ (the default thickness $e_{3t}(jpk - 1)$ being $250~m$). 
    788 Two variables in the namdom namelist are used to define the partial step vertical grid. 
    789 The mimimum water thickness (in meters) allowed for a cell partially filled with bathymetry at level jk is 
    790 the minimum of \np{rn\_e3zps\_min} (thickness in meters, usually $20~m$) or $e_{3t}(jk)*$\np{rn\_e3zps\_rat} 
    791 (a fraction, usually 10\%, of the default thickness $e_{3t}(jk)$). 
    792  
    793 \gmcomment{ \colorbox{yellow}{Add a figure here of pstep especially at last ocean level }  } 
    794  
    795 % ------------------------------------------------------------------------------------------------------------- 
    796 %        s-coordinate 
    797 % ------------------------------------------------------------------------------------------------------------- 
    798 \subsection{$S$-coordinate (\protect\np{ln\_sco}~\forcode{= .true.})} 
    799 \label{subsec:DOM_sco} 
    800 %------------------------------------------nam_zgr_sco--------------------------------------------------- 
    801 % 
    802 %\nlst{namzgr_sco}  
    803 %-------------------------------------------------------------------------------------------------------------- 
    804 Options are defined in \ngn{namzgr\_sco}. 
    805 In $s$-coordinate (\np{ln\_sco}~\forcode{= .true.}), the depth and thickness of the model levels are defined from 
    806 the product of a depth field and either a stretching function or its derivative, respectively: 
    807  
    808 \begin{align*} 
    809   % \label{eq:DOM_sco_ana} 
    810   z(k)   &= h(i,j) \; z_0 (k) \\ 
    811   e_3(k) &= h(i,j) \; z_0'(k) 
    812 \end{align*} 
    813  
    814 where $h$ is the depth of the last $w$-level ($z_0(k)$) defined at the $t$-point location in the horizontal and 
    815 $z_0(k)$ is a function which varies from $0$ at the sea surface to $1$ at the ocean bottom. 
    816 The depth field $h$ is not necessary the ocean depth, 
    817 since a mixed step-like and bottom-following representation of the topography can be used 
    818 (\autoref{fig:z_zps_s_sps}) or an envelop bathymetry can be defined (\autoref{fig:z_zps_s_sps}). 
    819 The namelist parameter \np{rn\_rmax} determines the slope at which 
    820 the terrain-following coordinate intersects the sea bed and becomes a pseudo z-coordinate. 
    821 The coordinate can also be hybridised by specifying \np{rn\_sbot\_min} and \np{rn\_sbot\_max} as 
    822 the minimum and maximum depths at which the terrain-following vertical coordinate is calculated. 
    823  
    824 Options for stretching the coordinate are provided as examples, 
    825 but care must be taken to ensure that the vertical stretch used is appropriate for the application. 
    826  
    827 The original default NEMO s-coordinate stretching is available if neither of the other options are specified as true 
    828 (\np{ln\_s\_SH94}~\forcode{= .false.} and \np{ln\_s\_SF12}~\forcode{= .false.}). 
    829 This uses a depth independent $\tanh$ function for the stretching \citep{Madec_al_JPO96}: 
    830  
    831 \[ 
    832   z = s_{min} + C (s) (H - s_{min}) 
    833   % \label{eq:SH94_1} 
    834 \] 
    835  
    836 where $s_{min}$ is the depth at which the $s$-coordinate stretching starts and 
    837 allows a $z$-coordinate to placed on top of the stretched coordinate, 
    838 and $z$ is the depth (negative down from the asea surface). 
    839 \begin{gather*} 
    840   s = - \frac{k}{n - 1} \quad \text{and} \quad 0 \leq k \leq n - 1 
    841   % \label{eq:DOM_s} 
    842  \\ 
    843   % \label{eq:DOM_sco_function} 
    844   C(s) = \frac{[\tanh(\theta \, (s + b)) - \tanh(\theta \, b)]}{2 \; \sinh(\theta)} 
    845 \end{gather*} 
    846  
    847 A stretching function, 
    848 modified from the commonly used \citet{Song_Haidvogel_JCP94} stretching (\np{ln\_s\_SH94}~\forcode{= .true.}), 
    849 is also available and is more commonly used for shelf seas modelling: 
    850  
    851 \[ 
    852   C(s) =   (1 - b) \frac{\sinh(\theta s)}{\sinh(\theta)} 
    853          + b       \frac{\tanh \lt[ \theta \lt(s + \frac{1}{2} \rt) \rt] -   \tanh \lt( \frac{\theta}{2} \rt)} 
    854                         {                                                  2 \tanh \lt( \frac{\theta}{2} \rt)} 
    855   % \label{eq:SH94_2} 
    856 \] 
    857  
    858 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    859 \begin{figure}[!ht] 
    860   \begin{center} 
    861     \includegraphics[]{Fig_sco_function} 
    862     \caption{ 
    863       \protect\label{fig:sco_function} 
    864       Examples of the stretching function applied to a seamount; 
    865       from left to right: surface, surface and bottom, and bottom intensified resolutions 
    866     } 
    867   \end{center} 
    868 \end{figure} 
    869 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    870  
    871 where $H_c$ is the critical depth (\np{rn\_hc}) at which the coordinate transitions from pure $\sigma$ to 
    872 the stretched coordinate, and $\theta$ (\np{rn\_theta}) and $b$ (\np{rn\_bb}) are the surface and 
    873 bottom control parameters such that $0 \leqslant \theta \leqslant 20$, and $0 \leqslant b \leqslant 1$. 
    874 $b$ has been designed to allow surface and/or bottom increase of the vertical resolution 
    875 (\autoref{fig:sco_function}). 
    876  
    877 Another example has been provided at version 3.5 (\np{ln\_s\_SF12}) that allows a fixed surface resolution in 
    878 an analytical terrain-following stretching \citet{Siddorn_Furner_OM12}. 
    879 In this case the a stretching function $\gamma$ is defined such that: 
    880  
    881 \begin{equation} 
    882   z = - \gamma h \quad \text{with} \quad 0 \leq \gamma \leq 1 
    883   % \label{eq:z} 
    884 \end{equation} 
    885  
    886 The function is defined with respect to $\sigma$, the unstretched terrain-following coordinate: 
    887  
    888 \begin{gather*} 
    889   % \label{eq:DOM_gamma_deriv} 
    890   \gamma =   A \lt( \sigma   - \frac{1}{2} (\sigma^2     + f (\sigma)) \rt) 
    891            + B \lt( \sigma^3 - f           (\sigma) \rt) + f (\sigma)       \\ 
    892   \intertext{Where:} 
    893   % \label{eq:DOM_gamma} 
    894   f(\sigma) = (\alpha + 2) \sigma^{\alpha + 1} - (\alpha + 1) \sigma^{\alpha + 2} 
    895   \quad \text{and} \quad \sigma = \frac{k}{n - 1} 
    896 \end{gather*} 
    897  
    898 This gives an analytical stretching of $\sigma$ that is solvable in $A$ and $B$ as a function of 
    899 the user prescribed stretching parameter $\alpha$ (\np{rn\_alpha}) that stretches towards 
    900 the surface ($\alpha > 1.0$) or the bottom ($\alpha < 1.0$) and 
    901 user prescribed surface (\np{rn\_zs}) and bottom depths. 
    902 The bottom cell depth in this example is given as a function of water depth: 
    903  
    904 \[ 
    905   % \label{eq:DOM_zb} 
    906   Z_b = h a + b 
    907 \] 
    908  
    909 where the namelist parameters \np{rn\_zb\_a} and \np{rn\_zb\_b} are $a$ and $b$ respectively. 
    910  
    911 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    912 \begin{figure}[!ht] 
    913   \includegraphics[]{Fig_DOM_compare_coordinates_surface} 
    914   \caption{ 
    915     A comparison of the \citet{Song_Haidvogel_JCP94} $S$-coordinate (solid lines), 
    916     a 50 level $Z$-coordinate (contoured surfaces) and 
    917     the \citet{Siddorn_Furner_OM12} $S$-coordinate (dashed lines) in the surface $100~m$ for 
    918     a idealised bathymetry that goes from $50~m$ to $5500~m$ depth. 
    919     For clarity every third coordinate surface is shown. 
    920   } 
    921   \label{fig:fig_compare_coordinates_surface} 
    922 \end{figure} 
    923  % >>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    924  
    925 This gives a smooth analytical stretching in computational space that is constrained to 
    926 given specified surface and bottom grid cell thicknesses in real space. 
    927 This is not to be confused with the hybrid schemes that 
    928 superimpose geopotential coordinates on terrain following coordinates thus 
    929 creating a non-analytical vertical coordinate that 
    930 therefore may suffer from large gradients in the vertical resolutions. 
    931 This stretching is less straightforward to implement than the \citet{Song_Haidvogel_JCP94} stretching, 
    932 but has the advantage of resolving diurnal processes in deep water and has generally flatter slopes. 
    933  
    934 As with the \citet{Song_Haidvogel_JCP94} stretching the stretch is only applied at depths greater than 
    935 the critical depth $h_c$. 
    936 In this example two options are available in depths shallower than $h_c$, 
    937 with pure sigma being applied if the \np{ln\_sigcrit} is true and pure z-coordinates if it is false 
    938 (the z-coordinate being equal to the depths of the stretched coordinate at $h_c$). 
    939  
    940 Minimising the horizontal slope of the vertical coordinate is important in terrain-following systems as 
    941 large slopes lead to hydrostatic consistency. 
    942 A hydrostatic consistency parameter diagnostic following \citet{Haney1991} has been implemented, 
    943 and is output as part of the model mesh file at the start of the run. 
    944  
    945 % ------------------------------------------------------------------------------------------------------------- 
    946 %        z*- or s*-coordinate 
    947 % ------------------------------------------------------------------------------------------------------------- 
    948 \subsection{\zstar- or \sstar-coordinate (\protect\np{ln\_linssh}~\forcode{= .false.})} 
    949 \label{subsec:DOM_zgr_star} 
    950  
    951 This option is described in the Report by Levier \textit{et al.} (2007), available on the \NEMO web site. 
    952  
    953 %gm% key advantage: minimise the diffusion/dispertion associated with advection in response to high frequency surface disturbances 
    954  
    955 % ------------------------------------------------------------------------------------------------------------- 
    956 %        level bathymetry and mask  
    957 % ------------------------------------------------------------------------------------------------------------- 
    958 \subsection{Level bathymetry and mask} 
     545They are updated at each model time step. 
     546The initial fixed reference coordinate system is held in variable names with a $\_0$ suffix. 
     547When the linear free surface option is used (\np{ln\_linssh}\forcode{=.true.}), 
     548\textit{before}, \textit{now} and \textit{after} arrays are initially set to 
     549their reference counterpart and remain fixed. 
     550 
     551\subsubsection{Required fields} 
     552\label{sec:DOM_zgr_fields} 
     553 
     554The explicit specification of a range of fields related to the vertical grid are required for 
     555the definition of a configuration. 
     556These include: 
     557 
     558\begin{clines} 
     559int    ln_zco, ln_zps, ln_sco            /* flags for z-coord, z-coord with partial steps and s-coord    */ 
     560int    ln_isfcav                         /* flag  for ice shelf cavities                                 */ 
     561double e3t_1d, e3w_1d                    /* reference vertical scale factors at T and W points           */ 
     562double e3t_0, e3u_0, e3v_0, e3f_0, e3w_0 /* vertical scale factors 3D coordinate at T,U,V,F and W points */ 
     563double e3uw_0, e3vw_0                    /* vertical scale factors 3D coordinate at UW and VW points     */ 
     564int    bottom_level, top_level           /* last wet T-points, 1st wet T-points (for ice shelf cavities) */ 
     565                                         /* For reference:                                               */ 
     566float  bathy_metry                       /* bathymetry used in setting top and bottom levels             */ 
     567\end{clines} 
     568 
     569This set of vertical metrics is sufficient to describe the initial depth and thickness of every gridcell in 
     570the model regardless of the choice of vertical coordinate. 
     571With constant z-levels, e3 metrics will be uniform across each horizontal level. 
     572In the partial step case each e3 at the \jp{bottom\_level} 
     573(and, possibly, \jp{top\_level} if ice cavities are present) 
     574may vary from its horizontal neighbours. 
     575And, in s-coordinates, variations can occur throughout the water column. 
     576With the non-linear free-surface, all the coordinates behave more like the s-coordinate in 
     577that variations occur throughout the water column with displacements related to the sea surface height. 
     578These variations are typically much smaller than those arising from bottom fitted coordinates. 
     579The values for vertical metrics supplied in the domain configuration file can be considered as 
     580those arising from a flat sea surface with zero elevation. 
     581 
     582The \jp{bottom\_level} and \jp{top\_level} 2D arrays define the \jp{bottom\_level} and top wet levels in each grid column. 
     583Without ice cavities, \jp{top\_level} is essentially a land mask (0 on land; 1 everywhere else). 
     584With ice cavities, \jp{top\_level} determines the first wet point below the overlying ice shelf. 
     585 
     586 
     587% ------------------------------------------------------------------------------------------------------------- 
     588%        level bathymetry and mask 
     589% ------------------------------------------------------------------------------------------------------------- 
     590\subsubsection{Level bathymetry and mask} 
    959591\label{subsec:DOM_msk} 
    960592 
    961 Whatever the vertical coordinate used, the model offers the possibility of representing the bottom topography with 
    962 steps that follow the face of the model cells (step like topography) \citep{Madec_al_JPO96}. 
    963 The distribution of the steps in the horizontal is defined in a 2D integer array, mbathy, which 
    964 gives the number of ocean levels (\ie those that are not masked) at each $t$-point. 
    965 mbathy is computed from the meter bathymetry using the definiton of gdept as the number of $t$-points which 
    966 gdept $\leq$ bathy. 
    967  
    968 Modifications of the model bathymetry are performed in the \textit{bat\_ctl} routine (see \mdl{domzgr} module) after 
    969 mbathy is computed. 
    970 Isolated grid points that do not communicate with another ocean point at the same level are eliminated. 
    971  
    972 As for the representation of bathymetry, a 2D integer array, misfdep, is created. 
    973 misfdep defines the level of the first wet $t$-point. 
    974 All the cells between $k = 1$ and $misfdep(i,j) - 1$ are masked. 
    975 By default, $misfdep(:,:) = 1$ and no cells are masked. 
    976  
    977 In case of ice shelf cavities, modifications of the model bathymetry and ice shelf draft into  
    978 the cavities are performed in the \textit{zgr\_isf} routine. 
    979 The compatibility between ice shelf draft and bathymetry is checked. 
    980 All the locations where the isf cavity is thinnest than \np{rn\_isfhmin} meters are grounded (\ie masked). 
    981 If only one cell on the water column is opened at $t$-, $u$- or $v$-points, 
    982 the bathymetry or the ice shelf draft is dug to fit this constrain. 
    983 If the incompatibility is too strong (need to dig more than 1 cell), the cell is masked. 
    984  
    985 From the \textit{mbathy} and \textit{misfdep} array, the mask fields are defined as follows: 
     593 
     594From \jp{top\_level} and \jp{bottom\_level} fields, the mask fields are defined as follows: 
    986595\begin{alignat*}{2} 
    987596  tmask(i,j,k) &= &  & 
    988597    \begin{cases} 
    989                   0 &\text{if $                  k  <    misfdep(i,j)$} \\ 
    990                   1 &\text{if $misfdep(i,j) \leq k \leq   mbathy(i,j)$} \\ 
    991                   0 &\text{if $                  k  >     mbathy(i,j)$} 
     598                  0 &\text{if $                  k  <    top\_level(i,j)$} \\ 
     599                  1 &\text{if $bottom\_level(i,j) \leq k \leq   top\_level(i,j)$} \\ 
     600                  0 &\text{if $                  k  >     bottom\_level(i,j)$} 
    992601    \end{cases} 
    993602  \\ 
     
    1002611Note that, without ice shelves cavities, 
    1003612masks at $t-$ and $w-$points are identical with the numerical indexing used (\autoref{subsec:DOM_Num_Index}). 
    1004 Nevertheless, $wmask$ are required with ocean cavities to deal with the top boundary (ice shelf/ocean interface)  
     613Nevertheless, $wmask$ are required with ocean cavities to deal with the top boundary (ice shelf/ocean interface) 
    1005614exactly in the same way as for the bottom boundary. 
    1006615 
    1007 The specification of closed lateral boundaries requires that at least 
    1008 the first and last rows and columns of the \textit{mbathy} array are set to zero. 
    1009 In the particular case of an east-west cyclical boundary condition, \textit{mbathy} has its last column equal to 
    1010 the second one and its first column equal to the last but one (and so too the mask arrays) 
    1011 (see \autoref{fig:LBC_jperio}). 
     616%% The specification of closed lateral boundaries requires that at least 
     617%% the first and last rows and columns of the \textit{mbathy} array are set to zero. 
     618%% In the particular case of an east-west cyclical boundary condition, \textit{mbathy} has its last column equal to 
     619%% the second one and its first column equal to the last but one (and so too the mask arrays) 
     620%% (see \autoref{fig:LBC_jperio}). 
     621 
     622 
     623%------------------------------------------------------------------------------------------------- 
     624%        Closed seas 
     625%------------------------------------------------------------------------------------------------- 
     626\subsection{Closed seas} \label{subsec:DOM_closea} 
     627 
     628When a global ocean is coupled to an atmospheric model it is better to represent all large water bodies 
     629(\eg\ Great Lakes, Caspian sea \dots) even if the model resolution does not allow their communication with 
     630the rest of the ocean. 
     631This is unnecessary when the ocean is forced by fixed atmospheric conditions, 
     632so these seas can be removed from the ocean domain. 
     633The user has the option to set the bathymetry in closed seas to zero (see \autoref{sec:MISC_closea}) and 
     634to optionally decide on the fate of any freshwater imbalance over the area. 
     635The options are explained in \autoref{sec:MISC_closea} but it should be noted here that 
     636a successful use of these options requires appropriate mask fields to be present in the domain configuration file. 
     637Among the possibilities are: 
     638 
     639\begin{clines} 
     640int    closea_mask          /* non-zero values in closed sea areas for optional masking                  */ 
     641int    closea_mask_rnf      /* non-zero values in closed sea areas with runoff locations (precip only)   */ 
     642int    closea_mask_emp      /* non-zero values in closed sea areas with runoff locations (total emp)     */ 
     643\end{clines} 
     644 
     645% ------------------------------------------------------------------------------------------------------------- 
     646%        Grid files 
     647% ------------------------------------------------------------------------------------------------------------- 
     648\subsection{Output grid files} 
     649\label{subsec:DOM_meshmask} 
     650 
     651Most of the arrays relating to a particular ocean model configuration discussed in this chapter 
     652(grid-point position, scale factors) 
     653can be saved in a file if 
     654namelist parameter \np{ln\_write\_cfg} (namelist \nam{cfg}) is set to \forcode{.true.}; 
     655the output filename is set through parameter \np{cn\_domcfg\_out}. 
     656This is only really useful if 
     657the fields are computed in subroutines \mdl{usrdef\_hgr} or \mdl{usrdef\_zgr} and 
     658checking or confirmation is required. 
     659 
     660Alternatively, all the arrays relating to a particular ocean model configuration 
     661(grid-point position, scale factors, depths and masks) 
     662can be saved in a file called \texttt{mesh\_mask} if 
     663namelist parameter \np{ln\_meshmask} (namelist \nam{dom}) is set to \forcode{.true.}. 
     664This file contains additional fields that can be useful for post-processing applications. 
    1012665 
    1013666% ================================================================ 
    1014667% Domain: Initial State (dtatsd & istate) 
    1015668% ================================================================ 
    1016 \section{Initial state (\protect\mdl{istate} and \protect\mdl{dtatsd})} 
    1017 \label{sec:DTA_tsd} 
     669\section[Initial state (\textit{istate.F90} and \textit{dtatsd.F90})] 
     670{Initial state (\protect\mdl{istate} and \protect\mdl{dtatsd})} 
     671\label{sec:DOM_DTA_tsd} 
    1018672%-----------------------------------------namtsd------------------------------------------- 
    1019  
    1020 \nlst{namtsd}  
     673\begin{listing} 
     674  \nlst{namtsd} 
     675  \caption{\texttt{namtsd}} 
     676  \label{lst:namtsd} 
     677\end{listing} 
    1021678%------------------------------------------------------------------------------------------ 
    1022679 
    1023 Options are defined in \ngn{namtsd}. 
    1024 By default, the ocean start from rest (the velocity field is set to zero) and the initialization of temperature and 
    1025 salinity fields is controlled through the \np{ln\_tsd\_ini} namelist parameter. 
     680Basic initial state options are defined in \nam{tsd}. 
     681By default, the ocean starts from rest (the velocity field is set to zero) and 
     682the initialization of temperature and salinity fields is controlled through the \np{ln\_tsd\_init} namelist parameter. 
     683 
    1026684\begin{description} 
    1027 \item[\np{ln\_tsd\_init}~\forcode{= .true.}] 
    1028   use a T and S input files that can be given on the model grid itself or on their native input data grid. 
    1029   In the latter case, 
    1030   the data will be interpolated on-the-fly both in the horizontal and the vertical to the model grid 
     685\item[\np{ln\_tsd\_init}\forcode{= .true.}] 
     686  Use T and S input files that can be given on the model grid itself or on their native input data grids. 
     687  In the latter case, the data will be interpolated on-the-fly both in the horizontal and the vertical to the model grid 
    1031688  (see \autoref{subsec:SBC_iof}). 
    1032   The information relative to the input files are given in the \np{sn\_tem} and \np{sn\_sal} structures. 
     689  The information relating to the input files are specified in the \np{sn\_tem} and \np{sn\_sal} structures. 
    1033690  The computation is done in the \mdl{dtatsd} module. 
    1034 \item[\np{ln\_tsd\_init}~\forcode{= .false.}] 
    1035   use constant salinity value of $35.5~psu$ and an analytical profile of temperature 
    1036   (typical of the tropical ocean), see \rou{istate\_t\_s} subroutine called from \mdl{istate} module. 
     691\item[\np{ln\_tsd\_init}\forcode{= .false.}] 
     692  Initial values for T and S are set via a user supplied \rou{usr\_def\_istate} routine contained in \mdl{userdef\_istate}. 
     693  The default version sets horizontally uniform T and profiles as used in the GYRE configuration 
     694  (see \autoref{sec:CFGS_gyre}). 
    1037695\end{description} 
    1038696 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_DYN.tex

    r10499 r11564  
    88\label{chap:DYN} 
    99 
    10 \minitoc 
     10\chaptertoc 
    1111 
    1212Using the representation described in \autoref{chap:DOM}, 
     
    3636(surface wind stress calculation using bulk formulae, estimation of mixing coefficients) 
    3737that are carried out in modules SBC, LDF and ZDF and are described in 
    38 \autoref{chap:SBC}, \autoref{chap:LDF} and \autoref{chap:ZDF}, respectively.  
     38\autoref{chap:SBC}, \autoref{chap:LDF} and \autoref{chap:ZDF}, respectively. 
    3939 
    4040In the present chapter we also describe the diagnostic equations used to compute the horizontal divergence, 
    4141curl of the velocities (\emph{divcur} module) and the vertical velocity (\emph{wzvmod} module). 
    4242 
    43 The different options available to the user are managed by namelist variables.  
    44 For term \textit{ttt} in the momentum equations, the logical namelist variables are \textit{ln\_dynttt\_xxx},  
     43The different options available to the user are managed by namelist variables. 
     44For term \textit{ttt} in the momentum equations, the logical namelist variables are \textit{ln\_dynttt\_xxx}, 
    4545where \textit{xxx} is a 3 or 4 letter acronym corresponding to each optional scheme. 
    46 If a CPP key is used for this term its name is \key{ttt}. 
     46%If a CPP key is used for this term its name is \key{ttt}. 
    4747The corresponding code can be found in the \textit{dynttt\_xxx} module in the DYN directory, 
    4848and it is usually computed in the \textit{dyn\_ttt\_xxx} subroutine. 
    4949 
    5050The user has the option of extracting and outputting each tendency term from the 3D momentum equations 
    51 (\key{trddyn} defined), as described in \autoref{chap:MISC}. 
    52 Furthermore, the tendency terms associated with the 2D barotropic vorticity balance (when \key{trdvor} is defined) 
     51(\texttt{trddyn?} defined), as described in \autoref{chap:MISC}. 
     52Furthermore, the tendency terms associated with the 2D barotropic vorticity balance (when \texttt{trdvor?} is defined) 
    5353can be derived from the 3D terms. 
    5454%%% 
    55 \gmcomment{STEVEN: not quite sure I've got the sense of the last sentence. does  
     55\gmcomment{STEVEN: not quite sure I've got the sense of the last sentence. does 
    5656MISC correspond to "extracting tendency terms" or "vorticity balance"?} 
    5757 
     
    6565%           Horizontal divergence and relative vorticity 
    6666%-------------------------------------------------------------------------------------------------------------- 
    67 \subsection{Horizontal divergence and relative vorticity (\protect\mdl{divcur})} 
     67\subsection[Horizontal divergence and relative vorticity (\textit{divcur.F90})]{Horizontal divergence and relative vorticity (\protect\mdl{divcur})} 
    6868\label{subsec:DYN_divcur} 
    6969 
    70 The vorticity is defined at an $f$-point (\ie corner point) as follows: 
    71 \begin{equation} 
    72   \label{eq:divcur_cur} 
     70The vorticity is defined at an $f$-point (\ie\ corner point) as follows: 
     71\begin{equation} 
     72  \label{eq:DYN_divcur_cur} 
    7373  \zeta =\frac{1}{e_{1f}\,e_{2f} }\left( {\;\delta_{i+1/2} \left[ {e_{2v}\;v} \right] 
    7474      -\delta_{j+1/2} \left[ {e_{1u}\;u} \right]\;} \right) 
    75 \end{equation}  
     75\end{equation} 
    7676 
    7777The horizontal divergence is defined at a $T$-point. 
    7878It is given by: 
    7979\[ 
    80   % \label{eq:divcur_div} 
     80  % \label{eq:DYN_divcur_div} 
    8181  \chi =\frac{1}{e_{1t}\,e_{2t}\,e_{3t} } 
    8282  \left( {\delta_i \left[ {e_{2u}\,e_{3u}\,u} \right] 
     
    9696ensure perfect restartability. 
    9797The vorticity and divergence at the \textit{now} time step are used for the computation of 
    98 the nonlinear advection and of the vertical velocity respectively.  
     98the nonlinear advection and of the vertical velocity respectively. 
    9999 
    100100%-------------------------------------------------------------------------------------------------------------- 
    101101%           Sea Surface Height evolution 
    102102%-------------------------------------------------------------------------------------------------------------- 
    103 \subsection{Horizontal divergence and relative vorticity (\protect\mdl{sshwzv})} 
     103\subsection[Horizontal divergence and relative vorticity (\textit{sshwzv.F90})]{Horizontal divergence and relative vorticity (\protect\mdl{sshwzv})} 
    104104\label{subsec:DYN_sshwzv} 
    105105 
    106106The sea surface height is given by: 
    107107\begin{equation} 
    108   \label{eq:dynspg_ssh} 
     108  \label{eq:DYN_spg_ssh} 
    109109  \begin{aligned} 
    110110    \frac{\partial \eta }{\partial t} 
     
    115115  \end{aligned} 
    116116\end{equation} 
    117 where \textit{emp} is the surface freshwater budget (evaporation minus precipitation),  
     117where \textit{emp} is the surface freshwater budget (evaporation minus precipitation), 
    118118expressed in Kg/m$^2$/s (which is equal to mm/s), 
    119119and $\rho_w$=1,035~Kg/m$^3$ is the reference density of sea water (Boussinesq approximation). 
    120120If river runoff is expressed as a surface freshwater flux (see \autoref{chap:SBC}) then 
    121 \textit{emp} can be written as the evaporation minus precipitation, minus the river runoff.  
     121\textit{emp} can be written as the evaporation minus precipitation, minus the river runoff. 
    122122The sea-surface height is evaluated using exactly the same time stepping scheme as 
    123 the tracer equation \autoref{eq:tra_nxt}: 
     123the tracer equation \autoref{eq:TRA_nxt}: 
    124124a leapfrog scheme in combination with an Asselin time filter, 
    125 \ie the velocity appearing in \autoref{eq:dynspg_ssh} is centred in time (\textit{now} velocity). 
     125\ie\ the velocity appearing in \autoref{eq:DYN_spg_ssh} is centred in time (\textit{now} velocity). 
    126126This is of paramount importance. 
    127127Replacing $T$ by the number $1$ in the tracer equation and summing over the water column must lead to 
    128128the sea surface height equation otherwise tracer content will not be conserved 
    129 \citep{Griffies_al_MWR01, Leclair_Madec_OM09}. 
     129\citep{griffies.pacanowski.ea_MWR01, leclair.madec_OM09}. 
    130130 
    131131The vertical velocity is computed by an upward integration of the horizontal divergence starting at the bottom, 
    132132taking into account the change of the thickness of the levels: 
    133133\begin{equation} 
    134   \label{eq:wzv} 
     134  \label{eq:DYN_wzv} 
    135135  \left\{ 
    136136    \begin{aligned} 
     
    142142\end{equation} 
    143143 
    144 In the case of a non-linear free surface (\key{vvl}), the top vertical velocity is $-\textit{emp}/\rho_w$,  
     144In the case of a non-linear free surface (\texttt{vvl?}), the top vertical velocity is $-\textit{emp}/\rho_w$, 
    145145as changes in the divergence of the barotropic transport are absorbed into the change of the level thicknesses, 
    146146re-orientated downward. 
    147147\gmcomment{not sure of this...  to be modified with the change in emp setting} 
    148 In the case of a linear free surface, the time derivative in \autoref{eq:wzv} disappears. 
     148In the case of a linear free surface, the time derivative in \autoref{eq:DYN_wzv} disappears. 
    149149The upper boundary condition applies at a fixed level $z=0$. 
    150150The top vertical velocity is thus equal to the divergence of the barotropic transport 
    151 (\ie the first term in the right-hand-side of \autoref{eq:dynspg_ssh}). 
     151(\ie\ the first term in the right-hand-side of \autoref{eq:DYN_spg_ssh}). 
    152152 
    153153Note also that whereas the vertical velocity has the same discrete expression in $z$- and $s$-coordinates, 
    154154its physical meaning is not the same: 
    155155in the second case, $w$ is the velocity normal to the $s$-surfaces. 
    156 Note also that the $k$-axis is re-orientated downwards in the \fortran code compared to 
    157 the indexing used in the semi-discrete equations such as \autoref{eq:wzv} 
    158 (see \autoref{subsec:DOM_Num_Index_vertical}).  
     156Note also that the $k$-axis is re-orientated downwards in the \fortran\ code compared to 
     157the indexing used in the semi-discrete equations such as \autoref{eq:DYN_wzv} 
     158(see \autoref{subsec:DOM_Num_Index_vertical}). 
    159159 
    160160 
     
    166166%-----------------------------------------nam_dynadv---------------------------------------------------- 
    167167 
    168 \nlst{namdyn_adv}  
     168\begin{listing} 
     169  \nlst{namdyn_adv} 
     170  \caption{\texttt{namdyn\_adv}} 
     171  \label{lst:namdyn_adv} 
     172\end{listing} 
    169173%------------------------------------------------------------------------------------------------------------- 
    170174 
    171175The vector invariant form of the momentum equations is the one most often used in 
    172 applications of the \NEMO ocean model. 
     176applications of the \NEMO\ ocean model. 
    173177The flux form option (see next section) has been present since version $2$. 
    174 Options are defined through the \ngn{namdyn\_adv} namelist variables Coriolis and 
     178Options are defined through the \nam{dyn\_adv} namelist variables Coriolis and 
    175179momentum advection terms are evaluated using a leapfrog scheme, 
    176 \ie the velocity appearing in these expressions is centred in time (\textit{now} velocity).  
     180\ie\ the velocity appearing in these expressions is centred in time (\textit{now} velocity). 
    177181At the lateral boundaries either free slip, no slip or partial slip boundary conditions are applied following 
    178182\autoref{chap:LBC}. 
    179183 
    180184% ------------------------------------------------------------------------------------------------------------- 
    181 %        Vorticity term  
     185%        Vorticity term 
    182186% ------------------------------------------------------------------------------------------------------------- 
    183 \subsection{Vorticity term (\protect\mdl{dynvor})} 
     187\subsection[Vorticity term (\textit{dynvor.F90})]{Vorticity term (\protect\mdl{dynvor})} 
    184188\label{subsec:DYN_vor} 
    185189%------------------------------------------nam_dynvor---------------------------------------------------- 
    186190 
    187 \nlst{namdyn_vor}  
     191\begin{listing} 
     192  \nlst{namdyn_vor} 
     193  \caption{\texttt{namdyn\_vor}} 
     194  \label{lst:namdyn_vor} 
     195\end{listing} 
    188196%------------------------------------------------------------------------------------------------------------- 
    189197 
    190 Options are defined through the \ngn{namdyn\_vor} namelist variables. 
    191 Four discretisations of the vorticity term (\np{ln\_dynvor\_xxx}\forcode{ = .true.}) are available: 
     198Options are defined through the \nam{dyn\_vor} namelist variables. 
     199Four discretisations of the vorticity term (\texttt{ln\_dynvor\_xxx}\forcode{=.true.}) are available: 
    192200conserving potential enstrophy of horizontally non-divergent flow (ENS scheme); 
    193201conserving horizontal kinetic energy (ENE scheme); 
     
    195203horizontal kinetic energy for the planetary vorticity term (MIX scheme); 
    196204or conserving both the potential enstrophy of horizontally non-divergent flow and horizontal kinetic energy 
    197 (EEN scheme) (see \autoref{subsec:C_vorEEN}). 
     205(EEN scheme) (see \autoref{subsec:INVARIANTS_vorEEN}). 
    198206In the case of ENS, ENE or MIX schemes the land sea mask may be slightly modified to ensure the consistency of 
    199 vorticity term with analytical equations (\np{ln\_dynvor\_con}\forcode{ = .true.}). 
     207vorticity term with analytical equations (\np{ln\_dynvor\_con}\forcode{=.true.}). 
    200208The vorticity terms are all computed in dedicated routines that can be found in the \mdl{dynvor} module. 
    201209 
     
    203211%                 enstrophy conserving scheme 
    204212%------------------------------------------------------------- 
    205 \subsubsection{Enstrophy conserving scheme (\protect\np{ln\_dynvor\_ens}\forcode{ = .true.})} 
     213\subsubsection[Enstrophy conserving scheme (\forcode{ln_dynvor_ens = .true.})]{Enstrophy conserving scheme (\protect\np{ln\_dynvor\_ens}\forcode{ = .true.})} 
    206214\label{subsec:DYN_vor_ens} 
    207215 
    208216In the enstrophy conserving case (ENS scheme), 
    209217the discrete formulation of the vorticity term provides a global conservation of the enstrophy 
    210 ($ [ (\zeta +f ) / e_{3f} ]^2 $ in $s$-coordinates) for a horizontally non-divergent flow (\ie $\chi$=$0$), 
     218($ [ (\zeta +f ) / e_{3f} ]^2 $ in $s$-coordinates) for a horizontally non-divergent flow (\ie\ $\chi$=$0$), 
    211219but does not conserve the total kinetic energy. 
    212220It is given by: 
    213221\begin{equation} 
    214   \label{eq:dynvor_ens} 
     222  \label{eq:DYN_vor_ens} 
    215223  \left\{ 
    216224    \begin{aligned} 
     
    221229    \end{aligned} 
    222230  \right. 
    223 \end{equation}  
     231\end{equation} 
    224232 
    225233%------------------------------------------------------------- 
    226234%                 energy conserving scheme 
    227235%------------------------------------------------------------- 
    228 \subsubsection{Energy conserving scheme (\protect\np{ln\_dynvor\_ene}\forcode{ = .true.})} 
     236\subsubsection[Energy conserving scheme (\forcode{ln_dynvor_ene = .true.})]{Energy conserving scheme (\protect\np{ln\_dynvor\_ene}\forcode{ = .true.})} 
    229237\label{subsec:DYN_vor_ene} 
    230238 
     
    232240It is given by: 
    233241\begin{equation} 
    234   \label{eq:dynvor_ene} 
     242  \label{eq:DYN_vor_ene} 
    235243  \left\{ 
    236244    \begin{aligned} 
     
    241249    \end{aligned} 
    242250  \right. 
    243 \end{equation}  
     251\end{equation} 
    244252 
    245253%------------------------------------------------------------- 
    246254%                 mix energy/enstrophy conserving scheme 
    247255%------------------------------------------------------------- 
    248 \subsubsection{Mixed energy/enstrophy conserving scheme (\protect\np{ln\_dynvor\_mix}\forcode{ = .true.}) } 
     256\subsubsection[Mixed energy/enstrophy conserving scheme (\forcode{ln_dynvor_mix = .true.})]{Mixed energy/enstrophy conserving scheme (\protect\np{ln\_dynvor\_mix}\forcode{ = .true.})} 
    249257\label{subsec:DYN_vor_mix} 
    250258 
    251259For the mixed energy/enstrophy conserving scheme (MIX scheme), a mixture of the two previous schemes is used. 
    252 It consists of the ENS scheme (\autoref{eq:dynvor_ens}) for the relative vorticity term, 
    253 and of the ENE scheme (\autoref{eq:dynvor_ene}) applied to the planetary vorticity term. 
    254 \[ 
    255   % \label{eq:dynvor_mix} 
     260It consists of the ENS scheme (\autoref{eq:DYN_vor_ens}) for the relative vorticity term, 
     261and of the ENE scheme (\autoref{eq:DYN_vor_ene}) applied to the planetary vorticity term. 
     262\[ 
     263  % \label{eq:DYN_vor_mix} 
    256264  \left\{ { 
    257265      \begin{aligned} 
     
    271279%                 energy and enstrophy conserving scheme 
    272280%------------------------------------------------------------- 
    273 \subsubsection{Energy and enstrophy conserving scheme (\protect\np{ln\_dynvor\_een}\forcode{ = .true.}) } 
     281\subsubsection[Energy and enstrophy conserving scheme (\forcode{ln_dynvor_een = .true.})]{Energy and enstrophy conserving scheme (\protect\np{ln\_dynvor\_een}\forcode{ = .true.})} 
    274282\label{subsec:DYN_vor_een} 
    275283 
     
    278286the presence of grid point oscillation structures that will be invisible to the operator. 
    279287These structures are \textit{computational modes} that will be at least partly damped by 
    280 the momentum diffusion operator (\ie the subgrid-scale advection), but not by the resolved advection term. 
     288the momentum diffusion operator (\ie\ the subgrid-scale advection), but not by the resolved advection term. 
    281289The ENS and ENE schemes therefore do not contribute to dump any grid point noise in the horizontal velocity field. 
    282290Such noise would result in more noise in the vertical velocity field, an undesirable feature. 
     
    284292$u$ and $v$ are located at different grid points, 
    285293a price worth paying to avoid a double averaging in the pressure gradient term as in the $B$-grid. 
    286 \gmcomment{ To circumvent this, Adcroft (ADD REF HERE)  
     294\gmcomment{ To circumvent this, Adcroft (ADD REF HERE) 
    287295Nevertheless, this technique strongly distort the phase and group velocity of Rossby waves....} 
    288296 
    289 A very nice solution to the problem of double averaging was proposed by \citet{Arakawa_Hsu_MWR90}. 
     297A very nice solution to the problem of double averaging was proposed by \citet{arakawa.hsu_MWR90}. 
    290298The idea is to get rid of the double averaging by considering triad combinations of vorticity. 
    291299It is noteworthy that this solution is conceptually quite similar to the one proposed by 
    292 \citep{Griffies_al_JPO98} for the discretization of the iso-neutral diffusion operator (see \autoref{apdx:C}). 
    293  
    294 The \citet{Arakawa_Hsu_MWR90} vorticity advection scheme for a single layer is modified  
    295 for spherical coordinates as described by \citet{Arakawa_Lamb_MWR81} to obtain the EEN scheme.  
    296 First consider the discrete expression of the potential vorticity, $q$, defined at an $f$-point:  
    297 \[ 
    298   % \label{eq:pot_vor} 
     300\citep{griffies.gnanadesikan.ea_JPO98} for the discretization of the iso-neutral diffusion operator (see \autoref{apdx:INVARIANTS}). 
     301 
     302The \citet{arakawa.hsu_MWR90} vorticity advection scheme for a single layer is modified 
     303for spherical coordinates as described by \citet{arakawa.lamb_MWR81} to obtain the EEN scheme. 
     304First consider the discrete expression of the potential vorticity, $q$, defined at an $f$-point: 
     305\[ 
     306  % \label{eq:DYN_pot_vor} 
    299307  q  = \frac{\zeta +f} {e_{3f} } 
    300308\] 
    301 where the relative vorticity is defined by (\autoref{eq:divcur_cur}), 
    302 the Coriolis parameter is given by $f=2 \,\Omega \;\sin \varphi _f $ and the layer thickness at $f$-points is:  
    303 \begin{equation} 
    304   \label{eq:een_e3f} 
     309where the relative vorticity is defined by (\autoref{eq:DYN_divcur_cur}), 
     310the Coriolis parameter is given by $f=2 \,\Omega \;\sin \varphi _f $ and the layer thickness at $f$-points is: 
     311\begin{equation} 
     312  \label{eq:DYN_een_e3f} 
    305313  e_{3f} = \overline{\overline {e_{3t} }} ^{\,i+1/2,j+1/2} 
    306314\end{equation} 
     
    308316%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    309317\begin{figure}[!ht] 
    310   \begin{center} 
    311     \includegraphics[width=0.70\textwidth]{Fig_DYN_een_triad} 
    312     \caption{ 
    313       \protect\label{fig:DYN_een_triad} 
    314       Triads used in the energy and enstrophy conserving scheme (een) for 
    315       $u$-component (upper panel) and $v$-component (lower panel). 
    316     } 
    317   \end{center} 
     318  \centering 
     319  \includegraphics[width=\textwidth]{Fig_DYN_een_triad} 
     320  \caption[Triads used in the energy and enstrophy conserving scheme (EEN)]{ 
     321    Triads used in the energy and enstrophy conserving scheme (EEN) for 
     322    $u$-component (upper panel) and $v$-component (lower panel).} 
     323  \label{fig:DYN_een_triad} 
    318324\end{figure} 
    319325% >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    320326 
    321 A key point in \autoref{eq:een_e3f} is how the averaging in the \textbf{i}- and \textbf{j}- directions is made.  
     327A key point in \autoref{eq:DYN_een_e3f} is how the averaging in the \textbf{i}- and \textbf{j}- directions is made. 
    322328It uses the sum of masked t-point vertical scale factor divided either by the sum of the four t-point masks 
    323 (\np{nn\_een\_e3f}\forcode{ = 1}), or just by $4$ (\np{nn\_een\_e3f}\forcode{ = .true.}). 
     329(\np{nn\_een\_e3f}\forcode{=1}), or just by $4$ (\np{nn\_een\_e3f}\forcode{=.true.}). 
    324330The latter case preserves the continuity of $e_{3f}$ when one or more of the neighbouring $e_{3t}$ tends to zero and 
    325331extends by continuity the value of $e_{3f}$ into the land areas. 
     
    327333(with a systematic reduction of $e_{3f}$ when a model level intercept the bathymetry) 
    328334that tends to reinforce the topostrophy of the flow 
    329 (\ie the tendency of the flow to follow the isobaths) \citep{Penduff_al_OS07}.  
     335(\ie\ the tendency of the flow to follow the isobaths) \citep{penduff.le-sommer.ea_OS07}. 
    330336 
    331337Next, the vorticity triads, $ {^i_j}\mathbb{Q}^{i_p}_{j_p}$ can be defined at a $T$-point as 
    332338the following triad combinations of the neighbouring potential vorticities defined at f-points 
    333 (\autoref{fig:DYN_een_triad}):  
    334 \begin{equation} 
    335   \label{eq:Q_triads} 
     339(\autoref{fig:DYN_een_triad}): 
     340\begin{equation} 
     341  \label{eq:DYN_Q_triads} 
    336342  _i^j \mathbb{Q}^{i_p}_{j_p} 
    337343  = \frac{1}{12} \ \left(   q^{i-i_p}_{j+j_p} + q^{i+j_p}_{j+i_p} + q^{i+i_p}_{j-j_p}  \right) 
    338344\end{equation} 
    339 where the indices $i_p$ and $k_p$ take the values: $i_p = -1/2$ or $1/2$ and $j_p = -1/2$ or $1/2$.  
    340  
    341 Finally, the vorticity terms are represented as:  
    342 \begin{equation} 
    343   \label{eq:dynvor_een} 
     345where the indices $i_p$ and $k_p$ take the values: $i_p = -1/2$ or $1/2$ and $j_p = -1/2$ or $1/2$. 
     346 
     347Finally, the vorticity terms are represented as: 
     348\begin{equation} 
     349  \label{eq:DYN_vor_een} 
    344350  \left\{ { 
    345351      \begin{aligned} 
     
    350356      \end{aligned} 
    351357    } \right. 
    352 \end{equation}  
     358\end{equation} 
    353359 
    354360This EEN scheme in fact combines the conservation properties of the ENS and ENE schemes. 
    355361It conserves both total energy and potential enstrophy in the limit of horizontally nondivergent flow 
    356 (\ie $\chi$=$0$) (see \autoref{subsec:C_vorEEN}).  
     362(\ie\ $\chi$=$0$) (see \autoref{subsec:INVARIANTS_vorEEN}). 
    357363Applied to a realistic ocean configuration, it has been shown that it leads to a significant reduction of 
    358 the noise in the vertical velocity field \citep{Le_Sommer_al_OM09}. 
     364the noise in the vertical velocity field \citep{le-sommer.penduff.ea_OM09}. 
    359365Furthermore, used in combination with a partial steps representation of bottom topography, 
    360366it improves the interaction between current and topography, 
    361 leading to a larger topostrophy of the flow \citep{Barnier_al_OD06, Penduff_al_OS07}.  
     367leading to a larger topostrophy of the flow \citep{barnier.madec.ea_OD06, penduff.le-sommer.ea_OS07}. 
    362368 
    363369%-------------------------------------------------------------------------------------------------------------- 
    364370%           Kinetic Energy Gradient term 
    365371%-------------------------------------------------------------------------------------------------------------- 
    366 \subsection{Kinetic energy gradient term (\protect\mdl{dynkeg})} 
     372\subsection[Kinetic energy gradient term (\textit{dynkeg.F90})]{Kinetic energy gradient term (\protect\mdl{dynkeg})} 
    367373\label{subsec:DYN_keg} 
    368374 
    369 As demonstrated in \autoref{apdx:C}, 
     375As demonstrated in \autoref{apdx:INVARIANTS}, 
    370376there is a single discrete formulation of the kinetic energy gradient term that, 
    371377together with the formulation chosen for the vertical advection (see below), 
    372378conserves the total kinetic energy: 
    373379\[ 
    374   % \label{eq:dynkeg} 
     380  % \label{eq:DYN_keg} 
    375381  \left\{ 
    376382    \begin{aligned} 
     
    384390%           Vertical advection term 
    385391%-------------------------------------------------------------------------------------------------------------- 
    386 \subsection{Vertical advection term (\protect\mdl{dynzad}) } 
     392\subsection[Vertical advection term (\textit{dynzad.F90})]{Vertical advection term (\protect\mdl{dynzad})} 
    387393\label{subsec:DYN_zad} 
    388394 
     
    391397conserves the total kinetic energy. 
    392398Indeed, the change of KE due to the vertical advection is exactly balanced by 
    393 the change of KE due to the gradient of KE (see \autoref{apdx:C}). 
    394 \[ 
    395   % \label{eq:dynzad} 
     399the change of KE due to the gradient of KE (see \autoref{apdx:INVARIANTS}). 
     400\[ 
     401  % \label{eq:DYN_zad} 
    396402  \left\{ 
    397403    \begin{aligned} 
     
    401407  \right. 
    402408\] 
    403 When \np{ln\_dynzad\_zts}\forcode{ = .true.}, 
     409When \np{ln\_dynzad\_zts}\forcode{=.true.}, 
    404410a split-explicit time stepping with 5 sub-timesteps is used on the vertical advection term. 
    405 This option can be useful when the value of the timestep is limited by vertical advection \citep{Lemarie_OM2015}.  
     411This option can be useful when the value of the timestep is limited by vertical advection \citep{lemarie.debreu.ea_OM15}. 
    406412Note that in this case, 
    407413a similar split-explicit time stepping should be used on vertical advection of tracer to ensure a better stability, 
     
    416422%------------------------------------------nam_dynadv---------------------------------------------------- 
    417423 
    418 \nlst{namdyn_adv}  
    419424%------------------------------------------------------------------------------------------------------------- 
    420425 
    421 Options are defined through the \ngn{namdyn\_adv} namelist variables. 
     426Options are defined through the \nam{dyn\_adv} namelist variables. 
    422427In the flux form (as in the vector invariant form), 
    423428the Coriolis and momentum advection terms are evaluated using a leapfrog scheme, 
    424 \ie the velocity appearing in their expressions is centred in time (\textit{now} velocity). 
     429\ie\ the velocity appearing in their expressions is centred in time (\textit{now} velocity). 
    425430At the lateral boundaries either free slip, 
    426431no slip or partial slip boundary conditions are applied following \autoref{chap:LBC}. 
     
    430435%           Coriolis plus curvature metric terms 
    431436%-------------------------------------------------------------------------------------------------------------- 
    432 \subsection{Coriolis plus curvature metric terms (\protect\mdl{dynvor}) } 
     437\subsection[Coriolis plus curvature metric terms (\textit{dynvor.F90})]{Coriolis plus curvature metric terms (\protect\mdl{dynvor})} 
    433438\label{subsec:DYN_cor_flux} 
    434439 
    435440In flux form, the vorticity term reduces to a Coriolis term in which the Coriolis parameter has been modified to account for the "metric" term. 
    436441This altered Coriolis parameter is thus discretised at $f$-points. 
    437 It is given by:  
     442It is given by: 
    438443\begin{multline*} 
    439   % \label{eq:dyncor_metric} 
     444  % \label{eq:DYN_cor_metric} 
    440445  f+\frac{1}{e_1 e_2 }\left( {v\frac{\partial e_2 }{\partial i}  -  u\frac{\partial e_1 }{\partial j}} \right)  \\ 
    441446  \equiv   f + \frac{1}{e_{1f} e_{2f} } \left( { \ \overline v ^{i+1/2}\delta_{i+1/2} \left[ {e_{2u} } \right] 
    442447      -  \overline u ^{j+1/2}\delta_{j+1/2} \left[ {e_{1u} } \right]  }  \ \right) 
    443 \end{multline*}  
    444  
    445 Any of the (\autoref{eq:dynvor_ens}), (\autoref{eq:dynvor_ene}) and (\autoref{eq:dynvor_een}) schemes can be used to 
     448\end{multline*} 
     449 
     450Any of the (\autoref{eq:DYN_vor_ens}), (\autoref{eq:DYN_vor_ene}) and (\autoref{eq:DYN_vor_een}) schemes can be used to 
    446451compute the product of the Coriolis parameter and the vorticity. 
    447 However, the energy-conserving scheme (\autoref{eq:dynvor_een}) has exclusively been used to date. 
    448 This term is evaluated using a leapfrog scheme, \ie the velocity is centred in time (\textit{now} velocity). 
     452However, the energy-conserving scheme (\autoref{eq:DYN_vor_een}) has exclusively been used to date. 
     453This term is evaluated using a leapfrog scheme, \ie\ the velocity is centred in time (\textit{now} velocity). 
    449454 
    450455%-------------------------------------------------------------------------------------------------------------- 
    451456%           Flux form Advection term 
    452457%-------------------------------------------------------------------------------------------------------------- 
    453 \subsection{Flux form advection term (\protect\mdl{dynadv}) } 
     458\subsection[Flux form advection term (\textit{dynadv.F90})]{Flux form advection term (\protect\mdl{dynadv})} 
    454459\label{subsec:DYN_adv_flux} 
    455460 
    456461The discrete expression of the advection term is given by: 
    457462\[ 
    458   % \label{eq:dynadv} 
     463  % \label{eq:DYN_adv} 
    459464  \left\{ 
    460465    \begin{aligned} 
     
    475480a $2^{nd}$ order centered finite difference scheme, CEN2, 
    476481or a $3^{rd}$ order upstream biased scheme, UBS. 
    477 The latter is described in \citet{Shchepetkin_McWilliams_OM05}. 
    478 The schemes are selected using the namelist logicals \np{ln\_dynadv\_cen2} and \np{ln\_dynadv\_ubs}.  
     482The latter is described in \citet{shchepetkin.mcwilliams_OM05}. 
     483The schemes are selected using the namelist logicals \np{ln\_dynadv\_cen2} and \np{ln\_dynadv\_ubs}. 
    479484In flux form, the schemes differ by the choice of a space and time interpolation to define the value of 
    480 $u$ and $v$ at the centre of each face of $u$- and $v$-cells, \ie at the $T$-, $f$-, 
    481 and $uw$-points for $u$ and at the $f$-, $T$- and $vw$-points for $v$.  
     485$u$ and $v$ at the centre of each face of $u$- and $v$-cells, \ie\ at the $T$-, $f$-, 
     486and $uw$-points for $u$ and at the $f$-, $T$- and $vw$-points for $v$. 
    482487 
    483488%------------------------------------------------------------- 
    484489%                 2nd order centred scheme 
    485490%------------------------------------------------------------- 
    486 \subsubsection{CEN2: $2^{nd}$ order centred scheme (\protect\np{ln\_dynadv\_cen2}\forcode{ = .true.})} 
     491\subsubsection[CEN2: $2^{nd}$ order centred scheme (\forcode{ln_dynadv_cen2 = .true.})]{CEN2: $2^{nd}$ order centred scheme (\protect\np{ln\_dynadv\_cen2}\forcode{ = .true.})} 
    487492\label{subsec:DYN_adv_cen2} 
    488493 
    489494In the centered $2^{nd}$ order formulation, the velocity is evaluated as the mean of the two neighbouring points: 
    490495\begin{equation} 
    491   \label{eq:dynadv_cen2} 
     496  \label{eq:DYN_adv_cen2} 
    492497  \left\{ 
    493498    \begin{aligned} 
     
    496501    \end{aligned} 
    497502  \right. 
    498 \end{equation}  
    499  
    500 The scheme is non diffusive (\ie conserves the kinetic energy) but dispersive (\ie it may create false extrema). 
     503\end{equation} 
     504 
     505The scheme is non diffusive (\ie\ conserves the kinetic energy) but dispersive (\ie\ it may create false extrema). 
    501506It is therefore notoriously noisy and must be used in conjunction with an explicit diffusion operator to 
    502507produce a sensible solution. 
     
    507512%                 UBS scheme 
    508513%------------------------------------------------------------- 
    509 \subsubsection{UBS: Upstream Biased Scheme (\protect\np{ln\_dynadv\_ubs}\forcode{ = .true.})} 
     514\subsubsection[UBS: Upstream Biased Scheme (\forcode{ln_dynadv_ubs = .true.})]{UBS: Upstream Biased Scheme (\protect\np{ln\_dynadv\_ubs}\forcode{ = .true.})} 
    510515\label{subsec:DYN_adv_ubs} 
    511516 
     
    514519For example, the evaluation of $u_T^{ubs} $ is done as follows: 
    515520\begin{equation} 
    516   \label{eq:dynadv_ubs} 
     521  \label{eq:DYN_adv_ubs} 
    517522  u_T^{ubs} =\overline u ^i-\;\frac{1}{6} 
    518523  \begin{cases} 
     
    522527\end{equation} 
    523528where $u"_{i+1/2} =\delta_{i+1/2} \left[ {\delta_i \left[ u \right]} \right]$. 
    524 This results in a dissipatively dominant (\ie hyper-diffusive) truncation error 
    525 \citep{Shchepetkin_McWilliams_OM05}. 
    526 The overall performance of the advection scheme is similar to that reported in \citet{Farrow1995}. 
     529This results in a dissipatively dominant (\ie\ hyper-diffusive) truncation error 
     530\citep{shchepetkin.mcwilliams_OM05}. 
     531The overall performance of the advection scheme is similar to that reported in \citet{farrow.stevens_JPO95}. 
    527532It is a relatively good compromise between accuracy and smoothness. 
    528533It is not a \emph{positive} scheme, meaning that false extrema are permitted. 
    529534But the amplitudes of the false extrema are significantly reduced over those in the centred second order method. 
    530 As the scheme already includes a diffusion component, it can be used without explicit lateral diffusion on momentum  
    531 (\ie \np{ln\_dynldf\_lap}\forcode{ = }\np{ln\_dynldf\_bilap}\forcode{ = .false.}), 
     535As the scheme already includes a diffusion component, it can be used without explicit lateral diffusion on momentum 
     536(\ie\ \np{ln\_dynldf\_lap}\forcode{=}\np{ln\_dynldf\_bilap}\forcode{=.false.}), 
    532537and it is recommended to do so. 
    533538 
    534539The UBS scheme is not used in all directions. 
    535 In the vertical, the centred $2^{nd}$ order evaluation of the advection is preferred, \ie $u_{uw}^{ubs}$ and 
    536 $u_{vw}^{ubs}$ in \autoref{eq:dynadv_cen2} are used. 
    537 UBS is diffusive and is associated with vertical mixing of momentum. \gmcomment{ gm  pursue the  
     540In the vertical, the centred $2^{nd}$ order evaluation of the advection is preferred, \ie\ $u_{uw}^{ubs}$ and 
     541$u_{vw}^{ubs}$ in \autoref{eq:DYN_adv_cen2} are used. 
     542UBS is diffusive and is associated with vertical mixing of momentum. \gmcomment{ gm  pursue the 
    538543sentence:Since vertical mixing of momentum is a source term of the TKE equation...  } 
    539544 
    540 For stability reasons, the first term in (\autoref{eq:dynadv_ubs}), 
     545For stability reasons, the first term in (\autoref{eq:DYN_adv_ubs}), 
    541546which corresponds to a second order centred scheme, is evaluated using the \textit{now} velocity (centred in time), 
    542547while the second term, which is the diffusion part of the scheme, 
    543548is evaluated using the \textit{before} velocity (forward in time). 
    544 This is discussed by \citet{Webb_al_JAOT98} in the context of the Quick advection scheme. 
     549This is discussed by \citet{webb.de-cuevas.ea_JAOT98} in the context of the Quick advection scheme. 
    545550 
    546551Note that the UBS and QUICK (Quadratic Upstream Interpolation for Convective Kinematics) schemes only differ by 
    547552one coefficient. 
    548 Replacing $1/6$ by $1/8$ in (\autoref{eq:dynadv_ubs}) leads to the QUICK advection scheme \citep{Webb_al_JAOT98}. 
     553Replacing $1/6$ by $1/8$ in (\autoref{eq:DYN_adv_ubs}) leads to the QUICK advection scheme \citep{webb.de-cuevas.ea_JAOT98}. 
    549554This option is not available through a namelist parameter, since the $1/6$ coefficient is hard coded. 
    550555Nevertheless it is quite easy to make the substitution in the \mdl{dynadv\_ubs} module and obtain a QUICK scheme. 
     
    560565%           Hydrostatic pressure gradient term 
    561566% ================================================================ 
    562 \section{Hydrostatic pressure gradient (\protect\mdl{dynhpg})} 
     567\section[Hydrostatic pressure gradient (\textit{dynhpg.F90})]{Hydrostatic pressure gradient (\protect\mdl{dynhpg})} 
    563568\label{sec:DYN_hpg} 
    564569%------------------------------------------nam_dynhpg--------------------------------------------------- 
    565570 
    566 \nlst{namdyn_hpg}  
     571\begin{listing} 
     572  \nlst{namdyn_hpg} 
     573  \caption{\texttt{namdyn\_hpg}} 
     574  \label{lst:namdyn_hpg} 
     575\end{listing} 
    567576%------------------------------------------------------------------------------------------------------------- 
    568577 
    569 Options are defined through the \ngn{namdyn\_hpg} namelist variables. 
     578Options are defined through the \nam{dyn\_hpg} namelist variables. 
    570579The key distinction between the different algorithms used for 
    571580the hydrostatic pressure gradient is the vertical coordinate used, 
    572 since HPG is a \emph{horizontal} pressure gradient, \ie computed along geopotential surfaces. 
     581since HPG is a \emph{horizontal} pressure gradient, \ie\ computed along geopotential surfaces. 
    573582As a result, any tilt of the surface of the computational levels will require a specific treatment to 
    574583compute the hydrostatic pressure gradient. 
    575584 
    576585The hydrostatic pressure gradient term is evaluated either using a leapfrog scheme, 
    577 \ie the density appearing in its expression is centred in time (\emph{now} $\rho$), 
     586\ie\ the density appearing in its expression is centred in time (\emph{now} $\rho$), 
    578587or a semi-implcit scheme. 
    579588At the lateral boundaries either free slip, no slip or partial slip boundary conditions are applied. 
     
    582591%           z-coordinate with full step 
    583592%-------------------------------------------------------------------------------------------------------------- 
    584 \subsection{Full step $Z$-coordinate (\protect\np{ln\_dynhpg\_zco}\forcode{ = .true.})} 
     593\subsection[Full step $Z$-coordinate (\forcode{ln_dynhpg_zco = .true.})]{Full step $Z$-coordinate (\protect\np{ln\_dynhpg\_zco}\forcode{ = .true.})} 
    585594\label{subsec:DYN_hpg_zco} 
    586595 
     
    592601for $k=km$ (surface layer, $jk=1$ in the code) 
    593602\begin{equation} 
    594   \label{eq:dynhpg_zco_surf} 
     603  \label{eq:DYN_hpg_zco_surf} 
    595604  \left\{ 
    596605    \begin{aligned} 
     
    601610    \end{aligned} 
    602611  \right. 
    603 \end{equation}  
     612\end{equation} 
    604613 
    605614for $1<k<km$ (interior layer) 
    606615\begin{equation} 
    607   \label{eq:dynhpg_zco} 
     616  \label{eq:DYN_hpg_zco} 
    608617  \left\{ 
    609618    \begin{aligned} 
     
    616625    \end{aligned} 
    617626  \right. 
    618 \end{equation}  
    619  
    620 Note that the $1/2$ factor in (\autoref{eq:dynhpg_zco_surf}) is adequate because of the definition of $e_{3w}$ as 
     627\end{equation} 
     628 
     629Note that the $1/2$ factor in (\autoref{eq:DYN_hpg_zco_surf}) is adequate because of the definition of $e_{3w}$ as 
    621630the vertical derivative of the scale factor at the surface level ($z=0$). 
    622 Note also that in case of variable volume level (\key{vvl} defined), 
    623 the surface pressure gradient is included in \autoref{eq:dynhpg_zco_surf} and 
    624 \autoref{eq:dynhpg_zco} through the space and time variations of the vertical scale factor $e_{3w}$. 
     631Note also that in case of variable volume level (\texttt{vvl?} defined), 
     632the surface pressure gradient is included in \autoref{eq:DYN_hpg_zco_surf} and 
     633\autoref{eq:DYN_hpg_zco} through the space and time variations of the vertical scale factor $e_{3w}$. 
    625634 
    626635%-------------------------------------------------------------------------------------------------------------- 
    627636%           z-coordinate with partial step 
    628637%-------------------------------------------------------------------------------------------------------------- 
    629 \subsection{Partial step $Z$-coordinate (\protect\np{ln\_dynhpg\_zps}\forcode{ = .true.})} 
     638\subsection[Partial step $Z$-coordinate (\forcode{ln_dynhpg_zps = .true.})]{Partial step $Z$-coordinate (\protect\np{ln\_dynhpg\_zps}\forcode{ = .true.})} 
    630639\label{subsec:DYN_hpg_zps} 
    631640 
     
    633642Before taking horizontal gradients between these tracer points, 
    634643a linear interpolation is used to approximate the deeper tracer as if 
    635 it actually lived at the depth of the shallower tracer point.  
     644it actually lived at the depth of the shallower tracer point. 
    636645 
    637646Apart from this modification, 
     
    652661 
    653662Pressure gradient formulations in an $s$-coordinate have been the subject of a vast number of papers 
    654 (\eg, \citet{Song1998, Shchepetkin_McWilliams_OM05}).  
     663(\eg, \citet{song_MWR98, shchepetkin.mcwilliams_OM05}). 
    655664A number of different pressure gradient options are coded but the ROMS-like, 
    656665density Jacobian with cubic polynomial method is currently disabled whilst known bugs are under investigation. 
    657666 
    658 $\bullet$ Traditional coding (see for example \citet{Madec_al_JPO96}: (\np{ln\_dynhpg\_sco}\forcode{ = .true.}) 
    659 \begin{equation} 
    660   \label{eq:dynhpg_sco} 
     667$\bullet$ Traditional coding (see for example \citet{madec.delecluse.ea_JPO96}: (\np{ln\_dynhpg\_sco}\forcode{=.true.}) 
     668\begin{equation} 
     669  \label{eq:DYN_hpg_sco} 
    661670  \left\{ 
    662671    \begin{aligned} 
     
    667676    \end{aligned} 
    668677  \right. 
    669 \end{equation}  
     678\end{equation} 
    670679 
    671680Where the first term is the pressure gradient along coordinates, 
    672 computed as in \autoref{eq:dynhpg_zco_surf} - \autoref{eq:dynhpg_zco}, 
    673 and $z_T$ is the depth of the $T$-point evaluated from the sum of the vertical scale factors at the $w$-point  
     681computed as in \autoref{eq:DYN_hpg_zco_surf} - \autoref{eq:DYN_hpg_zco}, 
     682and $z_T$ is the depth of the $T$-point evaluated from the sum of the vertical scale factors at the $w$-point 
    674683($e_{3w}$). 
    675   
    676 $\bullet$ Traditional coding with adaptation for ice shelf cavities (\np{ln\_dynhpg\_isf}\forcode{ = .true.}). 
    677 This scheme need the activation of ice shelf cavities (\np{ln\_isfcav}\forcode{ = .true.}). 
    678  
    679 $\bullet$ Pressure Jacobian scheme (prj) (a research paper in preparation) (\np{ln\_dynhpg\_prj}\forcode{ = .true.}) 
    680  
    681 $\bullet$ Density Jacobian with cubic polynomial scheme (DJC) \citep{Shchepetkin_McWilliams_OM05}  
    682 (\np{ln\_dynhpg\_djc}\forcode{ = .true.}) (currently disabled; under development) 
    683  
    684 Note that expression \autoref{eq:dynhpg_sco} is commonly used when the variable volume formulation is activated 
    685 (\key{vvl}) because in that case, even with a flat bottom, 
    686 the coordinate surfaces are not horizontal but follow the free surface \citep{Levier2007}. 
    687 The pressure jacobian scheme (\np{ln\_dynhpg\_prj}\forcode{ = .true.}) is available as 
    688 an improved option to \np{ln\_dynhpg\_sco}\forcode{ = .true.} when \key{vvl} is active. 
     684 
     685$\bullet$ Traditional coding with adaptation for ice shelf cavities (\np{ln\_dynhpg\_isf}\forcode{=.true.}). 
     686This scheme need the activation of ice shelf cavities (\np{ln\_isfcav}\forcode{=.true.}). 
     687 
     688$\bullet$ Pressure Jacobian scheme (prj) (a research paper in preparation) (\np{ln\_dynhpg\_prj}\forcode{=.true.}) 
     689 
     690$\bullet$ Density Jacobian with cubic polynomial scheme (DJC) \citep{shchepetkin.mcwilliams_OM05} 
     691(\np{ln\_dynhpg\_djc}\forcode{=.true.}) (currently disabled; under development) 
     692 
     693Note that expression \autoref{eq:DYN_hpg_sco} is commonly used when the variable volume formulation is activated 
     694(\texttt{vvl?}) because in that case, even with a flat bottom, 
     695the coordinate surfaces are not horizontal but follow the free surface \citep{levier.treguier.ea_rpt07}. 
     696The pressure jacobian scheme (\np{ln\_dynhpg\_prj}\forcode{=.true.}) is available as 
     697an improved option to \np{ln\_dynhpg\_sco}\forcode{=.true.} when \texttt{vvl?} is active. 
    689698The pressure Jacobian scheme uses a constrained cubic spline to 
    690699reconstruct the density profile across the water column. 
     
    696705\subsection{Ice shelf cavity} 
    697706\label{subsec:DYN_hpg_isf} 
     707 
    698708Beneath an ice shelf, the total pressure gradient is the sum of the pressure gradient due to the ice shelf load and 
    699 the pressure gradient due to the ocean load (\np{ln\_dynhpg\_isf}\forcode{ = .true.}).\\ 
     709the pressure gradient due to the ocean load (\np{ln\_dynhpg\_isf}\forcode{=.true.}).\\ 
    700710 
    701711The main hypothesis to compute the ice shelf load is that the ice shelf is in an isostatic equilibrium. 
     
    704714corresponds to the water replaced by the ice shelf. 
    705715This top pressure is constant over time. 
    706 A detailed description of this method is described in \citet{Losch2008}.\\ 
    707  
    708 The pressure gradient due to ocean load is computed using the expression \autoref{eq:dynhpg_sco} described in 
    709 \autoref{subsec:DYN_hpg_sco}.  
     716A detailed description of this method is described in \citet{losch_JGR08}.\\ 
     717 
     718The pressure gradient due to ocean load is computed using the expression \autoref{eq:DYN_hpg_sco} described in 
     719\autoref{subsec:DYN_hpg_sco}. 
    710720 
    711721%-------------------------------------------------------------------------------------------------------------- 
    712722%           Time-scheme 
    713723%-------------------------------------------------------------------------------------------------------------- 
    714 \subsection{Time-scheme (\protect\np{ln\_dynhpg\_imp}\forcode{ = .true./.false.})} 
     724\subsection[Time-scheme (\forcode{ln_dynhpg_imp = .{true,false}.})]{Time-scheme (\protect\np{ln\_dynhpg\_imp}\forcode{ = .\{true,false\}}.)} 
    715725\label{subsec:DYN_hpg_imp} 
    716726 
     
    722732the physical phenomenon that controls the time-step is internal gravity waves (IGWs). 
    723733A semi-implicit scheme for doubling the stability limit associated with IGWs can be used 
    724 \citep{Brown_Campana_MWR78, Maltrud1998}. 
     734\citep{brown.campana_MWR78, maltrud.smith.ea_JGR98}. 
    725735It involves the evaluation of the hydrostatic pressure gradient as 
    726736an average over the three time levels $t-\rdt$, $t$, and $t+\rdt$ 
    727 (\ie \textit{before}, \textit{now} and  \textit{after} time-steps), 
    728 rather than at the central time level $t$ only, as in the standard leapfrog scheme.  
    729  
    730 $\bullet$ leapfrog scheme (\np{ln\_dynhpg\_imp}\forcode{ = .true.}): 
    731  
    732 \begin{equation} 
    733   \label{eq:dynhpg_lf} 
     737(\ie\ \textit{before}, \textit{now} and  \textit{after} time-steps), 
     738rather than at the central time level $t$ only, as in the standard leapfrog scheme. 
     739 
     740$\bullet$ leapfrog scheme (\np{ln\_dynhpg\_imp}\forcode{=.true.}): 
     741 
     742\begin{equation} 
     743  \label{eq:DYN_hpg_lf} 
    734744  \frac{u^{t+\rdt}-u^{t-\rdt}}{2\rdt} = \;\cdots \; 
    735745  -\frac{1}{\rho_o \,e_{1u} }\delta_{i+1/2} \left[ {p_h^t } \right] 
    736746\end{equation} 
    737747 
    738 $\bullet$ semi-implicit scheme (\np{ln\_dynhpg\_imp}\forcode{ = .true.}): 
    739 \begin{equation} 
    740   \label{eq:dynhpg_imp} 
     748$\bullet$ semi-implicit scheme (\np{ln\_dynhpg\_imp}\forcode{=.true.}): 
     749\begin{equation} 
     750  \label{eq:DYN_hpg_imp} 
    741751  \frac{u^{t+\rdt}-u^{t-\rdt}}{2\rdt} = \;\cdots \; 
    742752  -\frac{1}{4\,\rho_o \,e_{1u} } \delta_{i+1/2} \left[ p_h^{t+\rdt} +2\,p_h^t +p_h^{t-\rdt}  \right] 
    743753\end{equation} 
    744754 
    745 The semi-implicit time scheme \autoref{eq:dynhpg_imp} is made possible without 
     755The semi-implicit time scheme \autoref{eq:DYN_hpg_imp} is made possible without 
    746756significant additional computation since the density can be updated to time level $t+\rdt$ before 
    747757computing the horizontal hydrostatic pressure gradient. 
    748758It can be easily shown that the stability limit associated with the hydrostatic pressure gradient doubles using 
    749 \autoref{eq:dynhpg_imp} compared to that using the standard leapfrog scheme \autoref{eq:dynhpg_lf}. 
    750 Note that \autoref{eq:dynhpg_imp} is equivalent to applying a time filter to the pressure gradient to 
     759\autoref{eq:DYN_hpg_imp} compared to that using the standard leapfrog scheme \autoref{eq:DYN_hpg_lf}. 
     760Note that \autoref{eq:DYN_hpg_imp} is equivalent to applying a time filter to the pressure gradient to 
    751761eliminate high frequency IGWs. 
    752 Obviously, when using \autoref{eq:dynhpg_imp}, 
     762Obviously, when using \autoref{eq:DYN_hpg_imp}, 
    753763the doubling of the time-step is achievable only if no other factors control the time-step, 
    754764such as the stability limits associated with advection or diffusion. 
    755765 
    756 In practice, the semi-implicit scheme is used when \np{ln\_dynhpg\_imp}\forcode{ = .true.}. 
     766In practice, the semi-implicit scheme is used when \np{ln\_dynhpg\_imp}\forcode{=.true.}. 
    757767In this case, we choose to apply the time filter to temperature and salinity used in the equation of state, 
    758768instead of applying it to the hydrostatic pressure or to the density, 
     
    760770The density used to compute the hydrostatic pressure gradient (whatever the formulation) is evaluated as follows: 
    761771\[ 
    762   % \label{eq:rho_flt} 
     772  % \label{eq:DYN_rho_flt} 
    763773  \rho^t = \rho( \widetilde{T},\widetilde {S},z_t) 
    764774  \quad    \text{with}  \quad 
     
    773783% Surface Pressure Gradient 
    774784% ================================================================ 
    775 \section{Surface pressure gradient (\protect\mdl{dynspg})} 
     785\section[Surface pressure gradient (\textit{dynspg.F90})]{Surface pressure gradient (\protect\mdl{dynspg})} 
    776786\label{sec:DYN_spg} 
    777787%-----------------------------------------nam_dynspg---------------------------------------------------- 
    778788 
    779 \nlst{namdyn_spg}  
     789\begin{listing} 
     790  \nlst{namdyn_spg} 
     791  \caption{\texttt{namdyn\_spg}} 
     792  \label{lst:namdyn_spg} 
     793\end{listing} 
    780794%------------------------------------------------------------------------------------------------------------ 
    781795 
    782 Options are defined through the \ngn{namdyn\_spg} namelist variables. 
    783 The surface pressure gradient term is related to the representation of the free surface (\autoref{sec:PE_hor_pg}). 
     796Options are defined through the \nam{dyn\_spg} namelist variables. 
     797The surface pressure gradient term is related to the representation of the free surface (\autoref{sec:MB_hor_pg}). 
    784798The main distinction is between the fixed volume case (linear free surface) and 
    785 the variable volume case (nonlinear free surface, \key{vvl} is defined). 
    786 In the linear free surface case (\autoref{subsec:PE_free_surface}) 
     799the variable volume case (nonlinear free surface, \texttt{vvl?} is defined). 
     800In the linear free surface case (\autoref{subsec:MB_free_surface}) 
    787801the vertical scale factors $e_{3}$ are fixed in time, 
    788 while they are time-dependent in the nonlinear case (\autoref{subsec:PE_free_surface}). 
    789 With both linear and nonlinear free surface, external gravity waves are allowed in the equations,  
     802while they are time-dependent in the nonlinear case (\autoref{subsec:MB_free_surface}). 
     803With both linear and nonlinear free surface, external gravity waves are allowed in the equations, 
    790804which imposes a very small time step when an explicit time stepping is used. 
    791 Two methods are proposed to allow a longer time step for the three-dimensional equations:  
    792 the filtered free surface, which is a modification of the continuous equations (see \autoref{eq:PE_flt}),  
     805Two methods are proposed to allow a longer time step for the three-dimensional equations: 
     806the filtered free surface, which is a modification of the continuous equations (see \autoref{eq:MB_flt?}), 
    793807and the split-explicit free surface described below. 
    794 The extra term introduced in the filtered method is calculated implicitly,  
     808The extra term introduced in the filtered method is calculated implicitly, 
    795809so that the update of the next velocities is done in module \mdl{dynspg\_flt} and not in \mdl{dynnxt}. 
    796810 
    797811 
    798812The form of the surface pressure gradient term depends on how the user wants to 
    799 handle the fast external gravity waves that are a solution of the analytical equation (\autoref{sec:PE_hor_pg}). 
     813handle the fast external gravity waves that are a solution of the analytical equation (\autoref{sec:MB_hor_pg}). 
    800814Three formulations are available, all controlled by a CPP key (ln\_dynspg\_xxx): 
    801815an explicit formulation which requires a small time step; 
    802816a filtered free surface formulation which allows a larger time step by 
    803 adding a filtering term into the momentum equation;  
     817adding a filtering term into the momentum equation; 
    804818and a split-explicit free surface formulation, described below, which also allows a larger time step. 
    805819 
     
    811825% Explicit free surface formulation 
    812826%-------------------------------------------------------------------------------------------------------------- 
    813 \subsection{Explicit free surface (\protect\key{dynspg\_exp})} 
     827\subsection[Explicit free surface (\texttt{ln\_dynspg\_exp}\forcode{ = .true.})]{Explicit free surface (\protect\np{ln\_dynspg\_exp}\forcode{ = .true.})} 
    814828\label{subsec:DYN_spg_exp} 
    815829 
    816 In the explicit free surface formulation (\key{dynspg\_exp} defined), 
     830In the explicit free surface formulation (\np{ln\_dynspg\_exp} set to true), 
    817831the model time step is chosen to be small enough to resolve the external gravity waves 
    818832(typically a few tens of seconds). 
    819 The surface pressure gradient, evaluated using a leap-frog scheme (\ie centered in time), 
     833The surface pressure gradient, evaluated using a leap-frog scheme (\ie\ centered in time), 
    820834is thus simply given by : 
    821835\begin{equation} 
    822   \label{eq:dynspg_exp} 
     836  \label{eq:DYN_spg_exp} 
    823837  \left\{ 
    824838    \begin{aligned} 
     
    827841    \end{aligned} 
    828842  \right. 
    829 \end{equation}  
    830  
    831 Note that in the non-linear free surface case (\ie \key{vvl} defined), 
     843\end{equation} 
     844 
     845Note that in the non-linear free surface case (\ie\ \texttt{vvl?} defined), 
    832846the surface pressure gradient is already included in the momentum tendency through 
    833847the level thickness variation allowed in the computation of the hydrostatic pressure gradient. 
     
    837851% Split-explict free surface formulation 
    838852%-------------------------------------------------------------------------------------------------------------- 
    839 \subsection{Split-explicit free surface (\protect\key{dynspg\_ts})} 
     853\subsection[Split-explicit free surface (\texttt{ln\_dynspg\_ts}\forcode{ = .true.})]{Split-explicit free surface (\protect\np{ln\_dynspg\_ts}\forcode{ = .true.})} 
    840854\label{subsec:DYN_spg_ts} 
    841855%------------------------------------------namsplit----------------------------------------------------------- 
     
    844858%------------------------------------------------------------------------------------------------------------- 
    845859 
    846 The split-explicit free surface formulation used in \NEMO (\key{dynspg\_ts} defined), 
    847 also called the time-splitting formulation, follows the one proposed by \citet{Shchepetkin_McWilliams_OM05}. 
     860The split-explicit free surface formulation used in \NEMO\ (\np{ln\_dynspg\_ts} set to true), 
     861also called the time-splitting formulation, follows the one proposed by \citet{shchepetkin.mcwilliams_OM05}. 
    848862The general idea is to solve the free surface equation and the associated barotropic velocity equations with 
    849863a smaller time step than $\rdt$, the time step used for the three dimensional prognostic variables 
    850 (\autoref{fig:DYN_dynspg_ts}). 
     864(\autoref{fig:DYN_spg_ts}). 
    851865The size of the small time step, $\rdt_e$ (the external mode or barotropic time step) is provided through 
    852866the \np{nn\_baro} namelist parameter as: $\rdt_e = \rdt / nn\_baro$. 
    853 This parameter can be optionally defined automatically (\np{ln\_bt\_nn\_auto}\forcode{ = .true.}) considering that 
     867This parameter can be optionally defined automatically (\np{ln\_bt\_nn\_auto}\forcode{=.true.}) considering that 
    854868the stability of the barotropic system is essentially controled by external waves propagation. 
    855869Maximum Courant number is in that case time independent, and easily computed online from the input bathymetry. 
     
    859873The barotropic mode solves the following equations: 
    860874% \begin{subequations} 
    861 %  \label{eq:BT} 
    862 \begin{equation} 
    863   \label{eq:BT_dyn} 
    864   \frac{\partial {\rm \overline{{\bf U}}_h} }{\partial t}= 
    865   -f\;{\rm {\bf k}}\times {\rm \overline{{\bf U}}_h} 
    866   -g\nabla _h \eta -\frac{c_b^{\textbf U}}{H+\eta} \rm {\overline{{\bf U}}_h} + \rm {\overline{\bf G}} 
    867 \end{equation} 
    868 \[ 
    869   % \label{eq:BT_ssh} 
    870   \frac{\partial \eta }{\partial t}=-\nabla \cdot \left[ {\left( {H+\eta } \right) \; {\rm{\bf \overline{U}}}_h \,} \right]+P-E 
     875%  \label{eq:DYN_BT} 
     876\begin{equation} 
     877  \label{eq:DYN_BT_dyn} 
     878  \frac{\partial {\mathrm \overline{{\mathbf U}}_h} }{\partial t}= 
     879  -f\;{\mathrm {\mathbf k}}\times {\mathrm \overline{{\mathbf U}}_h} 
     880  -g\nabla _h \eta -\frac{c_b^{\textbf U}}{H+\eta} \mathrm {\overline{{\mathbf U}}_h} + \mathrm {\overline{\mathbf G}} 
     881\end{equation} 
     882\[ 
     883  % \label{eq:DYN_BT_ssh} 
     884  \frac{\partial \eta }{\partial t}=-\nabla \cdot \left[ {\left( {H+\eta } \right) \; {\mathrm{\mathbf \overline{U}}}_h \,} \right]+P-E 
    871885\] 
    872886% \end{subequations} 
    873 where $\rm {\overline{\bf G}}$ is a forcing term held constant, containing coupling term between modes, 
     887where $\mathrm {\overline{\mathbf G}}$ is a forcing term held constant, containing coupling term between modes, 
    874888surface atmospheric forcing as well as slowly varying barotropic terms not explicitly computed to gain efficiency. 
    875 The third term on the right hand side of \autoref{eq:BT_dyn} represents the bottom stress 
    876 (see section \autoref{sec:ZDF_bfr}), explicitly accounted for at each barotropic iteration. 
     889The third term on the right hand side of \autoref{eq:DYN_BT_dyn} represents the bottom stress 
     890(see section \autoref{sec:ZDF_drg}), explicitly accounted for at each barotropic iteration. 
    877891Temporal discretization of the system above follows a three-time step Generalized Forward Backward algorithm 
    878 detailed in \citet{Shchepetkin_McWilliams_OM05}. 
    879 AB3-AM4 coefficients used in \NEMO follow the second-order accurate, 
    880 "multi-purpose" stability compromise as defined in \citet{Shchepetkin_McWilliams_Bk08} 
    881 (see their figure 12, lower left).  
     892detailed in \citet{shchepetkin.mcwilliams_OM05}. 
     893AB3-AM4 coefficients used in \NEMO\ follow the second-order accurate, 
     894"multi-purpose" stability compromise as defined in \citet{shchepetkin.mcwilliams_ibk09} 
     895(see their figure 12, lower left). 
    882896 
    883897%>   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   > 
    884898\begin{figure}[!t] 
    885   \begin{center} 
    886     \includegraphics[width=0.7\textwidth]{Fig_DYN_dynspg_ts} 
    887     \caption{ 
    888       \protect\label{fig:DYN_dynspg_ts} 
    889       Schematic of the split-explicit time stepping scheme for the external and internal modes. 
    890       Time increases to the right. In this particular exemple, 
    891       a boxcar averaging window over $nn\_baro$ barotropic time steps is used ($nn\_bt\_flt=1$) and $nn\_baro=5$. 
    892       Internal mode time steps (which are also the model time steps) are denoted by $t-\rdt$, $t$ and $t+\rdt$. 
    893       Variables with $k$ superscript refer to instantaneous barotropic variables, 
    894       $< >$ and $<< >>$ operator refer to time filtered variables using respectively primary (red vertical bars) and 
    895       secondary weights (blue vertical bars). 
    896       The former are used to obtain time filtered quantities at $t+\rdt$ while 
    897       the latter are used to obtain time averaged transports to advect tracers. 
    898       a) Forward time integration: \protect\np{ln\_bt\_fw}\forcode{ = .true.}, 
    899       \protect\np{ln\_bt\_av}\forcode{ = .true.}. 
    900       b) Centred time integration: \protect\np{ln\_bt\_fw}\forcode{ = .false.}, 
    901       \protect\np{ln\_bt\_av}\forcode{ = .true.}. 
    902       c) Forward time integration with no time filtering (POM-like scheme): 
    903       \protect\np{ln\_bt\_fw}\forcode{ = .true.}, \protect\np{ln\_bt\_av}\forcode{ = .false.}. 
    904     } 
    905   \end{center} 
     899  \centering 
     900  \includegraphics[width=\textwidth]{Fig_DYN_dynspg_ts} 
     901  \caption[Split-explicit time stepping scheme for the external and internal modes]{ 
     902    Schematic of the split-explicit time stepping scheme for the external and internal modes. 
     903    Time increases to the right. 
     904    In this particular exemple, 
     905    a boxcar averaging window over \np{nn\_baro} barotropic time steps is used 
     906    (\np{nn\_bt\_flt}\forcode{=1}) and \np{nn\_baro}\forcode{=5}. 
     907    Internal mode time steps (which are also the model time steps) are denoted by 
     908    $t-\rdt$, $t$ and $t+\rdt$. 
     909    Variables with $k$ superscript refer to instantaneous barotropic variables, 
     910    $< >$ and $<< >>$ operator refer to time filtered variables using respectively primary 
     911    (red vertical bars) and secondary weights (blue vertical bars). 
     912    The former are used to obtain time filtered quantities at $t+\rdt$ while 
     913    the latter are used to obtain time averaged transports to advect tracers. 
     914    a) Forward time integration: 
     915    \protect\np{ln\_bt\_fw}\forcode{=.true.},  \protect\np{ln\_bt\_av}\forcode{=.true.}. 
     916    b) Centred time integration: 
     917    \protect\np{ln\_bt\_fw}\forcode{=.false.}, \protect\np{ln\_bt\_av}\forcode{=.true.}. 
     918    c) Forward time integration with no time filtering (POM-like scheme): 
     919    \protect\np{ln\_bt\_fw}\forcode{=.true.},  \protect\np{ln\_bt\_av}\forcode{=.false.}.} 
     920  \label{fig:DYN_spg_ts} 
    906921\end{figure} 
    907922%>   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   > 
    908923 
    909 In the default case (\np{ln\_bt\_fw}\forcode{ = .true.}), 
     924In the default case (\np{ln\_bt\_fw}\forcode{=.true.}), 
    910925the external mode is integrated between \textit{now} and \textit{after} baroclinic time-steps 
    911 (\autoref{fig:DYN_dynspg_ts}a). 
     926(\autoref{fig:DYN_spg_ts}a). 
    912927To avoid aliasing of fast barotropic motions into three dimensional equations, 
    913 time filtering is eventually applied on barotropic quantities (\np{ln\_bt\_av}\forcode{ = .true.}). 
     928time filtering is eventually applied on barotropic quantities (\np{ln\_bt\_av}\forcode{=.true.}). 
    914929In that case, the integration is extended slightly beyond \textit{after} time step to 
    915930provide time filtered quantities. 
    916931These are used for the subsequent initialization of the barotropic mode in the following baroclinic step. 
    917 Since external mode equations written at baroclinic time steps finally follow a forward time stepping scheme,  
     932Since external mode equations written at baroclinic time steps finally follow a forward time stepping scheme, 
    918933asselin filtering is not applied to barotropic quantities.\\ 
    919934Alternatively, one can choose to integrate barotropic equations starting from \textit{before} time step 
    920 (\np{ln\_bt\_fw}\forcode{ = .false.}). 
     935(\np{ln\_bt\_fw}\forcode{=.false.}). 
    921936Although more computationaly expensive ( \np{nn\_baro} additional iterations are indeed necessary), 
    922937the baroclinic to barotropic forcing term given at \textit{now} time step become centred in 
     
    936951and time splitting not compatible. 
    937952Advective barotropic velocities are obtained by using a secondary set of filtering weights, 
    938 uniquely defined from the filter coefficients used for the time averaging (\citet{Shchepetkin_McWilliams_OM05}). 
     953uniquely defined from the filter coefficients used for the time averaging (\citet{shchepetkin.mcwilliams_OM05}). 
    939954Consistency between the time averaged continuity equation and the time stepping of tracers is here the key to 
    940955obtain exact conservation. 
     
    943958 
    944959One can eventually choose to feedback instantaneous values by not using any time filter 
    945 (\np{ln\_bt\_av}\forcode{ = .false.}).  
     960(\np{ln\_bt\_av}\forcode{=.false.}). 
    946961In that case, external mode equations are continuous in time, 
    947 \ie they are not re-initialized when starting a new sub-stepping sequence. 
     962\ie\ they are not re-initialized when starting a new sub-stepping sequence. 
    948963This is the method used so far in the POM model, the stability being maintained by 
    949964refreshing at (almost) each barotropic time step advection and horizontal diffusion terms. 
    950 Since the latter terms have not been added in \NEMO for computational efficiency, 
     965Since the latter terms have not been added in \NEMO\ for computational efficiency, 
    951966removing time filtering is not recommended except for debugging purposes. 
    952967This may be used for instance to appreciate the damping effect of the standard formulation on 
    953968external gravity waves in idealized or weakly non-linear cases. 
    954969Although the damping is lower than for the filtered free surface, 
    955 it is still significant as shown by \citet{Levier2007} in the case of an analytical barotropic Kelvin wave. 
     970it is still significant as shown by \citet{levier.treguier.ea_rpt07} in the case of an analytical barotropic Kelvin wave. 
    956971 
    957972%>>>>>=============== 
    958 \gmcomment{               %%% copy from griffies Book  
     973\gmcomment{               %%% copy from griffies Book 
    959974 
    960975\textbf{title: Time stepping the barotropic system } 
     
    963978Hence, we can update the surface height and vertically integrated velocity with a leap-frog scheme using 
    964979the small barotropic time step $\rdt$. 
    965 We have  
     980We have 
    966981 
    967982\[ 
     
    9861001and total depth of the ocean $H(\tau)$ are held for the duration of the barotropic time stepping over 
    9871002a single cycle. 
    988 This is also the time that sets the barotropic time steps via  
     1003This is also the time that sets the barotropic time steps via 
    9891004\[ 
    9901005  % \label{eq:DYN_spg_ts_t} 
     
    9921007\] 
    9931008with $n$ an integer. 
    994 The density scaled surface pressure is evaluated via  
     1009The density scaled surface pressure is evaluated via 
    9951010\[ 
    9961011  % \label{eq:DYN_spg_ts_ps} 
     
    10011016  \end{cases} 
    10021017\] 
    1003 To get started, we assume the following initial conditions  
     1018To get started, we assume the following initial conditions 
    10041019\[ 
    10051020  % \label{eq:DYN_spg_ts_eta} 
     
    10091024  \end{split} 
    10101025\] 
    1011 with  
     1026with 
    10121027\[ 
    10131028  % \label{eq:DYN_spg_ts_etaF} 
     
    10151030\] 
    10161031the time averaged surface height taken from the previous barotropic cycle. 
    1017 Likewise,  
     1032Likewise, 
    10181033\[ 
    10191034  % \label{eq:DYN_spg_ts_u} 
     
    10211036  \textbf{U}(\tau,t_{n=1}) = \textbf{U}^{(b)}(\tau,t_{n=0}) + \rdt \ \text{RHS}_{n=0} 
    10221037\] 
    1023 with  
     1038with 
    10241039\[ 
    10251040  % \label{eq:DYN_spg_ts_u} 
     
    10271042\] 
    10281043the time averaged vertically integrated transport. 
    1029 Notably, there is no Robert-Asselin time filter used in the barotropic portion of the integration.  
     1044Notably, there is no Robert-Asselin time filter used in the barotropic portion of the integration. 
    10301045 
    10311046Upon reaching $t_{n=N} = \tau + 2\rdt \tau$ , 
    10321047the vertically integrated velocity is time averaged to produce the updated vertically integrated velocity at 
    1033 baroclinic time $\tau + \rdt \tau$  
     1048baroclinic time $\tau + \rdt \tau$ 
    10341049\[ 
    10351050  % \label{eq:DYN_spg_ts_u} 
     
    10371052\] 
    10381053The surface height on the new baroclinic time step is then determined via a baroclinic leap-frog using 
    1039 the following form  
     1054the following form 
    10401055 
    10411056\begin{equation} 
    10421057  \label{eq:DYN_spg_ts_ssh} 
    1043   \eta(\tau+\Delta) - \eta^{F}(\tau-\Delta) = 2\rdt \ \left[ - \nabla \cdot \textbf{U}(\tau) + \text{EMP}_w \right]   
     1058  \eta(\tau+\Delta) - \eta^{F}(\tau-\Delta) = 2\rdt \ \left[ - \nabla \cdot \textbf{U}(\tau) + \text{EMP}_w \right] 
    10441059\end{equation} 
    10451060 
    10461061The use of this "big-leap-frog" scheme for the surface height ensures compatibility between 
    10471062the mass/volume budgets and the tracer budgets. 
    1048 More discussion of this point is provided in Chapter 10 (see in particular Section 10.2).  
    1049   
     1063More discussion of this point is provided in Chapter 10 (see in particular Section 10.2). 
     1064 
    10501065In general, some form of time filter is needed to maintain integrity of the surface height field due to 
    10511066the leap-frog splitting mode in equation \autoref{eq:DYN_spg_ts_ssh}. 
    10521067We have tried various forms of such filtering, 
    1053 with the following method discussed in \cite{Griffies_al_MWR01} chosen due to 
     1068with the following method discussed in \cite{griffies.pacanowski.ea_MWR01} chosen due to 
    10541069its stability and reasonably good maintenance of tracer conservation properties (see ??). 
    10551070 
     
    10581073  \eta^{F}(\tau-\Delta) =  \overline{\eta^{(b)}(\tau)} 
    10591074\end{equation} 
    1060 Another approach tried was  
     1075Another approach tried was 
    10611076 
    10621077\[ 
     
    10711086eliminating tracer and surface height time filtering (see ?? for more complete discussion). 
    10721087However, in the general case with a non-zero $\alpha$, 
    1073 the filter \autoref{eq:DYN_spg_ts_sshf} was found to be more conservative, and so is recommended.  
     1088the filter \autoref{eq:DYN_spg_ts_sshf} was found to be more conservative, and so is recommended. 
    10741089 
    10751090}            %%end gm comment (copy of griffies book) 
     
    10811096% Filtered free surface formulation 
    10821097%-------------------------------------------------------------------------------------------------------------- 
    1083 \subsection{Filtered free surface (\protect\key{dynspg\_flt})} 
     1098\subsection[Filtered free surface (\texttt{dynspg\_flt?})]{Filtered free surface (\protect\texttt{dynspg\_flt?})} 
    10841099\label{subsec:DYN_spg_fltp} 
    10851100 
    1086 The filtered formulation follows the \citet{Roullet_Madec_JGR00} implementation.  
    1087 The extra term introduced in the equations (see \autoref{subsec:PE_free_surface}) is solved implicitly.  
     1101The filtered formulation follows the \citet{roullet.madec_JGR00} implementation. 
     1102The extra term introduced in the equations (see \autoref{subsec:MB_free_surface}) is solved implicitly. 
    10881103The elliptic solvers available in the code are documented in \autoref{chap:MISC}. 
    10891104 
    10901105%% gm %%======>>>>   given here the discrete eqs provided to the solver 
    1091 \gmcomment{               %%% copy from chap-model basics  
     1106\gmcomment{               %%% copy from chap-model basics 
    10921107  \[ 
    1093     % \label{eq:spg_flt} 
    1094     \frac{\partial {\rm {\bf U}}_h }{\partial t}= {\rm {\bf M}} 
     1108    % \label{eq:DYN_spg_flt} 
     1109    \frac{\partial {\mathrm {\mathbf U}}_h }{\partial t}= {\mathrm {\mathbf M}} 
    10951110    - g \nabla \left( \tilde{\rho} \ \eta \right) 
    10961111    - g \ T_c \nabla \left( \widetilde{\rho} \ \partial_t \eta \right) 
     
    10981113  where $T_c$, is a parameter with dimensions of time which characterizes the force, 
    10991114  $\widetilde{\rho} = \rho / \rho_o$ is the dimensionless density, 
    1100   and $\rm {\bf M}$ represents the collected contributions of the Coriolis, hydrostatic pressure gradient, 
    1101   non-linear and viscous terms in \autoref{eq:PE_dyn}. 
     1115  and $\mathrm {\mathbf M}$ represents the collected contributions of the Coriolis, hydrostatic pressure gradient, 
     1116  non-linear and viscous terms in \autoref{eq:MB_dyn}. 
    11021117}   %end gmcomment 
    11031118 
    1104 Note that in the linear free surface formulation (\key{vvl} not defined), 
     1119Note that in the linear free surface formulation (\texttt{vvl?} not defined), 
    11051120the ocean depth is time-independent and so is the matrix to be inverted. 
    1106 It is computed once and for all and applies to all ocean time steps.  
     1121It is computed once and for all and applies to all ocean time steps. 
    11071122 
    11081123% ================================================================ 
    11091124% Lateral diffusion term 
    11101125% ================================================================ 
    1111 \section{Lateral diffusion term and operators (\protect\mdl{dynldf})} 
     1126\section[Lateral diffusion term and operators (\textit{dynldf.F90})]{Lateral diffusion term and operators (\protect\mdl{dynldf})} 
    11121127\label{sec:DYN_ldf} 
    11131128%------------------------------------------nam_dynldf---------------------------------------------------- 
    11141129 
    1115 \nlst{namdyn_ldf}  
     1130\begin{listing} 
     1131  \nlst{namdyn_ldf} 
     1132  \caption{\texttt{namdyn\_ldf}} 
     1133  \label{lst:namdyn_ldf} 
     1134\end{listing} 
    11161135%------------------------------------------------------------------------------------------------------------- 
    11171136 
    1118 Options are defined through the \ngn{namdyn\_ldf} namelist variables. 
     1137Options are defined through the \nam{dyn\_ldf} namelist variables. 
    11191138The options available for lateral diffusion are to use either laplacian (rotated or not) or biharmonic operators. 
    11201139The coefficients may be constant or spatially variable; 
    11211140the description of the coefficients is found in the chapter on lateral physics (\autoref{chap:LDF}). 
    11221141The lateral diffusion of momentum is evaluated using a forward scheme, 
    1123 \ie the velocity appearing in its expression is the \textit{before} velocity in time, 
     1142\ie\ the velocity appearing in its expression is the \textit{before} velocity in time, 
    11241143except for the pure vertical component that appears when a tensor of rotation is used. 
    1125 This latter term is solved implicitly together with the vertical diffusion term (see \autoref{chap:STP}). 
     1144This latter term is solved implicitly together with the vertical diffusion term (see \autoref{chap:TD}). 
    11261145 
    11271146At the lateral boundaries either free slip, 
     
    11371156  In finite difference methods, 
    11381157  the biharmonic operator is frequently the method of choice to achieve this scale selective dissipation since 
    1139   its damping time (\ie its spin down time) scale like $\lambda^{-4}$ for disturbances of wavelength $\lambda$ 
     1158  its damping time (\ie\ its spin down time) scale like $\lambda^{-4}$ for disturbances of wavelength $\lambda$ 
    11401159  (so that short waves damped more rapidelly than long ones), 
    11411160  whereas the Laplace operator damping time scales only like $\lambda^{-2}$. 
     
    11431162 
    11441163% ================================================================ 
    1145 \subsection[Iso-level laplacian (\protect\np{ln\_dynldf\_lap}\forcode{ = .true.})] 
    1146             {Iso-level laplacian operator (\protect\np{ln\_dynldf\_lap}\forcode{ = .true.})} 
     1164\subsection[Iso-level laplacian (\forcode{ln_dynldf_lap = .true.})]{Iso-level laplacian operator (\protect\np{ln\_dynldf\_lap}\forcode{ = .true.})} 
    11471165\label{subsec:DYN_ldf_lap} 
    11481166 
    1149 For lateral iso-level diffusion, the discrete operator is:  
    1150 \begin{equation} 
    1151   \label{eq:dynldf_lap} 
     1167For lateral iso-level diffusion, the discrete operator is: 
     1168\begin{equation} 
     1169  \label{eq:DYN_ldf_lap} 
    11521170  \left\{ 
    11531171    \begin{aligned} 
    1154       D_u^{l{\rm {\bf U}}} =\frac{1}{e_{1u} }\delta_{i+1/2} \left[ {A_T^{lm} 
    1155           \;\chi } \right]-\frac{1}{e_{2u} {\kern 1pt}e_{3u} }\delta_j \left[  
     1172      D_u^{l{\mathrm {\mathbf U}}} =\frac{1}{e_{1u} }\delta_{i+1/2} \left[ {A_T^{lm} 
     1173          \;\chi } \right]-\frac{1}{e_{2u} {\kern 1pt}e_{3u} }\delta_j \left[ 
    11561174        {A_f^{lm} \;e_{3f} \zeta } \right] \\ \\ 
    1157       D_v^{l{\rm {\bf U}}} =\frac{1}{e_{2v} }\delta_{j+1/2} \left[ {A_T^{lm} 
    1158           \;\chi } \right]+\frac{1}{e_{1v} {\kern 1pt}e_{3v} }\delta_i \left[  
     1175      D_v^{l{\mathrm {\mathbf U}}} =\frac{1}{e_{2v} }\delta_{j+1/2} \left[ {A_T^{lm} 
     1176          \;\chi } \right]+\frac{1}{e_{1v} {\kern 1pt}e_{3v} }\delta_i \left[ 
    11591177        {A_f^{lm} \;e_{3f} \zeta } \right] 
    11601178    \end{aligned} 
    11611179  \right. 
    1162 \end{equation}  
    1163  
    1164 As explained in \autoref{subsec:PE_ldf}, 
     1180\end{equation} 
     1181 
     1182As explained in \autoref{subsec:MB_ldf}, 
    11651183this formulation (as the gradient of a divergence and curl of the vorticity) preserves symmetry and 
    1166 ensures a complete separation between the vorticity and divergence parts of the momentum diffusion.  
     1184ensures a complete separation between the vorticity and divergence parts of the momentum diffusion. 
    11671185 
    11681186%-------------------------------------------------------------------------------------------------------------- 
    11691187%           Rotated laplacian operator 
    11701188%-------------------------------------------------------------------------------------------------------------- 
    1171 \subsection[Rotated laplacian (\protect\np{ln\_dynldf\_iso}\forcode{ = .true.})] 
    1172             {Rotated laplacian operator (\protect\np{ln\_dynldf\_iso}\forcode{ = .true.})} 
     1189\subsection[Rotated laplacian (\forcode{ln_dynldf_iso = .true.})]{Rotated laplacian operator (\protect\np{ln\_dynldf\_iso}\forcode{ = .true.})} 
    11731190\label{subsec:DYN_ldf_iso} 
    11741191 
    11751192A rotation of the lateral momentum diffusion operator is needed in several cases: 
    1176 for iso-neutral diffusion in the $z$-coordinate (\np{ln\_dynldf\_iso}\forcode{ = .true.}) and 
    1177 for either iso-neutral (\np{ln\_dynldf\_iso}\forcode{ = .true.}) or 
    1178 geopotential (\np{ln\_dynldf\_hor}\forcode{ = .true.}) diffusion in the $s$-coordinate. 
     1193for iso-neutral diffusion in the $z$-coordinate (\np{ln\_dynldf\_iso}\forcode{=.true.}) and 
     1194for either iso-neutral (\np{ln\_dynldf\_iso}\forcode{=.true.}) or 
     1195geopotential (\np{ln\_dynldf\_hor}\forcode{=.true.}) diffusion in the $s$-coordinate. 
    11791196In the partial step case, coordinates are horizontal except at the deepest level and 
    1180 no rotation is performed when \np{ln\_dynldf\_hor}\forcode{ = .true.}. 
     1197no rotation is performed when \np{ln\_dynldf\_hor}\forcode{=.true.}. 
    11811198The diffusion operator is defined simply as the divergence of down gradient momentum fluxes on 
    11821199each momentum component. 
     
    11841201The resulting discrete representation is: 
    11851202\begin{equation} 
    1186   \label{eq:dyn_ldf_iso} 
     1203  \label{eq:DYN_ldf_iso} 
    11871204  \begin{split} 
    11881205    D_u^{l\textbf{U}} &= \frac{1}{e_{1u} \, e_{2u} \, e_{3u} } \\ 
     
    12081225                -e_{2f} \; r_{1f} \,\overline{\overline {\delta_{k+1/2}[v]}}^{\,i+1/2,\,k}} 
    12091226            \right)} \right]}    \right. \\ 
    1210     & \qquad +\ \delta_j \left[ {A_T^{lm} \left( {\frac{e_{1t}\,e_{3t} }{e_{2t}  
     1227    & \qquad +\ \delta_j \left[ {A_T^{lm} \left( {\frac{e_{1t}\,e_{3t} }{e_{2t} 
    12111228            }\,\delta_{j} [v] - e_{1t}\, r_{2t} 
    12121229            \,\overline{\overline {\delta_{k+1/2} [v]}} ^{\,j,\,k}} 
    12131230        \right)} \right] \\ 
    1214     & \qquad +\ \delta_k \left[ {A_{vw}^{lm} \left( {-e_{2v} \, r_{1vw} \,\overline{\overline  
     1231    & \qquad +\ \delta_k \left[ {A_{vw}^{lm} \left( {-e_{2v} \, r_{1vw} \,\overline{\overline 
    12151232              {\delta_{i+1/2} [v]}}^{\,i+1/2,\,k+1/2} }\right.} \right. \\ 
    12161233    &  \ \qquad \qquad \qquad \quad\ 
    12171234    - e_{1v} \, r_{2vw} \,\overline{\overline {\delta_{j+1/2} [v]}} ^{\,j+1/2,\,k+1/2} \\ 
    1218     & \left. {\left. { \ \qquad \qquad \qquad \ \ \ \left. {\  
     1235    & \left. {\left. { \ \qquad \qquad \qquad \ \ \ \left. {\ 
    12191236                +\frac{e_{1v}\, e_{2v} }{e_{3vw} }\,\left( {r_{1vw}^2+r_{2vw}^2} 
    1220                 \right)\,\delta_{k+1/2} [v]} \right)} \right]\;\;\;} \right\}  
     1237                \right)\,\delta_{k+1/2} [v]} \right)} \right]\;\;\;} \right\} 
    12211238  \end{split} 
    12221239\end{equation} 
    12231240where $r_1$ and $r_2$ are the slopes between the surface along which the diffusion operator acts and 
    1224 the surface of computation ($z$- or $s$-surfaces).  
     1241the surface of computation ($z$- or $s$-surfaces). 
    12251242The way these slopes are evaluated is given in the lateral physics chapter (\autoref{chap:LDF}). 
    12261243 
     
    12281245%           Iso-level bilaplacian operator 
    12291246%-------------------------------------------------------------------------------------------------------------- 
    1230 \subsection[Iso-level bilaplacian (\protect\np{ln\_dynldf\_bilap}\forcode{ = .true.})] 
    1231             {Iso-level bilaplacian operator (\protect\np{ln\_dynldf\_bilap}\forcode{ = .true.})} 
     1247\subsection[Iso-level bilaplacian (\forcode{ln_dynldf_bilap = .true.})]{Iso-level bilaplacian operator (\protect\np{ln\_dynldf\_bilap}\forcode{ = .true.})} 
    12321248\label{subsec:DYN_ldf_bilap} 
    12331249 
    1234 The lateral fourth order operator formulation on momentum is obtained by applying \autoref{eq:dynldf_lap} twice. 
     1250The lateral fourth order operator formulation on momentum is obtained by applying \autoref{eq:DYN_ldf_lap} twice. 
    12351251It requires an additional assumption on boundary conditions: 
    12361252the first derivative term normal to the coast depends on the free or no-slip lateral boundary conditions chosen, 
     
    12431259%           Vertical diffusion term 
    12441260% ================================================================ 
    1245 \section{Vertical diffusion term (\protect\mdl{dynzdf})} 
     1261\section[Vertical diffusion term (\textit{dynzdf.F90})]{Vertical diffusion term (\protect\mdl{dynzdf})} 
    12461262\label{sec:DYN_zdf} 
    12471263%----------------------------------------------namzdf------------------------------------------------------ 
    12481264 
    1249 \nlst{namzdf}  
    12501265%------------------------------------------------------------------------------------------------------------- 
    12511266 
    1252 Options are defined through the \ngn{namzdf} namelist variables. 
     1267Options are defined through the \nam{zdf} namelist variables. 
    12531268The large vertical diffusion coefficient found in the surface mixed layer together with high vertical resolution implies that in the case of explicit time stepping there would be too restrictive a constraint on the time step. 
    12541269Two time stepping schemes can be used for the vertical diffusion term: 
    12551270$(a)$ a forward time differencing scheme 
    1256 (\np{ln\_zdfexp}\forcode{ = .true.}) using a time splitting technique (\np{nn\_zdfexp} $>$ 1) or 
    1257 $(b)$ a backward (or implicit) time differencing scheme (\np{ln\_zdfexp}\forcode{ = .false.}) 
    1258 (see \autoref{chap:STP}). 
    1259 Note that namelist variables \np{ln\_zdfexp} and \np{nn\_zdfexp} apply to both tracers and dynamics.  
     1271(\np{ln\_zdfexp}\forcode{=.true.}) using a time splitting technique (\np{nn\_zdfexp} $>$ 1) or 
     1272$(b)$ a backward (or implicit) time differencing scheme (\np{ln\_zdfexp}\forcode{=.false.}) 
     1273(see \autoref{chap:TD}). 
     1274Note that namelist variables \np{ln\_zdfexp} and \np{nn\_zdfexp} apply to both tracers and dynamics. 
    12601275 
    12611276The formulation of the vertical subgrid scale physics is the same whatever the vertical coordinate is. 
    1262 The vertical diffusion operators given by \autoref{eq:PE_zdf} take the following semi-discrete space form: 
    1263 \[ 
    1264   % \label{eq:dynzdf} 
     1277The vertical diffusion operators given by \autoref{eq:MB_zdf} take the following semi-discrete space form: 
     1278\[ 
     1279  % \label{eq:DYN_zdf} 
    12651280  \left\{ 
    12661281    \begin{aligned} 
     
    12801295the vertical turbulent momentum fluxes, 
    12811296\begin{equation} 
    1282   \label{eq:dynzdf_sbc} 
     1297  \label{eq:DYN_zdf_sbc} 
    12831298  \left.{\left( {\frac{A^{vm} }{e_3 }\ \frac{\partial \textbf{U}_h}{\partial k}} \right)} \right|_{z=1} 
    12841299  = \frac{1}{\rho_o} \binom{\tau_u}{\tau_v } 
     
    12861301where $\left( \tau_u ,\tau_v \right)$ are the two components of the wind stress vector in 
    12871302the (\textbf{i},\textbf{j}) coordinate system. 
    1288 The high mixing coefficients in the surface mixed layer ensure that the surface wind stress is distributed in  
     1303The high mixing coefficients in the surface mixed layer ensure that the surface wind stress is distributed in 
    12891304the vertical over the mixed layer depth. 
    12901305If the vertical mixing coefficient is small (when no mixed layer scheme is used) 
     
    12931308 
    12941309The turbulent flux of momentum at the bottom of the ocean is specified through a bottom friction parameterisation 
    1295 (see \autoref{sec:ZDF_bfr}) 
     1310(see \autoref{sec:ZDF_drg}) 
    12961311 
    12971312% ================================================================ 
     
    13031318Besides the surface and bottom stresses (see the above section) 
    13041319which are introduced as boundary conditions on the vertical mixing, 
    1305 three other forcings may enter the dynamical equations by affecting the surface pressure gradient.  
    1306  
    1307 (1) When \np{ln\_apr\_dyn}\forcode{ = .true.} (see \autoref{sec:SBC_apr}), 
     1320three other forcings may enter the dynamical equations by affecting the surface pressure gradient. 
     1321 
     1322(1) When \np{ln\_apr\_dyn}\forcode{=.true.} (see \autoref{sec:SBC_apr}), 
    13081323the atmospheric pressure is taken into account when computing the surface pressure gradient. 
    13091324 
    1310 (2) When \np{ln\_tide\_pot}\forcode{ = .true.} and \np{ln\_tide}\forcode{ = .true.} (see \autoref{sec:SBC_tide}), 
     1325(2) When \np{ln\_tide\_pot}\forcode{=.true.} and \np{ln\_tide}\forcode{=.true.} (see \autoref{sec:SBC_tide}), 
    13111326the tidal potential is taken into account when computing the surface pressure gradient. 
    13121327 
    1313 (3) When \np{nn\_ice\_embd}\forcode{ = 2} and LIM or CICE is used 
    1314 (\ie when the sea-ice is embedded in the ocean), 
     1328(3) When \np{nn\_ice\_embd}\forcode{=2} and LIM or CICE is used 
     1329(\ie\ when the sea-ice is embedded in the ocean), 
    13151330the snow-ice mass is taken into account when computing the surface pressure gradient. 
    13161331 
     
    13201335 
    13211336% ================================================================ 
    1322 % Wetting and drying  
     1337% Wetting and drying 
    13231338% ================================================================ 
    13241339\section{Wetting and drying } 
    13251340\label{sec:DYN_wetdry} 
     1341 
    13261342There are two main options for wetting and drying code (wd): 
    13271343(a) an iterative limiter (il) and (b) a directional limiter (dl). 
    1328 The directional limiter is based on the scheme developed by \cite{WarnerEtal13} for RO 
     1344The directional limiter is based on the scheme developed by \cite{warner.defne.ea_CG13} for RO 
    13291345MS 
    1330 which was in turn based on ideas developed for POM by \cite{Oey06}. The iterative 
     1346which was in turn based on ideas developed for POM by \cite{oey_OM06}. The iterative 
    13311347limiter is a new scheme.  The iterative limiter is activated by setting $\mathrm{ln\_wd\_il} = \mathrm{.true.}$ 
    13321348and $\mathrm{ln\_wd\_dl} = \mathrm{.false.}$. The directional limiter is activated 
    13331349by setting $\mathrm{ln\_wd\_dl} = \mathrm{.true.}$ and $\mathrm{ln\_wd\_il} = \mathrm{.false.}$. 
    13341350 
    1335 \nlst{namwad} 
     1351\begin{listing} 
     1352  \nlst{namwad} 
     1353  \caption{\texttt{namwad}} 
     1354  \label{lst:namwad} 
     1355\end{listing} 
    13361356 
    13371357The following terminology is used. The depth of the topography (positive downwards) 
    1338 at each $(i,j)$ point is the quantity stored in array $\mathrm{ht\_wd}$ in the NEMO code. 
     1358at each $(i,j)$ point is the quantity stored in array $\mathrm{ht\_wd}$ in the \NEMO\ code. 
    13391359The height of the free surface (positive upwards) is denoted by $ \mathrm{ssh}$. Given the sign 
    13401360conventions used, the water depth, $h$, is the height of the free surface plus the depth of the 
     
    13441364covered by water. They require the topography specified with a model 
    13451365configuration to have negative depths at points where the land is higher than the 
    1346 topography's reference sea-level. The vertical grid in NEMO is normally computed relative to an 
     1366topography's reference sea-level. The vertical grid in \NEMO\ is normally computed relative to an 
    13471367initial state with zero sea surface height elevation. 
    13481368The user can choose to compute the vertical grid and heights in the model relative to 
     
    13631383All these configurations have used pure sigma coordinates. It is expected that 
    13641384the wetting and drying code will work in domains with more general s-coordinates provided 
    1365 the coordinates are pure sigma in the region where wetting and drying actually occurs.  
     1385the coordinates are pure sigma in the region where wetting and drying actually occurs. 
    13661386 
    13671387The next sub-section descrbies the directional limiter and the following sub-section the iterative limiter. 
     
    13721392%   Iterative limiters 
    13731393%----------------------------------------------------------------------------------------- 
    1374 \subsection   [Directional limiter (\textit{wet\_dry})] 
    1375          {Directional limiter (\mdl{wet\_dry})} 
     1394\subsection[Directional limiter (\textit{wet\_dry.F90})]{Directional limiter (\mdl{wet\_dry})} 
    13761395\label{subsec:DYN_wd_directional_limiter} 
     1396 
    13771397The principal idea of the directional limiter is that 
    1378 water should not be allowed to flow out of a dry tracer cell (i.e. one whose water depth is less than rn\_wdmin1). 
     1398water should not be allowed to flow out of a dry tracer cell (i.e. one whose water depth is less than \np{rn\_wdmin1}). 
    13791399 
    13801400All the changes associated with this option are made to the barotropic solver for the non-linear 
     
    13861406 
    13871407The flux across each $u$-face of a tracer cell is multiplied by a factor zuwdmask (an array which depends on ji and jj). 
    1388 If the user sets ln\_wd\_dl\_ramp = .False. then zuwdmask is 1 when the 
    1389 flux is from a cell with water depth greater than rn\_wdmin1 and 0 otherwise. If the user sets 
    1390 ln\_wd\_dl\_ramp = .True. the flux across the face is ramped down as the water depth decreases 
    1391 from 2 * rn\_wdmin1 to rn\_wdmin1. The use of this ramp reduced grid-scale noise in idealised test cases. 
     1408If the user sets \np{ln\_wd\_dl\_ramp}\forcode{=.false.} then zuwdmask is 1 when the 
     1409flux is from a cell with water depth greater than \np{rn\_wdmin1} and 0 otherwise. If the user sets 
     1410\np{ln\_wd\_dl\_ramp}\forcode{=.true.} the flux across the face is ramped down as the water depth decreases 
     1411from 2 * \np{rn\_wdmin1} to \np{rn\_wdmin1}. The use of this ramp reduced grid-scale noise in idealised test cases. 
    13921412 
    13931413At the point where the flux across a $u$-face is multiplied by zuwdmask , we have chosen 
     
    14001420 
    14011421 
    1402 \cite{WarnerEtal13} state that in their scheme the velocity masks at the cell faces for the baroclinic 
     1422\cite{warner.defne.ea_CG13} state that in their scheme the velocity masks at the cell faces for the baroclinic 
    14031423timesteps are set to 0 or 1 depending on whether the average of the masks over the barotropic sub-steps is respectively less than 
    14041424or greater than 0.5. That scheme does not conserve tracers in integrations started from constant tracer 
    14051425fields (tracers independent of $x$, $y$ and $z$). Our scheme conserves constant tracers because 
    14061426the velocities used at the tracer cell faces on the baroclinic timesteps are carefully calculated by dynspg\_ts 
    1407 to equal their mean value during the barotropic steps. If the user sets ln\_wd\_dl\_bc = .True., the 
    1408 baroclinic velocities are also multiplied by a suitably weighted average of zuwdmask.   
     1427to equal their mean value during the barotropic steps. If the user sets \np{ln\_wd\_dl\_bc}\forcode{=.true.}, the 
     1428baroclinic velocities are also multiplied by a suitably weighted average of zuwdmask. 
    14091429 
    14101430%----------------------------------------------------------------------------------------- 
     
    14121432%----------------------------------------------------------------------------------------- 
    14131433 
    1414 \subsection   [Iterative limiter (\textit{wet\_dry})] 
    1415          {Iterative limiter (\mdl{wet\_dry})} 
     1434\subsection[Iterative limiter (\textit{wet\_dry.F90})]{Iterative limiter (\mdl{wet\_dry})} 
    14161435\label{subsec:DYN_wd_iterative_limiter} 
    14171436 
    1418 \subsubsection [Iterative flux limiter (\textit{wet\_dry})] 
    1419          {Iterative flux limiter (\mdl{wet\_dry})} 
    1420 \label{subsubsec:DYN_wd_il_spg_limiter} 
     1437\subsubsection[Iterative flux limiter (\textit{wet\_dry.F90})]{Iterative flux limiter (\mdl{wet\_dry})} 
     1438\label{subsec:DYN_wd_il_spg_limiter} 
    14211439 
    14221440The iterative limiter modifies the fluxes across the faces of cells that are either already ``dry'' 
     
    14261444 
    14271445The continuity equation for the total water depth in a column 
    1428 \begin{equation} \label{dyn_wd_continuity} 
    1429  \frac{\partial h}{\partial t} + \mathbf{\nabla.}(h\mathbf{u}) = 0 . 
     1446\begin{equation} 
     1447  \label{eq:DYN_wd_continuity} 
     1448  \frac{\partial h}{\partial t} + \mathbf{\nabla.}(h\mathbf{u}) = 0 . 
    14301449\end{equation} 
    14311450can be written in discrete form  as 
    14321451 
    1433 \begin{align} \label{dyn_wd_continuity_2} 
    1434 \frac{e_1 e_2}{\Delta t} ( h_{i,j}(t_{n+1}) - h_{i,j}(t_e) )  
    1435 &= - ( \mathrm{flxu}_{i+1,j} - \mathrm{flxu}_{i,j}  + \mathrm{flxv}_{i,j+1} - \mathrm{flxv}_{i,j} ) \\ 
    1436 &= \mathrm{zzflx}_{i,j} . 
     1452\begin{align} 
     1453  \label{eq:DYN_wd_continuity_2} 
     1454  \frac{e_1 e_2}{\Delta t} ( h_{i,j}(t_{n+1}) - h_{i,j}(t_e) ) 
     1455  &= - ( \mathrm{flxu}_{i+1,j} - \mathrm{flxu}_{i,j}  + \mathrm{flxv}_{i,j+1} - \mathrm{flxv}_{i,j} ) \\ 
     1456  &= \mathrm{zzflx}_{i,j} . 
    14371457\end{align} 
    14381458 
     
    14471467(zzflxp) and fluxes that are into the cell (zzflxn).  Clearly 
    14481468 
    1449 \begin{equation} \label{dyn_wd_zzflx_p_n_1} 
    1450 \mathrm{zzflx}_{i,j} = \mathrm{zzflxp}_{i,j} + \mathrm{zzflxn}_{i,j} .   
     1469\begin{equation} 
     1470  \label{eq:DYN_wd_zzflx_p_n_1} 
     1471  \mathrm{zzflx}_{i,j} = \mathrm{zzflxp}_{i,j} + \mathrm{zzflxn}_{i,j} . 
    14511472\end{equation} 
    14521473 
     
    14591480$\mathrm{zcoef}_{i,j}^{(m)}$ such that: 
    14601481 
    1461 \begin{equation} \label{dyn_wd_continuity_coef} 
    1462 \begin{split} 
    1463 \mathrm{zzflxp}^{(m)}_{i,j} =& \mathrm{zcoef}_{i,j}^{(m)} \mathrm{zzflxp}^{(0)}_{i,j} \\ 
    1464 \mathrm{zzflxn}^{(m)}_{i,j} =& \mathrm{zcoef}_{i,j}^{(m)} \mathrm{zzflxn}^{(0)}_{i,j} 
    1465 \end{split} 
     1482\begin{equation} 
     1483  \label{eq:DYN_wd_continuity_coef} 
     1484  \begin{split} 
     1485    \mathrm{zzflxp}^{(m)}_{i,j} =& \mathrm{zcoef}_{i,j}^{(m)} \mathrm{zzflxp}^{(0)}_{i,j} \\ 
     1486    \mathrm{zzflxn}^{(m)}_{i,j} =& \mathrm{zcoef}_{i,j}^{(m)} \mathrm{zzflxn}^{(0)}_{i,j} 
     1487  \end{split} 
    14661488\end{equation} 
    14671489 
     
    14711493The iteration is initialised by setting 
    14721494 
    1473 \begin{equation} \label{dyn_wd_zzflx_initial} 
    1474 \mathrm{zzflxp^{(0)}}_{i,j} = \mathrm{zzflxp}_{i,j} , \quad  \mathrm{zzflxn^{(0)}}_{i,j} = \mathrm{zzflxn}_{i,j} .  
     1495\begin{equation} 
     1496  \label{eq:DYN_wd_zzflx_initial} 
     1497  \mathrm{zzflxp^{(0)}}_{i,j} = \mathrm{zzflxp}_{i,j} , \quad  \mathrm{zzflxn^{(0)}}_{i,j} = \mathrm{zzflxn}_{i,j} . 
    14751498\end{equation} 
    14761499 
    14771500The fluxes out of cell $(i,j)$ are updated at the $m+1$th iteration if the depth of the 
    14781501cell on timestep $t_e$, namely $h_{i,j}(t_e)$, is less than the total flux out of the cell 
    1479 times the timestep divided by the cell area. Using (\ref{dyn_wd_continuity_2}) this 
     1502times the timestep divided by the cell area. Using (\autoref{eq:DYN_wd_continuity_2}) this 
    14801503condition is 
    14811504 
    1482 \begin{equation} \label{dyn_wd_continuity_if} 
    1483 h_{i,j}(t_e)  - \mathrm{rn\_wdmin1} <  \frac{\Delta t}{e_1 e_2} ( \mathrm{zzflxp}^{(m)}_{i,j} + \mathrm{zzflxn}^{(m)}_{i,j} ) . 
    1484 \end{equation} 
    1485  
    1486 Rearranging (\ref{dyn_wd_continuity_if}) we can obtain an expression for the maximum 
     1505\begin{equation} 
     1506  \label{eq:DYN_wd_continuity_if} 
     1507  h_{i,j}(t_e)  - \mathrm{rn\_wdmin1} <  \frac{\Delta t}{e_1 e_2} ( \mathrm{zzflxp}^{(m)}_{i,j} + \mathrm{zzflxn}^{(m)}_{i,j} ) . 
     1508\end{equation} 
     1509 
     1510Rearranging (\autoref{eq:DYN_wd_continuity_if}) we can obtain an expression for the maximum 
    14871511outward flux that can be allowed and still maintain the minimum wet depth: 
    14881512 
    1489 \begin{equation} \label{dyn_wd_max_flux} 
    1490 \begin{split} 
    1491 \mathrm{zzflxp}^{(m+1)}_{i,j} = \Big[ (h_{i,j}(t_e) & - \mathrm{rn\_wdmin1} - \mathrm{rn\_wdmin2})  \frac{e_1 e_2}{\Delta t} \phantom{]} \\ 
    1492 \phantom{[} & -  \mathrm{zzflxn}^{(m)}_{i,j} \Big] 
    1493 \end{split} 
    1494 \end{equation} 
    1495  
    1496 Note a small tolerance ($\mathrm{rn\_wdmin2}$) has been introduced here {\it [Q: Why is 
    1497 this necessary/desirable?]}. Substituting from (\ref{dyn_wd_continuity_coef}) gives an 
     1513\begin{equation} 
     1514  \label{eq:DYN_wd_max_flux} 
     1515  \begin{split} 
     1516    \mathrm{zzflxp}^{(m+1)}_{i,j} = \Big[ (h_{i,j}(t_e) & - \mathrm{rn\_wdmin1} - \mathrm{rn\_wdmin2})  \frac{e_1 e_2}{\Delta t} \phantom{]} \\ 
     1517    \phantom{[} & -  \mathrm{zzflxn}^{(m)}_{i,j} \Big] 
     1518  \end{split} 
     1519\end{equation} 
     1520 
     1521Note a small tolerance ($\mathrm{rn\_wdmin2}$) has been introduced here {\itshape [Q: Why is 
     1522this necessary/desirable?]}. Substituting from (\autoref{eq:DYN_wd_continuity_coef}) gives an 
    14981523expression for the coefficient needed to multiply the outward flux at this cell in order 
    14991524to avoid drying. 
    15001525 
    1501 \begin{equation} \label{dyn_wd_continuity_nxtcoef} 
    1502 \begin{split} 
    1503 \mathrm{zcoef}^{(m+1)}_{i,j} = \Big[ (h_{i,j}(t_e) & - \mathrm{rn\_wdmin1} - \mathrm{rn\_wdmin2})  \frac{e_1 e_2}{\Delta t} \phantom{]} \\ 
    1504 \phantom{[} & -  \mathrm{zzflxn}^{(m)}_{i,j} \Big] \frac{1}{ \mathrm{zzflxp}^{(0)}_{i,j} }  
    1505 \end{split} 
     1526\begin{equation} 
     1527  \label{eq:DYN_wd_continuity_nxtcoef} 
     1528  \begin{split} 
     1529    \mathrm{zcoef}^{(m+1)}_{i,j} = \Big[ (h_{i,j}(t_e) & - \mathrm{rn\_wdmin1} - \mathrm{rn\_wdmin2})  \frac{e_1 e_2}{\Delta t} \phantom{]} \\ 
     1530    \phantom{[} & -  \mathrm{zzflxn}^{(m)}_{i,j} \Big] \frac{1}{ \mathrm{zzflxp}^{(0)}_{i,j} } 
     1531  \end{split} 
    15061532\end{equation} 
    15071533 
     
    15221548%      Surface pressure gradients 
    15231549%---------------------------------------------------------------------------------------- 
    1524 \subsubsection   [Modification of surface pressure gradients (\textit{dynhpg})] 
    1525          {Modification of surface pressure gradients (\mdl{dynhpg})} 
    1526 \label{subsubsec:DYN_wd_il_spg} 
     1550\subsubsection[Modification of surface pressure gradients (\textit{dynhpg.F90})]{Modification of surface pressure gradients (\mdl{dynhpg})} 
     1551\label{subsec:DYN_wd_il_spg} 
    15271552 
    15281553At ``dry'' points the water depth is usually close to $\mathrm{rn\_wdmin1}$. If the 
     
    15371562neighbouring $(i+1,j)$ and $(i,j)$ tracer points.  zcpx is calculated using two logicals 
    15381563variables, $\mathrm{ll\_tmp1}$ and $\mathrm{ll\_tmp2}$ which are evaluated for each grid 
    1539 column.  The three possible combinations are illustrated in figure \ref{Fig_WAD_dynhpg}. 
     1564column.  The three possible combinations are illustrated in \autoref{fig:DYN_WAD_dynhpg}. 
    15401565 
    15411566%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    1542 \begin{figure}[!ht] \begin{center} 
    1543 \includegraphics[width=0.8\textwidth]{Fig_WAD_dynhpg} 
    1544 \caption{ \label{Fig_WAD_dynhpg} 
    1545 Illustrations of the three possible combinations of the logical variables controlling the 
    1546 limiting of the horizontal pressure gradient in wetting and drying regimes} 
    1547 \end{center}\end{figure} 
     1567\begin{figure}[!ht] 
     1568  \centering 
     1569  \includegraphics[width=\textwidth]{Fig_WAD_dynhpg} 
     1570  \caption[Combinations controlling the limiting of the horizontal pressure gradient in 
     1571  wetting and drying regimes]{ 
     1572    Three possible combinations of the logical variables controlling the 
     1573    limiting of the horizontal pressure gradient in wetting and drying regimes} 
     1574  \label{fig:DYN_WAD_dynhpg} 
     1575\end{figure} 
    15481576%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    15491577 
     
    15531581of the topography at the two points: 
    15541582 
    1555 \begin{equation} \label{dyn_ll_tmp1} 
    1556 \begin{split} 
    1557 \mathrm{ll\_tmp1}  = & \mathrm{MIN(sshn(ji,jj), sshn(ji+1,jj))} > \\ 
     1583\begin{equation} 
     1584  \label{eq:DYN_ll_tmp1} 
     1585  \begin{split} 
     1586    \mathrm{ll\_tmp1}  = & \mathrm{MIN(sshn(ji,jj), sshn(ji+1,jj))} > \\ 
    15581587                     & \quad \mathrm{MAX(-ht\_wd(ji,jj), -ht\_wd(ji+1,jj))\  .and.} \\ 
    1559 & \mathrm{MAX(sshn(ji,jj) + ht\_wd(ji,jj),} \\ 
    1560 & \mathrm{\phantom{MAX(}sshn(ji+1,jj) + ht\_wd(ji+1,jj))} >\\ 
    1561 & \quad\quad\mathrm{rn\_wdmin1 + rn\_wdmin2 } 
    1562 \end{split} 
     1588                     & \mathrm{MAX(sshn(ji,jj) + ht\_wd(ji,jj),} \\ 
     1589                     & \mathrm{\phantom{MAX(}sshn(ji+1,jj) + ht\_wd(ji+1,jj))} >\\ 
     1590                     & \quad\quad\mathrm{rn\_wdmin1 + rn\_wdmin2 } 
     1591  \end{split} 
    15631592\end{equation} 
    15641593 
     
    15671596at the two points plus $\mathrm{rn\_wdmin1} + \mathrm{rn\_wdmin2}$ 
    15681597 
    1569 \begin{equation} \label{dyn_ll_tmp2} 
    1570 \begin{split} 
    1571 \mathrm{ ll\_tmp2 } = & \mathrm{( ABS( sshn(ji,jj) - sshn(ji+1,jj) ) > 1.E-12 )\ .AND.}\\ 
    1572 & \mathrm{( MAX(sshn(ji,jj), sshn(ji+1,jj)) > } \\ 
    1573 & \mathrm{\phantom{(} MAX(-ht\_wd(ji,jj), -ht\_wd(ji+1,jj)) + rn\_wdmin1 + rn\_wdmin2}) . 
    1574 \end{split} 
     1598\begin{equation} 
     1599  \label{eq:DYN_ll_tmp2} 
     1600  \begin{split} 
     1601    \mathrm{ ll\_tmp2 } = & \mathrm{( ABS( sshn(ji,jj) - sshn(ji+1,jj) ) > 1.E-12 )\ .AND.}\\ 
     1602    & \mathrm{( MAX(sshn(ji,jj), sshn(ji+1,jj)) > } \\ 
     1603    & \mathrm{\phantom{(} MAX(-ht\_wd(ji,jj), -ht\_wd(ji+1,jj)) + rn\_wdmin1 + rn\_wdmin2}) . 
     1604  \end{split} 
    15751605\end{equation} 
    15761606 
     
    15881618conditions. 
    15891619 
    1590 \subsubsection   [Additional considerations (\textit{usrdef\_zgr})] 
    1591          {Additional considerations (\mdl{usrdef\_zgr})} 
    1592 \label{subsubsec:WAD_additional} 
     1620\subsubsection[Additional considerations (\textit{usrdef\_zgr.F90})]{Additional considerations (\mdl{usrdef\_zgr})} 
     1621\label{subsec:DYN_WAD_additional} 
    15931622 
    15941623In the very shallow water where wetting and drying occurs the parametrisation of 
     
    16031632%      The WAD test cases 
    16041633%---------------------------------------------------------------------------------------- 
    1605 \subsection   [The WAD test cases (\textit{usrdef\_zgr})] 
    1606          {The WAD test cases (\mdl{usrdef\_zgr})} 
    1607 \label{WAD_test_cases} 
     1634\subsection[The WAD test cases (\textit{usrdef\_zgr.F90})]{The WAD test cases (\mdl{usrdef\_zgr})} 
     1635\label{subsec:DYN_WAD_test_cases} 
    16081636 
    16091637See the WAD tests MY\_DOC documention for details of the WAD test cases. 
     
    16121640 
    16131641% ================================================================ 
    1614 % Time evolution term  
    1615 % ================================================================ 
    1616 \section{Time evolution term (\protect\mdl{dynnxt})} 
     1642% Time evolution term 
     1643% ================================================================ 
     1644\section[Time evolution term (\textit{dynnxt.F90})]{Time evolution term (\protect\mdl{dynnxt})} 
    16171645\label{sec:DYN_nxt} 
    16181646 
    16191647%----------------------------------------------namdom---------------------------------------------------- 
    16201648 
    1621 \nlst{namdom}  
    16221649%------------------------------------------------------------------------------------------------------------- 
    16231650 
    1624 Options are defined through the \ngn{namdom} namelist variables. 
     1651Options are defined through the \nam{dom} namelist variables. 
    16251652The general framework for dynamics time stepping is a leap-frog scheme, 
    1626 \ie a three level centred time scheme associated with an Asselin time filter (cf. \autoref{chap:STP}). 
     1653\ie\ a three level centred time scheme associated with an Asselin time filter (cf. \autoref{chap:TD}). 
    16271654The scheme is applied to the velocity, except when 
    16281655using the flux form of momentum advection (cf. \autoref{sec:DYN_adv_cor_flux}) 
    1629 in the variable volume case (\key{vvl} defined), 
    1630 where it has to be applied to the thickness weighted velocity (see \autoref{sec:A_momentum})   
     1656in the variable volume case (\texttt{vvl?} defined), 
     1657where it has to be applied to the thickness weighted velocity (see \autoref{sec:SCOORD_momentum}) 
    16311658 
    16321659$\bullet$ vector invariant form or linear free surface 
    1633 (\np{ln\_dynhpg\_vec}\forcode{ = .true.} ; \key{vvl} not defined): 
    1634 \[ 
    1635   % \label{eq:dynnxt_vec} 
     1660(\np{ln\_dynhpg\_vec}\forcode{=.true.} ; \texttt{vvl?} not defined): 
     1661\[ 
     1662  % \label{eq:DYN_nxt_vec} 
    16361663  \left\{ 
    16371664    \begin{aligned} 
     
    16431670 
    16441671$\bullet$ flux form and nonlinear free surface 
    1645 (\np{ln\_dynhpg\_vec}\forcode{ = .false.} ; \key{vvl} defined): 
    1646 \[ 
    1647   % \label{eq:dynnxt_flux} 
     1672(\np{ln\_dynhpg\_vec}\forcode{=.false.} ; \texttt{vvl?} defined): 
     1673\[ 
     1674  % \label{eq:DYN_nxt_flux} 
    16481675  \left\{ 
    16491676    \begin{aligned} 
     
    16571684the subscript $f$ denotes filtered values and $\gamma$ is the Asselin coefficient. 
    16581685$\gamma$ is initialized as \np{nn\_atfp} (namelist parameter). 
    1659 Its default value is \np{nn\_atfp}\forcode{ = 10.e-3}. 
     1686Its default value is \np{nn\_atfp}\forcode{=10.e-3}. 
    16601687In both cases, the modified Asselin filter is not applied since perfect conservation is not an issue for 
    16611688the momentum equations. 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_LBC.tex

    r10614 r11564  
    33\begin{document} 
    44% ================================================================ 
    5 % Chapter — Lateral Boundary Condition (LBC)  
     5% Chapter — Lateral Boundary Condition (LBC) 
    66% ================================================================ 
    77\chapter{Lateral Boundary Condition (LBC)} 
    88\label{chap:LBC} 
    99 
    10 \minitoc 
     10\chaptertoc 
    1111 
    1212\newpage 
     
    1717% Boundary Condition at the Coast 
    1818% ================================================================ 
    19 \section{Boundary condition at the coast (\protect\np{rn\_shlat})} 
     19\section[Boundary condition at the coast (\texttt{rn\_shlat})] 
     20{Boundary condition at the coast (\protect\np{rn\_shlat})} 
    2021\label{sec:LBC_coast} 
    21 %--------------------------------------------nam_lbc------------------------------------------------------- 
    22  
    23 \nlst{namlbc}  
     22%--------------------------------------------namlbc------------------------------------------------------- 
     23 
     24\begin{listing} 
     25  \nlst{namlbc} 
     26  \caption{\texttt{namlbc}} 
     27  \label{lst:namlbc} 
     28\end{listing} 
    2429%-------------------------------------------------------------------------------------------------------------- 
    2530 
    26 %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 \autoref{subsec:DOM_msk}).  
    27  
    28 %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, \ie 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 \autoref{subsec:DOM_msk}. 
    29  
    30 Options are defined through the \ngn{namlbc} namelist variables. 
     31%The lateral ocean boundary conditions contiguous to coastlines are Neumann conditions for heat and salt 
     32%(no flux across boundaries) and Dirichlet conditions for momentum (ranging from free-slip to "strong" no-slip). 
     33%They are handled automatically by the mask system (see \autoref{subsec:DOM_msk}). 
     34 
     35%OPA allows land and topography grid points in the computational domain due to the presence of continents or islands, 
     36%and includes the use of a full or partial step representation of bottom topography. 
     37%The computation is performed over the whole domain, \ie\ we do not try to restrict the computation to ocean-only points. 
     38%This choice has two motivations. 
     39%Firstly, working on ocean only grid points overloads the code and harms the code readability. 
     40%Secondly, and more importantly, it drastically reduces the vector portion of the computation, 
     41%leading to a dramatic increase of CPU time requirement on vector computers. 
     42%The current section describes how the masking affects the computation of the various terms of the equations 
     43%with respect to the boundary condition at solid walls. 
     44%The process of defining which areas are to be masked is described in \autoref{subsec:DOM_msk}. 
     45 
     46Options are defined through the \nam{lbc} namelist variables. 
    3147The discrete representation of a domain with complex boundaries (coastlines and bottom topography) leads to 
    3248arrays that include large portions where a computation is not required as the model variables remain at zero. 
     
    4056Since most of the boundary conditions consist of a zero flux across the solid boundaries, 
    4157they can be simply applied by multiplying variables by the correct mask arrays, 
    42 \ie the mask array of the grid point where the flux is evaluated. 
     58\ie\ the mask array of the grid point where the flux is evaluated. 
    4359For example, the heat flux in the \textbf{i}-direction is evaluated at $u$-points. 
    4460Evaluating this quantity as, 
    4561 
    4662\[ 
    47   % \label{eq:lbc_aaaa} 
     63  % \label{eq:LBC_aaaa} 
    4864  \frac{A^{lT} }{e_1 }\frac{\partial T}{\partial i}\equiv \frac{A_u^{lT} 
    4965  }{e_{1u} } \; \delta_{i+1 / 2} \left[ T \right]\;\;mask_u 
     
    5167(where mask$_{u}$ is the mask array at a $u$-point) ensures that the heat flux is zero inside land and 
    5268at the boundaries, since mask$_{u}$ is zero at solid boundaries which in this case are defined at $u$-points 
    53 (normal velocity $u$ remains zero at the coast) (\autoref{fig:LBC_uv}).  
     69(normal velocity $u$ remains zero at the coast) (\autoref{fig:LBC_uv}). 
    5470 
    5571%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    5672\begin{figure}[!t] 
    57   \begin{center} 
    58     \includegraphics[width=0.90\textwidth]{Fig_LBC_uv} 
    59     \caption{ 
    60       \protect\label{fig:LBC_uv} 
    61       Lateral boundary (thick line) at T-level. 
    62       The velocity normal to the boundary is set to zero. 
    63     } 
    64   \end{center} 
     73  \centering 
     74  \includegraphics[width=\textwidth]{Fig_LBC_uv} 
     75  \caption[Lateral boundary at $T$-level]{ 
     76    Lateral boundary (thick line) at T-level. 
     77    The velocity normal to the boundary is set to zero.} 
     78  \label{fig:LBC_uv} 
    6579\end{figure} 
    6680%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    8498%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    8599\begin{figure}[!p] 
    86   \begin{center} 
    87     \includegraphics[width=0.90\textwidth]{Fig_LBC_shlat} 
    88     \caption{ 
    89       \protect\label{fig:LBC_shlat} 
    90       lateral boundary condition 
    91       (a) free-slip ($rn\_shlat=0$); 
    92       (b) no-slip ($rn\_shlat=2$); 
    93       (c) "partial" free-slip ($0<rn\_shlat<2$) and 
    94       (d) "strong" no-slip ($2<rn\_shlat$). 
    95       Implied "ghost" velocity inside land area is display in grey. 
    96     } 
    97   \end{center} 
     100  \centering 
     101  \includegraphics[width=\textwidth]{Fig_LBC_shlat} 
     102  \caption[Lateral boundary conditions]{ 
     103    Lateral boundary conditions 
     104    (a) free-slip                       (\protect\np{rn\_shlat}\forcode{=0}); 
     105    (b) no-slip                         (\protect\np{rn\_shlat}\forcode{=2}); 
     106    (c) "partial" free-slip (\forcode{0<}\protect\np{rn\_shlat}\forcode{<2}) and 
     107    (d) "strong" no-slip    (\forcode{2<}\protect\np{rn\_shlat}). 
     108    Implied "ghost" velocity inside land area is display in grey.} 
     109  \label{fig:LBC_shlat} 
    98110\end{figure} 
    99111%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    101113\begin{description} 
    102114 
    103 \item[free-slip boundary condition (\np{rn\_shlat}\forcode{ = 0}):] the tangential velocity at 
     115\item[free-slip boundary condition (\np{rn\_shlat}\forcode{=0}):] the tangential velocity at 
    104116  the coastline is equal to the offshore velocity, 
    105   \ie the normal derivative of the tangential velocity is zero at the coast, 
     117  \ie\ the normal derivative of the tangential velocity is zero at the coast, 
    106118  so the vorticity: mask$_{f}$ array is set to zero inside the land and just at the coast 
    107119  (\autoref{fig:LBC_shlat}-a). 
    108120 
    109 \item[no-slip boundary condition (\np{rn\_shlat}\forcode{ = 2}):] the tangential velocity vanishes at the coastline. 
     121\item[no-slip boundary condition (\np{rn\_shlat}\forcode{=2}):] the tangential velocity vanishes at the coastline. 
    110122  Assuming that the tangential velocity decreases linearly from 
    111123  the closest ocean velocity grid point to the coastline, 
     
    113125  the closest ocean velocity gridpoint were of the same magnitude but in the opposite direction 
    114126  (\autoref{fig:LBC_shlat}-b). 
    115   Therefore, the vorticity along the coastlines is given by:  
     127  Therefore, the vorticity along the coastlines is given by: 
    116128 
    117129  \[ 
     
    122134  the no-slip boundary condition, simply by multiplying it by the mask$_{f}$ : 
    123135  \[ 
    124     % \label{eq:lbc_bbbb} 
     136    % \label{eq:LBC_bbbb} 
    125137    \zeta \equiv \frac{1}{e_{1f} {\kern 1pt}e_{2f} }\left( {\delta_{i+1/2} 
    126138        \left[ {e_{2v} \,v} \right]-\delta_{j+1/2} \left[ {e_{1u} \,u} \right]} 
     
    129141 
    130142\item["partial" free-slip boundary condition (0$<$\np{rn\_shlat}$<$2):] the tangential velocity at 
    131   the coastline is smaller than the offshore velocity, \ie there is a lateral friction but 
     143  the coastline is smaller than the offshore velocity, \ie\ there is a lateral friction but 
    132144  not strong enough to make the tangential velocity at the coast vanish (\autoref{fig:LBC_shlat}-c). 
    133145  This can be selected by providing a value of mask$_{f}$ strictly inbetween $0$ and $2$. 
     
    139151\end{description} 
    140152 
    141 Note that when the bottom topography is entirely represented by the $s$-coor-dinates (pure $s$-coordinate), 
     153Note that when the bottom topography is entirely represented by the $s$-coordinates (pure $s$-coordinate), 
    142154the lateral boundary condition on tangential velocity is of much less importance as 
    143155it is only applied next to the coast where the minimum water depth can be quite shallow. 
     
    147159% Boundary Condition around the Model Domain 
    148160% ================================================================ 
    149 \section{Model domain boundary condition (\protect\np{jperio})} 
     161\section[Model domain boundary condition (\texttt{jperio})] 
     162{Model domain boundary condition (\protect\jp{jperio})} 
    150163\label{sec:LBC_jperio} 
    151164 
     
    153166closed, cyclic east-west, cyclic north-south, a north-fold, and combination closed-north fold or 
    154167bi-cyclic east-west and north-fold. 
    155 The north-fold boundary condition is associated with the 3-pole ORCA mesh.  
     168The north-fold boundary condition is associated with the 3-pole ORCA mesh. 
    156169 
    157170% ------------------------------------------------------------------------------------------------------------- 
    158 %        Closed, cyclic (\np{jperio}\forcode{ = 0..2})  
     171%        Closed, cyclic (\jp{jperio}\forcode{ = 0..2}) 
    159172% ------------------------------------------------------------------------------------------------------------- 
    160 \subsection{Closed, cyclic (\protect\np{jperio}\forcode{= [0127]})} 
     173\subsection[Closed, cyclic (\forcode{jperio=[0127]})] 
     174{Closed, cyclic (\protect\jp{jperio}\forcode{=[0127]})} 
    161175\label{subsec:LBC_jperio012} 
    162176 
    163177The choice of closed or cyclic model domain boundary condition is made by 
    164 setting \np{jperio} to 0, 1, 2 or 7 in namelist \ngn{namcfg}. 
     178setting \jp{jperio} to 0, 1, 2 or 7 in namelist \nam{cfg}. 
    165179Each time such a boundary condition is needed, it is set by a call to routine \mdl{lbclnk}. 
    166180The computation of momentum and tracer trends proceeds from $i=2$ to $i=jpi-1$ and from $j=2$ to $j=jpj-1$, 
    167 \ie in the model interior. 
     181\ie\ in the model interior. 
    168182To choose a lateral model boundary condition is to specify the first and last rows and columns of 
    169 the model variables.  
     183the model variables. 
    170184 
    171185\begin{description} 
    172186 
    173 \item[For closed boundary (\np{jperio}\forcode{ = 0})], 
     187\item[For closed boundary (\jp{jperio}\forcode{=0})], 
    174188  solid walls are imposed at all model boundaries: 
    175189  first and last rows and columns are set to zero. 
    176190 
    177 \item[For cyclic east-west boundary (\np{jperio}\forcode{ = 1})], 
     191\item[For cyclic east-west boundary (\jp{jperio}\forcode{=1})], 
    178192  first and last rows are set to zero (closed) whilst the first column is set to 
    179193  the value of the last-but-one column and the last column to the value of the second one 
     
    181195  Whatever flows out of the eastern (western) end of the basin enters the western (eastern) end. 
    182196 
    183 \item[For cyclic north-south boundary (\np{jperio}\forcode{ = 2})], 
     197\item[For cyclic north-south boundary (\jp{jperio}\forcode{=2})], 
    184198  first and last columns are set to zero (closed) whilst the first row is set to 
    185199  the value of the last-but-one row and the last row to the value of the second one 
     
    187201  Whatever flows out of the northern (southern) end of the basin enters the southern (northern) end. 
    188202 
    189 \item[Bi-cyclic east-west and north-south boundary (\np{jperio}\forcode{ = 7})] combines cases 1 and 2. 
     203\item[Bi-cyclic east-west and north-south boundary (\jp{jperio}\forcode{=7})] combines cases 1 and 2. 
    190204 
    191205\end{description} 
     
    193207%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    194208\begin{figure}[!t] 
    195   \begin{center} 
    196     \includegraphics[width=1.0\textwidth]{Fig_LBC_jperio} 
    197     \caption{ 
    198       \protect\label{fig:LBC_jperio} 
    199       setting of (a) east-west cyclic  (b) symmetric across the equator boundary conditions. 
    200     } 
    201   \end{center} 
     209  \centering 
     210  \includegraphics[width=\textwidth]{Fig_LBC_jperio} 
     211  \caption[Setting of east-west cyclic and symmetric across the Equator boundary conditions]{ 
     212    Setting of (a) east-west cyclic (b) symmetric across the Equator boundary conditions} 
     213  \label{fig:LBC_jperio} 
    202214\end{figure} 
    203215%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    204216 
    205217% ------------------------------------------------------------------------------------------------------------- 
    206 %        North fold (\textit{jperio = 3 }to $6)$  
     218%        North fold (\textit{jperio = 3 }to $6)$ 
    207219% ------------------------------------------------------------------------------------------------------------- 
    208 \subsection{North-fold (\protect\np{jperio}\forcode{ = 3..6})} 
     220\subsection[North-fold (\forcode{jperio=[3-6]})] 
     221{North-fold (\protect\jp{jperio}\forcode{=[3-6]})} 
    209222\label{subsec:LBC_north_fold} 
    210223 
    211224The north fold boundary condition has been introduced in order to handle the north boundary of 
    212225a three-polar ORCA grid. 
    213 Such a grid has two poles in the northern hemisphere (\autoref{fig:MISC_ORCA_msh}, 
    214 and thus requires a specific treatment illustrated in \autoref{fig:North_Fold_T}.  
     226Such a grid has two poles in the northern hemisphere (\autoref{fig:CFGS_ORCA_msh}, 
     227and thus requires a specific treatment illustrated in \autoref{fig:LBC_North_Fold_T}. 
    215228Further information can be found in \mdl{lbcnfd} module which applies the north fold boundary condition. 
    216229 
    217230%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    218231\begin{figure}[!t] 
    219   \begin{center} 
    220     \includegraphics[width=0.90\textwidth]{Fig_North_Fold_T} 
    221     \caption{ 
    222       \protect\label{fig:North_Fold_T} 
    223       North fold boundary with a $T$-point pivot and cyclic east-west boundary condition ($jperio=4$), 
    224       as used in ORCA 2, 1/4, and 1/12. 
    225       Pink shaded area corresponds to the inner domain mask (see text). 
    226     } 
    227   \end{center} 
     232  \centering 
     233  \includegraphics[width=\textwidth]{Fig_North_Fold_T} 
     234  \caption[North fold boundary in ORCA 2\deg, 1/4\deg and 1/12\deg]{ 
     235    North fold boundary with a $T$-point pivot and cyclic east-west boundary condition ($jperio=4$), 
     236    as used in ORCA 2\deg, 1/4\deg and 1/12\deg. 
     237    Pink shaded area corresponds to the inner domain mask (see text).} 
     238  \label{fig:LBC_North_Fold_T} 
    228239\end{figure} 
    229240%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    230241 
    231242% ==================================================================== 
    232 % Exchange with neighbouring processors  
     243% Exchange with neighbouring processors 
    233244% ==================================================================== 
    234 \section{Exchange with neighbouring processors (\protect\mdl{lbclnk}, \protect\mdl{lib\_mpp})} 
     245\section[Exchange with neighbouring processors (\textit{lbclnk.F90}, \textit{lib\_mpp.F90})] 
     246{Exchange with neighbouring processors (\protect\mdl{lbclnk}, \protect\mdl{lib\_mpp})} 
    235247\label{sec:LBC_mpp} 
    236248 
     249%-----------------------------------------nammpp-------------------------------------------- 
     250 
     251\begin{listing} 
     252  \nlst{nammpp} 
     253  \caption{\texttt{nammpp}} 
     254  \label{lst:nammpp} 
     255\end{listing} 
     256%----------------------------------------------------------------------------------------------- 
     257 
    237258For massively parallel processing (mpp), a domain decomposition method is used. 
    238 The basic idea of the method is to split the large computation domain of a numerical experiment into 
    239 several smaller domains and solve the set of equations by addressing independent local problems. 
     259The basic idea of the method is to split the large computation domain of a numerical experiment into several smaller domains and 
     260solve the set of equations by addressing independent local problems. 
    240261Each processor has its own local memory and computes the model equation over a subdomain of the whole model domain. 
    241 The subdomain boundary conditions are specified through communications between processors which 
    242 are organized by explicit statements (message passing method). 
    243  
    244 A big advantage is that the method does not need many modifications of the initial \fortran code. 
    245 From the modeller's point of view, each sub domain running on a processor is identical to the "mono-domain" code. 
    246 In addition, the programmer manages the communications between subdomains, 
    247 and the code is faster when the number of processors is increased. 
    248 The porting of OPA code on an iPSC860 was achieved during Guyon's PhD [Guyon et al. 1994, 1995] 
    249 in collaboration with CETIIS and ONERA. 
    250 The implementation in the operational context and the studies of performance on 
    251 a T3D and T3E Cray computers have been made in collaboration with IDRIS and CNRS. 
     262The subdomain boundary conditions are specified through communications between processors which are organized by 
     263explicit statements (message passing method). 
    252264The present implementation is largely inspired by Guyon's work [Guyon 1995]. 
    253265 
     
    256268depend at the very most on one neighbouring point. 
    257269The only non-local computations concern the vertical physics 
    258 (implicit diffusion, turbulent closure scheme, ...) (delocalization over the whole water column), 
    259 and the solving of the elliptic equation associated with the surface pressure gradient computation 
    260 (delocalization over the whole horizontal domain). 
     270(implicit diffusion, turbulent closure scheme, ...). 
    261271Therefore, a pencil strategy is used for the data sub-structuration: 
    262272the 3D initial domain is laid out on local processor memories following a 2D horizontal topological splitting. 
     
    267277After a computation, a communication phase starts: 
    268278each processor sends to its neighbouring processors the update values of the points corresponding to 
    269 the interior overlapping area to its neighbouring sub-domain (\ie the innermost of the two overlapping rows). 
    270 The communication is done through the Message Passing Interface (MPI). 
     279the interior overlapping area to its neighbouring sub-domain (\ie\ the innermost of the two overlapping rows). 
     280Communications are first done according to the east-west direction and next according to the north-south direction. 
     281There is no specific communications for the corners. 
     282The communication is done through the Message Passing Interface (MPI) and requires \key{mpp\_mpi}. 
     283Use also \key{mpi2} if MPI3 is not available on your computer. 
    271284The data exchanges between processors are required at the very place where 
    272285lateral domain boundary conditions are set in the mono-domain computation: 
    273286the \rou{lbc\_lnk} routine (found in \mdl{lbclnk} module) which manages such conditions is interfaced with 
    274 routines found in \mdl{lib\_mpp} module when running on an MPP computer (\ie when \key{mpp\_mpi} defined). 
    275 It has to be pointed out that when using the MPP version of the model, 
    276 the east-west cyclic boundary condition is done implicitly, 
    277 whilst the south-symmetric boundary condition option is not available. 
     287routines found in \mdl{lib\_mpp} module. 
     288The output file \textit{communication\_report.txt} provides the list of which routines do how 
     289many communications during 1 time step of the model.\\ 
    278290 
    279291%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    280292\begin{figure}[!t] 
    281   \begin{center} 
    282     \includegraphics[width=0.90\textwidth]{Fig_mpp} 
    283     \caption{ 
    284       \protect\label{fig:mpp} 
    285       Positioning of a sub-domain when massively parallel processing is used. 
    286     } 
    287   \end{center} 
     293  \centering 
     294  \includegraphics[width=\textwidth]{Fig_mpp} 
     295  \caption{Positioning of a sub-domain when massively parallel processing is used} 
     296  \label{fig:LBC_mpp} 
    288297\end{figure} 
    289298%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    290299 
    291 In the standard version of \NEMO, the splitting is regular and arithmetic. 
    292 The i-axis is divided by \jp{jpni} and 
    293 the j-axis by \jp{jpnj} for a number of processors \jp{jpnij} most often equal to $jpni \times jpnj$ 
    294 (parameters set in  \ngn{nammpp} namelist). 
    295 Each processor is independent and without message passing or synchronous process, 
    296 programs run alone and access just its own local memory. 
    297 For this reason, the main model dimensions are now the local dimensions of the subdomain (pencil) that 
    298 are named \jp{jpi}, \jp{jpj}, \jp{jpk}. 
     300In \NEMO, the splitting is regular and arithmetic. 
     301The total number of subdomains corresponds to the number of MPI processes allocated to \NEMO\ when the model is launched 
     302(\ie\ mpirun -np x ./nemo will automatically give x subdomains). 
     303The i-axis is divided by \np{jpni} and the j-axis by \np{jpnj}. 
     304These parameters are defined in \nam{mpp} namelist. 
     305If \np{jpni} and \np{jpnj} are < 1, they will be automatically redefined in the code to give the best domain decomposition 
     306(see bellow). 
     307 
     308Each processor is independent and without message passing or synchronous process, programs run alone and access just its own local memory. 
     309For this reason, 
     310the main model dimensions are now the local dimensions of the subdomain (pencil) that are named \jp{jpi}, \jp{jpj}, \jp{jpk}. 
    299311These dimensions include the internal domain and the overlapping rows. 
    300 The number of rows to exchange (known as the halo) is usually set to one (\jp{jpreci}=1, in \mdl{par\_oce}). 
    301 The whole domain dimensions are named \np{jpiglo}, \np{jpjglo} and \jp{jpk}. 
     312The number of rows to exchange (known as the halo) is usually set to one (nn\_hls=1, in \mdl{par\_oce}, 
     313and must be kept to one until further notice). 
     314The whole domain dimensions are named \jp{jpiglo}, \jp{jpjglo} and \jp{jpk}. 
    302315The relationship between the whole domain and a sub-domain is: 
     316\begin{gather*} 
     317  jpi = ( jpiglo-2\times nn\_hls + (jpni-1) ) / jpni + 2\times nn\_hls \\ 
     318  jpj = ( jpjglo-2\times nn\_hls + (jpnj-1) ) / jpnj + 2\times nn\_hls 
     319\end{gather*} 
     320 
     321One also defines variables nldi and nlei which correspond to the internal domain bounds, and the variables nimpp and njmpp which are the position of the (1,1) grid-point in the global domain (\autoref{fig:LBC_mpp}). Note that since the version 4, there is no more extra-halo area as defined in \autoref{fig:LBC_mpp} so \jp{jpi} is now always equal to nlci and \jp{jpj} equal to nlcj. 
     322 
     323An element of $T_{l}$, a local array (subdomain) corresponds to an element of $T_{g}$, 
     324a global array (whole domain) by the relationship: 
    303325\[ 
    304   jpi = ( jpiglo-2*jpreci + (jpni-1) ) / jpni + 2*jpreci 
    305   jpj = ( jpjglo-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj 
    306 \] 
    307 where \jp{jpni}, \jp{jpnj} are the number of processors following the i- and j-axis. 
    308  
    309 One also defines variables nldi and nlei which correspond to the internal domain bounds,  
    310 and the variables nimpp and njmpp which are the position of the (1,1) grid-point in the global domain.  
    311 An element of $T_{l}$, a local array (subdomain) corresponds to an element of $T_{g}$, 
    312 a global array (whole domain) by the relationship:  
    313 \[ 
    314   % \label{eq:lbc_nimpp} 
     326  % \label{eq:LBC_nimpp} 
    315327  T_{g} (i+nimpp-1,j+njmpp-1,k) = T_{l} (i,j,k), 
    316328\] 
    317 with  $1 \leq i \leq jpi$, $1  \leq j \leq jpj $ , and  $1  \leq k \leq jpk$. 
    318  
    319 Processors are numbered from 0 to $jpnij-1$, the number is saved in the variable nproc. 
    320 In the standard version, a processor has no more than 
    321 four neighbouring processors named nono (for north), noea (east), noso (south) and nowe (west) and 
    322 two variables, nbondi and nbondj, indicate the relative position of the processor: 
    323 \begin{itemize} 
    324 \item       nbondi = -1    an east neighbour, no west processor, 
    325 \item       nbondi =  0 an east neighbour, a west neighbour, 
    326 \item       nbondi =  1    no east processor, a west neighbour, 
    327 \item       nbondi =  2    no splitting following the i-axis. 
    328 \end{itemize} 
    329 During the simulation, processors exchange data with their neighbours. 
    330 If there is effectively a neighbour, the processor receives variables from this processor on its overlapping row, 
    331 and sends the data issued from internal domain corresponding to the overlapping row of the other processor. 
    332  
    333  
    334 The \NEMO model computes equation terms with the help of mask arrays (0 on land points and 1 on sea points). 
    335 It is easily readable and very efficient in the context of a computer with vectorial architecture. 
    336 However, in the case of a scalar processor, computations over the land regions become more expensive in 
    337 terms of CPU time.  
    338 It is worse when we use a complex configuration with a realistic bathymetry like the global ocean where 
    339 more than 50 \% of points are land points. 
    340 For this reason, a pre-processing tool can be used to choose the mpp domain decomposition with a maximum number of 
    341 only land points processors, which can then be eliminated (\autoref{fig:mppini2}) 
    342 (For example, the mpp\_optimiz tools, available from the DRAKKAR web site). 
    343 This optimisation is dependent on the specific bathymetry employed. 
    344 The user then chooses optimal parameters \jp{jpni}, \jp{jpnj} and \jp{jpnij} with $jpnij < jpni \times jpnj$, 
    345 leading to the elimination of $jpni \times jpnj - jpnij$ land processors. 
    346 When those parameters are specified in \ngn{nammpp} namelist, 
    347 the algorithm in the \rou{inimpp2} routine sets each processor's parameters (nbound, nono, noea,...) so that 
    348 the land-only processors are not taken into account. 
    349  
    350 \gmcomment{Note that the inimpp2 routine is general so that the original inimpp  
    351 routine should be suppressed from the code.} 
    352  
    353 When land processors are eliminated, 
    354 the value corresponding to these locations in the model output files is undefined. 
    355 Note that this is a problem for the meshmask file which requires to be defined over the whole domain. 
    356 Therefore, user should not eliminate land processors when creating a meshmask file 
    357 (\ie when setting a non-zero value to \np{nn\_msh}). 
     329with $1 \leq i \leq jpi$, $1  \leq j \leq jpj $ , and  $1  \leq k \leq jpk$. 
     330 
     331The 1-d arrays $mig(1:\jp{jpi})$ and $mjg(1:\jp{jpj})$, defined in \rou{dom\_glo} routine (\mdl{domain} module), should be used to get global domain indices from local domain indices. The 1-d arrays, $mi0(1:\jp{jpiglo})$, $mi1(1:\jp{jpiglo})$ and $mj0(1:\jp{jpjglo})$, $mj1(1:\jp{jpjglo})$ have the reverse purpose and should be used to define loop indices expressed in global domain indices (see examples in \mdl{dtastd} module).\\ 
     332 
     333The \NEMO\ model computes equation terms with the help of mask arrays (0 on land points and 1 on sea points). It is therefore possible that an MPI subdomain contains only land points. To save ressources, we try to supress from the computational domain as much land subdomains as possible. For example if $N_{mpi}$ processes are allocated to NEMO, the domain decomposition will be given by the following equation: 
     334\[ 
     335  N_{mpi} = jpni \times jpnj - N_{land} + N_{useless} 
     336\] 
     337$N_{land}$ is the total number of land subdomains in the domain decomposition defined by \np{jpni} and \np{jpnj}. $N_{useless}$ is the number of land subdomains that are kept in the compuational domain in order to make sure that $N_{mpi}$ MPI processes are indeed allocated to a given subdomain. The values of $N_{mpi}$, \np{jpni}, \np{jpnj},  $N_{land}$ and $N_{useless}$ are printed in the output file \texttt{ocean.output}. $N_{useless}$ must, of course, be as small as possible to limit the waste of ressources. A warning is issued in  \texttt{ocean.output} if $N_{useless}$ is not zero. Note that non-zero value of $N_{useless}$ is uselly required when using AGRIF as, up to now, the parent grid and each of the child grids must use all the $N_{mpi}$ processes. 
     338 
     339If the domain decomposition is automatically defined (when \np{jpni} and \np{jpnj} are < 1), the decomposition chosen by the model will minimise the sub-domain size (defined as $max_{all domains}(jpi \times jpj)$) and maximize the number of eliminated land subdomains. This means that no other domain decomposition (a set of \np{jpni} and \np{jpnj} values) will use less processes than $(jpni  \times  jpnj - N_{land})$ and get a smaller subdomain size. 
     340In order to specify $N_{mpi}$ properly (minimize $N_{useless}$), you must run the model once with \np{ln\_list} activated. In this case, the model will start the initialisation phase, print the list of optimum decompositions ($N_{mpi}$, \np{jpni} and \np{jpnj}) in \texttt{ocean.output} and directly abort. The maximum value of $N_{mpi}$ tested in this list is given by $max(N_{MPI\_tasks}, jpni \times jpnj)$. For example, run the model on 40 nodes with ln\_list activated and $jpni = 10000$ and $jpnj = 1$, will print the list of optimum domains decomposition from 1 to about 10000. 
     341 
     342Processors are numbered from 0 to $N_{mpi} - 1$. Subdomains containning some ocean points are numbered first from 0 to $jpni * jpnj - N_{land} -1$. The remaining $N_{useless}$ land subdomains are numbered next, which means that, for a given (\np{jpni}, \np{jpnj}), the numbers attributed to he ocean subdomains do not vary with $N_{useless}$. 
     343 
     344When land processors are eliminated, the value corresponding to these locations in the model output files is undefined. \np{ln\_mskland} must be activated in order avoid Not a Number values in output files. Note that it is better to not eliminate land processors when creating a meshmask file (\ie\ when setting a non-zero value to \np{nn\_msh}). 
    358345 
    359346%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    360347\begin{figure}[!ht] 
    361   \begin{center} 
    362     \includegraphics[width=0.90\textwidth]{Fig_mppini2} 
    363     \caption { 
    364       \protect\label{fig:mppini2} 
    365       Example of Atlantic domain defined for the CLIPPER projet. 
    366       Initial grid is composed of 773 x 1236 horizontal points. 
    367       (a) the domain is split onto 9 \time 20 subdomains (jpni=9, jpnj=20). 
    368       52 subdomains are land areas. 
    369       (b) 52 subdomains are eliminated (white rectangles) and 
    370       the resulting number of processors really used during the computation is jpnij=128. 
    371     } 
    372   \end{center} 
     348  \centering 
     349  \includegraphics[width=\textwidth]{Fig_mppini2} 
     350  \caption[Atlantic domain defined for the CLIPPER projet]{ 
     351    Example of Atlantic domain defined for the CLIPPER projet. 
     352    Initial grid is composed of 773 x 1236 horizontal points. 
     353    (a) the domain is split onto 9 $times$ 20 subdomains (jpni=9, jpnj=20). 
     354    52 subdomains are land areas. 
     355    (b) 52 subdomains are eliminated (white rectangles) and 
     356    the resulting number of processors really used during the computation is jpnij=128.} 
     357  \label{fig:LBC_mppini2} 
    373358\end{figure} 
    374359%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    376361 
    377362% ==================================================================== 
    378 % Unstructured open boundaries BDY  
     363% Unstructured open boundaries BDY 
    379364% ==================================================================== 
    380365\section{Unstructured open boundary conditions (BDY)} 
     
    383368%-----------------------------------------nambdy-------------------------------------------- 
    384369 
    385 \nlst{nambdy}  
     370\begin{listing} 
     371  \nlst{nambdy} 
     372  \caption{\texttt{nambdy}} 
     373  \label{lst:nambdy} 
     374\end{listing} 
    386375%----------------------------------------------------------------------------------------------- 
    387376%-----------------------------------------nambdy_dta-------------------------------------------- 
    388377 
    389 \nlst{nambdy_dta}  
     378\begin{listing} 
     379  \nlst{nambdy_dta} 
     380  \caption{\texttt{nambdy\_dta}} 
     381  \label{lst:nambdy_dta} 
     382\end{listing} 
    390383%----------------------------------------------------------------------------------------------- 
    391384 
    392 Options are defined through the \ngn{nambdy} \ngn{nambdy\_dta} namelist variables. 
    393 The BDY module is the core implementation of open boundary conditions for regional configurations on  
    394 temperature, salinity, barotropic and baroclinic velocities, as well as ice concentration, ice and snow thicknesses). 
    395  
    396 The BDY module was modelled on the OBC module (see NEMO 3.4) and shares many features and 
    397 a similar coding structure \citep{Chanut2005}. 
     385Options are defined through the \nam{bdy} and \nam{bdy\_dta} namelist variables. 
     386The BDY module is the core implementation of open boundary conditions for regional configurations on 
     387ocean temperature, salinity, barotropic-baroclinic velocities, ice-snow concentration, thicknesses, temperatures, salinity and melt ponds concentration and thickness. 
     388 
     389The BDY module was modelled on the OBC module (see \NEMO\ 3.4) and shares many features and 
     390a similar coding structure \citep{chanut_rpt05}. 
    398391The specification of the location of the open boundary is completely flexible and 
    399 allows for example the open boundary to follow an isobath or other irregular contour.  
    400 Boundary data files used with versions of NEMO prior to Version 3.4 may need to be re-ordered to work with this version. 
     392allows any type of setup, from regular boundaries to irregular contour (it includes the possibility to set an open boundary able to follow an isobath). 
     393Boundary data files used with versions of \NEMO\ prior to Version 3.4 may need to be re-ordered to work with this version. 
    401394See the section on the Input Boundary Data Files for details. 
    402395 
    403396%---------------------------------------------- 
    404397\subsection{Namelists} 
    405 \label{subsec:BDY_namelist} 
    406  
    407 The BDY module is activated by setting \np{ln\_bdy}\forcode{ = .true.} . 
     398\label{subsec:LBC_bdy_namelist} 
     399 
     400The BDY module is activated by setting \np{ln\_bdy}\forcode{=.true.} . 
    408401It is possible to define more than one boundary ``set'' and apply different boundary conditions to each set. 
    409402The number of boundary sets is defined by \np{nb\_bdy}. 
    410 Each boundary set may be defined as a set of straight line segments in a namelist 
    411 (\np{ln\_coords\_file}\forcode{ = .false.}) or read in from a file (\np{ln\_coords\_file}\forcode{ = .true.}). 
    412 If the set is defined in a namelist, then the namelists \ngn{nambdy\_index} must be included separately, one for each set. 
    413 If the set is defined by a file, then a ``\ifile{coordinates.bdy}'' file must be provided. 
    414 The coordinates.bdy file is analagous to the usual NEMO ``\ifile{coordinates}'' file. 
     403Each boundary set can be either defined as a series of straight line segments directly in the namelist 
     404(\np{ln\_coords\_file}\forcode{=.false.}, and a namelist block \nam{bdy\_index} must be included for each set) or read in from a file (\np{ln\_coords\_file}\forcode{=.true.}, and a ``\ifile{coordinates.bdy}'' file must be provided). 
     405The coordinates.bdy file is analagous to the usual \NEMO\ ``\ifile{coordinates}'' file. 
    415406In the example above, there are two boundary sets, the first of which is defined via a file and 
    416 the second is defined in a namelist. 
    417 For more details of the definition of the boundary geometry see section \autoref{subsec:BDY_geometry}. 
     407the second is defined in the namelist. 
     408For more details of the definition of the boundary geometry see section \autoref{subsec:LBC_bdy_geometry}. 
    418409 
    419410For each boundary set a boundary condition has to be chosen for the barotropic solution 
    420 (``u2d'':sea-surface height and barotropic velocities), for the baroclinic velocities (``u3d''),  
    421 for the active tracers \footnote{The BDY module does not deal with passive tracers at this version} (``tra''), and sea-ice (``ice''). 
    422 For each set of variables there is a choice of algorithm and a choice for the data, 
    423 eg. for the active tracers the algorithm is set by \np{cn\_tra} and the choice of data is set by \np{nn\_tra\_dta}.\\  
     411(``u2d'':sea-surface height and barotropic velocities), for the baroclinic velocities (``u3d''), 
     412for the active tracers \footnote{The BDY module does not deal with passive tracers at this version} (``tra''), and for sea-ice (``ice''). 
     413For each set of variables one has to choose an algorithm and the boundary data (set resp. by \np{cn\_tra} and \np{nn\_tra\_dta} for tracers).\\ 
    424414 
    425415The choice of algorithm is currently as follows: 
     
    431421\item[\forcode{'neumann'}:] Value at the boundary are duplicated (No gradient). Only available for baroclinic velocity and tracer variables. 
    432422\item[\forcode{'frs'}:] Flow Relaxation Scheme (FRS) available for all variables. 
    433 \item[\forcode{'Orlanski'}:] Orlanski radiation scheme (fully oblique) for barotropic, baroclinic and tracer variables.  
    434 \item[\forcode{'Orlanski_npo'}:] Orlanski radiation scheme for barotropic, baroclinic and tracer variables.  
     423\item[\forcode{'Orlanski'}:] Orlanski radiation scheme (fully oblique) for barotropic, baroclinic and tracer variables. 
     424\item[\forcode{'Orlanski_npo'}:] Orlanski radiation scheme for barotropic, baroclinic and tracer variables. 
    435425\item[\forcode{'flather'}:] Flather radiation scheme for the barotropic variables only. 
    436426\end{description} 
    437427 
    438 The main choice for the boundary data is to use initial conditions as boundary data 
    439 (\np{nn\_tra\_dta}\forcode{ = 0}) or to use external data from a file (\np{nn\_tra\_dta}\forcode{ = 1}). 
    440 In case the 3d velocity data contain the total velocity (ie, baroclinic and barotropic velocity),  
    441 the bdy code can derived baroclinic and barotropic velocities by setting \np{ln\_full\_vel}\forcode{ = .true. } 
     428The boundary data is either set to initial conditions 
     429(\np{nn\_tra\_dta}\forcode{=0}) or forced with external data from a file (\np{nn\_tra\_dta}\forcode{=1}). 
     430In case the 3d velocity data contain the total velocity (ie, baroclinic and barotropic velocity), 
     431the bdy code can derived baroclinic and barotropic velocities by setting \np{ln\_full\_vel}\forcode{=.true.} 
    442432For the barotropic solution there is also the option to use tidal harmonic forcing either by 
    443 itself (\np{nn\_dyn2d\_dta}\forcode{ = 2}) or in addition to other external data (\np{nn\_dyn2d\_dta}\forcode{ = 3}).\\ 
    444 Sea-ice salinity, temperature and age data at the boundary are constant and defined repectively by \np{rn\_ice\_sal}, \np{rn\_ice\_tem} and \np{rn\_ice\_age}.  
    445  
    446 If external boundary data is required then the \ngn{nambdy\_dta} namelist must be defined. 
    447 One \ngn{nambdy\_dta} namelist is required for each boundary set in the order in which 
    448 the boundary sets are defined in nambdy. 
    449 In the example given, two boundary sets have been defined. The first one is reading data file in the \ngn{nambdy\_dta} namelist shown above  
    450 and the second one is using data from intial condition (no namelist bloc needed). 
     433itself (\np{nn\_dyn2d\_dta}\forcode{=2}) or in addition to other external data (\np{nn\_dyn2d\_dta}\forcode{=3}).\\ 
     434If not set to initial conditions, sea-ice salinity, temperatures and melt ponds data at the boundary can either be read in a file or defined as constant (by \np{rn\_ice\_sal}, \np{rn\_ice\_tem}, \np{rn\_ice\_apnd}, \np{rn\_ice\_hpnd}). Ice age is constant and defined by \np{rn\_ice\_age}. 
     435 
     436If external boundary data is required then the \nam{bdy\_dta} namelist must be defined. 
     437One \nam{bdy\_dta} namelist is required for each boundary set, adopting the same order of indexes in which the boundary sets are defined in nambdy. 
     438In the example given, two boundary sets have been defined. The first one is reading data file in the \nam{bdy\_dta} namelist shown above 
     439and the second one is using data from intial condition (no namelist block needed). 
    451440The boundary data is read in using the fldread module, 
    452 so the \ngn{nambdy\_dta} namelist is in the format required for fldread. 
    453 For each variable required, the filename, the frequency of the files and 
    454 the frequency of the data in the files is given. 
    455 Also whether or not time-interpolation is required and whether the data is climatological (time-cyclic) data.\\ 
     441so the \nam{bdy\_dta} namelist is in the format required for fldread. 
     442For each required variable, the filename, the frequency of the files and 
     443the frequency of the data in the files are given. 
     444Also whether or not time-interpolation is required and whether the data is climatological (time-cyclic) data. 
     445For sea-ice salinity, temperatures and melt ponds, reading the files are skipped and constant values are used if filenames are defined as {'NOT USED'}.\\ 
    456446 
    457447There is currently an option to vertically interpolate the open boundary data onto the native grid at run-time. 
    458 If \np{nn\_bdy\_jpk} $< -1$, it is assumed that the lateral boundary data are already on the native grid.  
    459 However, if \np{nn\_bdy\_jpk} is set to the number of vertical levels present in the boundary data,  
    460 a bilinear interpolation onto the native grid will be triggered at runtime.  
    461 For this to be successful the additional variables: $gdept$, $gdepu$, $gdepv$, $e3t$, $e3u$ and $e3v$, are required to be present in the lateral boundary files.  
    462 These correspond to the depths and scale factors of the input data,  
     448If \np{nn\_bdy\_jpk}$<-1$, it is assumed that the lateral boundary data are already on the native grid. 
     449However, if \np{nn\_bdy\_jpk} is set to the number of vertical levels present in the boundary data, 
     450a bilinear interpolation onto the native grid will be triggered at runtime. 
     451For this to be successful the additional variables: $gdept$, $gdepu$, $gdepv$, $e3t$, $e3u$ and $e3v$, are required to be present in the lateral boundary files. 
     452These correspond to the depths and scale factors of the input data, 
    463453the latter used to make any adjustment to the velocity fields due to differences in the total water depths between the two vertical grids.\\ 
    464454 
    465 In the example namelists given, two boundary sets are defined. 
     455In the example of given namelists, two boundary sets are defined. 
    466456The first set is defined via a file and applies FRS conditions to temperature and salinity and 
    467457Flather conditions to the barotropic variables. No condition specified for the baroclinic velocity and sea-ice. 
     
    469459Tidal harmonic forcing is also used. 
    470460The second set is defined in a namelist. 
    471 FRS conditions are applied on temperature and salinity and climatological data is read from initial condition files.  
     461FRS conditions are applied on temperature and salinity and climatological data is read from initial condition files. 
    472462 
    473463%---------------------------------------------- 
    474464\subsection{Flow relaxation scheme} 
    475 \label{subsec:BDY_FRS_scheme} 
    476  
    477 The Flow Relaxation Scheme (FRS) \citep{Davies_QJRMS76,Engerdahl_Tel95}, 
     465\label{subsec:LBC_bdy_FRS_scheme} 
     466 
     467The Flow Relaxation Scheme (FRS) \citep{davies_QJRMS76,engedahl_T95}, 
    478468applies a simple relaxation of the model fields to externally-specified values over 
    479469a zone next to the edge of the model domain. 
    480470Given a model prognostic variable $\Phi$ 
    481471\[ 
    482   % \label{eq:bdy_frs1} 
     472  % \label{eq:LBC_bdy_frs1} 
    483473  \Phi(d) = \alpha(d)\Phi_{e}(d) + (1-\alpha(d))\Phi_{m}(d)\;\;\;\;\; d=1,N 
    484474\] 
     
    489479the prognostic equation for $\Phi$ of the form: 
    490480\[ 
    491   % \label{eq:bdy_frs2} 
     481  % \label{eq:LBC_bdy_frs2} 
    492482  -\frac{1}{\tau}\left(\Phi - \Phi_{e}\right) 
    493483\] 
    494484where the relaxation time scale $\tau$ is given by a function of $\alpha$ and the model time step $\Delta t$: 
    495485\[ 
    496   % \label{eq:bdy_frs3} 
     486  % \label{eq:LBC_bdy_frs3} 
    497487  \tau = \frac{1-\alpha}{\alpha}  \,\rdt 
    498488\] 
     
    500490is relaxed towards the external conditions over the rest of the FRS zone. 
    501491The application of a relaxation zone helps to prevent spurious reflection of 
    502 outgoing signals from the model boundary.  
     492outgoing signals from the model boundary. 
    503493 
    504494The function $\alpha$ is specified as a $tanh$ function: 
    505495\[ 
    506   % \label{eq:bdy_frs4} 
     496  % \label{eq:LBC_bdy_frs4} 
    507497  \alpha(d) = 1 - \tanh\left(\frac{d-1}{2}\right),       \quad d=1,N 
    508498\] 
     
    512502%---------------------------------------------- 
    513503\subsection{Flather radiation scheme} 
    514 \label{subsec:BDY_flather_scheme} 
    515  
    516 The \citet{Flather_JPO94} scheme is a radiation condition on the normal, 
     504\label{subsec:LBC_bdy_flather_scheme} 
     505 
     506The \citet{flather_JPO94} scheme is a radiation condition on the normal, 
    517507depth-mean transport across the open boundary. 
    518508It takes the form 
    519 \begin{equation}  \label{eq:bdy_fla1} 
    520 U = U_{e} + \frac{c}{h}\left(\eta - \eta_{e}\right), 
     509\begin{equation} 
     510  \label{eq:LBC_bdy_fla1} 
     511  U = U_{e} + \frac{c}{h}\left(\eta - \eta_{e}\right), 
    521512\end{equation} 
    522513where $U$ is the depth-mean velocity normal to the boundary and $\eta$ is the sea surface height, 
     
    527518the external depth-mean normal velocity, 
    528519plus a correction term that allows gravity waves generated internally to exit the model boundary. 
    529 Note that the sea-surface height gradient in \autoref{eq:bdy_fla1} is a spatial gradient across the model boundary, 
     520Note that the sea-surface height gradient in \autoref{eq:LBC_bdy_fla1} is a spatial gradient across the model boundary, 
    530521so that $\eta_{e}$ is defined on the $T$ points with $nbr=1$ and $\eta$ is defined on the $T$ points with $nbr=2$. 
    531 $U$ and $U_{e}$ are defined on the $U$ or $V$ points with $nbr=1$, \ie between the two $T$ grid points. 
     522$U$ and $U_{e}$ are defined on the $U$ or $V$ points with $nbr=1$, \ie\ between the two $T$ grid points. 
    532523 
    533524%---------------------------------------------- 
    534525\subsection{Orlanski radiation scheme} 
    535 \label{subsec:BDY_orlanski_scheme} 
    536  
    537 The Orlanski scheme is based on the algorithm described by \citep{Marchesiello2001}, hereafter MMS. 
     526\label{subsec:LBC_bdy_orlanski_scheme} 
     527 
     528The Orlanski scheme is based on the algorithm described by \citep{marchesiello.mcwilliams.ea_OM01}, hereafter MMS. 
    538529 
    539530The adaptive Orlanski condition solves a wave plus relaxation equation at the boundary: 
    540531\begin{equation} 
    541 \frac{\partial\phi}{\partial t} + c_x \frac{\partial\phi}{\partial x} + c_y \frac{\partial\phi}{\partial y} = 
    542                                                 -\frac{1}{\tau}(\phi - \phi^{ext}) 
    543 \label{eq:wave_continuous} 
     532  \label{eq:LBC_wave_continuous} 
     533  \frac{\partial\phi}{\partial t} + c_x \frac{\partial\phi}{\partial x} + c_y \frac{\partial\phi}{\partial y} = 
     534  -\frac{1}{\tau}(\phi - \phi^{ext}) 
    544535\end{equation} 
    545536 
     
    547538velocities are diagnosed from the model fields as: 
    548539 
    549 \begin{equation} \label{eq:cx} 
    550 c_x = -\frac{\partial\phi}{\partial t}\frac{\partial\phi / \partial x}{(\partial\phi /\partial x)^2 + (\partial\phi /\partial y)^2} 
     540\begin{equation} 
     541  \label{eq:LBC_cx} 
     542  c_x = -\frac{\partial\phi}{\partial t}\frac{\partial\phi / \partial x}{(\partial\phi /\partial x)^2 + (\partial\phi /\partial y)^2} 
    551543\end{equation} 
    552544\begin{equation} 
    553 \label{eq:cy} 
    554 c_y = -\frac{\partial\phi}{\partial t}\frac{\partial\phi / \partial y}{(\partial\phi /\partial x)^2 + (\partial\phi /\partial y)^2} 
     545  \label{eq:LBC_cy} 
     546  c_y = -\frac{\partial\phi}{\partial t}\frac{\partial\phi / \partial y}{(\partial\phi /\partial x)^2 + (\partial\phi /\partial y)^2} 
    555547\end{equation} 
    556548 
    557549(As noted by MMS, this is a circular diagnosis of the phase speeds which only makes sense on a discrete grid). 
    558 Equation (\autoref{eq:wave_continuous}) is defined adaptively depending on the sign of the phase velocity normal to the boundary $c_x$. 
     550Equation (\autoref{eq:LBC_wave_continuous}) is defined adaptively depending on the sign of the phase velocity normal to the boundary $c_x$. 
    559551For $c_x$ outward, we have 
    560552 
     
    566558 
    567559\begin{equation} 
    568 \tau = \tau_{in}\,\,\,;\,\,\, c_x = c_y = 0 
    569 \label{eq:tau_in} 
     560  \label{eq:LBC_tau_in} 
     561  \tau = \tau_{in}\,\,\,;\,\,\, c_x = c_y = 0 
    570562\end{equation} 
    571563 
    572 Generally the relaxation time scale at inward propagation points \np{(rn\_time\_dmp}) is set much shorter than the time scale at outward propagation 
     564Generally the relaxation time scale at inward propagation points (\np{rn\_time\_dmp}) is set much shorter than the time scale at outward propagation 
    573565points (\np{rn\_time\_dmp\_out}) so that the solution is constrained more strongly by the external data at inward propagation points. 
    574 See \autoref{subsec:BDY_relaxation} for detailed on the spatial shape of the scaling.\\  
    575 The ``normal propagation of oblique radiation'' or NPO approximation (called \forcode{'orlanski_npo'}) involves assuming  
    576 that $c_y$ is zero in equation (\autoref{eq:wave_continuous}), but including 
    577 this term in the denominator of equation (\autoref{eq:cx}). Both versions of the scheme are options in BDY. Equations 
    578 (\autoref{eq:wave_continuous}) - (\autoref{eq:tau_in}) correspond to equations (13) - (15) and (2) - (3) in MMS.\\ 
     566See \autoref{subsec:LBC_bdy_relaxation} for detailed on the spatial shape of the scaling.\\ 
     567The ``normal propagation of oblique radiation'' or NPO approximation (called \forcode{'orlanski_npo'}) involves assuming 
     568that $c_y$ is zero in equation (\autoref{eq:LBC_wave_continuous}), but including 
     569this term in the denominator of equation (\autoref{eq:LBC_cx}). Both versions of the scheme are options in BDY. Equations 
     570(\autoref{eq:LBC_wave_continuous}) - (\autoref{eq:LBC_tau_in}) correspond to equations (13) - (15) and (2) - (3) in MMS.\\ 
    579571 
    580572%---------------------------------------------- 
    581573\subsection{Relaxation at the boundary} 
    582 \label{subsec:BDY_relaxation} 
    583  
    584 In addition to a specific boundary condition specified as \np{cn\_tra} and \np{cn\_dyn3d}, relaxation on baroclinic velocities and tracers variables are available.  
     574\label{subsec:LBC_bdy_relaxation} 
     575 
     576In addition to a specific boundary condition specified as \np{cn\_tra} and \np{cn\_dyn3d}, relaxation on baroclinic velocities and tracers variables are available. 
    585577It is control by the namelist parameter \np{ln\_tra\_dmp} and \np{ln\_dyn3d\_dmp} for each boundary set. 
    586578 
    587 The relaxation time scale value (\np{rn\_time\_dmp} and \np{rn\_time\_dmp\_out}, $\tau$) are defined at the boundaries itself.  
     579The relaxation time scale value (\np{rn\_time\_dmp} and \np{rn\_time\_dmp\_out}, $\tau$) are defined at the boundaries itself. 
    588580This time scale ($\alpha$) is weighted by the distance ($d$) from the boundary over \np{nn\_rimwidth} cells ($N$): 
    589581 
     
    592584\] 
    593585 
    594 The same scaling is applied in the Orlanski damping.  
     586The same scaling is applied in the Orlanski damping. 
    595587 
    596588%---------------------------------------------- 
    597589\subsection{Boundary geometry} 
    598 \label{subsec:BDY_geometry} 
     590\label{subsec:LBC_bdy_geometry} 
    599591 
    600592Each open boundary set is defined as a list of points. 
    601593The information is stored in the arrays $nbi$, $nbj$, and $nbr$ in the $idx\_bdy$ structure. 
    602 The $nbi$ and $nbj$ arrays define the local $(i,j)$ indices of each point in the boundary zone and 
    603 the $nbr$ array defines the discrete distance from the boundary with $nbr=1$ meaning that 
    604 the point is next to the edge of the model domain and $nbr>1$ showing that 
    605 the point is increasingly further away from the edge of the model domain. 
     594The $nbi$ and $nbj$ arrays define the local $(i,j)$ indexes of each point in the boundary zone and 
     595the $nbr$ array defines the discrete distance from the boundary: $nbr=1$ means that 
     596the boundary point is next to the edge of the model domain, while $nbr>1$ means that 
     597the boundary point is increasingly further away from the edge of the model domain. 
    606598A set of $nbi$, $nbj$, and $nbr$ arrays is defined for each of the $T$, $U$ and $V$ grids. 
    607 Figure \autoref{fig:LBC_bdy_geom} shows an example of an irregular boundary.  
     599\autoref{fig:LBC_bdy_geom} shows an example of an irregular boundary. 
    608600 
    609601The boundary geometry for each set may be defined in a namelist nambdy\_index or 
    610602by reading in a ``\ifile{coordinates.bdy}'' file. 
    611603The nambdy\_index namelist defines a series of straight-line segments for north, east, south and west boundaries. 
    612 One nambdy\_index namelist bloc is needed for each boundary condition defined by indexes.  
    613 For the northern boundary, \np{nbdysegn} gives the number of segments, 
    614 \np{jpjnob} gives the $j$ index for each segment and \np{jpindt} and 
    615 \np{jpinft} give the start and end $i$ indices for each segment with similar for the other boundaries. 
     604One nambdy\_index namelist block is needed for each boundary condition defined by indexes. 
     605For the northern boundary, \texttt{nbdysegn} gives the number of segments, 
     606\jp{jpjnob} gives the $j$ index for each segment and \jp{jpindt} and 
     607\jp{jpinft} give the start and end $i$ indices for each segment with similar for the other boundaries. 
    616608These segments define a list of $T$ grid points along the outermost row of the boundary ($nbr\,=\, 1$). 
    617 The code deduces the $U$ and $V$ points and also the points for $nbr\,>\, 1$ if \np{nn\_rimwidth}\forcode{ > 1}. 
     609The code deduces the $U$ and $V$ points and also the points for $nbr\,>\, 1$ if \np{nn\_rimwidth}\forcode{>1}. 
    618610 
    619611The boundary geometry may also be defined from a ``\ifile{coordinates.bdy}'' file. 
    620 Figure \autoref{fig:LBC_nc_header} gives an example of the header information from such a file. 
     612\autoref{fig:LBC_nc_header} gives an example of the header information from such a file, based on the description of geometrical setup given above. 
    621613The file should contain the index arrays for each of the $T$, $U$ and $V$ grids. 
    622614The arrays must be in order of increasing $nbr$. 
     
    624616Typically this file will be used to generate external boundary data via interpolation and so 
    625617will also contain the latitudes and longitudes of each point as shown. 
    626 However, this is not necessary to run the model.  
     618However, this is not necessary to run the model. 
    627619 
    628620For some choices of irregular boundary the model domain may contain areas of ocean which 
    629621are not part of the computational domain. 
    630 For example if an open boundary is defined along an isobath, say at the shelf break, 
     622For example, if an open boundary is defined along an isobath, say at the shelf break, 
    631623then the areas of ocean outside of this boundary will need to be masked out. 
    632624This can be done by reading a mask file defined as \np{cn\_mask\_file} in the nam\_bdy namelist. 
     
    635627%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    636628\begin{figure}[!t] 
    637   \begin{center} 
    638     \includegraphics[width=1.0\textwidth]{Fig_LBC_bdy_geom} 
    639     \caption { 
    640       \protect\label{fig:LBC_bdy_geom} 
    641       Example of geometry of unstructured open boundary 
    642     } 
    643   \end{center} 
     629  \centering 
     630  \includegraphics[width=\textwidth]{Fig_LBC_bdy_geom} 
     631  \caption[Geometry of unstructured open boundary]{Example of geometry of unstructured open boundary} 
     632  \label{fig:LBC_bdy_geom} 
    644633\end{figure} 
    645634%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    647636%---------------------------------------------- 
    648637\subsection{Input boundary data files} 
    649 \label{subsec:BDY_data} 
     638\label{subsec:LBC_bdy_data} 
    650639 
    651640The data files contain the data arrays in the order in which the points are defined in the $nbi$ and $nbj$ arrays. 
     
    653642a time dimension; 
    654643$xb$ which is the index of the boundary data point in the horizontal; 
    655 and $yb$ which is a degenerate dimension of 1 to enable the file to be read by the standard NEMO I/O routines. 
    656 The 3D fields also have a depth dimension.  
     644and $yb$ which is a degenerate dimension of 1 to enable the file to be read by the standard \NEMO\ I/O routines. 
     645The 3D fields also have a depth dimension. 
    657646 
    658647From Version 3.4 there are new restrictions on the order in which the boundary points are defined 
     
    665654\item All the data for a particular boundary set must be in the same order. 
    666655  (Prior to 3.4 it was possible to define barotropic data in a different order to 
    667   the data for tracers and baroclinic velocities).  
     656  the data for tracers and baroclinic velocities). 
    668657\end{enumerate} 
    669658 
    670659These restrictions mean that data files used with versions of the 
    671660model prior to Version 3.4 may not work with Version 3.4 onwards. 
    672 A \fortran utility {\it bdy\_reorder} exists in the TOOLS directory which 
     661A \fortran\ utility {\itshape bdy\_reorder} exists in the TOOLS directory which 
    673662will re-order the data in old BDY data files. 
    674663 
    675664%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    676665\begin{figure}[!t] 
    677   \begin{center} 
    678     \includegraphics[width=1.0\textwidth]{Fig_LBC_nc_header} 
    679     \caption { 
    680       \protect\label{fig:LBC_nc_header} 
    681       Example of the header for a \protect\ifile{coordinates.bdy} file 
    682     } 
    683   \end{center} 
     666  \centering 
     667  \includegraphics[width=\textwidth]{Fig_LBC_nc_header} 
     668  \caption[Header for a \protect\ifile{coordinates.bdy} file]{ 
     669    Example of the header for a \protect\ifile{coordinates.bdy} file} 
     670  \label{fig:LBC_nc_header} 
    684671\end{figure} 
    685672%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    687674%---------------------------------------------- 
    688675\subsection{Volume correction} 
    689 \label{subsec:BDY_vol_corr} 
     676\label{subsec:LBC_bdy_vol_corr} 
    690677 
    691678There is an option to force the total volume in the regional model to be constant. 
    692679This is controlled  by the \np{ln\_vol} parameter in the namelist. 
    693 A value of \np{ln\_vol}\forcode{ = .false.} indicates that this option is not used. 
    694 Two options to control the volume are available (\np{nn\_volctl}).  
    695 If \np{nn\_volctl}\forcode{ = 0} then a correction is applied to the normal barotropic velocities around the boundary at 
     680A value of \np{ln\_vol}\forcode{=.false.} indicates that this option is not used. 
     681Two options to control the volume are available (\np{nn\_volctl}). 
     682If \np{nn\_volctl}\forcode{=0} then a correction is applied to the normal barotropic velocities around the boundary at 
    696683each timestep to ensure that the integrated volume flow through the boundary is zero. 
    697 If \np{nn\_volctl}\forcode{ = 1} then the calculation of the volume change on 
     684If \np{nn\_volctl}\forcode{=1} then the calculation of the volume change on 
    698685the timestep includes the change due to the freshwater flux across the surface and 
    699686the correction velocity corrects for this as well. 
     
    704691%---------------------------------------------- 
    705692\subsection{Tidal harmonic forcing} 
    706 \label{subsec:BDY_tides} 
     693\label{subsec:LBC_bdy_tides} 
    707694 
    708695%-----------------------------------------nambdy_tide-------------------------------------------- 
    709696 
    710 \nlst{nambdy_tide}  
     697\begin{listing} 
     698  \nlst{nambdy_tide} 
     699  \caption{\texttt{nambdy\_tide}} 
     700  \label{lst:nambdy_tide} 
     701\end{listing} 
    711702%----------------------------------------------------------------------------------------------- 
    712703 
    713704Tidal forcing at open boundaries requires the activation of surface 
    714 tides (i.e., in \ngn{nam\_tide}, \np{ln\_tide} needs to be set to 
     705tides (i.e., in \nam{\_tide}, \np{ln\_tide} needs to be set to 
    715706\forcode{.true.} and the required constituents need to be activated by 
    716 including their names in the \np{cname} array; see 
     707including their names in the \np{clname} array; see 
    717708\autoref{sec:SBC_tide}). Specific options related to the reading in of 
    718709the complex harmonic amplitudes of elevation (SSH) and barotropic 
    719710velocity (u,v) at open boundaries are defined through the 
    720 \ngn{nambdy\_tide} namelist parameters.\\ 
     711\nam{bdy\_tide} namelist parameters.\\ 
    721712 
    722713The tidal harmonic data at open boundaries can be specified in two 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_LDF.tex

    r10442 r11564  
    99\label{chap:LDF} 
    1010 
    11 \minitoc 
     11\chaptertoc 
    1212 
    1313\newpage 
    1414 
    15 The lateral physics terms in the momentum and tracer equations have been described in \autoref{eq:PE_zdf} and 
     15The lateral physics terms in the momentum and tracer equations have been described in \autoref{eq:MB_zdf} and 
    1616their discrete formulation in \autoref{sec:TRA_ldf} and \autoref{sec:DYN_ldf}). 
    1717In this section we further discuss each lateral physics option. 
     
    2222(3) the space and time variations of the eddy coefficients. 
    2323These three aspects of the lateral diffusion are set through namelist parameters 
    24 (see the \ngn{nam\_traldf} and \ngn{nam\_dynldf} below). 
    25 Note that this chapter describes the standard implementation of iso-neutral tracer mixing, 
    26 and Griffies's implementation, which is used if \np{traldf\_grif}\forcode{ = .true.}, 
    27 is described in Appdx\autoref{apdx:triad} 
    28  
    29 %-----------------------------------nam_traldf - nam_dynldf-------------------------------------------- 
    30  
    31 \nlst{namtra_ldf}  
    32  
    33 \nlst{namdyn_ldf}  
     24(see the \nam{tra\_ldf} and \nam{dyn\_ldf} below). 
     25Note that this chapter describes the standard implementation of iso-neutral tracer mixing. 
     26Griffies's implementation, which is used if \np{ln\_traldf\_triad}\forcode{=.true.}, 
     27is described in \autoref{apdx:TRIADS} 
     28 
     29%-----------------------------------namtra_ldf - namdyn_ldf-------------------------------------------- 
     30 
    3431%-------------------------------------------------------------------------------------------------------------- 
    3532 
     33% ================================================================ 
     34% Lateral Mixing Operator 
     35% ================================================================ 
     36\section[Lateral mixing operators] 
     37{Lateral mixing operators} 
     38\label{sec:LDF_op} 
     39We remind here the different lateral mixing operators that can be used. Further details can be found in \autoref{subsec:TRA_ldf_op} and  \autoref{sec:DYN_ldf}. 
     40 
     41\subsection[No lateral mixing (\forcode{ln_traldf_OFF}, \forcode{ln_dynldf_OFF})] 
     42{No lateral mixing (\protect\np{ln\_traldf\_OFF}, \protect\np{ln\_dynldf\_OFF})} 
     43 
     44It is possible to run without explicit lateral diffusion on tracers (\protect\np{ln\_traldf\_OFF}\forcode{=.true.}) and/or 
     45momentum (\protect\np{ln\_dynldf\_OFF}\forcode{=.true.}). The latter option is even recommended if using the 
     46UBS advection scheme on momentum (\np{ln\_dynadv\_ubs}\forcode{=.true.}, 
     47see \autoref{subsec:DYN_adv_ubs}) and can be useful for testing purposes. 
     48 
     49\subsection[Laplacian mixing (\forcode{ln_traldf_lap}, \forcode{ln_dynldf_lap})] 
     50{Laplacian mixing (\protect\np{ln\_traldf\_lap}, \protect\np{ln\_dynldf\_lap})} 
     51Setting \protect\np{ln\_traldf\_lap}\forcode{=.true.} and/or \protect\np{ln\_dynldf\_lap}\forcode{=.true.} enables 
     52a second order diffusion on tracers and momentum respectively. Note that in \NEMO\ 4, one can not combine 
     53Laplacian and Bilaplacian operators for the same variable. 
     54 
     55\subsection[Bilaplacian mixing (\forcode{ln_traldf_blp}, \forcode{ln_dynldf_blp})] 
     56{Bilaplacian mixing (\protect\np{ln\_traldf\_blp}, \protect\np{ln\_dynldf\_blp})} 
     57Setting \protect\np{ln\_traldf\_blp}\forcode{=.true.} and/or \protect\np{ln\_dynldf\_blp}\forcode{=.true.} enables 
     58a fourth order diffusion on tracers and momentum respectively. It is implemented by calling the above Laplacian operator twice. 
     59We stress again that from \NEMO\ 4, the simultaneous use Laplacian and Bilaplacian operators is not allowed. 
    3660 
    3761% ================================================================ 
    3862% Direction of lateral Mixing 
    3963% ================================================================ 
    40 \section{Direction of lateral mixing (\protect\mdl{ldfslp})} 
     64\section[Direction of lateral mixing (\textit{ldfslp.F90})] 
     65{Direction of lateral mixing (\protect\mdl{ldfslp})} 
    4166\label{sec:LDF_slp} 
    4267 
     
    4469\gmcomment{ 
    4570  we should emphasize here that the implementation is a rather old one. 
    46   Better work can be achieved by using \citet{Griffies_al_JPO98, Griffies_Bk04} iso-neutral scheme. 
     71  Better work can be achieved by using \citet{griffies.gnanadesikan.ea_JPO98, griffies_bk04} iso-neutral scheme. 
    4772} 
    4873 
     
    5479the cell of the quantity to be diffused. 
    5580For a tracer, this leads to the following four slopes: 
    56 $r_{1u}$, $r_{1w}$, $r_{2v}$, $r_{2w}$ (see \autoref{eq:tra_ldf_iso}), 
     81$r_{1u}$, $r_{1w}$, $r_{2v}$, $r_{2w}$ (see \autoref{eq:TRA_ldf_iso}), 
    5782while for momentum the slopes are  $r_{1t}$, $r_{1uw}$, $r_{2f}$, $r_{2uw}$ for $u$ and 
    58 $r_{1f}$, $r_{1vw}$, $r_{2t}$, $r_{2vw}$ for $v$.  
     83$r_{1f}$, $r_{1vw}$, $r_{2t}$, $r_{2vw}$ for $v$. 
    5984 
    6085%gm% add here afigure of the slope in i-direction 
     
    6287\subsection{Slopes for tracer geopotential mixing in the $s$-coordinate} 
    6388 
    64 In $s$-coordinates, geopotential mixing (\ie horizontal mixing) $r_1$ and $r_2$ are the slopes between 
     89In $s$-coordinates, geopotential mixing (\ie\ horizontal mixing) $r_1$ and $r_2$ are the slopes between 
    6590the geopotential and computational surfaces. 
    66 Their discrete formulation is found by locally solving \autoref{eq:tra_ldf_iso} when 
     91Their discrete formulation is found by locally solving \autoref{eq:TRA_ldf_iso} when 
    6792the diffusive fluxes in the three directions are set to zero and $T$ is assumed to be horizontally uniform, 
    68 \ie a linear function of $z_T$, the depth of a $T$-point.  
     93\ie\ a linear function of $z_T$, the depth of a $T$-point. 
    6994%gm { Steven : My version is obviously wrong since I'm left with an arbitrary constant which is the local vertical temperature gradient} 
    7095 
    7196\begin{equation} 
    72   \label{eq:ldfslp_geo} 
     97  \label{eq:LDF_slp_geo} 
    7398  \begin{aligned} 
    7499    r_{1u} &= \frac{e_{3u}}{ \left( e_{1u}\;\overline{\overline{e_{3w}}}^{\,i+1/2,\,k} \right)} 
     
    85110\end{equation} 
    86111 
    87 %gm%  caution I'm not sure the simplification was a good idea!  
    88  
    89 These slopes are computed once in \rou{ldfslp\_init} when \np{ln\_sco}\forcode{ = .true.}rue, 
    90 and either \np{ln\_traldf\_hor}\forcode{ = .true.} or \np{ln\_dynldf\_hor}\forcode{ = .true.}.  
     112%gm%  caution I'm not sure the simplification was a good idea! 
     113 
     114These slopes are computed once in \rou{ldf\_slp\_init} when \np{ln\_sco}\forcode{=.true.}, 
     115and either \np{ln\_traldf\_hor}\forcode{=.true.} or \np{ln\_dynldf\_hor}\forcode{=.true.}. 
    91116 
    92117\subsection{Slopes for tracer iso-neutral mixing} 
     
    96121Their formulation does not depend on the vertical coordinate used. 
    97122Their discrete formulation is found using the fact that the diffusive fluxes of 
    98 locally referenced potential density (\ie $in situ$ density) vanish. 
    99 So, substituting $T$ by $\rho$ in \autoref{eq:tra_ldf_iso} and setting the diffusive fluxes in 
     123locally referenced potential density (\ie\ $in situ$ density) vanish. 
     124So, substituting $T$ by $\rho$ in \autoref{eq:TRA_ldf_iso} and setting the diffusive fluxes in 
    100125the three directions to zero leads to the following definition for the neutral slopes: 
    101126 
    102127\begin{equation} 
    103   \label{eq:ldfslp_iso} 
     128  \label{eq:LDF_slp_iso} 
    104129  \begin{split} 
    105130    r_{1u} &= \frac{e_{3u}}{e_{1u}}\; \frac{\delta_{i+1/2}[\rho]} 
     
    117142 
    118143%gm% rewrite this as the explanation is not very clear !!! 
    119 %In practice, \autoref{eq:ldfslp_iso} is of little help in evaluating the neutral surface slopes. Indeed, for an unsimplified equation of state, the density has a strong dependancy on pressure (here approximated as the depth), therefore applying \autoref{eq:ldfslp_iso} using the $in situ$ density, $\rho$, computed at T-points leads to a flattening of slopes as the depth increases. This is due to the strong increase of the $in situ$ density with depth.  
    120  
    121 %By definition, neutral surfaces are tangent to the local $in situ$ density \citep{McDougall1987}, therefore in \autoref{eq:ldfslp_iso}, all the derivatives have to be evaluated at the same local pressure (which in decibars is approximated by the depth in meters). 
    122  
    123 %In the $z$-coordinate, the derivative of the  \autoref{eq:ldfslp_iso} numerator is evaluated at the same depth \nocite{as what?} ($T$-level, which is the same as the $u$- and $v$-levels), so  the $in situ$ density can be used for its evaluation.  
    124  
    125 As the mixing is performed along neutral surfaces, the gradient of $\rho$ in \autoref{eq:ldfslp_iso} has to 
     144%In practice, \autoref{eq:LDF_slp_iso} is of little help in evaluating the neutral surface slopes. Indeed, for an unsimplified equation of state, the density has a strong dependancy on pressure (here approximated as the depth), therefore applying \autoref{eq:LDF_slp_iso} using the $in situ$ density, $\rho$, computed at T-points leads to a flattening of slopes as the depth increases. This is due to the strong increase of the $in situ$ density with depth. 
     145 
     146%By definition, neutral surfaces are tangent to the local $in situ$ density \citep{mcdougall_JPO87}, therefore in \autoref{eq:LDF_slp_iso}, all the derivatives have to be evaluated at the same local pressure (which in decibars is approximated by the depth in meters). 
     147 
     148%In the $z$-coordinate, the derivative of the  \autoref{eq:LDF_slp_iso} numerator is evaluated at the same depth \nocite{as what?} ($T$-level, which is the same as the $u$- and $v$-levels), so  the $in situ$ density can be used for its evaluation. 
     149 
     150As the mixing is performed along neutral surfaces, the gradient of $\rho$ in \autoref{eq:LDF_slp_iso} has to 
    126151be evaluated at the same local pressure 
    127152(which, in decibars, is approximated by the depth in meters in the model). 
    128 Therefore \autoref{eq:ldfslp_iso} cannot be used as such, 
     153Therefore \autoref{eq:LDF_slp_iso} cannot be used as such, 
    129154but further transformation is needed depending on the vertical coordinate used: 
    130155 
     
    132157 
    133158\item[$z$-coordinate with full step: ] 
    134   in \autoref{eq:ldfslp_iso} the densities appearing in the $i$ and $j$ derivatives  are taken at the same depth, 
     159  in \autoref{eq:LDF_slp_iso} the densities appearing in the $i$ and $j$ derivatives  are taken at the same depth, 
    135160  thus the $in situ$ density can be used. 
    136161  This is not the case for the vertical derivatives: $\delta_{k+1/2}[\rho]$ is replaced by $-\rho N^2/g$, 
    137   where $N^2$ is the local Brunt-Vais\"{a}l\"{a} frequency evaluated following \citet{McDougall1987} 
    138   (see \autoref{subsec:TRA_bn2}).  
     162  where $N^2$ is the local Brunt-Vais\"{a}l\"{a} frequency evaluated following \citet{mcdougall_JPO87} 
     163  (see \autoref{subsec:TRA_bn2}). 
    139164 
    140165\item[$z$-coordinate with partial step: ] 
     
    144169\item[$s$- or hybrid $s$-$z$- coordinate: ] 
    145170  in the current release of \NEMO, iso-neutral mixing is only employed for $s$-coordinates if 
    146   the Griffies scheme is used (\np{traldf\_grif}\forcode{ = .true.}; 
    147   see Appdx \autoref{apdx:triad}). 
     171  the Griffies scheme is used (\np{ln\_traldf\_triad}\forcode{=.true.}; 
     172  see \autoref{apdx:TRIADS}). 
    148173  In other words, iso-neutral mixing will only be accurately represented with a linear equation of state 
    149   (\np{nn\_eos}\forcode{ = 1..2}). 
    150   In the case of a "true" equation of state, the evaluation of $i$ and $j$ derivatives in \autoref{eq:ldfslp_iso} 
     174  (\np{ln\_seos}\forcode{=.true.}). 
     175  In the case of a "true" equation of state, the evaluation of $i$ and $j$ derivatives in \autoref{eq:LDF_slp_iso} 
    151176  will include a pressure dependent part, leading to the wrong evaluation of the neutral slopes. 
    152177 
    153 %gm%  
     178%gm% 
    154179  Note: The solution for $s$-coordinate passes trough the use of different (and better) expression for 
    155180  the constraint on iso-neutral fluxes. 
    156   Following \citet{Griffies_Bk04}, instead of specifying directly that there is a zero neutral diffusive flux of 
     181  Following \citet{griffies_bk04}, instead of specifying directly that there is a zero neutral diffusive flux of 
    157182  locally referenced potential density, we stay in the $T$-$S$ plane and consider the balance between 
    158183  the neutral direction diffusive fluxes of potential temperature and salinity: 
     
    165190 
    166191\[ 
    167   % \label{eq:ldfslp_iso2} 
     192  % \label{eq:LDF_slp_iso2} 
    168193  \begin{split} 
    169194    r_{1u} &= \frac{e_{3u}}{e_{1u}}\; \frac 
     
    197222 
    198223This implementation is a rather old one. 
    199 It is similar to the one proposed by Cox [1987], except for the background horizontal diffusion. 
    200 Indeed, the Cox implementation of isopycnal diffusion in GFDL-type models requires 
     224It is similar to the one proposed by \citet{cox_OM87}, except for the background horizontal diffusion. 
     225Indeed, the \citet{cox_OM87} implementation of isopycnal diffusion in GFDL-type models requires 
    201226a minimum background horizontal diffusion for numerical stability reasons. 
    202227To overcome this problem, several techniques have been proposed in which the numerical schemes of 
    203 the ocean model are modified \citep{Weaver_Eby_JPO97, Griffies_al_JPO98}. 
    204 Griffies's scheme is now available in \NEMO if \np{traldf\_grif\_iso} is set true; see Appdx \autoref{apdx:triad}. 
    205 Here, another strategy is presented \citep{Lazar_PhD97}: 
     228the ocean model are modified \citep{weaver.eby_JPO97, griffies.gnanadesikan.ea_JPO98}. 
     229Griffies's scheme is now available in \NEMO\ if \np{ln\_traldf\_triad}\forcode{ = .true.}; see \autoref{apdx:TRIADS}. 
     230Here, another strategy is presented \citep{lazar_phd97}: 
    206231a local filtering of the iso-neutral slopes (made on 9 grid-points) prevents the development of 
    207232grid point noise generated by the iso-neutral diffusion operator (\autoref{fig:LDF_ZDF1}). 
     
    212237 
    213238Nevertheless, this iso-neutral operator does not ensure that variance cannot increase, 
    214 contrary to the \citet{Griffies_al_JPO98} operator which has that property.  
     239contrary to the \citet{griffies.gnanadesikan.ea_JPO98} operator which has that property. 
    215240 
    216241%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    217242\begin{figure}[!ht] 
    218   \begin{center} 
    219     \includegraphics[width=0.70\textwidth]{Fig_LDF_ZDF1} 
    220     \caption { 
    221       \protect\label{fig:LDF_ZDF1} 
    222       averaging procedure for isopycnal slope computation. 
    223     } 
    224   \end{center} 
     243  \centering 
     244  \includegraphics[width=\textwidth]{Fig_LDF_ZDF1} 
     245  \caption{Averaging procedure for isopycnal slope computation} 
     246  \label{fig:LDF_ZDF1} 
    225247\end{figure} 
    226248%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    227249 
    228 %There are three additional questions about the slope calculation.  
    229 %First the expression for the rotation tensor has been obtain assuming the "small slope" approximation, so a bound has to be imposed on slopes.  
    230 %Second, numerical stability issues also require a bound on slopes.  
     250%There are three additional questions about the slope calculation. 
     251%First the expression for the rotation tensor has been obtain assuming the "small slope" approximation, so a bound has to be imposed on slopes. 
     252%Second, numerical stability issues also require a bound on slopes. 
    231253%Third, the question of boundary condition specified on slopes... 
    232254 
     
    235257 
    236258 
    237 % In addition and also for numerical stability reasons \citep{Cox1987, Griffies_Bk04},  
    238 % the slopes are bounded by $1/100$ everywhere. This limit is decreasing linearly  
    239 % to zero fom $70$ meters depth and the surface (the fact that the eddies "feel" the  
     259% In addition and also for numerical stability reasons \citep{cox_OM87, griffies_bk04}, 
     260% the slopes are bounded by $1/100$ everywhere. This limit is decreasing linearly 
     261% to zero fom $70$ meters depth and the surface (the fact that the eddies "feel" the 
    240262% surface motivates this flattening of isopycnals near the surface). 
    241263 
    242 For numerical stability reasons \citep{Cox1987, Griffies_Bk04}, the slopes must also be bounded by 
    243 $1/100$ everywhere. 
     264For numerical stability reasons \citep{cox_OM87, griffies_bk04}, the slopes must also be bounded by 
     265the namelist scalar \np{rn\_slpmax} (usually $1/100$) everywhere. 
    244266This constraint is applied in a piecewise linear fashion, increasing from zero at the surface to 
    245267$1/100$ at $70$ metres and thereafter decreasing to zero at the bottom of the ocean 
    246268(the fact that the eddies "feel" the surface motivates this flattening of isopycnals near the surface). 
     269\colorbox{yellow}{The way slopes are tapered has be checked. Not sure that this is still what is actually done.} 
    247270 
    248271%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    249272\begin{figure}[!ht] 
    250   \begin{center} 
    251     \includegraphics[width=0.70\textwidth]{Fig_eiv_slp} 
    252     \caption{ 
    253       \protect\label{fig:eiv_slp} 
    254       Vertical profile of the slope used for lateral mixing in the mixed layer: 
    255       \textit{(a)} in the real ocean the slope is the iso-neutral slope in the ocean interior, 
    256       which has to be adjusted at the surface boundary 
    257       \ie it must tend to zero at the surface since there is no mixing across the air-sea interface: 
    258       wall boundary condition). 
    259       Nevertheless, the profile between the surface zero value and the interior iso-neutral one is unknown, 
    260       and especially the value at the base of the mixed layer; 
    261       \textit{(b)} profile of slope using a linear tapering of the slope near the surface and 
    262       imposing a maximum slope of 1/100; 
    263       \textit{(c)} profile of slope actually used in \NEMO: a linear decrease of the slope from 
    264       zero at the surface to its ocean interior value computed just below the mixed layer. 
    265       Note the huge change in the slope at the base of the mixed layer between \textit{(b)} and \textit{(c)}. 
    266     } 
    267   \end{center} 
     273  \centering 
     274  \includegraphics[width=\textwidth]{Fig_eiv_slp} 
     275  \caption[Vertical profile of the slope used for lateral mixing in the mixed layer]{ 
     276    Vertical profile of the slope used for lateral mixing in the mixed layer: 
     277    \textit{(a)} in the real ocean the slope is the iso-neutral slope in the ocean interior, 
     278    which has to be adjusted at the surface boundary 
     279    \ie\ it must tend to zero at the surface since there is no mixing across the air-sea interface: 
     280    wall boundary condition). 
     281    Nevertheless, 
     282    the profile between the surface zero value and the interior iso-neutral one is unknown, 
     283    and especially the value at the base of the mixed layer; 
     284    \textit{(b)} profile of slope using a linear tapering of the slope near the surface and 
     285    imposing a maximum slope of 1/100; 
     286    \textit{(c)} profile of slope actually used in \NEMO: 
     287    a linear decrease of the slope from zero at the surface to 
     288    its ocean interior value computed just below the mixed layer. 
     289    Note the huge change in the slope at the base of the mixed layer between 
     290    \textit{(b)} and \textit{(c)}.} 
     291  \label{fig:LDF_eiv_slp} 
    268292\end{figure} 
    269293%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    275299The iso-neutral diffusion operator on momentum is the same as the one used on tracers but 
    276300applied to each component of the velocity separately 
    277 (see \autoref{eq:dyn_ldf_iso} in section~\autoref{subsec:DYN_ldf_iso}). 
     301(see \autoref{eq:DYN_ldf_iso} in section~\autoref{subsec:DYN_ldf_iso}). 
    278302The slopes between the surface along which the diffusion operator acts and the surface of computation 
    279303($z$- or $s$-surfaces) are defined at $T$-, $f$-, and \textit{uw}- points for the $u$-component, and $T$-, $f$- and 
    280304\textit{vw}- points for the $v$-component. 
    281305They are computed from the slopes used for tracer diffusion, 
    282 \ie \autoref{eq:ldfslp_geo} and \autoref{eq:ldfslp_iso}: 
     306\ie\ \autoref{eq:LDF_slp_geo} and \autoref{eq:LDF_slp_iso}: 
    283307 
    284308\[ 
    285   % \label{eq:ldfslp_dyn} 
     309  % \label{eq:LDF_slp_dyn} 
    286310  \begin{aligned} 
    287311    &r_{1t}\ \ = \overline{r_{1u}}^{\,i}       &&&    r_{1f}\ \ &= \overline{r_{1u}}^{\,i+1/2} \\ 
     
    294318The major issue remaining is in the specification of the boundary conditions. 
    295319The same boundary conditions are chosen as those used for lateral diffusion along model level surfaces, 
    296 \ie using the shear computed along the model levels and with no additional friction at the ocean bottom 
     320\ie\ using the shear computed along the model levels and with no additional friction at the ocean bottom 
    297321(see \autoref{sec:LBC_coast}). 
    298322 
    299323 
    300324% ================================================================ 
    301 % Lateral Mixing Operator 
    302 % ================================================================ 
    303 \section{Lateral mixing operators (\protect\mdl{traldf}, \protect\mdl{traldf}) } 
    304 \label{sec:LDF_op} 
    305  
    306  
    307     
    308 % ================================================================ 
    309325% Lateral Mixing Coefficients 
    310326% ================================================================ 
    311 \section{Lateral mixing coefficient (\protect\mdl{ldftra}, \protect\mdl{ldfdyn}) } 
     327\section[Lateral mixing coefficient (\forcode{nn_aht_ijk_t}, \forcode{nn_ahm_ijk_t})] 
     328{Lateral mixing coefficient (\protect\np{nn\_aht\_ijk\_t}, \protect\np{nn\_ahm\_ijk\_t})} 
    312329\label{sec:LDF_coef} 
    313330 
    314 Introducing a space variation in the lateral eddy mixing coefficients changes the model core memory requirement, 
    315 adding up to four extra three-dimensional arrays for the geopotential or isopycnal second order operator applied to  
    316 momentum. 
    317 Six CPP keys control the space variation of eddy coefficients: three for momentum and three for tracer. 
    318 The three choices allow: 
    319 a space variation in the three space directions (\key{traldf\_c3d},  \key{dynldf\_c3d}), 
    320 in the horizontal plane (\key{traldf\_c2d},  \key{dynldf\_c2d}), 
    321 or in the vertical only (\key{traldf\_c1d},  \key{dynldf\_c1d}). 
    322 The default option is a constant value over the whole ocean on both momentum and tracers.  
    323     
    324 The number of additional arrays that have to be defined and the gridpoint position at which 
    325 they are defined depend on both the space variation chosen and the type of operator used. 
    326 The resulting eddy viscosity and diffusivity coefficients can be a function of more than one variable. 
    327 Changes in the computer code when switching from one option to another have been minimized by 
    328 introducing the eddy coefficients as statement functions 
    329 (include file \textit{ldftra\_substitute.h90} and \textit{ldfdyn\_substitute.h90}). 
    330 The functions are replaced by their actual meaning during the preprocessing step (CPP). 
    331 The specification of the space variation of the coefficient is made in \mdl{ldftra} and \mdl{ldfdyn}, 
    332 or more precisely in include files \textit{traldf\_cNd.h90} and \textit{dynldf\_cNd.h90}, with N=1, 2 or 3. 
    333 The user can modify these include files as he/she wishes. 
    334 The way the mixing coefficient are set in the reference version can be briefly described as follows: 
    335  
    336 \subsubsection{Constant mixing coefficients (default option)} 
    337 When none of the \key{dynldf\_...} and \key{traldf\_...} keys are defined, 
    338 a constant value is used over the whole ocean for momentum and tracers, 
    339 which is specified through the \np{rn\_ahm0} and \np{rn\_aht0} namelist parameters. 
    340  
    341 \subsubsection{Vertically varying mixing coefficients (\protect\key{traldf\_c1d} and \key{dynldf\_c1d})}  
    342 The 1D option is only available when using the $z$-coordinate with full step. 
    343 Indeed in all the other types of vertical coordinate, 
    344 the depth is a 3D function of (\textbf{i},\textbf{j},\textbf{k}) and therefore, 
    345 introducing depth-dependent mixing coefficients will require 3D arrays. 
    346 In the 1D option, a hyperbolic variation of the lateral mixing coefficient is introduced in which 
    347 the surface value is \np{rn\_aht0} (\np{rn\_ahm0}), the bottom value is 1/4 of the surface value, 
    348 and the transition takes place around z=300~m with a width of 300~m 
    349 (\ie both the depth and the width of the inflection point are set to 300~m). 
    350 This profile is hard coded in file \textit{traldf\_c1d.h90}, but can be easily modified by users. 
    351  
    352 \subsubsection{Horizontally varying mixing coefficients (\protect\key{traldf\_c2d} and \protect\key{dynldf\_c2d})} 
    353 By default the horizontal variation of the eddy coefficient depends on the local mesh size and 
     331The specification of the space variation of the coefficient is made in modules \mdl{ldftra} and \mdl{ldfdyn}. 
     332The way the mixing coefficients are set in the reference version can be described as follows: 
     333 
     334\subsection[Mixing coefficients read from file (\forcode{nn_aht_ijk_t=-20, -30}, \forcode{nn_ahm_ijk_t=-20,-30})] 
     335{ Mixing coefficients read from file (\protect\np{nn\_aht\_ijk\_t}\forcode{=-20, -30}, \protect\np{nn\_ahm\_ijk\_t}\forcode{=-20, -30})} 
     336 
     337Mixing coefficients can be read from file if a particular geographical variation is needed. For example, in the ORCA2 global ocean model, 
     338the laplacian viscosity operator uses $A^l$~= 4.10$^4$ m$^2$/s poleward of 20$^{\circ}$ north and south and 
     339decreases linearly to $A^l$~= 2.10$^3$ m$^2$/s at the equator \citep{madec.delecluse.ea_JPO96, delecluse.madec_icol99}. 
     340Similar modified horizontal variations can be found with the Antarctic or Arctic sub-domain options of ORCA2 and ORCA05. 
     341The provided fields can either be 2d (\np{nn\_aht\_ijk\_t}\forcode{=-20}, \np{nn\_ahm\_ijk\_t}\forcode{=-20}) or 3d (\np{nn\_aht\_ijk\_t}\forcode{=-30},  \np{nn\_ahm\_ijk\_t}\forcode{=-30}). They must be given at U, V points for tracers and T, F points for momentum (see \autoref{tab:LDF_files}). 
     342 
     343%-------------------------------------------------TABLE--------------------------------------------------- 
     344\begin{table}[htb] 
     345  \centering 
     346  \begin{tabular}{|l|l|l|l|} 
     347    \hline 
     348    Namelist parameter                       & Input filename                               & dimensions & variable names                      \\  \hline 
     349    \np{nn\_ahm\_ijk\_t}\forcode{=-20}     & \forcode{eddy_viscosity_2D.nc }            &     $(i,j)$         & \forcode{ahmt_2d, ahmf_2d}  \\  \hline 
     350    \np{nn\_aht\_ijk\_t}\forcode{=-20}           & \forcode{eddy_diffusivity_2D.nc }           &     $(i,j)$           & \forcode{ahtu_2d, ahtv_2d}    \\   \hline 
     351    \np{nn\_ahm\_ijk\_t}\forcode{=-30}        & \forcode{eddy_viscosity_3D.nc }            &     $(i,j,k)$          & \forcode{ahmt_3d, ahmf_3d}  \\  \hline 
     352    \np{nn\_aht\_ijk\_t}\forcode{=-30}     & \forcode{eddy_diffusivity_3D.nc }           &     $(i,j,k)$         & \forcode{ahtu_3d, ahtv_3d}    \\   \hline 
     353  \end{tabular} 
     354  \caption{Description of expected input files if mixing coefficients are read from NetCDF files} 
     355  \label{tab:LDF_files} 
     356\end{table} 
     357%-------------------------------------------------------------------------------------------------------------- 
     358 
     359\subsection[Constant mixing coefficients (\forcode{nn_aht_ijk_t=0}, \forcode{nn_ahm_ijk_t=0})] 
     360{ Constant mixing coefficients (\protect\np{nn\_aht\_ijk\_t}\forcode{=0}, \protect\np{nn\_ahm\_ijk\_t}\forcode{=0})} 
     361 
     362If constant, mixing coefficients are set thanks to a velocity and a length scales ($U_{scl}$, $L_{scl}$) such that: 
     363 
     364\begin{equation} 
     365  \label{eq:LDF_constantah} 
     366  A_o^l = \left\{ 
     367    \begin{aligned} 
     368      & \frac{1}{2} U_{scl} L_{scl}            & \text{for laplacian operator } \\ 
     369      & \frac{1}{12} U_{scl} L_{scl}^3                    & \text{for bilaplacian operator } 
     370    \end{aligned} 
     371  \right. 
     372\end{equation} 
     373 
     374 $U_{scl}$ and $L_{scl}$ are given by the namelist parameters \np{rn\_Ud}, \np{rn\_Uv}, \np{rn\_Ld} and \np{rn\_Lv}. 
     375 
     376\subsection[Vertically varying mixing coefficients (\forcode{nn_aht_ijk_t=10}, \forcode{nn_ahm_ijk_t=10})] 
     377{Vertically varying mixing coefficients (\protect\np{nn\_aht\_ijk\_t}\forcode{=10}, \protect\np{nn\_ahm\_ijk\_t}\forcode{=10})} 
     378 
     379In the vertically varying case, a hyperbolic variation of the lateral mixing coefficient is introduced in which 
     380the surface value is given by \autoref{eq:LDF_constantah}, the bottom value is 1/4 of the surface value, 
     381and the transition takes place around z=500~m with a width of 200~m. 
     382This profile is hard coded in module \mdl{ldfc1d\_c2d}, but can be easily modified by users. 
     383 
     384\subsection[Mesh size dependent mixing coefficients (\forcode{nn_aht_ijk_t=20}, \forcode{nn_ahm_ijk_t=20})] 
     385{Mesh size dependent mixing coefficients (\protect\np{nn\_aht\_ijk\_t}\forcode{=20}, \protect\np{nn\_ahm\_ijk\_t}\forcode{=20})} 
     386 
     387In that case, the horizontal variation of the eddy coefficient depends on the local mesh size and 
    354388the type of operator used: 
    355389\begin{equation} 
    356   \label{eq:title} 
     390  \label{eq:LDF_title} 
    357391  A_l = \left\{ 
    358392    \begin{aligned} 
    359       & \frac{\max(e_1,e_2)}{e_{max}} A_o^l           & \text{for laplacian operator } \\ 
    360       & \frac{\max(e_1,e_2)^{3}}{e_{max}^{3}} A_o^l          & \text{for bilaplacian operator } 
     393      & \frac{1}{2} U_{scl}  \max(e_1,e_2)         & \text{for laplacian operator } \\ 
     394      & \frac{1}{12} U_{scl}  \max(e_1,e_2)^{3}             & \text{for bilaplacian operator } 
    361395    \end{aligned} 
    362396  \right. 
    363397\end{equation} 
    364 where $e_{max}$ is the maximum of $e_1$ and $e_2$ taken over the whole masked ocean domain, 
    365 and $A_o^l$ is the \np{rn\_ahm0} (momentum) or \np{rn\_aht0} (tracer) namelist parameter. 
     398where $U_{scl}$ is a user defined velocity scale (\np{rn\_Ud}, \np{rn\_Uv}). 
    366399This variation is intended to reflect the lesser need for subgrid scale eddy mixing where 
    367400the grid size is smaller in the domain. 
    368 It was introduced in the context of the DYNAMO modelling project \citep{Willebrand_al_PO01}. 
    369 Note that such a grid scale dependance of mixing coefficients significantly increase the range of stability of 
    370 model configurations presenting large changes in grid pacing such as global ocean models. 
     401It was introduced in the context of the DYNAMO modelling project \citep{willebrand.barnier.ea_PO01}. 
     402Note that such a grid scale dependance of mixing coefficients significantly increases the range of stability of 
     403model configurations presenting large changes in grid spacing such as global ocean models. 
    371404Indeed, in such a case, a constant mixing coefficient can lead to a blow up of the model due to 
    372 large coefficient compare to the smallest grid size (see \autoref{sec:STP_forward_imp}), 
     405large coefficient compare to the smallest grid size (see \autoref{sec:TD_forward_imp}), 
    373406especially when using a bilaplacian operator. 
    374407 
    375 Other formulations can be introduced by the user for a given configuration. 
    376 For example, in the ORCA2 global ocean model (see Configurations), 
    377 the laplacian viscosity operator uses \np{rn\_ahm0}~= 4.10$^4$ m$^2$/s poleward of 20$^{\circ}$ north and south and 
    378 decreases linearly to \np{rn\_aht0}~= 2.10$^3$ m$^2$/s at the equator \citep{Madec_al_JPO96, Delecluse_Madec_Bk00}. 
    379 This modification can be found in routine \rou{ldf\_dyn\_c2d\_orca} defined in \mdl{ldfdyn\_c2d}. 
    380 Similar modified horizontal variations can be found with the Antarctic or Arctic sub-domain options of 
    381 ORCA2 and ORCA05 (see \&namcfg namelist). 
    382  
    383 \subsubsection{Space varying mixing coefficients (\protect\key{traldf\_c3d} and \key{dynldf\_c3d})} 
    384  
    385 The 3D space variation of the mixing coefficient is simply the combination of the 1D and 2D cases, 
    386 \ie a hyperbolic tangent variation with depth associated with a grid size dependence of 
    387 the magnitude of the coefficient.  
    388  
    389 \subsubsection{Space and time varying mixing coefficients} 
    390  
    391 There is no default specification of space and time varying mixing coefficient.  
    392 The only case available is specific to the ORCA2 and ORCA05 global ocean configurations. 
    393 It provides only a tracer mixing coefficient for eddy induced velocity (ORCA2) or both iso-neutral and 
    394 eddy induced velocity (ORCA05) that depends on the local growth rate of baroclinic instability. 
    395 This specification is actually used when an ORCA key and both \key{traldf\_eiv} and \key{traldf\_c2d} are defined. 
     408\colorbox{yellow}{CASE \np{nn\_aht\_ijk\_t} = 21 to be added} 
     409 
     410\subsection[Mesh size and depth dependent mixing coefficients (\forcode{nn_aht_ijk_t=30}, \forcode{nn_ahm_ijk_t=30})] 
     411{Mesh size and depth dependent mixing coefficients (\protect\np{nn\_aht\_ijk\_t}\forcode{=30}, \protect\np{nn\_ahm\_ijk\_t}\forcode{=30})} 
     412 
     413The 3D space variation of the mixing coefficient is simply the combination of the 1D and 2D cases above, 
     414\ie\ a hyperbolic tangent variation with depth associated with a grid size dependence of 
     415the magnitude of the coefficient. 
     416 
     417\subsection[Velocity dependent mixing coefficients (\forcode{nn_aht_ijk_t=31}, \forcode{nn_ahm_ijk_t=31})] 
     418{Flow dependent mixing coefficients (\protect\np{nn\_aht\_ijk\_t}\forcode{=31}, \protect\np{nn\_ahm\_ijk\_t}\forcode{=31})} 
     419In that case, the eddy coefficient is proportional to the local velocity magnitude so that the Reynolds number $Re =  \lvert U \rvert  e / A_l$ is constant (and here hardcoded to $12$): 
     420\colorbox{yellow}{JC comment: The Reynolds is effectively set to 12 in the code for both operators but shouldn't it be 2 for Laplacian ?} 
     421 
     422\begin{equation} 
     423  \label{eq:LDF_flowah} 
     424  A_l = \left\{ 
     425    \begin{aligned} 
     426      & \frac{1}{12} \lvert U \rvert e          & \text{for laplacian operator } \\ 
     427      & \frac{1}{12} \lvert U \rvert e^3             & \text{for bilaplacian operator } 
     428    \end{aligned} 
     429  \right. 
     430\end{equation} 
     431 
     432\subsection[Deformation rate dependent viscosities (\forcode{nn_ahm_ijk_t=32})] 
     433{Deformation rate dependent viscosities (\protect\np{nn\_ahm\_ijk\_t}\forcode{=32})} 
     434 
     435This option refers to the \citep{smagorinsky_MW63} scheme which is here implemented for momentum only. Smagorinsky chose as a 
     436characteristic time scale $T_{smag}$ the deformation rate and for the lengthscale $L_{smag}$ the maximum wavenumber possible on the horizontal grid, e.g.: 
     437 
     438\begin{equation} 
     439  \label{eq:LDF_smag1} 
     440  \begin{split} 
     441    T_{smag}^{-1} & = \sqrt{\left( \partial_x u - \partial_y v\right)^2 + \left( \partial_y u + \partial_x v\right)^2  } \\ 
     442    L_{smag} & = \frac{1}{\pi}\frac{e_1 e_2}{e_1 + e_2} 
     443  \end{split} 
     444\end{equation} 
     445 
     446Introducing a user defined constant $C$ (given in the namelist as \np{rn\_csmc}), one can deduce the mixing coefficients as follows: 
     447 
     448\begin{equation} 
     449  \label{eq:LDF_smag2} 
     450  A_{smag} = \left\{ 
     451    \begin{aligned} 
     452      & C^2  T_{smag}^{-1}  L_{smag}^2       & \text{for laplacian operator } \\ 
     453      & \frac{C^2}{8} T_{smag}^{-1} L_{smag}^4        & \text{for bilaplacian operator } 
     454    \end{aligned} 
     455  \right. 
     456\end{equation} 
     457 
     458For stability reasons, upper and lower limits are applied on the resulting coefficient (see \autoref{sec:TD_forward_imp}) so that: 
     459\begin{equation} 
     460  \label{eq:LDF_smag3} 
     461    \begin{aligned} 
     462      & C_{min} \frac{1}{2}   \lvert U \rvert  e    < A_{smag} < C_{max} \frac{e^2}{   8\rdt}                 & \text{for laplacian operator } \\ 
     463      & C_{min} \frac{1}{12} \lvert U \rvert  e^3 < A_{smag} < C_{max} \frac{e^4}{64 \rdt}                 & \text{for bilaplacian operator } 
     464    \end{aligned} 
     465\end{equation} 
     466 
     467where $C_{min}$ and $C_{max}$ are adimensional namelist parameters given by \np{rn\_minfac} and \np{rn\_maxfac} respectively. 
     468 
     469\subsection{About space and time varying mixing coefficients} 
    396470 
    397471The following points are relevant when the eddy coefficient varies spatially: 
    398472 
    399473(1) the momentum diffusion operator acting along model level surfaces is written in terms of curl and 
    400 divergent components of the horizontal current (see \autoref{subsec:PE_ldf}). 
     474divergent components of the horizontal current (see \autoref{subsec:MB_ldf}). 
    401475Although the eddy coefficient could be set to different values in these two terms, 
    402 this option is not currently available.  
     476this option is not currently available. 
    403477 
    404478(2) with an horizontally varying viscosity, the quadratic integral constraints on enstrophy and on the square of 
    405479the horizontal divergence for operators acting along model-surfaces are no longer satisfied 
    406 (\autoref{sec:dynldf_properties}). 
    407  
    408 (3) for isopycnal diffusion on momentum or tracers, an additional purely horizontal background diffusion with 
    409 uniform coefficient can be added by setting a non zero value of \np{rn\_ahmb0} or \np{rn\_ahtb0}, 
    410 a background horizontal eddy viscosity or diffusivity coefficient 
    411 (namelist parameters whose default values are $0$). 
    412 However, the technique used to compute the isopycnal slopes is intended to get rid of such a background diffusion, 
    413 since it introduces spurious diapycnal diffusion (see \autoref{sec:LDF_slp}). 
    414  
    415 (4) when an eddy induced advection term is used (\key{traldf\_eiv}), 
    416 $A^{eiv}$, the eddy induced coefficient has to be defined. 
    417 Its space variations are controlled by the same CPP variable as for the eddy diffusivity coefficient 
    418 (\ie \key{traldf\_cNd}).  
    419  
    420 (5) the eddy coefficient associated with a biharmonic operator must be set to a \emph{negative} value. 
    421  
    422 (6) it is possible to use both the laplacian and biharmonic operators concurrently. 
    423  
    424 (7) it is possible to run without explicit lateral diffusion on momentum 
    425 (\np{ln\_dynldf\_lap}\forcode{ = .?.}\np{ln\_dynldf\_bilap}\forcode{ = .false.}). 
    426 This is recommended when using the UBS advection scheme on momentum (\np{ln\_dynadv\_ubs}\forcode{ = .true.}, 
    427 see \autoref{subsec:DYN_adv_ubs}) and can be useful for testing purposes. 
     480(\autoref{sec:INVARIANTS_dynldf_properties}). 
    428481 
    429482% ================================================================ 
    430483% Eddy Induced Mixing 
    431484% ================================================================ 
    432 \section{Eddy induced velocity (\protect\mdl{traadv\_eiv}, \protect\mdl{ldfeiv})} 
     485\section[Eddy induced velocity (\forcode{ln_ldfeiv=.true.})] 
     486{Eddy induced velocity (\protect\np{ln\_ldfeiv}\forcode{=.true.})} 
     487 
    433488\label{sec:LDF_eiv} 
     489 
     490%--------------------------------------------namtra_eiv--------------------------------------------------- 
     491 
     492\begin{listing} 
     493  \nlst{namtra_eiv} 
     494  \caption{\texttt{namtra\_eiv}} 
     495  \label{lst:namtra_eiv} 
     496\end{listing} 
     497 
     498%-------------------------------------------------------------------------------------------------------------- 
     499 
    434500 
    435501%%gm  from Triad appendix  : to be incorporated.... 
     
    453519} 
    454520 
    455 When Gent and McWilliams [1990] diffusion is used (\key{traldf\_eiv} defined), 
     521When  \citet{gent.mcwilliams_JPO90} diffusion is used (\np{ln\_ldfeiv}\forcode{=.true.}), 
    456522an eddy induced tracer advection term is added, 
    457523the formulation of which depends on the slopes of iso-neutral surfaces. 
    458524Contrary to the case of iso-neutral mixing, the slopes used here are referenced to the geopotential surfaces, 
    459 \ie \autoref{eq:ldfslp_geo} is used in $z$-coordinates, 
    460 and the sum \autoref{eq:ldfslp_geo} + \autoref{eq:ldfslp_iso} in $s$-coordinates. 
    461 The eddy induced velocity is given by:  
    462 \begin{equation} 
    463   \label{eq:ldfeiv} 
     525\ie\ \autoref{eq:LDF_slp_geo} is used in $z$-coordinates, 
     526and the sum \autoref{eq:LDF_slp_geo} + \autoref{eq:LDF_slp_iso} in $s$-coordinates. 
     527 
     528If isopycnal mixing is used in the standard way, \ie\ \np{ln\_traldf\_triad}\forcode{=.false.}, the eddy induced velocity is given by: 
     529\begin{equation} 
     530  \label{eq:LDF_eiv} 
    464531  \begin{split} 
    465532    u^* & = \frac{1}{e_{2u}e_{3u}}\; \delta_k \left[e_{2u} \, A_{uw}^{eiv} \; \overline{r_{1w}}^{\,i+1/2} \right]\\ 
     
    468535  \end{split} 
    469536\end{equation} 
    470 where $A^{eiv}$ is the eddy induced velocity coefficient whose value is set through \np{rn\_aeiv}, 
    471 a \textit{nam\_traldf} namelist parameter. 
    472 The three components of the eddy induced velocity are computed and 
    473 add to the eulerian velocity in \mdl{traadv\_eiv}. 
     537where $A^{eiv}$ is the eddy induced velocity coefficient whose value is set through \np{nn\_aei\_ijk\_t} \nam{tra\_eiv} namelist parameter. 
     538The three components of the eddy induced velocity are computed in \rou{ldf\_eiv\_trp} and 
     539added to the eulerian velocity in \rou{tra\_adv} where tracer advection is performed. 
    474540This has been preferred to a separate computation of the advective trends associated with the eiv velocity, 
    475541since it allows us to take advantage of all the advection schemes offered for the tracers 
    476542(see \autoref{sec:TRA_adv}) and not just the $2^{nd}$ order advection scheme as in 
    477 previous releases of OPA \citep{Madec1998}. 
     543previous releases of OPA \citep{madec.delecluse.ea_NPM98}. 
    478544This is particularly useful for passive tracers where \emph{positivity} of the advection scheme is of 
    479 paramount importance.  
     545paramount importance. 
    480546 
    481547At the surface, lateral and bottom boundaries, the eddy induced velocity, 
    482 and thus the advective eddy fluxes of heat and salt, are set to zero.  
     548and thus the advective eddy fluxes of heat and salt, are set to zero. 
     549The value of the eddy induced mixing coefficient and its space variation is controlled in a similar way as for lateral mixing coefficient described in the preceding subsection (\np{nn\_aei\_ijk\_t}, \np{rn\_Ue}, \np{rn\_Le} namelist parameters). 
     550\colorbox{yellow}{CASE \np{nn\_aei\_ijk\_t} = 21 to be added} 
     551 
     552In case of setting \np{ln\_traldf\_triad}\forcode{ = .true.}, a skew form of the eddy induced advective fluxes is used, which is described in \autoref{apdx:TRIADS}. 
     553 
     554% ================================================================ 
     555% Mixed layer eddies 
     556% ================================================================ 
     557\section[Mixed layer eddies (\forcode{ln_mle=.true.})] 
     558{Mixed layer eddies (\protect\np{ln\_mle}\forcode{=.true.})} 
     559 
     560\label{sec:LDF_mle} 
     561 
     562%--------------------------------------------namtra_eiv--------------------------------------------------- 
     563 
     564\begin{listing} 
     565  \nlst{namtra_mle} 
     566  \caption{\texttt{namtra\_mle}} 
     567  \label{lst:namtra_mle} 
     568\end{listing} 
     569 
     570%-------------------------------------------------------------------------------------------------------------- 
     571 
     572If  \np{ln\_mle}\forcode{=.true.} in \nam{tra\_mle} namelist, a parameterization of the mixing due to unresolved mixed layer instabilities is activated (\citet{foxkemper.ferrari_JPO08}). Additional transport is computed in \rou{ldf\_mle\_trp} and added to the eulerian transport in \rou{tra\_adv} as done for eddy induced advection. 
     573 
     574\colorbox{yellow}{TBC} 
    483575 
    484576\biblio 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_OBS.tex

    r10442 r11564  
    88\label{chap:OBS} 
    99 
    10 Authors: D. Lea, M. Martin, K. Mogensen, A. Vidard, A. Weaver, A. Ryan, ...   % do we keep that ? 
    11  
    12 \minitoc 
     10\chaptertoc 
     11 
     12\vfill 
     13\begin{figure}[b] 
     14\subsubsection*{Changes record} 
     15\begin{tabular}{l||l|m{0.65\linewidth}} 
     16    Release   & Author        & Modifications \\ 
     17    {\em 4.0} & {\em D. J. Lea} & {\em \NEMO\ 4.0 updates}  \\ 
     18    {\em 3.6} & {\em M. Martin, A. Ryan} & {\em Add averaging operator, standalone obs oper} \\ 
     19    {\em 3.4} & {\em D. J. Lea, M. Martin, ...} & {\em Initial version}  \\ 
     20    {\em --\texttt{"}--} & {\em ... K. Mogensen, A. Vidard, A. Weaver} & {\em ---\texttt{"}---}  \\ 
     21\end{tabular} 
     22\end{figure} 
    1323 
    1424\newpage 
    1525 
    16 The observation and model comparison code (OBS) reads in observation files 
    17 (profile temperature and salinity, sea surface temperature, sea level anomaly, sea ice concentration, and velocity) and calculates an interpolated model equivalent value at the observation location and nearest model timestep. 
     26The observation and model comparison code, the observation operator (OBS), reads in observation files 
     27(profile temperature and salinity, sea surface temperature, sea level anomaly, sea ice concentration, and velocity) and calculates an interpolated model equivalent value at the observation location and nearest model time step. 
    1828The resulting data are saved in a ``feedback'' file (or files). 
    1929The code was originally developed for use with the NEMOVAR data assimilation code, 
    2030but can be used for validation or verification of the model or with any other data assimilation system. 
    2131 
    22 The OBS code is called from \mdl{nemogcm} for model initialisation and to calculate the model equivalent values for observations on the 0th timestep. 
    23 The code is then called again after each timestep from \mdl{step}. 
    24 The code is only activated if the namelist logical \np{ln\_diaobs} is set to true. 
     32The OBS code is called from \mdl{nemogcm} for model initialisation and to calculate the model equivalent values for observations on the 0th time step. 
     33The code is then called again after each time step from \mdl{step}. 
     34The code is only activated if the \nam{obs} namelist logical \np{ln\_diaobs} is set to true. 
    2535 
    2636For all data types a 2D horizontal interpolator or averager is needed to 
     
    2838For {\em in situ} profiles, a 1D vertical interpolator is needed in addition to 
    2939provide model fields at the observation depths. 
    30 This now works in a generalised vertical coordinate system.  
    31  
    32 Some profile observation types (\eg tropical moored buoys) are made available as daily averaged quantities. 
     40This now works in a generalised vertical coordinate system. 
     41 
     42Some profile observation types (\eg\ tropical moored buoys) are made available as daily averaged quantities. 
    3343The observation operator code can be set-up to calculate the equivalent daily average model temperature fields using 
    3444the \np{nn\_profdavtypes} namelist array. 
     
    3646the observation operator code can calculate equivalent night-time average model SST fields by 
    3747setting the namelist value \np{ln\_sstnight} to true. 
    38 Otherwise the model value from the nearest timestep to the observation time is used. 
    39  
    40 The code is controlled by the namelist \textit{namobs}. 
     48Otherwise (by default) the model value from the nearest time step to the observation time is used. 
     49 
     50The code is controlled by the namelist \nam{obs}. 
    4151See the following sections for more details on setting up the namelist. 
    4252 
    43 \autoref{sec:OBS_example} introduces a test example of the observation operator code including 
     53In \autoref{sec:OBS_example} a test example of the observation operator code is introduced, including 
    4454where to obtain data and how to setup the namelist. 
    45 \autoref{sec:OBS_details} introduces some more technical details of the different observation types used and 
    46 also shows a more complete namelist. 
    47 \autoref{sec:OBS_theory} introduces some of the theoretical aspects of the observation operator including 
     55In \autoref{sec:OBS_details} some more technical details of the different observation types used are introduced, and we 
     56also show a more complete namelist. 
     57In \autoref{sec:OBS_theory} some of the theoretical aspects of the observation operator are described including 
    4858interpolation methods and running on multiple processors. 
    49 \autoref{sec:OBS_ooo} describes the offline observation operator code. 
    50 \autoref{sec:OBS_obsutils} introduces some utilities to help working with the files produced by the OBS code. 
     59In \autoref{sec:OBS_sao} the standalone observation operator code is described. 
     60In \autoref{sec:OBS_obsutils} we describe some utilities to help work with the files produced by the OBS code. 
    5161 
    5262% ================================================================ 
     
    5666\label{sec:OBS_example} 
    5767 
    58 This section describes an example of running the observation operator code using 
    59 profile data which can be freely downloaded. 
    60 It shows how to adapt an existing run and build of NEMO to run the observation operator. 
     68In this section an example of running the observation operator code is described using 
     69profile observation data which can be freely downloaded. 
     70It shows how to adapt an existing run and build of \NEMO\ to run the observation operator. Note also the observation operator and the assimilation increments code are run in the ORCA2\_ICE\_OBS SETTE test. 
    6171 
    6272\begin{enumerate} 
    63 \item Compile NEMO. 
     73\item Compile \NEMO. 
    6474 
    6575\item Download some EN4 data from \href{http://www.metoffice.gov.uk/hadobs}{www.metoffice.gov.uk/hadobs}. 
    6676  Choose observations which are valid for the period of your test run because 
    67   the observation operator compares the model and observations for a matching date and time.  
    68  
    69 \item Compile the OBSTOOLS code using:  
     77  the observation operator compares the model and observations for a matching date and time. 
     78 
     79\item Compile the OBSTOOLS code in the \path{tools} directory using: 
    7080\begin{cmds} 
    71 ./maketools -n OBSTOOLS -m [ARCH]. 
     81./maketools -n OBSTOOLS -m [ARCH] 
    7282\end{cmds} 
    7383 
    74 \item Convert the EN4 data into feedback format:  
     84replacing \texttt{[ARCH]} with the build architecture file for your machine. Note the tools are checked out from a separate location of the repository (under \path{/utils/tools}). 
     85 
     86\item Convert the EN4 data into feedback format: 
    7587\begin{cmds} 
    7688enact2fb.exe profiles_01.nc EN.4.1.1.f.profiles.g10.YYYYMM.nc 
    7789\end{cmds} 
    7890 
    79 \item Include the following in the NEMO namelist to run the observation operator on this data: 
     91\item Include the following in the \NEMO\ namelist to run the observation operator on this data: 
    8092\end{enumerate} 
    8193 
    82 Options are defined through the \ngn{namobs} namelist variables. 
     94Options are defined through the \nam{obs} namelist variables. 
    8395The options \np{ln\_t3d} and \np{ln\_s3d} switch on the temperature and salinity profile observation operator code. 
    8496The filename or array of filenames are specified using the \np{cn\_profbfiles} variable. 
     
    8799This can be expensive, particularly for large numbers of observations, 
    88100setting \np{ln\_grid\_search\_lookup} allows the use of a lookup table which 
    89 is saved into an ``xypos`` file (or files). 
     101is saved into an \np{cn\_gridsearch} file (or files). 
    90102This will need to be generated the first time if it does not exist in the run directory. 
    91103However, once produced it will significantly speed up future grid searches. 
    92104Setting \np{ln\_grid\_global} means that the code distributes the observations evenly between processors. 
    93105Alternatively each processor will work with observations located within the model subdomain 
    94 (see section~\autoref{subsec:OBS_parallel}). 
     106(see \autoref{subsec:OBS_parallel}). 
    95107 
    96108A number of utilities are now provided to plot the feedback files, convert and recombine the files. 
    97 These are explained in more detail in section~\autoref{sec:OBS_obsutils}. 
    98 Utilites to convert other input data formats into the feedback format are also described in 
    99 section~\autoref{sec:OBS_obsutils}. 
     109These are explained in more detail in \autoref{sec:OBS_obsutils}. 
     110Utilities to convert other input data formats into the feedback format are also described in 
     111\autoref{sec:OBS_obsutils}. 
    100112 
    101113\section{Technical details (feedback type observation file headers)} 
    102114\label{sec:OBS_details} 
    103115 
    104 Here we show a more complete example namelist \ngn{namobs} and also show the NetCDF headers of 
     116Here we show a more complete example namelist \nam{obs} and also show the NetCDF headers of 
    105117the observation files that may be used with the observation operator. 
    106118 
    107119%------------------------------------------namobs-------------------------------------------------------- 
    108120 
    109 \nlst{namobs} 
     121\begin{listing} 
     122  \nlst{namobs} 
     123  \caption{\texttt{namobs}} 
     124  \label{lst:namobs} 
     125\end{listing} 
    110126%------------------------------------------------------------------------------------------------------------- 
    111127 
    112 The observation operator code uses the "feedback" observation file format for all data types. 
     128The observation operator code uses the feedback observation file format for all data types. 
    113129All the observation files must be in NetCDF format. 
    114130Some example headers (produced using \mbox{\textit{ncdump~-h}}) for profile data, sea level anomaly and 
    115131sea surface temperature are in the following subsections. 
    116132 
    117 \subsection{Profile feedback} 
     133\subsection{Profile feedback file} 
    118134 
    119135\begin{clines} 
     
    271287\end{clines} 
    272288 
    273 \subsection{Sea level anomaly feedback} 
     289\subsection{Sea level anomaly feedback file} 
    274290 
    275291\begin{clines} 
     
    395411\end{clines} 
    396412 
    397 The mean dynamic topography (MDT) must be provided in a separate file defined on 
     413To use Sea Level Anomaly (SLA) data the mean dynamic topography (MDT) must be provided in a separate file defined on 
    398414the model grid called \ifile{slaReferenceLevel}. 
    399415The MDT is required in order to produce the model equivalent sea level anomaly from the model sea surface height. 
     
    417433\end{clines} 
    418434 
    419 \subsection{Sea surface temperature feedback} 
     435\subsection{Sea surface temperature feedback file} 
    420436 
    421437\begin{clines} 
     
    542558the model equivalent of the observation is calculated by interpolating from 
    543559the four surrounding grid points to the observation location. 
    544 Some satellite observations (\eg microwave satellite SST data, or satellite SSS data) have a footprint which 
     560Some satellite observations (\eg\ microwave satellite SST data, or satellite SSS data) have a footprint which 
    545561is similar in size or larger than the model grid size (particularly when the grid size is small). 
    546562In those cases the model counterpart should be calculated by averaging the model grid points over 
    547563the same size as the footprint. 
    548 NEMO therefore has the capability to specify either an interpolation or an averaging 
    549 (for surface observation types only).  
     564\NEMO\ therefore has the capability to specify either an interpolation or an averaging 
     565(for surface observation types only). 
    550566 
    551567The main namelist option associated with the interpolation/averaging is \np{nn\_2dint}. 
     
    559575\item \np{nn\_2dint}\forcode{ = 4}: Polynomial interpolation 
    560576\item \np{nn\_2dint}\forcode{ = 5}: Radial footprint averaging with diameter specified in the namelist as 
    561   \np{rn\_???\_avglamscl} in degrees or metres (set using \np{ln\_???\_fp\_indegs}) 
     577  \texttt{rn\_[var]\_avglamscl} in degrees or metres (set using \texttt{ln\_[var]\_fp\_indegs}) 
    562578\item \np{nn\_2dint}\forcode{ = 6}: Rectangular footprint averaging with E/W and N/S size specified in 
    563   the namelist as \np{rn\_???\_avglamscl} and \np{rn\_???\_avgphiscl} in degrees or metres 
    564   (set using \np{ln\_???\_fp\_indegs}) 
     579  the namelist as \texttt{rn\_[var]\_avglamscl} and \texttt{rn\_[var]\_avgphiscl} in degrees or metres 
     580  (set using \texttt{ln\_[var]\_fp\_indegs}) 
    565581\end{itemize} 
    566 The ??? in the last two options indicate these options should be specified for each observation type for 
     582Replace \texttt{[var]} in the last two options with the observation type (sla, sst, sss or sic) for 
    567583which the averaging is to be performed (see namelist example above). 
    568584The \np{nn\_2dint} default option can be overridden for surface observation types using 
    569 namelist values \np{nn\_2dint\_???} where ??? is one of sla,sst,sss,sic. 
    570  
    571 Below is some more detail on the various options for interpolation and averaging available in NEMO. 
     585namelist values \texttt{nn\_2dint\_[var]} where \texttt{[var]} is the observation type. 
     586 
     587Below is some more detail on the various options for interpolation and averaging available in \NEMO. 
    572588 
    573589\subsubsection{Horizontal interpolation} 
    574590 
    575 Consider an observation point ${\rm P}$ with with longitude and latitude $({\lambda_{}}_{\rm P}, \phi_{\rm P})$ and 
    576 the four nearest neighbouring model grid points ${\rm A}$, ${\rm B}$, ${\rm C}$ and ${\rm D}$ with 
    577 longitude and latitude ($\lambda_{\rm A}$, $\phi_{\rm A}$),($\lambda_{\rm B}$, $\phi_{\rm B}$) etc. 
    578 All horizontal interpolation methods implemented in NEMO estimate the value of a model variable $x$ at point $P$ as 
    579 a weighted linear combination of the values of the model variables at the grid points ${\rm A}$, ${\rm B}$ etc.: 
     591Consider an observation point ${\mathrm P}$ with longitude and latitude (${\lambda_{}}_{\mathrm P}$, $\phi_{\mathrm P}$) and 
     592the four nearest neighbouring model grid points ${\mathrm A}$, ${\mathrm B}$, ${\mathrm C}$ and ${\mathrm D}$ with 
     593longitude and latitude ($\lambda_{\mathrm A}$, $\phi_{\mathrm A}$),($\lambda_{\mathrm B}$, $\phi_{\mathrm B}$) etc. 
     594All horizontal interpolation methods implemented in \NEMO\ estimate the value of a model variable $x$ at point $P$ as 
     595a weighted linear combination of the values of the model variables at the grid points ${\mathrm A}$, ${\mathrm B}$ etc.: 
     596 
    580597\begin{align*} 
    581   {x_{}}_{\rm P} & \hspace{-2mm} = \hspace{-2mm} & 
    582                                                    \frac{1}{w} \left( {w_{}}_{\rm A} {x_{}}_{\rm A} + 
    583                                                    {w_{}}_{\rm B} {x_{}}_{\rm B} + 
    584                                                    {w_{}}_{\rm C} {x_{}}_{\rm C} + 
    585                                                    {w_{}}_{\rm D} {x_{}}_{\rm D} \right) 
     598  {x_{}}_{\mathrm P} = 
     599\frac{1}{w} \left( {w_{}}_{\mathrm A} {x_{}}_{\mathrm A} + 
     600{w_{}}_{\mathrm B} {x_{}}_{\mathrm B} + 
     601{w_{}}_{\mathrm C} {x_{}}_{\mathrm C} + 
     602{w_{}}_{\mathrm D} {x_{}}_{\mathrm D} \right) 
    586603\end{align*} 
    587 where ${w_{}}_{\rm A}$, ${w_{}}_{\rm B}$ etc. are the respective weights for the model field at 
    588 points ${\rm A}$, ${\rm B}$ etc., and $w = {w_{}}_{\rm A} + {w_{}}_{\rm B} + {w_{}}_{\rm C} + {w_{}}_{\rm D}$. 
     604 
     605where ${w_{}}_{\mathrm A}$, ${w_{}}_{\mathrm B}$ etc. are the respective weights for the model field at 
     606points ${\mathrm A}$, ${\mathrm B}$ etc., and $w = {w_{}}_{\mathrm A} + {w_{}}_{\mathrm B} + {w_{}}_{\mathrm C} + {w_{}}_{\mathrm D}$. 
    589607 
    590608Four different possibilities are available for computing the weights. 
     
    592610\begin{enumerate} 
    593611 
    594 \item[1.] {\bf Great-Circle distance-weighted interpolation.} 
     612\item[1.] {\bfseries Great-Circle distance-weighted interpolation.} 
    595613  The weights are computed as a function of the great-circle distance $s(P, \cdot)$ between $P$ and 
    596614  the model grid points $A$, $B$ etc. 
    597   For example, the weight given to the field ${x_{}}_{\rm A}$ is specified as the product of the distances 
    598   from ${\rm P}$ to the other points: 
    599   \begin{align*} 
    600     {w_{}}_{\rm A} = s({\rm P}, {\rm B}) \, s({\rm P}, {\rm C}) \, s({\rm P}, {\rm D}) 
    601   \end{align*} 
    602   where  
    603   \begin{align*} 
    604     s\left ({\rm P}, {\rm M} \right )  
    605      & \hspace{-2mm} = \hspace{-2mm} &  
    606       \cos^{-1} \! \left\{  
    607                \sin {\phi_{}}_{\rm P} \sin {\phi_{}}_{\rm M} 
    608              + \cos {\phi_{}}_{\rm P} \cos {\phi_{}}_{\rm M}  
    609                \cos ({\lambda_{}}_{\rm M} - {\lambda_{}}_{\rm P})  
     615  For example, the weight given to the field ${x_{}}_{\mathrm A}$ is specified as the product of the distances 
     616  from ${\mathrm P}$ to the other points: 
     617 
     618  \begin{alignat*}{2} 
     619    {w_{}}_{\mathrm A} = s({\mathrm P}, {\mathrm B}) \, s({\mathrm P}, {\mathrm C}) \, s({\mathrm P}, {\mathrm D}) 
     620  \end{alignat*} 
     621 
     622  where 
     623 
     624  \begin{alignat*}{2} 
     625    s\left({\mathrm P}, {\mathrm M} \right) & = & \hspace{0.25em} \cos^{-1} \! \left\{ 
     626               \sin {\phi_{}}_{\mathrm P} \sin {\phi_{}}_{\mathrm M} 
     627             + \cos {\phi_{}}_{\mathrm P} \cos {\phi_{}}_{\mathrm M} 
     628               \cos ({\lambda_{}}_{\mathrm M} - {\lambda_{}}_{\mathrm P}) 
    610629                   \right\} 
    611    \end{align*} 
     630   \end{alignat*} 
     631 
    612632   and $M$ corresponds to $B$, $C$ or $D$. 
    613633   A more stable form of the great-circle distance formula for small distances ($x$ near 1) 
    614    involves the arcsine function (\eg see p.~101 of \citet{Daley_Barker_Bk01}: 
    615    \begin{align*} 
    616      s\left( {\rm P}, {\rm M} \right) & \hspace{-2mm} = \hspace{-2mm} & \sin^{-1} \! \left\{ \sqrt{ 1 - x^2 } \right\} 
    617    \end{align*} 
     634   involves the arcsine function (\eg\ see p.~101 of \citet{daley.barker_bk01}: 
     635 
     636   \begin{alignat*}{2} 
     637     s\left( {\mathrm P}, {\mathrm M} \right) = \sin^{-1} \! \left\{ \sqrt{ 1 - x^2 } \right\} 
     638   \end{alignat*} 
     639 
    618640   where 
    619    \begin{align*} 
    620      x & \hspace{-2mm} = \hspace{-2mm} & 
    621                                          {a_{}}_{\rm M} {a_{}}_{\rm P} + {b_{}}_{\rm M} {b_{}}_{\rm P} + {c_{}}_{\rm M} {c_{}}_{\rm P} 
    622    \end{align*} 
    623    and  
    624    \begin{align*} 
    625       {a_{}}_{\rm M} & \hspace{-2mm} = \hspace{-2mm} & \sin {\phi_{}}_{\rm M}, \\ 
    626       {a_{}}_{\rm P} & \hspace{-2mm} = \hspace{-2mm} & \sin {\phi_{}}_{\rm P}, \\ 
    627       {b_{}}_{\rm M} & \hspace{-2mm} = \hspace{-2mm} & \cos {\phi_{}}_{\rm M} \cos {\phi_{}}_{\rm M}, \\ 
    628       {b_{}}_{\rm P} & \hspace{-2mm} = \hspace{-2mm} & \cos {\phi_{}}_{\rm P} \cos {\phi_{}}_{\rm P}, \\ 
    629       {c_{}}_{\rm M} & \hspace{-2mm} = \hspace{-2mm} & \cos {\phi_{}}_{\rm M} \sin {\phi_{}}_{\rm M}, \\ 
    630       {c_{}}_{\rm P} & \hspace{-2mm} = \hspace{-2mm} & \cos {\phi_{}}_{\rm P} \sin {\phi_{}}_{\rm P}. 
    631   \end{align*} 
    632  
    633 \item[2.] {\bf Great-Circle distance-weighted interpolation with small angle approximation.} 
     641 
     642   \begin{alignat*}{2} 
     643     x = {a_{}}_{\mathrm M} {a_{}}_{\mathrm P} + {b_{}}_{\mathrm M} {b_{}}_{\mathrm P} + {c_{}}_{\mathrm M} {c_{}}_{\mathrm P} 
     644   \end{alignat*} 
     645 
     646   and 
     647 
     648   \begin{alignat*}{3} 
     649   & {a_{}}_{\mathrm M} & = && \quad \sin {\phi_{}}_{\mathrm M}, \\ 
     650   & {a_{}}_{\mathrm P} & = && \quad \sin {\phi_{}}_{\mathrm P}, \\ 
     651   & {b_{}}_{\mathrm M} & = && \quad \cos {\phi_{}}_{\mathrm M} \cos {\phi_{}}_{\mathrm M}, \\ 
     652   & {b_{}}_{\mathrm P} & = && \quad \cos {\phi_{}}_{\mathrm P} \cos {\phi_{}}_{\mathrm P}, \\ 
     653   & {c_{}}_{\mathrm M} & = && \quad \cos {\phi_{}}_{\mathrm M} \sin {\phi_{}}_{\mathrm M}, \\ 
     654   & {c_{}}_{\mathrm P} & = && \quad \cos {\phi_{}}_{\mathrm P} \sin {\phi_{}}_{\mathrm P}. 
     655   \end{alignat*} 
     656 
     657\item[2.] {\bfseries Great-Circle distance-weighted interpolation with small angle approximation.} 
    634658  Similar to the previous interpolation but with the distance $s$ computed as 
    635   \begin{align*} 
    636     s\left( {\rm P}, {\rm M} \right) 
    637     & \hspace{-2mm} = \hspace{-2mm} & 
    638                                       \sqrt{ \left( {\phi_{}}_{\rm M} - {\phi_{}}_{\rm P} \right)^{2} 
    639                                       + \left( {\lambda_{}}_{\rm M} - {\lambda_{}}_{\rm P} \right)^{2} 
    640                                       \cos^{2} {\phi_{}}_{\rm M} } 
    641   \end{align*} 
     659  \begin{alignat*}{2} 
     660    s\left( {\mathrm P}, {\mathrm M} \right) 
     661    & = & \sqrt{ \left( {\phi_{}}_{\mathrm M} - {\phi_{}}_{\mathrm P} \right)^{2} 
     662                                      + \left( {\lambda_{}}_{\mathrm M} - {\lambda_{}}_{\mathrm P} \right)^{2} 
     663                                      \cos^{2} {\phi_{}}_{\mathrm M} } 
     664  \end{alignat*} 
    642665  where $M$ corresponds to $A$, $B$, $C$ or $D$. 
    643666 
    644 \item[3.] {\bf Bilinear interpolation for a regular spaced grid.} 
     667\item[3.] {\bfseries Bilinear interpolation for a regular spaced grid.} 
    645668  The interpolation is split into two 1D interpolations in the longitude and latitude directions, respectively. 
    646669 
    647 \item[4.] {\bf Bilinear remapping interpolation for a general grid.} 
     670\item[4.] {\bfseries Bilinear remapping interpolation for a general grid.} 
    648671  An iterative scheme that involves first mapping a quadrilateral cell into 
    649672  a cell with coordinates (0,0), (1,0), (0,1) and (1,1). 
    650   This method is based on the SCRIP interpolation package \citep{Jones_1998}. 
    651    
     673  This method is based on the \href{https://github.com/SCRIP-Project/SCRIP}{SCRIP interpolation package}. 
     674 
    652675\end{enumerate} 
    653676 
     
    658681\item The standard grid-searching code is used to find the nearest model grid point to the observation location 
    659682  (see next subsection). 
    660 \item The maximum number of grid points is calculated in the local grid domain for which 
    661   the averaging is likely need to cover. 
    662 \item The lats/longs of the grid points surrounding the nearest model grid box are extracted using 
    663   existing mpi routines. 
     683\item The maximum number of grid points required for that observation in each local grid domain is calculated. Some of these points may later turn out to have zero weight depending on the shape of the footprint. 
     684\item The longitudes and latitudes of the grid points surrounding the nearest model grid box are extracted using 
     685  existing MPI routines. 
    664686\item The weights for each grid point associated with each observation are calculated, 
    665687  either for radial or rectangular footprints. 
     
    673695 
    674696Examples of the weights calculated for an observation with rectangular and radial footprints are shown in 
    675 Figs.~\autoref{fig:obsavgrec} and~\autoref{fig:obsavgrad}. 
     697\autoref{fig:OBS_avgrec} and~\autoref{fig:OBS_avgrad}. 
    676698 
    677699%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    678700\begin{figure} 
    679   \begin{center} 
    680     \includegraphics[width=0.90\textwidth]{Fig_OBS_avg_rec} 
    681     \caption{ 
    682       \protect\label{fig:obsavgrec} 
    683       Weights associated with each model grid box (blue lines and numbers) 
    684       for an observation at -170.5\deg{E}, 56.0\deg{N} with a rectangular footprint of 1\deg x 1\deg. 
    685     } 
    686   \end{center} 
     701  \centering 
     702  \includegraphics[width=\textwidth]{Fig_OBS_avg_rec} 
     703  \caption[Observational weights with a rectangular footprint]{ 
     704    Weights associated with each model grid box (blue lines and numbers) 
     705    for an observation at -170.5\deg{E}, 56.0\deg{N} with a rectangular footprint of 1\deg\ x 1\deg.} 
     706  \label{fig:OBS_avgrec} 
     707\end{figure} 
     708% >>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     709 
     710%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     711\begin{figure} 
     712  \centering 
     713  \includegraphics[width=\textwidth]{Fig_OBS_avg_rad} 
     714  \caption[Observational weights with a radial footprint]{ 
     715    Weights associated with each model grid box (blue lines and numbers) 
     716    for an observation at -170.5\deg{E}, 56.0\deg{N} with a radial footprint with diameter 1\deg.} 
     717  \label{fig:OBS_avgrad} 
    687718\end{figure} 
    688719%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    689720 
    690 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    691 \begin{figure} 
    692   \begin{center} 
    693     \includegraphics[width=0.90\textwidth]{Fig_OBS_avg_rad} 
    694     \caption{ 
    695       \protect\label{fig:obsavgrad} 
    696       Weights associated with each model grid box (blue lines and numbers) 
    697       for an observation at -170.5\deg{E}, 56.0\deg{N} with a radial footprint with diameter 1\deg. 
    698     }  
    699   \end{center} 
    700 \end{figure} 
    701 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    702  
    703721 
    704722\subsection{Grid search} 
    705723 
    706 For many grids used by the NEMO model, such as the ORCA family, the horizontal grid coordinates $i$ and $j$ are not simple functions of latitude and longitude. 
     724For many grids used by the \NEMO\ model, such as the ORCA family, the horizontal grid coordinates $i$ and $j$ are not simple functions of latitude and longitude. 
    707725Therefore, it is not always straightforward to determine the grid points surrounding any given observational position. 
    708 Before the interpolation can be performed, a search algorithm is then required to determine the corner points of  
     726Before the interpolation can be performed, a search algorithm is then required to determine the corner points of 
    709727the quadrilateral cell in which the observation is located. 
    710 This is the most difficult and time consuming part of the 2D interpolation procedure.  
     728This is the most difficult and time consuming part of the 2D interpolation procedure. 
    711729A robust test for determining if an observation falls within a given quadrilateral cell is as follows. 
    712 Let ${\rm P}({\lambda_{}}_{\rm P} ,{\phi_{}}_{\rm P} )$ denote the observation point, 
    713 and let ${\rm A}({\lambda_{}}_{\rm A} ,{\phi_{}}_{\rm A} )$, ${\rm B}({\lambda_{}}_{\rm B} ,{\phi_{}}_{\rm B} )$, 
    714 ${\rm C}({\lambda_{}}_{\rm C} ,{\phi_{}}_{\rm C} )$ and ${\rm D}({\lambda_{}}_{\rm D} ,{\phi_{}}_{\rm D} )$ 
    715 denote the bottom left, bottom right, top left and top right corner points of the cell, respectively.  
    716 To determine if P is inside the cell, we verify that the cross-products  
     730Let ${\mathrm P}({\lambda_{}}_{\mathrm P} ,{\phi_{}}_{\mathrm P} )$ denote the observation point, 
     731and let ${\mathrm A}({\lambda_{}}_{\mathrm A} ,{\phi_{}}_{\mathrm A} )$, ${\mathrm B}({\lambda_{}}_{\mathrm B} ,{\phi_{}}_{\mathrm B} )$, 
     732${\mathrm C}({\lambda_{}}_{\mathrm C} ,{\phi_{}}_{\mathrm C} )$ and ${\mathrm D}({\lambda_{}}_{\mathrm D} ,{\phi_{}}_{\mathrm D} )$ 
     733denote the bottom left, bottom right, top left and top right corner points of the cell, respectively. 
     734To determine if P is inside the cell, we verify that the cross-products 
    717735\begin{align*} 
    718736  \begin{array}{lllll} 
    719     {{\bf r}_{}}_{\rm PA} \times {{\bf r}_{}}_{\rm PC} 
    720     & = & [({\lambda_{}}_{\rm A}\; -\; {\lambda_{}}_{\rm P} ) 
    721           ({\phi_{}}_{\rm C}   \; -\; {\phi_{}}_{\rm P} ) 
    722           - ({\lambda_{}}_{\rm C}\; -\; {\lambda_{}}_{\rm P} ) 
    723           ({\phi_{}}_{\rm A}   \; -\; {\phi_{}}_{\rm P} )] \; \widehat{\bf k} \\ 
    724     {{\bf r}_{}}_{\rm PB} \times {{\bf r}_{}}_{\rm PA} 
    725     & = & [({\lambda_{}}_{\rm B}\; -\; {\lambda_{}}_{\rm P} ) 
    726           ({\phi_{}}_{\rm A}   \; -\; {\phi_{}}_{\rm P} ) 
    727           - ({\lambda_{}}_{\rm A}\; -\; {\lambda_{}}_{\rm P} ) 
    728           ({\phi_{}}_{\rm B}   \; -\; {\phi_{}}_{\rm P} )] \; \widehat{\bf k} \\ 
    729     {{\bf r}_{}}_{\rm PC} \times {{\bf r}_{}}_{\rm PD} 
    730     & = & [({\lambda_{}}_{\rm C}\; -\; {\lambda_{}}_{\rm P} ) 
    731           ({\phi_{}}_{\rm D}   \; -\; {\phi_{}}_{\rm P} ) 
    732           - ({\lambda_{}}_{\rm D}\; -\; {\lambda_{}}_{\rm P} ) 
    733           ({\phi_{}}_{\rm C}   \; -\; {\phi_{}}_{\rm P} )] \; \widehat{\bf k} \\ 
    734     {{\bf r}_{}}_{\rm PD} \times {{\bf r}_{}}_{\rm PB} 
    735     & = & [({\lambda_{}}_{\rm D}\; -\; {\lambda_{}}_{\rm P} ) 
    736           ({\phi_{}}_{\rm B}   \; -\; {\phi_{}}_{\rm P} ) 
    737           - ({\lambda_{}}_{\rm B}\; -\; {\lambda_{}}_{\rm P} ) 
    738           ({\phi_{}}_{\rm D}  \;  - \; {\phi_{}}_{\rm P} )] \; \widehat{\bf k} \\ 
     737    {{\mathbf r}_{}}_{\mathrm PA} \times {{\mathbf r}_{}}_{\mathrm PC} 
     738    & = & [({\lambda_{}}_{\mathrm A}\; -\; {\lambda_{}}_{\mathrm P} ) 
     739          ({\phi_{}}_{\mathrm C}   \; -\; {\phi_{}}_{\mathrm P} ) 
     740          - ({\lambda_{}}_{\mathrm C}\; -\; {\lambda_{}}_{\mathrm P} ) 
     741          ({\phi_{}}_{\mathrm A}   \; -\; {\phi_{}}_{\mathrm P} )] \; \widehat{\mathbf k} \\ 
     742    {{\mathbf r}_{}}_{\mathrm PB} \times {{\mathbf r}_{}}_{\mathrm PA} 
     743    & = & [({\lambda_{}}_{\mathrm B}\; -\; {\lambda_{}}_{\mathrm P} ) 
     744          ({\phi_{}}_{\mathrm A}   \; -\; {\phi_{}}_{\mathrm P} ) 
     745          - ({\lambda_{}}_{\mathrm A}\; -\; {\lambda_{}}_{\mathrm P} ) 
     746          ({\phi_{}}_{\mathrm B}   \; -\; {\phi_{}}_{\mathrm P} )] \; \widehat{\mathbf k} \\ 
     747    {{\mathbf r}_{}}_{\mathrm PC} \times {{\mathbf r}_{}}_{\mathrm PD} 
     748    & = & [({\lambda_{}}_{\mathrm C}\; -\; {\lambda_{}}_{\mathrm P} ) 
     749          ({\phi_{}}_{\mathrm D}   \; -\; {\phi_{}}_{\mathrm P} ) 
     750          - ({\lambda_{}}_{\mathrm D}\; -\; {\lambda_{}}_{\mathrm P} ) 
     751          ({\phi_{}}_{\mathrm C}   \; -\; {\phi_{}}_{\mathrm P} )] \; \widehat{\mathbf k} \\ 
     752    {{\mathbf r}_{}}_{\mathrm PD} \times {{\mathbf r}_{}}_{\mathrm PB} 
     753    & = & [({\lambda_{}}_{\mathrm D}\; -\; {\lambda_{}}_{\mathrm P} ) 
     754          ({\phi_{}}_{\mathrm B}   \; -\; {\phi_{}}_{\mathrm P} ) 
     755          - ({\lambda_{}}_{\mathrm B}\; -\; {\lambda_{}}_{\mathrm P} ) 
     756          ({\phi_{}}_{\mathrm D}  \;  - \; {\phi_{}}_{\mathrm P} )] \; \widehat{\mathbf k} \\ 
    739757  \end{array} 
    740   % \label{eq:cross} 
     758  % \label{eq:OBS_cross} 
    741759\end{align*} 
    742 point in the opposite direction to the unit normal $\widehat{\bf k}$ 
    743 (\ie that the coefficients of $\widehat{\bf k}$ are negative), 
    744 where ${{\bf r}_{}}_{\rm PA}$, ${{\bf r}_{}}_{\rm PB}$, etc. correspond to 
     760point in the opposite direction to the unit normal $\widehat{\mathbf k}$ 
     761(\ie\ that the coefficients of $\widehat{\mathbf k}$ are negative), 
     762where ${{\mathbf r}_{}}_{\mathrm PA}$, ${{\mathbf r}_{}}_{\mathrm PB}$, etc. correspond to 
    745763the vectors between points P and A, P and B, etc.. 
    746 The method used is similar to the method used in the SCRIP interpolation package \citep{Jones_1998}. 
     764The method used is similar to the method used in the \href{https://github.com/SCRIP-Project/SCRIP}{SCRIP interpolation package}. 
    747765 
    748766In order to speed up the grid search, there is the possibility to construct a lookup table for a user specified resolution. 
     
    750768be searched for on a regular grid. 
    751769For each observation position, the closest point on the regular grid of this position is computed and 
    752 the $i$ and $j$ ranges of this point searched to determine the precise four points surrounding the observation.  
     770the $i$ and $j$ ranges of this point searched to determine the precise four points surrounding the observation. 
    753771 
    754772\subsection{Parallel aspects of horizontal interpolation} 
     
    757775For horizontal interpolation, there is the basic problem that 
    758776the observations are unevenly distributed on the globe. 
    759 In numerical models, it is common to divide the model grid into subgrids (or domains) where 
     777In \NEMO\ the model grid is divided into subgrids (or domains) where 
    760778each subgrid is executed on a single processing element with explicit message passing for 
    761779exchange of information along the domain boundaries when running on a massively parallel processor (MPP) system. 
    762 This approach is used by \NEMO. 
    763  
    764 For observations there is no natural distribution since the observations are not equally distributed on the globe.  
     780 
     781For observations there is no natural distribution since the observations are not equally distributed on the globe. 
    765782Two options have been made available: 
    7667831) geographical distribution; 
     
    771788%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    772789\begin{figure} 
    773   \begin{center} 
    774     \includegraphics[width=10cm,height=12cm,angle=-90.]{Fig_ASM_obsdist_local} 
    775     \caption{ 
    776       \protect\label{fig:obslocal} 
    777       Example of the distribution of observations with the geographical distribution of observational data. 
    778     } 
    779   \end{center} 
     790  \centering 
     791  \includegraphics[width=\textwidth]{Fig_ASM_obsdist_local} 
     792  \caption[Observations with the geographical distribution]{ 
     793    Example of the distribution of observations with 
     794    the geographical distribution of observational data} 
     795  \label{fig:OBS_local} 
    780796\end{figure} 
    781797%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    783799This is the simplest option in which the observations are distributed according to 
    784800the domain of the grid-point parallelization. 
    785 \autoref{fig:obslocal} shows an example of the distribution of the {\em in situ} data on processors with 
    786 a different colour for each observation on a given processor for a 4 $\times$ 2 decomposition with ORCA2.  
     801\autoref{fig:OBS_local} shows an example of the distribution of the {\em in situ} data on processors with 
     802a different colour for each observation on a given processor for a 4 $\times$ 2 decomposition with ORCA2. 
    787803The grid-point domain decomposition is clearly visible on the plot. 
    788804 
    789805The advantage of this approach is that all information needed for horizontal interpolation is available without 
    790806any MPP communication. 
    791 Of course, this is under the assumption that we are only using a $2 \times 2$ grid-point stencil for 
    792 the interpolation (\eg bilinear interpolation). 
     807This is under the assumption that we are dealing with point observations and only using a $2 \times 2$ grid-point stencil for 
     808the interpolation (\eg\ bilinear interpolation). 
    793809For higher order interpolation schemes this is no longer valid. 
    794810A disadvantage with the above scheme is that the number of observations on each processor can be very different. 
     
    800816%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    801817\begin{figure} 
    802   \begin{center} 
    803     \includegraphics[width=10cm,height=12cm,angle=-90.]{Fig_ASM_obsdist_global} 
    804     \caption{ 
    805       \protect\label{fig:obsglobal} 
    806       Example of the distribution of observations with the round-robin distribution of observational data. 
    807     } 
    808   \end{center} 
     818  \centering 
     819  \includegraphics[width=\textwidth]{Fig_ASM_obsdist_global} 
     820  \caption[Observations with the round-robin distribution]{ 
     821    Example of the distribution of observations with 
     822    the round-robin distribution of observational data.} 
     823  \label{fig:OBS_global} 
    809824\end{figure} 
    810825%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    813828use message passing in order to retrieve the stencil for interpolation. 
    814829The simplest distribution of the observations is to distribute them using a round-robin scheme. 
    815 \autoref{fig:obsglobal} shows the distribution of the {\em in situ} data on processors for 
     830\autoref{fig:OBS_global} shows the distribution of the {\em in situ} data on processors for 
    816831the round-robin distribution of observations with a different colour for each observation on a given processor for 
    817 a 4 $\times$ 2 decomposition with ORCA2 for the same input data as in \autoref{fig:obslocal}. 
     832a 4 $\times$ 2 decomposition with ORCA2 for the same input data as in \autoref{fig:OBS_local}. 
    818833The observations are now clearly randomly distributed on the globe. 
    819834In order to be able to perform horizontal interpolation in this case, 
     
    827842At the bottom boundary, this is done using the land-ocean mask. 
    828843 
     844For profile observation types we do both vertical and horizontal interpolation. \NEMO\ has a generalised vertical coordinate system this means the vertical level depths can vary with location. Therefore, it is necessary first to perform vertical interpolation of the model value to the observation depths for each of the four surrounding grid points. After this the model values, at these points, at the observation depth, are horizontally interpolated to the observation location. 
     845 
    829846\newpage 
    830847 
    831848% ================================================================ 
    832 % Offline observation operator documentation 
     849% Standalone observation operator documentation 
    833850% ================================================================ 
    834851 
    835852%\usepackage{framed} 
    836853 
    837 \section{Offline observation operator} 
    838 \label{sec:OBS_ooo} 
     854\section{Standalone observation operator} 
     855\label{sec:OBS_sao} 
    839856 
    840857\subsection{Concept} 
    841858 
    842 The obs oper maps model variables to observation space. 
    843 It is possible to apply this mapping without running the model. 
    844 The software which performs this functionality is known as the \textbf{offline obs oper}. 
    845 The obs oper is divided into three stages. 
    846 An initialisation phase, an interpolation phase and an output phase. 
    847 The implementation of which is outlined in the previous sections. 
    848 During the interpolation phase the offline obs oper populates the model arrays by 
    849 reading saved model fields from disk. 
    850  
    851 There are two ways of exploiting this offline capacity. 
     859The observation operator maps model variables to observation space. This is normally done while the model is running, i.e. online, it is possible to apply this mapping offline without running the model with the \textbf{standalone observation operator} (SAO). The process is divided into an initialisation phase, an interpolation phase and an output phase. 
     860During the interpolation phase the SAO populates the model arrays by 
     861reading saved model fields from disk. The interpolation and the output phases use the same OBS code described in the preceding sections. 
     862 
     863There are two ways of exploiting the standalone capacity. 
    852864The first is to mimic the behaviour of the online system by supplying model fields at 
    853865regular intervals between the start and the end of the run. 
    854866This approach results in a single model counterpart per observation. 
    855 This kind of usage produces feedback files the same file format as the online obs oper. 
    856 The second is to take advantage of the offline setting in which 
    857 multiple model counterparts can be calculated per observation. 
     867This kind of usage produces feedback files the same file format as the online observation operator. 
     868The second is to take advantage of the ability to run offline by calculating 
     869multiple model counterparts for each observation. 
    858870In this case it is possible to consider all forecasts verifying at the same time. 
    859 By forecast, I mean any method which produces an estimate of physical reality which is not an observed value. 
    860 In the case of class 4 files this means forecasts, analyses, persisted analyses and 
    861 climatological values verifying at the same time. 
    862 Although the class 4 file format doesn't account for multiple ensemble members or 
    863 multiple experiments per observation, it is possible to include these components in the same or multiple files. 
     871By forecast, we mean any method which produces an estimate of physical reality which is not an observed value. 
    864872 
    865873%-------------------------------------------------------------------------------------------------------- 
    866 % offline_oper.exe  
     874% sao.exe 
    867875%-------------------------------------------------------------------------------------------------------- 
    868876 
    869 \subsection{Using the offline observation operator} 
     877\subsection{Using the standalone observation operator} 
    870878 
    871879\subsubsection{Building} 
    872880 
    873 In addition to \emph{OPA\_SRC} the offline obs oper requires the inclusion of the \emph{OOO\_SRC} directory. 
    874 \emph{OOO\_SRC} contains a replacement \mdl{nemo} and \mdl{nemogcm} which 
     881In addition to \emph{OPA\_SRC} the SAO requires the inclusion of the \emph{SAO\_SRC} directory. 
     882\emph{SAO\_SRC} contains a replacement \mdl{nemo} and \mdl{nemogcm} which 
    875883overwrites the resultant \textbf{nemo.exe}. 
    876 This is the approach taken by \emph{SAS\_SRC} and \emph{OFF\_SRC}. 
     884Note this a similar approach to that taken by the standalone surface scheme \emph{SAS\_SRC} and the offline TOP model \emph{OFF\_SRC}. 
    877885 
    878886%-------------------------------------------------------------------------------------------------------- 
    879 % Running  
     887% Running 
    880888%-------------------------------------------------------------------------------------------------------- 
    881889\subsubsection{Running} 
    882890 
    883 The simplest way to use the executable is to edit and append the \textbf{ooo.nml} namelist to 
    884 a full NEMO namelist and then to run the executable as if it were nemo.exe.  
    885  
    886 \subsubsection{Quick script} 
    887  
    888 A useful Python utility to control the namelist options can be found in \textbf{OBSTOOLS/OOO}. 
    889 The functions which locate model fields and observation files can be manually specified. 
    890 The package can be installed by appropriate use of the included setup.py script. 
    891  
    892 Documentation can be auto-generated by Sphinx by running \emph{make html} in the \textbf{doc} directory. 
     891The simplest way to use the executable is to edit and append the \textbf{sao.nml} namelist to 
     892a full \NEMO\ namelist and then to run the executable as if it were nemo.exe. 
    893893 
    894894%-------------------------------------------------------------------------------------------------------- 
    895895% Configuration section 
    896896%-------------------------------------------------------------------------------------------------------- 
    897 \subsection{Configuring the offline observation operator} 
    898 The observation files and settings understood by \textbf{namobs} have been outlined in the online obs oper section. 
    899 In addition there are two further namelists wich control the operation of the offline obs oper. 
    900 \textbf{namooo} which controls the input model fields and \textbf{namcl4} which 
    901 controls the production of class 4 files.  
     897\subsection{Configuring the standalone observation operator} 
     898The observation files and settings understood by \nam{obs} have been outlined in the online observation operator section. 
     899In addition is a further namelist \nam{sao} which used to set the input model fields for the SAO 
    902900 
    903901\subsubsection{Single field} 
    904902 
    905 In offline mode model arrays are populated at appropriate time steps via input files. 
    906 At present, \textbf{tsn} and \textbf{sshn} are populated by the default read routines.  
     903In the SAO the model arrays are populated at appropriate time steps via input files. 
     904At present, \textbf{tsn} and \textbf{sshn} are populated by the default read routines. 
    907905These routines will be expanded upon in future versions to allow the specification of any model variable. 
    908906As such, input files must be global versions of the model domain with 
    909907\textbf{votemper}, \textbf{vosaline} and optionally \textbf{sshn} present. 
    910908 
    911 For each field read there must be an entry in the \textbf{namooo} namelist specifying 
     909For each field read there must be an entry in the \nam{sao} namelist specifying 
    912910the name of the file to read and the index along the \emph{time\_counter}. 
    913911For example, to read the second time counter from a single file the namelist would be. 
     
    915913\begin{forlines} 
    916914!---------------------------------------------------------------------- 
    917 !       namooo Offline obs_oper namelist 
     915!       namsao Standalone obs_oper namelist 
    918916!---------------------------------------------------------------------- 
    919 !   ooo_files    specifies the files containing the model counterpart 
    920 !   nn_ooo_idx   specifies the time_counter index within the model file 
    921 &namooo 
    922    ooo_files = "foo.nc" 
    923    nn_ooo_idx = 2 
     917!   sao_files    specifies the files containing the model counterpart 
     918!   nn_sao_idx   specifies the time_counter index within the model file 
     919&namsao 
     920   sao_files = "foo.nc" 
     921   nn_sao_idx = 2 
    924922/ 
    925923\end{forlines} 
     
    927925\subsubsection{Multiple fields per run} 
    928926 
    929 Model field iteration is controlled via \textbf{nn\_ooo\_freq} which 
     927Model field iteration is controlled via \textbf{nn\_sao\_freq} which 
    930928specifies the number of model steps at which the next field gets read. 
    931929For example, if 12 hourly fields are to be interpolated in a setup where 288 steps equals 24 hours. 
     
    933931\begin{forlines} 
    934932!---------------------------------------------------------------------- 
    935 !       namooo Offline obs_oper namelist 
     933!       namsao Standalone obs_oper namelist 
    936934!---------------------------------------------------------------------- 
    937 !   ooo_files    specifies the files containing the model counterpart 
    938 !   nn_ooo_idx   specifies the time_counter index within the model file 
    939 !   nn_ooo_freq  specifies number of time steps between read operations 
    940 &namooo 
    941    ooo_files = "foo.nc" "foo.nc" 
    942    nn_ooo_idx = 1 2 
    943    nn_ooo_freq = 144 
     935!   sao_files    specifies the files containing the model counterpart 
     936!   nn_sao_idx   specifies the time_counter index within the model file 
     937!   nn_sao_freq  specifies number of time steps between read operations 
     938&namsao 
     939   sao_files = "foo.nc" "foo.nc" 
     940   nn_sao_idx = 1 2 
     941   nn_sao_freq = 144 
    944942/ 
    945943\end{forlines} 
     
    952950%\end{framed} 
    953951 
    954 It is easy to see how a collection of fields taken fron a number of files at different indices can be combined at 
     952A collection of fields taken from a number of files at different indices can be combined at 
    955953a particular frequency in time to generate a pseudo model evolution. 
    956 As long as all that is needed is a single model counterpart at a regular interval then 
    957 namooo is all that needs to be edited. 
    958 However, a far more interesting approach can be taken in which multiple forecasts, analyses, persisted analyses and 
    959 climatologies are considered against the same set of observations. 
    960 For this a slightly more complicated approach is needed. 
    961 It is referred to as \emph{Class 4} since it is the fourth metric defined by the GODAE intercomparison project. 
    962  
    963 %-------------------------------------------------------------------------------------------------------- 
    964 % Class 4 file section 
    965 %-------------------------------------------------------------------------------------------------------- 
    966 \subsubsection{Multiple model counterparts per observation a.k.a Class 4} 
    967  
    968 A generalisation of feedback files to allow multiple model components per observation. 
    969 For a single observation, as well as previous forecasts verifying at the same time 
    970 there are also analyses, persisted analyses and climatologies.  
    971  
    972  
    973 The above namelist performs two basic functions. 
    974 It organises the fields given in \textbf{namooo} into groups so that observations can be matched up multiple times. 
    975 It also controls the metadata and the output variable of the class 4 file when a write routine is called. 
    976  
    977 %\begin{framed} 
    978 \textbf{Note: ln\_cl4} must be set to \forcode{.true.} in \textbf{namobs} to use class 4 outputs. 
    979 %\end{framed} 
    980  
    981 \subsubsection{Class 4 naming convention} 
    982  
    983 The standard class 4 file naming convention is as follows. 
    984  
    985 \noindent 
    986 \linebreak 
    987 \textbf{\$\{prefix\}\_\$\{yyyymmdd\}\_\$\{sys\}\_\$\{cfg\}\_\$\{vn\}\_\$\{kind\}\_\$\{nproc\}}.nc 
    988  
    989 \noindent 
    990 \linebreak 
    991 Much of the namelist is devoted to specifying this convention. 
    992 The following namelist settings control the elements of the output file names. 
    993 Each should be specified as a single string of character data. 
    994  
    995 \begin{description} 
    996 \item[cl4\_prefix] 
    997   Prefix for class 4 files \eg class4 
    998 \item[cl4\_date] 
    999   YYYYMMDD validity date 
    1000 \item[cl4\_sys] 
    1001   The name of the class 4 model system \eg FOAM 
    1002 \item[cl4\_cfg] 
    1003   The name of the class 4 model configuration \eg orca025 
    1004 \item[cl4\_vn] 
    1005   The name of the class 4 model version \eg 12.0 
    1006 \end{description} 
    1007  
    1008 \noindent 
    1009 The kind is specified by the observation type internally to the obs oper. 
    1010 The processor number is specified internally in NEMO.  
    1011  
    1012 \subsubsection{Class 4 file global attributes} 
    1013  
    1014 Global attributes necessary to fulfill the class 4 file definition. 
    1015 These are also useful pieces of information when collaborating with external partners. 
    1016  
    1017 \begin{description} 
    1018 \item[cl4\_contact] 
    1019   Contact email for class 4 files. 
    1020 \item[cl4\_inst] 
    1021   The name of the producers institution. 
    1022 \item[cl4\_cfg] 
    1023   The name of the class 4 model configuration \eg orca025 
    1024 \item[cl4\_vn] 
    1025   The name of the class 4 model version \eg 12.0 
    1026 \end{description} 
    1027  
    1028 \noindent 
    1029 The obs\_type, creation date and validity time are specified internally to the obs oper. 
    1030  
    1031 \subsubsection{Class 4 model counterpart configuration} 
    1032  
    1033 As seen previously it is possible to perform a single sweep of the obs oper and 
    1034 specify a collection of model fields equally spaced along that sweep. 
    1035 In the class 4 case the single sweep is replaced with multiple sweeps and 
    1036 a certain ammount of book keeping is needed to ensure each model counterpart makes its way to 
    1037 the correct piece of memory in the output files. 
    1038  
    1039 \noindent 
    1040 \linebreak 
    1041 In terms of book keeping, the offline obs oper needs to know how many full sweeps need to be performed. 
    1042 This is specified via the \textbf{cl4\_match\_len} variable and 
    1043 is the total number of model counterparts per observation. 
    1044 For example, a 3 forecasts plus 3 persistence fields plus an analysis field would be 7 counterparts per observation. 
    1045  
    1046 \begin{forlines} 
    1047    cl4_match_len = 7 
    1048 \end{forlines} 
    1049  
    1050 Then to correctly allocate a class 4 file the forecast axis must be defined. 
    1051 This is controlled via \textbf{cl4\_fcst\_len}, which in out above example would be 3. 
    1052  
    1053 \begin{forlines} 
    1054    cl4_fcst_len = 3 
    1055 \end{forlines} 
    1056  
    1057 Then for each model field it is necessary to designate what class 4 variable and index along 
    1058 the forecast dimension the model counterpart should be stored in the output file. 
    1059 As well as a value for that lead time in hours, this will be useful when interpreting the data afterwards.  
    1060  
    1061 \begin{forlines} 
    1062    cl4_vars = "forecast" "forecast" "forecast" "persistence" "persistence" 
    1063               "persistence" "best_estimate" 
    1064    cl4_fcst_idx = 1 2 3 1 2 3 1 
    1065    cl4_leadtime = 12 36 60  
    1066 \end{forlines} 
    1067  
    1068 In terms of files and indices of fields inside each file the class 4 approach makes use of 
    1069 the \textbf{namooo} namelist. 
    1070 If our fields are in separate files with a single field per file our example inputs will be specified. 
    1071  
    1072 \begin{forlines} 
    1073    ooo_files = "F.1.nc" "F.2.nc" "F.3.nc" "P.1.nc" "P.2.nc" "P.3.nc" "A.1.nc" 
    1074    nn_ooo_idx = 1 1 1 1 1 1 1 
    1075 \end{forlines} 
    1076  
    1077 When we combine all of the naming conventions, global attributes and i/o instructions the class 4 namelist becomes. 
    1078  
    1079 \begin{forlines} 
    1080 !---------------------------------------------------------------------- 
    1081 !       namooo Offline obs_oper namelist 
    1082 !---------------------------------------------------------------------- 
    1083 !   ooo_files    specifies the files containing the model counterpart 
    1084 !   nn_ooo_idx   specifies the time_counter index within the model file 
    1085 !   nn_ooo_freq  specifies number of time steps between read operations 
    1086 &namooo 
    1087    ooo_files = "F.1.nc" "F.2.nc" "F.3.nc" "P.1.nc" "P.2.nc" "P.3.nc" "A.1.nc" 
    1088    nn_ooo_idx = 1 1 1 1 1 1 1 
    1089 / 
    1090 !---------------------------------------------------------------------- 
    1091 !       namcl4 Offline obs_oper class 4 namelist 
    1092 !---------------------------------------------------------------------- 
    1093 ! 
    1094 !  Naming convention 
    1095 !  ----------------- 
    1096 !  cl4_prefix    specifies the output file prefix 
    1097 !  cl4_date      specifies the output file validity date 
    1098 !  cl4_sys       specifies the model counterpart system 
    1099 !  cl4_cfg       specifies the model counterpart configuration 
    1100 !  cl4_vn        specifies the model counterpart version 
    1101 !  cl4_inst      specifies the model counterpart institute 
    1102 !  cl4_contact   specifies the file producers contact details 
    1103 ! 
    1104 !  I/O specification 
    1105 !  ----------------- 
    1106 !  cl4_vars      specifies the names of the output file netcdf variable 
    1107 !  cl4_fcst_idx  specifies output file forecast index 
    1108 !  cl4_fcst_len  specifies forecast axis length 
    1109 !  cl4_match_len specifies number of unique matches per observation 
    1110 !  cl4_leadtime  specifies the forecast axis lead time  
    1111 ! 
    1112 &namcl4 
    1113    cl4_match_len = 7 
    1114    cl4_fcst_len = 3 
    1115    cl4_fcst_idx = 1 2 3 1 2 3 1 
    1116    cl4_vars = "forecast" "forecast" "forecast" "persistence" "persistence" 
    1117               "persistence" "best_estimate" 
    1118    cl4_leadtime = 12 36 60 
    1119    cl4_prefix = "class4" 
    1120    cl4_date = "20130101" 
    1121    cl4_vn = "12.0" 
    1122    cl4_sys = "FOAM" 
    1123    cl4_cfg = "AMM7" 
    1124    cl4_contact = "example@example.com" 
    1125    cl4_inst = "UK Met Office" 
    1126 / 
    1127 \end{forlines} 
    1128  
    1129 \subsubsection{Climatology interpolation} 
    1130  
    1131 The climatological counterpart is generated at the start of the run by 
    1132 restarting the model from climatology through appropriate use of \textbf{namtsd}. 
    1133 To override the offline observation operator read routine and to take advantage of the restart settings, 
    1134 specify the first entry in \textbf{cl4\_vars} as "climatology". 
    1135 This will then pipe the restart from climatology into the output class 4 file. 
    1136 As in every other class 4 matchup the input file, input index and output index must be specified. 
    1137 These can be replaced with dummy data since they are not used but 
    1138 they must be present to cycle through the matchups correctly.  
    1139  
    1140 \subsection{Advanced usage} 
    1141  
    1142 In certain cases it may be desirable to include both multiple model fields per observation window with 
    1143 multiple match ups per observation. 
    1144 This can be achieved by specifying \textbf{nn\_ooo\_freq} as well as the class 4 settings. 
    1145 Care must be taken in generating the ooo\_files list such that the files are arranged into 
    1146 consecutive blocks of single match ups. 
    1147 For example, 2 forecast fields of 12 hourly data would result in 4 separate read operations but 
    1148 only 2 write operations, 1 per forecast. 
    1149  
    1150 \begin{forlines} 
    1151    ooo_files = "F1.nc" "F1.nc" "F2.nc" "F2.nc" 
    1152 ... 
    1153    cl4_fcst_idx = 1 2 
    1154 \end{forlines} 
    1155  
    1156 The above notation reveals the internal split between match up iterators and file iterators. 
    1157 This technique has not been used before so experimentation is needed before results can be trusted. 
     954If all that is needed is a single model counterpart at a regular interval then 
     955the standard SAO is all that is required. 
     956However, just to note, it is possible to extend this approach by comparing multiple forecasts, analyses, persisted analyses and 
     957climatologies with the same set of observations. 
     958This approach is referred to as \emph{Class 4} since it is the fourth metric defined by the GODAE intercomparison project. This requires multiple runs of the SAO and running an additional utility (not currently in the \NEMO\ repository) to combine the feedback files into one class 4 file. 
    1158959 
    1159960\newpage 
     
    1162963\label{sec:OBS_obsutils} 
    1163964 
    1164 Some tools for viewing and processing of observation and feedback files are provided in 
    1165 the NEMO repository for convenience. 
    1166 These include OBSTOOLS which are a collection of \fortran programs which are helpful to deal with feedback files. 
     965For convenience some tools for viewing and processing of observation and feedback files are provided in 
     966the \NEMO\ repository. 
     967These tools include OBSTOOLS which are a collection of \fortran\ programs which are helpful to deal with feedback files. 
    1167968They do such tasks as observation file conversion, printing of file contents, 
    1168969some basic statistical analysis of feedback files. 
    1169 The other tool is an IDL program called dataplot which uses a graphical interface to 
     970The other main tool is an IDL program called dataplot which uses a graphical interface to 
    1170971visualise observations and feedback files. 
    1171972OBSTOOLS and dataplot are described in more detail below. 
     
    1173974\subsection{Obstools} 
    1174975 
    1175 A series of \fortran utilities is provided with NEMO called OBSTOOLS. 
    1176 This are helpful in handling observation files and the feedback file output from the NEMO observation operator. 
    1177 The utilities are as follows 
    1178  
    1179 \subsubsection{c4comb} 
    1180  
    1181 The program c4comb combines multiple class 4 files produced by individual processors in 
    1182 an MPI run of NEMO offline obs\_oper into a single class 4 file. 
    1183 The program is called in the following way: 
    1184  
    1185  
    1186 \footnotesize 
    1187 \begin{cmds} 
    1188 c4comb.exe outputfile inputfile1 inputfile2 ... 
    1189 \end{cmds} 
     976A series of \fortran\ utilities is provided with \NEMO\ called OBSTOOLS. 
     977This are helpful in handling observation files and the feedback file output from the observation operator. A brief description of some of the utilities follows 
    1190978 
    1191979\subsubsection{corio2fb} 
    1192980 
    1193981The program corio2fb converts profile observation files from the Coriolis format to the standard feedback format. 
    1194 The program is called in the following way: 
    1195  
    1196 \footnotesize 
     982It is called in the following way: 
     983 
    1197984\begin{cmds} 
    1198985corio2fb.exe outputfile inputfile1 inputfile2 ... 
     
    1202989 
    1203990The program enact2fb converts profile observation files from the ENACT format to the standard feedback format. 
    1204 The program is called in the following way: 
    1205  
    1206 \footnotesize 
     991It is called in the following way: 
     992 
    1207993\begin{cmds} 
    1208994enact2fb.exe outputfile inputfile1 inputfile2 ... 
     
    1212998 
    1213999The program fbcomb combines multiple feedback files produced by individual processors in 
    1214 an MPI run of NEMO into a single feedback file. 
    1215 The program is called in the following way: 
    1216  
    1217 \footnotesize 
     1000an MPI run of \NEMO\ into a single feedback file. 
     1001It is called in the following way: 
     1002 
    12181003\begin{cmds} 
    12191004fbcomb.exe outputfile inputfile1 inputfile2 ... 
     
    12231008 
    12241009The program fbmatchup will match observations from two feedback files. 
    1225 The program is called in the following way: 
    1226  
    1227 \footnotesize 
     1010It is called in the following way: 
     1011 
    12281012\begin{cmds} 
    12291013fbmatchup.exe outputfile inputfile1 varname1 inputfile2 varname2 ... 
     
    12341018The program fbprint will print the contents of a feedback file or files to standard output. 
    12351019Selected information can be output using optional arguments. 
    1236 The program is called in the following way: 
    1237  
    1238 \footnotesize 
     1020It is called in the following way: 
     1021 
    12391022\begin{cmds} 
    12401023fbprint.exe [options] inputfile 
     
    12461029     -B            Select observations based on QC flags 
    12471030     -u            unsorted 
    1248      -s ID         select station ID   
     1031     -s ID         select station ID 
    12491032     -t TYPE       select observation type 
    1250      -v NUM1-NUM2  select variable range to print by number  
     1033     -v NUM1-NUM2  select variable range to print by number 
    12511034                      (default all) 
    1252      -a NUM1-NUM2  select additional variable range to print by number  
     1035     -a NUM1-NUM2  select additional variable range to print by number 
    12531036                      (default all) 
    1254      -e NUM1-NUM2  select extra variable range to print by number  
     1037     -e NUM1-NUM2  select extra variable range to print by number 
    12551038                      (default all) 
    12561039     -d            output date range 
     
    12621045 
    12631046The program fbsel will select or subsample observations. 
    1264 The program is called in the following way: 
    1265  
    1266 \footnotesize 
     1047It is called in the following way: 
     1048 
    12671049\begin{cmds} 
    12681050fbsel.exe <input filename> <output filename> 
     
    12721054 
    12731055The program fbstat will output summary statistics in different global areas into a number of files. 
    1274 The program is called in the following way: 
    1275  
    1276 \footnotesize 
     1056It is called in the following way: 
     1057 
    12771058\begin{cmds} 
    12781059fbstat.exe [-nmlev] <filenames> 
     
    12831064The program fbthin will thin the data to 1 degree resolution. 
    12841065The code could easily be modified to thin to a different resolution. 
    1285 The program is called in the following way: 
    1286  
    1287 \footnotesize 
     1066It is called in the following way: 
     1067 
    12881068\begin{cmds} 
    12891069fbthin.exe inputfile outputfile 
     
    12931073 
    12941074The program sla2fb will convert an AVISO SLA format file to feedback format. 
    1295 The program is called in the following way: 
    1296  
    1297 \footnotesize 
     1075It is called in the following way: 
     1076 
    12981077\begin{cmds} 
    12991078sla2fb.exe [-s type] outputfile inputfile1 inputfile2 ... 
     
    13061085 
    13071086The program vel2fb will convert TAO/PIRATA/RAMA currents files to feedback format. 
    1308 The program is called in the following way: 
    1309  
    1310 \footnotesize 
     1087It is called in the following way: 
     1088 
    13111089\begin{cmds} 
    13121090vel2fb.exe outputfile inputfile1 inputfile2 ... 
     
    13201098 
    13211099An IDL program called dataplot is included which uses a graphical interface to 
    1322 visualise observations and feedback files. 
     1100visualise observations and feedback files. Note a similar package has recently developed in python (also called dataplot) which does some of the same things that the IDL dataplot does. Please contact the authors of the this chapter if you are interested in this. 
     1101 
    13231102It is possible to zoom in, plot individual profiles and calculate some basic statistics. 
    13241103To plot some data run IDL and then: 
    1325 \footnotesize 
     1104 
    13261105\begin{minted}{idl} 
    13271106IDL> dataplot, "filename" 
     
    13311110for example multiple feedback files from different processors or from different days, 
    13321111the easiest method is to use the spawn command to generate a list of files which can then be passed to dataplot. 
    1333 \footnotesize 
     1112 
    13341113\begin{minted}{idl} 
    13351114IDL> spawn, 'ls profb*.nc', files 
     
    13371116\end{minted} 
    13381117 
    1339 \autoref{fig:obsdataplotmain} shows the main window which is launched when dataplot starts. 
     1118\autoref{fig:OBS_dataplotmain} shows the main window which is launched when dataplot starts. 
    13401119This is split into three parts. 
    13411120At the top there is a menu bar which contains a variety of drop down menus. 
     
    13501129The plotting colour range can be changed by clicking on the colour bar. 
    13511130The title of the plot gives some basic information about the date range and depth range shown, 
    1352 the extreme values, and the mean and rms values. 
     1131the extreme values, and the mean and RMS values. 
    13531132It is possible to zoom in using a drag-box. 
    13541133You may also zoom in or out using the mouse wheel. 
     
    13621141observation minus background value. 
    13631142The next group of radio buttons selects the map projection. 
    1364 This can either be regular latitude longitude grid, or north or south polar stereographic. 
     1143This can either be regular longitude latitude grid, or north or south polar stereographic. 
    13651144The next group of radio buttons will plot bad observations, switch to salinity and 
    13661145plot density for profile observations. 
     
    13691148%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    13701149\begin{figure} 
    1371   \begin{center} 
    1372     % \includegraphics[width=10cm,height=12cm,angle=-90.]{Fig_OBS_dataplot_main} 
    1373     \includegraphics[width=9cm,angle=-90.]{Fig_OBS_dataplot_main} 
    1374     \caption{ 
    1375       \protect\label{fig:obsdataplotmain} 
    1376       Main window of dataplot. 
    1377     } 
    1378   \end{center} 
     1150  \centering 
     1151  \includegraphics[width=\textwidth]{Fig_OBS_dataplot_main} 
     1152  \caption{Main window of dataplot} 
     1153  \label{fig:OBS_dataplotmain} 
    13791154\end{figure} 
    13801155%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    13811156 
    13821157If a profile point is clicked with the mouse button a plot of the observation and background values as 
    1383 a function of depth (\autoref{fig:obsdataplotprofile}). 
     1158a function of depth (\autoref{fig:OBS_dataplotprofile}). 
    13841159 
    13851160%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    13861161\begin{figure} 
    1387   \begin{center} 
    1388     % \includegraphics[width=10cm,height=12cm,angle=-90.]{Fig_OBS_dataplot_prof} 
    1389     \includegraphics[width=7cm,angle=-90.]{Fig_OBS_dataplot_prof} 
    1390     \caption{ 
    1391       \protect\label{fig:obsdataplotprofile} 
    1392       Profile plot from dataplot produced by right clicking on a point in the main window. 
    1393     } 
    1394   \end{center} 
     1162  \centering 
     1163  \includegraphics[width=\textwidth]{Fig_OBS_dataplot_prof} 
     1164  \caption[Profile plot from dataplot]{ 
     1165    Profile plot from dataplot produced by right clicking on a point in the main window} 
     1166  \label{fig:OBS_dataplotprofile} 
    13951167\end{figure} 
    13961168%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_SBC.tex

    r10614 r11564  
    22 
    33\begin{document} 
    4 % ================================================================ 
    5 % Chapter —— Surface Boundary Condition (SBC, ISF, ICB)  
    6 % ================================================================ 
    7 \chapter{Surface Boundary Condition (SBC, ISF, ICB) } 
     4 
     5% ================================================================ 
     6% Chapter —— Surface Boundary Condition (SBC, SAS, ISF, ICB) 
     7% ================================================================ 
     8\chapter{Surface Boundary Condition (SBC, SAS, ISF, ICB)} 
    89\label{chap:SBC} 
    9 \minitoc 
     10\chaptertoc 
    1011 
    1112\newpage 
     
    1314%---------------------------------------namsbc-------------------------------------------------- 
    1415 
    15 \nlst{namsbc} 
     16\begin{listing} 
     17  \nlst{namsbc} 
     18  \caption{\texttt{namsbc}} 
     19  \label{lst:namsbc} 
     20\end{listing} 
    1621%-------------------------------------------------------------------------------------------------------------- 
    1722 
    18 The ocean needs six fields as surface boundary condition: 
     23The ocean needs seven fields as surface boundary condition: 
     24 
    1925\begin{itemize} 
    2026\item 
     
    2632\item 
    2733  the surface salt flux associated with freezing/melting of seawater $\left( {\textit{sfx}} \right)$ 
     34\item 
     35  the atmospheric pressure at the ocean surface $\left( p_a \right)$ 
    2836\end{itemize} 
    29 plus an optional field: 
     37 
     38Four different ways are available to provide the seven fields to the ocean. They are controlled by 
     39namelist \nam{sbc} variables: 
     40 
    3041\begin{itemize} 
    31    \item the atmospheric pressure at the ocean surface $\left( p_a \right)$ 
     42\item 
     43  a bulk formulation (\np{ln\_blk}\forcode{=.true.} with four possible bulk algorithms), 
     44\item 
     45  a flux formulation (\np{ln\_flx}\forcode{=.true.}), 
     46\item 
     47  a coupled or mixed forced/coupled formulation (exchanges with a atmospheric model via the OASIS coupler), 
     48(\np{ln\_cpl} or \np{ln\_mixcpl}\forcode{=.true.}), 
     49\item 
     50  a user defined formulation (\np{ln\_usr}\forcode{=.true.}). 
    3251\end{itemize} 
    3352 
    34 Four different ways to provide the first six fields to the ocean are available which are controlled by 
    35 namelist \ngn{namsbc} variables: 
    36 an analytical formulation (\np{ln\_ana}\forcode{ = .true.}), 
    37 a flux formulation (\np{ln\_flx}\forcode{ = .true.}), 
    38 a bulk formulae formulation (CORE (\np{ln\_blk\_core}\forcode{ = .true.}), 
    39 CLIO (\np{ln\_blk\_clio}\forcode{ = .true.}) bulk formulae) and 
    40 a coupled or mixed forced/coupled formulation (exchanges with a atmospheric model via the OASIS coupler) 
    41 (\np{ln\_cpl} or \np{ln\_mixcpl}\forcode{ = .true.}).  
    42 When used (\ie \np{ln\_apr\_dyn}\forcode{ = .true.}), 
    43 the atmospheric pressure forces both ocean and ice dynamics. 
    44  
    4553The frequency at which the forcing fields have to be updated is given by the \np{nn\_fsbc} namelist parameter. 
    46 When the fields are supplied from data files (flux and bulk formulations), 
    47 the input fields need not be supplied on the model grid. 
    48 Instead a file of coordinates and weights can be supplied which maps the data from the supplied grid to 
     54 
     55When the fields are supplied from data files (bulk, flux and mixed formulations), 
     56the input fields do not need to be supplied on the model grid. 
     57Instead, a file of coordinates and weights can be supplied to map the data from the input fields grid to 
    4958the model points (so called "Interpolation on the Fly", see \autoref{subsec:SBC_iof}). 
    50 If the Interpolation on the Fly option is used, input data belonging to land points (in the native grid), 
    51 can be masked to avoid spurious results in proximity of the coasts as 
     59If the "Interpolation on the Fly" option is used, input data belonging to land points (in the native grid) 
     60should be masked or filled to avoid spurious results in proximity of the coasts, as 
    5261large sea-land gradients characterize most of the atmospheric variables. 
    5362 
    5463In addition, the resulting fields can be further modified using several namelist options. 
    55 These options control  
     64These options control: 
     65 
    5666\begin{itemize} 
    5767\item 
    5868  the rotation of vector components supplied relative to an east-north coordinate system onto 
    59   the local grid directions in the model; 
    60 \item 
    61   the addition of a surface restoring term to observed SST and/or SSS (\np{ln\_ssr}\forcode{ = .true.}); 
    62 \item 
    63   the modification of fluxes below ice-covered areas (using observed ice-cover or a sea-ice model) 
    64   (\np{nn\_ice}\forcode{ = 0..3}); 
    65 \item 
    66   the addition of river runoffs as surface freshwater fluxes or lateral inflow (\np{ln\_rnf}\forcode{ = .true.}); 
    67 \item 
    68   the addition of isf melting as lateral inflow (parameterisation) or 
    69   as fluxes applied at the land-ice ocean interface (\np{ln\_isf}) ;  
     69  the local grid directions in the model, 
     70\item 
     71  the use of a land/sea mask for input fields (\np{nn\_lsm}\forcode{=.true.}), 
     72\item 
     73  the addition of a surface restoring term to observed SST and/or SSS (\np{ln\_ssr}\forcode{=.true.}), 
     74\item 
     75  the modification of fluxes below ice-covered areas (using climatological ice-cover or a sea-ice model) 
     76  (\np{nn\_ice}\forcode{=0..3}), 
     77\item 
     78  the addition of river runoffs as surface freshwater fluxes or lateral inflow (\np{ln\_rnf}\forcode{=.true.}), 
     79\item 
     80  the addition of ice-shelf melting as lateral inflow (parameterisation) or 
     81  as fluxes applied at the land-ice ocean interface (\np{ln\_isf}\forcode{=.true.}), 
    7082\item 
    7183  the addition of a freshwater flux adjustment in order to avoid a mean sea-level drift 
    72   (\np{nn\_fwb}\forcode{ = 0..2}); 
    73 \item 
    74   the transformation of the solar radiation (if provided as daily mean) into a diurnal cycle 
    75   (\np{ln\_dm2dc}\forcode{ = .true.}); 
    76 \item 
    77   a neutral drag coefficient can be read from an external wave model (\np{ln\_cdgw}\forcode{ = .true.}); 
    78 \item 
    79   the Stokes drift rom an external wave model can be accounted (\np{ln\_sdw}\forcode{ = .true.});  
    80 \item 
    81   the Stokes-Coriolis term can be included (\np{ln\_stcor}\forcode{ = .true.}); 
    82 \item 
    83   the surface stress felt by the ocean can be modified by surface waves (\np{ln\_tauwoc}\forcode{ = .true.}). 
     84  (\np{nn\_fwb}\forcode{=0..2}), 
     85\item 
     86  the transformation of the solar radiation (if provided as daily mean) into an analytical diurnal cycle 
     87  (\np{ln\_dm2dc}\forcode{=.true.}), 
     88\item 
     89  the activation of wave effects from an external wave model  (\np{ln\_wave}\forcode{=.true.}), 
     90\item 
     91  a neutral drag coefficient is read from an external wave model (\np{ln\_cdgw}\forcode{=.true.}), 
     92\item 
     93  the Stokes drift from an external wave model is accounted for (\np{ln\_sdw}\forcode{=.true.}), 
     94\item 
     95  the choice of the Stokes drift profile parameterization (\np{nn\_sdrift}\forcode{=0..2}), 
     96\item 
     97  the surface stress given to the ocean is modified by surface waves (\np{ln\_tauwoc}\forcode{=.true.}), 
     98\item 
     99  the surface stress given to the ocean is read from an external wave model (\np{ln\_tauw}\forcode{=.true.}), 
     100\item 
     101  the Stokes-Coriolis term is included (\np{ln\_stcor}\forcode{=.true.}), 
     102\item 
     103  the light penetration in the ocean (\np{ln\_traqsr}\forcode{=.true.} with namelist \nam{tra\_qsr}), 
     104\item 
     105  the atmospheric surface pressure gradient effect on ocean and ice dynamics (\np{ln\_apr\_dyn}\forcode{=.true.} with namelist \nam{sbc\_apr}), 
     106\item 
     107  the effect of sea-ice pressure on the ocean (\np{ln\_ice\_embd}\forcode{=.true.}). 
    84108\end{itemize} 
    85109 
    86 In this chapter, we first discuss where the surface boundary condition appears in the model equations. 
    87 Then we present the five ways of providing the surface boundary condition,  
    88 followed by the description of the atmospheric pressure and the river runoff.  
    89 Next the scheme for interpolation on the fly is described. 
     110In this chapter, we first discuss where the surface boundary conditions appear in the model equations. 
     111Then we present the three ways of providing the surface boundary conditions, 
     112followed by the description of the atmospheric pressure and the river runoff. 
     113Next, the scheme for interpolation on the fly is described. 
    90114Finally, the different options that further modify the fluxes applied to the ocean are discussed. 
    91 One of these is modification by icebergs (see \autoref{sec:ICB_icebergs}), 
     115One of these is modification by icebergs (see \autoref{sec:SBC_ICB_icebergs}), 
    92116which act as drifting sources of fresh water. 
    93 Another example of modification is that due to the ice shelf melting/freezing (see \autoref{sec:SBC_isf}),  
     117Another example of modification is that due to the ice shelf melting/freezing (see \autoref{sec:SBC_isf}), 
    94118which provides additional sources of fresh water. 
    95119 
    96120 
     121 
    97122% ================================================================ 
    98123% Surface boundary condition for the ocean 
    99124% ================================================================ 
    100125\section{Surface boundary condition for the ocean} 
    101 \label{sec:SBC_general} 
     126\label{sec:SBC_ocean} 
    102127 
    103128The surface ocean stress is the stress exerted by the wind and the sea-ice on the ocean. 
    104129It is applied in \mdl{dynzdf} module as a surface boundary condition of the computation of 
    105 the momentum vertical mixing trend (see \autoref{eq:dynzdf_sbc} in \autoref{sec:DYN_zdf}). 
     130the momentum vertical mixing trend (see \autoref{eq:DYN_zdf_sbc} in \autoref{sec:DYN_zdf}). 
    106131As such, it has to be provided as a 2D vector interpolated onto the horizontal velocity ocean mesh, 
    107 \ie resolved onto the model (\textbf{i},\textbf{j}) direction at $u$- and $v$-points. 
     132\ie\ resolved onto the model (\textbf{i},\textbf{j}) direction at $u$- and $v$-points. 
    108133 
    109134The surface heat flux is decomposed into two parts, a non solar and a solar heat flux, 
    110135$Q_{ns}$ and $Q_{sr}$, respectively. 
    111136The former is the non penetrative part of the heat flux 
    112 (\ie the sum of sensible, latent and long wave heat fluxes plus 
    113 the heat content of the mass exchange with the atmosphere and sea-ice). 
     137(\ie\ the sum of sensible, latent and long wave heat fluxes plus 
     138the heat content of the mass exchange between the ocean and sea-ice). 
    114139It is applied in \mdl{trasbc} module as a surface boundary condition trend of 
    115140the first level temperature time evolution equation 
    116 (see \autoref{eq:tra_sbc} and \autoref{eq:tra_sbc_lin} in \autoref{subsec:TRA_sbc}).  
     141(see \autoref{eq:TRA_sbc} and \autoref{eq:TRA_sbc_lin} in \autoref{subsec:TRA_sbc}). 
    117142The latter is the penetrative part of the heat flux. 
    118 It is applied as a 3D trends of the temperature equation (\mdl{traqsr} module) when 
    119 \np{ln\_traqsr}\forcode{ = .true.}. 
     143It is applied as a 3D trend of the temperature equation (\mdl{traqsr} module) when 
     144\np{ln\_traqsr}\forcode{=.true.}. 
    120145The way the light penetrates inside the water column is generally a sum of decreasing exponentials 
    121 (see \autoref{subsec:TRA_qsr}).  
     146(see \autoref{subsec:TRA_qsr}). 
    122147 
    123148The surface freshwater budget is provided by the \textit{emp} field. 
    124149It represents the mass flux exchanged with the atmosphere (evaporation minus precipitation) and 
    125150possibly with the sea-ice and ice shelves (freezing minus melting of ice). 
    126 It affects both the ocean in two different ways: 
    127 $(i)$  it changes the volume of the ocean and therefore appears in the sea surface height equation as 
    128 a volume flux, and  
     151It affects the ocean in two different ways: 
     152$(i)$  it changes the volume of the ocean, and therefore appears in the sea surface height equation as      %GS: autoref ssh equation to be added 
     153a volume flux, and 
    129154$(ii)$ it changes the surface temperature and salinity through the heat and salt contents of 
    130 the mass exchanged with the atmosphere, the sea-ice and the ice shelves.  
     155the mass exchanged with atmosphere, sea-ice and ice shelves. 
    131156 
    132157 
    133158%\colorbox{yellow}{Miss: } 
    134159% 
    135 %A extensive description of all namsbc namelist (parameter that have to be  
     160%A extensive description of all namsbc namelist (parameter that have to be 
    136161%created!) 
    137162% 
    138 %Especially the \np{nn\_fsbc}, the \mdl{sbc\_oce} module (fluxes + mean sst sss ssu  
    139 %ssv) \ie information required by flux computation or sea-ice 
     163%Especially the \np{nn\_fsbc}, the \mdl{sbc\_oce} module (fluxes + mean sst sss ssu 
     164%ssv) \ie\ information required by flux computation or sea-ice 
    140165% 
    141 %\mdl{sbc\_oce} containt the definition in memory of the 7 fields (6+runoff), add  
     166%\mdl{sbc\_oce} containt the definition in memory of the 7 fields (6+runoff), add 
    142167%a word on runoff: included in surface bc or add as lateral obc{\ldots}. 
    143168% 
    144169%Sbcmod manage the ``providing'' (fourniture) to the ocean the 7 fields 
    145170% 
    146 %Fluxes update only each nf{\_}sbc time step (namsbc) explain relation  
    147 %between nf{\_}sbc and nf{\_}ice, do we define nf{\_}blk??? ? only one  
    148 %nf{\_}sbc 
     171%Fluxes update only each nf\_sbc time step (namsbc) explain relation 
     172%between nf\_sbc and nf\_ice, do we define nf\_blk??? ? only one 
     173%nf\_sbc 
    149174% 
    150175%Explain here all the namlist namsbc variable{\ldots}. 
    151 %  
     176% 
    152177% explain : use or not of surface currents 
    153178% 
     
    155180 
    156181The ocean model provides, at each time step, to the surface module (\mdl{sbcmod}) 
    157 the surface currents, temperature and salinity.   
    158 These variables are averaged over \np{nn\_fsbc} time-step (\autoref{tab:ssm}), and 
    159 it is these averaged fields which are used to computes the surface fluxes at a frequency of \np{nn\_fsbc} time-step. 
     182the surface currents, temperature and salinity. 
     183These variables are averaged over \np{nn\_fsbc} time-step (\autoref{tab:SBC_ssm}), and 
     184these averaged fields are used to compute the surface fluxes at the frequency of \np{nn\_fsbc} time-steps. 
    160185 
    161186 
    162187%-------------------------------------------------TABLE--------------------------------------------------- 
    163188\begin{table}[tb] 
    164   \begin{center} 
    165     \begin{tabular}{|l|l|l|l|} 
    166       \hline 
    167       Variable description             & Model variable  & Units  & point \\  \hline 
    168       i-component of the surface current  & ssu\_m & $m.s^{-1}$   & U \\   \hline 
    169       j-component of the surface current  & ssv\_m & $m.s^{-1}$   & V \\   \hline 
    170       Sea surface temperature          & sst\_m & \r{}$K$      & T \\   \hline 
    171       Sea surface salinty              & sss\_m & $psu$        & T \\   \hline 
    172     \end{tabular} 
    173     \caption{ 
    174       \protect\label{tab:ssm} 
    175       Ocean variables provided by the ocean to the surface module (SBC). 
    176       The variable are averaged over nn{\_}fsbc time step, 
    177       \ie the frequency of computation of surface fluxes. 
    178     } 
    179   \end{center} 
     189  \centering 
     190  \begin{tabular}{|l|l|l|l|} 
     191    \hline 
     192    Variable description                           & Model variable  & Units  & point                 \\ 
     193    \hline 
     194    i-component of the surface current & ssu\_m               & $m.s^{-1}$     & U     \\ 
     195    \hline 
     196    j-component of the surface current & ssv\_m               & $m.s^{-1}$     & V     \\ 
     197    \hline 
     198    Sea surface temperature                  & sst\_m               & \r{}$K$              & T     \\\hline 
     199    Sea surface salinty                         & sss\_m               & $psu$              & T     \\   \hline 
     200  \end{tabular} 
     201  \caption[Ocean variables provided to the surface module)]{ 
     202    Ocean variables provided to the surface module (\texttt{SBC}). 
     203    The variable are averaged over \protect\np{nn\_fsbc} time-step, 
     204    \ie\ the frequency of computation of surface fluxes.} 
     205  \label{tab:SBC_ssm} 
    180206\end{table} 
    181207%-------------------------------------------------------------------------------------------------------------- 
    182208 
    183 %\colorbox{yellow}{Penser a} mettre dans le restant l'info nn{\_}fsbc ET nn{\_}fsbc*rdt de sorte de reinitialiser la moyenne si on change la frequence ou le pdt 
    184  
    185  
    186 % ================================================================ 
    187 %       Input Data  
     209%\colorbox{yellow}{Penser a} mettre dans le restant l'info nn\_fsbc ET nn\_fsbc*rdt de sorte de reinitialiser la moyenne si on change la frequence ou le pdt 
     210 
     211 
     212 
     213% ================================================================ 
     214%       Input Data 
    188215% ================================================================ 
    189216\section{Input data generic interface} 
     
    191218 
    192219A generic interface has been introduced to manage the way input data 
    193 (2D or 3D fields, like surface forcing or ocean T and S) are specify in \NEMO. 
    194 This task is archieved by \mdl{fldread}. 
    195 The module was design with four main objectives in mind:  
     220(2D or 3D fields, like surface forcing or ocean T and S) are specified in \NEMO. 
     221This task is achieved by \mdl{fldread}. 
     222The module is designed with four main objectives in mind: 
    196223\begin{enumerate} 
    197224\item 
    198   optionally provide a time interpolation of the input data at model time-step, whatever their input frequency is, 
     225  optionally provide a time interpolation of the input data every specified model time-step, whatever their input frequency is, 
    199226  and according to the different calendars available in the model. 
    200227\item 
     
    204231\item 
    205232  provide a simple user interface and a rather simple developer interface by 
    206   limiting the number of prerequisite information.  
    207 \end{enumerate}   
    208  
    209 As a results the user have only to fill in for each variable a structure in the namelist file to 
     233  limiting the number of prerequisite informations. 
     234\end{enumerate} 
     235 
     236As a result, the user has only to fill in for each variable a structure in the namelist file to 
    210237define the input data file and variable names, the frequency of the data (in hours or months), 
    211238whether its is climatological data or not, the period covered by the input file (one year, month, week or day), 
    212 and three additional parameters for on-the-fly interpolation. 
     239and three additional parameters for the on-the-fly interpolation. 
    213240When adding a new input variable, the developer has to add the associated structure in the namelist, 
    214241read this information by mirroring the namelist read in \rou{sbc\_blk\_init} for example, 
    215242and simply call \rou{fld\_read} to obtain the desired input field at the model time-step and grid points. 
    216243 
    217 The only constraints are that the input file is a NetCDF file, the file name follows a nomenclature  
     244The only constraints are that the input file is a NetCDF file, the file name follows a nomenclature 
    218245(see \autoref{subsec:SBC_fldread}), the period it cover is one year, month, week or day, and, 
    219246if on-the-fly interpolation is used, a file of weights must be supplied (see \autoref{subsec:SBC_iof}). 
    220247 
    221248Note that when an input data is archived on a disc which is accessible directly from the workspace where 
    222 the code is executed, then the use can set the \np{cn\_dir} to the pathway leading to the data. 
    223 By default, the data are assumed to have been copied so that cn\_dir='./'. 
     249the code is executed, then the user can set the \np{cn\_dir} to the pathway leading to the data. 
     250By default, the data are assumed to be in the same directory as the executable, so that cn\_dir='./'. 
     251 
    224252 
    225253% ------------------------------------------------------------------------------------------------------------- 
    226254% Input Data specification (\mdl{fldread}) 
    227255% ------------------------------------------------------------------------------------------------------------- 
    228 \subsection{Input data specification (\protect\mdl{fldread})} 
     256\subsection[Input data specification (\textit{fldread.F90})] 
     257{Input data specification (\protect\mdl{fldread})} 
    229258\label{subsec:SBC_fldread} 
    230259 
    231260The structure associated with an input variable contains the following information: 
    232261\begin{forlines} 
    233 !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask !  
     262!  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
    234263!             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      ! 
    235264\end{forlines} 
    236 where  
    237 \begin{description}   
     265where 
     266\begin{description} 
    238267\item[File name]: 
    239   the stem name of the NetCDF file to be open. 
     268  the stem name of the NetCDF file to be opened. 
    240269  This stem will be completed automatically by the model, with the addition of a '.nc' at its end and 
    241270  by date information and possibly a prefix (when using AGRIF). 
    242   Tab.\autoref{tab:fldread} provides the resulting file name in all possible cases according to 
     271  \autoref{tab:SBC_fldread} provides the resulting file name in all possible cases according to 
    243272  whether it is a climatological file or not, and to the open/close frequency (see below for definition). 
    244273 
    245274%--------------------------------------------------TABLE-------------------------------------------------- 
    246275  \begin{table}[htbp] 
    247     \begin{center} 
    248       \begin{tabular}{|l|c|c|c|} 
    249         \hline 
    250         & daily or weekLLL         & monthly                   &   yearly          \\   \hline 
    251         \np{clim}\forcode{ = .false.}  & fn\_yYYYYmMMdDD.nc  &   fn\_yYYYYmMM.nc   &   fn\_yYYYY.nc  \\   \hline 
    252         \np{clim}\forcode{ = .true.}         & not possible                  &  fn\_m??.nc             &   fn                \\   \hline 
    253       \end{tabular} 
    254     \end{center} 
    255     \caption{ 
    256       \protect\label{tab:fldread} 
    257       naming nomenclature for climatological or interannual input file, as a function of the Open/close frequency. 
     276    \centering 
     277    \begin{tabular}{|l|c|c|c|} 
     278      \hline 
     279                                  &  daily or weekLL     &  monthly           &  yearly        \\ 
     280      \hline 
     281      \np{clim}\forcode{=.false.} &  fn\_yYYYYmMMdDD.nc  &  fn\_yYYYYmMM.nc   &  fn\_yYYYY.nc  \\ 
     282      \hline 
     283      \np{clim}\forcode{=.true.}  &  not possible        &  fn\_m??.nc        &  fn            \\ 
     284      \hline 
     285    \end{tabular} 
     286    \caption[Naming nomenclature for climatological or interannual input file]{ 
     287      Naming nomenclature for climatological or interannual input file, 
     288      as a function of the open/close frequency. 
    258289      The stem name is assumed to be 'fn'. 
    259290      For weekly files, the 'LLL' corresponds to the first three letters of the first day of the week 
    260       (\ie 'sun','sat','fri','thu','wed','tue','mon'). 
    261       The 'YYYY', 'MM' and 'DD' should be replaced by the actual year/month/day, always coded with 4 or 2 digits. 
    262       Note that (1) in mpp, if the file is split over each subdomain, the suffix '.nc' is replaced by '\_PPPP.nc', 
     291      (\ie\ 'sun','sat','fri','thu','wed','tue','mon'). 
     292      The 'YYYY', 'MM' and 'DD' should be replaced by the actual year/month/day, 
     293      always coded with 4 or 2 digits. 
     294      Note that (1) in mpp, if the file is split over each subdomain, 
     295      the suffix '.nc' is replaced by '\_PPPP.nc', 
    263296      where 'PPPP' is the process number coded with 4 digits; 
    264       (2) when using AGRIF, the prefix '\_N' is added to files, where 'N'  is the child grid number. 
     297      (2) when using AGRIF, the prefix '\_N' is added to files, where 'N' is the child grid number. 
    265298    } 
     299    \label{tab:SBC_fldread} 
    266300  \end{table} 
    267301%-------------------------------------------------------------------------------------------------------------- 
    268    
     302 
    269303 
    270304\item[Record frequency]: 
     
    272306  Its unit is in hours if it is positive (for example 24 for daily forcing) or in months if negative 
    273307  (for example -1 for monthly forcing or -12 for annual forcing). 
    274   Note that this frequency must really be an integer and not a real. 
    275   On some computers, seting it to '24.' can be interpreted as 240! 
     308  Note that this frequency must REALLY be an integer and not a real. 
     309  On some computers, setting it to '24.' can be interpreted as 240! 
    276310 
    277311\item[Variable name]: 
     
    284318  00h00'00'' to 23h59'59". 
    285319  If set to 'true', the forcing will have a broken line shape. 
    286   Records are assumed to be dated the middle of the forcing period. 
     320  Records are assumed to be dated at the middle of the forcing period. 
    287321  For example, when using a daily forcing with time interpolation, 
    288   linear interpolation will be performed between mid-day of two consecutive days.  
     322  linear interpolation will be performed between mid-day of two consecutive days. 
    289323 
    290324\item[Climatological forcing]: 
    291325  a logical to specify if a input file contains climatological forcing which can be cycle in time, 
    292326  or an interannual forcing which will requires additional files if 
    293   the period covered by the simulation exceed the one of the file. 
    294   See the above the file naming strategy which impacts the expected name of the file to be opened.  
     327  the period covered by the simulation exceeds the one of the file. 
     328  See the above file naming strategy which impacts the expected name of the file to be opened. 
    295329 
    296330\item[Open/close frequency]: 
     
    301335  Files are assumed to contain data from the beginning of the open/close period. 
    302336  For example, the first record of a yearly file containing daily data is Jan 1st even if 
    303   the experiment is not starting at the beginning of the year.  
     337  the experiment is not starting at the beginning of the year. 
    304338 
    305339\item[Others]: 
     
    313347The only tricky point is therefore to specify the date at which we need to do the interpolation and 
    314348the date of the records read in the input files. 
    315 Following \citet{Leclair_Madec_OM09}, the date of a time step is set at the middle of the time step. 
    316 For example, for an experiment starting at 0h00'00" with a one hour time-step, 
     349Following \citet{leclair.madec_OM09}, the date of a time step is set at the middle of the time step. 
     350For example, for an experiment starting at 0h00'00" with a one-hour time-step, 
    317351a time interpolation will be performed at the following time: 0h30'00", 1h30'00", 2h30'00", etc. 
    318352However, for forcing data related to the surface module, 
    319353values are not needed at every time-step but at every \np{nn\_fsbc} time-step. 
    320 For example with \np{nn\_fsbc}\forcode{ = 3}, the surface module will be called at time-steps 1, 4, 7, etc. 
    321 The date used for the time interpolation is thus redefined to be at the middle of \np{nn\_fsbc} time-step period. 
    322 In the previous example, this leads to: 1h30'00", 4h30'00", 7h30'00", etc. \\  
     354For example with \np{nn\_fsbc}\forcode{=3}, the surface module will be called at time-steps 1, 4, 7, etc. 
     355The date used for the time interpolation is thus redefined to the middle of \np{nn\_fsbc} time-step period. 
     356In the previous example, this leads to: 1h30'00", 4h30'00", 7h30'00", etc. \\ 
    323357(2) For code readablility and maintenance issues, we don't take into account the NetCDF input file calendar. 
    324358The calendar associated with the forcing field is build according to the information provided by 
    325359user in the record frequency, the open/close frequency and the type of temporal interpolation. 
    326360For example, the first record of a yearly file containing daily data that will be interpolated in time is assumed to 
    327 be start Jan 1st at 12h00'00" and end Dec 31st at 12h00'00". \\ 
     361start Jan 1st at 12h00'00" and end Dec 31st at 12h00'00". \\ 
    328362(3) If a time interpolation is requested, the code will pick up the needed data in the previous (next) file when 
    329363interpolating data with the first (last) record of the open/close period. 
    330 For example, if the input file specifications are ''yearly, containing daily data to be interpolated in time'',  
     364For example, if the input file specifications are ''yearly, containing daily data to be interpolated in time'', 
    331365the values given by the code between 00h00'00" and 11h59'59" on Jan 1st will be interpolated values between 
    332366Dec 31st 12h00'00" and Jan 1st 12h00'00". 
    333367If the forcing is climatological, Dec and Jan will be keep-up from the same year. 
    334368However, if the forcing is not climatological, at the end of 
    335 the open/close period the code will automatically close the current file and open the next one. 
     369the open/close period, the code will automatically close the current file and open the next one. 
    336370Note that, if the experiment is starting (ending) at the beginning (end) of 
    337 an open/close period we do accept that the previous (next) file is not existing. 
     371an open/close period, we do accept that the previous (next) file is not existing. 
    338372In this case, the time interpolation will be performed between two identical values. 
    339373For example, when starting an experiment on Jan 1st of year Y with yearly files and daily data to be interpolated, 
    340374we do accept that the file related to year Y-1 is not existing. 
    341375The value of Jan 1st will be used as the missing one for Dec 31st of year Y-1. 
    342 If the file of year Y-1 exists, the code will read its last record.  
     376If the file of year Y-1 exists, the code will read its last record. 
    343377Therefore, this file can contain only one record corresponding to Dec 31st, 
    344378a useful feature for user considering that it is too heavy to manipulate the complete file for year Y-1. 
     
    353387Interpolation on the Fly allows the user to supply input files required for the surface forcing on 
    354388grids other than the model grid. 
    355 To do this he or she must supply, in addition to the source data file, a file of weights to be used to 
     389To do this, he or she must supply, in addition to the source data file(s), a file of weights to be used to 
    356390interpolate from the data grid to the model grid. 
    357391The original development of this code used the SCRIP package 
    358392(freely available \href{http://climate.lanl.gov/Software/SCRIP}{here} under a copyright agreement). 
    359 In principle, any package can be used to generate the weights, but the variables in 
     393In principle, any package such as CDO can be used to generate the weights, but the variables in 
    360394the input weights file must have the same names and meanings as assumed by the model. 
    361 Two methods are currently available: bilinear and bicubic interpolation. 
     395Two methods are currently available: bilinear and bicubic interpolations. 
    362396Prior to the interpolation, providing a land/sea mask file, the user can decide to remove land points from 
    363397the input file and substitute the corresponding values with the average of the 8 neighbouring points in 
     
    365399Only "sea points" are considered for the averaging. 
    366400The land/sea mask file must be provided in the structure associated with the input variable. 
    367 The netcdf land/sea mask variable name must be 'LSM' it must have the same horizontal and vertical dimensions of 
    368 the associated variable and should be equal to 1 over land and 0 elsewhere. 
    369 The procedure can be recursively applied setting nn\_lsm > 1 in namsbc namelist. 
    370 Note that nn\_lsm=0 forces the code to not apply the procedure even if a file for land/sea mask is supplied. 
    371  
     401The netcdf land/sea mask variable name must be 'LSM' and must have the same horizontal and vertical dimensions as 
     402the associated variables and should be equal to 1 over land and 0 elsewhere. 
     403The procedure can be recursively applied by setting nn\_lsm > 1 in namsbc namelist. 
     404Note that nn\_lsm=0 forces the code to not apply the procedure, even if a land/sea mask file is supplied. 
     405 
     406 
     407% ------------------------------------------------------------------------------------------------------------- 
     408% Bilinear interpolation 
     409% ------------------------------------------------------------------------------------------------------------- 
    372410\subsubsection{Bilinear interpolation} 
    373411\label{subsec:SBC_iof_bilinear} 
     
    375413The input weights file in this case has two sets of variables: 
    376414src01, src02, src03, src04 and wgt01, wgt02, wgt03, wgt04. 
    377 The "src" variables correspond to the point in the input grid to which the weight "wgt" is to be applied. 
     415The "src" variables correspond to the point in the input grid to which the weight "wgt" is applied. 
    378416Each src value is an integer corresponding to the index of a point in the input grid when 
    379417written as a one dimensional array. 
     
    391429and wgt(1) corresponds to variable "wgt01" for example. 
    392430 
     431 
     432% ------------------------------------------------------------------------------------------------------------- 
     433% Bicubic interpolation 
     434% ------------------------------------------------------------------------------------------------------------- 
    393435\subsubsection{Bicubic interpolation} 
    394436\label{subsec:SBC_iof_bicubic} 
    395437 
    396 Again there are two sets of variables: "src" and "wgt". 
    397 But in this case there are 16 of each. 
     438Again, there are two sets of variables: "src" and "wgt". 
     439But in this case, there are 16 of each. 
    398440The symbolic algorithm used to calculate values on the model grid is now: 
    399441 
     
    401443  \begin{split} 
    402444    f_{m}(i,j) =  f_{m}(i,j) +& \sum_{k=1}^{4} {wgt(k)f(idx(src(k)))} 
    403     +   \sum_{k=5}^{8} {wgt(k)\left.\frac{\partial f}{\partial i}\right| _{idx(src(k))} }    \\ 
    404     +& \sum_{k=9}^{12} {wgt(k)\left.\frac{\partial f}{\partial j}\right| _{idx(src(k))} } 
    405     +   \sum_{k=13}^{16} {wgt(k)\left.\frac{\partial ^2 f}{\partial i \partial j}\right| _{idx(src(k))} } 
     445    +  \sum_{k=5 }^{8 } {wgt(k)\left.\frac{\partial f}{\partial i}\right| _{idx(src(k))} }    \\ 
     446    +& \sum_{k=9 }^{12} {wgt(k)\left.\frac{\partial f}{\partial j}\right| _{idx(src(k))} } 
     447    +  \sum_{k=13}^{16} {wgt(k)\left.\frac{\partial ^2 f}{\partial i \partial j}\right| _{idx(src(k))} } 
    406448  \end{split} 
    407449\] 
    408450The gradients here are taken with respect to the horizontal indices and not distances since 
    409 the spatial dependency has been absorbed into the weights. 
    410  
     451the spatial dependency has been included into the weights. 
     452 
     453 
     454% ------------------------------------------------------------------------------------------------------------- 
     455% Implementation 
     456% ------------------------------------------------------------------------------------------------------------- 
    411457\subsubsection{Implementation} 
    412458\label{subsec:SBC_iof_imp} 
     
    420466inspecting a global attribute stored in the weights input file. 
    421467This attribute must be called "ew\_wrap" and be of integer type. 
    422 If it is negative, the input non-model grid is assumed not to be cyclic. 
     468If it is negative, the input non-model grid is assumed to be not cyclic. 
    423469If zero or greater, then the value represents the number of columns that overlap. 
    424470$E.g.$ if the input grid has columns at longitudes 0, 1, 2, .... , 359, then ew\_wrap should be set to 0; 
    425471if longitudes are 0.5, 2.5, .... , 358.5, 360.5, 362.5, ew\_wrap should be 2. 
    426472If the model does not find attribute ew\_wrap, then a value of -999 is assumed. 
    427 In this case the \rou{fld\_read} routine defaults ew\_wrap to value 0 and 
     473In this case, the \rou{fld\_read} routine defaults ew\_wrap to value 0 and 
    428474therefore the grid is assumed to be cyclic with no overlapping columns. 
    429 (In fact this only matters when bicubic interpolation is required.) 
     475(In fact, this only matters when bicubic interpolation is required.) 
    430476Note that no testing is done to check the validity in the model, 
    431477since there is no way of knowing the name used for the longitude variable, 
     
    444490or is a copy of one from the first few columns on the opposite side of the grid (cyclical case). 
    445491 
     492 
     493% ------------------------------------------------------------------------------------------------------------- 
     494% Limitations 
     495% ------------------------------------------------------------------------------------------------------------- 
    446496\subsubsection{Limitations} 
    447497\label{subsec:SBC_iof_lim} 
    448498 
    449 \begin{enumerate}   
    450 \item 
    451   The case where input data grids are not logically rectangular has not been tested. 
     499\begin{enumerate} 
     500\item 
     501  The case where input data grids are not logically rectangular (irregular grid case) has not been tested. 
    452502\item 
    453503  This code is not guaranteed to produce positive definite answers from positive definite inputs when 
     
    470520(see the directory NEMOGCM/TOOLS/WEIGHTS). 
    471521 
     522 
    472523% ------------------------------------------------------------------------------------------------------------- 
    473524% Standalone Surface Boundary Condition Scheme 
    474525% ------------------------------------------------------------------------------------------------------------- 
    475 \subsection{Standalone surface boundary condition scheme} 
    476 \label{subsec:SAS_iof} 
    477  
    478 %---------------------------------------namsbc_ana-------------------------------------------------- 
    479  
    480 \nlst{namsbc_sas} 
     526\subsection{Standalone surface boundary condition scheme (SAS)} 
     527\label{subsec:SBC_SAS} 
     528 
     529%---------------------------------------namsbc_sas-------------------------------------------------- 
     530 
     531\begin{listing} 
     532  \nlst{namsbc_sas} 
     533  \caption{\texttt{namsbc\_sas}} 
     534  \label{lst:namsbc_sas} 
     535\end{listing} 
    481536%-------------------------------------------------------------------------------------------------------------- 
    482537 
    483 In some circumstances it may be useful to avoid calculating the 3D temperature, 
    484 salinity and velocity fields and simply read them in from a previous run or receive them from OASIS.   
     538In some circumstances, it may be useful to avoid calculating the 3D temperature, 
     539salinity and velocity fields and simply read them in from a previous run or receive them from OASIS. 
    485540For example: 
    486541 
     
    496551  Spinup of the iceberg floats 
    497552\item 
    498   Ocean/sea-ice simulation with both media running in parallel (\np{ln\_mixcpl}\forcode{ = .true.}) 
     553  Ocean/sea-ice simulation with both models running in parallel (\np{ln\_mixcpl}\forcode{=.true.}) 
    499554\end{itemize} 
    500555 
    501 The StandAlone Surface scheme provides this utility. 
    502 Its options are defined through the \ngn{namsbc\_sas} namelist variables. 
     556The Standalone Surface scheme provides this capacity. 
     557Its options are defined through the \nam{sbc\_sas} namelist variables. 
    503558A new copy of the model has to be compiled with a configuration based on ORCA2\_SAS\_LIM. 
    504 However no namelist parameters need be changed from the settings of the previous run (except perhaps nn{\_}date0). 
     559However, no namelist parameters need be changed from the settings of the previous run (except perhaps nn\_date0). 
    505560In this configuration, a few routines in the standard model are overriden by new versions. 
    506561Routines replaced are: 
     
    518573  This has been cut down and now only calculates surface forcing and the ice model required. 
    519574  New surface modules that can function when only the surface level of the ocean state is defined can also be added 
    520   (\eg icebergs). 
     575  (\eg\ icebergs). 
    521576\item 
    522577  \mdl{daymod}: 
     
    524579  so calls to restart functions have been removed. 
    525580  This also means that the calendar cannot be controlled by time in a restart file, 
    526   so the user must make sure that nn{\_}date0 in the model namelist is correct for his or her purposes. 
     581  so the user must check that nn\_date0 in the model namelist is correct for his or her purposes. 
    527582\item 
    528583  \mdl{stpctl}: 
     
    542597  This module initialises the input files needed for reading temperature, salinity and 
    543598  velocity arrays at the surface. 
    544   These filenames are supplied in namelist namsbc{\_}sas. 
    545   Unfortunately because of limitations with the \mdl{iom} module, 
     599  These filenames are supplied in namelist namsbc\_sas. 
     600  Unfortunately, because of limitations with the \mdl{iom} module, 
    546601  the full 3D fields from the mean files have to be read in and interpolated in time, 
    547602  before using just the top level. 
     
    550605 
    551606 
    552 % Missing the description of the 2 following variables: 
    553 %   ln_3d_uve   = .true.    !  specify whether we are supplying a 3D u,v and e3 field 
    554 %   ln_read_frq = .false.    !  specify whether we must read frq or not 
    555  
    556  
    557  
    558 % ================================================================ 
    559 % Analytical formulation (sbcana module)  
    560 % ================================================================ 
    561 \section{Analytical formulation (\protect\mdl{sbcana})} 
    562 \label{sec:SBC_ana} 
    563  
    564 %---------------------------------------namsbc_ana-------------------------------------------------- 
    565 % 
    566 %\nlst{namsbc_ana} 
    567 %-------------------------------------------------------------------------------------------------------------- 
    568  
    569 The analytical formulation of the surface boundary condition is the default scheme. 
    570 In this case, all the six fluxes needed by the ocean are assumed to be uniform in space. 
    571 They take constant values given in the namelist \ngn{namsbc{\_}ana} by 
    572 the variables \np{rn\_utau0}, \np{rn\_vtau0}, \np{rn\_qns0}, \np{rn\_qsr0}, and \np{rn\_emp0} 
    573 ($\textit{emp}=\textit{emp}_S$). 
    574 The runoff is set to zero. 
    575 In addition, the wind is allowed to reach its nominal value within a given number of time steps (\np{nn\_tau000}). 
    576  
    577 If a user wants to apply a different analytical forcing, 
    578 the \mdl{sbcana} module can be modified to use another scheme. 
    579 As an example, the \mdl{sbc\_ana\_gyre} routine provides the analytical forcing for the GYRE configuration 
    580 (see GYRE configuration manual, in preparation). 
    581  
    582  
    583 % ================================================================ 
    584 % Flux formulation  
    585 % ================================================================ 
    586 \section{Flux formulation (\protect\mdl{sbcflx})} 
     607The user can also choose in the \nam{sbc\_sas} namelist to read the mean (nn\_fsbc time-step) fraction of solar net radiation absorbed in the 1st T level using 
     608 (\np{ln\_flx}\forcode{=.true.}) and to provide 3D oceanic velocities instead of 2D ones (\np{ln\_flx}\forcode{=.true.}). In that last case, only the 1st level will be read in. 
     609 
     610 
     611 
     612% ================================================================ 
     613% Flux formulation 
     614% ================================================================ 
     615\section[Flux formulation (\textit{sbcflx.F90})] 
     616{Flux formulation (\protect\mdl{sbcflx})} 
    587617\label{sec:SBC_flx} 
    588618%------------------------------------------namsbc_flx---------------------------------------------------- 
    589619 
    590 \nlst{namsbc_flx}  
     620\begin{listing} 
     621  \nlst{namsbc_flx} 
     622  \caption{\texttt{namsbc\_flx}} 
     623  \label{lst:namsbc_flx} 
     624\end{listing} 
    591625%------------------------------------------------------------------------------------------------------------- 
    592626 
    593 In the flux formulation (\np{ln\_flx}\forcode{ = .true.}), 
     627In the flux formulation (\np{ln\_flx}\forcode{=.true.}), 
    594628the surface boundary condition fields are directly read from input files. 
    595 The user has to define in the namelist \ngn{namsbc{\_}flx} the name of the file, 
     629The user has to define in the namelist \nam{sbc\_flx} the name of the file, 
    596630the name of the variable read in the file, the time frequency at which it is given (in hours), 
    597631and a logical setting whether a time interpolation to the model time step is required for this field. 
     
    602636 
    603637 
     638 
    604639% ================================================================ 
    605640% Bulk formulation 
    606641% ================================================================ 
    607 \section[Bulk formulation {(\textit{sbcblk\{\_core,\_clio\}.F90})}] 
    608                         {Bulk formulation {(\protect\mdl{sbcblk\_core}, \protect\mdl{sbcblk\_clio})}} 
     642\section[Bulk formulation (\textit{sbcblk.F90})] 
     643{Bulk formulation (\protect\mdl{sbcblk})} 
    609644\label{sec:SBC_blk} 
    610  
    611 In the bulk formulation, the surface boundary condition fields are computed using bulk formulae and atmospheric fields and ocean (and ice) variables. 
     645%---------------------------------------namsbc_blk-------------------------------------------------- 
     646 
     647\begin{listing} 
     648  \nlst{namsbc_blk} 
     649  \caption{\texttt{namsbc\_blk}} 
     650  \label{lst:namsbc_blk} 
     651\end{listing} 
     652%-------------------------------------------------------------------------------------------------------------- 
     653 
     654In the bulk formulation, the surface boundary condition fields are computed with bulk formulae using atmospheric fields 
     655and ocean (and sea-ice) variables averaged over \np{nn\_fsbc} time-step. 
    612656 
    613657The atmospheric fields used depend on the bulk formulae used. 
    614 Two bulk formulations are available: 
    615 the CORE and the CLIO bulk formulea. 
     658In forced mode, when a sea-ice model is used, a specific bulk formulation is used. 
     659Therefore, different bulk formulae are used for the turbulent fluxes computation 
     660over the ocean and over sea-ice surface. 
     661For the ocean, four bulk formulations are available thanks to the \href{https://brodeau.github.io/aerobulk/}{Aerobulk} package (\citet{brodeau.barnier.ea_JPO16}): 
     662the NCAR (formerly named CORE), COARE 3.0, COARE 3.5 and ECMWF bulk formulae. 
    616663The choice is made by setting to true one of the following namelist variable: 
    617 \np{ln\_core} or \np{ln\_clio}. 
    618  
    619 Note: 
    620 in forced mode, when a sea-ice model is used, a bulk formulation (CLIO or CORE) have to be used. 
    621 Therefore the two bulk (CLIO and CORE) formulea include the computation of the fluxes over 
    622 both an ocean and an ice surface.  
    623  
    624 % ------------------------------------------------------------------------------------------------------------- 
    625 %        CORE Bulk formulea 
    626 % ------------------------------------------------------------------------------------------------------------- 
    627 \subsection{CORE formulea (\protect\mdl{sbcblk\_core}, \protect\np{ln\_core}\forcode{ = .true.})} 
    628 \label{subsec:SBC_blk_core} 
    629 %------------------------------------------namsbc_core---------------------------------------------------- 
    630 % 
    631 %\nlst{namsbc_core} 
    632 %------------------------------------------------------------------------------------------------------------- 
    633  
    634 The CORE bulk formulae have been developed by \citet{Large_Yeager_Rep04}. 
    635 They have been designed to handle the CORE forcing, a mixture of NCEP reanalysis and satellite data. 
    636 They use an inertial dissipative method to compute the turbulent transfer coefficients 
    637 (momentum, sensible heat and evaporation) from the 10 metre wind speed, air temperature and specific humidity. 
    638 This \citet{Large_Yeager_Rep04} dataset is available through 
    639 the \href{http://nomads.gfdl.noaa.gov/nomads/forms/mom4/CORE.html}{GFDL web site}. 
    640  
    641 Note that substituting ERA40 to NCEP reanalysis fields does not require changes in the bulk formulea themself. 
    642 This is the so-called DRAKKAR Forcing Set (DFS) \citep{Brodeau_al_OM09}. 
    643  
    644 Options are defined through the  \ngn{namsbc\_core} namelist variables. 
    645 The required 8 input fields are: 
     664 \np{ln\_NCAR}, \np{ln\_COARE\_3p0},  \np{ln\_COARE\_3p5} and  \np{ln\_ECMWF}. 
     665For sea-ice, three possibilities can be selected: 
     666a constant transfer coefficient (1.4e-3; default value), \citet{lupkes.gryanik.ea_JGR12} (\np{ln\_Cd\_L12}), and \citet{lupkes.gryanik_JGR15} (\np{ln\_Cd\_L15}) parameterizations 
     667 
     668Common options are defined through the \nam{sbc\_blk} namelist variables. 
     669The required 9 input fields are: 
    646670 
    647671%--------------------------------------------------TABLE-------------------------------------------------- 
    648672\begin{table}[htbp] 
    649   \label{tab:CORE} 
    650   \begin{center} 
    651     \begin{tabular}{|l|c|c|c|} 
    652       \hline 
    653       Variable desciption              & Model variable  & Units   & point \\    \hline 
    654       i-component of the 10m air velocity & utau      & $m.s^{-1}$         & T  \\  \hline 
    655       j-component of the 10m air velocity & vtau      & $m.s^{-1}$         & T  \\  \hline 
    656       10m air temperature              & tair      & \r{}$K$            & T   \\ \hline 
    657       Specific humidity             & humi      & \%              & T \\      \hline 
    658       Incoming long wave radiation     & qlw    & $W.m^{-2}$         & T \\      \hline 
    659       Incoming short wave radiation    & qsr    & $W.m^{-2}$         & T \\      \hline 
    660       Total precipitation (liquid + solid)   & precip & $Kg.m^{-2}.s^{-1}$ & T \\   \hline 
    661       Solid precipitation              & snow      & $Kg.m^{-2}.s^{-1}$ & T \\   \hline 
     673  \centering 
     674  \begin{tabular}{|l|c|c|c|} 
     675    \hline 
     676    Variable description                 & Model variable & Units              & point \\ 
     677    \hline 
     678    i-component of the 10m air velocity  & utau           & $m.s^{-1}$         & T     \\ 
     679    \hline 
     680    j-component of the 10m air velocity  & vtau           & $m.s^{-1}$         & T     \\ 
     681    \hline 
     682    10m air temperature                  & tair           & \r{}$K$            & T     \\ 
     683    \hline 
     684    Specific humidity                    & humi           & \%                 & T     \\ 
     685    \hline 
     686    Incoming long wave radiation         & qlw            & $W.m^{-2}$         & T     \\ 
     687    \hline 
     688    Incoming short wave radiation        & qsr            & $W.m^{-2}$         & T     \\ 
     689    \hline 
     690    Total precipitation (liquid + solid) & precip         & $Kg.m^{-2}.s^{-1}$ & T     \\ 
     691    \hline 
     692    Solid precipitation                  & snow           & $Kg.m^{-2}.s^{-1}$ & T     \\ 
     693    \hline 
     694    Mean sea-level pressure              & slp            & $hPa$              & T     \\ 
     695    \hline 
    662696    \end{tabular} 
    663   \end{center} 
     697  \label{tab:SBC_BULK} 
    664698\end{table} 
    665699%-------------------------------------------------------------------------------------------------------------- 
     
    671705The \np{sn\_wndi}, \np{sn\_wndj}, \np{sn\_qsr}, \np{sn\_qlw}, \np{sn\_tair}, \np{sn\_humi}, \np{sn\_prec}, 
    672706\np{sn\_snow}, \np{sn\_tdif} parameters describe the fields and the way they have to be used 
    673 (spatial and temporal interpolations).  
     707(spatial and temporal interpolations). 
    674708 
    675709\np{cn\_dir} is the directory of location of bulk files 
     
    678712\np{rn\_zu}: is the height of wind measurements (m) 
    679713 
    680 Three multiplicative factors are availables:  
    681 \np{rn\_pfac} and \np{rn\_efac} allows to adjust (if necessary) the global freshwater budget by 
     714Three multiplicative factors are available: 
     715\np{rn\_pfac} and \np{rn\_efac} allow to adjust (if necessary) the global freshwater budget by 
    682716increasing/reducing the precipitations (total and snow) and or evaporation, respectively. 
    683717The third one,\np{rn\_vfac}, control to which extend the ice/ocean velocities are taken into account in 
    684718the calculation of surface wind stress. 
    685 Its range should be between zero and one, and it is recommended to set it to 0. 
    686  
    687 % ------------------------------------------------------------------------------------------------------------- 
    688 %        CLIO Bulk formulea 
    689 % ------------------------------------------------------------------------------------------------------------- 
    690 \subsection{CLIO formulea (\protect\mdl{sbcblk\_clio}, \protect\np{ln\_clio}\forcode{ = .true.})} 
    691 \label{subsec:SBC_blk_clio} 
    692 %------------------------------------------namsbc_clio---------------------------------------------------- 
    693 % 
    694 %\nlst{namsbc_clio} 
    695 %------------------------------------------------------------------------------------------------------------- 
    696  
    697 The CLIO bulk formulae were developed several years ago for the Louvain-la-neuve coupled ice-ocean model 
    698 (CLIO, \cite{Goosse_al_JGR99}).  
    699 They are simpler bulk formulae. 
    700 They assume the stress to be known and compute the radiative fluxes from a climatological cloud cover.  
    701  
    702 Options are defined through the  \ngn{namsbc\_clio} namelist variables. 
    703 The required 7 input fields are: 
    704  
    705 %--------------------------------------------------TABLE-------------------------------------------------- 
    706 \begin{table}[htbp] 
    707   \label{tab:CLIO} 
    708   \begin{center} 
    709     \begin{tabular}{|l|l|l|l|} 
    710       \hline 
    711       Variable desciption           & Model variable  & Units           & point \\  \hline 
    712       i-component of the ocean stress     & utau         & $N.m^{-2}$         & U \\   \hline 
    713       j-component of the ocean stress     & vtau         & $N.m^{-2}$         & V \\   \hline 
    714       Wind speed module             & vatm         & $m.s^{-1}$         & T \\   \hline 
    715       10m air temperature              & tair         & \r{}$K$            & T \\   \hline 
    716       Specific humidity                & humi         & \%              & T \\   \hline 
    717       Cloud cover                   &           & \%              & T \\   \hline 
    718       Total precipitation (liquid + solid)   & precip    & $Kg.m^{-2}.s^{-1}$ & T \\   \hline 
    719       Solid precipitation              & snow         & $Kg.m^{-2}.s^{-1}$ & T \\   \hline 
    720     \end{tabular} 
    721   \end{center} 
    722 \end{table} 
    723 %-------------------------------------------------------------------------------------------------------------- 
     719Its range must be between zero and one, and it is recommended to set it to 0 at low-resolution (ORCA2 configuration). 
    724720 
    725721As for the flux formulation, information about the input data required by the model is provided in 
    726 the namsbc\_blk\_core or namsbc\_blk\_clio namelist (see \autoref{subsec:SBC_fldread}).  
     722the namsbc\_blk namelist (see \autoref{subsec:SBC_fldread}). 
     723 
     724 
     725% ------------------------------------------------------------------------------------------------------------- 
     726%        Ocean-Atmosphere Bulk formulae 
     727% ------------------------------------------------------------------------------------------------------------- 
     728\subsection[Ocean-Atmosphere Bulk formulae (\textit{sbcblk\_algo\_coare.F90, sbcblk\_algo\_coare3p5.F90, 
     729sbcblk\_algo\_ecmwf.F90, sbcblk\_algo\_ncar.F90})] 
     730{Ocean-Atmosphere Bulk formulae (\mdl{sbcblk\_algo\_coare}, \mdl{sbcblk\_algo\_coare3p5}, 
     731\mdl{sbcblk\_algo\_ecmwf}, \mdl{sbcblk\_algo\_ncar})} 
     732\label{subsec:SBC_blk_ocean} 
     733 
     734Four different bulk algorithms are available to compute surface turbulent momentum and heat fluxes over the ocean. 
     735COARE 3.0, COARE 3.5 and ECMWF schemes mainly differ by their roughness lenghts computation and consequently 
     736their neutral transfer coefficients relationships with neutral wind. 
     737\begin{itemize} 
     738\item 
     739  NCAR (\np{ln\_NCAR}\forcode{=.true.}): 
     740  The NCAR bulk formulae have been developed by \citet{large.yeager_rpt04}. 
     741  They have been designed to handle the NCAR forcing, a mixture of NCEP reanalysis and satellite data. 
     742  They use an inertial dissipative method to compute the turbulent transfer coefficients 
     743  (momentum, sensible heat and evaporation) from the 10m wind speed, air temperature and specific humidity. 
     744  This \citet{large.yeager_rpt04} dataset is available through 
     745  the \href{http://nomads.gfdl.noaa.gov/nomads/forms/mom4/NCAR.html}{GFDL web site}. 
     746  Note that substituting ERA40 to NCEP reanalysis fields does not require changes in the bulk formulea themself. 
     747  This is the so-called DRAKKAR Forcing Set (DFS) \citep{brodeau.barnier.ea_OM10}. 
     748\item 
     749  COARE 3.0 (\np{ln\_COARE\_3p0}\forcode{=.true.}): 
     750  See \citet{fairall.bradley.ea_JC03} for more details 
     751\item 
     752  COARE 3.5 (\np{ln\_COARE\_3p5}\forcode{=.true.}): 
     753  See \citet{edson.jampana.ea_JPO13} for more details 
     754\item 
     755  ECMWF (\np{ln\_ECMWF}\forcode{=.true.}): 
     756  Based on \href{https://www.ecmwf.int/node/9221}{IFS (Cy31)} implementation and documentation. 
     757  Surface roughness lengths needed for the Obukhov length are computed following \citet{beljaars_QJRMS95}. 
     758\end{itemize} 
     759 
     760% ------------------------------------------------------------------------------------------------------------- 
     761%        Ice-Atmosphere Bulk formulae 
     762% ------------------------------------------------------------------------------------------------------------- 
     763\subsection{Ice-Atmosphere Bulk formulae} 
     764\label{subsec:SBC_blk_ice} 
     765 
     766Surface turbulent fluxes between sea-ice and the atmosphere can be computed in three different ways: 
     767 
     768\begin{itemize} 
     769\item 
     770  Constant value (\np{constant\ value}\forcode{ Cd_ice = 1.4e-3 }): 
     771  default constant value used for momentum and heat neutral transfer coefficients 
     772\item 
     773  \citet{lupkes.gryanik.ea_JGR12} (\np{ln\_Cd\_L12}\forcode{=.true.}): 
     774  This scheme adds a dependency on edges at leads, melt ponds and flows 
     775  of the constant neutral air-ice drag. After some approximations, 
     776  this can be resumed to a dependency on ice concentration (A). 
     777  This drag coefficient has a parabolic shape (as a function of ice concentration) 
     778  starting at 1.5e-3 for A=0, reaching 1.97e-3 for A=0.5 and going down 1.4e-3 for A=1. 
     779  It is theoretically applicable to all ice conditions (not only MIZ). 
     780\item 
     781  \citet{lupkes.gryanik_JGR15} (\np{ln\_Cd\_L15}\forcode{=.true.}): 
     782  Alternative turbulent transfer coefficients formulation between sea-ice 
     783  and atmosphere with distinct momentum and heat coefficients depending 
     784  on sea-ice concentration and atmospheric stability (no melt-ponds effect for now). 
     785  The parameterization is adapted from ECHAM6 atmospheric model. 
     786  Compared to Lupkes2012 scheme, it considers specific skin and form drags 
     787  to compute neutral transfer coefficients for both heat and momentum fluxes. 
     788  Atmospheric stability effect on transfer coefficient is also taken into account. 
     789\end{itemize} 
     790 
     791 
    727792 
    728793% ================================================================ 
    729794% Coupled formulation 
    730795% ================================================================ 
    731 \section{Coupled formulation (\protect\mdl{sbccpl})} 
     796\section[Coupled formulation (\textit{sbccpl.F90})] 
     797{Coupled formulation (\protect\mdl{sbccpl})} 
    732798\label{sec:SBC_cpl} 
    733799%------------------------------------------namsbc_cpl---------------------------------------------------- 
    734800 
    735 \nlst{namsbc_cpl}  
     801\begin{listing} 
     802  \nlst{namsbc_cpl} 
     803  \caption{\texttt{namsbc\_cpl}} 
     804  \label{lst:namsbc_cpl} 
     805\end{listing} 
    736806%------------------------------------------------------------------------------------------------------------- 
    737807 
    738808In the coupled formulation of the surface boundary condition, 
    739 the fluxes are provided by the OASIS coupler at a frequency which is defined in the OASIS coupler, 
     809the fluxes are provided by the OASIS coupler at a frequency which is defined in the OASIS coupler namelist, 
    740810while sea and ice surface temperature, ocean and ice albedo, and ocean currents are sent to 
    741811the atmospheric component. 
    742812 
    743813A generalised coupled interface has been developed. 
    744 It is currently interfaced with OASIS-3-MCT (\key{oasis3}). 
    745 It has been successfully used to interface \NEMO to most of the European atmospheric GCM 
     814It is currently interfaced with OASIS-3-MCT versions 1 to 4 (\key{oasis3}). 
     815An additional specific CPP key (\key{oa3mct\_v1v2}) is needed for OASIS-3-MCT versions 1 and 2. 
     816It has been successfully used to interface \NEMO\ to most of the European atmospheric GCM 
    746817(ARPEGE, ECHAM, ECMWF, HadAM, HadGAM, LMDz), as well as to \href{http://wrf-model.org/}{WRF} 
    747818(Weather Research and Forecasting Model). 
    748819 
    749 Note that in addition to the setting of \np{ln\_cpl} to true, the \key{coupled} have to be defined. 
    750 The CPP key is mainly used in sea-ice to ensure that the atmospheric fluxes are actually received by 
    751 the ice-ocean system (no calculation of ice sublimation in coupled mode). 
    752 When PISCES biogeochemical model (\key{top} and \key{pisces}) is also used in the coupled system,  
    753 the whole carbon cycle is computed by defining \key{cpl\_carbon\_cycle}. 
     820When PISCES biogeochemical model (\key{top}) is also used in the coupled system, 
     821the whole carbon cycle is computed. 
    754822In this case, CO$_2$ fluxes will be exchanged between the atmosphere and the ice-ocean system 
    755 (and need to be activated in \ngn{namsbc{\_}cpl} ). 
     823(and need to be activated in \nam{sbc\_cpl} ). 
    756824 
    757825The namelist above allows control of various aspects of the coupling fields (particularly for vectors) and 
    758826now allows for any coupling fields to have multiple sea ice categories (as required by LIM3 and CICE). 
    759 When indicating a multi-category coupling field in namsbc{\_}cpl the number of categories will be determined by 
     827When indicating a multi-category coupling field in \nam{sbc\_cpl}, the number of categories will be determined by 
    760828the number used in the sea ice model. 
    761 In some limited cases it may be possible to specify single category coupling fields even when 
     829In some limited cases, it may be possible to specify single category coupling fields even when 
    762830the sea ice model is running with multiple categories - 
    763 in this case the user should examine the code to be sure the assumptions made are satisfactory. 
    764 In cases where this is definitely not possible the model should abort with an error message. 
    765 The new code has been tested using ECHAM with LIM2, and HadGAM3 with CICE but 
    766 although it will compile with \key{lim3} additional minor code changes may be required to run using LIM3. 
     831in this case, the user should examine the code to be sure the assumptions made are satisfactory. 
     832In cases where this is definitely not possible, the model should abort with an error message. 
     833 
    767834 
    768835 
     
    770837%        Atmospheric pressure 
    771838% ================================================================ 
    772 \section{Atmospheric pressure (\protect\mdl{sbcapr})} 
     839\section[Atmospheric pressure (\textit{sbcapr.F90})] 
     840{Atmospheric pressure (\protect\mdl{sbcapr})} 
    773841\label{sec:SBC_apr} 
    774842%------------------------------------------namsbc_apr---------------------------------------------------- 
    775843 
    776 \nlst{namsbc_apr}  
     844\begin{listing} 
     845  \nlst{namsbc_apr} 
     846  \caption{\texttt{namsbc\_apr}} 
     847  \label{lst:namsbc_apr} 
     848\end{listing} 
    777849%------------------------------------------------------------------------------------------------------------- 
    778850 
    779851The optional atmospheric pressure can be used to force ocean and ice dynamics 
    780 (\np{ln\_apr\_dyn}\forcode{ = .true.}, \textit{\ngn{namsbc}} namelist). 
    781 The input atmospheric forcing defined via \np{sn\_apr} structure (\textit{namsbc\_apr} namelist) 
     852(\np{ln\_apr\_dyn}\forcode{=.true.}, \nam{sbc} namelist). 
     853The input atmospheric forcing defined via \np{sn\_apr} structure (\nam{sbc\_apr} namelist) 
    782854can be interpolated in time to the model time step, and even in space when the interpolation on-the-fly is used. 
    783855When used to force the dynamics, the atmospheric pressure is further transformed into 
     
    789861where $P_{atm}$ is the atmospheric pressure and $P_o$ a reference atmospheric pressure. 
    790862A value of $101,000~N/m^2$ is used unless \np{ln\_ref\_apr} is set to true. 
    791 In this case $P_o$ is set to the value of $P_{atm}$ averaged over the ocean domain, 
    792 \ie the mean value of $\eta_{ib}$ is kept to zero at all time step. 
     863In this case, $P_o$ is set to the value of $P_{atm}$ averaged over the ocean domain, 
     864\ie\ the mean value of $\eta_{ib}$ is kept to zero at all time steps. 
    793865 
    794866The gradient of $\eta_{ib}$ is added to the RHS of the ocean momentum equation (see \mdl{dynspg} for the ocean). 
    795867For sea-ice, the sea surface height, $\eta_m$, which is provided to the sea ice model is set to $\eta - \eta_{ib}$ 
    796868(see \mdl{sbcssr} module). 
    797 $\eta_{ib}$ can be set in the output. 
     869$\eta_{ib}$ can be written in the output. 
    798870This can simplify altimetry data and model comparison as 
    799871inverse barometer sea surface height is usually removed from these date prior to their distribution. 
    800872 
    801873When using time-splitting and BDY package for open boundaries conditions, 
    802 the equivalent inverse barometer sea surface height $\eta_{ib}$ can be added to BDY ssh data:  
     874the equivalent inverse barometer sea surface height $\eta_{ib}$ can be added to BDY ssh data: 
    803875\np{ln\_apr\_obc}  might be set to true. 
    804876 
     877 
     878 
    805879% ================================================================ 
    806880%        Surface Tides Forcing 
    807881% ================================================================ 
    808 \section{Surface tides (\protect\mdl{sbctide})} 
     882\section[Surface tides (\textit{sbctide.F90})] 
     883{Surface tides (\protect\mdl{sbctide})} 
    809884\label{sec:SBC_tide} 
    810885 
    811886%------------------------------------------nam_tide--------------------------------------- 
    812887 
    813 \nlst{nam_tide} 
     888\begin{listing} 
     889  \nlst{nam_tide} 
     890  \caption{\texttt{nam\_tide}} 
     891  \label{lst:nam_tide} 
     892\end{listing} 
    814893%----------------------------------------------------------------------------------------- 
    815894 
    816895The tidal forcing, generated by the gravity forces of the Earth-Moon and Earth-Sun sytems, 
    817 is activated if \np{ln\_tide} and \np{ln\_tide\_pot} are both set to \forcode{.true.} in \ngn{nam\_tide}. 
    818 This translates as an additional barotropic force in the momentum equations \ref{eq:PE_dyn} such that: 
     896is activated if \np{ln\_tide} and \np{ln\_tide\_pot} are both set to \forcode{.true.} in \nam{\_tide}. 
     897This translates as an additional barotropic force in the momentum \autoref{eq:MB_PE_dyn} such that: 
    819898\[ 
    820   % \label{eq:PE_dyn_tides} 
    821   \frac{\partial {\rm {\bf U}}_h }{\partial t}= ... 
     899  % \label{eq:SBC_PE_dyn_tides} 
     900  \frac{\partial {\mathrm {\mathbf U}}_h }{\partial t}= ... 
    822901  +g\nabla (\Pi_{eq} + \Pi_{sal}) 
    823902\] 
    824903where $\Pi_{eq}$ stands for the equilibrium tidal forcing and 
    825904$\Pi_{sal}$ is a self-attraction and loading term (SAL). 
    826   
     905 
    827906The equilibrium tidal forcing is expressed as a sum over a subset of 
    828907constituents chosen from the set of available tidal constituents 
    829 defined in file \rou{SBC/tide.h90} (this comprises the tidal 
     908defined in file \hf{SBC/tide} (this comprises the tidal 
    830909constituents \textit{M2, N2, 2N2, S2, K2, K1, O1, Q1, P1, M4, Mf, Mm, 
    831910  Msqm, Mtm, S1, MU2, NU2, L2}, and \textit{T2}). Individual 
    832911constituents are selected by including their names in the array 
    833 \np{clname} in \ngn{nam\_tide} (e.g., \np{clname(1) = 'M2', 
    834   clname(2)='S2'} to select solely the tidal consituents \textit{M2} 
     912\np{clname} in \nam{\_tide} (e.g., \np{clname}\forcode{(1)='M2', } 
     913\np{clname}\forcode{(2)='S2'} to select solely the tidal consituents \textit{M2} 
    835914and \textit{S2}). Optionally, when \np{ln\_tide\_ramp} is set to 
    836915\forcode{.true.}, the equilibrium tidal forcing can be ramped up 
     
    839918 
    840919The SAL term should in principle be computed online as it depends on 
    841 the model tidal prediction itself (see \citet{Arbic2004} for a 
     920the model tidal prediction itself (see \citet{arbic.garner.ea_DSR04} for a 
    842921discussion about the practical implementation of this term). 
    843922Nevertheless, the complex calculations involved would make this 
    844 computationally too expensive.  Here, two options are available: 
     923computationally too expensive. Here, two options are available: 
    845924$\Pi_{sal}$ generated by an external model can be read in 
    846 (\np{ln\_read\_load=.true.}), or a ``scalar approximation'' can be 
    847 used (\np{ln\_scal\_load=.true.}). In the latter case 
     925(\np{ln\_read\_load}\forcode{ =.true.}), or a ``scalar approximation'' can be 
     926used (\np{ln\_scal\_load}\forcode{ =.true.}). In the latter case 
    848927\[ 
    849928  \Pi_{sal} = \beta \eta, 
     
    854933\forcode{.false.} removes the SAL contribution. 
    855934 
     935 
     936 
    856937% ================================================================ 
    857938%        River runoffs 
    858939% ================================================================ 
    859 \section{River runoffs (\protect\mdl{sbcrnf})} 
     940\section[River runoffs (\textit{sbcrnf.F90})]{River runoffs (\protect\mdl{sbcrnf})} 
    860941\label{sec:SBC_rnf} 
    861942%------------------------------------------namsbc_rnf---------------------------------------------------- 
    862943 
    863 \nlst{namsbc_rnf}  
     944\begin{listing} 
     945  \nlst{namsbc_rnf} 
     946  \caption{\texttt{namsbc\_rnf}} 
     947  \label{lst:namsbc_rnf} 
     948\end{listing} 
    864949%------------------------------------------------------------------------------------------------------------- 
    865950 
    866 %River runoff generally enters the ocean at a nonzero depth rather than through the surface.  
     951%River runoff generally enters the ocean at a nonzero depth rather than through the surface. 
    867952%Many models, however, have traditionally inserted river runoff to the top model cell. 
    868 %This was the case in \NEMO prior to the version 3.3. The switch toward a input of runoff  
    869 %throughout a nonzero depth has been motivated by the numerical and physical problems  
    870 %that arise when the top grid cells are of the order of one meter. This situation is common in  
    871 %coastal modelling and becomes more and more often open ocean and climate modelling  
     953%This was the case in \NEMO\ prior to the version 3.3. The switch toward a input of runoff 
     954%throughout a nonzero depth has been motivated by the numerical and physical problems 
     955%that arise when the top grid cells are of the order of one meter. This situation is common in 
     956%coastal modelling and becomes more and more often open ocean and climate modelling 
    872957%\footnote{At least a top cells thickness of 1~meter and a 3 hours forcing frequency are 
    873 %required to properly represent the diurnal cycle \citep{Bernie_al_JC05}. see also \autoref{fig:SBC_dcy}.}. 
    874  
    875  
    876 %To do this we need to treat evaporation/precipitation fluxes and river runoff differently in the  
    877 %\mdl{tra\_sbc} module.  We decided to separate them throughout the code, so that the variable  
    878 %\textit{emp} represented solely evaporation minus precipitation fluxes, and a new 2d variable  
    879 %rnf was added which represents the volume flux of river runoff (in kg/m2s to remain consistent with  
    880 %emp).  This meant many uses of emp and emps needed to be changed, a list of all modules which use  
     958%required to properly represent the diurnal cycle \citep{bernie.woolnough.ea_JC05}. see also \autoref{fig:SBC_dcy}.}. 
     959 
     960 
     961%To do this we need to treat evaporation/precipitation fluxes and river runoff differently in the 
     962%\mdl{tra\_sbc} module.  We decided to separate them throughout the code, so that the variable 
     963%\textit{emp} represented solely evaporation minus precipitation fluxes, and a new 2d variable 
     964%rnf was added which represents the volume flux of river runoff (in kg/m2s to remain consistent with 
     965%emp).  This meant many uses of emp and emps needed to be changed, a list of all modules which use 
    881966%emp or emps and the changes made are below: 
    882967 
     
    885970River runoff generally enters the ocean at a nonzero depth rather than through the surface. 
    886971Many models, however, have traditionally inserted river runoff to the top model cell. 
    887 This was the case in \NEMO prior to the version 3.3, 
     972This was the case in \NEMO\ prior to the version 3.3, 
    888973and was combined with an option to increase vertical mixing near the river mouth. 
    889974 
    890975However, with this method numerical and physical problems arise when the top grid cells are of the order of one meter. 
    891 This situation is common in coastal modelling and is becoming more common in open ocean and climate modelling  
     976This situation is common in coastal modelling and is becoming more common in open ocean and climate modelling 
    892977\footnote{ 
    893978  At least a top cells thickness of 1~meter and a 3 hours forcing frequency are required to 
    894   properly represent the diurnal cycle \citep{Bernie_al_JC05}. 
     979  properly represent the diurnal cycle \citep{bernie.woolnough.ea_JC05}. 
    895980  see also \autoref{fig:SBC_dcy}.}. 
    896981 
     
    900985along with the depth (in metres) which the river should be added to. 
    901986 
    902 Namelist variables in \ngn{namsbc\_rnf}, \np{ln\_rnf\_depth}, \np{ln\_rnf\_sal} and 
     987Namelist variables in \nam{sbc\_rnf}, \np{ln\_rnf\_depth}, \np{ln\_rnf\_sal} and 
    903988\np{ln\_rnf\_temp} control whether the river attributes (depth, salinity and temperature) are read in and used. 
    904989If these are set as false the river is added to the surface box only, assumed to be fresh (0~psu), 
    905990and/or taken as surface temperature respectively. 
    906991 
    907 The runoff value and attributes are read in in sbcrnf.   
     992The runoff value and attributes are read in in sbcrnf. 
    908993For temperature -999 is taken as missing data and the river temperature is taken to 
    909994be the surface temperatue at the river point. 
    910 For the depth parameter a value of -1 means the river is added to the surface box only,  
    911 and a value of -999 means the river is added through the entire water column.  
     995For the depth parameter a value of -1 means the river is added to the surface box only, 
     996and a value of -999 means the river is added through the entire water column. 
    912997After being read in the temperature and salinity variables are multiplied by the amount of runoff 
    913998(converted into m/s) to give the heat and salt content of the river runoff. 
     
    9161001The variable \textit{h\_dep} is then calculated to be the depth (in metres) of 
    9171002the bottom of the lowest box the river water is being added to 
    918 (\ie the total depth that river water is being added to in the model). 
     1003(\ie\ the total depth that river water is being added to in the model). 
    9191004 
    9201005The mass/volume addition due to the river runoff is, at each relevant depth level, added to 
     
    9221007This increases the diffusion term in the vicinity of the river, thereby simulating a momentum flux. 
    9231008The sea surface height is calculated using the sum of the horizontal divergence terms, 
    924 and so the river runoff indirectly forces an increase in sea surface height.  
     1009and so the river runoff indirectly forces an increase in sea surface height. 
    9251010 
    9261011The \textit{hdivn} terms are used in the tracer advection modules to force vertical velocities. 
     
    9351020As such the volume of water does not change, but the water is diluted. 
    9361021 
    937 For the non-linear free surface case (\key{vvl}), no flux is allowed through the surface. 
     1022For the non-linear free surface case, no flux is allowed through the surface. 
    9381023Instead in the surface box (as well as water moving up from the boxes below) a volume of runoff water is added with 
    9391024no corresponding heat and salt addition and so as happens in the lower boxes there is a dilution effect. 
     
    9441029This is done in the same way for both vvl and non-vvl. 
    9451030The temperature and salinity are increased through the specified depth according to 
    946 the heat and salt content of the river.  
     1031the heat and salt content of the river. 
    9471032 
    9481033In the non-linear free surface case (vvl), 
     
    9531038 
    9541039It is also possible for runnoff to be specified as a negative value for modelling flow through straits, 
    955 \ie modelling the Baltic flow in and out of the North Sea. 
     1040\ie\ modelling the Baltic flow in and out of the North Sea. 
    9561041When the flow is out of the domain there is no change in temperature and salinity, 
    9571042regardless of the namelist options used, 
    958 as the ocean water leaving the domain removes heat and salt (at the same concentration) with it.  
    959  
    960  
    961 %\colorbox{yellow}{Nevertheless, Pb of vertical resolution and 3D input : increase vertical mixing near river mouths to mimic a 3D river  
     1043as the ocean water leaving the domain removes heat and salt (at the same concentration) with it. 
     1044 
     1045 
     1046%\colorbox{yellow}{Nevertheless, Pb of vertical resolution and 3D input : increase vertical mixing near river mouths to mimic a 3D river 
    9621047 
    9631048%All river runoff and emp fluxes are assumed to be fresh water (zero salinity) and at the same temperature as the sea surface.} 
     
    9711056%\gmcomment{  word doc of runoffs: 
    9721057% 
    973 %In the current \NEMO setup river runoff is added to emp fluxes, these are then applied at just the sea surface as a volume change (in the variable volume case this is a literal volume change, and in the linear free surface case the free surface is moved) and a salt flux due to the concentration/dilution effect.  There is also an option to increase vertical mixing near river mouths; this gives the effect of having a 3d river.  All river runoff and emp fluxes are assumed to be fresh water (zero salinity) and at the same temperature as the sea surface. 
    974 %Our aim was to code the option to specify the temperature and salinity of river runoff, (as well as the amount), along with the depth that the river water will affect.  This would make it possible to model low salinity outflow, such as the Baltic, and would allow the ocean temperature to be affected by river runoff.   
     1058%In the current \NEMO\ setup river runoff is added to emp fluxes, these are then applied at just the sea surface as a volume change (in the variable volume case this is a literal volume change, and in the linear free surface case the free surface is moved) and a salt flux due to the concentration/dilution effect.  There is also an option to increase vertical mixing near river mouths; this gives the effect of having a 3d river.  All river runoff and emp fluxes are assumed to be fresh water (zero salinity) and at the same temperature as the sea surface. 
     1059%Our aim was to code the option to specify the temperature and salinity of river runoff, (as well as the amount), along with the depth that the river water will affect.  This would make it possible to model low salinity outflow, such as the Baltic, and would allow the ocean temperature to be affected by river runoff. 
    9751060 
    9761061%The depth option makes it possible to have the river water affecting just the surface layer, throughout depth, or some specified point in between. 
     
    9781063%To do this we need to treat evaporation/precipitation fluxes and river runoff differently in the tra_sbc module.  We decided to separate them throughout the code, so that the variable emp represented solely evaporation minus precipitation fluxes, and a new 2d variable rnf was added which represents the volume flux of river runoff (in kg/m2s to remain consistent with emp).  This meant many uses of emp and emps needed to be changed, a list of all modules which use emp or emps and the changes made are below: 
    9791064 
    980 %} 
     1065 
     1066 
    9811067% ================================================================ 
    9821068%        Ice shelf melting 
    9831069% ================================================================ 
    984 \section{Ice shelf melting (\protect\mdl{sbcisf})} 
     1070\section[Ice shelf melting (\textit{sbcisf.F90})]{Ice shelf melting (\protect\mdl{sbcisf})} 
    9851071\label{sec:SBC_isf} 
    9861072%------------------------------------------namsbc_isf---------------------------------------------------- 
    9871073 
    988 \nlst{namsbc_isf} 
     1074\begin{listing} 
     1075  \nlst{namsbc_isf} 
     1076  \caption{\texttt{namsbc\_isf}} 
     1077  \label{lst:namsbc_isf} 
     1078\end{listing} 
    9891079%-------------------------------------------------------------------------------------------------------- 
    990 The namelist variable in \ngn{namsbc}, \np{nn\_isf}, controls the ice shelf representation. 
    991 Description and result of sensitivity test to \np{nn\_isf} are presented in \citet{Mathiot2017}.  
     1080 
     1081The namelist variable in \nam{sbc}, \np{nn\_isf}, controls the ice shelf representation. 
     1082Description and result of sensitivity test to \np{nn\_isf} are presented in \citet{mathiot.jenkins.ea_GMD17}. 
    9921083The different options are illustrated in \autoref{fig:SBC_isf}. 
    9931084 
    9941085\begin{description} 
    995 \item[\np{nn\_isf}\forcode{ = 1}]: 
    996   The ice shelf cavity is represented (\np{ln\_isfcav}\forcode{ = .true.} needed). 
     1086 
     1087  \item[\np{nn\_isf}\forcode{=1}]: 
     1088  The ice shelf cavity is represented (\np{ln\_isfcav}\forcode{=.true.} needed). 
    9971089  The fwf and heat flux are depending of the local water properties. 
     1090 
    9981091  Two different bulk formulae are available: 
    9991092 
    10001093   \begin{description} 
    1001    \item[\np{nn\_isfblk}\forcode{ = 1}]: 
     1094   \item[\np{nn\_isfblk}\forcode{=1}]: 
    10021095     The melt rate is based on a balance between the upward ocean heat flux and 
    1003      the latent heat flux at the ice shelf base. A complete description is available in \citet{Hunter2006}. 
    1004    \item[\np{nn\_isfblk}\forcode{ = 2}]: 
     1096     the latent heat flux at the ice shelf base. A complete description is available in \citet{hunter_rpt06}. 
     1097   \item[\np{nn\_isfblk}\forcode{=2}]: 
    10051098     The melt rate and the heat flux are based on a 3 equations formulation 
    1006      (a heat flux budget at the ice base, a salt flux budget at the ice base and a linearised freezing point temperature equation).  
    1007      A complete description is available in \citet{Jenkins1991}. 
     1099     (a heat flux budget at the ice base, a salt flux budget at the ice base and a linearised freezing point temperature equation). 
     1100     A complete description is available in \citet{jenkins_JGR91}. 
    10081101   \end{description} 
    10091102 
    1010      Temperature and salinity used to compute the melt are the average temperature in the top boundary layer \citet{Losch2008}.  
     1103     Temperature and salinity used to compute the melt are the average temperature in the top boundary layer \citet{losch_JGR08}. 
    10111104     Its thickness is defined by \np{rn\_hisf\_tbl}. 
    10121105     The fluxes and friction velocity are computed using the mean temperature, salinity and velocity in the the first \np{rn\_hisf\_tbl} m. 
     
    10161109     If \np{rn\_hisf\_tbl} smaller than top $e_{3}t$, the top boundary layer thickness is set to the top cell thickness.\\ 
    10171110 
    1018      Each melt bulk formula depends on a exchange coeficient ($\Gamma^{T,S}$) between the ocean and the ice.  
     1111     Each melt bulk formula depends on a exchange coeficient ($\Gamma^{T,S}$) between the ocean and the ice. 
    10191112     There are 3 different ways to compute the exchange coeficient: 
    10201113   \begin{description} 
    1021         \item[\np{nn\_gammablk}\forcode{ = 0}]: 
    1022      The salt and heat exchange coefficients are constant and defined by \np{rn\_gammas0} and \np{rn\_gammat0}.  
    1023 \[ 
    1024   % \label{eq:sbc_isf_gamma_iso} 
    1025 \gamma^{T} = \np{rn\_gammat0} 
    1026 \] 
    1027 \[ 
    1028 \gamma^{S} = \np{rn\_gammas0} 
    1029 \] 
     1114        \item[\np{nn\_gammablk}\forcode{=0}]: 
     1115     The salt and heat exchange coefficients are constant and defined by \np{rn\_gammas0} and \np{rn\_gammat0}. 
     1116     \begin{gather*} 
     1117       % \label{eq:SBC_isf_gamma_iso} 
     1118       \gamma^{T} = rn\_gammat0 \\ 
     1119       \gamma^{S} = rn\_gammas0 
     1120     \end{gather*} 
    10301121     This is the recommended formulation for ISOMIP. 
    1031    \item[\np{nn\_gammablk}\forcode{ = 1}]: 
     1122   \item[\np{nn\_gammablk}\forcode{=1}]: 
    10321123     The salt and heat exchange coefficients are velocity dependent and defined as 
    1033 \[ 
    1034 \gamma^{T} = \np{rn\_gammat0} \times u_{*}  
    1035 \] 
    1036 \[ 
    1037 \gamma^{S} = \np{rn\_gammas0} \times u_{*} 
    1038 \] 
     1124     \begin{gather*} 
     1125       \gamma^{T} = rn\_gammat0 \times u_{*} \\ 
     1126       \gamma^{S} = rn\_gammas0 \times u_{*} 
     1127     \end{gather*} 
    10391128     where $u_{*}$ is the friction velocity in the top boundary layer (ie first \np{rn\_hisf\_tbl} meters). 
    1040      See \citet{Jenkins2010} for all the details on this formulation. It is the recommended formulation for realistic application. 
    1041    \item[\np{nn\_gammablk}\forcode{ = 2}]: 
     1129     See \citet{jenkins.nicholls.ea_JPO10} for all the details on this formulation. It is the recommended formulation for realistic application. 
     1130   \item[\np{nn\_gammablk}\forcode{=2}]: 
    10421131     The salt and heat exchange coefficients are velocity and stability dependent and defined as: 
    10431132\[ 
    1044 \gamma^{T,S} = \frac{u_{*}}{\Gamma_{Turb} + \Gamma^{T,S}_{Mole}}  
     1133\gamma^{T,S} = \frac{u_{*}}{\Gamma_{Turb} + \Gamma^{T,S}_{Mole}} 
    10451134\] 
    10461135     where $u_{*}$ is the friction velocity in the top boundary layer (ie first \np{rn\_hisf\_tbl} meters), 
    10471136     $\Gamma_{Turb}$ the contribution of the ocean stability and 
    10481137     $\Gamma^{T,S}_{Mole}$ the contribution of the molecular diffusion. 
    1049      See \citet{Holland1999} for all the details on this formulation.  
    1050      This formulation has not been extensively tested in NEMO (not recommended). 
     1138     See \citet{holland.jenkins_JPO99} for all the details on this formulation. 
     1139     This formulation has not been extensively tested in \NEMO\ (not recommended). 
    10511140   \end{description} 
    1052  \item[\np{nn\_isf}\forcode{ = 2}]: 
     1141  \item[\np{nn\_isf}\forcode{=2}]: 
    10531142   The ice shelf cavity is not represented. 
    1054    The fwf and heat flux are computed using the \citet{Beckmann2003} parameterisation of isf melting. 
     1143   The fwf and heat flux are computed using the \citet{beckmann.goosse_OM03} parameterisation of isf melting. 
    10551144   The fluxes are distributed along the ice shelf edge between the depth of the average grounding line (GL) 
    10561145   (\np{sn\_depmax\_isf}) and the base of the ice shelf along the calving front 
    1057    (\np{sn\_depmin\_isf}) as in (\np{nn\_isf}\forcode{ = 3}). 
     1146   (\np{sn\_depmin\_isf}) as in (\np{nn\_isf}\forcode{=3}). 
    10581147   The effective melting length (\np{sn\_Leff\_isf}) is read from a file. 
    1059  \item[\np{nn\_isf}\forcode{ = 3}]: 
     1148  \item[\np{nn\_isf}\forcode{=3}]: 
    10601149   The ice shelf cavity is not represented. 
    10611150   The fwf (\np{sn\_rnfisf}) is prescribed and distributed along the ice shelf edge between 
     
    10631152   the base of the ice shelf along the calving front (\np{sn\_depmin\_isf}). 
    10641153   The heat flux ($Q_h$) is computed as $Q_h = fwf \times L_f$. 
    1065  \item[\np{nn\_isf}\forcode{ = 4}]: 
    1066    The ice shelf cavity is opened (\np{ln\_isfcav}\forcode{ = .true.} needed). 
     1154  \item[\np{nn\_isf}\forcode{=4}]: 
     1155   The ice shelf cavity is opened (\np{ln\_isfcav}\forcode{=.true.} needed). 
    10671156   However, the fwf is not computed but specified from file \np{sn\_fwfisf}). 
    10681157   The heat flux ($Q_h$) is computed as $Q_h = fwf \times L_f$. 
    1069    As in \np{nn\_isf}\forcode{ = 1}, the fluxes are spread over the top boundary layer thickness (\np{rn\_hisf\_tbl})\\ 
     1158   As in \np{nn\_isf}\forcode{=1}, the fluxes are spread over the top boundary layer thickness (\np{rn\_hisf\_tbl})\\ 
    10701159\end{description} 
    10711160 
    1072 $\bullet$ \np{nn\_isf}\forcode{ = 1} and \np{nn\_isf}\forcode{ = 2} compute a melt rate based on 
     1161$\bullet$ \np{nn\_isf}\forcode{=1} and \np{nn\_isf}\forcode{=2} compute a melt rate based on 
    10731162the water mass properties, ocean velocities and depth. 
    10741163This flux is thus highly dependent of the model resolution (horizontal and vertical), 
    10751164realism of the water masses onto the shelf ...\\ 
    10761165 
    1077 $\bullet$ \np{nn\_isf}\forcode{ = 3} and \np{nn\_isf}\forcode{ = 4} read the melt rate from a file. 
     1166$\bullet$ \np{nn\_isf}\forcode{=3} and \np{nn\_isf}\forcode{=4} read the melt rate from a file. 
    10781167You have total control of the fwf forcing. 
    10791168This can be useful if the water masses on the shelf are not realistic or 
    10801169the resolution (horizontal/vertical) are too coarse to have realistic melting or 
    1081 for studies where you need to control your heat and fw input.\\  
     1170for studies where you need to control your heat and fw input.\\ 
    10821171 
    10831172The ice shelf melt is implemented as a volume flux as for the runoff. 
     
    10881177%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    10891178\begin{figure}[!t] 
    1090   \begin{center} 
    1091     \includegraphics[width=0.8\textwidth]{Fig_SBC_isf} 
    1092     \caption{ 
    1093       \protect\label{fig:SBC_isf} 
    1094       Illustration the location where the fwf is injected and whether or not the fwf is interactif or not depending of \np{nn\_isf}. 
    1095     } 
    1096   \end{center} 
     1179  \centering 
     1180  \includegraphics[width=\textwidth]{Fig_SBC_isf} 
     1181  \caption[Ice shelf location and fresh water flux definition]{ 
     1182    Illustration of the location where the fwf is injected and 
     1183    whether or not the fwf is interactif or not depending of \protect\np{nn\_isf}.} 
     1184  \label{fig:SBC_isf} 
    10971185\end{figure} 
    10981186%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    10991187 
     1188 
     1189 
     1190% ================================================================ 
     1191%        Ice sheet coupling 
     1192% ================================================================ 
    11001193\section{Ice sheet coupling} 
    11011194\label{sec:SBC_iscpl} 
    11021195%------------------------------------------namsbc_iscpl---------------------------------------------------- 
    11031196 
    1104 \nlst{namsbc_iscpl} 
     1197\begin{listing} 
     1198  \nlst{namsbc_iscpl} 
     1199  \caption{\texttt{namsbc\_iscpl}} 
     1200  \label{lst:namsbc_iscpl} 
     1201\end{listing} 
    11051202%-------------------------------------------------------------------------------------------------------- 
     1203 
    11061204Ice sheet/ocean coupling is done through file exchange at the restart step. 
    11071205At each restart step: 
     1206 
    11081207\begin{description} 
    11091208\item[Step 1]: the ice sheet model send a new bathymetry and ice shelf draft netcdf file. 
    11101209\item[Step 2]: a new domcfg.nc file is built using the DOMAINcfg tools. 
    1111 \item[Step 3]: NEMO run for a specific period and output the average melt rate over the period. 
     1210\item[Step 3]: \NEMO\ run for a specific period and output the average melt rate over the period. 
    11121211\item[Step 4]: the ice sheet model run using the melt rate outputed in step 4. 
    11131212\item[Step 5]: go back to 1. 
    11141213\end{description} 
    11151214 
    1116 If \np{ln\_iscpl}\forcode{ = .true.}, the isf draft is assume to be different at each restart step with 
     1215If \np{ln\_iscpl}\forcode{=.true.}, the isf draft is assume to be different at each restart step with 
    11171216potentially some new wet/dry cells due to the ice sheet dynamics/thermodynamics. 
    11181217The wetting and drying scheme applied on the restart is very simple and described below for the 6 different possible cases: 
     1218 
    11191219\begin{description} 
    11201220\item[Thin a cell down]: 
     
    11261226  mask, T/S, U/V and ssh are set to 0. 
    11271227  Furthermore, U/V into the water column are modified to satisfy ($bt_b=bt_n$). 
    1128 \item[Wet a cell]:  
     1228\item[Wet a cell]: 
    11291229  mask is set to 1, T/S is extrapolated from neighbours, $ssh_n = ssh_b$ and U/V set to 0. 
    1130   If no neighbours, T/S is extrapolated from old top cell value.  
     1230  If no neighbours, T/S is extrapolated from old top cell value. 
    11311231  If no neighbours along i,j and k (both previous test failed), T/S/U/V/ssh and mask are set to 0. 
    11321232\item[Dry a column]: 
     
    11451245The default number is set up for the MISOMIP idealised experiments. 
    11461246This coupling procedure is able to take into account grounding line and calving front migration. 
    1147 However, it is a non-conservative processe.  
     1247However, it is a non-conservative processe. 
    11481248This could lead to a trend in heat/salt content and volume.\\ 
    11491249 
    11501250In order to remove the trend and keep the conservation level as close to 0 as possible, 
    1151 a simple conservation scheme is available with \np{ln\_hsb}\forcode{ = .true.}. 
     1251a simple conservation scheme is available with \np{ln\_hsb}\forcode{=.true.}. 
    11521252The heat/salt/vol. gain/loss is diagnosed, as well as the location. 
    1153 A correction increment is computed and apply each time step during the next \np{rn\_fiscpl} time steps.  
     1253A correction increment is computed and apply each time step during the next \np{rn\_fiscpl} time steps. 
    11541254For safety, it is advised to set \np{rn\_fiscpl} equal to the coupling period (smallest increment possible). 
    11551255The corrective increment is apply into the cell itself (if it is a wet cell), the neigbouring cells or the closest wet cell (if the cell is now dry). 
    11561256 
    1157 % 
     1257 
     1258 
    11581259% ================================================================ 
    11591260%        Handling of icebergs 
    11601261% ================================================================ 
    11611262\section{Handling of icebergs (ICB)} 
    1162 \label{sec:ICB_icebergs} 
     1263\label{sec:SBC_ICB_icebergs} 
    11631264%------------------------------------------namberg---------------------------------------------------- 
    11641265 
    1165 \nlst{namberg} 
     1266\begin{listing} 
     1267  \nlst{namberg} 
     1268  \caption{\texttt{namberg}} 
     1269  \label{lst:namberg} 
     1270\end{listing} 
    11661271%------------------------------------------------------------------------------------------------------------- 
    11671272 
    1168 Icebergs are modelled as lagrangian particles in NEMO \citep{Marsh_GMD2015}. 
    1169 Their physical behaviour is controlled by equations as described in \citet{Martin_Adcroft_OM10} ). 
    1170 (Note that the authors kindly provided a copy of their code to act as a basis for implementation in NEMO). 
     1273Icebergs are modelled as lagrangian particles in \NEMO\ \citep{marsh.ivchenko.ea_GMD15}. 
     1274Their physical behaviour is controlled by equations as described in \citet{martin.adcroft_OM10} ). 
     1275(Note that the authors kindly provided a copy of their code to act as a basis for implementation in \NEMO). 
    11711276Icebergs are initially spawned into one of ten classes which have specific mass and thickness as 
    1172 described in the \ngn{namberg} namelist: \np{rn\_initial\_mass} and \np{rn\_initial\_thickness}. 
     1277described in the \nam{berg} namelist: \np{rn\_initial\_mass} and \np{rn\_initial\_thickness}. 
    11731278Each class has an associated scaling (\np{rn\_mass\_scaling}), 
    11741279which is an integer representing how many icebergs of this class are being described as one lagrangian point 
    11751280(this reduces the numerical problem of tracking every single iceberg). 
    1176 They are enabled by setting \np{ln\_icebergs}\forcode{ = .true.}. 
     1281They are enabled by setting \np{ln\_icebergs}\forcode{=.true.}. 
    11771282 
    11781283Two initialisation schemes are possible. 
     
    11851290  \np{nn\_test\_icebergs} is defined by four numbers in \np{nn\_test\_box} representing the corners of 
    11861291  the geographical box: lonmin,lonmax,latmin,latmax 
    1187 \item[\np{nn\_test\_icebergs}\forcode{ = -1}] 
    1188   In this scheme the model reads a calving file supplied in the \np{sn\_icb} parameter. 
     1292\item[\np{nn\_test\_icebergs}\forcode{=-1}] 
     1293  In this scheme, the model reads a calving file supplied in the \np{sn\_icb} parameter. 
    11891294  This should be a file with a field on the configuration grid (typically ORCA) 
    11901295  representing ice accumulation rate at each model point. 
     
    11941299  At each time step, a test is performed to see if there is enough ice mass to 
    11951300  calve an iceberg of each class in order (1 to 10). 
    1196   Note that this is the initial mass multiplied by the number each particle represents (\ie the scaling). 
     1301  Note that this is the initial mass multiplied by the number each particle represents (\ie\ the scaling). 
    11971302  If there is enough ice, a new iceberg is spawned and the total available ice reduced accordingly. 
    11981303\end{description} 
     
    12031308or (if \np{rn\_bits\_erosion\_fraction}~$>$~0) into melt and additionally small ice bits 
    12041309which are assumed to propagate with their larger parent and thus delay fluxing into the ocean. 
    1205 Melt water (and other variables on the configuration grid) are written into the main NEMO model output files. 
     1310Melt water (and other variables on the configuration grid) are written into the main \NEMO\ model output files. 
    12061311 
    12071312Extensive diagnostics can be produced. 
     
    12241329since its trajectory data may be spread across multiple files. 
    12251330 
    1226 % ------------------------------------------------------------------------------------------------------------- 
     1331 
     1332 
     1333% ============================================================================================================= 
    12271334%        Interactions with waves (sbcwave.F90, ln_wave) 
    1228 % ------------------------------------------------------------------------------------------------------------- 
    1229 \section{Interactions with waves (\protect\mdl{sbcwave}, \protect\np{ln\_wave})} 
     1335% ============================================================================================================= 
     1336\section[Interactions with waves (\textit{sbcwave.F90}, \texttt{ln\_wave})]{Interactions with waves (\protect\mdl{sbcwave}, \protect\np{ln\_wave})} 
    12301337\label{sec:SBC_wave} 
    12311338%------------------------------------------namsbc_wave-------------------------------------------------------- 
    12321339 
    1233 \nlst{namsbc_wave} 
     1340\begin{listing} 
     1341  \nlst{namsbc_wave} 
     1342  \caption{\texttt{namsbc\_wave}} 
     1343  \label{lst:namsbc_wave} 
     1344\end{listing} 
    12341345%------------------------------------------------------------------------------------------------------------- 
    12351346 
    1236 Ocean waves represent the interface between the ocean and the atmosphere, so NEMO is extended to incorporate  
    1237 physical processes related to ocean surface waves, namely the surface stress modified by growth and  
    1238 dissipation of the oceanic wave field, the Stokes-Coriolis force and the Stokes drift impact on mass and  
    1239 tracer advection; moreover the neutral surface drag coefficient from a wave model can be used to evaluate  
     1347Ocean waves represent the interface between the ocean and the atmosphere, so \NEMO\ is extended to incorporate 
     1348physical processes related to ocean surface waves, namely the surface stress modified by growth and 
     1349dissipation of the oceanic wave field, the Stokes-Coriolis force and the Stokes drift impact on mass and 
     1350tracer advection; moreover the neutral surface drag coefficient from a wave model can be used to evaluate 
    12401351the wind stress. 
    12411352 
    1242 Physical processes related to ocean surface waves can be accounted by setting the logical variable  
    1243 \np{ln\_wave}\forcode{= .true.} in \ngn{namsbc} namelist. In addition, specific flags accounting for  
    1244 different porcesses should be activated as explained in the following sections. 
     1353Physical processes related to ocean surface waves can be accounted by setting the logical variable 
     1354\np{ln\_wave}\forcode{=.true.} in \nam{sbc} namelist. In addition, specific flags accounting for 
     1355different processes should be activated as explained in the following sections. 
    12451356 
    12461357Wave fields can be provided either in forced or coupled mode: 
    12471358\begin{description} 
    1248 \item[forced mode]: wave fields should be defined through the \ngn{namsbc\_wave} namelist  
    1249 for external data names, locations, frequency, interpolation and all the miscellanous options allowed by  
    1250 Input Data generic Interface (see \autoref{sec:SBC_input}).  
    1251 \item[coupled mode]: NEMO and an external wave model can be coupled by setting \np{ln\_cpl} \forcode{= .true.}  
    1252 in \ngn{namsbc} namelist and filling the \ngn{namsbc\_cpl} namelist. 
     1359\item[forced mode]: wave fields should be defined through the \nam{sbc\_wave} namelist 
     1360for external data names, locations, frequency, interpolation and all the miscellanous options allowed by 
     1361Input Data generic Interface (see \autoref{sec:SBC_input}). 
     1362\item[coupled mode]: \NEMO\ and an external wave model can be coupled by setting \np{ln\_cpl} \forcode{= .true.} 
     1363in \nam{sbc} namelist and filling the \nam{sbc\_cpl} namelist. 
    12531364\end{description} 
    12541365 
    12551366 
    1256 % ================================================================ 
     1367% ---------------------------------------------------------------- 
    12571368% Neutral drag coefficient from wave model (ln_cdgw) 
    12581369 
    1259 % ================================================================ 
    1260 \subsection{Neutral drag coefficient from wave model (\protect\np{ln\_cdgw})} 
     1370% ---------------------------------------------------------------- 
     1371\subsection[Neutral drag coefficient from wave model (\texttt{ln\_cdgw})]{Neutral drag coefficient from wave model (\protect\np{ln\_cdgw})} 
    12611372\label{subsec:SBC_wave_cdgw} 
    12621373 
    1263 The neutral surface drag coefficient provided from an external data source (\ie a wave model),  
    1264 can be used by setting the logical variable \np{ln\_cdgw} \forcode{= .true.} in \ngn{namsbc} namelist.  
    1265 Then using the routine \rou{turb\_ncar} and starting from the neutral drag coefficent provided,  
    1266 the drag coefficient is computed according to the stable/unstable conditions of the  
    1267 air-sea interface following \citet{Large_Yeager_Rep04}.  
    1268  
    1269  
    1270 % ================================================================ 
     1374The neutral surface drag coefficient provided from an external data source (\ie\ a wave model), 
     1375can be used by setting the logical variable \np{ln\_cdgw} \forcode{= .true.} in \nam{sbc} namelist. 
     1376Then using the routine \rou{sbcblk\_algo\_ncar} and starting from the neutral drag coefficent provided, 
     1377the drag coefficient is computed according to the stable/unstable conditions of the 
     1378air-sea interface following \citet{large.yeager_rpt04}. 
     1379 
     1380 
     1381% ---------------------------------------------------------------- 
    12711382% 3D Stokes Drift (ln_sdw, nn_sdrift) 
    1272 % ================================================================ 
    1273 \subsection{3D Stokes Drift (\protect\np{ln\_sdw, nn\_sdrift})} 
     1383% ---------------------------------------------------------------- 
     1384\subsection[3D Stokes Drift (\texttt{ln\_sdw}, \texttt{nn\_sdrift})]{3D Stokes Drift (\protect\np{ln\_sdw, nn\_sdrift})} 
    12741385\label{subsec:SBC_wave_sdw} 
    12751386 
    1276 The Stokes drift is a wave driven mechanism of mass and momentum transport \citep{Stokes_1847}.  
    1277 It is defined as the difference between the average velocity of a fluid parcel (Lagrangian velocity)  
    1278 and the current measured at a fixed point (Eulerian velocity).  
    1279 As waves travel, the water particles that make up the waves travel in orbital motions but  
    1280 without a closed path. Their movement is enhanced at the top of the orbit and slowed slightly  
    1281 at the bottom so the result is a net forward motion of water particles, referred to as the Stokes drift.  
    1282 An accurate evaluation of the Stokes drift and the inclusion of related processes may lead to improved  
    1283 representation of surface physics in ocean general circulation models. 
    1284 The Stokes drift velocity $\mathbf{U}_{st}$ in deep water can be computed from the wave spectrum and may be written as:  
     1387The Stokes drift is a wave driven mechanism of mass and momentum transport \citep{stokes_ibk09}. 
     1388It is defined as the difference between the average velocity of a fluid parcel (Lagrangian velocity) 
     1389and the current measured at a fixed point (Eulerian velocity). 
     1390As waves travel, the water particles that make up the waves travel in orbital motions but 
     1391without a closed path. Their movement is enhanced at the top of the orbit and slowed slightly 
     1392at the bottom, so the result is a net forward motion of water particles, referred to as the Stokes drift. 
     1393An accurate evaluation of the Stokes drift and the inclusion of related processes may lead to improved 
     1394representation of surface physics in ocean general circulation models. %GS: reference needed 
     1395The Stokes drift velocity $\mathbf{U}_{st}$ in deep water can be computed from the wave spectrum and may be written as: 
    12851396 
    12861397\[ 
    1287   % \label{eq:sbc_wave_sdw} 
     1398  % \label{eq:SBC_wave_sdw} 
    12881399  \mathbf{U}_{st} = \frac{16{\pi^3}} {g} 
    12891400  \int_0^\infty \int_{-\pi}^{\pi} (cos{\theta},sin{\theta}) {f^3} 
     
    12911402\] 
    12921403 
    1293 where: ${\theta}$ is the wave direction, $f$ is the wave intrinsic frequency,  
    1294 $\mathrm{S}($f$,\theta)$ is the 2D frequency-direction spectrum,  
    1295 $k$ is the mean wavenumber defined as:  
     1404where: ${\theta}$ is the wave direction, $f$ is the wave intrinsic frequency, 
     1405$\mathrm{S}($f$,\theta)$ is the 2D frequency-direction spectrum, 
     1406$k$ is the mean wavenumber defined as: 
    12961407$k=\frac{2\pi}{\lambda}$ (being $\lambda$ the wavelength). \\ 
    12971408 
    1298 In order to evaluate the Stokes drift in a realistic ocean wave field the wave spectral shape is required  
    1299 and its computation quickly becomes expensive as the 2D spectrum must be integrated for each vertical level.  
     1409In order to evaluate the Stokes drift in a realistic ocean wave field, the wave spectral shape is required 
     1410and its computation quickly becomes expensive as the 2D spectrum must be integrated for each vertical level. 
    13001411To simplify, it is customary to use approximations to the full Stokes profile. 
    1301 Three possible parameterizations for the calculation for the approximate Stokes drift velocity profile  
    1302 are included in the code through the \np{nn\_sdrift} parameter once provided the surface Stokes drift  
    1303 $\mathbf{U}_{st |_{z=0}}$ which is evaluated by an external wave model that accurately reproduces the wave spectra  
    1304 and makes possible the estimation of the surface Stokes drift for random directional waves in  
     1412Three possible parameterizations for the calculation for the approximate Stokes drift velocity profile 
     1413are included in the code through the \np{nn\_sdrift} parameter once provided the surface Stokes drift 
     1414$\mathbf{U}_{st |_{z=0}}$ which is evaluated by an external wave model that accurately reproduces the wave spectra 
     1415and makes possible the estimation of the surface Stokes drift for random directional waves in 
    13051416realistic wave conditions: 
    13061417 
    13071418\begin{description} 
    1308 \item[\np{nn\_sdrift} = 0]: exponential integral profile parameterization proposed by  
    1309 \citet{Breivik_al_JPO2014}: 
     1419\item[\np{nn\_sdrift} = 0]: exponential integral profile parameterization proposed by 
     1420\citet{breivik.janssen.ea_JPO14}: 
    13101421 
    13111422\[ 
    1312   % \label{eq:sbc_wave_sdw_0a} 
    1313   \mathbf{U}_{st} \cong \mathbf{U}_{st |_{z=0}} \frac{\mathrm{e}^{-2k_ez}} {1-8k_ez}  
     1423  % \label{eq:SBC_wave_sdw_0a} 
     1424  \mathbf{U}_{st} \cong \mathbf{U}_{st |_{z=0}} \frac{\mathrm{e}^{-2k_ez}} {1-8k_ez} 
    13141425\] 
    13151426 
     
    13171428 
    13181429\[ 
    1319   % \label{eq:sbc_wave_sdw_0b} 
     1430  % \label{eq:SBC_wave_sdw_0b} 
    13201431  k_e = \frac{|\mathbf{U}_{\left.st\right|_{z=0}}|} {|T_{st}|} 
    13211432  \quad \text{and }\ 
    1322   T_{st} = \frac{1}{16} \bar{\omega} H_s^2  
     1433  T_{st} = \frac{1}{16} \bar{\omega} H_s^2 
    13231434\] 
    13241435 
    13251436where $H_s$ is the significant wave height and $\omega$ is the wave frequency. 
    13261437 
    1327 \item[\np{nn\_sdrift} = 1]: velocity profile based on the Phillips spectrum which is considered to be a  
    1328 reasonable estimate of the part of the spectrum most contributing to the Stokes drift velocity near the surface 
    1329 \citep{Breivik_al_OM2016}: 
     1438\item[\np{nn\_sdrift} = 1]: velocity profile based on the Phillips spectrum which is considered to be a 
     1439reasonable estimate of the part of the spectrum mostly contributing to the Stokes drift velocity near the surface 
     1440\citep{breivik.bidlot.ea_OM16}: 
    13301441 
    13311442\[ 
    1332   % \label{eq:sbc_wave_sdw_1} 
     1443  % \label{eq:SBC_wave_sdw_1} 
    13331444  \mathbf{U}_{st} \cong \mathbf{U}_{st |_{z=0}} \Big[exp(2k_pz)-\beta \sqrt{-2 \pi k_pz} 
    13341445  \textit{ erf } \Big(\sqrt{-2 k_pz}\Big)\Big] 
     
    13371448where $erf$ is the complementary error function and $k_p$ is the peak wavenumber. 
    13381449 
    1339 \item[\np{nn\_sdrift} = 2]: velocity profile based on the Phillips spectrum as for \np{nn\_sdrift} = 1  
     1450\item[\np{nn\_sdrift} = 2]: velocity profile based on the Phillips spectrum as for \np{nn\_sdrift} = 1 
    13401451but using the wave frequency from a wave model. 
    13411452 
    13421453\end{description} 
    13431454 
    1344 The Stokes drift enters the wave-averaged momentum equation, as well as the tracer advection equations  
    1345 and its effect on the evolution of the sea-surface height ${\eta}$ is considered as follows:  
     1455The Stokes drift enters the wave-averaged momentum equation, as well as the tracer advection equations 
     1456and its effect on the evolution of the sea-surface height ${\eta}$ is considered as follows: 
    13461457 
    13471458\[ 
    1348   % \label{eq:sbc_wave_eta_sdw} 
     1459  % \label{eq:SBC_wave_eta_sdw} 
    13491460  \frac{\partial{\eta}}{\partial{t}} = 
    13501461  -\nabla_h \int_{-H}^{\eta} (\mathbf{U} + \mathbf{U}_{st}) dz 
    13511462\] 
    13521463 
    1353 The tracer advection equation is also modified in order for Eulerian ocean models to properly account  
    1354 for unresolved wave effect. The divergence of the wave tracer flux equals the mean tracer advection  
    1355 that is induced by the three-dimensional Stokes velocity.  
    1356 The advective equation for a tracer $c$ combining the effects of the mean current and sea surface waves  
    1357 can be formulated as follows:  
     1464The tracer advection equation is also modified in order for Eulerian ocean models to properly account 
     1465for unresolved wave effect. The divergence of the wave tracer flux equals the mean tracer advection 
     1466that is induced by the three-dimensional Stokes velocity. 
     1467The advective equation for a tracer $c$ combining the effects of the mean current and sea surface waves 
     1468can be formulated as follows: 
    13581469 
    13591470\[ 
    1360   % \label{eq:sbc_wave_tra_sdw} 
     1471  % \label{eq:SBC_wave_tra_sdw} 
    13611472  \frac{\partial{c}}{\partial{t}} = 
    13621473  - (\mathbf{U} + \mathbf{U}_{st}) \cdot \nabla{c} 
     
    13641475 
    13651476 
    1366 % ================================================================ 
     1477% ---------------------------------------------------------------- 
    13671478% Stokes-Coriolis term (ln_stcor) 
    1368 % ================================================================ 
    1369 \subsection{Stokes-Coriolis term (\protect\np{ln\_stcor})} 
     1479% ---------------------------------------------------------------- 
     1480\subsection[Stokes-Coriolis term (\texttt{ln\_stcor})]{Stokes-Coriolis term (\protect\np{ln\_stcor})} 
    13701481\label{subsec:SBC_wave_stcor} 
    13711482 
    1372 In a rotating ocean, waves exert a wave-induced stress on the mean ocean circulation which results  
    1373 in a force equal to $\mathbf{U}_{st}$×$f$, where $f$ is the Coriolis parameter.  
    1374 This additional force may have impact on the Ekman turning of the surface current.  
    1375 In order to include this term, once evaluated the Stokes drift (using one of the 3 possible  
    1376 approximations described in \autoref{subsec:SBC_wave_sdw}),  
    1377 \np{ln\_stcor}\forcode{ = .true.} has to be set. 
    1378  
    1379  
    1380 % ================================================================ 
     1483In a rotating ocean, waves exert a wave-induced stress on the mean ocean circulation which results 
     1484in a force equal to $\mathbf{U}_{st}$×$f$, where $f$ is the Coriolis parameter. 
     1485This additional force may have impact on the Ekman turning of the surface current. 
     1486In order to include this term, once evaluated the Stokes drift (using one of the 3 possible 
     1487approximations described in \autoref{subsec:SBC_wave_sdw}), 
     1488\np{ln\_stcor}\forcode{=.true.} has to be set. 
     1489 
     1490 
     1491% ---------------------------------------------------------------- 
    13811492% Waves modified stress (ln_tauwoc, ln_tauw) 
    1382 % ================================================================ 
    1383 \subsection{Wave modified sress (\protect\np{ln\_tauwoc, ln\_tauw})}  
     1493% ---------------------------------------------------------------- 
     1494\subsection[Wave modified stress (\texttt{ln\_tauwoc}, \texttt{ln\_tauw})]{Wave modified sress (\protect\np{ln\_tauwoc, ln\_tauw})} 
    13841495\label{subsec:SBC_wave_tauw} 
    13851496 
    1386 The surface stress felt by the ocean is the atmospheric stress minus the net stress going  
    1387 into the waves \citep{Janssen_al_TM13}. Therefore, when waves are growing, momentum and energy is spent and is not  
    1388 available for forcing the mean circulation, while in the opposite case of a decaying sea  
    1389 state more momentum is available for forcing the ocean.  
    1390 Only when the sea state is in equilibrium the ocean is forced by the atmospheric stress,  
    1391 but in practice an equilibrium sea state is a fairly rare event.  
    1392 So the atmospheric stress felt by the ocean circulation $\tau_{oc,a}$ can be expressed as:  
     1497The surface stress felt by the ocean is the atmospheric stress minus the net stress going 
     1498into the waves \citep{janssen.breivik.ea_rpt13}. Therefore, when waves are growing, momentum and energy is spent and is not 
     1499available for forcing the mean circulation, while in the opposite case of a decaying sea 
     1500state, more momentum is available for forcing the ocean. 
     1501Only when the sea state is in equilibrium, the ocean is forced by the atmospheric stress, 
     1502but in practice, an equilibrium sea state is a fairly rare event. 
     1503So the atmospheric stress felt by the ocean circulation $\tau_{oc,a}$ can be expressed as: 
    13931504 
    13941505\[ 
    1395   % \label{eq:sbc_wave_tauoc} 
     1506  % \label{eq:SBC_wave_tauoc} 
    13961507  \tau_{oc,a} = \tau_a - \tau_w 
    13971508\] 
     
    14011512 
    14021513\[ 
    1403   % \label{eq:sbc_wave_tauw} 
     1514  % \label{eq:SBC_wave_tauw} 
    14041515  \tau_w = \rho g \int {\frac{dk}{c_p} (S_{in}+S_{nl}+S_{diss})} 
    14051516\] 
    14061517 
    14071518where: $c_p$ is the phase speed of the gravity waves, 
    1408 $S_{in}$, $S_{nl}$ and $S_{diss}$ are three source terms that represent  
    1409 the physics of ocean waves. The first one, $S_{in}$, describes the generation  
    1410 of ocean waves by wind and therefore represents the momentum and energy transfer  
    1411 from air to ocean waves; the second term $S_{nl}$ denotes  
    1412 the nonlinear transfer by resonant four-wave interactions; while the third term $S_{diss}$  
    1413 describes the dissipation of waves by processes such as white-capping, large scale breaking  
     1519$S_{in}$, $S_{nl}$ and $S_{diss}$ are three source terms that represent 
     1520the physics of ocean waves. The first one, $S_{in}$, describes the generation 
     1521of ocean waves by wind and therefore represents the momentum and energy transfer 
     1522from air to ocean waves; the second term $S_{nl}$ denotes 
     1523the nonlinear transfer by resonant four-wave interactions; while the third term $S_{diss}$ 
     1524describes the dissipation of waves by processes such as white-capping, large scale breaking 
    14141525eddy-induced damping. 
    14151526 
    1416 The wave stress derived from an external wave model can be provided either through the normalized  
    1417 wave stress into the ocean by setting \np{ln\_tauwoc}\forcode{ = .true.}, or through the zonal and  
    1418 meridional stress components by setting \np{ln\_tauw}\forcode{ = .true.}. 
     1527The wave stress derived from an external wave model can be provided either through the normalized 
     1528wave stress into the ocean by setting \np{ln\_tauwoc}\forcode{=.true.}, or through the zonal and 
     1529meridional stress components by setting \np{ln\_tauw}\forcode{=.true.}. 
     1530 
    14191531 
    14201532 
     
    14251537\label{sec:SBC_misc} 
    14261538 
     1539 
    14271540% ------------------------------------------------------------------------------------------------------------- 
    14281541%        Diurnal cycle 
    14291542% ------------------------------------------------------------------------------------------------------------- 
    1430 \subsection{Diurnal cycle (\protect\mdl{sbcdcy})} 
     1543\subsection[Diurnal cycle (\textit{sbcdcy.F90})]{Diurnal cycle (\protect\mdl{sbcdcy})} 
    14311544\label{subsec:SBC_dcy} 
    1432 %------------------------------------------namsbc_rnf---------------------------------------------------- 
     1545%------------------------------------------namsbc------------------------------------------------------------- 
    14331546% 
    1434 \nlst{namsbc}  
     1547 
    14351548%------------------------------------------------------------------------------------------------------------- 
    14361549 
    14371550%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    14381551\begin{figure}[!t] 
    1439   \begin{center} 
    1440     \includegraphics[width=0.8\textwidth]{Fig_SBC_diurnal} 
    1441     \caption{ 
    1442       \protect\label{fig:SBC_diurnal} 
    1443       Example of recontruction of the diurnal cycle variation of short wave flux from daily mean values. 
    1444       The reconstructed diurnal cycle (black line) is chosen as 
    1445       the mean value of the analytical cycle (blue line) over a time step, 
    1446       not as the mid time step value of the analytically cycle (red square). 
    1447       From \citet{Bernie_al_CD07}. 
    1448     } 
    1449   \end{center} 
     1552  \centering 
     1553  \includegraphics[width=\textwidth]{Fig_SBC_diurnal} 
     1554  \caption[Reconstruction of the diurnal cycle variation of short wave flux]{ 
     1555    Example of reconstruction of the diurnal cycle variation of short wave flux from 
     1556    daily mean values. 
     1557    The reconstructed diurnal cycle (black line) is chosen as 
     1558    the mean value of the analytical cycle (blue line) over a time step, 
     1559    not as the mid time step value of the analytically cycle (red square). 
     1560    From \citet{bernie.guilyardi.ea_CD07}.} 
     1561  \label{fig:SBC_diurnal} 
    14501562\end{figure} 
    14511563%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    14521564 
    1453 \cite{Bernie_al_JC05} have shown that to capture 90$\%$ of the diurnal variability of SST requires a vertical resolution in upper ocean of 1~m or better and a temporal resolution of the surface fluxes of 3~h or less. 
    1454 Unfortunately high frequency forcing fields are rare, not to say inexistent. 
    1455 Nevertheless, it is possible to obtain a reasonable diurnal cycle of the SST knowning only short wave flux (SWF) at 
    1456 high frequency \citep{Bernie_al_CD07}. 
     1565\cite{bernie.woolnough.ea_JC05} have shown that to capture 90$\%$ of the diurnal variability of SST requires a vertical resolution in upper ocean of 1~m or better and a temporal resolution of the surface fluxes of 3~h or less. 
     1566%Unfortunately high frequency forcing fields are rare, not to say inexistent. GS: not true anymore ! 
     1567Nevertheless, it is possible to obtain a reasonable diurnal cycle of the SST knowning only short wave flux (SWF) at high frequency \citep{bernie.guilyardi.ea_CD07}. 
    14571568Furthermore, only the knowledge of daily mean value of SWF is needed, 
    14581569as higher frequency variations can be reconstructed from them, 
    14591570assuming that the diurnal cycle of SWF is a scaling of the top of the atmosphere diurnal cycle of incident SWF. 
    1460 The \cite{Bernie_al_CD07} reconstruction algorithm is available in \NEMO by 
    1461 setting \np{ln\_dm2dc}\forcode{ = .true.} (a \textit{\ngn{namsbc}} namelist variable) when 
    1462 using CORE bulk formulea (\np{ln\_blk\_core}\forcode{ = .true.}) or 
    1463 the flux formulation (\np{ln\_flx}\forcode{ = .true.}). 
     1571The \cite{bernie.guilyardi.ea_CD07} reconstruction algorithm is available in \NEMO\ by 
     1572setting \np{ln\_dm2dc}\forcode{=.true.} (a \textit{\nam{sbc}} namelist variable) when 
     1573using a bulk formulation (\np{ln\_blk}\forcode{=.true.}) or 
     1574the flux formulation (\np{ln\_flx}\forcode{=.true.}). 
    14641575The reconstruction is performed in the \mdl{sbcdcy} module. 
    1465 The detail of the algoritm used can be found in the appendix~A of \cite{Bernie_al_CD07}. 
    1466 The algorithm preserve the daily mean incoming SWF as the reconstructed SWF at 
     1576The detail of the algoritm used can be found in the appendix~A of \cite{bernie.guilyardi.ea_CD07}. 
     1577The algorithm preserves the daily mean incoming SWF as the reconstructed SWF at 
    14671578a given time step is the mean value of the analytical cycle over this time step (\autoref{fig:SBC_diurnal}). 
    14681579The use of diurnal cycle reconstruction requires the input SWF to be daily 
    1469 (\ie a frequency of 24 and a time interpolation set to true in \np{sn\_qsr} namelist parameter). 
    1470 Furthermore, it is recommended to have a least 8 surface module time step per day, 
     1580(\ie\ a frequency of 24 hours and a time interpolation set to true in \np{sn\_qsr} namelist parameter). 
     1581Furthermore, it is recommended to have a least 8 surface module time steps per day, 
    14711582that is  $\rdt \ nn\_fsbc < 10,800~s = 3~h$. 
    14721583An example of recontructed SWF is given in \autoref{fig:SBC_dcy} for a 12 reconstructed diurnal cycle, 
     
    14751586%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    14761587\begin{figure}[!t] 
    1477   \begin{center} 
    1478     \includegraphics[width=0.7\textwidth]{Fig_SBC_dcy} 
    1479     \caption{ 
    1480       \protect\label{fig:SBC_dcy} 
    1481       Example of recontruction of the diurnal cycle variation of short wave flux from 
    1482       daily mean values on an ORCA2 grid with a time sampling of 2~hours (from 1am to 11pm). 
    1483       The display is on (i,j) plane. 
    1484     } 
    1485   \end{center} 
     1588  \centering 
     1589  \includegraphics[width=\textwidth]{Fig_SBC_dcy} 
     1590  \caption[Reconstruction of the diurnal cycle variation of short wave flux on an ORCA2 grid]{ 
     1591    Example of reconstruction of the diurnal cycle variation of short wave flux from 
     1592    daily mean values on an ORCA2 grid with a time sampling of 2~hours (from 1am to 11pm). 
     1593    The display is on (i,j) plane.} 
     1594  \label{fig:SBC_dcy} 
    14861595\end{figure} 
    14871596%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    14911600an inconsistency between the scale of the vertical resolution and the forcing acting on that scale. 
    14921601 
     1602 
    14931603% ------------------------------------------------------------------------------------------------------------- 
    14941604%        Rotation of vector pairs onto the model grid directions 
     
    14971607\label{subsec:SBC_rotation} 
    14981608 
    1499 When using a flux (\np{ln\_flx}\forcode{ = .true.}) or 
    1500 bulk (\np{ln\_clio}\forcode{ = .true.} or \np{ln\_core}\forcode{ = .true.}) formulation, 
     1609When using a flux (\np{ln\_flx}\forcode{=.true.}) or bulk (\np{ln\_blk}\forcode{=.true.}) formulation, 
    15011610pairs of vector components can be rotated from east-north directions onto the local grid directions. 
    15021611This is particularly useful when interpolation on the fly is used since here any vectors are likely to 
    15031612be defined relative to a rectilinear grid. 
    1504 To activate this option a non-empty string is supplied in the rotation pair column of the relevant namelist. 
    1505 The eastward component must start with "U" and the northward component with "V".   
     1613To activate this option, a non-empty string is supplied in the rotation pair column of the relevant namelist. 
     1614The eastward component must start with "U" and the northward component with "V". 
    15061615The remaining characters in the strings are used to identify which pair of components go together. 
    15071616So for example, strings "U1" and "V1" next to "utau" and "vtau" would pair the wind stress components together and 
     
    15111620The rot\_rep routine from the \mdl{geo2ocean} module is used to perform the rotation. 
    15121621 
     1622 
    15131623% ------------------------------------------------------------------------------------------------------------- 
    15141624%        Surface restoring to observed SST and/or SSS 
    15151625% ------------------------------------------------------------------------------------------------------------- 
    1516 \subsection{Surface restoring to observed SST and/or SSS (\protect\mdl{sbcssr})} 
     1626\subsection[Surface restoring to observed SST and/or SSS (\textit{sbcssr.F90})]{Surface restoring to observed SST and/or SSS (\protect\mdl{sbcssr})} 
    15171627\label{subsec:SBC_ssr} 
    15181628%------------------------------------------namsbc_ssr---------------------------------------------------- 
    15191629 
    1520 \nlst{namsbc_ssr}  
     1630\begin{listing} 
     1631  \nlst{namsbc_ssr} 
     1632  \caption{\texttt{namsbc\_ssr}} 
     1633  \label{lst:namsbc_ssr} 
     1634\end{listing} 
    15211635%------------------------------------------------------------------------------------------------------------- 
    15221636 
    1523 IOptions are defined through the \ngn{namsbc\_ssr} namelist variables. 
    1524 On forced mode using a flux formulation (\np{ln\_flx}\forcode{ = .true.}), 
     1637Options are defined through the \nam{sbc\_ssr} namelist variables. 
     1638On forced mode using a flux formulation (\np{ln\_flx}\forcode{=.true.}), 
    15251639a feedback term \emph{must} be added to the surface heat flux $Q_{ns}^o$: 
    15261640\[ 
    1527   % \label{eq:sbc_dmp_q} 
     1641  % \label{eq:SBC_dmp_q} 
    15281642  Q_{ns} = Q_{ns}^o + \frac{dQ}{dT} \left( \left. T \right|_{k=1} - SST_{Obs} \right) 
    15291643\] 
     
    15311645$T$ is the model surface layer temperature and 
    15321646$\frac{dQ}{dT}$ is a negative feedback coefficient usually taken equal to $-40~W/m^2/K$. 
    1533 For a $50~m$ mixed-layer depth, this value corresponds to a relaxation time scale of two months.  
    1534 This term ensures that if $T$ perfectly matches the supplied SST, then $Q$ is equal to $Q_o$.  
     1647For a $50~m$ mixed-layer depth, this value corresponds to a relaxation time scale of two months. 
     1648This term ensures that if $T$ perfectly matches the supplied SST, then $Q$ is equal to $Q_o$. 
    15351649 
    15361650In the fresh water budget, a feedback term can also be added. 
     
    15381652 
    15391653\begin{equation} 
    1540   \label{eq:sbc_dmp_emp} 
     1654  \label{eq:SBC_dmp_emp} 
    15411655  \textit{emp} = \textit{emp}_o + \gamma_s^{-1} e_{3t}  \frac{  \left(\left.S\right|_{k=1}-SSS_{Obs}\right)} 
    15421656  {\left.S\right|_{k=1}} 
     
    15461660(observed, climatological or an atmospheric model product), 
    15471661\textit{SSS}$_{Obs}$ is a sea surface salinity 
    1548 (usually a time interpolation of the monthly mean Polar Hydrographic Climatology \citep{Steele2001}), 
     1662(usually a time interpolation of the monthly mean Polar Hydrographic Climatology \citep{steele.morley.ea_JC01}), 
    15491663$\left.S\right|_{k=1}$ is the model surface layer salinity and 
    15501664$\gamma_s$ is a negative feedback coefficient which is provided as a namelist parameter. 
    1551 Unlike heat flux, there is no physical justification for the feedback term in \autoref{eq:sbc_dmp_emp} as 
    1552 the atmosphere does not care about ocean surface salinity \citep{Madec1997}. 
     1665Unlike heat flux, there is no physical justification for the feedback term in \autoref{eq:SBC_dmp_emp} as 
     1666the atmosphere does not care about ocean surface salinity \citep{madec.delecluse_IWN97}. 
    15531667The SSS restoring term should be viewed as a flux correction on freshwater fluxes to 
    15541668reduce the uncertainties we have on the observed freshwater budget. 
    15551669 
     1670 
    15561671% ------------------------------------------------------------------------------------------------------------- 
    15571672%        Handling of ice-covered area 
     
    15621677The presence at the sea surface of an ice covered area modifies all the fluxes transmitted to the ocean. 
    15631678There are several way to handle sea-ice in the system depending on 
    1564 the value of the \np{nn\_ice} namelist parameter found in \ngn{namsbc} namelist. 
     1679the value of the \np{nn\_ice} namelist parameter found in \nam{sbc} namelist. 
    15651680\begin{description} 
    1566 \item[nn{\_}ice = 0] 
     1681\item[nn\_ice = 0] 
    15671682  there will never be sea-ice in the computational domain. 
    15681683  This is a typical namelist value used for tropical ocean domain. 
    15691684  The surface fluxes are simply specified for an ice-free ocean. 
    15701685  No specific things is done for sea-ice. 
    1571 \item[nn{\_}ice = 1] 
     1686\item[nn\_ice = 1] 
    15721687  sea-ice can exist in the computational domain, but no sea-ice model is used. 
    15731688  An observed ice covered area is read in a file. 
     
    15781693  This prevents deep convection to occur when trying to reach the freezing point 
    15791694  (and so ice covered area condition) while the SSS is too large. 
    1580   This manner of managing sea-ice area, just by using si IF case, 
     1695  This manner of managing sea-ice area, just by using a IF case, 
    15811696  is usually referred as the \textit{ice-if} model. 
    1582   It can be found in the \mdl{sbcice{\_}if} module. 
    1583 \item[nn{\_}ice = 2 or more] 
     1697  It can be found in the \mdl{sbcice\_if} module. 
     1698\item[nn\_ice = 2 or more] 
    15841699  A full sea ice model is used. 
    15851700  This model computes the ice-ocean fluxes, 
    15861701  that are combined with the air-sea fluxes using the ice fraction of each model cell to 
    1587   provide the surface ocean fluxes. 
    1588   Note that the activation of a sea-ice model is is done by defining a CPP key (\key{lim3} or \key{cice}). 
    1589   The activation automatically overwrites the read value of nn{\_}ice to its appropriate value 
    1590   (\ie $2$ for LIM-3 or $3$ for CICE). 
     1702  provide the surface averaged ocean fluxes. 
     1703  Note that the activation of a sea-ice model is done by defining a CPP key (\key{si3} or \key{cice}). 
     1704  The activation automatically overwrites the read value of nn\_ice to its appropriate value 
     1705  (\ie\ $2$ for SI3 or $3$ for CICE). 
    15911706\end{description} 
    15921707 
    15931708% {Description of Ice-ocean interface to be added here or in LIM 2 and 3 doc ?} 
    1594  
    1595 \subsection{Interface to CICE (\protect\mdl{sbcice\_cice})} 
     1709%GS: ocean-ice (SI3) interface is not located in SBC directory anymore, so it should be included in SI3 doc 
     1710 
     1711 
     1712% ------------------------------------------------------------------------------------------------------------- 
     1713%        CICE-ocean Interface 
     1714% ------------------------------------------------------------------------------------------------------------- 
     1715\subsection[Interface to CICE (\textit{sbcice\_cice.F90})]{Interface to CICE (\protect\mdl{sbcice\_cice})} 
    15961716\label{subsec:SBC_cice} 
    15971717 
    1598 It is now possible to couple a regional or global NEMO configuration (without AGRIF) 
     1718It is possible to couple a regional or global \NEMO\ configuration (without AGRIF) 
    15991719to the CICE sea-ice model by using \key{cice}. 
    16001720The CICE code can be obtained from \href{http://oceans11.lanl.gov/trac/CICE/}{LANL} and 
    16011721the additional 'hadgem3' drivers will be required, even with the latest code release. 
    1602 Input grid files consistent with those used in NEMO will also be needed, 
     1722Input grid files consistent with those used in \NEMO\ will also be needed, 
    16031723and CICE CPP keys \textbf{ORCA\_GRID}, \textbf{CICE\_IN\_NEMO} and \textbf{coupled} should be used 
    16041724(seek advice from UKMO if necessary). 
    1605 Currently the code is only designed to work when using the CORE forcing option for NEMO 
    1606 (with \textit{calc\_strair}\forcode{ = .true.} and \textit{calc\_Tsfc}\forcode{ = .true.} in the CICE name-list), 
    1607 or alternatively when NEMO is coupled to the HadGAM3 atmosphere model 
    1608 (with \textit{calc\_strair}\forcode{ = .false.} and \textit{calc\_Tsfc}\forcode{ = false}). 
     1725Currently, the code is only designed to work when using the NCAR forcing option for \NEMO\ %GS: still true ? 
     1726(with \textit{calc\_strair}\forcode{=.true.} and \textit{calc\_Tsfc}\forcode{=.true.} in the CICE name-list), 
     1727or alternatively when \NEMO\ is coupled to the HadGAM3 atmosphere model 
     1728(with \textit{calc\_strair}\forcode{=.false.} and \textit{calc\_Tsfc}\forcode{=false}). 
    16091729The code is intended to be used with \np{nn\_fsbc} set to 1 
    16101730(although coupling ocean and ice less frequently should work, 
     
    16121732the user should check that results are not significantly different to the standard case). 
    16131733 
    1614 There are two options for the technical coupling between NEMO and CICE. 
     1734There are two options for the technical coupling between \NEMO\ and CICE. 
    16151735The standard version allows complete flexibility for the domain decompositions in the individual models, 
    16161736but this is at the expense of global gather and scatter operations in the coupling which 
    16171737become very expensive on larger numbers of processors. 
    1618 The alternative option (using \key{nemocice\_decomp} for both NEMO and CICE) ensures that 
     1738The alternative option (using \key{nemocice\_decomp} for both \NEMO\ and CICE) ensures that 
    16191739the domain decomposition is identical in both models (provided domain parameters are set appropriately, 
    16201740and \textit{processor\_shape~=~square-ice} and \textit{distribution\_wght~=~block} in the CICE name-list) and 
     
    16231743there is no sea ice. 
    16241744 
    1625 % ------------------------------------------------------------------------------------------------------------- 
    1626 %        Freshwater budget control  
    1627 % ------------------------------------------------------------------------------------------------------------- 
    1628 \subsection{Freshwater budget control (\protect\mdl{sbcfwb})} 
     1745 
     1746% ------------------------------------------------------------------------------------------------------------- 
     1747%        Freshwater budget control 
     1748% ------------------------------------------------------------------------------------------------------------- 
     1749\subsection[Freshwater budget control (\textit{sbcfwb.F90})]{Freshwater budget control (\protect\mdl{sbcfwb})} 
    16291750\label{subsec:SBC_fwb} 
    16301751 
    1631 For global ocean simulation it can be useful to introduce a control of the mean sea level in order to 
     1752For global ocean simulation, it can be useful to introduce a control of the mean sea level in order to 
    16321753prevent unrealistic drift of the sea surface height due to inaccuracy in the freshwater fluxes. 
    1633 In \NEMO, two way of controlling the the freshwater budget.  
     1754In \NEMO, two way of controlling the freshwater budget are proposed: 
     1755 
    16341756\begin{description} 
    1635 \item[\np{nn\_fwb}\forcode{ = 0}] 
     1757\item[\np{nn\_fwb}\forcode{=0}] 
    16361758  no control at all. 
    16371759  The mean sea level is free to drift, and will certainly do so. 
    1638 \item[\np{nn\_fwb}\forcode{ = 1}] 
    1639   global mean \textit{emp} set to zero at each model time step.  
    1640 %Note that with a sea-ice model, this technique only control the mean sea level with linear free surface (\key{vvl} not defined) and no mass flux between ocean and ice (as it is implemented in the current ice-ocean coupling).  
    1641 \item[\np{nn\_fwb}\forcode{ = 2}] 
     1760\item[\np{nn\_fwb}\forcode{=1}] 
     1761  global mean \textit{emp} set to zero at each model time step. 
     1762  %GS: comment below still relevant ? 
     1763  %Note that with a sea-ice model, this technique only controls the mean sea level with linear free surface and no mass flux between ocean and ice (as it is implemented in the current ice-ocean coupling). 
     1764\item[\np{nn\_fwb}\forcode{=2}] 
    16421765  freshwater budget is adjusted from the previous year annual mean budget which 
    16431766  is read in the \textit{EMPave\_old.dat} file. 
    16441767  As the model uses the Boussinesq approximation, the annual mean fresh water budget is simply evaluated from 
    1645   the change in the mean sea level at January the first and saved in the \textit{EMPav.dat} file.  
     1768  the change in the mean sea level at January the first and saved in the \textit{EMPav.dat} file. 
    16461769\end{description} 
    16471770 
    1648  
    1649  
    16501771% Griffies doc: 
    1651 % When running ocean-ice simulations, we are not explicitly representing land processes,  
    1652 % such as rivers, catchment areas, snow accumulation, etc. However, to reduce model drift,  
    1653 % it is important to balance the hydrological cycle in ocean-ice models.  
    1654 % We thus need to prescribe some form of global normalization to the precipitation minus evaporation plus river runoff.  
    1655 % The result of the normalization should be a global integrated zero net water input to the ocean-ice system over  
    1656 % a chosen time scale.  
    1657 %How often the normalization is done is a matter of choice. In mom4p1, we choose to do so at each model time step,  
    1658 % so that there is always a zero net input of water to the ocean-ice system.  
    1659 % Others choose to normalize over an annual cycle, in which case the net imbalance over an annual cycle is used  
    1660 % to alter the subsequent year�s water budget in an attempt to damp the annual water imbalance.  
    1661 % Note that the annual budget approach may be inappropriate with interannually varying precipitation forcing.  
    1662 % When running ocean-ice coupled models, it is incorrect to include the water transport between the ocean  
    1663 % and ice models when aiming to balance the hydrological cycle.  
    1664 % The reason is that it is the sum of the water in the ocean plus ice that should be balanced when running ocean-ice models,  
    1665 % not the water in any one sub-component. As an extreme example to illustrate the issue,  
    1666 % consider an ocean-ice model with zero initial sea ice. As the ocean-ice model spins up,  
    1667 % there should be a net accumulation of water in the growing sea ice, and thus a net loss of water from the ocean.  
    1668 % The total water contained in the ocean plus ice system is constant, but there is an exchange of water between  
    1669 % the subcomponents. This exchange should not be part of the normalization used to balance the hydrological cycle  
    1670 % in ocean-ice models.  
     1772% When running ocean-ice simulations, we are not explicitly representing land processes, 
     1773% such as rivers, catchment areas, snow accumulation, etc. However, to reduce model drift, 
     1774% it is important to balance the hydrological cycle in ocean-ice models. 
     1775% We thus need to prescribe some form of global normalization to the precipitation minus evaporation plus river runoff. 
     1776% The result of the normalization should be a global integrated zero net water input to the ocean-ice system over 
     1777% a chosen time scale. 
     1778% How often the normalization is done is a matter of choice. In mom4p1, we choose to do so at each model time step, 
     1779% so that there is always a zero net input of water to the ocean-ice system. 
     1780% Others choose to normalize over an annual cycle, in which case the net imbalance over an annual cycle is used 
     1781% to alter the subsequent year�s water budget in an attempt to damp the annual water imbalance. 
     1782% Note that the annual budget approach may be inappropriate with interannually varying precipitation forcing. 
     1783% When running ocean-ice coupled models, it is incorrect to include the water transport between the ocean 
     1784% and ice models when aiming to balance the hydrological cycle. 
     1785% The reason is that it is the sum of the water in the ocean plus ice that should be balanced when running ocean-ice models, 
     1786% not the water in any one sub-component. As an extreme example to illustrate the issue, 
     1787% consider an ocean-ice model with zero initial sea ice. As the ocean-ice model spins up, 
     1788% there should be a net accumulation of water in the growing sea ice, and thus a net loss of water from the ocean. 
     1789% The total water contained in the ocean plus ice system is constant, but there is an exchange of water between 
     1790% the subcomponents. This exchange should not be part of the normalization used to balance the hydrological cycle 
     1791% in ocean-ice models. 
     1792 
    16711793 
    16721794\biblio 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_STO.tex

    r10442 r11564  
    88\label{chap:STO} 
    99 
    10 Authors: P.-A. Bouttier 
    11  
    12 \minitoc 
     10\chaptertoc 
     11 
     12% \vfill 
     13% \begin{figure}[b] 
     14% \subsubsection*{Changes record} 
     15% \begin{tabular}{l||l|m{0.65\linewidth}} 
     16%    Release   & Author        & Modifications \\ 
     17%    {\em 4.0.1} & {\em C. Levy} & {\em 4.0.1 update}  \\ 
     18%    {\em 3.6} & {\em P.-A. Bouttier} & {\em initial version}  \\ 
     19% \end{tabular} 
     20% \end{figure} 
     21 
     22Authors: \\ 
     23C. Levy release 4.0.1 update \\ 
     24P.-A. Bouttier release 3.6 inital version 
    1325 
    1426\newpage 
    1527 
    16 The stochastic parametrization module aims to explicitly simulate uncertainties in the model. 
    17 More particularly, \cite{Brankart_OM2013} has shown that, 
    18 because of the nonlinearity of the seawater equation of state, unresolved scales represent a major source of 
    19 uncertainties in the computation of the large scale horizontal density gradient (from T/S large scale fields), 
    20 and that the impact of these uncertainties can be simulated by 
    21 random processes representing unresolved T/S fluctuations. 
    22  
    23 The stochastic formulation of the equation of state can be written as: 
     28As a result of the nonlinearity of the seawater equation of state, unresolved scales represent a major source of uncertainties in the computation of the large-scale horizontal density gradient from the large-scale temperature and salinity fields. Following  \cite{brankart_OM13}, the impact of these uncertainties can be simulated by random processes representing unresolved T/S fluctuations. The Stochastic Parametrization of EOS (STO) module implements this parametrization. 
     29 
     30As detailed in \cite{brankart_OM13}, the stochastic formulation of the equation of state can be written as: 
    2431\begin{equation} 
    25   \label{eq:eos_sto} 
     32  \label{eq:STO_eos_sto} 
    2633  \rho = \frac{1}{2} \sum_{i=1}^m\{ \rho[T+\Delta T_i,S+\Delta S_i,p_o(z)] + \rho[T-\Delta T_i,S-\Delta S_i,p_o(z)] \} 
    2734\end{equation} 
    2835where $p_o(z)$ is the reference pressure depending on the depth and, 
    29 $\Delta T_i$ and $\Delta S_i$ are a set of T/S perturbations defined as 
     36$\Delta T_i$ and $\Delta S_i$ (i=1,m) is a set of T/S perturbations defined as 
    3037the scalar product of the respective local T/S gradients with random walks $\mathbf{\xi}$: 
    3138\begin{equation} 
    32   \label{eq:sto_pert} 
     39  \label{eq:STO_sto_pert} 
    3340  \Delta T_i = \mathbf{\xi}_i \cdot \nabla T \qquad \hbox{and} \qquad \Delta S_i = \mathbf{\xi}_i \cdot \nabla S 
    3441\end{equation} 
    35 $\mathbf{\xi}_i$ are produced by a first-order autoregressive processes (AR-1) with 
     42$\mathbf{\xi}_i$ are produced by a first-order autoregressive process (AR-1) with 
    3643a parametrized decorrelation time scale, and horizontal and vertical standard deviations $\sigma_s$. 
    3744$\mathbf{\xi}$ are uncorrelated over the horizontal and fully correlated along the vertical. 
     
    4148\label{sec:STO_the_details} 
    4249 
    43 The starting point of our implementation of stochastic parameterizations in NEMO is to observe that 
    44 many existing parameterizations are based on autoregressive processes, 
     50There are many existing parameterizations based on autoregressive processes, 
    4551which are used as a basic source of randomness to transform a deterministic model into a probabilistic model. 
    46 A generic approach is thus to add one single new module in NEMO, 
    47 generating processes with appropriate statistics to simulate each kind of uncertainty in the model 
    48 (see \cite{Brankart_al_GMD2015} for more details). 
    49  
    50 In practice, at every model grid point, 
     52The generic approach here is to a new STO module, 
     53generating processes features with appropriate statistics to simulate these uncertainties in the model 
     54(see \cite{brankart.candille.ea_GMD15} for more details). 
     55 
     56In practice, at each model grid point, 
    5157independent Gaussian autoregressive processes~$\xi^{(i)},\,i=1,\ldots,m$ are first generated using 
    5258the same basic equation: 
    5359 
    5460\begin{equation} 
    55   \label{eq:autoreg} 
     61  \label{eq:STO_autoreg} 
    5662  \xi^{(i)}_{k+1} = a^{(i)} \xi^{(i)}_k + b^{(i)} w^{(i)} + c^{(i)} 
    5763\end{equation} 
     
    6874 
    6975  \[ 
    70     % \label{eq:ord1} 
     76    % \label{eq:STO_ord1} 
    7177    \left\{ 
    7278      \begin{array}{l} 
     
    8591 
    8692  \begin{equation} 
    87     \label{eq:ord2} 
     93    \label{eq:STO_ord2} 
    8894    \left\{ 
    8995      \begin{array}{l} 
     
    101107\noindent 
    102108In this way, higher order processes can be easily generated recursively using the same piece of code implementing 
    103 (\autoref{eq:autoreg}), and using succesively processes from order $0$ to~$n-1$ as~$w^{(i)}$. 
    104 The parameters in (\autoref{eq:ord2}) are computed so that this recursive application of 
    105 (\autoref{eq:autoreg}) leads to processes with the required standard deviation and correlation timescale, 
     109\autoref{eq:STO_autoreg}, and using successive processes from order $0$ to~$n-1$ as~$w^{(i)}$. 
     110The parameters in \autoref{eq:STO_ord2} are computed so that this recursive application of 
     111\autoref{eq:STO_autoreg} leads to processes with the required standard deviation and correlation timescale, 
    106112with the additional condition that the $n-1$ first derivatives of the autocorrelation function are equal to 
    107 zero at~$t=0$, so that the resulting processes become smoother and smoother as $n$ is increased. 
     113zero at~$t=0$, so that the resulting processes become smoother and smoother as $n$ increases. 
    108114 
    109115Overall, this method provides quite a simple and generic way of generating a wide class of stochastic processes. 
    110116However, this also means that new model parameters are needed to specify each of these stochastic processes. 
    111 As in any parameterization of lacking physics, a very important issues then to tune these new parameters using 
     117As in any parameterization, the main issue is to tune the parameters using 
    112118either first principles, model simulations, or real-world observations. 
     119The parameters are set by default as described in \cite{brankart_OM13}, which has been shown in the paper 
     120to give good results for a global low resolution (2°) \NEMO\ configuration. where this parametrization produces a major effect on the average large-scale circulation, especilally in regions of intense mesoscale activity. 
     121The set of parameters will need further investigation to find appropriate values 
     122for any other configuration or resolution of the model. 
    113123 
    114124\section{Implementation details} 
    115125\label{sec:STO_thech_details} 
    116126 
    117 %---------------------------------------namsbc-------------------------------------------------- 
    118  
    119 \nlst{namsto} 
    120 %-------------------------------------------------------------------------------------------------------------- 
    121  
    122 The computer code implementing stochastic parametrisations can be found in the STO directory. 
    123 It involves three modules :  
    124 \begin{description} 
    125 \item[\mdl{stopar}:] 
    126   define the Stochastic parameters and their time evolution. 
    127 \item[\mdl{storng}:] 
    128   a random number generator based on (and includes) the 64-bit KISS (Keep It Simple Stupid) random number generator 
    129   distributed by George Marsaglia 
    130   (see \href{https://groups.google.com/forum/#!searchin/comp.lang.fortran/64-bit$20KISS$20RNGs}{here}) 
    131 \item[\mdl{stopts}:] 
    132   stochastic parametrisation associated with the non-linearity of the equation of seawater, 
    133   implementing \autoref{eq:sto_pert} and specific piece of code in 
    134   the equation of state implementing \autoref{eq:eos_sto}. 
    135 \end{description} 
    136  
    137 The \mdl{stopar} module has 3 public routines to be called by the model (in our case, NEMO): 
    138  
    139 The first routine (\rou{sto\_par}) is a direct implementation of (\autoref{eq:autoreg}), 
     127 
     128The code implementing stochastic parametrisation is located in the src/OCE/STO directory. 
     129It contains three modules : 
     130% \begin{description} 
     131 
     132\mdl{stopar} : define the Stochastic parameters and their time evolution 
     133 
     134\mdl{storng} : random number generator based on and including the 64-bit KISS (Keep It Simple Stupid) random number generator distributed by George Marsaglia 
     135 
     136\mdl{stopts} : stochastic parametrisation associated with the non-linearity of the equation of 
     137 seawater, implementing \autoref{eq:STO_sto_pert} so as specifics in the equation of state 
     138 implementing \autoref{eq:STO_eos_sto}. 
     139% \end{description} 
     140 
     141The \mdl{stopar} module includes three public routines called in the model: 
     142 
     143(\rou{sto\_par}) is a direct implementation of \autoref{eq:STO_autoreg}, 
    140144applied at each model grid point (in 2D or 3D), and called at each model time step ($k$) to 
    141145update every autoregressive process ($i=1,\ldots,m$). 
     
    143147to introduce a spatial correlation between the stochastic processes. 
    144148 
    145 The second routine (\rou{sto\_par\_init}) is an initialization routine mainly dedicated to 
    146 the computation of parameters $a^{(i)}, b^{(i)}, c^{(i)}$ for each autoregressive process, 
     149(\rou{sto\_par\_init}) is the initialization routine computing 
     150the values $a^{(i)}, b^{(i)}, c^{(i)}$ for each autoregressive process, 
    147151as a function of the statistical properties required by the model user 
    148 (mean, standard deviation, time correlation, order of the process,\ldots).  
    149  
    150 Parameters for the processes can be specified through the following \ngn{namsto} namelist parameters: 
     152(mean, standard deviation, time correlation, order of the process,\ldots). 
     153This routine also includes the initialization (seeding) of the random number generator. 
     154 
     155(\rou{sto\_rst\_write}) writes a restart file 
     156(which suffix name is given by \np{cn\_storst\_out} namelist parameter) containing the current value of 
     157all autoregressive processes to allow creating the file needed for a restart. 
     158This restart file also contains the current state of the random number generator. 
     159When \np{ln\_rststo} is set to \forcode{.true.}), 
     160the restart file (which suffix name is given by \np{cn\_storst\_in} namelist parameter) is read by 
     161the initialization routine (\rou{sto\_par\_init}). 
     162The simulation will continue exactly as if it was not interrupted only 
     163when \np{ln\_rstseed} is set to \forcode{.true.}, 
     164\ie\ when the state of the random number generator is read in the restart file.\\ 
     165 
     166The implementation includes the basics for a few possible stochastic parametrisations including equation of state, 
     167lateral diffusion, horizontal pressure gradient, ice strength, trend, tracers dynamics. 
     168As for this release, only the stochastic parametrisation of equation of state is fully available and tested. \\ 
     169 
     170Options and parameters \\ 
     171 
     172The \np{ln\_sto\_eos} namelist variable activates stochastic parametrisation of equation of state. 
     173By default it set to \forcode{.false.}) and not active. 
     174The set of parameters is available in \nam{sto} namelist 
     175(only the subset for equation of state stochastic parametrisation is listed below): 
     176%---------------------------------------namsto-------------------------------------------------- 
     177 
     178\begin{listing} 
     179  \nlst{namsto} 
     180  \caption{\texttt{namsto}} 
     181  \label{lst:namsto} 
     182\end{listing} 
     183%-------------------------------------------------------------------------------------------------------------- 
     184 
     185The variables of stochastic paramtetrisation itself (based on the global 2° experiments as in \cite{brankart_OM13} are: 
     186 
    151187\begin{description} 
    152188\item[\np{nn\_sto\_eos}:]   number of independent random walks 
    153 \item[\np{rn\_eos\_stdxy}:] random walk horz. standard deviation (in grid points) 
    154 \item[\np{rn\_eos\_stdz}:]  random walk vert. standard deviation (in grid points) 
     189\item[\np{rn\_eos\_stdxy}:] random walk horizontal standard deviation (in grid points) 
     190\item[\np{rn\_eos\_stdz}:]  random walk vertical standard deviation (in grid points) 
    155191\item[\np{rn\_eos\_tcor}:]  random walk time correlation (in timesteps) 
    156192\item[\np{nn\_eos\_ord}:]   order of autoregressive processes 
     
    158194\item[\np{rn\_eos\_lim}:]   limitation factor (default = 3.0) 
    159195\end{description} 
    160 This routine also includes the initialization (seeding) of the random number generator. 
    161  
    162 The third routine (\rou{sto\_rst\_write}) writes a restart file 
    163 (which suffix name is given by \np{cn\_storst\_out} namelist parameter) containing the current value of 
    164 all autoregressive processes to allow restarting a simulation from where it has been interrupted. 
    165 This file also contains the current state of the random number generator. 
    166 When \np{ln\_rststo} is set to \forcode{.true.}), 
    167 the restart file (which suffix name is given by \np{cn\_storst\_in} namelist parameter) is read by 
    168 the initialization routine (\rou{sto\_par\_init}). 
    169 The simulation will continue exactly as if it was not interrupted only 
    170 when \np{ln\_rstseed} is set to \forcode{.true.}, 
    171 \ie when the state of the random number generator is read in the restart file. 
    172  
     196 
     197The first four parameters define the stochastic part of equation of state. 
    173198\biblio 
    174199 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_TRA.tex

    r10544 r11564  
    88\label{chap:TRA} 
    99 
    10 \minitoc 
    11  
    12 % missing/update  
     10\chaptertoc 
     11 
     12% missing/update 
    1313% traqsr: need to coordinate with SBC module 
    1414 
    15 %STEVEN :  is the use of the word "positive" to describe a scheme enough, or should it be "positive definite"? I added a comment to this effect on some instances of this below 
     15%STEVEN :  is the use of the word "positive" to describe a scheme enough, or should it be "positive definite"? 
     16%I added a comment to this effect on some instances of this below 
    1617 
    1718Using the representation described in \autoref{chap:DOM}, several semi -discrete space forms of 
     
    3536The terms QSR, BBC, BBL and DMP are optional. 
    3637The external forcings and parameterisations require complex inputs and complex calculations 
    37 (\eg bulk formulae, estimation of mixing coefficients) that are carried out in the SBC, 
     38(\eg\ bulk formulae, estimation of mixing coefficients) that are carried out in the SBC, 
    3839LDF and ZDF modules and described in \autoref{chap:SBC}, \autoref{chap:LDF} and 
    3940\autoref{chap:ZDF}, respectively. 
     
    4748associated modules \mdl{eosbn2} and \mdl{phycst}). 
    4849 
    49 The different options available to the user are managed by namelist logicals or CPP keys. 
     50The different options available to the user are managed by namelist logicals. 
    5051For each equation term \textit{TTT}, the namelist logicals are \textit{ln\_traTTT\_xxx}, 
    5152where \textit{xxx} is a 3 or 4 letter acronym corresponding to each optional scheme. 
    52 The CPP key (when it exists) is \key{traTTT}. 
    5353The equivalent code can be found in the \textit{traTTT} or \textit{traTTT\_xxx} module, 
    5454in the \path{./src/OCE/TRA} directory. 
    5555 
    5656The user has the option of extracting each tendency term on the RHS of the tracer equation for output 
    57 (\np{ln\_tra\_trd} or \np{ln\_tra\_mxl}~\forcode{= .true.}), as described in \autoref{chap:DIA}. 
     57(\np{ln\_tra\_trd} or \np{ln\_tra\_mxl}\forcode{=.true.}), as described in \autoref{chap:DIA}. 
    5858 
    5959% ================================================================ 
    6060% Tracer Advection 
    6161% ================================================================ 
    62 \section{Tracer advection (\protect\mdl{traadv})} 
     62\section[Tracer advection (\textit{traadv.F90})] 
     63{Tracer advection (\protect\mdl{traadv})} 
    6364\label{sec:TRA_adv} 
    6465%------------------------------------------namtra_adv----------------------------------------------------- 
    6566 
    66 \nlst{namtra_adv} 
     67\begin{listing} 
     68  \nlst{namtra_adv} 
     69  \caption{\texttt{namtra\_adv}} 
     70  \label{lst:namtra_adv} 
     71\end{listing} 
    6772%------------------------------------------------------------------------------------------------------------- 
    6873 
    69 When considered (\ie when \np{ln\_traadv\_NONE} is not set to \forcode{.true.}), 
     74When considered (\ie\ when \np{ln\_traadv\_OFF} is not set to \forcode{.true.}), 
    7075the advection tendency of a tracer is expressed in flux form, 
    71 \ie as the divergence of the advective fluxes. 
     76\ie\ as the divergence of the advective fluxes. 
    7277Its discrete expression is given by : 
    7378\begin{equation} 
    74   \label{eq:tra_adv} 
     79  \label{eq:TRA_adv} 
    7580  ADV_\tau = - \frac{1}{b_t} \Big(   \delta_i [ e_{2u} \, e_{3u} \; u \; \tau_u] 
    7681                                   + \delta_j [ e_{1v} \, e_{3v} \; v \; \tau_v] \Big) 
     
    7883\end{equation} 
    7984where $\tau$ is either T or S, and $b_t = e_{1t} \, e_{2t} \, e_{3t}$ is the volume of $T$-cells. 
    80 The flux form in \autoref{eq:tra_adv} implicitly requires the use of the continuity equation. 
     85The flux form in \autoref{eq:TRA_adv} implicitly requires the use of the continuity equation. 
    8186Indeed, it is obtained by using the following equality: $\nabla \cdot (\vect U \, T) = \vect U \cdot \nabla T$ which 
    8287results from the use of the continuity equation, $\partial_t e_3 + e_3 \; \nabla \cdot \vect U = 0$ 
    83 (which reduces to $\nabla \cdot \vect U = 0$ in linear free surface, \ie \np{ln\_linssh}~\forcode{= .true.}). 
     88(which reduces to $\nabla \cdot \vect U = 0$ in linear free surface, \ie\ \np{ln\_linssh}\forcode{=.true.}). 
    8489Therefore it is of paramount importance to design the discrete analogue of the advection tendency so that 
    8590it is consistent with the continuity equation in order to enforce the conservation properties of 
    8691the continuous equations. 
    87 In other words, by setting $\tau = 1$ in (\autoref{eq:tra_adv}) we recover the discrete form of 
     92In other words, by setting $\tau = 1$ in (\autoref{eq:TRA_adv}) we recover the discrete form of 
    8893the continuity equation which is used to calculate the vertical velocity. 
    8994%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    9095\begin{figure}[!t] 
    91   \begin{center} 
    92     \includegraphics[]{Fig_adv_scheme} 
    93     \caption{ 
    94       \protect\label{fig:adv_scheme} 
    95       Schematic representation of some ways used to evaluate the tracer value at $u$-point and 
    96       the amount of tracer exchanged between two neighbouring grid points. 
    97       Upsteam biased scheme (ups): 
    98       the upstream value is used and the black area is exchanged. 
    99       Piecewise parabolic method (ppm): 
    100       a parabolic interpolation is used and the black and dark grey areas are exchanged. 
    101       Monotonic upstream scheme for conservative laws (muscl): 
    102       a parabolic interpolation is used and black, dark grey and grey areas are exchanged. 
    103       Second order scheme (cen2): 
    104       the mean value is used and black, dark grey, grey and light grey areas are exchanged. 
    105       Note that this illustration does not include the flux limiter used in ppm and muscl schemes. 
    106     } 
    107   \end{center} 
     96  \centering 
     97  \includegraphics[width=\textwidth]{Fig_adv_scheme} 
     98  \caption[Ways to evaluate the tracer value and the amount of tracer exchanged]{ 
     99    Schematic representation of some ways used to evaluate the tracer value at $u$-point and 
     100    the amount of tracer exchanged between two neighbouring grid points. 
     101    Upsteam biased scheme (ups): 
     102    the upstream value is used and the black area is exchanged. 
     103    Piecewise parabolic method (ppm): 
     104    a parabolic interpolation is used and the black and dark grey areas are exchanged. 
     105    Monotonic upstream scheme for conservative laws (muscl): 
     106    a parabolic interpolation is used and black, dark grey and grey areas are exchanged. 
     107    Second order scheme (cen2): 
     108    the mean value is used and black, dark grey, grey and light grey areas are exchanged. 
     109    Note that this illustration does not include the flux limiter used in ppm and muscl schemes.} 
     110  \label{fig:TRA_adv_scheme} 
    108111\end{figure} 
    109112%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    110113 
    111 The key difference between the advection schemes available in \NEMO is the choice made in space and 
     114The key difference between the advection schemes available in \NEMO\ is the choice made in space and 
    112115time interpolation to define the value of the tracer at the velocity points 
    113 (\autoref{fig:adv_scheme}). 
     116(\autoref{fig:TRA_adv_scheme}). 
    114117 
    115118Along solid lateral and bottom boundaries a zero tracer flux is automatically specified, 
     
    119122\begin{description} 
    120123\item[linear free surface:] 
    121   (\np{ln\_linssh}~\forcode{= .true.}) 
     124  (\np{ln\_linssh}\forcode{=.true.}) 
    122125  the first level thickness is constant in time: 
    123126  the vertical boundary condition is applied at the fixed surface $z = 0$ rather than on 
    124127  the moving surface $z = \eta$. 
    125128  There is a non-zero advective flux which is set for all advection schemes as 
    126   $\tau_w|_{k = 1/2} = T_{k = 1}$, \ie the product of surface velocity (at $z = 0$) by 
     129  $\tau_w|_{k = 1/2} = T_{k = 1}$, \ie\ the product of surface velocity (at $z = 0$) by 
    127130  the first level tracer value. 
    128131\item[non-linear free surface:] 
    129   (\np{ln\_linssh}~\forcode{= .false.}) 
     132  (\np{ln\_linssh}\forcode{=.false.}) 
    130133  convergence/divergence in the first ocean level moves the free surface up/down. 
    131134  There is no tracer advection through it so that the advective fluxes through the surface are also zero. 
     
    136139Nevertheless, in the latter case, it is achieved to a good approximation since 
    137140the non-conservative term is the product of the time derivative of the tracer and the free surface height, 
    138 two quantities that are not correlated \citep{Roullet_Madec_JGR00, Griffies_al_MWR01, Campin2004}. 
    139  
    140 The velocity field that appears in (\autoref{eq:tra_adv} and \autoref{eq:tra_adv_zco}) is 
    141 the centred (\textit{now}) \textit{effective} ocean velocity, \ie the \textit{eulerian} velocity 
     141two quantities that are not correlated \citep{roullet.madec_JGR00, griffies.pacanowski.ea_MWR01, campin.adcroft.ea_OM04}. 
     142 
     143The velocity field that appears in (\autoref{eq:TRA_adv} is 
     144the centred (\textit{now}) \textit{effective} ocean velocity, \ie\ the \textit{eulerian} velocity 
    142145(see \autoref{chap:DYN}) plus the eddy induced velocity (\textit{eiv}) and/or 
    143146the mixed layer eddy induced velocity (\textit{eiv}) when those parameterisations are used 
     
    148151Conservative Laws scheme (MUSCL), a $3^{rd}$ Upstream Biased Scheme (UBS, also often called UP3), 
    149152and a Quadratic Upstream Interpolation for Convective Kinematics with Estimated Streaming Terms scheme (QUICKEST). 
    150 The choice is made in the \ngn{namtra\_adv} namelist, by setting to \forcode{.true.} one of 
     153The choice is made in the \nam{tra\_adv} namelist, by setting to \forcode{.true.} one of 
    151154the logicals \textit{ln\_traadv\_xxx}. 
    152155The corresponding code can be found in the \textit{traadv\_xxx.F90} module, where 
    153156\textit{xxx} is a 3 or 4 letter acronym corresponding to each scheme. 
    154 By default (\ie in the reference namelist, \textit{namelist\_ref}), all the logicals are set to \forcode{.false.}. 
     157By default (\ie\ in the reference namelist, \textit{namelist\_ref}), all the logicals are set to \forcode{.false.}. 
    155158If the user does not select an advection scheme in the configuration namelist (\textit{namelist\_cfg}), 
    156159the tracers will \textit{not} be advected! 
     
    183186%        2nd and 4th order centred schemes 
    184187% ------------------------------------------------------------------------------------------------------------- 
    185 \subsection{CEN: Centred scheme (\protect\np{ln\_traadv\_cen}~\forcode{= .true.})} 
     188\subsection[CEN: Centred scheme (\forcode{ln_traadv_cen=.true.})] 
     189{CEN: Centred scheme (\protect\np{ln\_traadv\_cen}\forcode{=.true.})} 
    186190\label{subsec:TRA_adv_cen} 
    187191 
    188 %        2nd order centred scheme   
    189  
    190 The centred advection scheme (CEN) is used when \np{ln\_traadv\_cen}~\forcode{= .true.}. 
     192%        2nd order centred scheme 
     193 
     194The centred advection scheme (CEN) is used when \np{ln\_traadv\_cen}\forcode{=.true.}. 
    191195Its order ($2^{nd}$ or $4^{th}$) can be chosen independently on horizontal (iso-level) and vertical direction by 
    192196setting \np{nn\_cen\_h} and \np{nn\_cen\_v} to $2$ or $4$. 
     
    197201For example, in the $i$-direction : 
    198202\begin{equation} 
    199   \label{eq:tra_adv_cen2} 
     203  \label{eq:TRA_adv_cen2} 
    200204  \tau_u^{cen2} = \overline T ^{i + 1/2} 
    201205\end{equation} 
    202206 
    203 CEN2 is non diffusive (\ie it conserves the tracer variance, $\tau^2$) but dispersive 
    204 (\ie it may create false extrema). 
     207CEN2 is non diffusive (\ie\ it conserves the tracer variance, $\tau^2$) but dispersive 
     208(\ie\ it may create false extrema). 
    205209It is therefore notoriously noisy and must be used in conjunction with an explicit diffusion operator to 
    206210produce a sensible solution. 
    207211The associated time-stepping is performed using a leapfrog scheme in conjunction with an Asselin time-filter, 
    208 so $T$ in (\autoref{eq:tra_adv_cen2}) is the \textit{now} tracer value. 
     212so $T$ in (\autoref{eq:TRA_adv_cen2}) is the \textit{now} tracer value. 
    209213 
    210214Note that using the CEN2, the overall tracer advection is of second order accuracy since 
    211 both (\autoref{eq:tra_adv}) and (\autoref{eq:tra_adv_cen2}) have this order of accuracy. 
    212  
    213 %        4nd order centred scheme   
     215both (\autoref{eq:TRA_adv}) and (\autoref{eq:TRA_adv_cen2}) have this order of accuracy. 
     216 
     217%        4nd order centred scheme 
    214218 
    215219In the $4^{th}$ order formulation (CEN4), tracer values are evaluated at u- and v-points as 
     
    217221For example, in the $i$-direction: 
    218222\begin{equation} 
    219   \label{eq:tra_adv_cen4} 
     223  \label{eq:TRA_adv_cen4} 
    220224  \tau_u^{cen4} = \overline{T - \frac{1}{6} \, \delta_i \Big[ \delta_{i + 1/2}[T] \, \Big]}^{\,i + 1/2} 
    221225\end{equation} 
    222 In the vertical direction (\np{nn\_cen\_v}~\forcode{= 4}), 
    223 a $4^{th}$ COMPACT interpolation has been prefered \citep{Demange_PhD2014}. 
     226In the vertical direction (\np{nn\_cen\_v}\forcode{=4}), 
     227a $4^{th}$ COMPACT interpolation has been prefered \citep{demange_phd14}. 
    224228In the COMPACT scheme, both the field and its derivative are interpolated, which leads, after a matrix inversion, 
    225 spectral characteristics similar to schemes of higher order \citep{Lele_JCP1992}.  
     229spectral characteristics similar to schemes of higher order \citep{lele_JCP92}. 
    226230 
    227231Strictly speaking, the CEN4 scheme is not a $4^{th}$ order advection scheme but 
    228232a $4^{th}$ order evaluation of advective fluxes, 
    229 since the divergence of advective fluxes \autoref{eq:tra_adv} is kept at $2^{nd}$ order. 
     233since the divergence of advective fluxes \autoref{eq:TRA_adv} is kept at $2^{nd}$ order. 
    230234The expression \textit{$4^{th}$ order scheme} used in oceanographic literature is usually associated with 
    231235the scheme presented here. 
     
    235239 
    236240A direct consequence of the pseudo-fourth order nature of the scheme is that it is not non-diffusive, 
    237 \ie the global variance of a tracer is not preserved using CEN4. 
     241\ie\ the global variance of a tracer is not preserved using CEN4. 
    238242Furthermore, it must be used in conjunction with an explicit diffusion operator to produce a sensible solution. 
    239243As in CEN2 case, the time-stepping is performed using a leapfrog scheme in conjunction with an Asselin time-filter, 
    240 so $T$ in (\autoref{eq:tra_adv_cen4}) is the \textit{now} tracer. 
     244so $T$ in (\autoref{eq:TRA_adv_cen4}) is the \textit{now} tracer. 
    241245 
    242246At a $T$-grid cell adjacent to a boundary (coastline, bottom and surface), 
     
    248252 
    249253% ------------------------------------------------------------------------------------------------------------- 
    250 %        FCT scheme   
    251 % ------------------------------------------------------------------------------------------------------------- 
    252 \subsection{FCT: Flux Corrected Transport scheme (\protect\np{ln\_traadv\_fct}~\forcode{= .true.})} 
     254%        FCT scheme 
     255% ------------------------------------------------------------------------------------------------------------- 
     256\subsection[FCT: Flux Corrected Transport scheme (\forcode{ln_traadv_fct=.true.})] 
     257{FCT: Flux Corrected Transport scheme (\protect\np{ln\_traadv\_fct}\forcode{=.true.})} 
    253258\label{subsec:TRA_adv_tvd} 
    254259 
    255 The Flux Corrected Transport schemes (FCT) is used when \np{ln\_traadv\_fct}~\forcode{= .true.}. 
     260The Flux Corrected Transport schemes (FCT) is used when \np{ln\_traadv\_fct}\forcode{=.true.}. 
    256261Its order ($2^{nd}$ or $4^{th}$) can be chosen independently on horizontal (iso-level) and vertical direction by 
    257262setting \np{nn\_fct\_h} and \np{nn\_fct\_v} to $2$ or $4$. 
     
    262267For example, in the $i$-direction : 
    263268\begin{equation} 
    264   \label{eq:tra_adv_fct} 
     269  \label{eq:TRA_adv_fct} 
    265270  \begin{split} 
    266271    \tau_u^{ups} &= 
     
    275280where $c_u$ is a flux limiter function taking values between 0 and 1. 
    276281The FCT order is the one of the centred scheme used 
    277 (\ie it depends on the setting of \np{nn\_fct\_h} and \np{nn\_fct\_v}). 
     282(\ie\ it depends on the setting of \np{nn\_fct\_h} and \np{nn\_fct\_v}). 
    278283There exist many ways to define $c_u$, each corresponding to a different FCT scheme. 
    279 The one chosen in \NEMO is described in \citet{Zalesak_JCP79}. 
     284The one chosen in \NEMO\ is described in \citet{zalesak_JCP79}. 
    280285$c_u$ only departs from $1$ when the advective term produces a local extremum in the tracer field. 
    281286The resulting scheme is quite expensive but \textit{positive}. 
    282287It can be used on both active and passive tracers. 
    283 A comparison of FCT-2 with MUSCL and a MPDATA scheme can be found in \citet{Levy_al_GRL01}. 
    284  
    285 An additional option has been added controlled by \np{nn\_fct\_zts}. 
    286 By setting this integer to a value larger than zero, 
    287 a $2^{nd}$ order FCT scheme is used on both horizontal and vertical direction, but on the latter, 
    288 a split-explicit time stepping is used, with a number of sub-timestep equals to \np{nn\_fct\_zts}. 
    289 This option can be useful when the size of the timestep is limited by vertical advection \citep{Lemarie_OM2015}. 
    290 Note that in this case, a similar split-explicit time stepping should be used on vertical advection of momentum to 
    291 insure a better stability (see \autoref{subsec:DYN_zad}). 
    292  
    293 For stability reasons (see \autoref{chap:STP}), 
    294 $\tau_u^{cen}$ is evaluated in (\autoref{eq:tra_adv_fct}) using the \textit{now} tracer while 
     288A comparison of FCT-2 with MUSCL and a MPDATA scheme can be found in \citet{levy.estublier.ea_GRL01}. 
     289 
     290 
     291For stability reasons (see \autoref{chap:TD}), 
     292$\tau_u^{cen}$ is evaluated in (\autoref{eq:TRA_adv_fct}) using the \textit{now} tracer while 
    295293$\tau_u^{ups}$ is evaluated using the \textit{before} tracer. 
    296294In other words, the advective part of the scheme is time stepped with a leap-frog scheme 
     
    298296 
    299297% ------------------------------------------------------------------------------------------------------------- 
    300 %        MUSCL scheme   
    301 % ------------------------------------------------------------------------------------------------------------- 
    302 \subsection{MUSCL: Monotone Upstream Scheme for Conservative Laws (\protect\np{ln\_traadv\_mus}~\forcode{= .true.})} 
     298%        MUSCL scheme 
     299% ------------------------------------------------------------------------------------------------------------- 
     300\subsection[MUSCL: Monotone Upstream Scheme for Conservative Laws (\forcode{ln_traadv_mus=.true.})] 
     301{MUSCL: Monotone Upstream Scheme for Conservative Laws (\protect\np{ln\_traadv\_mus}\forcode{=.true.})} 
    303302\label{subsec:TRA_adv_mus} 
    304303 
    305 The Monotone Upstream Scheme for Conservative Laws (MUSCL) is used when \np{ln\_traadv\_mus}~\forcode{= .true.}. 
     304The Monotone Upstream Scheme for Conservative Laws (MUSCL) is used when \np{ln\_traadv\_mus}\forcode{=.true.}. 
    306305MUSCL implementation can be found in the \mdl{traadv\_mus} module. 
    307306 
    308 MUSCL has been first implemented in \NEMO by \citet{Levy_al_GRL01}. 
     307MUSCL has been first implemented in \NEMO\ by \citet{levy.estublier.ea_GRL01}. 
    309308In its formulation, the tracer at velocity points is evaluated assuming a linear tracer variation between 
    310 two $T$-points (\autoref{fig:adv_scheme}). 
     309two $T$-points (\autoref{fig:TRA_adv_scheme}). 
    311310For example, in the $i$-direction : 
    312311\begin{equation} 
    313   % \label{eq:tra_adv_mus} 
     312  % \label{eq:TRA_adv_mus} 
    314313  \tau_u^{mus} = \lt\{ 
    315314  \begin{split} 
     
    331330This choice ensure the \textit{positive} character of the scheme. 
    332331In addition, fluxes round a grid-point where a runoff is applied can optionally be computed using upstream fluxes 
    333 (\np{ln\_mus\_ups}~\forcode{= .true.}). 
    334  
    335 % ------------------------------------------------------------------------------------------------------------- 
    336 %        UBS scheme   
    337 % ------------------------------------------------------------------------------------------------------------- 
    338 \subsection{UBS a.k.a. UP3: Upstream-Biased Scheme (\protect\np{ln\_traadv\_ubs}~\forcode{= .true.})} 
     332(\np{ln\_mus\_ups}\forcode{=.true.}). 
     333 
     334% ------------------------------------------------------------------------------------------------------------- 
     335%        UBS scheme 
     336% ------------------------------------------------------------------------------------------------------------- 
     337\subsection[UBS a.k.a. UP3: Upstream-Biased Scheme (\forcode{ln_traadv_ubs=.true.})] 
     338{UBS a.k.a. UP3: Upstream-Biased Scheme (\protect\np{ln\_traadv\_ubs}\forcode{=.true.})} 
    339339\label{subsec:TRA_adv_ubs} 
    340340 
    341 The Upstream-Biased Scheme (UBS) is used when \np{ln\_traadv\_ubs}~\forcode{= .true.}. 
     341The Upstream-Biased Scheme (UBS) is used when \np{ln\_traadv\_ubs}\forcode{=.true.}. 
    342342UBS implementation can be found in the \mdl{traadv\_mus} module. 
    343343 
     
    347347For example, in the $i$-direction: 
    348348\begin{equation} 
    349   \label{eq:tra_adv_ubs} 
     349  \label{eq:TRA_adv_ubs} 
    350350  \tau_u^{ubs} = \overline T ^{i + 1/2} - \frac{1}{6} 
    351351    \begin{cases} 
     
    358358 
    359359This results in a dissipatively dominant (i.e. hyper-diffusive) truncation error 
    360 \citep{Shchepetkin_McWilliams_OM05}. 
    361 The overall performance of the advection scheme is similar to that reported in \cite{Farrow1995}. 
     360\citep{shchepetkin.mcwilliams_OM05}. 
     361The overall performance of the advection scheme is similar to that reported in \cite{farrow.stevens_JPO95}. 
    362362It is a relatively good compromise between accuracy and smoothness. 
    363363Nevertheless the scheme is not \textit{positive}, meaning that false extrema are permitted, 
     
    367367The intrinsic diffusion of UBS makes its use risky in the vertical direction where 
    368368the control of artificial diapycnal fluxes is of paramount importance 
    369 \citep{Shchepetkin_McWilliams_OM05, Demange_PhD2014}. 
     369\citep{shchepetkin.mcwilliams_OM05, demange_phd14}. 
    370370Therefore the vertical flux is evaluated using either a $2^nd$ order FCT scheme or a $4^th$ order COMPACT scheme 
    371 (\np{nn\_cen\_v}~\forcode{= 2 or 4}). 
    372  
    373 For stability reasons (see \autoref{chap:STP}), the first term  in \autoref{eq:tra_adv_ubs} 
     371(\np{nn\_ubs\_v}\forcode{=2 or 4}). 
     372 
     373For stability reasons (see \autoref{chap:TD}), the first term  in \autoref{eq:TRA_adv_ubs} 
    374374(which corresponds to a second order centred scheme) 
    375375is evaluated using the \textit{now} tracer (centred in time) while the second term 
    376376(which is the diffusive part of the scheme), 
    377377is evaluated using the \textit{before} tracer (forward in time). 
    378 This choice is discussed by \citet{Webb_al_JAOT98} in the context of the QUICK advection scheme. 
     378This choice is discussed by \citet{webb.de-cuevas.ea_JAOT98} in the context of the QUICK advection scheme. 
    379379UBS and QUICK schemes only differ by one coefficient. 
    380 Replacing 1/6 with 1/8 in \autoref{eq:tra_adv_ubs} leads to the QUICK advection scheme \citep{Webb_al_JAOT98}. 
     380Replacing 1/6 with 1/8 in \autoref{eq:TRA_adv_ubs} leads to the QUICK advection scheme \citep{webb.de-cuevas.ea_JAOT98}. 
    381381This option is not available through a namelist parameter, since the 1/6 coefficient is hard coded. 
    382382Nevertheless it is quite easy to make the substitution in the \mdl{traadv\_ubs} module and obtain a QUICK scheme. 
    383383 
    384 Note that it is straightforward to rewrite \autoref{eq:tra_adv_ubs} as follows: 
     384Note that it is straightforward to rewrite \autoref{eq:TRA_adv_ubs} as follows: 
    385385\begin{gather} 
    386   \label{eq:traadv_ubs2} 
     386  \label{eq:TRA_adv_ubs2} 
    387387  \tau_u^{ubs} = \tau_u^{cen4} + \frac{1}{12} 
    388388    \begin{cases} 
     
    391391    \end{cases} 
    392392  \intertext{or equivalently} 
    393   % \label{eq:traadv_ubs2b} 
     393  % \label{eq:TRA_adv_ubs2b} 
    394394  u_{i + 1/2} \ \tau_u^{ubs} = u_{i + 1/2} \, \overline{T - \frac{1}{6} \, \delta_i \Big[ \delta_{i + 1/2}[T] \Big]}^{\,i + 1/2} 
    395395                             - \frac{1}{2} |u|_{i + 1/2} \, \frac{1}{6} \, \delta_{i + 1/2} [\tau"_i] \nonumber 
    396396\end{gather} 
    397397 
    398 \autoref{eq:traadv_ubs2} has several advantages. 
     398\autoref{eq:TRA_adv_ubs2} has several advantages. 
    399399Firstly, it clearly reveals that the UBS scheme is based on the fourth order scheme to which 
    400400an upstream-biased diffusion term is added. 
    401401Secondly, this emphasises that the $4^{th}$ order part (as well as the $2^{nd}$ order part as stated above) has to 
    402 be evaluated at the \textit{now} time step using \autoref{eq:tra_adv_ubs}. 
     402be evaluated at the \textit{now} time step using \autoref{eq:TRA_adv_ubs}. 
    403403Thirdly, the diffusion term is in fact a biharmonic operator with an eddy coefficient which 
    404404is simply proportional to the velocity: $A_u^{lm} = \frac{1}{12} \, {e_{1u}}^3 \, |u|$. 
    405 Note the current version of NEMO uses the computationally more efficient formulation \autoref{eq:tra_adv_ubs}. 
    406  
    407 % ------------------------------------------------------------------------------------------------------------- 
    408 %        QCK scheme   
    409 % ------------------------------------------------------------------------------------------------------------- 
    410 \subsection{QCK: QuiCKest scheme (\protect\np{ln\_traadv\_qck}~\forcode{= .true.})} 
     405Note the current version of \NEMO\ uses the computationally more efficient formulation \autoref{eq:TRA_adv_ubs}. 
     406 
     407% ------------------------------------------------------------------------------------------------------------- 
     408%        QCK scheme 
     409% ------------------------------------------------------------------------------------------------------------- 
     410\subsection[QCK: QuiCKest scheme (\forcode{ln_traadv_qck=.true.})] 
     411{QCK: QuiCKest scheme (\protect\np{ln\_traadv\_qck}\forcode{=.true.})} 
    411412\label{subsec:TRA_adv_qck} 
    412413 
    413414The Quadratic Upstream Interpolation for Convective Kinematics with Estimated Streaming Terms (QUICKEST) scheme 
    414 proposed by \citet{Leonard1979} is used when \np{ln\_traadv\_qck}~\forcode{= .true.}. 
     415proposed by \citet{leonard_CMAME79} is used when \np{ln\_traadv\_qck}\forcode{=.true.}. 
    415416QUICKEST implementation can be found in the \mdl{traadv\_qck} module. 
    416417 
    417418QUICKEST is the third order Godunov scheme which is associated with the ULTIMATE QUICKEST limiter 
    418 \citep{Leonard1991}. 
    419 It has been implemented in NEMO by G. Reffray (MERCATOR-ocean) and can be found in the \mdl{traadv\_qck} module. 
     419\citep{leonard_CMAME91}. 
     420It has been implemented in \NEMO\ by G. Reffray (MERCATOR-ocean) and can be found in the \mdl{traadv\_qck} module. 
    420421The resulting scheme is quite expensive but \textit{positive}. 
    421422It can be used on both active and passive tracers. 
     
    431432% Tracer Lateral Diffusion 
    432433% ================================================================ 
    433 \section{Tracer lateral diffusion (\protect\mdl{traldf})} 
     434\section[Tracer lateral diffusion (\textit{traldf.F90})] 
     435{Tracer lateral diffusion (\protect\mdl{traldf})} 
    434436\label{sec:TRA_ldf} 
    435437%-----------------------------------------nam_traldf------------------------------------------------------ 
    436438 
    437 \nlst{namtra_ldf} 
     439\begin{listing} 
     440  \nlst{namtra_ldf} 
     441  \caption{\texttt{namtra\_ldf}} 
     442  \label{lst:namtra_ldf} 
     443\end{listing} 
    438444%------------------------------------------------------------------------------------------------------------- 
    439   
    440 Options are defined through the \ngn{namtra\_ldf} namelist variables. 
    441 They are regrouped in four items, allowing to specify  
     445 
     446Options are defined through the \nam{tra\_ldf} namelist variables. 
     447They are regrouped in four items, allowing to specify 
    442448$(i)$   the type of operator used (none, laplacian, bilaplacian), 
    443449$(ii)$  the direction along which the operator acts (iso-level, horizontal, iso-neutral), 
    444 $(iii)$ some specific options related to the rotated operators (\ie non-iso-level operator), and 
     450$(iii)$ some specific options related to the rotated operators (\ie\ non-iso-level operator), and 
    445451$(iv)$  the specification of eddy diffusivity coefficient (either constant or variable in space and time). 
    446452Item $(iv)$ will be described in \autoref{chap:LDF}. 
     
    450456 
    451457The lateral diffusion of tracers is evaluated using a forward scheme, 
    452 \ie the tracers appearing in its expression are the \textit{before} tracers in time, 
     458\ie\ the tracers appearing in its expression are the \textit{before} tracers in time, 
    453459except for the pure vertical component that appears when a rotation tensor is used. 
    454 This latter component is solved implicitly together with the vertical diffusion term (see \autoref{chap:STP}). 
    455 When \np{ln\_traldf\_msc}~\forcode{= .true.}, a Method of Stabilizing Correction is used in which 
    456 the pure vertical component is split into an explicit and an implicit part \citep{Lemarie_OM2012}. 
     460This latter component is solved implicitly together with the vertical diffusion term (see \autoref{chap:TD}). 
     461When \np{ln\_traldf\_msc}\forcode{=.true.}, a Method of Stabilizing Correction is used in which 
     462the pure vertical component is split into an explicit and an implicit part \citep{lemarie.debreu.ea_OM12}. 
    457463 
    458464% ------------------------------------------------------------------------------------------------------------- 
    459465%        Type of operator 
    460466% ------------------------------------------------------------------------------------------------------------- 
    461 \subsection[Type of operator (\protect\np{ln\_traldf}\{\_NONE,\_lap,\_blp\}\})]{Type of operator (\protect\np{ln\_traldf\_NONE}, \protect\np{ln\_traldf\_lap}, or \protect\np{ln\_traldf\_blp}) }  
     467\subsection[Type of operator (\texttt{ln\_traldf}\{\texttt{\_OFF,\_lap,\_blp}\})] 
     468{Type of operator (\protect\np{ln\_traldf\_OFF}, \protect\np{ln\_traldf\_lap}, or \protect\np{ln\_traldf\_blp}) } 
    462469\label{subsec:TRA_ldf_op} 
    463470 
     
    465472 
    466473\begin{description} 
    467 \item[\np{ln\_traldf\_NONE}~\forcode{= .true.}:] 
     474\item[\np{ln\_traldf\_OFF}\forcode{=.true.}:] 
    468475  no operator selected, the lateral diffusive tendency will not be applied to the tracer equation. 
    469476  This option can be used when the selected advection scheme is diffusive enough (MUSCL scheme for example). 
    470 \item[\np{ln\_traldf\_lap}~\forcode{= .true.}:] 
     477\item[\np{ln\_traldf\_lap}\forcode{=.true.}:] 
    471478  a laplacian operator is selected. 
    472   This harmonic operator takes the following expression:  $\mathpzc{L}(T) = \nabla \cdot A_{ht} \; \nabla T $, 
     479  This harmonic operator takes the following expression:  $\mathcal{L}(T) = \nabla \cdot A_{ht} \; \nabla T $, 
    473480  where the gradient operates along the selected direction (see \autoref{subsec:TRA_ldf_dir}), 
    474481  and $A_{ht}$ is the eddy diffusivity coefficient expressed in $m^2/s$ (see \autoref{chap:LDF}). 
    475 \item[\np{ln\_traldf\_blp}~\forcode{= .true.}]: 
     482\item[\np{ln\_traldf\_blp}\forcode{=.true.}]: 
    476483  a bilaplacian operator is selected. 
    477484  This biharmonic operator takes the following expression: 
    478   $\mathpzc{B} = - \mathpzc{L}(\mathpzc{L}(T)) = - \nabla \cdot b \nabla (\nabla \cdot b \nabla T)$ 
     485  $\mathcal{B} = - \mathcal{L}(\mathcal{L}(T)) = - \nabla \cdot b \nabla (\nabla \cdot b \nabla T)$ 
    479486  where the gradient operats along the selected direction, 
    480487  and $b^2 = B_{ht}$ is the eddy diffusivity coefficient expressed in $m^4/s$ (see \autoref{chap:LDF}). 
     
    486493minimizing the impact on the larger scale features. 
    487494The main difference between the two operators is the scale selectiveness. 
    488 The bilaplacian damping time (\ie its spin down time) scales like $\lambda^{-4}$ for 
     495The bilaplacian damping time (\ie\ its spin down time) scales like $\lambda^{-4}$ for 
    489496disturbances of wavelength $\lambda$ (so that short waves damped more rapidelly than long ones), 
    490497whereas the laplacian damping time scales only like $\lambda^{-2}$. 
     
    493500%        Direction of action 
    494501% ------------------------------------------------------------------------------------------------------------- 
    495 \subsection[Action direction (\protect\np{ln\_traldf}\{\_lev,\_hor,\_iso,\_triad\})]{Direction of action (\protect\np{ln\_traldf\_lev}, \protect\np{ln\_traldf\_hor}, \protect\np{ln\_traldf\_iso}, or \protect\np{ln\_traldf\_triad}) }  
     502\subsection[Action direction (\texttt{ln\_traldf}\{\texttt{\_lev,\_hor,\_iso,\_triad}\})] 
     503{Direction of action (\protect\np{ln\_traldf\_lev}, \protect\np{ln\_traldf\_hor}, \protect\np{ln\_traldf\_iso}, or \protect\np{ln\_traldf\_triad}) } 
    496504\label{subsec:TRA_ldf_dir} 
    497505 
    498506The choice of a direction of action determines the form of operator used. 
    499507The operator is a simple (re-entrant) laplacian acting in the (\textbf{i},\textbf{j}) plane when 
    500 iso-level option is used (\np{ln\_traldf\_lev}~\forcode{= .true.}) or 
    501 when a horizontal (\ie geopotential) operator is demanded in \textit{z}-coordinate 
    502 (\np{ln\_traldf\_hor} and \np{ln\_zco} equal \forcode{.true.}). 
     508iso-level option is used (\np{ln\_traldf\_lev}\forcode{=.true.}) or 
     509when a horizontal (\ie\ geopotential) operator is demanded in \textit{z}-coordinate 
     510(\np{ln\_traldf\_hor} and \np{ln\_zco}\forcode{=.true.}). 
    503511The associated code can be found in the \mdl{traldf\_lap\_blp} module. 
    504512The operator is a rotated (re-entrant) laplacian when 
    505513the direction along which it acts does not coincide with the iso-level surfaces, 
    506514that is when standard or triad iso-neutral option is used 
    507 (\np{ln\_traldf\_iso} or \np{ln\_traldf\_triad} equals \forcode{.true.}, 
     515(\np{ln\_traldf\_iso} or \np{ln\_traldf\_triad} = \forcode{.true.}, 
    508516see \mdl{traldf\_iso} or \mdl{traldf\_triad} module, resp.), or 
    509 when a horizontal (\ie geopotential) operator is demanded in \textit{s}-coordinate 
    510 (\np{ln\_traldf\_hor} and \np{ln\_sco} equal \forcode{.true.}) 
     517when a horizontal (\ie\ geopotential) operator is demanded in \textit{s}-coordinate 
     518(\np{ln\_traldf\_hor} and \np{ln\_sco} = \forcode{.true.}) 
    511519\footnote{In this case, the standard iso-neutral operator will be automatically selected}. 
    512520In that case, a rotation is applied to the gradient(s) that appears in the operator so that 
     
    519527%       iso-level operator 
    520528% ------------------------------------------------------------------------------------------------------------- 
    521 \subsection{Iso-level (bi -)laplacian operator ( \protect\np{ln\_traldf\_iso}) } 
     529\subsection[Iso-level (bi-)laplacian operator (\texttt{ln\_traldf\_iso})] 
     530{Iso-level (bi-)laplacian operator ( \protect\np{ln\_traldf\_iso})} 
    522531\label{subsec:TRA_ldf_lev} 
    523532 
    524 The laplacian diffusion operator acting along the model (\textit{i,j})-surfaces is given by:  
    525 \begin{equation} 
    526   \label{eq:tra_ldf_lap} 
     533The laplacian diffusion operator acting along the model (\textit{i,j})-surfaces is given by: 
     534\begin{equation} 
     535  \label{eq:TRA_ldf_lap} 
    527536  D_t^{lT} = \frac{1}{b_t} \Bigg(   \delta_{i} \lt[ A_u^{lT} \; \frac{e_{2u} \, e_{3u}}{e_{1u}} \; \delta_{i + 1/2} [T] \rt] 
    528537                                  + \delta_{j} \lt[ A_v^{lT} \; \frac{e_{1v} \, e_{3v}}{e_{2v}} \; \delta_{j + 1/2} [T] \rt] \Bigg) 
     
    531540where zero diffusive fluxes is assumed across solid boundaries, 
    532541first (and third in bilaplacian case) horizontal tracer derivative are masked. 
    533 It is implemented in the \rou{traldf\_lap} subroutine found in the \mdl{traldf\_lap} module. 
    534 The module also contains \rou{traldf\_blp}, the subroutine calling twice \rou{traldf\_lap} in order to 
     542It is implemented in the \rou{tra\_ldf\_lap} subroutine found in the \mdl{traldf\_lap\_blp} module. 
     543The module also contains \rou{tra\_ldf\_blp}, the subroutine calling twice \rou{tra\_ldf\_lap} in order to 
    535544compute the iso-level bilaplacian operator. 
    536545 
    537546It is a \textit{horizontal} operator (\ie acting along geopotential surfaces) in 
    538547the $z$-coordinate with or without partial steps, but is simply an iso-level operator in the $s$-coordinate. 
    539 It is thus used when, in addition to \np{ln\_traldf\_lap} or \np{ln\_traldf\_blp}~\forcode{= .true.}, 
    540 we have \np{ln\_traldf\_lev}~\forcode{= .true.} or \np{ln\_traldf\_hor}~=~\np{ln\_zco}~\forcode{= .true.}. 
     548It is thus used when, in addition to \np{ln\_traldf\_lap} or \np{ln\_traldf\_blp}\forcode{=.true.}, 
     549we have \np{ln\_traldf\_lev}\forcode{=.true.} or \np{ln\_traldf\_hor}~=~\np{ln\_zco}\forcode{=.true.}. 
    541550In both cases, it significantly contributes to diapycnal mixing. 
    542551It is therefore never recommended, even when using it in the bilaplacian case. 
    543552 
    544 Note that in the partial step $z$-coordinate (\np{ln\_zps}~\forcode{= .true.}), 
     553Note that in the partial step $z$-coordinate (\np{ln\_zps}\forcode{=.true.}), 
    545554tracers in horizontally adjacent cells are located at different depths in the vicinity of the bottom. 
    546 In this case, horizontal derivatives in (\autoref{eq:tra_ldf_lap}) at the bottom level require a specific treatment. 
     555In this case, horizontal derivatives in (\autoref{eq:TRA_ldf_lap}) at the bottom level require a specific treatment. 
    547556They are calculated in the \mdl{zpshde} module, described in \autoref{sec:TRA_zpshde}. 
    548557 
     
    550559%         Rotated laplacian operator 
    551560% ------------------------------------------------------------------------------------------------------------- 
    552 \subsection{Standard and triad (bi -)laplacian operator} 
     561\subsection{Standard and triad (bi-)laplacian operator} 
    553562\label{subsec:TRA_ldf_iso_triad} 
    554563 
    555 %&&    Standard rotated (bi -)laplacian operator 
     564%&&    Standard rotated (bi-)laplacian operator 
    556565%&& ---------------------------------------------- 
    557 \subsubsection{Standard rotated (bi -)laplacian operator (\protect\mdl{traldf\_iso})} 
     566\subsubsection[Standard rotated (bi-)laplacian operator (\textit{traldf\_iso.F90})] 
     567{Standard rotated (bi-)laplacian operator (\protect\mdl{traldf\_iso})} 
    558568\label{subsec:TRA_ldf_iso} 
    559 The general form of the second order lateral tracer subgrid scale physics (\autoref{eq:PE_zdf}) 
     569The general form of the second order lateral tracer subgrid scale physics (\autoref{eq:MB_zdf}) 
    560570takes the following semi -discrete space form in $z$- and $s$-coordinates: 
    561571\begin{equation} 
    562   \label{eq:tra_ldf_iso} 
     572  \label{eq:TRA_ldf_iso} 
    563573  \begin{split} 
    564574    D_T^{lT} = \frac{1}{b_t} \Bigg[ \quad &\delta_i A_u^{lT} \lt( \frac{e_{2u} e_{3u}}{e_{1u}}                      \, \delta_{i + 1/2} [T] 
     
    573583where $b_t = e_{1t} \, e_{2t} \, e_{3t}$  is the volume of $T$-cells, 
    574584$r_1$ and $r_2$ are the slopes between the surface of computation ($z$- or $s$-surfaces) and 
    575 the surface along which the diffusion operator acts (\ie horizontal or iso-neutral surfaces). 
    576 It is thus used when, in addition to \np{ln\_traldf\_lap}~\forcode{= .true.}, 
    577 we have \np{ln\_traldf\_iso}~\forcode{= .true.}, 
    578 or both \np{ln\_traldf\_hor}~\forcode{= .true.} and \np{ln\_zco}~\forcode{= .true.}. 
     585the surface along which the diffusion operator acts (\ie\ horizontal or iso-neutral surfaces). 
     586It is thus used when, in addition to \np{ln\_traldf\_lap}\forcode{=.true.}, 
     587we have \np{ln\_traldf\_iso}\forcode{=.true.}, 
     588or both \np{ln\_traldf\_hor}\forcode{=.true.} and \np{ln\_zco}\forcode{=.true.}. 
    579589The way these slopes are evaluated is given in \autoref{sec:LDF_slp}. 
    580590At the surface, bottom and lateral boundaries, the turbulent fluxes of heat and salt are set to zero using 
    581591the mask technique (see \autoref{sec:LBC_coast}). 
    582592 
    583 The operator in \autoref{eq:tra_ldf_iso} involves both lateral and vertical derivatives. 
     593The operator in \autoref{eq:TRA_ldf_iso} involves both lateral and vertical derivatives. 
    584594For numerical stability, the vertical second derivative must be solved using the same implicit time scheme as that 
    585595used in the vertical physics (see \autoref{sec:TRA_zdf}). 
     
    590600This formulation conserves the tracer but does not ensure the decrease of the tracer variance. 
    591601Nevertheless the treatment performed on the slopes (see \autoref{chap:LDF}) allows the model to run safely without 
    592 any additional background horizontal diffusion \citep{Guilyardi_al_CD01}. 
    593  
    594 Note that in the partial step $z$-coordinate (\np{ln\_zps}~\forcode{= .true.}), 
    595 the horizontal derivatives at the bottom level in \autoref{eq:tra_ldf_iso} require a specific treatment. 
     602any additional background horizontal diffusion \citep{guilyardi.madec.ea_CD01}. 
     603 
     604Note that in the partial step $z$-coordinate (\np{ln\_zps}\forcode{=.true.}), 
     605the horizontal derivatives at the bottom level in \autoref{eq:TRA_ldf_iso} require a specific treatment. 
    596606They are calculated in module zpshde, described in \autoref{sec:TRA_zpshde}. 
    597607 
    598 %&&     Triad rotated (bi -)laplacian operator 
     608%&&     Triad rotated (bi-)laplacian operator 
    599609%&&  ------------------------------------------- 
    600 \subsubsection{Triad rotated (bi -)laplacian operator (\protect\np{ln\_traldf\_triad})} 
     610\subsubsection[Triad rotated (bi-)laplacian operator (\textit{ln\_traldf\_triad})] 
     611{Triad rotated (bi-)laplacian operator (\protect\np{ln\_traldf\_triad})} 
    601612\label{subsec:TRA_ldf_triad} 
    602613 
    603 If the Griffies triad scheme is employed (\np{ln\_traldf\_triad}~\forcode{= .true.}; see \autoref{apdx:triad}) 
    604  
    605 An alternative scheme developed by \cite{Griffies_al_JPO98} which ensures tracer variance decreases 
    606 is also available in \NEMO (\np{ln\_traldf\_grif}~\forcode{= .true.}). 
    607 A complete description of the algorithm is given in \autoref{apdx:triad}. 
    608  
    609 The lateral fourth order bilaplacian operator on tracers is obtained by applying (\autoref{eq:tra_ldf_lap}) twice. 
     614An alternative scheme developed by \cite{griffies.gnanadesikan.ea_JPO98} which ensures tracer variance decreases 
     615is also available in \NEMO\ (\np{ln\_traldf\_triad}\forcode{=.true.}). 
     616A complete description of the algorithm is given in \autoref{apdx:TRIADS}. 
     617 
     618The lateral fourth order bilaplacian operator on tracers is obtained by applying (\autoref{eq:TRA_ldf_lap}) twice. 
    610619The operator requires an additional assumption on boundary conditions: 
    611620both first and third derivative terms normal to the coast are set to zero. 
    612621 
    613 The lateral fourth order operator formulation on tracers is obtained by applying (\autoref{eq:tra_ldf_iso}) twice. 
     622The lateral fourth order operator formulation on tracers is obtained by applying (\autoref{eq:TRA_ldf_iso}) twice. 
    614623It requires an additional assumption on boundary conditions: 
    615624first and third derivative terms normal to the coast, 
     
    625634\item \np{rn\_slpmax} = slope limit (both operators) 
    626635\item \np{ln\_triad\_iso} = pure horizontal mixing in ML (triad only) 
    627 \item \np{rn\_sw\_triad} $= 1$ switching triad; $= 0$ all 4 triads used (triad only)  
     636\item \np{rn\_sw\_triad} $= 1$ switching triad; $= 0$ all 4 triads used (triad only) 
    628637\item \np{ln\_botmix\_triad} = lateral mixing on bottom (triad only) 
    629638\end{itemize} 
     
    632641% Tracer Vertical Diffusion 
    633642% ================================================================ 
    634 \section{Tracer vertical diffusion (\protect\mdl{trazdf})} 
     643\section[Tracer vertical diffusion (\textit{trazdf.F90})] 
     644{Tracer vertical diffusion (\protect\mdl{trazdf})} 
    635645\label{sec:TRA_zdf} 
    636646%--------------------------------------------namzdf--------------------------------------------------------- 
    637647 
    638 \nlst{namzdf} 
    639648%-------------------------------------------------------------------------------------------------------------- 
    640649 
    641 Options are defined through the \ngn{namzdf} namelist variables. 
     650Options are defined through the \nam{zdf} namelist variables. 
    642651The formulation of the vertical subgrid scale tracer physics is the same for all the vertical coordinates, 
    643652and is based on a laplacian operator. 
    644 The vertical diffusion operator given by (\autoref{eq:PE_zdf}) takes the following semi -discrete space form: 
     653The vertical diffusion operator given by (\autoref{eq:MB_zdf}) takes the following semi -discrete space form: 
    645654\begin{gather*} 
    646   % \label{eq:tra_zdf} 
     655  % \label{eq:TRA_zdf} 
    647656    D^{vT}_T = \frac{1}{e_{3t}} \, \delta_k \lt[ \, \frac{A^{vT}_w}{e_{3w}} \delta_{k + 1/2}[T] \, \rt] \\ 
    648657    D^{vS}_T = \frac{1}{e_{3t}} \; \delta_k \lt[ \, \frac{A^{vS}_w}{e_{3w}} \delta_{k + 1/2}[S] \, \rt] 
     
    651660respectively. 
    652661Generally, $A_w^{vT} = A_w^{vS}$ except when double diffusive mixing is parameterised 
    653 (\ie \key{zdfddm} is defined). 
     662(\ie\ \np{ln\_zdfddm}\forcode{=.true.},). 
    654663The way these coefficients are evaluated is given in \autoref{chap:ZDF} (ZDF). 
    655664Furthermore, when iso-neutral mixing is used, both mixing coefficients are increased by 
    656665$\frac{e_{1w} e_{2w}}{e_{3w} }({r_{1w}^2 + r_{2w}^2})$ to account for the vertical second derivative of 
    657 \autoref{eq:tra_ldf_iso}. 
     666\autoref{eq:TRA_ldf_iso}. 
    658667 
    659668At the surface and bottom boundaries, the turbulent fluxes of heat and salt must be specified. 
     
    663672 
    664673The large eddy coefficient found in the mixed layer together with high vertical resolution implies that 
    665 in the case of explicit time stepping (\np{ln\_zdfexp}~\forcode{= .true.}) 
    666 there would be too restrictive a constraint on the time step. 
    667 Therefore, the default implicit time stepping is preferred for the vertical diffusion since 
     674there would be too restrictive constraint on the time step if we use explicit time stepping. 
     675Therefore an implicit time stepping is preferred for the vertical diffusion since 
    668676it overcomes the stability constraint. 
    669 A forward time differencing scheme (\np{ln\_zdfexp}~\forcode{= .true.}) using 
    670 a time splitting technique (\np{nn\_zdfexp} $> 1$) is provided as an alternative. 
    671 Namelist variables \np{ln\_zdfexp} and \np{nn\_zdfexp} apply to both tracers and dynamics. 
    672677 
    673678% ================================================================ 
     
    680685%        surface boundary condition 
    681686% ------------------------------------------------------------------------------------------------------------- 
    682 \subsection{Surface boundary condition (\protect\mdl{trasbc})} 
     687\subsection[Surface boundary condition (\textit{trasbc.F90})] 
     688{Surface boundary condition (\protect\mdl{trasbc})} 
    683689\label{subsec:TRA_sbc} 
    684690 
     
    690696 
    691697Due to interactions and mass exchange of water ($F_{mass}$) with other Earth system components 
    692 (\ie atmosphere, sea-ice, land), the change in the heat and salt content of the surface layer of the ocean is due 
     698(\ie\ atmosphere, sea-ice, land), the change in the heat and salt content of the surface layer of the ocean is due 
    693699both to the heat and salt fluxes crossing the sea surface (not linked with $F_{mass}$) and 
    694700to the heat and salt content of the mass exchange. 
     
    702708\item 
    703709  $Q_{ns}$, the non-solar part of the net surface heat flux that crosses the sea surface 
    704   (\ie the difference between the total surface heat flux and the fraction of the short wave flux that 
     710  (\ie\ the difference between the total surface heat flux and the fraction of the short wave flux that 
    705711  penetrates into the water column, see \autoref{subsec:TRA_qsr}) 
    706712  plus the heat content associated with of the mass exchange with the atmosphere and lands. 
     
    720726The surface boundary condition on temperature and salinity is applied as follows: 
    721727\begin{equation} 
    722   \label{eq:tra_sbc} 
     728  \label{eq:TRA_sbc} 
    723729  \begin{alignedat}{2} 
    724730    F^T &= \frac{1}{C_p} &\frac{1}{\rho_o \lt. e_{3t} \rt|_{k = 1}} &\overline{Q_{ns}      }^t \\ 
     
    728734where $\overline x^t$ means that $x$ is averaged over two consecutive time steps 
    729735($t - \rdt / 2$ and $t + \rdt / 2$). 
    730 Such time averaging prevents the divergence of odd and even time step (see \autoref{chap:STP}). 
    731  
    732 In the linear free surface case (\np{ln\_linssh}~\forcode{= .true.}), an additional term has to be added on 
     736Such time averaging prevents the divergence of odd and even time step (see \autoref{chap:TD}). 
     737 
     738In the linear free surface case (\np{ln\_linssh}\forcode{=.true.}), an additional term has to be added on 
    733739both temperature and salinity. 
    734740On temperature, this term remove the heat content associated with mass exchange that has been added to $Q_{ns}$. 
     
    737743The resulting surface boundary condition is applied as follows: 
    738744\begin{equation} 
    739   \label{eq:tra_sbc_lin} 
     745  \label{eq:TRA_sbc_lin} 
    740746  \begin{alignedat}{2} 
    741747    F^T &= \frac{1}{C_p} &\frac{1}{\rho_o \lt. e_{3t} \rt|_{k = 1}} 
     
    744750          &\overline{(\textit{sfx} -        \textit{emp} \lt. S \rt|_{k = 1})}^t 
    745751  \end{alignedat} 
    746 \end{equation}  
     752\end{equation} 
    747753Note that an exact conservation of heat and salt content is only achieved with non-linear free surface. 
    748754In the linear free surface case, there is a small imbalance. 
    749 The imbalance is larger than the imbalance associated with the Asselin time filter \citep{Leclair_Madec_OM09}. 
    750 This is the reason why the modified filter is not applied in the linear free surface case (see \autoref{chap:STP}). 
    751  
    752 % ------------------------------------------------------------------------------------------------------------- 
    753 %        Solar Radiation Penetration  
    754 % ------------------------------------------------------------------------------------------------------------- 
    755 \subsection{Solar radiation penetration (\protect\mdl{traqsr})} 
     755The imbalance is larger than the imbalance associated with the Asselin time filter \citep{leclair.madec_OM09}. 
     756This is the reason why the modified filter is not applied in the linear free surface case (see \autoref{chap:TD}). 
     757 
     758% ------------------------------------------------------------------------------------------------------------- 
     759%        Solar Radiation Penetration 
     760% ------------------------------------------------------------------------------------------------------------- 
     761\subsection[Solar radiation penetration (\textit{traqsr.F90})] 
     762{Solar radiation penetration (\protect\mdl{traqsr})} 
    756763\label{subsec:TRA_qsr} 
    757764%--------------------------------------------namqsr-------------------------------------------------------- 
    758765 
    759 \nlst{namtra_qsr} 
     766\begin{listing} 
     767  \nlst{namtra_qsr} 
     768  \caption{\texttt{namtra\_qsr}} 
     769  \label{lst:namtra_qsr} 
     770\end{listing} 
    760771%-------------------------------------------------------------------------------------------------------------- 
    761772 
    762 Options are defined through the \ngn{namtra\_qsr} namelist variables. 
    763 When the penetrative solar radiation option is used (\np{ln\_flxqsr}~\forcode{= .true.}), 
     773Options are defined through the \nam{tra\_qsr} namelist variables. 
     774When the penetrative solar radiation option is used (\np{ln\_traqsr}\forcode{=.true.}), 
    764775the solar radiation penetrates the top few tens of meters of the ocean. 
    765 If it is not used (\np{ln\_flxqsr}~\forcode{= .false.}) all the heat flux is absorbed in the first ocean level. 
    766 Thus, in the former case a term is added to the time evolution equation of temperature \autoref{eq:PE_tra_T} and 
    767 the surface boundary condition is modified to take into account only the non-penetrative part of the surface  
     776If it is not used (\np{ln\_traqsr}\forcode{=.false.}) all the heat flux is absorbed in the first ocean level. 
     777Thus, in the former case a term is added to the time evolution equation of temperature \autoref{eq:MB_PE_tra_T} and 
     778the surface boundary condition is modified to take into account only the non-penetrative part of the surface 
    768779heat flux: 
    769780\begin{equation} 
    770   \label{eq:PE_qsr} 
     781  \label{eq:TRA_PE_qsr} 
    771782  \begin{gathered} 
    772783    \pd[T]{t} = \ldots + \frac{1}{\rho_o \, C_p \, e_3} \; \pd[I]{k} \\ 
     
    774785  \end{gathered} 
    775786\end{equation} 
    776 where $Q_{sr}$ is the penetrative part of the surface heat flux (\ie the shortwave radiation) and 
     787where $Q_{sr}$ is the penetrative part of the surface heat flux (\ie\ the shortwave radiation) and 
    777788$I$ is the downward irradiance ($\lt. I \rt|_{z = \eta} = Q_{sr}$). 
    778 The additional term in \autoref{eq:PE_qsr} is discretized as follows: 
    779 \begin{equation} 
    780   \label{eq:tra_qsr} 
     789The additional term in \autoref{eq:TRA_PE_qsr} is discretized as follows: 
     790\begin{equation} 
     791  \label{eq:TRA_qsr} 
    781792  \frac{1}{\rho_o \, C_p \, e_3} \, \pd[I]{k} \equiv \frac{1}{\rho_o \, C_p \, e_{3t}} \delta_k [I_w] 
    782793\end{equation} 
     
    788799(specified through namelist parameter \np{rn\_abs}). 
    789800It is assumed to penetrate the ocean with a decreasing exponential profile, with an e-folding depth scale, $\xi_0$, 
    790 of a few tens of centimetres (typically $\xi_0 = 0.35~m$ set as \np{rn\_si0} in the \ngn{namtra\_qsr} namelist). 
     801of a few tens of centimetres (typically $\xi_0 = 0.35~m$ set as \np{rn\_si0} in the \nam{tra\_qsr} namelist). 
    791802For shorter wavelengths (400-700~nm), the ocean is more transparent, and solar energy propagates to 
    792803larger depths where it contributes to local heating. 
    793804The way this second part of the solar energy penetrates into the ocean depends on which formulation is chosen. 
    794 In the simple 2-waveband light penetration scheme (\np{ln\_qsr\_2bd}~\forcode{= .true.}) 
     805In the simple 2-waveband light penetration scheme (\np{ln\_qsr\_2bd}\forcode{=.true.}) 
    795806a chlorophyll-independent monochromatic formulation is chosen for the shorter wavelengths, 
    796 leading to the following expression \citep{Paulson1977}: 
     807leading to the following expression \citep{paulson.simpson_JPO77}: 
    797808\[ 
    798   % \label{eq:traqsr_iradiance} 
     809  % \label{eq:TRA_qsr_iradiance} 
    799810  I(z) = Q_{sr} \lt[ Re^{- z / \xi_0} + (1 - R) e^{- z / \xi_1} \rt] 
    800811\] 
     
    805816 
    806817Such assumptions have been shown to provide a very crude and simplistic representation of 
    807 observed light penetration profiles (\cite{Morel_JGR88}, see also \autoref{fig:traqsr_irradiance}). 
     818observed light penetration profiles (\cite{morel_JGR88}, see also \autoref{fig:TRA_qsr_irradiance}). 
    808819Light absorption in the ocean depends on particle concentration and is spectrally selective. 
    809 \cite{Morel_JGR88} has shown that an accurate representation of light penetration can be provided by 
     820\cite{morel_JGR88} has shown that an accurate representation of light penetration can be provided by 
    810821a 61 waveband formulation. 
    811822Unfortunately, such a model is very computationally expensive. 
    812 Thus, \cite{Lengaigne_al_CD07} have constructed a simplified version of this formulation in which 
     823Thus, \cite{lengaigne.menkes.ea_CD07} have constructed a simplified version of this formulation in which 
    813824visible light is split into three wavebands: blue (400-500 nm), green (500-600 nm) and red (600-700nm). 
    814825For each wave-band, the chlorophyll-dependent attenuation coefficient is fitted to the coefficients computed from 
    815 the full spectral model of \cite{Morel_JGR88} (as modified by \cite{Morel_Maritorena_JGR01}), 
     826the full spectral model of \cite{morel_JGR88} (as modified by \cite{morel.maritorena_JGR01}), 
    816827assuming the same power-law relationship. 
    817 As shown in \autoref{fig:traqsr_irradiance}, this formulation, called RGB (Red-Green-Blue), 
     828As shown in \autoref{fig:TRA_qsr_irradiance}, this formulation, called RGB (Red-Green-Blue), 
    818829reproduces quite closely the light penetration profiles predicted by the full spectal model, 
    819830but with much greater computational efficiency. 
    820831The 2-bands formulation does not reproduce the full model very well. 
    821832 
    822 The RGB formulation is used when \np{ln\_qsr\_rgb}~\forcode{= .true.}. 
    823 The RGB attenuation coefficients (\ie the inverses of the extinction length scales) are tabulated over 
     833The RGB formulation is used when \np{ln\_qsr\_rgb}\forcode{=.true.}. 
     834The RGB attenuation coefficients (\ie\ the inverses of the extinction length scales) are tabulated over 
    82483561 nonuniform chlorophyll classes ranging from 0.01 to 10 g.Chl/L 
    825836(see the routine \rou{trc\_oce\_rgb} in \mdl{trc\_oce} module). 
     
    827838 
    828839\begin{description} 
    829 \item[\np{nn\_chdta}~\forcode{= 0}] 
    830   a constant 0.05 g.Chl/L value everywhere ;  
    831 \item[\np{nn\_chdta}~\forcode{= 1}] 
     840\item[\np{nn\_chldta}\forcode{=0}] 
     841  a constant 0.05 g.Chl/L value everywhere ; 
     842\item[\np{nn\_chldta}\forcode{=1}] 
    832843  an observed time varying chlorophyll deduced from satellite surface ocean color measurement spread uniformly in 
    833844  the vertical direction; 
    834 \item[\np{nn\_chdta}~\forcode{= 2}] 
     845\item[\np{nn\_chldta}\forcode{=2}] 
    835846  same as previous case except that a vertical profile of chlorophyl is used. 
    836   Following \cite{Morel_Berthon_LO89}, the profile is computed from the local surface chlorophyll value; 
    837 \item[\np{ln\_qsr\_bio}~\forcode{= .true.}] 
     847  Following \cite{morel.berthon_LO89}, the profile is computed from the local surface chlorophyll value; 
     848\item[\np{ln\_qsr\_bio}\forcode{=.true.}] 
    838849  simulated time varying chlorophyll by TOP biogeochemical model. 
    839850  In this case, the RGB formulation is used to calculate both the phytoplankton light limitation in 
    840   PISCES or LOBSTER and the oceanic heating rate. 
    841 \end{description}  
    842  
    843 The trend in \autoref{eq:tra_qsr} associated with the penetration of the solar radiation is added to 
     851  PISCES and the oceanic heating rate. 
     852\end{description} 
     853 
     854The trend in \autoref{eq:TRA_qsr} associated with the penetration of the solar radiation is added to 
    844855the temperature trend, and the surface heat flux is modified in routine \mdl{traqsr}. 
    845856 
     
    847858the depth of $w-$levels does not significantly vary with location. 
    848859The level at which the light has been totally absorbed 
    849 (\ie it is less than the computer precision) is computed once, 
     860(\ie\ it is less than the computer precision) is computed once, 
    850861and the trend associated with the penetration of the solar radiation is only added down to that level. 
    851862Finally, note that when the ocean is shallow ($<$ 200~m), part of the solar radiation can reach the ocean floor. 
    852863In this case, we have chosen that all remaining radiation is absorbed in the last ocean level 
    853 (\ie $I$ is masked). 
     864(\ie\ $I$ is masked). 
    854865 
    855866%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    856867\begin{figure}[!t] 
    857   \begin{center} 
    858     \includegraphics[]{Fig_TRA_Irradiance} 
    859     \caption{ 
    860       \protect\label{fig:traqsr_irradiance} 
    861       Penetration profile of the downward solar irradiance calculated by four models. 
    862       Two waveband chlorophyll-independent formulation (blue), 
    863       a chlorophyll-dependent monochromatic formulation (green), 
    864       4 waveband RGB formulation (red), 
    865       61 waveband Morel (1988) formulation (black) for a chlorophyll concentration of 
    866       (a) Chl=0.05 mg/m$^3$ and (b) Chl=0.5 mg/m$^3$. 
    867       From \citet{Lengaigne_al_CD07}. 
    868     } 
    869   \end{center} 
     868  \centering 
     869  \includegraphics[width=\textwidth]{Fig_TRA_Irradiance} 
     870  \caption[Penetration profile of the downward solar irradiance calculated by four models]{ 
     871    Penetration profile of the downward solar irradiance calculated by four models. 
     872    Two waveband chlorophyll-independent formulation (blue), 
     873    a chlorophyll-dependent monochromatic formulation (green), 
     874    4 waveband RGB formulation (red), 
     875    61 waveband Morel (1988) formulation (black) for a chlorophyll concentration of 
     876    (a) Chl=0.05 mg/m$^3$ and (b) Chl=0.5 mg/m$^3$. 
     877    From \citet{lengaigne.menkes.ea_CD07}.} 
     878  \label{fig:TRA_qsr_irradiance} 
    870879\end{figure} 
    871880%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    874883%        Bottom Boundary Condition 
    875884% ------------------------------------------------------------------------------------------------------------- 
    876 \subsection{Bottom boundary condition (\protect\mdl{trabbc})} 
     885\subsection[Bottom boundary condition (\textit{trabbc.F90}) - \forcode{ln_trabbc=.true.})] 
     886{Bottom boundary condition (\protect\mdl{trabbc})} 
    877887\label{subsec:TRA_bbc} 
    878888%--------------------------------------------nambbc-------------------------------------------------------- 
    879889 
    880 \nlst{nambbc} 
     890\begin{listing} 
     891  \nlst{nambbc} 
     892  \caption{\texttt{nambbc}} 
     893  \label{lst:nambbc} 
     894\end{listing} 
    881895%-------------------------------------------------------------------------------------------------------------- 
    882896%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    883897\begin{figure}[!t] 
    884   \begin{center} 
    885     \includegraphics[]{Fig_TRA_geoth} 
    886     \caption{ 
    887       \protect\label{fig:geothermal} 
    888       Geothermal Heat flux (in $mW.m^{-2}$) used by \cite{Emile-Geay_Madec_OS09}. 
    889       It is inferred from the age of the sea floor and the formulae of \citet{Stein_Stein_Nat92}. 
    890     } 
    891   \end{center} 
     898  \centering 
     899  \includegraphics[width=\textwidth]{Fig_TRA_geoth} 
     900  \caption[Geothermal heat flux]{ 
     901    Geothermal Heat flux (in $mW.m^{-2}$) used by \cite{emile-geay.madec_OS09}. 
     902    It is inferred from the age of the sea floor and the formulae of \citet{stein.stein_N92}.} 
     903  \label{fig:TRA_geothermal} 
    892904\end{figure} 
    893905%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    894906 
    895907Usually it is assumed that there is no exchange of heat or salt through the ocean bottom, 
    896 \ie a no flux boundary condition is applied on active tracers at the bottom. 
     908\ie\ a no flux boundary condition is applied on active tracers at the bottom. 
    897909This is the default option in \NEMO, and it is implemented using the masking technique. 
    898910However, there is a non-zero heat flux across the seafloor that is associated with solid earth cooling. 
    899 This flux is weak compared to surface fluxes (a mean global value of $\sim 0.1 \, W/m^2$ \citep{Stein_Stein_Nat92}), 
     911This flux is weak compared to surface fluxes (a mean global value of $\sim 0.1 \, W/m^2$ \citep{stein.stein_N92}), 
    900912but it warms systematically the ocean and acts on the densest water masses. 
    901913Taking this flux into account in a global ocean model increases the deepest overturning cell 
    902 (\ie the one associated with the Antarctic Bottom Water) by a few Sverdrups \citep{Emile-Geay_Madec_OS09}. 
    903  
    904 Options are defined through the  \ngn{namtra\_bbc} namelist variables. 
     914(\ie\ the one associated with the Antarctic Bottom Water) by a few Sverdrups \citep{emile-geay.madec_OS09}. 
     915 
     916Options are defined through the \nam{bbc} namelist variables. 
    905917The presence of geothermal heating is controlled by setting the namelist parameter \np{ln\_trabbc} to true. 
    906918Then, when \np{nn\_geoflx} is set to 1, a constant geothermal heating is introduced whose value is given by 
    907 the \np{nn\_geoflx\_cst}, which is also a namelist parameter. 
     919the \np{rn\_geoflx\_cst}, which is also a namelist parameter. 
    908920When \np{nn\_geoflx} is set to 2, a spatially varying geothermal heat flux is introduced which is provided in 
    909 the \ifile{geothermal\_heating} NetCDF file (\autoref{fig:geothermal}) \citep{Emile-Geay_Madec_OS09}. 
     921the \ifile{geothermal\_heating} NetCDF file (\autoref{fig:TRA_geothermal}) \citep{emile-geay.madec_OS09}. 
    910922 
    911923% ================================================================ 
    912924% Bottom Boundary Layer 
    913925% ================================================================ 
    914 \section{Bottom boundary layer (\protect\mdl{trabbl} - \protect\key{trabbl})} 
     926\section[Bottom boundary layer (\textit{trabbl.F90} - \forcode{ln_trabbl=.true.})] 
     927{Bottom boundary layer (\protect\mdl{trabbl} - \protect\np{ln\_trabbl}\forcode{=.true.})} 
    915928\label{sec:TRA_bbl} 
    916929%--------------------------------------------nambbl--------------------------------------------------------- 
    917930 
    918 \nlst{nambbl} 
     931\begin{listing} 
     932  \nlst{nambbl} 
     933  \caption{\texttt{nambbl}} 
     934  \label{lst:nambbl} 
     935\end{listing} 
    919936%-------------------------------------------------------------------------------------------------------------- 
    920937 
    921 Options are defined through the \ngn{nambbl} namelist variables. 
     938Options are defined through the \nam{bbl} namelist variables. 
    922939In a $z$-coordinate configuration, the bottom topography is represented by a series of discrete steps. 
    923940This is not adequate to represent gravity driven downslope flows. 
     
    931948sometimes over a thickness much larger than the thickness of the observed gravity plume. 
    932949A similar problem occurs in the $s$-coordinate when the thickness of the bottom level varies rapidly downstream of 
    933 a sill \citep{Willebrand_al_PO01}, and the thickness of the plume is not resolved. 
    934  
    935 The idea of the bottom boundary layer (BBL) parameterisation, first introduced by \citet{Beckmann_Doscher1997}, 
     950a sill \citep{willebrand.barnier.ea_PO01}, and the thickness of the plume is not resolved. 
     951 
     952The idea of the bottom boundary layer (BBL) parameterisation, first introduced by \citet{beckmann.doscher_JPO97}, 
    936953is to allow a direct communication between two adjacent bottom cells at different levels, 
    937954whenever the densest water is located above the less dense water. 
     
    939956In the current implementation of the BBL, only the tracers are modified, not the velocities. 
    940957Furthermore, it only connects ocean bottom cells, and therefore does not include all the improvements introduced by 
    941 \citet{Campin_Goosse_Tel99}. 
     958\citet{campin.goosse_T99}. 
    942959 
    943960% ------------------------------------------------------------------------------------------------------------- 
    944961%        Diffusive BBL 
    945962% ------------------------------------------------------------------------------------------------------------- 
    946 \subsection{Diffusive bottom boundary layer (\protect\np{nn\_bbl\_ldf}~\forcode{= 1})} 
     963\subsection[Diffusive bottom boundary layer (\forcode{nn_bbl_ldf=1})] 
     964{Diffusive bottom boundary layer (\protect\np{nn\_bbl\_ldf}\forcode{=1})} 
    947965\label{subsec:TRA_bbl_diff} 
    948966 
    949 When applying sigma-diffusion (\key{trabbl} defined and \np{nn\_bbl\_ldf} set to 1), 
    950 the diffusive flux between two adjacent cells at the ocean floor is given by  
     967When applying sigma-diffusion (\np{ln\_trabbl}\forcode{=.true.} and \np{nn\_bbl\_ldf} set to 1), 
     968the diffusive flux between two adjacent cells at the ocean floor is given by 
    951969\[ 
    952   % \label{eq:tra_bbl_diff} 
     970  % \label{eq:TRA_bbl_diff} 
    953971  \vect F_\sigma = A_l^\sigma \, \nabla_\sigma T 
    954972\] 
    955973with $\nabla_\sigma$ the lateral gradient operator taken between bottom cells, and 
    956974$A_l^\sigma$ the lateral diffusivity in the BBL. 
    957 Following \citet{Beckmann_Doscher1997}, the latter is prescribed with a spatial dependence, 
    958 \ie in the conditional form 
    959 \begin{equation} 
    960   \label{eq:tra_bbl_coef} 
     975Following \citet{beckmann.doscher_JPO97}, the latter is prescribed with a spatial dependence, 
     976\ie\ in the conditional form 
     977\begin{equation} 
     978  \label{eq:TRA_bbl_coef} 
    961979  A_l^\sigma (i,j,t) = 
    962980      \begin{cases} 
     
    968986where $A_{bbl}$ is the BBL diffusivity coefficient, given by the namelist parameter \np{rn\_ahtbbl} and 
    969987usually set to a value much larger than the one used for lateral mixing in the open ocean. 
    970 The constraint in \autoref{eq:tra_bbl_coef} implies that sigma-like diffusion only occurs when 
     988The constraint in \autoref{eq:TRA_bbl_coef} implies that sigma-like diffusion only occurs when 
    971989the density above the sea floor, at the top of the slope, is larger than in the deeper ocean 
    972 (see green arrow in \autoref{fig:bbl}). 
     990(see green arrow in \autoref{fig:TRA_bbl}). 
    973991In practice, this constraint is applied separately in the two horizontal directions, 
    974 and the density gradient in \autoref{eq:tra_bbl_coef} is evaluated with the log gradient formulation:  
     992and the density gradient in \autoref{eq:TRA_bbl_coef} is evaluated with the log gradient formulation: 
    975993\[ 
    976   % \label{eq:tra_bbl_Drho} 
     994  % \label{eq:TRA_bbl_Drho} 
    977995  \nabla_\sigma \rho / \rho = \alpha \, \nabla_\sigma T + \beta \, \nabla_\sigma S 
    978996\] 
     
    9831001%        Advective BBL 
    9841002% ------------------------------------------------------------------------------------------------------------- 
    985 \subsection{Advective bottom boundary layer  (\protect\np{nn\_bbl\_adv}~\forcode{= 1..2})} 
     1003\subsection[Advective bottom boundary layer (\forcode{nn_bbl_adv=[12]})] 
     1004{Advective bottom boundary layer (\protect\np{nn\_bbl\_adv}\forcode{=[12]})} 
    9861005\label{subsec:TRA_bbl_adv} 
    9871006 
     
    9931012%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    9941013\begin{figure}[!t] 
    995   \begin{center} 
    996     \includegraphics[]{Fig_BBL_adv} 
    997     \caption{ 
    998       \protect\label{fig:bbl} 
    999       Advective/diffusive Bottom Boundary Layer. 
    1000       The BBL parameterisation is activated when $\rho^i_{kup}$ is larger than $\rho^{i + 1}_{kdnw}$. 
    1001       Red arrows indicate the additional overturning circulation due to the advective BBL. 
    1002       The transport of the downslope flow is defined either as the transport of the bottom ocean cell (black arrow), 
    1003       or as a function of the along slope density gradient. 
    1004       The green arrow indicates the diffusive BBL flux directly connecting $kup$ and $kdwn$ ocean bottom cells. 
    1005     } 
    1006   \end{center} 
     1014  \centering 
     1015  \includegraphics[width=\textwidth]{Fig_BBL_adv} 
     1016  \caption[Advective/diffusive bottom boundary layer]{ 
     1017    Advective/diffusive Bottom Boundary Layer. 
     1018    The BBL parameterisation is activated when $\rho^i_{kup}$ is larger than $\rho^{i + 1}_{kdnw}$. 
     1019    Red arrows indicate the additional overturning circulation due to the advective BBL. 
     1020    The transport of the downslope flow is defined either 
     1021    as the transport of the bottom ocean cell (black arrow), 
     1022    or as a function of the along slope density gradient. 
     1023    The green arrow indicates the diffusive BBL flux directly connecting 
     1024    $kup$ and $kdwn$ ocean bottom cells.} 
     1025  \label{fig:TRA_bbl} 
    10071026\end{figure} 
    10081027%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    10141033%%%gmcomment   :  this section has to be really written 
    10151034 
    1016 When applying an advective BBL (\np{nn\_bbl\_adv}~\forcode{= 1..2}), an overturning circulation is added which 
     1035When applying an advective BBL (\np{nn\_bbl\_adv}\forcode{=1..2}), an overturning circulation is added which 
    10171036connects two adjacent bottom grid-points only if dense water overlies less dense water on the slope. 
    10181037The density difference causes dense water to move down the slope. 
    10191038 
    1020 \np{nn\_bbl\_adv}~\forcode{= 1}: 
     1039\np{nn\_bbl\_adv}\forcode{=1}: 
    10211040the downslope velocity is chosen to be the Eulerian ocean velocity just above the topographic step 
    1022 (see black arrow in \autoref{fig:bbl}) \citep{Beckmann_Doscher1997}. 
     1041(see black arrow in \autoref{fig:TRA_bbl}) \citep{beckmann.doscher_JPO97}. 
    10231042It is a \textit{conditional advection}, that is, advection is allowed only 
    1024 if dense water overlies less dense water on the slope (\ie $\nabla_\sigma \rho \cdot \nabla H < 0$) and 
    1025 if the velocity is directed towards greater depth (\ie $\vect U \cdot \nabla H > 0$). 
    1026  
    1027 \np{nn\_bbl\_adv}~\forcode{= 2}: 
     1043if dense water overlies less dense water on the slope (\ie\ $\nabla_\sigma \rho \cdot \nabla H < 0$) and 
     1044if the velocity is directed towards greater depth (\ie\ $\vect U \cdot \nabla H > 0$). 
     1045 
     1046\np{nn\_bbl\_adv}\forcode{=2}: 
    10281047the downslope velocity is chosen to be proportional to $\Delta \rho$, 
    1029 the density difference between the higher cell and lower cell densities \citep{Campin_Goosse_Tel99}. 
     1048the density difference between the higher cell and lower cell densities \citep{campin.goosse_T99}. 
    10301049The advection is allowed only  if dense water overlies less dense water on the slope 
    1031 (\ie $\nabla_\sigma \rho \cdot \nabla H < 0$). 
    1032 For example, the resulting transport of the downslope flow, here in the $i$-direction (\autoref{fig:bbl}), 
     1050(\ie\ $\nabla_\sigma \rho \cdot \nabla H < 0$). 
     1051For example, the resulting transport of the downslope flow, here in the $i$-direction (\autoref{fig:TRA_bbl}), 
    10331052is simply given by the following expression: 
    10341053\[ 
    1035   % \label{eq:bbl_Utr} 
     1054  % \label{eq:TRA_bbl_Utr} 
    10361055  u^{tr}_{bbl} = \gamma g \frac{\Delta \rho}{\rho_o} e_{1u} \, min ({e_{3u}}_{kup},{e_{3u}}_{kdwn}) 
    10371056\] 
     
    10411060The parameter $\gamma$ should take a different value for each bathymetric step, but for simplicity, 
    10421061and because no direct estimation of this parameter is available, a uniform value has been assumed. 
    1043 The possible values for $\gamma$ range between 1 and $10~s$ \citep{Campin_Goosse_Tel99}. 
     1062The possible values for $\gamma$ range between 1 and $10~s$ \citep{campin.goosse_T99}. 
    10441063 
    10451064Scalar properties are advected by this additional transport $(u^{tr}_{bbl},v^{tr}_{bbl})$ using the upwind scheme. 
     
    10471066the surrounding water at intermediate depths. 
    10481067The entrainment is replaced by the vertical mixing implicit in the advection scheme. 
    1049 Let us consider as an example the case displayed in \autoref{fig:bbl} where 
     1068Let us consider as an example the case displayed in \autoref{fig:TRA_bbl} where 
    10501069the density at level $(i,kup)$ is larger than the one at level $(i,kdwn)$. 
    10511070The advective BBL scheme modifies the tracer time tendency of the ocean cells near the topographic step by 
    1052 the downslope flow \autoref{eq:bbl_dw}, the horizontal \autoref{eq:bbl_hor} and 
    1053 the upward \autoref{eq:bbl_up} return flows as follows:  
     1071the downslope flow \autoref{eq:TRA_bbl_dw}, the horizontal \autoref{eq:TRA_bbl_hor} and 
     1072the upward \autoref{eq:TRA_bbl_up} return flows as follows: 
    10541073\begin{alignat}{3} 
    1055   \label{eq:bbl_dw} 
     1074  \label{eq:TRA_bbl_dw} 
    10561075  \partial_t T^{do}_{kdw} &\equiv \partial_t T^{do}_{kdw} 
    10571076                                &&+ \frac{u^{tr}_{bbl}}{{b_t}^{do}_{kdw}} &&\lt( T^{sh}_{kup} - T^{do}_{kdw} \rt) \\ 
    1058   \label{eq:bbl_hor} 
     1077  \label{eq:TRA_bbl_hor} 
    10591078  \partial_t T^{sh}_{kup} &\equiv \partial_t T^{sh}_{kup} 
    10601079                                &&+ \frac{u^{tr}_{bbl}}{{b_t}^{sh}_{kup}} &&\lt( T^{do}_{kup} - T^{sh}_{kup} \rt) \\ 
     
    10621081  \intertext{and for $k =kdw-1,\;..., \; kup$ :} 
    10631082  % 
    1064   \label{eq:bbl_up} 
     1083  \label{eq:TRA_bbl_up} 
    10651084  \partial_t T^{do}_{k} &\equiv \partial_t S^{do}_{k} 
    10661085                                &&+ \frac{u^{tr}_{bbl}}{{b_t}^{do}_{k}}   &&\lt( T^{do}_{k +1} - T^{sh}_{k}   \rt) 
     
    10741093% Tracer damping 
    10751094% ================================================================ 
    1076 \section{Tracer damping (\protect\mdl{tradmp})} 
     1095\section[Tracer damping (\textit{tradmp.F90})] 
     1096{Tracer damping (\protect\mdl{tradmp})} 
    10771097\label{sec:TRA_dmp} 
    10781098%--------------------------------------------namtra_dmp------------------------------------------------- 
    10791099 
    1080 \nlst{namtra_dmp} 
     1100\begin{listing} 
     1101  \nlst{namtra_dmp} 
     1102  \caption{\texttt{namtra\_dmp}} 
     1103  \label{lst:namtra_dmp} 
     1104\end{listing} 
    10811105%-------------------------------------------------------------------------------------------------------------- 
    10821106 
    10831107In some applications it can be useful to add a Newtonian damping term into the temperature and salinity equations: 
    10841108\begin{equation} 
    1085   \label{eq:tra_dmp} 
     1109  \label{eq:TRA_dmp} 
    10861110  \begin{gathered} 
    10871111    \pd[T]{t} = \cdots - \gamma (T - T_o) \\ 
    10881112    \pd[S]{t} = \cdots - \gamma (S - S_o) 
    10891113  \end{gathered} 
    1090 \end{equation}  
     1114\end{equation} 
    10911115where $\gamma$ is the inverse of a time scale, and $T_o$ and $S_o$ are given temperature and salinity fields 
    10921116(usually a climatology). 
    1093 Options are defined through the  \ngn{namtra\_dmp} namelist variables. 
     1117Options are defined through the  \nam{tra\_dmp} namelist variables. 
    10941118The restoring term is added when the namelist parameter \np{ln\_tradmp} is set to true. 
    1095 It also requires that both \np{ln\_tsd\_init} and \np{ln\_tsd\_tradmp} are set to true in 
    1096 \ngn{namtsd} namelist as well as \np{sn\_tem} and \np{sn\_sal} structures are correctly set 
    1097 (\ie that $T_o$ and $S_o$ are provided in input files and read using \mdl{fldread}, 
     1119It also requires that both \np{ln\_tsd\_init} and \np{ln\_tsd\_dmp} are set to true in 
     1120\nam{tsd} namelist as well as \np{sn\_tem} and \np{sn\_sal} structures are correctly set 
     1121(\ie\ that $T_o$ and $S_o$ are provided in input files and read using \mdl{fldread}, 
    10981122see \autoref{subsec:SBC_fldread}). 
    10991123The restoring coefficient $\gamma$ is a three-dimensional array read in during the \rou{tra\_dmp\_init} routine. 
     
    11011125The DMP\_TOOLS tool is provided to allow users to generate the netcdf file. 
    11021126 
    1103 The two main cases in which \autoref{eq:tra_dmp} is used are 
     1127The two main cases in which \autoref{eq:TRA_dmp} is used are 
    11041128\textit{(a)} the specification of the boundary conditions along artificial walls of a limited domain basin and 
    11051129\textit{(b)} the computation of the velocity field associated with a given $T$-$S$ field 
     
    11091133In the vicinity of these walls, $\gamma$ takes large values (equivalent to a time scale of a few days) whereas 
    11101134it is zero in the interior of the model domain. 
    1111 The second case corresponds to the use of the robust diagnostic method \citep{Sarmiento1982}. 
     1135The second case corresponds to the use of the robust diagnostic method \citep{sarmiento.bryan_JGR82}. 
    11121136It allows us to find the velocity field consistent with the model dynamics whilst 
    11131137having a $T$, $S$ field close to a given climatological field ($T_o$, $S_o$). 
     
    11211145only below the mixed layer (defined either on a density or $S_o$ criterion). 
    11221146It is common to set the damping to zero in the mixed layer as the adjustment time scale is short here 
    1123 \citep{Madec_al_JPO96}. 
     1147\citep{madec.delecluse.ea_JPO96}. 
    11241148 
    11251149For generating \ifile{resto}, see the documentation for the DMP tool provided with the source code under 
     
    11291153% Tracer time evolution 
    11301154% ================================================================ 
    1131 \section{Tracer time evolution (\protect\mdl{tranxt})} 
     1155\section[Tracer time evolution (\textit{tranxt.F90})] 
     1156{Tracer time evolution (\protect\mdl{tranxt})} 
    11321157\label{sec:TRA_nxt} 
    11331158%--------------------------------------------namdom----------------------------------------------------- 
    1134  
    1135 \nlst{namdom} 
    11361159%-------------------------------------------------------------------------------------------------------------- 
    11371160 
    1138 Options are defined through the \ngn{namdom} namelist variables. 
    1139 The general framework for tracer time stepping is a modified leap-frog scheme \citep{Leclair_Madec_OM09}, 
    1140 \ie a three level centred time scheme associated with a Asselin time filter (cf. \autoref{sec:STP_mLF}): 
    1141 \begin{equation} 
    1142   \label{eq:tra_nxt} 
     1161Options are defined through the \nam{dom} namelist variables. 
     1162The general framework for tracer time stepping is a modified leap-frog scheme \citep{leclair.madec_OM09}, 
     1163\ie\ a three level centred time scheme associated with a Asselin time filter (cf. \autoref{sec:TD_mLF}): 
     1164\begin{equation} 
     1165  \label{eq:TRA_nxt} 
    11431166  \begin{alignedat}{3} 
    11441167    &(e_{3t}T)^{t + \rdt} &&= (e_{3t}T)_f^{t - \rdt} &&+ 2 \, \rdt \,e_{3t}^t \ \text{RHS}^t \\ 
    11451168    &(e_{3t}T)_f^t        &&= (e_{3t}T)^t            &&+ \, \gamma \, \lt[ (e_{3t}T)_f^{t - \rdt} - 2(e_{3t}T)^t + (e_{3t}T)^{t + \rdt} \rt] \\ 
    1146     &                     &&                         &&- \, \gamma \, \rdt \, \lt[ Q^{t + \rdt/2} - Q^{t - \rdt/2} \rt]   
     1169    &                     &&                         &&- \, \gamma \, \rdt \, \lt[ Q^{t + \rdt/2} - Q^{t - \rdt/2} \rt] 
    11471170  \end{alignedat} 
    1148 \end{equation}  
     1171\end{equation} 
    11491172where RHS is the right hand side of the temperature equation, the subscript $f$ denotes filtered values, 
    11501173$\gamma$ is the Asselin coefficient, and $S$ is the total forcing applied on $T$ 
    1151 (\ie fluxes plus content in mass exchanges). 
     1174(\ie\ fluxes plus content in mass exchanges). 
    11521175$\gamma$ is initialized as \np{rn\_atfp} (\textbf{namelist} parameter). 
    1153 Its default value is \np{rn\_atfp}~\forcode{= 10.e-3}. 
     1176Its default value is \np{rn\_atfp}\forcode{=10.e-3}. 
    11541177Note that the forcing correction term in the filter is not applied in linear free surface 
    1155 (\jp{lk\_vvl}~\forcode{= .false.}) (see \autoref{subsec:TRA_sbc}). 
     1178(\jp{ln\_linssh}\forcode{=.true.}) (see \autoref{subsec:TRA_sbc}). 
    11561179Not also that in constant volume case, the time stepping is performed on $T$, not on its content, $e_{3t}T$. 
    11571180 
     
    11641187 
    11651188% ================================================================ 
    1166 % Equation of State (eosbn2)  
    1167 % ================================================================ 
    1168 \section{Equation of state (\protect\mdl{eosbn2}) } 
     1189% Equation of State (eosbn2) 
     1190% ================================================================ 
     1191\section[Equation of state (\textit{eosbn2.F90})] 
     1192{Equation of state (\protect\mdl{eosbn2})} 
    11691193\label{sec:TRA_eosbn2} 
    11701194%--------------------------------------------nameos----------------------------------------------------- 
    11711195 
    1172 \nlst{nameos} 
     1196\begin{listing} 
     1197  \nlst{nameos} 
     1198  \caption{\texttt{nameos}} 
     1199  \label{lst:nameos} 
     1200\end{listing} 
    11731201%-------------------------------------------------------------------------------------------------------------- 
    11741202 
     
    11761204%        Equation of State 
    11771205% ------------------------------------------------------------------------------------------------------------- 
    1178 \subsection{Equation of seawater (\protect\np{nn\_eos}~\forcode{= -1..1})} 
     1206\subsection[Equation of seawater (\texttt{ln}\{\texttt{\_teso10,\_eos80,\_seos}\})] 
     1207{Equation of seawater (\protect\np{ln\_teos10}, \protect\np{ln\_teos80}, or \protect\np{ln\_seos}) } 
    11791208\label{subsec:TRA_eos} 
     1209 
    11801210 
    11811211The Equation Of Seawater (EOS) is an empirical nonlinear thermodynamic relationship linking seawater density, 
     
    11861216Nonlinearities of the EOS are of major importance, in particular influencing the circulation through 
    11871217determination of the static stability below the mixed layer, 
    1188 thus controlling rates of exchange between the atmosphere and the ocean interior \citep{Roquet_JPO2015}. 
    1189 Therefore an accurate EOS based on either the 1980 equation of state (EOS-80, \cite{UNESCO1983}) or 
    1190 TEOS-10 \citep{TEOS10} standards should be used anytime a simulation of the real ocean circulation is attempted 
    1191 \citep{Roquet_JPO2015}. 
     1218thus controlling rates of exchange between the atmosphere and the ocean interior \citep{roquet.madec.ea_JPO15}. 
     1219Therefore an accurate EOS based on either the 1980 equation of state (EOS-80, \cite{fofonoff.millard_bk83}) or 
     1220TEOS-10 \citep{ioc.iapso_bk10} standards should be used anytime a simulation of the real ocean circulation is attempted 
     1221\citep{roquet.madec.ea_JPO15}. 
    11921222The use of TEOS-10 is highly recommended because 
    11931223\textit{(i)}   it is the new official EOS, 
    11941224\textit{(ii)}  it is more accurate, being based on an updated database of laboratory measurements, and 
    11951225\textit{(iii)} it uses Conservative Temperature and Absolute Salinity (instead of potential temperature and 
    1196 practical salinity for EOS-980, both variables being more suitable for use as model variables 
    1197 \citep{TEOS10, Graham_McDougall_JPO13}. 
    1198 EOS-80 is an obsolescent feature of the NEMO system, kept only for backward compatibility. 
     1226practical salinity for EOS-80, both variables being more suitable for use as model variables 
     1227\citep{ioc.iapso_bk10, graham.mcdougall_JPO13}. 
     1228EOS-80 is an obsolescent feature of the \NEMO\ system, kept only for backward compatibility. 
    11991229For process studies, it is often convenient to use an approximation of the EOS. 
    1200 To that purposed, a simplified EOS (S-EOS) inspired by \citet{Vallis06} is also available. 
     1230To that purposed, a simplified EOS (S-EOS) inspired by \citet{vallis_bk06} is also available. 
    12011231 
    12021232In the computer code, a density anomaly, $d_a = \rho / \rho_o - 1$, is computed, with $\rho_o$ a reference density. 
     
    12041234This is a sensible choice for the reference density used in a Boussinesq ocean climate model, as, 
    12051235with the exception of only a small percentage of the ocean, 
    1206 density in the World Ocean varies by no more than 2$\%$ from that value \citep{Gill1982}. 
    1207  
    1208 Options are defined through the \ngn{nameos} namelist variables, and in particular \np{nn\_eos} which 
    1209 controls the EOS used (\forcode{= -1} for TEOS10 ; \forcode{= 0} for EOS-80 ; \forcode{= 1} for S-EOS). 
     1236density in the World Ocean varies by no more than 2$\%$ from that value \citep{gill_bk82}. 
     1237 
     1238Options which control the EOS used are defined through the \nam{eos} namelist variables. 
    12101239 
    12111240\begin{description} 
    1212 \item[\np{nn\_eos}~\forcode{= -1}] 
    1213   the polyTEOS10-bsq equation of seawater \citep{Roquet_OM2015} is used. 
     1241\item[\np{ln\_teos10}\forcode{=.true.}] 
     1242  the polyTEOS10-bsq equation of seawater \citep{roquet.madec.ea_OM15} is used. 
    12141243  The accuracy of this approximation is comparable to the TEOS-10 rational function approximation, 
    12151244  but it is optimized for a boussinesq fluid and the polynomial expressions have simpler and 
     
    12171246  use in ocean models. 
    12181247  Note that a slightly higher precision polynomial form is now used replacement of 
    1219   the TEOS-10 rational function approximation for hydrographic data analysis \citep{TEOS10}. 
     1248  the TEOS-10 rational function approximation for hydrographic data analysis \citep{ioc.iapso_bk10}. 
    12201249  A key point is that conservative state variables are used: 
    12211250  Absolute Salinity (unit: g/kg, notation: $S_A$) and Conservative Temperature (unit: \deg{C}, notation: $\Theta$). 
    12221251  The pressure in decibars is approximated by the depth in meters. 
    12231252  With TEOS10, the specific heat capacity of sea water, $C_p$, is a constant. 
    1224   It is set to $C_p = 3991.86795711963~J\,Kg^{-1}\,^{\circ}K^{-1}$, according to \citet{TEOS10}. 
     1253  It is set to $C_p = 3991.86795711963~J\,Kg^{-1}\,^{\circ}K^{-1}$, according to \citet{ioc.iapso_bk10}. 
    12251254  Choosing polyTEOS10-bsq implies that the state variables used by the model are $\Theta$ and $S_A$. 
    12261255  In particular, the initial state deined by the user have to be given as \textit{Conservative} Temperature and 
    12271256  \textit{Absolute} Salinity. 
    1228   In addition, setting \np{ln\_useCT} to \forcode{.true.} convert the Conservative SST to potential SST prior to 
     1257  In addition, when using TEOS10, the Conservative SST is converted to potential SST prior to 
    12291258  either computing the air-sea and ice-sea fluxes (forced mode) or 
    12301259  sending the SST field to the atmosphere (coupled mode). 
    1231 \item[\np{nn\_eos}~\forcode{= 0}] 
     1260\item[\np{ln\_eos80}\forcode{=.true.}] 
    12321261  the polyEOS80-bsq equation of seawater is used. 
    12331262  It takes the same polynomial form as the polyTEOS10, but the coefficients have been optimized to 
     
    12381267  The pressure in decibars is approximated by the depth in meters. 
    12391268  With thsi EOS, the specific heat capacity of sea water, $C_p$, is a function of temperature, salinity and 
    1240   pressure \citep{UNESCO1983}. 
     1269  pressure \citep{fofonoff.millard_bk83}. 
    12411270  Nevertheless, a severe assumption is made in order to have a heat content ($C_p T_p$) which 
    12421271  is conserved by the model: $C_p$ is set to a constant value, the TEOS10 value. 
    1243 \item[\np{nn\_eos}~\forcode{= 1}] 
    1244   a simplified EOS (S-EOS) inspired by \citet{Vallis06} is chosen, 
     1272\item[\np{ln\_seos}\forcode{=.true.}] 
     1273  a simplified EOS (S-EOS) inspired by \citet{vallis_bk06} is chosen, 
    12451274  the coefficients of which has been optimized to fit the behavior of TEOS10 
    1246   (Roquet, personal comm.) (see also \citet{Roquet_JPO2015}). 
     1275  (Roquet, personal comm.) (see also \citet{roquet.madec.ea_JPO15}). 
    12471276  It provides a simplistic linear representation of both cabbeling and thermobaricity effects which 
    1248   is enough for a proper treatment of the EOS in theoretical studies \citep{Roquet_JPO2015}. 
     1277  is enough for a proper treatment of the EOS in theoretical studies \citep{roquet.madec.ea_JPO15}. 
    12491278  With such an equation of state there is no longer a distinction between 
    12501279  \textit{conservative} and \textit{potential} temperature, 
    12511280  as well as between \textit{absolute} and \textit{practical} salinity. 
    12521281  S-EOS takes the following expression: 
     1282 
    12531283  \begin{gather*} 
    1254     % \label{eq:tra_S-EOS} 
     1284    % \label{eq:TRA_S-EOS} 
    12551285    \begin{alignedat}{2} 
    12561286    &d_a(T,S,z) = \frac{1}{\rho_o} \big[ &- a_0 \; ( 1 + 0.5 \; \lambda_1 \; T_a + \mu_1 \; z ) * &T_a \big. \\ 
    1257     &                                    &+ b_0 \; ( 1 - 0.5 \; \lambda_2 \; S_a - \mu_2 \; z ) * &S_a       \\   
     1287    &                                    &+ b_0 \; ( 1 - 0.5 \; \lambda_2 \; S_a - \mu_2 \; z ) * &S_a       \\ 
    12581288    &                              \big. &- \nu \;                           T_a                  &S_a \big] \\ 
    12591289    \end{alignedat} 
     
    12611291    \text{with~} T_a = T - 10 \, ; \, S_a = S - 35 \, ; \, \rho_o = 1026~Kg/m^3 
    12621292  \end{gather*} 
    1263   where the computer name of the coefficients as well as their standard value are given in \autoref{tab:SEOS}. 
     1293  where the computer name of the coefficients as well as their standard value are given in \autoref{tab:TRA_SEOS}. 
    12641294  In fact, when choosing S-EOS, various approximation of EOS can be specified simply by 
    12651295  changing the associated coefficients. 
     
    12721302%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    12731303\begin{table}[!tb] 
    1274   \begin{center} 
    1275     \begin{tabular}{|l|l|l|l|} 
    1276       \hline 
    1277       coeff.      & computer name   & S-EOS           & description                      \\ 
    1278       \hline 
    1279       $a_0$       & \np{rn\_a0}     & $1.6550~10^{-1}$ & linear thermal expansion coeff. \\ 
    1280       \hline 
    1281       $b_0$       & \np{rn\_b0}     & $7.6554~10^{-1}$ & linear haline  expansion coeff. \\ 
    1282       \hline 
    1283       $\lambda_1$ & \np{rn\_lambda1}& $5.9520~10^{-2}$ & cabbeling coeff. in $T^2$       \\ 
    1284       \hline 
    1285       $\lambda_2$ & \np{rn\_lambda2}& $5.4914~10^{-4}$ & cabbeling coeff. in $S^2$       \\ 
    1286       \hline 
    1287       $\nu$       & \np{rn\_nu}     & $2.4341~10^{-3}$ & cabbeling coeff. in $T \, S$    \\ 
    1288       \hline 
    1289       $\mu_1$     & \np{rn\_mu1}    & $1.4970~10^{-4}$ & thermobaric coeff. in T         \\ 
    1290       \hline 
    1291       $\mu_2$     & \np{rn\_mu2}    & $1.1090~10^{-5}$ & thermobaric coeff. in S         \\ 
    1292       \hline 
    1293     \end{tabular} 
    1294     \caption{ 
    1295       \protect\label{tab:SEOS} 
    1296       Standard value of S-EOS coefficients. 
    1297     } 
    1298 \end{center} 
     1304  \centering 
     1305  \begin{tabular}{|l|l|l|l|} 
     1306    \hline 
     1307    coeff.     & computer name   & S-EOS           & description                      \\ 
     1308    \hline 
     1309    $a_0$       & \np{rn\_a0}     & $1.6550~10^{-1}$ & linear thermal expansion coeff. \\ 
     1310    \hline 
     1311    $b_0$         & \np{rn\_b0}     & $7.6554~10^{-1}$ & linear haline  expansion coeff. \\ 
     1312    \hline 
     1313    $\lambda_1$   & \np{rn\_lambda1}& $5.9520~10^{-2}$ & cabbeling coeff. in $T^2$       \\ 
     1314    \hline 
     1315    $\lambda_2$   & \np{rn\_lambda2}& $5.4914~10^{-4}$ & cabbeling coeff. in $S^2$       \\ 
     1316    \hline 
     1317    $\nu$       & \np{rn\_nu}     & $2.4341~10^{-3}$ & cabbeling coeff. in $T \, S$      \\ 
     1318    \hline 
     1319    $\mu_1$     & \np{rn\_mu1}   & $1.4970~10^{-4}$ & thermobaric coeff. in T         \\ 
     1320    \hline 
     1321    $\mu_2$     & \np{rn\_mu2}   & $1.1090~10^{-5}$ & thermobaric coeff. in S         \\ 
     1322    \hline 
     1323  \end{tabular} 
     1324  \caption{Standard value of S-EOS coefficients} 
     1325  \label{tab:TRA_SEOS} 
    12991326\end{table} 
    13001327%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    13031330%        Brunt-V\"{a}is\"{a}l\"{a} Frequency 
    13041331% ------------------------------------------------------------------------------------------------------------- 
    1305 \subsection{Brunt-V\"{a}is\"{a}l\"{a} frequency (\protect\np{nn\_eos}~\forcode{= 0..2})} 
     1332\subsection[Brunt-V\"{a}is\"{a}l\"{a} frequency] 
     1333{Brunt-V\"{a}is\"{a}l\"{a} frequency} 
    13061334\label{subsec:TRA_bn2} 
    13071335 
     
    13121340In particular, $N^2$ has to be computed at the local pressure 
    13131341(pressure in decibar being approximated by the depth in meters). 
    1314 The expression for $N^2$  is given by:  
     1342The expression for $N^2$  is given by: 
    13151343\[ 
    1316   % \label{eq:tra_bn2} 
     1344  % \label{eq:TRA_bn2} 
    13171345  N^2 = \frac{g}{e_{3w}} \lt( \beta \; \delta_{k + 1/2}[S] - \alpha \; \delta_{k + 1/2}[T] \rt) 
    13181346\] 
     
    13211349The coefficients are a polynomial function of temperature, salinity and depth which expression depends on 
    13221350the chosen EOS. 
    1323 They are computed through \textit{eos\_rab}, a \fortran function that can be found in \mdl{eosbn2}. 
     1351They are computed through \textit{eos\_rab}, a \fortran\ function that can be found in \mdl{eosbn2}. 
    13241352 
    13251353% ------------------------------------------------------------------------------------------------------------- 
     
    13291357\label{subsec:TRA_fzp} 
    13301358 
    1331 The freezing point of seawater is a function of salinity and pressure \citep{UNESCO1983}: 
    1332 \begin{equation} 
    1333   \label{eq:tra_eos_fzp} 
     1359The freezing point of seawater is a function of salinity and pressure \citep{fofonoff.millard_bk83}: 
     1360\begin{equation} 
     1361  \label{eq:TRA_eos_fzp} 
    13341362  \begin{split} 
    13351363    &T_f (S,p) = \lt( a + b \, \sqrt{S} + c \, S \rt) \, S + d \, p \\ 
    1336     &\text{where~} a = -0.0575, \, b = 1.710523~10^{-3}, \, c = -2.154996~10^{-4} \\  
     1364    &\text{where~} a = -0.0575, \, b = 1.710523~10^{-3}, \, c = -2.154996~10^{-4} \\ 
    13371365    &\text{and~} d = -7.53~10^{-3} 
    13381366    \end{split} 
    13391367\end{equation} 
    13401368 
    1341 \autoref{eq:tra_eos_fzp} is only used to compute the potential freezing point of sea water 
    1342 (\ie referenced to the surface $p = 0$), 
    1343 thus the pressure dependent terms in \autoref{eq:tra_eos_fzp} (last term) have been dropped. 
     1369\autoref{eq:TRA_eos_fzp} is only used to compute the potential freezing point of sea water 
     1370(\ie\ referenced to the surface $p = 0$), 
     1371thus the pressure dependent terms in \autoref{eq:TRA_eos_fzp} (last term) have been dropped. 
    13441372The freezing point is computed through \textit{eos\_fzp}, 
    1345 a \fortran function that can be found in \mdl{eosbn2}. 
    1346  
    1347 % ------------------------------------------------------------------------------------------------------------- 
    1348 %        Potential Energy      
     1373a \fortran\ function that can be found in \mdl{eosbn2}. 
     1374 
     1375% ------------------------------------------------------------------------------------------------------------- 
     1376%        Potential Energy 
    13491377% ------------------------------------------------------------------------------------------------------------- 
    13501378%\subsection{Potential Energy anomalies} 
     
    13551383 
    13561384% ================================================================ 
    1357 % Horizontal Derivative in zps-coordinate  
    1358 % ================================================================ 
    1359 \section{Horizontal derivative in \textit{zps}-coordinate (\protect\mdl{zpshde})} 
     1385% Horizontal Derivative in zps-coordinate 
     1386% ================================================================ 
     1387\section[Horizontal derivative in \textit{zps}-coordinate (\textit{zpshde.F90})] 
     1388{Horizontal derivative in \textit{zps}-coordinate (\protect\mdl{zpshde})} 
    13601389\label{sec:TRA_zpshde} 
    13611390 
    1362 \gmcomment{STEVEN: to be consistent with earlier discussion of differencing and averaging operators,  
     1391\gmcomment{STEVEN: to be consistent with earlier discussion of differencing and averaging operators, 
    13631392I've changed "derivative" to "difference" and "mean" to "average"} 
    13641393 
    1365 With partial cells (\np{ln\_zps}~\forcode{= .true.}) at bottom and top (\np{ln\_isfcav}~\forcode{= .true.}), 
     1394With partial cells (\np{ln\_zps}\forcode{=.true.}) at bottom and top (\np{ln\_isfcav}\forcode{=.true.}), 
    13661395in general, tracers in horizontally adjacent cells live at different depths. 
    13671396Horizontal gradients of tracers are needed for horizontal diffusion (\mdl{traldf} module) and 
    13681397the hydrostatic pressure gradient calculations (\mdl{dynhpg} module). 
    1369 The partial cell properties at the top (\np{ln\_isfcav}~\forcode{= .true.}) are computed in the same way as 
     1398The partial cell properties at the top (\np{ln\_isfcav}\forcode{=.true.}) are computed in the same way as 
    13701399for the bottom. 
    13711400So, only the bottom interpolation is explained below. 
     
    13731402Before taking horizontal gradients between the tracers next to the bottom, 
    13741403a linear interpolation in the vertical is used to approximate the deeper tracer as if 
    1375 it actually lived at the depth of the shallower tracer point (\autoref{fig:Partial_step_scheme}). 
     1404it actually lived at the depth of the shallower tracer point (\autoref{fig:TRA_Partial_step_scheme}). 
    13761405For example, for temperature in the $i$-direction the needed interpolated temperature, $\widetilde T$, is: 
    13771406 
    13781407%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    13791408\begin{figure}[!p] 
    1380   \begin{center} 
    1381     \includegraphics[]{Fig_partial_step_scheme} 
    1382     \caption{ 
    1383       \protect\label{fig:Partial_step_scheme} 
    1384       Discretisation of the horizontal difference and average of tracers in the $z$-partial step coordinate 
    1385       (\protect\np{ln\_zps}~\forcode{= .true.}) in the case $(e3w_k^{i + 1} - e3w_k^i) > 0$. 
    1386       A linear interpolation is used to estimate $\widetilde T_k^{i + 1}$, 
    1387       the tracer value at the depth of the shallower tracer point of the two adjacent bottom $T$-points. 
    1388       The horizontal difference is then given by: $\delta_{i + 1/2} T_k = \widetilde T_k^{\, i + 1} -T_k^{\, i}$ and 
    1389       the average by: $\overline T_k^{\, i + 1/2} = (\widetilde T_k^{\, i + 1/2} - T_k^{\, i}) / 2$. 
    1390     } 
    1391   \end{center} 
     1409  \centering 
     1410  \includegraphics[width=\textwidth]{Fig_partial_step_scheme} 
     1411  \caption[Discretisation of the horizontal difference and average of tracers in 
     1412  the $z$-partial step coordinate]{ 
     1413    Discretisation of the horizontal difference and average of tracers in 
     1414    the $z$-partial step coordinate (\protect\np{ln\_zps}\forcode{=.true.}) in 
     1415    the case $(e3w_k^{i + 1} - e3w_k^i) > 0$. 
     1416    A linear interpolation is used to estimate $\widetilde T_k^{i + 1}$, 
     1417    the tracer value at the depth of the shallower tracer point of 
     1418    the two adjacent bottom $T$-points. 
     1419    The horizontal difference is then given by: 
     1420    $\delta_{i + 1/2} T_k = \widetilde T_k^{\, i + 1} -T_k^{\, i}$ and 
     1421    the average by: 
     1422    $\overline T_k^{\, i + 1/2} = (\widetilde T_k^{\, i + 1/2} - T_k^{\, i}) / 2$.} 
     1423  \label{fig:TRA_Partial_step_scheme} 
    13921424\end{figure} 
    13931425%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    14021434  \rt. 
    14031435\] 
    1404 and the resulting forms for the horizontal difference and the horizontal average value of $T$ at a $U$-point are:  
    1405 \begin{equation} 
    1406   \label{eq:zps_hde} 
     1436and the resulting forms for the horizontal difference and the horizontal average value of $T$ at a $U$-point are: 
     1437\begin{equation} 
     1438  \label{eq:TRA_zps_hde} 
    14071439  \begin{split} 
    14081440    \delta_{i + 1/2} T       &= 
     
    14281460Instead of forming a linear approximation of density, we compute $\widetilde \rho$ from the interpolated values of 
    14291461$T$ and $S$, and the pressure at a $u$-point 
    1430 (in the equation of state pressure is approximated by depth, see \autoref{subsec:TRA_eos}):  
     1462(in the equation of state pressure is approximated by depth, see \autoref{subsec:TRA_eos}): 
    14311463\[ 
    1432   % \label{eq:zps_hde_rho} 
     1464  % \label{eq:TRA_zps_hde_rho} 
    14331465  \widetilde \rho = \rho (\widetilde T,\widetilde S,z_u) \quad \text{where~} z_u = \min \lt( z_T^{i + 1},z_T^i \rt) 
    14341466\] 
     
    14411473Note that in almost all the advection schemes presented in this Chapter, 
    14421474both averaging and differencing operators appear. 
    1443 Yet \autoref{eq:zps_hde} has not been used in these schemes: 
     1475Yet \autoref{eq:TRA_zps_hde} has not been used in these schemes: 
    14441476in contrast to diffusion and pressure gradient computations, 
    14451477no correction for partial steps is applied for advection. 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_ZDF.tex

    r10442 r11564  
    11\documentclass[../main/NEMO_manual]{subfiles} 
     2 
     3%% Custom aliases 
     4\newcommand{\cf}{\ensuremath{C\kern-0.14em f}} 
    25 
    36\begin{document} 
     
    811\label{chap:ZDF} 
    912 
    10 \minitoc 
     13\chaptertoc 
    1114 
    1215%gm% Add here a small introduction to ZDF and naming of the different physics (similar to what have been written for TRA and DYN. 
     
    1821% ================================================================ 
    1922\section{Vertical mixing} 
    20 \label{sec:ZDF_zdf} 
     23\label{sec:ZDF} 
    2124 
    2225The discrete form of the ocean subgrid scale physics has been presented in 
     
    2528At the surface they are prescribed from the surface forcing (see \autoref{chap:SBC}), 
    2629while at the bottom they are set to zero for heat and salt, 
    27 unless a geothermal flux forcing is prescribed as a bottom boundary condition (\ie \key{trabbl} defined, 
     30unless a geothermal flux forcing is prescribed as a bottom boundary condition (\ie\ \np{ln\_trabbc} defined, 
    2831see \autoref{subsec:TRA_bbc}), and specified through a bottom friction parameterisation for momentum 
    29 (see \autoref{sec:ZDF_bfr}). 
     32(see \autoref{sec:ZDF_drg}). 
    3033 
    3134In this section we briefly discuss the various choices offered to compute the vertical eddy viscosity and 
     
    3336respectively (see \autoref{sec:TRA_zdf} and \autoref{sec:DYN_zdf}). 
    3437These coefficients can be assumed to be either constant, or a function of the local Richardson number, 
    35 or computed from a turbulent closure model (either TKE or GLS formulation). 
    36 The computation of these coefficients is initialized in the \mdl{zdfini} module and performed in 
    37 the \mdl{zdfric}, \mdl{zdftke} or \mdl{zdfgls} modules. 
     38or computed from a turbulent closure model (either TKE or GLS or OSMOSIS formulation). 
     39The computation of these coefficients is initialized in the \mdl{zdfphy} module and performed in 
     40the \mdl{zdfric}, \mdl{zdftke} or \mdl{zdfgls} or \mdl{zdfosm} modules. 
    3841The trends due to the vertical momentum and tracer diffusion, including the surface forcing, 
    39 are computed and added to the general trend in the \mdl{dynzdf} and \mdl{trazdf} modules, respectively.  
    40 These trends can be computed using either a forward time stepping scheme 
    41 (namelist parameter \np{ln\_zdfexp}\forcode{ = .true.}) or a backward time stepping scheme 
    42 (\np{ln\_zdfexp}\forcode{ = .false.}) depending on the magnitude of the mixing coefficients, 
    43 and thus of the formulation used (see \autoref{chap:STP}). 
    44  
    45 % ------------------------------------------------------------------------------------------------------------- 
    46 %        Constant  
    47 % ------------------------------------------------------------------------------------------------------------- 
    48 \subsection{Constant (\protect\key{zdfcst})} 
     42are computed and added to the general trend in the \mdl{dynzdf} and \mdl{trazdf} modules, respectively. 
     43%These trends can be computed using either a forward time stepping scheme 
     44%(namelist parameter \np{ln\_zdfexp}\forcode{=.true.}) or a backward time stepping scheme 
     45%(\np{ln\_zdfexp}\forcode{=.false.}) depending on the magnitude of the mixing coefficients, 
     46%and thus of the formulation used (see \autoref{chap:TD}). 
     47 
     48%--------------------------------------------namzdf-------------------------------------------------------- 
     49 
     50\begin{listing} 
     51  \nlst{namzdf} 
     52  \caption{\texttt{namzdf}} 
     53  \label{lst:namzdf} 
     54\end{listing} 
     55%-------------------------------------------------------------------------------------------------------------- 
     56 
     57% ------------------------------------------------------------------------------------------------------------- 
     58%        Constant 
     59% ------------------------------------------------------------------------------------------------------------- 
     60\subsection[Constant (\forcode{ln_zdfcst=.true.})] 
     61{Constant (\protect\np{ln\_zdfcst}\forcode{=.true.})} 
    4962\label{subsec:ZDF_cst} 
    50 %--------------------------------------------namzdf--------------------------------------------------------- 
    51  
    52 \nlst{namzdf} 
    53 %-------------------------------------------------------------------------------------------------------------- 
    54  
    55 Options are defined through the \ngn{namzdf} namelist variables. 
    56 When \key{zdfcst} is defined, the momentum and tracer vertical eddy coefficients are set to 
     63 
     64Options are defined through the \nam{zdf} namelist variables. 
     65When \np{ln\_zdfcst} is defined, the momentum and tracer vertical eddy coefficients are set to 
    5766constant values over the whole ocean. 
    5867This is the crudest way to define the vertical ocean physics. 
    59 It is recommended that this option is only used in process studies, not in basin scale simulations. 
     68It is recommended to use this option only in process studies, not in basin scale simulations. 
    6069Typical values used in this case are: 
    6170\begin{align*} 
     
    6473\end{align*} 
    6574 
    66 These values are set through the \np{rn\_avm0} and \np{rn\_avt0} namelist parameters.  
     75These values are set through the \np{rn\_avm0} and \np{rn\_avt0} namelist parameters. 
    6776In all cases, do not use values smaller that those associated with the molecular viscosity and diffusivity, 
    6877that is $\sim10^{-6}~m^2.s^{-1}$ for momentum, $\sim10^{-7}~m^2.s^{-1}$ for temperature and 
     
    7281%        Richardson Number Dependent 
    7382% ------------------------------------------------------------------------------------------------------------- 
    74 \subsection{Richardson number dependent (\protect\key{zdfric})} 
     83\subsection[Richardson number dependent (\forcode{ln_zdfric=.true.})] 
     84{Richardson number dependent (\protect\np{ln\_zdfric}\forcode{=.true.})} 
    7585\label{subsec:ZDF_ric} 
    7686 
    7787%--------------------------------------------namric--------------------------------------------------------- 
    7888 
    79 \nlst{namzdf_ric} 
     89\begin{listing} 
     90  \nlst{namzdf_ric} 
     91  \caption{\texttt{namzdf\_ric}} 
     92  \label{lst:namzdf_ric} 
     93\end{listing} 
    8094%-------------------------------------------------------------------------------------------------------------- 
    8195 
    82 When \key{zdfric} is defined, a local Richardson number dependent formulation for the vertical momentum and 
    83 tracer eddy coefficients is set through the \ngn{namzdf\_ric} namelist variables. 
    84 The vertical mixing coefficients are diagnosed from the large scale variables computed by the model.  
     96When \np{ln\_zdfric}\forcode{=.true.}, a local Richardson number dependent formulation for the vertical momentum and 
     97tracer eddy coefficients is set through the \nam{zdf\_ric} namelist variables. 
     98The vertical mixing coefficients are diagnosed from the large scale variables computed by the model. 
    8599\textit{In situ} measurements have been used to link vertical turbulent activity to large scale ocean structures. 
    86100The hypothesis of a mixing mainly maintained by the growth of Kelvin-Helmholtz like instabilities leads to 
    87101a dependency between the vertical eddy coefficients and the local Richardson number 
    88 (\ie the ratio of stratification to vertical shear). 
    89 Following \citet{Pacanowski_Philander_JPO81}, the following formulation has been implemented: 
    90 \[ 
    91   % \label{eq:zdfric} 
     102(\ie\ the ratio of stratification to vertical shear). 
     103Following \citet{pacanowski.philander_JPO81}, the following formulation has been implemented: 
     104\[ 
     105  % \label{eq:ZDF_ric} 
    92106  \left\{ 
    93107    \begin{aligned} 
     
    98112\] 
    99113where $Ri = N^2 / \left(\partial_z \textbf{U}_h \right)^2$ is the local Richardson number, 
    100 $N$ is the local Brunt-Vais\"{a}l\"{a} frequency (see \autoref{subsec:TRA_bn2}),  
     114$N$ is the local Brunt-Vais\"{a}l\"{a} frequency (see \autoref{subsec:TRA_bn2}), 
    101115$A_b^{vT} $ and $A_b^{vm}$ are the constant background values set as in the constant case 
    102116(see \autoref{subsec:ZDF_cst}), and $A_{ric}^{vT} = 10^{-4}~m^2.s^{-1}$ is the maximum value that 
     
    106120 
    107121A simple mixing-layer model to transfer and dissipate the atmospheric forcings 
    108 (wind-stress and buoyancy fluxes) can be activated setting the \np{ln\_mldw}\forcode{ = .true.} in the namelist. 
     122(wind-stress and buoyancy fluxes) can be activated setting the \np{ln\_mldw}\forcode{=.true.} in the namelist. 
    109123 
    110124In this case, the local depth of turbulent wind-mixing or "Ekman depth" $h_{e}(x,y,t)$ is evaluated and 
     
    124138The final $h_{e}$ is further constrained by the adjustable bounds \np{rn\_mldmin} and \np{rn\_mldmax}. 
    125139Once $h_{e}$ is computed, the vertical eddy coefficients within $h_{e}$ are set to 
    126 the empirical values \np{rn\_wtmix} and \np{rn\_wvmix} \citep{Lermusiaux2001}. 
    127  
    128 % ------------------------------------------------------------------------------------------------------------- 
    129 %        TKE Turbulent Closure Scheme  
    130 % ------------------------------------------------------------------------------------------------------------- 
    131 \subsection{TKE turbulent closure scheme (\protect\key{zdftke})} 
     140the empirical values \np{rn\_wtmix} and \np{rn\_wvmix} \citep{lermusiaux_JMS01}. 
     141 
     142% ------------------------------------------------------------------------------------------------------------- 
     143%        TKE Turbulent Closure Scheme 
     144% ------------------------------------------------------------------------------------------------------------- 
     145\subsection[TKE turbulent closure scheme (\forcode{ln_zdftke=.true.})] 
     146{TKE turbulent closure scheme (\protect\np{ln\_zdftke}\forcode{=.true.})} 
    132147\label{subsec:ZDF_tke} 
    133  
    134148%--------------------------------------------namzdf_tke-------------------------------------------------- 
    135149 
    136 \nlst{namzdf_tke} 
     150\begin{listing} 
     151  \nlst{namzdf_tke} 
     152  \caption{\texttt{namzdf\_tke}} 
     153  \label{lst:namzdf_tke} 
     154\end{listing} 
    137155%-------------------------------------------------------------------------------------------------------------- 
    138156 
     
    140158a prognostic equation for $\bar{e}$, the turbulent kinetic energy, 
    141159and a closure assumption for the turbulent length scales. 
    142 This turbulent closure model has been developed by \citet{Bougeault1989} in the atmospheric case, 
    143 adapted by \citet{Gaspar1990} for the oceanic case, and embedded in OPA, the ancestor of NEMO, 
    144 by \citet{Blanke1993} for equatorial Atlantic simulations. 
    145 Since then, significant modifications have been introduced by \citet{Madec1998} in both the implementation and 
     160This turbulent closure model has been developed by \citet{bougeault.lacarrere_MWR89} in the atmospheric case, 
     161adapted by \citet{gaspar.gregoris.ea_JGR90} for the oceanic case, and embedded in OPA, the ancestor of \NEMO, 
     162by \citet{blanke.delecluse_JPO93} for equatorial Atlantic simulations. 
     163Since then, significant modifications have been introduced by \citet{madec.delecluse.ea_NPM98} in both the implementation and 
    146164the formulation of the mixing length scale. 
    147165The time evolution of $\bar{e}$ is the result of the production of $\bar{e}$ through vertical shear, 
    148 its destruction through stratification, its vertical diffusion, and its dissipation of \citet{Kolmogorov1942} type: 
     166its destruction through stratification, its vertical diffusion, and its dissipation of \citet{kolmogorov_IANS42} type: 
    149167\begin{equation} 
    150   \label{eq:zdftke_e} 
     168  \label{eq:ZDF_tke_e} 
    151169  \frac{\partial \bar{e}}{\partial t} = 
    152170  \frac{K_m}{{e_3}^2 }\;\left[ {\left( {\frac{\partial u}{\partial k}} \right)^2 
     
    158176\end{equation} 
    159177\[ 
    160   % \label{eq:zdftke_kz} 
     178  % \label{eq:ZDF_tke_kz} 
    161179  \begin{split} 
    162180    K_m &= C_k\  l_k\  \sqrt {\bar{e}\; }    \\ 
     
    164182  \end{split} 
    165183\] 
    166 where $N$ is the local Brunt-Vais\"{a}l\"{a} frequency (see \autoref{subsec:TRA_bn2}),  
    167 $l_{\epsilon }$ and $l_{\kappa }$ are the dissipation and mixing length scales,  
     184where $N$ is the local Brunt-Vais\"{a}l\"{a} frequency (see \autoref{subsec:TRA_bn2}), 
     185$l_{\epsilon }$ and $l_{\kappa }$ are the dissipation and mixing length scales, 
    168186$P_{rt}$ is the Prandtl number, $K_m$ and $K_\rho$ are the vertical eddy viscosity and diffusivity coefficients. 
    169187The constants $C_k =  0.1$ and $C_\epsilon = \sqrt {2} /2$ $\approx 0.7$ are designed to deal with 
    170 vertical mixing at any depth \citep{Gaspar1990}.  
     188vertical mixing at any depth \citep{gaspar.gregoris.ea_JGR90}. 
    171189They are set through namelist parameters \np{nn\_ediff} and \np{nn\_ediss}. 
    172 $P_{rt}$ can be set to unity or, following \citet{Blanke1993}, be a function of the local Richardson number, $R_i$: 
     190$P_{rt}$ can be set to unity or, following \citet{blanke.delecluse_JPO93}, be a function of the local Richardson number, $R_i$: 
    173191\begin{align*} 
    174   % \label{eq:prt} 
     192  % \label{eq:ZDF_prt} 
    175193  P_{rt} = 
    176194  \begin{cases} 
     
    180198  \end{cases} 
    181199\end{align*} 
    182 Options are defined through the  \ngn{namzdfy\_tke} namelist variables. 
    183200The choice of $P_{rt}$ is controlled by the \np{nn\_pdl} namelist variable. 
    184201 
    185202At the sea surface, the value of $\bar{e}$ is prescribed from the wind stress field as 
    186203$\bar{e}_o = e_{bb} |\tau| / \rho_o$, with $e_{bb}$ the \np{rn\_ebb} namelist parameter. 
    187 The default value of $e_{bb}$ is 3.75. \citep{Gaspar1990}), however a much larger value can be used when 
     204The default value of $e_{bb}$ is 3.75. \citep{gaspar.gregoris.ea_JGR90}), however a much larger value can be used when 
    188205taking into account the surface wave breaking (see below Eq. \autoref{eq:ZDF_Esbc}). 
    189206The bottom value of TKE is assumed to be equal to the value of the level just above. 
     
    191208the numerical scheme does not ensure its positivity. 
    192209To overcome this problem, a cut-off in the minimum value of $\bar{e}$ is used (\np{rn\_emin} namelist parameter). 
    193 Following \citet{Gaspar1990}, the cut-off value is set to $\sqrt{2}/2~10^{-6}~m^2.s^{-2}$. 
    194 This allows the subsequent formulations to match that of \citet{Gargett1984} for the diffusion in 
     210Following \citet{gaspar.gregoris.ea_JGR90}, the cut-off value is set to $\sqrt{2}/2~10^{-6}~m^2.s^{-2}$. 
     211This allows the subsequent formulations to match that of \citet{gargett_JMR84} for the diffusion in 
    195212the thermocline and deep ocean :  $K_\rho = 10^{-3} / N$. 
    196213In addition, a cut-off is applied on $K_m$ and $K_\rho$ to avoid numerical instabilities associated with 
    197214too weak vertical diffusion. 
    198215They must be specified at least larger than the molecular values, and are set through \np{rn\_avm0} and 
    199 \np{rn\_avt0} (namzdf namelist, see \autoref{subsec:ZDF_cst}). 
     216\np{rn\_avt0} (\nam{zdf} namelist, see \autoref{subsec:ZDF_cst}). 
    200217 
    201218\subsubsection{Turbulent length scale} 
    202219 
    203220For computational efficiency, the original formulation of the turbulent length scales proposed by 
    204 \citet{Gaspar1990} has been simplified. 
     221\citet{gaspar.gregoris.ea_JGR90} has been simplified. 
    205222Four formulations are proposed, the choice of which is controlled by the \np{nn\_mxl} namelist parameter. 
    206 The first two are based on the following first order approximation \citep{Blanke1993}: 
     223The first two are based on the following first order approximation \citep{blanke.delecluse_JPO93}: 
    207224\begin{equation} 
    208   \label{eq:tke_mxl0_1} 
     225  \label{eq:ZDF_tke_mxl0_1} 
    209226  l_k = l_\epsilon = \sqrt {2 \bar{e}\; } / N 
    210227\end{equation} 
    211228which is valid in a stable stratified region with constant values of the Brunt-Vais\"{a}l\"{a} frequency. 
    212229The resulting length scale is bounded by the distance to the surface or to the bottom 
    213 (\np{nn\_mxl}\forcode{ = 0}) or by the local vertical scale factor (\np{nn\_mxl}\forcode{ = 1}). 
    214 \citet{Blanke1993} notice that this simplification has two major drawbacks: 
     230(\np{nn\_mxl}\forcode{=0}) or by the local vertical scale factor (\np{nn\_mxl}\forcode{=1}). 
     231\citet{blanke.delecluse_JPO93} notice that this simplification has two major drawbacks: 
    215232it makes no sense for locally unstable stratification and the computation no longer uses all 
    216233the information contained in the vertical density profile. 
    217 To overcome these drawbacks, \citet{Madec1998} introduces the \np{nn\_mxl}\forcode{ = 2..3} cases, 
     234To overcome these drawbacks, \citet{madec.delecluse.ea_NPM98} introduces the \np{nn\_mxl}\forcode{=2, 3} cases, 
    218235which add an extra assumption concerning the vertical gradient of the computed length scale. 
    219 So, the length scales are first evaluated as in \autoref{eq:tke_mxl0_1} and then bounded such that: 
     236So, the length scales are first evaluated as in \autoref{eq:ZDF_tke_mxl0_1} and then bounded such that: 
    220237\begin{equation} 
    221   \label{eq:tke_mxl_constraint} 
     238  \label{eq:ZDF_tke_mxl_constraint} 
    222239  \frac{1}{e_3 }\left| {\frac{\partial l}{\partial k}} \right| \leq 1 
    223240  \qquad \text{with }\  l =  l_k = l_\epsilon 
    224241\end{equation} 
    225 \autoref{eq:tke_mxl_constraint} means that the vertical variations of the length scale cannot be larger than 
     242\autoref{eq:ZDF_tke_mxl_constraint} means that the vertical variations of the length scale cannot be larger than 
    226243the variations of depth. 
    227 It provides a better approximation of the \citet{Gaspar1990} formulation while being much less  
     244It provides a better approximation of the \citet{gaspar.gregoris.ea_JGR90} formulation while being much less 
    228245time consuming. 
    229246In particular, it allows the length scale to be limited not only by the distance to the surface or 
    230247to the ocean bottom but also by the distance to a strongly stratified portion of the water column such as 
    231 the thermocline (\autoref{fig:mixing_length}). 
    232 In order to impose the \autoref{eq:tke_mxl_constraint} constraint, we introduce two additional length scales: 
     248the thermocline (\autoref{fig:ZDF_mixing_length}). 
     249In order to impose the \autoref{eq:ZDF_tke_mxl_constraint} constraint, we introduce two additional length scales: 
    233250$l_{up}$ and $l_{dwn}$, the upward and downward length scales, and 
    234251evaluate the dissipation and mixing length scales as 
     
    236253%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    237254\begin{figure}[!t] 
    238   \begin{center} 
    239     \includegraphics[width=1.00\textwidth]{Fig_mixing_length} 
    240     \caption{ 
    241       \protect\label{fig:mixing_length} 
    242       Illustration of the mixing length computation. 
    243     } 
    244   \end{center} 
     255  \centering 
     256  \includegraphics[width=\textwidth]{Fig_mixing_length} 
     257  \caption[Mixing length computation]{Illustration of the mixing length computation} 
     258  \label{fig:ZDF_mixing_length} 
    245259\end{figure} 
    246260%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    247261\[ 
    248   % \label{eq:tke_mxl2} 
     262  % \label{eq:ZDF_tke_mxl2} 
    249263  \begin{aligned} 
    250264    l_{up\ \ }^{(k)} &= \min \left(  l^{(k)} \ , \ l_{up}^{(k+1)} + e_{3t}^{(k)}\ \ \ \;  \right) 
     
    254268  \end{aligned} 
    255269\] 
    256 where $l^{(k)}$ is computed using \autoref{eq:tke_mxl0_1}, \ie $l^{(k)} = \sqrt {2 {\bar e}^{(k)} / {N^2}^{(k)} }$. 
    257  
    258 In the \np{nn\_mxl}\forcode{ = 2} case, the dissipation and mixing length scales take the same value: 
    259 $ l_k=  l_\epsilon = \min \left(\ l_{up} \;,\;  l_{dwn}\ \right)$, while in the \np{nn\_mxl}\forcode{ = 3} case, 
    260 the dissipation and mixing turbulent length scales are give as in \citet{Gaspar1990}: 
    261 \[ 
    262   % \label{eq:tke_mxl_gaspar} 
     270where $l^{(k)}$ is computed using \autoref{eq:ZDF_tke_mxl0_1}, \ie\ $l^{(k)} = \sqrt {2 {\bar e}^{(k)} / {N^2}^{(k)} }$. 
     271 
     272In the \np{nn\_mxl}\forcode{=2} case, the dissipation and mixing length scales take the same value: 
     273$ l_k=  l_\epsilon = \min \left(\ l_{up} \;,\;  l_{dwn}\ \right)$, while in the \np{nn\_mxl}\forcode{=3} case, 
     274the dissipation and mixing turbulent length scales are give as in \citet{gaspar.gregoris.ea_JGR90}: 
     275\[ 
     276  % \label{eq:ZDF_tke_mxl_gaspar} 
    263277  \begin{aligned} 
    264278    & l_k          = \sqrt{\  l_{up} \ \ l_{dwn}\ }   \\ 
     
    270284Usually the surface scale is given by $l_o = \kappa \,z_o$ where $\kappa = 0.4$ is von Karman's constant and 
    271285$z_o$ the roughness parameter of the surface. 
    272 Assuming $z_o=0.1$~m \citep{Craig_Banner_JPO94} leads to a 0.04~m, the default value of \np{rn\_mxl0}. 
     286Assuming $z_o=0.1$~m \citep{craig.banner_JPO94} leads to a 0.04~m, the default value of \np{rn\_mxl0}. 
    273287In the ocean interior a minimum length scale is set to recover the molecular viscosity when 
    274288$\bar{e}$ reach its minimum value ($1.10^{-6}= C_k\, l_{min} \,\sqrt{\bar{e}_{min}}$ ). 
     
    277291%-----------------------------------------------------------------------% 
    278292 
    279 Following \citet{Mellor_Blumberg_JPO04}, the TKE turbulence closure model has been modified to 
     293Following \citet{mellor.blumberg_JPO04}, the TKE turbulence closure model has been modified to 
    280294include the effect of surface wave breaking energetics. 
    281295This results in a reduction of summertime surface temperature when the mixed layer is relatively shallow. 
    282 The \citet{Mellor_Blumberg_JPO04} modifications acts on surface length scale and TKE values and 
    283 air-sea drag coefficient.  
    284 The latter concerns the bulk formulea and is not discussed here.  
    285  
    286 Following \citet{Craig_Banner_JPO94}, the boundary condition on surface TKE value is : 
     296The \citet{mellor.blumberg_JPO04} modifications acts on surface length scale and TKE values and 
     297air-sea drag coefficient. 
     298The latter concerns the bulk formulae and is not discussed here. 
     299 
     300Following \citet{craig.banner_JPO94}, the boundary condition on surface TKE value is : 
    287301\begin{equation} 
    288302  \label{eq:ZDF_Esbc} 
    289303  \bar{e}_o = \frac{1}{2}\,\left(  15.8\,\alpha_{CB} \right)^{2/3} \,\frac{|\tau|}{\rho_o} 
    290304\end{equation} 
    291 where $\alpha_{CB}$ is the \citet{Craig_Banner_JPO94} constant of proportionality which depends on the ''wave age'', 
    292 ranging from 57 for mature waves to 146 for younger waves \citep{Mellor_Blumberg_JPO04}.  
     305where $\alpha_{CB}$ is the \citet{craig.banner_JPO94} constant of proportionality which depends on the ''wave age'', 
     306ranging from 57 for mature waves to 146 for younger waves \citep{mellor.blumberg_JPO04}. 
    293307The boundary condition on the turbulent length scale follows the Charnock's relation: 
    294308\begin{equation} 
     
    297311\end{equation} 
    298312where $\kappa=0.40$ is the von Karman constant, and $\beta$ is the Charnock's constant. 
    299 \citet{Mellor_Blumberg_JPO04} suggest $\beta = 2.10^{5}$ the value chosen by 
    300 \citet{Stacey_JPO99} citing observation evidence, and 
     313\citet{mellor.blumberg_JPO04} suggest $\beta = 2.10^{5}$ the value chosen by 
     314\citet{stacey_JPO99} citing observation evidence, and 
    301315$\alpha_{CB} = 100$ the Craig and Banner's value. 
    302316As the surface boundary condition on TKE is prescribed through $\bar{e}_o = e_{bb} |\tau| / \rho_o$, 
    303 with $e_{bb}$ the \np{rn\_ebb} namelist parameter, setting \np{rn\_ebb}\forcode{ = 67.83} corresponds  
     317with $e_{bb}$ the \np{rn\_ebb} namelist parameter, setting \np{rn\_ebb}\forcode{ = 67.83} corresponds 
    304318to $\alpha_{CB} = 100$. 
    305 Further setting  \np{ln\_mxl0} to true applies \autoref{eq:ZDF_Lsbc} as surface boundary condition on length scale, 
     319Further setting  \np{ln\_mxl0}\forcode{ =.true.},  applies \autoref{eq:ZDF_Lsbc} as the surface boundary condition on the length scale, 
    306320with $\beta$ hard coded to the Stacey's value. 
    307 Note that a minimal threshold of \np{rn\_emin0}$=10^{-4}~m^2.s^{-2}$ (namelist parameters) is applied on 
     321Note that a minimal threshold of \np{rn\_emin0}$=10^{-4}~m^2.s^{-2}$ (namelist parameters) is applied on the 
    308322surface $\bar{e}$ value. 
    309323 
     
    315329Although LC have nothing to do with convection, the circulation pattern is rather similar to 
    316330so-called convective rolls in the atmospheric boundary layer. 
    317 The detailed physics behind LC is described in, for example, \citet{Craik_Leibovich_JFM76}. 
     331The detailed physics behind LC is described in, for example, \citet{craik.leibovich_JFM76}. 
    318332The prevailing explanation is that LC arise from a nonlinear interaction between the Stokes drift and 
    319 wind drift currents.  
     333wind drift currents. 
    320334 
    321335Here we introduced in the TKE turbulent closure the simple parameterization of Langmuir circulations proposed by 
    322 \citep{Axell_JGR02} for a $k-\epsilon$ turbulent closure. 
     336\citep{axell_JGR02} for a $k-\epsilon$ turbulent closure. 
    323337The parameterization, tuned against large-eddy simulation, includes the whole effect of LC in 
    324 an extra source terms of TKE, $P_{LC}$. 
    325 The presence of $P_{LC}$ in \autoref{eq:zdftke_e}, the TKE equation, is controlled by setting \np{ln\_lc} to 
    326 \forcode{.true.} in the namtke namelist. 
    327   
    328 By making an analogy with the characteristic convective velocity scale (\eg, \citet{D'Alessio_al_JPO98}), 
    329 $P_{LC}$ is assumed to be :  
     338an extra source term of TKE, $P_{LC}$. 
     339The presence of $P_{LC}$ in \autoref{eq:ZDF_tke_e}, the TKE equation, is controlled by setting \np{ln\_lc} to 
     340\forcode{.true.} in the \nam{zdf\_tke} namelist. 
     341 
     342By making an analogy with the characteristic convective velocity scale (\eg, \citet{dalessio.abdella.ea_JPO98}), 
     343$P_{LC}$ is assumed to be : 
    330344\[ 
    331345P_{LC}(z) = \frac{w_{LC}^3(z)}{H_{LC}} 
    332346\] 
    333347where $w_{LC}(z)$ is the vertical velocity profile of LC, and $H_{LC}$ is the LC depth. 
    334 With no information about the wave field, $w_{LC}$ is assumed to be proportional to  
    335 the Stokes drift $u_s = 0.377\,\,|\tau|^{1/2}$, where $|\tau|$ is the surface wind stress module  
    336 \footnote{Following \citet{Li_Garrett_JMR93}, the surface Stoke drift velocity may be expressed as 
     348With no information about the wave field, $w_{LC}$ is assumed to be proportional to 
     349the Stokes drift $u_s = 0.377\,\,|\tau|^{1/2}$, where $|\tau|$ is the surface wind stress module 
     350\footnote{Following \citet{li.garrett_JMR93}, the surface Stoke drift velocity may be expressed as 
    337351  $u_s =  0.016 \,|U_{10m}|$. 
    338352  Assuming an air density of $\rho_a=1.22 \,Kg/m^3$ and a drag coefficient of 
     
    341355For the vertical variation, $w_{LC}$ is assumed to be zero at the surface as well as at 
    342356a finite depth $H_{LC}$ (which is often close to the mixed layer depth), 
    343 and simply varies as a sine function in between (a first-order profile for the Langmuir cell structures).  
     357and simply varies as a sine function in between (a first-order profile for the Langmuir cell structures). 
    344358The resulting expression for $w_{LC}$ is : 
    345359\[ 
     
    350364  \end{cases} 
    351365\] 
    352 where $c_{LC} = 0.15$ has been chosen by \citep{Axell_JGR02} as a good compromise to fit LES data. 
     366where $c_{LC} = 0.15$ has been chosen by \citep{axell_JGR02} as a good compromise to fit LES data. 
    353367The chosen value yields maximum vertical velocities $w_{LC}$ of the order of a few centimeters per second. 
    354368The value of $c_{LC}$ is set through the \np{rn\_lc} namelist parameter, 
    355 having in mind that it should stay between 0.15 and 0.54 \citep{Axell_JGR02}.  
     369having in mind that it should stay between 0.15 and 0.54 \citep{axell_JGR02}. 
    356370 
    357371The $H_{LC}$ is estimated in a similar way as the turbulent length scale of TKE equations: 
    358 $H_{LC}$ is depth to which a water parcel with kinetic energy due to Stoke drift can reach on its own by 
    359 converting its kinetic energy to potential energy, according to  
     372$H_{LC}$ is the depth to which a water parcel with kinetic energy due to Stoke drift can reach on its own by 
     373converting its kinetic energy to potential energy, according to 
    360374\[ 
    361375- \int_{-H_{LC}}^0 { N^2\;z  \;dz} = \frac{1}{2} u_s^2 
     
    368382produce mixed-layer depths that are too shallow during summer months and windy conditions. 
    369383This bias is particularly acute over the Southern Ocean. 
    370 To overcome this systematic bias, an ad hoc parameterization is introduced into the TKE scheme \cite{Rodgers_2014}.  
    371 The parameterization is an empirical one, \ie not derived from theoretical considerations, 
    372 but rather is meant to account for observed processes that affect the density structure of  
    373 the ocean’s planetary boundary layer that are not explicitly captured by default in the TKE scheme  
    374 (\ie near-inertial oscillations and ocean swells and waves). 
    375  
    376 When using this parameterization (\ie when \np{nn\_etau}\forcode{ = 1}), 
     384To overcome this systematic bias, an ad hoc parameterization is introduced into the TKE scheme \cite{rodgers.aumont.ea_B14}. 
     385The parameterization is an empirical one, \ie\ not derived from theoretical considerations, 
     386but rather is meant to account for observed processes that affect the density structure of 
     387the ocean’s planetary boundary layer that are not explicitly captured by default in the TKE scheme 
     388(\ie\ near-inertial oscillations and ocean swells and waves). 
     389 
     390When using this parameterization (\ie\ when \np{nn\_etau}\forcode{=1}), 
    377391the TKE input to the ocean ($S$) imposed by the winds in the form of near-inertial oscillations, 
    378392swell and waves is parameterized by \autoref{eq:ZDF_Esbc} the standard TKE surface boundary condition, 
     
    383397\end{equation} 
    384398where $z$ is the depth, $e_s$ is TKE surface boundary condition, $f_r$ is the fraction of the surface TKE that 
    385 penetrate in the ocean, $h_\tau$ is a vertical mixing length scale that controls exponential shape of 
     399penetrates in the ocean, $h_\tau$ is a vertical mixing length scale that controls exponential shape of 
    386400the penetration, and $f_i$ is the ice concentration 
    387 (no penetration if $f_i=1$, that is if the ocean is entirely covered by sea-ice). 
     401(no penetration if $f_i=1$, \ie\ if the ocean is entirely covered by sea-ice). 
    388402The value of $f_r$, usually a few percents, is specified through \np{rn\_efr} namelist parameter. 
    389 The vertical mixing length scale, $h_\tau$, can be set as a 10~m uniform value (\np{nn\_etau}\forcode{ = 0}) or 
     403The vertical mixing length scale, $h_\tau$, can be set as a 10~m uniform value (\np{nn\_etau}\forcode{=0}) or 
    390404a latitude dependent value (varying from 0.5~m at the Equator to a maximum value of 30~m at high latitudes 
    391 (\np{nn\_etau}\forcode{ = 1}).  
    392  
    393 Note that two other option existe, \np{nn\_etau}\forcode{ = 2..3}. 
     405(\np{nn\_etau}\forcode{=1}). 
     406 
     407Note that two other option exist, \np{nn\_etau}\forcode{=2, 3}. 
    394408They correspond to applying \autoref{eq:ZDF_Ehtau} only at the base of the mixed layer, 
    395 or to using the high frequency part of the stress to evaluate the fraction of TKE that penetrate the ocean.  
     409or to using the high frequency part of the stress to evaluate the fraction of TKE that penetrates the ocean. 
    396410Those two options are obsolescent features introduced for test purposes. 
    397 They will be removed in the next release.  
    398  
    399 % from Burchard et al OM 2008 :  
    400 % the most critical process not reproduced by statistical turbulence models is the activity of  
    401 % internal waves and their interaction with turbulence. After the Reynolds decomposition,  
    402 % internal waves are in principle included in the RANS equations, but later partially  
    403 % excluded by the hydrostatic assumption and the model resolution.  
    404 % Thus far, the representation of internal wave mixing in ocean models has been relatively crude  
    405 % (\eg Mellor, 1989; Large et al., 1994; Meier, 2001; Axell, 2002; St. Laurent and Garrett, 2002). 
    406  
    407 % ------------------------------------------------------------------------------------------------------------- 
    408 %        TKE discretization considerations 
    409 % ------------------------------------------------------------------------------------------------------------- 
    410 \subsection{TKE discretization considerations (\protect\key{zdftke})} 
     411They will be removed in the next release. 
     412 
     413% This should be explain better below what this rn_eice parameter is meant for: 
     414In presence of Sea Ice, the value of this mixing can be modulated by the \np{rn\_eice} namelist parameter. 
     415This parameter varies from \forcode{0} for no effect to \forcode{4} to suppress the TKE input into the ocean when Sea Ice concentration 
     416is greater than 25\%. 
     417 
     418% from Burchard et al OM 2008 : 
     419% the most critical process not reproduced by statistical turbulence models is the activity of 
     420% internal waves and their interaction with turbulence. After the Reynolds decomposition, 
     421% internal waves are in principle included in the RANS equations, but later partially 
     422% excluded by the hydrostatic assumption and the model resolution. 
     423% Thus far, the representation of internal wave mixing in ocean models has been relatively crude 
     424% (\eg\ Mellor, 1989; Large et al., 1994; Meier, 2001; Axell, 2002; St. Laurent and Garrett, 2002). 
     425 
     426% ------------------------------------------------------------------------------------------------------------- 
     427%        GLS Generic Length Scale Scheme 
     428% ------------------------------------------------------------------------------------------------------------- 
     429\subsection[GLS: Generic Length Scale (\forcode{ln_zdfgls=.true.})] 
     430{GLS: Generic Length Scale (\protect\np{ln\_zdfgls}\forcode{=.true.})} 
     431\label{subsec:ZDF_gls} 
     432 
     433%--------------------------------------------namzdf_gls--------------------------------------------------------- 
     434 
     435\begin{listing} 
     436  \nlst{namzdf_gls} 
     437  \caption{\texttt{namzdf\_gls}} 
     438  \label{lst:namzdf_gls} 
     439\end{listing} 
     440%-------------------------------------------------------------------------------------------------------------- 
     441 
     442The Generic Length Scale (GLS) scheme is a turbulent closure scheme based on two prognostic equations: 
     443one for the turbulent kinetic energy $\bar {e}$, and another for the generic length scale, 
     444$\psi$ \citep{umlauf.burchard_JMR03, umlauf.burchard_CSR05}. 
     445This later variable is defined as: $\psi = {C_{0\mu}}^{p} \ {\bar{e}}^{m} \ l^{n}$, 
     446where the triplet $(p, m, n)$ value given in Tab.\autoref{tab:ZDF_GLS} allows to recover a number of 
     447well-known turbulent closures ($k$-$kl$ \citep{mellor.yamada_RG82}, $k$-$\epsilon$ \citep{rodi_JGR87}, 
     448$k$-$\omega$ \citep{wilcox_AJ88} among others \citep{umlauf.burchard_JMR03,kantha.carniel_JMR03}). 
     449The GLS scheme is given by the following set of equations: 
     450\begin{equation} 
     451  \label{eq:ZDF_gls_e} 
     452  \frac{\partial \bar{e}}{\partial t} = 
     453  \frac{K_m}{\sigma_e e_3 }\;\left[ {\left( \frac{\partial u}{\partial k} \right)^2 
     454      +\left( \frac{\partial v}{\partial k} \right)^2} \right] 
     455  -K_\rho \,N^2 
     456  +\frac{1}{e_3}\,\frac{\partial}{\partial k} \left[ \frac{K_m}{e_3}\,\frac{\partial \bar{e}}{\partial k} \right] 
     457  - \epsilon 
     458\end{equation} 
     459 
     460\[ 
     461  % \label{eq:ZDF_gls_psi} 
     462  \begin{split} 
     463    \frac{\partial \psi}{\partial t} =& \frac{\psi}{\bar{e}} \left\{ 
     464      \frac{C_1\,K_m}{\sigma_{\psi} {e_3}}\;\left[ {\left( \frac{\partial u}{\partial k} \right)^2 
     465          +\left( \frac{\partial v}{\partial k} \right)^2} \right] 
     466      - C_3 \,K_\rho\,N^2   - C_2 \,\epsilon \,Fw   \right\}             \\ 
     467    &+\frac{1}{e_3}  \;\frac{\partial }{\partial k}\left[ {\frac{K_m}{e_3 } 
     468        \;\frac{\partial \psi}{\partial k}} \right]\; 
     469  \end{split} 
     470\] 
     471 
     472\[ 
     473  % \label{eq:ZDF_gls_kz} 
     474  \begin{split} 
     475    K_m    &= C_{\mu} \ \sqrt {\bar{e}} \ l         \\ 
     476    K_\rho &= C_{\mu'}\ \sqrt {\bar{e}} \ l 
     477  \end{split} 
     478\] 
     479 
     480\[ 
     481  % \label{eq:ZDF_gls_eps} 
     482  {\epsilon} = C_{0\mu} \,\frac{\bar {e}^{3/2}}{l} \; 
     483\] 
     484where $N$ is the local Brunt-Vais\"{a}l\"{a} frequency (see \autoref{subsec:TRA_bn2}) and 
     485$\epsilon$ the dissipation rate. 
     486The constants $C_1$, $C_2$, $C_3$, ${\sigma_e}$, ${\sigma_{\psi}}$ and the wall function ($Fw$) depends of 
     487the choice of the turbulence model. 
     488Four different turbulent models are pre-defined (\autoref{tab:ZDF_GLS}). 
     489They are made available through the \np{nn\_clo} namelist parameter. 
     490 
     491%--------------------------------------------------TABLE-------------------------------------------------- 
     492\begin{table}[htbp] 
     493  \centering 
     494  % \begin{tabular}{cp{70pt}cp{70pt}cp{70pt}cp{70pt}cp{70pt}cp{70pt}c} 
     495  \begin{tabular}{ccccc} 
     496    &   $k-kl$   & $k-\epsilon$ & $k-\omega$ &   generic   \\ 
     497    % & \citep{mellor.yamada_RG82} &  \citep{rodi_JGR87}       & \citep{wilcox_AJ88} &                 \\ 
     498    \hline 
     499    \hline 
     500    \np{nn\_clo}     & \textbf{0} &   \textbf{1}  &   \textbf{2}   &    \textbf{3}   \\ 
     501    \hline 
     502    $( p , n , m )$         &   ( 0 , 1 , 1 )   & ( 3 , 1.5 , -1 )   & ( -1 , 0.5 , -1 )    &  ( 2 , 1 , -0.67 )  \\ 
     503    $\sigma_k$      &    2.44         &     1.              &      2.                &      0.8          \\ 
     504    $\sigma_\psi$  &    2.44         &     1.3            &      2.                 &       1.07       \\ 
     505    $C_1$              &      0.9         &     1.44          &      0.555          &       1.           \\ 
     506    $C_2$              &      0.5         &     1.92          &      0.833          &       1.22       \\ 
     507    $C_3$              &      1.           &     1.              &      1.                &       1.           \\ 
     508    $F_{wall}$        &      Yes        &       --             &     --                  &      --          \\ 
     509    \hline 
     510    \hline 
     511  \end{tabular} 
     512  \caption[Set of predefined GLS parameters or equivalently predefined turbulence models available]{ 
     513    Set of predefined GLS parameters, or equivalently predefined turbulence models available with 
     514    \protect\np{ln\_zdfgls}\forcode{=.true.} and controlled by 
     515    the \protect\np{nn\_clos} namelist variable in \protect\nam{zdf\_gls}.} 
     516  \label{tab:ZDF_GLS} 
     517\end{table} 
     518%-------------------------------------------------------------------------------------------------------------- 
     519 
     520In the Mellor-Yamada model, the negativity of $n$ allows to use a wall function to force the convergence of 
     521the mixing length towards $\kappa z_b$ ($\kappa$ is the Von Karman constant and $z_b$ the rugosity length scale) value near physical boundaries 
     522(logarithmic boundary layer law). 
     523$C_{\mu}$ and $C_{\mu'}$ are calculated from stability function proposed by \citet{galperin.kantha.ea_JAS88}, 
     524or by \citet{kantha.clayson_JGR94} or one of the two functions suggested by \citet{canuto.howard.ea_JPO01} 
     525(\np{nn\_stab\_func}\forcode{=0, 3}, resp.). 
     526The value of $C_{0\mu}$ depends on the choice of the stability function. 
     527 
     528The surface and bottom boundary condition on both $\bar{e}$ and $\psi$ can be calculated thanks to Dirichlet or 
     529Neumann condition through \np{nn\_bc\_surf} and \np{nn\_bc\_bot}, resp. 
     530As for TKE closure, the wave effect on the mixing is considered when 
     531\np{rn\_crban}\forcode{ > 0.} \citep{craig.banner_JPO94, mellor.blumberg_JPO04}. 
     532The \np{rn\_crban} namelist parameter is $\alpha_{CB}$ in \autoref{eq:ZDF_Esbc} and 
     533\np{rn\_charn} provides the value of $\beta$ in \autoref{eq:ZDF_Lsbc}. 
     534 
     535The $\psi$ equation is known to fail in stably stratified flows, and for this reason 
     536almost all authors apply a clipping of the length scale as an \textit{ad hoc} remedy. 
     537With this clipping, the maximum permissible length scale is determined by $l_{max} = c_{lim} \sqrt{2\bar{e}}/ N$. 
     538A value of $c_{lim} = 0.53$ is often used \citep{galperin.kantha.ea_JAS88}. 
     539\cite{umlauf.burchard_CSR05} show that the value of the clipping factor is of crucial importance for 
     540the entrainment depth predicted in stably stratified situations, 
     541and that its value has to be chosen in accordance with the algebraic model for the turbulent fluxes. 
     542The clipping is only activated if \np{ln\_length\_lim}\forcode{=.true.}, 
     543and the $c_{lim}$ is set to the \np{rn\_clim\_galp} value. 
     544 
     545The time and space discretization of the GLS equations follows the same energetic consideration as for 
     546the TKE case described in \autoref{subsec:ZDF_tke_ene} \citep{burchard_OM02}. 
     547Evaluation of the 4 GLS turbulent closure schemes can be found in \citet{warner.sherwood.ea_OM05} in ROMS model and 
     548 in \citet{reffray.guillaume.ea_GMD15} for the \NEMO\ model. 
     549 
     550 
     551% ------------------------------------------------------------------------------------------------------------- 
     552%        OSM OSMOSIS BL Scheme 
     553% ------------------------------------------------------------------------------------------------------------- 
     554\subsection[OSM: OSMosis boundary layer scheme (\forcode{ln_zdfosm=.true.})] 
     555{OSM: OSMosis boundary layer scheme (\protect\np{ln\_zdfosm}\forcode{=.true.})} 
     556\label{subsec:ZDF_osm} 
     557%--------------------------------------------namzdf_osm--------------------------------------------------------- 
     558 
     559\begin{listing} 
     560  \nlst{namzdf_osm} 
     561  \caption{\texttt{namzdf\_osm}} 
     562  \label{lst:namzdf_osm} 
     563\end{listing} 
     564%-------------------------------------------------------------------------------------------------------------- 
     565 
     566The OSMOSIS turbulent closure scheme is based on......   TBC 
     567 
     568% ------------------------------------------------------------------------------------------------------------- 
     569%        TKE and GLS discretization considerations 
     570% ------------------------------------------------------------------------------------------------------------- 
     571\subsection[ Discrete energy conservation for TKE and GLS schemes] 
     572{Discrete energy conservation for TKE and GLS schemes} 
    411573\label{subsec:ZDF_tke_ene} 
    412574 
    413575%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    414576\begin{figure}[!t] 
    415   \begin{center} 
    416     \includegraphics[width=1.00\textwidth]{Fig_ZDF_TKE_time_scheme} 
    417     \caption{ 
    418       \protect\label{fig:TKE_time_scheme} 
    419       Illustration of the TKE time integration and its links to the momentum and tracer time integration. 
    420     } 
    421   \end{center}   
     577  \centering 
     578  \includegraphics[width=\textwidth]{Fig_ZDF_TKE_time_scheme} 
     579  \caption[Subgrid kinetic energy integration in GLS and TKE schemes]{ 
     580    Illustration of the subgrid kinetic energy integration in GLS and TKE schemes and 
     581    its links to the momentum and tracer time integration.} 
     582  \label{fig:ZDF_TKE_time_scheme} 
    422583\end{figure} 
    423584%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    424585 
    425586The production of turbulence by vertical shear (the first term of the right hand side of 
    426 \autoref{eq:zdftke_e}) should balance the loss of kinetic energy associated with the vertical momentum diffusion 
    427 (first line in \autoref{eq:PE_zdf}). 
    428 To do so a special care have to be taken for both the time and space discretization of 
    429 the TKE equation \citep{Burchard_OM02,Marsaleix_al_OM08}. 
    430  
    431 Let us first address the time stepping issue. \autoref{fig:TKE_time_scheme} shows how 
     587\autoref{eq:ZDF_tke_e}) and  \autoref{eq:ZDF_gls_e}) should balance the loss of kinetic energy associated with the vertical momentum diffusion 
     588(first line in \autoref{eq:MB_zdf}). 
     589To do so a special care has to be taken for both the time and space discretization of 
     590the kinetic energy equation \citep{burchard_OM02,marsaleix.auclair.ea_OM08}. 
     591 
     592Let us first address the time stepping issue. \autoref{fig:ZDF_TKE_time_scheme} shows how 
    432593the two-level Leap-Frog time stepping of the momentum and tracer equations interplays with 
    433 the one-level forward time stepping of TKE equation. 
     594the one-level forward time stepping of the equation for $\bar{e}$. 
    434595With this framework, the total loss of kinetic energy (in 1D for the demonstration) due to 
    435596the vertical momentum diffusion is obtained by multiplying this quantity by $u^t$ and 
    436 summing the result vertically:    
     597summing the result vertically: 
    437598\begin{equation} 
    438   \label{eq:energ1} 
     599  \label{eq:ZDF_energ1} 
    439600  \begin{split} 
    440601    \int_{-H}^{\eta}  u^t \,\partial_z &\left( {K_m}^t \,(\partial_z u)^{t+\rdt}  \right) \,dz   \\ 
     
    444605\end{equation} 
    445606Here, the vertical diffusion of momentum is discretized backward in time with a coefficient, $K_m$, 
    446 known at time $t$ (\autoref{fig:TKE_time_scheme}), as it is required when using the TKE scheme 
    447 (see \autoref{sec:STP_forward_imp}). 
    448 The first term of the right hand side of \autoref{eq:energ1} represents the kinetic energy transfer at 
     607known at time $t$ (\autoref{fig:ZDF_TKE_time_scheme}), as it is required when using the TKE scheme 
     608(see \autoref{sec:TD_forward_imp}). 
     609The first term of the right hand side of \autoref{eq:ZDF_energ1} represents the kinetic energy transfer at 
    449610the surface (atmospheric forcing) and at the bottom (friction effect). 
    450611The second term is always negative. 
    451612It is the dissipation rate of kinetic energy, and thus minus the shear production rate of $\bar{e}$. 
    452 \autoref{eq:energ1} implies that, to be energetically consistent, 
     613\autoref{eq:ZDF_energ1} implies that, to be energetically consistent, 
    453614the production rate of $\bar{e}$ used to compute $(\bar{e})^t$ (and thus ${K_m}^t$) should be expressed as 
    454615${K_m}^{t-\rdt}\,(\partial_z u)^{t-\rdt} \,(\partial_z u)^t$ 
     
    456617 
    457618A similar consideration applies on the destruction rate of $\bar{e}$ due to stratification 
    458 (second term of the right hand side of \autoref{eq:zdftke_e}). 
     619(second term of the right hand side of \autoref{eq:ZDF_tke_e} and \autoref{eq:ZDF_gls_e}). 
    459620This term must balance the input of potential energy resulting from vertical mixing. 
    460 The rate of change of potential energy (in 1D for the demonstration) due vertical mixing is obtained by 
    461 multiplying vertical density diffusion tendency by $g\,z$ and and summing the result vertically: 
     621The rate of change of potential energy (in 1D for the demonstration) due to vertical mixing is obtained by 
     622multiplying the vertical density diffusion tendency by $g\,z$ and and summing the result vertically: 
    462623\begin{equation} 
    463   \label{eq:energ2} 
     624  \label{eq:ZDF_energ2} 
    464625  \begin{split} 
    465626    \int_{-H}^{\eta} g\,z\,\partial_z &\left( {K_\rho}^t \,(\partial_k \rho)^{t+\rdt}   \right) \,dz    \\ 
     
    470631  \end{split} 
    471632\end{equation} 
    472 where we use $N^2 = -g \,\partial_k \rho / (e_3 \rho)$.  
    473 The first term of the right hand side of \autoref{eq:energ2} is always zero because 
     633where we use $N^2 = -g \,\partial_k \rho / (e_3 \rho)$. 
     634The first term of the right hand side of \autoref{eq:ZDF_energ2} is always zero because 
    474635there is no diffusive flux through the ocean surface and bottom). 
    475636The second term is minus the destruction rate of  $\bar{e}$ due to stratification. 
    476 Therefore \autoref{eq:energ1} implies that, to be energetically consistent, 
    477 the product ${K_\rho}^{t-\rdt}\,(N^2)^t$ should be used in \autoref{eq:zdftke_e}, the TKE equation. 
     637Therefore \autoref{eq:ZDF_energ1} implies that, to be energetically consistent, 
     638the product ${K_\rho}^{t-\rdt}\,(N^2)^t$ should be used in \autoref{eq:ZDF_tke_e} and  \autoref{eq:ZDF_gls_e}. 
    478639 
    479640Let us now address the space discretization issue. 
    480641The vertical eddy coefficients are defined at $w$-point whereas the horizontal velocity components are in 
    481 the centre of the side faces of a $t$-box in staggered C-grid (\autoref{fig:cell}). 
     642the centre of the side faces of a $t$-box in staggered C-grid (\autoref{fig:DOM_cell}). 
    482643A space averaging is thus required to obtain the shear TKE production term. 
    483 By redoing the \autoref{eq:energ1} in the 3D case, it can be shown that the product of eddy coefficient by 
     644By redoing the \autoref{eq:ZDF_energ1} in the 3D case, it can be shown that the product of eddy coefficient by 
    484645the shear at $t$ and $t-\rdt$ must be performed prior to the averaging. 
    485 Furthermore, the possible time variation of $e_3$ (\key{vvl} case) have to be taken into account. 
     646Furthermore, the time variation of $e_3$ has be taken into account. 
    486647 
    487648The above energetic considerations leads to the following final discrete form for the TKE equation: 
    488649\begin{equation} 
    489   \label{eq:zdftke_ene} 
     650  \label{eq:ZDF_tke_ene} 
    490651  \begin{split} 
    491652    \frac { (\bar{e})^t - (\bar{e})^{t-\rdt} } {\rdt}  \equiv 
     
    504665  \end{split} 
    505666\end{equation} 
    506 where the last two terms in \autoref{eq:zdftke_ene} (vertical diffusion and Kolmogorov dissipation) 
    507 are time stepped using a backward scheme (see\autoref{sec:STP_forward_imp}). 
     667where the last two terms in \autoref{eq:ZDF_tke_ene} (vertical diffusion and Kolmogorov dissipation) 
     668are time stepped using a backward scheme (see\autoref{sec:TD_forward_imp}). 
    508669Note that the Kolmogorov term has been linearized in time in order to render the implicit computation possible. 
    509 The restart of the TKE scheme requires the storage of $\bar {e}$, $K_m$, $K_\rho$ and $l_\epsilon$ as 
    510 they all appear in the right hand side of \autoref{eq:zdftke_ene}. 
    511 For the latter, it is in fact the ratio $\sqrt{\bar{e}}/l_\epsilon$ which is stored.  
    512  
    513 % ------------------------------------------------------------------------------------------------------------- 
    514 %        GLS Generic Length Scale Scheme  
    515 % ------------------------------------------------------------------------------------------------------------- 
    516 \subsection{GLS: Generic Length Scale (\protect\key{zdfgls})} 
    517 \label{subsec:ZDF_gls} 
    518  
    519 %--------------------------------------------namzdf_gls--------------------------------------------------------- 
    520  
    521 \nlst{namzdf_gls} 
    522 %-------------------------------------------------------------------------------------------------------------- 
    523  
    524 The Generic Length Scale (GLS) scheme is a turbulent closure scheme based on two prognostic equations: 
    525 one for the turbulent kinetic energy $\bar {e}$, and another for the generic length scale, 
    526 $\psi$ \citep{Umlauf_Burchard_JMS03, Umlauf_Burchard_CSR05}. 
    527 This later variable is defined as: $\psi = {C_{0\mu}}^{p} \ {\bar{e}}^{m} \ l^{n}$,  
    528 where the triplet $(p, m, n)$ value given in Tab.\autoref{tab:GLS} allows to recover a number of 
    529 well-known turbulent closures ($k$-$kl$ \citep{Mellor_Yamada_1982}, $k$-$\epsilon$ \citep{Rodi_1987}, 
    530 $k$-$\omega$ \citep{Wilcox_1988} among others \citep{Umlauf_Burchard_JMS03,Kantha_Carniel_CSR05}).  
    531 The GLS scheme is given by the following set of equations: 
    532 \begin{equation} 
    533   \label{eq:zdfgls_e} 
    534   \frac{\partial \bar{e}}{\partial t} = 
    535   \frac{K_m}{\sigma_e e_3 }\;\left[ {\left( \frac{\partial u}{\partial k} \right)^2 
    536       +\left( \frac{\partial v}{\partial k} \right)^2} \right] 
    537   -K_\rho \,N^2 
    538   +\frac{1}{e_3}\,\frac{\partial}{\partial k} \left[ \frac{K_m}{e_3}\,\frac{\partial \bar{e}}{\partial k} \right] 
    539   - \epsilon 
    540 \end{equation} 
    541  
    542 \[ 
    543   % \label{eq:zdfgls_psi} 
    544   \begin{split} 
    545     \frac{\partial \psi}{\partial t} =& \frac{\psi}{\bar{e}} \left\{ 
    546       \frac{C_1\,K_m}{\sigma_{\psi} {e_3}}\;\left[ {\left( \frac{\partial u}{\partial k} \right)^2 
    547           +\left( \frac{\partial v}{\partial k} \right)^2} \right] 
    548       - C_3 \,K_\rho\,N^2   - C_2 \,\epsilon \,Fw   \right\}             \\ 
    549     &+\frac{1}{e_3}  \;\frac{\partial }{\partial k}\left[ {\frac{K_m}{e_3 } 
    550         \;\frac{\partial \psi}{\partial k}} \right]\; 
    551   \end{split} 
    552 \] 
    553  
    554 \[ 
    555   % \label{eq:zdfgls_kz} 
    556   \begin{split} 
    557     K_m    &= C_{\mu} \ \sqrt {\bar{e}} \ l         \\ 
    558     K_\rho &= C_{\mu'}\ \sqrt {\bar{e}} \ l 
    559   \end{split} 
    560 \] 
    561  
    562 \[ 
    563   % \label{eq:zdfgls_eps} 
    564   {\epsilon} = C_{0\mu} \,\frac{\bar {e}^{3/2}}{l} \; 
    565 \] 
    566 where $N$ is the local Brunt-Vais\"{a}l\"{a} frequency (see \autoref{subsec:TRA_bn2}) and 
    567 $\epsilon$ the dissipation rate.  
    568 The constants $C_1$, $C_2$, $C_3$, ${\sigma_e}$, ${\sigma_{\psi}}$ and the wall function ($Fw$) depends of 
    569 the choice of the turbulence model. 
    570 Four different turbulent models are pre-defined (Tab.\autoref{tab:GLS}). 
    571 They are made available through the \np{nn\_clo} namelist parameter.  
    572  
    573 %--------------------------------------------------TABLE-------------------------------------------------- 
    574 \begin{table}[htbp] 
    575   \begin{center} 
    576     % \begin{tabular}{cp{70pt}cp{70pt}cp{70pt}cp{70pt}cp{70pt}cp{70pt}c} 
    577     \begin{tabular}{ccccc} 
    578       &   $k-kl$   & $k-\epsilon$ & $k-\omega$ &   generic   \\ 
    579       % & \citep{Mellor_Yamada_1982} &  \citep{Rodi_1987}       & \citep{Wilcox_1988} &                 \\ 
    580       \hline 
    581       \hline 
    582       \np{nn\_clo}     & \textbf{0} &   \textbf{1}  &   \textbf{2}   &    \textbf{3}   \\ 
    583       \hline 
    584       $( p , n , m )$          &   ( 0 , 1 , 1 )   & ( 3 , 1.5 , -1 )   & ( -1 , 0.5 , -1 )    &  ( 2 , 1 , -0.67 )  \\ 
    585       $\sigma_k$      &    2.44         &     1.              &      2.                &      0.8          \\ 
    586       $\sigma_\psi$  &    2.44         &     1.3            &      2.                 &       1.07       \\ 
    587       $C_1$              &      0.9         &     1.44          &      0.555          &       1.           \\ 
    588       $C_2$              &      0.5         &     1.92          &      0.833          &       1.22       \\ 
    589       $C_3$              &      1.           &     1.              &      1.                &       1.           \\ 
    590       $F_{wall}$        &      Yes        &       --             &     --                  &      --          \\ 
    591       \hline 
    592       \hline 
    593     \end{tabular} 
    594     \caption{ 
    595       \protect\label{tab:GLS} 
    596       Set of predefined GLS parameters, or equivalently predefined turbulence models available with 
    597       \protect\key{zdfgls} and controlled by the \protect\np{nn\_clos} namelist variable in \protect\ngn{namzdf\_gls}. 
    598     } 
    599   \end{center} 
    600 \end{table} 
    601 %-------------------------------------------------------------------------------------------------------------- 
    602  
    603 In the Mellor-Yamada model, the negativity of $n$ allows to use a wall function to force the convergence of 
    604 the mixing length towards $K z_b$ ($K$: Kappa and $z_b$: rugosity length) value near physical boundaries 
    605 (logarithmic boundary layer law). 
    606 $C_{\mu}$ and $C_{\mu'}$ are calculated from stability function proposed by \citet{Galperin_al_JAS88}, 
    607 or by \citet{Kantha_Clayson_1994} or one of the two functions suggested by \citet{Canuto_2001} 
    608 (\np{nn\_stab\_func}\forcode{ = 0..3}, resp.).  
    609 The value of $C_{0\mu}$ depends of the choice of the stability function. 
    610  
    611 The surface and bottom boundary condition on both $\bar{e}$ and $\psi$ can be calculated thanks to Dirichlet or 
    612 Neumann condition through \np{nn\_tkebc\_surf} and \np{nn\_tkebc\_bot}, resp. 
    613 As for TKE closure, the wave effect on the mixing is considered when 
    614 \np{ln\_crban}\forcode{ = .true.} \citep{Craig_Banner_JPO94, Mellor_Blumberg_JPO04}. 
    615 The \np{rn\_crban} namelist parameter is $\alpha_{CB}$ in \autoref{eq:ZDF_Esbc} and 
    616 \np{rn\_charn} provides the value of $\beta$ in \autoref{eq:ZDF_Lsbc}.  
    617  
    618 The $\psi$ equation is known to fail in stably stratified flows, and for this reason 
    619 almost all authors apply a clipping of the length scale as an \textit{ad hoc} remedy. 
    620 With this clipping, the maximum permissible length scale is determined by $l_{max} = c_{lim} \sqrt{2\bar{e}}/ N$. 
    621 A value of $c_{lim} = 0.53$ is often used \citep{Galperin_al_JAS88}. 
    622 \cite{Umlauf_Burchard_CSR05} show that the value of the clipping factor is of crucial importance for 
    623 the entrainment depth predicted in stably stratified situations, 
    624 and that its value has to be chosen in accordance with the algebraic model for the turbulent fluxes. 
    625 The clipping is only activated if \np{ln\_length\_lim}\forcode{ = .true.}, 
    626 and the $c_{lim}$ is set to the \np{rn\_clim\_galp} value. 
    627  
    628 The time and space discretization of the GLS equations follows the same energetic consideration as for 
    629 the TKE case described in \autoref{subsec:ZDF_tke_ene} \citep{Burchard_OM02}. 
    630 Examples of performance of the 4 turbulent closure scheme can be found in \citet{Warner_al_OM05}. 
    631  
    632 % ------------------------------------------------------------------------------------------------------------- 
    633 %        OSM OSMOSIS BL Scheme  
    634 % ------------------------------------------------------------------------------------------------------------- 
    635 \subsection{OSM: OSMOSIS boundary layer scheme (\protect\key{zdfosm})} 
    636 \label{subsec:ZDF_osm} 
    637  
    638 %--------------------------------------------namzdf_osm--------------------------------------------------------- 
    639  
    640 \nlst{namzdf_osm} 
    641 %-------------------------------------------------------------------------------------------------------------- 
    642  
    643 The OSMOSIS turbulent closure scheme is based on......   TBC 
     670%The restart of the TKE scheme requires the storage of $\bar {e}$, $K_m$, $K_\rho$ and $l_\epsilon$ as 
     671%they all appear in the right hand side of \autoref{eq:ZDF_tke_ene}. 
     672%For the latter, it is in fact the ratio $\sqrt{\bar{e}}/l_\epsilon$ which is stored. 
    644673 
    645674% ================================================================ 
     
    649678\label{sec:ZDF_conv} 
    650679 
    651 %--------------------------------------------namzdf-------------------------------------------------------- 
    652  
    653 \nlst{namzdf} 
    654 %-------------------------------------------------------------------------------------------------------------- 
    655  
    656 Static instabilities (\ie light potential densities under heavy ones) may occur at particular ocean grid points. 
     680Static instabilities (\ie\ light potential densities under heavy ones) may occur at particular ocean grid points. 
    657681In nature, convective processes quickly re-establish the static stability of the water column. 
    658682These processes have been removed from the model via the hydrostatic assumption so they must be parameterized. 
     
    662686 
    663687% ------------------------------------------------------------------------------------------------------------- 
    664 %       Non-Penetrative Convective Adjustment  
    665 % ------------------------------------------------------------------------------------------------------------- 
    666 \subsection[Non-penetrative convective adjmt (\protect\np{ln\_tranpc}\forcode{ = .true.})] 
    667             {Non-penetrative convective adjustment (\protect\np{ln\_tranpc}\forcode{ = .true.})} 
     688%       Non-Penetrative Convective Adjustment 
     689% ------------------------------------------------------------------------------------------------------------- 
     690\subsection[Non-penetrative convective adjustment (\forcode{ln_tranpc=.true.})] 
     691{Non-penetrative convective adjustment (\protect\np{ln\_tranpc}\forcode{=.true.})} 
    668692\label{subsec:ZDF_npc} 
    669  
    670 %--------------------------------------------namzdf-------------------------------------------------------- 
    671  
    672 \nlst{namzdf} 
    673 %-------------------------------------------------------------------------------------------------------------- 
    674693 
    675694%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    676695\begin{figure}[!htb] 
    677   \begin{center} 
    678     \includegraphics[width=0.90\textwidth]{Fig_npc} 
    679     \caption{ 
    680       \protect\label{fig:npc} 
    681       Example of an unstable density profile treated by the non penetrative convective adjustment algorithm. 
    682       $1^{st}$ step: the initial profile is checked from the surface to the bottom. 
    683       It is found to be unstable between levels 3 and 4. 
    684       They are mixed. 
    685       The resulting $\rho$ is still larger than $\rho$(5): levels 3 to 5 are mixed. 
    686       The resulting $\rho$ is still larger than $\rho$(6): levels 3 to 6 are mixed. 
    687       The $1^{st}$ step ends since the density profile is then stable below the level 3. 
    688       $2^{nd}$ step: the new $\rho$ profile is checked following the same procedure as in $1^{st}$ step: 
    689       levels 2 to 5 are mixed. 
    690       The new density profile is checked. 
    691       It is found stable: end of algorithm. 
    692     } 
    693   \end{center} 
     696  \centering 
     697  \includegraphics[width=\textwidth]{Fig_npc} 
     698  \caption[Unstable density profile treated by the non penetrative convective adjustment algorithm]{ 
     699    Example of an unstable density profile treated by 
     700    the non penetrative convective adjustment algorithm. 
     701    $1^{st}$ step: the initial profile is checked from the surface to the bottom. 
     702    It is found to be unstable between levels 3 and 4. 
     703    They are mixed. 
     704    The resulting $\rho$ is still larger than $\rho$(5): levels 3 to 5 are mixed. 
     705    The resulting $\rho$ is still larger than $\rho$(6): levels 3 to 6 are mixed. 
     706    The $1^{st}$ step ends since the density profile is then stable below the level 3. 
     707    $2^{nd}$ step: the new $\rho$ profile is checked following the same procedure as in $1^{st}$ step: 
     708    levels 2 to 5 are mixed. 
     709    The new density profile is checked. 
     710    It is found stable: end of algorithm.} 
     711  \label{fig:ZDF_npc} 
    694712\end{figure} 
    695713%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    696714 
    697 Options are defined through the \ngn{namzdf} namelist variables. 
    698 The non-penetrative convective adjustment is used when \np{ln\_zdfnpc}\forcode{ = .true.}. 
     715Options are defined through the \nam{zdf} namelist variables. 
     716The non-penetrative convective adjustment is used when \np{ln\_zdfnpc}\forcode{=.true.}. 
    699717It is applied at each \np{nn\_npc} time step and mixes downwards instantaneously the statically unstable portion of 
    700718the water column, but only until the density structure becomes neutrally stable 
    701 (\ie until the mixed portion of the water column has \textit{exactly} the density of the water just below) 
    702 \citep{Madec_al_JPO91}. 
    703 The associated algorithm is an iterative process used in the following way (\autoref{fig:npc}): 
     719(\ie\ until the mixed portion of the water column has \textit{exactly} the density of the water just below) 
     720\citep{madec.delecluse.ea_JPO91}. 
     721The associated algorithm is an iterative process used in the following way (\autoref{fig:ZDF_npc}): 
    704722starting from the top of the ocean, the first instability is found. 
    705723Assume in the following that the instability is located between levels $k$ and $k+1$. 
     
    716734This algorithm is significantly different from mixing statically unstable levels two by two. 
    717735The latter procedure cannot converge with a finite number of iterations for some vertical profiles while 
    718 the algorithm used in \NEMO converges for any profile in a number of iterations which is less than 
     736the algorithm used in \NEMO\ converges for any profile in a number of iterations which is less than 
    719737the number of vertical levels. 
    720 This property is of paramount importance as pointed out by \citet{Killworth1989}: 
     738This property is of paramount importance as pointed out by \citet{killworth_iprc89}: 
    721739it avoids the existence of permanent and unrealistic static instabilities at the sea surface. 
    722740This non-penetrative convective algorithm has been proved successful in studies of the deep water formation in 
    723 the north-western Mediterranean Sea \citep{Madec_al_JPO91, Madec_al_DAO91, Madec_Crepon_Bk91}. 
     741the north-western Mediterranean Sea \citep{madec.delecluse.ea_JPO91, madec.chartier.ea_DAO91, madec.crepon_iprc91}. 
    724742 
    725743The current implementation has been modified in order to deal with any non linear equation of seawater 
    726744(L. Brodeau, personnal communication). 
    727745Two main differences have been introduced compared to the original algorithm: 
    728 $(i)$ the stability is now checked using the Brunt-V\"{a}is\"{a}l\"{a} frequency  
    729 (not the the difference in potential density);  
     746$(i)$ the stability is now checked using the Brunt-V\"{a}is\"{a}l\"{a} frequency 
     747(not the difference in potential density); 
    730748$(ii)$ when two levels are found unstable, their thermal and haline expansion coefficients are vertically mixed in 
    731749the same way their temperature and salinity has been mixed. 
     
    734752 
    735753% ------------------------------------------------------------------------------------------------------------- 
    736 %       Enhanced Vertical Diffusion  
    737 % ------------------------------------------------------------------------------------------------------------- 
    738 \subsection{Enhanced vertical diffusion (\protect\np{ln\_zdfevd}\forcode{ = .true.})} 
     754%       Enhanced Vertical Diffusion 
     755% ------------------------------------------------------------------------------------------------------------- 
     756\subsection[Enhanced vertical diffusion (\forcode{ln_zdfevd=.true.})] 
     757{Enhanced vertical diffusion (\protect\np{ln\_zdfevd}\forcode{=.true.})} 
    739758\label{subsec:ZDF_evd} 
    740759 
    741 %--------------------------------------------namzdf-------------------------------------------------------- 
    742  
    743 \nlst{namzdf} 
    744 %-------------------------------------------------------------------------------------------------------------- 
    745  
    746 Options are defined through the  \ngn{namzdf} namelist variables. 
    747 The enhanced vertical diffusion parameterisation is used when \np{ln\_zdfevd}\forcode{ = .true.}. 
     760Options are defined through the  \nam{zdf} namelist variables. 
     761The enhanced vertical diffusion parameterisation is used when \np{ln\_zdfevd}\forcode{=.true.}. 
    748762In this case, the vertical eddy mixing coefficients are assigned very large values 
    749 (a typical value is $10\;m^2s^{-1})$ in regions where the stratification is unstable 
    750 (\ie when $N^2$ the Brunt-Vais\"{a}l\"{a} frequency is negative) \citep{Lazar_PhD97, Lazar_al_JPO99}. 
    751 This is done either on tracers only (\np{nn\_evdm}\forcode{ = 0}) or 
    752 on both momentum and tracers (\np{nn\_evdm}\forcode{ = 1}). 
    753  
    754 In practice, where $N^2\leq 10^{-12}$, $A_T^{vT}$ and $A_T^{vS}$, and if \np{nn\_evdm}\forcode{ = 1}, 
     763in regions where the stratification is unstable 
     764(\ie\ when $N^2$ the Brunt-Vais\"{a}l\"{a} frequency is negative) \citep{lazar_phd97, lazar.madec.ea_JPO99}. 
     765This is done either on tracers only (\np{nn\_evdm}\forcode{=0}) or 
     766on both momentum and tracers (\np{nn\_evdm}\forcode{=1}). 
     767 
     768In practice, where $N^2\leq 10^{-12}$, $A_T^{vT}$ and $A_T^{vS}$, and if \np{nn\_evdm}\forcode{=1}, 
    755769the four neighbouring $A_u^{vm} \;\mbox{and}\;A_v^{vm}$ values also, are set equal to 
    756770the namelist parameter \np{rn\_avevd}. 
     
    759773the convective adjustment algorithm presented above when mixing both tracers and 
    760774momentum in the case of static instabilities. 
    761 It requires the use of an implicit time stepping on vertical diffusion terms 
    762 (\ie np{ln\_zdfexp}\forcode{ = .false.}). 
    763775 
    764776Note that the stability test is performed on both \textit{before} and \textit{now} values of $N^2$. 
    765777This removes a potential source of divergence of odd and even time step in 
    766 a leapfrog environment \citep{Leclair_PhD2010} (see \autoref{sec:STP_mLF}). 
    767  
    768 % ------------------------------------------------------------------------------------------------------------- 
    769 %       Turbulent Closure Scheme  
    770 % ------------------------------------------------------------------------------------------------------------- 
    771 \subsection[Turbulent closure scheme (\protect\key{zdf}\{tke,gls,osm\})]{Turbulent Closure Scheme (\protect\key{zdftke}, \protect\key{zdfgls} or \protect\key{zdfosm})} 
     778a leapfrog environment \citep{leclair_phd10} (see \autoref{sec:TD_mLF}). 
     779 
     780% ------------------------------------------------------------------------------------------------------------- 
     781%       Turbulent Closure Scheme 
     782% ------------------------------------------------------------------------------------------------------------- 
     783\subsection{Handling convection with turbulent closure schemes (\forcode{ln_zdf{tke,gls,osm}=.true.})} 
    772784\label{subsec:ZDF_tcs} 
    773785 
    774 The turbulent closure scheme presented in \autoref{subsec:ZDF_tke} and \autoref{subsec:ZDF_gls} 
    775 (\key{zdftke} or \key{zdftke} is defined) in theory solves the problem of statically unstable density profiles. 
     786 
     787The turbulent closure schemes presented in \autoref{subsec:ZDF_tke}, \autoref{subsec:ZDF_gls} and 
     788\autoref{subsec:ZDF_osm} (\ie\ \np{ln\_zdftke} or \np{ln\_zdfgls} or \np{ln\_zdfosm} defined) deal, in theory, 
     789with statically unstable density profiles. 
    776790In such a case, the term corresponding to the destruction of turbulent kinetic energy through stratification in 
    777 \autoref{eq:zdftke_e} or \autoref{eq:zdfgls_e} becomes a source term, since $N^2$ is negative.  
    778 It results in large values of $A_T^{vT}$ and  $A_T^{vT}$, and also the four neighbouring $A_u^{vm} {and}\;A_v^{vm}$ 
    779 (up to $1\;m^2s^{-1}$). 
     791\autoref{eq:ZDF_tke_e} or \autoref{eq:ZDF_gls_e} becomes a source term, since $N^2$ is negative. 
     792It results in large values of $A_T^{vT}$ and  $A_T^{vT}$, and also of the four neighboring values at 
     793velocity points $A_u^{vm} {and}\;A_v^{vm}$ (up to $1\;m^2s^{-1}$). 
    780794These large values restore the static stability of the water column in a way similar to that of 
    781795the enhanced vertical diffusion parameterisation (\autoref{subsec:ZDF_evd}). 
     
    784798because the mixing length scale is bounded by the distance to the sea surface. 
    785799It can thus be useful to combine the enhanced vertical diffusion with the turbulent closure scheme, 
    786 \ie setting the \np{ln\_zdfnpc} namelist parameter to true and 
    787 defining the turbulent closure CPP key all together. 
    788  
    789 The KPP turbulent closure scheme already includes enhanced vertical diffusion in the case of convection, 
    790 as governed by the variables $bvsqcon$ and $difcon$ found in \mdl{zdfkpp}, 
    791 therefore \np{ln\_zdfevd}\forcode{ = .false.} should be used with the KPP scheme. 
     800\ie\ setting the \np{ln\_zdfnpc} namelist parameter to true and 
     801defining the turbulent closure (\np{ln\_zdftke} or \np{ln\_zdfgls} = \forcode{.true.}) all together. 
     802 
     803The OSMOSIS turbulent closure scheme already includes enhanced vertical diffusion in the case of convection, 
     804%as governed by the variables $bvsqcon$ and $difcon$ found in \mdl{zdfkpp}, 
     805therefore \np{ln\_zdfevd}\forcode{=.false.} should be used with the OSMOSIS scheme. 
    792806% gm%  + one word on non local flux with KPP scheme trakpp.F90 module... 
    793807 
     
    795809% Double Diffusion Mixing 
    796810% ================================================================ 
    797 \section{Double diffusion mixing (\protect\key{zdfddm})} 
    798 \label{sec:ZDF_ddm} 
     811\section[Double diffusion mixing (\forcode{ln_zdfddm=.true.})] 
     812{Double diffusion mixing (\protect\np{ln\_zdfddm}\forcode{=.true.})} 
     813\label{subsec:ZDF_ddm} 
     814 
    799815 
    800816%-------------------------------------------namzdf_ddm------------------------------------------------- 
     
    803819%-------------------------------------------------------------------------------------------------------------- 
    804820 
    805 Options are defined through the  \ngn{namzdf\_ddm} namelist variables. 
     821This parameterisation has been introduced in \mdl{zdfddm} module and is controlled by the namelist parameter 
     822\np{ln\_zdfddm} in \nam{zdf}. 
    806823Double diffusion occurs when relatively warm, salty water overlies cooler, fresher water, or vice versa. 
    807824The former condition leads to salt fingering and the latter to diffusive convection. 
    808825Double-diffusive phenomena contribute to diapycnal mixing in extensive regions of the ocean. 
    809 \citet{Merryfield1999} include a parameterisation of such phenomena in a global ocean model and show that  
     826\citet{merryfield.holloway.ea_JPO99} include a parameterisation of such phenomena in a global ocean model and show that 
    810827it leads to relatively minor changes in circulation but exerts significant regional influences on 
    811828temperature and salinity. 
    812 This parameterisation has been introduced in \mdl{zdfddm} module and is controlled by the \key{zdfddm} CPP key. 
    813  
    814 Diapycnal mixing of S and T are described by diapycnal diffusion coefficients  
     829 
     830 
     831Diapycnal mixing of S and T are described by diapycnal diffusion coefficients 
    815832\begin{align*} 
    816   % \label{eq:zdfddm_Kz} 
     833  % \label{eq:ZDF_ddm_Kz} 
    817834  &A^{vT} = A_o^{vT}+A_f^{vT}+A_d^{vT} \\ 
    818835  &A^{vS} = A_o^{vS}+A_f^{vS}+A_d^{vS} 
     
    826843(1981): 
    827844\begin{align} 
    828   \label{eq:zdfddm_f} 
     845  \label{eq:ZDF_ddm_f} 
    829846  A_f^{vS} &= 
    830847             \begin{cases} 
     
    832849               0                              &\text{otherwise} 
    833850             \end{cases} 
    834   \\         \label{eq:zdfddm_f_T} 
    835   A_f^{vT} &= 0.7 \ A_f^{vS} / R_\rho  
     851  \\         \label{eq:ZDF_ddm_f_T} 
     852  A_f^{vT} &= 0.7 \ A_f^{vS} / R_\rho 
    836853\end{align} 
    837854 
    838855%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    839856\begin{figure}[!t] 
    840   \begin{center} 
    841     \includegraphics[width=0.99\textwidth]{Fig_zdfddm} 
    842     \caption{ 
    843       \protect\label{fig:zdfddm} 
    844       From \citet{Merryfield1999} : 
    845       (a) Diapycnal diffusivities $A_f^{vT}$ and $A_f^{vS}$ for temperature and salt in regions of salt fingering. 
    846       Heavy curves denote $A^{\ast v} = 10^{-3}~m^2.s^{-1}$ and thin curves $A^{\ast v} = 10^{-4}~m^2.s^{-1}$; 
    847       (b) diapycnal diffusivities $A_d^{vT}$ and $A_d^{vS}$ for temperature and salt in regions of 
    848       diffusive convection. 
    849       Heavy curves denote the Federov parameterisation and thin curves the Kelley parameterisation. 
    850       The latter is not implemented in \NEMO. 
    851     } 
    852   \end{center} 
     857  \centering 
     858  \includegraphics[width=\textwidth]{Fig_zdfddm} 
     859  \caption[Diapycnal diffusivities for temperature and salt in regions of salt fingering and 
     860  diffusive convection]{ 
     861    From \citet{merryfield.holloway.ea_JPO99}: 
     862    (a) Diapycnal diffusivities $A_f^{vT}$ and $A_f^{vS}$ for temperature and salt in 
     863    regions of salt fingering. 
     864    Heavy curves denote $A^{\ast v} = 10^{-3}~m^2.s^{-1}$ and 
     865    thin curves $A^{\ast v} = 10^{-4}~m^2.s^{-1}$; 
     866    (b) diapycnal diffusivities $A_d^{vT}$ and $A_d^{vS}$ for temperature and salt in 
     867    regions of diffusive convection. 
     868    Heavy curves denote the Federov parameterisation and thin curves the Kelley parameterisation. 
     869    The latter is not implemented in \NEMO.} 
     870  \label{fig:ZDF_ddm} 
    853871\end{figure} 
    854872%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    855873 
    856 The factor 0.7 in \autoref{eq:zdfddm_f_T} reflects the measured ratio $\alpha F_T /\beta F_S \approx  0.7$ of 
    857 buoyancy flux of heat to buoyancy flux of salt (\eg, \citet{McDougall_Taylor_JMR84}). 
    858 Following  \citet{Merryfield1999}, we adopt $R_c = 1.6$, $n = 6$, and $A^{\ast v} = 10^{-4}~m^2.s^{-1}$. 
     874The factor 0.7 in \autoref{eq:ZDF_ddm_f_T} reflects the measured ratio $\alpha F_T /\beta F_S \approx  0.7$ of 
     875buoyancy flux of heat to buoyancy flux of salt (\eg, \citet{mcdougall.taylor_JMR84}). 
     876Following  \citet{merryfield.holloway.ea_JPO99}, we adopt $R_c = 1.6$, $n = 6$, and $A^{\ast v} = 10^{-4}~m^2.s^{-1}$. 
    859877 
    860878To represent mixing of S and T by diffusive layering,  the diapycnal diffusivities suggested by 
    861 Federov (1988) is used:  
     879Federov (1988) is used: 
    862880\begin{align} 
    863   % \label{eq:zdfddm_d} 
     881  % \label{eq:ZDF_ddm_d} 
    864882  A_d^{vT} &= 
    865883             \begin{cases} 
     
    869887             \end{cases} 
    870888                                       \nonumber \\ 
    871   \label{eq:zdfddm_d_S} 
     889  \label{eq:ZDF_ddm_d_S} 
    872890  A_d^{vS} &= 
    873891             \begin{cases} 
     
    878896\end{align} 
    879897 
    880 The dependencies of \autoref{eq:zdfddm_f} to \autoref{eq:zdfddm_d_S} on $R_\rho$ are illustrated in 
    881 \autoref{fig:zdfddm}. 
     898The dependencies of \autoref{eq:ZDF_ddm_f} to \autoref{eq:ZDF_ddm_d_S} on $R_\rho$ are illustrated in 
     899\autoref{fig:ZDF_ddm}. 
    882900Implementing this requires computing $R_\rho$ at each grid point on every time step. 
    883901This is done in \mdl{eosbn2} at the same time as $N^2$ is computed. 
     
    887905% Bottom Friction 
    888906% ================================================================ 
    889 \section{Bottom and top friction (\protect\mdl{zdfbfr})} 
    890 \label{sec:ZDF_bfr} 
    891  
    892 %--------------------------------------------nambfr-------------------------------------------------------- 
     907 \section[Bottom and top friction (\textit{zdfdrg.F90})] 
     908 {Bottom and top friction (\protect\mdl{zdfdrg})} 
     909 \label{sec:ZDF_drg} 
     910 
     911%--------------------------------------------namdrg-------------------------------------------------------- 
    893912% 
    894 %\nlst{nambfr} 
     913\begin{listing} 
     914  \nlst{namdrg} 
     915  \caption{\texttt{namdrg}} 
     916  \label{lst:namdrg} 
     917\end{listing} 
     918\begin{listing} 
     919  \nlst{namdrg_top} 
     920  \caption{\texttt{namdrg\_top}} 
     921  \label{lst:namdrg_top} 
     922\end{listing} 
     923\begin{listing} 
     924  \nlst{namdrg_bot} 
     925  \caption{\texttt{namdrg\_bot}} 
     926  \label{lst:namdrg_bot} 
     927\end{listing} 
     928 
    895929%-------------------------------------------------------------------------------------------------------------- 
    896930 
    897 Options to define the top and bottom friction are defined through the \ngn{nambfr} namelist variables. 
     931Options to define the top and bottom friction are defined through the \nam{drg} namelist variables. 
    898932The bottom friction represents the friction generated by the bathymetry. 
    899933The top friction represents the friction generated by the ice shelf/ocean interface. 
    900 As the friction processes at the top and bottom are treated in similar way, 
    901 only the bottom friction is described in detail below. 
     934As the friction processes at the top and the bottom are treated in and identical way, 
     935the description below considers mostly the bottom friction case, if not stated otherwise. 
    902936 
    903937 
     
    905939a condition on the vertical diffusive flux. 
    906940For the bottom boundary layer, one has: 
    907 \[ 
    908   % \label{eq:zdfbfr_flux} 
    909   A^{vm} \left( \partial {\textbf U}_h / \partial z \right) = {{\cal F}}_h^{\textbf U} 
    910 \] 
     941 \[ 
     942   % \label{eq:ZDF_bfr_flux} 
     943   A^{vm} \left( \partial {\textbf U}_h / \partial z \right) = {{\cal F}}_h^{\textbf U} 
     944 \] 
    911945where ${\cal F}_h^{\textbf U}$ is represents the downward flux of horizontal momentum outside 
    912946the logarithmic turbulent boundary layer (thickness of the order of 1~m in the ocean). 
     
    916950one needs a vertical diffusion coefficient $A^{vm} = 0.125$~m$^2$s$^{-1}$ 
    917951(for a Coriolis frequency $f = 10^{-4}$~m$^2$s$^{-1}$). 
    918 With a background diffusion coefficient $A^{vm} = 10^{-4}$~m$^2$s$^{-1}$, the Ekman layer depth is only 1.4~m.  
     952With a background diffusion coefficient $A^{vm} = 10^{-4}$~m$^2$s$^{-1}$, the Ekman layer depth is only 1.4~m. 
    919953When the vertical mixing coefficient is this small, using a flux condition is equivalent to 
    920954entering the viscous forces (either wind stress or bottom friction) as a body force over the depth of the top or 
     
    922956To illustrate this, consider the equation for $u$ at $k$, the last ocean level: 
    923957\begin{equation} 
    924   \label{eq:zdfbfr_flux2} 
     958  \label{eq:ZDF_drg_flux2} 
    925959  \frac{\partial u_k}{\partial t} = \frac{1}{e_{3u}} \left[ \frac{A_{uw}^{vm}}{e_{3uw}} \delta_{k+1/2}\;[u] - {\cal F}^u_h \right] \approx - \frac{{\cal F}^u_{h}}{e_{3u}} 
    926960\end{equation} 
     
    935969 
    936970In the code, the bottom friction is imposed by adding the trend due to the bottom friction to 
    937 the general momentum trend in \mdl{dynbfr}. 
     971 the general momentum trend in \mdl{dynzdf}. 
    938972For the time-split surface pressure gradient algorithm, the momentum trend due to 
    939973the barotropic component needs to be handled separately. 
    940974For this purpose it is convenient to compute and store coefficients which can be simply combined with 
    941975bottom velocities and geometric values to provide the momentum trend due to bottom friction. 
    942 These coefficients are computed in \mdl{zdfbfr} and generally take the form $c_b^{\textbf U}$ where: 
     976 These coefficients are computed in \mdl{zdfdrg} and generally take the form $c_b^{\textbf U}$ where: 
    943977\begin{equation} 
    944   \label{eq:zdfbfr_bdef} 
     978  \label{eq:ZDF_bfr_bdef} 
    945979  \frac{\partial {\textbf U_h}}{\partial t} = 
    946980  - \frac{{\cal F}^{\textbf U}_{h}}{e_{3u}} = \frac{c_b^{\textbf U}}{e_{3u}} \;{\textbf U}_h^b 
    947981\end{equation} 
    948982where $\textbf{U}_h^b = (u_b\;,\;v_b)$ is the near-bottom, horizontal, ocean velocity. 
     983Note than from \NEMO\ 4.0, drag coefficients are only computed at cell centers (\ie\ at T-points) and refer to as $c_b^T$ in the following. These are then linearly interpolated in space to get $c_b^\textbf{U}$ at velocity points. 
    949984 
    950985% ------------------------------------------------------------------------------------------------------------- 
    951986%       Linear Bottom Friction 
    952987% ------------------------------------------------------------------------------------------------------------- 
    953 \subsection{Linear bottom friction (\protect\np{nn\_botfr}\forcode{ = 0..1})} 
    954 \label{subsec:ZDF_bfr_linear} 
    955  
    956 The linear bottom friction parameterisation (including the special case of a free-slip condition) assumes that 
    957 the bottom friction is proportional to the interior velocity (\ie the velocity of the last model level): 
    958 \[ 
    959   % \label{eq:zdfbfr_linear} 
     988 \subsection[Linear top/bottom friction (\forcode{ln_lin=.true.})] 
     989 {Linear top/bottom friction (\protect\np{ln\_lin}\forcode{=.true.)}} 
     990 \label{subsec:ZDF_drg_linear} 
     991 
     992The linear friction parameterisation (including the special case of a free-slip condition) assumes that 
     993the friction is proportional to the interior velocity (\ie\ the velocity of the first/last model level): 
     994\[ 
     995  % \label{eq:ZDF_bfr_linear} 
    960996  {\cal F}_h^\textbf{U} = \frac{A^{vm}}{e_3} \; \frac{\partial \textbf{U}_h}{\partial k} = r \; \textbf{U}_h^b 
    961997\] 
    962 where $r$ is a friction coefficient expressed in ms$^{-1}$. 
    963 This coefficient is generally estimated by setting a typical decay time $\tau$ in the deep ocean,  
     998where $r$ is a friction coefficient expressed in $m s^{-1}$. 
     999This coefficient is generally estimated by setting a typical decay time $\tau$ in the deep ocean, 
    9641000and setting $r = H / \tau$, where $H$ is the ocean depth. 
    965 Commonly accepted values of $\tau$ are of the order of 100 to 200 days \citep{Weatherly_JMR84}. 
     1001Commonly accepted values of $\tau$ are of the order of 100 to 200 days \citep{weatherly_JMR84}. 
    9661002A value $\tau^{-1} = 10^{-7}$~s$^{-1}$ equivalent to 115 days, is usually used in quasi-geostrophic models. 
    9671003One may consider the linear friction as an approximation of quadratic friction, $r \approx 2\;C_D\;U_{av}$ 
    968 (\citet{Gill1982}, Eq. 9.6.6). 
     1004(\citet{gill_bk82}, Eq. 9.6.6). 
    9691005For example, with a drag coefficient $C_D = 0.002$, a typical speed of tidal currents of $U_{av} =0.1$~m\;s$^{-1}$, 
    9701006and assuming an ocean depth $H = 4000$~m, the resulting friction coefficient is $r = 4\;10^{-4}$~m\;s$^{-1}$. 
    9711007This is the default value used in \NEMO. It corresponds to a decay time scale of 115~days. 
    972 It can be changed by specifying \np{rn\_bfri1} (namelist parameter). 
    973  
    974 For the linear friction case the coefficients defined in the general expression \autoref{eq:zdfbfr_bdef} are:  
    975 \[ 
    976   % \label{eq:zdfbfr_linbfr_b} 
    977   \begin{split} 
    978     c_b^u &= - r\\ 
    979     c_b^v &= - r\\ 
    980   \end{split} 
    981 \] 
    982 When \np{nn\_botfr}\forcode{ = 1}, the value of $r$ used is \np{rn\_bfri1}. 
    983 Setting \np{nn\_botfr}\forcode{ = 0} is equivalent to setting $r=0$ and 
    984 leads to a free-slip bottom boundary condition. 
    985 These values are assigned in \mdl{zdfbfr}. 
    986 From v3.2 onwards there is support for local enhancement of these values via an externally defined 2D mask array 
    987 (\np{ln\_bfr2d}\forcode{ = .true.}) given in the \ifile{bfr\_coef} input NetCDF file. 
     1008It can be changed by specifying \np{rn\_Uc0} (namelist parameter). 
     1009 
     1010 For the linear friction case the drag coefficient used in the general expression \autoref{eq:ZDF_bfr_bdef} is: 
     1011\[ 
     1012  % \label{eq:ZDF_bfr_linbfr_b} 
     1013    c_b^T = - r 
     1014\] 
     1015When \np{ln\_lin} \forcode{= .true.}, the value of $r$ used is \np{rn\_Uc0}*\np{rn\_Cd0}. 
     1016Setting \np{ln\_OFF} \forcode{= .true.} (and \forcode{ln_lin=.true.}) is equivalent to setting $r=0$ and leads to a free-slip boundary condition. 
     1017 
     1018These values are assigned in \mdl{zdfdrg}. 
     1019Note that there is support for local enhancement of these values via an externally defined 2D mask array 
     1020(\np{ln\_boost}\forcode{=.true.}) given in the \ifile{bfr\_coef} input NetCDF file. 
    9881021The mask values should vary from 0 to 1. 
    9891022Locations with a non-zero mask value will have the friction coefficient increased by 
    990 $mask\_value$*\np{rn\_bfrien}*\np{rn\_bfri1}. 
     1023$mask\_value$ * \np{rn\_boost} * \np{rn\_Cd0}. 
    9911024 
    9921025% ------------------------------------------------------------------------------------------------------------- 
    9931026%       Non-Linear Bottom Friction 
    9941027% ------------------------------------------------------------------------------------------------------------- 
    995 \subsection{Non-linear bottom friction (\protect\np{nn\_botfr}\forcode{ = 2})} 
    996 \label{subsec:ZDF_bfr_nonlinear} 
    997  
    998 The non-linear bottom friction parameterisation assumes that the bottom friction is quadratic:  
    999 \[ 
    1000   % \label{eq:zdfbfr_nonlinear} 
     1028 \subsection[Non-linear top/bottom friction (\forcode{ln_non_lin=.true.})] 
     1029 {Non-linear top/bottom friction (\protect\np{ln\_non\_lin}\forcode{=.true.})} 
     1030 \label{subsec:ZDF_drg_nonlinear} 
     1031 
     1032The non-linear bottom friction parameterisation assumes that the top/bottom friction is quadratic: 
     1033\[ 
     1034  % \label{eq:ZDF_drg_nonlinear} 
    10011035  {\cal F}_h^\textbf{U} = \frac{A^{vm}}{e_3 }\frac{\partial \textbf {U}_h 
    10021036  }{\partial k}=C_D \;\sqrt {u_b ^2+v_b ^2+e_b } \;\; \textbf {U}_h^b 
    10031037\] 
    1004 where $C_D$ is a drag coefficient, and $e_b $ a bottom turbulent kinetic energy due to tides, 
     1038where $C_D$ is a drag coefficient, and $e_b $ a top/bottom turbulent kinetic energy due to tides, 
    10051039internal waves breaking and other short time scale currents. 
    10061040A typical value of the drag coefficient is $C_D = 10^{-3} $. 
    1007 As an example, the CME experiment \citep{Treguier_JGR92} uses $C_D = 10^{-3}$ and 
    1008 $e_b = 2.5\;10^{-3}$m$^2$\;s$^{-2}$, while the FRAM experiment \citep{Killworth1992} uses $C_D = 1.4\;10^{-3}$ and 
     1041As an example, the CME experiment \citep{treguier_JGR92} uses $C_D = 10^{-3}$ and 
     1042$e_b = 2.5\;10^{-3}$m$^2$\;s$^{-2}$, while the FRAM experiment \citep{killworth_JPO92} uses $C_D = 1.4\;10^{-3}$ and 
    10091043$e_b =2.5\;\;10^{-3}$m$^2$\;s$^{-2}$. 
    1010 The CME choices have been set as default values (\np{rn\_bfri2} and \np{rn\_bfeb2} namelist parameters). 
    1011  
    1012 As for the linear case, the bottom friction is imposed in the code by adding the trend due to 
    1013 the bottom friction to the general momentum trend in \mdl{dynbfr}. 
    1014 For the non-linear friction case the terms computed in \mdl{zdfbfr} are: 
    1015 \[ 
    1016   % \label{eq:zdfbfr_nonlinbfr} 
    1017   \begin{split} 
    1018     c_b^u &= - \; C_D\;\left[ u^2 + \left(\bar{\bar{v}}^{i+1,j}\right)^2 + e_b \right]^{1/2}\\ 
    1019     c_b^v &= - \; C_D\;\left[  \left(\bar{\bar{u}}^{i,j+1}\right)^2 + v^2 + e_b \right]^{1/2}\\ 
    1020   \end{split} 
    1021 \] 
    1022  
    1023 The coefficients that control the strength of the non-linear bottom friction are initialised as namelist parameters: 
    1024 $C_D$= \np{rn\_bfri2}, and $e_b$ =\np{rn\_bfeb2}. 
    1025 Note for applications which treat tides explicitly a low or even zero value of \np{rn\_bfeb2} is recommended. 
    1026 From v3.2 onwards a local enhancement of $C_D$ is possible via an externally defined 2D mask array 
    1027 (\np{ln\_bfr2d}\forcode{ = .true.}). 
    1028 This works in the same way as for the linear bottom friction case with non-zero masked locations increased by 
    1029 $mask\_value$*\np{rn\_bfrien}*\np{rn\_bfri2}. 
     1044The CME choices have been set as default values (\np{rn\_Cd0} and \np{rn\_ke0} namelist parameters). 
     1045 
     1046As for the linear case, the friction is imposed in the code by adding the trend due to 
     1047the friction to the general momentum trend in \mdl{dynzdf}. 
     1048For the non-linear friction case the term computed in \mdl{zdfdrg} is: 
     1049\[ 
     1050  % \label{eq:ZDF_drg_nonlinbfr} 
     1051    c_b^T = - \; C_D\;\left[ \left(\bar{u_b}^{i}\right)^2 + \left(\bar{v_b}^{j}\right)^2 + e_b \right]^{1/2} 
     1052\] 
     1053 
     1054The coefficients that control the strength of the non-linear friction are initialised as namelist parameters: 
     1055$C_D$= \np{rn\_Cd0}, and $e_b$ =\np{rn\_bfeb2}. 
     1056Note that for applications which consider tides explicitly, a low or even zero value of \np{rn\_bfeb2} is recommended. A local enhancement of $C_D$ is again possible via an externally defined 2D mask array 
     1057(\np{ln\_boost}\forcode{=.true.}). 
     1058This works in the same way as for the linear friction case with non-zero masked locations increased by 
     1059$mask\_value$ * \np{rn\_boost} * \np{rn\_Cd0}. 
    10301060 
    10311061% ------------------------------------------------------------------------------------------------------------- 
    10321062%       Bottom Friction Log-layer 
    10331063% ------------------------------------------------------------------------------------------------------------- 
    1034 \subsection[Log-layer btm frict enhncmnt (\protect\np{nn\_botfr}\forcode{ = 2}, \protect\np{ln\_loglayer}\forcode{ = .true.})] 
    1035             {Log-layer bottom friction enhancement (\protect\np{nn\_botfr}\forcode{ = 2}, \protect\np{ln\_loglayer}\forcode{ = .true.})} 
    1036 \label{subsec:ZDF_bfr_loglayer} 
    1037  
    1038 In the non-linear bottom friction case, the drag coefficient, $C_D$, can be optionally enhanced using 
    1039 a "law of the wall" scaling. 
    1040 If  \np{ln\_loglayer} = .true., $C_D$ is no longer constant but is related to the thickness of 
    1041 the last wet layer in each column by: 
    1042 \[ 
    1043   C_D = \left ( {\kappa \over {\rm log}\left ( 0.5e_{3t}/rn\_bfrz0 \right ) } \right )^2 
    1044 \] 
    1045  
    1046 \noindent where $\kappa$ is the von-Karman constant and \np{rn\_bfrz0} is a roughness length provided via 
    1047 the namelist. 
    1048  
    1049 For stability, the drag coefficient is bounded such that it is kept greater or equal to 
    1050 the base \np{rn\_bfri2} value and it is not allowed to exceed the value of an additional namelist parameter: 
    1051 \np{rn\_bfri2\_max}, \ie 
    1052 \[ 
    1053   rn\_bfri2 \leq C_D \leq rn\_bfri2\_max 
    1054 \] 
    1055  
    1056 \noindent Note also that a log-layer enhancement can also be applied to the top boundary friction if 
    1057 under ice-shelf cavities are in use (\np{ln\_isfcav}\forcode{ = .true.}). 
    1058 In this case, the relevant namelist parameters are \np{rn\_tfrz0}, \np{rn\_tfri2} and \np{rn\_tfri2\_max}. 
    1059  
    1060 % ------------------------------------------------------------------------------------------------------------- 
    1061 %       Bottom Friction stability 
    1062 % ------------------------------------------------------------------------------------------------------------- 
    1063 \subsection{Bottom friction stability considerations} 
    1064 \label{subsec:ZDF_bfr_stability} 
    1065  
    1066 Some care needs to exercised over the choice of parameters to ensure that the implementation of 
    1067 bottom friction does not induce numerical instability. 
    1068 For the purposes of stability analysis, an approximation to \autoref{eq:zdfbfr_flux2} is: 
     1064 \subsection[Log-layer top/bottom friction (\forcode{ln_loglayer=.true.})] 
     1065 {Log-layer top/bottom friction (\protect\np{ln\_loglayer}\forcode{=.true.})} 
     1066 \label{subsec:ZDF_drg_loglayer} 
     1067 
     1068In the non-linear friction case, the drag coefficient, $C_D$, can be optionally enhanced using 
     1069a "law of the wall" scaling. This assumes that the model vertical resolution can capture the logarithmic layer which typically occur for layers thinner than 1 m or so. 
     1070If  \np{ln\_loglayer} \forcode{= .true.}, $C_D$ is no longer constant but is related to the distance to the wall (or equivalently to the half of the top/bottom layer thickness): 
     1071\[ 
     1072  C_D = \left ( {\kappa \over {\mathrm log}\left ( 0.5 \; e_{3b} / rn\_{z0} \right ) } \right )^2 
     1073\] 
     1074 
     1075\noindent where $\kappa$ is the von-Karman constant and \np{rn\_z0} is a roughness length provided via the namelist. 
     1076 
     1077The drag coefficient is bounded such that it is kept greater or equal to 
     1078the base \np{rn\_Cd0} value which occurs where layer thicknesses become large and presumably logarithmic layers are not resolved at all. For stability reason, it is also not allowed to exceed the value of an additional namelist parameter: 
     1079\np{rn\_Cdmax}, \ie 
     1080\[ 
     1081  rn\_Cd0 \leq C_D \leq rn\_Cdmax 
     1082\] 
     1083 
     1084\noindent The log-layer enhancement can also be applied to the top boundary friction if 
     1085under ice-shelf cavities are activated (\np{ln\_isfcav}\forcode{=.true.}). 
     1086%In this case, the relevant namelist parameters are \np{rn\_tfrz0}, \np{rn\_tfri2} and \np{rn\_tfri2\_max}. 
     1087 
     1088% ------------------------------------------------------------------------------------------------------------- 
     1089%       Explicit bottom Friction 
     1090% ------------------------------------------------------------------------------------------------------------- 
     1091 \subsection{Explicit top/bottom friction (\forcode{ln_drgimp=.false.})} 
     1092 \label{subsec:ZDF_drg_stability} 
     1093 
     1094Setting \np{ln\_drgimp} \forcode{= .false.} means that bottom friction is treated explicitly in time, which has the advantage of simplifying the interaction with the split-explicit free surface (see \autoref{subsec:ZDF_drg_ts}). The latter does indeed require the knowledge of bottom stresses in the course of the barotropic sub-iteration, which becomes less straightforward in the implicit case. In the explicit case, top/bottom stresses can be computed using \textit{before} velocities and inserted in the overall momentum tendency budget. This reads: 
     1095 
     1096At the top (below an ice shelf cavity): 
     1097\[ 
     1098  \left.{\left( {\frac{A^{vm} }{e_3 }\ \frac{\partial \textbf{U}_h}{\partial k}} \right)} \right|_{t} 
     1099  = c_{t}^{\textbf{U}}\textbf{u}^{n-1}_{t} 
     1100\] 
     1101 
     1102At the bottom (above the sea floor): 
     1103\[ 
     1104  \left.{\left( {\frac{A^{vm} }{e_3 }\ \frac{\partial \textbf{U}_h}{\partial k}} \right)} \right|_{b} 
     1105  = c_{b}^{\textbf{U}}\textbf{u}^{n-1}_{b} 
     1106\] 
     1107 
     1108Since this is conditionally stable, some care needs to exercised over the choice of parameters to ensure that the implementation of explicit top/bottom friction does not induce numerical instability. 
     1109For the purposes of stability analysis, an approximation to \autoref{eq:ZDF_drg_flux2} is: 
    10691110\begin{equation} 
    1070   \label{eq:Eqn_bfrstab} 
     1111  \label{eq:ZDF_Eqn_drgstab} 
    10711112  \begin{split} 
    10721113    \Delta u &= -\frac{{{\cal F}_h}^u}{e_{3u}}\;2 \rdt    \\ 
     
    10741115  \end{split} 
    10751116\end{equation} 
    1076 \noindent where linear bottom friction and a leapfrog timestep have been assumed. 
    1077 To ensure that the bottom friction cannot reverse the direction of flow it is necessary to have: 
    1078 \[ 
    1079   |\Delta u| < \;|u|  
    1080 \] 
    1081 \noindent which, using \autoref{eq:Eqn_bfrstab}, gives: 
     1117\noindent where linear friction and a leapfrog timestep have been assumed. 
     1118To ensure that the friction cannot reverse the direction of flow it is necessary to have: 
     1119\[ 
     1120  |\Delta u| < \;|u| 
     1121\] 
     1122\noindent which, using \autoref{eq:ZDF_Eqn_drgstab}, gives: 
    10821123\[ 
    10831124  r\frac{2\rdt}{e_{3u}} < 1 \qquad  \Rightarrow \qquad r < \frac{e_{3u}}{2\rdt}\\ 
     
    10921133For example, if $|u| = 1$ m.s$^{-1}$, $rdt = 1800$ s, $r = 10^{-3}$ then $e_{3u}$ should be greater than 3.6 m. 
    10931134For most applications, with physically sensible parameters these restrictions should not be of concern. 
    1094 But caution may be necessary if attempts are made to locally enhance the bottom friction parameters.  
    1095 To ensure stability limits are imposed on the bottom friction coefficients both 
     1135But caution may be necessary if attempts are made to locally enhance the bottom friction parameters. 
     1136To ensure stability limits are imposed on the top/bottom friction coefficients both 
    10961137during initialisation and at each time step. 
    1097 Checks at initialisation are made in \mdl{zdfbfr} (assuming a 1 m.s$^{-1}$ velocity in the non-linear case). 
     1138Checks at initialisation are made in \mdl{zdfdrg} (assuming a 1 m.s$^{-1}$ velocity in the non-linear case). 
    10981139The number of breaches of the stability criterion are reported as well as 
    10991140the minimum and maximum values that have been set. 
    1100 The criterion is also checked at each time step, using the actual velocity, in \mdl{dynbfr}. 
    1101 Values of the bottom friction coefficient are reduced as necessary to ensure stability; 
     1141The criterion is also checked at each time step, using the actual velocity, in \mdl{dynzdf}. 
     1142Values of the friction coefficient are reduced as necessary to ensure stability; 
    11021143these changes are not reported. 
    11031144 
    1104 Limits on the bottom friction coefficient are not imposed if the user has elected to 
    1105 handle the bottom friction implicitly (see \autoref{subsec:ZDF_bfr_imp}). 
     1145Limits on the top/bottom friction coefficient are not imposed if the user has elected to 
     1146handle the friction implicitly (see \autoref{subsec:ZDF_drg_imp}). 
    11061147The number of potential breaches of the explicit stability criterion are still reported for information purposes. 
    11071148 
     
    11091150%       Implicit Bottom Friction 
    11101151% ------------------------------------------------------------------------------------------------------------- 
    1111 \subsection{Implicit bottom friction (\protect\np{ln\_bfrimp}\forcode{ = .true.})} 
    1112 \label{subsec:ZDF_bfr_imp} 
     1152 \subsection[Implicit top/bottom friction (\forcode{ln_drgimp=.true.})] 
     1153 {Implicit top/bottom friction (\protect\np{ln\_drgimp}\forcode{=.true.})} 
     1154 \label{subsec:ZDF_drg_imp} 
    11131155 
    11141156An optional implicit form of bottom friction has been implemented to improve model stability. 
    1115 We recommend this option for shelf sea and coastal ocean applications, especially for split-explicit time splitting. 
    1116 This option can be invoked by setting \np{ln\_bfrimp} to \forcode{.true.} in the \textit{nambfr} namelist. 
    1117 This option requires \np{ln\_zdfexp} to be \forcode{.false.} in the \textit{namzdf} namelist.  
    1118  
    1119 This implementation is realised in \mdl{dynzdf\_imp} and \mdl{dynspg\_ts}. In \mdl{dynzdf\_imp}, 
    1120 the bottom boundary condition is implemented implicitly. 
    1121  
    1122 \[ 
    1123   % \label{eq:dynzdf_bfr} 
    1124   \left.{\left( {\frac{A^{vm} }{e_3 }\ \frac{\partial \textbf{U}_h}{\partial k}} \right)} \right|_{mbk} 
    1125   = \binom{c_{b}^{u}u^{n+1}_{mbk}}{c_{b}^{v}v^{n+1}_{mbk}} 
    1126 \] 
    1127  
    1128 where $mbk$ is the layer number of the bottom wet layer. 
    1129 Superscript $n+1$ means the velocity used in the friction formula is to be calculated, so, it is implicit. 
    1130  
    1131 If split-explicit time splitting is used, care must be taken to avoid the double counting of the bottom friction in 
    1132 the 2-D barotropic momentum equations. 
    1133 As NEMO only updates the barotropic pressure gradient and Coriolis' forcing terms in the 2-D barotropic calculation, 
    1134 we need to remove the bottom friction induced by these two terms which has been included in the 3-D momentum trend  
    1135 and update it with the latest value. 
    1136 On the other hand, the bottom friction contributed by the other terms 
    1137 (\eg the advection term, viscosity term) has been included in the 3-D momentum equations and 
    1138 should not be added in the 2-D barotropic mode. 
    1139  
    1140 The implementation of the implicit bottom friction in \mdl{dynspg\_ts} is done in two steps as the following: 
    1141  
    1142 \[ 
    1143   % \label{eq:dynspg_ts_bfr1} 
    1144   \frac{\textbf{U}_{med}-\textbf{U}^{m-1}}{2\Delta t}=-g\nabla\eta-f\textbf{k}\times\textbf{U}^{m}+c_{b} 
    1145   \left(\textbf{U}_{med}-\textbf{U}^{m-1}\right) 
    1146 \] 
    1147 \[ 
    1148   \frac{\textbf{U}^{m+1}-\textbf{U}_{med}}{2\Delta t}=\textbf{T}+ 
    1149   \left(g\nabla\eta^{'}+f\textbf{k}\times\textbf{U}^{'}\right)- 
    1150   2\Delta t_{bc}c_{b}\left(g\nabla\eta^{'}+f\textbf{k}\times\textbf{u}_{b}\right) 
    1151 \] 
    1152  
    1153 where $\textbf{T}$ is the vertical integrated 3-D momentum trend. 
    1154 We assume the leap-frog time-stepping is used here. 
    1155 $\Delta t$ is the barotropic mode time step and $\Delta t_{bc}$ is the baroclinic mode time step. 
    1156 $c_{b}$ is the friction coefficient. 
    1157 $\eta$ is the sea surface level calculated in the barotropic loops while $\eta^{'}$ is the sea surface level used in 
    1158 the 3-D baroclinic mode. 
    1159 $\textbf{u}_{b}$ is the bottom layer horizontal velocity. 
    1160  
    1161 % ------------------------------------------------------------------------------------------------------------- 
    1162 %       Bottom Friction with split-explicit time splitting 
    1163 % ------------------------------------------------------------------------------------------------------------- 
    1164 \subsection[Bottom friction w/ split-explicit time splitting (\protect\np{ln\_bfrimp})] 
    1165             {Bottom friction with split-explicit time splitting (\protect\np{ln\_bfrimp})} 
    1166 \label{subsec:ZDF_bfr_ts} 
    1167  
    1168 When calculating the momentum trend due to bottom friction in \mdl{dynbfr}, 
    1169 the bottom velocity at the before time step is used. 
    1170 This velocity includes both the baroclinic and barotropic components which is appropriate when 
    1171 using either the explicit or filtered surface pressure gradient algorithms 
    1172 (\key{dynspg\_exp} or \key{dynspg\_flt}). 
    1173 Extra attention is required, however, when using split-explicit time stepping (\key{dynspg\_ts}). 
    1174 In this case the free surface equation is solved with a small time step \np{rn\_rdt}/\np{nn\_baro}, 
    1175 while the three dimensional prognostic variables are solved with the longer time step of \np{rn\_rdt} seconds. 
    1176 The trend in the barotropic momentum due to bottom friction appropriate to this method is that given by 
    1177 the selected parameterisation (\ie linear or non-linear bottom friction) computed with 
    1178 the evolving velocities at each barotropic timestep.  
    1179  
    1180 In the case of non-linear bottom friction, we have elected to partially linearise the problem by 
    1181 keeping the coefficients fixed throughout the barotropic time-stepping to those computed in 
    1182 \mdl{zdfbfr} using the now timestep. 
    1183 This decision allows an efficient use of the $c_b^{\vect{U}}$ coefficients to: 
    1184  
     1157We recommend this option for shelf sea and coastal ocean applications. %, especially for split-explicit time splitting. 
     1158This option can be invoked by setting \np{ln\_drgimp} to \forcode{.true.} in the \nam{drg} namelist. 
     1159%This option requires \np{ln\_zdfexp} to be \forcode{.false.} in the \nam{zdf} namelist. 
     1160 
     1161This implementation is performed in \mdl{dynzdf} where the following boundary conditions are set while solving the fully implicit diffusion step: 
     1162 
     1163At the top (below an ice shelf cavity): 
     1164\[ 
     1165  % \label{eq:ZDF_dynZDF__drg_top} 
     1166  \left.{\left( {\frac{A^{vm} }{e_3 }\ \frac{\partial \textbf{U}_h}{\partial k}} \right)} \right|_{t} 
     1167  = c_{t}^{\textbf{U}}\textbf{u}^{n+1}_{t} 
     1168\] 
     1169 
     1170At the bottom (above the sea floor): 
     1171\[ 
     1172  % \label{eq:ZDF_dynZDF__drg_bot} 
     1173  \left.{\left( {\frac{A^{vm} }{e_3 }\ \frac{\partial \textbf{U}_h}{\partial k}} \right)} \right|_{b} 
     1174  = c_{b}^{\textbf{U}}\textbf{u}^{n+1}_{b} 
     1175\] 
     1176 
     1177where $t$ and $b$ refers to top and bottom layers respectively. 
     1178Superscript $n+1$ means the velocity used in the friction formula is to be calculated, so it is implicit. 
     1179 
     1180% ------------------------------------------------------------------------------------------------------------- 
     1181%       Bottom Friction with split-explicit free surface 
     1182% ------------------------------------------------------------------------------------------------------------- 
     1183 \subsection[Bottom friction with split-explicit free surface] 
     1184 {Bottom friction with split-explicit free surface} 
     1185 \label{subsec:ZDF_drg_ts} 
     1186 
     1187With split-explicit free surface, the sub-stepping of barotropic equations needs the knowledge of top/bottom stresses. An obvious way to satisfy this is to take them as constant over the course of the barotropic integration and equal to the value used to update the baroclinic momentum trend. Provided \np{ln\_drgimp}\forcode{= .false.} and a centred or \textit{leap-frog} like integration of barotropic equations is used (\ie\ \forcode{ln_bt_fw=.false.}, cf \autoref{subsec:DYN_spg_ts}), this does ensure that barotropic and baroclinic dynamics feel the same stresses during one leapfrog time step. However, if \np{ln\_drgimp}\forcode{= .true.},  stresses depend on the \textit{after} value of the velocities which themselves depend on the barotropic iteration result. This cyclic dependency makes difficult obtaining consistent stresses in 2d and 3d dynamics. Part of this mismatch is then removed when setting the final barotropic component of 3d velocities to the time splitting estimate. This last step can be seen as a necessary evil but should be minimized since it interferes with the adjustment to the boundary conditions. 
     1188 
     1189The strategy to handle top/bottom stresses with split-explicit free surface in \NEMO\ is as follows: 
    11851190\begin{enumerate} 
    1186 \item On entry to \rou{dyn\_spg\_ts}, remove the contribution of the before barotropic velocity to 
    1187   the bottom friction component of the vertically integrated momentum trend. 
    1188   Note the same stability check that is carried out on the bottom friction coefficient in \mdl{dynbfr} has to 
    1189   be applied here to ensure that the trend removed matches that which was added in \mdl{dynbfr}. 
    1190 \item At each barotropic step, compute the contribution of the current barotropic velocity to 
    1191   the trend due to bottom friction. 
    1192   Add this contribution to the vertically integrated momentum trend. 
    1193   This contribution is handled implicitly which eliminates the need to impose a stability criteria on 
    1194   the values of the bottom friction coefficient within the barotropic loop.  
     1191\item To extend the stability of the barotropic sub-stepping, bottom stresses are refreshed at each sub-iteration. The baroclinic part of the flow entering the stresses is frozen at the initial time of the barotropic iteration. In case of non-linear friction, the drag coefficient is also constant. 
     1192\item In case of an implicit drag, specific computations are performed in \mdl{dynzdf} which renders the overall scheme mixed explicit/implicit: the barotropic components of 3d velocities are removed before seeking for the implicit vertical diffusion result. Top/bottom stresses due to the barotropic components are explicitly accounted for thanks to the updated values of barotropic velocities. Then the implicit solution of 3d velocities is obtained. Lastly, the residual barotropic component is replaced by the time split estimate. 
    11951193\end{enumerate} 
    11961194 
    1197 Note that the use of an implicit formulation within the barotropic loop for the bottom friction trend means that 
    1198 any limiting of the bottom friction coefficient in \mdl{dynbfr} does not adversely affect the solution when 
    1199 using split-explicit time splitting. 
    1200 This is because the major contribution to bottom friction is likely to come from the barotropic component which 
    1201 uses the unrestricted value of the coefficient. 
    1202 However, if the limiting is thought to be having a major effect 
    1203 (a more likely prospect in coastal and shelf seas applications) then 
    1204 the fully implicit form of the bottom friction should be used (see \autoref{subsec:ZDF_bfr_imp}) 
    1205 which can be selected by setting \np{ln\_bfrimp} $=$ \forcode{.true.}. 
    1206  
    1207 Otherwise, the implicit formulation takes the form: 
    1208 \[ 
    1209   % \label{eq:zdfbfr_implicitts} 
    1210   \bar{U}^{t+ \rdt} = \; \left [ \bar{U}^{t-\rdt}\; + 2 \rdt\;RHS \right ] / \left [ 1 - 2 \rdt \;c_b^{u} / H_e \right ] 
    1211 \] 
    1212 where $\bar U$ is the barotropic velocity, $H_e$ is the full depth (including sea surface height),  
    1213 $c_b^u$ is the bottom friction coefficient as calculated in \rou{zdf\_bfr} and 
    1214 $RHS$ represents all the components to the vertically integrated momentum trend except for 
    1215 that due to bottom friction. 
    1216  
    1217 % ================================================================ 
    1218 % Tidal Mixing 
    1219 % ================================================================ 
    1220 \section{Tidal mixing (\protect\key{zdftmx})} 
    1221 \label{sec:ZDF_tmx} 
    1222  
    1223 %--------------------------------------------namzdf_tmx-------------------------------------------------- 
     1195Note that other strategies are possible, like considering vertical diffusion step in advance, \ie\ prior barotropic integration. 
     1196 
     1197 
     1198% ================================================================ 
     1199% Internal wave-driven mixing 
     1200% ================================================================ 
     1201\section[Internal wave-driven mixing (\forcode{ln_zdfiwm=.true.})] 
     1202{Internal wave-driven mixing (\protect\np{ln\_zdfiwm}\forcode{=.true.})} 
     1203\label{subsec:ZDF_tmx_new} 
     1204 
     1205%--------------------------------------------namzdf_iwm------------------------------------------ 
    12241206% 
    1225 %\nlst{namzdf_tmx} 
     1207\begin{listing} 
     1208  \nlst{namzdf_iwm} 
     1209  \caption{\texttt{namzdf\_iwm}} 
     1210  \label{lst:namzdf_iwm} 
     1211\end{listing} 
    12261212%-------------------------------------------------------------------------------------------------------------- 
    12271213 
    1228  
    1229 % ------------------------------------------------------------------------------------------------------------- 
    1230 %        Bottom intensified tidal mixing  
    1231 % ------------------------------------------------------------------------------------------------------------- 
    1232 \subsection{Bottom intensified tidal mixing} 
    1233 \label{subsec:ZDF_tmx_bottom} 
    1234  
    1235 Options are defined through the  \ngn{namzdf\_tmx} namelist variables. 
    1236 The parameterization of tidal mixing follows the general formulation for the vertical eddy diffusivity proposed by 
    1237 \citet{St_Laurent_al_GRL02} and first introduced in an OGCM by \citep{Simmons_al_OM04}.  
    1238 In this formulation an additional vertical diffusivity resulting from internal tide breaking, 
    1239 $A^{vT}_{tides}$ is expressed as a function of $E(x,y)$, 
    1240 the energy transfer from barotropic tides to baroclinic tides: 
    1241 \begin{equation} 
    1242   \label{eq:Ktides} 
    1243   A^{vT}_{tides} =  q \,\Gamma \,\frac{ E(x,y) \, F(z) }{ \rho \, N^2 } 
    1244 \end{equation} 
    1245 where $\Gamma$ is the mixing efficiency, $N$ the Brunt-Vais\"{a}l\"{a} frequency (see \autoref{subsec:TRA_bn2}), 
    1246 $\rho$ the density, $q$ the tidal dissipation efficiency, and $F(z)$ the vertical structure function.  
    1247  
    1248 The mixing efficiency of turbulence is set by $\Gamma$ (\np{rn\_me} namelist parameter) and 
    1249 is usually taken to be the canonical value of $\Gamma = 0.2$ (Osborn 1980).  
    1250 The tidal dissipation efficiency is given by the parameter $q$ (\np{rn\_tfe} namelist parameter) 
    1251 represents the part of the internal wave energy flux $E(x, y)$ that is dissipated locally, 
    1252 with the remaining $1-q$ radiating away as low mode internal waves and 
    1253 contributing to the background internal wave field. 
    1254 A value of $q=1/3$ is typically used \citet{St_Laurent_al_GRL02}. 
    1255 The vertical structure function $F(z)$ models the distribution of the turbulent mixing in the vertical. 
    1256 It is implemented as a simple exponential decaying upward away from the bottom, 
    1257 with a vertical scale of $h_o$ (\np{rn\_htmx} namelist parameter, 
    1258 with a typical value of $500\,m$) \citep{St_Laurent_Nash_DSR04},  
    1259 \[ 
    1260   % \label{eq:Fz} 
    1261   F(i,j,k) = \frac{ e^{ -\frac{H+z}{h_o} } }{ h_o \left( 1- e^{ -\frac{H}{h_o} } \right) } 
    1262 \] 
    1263 and is normalized so that vertical integral over the water column is unity.  
    1264  
    1265 The associated vertical viscosity is calculated from the vertical diffusivity assuming a Prandtl number of 1, 
    1266 \ie $A^{vm}_{tides}=A^{vT}_{tides}$. 
    1267 In the limit of $N \rightarrow 0$ (or becoming negative), the vertical diffusivity is capped at $300\,cm^2/s$ and 
    1268 impose a lower limit on $N^2$ of \np{rn\_n2min} usually set to $10^{-8} s^{-2}$. 
    1269 These bounds are usually rarely encountered. 
    1270  
    1271 The internal wave energy map, $E(x, y)$ in \autoref{eq:Ktides}, is derived from a barotropic model of 
    1272 the tides utilizing a parameterization of the conversion of barotropic tidal energy into internal waves. 
    1273 The essential goal of the parameterization is to represent the momentum exchange between the barotropic tides and 
    1274 the unrepresented internal waves induced by the tidal flow over rough topography in a stratified ocean. 
    1275 In the current version of \NEMO, the map is built from the output of 
    1276 the barotropic global ocean tide model MOG2D-G \citep{Carrere_Lyard_GRL03}. 
    1277 This model provides the dissipation associated with internal wave energy for the M2 and K1 tides component 
    1278 (\autoref{fig:ZDF_M2_K1_tmx}). 
    1279 The S2 dissipation is simply approximated as being $1/4$ of the M2 one. 
    1280 The internal wave energy is thus : $E(x, y) = 1.25 E_{M2} + E_{K1}$. 
    1281 Its global mean value is $1.1$ TW, 
    1282 in agreement with independent estimates \citep{Egbert_Ray_Nat00, Egbert_Ray_JGR01}.  
    1283  
    1284 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    1285 \begin{figure}[!t] 
    1286   \begin{center} 
    1287     \includegraphics[width=0.90\textwidth]{Fig_ZDF_M2_K1_tmx} 
    1288     \caption{ 
    1289       \protect\label{fig:ZDF_M2_K1_tmx} 
    1290       (a) M2 and (b) K1 internal wave drag energy from \citet{Carrere_Lyard_GRL03} ($W/m^2$). 
    1291     } 
    1292   \end{center} 
    1293 \end{figure} 
    1294 %>>>>>>>>>>>>>>>>>>>>>>>>>>>>  
    1295   
    1296 % ------------------------------------------------------------------------------------------------------------- 
    1297 %        Indonesian area specific treatment  
    1298 % ------------------------------------------------------------------------------------------------------------- 
    1299 \subsection{Indonesian area specific treatment (\protect\np{ln\_zdftmx\_itf})} 
    1300 \label{subsec:ZDF_tmx_itf} 
    1301  
    1302 When the Indonesian Through Flow (ITF) area is included in the model domain, 
    1303 a specific treatment of tidal induced mixing in this area can be used. 
    1304 It is activated through the namelist logical \np{ln\_tmx\_itf}, and the user must provide an input NetCDF file, 
    1305 \ifile{mask\_itf}, which contains a mask array defining the ITF area where the specific treatment is applied. 
    1306  
    1307 When \np{ln\_tmx\_itf}\forcode{ = .true.}, the two key parameters $q$ and $F(z)$ are adjusted following 
    1308 the parameterisation developed by \citet{Koch-Larrouy_al_GRL07}: 
    1309  
    1310 First, the Indonesian archipelago is a complex geographic region with a series of 
    1311 large, deep, semi-enclosed basins connected via numerous narrow straits. 
    1312 Once generated, internal tides remain confined within this semi-enclosed area and hardly radiate away. 
    1313 Therefore all the internal tides energy is consumed within this area. 
    1314 So it is assumed that $q = 1$, \ie all the energy generated is available for mixing. 
    1315 Note that for test purposed, the ITF tidal dissipation efficiency is a namelist parameter (\np{rn\_tfe\_itf}). 
    1316 A value of $1$ or close to is this recommended for this parameter. 
    1317  
    1318 Second, the vertical structure function, $F(z)$, is no more associated with a bottom intensification of the mixing, 
    1319 but with a maximum of energy available within the thermocline. 
    1320 \citet{Koch-Larrouy_al_GRL07} have suggested that the vertical distribution of 
    1321 the energy dissipation proportional to $N^2$ below the core of the thermocline and to $N$ above.  
    1322 The resulting $F(z)$ is: 
    1323 \[ 
    1324   % \label{eq:Fz_itf} 
    1325   F(i,j,k) \sim     \left\{ 
    1326     \begin{aligned} 
    1327       \frac{q\,\Gamma E(i,j) } {\rho N \, \int N     dz}    \qquad \text{when $\partial_z N < 0$} \\ 
    1328       \frac{q\,\Gamma E(i,j) } {\rho     \, \int N^2 dz}    \qquad \text{when $\partial_z N > 0$} 
    1329     \end{aligned} 
    1330   \right. 
    1331 \] 
    1332  
    1333 Averaged over the ITF area, the resulting tidal mixing coefficient is $1.5\,cm^2/s$,  
    1334 which agrees with the independent estimates inferred from observations. 
    1335 Introduced in a regional OGCM, the parameterization improves the water mass characteristics in 
    1336 the different Indonesian seas, suggesting that the horizontal and vertical distributions of 
    1337 the mixing are adequately prescribed \citep{Koch-Larrouy_al_GRL07, Koch-Larrouy_al_OD08a, Koch-Larrouy_al_OD08b}. 
    1338 Note also that such a parameterisation has a significant impact on the behaviour of 
    1339 global coupled GCMs \citep{Koch-Larrouy_al_CD10}. 
    1340  
    1341 % ================================================================ 
    1342 % Internal wave-driven mixing 
    1343 % ================================================================ 
    1344 \section{Internal wave-driven mixing (\protect\key{zdftmx\_new})} 
    1345 \label{sec:ZDF_tmx_new} 
    1346  
    1347 %--------------------------------------------namzdf_tmx_new------------------------------------------ 
    1348 % 
    1349 %\nlst{namzdf_tmx_new} 
    1350 %-------------------------------------------------------------------------------------------------------------- 
    1351  
    13521214The parameterization of mixing induced by breaking internal waves is a generalization of 
    1353 the approach originally proposed by \citet{St_Laurent_al_GRL02}. 
     1215the approach originally proposed by \citet{st-laurent.simmons.ea_GRL02}. 
    13541216A three-dimensional field of internal wave energy dissipation $\epsilon(x,y,z)$ is first constructed, 
    1355 and the resulting diffusivity is obtained as  
    1356 \[ 
    1357   % \label{eq:Kwave} 
     1217and the resulting diffusivity is obtained as 
     1218\[ 
     1219  % \label{eq:ZDF_Kwave} 
    13581220  A^{vT}_{wave} =  R_f \,\frac{ \epsilon }{ \rho \, N^2 } 
    13591221\] 
    13601222where $R_f$ is the mixing efficiency and $\epsilon$ is a specified three dimensional distribution of 
    13611223the energy available for mixing. 
    1362 If the \np{ln\_mevar} namelist parameter is set to false, the mixing efficiency is taken as constant and 
    1363 equal to 1/6 \citep{Osborn_JPO80}. 
     1224If the \np{ln\_mevar} namelist parameter is set to \forcode{.false.}, the mixing efficiency is taken as constant and 
     1225equal to 1/6 \citep{osborn_JPO80}. 
    13641226In the opposite (recommended) case, $R_f$ is instead a function of 
    13651227the turbulence intensity parameter $Re_b = \frac{ \epsilon}{\nu \, N^2}$, 
    1366 with $\nu$ the molecular viscosity of seawater, following the model of \cite{Bouffard_Boegman_DAO2013} and 
    1367 the implementation of \cite{de_lavergne_JPO2016_efficiency}. 
     1228with $\nu$ the molecular viscosity of seawater, following the model of \cite{bouffard.boegman_DAO13} and 
     1229the implementation of \cite{de-lavergne.madec.ea_JPO16}. 
    13681230Note that $A^{vT}_{wave}$ is bounded by $10^{-2}\,m^2/s$, a limit that is often reached when 
    13691231the mixing efficiency is constant. 
    13701232 
    1371 In addition to the mixing efficiency, the ratio of salt to heat diffusivities can chosen to vary  
    1372 as a function of $Re_b$ by setting the \np{ln\_tsdiff} parameter to true, a recommended choice.  
    1373 This parameterization of differential mixing, due to \cite{Jackson_Rehmann_JPO2014}, 
    1374 is implemented as in \cite{de_lavergne_JPO2016_efficiency}. 
     1233In addition to the mixing efficiency, the ratio of salt to heat diffusivities can chosen to vary 
     1234as a function of $Re_b$ by setting the \np{ln\_tsdiff} parameter to \forcode{.true.}, a recommended choice. 
     1235This parameterization of differential mixing, due to \cite{jackson.rehmann_JPO14}, 
     1236is implemented as in \cite{de-lavergne.madec.ea_JPO16}. 
    13751237 
    13761238The three-dimensional distribution of the energy available for mixing, $\epsilon(i,j,k)$, 
    13771239is constructed from three static maps of column-integrated internal wave energy dissipation, 
    1378 $E_{cri}(i,j)$, $E_{pyc}(i,j)$, and $E_{bot}(i,j)$, combined to three corresponding vertical structures 
    1379 (de Lavergne et al., in prep): 
     1240$E_{cri}(i,j)$, $E_{pyc}(i,j)$, and $E_{bot}(i,j)$, combined to three corresponding vertical structures: 
     1241 
    13801242\begin{align*} 
    13811243  F_{cri}(i,j,k) &\propto e^{-h_{ab} / h_{cri} }\\ 
    1382   F_{pyc}(i,j,k) &\propto N^{n\_p}\\ 
     1244  F_{pyc}(i,j,k) &\propto N^{n_p}\\ 
    13831245  F_{bot}(i,j,k) &\propto N^2 \, e^{- h_{wkb} / h_{bot} } 
    1384 \end{align*}  
     1246\end{align*} 
    13851247In the above formula, $h_{ab}$ denotes the height above bottom, 
    13861248$h_{wkb}$ denotes the WKB-stretched height above bottom, defined by 
     
    13881250  h_{wkb} = H \, \frac{ \int_{-H}^{z} N \, dz' } { \int_{-H}^{\eta} N \, dz'  } \; , 
    13891251\] 
    1390 The $n_p$ parameter (given by \np{nn\_zpyc} in \ngn{namzdf\_tmx\_new} namelist) 
     1252The $n_p$ parameter (given by \np{nn\_zpyc} in \nam{zdf\_iwm} namelist) 
    13911253controls the stratification-dependence of the pycnocline-intensified dissipation. 
    1392 It can take values of 1 (recommended) or 2. 
     1254It can take values of $1$ (recommended) or $2$. 
    13931255Finally, the vertical structures $F_{cri}$ and $F_{bot}$ require the specification of 
    13941256the decay scales $h_{cri}(i,j)$ and $h_{bot}(i,j)$, which are defined by two additional input maps. 
    13951257$h_{cri}$ is related to the large-scale topography of the ocean (etopo2) and 
    13961258$h_{bot}$ is a function of the energy flux $E_{bot}$, the characteristic horizontal scale of 
    1397 the abyssal hill topography \citep{Goff_JGR2010} and the latitude. 
     1259the abyssal hill topography \citep{goff_JGR10} and the latitude. 
     1260% 
     1261% Jc: input files names ? 
     1262 
     1263% ================================================================ 
     1264% surface wave-induced mixing 
     1265% ================================================================ 
     1266\section[Surface wave-induced mixing (\forcode{ln_zdfswm=.true.})] 
     1267{Surface wave-induced mixing (\protect\np{ln\_zdfswm}\forcode{=.true.})} 
     1268\label{subsec:ZDF_swm} 
     1269 
     1270Surface waves produce an enhanced mixing through wave-turbulence interaction. 
     1271In addition to breaking waves induced turbulence (\autoref{subsec:ZDF_tke}), 
     1272the influence of non-breaking waves can be accounted introducing 
     1273wave-induced viscosity and diffusivity as a function of the wave number spectrum. 
     1274Following \citet{qiao.yuan.ea_OD10}, a formulation of wave-induced mixing coefficient 
     1275is provided  as a function of wave amplitude, Stokes Drift and wave-number: 
     1276 
     1277\begin{equation} 
     1278  \label{eq:ZDF_Bv} 
     1279  B_{v} = \alpha {A} {U}_{st} {exp(3kz)} 
     1280\end{equation} 
     1281 
     1282Where $B_{v}$ is the wave-induced mixing coefficient, $A$ is the wave amplitude, 
     1283${U}_{st}$ is the Stokes Drift velocity, $k$ is the wave number and $\alpha$ 
     1284is a constant which should be determined by observations or 
     1285numerical experiments and is set to be 1. 
     1286 
     1287The coefficient $B_{v}$ is then directly added to the vertical viscosity 
     1288and diffusivity coefficients. 
     1289 
     1290In order to account for this contribution set: \forcode{ln_zdfswm=.true.}, 
     1291then wave interaction has to be activated through \forcode{ln_wave=.true.}, 
     1292the Stokes Drift can be evaluated by setting \forcode{ln_sdw=.true.} 
     1293(see \autoref{subsec:SBC_wave_sdw}) 
     1294and the needed wave fields can be provided either in forcing or coupled mode 
     1295(for more information on wave parameters and settings see \autoref{sec:SBC_wave}) 
     1296 
     1297% ================================================================ 
     1298% Adaptive-implicit vertical advection 
     1299% ================================================================ 
     1300\section[Adaptive-implicit vertical advection (\forcode{ln_zad_Aimp=.true.})] 
     1301{Adaptive-implicit vertical advection(\protect\np{ln\_zad\_Aimp}\forcode{=.true.})} 
     1302\label{subsec:ZDF_aimp} 
     1303 
     1304The adaptive-implicit vertical advection option in NEMO is based on the work of 
     1305\citep{shchepetkin_OM15}.  In common with most ocean models, the timestep used with NEMO 
     1306needs to satisfy multiple criteria associated with different physical processes in order 
     1307to maintain numerical stability. \citep{shchepetkin_OM15} pointed out that the vertical 
     1308CFL criterion is commonly the most limiting. \citep{lemarie.debreu.ea_OM15} examined the 
     1309constraints for a range of time and space discretizations and provide the CFL stability 
     1310criteria for a range of advection schemes. The values for the Leap-Frog with Robert 
     1311asselin filter time-stepping (as used in NEMO) are reproduced in 
     1312\autoref{tab:ZDF_zad_Aimp_CFLcrit}. Treating the vertical advection implicitly can avoid these 
     1313restrictions but at the cost of large dispersive errors and, possibly, large numerical 
     1314viscosity. The adaptive-implicit vertical advection option provides a targetted use of the 
     1315implicit scheme only when and where potential breaches of the vertical CFL condition 
     1316occur. In many practical applications these events may occur remote from the main area of 
     1317interest or due to short-lived conditions such that the extra numerical diffusion or 
     1318viscosity does not greatly affect the overall solution. With such applications, setting: 
     1319\forcode{ln_zad_Aimp=.true.} should allow much longer model timesteps to be used whilst 
     1320retaining the accuracy of the high order explicit schemes over most of the domain. 
     1321 
     1322\begin{table}[htbp] 
     1323  \centering 
     1324  % \begin{tabular}{cp{70pt}cp{70pt}cp{70pt}cp{70pt}} 
     1325  \begin{tabular}{r|ccc} 
     1326    \hline 
     1327    spatial discretization  & 2$^nd$ order centered & 3$^rd$ order upwind & 4$^th$ order compact \\ 
     1328    advective CFL criterion &                 0.904 &              0.472  &                0.522 \\ 
     1329    \hline 
     1330  \end{tabular} 
     1331  \caption[Advective CFL criteria for the leapfrog with Robert Asselin filter time-stepping]{ 
     1332    The advective CFL criteria for a range of spatial discretizations for 
     1333    the leapfrog with Robert Asselin filter time-stepping 
     1334    ($\nu=0.1$) as given in \citep{lemarie.debreu.ea_OM15}.} 
     1335  \label{tab:ZDF_zad_Aimp_CFLcrit} 
     1336\end{table} 
     1337 
     1338In particular, the advection scheme remains explicit everywhere except where and when 
     1339local vertical velocities exceed a threshold set just below the explicit stability limit. 
     1340Once the threshold is reached a tapered transition towards an implicit scheme is used by 
     1341partitioning the vertical velocity into a part that can be treated explicitly and any 
     1342excess that must be treated implicitly. The partitioning is achieved via a Courant-number 
     1343dependent weighting algorithm as described in \citep{shchepetkin_OM15}. 
     1344 
     1345The local cell Courant number ($Cu$) used for this partitioning is: 
     1346 
     1347\begin{equation} 
     1348  \label{eq:ZDF_Eqn_zad_Aimp_Courant} 
     1349  \begin{split} 
     1350    Cu &= {2 \rdt \over e^n_{3t_{ijk}}} \bigg (\big [ \texttt{Max}(w^n_{ijk},0.0) - \texttt{Min}(w^n_{ijk+1},0.0) \big ]    \\ 
     1351       &\phantom{=} +\big [ \texttt{Max}(e_{{2_u}ij}e^n_{{3_{u}}ijk}u^n_{ijk},0.0) - \texttt{Min}(e_{{2_u}i-1j}e^n_{{3_{u}}i-1jk}u^n_{i-1jk},0.0) \big ] 
     1352                     \big / e_{{1_t}ij}e_{{2_t}ij}            \\ 
     1353       &\phantom{=} +\big [ \texttt{Max}(e_{{1_v}ij}e^n_{{3_{v}}ijk}v^n_{ijk},0.0) - \texttt{Min}(e_{{1_v}ij-1}e^n_{{3_{v}}ij-1k}v^n_{ij-1k},0.0) \big ] 
     1354                     \big / e_{{1_t}ij}e_{{2_t}ij} \bigg )    \\ 
     1355  \end{split} 
     1356\end{equation} 
     1357 
     1358\noindent and the tapering algorithm follows \citep{shchepetkin_OM15} as: 
     1359 
     1360\begin{align} 
     1361  \label{eq:ZDF_Eqn_zad_Aimp_partition} 
     1362Cu_{min} &= 0.15 \nonumber \\ 
     1363Cu_{max} &= 0.3  \nonumber \\ 
     1364Cu_{cut} &= 2Cu_{max} - Cu_{min} \nonumber \\ 
     1365Fcu    &= 4Cu_{max}*(Cu_{max}-Cu_{min}) \nonumber \\ 
     1366\cf &= 
     1367     \begin{cases} 
     1368        0.0                                                        &\text{if $Cu \leq Cu_{min}$} \\ 
     1369        (Cu - Cu_{min})^2 / (Fcu +  (Cu - Cu_{min})^2)             &\text{else if $Cu < Cu_{cut}$} \\ 
     1370        (Cu - Cu_{max}) / Cu                                       &\text{else} 
     1371     \end{cases} 
     1372\end{align} 
     1373 
     1374\begin{figure}[!t] 
     1375  \centering 
     1376  \includegraphics[width=\textwidth]{Fig_ZDF_zad_Aimp_coeff} 
     1377  \caption[Partitioning coefficient used to partition vertical velocities into parts]{ 
     1378    The value of the partitioning coefficient (\cf) used to partition vertical velocities into 
     1379    parts to be treated implicitly and explicitly for a range of typical Courant numbers 
     1380    (\forcode{ln_zad_Aimp=.true.}).} 
     1381  \label{fig:ZDF_zad_Aimp_coeff} 
     1382\end{figure} 
     1383 
     1384\noindent The partitioning coefficient is used to determine the part of the vertical 
     1385velocity that must be handled implicitly ($w_i$) and to subtract this from the total 
     1386vertical velocity ($w_n$) to leave that which can continue to be handled explicitly: 
     1387 
     1388\begin{align} 
     1389  \label{eq:ZDF_Eqn_zad_Aimp_partition2} 
     1390    w_{i_{ijk}} &= \cf_{ijk} w_{n_{ijk}}     \nonumber \\ 
     1391    w_{n_{ijk}} &= (1-\cf_{ijk}) w_{n_{ijk}} 
     1392\end{align} 
     1393 
     1394\noindent Note that the coefficient is such that the treatment is never fully implicit; 
     1395the three cases from \autoref{eq:ZDF_Eqn_zad_Aimp_partition} can be considered as: 
     1396fully-explicit; mixed explicit/implicit and mostly-implicit.  With the settings shown the 
     1397coefficient (\cf) varies as shown in \autoref{fig:ZDF_zad_Aimp_coeff}. Note with these values 
     1398the $Cu_{cut}$ boundary between the mixed implicit-explicit treatment and 'mostly 
     1399implicit' is 0.45 which is just below the stability limited given in 
     1400\autoref{tab:ZDF_zad_Aimp_CFLcrit}  for a 3rd order scheme. 
     1401 
     1402The $w_i$ component is added to the implicit solvers for the vertical mixing in 
     1403\mdl{dynzdf} and \mdl{trazdf} in a similar way to \citep{shchepetkin_OM15}.  This is 
     1404sufficient for the flux-limited advection scheme (\forcode{ln_traadv_mus}) but further 
     1405intervention is required when using the flux-corrected scheme (\forcode{ln_traadv_fct}). 
     1406For these schemes the implicit upstream fluxes must be added to both the monotonic guess 
     1407and to the higher order solution when calculating the antidiffusive fluxes. The implicit 
     1408vertical fluxes are then removed since they are added by the implicit solver later on. 
     1409 
     1410The adaptive-implicit vertical advection option is new to NEMO at v4.0 and has yet to be 
     1411used in a wide range of simulations. The following test simulation, however, does illustrate 
     1412the potential benefits and will hopefully encourage further testing and feedback from users: 
     1413 
     1414\begin{figure}[!t] 
     1415  \centering 
     1416  \includegraphics[width=\textwidth]{Fig_ZDF_zad_Aimp_overflow_frames} 
     1417  \caption[OVERFLOW: time-series of temperature vertical cross-sections]{ 
     1418    A time-series of temperature vertical cross-sections for the OVERFLOW test case. 
     1419    These results are for the default settings with \forcode{nn_rdt=10.0} and 
     1420    without adaptive implicit vertical advection (\forcode{ln_zad_Aimp=.false.}).} 
     1421  \label{fig:ZDF_zad_Aimp_overflow_frames} 
     1422\end{figure} 
     1423 
     1424\subsection{Adaptive-implicit vertical advection in the OVERFLOW test-case} 
     1425 
     1426The \href{https://forge.ipsl.jussieu.fr/nemo/chrome/site/doc/NEMO/guide/html/test\_cases.html\#overflow}{OVERFLOW test case} 
     1427provides a simple illustration of the adaptive-implicit advection in action. The example here differs from the basic test case 
     1428by only a few extra physics choices namely: 
     1429 
     1430\begin{verbatim} 
     1431     ln_dynldf_OFF = .false. 
     1432     ln_dynldf_lap = .true. 
     1433     ln_dynldf_hor = .true. 
     1434     ln_zdfnpc     = .true. 
     1435     ln_traadv_fct = .true. 
     1436        nn_fct_h   =  2 
     1437        nn_fct_v   =  2 
     1438\end{verbatim} 
     1439 
     1440\noindent which were chosen to provide a slightly more stable and less noisy solution. The 
     1441result when using the default value of \forcode{nn_rdt=10.} without adaptive-implicit 
     1442vertical velocity is illustrated in \autoref{fig:ZDF_zad_Aimp_overflow_frames}. The mass of 
     1443cold water, initially sitting on the shelf, moves down the slope and forms a 
     1444bottom-trapped, dense plume. Even with these extra physics choices the model is close to 
     1445stability limits and attempts with \forcode{nn_rdt=30.} will fail after about 5.5 hours 
     1446with excessively high horizontal velocities. This time-scale corresponds with the time the 
     1447plume reaches the steepest part of the topography and, although detected as a horizontal 
     1448CFL breach, the instability originates from a breach of the vertical CFL limit. This is a good 
     1449candidate, therefore, for use of the adaptive-implicit vertical advection scheme. 
     1450 
     1451The results with \forcode{ln_zad_Aimp=.true.} and a variety of model timesteps 
     1452are shown in \autoref{fig:ZDF_zad_Aimp_overflow_all_rdt} (together with the equivalent 
     1453frames from the base run).  In this simple example the use of the adaptive-implicit 
     1454vertcal advection scheme has enabled a 12x increase in the model timestep without 
     1455significantly altering the solution (although at this extreme the plume is more diffuse 
     1456and has not travelled so far).  Notably, the solution with and without the scheme is 
     1457slightly different even with \forcode{nn_rdt=10.}; suggesting that the base run was 
     1458close enough to instability to trigger the scheme despite completing successfully. 
     1459To assist in diagnosing how active the scheme is, in both location and time, the 3D 
     1460implicit and explicit components of the vertical velocity are available via XIOS as 
     1461\texttt{wimp} and \texttt{wexp} respectively.  Likewise, the partitioning coefficient 
     1462(\cf) is also available as \texttt{wi\_cff}. For a quick oversight of 
     1463the schemes activity the global maximum values of the absolute implicit component 
     1464of the vertical velocity and the partitioning coefficient are written to the netCDF 
     1465version of the run statistics file (\texttt{run.stat.nc}) if this is active (see 
     1466\autoref{sec:MISC_opt} for activation details). 
     1467 
     1468\autoref{fig:ZDF_zad_Aimp_maxCf} shows examples of the maximum partitioning coefficient for 
     1469the various overflow tests.  Note that the adaptive-implicit vertical advection scheme is 
     1470active even in the base run with \forcode{nn_rdt=10.0s} adding to the evidence that the 
     1471test case is close to stability limits even with this value. At the larger timesteps, the 
     1472vertical velocity is treated mostly implicitly at some location throughout the run. The 
     1473oscillatory nature of this measure appears to be linked to the progress of the plume front 
     1474as each cusp is associated with the location of the maximum shifting to the adjacent cell. 
     1475This is illustrated in \autoref{fig:ZDF_zad_Aimp_maxCf_loc} where the i- and k- locations of the 
     1476maximum have been overlaid for the base run case. 
     1477 
     1478\medskip 
     1479\noindent Only limited tests have been performed in more realistic configurations. In the 
     1480ORCA2\_ICE\_PISCES reference configuration the scheme does activate and passes 
     1481restartability and reproducibility tests but it is unable to improve the model's stability 
     1482enough to allow an increase in the model time-step. A view of the time-series of maximum 
     1483partitioning coefficient (not shown here)  suggests that the default time-step of 5400s is 
     1484already pushing at stability limits, especially in the initial start-up phase. The 
     1485time-series does not, however, exhibit any of the 'cuspiness' found with the overflow 
     1486tests. 
     1487 
     1488\medskip 
     1489\noindent A short test with an eORCA1 configuration promises more since a test using a 
     1490time-step of 3600s remains stable with \forcode{ln_zad_Aimp=.true.} whereas the 
     1491time-step is limited to 2700s without. 
     1492 
     1493\begin{figure}[!t] 
     1494  \centering 
     1495  \includegraphics[width=\textwidth]{Fig_ZDF_zad_Aimp_overflow_all_rdt} 
     1496  \caption[OVERFLOW: sample temperature vertical cross-sections from mid- and end-run]{ 
     1497    Sample temperature vertical cross-sections from mid- and end-run using 
     1498    different values for \forcode{nn_rdt} and with or without adaptive implicit vertical advection. 
     1499    Without the adaptive implicit vertical advection 
     1500    only the run with the shortest timestep is able to run to completion. 
     1501    Note also that the colour-scale has been chosen to confirm that 
     1502    temperatures remain within the original range of 10$^o$ to 20$^o$.} 
     1503  \label{fig:ZDF_zad_Aimp_overflow_all_rdt} 
     1504\end{figure} 
     1505 
     1506\begin{figure}[!t] 
     1507  \centering 
     1508  \includegraphics[width=\textwidth]{Fig_ZDF_zad_Aimp_maxCf} 
     1509  \caption[OVERFLOW: maximum partitioning coefficient during a series of test runs]{ 
     1510    The maximum partitioning coefficient during a series of test runs with 
     1511    increasing model timestep length. 
     1512    At the larger timesteps, 
     1513    the vertical velocity is treated mostly implicitly at some location throughout the run.} 
     1514  \label{fig:ZDF_zad_Aimp_maxCf} 
     1515\end{figure} 
     1516 
     1517\begin{figure}[!t] 
     1518  \centering 
     1519  \includegraphics[width=\textwidth]{Fig_ZDF_zad_Aimp_maxCf_loc} 
     1520  \caption[OVERFLOW: maximum partitioning coefficient for the case overlaid]{ 
     1521    The maximum partitioning coefficient for the \forcode{nn_rdt=10.0} case overlaid with 
     1522    information on the gridcell i- and k-locations of the maximum value.} 
     1523  \label{fig:ZDF_zad_Aimp_maxCf_loc} 
     1524\end{figure} 
    13981525 
    13991526% ================================================================ 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_conservation.tex

    r10442 r11564  
    77% ================================================================ 
    88\chapter{Invariants of the Primitive Equations} 
    9 \label{chap:Invariant} 
    10 \minitoc 
     9\label{chap:CONS} 
     10 
     11\chaptertoc 
    1112 
    1213The continuous equations of motion have many analytic properties. 
     
    2122horizontal kinetic energy and/or potential enstrophy of horizontally non-divergent flow, 
    2223and variance of temperature and salinity will be conserved in the absence of dissipative effects and forcing. 
    23 \citet{Arakawa1966} has first pointed out the advantage of this approach. 
     24\citet{arakawa_JCP66} has first pointed out the advantage of this approach. 
    2425He showed that if integral constraints on energy are maintained, 
    2526the computation will be free of the troublesome "non linear" instability originally pointed out by 
    26 \citet{Phillips1959}. 
     27\citet{phillips_TAMS59}. 
    2728A consistent formulation of the energetic properties is also extremely important in carrying out 
    2829long-term numerical simulations for an oceanographic model. 
    29 Such a formulation avoids systematic errors that accumulate with time \citep{Bryan1997}. 
     30Such a formulation avoids systematic errors that accumulate with time \citep{bryan_JCP97}. 
    3031 
    3132The general philosophy of OPA which has led to the discrete formulation presented in {\S}II.2 and II.3 is to 
     
    3536The alternative is to use diffusive schemes such as upstream or flux corrected schemes. 
    3637This last option was rejected because we prefer a complete handling of the model diffusion, 
    37 \ie of the model physics rather than letting the advective scheme produces its own implicit diffusion without 
     38\ie\ of the model physics rather than letting the advective scheme produces its own implicit diffusion without 
    3839controlling the space and time structure of this implicit diffusion. 
    3940Note that in some very specific cases as passive tracer studies, the positivity of the advective scheme is required. 
    4041In that case, and in that case only, the advective scheme used for passive tracer is a flux correction scheme 
    41 \citep{Marti1992, Levy1996, Levy1998}. 
     42\citep{Marti1992?, Levy1996?, Levy1998?}. 
    4243 
    4344% ------------------------------------------------------------------------------------------------------------- 
     
    4546% ------------------------------------------------------------------------------------------------------------- 
    4647\section{Conservation properties on ocean dynamics} 
    47 \label{sec:Invariant_dyn} 
     48\label{sec:CONS_Invariant_dyn} 
    4849 
    4950The non linear term of the momentum equations has been split into a vorticity term, 
     
    6364The continuous formulation of the vorticity term satisfies following integral constraints: 
    6465\[ 
    65   % \label{eq:vor_vorticity} 
     66  % \label{eq:CONS_vor_vorticity} 
    6667  \int_D {{\textbf {k}}\cdot \frac{1}{e_3 }\nabla \times \left( {\varsigma 
    67         \;{\rm {\bf k}}\times {\textbf {U}}_h } \right)\;dv} =0 
    68 \] 
    69  
    70 \[ 
    71   % \label{eq:vor_enstrophy} 
     68        \;{\mathrm {\mathbf k}}\times {\textbf {U}}_h } \right)\;dv} =0 
     69\] 
     70 
     71\[ 
     72  % \label{eq:CONS_vor_enstrophy} 
    7273  if\quad \chi =0\quad \quad \int\limits_D {\varsigma \;{\textbf{k}}\cdot 
    7374    \frac{1}{e_3 }\nabla \times \left( {\varsigma {\textbf{k}}\times {\textbf{U}}_h } \right)\;dv} =-\int\limits_D {\frac{1}{2}\varsigma ^2\,\chi \;dv} 
     
    7677 
    7778\[ 
    78   % \label{eq:vor_energy} 
     79  % \label{eq:CONS_vor_energy} 
    7980  \int_D {{\textbf{U}}_h \times \left( {\varsigma \;{\textbf{k}}\times {\textbf{U}}_h } \right)\;dv} =0 
    8081\] 
     
    8889Using the symmetry or anti-symmetry properties of the operators (Eqs II.1.10 and 11), 
    8990it can be shown that the scheme (II.2.11) satisfies (II.4.1b) but not (II.4.1c), 
    90 while scheme (II.2.12) satisfies (II.4.1c) but not (II.4.1b) (see appendix C).  
     91while scheme (II.2.12) satisfies (II.4.1c) but not (II.4.1b) (see appendix C). 
    9192Note that the enstrophy conserving scheme on total vorticity has been chosen as the standard discrete form of 
    9293the vorticity term. 
     
    102103the horizontal gradient of horizontal kinetic energy: 
    103104 
    104 \begin{equation} \label{eq:keg_zad} 
    105 \int_D {{\textbf{U}}_h \cdot \nabla _h \left( {1/2\;{\textbf{U}}_h ^2} \right)\;dv} =-\int_D {{\textbf{U}}_h \cdot \frac{w}{e_3 }\;\frac{\partial  
     105\begin{equation} \label{eq:CONS_keg_zad} 
     106\int_D {{\textbf{U}}_h \cdot \nabla _h \left( {1/2\;{\textbf{U}}_h ^2} \right)\;dv} =-\int_D {{\textbf{U}}_h \cdot \frac{w}{e_3 }\;\frac{\partial 
    106107{\textbf{U}}_h }{\partial k}\;dv} 
    107108\end{equation} 
    108109 
    109110Using the discrete form given in {\S}II.2-a and the symmetry or anti-symmetry properties of 
    110 the mean and difference operators, \autoref{eq:keg_zad} is demonstrated in the Appendix C. 
    111 The main point here is that satisfying \autoref{eq:keg_zad} links the choice of the discrete forms of 
     111the mean and difference operators, \autoref{eq:CONS_keg_zad} is demonstrated in the Appendix C. 
     112The main point here is that satisfying \autoref{eq:CONS_keg_zad} links the choice of the discrete forms of 
    112113the vertical advection and of the horizontal gradient of horizontal kinetic energy. 
    113114Choosing one imposes the other. 
     
    122123This properties is satisfied locally with the choice of discretization we have made (property (II.1.9)~). 
    123124In addition, when the equation of state is linear 
    124 (\ie when an advective-diffusive equation for density can be derived from those of temperature and salinity) 
     125(\ie\ when an advective-diffusive equation for density can be derived from those of temperature and salinity) 
    125126the change of horizontal kinetic energy due to the work of pressure forces is balanced by the change of 
    126127potential energy due to buoyancy forces: 
    127128 
    128129\[ 
    129   % \label{eq:hpg_pe} 
     130  % \label{eq:CONS_hpg_pe} 
    130131  \int_D {-\frac{1}{\rho_o }\left. {\nabla p^h} \right|_z \cdot {\textbf {U}}_h \;dv} \;=\;\int_D {\nabla .\left( {\rho \,{\textbf{U}}} \right)\;g\;z\;\;dv} 
    131132\] 
     
    133134Using the discrete form given in {\S}~II.2-a and the symmetry or anti-symmetry properties of 
    134135the mean and difference operators, (II.4.3) is demonstrated in the Appendix C. 
    135 The main point here is that satisfying (II.4.3) strongly constraints the discrete expression of the depth of  
     136The main point here is that satisfying (II.4.3) strongly constraints the discrete expression of the depth of 
    136137$T$-points and of the term added to the pressure gradient in $s-$coordinates: the depth of a $T$-point, $z_T$, 
    137138is defined as the sum the vertical scale factors at $w$-points starting from the surface. 
     
    145146Nevertheless, the $\psi$-equation is solved numerically by an iterative solver (see {\S}~III.5), 
    146147thus the property is only satisfied with the accuracy required on the solver. 
    147 In addition, with the rigid-lid approximation, the change of horizontal kinetic energy due to the work of  
     148In addition, with the rigid-lid approximation, the change of horizontal kinetic energy due to the work of 
    148149surface pressure forces is exactly zero: 
    149150\[ 
    150   % \label{eq:spg} 
     151  % \label{eq:CONS_spg} 
    151152  \int_D {-\frac{1}{\rho_o }\nabla _h } \left( {p_s } \right)\cdot {\textbf{U}}_h \;dv=0 
    152153\] 
     
    161162% ------------------------------------------------------------------------------------------------------------- 
    162163\section{Conservation properties on ocean thermodynamics} 
    163 \label{sec:Invariant_tra} 
     164\label{sec:CONS_Invariant_tra} 
    164165 
    165166In continuous formulation, the advective terms of the tracer equations conserve the tracer content and 
    166167the quadratic form of the tracer, \ie 
    167168\[ 
    168   % \label{eq:tra_tra2} 
     169  % \label{eq:CONS_tra_tra2} 
    169170  \int_D {\nabla .\left( {T\;{\textbf{U}}} \right)\;dv} =0 
    170171  \;\text{and} 
     
    176177Note that in both continuous and discrete formulations, there is generally no strict conservation of mass, 
    177178since the equation of state is non linear with respect to $T$ and $S$. 
    178 In practice, the mass is conserved with a very good accuracy.  
     179In practice, the mass is conserved with a very good accuracy. 
    179180 
    180181% ------------------------------------------------------------------------------------------------------------- 
     
    182183% ------------------------------------------------------------------------------------------------------------- 
    183184\subsection{Conservation properties on momentum physics} 
    184 \label{subsec:Invariant_dyn_physics} 
     185\label{subsec:CONS_Invariant_dyn_physics} 
    185186 
    186187\textbf{* lateral momentum diffusion term} 
     
    188189The continuous formulation of the horizontal diffusion of momentum satisfies the following integral constraints~: 
    189190\[ 
    190   % \label{eq:dynldf_dyn} 
    191   \int\limits_D {\frac{1}{e_3 }{\rm {\bf k}}\cdot \nabla \times \left[ {\nabla 
     191  % \label{eq:CONS_dynldf_dyn} 
     192  \int\limits_D {\frac{1}{e_3 }{\mathrm {\mathbf k}}\cdot \nabla \times \left[ {\nabla 
    192193        _h \left( {A^{lm}\;\chi } \right)-\nabla _h \times \left( {A^{lm}\;\zeta 
    193             \;{\rm {\bf k}}} \right)} \right]\;dv} =0 
    194 \] 
    195  
    196 \[ 
    197   % \label{eq:dynldf_div} 
     194            \;{\mathrm {\mathbf k}}} \right)} \right]\;dv} =0 
     195\] 
     196 
     197\[ 
     198  % \label{eq:CONS_dynldf_div} 
    198199  \int\limits_D {\nabla _h \cdot \left[ {\nabla _h \left( {A^{lm}\;\chi } 
    199         \right)-\nabla _h \times \left( {A^{lm}\;\zeta \;{\rm {\bf k}}} \right)} 
     200        \right)-\nabla _h \times \left( {A^{lm}\;\zeta \;{\mathrm {\mathbf k}}} \right)} 
    200201    \right]\;dv} =0 
    201202\] 
    202203 
    203204\[ 
    204   % \label{eq:dynldf_curl} 
    205   \int_D {{\rm {\bf U}}_h \cdot \left[ {\nabla _h \left( {A^{lm}\;\chi } 
    206         \right)-\nabla _h \times \left( {A^{lm}\;\zeta \;{\rm {\bf k}}} \right)} 
     205  % \label{eq:CONS_dynldf_curl} 
     206  \int_D {{\mathrm {\mathbf U}}_h \cdot \left[ {\nabla _h \left( {A^{lm}\;\chi } 
     207        \right)-\nabla _h \times \left( {A^{lm}\;\zeta \;{\mathrm {\mathbf k}}} \right)} 
    207208    \right]\;dv} \leqslant 0 
    208209\] 
    209210 
    210211\[ 
    211   % \label{eq:dynldf_curl2} 
    212   \mbox{if}\quad A^{lm}=cste\quad \quad \int_D {\zeta \;{\rm {\bf k}}\cdot 
     212  % \label{eq:CONS_dynldf_curl2} 
     213  \mbox{if}\quad A^{lm}=cste\quad \quad \int_D {\zeta \;{\mathrm {\mathbf k}}\cdot 
    213214    \nabla \times \left[ {\nabla _h \left( {A^{lm}\;\chi } \right)-\nabla _h 
    214         \times \left( {A^{lm}\;\zeta \;{\rm {\bf k}}} \right)} \right]\;dv} 
     215        \times \left( {A^{lm}\;\zeta \;{\mathrm {\mathbf k}}} \right)} \right]\;dv} 
    215216  \leqslant 0 
    216217\] 
    217218 
    218219\[ 
    219   % \label{eq:dynldf_div2} 
     220  % \label{eq:CONS_dynldf_div2} 
    220221  \mbox{if}\quad A^{lm}=cste\quad \quad \int_D {\chi \;\nabla _h \cdot \left[ 
    221222      {\nabla _h \left( {A^{lm}\;\chi } \right)-\nabla _h \times \left( 
    222           {A^{lm}\;\zeta \;{\rm {\bf k}}} \right)} \right]\;dv} \leqslant 0 
     223          {A^{lm}\;\zeta \;{\mathrm {\mathbf k}}} \right)} \right]\;dv} \leqslant 0 
    223224\] 
    224225 
     
    250251 
    251252\[ 
    252   % \label{eq:dynzdf_dyn} 
     253  % \label{eq:CONS_dynzdf_dyn} 
    253254  \begin{aligned} 
    254255    & \int_D {\frac{1}{e_3 }}  \frac{\partial }{\partial k}\left( \frac{A^{vm}}{e_3 }\frac{\partial {\textbf{U}}_h }{\partial k} \right) \;dv = \overrightarrow{\textbf{0}} \\ 
     
    258259conservation of vorticity, dissipation of enstrophy 
    259260\[ 
    260   % \label{eq:dynzdf_vor} 
    261   \begin{aligned} 
    262     & \int_D {\frac{1}{e_3 }{\rm {\bf k}}\cdot \nabla \times \left( {\frac{1}{e_3 
    263           }\frac{\partial }{\partial k}\left( {\frac{A^{vm}}{e_3 }\frac{\partial {\rm 
    264                   {\bf U}}_h }{\partial k}} \right)} \right)\;dv} =0 \\ 
    265     & \int_D {\zeta \,{\rm {\bf k}}\cdot \nabla \times \left( {\frac{1}{e_3 
    266           }\frac{\partial }{\partial k}\left( {\frac{A^{vm}}{e_3 }\frac{\partial {\rm 
    267                   {\bf U}}_h }{\partial k}} \right)} \right)\;dv} \leq 0 \\ 
     261  % \label{eq:CONS_dynzdf_vor} 
     262  \begin{aligned} 
     263    & \int_D {\frac{1}{e_3 }{\mathrm {\mathbf k}}\cdot \nabla \times \left( {\frac{1}{e_3 
     264          }\frac{\partial }{\partial k}\left( {\frac{A^{vm}}{e_3 }\frac{\partial {\mathrm 
     265                  {\mathbf U}}_h }{\partial k}} \right)} \right)\;dv} =0 \\ 
     266    & \int_D {\zeta \,{\mathrm {\mathbf k}}\cdot \nabla \times \left( {\frac{1}{e_3 
     267          }\frac{\partial }{\partial k}\left( {\frac{A^{vm}}{e_3 }\frac{\partial {\mathrm 
     268                  {\mathbf U}}_h }{\partial k}} \right)} \right)\;dv} \leq 0 \\ 
    268269  \end{aligned} 
    269270\] 
    270271conservation of horizontal divergence, dissipation of square of the horizontal divergence 
    271272\[ 
    272   % \label{eq:dynzdf_div} 
     273  % \label{eq:CONS_dynzdf_div} 
    273274  \begin{aligned} 
    274275    &\int_D {\nabla \cdot \left( {\frac{1}{e_3 }\frac{\partial }{\partial 
    275             k}\left( {\frac{A^{vm}}{e_3 }\frac{\partial {\rm {\bf U}}_h }{\partial k}} 
     276            k}\left( {\frac{A^{vm}}{e_3 }\frac{\partial {\mathrm {\mathbf U}}_h }{\partial k}} 
    276277          \right)} \right)\;dv} =0 \\ 
    277278    & \int_D {\chi \;\nabla \cdot \left( {\frac{1}{e_3 }\frac{\partial }{\partial 
    278             k}\left( {\frac{A^{vm}}{e_3 }\frac{\partial {\rm {\bf U}}_h }{\partial k}} 
     279            k}\left( {\frac{A^{vm}}{e_3 }\frac{\partial {\mathrm {\mathbf U}}_h }{\partial k}} 
    279280          \right)} \right)\;dv} \leq 0 \\ 
    280281  \end{aligned} 
     
    283284In discrete form, all these properties are satisfied in $z$-coordinate (see Appendix C). 
    284285In $s$-coordinates, only first order properties can be demonstrated, 
    285 \ie the vertical momentum physics conserve momentum, potential vorticity, and horizontal divergence. 
     286\ie\ the vertical momentum physics conserve momentum, potential vorticity, and horizontal divergence. 
    286287 
    287288% ------------------------------------------------------------------------------------------------------------- 
     
    289290% ------------------------------------------------------------------------------------------------------------- 
    290291\subsection{Conservation properties on tracer physics} 
    291 \label{subsec:Invariant_tra_physics} 
     292\label{subsec:CONS_Invariant_tra_physics} 
    292293 
    293294The numerical schemes used for tracer subgridscale physics are written in such a way that 
    294295the heat and salt contents are conserved (equations in flux form, second order centred finite differences). 
    295296As a form flux is used to compute the temperature and salinity, 
    296 the quadratic form of these quantities (\ie their variance) globally tends to diminish. 
     297the quadratic form of these quantities (\ie\ their variance) globally tends to diminish. 
    297298As for the advective term, there is generally no strict conservation of mass even if, 
    298 in practice, the mass is conserved with a very good accuracy.  
    299  
    300 \textbf{* lateral physics: }conservation of tracer, dissipation of tracer  
     299in practice, the mass is conserved with a very good accuracy. 
     300 
     301\textbf{* lateral physics: }conservation of tracer, dissipation of tracer 
    301302variance, i.e. 
    302303 
    303304\[ 
    304   % \label{eq:traldf_t_t2} 
     305  % \label{eq:CONS_traldf_t_t2} 
    305306  \begin{aligned} 
    306307    &\int_D \nabla\, \cdot\, \left( A^{lT} \,\Re \,\nabla \,T \right)\;dv = 0 \\ 
     
    312313 
    313314\[ 
    314   % \label{eq:trazdf_t_t2} 
     315  % \label{eq:CONS_trazdf_t_t2} 
    315316  \begin{aligned} 
    316317    & \int_D \frac{1}{e_3 } \frac{\partial }{\partial k}\left( \frac{A^{vT}}{e_3 }  \frac{\partial T}{\partial k}  \right)\;dv = 0 \\ 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_misc.tex

    r10601 r11564  
    88\label{chap:MISC} 
    99 
    10 \minitoc 
     10\chaptertoc 
    1111 
    1212\newpage 
     
    2727balance the net evaporation occurring over the Mediterranean region. 
    2828This problem occurs even in eddy permitting simulations. 
    29 For example, in ORCA 1/4\deg several straits of the Indonesian archipelago (Ombai, Lombok...) 
     29For example, in ORCA 1/4\deg\ several straits of the Indonesian archipelago (Ombai, Lombok...) 
    3030are much narrow than even a single ocean grid-point. 
    3131 
    32 We describe briefly here the three methods that can be used in \NEMO to handle such improperly resolved straits. 
    33 The first two consist of opening the strait by hand while ensuring that the mass exchanges through 
    34 the strait are not too large by either artificially reducing the surface of the strait grid-cells or, 
    35 locally increasing the lateral friction. 
    36 In the third one, the strait is closed but exchanges of mass, heat and salt across the land are allowed. 
    37 Note that such modifications are so specific to a given configuration that no attempt has been made to 
    38 set them in a generic way. 
    39 However, examples of how they can be set up is given in the ORCA 2\deg and 0.5\deg configurations. 
    40 For example, for details of implementation in ORCA2, search: \texttt{IF( cp\_cfg == "orca" .AND. jp\_cfg == 2 )} 
     32We describe briefly here the two methods that can be used in \NEMO\ to handle such 
     33improperly resolved straits. The methods consist of opening the strait while ensuring 
     34that the mass exchanges through the strait are not too large by either artificially 
     35reducing the cross-sectional area of the strait grid-cells or, locally increasing the 
     36lateral friction. 
    4137 
    4238% ------------------------------------------------------------------------------------------------------------- 
     
    4642\label{subsec:MISC_strait_hand} 
    4743 
    48 $\bullet$ reduced scale factor in the cross-strait direction to a value in better agreement with 
    49 the true mean width of the strait (\autoref{fig:MISC_strait_hand}). 
    50 This technique is sometime called "partially open face" or "partially closed cells". 
    51 The key issue here is only to reduce the faces of $T$-cell 
    52 (\ie change the value of the horizontal scale factors at $u$- or $v$-point) but not the volume of the $T$-cell. 
    53 Indeed, reducing the volume of strait $T$-cell can easily produce a numerical instability at 
    54 that grid point that would require a reduction of the model time step. 
    55 The changes associated with strait management are done in \mdl{domhgr}, 
    56 just after the definition or reading of the horizontal scale factors.  
    57  
    58 $\bullet$ increase of the viscous boundary layer thickness by local increase of the fmask value at the coast 
    59 (\autoref{fig:MISC_strait_hand}). 
    60 This is done in \mdl{dommsk} together with the setting of the coastal value of fmask (see  \autoref{sec:LBC_coast}). 
     44The first method involves reducing the scale factor in the cross-strait direction to a 
     45value in better agreement with the true mean width of the strait 
     46(\autoref{fig:MISC_strait_hand}).  This technique is sometime called "partially open face" 
     47or "partially closed cells".  The key issue here is only to reduce the faces of $T$-cell 
     48(\ie\ change the value of the horizontal scale factors at $u$- or $v$-point) but not the 
     49volume of the $T$-cell.  Indeed, reducing the volume of strait $T$-cell can easily produce 
     50a numerical instability at that grid point which would require a reduction of the model 
     51time step.  Thus to instigate a local change in the width of a Strait requires two steps: 
     52 
     53\begin{itemize} 
     54 
     55\item Add \texttt{e1e2u} and \texttt{e1e2v} arrays to the \np{cn\_domcfg} file. These 2D 
     56arrays should contain the products of the unaltered values of: $\texttt{e1u}*\texttt{e2u}$ 
     57and $\texttt{e1u}*\texttt{e2v}$ respectively. That is the original surface areas of $u$- 
     58and $v$- cells respectively.  These areas are usually defined by the corresponding product 
     59within the \NEMO\ code but the presence of \texttt{e1e2u} and \texttt{e1e2v} in the 
     60\np{cn\_domcfg} file will suppress this calculation and use the supplied fields instead. 
     61If the model domain is provided by user-supplied code in \mdl{usrdef\_hgr}, then this 
     62routine should also return \texttt{e1e2u} and \texttt{e1e2v} and set the integer return 
     63argument \texttt{ie1e2u\_v} to a non-zero value. Values other than 0 for this argument 
     64will suppress the calculation of the areas. 
     65 
     66\item Change values of \texttt{e2u} or \texttt{e1v} (either in the \np{cn\_domcfg} file or 
     67via code in  \mdl{usrdef\_hgr}), whereever a Strait reduction is required. The choice of 
     68whether to alter \texttt{e2u} or \texttt{e1v} depends. respectively,  on whether the 
     69Strait in question is North-South orientated (\eg\ Gibraltar) or East-West orientated (\eg 
     70Lombok). 
     71 
     72\end{itemize} 
     73 
     74The second method is to increase the viscous boundary layer thickness by a local increase 
     75of the fmask value at the coast. This method can also be effective in wider passages.  The 
     76concept is illustarted in the second part of  \autoref{fig:MISC_strait_hand} and changes 
     77to specific locations can be coded in \mdl{usrdef\_fmask}. The \forcode{usr_def_fmask} 
     78routine is always called after \texttt{fmask} has been defined according to the choice of 
     79lateral boundary condition as discussed in \autoref{sec:LBC_coast}. The default version of 
     80\mdl{usrdef\_fmask} contains settings specific to ORCA2 and ORCA1 configurations. These are 
     81meant as examples only; it is up to the user to verify settings and provide alternatives 
     82for their own configurations. The default \forcode{usr_def_fmask} makes no changes to 
     83\texttt{fmask} for any other configuration. 
    6184 
    6285%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    6386\begin{figure}[!tbp] 
    64   \begin{center} 
    65     \includegraphics[width=0.80\textwidth]{Fig_Gibraltar} 
    66     \includegraphics[width=0.80\textwidth]{Fig_Gibraltar2} 
    67     \caption{ 
    68       \protect\label{fig:MISC_strait_hand} 
    69       Example of the Gibraltar strait defined in a $1^{\circ} \times 1^{\circ}$ mesh. 
    70       \textit{Top}: using partially open cells. 
    71       The meridional scale factor at $v$-point is reduced on both sides of the strait to account for 
    72       the real width of the strait (about 20 km). 
    73       Note that the scale factors of the strait $T$-point remains unchanged. 
    74       \textit{Bottom}: using viscous boundary layers. 
    75       The four fmask parameters along the strait coastlines are set to a value larger than 4, 
    76       \ie "strong" no-slip case (see \autoref{fig:LBC_shlat}) creating a large viscous boundary layer that 
    77       allows a reduced transport through the strait. 
    78     } 
    79   \end{center} 
     87  \centering 
     88  \includegraphics[width=\textwidth]{Fig_Gibraltar} 
     89  \includegraphics[width=\textwidth]{Fig_Gibraltar2} 
     90  \caption[Two methods to defined the Gibraltar strait]{ 
     91    Example of the Gibraltar strait defined in a 1\deg\ $\times$ 1\deg\ mesh. 
     92    \textit{Top}: using partially open cells. 
     93    The meridional scale factor at $v$-point is reduced on both sides of the strait to 
     94    account for the real width of the strait (about 20 km). 
     95    Note that the scale factors of the strait $T$-point remains unchanged. 
     96    \textit{Bottom}: using viscous boundary layers. 
     97    The four fmask parameters along the strait coastlines are set to a value larger than 4, 
     98    \ie\ "strong" no-slip case (see \autoref{fig:LBC_shlat}) creating a large viscous boundary layer 
     99    that allows a reduced transport through the strait.} 
     100  \label{fig:MISC_strait_hand} 
    80101\end{figure} 
    81102%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    83104%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    84105\begin{figure}[!tbp] 
    85   \begin{center} 
    86     \includegraphics[width=1.0\textwidth]{Fig_closea_mask_example} 
    87     \caption{ 
    88       \protect\label{fig:closea_mask_example} 
    89       Example of mask fields for the closea module. \textit{Left}: a 
    90       closea\_mask field; \textit{Right}: a closea\_mask\_rnf 
    91       field. In this example, if ln\_closea is set to .true., the mean 
    92       freshwater flux over each of the American Great Lakes will be 
    93       set to zero, and the total residual for all the lakes, if 
    94       negative, will be put into the St Laurence Seaway in the area 
    95       shown.  
    96     } 
    97   \end{center} 
     106  \centering 
     107  \includegraphics[width=\textwidth]{Fig_closea_mask_example} 
     108  \caption[Mask fields for the \protect\mdl{closea} module]{ 
     109    Example of mask fields for the \protect\mdl{closea} module. 
     110    \textit{Left}: a closea\_mask field; 
     111    \textit{Right}: a closea\_mask\_rnf field. 
     112    In this example, if \protect\np{ln\_closea} is set to \forcode{.true.}, 
     113    the mean freshwater flux over each of the American Great Lakes will be set to zero, 
     114    and the total residual for all the lakes, if negative, will be put into 
     115    the St Laurence Seaway in the area shown.} 
     116  \label{fig:MISC_closea_mask_example} 
    98117\end{figure} 
    99118%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    102121% Closed seas 
    103122% ================================================================ 
    104 \section{Closed seas (\protect\mdl{closea})} 
     123\section[Closed seas (\textit{closea.F90})] 
     124{Closed seas (\protect\mdl{closea})} 
    105125\label{sec:MISC_closea} 
    106126 
     
    116136to zero and put the residual flux into the ocean. 
    117137 
    118 Prior to NEMO 4 the locations of inland seas and lakes was set via 
    119 hardcoded indices for various ORCA configurations. From NEMO 4 onwards 
     138Prior to \NEMO\ 4 the locations of inland seas and lakes was set via 
     139hardcoded indices for various ORCA configurations. From \NEMO\ 4 onwards 
    120140the inland seas and lakes are defined using mask fields in the 
    121141domain configuration file. The options are as follows. 
    122142 
    123143\begin{enumerate} 
    124 \item{{\bf No ``closea\_mask'' field is included in domain configuration 
     144\item{{\bfseries No ``closea\_mask'' field is included in domain configuration 
    125145  file.} In this case the closea module does nothing.} 
    126146 
    127 \item{{\bf A field called closea\_mask is included in the domain 
     147\item{{\bfseries A field called closea\_mask is included in the domain 
    128148configuration file and ln\_closea=.false. in namelist namcfg.} In this 
    129149case the inland seas defined by the closea\_mask field are filled in 
     
    131151closea\_mask that is nonzero is set to be a land point.} 
    132152 
    133 \item{{\bf A field called closea\_mask is included in the domain 
     153\item{{\bfseries A field called closea\_mask is included in the domain 
    134154configuration file and ln\_closea=.true. in namelist namcfg.} Each 
    135155inland sea or group of inland seas is set to a positive integer value 
    136 in the closea\_mask field (see Figure \ref{fig:closea_mask_example} 
     156in the closea\_mask field (see \autoref{fig:MISC_closea_mask_example} 
    137157for an example). The net surface flux over each inland sea or group of 
    138158inland seas is set to zero each timestep and the residual flux is 
     
    140160closea\_mask is zero).} 
    141161 
    142 \item{{\bf Fields called closea\_mask and closea\_mask\_rnf are 
     162\item{{\bfseries Fields called closea\_mask and closea\_mask\_rnf are 
    143163included in the domain configuration file and ln\_closea=.true. in 
    144164namelist namcfg.} This option works as for option 3, except that if 
     
    149169by the closea\_mask\_rnf field. Each mapping is defined by a positive 
    150170integer value for the inland sea(s) and the corresponding runoff 
    151 points. An example is given in Figure 
    152 \ref{fig:closea_mask_example}. If no mapping is provided for a 
     171points. An example is given in 
     172\autoref{fig:MISC_closea_mask_example}. If no mapping is provided for a 
    153173particular inland sea then the residual is spread over the global 
    154174ocean.} 
    155175 
    156 \item{{\bf Fields called closea\_mask and closea\_mask\_emp are 
     176\item{{\bfseries Fields called closea\_mask and closea\_mask\_emp are 
    157177included in the domain configuration file and ln\_closea=.true. in 
    158178namelist namcfg.} This option works the same as option 4 except that 
     
    164184 
    165185There is a python routine to create the closea\_mask fields and append 
    166 them to the domain configuration file in the utils/tools/DOMAINcfg directory.  
    167  
    168 % ================================================================ 
    169 % Sub-Domain Functionality  
     186them to the domain configuration file in the utils/tools/DOMAINcfg directory. 
     187 
     188% ================================================================ 
     189% Sub-Domain Functionality 
    170190% ================================================================ 
    171191\section{Sub-domain functionality} 
     
    174194\subsection{Simple subsetting of input files via NetCDF attributes} 
    175195 
    176 The extended grids for use with the under-shelf ice cavities will result in redundant rows around Antarctica if 
    177 the ice cavities are not active. 
    178 A simple mechanism for subsetting input files associated with the extended domains has been implemented to 
    179 avoid the need to maintain different sets of input fields for use with or without active ice cavities. 
    180 The existing 'zoom' options are overly complex for this task and marked for deletion anyway. 
    181 This alternative subsetting operates for the j-direction only and works by optionally looking for and 
    182 using a global file attribute (named: \np{open\_ocean\_jstart}) to determine the starting j-row for input. 
    183 The use of this option is best explained with an example: 
    184 consider an ORCA1 configuration using the extended grid bathymetry and coordinate files: 
    185 \vspace{-10pt} 
    186 \ifile{eORCA1\_bathymetry\_v2} 
    187 \ifile{eORCA1\_coordinates} 
    188 \noindent These files define a horizontal domain of 362x332. 
    189 Assuming the first row with open ocean wet points in the non-isf bathymetry for this set is row 42 
    190 (\fortran indexing) then the formally correct setting for \np{open\_ocean\_jstart} is 41. 
    191 Using this value as the first row to be read will result in a 362x292 domain which is the same size as 
    192 the original ORCA1 domain. 
    193 Thus the extended coordinates and bathymetry files can be used with all the original input files for ORCA1 if 
    194 the ice cavities are not active (\np{ln\_isfcav = .false.}). 
    195 Full instructions for achieving this are: 
    196  
    197 \noindent Add the new attribute to any input files requiring a j-row offset, i.e: 
    198 \vspace{-10pt} 
     196The extended grids for use with the under-shelf ice cavities will result in redundant rows 
     197around Antarctica if the ice cavities are not active.  A simple mechanism for subsetting 
     198input files associated with the extended domains has been implemented to avoid the need to 
     199maintain different sets of input fields for use with or without active ice cavities.  This 
     200subsetting operates for the j-direction only and works by optionally looking for and using 
     201a global file attribute (named: \np{open\_ocean\_jstart}) to determine the starting j-row 
     202for input.  The use of this option is best explained with an example: 
     203\medskip 
     204 
     205\noindent Consider an ORCA1 
     206configuration using the extended grid domain configuration file: \ifile{eORCA1\_domcfg.nc} 
     207This file define a horizontal domain of 362x332.  The first row with 
     208open ocean wet points in the non-isf bathymetry for this set is row 42 (\fortran\ indexing) 
     209then the formally correct setting for \np{open\_ocean\_jstart} is 41.  Using this value as 
     210the first row to be read will result in a 362x292 domain which is the same size as the 
     211original ORCA1 domain.  Thus the extended domain configuration file can be used with all 
     212the original input files for ORCA1 if the ice cavities are not active (\np{ln\_isfcav = 
     213.false.}).  Full instructions for achieving this are: 
     214 
     215\begin{itemize} 
     216\item  Add the new attribute to any input files requiring a j-row offset, i.e: 
    199217\begin{cmds} 
    200 ncatted  -a open_ocean_jstart,global,a,d,41 eORCA1_coordinates.nc  
    201 ncatted  -a open_ocean_jstart,global,a,d,41 eORCA1_bathymetry_v2.nc 
     218ncatted  -a open_ocean_jstart,global,a,d,41 eORCA1_domcfg.nc 
    202219\end{cmds} 
    203   
    204 \noindent Add the logical switch to \ngn{namcfg} in the configuration namelist and set true: 
    205 %--------------------------------------------namcfg-------------------------------------------------------- 
    206  
    207 \nlst{namcfg} 
    208 %-------------------------------------------------------------------------------------------------------------- 
    209  
    210 \noindent Note the j-size of the global domain is the (extended j-size minus \np{open\_ocean\_jstart} + 1 ) and 
    211 this must match the size of all datasets other than bathymetry and coordinates currently. 
    212 However the option can be extended to any global, 2D and 3D, netcdf, input field by adding the: 
    213 \vspace{-10pt} 
     220 
     221\item Add the logical switch \np{ln\_use\_jattr} to \nam{cfg} in the configuration 
     222namelist (if it is not already there) and set \np{.true.} 
     223\end{itemize} 
     224 
     225\noindent Note that with this option, the j-size of the global domain is (extended 
     226j-size minus \np{open\_ocean\_jstart} + 1 ) and this must match the \texttt{jpjglo} value 
     227for the configuration. This means an alternative version of \ifile{eORCA1\_domcfg.nc} must 
     228be created for when \np{ln\_use\_jattr} is active. The \texttt{ncap2} tool provides a 
     229convenient way of achieving this: 
     230 
     231\begin{cmds} 
     232ncap2 -s 'jpjglo=292' eORCA1_domcfg.nc nORCA1_domcfg.nc 
     233\end{cmds} 
     234 
     235The domain configuration file is unique in this respect since it also contains the value of \jp{jpjglo} 
     236that is read and used by the model. 
     237Any other global, 2D and 3D, netcdf, input field can be prepared for use in a reduced domain by adding the 
     238\texttt{open\_ocean\_jstart} attribute to the file's global attributes. 
     239In particular this is true for any field that is read by \NEMO\ using the following optional argument to 
     240the appropriate call to \np{iom\_get}. 
     241 
    214242\begin{forlines} 
    215243lrowattr=ln_use_jattr 
    216244\end{forlines} 
    217 optional argument to the appropriate \np{iom\_get} call and the \np{open\_ocean\_jstart} attribute to 
    218 the corresponding input files. 
    219 It remains the users responsibility to set \np{jpjdta} and \np{jpjglo} values in 
    220 the \np{namelist\_cfg} file according to their needs. 
    221  
    222 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    223 \begin{figure}[!ht] 
    224   \begin{center} 
    225     \includegraphics[width=0.90\textwidth]{Fig_LBC_zoom} 
    226     \caption{ 
    227       \protect\label{fig:LBC_zoom} 
    228       Position of a model domain compared to the data input domain when the zoom functionality is used. 
    229     } 
    230   \end{center} 
    231 \end{figure} 
    232 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    233  
     245 
     246Currently, only the domain configuration variables make use of this optional argument so 
     247this facility is of little practical use except for tests where no other external input 
     248files are needed or you wish to use an extended domain configuration with inputs from 
     249earlier, non-extended configurations. Alternatively, it should be possible to exclude 
     250empty rows for extended domain, forced ocean runs using interpolation on the fly, by 
     251adding the optional argument to \texttt{iom\_get} calls for the weights and initial 
     252conditions. Experimenting with this remains an exercise for the user. 
    234253 
    235254% ================================================================ 
    236255% Accuracy and Reproducibility 
    237256% ================================================================ 
    238 \section{Accuracy and reproducibility (\protect\mdl{lib\_fortran})} 
     257\section[Accuracy and reproducibility (\textit{lib\_fortran.F90})] 
     258{Accuracy and reproducibility (\protect\mdl{lib\_fortran})} 
    239259\label{sec:MISC_fortran} 
    240260 
    241 \subsection{Issues with intrinsinc SIGN function (\protect\key{nosignedzero})} 
     261\subsection[Issues with intrinsinc SIGN function (\texttt{\textbf{key\_nosignedzero}})] 
     262{Issues with intrinsinc SIGN function (\protect\key{nosignedzero})} 
    242263\label{subsec:MISC_sign} 
    243264 
    244 The SIGN(A, B) is the \fortran intrinsic function delivers the magnitude of A with the sign of B. 
     265The SIGN(A, B) is the \fortran\ intrinsic function delivers the magnitude of A with the sign of B. 
    245266For example, SIGN(-3.0,2.0) has the value 3.0. 
    246267The problematic case is when the second argument is zero, because, on platforms that support IEEE arithmetic, 
     
    254275and the processor is capable of distinguishing between positive and negative zero, 
    255276and B is negative real zero. 
    256 Then SIGN delivers a negative result where, under \fninety rules, it used to return a positive result. 
     277Then SIGN delivers a negative result where, under \fninety\ rules, it used to return a positive result. 
    257278This change may be especially sensitive for the ice model, 
    258279so we overwrite the intrinsinc function with our own function simply performing :   \\ 
     
    269290 
    270291The numerical reproducibility of simulations on distributed memory parallel computers is a critical issue. 
    271 In particular, within NEMO global summation of distributed arrays is most susceptible to rounding errors, 
     292In particular, within \NEMO\ global summation of distributed arrays is most susceptible to rounding errors, 
    272293and their propagation and accumulation cause uncertainty in final simulation reproducibility on 
    273294different numbers of processors. 
    274 To avoid so, based on \citet{He_Ding_JSC01} review of different technics, 
     295To avoid so, based on \citet{he.ding_JS01} review of different technics, 
    275296we use a so called self-compensated summation method. 
    276 The idea is to estimate the roundoff error, store it in a buffer, and then add it back in the next addition.  
     297The idea is to estimate the roundoff error, store it in a buffer, and then add it back in the next addition. 
    277298 
    278299Suppose we need to calculate $b = a_1 + a_2 + a_3$. 
     
    292313The self-compensated summation method should be used in all summation in i- and/or j-direction. 
    293314See \mdl{closea} module for an example. 
    294 Note also that this implementation may be sensitive to the optimization level.  
     315Note also that this implementation may be sensitive to the optimization level. 
    295316 
    296317\subsection{MPP scalability} 
     
    314335This alternative method should give identical results to the default \textsc{ALLGATHER} method and 
    315336is recommended for large values of \np{jpni}. 
    316 The new method is activated by setting \np{ln\_nnogather} to be true ({\bf nammpp}). 
     337The new method is activated by setting \np{ln\_nnogather} to be true (\nam{mpp}). 
    317338The reproducibility of results using the two methods should be confirmed for each new, 
    318339non-reference configuration. 
     
    325346%--------------------------------------------namctl------------------------------------------------------- 
    326347 
    327 \nlst{namctl}  
     348\begin{listing} 
     349  \nlst{namctl} 
     350  \caption{\texttt{namctl}} 
     351  \label{lst:namctl} 
     352\end{listing} 
    328353%-------------------------------------------------------------------------------------------------------------- 
    329354 
    330 Options are defined through the  \ngn{namctl} namelist variables. 
     355Options are defined through the  \nam{ctl} namelist variables. 
    331356 
    332357\subsection{Vector optimisation} 
     
    335360This is very a very efficient way to increase the length of vector calculations and thus 
    336361to speed up the model on vector computers. 
    337   
     362 
    338363% Add here also one word on NPROMA technique that has been found useless, since compiler have made significant progress during the last decade. 
    339   
     364 
    340365% Add also one word on NEC specific optimisation (Novercheck option for example) 
    341   
     366 
    342367\subsection{Control print} 
    343368 
     
    386411at a suitably long interval. For example: 
    387412 
    388 \begin{verbatim}      
     413\begin{verbatim} 
    389414       sn_cfctl%ptimincr  = 25 
    390415\end{verbatim} 
    391416 
    392 will carry out the global communications and write the information every 25 timesteps. This  
     417will carry out the global communications and write the information every 25 timesteps. This 
    393418increment also applies to the time.step file which is otherwise updated every timestep. 
    394419 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_model_basics.tex

    r10544 r11564  
     1 
    12\documentclass[../main/NEMO_manual]{subfiles} 
    23 
     
    78% ================================================================ 
    89\chapter{Model Basics} 
    9 \label{chap:PE} 
    10 \minitoc 
     10\label{chap:MB} 
     11 
     12\chaptertoc 
    1113 
    1214\newpage 
     
    1618% ================================================================ 
    1719\section{Primitive equations} 
    18 \label{sec:PE_PE} 
    19  
    20 % ------------------------------------------------------------------------------------------------------------- 
    21 %        Vector Invariant Formulation  
     20\label{sec:MB_PE} 
     21 
     22% ------------------------------------------------------------------------------------------------------------- 
     23%        Vector Invariant Formulation 
    2224% ------------------------------------------------------------------------------------------------------------- 
    2325 
    2426\subsection{Vector invariant formulation} 
    25 \label{subsec:PE_Vector} 
     27\label{subsec:MB_PE_vector} 
    2628 
    2729The ocean is a fluid that can be described to a good approximation by the primitive equations, 
    28 \ie the Navier-Stokes equations along with a nonlinear equation of state which 
     30\ie\ the Navier-Stokes equations along with a nonlinear equation of state which 
    2931couples the two active tracers (temperature and salinity) to the fluid velocity, 
    3032plus the following additional assumptions made from scale considerations: 
     
    3234\begin{enumerate} 
    3335\item 
    34   \textit{spherical earth approximation}: the geopotential surfaces are assumed to be spheres so that 
    35   gravity (local vertical) is parallel to the earth's radius 
     36  \textit{spherical Earth approximation}: the geopotential surfaces are assumed to be oblate spheriods 
     37  that follow the Earth's bulge; these spheroids are approximated by spheres with 
     38  gravity locally vertical (parallel to the Earth's radius) and independent of latitude 
     39  \citep[][section 2]{white.hoskins.ea_QJRMS05}. 
    3640\item 
    3741  \textit{thin-shell approximation}: the ocean depth is neglected compared to the earth's radius 
     
    4448  the buoyancy force 
    4549  \begin{equation} 
    46     \label{eq:PE_eos} 
     50    \label{eq:MB_PE_eos} 
    4751    \rho = \rho \ (T,S,p) 
    4852  \end{equation} 
     
    5357  convective processes must be parameterized instead) 
    5458  \begin{equation} 
    55     \label{eq:PE_hydrostatic} 
     59    \label{eq:MB_PE_hydrostatic} 
    5660    \pd[p]{z} = - \rho \ g 
    5761  \end{equation} 
     
    6064  is assumed to be zero. 
    6165  \begin{equation} 
    62     \label{eq:PE_continuity} 
     66    \label{eq:MB_PE_continuity} 
    6367    \nabla \cdot \vect U = 0 
    6468  \end{equation} 
     69 \item 
     70  \textit{Neglect of additional Coriolis terms}: the Coriolis terms that vary with the cosine of latitude are neglected. 
     71  These terms may be non-negligible where the Brunt-Vaisala frequency $N$ is small, either in the deep ocean or 
     72  in the sub-mesoscale motions of the mixed layer, or near the equator \citep[][section 1]{white.hoskins.ea_QJRMS05}. 
     73  They can be consistently included as part of the ocean dynamics \citep[][section 3(d)]{white.hoskins.ea_QJRMS05} and are 
     74  retained in the MIT ocean model. 
    6575\end{enumerate} 
    6676 
    6777Because the gravitational force is so dominant in the equations of large-scale motions, 
    68 it is useful to choose an orthogonal set of unit vectors $(i,j,k)$ linked to the earth such that 
     78it is useful to choose an orthogonal set of unit vectors $(i,j,k)$ linked to the Earth such that 
    6979$k$ is the local upward vector and $(i,j)$ are two vectors orthogonal to $k$, 
    70 \ie tangent to the geopotential surfaces. 
     80\ie\ tangent to the geopotential surfaces. 
    7181Let us define the following variables: $\vect U$ the vector velocity, $\vect U = \vect U_h + w \, \vect k$ 
    72 (the subscript $h$ denotes the local horizontal vector, \ie over the $(i,j)$ plane),  
     82(the subscript $h$ denotes the local horizontal vector, \ie\ over the $(i,j)$ plane), 
    7383$T$ the potential temperature, $S$ the salinity, $\rho$ the \textit{in situ} density. 
    7484The vector invariant form of the primitive equations in the $(i,j,k)$ vector system provides 
    7585the following equations: 
    7686\begin{subequations} 
    77   \label{eq:PE} 
     87  \label{eq:MB_PE} 
    7888  \begin{gather} 
    7989    \intertext{$-$ the momentum balance} 
    80     \label{eq:PE_dyn} 
     90    \label{eq:MB_PE_dyn} 
    8191    \pd[\vect U_h]{t} = - \lt[ (\nabla \times \vect U) \times \vect U + \frac{1}{2} \nabla \lt( \vect U^2 \rt) \rt]_h 
    8292                        - f \; k \times \vect U_h - \frac{1}{\rho_o} \nabla_h p 
    8393                        + \vect D^{\vect U} + \vect F^{\vect U} \\ 
    8494    \intertext{$-$ the heat and salt conservation equations} 
    85     \label{eq:PE_tra_T} 
     95    \label{eq:MB_PE_tra_T} 
    8696    \pd[T]{t} = - \nabla \cdot (T \ \vect U) + D^T + F^T \\ 
    87     \label{eq:PE_tra_S} 
     97    \label{eq:MB_PE_tra_S} 
    8898    \pd[S]{t} = - \nabla \cdot (S \ \vect U) + D^S + F^S 
    8999  \end{gather} 
     
    91101where $\nabla$ is the generalised derivative vector operator in $(i,j,k)$ directions, $t$ is the time, 
    92102$z$ is the vertical coordinate, $\rho$ is the \textit{in situ} density given by the equation of state 
    93 (\autoref{eq:PE_eos}), $\rho_o$ is a reference density, $p$ the pressure, 
     103(\autoref{eq:MB_PE_eos}), $\rho_o$ is a reference density, $p$ the pressure, 
    94104$f = 2 \vect \Omega \cdot k$ is the Coriolis acceleration 
    95105(where $\vect \Omega$ is the Earth's angular velocity vector), and $g$ is the gravitational acceleration. 
    96106$\vect D^{\vect U}$, $D^T$ and $D^S$ are the parameterisations of small-scale physics for momentum, 
    97107temperature and salinity, and $\vect F^{\vect U}$, $F^T$ and $F^S$ surface forcing terms. 
    98 Their nature and formulation are discussed in \autoref{sec:PE_zdf_ldf} and \autoref{subsec:PE_boundary_condition}. 
     108Their nature and formulation are discussed in \autoref{sec:MB_zdf_ldf} and \autoref{subsec:MB_boundary_condition}. 
    99109 
    100110% ------------------------------------------------------------------------------------------------------------- 
     
    102112% ------------------------------------------------------------------------------------------------------------- 
    103113\subsection{Boundary conditions} 
    104 \label{subsec:PE_boundary_condition} 
     114\label{subsec:MB_boundary_condition} 
    105115 
    106116An ocean is bounded by complex coastlines, bottom topography at its base and 
    107117an air-sea or ice-sea interface at its top. 
    108118These boundaries can be defined by two surfaces, $z = - H(i,j)$ and $z = \eta(i,j,k,t)$, 
    109 where $H$ is the depth of the ocean bottom and $\eta$ is the height of the sea surface. 
    110 Both $H$ and $\eta$ are usually referenced to a given surface, $z = 0$, chosen as a mean sea surface 
    111 (\autoref{fig:ocean_bc}). 
     119where $H$ is the depth of the ocean bottom and $\eta$ is the height of the sea surface 
     120(discretisation can introduce additional artificial ``side-wall'' boundaries). 
     121Both $H$ and $\eta$ are referenced to a surface of constant geopotential (\ie\ a mean sea surface height) on which $z = 0$. 
     122(\autoref{fig:MB_ocean_bc}). 
    112123Through these two boundaries, the ocean can exchange fluxes of heat, fresh water, salt, and momentum with 
    113124the solid earth, the continental margins, the sea ice and the atmosphere. 
     
    119130%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    120131\begin{figure}[!ht] 
    121   \begin{center} 
    122     \includegraphics[]{Fig_I_ocean_bc} 
    123     \caption{ 
    124       \protect\label{fig:ocean_bc} 
    125       The ocean is bounded by two surfaces, $z = - H(i,j)$ and $z = \eta(i,j,t)$, 
    126       where $H$ is the depth of the sea floor and $\eta$ the height of the sea surface. 
    127       Both $H$ and $\eta$ are referenced to $z = 0$. 
    128     } 
    129   \end{center} 
     132  \centering 
     133  \includegraphics[width=\textwidth]{Fig_I_ocean_bc} 
     134  \caption[Ocean boundary conditions]{ 
     135    The ocean is bounded by two surfaces, $z = - H(i,j)$ and $z = \eta(i,j,t)$, 
     136    where $H$ is the depth of the sea floor and $\eta$ the height of the sea surface. 
     137    Both $H$ and $\eta$ are referenced to $z = 0$.} 
     138  \label{fig:MB_ocean_bc} 
    130139\end{figure} 
    131140%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    144153  \footnote{ 
    145154    In fact, it has been shown that the heat flux associated with the solid Earth cooling 
    146     (\ie the geothermal heating) is not negligible for the thermohaline circulation of the world ocean 
     155    (\ie\ the geothermal heating) is not negligible for the thermohaline circulation of the world ocean 
    147156    (see \autoref{subsec:TRA_bbc}). 
    148157  }. 
    149158  The boundary condition is thus set to no flux of heat and salt across solid boundaries. 
    150159  For momentum, the situation is different. There is no flow across solid boundaries, 
    151   \ie the velocity normal to the ocean bottom and coastlines is zero (in other words, 
     160  \ie\ the velocity normal to the ocean bottom and coastlines is zero (in other words, 
    152161  the bottom velocity is parallel to solid boundaries). This kinematic boundary condition 
    153162  can be expressed as: 
    154163  \begin{equation} 
    155     \label{eq:PE_w_bbc} 
     164    \label{eq:MB_w_bbc} 
    156165    w = - \vect U_h \cdot \nabla_h (H) 
    157166  \end{equation} 
     
    160169  It must be parameterized in terms of turbulent fluxes using bottom and/or lateral boundary conditions. 
    161170  Its specification depends on the nature of the physical parameterisation used for 
    162   $\vect D^{\vect U}$ in \autoref{eq:PE_dyn}. 
    163   It is discussed in \autoref{eq:PE_zdf}.% and Chap. III.6 to 9. 
     171  $\vect D^{\vect U}$ in \autoref{eq:MB_PE_dyn}. 
     172  It is discussed in \autoref{eq:MB_zdf}.% and Chap. III.6 to 9. 
    164173\item[Atmosphere - ocean interface:] 
    165174  the kinematic surface condition plus the mass flux of fresh water PE (the precipitation minus evaporation budget) 
    166175  leads to: 
    167176  \[ 
    168     % \label{eq:PE_w_sbc} 
     177    % \label{eq:MB_w_sbc} 
    169178    w = \pd[\eta]{t} + \lt. \vect U_h \rt|_{z = \eta} \cdot \nabla_h (\eta) + P - E 
    170179  \] 
     
    183192% ================================================================ 
    184193\section{Horizontal pressure gradient} 
    185 \label{sec:PE_hor_pg} 
     194\label{sec:MB_hor_pg} 
    186195 
    187196% ------------------------------------------------------------------------------------------------------------- 
     
    189198% ------------------------------------------------------------------------------------------------------------- 
    190199\subsection{Pressure formulation} 
    191 \label{subsec:PE_p_formulation} 
     200\label{subsec:MB_p_formulation} 
    192201 
    193202The total pressure at a given depth $z$ is composed of a surface pressure $p_s$ at 
    194203a reference geopotential surface ($z = 0$) and a hydrostatic pressure $p_h$ such that: 
    195204$p(i,j,k,t) = p_s(i,j,t) + p_h(i,j,k,t)$. 
    196 The latter is computed by integrating (\autoref{eq:PE_hydrostatic}), 
    197 assuming that pressure in decibars can be approximated by depth in meters in (\autoref{eq:PE_eos}). 
     205The latter is computed by integrating (\autoref{eq:MB_PE_hydrostatic}), 
     206assuming that pressure in decibars can be approximated by depth in meters in (\autoref{eq:MB_PE_eos}). 
    198207The hydrostatic pressure is then given by: 
    199208\[ 
    200   % \label{eq:PE_pressure} 
     209  % \label{eq:MB_pressure} 
    201210  p_h (i,j,z,t) = \int_{\varsigma = z}^{\varsigma = 0} g \; \rho (T,S,\varsigma) \; d \varsigma 
    202211\] 
     
    210219The flow is barotropic and the surface moves up and down with gravity as the restoring force. 
    211220The phase speed of such waves is high (some hundreds of metres per second) so that 
    212 the time step would have to be very short if they were present in the model. 
     221the time step has to be very short when they are present in the model. 
    213222The latter strategy filters out these waves since the rigid lid approximation implies $\eta = 0$, 
    214 \ie the sea surface is the surface $z = 0$. 
     223\ie\ the sea surface is the surface $z = 0$. 
    215224This well known approximation increases the surface wave speed to infinity and 
    216 modifies certain other longwave dynamics (\eg barotropic Rossby or planetary waves). 
     225modifies certain other longwave dynamics (\eg\ barotropic Rossby or planetary waves). 
    217226The rigid-lid hypothesis is an obsolescent feature in modern OGCMs. 
    218227It has been available until the release 3.1 of \NEMO, and it has been removed in release 3.2 and followings. 
    219 Only the free surface formulation is now described in the this document (see the next sub-section). 
     228Only the free surface formulation is now described in this document (see the next sub-section). 
    220229 
    221230% ------------------------------------------------------------------------------------------------------------- 
     
    223232% ------------------------------------------------------------------------------------------------------------- 
    224233\subsection{Free surface formulation} 
    225 \label{subsec:PE_free_surface} 
     234\label{subsec:MB_free_surface} 
    226235 
    227236In the free surface formulation, a variable $\eta$, the sea-surface height, 
    228237is introduced which describes the shape of the air-sea interface. 
    229238This variable is solution of a prognostic equation which is established by forming the vertical average of 
    230 the kinematic surface condition (\autoref{eq:PE_w_bbc}): 
     239the kinematic surface condition (\autoref{eq:MB_w_bbc}): 
    231240\begin{equation} 
    232   \label{eq:PE_ssh} 
     241  \label{eq:MB_ssh} 
    233242  \pd[\eta]{t} = - D + P - E \quad \text{where} \quad D = \nabla \cdot \lt[ (H + \eta) \; \overline{U}_h \, \rt] 
    234243\end{equation} 
    235 and using (\autoref{eq:PE_hydrostatic}) the surface pressure is given by: $p_s = \rho \, g \, \eta$. 
     244and using (\autoref{eq:MB_PE_hydrostatic}) the surface pressure is given by: $p_s = \rho \, g \, \eta$. 
    236245 
    237246Allowing the air-sea interface to move introduces the external gravity waves (EGWs) as 
    238247a class of solution of the primitive equations. 
    239 These waves are barotropic because of hydrostatic assumption, and their phase speed is quite high. 
     248These waves are barotropic (\ie\ nearly independent of depth) and their phase speed is quite high. 
    240249Their time scale is short with respect to the other processes described by the primitive equations. 
    241250 
     
    246255the baroclinic structure of the ocean (internal waves) possibly in shallow seas, 
    247256then a non linear free surface is the most appropriate. 
    248 This means that no approximation is made in \autoref{eq:PE_ssh} and that 
     257This means that no approximation is made in \autoref{eq:MB_ssh} and that 
    249258the variation of the ocean volume is fully taken into account. 
    250259Note that in order to study the fast time scales associated with EGWs it is necessary to 
     
    257266not altering the slow barotropic Rossby waves. 
    258267If further, an approximative conservation of heat and salt contents is sufficient for the problem solved, 
    259 then it is sufficient to solve a linearized version of \autoref{eq:PE_ssh}, 
    260 which still allows to take into account freshwater fluxes applied at the ocean surface \citep{Roullet_Madec_JGR00}. 
     268then it is sufficient to solve a linearized version of \autoref{eq:MB_ssh}, 
     269which still allows to take into account freshwater fluxes applied at the ocean surface \citep{roullet.madec_JGR00}. 
    261270Nevertheless, with the linearization, an exact conservation of heat and salt contents is lost. 
    262271 
    263272The filtering of EGWs in models with a free surface is usually a matter of discretisation of 
    264273the temporal derivatives, 
    265 using a split-explicit method \citep{Killworth_al_JPO91, Zhang_Endoh_JGR92} or 
    266 the implicit scheme \citep{Dukowicz1994} or 
    267 the addition of a filtering force in the momentum equation \citep{Roullet_Madec_JGR00}. 
    268 With the present release, \NEMO offers the choice between 
     274using a split-explicit method \citep{killworth.webb.ea_JPO91, zhang.endoh_JGR92} or 
     275the implicit scheme \citep{dukowicz.smith_JGR94} or 
     276the addition of a filtering force in the momentum equation \citep{roullet.madec_JGR00}. 
     277With the present release, \NEMO\ offers the choice between 
    269278an explicit free surface (see \autoref{subsec:DYN_spg_exp}) or 
    270 a split-explicit scheme strongly inspired the one proposed by \citet{Shchepetkin_McWilliams_OM05} 
     279a split-explicit scheme strongly inspired the one proposed by \citet{shchepetkin.mcwilliams_OM05} 
    271280(see \autoref{subsec:DYN_spg_ts}). 
    272281 
     
    275284% ================================================================ 
    276285\section{Curvilinear \textit{z-}coordinate system} 
    277 \label{sec:PE_zco} 
     286\label{sec:MB_zco} 
    278287 
    279288% ------------------------------------------------------------------------------------------------------------- 
     
    281290% ------------------------------------------------------------------------------------------------------------- 
    282291\subsection{Tensorial formalism} 
    283 \label{subsec:PE_tensorial} 
     292\label{subsec:MB_tensorial} 
    284293 
    285294In many ocean circulation problems, the flow field has regions of enhanced dynamics 
    286 (\ie surface layers, western boundary currents, equatorial currents, or ocean fronts). 
     295(\ie\ surface layers, western boundary currents, equatorial currents, or ocean fronts). 
    287296The representation of such dynamical processes can be improved by 
    288297specifically increasing the model resolution in these regions. 
     
    292301cannot be easily treated in a global model without filtering. 
    293302A solution consists of introducing an appropriate coordinate transformation that 
    294 shifts the singular point onto land \citep{Madec_Imbard_CD96, Murray_JCP96}. 
     303shifts the singular point onto land \citep{madec.imbard_CD96, murray_JCP96}. 
    295304As a consequence, it is important to solve the primitive equations in various curvilinear coordinate systems. 
    296305An efficient way of introducing an appropriate coordinate transform can be found when using a tensorial formalism. 
     
    298307Ocean modellers mainly use three-dimensional orthogonal grids on the sphere (spherical earth approximation), 
    299308with preservation of the local vertical. Here we give the simplified equations for this particular case. 
    300 The general case is detailed by \citet{Eiseman1980} in their survey of the conservation laws of fluid dynamics. 
     309The general case is detailed by \citet{eiseman.stone_SR80} in their survey of the conservation laws of fluid dynamics. 
    301310 
    302311Let $(i,j,k)$ be a set of orthogonal curvilinear coordinates on 
     
    304313$(i,j,k)$ linked to the earth such that 
    305314$k$ is the local upward vector and $(i,j)$ are two vectors orthogonal to $k$, 
    306 \ie along geopotential surfaces (\autoref{fig:referential}). 
     315\ie\ along geopotential surfaces (\autoref{fig:MB_referential}). 
    307316Let $(\lambda,\varphi,z)$ be the geographical coordinate system in which a position is defined by 
    308317the latitude $\varphi(i,j)$, the longitude $\lambda(i,j)$ and 
    309318the distance from the centre of the earth $a + z(k)$ where $a$ is the earth's radius and 
    310 $z$ the altitude above a reference sea level (\autoref{fig:referential}). 
     319$z$ the altitude above a reference sea level (\autoref{fig:MB_referential}). 
    311320The local deformation of the curvilinear coordinate system is given by $e_1$, $e_2$ and $e_3$, 
    312321the three scale factors: 
    313322\begin{equation} 
    314   \label{eq:scale_factors} 
     323  \label{eq:MB_scale_factors} 
    315324  \begin{aligned} 
    316325    e_1 &= (a + z) \lt[ \lt( \pd[\lambda]{i} \cos \varphi \rt)^2 + \lt( \pd[\varphi]{i} \rt)^2 \rt]^{1/2} \\ 
     
    322331% >>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    323332\begin{figure}[!tb] 
    324   \begin{center} 
    325     \includegraphics[]{Fig_I_earth_referential} 
    326     \caption{ 
    327       \protect\label{fig:referential} 
    328       the geographical coordinate system $(\lambda,\varphi,z)$ and the curvilinear 
    329       coordinate system $(i,j,k)$. 
    330     } 
    331   \end{center} 
     333  \centering 
     334  \includegraphics[width=\textwidth]{Fig_I_earth_referential} 
     335  \caption[Geographical and curvilinear coordinate systems]{ 
     336    the geographical coordinate system $(\lambda,\varphi,z)$ and the curvilinear 
     337    coordinate system $(i,j,k)$.} 
     338  \label{fig:MB_referential} 
    332339\end{figure} 
    333340%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    334341 
    335342Since the ocean depth is far smaller than the earth's radius, $a + z$, can be replaced by $a$ in 
    336 (\autoref{eq:scale_factors}) (thin-shell approximation). 
     343(\autoref{eq:MB_scale_factors}) (thin-shell approximation). 
    337344The resulting horizontal scale factors $e_1$, $e_2$  are independent of $k$ while 
    338345the vertical scale factor is a single function of $k$ as $k$ is parallel to $z$. 
    339346The scalar and vector operators that appear in the primitive equations 
    340 (\autoref{eq:PE_dyn} to \autoref{eq:PE_eos}) can be written in the tensorial form, 
     347(\autoref{eq:MB_PE_dyn} to \autoref{eq:MB_PE_eos}) can then be written in the tensorial form, 
    341348invariant in any orthogonal horizontal curvilinear coordinate system transformation: 
    342349\begin{subequations} 
    343   % \label{eq:PE_discrete_operators} 
     350  % \label{eq:MB_discrete_operators} 
    344351  \begin{gather} 
    345     \label{eq:PE_grad} 
     352    \label{eq:MB_grad} 
    346353    \nabla q =   \frac{1}{e_1} \pd[q]{i} \; \vect i 
    347354               + \frac{1}{e_2} \pd[q]{j} \; \vect j 
    348355               + \frac{1}{e_3} \pd[q]{k} \; \vect k \\ 
    349     \label{eq:PE_div} 
     356    \label{eq:MB_div} 
    350357    \nabla \cdot \vect A =   \frac{1}{e_1 \; e_2} \lt[ \pd[(e_2 \; a_1)]{\partial i} + \pd[(e_1 \; a_2)]{j} \rt] 
    351358                           + \frac{1}{e_3} \lt[ \pd[a_3]{k} \rt] 
    352359  \end{gather} 
    353360  \begin{multline} 
    354     \label{eq:PE_curl} 
     361    \label{eq:MB_curl} 
    355362      \nabla \times \vect{A} =   \lt[ \frac{1}{e_2} \pd[a_3]{j} - \frac{1}{e_3} \pd[a_2]{k}   \rt] \vect i \\ 
    356363                               + \lt[ \frac{1}{e_3} \pd[a_1]{k} - \frac{1}{e_1} \pd[a_3]{i}   \rt] \vect j \\ 
     
    358365  \end{multline} 
    359366  \begin{gather} 
    360     \label{eq:PE_lap} 
     367    \label{eq:MB_lap} 
    361368    \Delta q = \nabla \cdot (\nabla q) \\ 
    362     \label{eq:PE_lap_vector} 
     369    \label{eq:MB_lap_vector} 
    363370    \Delta \vect A = \nabla (\nabla \cdot \vect A) - \nabla \times (\nabla \times \vect A) 
    364371  \end{gather} 
     
    370377% ------------------------------------------------------------------------------------------------------------- 
    371378\subsection{Continuous model equations} 
    372 \label{subsec:PE_zco_Eq} 
     379\label{subsec:MB_zco_Eq} 
    373380 
    374381In order to express the Primitive Equations in tensorial formalism, 
    375382it is necessary to compute the horizontal component of the non-linear and viscous terms of the equation using 
    376 \autoref{eq:PE_grad}) to \autoref{eq:PE_lap_vector}. 
     383\autoref{eq:MB_grad}) to \autoref{eq:MB_lap_vector}. 
    377384Let us set $\vect U = (u,v,w) = \vect U_h + w \; \vect k $, the velocity in the $(i,j,k)$ coordinates system and 
    378385define the relative vorticity $\zeta$ and the divergence of the horizontal velocity field $\chi$, by: 
    379386\begin{gather} 
    380   \label{eq:PE_curl_Uh} 
     387  \label{eq:MB_curl_Uh} 
    381388  \zeta = \frac{1}{e_1 e_2} \lt[ \pd[(e_2 \, v)]{i} - \pd[(e_1 \, u)]{j} \rt] \\ 
    382   \label{eq:PE_div_Uh} 
     389  \label{eq:MB_div_Uh} 
    383390  \chi  = \frac{1}{e_1 e_2} \lt[ \pd[(e_2 \, u)]{i} + \pd[(e_1 \, v)]{j} \rt] 
    384391\end{gather} 
    385392 
    386 Using the fact that the horizontal scale factors $e_1$ and $e_2$ are independent of $k$ and that 
     393Using again the fact that the horizontal scale factors $e_1$ and $e_2$ are independent of $k$ and that 
    387394$e_3$  is a function of the single variable $k$, 
    388 $NLT$ the nonlinear term of \autoref{eq:PE_dyn} can be transformed as follows: 
     395$NLT$ the nonlinear term of \autoref{eq:MB_PE_dyn} can be transformed as follows: 
    389396\begin{alignat*}{2} 
    390397  &NLT &=   &\lt[ (\nabla \times {\vect U}) \times {\vect U} + \frac{1}{2} \nabla \lt( {\vect U}^2 \rt) \rt]_h \\ 
     
    427434\end{alignat*} 
    428435The last term of the right hand side is obviously zero, and thus the nonlinear term of 
    429 \autoref{eq:PE_dyn} is written in the $(i,j,k)$ coordinate system: 
     436\autoref{eq:MB_PE_dyn} is written in the $(i,j,k)$ coordinate system: 
    430437\begin{equation} 
    431   \label{eq:PE_vector_form} 
     438  \label{eq:MB_vector_form} 
    432439  NLT =   \zeta \; \vect k \times \vect U_h + \frac{1}{2} \nabla_h \lt( \vect U_h^2 \rt) 
    433440        + \frac{1}{e_3} w \pd[\vect U_h]{k} 
     
    436443This is the so-called \textit{vector invariant form} of the momentum advection term. 
    437444For some purposes, it can be advantageous to write this term in the so-called flux form, 
    438 \ie to write it as the divergence of fluxes. 
    439 For example, the first component of \autoref{eq:PE_vector_form} (the $i$-component) is transformed as follows: 
     445\ie\ to write it as the divergence of fluxes. 
     446For example, the first component of \autoref{eq:MB_vector_form} (the $i$-component) is transformed as follows: 
    440447\begin{alignat*}{2} 
    441448  &NLT_i &= &- \zeta \; v + \frac{1}{2 \; e_1} \pd[ (u^2 + v^2) ]{i} + \frac{1}{e_3} w \ \pd[u]{k} \\ 
     
    456463  &      &= &\nabla \cdot (\vect U \, u) - (\nabla \cdot \vect U) \ u 
    457464            + \frac{1}{e_1 e_2} \lt( -v^2 \pd[e_2]{i} + u v \, \pd[e_1]{j} \rt) \\ 
    458   \intertext{as $\nabla \cdot {\vect U} \; = 0$ (incompressibility) it comes:} 
     465  \intertext{as $\nabla \cdot {\vect U} \; = 0$ (incompressibility) it becomes:} 
    459466  &      &= &\, \nabla \cdot (\vect U \, u) + \frac{1}{e_1 e_2} \lt( v \; \pd[e_2]{i} - u \; \pd[e_1]{j} \rt) (-v) 
    460467\end{alignat*} 
     
    462469The flux form of the momentum advection term is therefore given by: 
    463470\begin{equation} 
    464   \label{eq:PE_flux_form} 
     471  \label{eq:MB_flux_form} 
    465472  NLT =   \nabla \cdot \lt( 
    466473    \begin{array}{*{20}c} 
     
    475482the first one is expressed as the divergence of momentum fluxes (hence the flux form name given to this formulation) 
    476483and the second one is due to the curvilinear nature of the coordinate system used. 
    477 The latter is called the \textit{metric} term and can be viewed as a modification of the Coriolis parameter:  
     484The latter is called the \textit{metric} term and can be viewed as a modification of the Coriolis parameter: 
    478485\[ 
    479   % \label{eq:PE_cor+metric} 
     486  % \label{eq:MB_cor+metric} 
    480487  f \to f + \frac{1}{e_1 e_2} \lt( v \pd[e_2]{i} - u \pd[e_1]{j} \rt) 
    481488\] 
    482489 
    483490Note that in the case of geographical coordinate, 
    484 \ie when $(i,j) \to (\lambda,\varphi)$ and $(e_1,e_2) \to (a \, \cos \varphi,a)$, 
     491\ie\ when $(i,j) \to (\lambda,\varphi)$ and $(e_1,e_2) \to (a \, \cos \varphi,a)$, 
    485492we recover the commonly used modification of the Coriolis parameter $f \to f + (u / a) \tan \varphi$. 
    486493 
     
    492499  \textbf{Vector invariant form of the momentum equations}: 
    493500  \begin{equation} 
    494     \label{eq:PE_dyn_vect} 
     501    \label{eq:MB_dyn_vect} 
    495502    \begin{split} 
    496     % \label{eq:PE_dyn_vect_u} 
     503    % \label{eq:MB_dyn_vect_u} 
    497504      \pd[u]{t} = &+ (\zeta + f) \, v - \frac{1}{2 e_1} \pd[]{i} (u^2 + v^2) 
    498505                   - \frac{1}{e_3} w \pd[u]{k} - \frac{1}{e_1} \pd[]{i} \lt( \frac{p_s + p_h}{\rho_o} \rt) \\ 
    499506                  &+ D_u^{\vect U} + F_u^{\vect U} \\ 
    500507      \pd[v]{t} = &- (\zeta + f) \, u - \frac{1}{2 e_2} \pd[]{j} (u^2 + v^2) 
    501                    - \frac{1}{e_3} w \pd[v]{k} - \frac{1}{e_2} \pd[]{j} \lt( \frac{p_s + p_h}{\rho_o} \rt) \\  
     508                   - \frac{1}{e_3} w \pd[v]{k} - \frac{1}{e_2} \pd[]{j} \lt( \frac{p_s + p_h}{\rho_o} \rt) \\ 
    502509                  &+ D_v^{\vect U} + F_v^{\vect U} 
    503510    \end{split} 
     
    505512\item 
    506513  \textbf{flux form of the momentum equations}: 
    507   % \label{eq:PE_dyn_flux} 
     514  % \label{eq:MB_dyn_flux} 
    508515  \begin{multline*} 
    509     % \label{eq:PE_dyn_flux_u} 
     516    % \label{eq:MB_dyn_flux_u} 
    510517    \pd[u]{t} = + \lt[ f + \frac{1}{e_1 \; e_2} \lt( v \pd[e_2]{i} - u \pd[e_1]{j} \rt) \rt] \, v \\ 
    511518                - \frac{1}{e_1 \; e_2} \lt( \pd[(e_2 \, u \, u)]{i} + \pd[(e_1 \, v \, u)]{j} \rt) \\ 
     
    514521  \end{multline*} 
    515522  \begin{multline*} 
    516     % \label{eq:PE_dyn_flux_v} 
     523    % \label{eq:MB_dyn_flux_v} 
    517524    \pd[v]{t} = - \lt[ f + \frac{1}{e_1 \; e_2} \lt( v \pd[e_2]{i} - u \pd[e_1]{j} \rt) \rt] \, u \\ 
    518                 + \frac{1}{e_1 \; e_2} \lt( \pd[(e_2 \, u \, v)]{i} + \pd[(e_1 \, v \, v)]{j} \rt) \\ 
     525                - \frac{1}{e_1 \; e_2} \lt( \pd[(e_2 \, u \, v)]{i} + \pd[(e_1 \, v \, v)]{j} \rt) \\ 
    519526                - \frac{1}{e_3} \pd[(w \, v)]{k} - \frac{1}{e_2} \pd[]{j} \lt( \frac{p_s + p_h}{\rho_o} \rt) 
    520527                + D_v^{\vect U} + F_v^{\vect U} 
    521528  \end{multline*} 
    522   where $\zeta$, the relative vorticity, is given by \autoref{eq:PE_curl_Uh} and $p_s$, the surface pressure, 
     529  where $\zeta$, the relative vorticity, is given by \autoref{eq:MB_curl_Uh} and $p_s$, the surface pressure, 
    523530  is given by: 
    524531  \[ 
    525   % \label{eq:PE_spg} 
     532  % \label{eq:MB_spg} 
    526533    p_s = \rho \,g \, \eta 
    527534  \] 
    528   with $\eta$ is solution of \autoref{eq:PE_ssh}. 
     535  and $\eta$ is the solution of \autoref{eq:MB_ssh}. 
    529536 
    530537  The vertical velocity and the hydrostatic pressure are diagnosed from the following equations: 
    531538  \[ 
    532   % \label{eq:w_diag} 
    533     \pd[w]{k} = - \chi \; e_3 \qquad  
    534   % \label{eq:hp_diag} 
     539  % \label{eq:MB_w_diag} 
     540    \pd[w]{k} = - \chi \; e_3 \qquad 
     541  % \label{eq:MB_hp_diag} 
    535542    \pd[p_h]{k} = - \rho \; g \; e_3 
    536543  \] 
    537   where the divergence of the horizontal velocity, $\chi$ is given by \autoref{eq:PE_div_Uh}. 
    538 \item \textit{tracer equations}: 
    539   \[ 
    540     %\label{eq:S} 
    541     \pd[T]{t} = - \frac{1}{e_1 e_2} \lt[ \pd[(e_2 T \, u)]{i} + \pd[(e_1 T \, v)]{j} \rt] 
     544  where the divergence of the horizontal velocity, $\chi$ is given by \autoref{eq:MB_div_Uh}. 
     545 
     546\item 
     547  \textbf{tracer equations}: 
     548  \begin{equation} 
     549  \begin{split} 
     550    \pd[T]{t} = & - \frac{1}{e_1 e_2} \lt[ \pd[(e_2 T \, u)]{i} + \pd[(e_1 T \, v)]{j} \rt] 
    542551                - \frac{1}{e_3} \pd[(T \, w)]{k} + D^T + F^T \\ 
    543     %\label{eq:T} 
    544     \pd[S]{t} = - \frac{1}{e_1 e_2} \lt[ \pd[(e_2 S \, u)]{i} + \pd[(e_1 S \, v)]{j} \rt] 
    545                 - \frac{1}{e_3} \pd[(S \, w)]{k} + D^S + F^S 
    546     %\label{eq:rho} 
    547     \rho = \rho \big( T,S,z(k) \big) 
    548   \] 
     552    \pd[S]{t} = & - \frac{1}{e_1 e_2} \lt[ \pd[(e_2 S \, u)]{i} + \pd[(e_1 S \, v)]{j} \rt] 
     553                - \frac{1}{e_3} \pd[(S \, w)]{k} + D^S + F^S \\ 
     554    \rho = & \rho \big( T,S,z(k) \big) 
     555  \end{split} 
     556  \end{equation} 
    549557\end{itemize} 
    550558 
    551559The expression of $\vect D^{U}$, $D^{S}$ and $D^{T}$ depends on the subgrid scale parameterisation used. 
    552 It will be defined in \autoref{eq:PE_zdf}. 
     560It will be defined in \autoref{eq:MB_zdf}. 
    553561The nature and formulation of $\vect F^{\vect U}$, $F^T$ and $F^S$, the surface forcing terms, 
    554562are discussed in \autoref{chap:SBC}. 
     
    560568% ================================================================ 
    561569\section{Curvilinear generalised vertical coordinate system} 
    562 \label{sec:PE_gco} 
     570\label{sec:MB_gco} 
    563571 
    564572The ocean domain presents a huge diversity of situation in the vertical. 
     
    569577Therefore, in order to represent the ocean with respect to 
    570578the first point a space and time dependent vertical coordinate that follows the variation of the sea surface height 
    571 \eg an \zstar-coordinate; 
     579\eg\ an \zstar-coordinate; 
    572580for the second point, a space variation to fit the change of bottom topography 
    573 \eg a terrain-following or $\sigma$-coordinate; 
     581\eg\ a terrain-following or $\sigma$-coordinate; 
    574582and for the third point, one will be tempted to use a space and time dependent coordinate that 
    575 follows the isopycnal surfaces, \eg an isopycnic coordinate. 
    576  
    577 In order to satisfy two or more constrains one can even be tempted to mixed these coordinate systems, as in 
     583follows the isopycnal surfaces, \eg\ an isopycnic coordinate. 
     584 
     585In order to satisfy two or more constraints one can even be tempted to mixed these coordinate systems, as in 
    578586HYCOM (mixture of $z$-coordinate at the surface, isopycnic coordinate in the ocean interior and $\sigma$ at 
    579 the ocean bottom) \citep{Chassignet_al_JPO03} or 
     587the ocean bottom) \citep{chassignet.smith.ea_JPO03} or 
    580588OPA (mixture of $z$-coordinate in vicinity the surface and steep topography areas and $\sigma$-coordinate elsewhere) 
    581 \citep{Madec_al_JPO96} among others. 
     589\citep{madec.delecluse.ea_JPO96} among others. 
    582590 
    583591In fact one is totally free to choose any space and time vertical coordinate by 
    584592introducing an arbitrary vertical coordinate : 
    585593\begin{equation} 
    586   \label{eq:PE_s} 
     594  \label{eq:MB_s} 
    587595  s = s(i,j,k,t) 
    588596\end{equation} 
    589597with the restriction that the above equation gives a single-valued monotonic relationship between $s$ and $k$, 
    590598when $i$, $j$ and $t$ are held fixed. 
    591 \autoref{eq:PE_s} is a transformation from the $(i,j,k,t)$ coordinate system with independent variables into 
     599\autoref{eq:MB_s} is a transformation from the $(i,j,k,t)$ coordinate system with independent variables into 
    592600the $(i,j,s,t)$ generalised coordinate system with $s$ depending on the other three variables through 
    593 \autoref{eq:PE_s}. 
    594 This so-called \textit{generalised vertical coordinate} \citep{Kasahara_MWR74} is in fact 
     601\autoref{eq:MB_s}. 
     602This so-called \textit{generalised vertical coordinate} \citep{kasahara_MWR74} is in fact 
    595603an Arbitrary Lagrangian--Eulerian (ALE) coordinate. 
    596 Indeed, choosing an expression for $s$ is an arbitrary choice that determines 
     604Indeed, one has a great deal of freedom in the choice of expression for $s$. The choice determines 
    597605which part of the vertical velocity (defined from a fixed referential) will cross the levels (Eulerian part) and 
    598606which part will be used to move them (Lagrangian part). 
    599 The coordinate is also sometime referenced as an adaptive coordinate \citep{Hofmeister_al_OM09}, 
     607The coordinate is also sometime referenced as an adaptive coordinate \citep{hofmeister.burchard.ea_OM10}, 
    600608since the coordinate system is adapted in the course of the simulation. 
    601609Its most often used implementation is via an ALE algorithm, 
    602610in which a pure lagrangian step is followed by regridding and remapping steps, 
    603 the later step implicitly embedding the vertical advection 
    604 \citep{Hirt_al_JCP74, Chassignet_al_JPO03, White_al_JCP09}. 
    605 Here we follow the \citep{Kasahara_MWR74} strategy: 
    606 a regridding step (an update of the vertical coordinate) followed by an eulerian step with 
     611the latter step implicitly embedding the vertical advection 
     612\citep{hirt.amsden.ea_JCP74, chassignet.smith.ea_JPO03, white.adcroft.ea_JCP09}. 
     613Here we follow the \citep{kasahara_MWR74} strategy: 
     614a regridding step (an update of the vertical coordinate) followed by an Eulerian step with 
    607615an explicit computation of vertical advection relative to the moving s-surfaces. 
    608616 
    609617%\gmcomment{ 
    610618%A key point here is that the $s$-coordinate depends on $(i,j)$ ==> horizontal pressure gradient... 
    611 the generalized vertical coordinates used in ocean modelling are not orthogonal, 
     619The generalized vertical coordinates used in ocean modelling are not orthogonal, 
    612620which contrasts with many other applications in mathematical physics. 
    613621Hence, it is useful to keep in mind the following properties that may seem odd on initial encounter. 
     
    615623The horizontal velocity in ocean models measures motions in the horizontal plane, 
    616624perpendicular to the local gravitational field. 
    617 That is, horizontal velocity is mathematically the same regardless the vertical coordinate, be it geopotential, 
     625That is, horizontal velocity is mathematically the same regardless of the vertical coordinate, be it geopotential, 
    618626isopycnal, pressure, or terrain following. 
    619627The key motivation for maintaining the same horizontal velocity component is that 
     
    644652\subsection{\textit{S}-coordinate formulation} 
    645653 
    646 Starting from the set of equations established in \autoref{sec:PE_zco} for the special case $k = z$ and 
     654Starting from the set of equations established in \autoref{sec:MB_zco} for the special case $k = z$ and 
    647655thus $e_3 = 1$, we introduce an arbitrary vertical coordinate $s = s(i,j,k,t)$, 
    648656which includes $z$-, \zstar- and $\sigma$-coordinates as special cases 
    649657($s = z$, $s = \zstar$, and $s = \sigma = z / H$ or $ = z / \lt( H + \eta \rt)$, resp.). 
    650 A formal derivation of the transformed equations is given in \autoref{apdx:A}. 
     658A formal derivation of the transformed equations is given in \autoref{apdx:SCOORD}. 
    651659Let us define the vertical scale factor by $e_3 = \partial_s z$  ($e_3$ is now a function of $(i,j,k,t)$ ), 
    652660and the slopes in the $(i,j)$ directions between $s$- and $z$-surfaces by: 
    653661\begin{equation} 
    654   \label{eq:PE_sco_slope} 
     662  \label{eq:MB_sco_slope} 
    655663  \sigma_1 = \frac{1}{e_1} \; \lt. \pd[z]{i} \rt|_s \quad \text{and} \quad 
    656664  \sigma_2 = \frac{1}{e_2} \; \lt. \pd[z]{j} \rt|_s 
    657665\end{equation} 
    658 We also introduce $\omega$, a dia-surface velocity component, defined as the velocity  
     666We also introduce $\omega$, a dia-surface velocity component, defined as the velocity 
    659667relative to the moving $s$-surfaces and normal to them: 
    660668\[ 
    661   % \label{eq:PE_sco_w} 
    662   \omega = w - e_3 \, \pd[s]{t} - \sigma_1 \, u - \sigma_2 \, v 
     669  % \label{eq:MB_sco_w} 
     670  \omega = w -  \, \lt. \pd[z]{t} \rt|_s - \sigma_1 \, u - \sigma_2 \, v 
    663671\] 
    664672 
    665 The equations solved by the ocean model \autoref{eq:PE} in $s$-coordinate can be written as follows 
    666 (see \autoref{sec:A_momentum}): 
     673The equations solved by the ocean model \autoref{eq:MB_PE} in $s$-coordinate can be written as follows 
     674(see \autoref{sec:SCOORD_momentum}): 
    667675 
    668676\begin{itemize} 
    669677\item \textbf{Vector invariant form of the momentum equation}: 
    670678  \begin{multline*} 
    671   % \label{eq:PE_sco_u_vector} 
     679  % \label{eq:MB_sco_u_vector} 
    672680    \pd[u]{t} = + (\zeta + f) \, v - \frac{1}{2 \, e_1} \pd[]{i} (u^2 + v^2) - \frac{1}{e_3} \omega \pd[u]{k} \\ 
    673                 - \frac{1}{e_1} \pd[]{i} \lt( \frac{p_s + p_h}{\rho_o} \rt) + g \frac{\rho}{\rho_o} \sigma_1 
     681                - \frac{1}{e_1} \pd[]{i} \lt( \frac{p_s + p_h}{\rho_o} \rt) - g \frac{\rho}{\rho_o} \sigma_1 
    674682                + D_u^{\vect U} + F_u^{\vect U} 
    675683  \end{multline*} 
    676684  \begin{multline*} 
    677   % \label{eq:PE_sco_v_vector} 
     685  % \label{eq:MB_sco_v_vector} 
    678686    \pd[v]{t} = - (\zeta + f) \, u - \frac{1}{2 \, e_2} \pd[]{j}(u^2 + v^2) - \frac{1}{e_3} \omega \pd[v]{k} \\ 
    679                 - \frac{1}{e_2} \pd[]{j} \lt( \frac{p_s + p_h}{\rho_o} \rt) + g \frac{\rho}{\rho_o} \sigma_2 
     687                - \frac{1}{e_2} \pd[]{j} \lt( \frac{p_s + p_h}{\rho_o} \rt) - g \frac{\rho}{\rho_o} \sigma_2 
    680688                + D_v^{\vect U} + F_v^{\vect U} 
    681689  \end{multline*} 
    682690\item \textbf{Flux form of the momentum equation}: 
    683691  \begin{multline*} 
    684   % \label{eq:PE_sco_u_flux} 
     692  % \label{eq:MB_sco_u_flux} 
    685693    \frac{1}{e_3} \pd[(e_3 \, u)]{t} = + \lt[ f + \frac{1}{e_1 \; e_2} \lt( v \pd[e_2]{i} - u \pd[e_1]{j} \rt) \rt] \, v \\ 
    686694                                       - \frac{1}{e_1 \; e_2 \; e_3} \lt( \pd[(e_2 \, e_3 \, u \, u)]{i} + \pd[(e_1 \, e_3 \, v \, u)]{j} \rt) \\ 
    687695                                       - \frac{1}{e_3} \pd[(\omega \, u)]{k} 
    688696                                       - \frac{1}{e_1} \pd[]{i} \lt( \frac{p_s + p_h}{\rho_o} \rt) 
    689                                        + g \frac{\rho}{\rho_o} \sigma_1 + D_u^{\vect U} + F_u^{\vect U} 
     697                                       - g \frac{\rho}{\rho_o} \sigma_1 + D_u^{\vect U} + F_u^{\vect U} 
    690698  \end{multline*} 
    691699  \begin{multline*} 
    692   % \label{eq:PE_sco_v_flux} 
     700  % \label{eq:MB_sco_v_flux} 
    693701    \frac{1}{e_3} \pd[(e_3 \, v)]{t} = - \lt[ f + \frac{1}{e_1 \; e_2} \lt( v \pd[e_2]{i} - u \pd[e_1]{j} \rt) \rt] \, u \\ 
    694702                                       - \frac{1}{e_1 \; e_2 \; e_3} \lt( \pd[( e_2 \; e_3 \, u \, v)]{i} + \pd[(e_1 \; e_3 \, v \, v)]{j} \rt) \\ 
    695703                                       - \frac{1}{e_3} \pd[(\omega \, v)]{k} 
    696704                                       - \frac{1}{e_2} \pd[]{j} \lt( \frac{p_s + p_h}{\rho_o} \rt) 
    697                                        + g \frac{\rho}{\rho_o}\sigma_2 + D_v^{\vect U} + F_v^{\vect U} 
     705                                       - g \frac{\rho}{\rho_o}\sigma_2 + D_v^{\vect U} + F_v^{\vect U} 
    698706  \end{multline*} 
    699707  where the relative vorticity, $\zeta$, the surface pressure gradient, 
    700708  and the hydrostatic pressure have the same expressions as in $z$-coordinates although 
    701709  they do not represent exactly the same quantities. 
    702   $\omega$ is provided by the continuity equation (see \autoref{apdx:A}): 
     710  $\omega$ is provided by the continuity equation (see \autoref{apdx:SCOORD}): 
    703711  \[ 
    704   % \label{eq:PE_sco_continuity} 
     712  % \label{eq:MB_sco_continuity} 
    705713    \pd[e_3]{t} + e_3 \; \chi + \pd[\omega]{s} = 0 \quad \text{with} \quad 
    706714    \chi = \frac{1}{e_1 e_2 e_3} \lt( \pd[(e_2 e_3 \, u)]{i} + \pd[(e_1 e_3 \, v)]{j} \rt) 
     
    708716\item \textit{tracer equations}: 
    709717  \begin{multline*} 
    710   % \label{eq:PE_sco_t} 
     718  % \label{eq:MB_sco_t} 
    711719    \frac{1}{e_3} \pd[(e_3 \, T)]{t} = - \frac{1}{e_1 e_2 e_3} \lt(   \pd[(e_2 e_3 \, u \, T)]{i} 
    712720                                                                    + \pd[(e_1 e_3 \, v \, T)]{j} \rt) \\ 
     
    714722  \end{multline*} 
    715723  \begin{multline} 
    716   % \label{eq:PE_sco_s} 
     724  % \label{eq:MB_sco_s} 
    717725    \frac{1}{e_3} \pd[(e_3 \, S)]{t} = - \frac{1}{e_1 e_2 e_3} \lt(   \pd[(e_2 e_3 \, u \, S)]{i} 
    718726                                                                    + \pd[(e_1 e_3 \, v \, S)]{j} \rt) \\ 
     
    733741% ------------------------------------------------------------------------------------------------------------- 
    734742\subsection{Curvilinear \zstar-coordinate system} 
    735 \label{subsec:PE_zco_star} 
     743\label{subsec:MB_zco_star} 
    736744 
    737745%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    738746\begin{figure}[!b] 
    739   \begin{center} 
    740     \includegraphics[]{Fig_z_zstar} 
    741     \caption{ 
    742       \protect\label{fig:z_zstar} 
    743       (a) $z$-coordinate in linear free-surface case ; 
    744       (b) $z$-coordinate in non-linear free surface case ; 
    745       (c) re-scaled height coordinate 
    746       (become popular as the \zstar-coordinate \citep{Adcroft_Campin_OM04}). 
    747     } 
    748   \end{center} 
     747  \centering 
     748  \includegraphics[width=\textwidth]{Fig_z_zstar} 
     749  \caption[Curvilinear z-coordinate systems (\{non-\}linear free-surface cases and re-scaled \zstar)]{ 
     750    (a) $z$-coordinate in linear free-surface case ; 
     751    (b) $z$-coordinate in non-linear free surface case ; 
     752    (c) re-scaled height coordinate 
     753    (become popular as the \zstar-coordinate \citep{adcroft.campin_OM04}).} 
     754  \label{fig:MB_z_zstar} 
    749755\end{figure} 
    750756%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    751757 
    752 In that case, the free surface equation is nonlinear, and the variations of volume are fully taken into account. 
    753 These coordinates systems is presented in a report \citep{Levier2007} available on the \NEMO web site. 
     758In this case, the free surface equation is nonlinear, and the variations of volume are fully taken into account. 
     759These coordinates systems is presented in a report \citep{levier.treguier.ea_rpt07} available on the \NEMO\ web site. 
    754760 
    755761The \zstar coordinate approach is an unapproximated, non-linear free surface implementation which allows one to 
    756 deal with large amplitude free-surface variations relative to the vertical resolution \citep{Adcroft_Campin_OM04}. 
     762deal with large amplitude free-surface variations relative to the vertical resolution \citep{adcroft.campin_OM04}. 
    757763In the \zstar formulation, 
    758764the variation of the column thickness due to sea-surface undulations is not concentrated in the surface level, 
    759765as in the $z$-coordinate formulation, but is equally distributed over the full water column. 
    760766Thus vertical levels naturally follow sea-surface variations, with a linear attenuation with depth, 
    761 as illustrated by \autoref{fig:z_zstar}. 
    762 Note that with a flat bottom, such as in \autoref{fig:z_zstar}, the bottom-following $z$ coordinate and \zstar are equivalent. 
     767as illustrated by \autoref{fig:MB_z_zstar}. 
     768Note that with a flat bottom, such as in \autoref{fig:MB_z_zstar}, the bottom-following $z$ coordinate and \zstar are equivalent. 
    763769The definition and modified oceanic equations for the rescaled vertical coordinate \zstar, 
    764770including the treatment of fresh-water flux at the surface, are detailed in Adcroft and Campin (2004). 
     
    766772The position (\zstar) and vertical discretization (\zstar) are expressed as: 
    767773\[ 
    768   % \label{eq:z-star} 
     774  % \label{eq:MB_z-star} 
    769775  H + \zstar = (H + z)  / r \quad \text{and}  \quad \delta \zstar 
    770776              = \delta z / r \quad \text{with} \quad r 
    771               = \frac{H + \eta}{H} 
     777              = \frac{H + \eta}{H} . 
     778\] 
     779Simple re-organisation of the above expressions gives 
     780\[ 
     781  % \label{eq:MB_zstar_2} 
     782  \zstar = H \lt( \frac{z - \eta}{H + \eta} \rt) . 
    772783\] 
    773784Since the vertical displacement of the free surface is incorporated in the vertical coordinate \zstar, 
     
    776787Also the divergence of the flow field is no longer zero as shown by the continuity equation: 
    777788\[ 
    778   \pd[r]{t} = \nabla_{\zstar} \cdot \lt( r \; \vect U_h \rt) (r \; w *) = 0 
     789  \pd[r]{t} = \nabla_{\zstar} \cdot \lt( r \; \vect U_h \rt) + \pd[r \; w^*]{\zstar} = 0 . 
    779790\] 
    780  
    781 % from MOM4p1 documentation 
    782 To overcome problems with vanishing surface and/or bottom cells, we consider the zstar coordinate  
    783 \[ 
    784   % \label{eq:PE_} 
    785   \zstar = H \lt( \frac{z - \eta}{H + \eta} \rt) 
    786 \] 
    787  
    788 This coordinate is closely related to the "eta" coordinate used in many atmospheric models 
     791This \zstar coordinate is closely related to the "eta" coordinate used in many atmospheric models 
    789792(see Black (1994) for a review of eta coordinate atmospheric models). 
    790793It was originally used in ocean models by Stacey et al. (1995) for studies of tides next to shelves, 
     
    797800it is clear that surfaces constant \zstar are very similar to the depth surfaces. 
    798801These properties greatly reduce difficulties of computing the horizontal pressure gradient relative to 
    799 terrain following sigma models discussed in \autoref{subsec:PE_sco}. 
    800 Additionally, since \zstar when $\eta = 0$, 
     802terrain following sigma models discussed in \autoref{subsec:MB_sco}. 
     803Additionally, since $\zstar = z$ when $\eta = 0$, 
    801804no flow is spontaneously generated in an unforced ocean starting from rest, regardless the bottom topography. 
    802805This behaviour is in contrast to the case with "s"-models, where pressure gradient errors in the presence of 
     
    804807depending on the sophistication of the pressure gradient solver. 
    805808The quasi -horizontal nature of the coordinate surfaces also facilitates the implementation of 
    806 neutral physics parameterizations in \zstar models using the same techniques as in $z$-models 
    807 (see Chapters 13-16 of \cite{Griffies_Bk04}) for a discussion of neutral physics in $z$-models, 
     809neutral physics parameterizations in \zstar  models using the same techniques as in $z$-models 
     810(see Chapters 13-16 of \cite{griffies_bk04}) for a discussion of neutral physics in $z$-models, 
    808811as well as \autoref{sec:LDF_slp} in this document for treatment in \NEMO). 
    809812 
    810 The range over which \zstar varies is time independent $-H \leq \zstar \leq 0$. 
    811 Hence, all cells remain nonvanishing, so long as the surface height maintains $\eta > ?H$. 
     813The range over which \zstar  varies is time independent $-H \leq \zstar \leq 0$. 
     814Hence, all cells remain nonvanishing, so long as the surface height maintains $\eta > -H$. 
    812815This is a minor constraint relative to that encountered on the surface height when using $s = z$ or $s = z - \eta$. 
    813816 
    814 Because \zstar has a time independent range, all grid cells have static increments ds, 
    815 and the sum of the ver tical increments yields the time independent ocean depth. %k ds = H. 
     817Because \zstar  has a time independent range, all grid cells have static increments ds, 
     818and the sum of the vertical increments yields the time independent ocean depth. %k ds = H. 
    816819The \zstar coordinate is therefore invisible to undulations of the free surface, 
    817820since it moves along with the free surface. 
    818 This proper ty means that no spurious vertical transport is induced across surfaces of constant \zstar by 
     821This property means that no spurious vertical transport is induced across surfaces of constant \zstar by 
    819822the motion of external gravity waves. 
    820 Such spurious transpor t can be a problem in z-models, especially those with tidal forcing. 
    821 Quite generally, the time independent range for the \zstar coordinate is a very convenient property that 
    822 allows for a nearly arbitrary ver tical resolution even in the presence of large amplitude fluctuations of 
     823Such spurious transport can be a problem in z-models, especially those with tidal forcing. 
     824Quite generally, the time independent range for the \zstar  coordinate is a very convenient property that 
     825allows for a nearly arbitrary vertical resolution even in the presence of large amplitude fluctuations of 
    823826the surface height, again so long as $\eta > -H$. 
    824827%end MOM doc %%% 
    825828 
    826 \newpage  
     829\newpage 
    827830 
    828831% ------------------------------------------------------------------------------------------------------------- 
     
    830833% ------------------------------------------------------------------------------------------------------------- 
    831834\subsection{Curvilinear terrain-following \textit{s}--coordinate} 
    832 \label{subsec:PE_sco} 
     835\label{subsec:MB_sco} 
    833836 
    834837% ------------------------------------------------------------------------------------------------------------- 
     
    842845For example, the topographic $\beta$-effect is usually larger than the planetary one along continental slopes. 
    843846Topographic Rossby waves can be excited and can interact with the mean current. 
    844 In the $z$-coordinate system presented in the previous section (\autoref{sec:PE_zco}), 
     847In the $z$-coordinate system presented in the previous section (\autoref{sec:MB_zco}), 
    845848$z$-surfaces are geopotential surfaces. 
    846849The bottom topography is discretised by steps. 
     
    849852The response to such a velocity field often leads to numerical dispersion effects. 
    850853One solution to strongly reduce this error is to use a partial step representation of bottom topography instead of 
    851 a full step one \cite{Pacanowski_Gnanadesikan_MWR98}. 
     854a full step one \cite{pacanowski.gnanadesikan_MWR98}. 
    852855Another solution is to introduce a terrain-following coordinate system (hereafter $s$-coordinate). 
    853856 
     
    866869The main two problems come from the truncation error in the horizontal pressure gradient and 
    867870a possibly increased diapycnal diffusion. 
    868 The horizontal pressure force in $s$-coordinate consists of two terms (see \autoref{apdx:A}), 
     871The horizontal pressure force in $s$-coordinate consists of two terms (see \autoref{apdx:SCOORD}), 
    869872 
    870873\begin{equation} 
    871   \label{eq:PE_p_sco} 
    872   \nabla p |_z = \nabla p |_s - \pd[p]{s} \nabla z |_s 
     874  \label{eq:MB_p_sco} 
     875  \nabla p |_z = \nabla p |_s - \frac{1}{e_3} \pd[p]{s} \nabla z |_s 
    873876\end{equation} 
    874877 
    875 The second term in \autoref{eq:PE_p_sco} depends on the tilt of the coordinate surface and 
    876 introduces a truncation error that is not present in a $z$-model. 
     878The second term in \autoref{eq:MB_p_sco} depends on the tilt of the coordinate surface and 
     879leads to a truncation error that is not present in a $z$-model. 
    877880In the special case of a $\sigma$-coordinate (i.e. a depth-normalised coordinate system $\sigma = z/H$), 
    878 \citet{Haney1991} and \citet{Beckmann1993} have given estimates of the magnitude of this truncation error. 
     881\citet{haney_JPO91} and \citet{beckmann.haidvogel_JPO93} have given estimates of the magnitude of this truncation error. 
    879882It depends on topographic slope, stratification, horizontal and vertical resolution, the equation of state, 
    880883and the finite difference scheme. 
     
    884887The large-scale slopes require high horizontal resolution, and the computational cost becomes prohibitive. 
    885888This problem can be at least partially overcome by mixing $s$-coordinate and 
    886 step-like representation of bottom topography \citep{Gerdes1993a,Gerdes1993b,Madec_al_JPO96}. 
     889step-like representation of bottom topography \citep{gerdes_JGR93*a,gerdes_JGR93*b,madec.delecluse.ea_JPO96}. 
    887890However, the definition of the model domain vertical coordinate becomes then a non-trivial thing for 
    888891a realistic bottom topography: 
    889 a envelope topography is defined in $s$-coordinate on which a full or 
     892an envelope topography is defined in $s$-coordinate on which a full or 
    890893partial step bottom topography is then applied in order to adjust the model depth to the observed one 
    891 (see \autoref{sec:DOM_zgr}. 
     894(see \autoref{subsec:DOM_zgr}. 
    892895 
    893896For numerical reasons a minimum of diffusion is required along the coordinate surfaces of 
     
    904907In contrast, the ocean will stay at rest in a $z$-model. 
    905908As for the truncation error, the problem can be reduced by introducing the terrain-following coordinate below 
    906 the strongly stratified portion of the water column (\ie the main thermocline) \citep{Madec_al_JPO96}. 
     909the strongly stratified portion of the water column (\ie\ the main thermocline) \citep{madec.delecluse.ea_JPO96}. 
    907910An alternate solution consists of rotating the lateral diffusive tensor to geopotential or to isoneutral surfaces 
    908 (see \autoref{subsec:PE_ldf}). 
     911(see \autoref{subsec:MB_ldf}). 
    909912Unfortunately, the slope of isoneutral surfaces relative to the $s$-surfaces can very large, 
    910913strongly exceeding the stability limit of such a operator when it is discretized (see \autoref{chap:LDF}). 
    911914 
    912 The $s$-coordinates introduced here \citep{Lott_al_OM90,Madec_al_JPO96} differ mainly in two aspects from 
     915The $s$-coordinates introduced here \citep{lott.madec.ea_OM90,madec.delecluse.ea_JPO96} differ mainly in two aspects from 
    913916similar models: 
    914917it allows a representation of bottom topography with mixed full or partial step-like/terrain following topography; 
     
    919922% ------------------------------------------------------------------------------------------------------------- 
    920923\subsection{\texorpdfstring{Curvilinear \ztilde-coordinate}{}} 
    921 \label{subsec:PE_zco_tilde} 
    922  
    923 The \ztilde -coordinate has been developed by \citet{Leclair_Madec_OM11}. 
    924 It is available in \NEMO since the version 3.4. 
     924\label{subsec:MB_zco_tilde} 
     925 
     926The \ztilde -coordinate has been developed by \citet{leclair.madec_OM11}. 
     927It is available in \NEMO\ since the version 3.4 and is more robust in version 4.0 than previously. 
    925928Nevertheless, it is currently not robust enough to be used in all possible configurations. 
    926929Its use is therefore not recommended. 
    927930 
    928 \newpage  
     931\newpage 
    929932 
    930933% ================================================================ 
     
    932935% ================================================================ 
    933936\section{Subgrid scale physics} 
    934 \label{sec:PE_zdf_ldf} 
    935  
    936 The primitive equations describe the behaviour of a geophysical fluid at space and time scales larger than 
     937\label{sec:MB_zdf_ldf} 
     938 
     939The hydrostatic primitive equations describe the behaviour of a geophysical fluid at space and time scales larger than 
    937940a few kilometres in the horizontal, a few meters in the vertical and a few minutes. 
    938941They are usually solved at larger scales: the specified grid spacing and time step of the numerical model. 
     
    940943must be represented entirely in terms of large-scale patterns to close the equations. 
    941944These effects appear in the equations as the divergence of turbulent fluxes 
    942 (\ie fluxes associated with the mean correlation of small scale perturbations). 
     945(\ie\ fluxes associated with the mean correlation of small scale perturbations). 
    943946Assuming a turbulent closure hypothesis is equivalent to choose a formulation for these fluxes. 
    944947It is usually called the subgrid scale physics. 
     
    949952The control exerted by gravity on the flow induces a strong anisotropy between the lateral and vertical motions. 
    950953Therefore subgrid-scale physics \textbf{D}$^{\vect U}$, $D^{S}$ and $D^{T}$  in 
    951 \autoref{eq:PE_dyn}, \autoref{eq:PE_tra_T} and \autoref{eq:PE_tra_S} are divided into 
     954\autoref{eq:MB_PE_dyn}, \autoref{eq:MB_PE_tra_T} and \autoref{eq:MB_PE_tra_S} are divided into 
    952955a lateral part \textbf{D}$^{l \vect U}$, $D^{l S}$ and $D^{l T}$ and 
    953956a vertical part \textbf{D}$^{v \vect U}$, $D^{v S}$ and $D^{v T}$. 
     
    958961% ------------------------------------------------------------------------------------------------------------- 
    959962\subsection{Vertical subgrid scale physics} 
    960 \label{subsec:PE_zdf} 
     963\label{subsec:MB_zdf} 
    961964 
    962965The model resolution is always larger than the scale at which the major sources of vertical turbulence occur 
     
    972975The resulting vertical momentum and tracer diffusive operators are of second order: 
    973976\begin{equation} 
    974   \label{eq:PE_zdf} 
     977  \label{eq:MB_zdf} 
    975978  \begin{gathered} 
    976979    \vect D^{v \vect U} = \pd[]{z} \lt( A^{vm} \pd[\vect U_h]{z} \rt) \ , \\ 
     
    984987All the vertical physics is embedded in the specification of the eddy coefficients. 
    985988They can be assumed to be either constant, or function of the local fluid properties 
    986 (\eg Richardson number, Brunt-Vais\"{a}l\"{a} frequency...), 
     989(\eg\ Richardson number, Brunt-Vais\"{a}l\"{a} frequency, distance from the boundary ...), 
    987990or computed from a turbulent closure model. 
    988 The choices available in \NEMO are discussed in \autoref{chap:ZDF}). 
     991The choices available in \NEMO\ are discussed in \autoref{chap:ZDF}). 
    989992 
    990993% ------------------------------------------------------------------------------------------------------------- 
     
    992995% ------------------------------------------------------------------------------------------------------------- 
    993996\subsection{Formulation of the lateral diffusive and viscous operators} 
    994 \label{subsec:PE_ldf} 
     997\label{subsec:MB_ldf} 
    995998 
    996999Lateral turbulence can be roughly divided into a mesoscale turbulence associated with eddies 
     
    9991002and a sub mesoscale turbulence which is never explicitly solved even partially, but always parameterized. 
    10001003The formulation of lateral eddy fluxes depends on whether the mesoscale is below or above the grid-spacing 
    1001 (\ie the model is eddy-resolving or not). 
     1004(\ie\ the model is eddy-resolving or not). 
    10021005 
    10031006In non-eddy-resolving configurations, the closure is similar to that used for the vertical physics. 
     
    10051008The resulting lateral diffusive and dissipative operators are of second order. 
    10061009Observations show that lateral mixing induced by mesoscale turbulence tends to be along isopycnal surfaces 
    1007 (or more precisely neutral surfaces \cite{McDougall1987}) rather than across them. 
     1010(or more precisely neutral surfaces \cite{mcdougall_JPO87}) rather than across them. 
    10081011As the slope of neutral surfaces is small in the ocean, a common approximation is to assume that 
    1009 the `lateral' direction is the horizontal, \ie the lateral mixing is performed along geopotential surfaces. 
     1012the `lateral' direction is the horizontal, \ie\ the lateral mixing is performed along geopotential surfaces. 
    10101013This leads to a geopotential second order operator for lateral subgrid scale physics. 
    10111014This assumption can be relaxed: the eddy-induced turbulent fluxes can be better approached by assuming that 
     
    10141017it has components in the three space directions. 
    10151018However, 
    1016 both horizontal and isoneutral operators have no effect on mean (\ie large scale) potential energy whereas 
     1019both horizontal and isoneutral operators have no effect on mean (\ie\ large scale) potential energy whereas 
    10171020potential energy is a main source of turbulence (through baroclinic instabilities). 
    1018 \citet{Gent1990} have proposed a parameterisation of mesoscale eddy-induced turbulence which 
     1021\citet{gent.mcwilliams_JPO90} proposed a parameterisation of mesoscale eddy-induced turbulence which 
    10191022associates an eddy-induced velocity to the isoneutral diffusion. 
    10201023Its mean effect is to reduce the mean potential energy of the ocean. 
     
    10331036Another approach is becoming more and more popular: 
    10341037instead of specifying explicitly a sub-grid scale term in the momentum and tracer time evolution equations, 
    1035 one uses a advective scheme which is diffusive enough to maintain the model stability. 
     1038one uses an advective scheme which is diffusive enough to maintain the model stability. 
    10361039It must be emphasised that then, all the sub-grid scale physics is included in the formulation of 
    10371040the advection scheme. 
    10381041 
    10391042All these parameterisations of subgrid scale physics have advantages and drawbacks. 
    1040 There are not all available in \NEMO. For active tracers (temperature and salinity) the main ones are: 
     1043They are not all available in \NEMO. For active tracers (temperature and salinity) the main ones are: 
    10411044Laplacian and bilaplacian operators acting along geopotential or iso-neutral surfaces, 
    1042 \citet{Gent1990} parameterisation, and various slightly diffusive advection schemes. 
     1045\citet{gent.mcwilliams_JPO90} parameterisation, and various slightly diffusive advection schemes. 
    10431046For momentum, the main ones are: Laplacian and bilaplacian operators acting along geopotential surfaces, 
    10441047and UBS advection schemes when flux form is chosen for the momentum advection. 
     
    10461049\subsubsection{Lateral laplacian tracer diffusive operator} 
    10471050 
    1048 The lateral Laplacian tracer diffusive operator is defined by (see \autoref{apdx:B}): 
     1051The lateral Laplacian tracer diffusive operator is defined by (see \autoref{apdx:DIFFOPERS}): 
    10491052\begin{equation} 
    1050   \label{eq:PE_iso_tensor} 
     1053  \label{eq:MB_iso_tensor} 
    10511054  D^{lT} = \nabla \vect . \lt( A^{lT} \; \Re \; \nabla T \rt) \quad \text{with} \quad 
    10521055  \Re = 
     
    10581061\end{equation} 
    10591062where $r_1$ and $r_2$ are the slopes between the surface along which the diffusive operator acts and 
    1060 the model level (\eg $z$- or $s$-surfaces). 
    1061 Note that the formulation \autoref{eq:PE_iso_tensor} is exact for 
     1063the model level (\eg\ $z$- or $s$-surfaces). 
     1064Note that the formulation \autoref{eq:MB_iso_tensor} is exact for 
    10621065the rotation between geopotential and $s$-surfaces, 
    10631066while it is only an approximation for the rotation between isoneutral and $z$- or $s$-surfaces. 
    1064 Indeed, in the latter case, two assumptions are made to simplify \autoref{eq:PE_iso_tensor} \citep{Cox1987}. 
     1067Indeed, in the latter case, two assumptions are made to simplify \autoref{eq:MB_iso_tensor} \citep{cox_OM87}. 
    10651068First, the horizontal contribution of the dianeutral mixing is neglected since the ratio between iso and 
    10661069dia-neutral diffusive coefficients is known to be several orders of magnitude smaller than unity. 
    10671070Second, the two isoneutral directions of diffusion are assumed to be independent since 
    1068 the slopes are generally less than $10^{-2}$ in the ocean (see \autoref{apdx:B}). 
     1071the slopes are generally less than $10^{-2}$ in the ocean (see \autoref{apdx:DIFFOPERS}). 
    10691072 
    10701073For \textit{iso-level} diffusion, $r_1$ and $r_2 $ are zero. 
     
    10731076For \textit{geopotential} diffusion, 
    10741077$r_1$ and $r_2 $ are the slopes between the geopotential and computational surfaces: 
    1075 they are equal to $\sigma_1$ and $\sigma_2$, respectively (see \autoref{eq:PE_sco_slope}). 
     1078they are equal to $\sigma_1$ and $\sigma_2$, respectively (see \autoref{eq:MB_sco_slope}). 
    10761079 
    10771080For \textit{isoneutral} diffusion $r_1$ and $r_2$ are the slopes between the isoneutral and computational surfaces. 
     
    10791082In $z$-coordinates: 
    10801083\begin{equation} 
    1081   \label{eq:PE_iso_slopes} 
     1084  \label{eq:MB_iso_slopes} 
    10821085  r_1 = \frac{e_3}{e_1} \lt( \pd[\rho]{i} \rt) \lt( \pd[\rho]{k} \rt)^{-1} \quad 
    10831086  r_2 = \frac{e_3}{e_2} \lt( \pd[\rho]{j} \rt) \lt( \pd[\rho]{k} \rt)^{-1} 
     
    10871090\subsubsection{Eddy induced velocity} 
    10881091 
    1089 When the \textit{eddy induced velocity} parametrisation (eiv) \citep{Gent1990} is used, 
     1092When the \textit{eddy induced velocity} parametrisation (eiv) \citep{gent.mcwilliams_JPO90} is used, 
    10901093an additional tracer advection is introduced in combination with the isoneutral diffusion of tracers: 
    10911094\[ 
    1092   % \label{eq:PE_iso+eiv} 
     1095  % \label{eq:MB_iso+eiv} 
    10931096  D^{lT} = \nabla \cdot \lt( A^{lT} \; \Re \; \nabla T \rt) + \nabla \cdot \lt( \vect U^\ast \, T \rt) 
    10941097\] 
     
    10961099eddy-induced transport velocity. This velocity field is defined by: 
    10971100\begin{gather} 
    1098   % \label{eq:PE_eiv} 
     1101  % \label{eq:MB_eiv} 
    10991102  u^\ast =   \frac{1}{e_3}            \pd[]{k} \lt( A^{eiv} \;        \tilde{r}_1 \rt) \\ 
    11001103  v^\ast =   \frac{1}{e_3}            \pd[]{k} \lt( A^{eiv} \;        \tilde{r}_2 \rt) \\ 
     
    11051108(or equivalently the isoneutral thickness diffusivity coefficient), 
    11061109and $\tilde r_1$ and $\tilde r_2$ are the slopes between isoneutral and \textit{geopotential} surfaces. 
    1107 Their values are thus independent of the vertical coordinate, but their expression depends on the coordinate:  
     1110Their values are thus independent of the vertical coordinate, but their expression depends on the coordinate: 
    11081111\begin{align} 
    1109   \label{eq:PE_slopes_eiv} 
     1112  \label{eq:MB_slopes_eiv} 
    11101113  \tilde{r}_n = 
    11111114    \begin{cases} 
     
    11191122This can be achieved in a model by tapering either the eddy coefficient or the slopes to zero in the vicinity of 
    11201123the boundaries. 
    1121 The latter strategy is used in \NEMO (cf. \autoref{chap:LDF}). 
     1124The latter strategy is used in \NEMO\ (cf. \autoref{chap:LDF}). 
    11221125 
    11231126\subsubsection{Lateral bilaplacian tracer diffusive operator} 
     
    11251128The lateral bilaplacian tracer diffusive operator is defined by: 
    11261129\[ 
    1127   % \label{eq:PE_bilapT} 
     1130  % \label{eq:MB_bilapT} 
    11281131  D^{lT}= - \Delta \; (\Delta T) \quad \text{where} \quad 
    11291132  \Delta \bullet = \nabla \lt( \sqrt{B^{lT}} \; \Re \; \nabla \bullet \rt) 
    11301133\] 
    1131 It is the Laplacian operator given by \autoref{eq:PE_iso_tensor} applied twice with 
     1134It is the Laplacian operator given by \autoref{eq:MB_iso_tensor} applied twice with 
    11321135the harmonic eddy diffusion coefficient set to the square root of the biharmonic one. 
    11331136 
     
    11351138 
    11361139The Laplacian momentum diffusive operator along $z$- or $s$-surfaces is found by 
    1137 applying \autoref{eq:PE_lap_vector} to the horizontal velocity vector (see \autoref{apdx:B}): 
     1140applying \autoref{eq:MB_lap_vector} to the horizontal velocity vector (see \autoref{apdx:DIFFOPERS}): 
    11381141\begin{align*} 
    1139   % \label{eq:PE_lapU} 
     1142  % \label{eq:MB_lapU} 
    11401143  \vect D^{l \vect U} &=   \nabla_h        \big( A^{lm}    \chi             \big) 
    11411144                         - \nabla_h \times \big( A^{lm} \, \zeta \; \vect k \big) \\ 
    11421145                      &= \lt(   \frac{1}{e_1}     \pd[ \lt( A^{lm}    \chi      \rt) ]{i} \rt. 
    1143                               - \frac{1}{e_2 e_3} \pd[ \lt( A^{lm} \; e_3 \zeta \rt) ]{j} 
     1146                              - \frac{1}{e_2 e_3} \pd[ \lt( A^{lm} \; e_3 \zeta \rt) ]{j} , 
    11441147                                \frac{1}{e_2}     \pd[ \lt( A^{lm}    \chi      \rt) ]{j} 
    11451148                         \lt. + \frac{1}{e_1 e_3} \pd[ \lt( A^{lm} \; e_3 \zeta \rt) ]{i} \rt) 
     
    11471150 
    11481151Such a formulation ensures a complete separation between the vorticity and horizontal divergence fields 
    1149 (see \autoref{apdx:C}). 
     1152(see \autoref{apdx:INVARIANTS}). 
    11501153Unfortunately, it is only available in \textit{iso-level} direction. 
    11511154When a rotation is required 
    1152 (\ie geopotential diffusion in $s$-coordinates or isoneutral diffusion in both $z$- and $s$-coordinates), 
     1155(\ie\ geopotential diffusion in $s$-coordinates or isoneutral diffusion in both $z$- and $s$-coordinates), 
    11531156the $u$ and $v$-fields are considered as independent scalar fields, so that the diffusive operator is given by: 
    11541157\begin{gather*} 
    1155   % \label{eq:PE_lapU_iso} 
     1158  % \label{eq:MB_lapU_iso} 
    11561159    D_u^{l \vect U} = \nabla . \lt( A^{lm} \; \Re \; \nabla u \rt) \\ 
    11571160    D_v^{l \vect U} = \nabla . \lt( A^{lm} \; \Re \; \nabla v \rt) 
    11581161\end{gather*} 
    1159 where $\Re$ is given by \autoref{eq:PE_iso_tensor}. 
     1162where $\Re$ is given by \autoref{eq:MB_iso_tensor}. 
    11601163It is the same expression as those used for diffusive operator on tracers. 
    11611164It must be emphasised that such a formulation is only exact in a Cartesian coordinate system, 
    1162 \ie on a $f$- or $\beta$-plane, not on the sphere. 
     1165\ie\ on a $f$- or $\beta$-plane, not on the sphere. 
    11631166It is also a very good approximation in vicinity of the Equator in 
    1164 a geographical coordinate system \citep{Lengaigne_al_JGR03}. 
    1165  
    1166 \subsubsection{lateral bilaplacian momentum diffusive operator} 
     1167a geographical coordinate system \citep{lengaigne.madec.ea_JGR03}. 
     1168 
     1169\subsubsection{Lateral bilaplacian momentum diffusive operator} 
    11671170 
    11681171As for tracers, the bilaplacian order momentum diffusive operator is a re-entering Laplacian operator with 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_model_basics_zstar.tex

    r10544 r11564  
    1818 
    1919In that case, the free surface equation is nonlinear, and the variations of volume are fully taken into account. 
    20 These coordinates systems is presented in a report \citep{Levier2007} available on the \NEMO web site.  
     20These coordinates systems is presented in a report \citep{levier.treguier.ea_rpt07} available on the \NEMO\ web site. 
    2121 
    2222\colorbox{yellow}{  end of to be updated} 
     
    2424% from MOM4p1 documentation 
    2525 
    26 To overcome problems with vanishing surface and/or bottom cells, we consider the zstar coordinate  
    27 \[ 
    28   % \label{eq:PE_} 
     26To overcome problems with vanishing surface and/or bottom cells, we consider the zstar coordinate 
     27\[ 
     28  % \label{eq:MBZ_PE_} 
    2929  z^\star = H \left( \frac{z-\eta}{H+\eta} \right) 
    3030\] 
     
    4040the surface height, it is clear that surfaces constant $z^\star$ are very similar to the depth surfaces. 
    4141These properties greatly reduce difficulties of computing the horizontal pressure gradient relative to 
    42 terrain following sigma models discussed in \autoref{subsec:PE_sco}.  
     42terrain following sigma models discussed in \autoref{subsec:MB_sco}. 
    4343Additionally, since $z^\star$ when $\eta = 0$, no flow is spontaneously generated in 
    4444an unforced ocean starting from rest, regardless the bottom topography. 
     
    4949neutral physics parameterizations in $z^\star$ models using the same techniques as in $z$-models 
    5050(see Chapters 13-16 of Griffies (2004) for a discussion of neutral physics in $z$-models, 
    51 as well as  \autoref{sec:LDF_slp} in this document for treatment in \NEMO).  
     51as well as  \autoref{sec:LDF_slp} in this document for treatment in \NEMO). 
    5252 
    5353The range over which $z^\star$ varies is time independent $-H \leq z^\star \leq 0$. 
    5454Hence, all cells remain nonvanishing, so long as the surface height maintains $\eta > ?H$. 
    55 This is a minor constraint relative to that encountered on the surface height when using $s = z$ or $s = z - \eta$.  
     55This is a minor constraint relative to that encountered on the surface height when using $s = z$ or $s = z - \eta$. 
    5656 
    5757Because $z^\star$ has a time independent range, all grid cells have static increments ds, 
    58 and the sum of the ver tical increments yields the time independent ocean depth %�k ds = H.  
     58and the sum of the ver tical increments yields the time independent ocean depth %�k ds = H. 
    5959The $z^\star$ coordinate is therefore invisible to undulations of the free surface, 
    6060since it moves along with the free surface. 
     
    6464Quite generally, the time independent range for the $z^\star$ coordinate is a very convenient property that 
    6565allows for a nearly arbitrary vertical resolution even in the presence of large amplitude fluctuations of 
    66 the surface height, again so long as $\eta > -H$.  
     66the surface height, again so long as $\eta > -H$. 
    6767 
    6868%%% 
     
    7373% Surface Pressure Gradient and Sea Surface Height 
    7474% ================================================================ 
    75 \section{Surface pressure gradient and sea surface heigth (\protect\mdl{dynspg})} 
    76 \label{sec:DYN_hpg_spg} 
     75\section[Surface pressure gradient and sea surface heigth (\textit{dynspg.F90})] 
     76{Surface pressure gradient and sea surface heigth (\protect\mdl{dynspg})} 
     77\label{sec:MBZ_dyn_hpg_spg} 
    7778%-----------------------------------------nam_dynspg---------------------------------------------------- 
    7879 
    79 %\nlst{nam_dynspg}  
     80%\nlst{nam_dynspg} 
    8081%------------------------------------------------------------------------------------------------------------ 
    81 Options are defined through the \ngn{nam\_dynspg} namelist variables. 
    82 The surface pressure gradient term is related to the representation of the free surface (\autoref{sec:PE_hor_pg}). 
     82Options are defined through the \nam{\_dynspg} namelist variables. 
     83The surface pressure gradient term is related to the representation of the free surface (\autoref{sec:MB_hor_pg}). 
    8384The main distinction is between the fixed volume case (linear free surface or rigid lid) and 
    8485the variable volume case (nonlinear free surface, \key{vvl} is active). 
    85 In the linear free surface case (\autoref{subsec:PE_free_surface}) and rigid lid (\autoref{PE_rigid_lid}), 
     86In the linear free surface case (\autoref{subsec:MB_free_surface}) and rigid lid (\autoref{PE_rigid_lid}), 
    8687the vertical scale factors $e_{3}$ are fixed in time, 
    87 while in the nonlinear case (\autoref{subsec:PE_free_surface}) they are time-dependent. 
     88while in the nonlinear case (\autoref{subsec:MB_free_surface}) they are time-dependent. 
    8889With both linear and nonlinear free surface, external gravity waves are allowed in the equations, 
    8990which imposes a very small time step when an explicit time stepping is used. 
    9091Two methods are proposed to allow a longer time step for the three-dimensional equations: 
    91 the filtered free surface, which is a modification of the continuous equations %(see \autoref{eq:PE_flt}), 
     92the filtered free surface, which is a modification of the continuous equations %(see \autoref{eq:MB_flt?}), 
    9293and the split-explicit free surface described below. 
    9394The extra term introduced in the filtered method is calculated implicitly, 
     
    9798% Explicit 
    9899%------------------------------------------------------------- 
    99 \subsubsection{Explicit (\protect\key{dynspg\_exp})} 
    100 \label{subsec:DYN_spg_exp} 
     100\subsubsection[Explicit (\texttt{\textbf{key\_dynspg\_exp}})] 
     101{Explicit (\protect\key{dynspg\_exp})} 
     102\label{subsec:MBZ_dyn_spg_exp} 
    101103 
    102104In the explicit free surface formulation, the model time step is chosen small enough to 
     
    104106The sea surface height is given by: 
    105107\begin{equation} 
    106   \label{eq:dynspg_ssh} 
     108  \label{eq:MBZ_dynspg_ssh} 
    107109  \frac{\partial \eta }{\partial t}\equiv \frac{\text{EMP}}{\rho_w }+\frac{1}{e_{1T} 
    108110    e_{2T} }\sum\limits_k {\left( {\delta_i \left[ {e_{2u} e_{3u} u} 
     
    114116and $\rho_w =1,000\,Kg.m^{-3}$ is the volumic mass of pure water. 
    115117The sea-surface height is evaluated using a leapfrog scheme in combination with an Asselin time filter, 
    116 (\ie the velocity appearing in (\autoref{eq:dynspg_ssh}) is centred in time (\textit{now} velocity).  
     118(\ie\ the velocity appearing in (\autoref{eq:DYN_spg_ssh}) is centred in time (\textit{now} velocity). 
    117119 
    118120The surface pressure gradient, also evaluated using a leap-frog scheme, is then simply given by: 
    119121\begin{equation} 
    120   \label{eq:dynspg_exp} 
     122  \label{eq:MBZ_dynspg_exp} 
    121123  \left\{ 
    122124    \begin{aligned} 
     
    125127    \end{aligned} 
    126128  \right. 
    127 \end{equation}  
     129\end{equation} 
    128130 
    129131Consistent with the linearization, a $\left. \rho \right|_{k=1} / \rho_o$ factor is omitted in 
    130 (\autoref{eq:dynspg_exp}).  
     132(\autoref{eq:DYN_spg_exp}). 
    131133 
    132134%------------------------------------------------------------- 
    133135% Split-explicit time-stepping 
    134136%------------------------------------------------------------- 
    135 \subsubsection{Split-explicit time-stepping (\protect\key{dynspg\_ts})} 
    136 \label{subsec:DYN_spg_ts} 
     137\subsubsection[Split-explicit time-stepping (\texttt{\textbf{key\_dynspg\_ts}})] 
     138{Split-explicit time-stepping (\protect\key{dynspg\_ts})} 
     139\label{subsec:MBZ_dyn_spg_ts} 
    137140%--------------------------------------------namdom---------------------------------------------------- 
    138141 
    139 \nlst{namdom}  
    140142%-------------------------------------------------------------------------------------------------------------- 
    141 The split-explicit free surface formulation used in OPA follows the one proposed by \citet{Griffies2004}. 
     143The split-explicit free surface formulation used in OPA follows the one proposed by \citet{Griffies2004?}. 
    142144The general idea is to solve the free surface equation with a small time step, 
    143145while the three dimensional prognostic variables are solved with a longer time step that 
    144 is a multiple of \np{rdtbt} in the \ngn{namdom} namelist (Figure III.3).  
     146is a multiple of \np{rdtbt} in the \nam{dom} namelist (Figure III.3). 
    145147 
    146148%>   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   > 
    147149\begin{figure}[!t] 
    148   \begin{center} 
    149     \includegraphics[width=0.90\textwidth]{Fig_DYN_dynspg_ts} 
    150     \caption{ 
    151       \protect\label{fig:DYN_dynspg_ts} 
    152       Schematic of the split-explicit time stepping scheme for the barotropic and baroclinic modes, 
    153       after \citet{Griffies2004}. 
    154       Time increases to the right. 
    155       Baroclinic time steps are denoted by $t-\Delta t$, $t, t+\Delta t$, and $t+2\Delta t$. 
    156       The curved line represents a leap-frog time step, 
    157       and the smaller barotropic time steps $N \Delta t=2\Delta t$ are denoted by the zig-zag line. 
    158       The vertically integrated forcing \textbf{M}(t) computed at 
    159       baroclinic time step t represents the interaction between the barotropic and baroclinic motions. 
    160       While keeping the total depth, tracer, and freshwater forcing fields fixed, 
    161       a leap-frog integration carries the surface height and vertically integrated velocity from 
    162       t to $t+2 \Delta t$ using N barotropic time steps of length $\Delta t$. 
    163       Time averaging the barotropic fields over the N+1 time steps (endpoints included) 
    164       centers the vertically integrated velocity at the baroclinic timestep $t+\Delta t$. 
    165       A baroclinic leap-frog time step carries the surface height to $t+\Delta t$ using the convergence of 
    166       the time averaged vertically integrated velocity taken from baroclinic time step t. 
    167     } 
    168   \end{center} 
     150  \centering 
     151  \includegraphics[width=\textwidth]{Fig_DYN_dynspg_ts} 
     152  \caption[Schematic of the split-explicit time stepping scheme for 
     153  the barotropic and baroclinic modes, after \citet{Griffies2004?}]{ 
     154    Schematic of the split-explicit time stepping scheme for the barotropic and baroclinic modes, 
     155    after \citet{Griffies2004?}. 
     156    Time increases to the right. 
     157    Baroclinic time steps are denoted by $t-\Delta t$, $t, t+\Delta t$, and $t+2\Delta t$. 
     158    The curved line represents a leap-frog time step, 
     159    and the smaller barotropic time steps $N \Delta t=2\Delta t$ are denoted by the zig-zag line. 
     160    The vertically integrated forcing \textbf{M}(t) computed at 
     161    baroclinic time step t represents the interaction between the barotropic and baroclinic motions. 
     162    While keeping the total depth, tracer, and freshwater forcing fields fixed, 
     163    a leap-frog integration carries the surface height and vertically integrated velocity from 
     164    t to $t+2 \Delta t$ using N barotropic time steps of length $\Delta t$. 
     165    Time averaging the barotropic fields over the N+1 time steps (endpoints included) 
     166    centers the vertically integrated velocity at the baroclinic timestep $t+\Delta t$. 
     167    A baroclinic leap-frog time step carries the surface height to $t+\Delta t$ using 
     168    the convergence of the time averaged vertically integrated velocity taken from 
     169    baroclinic time step t.} 
     170  \label{fig:MBZ_dyn_dynspg_ts} 
    169171\end{figure} 
    170172%>   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   > 
    171173 
    172174The split-explicit formulation has a damping effect on external gravity waves, 
    173 which is weaker than the filtered free surface but still significant as shown by \citet{Levier2007} in 
    174 the case of an analytical barotropic Kelvin wave.  
     175which is weaker than the filtered free surface but still significant as shown by \citet{levier.treguier.ea_rpt07} in 
     176the case of an analytical barotropic Kelvin wave. 
    175177 
    176178%from griffies book: .....   copy past ! 
     
    183185We have 
    184186\[ 
    185   % \label{eq:DYN_spg_ts_eta} 
     187  % \label{eq:MBZ_dyn_spg_ts_eta} 
    186188  \eta^{(b)}(\tau,t_{n+1}) - \eta^{(b)}(\tau,t_{n+1}) (\tau,t_{n-1}) 
    187   = 2 \Delta t \left[-\nabla \cdot \textbf{U}^{(b)}(\tau,t_n) + \text{EMP}_w(\tau) \right]  
     189  = 2 \Delta t \left[-\nabla \cdot \textbf{U}^{(b)}(\tau,t_n) + \text{EMP}_w(\tau) \right] 
    188190\] 
    189191\begin{multline*} 
    190   % \label{eq:DYN_spg_ts_u} 
     192  % \label{eq:MBZ_dyn_spg_ts_u} 
    191193  \textbf{U}^{(b)}(\tau,t_{n+1}) - \textbf{U}^{(b)}(\tau,t_{n-1})  \\ 
    192194  = 2\Delta t \left[ - f \textbf{k} \times \textbf{U}^{(b)}(\tau,t_{n}) 
     
    202204the freshwater flux $\text{EMP}_w(\tau)$, and total depth of the ocean $H(\tau)$ are held for 
    203205the duration of the barotropic time stepping over a single cycle. 
    204 This is also the time that sets the barotropic time steps via  
    205 \[ 
    206   % \label{eq:DYN_spg_ts_t} 
    207   t_n=\tau+n\Delta t    
     206This is also the time that sets the barotropic time steps via 
     207\[ 
     208  % \label{eq:MBZ_dyn_spg_ts_t} 
     209  t_n=\tau+n\Delta t 
    208210\] 
    209211with $n$ an integer. 
    210 The density scaled surface pressure is evaluated via  
    211 \[ 
    212   % \label{eq:DYN_spg_ts_ps} 
     212The density scaled surface pressure is evaluated via 
     213\[ 
     214  % \label{eq:MBZ_dyn_spg_ts_ps} 
    213215  p_s^{(b)}(\tau,t_{n}) = 
    214216  \begin{cases} 
     
    217219  \end{cases} 
    218220\] 
    219 To get started, we assume the following initial conditions  
    220 \[ 
    221   % \label{eq:DYN_spg_ts_eta} 
     221To get started, we assume the following initial conditions 
     222\[ 
     223  % \label{eq:MBZ_dyn_spg_ts_eta} 
    222224  \begin{split} 
    223225    \eta^{(b)}(\tau,t_{n=0}) &= \overline{\eta^{(b)}(\tau)} \\ 
     
    225227  \end{split} 
    226228\] 
    227 with  
    228 \[ 
    229   % \label{eq:DYN_spg_ts_etaF} 
     229with 
     230\[ 
     231  % \label{eq:MBZ_dyn_spg_ts_etaF} 
    230232  \overline{\eta^{(b)}(\tau)} = \frac{1}{N+1} \sum\limits_{n=0}^N \eta^{(b)}(\tau-\Delta t,t_{n}) 
    231233\] 
     
    233235Likewise, 
    234236\[ 
    235   % \label{eq:DYN_spg_ts_u} 
     237  % \label{eq:MBZ_dyn_spg_ts_u} 
    236238  \textbf{U}^{(b)}(\tau,t_{n=0}) = \overline{\textbf{U}^{(b)}(\tau)} \\ \\ 
    237239  \textbf{U}(\tau,t_{n=1}) = \textbf{U}^{(b)}(\tau,t_{n=0}) + \Delta t \ \text{RHS}_{n=0} 
    238240\] 
    239 with  
    240 \[ 
    241   % \label{eq:DYN_spg_ts_u} 
     241with 
     242\[ 
     243  % \label{eq:MBZ_dyn_spg_ts_u} 
    242244  \overline{\textbf{U}^{(b)}(\tau)} = \frac{1}{N+1} \sum\limits_{n=0}^N\textbf{U}^{(b)}(\tau-\Delta t,t_{n}) 
    243245\] 
    244246the time averaged vertically integrated transport. 
    245 Notably, there is no Robert-Asselin time filter used in the barotropic portion of the integration.  
     247Notably, there is no Robert-Asselin time filter used in the barotropic portion of the integration. 
    246248 
    247249Upon reaching $t_{n=N} = \tau + 2\Delta \tau$ , the vertically integrated velocity is time averaged to 
    248 produce the updated vertically integrated velocity at baroclinic time $\tau + \Delta \tau$  
    249 \[ 
    250   % \label{eq:DYN_spg_ts_u} 
     250produce the updated vertically integrated velocity at baroclinic time $\tau + \Delta \tau$ 
     251\[ 
     252  % \label{eq:MBZ_dyn_spg_ts_u} 
    251253  \textbf{U}(\tau+\Delta t) = \overline{\textbf{U}^{(b)}(\tau+\Delta t)} 
    252254  = \frac{1}{N+1} \sum\limits_{n=0}^N\textbf{U}^{(b)}(\tau,t_{n}) 
    253255\] 
    254256The surface height on the new baroclinic time step is then determined via 
    255 a baroclinic leap-frog using the following form  
     257a baroclinic leap-frog using the following form 
    256258\begin{equation} 
    257   \label{eq:DYN_spg_ts_ssh} 
     259  \label{eq:MBZ_dyn_spg_ts_ssh} 
    258260  \eta(\tau+\Delta) - \eta^{F}(\tau-\Delta) = 2\Delta t \ \left[ - \nabla \cdot \textbf{U}(\tau) + \text{EMP}_w \right] 
    259261\end{equation} 
     
    261263The use of this "big-leap-frog" scheme for the surface height ensures compatibility between 
    262264the mass/volume budgets and the tracer budgets. 
    263 More discussion of this point is provided in Chapter 10 (see in particular Section 10.2).  
    264   
     265More discussion of this point is provided in Chapter 10 (see in particular Section 10.2). 
     266 
    265267In general, some form of time filter is needed to maintain integrity of the surface height field due to 
    266 the leap-frog splitting mode in equation \autoref{eq:DYN_spg_ts_ssh}. 
     268the leap-frog splitting mode in equation \autoref{eq:MBZ_dyn_spg_ts_ssh}. 
    267269We have tried various forms of such filtering, 
    268270with the following method discussed in Griffies et al. (2001) chosen due to its stability and 
    269 reasonably good maintenance of tracer conservation properties (see ??)  
     271reasonably good maintenance of tracer conservation properties (see ??) 
    270272 
    271273\begin{equation} 
    272   \label{eq:DYN_spg_ts_sshf} 
     274  \label{eq:MBZ_dyn_spg_ts_sshf} 
    273275  \eta^{F}(\tau-\Delta) =  \overline{\eta^{(b)}(\tau)} 
    274276\end{equation} 
    275 Another approach tried was  
    276  
    277 \[ 
    278   % \label{eq:DYN_spg_ts_sshf2} 
     277Another approach tried was 
     278 
     279\[ 
     280  % \label{eq:MBZ_dyn_spg_ts_sshf2} 
    279281  \eta^{F}(\tau-\Delta) = \eta(\tau) 
    280282  + (\alpha/2) \left[\overline{\eta^{(b)}}(\tau+\Delta t) 
     
    285287This isolation allows for an easy check that tracer conservation is exact when eliminating tracer and 
    286288surface height time filtering (see ?? for more complete discussion). 
    287 However, in the general case with a non-zero $\alpha$, the filter \autoref{eq:DYN_spg_ts_sshf} was found to 
    288 be more conservative, and so is recommended.  
    289  
    290 %------------------------------------------------------------- 
    291 % Filtered formulation  
    292 %------------------------------------------------------------- 
    293 \subsubsection{Filtered formulation (\protect\key{dynspg\_flt})} 
    294 \label{subsec:DYN_spg_flt} 
    295  
    296 The filtered formulation follows the \citet{Roullet2000} implementation. 
     289However, in the general case with a non-zero $\alpha$, the filter \autoref{eq:MBZ_dyn_spg_ts_sshf} was found to 
     290be more conservative, and so is recommended. 
     291 
     292%------------------------------------------------------------- 
     293% Filtered formulation 
     294%------------------------------------------------------------- 
     295\subsubsection[Filtered formulation (\texttt{\textbf{key\_dynspg\_flt}})] 
     296{Filtered formulation (\protect\key{dynspg\_flt})} 
     297\label{subsec:MBZ_dyn_spg_flt} 
     298 
     299The filtered formulation follows the \citet{Roullet2000?} implementation. 
    297300The extra term introduced in the equations (see {\S}I.2.2) is solved implicitly. 
    298301The elliptic solvers available in the code are documented in \autoref{chap:MISC}. 
    299302The amplitude of the extra term is given by the namelist variable \np{rnu}. 
    300 The default value is 1, as recommended by \citet{Roullet2000} 
    301  
    302 \colorbox{red}{\np{rnu}\forcode{ = 1} to be suppressed from namelist !} 
    303  
    304 %------------------------------------------------------------- 
    305 % Non-linear free surface formulation  
    306 %------------------------------------------------------------- 
    307 \subsection{Non-linear free surface formulation (\protect\key{vvl})} 
    308 \label{subsec:DYN_spg_vvl} 
     303The default value is 1, as recommended by \citet{Roullet2000?} 
     304 
     305\colorbox{red}{\np{rnu}\forcode{=1} to be suppressed from namelist !} 
     306 
     307%------------------------------------------------------------- 
     308% Non-linear free surface formulation 
     309%------------------------------------------------------------- 
     310\subsection[Non-linear free surface formulation (\texttt{\textbf{key\_vvl}})] 
     311{Non-linear free surface formulation (\protect\key{vvl})} 
     312\label{subsec:MBZ_dyn_spg_vvl} 
    309313 
    310314In the non-linear free surface formulation, the variations of volume are fully taken into account. 
    311 This option is presented in a report \citep{Levier2007} available on the NEMO web site. 
     315This option is presented in a report \citep{levier.treguier.ea_rpt07} available on the \NEMO\ web site. 
    312316The three time-stepping methods (explicit, split-explicit and filtered) are the same as in 
    313 \autoref{DYN_spg_linear} except that the ocean depth is now time-dependent. 
     317\autoref{?:DYN_spg_linear?} except that the ocean depth is now time-dependent. 
    314318In particular, this means that in filtered case, the matrix to be inverted has to be recomputed at each time-step. 
    315319 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/NEMO/subfiles/chap_time_domain.tex

    r10501 r11564  
    66% Chapter 2 ——— Time Domain (step.F90) 
    77% ================================================================ 
    8 \chapter{Time Domain (STP)} 
    9 \label{chap:STP} 
    10 \minitoc 
     8\chapter{Time Domain} 
     9\label{chap:TD} 
     10\chaptertoc 
    1111 
    1212% Missing things: 
    13 %  - daymod: definition of the time domain (nit000, nitend andd the calendar) 
     13%  - daymod: definition of the time domain (nit000, nitend and the calendar) 
    1414 
    1515\gmcomment{STEVEN :maybe a picture of the directory structure in the introduction which could be referred to here, 
     
    1919\newpage 
    2020 
    21 Having defined the continuous equations in \autoref{chap:PE}, we need now to choose a time discretization, 
     21Having defined the continuous equations in \autoref{chap:MB}, we need now to choose a time discretization, 
    2222a key feature of an ocean model as it exerts a strong influence on the structure of the computer code 
    23 (\ie on its flowchart). 
    24 In the present chapter, we provide a general description of the \NEMO time stepping strategy and 
     23(\ie\ on its flowchart). 
     24In the present chapter, we provide a general description of the \NEMO\ time stepping strategy and 
    2525the consequences for the order in which the equations are solved. 
    2626 
     
    2929% ================================================================ 
    3030\section{Time stepping environment} 
    31 \label{sec:STP_environment} 
    32  
    33 The time stepping used in \NEMO is a three level scheme that can be represented as follows: 
    34 \begin{equation} 
    35   \label{eq:STP} 
     31\label{sec:TD_environment} 
     32 
     33The time stepping used in \NEMO\ is a three level scheme that can be represented as follows: 
     34\begin{equation} 
     35  \label{eq:TD} 
    3636  x^{t + \rdt} = x^{t - \rdt} + 2 \, \rdt \ \text{RHS}_x^{t - \rdt, \, t, \, t + \rdt} 
    37 \end{equation}  
     37\end{equation} 
    3838where $x$ stands for $u$, $v$, $T$ or $S$; 
    3939RHS is the Right-Hand-Side of the corresponding time evolution equation; 
    4040$\rdt$ is the time step; 
    4141and the superscripts indicate the time at which a quantity is evaluated. 
    42 Each term of the RHS is evaluated at a specific time step depending on the physics with which it is associated. 
    43  
    44 The choice of the time step used for this evaluation is discussed below as well as 
     42Each term of the RHS is evaluated at a specific time stepping depending on the physics with which it is associated. 
     43 
     44The choice of the time stepping used for this evaluation is discussed below as well as 
    4545the implications for starting or restarting a model simulation. 
    4646Note that the time stepping calculation is generally performed in a single operation. 
     
    5252The third array, although referred to as $x_a$ (after) in the code, 
    5353is usually not the variable at the after time step; 
    54 but rather it is used to store the time derivative (RHS in \autoref{eq:STP}) prior to time-stepping the equation. 
    55 Generally, the time stepping is performed once at each time step in the \mdl{tranxt} and \mdl{dynnxt} modules, 
    56 except when using implicit vertical diffusion or calculating sea surface height in which 
    57 case time-splitting options are used. 
     54but rather it is used to store the time derivative (RHS in \autoref{eq:TD}) prior to time-stepping the equation. 
     55The time stepping itself is performed once at each time step where implicit vertical diffusion is computed, \ie\ in the \mdl{trazdf} and \mdl{dynzdf} modules. 
    5856 
    5957% ------------------------------------------------------------------------------------------------------------- 
     
    6159% ------------------------------------------------------------------------------------------------------------- 
    6260\section{Non-diffusive part --- Leapfrog scheme} 
    63 \label{sec:STP_leap_frog} 
     61\label{sec:TD_leap_frog} 
    6462 
    6563The time stepping used for processes other than diffusion is the well-known leapfrog scheme 
    66 \citep{Mesinger_Arakawa_Bk76}. 
     64\citep{mesinger.arakawa_bk76}. 
    6765This scheme is widely used for advection processes in low-viscosity fluids. 
    68 It is a time centred scheme, \ie the RHS in \autoref{eq:STP} is evaluated at time step $t$, the now time step. 
     66It is a time centred scheme, \ie\ the RHS in \autoref{eq:TD} is evaluated at time step $t$, the now time step. 
    6967It may be used for momentum and tracer advection, pressure gradient, and Coriolis terms, 
    7068but not for diffusion terms. 
     
    8078To prevent it, the leapfrog scheme is often used in association with a Robert-Asselin time filter 
    8179(hereafter the LF-RA scheme). 
    82 This filter, first designed by \citet{Robert_JMSJ66} and more comprehensively studied by \citet{Asselin_MWR72}, 
     80This filter, first designed by \citet{robert_JMSJ66} and more comprehensively studied by \citet{asselin_MWR72}, 
    8381is a kind of laplacian diffusion in time that mixes odd and even time steps: 
    8482\begin{equation} 
    85   \label{eq:STP_asselin} 
     83  \label{eq:TD_asselin} 
    8684  x_F^t = x^t + \gamma \, \lt[ x_F^{t - \rdt} - 2 x^t + x^{t + \rdt} \rt] 
    8785\end{equation} 
    8886where the subscript $F$ denotes filtered values and $\gamma$ is the Asselin coefficient. 
    8987$\gamma$ is initialized as \np{rn\_atfp} (namelist parameter). 
    90 Its default value is \np{rn\_atfp}~\forcode{= 10.e-3} (see \autoref{sec:STP_mLF}), 
    91 causing only a weak dissipation of high frequency motions (\citep{Farge1987}). 
     88Its default value is \np{rn\_atfp}\forcode{ = 10.e-3} (see \autoref{sec:TD_mLF}), 
     89causing only a weak dissipation of high frequency motions (\citep{farge-coulombier_phd87}). 
    9290The addition of a time filter degrades the accuracy of the calculation from second to first order. 
    9391However, the second order truncation error is proportional to $\gamma$, which is small compared to 1. 
     
    9795When used with the 2nd order space centred discretisation of the advection terms in 
    9896the momentum and tracer equations, LF-RA avoids implicit numerical diffusion: 
    99 diffusion is set explicitly by the user through the Robert-Asselin  
     97diffusion is set explicitly by the user through the Robert-Asselin 
    10098filter parameter and the viscosity and diffusion coefficients. 
    10199 
     
    104102% ------------------------------------------------------------------------------------------------------------- 
    105103\section{Diffusive part --- Forward or backward scheme} 
    106 \label{sec:STP_forward_imp} 
     104\label{sec:TD_forward_imp} 
    107105 
    108106The leapfrog differencing scheme is unsuitable for the representation of diffusion and damping processes. 
    109 For a tendancy $D_x$, representing a diffusion term or a restoring term to a tracer climatology 
     107For a tendency $D_x$, representing a diffusion term or a restoring term to a tracer climatology 
    110108(when present, see \autoref{sec:TRA_dmp}), a forward time differencing scheme is used : 
    111109\[ 
    112   %\label{eq:STP_euler} 
     110  %\label{eq:TD_euler} 
    113111  x^{t + \rdt} = x^{t - \rdt} + 2 \, \rdt \ D_x^{t - \rdt} 
    114112\] 
    115113 
    116114This is diffusive in time and conditionally stable. 
    117 The conditions for stability of second and fourth order horizontal diffusion schemes are \citep{Griffies_Bk04}: 
    118 \begin{equation} 
    119   \label{eq:STP_euler_stability} 
     115The conditions for stability of second and fourth order horizontal diffusion schemes are \citep{griffies_bk04}: 
     116\begin{equation} 
     117  \label{eq:TD_euler_stability} 
    120118  A^h < 
    121119  \begin{cases} 
     
    125123\end{equation} 
    126124where $e$ is the smallest grid size in the two horizontal directions and $A^h$ is the mixing coefficient. 
    127 The linear constraint \autoref{eq:STP_euler_stability} is a necessary condition, but not sufficient. 
     125The linear constraint \autoref{eq:TD_euler_stability} is a necessary condition, but not sufficient. 
    128126If it is not satisfied, even mildly, then the model soon becomes wildly unstable. 
    129127The instability can be removed by either reducing the length of the time steps or reducing the mixing coefficient. 
    130128 
    131129For the vertical diffusion terms, a forward time differencing scheme can be used, 
    132 but usually the numerical stability condition imposes a strong constraint on the time step. 
    133 Two solutions are available in \NEMO to overcome the stability constraint: 
    134 $(a)$ a forward time differencing scheme using a time splitting technique (\np{ln\_zdfexp}~\forcode{= .true.}) or 
    135 $(b)$ a backward (or implicit) time differencing scheme                   (\np{ln\_zdfexp}~\forcode{= .false.}). 
    136 In $(a)$, the master time step $\Delta$t is cut into $N$ fractional time steps so that 
    137 the stability criterion is reduced by a factor of $N$. 
    138 The computation is performed as follows: 
    139 \begin{alignat*}{2} 
    140   % \label{eq:STP_ts} 
    141   &x_\ast^{t - \rdt}                      &= &x^{t - \rdt} \\ 
    142   &x_\ast^{t - \rdt + L \frac{2 \rdt}{N}} &=   &x_\ast ^{t - \rdt + (L - 1) \frac{2 \rdt}{N}} 
    143                                              + \frac{2 \rdt}{N} \; DF^{t - \rdt + (L - 1) \frac{2 \rdt}{N}} 
    144   \quad \text{for $L = 1$ to $N$} \\ 
    145   &x^{t + \rdt}                           &= &x_\ast^{t + \rdt} 
    146 \end{alignat*} 
    147 with DF a vertical diffusion term. 
    148 The number of fractional time steps, $N$, is given by setting \np{nn\_zdfexp}, (namelist parameter). 
    149 The scheme $(b)$ is unconditionally stable but diffusive. It can be written as follows: 
    150 \begin{equation} 
    151   \label{eq:STP_imp} 
     130but usually the numerical stability condition imposes a strong constraint on the time step. To overcome the stability constraint, a 
     131backward (or implicit) time differencing scheme is used. This scheme is unconditionally stable but diffusive and can be written as follows: 
     132\begin{equation} 
     133  \label{eq:TD_imp} 
    152134  x^{t + \rdt} = x^{t - \rdt} + 2 \, \rdt \ \text{RHS}_x^{t + \rdt} 
    153135\end{equation} 
     
    157139%%gm 
    158140 
    159 This scheme is rather time consuming since it requires a matrix inversion, 
    160 but it becomes attractive since a value of 3 or more is needed for N in the forward time differencing scheme. 
    161 For example, the finite difference approximation of the temperature equation is: 
     141This scheme is rather time consuming since it requires a matrix inversion. For example, the finite difference approximation of the temperature equation is: 
    162142\[ 
    163   % \label{eq:STP_imp_zdf} 
     143  % \label{eq:TD_imp_zdf} 
    164144  \frac{T(k)^{t + 1} - T(k)^{t - 1}}{2 \; \rdt} 
    165145  \equiv 
     
    167147\] 
    168148where RHS is the right hand side of the equation except for the vertical diffusion term. 
    169 We rewrite \autoref{eq:STP_imp} as: 
    170 \begin{equation} 
    171   \label{eq:STP_imp_mat} 
     149We rewrite \autoref{eq:TD_imp} as: 
     150\begin{equation} 
     151  \label{eq:TD_imp_mat} 
    172152  -c(k + 1) \; T^{t + 1}(k + 1) + d(k) \; T^{t + 1}(k) - \; c(k) \; T^{t + 1}(k - 1) \equiv b(k) 
    173153\end{equation} 
    174 where  
    175 \begin{align*}  
     154where 
     155\begin{align*} 
    176156  c(k) &= A_w^{vT} (k) \, / \, e_{3w} (k)     \\ 
    177157  d(k) &= e_{3t}   (k)       \, / \, (2 \rdt) + c_k + c_{k + 1}    \\ 
     
    179159\end{align*} 
    180160 
    181 \autoref{eq:STP_imp_mat} is a linear system of equations with an associated matrix which is tridiagonal. 
     161\autoref{eq:TD_imp_mat} is a linear system of equations with an associated matrix which is tridiagonal. 
    182162Moreover, 
    183163$c(k)$ and $d(k)$ are positive and the diagonal term is greater than the sum of the two extra-diagonal terms, 
    184164therefore a special adaptation of the Gauss elimination procedure is used to find the solution 
    185 (see for example \citet{Richtmyer1967}). 
     165(see for example \citet{richtmyer.morton_bk67}). 
    186166 
    187167% ------------------------------------------------------------------------------------------------------------- 
     
    189169% ------------------------------------------------------------------------------------------------------------- 
    190170\section{Surface pressure gradient} 
    191 \label{sec:STP_spg_ts} 
    192  
    193 ===>>>>  TO BE written....  :-) 
    194  
    195 %\gmcomment{  
     171\label{sec:TD_spg_ts} 
     172 
     173The leapfrog environment supports a centred in time computation of the surface pressure, \ie\ evaluated 
     174at \textit{now} time step. This refers to as the explicit free surface case in the code (\np{ln\_dynspg\_exp}\forcode{=.true.}). 
     175This choice however imposes a strong constraint on the time step which should be small enough to resolve the propagation 
     176of external gravity waves. As a matter of fact, one rather use in a realistic setup, a split-explicit free surface 
     177(\np{ln\_dynspg\_ts}\forcode{=.true.}) in which barotropic and baroclinic dynamical equations are solved separately with ad-hoc 
     178time steps. The use of the time-splitting (in combination with non-linear free surface) imposes some constraints on the design of 
     179the overall flowchart, in particular to ensure exact tracer conservation (see \autoref{fig:TD_TimeStep_flowchart}). 
     180 
     181Compared to the former use of the filtered free surface in \NEMO\ v3.6 (\citet{roullet.madec_JGR00}), the use of a split-explicit free surface is advantageous 
     182on massively parallel computers. Indeed, no global computations are anymore required by the elliptic solver which saves a substantial amount of communication 
     183time. Fast barotropic motions (such as tides) are also simulated with a better accuracy. 
     184 
     185%\gmcomment{ 
    196186%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    197187\begin{figure}[!t] 
    198   \begin{center} 
    199     \includegraphics[]{Fig_TimeStepping_flowchart} 
    200     \caption{ 
    201       \protect\label{fig:TimeStep_flowchart} 
    202       Sketch of the leapfrog time stepping sequence in \NEMO from \citet{Leclair_Madec_OM09}. 
    203       The use of a semi -implicit computation of the hydrostatic pressure gradient requires the tracer equation to 
    204       be stepped forward prior to the momentum equation. 
    205       The need for knowledge of the vertical scale factor (here denoted as $h$) requires the sea surface height and 
    206       the continuity equation to be stepped forward prior to the computation of the tracer equation. 
    207       Note that the method for the evaluation of the surface pressure gradient $\nabla p_s$ is not presented here 
    208       (see \autoref{sec:DYN_spg}). 
    209     } 
    210   \end{center} 
     188  \centering 
     189  \includegraphics[width=\textwidth]{Fig_TimeStepping_flowchart_v4} 
     190  \caption[Leapfrog time stepping sequence with split-explicit free surface]{ 
     191    Sketch of the leapfrog time stepping sequence in \NEMO\ with split-explicit free surface. 
     192    The latter combined with non-linear free surface requires the dynamical tendency being 
     193    updated prior tracers tendency to ensure conservation. 
     194    Note the use of time integrated fluxes issued from the barotropic loop in 
     195    subsequent calculations of tracer advection and in the continuity equation. 
     196    Details about the time-splitting scheme can be found in \autoref{subsec:DYN_spg_ts}.} 
     197  \label{fig:TD_TimeStep_flowchart} 
    211198\end{figure} 
    212199%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    217204% ------------------------------------------------------------------------------------------------------------- 
    218205\section{Modified Leapfrog -- Asselin filter scheme} 
    219 \label{sec:STP_mLF} 
    220  
    221 Significant changes have been introduced by \cite{Leclair_Madec_OM09} in the LF-RA scheme in order to 
     206\label{sec:TD_mLF} 
     207 
     208Significant changes have been introduced by \cite{leclair.madec_OM09} in the LF-RA scheme in order to 
    222209ensure tracer conservation and to allow the use of a much smaller value of the Asselin filter parameter. 
    223210The modifications affect both the forcing and filtering treatments in the LF-RA scheme. 
    224211 
    225212In a classical LF-RA environment, the forcing term is centred in time, 
    226 \ie it is time-stepped over a $2 \rdt$ period: 
     213\ie\ it is time-stepped over a $2 \rdt$ period: 
    227214$x^t = x^t + 2 \rdt Q^t$ where $Q$ is the forcing applied to $x$, 
    228 and the time filter is given by \autoref{eq:STP_asselin} so that $Q$ is redistributed over several time step. 
     215and the time filter is given by \autoref{eq:TD_asselin} so that $Q$ is redistributed over several time step. 
    229216In the modified LF-RA environment, these two formulations have been replaced by: 
    230217\begin{gather} 
    231   \label{eq:STP_forcing} 
     218  \label{eq:TD_forcing} 
    232219  x^{t + \rdt} = x^{t - \rdt} + \rdt \lt( Q^{t - \rdt / 2} + Q^{t + \rdt / 2} \rt)  \\ 
    233   \label{eq:STP_RA} 
     220  \label{eq:TD_RA} 
    234221  x_F^t       = x^t + \gamma \, \lt( x_F^{t - \rdt} - 2 x^t + x^{t + \rdt} \rt) 
    235222                    - \gamma \, \rdt \, \lt( Q^{t + \rdt / 2} - Q^{t - \rdt / 2} \rt) 
    236223\end{gather} 
    237 The change in the forcing formulation given by \autoref{eq:STP_forcing} (see \autoref{fig:MLF_forcing}) 
     224The change in the forcing formulation given by \autoref{eq:TD_forcing} (see \autoref{fig:TD_MLF_forcing}) 
    238225has a significant effect: 
    239 the forcing term no longer excites the divergence of odd and even time steps \citep{Leclair_Madec_OM09}. 
     226the forcing term no longer excites the divergence of odd and even time steps \citep{leclair.madec_OM09}. 
    240227% forcing seen by the model.... 
    241 This property improves the LF-RA scheme in two respects. 
     228This property improves the LF-RA scheme in two aspects. 
    242229First, the LF-RA can now ensure the local and global conservation of tracers. 
    243230Indeed, time filtering is no longer required on the forcing part. 
    244 The influence of the Asselin filter on the forcing is be removed by adding a new term in the filter 
    245 (last term in \autoref{eq:STP_RA} compared to \autoref{eq:STP_asselin}). 
     231The influence of the Asselin filter on the forcing is explicitly removed by adding a new term in the filter 
     232(last term in \autoref{eq:TD_RA} compared to \autoref{eq:TD_asselin}). 
    246233Since the filtering of the forcing was the source of non-conservation in the classical LF-RA scheme, 
    247 the modified formulation becomes conservative \citep{Leclair_Madec_OM09}. 
     234the modified formulation becomes conservative \citep{leclair.madec_OM09}. 
    248235Second, the LF-RA becomes a truly quasi -second order scheme. 
    249 Indeed, \autoref{eq:STP_forcing} used in combination with a careful treatment of static instability 
    250 (\autoref{subsec:ZDF_evd}) and of the TKE physics (\autoref{subsec:ZDF_tke_ene}), 
    251 the two other main sources of time step divergence, 
     236Indeed, \autoref{eq:TD_forcing} used in combination with a careful treatment of static instability 
     237(\autoref{subsec:ZDF_evd}) and of the TKE physics (\autoref{subsec:ZDF_tke_ene}) 
     238(the two other main sources of time step divergence), 
    252239allows a reduction by two orders of magnitude of the Asselin filter parameter. 
    253240 
    254241Note that the forcing is now provided at the middle of a time step: 
    255242$Q^{t + \rdt / 2}$ is the forcing applied over the $[t,t + \rdt]$ time interval. 
    256 This and the change in the time filter, \autoref{eq:STP_RA}, 
    257 allows an exact evaluation of the contribution due to the forcing term between any two time steps, 
     243This and the change in the time filter, \autoref{eq:TD_RA}, 
     244allows for an exact evaluation of the contribution due to the forcing term between any two time steps, 
    258245even if separated by only $\rdt$ since the time filter is no longer applied to the forcing term. 
    259246 
    260247%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    261248\begin{figure}[!t] 
    262   \begin{center} 
    263     \includegraphics[]{Fig_MLF_forcing} 
    264     \caption{ 
    265       \protect\label{fig:MLF_forcing} 
    266       Illustration of forcing integration methods. 
    267       (top) ''Traditional'' formulation: 
    268       the forcing is defined at the same time as the variable to which it is applied 
    269       (integer value of the time step index) and it is applied over a $2 \rdt$ period. 
    270       (bottom)  modified formulation: 
    271       the forcing is defined in the middle of the time (integer and a half value of the time step index) and 
    272       the mean of two successive forcing values ($n - 1 / 2$, $n + 1 / 2$) is applied over a $2 \rdt$ period. 
    273     } 
    274   \end{center} 
     249  \centering 
     250  \includegraphics[width=\textwidth]{Fig_MLF_forcing} 
     251  \caption[Forcing integration methods for modified leapfrog (top and bottom)]{ 
     252    Illustration of forcing integration methods. 
     253    (top) ''Traditional'' formulation: 
     254    the forcing is defined at the same time as the variable to which it is applied 
     255    (integer value of the time step index) and it is applied over a $2 \rdt$ period. 
     256    (bottom)  modified formulation: 
     257    the forcing is defined in the middle of the time 
     258    (integer and a half value of the time step index) and 
     259    the mean of two successive forcing values ($n - 1 / 2$, $n + 1 / 2$) is applied over 
     260    a $2 \rdt$ period.} 
     261  \label{fig:TD_MLF_forcing} 
    275262\end{figure} 
    276263%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    280267% ------------------------------------------------------------------------------------------------------------- 
    281268\section{Start/Restart strategy} 
    282 \label{sec:STP_rst} 
     269\label{sec:TD_rst} 
    283270 
    284271%--------------------------------------------namrun------------------------------------------- 
    285 \nlst{namrun} 
     272\begin{listing} 
     273  \nlst{namrun} 
     274  \caption{\texttt{namrun}} 
     275  \label{lst:namrun} 
     276\end{listing} 
    286277%-------------------------------------------------------------------------------------------------------------- 
    287278 
     
    289280(Euler time integration): 
    290281\[ 
    291   % \label{eq:DOM_euler} 
     282  % \label{eq:TD_DOM_euler} 
    292283  x^1 = x^0 + \rdt \ \text{RHS}^0 
    293284\] 
    294 This is done simply by keeping the leapfrog environment (\ie the \autoref{eq:STP} three level time stepping) but 
     285This is done simply by keeping the leapfrog environment (\ie\ the \autoref{eq:TD} three level time stepping) but 
    295286setting all $x^0$ (\textit{before}) and $x^1$ (\textit{now}) fields equal at the first time step and 
    296 using half the value of $\rdt$. 
     287using half the value of a leapfrog time step ($2 \rdt$). 
    297288 
    298289It is also possible to restart from a previous computation, by using a restart file. 
     
    303294This requires saving two time levels and many auxiliary data in the restart files in machine precision. 
    304295 
    305 Note that when a semi -implicit scheme is used to evaluate the hydrostatic pressure gradient 
    306 (see \autoref{subsec:DYN_hpg_imp}), an extra three-dimensional field has to 
    307 be added to the restart file to ensure an exact restartability. 
    308 This is done optionally via the  \np{nn\_dynhpg\_rst} namelist parameter, 
    309 so that the size of the restart file can be reduced when restartability is not a key issue 
    310 (operational oceanography or in ensemble simulations for seasonal forecasting). 
    311  
    312 Note the size of the time step used, $\rdt$, is also saved in the restart file. 
    313 When restarting, if the the time step has been changed, a restart using an Euler time stepping scheme is imposed. 
    314 Options are defined through the  \ngn{namrun} namelist variables. 
     296Note that the time step $\rdt$, is also saved in the restart file. 
     297When restarting, if the time step has been changed, or one of the prognostic variables at \textit{before} time step 
     298is missing, an Euler time stepping scheme is imposed. A forward initial step can still be enforced by the user by setting 
     299the namelist variable \np{nn\_euler}\forcode{=0}. Other options to control the time integration of the model 
     300are defined through the  \nam{run} namelist variables. 
    315301%%% 
    316302\gmcomment{ 
     
    319305add also the idea of writing several restart for seasonal forecast : how is it done ? 
    320306 
    321 verify that all namelist pararmeters are truly described  
     307verify that all namelist pararmeters are truly described 
    322308 
    323309a word on the check of restart  ..... 
     
    325311%%% 
    326312 
    327 \gmcomment{       % add a subsection here   
     313\gmcomment{       % add a subsection here 
    328314 
    329315%------------------------------------------------------------------------------------------------------------- 
     
    331317% ------------------------------------------------------------------------------------------------------------- 
    332318\subsection{Time domain} 
    333 \label{subsec:STP_time} 
     319\label{subsec:TD_time} 
    334320%--------------------------------------------namrun------------------------------------------- 
    335321 
    336 \nlst{namdom}          
    337322%-------------------------------------------------------------------------------------------------------------- 
    338323 
    339 Options are defined through the  \ngn{namdom} namelist variables. 
     324Options are defined through the  \nam{dom} namelist variables. 
    340325 \colorbox{yellow}{add here a few word on nit000 and nitend} 
    341326 
     
    349334 
    350335%% 
    351 \gmcomment{       % add implicit in vvl case  and Crant-Nicholson scheme    
     336\gmcomment{       % add implicit in vvl case  and Crant-Nicholson scheme 
    352337 
    353338Implicit time stepping in case of variable volume thickness. 
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/SI3

    • Property svn:ignore deleted
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/SI3/namelists

    • Property svn:ignore deleted
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/SI3/namelists/namdyn_adv

    • Property svn:mime-type set to text/x-fortran
  • NEMO/branches/2019/dev_r10973_AGRIF-01_jchanut_small_jpi_jpj/doc/latex/TOP

    • Property svn:ignore deleted
Note: See TracChangeset for help on using the changeset viewer.