Index: /trunk/DOC/TexFiles/Chapters/Chap_DIA.tex
===================================================================
--- /trunk/DOC/TexFiles/Chapters/Chap_DIA.tex	(revision 3939)
+++ /trunk/DOC/TexFiles/Chapters/Chap_DIA.tex	(revision 3940)
@@ -31,16 +31,5 @@
 "\textit{grep -i numout}" in the source code directory.
 
-In the standard configuration, the user will find the model results in 
-NetCDF files containing mean values (or instantaneous values if 
-\key{diainstant} is defined) for every time-step where output is demanded.
-These outputs are defined in the \mdl{diawri} module. 
-When defining \key{dimgout}, the output are written in DIMG format,
-an IEEE output format.
-
-Since version 3.2, an I/O server has been added which provides more
-flexibility in the choice of the fields to be output as well as how the 
-writing work is distributed over the processors in massively parallel
-computing. It is presented in next section. 
-
+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). 
 
 %\gmcomment{                    % start of gmcomment
@@ -53,29 +42,18 @@
 
 
-Since version 3.2, iom\_put is the NEMO output interface. It was designed to be simple to use, 
-flexible and efficient. Two main functionalities are covered by iom\_put: 
-(1) the control of the output files through an external xml file defined by the user ; 
-(2) the distribution (or not) of all task related to output files on dedicated processors.
-The first functionality allows the user to specify, without touching anything into the code, 
-the way he want to output data: \\
+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 extract a subdomain (for example all TAO-PIRATA-RAMA moorings are already defined)  \\
-- choice of the temporal operation to perform: mean, instantaneous, min, max  \\
+- 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, iom\_put allows the user to output any variable (scalar, 2D or 3D) in the code 
-in a very easy way. All details of iom\_put functionalities are listed in the following subsections.
-An example of the iodef.xml file 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. 
-The idea is to dedicate N specific processes to write the outputs, where N is defined by the user. 
-In the current version, this functionality is technically working however, its performance are usually poor 
-(for known reasons). Users can therefore test this functionality but they must be aware that expected 
-performance improvement will not be achieved before the release 3.4.
-An example of xmlio\_server.def NEMOGCM/CONFIG/ORCA2\_LIM/EXP00/xmlio\_server.def
- 
+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}
@@ -93,102 +71,250 @@
 \subsubsection{Structure of the xml file used in NEMO}
 
-The xml file is split into 3 parts:
+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[field definition]: define all variables that can be output \\
-all lines in between the following two tags\\
-\verb?   <field\_definition ...> ?  \\
-\verb?   </field\_definition ...> ? 
+\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}
+
+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 \\
-all lines in between the following two tags \\
-\verb?   <field\_definition> ?  \\
-\verb?   </field\_definition> ?
-\item[axis and grid definitions]: define the horizontal and vertical grids \\
-all lines in between the following two set of two tags\\
-\verb?   <axis\_definition ...> ?  \\
-\verb?   </axis\_definition ...> ?
-and \\
-\verb?   <grid\_definition ...> ?  \\
-\verb?   </grid\_definition ...> ?
+\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}
 
-\subsubsection{Inheritance and group }
-
- Xml extensively uses the concept of inheritance. \\
+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" /> ? 
+
+
+\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.  \\
 \\
-example 1: \\
-\vspace{-30pt}
+example 1: Direct inheritance. \\
 \begin{alltt}  {{\scriptsize    
 \begin{verbatim}
-   <field_definition operation="ave(X)" >
+   <field_definition operation="average" >
       <field id="sst"                    />   <!-- averaged      sst --> 
-      <field id="sss" operation="inst(X)"/>   <!-- instantaneous sss --> 
+      <field id="sss" operation="instant"/>   <!-- instantaneous sss --> 
    </field_definition> 
 \end{verbatim}
 }}\end{alltt} 
 
-The field ''sst'' which is part (or a child) of the field\_definition will inherit the value ''ave(X)'' 
-of the attribute ''operation'' from its parent ''field definition''. Note that a child can overwrite 
+The field ''sst'' which is part (or a child) of the field\_definition will inherit the value ''average'' 
+of the attribute ''operation'' from its parent. Note that a child can overwrite 
 the attribute definition inherited from its parents. In the example above, the field ''sss'' will 
-therefore output instantaneous values instead of average values.
-
-example 2: Use (or overwrite) attributes value of a field when listing the variables included in a file
-\vspace{-20pt}
+for example output instantaneous values instead of average values. \\
+\\
+example 2: Inheritance by reference. \\
 \begin{alltt}  {{\scriptsize
 \begin{verbatim}
    <field_definition>
-      <field id="sst" description="sea surface temperature" />   
-      <field id="sss" description="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="file_1" />   
-            <field ref="sst"                              />  <!-- default def -->
-            <field ref="sss" description="my description" />  <!-- overwrite   -->
+      <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} 
-
-With the help of the inheritance, the concept of group allow to define a set of attributes 
-for several fields or files. 
-
-example 3, group of fields: define a group ''T\_grid\_variables'' identified with the name 
-''grid\_T''. By default variables of this group have no vertical axis but, following inheritance 
-rules, ''axis\_ref'' can be redefined for the field ''toce'' that is a 3D variable.
-\vspace{-30pt}
-\begin{alltt}  {{\scriptsize
-\begin{verbatim}
-   <field_definition>
-      <group id="grid_T" axis_ref="none" grid_ref="T_grid_variables">
-            <field id="sst"/>  
-            <field id="sss"/>  
-            <field id="toce" axis_ref="deptht"/>  <!-- overwrite axis def -->
-      </group>
-   </field_definition> 
-\end{verbatim}
-}}\end{alltt} 
-
-example 4, group of files: define a group of file with the attribute output\_freq equal to 432000 (5 days)
-\vspace{-30pt}
-\begin{alltt}  {{\scriptsize
-\begin{verbatim}
-   <file_definition>
-      <group id="5d" output_freq="432000">    <!-- 5d files -->
-         <file id="5d_grid_T" name="auto">   <!-- T grid file -->
+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''.
+\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"                        />
          ...
-         </file>
-         <file id="5d_grid_U" name="auto">   <!-- U grid file -->
+\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:
+\begin{alltt}  {{\scriptsize
+\begin{verbatim}
+   <field_group id="groupU" >
+      <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:
+\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 -->
+   </file>   
+\end{verbatim}
+}}\end{alltt} 
+
+\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. 
+
+\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).
+\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" />
+\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:
+\begin{alltt}  {{\scriptsize
+\begin{verbatim}
+   <file id="myfile_vzoom" output_freq="1d" >
+      <field field_ref="toce" domain_ref="myzoom"/>
+   </file>
+\end{verbatim}
+}}\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'' ...)
+\begin{alltt}  {{\scriptsize
+\begin{verbatim}
+   <file id="myfile_vzoom" output_freq="1d" >
+      <field field_ref="toce" domain_ref="0n180wT"/>
+   </file>
+\end{verbatim}
+}}\end{alltt} 
+Note that if the domain decomposition used in XIOS cuts the subdomain in several parts and if you use the ''multiple\_file'' type for your output files, you will endup with several files you will need to rebuild using unprovided tools (like ncpdq and ncrcat, \href{http://nco.sourceforge.net/nco.html#Concatenation}{see nco manual}). We are therefore advising to use the ''one\_file'' type in this case.
+
+\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:
+\begin{alltt}  {{\scriptsize
+\begin{verbatim}
+   <axis_group id="deptht" long_name="Vertical T levels" unit="m" positive="down" >
+      <axis id="deptht" />
+      <axis id="deptht_myzoom" zoom_begin="1" zoom_end="10" />
+\end{verbatim}
+}}\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:
+\begin{alltt}  {{\scriptsize
+\begin{verbatim}
+   <file id="myfile_hzoom" output_freq="1d" >
+      <field field_ref="toce" axis_ref="deptht_myzoom"/>
+   </file>
+\end{verbatim}
+}}\end{alltt} 
+
+\subsubsection{Control of the output file names}
+
+The output file names are defined by the attributs ''name'' and ''name\_suffix'' of the tag family file. for example:
+\begin{alltt}  {{\scriptsize
+\begin{verbatim}
+   <file_group id="1d" output_freq="1d" name="myfile_1d" > 
+      <file id="myfileA" name_suffix="_AAA" > <!-- will create file "myfile_1d_AAA"  -->
          ...
-         </file>
-      </group>
-   </file_definition> 
-\end{verbatim}
-}}\end{alltt} 
-
-\subsubsection{Control 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). 
+      </file>
+      <file id="myfileB" name_suffix="_BBB" > <!-- will create file "myfile_1d_BBB" -->
+         ...
+      </file>
+   </file_group>
+\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: \\
+\\
+\begin{tabular}{|p{4cm}|p{8cm}|}
+   \hline
+   \centering part of the name automatically to be replaced &
+   by \\
+   \hline
+   \hline
+   \centering @expname@ &
+   the experience name (from cn\_exp in the namelist) \\
+   \hline
+   \centering @freq@ &
+   output frequency (from attribute output\_freq) \\
+   \hline
+   \centering @startdate@  &
+   starting date of the simulation (from nn\_date0 in the restart or the namelist). \verb?yyyymmdd? format \\
+   \hline
+   \centering @startdatefull@  & 
+   starting date of the simulation (from nn\_date0 in the restart or the namelist). \verb?yyyymmdd_hh:mm:ss? format \\
+   \hline
+   \centering @enddate@  &
+   ending date of the simulation (from nn\_date0 and nn\_itend in the namelist). \verb?yyyymmdd? format \\
+   \hline
+   \centering @enddatefull@  & 
+   ending date of the simulation (from nn\_date0 and nn\_itend in the namelist). \verb?yyyymmdd_hh:mm:ss? format \\
+   \hline
+\end{tabular}
+\\
+
+For example, 
+
+\begin{alltt}  {{\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
+\begin{verbatim}
+   cn_exp      =  "ORCA2"
+   nn_date0    =  19891231
+   ln_rstart   = .false.
+\end{verbatim}
+}}\end{alltt} 
+
+will give the following file name radical:
+
+\begin{alltt}  {{\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: \\
@@ -202,15 +328,14 @@
     \multicolumn{2}{|c|}{field\_definition} & freq\_op & \np{rn\_rdt} \\
    \hline
-    \multicolumn{2}{|c|}{SBC}                  & freq\_op & \np{rn\_rdt} $\times$ \np{nn\_fsbc} \\
-   \hline
-    1h, 2h, 3h, 4h, 6h, 12h & \_grid\_T, \_grid\_U,  &  name & filename defined by   \\
-    1d, 3d, 5d                     & \_grid\_V, \_grid\_W, &            & a call to rou{dia\_nam}  \\
-    1m, 2m, 3m, 4m, 6m    & \_icemod, \_ptrc\_T,  &            & following NEMO \\
-    1y, 2y, 5y, 10y               &  \_diad\_T, \_scalar   &            & nomenclature \\
+    \multicolumn{2}{|c|}{SBC}               & freq\_op & \np{rn\_rdt} $\times$ \np{nn\_fsbc}  \\
+   \hline
+    \multicolumn{2}{|c|}{ptrc\_T}           & freq\_op & \np{rn\_rdt} $\times$ \np{nn\_dttrc} \\
+   \hline
+    \multicolumn{2}{|c|}{diad\_T}           & freq\_op & \np{rn\_rdt} $\times$ \np{nn\_dttrc} \\
    \hline
     \multicolumn{2}{|c|}{EqT, EqU, EqW} & jbegin, ni,      & according to the grid    \\
     \multicolumn{2}{|c|}{                         } & name\_suffix &                                      \\
    \hline
-    \multicolumn{2}{|c|}{TAO, RAMA and PIRATA moorings} & ibegin, jbegin,      & according to the grid    \\
+   \multicolumn{2}{|c|}{TAO, RAMA and PIRATA moorings} & zoom\_ibegin, zoom\_jbegin, & according to the grid    \\
     \multicolumn{2}{|c|}{                                                       } & name\_suffix &                                      \\
    \hline
@@ -218,194 +343,373 @@
 
 
-\subsection{ Detailed functionalities }
-
 \subsubsection{Tag list}
 
-\begin{description}
-
-\item[context]: define the model using the xml file. Id is the only attribute accepted. 
-Its value must be ''nemo'' or ''n\_nemo'' for the nth AGRIF zoom. Child of simulation tag.
-
-\item[field]: define the field to be output. Accepted attributes are axis\_ref, description, enable, 
-freq\_op, grid\_ref, id (if child of field\_definition), level, operation, name, ref (if child of file), 
-unit, zoom\_ref. Child of field\_definition, file or group of fields tag.
-
-\item[field\_definition]: definition of the part of the xml file corresponding to the field definition. 
-Accept the same attributes as field tag. Child of context tag.
-
-\item[group]: define a group of file or field. Accept the same attributes as file or field.
-
-\item[file]: define the output file's characteristics. Accepted attributes are description, enable, 
-output\_freq, output\_level, id, name, name\_suffix. Child of file\_definition or group of files tag.
-
-\item[file\_definition]: definition of the part of the xml file corresponding to the file definition. 
-Accept the same attributes as file tag. Child of context tag.
-
-\item[axis]: definition of the vertical axis. Accepted attributes are description, id, positive, size, unit. 
-Child of axis\_definition tag.
-
-\item[axis\_definition]: definition of the part of the xml file corresponding to the vertical axis definition. 
-Accept the same attributes as axis tag. Child of context tag
-
-\item[grid]: definition of the horizontal grid. Accepted attributes are description and id. 
-Child of axis\_definition tag.
-
-\item[grid\_definition]: definition of the part of the xml file corresponding to the horizontal grid definition. 
-Accept the same attributes as grid tag. Child of context tag
-
-\item[zoom]: definition of a subdomain of an horizontal grid. Accepted attributes are description, id, 
-i/jbegin, ni/j. Child of grid tag.
-
-\end{description}
+
+\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   
+   simulation & 
+   this tag is the root tag which encapsulates all the content of the xml file &
+   none &
+   none &
+   context \\
+   \hline   
+   context &
+   encapsulates parts of the xml file dédicated 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 \\
+   \hline   
+   \hline   
+   field\_definition &
+   encapsulates the definition of all the fields that can potentially be outputted &
+   axis\_ref, default\_value, domain\_ref, enabled, grid\_ref, level, operation, prec, src &
+   context &
+   field or field\_group \\
+   \hline   
+   field\_group &
+   encapsulates a group of fields &
+   axis\_ref, default\_value, domain\_ref, enabled, group\_ref, grid\_ref, id, level, operation, prec, src &
+   field\_definition, field\_group, file &
+   field or field\_group \\
+   \hline   
+   field &
+   define a specific field &
+   axis\_ref, default\_value, domain\_ref, enabled, field\_ref, grid\_ref, id, level, long\_name, name, operation, prec, standard\_name, unit &
+   field\_definition, field\_group, file &
+   none \\
+   \hline   
+   \hline   
+   file\_definition & 
+   encapsulates the definition of all the files that will be outputted &
+   enabled, min\_digits, name, name\_suffix, output\_level, split\_format, split\_freq, sync\_freq, type, src &
+   context & 
+   file or file\_group \\
+   \hline   
+   file\_group & 
+   encapsulates a group of files that will 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 & 
+   file or file\_group \\
+   \hline   
+   file & 
+   defile the contentof 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 & 
+   define all the vertical axis potentially used by the variables &
+   src &
+   context &  
+   axis\_group, axis \\
+   \hline   
+   axis\_group & 
+   encapsulates a group of vertical axis &
+   id, lon\_name, positive, src, standard\_name, unit, zoom\_begin, zoom\_end, zoom\_size &
+   axis\_definition, axis\_group & 
+   axis\_group, axis \\
+   \hline   
+   axis & 
+   define a vertical axis &
+   id, lon\_name, positive, src, standard\_name, unit, zoom\_begin, zoom\_end, zoom\_size &
+   axis\_definition, axis\_group  & 
+   none \\
+   \hline   
+   \hline   
+   domain\_definition & 
+   define all the horizontal domains potentially used by the variables &
+   src &
+   context & 
+   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 \\
+   \hline   
+   domain & 
+   define an horizontal domain &
+   id, lon\_name, src, zoom\_ibegin, zoom\_jbegin, zoom\_ni, zoom\_nj &
+   domain\_definition, domain\_group & 
+   none \\
+   \hline   
+   \hline   
+   grid\_definition & 
+   define all the grid (association of a domain and/or an axis) potentially used by the variables &
+   src &
+   context & 
+   grid\_group, grid \\
+   \hline   
+   grid\_group & 
+   encapsulates a group of grids &
+   id, domain\_ref, axis\_ref &
+   grid\_definition, grid\_group & 
+   grid\_group, grid \\
+   \hline   
+   grid & 
+   define a grid &
+   id, domain\_ref, axis\_ref &
+   grid\_definition, grid\_group & 
+   none \\
+   \hline   
+\end{tabular}
 
 
 \subsubsection{Attributes list}
 
-Applied to a tag or a group of tags.
-
-% table to be added ?
-Another table, perhaps?
-
-%%%%
-
-Attribute
-Applied to?
-Definition
-Comment
-axis\_ref
-field
-String defining the vertical axis of the variable. It refers to the id of the vertical axis defined in the axis tag.
-Use ''non'' if the variable has no vertical axis
-
-%%%%%%
-
-\begin{description}
-
-\item[axis\_ref]: field attribute. String defining the vertical axis of the variable. 
-It refers to the id of the vertical axis defined in the axis tag. 
-Use ''none'' if the variable has no vertical axis
-
-\item[description]: this attribute can be applied to all tags but it is used only with the field tag. 
-In this case, the value of description will be used to define, in the output netcdf file, 
-the attributes long\_name and standard\_name of the variable.
-
-\item[enabled]: field and file attribute. Logical to switch on/off the output of a field or a file. 
-
-\item[freq\_op]: field attribute (automatically defined, see part 1.4 (''control of the xml attributes'')). 
-An integer defining the frequency in seconds at which NEMO is calling iom\_put for this variable. 
-It corresponds to the model time step (rn\_rdt in the namelist) except for the variables computed 
-at the frequency of the surface boundary condition (rn\_rdt ? nn\_fsbc in the namelist).   
-
-\item[grid\_ref]: field attribute. String defining the horizontal grid of the variable. 
-It refers to the id of the grid tag.
-
-\item[ibegin]: zoom attribute. Integer defining the zoom starting point along x direction. 
-Automatically defined for TAO/RAMA/PIRATA moorings (see part 1.4).  
-
-\item[id]: exists for all tag. This is a string defining the name to a specific tag that will be used 
-later to refer to this tag. Tags of the same category must have different ids.
-
-\item[jbegin]: zoom attribute. Integer defining the zoom starting point along y direction. 
-Automatically defined for TAO/RAMA/PIRATA moorings and equatorial section (see part 1.4). 
-
-\item[level]: field attribute. Integer from 0 to 10 defining the output priority of a field. 
-See output\_level attribute definition
-
-\item[operation]: field attribute. String defining the type of temporal operation to perform on a variable. 
-Possible choices are ''ave(X)'' for temporal mean, ''inst(X)'' for instantaneous, ''t\_min(X)'' for temporal min 
-and ''t\_max(X)'' for temporal max.
-
-\item[output\_freq]: file attribute. Integer defining the operation frequency in seconds. 
-For example 86400 for daily mean.
-
-\item[output\_level]: file attribute. Integer from 0 to 10 defining the output priority of variables in a file: 
-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.  
-
-\item[positive]: axis attribute (always .FALSE.). Logical defining the vertical axis convention used 
-in \NEMO (positive downward). Define the attribute positive of the variable in the netcdf output file.
-
-\item[prec]: field attribute. Integer defining the output precision. 
-Not implemented, we always output real4 arrays. 
-
-\item[name]: field or file attribute. String defining the name of a variable or a file. 
-If the name of a file is undefined, its id is used as a name. 2 files must have different names. 
-Files with specific ids will have their name automatically defined (see part 1.4). 
-Note that is name will be automatically completed by the cpu number (if needed) and ''.nc''
-
-\item[name\_suffix]: file attribute. String defining a suffix to be inserted after the name 
-and before the cpu number and the ''.nc'' termination. Files with specific ids have an 
-automatic definition of their suffix (see part 1.4).
-
-\item[ni]: zoom attribute. Integer defining the zoom extent along x direction. 
-Automatically defined for equatorial sections (see part 1.4).  
-
-\item[nj]: zoom attribute. Integer defining the zoom extent along x direction. 
-
-\item[ref]: field attribute. String referring to the id of the field we want to add in a file.
-
-\item[size]: axis attribute. use unknown...
-
-\item[unit]: field attribute. String defining the unit of a variable and the associated 
-attribute in the netcdf output file.
-
-\item[zoom\_ref]: field attribute. String defining the subdomain of data on which 
-the file should be written (to ouput data only in a limited area). 
-It refers to the id of a zoom defined in the zoom tag.
-\end{description}
-
-
-\subsection{IO\_SERVER}
+\begin{tabular}{|p{2cm}|p{4cm}|p{4cm}|p{2cm}|}
+   \hline
+   attribute name & 
+   description & 
+   example & 
+   accepted by \\ 
+   \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" & 
+   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   
+\end{tabular}
+\begin{tabular}{|p{2cm}|p{4cm}|p{4cm}|p{2cm}|}
+   \hline
+   attribute name & 
+   description & 
+   example & 
+   accepted by \\ 
+   \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 & 
+   time\_origin="1900-01-01 00:00:00"& 
+   context \\ 
+   \hline   
+   type (1)& 
+   specify if the output files must be splitted (multiple\_file) or not (one\_file) & 
+   type="multiple\_file" & 
+   file familly \\ 
+   \hline   
+   type (2)& 
+   define the type of a variable tag & 
+   type="boolean" & 
+   variable \\ 
+   \hline   
+   unit & 
+   unit of a variable or the vertical axis & 
+   unit="m" & 
+   field and axis families \\ 
+   \hline   
+   zoom\_ibegin & 
+   starting point along x direction of the zoom. Automatically defined for TAO/RAMA/PIRATA moorings & 
+   zoom\_ibegin="1" & 
+   domain family \\ 
+   \hline   
+   zoom\_jbegin & 
+   starting point along y direction of the zoom. Automatically defined for TAO/RAMA/PIRATA moorings & 
+   zoom\_jbegin="1" & 
+   domain family \\ 
+   \hline   
+   zoom\_ni & 
+   zoom extent along x direction & 
+   zoom\_ni="1" & 
+   domain family \\ 
+   \hline   
+   zoom\_nj & 
+   zoom extent along y direction & 
+   zoom\_nj="1" & 
+   domain family \\ 
+   \hline   
+\end{tabular}
+
+\subsection{XIOS: the IO\_SERVER}
 
 \subsubsection{Attached or detached mode?}
 
-Iom\_put is based on the io\_server developed by Yann Meurdesoif from IPSL 
-(see \href{http://forge.ipsl.jussieu.fr/ioserver/browser}{here} for the source code or 
-see its copy in NEMOGCM/EXTERNAL directory). 
-This server can be used in ''attached mode'' (as a library) or in ''detached mode'' 
-(as an external executable on n cpus). In attached mode, each cpu of NEMO will output 
-its own subdomain. In detached mode, the io\_server will gather data from NEMO 
-and output them split over n files with n the number of cpu dedicated to the io\_server.
-
-\subsubsection{Control the io\_server: the namelist file xmlio\_server.def}
-
-%
-%Again, a small table might be more readable?
-%Name
-%Type
-%Description
-%Comment
-%Using_server
-%Logical 
-%Switch to use the server in attached or detached mode
-%(.TRUE. corresponding to detached mode).
-
-The control of the use of the io\_server is done through the namelist file of the io\_server 
-called xmlio\_server.def.
-
-\textbf{using\_server}: logical, switch to use the server in attached or detached mode 
-(.TRUE. corresponding to detached mode).
-
-\textbf{using\_oasis}: logical, set to .TRUE. if NEMO is used in coupled mode.
-
-\textbf{client\_id} = ''oceanx'' : character, used only in coupled mode. 
-Specify the id used in OASIS to refer to NEMO. The same id must be used to refer to NEMO 
-in the \$NBMODEL part of OASIS namcouple in the call of prim\_init\_comp\_proto in cpl\_oasis3f90
-
-\textbf{server\_id} = ''ionemo'' : character, used only in coupled mode. 
-Specify the id used in OASIS to refer to the IO\_SERVER when used in detached mode. 
-Use the same id to refer to the io\_server in the \$NBMODEL part of OASIS namcouple.
-
-\textbf{global\_mpi\_buffer\_size}: integer; define the size in Mb of the MPI buffer used by the io\_server.
-
-\subsubsection{Number of cpu used by the io\_server in detached mode}
-
-The number of cpu used by the io\_server is specified only when launching the model.
-Here is an example of 2 cpus for the io\_server and 6 cpu for opa using mpirun:
-
-\texttt{ -p 2 -e ./ioserver}
-
-\texttt{ -p 6 -e ./opa }
-
+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}
@@ -413,5 +717,5 @@
 \subsubsection{Add your own outputs}
 
-It is very easy to add you own outputs with iom\_put. 4 points must be followed.
+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 \\
@@ -429,10 +733,10 @@
    <field_definition>
       ...
-      <field id="identifier" description="blabla" />   
+      <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 iom\_put.
+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''...$>$
@@ -442,5 +746,5 @@
 \begin{alltt}  {{\scriptsize
 \begin{verbatim}
-   <file id="file_1" .../>   
+   <file id="file1" .../>   
       ...
       <field ref="identifier" />   
@@ -451,43 +755,4 @@
 
 \end{description}
-
-\subsubsection{Several time axes in the output file}
-
-If your output file contains variables with different operations (see operation definition), 
-IOIPSL will create one specific time axis for each operation. Note that inst(X) will have 
-a time axis corresponding to the end each output period whereas all other operators 
-will have a time axis centred in the middle of the output periods.
-
-\subsubsection{Error/bug messages from IOIPSL}
-
-If you get the following error in the standard output file:
-\vspace{-20pt}
-\begin{alltt}  {{\scriptsize
-\begin{verbatim}
-FATAL ERROR FROM ROUTINE flio_dom_set
- --> too many domains simultaneously defined 
- --> please unset useless domains 
- --> by calling flio_dom_unset 
-\end{verbatim}
-}}\end{alltt} 
-
-You must increase the value of dom\_max\_nb in fliocom.f90 (multiply it by 10 for example). 
-
-If you mix, in the same file, variables with different freq\_op (see definition above), 
-like for example variables from the surface module with other variables, 
-IOIPSL will print in the standard output file warning messages saying there may be a bug. 
-\vspace{-20pt}
-\begin{alltt}  {{\scriptsize
-\begin{verbatim}
-WARNING FROM ROUTINE histvar_seq   
- --> There were 10 errors in the learned sequence of variables  
- --> for file   4 
- --> This looks like a bug, please report it.
-\end{verbatim}
-}}\end{alltt} 
-
-Don't worry, there is no bug, everything is properly working!
-
- %    }      %end  \gmcomment
 
 
Index: /trunk/NEMOGCM/CONFIG/AMM12/EXP00/iodef.xml
===================================================================
--- /trunk/NEMOGCM/CONFIG/AMM12/EXP00/iodef.xml	(revision 3939)
+++ /trunk/NEMOGCM/CONFIG/AMM12/EXP00/iodef.xml	(revision 3940)
@@ -21,6 +21,8 @@
     -->
     
-    <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="1ts" output_freq="1ts"  output_level="10" enabled=".TRUE."/> <!-- 1 time step files -->
+
       <file_group id="1h" output_freq="1h"  output_level="10" enabled=".TRUE."/> <!-- 1h files -->
       <file_group id="2h" output_freq="2h"  output_level="10" enabled=".TRUE."/> <!-- 2h files -->
Index: /trunk/NEMOGCM/CONFIG/GYRE/EXP00/iodef.xml
===================================================================
--- /trunk/NEMOGCM/CONFIG/GYRE/EXP00/iodef.xml	(revision 3939)
+++ /trunk/NEMOGCM/CONFIG/GYRE/EXP00/iodef.xml	(revision 3940)
@@ -21,6 +21,8 @@
     -->
     
-    <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="1ts" output_freq="1ts"  output_level="10" enabled=".TRUE."/> <!-- 1 time step files -->
+
       <file_group id="1h" output_freq="1h"  output_level="10" enabled=".TRUE."/> <!-- 1h files -->
       <file_group id="2h" output_freq="2h"  output_level="10" enabled=".TRUE."/> <!-- 2h files -->
@@ -33,5 +35,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="file1" name_suffix="_grid_T" description="ocean T grid variables" >
 	  <field field_ref="toce"         name="votemper"  />
 	  <field field_ref="soce"         name="vosaline"  />
@@ -47,15 +49,15 @@
         </file>
 	
-        <file id="5d_grid_U" name="auto" description="ocean U grid variables" >
+	<file id="file2" name_suffix="_grid_U" description="ocean U grid variables" >
           <field field_ref="uoce"         name="vozocrtx"  />
           <field field_ref="utau"         name="sozotaux"  />
         </file>
 	
-        <file id="5d_grid_V" name="auto" description="ocean V grid variables" >
+	<file id="file3" name_suffix="_grid_V" description="ocean V grid variables" >
           <field field_ref="voce"         name="vomecrty"  /> 
           <field field_ref="vtau"         name="sometauy"  /> 
         </file>
 	
-        <file id="5d_grid_W" name="auto" description="ocean W grid variables" >
+	<file id="file4" name_suffix="_grid_W" description="ocean W grid variables" >
           <field field_ref="woce"         name="vovecrtz" />
           <field field_ref="avt"          name="votkeavt" />
Index: /trunk/NEMOGCM/CONFIG/GYRE_BFM/EXP00/iodef.xml
===================================================================
--- /trunk/NEMOGCM/CONFIG/GYRE_BFM/EXP00/iodef.xml	(revision 3939)
+++ /trunk/NEMOGCM/CONFIG/GYRE_BFM/EXP00/iodef.xml	(revision 3940)
@@ -21,6 +21,8 @@
     -->
     
-    <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="1ts" output_freq="1ts"  output_level="10" enabled=".TRUE."/> <!-- 1 time step files -->
+
       <file_group id="1h" output_freq="1h"  output_level="10" enabled=".TRUE."/> <!-- 1h files -->
       <file_group id="2h" output_freq="2h"  output_level="10" enabled=".TRUE."/> <!-- 2h files -->
Index: /trunk/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/iodef.xml
===================================================================
--- /trunk/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/iodef.xml	(revision 3939)
+++ /trunk/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/iodef.xml	(revision 3940)
@@ -21,6 +21,8 @@
     -->
     
-    <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="1ts" output_freq="1ts"  output_level="10" enabled=".TRUE."/> <!-- 1 time step files -->
+
       <file_group id="1h" output_freq="1h"  output_level="10" enabled=".TRUE."/> <!-- 1h files -->
       <file_group id="2h" output_freq="2h"  output_level="10" enabled=".TRUE."/> <!-- 2h files -->
@@ -33,5 +35,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="file1" name_suffix="_grid_T" description="ocean T grid variables" >
 	  <field field_ref="toce"         name="votemper"  />
 	  <field field_ref="soce"         name="vosaline"  />
@@ -47,15 +49,15 @@
         </file>
 	
-        <file id="5d_grid_U" name="auto" description="ocean U grid variables" >
+        <file id="file2" name_suffix="_grid_U" description="ocean U grid variables" >
           <field field_ref="uoce"         name="vozocrtx"  />
           <field field_ref="utau"         name="sozotaux"  />
         </file>
 	
-        <file id="5d_grid_V" name="auto" description="ocean V grid variables" >
+        <file id="file3" name_suffix="_grid_V" description="ocean V grid variables" >
           <field field_ref="voce"         name="vomecrty"  /> 
           <field field_ref="vtau"         name="sometauy"  /> 
         </file>
 	
-        <file id="5d_grid_W" name="auto" description="ocean W grid variables" >
+        <file id="file4" name_suffix="_grid_W" description="ocean W grid variables" >
           <field field_ref="woce"         name="vovecrtz" />
           <field field_ref="avt"          name="votkeavt" />
@@ -63,5 +65,5 @@
         </file>
 
-	<file id="5d_ptrc_T" name="auto" description="lobster sms variables" >
+	<file id="file5" name="_ptrc_T" description="lobster sms variables" >
           <field field_ref="DET"      />
           <field field_ref="ZOO"      />
@@ -82,5 +84,5 @@
       <file_group id="1y"  output_freq="1y" output_level="10" enabled=".TRUE."> <!-- real yearly files -->
 
-	<file id="1y_diad_T" name="auto" description="additional lobster diagnostics" >  
+	<file id="file6" name_suffix="_diad_T" description="additional lobster diagnostics" >  
           <field field_ref="FNO3PHY"   /> 
           <field field_ref="FNH4PHY"   /> 
Index: /trunk/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_ar5.xml
===================================================================
--- /trunk/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_ar5.xml	(revision 3939)
+++ /trunk/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_ar5.xml	(revision 3940)
@@ -26,10 +26,10 @@
     -->
     
-    <file_definition type="multiple_file" output_level="10" sync_freq="1d" min_digits="4">
+    <file_definition type="multiple_file" name="@expname@_@freq@_@startdate@_@enddate@" output_level="10" sync_freq="2mo" min_digits="4">
       <!--
 +++++++++++++++++++++++++++++++++++++++++++++++   daily   ++++++++++++++++++++++++++++++++++++++++++++++++++
         -->
       <file_group id="1d" output_freq="1d"  enabled=".TRUE.">                      <!-- 1d files -->
-	<file id="1d_grid_T" name="auto" name_suffix="_table2.2" >         <!-- grid T  -->
+	<file id="file1" name_suffix="_grid_T_table2.2" >         <!-- grid T  -->
 	  <field field_ref="sst"          name='tos'      long_name="sea_surface_temperature"                              level="2"                      />
 	  <field field_ref="sst2"         name='tossq'    long_name="square_of_sea_surface_temperature"                    level="2"                      />
@@ -43,151 +43,136 @@
 	<!--
 ..............................................    grid T   .................................................
-	  -->
-	<file_group id="1m_grid_T" name="auto" >                                                        <!-- grid T -->
-	  
-	  <file id="1m grid_T table 2.2" name_suffix="_table2.2" >
-	    <field field_ref="botpres"      name="pbo"      long_name="sea_water_pressure_at_sea_floor"                               />
-	    <!-- pso : sea_water_pressure_at_sea_water_surface = 0 -->
-	    <field field_ref="ssh"          name="zos"      long_name="sea_surface_height_above_geoid"                                 />
-	    <field field_ref="ssh2"         name="zossq"    long_name="square_of_sea_surface_height_above_geoid"             level="2" />
-	    <!-- masscello : sea_water_mass_per_unit_area = cellthc*rau0                                          no time changes -->
-	    <field field_ref="cellthc"      name="thkcello" long_name="cell_thickness"                                                 /> <!-- no time changes -->
-	    <field field_ref="toce"         name="thetao"   long_name="sea_water_potential_temperature"                                />
-	    <field field_ref="sst"          name="tos"      long_name="sea_surface_temperature"                              level="1" />
-	    <field field_ref="sst2"         name="tossq"    long_name="square_of_sea_surface_temperature"                    level="2" />
-	    <field field_ref="soce"         name="so"       long_name="sea_water_salinity"                                             />
-	    <field field_ref="sss"          name="sos"      long_name="sea_surface_salinity"                                 level="1" />
-	    <field field_ref="rhop"         name="rhopoto"  long_name="sea_water_potential_density"                          level="2" />
-	    <!-- no agessc : sea_water_age_since_surface_contact -->
-	    <!-- no cfc11  : moles_per_unit_mass_of_cfc11_in_sea_water -->
-	    <!-- msftbarot : ocean_barotropic_mass_streamfunction : offline -->
-	    <!-- mlotst    :           ocean_mixed_layer_thickness_defined_by_sigma_t : must be done offline -->
-	    <!-- mlotstsq  : square_of_ocean_mixed_layer_thickness_defined_by_sigma_t : must be done offline -->
-	    <field field_ref="mldkz5"       name='omlmax'   long_name="ocean_mixed_layer_thickness_defined_by_mixing_scheme" level="2" operation="maximum" />
-	  </file>   
-	  
-	  <file id="1m grid_T table 2.5" name_suffix="_table2.5" >
-	    <field field_ref="rain"         name="pr"       long_name="rainfall_flux"                                           level="1" />
-	    <field field_ref="snow_ao_cea"  name="prsn"     long_name="snowfall_flux"                                           level="1" />
-	    <field field_ref="evap_ao_cea"  name="evs"      long_name="water_evaporation_flux"                                  level="1" />
-	    <field field_ref="runoffs"      name="friver"   long_name="water_flux_into_sea_water_from_rivers"                   level="1" />
-	    <field field_ref="calving"      name="ficeberg" long_name="water_flux_into_sea_water_from_icebergs"                 level="1" />
-	    <field field_ref="isnwmlt_cea"  name="fsitherm" long_name="water_flux_into_sea_water_due_to_sea_ice_thermodynamics" level="1" />
-	    <field field_ref="empmr"        name="wfo"      long_name="water_flux_into_sea_water"                               level="1" />
-	    <!-- wfonocorr : water_flux_into_sea_water_without_flux_correction : emp - erp -->  
-	    <field field_ref="erp"          name="wfcorr"   long_name="water_flux_correction"                                   level="1" /> <!-- usually = 0 -->
-	  </file>   
-	  
-	  <file id="1m grid_T table 2.6" name_suffix="_table2.6" >
-	    <!-- vsfpr    : virtual_salt_flux_into_sea_water_due_to_rainfall    = 0 --> 
-	    <!-- vsfevap  : virtual_salt_flux_into_sea_water_due_to_evaporation = 0 --> 
-	    <!-- vsfriver : virtual_salt_flux_into_sea_water_from_rivers        = 0 --> 	  
-	    <field field_ref="fsal_virt_cea" name="vsfsit" long_name="virtual_salt_flux_into_sea_water_due_to_sea_ice_thermodynamics" level="1" />
-	    <!-- vsf      : virtual_salt_flux_into_sea_water = fsal_virtual + fsal_real -->
-	    <!-- wfcorr   : virtual_salt_flux_correction                        = 0 --> 
-	    <field field_ref="fsal_virt_cea" name="sfdsi"  long_name="downward_sea_ice_basal_salt_flux"                               level="1" />
-	    <!-- sfriver  : salt_flux_into_sea_water_from_rivers                = 0 --> 
-	  </file>   
-	  
-	  <file id="1m grid_T table 2.7" name_suffix="_table2.7" >
-	    <!-- hfgeou : upward_geothermal_heat_flux_at_sea_floor : cte, see nambbc and trabbc.F90 -->
-	    <field field_ref="hflx_rain_cea" name="hfrainds"    long_name="temperature_flux_due_to_rainfall_expressed_as_heat_flux_into_sea_water"      level="1" />
-	    <field field_ref="hflx_evap_cea" name="hfevapds"    long_name="temperature_flux_due_to_evaporation_expressed_as_heat_flux_out_of_sea_water" level="1" />
-	    <field field_ref="hflx_rnf_cea"  name="hfrunoffds"  long_name="temperature_flux_due_to_runoff_expressed_as_heat_flux_into_sea_water"        level="1" />
-	    <field field_ref="hflx_snow_cea" name="hfsnthermds" long_name="heat_flux_into_sea_water_due_to_snow_thermodynamics"                         level="1" />
-	    <field field_ref="hflx_ice_cea"  name="hfsithermds" long_name="heat_flux_into_sea_water_due_to_sea_ice_thermodynamics"                      level="1" />
-	    <field field_ref="hflx_cal_cea"  name="hfibthermds" long_name="heat_flux_into_sea_water_due_to_iceberg_thermodynamics"                      level="1" />
-	    <!-- rlds   : surface_net_downward_longwave_flux : not available -->
-	    <!-- hfls   : surface_downward_latent_heat_flux  : not available -->
-	    <!-- hfss   : surface_downward_sensible_heat_flux: not available -->
-	    <field field_ref="qns"           name="nshfls"      long_name="surface_net_downward_non_solar_flux"                                         level="1" />
-	    <field field_ref="qsr"           name="rsntds"      long_name="surface_net_downward_shortwave_flux"                                         level="1" />
-	    <field field_ref="qsr3d"         name="rsds"        long_name="downwelling_shortwave_flux_in_sea_water"                                     level="1" />
-	    <field field_ref="qrp"           name="hfcorr"      long_name="heat_flux_correction"                                                        level="1" />
-	  </file>   
-	</file_group>
+	  -->	  
+	<file id="file2" name_suffix="_grid_T_table2.2" >
+	  <field field_ref="botpres"      name="pbo"      long_name="sea_water_pressure_at_sea_floor"                               />
+	  <!-- pso : sea_water_pressure_at_sea_water_surface = 0 -->
+	  <field field_ref="ssh"          name="zos"      long_name="sea_surface_height_above_geoid"                                 />
+	  <field field_ref="ssh2"         name="zossq"    long_name="square_of_sea_surface_height_above_geoid"             level="2" />
+	  <!-- masscello : sea_water_mass_per_unit_area = cellthc*rau0                                          no time changes -->
+	  <field field_ref="cellthc"      name="thkcello" long_name="cell_thickness"                                                 /> <!-- no time changes -->
+	  <field field_ref="toce"         name="thetao"   long_name="sea_water_potential_temperature"                                />
+	  <field field_ref="sst"          name="tos"      long_name="sea_surface_temperature"                              level="1" />
+	  <field field_ref="sst2"         name="tossq"    long_name="square_of_sea_surface_temperature"                    level="2" />
+	  <field field_ref="soce"         name="so"       long_name="sea_water_salinity"                                             />
+	  <field field_ref="sss"          name="sos"      long_name="sea_surface_salinity"                                 level="1" />
+	  <field field_ref="rhop"         name="rhopoto"  long_name="sea_water_potential_density"                          level="2" />
+	  <!-- no agessc : sea_water_age_since_surface_contact -->
+	  <!-- no cfc11  : moles_per_unit_mass_of_cfc11_in_sea_water -->
+	  <!-- msftbarot : ocean_barotropic_mass_streamfunction : offline -->
+	  <!-- mlotst    :           ocean_mixed_layer_thickness_defined_by_sigma_t : must be done offline -->
+	  <!-- mlotstsq  : square_of_ocean_mixed_layer_thickness_defined_by_sigma_t : must be done offline -->
+	  <field field_ref="mldkz5"       name='omlmax'   long_name="ocean_mixed_layer_thickness_defined_by_mixing_scheme" level="2" operation="maximum" />
+	</file>   
+	
+	<file id="file3" name_suffix="_grid_T_table2.5" >
+	  <field field_ref="rain"         name="pr"       long_name="rainfall_flux"                                           level="1" />
+	  <field field_ref="snow_ao_cea"  name="prsn"     long_name="snowfall_flux"                                           level="1" />
+	  <field field_ref="evap_ao_cea"  name="evs"      long_name="water_evaporation_flux"                                  level="1" />
+	  <field field_ref="runoffs"      name="friver"   long_name="water_flux_into_sea_water_from_rivers"                   level="1" />
+	  <field field_ref="calving"      name="ficeberg" long_name="water_flux_into_sea_water_from_icebergs"                 level="1" />
+	  <field field_ref="isnwmlt_cea"  name="fsitherm" long_name="water_flux_into_sea_water_due_to_sea_ice_thermodynamics" level="1" />
+	  <field field_ref="empmr"        name="wfo"      long_name="water_flux_into_sea_water"                               level="1" />
+	  <!-- wfonocorr : water_flux_into_sea_water_without_flux_correction : emp - erp -->  
+	  <field field_ref="erp"          name="wfcorr"   long_name="water_flux_correction"                                   level="1" /> <!-- usually = 0 -->
+	</file>   
+	
+	<file id="file4" name_suffix="_grid_T_table2.6" >
+	  <!-- vsfpr    : virtual_salt_flux_into_sea_water_due_to_rainfall    = 0 --> 
+	  <!-- vsfevap  : virtual_salt_flux_into_sea_water_due_to_evaporation = 0 --> 
+	  <!-- vsfriver : virtual_salt_flux_into_sea_water_from_rivers        = 0 --> 	  
+	  <field field_ref="fsal_virt_cea" name="vsfsit" long_name="virtual_salt_flux_into_sea_water_due_to_sea_ice_thermodynamics" level="1" />
+	  <!-- vsf      : virtual_salt_flux_into_sea_water = fsal_virtual + fsal_real -->
+	  <!-- wfcorr   : virtual_salt_flux_correction                        = 0 --> 
+	  <field field_ref="fsal_virt_cea" name="sfdsi"  long_name="downward_sea_ice_basal_salt_flux"                               level="1" />
+	  <!-- sfriver  : salt_flux_into_sea_water_from_rivers                = 0 --> 
+	</file>   
+	
+	<file id="file5" name_suffix="_grid_T_table2.7" >
+	  <!-- hfgeou : upward_geothermal_heat_flux_at_sea_floor : cte, see nambbc and trabbc.F90 -->
+	  <field field_ref="hflx_rain_cea" name="hfrainds"    long_name="temperature_flux_due_to_rainfall_expressed_as_heat_flux_into_sea_water"      level="1" />
+	  <field field_ref="hflx_evap_cea" name="hfevapds"    long_name="temperature_flux_due_to_evaporation_expressed_as_heat_flux_out_of_sea_water" level="1" />
+	  <field field_ref="hflx_rnf_cea"  name="hfrunoffds"  long_name="temperature_flux_due_to_runoff_expressed_as_heat_flux_into_sea_water"        level="1" />
+	  <field field_ref="hflx_snow_cea" name="hfsnthermds" long_name="heat_flux_into_sea_water_due_to_snow_thermodynamics"                         level="1" />
+	  <field field_ref="hflx_ice_cea"  name="hfsithermds" long_name="heat_flux_into_sea_water_due_to_sea_ice_thermodynamics"                      level="1" />
+	  <field field_ref="hflx_cal_cea"  name="hfibthermds" long_name="heat_flux_into_sea_water_due_to_iceberg_thermodynamics"                      level="1" />
+	  <!-- rlds   : surface_net_downward_longwave_flux : not available -->
+	  <!-- hfls   : surface_downward_latent_heat_flux  : not available -->
+	  <!-- hfss   : surface_downward_sensible_heat_flux: not available -->
+	  <field field_ref="qns"           name="nshfls"      long_name="surface_net_downward_non_solar_flux"                                         level="1" />
+	  <field field_ref="qsr"           name="rsntds"      long_name="surface_net_downward_shortwave_flux"                                         level="1" />
+	  <field field_ref="qsr3d"         name="rsds"        long_name="downwelling_shortwave_flux_in_sea_water"                                     level="1" />
+	  <field field_ref="qrp"           name="hfcorr"      long_name="heat_flux_correction"                                                        level="1" />
+	</file>   
 	<!--
 ..............................................    grid U   .................................................
-	  -->
-	<file_group id="1m_grid_U" name="auto" >                                                        <!-- grid U -->
-
-	  <file id="1m grid_U table 2.3" name_suffix="_table2.3" >
-	    <field field_ref="uoce"         name="uo"      long_name="sea_water_x_velocity"                                       />
-	    <field field_ref="u_masstr"     name="umo"     long_name="ocean_mass_x_transport"                           level="1" />
-	    <field field_ref="u_heattr"     name="hfx"     long_name="ocean_heat_x_transport"                           level="1" />
-	    <field field_ref="ueiv_heattr"  name="hfxba"   long_name="ocean_heat_x_transport_due_to_bolus_advection"    level="2" />
-	    <field field_ref="udiff_heattr" name="hfxdiff" long_name="ocean_heat_x_transport_due_to_diffusion"          level="2" />
-	  </file>   
-
-	  <file id="1m grid_U table 2.8" name_suffix="_table2.8" >
-	    <field field_ref="utau"         name="tauuo" long_name="surface_downward_x_stress"                          level="1" />
-	    <!-- tauucorr : surface_downward_x_stress_correction = 0 -->
-	  </file>   
-
-	</file_group>
+	-->
+	<file id="file6" name_suffix="_grid_U_table2.3" >
+	  <field field_ref="uoce"         name="uo"      long_name="sea_water_x_velocity"                                       />
+	  <field field_ref="u_masstr"     name="umo"     long_name="ocean_mass_x_transport"                           level="1" />
+	  <field field_ref="u_heattr"     name="hfx"     long_name="ocean_heat_x_transport"                           level="1" />
+	  <field field_ref="ueiv_heattr"  name="hfxba"   long_name="ocean_heat_x_transport_due_to_bolus_advection"    level="2" />
+	  <field field_ref="udiff_heattr" name="hfxdiff" long_name="ocean_heat_x_transport_due_to_diffusion"          level="2" />
+	</file>   
+	
+	<file id="file7" name_suffix="_grid_U_table2.8" >
+	  <field field_ref="utau"         name="tauuo" long_name="surface_downward_x_stress"                          level="1" />
+	  <!-- tauucorr : surface_downward_x_stress_correction = 0 -->
+	</file>   
 	<!--
 ..............................................    grid V   .................................................
-	  -->
-	<file_group id="1m_grid_V" name="auto" >                                                        <!-- grid V -->
-
-	  <file id="1m grid_V table 2.3" name_suffix="_table2.3" >
-	    <field field_ref="voce"         name="vo"      long_name="sea_water_y_velocity"                                       />
-	    <field field_ref="v_masstr"     name="vmo"     long_name="ocean_mass_y_transport"                           level="1" />
-	    <field field_ref="v_heattr"     name="hfy"     long_name="ocean_heat_y_transport"                           level="1" />
-	    <field field_ref="veiv_heattr"  name="hfyba"   long_name="ocean_heat_y_transport_due_to_bolus_advection"    level="2" />
-	    <field field_ref="vdiff_heattr" name="hfydiff" long_name="ocean_heat_y_transport_due_to_diffusion"          level="2" />
-	  </file>   
-
-	  <file id="1m grid_V table 2.8" name_suffix="_table2.8" >
-	    <field field_ref="vtau"         name="tauvo" long_name="surface_downward_y_stress"                          level="1" />
-	    <!-- tauvcorr : surface_downward_y_stress_correction = 0 -->
-	  </file>   
-
-	</file_group>
+	-->
+	<file id="file8" name_suffix="_grid_V_table2.3" >
+	  <field field_ref="voce"         name="vo"      long_name="sea_water_y_velocity"                                       />
+	  <field field_ref="v_masstr"     name="vmo"     long_name="ocean_mass_y_transport"                           level="1" />
+	  <field field_ref="v_heattr"     name="hfy"     long_name="ocean_heat_y_transport"                           level="1" />
+	  <field field_ref="veiv_heattr"  name="hfyba"   long_name="ocean_heat_y_transport_due_to_bolus_advection"    level="2" />
+	  <field field_ref="vdiff_heattr" name="hfydiff" long_name="ocean_heat_y_transport_due_to_diffusion"          level="2" />
+	</file>   
+	
+	<file id="file9" name_suffix="_grid_V_table2.8" >
+	  <field field_ref="vtau"         name="tauvo" long_name="surface_downward_y_stress"                          level="1" />
+	  <!-- tauvcorr : surface_downward_y_stress_correction = 0 -->
+	</file>   
 	<!--
 ..............................................    grid W   .................................................
-	  -->
-	<file_group id="1m_grid_W" name="auto" >                                                        <!-- grid W -->
-	  
-	  <file id="1m grid_W table 2.3" name_suffix="_table2.3" >
-	    <field field_ref="w_masstr"   name="wmo"   long_name="upward_ocean_mass_transport"                                    />
-	    <field field_ref="w_masstr2"  name="wmosq" long_name="square_pf_upward_ocean_mass_transport"                          />
-	  </file>   
-	  
-	  <file id="1m grid_W table 2.9" name_suffix="_table2.9" >
-	    <field field_ref="avt"     name="difvho"   long_name="ocean_vertical_heat_diffusivity"                  level="2" />
-	    <field field_ref="avs"     name="difvso"   long_name="ocean_vertical_salt_diffusivity"                  level="2" />
-	    <!-- difvtrbo : ocean_vertical_tracer_diffusivity_due_to_background : cte with time, see namelist parameters nn_avb and  nn_havtb -->
-	    <field field_ref="av_tide" name="difvtrto" long_name="ocean_vertical_tracer_diffusivity_due_to_tides"   level="2" />
-	    <!-- tnpeo     : tendency_of_ocean_potential_energy_content                   : not available -->
-	    <!-- tnpeot    : tendency_of_ocean_potential_energy_content_due_to_tides      : not available -->
-	    <!-- tnpeotb   : tendency_of_ocean_potential_energy_content_due_to_background : not available -->
-	    <field field_ref="avm"     name="difvmo"   long_name="ocean_vertical_momentum_diffusivity"              level="2" />
-	    <!-- difvmbo : ocean_vertical_momentum_diffusivity_due_to_background : cte with time, see namelist parameters nn_avb -->
-	    <field field_ref="av_tide" name="difvmto"  long_name="ocean_vertical_momentum_diffusivity_due_to_tides" level="2" /> <!-- same as tracer -->
-	    <!-- difvmfdo : ocean_vertical_momentum_diffusivity_due_to_form_drag : ??? -->
-	    <!-- dispkevfo : ocean_kinetic_energy_dissipation_per_unit_area_due_to_vertical_friction : not available -->
-	  </file>
-
-	  <file id="1m grid_W table 2.10" name_suffix="_table2.10" >
-	    <!-- if ln_traldf_lap    =  .true. -->
-	    <field field_ref="aht2d_eiv" name="diftrblo" long_name="ocean_tracer_bolus_laplacian_diffusivity"                     level="2" />
-	    <!-- diftrelo : ocean_tracer_epineutral_laplacian_diffusivity : cte with time, see ln_traldf_iso -->
-	    <!-- diftrxylo : ocean_tracer_xy_laplacian_diffusivity : cte with time -->
-	    <!-- if ln_traldf_bilap  =  .true. -->
-	    <!-- field field_ref="diftrbbo" name="aht2d_eiv" long_name="ocean_tracer_bolus_biharmonic_diffusivity"                    level="2" /-->
-	    <!-- diftrebo : ocean_tracer_epineutral_biharmonic_diffusivity : cte with time, see ln_traldf_iso -->
-	    <!-- diftrxybo : ocean_tracer_xy_biharmonic_diffusivity : cte with time -->
-	    <!-- tnkebto : tendency_of_ocean_eddy_kinetic_energy_content_due_to_bolus_transport : not available -->
-	    <!-- difmxylo : ocean_momentum_xy_laplacian_diffusivity : cte with time, see ln_dynldf_lap -->
-	    <!-- difmxybo : ocean_momentum_xy_biharmonic_diffusivity : cte with time, see ln_dynldf_bilap -->
-	    <!-- dispkexyfo : ocean_kinetic_energy_dissipation_per_unit_area_due_to_xy_friction : not available -->
-	  </file>   
-
-	</file_group>
+	-->
+	<file id="file10" name_suffix="_grid_W_table2.3" >
+	  <field field_ref="w_masstr"   name="wmo"   long_name="upward_ocean_mass_transport"                                    />
+	  <field field_ref="w_masstr2"  name="wmosq" long_name="square_pf_upward_ocean_mass_transport"                          />
+	</file>   
+	
+	<file id="file11" name_suffix="_grid_W_table2.9" >
+	  <field field_ref="avt"     name="difvho"   long_name="ocean_vertical_heat_diffusivity"                  level="2" />
+	  <field field_ref="avs"     name="difvso"   long_name="ocean_vertical_salt_diffusivity"                  level="2" />
+	  <!-- difvtrbo : ocean_vertical_tracer_diffusivity_due_to_background : cte with time, see namelist parameters nn_avb and  nn_havtb -->
+	  <field field_ref="av_tide" name="difvtrto" long_name="ocean_vertical_tracer_diffusivity_due_to_tides"   level="2" />
+	  <!-- tnpeo     : tendency_of_ocean_potential_energy_content                   : not available -->
+	  <!-- tnpeot    : tendency_of_ocean_potential_energy_content_due_to_tides      : not available -->
+	  <!-- tnpeotb   : tendency_of_ocean_potential_energy_content_due_to_background : not available -->
+	  <field field_ref="avm"     name="difvmo"   long_name="ocean_vertical_momentum_diffusivity"              level="2" />
+	  <!-- difvmbo : ocean_vertical_momentum_diffusivity_due_to_background : cte with time, see namelist parameters nn_avb -->
+	  <field field_ref="av_tide" name="difvmto"  long_name="ocean_vertical_momentum_diffusivity_due_to_tides" level="2" /> <!-- same as tracer -->
+	  <!-- difvmfdo : ocean_vertical_momentum_diffusivity_due_to_form_drag : ??? -->
+	  <!-- dispkevfo : ocean_kinetic_energy_dissipation_per_unit_area_due_to_vertical_friction : not available -->
+	</file>
+	
+	<file id="file12" name_suffix="_grid_W_table2.10" >
+	  <!-- if ln_traldf_lap    =  .true. -->
+	  <field field_ref="aht2d_eiv" name="diftrblo" long_name="ocean_tracer_bolus_laplacian_diffusivity"                     level="2" />
+	  <!-- diftrelo : ocean_tracer_epineutral_laplacian_diffusivity : cte with time, see ln_traldf_iso -->
+	  <!-- diftrxylo : ocean_tracer_xy_laplacian_diffusivity : cte with time -->
+	  <!-- if ln_traldf_bilap  =  .true. -->
+	  <!-- field field_ref="diftrbbo" name="aht2d_eiv" long_name="ocean_tracer_bolus_biharmonic_diffusivity"                    level="2" /-->
+	  <!-- diftrebo : ocean_tracer_epineutral_biharmonic_diffusivity : cte with time, see ln_traldf_iso -->
+	  <!-- diftrxybo : ocean_tracer_xy_biharmonic_diffusivity : cte with time -->
+	  <!-- tnkebto : tendency_of_ocean_eddy_kinetic_energy_content_due_to_bolus_transport : not available -->
+	  <!-- difmxylo : ocean_momentum_xy_laplacian_diffusivity : cte with time, see ln_dynldf_lap -->
+	  <!-- difmxybo : ocean_momentum_xy_biharmonic_diffusivity : cte with time, see ln_dynldf_bilap -->
+	  <!-- dispkexyfo : ocean_kinetic_energy_dissipation_per_unit_area_due_to_xy_friction : not available -->
+	</file>   
 	<!--
 ..............................................    scalar   .................................................
-	  -->
-	<file id="1m_scalar" name="auto" name_suffix="_table2.2" >         <!-- scalar -->
+	-->
+	<file id="file13" name_suffix="_scalar_table2.2" >         <!-- scalar -->
 	  <field field_ref="masstot"    name="masso"    long_name="sea_water_mass"                                />
 	  <field field_ref="voltot"     name="volo"     long_name="sea_water_volume"                              />
@@ -200,6 +185,6 @@
 	<!--
 ..............................................    icemod   .................................................
-	  -->
-	<file id="1m_icemod" name="auto" name_suffix="_table2.2" >         <!-- scalar -->
+	-->
+	<file id="file14" name_suffix="_icemod_table2.2" >         <!-- scalar -->
 	  <field field_ref="ice_pres"                     />
 	  <field field_ref="ice_cover"    name="sic"        long_name="sea_ice_area_fraction"                            />
Index: /trunk/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_default.xml
===================================================================
--- /trunk/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_default.xml	(revision 3939)
+++ /trunk/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_default.xml	(revision 3940)
@@ -21,6 +21,8 @@
     -->
     
-    <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="1ts" output_freq="1ts"  output_level="10" enabled=".TRUE."/> <!-- 1 time step files -->
+
       <file_group id="1h" output_freq="1h"  output_level="10" enabled=".TRUE."/> <!-- 1h files -->
       <file_group id="2h" output_freq="2h"  output_level="10" enabled=".TRUE."/> <!-- 2h files -->
@@ -31,5 +33,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="tos"      long_name="sea_surface_temperature"                       />
 	  <field field_ref="sss"          name="sos"      long_name="sea_surface_salinity"                          />
@@ -37,18 +39,19 @@
 	</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="uos"     long_name="sea_surface_x_velocity"    />
 	</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="vos"     long_name="sea_surface_y_velocity"    />
 	</file>
 	
       </file_group>
+
       <file_group id="3d" output_freq="3d"  output_level="10" enabled=".TRUE."/> <!-- 3d files -->    
 
       <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="thetao"   long_name="sea_water_potential_temperature"               />
 	  <field field_ref="soce"         name="so"       long_name="sea_water_salinity"                            />
@@ -66,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="uo"      long_name="sea_water_x_velocity"      />
 	  <field field_ref="suoce"        name="uos"     long_name="sea_surface_x_velocity"    />
@@ -72,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="vo"      long_name="sea_water_y_velocity"      />
 	  <field field_ref="svoce"        name="vos"     long_name="sea_surface_y_velocity"    />
@@ -78,10 +81,10 @@
 	</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="wo"      long_name="ocean vertical velocity"         />
 	  <field field_ref="avt"          name="difvho"  long_name="ocean_vertical_heat_diffusivity" />
 	</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="snd"     long_name="surface_snow_thickness"   />
Index: /trunk/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_demo.xml
===================================================================
--- /trunk/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_demo.xml	(revision 3939)
+++ /trunk/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_demo.xml	(revision 3940)
@@ -21,8 +21,8 @@
     -->
     
-    <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 -->
-	<file id="1h_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"  />
 	  <field field_ref="qsr"  />
@@ -32,44 +32,41 @@
      
       <file_group id="1d" output_freq="1d"  output_level="10" enabled=".TRUE."> <!-- 1d files -->
-
-	<file_group id="1d_grid_T" name="auto" description="ocean T grid variables" >
-
-	  <!-- example of "hand made" zoom  -->
-	  <file id="blabla_1" name_suffix="_myzoom" >
-	    <!-- group of variables sharing the same zoom. see zoom definition in domain_def.xml -->
-	    <field_group id="blabla" domain_ref="myzoom" >    
-	      <field field_ref="toce" />
-	      <field field_ref="soce" />
-	    </field_group>
-	  </file>
-
-	  <!-- 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" name_suffix="auto" >
-	      <field_group group_ref="mooring"/>  
-	  </file>
-
-	  <!-- Equatorial section: automatic definition of the file name suffix based on id="EqT" -->
-	  <!-- Zoom over vertical axis. def of axis_ref in the axis_definition bellow -->
-	  <file id="EqT" name_suffix="auto" >
-	    <field_group id="EqT" domain_ref="EqT" >
-	      <field field_ref="toce" name="votemper" axis_ref="deptht_zoom"  />
-	    </field_group>
-	  </file>
-
-	  <!-- global file with different operations on data   -->
-	  <file id="blabla_2" >
-	    <field field_ref="toce"   default_value="-10" />    <!-- redefine the missing value -->
-	    <field field_ref="sst"    name="sstmooring1" domain_ref="0n180wT"  />   <!-- include a mooring -->
-	    <field field_ref="sst"    name="sst_1d_ave"  />                         <!-- mean -->
-	    <field field_ref="sst"    name="sst_1d_inst" operation="instant" />     <!-- instant value -->
-	    <field field_ref="sst"    name="sst_1d_max"  operation="maximum" />     <!-- max -->
-	    <field field_ref="suoce"  />   <!-- include a U-grid variable in the list -->
-	  </file>
-
-	</file_group>
+	
+	<!-- example of "hand made" zoom  -->
+	<file id="file2" name_suffix="_grid_T_myzoom" >
+	  <!-- group of variables sharing the same zoom. see zoom definition in domain_def.xml -->
+	  <field_group id="blabla" domain_ref="myzoom" >    
+	    <field field_ref="toce" />
+	    <field field_ref="soce" />
+	  </field_group>
+	</file>
+	
+	<!-- 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>
+	
+	<!-- Equatorial section: automatic definition of the file name suffix based on id="EqT" -->
+	<!-- Zoom over vertical axis. def of axis_ref in the axis_definition bellow -->
+	<file id="EqT" >
+	  <field_group id="EqT" domain_ref="EqT" >
+	    <field field_ref="toce" name="votemper" axis_ref="deptht_myzoom"  />
+	  </field_group>
+	</file>
+	
+	<!-- global file with different operations on data   -->
+	<file id="file3" >
+	  <field field_ref="toce"   default_value="-10" />    <!-- redefine the missing value -->
+	  <field field_ref="sst"    name="sstmooring1" domain_ref="0n180wT"  />   <!-- include a mooring -->
+	  <field field_ref="sst"    name="sst_1d_ave"  />                         <!-- mean -->
+	  <field field_ref="sst"    name="sst_1d_inst" operation="instant" />     <!-- instant value -->
+	  <field field_ref="sst"    name="sst_1d_max"  operation="maximum" />     <!-- max -->
+	  <field field_ref="suoce"  />   <!-- include a U-grid variable in the list -->
+	</file>
+	
       </file_group>
-
-   </file_definition>
+      
+    </file_definition>
     
     <!-- 
@@ -82,5 +79,5 @@
      <axis_group id="deptht" long_name="Vertical T levels" unit="m" positive="down" >
        <axis id="deptht" />
-       <axis id="deptht_zoom" zoom_begin="1" zoom_end="10" />
+       <axis id="deptht_myzoom" zoom_begin="1" zoom_end="10" />
      </axis_group>
       <axis id="depthu" long_name="Vertical U levels" unit="m" positive="down" />
Index: /trunk/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_oldstyle.xml
===================================================================
--- /trunk/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_oldstyle.xml	(revision 3939)
+++ /trunk/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef_oldstyle.xml	(revision 3940)
@@ -21,6 +21,8 @@
     -->
     
-    <file_definition type="multiple_file" sync_freq="1d" min_digits="4">
+    <file_definition type="multiple_file" name="@expname@_@freq@_@startdate@_@enddate@" sync_freq="1mo" min_digits="4">
     
+      <file_group id="1ts" output_freq="1ts"  output_level="10" enabled=".TRUE."/> <!-- 1 time step files -->
+
       <file_group id="1h" output_freq="1h"  output_level="10" enabled=".TRUE."/> <!-- 1h files -->
       <file_group id="2h" output_freq="2h"  output_level="10" enabled=".TRUE."/> <!-- 2h files -->
@@ -33,5 +35,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="file1" name_suffix="_grid_T" description="ocean T grid variables" >
 	  <field field_ref="toce"         name="votemper"  />
 	  <field field_ref="soce"         name="vosaline"  />
@@ -52,5 +54,5 @@
 	</file>
 	
-	<file id="5d_grid_U" name="auto" description="ocean U grid variables" >
+	<file id="file2" name_suffix="_grid_U" description="ocean U grid variables" >
 	  <field field_ref="uoce"         name="vozocrtx"  />
 	  <field field_ref="uoce_eiv"     name="vozoeivu"  />
@@ -58,5 +60,5 @@
 	</file>
 	
-	<file id="5d_grid_V" name="auto" description="ocean V grid variables" >
+	<file id="file3" name_suffix="_grid_V" description="ocean V grid variables" >
 	  <field field_ref="voce"         name="vomecrty"  />
 	  <field field_ref="voce_eiv"     name="vomeeivv"  />
@@ -64,5 +66,5 @@
 	</file>
 	
-	<file id="5d_grid_W" name="auto" description="ocean W grid variables" >
+	<file id="file4" name_suffix="_grid_W" description="ocean V grid variables" >
 	  <field field_ref="woce"         name="vovecrtz" />
 	  <field field_ref="avt"          name="votkeavt" />
@@ -71,5 +73,5 @@
 	</file>
 	
-	<file id="5d_icemod" name="auto" description="ice variables" >
+	<file id="file5" name_suffix="_icemod" description="ocean V grid variables" >
 	  <field field_ref="ice_pres"                     />
 	  <field field_ref="snowthic_cea" name="isnowthi" />
Index: /trunk/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90
===================================================================
--- /trunk/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90	(revision 3939)
+++ /trunk/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90	(revision 3940)
@@ -36,4 +36,5 @@
    USE xios
 # endif
+   USE ioipsl, ONLY :  ju2ymds    ! for calendar
 
    IMPLICIT NONE
@@ -52,6 +53,6 @@
    PRIVATE iom_p1d, iom_p2d, iom_p3d
 #if defined key_iomput
-   PRIVATE iom_set_domain_attr, iom_set_axis_attr, iom_set_field_attr, iom_set_file_attr, iom_set_grid_attr
-   PRIVATE set_grid, set_scalar, set_xmlatt, set_mooring
+   PRIVATE iom_set_domain_attr, iom_set_axis_attr, iom_set_field_attr, iom_set_file_attr, iom_get_file_attr, iom_set_grid_attr
+   PRIVATE set_grid, set_scalar, set_xmlatt, set_mooring, iom_update_file_name, iom_sdate
 # endif
 
@@ -130,11 +131,11 @@
 
       ! end file definition
-       dtime%second=rdt
-       CALL xios_set_timestep(dtime)
-       CALL xios_close_context_definition()
-
-       CALL xios_update_calendar(0)
+      dtime%second = rdt
+      CALL xios_set_timestep(dtime)
+      CALL xios_close_context_definition()
+      
+      CALL xios_update_calendar(0)
 #endif
-
+      
    END SUBROUTINE iom_init
 
@@ -174,9 +175,9 @@
       LOGICAL         , INTENT(in   ), OPTIONAL ::   ldiof    ! Interp On the Fly, needed for AGRIF (default = .FALSE.)
 
-      CHARACTER(LEN=100)    ::   clname    ! the name of the file based on cdname [[+clcpu]+clcpu]
-      CHARACTER(LEN=100)    ::   cltmpn    ! tempory name to store clname (in writting mode)
+      CHARACTER(LEN=256)    ::   clname    ! the name of the file based on cdname [[+clcpu]+clcpu]
+      CHARACTER(LEN=256)    ::   cltmpn    ! tempory name to store clname (in writting mode)
       CHARACTER(LEN=10)     ::   clsuffix  ! ".nc" or ".dimg"
       CHARACTER(LEN=15)     ::   clcpu     ! the cpu number (max jpmax_digits digits)
-      CHARACTER(LEN=100)    ::   clinfo    ! info character
+      CHARACTER(LEN=256)    ::   clinfo    ! info character
       LOGICAL               ::   llok      ! check the existence 
       LOGICAL               ::   llwrt     ! local definition of ldwrt
@@ -561,6 +562,6 @@
       REAL(wp)                       ::   zscf, zofs  ! sacle_factor and add_offset
       INTEGER                        ::   itmp        ! temporary integer
-      CHARACTER(LEN=100)             ::   clinfo      ! info character
-      CHARACTER(LEN=100)             ::   clname      ! file name
+      CHARACTER(LEN=256)             ::   clinfo      ! info character
+      CHARACTER(LEN=256)             ::   clname      ! file name
       CHARACTER(LEN=1)               ::   clrankpv, cldmspc      ! 
       !---------------------------------------------------------------------
@@ -1010,10 +1011,9 @@
    !!----------------------------------------------------------------------
 
-
 #if defined key_iomput
 
-   SUBROUTINE iom_set_domain_attr( cdname, ni_glo, nj_glo, ibegin, jbegin, ni, nj, zoom_ibegin, zoom_jbegin, zoom_ni, zoom_nj,   &
+   SUBROUTINE iom_set_domain_attr( cdid, ni_glo, nj_glo, ibegin, jbegin, ni, nj, zoom_ibegin, zoom_jbegin, zoom_ni, zoom_nj,   &
       &                                    data_dim, data_ibegin, data_ni, data_jbegin, data_nj, lonvalue, latvalue, mask )
-      CHARACTER(LEN=*)                 , INTENT(in) ::   cdname
+      CHARACTER(LEN=*)                 , INTENT(in) ::   cdid
       INTEGER                , OPTIONAL, INTENT(in) ::   ni_glo, nj_glo, ibegin, jbegin, ni, nj
       INTEGER                , OPTIONAL, INTENT(in) ::   data_dim, data_ibegin, data_ni, data_jbegin, data_nj
@@ -1022,50 +1022,81 @@
       LOGICAL, DIMENSION(:,:), OPTIONAL, INTENT(in) ::   mask
 
-      IF ( xios_is_valid_domain     (cdname) ) THEN
-         CALL xios_set_domain_attr     ( cdname, ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, jbegin=jbegin, ni=ni, nj=nj,   &
-            &    data_dim=data_dim, data_ibegin=data_ibegin, data_ni=data_ni, data_jbegin=data_jbegin, data_nj=data_nj   ,   &
-            &    zoom_ibegin=zoom_ibegin, zoom_jbegin=zoom_jbegin, zoom_ni=zoom_ni, zoom_nj=zoom_nj,                         &
+      IF ( xios_is_valid_domain     (cdid) ) THEN
+         CALL xios_set_domain_attr     ( cdid, ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, jbegin=jbegin, ni=ni, nj=nj,   &
+            &    data_dim=data_dim, data_ibegin=data_ibegin, data_ni=data_ni, data_jbegin=data_jbegin, data_nj=data_nj ,   &
+            &    zoom_ibegin=zoom_ibegin, zoom_jbegin=zoom_jbegin, zoom_ni=zoom_ni, zoom_nj=zoom_nj,                       &
             &    lonvalue=lonvalue, latvalue=latvalue,mask=mask )
       ENDIF
 
-      IF ( xios_is_valid_domaingroup(cdname) ) THEN
-         CALL xios_set_domaingroup_attr( cdname, ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, jbegin=jbegin, ni=ni, nj=nj,   &
-            &    data_dim=data_dim, data_ibegin=data_ibegin, data_ni=data_ni, data_jbegin=data_jbegin, data_nj=data_nj   ,   &
-            &    zoom_ibegin=zoom_ibegin, zoom_jbegin=zoom_jbegin, zoom_ni=zoom_ni, zoom_nj=zoom_nj,                         &
+      IF ( xios_is_valid_domaingroup(cdid) ) THEN
+         CALL xios_set_domaingroup_attr( cdid, ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, jbegin=jbegin, ni=ni, nj=nj,   &
+            &    data_dim=data_dim, data_ibegin=data_ibegin, data_ni=data_ni, data_jbegin=data_jbegin, data_nj=data_nj ,   &
+            &    zoom_ibegin=zoom_ibegin, zoom_jbegin=zoom_jbegin, zoom_ni=zoom_ni, zoom_nj=zoom_nj,                       &
             &    lonvalue=lonvalue, latvalue=latvalue,mask=mask )
       ENDIF
+      CALL xios_solve_inheritance()
 
    END SUBROUTINE iom_set_domain_attr
 
 
-   SUBROUTINE iom_set_axis_attr( cdname, paxis )
-      CHARACTER(LEN=*)      , INTENT(in) ::   cdname
+   SUBROUTINE iom_set_axis_attr( cdid, paxis )
+      CHARACTER(LEN=*)      , INTENT(in) ::   cdid
       REAL(wp), DIMENSION(:), INTENT(in) ::   paxis
-      IF ( xios_is_valid_axis     (cdname) )   CALL xios_set_axis_attr     ( cdname, size=size(paxis),value=paxis )
-      IF ( xios_is_valid_axisgroup(cdname) )   CALL xios_set_axisgroup_attr( cdname, size=size(paxis),value=paxis )
+      IF ( xios_is_valid_axis     (cdid) )   CALL xios_set_axis_attr     ( cdid, size=size(paxis),value=paxis )
+      IF ( xios_is_valid_axisgroup(cdid) )   CALL xios_set_axisgroup_attr( cdid, size=size(paxis),value=paxis )
+      CALL xios_solve_inheritance()
    END SUBROUTINE iom_set_axis_attr
 
 
-   SUBROUTINE iom_set_field_attr( cdname, freq_op)
-      CHARACTER(LEN=*)          , INTENT(in) ::   cdname
+   SUBROUTINE iom_set_field_attr( cdid, freq_op, freq_offset )
+      CHARACTER(LEN=*)          , INTENT(in) ::   cdid
       CHARACTER(LEN=*),OPTIONAL , INTENT(in) ::   freq_op
-      IF ( xios_is_valid_field     (cdname) )   CALL xios_set_field_attr     ( cdname, freq_op=freq_op )
-      IF ( xios_is_valid_fieldgroup(cdname) )   CALL xios_set_fieldgroup_attr( cdname, freq_op=freq_op )
+      CHARACTER(LEN=*),OPTIONAL , INTENT(in) ::   freq_offset
+      IF ( xios_is_valid_field     (cdid) )   CALL xios_set_field_attr     ( cdid, freq_op=freq_op, freq_offset=freq_offset )
+      IF ( xios_is_valid_fieldgroup(cdid) )   CALL xios_set_fieldgroup_attr( cdid, freq_op=freq_op, freq_offset=freq_offset )
+      CALL xios_solve_inheritance()
    END SUBROUTINE iom_set_field_attr
 
 
-   SUBROUTINE iom_set_file_attr( cdname, name, name_suffix )
-      CHARACTER(LEN=*)          , INTENT(in) ::   cdname
+   SUBROUTINE iom_set_file_attr( cdid, name, name_suffix )
+      CHARACTER(LEN=*)          , INTENT(in) ::   cdid
       CHARACTER(LEN=*),OPTIONAL , INTENT(in) ::   name, name_suffix
-      IF ( xios_is_valid_file     (cdname) )   CALL xios_set_file_attr     ( cdname, name=name, name_suffix=name_suffix )
-      IF ( xios_is_valid_filegroup(cdname) )   CALL xios_set_filegroup_attr( cdname, name=name, name_suffix=name_suffix )
+      IF ( xios_is_valid_file     (cdid) )   CALL xios_set_file_attr     ( cdid, name=name, name_suffix=name_suffix )
+      IF ( xios_is_valid_filegroup(cdid) )   CALL xios_set_filegroup_attr( cdid, name=name, name_suffix=name_suffix )
+      CALL xios_solve_inheritance()
    END SUBROUTINE iom_set_file_attr
 
 
-   SUBROUTINE iom_set_grid_attr( cdname, mask )
-      CHARACTER(LEN=*)                   , INTENT(in) ::   cdname
+   SUBROUTINE iom_get_file_attr( cdid, name, name_suffix, output_freq )
+      CHARACTER(LEN=*)          , INTENT(in ) ::   cdid
+      CHARACTER(LEN=*),OPTIONAL , INTENT(out) ::   name, name_suffix, output_freq
+      LOGICAL                                 ::   llexist1,llexist2,llexist3
+      !---------------------------------------------------------------------
+      IF( PRESENT( name        ) )   name = ''          ! default values
+      IF( PRESENT( name_suffix ) )   name_suffix = ''
+      IF( PRESENT( output_freq ) )   output_freq = ''
+      IF ( xios_is_valid_file     (cdid) ) THEN
+         CALL xios_solve_inheritance()
+         CALL xios_is_defined_file_attr     ( cdid, name = llexist1, name_suffix = llexist2, output_freq = llexist3)
+         IF(llexist1)   CALL xios_get_file_attr     ( cdid, name = name )
+         IF(llexist2)   CALL xios_get_file_attr     ( cdid, name_suffix = name_suffix )
+         IF(llexist3)   CALL xios_get_file_attr     ( cdid, output_freq = output_freq )
+      ENDIF
+      IF ( xios_is_valid_filegroup(cdid) ) THEN
+         CALL xios_solve_inheritance()
+         CALL xios_is_defined_filegroup_attr( cdid, name = llexist1, name_suffix = llexist2, output_freq = llexist3)
+         IF(llexist1)   CALL xios_get_filegroup_attr( cdid, name = name )
+         IF(llexist2)   CALL xios_get_filegroup_attr( cdid, name_suffix = name_suffix )
+         IF(llexist3)   CALL xios_get_filegroup_attr( cdid, output_freq = output_freq )
+      ENDIF
+   END SUBROUTINE iom_get_file_attr
+
+
+   SUBROUTINE iom_set_grid_attr( cdid, mask )
+      CHARACTER(LEN=*)                   , INTENT(in) ::   cdid
       LOGICAL, DIMENSION(:,:,:), OPTIONAL, INTENT(in) ::   mask
-      IF ( xios_is_valid_grid     (cdname) )   CALL xios_set_grid_attr     ( cdname, mask=mask )
-      IF ( xios_is_valid_gridgroup(cdname) )   CALL xios_set_gridgroup_attr( cdname, mask=mask )
+      IF ( xios_is_valid_grid     (cdid) )   CALL xios_set_grid_attr     ( cdid, mask=mask )
+      IF ( xios_is_valid_gridgroup(cdid) )   CALL xios_set_gridgroup_attr( cdid, mask=mask )
+      CALL xios_solve_inheritance()
    END SUBROUTINE iom_set_grid_attr
 
@@ -1073,5 +1104,5 @@
    SUBROUTINE set_grid( cdgrd, plon, plat )
       !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE   ***
+      !!                     ***  ROUTINE set_grid  ***
       !!
       !! ** Purpose :   define horizontal grids
@@ -1110,5 +1141,5 @@
    SUBROUTINE set_scalar
       !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE   ***
+      !!                     ***  ROUTINE set_scalar  ***
       !!
       !! ** Purpose :   define fake grids for scalar point
@@ -1126,19 +1157,14 @@
    SUBROUTINE set_xmlatt
       !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE   ***
+      !!                     ***  ROUTINE set_xmlatt  ***
       !!
       !! ** Purpose :   automatic definitions of some of the xml attributs...
       !!
       !!----------------------------------------------------------------------
-      CHARACTER(len=6),DIMENSION( 8) ::   clsuff                   ! suffix name
       CHARACTER(len=1),DIMENSION( 3) ::   clgrd                    ! suffix name
-      CHARACTER(len=50)              ::   clname                   ! file name
+      CHARACTER(len=256)             ::   clsuff                   ! suffix name
       CHARACTER(len=1)               ::   cl1                      ! 1 character
       CHARACTER(len=2)               ::   cl2                      ! 1 character
-      CHARACTER(len=255)             ::   tfo
-      INTEGER                        ::   idt                      ! time-step in seconds
-      INTEGER                        ::   iddss, ihhss             ! number of seconds in 1 day, 1 hour and 1 year
-      INTEGER                        ::   iyymo                    ! number of months in 1 year
-      INTEGER                        ::   jg, jh, jd, jm, jy       ! loop counters
+      INTEGER                        ::   ji, jg                   ! loop counters
       INTEGER                        ::   ix, iy                   ! i-,j- index
       REAL(wp)        ,DIMENSION(11) ::   zlontao                  ! longitudes of tao    moorings
@@ -1150,39 +1176,18 @@
       !!----------------------------------------------------------------------
       ! 
-      idt   = NINT( rdttra(1)     )
-      iddss = NINT( rday          )                                         ! number of seconds in 1 day
-      ihhss = NINT( rmmss * rhhmm )                                         ! number of seconds in 1 hour
-      iyymo = NINT( raamo         )                                         ! number of months in 1 year
-
       ! frequency of the call of iom_put (attribut: freq_op)
-      tfo = TRIM(i2str(idt))//'s'
-      CALL iom_set_field_attr('field_definition', freq_op=tfo)
-      CALL iom_set_field_attr('SBC'   , freq_op=TRIM(i2str(idt* nn_fsbc ))//'s')
-      CALL iom_set_field_attr('ptrc_T', freq_op=TRIM(i2str(idt* nn_dttrc))//'s')
-      CALL iom_set_field_attr('diad_T', freq_op=TRIM(i2str(idt* nn_dttrc))//'s')
+      WRITE(cl1,'(i1)')        1   ;   CALL iom_set_field_attr('field_definition', freq_op = cl1//'ts', freq_offset='0ts')
+      WRITE(cl1,'(i1)')  nn_fsbc   ;   CALL iom_set_field_attr('SBC'             , freq_op = cl1//'ts', freq_offset='0ts')
+      WRITE(cl1,'(i1)') nn_dttrc   ;   CALL iom_set_field_attr('ptrc_T'          , freq_op = cl1//'ts', freq_offset='0ts')
+      WRITE(cl1,'(i1)') nn_dttrc   ;   CALL iom_set_field_attr('diad_T'          , freq_op = cl1//'ts', freq_offset='0ts')
        
       ! output file names (attribut: name)
-      clsuff(:) = (/ 'grid_T', 'grid_U', 'grid_V', 'grid_W', 'icemod', 'ptrc_T', 'diad_T', 'scalar' /)      
-      DO jg = 1, SIZE(clsuff)                                                                  ! grid type
-         DO jh = 1, 24                                                                         ! 1-24 hours
-            WRITE(cl2,'(i2)') jh 
-            CALL dia_nam( clname, jh * ihhss, clsuff(jg), ldfsec = .TRUE. )
-            CALL iom_set_file_attr(TRIM(ADJUSTL(cl2))//'h_'//clsuff(jg), name=TRIM(clname))
-         END DO
-         DO jd = 1, 30                                                                         ! 1-30 days
-            WRITE(cl1,'(i1)') jd 
-            CALL dia_nam( clname, jd * iddss, clsuff(jg), ldfsec = .TRUE. )
-            CALL iom_set_file_attr(cl1//'d_'//clsuff(jg), name=TRIM(clname))
-         END DO
-         DO jm = 1, 11                                                                         ! 1-11 months
-            WRITE(cl1,'(i1)') jm 
-            CALL dia_nam( clname, -jm, clsuff(jg) )
-            CALL iom_set_file_attr(cl1//'m_'//clsuff(jg), name=TRIM(clname))
-         END DO
-         DO jy = 1, 50                                                                         ! 1-50 years  
-            WRITE(cl2,'(i2)') jy 
-            CALL dia_nam( clname, -jy * iyymo, clsuff(jg) )
-            CALL iom_set_file_attr(TRIM(ADJUSTL(cl2))//'y_'//clsuff(jg), name=TRIM(clname))
-         END DO
+      DO ji = 1, 9
+         WRITE(cl1,'(i1)') ji 
+         CALL iom_update_file_name('file'//cl1)
+      END DO
+      DO ji = 1, 99
+         WRITE(cl2,'(i2.2)') ji 
+         CALL iom_update_file_name('file'//cl2)
       END DO
 
@@ -1193,6 +1198,8 @@
          ! Equatorial section (attributs: jbegin, ni, name_suffix)
          CALL dom_ngb( 0., 0., ix, iy, cl1 )
-         CALL iom_set_domain_attr('Eq'//cl1, zoom_jbegin=iy, zoom_ni=jpiglo)
-         CALL iom_set_file_attr('Eq'//cl1, name_suffix= '_Eq')
+         CALL iom_set_domain_attr ('Eq'//cl1, zoom_jbegin=iy, zoom_ni=jpiglo)
+         CALL iom_get_file_attr   ('Eq'//cl1, name_suffix = clsuff             )
+         CALL iom_set_file_attr   ('Eq'//cl1, name_suffix = TRIM(clsuff)//'_Eq')
+         CALL iom_update_file_name('Eq'//cl1)
       END DO
       ! TAO moorings (attributs: ibegin, jbegin, name_suffix)
@@ -1214,5 +1221,5 @@
    SUBROUTINE set_mooring( plon, plat)
       !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE   ***
+      !!                     ***  ROUTINE set_mooring  ***
       !!
       !! ** Purpose :   automatic definitions of moorings xml attributs...
@@ -1223,5 +1230,6 @@
 !!$      CHARACTER(len=1),DIMENSION(4) ::   clgrd = (/ 'T', 'U', 'V', 'W' /)   ! suffix name
       CHARACTER(len=1),DIMENSION(1) ::   clgrd = (/ 'T' /)        ! suffix name
-      CHARACTER(len=50)             ::   clname                   ! file name
+      CHARACTER(len=256)            ::   clname                   ! file name
+      CHARACTER(len=256)            ::   clsuff                   ! suffix name
       CHARACTER(len=1)              ::   cl1                      ! 1 character
       CHARACTER(len=6)              ::   clon,clat                ! name of longitude, latitude
@@ -1269,6 +1277,8 @@
                ENDIF
                clname = TRIM(ADJUSTL(clat))//TRIM(ADJUSTL(clon))
-               CALL iom_set_domain_attr(TRIM(clname)//cl1, zoom_ibegin= ix, zoom_jbegin= iy)
-               CALL iom_set_file_attr(TRIM(clname)//cl1, name_suffix= '_'//TRIM(clname))
+               CALL iom_set_domain_attr (TRIM(clname)//cl1, zoom_ibegin= ix, zoom_jbegin= iy)
+               CALL iom_get_file_attr   (TRIM(clname)//cl1, name_suffix = clsuff                         )
+               CALL iom_set_file_attr   (TRIM(clname)//cl1, name_suffix = TRIM(clsuff)//'_'//TRIM(clname))
+               CALL iom_update_file_name(TRIM(clname)//cl1)
             END DO
          END DO
@@ -1277,4 +1287,139 @@
    END SUBROUTINE set_mooring
 
+   
+   SUBROUTINE iom_update_file_name( cdid )
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE iom_update_file_name  ***
+      !!
+      !! ** Purpose :   
+      !!
+      !!----------------------------------------------------------------------
+      CHARACTER(LEN=*)          , INTENT(in) ::   cdid
+      !
+      CHARACTER(LEN=256) ::   clname
+      CHARACTER(LEN=20)  ::   clfreq
+      CHARACTER(LEN=20)  ::   cldate
+      INTEGER            ::   idx
+      INTEGER            ::   jn
+      INTEGER            ::   itrlen
+      INTEGER            ::   iyear, imonth, iday, isec
+      REAL(wp)           ::   zsec
+      LOGICAL            ::   llexist
+      !!----------------------------------------------------------------------
+
+      DO jn = 1,2
+
+         IF( jn == 1 )   CALL iom_get_file_attr( cdid, name        = clname, output_freq = clfreq )
+         IF( jn == 2 )   CALL iom_get_file_attr( cdid, name_suffix = clname )
+
+         IF ( TRIM(clname) /= '' ) THEN 
+
+            idx = INDEX(clname,'@expname@') + INDEX(clname,'@EXPNAME@')
+            DO WHILE ( idx /= 0 ) 
+               clname = clname(1:idx-1)//TRIM(cexper)//clname(idx+9:LEN_TRIM(clname))
+               idx = INDEX(clname,'@expname@') + INDEX(clname,'@EXPNAME@')
+            END DO
+
+            idx = INDEX(clname,'@freq@') + INDEX(clname,'@FREQ@')
+            DO WHILE ( idx /= 0 ) 
+               IF ( TRIM(clfreq) /= '' ) THEN
+                  itrlen = LEN_TRIM(clfreq)
+                  IF ( clfreq(itrlen-1:itrlen) == 'mo' ) clfreq = clfreq(1:itrlen-1)
+                  clname = clname(1:idx-1)//TRIM(clfreq)//clname(idx+6:LEN_TRIM(clname))
+               ELSE
+                  CALL ctl_stop('error in the name of file id '//TRIM(cdid),   &
+                     & ' attribute output_freq is undefined -> cannot replace @freq@ in '//TRIM(clname) )
+               ENDIF
+               idx = INDEX(clname,'@freq@') + INDEX(clname,'@FREQ@')
+            END DO
+
+            idx = INDEX(clname,'@startdate@') + INDEX(clname,'@STARTDATE@')
+            DO WHILE ( idx /= 0 ) 
+               cldate = iom_sdate( fjulday - rdttra(1) / rday )
+               clname = clname(1:idx-1)//TRIM(cldate)//clname(idx+11:LEN_TRIM(clname))
+               idx = INDEX(clname,'@startdate@') + INDEX(clname,'@STARTDATE@')
+            END DO
+
+            idx = INDEX(clname,'@startdatefull@') + INDEX(clname,'@STARTDATEFULL@')
+            DO WHILE ( idx /= 0 ) 
+               cldate = iom_sdate( fjulday - rdttra(1) / rday, ldfull = .TRUE. )
+               clname = clname(1:idx-1)//TRIM(cldate)//clname(idx+15:LEN_TRIM(clname))
+               idx = INDEX(clname,'@startdatefull@') + INDEX(clname,'@STARTDATEFULL@')
+            END DO
+
+            idx = INDEX(clname,'@enddate@') + INDEX(clname,'@ENDDATE@')
+            DO WHILE ( idx /= 0 ) 
+               cldate = iom_sdate( fjulday + rdttra(1) / rday * REAL( nitend - nit000, wp ), ld24 = .TRUE. )
+               clname = clname(1:idx-1)//TRIM(cldate)//clname(idx+9:LEN_TRIM(clname))
+               idx = INDEX(clname,'@enddate@') + INDEX(clname,'@ENDDATE@')
+            END DO
+
+            idx = INDEX(clname,'@enddatefull@') + INDEX(clname,'@ENDDATEFULL@')
+            DO WHILE ( idx /= 0 ) 
+               cldate = iom_sdate( fjulday + rdttra(1) / rday * REAL( nitend - nit000, wp ), ld24 = .TRUE., ldfull = .TRUE. )
+               clname = clname(1:idx-1)//TRIM(cldate)//clname(idx+13:LEN_TRIM(clname))
+               idx = INDEX(clname,'@enddatefull@') + INDEX(clname,'@ENDDATEFULL@')
+            END DO
+
+            IF( jn == 1 )   CALL iom_set_file_attr( cdid, name        = clname )
+            IF( jn == 2 )   CALL iom_set_file_attr( cdid, name_suffix = clname )
+
+         ENDIF
+
+      END DO
+
+   END SUBROUTINE iom_update_file_name
+
+
+   FUNCTION iom_sdate( pjday, ld24, ldfull )
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE iom_sdate  ***
+      !!
+      !! ** Purpose :   send back the date corresponding to the given julian day
+      !!
+      !!----------------------------------------------------------------------
+      REAL(wp), INTENT(in   )           ::   pjday         ! julian day
+      LOGICAL , INTENT(in   ), OPTIONAL ::   ld24          ! true to force 24:00 instead of 00:00
+      LOGICAL , INTENT(in   ), OPTIONAL ::   ldfull        ! true to get the compleate date: yyyymmdd_hh:mm:ss
+      !
+      CHARACTER(LEN=20) ::   iom_sdate
+      CHARACTER(LEN=50) ::   clfmt                         !  format used to write the date 
+      INTEGER           ::   iyear, imonth, iday, ihour, iminute, isec
+      REAL(wp)          ::   zsec
+      LOGICAL           ::   ll24, llfull
+      !
+      IF( PRESENT(ld24) ) THEN   ;   ll24 = ld24
+      ELSE                       ;   ll24 = .FALSE.
+      ENDIF
+
+      IF( PRESENT(ldfull) ) THEN   ;   llfull = ldfull
+      ELSE                         ;   llfull = .FALSE.
+      ENDIF
+
+      CALL ju2ymds( pjday, iyear, imonth, iday, zsec )
+      isec = NINT(zsec)
+
+      IF ( ll24 .AND. isec == 0 ) THEN   ! 00:00 of the next day -> move to 24:00 of the current day
+         CALL ju2ymds( pjday - 1., iyear, imonth, iday, zsec )
+         isec = 86400
+      ENDIF
+
+      IF( iyear < 10000 ) THEN   ;   clfmt = "i4.4,2i2.2"                ! format used to write the date 
+      ELSE                       ;   WRITE(clfmt, "('i',i1,',2i2.2')") INT(LOG10(REAL(iyear,wp))) + 1
+      ENDIF
+      
+      IF( llfull ) THEN 
+         clfmt = TRIM(clfmt)//",'_',i2.2,':',i2.2,':',i2.2"
+         ihour   = isec / 3600
+         isec    = MOD(isec, 3600)
+         iminute = isec / 60
+         isec    = MOD(isec, 60)
+         WRITE(iom_sdate, '('//TRIM(clfmt)//')') iyear, imonth, iday, ihour, iminute, isec    ! date of the end of run
+      ELSE
+         WRITE(iom_sdate, '('//TRIM(clfmt)//')') iyear, imonth, iday                          ! date of the end of run
+      ENDIF
+
+   END FUNCTION iom_sdate
+
 #else
 
@@ -1285,13 +1430,4 @@
 
 #endif
-
-   FUNCTION i2str(int)
-   IMPLICIT NONE
-      INTEGER, INTENT(IN) :: int
-      CHARACTER(LEN=255) :: i2str
-
-      WRITE(i2str,*) int
-      
-   END FUNCTION i2str  
    
    !!======================================================================
