Index: branches/2013/dev_CMCC_2013/DOC/NEMO_book.tex
===================================================================
--- branches/2013/dev_CMCC_2013/DOC/NEMO_book.tex	(revision 4174)
+++ branches/2013/dev_CMCC_2013/DOC/NEMO_book.tex	(revision 4175)
@@ -23,4 +23,5 @@
 \usepackage[margin=10pt,font={small},labelsep=colon,labelfont={bf}]{caption} % Gives small font for captions
 \usepackage{enumitem}                          % allows non-bold description items
+\usepackage{longtable}                         % allows multipage tables
 %\usepackage{colortbl}                           % gives coloured panels behind table columns
 
Index: branches/2013/dev_CMCC_2013/DOC/TexFiles/Chapters/Chap_DIA.tex
===================================================================
--- branches/2013/dev_CMCC_2013/DOC/TexFiles/Chapters/Chap_DIA.tex	(revision 4174)
+++ branches/2013/dev_CMCC_2013/DOC/TexFiles/Chapters/Chap_DIA.tex	(revision 4175)
@@ -1,4 +1,4 @@
 % ================================================================
-% Chapter Ñ I/O & Diagnostics
+% Chapter I/O & Diagnostics
 % ================================================================
 \chapter{Ouput and Diagnostics (IOM, DIA, TRD, FLO)}
@@ -16,5 +16,5 @@
 
 The model outputs are of three types: the restart file, the output listing, 
-and the output file(s). The restart file is used internally by the code when 
+and the diagnostic output file(s). The restart file is used internally by the code when 
 the user wants to start the model with initial conditions defined by a 
 previous simulation. It contains all the information that is necessary in 
@@ -25,5 +25,7 @@
 that it is saved in the same binary format as the one used by the computer 
 that is to read it (in particular, 32 bits binary IEEE format must not be used for 
-this file). The output listing and file(s) are predefined but should be checked 
+this file). 
+
+The output listing and file(s) are predefined but should be checked 
 and eventually adapted to the user's needs. The output listing is stored in 
 the $ocean.output$ file. The information is printed from within the code on the 
@@ -31,5 +33,9 @@
 "\textit{grep -i numout}" in the source code directory.
 
-By default, outpout files are written in NetCDF format but an IEEE output format, called DIMG, can be choosen when defining \key{dimgout}. Since version 3.2, when defining \key{iomput}, an I/O server has been added which provides more flexibility in the choice of the fields to be outputted as well as how the writing work is distributed over the processors in massively parallel computing. The complete description of the use of this I/O server is presented in next section. If neither \key{iomput} nor \key{dimgout} are defined, NEMO is producing NetCDF with the old IOIPSL library which has been kept for compatibility and its easy installation, but it is quite inefficient on parrallel machines. If \key{iomput} is not defined, output files are defined in the \mdl{diawri} module and containing mean (or instantaneous if \key{diainstant} is defined) values over a period of nn\_write time-step (namelist parameter). 
+By default, diagnostic output files are written in NetCDF format but an IEEE binary output format, called DIMG, can be choosen by defining \key{dimgout}. 
+
+Since version 3.2, when defining \key{iomput}, an I/O server has been added which provides more flexibility in the choice of the fields to be written as well as how the writing work is distributed over the processors in massively parallel computing. The complete description of the use of this I/O server is presented in the next section. 
+
+By default, if neither \key{iomput} nor \key{dimgout} are defined, NEMO produces NetCDF with the old IOIPSL library which has been kept for compatibility and its easy installation. However, the IOIPSL library is quite inefficient on parallel machines and, since version 3.2, many diagnostic options have been added presuming the use of \key{iomput}. The usefulness of the default IOIPSL-based option is expected to reduce with each new release. If \key{iomput} is not defined, output files and content are defined in the \mdl{diawri} module and contain mean (or instantaneous if \key{diainstant} is defined) values over a regular period of nn\_write time-steps (namelist parameter). 
 
 %\gmcomment{                    % start of gmcomment
@@ -42,21 +48,145 @@
 
 
-Since version 3.2, iomput is the NEMO output interface. It was designed to be simple to use, flexible and efficient. The two main purposes of iomput are: \\
-(1) the complete and flexible control of the output files through an external xml file defined by the user \\
-(2) to achieve high performance outputs through the distribution (or not) of all tasks related to output files on dedicated processes. \\
-The first functionality allows the user to specify, without touching anything into the code, the way he want to output data: \\
-- choice of output frequencies that can be different for each file (including real months and years) \\
-- choice of file contents: decide which data will be written in which file (the same data can be outputted in different files)  \\
-- possibility to split output files at a choosen frequency \\
-- possibility to extract a vertical or an horizontal subdomain  \\
-- choice of the temporal operation to perform: average, accumulate, instantaneous, min, max and once  \\
-- extremely large choice of data available   \\
-- redefine variables name and long\_name  \\
-In addition, iomput allows the user to output any variable (scalar, 2D or 3D) in the code in a very easy way. All details of iomput functionalities are listed in the following subsections. Example of the iodef.xml files that control the outputs can be found here: NEMOGCM/CONFIG/ORCA2\_LIM/EXP00/iodef*.xml
-
-The second functionality targets outputs performances when running on a very large number of processes. First, iomput provides the possibility to dedicate N specific processes (in addition to NEMO processes) to write the outputs, where N is big enough (and defined by the user) to suppress the bottle neck associated with the the writing of the output files. Since version 3.5, this interface depends on an external code called \href{http://forge.ipsl.jussieu.fr/ioserver}{XIOS}. This new IO server takes advantage of the new functionalitiy of NetCDF4 that allows the user to write files in parallel and therefore to bypass the rebuilding phase. Note that writting in parallel into the same NetCDF files requires that your NetCDF4 library is linked to an HDF5 library that has been correctly compiled (i.e. with the configure option $--$enable-parallel). Note that the files created by iomput trough xios are incompatible with NetCDF3. All post-processsing and visualization tools must therefore be compatible with NetCDF4 and not only NetCDF3.
-
-\subsection{Basic knowledge}
-
+Since version 3.2, iomput is the NEMO output interface of choice. It has been designed to be simple to use, flexible and efficient. The two main purposes of iomput are: 
+\begin{enumerate}
+\item The complete and flexible control of the output files through external XML files adapted by the user from standard templates. 
+\item To achieve high performance and scalable output through the optional distribution of all diagnostic output related tasks to dedicated processes. 
+\end{enumerate}
+The first functionality allows the user to specify, without code changes or recompilation, aspects of the diagnostic output stream, such as:
+\begin{itemize}
+\item The choice of output frequencies that can be different for each file (including real months and years).
+\item The choice of file contents; includes complete flexibility over which data are written in which files (the same data can be written in different files). 
+\item The possibility to split output files at a choosen frequency.
+\item The possibility to extract a vertical or an horizontal subdomain.
+\item The choice of the temporal operation to perform, e.g.: average, accumulate, instantaneous, min, max and once.
+\item Control over metadata via a large XML "database" of possible output fields.
+\end{itemize}
+In addition, iomput allows the user to add the output of any new variable (scalar, 2D or 3D) in the code in a very easy way. All details of iomput functionalities are listed in the following subsections. Examples of the XML files that control the outputs can be found in:
+\begin{alltt}
+\begin{verbatim}
+  NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef.xml
+  NEMOGCM/CONFIG/SHARED/field_def.xml
+  and
+  NEMOGCM/CONFIG/SHARED/domain_def.xml.
+\end{verbatim}
+\end{alltt}
+
+The second functionality targets output performance when running in parallel (\key{mpp\_mpi}). Iomput provides the possibility to specify N dedicated I/O processes (in addition to the NEMO processes) to collect and write the outputs. With an appropriate choice of N by the user, the bottleneck associated with the writing of the output files can be greatly reduced. 
+
+Since version 3.5, the iom\_put interface depends on an external code called \href{http://forge.ipsl.jussieu.fr/ioserver}{XIOS}. This new IO server can take advantage of the parallel I/O functionality of NetCDF4 to create a single output file and therefore to bypass the rebuilding phase. Note that writing in parallel into the same NetCDF files requires that your NetCDF4 library is linked to an HDF5 library that has been correctly compiled (i.e. with the configure option $--$enable-parallel). Note that the files created by iomput through XIOS are incompatible with NetCDF3. All post-processsing and visualization tools must therefore be compatible with NetCDF4 and not only NetCDF3.
+
+Even if not using the parallel I/O functionality of NetCDF4, using N dedicated I/O servers, where N is typically much less than the number of NEMO processors, will reduce the number of output files created. This can greatly reduce the post-processing burden usually associated with using large numbers of NEMO processors. Note that for smaller configurations, the rebuilding phase can be avoided, even without a parallel-enabled NetCDF4 library, simply by employing only one dedicated I/O server.
+
+\subsection{XIOS: the IO\_SERVER}
+
+\subsubsection{Attached or detached mode?}
+
+Iomput is based on \href{http://forge.ipsl.jussieu.fr/ioserver/wiki}{XIOS}, the io\_server developed by Yann Meurdesoif from IPSL. The behaviour of the io subsystem is controlled by settings in the external XML files listed above. Key settings in the iodef.xml file are {\tt using\_server} and the {\tt type} tag associated with each defined file. The {\tt using\_server} setting determines whether or not the server will be used in ''attached mode'' (as a library) [{\tt false}] or in ''detached mode'' (as an external executable on N additional, dedicated cpus) [{\tt true}]. The ''attached mode'' is simpler to use but much less efficient for massively parallel applications. The type of each file can be either ''multiple\_file'' or ''one\_file''.
+
+In attached mode and if the type of file is ''multiple\_file'', then each NEMO process will also act as an IO server and produce its own set of output files. Superficially, this emulates the standard behaviour in previous versions, However, the subdomain written out by each process does not correspond to the {\tt jpi x jpj x jpk} domain actually computed by the process (although it may if {\tt jpni=1}). Instead each process will have collected and written out a number of complete longitudinal strips. If the ''one\_file'' option is chosen then all processes will collect their longitudinal strips and write (in parallel) to a single output file. 
+
+In detached mode and if the type of file is ''multiple\_file'', then each stand-alone XIOS process will collect data for a range of complete longitudinal strips and write to its own set of output files. If the ''one\_file'' option is chosen then all XIOS processes will collect their longitudinal strips and write (in parallel) to a single output file. Note running in detached mode requires launching a Multiple Process Multiple Data (MPMD) parallel job. The following subsection provides a typical example but the syntax will vary in different MPP environments.
+
+\subsubsection{Number of cpu used by XIOS in detached mode}
+
+The number of cores used by the XIOS is specified when launching the model. The number of cores dedicated to XIOS should be from ~1/10 to ~1/50 of the number or cores dedicated to NEMO. Some manufacturers suggest using O($\sqrt{N}$) dedicated IO processors for N processors but this is a general recommendation and not specific to NEMO. It is difficult to provide precise recommendations because the optimal choice will depend on the particular hardware properties of the target system (parallel filesystem performance, available memory, memory bandwidth etc.) and the volume and frequency of data to be created. Here is an example of 2 cpus for the io\_server and 62 cpu for nemo using mpirun:
+
+\texttt{ mpirun -np 62 ./nemo.exe : -np 2 ./xios\_server.exe }
+
+\subsubsection{Control of XIOS: the XIOS context in iodef.xml}
+
+As well as the {\tt using\_server} flag, other controls on the use of XIOS are set in the XIOS context in iodef.xml. See the XML basics section below for more details on XML syntax and rules.
+
+\begin{tabular}{|p{4cm}|p{6.0cm}|p{2.0cm}|}
+   \hline
+   variable name & 
+   description & 
+   example \\ 
+   \hline   
+   \hline
+   buffer\_size & 
+   buffer size used by XIOS to send data from NEMO to XIOS. Larger is more efficient. Note that needed/used buffer sizes are summarized at the end of the job & 
+   25000000 \\ 
+   \hline   
+   buffer\_server\_factor\_size & 
+   ratio between NEMO and XIOS buffer size. Should be 2. & 
+   2 \\ 
+   \hline
+   info\_level & 
+   verbosity level (0 to 100) & 
+   0 \\ 
+   \hline
+   using\_server & 
+   activate attached(false) or detached(true) mode & 
+   true \\ 
+   \hline
+   using\_oasis & 
+   XIOS is used with OASIS(true) or not (false) & 
+   false \\ 
+   \hline
+   oasis\_codes\_id & 
+   when using oasis, define the identifier of NEMO in the namcouple. Note that the identifier of XIOS is xios.x & 
+   oceanx \\ 
+   \hline   
+\end{tabular}
+
+
+\subsection{Practical issues}
+
+\subsubsection{Installation}
+
+As mentioned, XIOS is supported separately and must be downloaded and compiled before it can be used with NEMO. See the installation guide on the \href{http://forge.ipsl.jussieu.fr/ioserver/wiki}{XIOS} wiki for help and guidance. NEMO will need to link to the compiled XIOS library. The 
+\href{http://www.nemo-ocean.eu/Using-NEMO/User-Guides/Basics/XIOS-IO-server-installation-and-use}{XIOS with NEMO} guide provides an example illustration of how this can be achieved.
+
+\subsubsection{Add your own outputs}
+
+It is very easy to add your own outputs with iomput. Many standard fields and diagnostics are already prepared (i.e., steps 1 to 3 below have been done) and simply need to be activated by including the required output in a file definition in iodef.xml (step 4). To add new output variables, all 4 of the following steps must be taken.
+\begin{description}
+\item[1.] in NEMO code, add a \\
+\texttt{      CALL iom\_put( 'identifier', array ) } \\
+where you want to output a 2D or 3D array.
+
+\item[2.] If necessary, add \\
+\texttt{   USE iom\ \ \ \ \ \ \ \ \ \ \ \ ! I/O manager library }  \\
+to the list of used modules in the upper part of your module. 
+
+\item[3.] in the field\_def.xml file, add the definition of your variable using the same identifier you used in the f90 code (see subsequent sections for a details of the XML syntax and rules). For example:
+\vspace{-20pt}
+\begin{alltt}  {{\scriptsize
+\begin{verbatim}
+   <field_definition>
+      <!-- T grid -->
+
+     <field_group id="grid_T" grid_ref="grid_T_3D">
+      ...
+      <field id="identifier" long_name="blabla" ... />   
+      ...
+   </field_definition> 
+\end{verbatim}
+}}\end{alltt} 
+Note your definition must be added to the field\_group whose reference grid is consistent with the size of the array passed to iomput. The grid\_ref attribute refers to definitions set in iodef.xml which, in turn, reference grids and axes either defined in the code (iom\_set\_domain\_attr and iom\_set\_axis\_attr in iom.F90) or defined in the domain\_def.xml file. E.g.:
+\vspace{-20pt}
+\begin{alltt}  {{\scriptsize
+\begin{verbatim}
+     <grid id="grid_T_3D" domain_ref="grid_T" axis_ref="deptht"/>
+\end{verbatim}
+}}\end{alltt} 
+Note, if your array is computed within the surface module each nn\_fsbc time\_step, 
+add the field definition within the field\_group defined with the id ''SBC'': $<$field\_group id=''SBC''...$>$ which has been defined with the correct frequency of operations (iom\_set\_field\_attr in iom.F90)
+
+\item[4.] add your field in one of the output files defined in iodef.xml (again see subsequent sections for syntax and rules)   \\
+\vspace{-20pt}
+\begin{alltt}  {{\scriptsize
+\begin{verbatim}
+   <file id="file1" .../>   
+      ...
+      <field field_ref="identifier" />   
+      ...
+   </file>   
+\end{verbatim}
+}}\end{alltt} 
+
+\end{description}
+\subsection{XML fundamentals}
 
 \subsubsection{ XML basic rules}
@@ -72,63 +202,134 @@
 
 The XML file used in XIOS is structured by 7 families of tags: context, axis, domain, grid, field, file and variable. Each tag family has hierarchy of three flavors (except for context):
-\begin{description}
-\item[root]: declaration of the root element that can contain element groups or elements, for example : $<$file\_definition ...$/>$ \\
-\item[group]: declaration of a group element that can contain element groups or elements, for example : $<$file\_group ...$/>$ \\
-\item[element]: declaration of an element that can contain elements, for example : $<$file ...$/>$  \\
-\end{description}
+\\
+\begin{tabular}{|p{3.0cm}|p{4.5cm}|p{4.5cm}|}
+   \hline
+   flavor &
+   description &
+   example \\
+   \hline
+   \hline
+   root &
+   declaration of the root element that can contain element groups or elements &
+   {\scriptsize \verb? < file_definition ... >?} \\
+   \hline
+   group &
+   declaration of a group element that can contain element groups or elements &
+   {\scriptsize \verb? < file_group ... >?} \\
+   \hline
+   element &
+   declaration of an element that can contain elements &
+   {\scriptsize \verb? < file ... >?} \\
+   \hline
+\end{tabular}
+\\
 
 Each element may have several attributes. Some attributes are mandatory, other are optional but have a default value and other are are completely optional. Id is a special attribute used to identify an element or a group of elements. It must be unique for a kind of element. It is optional, but no reference to the corresponding element can be done if it is not defined.
 
-The XML file is split into context tags that are used to isolate IO definition from different codes or different parts of a code. No interference is possible between 2 different contexts. Each context has its own calendar and an associated timestep. In NEMO, we used the following contexts (that can be defined in any order):
-\begin{description}
-\item[contex xios]: context containing informations for XIOS \\
-\verb?   <context id="xios" ... ? 
-\item[context nemo]: contex containing IO informations for NEMO (mother grid when using AGRIF) \\
-\verb?   <context id="nemo" ... ? 
-\item[context 1\_nemo]: contex containing IO informations for NEMO child grid 1 (when using AGRIF) \\
-\verb?   <context id="1_nemo" ... ?  
-\item[context n\_nemo]: contex containing IO informations for NEMO child grid n (when using AGRIF) \\
-\verb?   <context id="n_nemo" ... ?
-\end{description}
-
-Each context tag related to NEMO (mother or child grids) is divided into 5 parts (that can be defined in any order):
-\begin{description}
-\item[field definition]: define all variables that can potentially be outputted \\
-\verb?   <field_definition ... ?
-\item[file definition]: define the netcdf files to be created and the variables they will contain \\
-\verb?   <file_definition ... ? 
-\item[axis definitions]: define vertical axis \\
-\verb?   <axis_definition ... ?
-\item[domain definitions]: define the horizontal grids \\
-\verb?   <domain_definition ... ?
-\item[grid definitions]: define the 2D and 3D grids (association of an axis and a domain) \\
-\verb?   <grid_definition ... ? 
-\end{description}
-
-the xios context contains only 1 tag:
-\begin{description}
-\item[variable definition]: define variables needed by xios. This can be seen as a kind of namelist for xios. \\
-\verb?   <variable_definition ... ? 
-\end{description}
-
-The XML file can be split in different parts to improve its readability and facilitate its use. The inclusing of XML files into the main XML file can be done through the attribute src: \\
-\verb?   <context src="./nemo_def.xml" /> ? 
-In NEMO, by default, the field and domain définition is done in 2 séparate files: \\
-NEMOGCM/CONFIG/SHARED/field\_def.xml and \\
-NEMOGCM/CONFIG/SHARED/domain\_def.xml that are included in the main iodef.xml file through the following commands: \\
-\verb?   <field_definition src="./field_def.xml" /> ? \\
-\verb?   <domain_definition src="./domain_def.xml" /> ? 
+The XML file is split into context tags that are used to isolate IO definition from different codes or different parts of a code. No interference is possible between 2 different contexts. Each context has its own calendar and an associated timestep. In NEMO, we used the following contexts (that can be defined in any order):\\
+\\
+\begin{tabular}{|p{3.0cm}|p{4.5cm}|p{4.5cm}|}
+   \hline
+   context &
+   description &
+   example \\
+   \hline
+   \hline
+   context xios &
+   context containing information for XIOS &
+   {\scriptsize \verb? <context id="xios" ...  ?} \\
+   \hline
+   context nemo &
+   context containing IO information for NEMO (mother grid when using AGRIF) &
+   {\scriptsize \verb? <context id="nemo" ... ?} \\
+   \hline
+   context 1\_nemo &
+   context containing IO information for NEMO child grid 1 (when using AGRIF) &
+   {\scriptsize \verb? <context id="1_nemo" ...  ?} \\
+   \hline
+   context n\_nemo &
+   context containing IO information for NEMO child grid n (when using AGRIF) &
+   {\scriptsize \verb? <context id="n_nemo" ...  ?} \\
+   \hline
+\end{tabular}
+\\
+
+\noindent The xios context contains only 1 tag:
+\\
+\begin{tabular}{|p{3.0cm}|p{4.5cm}|p{4.5cm}|}
+   \hline
+   context tag &
+   description &
+   example \\
+   \hline
+   \hline
+   variable\_definition &
+   define variables needed by XIOS. This can be seen as a kind of namelist for XIOS. &
+   {\scriptsize \verb? <variable_definition ... ?} \\
+   \hline
+\end{tabular}
+\\
+
+\noindent Each context tag related to NEMO (mother or child grids) is divided into 5 parts (that can be defined in any order):\\
+\\
+\begin{tabular}{|p{3.0cm}|p{4.5cm}|p{4.5cm}|}
+   \hline
+   context tag &
+   description &
+   example \\
+   \hline
+   \hline
+   field\_definition &
+   define all variables that can potentially be outputted &
+   {\scriptsize \verb? <field_definition ... ?} \\
+   \hline
+   file\_definition &
+   define the netcdf files to be created and the variables they will contain &
+   {\scriptsize \verb? <file_definition ... ?} \\
+   \hline
+   axis\_definition &
+   define vertical axis &
+   {\scriptsize \verb? <axis_definition ... ?} \\
+   \hline
+   domain\_definition &
+   define the horizontal grids &
+   {\scriptsize \verb? <domain_definition ... ?} \\
+   \hline
+   grid\_definition &
+   define the 2D and 3D grids (association of an axis and a domain) &
+   {\scriptsize \verb? <grid_definition ... ?} \\
+   \hline
+\end{tabular}
+\\
+
+\subsubsection{Nesting XML files}
+
+The XML file can be split in different parts to improve its readability and facilitate its use. The inclusion of XML files into the main XML file can be done through the attribute src: \\
+{\scriptsize \verb? <context src="./nemo_def.xml" /> ?}\\
+ 
+\noindent In NEMO, by default, the field and domain definition is done in 2 separate files:
+{\scriptsize \tt
+\begin{verbatim}
+NEMOGCM/CONFIG/SHARED/field_def.xml
+and
+NEMOGCM/CONFIG/SHARED/domain_def.xml 
+\end{verbatim}
+}
+\noindent that are included in the main iodef.xml file through the following commands: \\
+{\scriptsize \verb? <field_definition src="./field_def.xml" /> ? \\
+\verb? <domain_definition src="./domain_def.xml" /> ? }
 
 
 \subsubsection{Use of inheritance}
 
-XML extensively uses the concept of inheritance. XML has a based tree structure with a parent-child oriented relation: all children inherit attributes from parent, but an attribute defined in a child replace the inherited attribute value. Note that the special attribute ''id'' is never inherited.  \\
+XML extensively uses the concept of inheritance. XML has a tree based structure with a parent-child oriented relation: all children inherit attributes from parent, but an attribute defined in a child replace the inherited attribute value. Note that the special attribute ''id'' is never inherited.  \\
 \\
-example 1: Direct inheritance. \\
+example 1: Direct inheritance.
+\vspace{-20pt}
 \begin{alltt}  {{\scriptsize    
 \begin{verbatim}
    <field_definition operation="average" >
-      <field id="sst"                    />   <!-- averaged      sst --> 
-      <field id="sss" operation="instant"/>   <!-- instantaneous sss --> 
+     <field id="sst"                    />   <!-- averaged      sst --> 
+     <field id="sss" operation="instant"/>   <!-- instantaneous sss --> 
    </field_definition> 
 \end{verbatim}
@@ -140,55 +341,56 @@
 for example output instantaneous values instead of average values. \\
 \\
-example 2: Inheritance by reference. \\
+example 2: Inheritance by reference.
+\vspace{-20pt}
 \begin{alltt}  {{\scriptsize
 \begin{verbatim}
    <field_definition>
-      <field id="sst" long_name="sea surface temperature" />   
-      <field id="sss" long_name="sea surface salinity"    />  
+     <field id="sst" long_name="sea surface temperature" />   
+     <field id="sss" long_name="sea surface salinity"    />  
    </field_definition>      
 
    <file_definition>
-      <file id="myfile" output_freq="1d" />   
-            <field field_ref="sst"                            />  <!-- default def -->
-            <field field_ref="sss" long_name="my description" />  <!-- overwrite   -->
-      </file>   
+     <file id="myfile" output_freq="1d" />   
+       <field field_ref="sst"                            />  <!-- default def -->
+       <field field_ref="sss" long_name="my description" />  <!-- overwrite   -->
+     </file>   
    </file_definition> 
 \end{verbatim}
 }}\end{alltt} 
-Inherite (and overwrite, if needed) the attributes of a tag you are refering to.
-
-\subsubsection{Use of Group}
-
-Groups can be used fort 2 purposes. \\
-
-First, the group can be used to define common attributes to be shared by the elements of the group through the inheritance. In the following example, we define a group of field that will share a common grid ''grid\_T\_2D''. Note that for the field ''toce'', we overwrite the grid definition inherited from the group by ''grid\_T\_3D''.
+Inherit (and overwrite, if needed) the attributes of a tag you are refering to.
+
+\subsubsection{Use of Groups}
+
+Groups can be used for 2 purposes. Firstly, the group can be used to define common attributes to be shared by the elements of the group through the inheritance. In the following example, we define a group of field that will share a common grid ''grid\_T\_2D''. Note that for the field ''toce'', we overwrite the grid definition inherited from the group by ''grid\_T\_3D''.
+\vspace{-20pt}
 \begin{alltt}  {{\scriptsize
 \begin{verbatim}
    <field_group id="grid_T" grid_ref="grid_T_2D">
-      <field id="toce" long_name="temperature"             unit="degC" grid_ref="grid_T_3D"/>
-      <field id="sst"  long_name="sea surface temperature" unit="degC"                     />
-      <field id="sss"  long_name="sea surface salinity"    unit="psu"                      />
-      <field id="ssh"  long_name="sea surface height"      unit="m"                        />
+    <field id="toce" long_name="temperature"             unit="degC" grid_ref="grid_T_3D"/>
+    <field id="sst"  long_name="sea surface temperature" unit="degC"                     />
+    <field id="sss"  long_name="sea surface salinity"    unit="psu"                      />
+    <field id="ssh"  long_name="sea surface height"      unit="m"                        />
          ...
 \end{verbatim}
 }}\end{alltt} 
 
-Second, the group can be used to replace a list of elements. Several examples of groups of fields are proposed at the end of the file \\
-NEMOGCM/CONFIG/SHARED/field\_def.xml. For example, a short list of usual variables related to the U grid:
+Secondly, the group can be used to replace a list of elements. Several examples of groups of fields are proposed at the end of the file {\tt CONFIG/SHARED/field\_def.xml}. For example, a short list of the usual variables related to the U grid:
+\vspace{-20pt}
 \begin{alltt}  {{\scriptsize
 \begin{verbatim}
    <field_group id="groupU" >
-      <field field_ref="uoce"  />
-      <field field_ref="suoce" />
-      <field field_ref="utau"  />
+    <field field_ref="uoce"  />
+    <field field_ref="suoce" />
+    <field field_ref="utau"  />
    </field_group>
 \end{verbatim}
 }}\end{alltt} 
-that can be directly include in a file through the following syntaxe:
+that can be directly include in a file through the following syntax:
+\vspace{-20pt}
 \begin{alltt}  {{\scriptsize
 \begin{verbatim}
    <file id="myfile_U" output_freq="1d" />   
-      <field_group group_ref="groupU"/>  
-      <field field_ref="uocetr_eff"  />  <!-- add another field -->
+    <field_group group_ref="groupU"/>  
+    <field field_ref="uocetr_eff"  />  <!-- add another field -->
    </file>   
 \end{verbatim}
@@ -197,15 +399,17 @@
 \subsection{Detailed functionalities }
 
-The file NEMOGCM/CONFIG/ORCA2\_LIM/iodef\_demo.xml provides several examples of the use of the new functionalities offered by the XML interface of XIOS. 
+The file {\tt NEMOGCM/CONFIG/ORCA2\_LIM/iodef\_demo.xml} provides several examples of the use of the new functionalities offered by the XML interface of XIOS. 
 
 \subsubsection{Define horizontal subdomains}
-Horizontal subdomains are defined through the attributs zoom\_ibegin, zoom\_jbegin, zoom\_ni, zoom\_nj of the tag family domain. It must therefore be done in the domain part of the XML file. For example, in NEMOGCM/CONFIG/SHARED/domain\_def.xml, we provide the following example of a definition of a 5 by 5 box with the bottom left corner at point (10,10).
+Horizontal subdomains are defined through the attributs zoom\_ibegin, zoom\_jbegin, zoom\_ni, zoom\_nj of the tag family domain. It must therefore be done in the domain part of the XML file. For example, in {\tt CONFIG/SHARED/domain\_def.xml}, we provide the following example of a definition of a 5 by 5 box with the bottom left corner at point (10,10).
+\vspace{-20pt}
 \begin{alltt}  {{\scriptsize
 \begin{verbatim}
    <domain_group id="grid_T">
-      <domain id="myzoom" zoom_ibegin="10" zoom_jbegin="10" zoom_ni="5" zoom_nj="5" />
+    <domain id="myzoom" zoom_ibegin="10" zoom_jbegin="10" zoom_ni="5" zoom_nj="5" />
 \end{verbatim}
 }}\end{alltt} 
 The use of this subdomain is done through the redefinition of the attribute domain\_ref of the tag family field. For example:
+\vspace{-20pt}
 \begin{alltt}  {{\scriptsize
 \begin{verbatim}
@@ -216,4 +420,5 @@
 }}\end{alltt} 
 Moorings are seen as an extrem case corresponding to a 1 by 1 subdomain. The Equatorial section, the TAO, RAMA and PIRATA moorings are alredy registered in the code and can therefore be outputted without taking care of their (i,j) position in the grid. These predefined domains can be activated by the use of specific domain\_ref: ''EqT'', ''EqU'' or ''EqW'' for the equatorial sections and the mooring position for TAO, RAMA and PIRATA followed by ''T'' (for example: ''8s137eT'', ''1.5s80.5eT'' ...)
+\vspace{-20pt}
 \begin{alltt}  {{\scriptsize
 \begin{verbatim}
@@ -227,4 +432,5 @@
 \subsubsection{Define vertical zooms}
 Vertical zooms are defined through the attributs zoom\_begin and zoom\_end of the tag family axis. It must therefore be done in the axis part of the XML file. For example, in NEMOGCM/CONFIG/ORCA2\_LIM/iodef\_demo.xml, we provide the following example:
+\vspace{-20pt}
 \begin{alltt}  {{\scriptsize
 \begin{verbatim}
@@ -235,4 +441,5 @@
 }}\end{alltt} 
 The use of this vertical zoom is done through the redefinition of the attribute axis\_ref of the tag family field. For example:
+\vspace{-20pt}
 \begin{alltt}  {{\scriptsize
 \begin{verbatim}
@@ -246,4 +453,5 @@
 
 The output file names are defined by the attributs ''name'' and ''name\_suffix'' of the tag family file. for example:
+\vspace{-20pt}
 \begin{alltt}  {{\scriptsize
 \begin{verbatim}
@@ -258,10 +466,9 @@
 \end{verbatim}
 }}\end{alltt} 
-However it is also often very convienent to define the file name with the name of the experience, the output file frequency and the date of the beginning and the end of the simulation (which are informations stored either in the namelist or in the XML file). To do so, we added the following rule: if the id of the tag file is ''fileN''(where N = 1 to 99) or one of the predefined section or mooring (see next subsection), the following part of the name and the name\_suffix (that can be inherited) will be automatically replaced by: \\
+However it is often very convienent to define the file name with the name of the experience, the output file frequency and the date of the beginning and the end of the simulation (which are informations stored either in the namelist or in the XML file). To do so, we added the following rule: if the id of the tag file is ''fileN''(where N = 1 to 99) or one of the predefined section or mooring (see next subsection), the following part of the name and the name\_suffix (that can be inherited) will be automatically replaced by:\\
 \\
 \begin{tabular}{|p{4cm}|p{8cm}|}
    \hline
-   \centering part of the name automatically to be replaced &
-   by \\
+   \centering placeholder string & automatically  replaced by \\
    \hline
    \hline
@@ -284,18 +491,15 @@
    ending date of the simulation (from nn\_date0 and nn\_itend in the namelist). \verb?yyyymmdd_hh:mm:ss? format \\
    \hline
-\end{tabular}
+\end{tabular}\\
 \\
 
-For example, 
-
-\begin{alltt}  {{\scriptsize
+\noindent For example, 
+{{\scriptsize
 \begin{verbatim}
    <file id="myfile_hzoom" name="myfile_@expname@_@startdate@_freq@freq@" output_freq="1d" >
 \end{verbatim}
-}}\end{alltt} 
-
-With, in the namelist:
-
-\begin{alltt}  {{\scriptsize
+}}
+\noindent with the namelist:
+{{\scriptsize
 \begin{verbatim}
    cn_exp      =  "ORCA2"
@@ -303,20 +507,17 @@
    ln_rstart   = .false.
 \end{verbatim}
-}}\end{alltt} 
-
-will give the following file name radical:
-
-\begin{alltt}  {{\scriptsize
+}}
+\noindent will give the following file name radical:
+{{\scriptsize
 \begin{verbatim}
    myfile_ORCA2_19891231_freq1d 
 \end{verbatim}
-}}\end{alltt} 
-
+}}
 
 \subsubsection{Other controls of the xml attributes from NEMO}
 
-The values of some attributes are automatically defined by NEMO (and any definition given in the xml file is overwritten). By convention, these attributes are defined to ''auto'' (for string) or ''0000'' (for integer) in the xml file (but this is not necessary). 
-
-Here is the list of these attributes: \\
+The values of some attributes are defined by subroutine calls within NEMO (calls to iom\_set\_domain\_attr, iom\_set\_axis\_attr and iom\_set\_field\_attr in iom.F90). Any definition given in the xml file will be overwritten. By convention, these attributes are defined to ''auto'' (for string) or ''0000'' (for integer) in the xml file (but this is not necessary). 
+
+Here is the list of these attributes:\\
 \\
 \begin{tabular}{|l|c|c|c|}
@@ -343,8 +544,9 @@
 
 
+\subsection{XML reference tables}
+
 \subsubsection{Tag list}
 
-
-\begin{tabular}{|p{2cm}|p{2.5cm}|p{3.5cm}|p{2cm}|p{2cm}|}
+\begin{longtable}{|p{2.2cm}|p{2.5cm}|p{3.5cm}|p{2.2cm}|p{1.6cm}|}
    \hline
    tag name & 
@@ -352,6 +554,5 @@
    accepted attribute & 
    child of &
-   parent of \\
-   \hline   
+   parent of \endhead
    \hline   
    simulation & 
@@ -362,8 +563,8 @@
    \hline   
    context &
-   encapsulates parts of the xml file dédicated to different codes or different parts of a code &
+   encapsulates parts of the xml file dedicated to different codes or different parts of a code &
    id (''xios'', ''nemo'' or ''n\_nemo'' for the nth AGRIF zoom), src, time\_origin &
    simulation &
-   all root tags: ...\_definition \\
+   all root tags: ... \_definition \\
    \hline   
    \hline   
@@ -400,18 +601,8 @@
    \hline   
    file & 
-   defile the contentof a file to be outputted &
+   define the contents of a file to be outputted &
    enabled, description, id, min\_digits, name, name\_suffix, output\_freq, output\_level, split\_format, split\_freq, sync\_freq, type, src &
    file\_definition, file\_group & 
    field \\
-   \hline   
-\end{tabular}
-\begin{tabular}{|p{2cm}|p{2.5cm}|p{3.5cm}|p{2cm}|p{2cm}|}
-   \hline
-   tag name & 
-   description & 
-   accepted attribute & 
-   child of &
-   parent of \\
-   \hline   
    \hline   
    axis\_definition & 
@@ -434,20 +625,20 @@
    \hline   
    \hline   
-   domain\_definition & 
+   domain\_\-definition & 
    define all the horizontal domains potentially used by the variables &
    src &
    context & 
-   domain\_group, domain \\
+   domain\_\-group, domain \\
    \hline   
    domain\_group & 
    encapsulates a group of horizontal domains &
    id, lon\_name, src, zoom\_ibegin, zoom\_jbegin, zoom\_ni, zoom\_nj &
-   domain\_definition, domain\_group & 
-   domain\_group, domain \\
+   domain\_\-definition, domain\_group & 
+   domain\_\-group, domain \\
    \hline   
    domain & 
    define an horizontal domain &
    id, lon\_name, src, zoom\_ibegin, zoom\_jbegin, zoom\_ni, zoom\_nj &
-   domain\_definition, domain\_group & 
+   domain\_\-definition, domain\_group & 
    none \\
    \hline   
@@ -471,11 +662,86 @@
    none \\
    \hline   
-\end{tabular}
+\end{longtable}
 
 
 \subsubsection{Attributes list}
 
-\begin{tabular}{|p{2cm}|p{4cm}|p{4cm}|p{2cm}|}
-   \hline
+\begin{longtable}{|p{2.2cm}|p{4cm}|p{3.8cm}|p{2cm}|}
+   \hline
+   attribute name & 
+   description & 
+   example & 
+   accepted by \endhead
+   \hline   
+   axis\_ref & 
+   refers to the id of a vertical axis & 
+   axis\_ref="deptht" & 
+   field, grid families \\ 
+   \hline   
+   enabled & 
+   switch on/off the output of a field or a file & 
+   enabled=".TRUE." & 
+   field, file families \\ 
+   \hline   
+   default\_value & 
+   missing\_value definition & 
+   default\_value="1.e20" & 
+   field family \\ 
+   \hline   
+   description & 
+   just for information, not used & 
+   description="ocean T grid variables" & 
+   all tags \\ 
+   \hline   
+   domain\_ref & 
+   refers to the id of a domain & 
+   domain\_ref="grid\_T" & 
+   field or grid families \\ 
+   \hline   
+   field\_ref & 
+   id of the field we want to add in a file & 
+   field\_ref="toce" & 
+   field \\ 
+   \hline   
+   grid\_ref & 
+   refers to the id of a grid & 
+   grid\_ref="grid\_T\_2D" & 
+   field family \\ 
+   \hline   
+   group\_ref & 
+   refer to a group of variables & 
+   group\_ref="mooring" & 
+   field\_group \\ 
+   \hline   
+   id & 
+   allow to identify a tag & 
+   id="nemo" &
+   accepted by all tags except simulation \\ 
+   \hline   
+   level & 
+   output priority of a field: 0 (high) to 10 (low)& 
+   level="1" & 
+   field family \\ 
+   \hline   
+   long\_name & 
+   define the long\_name attribute in the NetCDF file & 
+   long\_name="Vertical T levels" & 
+   field \\ 
+   \hline   
+   min\_digits & 
+   specify the minimum of digits used in the core number in the name of the NetCDF file & 
+   min\_digits="4" & 
+   file family \\ 
+   \hline   
+   name & 
+   name of a variable or a file. If the name of a file is undefined, its id is used as a name & 
+   name="tos" & 
+   field or file families \\ 
+   \hline   
+   name\_suffix & 
+   suffix to be inserted after the name and before the cpu number and the ''.nc'' termination of a file & 
+   name\_suffix="\_myzoom" & 
+   file family \\ 
+   \hline   
    attribute name & 
    description & 
@@ -484,77 +750,54 @@
    \hline   
    \hline   
-   axis\_ref & 
-   refers to the id of a vertical axis & 
-   axis\_ref="deptht" & 
-   field, grid families \\ 
-   \hline   
-   enabled & 
-   switch on/off the output of a field or a file & 
-   enabled=".TRUE." & 
-   field, file families \\ 
-   \hline   
-   default\_value & 
-   missing\_value definition & 
-   default\_value="1.e20" & 
+   operation & 
+   type of temporal operation: average, accumulate, instantaneous, min, max and once & 
+   operation="average" & 
    field family \\ 
    \hline   
-   description & 
-   just for information, not used & 
-   description="ocean T grid variables" & 
-   all tags \\ 
-   \hline   
-   domain\_ref & 
-   refers to the id of a domain & 
-   domain\_ref="grid\_T" & 
-   field or grid families \\ 
-   \hline   
-   field\_ref= & 
-   id of the field we want to add in a file & 
-   field\_ref="toce" & 
+   output\_freq & 
+   operation frequency. units can be ts (timestep), y, mo, d, h, mi, s. & 
+   output\_freq="1d12h" & 
+   field family \\ 
+   \hline   
+   output\_level & 
+   output priority of variables in a file: 0 (high) to 10 (low). All variables listed in the file with a level smaller or equal to output\_level will be output. Other variables won't be output even if they are listed in the file. &  
+   output\_level="10"& 
+   file family \\ 
+   \hline   
+   positive & 
+   convention used for the orientation of vertival axis (positive downward in \NEMO). & 
+   positive="down" & 
+   axis family \\ 
+   \hline   
+   prec & 
+   output precision: real 4 or real 8 & 
+   prec="4" & 
+   field family \\ 
+   \hline   
+   split\_format & 
+   date format used in the name of splitted output files. can be spécified using the following syntaxe: \%y, \%mo, \%d, \%h \%mi and \%s & 
+   split\_format= "\%yy\%mom\%dd" & 
+   file family \\ 
+   \hline   
+   split\_freq & 
+   split output files frequency. units can be ts (timestep), y, mo, d, h, mi, s. & 
+   split\_freq="1mo" & 
+   file family \\ 
+   \hline   
+   src & 
+   allow to include a file & 
+   src="./field\_def.xml" & 
+   accepted by all tags except simulation \\ 
+   \hline   
+   standard\_name & 
+   define the standard\_name attribute in the NetCDF file & 
+   standard\_name= "Eastward\_Sea\_Ice\_Transport" & 
    field \\ 
    \hline   
-   grid\_ref & 
-   refers to the id of a grid & 
-   grid\_ref="grid\_T\_2D" & 
-   field family \\ 
-   \hline   
-   group\_ref & 
-   refer to a group of variables & 
-   group\_ref="mooring" & 
-   field\_group \\ 
-   \hline   
-   id & 
-   allow to identify a tag & 
-   id="nemo" &
-   accepted by all tags except simulation \\ 
-   \hline   
-   level & 
-   output priority of a field: 0 (high) to 10 (low)& 
-   level="1" & 
-   field family \\ 
-   \hline   
-   long\_name & 
-   define the long\_name attribute in the NetCDF file & 
-   long\_name="Vertical T levels" & 
-   field \\ 
-   \hline   
-   min\_digits & 
-   specify the minimum of digits used in the core number in the name of the NetCDF file & 
-   min\_digits="4" & 
+   sync\_freq & 
+   NetCDF file synchronization frequency (update of the time\_counter). units can be ts (timestep), y, mo, d, h, mi, s. & 
+   sync\_freq="10d" & 
    file family \\ 
    \hline   
-   name & 
-   name of a variable or a file. If the name of a file is undefined, its id is used as a name & 
-   name="tos" & 
-   field or file families \\ 
-   \hline   
-   name\_suffix & 
-   suffix to be inserted after the name and before the cpu number and the ''.nc'' termination of a file & 
-   name\_suffix="\_myzoom" & 
-   file family \\ 
-   \hline   
-\end{tabular}
-\begin{tabular}{|p{2cm}|p{4cm}|p{4cm}|p{2cm}|}
-   \hline
    attribute name & 
    description & 
@@ -563,63 +806,4 @@
    \hline   
    \hline   
-   operation & 
-   type of temporal operation: average, accumulate, instantaneous, min, max and once & 
-   operation="average" & 
-   field family \\ 
-   \hline   
-   output\_freq & 
-   operation frequency. units can be ts (timestep), y, mo, d, h, mi, s. & 
-   output\_freq="1d12h" & 
-   field family \\ 
-   \hline   
-   output\_level & 
-   output priority of variables in a file: 0 (high) to 10 (low). All variables listed in the file with a level smaller or equal to output\_level will be output. Other variables won't be output even if they are listed in the file. &  
-   output\_level="10"& 
-   file family \\ 
-   \hline   
-   positive & 
-   convention used for the orientation of vertival axis (positive downward in \NEMO). & 
-   positive="down" & 
-   axis family \\ 
-   \hline   
-   prec & 
-   output precision: real 4 or real 8 & 
-   prec="4" & 
-   field family \\ 
-   \hline   
-   split\_format & 
-   date format used in the name of splitted output files. can be spécified using the following syntaxe: \%y, \%mo, \%d, \%h \%mi and \%s & 
-   split\_format="\%yy\%mom\%dd" & 
-   file family \\ 
-   \hline   
-   split\_freq & 
-   split output files frequency. units can be ts (timestep), y, mo, d, h, mi, s. & 
-   split\_freq="1mo" & 
-   file family \\ 
-   \hline   
-   src & 
-   allow to include a file & 
-   src="./field\_def.xml" & 
-   accepted by all tags except simulation \\ 
-   \hline   
-   standard\_name & 
-   define the standard\_name attribute in the NetCDF file & 
-   standard\_name="Eastward\_Sea\_Ice\_Transport" & 
-   field \\ 
-   \hline   
-   sync\_freq & 
-   NetCDF file synchronization frequency (update of the time\_counter). units can be ts (timestep), y, mo, d, h, mi, s. & 
-   sync\_freq="10d" & 
-   file family \\ 
-   \hline   
-\end{tabular}
-\begin{tabular}{|p{2cm}|p{4cm}|p{4cm}|p{2cm}|}
-   \hline
-   attribute name & 
-   description & 
-   example & 
-   accepted by \\ 
-   \hline   
-   \hline   
    time\_origin & 
    specify the origin of the time counter & 
@@ -628,5 +812,5 @@
    \hline   
    type (1)& 
-   specify if the output files must be splitted (multiple\_file) or not (one\_file) & 
+   specify if the output files must be split (multiple\_file) or not (one\_file) & 
    type="multiple\_file" & 
    file familly \\ 
@@ -662,97 +846,6 @@
    domain family \\ 
    \hline   
-\end{tabular}
-
-\subsection{XIOS: the IO\_SERVER}
-
-\subsubsection{Attached or detached mode?}
-
-Iomput is based on \href{http://forge.ipsl.jussieu.fr/ioserver/wiki}{XIOS}, the io\_server developed by Yann Meurdesoif from IPSL. This server can be used in ''attached mode'' (as a library) or in ''detached mode'' (as an external executable on n cpus). The ''attached mode'' is simpler to use but much less efficient. If the type of file is ''multiple\_file'', then in attached(detached) mode, each NEMO(XIOS) process will output its own subdomain: if NEMO(XIOS) is runnning on N cores, the ouput files will be splitted into N files. If the type of file is ''one\_file'', the output files will be directly recombined into one unique file either in ''detached mode'' or ''attached mode''.  
-
-\subsubsection{Control of xios: the xios context in iodef.xml}
-
-The control of the use of xios is done through the xios context in iodef.xml.
-
-\begin{tabular}{|p{3cm}|p{6.5cm}|p{2.5cm}|}
-   \hline
-   variable name & 
-   description & 
-   example \\ 
-   \hline   
-   \hline
-   buffer\_size & 
-   buffer size used by XIOS to send data from NEMO to XIOS. Larger is more efficient. Note that needed/used buffer sizes are summarized at the end of the job & 
-   25000000 \\ 
-   \hline   
-   buffer\_server\_factor\_size & 
-   ratio between NEMO and XIOS buffer size. Should be 2. & 
-   2 \\ 
-   \hline
-   info\_level & 
-   verbosity level (0 to 100) & 
-   0 \\ 
-   \hline
-   using\_server & 
-   activate attached(false) or detached(true) mode & 
-   true \\ 
-   \hline
-   using\_oasis & 
-   xios is used with OASIS(true) or not (false) & 
-   false \\ 
-   \hline
-   oasis\_codes\_id & 
-   when using oasis, define the identifier of NEMO in the namcouple. Not that the identifier of XIOS is xios.x & 
-   oceanx \\ 
-   \hline   
-\end{tabular}
-
-\subsubsection{Number of cpu used by XIOS in detached mode}
-
-The number of cores used by the xios is specified only when launching the model. The number or cores dedicated to XIOS should be from ~1/10 to ~1/50 of the number or cores dedicated to NEMO (according of the amount of data to be created). Here is an example of 2 cpus for the io\_server and 62 cpu for opa using mpirun:
-
-\texttt{ mpirun -np 2 ./nemo.exe : -np 62 ./xios\_server.exe }
-
-\subsection{Practical issues}
-
-\subsubsection{Add your own outputs}
-
-It is very easy to add you own outputs with iomput. 4 points must be followed.
-\begin{description}
-\item[1-] in NEMO code, add a \\
-\texttt{      CALL iom\_put( 'identifier', array ) } \\
-where you want to output a 2D or 3D array.
-
-\item[2-] don't forget to add \\
-\texttt{   USE iom            ! I/O manager library }  \\
-in the list of used modules in the upper part of your module. 
-
-\item[3-] in the file\_definition part of the xml file, add the definition of your variable using the same identifier you used in the f90 code.
-\vspace{-20pt}
-\begin{alltt}  {{\scriptsize
-\begin{verbatim}
-   <field_definition>
-      ...
-      <field id="identifier" long_name="blabla" ... />   
-      ...
-   </field_definition> 
-\end{verbatim}
-}}\end{alltt} 
-attributes axis\_ref and grid\_ref must be consistent with the size of the array to pass to iomput.
-if your array is computed within the surface module each nn\_fsbc time\_step, 
-add the field definition within the group defined with the id ''SBC'': $<$group id=''SBC''...$>$
-
-\item[4-] add your field in one of the output files   \\
-\vspace{-20pt}
-\begin{alltt}  {{\scriptsize
-\begin{verbatim}
-   <file id="file1" .../>   
-      ...
-      <field ref="identifier" />   
-      ...
-   </file>   
-\end{verbatim}
-}}\end{alltt} 
-
-\end{description}
+\end{longtable}
+
 
 
@@ -809,4 +902,5 @@
 domain size in any dimension. The algorithm used is:
 
+\vspace{-20pt}
 \begin{alltt}  {{\scriptsize 
 \begin{verbatim}
Index: branches/2013/dev_CMCC_2013/NEMOGCM/ARCH/arch-X64_CURIE.fcm
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/ARCH/arch-X64_CURIE.fcm	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/ARCH/arch-X64_CURIE.fcm	(revision 4175)
@@ -29,6 +29,6 @@
 #  - fcm variables are starting with a % (and not a $)
 #
-%NCDF_HOME           /usr/local/netcdf-4.2_hdf5
-%HDF5_HOME           /usr/local/hdf5-1.8.8
+%NCDF_HOME           /usr/local/netcdf-4.2_hdf5_parallel
+%HDF5_HOME           /usr/local/hdf5-1.8.9_parallel
 %XIOS_HOME           $WORKDIR/now/models/xios
 %OASIS_HOME          $WORKDIR/now/models/oa3mct
Index: branches/2013/dev_CMCC_2013/NEMOGCM/ARCH/arch-X64_YELLOWSTONE.fcm
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/ARCH/arch-X64_YELLOWSTONE.fcm	(revision 4175)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/ARCH/arch-X64_YELLOWSTONE.fcm	(revision 4175)
@@ -0,0 +1,53 @@
+# Yellowstone IBM at NCAR, http://www2.cisl.ucar.edu/resources/yellowstone
+#
+# NCDF_HOME   root directory containing lib and include subdirectories for netcdf4
+# HDF5_HOME   root directory containing lib and include subdirectories for HDF5
+# XIOS_HOME   root directory containing lib for XIOS
+# OASIS_HOME  root directory containing lib for OASIS
+#
+# NCDF_INC    netcdf4 include file
+# NCDF_LIB    netcdf4 library
+# XIOS_INC    xios include file    (taken into accound only if key_iomput is activated)
+# XIOS_LIB    xios library         (taken into accound only if key_iomput is activated)
+# OASIS_INC   oasis include file   (taken into accound only if key_oasis3 is activated)
+# OASIS_LIB   oasis library        (taken into accound only if key_oasis3 is activated)
+#
+# FC          Fortran compiler command
+# FCFLAGS     Fortran compiler flags
+# FFLAGS      Fortran 77 compiler flags
+# LD          linker
+# LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries
+# FPPFLAGS    pre-processing flags
+# AR          assembler
+# ARFLAGS     assembler flags
+# MK          make
+# USER_INC    complete list of include files
+# USER_LIB    complete list of libraries to pass to the linker
+#
+# Note that:
+#  - unix variables "$..." are accpeted and will be evaluated before calling fcm.
+#  - fcm variables are starting with a % (and not a $)
+#
+%NCDF_HOME           /glade/apps/opt/netcdf-mpi/4.2/intel/12.1.4
+%HDF5_HOME           /glade/apps/opt/hdf5-mpi/1.8.9/intel/12.1.4
+%XIOS_HOME           /glade/p/work/$( whoami )/now/models/xios
+%OASIS_HOME          /glade/p/work/$( whoami )/now/models/oa3mct
+
+%NCDF_INC            -I%NCDF_HOME/include 
+%NCDF_LIB            -L%NCDF_HOME/lib -lnetcdff -lnetcdf -L%HDF5_HOME/lib -lhdf5_hl -lhdf5 -lhdf5
+%XIOS_INC            -I%XIOS_HOME/inc 
+%XIOS_LIB            -L%XIOS_HOME/lib -lxios
+%OASIS_INC           -I%OASIS_HOME/build/lib/mct -I%OASIS_HOME/build/lib/psmile.MPI1
+%OASIS_LIB           -L%OASIS_HOME/lib -lpsmile.MPI1 -lmct -lmpeu -lscrip
+
+%FC                  mpif90 -c -cpp
+%FCFLAGS            -i4 -r8 -O3 -fp-model precise -xAVX
+%FFLAGS              %FCFLAGS
+%LD                  mpif90
+%LDFLAGS             -lstdc++
+%FPPFLAGS            -P -C -traditional
+%AR                  ar
+%ARFLAGS             rs
+%MK                  gmake
+%USER_INC            %XIOS_INC %OASIS_INC %NCDF_INC
+%USER_LIB            %XIOS_LIB %OASIS_LIB %NCDF_LIB
Index: branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/AMM12/EXP00/iodef.xml
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/AMM12/EXP00/iodef.xml	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/AMM12/EXP00/iodef.xml	(revision 4175)
@@ -62,4 +62,5 @@
       <axis id="depthw" long_name="Vertical W levels" unit="m" positive="down" />
       <axis id="nfloat" long_name="Float number"      unit="-"  />
+      <axis id="icbcla" long_name="Iceberg class"     unit="-"  />
    </axis_definition> 
     
Index: branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/GYRE/EXP00/iodef.xml
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/GYRE/EXP00/iodef.xml	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/GYRE/EXP00/iodef.xml	(revision 4175)
@@ -92,4 +92,5 @@
       <axis id="depthw" long_name="Vertical W levels" unit="m" positive="down" />
       <axis id="nfloat" long_name="Float number"      unit="-"  />
+      <axis id="icbcla" long_name="Iceberg class"     unit="-"  />
    </axis_definition> 
     
Index: branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/GYRE_BFM/EXP00/iodef.xml
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/GYRE_BFM/EXP00/iodef.xml	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/GYRE_BFM/EXP00/iodef.xml	(revision 4175)
@@ -62,4 +62,5 @@
       <axis id="depthw" long_name="Vertical W levels" unit="m" positive="down" />
       <axis id="nfloat" long_name="Float number"      unit="-"  />
+      <axis id="icbcla" long_name="Iceberg class"     unit="-"  />
    </axis_definition> 
     
Index: branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/iodef.xml
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/iodef.xml	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/iodef.xml	(revision 4175)
@@ -128,4 +128,5 @@
       <axis id="depthw" long_name="Vertical W levels" unit="m" positive="down" />
       <axis id="nfloat" long_name="Float number"      unit="-"  />
+      <axis id="icbcla" long_name="Iceberg class"     unit="-"  />
    </axis_definition> 
     
Index: branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_ar5.xml
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_ar5.xml	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_ar5.xml	(revision 4175)
@@ -248,4 +248,5 @@
       <axis id="depthw" long_name="Vertical W levels" unit="m" positive="down" />
       <axis id="nfloat" long_name="Float number"      unit="-"  />
+      <axis id="icbcla" long_name="Iceberg class"     unit="-"  />
    </axis_definition> 
     
Index: branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_default.xml
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_default.xml	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_default.xml	(revision 4175)
@@ -129,4 +129,5 @@
       <axis id="depthw" long_name="Vertical W levels" unit="m" positive="down" />
       <axis id="nfloat" long_name="Float number"      unit="-"  />
+      <axis id="icbcla" long_name="Iceberg class"     unit="-"  />
    </axis_definition> 
     
Index: branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_demo.xml
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_demo.xml	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_demo.xml	(revision 4175)
@@ -44,6 +44,6 @@
 	<!-- mooring: automatic definition of the file name suffix based on id="0n180wT"  -->
 	<!-- include a group of variables. see field_def.xml for mooring variables definition  -->
-	<file id="0n180wT" >
-	  <field_group group_ref="mooring"/>  
+	<file id="0n180wT">
+	  <field_group group_ref="mooring" domain_ref="0n180wT" />  
 	</file>
 	
@@ -53,4 +53,5 @@
 	  <field_group id="EqT" domain_ref="EqT" >
 	    <field field_ref="toce" name="votemper" axis_ref="deptht_myzoom"  />
+	    <field field_ref="sss" />
 	  </field_group>
 	</file>
@@ -85,4 +86,5 @@
       <axis id="depthw" long_name="Vertical W levels" unit="m" positive="down" />
       <axis id="nfloat" long_name="Float number"      unit="-"  />
+      <axis id="icbcla" long_name="Iceberg class"     unit="-"  />
    </axis_definition> 
     
Index: branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_oldstyle.xml
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_oldstyle.xml	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_oldstyle.xml	(revision 4175)
@@ -116,4 +116,5 @@
       <axis id="depthw" long_name="Vertical W levels" unit="m" positive="down" />
       <axis id="nfloat" long_name="Float number"      unit="-"  />
+      <axis id="icbcla" long_name="Iceberg class"     unit="-"  />
    </axis_definition> 
     
Index: branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/iodef.xml
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/iodef.xml	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/iodef.xml	(revision 4175)
@@ -21,5 +21,5 @@
     -->
     
-    <file_definition type="multiple_file" sync_freq="1d" min_digits="4">
+    <file_definition type="multiple_file" name="@expname@_@freq@_@startdate@_@enddate@" sync_freq="1d" min_digits="4">
     
       <file_group id="1h" output_freq="1h"  output_level="10" enabled=".TRUE."/> <!-- 1h files -->
@@ -60,4 +60,5 @@
       <axis id="depthw" long_name="Vertical W levels" unit="m" positive="down" />
       <axis id="nfloat" long_name="Float number"      unit="-"  />
+      <axis id="icbcla" long_name="Iceberg class"     unit="-"  />
    </axis_definition> 
     
Index: branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/iodef.xml
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/iodef.xml	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/iodef.xml	(revision 4175)
@@ -21,5 +21,5 @@
     -->
     
-    <file_definition type="multiple_file" sync_freq="1d" min_digits="4">
+    <file_definition type="multiple_file" name="@expname@_@freq@_@startdate@_@enddate@" sync_freq="10d" min_digits="4">
     
       <file_group id="1h" output_freq="1h"  output_level="10" enabled=".TRUE."/> <!-- 1h files -->
@@ -31,5 +31,5 @@
       <file_group id="1d" output_freq="1d"  output_level="10" enabled=".TRUE."> <!-- 1d files -->
 
-	<file id="1d_grid_T" name="auto" description="ocean T grid variables" >
+	<file id="file1" name_suffix="_grid_T" description="ocean T grid variables" >
 	  <field field_ref="sst"          name="sosstsst"  />
 	  <field field_ref="sss"          name="sosaline"  />
@@ -37,9 +37,9 @@
 	</file>
 
-	<file id="1d_grid_U" name="auto" description="ocean U grid variables" >
+	<file id="file2" name_suffix="_grid_U" description="ocean U grid variables" >
 	  <field field_ref="suoce"         name="vozocrtx"  />
 	</file>
 	
-	<file id="1d_grid_V" name="auto" description="ocean V grid variables" >
+	<file id="file3" name_suffix="_grid_V" description="ocean V grid variables" >
 	  <field field_ref="svoce"         name="vomecrty"  />
 	</file>
@@ -49,5 +49,5 @@
       <file_group id="5d" output_freq="5d"  output_level="10" enabled=".TRUE.">  <!-- 5d files -->   
 
-	<file id="5d_grid_T" name="auto" description="ocean T grid variables" >
+	<file id="file4" name_suffix="_grid_T" description="ocean T grid variables" >
 	  <field field_ref="toce"         name="votemper"  />
 	  <field field_ref="soce"         name="vosaline"  />
@@ -69,5 +69,5 @@
 	</file>
 	
-	<file id="5d_grid_U" name="auto" description="ocean U grid variables" >
+	<file id="file5" name_suffix="_grid_U" description="ocean U grid variables" >
 	  <field field_ref="uoce"         name="vozocrtx"  />
 	  <field field_ref="uoce_eiv"     name="vozoeivu"  />
@@ -75,5 +75,5 @@
 	</file>
 	
-	<file id="5d_grid_V" name="auto" description="ocean V grid variables" >
+	<file id="file6" name_suffix="_grid_V" description="ocean V grid variables" >
 	  <field field_ref="voce"         name="vomecrty"  />
 	  <field field_ref="voce_eiv"     name="vomeeivv"  />
@@ -81,5 +81,5 @@
 	</file>
 	
-	<file id="5d_grid_W" name="auto" description="ocean W grid variables" >
+	<file id="file7" name_suffix="_grid_W" description="ocean W grid variables" >
 	  <field field_ref="woce"         name="vovecrtz" />
 	  <field field_ref="avt"          name="votkeavt" />
@@ -88,5 +88,5 @@
 	</file>
 	
-	<file id="5d_icemod" name="auto" description="ice variables" >
+	<file id="file8" name_suffix="_icemod" description="ice variables" >
 	  <field field_ref="ice_pres"                     />
 	  <field field_ref="snowthic_cea" name="isnowthi" />
@@ -108,5 +108,5 @@
       <file_group id="1m" output_freq="1mo" output_level="10" enabled=".TRUE."> <!-- real monthly files -->
 
-	<file id="1m_ptrc_T" name="auto" description="pisces sms variables" >
+	<file id="file9" name_suffix="_ptrc_T" description="pisces sms variables" >
           <field field_ref="DIC"      />
           <field field_ref="Alkalini" />
@@ -120,5 +120,5 @@
 	</file>
 	
-	<file id="1m_diad_T" name="auto" description="additional pisces diagnostics" >
+	<file id="file10" name_suffix="_diad_T" description="additional pisces diagnostics" >
           <field field_ref="Cflx"     />
           <field field_ref="Dpco2"    />
@@ -133,5 +133,5 @@
       <file_group id="1y"  output_freq="1y" output_level="10" enabled=".TRUE."> <!-- real yearly files -->
 
-	<file id="1y_ptrc_T" name="auto" description="pisces sms variables" >
+	<file id="file11" name_suffix="_ptrc_T" description="pisces sms variables" >
           <field field_ref="DIC"      />
           <field field_ref="Alkalini" />
@@ -160,5 +160,5 @@
 	</file>
 
-	<file id="1y_diad_T" name="auto" description="additional pisces diagnostics" >
+	<file id="file12" name_suffix="_diad_T" description="additional pisces diagnostics" >
           <field field_ref="PH"       />
           <field field_ref="CO3"      />
@@ -230,4 +230,5 @@
       <axis id="depthw" long_name="Vertical W levels" unit="m" positive="down" />
       <axis id="nfloat" long_name="Float number"      unit="-"  />
+      <axis id="icbcla" long_name="Iceberg class"     unit="-"  />
    </axis_definition> 
     
Index: branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/iodef.xml
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/iodef.xml	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/iodef.xml	(revision 4175)
@@ -21,5 +21,5 @@
     -->
     
-    <file_definition type="multiple_file" sync_freq="1d" min_digits="4">
+    <file_definition type="multiple_file" name="@expname@_@freq@_@startdate@_@enddate@" sync_freq="1d" min_digits="4">
     
       <file_group id="1h" output_freq="1h"  output_level="10" enabled=".TRUE."/> <!-- 1h files -->
@@ -35,5 +35,5 @@
       <file_group id="1m" output_freq="1mo" output_level="10" enabled=".TRUE."> <!-- real monthly files -->
 
-	<file id="1m_ptrc_T" name="auto" description="pisces sms variables" >
+	<file id="file1" name_suffix="_ptrc_T" description="pisces sms variables" >
           <field field_ref="DIC"      />
           <field field_ref="Alkalini" />
@@ -47,5 +47,5 @@
 	</file>
 	
-	<file id="1m_diad_T" name="auto" description="additional pisces diagnostics" >
+	<file id="file2" name_suffix="_diad_T" description="additional pisces diagnostics" >
           <field field_ref="Cflx"     />
           <field field_ref="Dpco2"    />
@@ -60,5 +60,5 @@
       <file_group id="1y"  output_freq="1y" output_level="10" enabled=".TRUE."> <!-- real yearly files -->
 
-	<file id="1y_ptrc_T" name="auto" description="pisces sms variables" >
+	<file id="file3" name_suffix="_ptrc_T" description="pisces sms variables" >
           <field field_ref="DIC"      />
           <field field_ref="Alkalini" />
@@ -87,5 +87,5 @@
 	</file>
 
-	<file id="1y_diad_T" name="auto" description="additional pisces diagnostics" >
+	<file id="file4" name_suffix="_diad_T" description="additional pisces diagnostics" >
           <field field_ref="PH"       />
           <field field_ref="CO3"      />
@@ -157,4 +157,5 @@
       <axis id="depthw" long_name="Vertical W levels" unit="m" positive="down" />
       <axis id="nfloat" long_name="Float number"      unit="-"  />
+      <axis id="icbcla" long_name="Iceberg class"     unit="-"  />
    </axis_definition> 
     
Index: branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_SAS_LIM/EXP00/iodef.xml
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_SAS_LIM/EXP00/iodef.xml	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/ORCA2_SAS_LIM/EXP00/iodef.xml	(revision 4175)
@@ -21,5 +21,5 @@
     -->
     
-    <file_definition type="multiple_file" sync_freq="1d" min_digits="4">
+    <file_definition type="multiple_file" name="@expname@_@freq@_@startdate@_@enddate@" sync_freq="1d" min_digits="4">
     
       <file_group id="1h" output_freq="1h"  output_level="10" enabled=".TRUE."/> <!-- 1h files -->
@@ -60,4 +60,5 @@
       <axis id="depthw" long_name="Vertical W levels" unit="m" positive="down" />
       <axis id="nfloat" long_name="Float number"      unit="-"  />
+      <axis id="icbcla" long_name="Iceberg class"     unit="-"  />
    </axis_definition> 
     
Index: branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/SHARED/field_def.xml
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/SHARED/field_def.xml	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/CONFIG/SHARED/field_def.xml	(revision 4175)
@@ -221,4 +221,21 @@
       </field_group>
 
+      <!-- variables available with iceberg trajectories -->
+      <field_group id="icbvar" domain_ref="grid_T"  > 
+        <field id="berg_melt"          long_name="icb melt rate of icebergs"                     unit="kg/m2/s"   />
+        <field id="berg_buoy_melt"     long_name="icb buoyancy component of iceberg melt rate"   unit="kg/m2/s"   />
+        <field id="berg_eros_melt"     long_name="icb erosion component of iceberg melt rate"    unit="kg/m2/s"   />
+        <field id="berg_conv_melt"     long_name="icb convective component of iceberg melt rate" unit="kg/m2/s"   />
+        <field id="berg_virtual_area"  long_name="icb virtual coverage by icebergs"              unit="m2"        />
+        <field id="bits_src"           long_name="icb mass source of bergy bits"                 unit="kg/m2/s"   />
+        <field id="bits_melt"          long_name="icb melt rate of bergy bits"                   unit="kg/m2/s"   />
+        <field id="bits_mass"          long_name="icb bergy bit density field"                   unit="kg/m2"     />
+        <field id="berg_mass"          long_name="icb iceberg density field"                     unit="kg/m2"     />
+        <field id="calving"            long_name="icb calving mass input"                        unit="kg/s"      />
+        <field id="berg_floating_melt" long_name="icb melt rate of icebergs + bits"              unit="kg/m2/s"   />
+        <field id="berg_real_calving"  long_name="icb calving into iceberg class"                unit="kg/s"     axis_ref="icbcla" />
+        <field id="berg_stored_ice"    long_name="icb accumulated ice mass by class"             unit="kg"       axis_ref="icbcla" />
+      </field_group>
+
       <!-- ptrc on T grid -->
 
@@ -249,13 +266,18 @@
        <field id="NH4"      long_name="Ammonium Concentration"                   unit="mmol/m3" />
 
+       <!-- PISCES with Kriest parametisation : variables available with key_kriest -->
+       <field id="Num"      long_name="Number of organic particles"              unit="nbr" />
+
+       <!-- PISCES light : variables available with key_pisces_reduced -->
        <field id="DET"      long_name="Detritus"                                 unit="mmol-N/m3" />
        <field id="DOM"      long_name="Dissolved Organic Matter"                 unit="mmol-N/m3" />
 
+       <!-- CFC11 : variables available with key_cfc -->
        <field id="CFC11"    long_name="CFC-11 Concentration"                     unit="umol/L" />
+       <!-- Bomb C14 : variables available with key_c14b -->
        <field id="C14B"     long_name="Bomb C14 Concentration"                   unit="ration" />
      </field_group>
 
-      <!-- diad on T grid : variables available with key_diatrc -->
-
+      <!-- PISCES additional diagnostics on T grid  -->
      <field_group id="diad_T" grid_ref="grid_T_2D">
        <field id="PH"          long_name="PH"                                      unit="-"          grid_ref="grid_T_3D" />
@@ -311,33 +333,45 @@
        <field id="Heup"        long_name="Euphotic layer depth"                    unit="m"                            />
        <field id="Irondep"     long_name="Iron deposition from dust"               unit="mol/m2/s"                     />
-       <field id="Ironsed"     long_name="Iron deposition from sediment"           unit="mol/m2/s"  grid_ref="grid_T_3D"  />
-
-       <field id="FNO3PHY"  long_name="FNO3PHY"                             unit="-"  grid_ref="grid_T_3D" /> 
-       <field id="FNH4PHY"  long_name="FNH4PHY"                             unit="-"  grid_ref="grid_T_3D" /> 
-       <field id="FNH4NO3"  long_name="FNH4NO3"                             unit="-"  grid_ref="grid_T_3D" /> 
-       <field id="TNO3PHY"  long_name="TNO3PHY"                             unit="-"  /> 
-       <field id="TNH4PHY"  long_name="TNH4PHY"                             unit="-"  /> 
-       <field id="TPHYDOM"  long_name="TPHYDOM"                             unit="-"  /> 
-       <field id="TPHYNH4"  long_name="TPHYNH4"                             unit="-"  /> 
-       <field id="TPHYZOO"  long_name="TPHYZOO"                             unit="-"  /> 
-       <field id="TPHYDET"  long_name="TPHYDET"                             unit="-"  /> 
-       <field id="TDETZOO"  long_name="TDETZOO"                             unit="-"  /> 
-       <field id="TZOODET"  long_name="TZOODET"                             unit="-"  /> 
-       <field id="TZOOBOD"  long_name="TZOOBOD"                             unit="-"  /> 
-       <field id="TZOONH4"  long_name="TZOONH4"                             unit="-"  /> 
-       <field id="TZOODOM"  long_name="TZOODOM"                             unit="-"  /> 
-       <field id="TNH4NO3"  long_name="TNH4NO3"                             unit="-"  /> 
-       <field id="TDOMNH4"  long_name="TDOMNH4"                             unit="-"  /> 
-       <field id="TDETNH4"  long_name="TDETNH4"                             unit="-"  /> 
-       <field id="TPHYTOT"  long_name="TPHYTOT"                             unit="-"  /> 
-       <field id="TZOOTOT"  long_name="TZOOTOT"                             unit="-"  /> 
-       <field id="SEDPOC"   long_name="SEDPOC"                              unit="-"  /> 
-       <field id="TDETSED"  long_name="TDETSED"                             unit="-"  /> 
-
-       <field id="qtrCFC11"     long_name="Air-sea flux of CFC-11"                   unit="mol/m2/s"   />
-       <field id="qintCFC11"    long_name="Cumulative air-sea flux of CFC-11"        unit="mol/m2"     />
-       <field id="qtrC14b"      long_name="Air-sea flux of Bomb C14"                 unit="mol/m2/s"   />
-       <field id="qintC14b"     long_name="Cumulative air-sea flux of Bomb C14"      unit="mol/m2"     />
-       <field id="fdecay"       long_name="Radiactive decay of Bomb C14"             unit="mol/m3"  grid_ref="grid_T_3D"  />
+       <field id="Ironsed"     long_name="Iron deposition from sediment"           unit="mol/m2/s"  grid_ref="grid_T_3D "/>
+
+       <!-- PISCES with Kriest parametisation : variables available with key_kriest -->
+       <field id="POCFlx"      long_name="Particulate organic C flux"              unit="mol/m2/s"   grid_ref="grid_T_3D" />
+       <field id="NumFlx"      long_name="Particle number flux"                    unit="nbr/m2/s"   grid_ref="grid_T_3D" />
+       <field id="SiFlx"       long_name="Biogenic Si flux"                        unit="mol/m2/s"   grid_ref="grid_T_3D" />
+       <field id="CaCO3Flx"    long_name="CaCO3 flux"                              unit="mol/m2/s"   grid_ref="grid_T_3D" />
+       <field id="xnum"        long_name="Number of particles in aggregats"        unit="-"          grid_ref="grid_T_3D" />
+       <field id="W1"          long_name="sinking speed of mass flux"              unit="m2/s"       grid_ref="grid_T_3D" />
+       <field id="W2"          long_name="sinking speed of number flux"            unit="m2/s"       grid_ref="grid_T_3D" />
+
+       <!-- PISCES light : variables available with key_pisces_reduced -->
+       <field id="FNO3PHY"     long_name="FNO3PHY"                                 unit="-"          grid_ref="grid_T_3D" /> 
+       <field id="FNH4PHY"     long_name="FNH4PHY"                                 unit="-"          grid_ref="grid_T_3D" /> 
+       <field id="FNH4NO3"     long_name="FNH4NO3"                                 unit="-"          grid_ref="grid_T_3D" /> 
+       <field id="TNO3PHY"     long_name="TNO3PHY"                                 unit="-"  /> 
+       <field id="TNH4PHY"     long_name="TNH4PHY"                                 unit="-"  /> 
+       <field id="TPHYDOM"     long_name="TPHYDOM"                                 unit="-"  /> 
+       <field id="TPHYNH4"     long_name="TPHYNH4"                                 unit="-"  /> 
+       <field id="TPHYZOO"     long_name="TPHYZOO"                                 unit="-"  /> 
+       <field id="TPHYDET"     long_name="TPHYDET"                                 unit="-"  /> 
+       <field id="TDETZOO"     long_name="TDETZOO"                                 unit="-"  /> 
+       <field id="TZOODET"     long_name="TZOODET"                                 unit="-"  /> 
+       <field id="TZOOBOD"     long_name="TZOOBOD"                                 unit="-"  /> 
+       <field id="TZOONH4"     long_name="TZOONH4"                                 unit="-"  /> 
+       <field id="TZOODOM"     long_name="TZOODOM"                                 unit="-"  /> 
+       <field id="TNH4NO3"     long_name="TNH4NO3"                                 unit="-"  /> 
+       <field id="TDOMNH4"     long_name="TDOMNH4"                                 unit="-"  /> 
+       <field id="TDETNH4"     long_name="TDETNH4"                                 unit="-"  /> 
+       <field id="TPHYTOT"     long_name="TPHYTOT"                                 unit="-"  /> 
+       <field id="TZOOTOT"     long_name="TZOOTOT"                                 unit="-"  /> 
+       <field id="SEDPOC"      long_name="SEDPOC"                                  unit="-"  /> 
+       <field id="TDETSED"     long_name="TDETSED"                                 unit="-"  /> 
+
+       <!-- CFC11 : variables available with key_cfc -->
+       <field id="qtrCFC11"    long_name="Air-sea flux of CFC-11"                   unit="mol/m2/s"   />
+       <field id="qintCFC11"   long_name="Cumulative air-sea flux of CFC-11"        unit="mol/m2"     />
+       <!-- Bomb C14 : variables available with key_c14b -->
+       <field id="qtrC14b"     long_name="Air-sea flux of Bomb C14"                 unit="mol/m2/s"   />
+       <field id="qintC14b"    long_name="Cumulative air-sea flux of Bomb C14"      unit="mol/m2"     />
+       <field id="fdecay"      long_name="Radiactive decay of Bomb C14"             unit="mol/m3"  grid_ref="grid_T_3D"  />
      </field_group>
 
Index: branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90	(revision 4175)
@@ -30,4 +30,5 @@
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
    USE in_out_manager  !
+   USE domvvl          ! variable volume
 
    IMPLICIT NONE
@@ -84,13 +85,22 @@
       pu2d(:,:) = 0.e0
       pv2d(:,:) = 0.e0
-      DO jk = 1, jpkm1   !! Vertically integrated momentum trends
-          pu2d(:,:) = pu2d(:,:) + fse3u(:,:,jk) * umask(:,:,jk) * ua(:,:,jk)
-          pv2d(:,:) = pv2d(:,:) + fse3v(:,:,jk) * vmask(:,:,jk) * va(:,:,jk)
-      END DO
-      pu2d(:,:) = pu2d(:,:) * phur(:,:)
-      pv2d(:,:) = pv2d(:,:) * phvr(:,:)
+      IF (lk_vvl) THEN
+         DO jk = 1, jpkm1   !! Vertically integrated momentum trends
+            pu2d(:,:) = pu2d(:,:) + fse3u_a(:,:,jk) * umask(:,:,jk) * ua(:,:,jk)
+            pv2d(:,:) = pv2d(:,:) + fse3v_a(:,:,jk) * vmask(:,:,jk) * va(:,:,jk)
+         END DO
+         pu2d(:,:) = pu2d(:,:) / ( hu_0(:,:) + sshu_a(:,:) + 1._wp - umask(:,:,1) )
+         pv2d(:,:) = pv2d(:,:) / ( hv_0(:,:) + sshv_a(:,:) + 1._wp - vmask(:,:,1) )
+      ELSE
+         DO jk = 1, jpkm1   !! Vertically integrated momentum trends
+            pu2d(:,:) = pu2d(:,:) + fse3u(:,:,jk) * umask(:,:,jk) * ua(:,:,jk)
+            pv2d(:,:) = pv2d(:,:) + fse3v(:,:,jk) * vmask(:,:,jk) * va(:,:,jk)
+         END DO
+         pu2d(:,:) = pu2d(:,:) * phur(:,:)
+         pv2d(:,:) = pv2d(:,:) * phvr(:,:)
+      ENDIF
       DO jk = 1 , jpkm1
-         ua(:,:,jk) = ua(:,:,jk) - pu2d(:,:)
-         va(:,:,jk) = va(:,:,jk) - pv2d(:,:)
+         ua(:,:,jk) = ua(:,:,jk) - pu2d(:,:) * umask(:,:,jk)
+         va(:,:,jk) = va(:,:,jk) - pv2d(:,:) * vmask(:,:,jk)
       END DO
 
Index: branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/C1D/step_c1d.F90
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/C1D/step_c1d.F90	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/C1D/step_c1d.F90	(revision 4175)
@@ -59,6 +59,7 @@
 
                              indic = 0                ! reset to no error condition
+      IF( kstp == nit000 )   CALL iom_init            ! iom_put initialization (must be done after nemo_init for AGRIF+XIOS+OASIS)
       IF( kstp /= nit000 )   CALL day( kstp )         ! Calendar (day was already called at nit000 in day_init)
-                             CALL iom_setkt( kstp )   ! say to iom that we are at time step kstp
+                             CALL iom_setkt( kstp - nit000 + 1 )   ! say to iom that we are at time step kstp
 
       !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@@ -106,4 +107,6 @@
       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                          CALL dia_wri( kstp )       ! ocean model: outputs
+      IF( lk_diahth  )   CALL dia_hth( kstp )       ! Thermocline depth (20°C)
+
 
 #if defined key_top
Index: branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90	(revision 4175)
@@ -42,5 +42,6 @@
 #endif
 #if defined key_lim3
-  USE ice_3
+  USE par_ice
+  USE ice
 #endif
   USE domvvl
@@ -484,4 +485,5 @@
                  ijglo = secs(jsec)%listPoint(jpt)%J + jpjzoom - 1 + njmpp - 1
                  WRITE(numout,*)'         # I J : ',iiglo,ijglo
+                 CALL FLUSH(numout)
               ENDDO
            ENDIF
@@ -606,5 +608,5 @@
     
      !! * Local variables
-     INTEGER             :: jk, jseg, jclass,                    &!loop on level/segment/classes  
+     INTEGER             :: jk, jseg, jclass,jl,                 &!loop on level/segment/classes/ice categories
                             isgnu, isgnv                          ! 
      REAL(wp)            :: zumid, zvmid,                        &!U/V velocity on a cell segment 
@@ -771,5 +773,6 @@
    
               zTnorm=zumid_ice*e2u(k%I,k%J)+zvmid_ice*e1v(k%I,k%J)
-   
+
+#if defined key_lim2   
               transports_2d(1,jsec,jseg) = transports_2d(1,jsec,jseg) + (zTnorm)*   & 
                                    (1.0 - frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))  & 
@@ -778,4 +781,16 @@
               transports_2d(2,jsec,jseg) = transports_2d(2,jsec,jseg) + (zTnorm)*   & 
                                     (1.0 -  frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))
+#endif
+#if defined key_lim3
+              DO jl=1,jpl
+                 transports_2d(1,jsec,jseg) = transports_2d(1,jsec,jseg) + (zTnorm)*     &
+                                   a_i(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J,jl) * &
+                                  ( ht_i(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J,jl) +  &
+                                    ht_s(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J,jl) )
+                                   
+                 transports_2d(2,jsec,jseg) = transports_2d(2,jsec,jseg) + (zTnorm)*   &
+                                   a_i(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J,jl)
+              ENDDO
+#endif
    
            ENDIF !end of ice case
Index: branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90	(revision 4175)
@@ -192,5 +192,5 @@
       INTEGER  ::   iku, ikv     ! local integers    
       INTEGER  ::   ii0, ii1, ij0, ij1   ! temporary integers
-      REAL(wp) ::   zvt          ! local scalars
+      REAL(wp) ::   zvt, zvtip1, zvtjp1  ! local scalars
       !!----------------------------------------------------------------------
       !
@@ -202,5 +202,5 @@
          WRITE(numout,*) '~~~~~~~~~ '
          pe3u_b(:,:,jpk) = fse3u_0(:,:,jpk)
-         pe3v_b(:,:,jpk) = fse3u_0(:,:,jpk)
+         pe3v_b(:,:,jpk) = fse3v_0(:,:,jpk)
       ENDIF
       
@@ -208,7 +208,9 @@
          DO jj = 2, jpjm1
             DO ji = fs_2, fs_jpim1
-               zvt = fse3t_b(ji,jj,jk) * e1e2t(ji,jj)
-               pe3u_b(ji,jj,jk) = 0.5_wp * ( zvt + fse3t_b(ji+1,jj,jk) * e1e2t(ji+1,jj) ) / ( e1u(ji,jj) * e2u(ji,jj) )
-               pe3v_b(ji,jj,jk) = 0.5_wp * ( zvt + fse3t_b(ji,jj+1,jk) * e1e2t(ji,jj+1) ) / ( e1v(ji,jj) * e2v(ji,jj) )
+               zvt    = ( fse3t_b(ji  ,jj  ,jk) - fse3t_0(ji  ,jj  ,jk) ) * e1e2t(ji  ,jj  )
+               zvtip1 = ( fse3t_b(ji+1,jj  ,jk) - fse3t_0(ji+1,jj  ,jk) ) * e1e2t(ji+1,jj  )
+               zvtjp1 = ( fse3t_b(ji  ,jj+1,jk) - fse3t_0(ji  ,jj+1,jk) ) * e1e2t(ji  ,jj+1)
+               pe3u_b(ji,jj,jk) = fse3u_0(ji,jj,jk) + 0.5_wp * ( zvt + zvtip1 ) / ( e1u(ji,jj) * e2u(ji,jj) )
+               pe3v_b(ji,jj,jk) = fse3v_0(ji,jj,jk) + 0.5_wp * ( zvt + zvtjp1 ) / ( e1v(ji,jj) * e2v(ji,jj) )
             END DO
          END DO
Index: branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90	(revision 4175)
@@ -1373,4 +1373,26 @@
       where (e3vw  (:,:,:).eq.0.0)  e3vw(:,:,:) = 1.0
 
+#if defined key_agrif
+      ! Ensure meaningful vertical scale factors in ghost lines/columns
+      IF( .NOT. Agrif_Root() ) THEN
+         !  
+         IF((nbondi == -1).OR.(nbondi == 2)) THEN
+            e3u(1,:,:) = e3u(2,:,:)
+         ENDIF
+         !
+         IF((nbondi ==  1).OR.(nbondi == 2)) THEN
+            e3u(nlci-1,:,:) = e3u(nlci-2,:,:)
+         ENDIF
+         !
+         IF((nbondj == -1).OR.(nbondj == 2)) THEN
+            e3v(:,1,:) = e3v(:,2,:)
+         ENDIF
+         !
+         IF((nbondj ==  1).OR.(nbondj == 2)) THEN
+            e3v(:,nlcj-1,:) = e3v(:,nlcj-2,:)
+         ENDIF
+         !
+      ENDIF
+#endif
 
       fsdept(:,:,:) = gdept (:,:,:)
@@ -1421,8 +1443,11 @@
          WRITE(numout,"(10x,i4,4f9.2)") ( jk, fsdept(1,1,jk), fsdepw(1,1,jk),     &
             &                                 fse3t (1,1,jk), fse3w (1,1,jk), jk=1,jpk )
-         DO jj = mj0(20), mj1(20)
-            DO ji = mi0(20), mi1(20)
+         iip1 = MIN(20, jpiglo-1)  ! for config with i smaller than 20 points
+         ijp1 = MIN(20, jpjglo-1)  ! for config with j smaller than 20 points
+         DO jj = mj0(ijp1), mj1(ijp1)
+            DO ji = mi0(iip1), mi1(iip1)
                WRITE(numout,*)
-               WRITE(numout,*) ' domzgr: vertical coordinates : point (20,20,k)   bathy = ', bathy(ji,jj), hbatt(ji,jj)
+               WRITE(numout,*) ' domzgr: vertical coordinates : point (',iip1,',',ijp1,',k)   bathy = ',  &
+                  &                                              bathy(ji,jj), hbatt(ji,jj)
                WRITE(numout,*) ' ~~~~~~  --------------------'
                WRITE(numout,"(9x,' level   gdept    gdepw    gde3w     e3t      e3w  ')")
@@ -1431,8 +1456,11 @@
             END DO
          END DO
-         DO jj = mj0(74), mj1(74)
-            DO ji = mi0(100), mi1(100)
+         iip1 = MIN(  74, jpiglo-1)
+         ijp1 = MIN( 100, jpjglo-1)
+         DO jj = mj0(ijp1), mj1(ijp1)
+            DO ji = mi0(iip1), mi1(iip1)
                WRITE(numout,*)
-               WRITE(numout,*) ' domzgr: vertical coordinates : point (100,74,k)   bathy = ', bathy(ji,jj), hbatt(ji,jj)
+               WRITE(numout,*) ' domzgr: vertical coordinates : point (',iip1,',',ijp1,',k)   bathy = ',  &
+                  &                                              bathy(ji,jj), hbatt(ji,jj)
                WRITE(numout,*) ' ~~~~~~  --------------------'
                WRITE(numout,"(9x,' level   gdept    gdepw    gde3w     e3t      e3w  ')")
Index: branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/ICB/icb_oce.F90
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/ICB/icb_oce.F90	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/ICB/icb_oce.F90	(revision 4175)
@@ -37,5 +37,4 @@
    USE par_oce   ! ocean parameters
    USE lib_mpp   ! MPP library
-   USE fldread   ! read input fields (FLD type)
 
    IMPLICIT NONE
@@ -151,6 +150,4 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   :: griddata                           !: work array for icbrst
 
-   TYPE(FLD), PUBLIC, ALLOCATABLE     , DIMENSION(:)       ::   sf_icb   !: structure: file information, fields read
-
    !!----------------------------------------------------------------------
    !! NEMO/OPA 3.3 , NEMO Consortium (2011)
@@ -168,6 +165,5 @@
       !
       icb_alloc = 0
-      ALLOCATE( berg_grid                      ,                                               &
-         &      berg_grid%calving    (jpi,jpj) , berg_grid%calving_hflx (jpi,jpj)          ,   &
+      ALLOCATE( berg_grid%calving    (jpi,jpj) , berg_grid%calving_hflx (jpi,jpj)          ,   &
          &      berg_grid%stored_heat(jpi,jpj) , berg_grid%floating_melt(jpi,jpj)          ,   &
          &      berg_grid%maxclass   (jpi,jpj) , berg_grid%stored_ice   (jpi,jpj,nclasses) ,   &
Index: branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/ICB/icbini.F90
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/ICB/icbini.F90	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/ICB/icbini.F90	(revision 4175)
@@ -35,6 +35,8 @@
    PUBLIC   icb_init  ! routine called in nemogcm.F90 module
 
-   CHARACTER(len=100) ::   cn_dir = './'   ! Root directory for location of icb files
-   TYPE(FLD_N)        ::   sn_icb          ! information about the calving file to be read
+   CHARACTER(len=100)                                 ::   cn_dir = './'   !: Root directory for location of icb files
+   TYPE(FLD_N)                                        ::   sn_icb          !: information about the calving file to be read
+   TYPE(FLD), PUBLIC, ALLOCATABLE     , DIMENSION(:)  ::   sf_icb          !: structure: file information, fields read
+                                                                           !: used in icbini and icbstp
 
    !!----------------------------------------------------------------------
Index: branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/ICB/icbstp.F90
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/ICB/icbstp.F90	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/ICB/icbstp.F90	(revision 4175)
@@ -24,4 +24,5 @@
    USE lib_mpp
    USE iom
+   USE fldread
    USE timing         ! timing
 
Index: branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90	(revision 4175)
@@ -31,4 +31,5 @@
    USE sbc_oce, ONLY :   nn_fsbc         ! ocean space and time domain
    USE trc_oce, ONLY :   nn_dttrc        !  !: frequency of step on passive tracers
+   USE icb_oce, ONLY :   class_num       !  !: iceberg classes
    USE domngb          ! ocean space and time domain
    USE phycst          ! physical constants
@@ -99,5 +100,9 @@
       clname = "nemo"
       IF( TRIM(Agrif_CFixed()) /= '0' )   clname = TRIM(Agrif_CFixed())//"_"//TRIM(clname)
+# if defined key_mpp_mpi
       CALL xios_context_initialize(TRIM(clname), mpi_comm_opa)
+# else
+      CALL xios_context_initialize(TRIM(clname), 0)
+# endif
       CALL iom_swap
 
@@ -124,6 +129,7 @@
       CALL iom_set_axis_attr( "depthw", gdepw_0 )
 # if defined key_floats
-      CALL iom_set_axis_attr( "nfloat", (ji, ji=1,nfloat) )
+      CALL iom_set_axis_attr( "nfloat", (/ (REAL(ji,wp), ji=1,nfloat) /) )
 # endif
+      CALL iom_set_axis_attr( "icbcla", class_num )
       
       ! automatic definitions of some of the xml attributs
Index: branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/LBC/mppini_2.h90
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/LBC/mppini_2.h90	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/LBC/mppini_2.h90	(revision 4175)
@@ -122,4 +122,12 @@
       irestj = 1 + MOD( jpjglo - nrecj -1 , jpnj )
 
+#if defined key_nemocice_decomp
+      ! Change padding to be consistent with CICE
+      ilci(1:jpni-1      ,:) = jpi
+      ilci(jpni          ,:) = jpiglo - (jpni - 1) * (jpi - nreci)
+
+      ilcj(:,      1:jpnj-1) = jpj
+      ilcj(:,          jpnj) = jpjglo - (jpnj - 1) * (jpj - nrecj)
+#else
       ilci(1:iresti      ,:) = jpi
       ilci(iresti+1:jpni ,:) = jpi-1
@@ -127,4 +135,5 @@
       ilcj(:,      1:irestj) = jpj
       ilcj(:, irestj+1:jpnj) = jpj-1
+#endif
 
       IF(lwp) WRITE(numout,*)
Index: branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/SOL/solmat.F90
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/SOL/solmat.F90	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/SOL/solmat.F90	(revision 4175)
@@ -30,4 +30,5 @@
    USE lbclnk          ! lateral boudary conditions
    USE lib_mpp         ! distributed memory computing
+   USE c1d               ! 1D vertical configuration
    USE in_out_manager  ! I/O manager
    USE timing          ! timing
@@ -271,4 +272,5 @@
       
       ! SOR and PCG solvers
+      IF( lk_c1d ) CALL lbc_lnk( gcdmat, 'T', 1._wp ) ! 1D case bmask =/0  but gcdmat not define everywhere 
       DO jj = 1, jpj
          DO ji = 1, jpi
Index: branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/step.F90
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 4175)
@@ -271,5 +271,5 @@
       !
 #if defined key_iomput
-      IF( kstp == nitend   )   CALL xios_context_finalize() ! needed for XIOS+AGRIF
+      IF( kstp == nitend .OR. indic < 0 )   CALL xios_context_finalize() ! needed for XIOS+AGRIF
 #endif
       !
Index: branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zfechem.F90
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zfechem.F90	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zfechem.F90	(revision 4175)
@@ -129,5 +129,5 @@
                   zoxy   = trn(ji,jj,jk,jpoxy) * ( rhop(ji,jj,jk) / 1.e3 )
                   ! Fe2+ oxydation rate from Santana-Casiano et al. (2005)
-                  zkox   = 35.407 - 6.7109 * zph + 0.5342 * zph * zph - 5362.6 / ( tsn(ji,jj,1,jp_tem) + 273.15 )  &
+                  zkox   = 35.407 - 6.7109 * zph + 0.5342 * zph * zph - 5362.6 / ( tsn(ji,jj,jk,jp_tem) + 273.15 )  &
                     &    - 0.04406 * SQRT( tsn(ji,jj,jk,jp_sal) ) - 0.002847 * tsn(ji,jj,jk,jp_sal)
                   zkox   = ( 10.** zkox ) * spd
Index: branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsms.F90
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsms.F90	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsms.F90	(revision 4175)
@@ -392,5 +392,5 @@
 #endif
             &                    + trn(:,:,:,jpsfe)                     &
-            &                    + trn(:,:,:,jpzoo)                     &
+            &                    + trn(:,:,:,jpzoo) * ferat3            &
             &                    + trn(:,:,:,jpmes) * ferat3            ) * cvol(:,:,:)  )
 
Index: branches/2013/dev_CMCC_2013/NEMOGCM/SETTE/iodef_sette.xml
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/SETTE/iodef_sette.xml	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/SETTE/iodef_sette.xml	(revision 4175)
@@ -21,5 +21,5 @@
     -->
     
-    <file_definition type="multiple_file" sync_freq="1d" min_digits="4">
+    <file_definition type="multiple_file" name="@expname@_@freq@_@startdate@_@enddate@" sync_freq="1d" min_digits="4">
     
       <file_group id="1h" output_freq="1h"  output_level="10" enabled=".FALSE."/> <!-- 1h files -->
@@ -54,9 +54,10 @@
     
    <axis_definition>  
-      <axis id="deptht" long_name="Vertical T levels" unit="m"  /><!-- positive=".FALSE." -->
-      <axis id="depthu" long_name="Vertical U levels" unit="m"  /><!-- positive=".FALSE." -->
-      <axis id="depthv" long_name="Vertical V levels" unit="m"  /><!-- positive=".FALSE." -->
-      <axis id="depthw" long_name="Vertical W levels" unit="m"  /><!-- positive=".FALSE." -->
+      <axis id="deptht" long_name="Vertical T levels" unit="m" positive="down" />
+      <axis id="depthu" long_name="Vertical U levels" unit="m" positive="down" />
+      <axis id="depthv" long_name="Vertical V levels" unit="m" positive="down" />
+      <axis id="depthw" long_name="Vertical W levels" unit="m" positive="down" />
       <axis id="nfloat" long_name="Float number"      unit="-"  />
+      <axis id="icbcla" long_name="Iceberg class"     unit="-"  />
    </axis_definition> 
     
Index: branches/2013/dev_CMCC_2013/NEMOGCM/TOOLS/MISCELLANEOUS/chk_iomput.sh
===================================================================
--- branches/2013/dev_CMCC_2013/NEMOGCM/TOOLS/MISCELLANEOUS/chk_iomput.sh	(revision 4174)
+++ branches/2013/dev_CMCC_2013/NEMOGCM/TOOLS/MISCELLANEOUS/chk_iomput.sh	(revision 4175)
@@ -35,7 +35,7 @@
 	    echo ' --insrc              only print all variable definitions found in the source code'
 	    echo 'Examples'
-	    echo '      chk_iomput.sh'
-	    echo '      chk_iomput.sh --help'
-	    echo '      chk_iomput.sh ../../CONFIG/ORCA2_LIM/EXP00/iodef.xml "../../NEMO/OPA_SRC/ ../../NEMO/LIM_SRC_2/"'
+	    echo '      ./chk_iomput.sh'
+	    echo '      ./chk_iomput.sh --help'
+	    echo '      ./chk_iomput.sh ../../CONFIG/ORCA2_LIM/EXP00/iodef.xml "../../NEMO/OPA_SRC/ ../../NEMO/LIM_SRC_2/"'
 	    echo
 	    exit ;;
@@ -59,5 +59,13 @@
 #------------------------------------------------
 #
-[ $inxml -eq 1 ] && grep "< *field * id *=" $xmlfile
+external=$( grep -c "<field_definition.* src=" $xmlfile )
+if [ $external -eq 1 ]
+then
+    xmlfield_def=$( grep "<field_definition.* src=" $xmlfile | sed -e 's/.*src="\([^"]*\)".*/\1/' )
+    xmlfield_def=$( dirname $xmlfile )/$xmlfield_def   
+else
+    xmlfield_def=$xmlfile
+fi
+[ $inxml -eq 1 ] && grep "< *field * id *=" $xmlfield_def
 [ $insrc -eq 1 ] && find $srcdir -name "*.[Ffh]90" -exec grep -iH "^[^\!]*call  *iom_put *(" {} \;
 [ $(( $insrc + $inxml )) -ge 1 ] && exit
@@ -71,17 +79,25 @@
 # list of variables used in "CALL iom_put"
 #
-varlistsrc=$( find $srcdir -name "*.[Ffh]90" -exec grep -i  "^[^\!]*call  *iom_put *(" {} \; | sed -e "s/.*iom_put *( *[\"\']\([^\"\']*\)[\"\'] *,.*/\1/" | sort -d )
+badvarsrc=$( find $srcdir -name "*.[Ffh]90" -exec grep -i  "^[^\!]*call  *iom_put *(" {} \; | sed -e "s/.*iom_put *( *[\"\']\([^\"\']*\)[\"\'] *,.*/\1/" | grep -ic iom_put )
+if [ $badvarsrc -ne 0 ]
+then
+    echo "The following call to iom_put cannot be checked"
+    echo
+    find $srcdir -name "*.[Ffh]90" -exec grep -i  "^[^\!]*call  *iom_put *(" {} \; | sed -e "s/.*iom_put *( *[\"\']\([^\"\']*\)[\"\'] *,.*/\1/" | grep -i iom_put | sort -d 
+    echo
+fi
+varlistsrc=$( find $srcdir -name "*.[Ffh]90" -exec grep -i  "^[^\!]*call  *iom_put *(" {} \; | sed -e "s/.*iom_put *( *[\"\']\([^\"\']*\)[\"\'] *,.*/\1/" | grep -vi iom_put | sort -d )
 #
 # list of variables defined in the xml file
 #
-varlistxml=$( grep "< *field * id *=" $xmlfile  | sed -e "s/^.*< *field * id *= *[\"\']\([^\"\']*\)[\"\'].*/\1/" | sort -d )
+varlistxml=$( grep "< *field.* id *=" $xmlfield_def  | sed -e "s/^.*< *field.* id *= *[\"\']\([^\"\']*\)[\"\'].*/\1/" | sort -d )
 #
 # list of variables to be outputed in the xml file
 #
-varlistout=$( grep "< *field * ref *=" $xmlfile  | sed -e "s/^.*< *field * ref *= *[\"\']\([^\"\']*\)[\"\'].*/\1/" | sort -d )
+varlistout=$( grep "< *field.* field_ref *=" $xmlfile  | sed -e "s/^.*< *field.* field_ref *= *[\"\']\([^\"\']*\)[\"\'].*/\1/" | sort -d )
 #
 echo "--------------------------------------------------"
 echo  check if all iom_put found in $srcdir
-echo  have a corresponding variable definition in $xmlfile
+echo  have a corresponding variable definition in $xmlfield_def
 echo "--------------------------------------------------"
 for var in $varlistsrc
@@ -90,5 +106,5 @@
     if [ $tst -ne 1 ] 
     then
-	echo "problem with $var: $tst lines corresponding to its definition in $xmlfile, but defined in the code in"
+	echo "problem with $var: $tst lines corresponding to its definition in $xmlfield_def, but defined in the code in"
 	for f in $srclist
 	do
