Index: NEMO/branches/2020/ticket_2444/doc/latex/NEMO/subfiles/apdx_DOMAINcfg.tex
===================================================================
--- NEMO/branches/2020/ticket_2444/doc/latex/NEMO/subfiles/apdx_DOMAINcfg.tex	(revision 12768)
+++ NEMO/branches/2020/ticket_2444/doc/latex/NEMO/subfiles/apdx_DOMAINcfg.tex	(revision 12769)
@@ -319,9 +319,4 @@
   Defining the bathymetry also defines the coastline: where the bathymetry is zero,
   no wet levels are defined (all levels are masked).
-
-  The \ifile{isfdraft\_meter} file (Netcdf format) provides the ice shelf draft (positive, in meters) at
-  each grid point of the model grid.
-  This file is only needed if \np[=.true.]{ln_isfcav}{ln\_isfcav}.
-  Defining the ice shelf draft will also define the ice shelf edge and the grounding line position.
 \end{description}
 
@@ -530,4 +525,109 @@
 This option is described in the Report by Levier \textit{et al.} (2007), available on the \NEMO\ web site.
 
+\section{Ice shelf cavity definition}
+\label{subsec:zgrisf}
+
+  If the under ice shelf seas are opened (\np{ln_isfcav}{ln\_isfcav}), the depth of the ice shelf/ocean interface has to be include in 
+  the \ifile{isfdraft\_meter} file (Netcdf format). This file need to include the \ifile{isf\_draft} variable. 
+  A positive value will me an ice shelf/ocean or ice shelf bedrock interface below the reference 0m ssh. 
+  The exact shape of the ice shelf cavity (grounding line position and minimum thickness of the water column under an ice shelf, ...) can be specify in \nam{lst:namzgr_isf}.
+
+
+\begin{listing}
+  \nlst{namzgr_isf_domcfg}
+  \caption{\forcode{&namzgr_isf}}
+  \label{lst:namzgr_isf}
+\end{listing}
+
+   The options available to define the shape of the under ice shelf cavities are listed in \nam{namzgr_isf}{namzgr\_isf} (\texttt{DOMAINcfg} only, \autoref{lst:namzgr_isf}).
+
+   \subsection{Model ice shelf draft definition}
+   \label{subsec:zgrisf_isfd}
+
+   First of all, the tool make sure, the ice shelf draft ($h_{isf}$) is sensible and compatible with the bathymetry.
+   There are 3 compulsory steps to achieve this:
+
+   \begin{description}
+   \item{\np{rn_isfdep_min}{rn\_isfdep\_min}:} this is the minimum ice shelf draft. This is to make sure there is no ridiculous thin ice shelf. If \np{rn_isfdep_min}{rn\_isfdep\_min} is smaller than the surface level, \np{rn_isfdep_min}{rn\_isfdep\_min} is set to $e3t\_1d(1)$. 
+   Where $h_{isf} < MAX(e3t\_1d(1),\np{rn_isfdep_min}{rn\_isfdep\_min}$), $h_{isf}$ is set to \np{rn_isfdep_min}{rn\_isfdep\_min}.
+
+   \item{\np{rn_glhw_min}{rn\_glhw\_min}:} This parameter is used to define the grounding line position.
+   Where the difference between the bathymetry and the ice shelf draft is smaller than \np{rn_glhw_min}{rn\_glhw\_min}, the cell are grounded (ie masked). 
+   This step is needed to take into account possible small mismatch between ice shelf draft value and bathymetry value (sources are coming from different grid, different data processes, rounding error, ...).
+
+   \item{\np{rn_isfhw_min}{rn\_isfhw\_min}:} This parameter is minimum water column thickness in the cavity. 
+   Where the water column thickness is lower than \np{rn_isfhw_min}{rn\_isfhw\_min}, the ice shelf draft is adjusted to match this criterion. 
+   If for any reason, this adjustement break the minimum ice shelf draft allowed (\np{rn_isfdep_min}{rn\_isfdep\_min}), the cell is masked.
+   \end{description}
+
+   Once all these adjustements are made, if the water column thickness contains one cell wide channels, these channels can be closed using \np{ln_isfchannel}{ln\_isfchannel}.  
+ 
+   \subsection{Model top level definition}
+   After the definition of the ice shelf draft, the tool defines the top level. 
+   The compulsory criterion is that the water column needs at least 2 wet cells in the water column at U- and V-points.
+   To do so, if there one cell wide water column, the tools adjust the ice shelf draft to fillful the requierement.\\
+
+   The process is the following:
+   \begin{description}
+   \item{step 1:} The top level is defined in the same way as the bottom level is defined.
+   \item{step 2:} The isolated grid point in the bathymetry are filled (as it is done in a domain without ice shelf)
+   \item{step 3:} The tools make sure, the top level is above or equal to the bottom level
+   \item{step 4:} If the water column at a U- or V- point is one wet cell wide, the ice shelf draft is adjusted. So the actual top cell become fully open and the new
+   top cell thickness is set to the minimum cell thickness allowed (following the same logic as for the bottom partial cell). This step is iterated 4 times to ensure the condition is fullfill along the 4 sides of the cell.
+   \end{description}
+
+   In case of steep slope and shallow water column, it likely that 2 cells are disconnected (bathymetry above its neigbourg ice shelf draft). 
+   The option \np{ln_isfconnect}{ln\_isfconnect} allow the tool to force the connection between these 2 cells.
+   Some limiters in meter or levels on the digging allowed by the tool are available (respectively, \np{rn_zisfmax}{rn\_zisfmax} or \np{rn_kisfmax}{rn\_kisfmax}).
+   This will prevent the formation of subglacial lakes at the expense of long vertical pipe to connect cells at very different levels.
+
+   \subsection{Subglacial lakes}
+   Despite careful setting of your ice shelf draft and bathymetry input file as well as setting described in \autoref{subsec:zgrisf_isfd}, some situation are unavoidable.
+   For exemple if you setup your ice shelf draft and bathymetry to do ocean/ice sheet coupling, 
+   you may decide to fill the whole antarctic with a bathymetry and an ice shelf draft value (ice/bedrock interface depth when grounded). 
+   If you do so, the subglacial lakes will show up (Vostock for example). An other possibility is with coarse vertical resolution, some ice shelves could be cut in 2 parts: 
+   one connected to the main ocean and an other one closed which can be considered as a subglacial sea be the model.\\
+
+   The namelist option \np{ln_isfsubgl}{ln\_isfsubgl} allow you to remove theses subglacial lakes.
+   This may be useful for esthetical reason or for stability reasons:
+
+   \begin{description}
+   \item $\bullet$ In a subglacial lakes, in case of very weak circulation (often the case), the only heat flux is the conductive heat flux through the ice sheet. 
+         This will lead to constant freezing until water reaches -20C. 
+         This is one of the defitiency of the 3 equation melt formulation (for details on this formulation, see: \autoref{sec:isf}).
+   \item $\bullet$ In case of coupling with an ice sheet model, 
+         the ssh in the subglacial lakes and the main ocean could be very different (ssh initial adjustement for example), 
+         and so if for any reason both a connected at some point, the model is likely to fall over.\\
+   \end{description}
+
+\section{Closed sea definition}
+\label{sec:clocfg}
+
+\begin{listing}
+  \nlst{namclo_domcfg}
+  \caption{\forcode{&namclo}}
+  \label{lst:namclo}
+\end{listing}
+
+The options available to define the closed seas and how closed sea net fresh water input will be redistributed by NEMO are listed in \nam{clo} (\texttt{DOMAINcfg} only, \autoref{lst:namclo}).
+The individual definition of each closed sea is managed by \np{sn_lake}{sn\_lake}. In this fields the user needs to defined:\\
+   \begin{description}
+   \item $\bullet$    the name of the closed sea (print output purposes).
+   \item $\bullet$    the seed location to define the area of the closed sea (if seed on land because not present in this configuration, this closed sea will be ignored).\\
+   \item $\bullet$    the seed location for the target area.
+   \item $\bullet$    the type of target area ('local','coast' or 'global'). See point 6 for definition of these cases.
+   \item $\bullet$    the type of redistribution scheme for the net fresh water flux over the closed sea (as a runoff in a target area, as emp in a target area, as emp globally). For the runoff case, if the net fwf is negative, it will be redistribut globally.
+   \item $\bullet$    the radius of the target area (not used for the 'global' case). So the target defined by a 'local' target area of a radius of 100km, for example, correspond to all the wet points within this radius. The coastal case will return only the coastal point within the specifid radius.
+   \item $\bullet$    the target id. This target id is used to group multiple lakes into the same river ouflow (Great Lakes for example).
+   \end{description}
+
+The closed sea module defines a number of masks in the \ifile{domain\_cfg} output:
+   \begin{description}
+   \item[\textit{mask\_opensea}:] a mask of the main ocean without all the closed seas closed. This mask is defined by a flood filling algorithm with an initial seed (localisation defined by \np{rn_lon_opnsea}{rn\_lon\_opnsea} and \np{rn_lat_opnsea}{rn\_lat\_opnsea}).
+   \item[\textit{mask\_csglo}, \textit{mask\_csrnf}, \textit{mask\_csemp}:] a mask of all the closed seas defined in the namelist by \np{sn_lake}{sn\_lake} for each redistribution scheme. The total number of defined closed seas has to be defined in \np{nn_closea}{nn\_closea}.
+   \item[\textit{mask\_csgrpglo}, \textit{mask\_csgrprnf}, \textit{mask\_csgrpemp}:] a mask of all the closed seas and targets grouped by target id for each type of redistribution scheme.
+   \item[\textit{mask\_csundef}:] a mask of all the closed sea not defined in \np{sn_lake}{sn\_lake}. This will allows NEMO to mask them if needed or to inform the user of potential minor issues in its bathymetry.
+   \end{description}
+   
 \subinc{\input{../../global/epilogue}}
 
