Index: /branches/2012/dev_MERGE_2012/DOC/TexFiles/Biblio/Biblio.bib
===================================================================
--- /branches/2012/dev_MERGE_2012/DOC/TexFiles/Biblio/Biblio.bib	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/DOC/TexFiles/Biblio/Biblio.bib	(revision 3680)
@@ -2537,4 +2537,11 @@
 }
 
+@ARTICLE{Siddorn_Furner_OM12,
+  author = {J. Siddorn and R. Furner},
+  title = {An analytical stretching function that combines the best attributes of geopotential and terrain-following vertical coordinates},
+  journal = OM,
+  year = {2012},
+  pages = {submitted},
+}
 @ARTICLE{Simmons_al_OM04,
   author = {H. L. Simmons and S. R. Jayne and L. C. {St. Laurent} and A. J. Weaver},
Index: /branches/2012/dev_MERGE_2012/DOC/TexFiles/Chapters/Chap_DIA.tex
===================================================================
--- /branches/2012/dev_MERGE_2012/DOC/TexFiles/Chapters/Chap_DIA.tex	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/DOC/TexFiles/Chapters/Chap_DIA.tex	(revision 3680)
@@ -838,5 +838,5 @@
 - \texttt{heat\_transport}   for heat transports   (  unit: $10^{15} W $ )
 
-- \texttt{salt\_transport}   for salt transports   (  unit: $10^{9}g s^{-1}$ )\\
+- \texttt{salt\_transport}   for salt transports   (  unit: $10^{9}Kg s^{-1}$ )\\
 
 
Index: /branches/2012/dev_MERGE_2012/DOC/TexFiles/Chapters/Chap_DOM.tex
===================================================================
--- /branches/2012/dev_MERGE_2012/DOC/TexFiles/Chapters/Chap_DOM.tex	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/DOC/TexFiles/Chapters/Chap_DOM.tex	(revision 3680)
@@ -502,5 +502,5 @@
 time-variation of the free surface so that the transformation is time dependent: 
 $z(i,j,k,t)$ (Fig.~\ref{Fig_z_zps_s_sps}f). This option can be used with full step 
-bathymetry or $s$-coordinate (hybride and partial step coordinates have not 
+bathymetry or $s$-coordinate (hybrid and partial step coordinates have not 
 yet been tested in NEMO v2.3). 
 
@@ -743,4 +743,5 @@
 levels are defined from the product of a depth field and either a stretching 
 function or its derivative, respectively:
+
 \begin{equation} \label{DOM_sco_ana}
 \begin{split}
@@ -749,34 +750,97 @@
 \end{split}
 \end{equation}
+
 where $h$ is the depth of the last $w$-level ($z_0(k)$) defined at the $t$-point 
 location in the horizontal and $z_0(k)$ is a function which varies from $0$ at the sea 
 surface to $1$ at the ocean bottom. The depth field $h$ is not necessary the ocean 
 depth, since a mixed step-like and bottom-following representation of the 
-topography can be used (Fig.~\ref{Fig_z_zps_s_sps}d-e). In the example provided 
-(\rou{zgr\_sco} routine, see \mdl{domzgr}) $h$ is a smooth envelope bathymetry 
-and steps are used to represent sharp bathymetric gradients.
-
-A new flexible stretching function, modified from \citet{Song_Haidvogel_JCP94} is provided as an example:
+topography can be used (Fig.~\ref{Fig_z_zps_s_sps}d-e) or an envelop bathymetry can be defined (Fig.~\ref{Fig_z_zps_s_sps}f).
+The namelist parameter \np{rn\_rmax} determines the slope at which the terrain-following coordinate intersects the sea bed and becomes a pseudo z-coordinate. The coordinate can also be hybridised by specifying \np{rn\_sbot\_min} and \np{rn\_sbot\_max} as the minimum and maximum depths at which the terrain-following vertical coordinate is calculated.
+
+Options for stretching the coordinate are provided as examples, but care must be taken to ensure that the vertical stretch used is appropriate for the application.
+
+The original default NEMO s-coordinate stretching is available if neither of the other options are specified as true (\np{ln\_sco\_SH94}~=~false and \np{ln\_sco\_SF12}~=~false.) This uses a depth independent $\tanh$ function for the stretching \citep{Madec_al_JPO96}:
+
+\begin{equation}
+  z = s_{min}+C\left(s\right)\left(H-s_{min}\right)
+  \label{eq:SH94_1}
+\end{equation}
+
+where $s_{min}$ is the depth at which the s-coordinate stretching starts and allows a z-coordinate to placed on top of the stretched coordinate, and z is the depth (negative down from the asea surface).
+
+\begin{equation}
+  s = -\frac{k}{n-1} \quad \text{ and } \quad 0 \leq k \leq n-1
+  \label{eq:s}
+\end{equation}
+
 \begin{equation} \label{DOM_sco_function}
 \begin{split}
-z	&= h_c +( h-h_c)\;c s)	\\
-c(s)	&=  \frac{ \left[	  \tanh{ \left( \theta \, (s+b) \right)} 
+C(s)	&=  \frac{ \left[	  \tanh{ \left( \theta \, (s+b) \right)} 
 	  	 			- \tanh{ \left(  \theta \, b      \right)}  \right]}
 		      {2\;\sinh \left( \theta \right)}
 \end{split}
 \end{equation}
-where $h_c$ is the thermocline depth and $\theta$ and $b$ are the surface and 
+
+A stretching function, modified from the commonly used \citet{Song_Haidvogel_JCP94} stretching (\np{ln\_sco\_SH94}~=~true), is also available and is more commonly used for shelf seas modelling:
+
+\begin{equation}
+  C\left(s\right) =   \left(1 - b \right)\frac{ \sinh\left( \theta s\right)}{\sinh\left(\theta\right)} +      \\
+  b\frac{ \tanh \left[ \theta \left(s + \frac{1}{2} \right)\right] - \tanh\left(\frac{\theta}{2}\right)}{ 2\tanh\left (\frac{\theta}{2}\right)}
+  \label{eq:SH94_2}
+\end{equation}
+
+%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+\begin{figure}[!ht]    \begin{center}
+\includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_sco_function.pdf}
+\caption{  \label{Fig_sco_function}   
+Examples of the stretching function applied to a seamount; from left to right: 
+surface, surface and bottom, and bottom intensified resolutions}
+\end{center}   \end{figure}
+%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+where $H_c$ is the critical depth (\np{rn\_hc}) at which the coordinate transitions from pure $\sigma$ to the stretched coordinate,  and $\theta$ (\np{rn\_theta}) and $b$ (\np{rn\_bb}) are the surface and 
 bottom control parameters such that $0\leqslant \theta \leqslant 20$, and 
 $0\leqslant b\leqslant 1$. $b$ has been designed to allow surface and/or bottom 
 increase of the vertical resolution (Fig.~\ref{Fig_sco_function}).
 
-%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-\begin{figure}[!tb]    \begin{center}
-\includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_sco_function.pdf}
-\caption{  \label{Fig_sco_function}   
-Examples of the stretching function applied to a sea mont; from left to right: 
-surface, surface and bottom, and bottom intensified resolutions}
-\end{center}   \end{figure}
-%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+Another example has been provided at version 3.5 (\np{ln\_sco\_SF12}) that allows a fixed surface resolution in an analytical terrain-following stretching \citet{Siddorn_Furner_OM12}. In this case the a stretching function $\gamma$ is defined such that:
+
+\begin{equation}
+z = -\gamma h \quad \text{ with } \quad 0 \leq \gamma \leq 1
+\label{eq:z}
+\end{equation}
+
+The function is defined with respect to $\sigma$, the unstretched terrain-following coordinate:
+
+\begin{equation} \label{DOM_gamma_deriv}
+\gamma= A\left(\sigma-\frac{1}{2}\left(\sigma^{2}+f\left(\sigma\right)\right)\right)+B\left(\sigma^{3}-f\left(\sigma\right)\right)+f\left(\sigma\right)
+\end{equation}
+
+Where:
+\begin{equation} \label{DOM_gamma}
+f\left(\sigma\right)=\left(\alpha+2\right)\sigma^{\alpha+1}-\left(\alpha+1\right)\sigma^{\alpha+2} \quad \text{ and } \quad \sigma = \frac{k}{n-1} 
+\end{equation}
+
+This gives an analytical stretching of $\sigma$ that is solvable in $A$ and $B$ as a function of the user prescribed stretching parameter $\alpha$ (\np{rn\_alpha}) that stretches towards the surface ($\alpha > 1.0$) or the bottom ($\alpha < 1.0$) and user prescribed surface (\np{rn\_zs}) and bottom depths. The bottom cell depth in this example is given as a function of water depth:
+
+\begin{equation} \label{DOM_zb}
+Z_b= h a + b
+\end{equation}
+
+where the namelist parameters \np{rn\_zb\_a} and \np{rn\_zb\_b} are $a$ and $b$ respectively.
+
+%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+\begin{figure}[!ht]
+   \includegraphics[width=1.0\textwidth]{./TexFiles/Figures/FIG_DOM_compare_coordinates_surface.pdf}
+        \caption{A comparison of the \citet{Song_Haidvogel_JCP94} $S$-coordinate (solid lines), a 50 level $Z$-coordinate (contoured surfaces) and the \citet{Siddorn_Furner_OM12} $S$-coordinate (dashed lines) in the surface 100m for a idealised bathymetry that goes from 50m to 5500m depth. For clarity every third coordinate surface is shown.}
+    \label{fig_compare_coordinates_surface}
+\end{figure}
+%>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+This gives a smooth analytical stretching in computational space that is constrained to given specified surface and bottom grid cell thicknesses in real space. This is not to be confused with the hybrid schemes that superimpose geopotential coordinates on terrain following coordinates thus creating a non-analytical vertical coordinate that therefore may suffer from large gradients in the vertical resolutions. This stretching is less straightforward to implement than the \citet{Song_Haidvogel_JCP94} stretching, but has the advantage of resolving diurnal processes in deep water and has generally flatter slopes.
+
+As with the \citet{Song_Haidvogel_JCP94} stretching the stretch is only applied at depths greater than the critical depth $h_c$. In this example two options are available in depths shallower than $h_c$, with pure sigma being applied if the \np{ln\_sigcrit} is true and pure z-coordinates if it is false (the z-coordinate being equal to the depths of the stretched coordinate at $h_c$.
+
+Minimising the horizontal slope of the vertical coordinate is important in terrain-following systems as large slopes lead to hydrostatic consistency. A hydrostatic consistency parameter diagnostic following \citet{Haney1991} has been implemented, and is output as part of the model mesh file at the start of the run.
 
 % -------------------------------------------------------------------------------------------------------------
Index: /branches/2012/dev_MERGE_2012/DOC/TexFiles/Namelist/namzgr_sco
===================================================================
--- /branches/2012/dev_MERGE_2012/DOC/TexFiles/Namelist/namzgr_sco	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/DOC/TexFiles/Namelist/namzgr_sco	(revision 3680)
@@ -2,11 +2,24 @@
 &namzgr_sco    !   s-coordinate or hybrid z-s-coordinate
 !-----------------------------------------------------------------------
-   rn_sbot_min =  300.     !  minimum depth of s-bottom surface (>0) (m)
-   rn_sbot_max = 5250.     !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
-   rn_theta    =    6.0    !  surface control parameter (0<=rn_theta<=20)
-   rn_thetb    =    0.75   !  bottom control parameter  (0<=rn_thetb<= 1)
-   rn_rmax     =    0.15   !  maximum cut-off r-value allowed (0<rn_max<1)
-   ln_s_sigma  = .false.   !  hybrid s-sigma coordinates
-   rn_bb       =    0.8    !  stretching with s-sigma
-   rn_hc       =  150.0    !  critical depth with s-sigma 
+   ln_s_sh94   = .true.    !  Song & Haidvogel 1994 hybrid S-sigma   (T)|
+   ln_s_sf12   = .false.   !  Siddorn & Furner 2012 hybrid S-z-sigma (T)| if both are false the NEMO tanh stretching is applied
+   ln_sigcrit  = .false.   !  use sigma coordinates below critical depth (T) or Z coordinates (F) for Siddorn & Furner stretch
+                           !  stretching coefficients for all functions
+   rn_sbot_min =   10.0    !  minimum depth of s-bottom surface (>0) (m)
+   rn_sbot_max = 7000.0    !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
+   rn_hc       =  150.0    !  critical depth for transition to stretched coordinates
+                        !!!!!!!  Envelop bathymetry
+   rn_rmax     =    0.3    !  maximum cut-off r-value allowed (0<r_max<1)
+                        !!!!!!!  SH94 stretching coefficients  (ln_s_sh94 = .true.)
+   rn_theta    =    6.0    !  surface control parameter (0<=theta<=20)
+   rn_bb       =    0.8    !  stretching with SH94 s-sigma   
+                        !!!!!!!  SF12 stretching coefficient  (ln_s_sf12 = .true.)
+   rn_alpha    =    4.4    !  stretching with SF12 s-sigma
+   rn_efold    =    0.0    !  efold length scale for transition to stretched coord
+   rn_zs       =    1.0    !  depth of surface grid box
+                           !  bottom cell depth (Zb) is a linear function of water depth Zb = H*a + b
+   rn_zb_a     =    0.024  !  bathymetry scaling factor for calculating Zb
+   rn_zb_b     =   -0.2    !  offset for calculating Zb
+                        !!!!!!!! Other stretching (not SH94 or SF12) [also uses rn_theta above]
+   rn_thetb    =    1.0    !  bottom control parameter  (0<=thetb<= 1) 
 /
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/ARCH/CMCC/arch-PW6_calypso.fcm
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/ARCH/CMCC/arch-PW6_calypso.fcm	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/ARCH/CMCC/arch-PW6_calypso.fcm	(revision 3680)
@@ -0,0 +1,29 @@
+# vargas IBM POWER6 at french IDRIS, http://www.idris.fr/su/Scalaire/vargas/hw-vargas.html
+# NCDF_INC    netcdf include file
+# NCDF_LIB    netcdf library
+# FC          Fortran compiler command
+# FCFLAGS     Fortran compiler flags
+# FFLAGS      Fortran 77 compiler flags
+# LD          linker
+# LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+# FPPFLAGS    pre-processing flags
+# AR          assembler
+# ARFLAGS     assembler flags
+# MK          make  
+# USER_INC    additional include files for the compiler,  e.g. -I<include dir> 
+# USER_LIB    additional libraries to pass to the linker, e.g. -l<library>
+
+
+%NCDF_INC            -I/usr/local/netcdf-3.6.3/include
+%NCDF_LIB            -L/usr/local/netcdf-3.6.3/lib -lnetcdf
+%FC                  mpxlf90_r
+%FCFLAGS             -O3 -qsuffix=f=f90  -qstrict -qalias=intptr -qsuppress=1501-245 -qarch=pwr6 -q64 -qrealsize=8 -qtune=pwr6 -qextname -qlargepage -qmaxmem=-1
+%FFLAGS              -O3 -qsuffix=f=f90  -qstrict -qalias=intptr -qsuppress=1501-245 -qarch=pwr6 -q64 -qrealsize=8 -qtune=pwr6 -qextname -qlargepage -qmaxmem=-1
+%LD                  mpxlf90_r
+%LDFLAGS             -bloadmap:LinkerErrorMap 
+%FPPFLAGS            -P -C
+%AR                  ar  
+%ARFLAGS             rs
+%MK                  gmake 
+%USER_INC            %NCDF_INC
+%USER_LIB            %NCDF_LIB 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/ARCH/CMCC/arch-PW6_calypso_debug.fcm
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/ARCH/CMCC/arch-PW6_calypso_debug.fcm	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/ARCH/CMCC/arch-PW6_calypso_debug.fcm	(revision 3680)
@@ -0,0 +1,29 @@
+# vargas IBM POWER6 at french IDRIS, http://www.idris.fr/su/Scalaire/vargas/hw-vargas.html
+# NCDF_INC    netcdf include file
+# NCDF_LIB    netcdf library
+# FC          Fortran compiler command
+# FCFLAGS     Fortran compiler flags
+# FFLAGS      Fortran 77 compiler flags
+# LD          linker
+# LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+# FPPFLAGS    pre-processing flags
+# AR          assembler
+# ARFLAGS     assembler flags
+# MK          make  
+# USER_INC    additional include files for the compiler,  e.g. -I<include dir> 
+# USER_LIB    additional libraries to pass to the linker, e.g. -l<library>
+
+
+%NCDF_INC            -I/usr/local/netcdf-3.6.3/include
+%NCDF_LIB            -L/usr/local/netcdf-3.6.3/lib -lnetcdf
+%FC                  mpxlf90_r
+%FCFLAGS             -g -qsuffix=f=f90  -qstrict -qalias=intptr -qsuppress=1501-245 -qarch=pwr6 -q64 -qrealsize=8 -qtune=pwr6 -qextname -qlargepage -qmaxmem=-1
+%FFLAGS              -g -qsuffix=f=f90  -qstrict -qalias=intptr -qsuppress=1501-245 -qarch=pwr6 -q64 -qrealsize=8 -qtune=pwr6 -qextname -qlargepage -qmaxmem=-1
+%LD                  mpxlf90_r
+%LDFLAGS             -bloadmap:LinkerErrorMap 
+%FPPFLAGS            -P -C
+%AR                  ar  
+%ARFLAGS             rs
+%MK                  gmake 
+%USER_INC            %NCDF_INC
+%USER_LIB            %NCDF_LIB 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/ARCH/CMCC/arch-PW6_calypso_tools.fcm
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/ARCH/CMCC/arch-PW6_calypso_tools.fcm	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/ARCH/CMCC/arch-PW6_calypso_tools.fcm	(revision 3680)
@@ -0,0 +1,29 @@
+# vargas IBM POWER6 at french IDRIS, http://www.idris.fr/su/Scalaire/vargas/hw-vargas.html
+# NCDF_INC    netcdf include file
+# NCDF_LIB    netcdf library
+# FC          Fortran compiler command
+# FCFLAGS     Fortran compiler flags
+# FFLAGS      Fortran 77 compiler flags
+# LD          linker
+# LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+# FPPFLAGS    pre-processing flags
+# AR          assembler
+# ARFLAGS     assembler flags
+# MK          make  
+# USER_INC    additional include files for the compiler,  e.g. -I<include dir> 
+# USER_LIB    additional libraries to pass to the linker, e.g. -l<library>
+
+
+%NCDF_INC            -I/usr/local/netcdf-3.6.3/include
+%NCDF_LIB            -L/usr/local/netcdf-3.6.3/lib -lnetcdf
+%FC                  xlf90
+%FCFLAGS             -O3 -qsuffix=f=f90  -qstrict -qsuppress=1501-245 -qarch=pwr6 -q64 -qrealsize=8 -qtune=pwr6 -qextname -qlargepage -qmaxmem=-1
+%FFLAGS              -O3 -qsuffix=f=f90  -qstrict -qsuppress=1501-245 -qarch=pwr6 -q64 -qrealsize=8 -qtune=pwr6 -qextname -qlargepage -qmaxmem=-1
+%LD                  xlf90
+%LDFLAGS             -bloadmap:LinkerErrorMap 
+%FPPFLAGS            -P -C
+%AR                  ar  
+%ARFLAGS             rs
+%MK                  gmake 
+%USER_INC            %NCDF_INC
+%USER_LIB            %NCDF_LIB 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/ARCH/CNRS/arch-X64_CURIE.fcm
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/ARCH/CNRS/arch-X64_CURIE.fcm	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/ARCH/CNRS/arch-X64_CURIE.fcm	(revision 3680)
@@ -16,9 +16,13 @@
 %NCDF_INC            -I$(NETCDF_INC_DIR)
 %NCDF_LIB            -L$(NETCDF_LIB_DIR) -lnetcdff -lnetcdf
-%FC                  mpif90 -c -cpp
+%FC                  mpif90 -c 
 # for Curie Fat Node
-%FCFLAGS             -i4 -r8 -fast -xSSE4.2 -automatic
+#%FCFLAGS             -i4 -r8 -fast -xSSE4.2 -automatic
 # for Curie Thin Node
 #%FCFLAGS             -i4 -r8 -fast -xAVX   -automatic
+##
+## for both FAST and THIN nodes
+%FCFLAGS             -i4 -r8 -O3
+##
 %FFLAGS              %FCFLAGS
 %LD                  mpif90
Index: anches/2012/dev_MERGE_2012/NEMOGCM/ARCH/arch-PW6_CALYPSO.fcm
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/ARCH/arch-PW6_CALYPSO.fcm	(revision 3679)
+++ 	(revision )
@@ -1,29 +1,0 @@
-# vargas IBM POWER6 at french IDRIS, http://www.idris.fr/su/Scalaire/vargas/hw-vargas.html
-# NCDF_INC    netcdf include file
-# NCDF_LIB    netcdf library
-# FC          Fortran compiler command
-# FCFLAGS     Fortran compiler flags
-# FFLAGS      Fortran 77 compiler flags
-# LD          linker
-# LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
-# FPPFLAGS    pre-processing flags
-# AR          assembler
-# ARFLAGS     assembler flags
-# MK          make  
-# USER_INC    additional include files for the compiler,  e.g. -I<include dir> 
-# USER_LIB    additional libraries to pass to the linker, e.g. -l<library>
-
-
-%NCDF_INC            -I/usr/local/netcdf-3.6.3/include
-%NCDF_LIB            -L/usr/local/netcdf-3.6.3/lib -lnetcdf
-%FC                  mpxlf90_r
-%FCFLAGS             -qstrict -qfree=f90 -g -O3 -qrealsize=8 -qextname -qsource -q64 -qlargepage -qmaxmem=-1
-%FFLAGS              -qstrict -qfixed -g -O3 -qrealsize=8 -qextname -qsource -q64 -qlargepage -qmaxmem=-1
-%LD                  mpxlf90_r
-%LDFLAGS    
-%FPPFLAGS            -P -C
-%AR                  ar  
-%ARFLAGS             rs
-%MK                  gmake 
-%USER_INC            %NCDF_INC
-%USER_LIB            %NCDF_LIB 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/AMM12/EXP00/namelist
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/AMM12/EXP00/namelist	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/AMM12/EXP00/namelist	(revision 3680)
@@ -27,8 +27,8 @@
    cn_exp      =  "AMM12"  !  experience name 
    nn_it000    =       1   !  first time step
-   nn_itend    =     576   !  last  time step (std 1 day = 576)
+   nn_itend    =    2880   !  last  time step (std 1 day = 288)
    nn_date0    =  20070101 !  date at nit_0000 (format yyyymmdd) used if ln_rstart=F or (ln_rstart=T and nn_rstctl=0 or 1)
    nn_leapy    =       1   !  Leap year calendar (1) or not (0)
-   ln_rstart   =  .false.  !  start from rest (F) or from a restart file (T)
+   ln_rstart   =  .true.  !  start from rest (F) or from a restart file (T)
    nn_rstctl   =       0   !  restart control => activated only if ln_rstart = T
                            !    = 0 nn_date0 read in namelist ; nn_it000 : read in namelist
@@ -37,7 +37,7 @@
    cn_ocerst_in  = "restart"   !  suffix of ocean restart name (input)
    cn_ocerst_out = "restart"   !  suffix of ocean restart name (output)
-   nn_istate   =       0   !  output the initial state (1) or not (0)
-   nn_stock    =     576   !  frequency of creation of a restart file (modulo referenced to 1)
-   nn_write    =      12   !  frequency of write in the output file   (modulo referenced to nit000)
+   nn_istate   =       1   !  output the initial state (1) or not (0)
+   nn_stock    =     2880  !  frequency of creation of a restart file (modulo referenced to 1)
+   nn_write    =     144   !  frequency of write in the output file   (modulo referenced to nit000) 
    ln_dimgnnn  = .false.   !  DIMG file format: 1 file for all processors (F) or by processor (T)
    ln_mskland  = .false.   !  mask land points in NetCDF outputs (costly: + ~15%)
@@ -65,12 +65,25 @@
 &namzgr_sco    !   s-coordinate or hybrid z-s-coordinate
 !-----------------------------------------------------------------------
-   rn_sbot_min =   10.     !  minimum depth of s-bottom surface (>0) (m)
-   rn_sbot_max = 7000.     !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
+   ln_s_sh94   = .false.   !  Song & Haidvogel 1994 hybrid S-sigma   (T)|
+   ln_s_sf12   = .true.    !  Siddorn & Furner 2012 hybrid S-z-sigma (T)| if both are false the NEMO tanh stretching is applied
+   ln_sigcrit  = .true.    !  use sigma coordinates below critical depth (T) or Z coordinates (F) for Siddorn & Furner stretch
+                           !  stretching coefficients for all functions
+   rn_sbot_min =   10.0    !  minimum depth of s-bottom surface (>0) (m)
+   rn_sbot_max = 7000.0    !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
+   rn_hc       =   50.0    !  critical depth for transition to stretched coordinates
+                        !!!!!!!  Envelop bathymetry
+   rn_rmax     =    0.3    !  maximum cut-off r-value allowed (0<r_max<1)
+                        !!!!!!!  SH94 stretching coefficients  (ln_s_sh94 = .true.)
    rn_theta    =    6.0    !  surface control parameter (0<=theta<=20)
-   rn_thetb    =    1.00   !  bottom control parameter  (0<=thetb<= 1)
-   rn_rmax     =    0.30   !  maximum cut-off r-value allowed (0<r_max<1)
-   ln_s_sigma  = .true.    !  hybrid s-sigma coordinates
-   rn_bb       =    0.8    !  stretching with s-sigma
-   rn_hc       =  150.0    !  critical depth with s-sigma 
+   rn_bb       =    0.8    !  stretching with SH94 s-sigma   
+                        !!!!!!!  SF12 stretching coefficient  (ln_s_sf12 = .true.)
+   rn_alpha    =    4.4    !  stretching with SF12 s-sigma
+   rn_efold    =    0.0    !  efold length scale for transition to stretched coord
+   rn_zs       =    1.0    !  depth of surface grid box
+                           !  bottom cell depth (Zb) is a linear function of water depth Zb = H*a + b
+   rn_zb_a     =    0.024  !  bathymetry scaling factor for calculating Zb
+   rn_zb_b     =   -0.2    !  offset for calculating Zb
+                        !!!!!!!! Other stretching (not SH94 or SF12) [also uses rn_theta above]
+   rn_thetb    =    1.0    !  bottom control parameter  (0<=thetb<= 1) 
 /
 !-----------------------------------------------------------------------
@@ -79,10 +92,10 @@
    nn_bathy    =    1      !  compute (=0) or read (=1) the bathymetry file
    nn_closea    =   0      !  remove (=0) or keep (=1) closed seas and lakes (ORCA)
-   nn_msh      =    0      !  create (=1) a mesh file or not (=0)
+   nn_msh      =    1      !  create (=1) a mesh file or not (=0)
    rn_hmin     =   -3.     !  min depth of the ocean (>0) or min number of ocean level (<0)
    rn_e3zps_min=   20.     !  partial step thickness is set larger than the minimum of
    rn_e3zps_rat=    0.1    !  rn_e3zps_min and rn_e3zps_rat*e3t, with 0<rn_e3zps_rat<1
                            !
-   rn_rdt      =  150.     !  time step for the dynamics (and tracer if nn_acc=0)
+   rn_rdt      =  300.     !  time step for the dynamics (and tracer if nn_acc=0)
    nn_baro     =   30      !  number of barotropic time step            ("key_dynspg_ts")
    rn_atfp     =    0.1    !  asselin time filter parameter
@@ -147,5 +160,7 @@
                            !     =2 annual global mean of e-p-r set to zero
                            !     =3 global emp set to zero and spread out over erp area
+   ln_wave = .false.       !  Activate coupling with wave (either Stokes Drift or Drag coefficient, or both)  (T => fill namsbc_wave)
    ln_cdgw = .false.       !  Neutral drag coefficient read from wave model (T => fill namsbc_wave)
+   ln_sdw  = .false.       !  Computation of 3D stokes drift                (T => fill namsbc_wave)
 /
 !-----------------------------------------------------------------------
@@ -430,5 +445,5 @@
     cn_mask_file = ''                     !  name of mask file (if ln_mask_file=.TRUE.)
     nn_dyn2d      =  2                    !  boundary conditions for barotropic fields
-    nn_dyn2d_dta  =  2                    !  = 0, bdy data are equal to the initial state
+    nn_dyn2d_dta  =  3                    !  = 0, bdy data are equal to the initial state
                                           !  = 1, bdy data are read in 'bdydata   .nc' files
                                           !  = 2, use tidal harmonic forcing data from files
@@ -438,5 +453,5 @@
                            !  = 1, bdy data are read in 'bdydata   .nc' files
     nn_tra        =  1                    !  boundary conditions for T and S
-    nn_tra_dta    =  0                    !  = 0, bdy data are equal to the initial state
+    nn_tra_dta    =  1                    !  = 0, bdy data are equal to the initial state
                            !  = 1, bdy data are read in 'bdydata   .nc' files
     nn_rimwidth  = 10                      !  width of the relaxation zone
@@ -532,4 +547,5 @@
    ln_traadv_ubs    =  .false.  !  UBS scheme                 
    ln_traadv_qck    =  .false.  !  QUICKEST scheme                 
+   ln_traadv_msc_ups=  .false.  !  use upstream scheme within muscl
 /
 !----------------------------------------------------------------------------------
@@ -603,7 +619,7 @@
    ln_hpg_zco  = .false.   !  z-coordinate - full steps                   
    ln_hpg_zps  = .false.   !  z-coordinate - partial steps (interpolation)
-   ln_hpg_sco  = .true.    !  s-coordinate (standard jacobian formulation)
+   ln_hpg_sco  = .false.    !  s-coordinate (standard jacobian formulation)
    ln_hpg_djc  = .false.   !  s-coordinate (Density Jacobian with Cubic polynomial)
-   ln_hpg_prj  = .false.   !  s-coordinate (Pressure Jacobian scheme)
+   ln_hpg_prj  = .true.   !  s-coordinate (Pressure Jacobian scheme)
    ln_dynhpg_imp = .false. !  time stepping: semi-implicit time scheme  (T)
                                  !           centered      time scheme  (F)
@@ -792,5 +808,5 @@
    nn_bench    =    0      !  Bench mode (1/0): CAUTION use zero except for bench
                            !     (no physical validity of the results)
-   nn_timing   =    1      !  timing by routine activated (=1) creates timing.output file, or not (=0)
+   nn_timing   =    0      !  timing by routine activated (=1) creates timing.output file, or not (=0)
 /
 
@@ -978,4 +994,7 @@
 !              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
    sn_cdg      =  'cdg_wave' ,        1          , 'drag_coeff' , .true.   , .false. , 'daily'  ,''         , ''
+   sn_usd      =  'sdw_wave' ,        1          , 'u_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''
+   sn_vsd      =  'sdw_wave' ,        1          , 'v_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''
+   sn_wn       =  'sdw_wave' ,        1          , 'wave_num'   , .true.   , .false. , 'daily'  ,''         , ''
 !
    cn_dir_cdg  = './'  !  root directory for the location of drag coefficient files
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/AMM12_PISCES/EXP00/namelist
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/AMM12_PISCES/EXP00/namelist	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/AMM12_PISCES/EXP00/namelist	(revision 3680)
@@ -27,8 +27,8 @@
    cn_exp      =  "AMM12"  !  experience name 
    nn_it000    =       1   !  first time step
-   nn_itend    =     576   !  last  time step (std 1 day = 576)
+   nn_itend    =    2880   !  last  time step (std 1 day = 288)
    nn_date0    =  20070101 !  date at nit_0000 (format yyyymmdd) used if ln_rstart=F or (ln_rstart=T and nn_rstctl=0 or 1)
    nn_leapy    =       1   !  Leap year calendar (1) or not (0)
-   ln_rstart   =  .false.  !  start from rest (F) or from a restart file (T)
+   ln_rstart   =  .true.  !  start from rest (F) or from a restart file (T)
    nn_rstctl   =       0   !  restart control => activated only if ln_rstart = T
                            !    = 0 nn_date0 read in namelist ; nn_it000 : read in namelist
@@ -37,7 +37,7 @@
    cn_ocerst_in  = "restart"   !  suffix of ocean restart name (input)
    cn_ocerst_out = "restart"   !  suffix of ocean restart name (output)
-   nn_istate   =       0   !  output the initial state (1) or not (0)
-   nn_stock    =     576   !  frequency of creation of a restart file (modulo referenced to 1)
-   nn_write    =      12   !  frequency of write in the output file   (modulo referenced to nit000)
+   nn_istate   =       1   !  output the initial state (1) or not (0)
+   nn_stock    =     2880  !  frequency of creation of a restart file (modulo referenced to 1)
+   nn_write    =     144   !  frequency of write in the output file   (modulo referenced to nit000) 
    ln_dimgnnn  = .false.   !  DIMG file format: 1 file for all processors (F) or by processor (T)
    ln_mskland  = .false.   !  mask land points in NetCDF outputs (costly: + ~15%)
@@ -65,12 +65,25 @@
 &namzgr_sco    !   s-coordinate or hybrid z-s-coordinate
 !-----------------------------------------------------------------------
-   rn_sbot_min =   10.     !  minimum depth of s-bottom surface (>0) (m)
-   rn_sbot_max = 7000.     !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
+   ln_s_sh94   = .false.   !  Song & Haidvogel 1994 hybrid S-sigma   (T)|
+   ln_s_sf12   = .true.    !  Siddorn & Furner 2012 hybrid S-z-sigma (T)| if both are false the NEMO tanh stretching is applied
+   ln_sigcrit  = .true.    !  use sigma coordinates below critical depth (T) or Z coordinates (F) for Siddorn & Furner stretch
+                           !  stretching coefficients for all functions
+   rn_sbot_min =   10.0    !  minimum depth of s-bottom surface (>0) (m)
+   rn_sbot_max = 7000.0    !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
+   rn_hc       =   50.0    !  critical depth for transition to stretched coordinates
+                        !!!!!!!  Envelop bathymetry
+   rn_rmax     =    0.3    !  maximum cut-off r-value allowed (0<r_max<1)
+                        !!!!!!!  SH94 stretching coefficients  (ln_s_sh94 = .true.)
    rn_theta    =    6.0    !  surface control parameter (0<=theta<=20)
-   rn_thetb    =    1.00   !  bottom control parameter  (0<=thetb<= 1)
-   rn_rmax     =    0.30   !  maximum cut-off r-value allowed (0<r_max<1)
-   ln_s_sigma  = .true.    !  hybrid s-sigma coordinates
-   rn_bb       =    0.8    !  stretching with s-sigma
-   rn_hc       =  150.0    !  critical depth with s-sigma 
+   rn_bb       =    0.8    !  stretching with SH94 s-sigma   
+                        !!!!!!!  SF12 stretching coefficient  (ln_s_sf12 = .true.)
+   rn_alpha    =    4.4    !  stretching with SF12 s-sigma
+   rn_efold    =    0.0    !  efold length scale for transition to stretched coord
+   rn_zs       =    1.0    !  depth of surface grid box
+                           !  bottom cell depth (Zb) is a linear function of water depth Zb = H*a + b
+   rn_zb_a     =    0.024  !  bathymetry scaling factor for calculating Zb
+   rn_zb_b     =   -0.2    !  offset for calculating Zb
+                        !!!!!!!! Other stretching (not SH94 or SF12) [also uses rn_theta above]
+   rn_thetb    =    1.0    !  bottom control parameter  (0<=thetb<= 1) 
 /
 !-----------------------------------------------------------------------
@@ -79,10 +92,10 @@
    nn_bathy    =    1      !  compute (=0) or read (=1) the bathymetry file
    nn_closea    =   0      !  remove (=0) or keep (=1) closed seas and lakes (ORCA)
-   nn_msh      =    0      !  create (=1) a mesh file or not (=0)
+   nn_msh      =    1      !  create (=1) a mesh file or not (=0)
    rn_hmin     =   -3.     !  min depth of the ocean (>0) or min number of ocean level (<0)
    rn_e3zps_min=   20.     !  partial step thickness is set larger than the minimum of
    rn_e3zps_rat=    0.1    !  rn_e3zps_min and rn_e3zps_rat*e3t, with 0<rn_e3zps_rat<1
                            !
-   rn_rdt      =  150.     !  time step for the dynamics (and tracer if nn_acc=0)
+   rn_rdt      =  300.     !  time step for the dynamics (and tracer if nn_acc=0)
    nn_baro     =   30      !  number of barotropic time step            ("key_dynspg_ts")
    rn_atfp     =    0.1    !  asselin time filter parameter
@@ -102,6 +115,6 @@
    !
    cn_dir        = './'     !  root directory for the location of the runoff files
-   ln_tsd_init   = .false.  !  Initialisation of ocean T & S with T &S input data (T) or not (F)
-   ln_tsd_tradmp = .false.  !  damping of ocean T & S toward T &S input data (T) or not (F)
+   ln_tsd_init   = .false.   !  Initialisation of ocean T & S with T &S input data (T) or not (F)
+   ln_tsd_tradmp = .false.   !  damping of ocean T & S toward T &S input data (T) or not (F)
 /
 !!======================================================================
@@ -147,5 +160,7 @@
                            !     =2 annual global mean of e-p-r set to zero
                            !     =3 global emp set to zero and spread out over erp area
+   ln_wave = .false.       !  Activate coupling with wave (either Stokes Drift or Drag coefficient, or both)  (T => fill namsbc_wave)
    ln_cdgw = .false.       !  Neutral drag coefficient read from wave model (T => fill namsbc_wave)
+   ln_sdw  = .false.       !  Computation of 3D stokes drift                (T => fill namsbc_wave)
 /
 !-----------------------------------------------------------------------
@@ -305,5 +320,5 @@
                            !  or to SSS only (=1) or no damping term (=0)
    rn_dqdt     =   -40.    !  magnitude of the retroaction on temperature   [W/m2/K]
-   rn_deds     =  -166.67  !  magnitude of the damping on salinity   [mm/day]
+   rn_deds     =  -27.7    !  magnitude of the damping on salinity   [mm/day]
    ln_sssr_bnd =   .true.  !  flag to bound erp term (associated with nn_sssr=2)
    rn_sssr_bnd =   4.e0    !  ABS(Max/Min) value of the damping erp term [mm/day]
@@ -629,7 +644,7 @@
    ln_hpg_zco  = .false.   !  z-coordinate - full steps                   
    ln_hpg_zps  = .false.   !  z-coordinate - partial steps (interpolation)
-   ln_hpg_sco  = .true.    !  s-coordinate (standard jacobian formulation)
+   ln_hpg_sco  = .false.    !  s-coordinate (standard jacobian formulation)
    ln_hpg_djc  = .false.   !  s-coordinate (Density Jacobian with Cubic polynomial)
-   ln_hpg_prj  = .false.   !  s-coordinate (Pressure Jacobian scheme)
+   ln_hpg_prj  = .true.   !  s-coordinate (Pressure Jacobian scheme)
    ln_dynhpg_imp = .false. !  time stepping: semi-implicit time scheme  (T)
                                  !           centered      time scheme  (F)
@@ -818,5 +833,5 @@
    nn_bench    =    0      !  Bench mode (1/0): CAUTION use zero except for bench
                            !     (no physical validity of the results)
-   nn_timing   =    1      !  timing by routine activated (=1) creates timing.output file, or not (=0)
+   nn_timing   =    0      !  timing by routine activated (=1) creates timing.output file, or not (=0)
 /
 
@@ -908,5 +923,4 @@
                            !  0 < n : debug section number n
 /
-
 !!======================================================================
 !!            ***  Observation & Assimilation namelists ***
@@ -1005,4 +1019,7 @@
 !              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
    sn_cdg      =  'cdg_wave' ,        1          , 'drag_coeff' , .true.   , .false. , 'daily'  ,''         , ''
+   sn_usd      =  'sdw_wave' ,        1          , 'u_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''
+   sn_vsd      =  'sdw_wave' ,        1          , 'v_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''
+   sn_wn       =  'sdw_wave' ,        1          , 'wave_num'   , .true.   , .false. , 'daily'  ,''         , ''
 !
    cn_dir_cdg  = './'  !  root directory for the location of drag coefficient files
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE/EXP00/namelist
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE/EXP00/namelist	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE/EXP00/namelist	(revision 3680)
@@ -65,12 +65,25 @@
 &namzgr_sco    !   s-coordinate or hybrid z-s-coordinate
 !-----------------------------------------------------------------------
-   rn_sbot_min =  300.     !  minimum depth of s-bottom surface (>0) (m)
-   rn_sbot_max = 5250.     !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
-   rn_theta    =    6.0    !  surface control parameter (0<=rn_theta<=20)
-   rn_thetb    =    0.75   !  bottom control parameter  (0<=rn_thetb<= 1)
-   rn_rmax     =    0.15   !  maximum cut-off r-value allowed (0<rn_max<1)
-   ln_s_sigma  = .false.   !  hybrid s-sigma coordinates
-   rn_bb       =    0.8    !  stretching with s-sigma
-   rn_hc       =  150.0    !  critical depth with s-sigma 
+   ln_s_sh94   = .true.    !  Song & Haidvogel 1994 hybrid S-sigma   (T)|
+   ln_s_sf12   = .false.   !  Siddorn & Furner 2012 hybrid S-z-sigma (T)| if both are false the NEMO tanh stretching is applied
+   ln_sigcrit  = .false.   !  use sigma coordinates below critical depth (T) or Z coordinates (F) for Siddorn & Furner stretch
+                           !  stretching coefficients for all functions
+   rn_sbot_min =   10.0    !  minimum depth of s-bottom surface (>0) (m)
+   rn_sbot_max = 7000.0    !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
+   rn_hc       =  150.0    !  critical depth for transition to stretched coordinates
+                        !!!!!!!  Envelop bathymetry
+   rn_rmax     =    0.3    !  maximum cut-off r-value allowed (0<r_max<1)
+                        !!!!!!!  SH94 stretching coefficients  (ln_s_sh94 = .true.)
+   rn_theta    =    6.0    !  surface control parameter (0<=theta<=20)
+   rn_bb       =    0.8    !  stretching with SH94 s-sigma   
+                        !!!!!!!  SF12 stretching coefficient  (ln_s_sf12 = .true.)
+   rn_alpha    =    4.4    !  stretching with SF12 s-sigma
+   rn_efold    =    0.0    !  efold length scale for transition to stretched coord
+   rn_zs       =    1.0    !  depth of surface grid box
+                           !  bottom cell depth (Zb) is a linear function of water depth Zb = H*a + b
+   rn_zb_a     =    0.024  !  bathymetry scaling factor for calculating Zb
+   rn_zb_b     =   -0.2    !  offset for calculating Zb
+                        !!!!!!!! Other stretching (not SH94 or SF12) [also uses rn_theta above]
+   rn_thetb    =    1.0    !  bottom control parameter  (0<=thetb<= 1) 
 /
 !-----------------------------------------------------------------------
@@ -147,5 +160,7 @@
                            !     =2 annual global mean of e-p-r set to zero
                            !     =3 global emp set to zero and spread out over erp area
+   ln_wave = .false.       !  Activate coupling with wave (either Stokes Drift or Drag coefficient, or both)  (T => fill namsbc_wave)
    ln_cdgw = .false.       !  Neutral drag coefficient read from wave model (T => fill namsbc_wave)
+   ln_sdw  = .false.       !  Computation of 3D stokes drift                (T => fill namsbc_wave)
 /
 !-----------------------------------------------------------------------
@@ -568,4 +583,5 @@
    ln_traadv_ubs    =  .false.  !  UBS scheme                 
    ln_traadv_qck    =  .false.  !  QUICKEST scheme                 
+   ln_traadv_msc_ups=  .false.  !  use upstream scheme within muscl 
 /
 !----------------------------------------------------------------------------------
@@ -828,5 +844,5 @@
    nn_bench    =    0      !  Bench mode (1/0): CAUTION use zero except for bench
                            !     (no physical validity of the results)
-   nn_timing   =    1      !  timing by routine activated (=1) creates timing.output file, or not (=0)
+   nn_timing   =    0      !  timing by routine activated (=1) creates timing.output file, or not (=0)
 /
 
@@ -1000,4 +1016,7 @@
 !              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
    sn_cdg      =  'cdg_wave' ,        1          , 'drag_coeff' , .true.   , .false. , 'daily'  ,''         , ''
+   sn_usd      =  'sdw_wave' ,        1          , 'u_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''
+   sn_vsd      =  'sdw_wave' ,        1          , 'v_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''
+   sn_wn       =  'sdw_wave' ,        1          , 'wave_num'   , .true.   , .false. , 'daily'  ,''         , ''
 !
    cn_dir_cdg  = './'  !  root directory for the location of drag coefficient files
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE/cpp_GYRE.fcm
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE/cpp_GYRE.fcm	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE/cpp_GYRE.fcm	(revision 3680)
@@ -1,1 +1,1 @@
- bld::tool::fppkeys key_gyre key_dynspg_flt key_ldfslp key_zdftke key_iomput
+ bld::tool::fppkeys key_gyre key_dynspg_flt key_ldfslp key_zdftke key_iomput 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/CO2.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/CO2.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/CO2.nml	(revision 3680)
@@ -0,0 +1,97 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! ROUTINE: CO2
+!
+! DESCRIPTION
+!   List of parameters values
+!
+! INTERFACE
+! parameter values for mem_CO2 filled by InitCO2
+!
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2007 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+
+&CO2_parameters
+! Initial CO2 concentration in the air [ppm]
+   AtmCO20 = 370.0E0
+! Compute the partial pressure of Atmospheric CO2
+   calcAtmpCO2 = .FALSE.
+   pCO2Method = 1  ! 1=MixRatio*slp, 2=Magnus formula 
+!-----------------------------------------------------------------------------------!
+! Read external data for atmospheric CO2 values  
+          ! Read  !   File   ! NetCDF  !  Var    !  RefTime   ! Input      !   Time   !
+          ! Input !   name   ! Logical !  name   !  yyyymmdd  ! Frequency  !  interp  !
+!AtmCO2_N =    2  , 'CMIP5_Historical_GHG_1765_2005.nc' , .TRUE.  , 'CO2'   , '1764-07-01 00:00' ,  'yearly'  ,  .TRUE.  
+!AtmCO2_N =    2  , 'CMIP5_Historical_GHG_1765_2005.dat' , .FALSE.  , 'CO2'   , '1764-07-01 00:00' ,  'yearly'  ,  .TRUE.  
+! Read external data for atmospheric SLP 
+AtmSLP_N  =    0  , 'AtmSLP.nc' , .TRUE.  ,'AtmSLP' , '1764-07-01 00:00'  , 'dummy' ,  .TRUE.  
+AtmTDP_N  =    0  , 'AtmTDP.nc' , .TRUE.  ,'AtmTDP' , '1764-07-01 00:00'  , 'dummy' ,  .TRUE.  
+!-----------------------------------------------------------------------------------!
+
+! Initial pH value
+   phstart = 8.10E0
+
+! Choice of the acidity constants parameterization
+! K1K2==1 Roy et al. (1993); DOE (1994); pH on total scale
+! K1K2==2 Default
+!         Mehrbach et al (1973) refit by Dickson & Millero (1987)
+!         OCMIP STANDARD; pH on Sea Water Scale
+! K1K2==3 Mehrbach et al (1973) refit by Lueker et al. (2000)
+!         pH on total scale
+! K1K2==4 Hansson (1973b) data as refitted by Dickson and 
+!         Millero (1987); pH on Sea Water Scale
+   K1K2 = 2
+
+! Choice of [H+] numerical computation
+! MethodCalcCO2=1 Approximate static solution
+! MethodCalcCO2=2 Default. Standard OCMIP iteration
+! MethodCalcCO2=3 Follows et al., Ocean Modelling 2006
+!
+! Parameters for MethodCalcCO2=2
+! M2XACC    :  accuracy of the iterative scheme for OCMIP (default 1.E-10)
+! M2PHDELT  :  delta of pH for the root search (realized pH+/-DELT)
+!              in the OCMIP scheme (default 0.5)
+! M2MAXIT   :  maximum number of iterations for OCMIP (default 100 )
+!
+   MethodCalcCO2 = 2
+          M2XACC = 1.0E-10
+        M2PHDELT = 0.3
+         M2MAXIT = 100
+!
+! Calcium ion concentration
+!     [from : "Seawater : Its composition, properties and behaviour"
+!      (2nd Edition), Open University Course Team, 1995]
+!     seawater concentration    = 412 mg / l
+!     atomic weight             = 40.078 g / mol
+!     therefore, concentration  = 10.279 mmol / l
+!                               = 10.279 mol / m3
+        Caconc0 = 10.279E0
+! Normalize Calcium ion concentration by sea water salinity
+        Canorm  = .TRUE.
+/
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/LightAdaptation.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/LightAdaptation.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/LightAdaptation.nml	(revision 3680)
@@ -0,0 +1,55 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: LightAdaptation
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_LightAdaptation filled by InitLightAdaptation
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!  p_isw:  	 Switch between parameterizations
+!  p_chEPLi:  	 Maximum Iopt (W/m2)
+!        :  	    p_clEPLi    =      4.0,    6.0,    5.0,    8.0	# Minimum Iopt (W/m2)
+!  p_clEPLi:  	 Minimum Iopt (W/m2)
+!        :  	    p_ruEPLi    =      0.25,    0.25,   0.5,    0.125	# Maximum daily shift in Iopt (1/d)
+!  p_ruEPLi:  	 Maximum daily shift in Iopt (1/d)
+!  p_addepth:  	 Adaptation depth. Meaningless with high-res models
+
+&LightAdaptation_parameters
+      p_isw = 	1,	1,	1,	1
+  p_addepth = 	50.0,	50.0,	50.0,	50.0
+  p_chEPLi  = 	100.0,	100.0,	100.0,	100.0
+  p_clEPLi  = 	8.0,	10.0,	6.0,	12.0
+  p_ruEPLi  = 	0.2,	0.25,	0.3,	0.15
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/MesoZoo.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/MesoZoo.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/MesoZoo.nml	(revision 3680)
@@ -0,0 +1,86 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: MesoZoo
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_MesoZoo filled by InitMesoZoo
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!        :
+!        :  	 The variable Z3 represents carnivorous mesozooplankton and Z4 represents
+!        :  	 omnivorous mesozooplankton.
+!        :
+!  p_q10:  	 Doubling temperature
+!  p_srs:  	 Respiration rate at 10 degrees C
+!  p_sum:  	 Maximal productivity at 10 degrees C
+!  p_sd:  	 Background natural mortality
+!  p_vum:  	 Specific search volume
+!  p_puI_u:  	 Assimilation efficiency
+!  p_peI_R6:  	 Faeces production
+!  p_sdo:  	 Fractional density-dependent mortality
+!  p_sds:  	 Exponent of density-dependent mortality
+!  p_qpc:  	 Quotum phosphate
+!  p_qnc:  	 Quotum nitrate
+
+&MesoZoo_parameters
+!		Z3	Z4
+       p_q10 =	2.0,	2.0
+       p_srs =	0.01,	0.02
+        p_sd = 	0.01,	0.01
+       p_sum = 	1.6,	2.0
+       p_vum = 	0.016,	0.008
+     p_puI_u = 	0.8,	0.6
+    p_peI_R6 = 	0.2,	0.4
+       p_sdo = 	4.d-4,	4.d-4
+       p_sds = 	2.0,	2.0
+       p_qpc = 	1.67d-3,1.67d-3
+       p_qnc = 	0.015,	0.015
+     p_clO2o = 	30.0,	30.0
+!		P1	P2	P3	P4
+!	Z3
+ p_puPI(1,:) =	0.0,	0.0,	0.0,	0.0
+!	Z4
+ p_puPI(2,:) =	1.0,	0.25,	0.0,	0.0
+!		Z5	Z6
+!	Z3
+p_puMIZ(1,:) =	0.0,	0.0
+!	Z4
+p_puMIZ(2,:)=	1.0,	0.0,
+!		Z3	Z4
+!	Z3
+p_puMEZ(1,:)=	1.0,	1.0
+!	Z4
+p_puMEZ(2,:)=	0.0,	1.0
+
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/MicroZoo.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/MicroZoo.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/MicroZoo.nml	(revision 3680)
@@ -0,0 +1,93 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: MicroZoo
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_MicroZoo filled by InitMicroZoo
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!        :
+!        :  	 The variable Z5 represents microozooplankton and Z6 represents
+!        :  	 heterotrophic nanoflagellates (HNAN)
+!        :
+!  p_q10:  	 Q10 value
+!  p_srs:  	 Respiration rate at 10 degrees Celsius
+!  p_sum:  	 Max. rel daily uptake as a fraction of biomass
+!  p_sdo:  	 Mortality due to oxygen limitation
+!  p_sd:  	 Temperature independent mortality
+!  p_pu_ra:  	 Activity respiration
+!  p_pu_ea:  	 Activity excretion
+!  p_chro:  	 Oxygen saturation where respiration is 0.5
+!  p_chuc:  	 Food concentration where total uptake rate is 0.5
+!  p_minfood:  	 Concentration below which feeding on a particular
+!        :  	 foodsource is depressed
+!  p_qn_mz:  	 Maximum quotum P
+!  p_qp_mz:  	 Maximum quotum N
+!  p_suPI(P1):  	 /day   #relative P1 uptake by zoo
+!  p_suPI(P2):  	 /day   #relative P2 uptake by zoo
+!  p_suPI(P3):  	 /day   #relative P3 uptake by zoo
+!  p_suPI(P4):  	 /day   #relative P4 uptake by zoo
+!  p_suZI(Z5):  	 /day   #relative Z5 uptake by zoo
+!  p_suZI(Z6):  	 /day   #relative Z6 uptake by zoo
+!  p_suB1:  	 /day   #relative B1 uptake by zoo
+
+!       	Z5	Z6
+&MicroZoo_parameters
+       p_q10 = 	2.0,	2.0
+       p_srs = 	0.02,	0.02
+       p_sum = 	2.0,	10.0
+       p_sdo = 	0.05,	0.05
+        p_sd = 	0.0,	0.0
+     p_pu_ra = 	0.25,	0.35
+     p_pu_ea = 	0.25,	0.35
+      p_chro = 	7.8,	7.8
+      p_chuc = 	30.0,	100.0
+   p_minfood = 	10.0,	50.0
+     p_qp_mz = 	1.85d-3,1.85d-3
+     p_qn_mz = 	1.67d-2,1.67d-2
+! Food matrix parameters: take care of the notation
+!		P1	P2	P3	P4
+!	Z5
+ p_suPI(1,:) =	0.0,	1.0,	0.1,	0.0
+!	Z6
+ p_suPI(2,:) =	0.0,	0.2,	1.0,	0.0
+!		Z5	Z6
+!	Z5
+ p_suZI(1,:) = 	1.0,	1.0
+!	Z6
+ p_suZI(2,:) = 	0.0,	0.2
+!		Z5	Z6
+      p_suB1 = 	0.1,	1.0
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/Param.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/Param.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/Param.nml	(revision 3680)
@@ -0,0 +1,128 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: Param
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_Param filled by InitParam
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+&Param_parameters
+                    p_small = 1.0e-20
+                  p_q10diff = 1.49
+                      p_qro = 0.5
+               p_qon_dentri = 1.25
+                p_qon_nitri = 2.0
+                    p_clDxm = 0.001
+       CalcConservationFlag = .FALSE.
+          CalcTransportFlag = .TRUE.
+            CalcPelagicFlag = .TRUE.
+            CalcBenthicFlag = 0
+                    p_poro0 = 0.7 
+       CalcPhytoPlankton(1) = .TRUE.
+       CalcPhytoPlankton(2) = .TRUE.
+       CalcPhytoPlankton(3) = .TRUE.
+       CalcPhytoPlankton(4) = .FALSE.
+               CalcBacteria = .TRUE.
+     CalcMesoZooPlankton(1) = .TRUE.
+     CalcMesoZooPlankton(2) = .TRUE.
+    CalcMicroZooPlankton(1) = .TRUE.
+    CalcMicroZooPlankton(2) = .TRUE.
+           CalcPelChemistry = .TRUE.
+AssignPelBenFluxesInBFMFlag = .TRUE.
+AssignAirPelFluxesInBFMFlag = .TRUE.
+                      p_PAR = 0.40
+                       slp0 = 1013.25E0
+               ChlLightFlag = 2
+           ChlSynthesisFlag = 1
+        ProductionLightFlag = 1
+          LightLocationFlag = 3
+                     p_eps0 = 0.0435
+                   p_epsESS = 0.04d-3
+                 p_InitSink = 100.0
+                    p_d_tot = 0.30
+                  p_d_tot_2 = 0.35
+                  p_clD1D2m = 0.01
+                   p_pe_R1c = 0.60
+                   p_pe_R1n = 0.72
+                   p_pe_R1p = 0.832
+                   p_pe_R1s = 0.06
+                  p_epsChla = 3.0d-2
+                    p_epsR6 = 0.1d-3
+          check_fixed_quota = 0
+!				P1	P2	P3	P4
+                    p_qchlc = 	0.025,	0.015,	0.02,	0.02
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!  p_q10diff:  	 Temperature-dependency porewater diffusion
+!  p_qro:  	 stoichiometry O2-->S2-
+!  p_qon_dentri:  	 stoichiometry O2-->N denitrification
+!  p_qon_nitri:  	 stoichiometry O2-->N nitrification
+!  p_clDxm:  	 minimal value of D?.m for calculation of the alpha
+!        :  	 alpha is used in expo.func and values > 1/0.001 leadt
+!  CalcPelagicFlag:  	 Switch for pelagic system
+!  CalcBenthicFlag:  	 Switch for benthic system
+!  CalcTransportFlag:    Switch for transport
+!  CalcConservationFlag:    Switch for mass conservation check
+!  CalcPhytoPlankton:  	 Switches to turn on/off the calculation of pelagic groups
+!  CalcBacteria:
+!  CalcMesoZooPlankton:
+!  CalcMicroZooPlankton:
+!  CalcPelChemistry:
+!  CalcBenOrganisms:  	 Switches to turn on/off the calculation of benthic organisms
+!  CalcBenBacteria:
+!  AssignPelBenFluxesInBFMFlag:  	 Switches to make choice to define boundary
+!  AssignAirPelFluxesInBFMFlag:  	 fluxes in physical of biological model
+!        :  	     dim2D%
+!  p_PAR:  	 Photosynthetically available radiation
+!  ChlLightFlag:  	 Switch between light prop.(=1) or Chla.(=2) as a state
+!  ChlSynthesisFlag:  	 Switch between types of chl synthesis
+!                        1. PELAGOS; 2. OPATM-BFM; 3. UNIBO
+!  ProductionLightFlag:  Switch between instantaneous light production (=1) 
+!                        and daylength averaged production (=2)
+!  LightLocationFlag:    Switch between different depth-parameterizations
+!  p_qchlc(PhytoPlankton):  Fixed/Maximum quotum Chla:C dependent on 
+!                           ChlLightFlag [mg Chla (mg C)-1]
+!                           p_qchlc%   0.05, 0.03,  0.07,  0.02
+!  p_eps0:  	 Background extinction (abiotic)
+!  p_epsESS:  	 Inorg. suspended matter extinction coeff. (abiotic)
+!  p_InitSink:   parameter to Initialize BenthicSInk var.
+!  p_d_tot:  	 m # Max Thickness of the denitrification layer
+!  p_d_tot_2:  	 m # Thickness of modelled benthic sediment layers
+!  p_clD1D2m:  	 m # minimum distancebetween D1m and D2m
+!  p_pe_R1c:  	 Fraction of excretion going to PLOC
+!  p_pe_R1n:  	 Fraction of excretion going to PLOC
+!  p_pe_R1p:  	 Fraction of excretion going to PLOC
+!  p_epsChla:  	 Chla-contribution to extinction
+!  p_epsR6:  	 (m2/mgC) # Detritus-contribution to extinction
+!  check_fixed_quota       Check whether zooplankton have fixed quota
+!  p_poro0:      Constant porosity for 0D and 1D runs
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/PelBac.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/PelBac.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/PelBac.nml	(revision 3680)
@@ -0,0 +1,84 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: PelBac
+!
+! DESCRIPTION
+!   List of parameters values
+!
+! !AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2008 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!  p_version:  	 Switch for DOM uptake parameterization
+!        :  	 p_version=1 Polimene et al., 2006
+!        :  	 p_version=2 <BFM> standard version
+!  p_q10:  	 Q10-value (temperature dependency)
+!  p_chdo:  	 Michaelis const for O2 dependence (mmol/m3)
+!  p_sd:  	 Independent specific mortality (1/d)
+!  p_sd2:  	 Density dependent mortality (value: 0.009) (1/d)
+!  p_suR1:  	 Specific potential DOM availability (1/d)
+!  p_suR2:  	 Specific potential DOM availability (1/d)
+!  p_suR6:  	 Availability of POM (1/d)
+!  p_sum:  	 Specific potential uptake (1/d)
+!  p_pu_ra:  	 Activity respiration (-)
+!  p_pu_ra_o:  	 Decrease in Ass. efficiency at low O2 conc (-).
+!  p_srs:  	 Specific rest respiration (1/day)
+!  p_qnc:  	 Optimal N/C ratio (model units) 45:9:1
+!  p_qpc:  	 Optimal P/C ratio (model units) C:N:P
+!  p_qlnc:  	 Minimal N/C ratio (model units) 45:9:1 <BFM>
+!  p_qlpc:  	 Minimal P/C ratio (model units) C:N:P (BFM>
+!  p_qun:  	 nutrient affinity ( mmol/mgC/day) <BFM>
+!  p_qup:  	 nutrient affinity ( mmol/mgC/day) <BFM>
+!  p_lN4:  	 ammonium conc. at which nutrate uptake are equal (BFM)
+!  p_pu_ea_R7:   excretion of reg. org. met. (-) <POLIMENE>
+
+&PelBac_parameters
+  p_version = 2
+      p_q10 = 2.95
+     p_chdo = 30.0
+       p_sd = 0.0
+      p_sd2 = 0.009
+    p_suhR1 = 0.5
+    p_sulR1 = 0.25
+     p_suR2 = 0.05
+     p_suR6 = 0.02
+      p_sum = 8.4
+    p_pu_ra = 0.6
+  p_pu_ra_o = 0.2
+ p_pu_ea_R7 = 0.015
+      p_srs = 0.01
+      p_qpc = 1.9d-3
+    p_qlpc  = 9.5d-4
+      p_qnc = 1.2d-2
+     p_qlnc = 6.0d-3
+      p_qun = 0.050
+      p_qup = 0.0050,
+      p_lN4 = 0.05
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!EOP
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/PelChem.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/PelChem.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/PelChem.nml	(revision 3680)
@@ -0,0 +1,49 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: PelChem
+!
+! DESCRIPTION
+!   List of parameter values for peagic chemistry
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+&PelChem_parameters
+    p_sN4N3 = 0.01
+  p_q10N4N3 = 2.367
+  p_q10R6N5 = 1.49
+      p_rOS = 0.05
+    p_clO2o = 10.0
+    p_clN6r = 1.0
+   p_sN3O4n = 0.35
+     p_rPAo = 1.0
+    p_sR6N5 = 0.02
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/PelGlobal.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/PelGlobal.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/PelGlobal.nml	(revision 3680)
@@ -0,0 +1,48 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! ROUTINE: PelGlobal
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_PelGlobal filled by InitPelGlobal
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!  p_rR6m:  	 m/d   # detritus sinking rate
+!  p_rPIm:  	 m/d   # phytoplankton background sinking rate
+
+&PelGlobal_parameters
+  p_rR6m = 1.5
+!		P1	P2	P3	P4
+  p_rPIm = 	0.0, 	0.0, 	0.0, 	0.0
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/PhotoAvailableRadiation.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/PhotoAvailableRadiation.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/PhotoAvailableRadiation.nml	(revision 3680)
@@ -0,0 +1,46 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: PhotoAvailableRadiation
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_PhotoAvailableRadiation filled by InitPhotoAvailableRadiation
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, the mfstep group, the ERSEM team 
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!  p_iswLtyp:  	 Shape of the productivity function
+
+&PAR_parameters
+!		P1	P2	P3	P4
+  p_iswLtyp = 	5,	5,	5,	5
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/Phyto.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/Phyto.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/Phyto.nml	(revision 3680)
@@ -0,0 +1,120 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: Phyto
+!
+! DESCRIPTION
+!   List of parameter values
+!   for mem_Phyto filled by InitPhyto
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   Copyright (C) 2008 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!        :
+!        :  	 ---------------- Physiological parameters -----------------
+!        :
+!  p_q10:  	 Doubling temperature
+!  p_sum:  	 Maximal productivity at 10 degrees C
+!  p_srs:  	 Respiration rate at 10 degrees C
+!  p_sdmo:  	 Max.specific nutrient-stress lysis rate
+!  p_thdo:  	 Half value for nutrient stress lysis
+!  p_seo:  	 Extra lysis rate for high density cells
+!  p_sheo:  	 Half value for density stress lysis
+!  p_pu_ea:  	 Fraction of pp excreted as PLOC/PDET
+!  p_pu_ra:  	 Activity respiration rate
+!        
+!         	 ---------------- Nutrient parameters in phytoplankton -----------------
+!       
+!  p_netgrowth:  logical switch for nutrient-limited growth (true is default)
+!  p_limnut:  	 switch for nut. limitation (Liebig is default)
+!  p_chPs:  	 half-value of SIO4-lim (mmol Si m-3)
+!  p_qslc:  	 Minimum quotum Si in PI
+!  p_qsRc:  	 Reference quotum Si in PI
+!  p_qus:  	 affinity of PI for Si
+!  p_alpha_chl:  	 Initial slope P-I curve
+!      
+!       	 ------------- Chlorophyll parameters -----------
+!       	 skel: Skeletonema costatum pav: Pavlova lutheri
+!       	 syn: Synechoccus sp. (significant alpha decrease with irradiance)
+!       	 gyr: Gyrodinium sp. iso: Isochrysis galbana
+!       	             skel     iso      syn      gyr
+!  p_sdchl:  	 Specific turnover rate for Chla (d-1)
+!       	p_qchlc =    0.03,    0.025,   0.1,     0.02    # Maximum quotum Chla:C
+!       	            +-0.024  +-0.001  +-0.003  +-0.004
+!       	 Thalassiosira sp. (0.05+-0.01)
+!       	             skel     pav      syn      gyr
+!  p_esNI:  	 Nutrient stress threshold for Sinking
+!       	p_alpha_chl = 1.0d-5, 0.46d-5*2.0, 2.0d-5, 0.68d-5 # Initial slope P-I curve
+!       	 Thalassiosira sp. (0.48-0.63)
+!  p_res:  	Maximum Sinking velocity (m/d)
+!  p_qchlc  = 0.05,      0.03,      0.07,      0.02 # Maximum quotum Chla:C
+!       	 ------------- silicate limitation control: -----------
+!             p_qus > 0.0  : silica limitation is controlled by internal quoata
+!             if p_qus\=0  : simple MM limitation on external concentration
+!                            p_chPs must have a number or an error is generated!
+!                ------------- Iron parameters -----------
+!                conc.=[umol/m3] ratio=[umol Fe/mg C]
+!  p_qflc:       min Fe:C ratio derived from 3 umol Fe/mol C
+!                Sunda & Huntsman (1997), Nature, 390, p 389-392
+
+!               P1	P2	P3	P4
+&Phyto_parameters
+     p_limnut = 1,	1,	1,	1
+  p_netgrowth = .FALSE.,.FALSE.,.FALSE.,.FALSE.
+        p_q10 = 2.0,	2.0,	2.0,	2.0
+        p_sum = 2.0,	2.5,	3.0,	0.5
+        p_srs = 0.01,	0.05,	0.1,	0.1
+       p_sdmo = 0.05,	0.05,	0.05,	0.0
+        p_seo = 0.0,	0.0,	0.0,	0.0
+       p_sheo = 0.0,	0.0,	0.0,	100.0
+      p_pu_ea = 0.05,	0.2,	0.2,	0.15
+      p_pu_ra = 0.1,	0.2,	0.25,	0.1
+ p_switchR1R2 = 1.0,	1.0,	1.0,    1.0
+       p_qnlc = 4.193e-3,4.193e-3,4.193e-3,0.00687
+       p_qnRc = 1.26e-2,1.26e-2,1.26e-2,1.26e-2
+        p_xqn = 2.0,	2.0,	2.0,	2.0
+       p_qplc = 1.80e-4,1.80e-4,1.80e-4,4.29e-4
+       p_qpRc = 7.86e-4,7.86e-4,7.86e-4,7.86e-4
+        p_xqp = 2.0,	2.0,	2.0,	2.0
+       p_qslc = 8.5e-3,	0.0,	0.0,	0.0
+       p_qsRc = 0.01,	0.0,	0.0,	0.0
+        p_qun = 0.025,	0.025,	0.025,	0.025
+        p_qup = 0.025,	0.025,	0.025,	0.025
+        p_qus = 0.0,	0.0,	0.0,	0.0
+       p_esNI = 0.1,	0.00,	0.00,	0.00
+       p_thdo = 0.1,	0.1,	0.1,	0.1
+       p_res  = 5.0,	0.0,	0.0,	0.0
+       p_lN4  = 1.0,	1.0,	0.0,	1.0
+       p_chPs = 1.0,	0.0,	0.0,	0.0
+    p_Contois = 0.0,    0.0,    0.0,    0.0
+  p_alpha_chl = 1.38e-5, 0.46e-5, 1.52e-5, 0.68e-5
+      p_sdchl = 0.2,	0.2,	0.2,	0.2
+    p_EpEk_or = 0.0,    0.0,    0.0,    0.0
+ p_tochl_relt = 0.0,    0.0,    0.0,    0.0
+/
+
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/Settling.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/Settling.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/Settling.nml	(revision 3680)
@@ -0,0 +1,48 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! ROUTINE: Settling
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_Settling filled by InitSettling
+!
+! AUTHORS
+!   the BFM team
+!
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!  p_burvel_R6:  	 Bottom Burial Velocity for detritus (m/d)
+!  p_burvel_R2:  	 Bottom Burial Velocity for dissolved (m/d)
+!  p_burvel_PI:  	 Bottom Burial Velocity for plankton (m/d)
+
+&Settling_parameters
+  p_burvel_R6 = 1.5,
+  p_burvel_R2 = 0.0,
+  p_burvel_PI = 0.0
+/
+
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!BOP
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/bfm.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/bfm.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/bfm.nml	(revision 3680)
@@ -0,0 +1,188 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! ROUTINE: Namelist for standalone
+!
+! DESCRIPTION
+!  Parameter values for module standalone filled by init_standalone
+!
+! AUTHORS
+!   Marcello Vichi and Piet Ruardij
+!
+! COPYING
+!   
+!   Copyright (C) 2008 M. Vichi and P. Ruardij
+!   (rua@nioz.nl; vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+
+!-------------------------------------------------------------------------!
+!NAMELIST bfm_nml
+!-------------------------------------------------------------------------!
+!Main initialisation and output specifications
+!NAME           KIND    DESCRIPTION
+!bio_calc 	logical	Switch on/off BFM (for coupled configurations)
+!bfm_init       integer Initialization state
+!                       0. from constant values in bfm_init_nml below
+!                       1. from restart
+!bio_setup	integer BFM configuration:
+!			1. pelagic
+!			2. benthic
+!			3. pelagic and benthic
+!out_fname 	string 	Name of NetCDF output file
+!out_dir 	string 	Path to the output file
+!out_title 	string 	Name of the experiment in NetCDF file
+!out_delta 	integer Output is saved every out_delta timesteps
+!-------------------------------------------------------------------------!
+&bfm_nml
+    bio_calc = .true.
+    bfm_init = 0
+   bio_setup = 1
+  bfm_rstctl = .FALSE.
+   out_fname = 'BFM_NEMO'
+     out_dir = '.'
+   out_title = 'BFM'
+   out_delta = 12 
+   parallel_log = .TRUE.
+/
+
+!-------------------------------------------------------------------------!
+!NAMELIST bfm_init_nml
+!-------------------------------------------------------------------------!
+!Pelagic initialisation
+! pelagic  (O)              O2:   Oxygen (mmol/m3)
+! pelagic  (P)              N1:   Phosphate (mmol/m3)
+! pelagic  (N)              N3:   Nitrate (mmol/m3)
+! pelagic  (N)              N4:   Ammonium (mmol/m3)
+! pelagic  (Si)             N5:   Silicate (mmol/m3)
+! pelagic  (R)              N6:   Reduction Equivalents (mmol/m3)
+! pelagic  (N)              O4:   N2-sink (mmol/m3)
+! pelagic  (CNP)            B1:   Pelagic Bacteria
+! pelagic  (CNPSiI)         P1:   Diatoms (group PhytoPlankton))
+! pelagic  (CNPSiI)         P2:   Flagellates (group PhytoPlankton))
+! pelagic  (CNPSiI)         P3:   PicoPhytoPlankton (group PhytoPlankton))
+! pelagic  (CNPSiI)         P4:   Dinoflagellates (group PhytoPlankton))
+! pelagic  (CNP)            Z3:   Carnivorous mesozooplankton (group MesoZooPlankton))
+! pelagic  (CNP)            Z4:   Omnivorous mesozooplankton (group MesoZooPlankton))
+! pelagic  (CNP)            Z5:   Microzooplankton (group MicroZooPlankton))
+! pelagic  (CNP)            Z6:   Heterotrophic nanoflagellates (HNAN) (group MicroZooPlankton))
+! pelagic  (CNPSi)          R1:   Labile Organic Carbon (LOC)
+! pelagic  (C)              R2:   CarboHydrates (sugars)
+! pelagic  (CNPSi)          R6:   Particulate Organic Carbon (POC)
+! pelagic  (C)              R7:   Refractory Disoolved Organic Carbon
+!<variablename>0 = <realvalue>
+! 
+! Initialization with InitVar structure
+! BFM variable information for data input
+! availabel fields:
+! integer init: select the initialization
+!               0 = homogeneous
+!               1 = analytical
+!               2 = from file
+! options for init==1
+! real anv1: value in the surface layer
+! real anz1: depth of the surface layer
+! real anv2: value in the bottom layer
+! real anz2: depth of the bottom layer
+! options for init==2 (not used when coupled with NEMO because 
+!                      overridden by values in namelist_top)
+! char filename: name of the input file
+! char  varname: name of the var in input file
+! Options currently used when coupled with NEMO
+! logical obc: variable has open boundary data
+! logical sbc: variable has surface boundary data
+! logical cbc: variable has coastal boundary data
+!-------------------------------------------------------------------------!
+&bfm_init_nml
+   N1p0 = 1.0,
+   N3n0 = 5.0,
+   N4n0 = 1.0,
+   N5s0 = 8.0,
+   N6r0 = 1.0,
+   O2o0 = 300.0,
+   O4n0 = 200.0,
+   P1c0 = 1.0,
+   P2c0 = 1.0,
+   P3c0 = 1.0,
+   P4c0 = 1.0,
+   Z3c0 = 1.0,
+   Z4c0 = 1.0,
+   Z5c0 = 1.0,
+   Z6c0 = 1.0,
+   B1c0 = 1.0,
+   R1c0 = 1.0,
+   R2c0 = 0.1,
+   R6c0 = 1.0,
+   R7c0 = 1.0,
+   O3c0 = 27060.00, ![mgC /m3]  2200 umol/Kg
+   O3h0 = 2660.0,   ![mmol eq/m3]  2600 umol/Kg
+/
+
+!-------------------------------------------------------------------------!
+!NAMELIST bfm_save_nml
+!-------------------------------------------------------------------------!
+!Stored variables
+!ave_save: average values over the output interval
+!var_save: instantaneous value at the output interval
+!-------------------------------------------------------------------------!
+&bfm_save_nml
+   ave_save = 'ETW','O2o','O3c','O3h',
+          'EIR',
+          'N1p',
+          'N3n',
+          'N4n',
+          'N5s',
+          'P1c',
+          'P2c',
+          'P3c',
+          'P4c',
+          'R1c',
+          'R2c',
+          'R6c',
+          'P1n',
+          'P2n',
+          'P3n',
+          'P4n',
+          'R1n',
+          'R6n',
+          'P1l',
+          'P2l',
+          'P3l',
+          'P4l',
+          'xEPS',
+          'Chla',
+          'eiPI(iiP1)',
+          'eiPI(iiP2)',
+          'eiPI(iiP3)',
+          'eiPI(iiP4)',
+          'qlPc(iiP1)',
+          'qlPc(iiP2)',
+          'qlPc(iiP3)',
+          'qlPc(iiP4)',
+          'qnPc(iiP1)',
+          'qnPc(iiP2)',
+          'qnPc(iiP3)',
+          'qnPc(iiP4)',
+          'qpPc(iiP1)',
+          'qpPc(iiP2)',
+          'qpPc(iiP3)',
+          'qpPc(iiP4)',
+	'sunPI(iiP1)','sunPI(iiP2)','sunPI(iiP3)','sunPI(iiP4)',
+/
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/iodef.xml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/iodef.xml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/iodef.xml	(revision 3680)
@@ -0,0 +1,421 @@
+<?xml version="1.0"?>
+<simulation>
+  
+  <context id="nemo"> 
+    
+    <!-- $id$ -->
+
+    <!-- 
+============================================================================================================
+=                                  definition of all existing variables                                    =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+    
+    <field_definition level="1" prec="4" operation="ave(X)" enabled=".TRUE."> <!-- time step automaticaly defined -->
+
+      <!-- T grid -->
+      
+      <group id="grid_T" axis_ref="none" grid_ref="grid_T">
+	<field id="toce"         description="temperature"                               unit="degC" axis_ref="deptht"   />
+       	<field id="soce"         description="salinity"                                  unit="psu"  axis_ref="deptht"   />
+	<field id="sst"          description="sea surface temperature"                   unit="degC"                     />
+	<field id="sst2"         description="square of sea surface temperature"         unit="degC2"                    />
+	<field id="sstgrad"      description="module of sst gradient"                    unit="degC/m"                   />
+	<field id="sstgrad2"     description="square of module of sst gradient"          unit="degC2/m2"                 />
+	<field id="sss"          description="sea surface salinity"                      unit="psu"                      />
+	<field id="sss2"         description="square of sea surface salinity"            unit="psu2"                     />
+	<field id="ssh"          description="sea surface height"                        unit="m"                        />
+	<field id="ssh2"         description="square of sea surface height"              unit="m2"                       />
+	<field id="mldkz5"       description="mixing layer depth (Turbocline)"           unit="m"                        />
+	<field id="mldr10_1"     description="Mixed Layer Depth 0.01 ref.10m"            unit="m"                        />
+       	<field id="rhop"         description="potential density (sigma0)"                unit="kg/m3" axis_ref="deptht"  />
+	<!-- next variables available with key_diahth -->
+	<field id="mlddzt"       description="Thermocline Depth (max dT/dz)"             unit="m"                        />
+	<field id="mldr10_3"     description="Mixed Layer Depth dr=0.03 (ref.10m)"       unit="m"                        />
+	<field id="mldr0_1"      description="Mixed Layer Depth dr=0.01 (ref.surf)"      unit="m"                        />
+	<field id="mldr0_3"      description="Mixed Layer Depth dr=0.03 (ref.surf)"      unit="m"                        />
+	<field id="mld_dt02"     description="Mixed Layer Depth |dt|=0.2 (ref.10m)"      unit="m"                        />
+	<field id="topthdep"     description="Top of the thermocline dt=-0.2 (ref.10m)"  unit="m"                        />
+	<field id="pycndep"      description="Pycnocline depth dr~dt=-0.2 (ref.10m)"     unit="m"                        />
+	<field id="BLT"          description="Barrier Layer Thickness"                   unit="m"                        />
+	<field id="tinv"         description="Max of vertical invertion of temperature"  unit="degC"                     />
+	<field id="depti"        description="Depth of max. vert. inv. of temperature"   unit="m"                        />
+        <field id="20d"          description="Depth of 20C isotherm"                     unit="m"                        />
+	<field id="28d"          description="Depth of 28C isotherm"                     unit="m"                        />
+	<field id="hc300"        description="Heat content 300 m"                        unit="W"                        />
+	<!-- variables available with key_diaar5 -->
+	<field id="botpres"      description="Pressure at sea floor"                     unit="dbar"                     />
+	<field id="cellthc"      description="Cell thickness"                            unit="m"     axis_ref="deptht"  />
+     </group>
+
+      <!-- SBC -->
+      
+      <group id="SBC" axis_ref="none" grid_ref="grid_T" > <!-- time step automaticaly defined based on nn_fsbc -->
+
+	<field id="empmr"        description="Net Upward Water Flux"                                        unit="kg/m2/s"  />
+	<field id="empsmr"       description="concentration/dilution water flux"                            unit="kg/m2/s"  />
+	<field id="snowpre"      description="Snow precipitation"                                           unit="kg/m2/s"  />
+	<field id="runoffs"      description="River Runoffs"                                                unit="Kg/m2/s"  />
+
+	<field id="qt"           description="Net Downward Heat Flux"                                       unit="W/m2"     />
+	<field id="qns"          description="non solar Downward Heat Flux"                                 unit="W/m2"     />
+	<field id="qsr"          description="Shortwave Radiation"                                          unit="W/m2"     />
+	<field id="qsr3d"        description="Shortwave Radiation 3D distribution"        axis_ref="deptht" unit="W/m2"     />
+	<field id="qrp"          description="Surface Heat Flux: Damping"                                   unit="W/m2"     />
+	<field id="erp"          description="Surface Water Flux: Damping"                                  unit="Kg/m2/s"  />
+	<field id="taum"         description="wind stress module"                                           unit="N/m2"     />
+	<field id="wspd"         description="Wind speed module at 10 m"                                    unit="m/s"      />
+	
+        <!-- * variable relative to atmospheric pressure forcing : available with ln_apr_dyn -->
+        <field id="ssh_ib"       description="Inverse barometer sea surface height"                         unit="m"        />
+
+	<!-- *_oce variables available with ln_blk_clio or ln_blk_core -->
+	<field id="qns_oce"      description="Non solar Downward Heat Flux over open ocean"                 unit="W/m2"     />
+	<field id="qlw_oce"      description="Longwave Downward Heat Flux over open ocean"                  unit="W/m2"     />
+	<field id="qsb_oce"      description="Sensible Downward Heat Flux over open ocean"                  unit="W/m2"     />
+	<field id="qla_oce"      description="Latent Downward Heat Flux over open ocean"                    unit="W/m2"     />
+	<field id="taum_oce"     description="wind stress module over open ocean"                           unit="N/m2"     />
+
+	<field id="ice_cover"    description="Ice fraction"                                                 unit="1"        />
+
+	<field id="ioceflxb"     description="Oceanic flux at the ice base"                                 unit="W/m2"     />
+	<field id="qsr_ai_cea"   description="Air-Ice downward solar heat flux (cell average)"              unit="W/m2"     />
+	<field id="qns_ai_cea"   description="Air-Ice downward non-solar heat flux (cell average)"          unit="W/m2"     />
+	<field id="qla_ai_cea"   description="Air-Ice downward Latent heat flux (cell average)"             unit="W/m2"     />
+	
+	<field id="qsr_io_cea"   description="Ice-Oce downward solar heat flux (cell average)"              unit="W/m2"     />
+	<field id="qns_io_cea"   description="Ice-Oce downward non-solar heat flux (cell average)"          unit="W/m2"     />
+	
+	<field id="snowthic_cea" description="Snow thickness (cell average)"                                unit="m"        />
+	<field id="icethic_cea"  description="Ice thickness (cell average)"                                 unit="m"        />
+	<field id="iceprod_cea"  description="Ice production (cell average)"                                unit="m/s"      />
+	
+	<field id="ice_pres"     description="Ice presence"                                                 unit="-"        />
+	<field id="ist_cea"      description="Ice surface temperature (cell average)"                       unit="degC"     />
+	<field id="ist_ipa"      description="Ice surface temperature (ice presence average)"               unit="degC"     />      
+	<field id="uice_ipa"     description="Ice velocity along i-axis at I-point (ice presence average)"  unit="m/s"      />      
+	<field id="vice_ipa"     description="Ice velocity along j-axis at I-point (ice presence average)"  unit="m/s"      />      
+	
+	<field id="utau_ice"     description="Wind stress along i-axis over the ice at i-point"             unit="N/m2"     />
+	<field id="vtau_ice"     description="Wind stress along j-axis over the ice at i-point"             unit="N/m2"     />
+	
+	<field id="u_imasstr"    description="Sea-ice mass transport along i-axis"                          unit="kg/s"     />
+	<field id="v_imasstr"    description="Sea-ice mass transport along j-axis"                          unit="kg/s"     />
+
+	<!-- available key_coupled -->
+	<field id="snow_ao_cea"  description="Snow over ice-free ocean (cell average)"                      unit="kg/m2/s"  />
+	<field id="snow_ai_cea"  description="Snow over sea-ice (cell average)"                             unit="kg/m2/s"  />
+	<field id="subl_ai_cea"  description="Sublimation over sea-ice (cell average)"                      unit="kg/m2/s"  />
+	<field id="icealb_cea"   description="Ice albedo (cell average)"                                    unit="1"        />
+	<field id="calving"      description="Calving"                                                      unit="kg/m2/s"  />
+	<!-- available if key_coupled + conservative method -->
+	<field id="rain"         description="Liquid precipitation"                                         unit="Kg/m2/s"  />
+	<field id="evap_ao_cea"  description="Evaporation over ice-free ocean (cell average)"               unit="kg/m2/s"  />
+	<!-- variables available with key_diaar5 -->
+	<field id="isnwmlt_cea"   description="Snow over Ice melting (cell average)"                        unit="kg/m2/s"  />
+	<field id="fsal_virt_cea" description="Virtual salt flux due to ice formation (cell average)"       unit="kg/m2/s"  />
+	<field id="fsal_real_cea" description="Real salt flux due to ice formation (cell average)"          unit="kg/m2/s"  />
+	<field id="hflx_rain_cea" description="heat flux due to rainfall"                                   unit="W/m2"     />
+	<field id="hflx_evap_cea" description="heat flux due to evaporation"                                unit="W/m2"     />
+	<field id="hflx_snow_cea" description="heat flux due to snow falling over ice-free ocean"           unit="W/m2"     />
+	<field id="hflx_ice_cea"  description="heat flux due to ice thermodynamics"                         unit="W/m2"     />
+	<field id="hflx_rnf_cea"  description="heat flux due to runoffs"                                    unit="W/m2"     />
+	<field id="hflx_cal_cea"  description="heat flux due to calving"                                    unit="W/m2"     />
+	<field id="bicemel_cea"  description="Rate of Melt at Sea Ice Base (cell average)"                  unit="kg/m2/s"  />
+	<field id="licepro_cea"  description="Lateral Sea Ice Growth Rate (cell average)"                   unit="kg/m2/s"  />
+	<field id="snowmel_cea"  description="Snow Melt Rate (cell average)"                                unit="kg/m2/s"  />
+	<field id="sntoice_cea"  description="Snow-Ice Formation Rate (cell average)"                       unit="kg/m2/s"  />
+	<field id="ticemel_cea"  description="Rate of Melt at Upper Surface of Sea Ice (cell average)"      unit="kg/m2/s"  />
+
+      </group>
+
+      <!-- U grid -->
+      
+      <group id="grid_U"  axis_ref="depthu" grid_ref="grid_U">
+	<field id="utau"         description="Wind Stress along i-axis"                    unit="N/m2" axis_ref="none" />
+	<field id="uoce"         description="ocean current along i-axis"                  unit="m/s"                  />
+	<field id="uocetr_eff"   description="Effective ocean transport along i-axis"      unit="m3/s"                  />
+	<!-- uoce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="uoce_eiv"     description="EIV ocean current along i-axis"              unit="m/s"                  />
+	<!-- uoce_eiv: available with key_trabbl_adv -->
+	<field id="uoce_bbl"     description="BBL ocean current along i-axis"              unit="m/s"                  />
+	<field id="ahu_bbl"      description="BBL diffusive flux along i-axis"             unit="m3/s" axis_ref="none" />
+ 	<!-- variables available with key_diaar5 -->
+	<field id="u_masstr"     description="ocean eulerian mass transport along i-axis"  unit="kg/s"                 />
+	<field id="u_heattr"     description="ocean eulerian heat transport along i-axis"  unit="W"    axis_ref="none" />
+	<field id="ueiv_heattr"  description="ocean bolus heat transport along i-axis"     unit="W"    axis_ref="none" />
+	<field id="udiff_heattr" description="ocean diffusion heat transport along i-axis" unit="W"    axis_ref="none" />
+     </group>
+      
+      <!-- V grid -->
+      
+      <group id="grid_V"  axis_ref="depthv" grid_ref="grid_V">
+	<field id="vtau"         description="Wind Stress along j-axis"                    unit="N/m2" axis_ref="none" />
+	<field id="voce"         description="ocean current along j-axis"                  unit="m/s"                  />
+	<field id="vocetr_eff"   description="Effective ocean transport along j-axis"      unit="m3/s"                  />
+	<!-- voce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="voce_eiv"     description="EIV ocean current along j-axis"              unit="m/s"                  />
+	<!-- voce_eiv: available with key_trabbl_adv -->
+	<field id="voce_bbl"     description="BBL ocean current along j-axis"              unit="m/s"                  />
+	<field id="ahv_bbl"      description="BBL diffusive flux along j-axis"             unit="m3/s" axis_ref="none" />
+	<!-- variables available with key_diaar5 -->
+	<field id="v_masstr"     description="ocean eulerian mass transport along j-axis"  unit="kg/s"                 />
+	<field id="v_heattr"     description="ocean eulerian heat transport along j-axis"  unit="W"    axis_ref="none" />
+	<field id="veiv_heattr"  description="ocean bolus heat transport along j-axis"     unit="W"    axis_ref="none" />
+	<field id="vdiff_heattr" description="ocean diffusion heat transport along j-axis" unit="W"    axis_ref="none" />
+      </group>
+      
+      <!-- W grid -->
+      
+      <group id="grid_W"  axis_ref="depthw" grid_ref="grid_W">
+	<field id="woce"         description="ocean vertical velocity"                     unit="m/s"                  />
+	<field id="wocetr_eff"   description="effective ocean vertical transport"          unit="m3/s"                 />
+	<!-- woce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="woce_eiv"     description="EIV ocean vertical velocity"                 unit="m/s"                  />
+	<!-- woce_eiv: available with key_trabbl_adv -->
+	<field id="avt"          description="vertical eddy diffusivity"                   unit="m2/s"                 />
+	<field id="avm"          description="vertical eddy viscosity"                     unit="m2/s"                 />
+	<!-- avs: available with key_zdfddm -->
+	<field id="avs"          description="salt vertical eddy diffusivity"              unit="m2/s"                 />
+	<!-- avt_evd and avm_evd: available with ln_zdfevd -->
+	<field id="avt_evd"      description="enhanced vertical diffusivity"               unit="m2/s"                 />
+	<field id="avm_evd"      description="enhanced vertical viscosity"                 unit="m2/s"                 />
+	<!-- aht2d and  aht2d_eiv: available with key_traldf_eiv and key_traldf_c2d -->
+	<field id="aht2d"        description="lateral eddy diffusivity"                    unit="m2/s" axis_ref="none" />
+	<field id="aht2d_eiv"    description="EIV lateral eddy diffusivity"                unit="m2/s" axis_ref="none" />
+	<!-- avt_tide: available with key_zdftmx -->
+	<field id="av_tide"      description="tidal vertical diffusivity"                  unit="m2/s"                 />
+	<!-- variables available with key_diaar5 -->   
+	<field id="w_masstr"     description="vertical mass trasport"                      unit="kg/s"                 />
+	<field id="w_masstr2"    description="square of vertical mass trasport"            unit="kg2/s2"               />
+      </group>
+          
+      <!-- scalar -->
+      
+      <!-- variables available with key_diaar5 -->
+      <group id="scalar" axis_ref="none" grid_ref="scalarpoint" zoom_ref="1point" >
+	<field id="voltot"     description="global mean volume"                         unit="m3"   />
+	<field id="sshtot"     description="global mean ssh"                            unit="m"    />
+	<field id="sshsteric"  description="global mean ssh steric"                     unit="m"    />
+	<field id="sshthster"  description="global mean ssh thermosteric"               unit="m"    />
+	<field id="masstot"    description="global mean mass"                           unit="kg"   />
+	<field id="temptot"    description="global mean temperature"                    unit="degC" />
+	<field id="saltot"     description="global mean salinity"                       unit="psu"  />
+	<field id="fram_trans" description="Sea Ice Mass Transport Through Fram Strait" unit="kg/s" />
+      </group>
+
+      <!-- ptrc on T grid -->
+
+     <group id="ptrc_T" axis_ref="deptht" grid_ref="grid_T">
+       <field id="DET"      description="Detritus"                                      unit="mmole-N/m3" />
+       <field id="ZOO"      description="Zooplankton Concentration"                     unit="mmole-N/m3" />
+       <field id="PHY"      description="Phytoplankton Concentration"                   unit="mmole-N/m3" />
+       <field id="NO3"      description="Nitrate Concentration"                         unit="mmole-N/m3" />
+       <field id="NH4"      description="Ammonium Concentration"                        unit="mmole-N/m3" />
+       <field id="DOM"      description="Dissolved Organic Matter"                      unit="mmole-N/m3" />
+     </group>
+
+     <!-- diad on T grid -->
+
+     <group id="diad_T" axis_ref="none" grid_ref="grid_T">  
+       <field id="FNO3PHY"  description="FNO3PHY"                             unit="-"  axis_ref="deptht" /> 
+       <field id="FNH4PHY"  description="FNH4PHY"                             unit="-"  axis_ref="deptht" /> 
+       <field id="FNH4NO3"  description="FNH4NO3"                             unit="-"  axis_ref="deptht" /> 
+       <field id="TNO3PHY"  description="TNO3PHY"                             unit="-"  /> 
+       <field id="TNH4PHY"  description="TNH4PHY"                             unit="-"  /> 
+       <field id="TPHYDOM"  description="TPHYDOM"                             unit="-"  /> 
+       <field id="TPHYNH4"  description="TPHYNH4"                             unit="-"  /> 
+       <field id="TPHYZOO"  description="TPHYZOO"                             unit="-"  /> 
+       <field id="TPHYDET"  description="TPHYDET"                             unit="-"  /> 
+       <field id="TDETZOO"  description="TDETZOO"                             unit="-"  /> 
+       <field id="TDETSED"  description="TDETSED"                             unit="-"  /> 
+       <field id="TZOODET"  description="TZOODET"                             unit="-"  /> 
+       <field id="TZOOBOD"  description="TZOOBOD"                             unit="-"  /> 
+       <field id="TZOONH4"  description="TZOONH4"                             unit="-"  /> 
+       <field id="TZOODOM"  description="TZOODOM"                             unit="-"  /> 
+       <field id="TNH4NO3"  description="TNH4NO3"                             unit="-"  /> 
+       <field id="TDOMNH4"  description="TDOMNH4"                             unit="-"  /> 
+       <field id="TDETNH4"  description="TDETNH4"                             unit="-"  /> 
+       <field id="TPHYTOT"  description="TPHYTOT"                             unit="-"  /> 
+       <field id="TZOOTOT"  description="TZOOTOT"                             unit="-"  /> 
+       <field id="TDETDOM"  description="TDETDOM"                             unit="-"  /> 
+       <field id="SEDPOC"   description="SEDPOC"                              unit="-"  /> 
+     </group>
+
+  </field_definition>
+
+    <!-- 
+============================================================================================================
+=                                           output files definition                                        =
+=                                            Define your own files                                         =
+=                                         put the variables you want...                                    =
+============================================================================================================
+    -->
+
+  <file_definition output_level="10" enabled=".TRUE.">
+
+
+      <group id="1h" output_freq="3600"   output_level="10" enabled=".TRUE.">                      <!-- 1h files -->
+      </group>
+
+      <group id="2h" output_freq="7200"   output_level="10" enabled=".TRUE.">                      <!-- 2h files -->
+      </group>
+
+      <group id="3h" output_freq="10800"  output_level="10" enabled=".TRUE.">                      <!-- 3h files -->
+      </group>
+
+      <group id="4h" output_freq="14400"  output_level="10" enabled=".TRUE.">                      <!-- 4h files -->
+      </group>
+
+      <group id="6h" output_freq="21600"  output_level="10" enabled=".TRUE.">                      <!-- 6h files -->
+      </group>
+
+      <group id="1d" output_freq="86400"  output_level="10" enabled=".TRUE.">                      <!-- 1d files -->
+      </group>
+
+      <group id="2d" output_freq="172800" output_level="10" enabled=".TRUE.">                      <!-- 2d files -->
+      </group>
+
+      <group id="5d" output_freq="432000" output_level="10" enabled=".TRUE.">                      <!-- 5d files -->
+
+        <file id="5d_grid_T" name="auto" description="ocean T grid variables" >
+          <field ref="toce"         name="votemper"  />
+          <field ref="soce"         name="vosaline"  />
+          <field ref="sst"          name="sosstsst"  />
+          <field ref="sss"          name="sosaline"  />
+          <field ref="ssh"          name="sossheig"  />
+          <field ref="empmr"        name="sowaflup"  />
+          <field ref="qsr"          name="soshfldo"  />
+          <field ref="empsmr"       name="sowaflcd"  />
+          <field ref="qt"           name="sohefldo"  />
+          <field ref="mldr10_1"     name="somxl010"  />
+          <field ref="mldkz5"       name="somixhgt"  />
+          <field ref="wspd"         name="sowindsp"  />
+          <field ref="qrp"          name="sohefldp"  />
+          <field ref="erp"          name="sowafldp"  />
+          <field ref="mldr10_1"     name="sobowlin"  operation="t_max(X)" />
+          <field ref="mlddzt"       name="sothedep"  />
+          <field ref="20d"          name="so20chgt"  />
+          <field ref="28d"          name="so28chgt"  />
+          <field ref="hc300"        name="sohtc300"  />
+        </file>
+
+        <file id="5d_grid_U" name="auto" description="ocean U grid variables" >
+          <field ref="uoce"         name="vozocrtx"  />
+          <field ref="uoce_eiv"     name="vozoeivu"  />
+          <field ref="utau"         name="sozotaux"  />
+        </file>
+
+        <file id="5d_grid_V" name="auto" description="ocean V grid variables" >
+          <field ref="voce"         name="vomecrty"  />
+          <field ref="voce_eiv"     name="vomeeivv"  />
+          <field ref="vtau"         name="sometauy"  />
+        </file>
+
+        <file id="5d_grid_W" name="auto" description="ocean W grid variables" >
+          <field ref="woce"         name="vovecrtz" />
+          <field ref="woce_eiv"     name="voveeivw" />
+          <field ref="avt"          name="votkeavt" />
+          <field ref="avt_evd"      name="votkeevd" />
+          <field ref="avm"          name="votkeavm" />
+          <field ref="avm_evd"      name="votkeevm" />
+          <field ref="avs"          name="voddmavs" />
+          <field ref="aht2d"        name="soleahtw" />
+          <field ref="aht2d_eiv"    name="soleaeiw" />
+        </file>
+  
+       <file id="5d_ptrc_T" name="auto" description="lobster sms variables" >
+         <field ref="DET"      />
+         <field ref="ZOO"      />
+         <field ref="PHY"      />
+         <field ref="NO3"      />
+         <field ref="NH4"      />
+         <field ref="DOM"      />
+       </file>
+
+       <file id="5d_diad_T" name="auto" description="additional lobster diagnostics" >  
+         <field ref="FNO3PHY"   /> 
+         <field ref="FNH4PHY"   /> 
+         <field ref="FNH4NO3"   /> 
+         <field ref="TNO3PHY"   /> 
+         <field ref="TNH4PHY"   /> 
+         <field ref="TPHYDOM"   /> 
+         <field ref="TPHYNH4"   /> 
+         <field ref="TPHYZOO"   /> 
+         <field ref="TPHYDET"   /> 
+         <field ref="TDETZOO"   /> 
+         <field ref="TDETSED"   /> 
+         <field ref="TZOODET"   /> 
+         <field ref="TZOOBOD"   /> 
+         <field ref="TZOONH4"   /> 
+         <field ref="TZOODOM"   /> 
+         <field ref="TNH4NO3"   /> 
+         <field ref="TDOMNH4"   /> 
+         <field ref="TDETNH4"   /> 
+         <field ref="TPHYTOT"   /> 
+         <field ref="TZOOTOT"   /> 
+         <field ref="TDETDOM"   /> 
+         <field ref="SEDPOC"    /> 
+       </file>
+
+      </group>
+
+      <group id="1m" output_freq="-1"     output_level="10" enabled=".TRUE.">                      <!-- real monthly files -->
+      </group>
+
+      <group id="2m" output_freq="-2"     output_level="10" enabled=".TRUE.">                      <!-- real 2m files -->
+      </group>
+
+      <group id="3m" output_freq="-3"     output_level="10" enabled=".TRUE.">                      <!-- real 3m files -->
+      </group>
+
+      <group id="4m" output_freq="-4"     output_level="10" enabled=".TRUE.">                      <!-- real 4m files -->
+      </group>
+
+      <group id="6m" output_freq="-6"     output_level="10" enabled=".TRUE.">                      <!-- real 6m files -->
+      </group>
+
+      <group id="1y" output_freq="-12"    output_level="10" enabled=".TRUE.">                      <!-- real yearly files -->
+      </group>
+
+      <group id="2y"  output_freq="-24"   output_level="10" enabled=".TRUE.">                      <!-- real 2y files -->
+      </group>
+
+      <group id="5y"  output_freq="-60"   output_level="10" enabled=".TRUE.">                      <!-- real 5y files -->
+      </group>
+
+      <group id="10y" output_freq="-120"  output_level="10" enabled=".TRUE.">                      <!-- real 10y files -->
+      </group>
+
+ 
+  </file_definition>
+
+    <!-- 
+============================================================================================================
+=                                           grid definition                                                =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+
+  <axis_definition>  
+     <axis id="deptht" description="Vertical T levels" unit="m" positive=".false." />
+     <axis id="depthu" description="Vertical U levels" unit="m" positive=".false." />
+     <axis id="depthv" description="Vertical V levels" unit="m" positive=".false." />
+     <axis id="depthw" description="Vertical W levels" unit="m" positive=".false." />
+     <axis id="none" description="axe non defini" unit="none" size="1" />
+  </axis_definition> 
+
+  <grid_definition>
+    <grid id="grid_T" description="grid T" />
+    <grid id="grid_U" description="grid U" />
+    <grid id="grid_V" description="grid V" />
+    <grid id="grid_W" description="grid W" />
+    <grid id="scalarpoint" description="scalar" >
+      <zoom id="1point" ibegin="1" jbegin="1" ni="1" nj="1" />
+    </grid>
+  </grid_definition>    
+
+</context>
+
+</simulation>
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/namelist
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/namelist	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/namelist	(revision 3680)
@@ -0,0 +1,976 @@
+!.!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/OPA  :  1 - run manager      (namrun)
+!! namelists    2 - Domain           (namzgr, namzgr_sco, namdom, namtsd)
+!!              3 - Surface boundary (namsbc, namsbc_ana, namsbc_flx, namsbc_clio, namsbc_core
+!!                                    namsbc_cpl, namtra_qsr, namsbc_rnf, 
+!!                                    namsbc_apr, namsbc_ssr, namsbc_alb)
+!!              4 - lateral boundary (namlbc, namcla, namobc, namagrif, nambdy, nambdy_tide)
+!!              5 - bottom  boundary (nambfr, nambbc, nambbl)
+!!              6 - Tracer           (nameos, namtra_adv, namtra_ldf, namtra_dmp)
+!!              7 - dynamics         (namdyn_adv, namdyn_vor, namdyn_hpg, namdyn_spg, namdyn_ldf)
+!!              8 - Verical physics  (namzdf, namzdf_ric, namzdf_tke, namzdf_kpp, namzdf_ddm, namzdf_tmx)
+!!              9 - diagnostics      (namnc4, namtrd, namspr, namflo, namptr, namhsb)
+!!             10 - miscellaneous    (namsol, nammpp, nammpp_dyndist, namctl)
+!!             11 - Obs & Assim      (namobs, nam_asminc)
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+!!======================================================================
+!!                   ***  Run management namelists  ***
+!!======================================================================
+!!   namrun        parameters of the run
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namrun        !   parameters of the run
+!-----------------------------------------------------------------------
+   nn_no       =       0   !  job number
+   cn_exp      =  "GYRE"   !  experience name 
+   nn_it000    =       1   !  first time step
+   nn_itend    =    12   !  last  time step
+   nn_date0    =  010101   !  initial calendar date yymmdd (used if nn_rstctl=1)
+   nn_leapy    =      30   !  Leap year calendar (1) or not (0)
+   ln_rstart   = .false.   !  start from rest (F) or from a restart file (T)
+   nn_rstctl   =       0       !  restart control = 0 nn_it000 is not compared to the restart file value
+                               !                  = 1 use nn_date0 in namelist (not the value in the restart file)
+                               !                  = 2 calendar parameters read in the restart file
+   cn_ocerst_in  = "restart"   !  suffix of ocean restart name (input)
+   cn_ocerst_out = "restart"   !  suffix of ocean restart name (output)
+   nn_istate   =       0   !  output the initial state (1) or not (0)
+   nn_stock    =    4320   !  frequency of creation of a restart file (modulo referenced to 1)
+   nn_write    =      12   !  frequency of write in the output file   (modulo referenced to nn_it000)
+   ln_dimgnnn  = .false.   !  DIMG file format: 1 file for all processors (F) or by processor (T)
+   ln_mskland  = .false.   !  mask land points in NetCDF outputs (costly: + ~15%)
+   ln_clobber  = .false.   !  clobber (overwrite) an existing file
+   nn_chunksz  =       0   !  chunksize (bytes) for NetCDF file (works only with iom_nf90 routines)
+/
+
+!!======================================================================
+!!                      ***  Domain namelists  ***
+!!======================================================================
+!!   namzgr       vertical coordinate
+!!   namzgr_sco   s-coordinate or hybrid z-s-coordinate
+!!   namdom       space and time domain (bathymetry, mesh, timestep)
+!!   namtsd       data: temperature & salinity         
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namzgr        !   vertical coordinate
+!-----------------------------------------------------------------------
+   ln_zco      = .true.    !  z-coordinate - full    steps   (T/F)      ("key_zco" may also be defined)
+   ln_zps      = .false.   !  z-coordinate - partial steps   (T/F)
+   ln_sco      = .false.   !  s- or hybrid z-s-coordinate    (T/F)
+/
+!-----------------------------------------------------------------------
+&namzgr_sco    !   s-coordinate or hybrid z-s-coordinate
+!-----------------------------------------------------------------------
+   rn_sbot_min =  300.     !  minimum depth of s-bottom surface (>0) (m)
+   rn_sbot_max = 5250.     !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
+   rn_theta    =    6.0    !  surface control parameter (0<=rn_theta<=20)
+   rn_thetb    =    0.75   !  bottom control parameter  (0<=rn_thetb<= 1)
+   rn_rmax     =    0.15   !  maximum cut-off r-value allowed (0<rn_max<1)
+   ln_s_sigma  = .false.   !  hybrid s-sigma coordinates
+   rn_bb       =    0.8    !  stretching with s-sigma
+   rn_hc       =  150.0    !  critical depth with s-sigma 
+/
+!-----------------------------------------------------------------------
+&namdom        !   space and time domain (bathymetry, mesh, timestep)
+!-----------------------------------------------------------------------
+   nn_bathy    =    0      !  compute (=0) or read (=1) the bathymetry file
+   nn_closea    =   0      !  remove (=0) or keep (=1) closed seas and lakes (ORCA)
+   nn_msh      =    0      !  create (=1) a mesh file or not (=0)
+   rn_hmin     =   -3.     !  min depth of the ocean (>0) or min number of ocean level (<0)
+   rn_e3zps_min=   20.     !  partial step thickness is set larger than the minimum of
+   rn_e3zps_rat=    0.1    !  rn_e3zps_min and rn_e3zps_rat*e3t, with 0<rn_e3zps_rat<1
+                           !
+   rn_rdt      = 7200.     !  time step for the dynamics (and tracer if nn_acc=0)
+   nn_baro     =   60      !  number of barotropic time step            ("key_dynspg_ts")
+   rn_atfp     =    0.1    !  asselin time filter parameter
+   nn_acc      =    0      !  acceleration of convergence : =1      used, rdt < rdttra(k)
+                                 !                          =0, not used, rdt = rdttra
+   rn_rdtmin   = 7200.           !  minimum time step on tracers (used if nn_acc=1)
+   rn_rdtmax   = 7200.           !  maximum time step on tracers (used if nn_acc=1)
+   rn_rdth     =  800.           !  depth variation of tracer time step (used if nn_acc=1)
+/
+!-----------------------------------------------------------------------
+&namtsd    !   data : Temperature  & Salinity                           
+!-----------------------------------------------------------------------
+!          ! file name ! frequency (hours)    ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation !
+!          !           !  (if <0  months)     !   name   !  (logical)   ! (T/F) ! 'monthly'  ! filename ! pairing  !
+   sn_tem  = 'data_1m_potential_temperature_nomask', -1,'votemper',  .true.  , .true., 'yearly'   , ' '      , ' '
+   sn_sal  = 'data_1m_salinity_nomask'             , -1,'vosaline',  .true.  , .true., 'yearly'   , ''       , ' '
+   !
+   cn_dir        = './'      !  root directory for the location of the runoff files
+   ln_tsd_init   = .false.   !  Initialisation of ocean T & S with T &S input data (T) or not (F)
+   ln_tsd_tradmp = .false.   !  damping of ocean T & S toward T &S input data (T) or not (F)
+/
+!!======================================================================
+!!            ***  Surface Boundary Condition namelists  ***
+!!======================================================================
+!!   namsbc          surface boundary condition
+!!   namsbc_ana      analytical         formulation
+!!   namsbc_flx      flux               formulation
+!!   namsbc_clio     CLIO bulk formulae formulation
+!!   namsbc_core     CORE bulk formulae formulation
+!!   namsbc_mfs      MFS  bulk formulae formulation
+!!   namsbc_cpl      CouPLed            formulation                     ("key_coupled")
+!!   namtra_qsr      penetrative solar radiation
+!!   namsbc_rnf      river runoffs
+!!   namsbc_apr      Atmospheric Pressure
+!!   namsbc_ssr      sea surface restoring term (for T and/or S)
+!!   namsbc_alb      albedo parameters
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namsbc        !   Surface Boundary Condition (surface module)
+!-----------------------------------------------------------------------
+   nn_fsbc     = 1         !  frequency of surface boundary condition computation 
+                           !     (also = the frequency of sea-ice model call)
+   ln_ana      = .true.    !  analytical formulation                    (T => fill namsbc_ana ) 
+   ln_flx      = .false.   !  flux formulation                          (T => fill namsbc_flx )
+   ln_blk_clio = .false.   !  CLIO bulk formulation                     (T => fill namsbc_clio) 
+   ln_blk_core = .false.   !  CORE bulk formulation                     (T => fill namsbc_core) 
+   ln_blk_mfs  = .false.   !  MFS bulk formulation                      (T => fill namsbc_mfs )
+   ln_cpl      = .false.   !  Coupled formulation                       (T => fill namsbc_cpl )
+   ln_apr_dyn  = .false.   !  Patm gradient added in ocean & ice Eqs.   (T => fill namsbc_apr )
+   nn_ice      = 0         !  =0 no ice boundary condition   ,
+                           !  =1 use observed ice-cover      ,
+                           !  =2 ice-model used                         ("key_lim3" or "key_lim2)
+   ln_dm2dc    = .false.   !  daily mean to diurnal cycle on short wave
+   ln_rnf      = .false.   !  runoffs                                   (T => fill namsbc_rnf)
+   ln_ssr      = .false.   !  Sea Surface Restoring on T and/or S       (T => fill namsbc_ssr)
+   nn_fwb      = 0         !  FreshWater Budget: =0 unchecked 
+                           !     =1 global mean of e-p-r set to zero at each time step 
+                           !     =2 annual global mean of e-p-r set to zero
+                           !     =3 global emp set to zero and spread out over erp area
+   ln_cdgw = .false.       !  Neutral drag coefficient read from wave model (T => fill namsbc_wave)
+/
+!-----------------------------------------------------------------------
+&namsbc_ana    !   analytical surface boundary condition
+!-----------------------------------------------------------------------
+   nn_tau000   =   100     !  gently increase the stress over the first ntau_rst time-steps
+   rn_utau0    =   0.1e0   !  uniform value for the i-stress
+   rn_vtau0    =   0.e0    !  uniform value for the j-stress
+   rn_qns0     =   0.e0    !  uniform value for the total heat flux
+   rn_qsr0     =   0.e0    !  uniform value for the solar radiation
+   rn_emp0     =   0.e0    !  uniform value for the freswater budget (E-P)
+/
+!-----------------------------------------------------------------------
+&namsbc_flx    !   surface boundary condition : flux formulation
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_utau     = 'utau'      ,        24         , 'utau'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_vtau     = 'vtau'      ,        24         , 'vtau'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_qtot     = 'qtot'      ,        24         , 'qtot'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_qsr      = 'qsr'       ,        24         , 'qsr'     , .false.      , .false., 'yearly'  , ''       , ''
+   sn_emp      = 'emp'       ,        24         , 'emp'     , .false.      , .false., 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the flux files
+/      
+!-----------------------------------------------------------------------
+&namsbc_clio   !   namsbc_clio  CLIO bulk formulae
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_utau     = 'taux_1m'   ,       -1          , 'sozotaux',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_vtau     = 'tauy_1m'   ,       -1          , 'sometauy',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_wndm     = 'flx'       ,       -1          , 'socliowi',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_tair     = 'flx'       ,       -1          , 'socliot2',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_humi     = 'flx'       ,       -1          , 'socliohu',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_ccov     = 'flx'       ,       -1          , 'socliocl',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_prec     = 'flx'       ,       -1          , 'socliopl',   .false.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files are
+/
+!-----------------------------------------------------------------------
+&namsbc_core   !   namsbc_core  CORE bulk formulae
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_wndi = 'u_10.15JUNE2009_orca2'       ,  6  , 'U_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Uwnd'
+   sn_wndj = 'v_10.15JUNE2009_orca2'       ,  6  , 'V_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Vwnd'
+   sn_qsr  = 'ncar_rad.15JUNE2009_orca2'   , 24  , 'SWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_qlw  = 'ncar_rad.15JUNE2009_orca2'   , 24  , 'LWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_tair = 't_10.15JUNE2009_orca2'       ,  6  , 'T_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_humi = 'q_10.15JUNE2009_orca2'       ,  6  , 'Q_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_prec = 'ncar_precip.15JUNE2009_orca2', -1  , 'PRC_MOD1',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_snow = 'ncar_precip.15JUNE2009_orca2', -1  , 'SNOW'    ,   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_tdif = 'taudif_core'                 , 24  , 'taudif'  ,   .false.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files
+   ln_2m       = .false.   !  air temperature and humidity referenced at 2m (T) instead 10m (F)
+   ln_taudif   = .false.   !  HF tau contribution: use "mean of stress module - module of the mean stress" data
+   rn_pfac     = 1.        !  multiplicative factor for precipitation (total & snow)
+/
+!-----------------------------------------------------------------------
+&namsbc_mfs   !   namsbc_mfs  MFS bulk formulae
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_wndi     =   'ecmwf'   ,        6          , 'u10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
+   sn_wndj     =   'ecmwf'   ,        6          , 'v10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
+   sn_clc      =   'ecmwf'   ,        6          , 'clc'     ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''
+   sn_msl      =   'ecmwf'   ,        6          , 'msl'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
+   sn_tair     =   'ecmwf'   ,        6          , 't2'      ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
+   sn_rhm      =   'ecmwf'   ,        6          , 'rh'      ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''
+   sn_prec     =   'ecmwf'   ,        6          , 'precip'  ,    .true.    , .true.  , 'daily'  ,'bicubic.nc' , ''
+
+   cn_dir      = './ECMWF/'      !  root directory for the location of the bulk files
+/
+!-----------------------------------------------------------------------
+&namsbc_cpl    !   coupled ocean/atmosphere model                       ("key_coupled")
+!-----------------------------------------------------------------------
+!                    !     description       !  multiple  !    vector   !      vector          ! vector !
+!                    !                       ! categories !  reference  !    orientation       ! grids  !
+! send
+sn_snd_temp   =       'weighted oce and ice' ,    'no'    ,     ''      ,         ''           ,   ''    
+sn_snd_alb    =       'weighted ice'         ,    'no'    ,     ''      ,         ''           ,   ''    
+sn_snd_thick  =       'none'                 ,    'no'   ,     ''      ,         ''           ,   ''    
+sn_snd_crt    =       'none'                 ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'       
+sn_snd_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''           ,   ''        
+! receive
+sn_rcv_w10m   =       'none'                 ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_taumod =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_tau    =       'oce only'             ,    'no'    , 'cartesian' , 'eastward-northward',  'U,V'   
+sn_rcv_dqnsdt =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_qsr    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_qns    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_emp    =       'conservative'         ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_rnf    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_cal    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+/
+!-----------------------------------------------------------------------
+&namtra_qsr    !   penetrative solar radiation
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_chl      ='chlorophyll',        -1         , 'CHLA'    ,   .true.     , .true. , 'yearly'  , ''       , ''
+ 
+   cn_dir      = './'      !  root directory for the location of the runoff files
+   ln_traqsr   = .true.    !  Light penetration (T) or not (F)
+   ln_qsr_rgb  = .false.   !  RGB (Red-Green-Blue) light penetration
+   ln_qsr_2bd  = .true.    !  2 bands              light penetration
+   ln_qsr_bio  = .false.   !  bio-model light penetration
+   nn_chldta   =      0    !  RGB : Chl data (=1) or cst value (=0)
+   rn_abs      =   0.58    !  RGB & 2 bands: fraction of light (rn_si1)
+   rn_si0      =   0.35    !  RGB & 2 bands: shortess depth of extinction
+   rn_si1      =   23.0    !  2 bands: longest depth of extinction
+/
+!-----------------------------------------------------------------------
+&namsbc_rnf    !   runoffs namelist surface boundary condition
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_rnf      = 'runoff_core_monthly',    -1    , 'sorunoff',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_cnf      = 'runoff_core_monthly',     0    , 'socoefr0',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_s_rnf    = 'runoffs'            ,    24    , 'rosaline',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_t_rnf    = 'runoffs'            ,    24    , 'rotemper',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_dep_rnf  = 'runoffs'            ,     0    , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir       = './'      !  root directory for the location of the runoff files
+   ln_rnf_emp   = .false.   !  runoffs included into precipitation field (T) or into a file (F)
+   ln_rnf_mouth = .false.   !  specific treatment at rivers mouths
+   rn_hrnf      =  15.e0    !  depth over which enhanced vertical mixing is used
+   rn_avt_rnf   =   1.e-3   !  value of the additional vertical mixing coef. [m2/s]
+   rn_rfact     =   1.e0    !  multiplicative factor for runoff
+   ln_rnf_depth = .false.   !  read in depth information for runoff
+   ln_rnf_tem   = .false.   !  read in temperature information for runoff
+   ln_rnf_sal   = .false.   !  read in salinity information for runoff
+/
+!-----------------------------------------------------------------------
+&namsbc_apr    !   Atmospheric pressure used as ocean forcing or in bulk
+!-----------------------------------------------------------------------
+!              ! file name ! frequency (hours) ! variable ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
+!              !           !  (if <0  months)  !   name   !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
+   sn_apr      = 'patm'    ,         -1        ,'somslpre',    .true.      , .true.  , 'yearly'  ,  ''      ,   ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files
+   ln_ref_apr  = .false.   !  ref. pressure: global mean Patm (T) or a constant (F)
+/
+!-----------------------------------------------------------------------
+&namsbc_ssr    !   surface boundary condition : sea surface restoring
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_sst      = 'sst_data'  ,        24         ,  'sst'    ,    .false.   , .false., 'yearly'  , ''       , ''
+   sn_sss      = 'sss_data'  ,        -1         ,  'sss'    ,    .true.    , .true. , 'yearly'  , ''       , ''
+    
+   cn_dir      = './'      !  root directory for the location of the runoff files
+   nn_sstr     =     0     !  add a retroaction term in the surface heat       flux (=1) or not (=0)
+   nn_sssr     =     0     !  add a damping     term in the surface freshwater flux (=2)
+                           !  or to SSS only (=1) or no damping term (=0)
+   rn_dqdt     =   -40.    !  magnitude of the retroaction on temperature   [W/m2/K]
+   rn_deds     =   -27.7   !  magnitude of the damping on salinity   [mm/day]
+   ln_sssr_bnd =   .false. !  flag to bound erp term (associated with nn_sssr=2)
+   rn_sssr_bnd =   4.e0    !  ABS(Max/Min) value of the damping erp term [mm/day]
+/      
+!-----------------------------------------------------------------------
+&namsbc_alb    !   albedo parameters
+!-----------------------------------------------------------------------
+   rn_cloud    =    0.06   !  cloud correction to snow and ice albedo 
+   rn_albice   =    0.53   !  albedo of melting ice in the arctic and antarctic
+   rn_alphd    =    0.80   !  coefficients for linear interpolation used to
+   rn_alphc    =    0.65   !  compute albedo between two extremes values 
+   rn_alphdi   =    0.72   !  (Pyane, 1972)
+/
+
+!!======================================================================
+!!               ***  Lateral boundary condition  ***
+!!======================================================================
+!!   namlbc        lateral momentum boundary condition
+!!   namcla        cross land advection
+!!   namobc        open boundaries parameters                           ("key_obc")
+!!   namagrif      agrif nested grid ( read by child model only )       ("key_agrif") 
+!!   nambdy        Unstructured open boundaries                         ("key_bdy")
+!!   namtide       Tidal forcing at open boundaries                     ("key_bdy_tides")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namlbc        !   lateral momentum boundary condition
+!-----------------------------------------------------------------------
+   rn_shlat    =    0.     !  shlat = 0  !  0 < shlat < 2  !  shlat = 2  !  2 < shlat
+                           !  free slip  !   partial slip  !   no slip   ! strong slip
+   ln_vorlat   = .false.   !  consistency of vorticity boundary condition with analytical eqs.
+/
+!-----------------------------------------------------------------------
+&namcla        !   cross land advection
+!-----------------------------------------------------------------------
+   nn_cla      =    0      !  advection between 2 ocean pts separates by land
+/
+!-----------------------------------------------------------------------
+&namobc        !   open boundaries parameters                           ("key_obc")
+!-----------------------------------------------------------------------
+   ln_obc_clim = .false.   !  climatological obc data files (T) or not (F)
+   ln_vol_cst  = .true.    !  impose the total volume conservation (T) or not (F)
+   ln_obc_fla  = .false.   !  Flather open boundary condition 
+   nn_obcdta   =    1      !  = 0 the obc data are equal to the initial state
+                           !  = 1 the obc data are read in 'obc.dta' files
+   cn_obcdta   = 'annual'  !  set to annual if obc datafile hold 1 year of data
+                           !  set to monthly if obc datafile hold 1 month of data
+   rn_dpein    =    1.     !  damping time scale for inflow at east  open boundary
+   rn_dpwin    =    1.     !     -           -         -       west    -      -
+   rn_dpnin    =    1.     !     -           -         -       north   -      -
+   rn_dpsin    =    1.     !     -           -         -       south   -      -
+   rn_dpeob    = 3000.     !  time relaxation (days) for the east  open boundary
+   rn_dpwob    =   15.     !     -           -         -     west    -      -
+   rn_dpnob    = 3000.     !     -           -         -     north   -      -
+   rn_dpsob    =   15.     !     -           -         -     south   -      -
+   rn_volemp   =    1.     !  = 0 the total volume change with the surface flux (E-P-R)
+                           !  = 1 the total volume remains constant
+/
+!-----------------------------------------------------------------------
+&namagrif      !  AGRIF zoom                                            ("key_agrif")
+!-----------------------------------------------------------------------
+   nn_cln_update =    3    !  baroclinic update frequency
+   ln_spc_dyn    = .true.  !  use 0 as special value for dynamics
+   rn_sponge_tra = 2880.   !  coefficient for tracer   sponge layer [m2/s]
+   rn_sponge_dyn = 2880.   !  coefficient for dynamics sponge layer [m2/s]
+/
+!-----------------------------------------------------------------------
+!       nam_tide       tide parameters (#ifdef key_tide)
+!-----------------------------------------------------------------------
+!  ln_tide_pot    = use tidal potential forcing
+!  nb_harmo    = number of constituents used
+!  name(1)     = 'M2', 'K1', etc name of constituent
+
+&nam_tide
+   ln_tide_pot           = .true.
+   nb_harmo    = 11
+   clname(1)     =   'M2'
+   clname(2)     =   'S2'
+   clname(3)     =   'N2'
+   clname(4)     =   'K1'
+   clname(5)     =   'O1'
+   clname(6)     =   'Q1'
+   clname(7)     =   'M4'
+   clname(8)     =   'K2'
+   clname(9)     =   'P1'
+   clname(10)    =   'Mf'
+   clname(11)    =   'Mm'
+/
+!-----------------------------------------------------------------------
+&nambdy        !  unstructured open boundaries                          ("key_bdy")
+!-----------------------------------------------------------------------
+    nb_bdy = 1                            !  number of open boundary sets       
+    ln_coords_file = .true.               !  =T : read bdy coordinates from file
+    cn_coords_file = 'coordinates.bdy.nc' !  bdy coordinates files
+    ln_mask_file = .false.                !  =T : read mask from file
+    cn_mask_file = ''                     !  name of mask file (if ln_mask_file=.TRUE.)
+    nn_dyn2d      =  2                    !  boundary conditions for barotropic fields
+    nn_dyn2d_dta  =  3                    !  = 0, bdy data are equal to the initial state
+                                          !  = 1, bdy data are read in 'bdydata   .nc' files
+                                          !  = 2, use tidal harmonic forcing data from files
+                                          !  = 3, use external data AND tidal harmonic forcing
+    nn_dyn3d      =  0                    !  boundary conditions for baroclinic velocities
+    nn_dyn3d_dta  =  0                    !  = 0, bdy data are equal to the initial state
+                           !  = 1, bdy data are read in 'bdydata   .nc' files
+    nn_tra        =  1                    !  boundary conditions for T and S
+    nn_tra_dta    =  1                    !  = 0, bdy data are equal to the initial state
+                           !  = 1, bdy data are read in 'bdydata   .nc' files
+    nn_rimwidth  = 10                      !  width of the relaxation zone
+    ln_vol     = .false.                  !  total volume correction (see nn_volctl parameter)
+    nn_volctl  = 1                        !  = 0, the total water flux across open boundaries is zero
+/
+!-----------------------------------------------------------------------
+&nambdy_dta      !  open boundaries - external data           ("key_bdy")
+!-----------------------------------------------------------------------
+!              !   file name    ! frequency (hours) !  variable  ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
+!              !                !  (if <0  months)  !    name    !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
+   bn_ssh =     'amm12_bdyT_u2d' ,         24        , 'sossheig' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_u2d =     'amm12_bdyU_u2d' ,         24        , 'vobtcrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_v2d =     'amm12_bdyV_u2d' ,         24        , 'vobtcrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_u3d  =    'amm12_bdyU_u3d' ,         24        , 'vozocrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_v3d  =    'amm12_bdyV_u3d' ,         24        , 'vomecrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_tem  =    'amm12_bdyT_tra' ,         24        , 'votemper' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_sal  =    'amm12_bdyT_tra' ,         24        , 'vosaline' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   cn_dir  =    'bdydta/'
+   ln_full_vel = .false.
+/
+!-----------------------------------------------------------------------
+&nambdy_tide     ! tidal forcing at open boundaries              
+!-----------------------------------------------------------------------
+   filtide      = 'bdydta/amm12_bdytide_'         !  file name root of tidal forcing files
+    tide_cpt(1)   ='Q1'  !  names of tidal components used
+    tide_cpt(2)   ='O1'  !  names of tidal components used
+    tide_cpt(3)   ='P1'  !  names of tidal components used
+    tide_cpt(4)   ='S1'  !  names of tidal components used
+    tide_cpt(5)   ='K1'  !  names of tidal components used
+    tide_cpt(6)   ='2N2' !  names of tidal components used
+    tide_cpt(7)   ='MU2' !  names of tidal components used
+    tide_cpt(8)   ='N2'  !  names of tidal components used
+    tide_cpt(9)   ='NU2' !  names of tidal components used
+    tide_cpt(10)   ='M2'  !  names of tidal components used
+    tide_cpt(11)   ='L2'  !  names of tidal components used
+    tide_cpt(12)   ='T2'  !  names of tidal components used
+    tide_cpt(13)   ='S2'  !  names of tidal components used
+    tide_cpt(14)   ='K2'  !  names of tidal components used
+    tide_cpt(15)   ='M4'  !  names of tidal components used
+    tide_speed(1)   = 13.398661 !  phase speeds of tidal components (deg/hour)
+    tide_speed(2)   = 13.943036 !  phase speeds of tidal components (deg/hour)
+    tide_speed(3)   = 14.958932 !  phase speeds of tidal components (deg/hour)
+    tide_speed(4)   = 15.000001 !  phase speeds of tidal components (deg/hour)
+    tide_speed(5)   = 15.041069 !  phase speeds of tidal components (deg/hour)
+    tide_speed(6)   = 27.895355 !  phase speeds of tidal components (deg/hour)
+    tide_speed(7)   = 27.968210 !  phase speeds of tidal components (deg/hour)
+    tide_speed(8)   = 28.439730 !  phase speeds of tidal components (deg/hour)
+    tide_speed(9)   = 28.512585 !  phase speeds of tidal components (deg/hour)
+    tide_speed(10)   = 28.984106 !  phase speeds of tidal components (deg/hour)
+    tide_speed(11)   = 29.528479 !  phase speeds of tidal components (deg/hour)
+    tide_speed(12)   = 29.958935 !  phase speeds of tidal components (deg/hour)
+    tide_speed(13)   = 30.000002 !  phase speeds of tidal components (deg/hour)
+    tide_speed(14)   = 30.082138 !  phase speeds of tidal components (deg/hour)
+    tide_speed(15)   = 57.968212 !  phase speeds of tidal components (deg/hour)
+    ln_tide_date = .true.               !  adjust tidal harmonics for start date of run
+/
+!!======================================================================
+!!                 ***  Bottom boundary condition  ***
+!!======================================================================
+!!   nambfr        bottom friction
+!!   nambbc        bottom temperature boundary condition               
+!!   nambbl        bottom boundary layer scheme                         ("key_trabbl")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&nambfr        !   bottom friction
+!-----------------------------------------------------------------------
+   nn_bfr      =    2      !  type of bottom friction :   = 0 : free slip,  = 1 : linear friction
+                           !                              = 2 : nonlinear friction
+   rn_bfri1    =    4.e-4  !  bottom drag coefficient (linear case)
+   rn_bfri2    =    1.e-3  !  bottom drag coefficient (non linear case)
+   rn_bfeb2    =    2.5e-3 !  bottom turbulent kinetic energy background  (m^2/s^2)
+   ln_bfr2d    = .false.   !  horizontal variation of the bottom friction coef (read a 2D mask file )
+   rn_bfrien   =    50.    !  local multiplying factor of bfr (ln_bfr2d = .true.)
+   ln_bfrimp   = .true.    !  implicit bottom friction (requires ln_zdfexp = .false. if true)
+/
+!-----------------------------------------------------------------------
+&nambbc        !   bottom temperature boundary condition
+!-----------------------------------------------------------------------
+   ln_trabbc   = .false.   !  Apply a geothermal heating at the ocean bottom
+   nn_geoflx   =    0      !  geothermal heat flux: = 0 no flux 
+                           !     = 1 constant flux
+                           !     = 2 variable flux (read in geothermal_heating.nc in mW/m2) 
+   rn_geoflx_cst = 86.4e-3 !  Constant value of geothermal heat flux [W/m2]
+/
+!-----------------------------------------------------------------------
+&nambbl        !   bottom boundary layer scheme
+!-----------------------------------------------------------------------
+   nn_bbl_ldf  =  1      !  diffusive bbl (=1)   or not (=0)
+   nn_bbl_adv  =  0      !  advective bbl (=1/2) or not (=0)
+   rn_ahtbbl   =  1000.  !  lateral mixing coefficient in the bbl  [m2/s]
+   rn_gambbl   =  10.    !  advective bbl coefficient                 [s]
+/
+
+!!======================================================================
+!!                        Tracer (T & S ) namelists
+!!======================================================================
+!!   nameos        equation of state
+!!   namtra_adv    advection scheme
+!!   namtra_ldf    lateral diffusion scheme
+!!   namtra_dmp    T & S newtonian damping                        
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&nameos        !   ocean physical parameters
+!-----------------------------------------------------------------------
+   nn_eos      =   2       !  type of equation of state and Brunt-Vaisala frequency
+                           !     = 0, UNESCO (formulation of Jackett and McDougall (1994) and of McDougall (1987) )
+                           !     = 1, linear: rho(T)   = rau0 * ( 1.028 - ralpha * T )
+                           !     = 2, linear: rho(T,S) = rau0 * ( rbeta * S - ralpha * T )
+   rn_alpha    =   2.0e-4  !  thermal expension coefficient (nn_eos= 1 or 2)
+   rn_beta     =   7.7e-4  !  saline  expension coefficient (nn_eos= 2)
+/
+!-----------------------------------------------------------------------
+&namtra_adv    !   advection scheme for tracer 
+!-----------------------------------------------------------------------
+   ln_traadv_cen2   =  .false.  !  2nd order centered scheme   
+   ln_traadv_tvd    =  .true.   !  TVD scheme                
+   ln_traadv_muscl  =  .false.  !  MUSCL scheme             
+   ln_traadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries  
+   ln_traadv_ubs    =  .false.  !  UBS scheme                 
+   ln_traadv_qck    =  .false.  !  QUICKEST scheme                 
+/
+!-----------------------------------------------------------------------
+&namtra_ldf    !   lateral diffusion scheme for tracer 
+!-----------------------------------------------------------------------
+   !                       !  Type of the operator : 
+   ln_traldf_lap    =  .true.   !  laplacian operator       
+   ln_traldf_bilap  =  .false.  !  bilaplacian operator     
+   !                       !  Direction of action  :
+   ln_traldf_level  =  .false.  !  iso-level                
+   ln_traldf_hor    =  .false.  !  horizontal (geopotential)            (require "key_ldfslp" when ln_sco=T)
+   ln_traldf_iso    =  .true.   !  iso-neutral                          (require "key_ldfslp")
+   ln_traldf_grif   =  .false.  !  griffies skew flux formulation       (require "key_ldfslp")
+   ln_traldf_gdia   =  .false.  !  griffies operator strfn diagnostics  (require "key_ldfslp")
+   ln_triad_iso     =  .false.  !  griffies operator calculates triads twice => pure lateral mixing in ML (require "key_ldfslp")
+   ln_botmix_grif   =  .false.  !  griffies operator with lateral mixing on bottom (require "key_ldfslp")
+   !                       !  Coefficient
+   rn_aht_0         =  1000.    !  horizontal eddy diffusivity for tracers [m2/s]
+   rn_ahtb_0        =     0.    !  background eddy diffusivity for ldf_iso [m2/s]
+   rn_aeiv_0        =     0.    !  eddy induced velocity coef. [m2/s]   (require "key_traldf_eiv")
+/
+!-----------------------------------------------------------------------
+&namtra_dmp    !   tracer: T & S newtonian damping                      
+!-----------------------------------------------------------------------
+   ln_tradmp   =  .false.  !  add a damping termn (T) or not (F)
+   nn_hdmp     =   -1      !  horizontal shape =-1, damping in Med and Red Seas only
+                           !                   =XX, damping poleward of XX degrees (XX>0)
+                           !                      + F(distance-to-coast) + Red and Med Seas
+   nn_zdmp     =    1      !  vertical   shape =0    damping throughout the water column
+                           !                   =1 no damping in the mixing layer (kz  criteria)
+                           !                   =2 no damping in the mixed  layer (rho crieria)
+   rn_surf     =   50.     !  surface time scale of damping   [days]
+   rn_bot      =  360.     !  bottom  time scale of damping   [days]
+   rn_dep      =  800.     !  depth of transition between rn_surf and rn_bot [meters]
+   nn_file     =    1      !  create a damping.coeff NetCDF file (=1) or not (=0)
+/
+
+!!======================================================================
+!!                      ***  Dynamics namelists  ***
+!!======================================================================
+!!   namdyn_adv    formulation of the momentum advection
+!!   namdyn_vor    advection scheme
+!!   namdyn_hpg    hydrostatic pressure gradient
+!!   namdyn_spg    surface pressure gradient                            (CPP key only)
+!!   namdyn_ldf    lateral diffusion scheme
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namdyn_adv    !   formulation of the momentum advection
+!-----------------------------------------------------------------------
+   ln_dynadv_vec = .true.  !  vector form (T) or flux form (F)  
+   ln_dynadv_cen2= .false. !  flux form - 2nd order centered scheme
+   ln_dynadv_ubs = .false. !  flux form - 3rd order UBS      scheme 
+/  
+!-----------------------------------------------------------------------
+&namdyn_vor    !   option of physics/algorithm (not control by CPP keys)
+!-----------------------------------------------------------------------
+   ln_dynvor_ene = .true.  !  enstrophy conserving scheme  
+   ln_dynvor_ens = .false. !  energy conserving scheme    
+   ln_dynvor_mix = .false. !  mixed scheme               
+   ln_dynvor_een = .false. !  energy & enstrophy scheme  
+/
+!-----------------------------------------------------------------------
+&namdyn_hpg    !   Hydrostatic pressure gradient option
+!-----------------------------------------------------------------------
+   ln_hpg_zco  = .true.    !  z-coordinate - full steps                   
+   ln_hpg_zps  = .false.   !  z-coordinate - partial steps (interpolation)
+   ln_hpg_sco  = .false.   !  s-coordinate (standard jacobian formulation)
+   ln_hpg_djc  = .false.   !  s-coordinate (Density Jacobian with Cubic polynomial)
+   ln_hpg_prj  = .false.   !  s-coordinate (Pressure Jacobian scheme)
+   ln_dynhpg_imp = .false. !  time stepping: semi-implicit time scheme  (T)
+                                 !           centered      time scheme  (F)
+/
+!-----------------------------------------------------------------------
+!namdyn_spg    !   surface pressure gradient   (CPP key only)
+!-----------------------------------------------------------------------
+!                          !  explicit free surface                     ("key_dynspg_exp")
+!                          !  filtered free surface                     ("key_dynspg_flt")
+!                          !  split-explicit free surface               ("key_dynspg_ts")
+
+!-----------------------------------------------------------------------
+&namdyn_ldf    !   lateral diffusion on momentum
+!-----------------------------------------------------------------------
+   !                       !  Type of the operator : 
+   ln_dynldf_lap    =  .true.   !  laplacian operator         
+   ln_dynldf_bilap  =  .false.  !  bilaplacian operator    
+   !                       !  Direction of action  : 
+   ln_dynldf_level  =  .false.  !  iso-level               
+   ln_dynldf_hor    =  .true.   !  horizontal (geopotential)            (require "key_ldfslp" in s-coord.)
+   ln_dynldf_iso    =  .false.  !  iso-neutral                          (require "key_ldfslp")
+   !                       !  Coefficient
+   rn_ahm_0_lap     = 100000.   !  horizontal laplacian eddy viscosity   [m2/s]
+   rn_ahmb_0        =     0.    !  background eddy viscosity for ldf_iso [m2/s]
+   rn_ahm_0_blp     =     0.    !  horizontal bilaplacian eddy viscosity [m4/s]
+/
+
+!!======================================================================
+!!             Tracers & Dynamics vertical physics namelists
+!!======================================================================
+!!    namzdf        vertical physics
+!!    namzdf_ric    richardson number dependent vertical mixing         ("key_zdfric")
+!!    namzdf_tke    TKE dependent vertical mixing                       ("key_zdftke")
+!!    namzdf_kpp    KPP dependent vertical mixing                       ("key_zdfkpp")
+!!    namzdf_ddm    double diffusive mixing parameterization            ("key_zdfddm")
+!!    namzdf_tmx    tidal mixing parameterization                       ("key_zdftmx")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namzdf        !   vertical physics
+!-----------------------------------------------------------------------
+   rn_avm0     =   1.2e-4  !  vertical eddy viscosity   [m2/s]          (background Kz if not "key_zdfcst")
+   rn_avt0     =   1.2e-5  !  vertical eddy diffusivity [m2/s]          (background Kz if not "key_zdfcst")
+   nn_avb      =    0      !  profile for background avt & avm (=1) or not (=0)
+   nn_havtb    =    0      !  horizontal shape for avtb (=1) or not (=0)
+   ln_zdfevd   = .true.    !  enhanced vertical diffusion (evd) (T) or not (F)
+   nn_evdm     =    1      !  evd apply on tracer (=0) or on tracer and momentum (=1)
+   rn_avevd    =  100.     !  evd mixing coefficient [m2/s]
+   ln_zdfnpc   = .false.   !  Non-Penetrative Convective algorithm (T) or not (F)
+   nn_npc      =    1            !  frequency of application of npc
+   nn_npcp     =  365            !  npc control print frequency
+   ln_zdfexp   = .false.   !  time-stepping: split-explicit (T) or implicit (F) time stepping
+   nn_zdfexp   =    3            !  number of sub-timestep for ln_zdfexp=T
+/
+!-----------------------------------------------------------------------
+&namzdf_ric    !   richardson number dependent vertical diffusion       ("key_zdfric" )
+!-----------------------------------------------------------------------
+   rn_avmri    = 100.e-4   !  maximum value of the vertical viscosity
+   rn_alp      =   5.      !  coefficient of the parameterization
+   nn_ric      =   2       !  coefficient of the parameterization
+   rn_ekmfc    =   0.7     !  Factor in the Ekman depth Equation
+   rn_mldmin   =   1.0     !  minimum allowable mixed-layer depth estimate (m)
+   rn_mldmax   =1000.0     !  maximum allowable mixed-layer depth estimate (m)
+   rn_wtmix    =  10.0     !  vertical eddy viscosity coeff [m2/s] in the mixed-layer
+   rn_wvmix    =  10.0     !  vertical eddy diffusion coeff [m2/s] in the mixed-layer
+   ln_mldw     = .true.    !  Flag to use or not the mized layer depth param.
+/
+!-----------------------------------------------------------------------
+&namzdf_tke    !   turbulent eddy kinetic dependent vertical diffusion  ("key_zdftke")
+!-----------------------------------------------------------------------
+   rn_ediff    =   0.1     !  coef. for vertical eddy coef. (avt=rn_ediff*mxl*sqrt(e) )
+   rn_ediss    =   0.7     !  coef. of the Kolmogoroff dissipation
+   rn_ebb      =  67.83    !  coef. of the surface input of tke (=67.83 suggested when ln_mxl0=T)
+   rn_emin     =   1.e-6   !  minimum value of tke [m2/s2]
+   rn_emin0    =   1.e-4   !  surface minimum value of tke [m2/s2]
+   nn_mxl      =   2       !  mixing length: = 0 bounded by the distance to surface and bottom
+                           !                 = 1 bounded by the local vertical scale factor
+                           !                 = 2 first vertical derivative of mixing length bounded by 1
+                           !                 = 3 as =2 with distinct disspipative an mixing length scale
+   nn_pdl      =   1       !  Prandtl number function of richarson number (=1, avt=pdl(Ri)*avm) or not (=0, avt=avm)
+   ln_mxl0     = .true.    !  surface mixing length scale = F(wind stress) (T) or not (F)
+   rn_mxl0     =   0.04    !  surface  buoyancy lenght scale minimum value
+   ln_lc       = .true.    !  Langmuir cell parameterisation (Axell 2002)
+   rn_lc       =   0.15    !  coef. associated to Langmuir cells
+   nn_etau     =   0       !  penetration of tke below the mixed layer (ML) due to internal & intertial waves
+                           !        = 0 no penetration
+                           !        = 1 add a tke source below the ML
+                           !        = 2 add a tke source just at the base of the ML
+                           !        = 3 as = 1 applied on HF part of the stress    ("key_coupled")
+   rn_efr      =   0.05    !  fraction of surface tke value which penetrates below the ML (nn_etau=1 or 2)
+   nn_htau     =   1       !  type of exponential decrease of tke penetration below the ML
+                           !        = 0  constant 10 m length scale
+                           !        = 1  0.5m at the equator to 30m poleward of 40 degrees
+/
+!------------------------------------------------------------------------
+&namzdf_kpp    !   K-Profile Parameterization dependent vertical mixing  ("key_zdfkpp", and optionally:
+!------------------------------------------------------------------------ "key_kppcustom" or "key_kpplktb")
+   ln_kpprimix = .true.    !  shear instability mixing 
+   rn_difmiw   =  1.0e-04  !  constant internal wave viscosity [m2/s]
+   rn_difsiw   =  0.1e-04  !  constant internal wave diffusivity [m2/s]
+   rn_riinfty  =  0.8      !  local Richardson Number limit for shear instability
+   rn_difri    =  0.0050   !  maximum shear mixing at Rig = 0    [m2/s]
+   rn_bvsqcon  = -0.01e-07 !  Brunt-Vaisala squared for maximum convection [1/s2] 
+   rn_difcon   =  1.       !  maximum mixing in interior convection [m2/s] 
+   nn_avb      =  0        !  horizontal averaged (=1) or not (=0) on avt and amv
+   nn_ave      =  1        !  constant (=0) or profile (=1) background on avt
+/
+!-----------------------------------------------------------------------
+&namzdf_gls                !   GLS vertical diffusion                   ("key_zdfgls")
+!-----------------------------------------------------------------------
+   rn_emin       = 1.e-6   !  minimum value of e   [m2/s2]
+   rn_epsmin     = 1.e-12  !  minimum value of eps [m2/s3]
+   ln_length_lim = .true.  !  limit on the dissipation rate under stable stratification (Galperin et al., 1988)
+   rn_clim_galp  = 0.53    !  galperin limit
+   ln_crban      = .true.  !  Use Craig & Banner (1994) surface wave mixing parametrisation
+   ln_sigpsi     = .true.  !  Activate or not Burchard 2001 mods on psi schmidt number in the wb case
+   rn_crban      = 100.    !  Craig and Banner 1994 constant for wb tke flux
+   rn_charn      = 70000.  !  Charnock constant for wb induced roughness length
+   nn_tkebc_surf =   1     !  surface tke condition (0/1/2=Dir/Neum/Dir Mellor-Blumberg)
+   nn_tkebc_bot  =   1     !  bottom tke condition (0/1=Dir/Neum)
+   nn_psibc_surf =   1     !  surface psi condition (0/1/2=Dir/Neum/Dir Mellor-Blumberg)
+   nn_psibc_bot  =   1     !  bottom psi condition (0/1=Dir/Neum)
+   nn_stab_func  =   2     !  stability function (0=Galp, 1= KC94, 2=CanutoA, 3=CanutoB)
+   nn_clos       =   1     !  predefined closure type (0=MY82, 1=k-eps, 2=k-w, 3=Gen)
+/
+!-----------------------------------------------------------------------
+&namzdf_ddm    !   double diffusive mixing parameterization             ("key_zdfddm")
+!-----------------------------------------------------------------------
+   rn_avts     = 1.e-4     !  maximum avs (vertical mixing on salinity)
+   rn_hsbfr    = 1.6       !  heat/salt buoyancy flux ratio
+/
+!-----------------------------------------------------------------------
+&namzdf_tmx    !   tidal mixing parameterization                        ("key_zdftmx")
+!-----------------------------------------------------------------------
+   rn_htmx     = 500.      !  vertical decay scale for turbulence (meters)
+   rn_n2min    = 1.e-8     !  threshold of the Brunt-Vaisala frequency (s-1)
+   rn_tfe      = 0.333     !  tidal dissipation efficiency
+   rn_me       = 0.2       !  mixing efficiency 
+   ln_tmx_itf  = .false.   !  ITF specific parameterisation
+   rn_tfe_itf  = 1.        !  ITF tidal dissipation efficiency
+/
+
+!!======================================================================
+!!                  ***  Miscelaneous namelists  ***
+!!======================================================================
+!!   nammpp            Massively Parallel Processing                    ("key_mpp_mpi)
+!!   namctl            Control prints & Benchmark
+!!   namsol            elliptic solver / island / free surface 
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namsol        !   elliptic solver / island / free surface 
+!-----------------------------------------------------------------------
+   nn_solv     =      2    !  elliptic solver: =1 preconditioned conjugate gradient (pcg)
+                           !                   =2 successive-over-relaxation (sor)
+   nn_sol_arp  =      0    !  absolute/relative (0/1) precision convergence test
+   rn_eps      =  1.e-6    !  absolute precision of the solver
+   nn_nmin     =    210    !  minimum of iterations for the SOR solver
+   nn_nmax     =    800    !  maximum of iterations for the SOR solver
+   nn_nmod     =     10    !  frequency of test for the SOR solver
+   rn_resmax   =  1.e-10   !  absolute precision for the SOR solver
+   rn_sor      =  1.96     !  optimal coefficient for SOR solver (to be adjusted with the domain)
+/
+!-----------------------------------------------------------------------
+&nammpp        !   Massively Parallel Processing                        ("key_mpp_mpi)
+!-----------------------------------------------------------------------
+   cn_mpi_send =  'I'      !  mpi send/recieve type   ='S', 'B', or 'I' for standard send,
+                           !  buffer blocking send or immediate non-blocking sends, resp.
+   nn_buffer   =   0       !  size in bytes of exported buffer ('B' case), 0 no exportation
+   ln_nnogather=  .false.  !  activate code to avoid mpi_allgather use at the northfold
+   jpni        =   2       !  jpni   number of processors following i (set automatically if < 1)     
+   jpnj        =   2       !  jpnj   number of processors following j (set automatically if < 1)     
+   jpnij       =   4       !  jpnij  number of local domains (set automatically if < 1)              
+/
+!-----------------------------------------------------------------------
+&namctl        !   Control prints & Benchmark
+!-----------------------------------------------------------------------
+   ln_ctl      = .false.   !  trends control print (expensive!)
+   nn_print    =    0      !  level of print (0 no extra print)
+   nn_ictls    =    0      !  start i indice of control sum (use to compare mono versus
+   nn_ictle    =    0      !  end   i indice of control sum        multi processor runs
+   nn_jctls    =    0      !  start j indice of control               over a subdomain)
+   nn_jctle    =    0      !  end   j indice of control
+   nn_isplt    =    1      !  number of processors in i-direction
+   nn_jsplt    =    1      !  number of processors in j-direction
+   nn_bench    =    0      !  Bench mode (1/0): CAUTION use zero except for bench
+                           !     (no physical validity of the results)
+   nn_timing   =    1      !  timing by routine activated (=1) creates timing.output file, or not (=0)
+/
+
+!!======================================================================
+!!                  ***  Diagnostics namelists  ***
+!!======================================================================
+!!   namnc4       netcdf4 chunking and compression settings             ("key_netcdf4")
+!!   namtrd       dynamics and/or tracer trends                         ("key_trddyn","key_trdtra","key_trdmld")
+!!   namflo       float parameters                                      ("key_float")
+!!   namptr       Poleward Transport Diagnostics
+!!   namhsb       Heat and salt budgets 
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namnc4        !   netcdf4 chunking and compression settings            ("key_netcdf4")
+!-----------------------------------------------------------------------
+   nn_nchunks_i=   4       !  number of chunks in i-dimension
+   nn_nchunks_j=   4       !  number of chunks in j-dimension
+   nn_nchunks_k=   31      !  number of chunks in k-dimension
+                           !  setting nn_nchunks_k = jpk will give a chunk size of 1 in the vertical which
+                           !  is optimal for postprocessing which works exclusively with horizontal slabs
+   ln_nc4zip   = .true.    !  (T) use netcdf4 chunking and compression
+                           !  (F) ignore chunking information and produce netcdf3-compatible files
+/
+!-----------------------------------------------------------------------
+&namtrd        !   diagnostics on dynamics and/or tracer trends         ("key_trddyn" and/or "key_trdtra")
+!              !       or mixed-layer trends or barotropic vorticity    ("key_trdmld" or     "key_trdvor")
+!-----------------------------------------------------------------------
+   nn_trd      = 365       !  time step frequency dynamics and tracers trends
+   nn_ctls     =   0       !  control surface type in mixed-layer trends (0,1 or n<jpk)
+   rn_ucf      =   1.      !  unit conversion factor (=1 -> /seconds ; =86400. -> /day)
+   cn_trdrst_in      = "restart_mld"   ! suffix of ocean restart name (input)
+   cn_trdrst_out     = "restart_mld"   ! suffix of ocean restart name (output)
+   ln_trdmld_restart = .false.         !  restart for ML diagnostics
+   ln_trdmld_instant = .false.         !  flag to diagnose trends of instantantaneous or mean ML T/S
+/
+!-----------------------------------------------------------------------
+&namflo       !   float parameters                                      ("key_float")
+!-----------------------------------------------------------------------
+   jpnfl         = 1          !  total number of floats during the run
+   jpnnewflo     = 0          !  number of floats for the restart
+   ln_rstflo     = .false.    !  float restart (T) or not (F)
+   nn_writefl    =      75    !  frequency of writing in float output file
+   nn_stockfl    =    5475    !  frequency of creation of the float restart file
+   ln_argo       = .false.    !  Argo type floats (stay at the surface each 10 days)
+   ln_flork4     = .false.    !  trajectories computed with a 4th order Runge-Kutta (T)
+                              !  or computed with Blanke' scheme (F)
+   ln_ariane     = .true.     !  Input with Ariane tool convention(T)
+   ln_flo_ascii  = .true.     !  Output with Ariane tool netcdf convention(F) or ascii file (T)
+/
+!-----------------------------------------------------------------------
+&namptr       !   Poleward Transport Diagnostic
+!-----------------------------------------------------------------------
+   ln_diaptr  = .false.    !  Poleward heat and salt transport (T) or not (F)
+   ln_diaznl  = .true.     !  Add zonal means and meridional stream functions
+   ln_subbas  = .true.     !  Atlantic/Pacific/Indian basins computation (T) or not 
+                           !  (orca configuration only, need input basins mask file named "subbasins.nc"
+   ln_ptrcomp = .true.     !  Add decomposition : overturning
+   nn_fptr    =  1         !  Frequency of ptr computation [time step]
+   nn_fwri    =  15        !  Frequency of ptr outputs [time step]
+/
+!-----------------------------------------------------------------------
+&namhsb       !  Heat and salt budgets 
+!-----------------------------------------------------------------------
+   ln_diahsb  = .false.    !  check the heat and salt budgets (T) or not (F)
+/
+!-----------------------------------------------------------------------
+&namdct        ! transports through sections
+!-----------------------------------------------------------------------
+    nn_dct      = 60       !  time step frequency for transports computing
+    nn_dctwri   = 60       !  time step frequency for transports writing
+    nn_secdebug = 0        !      0 : no section to debug
+                           !     -1 : debug all section
+                           !  0 < n : debug section number n
+/ 
+
+!!======================================================================
+!!            ***  Observation & Assimilation namelists ***
+!!======================================================================
+!!   namobs       observation and model comparison                      ('key_diaobs')
+!!   nam_asminc   assimilation increments                               ('key_asminc')
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namobs       !  observation usage switch                               ('key_diaobs')
+!-----------------------------------------------------------------------
+   ln_t3d     = .false.    ! Logical switch for T profile observations         
+   ln_s3d     = .false.    ! Logical switch for S profile observations          
+   ln_ena     = .false.    ! Logical switch for ENACT insitu data set           
+   !                       !     ln_cor                  Logical switch for Coriolis insitu data set       
+   ln_profb   = .false.    ! Logical switch for feedback insitu data set     
+   ln_sla     = .false.    ! Logical switch for SLA observations               
+
+   ln_sladt   = .false.    ! Logical switch for AVISO SLA data              
+
+   ln_slafb   = .false.    ! Logical switch for feedback SLA data            
+                           !     ln_ssh                  Logical switch for SSH observations              
+
+   ln_sst     = .false.    ! Logical switch for SST observations              
+                           !     ln_reysst               Logical switch for Reynolds observations       
+                           !     ln_ghrsst               Logical switch for GHRSST observations          
+
+   ln_sstfb   = .false.    ! Logical switch for feedback SST data          
+                           !     ln_sss                  Logical switch for SSS observations              
+                           !     ln_seaice               Logical switch for Sea Ice observations        
+                           !     ln_vel3d                Logical switch for velocity observations         
+                           !     ln_velavcur             Logical switch for velocity daily av. cur.    
+                           !     ln_velhrcur             Logical switch for velocity high freq. cur.   
+                           !     ln_velavadcp            Logical switch for velocity daily av. ADCP  
+                           !     ln_velhradcp            Logical switch for velocity high freq. ADCP
+                           !     ln_velfb                Logical switch for feedback velocity data       
+                           !     ln_grid_global          Global distribtion of observations         
+                           !     ln_grid_search_lookup   Logical switch for obs grid search w/lookup table  
+                           !     grid_search_file        Grid search lookup file header 
+                           !     enactfiles              ENACT input observation file names 
+                           !     coriofiles              Coriolis input observation file name  
+   !                       ! profbfiles: Profile feedback input observation file name 
+   profbfiles = 'profiles_01.nc'
+                           !     ln_profb_enatim         Enact feedback input time setting switch    
+                           !     slafilesact             Active SLA input observation file name
+                           !     slafilespas             Passive SLA input observation file name 
+   !                       ! slafbfiles: Feedback SLA input observation file name 
+   slafbfiles = 'sla_01.nc'
+                           !     sstfiles                GHRSST input observation file name       
+   !                       ! sstfbfiles: Feedback SST input observation file name 
+   sstfbfiles = 'sst_01.nc' 'sst_02.nc' 'sst_03.nc' 'sst_04.nc' 'sst_05.nc'
+                           !     seaicefiles             Sea Ice input observation file name 
+                           !     velavcurfiles           Vel. cur. daily av. input file name  
+                           !     velhvcurfiles           Vel. cur. high freq. input file name  
+                           !     velavadcpfiles          Vel. ADCP daily av. input file name    
+                           !     velhvadcpfiles          Vel. ADCP high freq. input file name 
+                           !     velfbfiles              Vel. feedback input observation file name 
+                           !     dobsini                 Initial date in window YYYYMMDD.HHMMSS       
+                           !     dobsend                 Final date in window YYYYMMDD.HHMMSS         
+                           !     n1dint                  Type of vertical interpolation method        
+                           !     n2dint                  Type of horizontal interpolation method       
+                           !     ln_nea                  Rejection of observations near land switch    
+   nmsshc     = 0          ! MSSH correction scheme                         
+                           !     mdtcorr                 MDT  correction                               
+                           !     mdtcutoff               MDT cutoff for computed correction          
+   ln_altbias = .false.    ! Logical switch for alt bias                
+   ln_ignmis  = .true.     ! Logical switch for ignoring missing files   
+                           !     endailyavtypes   ENACT daily average types                    
+   ln_grid_global = .true.
+   ln_grid_search_lookup = .false.
+/ 
+!-----------------------------------------------------------------------
+&nam_asminc   !   assimilation increments                               ('key_asminc')
+!-----------------------------------------------------------------------
+    ln_bkgwri = .false.    !  Logical switch for writing out background state 
+    ln_trjwri = .false.    !  Logical switch for writing out state trajectory
+    ln_trainc = .false.    !  Logical switch for applying tracer increments
+    ln_dyninc = .false.    !  Logical switch for applying velocity increments
+    ln_sshinc = .false.    !  Logical switch for applying SSH increments 
+    ln_asmdin = .false.    !  Logical switch for Direct Initialization (DI)
+    ln_asmiau = .false.    !  Logical switch for Incremental Analysis Updating (IAU)
+    nitbkg    = 0          !  Timestep of background in [0,nitend-nit000-1]
+    nitdin    = 0          !  Timestep of background for DI in [0,nitend-nit000-1]
+    nitiaustr = 1          !  Timestep of start of IAU interval in [0,nitend-nit000-1]
+    nitiaufin = 15         !  Timestep of end of IAU interval in [0,nitend-nit000-1]
+    niaufn    = 0          !  Type of IAU weighting function
+    nittrjfrq = 0          !  Frequency of trajectory output for 4D-VAR
+    ln_salfix = .false.    !  Logical switch for ensuring that the sa > salfixmin
+    salfixmin = -9999      !  Minimum salinity after applying the increments
+    nn_divdmp = 0          !  Number of iterations of divergence damping operator
+/
+!-----------------------------------------------------------------------
+&namsbc_wave   ! External fields from wave model
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_cdg      =  'cdg_wave' ,        1          , 'drag_coeff' , .true.   , .false. , 'daily'  ,''         , ''
+!
+   cn_dir_cdg  = './'  !  root directory for the location of drag coefficient files
+/
+!-----------------------------------------------------------------------
+&namdyn_nept  !   Neptune effect (simplified: lateral and vertical diffusions removed)
+!-----------------------------------------------------------------------
+   ! Suggested lengthscale values are those of Eby & Holloway (1994) for a coarse model
+   ln_neptsimp       = .false.  ! yes/no use simplified neptune
+
+   ln_smooth_neptvel = .false.  ! yes/no smooth zunep, zvnep
+   rn_tslse          =  1.2e4   ! value of lengthscale L at the equator
+   rn_tslsp          =  3.0e3   ! value of lengthscale L at the pole
+   ! Specify whether to ramp down the Neptune velocity in shallow
+   ! water, and if so the depth range controlling such ramping down
+   ln_neptramp       = .false.  ! ramp down Neptune velocity in shallow water
+   rn_htrmin         =  100.0   ! min. depth of transition range
+   rn_htrmax         =  200.0   ! max. depth of transition range
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/namelist_top
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/namelist_top	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/namelist_top	(revision 3680)
@@ -0,0 +1,100 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/TOP1 :  1 - tracer definition                     (namtrc    )
+!! namelists    2 - dynamical tracer trends               (namtrc_trd)
+!!              3 - tracer advection                      (namtrc_adv)
+!!              4 - tracer lateral diffusion              (namtrc_ldf)
+!!              5 - tracer vertical physics               (namtrc_zdf)
+!!              6 - tracer newtonian damping              (namtrc_dmp)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namtrc     !   tracers definition
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   nn_dttrc      =  1        !  time step frequency for passive sn_tracers      
+   nn_writetrc   =  360     !  time step frequency for sn_tracer outputs
+   ln_top_euler  = .true.   !  use Euler timestepping at first step (T) or not (F)
+   ln_rsttr      = .false.   !  start from a restart file (T) or not (F)
+   nn_rsttr      =   0       !  restart control = 0 initial time step is not compared to the restart file value
+                           !                  = 1 do not use the value in the restart file
+                           !                  = 2 calendar parameters read in the restart file
+   cn_trcrst_in  = "restart_trc"   !  suffix of pass. sn_tracer restart name (input)
+   cn_trcrst_out = "restart_trc"   !  suffix of pass. sn_tracer restart name (output)
+   ln_trcdta     =  .false.        !  Initialisation from data input file (T) or not (F)
+!
+!              !    name   !           title of the field              !   units    ! initial data ! save   !
+!              !           !                                           !            ! from file    ! or not ! 
+!              !           !                                           !            ! or not       !        !
+   sn_tracer(1)   = 'DUMMY   ' , 'Dummy tracer      '                 ,  'dummy-units' ,  .false.     ,  .true.
+/
+!-----------------------------------------------------------------------
+&namtrc_adv    !   advection scheme for passive tracer 
+!-----------------------------------------------------------------------
+   ln_trcadv_cen2   =  .false.  !  2nd order centered scheme   
+   ln_trcadv_tvd    =  .true.  !  TVD scheme
+   ln_trcadv_muscl  =  .false.   !  MUSCL scheme
+   ln_trcadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries
+   ln_trcadv_ubs    =  .false.  !  UBS scheme
+   ln_trcadv_qck    =  .false.  !  QUICKEST scheme
+/
+!-----------------------------------------------------------------------
+&namtrc_ldf    !   lateral diffusion scheme for passive tracer 
+!-----------------------------------------------------------------------
+   ln_trcldf_diff   =  .true.   !  performs lateral diffusion (T) or not (F)
+!                               !  Type of the operator : 
+   ln_trcldf_lap    =  .true.   !     laplacian operator       
+   ln_trcldf_bilap  =  .false.  !     bilaplacian operator     
+                                !  Direction of action  :
+   ln_trcldf_level  =  .false.  !     iso-level                
+   ln_trcldf_hor    =  .false.  !     horizontal (geopotential)         (require "key_ldfslp" when ln_sco=T)
+   ln_trcldf_iso    =  .true.   !     iso-neutral                       (require "key_ldfslp")
+!                               !  Coefficient
+   rn_ahtrb_0       =     0.    !     background eddy diffusivity for ldf_iso [m2/s]
+/
+!-----------------------------------------------------------------------
+&namtrc_zdf        !   vertical physics
+!-----------------------------------------------------------------------
+   ln_trczdf_exp   =  .false.  !  split explicit (T) or implicit (F) time stepping
+   nn_trczdf_exp   =   3       !  number of sub-timestep for ln_trczdfexp=T
+/
+!-----------------------------------------------------------------------
+&namtrc_rad        !  treatment of negative concentrations 
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtrc_dmp    !   passive tracer newtonian damping
+!-----------------------------------------------------------------------
+/
+
+!-----------------------------------------------------------------------
+&namtrc_dta
+!-----------------------------------------------------------------------
+!              ! file name                ! frequency (hr) ! variable ! time interp. ! clim    !'yearly' or ! weights  ! rotation
+!              !                          !  (if <0 mon)   !   name   !  (logical)   ! (T/F)   ! 'monthly'  ! filename ! pairing
+   sn_trcdta(1)  = 'data_O2_nomask'       ,        -1      ,  'O2'      ,    .true.  , .true.  , 'yearly'   , ''       , ''
+   sn_trcdta(2)  = 'data_PO4_nomask'      ,        -1      ,  'PO4'     ,    .true.  , .true.  , 'yearly'   , ''       , ''
+   sn_trcdta(3)  = 'data_NO3_nomask'      ,        -1      ,  'NO3'     ,    .true.  , .true.  , 'yearly'   , ''       , ''
+   sn_trcdta(6)  = 'data_Si_nomask'       ,        -1      ,  'Si'      ,    .true.  , .true.  , 'yearly'   , ''       , ''
+   sn_trcdta(43) = 'data_DOC_nomask'      ,        -12     ,  'DOC'     ,    .false. , .true.  , 'yearly'   , ''       , ''
+   sn_trcdta(49) = 'data_DIC_nomask'      ,        -12     ,  'DIC'     ,    .false. , .true.  , 'yearly'   , ''       , ''
+   sn_trcdta(50) = 'data_Alkalini_nomask' ,        -12     ,  'Alkalini',    .false. , .true.  , 'yearly'   , ''       , ''
+   !
+   cn_dir       = './'     !  root directory for the location of the input files
+/
+
+!-----------------------------------------------------------------------
+&namtrc_bc
+!-----------------------------------------------------------------------
+!              ! file name                ! frequency (hr) ! variable ! time interp. ! clim    !'yearly' or ! weights  ! rotation
+!              !                          !  (if <0 mon)   !   name   !  (logical)   ! (T/F)   ! 'monthly'  ! filename ! pairing
+   sn_trcsbc(3)  = 'ndeposition.orca.nc'  ,        -12     ,  ''      ,    .true.  , .true.  , 'yearly'   , ''       , ''
+   !
+   cn_dir       = './'     !  root directory for the location of the boundary condition files
+/
+!-----------------------------------------------------------------------
+&namtrc_trd       !   diagnostics on tracer trends        ('key_trdtrc')
+!                          or mixed-layer trends          ('key_trdmld_trc')
+!----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtrc_dia       !   parameters for passive tracer additional diagnostics
+!----------------------------------------------------------------------
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/runscript
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/runscript	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/runscript	(revision 3680)
@@ -0,0 +1,43 @@
+#! /bin/sh 
+
+#BSUB -a poe
+#BSUB -J GYRE_BFM         # Name of the job.
+#BSUB -o GYRE_BFM_%J.out  # Appends std output to file %J.out.
+#BSUB -e GYRE_BFM_%J.err  # Appends std error to file %J.out.
+#BSUB -P nemo
+#BSUB -q poe_short    # queue
+#BSUB -n 4            # Number of CPUs
+##BSUB -x 
+###BSUB -R "span[ptile=32]"
+
+set -evx
+
+export MP_WAIT_MODE=poll
+export MP_POLLING_INTERVAL=30000000
+export MP_SHARED_MEMORY=yes
+export MP_EUILIB=us
+export MP_EUIDEVICE=sn_all
+export LDR_CNTRL=TEXTPSIZE=64K@STACKPSIZE=64K@DATAPSIZE=64K
+export MP_TASK_AFFINITY=core
+
+EXP="EXP00"
+
+workdir="/data/ans033/EXPERIMENTS/GYRE_BFM/${EXP}"
+execdir=`pwd`
+
+if [ ! -d ${workdir} ] ; then
+  mkdir -p ${workdir}
+fi
+
+cd ${workdir}
+rm -rf *
+# Copy files to exp folder
+cp ${execdir}/opa ./opa.x
+cp ${execdir}/* ./
+
+# Launch the model
+
+time mpirun.lsf opa.x 
+
+echo " ${EXP} DONEEE!!!"
+
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/xmlio_server.def
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/xmlio_server.def	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/EXP00/xmlio_server.def	(revision 3680)
@@ -0,0 +1,35 @@
+! xmlio_server namelist
+!
+! using_server: .TRUE.(.FALSE.) to use(bypass) the io_server
+! using_oasis : .TRUE.(.FALSE.) if nemo is coupled through OASIS
+! client_id   : used only for OASIS, NEMO      id in the namecouple 
+! server_id   : used only for OASIS, io_server id in the namecouple
+!
+&coupling_param
+  using_server = .FALSE.
+  using_oasis  = .FALSE.
+  client_id    = 'nemo.x'
+  server_id    = 'ionemo'
+/
+
+! global_mpi_buffer_size: size in Mo of the MPI buffer used by the io_server
+&mpi_param
+  global_mpi_buffer_size = 512
+/  
+
+!!======================================================================
+!!   namnc4            netcdf4 chunking and compression settings
+!!======================================================================
+!-----------------------------------------------------------------------
+&namnc4         !  netcdf4 chunking and compression settings
+                !  (benign if "key_netcdf4" is not used)
+!-----------------------------------------------------------------------
+   nn_nchunks_i   =   4       !  number of chunks in i-dimension
+   nn_nchunks_j   =   4       !  number of chunks in j-dimension
+   nn_nchunks_k   =   31      !  number of chunks in k-dimension
+                              !  setting nn_nchunks_k = jpk will give a chunk size of 1 in the vertical which
+                              !  is optimal for postprocessing which works exclusively with horizontal slabs
+   ln_nc4zip      =   .TRUE.  !  (T) use netcdf4 chunking and compression
+                              !  (F) ignore chunking information and produce netcdf3-compatible files  
+/
+  
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/README
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/README	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/README	(revision 3680)
@@ -0,0 +1,4 @@
+To compile with the BFM:
+export BFMDIR=path/to/bfm
+cd ..
+./makenemo -n GYRE_BFM -m ARCHFILE -e $BFMDIR/src/nemo -j 8
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/cpp_GYRE_BFM.fcm
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/cpp_GYRE_BFM.fcm	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_BFM/cpp_GYRE_BFM.fcm	(revision 3680)
@@ -0,0 +1,2 @@
+bld::tool::fppkeys  key_gyre key_dynspg_flt key_ldfslp key_zdftke key_vectopt_loop key_top key_my_trc key_mpp_mpi
+inc $BFMDIR/src/nemo/bfm.fcm
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/AA_job
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/AA_job	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/AA_job	(revision 3680)
@@ -0,0 +1,142 @@
+#-Q- sxnec ##################
+#-Q- sxnec ## SXNEC IDRIS
+#-Q- sxnec ##################
+#-Q- sxnec #@$-r :XXX:XXX:XXX:           # job name
+#-Q- sxnec #@$-o output_XXXXXXX.1        # outputfile name
+#-Q- sxnec #@$-me                        # sends a mail at the end of execution
+#-Q- sxnec #@$-eo                        # merge standard error and output
+#-Q- sxnec #@$-jo                        # print a short performance analysis
+#-Q- sxnec #@$-lT 00:30:00                # Max total CPU time
+#-Q- sxnec #@$-lt 00:30:00                # Max CPU time per process
+#-Q- sxnec #@$-lM 500Mb                    # Max memory
+#-Q- sxnec ##@$-c 4                     # Max number of simultaneous procs used (here=4)
+#-Q- sxnec ##@$-q multi                 # Use more than 1 proc
+#-Q- aix ##################
+#-Q- aix ## IBM   IDRIS  ##
+#-Q- aix ##################
+#-Q- aix #@job_name= :XXX:XXX:XXX:          
+#-Q- aix #@output= output_XXXXXXX.1          
+#-Q- aix #@error= error_XXXXXXX.1          
+#-Q- aix #@cpu_limit= 1800
+#-Q- aix #@stack_limit= 200Mb        
+#-Q- aix #@data_limit= 1.8Gb         
+#-Q- aix #@notification= complete
+#-Q- aix #@total_tasks= 1 
+#-Q- aix #@job_type= parallel
+#-Q- aix #@queue
+#-Q- sx8brodie ##################
+#-Q- sx8brodie ## SX8NEC IDRIS ##
+#-Q- sx8brodie ##################
+#-Q- sx8brodie #PBS -N :XXX:XXX:XXX:        # job name
+#-Q- sx8brodie #PBS -o output_XXXXXXX.1     # outputfile name
+#-Q- sx8brodie #PBS -j o                    # merge standard error and output
+#-Q- sx8brodie #PBS -S /usr/bin/ksh         # user shell
+#-Q- sx8brodie #PBS -l memsz_job=3.6gb      # Max memory
+#-Q- sx8brodie #PBS -l cputim_prc=1:01:00   # Max CPU time/prc
+#-Q- sx8brodie #PBS -l cputim_job=1:01:00   # Max CPU time/job
+#-Q- sx8brodie ##PBS -l cpunum_job=4
+#-Q- sx8brodie ##PBS -q multi
+#-Q- sx8mercure ##################
+#-Q- sx8mercure ## SX8NEC   CEA ##
+#-Q- sx8mercure ##################
+#-Q- sx8mercure #PBS -N :XXX:XXX:XXX:        # job name
+#-Q- sx8mercure #PBS -o output_XXXXXXX.1     # outputfile name
+#-Q- sx8mercure #PBS -j o                    # merge standard error and output
+#-Q- sx8mercure #PBS -S /usr/bin/ksh         # user shell
+#-Q- sx8mercure #PBS -l memsz_job=500mb      # Max memory
+#-Q- sx8mercure #PBS -l cputim_job=00:30:00   # Max CPU time
+#-Q- sx8mercure ##PBS -l cpunum_job=4
+########################################################################
+##
+##      Script to run a short experiment when installing the
+##      GYRE configuration 
+##
+##            Rachid Benshila, OPA System Team
+##
+##
+#########################################################################
+##-- print echo of commands before and after shell interpretation
+date
+set -vx
+
+#################################
+# Beginning of user modification
+#################################
+
+##-- define some directories:
+#- Launching run repository
+#-Q- sxnec R_EXPER=${QSUB_WORKDIR:-${PWD}}
+#-Q- sx8brodie R_EXPER=${PBS_O_WORKDIR}
+#-Q- aix R_EXPER=${QSUB_WORKDIR:-${PWD}}
+#-Q- sx8mercure R_EXPER=${PWD}
+#- modipsl repository
+R_EXEDIR=MMMMMMM     
+#- output files storing 
+R_SORTIE_OCE=AAAAAAA/GYRE_PISCES
+#- execution repository
+R_TMP=$TMPDIR         
+
+#################################
+# End of user modification
+#################################
+
+[ -d ${R_TMP} ] || mkdir ${R_TMP}
+cd ${R_TMP}
+
+#--  get the executable
+#-Q- sxnec rcp ${LOGNAME}@rhodes:${R_EXEDIR}/bin/opa opa.xx
+#-Q- sx8brodie rcp ${LOGNAME}@brodie:${R_EXEDIR}/bin/opa opa.xx
+#-Q- aix cp ${R_EXEDIR}/bin/opa opa.xx
+#-Q- sx8mercure cp ${R_EXEDIR}/bin/opa opa.xx
+chmod 777 opa.xx
+
+## --  Copy ancillary files
+#
+#- Namelist for the configuration 
+cp ${R_EXPER}/namelist         namelist
+cp ${R_EXPER}/namelist_top     namelist_top
+cp ${R_EXPER}/namelist_pisces namelist_pisces
+ls -alF
+
+#-Q- sxnec export F_PROGINF=yes
+#-Q- sxnec export F_ERRCNT=5
+#-Q- sx8brodie export F_PROGINF=yes
+#-Q- sx8brodie export F_ERRCNT=5
+#-Q- sx8mercure export F_PROGINF=yes
+#-Q- sx8mercure export F_ERRCNT=5
+
+#-Q- sxnec #- To be use for a mpp run
+#-Q- sxnec #mpirun -np ${NB_PROC} ./opa.xx
+#-Q- sx8brodie #- To be use for a mpp run
+#-Q- sx8brodie #mpirun -np ${NB_PROC} ./opa.xx
+#-Q- sx8mercure #- To be use for a mpp run
+#-Q- sx8mercure #mpirun -np ${NB_PROC} ./opa.xx
+
+./opa.xx
+
+## -- Save output files
+ls -alF
+#- to copy on a storage machine
+#-Q- sxnec DPUT=mfput
+#-Q- sx8brodie DPUT=mfput
+#-Q- aix DPUT=mfput
+#-Q- sx8mercure DPUT=cp 
+#-Q- sx8mercure [ -d ${R_SORTIE_OCE} ] || mkdir -p ${R_SORTIE_OCE}
+
+#- Save ocean output files
+$DPUT ocean.output ${R_SORTIE_OCE}/ocean.output
+$DPUT solver.stat ${R_SORTIE_OCE}/solver.stat
+[ -f mpp.output* ] && $DPUT mpp.output* ${R_SORTIE_OCE}/.
+for file_netcdf in *_grid_*.nc *_diad_T*.nc *_ptrc_T*.nc
+do
+$DPUT $file_netcdf ${R_SORTIE_OCE}/$file_netcdf
+done
+#
+#- Save restart files
+for restart in *restart*
+do
+$DPUT $restart ${R_SORTIE_OCE}/$restart 
+done
+#
+#- Save ftrace file
+[ -f ftrace.out* ] && $DPUT ftrace.out* ${R_SORTIE_OCE}/.
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/iodef.xml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/iodef.xml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/iodef.xml	(revision 3680)
@@ -0,0 +1,445 @@
+<?xml version="1.0"?>
+<simulation>
+  
+  <context id="nemo"> 
+    
+    <!-- $id$ -->
+
+    <!-- 
+============================================================================================================
+=                                  definition of all existing variables                                    =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+    
+    <field_definition level="1" prec="4" operation="ave(X)" enabled=".TRUE."> <!-- time step automaticaly defined -->
+
+      <!-- T grid -->
+      
+      <group id="grid_T" axis_ref="none" grid_ref="grid_T">
+	<field id="toce"         description="temperature"                               unit="degC" axis_ref="deptht"   />
+       	<field id="soce"         description="salinity"                                  unit="psu"  axis_ref="deptht"   />
+	<field id="sst"          description="sea surface temperature"                   unit="degC"                     />
+	<field id="sst2"         description="square of sea surface temperature"         unit="degC2"                    />
+	<field id="sstgrad"      description="module of sst gradient"                    unit="degC/m"                   />
+	<field id="sstgrad2"     description="square of module of sst gradient"          unit="degC2/m2"                 />
+	<field id="sss"          description="sea surface salinity"                      unit="psu"                      />
+	<field id="sss2"         description="square of sea surface salinity"            unit="psu2"                     />
+	<field id="ssh"          description="sea surface height"                        unit="m"                        />
+	<field id="ssh2"         description="square of sea surface height"              unit="m2"                       />
+	<field id="mldkz5"       description="mixing layer depth (Turbocline)"           unit="m"                        />
+	<field id="mldr10_1"     description="Mixed Layer Depth 0.01 ref.10m"            unit="m"                        />
+       	<field id="rhop"         description="potential density (sigma0)"                unit="kg/m3" axis_ref="deptht"  />
+	<!-- next variables available with key_diahth -->
+	<field id="mlddzt"       description="Thermocline Depth (max dT/dz)"             unit="m"                        />
+	<field id="mldr10_3"     description="Mixed Layer Depth dr=0.03 (ref.10m)"       unit="m"                        />
+	<field id="mldr0_1"      description="Mixed Layer Depth dr=0.01 (ref.surf)"      unit="m"                        />
+	<field id="mldr0_3"      description="Mixed Layer Depth dr=0.03 (ref.surf)"      unit="m"                        />
+	<field id="mld_dt02"     description="Mixed Layer Depth |dt|=0.2 (ref.10m)"      unit="m"                        />
+	<field id="topthdep"     description="Top of the thermocline dt=-0.2 (ref.10m)"  unit="m"                        />
+	<field id="pycndep"      description="Pycnocline depth dr~dt=-0.2 (ref.10m)"     unit="m"                        />
+	<field id="BLT"          description="Barrier Layer Thickness"                   unit="m"                        />
+	<field id="tinv"         description="Max of vertical invertion of temperature"  unit="degC"                     />
+	<field id="depti"        description="Depth of max. vert. inv. of temperature"   unit="m"                        />
+        <field id="20d"          description="Depth of 20C isotherm"                     unit="m"                        />
+	<field id="28d"          description="Depth of 28C isotherm"                     unit="m"                        />
+	<field id="hc300"        description="Heat content 300 m"                        unit="W"                        />
+	<!-- variables available with key_diaar5 -->
+	<field id="botpres"      description="Pressure at sea floor"                     unit="dbar"                     />
+	<field id="cellthc"      description="Cell thickness"                            unit="m"     axis_ref="deptht"  />
+     </group>
+
+      <!-- SBC -->
+      
+      <group id="SBC" axis_ref="none" grid_ref="grid_T" > <!-- time step automaticaly defined based on nn_fsbc -->
+
+	<field id="empmr"        description="Net Upward Water Flux"                                        unit="kg/m2/s"  />
+	<field id="empsmr"       description="concentration/dilution water flux"                            unit="kg/m2/s"  />
+	<field id="snowpre"      description="Snow precipitation"                                           unit="kg/m2/s"  />
+	<field id="runoffs"      description="River Runoffs"                                                unit="Kg/m2/s"  />
+
+	<field id="qt"           description="Net Downward Heat Flux"                                       unit="W/m2"     />
+	<field id="qns"          description="non solar Downward Heat Flux"                                 unit="W/m2"     />
+	<field id="qsr"          description="Shortwave Radiation"                                          unit="W/m2"     />
+	<field id="qsr3d"        description="Shortwave Radiation 3D distribution"        axis_ref="deptht" unit="W/m2"     />
+	<field id="qrp"          description="Surface Heat Flux: Damping"                                   unit="W/m2"     />
+	<field id="erp"          description="Surface Water Flux: Damping"                                  unit="Kg/m2/s"  />
+	<field id="taum"         description="wind stress module"                                           unit="N/m2"     />
+	<field id="wspd"         description="Wind speed module at 10 m"                                    unit="m/s"      />
+	
+        <!-- * variable relative to atmospheric pressure forcing : available with ln_apr_dyn -->
+        <field id="ssh_ib"       description="Inverse barometer sea surface height"                         unit="m"        />
+
+	<!-- *_oce variables available with ln_blk_clio or ln_blk_core -->
+	<field id="qns_oce"      description="Non solar Downward Heat Flux over open ocean"                 unit="W/m2"     />
+	<field id="qlw_oce"      description="Longwave Downward Heat Flux over open ocean"                  unit="W/m2"     />
+	<field id="qsb_oce"      description="Sensible Downward Heat Flux over open ocean"                  unit="W/m2"     />
+	<field id="qla_oce"      description="Latent Downward Heat Flux over open ocean"                    unit="W/m2"     />
+	<field id="taum_oce"     description="wind stress module over open ocean"                           unit="N/m2"     />
+
+	<field id="ice_cover"    description="Ice fraction"                                                 unit="1"        />
+
+	<field id="ioceflxb"     description="Oceanic flux at the ice base"                                 unit="W/m2"     />
+	<field id="qsr_ai_cea"   description="Air-Ice downward solar heat flux (cell average)"              unit="W/m2"     />
+	<field id="qns_ai_cea"   description="Air-Ice downward non-solar heat flux (cell average)"          unit="W/m2"     />
+	<field id="qla_ai_cea"   description="Air-Ice downward Latent heat flux (cell average)"             unit="W/m2"     />
+	
+	<field id="qsr_io_cea"   description="Ice-Oce downward solar heat flux (cell average)"              unit="W/m2"     />
+	<field id="qns_io_cea"   description="Ice-Oce downward non-solar heat flux (cell average)"          unit="W/m2"     />
+	
+	<field id="snowthic_cea" description="Snow thickness (cell average)"                                unit="m"        />
+	<field id="icethic_cea"  description="Ice thickness (cell average)"                                 unit="m"        />
+	<field id="iceprod_cea"  description="Ice production (cell average)"                                unit="m/s"      />
+	
+	<field id="ice_pres"     description="Ice presence"                                                 unit="-"        />
+	<field id="ist_cea"      description="Ice surface temperature (cell average)"                       unit="degC"     />
+	<field id="ist_ipa"      description="Ice surface temperature (ice presence average)"               unit="degC"     />      
+	<field id="uice_ipa"     description="Ice velocity along i-axis at I-point (ice presence average)"  unit="m/s"      />      
+	<field id="vice_ipa"     description="Ice velocity along j-axis at I-point (ice presence average)"  unit="m/s"      />      
+	
+	<field id="utau_ice"     description="Wind stress along i-axis over the ice at i-point"             unit="N/m2"     />
+	<field id="vtau_ice"     description="Wind stress along j-axis over the ice at i-point"             unit="N/m2"     />
+	
+	<field id="u_imasstr"    description="Sea-ice mass transport along i-axis"                          unit="kg/s"     />
+	<field id="v_imasstr"    description="Sea-ice mass transport along j-axis"                          unit="kg/s"     />
+
+	<!-- available key_coupled -->
+	<field id="snow_ao_cea"  description="Snow over ice-free ocean (cell average)"                      unit="kg/m2/s"  />
+	<field id="snow_ai_cea"  description="Snow over sea-ice (cell average)"                             unit="kg/m2/s"  />
+	<field id="subl_ai_cea"  description="Sublimation over sea-ice (cell average)"                      unit="kg/m2/s"  />
+	<field id="icealb_cea"   description="Ice albedo (cell average)"                                    unit="1"        />
+	<field id="calving"      description="Calving"                                                      unit="kg/m2/s"  />
+	<!-- available if key_coupled + conservative method -->
+	<field id="rain"         description="Liquid precipitation"                                         unit="Kg/m2/s"  />
+	<field id="evap_ao_cea"  description="Evaporation over ice-free ocean (cell average)"               unit="kg/m2/s"  />
+	<!-- variables available with key_diaar5 -->
+	<field id="isnwmlt_cea"   description="Snow over Ice melting (cell average)"                        unit="kg/m2/s"  />
+	<field id="fsal_virt_cea" description="Virtual salt flux due to ice formation (cell average)"       unit="kg/m2/s"  />
+	<field id="fsal_real_cea" description="Real salt flux due to ice formation (cell average)"          unit="kg/m2/s"  />
+	<field id="hflx_rain_cea" description="heat flux due to rainfall"                                   unit="W/m2"     />
+	<field id="hflx_evap_cea" description="heat flux due to evaporation"                                unit="W/m2"     />
+	<field id="hflx_snow_cea" description="heat flux due to snow falling over ice-free ocean"           unit="W/m2"     />
+	<field id="hflx_ice_cea"  description="heat flux due to ice thermodynamics"                         unit="W/m2"     />
+	<field id="hflx_rnf_cea"  description="heat flux due to runoffs"                                    unit="W/m2"     />
+	<field id="hflx_cal_cea"  description="heat flux due to calving"                                    unit="W/m2"     />
+	<field id="bicemel_cea"  description="Rate of Melt at Sea Ice Base (cell average)"                  unit="kg/m2/s"  />
+	<field id="licepro_cea"  description="Lateral Sea Ice Growth Rate (cell average)"                   unit="kg/m2/s"  />
+	<field id="snowmel_cea"  description="Snow Melt Rate (cell average)"                                unit="kg/m2/s"  />
+	<field id="sntoice_cea"  description="Snow-Ice Formation Rate (cell average)"                       unit="kg/m2/s"  />
+	<field id="ticemel_cea"  description="Rate of Melt at Upper Surface of Sea Ice (cell average)"      unit="kg/m2/s"  />
+
+      </group>
+
+      <!-- U grid -->
+      
+      <group id="grid_U"  axis_ref="depthu" grid_ref="grid_U">
+	<field id="utau"         description="Wind Stress along i-axis"                    unit="N/m2" axis_ref="none" />
+	<field id="uoce"         description="ocean current along i-axis"                  unit="m/s"                  />
+	<field id="uocetr_eff"   description="Effective ocean transport along i-axis"      unit="m3/s"                  />
+	<!-- uoce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="uoce_eiv"     description="EIV ocean current along i-axis"              unit="m/s"                  />
+	<!-- uoce_eiv: available with key_trabbl_adv -->
+	<field id="uoce_bbl"     description="BBL ocean current along i-axis"              unit="m/s"                  />
+	<field id="ahu_bbl"      description="BBL diffusive flux along i-axis"             unit="m3/s" axis_ref="none" />
+ 	<!-- variables available with key_diaar5 -->
+	<field id="u_masstr"     description="ocean eulerian mass transport along i-axis"  unit="kg/s"                 />
+	<field id="u_heattr"     description="ocean eulerian heat transport along i-axis"  unit="W"    axis_ref="none" />
+	<field id="ueiv_heattr"  description="ocean bolus heat transport along i-axis"     unit="W"    axis_ref="none" />
+	<field id="udiff_heattr" description="ocean diffusion heat transport along i-axis" unit="W"    axis_ref="none" />
+     </group>
+      
+      <!-- V grid -->
+      
+      <group id="grid_V"  axis_ref="depthv" grid_ref="grid_V">
+	<field id="vtau"         description="Wind Stress along j-axis"                    unit="N/m2" axis_ref="none" />
+	<field id="voce"         description="ocean current along j-axis"                  unit="m/s"                  />
+	<field id="vocetr_eff"   description="Effective ocean transport along j-axis"      unit="m3/s"                  />
+	<!-- voce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="voce_eiv"     description="EIV ocean current along j-axis"              unit="m/s"                  />
+	<!-- voce_eiv: available with key_trabbl_adv -->
+	<field id="voce_bbl"     description="BBL ocean current along j-axis"              unit="m/s"                  />
+	<field id="ahv_bbl"      description="BBL diffusive flux along j-axis"             unit="m3/s" axis_ref="none" />
+	<!-- variables available with key_diaar5 -->
+	<field id="v_masstr"     description="ocean eulerian mass transport along j-axis"  unit="kg/s"                 />
+	<field id="v_heattr"     description="ocean eulerian heat transport along j-axis"  unit="W"    axis_ref="none" />
+	<field id="veiv_heattr"  description="ocean bolus heat transport along j-axis"     unit="W"    axis_ref="none" />
+	<field id="vdiff_heattr" description="ocean diffusion heat transport along j-axis" unit="W"    axis_ref="none" />
+      </group>
+      
+      <!-- W grid -->
+      
+      <group id="grid_W"  axis_ref="depthw" grid_ref="grid_W">
+	<field id="woce"         description="ocean vertical velocity"                     unit="m/s"                  />
+	<field id="wocetr_eff"   description="effective ocean vertical transport"          unit="m3/s"                 />
+	<!-- woce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="woce_eiv"     description="EIV ocean vertical velocity"                 unit="m/s"                  />
+	<!-- woce_eiv: available with key_trabbl_adv -->
+	<field id="avt"          description="vertical eddy diffusivity"                   unit="m2/s"                 />
+	<field id="avm"          description="vertical eddy viscosity"                     unit="m2/s"                 />
+	<!-- avs: available with key_zdfddm -->
+	<field id="avs"          description="salt vertical eddy diffusivity"              unit="m2/s"                 />
+	<!-- avt_evd and avm_evd: available with ln_zdfevd -->
+	<field id="avt_evd"      description="enhanced vertical diffusivity"               unit="m2/s"                 />
+	<field id="avm_evd"      description="enhanced vertical viscosity"                 unit="m2/s"                 />
+	<!-- aht2d and  aht2d_eiv: available with key_traldf_eiv and key_traldf_c2d -->
+	<field id="aht2d"        description="lateral eddy diffusivity"                    unit="m2/s" axis_ref="none" />
+	<field id="aht2d_eiv"    description="EIV lateral eddy diffusivity"                unit="m2/s" axis_ref="none" />
+	<!-- avt_tide: available with key_zdftmx -->
+	<field id="av_tide"      description="tidal vertical diffusivity"                  unit="m2/s"                 />
+	<!-- variables available with key_diaar5 -->   
+	<field id="w_masstr"     description="vertical mass trasport"                      unit="kg/s"                 />
+	<field id="w_masstr2"    description="square of vertical mass trasport"            unit="kg2/s2"               />
+      </group>
+          
+      <!-- scalar -->
+      
+      <!-- variables available with key_diaar5 -->
+      <group id="scalar" axis_ref="none" grid_ref="scalarpoint" zoom_ref="1point" >
+	<field id="voltot"     description="global mean volume"                         unit="m3"   />
+	<field id="sshtot"     description="global mean ssh"                            unit="m"    />
+	<field id="sshsteric"  description="global mean ssh steric"                     unit="m"    />
+	<field id="sshthster"  description="global mean ssh thermosteric"               unit="m"    />
+	<field id="masstot"    description="global mean mass"                           unit="kg"   />
+	<field id="temptot"    description="global mean temperature"                    unit="degC" />
+	<field id="saltot"     description="global mean salinity"                       unit="psu"  />
+	<field id="fram_trans" description="Sea Ice Mass Transport Through Fram Strait" unit="kg/s" />
+      </group>
+
+      <!-- variables available with key_float -->
+      <group id="floatvar" axis_ref="nfloat" grid_ref="scalarpoint" zoom_ref="1point">
+        <field id="traj_lon"   description="floats longitude"   unit="deg"  operation="inst(X)" />
+        <field id="traj_lat"   description="floats latitude"    unit="deg"   />
+        <field id="traj_dep"   description="floats depth"       unit="m"     />
+        <field id="traj_temp"  description="floats temperature" unit="degC"  />
+        <field id="traj_salt"  description="floats salinity"    unit="psu"   />
+        <field id="traj_dens"  description="floats density"     unit="kg/m3" />
+        <field id="traj_group" description="floats group"       unit="none"  />
+      </group>
+
+
+      <!-- ptrc on T grid -->
+
+     <group id="ptrc_T" axis_ref="deptht" grid_ref="grid_T">
+       <field id="DET"      description="Detritus"                                      unit="mmole-N/m3" />
+       <field id="ZOO"      description="Zooplankton Concentration"                     unit="mmole-N/m3" />
+       <field id="PHY"      description="Phytoplankton Concentration"                   unit="mmole-N/m3" />
+       <field id="NO3"      description="Nitrate Concentration"                         unit="mmole-N/m3" />
+       <field id="NH4"      description="Ammonium Concentration"                        unit="mmole-N/m3" />
+       <field id="DOM"      description="Dissolved Organic Matter"                      unit="mmole-N/m3" />
+     </group>
+
+     <!-- diad on T grid -->
+
+     <group id="diad_T" axis_ref="none" grid_ref="grid_T">  
+       <field id="FNO3PHY"  description="FNO3PHY"                             unit="-"  axis_ref="deptht" /> 
+       <field id="FNH4PHY"  description="FNH4PHY"                             unit="-"  axis_ref="deptht" /> 
+       <field id="FNH4NO3"  description="FNH4NO3"                             unit="-"  axis_ref="deptht" /> 
+       <field id="TNO3PHY"  description="TNO3PHY"                             unit="-"  /> 
+       <field id="TNH4PHY"  description="TNH4PHY"                             unit="-"  /> 
+       <field id="TPHYDOM"  description="TPHYDOM"                             unit="-"  /> 
+       <field id="TPHYNH4"  description="TPHYNH4"                             unit="-"  /> 
+       <field id="TPHYZOO"  description="TPHYZOO"                             unit="-"  /> 
+       <field id="TPHYDET"  description="TPHYDET"                             unit="-"  /> 
+       <field id="TDETZOO"  description="TDETZOO"                             unit="-"  /> 
+       <field id="TDETSED"  description="TDETSED"                             unit="-"  /> 
+       <field id="TZOODET"  description="TZOODET"                             unit="-"  /> 
+       <field id="TZOOBOD"  description="TZOOBOD"                             unit="-"  /> 
+       <field id="TZOONH4"  description="TZOONH4"                             unit="-"  /> 
+       <field id="TZOODOM"  description="TZOODOM"                             unit="-"  /> 
+       <field id="TNH4NO3"  description="TNH4NO3"                             unit="-"  /> 
+       <field id="TDOMNH4"  description="TDOMNH4"                             unit="-"  /> 
+       <field id="TDETNH4"  description="TDETNH4"                             unit="-"  /> 
+       <field id="TPHYTOT"  description="TPHYTOT"                             unit="-"  /> 
+       <field id="TZOOTOT"  description="TZOOTOT"                             unit="-"  /> 
+       <field id="TDETDOM"  description="TDETDOM"                             unit="-"  /> 
+       <field id="SEDPOC"   description="SEDPOC"                              unit="-"  /> 
+     </group>
+
+  </field_definition>
+
+    <!-- 
+============================================================================================================
+=                                           output files definition                                        =
+=                                            Define your own files                                         =
+=                                         put the variables you want...                                    =
+============================================================================================================
+    -->
+
+  <file_definition output_level="10" enabled=".TRUE.">
+
+
+      <group id="1h" output_freq="3600"   output_level="10" enabled=".TRUE.">                      <!-- 1h files -->
+      </group>
+
+      <group id="2h" output_freq="7200"   output_level="10" enabled=".TRUE.">                      <!-- 2h files -->
+      </group>
+
+      <group id="3h" output_freq="10800"  output_level="10" enabled=".TRUE.">                      <!-- 3h files -->
+      </group>
+
+      <group id="4h" output_freq="14400"  output_level="10" enabled=".TRUE.">                      <!-- 4h files -->
+      </group>
+
+      <group id="6h" output_freq="21600"  output_level="10" enabled=".TRUE.">                      <!-- 6h files -->
+      </group>
+
+      <group id="1d" output_freq="86400"  output_level="10" enabled=".TRUE.">                      <!-- 1d files -->
+      </group>
+
+      <group id="2d" output_freq="172800" output_level="10" enabled=".TRUE.">                      <!-- 2d files -->
+      </group>
+
+      <group id="5d" output_freq="432000" output_level="10" enabled=".TRUE.">                      <!-- 5d files -->
+
+        <file id="5d_grid_T" name="auto" description="ocean T grid variables" >
+          <field ref="toce"         name="votemper"  />
+          <field ref="soce"         name="vosaline"  />
+          <field ref="sst"          name="sosstsst"  />
+          <field ref="sss"          name="sosaline"  />
+          <field ref="ssh"          name="sossheig"  />
+          <field ref="empmr"        name="sowaflup"  />
+          <field ref="qsr"          name="soshfldo"  />
+          <field ref="empsmr"       name="sowaflcd"  />
+          <field ref="qt"           name="sohefldo"  />
+          <field ref="mldr10_1"     name="somxl010"  />
+          <field ref="mldkz5"       name="somixhgt"  />
+          <field ref="wspd"         name="sowindsp"  />
+          <field ref="qrp"          name="sohefldp"  />
+          <field ref="erp"          name="sowafldp"  />
+          <field ref="mldr10_1"     name="sobowlin"  operation="t_max(X)" />
+          <field ref="mlddzt"       name="sothedep"  />
+          <field ref="20d"          name="so20chgt"  />
+          <field ref="28d"          name="so28chgt"  />
+          <field ref="hc300"        name="sohtc300"  />
+        </file>
+
+        <file id="5d_grid_U" name="auto" description="ocean U grid variables" >
+          <field ref="uoce"         name="vozocrtx"  />
+          <field ref="uoce_eiv"     name="vozoeivu"  />
+          <field ref="utau"         name="sozotaux"  />
+        </file>
+
+        <file id="5d_grid_V" name="auto" description="ocean V grid variables" >
+          <field ref="voce"         name="vomecrty"  />
+          <field ref="voce_eiv"     name="vomeeivv"  />
+          <field ref="vtau"         name="sometauy"  />
+        </file>
+
+        <file id="5d_grid_W" name="auto" description="ocean W grid variables" >
+          <field ref="woce"         name="vovecrtz" />
+          <field ref="woce_eiv"     name="voveeivw" />
+          <field ref="avt"          name="votkeavt" />
+          <field ref="avt_evd"      name="votkeevd" />
+          <field ref="avm"          name="votkeavm" />
+          <field ref="avm_evd"      name="votkeevm" />
+          <field ref="avs"          name="voddmavs" />
+          <field ref="aht2d"        name="soleahtw" />
+          <field ref="aht2d_eiv"    name="soleaeiw" />
+        </file>
+ 
+       <!-- variables available with key_float, instantaneous fields -->
+        <file id="floats"  description="floats variables">
+            <field ref="traj_lon"   name="floats_longitude"   freq_op="432000" />
+            <field ref="traj_lat"   name="floats_latitude"    freq_op="432000" />
+            <field ref="traj_dep"   name="floats_depth"       freq_op="432000" />
+            <field ref="traj_temp"  name="floats_temperature" freq_op="432000" />
+            <field ref="traj_salt"  name="floats_salinity"    freq_op="432000" />
+            <field ref="traj_dens"  name="floats_density"     freq_op="432000" />
+            <field ref="traj_group" name="floats_group"       freq_op="432000" />
+        </file>
+
+       <file id="5d_ptrc_T" name="auto" description="lobster sms variables" >
+         <field ref="DET"      />
+         <field ref="ZOO"      />
+         <field ref="PHY"      />
+         <field ref="NO3"      />
+         <field ref="NH4"      />
+         <field ref="DOM"      />
+       </file>
+
+       <file id="5d_diad_T" name="auto" description="additional lobster diagnostics" >  
+         <field ref="FNO3PHY"   /> 
+         <field ref="FNH4PHY"   /> 
+         <field ref="FNH4NO3"   /> 
+         <field ref="TNO3PHY"   /> 
+         <field ref="TNH4PHY"   /> 
+         <field ref="TPHYDOM"   /> 
+         <field ref="TPHYNH4"   /> 
+         <field ref="TPHYZOO"   /> 
+         <field ref="TPHYDET"   /> 
+         <field ref="TDETZOO"   /> 
+         <field ref="TDETSED"   /> 
+         <field ref="TZOODET"   /> 
+         <field ref="TZOOBOD"   /> 
+         <field ref="TZOONH4"   /> 
+         <field ref="TZOODOM"   /> 
+         <field ref="TNH4NO3"   /> 
+         <field ref="TDOMNH4"   /> 
+         <field ref="TDETNH4"   /> 
+         <field ref="TPHYTOT"   /> 
+         <field ref="TZOOTOT"   /> 
+         <field ref="TDETDOM"   /> 
+         <field ref="SEDPOC"    /> 
+       </file>
+
+      </group>
+
+      <group id="1m" output_freq="-1"     output_level="10" enabled=".TRUE.">                      <!-- real monthly files -->
+      </group>
+
+      <group id="2m" output_freq="-2"     output_level="10" enabled=".TRUE.">                      <!-- real 2m files -->
+      </group>
+
+      <group id="3m" output_freq="-3"     output_level="10" enabled=".TRUE.">                      <!-- real 3m files -->
+      </group>
+
+      <group id="4m" output_freq="-4"     output_level="10" enabled=".TRUE.">                      <!-- real 4m files -->
+      </group>
+
+      <group id="6m" output_freq="-6"     output_level="10" enabled=".TRUE.">                      <!-- real 6m files -->
+      </group>
+
+      <group id="1y" output_freq="-12"    output_level="10" enabled=".TRUE.">                      <!-- real yearly files -->
+      </group>
+
+      <group id="2y"  output_freq="-24"   output_level="10" enabled=".TRUE.">                      <!-- real 2y files -->
+      </group>
+
+      <group id="5y"  output_freq="-60"   output_level="10" enabled=".TRUE.">                      <!-- real 5y files -->
+      </group>
+
+      <group id="10y" output_freq="-120"  output_level="10" enabled=".TRUE.">                      <!-- real 10y files -->
+      </group>
+
+ 
+  </file_definition>
+
+    <!-- 
+============================================================================================================
+=                                           grid definition                                                =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+
+  <axis_definition>  
+     <axis id="deptht" description="Vertical T levels" unit="m" positive=".false." />
+     <axis id="depthu" description="Vertical U levels" unit="m" positive=".false." />
+     <axis id="depthv" description="Vertical V levels" unit="m" positive=".false." />
+     <axis id="depthw" description="Vertical W levels" unit="m" positive=".false." />
+     <axis id="nfloat" description="Number of float"   unit="no unit" positive=".false." />
+     <axis id="none" description="axe non defini" unit="none" size="1" />
+  </axis_definition> 
+
+  <grid_definition>
+    <grid id="grid_T" description="grid T" />
+    <grid id="grid_U" description="grid U" />
+    <grid id="grid_V" description="grid V" />
+    <grid id="grid_W" description="grid W" />
+    <grid id="scalarpoint" description="scalar" >
+      <zoom id="1point" ibegin="1" jbegin="1" ni="1" nj="1" />
+    </grid>
+  </grid_definition>    
+
+</context>
+
+</simulation>
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist	(revision 3680)
@@ -0,0 +1,1 @@
+link ../../GYRE/EXP00/namelist
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist_pisces
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist_pisces	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist_pisces	(revision 3680)
@@ -0,0 +1,149 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! LOBSTER :    1  - biological parameters for phytoplankton    (namlobphy)
+!! namelists    2  - biological parameters for nutrients        (namlobnut)
+!!              3  - biological parameters for zooplankton      (namlobzoo)    
+!!              4  - biological parameters for detritus         (namlobdet)
+!!              5  - biological parameters for DOM              (namlobdom)
+!!              6  - parameters from aphotic layers to sediment (namlobsed)
+!!              7  - general coefficients                       (namlobrat)
+!!              8  - optical parameters                         (namlobopt)
+!!              9  - additional 2D/3D  diagnostics              (namlobdia)
+!!              10 - biological diagnostics trends              (namlobdbi) 
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namlobphy     !   biological parameters for phytoplankton
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   apmin   =  0.        ! fixed phytoplancton concentration            [mmol/m3]
+   tmumax  =  1.21e-5   ! maximal phytoplankton growth rate            [s-1] 
+   rgamma  =  0.05      ! phytoplankton exudation fraction             [%]
+   fphylab =  0.75      ! NH4 fraction of phytoplankton exsudation     
+   tmmaxp  =  0.0       ! maximal phytoplancton mortality rate         [s-1] 
+   tmminp  =  5.8e-7    ! minimal phytoplancton mortality rate         [0.05/86400 s-1=20 days] 
+   rcchl   =  60.       ! Carbone/Chlorophyl ratio                     [mgC.mgChla-1]
+   aki     =  33.       ! light photosynthesis half saturation constant[W/m2]
+   toptp   =  0.        ! optimal photosynthesis temperature
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namlobnut     !   biological parameters for nutrients
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   anmin   =  0.        ! minimum nutrients concentration              [mmol/m3]
+   akno3   =  0.7       ! nitrate limitation half-saturation value     [mmol/m3]
+   aknh4   =  0.001     ! ammonium limitation half-saturation value    [mmol/m3]
+   taunn   =  5.80e-7   ! nitrification rate                           [s-1]  
+   psinut  =  3.        ! inhibition of nitrate uptake by ammonium
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namlobzoo     !   biological parameters for zooplankton
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   azmin   = 0.         ! minimum zooplancton concentration                      [mmol/m3]
+   eggzoo  = 0.0        ! minimum for zooplankton concentration, egg effect      [mmolN.m-3]
+   rgz     = 0.         ! ivlev coeff for zoo mortality
+   rppz    = 0.8        ! zooplankton nominal preference for phytoplancton food  [%]
+   taus    = 9.26E-6    ! specific zooplankton maximal grazing rate              [s-1] 
+!                       ! 0.75/86400 s-1=8.680555E-6    1/86400 = 1.15e-5
+   aks     = 1.         ! half-saturation constant for total zooplankton grazing [mmolN.m-3]
+   rpnaz   = 0.3        ! non-assimilated phytoplankton by zooplancton           [%]
+   rdnaz   = 0.3        ! non-assimilated detritus by zooplankton                [%] 
+   tauzn   = 8.1e-7     ! zooplancton specific excretion rate                    [0.1/86400 s-1=10 days] 
+   fzoolab = 0.5        ! NH4 fraction of zooplankton excretion
+   fdbod   = 0.5        ! zooplankton mortality fraction that goes to detritus
+   tmmaxz  = 0.         ! maximal zooplankton mortality rate
+   tmminz  = 2.31e-6    ! minimal zooplankton mortality rate                     [(mmolN/m3)-1 d-1]
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namlobdet     !   biological parameters for detritus
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   admin   = 0.         ! minimum detritus concentration                 [mmol/m3]
+   taudn   = 5.80e-7    ! detritus breakdown rate                        [0.1/86400 s-1=10 days]
+   fdetlab = 0.         ! NH4 fraction of detritus dissolution           
+   vsed    = 3.47e-5    ! detritus sedimentation speed                   [m/s]
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namlobdom     !   biological parameters for DOM
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   taudomn = 6.43e-8    ! DOM breakdown rate                             [s-1] 
+!                       ! slow remineralization rate of semi-labile dom to nh4 (1 month)
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namlobsed     !   parameters from aphotic layers to sediment
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   sedlam     = 3.86e-7 ! time coefficient of POC remineralization in sediments [s-1]
+   sedlostpoc = 0.      ! mass of POC lost in sediments
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namlobrat     !   general coefficients
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   redf    = 6.56       ! redfield ratio (C:N) for phyto
+   reddom  = 6.56       ! redfield ratio (C:N) for DOM
+   slopet  = 0.         ! van t Hoff "coefficient"
+   tmaxr   = 0.         ! maximal damping coeff under euphotic layer
+   tminr   = 5.80e-7    ! minimal damping coeff under euphotic layer
+   xhr     = -0.858     ! coeff for martin''s remineralisation profile
+   filmax  = 0.         ! ????
+   toptgz  = 0.         ! ???? 
+   tmaxgz  = 0.         ! ???? 
+   anumin  = 0.         ! ???? 
+   afdmin  = 0.         ! ???? 
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namlobopt     !   optical parameters
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   xkg0   = 0.0232     ! green absorption coefficient of water
+   xkr0   = 0.225      ! red absorption coefficent of water
+   xkgp   = 0.074      ! green absorption coefficient of chl
+   xkrp   = 0.037      ! red absorption coefficient of chl
+   xlg    = 0.674      ! green chl exposant for absorption
+   xlr    = 0.629      ! red chl exposant for absorption
+   rpig   = 0.7        ! chla/chla+pheo ratio
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namlobdia     !   additional 2D/3D tracers diagnostics
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!              !    name   ! title of   ! units !
+!              !           ! the field  !       !  
+   lobdia2d(1)   = 'TNO3PHY' , 'TNO3PHY',  '-'
+   lobdia2d(2)   = 'TNH4PHY' , 'TNH4PHY',  '-'
+   lobdia2d(3)   = 'TPHYDOM' , 'TPHYDOM',  '-'
+   lobdia2d(4)   = 'TPHYNH4' , 'TPHYNH4',  '-'
+   lobdia2d(5)   = 'TPHYZOO' , 'TPHYZOO',  '-'
+   lobdia2d(6)   = 'TPHYDET' , 'TPHYDET',  '-'
+   lobdia2d(7)   = 'TDETZOO' , 'TDETZOO',  '-'
+   lobdia2d(8)   = 'TDETSED' , 'TDETSED',  '-'
+   lobdia2d(9)   = 'TZOODET' , 'TZOODET',  '-'
+   lobdia2d(10)  = 'TZOOBOD' , 'TZOOBOD',  '-'
+   lobdia2d(11)  = 'TZOONH4' , 'TZOONH4',  '-'
+   lobdia2d(12)  = 'TZOODOM' , 'TZOODOM',  '-'
+   lobdia2d(13)  = 'TNH4NO3' , 'TNH4NO3',  '-'
+   lobdia2d(14)  = 'TDOMNH4' , 'TDOMNH4',  '-'
+   lobdia2d(15)  = 'TDETNH4' , 'TDETNH4',  '-'
+   lobdia2d(16)  = 'TPHYTOT' , 'TPHYTOT',  '-'
+   lobdia2d(17)  = 'TZOOTOT' , 'TZOOTOT',  '-'
+   lobdia2d(18)  = 'TDETDOM' , 'TDETDOM',  '-'
+   lobdia2d(19)  = 'SEDPOC ' , 'SEDPOC ',  '-'
+   lobdia3d(1)   = 'FNO3PHY' , 'FNO3PHY',  '-'
+   lobdia3d(2)   = 'FNH4PHY' , 'FNH4PHY',  '-'
+   lobdia3d(3)   = 'FNH4NO3' , 'FNH4NO3',  '-'
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namlobdbi     !   biological diagnostics trends     
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!                !  2D bio diagnostics   units : mmole/m2/s   ("key_trdmld_trc")
+!                !  name    !       title of the field      !     units      !
+   lobdiabio(1)  = 'NO3PHY' , 'Flux from NO3 to PHY          ',  'mmole/m3/s'
+   lobdiabio(2)  = 'NH4PHY' , 'Flux from NH4 to PHY          ',  'mmole/m3/s'
+   lobdiabio(3)  = 'PHYNH4' , 'Flux from PHY to NH4          ',  'mmole/m3/s'
+   lobdiabio(4)  = 'PHYDOM' , 'Flux from PHY to DOM          ',  'mmole/m3/s'
+   lobdiabio(5)  = 'PHYZOO' , 'Flux from PHY to ZOO          ',  'mmole/m3/s'
+   lobdiabio(6)  = 'PHYDET' , 'Flux from PHY to DET          ',  'mmole/m3/s'
+   lobdiabio(7)  = 'DETZOO' , 'Flux from DET to ZOO          ',  'mmole/m3/s'
+   lobdiabio(8)  = 'DETSED' , 'Flux from DET to SED          ',  'mmole/m3/s'
+   lobdiabio(9)  = 'ZOODET' , 'Flux from ZOO to DET          ',  'mmole/m3/s'
+   lobdiabio(10)  = 'ZOOBOD' , 'Zooplankton closure          ',  'mmole/m3/s'
+   lobdiabio(11)  = 'ZOONH4' , 'Flux from ZOO to NH4         ',  'mmole/m3/s'
+   lobdiabio(12)  = 'ZOODOM' , 'Flux from ZOO to DOM         ',  'mmole/m3/s'
+   lobdiabio(13)  = 'NH4NO3' , 'Flux from NH4 to NO3         ',  'mmole/m3/s'
+   lobdiabio(14)  = 'DOMNH4' , 'Flux from DOM to NH4         ',  'mmole/m3/s'
+   lobdiabio(15)  = 'DETNH4' , 'Flux from DET to NH4         ',  'mmole/m3/s'
+   lobdiabio(16)  = 'DETDOM' , 'Flux from DET to DOM         ',  'mmole/m3/s'
+   lobdiabio(17)  = 'SEDNO3' , 'NO3 remineralization from SED',  'mmole/m3/s'
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist_top
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist_top	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist_top	(revision 3680)
@@ -0,0 +1,112 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/TOP2 namelits :  1 - tracer definition                     (namtrc    )
+!!                       2 - tracer advection                      (namtrc_adv)
+!!                       3 - tracer lateral diffusion              (namtrc_ldf)
+!!                       4 - tracer vertical physics               (namtrc_zdf)
+!!                       5 - tracer newtonian damping              (namtrc_dmp)
+!!                       6 - dynamical tracer trends               (namtrc_trd)
+!!                       7 - tracer output                         (namtrc_wri)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namtrc     !   tracers definition
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!
+   nn_dttrc      =  1        !  time step frequency for passive sn_tracers
+   nn_writetrc   =  60      !  time step frequency for sn_tracer outputs
+   ln_rsttr      = .false.   !  start from a restart file (T) or not (F)
+   nn_rsttr      =   1       !  restart control = 0 initial time step is not compared to the restart file value
+                           !                  = 1 do not use the value in the restart file
+                           !                  = 2 calendar parameters read in the restart file
+   cn_trcrst_in  = "restart_trc.nc"   !  suffix of pass. sn_tracer restart name (input)
+   cn_trcrst_out = "restart_trc"   !  suffix of pass. sn_tracer restart name (output)
+   ln_trcdta     =   .false.    !  Initialisation from data input file (T) or not (F)
+!
+!                ! name  !     title of the field          !   units       ! initial data ! save   !
+!                !       !                                 !               ! from file    ! or not ! 
+!                !       !                                 !               ! or not       !        !
+   sn_tracer(1)   = 'DET'   , 'Detritus                   ',  'mmole-N/m3' ,  .false.     ,  .false.
+   sn_tracer(2)   = 'ZOO'   , 'Zooplankton concentration  ',  'mmole-N/m3' ,  .false.     ,  .false.
+   sn_tracer(3)   = 'PHY'   , 'Phytoplankton concentration',  'mmole-N/m3' ,  .false.     ,  .false.
+   sn_tracer(4)   = 'NO3'   , 'Nitrate concentration      ',  'mmole-N/m3' ,  .false.     ,  .true.
+   sn_tracer(5)   = 'NH4'   , 'Ammonium concentration     ',  'mmole-N/m3' ,  .false.     ,  .false.
+   sn_tracer(6)   = 'DOM'   , 'Dissolved organic matter   ',  'mmole-N/m3' ,  .false.     ,  .false.
+/
+!-----------------------------------------------------------------------
+&namtrc_dta      !    Initialisation from data input file (T) or not (F)
+!-----------------------------------------------------------------------
+!
+!                !  file name  ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!                !             !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_trcdta(4)  = 'NO3_R1'    ,        -12        ,  'NO3'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+
+   cn_dir        =     './'    !  root directory for the location of the runoff files
+   rn_trfac(4)   =    1.0      !   -       -       -       -      -
+/
+!-----------------------------------------------------------------------
+&namtrc_adv    !   advection scheme for passive tracer 
+!-----------------------------------------------------------------------
+   ln_trcadv_cen2   =  .false.  !  2nd order centered scheme   
+   ln_trcadv_tvd    =  .true.   !  TVD scheme
+   ln_trcadv_muscl  =  .false.  !  MUSCL scheme
+   ln_trcadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries
+   ln_trcadv_ubs    =  .false.  !  UBS scheme
+   ln_trcadv_qck    =  .false.  !  QUICKEST scheme
+/
+!-----------------------------------------------------------------------
+&namtrc_ldf    !   lateral diffusion scheme for passive tracer 
+!-----------------------------------------------------------------------
+   ln_trcldf_diff   =  .true.   !  performs lateral diffusion (T) or not (F)
+!                               !  Type of the operator : 
+   ln_trcldf_lap    =  .true.   !     laplacian operator       
+   ln_trcldf_bilap  =  .false.  !     bilaplacian operator     
+                                !  Direction of action  :
+   ln_trcldf_level  =  .false.  !     iso-level                
+   ln_trcldf_hor    =  .false.  !     horizontal (geopotential)         (require "key_ldfslp" when ln_sco=T)
+   ln_trcldf_iso    =  .true.   !     iso-neutral                       (require "key_ldfslp")
+!                               !  Coefficient
+   rn_ahtrc_0       =  1000.    !  horizontal eddy diffusivity for tracers [m2/s]
+   rn_ahtrb_0       =     0.    !     background eddy diffusivity for ldf_iso [m2/s]
+/
+!-----------------------------------------------------------------------
+&namtrc_zdf        !   vertical physics
+!-----------------------------------------------------------------------
+   ln_trczdf_exp   =  .false.  !  split explicit (T) or implicit (F) time stepping
+   nn_trczdf_exp   =   3       !  number of sub-timestep for ln_trczdfexp=T
+/
+!-----------------------------------------------------------------------
+&namtrc_rad        !  treatment of negative concentrations 
+!-----------------------------------------------------------------------
+   ln_trcrad   =  .false.  !  artificially correct negative concentrations (T) or not (F)
+/
+!-----------------------------------------------------------------------
+&namtrc_dmp    !   passive tracer newtonian damping  
+!-----------------------------------------------------------------------
+   ln_trcdmp   =  .false.  !  add a damping termn (T) or not (F)
+   nn_hdmp_tr  =   -1      !  horizontal shape =-1, damping in Med and Red Seas only
+                           !                   =XX, damping poleward of XX degrees (XX>0)
+                           !                      + F(distance-to-coast) + Red and Med Seas
+   nn_zdmp_tr  =    1      !  vertical   shape =0    damping throughout the water column
+                           !                   =1 no damping in the mixing layer (kz  criteria)
+                           !                   =2 no damping in the mixed  layer (rho crieria)
+   rn_surf_tr  =   50.     !  surface time scale of damping   [days]
+   rn_bot_tr   =  360.     !  bottom  time scale of damping   [days]
+   rn_dep_tr   =  800.     !  depth of transition between rn_surf and rn_bot [meters]
+   nn_file_tr  =    0      !  create a damping.coeff NetCDF file (=1) or not (=0)
+/
+!-----------------------------------------------------------------------
+&namtrc_trd                !   diagnostics on tracer trends        ('key_trdtrc')
+!                                   or mixed-layer trends          ('key_trdmld_trc')
+!----------------------------------------------------------------------
+   nn_trd_trc  =  5475      !  time step frequency and tracers trends
+   nn_ctls_trc =   0        !  control surface type in mixed-layer trends (0,1 or n<jpk)
+   rn_ucf_trc  =   1        !  unit conversion factor (=1 -> /seconds ; =86400. -> /day)
+   ln_trdmld_trc_restart = .false.  !  restart for ML diagnostics
+   ln_trdmld_trc_instant = .true.  !  flag to diagnose trends of instantantaneous or mean ML T/S
+   ln_trdtrc(1)  =   .true.
+/
+!-----------------------------------------------------------------------
+&namtrc_dia       !   parameters for passive tracer additional diagnostics
+!----------------------------------------------------------------------
+   ln_diatrc     =  .true.   !  save additional diag. (T) or not (F)
+   nn_writedia   =  60     !  time step frequency for diagnostics
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/xmlio_server.def
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/xmlio_server.def	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/xmlio_server.def	(revision 3680)
@@ -0,0 +1,35 @@
+! xmlio_server namelist
+!
+! using_server: .TRUE.(.FALSE.) to use(bypass) the io_server
+! using_oasis : .TRUE.(.FALSE.) if nemo is coupled through OASIS
+! client_id   : used only for OASIS, NEMO      id in the namecouple 
+! server_id   : used only for OASIS, io_server id in the namecouple
+!
+&coupling_param
+  using_server = .FALSE.
+  using_oasis  = .FALSE.
+  client_id    = 'nemo.x'
+  server_id    = 'ionemo'
+/
+
+! global_mpi_buffer_size: size in Mo of the MPI buffer used by the io_server
+&mpi_param
+  global_mpi_buffer_size = 512
+/  
+
+!!======================================================================
+!!   namnc4            netcdf4 chunking and compression settings
+!!======================================================================
+!-----------------------------------------------------------------------
+&namnc4         !  netcdf4 chunking and compression settings
+                !  (benign if "key_netcdf4" is not used)
+!-----------------------------------------------------------------------
+   nn_nchunks_i   =   4       !  number of chunks in i-dimension
+   nn_nchunks_j   =   4       !  number of chunks in j-dimension
+   nn_nchunks_k   =   31      !  number of chunks in k-dimension
+                              !  setting nn_nchunks_k = jpk will give a chunk size of 1 in the vertical which
+                              !  is optimal for postprocessing which works exclusively with horizontal slabs
+   ln_nc4zip      =   .TRUE.  !  (T) use netcdf4 chunking and compression
+                              !  (F) ignore chunking information and produce netcdf3-compatible files  
+/
+  
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/cpp_GYRE_PISCES.fcm
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/cpp_GYRE_PISCES.fcm	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/GYRE_PISCES/cpp_GYRE_PISCES.fcm	(revision 3680)
@@ -0,0 +1,1 @@
+bld::tool::fppkeys  key_gyre key_dynspg_flt key_ldfslp key_zdftke key_top key_pisces_reduced key_iomput 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/1_namelist
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/1_namelist	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/1_namelist	(revision 3680)
@@ -66,12 +66,25 @@
 &namzgr_sco    !   s-coordinate or hybrid z-s-coordinate
 !-----------------------------------------------------------------------
-   rn_sbot_min =  300.     !  minimum depth of s-bottom surface (>0) (m)
-   rn_sbot_max = 5250.     !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
-   rn_theta    =    6.0    !  surface control parameter (0<=rn_theta<=20)
-   rn_thetb    =    0.75   !  bottom control parameter  (0<=rn_thetb<= 1)
-   rn_rmax     =    0.15   !  maximum cut-off r-value allowed (0<rn_max<1)
-   ln_s_sigma  = .false.   !  hybrid s-sigma coordinates
-   rn_bb       =    0.8    !  stretching with s-sigma
-   rn_hc       =  150.0    !  critical depth with s-sigma 
+   ln_s_sh94   = .true.    !  Song & Haidvogel 1994 hybrid S-sigma   (T)|
+   ln_s_sf12   = .false.   !  Siddorn & Furner 2012 hybrid S-z-sigma (T)| if both are false the NEMO tanh stretching is applied
+   ln_sigcrit  = .false.   !  use sigma coordinates below critical depth (T) or Z coordinates (F) for Siddorn & Furner stretch
+                           !  stretching coefficients for all functions
+   rn_sbot_min =   10.0    !  minimum depth of s-bottom surface (>0) (m)
+   rn_sbot_max = 7000.0    !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
+   rn_hc       =  150.0    !  critical depth for transition to stretched coordinates
+                        !!!!!!!  Envelop bathymetry
+   rn_rmax     =    0.3    !  maximum cut-off r-value allowed (0<r_max<1)
+                        !!!!!!!  SH94 stretching coefficients  (ln_s_sh94 = .true.)
+   rn_theta    =    6.0    !  surface control parameter (0<=theta<=20)
+   rn_bb       =    0.8    !  stretching with SH94 s-sigma   
+                        !!!!!!!  SF12 stretching coefficient  (ln_s_sf12 = .true.)
+   rn_alpha    =    4.4    !  stretching with SF12 s-sigma
+   rn_efold    =    0.0    !  efold length scale for transition to stretched coord
+   rn_zs       =    1.0    !  depth of surface grid box
+                           !  bottom cell depth (Zb) is a linear function of water depth Zb = H*a + b
+   rn_zb_a     =    0.024  !  bathymetry scaling factor for calculating Zb
+   rn_zb_b     =   -0.2    !  offset for calculating Zb
+                        !!!!!!!! Other stretching (not SH94 or SF12) [also uses rn_theta above]
+   rn_thetb    =    1.0    !  bottom control parameter  (0<=thetb<= 1) 
 /
 !-----------------------------------------------------------------------
@@ -525,4 +538,5 @@
    ln_traadv_ubs    =  .false.  !  UBS scheme                 
    ln_traadv_qck    =  .false.  !  QUCIKEST scheme                 
+   ln_traadv_msc_ups=  .false.  !  use upstream scheme within muscl
 /
 !-----------------------------------------------------------------------
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/namelist
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/namelist	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/namelist	(revision 3680)
@@ -65,12 +65,25 @@
 &namzgr_sco    !   s-coordinate or hybrid z-s-coordinate
 !-----------------------------------------------------------------------
-   rn_sbot_min =  300.     !  minimum depth of s-bottom surface (>0) (m)
-   rn_sbot_max = 5250.     !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
-   rn_theta    =    6.0    !  surface control parameter (0<=rn_theta<=20)
-   rn_thetb    =    0.75   !  bottom control parameter  (0<=rn_thetb<= 1)
-   rn_rmax     =    0.15   !  maximum cut-off r-value allowed (0<rn_max<1)
-   ln_s_sigma  = .false.   !  hybrid s-sigma coordinates
-   rn_bb       =    0.8    !  stretching with s-sigma
-   rn_hc       =  150.0    !  critical depth with s-sigma 
+   ln_s_sh94   = .true.    !  Song & Haidvogel 1994 hybrid S-sigma   (T)|
+   ln_s_sf12   = .false.   !  Siddorn & Furner 2012 hybrid S-z-sigma (T)| if both are false the NEMO tanh stretching is applied
+   ln_sigcrit  = .false.   !  use sigma coordinates below critical depth (T) or Z coordinates (F) for Siddorn & Furner stretch
+                           !  stretching coefficients for all functions
+   rn_sbot_min =   10.0    !  minimum depth of s-bottom surface (>0) (m)
+   rn_sbot_max = 7000.0    !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
+   rn_hc       =  150.0    !  critical depth for transition to stretched coordinates
+                        !!!!!!!  Envelop bathymetry
+   rn_rmax     =    0.3    !  maximum cut-off r-value allowed (0<r_max<1)
+                        !!!!!!!  SH94 stretching coefficients  (ln_s_sh94 = .true.)
+   rn_theta    =    6.0    !  surface control parameter (0<=theta<=20)
+   rn_bb       =    0.8    !  stretching with SH94 s-sigma   
+                        !!!!!!!  SF12 stretching coefficient  (ln_s_sf12 = .true.)
+   rn_alpha    =    4.4    !  stretching with SF12 s-sigma
+   rn_efold    =    0.0    !  efold length scale for transition to stretched coord
+   rn_zs       =    1.0    !  depth of surface grid box
+                           !  bottom cell depth (Zb) is a linear function of water depth Zb = H*a + b
+   rn_zb_a     =    0.024  !  bathymetry scaling factor for calculating Zb
+   rn_zb_b     =   -0.2    !  offset for calculating Zb
+                        !!!!!!!! Other stretching (not SH94 or SF12) [also uses rn_theta above]
+   rn_thetb    =    1.0    !  bottom control parameter  (0<=thetb<= 1) 
 /
 !-----------------------------------------------------------------------
@@ -147,5 +160,7 @@
                            !     =2 annual global mean of e-p-r set to zero
                            !     =3 global emp set to zero and spread out over erp area
+   ln_wave = .false.       !  Activate coupling with wave (either Stokes Drift or Drag coefficient, or both)  (T => fill namsbc_wave)
    ln_cdgw = .false.       !  Neutral drag coefficient read from wave model (T => fill namsbc_wave)
+   ln_sdw  = .false.       !  Computation of 3D stokes drift                (T => fill namsbc_wave)
 /
 !-----------------------------------------------------------------------
@@ -563,4 +578,5 @@
    ln_traadv_ubs    =  .false.  !  UBS scheme                 
    ln_traadv_qck    =  .false.  !  QUICKEST scheme                 
+   ln_traadv_msc_ups=  .false.  !  use upstream scheme within muscl
 /
 !----------------------------------------------------------------------------------
@@ -823,5 +839,5 @@
    nn_bench    =    0      !  Bench mode (1/0): CAUTION use zero except for bench
                            !     (no physical validity of the results)
-   nn_timing   =    1      !  timing by routine activated (=1) creates timing.output file, or not (=0)
+   nn_timing   =    0      !  timing by routine activated (=1) creates timing.output file, or not (=0)
 /
 
@@ -1004,4 +1020,7 @@
 !              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
    sn_cdg      =  'cdg_wave' ,        1          , 'drag_coeff' , .true.   , .false. , 'daily'  ,''         , ''
+   sn_usd      =  'sdw_wave' ,        1          , 'u_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''
+   sn_vsd      =  'sdw_wave' ,        1          , 'v_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''
+   sn_wn       =  'sdw_wave' ,        1          , 'wave_num'   , .true.   , .false. , 'daily'  ,''         , ''
 !
    cn_dir_cdg  = './'  !  root directory for the location of drag coefficient files
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_atmc14.dat
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_atmc14.dat	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_atmc14.dat	(revision 3680)
@@ -0,0 +1,245 @@
+ Year    South 30S-30N   North 
+ 1765.5       0        0      0
+ 1766.5       0        0      0
+ 1767.5       0        0      0
+ 1768.5       0        0      0
+ 1769.5       0        0      0
+ 1770.5       0        0      0
+ 1771.5       0        0      0
+ 1772.5       0        0      0
+ 1773.5       0        0      0
+ 1774.5       0        0      0
+ 1775.5       0        0      0
+ 1776.5       0        0      0
+ 1777.5       0        0      0
+ 1778.5       0        0      0
+ 1779.5       0        0      0
+ 1780.5       0        0      0
+ 1781.5       0        0      0
+ 1782.5       0        0      0
+ 1783.5       0        0      0
+ 1784.5       0        0      0
+ 1785.5       0        0      0
+ 1786.5       0        0      0
+ 1787.5       0        0      0
+ 1788.5       0        0      0
+ 1789.5       0        0      0
+ 1790.5       0        0      0
+ 1791.5       0        0      0
+ 1792.5       0        0      0
+ 1793.5       0        0      0
+ 1794.5       0        0      0
+ 1795.5       0        0      0
+ 1796.5       0        0      0
+ 1797.5       0        0      0
+ 1798.5       0        0      0
+ 1799.5       0        0      0
+ 1800.5       0        0      0
+ 1801.5       0        0      0
+ 1802.5       0        0      0
+ 1803.5       0        0      0
+ 1804.5       0        0      0
+ 1805.5       0        0      0
+ 1806.5       0        0      0
+ 1807.5       0        0      0
+ 1808.5       0        0      0
+ 1809.5       0        0      0
+ 1810.5       0        0      0
+ 1811.5       0        0      0
+ 1812.5       0        0      0
+ 1813.5       0        0      0
+ 1814.5       0        0      0
+ 1815.5       0        0      0
+ 1816.5       0        0      0
+ 1817.5       0        0      0
+ 1818.5       0        0      0
+ 1819.5       0        0      0
+ 1820.5       0        0      0
+ 1821.5       0        0      0
+ 1822.5       0        0      0
+ 1823.5       0        0      0
+ 1824.5       0        0      0
+ 1825.5       0        0      0
+ 1826.5       0        0      0
+ 1827.5       0        0      0
+ 1828.5       0        0      0
+ 1829.5       0        0      0
+ 1830.5       0        0      0
+ 1831.5       0        0      0
+ 1832.5       0        0      0
+ 1833.5       0        0      0
+ 1834.5       0        0      0
+ 1835.5       0        0      0
+ 1836.5       0        0      0
+ 1837.5       0        0      0
+ 1838.5       0        0      0
+ 1839.5       0        0      0
+ 1840.5    -0.9     -0.9   -0.9
+ 1841.5      -1       -1     -1
+ 1842.5    -1.2     -1.2   -1.2
+ 1843.5    -1.3     -1.3   -1.3
+ 1844.5    -1.5     -1.5   -1.5
+ 1845.5    -1.6     -1.6   -1.6
+ 1846.5    -1.7     -1.7   -1.7
+ 1847.5    -1.9     -1.9   -1.9
+ 1848.5      -2       -2     -2
+ 1849.5    -2.2     -2.2   -2.2
+ 1850.5    -2.3     -2.3   -2.3
+ 1851.5    -2.5     -2.5   -2.5
+ 1852.5    -2.6     -2.6   -2.6
+ 1853.5    -2.8     -2.8   -2.8
+ 1854.5      -3       -3     -3
+ 1855.5    -3.1     -3.1   -3.1
+ 1856.5    -3.3     -3.3   -3.3
+ 1857.5    -3.6     -3.6   -3.6
+ 1858.5    -3.8     -3.8   -3.8
+ 1859.5      -4       -4     -4
+ 1860.5    -4.2     -4.2   -4.2
+ 1861.5    -4.5     -4.5   -4.5
+ 1862.5    -4.7     -4.7   -4.7
+ 1863.5    -4.9     -4.9   -4.9
+ 1864.5    -5.2     -5.2   -5.2
+ 1865.5    -5.4     -5.4   -5.4
+ 1866.5    -5.4     -5.4   -5.4
+ 1867.5    -5.4     -5.4   -5.4
+ 1868.5    -5.4     -5.4   -5.4
+ 1869.5    -5.4     -5.4   -5.4
+ 1870.5    -5.4     -5.4   -5.4
+ 1871.5    -5.3     -5.3   -5.3
+ 1872.5    -5.3     -5.3   -5.3
+ 1873.5    -5.3     -5.3   -5.3
+ 1874.5    -5.3     -5.3   -5.3
+ 1875.5    -5.3     -5.3   -5.3
+ 1876.5    -5.3     -5.3   -5.3
+ 1877.5    -5.3     -5.3   -5.3
+ 1878.5    -5.2     -5.2   -5.2
+ 1879.5    -5.2     -5.2   -5.2
+ 1880.5    -5.2     -5.2   -5.2
+ 1881.5    -5.2     -5.2   -5.2
+ 1882.5    -5.2     -5.2   -5.2
+ 1883.5    -5.1     -5.1   -5.1
+ 1884.5    -5.1     -5.1   -5.1
+ 1885.5    -5.1     -5.1   -5.1
+ 1886.5    -4.9     -4.9   -4.9
+ 1887.5    -4.8     -4.8   -4.8
+ 1888.5    -4.6     -4.6   -4.6
+ 1889.5    -4.5     -4.5   -4.5
+ 1890.5      -7     -4.5     -2
+ 1891.5      -7     -4.5     -2
+ 1892.5      -7     -4.5     -2
+ 1893.5      -7     -4.5     -2
+ 1894.5      -7     -4.5     -2
+ 1895.5      -7     -4.5     -2
+ 1896.5    -7.3     -4.8   -2.3
+ 1897.5    -7.7     -5.2   -2.7
+ 1898.5      -8     -5.5     -3
+ 1899.5    -8.3     -5.8   -3.3
+ 1900.5    -8.7     -6.2   -3.7
+ 1901.5      -9     -6.5     -4
+ 1902.5    -9.3     -6.8   -4.3
+ 1903.5    -9.7     -7.2   -4.7
+ 1904.5     -10     -7.5     -5
+ 1905.5   -10.3     -7.8   -5.3
+ 1906.5   -10.7     -8.2   -5.7
+ 1907.5     -11     -8.5     -6
+ 1908.5   -11.3     -8.8   -6.3
+ 1909.5   -11.7     -9.2   -6.7
+ 1910.5     -12     -9.5     -7
+ 1911.5   -12.3     -9.8   -7.3
+ 1912.5   -12.7    -10.2   -7.7
+ 1913.5     -13    -10.5     -8
+ 1914.5   -13.3    -10.8   -8.3
+ 1915.5   -13.7    -11.2   -8.7
+ 1916.5     -14    -11.5     -9
+ 1917.5   -14.3    -11.8   -9.3
+ 1918.5   -14.7    -12.2   -9.7
+ 1919.5     -15    -12.5    -10
+ 1920.5   -15.3    -12.8  -10.3
+ 1921.5   -15.7    -13.2  -10.7
+ 1922.5     -16    -13.5    -11
+ 1923.5   -16.3    -13.8  -11.3
+ 1924.5   -16.7    -14.2  -11.7
+ 1925.5     -17    -14.5    -12
+ 1926.5   -17.3    -14.8  -12.3
+ 1927.5   -17.7    -15.2  -12.7
+ 1928.5     -18    -15.5    -13
+ 1929.5   -18.3    -15.8  -13.3
+ 1930.5   -18.7    -16.2  -13.7
+ 1931.5     -19    -16.5    -14
+ 1932.5   -19.3    -16.8  -14.3
+ 1933.5   -19.7    -17.2  -14.7
+ 1934.5     -20    -17.5    -15
+ 1935.5   -20.3    -17.8  -15.3
+ 1936.5   -20.7    -18.2  -15.7
+ 1937.5     -21    -18.5    -16
+ 1938.5   -21.3    -18.8  -16.3
+ 1939.5   -21.7    -19.2  -16.7
+ 1940.5   -22.2    -21.5  -20.2
+ 1941.5   -21.4    -20.8  -19.4
+ 1942.5   -21.6      -21  -19.6
+ 1943.5   -24.5    -23.9  -22.5
+ 1944.5   -23.7      -23  -21.7
+ 1945.5   -24.1    -23.4  -22.1
+ 1946.5   -23.6    -22.8  -21.6
+ 1947.5   -23.1    -22.2  -21.1
+ 1948.5   -24.3    -23.4  -22.3
+ 1949.5   -26.6    -25.9  -24.6
+ 1950.5   -26.8    -26.1  -24.8
+ 1951.5   -26.8      -26  -24.8
+ 1952.5   -26.9    -25.7  -24.9
+ 1953.5   -25.9    -23.5  -23.9
+ 1954.5   -23.8    -14.4  -21.1
+ 1955.5     -11     -6.4   -8.2
+ 1956.5    14.7     23.4   26.5
+ 1957.5    35.8     51.9     73
+ 1958.5    81.8    105.7  140.2
+ 1959.5   141.1    176.8    228
+ 1960.5   185.6    200.3  212.3
+ 1961.5   198.7    205.8  221.6
+ 1962.5   215.9    256.2  358.5
+ 1963.5   330.6    474.3  718.3
+ 1964.5   520.6    672.3  835.7
+ 1965.5   637.3    697.5  756.3
+ 1966.5   619.7    658.5  691.9
+ 1967.5   585.6    605.4  623.6
+ 1968.5   549.7    559.6  564.5
+ 1969.5   528.5    537.1  545.4
+ 1970.5     506    519.1  529.1
+ 1971.5     489    495.4  499.4
+ 1972.5   461.6    466.6  465.6
+ 1973.5   430.9    426.1  418.6
+ 1974.5   394.9    400.7  400.8
+ 1975.5   378.2    378.7  369.8
+ 1976.5   349.8    354.4  352.5
+ 1977.5   326.7      330  333.9
+ 1978.5   310.2    320.6  325.8
+ 1979.5     291    296.1  295.8
+ 1980.5   274.8      272  264.5
+ 1981.5   257.5    254.8  256.7
+ 1982.5   241.1    241.1  238.3
+ 1983.5   221.5      225  224.2
+ 1984.5   206.7    209.7  209.3
+ 1985.5   197.1      204  201.1
+ 1986.5   187.4    193.9  191.1
+ 1987.5   175.5    186.5  183.6
+ 1988.5   171.6    177.6  174.7
+ 1989.5   157.3    166.6  163.7
+ 1990.5   148.3    155.1  152.2
+ 1991.5   141.2    145.3  142.4
+ 1992.5   132.2    137.6  136.3
+ 1993.5   127.2    131.8  128.7
+ 1994.5   120.4    125.5  122.1
+ 1995.5   114.9      120  115.8
+ 1996.5   110.3    109.6  109.8
+ 1997.5   105.2    109.7    104
+ 1998.5   100.2    103.2  100.3
+ 1999.5    92.7     98.6   95.7
+ 2000.5    86.5     92.6   89.7
+ 2001.5    80.7     87.6   84.8
+ 2002.5    72.9     80.4   77.5
+ 2003.5    79.5     77.4   73.5
+ 2004.5    77.7       75   70.6
+ 2005.5    75.7       73     67
+ 2006.5      75       72     66
+ 2007.5      74       71     65
+ 2008.5      73       70     64
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_cfc1112.atm
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_cfc1112.atm	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_cfc1112.atm	(revision 3680)
@@ -0,0 +1,84 @@
+ % Atmospheric lifetimes are  44.0 for CFC-11 
+ %                       and 125.0 for CFC-12 
+ % rel=  0 
+ %        <-Northern Data-> <-Southern Data->
+ % Year    CFC-11  CFC-12    CFC-11  CFC-12 
+ %         (ppt)   (ppt)      (ppt)   (ppt)
+ 1931.50    0.00    0.00       0.00    0.00   
+ 1932.50    0.00    0.01       0.00    0.01   
+ 1933.50    0.00    0.02       0.00    0.01   
+ 1934.50    0.00    0.03       0.00    0.02   
+ 1935.50    0.00    0.04       0.00    0.03   
+ 1936.50    0.00    0.07       0.00    0.04   
+ 1937.50    0.00    0.11       0.00    0.07   
+ 1938.50    0.00    0.17       0.00    0.11   
+ 1939.50    0.01    0.25       0.00    0.17   
+ 1940.50    0.01    0.37       0.01    0.25   
+ 1941.50    0.02    0.53       0.01    0.36   
+ 1942.50    0.02    0.72       0.02    0.51   
+ 1943.50    0.03    0.94       0.02    0.69   
+ 1944.50    0.04    1.25       0.03    0.91   
+ 1945.50    0.05    1.65       0.04    1.21   
+ 1946.50    0.08    2.33       0.05    1.64   
+ 1947.50    0.14    3.42       0.08    2.33   
+ 1948.50    0.24    4.73       0.14    3.32   
+ 1949.50    0.42    6.10       0.25    4.48   
+ 1950.50    0.67    7.58       0.42    5.77   
+ 1951.50    1.02    9.23       0.66    7.19   
+ 1952.50    1.53   10.94       1.01    8.72   
+ 1953.50    2.21   12.82       1.49   10.37   
+ 1954.50    3.07   14.97       2.13   12.20   
+ 1955.50    4.11   17.40       2.93   14.25   
+ 1956.50    5.39   20.22       3.92   16.59   
+ 1957.50    6.84   23.45       5.11   19.28   
+ 1958.50    8.19   26.86       6.39   22.28   
+ 1959.50    9.47   30.58       7.63   25.52   
+ 1960.50   11.13   35.03       8.96   29.18   
+ 1961.50   13.38   40.12      10.63   33.42   
+ 1962.50   16.23   45.89      12.78   38.25   
+ 1963.50   19.72   52.66      15.47   43.80   
+ 1964.50   23.87   60.57      18.75   50.28   
+ 1965.50   28.57   69.53      22.61   57.76   
+ 1966.50   33.78   79.46      26.99   66.21   
+ 1967.50   39.63   90.60      31.91   75.67   
+ 1968.50   46.27  103.16      37.46   86.31   
+ 1969.50   53.96  117.17      43.80   98.25   
+ 1970.50   62.75  132.52      51.07  111.52   
+ 1971.50   72.36  149.00      59.27  126.02   
+ 1972.50   83.04  166.85      68.34  141.70   
+ 1973.50   95.27  186.59      78.54  158.82   
+ 1974.50  108.81  208.14      90.04  177.62   
+ 1975.50  121.86  229.37     102.29  197.54   
+ 1976.50  134.47  249.51     114.40  217.31   
+ 1977.50  146.47  268.67     126.28  236.49   
+ 1978.50  157.18  286.35     137.45  254.72   
+ 1979.50  166.67  303.74     147.60  272.00   
+ 1980.50  175.11  320.96     158.08  290.34   
+ 1981.50  182.81  337.33     166.54  306.90   
+ 1982.50  189.88  352.01     174.69  323.74   
+ 1983.50  197.72  367.69     183.03  341.15   
+ 1984.50  206.34  383.86     190.95  357.80   
+ 1985.50  216.12  401.25     200.50  376.45   
+ 1986.50  227.48  420.96     209.82  394.00   
+ 1987.50  239.67  441.49     220.60  412.82   
+ 1988.50  251.05  463.22     231.46  433.46   
+ 1989.50  257.28  481.80     240.38  452.97   
+ 1990.50  263.65  493.96     249.23  470.55   
+ 1991.50  266.33  504.64     254.53  484.07   
+ 1992.50  266.00  512.87     258.80  495.65   
+ 1993.50  267.58  520.12     260.56  504.49   
+ 1994.50  267.24  526.58     261.73  512.31   
+ 1995.50  266.38  531.59     261.29  518.39   
+ 1996.50  265.25  534.81     261.08  523.50   
+ 1997.50  263.84  537.67     260.16  528.18   
+ 1998.50  262.24  999.99     258.96  999.99   
+ 1999.50  260.72  999.99     257.75  999.99   
+ 2000.50  259.34  999.99     255.69  999.99   
+ 2001.50  257.13  999.99     253.54  999.99   
+ 2002.50  254.89  999.99     252.93  999.99   
+ 2003.50  251.89  999.99     250.62  999.99   
+ 2004.50  250.67  999.99     249.52  999.99   
+ 2005.50  249.49  999.99     247.45  999.99   
+ 2006.50  248.31  999.99     245.38  999.99
+ 2007.50  247.13  999.99     243.31  999.99
+ 2008.50  245.95  999.99     241.24  999.99
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_namelist
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_namelist	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_namelist	(revision 3680)
@@ -0,0 +1,922 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/OPA  :  1 - run manager      (namrun)
+!! namelists    2 - Domain           (namzgr, namzgr_sco, namdom, namdta_tem, namdta_sal)
+!!              3 - Surface boundary (namsbc, namsbc_ana, namsbc_flx, namsbc_clio, namsbc_core
+!!                                    namsbc_cpl, namtra_qsr, namsbc_rnf, 
+!!                                    namsbc_apr, namsbc_ssr, namsbc_alb)
+!!              4 - lateral boundary (namlbc, namcla, namobc, namagrif, nambdy, nambdy_tide)
+!!              5 - bottom  boundary (nambfr, nambbc, nambbl)
+!!              6 - Tracer           (nameos, namtra_adv, namtra_ldf, namtra_dmp)
+!!              7 - dynamics         (namdyn_adv, namdyn_vor, namdyn_hpg, namdyn_spg, namdyn_ldf)
+!!              8 - Verical physics  (namzdf, namzdf_ric, namzdf_tke, namzdf_kpp, namzdf_ddm, namzdf_tmx)
+!!              9 - diagnostics      (namnc4, namtrd, namspr, namflo, namptr, namhsb)
+!!             10 - miscellaneous    (namsol, nammpp, nammpp_dyndist, namctl)
+!!             11 - Obs & Assim      (namobs, nam_asminc)
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+!!======================================================================
+!!                   ***  Run management namelists  ***
+!!======================================================================
+!!   namrun        parameters of the run
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namrun        !   parameters of the run
+!-----------------------------------------------------------------------
+   nn_no       =       0   !  job number (no more used...)
+   cn_exp      = "Agulhas" !  experience name 
+   nn_it000    =       1   !  first time step
+   nn_itend    =   10950   !  last  time step
+   nn_date0    = 19600101   !  date at nit_0000 (format yyyymmdd) used if ln_rstart=F or (ln_rstart=T and nn_rstctl=0 or 1)
+   nn_leapy    =       0   !  Leap year calendar (1) or not (0)
+   ln_rstart   = .false.   !  start from rest (F) or from a restart file (T)
+   nn_rstctl   =       0   !  restart control => activated only if ln_rstart = T
+                           !    = 0 nn_date0 read in namelist ; nn_it000 : read in namelist
+                           !    = 1 nn_date0 read in namelist ; nn_it000 : check consistancy between namelist and restart
+                           !    = 2 nn_date0 read in restart  ; nn_it000 : check consistancy between namelist and restart
+   cn_ocerst_in  = "restart"   !  suffix of ocean restart name (input)
+   cn_ocerst_out = "restart"   !  suffix of ocean restart name (output)
+   nn_istate   =       0   !  output the initial state (1) or not (0)
+   nn_stock    =   10950   !  frequency of creation of a restart file (modulo referenced to 1)
+   nn_write    =   10950   !  frequency of write in the output file   (modulo referenced to nn_it000)
+   ln_dimgnnn  = .false.   !  DIMG file format: 1 file for all processors (F) or by processor (T)
+   ln_mskland  = .false.   !  mask land points in NetCDF outputs (costly: + ~15%)
+   ln_clobber  = .false.   !  clobber (overwrite) an existing file
+   nn_chunksz  =       0   !  chunksize (bytes) for NetCDF file (works only with iom_nf90 routines)
+/
+
+!!======================================================================
+!!                      ***  Domain namelists  ***
+!!======================================================================
+!!   namzgr       vertical coordinate
+!!   namzgr_sco   s-coordinate or hybrid z-s-coordinate
+!!   namdom       space and time domain (bathymetry, mesh, timestep)
+!!   namdta_tem   data: temperature                                     ("key_dtatem")
+!!   namdta_sal   data: salinity                                        ("key_dtasal")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namzgr        !   vertical coordinate
+!-----------------------------------------------------------------------
+   ln_zco      = .false.   !  z-coordinate - full    steps   (T/F)      ("key_zco" may also be defined)
+   ln_zps      = .true.    !  z-coordinate - partial steps   (T/F)
+   ln_sco      = .false.   !  s- or hybrid z-s-coordinate    (T/F)
+/
+!-----------------------------------------------------------------------
+&namzgr_sco    !   s-coordinate or hybrid z-s-coordinate
+!-----------------------------------------------------------------------
+   rn_sbot_min =  300.     !  minimum depth of s-bottom surface (>0) (m)
+   rn_sbot_max = 5250.     !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
+   rn_theta    =    6.0    !  surface control parameter (0<=rn_theta<=20)
+   rn_thetb    =    0.75   !  bottom control parameter  (0<=rn_thetb<= 1)
+   rn_rmax     =    0.15   !  maximum cut-off r-value allowed (0<rn_max<1)
+   ln_s_sigma  = .false.   !  hybrid s-sigma coordinates
+   rn_bb       =    0.8    !  stretching with s-sigma
+   rn_hc       =  150.0    !  critical depth with s-sigma 
+/
+!-----------------------------------------------------------------------
+&namdom        !   space and time domain (bathymetry, mesh, timestep)
+!-----------------------------------------------------------------------
+   nn_bathy    =    1      !  compute (=0) or read (=1) the bathymetry file
+   nn_closea    =   0      !  remove (=0) or keep (=1) closed seas and lakes (ORCA)
+   nn_msh      =    0      !  create (=1) a mesh file or not (=0)
+   rn_hmin     =   -3.     !  min depth of the ocean (>0) or min number of ocean level (<0)
+   rn_e3zps_min=   20.     !  partial step thickness is set larger than the minimum of
+   rn_e3zps_rat=    0.1    !  rn_e3zps_min and rn_e3zps_rat*e3t, with 0<rn_e3zps_rat<1
+                           !
+   rn_rdt      = 2880.     !  time step for the dynamics (and tracer if nn_acc=0)
+   nn_baro     =   64      !  number of barotropic time step            ("key_dynspg_ts")
+   rn_atfp     =    0.1    !  asselin time filter parameter
+   nn_acc      =    0      !  acceleration of convergence : =1      used, rdt < rdttra(k)
+                                 !                          =0, not used, rdt = rdttra
+   rn_rdtmin   = 14400.          !  minimum time step on tracers (used if nn_acc=1)
+   rn_rdtmax   = 14400.          !  maximum time step on tracers (used if nn_acc=1)
+   rn_rdth     =  800.           !  depth variation of tracer time step  (used if nn_acc=1)
+/
+!-----------------------------------------------------------------------
+&namtsd    !   data : Temperature  & Salinity
+!-----------------------------------------------------------------------
+!          ! file name ! frequency (hours)    ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation !
+!          !           !  (if <0  months)     !   name   !  (logical)   ! (T/F) ! 'monthly'  ! filename ! pairing  !
+   sn_tem  = 'data_1m_potential_temperature_nomask', -1,'votemper',  .true.  , .true., 'yearly'   , ' '      , ' '
+   sn_sal  = 'data_1m_salinity_nomask'             , -1,'vosaline',  .true.  , .true., 'yearly'   , ''       , ' '
+/
+!!======================================================================
+!!            ***  Surface Boundary Condition namelists  ***
+!!======================================================================
+!!   namsbc          surface boundary condition
+!!   namsbc_ana      analytical         formulation
+!!   namsbc_flx      flux               formulation
+!!   namsbc_clio     CLIO bulk formulea formulation
+!!   namsbc_core     CORE bulk formulea formulation
+!!   namsbc_cpl      CouPLed            formulation                     ("key_coupled")
+!!   namtra_qsr      penetrative solar radiation
+!!   namsbc_rnf      river runoffs
+!!   namsbc_apr      Atmospheric Pressure
+!!   namsbc_ssr      sea surface restoring term (for T and/or S)
+!!   namsbc_alb      albedo parameters
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namsbc        !   Surface Boundary Condition (surface module)
+!-----------------------------------------------------------------------
+   nn_fsbc     = 5         !  frequency of surface boundary condition computation 
+                           !     (also = the frequency of sea-ice model call)
+   ln_ana      = .false.   !  analytical formulation                    (T => fill namsbc_ana ) 
+   ln_flx      = .false.   !  flux formulation                          (T => fill namsbc_flx )
+   ln_blk_clio = .false.   !  CLIO bulk formulation                     (T => fill namsbc_clio) 
+   ln_blk_core = .true.    !  CORE bulk formulation                     (T => fill namsbc_core) 
+   ln_cpl      = .false.   !  Coupled formulation                       (T => fill namsbc_cpl )
+   ln_apr_dyn  = .false.   !  Patm gradient added in ocean & ice Eqs.   (T => fill namsbc_apr )
+   nn_ice      = 0         !  =0 no ice boundary condition   ,
+                           !  =1 use observed ice-cover      ,
+                           !  =2 ice-model used                         ("key_lim3" or "key_lim2)
+   ln_dm2dc    = .false.   !  daily mean to diurnal cycle on short wave
+   ln_rnf      = .false.   !  runoffs                                   (T => fill namsbc_rnf)
+   ln_ssr      = .false.   !  Sea Surface Restoring on T and/or S       (T => fill namsbc_ssr)
+   nn_fwb      = 0         !  FreshWater Budget: =0 unchecked 
+                           !     =1 global mean of e-p-r set to zero at each time step 
+                           !     =2 annual global mean of e-p-r set to zero
+                           !     =3 global emp set to zero and spread out over erp area
+/
+!-----------------------------------------------------------------------
+&namsbc_ana    !   analytical surface boundary condition
+!-----------------------------------------------------------------------
+   nn_tau000   =   0       !  gently increase the stress over the first ntau_rst time-steps
+   rn_utau0    =   0.5     !  uniform value for the i-stress
+   rn_vtau0    =   0.e0    !  uniform value for the j-stress
+   rn_qns0     =   0.e0    !  uniform value for the total heat flux
+   rn_qsr0     =   0.e0    !  uniform value for the solar radiation
+   rn_emp0     =   0.e0    !  uniform value for the freswater budget (E-P)
+/
+!-----------------------------------------------------------------------
+&namsbc_flx    !   surface boundary condition : flux formulation
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_utau     = 'utau'      ,        24         , 'utau'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_vtau     = 'vtau'      ,        24         , 'vtau'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_qtot     = 'qtot'      ,        24         , 'qtot'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_qsr      = 'qsr'       ,        24         , 'qsr'     , .false.      , .false., 'yearly'  , ''       , ''
+   sn_emp      = 'emp'       ,        24         , 'emp'     , .false.      , .false., 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the flux files
+/      
+!-----------------------------------------------------------------------
+&namsbc_clio   !   namsbc_clio  CLIO bulk formulea
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_utau     = 'taux_1m'   ,       -1          , 'sozotaux',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_vtau     = 'tauy_1m'   ,       -1          , 'sometauy',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_wndm     = 'flx'       ,       -1          , 'socliowi',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_tair     = 'flx'       ,       -1          , 'socliot2',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_humi     = 'flx'       ,       -1          , 'socliohu',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_ccov     = 'flx'       ,       -1          , 'socliocl',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_prec     = 'flx'       ,       -1          , 'socliopl',   .false.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files are
+/
+!-----------------------------------------------------------------------
+&namsbc_core   !   namsbc_core  CORE bulk formulea
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_wndi = 'u_10.15JUNE2009_orca2'       ,  6  , 'U_10_MOD',   .false.    , .true. , 'yearly'  , 'weights_bicub.nc'       , ''
+   sn_wndj = 'v_10.15JUNE2009_orca2'       ,  6  , 'V_10_MOD',   .false.    , .true. , 'yearly'  , 'weights_bicub.nc'       , ''
+   sn_qsr  = 'ncar_rad.15JUNE2009_orca2'   , 24  , 'SWDN_MOD',   .false.    , .true. , 'yearly'  , 'weights_bilin.nc'       , ''
+   sn_qlw  = 'ncar_rad.15JUNE2009_orca2'   , 24  , 'LWDN_MOD',   .false.    , .true. , 'yearly'  , 'weights_bilin.nc'       , ''
+   sn_tair = 't_10.15JUNE2009_orca2'       ,  6  , 'T_10_MOD',   .false.    , .true. , 'yearly'  , 'weights_bilin.nc'       , ''
+   sn_humi = 'q_10.15JUNE2009_orca2'       ,  6  , 'Q_10_MOD',   .false.    , .true. , 'yearly'  , 'weights_bilin.nc'       , ''
+   sn_prec = 'ncar_precip.15JUNE2009_orca2', -1  , 'PRC_MOD1',   .false.    , .true. , 'yearly'  , 'weights_bilin.nc'       , ''
+   sn_snow = 'ncar_precip.15JUNE2009_orca2', -1  , 'SNOW'    ,   .false.    , .true. , 'yearly'  , 'weights_bilin.nc'       , ''
+   sn_tdif = 'taudif_core'                 , 24  , 'taudif'  ,   .false.    , .true. , 'yearly'  , 'weights_bilin.nc'       , ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files
+   ln_2m       = .false.   !  air temperature and humidity referenced at 2m (T) instead 10m (F)
+   ln_taudif   = .false.   !  HF tau contribution: use "mean of stress module - module of the mean stress" data
+   rn_pfac     = 1.        !  multiplicative factor for precipitation (total & snow)
+/
+!-----------------------------------------------------------------------
+&namsbc_cpl    !   coupled ocean/atmosphere model                       ("key_coupled")
+!-----------------------------------------------------------------------
+!                    !     description       !  multiple  !    vector   !      vector          ! vector !
+!                    !                       ! categories !  reference  !    orientation       ! grids  !
+! send
+sn_snd_temp   =       'weighted oce and ice' ,    'no'    ,     ''      ,         ''           ,   ''    
+sn_snd_alb    =       'weighted ice'         ,    'no'    ,     ''      ,         ''           ,   ''    
+sn_snd_thick  =       'none'                 ,    'no'   ,     ''      ,         ''           ,   ''    
+sn_snd_crt    =       'none'                 ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'       
+sn_snd_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''           ,   ''        
+! receive
+sn_rcv_w10m   =       'none'                 ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_taumod =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_tau    =       'oce only'             ,    'no'    , 'cartesian' , 'eastward-northward',  'U,V'   
+sn_rcv_dqnsdt =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_qsr    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_qns    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_emp    =       'conservative'         ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_rnf    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_cal    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+/
+!-----------------------------------------------------------------------
+&namtra_qsr    !   penetrative solar radiation
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_chl      ='chlorophyll',        -1         , 'CHLA'    ,   .true.     , .true. , 'yearly'  , 'weights_bilin.nc'       , ''
+
+   cn_dir      = './'      !  root directory for the location of the runoff files
+   ln_traqsr   = .true.    !  Light penetration (T) or not (F)
+   ln_qsr_rgb  = .true.    !  RGB (Red-Green-Blue) light penetration
+   ln_qsr_2bd  = .false.   !  2 bands              light penetration
+   ln_qsr_bio  = .false.   !  bio-model light penetration
+   nn_chldta   =      1    !  RGB : Chl data (=1) or cst value (=0)
+   rn_abs      =   0.58    !  RGB & 2 bands: fraction of light (rn_si1)
+   rn_si0      =   0.35    !  RGB & 2 bands: shortess depth of extinction
+   rn_si1      =   23.0    !  2 bands: longest depth of extinction
+/
+!-----------------------------------------------------------------------
+&namsbc_rnf    !   runoffs namelist surface boundary condition
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_rnf      = 'runoff_core_monthly',    -1    , 'sorunoff',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_cnf      = 'runoff_core_monthly',     0    , 'socoefr0',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_s_rnf    = 'runoffs'            ,    24    , 'rosaline',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_t_rnf    = 'runoffs'            ,    24    , 'rotemper',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_dep_rnf  = 'runoffs'            ,     0    , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir       = './'      !  root directory for the location of the runoff files
+   ln_rnf_emp   = .false.   !  runoffs included into precipitation field (T) or into a file (F)
+   ln_rnf_mouth = .true.    !  specific treatment at rivers mouths
+   rn_hrnf      =  15.e0    !  depth over which enhanced vertical mixing is used
+   rn_avt_rnf   =   1.e-3   !  value of the additional vertical mixing coef. [m2/s]
+   rn_rfact     =   1.e0    !  multiplicative factor for runoff
+   ln_rnf_depth = .false.   !  read in depth information for runoff
+   ln_rnf_tem   = .false.   !  read in temperature information for runoff
+   ln_rnf_sal   = .false.   !  read in salinity information for runoff
+/
+!-----------------------------------------------------------------------
+&namsbc_apr    !   Atmospheric pressure used as ocean forcing or in bulk
+!-----------------------------------------------------------------------
+!              ! file name ! frequency (hours) ! variable ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
+!              !           !  (if <0  months)  !   name   !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
+   sn_apr      = 'patm'    ,         -1        ,'somslpre',    .true.      , .true.  , 'yearly'  ,  ''      ,   ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files
+   ln_ref_apr  = .false.   !  ref. pressure: global mean Patm (T) or a constant (F)
+/
+!-----------------------------------------------------------------------
+&namsbc_ssr    !   surface boundary condition : sea surface restoring
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_sst      = 'sst_data'  ,        24         ,  'sst'    ,    .false.   , .false., 'yearly'  , ''       , ''
+   sn_sss      = 'sss_data'  ,        -1         ,  'sss'    ,    .true.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the runoff files
+   nn_sstr     =     0     !  add a retroaction term in the surface heat       flux (=1) or not (=0)
+   nn_sssr     =     2     !  add a damping     term in the surface freshwater flux (=2) 
+                           !  or to SSS only (=1) or no damping term (=0)
+   rn_dqdt     =   -40.    !  magnitude of the retroaction on temperature   [W/m2/K]
+   rn_deds     =   -27.7   !  magnitude of the damping on salinity   [mm/day]
+   ln_sssr_bnd =   .true.  !  flag to bound erp term (associated with nn_sssr=2)
+   rn_sssr_bnd =   4.e0    !  ABS(Max/Min) value of the damping erp term [mm/day]
+/      
+!-----------------------------------------------------------------------
+&namsbc_alb    !   albedo parameters
+!-----------------------------------------------------------------------
+   rn_cloud    =    0.06   !  cloud correction to snow and ice albedo 
+   rn_albice   =    0.53   !  albedo of melting ice in the arctic and antarctic
+   rn_alphd    =    0.80   !  coefficients for linear interpolation used to
+   rn_alphc    =    0.65   !  compute albedo between two extremes values 
+   rn_alphdi   =    0.72   !  (Pyane, 1972)
+/
+
+!!======================================================================
+!!               ***  Lateral boundary condition  ***
+!!======================================================================
+!!   namlbc        lateral momentum boundary condition
+!!   namcla        cross land advection
+!!   namobc        open boundaries parameters                           ("key_obc")
+!!   namagrif      agrif nested grid ( read by child model only )       ("key_agrif") 
+!!   nambdy        Unstructured open boundaries                         ("key_bdy")
+!!   namtide       Tidal forcing at open boundaries                     ("key_bdy_tides")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namlbc        !   lateral momentum boundary condition
+!-----------------------------------------------------------------------
+   rn_shlat    =    2.     !  shlat = 0  !  0 < shlat < 2  !  shlat = 2  !  2 < shlat
+                           !  free slip  !   partial slip  !   no slip   ! strong slip
+/
+!-----------------------------------------------------------------------
+&namcla        !   cross land advection
+!-----------------------------------------------------------------------
+   nn_cla      =    0      !  advection between 2 ocean pts separates by land
+/
+!-----------------------------------------------------------------------
+&namobc        !   open boundaries parameters                           ("key_obc")
+!-----------------------------------------------------------------------
+   ln_obc_clim = .false.   !  climatological obc data files (T) or not (F)
+   ln_vol_cst  = .true.    !  impose the total volume conservation (T) or not (F)
+   ln_obc_fla  = .false.   !  Flather open boundary condition 
+   nn_obcdta   =    1      !  = 0 the obc data are equal to the initial state
+                           !  = 1 the obc data are read in 'obc.dta' files
+   cn_obcdta   = 'annual'  !  set to annual if obc datafile hold 1 year of data
+                           !  set to monthly if obc datafile hold 1 month of data
+   rn_dpein    =    1.     !  damping time scale for inflow at east  open boundary
+   rn_dpwin    =    1.     !     -           -         -       west    -      -
+   rn_dpnin    =    1.     !     -           -         -       north   -      -
+   rn_dpsin    =    1.     !     -           -         -       south   -      -
+   rn_dpeob    = 3000.     !  time relaxation (days) for the east  open boundary
+   rn_dpwob    =   15.     !     -           -         -     west    -      -
+   rn_dpnob    = 3000.     !     -           -         -     north   -      -
+   rn_dpsob    =   15.     !     -           -         -     south   -      -
+   rn_volemp   =    1.     !  = 0 the total volume change with the surface flux (E-P-R)
+                           !  = 1 the total volume remains constant
+/
+!-----------------------------------------------------------------------
+&namagrif      !  AGRIF zoom                                            ("key_agrif")
+!-----------------------------------------------------------------------
+   nn_cln_update =    3    !  baroclinic update frequency
+   ln_spc_dyn    = .true.  !  use 0 as special value for dynamics
+   rn_sponge_tra = 2880.   !  coefficient for tracer   sponge layer [m2/s]
+   rn_sponge_dyn = 2880.   !  coefficient for dynamics sponge layer [m2/s]
+/
+!-----------------------------------------------------------------------
+&nambdy        !  unstructured open boundaries                          ("key_bdy")
+!-----------------------------------------------------------------------
+    nb_bdy = 1                            !  number of open boundary sets       
+    ln_coords_file = .true.               !  =T : read bdy coordinates from file
+    cn_coords_file = 'coordinates.bdy.nc' !  bdy coordinates files
+    ln_mask_file = .false.                !  =T : read mask from file
+    cn_mask_file = ''                     !  name of mask file (if ln_mask_file=.TRUE.)
+    nn_dyn2d      =  2                    !  boundary conditions for barotropic fields
+    nn_dyn2d_dta  =  3                    !  = 0, bdy data are equal to the initial state
+                                          !  = 1, bdy data are read in 'bdydata   .nc' files
+                                          !  = 2, use tidal harmonic forcing data from files
+                                          !  = 3, use external data AND tidal harmonic forcing
+    nn_dyn3d      =  0                    !  boundary conditions for baroclinic velocities
+    nn_dyn3d_dta  =  0                    !  = 0, bdy data are equal to the initial state
+                           !  = 1, bdy data are read in 'bdydata   .nc' files
+    nn_tra        =  1                    !  boundary conditions for T and S
+    nn_tra_dta    =  1                    !  = 0, bdy data are equal to the initial state
+                           !  = 1, bdy data are read in 'bdydata   .nc' files
+    nn_rimwidth  = 10                      !  width of the relaxation zone
+    nn_dmp2d_in  = 0                      !
+    nn_dmp2d_out = 0                      !
+    nn_dmp2d_in  = 0                      !
+    nn_dmp2d_out = 0                      !
+    ln_vol     = .false.                  !  total volume correction (see nn_volctl parameter)
+    nn_volctl  = 1                        !  = 0, the total water flux across open boundaries is zero
+/
+!-----------------------------------------------------------------------
+&nambdy_dta      !  open boundaries - external data           ("key_bdy")
+!-----------------------------------------------------------------------
+!              !   file name    ! frequency (hours) !  variable  ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
+!              !                !  (if <0  months)  !    name    !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
+   bn_ssh =     'amm12_bdyT_u2d' ,         24        , 'sossheig' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_u2d =     'amm12_bdyU_u2d' ,         24        , 'vobtcrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_v2d =     'amm12_bdyV_u2d' ,         24        , 'vobtcrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_u3d  =    'amm12_bdyU_u3d' ,         24        , 'vozocrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_v3d  =    'amm12_bdyV_u3d' ,         24        , 'vomecrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_tem  =    'amm12_bdyT_tra' ,         24        , 'votemper' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_sal  =    'amm12_bdyT_tra' ,         24        , 'vosaline' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   cn_dir  =    'bdydta/'
+   ln_full_vel = .false.
+/
+!-----------------------------------------------------------------------
+&nambdy_tide     ! tidal forcing at open boundaries              
+!-----------------------------------------------------------------------
+   filtide      = 'bdydta/amm12_bdytide_'         !  file name root of tidal forcing files
+    tide_cpt(1)   ='Q1'  !  names of tidal components used
+    tide_cpt(2)   ='O1'  !  names of tidal components used
+    tide_cpt(3)   ='P1'  !  names of tidal components used
+    tide_cpt(4)   ='S1'  !  names of tidal components used
+    tide_cpt(5)   ='K1'  !  names of tidal components used
+    tide_cpt(6)   ='2N2' !  names of tidal components used
+    tide_cpt(7)   ='MU2' !  names of tidal components used
+    tide_cpt(8)   ='N2'  !  names of tidal components used
+    tide_cpt(9)   ='NU2' !  names of tidal components used
+    tide_cpt(10)   ='M2'  !  names of tidal components used
+    tide_cpt(11)   ='L2'  !  names of tidal components used
+    tide_cpt(12)   ='T2'  !  names of tidal components used
+    tide_cpt(13)   ='S2'  !  names of tidal components used
+    tide_cpt(14)   ='K2'  !  names of tidal components used
+    tide_cpt(15)   ='M4'  !  names of tidal components used
+    tide_speed(1)   = 13.398661 !  phase speeds of tidal components (deg/hour)
+    tide_speed(2)   = 13.943036 !  phase speeds of tidal components (deg/hour)
+    tide_speed(3)   = 14.958932 !  phase speeds of tidal components (deg/hour)
+    tide_speed(4)   = 15.000001 !  phase speeds of tidal components (deg/hour)
+    tide_speed(5)   = 15.041069 !  phase speeds of tidal components (deg/hour)
+    tide_speed(6)   = 27.895355 !  phase speeds of tidal components (deg/hour)
+    tide_speed(7)   = 27.968210 !  phase speeds of tidal components (deg/hour)
+    tide_speed(8)   = 28.439730 !  phase speeds of tidal components (deg/hour)
+    tide_speed(9)   = 28.512585 !  phase speeds of tidal components (deg/hour)
+    tide_speed(10)   = 28.984106 !  phase speeds of tidal components (deg/hour)
+    tide_speed(11)   = 29.528479 !  phase speeds of tidal components (deg/hour)
+    tide_speed(12)   = 29.958935 !  phase speeds of tidal components (deg/hour)
+    tide_speed(13)   = 30.000002 !  phase speeds of tidal components (deg/hour)
+    tide_speed(14)   = 30.082138 !  phase speeds of tidal components (deg/hour)
+    tide_speed(15)   = 57.968212 !  phase speeds of tidal components (deg/hour)
+    ln_tide_date = .true.               !  adjust tidal harmonics for start date of run
+/
+!!======================================================================
+!!                 ***  Bottom boundary condition  ***
+!!======================================================================
+!!   nambfr        bottom friction
+!!   nambbc        bottom temperature boundary condition               
+!!   nambbl        bottom boundary layer scheme                         ("key_trabbl")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&nambfr        !   bottom friction
+!-----------------------------------------------------------------------
+   nn_bfr      =    1      !  type of bottom friction :   = 0 : free slip,  = 1 : linear friction
+                           !                              = 2 : nonlinear friction
+   rn_bfri1    =    4.e-4  !  bottom drag coefficient (linear case)
+   rn_bfri2    =    1.e-3  !  bottom drag coefficient (non linear case)
+   rn_bfeb2    =    2.5e-3 !  bottom turbulent kinetic energy background  (m2/s2)
+   ln_bfr2d    = .false.   !  horizontal variation of the bottom friction coef (read a 2D mask file )
+   rn_bfrien   =    50.    !  local multiplying factor of bfr (ln_bfr2d=T)
+   ln_bfrimp   = .true.    !  implicit bottom friction (requires ln_zdfexp = .false. if true)
+/
+!-----------------------------------------------------------------------
+&nambbc        !   bottom temperature boundary condition
+!-----------------------------------------------------------------------
+   ln_trabbc   = .true.    !  Apply a geothermal heating at the ocean bottom
+   nn_geoflx   =    2      !  geothermal heat flux: = 0 no flux 
+                           !     = 1 constant flux
+                           !     = 2 variable flux (read in geothermal_heating.nc in mW/m2) 
+   rn_geoflx_cst = 86.4e-3 !  Constant value of geothermal heat flux [W/m2]
+/
+!-----------------------------------------------------------------------
+&nambbl        !   bottom boundary layer scheme
+!-----------------------------------------------------------------------
+   nn_bbl_ldf  =  1      !  diffusive bbl (=1)   or not (=0)
+   nn_bbl_adv  =  0      !  advective bbl (=1/2) or not (=0)
+   rn_ahtbbl   =  1000.  !  lateral mixing coefficient in the bbl  [m2/s]
+   rn_gambbl   =  10.    !  advective bbl coefficient                 [s]
+/
+
+!!======================================================================
+!!                        Tracer (T & S ) namelists
+!!======================================================================
+!!   nameos        equation of state
+!!   namtra_adv    advection scheme
+!!   namtra_ldf    lateral diffusion scheme
+!!   namtra_dmp    T & S newtonian damping                              ("key_tradmp")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&nameos        !   ocean physical parameters
+!-----------------------------------------------------------------------
+   nn_eos      =   0       !  type of equation of state and Brunt-Vaisala frequency
+                           !     = 0, UNESCO (formulation of Jackett and McDougall (1994) and of McDougall (1987) )
+                           !     = 1, linear: rho(T)   = rau0 * ( 1.028 - ralpha * T )
+                           !     = 2, linear: rho(T,S) = rau0 * ( rbeta * S - ralpha * T )
+   rn_alpha    =   2.0e-4  !  thermal expension coefficient (nn_eos= 1 or 2)
+   rn_beta     =   7.7e-4  !  saline  expension coefficient (nn_eos= 2)
+/
+!-----------------------------------------------------------------------
+&namtra_adv    !   advection scheme for tracer 
+!-----------------------------------------------------------------------
+   ln_traadv_cen2   =  .false.  !  2nd order centered scheme   
+   ln_traadv_tvd    =  .true.   !  TVD scheme                
+   ln_traadv_muscl  =  .false.  !  MUSCL scheme             
+   ln_traadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries  
+   ln_traadv_ubs    =  .false.  !  UBS scheme                 
+   ln_traadv_qck    =  .false.  !  QUCIKEST scheme                 
+/
+!-----------------------------------------------------------------------
+&namtra_ldf    !   lateral diffusion scheme for tracer 
+!-----------------------------------------------------------------------
+   !                       !  Type of the operator : 
+   ln_traldf_lap    =  .true.   !  laplacian operator       
+   ln_traldf_bilap  =  .false.  !  bilaplacian operator     
+   !                       !  Direction of action  :
+   ln_traldf_level  =  .false.  !  iso-level                
+   ln_traldf_hor    =  .false.  !  horizontal (geopotential)            (require "key_ldfslp" when ln_sco=T)
+   ln_traldf_iso    =  .true.   !  iso-neutral                          (require "key_ldfslp")
+   ln_traldf_grif   =  .false.  !  griffies skew flux formulation       (require "key_ldfslp")  ! UNDER TEST, DO NOT USE
+   ln_traldf_gdia   =  .false.  !  griffies operator strfn diagnostics  (require "key_ldfslp")  ! UNDER TEST, DO NOT USE
+   !                       !  Coefficient
+   rn_aht_0         =  1000.    !  horizontal eddy diffusivity for tracers [m2/s]
+   rn_ahtb_0        =     0.    !  background eddy diffusivity for ldf_iso [m2/s]
+   rn_aeiv_0        =     0.    !  eddy induced velocity coefficient [m2/s]    (require "key_traldf_eiv")
+/
+!-----------------------------------------------------------------------
+&namtra_dmp    !   tracer: T & S newtonian damping                      ('key_tradmp')
+!-----------------------------------------------------------------------
+   nn_hdmp     =   90      !  horizontal shape =-1, damping in Med and Red Seas only
+                           !                   =XX, damping poleward of XX degrees (XX>0)
+                           !                      + F(distance-to-coast) + Red and Med Seas
+   nn_zdmp     =    1      !  vertical   shape =0    damping throughout the water column
+                           !                   =1 no damping in the mixing layer (kz  criteria)
+                           !                   =2 no damping in the mixed  layer (rho crieria)
+   rn_surf     =   50.     !  surface time scale of damping   [days]
+   rn_bot      =  360.     !  bottom  time scale of damping   [days]
+   rn_dep      =  800.     !  depth of transition between rn_surf and rn_bot [meters]
+   nn_file     =    0      !  create a damping.coeff NetCDF file (=1) or not (=0)
+/
+
+!!======================================================================
+!!                      ***  Dynamics namelists  ***
+!!======================================================================
+!!   namdyn_adv    formulation of the momentum advection
+!!   namdyn_vor    advection scheme
+!!   namdyn_hpg    hydrostatic pressure gradient
+!!   namdyn_spg    surface pressure gradient                            (CPP key only)
+!!   namdyn_ldf    lateral diffusion scheme
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namdyn_adv    !   formulation of the momentum advection
+!-----------------------------------------------------------------------
+   ln_dynadv_vec = .true.  !  vector form (T) or flux form (F)  
+   ln_dynadv_cen2= .false. !  flux form - 2nd order centered scheme
+   ln_dynadv_ubs = .false. !  flux form - 3rd order UBS      scheme 
+/  
+!-----------------------------------------------------------------------
+&namdyn_vor    !   option of physics/algorithm (not control by CPP keys)
+!-----------------------------------------------------------------------
+   ln_dynvor_ene = .false. !  enstrophy conserving scheme  
+   ln_dynvor_ens = .false. !  energy conserving scheme    
+   ln_dynvor_mix = .false. !  mixed scheme               
+   ln_dynvor_een = .true.  !  energy & enstrophy scheme  
+/
+!-----------------------------------------------------------------------
+&namdyn_hpg    !   Hydrostatic pressure gradient option
+!-----------------------------------------------------------------------
+   ln_hpg_zco  = .false.   !  z-coordinate - full steps                   
+   ln_hpg_zps  = .true.    !  z-coordinate - partial steps (interpolation)
+   ln_hpg_sco  = .false.   !  s-coordinate (standard jacobian formulation)
+   ln_hpg_djc  = .false.   !  s-coordinate (Density Jacobian with Cubic polynomial)
+   ln_hpg_prj  = .false.   !  s-coordinate (Pressure Jacobian scheme)
+   ln_dynhpg_imp = .false. !  time stepping: semi-implicit time scheme  (T)
+                                 !           centered      time scheme  (F)
+/
+!-----------------------------------------------------------------------
+!namdyn_spg    !   surface pressure gradient   (CPP key only)
+!-----------------------------------------------------------------------
+!                          !  explicit free surface                     ("key_dynspg_exp")
+!                          !  filtered free surface                     ("key_dynspg_flt")
+!                          !  split-explicit free surface               ("key_dynspg_ts")
+
+!-----------------------------------------------------------------------
+&namdyn_ldf    !   lateral diffusion on momentum
+!-----------------------------------------------------------------------
+   !                       !  Type of the operator : 
+   ln_dynldf_lap    =  .false.  !  laplacian operator         
+   ln_dynldf_bilap  =  .true.   !  bilaplacian operator    
+   !                       !  Direction of action  : 
+   ln_dynldf_level  =  .false.  !  iso-level               
+   ln_dynldf_hor    =  .true.   !  horizontal (geopotential)            (require "key_ldfslp" in s-coord.)
+   ln_dynldf_iso    =  .false.  !  iso-neutral                          (require "key_ldfslp")
+   !                       !  Coefficient
+   rn_ahm_0_lap     = 40000.    !  horizontal laplacian eddy viscosity   [m2/s]
+   rn_ahmb_0        =     0.    !  background eddy viscosity for ldf_iso [m2/s]
+   rn_ahm_0_blp     = -8.5e+11  !  horizontal bilaplacian eddy viscosity [m4/s] 
+/
+
+!!======================================================================
+!!             Tracers & Dynamics vertical physics namelists
+!!======================================================================
+!!    namzdf        vertical physics
+!!    namzdf_ric    richardson number dependent vertical mixing         ("key_zdfric")
+!!    namzdf_tke    TKE dependent vertical mixing                       ("key_zdftke")
+!!    namzdf_kpp    KPP dependent vertical mixing                       ("key_zdfkpp")
+!!    namzdf_ddm    double diffusive mixing parameterization            ("key_zdfddm")
+!!    namzdf_tmx    tidal mixing parameterization                       ("key_zdftmx")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namzdf        !   vertical physics
+!-----------------------------------------------------------------------
+   rn_avm0     =   1.2e-4  !  vertical eddy viscosity   [m2/s]          (background Kz if not "key_zdfcst")
+   rn_avt0     =   1.2e-5  !  vertical eddy diffusivity [m2/s]          (background Kz if not "key_zdfcst")
+   nn_avb      =    0      !  profile for background avt & avm (=1) or not (=0)
+   nn_havtb    =    0      !  horizontal shape for avtb (=1) or not (=0)
+   ln_zdfevd   = .true.    !  enhanced vertical diffusion (evd) (T) or not (F)
+   nn_evdm     =    0      !  evd apply on tracer (=0) or on tracer and momentum (=1)
+   rn_avevd    =  100.     !  evd mixing coefficient [m2/s]
+   ln_zdfnpc   = .false.   !  Non-Penetrative Convective algorithm (T) or not (F)
+   nn_npc      =    1            !  frequency of application of npc
+   nn_npcp     =  365            !  npc control print frequency
+   ln_zdfexp   = .false.   !  time-stepping: split-explicit (T) or implicit (F) time stepping
+   nn_zdfexp   =    3            !  number of sub-timestep for ln_zdfexp=T
+/
+!-----------------------------------------------------------------------
+&namzdf_ric    !   richardson number dependent vertical diffusion       ("key_zdfric" )
+!-----------------------------------------------------------------------
+   rn_avmri    = 100.e-4   !  maximum value of the vertical viscosity
+   rn_alp      =   5.      !  coefficient of the parameterization
+   nn_ric      =   2       !  coefficient of the parameterization
+/
+!-----------------------------------------------------------------------
+&namzdf_tke    !   turbulent eddy kinetic dependent vertical diffusion  ("key_zdftke")
+!-----------------------------------------------------------------------
+   rn_ediff    =   0.1     !  coef. for vertical eddy coef. (avt=rn_ediff*mxl*sqrt(e) )
+   rn_ediss    =   0.7     !  coef. of the Kolmogoroff dissipation
+   rn_ebb      =  67.83    !  coef. of the surface input of tke (=67.83 suggested when ln_mxl0=T)
+   rn_emin     =   1.e-6   !  minimum value of tke [m2/s2]
+   rn_emin0    =   1.e-4   !  surface minimum value of tke [m2/s2]
+   nn_mxl      =   2       !  mixing length: = 0 bounded by the distance to surface and bottom
+                           !                 = 1 bounded by the local vertical scale factor
+                           !                 = 2 first vertical derivative of mixing length bounded by 1
+                           !                 = 3 as =2 with distinct disspipative an mixing length scale
+   nn_pdl      =   1       !  Prandtl number function of richarson number (=1, avt=pdl(Ri)*avm) or not (=0, avt=avm)
+   ln_mxl0     = .true.    !  surface mixing length scale = F(wind stress) (T) or not (F)
+   rn_mxl0     =   0.04    !  surface  buoyancy lenght scale minimum value
+   ln_lc       = .true.    !  Langmuir cell parameterisation (Axell 2002)
+   rn_lc       =   0.15    !  coef. associated to Langmuir cells
+   nn_etau     =   1       !  penetration of tke below the mixed layer (ML) due to internal & intertial waves
+                           !        = 0 no penetration
+                           !        = 1 add a tke source below the ML
+                           !        = 2 add a tke source just at the base of the ML
+                           !        = 3 as = 1 applied on HF part of the stress    ("key_coupled")
+   rn_efr      =   0.05    !  fraction of surface tke value which penetrates below the ML (nn_etau=1 or 2)
+   nn_htau     =   1       !  type of exponential decrease of tke penetration below the ML
+                           !        = 0  constant 10 m length scale
+                           !        = 1  0.5m at the equator to 30m poleward of 40 degrees
+/
+!------------------------------------------------------------------------
+&namzdf_kpp    !   K-Profile Parameterization dependent vertical mixing  ("key_zdfkpp", and optionally:
+!------------------------------------------------------------------------ "key_kppcustom" or "key_kpplktb")
+   ln_kpprimix = .true.    !  shear instability mixing 
+   rn_difmiw   =  1.0e-04  !  constant internal wave viscosity [m2/s]
+   rn_difsiw   =  0.1e-04  !  constant internal wave diffusivity [m2/s]
+   rn_riinfty  =  0.8      !  local Richardson Number limit for shear instability
+   rn_difri    =  0.0050   !  maximum shear mixing at Rig = 0    [m2/s]
+   rn_bvsqcon  = -0.01e-07 !  Brunt-Vaisala squared for maximum convection [1/s2] 
+   rn_difcon   =  1.       !  maximum mixing in interior convection [m2/s] 
+   nn_avb      =  0        !  horizontal averaged (=1) or not (=0) on avt and amv
+   nn_ave      =  1        !  constant (=0) or profile (=1) background on avt
+/
+!-----------------------------------------------------------------------
+&namzdf_gls                !   GLS vertical diffusion                   ("key_zdfgls")
+!-----------------------------------------------------------------------
+   rn_emin       = 1.e-6   !  minimum value of e   [m2/s2]
+   rn_epsmin     = 1.e-12  !  minimum value of eps [m2/s3]
+   ln_length_lim = .true.  !  limit on the dissipation rate under stable stratification (Galperin et al., 1988)
+   rn_clim_galp  = 0.53    !  galperin limit
+   ln_crban      = .true.  !  Use Craig & Banner (1994) surface wave mixing parametrisation
+   ln_sigpsi     = .true.  !  Activate or not Burchard 2001 mods on psi schmidt number in the wb case
+   rn_crban      = 100.    !  Craig and Banner 1994 constant for wb tke flux
+   rn_charn      = 70000.  !  Charnock constant for wb induced roughness length
+   nn_tkebc_surf =   1     !  surface tke condition (0/1/2=Dir/Neum/Dir Mellor-Blumberg)
+   nn_tkebc_bot  =   1     !  bottom tke condition (0/1=Dir/Neum)
+   nn_psibc_surf =   1     !  surface psi condition (0/1/2=Dir/Neum/Dir Mellor-Blumberg)
+   nn_psibc_bot  =   1     !  bottom psi condition (0/1=Dir/Neum)
+   nn_stab_func  =   2     !  stability function (0=Galp, 1= KC94, 2=CanutoA, 3=CanutoB)
+   nn_clos       =   1     !  predefined closure type (0=MY82, 1=k-eps, 2=k-w, 3=Gen)
+/
+!-----------------------------------------------------------------------
+&namzdf_ddm    !   double diffusive mixing parameterization             ("key_zdfddm")
+!-----------------------------------------------------------------------
+   rn_avts     = 1.e-4     !  maximum avs (vertical mixing on salinity)
+   rn_hsbfr    = 1.6       !  heat/salt buoyancy flux ratio
+/
+!-----------------------------------------------------------------------
+&namzdf_tmx    !   tidal mixing parameterization                        ("key_zdftmx")
+!-----------------------------------------------------------------------
+   rn_htmx     = 500.      !  vertical decay scale for turbulence (meters)
+   rn_n2min    = 1.e-8     !  threshold of the Brunt-Vaisala frequency (s-1)
+   rn_tfe      = 0.333     !  tidal dissipation efficiency
+   rn_me       = 0.2       !  mixing efficiency 
+   ln_tmx_itf  = .false.   !  ITF specific parameterisation
+   rn_tfe_itf  = 1.        !  ITF tidal dissipation efficiency
+/
+
+!!======================================================================
+!!                  ***  Miscelaneous namelists  ***
+!!======================================================================
+!!   nammpp            Massively Parallel Processing                    ("key_mpp_mpi)
+!!   nammpp_dyndist    Massively Parallel domain decomposition          ("key_agrif" && "key_mpp_dyndist")
+!!   namctl            Control prints & Benchmark
+!!   namsol            elliptic solver / island / free surface 
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namsol        !   elliptic solver / island / free surface 
+!-----------------------------------------------------------------------
+   nn_solv     =      1    !  elliptic solver: =1 preconditioned conjugate gradient (pcg)
+                           !                   =2 successive-over-relaxation (sor)
+   nn_sol_arp  =      0    !  absolute/relative (0/1) precision convergence test
+   rn_eps      =  1.e-6    !  absolute precision of the solver
+   nn_nmin     =    300    !  minimum of iterations for the SOR solver
+   nn_nmax     =    800    !  maximum of iterations for the SOR solver
+   nn_nmod     =     10    !  frequency of test for the SOR solver
+   rn_resmax   =  1.e-10   !  absolute precision for the SOR solver
+   rn_sor      =  1.92     !  optimal coefficient for SOR solver (to be adjusted with the domain)
+/
+!-----------------------------------------------------------------------
+&nammpp        !   Massively Parallel Processing                        ("key_mpp_mpi)
+!-----------------------------------------------------------------------
+   cn_mpi_send =  'I'      !  mpi send/recieve type   ='S', 'B', or 'I' for standard send,
+                           !  buffer blocking send or immediate non-blocking sends, resp.
+   nn_buffer   =   0       !  size in bytes of exported buffer ('B' case), 0 no exportation
+/
+!-----------------------------------------------------------------------
+&nammpp_dyndist !   Massively Parallel Distribution for AGRIF zoom      ("key_agrif" && "key_mpp_dyndist")
+!-----------------------------------------------------------------------
+   jpni        =    1      !  jpni   number of processors following i
+   jpnj        =    1      !  jpnj   number of processors following j
+   jpnij       =    1      !  jpnij  number of local domains
+/
+!-----------------------------------------------------------------------
+&namctl        !   Control prints & Benchmark
+!-----------------------------------------------------------------------
+   ln_ctl      = .false.   !  trends control print (expensive!)
+   nn_print    =    0      !  level of print (0 no extra print)
+   nn_ictls    =    0      !  start i indice of control sum (use to compare mono versus
+   nn_ictle    =    0      !  end   i indice of control sum        multi processor runs
+   nn_jctls    =    0      !  start j indice of control               over a subdomain)
+   nn_jctle    =    0      !  end   j indice of control
+   nn_isplt    =    1      !  number of processors in i-direction
+   nn_jsplt    =    1      !  number of processors in j-direction
+   nn_bench    =    0      !  Bench mode (1/0): CAUTION use zero except for bench
+                           !     (no physical validity of the results)
+   nn_timing =      0
+/
+
+!!======================================================================
+!!                  ***  Diagnostics namelists  ***
+!!======================================================================
+!!   namnc4       netcdf4 chunking and compression settings             ("key_netcdf4")
+!!   namtrd       dynamics and/or tracer trends                         ("key_trddyn","key_trdtra","key_trdmld")
+!!   namflo       float parameters                                      ("key_float")
+!!   namptr       Poleward Transport Diagnostics
+!!   namhsb       Heat and salt budgets 
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namnc4        !   netcdf4 chunking and compression settings            ("key_netcdf4")
+!-----------------------------------------------------------------------
+   nn_nchunks_i=   4       !  number of chunks in i-dimension
+   nn_nchunks_j=   4       !  number of chunks in j-dimension
+   nn_nchunks_k=   31      !  number of chunks in k-dimension
+                           !  setting nn_nchunks_k = jpk will give a chunk size of 1 in the vertical which
+                           !  is optimal for postprocessing which works exclusively with horizontal slabs
+   ln_nc4zip   = .true.    !  (T) use netcdf4 chunking and compression
+                           !  (F) ignore chunking information and produce netcdf3-compatible files
+/
+!-----------------------------------------------------------------------
+&namtrd        !   diagnostics on dynamics and/or tracer trends         ("key_trddyn" and/or "key_trdtra")
+!              !       or mixed-layer trends or barotropic vorticity    ("key_trdmld" or     "key_trdvor")
+!-----------------------------------------------------------------------
+   nn_trd      = 365       !  time step frequency dynamics and tracers trends
+   nn_ctls     =   0       !  control surface type in mixed-layer trends (0,1 or n<jpk)
+   rn_ucf      =   1.      !  unit conversion factor (=1 -> /seconds ; =86400. -> /day)
+   cn_trdrst_in      = "restart_mld"   ! suffix of ocean restart name (input)
+   cn_trdrst_out     = "restart_mld"   ! suffix of ocean restart name (output)
+   ln_trdmld_restart = .false.         !  restart for ML diagnostics
+   ln_trdmld_instant = .false.         !  flag to diagnose trends of instantantaneous or mean ML T/S
+/
+!-----------------------------------------------------------------------
+&namflo       !   float parameters                                      ("key_float")
+!-----------------------------------------------------------------------
+   jpnfl         = 1          !  total number of floats during the run
+   jpnnewflo     = 0          !  number of floats for the restart
+   ln_rstflo     = .false.    !  float restart (T) or not (F)
+   nn_writefl    =      75    !  frequency of writing in float output file
+   nn_stockfl    =    5475    !  frequency of creation of the float restart file
+   ln_argo       = .false.    !  Argo type floats (stay at the surface each 10 days)
+   ln_flork4     = .false.    !  trajectories computed with a 4th order Runge-Kutta (T)
+                              !  or computed with Blanke' scheme (F)
+   ln_ariane     = .true.     !  Input with Ariane tool convention(T)
+   ln_flo_ascii  = .true.     !  Output with Ariane tool netcdf convention(F) or ascii file (T)
+/
+!-----------------------------------------------------------------------
+&namptr       !   Poleward Transport Diagnostic
+!-----------------------------------------------------------------------
+   ln_diaptr  = .false.    !  Poleward heat and salt transport (T) or not (F)
+   ln_diaznl  = .true.     !  Add zonal means and meridional stream functions
+   ln_subbas  = .true.     !  Atlantic/Pacific/Indian basins computation (T) or not 
+                           !  (orca configuration only, need input basins mask file named "subbasins.nc"
+   ln_ptrcomp = .true.     !  Add decomposition : overturning
+   nn_fptr    =  1         !  Frequency of ptr computation [time step]
+   nn_fwri    =  15        !  Frequency of ptr outputs [time step]
+/
+!-----------------------------------------------------------------------
+&namhsb       !  Heat and salt budgets 
+!-----------------------------------------------------------------------
+   ln_diahsb  = .false.    !  check the heat and salt budgets (T) or not (F)
+/
+
+!!======================================================================
+!!            ***  Observation & Assimilation namelists ***
+!!======================================================================
+!!   namobs       observation and model comparison                      ('key_diaobs')
+!!   nam_asminc   assimilation increments                               ('key_asminc')
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namobs       !  observation usage switch                               ('key_diaobs')
+!-----------------------------------------------------------------------
+   ln_t3d     = .false.    ! Logical switch for T profile observations         
+   ln_s3d     = .false.    ! Logical switch for S profile observations          
+   ln_ena     = .false.    ! Logical switch for ENACT insitu data set           
+   !                       !     ln_cor                  Logical switch for Coriolis insitu data set       
+   ln_profb   = .false.    ! Logical switch for feedback insitu data set     
+   ln_sla     = .false.    ! Logical switch for SLA observations               
+
+   ln_sladt   = .false.    ! Logical switch for AVISO SLA data              
+
+   ln_slafb   = .false.    ! Logical switch for feedback SLA data            
+                           !     ln_ssh                  Logical switch for SSH observations              
+
+   ln_sst     = .false.    ! Logical switch for SST observations              
+                           !     ln_reysst               Logical switch for Reynolds observations       
+                           !     ln_ghrsst               Logical switch for GHRSST observations          
+
+   ln_sstfb   = .false.    ! Logical switch for feedback SST data          
+                           !     ln_sss                  Logical switch for SSS observations              
+                           !     ln_seaice               Logical switch for Sea Ice observations        
+                           !     ln_vel3d                Logical switch for velocity observations         
+                           !     ln_velavcur             Logical switch for velocity daily av. cur.    
+                           !     ln_velhrcur             Logical switch for velocity high freq. cur.   
+                           !     ln_velavadcp            Logical switch for velocity daily av. ADCP  
+                           !     ln_velhradcp            Logical switch for velocity high freq. ADCP
+                           !     ln_velfb                Logical switch for feedback velocity data       
+                           !     ln_grid_global          Global distribtion of observations         
+                           !     ln_grid_search_lookup   Logical switch for obs grid search w/lookup table  
+                           !     grid_search_file        Grid search lookup file header 
+                           !     enactfiles              ENACT input observation file names 
+                           !     coriofiles              Coriolis input observation file name  
+   !                       ! profbfiles: Profile feedback input observation file name 
+   profbfiles = 'profiles_01.nc'
+                           !     ln_profb_enatim         Enact feedback input time setting switch    
+                           !     slafilesact             Active SLA input observation file name
+                           !     slafilespas             Passive SLA input observation file name 
+   !                       ! slafbfiles: Feedback SLA input observation file name 
+   slafbfiles = 'sla_01.nc'
+                           !     sstfiles                GHRSST input observation file name       
+   !                       ! sstfbfiles: Feedback SST input observation file name 
+   sstfbfiles = 'sst_01.nc' 'sst_02.nc' 'sst_03.nc' 'sst_04.nc' 'sst_05.nc'
+                           !     seaicefiles             Sea Ice input observation file name 
+                           !     velavcurfiles           Vel. cur. daily av. input file name  
+                           !     velhvcurfiles           Vel. cur. high freq. input file name  
+                           !     velavadcpfiles          Vel. ADCP daily av. input file name    
+                           !     velhvadcpfiles          Vel. ADCP high freq. input file name 
+                           !     velfbfiles              Vel. feedback input observation file name 
+                           !     dobsini                 Initial date in window YYYYMMDD.HHMMSS       
+                           !     dobsend                 Final date in window YYYYMMDD.HHMMSS         
+                           !     n1dint                  Type of vertical interpolation method        
+                           !     n2dint                  Type of horizontal interpolation method       
+                           !     ln_nea                  Rejection of observations near land switch    
+   nmsshc     = 0          ! MSSH correction scheme                         
+                           !     mdtcorr                 MDT  correction                               
+                           !     mdtcutoff               MDT cutoff for computed correction          
+   ln_altbias = .false.    ! Logical switch for alt bias                
+   ln_ignmis  = .true.     ! Logical switch for ignoring missing files   
+                           !     endailyavtypes   ENACT daily average types                    
+   ln_grid_global = .true.
+   ln_grid_search_lookup = .false.
+/ 
+!-----------------------------------------------------------------------
+&nam_asminc   !   assimilation increments                               ('key_asminc')
+!-----------------------------------------------------------------------
+    ln_bkgwri = .false.    !  Logical switch for writing out background state 
+    ln_trjwri = .false.    !  Logical switch for writing out state trajectory
+    ln_trainc = .false.    !  Logical switch for applying tracer increments
+    ln_dyninc = .false.    !  Logical switch for applying velocity increments
+    ln_sshinc = .false.    !  Logical switch for applying SSH increments 
+    ln_asmdin = .false.    !  Logical switch for Direct Initialization (DI)
+    ln_asmiau = .false.    !  Logical switch for Incremental Analysis Updating (IAU)
+    nitbkg    = 0          !  Timestep of background in [0,nitend-nit000-1]
+    nitdin    = 0          !  Timestep of background for DI in [0,nitend-nit000-1]
+    nitiaustr = 1          !  Timestep of start of IAU interval in [0,nitend-nit000-1]
+    nitiaufin = 15         !  Timestep of end of IAU interval in [0,nitend-nit000-1]
+    niaufn    = 0          !  Type of IAU weighting function
+    nittrjfrq = 0          !  Frequency of trajectory output for 4D-VAR
+    ln_salfix = .false.    !  Logical switch for ensuring that the sa > salfixmin
+    salfixmin = -9999      !  Minimum salinity after applying the increments
+/
+!-----------------------------------------------------------------------
+&namsbc_wave   ! External fields from wave model
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_cdg      =  'cdg_wave' ,        1          , 'drag_coeff' , .true.   , .false. , 'daily'  ,''         , ''
+!
+   cn_dir_cdg  = './'  !  root directory for the location of drag coefficient files
+/
+!-----------------------------------------------------------------------
+&namdyn_nept  !   Neptune effect (simplified: lateral and vertical diffusions removed)
+!-----------------------------------------------------------------------
+   ! Suggested lengthscale values are those of Eby & Holloway (1994) for a coarse model
+   ln_neptsimp       = .false.  ! yes/no use simplified neptune
+
+   ln_smooth_neptvel = .false.  ! yes/no smooth zunep, zvnep
+   rn_tslse          =  1.2e4   ! value of lengthscale L at the equator
+   rn_tslsp          =  3.0e3   ! value of lengthscale L at the pole
+   ! Specify whether to ramp down the Neptune velocity in shallow
+   ! water, and if so the depth range controlling such ramping down
+   ln_neptramp       = .true.   ! ramp down Neptune velocity in shallow water
+   rn_htrmin         =  100.0   ! min. depth of transition range
+   rn_htrmax         =  200.0   ! max. depth of transition range
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_namelist_c14b
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_namelist_c14b	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_namelist_c14b	(revision 3680)
@@ -0,0 +1,19 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! Bomb C14  :       1  - dates                             (namc14date)
+!! namelists    
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namc14date     !   dates
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   ndate_beg_b  = 650101    !  datedeb1
+   nyear_res_b  = 1955      !  iannee1
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namc14dia     !   additional 2D/3D tracers diagnostics ("key_trc_diaadd")
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!              !    name   !           title of the field          !     units      !
+!              !           !                                       !                !
+   c14dia2d(1)  = 'qtr_c14  ' , 'Air-sea flux                      ',  'mol/m2/s    '
+   c14dia2d(2)  = 'qint_c14 ' , 'Cumulative air-sea flux           ',  'mol/m2      '
+   c14dia3d(1)  = 'decay    ' , 'Radiactive decay                  ',  'mol/m3      '
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_namelist_cfc
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_namelist_cfc	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_namelist_cfc	(revision 3680)
@@ -0,0 +1,18 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! CFC  :       1  - dates                                 (namcfcdate)
+!! namelists    
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namcfcdate     !   dates
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   ndate_beg  = 300101    !  datedeb1
+   nyear_res  = 1932      !  iannee1
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namcfcdia     !   additional 2D/3D tracers diagnostics 
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!              !    name   !           title of the field          !     units      !
+!              !           !                                       !                !
+   cfcdia2d(1)  = 'qtr_c11 ' , 'Air-sea flux of CFC-11           ',  'mol/m2/s    '
+   cfcdia2d(2)  = 'qint_c11' , 'Cumulative air-sea flux of CFC-11 ', 'mol/m2      '
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_namelist_ice_lim2
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_namelist_ice_lim2	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_namelist_ice_lim2	(revision 3680)
@@ -0,0 +1,1 @@
+link ../../ORCA2_LIM/EXP00/1_namelist_ice_lim2
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_namelist_top
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_namelist_top	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_namelist_top	(revision 3680)
@@ -0,0 +1,105 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/TOP1 :  1 - tracer definition                     (namtrc    )
+!!              2 - tracer data initialisation            (namtrc_dta)
+!!              3 - tracer advection                      (namtrc_adv)
+!!              4 - tracer lateral diffusion              (namtrc_ldf)
+!!              5 - tracer vertical physics               (namtrc_zdf)
+!!              6 - tracer newtonian damping              (namtrc_dmp)
+!!              7 - dynamical tracer trends               (namtrc_trd)
+!!              8 - tracer output diagonstics             (namtrc_dia)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namtrc     !   tracers definition
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   nn_dttrc      =  1        !  time step frequency for passive sn_tracers      
+   nn_writetrc   =  10950      !  time step frequency for sn_tracer outputs
+   ln_rsttr      = .false.   !  start from a restart file (T) or not (F)
+   nn_rsttr      =   0       !  restart control = 0 initial time step is not compared to the restart file value
+                           !                  = 1 do not use the value in the restart file
+                           !                  = 2 calendar parameters read in the restart file
+   cn_trcrst_in  = "restart_trc"   !  suffix of pass. sn_tracer restart name (input)
+   cn_trcrst_out = "restart_trc"   !  suffix of pass. sn_tracer restart name (output)
+   ln_trcdta     =  .false. !  Initialisation from data input file (T) or not (F)
+   ln_trcdmp     =  .false.  !  add a damping termn (T) or not (F)
+!
+!              !    name   !           title of the field              !   units    ! initial data ! save   !
+!              !           !                                           !            ! from file    ! or not ! 
+!              !           !                                           !            ! or not       !        !
+   sn_tracer(1)  = 'CFC11   ' , 'CFC11 Concentration                    ',  'umolC/L',   .false.    ,  .true.
+   sn_tracer(2)  = 'C14B    ' , 'Bomb C14 Concentration                 ',  'ration ',   .false.    ,  .true.
+/
+!-----------------------------------------------------------------------
+&namtrc_dta      !    Initialisation from data input file
+!-----------------------------------------------------------------------
+!
+!                !  file name               ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!                !                          !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+/
+!-----------------------------------------------------------------------
+&namtrc_adv    !   advection scheme for passive tracer 
+!-----------------------------------------------------------------------
+   ln_trcadv_cen2   =  .false.  !  2nd order centered scheme   
+   ln_trcadv_tvd    =  .true.  !  TVD scheme
+   ln_trcadv_muscl  =  .false.   !  MUSCL scheme
+   ln_trcadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries
+   ln_trcadv_ubs    =  .false.  !  UBS scheme
+   ln_trcadv_qck    =  .false.  !  QUICKEST scheme
+/
+!-----------------------------------------------------------------------
+&namtrc_ldf    !   lateral diffusion scheme for passive tracer 
+!-----------------------------------------------------------------------
+   ln_trcldf_diff   =  .true.   !  performs lateral diffusion (T) or not (F)
+!                               !  Type of the operator : 
+   ln_trcldf_lap    =  .true.   !     laplacian operator       
+   ln_trcldf_bilap  =  .false.  !     bilaplacian operator     
+                                !  Direction of action  :
+   ln_trcldf_level  =  .false.  !     iso-level                
+   ln_trcldf_hor    =  .false.  !     horizontal (geopotential)         (require "key_ldfslp" when ln_sco=T)
+   ln_trcldf_iso    =  .true.   !     iso-neutral                       (require "key_ldfslp")
+!                               !  Coefficient
+   rn_ahtrc_0       =  2000.    !  horizontal eddy diffusivity for tracers [m2/s]
+   rn_ahtrb_0       =     0.    !     background eddy diffusivity for ldf_iso [m2/s]
+/
+!-----------------------------------------------------------------------
+&namtrc_zdf        !   vertical physics
+!-----------------------------------------------------------------------
+   ln_trczdf_exp   =  .false.  !  split explicit (T) or implicit (F) time stepping
+   nn_trczdf_exp   =   3       !  number of sub-timestep for ln_trczdfexp=T
+/
+!-----------------------------------------------------------------------
+&namtrc_rad        !  treatment of negative concentrations 
+!-----------------------------------------------------------------------
+   ln_trcrad   =  .true.  !  artificially correct negative concentrations (T) or not (F)
+/
+!-----------------------------------------------------------------------
+&namtrc_dmp    !   passive tracer newtonian damping   
+!-----------------------------------------------------------------------
+   nn_hdmp_tr  =   -1      !  horizontal shape =-1, damping in Med and Red Seas only
+                           !                   =XX, damping poleward of XX degrees (XX>0)
+                           !                      + F(distance-to-coast) + Red and Med Seas
+   nn_zdmp_tr  =    1      !  vertical   shape =0    damping throughout the water column
+                           !                   =1 no damping in the mixing layer (kz  criteria)
+                           !                   =2 no damping in the mixed  layer (rho crieria)
+   rn_surf_tr  =   50.     !  surface time scale of damping   [days]
+   rn_bot_tr   =  360.     !  bottom  time scale of damping   [days]
+   rn_dep_tr   =  800.     !  depth of transition between rn_surf and rn_bot [meters]
+   nn_file_tr  =    0      !  create a damping.coeff NetCDF file (=1) or not (=0)
+/
+!-----------------------------------------------------------------------
+&namtrc_trd       !   diagnostics on tracer trends        ('key_trdtrc')
+!                          or mixed-layer trends          ('key_trdmld_trc')
+!----------------------------------------------------------------------
+   nn_trd_trc  =  10950       !  time step frequency and tracers trends
+   nn_ctls_trc =   0        !  control surface type in mixed-layer trends (0,1 or n<jpk)
+   rn_ucf_trc  =   86400    !  unit conversion factor (=1 -> /seconds ; =86400. -> /day)
+   ln_trdmld_trc_restart = .false.  !  restart for ML diagnostics
+   ln_trdmld_trc_instant = .true.  !  flag to diagnose trends of instantantaneous or mean ML T/S
+   ln_trdtrc(1)  =   .true.
+   ln_trdtrc(2)  =   .true.
+/
+!-----------------------------------------------------------------------
+&namtrc_dia       !   parameters for passive tracer additional diagnostics
+!----------------------------------------------------------------------
+   ln_diatrc     =  .true.   !  save additional diag. (T) or not (F)
+   nn_writedia   =  10950     !  time step frequency for diagnostics
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_splco2.dat
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_splco2.dat	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/1_splco2.dat	(revision 3680)
@@ -0,0 +1,482 @@
+#  4  452
+#   Weighted smoothing spline fit
+# Ice core and Mauna Loa CO2                                       
+# 50% attenuation at     23.4968    ; REG =     100.000 
+#     Time     Smoothed data   
+ 1765.0  277.9514
+ 1765.5  277.9652
+ 1766.0  277.9797
+ 1766.5  277.9949
+ 1767.0  278.0108
+ 1767.5  278.0275
+ 1768.0  278.0448
+ 1768.5  278.0628
+ 1769.0  278.0816
+ 1769.5  278.1011
+ 1770.0  278.1213
+ 1770.5  278.1423
+ 1771.0  278.1640
+ 1771.5  278.1864
+ 1772.0  278.2096
+ 1772.5  278.2335
+ 1773.0  278.2581
+ 1773.5  278.2835
+ 1774.0  278.3097
+ 1774.5  278.3366
+ 1775.0  278.3642
+ 1775.5  278.3927
+ 1776.0  278.4218
+ 1776.5  278.4518
+ 1777.0  278.4825
+ 1777.5  278.5140
+ 1778.0  278.5463
+ 1778.5  278.5793
+ 1779.0  278.6132
+ 1779.5  278.6478
+ 1780.0  278.6832
+ 1780.5  278.7194
+ 1781.0  278.7564
+ 1781.5  278.7942
+ 1782.0  278.8327
+ 1782.5  278.8721
+ 1783.0  278.9123
+ 1783.5  278.9533
+ 1784.0  278.9951
+ 1784.5  279.0378
+ 1785.0  279.0812
+ 1785.5  279.1255
+ 1786.0  279.1706
+ 1786.5  279.2165
+ 1787.0  279.2633
+ 1787.5  279.3109
+ 1788.0  279.3593
+ 1788.5  279.4085
+ 1789.0  279.4586
+ 1789.5  279.5096
+ 1790.0  279.5614
+ 1790.5  279.6140
+ 1791.0  279.6676
+ 1791.5  279.7219
+ 1792.0  279.7772
+ 1792.5  279.8332
+ 1793.0  279.8902
+ 1793.5  279.9480
+ 1794.0  280.0067
+ 1794.5  280.0662
+ 1795.0  280.1266
+ 1795.5  280.1878
+ 1796.0  280.2499
+ 1796.5  280.3129
+ 1797.0  280.3767
+ 1797.5  280.4414
+ 1798.0  280.5069
+ 1798.5  280.5732
+ 1799.0  280.6401
+ 1799.5  280.7077
+ 1800.0  280.7759
+ 1800.5  280.8447
+ 1801.0  280.9139
+ 1801.5  280.9836
+ 1802.0  281.0537
+ 1802.5  281.1241
+ 1803.0  281.1948
+ 1803.5  281.2657
+ 1804.0  281.3369
+ 1804.5  281.4081
+ 1805.0  281.4794
+ 1805.5  281.5508
+ 1806.0  281.6221
+ 1806.5  281.6933
+ 1807.0  281.7644
+ 1807.5  281.8354
+ 1808.0  281.9060
+ 1808.5  281.9764
+ 1809.0  282.0465
+ 1809.5  282.1161
+ 1810.0  282.1853
+ 1810.5  282.2540
+ 1811.0  282.3222
+ 1811.5  282.3897
+ 1812.0  282.4566
+ 1812.5  282.5228
+ 1813.0  282.5882
+ 1813.5  282.6528
+ 1814.0  282.7166
+ 1814.5  282.7794
+ 1815.0  282.8412
+ 1815.5  282.9021
+ 1816.0  282.9619
+ 1816.5  283.0205
+ 1817.0  283.0779
+ 1817.5  283.1343
+ 1818.0  283.1896
+ 1818.5  283.2438
+ 1819.0  283.2971
+ 1819.5  283.3495
+ 1820.0  283.4011
+ 1820.5  283.4519
+ 1821.0  283.5020
+ 1821.5  283.5513
+ 1822.0  283.6001
+ 1822.5  283.6483
+ 1823.0  283.6959
+ 1823.5  283.7432
+ 1824.0  283.7900
+ 1824.5  283.8365
+ 1825.0  283.8827
+ 1825.5  283.9286
+ 1826.0  283.9745
+ 1826.5  284.0201
+ 1827.0  284.0658
+ 1827.5  284.1115
+ 1828.0  284.1573
+ 1828.5  284.2032
+ 1829.0  284.2494
+ 1829.5  284.2958
+ 1830.0  284.3426
+ 1830.5  284.3898
+ 1831.0  284.4375
+ 1831.5  284.4857
+ 1832.0  284.5346
+ 1832.5  284.5842
+ 1833.0  284.6345
+ 1833.5  284.6856
+ 1834.0  284.7376
+ 1834.5  284.7906
+ 1835.0  284.8445
+ 1835.5  284.8995
+ 1836.0  284.9557
+ 1836.5  285.0131
+ 1837.0  285.0718
+ 1837.5  285.1318
+ 1838.0  285.1932
+ 1838.5  285.2561
+ 1839.0  285.3206
+ 1839.5  285.3866
+ 1840.0  285.4543
+ 1840.5  285.5233
+ 1841.0  285.5936
+ 1841.5  285.6647
+ 1842.0  285.7366
+ 1842.5  285.8088
+ 1843.0  285.8812
+ 1843.5  285.9535
+ 1844.0  286.0255
+ 1844.5  286.0971
+ 1845.0  286.1683
+ 1845.5  286.2390
+ 1846.0  286.3091
+ 1846.5  286.3786
+ 1847.0  286.4475
+ 1847.5  286.5157
+ 1848.0  286.5831
+ 1848.5  286.6498
+ 1849.0  286.7157
+ 1849.5  286.7808
+ 1850.0  286.8451
+ 1850.5  286.9087
+ 1851.0  286.9714
+ 1851.5  287.0332
+ 1852.0  287.0943
+ 1852.5  287.1544
+ 1853.0  287.2138
+ 1853.5  287.2722
+ 1854.0  287.3298
+ 1854.5  287.3865
+ 1855.0  287.4423
+ 1855.5  287.4972
+ 1856.0  287.5515
+ 1856.5  287.6052
+ 1857.0  287.6583
+ 1857.5  287.7111
+ 1858.0  287.7635
+ 1858.5  287.8158
+ 1859.0  287.8680
+ 1859.5  287.9202
+ 1860.0  287.9725
+ 1860.5  288.0250
+ 1861.0  288.0778
+ 1861.5  288.1310
+ 1862.0  288.1848
+ 1862.5  288.2392
+ 1863.0  288.2942
+ 1863.5  288.3501
+ 1864.0  288.4070
+ 1864.5  288.4648
+ 1865.0  288.5238
+ 1865.5  288.5840
+ 1866.0  288.6455
+ 1866.5  288.7084
+ 1867.0  288.7726
+ 1867.5  288.8382
+ 1868.0  288.9053
+ 1868.5  288.9737
+ 1869.0  289.0437
+ 1869.5  289.1151
+ 1870.0  289.1880
+ 1870.5  289.2624
+ 1871.0  289.3384
+ 1871.5  289.4160
+ 1872.0  289.4954
+ 1872.5  289.5764
+ 1873.0  289.6592
+ 1873.5  289.7439
+ 1874.0  289.8304
+ 1874.5  289.9188
+ 1875.0  290.0092
+ 1875.5  290.1014
+ 1876.0  290.1957
+ 1876.5  290.2918
+ 1877.0  290.3899
+ 1877.5  290.4898
+ 1878.0  290.5917
+ 1878.5  290.6954
+ 1879.0  290.8010
+ 1879.5  290.9083
+ 1880.0  291.0174
+ 1880.5  291.1281
+ 1881.0  291.2405
+ 1881.5  291.3543
+ 1882.0  291.4697
+ 1882.5  291.5864
+ 1883.0  291.7044
+ 1883.5  291.8237
+ 1884.0  291.9442
+ 1884.5  292.0658
+ 1885.0  292.1885
+ 1885.5  292.3122
+ 1886.0  292.4368
+ 1886.5  292.5622
+ 1887.0  292.6884
+ 1887.5  292.8154
+ 1888.0  292.9430
+ 1888.5  293.0711
+ 1889.0  293.1996
+ 1889.5  293.3284
+ 1890.0  293.4572
+ 1890.5  293.5860
+ 1891.0  293.7147
+ 1891.5  293.8430
+ 1892.0  293.9709
+ 1892.5  294.0982
+ 1893.0  294.2247
+ 1893.5  294.3504
+ 1894.0  294.4751
+ 1894.5  294.5987
+ 1895.0  294.7210
+ 1895.5  294.8422
+ 1896.0  294.9626
+ 1896.5  295.0822
+ 1897.0  295.2014
+ 1897.5  295.3202
+ 1898.0  295.4390
+ 1898.5  295.5578
+ 1899.0  295.6769
+ 1899.5  295.7964
+ 1900.0  295.9167
+ 1900.5  296.0378
+ 1901.0  296.1599
+ 1901.5  296.2834
+ 1902.0  296.4082
+ 1902.5  296.5348
+ 1903.0  296.6631
+ 1903.5  296.7935
+ 1904.0  296.9261
+ 1904.5  297.0609
+ 1905.0  297.1977
+ 1905.5  297.3365
+ 1906.0  297.4772
+ 1906.5  297.6196
+ 1907.0  297.7637
+ 1907.5  297.9093
+ 1908.0  298.0562
+ 1908.5  298.2043
+ 1909.0  298.3535
+ 1909.5  298.5036
+ 1910.0  298.6545
+ 1910.5  298.8061
+ 1911.0  298.9584
+ 1911.5  299.1113
+ 1912.0  299.2648
+ 1912.5  299.4189
+ 1913.0  299.5734
+ 1913.5  299.7285
+ 1914.0  299.8839
+ 1914.5  300.0397
+ 1915.0  300.1958
+ 1915.5  300.3522
+ 1916.0  300.5088
+ 1916.5  300.6656
+ 1917.0  300.8225
+ 1917.5  300.9796
+ 1918.0  301.1368
+ 1918.5  301.2941
+ 1919.0  301.4514
+ 1919.5  301.6087
+ 1920.0  301.7659
+ 1920.5  301.9232
+ 1921.0  302.0803
+ 1921.5  302.2373
+ 1922.0  302.3942
+ 1922.5  302.5508
+ 1923.0  302.7071
+ 1923.5  302.8628
+ 1924.0  303.0179
+ 1924.5  303.1723
+ 1925.0  303.3258
+ 1925.5  303.4783
+ 1926.0  303.6298
+ 1926.5  303.7800
+ 1927.0  303.9290
+ 1927.5  304.0764
+ 1928.0  304.2224
+ 1928.5  304.3668
+ 1929.0  304.5098
+ 1929.5  304.6515
+ 1930.0  304.7920
+ 1930.5  304.9312
+ 1931.0  305.0694
+ 1931.5  305.2066
+ 1932.0  305.3428
+ 1932.5  305.4782
+ 1933.0  305.6128
+ 1933.5  305.7468
+ 1934.0  305.8803
+ 1934.5  306.0135
+ 1935.0  306.1465
+ 1935.5  306.2795
+ 1936.0  306.4126
+ 1936.5  306.5461
+ 1937.0  306.6801
+ 1937.5  306.8148
+ 1938.0  306.9503
+ 1938.5  307.0871
+ 1939.0  307.2251
+ 1939.5  307.3647
+ 1940.0  307.5059
+ 1940.5  307.6490
+ 1941.0  307.7943
+ 1941.5  307.9417
+ 1942.0  308.0917
+ 1942.5  308.2444
+ 1943.0  308.3999
+ 1943.5  308.5586
+ 1944.0  308.7204
+ 1944.5  308.8857
+ 1945.0  309.0544
+ 1945.5  309.2267
+ 1946.0  309.4026
+ 1946.5  309.5824
+ 1947.0  309.7661
+ 1947.5  309.9538
+ 1948.0  310.1455
+ 1948.5  310.3415
+ 1949.0  310.5418
+ 1949.5  310.7465
+ 1950.0  310.9557
+ 1950.5  311.1696
+ 1951.0  311.3883
+ 1951.5  311.6119
+ 1952.0  311.8406
+ 1952.5  312.0746
+ 1953.0  312.3139
+ 1953.5  312.5587
+ 1954.0  312.8091
+ 1954.5  313.0653
+ 1955.0  313.3275
+ 1955.5  313.5958
+ 1956.0  313.8704
+ 1956.5  314.1514
+ 1957.0  314.4390
+ 1957.5  314.7334
+ 1958.0  315.0347
+ 1958.5  315.3430
+ 1959.0  315.6585
+ 1959.5  315.9810
+ 1960.0  316.3099
+ 1960.5  316.6444
+ 1961.0  316.9835
+ 1961.5  317.3266
+ 1962.0  317.6732
+ 1962.5  318.0236
+ 1963.0  318.3782
+ 1963.5  318.7385
+ 1964.0  319.1062
+ 1964.5  319.4833
+ 1965.0  319.8721
+ 1965.5  320.2745
+ 1966.0  320.6922
+ 1966.5  321.1253
+ 1967.0  321.5737
+ 1967.5  322.0377
+ 1968.0  322.5174
+ 1968.5  323.0131
+ 1969.0  323.5248
+ 1969.5  324.0520
+ 1970.0  324.5937
+ 1970.5  325.1487
+ 1971.0  325.7158
+ 1971.5  326.2941
+ 1972.0  326.8828
+ 1972.5  327.4806
+ 1973.0  328.0859
+ 1973.5  328.6966
+ 1974.0  329.3108
+ 1974.5  329.9296
+ 1975.0  330.5549
+ 1975.5  331.1889
+ 1976.0  331.8340
+ 1976.5  332.4917
+ 1977.0  333.1631
+ 1977.5  333.8474
+ 1978.0  334.5436
+ 1978.5  335.2500
+ 1979.0  335.9649
+ 1979.5  336.6871
+ 1980.0  337.4153
+ 1980.5  338.1481
+ 1981.0  338.8848
+ 1981.5  339.6254
+ 1982.0  340.3708
+ 1982.5  341.1221
+ 1983.0  341.8802
+ 1983.5  342.6460
+ 1984.0  343.4197
+ 1984.5  344.2017
+ 1985.0  344.9922
+ 1985.5  345.7917
+ 1986.0  346.6006
+ 1986.5  347.4193
+ 1987.0  348.2476
+ 1987.5  349.0837
+ 1988.0  349.9257
+ 1988.5  350.7702
+ 1989.0  351.6200
+ 1989.5  352.4700
+ 1990.0  353.3200
+ 1990.5  354.1700
+ 1991.0  354.9666
+ 1991.5  355.4840
+ 1992.0  355.9125
+ 1992.5  356.2656
+ 1993.0  356.4832
+ 1993.5  356.9545
+ 1994.0  357.6902
+ 1994.5  358.6209
+ 1995.0  359.6369
+ 1995.5  360.6260
+ 1996.0  361.5229
+ 1996.5  362.3600
+ 1997.0  362.8839
+ 1997.5  363.4538
+ 1998.0  364.7527
+ 1998.5  366.5040
+ 1999.0  367.6363
+ 1999.5  368.1512
+ 2000.0  368.5849
+ 2000.5  369.4103
+ 2001.0  370.3523
+ 2001.5  371.0773
+ 2002.0  371.9717
+ 2002.5  373.1636
+ 2003.0  374.4362
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/AGRIF_FixedGrids.in
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/AGRIF_FixedGrids.in	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/AGRIF_FixedGrids.in	(revision 3680)
@@ -0,0 +1,1 @@
+link ../../ORCA2_LIM/EXP00/AGRIF_FixedGrids.in
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/STRAIT.dat
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/STRAIT.dat	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/STRAIT.dat	(revision 3680)
@@ -0,0 +1,55 @@
+ 
+ Net freshwater budget 
+   fwf    = -3.43323E-06 m3 =   0.00000 Sv
+ 
+   zarea = 3.57005E+14
+   zvol  = 1.32653E+18
+ 
+ Mean sea level : 
+   at nit000 =  0.00000E+00 m3 
+   at nitend = -3.24688E+12 m3 
+   diff      = -3.24688E+12 m3 =  -1.25266 Sv
+   mean sea level elevation    =  -0.00909 m
+ 
+ Anomaly of salinity content : 
+   at nit000 =  5.65470E+14 psu.m3 
+   at nitend = -3.35735E+13 psu.m3 
+   diff      = -5.99044E+14 psu.m3
+ 
+ Mean salinity : 
+   at nit000 =  34.72697 psu 
+   at nitend =  34.72651 psu 
+   diff      =  -0.00045 psu
+   S-SLevitus=  -0.00003 psu
+ 
+ Gibraltar : 
+   Flux entrant (Sv) :   0.4037
+   Flux sortant (Sv) :  -0.8196
+   T entrant (deg)   :  13.1923
+   T sortant (deg)   :  13.0994
+   S entrant (psu)   :  31.3817
+   S sortant (psu)   :  37.7129
+ 
+ Cadiz : 
+   Flux entrant (Sv) :   4.5633
+   Flux sortant (Sv) :  -4.9890
+   T entrant (deg)   :  13.2328
+   T sortant (deg)   :  11.6841
+   S entrant (psu)   :  35.8927
+   S sortant (psu)   :  35.9800
+ 
+ Bab el Mandeb : 
+   Flux entrant (Sv) :   0.4526
+   Flux sortant (Sv) :  -0.4375
+   T entrant (deg)   :  10.1702
+   T sortant (deg)   :  25.0599
+   S entrant (psu)   :  37.7353
+   S sortant (psu)   :  36.2338
+ 
+ Baltic : 
+   Flux entrant (Sv) :   0.0775
+   Flux sortant (Sv) :  -0.0876
+   T entrant (deg)   :   1.5469
+   T sortant (deg)   :   2.6595
+   S entrant (psu)   :   8.1471
+   S sortant (psu)   :  14.5510
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/atmc14.dat
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/atmc14.dat	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/atmc14.dat	(revision 3680)
@@ -0,0 +1,245 @@
+ Year    South 30S-30N   North 
+ 1765.5       0        0      0
+ 1766.5       0        0      0
+ 1767.5       0        0      0
+ 1768.5       0        0      0
+ 1769.5       0        0      0
+ 1770.5       0        0      0
+ 1771.5       0        0      0
+ 1772.5       0        0      0
+ 1773.5       0        0      0
+ 1774.5       0        0      0
+ 1775.5       0        0      0
+ 1776.5       0        0      0
+ 1777.5       0        0      0
+ 1778.5       0        0      0
+ 1779.5       0        0      0
+ 1780.5       0        0      0
+ 1781.5       0        0      0
+ 1782.5       0        0      0
+ 1783.5       0        0      0
+ 1784.5       0        0      0
+ 1785.5       0        0      0
+ 1786.5       0        0      0
+ 1787.5       0        0      0
+ 1788.5       0        0      0
+ 1789.5       0        0      0
+ 1790.5       0        0      0
+ 1791.5       0        0      0
+ 1792.5       0        0      0
+ 1793.5       0        0      0
+ 1794.5       0        0      0
+ 1795.5       0        0      0
+ 1796.5       0        0      0
+ 1797.5       0        0      0
+ 1798.5       0        0      0
+ 1799.5       0        0      0
+ 1800.5       0        0      0
+ 1801.5       0        0      0
+ 1802.5       0        0      0
+ 1803.5       0        0      0
+ 1804.5       0        0      0
+ 1805.5       0        0      0
+ 1806.5       0        0      0
+ 1807.5       0        0      0
+ 1808.5       0        0      0
+ 1809.5       0        0      0
+ 1810.5       0        0      0
+ 1811.5       0        0      0
+ 1812.5       0        0      0
+ 1813.5       0        0      0
+ 1814.5       0        0      0
+ 1815.5       0        0      0
+ 1816.5       0        0      0
+ 1817.5       0        0      0
+ 1818.5       0        0      0
+ 1819.5       0        0      0
+ 1820.5       0        0      0
+ 1821.5       0        0      0
+ 1822.5       0        0      0
+ 1823.5       0        0      0
+ 1824.5       0        0      0
+ 1825.5       0        0      0
+ 1826.5       0        0      0
+ 1827.5       0        0      0
+ 1828.5       0        0      0
+ 1829.5       0        0      0
+ 1830.5       0        0      0
+ 1831.5       0        0      0
+ 1832.5       0        0      0
+ 1833.5       0        0      0
+ 1834.5       0        0      0
+ 1835.5       0        0      0
+ 1836.5       0        0      0
+ 1837.5       0        0      0
+ 1838.5       0        0      0
+ 1839.5       0        0      0
+ 1840.5    -0.9     -0.9   -0.9
+ 1841.5      -1       -1     -1
+ 1842.5    -1.2     -1.2   -1.2
+ 1843.5    -1.3     -1.3   -1.3
+ 1844.5    -1.5     -1.5   -1.5
+ 1845.5    -1.6     -1.6   -1.6
+ 1846.5    -1.7     -1.7   -1.7
+ 1847.5    -1.9     -1.9   -1.9
+ 1848.5      -2       -2     -2
+ 1849.5    -2.2     -2.2   -2.2
+ 1850.5    -2.3     -2.3   -2.3
+ 1851.5    -2.5     -2.5   -2.5
+ 1852.5    -2.6     -2.6   -2.6
+ 1853.5    -2.8     -2.8   -2.8
+ 1854.5      -3       -3     -3
+ 1855.5    -3.1     -3.1   -3.1
+ 1856.5    -3.3     -3.3   -3.3
+ 1857.5    -3.6     -3.6   -3.6
+ 1858.5    -3.8     -3.8   -3.8
+ 1859.5      -4       -4     -4
+ 1860.5    -4.2     -4.2   -4.2
+ 1861.5    -4.5     -4.5   -4.5
+ 1862.5    -4.7     -4.7   -4.7
+ 1863.5    -4.9     -4.9   -4.9
+ 1864.5    -5.2     -5.2   -5.2
+ 1865.5    -5.4     -5.4   -5.4
+ 1866.5    -5.4     -5.4   -5.4
+ 1867.5    -5.4     -5.4   -5.4
+ 1868.5    -5.4     -5.4   -5.4
+ 1869.5    -5.4     -5.4   -5.4
+ 1870.5    -5.4     -5.4   -5.4
+ 1871.5    -5.3     -5.3   -5.3
+ 1872.5    -5.3     -5.3   -5.3
+ 1873.5    -5.3     -5.3   -5.3
+ 1874.5    -5.3     -5.3   -5.3
+ 1875.5    -5.3     -5.3   -5.3
+ 1876.5    -5.3     -5.3   -5.3
+ 1877.5    -5.3     -5.3   -5.3
+ 1878.5    -5.2     -5.2   -5.2
+ 1879.5    -5.2     -5.2   -5.2
+ 1880.5    -5.2     -5.2   -5.2
+ 1881.5    -5.2     -5.2   -5.2
+ 1882.5    -5.2     -5.2   -5.2
+ 1883.5    -5.1     -5.1   -5.1
+ 1884.5    -5.1     -5.1   -5.1
+ 1885.5    -5.1     -5.1   -5.1
+ 1886.5    -4.9     -4.9   -4.9
+ 1887.5    -4.8     -4.8   -4.8
+ 1888.5    -4.6     -4.6   -4.6
+ 1889.5    -4.5     -4.5   -4.5
+ 1890.5      -7     -4.5     -2
+ 1891.5      -7     -4.5     -2
+ 1892.5      -7     -4.5     -2
+ 1893.5      -7     -4.5     -2
+ 1894.5      -7     -4.5     -2
+ 1895.5      -7     -4.5     -2
+ 1896.5    -7.3     -4.8   -2.3
+ 1897.5    -7.7     -5.2   -2.7
+ 1898.5      -8     -5.5     -3
+ 1899.5    -8.3     -5.8   -3.3
+ 1900.5    -8.7     -6.2   -3.7
+ 1901.5      -9     -6.5     -4
+ 1902.5    -9.3     -6.8   -4.3
+ 1903.5    -9.7     -7.2   -4.7
+ 1904.5     -10     -7.5     -5
+ 1905.5   -10.3     -7.8   -5.3
+ 1906.5   -10.7     -8.2   -5.7
+ 1907.5     -11     -8.5     -6
+ 1908.5   -11.3     -8.8   -6.3
+ 1909.5   -11.7     -9.2   -6.7
+ 1910.5     -12     -9.5     -7
+ 1911.5   -12.3     -9.8   -7.3
+ 1912.5   -12.7    -10.2   -7.7
+ 1913.5     -13    -10.5     -8
+ 1914.5   -13.3    -10.8   -8.3
+ 1915.5   -13.7    -11.2   -8.7
+ 1916.5     -14    -11.5     -9
+ 1917.5   -14.3    -11.8   -9.3
+ 1918.5   -14.7    -12.2   -9.7
+ 1919.5     -15    -12.5    -10
+ 1920.5   -15.3    -12.8  -10.3
+ 1921.5   -15.7    -13.2  -10.7
+ 1922.5     -16    -13.5    -11
+ 1923.5   -16.3    -13.8  -11.3
+ 1924.5   -16.7    -14.2  -11.7
+ 1925.5     -17    -14.5    -12
+ 1926.5   -17.3    -14.8  -12.3
+ 1927.5   -17.7    -15.2  -12.7
+ 1928.5     -18    -15.5    -13
+ 1929.5   -18.3    -15.8  -13.3
+ 1930.5   -18.7    -16.2  -13.7
+ 1931.5     -19    -16.5    -14
+ 1932.5   -19.3    -16.8  -14.3
+ 1933.5   -19.7    -17.2  -14.7
+ 1934.5     -20    -17.5    -15
+ 1935.5   -20.3    -17.8  -15.3
+ 1936.5   -20.7    -18.2  -15.7
+ 1937.5     -21    -18.5    -16
+ 1938.5   -21.3    -18.8  -16.3
+ 1939.5   -21.7    -19.2  -16.7
+ 1940.5   -22.2    -21.5  -20.2
+ 1941.5   -21.4    -20.8  -19.4
+ 1942.5   -21.6      -21  -19.6
+ 1943.5   -24.5    -23.9  -22.5
+ 1944.5   -23.7      -23  -21.7
+ 1945.5   -24.1    -23.4  -22.1
+ 1946.5   -23.6    -22.8  -21.6
+ 1947.5   -23.1    -22.2  -21.1
+ 1948.5   -24.3    -23.4  -22.3
+ 1949.5   -26.6    -25.9  -24.6
+ 1950.5   -26.8    -26.1  -24.8
+ 1951.5   -26.8      -26  -24.8
+ 1952.5   -26.9    -25.7  -24.9
+ 1953.5   -25.9    -23.5  -23.9
+ 1954.5   -23.8    -14.4  -21.1
+ 1955.5     -11     -6.4   -8.2
+ 1956.5    14.7     23.4   26.5
+ 1957.5    35.8     51.9     73
+ 1958.5    81.8    105.7  140.2
+ 1959.5   141.1    176.8    228
+ 1960.5   185.6    200.3  212.3
+ 1961.5   198.7    205.8  221.6
+ 1962.5   215.9    256.2  358.5
+ 1963.5   330.6    474.3  718.3
+ 1964.5   520.6    672.3  835.7
+ 1965.5   637.3    697.5  756.3
+ 1966.5   619.7    658.5  691.9
+ 1967.5   585.6    605.4  623.6
+ 1968.5   549.7    559.6  564.5
+ 1969.5   528.5    537.1  545.4
+ 1970.5     506    519.1  529.1
+ 1971.5     489    495.4  499.4
+ 1972.5   461.6    466.6  465.6
+ 1973.5   430.9    426.1  418.6
+ 1974.5   394.9    400.7  400.8
+ 1975.5   378.2    378.7  369.8
+ 1976.5   349.8    354.4  352.5
+ 1977.5   326.7      330  333.9
+ 1978.5   310.2    320.6  325.8
+ 1979.5     291    296.1  295.8
+ 1980.5   274.8      272  264.5
+ 1981.5   257.5    254.8  256.7
+ 1982.5   241.1    241.1  238.3
+ 1983.5   221.5      225  224.2
+ 1984.5   206.7    209.7  209.3
+ 1985.5   197.1      204  201.1
+ 1986.5   187.4    193.9  191.1
+ 1987.5   175.5    186.5  183.6
+ 1988.5   171.6    177.6  174.7
+ 1989.5   157.3    166.6  163.7
+ 1990.5   148.3    155.1  152.2
+ 1991.5   141.2    145.3  142.4
+ 1992.5   132.2    137.6  136.3
+ 1993.5   127.2    131.8  128.7
+ 1994.5   120.4    125.5  122.1
+ 1995.5   114.9      120  115.8
+ 1996.5   110.3    109.6  109.8
+ 1997.5   105.2    109.7    104
+ 1998.5   100.2    103.2  100.3
+ 1999.5    92.7     98.6   95.7
+ 2000.5    86.5     92.6   89.7
+ 2001.5    80.7     87.6   84.8
+ 2002.5    72.9     80.4   77.5
+ 2003.5    79.5     77.4   73.5
+ 2004.5    77.7       75   70.6
+ 2005.5    75.7       73     67
+ 2006.5      75       72     66
+ 2007.5      74       71     65
+ 2008.5      73       70     64
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/cfc1112.atm
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/cfc1112.atm	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/cfc1112.atm	(revision 3680)
@@ -0,0 +1,84 @@
+ % Atmospheric lifetimes are  44.0 for CFC-11 
+ %                       and 125.0 for CFC-12 
+ % rel=  0 
+ %        <-Northern Data-> <-Southern Data->
+ % Year    CFC-11  CFC-12    CFC-11  CFC-12 
+ %         (ppt)   (ppt)      (ppt)   (ppt)
+ 1931.50    0.00    0.00       0.00    0.00   
+ 1932.50    0.00    0.01       0.00    0.01   
+ 1933.50    0.00    0.02       0.00    0.01   
+ 1934.50    0.00    0.03       0.00    0.02   
+ 1935.50    0.00    0.04       0.00    0.03   
+ 1936.50    0.00    0.07       0.00    0.04   
+ 1937.50    0.00    0.11       0.00    0.07   
+ 1938.50    0.00    0.17       0.00    0.11   
+ 1939.50    0.01    0.25       0.00    0.17   
+ 1940.50    0.01    0.37       0.01    0.25   
+ 1941.50    0.02    0.53       0.01    0.36   
+ 1942.50    0.02    0.72       0.02    0.51   
+ 1943.50    0.03    0.94       0.02    0.69   
+ 1944.50    0.04    1.25       0.03    0.91   
+ 1945.50    0.05    1.65       0.04    1.21   
+ 1946.50    0.08    2.33       0.05    1.64   
+ 1947.50    0.14    3.42       0.08    2.33   
+ 1948.50    0.24    4.73       0.14    3.32   
+ 1949.50    0.42    6.10       0.25    4.48   
+ 1950.50    0.67    7.58       0.42    5.77   
+ 1951.50    1.02    9.23       0.66    7.19   
+ 1952.50    1.53   10.94       1.01    8.72   
+ 1953.50    2.21   12.82       1.49   10.37   
+ 1954.50    3.07   14.97       2.13   12.20   
+ 1955.50    4.11   17.40       2.93   14.25   
+ 1956.50    5.39   20.22       3.92   16.59   
+ 1957.50    6.84   23.45       5.11   19.28   
+ 1958.50    8.19   26.86       6.39   22.28   
+ 1959.50    9.47   30.58       7.63   25.52   
+ 1960.50   11.13   35.03       8.96   29.18   
+ 1961.50   13.38   40.12      10.63   33.42   
+ 1962.50   16.23   45.89      12.78   38.25   
+ 1963.50   19.72   52.66      15.47   43.80   
+ 1964.50   23.87   60.57      18.75   50.28   
+ 1965.50   28.57   69.53      22.61   57.76   
+ 1966.50   33.78   79.46      26.99   66.21   
+ 1967.50   39.63   90.60      31.91   75.67   
+ 1968.50   46.27  103.16      37.46   86.31   
+ 1969.50   53.96  117.17      43.80   98.25   
+ 1970.50   62.75  132.52      51.07  111.52   
+ 1971.50   72.36  149.00      59.27  126.02   
+ 1972.50   83.04  166.85      68.34  141.70   
+ 1973.50   95.27  186.59      78.54  158.82   
+ 1974.50  108.81  208.14      90.04  177.62   
+ 1975.50  121.86  229.37     102.29  197.54   
+ 1976.50  134.47  249.51     114.40  217.31   
+ 1977.50  146.47  268.67     126.28  236.49   
+ 1978.50  157.18  286.35     137.45  254.72   
+ 1979.50  166.67  303.74     147.60  272.00   
+ 1980.50  175.11  320.96     158.08  290.34   
+ 1981.50  182.81  337.33     166.54  306.90   
+ 1982.50  189.88  352.01     174.69  323.74   
+ 1983.50  197.72  367.69     183.03  341.15   
+ 1984.50  206.34  383.86     190.95  357.80   
+ 1985.50  216.12  401.25     200.50  376.45   
+ 1986.50  227.48  420.96     209.82  394.00   
+ 1987.50  239.67  441.49     220.60  412.82   
+ 1988.50  251.05  463.22     231.46  433.46   
+ 1989.50  257.28  481.80     240.38  452.97   
+ 1990.50  263.65  493.96     249.23  470.55   
+ 1991.50  266.33  504.64     254.53  484.07   
+ 1992.50  266.00  512.87     258.80  495.65   
+ 1993.50  267.58  520.12     260.56  504.49   
+ 1994.50  267.24  526.58     261.73  512.31   
+ 1995.50  266.38  531.59     261.29  518.39   
+ 1996.50  265.25  534.81     261.08  523.50   
+ 1997.50  263.84  537.67     260.16  528.18   
+ 1998.50  262.24  999.99     258.96  999.99   
+ 1999.50  260.72  999.99     257.75  999.99   
+ 2000.50  259.34  999.99     255.69  999.99   
+ 2001.50  257.13  999.99     253.54  999.99   
+ 2002.50  254.89  999.99     252.93  999.99   
+ 2003.50  251.89  999.99     250.62  999.99   
+ 2004.50  250.67  999.99     249.52  999.99   
+ 2005.50  249.49  999.99     247.45  999.99   
+ 2006.50  248.31  999.99     245.38  999.99
+ 2007.50  247.13  999.99     243.31  999.99
+ 2008.50  245.95  999.99     241.24  999.99
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/iodef.xml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/iodef.xml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/iodef.xml	(revision 3680)
@@ -0,0 +1,1362 @@
+<?xml version="1.0"?>
+<simulation> 
+  
+  <context id="nemo">
+    
+    <!-- $id$ -->
+    
+    <!-- 
+============================================================================================================
+=                                  definition of all existing variables                                    =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+    
+    <field_definition level="1" prec="4" operation="ave(X)" enabled=".TRUE."> <!-- time step automaticaly defined -->
+
+      <!-- T grid -->
+      
+      <group id="grid_T" axis_ref="none" grid_ref="grid_T">
+	<field id="toce"         description="temperature"                               unit="degC" axis_ref="deptht"   />
+       	<field id="soce"         description="salinity"                                  unit="psu"  axis_ref="deptht"   />
+	<field id="sst"          description="sea surface temperature"                   unit="degC"                     />
+	<field id="sst2"         description="square of sea surface temperature"         unit="degC2"                    />
+	<field id="sstgrad"      description="module of sst gradient"                    unit="degC/m"                   />
+	<field id="sstgrad2"     description="square of module of sst gradient"          unit="degC2/m2"                 />
+	<field id="sss"          description="sea surface salinity"                      unit="psu"                      />
+	<field id="sss2"         description="square of sea surface salinity"            unit="psu2"                     />
+	<field id="ssh"          description="sea surface height"                        unit="m"                        />
+	<field id="ssh2"         description="square of sea surface height"              unit="m2"                       />
+	<field id="mldkz5"       description="mixing layer depth (Turbocline)"           unit="m"                        />
+	<field id="mldr10_1"     description="Mixed Layer Depth 0.01 ref.10m"            unit="m"                        />
+       	<field id="rhop"         description="potential density (sigma0)"                unit="kg/m3" axis_ref="deptht"  />
+	<!-- next variables available with key_diahth -->
+	<field id="mlddzt"       description="Thermocline Depth (max dT/dz)"             unit="m"                        />
+	<field id="mldr10_3"     description="Mixed Layer Depth dr=0.03 (ref.10m)"       unit="m"                        />
+	<field id="mldr0_1"      description="Mixed Layer Depth dr=0.01 (ref.surf)"      unit="m"                        />
+	<field id="mldr0_3"      description="Mixed Layer Depth dr=0.03 (ref.surf)"      unit="m"                        />
+	<field id="mld_dt02"     description="Mixed Layer Depth |dt|=0.2 (ref.10m)"      unit="m"                        />
+	<field id="topthdep"     description="Top of the thermocline dt=-0.2 (ref.10m)"  unit="m"                        />
+	<field id="pycndep"      description="Pycnocline depth dr~dt=-0.2 (ref.10m)"     unit="m"                        />
+	<field id="BLT"          description="Barrier Layer Thickness"                   unit="m"                        />
+	<field id="tinv"         description="Max of vertical invertion of temperature"  unit="degC"                     />
+	<field id="depti"        description="Depth of max. vert. inv. of temperature"   unit="m"                        />
+        <field id="20d"          description="Depth of 20C isotherm"                     unit="m"                        />
+	<field id="28d"          description="Depth of 28C isotherm"                     unit="m"                        />
+	<field id="hc300"        description="Heat content 300 m"                        unit="W"                        />
+	<!-- variables available with key_diaar5 -->
+	<field id="botpres"      description="Pressure at sea floor"                     unit="dbar"                     />
+	<field id="cellthc"      description="Cell thickness"                            unit="m"     axis_ref="deptht"  />
+    <!-- tidal composante -->
+    <field id="M2x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="M2y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="S2x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="S2y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="N2x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="N2y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="K1x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="K1y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="O1x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="O1y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="Q1x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="Q1y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="M4x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="M4y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="K2x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="K2y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="P1x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="P1y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="Mfx"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="Mfy"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="Mmx"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="Mmy"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+
+    <field id="M2x_u"          description="M2 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="M2y_u"          description="M2 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="S2x_u"          description="S2 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="S2y_u"          description="S2 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="N2x_u"          description="N2 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="N2y_u"          description="N2 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="K1x_u"          description="K1 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="K1y_u"          description="K1 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="O1x_u"          description="O1 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="O1y_u"          description="O1 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="Q1x_u"          description="Q1 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="Q1y_u"          description="Q1 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="M4x_u"          description="M4 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="M4y_u"          description="M4 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="K2x_u"          description="K2 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="K2y_u"          description="K2 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="P1x_u"          description="P1 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="P1y_u"          description="P1 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="Mfx_u"          description="Mf current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="Mfy_u"          description="Mf current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="Mmx_u"          description="Mm current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="Mmy_u"          description="Mm current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+
+    <field id="M2x_v"          description="M2 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="M2y_v"          description="M2 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="S2x_v"          description="S2 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="S2y_v"          description="S2 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="N2x_v"          description="N2 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="N2y_v"          description="N2 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="K1x_v"          description="K1 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="K1y_v"          description="K1 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="O1x_v"          description="O1 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="O1y_v"          description="O1 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="Q1x_v"          description="Q1 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="Q1y_v"          description="Q1 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="M4x_v"          description="M4 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="M4y_v"          description="M4 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="K2x_v"          description="K2 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="K2y_v"          description="K2 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="P1x_v"          description="P1 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="P1y_v"          description="P1 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="Mfx_v"          description="Mf current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="Mfy_v"          description="Mf current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="Mmx_v"          description="Mm current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="Mmy_v"          description="Mm current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+     </group>
+
+      <!-- SBC -->
+      
+      <group id="SBC" axis_ref="none" grid_ref="grid_T" > <!-- time step automaticaly defined based on nn_fsbc -->
+
+	<field id="empmr"        description="Net Upward Water Flux"                                        unit="kg/m2/s"  />
+	<field id="empsmr"       description="concentration/dilution water flux"                            unit="kg/m2/s"  />
+	<field id="snowpre"      description="Snow precipitation"                                           unit="kg/m2/s"  />
+	<field id="runoffs"      description="River Runoffs"                                                unit="Kg/m2/s"  />
+
+	<field id="qt"           description="Net Downward Heat Flux"                                       unit="W/m2"     />
+	<field id="qns"          description="non solar Downward Heat Flux"                                 unit="W/m2"     />
+	<field id="qsr"          description="Shortwave Radiation"                                          unit="W/m2"     />
+	<field id="qsr3d"        description="Shortwave Radiation 3D distribution"        axis_ref="deptht" unit="W/m2"     />
+	<field id="qrp"          description="Surface Heat Flux: Damping"                                   unit="W/m2"     />
+	<field id="erp"          description="Surface Water Flux: Damping"                                  unit="Kg/m2/s"  />
+	<field id="taum"         description="wind stress module"                                           unit="N/m2"     />
+	<field id="wspd"         description="Wind speed module at 10 m"                                    unit="m/s"      />
+	
+	<!-- * variable relative to atmospheric pressure forcing : available with ln_apr_dyn -->
+	<field id="ssh_ib"       description="Inverse barometer sea surface height"                         unit="m"        />
+
+	<!-- *_oce variables available with ln_blk_clio or ln_blk_core -->
+	<field id="qns_oce"      description="Non solar Downward Heat Flux over open ocean"                 unit="W/m2"     />
+	<field id="qlw_oce"      description="Longwave Downward Heat Flux over open ocean"                  unit="W/m2"     />
+	<field id="qsb_oce"      description="Sensible Downward Heat Flux over open ocean"                  unit="W/m2"     />
+	<field id="qla_oce"      description="Latent Downward Heat Flux over open ocean"                    unit="W/m2"     />
+	<field id="taum_oce"     description="wind stress module over open ocean"                           unit="N/m2"     />
+
+	<field id="ice_cover"    description="Ice fraction"                                                 unit="1"        />
+
+	<field id="ioceflxb"     description="Oceanic flux at the ice base"                                 unit="W/m2"     />
+	<field id="qsr_ai_cea"   description="Air-Ice downward solar heat flux (cell average)"              unit="W/m2"     />
+	<field id="qns_ai_cea"   description="Air-Ice downward non-solar heat flux (cell average)"          unit="W/m2"     />
+	<field id="qla_ai_cea"   description="Air-Ice downward Latent heat flux (cell average)"             unit="W/m2"     />
+	
+	<field id="qsr_io_cea"   description="Ice-Oce downward solar heat flux (cell average)"              unit="W/m2"     />
+	<field id="qns_io_cea"   description="Ice-Oce downward non-solar heat flux (cell average)"          unit="W/m2"     />
+	
+	<field id="snowthic_cea" description="Snow thickness (cell average)"                                unit="m"        />
+	<field id="icethic_cea"  description="Ice thickness (cell average)"                                 unit="m"        />
+	<field id="iceprod_cea"  description="Ice production (cell average)"                                unit="m/s"      />
+	
+	<field id="ice_pres"     description="Ice presence"                                                 unit="-"        />
+	<field id="ist_cea"      description="Ice surface temperature (cell average)"                       unit="degC"     />
+	<field id="ist_ipa"      description="Ice surface temperature (ice presence average)"               unit="degC"     />      
+	<field id="uice_ipa"     description="Ice velocity along i-axis at I-point (ice presence average)"  unit="m/s"      />      
+	<field id="vice_ipa"     description="Ice velocity along j-axis at I-point (ice presence average)"  unit="m/s"      />      
+	
+	<field id="utau_ice"     description="Wind stress along i-axis over the ice at i-point"             unit="N/m2"     />
+	<field id="vtau_ice"     description="Wind stress along j-axis over the ice at i-point"             unit="N/m2"     />
+	
+	<field id="u_imasstr"    description="Sea-ice mass transport along i-axis"                          unit="kg/s"     />
+	<field id="v_imasstr"    description="Sea-ice mass transport along j-axis"                          unit="kg/s"     />
+
+	<!-- available key_coupled -->
+	<field id="snow_ao_cea"  description="Snow over ice-free ocean (cell average)"                      unit="kg/m2/s"  />
+	<field id="snow_ai_cea"  description="Snow over sea-ice (cell average)"                             unit="kg/m2/s"  />
+	<field id="subl_ai_cea"  description="Sublimation over sea-ice (cell average)"                      unit="kg/m2/s"  />
+	<field id="icealb_cea"   description="Ice albedo (cell average)"                                    unit="1"        />
+	<field id="calving"      description="Calving"                                                      unit="kg/m2/s"  />
+	<!-- available if key_coupled + conservative method -->
+	<field id="rain"         description="Liquid precipitation"                                         unit="Kg/m2/s"  />
+	<field id="evap_ao_cea"  description="Evaporation over ice-free ocean (cell average)"               unit="kg/m2/s"  />
+	<!-- variables available with key_diaar5 -->
+	<field id="isnwmlt_cea"   description="Snow over Ice melting (cell average)"                        unit="kg/m2/s"  />
+	<field id="fsal_virt_cea" description="Virtual salt flux due to ice formation (cell average)"       unit="kg/m2/s"  />
+	<field id="fsal_real_cea" description="Real salt flux due to ice formation (cell average)"          unit="kg/m2/s"  />
+	<field id="hflx_rain_cea" description="heat flux due to rainfall"                                   unit="W/m2"     />
+	<field id="hflx_evap_cea" description="heat flux due to evaporation"                                unit="W/m2"     />
+	<field id="hflx_snow_cea" description="heat flux due to snow falling over ice-free ocean"           unit="W/m2"     />
+	<field id="hflx_ice_cea"  description="heat flux due to ice thermodynamics"                         unit="W/m2"     />
+	<field id="hflx_rnf_cea"  description="heat flux due to runoffs"                                    unit="W/m2"     />
+	<field id="hflx_cal_cea"  description="heat flux due to calving"                                    unit="W/m2"     />
+	<field id="bicemel_cea"  description="Rate of Melt at Sea Ice Base (cell average)"                  unit="kg/m2/s"  />
+	<field id="licepro_cea"  description="Lateral Sea Ice Growth Rate (cell average)"                   unit="kg/m2/s"  />
+	<field id="snowmel_cea"  description="Snow Melt Rate (cell average)"                                unit="kg/m2/s"  />
+	<field id="sntoice_cea"  description="Snow-Ice Formation Rate (cell average)"                       unit="kg/m2/s"  />
+	<field id="ticemel_cea"  description="Rate of Melt at Upper Surface of Sea Ice (cell average)"      unit="kg/m2/s"  />
+      </group>
+
+      <!-- U grid -->
+      
+      <group id="grid_U"  axis_ref="depthu" grid_ref="grid_U">
+	<field id="utau"         description="Wind Stress along i-axis"                    unit="N/m2" axis_ref="none" />
+	<field id="uoce"         description="ocean current along i-axis"                  unit="m/s"                  />
+	<field id="uocetr_eff"   description="Effective ocean transport along i-axis"      unit="m3/s"                  />
+	<!-- uoce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="uoce_eiv"     description="EIV ocean current along i-axis"              unit="m/s"                  />
+	<!-- uoce_eiv: available with key_trabbl -->
+	<field id="uoce_bbl"     description="BBL ocean current along i-axis"              unit="m/s"  axis_ref="none" />
+	<field id="ahu_bbl"      description="BBL diffusive flux along i-axis"             unit="m3/s" axis_ref="none" />
+ 	<!-- variables available with key_diaar5 -->
+	<field id="u_masstr"     description="ocean eulerian mass transport along i-axis"  unit="kg/s"                 />
+	<field id="u_heattr"     description="ocean eulerian heat transport along i-axis"  unit="W"    axis_ref="none" />
+	<field id="ueiv_heattr"  description="ocean bolus heat transport along i-axis"     unit="W"    axis_ref="none" />
+	<field id="udiff_heattr" description="ocean diffusion heat transport along i-axis" unit="W"    axis_ref="none" />
+     </group>
+      
+      <!-- V grid -->
+      
+      <group id="grid_V"  axis_ref="depthv" grid_ref="grid_V">
+	<field id="vtau"         description="Wind Stress along j-axis"                    unit="N/m2" axis_ref="none" />
+	<field id="voce"         description="ocean current along j-axis"                  unit="m/s"                  />
+	<field id="vocetr_eff"   description="Effective ocean transport along j-axis"      unit="m3/s"                  />
+	<!-- voce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="voce_eiv"     description="EIV ocean current along j-axis"              unit="m/s"                  />
+	<!-- voce_eiv: available with key_trabbl -->
+	<field id="voce_bbl"     description="BBL ocean current along j-axis"              unit="m/s" axis_ref="none"  />
+	<field id="ahv_bbl"      description="BBL diffusive flux along j-axis"             unit="m3/s" axis_ref="none" />
+	<!-- variables available with key_diaar5 -->
+	<field id="v_masstr"     description="ocean eulerian mass transport along j-axis"  unit="kg/s"                 />
+	<field id="v_heattr"     description="ocean eulerian heat transport along j-axis"  unit="W"    axis_ref="none" />
+	<field id="veiv_heattr"  description="ocean bolus heat transport along j-axis"     unit="W"    axis_ref="none" />
+	<field id="vdiff_heattr" description="ocean diffusion heat transport along j-axis" unit="W"    axis_ref="none" />
+      </group>
+      
+      <!-- W grid -->
+      
+      <group id="grid_W"  axis_ref="depthw" grid_ref="grid_W">
+	<field id="woce"         description="ocean vertical velocity"                     unit="m/s"                  />
+	<field id="wocetr_eff"   description="effective ocean vertical transport"          unit="m3/s"                 />
+	<!-- woce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="woce_eiv"     description="EIV ocean vertical velocity"                 unit="m/s"                  />
+	<!-- woce_eiv: available with key_trabbl_adv -->
+	<field id="avt"          description="vertical eddy diffusivity"                   unit="m2/s"                 />
+	<field id="avm"          description="vertical eddy viscosity"                     unit="m2/s"                 />
+	<!-- avs: available with key_zdfddm -->
+	<field id="avs"          description="salt vertical eddy diffusivity"              unit="m2/s"                 />
+	<!-- avt_evd and avm_evd: available with ln_zdfevd -->
+	<field id="avt_evd"      description="enhanced vertical diffusivity"               unit="m2/s"                 />
+	<field id="avm_evd"      description="enhanced vertical viscosity"                 unit="m2/s"                 />
+	<!-- aht2d and  aht2d_eiv: available with key_traldf_eiv and key_traldf_c2d -->
+	<field id="aht2d"        description="lateral eddy diffusivity"                    unit="m2/s" axis_ref="none" />
+	<field id="aht2d_eiv"    description="EIV lateral eddy diffusivity"                unit="m2/s" axis_ref="none" />
+	<!-- avt_tide: available with key_zdftmx -->
+	<field id="av_tide"      description="tidal vertical diffusivity"                  unit="m2/s"                 />
+	<!-- variables available with key_diaar5 -->   
+	<field id="w_masstr"     description="vertical mass trasport"                      unit="kg/s"                 />
+	<field id="w_masstr2"    description="square of vertical mass trasport"            unit="kg2/s2"               />
+      </group>
+          
+      <!-- scalar -->
+      
+      <!-- variables available with key_diaar5 -->
+      <group id="scalar" axis_ref="none" grid_ref="scalarpoint" zoom_ref="1point" >
+	<field id="voltot"     description="global mean volume"                         unit="m3"   />
+	<field id="sshtot"     description="global mean ssh"                            unit="m"    />
+	<field id="sshsteric"  description="global mean ssh steric"                     unit="m"    />
+	<field id="sshthster"  description="global mean ssh thermosteric"               unit="m"    />
+	<field id="masstot"    description="global mean mass"                           unit="kg"   />
+	<field id="temptot"    description="global mean temperature"                    unit="degC" />
+	<field id="saltot"     description="global mean salinity"                       unit="psu"  />
+	<field id="fram_trans" description="Sea Ice Mass Transport Through Fram Strait" unit="kg/s" />
+      </group>
+
+
+      <!-- variables available with key_float -->
+      <group id="floatvar" axis_ref="nfloat" grid_ref="scalarpoint" zoom_ref="1point">
+        <field id="traj_lon"   description="floats longitude"   unit="deg"   operation="inst(X)" />
+        <field id="traj_lat"   description="floats latitude"    unit="deg"   operation="inst(X)"  />
+        <field id="traj_dep"   description="floats depth"       unit="m"     operation="inst(X)"  />
+        <field id="traj_temp"  description="floats temperature" unit="degC"  operation="inst(X)"  />
+        <field id="traj_salt"  description="floats salinity"    unit="psu"   operation="inst(X)"  />
+        <field id="traj_dens"  description="floats density"     unit="kg/m3" operation="inst(X)"  />
+        <field id="traj_group" description="floats group"       unit="none"  operation="inst(X)"  />
+      </group>
+
+      <!-- ptrc on T grid : variables available with key_top key_cfc key_c14b -->
+     <group id="ptrc_T" axis_ref="deptht" grid_ref="grid_T">
+       <field id="CFC11"    description="CFC-11 Concentration"                     unit="umol/L" />
+       <field id="C14B"     description="Bomb C14 Concentration"                   unit="ration" />
+     </group>
+
+     <!-- diad on T grid : variables available with key_top key_cfc key_c14b  -->
+     <group id="diad_T" axis_ref="none" grid_ref="grid_T">
+       <field id="qtrCFC11"     description="Air-sea flux of CFC-11"                   unit="mol/m2/s"     />
+       <field id="qintCFC11"    description="Cumulative air-sea flux of CFC-11"        unit="mol/m2"     />
+       <field id="qtrC14b"     description="Air-sea flux of Bomb C14"                 unit="mol/m2/s"     />
+       <field id="qintC14b"    description="Cumulative air-sea flux of Bomb C14"      unit="mol/m2"     />
+       <field id="fdecay"       description="Radiactive decay of Bomb C14"             unit="mol/m3"  axis_ref="deptht"  />
+     </group>
+
+    </field_definition>
+
+    <!-- 
+============================================================================================================
+=                                           output files definition                                        =
+=                                            Define your own files                                         =
+=                                         put the variables you want...                                    =
+============================================================================================================
+    -->
+    
+    <file_definition >
+
+      <group id="1h" output_freq="3600"   output_level="10" enabled=".TRUE.">                      <!-- 1h files -->
+      </group>
+      
+      <group id="2h" output_freq="7200"   output_level="10" enabled=".TRUE.">                      <!-- 2h files -->
+      </group>
+      
+      <group id="3h" output_freq="10800"  output_level="10" enabled=".TRUE.">                      <!-- 3h files -->
+      </group>
+      
+      <group id="4h" output_freq="14400"  output_level="10" enabled=".TRUE.">                      <!-- 4h files -->
+      </group>
+      
+      <group id="6h" output_freq="21600"  output_level="10" enabled=".TRUE.">                      <!-- 6h files -->
+      </group>
+      
+      <group id="1d" output_freq="86400"  output_level="10" enabled=".TRUE.">                      <!-- 1d files -->
+
+    <!-- 
+............................................................................................................
+           example of 3 types of 1d files
+............................................................................................................
+    -->
+	<!-- automatic definition of the name based on id="1d_grid_T" 
+	     => this name is used as the radical for all file names of this group
+	     => add a suffix to be sure that all files names of this group are different   -->
+	<group id="1d_grid_T" name="auto" description="ocean T grid variables" >
+	  <!-- mooring: automatic definition of the file name suffix based on id="0n180wT"  -->
+	  <file id="0n180wT" name_suffix="auto" >
+	    <group id="0n180wT" zoom_ref="0n180wT" >    <!-- group of variables sharing the same zoom -->
+	      <field ref="toce" name="votemper"  />
+	      <field ref="uoce" name="vozocrtx"  />     <!-- include a U-grid variable in the list => switch to T-grid -->
+	    </group>
+	  </file>
+	  <!-- Equatorial section: automatic definition of the file name suffix based on id="EqT" -->
+	  <file id="EqT" name_suffix="auto" >
+	    <group id="EqT" zoom_ref="EqT" >
+	      <field ref="toce" name="votemper"  />
+	    </group>
+	  </file>
+	  <!-- global file with different operations on data   -->
+	  <file id="global" >
+	    <field ref="sst"    name="sst_1d_ave"                       />     <!-- mean -->
+	    <field ref="sst"    name="sst_1d_max"  operation="t_max(X)" />     <!-- max -->
+            <field ref="M2x"     name="M2_x_elev"  />
+            <field ref="M2y"     name="M2_y_elev"  />
+	  </file>
+	</group>
+
+        <!-- variables available with key_float, instantaneous fields -->
+<!--
+        <file id="floats"  description="floats variables">
+            <field ref="traj_lon"   name="floats_longitude"   freq_op="86400" />
+            <field ref="traj_lat"   name="floats_latitude"    freq_op="86400" />
+            <field ref="traj_dep"   name="floats_depth"       freq_op="86400" />
+            <field ref="traj_temp"  name="floats_temperature" freq_op="86400" />
+            <field ref="traj_salt"  name="floats_salinity"    freq_op="86400" />
+            <field ref="traj_dens"  name="floats_density"     freq_op="86400" />
+            <field ref="traj_group" name="floats_group"       freq_op="86400" />
+        </file>
+-->
+      </group>
+      
+      <group id="3d" output_freq="259200" output_level="10" enabled=".TRUE.">                      <!-- 3d files -->
+      </group>
+      
+      <group id="5d" output_freq="432000" output_level="10" enabled=".TRUE.">                      <!-- 5d files -->
+
+	<file id="5d_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="toce"         name="votemper"  />
+	  <field ref="soce"         name="vosaline"  />
+	  <field ref="sst"          name="sosstsst"  />
+	  <field ref="sss"          name="sosaline"  />
+	  <field ref="ssh"          name="sossheig"  />
+	  <field ref="empmr"        name="sowaflup"  />
+	  <field ref="qsr"          name="soshfldo"  />
+	  <field ref="empsmr"       name="sowaflcd"  />
+	  <field ref="qt"           name="sohefldo"  />
+	  <field ref="mldr10_1"     name="somxl010"  />
+	  <field ref="mldkz5"       name="somixhgt"  />
+	  <field ref="ice_cover"    name="soicecov"  />
+	  <field ref="wspd"         name="sowindsp"  />
+	  <field ref="qrp"          name="sohefldp"  />
+	  <field ref="erp"          name="sowafldp"  />
+	  <field ref="mlddzt"       name="sothedep"  />
+	  <field ref="20d"          name="so20chgt"  />
+	  <field ref="28d"          name="so28chgt"  />
+	  <field ref="hc300"        name="sohtc300"  />
+	  <field ref="ist_ipa"      name="soicetem"  />
+	  <field ref="icealb_cea"   name="soicealb"  />   
+	</file>
+	
+	<file id="5d_grid_U" name="auto" description="ocean U grid variables" >
+	  <field ref="uoce"         name="vozocrtx"  />
+	  <field ref="uoce_eiv"     name="vozoeivu"  />
+	  <field ref="utau"         name="sozotaux"  />
+	</file>
+	
+	<file id="5d_grid_V" name="auto" description="ocean V grid variables" >
+	  <field ref="voce"         name="vomecrty"  />
+	  <field ref="voce_eiv"     name="vomeeivv"  />
+	  <field ref="vtau"         name="sometauy"  />
+	</file>
+	
+	<file id="5d_grid_W" name="auto" description="ocean W grid variables" >
+	  <field ref="woce"         name="vovecrtz" />
+	  <field ref="woce_eiv"     name="voveeivw" />
+	  <field ref="avt"          name="votkeavt" />
+	  <field ref="avt_evd"      name="votkeevd" />
+	  <field ref="avm"          name="votkeavm" />
+	  <field ref="avm_evd"      name="votkeevm" />
+	  <field ref="avs"          name="voddmavs" />
+	  <field ref="aht2d"        name="soleahtw" />
+	  <field ref="aht2d_eiv"    name="soleaeiw" />
+	</file>
+	
+	<file id="5d_icemod" name="auto" description="ice variables" >
+	  <field ref="ice_pres"                     />
+	  <field ref="snowthic_cea" name="isnowthi" />
+	  <field ref="icethic_cea"  name="iicethic" />
+	  <field ref="iceprod_cea"  name="iiceprod" />
+	  <field ref="ist_ipa"      name="iicetemp" />
+	  <field ref="ioceflxb"     name="ioceflxb" />
+	  <field ref="uice_ipa"     name="iicevelu" />
+	  <field ref="vice_ipa"     name="iicevelv" />
+	  <field ref="utau_ice"     name="iicestru" />
+	  <field ref="vtau_ice"     name="iicestrv" />
+	  <field ref="qsr_io_cea"   name="iicesflx" />
+	  <field ref="qns_io_cea"   name="iicenflx" />
+	  <field ref="snowpre"      name="isnowpre" />
+	</file>
+
+        <file id="5d_ptrc_T" name="auto" description="pisces sms variables" >
+          <field ref="CFC11"      />
+          <field ref="C14B"      />
+       </file>
+
+        <file id="5d_diad_T" name="auto" description="pisces sms variables" >
+          <field ref="qintCFC11"     />
+          <field ref="qtrCFC11"     />
+          <field ref="qintC14b"     />
+          <field ref="qtrC14b"     />
+          <field ref="fdecay"     />
+       </file>
+	
+      </group>
+      
+      <group id="1m" output_freq="-1"     output_level="10" enabled=".TRUE.">                      <!-- real monthly files -->
+
+	<file id="1m_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="sst"          name="sosstsst"  />
+	</file>   
+
+      </group>
+
+      <group id="2m" output_freq="-2"     output_level="10" enabled=".TRUE.">                      <!-- real 2m files -->
+      </group>
+
+      <group id="3m" output_freq="-3"     output_level="10" enabled=".TRUE.">                      <!-- real 3m files -->
+      </group>
+
+      <group id="4m" output_freq="-4"     output_level="10" enabled=".TRUE.">                      <!-- real 4m files -->
+      </group>
+
+      <group id="6m" output_freq="-6"     output_level="10" enabled=".TRUE.">                      <!-- real 6m files -->
+      </group>
+
+      <group id="1y" output_freq="-12"    output_level="10" enabled=".TRUE.">                      <!-- real yearly files -->
+
+	<file id="1y_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="mldr10_1"     name="sobowlin"  operation="t_max(X)" />
+	</file>
+
+      </group>
+
+      <group id="2y"  output_freq="-24"   output_level="10" enabled=".TRUE.">                      <!-- real 2y files -->
+      </group>
+
+      <group id="5y"  output_freq="-60"   output_level="10" enabled=".TRUE.">                      <!-- real 5y files -->
+      </group>
+
+      <group id="10y" output_freq="-120"  output_level="10" enabled=".TRUE.">                      <!-- real 10y files -->
+      </group>
+
+    </file_definition>
+    
+    <!-- 
+============================================================================================================
+=                                           grid definition                                                =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+    
+    <axis_definition>  
+      <axis id="deptht" description="Vertical T levels" unit="m"       positive=".false." />
+      <axis id="depthu" description="Vertical U levels" unit="m"       positive=".false." />
+      <axis id="depthv" description="Vertical V levels" unit="m"       positive=".false." />
+      <axis id="depthw" description="Vertical W levels" unit="m"       positive=".false." />
+      <axis id="nfloat" description="Number of float"   unit="no unit" positive=".false." />
+      <axis id="none" description="axe non defini" unit="none" size="1" />
+    </axis_definition> 
+    
+    <grid_definition>
+      <grid id="grid_T" description="grid T" >
+    <!--   Eq section   -->
+	<zoom id="EqT" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+    <!--   TAO   -->
+      <!--   137e   -->
+	<zoom id="2n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   147e   -->
+	<zoom id="0n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   156e   -->
+	<zoom id="5s156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   165e   -->
+	<zoom id="8s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   180w   -->
+	<zoom id="8s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   170w   -->
+	<zoom id="8s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   155w   -->
+	<zoom id="8s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   140w   -->
+	<zoom id="8s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   125w   -->
+	<zoom id="8s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   110w   -->
+	<zoom id="8s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   95w   -->
+	<zoom id="8s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+    <!--   RAMA   -->
+      <!--   55e   -->
+	<zoom id="16s55eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s55eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+ 	<zoom id="8s55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s55eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n55eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   65e   -->
+	<zoom id="15n65eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   67e   -->
+	<zoom id="16s67eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s67eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s67eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n67eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   80.5e   -->
+	<zoom id="16s80.5eT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s80.5eT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s80.5eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n80.5eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   90e   -->
+	<zoom id="1.5s90eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n90eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n90eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="15n90eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   95e   -->
+	<zoom id="16s95eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s95eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s95eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s95eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+    <!--   PIRATA   -->
+      <!--   38w-30w   -->
+	<zoom id="19s34wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="14s32wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s30wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n35wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n38wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n38wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="15n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="20n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   23w   -->
+	<zoom id="0n23wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n23wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n23wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="21n23wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   10w   -->
+	<zoom id="10s10wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="6s10wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n10wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   0e   -->
+	<zoom id="0n0eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      </grid>
+
+      <grid id="grid_U" description="grid U" >
+    <!--   Eq section   -->
+	<zoom id="EqU" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+      </grid>
+
+      <grid id="grid_V" description="grid V" >
+      </grid>
+
+      <grid id="grid_W" description="grid W" >
+    <!--   Eq section   -->
+	<zoom id="EqW" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+      </grid>
+
+      <grid id="scalarpoint" description="scalar" >
+	<zoom id="1point" ibegin="1" jbegin="1" ni="1" nj="1" />
+      </grid>
+
+    </grid_definition>    
+    
+  </context>
+  <context id="1_nemo">
+    
+    <!-- $id$ -->
+    
+    <!-- 
+============================================================================================================
+=                                  definition of all existing variables                                    =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+    
+    <field_definition level="1" prec="4" operation="ave(X)" enabled=".TRUE."> <!-- time step automaticaly defined -->
+
+      <!-- T grid -->
+      
+      <group id="grid_T" axis_ref="none" grid_ref="grid_T">
+	<field id="toce"         description="temperature"                               unit="degC" axis_ref="deptht"   />
+       	<field id="soce"         description="salinity"                                  unit="psu"  axis_ref="deptht"   />
+	<field id="sst"          description="sea surface temperature"                   unit="degC"                     />
+	<field id="sst2"         description="square of sea surface temperature"         unit="degC2"                    />
+	<field id="sstgrad"      description="module of sst gradient"                    unit="degC/m"                   />
+	<field id="sstgrad2"     description="square of module of sst gradient"          unit="degC2/m2"                 />
+	<field id="sss"          description="sea surface salinity"                      unit="psu"                      />
+	<field id="sss2"         description="square of sea surface salinity"            unit="psu2"                     />
+	<field id="ssh"          description="sea surface height"                        unit="m"                        />
+	<field id="ssh2"         description="square of sea surface height"              unit="m2"                       />
+	<field id="mldkz5"       description="mixing layer depth (Turbocline)"           unit="m"                        />
+	<field id="mldr10_1"     description="Mixed Layer Depth 0.01 ref.10m"            unit="m"                        />
+       	<field id="rhop"         description="potential density (sigma0)"                unit="kg/m3" axis_ref="deptht"  />
+	<!-- next variables available with key_diahth -->
+	<field id="mlddzt"       description="Thermocline Depth (max dT/dz)"             unit="m"                        />
+	<field id="mldr10_3"     description="Mixed Layer Depth dr=0.03 (ref.10m)"       unit="m"                        />
+	<field id="mldr0_1"      description="Mixed Layer Depth dr=0.01 (ref.surf)"      unit="m"                        />
+	<field id="mldr0_3"      description="Mixed Layer Depth dr=0.03 (ref.surf)"      unit="m"                        />
+	<field id="mld_dt02"     description="Mixed Layer Depth |dt|=0.2 (ref.10m)"      unit="m"                        />
+	<field id="topthdep"     description="Top of the thermocline dt=-0.2 (ref.10m)"  unit="m"                        />
+	<field id="pycndep"      description="Pycnocline depth dr~dt=-0.2 (ref.10m)"     unit="m"                        />
+	<field id="BLT"          description="Barrier Layer Thickness"                   unit="m"                        />
+	<field id="tinv"         description="Max of vertical invertion of temperature"  unit="degC"                     />
+	<field id="depti"        description="Depth of max. vert. inv. of temperature"   unit="m"                        />
+        <field id="20d"          description="Depth of 20C isotherm"                     unit="m"                        />
+	<field id="28d"          description="Depth of 28C isotherm"                     unit="m"                        />
+	<field id="hc300"        description="Heat content 300 m"                        unit="W"                        />
+	<!-- variables available with key_diaar5 -->
+	<field id="botpres"      description="Pressure at sea floor"                     unit="dbar"                     />
+	<field id="cellthc"      description="Cell thickness"                            unit="m"     axis_ref="deptht"  />
+    <!-- tidal composante -->
+    <field id="M2x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="M2y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="S2x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="S2y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="N2x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="N2y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="K1x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="K1y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="O1x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="O1y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="Q1x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="Q1y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="M4x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="M4y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="K2x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="K2y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="P1x"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="P1y"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="Mfx"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="Mfy"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+    <field id="Mmx"          description="M2 Elevation harmonic real part "                             unit="m"        />
+    <field id="Mmy"          description="M2 Elevation harmonic imaginary part"                         unit="m"        />
+
+    <field id="M2x_u"          description="M2 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="M2y_u"          description="M2 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="S2x_u"          description="S2 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="S2y_u"          description="S2 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="N2x_u"          description="N2 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="N2y_u"          description="N2 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="K1x_u"          description="K1 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="K1y_u"          description="K1 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="O1x_u"          description="O1 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="O1y_u"          description="O1 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="Q1x_u"          description="Q1 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="Q1y_u"          description="Q1 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="M4x_u"          description="M4 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="M4y_u"          description="M4 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="K2x_u"          description="K2 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="K2y_u"          description="K2 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="P1x_u"          description="P1 current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="P1y_u"          description="P1 current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="Mfx_u"          description="Mf current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="Mfy_u"          description="Mf current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+    <field id="Mmx_u"          description="Mm current barotrope along i-axis harmonic real part "      unit="m/s"        />
+    <field id="Mmy_u"          description="Mm current barotrope along i-axis harmonic imaginary part " unit="m/s"        />
+
+    <field id="M2x_v"          description="M2 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="M2y_v"          description="M2 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="S2x_v"          description="S2 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="S2y_v"          description="S2 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="N2x_v"          description="N2 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="N2y_v"          description="N2 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="K1x_v"          description="K1 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="K1y_v"          description="K1 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="O1x_v"          description="O1 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="O1y_v"          description="O1 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="Q1x_v"          description="Q1 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="Q1y_v"          description="Q1 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="M4x_v"          description="M4 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="M4y_v"          description="M4 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="K2x_v"          description="K2 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="K2y_v"          description="K2 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="P1x_v"          description="P1 current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="P1y_v"          description="P1 current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="Mfx_v"          description="Mf current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="Mfy_v"          description="Mf current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+    <field id="Mmx_v"          description="Mm current barotrope along j-axis harmonic real part "      unit="m/s"        />
+    <field id="Mmy_v"          description="Mm current barotrope along j-axis harmonic imaginary part " unit="m/s"        />
+     </group>
+
+      <!-- SBC -->
+      
+      <group id="SBC" axis_ref="none" grid_ref="grid_T" > <!-- time step automaticaly defined based on nn_fsbc -->
+
+	<field id="empmr"        description="Net Upward Water Flux"                                        unit="kg/m2/s"  />
+	<field id="empsmr"       description="concentration/dilution water flux"                            unit="kg/m2/s"  />
+	<field id="snowpre"      description="Snow precipitation"                                           unit="kg/m2/s"  />
+	<field id="runoffs"      description="River Runoffs"                                                unit="Kg/m2/s"  />
+
+	<field id="qt"           description="Net Downward Heat Flux"                                       unit="W/m2"     />
+	<field id="qns"          description="non solar Downward Heat Flux"                                 unit="W/m2"     />
+	<field id="qsr"          description="Shortwave Radiation"                                          unit="W/m2"     />
+	<field id="qsr3d"        description="Shortwave Radiation 3D distribution"        axis_ref="deptht" unit="W/m2"     />
+	<field id="qrp"          description="Surface Heat Flux: Damping"                                   unit="W/m2"     />
+	<field id="erp"          description="Surface Water Flux: Damping"                                  unit="Kg/m2/s"  />
+	<field id="taum"         description="wind stress module"                                           unit="N/m2"     />
+	<field id="wspd"         description="Wind speed module at 10 m"                                    unit="m/s"      />
+	
+	<!-- * variable relative to atmospheric pressure forcing : available with ln_apr_dyn -->
+	<field id="ssh_ib"       description="Inverse barometer sea surface height"                         unit="m"        />
+
+	<!-- *_oce variables available with ln_blk_clio or ln_blk_core -->
+	<field id="qns_oce"      description="Non solar Downward Heat Flux over open ocean"                 unit="W/m2"     />
+	<field id="qlw_oce"      description="Longwave Downward Heat Flux over open ocean"                  unit="W/m2"     />
+	<field id="qsb_oce"      description="Sensible Downward Heat Flux over open ocean"                  unit="W/m2"     />
+	<field id="qla_oce"      description="Latent Downward Heat Flux over open ocean"                    unit="W/m2"     />
+	<field id="taum_oce"     description="wind stress module over open ocean"                           unit="N/m2"     />
+
+	<field id="ice_cover"    description="Ice fraction"                                                 unit="1"        />
+
+	<field id="ioceflxb"     description="Oceanic flux at the ice base"                                 unit="W/m2"     />
+	<field id="qsr_ai_cea"   description="Air-Ice downward solar heat flux (cell average)"              unit="W/m2"     />
+	<field id="qns_ai_cea"   description="Air-Ice downward non-solar heat flux (cell average)"          unit="W/m2"     />
+	<field id="qla_ai_cea"   description="Air-Ice downward Latent heat flux (cell average)"             unit="W/m2"     />
+	
+	<field id="qsr_io_cea"   description="Ice-Oce downward solar heat flux (cell average)"              unit="W/m2"     />
+	<field id="qns_io_cea"   description="Ice-Oce downward non-solar heat flux (cell average)"          unit="W/m2"     />
+	
+	<field id="snowthic_cea" description="Snow thickness (cell average)"                                unit="m"        />
+	<field id="icethic_cea"  description="Ice thickness (cell average)"                                 unit="m"        />
+	<field id="iceprod_cea"  description="Ice production (cell average)"                                unit="m/s"      />
+	
+	<field id="ice_pres"     description="Ice presence"                                                 unit="-"        />
+	<field id="ist_cea"      description="Ice surface temperature (cell average)"                       unit="degC"     />
+	<field id="ist_ipa"      description="Ice surface temperature (ice presence average)"               unit="degC"     />      
+	<field id="uice_ipa"     description="Ice velocity along i-axis at I-point (ice presence average)"  unit="m/s"      />      
+	<field id="vice_ipa"     description="Ice velocity along j-axis at I-point (ice presence average)"  unit="m/s"      />      
+	
+	<field id="utau_ice"     description="Wind stress along i-axis over the ice at i-point"             unit="N/m2"     />
+	<field id="vtau_ice"     description="Wind stress along j-axis over the ice at i-point"             unit="N/m2"     />
+	
+	<field id="u_imasstr"    description="Sea-ice mass transport along i-axis"                          unit="kg/s"     />
+	<field id="v_imasstr"    description="Sea-ice mass transport along j-axis"                          unit="kg/s"     />
+
+	<!-- available key_coupled -->
+	<field id="snow_ao_cea"  description="Snow over ice-free ocean (cell average)"                      unit="kg/m2/s"  />
+	<field id="snow_ai_cea"  description="Snow over sea-ice (cell average)"                             unit="kg/m2/s"  />
+	<field id="subl_ai_cea"  description="Sublimation over sea-ice (cell average)"                      unit="kg/m2/s"  />
+	<field id="icealb_cea"   description="Ice albedo (cell average)"                                    unit="1"        />
+	<field id="calving"      description="Calving"                                                      unit="kg/m2/s"  />
+	<!-- available if key_coupled + conservative method -->
+	<field id="rain"         description="Liquid precipitation"                                         unit="Kg/m2/s"  />
+	<field id="evap_ao_cea"  description="Evaporation over ice-free ocean (cell average)"               unit="kg/m2/s"  />
+	<!-- variables available with key_diaar5 -->
+	<field id="isnwmlt_cea"   description="Snow over Ice melting (cell average)"                        unit="kg/m2/s"  />
+	<field id="fsal_virt_cea" description="Virtual salt flux due to ice formation (cell average)"       unit="kg/m2/s"  />
+	<field id="fsal_real_cea" description="Real salt flux due to ice formation (cell average)"          unit="kg/m2/s"  />
+	<field id="hflx_rain_cea" description="heat flux due to rainfall"                                   unit="W/m2"     />
+	<field id="hflx_evap_cea" description="heat flux due to evaporation"                                unit="W/m2"     />
+	<field id="hflx_snow_cea" description="heat flux due to snow falling over ice-free ocean"           unit="W/m2"     />
+	<field id="hflx_ice_cea"  description="heat flux due to ice thermodynamics"                         unit="W/m2"     />
+	<field id="hflx_rnf_cea"  description="heat flux due to runoffs"                                    unit="W/m2"     />
+	<field id="hflx_cal_cea"  description="heat flux due to calving"                                    unit="W/m2"     />
+	<field id="bicemel_cea"  description="Rate of Melt at Sea Ice Base (cell average)"                  unit="kg/m2/s"  />
+	<field id="licepro_cea"  description="Lateral Sea Ice Growth Rate (cell average)"                   unit="kg/m2/s"  />
+	<field id="snowmel_cea"  description="Snow Melt Rate (cell average)"                                unit="kg/m2/s"  />
+	<field id="sntoice_cea"  description="Snow-Ice Formation Rate (cell average)"                       unit="kg/m2/s"  />
+	<field id="ticemel_cea"  description="Rate of Melt at Upper Surface of Sea Ice (cell average)"      unit="kg/m2/s"  />
+
+      </group>
+
+      <!-- U grid -->
+      
+      <group id="grid_U"  axis_ref="depthu" grid_ref="grid_U">
+	<field id="utau"         description="Wind Stress along i-axis"                    unit="N/m2" axis_ref="none" />
+	<field id="uoce"         description="ocean current along i-axis"                  unit="m/s"                  />
+	<field id="uocetr_eff"   description="Effective ocean transport along i-axis"      unit="m3/s"                  />
+	<!-- uoce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="uoce_eiv"     description="EIV ocean current along i-axis"              unit="m/s"                  />
+	<!-- uoce_eiv: available with key_trabbl -->
+	<field id="uoce_bbl"     description="BBL ocean current along i-axis"              unit="m/s"  axis_ref="none" />
+	<field id="ahu_bbl"      description="BBL diffusive flux along i-axis"             unit="m3/s" axis_ref="none" />
+ 	<!-- variables available with key_diaar5 -->
+	<field id="u_masstr"     description="ocean eulerian mass transport along i-axis"  unit="kg/s"                 />
+	<field id="u_heattr"     description="ocean eulerian heat transport along i-axis"  unit="W"    axis_ref="none" />
+	<field id="ueiv_heattr"  description="ocean bolus heat transport along i-axis"     unit="W"    axis_ref="none" />
+	<field id="udiff_heattr" description="ocean diffusion heat transport along i-axis" unit="W"    axis_ref="none" />
+     </group>
+      
+      <!-- V grid -->
+      
+      <group id="grid_V"  axis_ref="depthv" grid_ref="grid_V">
+	<field id="vtau"         description="Wind Stress along j-axis"                    unit="N/m2" axis_ref="none" />
+	<field id="voce"         description="ocean current along j-axis"                  unit="m/s"                  />
+	<field id="vocetr_eff"   description="Effective ocean transport along j-axis"      unit="m3/s"                  />
+	<!-- voce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="voce_eiv"     description="EIV ocean current along j-axis"              unit="m/s"                  />
+	<!-- voce_eiv: available with key_trabbl -->
+	<field id="voce_bbl"     description="BBL ocean current along j-axis"              unit="m/s" axis_ref="none"  />
+	<field id="ahv_bbl"      description="BBL diffusive flux along j-axis"             unit="m3/s" axis_ref="none" />
+	<!-- variables available with key_diaar5 -->
+	<field id="v_masstr"     description="ocean eulerian mass transport along j-axis"  unit="kg/s"                 />
+	<field id="v_heattr"     description="ocean eulerian heat transport along j-axis"  unit="W"    axis_ref="none" />
+	<field id="veiv_heattr"  description="ocean bolus heat transport along j-axis"     unit="W"    axis_ref="none" />
+	<field id="vdiff_heattr" description="ocean diffusion heat transport along j-axis" unit="W"    axis_ref="none" />
+      </group>
+      
+      <!-- W grid -->
+      
+      <group id="grid_W"  axis_ref="depthw" grid_ref="grid_W">
+	<field id="woce"         description="ocean vertical velocity"                     unit="m/s"                  />
+	<field id="wocetr_eff"   description="effective ocean vertical transport"          unit="m3/s"                 />
+	<!-- woce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="woce_eiv"     description="EIV ocean vertical velocity"                 unit="m/s"                  />
+	<!-- woce_eiv: available with key_trabbl_adv -->
+	<field id="avt"          description="vertical eddy diffusivity"                   unit="m2/s"                 />
+	<field id="avm"          description="vertical eddy viscosity"                     unit="m2/s"                 />
+	<!-- avs: available with key_zdfddm -->
+	<field id="avs"          description="salt vertical eddy diffusivity"              unit="m2/s"                 />
+	<!-- avt_evd and avm_evd: available with ln_zdfevd -->
+	<field id="avt_evd"      description="enhanced vertical diffusivity"               unit="m2/s"                 />
+	<field id="avm_evd"      description="enhanced vertical viscosity"                 unit="m2/s"                 />
+	<!-- aht2d and  aht2d_eiv: available with key_traldf_eiv and key_traldf_c2d -->
+	<field id="aht2d"        description="lateral eddy diffusivity"                    unit="m2/s" axis_ref="none" />
+	<field id="aht2d_eiv"    description="EIV lateral eddy diffusivity"                unit="m2/s" axis_ref="none" />
+	<!-- avt_tide: available with key_zdftmx -->
+	<field id="av_tide"      description="tidal vertical diffusivity"                  unit="m2/s"                 />
+	<!-- variables available with key_diaar5 -->   
+	<field id="w_masstr"     description="vertical mass trasport"                      unit="kg/s"                 />
+	<field id="w_masstr2"    description="square of vertical mass trasport"            unit="kg2/s2"               />
+      </group>
+          
+      <!-- scalar -->
+      
+      <!-- variables available with key_diaar5 -->
+      <group id="scalar" axis_ref="none" grid_ref="scalarpoint" zoom_ref="1point" >
+	<field id="voltot"     description="global mean volume"                         unit="m3"   />
+	<field id="sshtot"     description="global mean ssh"                            unit="m"    />
+	<field id="sshsteric"  description="global mean ssh steric"                     unit="m"    />
+	<field id="sshthster"  description="global mean ssh thermosteric"               unit="m"    />
+	<field id="masstot"    description="global mean mass"                           unit="kg"   />
+	<field id="temptot"    description="global mean temperature"                    unit="degC" />
+	<field id="saltot"     description="global mean salinity"                       unit="psu"  />
+	<field id="fram_trans" description="Sea Ice Mass Transport Through Fram Strait" unit="kg/s" />
+      </group>
+
+      <!-- variables available with key_float -->
+      <group id="floatvar" axis_ref="nfloat" grid_ref="scalarpoint" zoom_ref="1point">
+        <field id="traj_lon"   description="floats longitude"   unit="deg"   operation="inst(X)" />
+        <field id="traj_lat"   description="floats latitude"    unit="deg"   operation="inst(X)"  />
+        <field id="traj_dep"   description="floats depth"       unit="m"     operation="inst(X)"  />
+        <field id="traj_temp"  description="floats temperature" unit="degC"  operation="inst(X)"  />
+        <field id="traj_salt"  description="floats salinity"    unit="psu"   operation="inst(X)"  />
+        <field id="traj_dens"  description="floats density"     unit="kg/m3" operation="inst(X)"  />
+        <field id="traj_group" description="floats group"       unit="none"  operation="inst(X)"  />
+      </group>
+
+      <!-- ptrc on T grid : variables available with key_top key_cfc key_c14b -->
+     <group id="ptrc_T" axis_ref="deptht" grid_ref="grid_T">
+       <field id="CFC11"    description="CFC-11 Concentration"                     unit="umol/L" />
+       <field id="C14B"     description="Bomb C14 Concentration"                   unit="ration" />
+     </group>
+
+     <!-- diad on T grid : variables available with key_top key_cfc key_c14b  -->
+     <group id="diad_T" axis_ref="none" grid_ref="grid_T">
+       <field id="qtrCFC11"     description="Air-sea flux of CFC-11"                   unit="mol/m2/s"     />
+       <field id="qintCFC11"    description="Cumulative air-sea flux of CFC-11"        unit="mol/m2"     />
+       <field id="qtrC14b"     description="Air-sea flux of Bomb C14"                 unit="mol/m2/s"     />
+       <field id="qintC14b"    description="Cumulative air-sea flux of Bomb C14"      unit="mol/m2"     />
+       <field id="fdecay"       description="Radiactive decay of Bomb C14"             unit="mol/m3"  axis_ref="deptht"  />
+     </group>
+
+    </field_definition>
+    
+    <!-- 
+============================================================================================================
+=                                           output files definition                                        =
+=                                            Define your own files                                         =
+=                                         put the variables you want...                                    =
+============================================================================================================
+    -->
+    
+    <file_definition >
+
+      <group id="1h" output_freq="3600"   output_level="10" enabled=".TRUE.">                      <!-- 1h files -->
+      </group>
+      
+      <group id="2h" output_freq="7200"   output_level="10" enabled=".TRUE.">                      <!-- 2h files -->
+      </group>
+      
+      <group id="3h" output_freq="10800"  output_level="10" enabled=".TRUE.">                      <!-- 3h files -->
+      </group>
+      
+      <group id="4h" output_freq="14400"  output_level="10" enabled=".TRUE.">                      <!-- 4h files -->
+      </group>
+      
+      <group id="6h" output_freq="21600"  output_level="10" enabled=".TRUE.">                      <!-- 6h files -->
+      </group>
+      
+      <group id="1d" output_freq="86400"  output_level="10" enabled=".TRUE.">                      <!-- 1d files -->
+
+    <!-- 
+............................................................................................................
+           example of 3 types of 1d files
+............................................................................................................
+    -->
+        <!-- automatic definition of the name based on id="1d_grid_T"
+             => this name is used as the radical for all file names of this group
+             => add a suffix to be sure that all files names of this group are different   -->
+        <group id="1d_grid_T" name="auto" description="ocean T grid variables" >
+          <!-- global file with different operations on data   -->
+          <file id="global" >
+            <field ref="sst"    name="sst_1d_ave"                       />     <!-- mean -->
+            <field ref="sst"    name="sst_1d_max"  operation="t_max(X)" />     <!-- max -->
+            <field ref="M2x"     name="M2_x_elev"  />
+            <field ref="M2y"     name="M2_y_elev"  />
+          </file>
+        </group>
+
+        <!-- variables available with key_float, instantaneous fields -->
+<!--
+        <file id="floats"  description="floats variables">
+            <field ref="traj_lon"   name="floats_longitude"   freq_op="86400" />
+            <field ref="traj_lat"   name="floats_latitude"    freq_op="86400" />
+            <field ref="traj_dep"   name="floats_depth"       freq_op="86400" />
+            <field ref="traj_temp"  name="floats_temperature" freq_op="86400" />
+            <field ref="traj_salt"  name="floats_salinity"    freq_op="86400" />
+            <field ref="traj_dens"  name="floats_density"     freq_op="86400" />
+            <field ref="traj_group" name="floats_group"       freq_op="86400" />
+        </file>
+-->
+      </group>
+      
+      <group id="3d" output_freq="259200" output_level="10" enabled=".TRUE.">                      <!-- 3d files -->
+      </group>
+      
+      <group id="5d" output_freq="432000" output_level="10" enabled=".TRUE.">                      <!-- 5d files -->
+
+	<file id="5d_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="toce"         name="votemper"  />
+	  <field ref="soce"         name="vosaline"  />
+	  <field ref="sst"          name="sosstsst"  />
+	  <field ref="sss"          name="sosaline"  />
+	  <field ref="ssh"          name="sossheig"  />
+	  <field ref="empmr"        name="sowaflup"  />
+	  <field ref="qsr"          name="soshfldo"  />
+	  <field ref="empsmr"       name="sowaflcd"  />
+	  <field ref="qt"           name="sohefldo"  />
+	  <field ref="mldr10_1"     name="somxl010"  />
+	  <field ref="mldkz5"       name="somixhgt"  />
+	  <field ref="ice_cover"    name="soicecov"  />
+	  <field ref="wspd"         name="sowindsp"  />
+	  <field ref="qrp"          name="sohefldp"  />
+	  <field ref="erp"          name="sowafldp"  />
+	  <field ref="mlddzt"       name="sothedep"  />
+	  <field ref="20d"          name="so20chgt"  />
+	  <field ref="28d"          name="so28chgt"  />
+	  <field ref="hc300"        name="sohtc300"  />
+	  <field ref="ist_ipa"      name="soicetem"  />
+	  <field ref="icealb_cea"   name="soicealb"  />   
+	</file>
+	
+	<file id="5d_grid_U" name="auto" description="ocean U grid variables" >
+	  <field ref="uoce"         name="vozocrtx"  />
+	  <field ref="uoce_eiv"     name="vozoeivu"  />
+	  <field ref="utau"         name="sozotaux"  />
+	</file>
+	
+	<file id="5d_grid_V" name="auto" description="ocean V grid variables" >
+	  <field ref="voce"         name="vomecrty"  />
+	  <field ref="voce_eiv"     name="vomeeivv"  />
+	  <field ref="vtau"         name="sometauy"  />
+	</file>
+	
+	<file id="5d_grid_W" name="auto" description="ocean W grid variables" >
+	  <field ref="woce"         name="vovecrtz" />
+	  <field ref="woce_eiv"     name="voveeivw" />
+	  <field ref="avt"          name="votkeavt" />
+	  <field ref="avt_evd"      name="votkeevd" />
+	  <field ref="avm"          name="votkeavm" />
+	  <field ref="avm_evd"      name="votkeevm" />
+	  <field ref="avs"          name="voddmavs" />
+	  <field ref="aht2d"        name="soleahtw" />
+	  <field ref="aht2d_eiv"    name="soleaeiw" />
+	</file>
+	
+<!--	
+      <file id="5d_icemod" name="auto" description="ice variables" >
+	  <field ref="ice_pres"                     />
+	  <field ref="snowthic_cea" name="isnowthi" />
+	  <field ref="icethic_cea"  name="iicethic" />
+	  <field ref="iceprod_cea"  name="iiceprod" />
+	  <field ref="ist_ipa"      name="iicetemp" />
+	  <field ref="ioceflxb"     name="ioceflxb" />
+	  <field ref="uice_ipa"     name="iicevelu" />
+	  <field ref="vice_ipa"     name="iicevelv" />
+	  <field ref="utau_ice"     name="iicestru" />
+	  <field ref="vtau_ice"     name="iicestrv" />
+	  <field ref="qsr_io_cea"   name="iicesflx" />
+	  <field ref="qns_io_cea"   name="iicenflx" />
+	  <field ref="snowpre"      name="isnowpre" />
+	</file>
+-->	
+        <file id="5d_ptrc_T" name="auto" description="pisces sms variables" >
+          <field ref="CFC11"      />
+          <field ref="C14B"      />
+       </file>
+
+        <file id="5d_diad_T" name="auto" description="pisces sms variables" >
+          <field ref="qintCFC11"     />
+          <field ref="qtrCFC11"     />
+          <field ref="qintC14b"     />
+          <field ref="qtrC14b"     />
+          <field ref="fdecay"     />
+       </file>
+	
+      </group>
+      </group>
+      
+      <group id="1m" output_freq="-1"     output_level="10" enabled=".TRUE.">                      <!-- real monthly files -->
+
+	<file id="1m_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="sst"          name="sosstsst"  />
+	</file>   
+
+      </group>
+
+      <group id="2m" output_freq="-2"     output_level="10" enabled=".TRUE.">                      <!-- real 2m files -->
+      </group>
+
+      <group id="3m" output_freq="-3"     output_level="10" enabled=".TRUE.">                      <!-- real 3m files -->
+      </group>
+
+      <group id="4m" output_freq="-4"     output_level="10" enabled=".TRUE.">                      <!-- real 4m files -->
+      </group>
+
+      <group id="6m" output_freq="-6"     output_level="10" enabled=".TRUE.">                      <!-- real 6m files -->
+      </group>
+
+      <group id="1y" output_freq="-12"    output_level="10" enabled=".TRUE.">                      <!-- real yearly files -->
+
+	<file id="1y_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="mldr10_1"     name="sobowlin"  operation="t_max(X)" />
+	</file>
+
+      </group>
+
+      <group id="2y"  output_freq="-24"   output_level="10" enabled=".TRUE.">                      <!-- real 2y files -->
+      </group>
+
+      <group id="5y"  output_freq="-60"   output_level="10" enabled=".TRUE.">                      <!-- real 5y files -->
+      </group>
+
+      <group id="10y" output_freq="-120"  output_level="10" enabled=".TRUE.">                      <!-- real 10y files -->
+      </group>
+
+    </file_definition>
+    
+    <!-- 
+============================================================================================================
+=                                           grid definition                                                =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+    
+    <axis_definition>  
+      <axis id="deptht" description="Vertical T levels" unit="m" positive=".false." />
+      <axis id="depthu" description="Vertical U levels" unit="m" positive=".false." />
+      <axis id="depthv" description="Vertical V levels" unit="m" positive=".false." />
+      <axis id="depthw" description="Vertical W levels" unit="m" positive=".false." />
+      <axis id="none" description="axe non defini" unit="none" size="1" />
+      <axis id="nfloat" description="Number of float"   unit="no unit" positive=".false." />
+    </axis_definition> 
+    
+    <grid_definition>
+      <grid id="grid_T" description="grid T" >
+    <!--   Eq section   -->
+	<zoom id="EqT" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+    <!--   TAO   -->
+      <!--   137e   -->
+	<zoom id="2n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   147e   -->
+	<zoom id="0n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   156e   -->
+	<zoom id="5s156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   165e   -->
+	<zoom id="8s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   180w   -->
+	<zoom id="8s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   170w   -->
+	<zoom id="8s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   155w   -->
+	<zoom id="8s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   140w   -->
+	<zoom id="8s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   125w   -->
+	<zoom id="8s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   110w   -->
+	<zoom id="8s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   95w   -->
+	<zoom id="8s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+    <!--   RAMA   -->
+      <!--   55e   -->
+	<zoom id="16s55eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s55eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+ 	<zoom id="8s55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s55eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n55eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   65e   -->
+	<zoom id="15n65eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   67e   -->
+	<zoom id="16s67eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s67eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s67eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n67eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   80.5e   -->
+	<zoom id="16s80.5eT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s80.5eT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s80.5eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n80.5eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   90e   -->
+	<zoom id="1.5s90eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n90eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n90eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="15n90eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   95e   -->
+	<zoom id="16s95eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s95eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s95eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s95eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+    <!--   PIRATA   -->
+      <!--   38w-30w   -->
+	<zoom id="19s34wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="14s32wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s30wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n35wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n38wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n38wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="15n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="20n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   23w   -->
+	<zoom id="0n23wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n23wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n23wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="21n23wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   10w   -->
+	<zoom id="10s10wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="6s10wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n10wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   0e   -->
+	<zoom id="0n0eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      </grid>
+
+      <grid id="grid_U" description="grid U" >
+    <!--   Eq section   -->
+	<zoom id="EqU" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+      </grid>
+
+      <grid id="grid_V" description="grid V" >
+      </grid>
+
+      <grid id="grid_W" description="grid W" >
+    <!--   Eq section   -->
+	<zoom id="EqW" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+      </grid>
+
+      <grid id="scalarpoint" description="scalar" >
+	<zoom id="1point" ibegin="1" jbegin="1" ni="1" nj="1" />
+      </grid>
+
+    </grid_definition>    
+    
+  </context>
+
+</simulation>
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/iodef.xml_cfc
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/iodef.xml_cfc	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/iodef.xml_cfc	(revision 3680)
@@ -0,0 +1,120 @@
+<?xml version="1.0"?>
+<simulation> 
+  
+  <context id="nemo">
+
+    <!-- $id$ -->
+ 
+    <!-- 
+============================================================================================================
+=                                  definition of all existing variables                                    =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+
+  <field_definition level="1" prec="4" operation="ave(X)" enabled=".TRUE."> <!-- time step automaticaly defined -->
+ 
+      <!-- ptrc on T grid -->
+ 
+     <group id="ptrc_T" axis_ref="deptht" grid_ref="grid_T">
+       <field id="CFC11"    description="CFC-11 Concentration"                     unit="umol/L" />
+       <field id="C14B"     description="Bomb C14 Concentration"                   unit="ration" />
+     </group>
+
+      <!-- diad on T grid : variables available with key_diatrc -->
+
+     <group id="diad_T" axis_ref="none" grid_ref="grid_T">
+       <field id="qtr_c11"     description="Air-sea flux of CFC-11"                   unit="mol/m2/s"     />
+       <field id="qint_c11"    description="Cumulative air-sea flux of CFC-11"        unit="mol/m2"     />
+       <field id="qtr_c14"     description="Air-sea flux of Bomb C14"                 unit="mol/m2/s"     />
+       <field id="qint_c14"    description="Cumulative air-sea flux of Bomb C14"      unit="mol/m2"     />
+       <field id="decay"       description="Radiactive decay of Bomb C14"             unit="mol/m3"  axis_ref="deptht"  />
+     </group>         
+
+      <!-- scalar -->
+      
+      <group id="scalar" axis_ref="none" grid_ref="scalarpoint" zoom_ref="1point" >
+      </group>
+
+  </field_definition>
+
+    <!-- 
+============================================================================================================
+=                                           output files definition                                        =
+=                                            Define your own files                                         =
+=                                         put the variables you want...                                    =
+============================================================================================================
+    -->
+
+  <file_definition output_level="10" enabled=".TRUE.">
+   
+      <group id="1d" output_freq="86400"  output_level="10" enabled=".TRUE.">                      <!-- 1d files -->
+      </group>
+
+      <group id="5d" output_freq="432000" output_level="10" enabled=".TRUE.">                      <!-- 5d files -->
+      </group>
+ 
+      <group id="1m" output_freq="-1"     output_level="10" enabled=".TRUE.">                      <!-- real monthly files -->
+
+        <file id="1m_ptrc_T" name="auto" description="pisces sms variables" >
+          <field ref="CFC11"      />
+          <field ref="C14B"      />
+          <field ref="qint_c11"     />
+          <field ref="qint_c14"     />
+       </file>
+      </group>
+
+      <group id="2m" output_freq="-2"     output_level="10" enabled=".TRUE.">                      <!-- real 2m files -->
+      </group>
+
+      <group id="3m" output_freq="-3"     output_level="10" enabled=".TRUE.">                      <!-- real 3m files -->
+      </group>
+
+      <group id="4m" output_freq="-4"     output_level="10" enabled=".TRUE.">                      <!-- real 4m files -->
+      </group>
+
+      <group id="6m" output_freq="-6"     output_level="10" enabled=".TRUE.">                      <!-- real 6m files -->
+      </group>
+
+      <group id="1y" output_freq="-12"    output_level="10" enabled=".TRUE.">                      <!-- real yearly files -->
+      </group>
+
+      <group id="2y"  output_freq="-24"   output_level="10" enabled=".TRUE.">                      <!-- real 2y files -->
+      </group>
+
+      <group id="5y"  output_freq="-60"   output_level="10" enabled=".TRUE.">                      <!-- real 5y files -->
+      </group>
+
+      <group id="10y" output_freq="-120"  output_level="10" enabled=".TRUE.">                      <!-- real 10y files -->
+      </group>
+    
+  </file_definition>
+
+    <!-- 
+============================================================================================================
+=                                           grid definition                                                =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+
+  <axis_definition>  
+     <axis id="deptht" description="Vertical T levels" unit="m" positive=".false." />
+     <axis id="depthu" description="Vertical U levels" unit="m" positive=".false." />
+     <axis id="depthv" description="Vertical V levels" unit="m" positive=".false." />
+     <axis id="depthw" description="Vertical W levels" unit="m" positive=".false." />
+     <axis id="none" description="axe non defini" unit="none" size="1" />
+  </axis_definition> 
+
+  <grid_definition>
+    <grid id="grid_T" description="grid T" />
+    <grid id="grid_U" description="grid U" />
+    <grid id="grid_V" description="grid V" />
+    <grid id="grid_W" description="grid W" />
+    <grid id="scalarpoint" description="scalar" >
+      <zoom id="1point" ibegin="1" jbegin="1" ni="1" nj="1" />
+    </grid>
+  </grid_definition>
+
+</context>
+
+</simulation>
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist	(revision 3680)
@@ -0,0 +1,986 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/OPA  :  1 - run manager      (namrun)
+!! namelists    2 - Domain           (namzgr, namzgr_sco, namdom, namtsd)
+!!              3 - Surface boundary (namsbc, namsbc_ana, namsbc_flx, namsbc_clio, namsbc_core
+!!                                    namsbc_cpl, namtra_qsr, namsbc_rnf, 
+!!                                    namsbc_apr, namsbc_ssr, namsbc_alb)
+!!              4 - lateral boundary (namlbc, namcla, namobc, namagrif, nambdy, nambdy_tide)
+!!              5 - bottom  boundary (nambfr, nambbc, nambbl)
+!!              6 - Tracer           (nameos, namtra_adv, namtra_ldf, namtra_dmp)
+!!              7 - dynamics         (namdyn_adv, namdyn_vor, namdyn_hpg, namdyn_spg, namdyn_ldf)
+!!              8 - Verical physics  (namzdf, namzdf_ric, namzdf_tke, namzdf_kpp, namzdf_ddm, namzdf_tmx)
+!!              9 - diagnostics      (namnc4, namtrd, namspr, namflo, namptr, namhsb)
+!!             10 - miscellaneous    (namsol, nammpp, nammpp_dyndist, namctl)
+!!             11 - Obs & Assim      (namobs, nam_asminc)
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+!!======================================================================
+!!                   ***  Run management namelists  ***
+!!======================================================================
+!!   namrun        parameters of the run
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namrun        !   parameters of the run
+!-----------------------------------------------------------------------
+   nn_no       =       0   !  job number (no more used...)
+   cn_exp      =  "ORCA2C"  !  experience name 
+   nn_it000    =       1   !  first time step
+   nn_itend    =    5475   !  last  time step (std 5475)
+   nn_date0    = 19600101   !  date at nit_0000 (format yyyymmdd) used if ln_rstart=F or (ln_rstart=T and nn_rstctl=0 or 1)
+   nn_leapy    =       0   !  Leap year calendar (1) or not (0)
+   ln_rstart   = .false.   !  start from rest (F) or from a restart file (T)
+   nn_rstctl   =       0   !  restart control => activated only if ln_rstart = T
+                           !    = 0 nn_date0 read in namelist ; nn_it000 : read in namelist
+                           !    = 1 nn_date0 read in namelist ; nn_it000 : check consistancy between namelist and restart
+                           !    = 2 nn_date0 read in restart  ; nn_it000 : check consistancy between namelist and restart
+   cn_ocerst_in  = "restart"   !  suffix of ocean restart name (input)
+   cn_ocerst_out = "restart"   !  suffix of ocean restart name (output)
+   nn_istate   =       0   !  output the initial state (1) or not (0)
+   nn_stock    =    5475   !  frequency of creation of a restart file (modulo referenced to 1)
+   nn_write    =    5475   !  frequency of write in the output file   (modulo referenced to nn_it000)
+   ln_dimgnnn  = .false.   !  DIMG file format: 1 file for all processors (F) or by processor (T)
+   ln_mskland  = .false.   !  mask land points in NetCDF outputs (costly: + ~15%)
+   ln_clobber  = .false.   !  clobber (overwrite) an existing file
+   nn_chunksz  =       0   !  chunksize (bytes) for NetCDF file (works only with iom_nf90 routines)
+/
+
+!!======================================================================
+!!                      ***  Domain namelists  ***
+!!======================================================================
+!!   namzgr       vertical coordinate
+!!   namzgr_sco   s-coordinate or hybrid z-s-coordinate
+!!   namdom       space and time domain (bathymetry, mesh, timestep)
+!!   namtsd       data: temperature & salinity                         
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namzgr        !   vertical coordinate
+!-----------------------------------------------------------------------
+   ln_zco      = .false.   !  z-coordinate - full    steps   (T/F)      ("key_zco" may also be defined)
+   ln_zps      = .true.    !  z-coordinate - partial steps   (T/F)
+   ln_sco      = .false.   !  s- or hybrid z-s-coordinate    (T/F)
+/
+!-----------------------------------------------------------------------
+&namzgr_sco    !   s-coordinate or hybrid z-s-coordinate
+!-----------------------------------------------------------------------
+   rn_sbot_min =  300.     !  minimum depth of s-bottom surface (>0) (m)
+   rn_sbot_max = 5250.     !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
+   rn_theta    =    6.0    !  surface control parameter (0<=rn_theta<=20)
+   rn_thetb    =    0.75   !  bottom control parameter  (0<=rn_thetb<= 1)
+   rn_rmax     =    0.15   !  maximum cut-off r-value allowed (0<rn_max<1)
+   ln_s_sigma  = .false.   !  hybrid s-sigma coordinates
+   rn_bb       =    0.8    !  stretching with s-sigma
+   rn_hc       =  150.0    !  critical depth with s-sigma 
+/
+!-----------------------------------------------------------------------
+&namdom        !   space and time domain (bathymetry, mesh, timestep)
+!-----------------------------------------------------------------------
+   nn_bathy    =    1      !  compute (=0) or read (=1) the bathymetry file
+   nn_closea    =   0      !  remove (=0) or keep (=1) closed seas and lakes (ORCA)
+   nn_msh      =    0      !  create (=1) a mesh file or not (=0)
+   rn_hmin     =   -3.     !  min depth of the ocean (>0) or min number of ocean level (<0)
+   rn_e3zps_min=   20.     !  partial step thickness is set larger than the minimum of
+   rn_e3zps_rat=    0.1    !  rn_e3zps_min and rn_e3zps_rat*e3t, with 0<rn_e3zps_rat<1
+                           !
+   rn_rdt      = 5760.     !  time step for the dynamics (and tracer if nn_acc=0)
+   nn_baro     =   64      !  number of barotropic time step            ("key_dynspg_ts")
+   rn_atfp     =    0.1    !  asselin time filter parameter
+   nn_acc      =    0      !  acceleration of convergence : =1      used, rdt < rdttra(k)
+                                 !                          =0, not used, rdt = rdttra
+   rn_rdtmin   = 28800.          !  minimum time step on tracers (used if nn_acc=1)
+   rn_rdtmax   = 28800.          !  maximum time step on tracers (used if nn_acc=1)
+   rn_rdth     =  800.           !  depth variation of tracer time step  (used if nn_acc=1)
+/
+!-----------------------------------------------------------------------
+&namtsd    !   data : Temperature  & Salinity                           
+!-----------------------------------------------------------------------
+!          ! file name ! frequency (hours)    ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation !
+!          !           !  (if <0  months)     !   name   !  (logical)   ! (T/F) ! 'monthly'  ! filename ! pairing  !
+   sn_tem  = 'data_1m_potential_temperature_nomask', -1,'votemper',  .true.  , .true., 'yearly'   , ' '      , ' '
+   sn_sal  = 'data_1m_salinity_nomask'             , -1,'vosaline',  .true.  , .true., 'yearly'   , ''       , ' '
+   !
+   cn_dir        = './'     !  root directory for the location of the runoff files
+   ln_tsd_init   = .true.   !  Initialisation of ocean T & S with T &S input data (T) or not (F)
+   ln_tsd_tradmp = .true.   !  damping of ocean T & S toward T &S input data (T) or not (F)
+/
+!!======================================================================
+!!            ***  Surface Boundary Condition namelists  ***
+!!======================================================================
+!!   namsbc          surface boundary condition
+!!   namsbc_ana      analytical         formulation
+!!   namsbc_flx      flux               formulation
+!!   namsbc_clio     CLIO bulk formulae formulation
+!!   namsbc_core     CORE bulk formulae formulation
+!!   namsbc_mfs      MFS  bulk formulae formulation
+!!   namsbc_cpl      CouPLed            formulation                     ("key_coupled")
+!!   namtra_qsr      penetrative solar radiation
+!!   namsbc_rnf      river runoffs
+!!   namsbc_apr      Atmospheric Pressure
+!!   namsbc_ssr      sea surface restoring term (for T and/or S)
+!!   namsbc_alb      albedo parameters
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namsbc        !   Surface Boundary Condition (surface module)
+!-----------------------------------------------------------------------
+   nn_fsbc     = 5         !  frequency of surface boundary condition computation 
+                           !     (also = the frequency of sea-ice model call)
+   ln_ana      = .false.   !  analytical formulation                    (T => fill namsbc_ana ) 
+   ln_flx      = .false.   !  flux formulation                          (T => fill namsbc_flx )
+   ln_blk_clio = .false.   !  CLIO bulk formulation                     (T => fill namsbc_clio) 
+   ln_blk_core = .true.    !  CORE bulk formulation                     (T => fill namsbc_core) 
+   ln_blk_mfs  = .false.   !  MFS bulk formulation                      (T => fill namsbc_mfs )
+   ln_cpl      = .false.   !  Coupled formulation                       (T => fill namsbc_cpl )
+   ln_apr_dyn  = .false.   !  Patm gradient added in ocean & ice Eqs.   (T => fill namsbc_apr )
+   nn_ice      = 2         !  =0 no ice boundary condition   ,
+                           !  =1 use observed ice-cover      ,
+                           !  =2 ice-model used                         ("key_lim3" or "key_lim2)
+   ln_dm2dc    = .false.   !  daily mean to diurnal cycle on short wave
+   ln_rnf      = .true.    !  runoffs                                   (T => fill namsbc_rnf)
+   ln_ssr      = .true.    !  Sea Surface Restoring on T and/or S       (T => fill namsbc_ssr)
+   nn_fwb      = 3         !  FreshWater Budget: =0 unchecked 
+                           !     =1 global mean of e-p-r set to zero at each time step 
+                           !     =2 annual global mean of e-p-r set to zero
+                           !     =3 global emp set to zero and spread out over erp area
+   ln_cdgw = .false.       !  Neutral drag coefficient read from wave model (T => fill namsbc_wave)
+/
+!-----------------------------------------------------------------------
+&namsbc_ana    !   analytical surface boundary condition
+!-----------------------------------------------------------------------
+   nn_tau000   =   0       !  gently increase the stress over the first ntau_rst time-steps
+   rn_utau0    =   0.5     !  uniform value for the i-stress
+   rn_vtau0    =   0.e0    !  uniform value for the j-stress
+   rn_qns0     =   0.e0    !  uniform value for the total heat flux
+   rn_qsr0     =   0.e0    !  uniform value for the solar radiation
+   rn_emp0     =   0.e0    !  uniform value for the freswater budget (E-P)
+/
+!-----------------------------------------------------------------------
+&namsbc_flx    !   surface boundary condition : flux formulation
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_utau     = 'utau'      ,        24         , 'utau'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_vtau     = 'vtau'      ,        24         , 'vtau'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_qtot     = 'qtot'      ,        24         , 'qtot'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_qsr      = 'qsr'       ,        24         , 'qsr'     , .false.      , .false., 'yearly'  , ''       , ''
+   sn_emp      = 'emp'       ,        24         , 'emp'     , .false.      , .false., 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the flux files
+/      
+!-----------------------------------------------------------------------
+&namsbc_clio   !   namsbc_clio  CLIO bulk formulae
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_utau     = 'taux_1m'   ,       -1          , 'sozotaux',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_vtau     = 'tauy_1m'   ,       -1          , 'sometauy',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_wndm     = 'flx'       ,       -1          , 'socliowi',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_tair     = 'flx'       ,       -1          , 'socliot2',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_humi     = 'flx'       ,       -1          , 'socliohu',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_ccov     = 'flx'       ,       -1          , 'socliocl',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_prec     = 'flx'       ,       -1          , 'socliopl',   .false.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files are
+/
+!-----------------------------------------------------------------------
+&namsbc_core   !   namsbc_core  CORE bulk formulae
+!-----------------------------------------------------------------------
+!              !  file name                    ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !                               !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_wndi     = 'u_10.15JUNE2009_orca2'       ,         6         , 'U_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Uwnd'
+   sn_wndj     = 'v_10.15JUNE2009_orca2'       ,         6         , 'V_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Vwnd'
+   sn_qsr      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'SWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_qlw      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'LWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_tair     = 't_10.15JUNE2009_orca2'       ,         6         , 'T_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_humi     = 'q_10.15JUNE2009_orca2'       ,         6         , 'Q_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_prec     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'PRC_MOD1',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_snow     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'SNOW'    ,   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_tdif     = 'taudif_core'                 ,        24         , 'taudif'  ,   .false.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files
+   ln_2m       = .false.   !  air temperature and humidity referenced at 2m (T) instead 10m (F)
+   ln_taudif   = .false.   !  HF tau contribution: use "mean of stress module - module of the mean stress" data
+   rn_pfac     = 1.        !  multiplicative factor for precipitation (total & snow)
+/
+!-----------------------------------------------------------------------
+&namsbc_mfs   !   namsbc_mfs  MFS bulk formulae
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_wndi     =   'ecmwf'   ,        6          , 'u10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
+   sn_wndj     =   'ecmwf'   ,        6          , 'v10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
+   sn_clc      =   'ecmwf'   ,        6          , 'clc'     ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''
+   sn_msl      =   'ecmwf'   ,        6          , 'msl'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
+   sn_tair     =   'ecmwf'   ,        6          , 't2'      ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
+   sn_rhm      =   'ecmwf'   ,        6          , 'rh'      ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''
+   sn_prec     =   'ecmwf'   ,        6          , 'precip'  ,    .true.    , .true.  , 'daily'  ,'bicubic.nc' , ''
+
+   cn_dir      = './ECMWF/'      !  root directory for the location of the bulk files
+/
+!-----------------------------------------------------------------------
+&namsbc_cpl    !   coupled ocean/atmosphere model                       ("key_coupled")
+!-----------------------------------------------------------------------
+!                    !     description       !  multiple  !    vector   !      vector          ! vector !
+!                    !                       ! categories !  reference  !    orientation       ! grids  !
+! send
+sn_snd_temp   =       'weighted oce and ice' ,    'no'    ,     ''      ,         ''           ,   ''    
+sn_snd_alb    =       'weighted ice'         ,    'no'    ,     ''      ,         ''           ,   ''    
+sn_snd_thick  =       'none'                 ,    'no'   ,     ''      ,         ''           ,   ''    
+sn_snd_crt    =       'none'                 ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'       
+sn_snd_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''           ,   ''        
+! receive
+sn_rcv_w10m   =       'none'                 ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_taumod =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_tau    =       'oce only'             ,    'no'    , 'cartesian' , 'eastward-northward',  'U,V'   
+sn_rcv_dqnsdt =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_qsr    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_qns    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_emp    =       'conservative'         ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_rnf    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_cal    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+/
+!-----------------------------------------------------------------------
+&namtra_qsr    !   penetrative solar radiation
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_chl      ='chlorophyll',        -1         , 'CHLA'    ,   .true.     , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the runoff files
+   ln_traqsr   = .true.    !  Light penetration (T) or not (F)
+   ln_qsr_rgb  = .true.    !  RGB (Red-Green-Blue) light penetration
+   ln_qsr_2bd  = .false.   !  2 bands              light penetration
+   ln_qsr_bio  = .false.   !  bio-model light penetration
+   nn_chldta   =      1    !  RGB : Chl data (=1) or cst value (=0)
+   rn_abs      =   0.58    !  RGB & 2 bands: fraction of light (rn_si1)
+   rn_si0      =   0.35    !  RGB & 2 bands: shortess depth of extinction
+   rn_si1      =   23.0    !  2 bands: longest depth of extinction
+/
+!-----------------------------------------------------------------------
+&namsbc_rnf    !   runoffs namelist surface boundary condition
+!-----------------------------------------------------------------------
+!              !  file name           ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !                      !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_rnf      = 'runoff_core_monthly',        -1         , 'sorunoff',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_cnf      = 'runoff_core_monthly',         0         , 'socoefr0',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_s_rnf    = 'runoffs'            ,        24         , 'rosaline',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_t_rnf    = 'runoffs'            ,        24         , 'rotemper',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_dep_rnf  = 'runoffs'            ,         0         , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir       = './'      !  root directory for the location of the runoff files
+   ln_rnf_emp   = .false.   !  runoffs included into precipitation field (T) or into a file (F)
+   ln_rnf_mouth = .true.    !  specific treatment at rivers mouths
+   rn_hrnf      =  15.e0    !  depth over which enhanced vertical mixing is used
+   rn_avt_rnf   =   1.e-3   !  value of the additional vertical mixing coef. [m2/s]
+   rn_rfact     =   1.e0    !  multiplicative factor for runoff
+   ln_rnf_depth = .false.   !  read in depth information for runoff
+   ln_rnf_tem   = .false.   !  read in temperature information for runoff
+   ln_rnf_sal   = .false.   !  read in salinity information for runoff
+/
+!-----------------------------------------------------------------------
+&namsbc_apr    !   Atmospheric pressure used as ocean forcing or in bulk
+!-----------------------------------------------------------------------
+!              ! file name ! frequency (hours) ! variable ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
+!              !           !  (if <0  months)  !   name   !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
+   sn_apr      = 'patm'    ,         -1        ,'somslpre',    .true.      , .true.  , 'yearly'  ,  ''      ,   ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files
+   ln_ref_apr  = .false.   !  ref. pressure: global mean Patm (T) or a constant (F)
+/
+!-----------------------------------------------------------------------
+&namsbc_ssr    !   surface boundary condition : sea surface restoring
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_sst      = 'sst_data'  ,        24         ,  'sst'    ,    .false.   , .false., 'yearly'  , ''       , ''
+   sn_sss      = 'sss_data'  ,        -1         ,  'sss'    ,    .true.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the runoff files
+   nn_sstr     =     0     !  add a retroaction term in the surface heat       flux (=1) or not (=0)
+   nn_sssr     =     2     !  add a damping     term in the surface freshwater flux (=2) 
+                           !  or to SSS only (=1) or no damping term (=0)
+   rn_dqdt     =   -40.    !  magnitude of the retroaction on temperature   [W/m2/K]
+   rn_deds     =  -166.67  !  magnitude of the damping on salinity   [mm/day]
+   ln_sssr_bnd =   .true.  !  flag to bound erp term (associated with nn_sssr=2)
+   rn_sssr_bnd =   4.e0    !  ABS(Max/Min) value of the damping erp term [mm/day]
+/      
+!-----------------------------------------------------------------------
+&namsbc_alb    !   albedo parameters
+!-----------------------------------------------------------------------
+   rn_cloud    =    0.06   !  cloud correction to snow and ice albedo 
+   rn_albice   =    0.53   !  albedo of melting ice in the arctic and antarctic
+   rn_alphd    =    0.80   !  coefficients for linear interpolation used to
+   rn_alphc    =    0.65   !  compute albedo between two extremes values 
+   rn_alphdi   =    0.72   !  (Pyane, 1972)
+/
+
+!!======================================================================
+!!               ***  Lateral boundary condition  ***
+!!======================================================================
+!!   namlbc        lateral momentum boundary condition
+!!   namcla        cross land advection
+!!   namobc        open boundaries parameters                           ("key_obc")
+!!   namagrif      agrif nested grid ( read by child model only )       ("key_agrif") 
+!!   nambdy        Unstructured open boundaries                         ("key_bdy")
+!!   namtide       Tidal forcing at open boundaries                     ("key_bdy_tides")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namlbc        !   lateral momentum boundary condition
+!-----------------------------------------------------------------------
+   rn_shlat    =    2.     !  shlat = 0  !  0 < shlat < 2  !  shlat = 2  !  2 < shlat
+                           !  free slip  !   partial slip  !   no slip   ! strong slip
+   ln_vorlat   = .false.   !  consistency of vorticity boundary condition with analytical eqs.
+/
+!-----------------------------------------------------------------------
+&namcla        !   cross land advection
+!-----------------------------------------------------------------------
+   nn_cla      =    0      !  advection between 2 ocean pts separates by land
+/
+!-----------------------------------------------------------------------
+&namobc        !   open boundaries parameters                           ("key_obc")
+!-----------------------------------------------------------------------
+   ln_obc_clim = .false.   !  climatological obc data files (T) or not (F)
+   ln_vol_cst  = .true.    !  impose the total volume conservation (T) or not (F)
+   ln_obc_fla  = .false.   !  Flather open boundary condition 
+   nn_obcdta   =    1      !  = 0 the obc data are equal to the initial state
+                           !  = 1 the obc data are read in 'obc.dta' files
+   cn_obcdta   = 'annual'  !  set to annual if obc datafile hold 1 year of data
+                           !  set to monthly if obc datafile hold 1 month of data
+   rn_dpein    =    1.     !  damping time scale for inflow at east  open boundary
+   rn_dpwin    =    1.     !     -           -         -       west    -      -
+   rn_dpnin    =    1.     !     -           -         -       north   -      -
+   rn_dpsin    =    1.     !     -           -         -       south   -      -
+   rn_dpeob    = 3000.     !  time relaxation (days) for the east  open boundary
+   rn_dpwob    =   15.     !     -           -         -     west    -      -
+   rn_dpnob    = 3000.     !     -           -         -     north   -      -
+   rn_dpsob    =   15.     !     -           -         -     south   -      -
+   rn_volemp   =    1.     !  = 0 the total volume change with the surface flux (E-P-R)
+                           !  = 1 the total volume remains constant
+/
+!-----------------------------------------------------------------------
+&namagrif      !  AGRIF zoom                                            ("key_agrif")
+!-----------------------------------------------------------------------
+   nn_cln_update =    3    !  baroclinic update frequency
+   ln_spc_dyn    = .true.  !  use 0 as special value for dynamics
+   rn_sponge_tra = 2880.   !  coefficient for tracer   sponge layer [m2/s]
+   rn_sponge_dyn = 2880.   !  coefficient for dynamics sponge layer [m2/s]
+/
+!-----------------------------------------------------------------------
+&nam_tide      !   tide parameters (#ifdef key_tide)
+!-----------------------------------------------------------------------
+   ln_tide_pot   = .true.   !  use tidal potential forcing
+   nb_harmo      =    11    !  number of constituents used
+   clname(1)     =   'M2'   !  name of constituent
+   clname(2)     =   'S2'
+   clname(3)     =   'N2'
+   clname(4)     =   'K1'
+   clname(5)     =   'O1'
+   clname(6)     =   'Q1'
+   clname(7)     =   'M4'
+   clname(8)     =   'K2'
+   clname(9)     =   'P1'
+   clname(10)    =   'Mf'
+   clname(11)    =   'Mm'
+/
+!-----------------------------------------------------------------------
+&nambdy        !  unstructured open boundaries                          ("key_bdy")
+!-----------------------------------------------------------------------
+    nb_bdy = 1                            !  number of open boundary sets       
+    ln_coords_file = .true.               !  =T : read bdy coordinates from file
+    cn_coords_file = 'coordinates.bdy.nc' !  bdy coordinates files
+    ln_mask_file = .false.                !  =T : read mask from file
+    cn_mask_file = ''                     !  name of mask file (if ln_mask_file=.TRUE.)
+    nn_dyn2d      =  2                    !  boundary conditions for barotropic fields
+    nn_dyn2d_dta  =  3                    !  = 0, bdy data are equal to the initial state
+                                          !  = 1, bdy data are read in 'bdydata   .nc' files
+                                          !  = 2, use tidal harmonic forcing data from files
+                                          !  = 3, use external data AND tidal harmonic forcing
+    nn_dyn3d      =  0                    !  boundary conditions for baroclinic velocities
+    nn_dyn3d_dta  =  0                    !  = 0, bdy data are equal to the initial state
+                           !  = 1, bdy data are read in 'bdydata   .nc' files
+    nn_tra        =  1                    !  boundary conditions for T and S
+    nn_tra_dta    =  1                    !  = 0, bdy data are equal to the initial state
+                           !  = 1, bdy data are read in 'bdydata   .nc' files
+    nn_rimwidth  = 10                      !  width of the relaxation zone
+    ln_vol     = .false.                  !  total volume correction (see nn_volctl parameter)
+    nn_volctl  = 1                        !  = 0, the total water flux across open boundaries is zero
+/
+!-----------------------------------------------------------------------
+&nambdy_dta      !  open boundaries - external data           ("key_bdy")
+!-----------------------------------------------------------------------
+!              !   file name    ! frequency (hours) !  variable  ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
+!              !                !  (if <0  months)  !    name    !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
+   bn_ssh =     'amm12_bdyT_u2d' ,         24        , 'sossheig' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_u2d =     'amm12_bdyU_u2d' ,         24        , 'vobtcrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_v2d =     'amm12_bdyV_u2d' ,         24        , 'vobtcrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_u3d  =    'amm12_bdyU_u3d' ,         24        , 'vozocrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_v3d  =    'amm12_bdyV_u3d' ,         24        , 'vomecrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_tem  =    'amm12_bdyT_tra' ,         24        , 'votemper' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_sal  =    'amm12_bdyT_tra' ,         24        , 'vosaline' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   cn_dir  =    'bdydta/'
+   ln_full_vel = .false.
+/
+!-----------------------------------------------------------------------
+&nambdy_tide     ! tidal forcing at open boundaries              
+!-----------------------------------------------------------------------
+   filtide      = 'bdydta/amm12_bdytide_'         !  file name root of tidal forcing files
+    tide_cpt(1)   ='Q1'  !  names of tidal components used
+    tide_cpt(2)   ='O1'  !  names of tidal components used
+    tide_cpt(3)   ='P1'  !  names of tidal components used
+    tide_cpt(4)   ='S1'  !  names of tidal components used
+    tide_cpt(5)   ='K1'  !  names of tidal components used
+    tide_cpt(6)   ='2N2' !  names of tidal components used
+    tide_cpt(7)   ='MU2' !  names of tidal components used
+    tide_cpt(8)   ='N2'  !  names of tidal components used
+    tide_cpt(9)   ='NU2' !  names of tidal components used
+    tide_cpt(10)   ='M2'  !  names of tidal components used
+    tide_cpt(11)   ='L2'  !  names of tidal components used
+    tide_cpt(12)   ='T2'  !  names of tidal components used
+    tide_cpt(13)   ='S2'  !  names of tidal components used
+    tide_cpt(14)   ='K2'  !  names of tidal components used
+    tide_cpt(15)   ='M4'  !  names of tidal components used
+    tide_speed(1)   = 13.398661 !  phase speeds of tidal components (deg/hour)
+    tide_speed(2)   = 13.943036 !  phase speeds of tidal components (deg/hour)
+    tide_speed(3)   = 14.958932 !  phase speeds of tidal components (deg/hour)
+    tide_speed(4)   = 15.000001 !  phase speeds of tidal components (deg/hour)
+    tide_speed(5)   = 15.041069 !  phase speeds of tidal components (deg/hour)
+    tide_speed(6)   = 27.895355 !  phase speeds of tidal components (deg/hour)
+    tide_speed(7)   = 27.968210 !  phase speeds of tidal components (deg/hour)
+    tide_speed(8)   = 28.439730 !  phase speeds of tidal components (deg/hour)
+    tide_speed(9)   = 28.512585 !  phase speeds of tidal components (deg/hour)
+    tide_speed(10)   = 28.984106 !  phase speeds of tidal components (deg/hour)
+    tide_speed(11)   = 29.528479 !  phase speeds of tidal components (deg/hour)
+    tide_speed(12)   = 29.958935 !  phase speeds of tidal components (deg/hour)
+    tide_speed(13)   = 30.000002 !  phase speeds of tidal components (deg/hour)
+    tide_speed(14)   = 30.082138 !  phase speeds of tidal components (deg/hour)
+    tide_speed(15)   = 57.968212 !  phase speeds of tidal components (deg/hour)
+    ln_tide_date = .true.               !  adjust tidal harmonics for start date of run
+/
+!!======================================================================
+!!                 ***  Bottom boundary condition  ***
+!!======================================================================
+!!   nambfr        bottom friction
+!!   nambbc        bottom temperature boundary condition               
+!!   nambbl        bottom boundary layer scheme                         ("key_trabbl")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&nambfr        !   bottom friction
+!-----------------------------------------------------------------------
+   nn_bfr      =    1      !  type of bottom friction :   = 0 : free slip,  = 1 : linear friction
+                           !                              = 2 : nonlinear friction
+   rn_bfri1    =    4.e-4  !  bottom drag coefficient (linear case)
+   rn_bfri2    =    1.e-3  !  bottom drag coefficient (non linear case)
+   rn_bfeb2    =    2.5e-3 !  bottom turbulent kinetic energy background  (m2/s2)
+   ln_bfr2d    = .false.   !  horizontal variation of the bottom friction coef (read a 2D mask file )
+   rn_bfrien   =    50.    !  local multiplying factor of bfr (ln_bfr2d=T)
+   ln_bfrimp   = .true.    !  implicit bottom friction (requires ln_zdfexp = .false. if true)
+/
+!-----------------------------------------------------------------------
+&nambbc        !   bottom temperature boundary condition
+!-----------------------------------------------------------------------
+   ln_trabbc   = .true.    !  Apply a geothermal heating at the ocean bottom
+   nn_geoflx   =    2      !  geothermal heat flux: = 0 no flux 
+                           !     = 1 constant flux
+                           !     = 2 variable flux (read in geothermal_heating.nc in mW/m2) 
+   rn_geoflx_cst = 86.4e-3 !  Constant value of geothermal heat flux [W/m2]
+/
+!-----------------------------------------------------------------------
+&nambbl        !   bottom boundary layer scheme
+!-----------------------------------------------------------------------
+   nn_bbl_ldf  =  1      !  diffusive bbl (=1)   or not (=0)
+   nn_bbl_adv  =  0      !  advective bbl (=1/2) or not (=0)
+   rn_ahtbbl   =  1000.  !  lateral mixing coefficient in the bbl  [m2/s]
+   rn_gambbl   =  10.    !  advective bbl coefficient                 [s]
+/
+
+!!======================================================================
+!!                        Tracer (T & S ) namelists
+!!======================================================================
+!!   nameos        equation of state
+!!   namtra_adv    advection scheme
+!!   namtra_ldf    lateral diffusion scheme
+!!   namtra_dmp    T & S newtonian damping                        
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&nameos        !   ocean physical parameters
+!-----------------------------------------------------------------------
+   nn_eos      =   0       !  type of equation of state and Brunt-Vaisala frequency
+                           !     = 0, UNESCO (formulation of Jackett and McDougall (1994) and of McDougall (1987) )
+                           !     = 1, linear: rho(T)   = rau0 * ( 1.028 - ralpha * T )
+                           !     = 2, linear: rho(T,S) = rau0 * ( rbeta * S - ralpha * T )
+   rn_alpha    =   2.0e-4  !  thermal expension coefficient (nn_eos= 1 or 2)
+   rn_beta     =   7.7e-4  !  saline  expension coefficient (nn_eos= 2)
+/
+!-----------------------------------------------------------------------
+&namtra_adv    !   advection scheme for tracer 
+!-----------------------------------------------------------------------
+   ln_traadv_cen2   =  .false.  !  2nd order centered scheme   
+   ln_traadv_tvd    =  .true.   !  TVD scheme                
+   ln_traadv_muscl  =  .false.  !  MUSCL scheme             
+   ln_traadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries  
+   ln_traadv_ubs    =  .false.  !  UBS scheme                 
+   ln_traadv_qck    =  .false.  !  QUICKEST scheme                 
+/
+!----------------------------------------------------------------------------------
+&namtra_ldf    !   lateral diffusion scheme for tracers
+!----------------------------------------------------------------------------------
+   !                       !  Operator type:
+   ln_traldf_lap    =  .true.   !  laplacian operator
+   ln_traldf_bilap  =  .false.  !  bilaplacian operator
+   !                       !  Direction of action:
+   ln_traldf_level  =  .false.  !  iso-level
+   ln_traldf_hor    =  .false.  !  horizontal (geopotential)   (needs "key_ldfslp" when ln_sco=T)
+   ln_traldf_iso    =  .true.   !  iso-neutral                 (needs "key_ldfslp")
+   !		       	   !  Griffies parameters              (all need "key_ldfslp")
+   ln_traldf_grif   =  .false.  !  use griffies triads
+   ln_traldf_gdia   =  .false.  !  output griffies eddy velocities
+   ln_triad_iso     =  .false.  !  pure lateral mixing in ML
+   ln_botmix_grif   =  .false.  !  lateral mixing on bottom
+   !                       !  Coefficients
+   ! Eddy-induced (GM) advection always used with Griffies; otherwise needs "key_traldf_eiv"
+   ! Value rn_aeiv_0 is ignored unless = 0 with Held-Larichev spatially varying aeiv
+   !                                  (key_traldf_c2d & key_traldf_eiv & key_orca_r2, _r1 or _r05)
+   rn_aeiv_0        =  2000.    !  eddy induced velocity coefficient [m2/s]
+   rn_aht_0         =  2000.    !  horizontal eddy diffusivity for tracers [m2/s]
+   rn_ahtb_0        =     0.    !  background eddy diffusivity for ldf_iso [m2/s]
+   !                                           (normally=0; not used with Griffies)
+/
+!-----------------------------------------------------------------------
+&namtra_dmp    !   tracer: T & S newtonian damping                  
+!-----------------------------------------------------------------------
+   ln_tradmp   =  .true.   !  add a damping termn (T) or not (F)
+   nn_hdmp     =   -1      !  horizontal shape =-1, damping in Med and Red Seas only
+                           !                   =XX, damping poleward of XX degrees (XX>0)
+                           !                      + F(distance-to-coast) + Red and Med Seas
+   nn_zdmp     =    0      !  vertical   shape =0    damping throughout the water column
+                           !                   =1 no damping in the mixing layer (kz  criteria)
+                           !                   =2 no damping in the mixed  layer (rho crieria)
+   rn_surf     =   50.     !  surface time scale of damping   [days]
+   rn_bot      =  360.     !  bottom  time scale of damping   [days]
+   rn_dep      =  800.     !  depth of transition between rn_surf and rn_bot [meters]
+   nn_file     =    0      !  create a damping.coeff NetCDF file (=1) or not (=0)
+/
+
+!!======================================================================
+!!                      ***  Dynamics namelists  ***
+!!======================================================================
+!!   namdyn_adv    formulation of the momentum advection
+!!   namdyn_vor    advection scheme
+!!   namdyn_hpg    hydrostatic pressure gradient
+!!   namdyn_spg    surface pressure gradient                            (CPP key only)
+!!   namdyn_ldf    lateral diffusion scheme
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namdyn_adv    !   formulation of the momentum advection
+!-----------------------------------------------------------------------
+   ln_dynadv_vec = .true.  !  vector form (T) or flux form (F)  
+   ln_dynadv_cen2= .false. !  flux form - 2nd order centered scheme
+   ln_dynadv_ubs = .false. !  flux form - 3rd order UBS      scheme 
+/  
+!-----------------------------------------------------------------------
+&namdyn_vor    !   option of physics/algorithm (not control by CPP keys)
+!-----------------------------------------------------------------------
+   ln_dynvor_ene = .false. !  enstrophy conserving scheme  
+   ln_dynvor_ens = .false. !  energy conserving scheme    
+   ln_dynvor_mix = .false. !  mixed scheme               
+   ln_dynvor_een = .true.  !  energy & enstrophy scheme  
+/
+!-----------------------------------------------------------------------
+&namdyn_hpg    !   Hydrostatic pressure gradient option
+!-----------------------------------------------------------------------
+   ln_hpg_zco  = .false.   !  z-coordinate - full steps                   
+   ln_hpg_zps  = .true.    !  z-coordinate - partial steps (interpolation)
+   ln_hpg_sco  = .false.   !  s-coordinate (standard jacobian formulation)
+   ln_hpg_djc  = .false.   !  s-coordinate (Density Jacobian with Cubic polynomial)
+   ln_hpg_prj  = .false.   !  s-coordinate (Pressure Jacobian scheme)
+   ln_dynhpg_imp = .false. !  time stepping: semi-implicit time scheme  (T)
+                                 !           centered      time scheme  (F)
+/
+!-----------------------------------------------------------------------
+!namdyn_spg    !   surface pressure gradient   (CPP key only)
+!-----------------------------------------------------------------------
+!                          !  explicit free surface                     ("key_dynspg_exp")
+!                          !  filtered free surface                     ("key_dynspg_flt")
+!                          !  split-explicit free surface               ("key_dynspg_ts")
+
+!-----------------------------------------------------------------------
+&namdyn_ldf    !   lateral diffusion on momentum
+!-----------------------------------------------------------------------
+   !                       !  Type of the operator : 
+   ln_dynldf_lap    =  .true.   !  laplacian operator         
+   ln_dynldf_bilap  =  .false.  !  bilaplacian operator    
+   !                       !  Direction of action  : 
+   ln_dynldf_level  =  .false.  !  iso-level               
+   ln_dynldf_hor    =  .true.   !  horizontal (geopotential)            (require "key_ldfslp" in s-coord.)
+   ln_dynldf_iso    =  .false.  !  iso-neutral                          (require "key_ldfslp")
+   !                       !  Coefficient
+   rn_ahm_0_lap     = 40000.    !  horizontal laplacian eddy viscosity   [m2/s]
+   rn_ahmb_0        =     0.    !  background eddy viscosity for ldf_iso [m2/s]
+   rn_ahm_0_blp     =     0.    !  horizontal bilaplacian eddy viscosity [m4/s] 
+/
+
+!!======================================================================
+!!             Tracers & Dynamics vertical physics namelists
+!!======================================================================
+!!    namzdf        vertical physics
+!!    namzdf_ric    richardson number dependent vertical mixing         ("key_zdfric")
+!!    namzdf_tke    TKE dependent vertical mixing                       ("key_zdftke")
+!!    namzdf_kpp    KPP dependent vertical mixing                       ("key_zdfkpp")
+!!    namzdf_ddm    double diffusive mixing parameterization            ("key_zdfddm")
+!!    namzdf_tmx    tidal mixing parameterization                       ("key_zdftmx")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namzdf        !   vertical physics
+!-----------------------------------------------------------------------
+   rn_avm0     =   1.2e-4  !  vertical eddy viscosity   [m2/s]          (background Kz if not "key_zdfcst")
+   rn_avt0     =   1.2e-5  !  vertical eddy diffusivity [m2/s]          (background Kz if not "key_zdfcst")
+   nn_avb      =    0      !  profile for background avt & avm (=1) or not (=0)
+   nn_havtb    =    0      !  horizontal shape for avtb (=1) or not (=0)
+   ln_zdfevd   = .true.    !  enhanced vertical diffusion (evd) (T) or not (F)
+   nn_evdm     =    0      !  evd apply on tracer (=0) or on tracer and momentum (=1)
+   rn_avevd    =  100.     !  evd mixing coefficient [m2/s]
+   ln_zdfnpc   = .false.   !  Non-Penetrative Convective algorithm (T) or not (F)
+   nn_npc      =    1            !  frequency of application of npc
+   nn_npcp     =  365            !  npc control print frequency
+   ln_zdfexp   = .false.   !  time-stepping: split-explicit (T) or implicit (F) time stepping
+   nn_zdfexp   =    3            !  number of sub-timestep for ln_zdfexp=T
+/
+!-----------------------------------------------------------------------
+&namzdf_ric    !   richardson number dependent vertical diffusion       ("key_zdfric" )
+!-----------------------------------------------------------------------
+   rn_avmri    = 100.e-4   !  maximum value of the vertical viscosity
+   rn_alp      =   5.      !  coefficient of the parameterization
+   nn_ric      =   2       !  coefficient of the parameterization
+   rn_ekmfc    =   0.7     !  Factor in the Ekman depth Equation
+   rn_mldmin   =   1.0     !  minimum allowable mixed-layer depth estimate (m)
+   rn_mldmax   =1000.0     !  maximum allowable mixed-layer depth estimate (m)
+   rn_wtmix    =  10.0     !  vertical eddy viscosity coeff [m2/s] in the mixed-layer
+   rn_wvmix    =  10.0     !  vertical eddy diffusion coeff [m2/s] in the mixed-layer
+   ln_mldw     = .true.    !  Flag to use or not the mized layer depth param.
+/
+!-----------------------------------------------------------------------
+&namzdf_tke    !   turbulent eddy kinetic dependent vertical diffusion  ("key_zdftke")
+!-----------------------------------------------------------------------
+   rn_ediff    =   0.1     !  coef. for vertical eddy coef. (avt=rn_ediff*mxl*sqrt(e) )
+   rn_ediss    =   0.7     !  coef. of the Kolmogoroff dissipation
+   rn_ebb      =  67.83    !  coef. of the surface input of tke (=67.83 suggested when ln_mxl0=T)
+   rn_emin     =   1.e-6   !  minimum value of tke [m2/s2]
+   rn_emin0    =   1.e-4   !  surface minimum value of tke [m2/s2]
+   nn_mxl      =   2       !  mixing length: = 0 bounded by the distance to surface and bottom
+                           !                 = 1 bounded by the local vertical scale factor
+                           !                 = 2 first vertical derivative of mixing length bounded by 1
+                           !                 = 3 as =2 with distinct disspipative an mixing length scale
+   nn_pdl      =   1       !  Prandtl number function of richarson number (=1, avt=pdl(Ri)*avm) or not (=0, avt=avm)
+   ln_mxl0     = .true.    !  surface mixing length scale = F(wind stress) (T) or not (F)
+   rn_mxl0     =   0.04    !  surface  buoyancy lenght scale minimum value
+   ln_lc       = .true.    !  Langmuir cell parameterisation (Axell 2002)
+   rn_lc       =   0.15    !  coef. associated to Langmuir cells
+   nn_etau     =   1       !  penetration of tke below the mixed layer (ML) due to internal & intertial waves
+                           !        = 0 no penetration
+                           !        = 1 add a tke source below the ML
+                           !        = 2 add a tke source just at the base of the ML
+                           !        = 3 as = 1 applied on HF part of the stress    ("key_coupled")
+   rn_efr      =   0.05    !  fraction of surface tke value which penetrates below the ML (nn_etau=1 or 2)
+   nn_htau     =   1       !  type of exponential decrease of tke penetration below the ML
+                           !        = 0  constant 10 m length scale
+                           !        = 1  0.5m at the equator to 30m poleward of 40 degrees
+/
+!------------------------------------------------------------------------
+&namzdf_kpp    !   K-Profile Parameterization dependent vertical mixing  ("key_zdfkpp", and optionally:
+!------------------------------------------------------------------------ "key_kppcustom" or "key_kpplktb")
+   ln_kpprimix = .true.    !  shear instability mixing 
+   rn_difmiw   =  1.0e-04  !  constant internal wave viscosity [m2/s]
+   rn_difsiw   =  0.1e-04  !  constant internal wave diffusivity [m2/s]
+   rn_riinfty  =  0.8      !  local Richardson Number limit for shear instability
+   rn_difri    =  0.0050   !  maximum shear mixing at Rig = 0    [m2/s]
+   rn_bvsqcon  = -0.01e-07 !  Brunt-Vaisala squared for maximum convection [1/s2] 
+   rn_difcon   =  1.       !  maximum mixing in interior convection [m2/s] 
+   nn_avb      =  0        !  horizontal averaged (=1) or not (=0) on avt and amv
+   nn_ave      =  1        !  constant (=0) or profile (=1) background on avt
+/
+!-----------------------------------------------------------------------
+&namzdf_gls                !   GLS vertical diffusion                   ("key_zdfgls")
+!-----------------------------------------------------------------------
+   rn_emin       = 1.e-6   !  minimum value of e   [m2/s2]
+   rn_epsmin     = 1.e-12  !  minimum value of eps [m2/s3]
+   ln_length_lim = .true.  !  limit on the dissipation rate under stable stratification (Galperin et al., 1988)
+   rn_clim_galp  = 0.53    !  galperin limit
+   ln_crban      = .true.  !  Use Craig & Banner (1994) surface wave mixing parametrisation
+   ln_sigpsi     = .true.  !  Activate or not Burchard 2001 mods on psi schmidt number in the wb case
+   rn_crban      = 100.    !  Craig and Banner 1994 constant for wb tke flux
+   rn_charn      = 70000.  !  Charnock constant for wb induced roughness length
+   nn_tkebc_surf =   1     !  surface tke condition (0/1/2=Dir/Neum/Dir Mellor-Blumberg)
+   nn_tkebc_bot  =   1     !  bottom tke condition (0/1=Dir/Neum)
+   nn_psibc_surf =   1     !  surface psi condition (0/1/2=Dir/Neum/Dir Mellor-Blumberg)
+   nn_psibc_bot  =   1     !  bottom psi condition (0/1=Dir/Neum)
+   nn_stab_func  =   2     !  stability function (0=Galp, 1= KC94, 2=CanutoA, 3=CanutoB)
+   nn_clos       =   1     !  predefined closure type (0=MY82, 1=k-eps, 2=k-w, 3=Gen)
+/
+!-----------------------------------------------------------------------
+&namzdf_ddm    !   double diffusive mixing parameterization             ("key_zdfddm")
+!-----------------------------------------------------------------------
+   rn_avts     = 1.e-4     !  maximum avs (vertical mixing on salinity)
+   rn_hsbfr    = 1.6       !  heat/salt buoyancy flux ratio
+/
+!-----------------------------------------------------------------------
+&namzdf_tmx    !   tidal mixing parameterization                        ("key_zdftmx")
+!-----------------------------------------------------------------------
+   rn_htmx     = 500.      !  vertical decay scale for turbulence (meters)
+   rn_n2min    = 1.e-8     !  threshold of the Brunt-Vaisala frequency (s-1)
+   rn_tfe      = 0.333     !  tidal dissipation efficiency
+   rn_me       = 0.2       !  mixing efficiency 
+   ln_tmx_itf  = .true.    !  ITF specific parameterisation
+   rn_tfe_itf  = 1.        !  ITF tidal dissipation efficiency
+/
+
+!!======================================================================
+!!                  ***  Miscellaneous namelists  ***
+!!======================================================================
+!!   nammpp            Massively Parallel Processing                    ("key_mpp_mpi)
+!!   namctl            Control prints & Benchmark
+!!   namsol            elliptic solver / island / free surface 
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namsol        !   elliptic solver / island / free surface 
+!-----------------------------------------------------------------------
+   nn_solv     =      1    !  elliptic solver: =1 preconditioned conjugate gradient (pcg)
+                           !                   =2 successive-over-relaxation (sor)
+   nn_sol_arp  =      0    !  absolute/relative (0/1) precision convergence test
+   rn_eps      =  1.e-6    !  absolute precision of the solver
+   nn_nmin     =    300    !  minimum of iterations for the SOR solver
+   nn_nmax     =    800    !  maximum of iterations for the SOR solver
+   nn_nmod     =     10    !  frequency of test for the SOR solver
+   rn_resmax   =  1.e-10   !  absolute precision for the SOR solver
+   rn_sor      =  1.92     !  optimal coefficient for SOR solver (to be adjusted with the domain)
+/
+!-----------------------------------------------------------------------
+&nammpp        !   Massively Parallel Processing                        ("key_mpp_mpi)
+!-----------------------------------------------------------------------
+   cn_mpi_send =  'I'      !  mpi send/recieve type   ='S', 'B', or 'I' for standard send,
+                           !  buffer blocking send or immediate non-blocking sends, resp.
+   nn_buffer   =   0       !  size in bytes of exported buffer ('B' case), 0 no exportation
+   ln_nnogather=  .false.  !  activate code to avoid mpi_allgather use at the northfold
+   jpni        =   0       !  jpni   number of processors following i (set automatically if < 1)
+   jpnj        =   0       !  jpnj   number of processors following j (set automatically if < 1)
+   jpnij       =   0       !  jpnij  number of local domains (set automatically if < 1)
+/
+!-----------------------------------------------------------------------
+&namctl        !   Control prints & Benchmark
+!-----------------------------------------------------------------------
+   ln_ctl      = .false.   !  trends control print (expensive!)
+   nn_print    =    0      !  level of print (0 no extra print)
+   nn_ictls    =    0      !  start i indice of control sum (use to compare mono versus
+   nn_ictle    =    0      !  end   i indice of control sum        multi processor runs
+   nn_jctls    =    0      !  start j indice of control               over a subdomain)
+   nn_jctle    =    0      !  end   j indice of control
+   nn_isplt    =    1      !  number of processors in i-direction
+   nn_jsplt    =    1      !  number of processors in j-direction
+   nn_bench    =    0      !  Bench mode (1/0): CAUTION use zero except for bench
+                           !     (no physical validity of the results)
+   nn_timing   =    0      !  timing by routine activated (=1) creates timing.output file, or not (=0)
+/
+
+!!======================================================================
+!!                  ***  Diagnostics namelists  ***
+!!======================================================================
+!!   namnc4       netcdf4 chunking and compression settings             ("key_netcdf4")
+!!   namtrd       dynamics and/or tracer trends                         ("key_trddyn","key_trdtra","key_trdmld")
+!!   namflo       float parameters                                      ("key_float")
+!!   namptr       Poleward Transport Diagnostics
+!!   namhsb       Heat and salt budgets 
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namnc4        !   netcdf4 chunking and compression settings            ("key_netcdf4")
+!-----------------------------------------------------------------------
+   nn_nchunks_i=   4       !  number of chunks in i-dimension
+   nn_nchunks_j=   4       !  number of chunks in j-dimension
+   nn_nchunks_k=   31      !  number of chunks in k-dimension
+                           !  setting nn_nchunks_k = jpk will give a chunk size of 1 in the vertical which
+                           !  is optimal for postprocessing which works exclusively with horizontal slabs
+   ln_nc4zip   = .true.    !  (T) use netcdf4 chunking and compression
+                           !  (F) ignore chunking information and produce netcdf3-compatible files
+/
+!-----------------------------------------------------------------------
+&namtrd        !   diagnostics on dynamics and/or tracer trends         ("key_trddyn" and/or "key_trdtra")
+!              !       or mixed-layer trends or barotropic vorticity    ("key_trdmld" or     "key_trdvor")
+!-----------------------------------------------------------------------
+   nn_trd      = 365       !  time step frequency dynamics and tracers trends
+   nn_ctls     =   0       !  control surface type in mixed-layer trends (0,1 or n<jpk)
+   rn_ucf      =   1.      !  unit conversion factor (=1 -> /seconds ; =86400. -> /day)
+   cn_trdrst_in      = "restart_mld"   ! suffix of ocean restart name (input)
+   cn_trdrst_out     = "restart_mld"   ! suffix of ocean restart name (output)
+   ln_trdmld_restart = .false.         !  restart for ML diagnostics
+   ln_trdmld_instant = .false.         !  flag to diagnose trends of instantantaneous or mean ML T/S
+/
+!-----------------------------------------------------------------------
+&namflo       !   float parameters                                      ("key_float")
+!-----------------------------------------------------------------------
+   jpnfl         = 1          !  total number of floats during the run
+   jpnnewflo     = 0          !  number of floats for the restart
+   ln_rstflo     = .false.    !  float restart (T) or not (F)
+   nn_writefl    =      75    !  frequency of writing in float output file 
+   nn_stockfl    =    5475    !  frequency of creation of the float restart file 
+   ln_argo       = .false.    !  Argo type floats (stay at the surface each 10 days)
+   ln_flork4     = .false.    !  trajectories computed with a 4th order Runge-Kutta (T)
+                              !  or computed with Blanke' scheme (F)
+   ln_ariane     = .true.     !  Input with Ariane tool convention(T)
+   ln_flo_ascii  = .true.     !  Output with Ariane tool netcdf convention(F) or ascii file (T)
+/
+!-----------------------------------------------------------------------
+&namptr       !   Poleward Transport Diagnostic
+!-----------------------------------------------------------------------
+   ln_diaptr  = .false.    !  Poleward heat and salt transport (T) or not (F)
+   ln_diaznl  = .true.     !  Add zonal means and meridional stream functions
+   ln_subbas  = .true.     !  Atlantic/Pacific/Indian basins computation (T) or not 
+                           !  (orca configuration only, need input basins mask file named "subbasins.nc"
+   ln_ptrcomp = .true.     !  Add decomposition : overturning
+   nn_fptr    =  1         !  Frequency of ptr computation [time step]
+   nn_fwri    =  15        !  Frequency of ptr outputs [time step]
+/
+!-----------------------------------------------------------------------
+&namhsb       !  Heat and salt budgets 
+!-----------------------------------------------------------------------
+   ln_diahsb  = .false.    !  check the heat and salt budgets (T) or not (F)
+/
+!-----------------------------------------------------------------------
+&nam_diaharm   !   Harmonic analysis of tidal constituents ('key_diaharm')
+!-----------------------------------------------------------------------
+    nit000_han = 1         ! First time step used for harmonic analysis
+    nitend_han = 75        ! Last time step used for harmonic analysis
+    nstep_han  = 15        ! Time step frequency for harmonic analysis
+    tname(1)   = 'M2'      ! Name of tidal constituents
+    tname(2)   = 'K1'
+/
+!-----------------------------------------------------------------------
+&namdct        ! transports through sections
+!-----------------------------------------------------------------------
+    nn_dct      = 15       !  time step frequency for transports computing
+    nn_dctwri   = 15       !  time step frequency for transports writing
+    nn_secdebug = 112      !      0 : no section to debug
+                           !     -1 : debug all section
+                           !  0 < n : debug section number n
+/
+
+!!======================================================================
+!!            ***  Observation & Assimilation namelists ***
+!!======================================================================
+!!   namobs       observation and model comparison                      ('key_diaobs')
+!!   nam_asminc   assimilation increments                               ('key_asminc')
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namobs       !  observation usage switch                               ('key_diaobs')
+!-----------------------------------------------------------------------
+   ln_t3d     = .false.    ! Logical switch for T profile observations         
+   ln_s3d     = .false.    ! Logical switch for S profile observations          
+   ln_ena     = .false.    ! Logical switch for ENACT insitu data set           
+   !                       !     ln_cor                  Logical switch for Coriolis insitu data set       
+   ln_profb   = .false.    ! Logical switch for feedback insitu data set     
+   ln_sla     = .false.    ! Logical switch for SLA observations               
+
+   ln_sladt   = .false.    ! Logical switch for AVISO SLA data              
+
+   ln_slafb   = .false.    ! Logical switch for feedback SLA data            
+                           !     ln_ssh                  Logical switch for SSH observations              
+
+   ln_sst     = .false.    ! Logical switch for SST observations              
+                           !     ln_reysst               Logical switch for Reynolds observations       
+                           !     ln_ghrsst               Logical switch for GHRSST observations          
+
+   ln_sstfb   = .false.    ! Logical switch for feedback SST data          
+                           !     ln_sss                  Logical switch for SSS observations              
+                           !     ln_seaice               Logical switch for Sea Ice observations        
+                           !     ln_vel3d                Logical switch for velocity observations         
+                           !     ln_velavcur             Logical switch for velocity daily av. cur.    
+                           !     ln_velhrcur             Logical switch for velocity high freq. cur.   
+                           !     ln_velavadcp            Logical switch for velocity daily av. ADCP  
+                           !     ln_velhradcp            Logical switch for velocity high freq. ADCP
+                           !     ln_velfb                Logical switch for feedback velocity data       
+                           !     ln_grid_global          Global distribtion of observations         
+                           !     ln_grid_search_lookup   Logical switch for obs grid search w/lookup table  
+                           !     grid_search_file        Grid search lookup file header 
+                           !     enactfiles              ENACT input observation file names 
+                           !     coriofiles              Coriolis input observation file name  
+   !                       ! profbfiles: Profile feedback input observation file name 
+   profbfiles = 'profiles_01.nc'
+                           !     ln_profb_enatim         Enact feedback input time setting switch    
+                           !     slafilesact             Active SLA input observation file name
+                           !     slafilespas             Passive SLA input observation file name 
+   !                       ! slafbfiles: Feedback SLA input observation file name 
+   slafbfiles = 'sla_01.nc'
+                           !     sstfiles                GHRSST input observation file name       
+   !                       ! sstfbfiles: Feedback SST input observation file name 
+   sstfbfiles = 'sst_01.nc' 'sst_02.nc' 'sst_03.nc' 'sst_04.nc' 'sst_05.nc'
+                           !     seaicefiles             Sea Ice input observation file name 
+                           !     velavcurfiles           Vel. cur. daily av. input file name  
+                           !     velhvcurfiles           Vel. cur. high freq. input file name  
+                           !     velavadcpfiles          Vel. ADCP daily av. input file name    
+                           !     velhvadcpfiles          Vel. ADCP high freq. input file name 
+                           !     velfbfiles              Vel. feedback input observation file name 
+                           !     dobsini                 Initial date in window YYYYMMDD.HHMMSS       
+                           !     dobsend                 Final date in window YYYYMMDD.HHMMSS         
+                           !     n1dint                  Type of vertical interpolation method        
+                           !     n2dint                  Type of horizontal interpolation method       
+                           !     ln_nea                  Rejection of observations near land switch    
+   nmsshc     = 0          ! MSSH correction scheme                         
+                           !     mdtcorr                 MDT  correction                               
+                           !     mdtcutoff               MDT cutoff for computed correction          
+   ln_altbias = .false.    ! Logical switch for alt bias                
+   ln_ignmis  = .true.     ! Logical switch for ignoring missing files   
+                           !     endailyavtypes   ENACT daily average types                    
+   ln_grid_global = .true.
+   ln_grid_search_lookup = .false.
+/ 
+!-----------------------------------------------------------------------
+&nam_asminc   !   assimilation increments                               ('key_asminc')
+!-----------------------------------------------------------------------
+    ln_bkgwri = .false.    !  Logical switch for writing out background state 
+    ln_trjwri = .false.    !  Logical switch for writing out state trajectory
+    ln_trainc = .false.    !  Logical switch for applying tracer increments
+    ln_dyninc = .false.    !  Logical switch for applying velocity increments
+    ln_sshinc = .false.    !  Logical switch for applying SSH increments 
+    ln_asmdin = .false.    !  Logical switch for Direct Initialization (DI)
+    ln_asmiau = .false.    !  Logical switch for Incremental Analysis Updating (IAU)
+    nitbkg    = 0          !  Timestep of background in [0,nitend-nit000-1]
+    nitdin    = 0          !  Timestep of background for DI in [0,nitend-nit000-1]
+    nitiaustr = 1          !  Timestep of start of IAU interval in [0,nitend-nit000-1]
+    nitiaufin = 15         !  Timestep of end of IAU interval in [0,nitend-nit000-1]
+    niaufn    = 0          !  Type of IAU weighting function
+    nittrjfrq = 0          !  Frequency of trajectory output for 4D-VAR
+    ln_salfix = .false.    !  Logical switch for ensuring that the sa > salfixmin
+    salfixmin = -9999      !  Minimum salinity after applying the increments
+    nn_divdmp = 0          !  Number of iterations of divergence damping operator
+/
+!-----------------------------------------------------------------------
+&namsbc_wave   ! External fields from wave model
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_cdg      =  'cdg_wave' ,        1          , 'drag_coeff' , .true.   , .false. , 'daily'  ,''         , ''
+!
+   cn_dir_cdg  = './'  !  root directory for the location of drag coefficient files
+/
+!-----------------------------------------------------------------------
+&namdyn_nept  !   Neptune effect (simplified: lateral and vertical diffusions removed)
+!-----------------------------------------------------------------------
+   ! Suggested lengthscale values are those of Eby & Holloway (1994) for a coarse model
+   ln_neptsimp       = .false.  ! yes/no use simplified neptune
+
+   ln_smooth_neptvel = .false.  ! yes/no smooth zunep, zvnep
+   rn_tslse          =  1.2e4   ! value of lengthscale L at the equator
+   rn_tslsp          =  3.0e3   ! value of lengthscale L at the pole
+   ! Specify whether to ramp down the Neptune velocity in shallow
+   ! water, and if so the depth range controlling such ramping down
+   ln_neptramp       = .true.   ! ramp down Neptune velocity in shallow water
+   rn_htrmin         =  100.0   ! min. depth of transition range
+   rn_htrmax         =  200.0   ! max. depth of transition range
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_c14b
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_c14b	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_c14b	(revision 3680)
@@ -0,0 +1,19 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! Bomb C14  :       1  - dates                             (namc14date)
+!! namelists    
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namc14date     !   dates
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   ndate_beg_b  = 650101    !  datedeb1
+   nyear_res_b  = 1955      !  iannee1
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namc14dia     !   additional 2D/3D tracers diagnostics ("key_trc_diaadd")
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!              !    name   !           title of the field          !     units      !
+!              !           !                                       !                !
+   c14dia2d(1)  = 'qtr_c14  ' , 'Air-sea flux                      ',  'mol/m2/s    '
+   c14dia2d(2)  = 'qint_c14 ' , 'Cumulative air-sea flux           ',  'mol/m2      '
+   c14dia3d(1)  = 'decay    ' , 'Radiactive decay                  ',  'mol/m3      '
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_cfc
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_cfc	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_cfc	(revision 3680)
@@ -0,0 +1,18 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! CFC  :       1  - dates                                 (namcfcdate)
+!! namelists    
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namcfcdate     !   dates
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   ndate_beg  = 300101    !  datedeb1
+   nyear_res  = 1932      !  iannee1
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namcfcdia     !   additional 2D/3D tracers diagnostics 
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!              !    name   !           title of the field          !     units      !
+!              !           !                                       !                !
+   cfcdia2d(1)  = 'qtr_c11 ' , 'Air-sea flux of CFC-11           ',  'mol/m2/s    '
+   cfcdia2d(2)  = 'qint_c11' , 'Cumulative air-sea flux of CFC-11 ', 'mol/m2      '
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_ice
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_ice	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_ice	(revision 3680)
@@ -0,0 +1,1 @@
+link ../../ORCA2_LIM/EXP00/namelist_ice_lim2
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_ice_lim2
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_ice_lim2	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_ice_lim2	(revision 3680)
@@ -0,0 +1,1 @@
+link ../../ORCA2_LIM/EXP00/namelist_ice_lim2
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_ice_lim3
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_ice_lim3	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_ice_lim3	(revision 3680)
@@ -0,0 +1,1 @@
+link ../../ORCA2_LIM/EXP00/namelist_ice_lim3
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_top
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_top	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_top	(revision 3680)
@@ -0,0 +1,105 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/TOP1 :  1 - tracer definition                     (namtrc    )
+!!              2 - tracer data initialisation            (namtrc_dta)
+!!              3 - tracer advection                      (namtrc_adv)
+!!              4 - tracer lateral diffusion              (namtrc_ldf)
+!!              5 - tracer vertical physics               (namtrc_zdf)
+!!              6 - tracer newtonian damping              (namtrc_dmp)
+!!              7 - dynamical tracer trends               (namtrc_trd)
+!!              8 - tracer output diagonstics             (namtrc_dia)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namtrc     !   tracers definition
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   nn_dttrc      =  1        !  time step frequency for passive sn_tracers      
+   nn_writetrc   =  5475      !  time step frequency for sn_tracer outputs
+   ln_rsttr      = .false.   !  start from a restart file (T) or not (F)
+   nn_rsttr      =   0       !  restart control = 0 initial time step is not compared to the restart file value
+                           !                  = 1 do not use the value in the restart file
+                           !                  = 2 calendar parameters read in the restart file
+   cn_trcrst_in  = "restart_trc"   !  suffix of pass. sn_tracer restart name (input)
+   cn_trcrst_out = "restart_trc"   !  suffix of pass. sn_tracer restart name (output)
+   ln_trcdta     =  .false. !  Initialisation from data input file (T) or not (F)
+   ln_trcdmp     =  .false.  !  add a damping termn (T) or not (F)
+!
+!              !    name   !           title of the field              !   units    ! initial data ! save   !
+!              !           !                                           !            ! from file    ! or not ! 
+!              !           !                                           !            ! or not       !        !
+   sn_tracer(1)  = 'CFC11   ' , 'CFC11 Concentration                    ',  'umolC/L',   .false.    ,  .true.
+   sn_tracer(2)  = 'C14B    ' , 'Bomb C14 Concentration                 ',  'ration ',   .false.    ,  .true.
+/
+!-----------------------------------------------------------------------
+&namtrc_dta      !    Initialisation from data input file
+!-----------------------------------------------------------------------
+!
+!                !  file name               ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!                !                          !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+/
+!-----------------------------------------------------------------------
+&namtrc_adv    !   advection scheme for passive tracer 
+!-----------------------------------------------------------------------
+   ln_trcadv_cen2   =  .false.  !  2nd order centered scheme   
+   ln_trcadv_tvd    =  .true.  !  TVD scheme
+   ln_trcadv_muscl  =  .false.   !  MUSCL scheme
+   ln_trcadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries
+   ln_trcadv_ubs    =  .false.  !  UBS scheme
+   ln_trcadv_qck    =  .false.  !  QUICKEST scheme
+/
+!-----------------------------------------------------------------------
+&namtrc_ldf    !   lateral diffusion scheme for passive tracer 
+!-----------------------------------------------------------------------
+   ln_trcldf_diff   =  .true.   !  performs lateral diffusion (T) or not (F)
+!                               !  Type of the operator : 
+   ln_trcldf_lap    =  .true.   !     laplacian operator       
+   ln_trcldf_bilap  =  .false.  !     bilaplacian operator     
+                                !  Direction of action  :
+   ln_trcldf_level  =  .false.  !     iso-level                
+   ln_trcldf_hor    =  .false.  !     horizontal (geopotential)         (require "key_ldfslp" when ln_sco=T)
+   ln_trcldf_iso    =  .true.   !     iso-neutral                       (require "key_ldfslp")
+!                               !  Coefficient
+   rn_ahtrc_0       =  2000.    !  horizontal eddy diffusivity for tracers [m2/s]
+   rn_ahtrb_0       =     0.    !     background eddy diffusivity for ldf_iso [m2/s]
+/
+!-----------------------------------------------------------------------
+&namtrc_zdf        !   vertical physics
+!-----------------------------------------------------------------------
+   ln_trczdf_exp   =  .false.  !  split explicit (T) or implicit (F) time stepping
+   nn_trczdf_exp   =   3       !  number of sub-timestep for ln_trczdfexp=T
+/
+!-----------------------------------------------------------------------
+&namtrc_rad        !  treatment of negative concentrations 
+!-----------------------------------------------------------------------
+   ln_trcrad   =  .true.  !  artificially correct negative concentrations (T) or not (F)
+/
+!-----------------------------------------------------------------------
+&namtrc_dmp    !   passive tracer newtonian damping   
+!-----------------------------------------------------------------------
+   nn_hdmp_tr  =   -1      !  horizontal shape =-1, damping in Med and Red Seas only
+                           !                   =XX, damping poleward of XX degrees (XX>0)
+                           !                      + F(distance-to-coast) + Red and Med Seas
+   nn_zdmp_tr  =    1      !  vertical   shape =0    damping throughout the water column
+                           !                   =1 no damping in the mixing layer (kz  criteria)
+                           !                   =2 no damping in the mixed  layer (rho crieria)
+   rn_surf_tr  =   50.     !  surface time scale of damping   [days]
+   rn_bot_tr   =  360.     !  bottom  time scale of damping   [days]
+   rn_dep_tr   =  800.     !  depth of transition between rn_surf and rn_bot [meters]
+   nn_file_tr  =    0      !  create a damping.coeff NetCDF file (=1) or not (=0)
+/
+!-----------------------------------------------------------------------
+&namtrc_trd       !   diagnostics on tracer trends        ('key_trdtrc')
+!                          or mixed-layer trends          ('key_trdmld_trc')
+!----------------------------------------------------------------------
+   nn_trd_trc  =  5475       !  time step frequency and tracers trends
+   nn_ctls_trc =   0        !  control surface type in mixed-layer trends (0,1 or n<jpk)
+   rn_ucf_trc  =   86400    !  unit conversion factor (=1 -> /seconds ; =86400. -> /day)
+   ln_trdmld_trc_restart = .false.  !  restart for ML diagnostics
+   ln_trdmld_trc_instant = .true.  !  flag to diagnose trends of instantantaneous or mean ML T/S
+   ln_trdtrc(1)  =   .true.
+   ln_trdtrc(2)  =   .true.
+/
+!-----------------------------------------------------------------------
+&namtrc_dia       !   parameters for passive tracer additional diagnostics
+!----------------------------------------------------------------------
+   ln_diatrc     =  .true.   !  save additional diag. (T) or not (F)
+   nn_writedia   =  5475     !  time step frequency for diagnostics
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/splco2.dat
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/splco2.dat	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/splco2.dat	(revision 3680)
@@ -0,0 +1,482 @@
+#  4  452
+#   Weighted smoothing spline fit
+# Ice core and Mauna Loa CO2                                       
+# 50% attenuation at     23.4968    ; REG =     100.000 
+#     Time     Smoothed data   
+ 1765.0  277.9514
+ 1765.5  277.9652
+ 1766.0  277.9797
+ 1766.5  277.9949
+ 1767.0  278.0108
+ 1767.5  278.0275
+ 1768.0  278.0448
+ 1768.5  278.0628
+ 1769.0  278.0816
+ 1769.5  278.1011
+ 1770.0  278.1213
+ 1770.5  278.1423
+ 1771.0  278.1640
+ 1771.5  278.1864
+ 1772.0  278.2096
+ 1772.5  278.2335
+ 1773.0  278.2581
+ 1773.5  278.2835
+ 1774.0  278.3097
+ 1774.5  278.3366
+ 1775.0  278.3642
+ 1775.5  278.3927
+ 1776.0  278.4218
+ 1776.5  278.4518
+ 1777.0  278.4825
+ 1777.5  278.5140
+ 1778.0  278.5463
+ 1778.5  278.5793
+ 1779.0  278.6132
+ 1779.5  278.6478
+ 1780.0  278.6832
+ 1780.5  278.7194
+ 1781.0  278.7564
+ 1781.5  278.7942
+ 1782.0  278.8327
+ 1782.5  278.8721
+ 1783.0  278.9123
+ 1783.5  278.9533
+ 1784.0  278.9951
+ 1784.5  279.0378
+ 1785.0  279.0812
+ 1785.5  279.1255
+ 1786.0  279.1706
+ 1786.5  279.2165
+ 1787.0  279.2633
+ 1787.5  279.3109
+ 1788.0  279.3593
+ 1788.5  279.4085
+ 1789.0  279.4586
+ 1789.5  279.5096
+ 1790.0  279.5614
+ 1790.5  279.6140
+ 1791.0  279.6676
+ 1791.5  279.7219
+ 1792.0  279.7772
+ 1792.5  279.8332
+ 1793.0  279.8902
+ 1793.5  279.9480
+ 1794.0  280.0067
+ 1794.5  280.0662
+ 1795.0  280.1266
+ 1795.5  280.1878
+ 1796.0  280.2499
+ 1796.5  280.3129
+ 1797.0  280.3767
+ 1797.5  280.4414
+ 1798.0  280.5069
+ 1798.5  280.5732
+ 1799.0  280.6401
+ 1799.5  280.7077
+ 1800.0  280.7759
+ 1800.5  280.8447
+ 1801.0  280.9139
+ 1801.5  280.9836
+ 1802.0  281.0537
+ 1802.5  281.1241
+ 1803.0  281.1948
+ 1803.5  281.2657
+ 1804.0  281.3369
+ 1804.5  281.4081
+ 1805.0  281.4794
+ 1805.5  281.5508
+ 1806.0  281.6221
+ 1806.5  281.6933
+ 1807.0  281.7644
+ 1807.5  281.8354
+ 1808.0  281.9060
+ 1808.5  281.9764
+ 1809.0  282.0465
+ 1809.5  282.1161
+ 1810.0  282.1853
+ 1810.5  282.2540
+ 1811.0  282.3222
+ 1811.5  282.3897
+ 1812.0  282.4566
+ 1812.5  282.5228
+ 1813.0  282.5882
+ 1813.5  282.6528
+ 1814.0  282.7166
+ 1814.5  282.7794
+ 1815.0  282.8412
+ 1815.5  282.9021
+ 1816.0  282.9619
+ 1816.5  283.0205
+ 1817.0  283.0779
+ 1817.5  283.1343
+ 1818.0  283.1896
+ 1818.5  283.2438
+ 1819.0  283.2971
+ 1819.5  283.3495
+ 1820.0  283.4011
+ 1820.5  283.4519
+ 1821.0  283.5020
+ 1821.5  283.5513
+ 1822.0  283.6001
+ 1822.5  283.6483
+ 1823.0  283.6959
+ 1823.5  283.7432
+ 1824.0  283.7900
+ 1824.5  283.8365
+ 1825.0  283.8827
+ 1825.5  283.9286
+ 1826.0  283.9745
+ 1826.5  284.0201
+ 1827.0  284.0658
+ 1827.5  284.1115
+ 1828.0  284.1573
+ 1828.5  284.2032
+ 1829.0  284.2494
+ 1829.5  284.2958
+ 1830.0  284.3426
+ 1830.5  284.3898
+ 1831.0  284.4375
+ 1831.5  284.4857
+ 1832.0  284.5346
+ 1832.5  284.5842
+ 1833.0  284.6345
+ 1833.5  284.6856
+ 1834.0  284.7376
+ 1834.5  284.7906
+ 1835.0  284.8445
+ 1835.5  284.8995
+ 1836.0  284.9557
+ 1836.5  285.0131
+ 1837.0  285.0718
+ 1837.5  285.1318
+ 1838.0  285.1932
+ 1838.5  285.2561
+ 1839.0  285.3206
+ 1839.5  285.3866
+ 1840.0  285.4543
+ 1840.5  285.5233
+ 1841.0  285.5936
+ 1841.5  285.6647
+ 1842.0  285.7366
+ 1842.5  285.8088
+ 1843.0  285.8812
+ 1843.5  285.9535
+ 1844.0  286.0255
+ 1844.5  286.0971
+ 1845.0  286.1683
+ 1845.5  286.2390
+ 1846.0  286.3091
+ 1846.5  286.3786
+ 1847.0  286.4475
+ 1847.5  286.5157
+ 1848.0  286.5831
+ 1848.5  286.6498
+ 1849.0  286.7157
+ 1849.5  286.7808
+ 1850.0  286.8451
+ 1850.5  286.9087
+ 1851.0  286.9714
+ 1851.5  287.0332
+ 1852.0  287.0943
+ 1852.5  287.1544
+ 1853.0  287.2138
+ 1853.5  287.2722
+ 1854.0  287.3298
+ 1854.5  287.3865
+ 1855.0  287.4423
+ 1855.5  287.4972
+ 1856.0  287.5515
+ 1856.5  287.6052
+ 1857.0  287.6583
+ 1857.5  287.7111
+ 1858.0  287.7635
+ 1858.5  287.8158
+ 1859.0  287.8680
+ 1859.5  287.9202
+ 1860.0  287.9725
+ 1860.5  288.0250
+ 1861.0  288.0778
+ 1861.5  288.1310
+ 1862.0  288.1848
+ 1862.5  288.2392
+ 1863.0  288.2942
+ 1863.5  288.3501
+ 1864.0  288.4070
+ 1864.5  288.4648
+ 1865.0  288.5238
+ 1865.5  288.5840
+ 1866.0  288.6455
+ 1866.5  288.7084
+ 1867.0  288.7726
+ 1867.5  288.8382
+ 1868.0  288.9053
+ 1868.5  288.9737
+ 1869.0  289.0437
+ 1869.5  289.1151
+ 1870.0  289.1880
+ 1870.5  289.2624
+ 1871.0  289.3384
+ 1871.5  289.4160
+ 1872.0  289.4954
+ 1872.5  289.5764
+ 1873.0  289.6592
+ 1873.5  289.7439
+ 1874.0  289.8304
+ 1874.5  289.9188
+ 1875.0  290.0092
+ 1875.5  290.1014
+ 1876.0  290.1957
+ 1876.5  290.2918
+ 1877.0  290.3899
+ 1877.5  290.4898
+ 1878.0  290.5917
+ 1878.5  290.6954
+ 1879.0  290.8010
+ 1879.5  290.9083
+ 1880.0  291.0174
+ 1880.5  291.1281
+ 1881.0  291.2405
+ 1881.5  291.3543
+ 1882.0  291.4697
+ 1882.5  291.5864
+ 1883.0  291.7044
+ 1883.5  291.8237
+ 1884.0  291.9442
+ 1884.5  292.0658
+ 1885.0  292.1885
+ 1885.5  292.3122
+ 1886.0  292.4368
+ 1886.5  292.5622
+ 1887.0  292.6884
+ 1887.5  292.8154
+ 1888.0  292.9430
+ 1888.5  293.0711
+ 1889.0  293.1996
+ 1889.5  293.3284
+ 1890.0  293.4572
+ 1890.5  293.5860
+ 1891.0  293.7147
+ 1891.5  293.8430
+ 1892.0  293.9709
+ 1892.5  294.0982
+ 1893.0  294.2247
+ 1893.5  294.3504
+ 1894.0  294.4751
+ 1894.5  294.5987
+ 1895.0  294.7210
+ 1895.5  294.8422
+ 1896.0  294.9626
+ 1896.5  295.0822
+ 1897.0  295.2014
+ 1897.5  295.3202
+ 1898.0  295.4390
+ 1898.5  295.5578
+ 1899.0  295.6769
+ 1899.5  295.7964
+ 1900.0  295.9167
+ 1900.5  296.0378
+ 1901.0  296.1599
+ 1901.5  296.2834
+ 1902.0  296.4082
+ 1902.5  296.5348
+ 1903.0  296.6631
+ 1903.5  296.7935
+ 1904.0  296.9261
+ 1904.5  297.0609
+ 1905.0  297.1977
+ 1905.5  297.3365
+ 1906.0  297.4772
+ 1906.5  297.6196
+ 1907.0  297.7637
+ 1907.5  297.9093
+ 1908.0  298.0562
+ 1908.5  298.2043
+ 1909.0  298.3535
+ 1909.5  298.5036
+ 1910.0  298.6545
+ 1910.5  298.8061
+ 1911.0  298.9584
+ 1911.5  299.1113
+ 1912.0  299.2648
+ 1912.5  299.4189
+ 1913.0  299.5734
+ 1913.5  299.7285
+ 1914.0  299.8839
+ 1914.5  300.0397
+ 1915.0  300.1958
+ 1915.5  300.3522
+ 1916.0  300.5088
+ 1916.5  300.6656
+ 1917.0  300.8225
+ 1917.5  300.9796
+ 1918.0  301.1368
+ 1918.5  301.2941
+ 1919.0  301.4514
+ 1919.5  301.6087
+ 1920.0  301.7659
+ 1920.5  301.9232
+ 1921.0  302.0803
+ 1921.5  302.2373
+ 1922.0  302.3942
+ 1922.5  302.5508
+ 1923.0  302.7071
+ 1923.5  302.8628
+ 1924.0  303.0179
+ 1924.5  303.1723
+ 1925.0  303.3258
+ 1925.5  303.4783
+ 1926.0  303.6298
+ 1926.5  303.7800
+ 1927.0  303.9290
+ 1927.5  304.0764
+ 1928.0  304.2224
+ 1928.5  304.3668
+ 1929.0  304.5098
+ 1929.5  304.6515
+ 1930.0  304.7920
+ 1930.5  304.9312
+ 1931.0  305.0694
+ 1931.5  305.2066
+ 1932.0  305.3428
+ 1932.5  305.4782
+ 1933.0  305.6128
+ 1933.5  305.7468
+ 1934.0  305.8803
+ 1934.5  306.0135
+ 1935.0  306.1465
+ 1935.5  306.2795
+ 1936.0  306.4126
+ 1936.5  306.5461
+ 1937.0  306.6801
+ 1937.5  306.8148
+ 1938.0  306.9503
+ 1938.5  307.0871
+ 1939.0  307.2251
+ 1939.5  307.3647
+ 1940.0  307.5059
+ 1940.5  307.6490
+ 1941.0  307.7943
+ 1941.5  307.9417
+ 1942.0  308.0917
+ 1942.5  308.2444
+ 1943.0  308.3999
+ 1943.5  308.5586
+ 1944.0  308.7204
+ 1944.5  308.8857
+ 1945.0  309.0544
+ 1945.5  309.2267
+ 1946.0  309.4026
+ 1946.5  309.5824
+ 1947.0  309.7661
+ 1947.5  309.9538
+ 1948.0  310.1455
+ 1948.5  310.3415
+ 1949.0  310.5418
+ 1949.5  310.7465
+ 1950.0  310.9557
+ 1950.5  311.1696
+ 1951.0  311.3883
+ 1951.5  311.6119
+ 1952.0  311.8406
+ 1952.5  312.0746
+ 1953.0  312.3139
+ 1953.5  312.5587
+ 1954.0  312.8091
+ 1954.5  313.0653
+ 1955.0  313.3275
+ 1955.5  313.5958
+ 1956.0  313.8704
+ 1956.5  314.1514
+ 1957.0  314.4390
+ 1957.5  314.7334
+ 1958.0  315.0347
+ 1958.5  315.3430
+ 1959.0  315.6585
+ 1959.5  315.9810
+ 1960.0  316.3099
+ 1960.5  316.6444
+ 1961.0  316.9835
+ 1961.5  317.3266
+ 1962.0  317.6732
+ 1962.5  318.0236
+ 1963.0  318.3782
+ 1963.5  318.7385
+ 1964.0  319.1062
+ 1964.5  319.4833
+ 1965.0  319.8721
+ 1965.5  320.2745
+ 1966.0  320.6922
+ 1966.5  321.1253
+ 1967.0  321.5737
+ 1967.5  322.0377
+ 1968.0  322.5174
+ 1968.5  323.0131
+ 1969.0  323.5248
+ 1969.5  324.0520
+ 1970.0  324.5937
+ 1970.5  325.1487
+ 1971.0  325.7158
+ 1971.5  326.2941
+ 1972.0  326.8828
+ 1972.5  327.4806
+ 1973.0  328.0859
+ 1973.5  328.6966
+ 1974.0  329.3108
+ 1974.5  329.9296
+ 1975.0  330.5549
+ 1975.5  331.1889
+ 1976.0  331.8340
+ 1976.5  332.4917
+ 1977.0  333.1631
+ 1977.5  333.8474
+ 1978.0  334.5436
+ 1978.5  335.2500
+ 1979.0  335.9649
+ 1979.5  336.6871
+ 1980.0  337.4153
+ 1980.5  338.1481
+ 1981.0  338.8848
+ 1981.5  339.6254
+ 1982.0  340.3708
+ 1982.5  341.1221
+ 1983.0  341.8802
+ 1983.5  342.6460
+ 1984.0  343.4197
+ 1984.5  344.2017
+ 1985.0  344.9922
+ 1985.5  345.7917
+ 1986.0  346.6006
+ 1986.5  347.4193
+ 1987.0  348.2476
+ 1987.5  349.0837
+ 1988.0  349.9257
+ 1988.5  350.7702
+ 1989.0  351.6200
+ 1989.5  352.4700
+ 1990.0  353.3200
+ 1990.5  354.1700
+ 1991.0  354.9666
+ 1991.5  355.4840
+ 1992.0  355.9125
+ 1992.5  356.2656
+ 1993.0  356.4832
+ 1993.5  356.9545
+ 1994.0  357.6902
+ 1994.5  358.6209
+ 1995.0  359.6369
+ 1995.5  360.6260
+ 1996.0  361.5229
+ 1996.5  362.3600
+ 1997.0  362.8839
+ 1997.5  363.4538
+ 1998.0  364.7527
+ 1998.5  366.5040
+ 1999.0  367.6363
+ 1999.5  368.1512
+ 2000.0  368.5849
+ 2000.5  369.4103
+ 2001.0  370.3523
+ 2001.5  371.0773
+ 2002.0  371.9717
+ 2002.5  373.1636
+ 2003.0  374.4362
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/xmlio_server.def
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/xmlio_server.def	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/xmlio_server.def	(revision 3680)
@@ -0,0 +1,35 @@
+! xmlio_server namelist
+!
+! using_server: .TRUE.(.FALSE.) to use(bypass) the io_server
+! using_oasis : .TRUE.(.FALSE.) if nemo is coupled through OASIS
+! client_id   : used only for OASIS, NEMO      id in the namecouple 
+! server_id   : used only for OASIS, io_server id in the namecouple
+!
+&coupling_param
+  using_server = .FALSE.
+  using_oasis  = .FALSE.
+  client_id    = 'nemo.x'
+  server_id    = 'ionemo'
+/
+
+! global_mpi_buffer_size: size in Mo of the MPI buffer used by the io_server
+&mpi_param
+  global_mpi_buffer_size = 512
+/  
+
+!!======================================================================
+!!   namnc4            netcdf4 chunking and compression settings
+!!======================================================================
+!-----------------------------------------------------------------------
+&namnc4         !  netcdf4 chunking and compression settings
+                !  (benign if "key_netcdf4" is not used)
+!-----------------------------------------------------------------------
+   nn_nchunks_i   =   4       !  number of chunks in i-dimension
+   nn_nchunks_j   =   4       !  number of chunks in j-dimension
+   nn_nchunks_k   =   31      !  number of chunks in k-dimension
+                              !  setting nn_nchunks_k = jpk will give a chunk size of 1 in the vertical which
+                              !  is optimal for postprocessing which works exclusively with horizontal slabs
+   ln_nc4zip      =   .FALSE.  !  (T) use netcdf4 chunking and compression
+                              !  (F) ignore chunking information and produce netcdf3-compatible files  
+/
+  
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/cpp_ORCA2_LIM_CFC_C14b.fcm
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/cpp_ORCA2_LIM_CFC_C14b.fcm	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/cpp_ORCA2_LIM_CFC_C14b.fcm	(revision 3680)
@@ -0,0 +1,1 @@
+bld::tool::fppkeys key_trabbl key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_zdftke key_zdfddm key_zdftmx key_top key_cfc key_c14b key_iomput
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/iodef.xml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/iodef.xml	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/iodef.xml	(revision 3680)
@@ -225,5 +225,5 @@
      <group id="ptrc_T" axis_ref="deptht" grid_ref="grid_T">
        <field id="DIC"      description="Dissolved inorganic Concentration"        unit="mmol/m3" />
-       <field id="Alkalini" description="Total Alkalinity Concentration"           unit="mmol/m3"    />
+       <field id="Alkalini" description="Total Alkalinity Concentration"           unit="mmol/m3" />
        <field id="O2"       description="Oxygen Concentration"                     unit="mmol/m3" />
        <field id="CaCO3"    description="Calcite Concentration"                    unit="mmol/m3" />
@@ -244,6 +244,6 @@
        <field id="GSi"      description="Sinking biogenic Silicate Concentration"  unit="mmol/m3" />
        <field id="NFe"      description="Nano iron Concentration"                  unit="mmol/m3" />
-       <field id="NCHL"     description="Nano chlorophyl Concentration"            unit="mg/m3" />
-       <field id="DCHL"     description="Diatoms chlorophyl Concentration"         unit="mg/m3" />
+       <field id="NCHL"     description="Nano chlorophyl Concentration"            unit="mg/m3"   />
+       <field id="DCHL"     description="Diatoms chlorophyl Concentration"         unit="mg/m3"   />
        <field id="NO3"      description="Nitrates Concentration"                   unit="mmol/m3" />
        <field id="NH4"      description="Ammonium Concentration"                   unit="mmol/m3" />
@@ -253,41 +253,57 @@
 
      <group id="diad_T" axis_ref="none" grid_ref="grid_T">
-       <field id="PH"          description="PH"                                       unit="-"          axis_ref="deptht" />
-       <field id="CO3"         description="Bicarbonates"                             unit="mol/m3"     axis_ref="deptht" />
-       <field id="CO3sat"      description="CO3 saturation"                           unit="mol/m3"     axis_ref="deptht" />
-       <field id="PAR"         description="Photosynthetically Available Radiation"   unit="W/m2"       axis_ref="deptht" />
-       <field id="PPPHY"       description="Primary production of nanophyto"          unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="PPPHY2"      description="Primary production of diatoms"            unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="PPNEWN"      description="New Primary production of nanophyto"      unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="PPNEWD"      description="New Primary production of diatoms"        unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="PBSi"        description="Primary production of Si diatoms"         unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="PFeN"        description="Primary production of nano iron"          unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="PFeD"        description="Primary production of diatoms iron"       unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="PCAL"        description="Calcite production"                       unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="DCAL"        description="Calcite dissolution"                      unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="GRAZ"        description="Grazing by zooplankton"                   unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="Mumax"       description="Maximum growth rate"                      unit="s-1"        axis_ref="deptht" />
-       <field id="MuN"         description="Realized growth rate for nanophyto"       unit="s-1"        axis_ref="deptht" />
-       <field id="MuD"         description="Realized growth rate for diatomes"        unit="s-1"        axis_ref="deptht" />
-       <field id="MuNlight"    description="Light limited growth rate for nanophyto"  unit="s-1"        axis_ref="deptht" />
-       <field id="MuDlight"    description="Light limited growth rate for diatomes"   unit="s-1"        axis_ref="deptht" />
-       <field id="LNnut"       description="Nutrient limitation term in Nanophyto"    unit="-"          axis_ref="deptht" />
-       <field id="LDnut"       description="Nutrient limitation term in Diatoms"      unit="-"          axis_ref="deptht" />
-       <field id="LNFe"        description="Iron limitation term in Nanophyto"        unit="-"          axis_ref="deptht" />
-       <field id="LDFe"        description="Iron limitation term in Diatoms"          unit="-"          axis_ref="deptht" />
-       <field id="LNlight"     description="Light limitation term in Nanophyto"       unit="-"          axis_ref="deptht" />
-       <field id="LDlight"     description="Light limitation term in Diatoms"         unit="-"          axis_ref="deptht" />
-       <field id="Nfix"        description="Nitrogen fixation at surface"             unit="mol/m2/s"                     />
-       <field id="EPC100"      description="Export of carbon particles at 100 m"      unit="mol/m2/s"                     />
-       <field id="EPFE100"     description="Export of biogenic iron at 100 m"         unit="mol/m2/s"                     />
-       <field id="EPSI100"     description="Export of Silicate at 100 m"              unit="mol/m2/s"                     />
-       <field id="EPCAL100"    description="Export of Calcite at 100 m"               unit="mol/m2/s"                     />
-       <field id="Cflx"        description="DIC flux"                                 unit="mol/m2/s"                     />
-       <field id="Oflx"        description="Oxygen flux"                              unit="mol/m2/s"                     />
-       <field id="Kg"          description="Gas transfer"                             unit="mol/m2/s/uatm"                />
-       <field id="Dpco2"       description="Delta CO2"                                unit="uatm"                         />
-       <field id="Dpo2"        description="Delta O2"                                 unit="uatm"                         />
-       <field id="Heup"        description="Euphotic layer depth"                     unit="m"                            />
-       <field id="Irondep"     description="Iron deposition"                          unit="mol/m2/s"                     />
+       <field id="PH"          description="PH"                                      unit="-"          axis_ref="deptht" />
+       <field id="CO3"         description="Bicarbonates"                            unit="mol/m3"     axis_ref="deptht" />
+       <field id="CO3sat"      description="CO3 saturation"                          unit="mol/m3"     axis_ref="deptht" />
+       <field id="PAR"         description="Photosynthetically Available Radiation"  unit="W/m2"       axis_ref="deptht" />
+       <field id="PPPHY"       description="Primary production of nanophyto"         unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="PPPHY2"      description="Primary production of diatoms"           unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="PPNEWN"      description="New Primary production of nanophyto"     unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="PPNEWD"      description="New Primary production of diatoms"       unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="PBSi"        description="Primary production of Si diatoms"        unit="molSi/m3/s" axis_ref="deptht" />
+       <field id="PFeN"        description="Primary production of nano iron"         unit="molFe/m3/s" axis_ref="deptht" />
+       <field id="PFeD"        description="Primary production of diatoms iron"      unit="molFe/m3/s" axis_ref="deptht" />
+       <field id="xfracal"     description="Calcifying fraction"                     unit="-"          axis_ref="deptht" />
+       <field id="PCAL"        description="Calcite production"                      unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="DCAL"        description="Calcite dissolution"                     unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="GRAZ1"       description="Grazing by microzooplankton"             unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="GRAZ2"       description="Grazing by mesozooplankton"              unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="REMIN"       description="Oxic remineralization of OM"             unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="DENIT"       description="Anoxic remineralization of OM"           unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="Nfix"        description="Nitrogen fixation"                       unit="molN/m3/s"  axis_ref="deptht" />
+       <field id="Mumax"       description="Maximum growth rate"                     unit="s-1"        axis_ref="deptht" />
+       <field id="MuN"         description="Realized growth rate for nanophyto"      unit="s-1"        axis_ref="deptht" />
+       <field id="MuD"         description="Realized growth rate for diatomes"       unit="s-1"        axis_ref="deptht" />
+       <field id="LNnut"       description="Nutrient limitation term in Nanophyto"   unit="-"          axis_ref="deptht" />
+       <field id="LDnut"       description="Nutrient limitation term in Diatoms"     unit="-"          axis_ref="deptht" />
+       <field id="LNFe"        description="Iron limitation term in Nanophyto"       unit="-"          axis_ref="deptht" />
+       <field id="LDFe"        description="Iron limitation term in Diatoms"         unit="-"          axis_ref="deptht" />
+       <field id="LNlight"     description="Light limitation term in Nanophyto"      unit="-"          axis_ref="deptht" />
+       <field id="LDlight"     description="Light limitation term in Diatoms"        unit="-"          axis_ref="deptht" />
+       <field id="Fe2"         description="Iron II concentration"                   unit="nmol/L"     axis_ref="deptht" />
+       <field id="Fe3"         description="Iron III concentration"                  unit="nmol/L"     axis_ref="deptht" />
+       <field id="FeL1"        description="Complexed Iron concentration with L1"    unit="nmol/L"     axis_ref="deptht" />
+       <field id="FeL2"        description="Complexed Iron concentration with L2"    unit="nmol/L"     axis_ref="deptht" />
+       <field id="FeP"         description="Precipitated Iron III"                   unit="nmol/L"     axis_ref="deptht" />
+       <field id="TL1"         description="Total L1 concentration"                  unit="nmol/L"     axis_ref="deptht" />
+       <field id="TL2"         description="Total L2 concentration"                  unit="nmol/L"     axis_ref="deptht" />
+       <field id="pdust"       description="dust concentration"                      unit="g/L"                          />
+       <field id="Totlig"      description="Total ligand concentation"               unit="nmol/L"     axis_ref="deptht" />
+       <field id="Biron"       description="Bioavailable iron"                       unit="nmol/L"     axis_ref="deptht" />
+       <field id="Sdenit"      description="Nitrate reduction in the sediments"      unit="molN/m2/s"                    />
+       <field id="Ironice"     description="Iron input/uptake due to sea ice"        unit="molFe/m2/s"                   />
+       <field id="HYDR"        description="Iron input from hydrothemal vents"       unit="molFe/m2/s"                   />
+       <field id="EPC100"      description="Export of carbon particles at 100 m"     unit="mol/m2/s"                     />
+       <field id="EPFE100"     description="Export of biogenic iron at 100 m"        unit="mol/m2/s"                     />
+       <field id="EPSI100"     description="Export of Silicate at 100 m"             unit="mol/m2/s"                     />
+       <field id="EPCAL100"    description="Export of Calcite at 100 m"              unit="mol/m2/s"                     />
+       <field id="Cflx"        description="DIC flux"                                unit="mol/m2/s"                     />
+       <field id="Oflx"        description="Oxygen flux"                             unit="mol/m2/s"                     />
+       <field id="Kg"          description="Gas transfer"                            unit="mol/m2/s/uatm"                />
+       <field id="Dpco2"       description="Delta CO2"                               unit="uatm"                         />
+       <field id="Dpo2"        description="Delta O2"                                unit="uatm"                         />
+       <field id="Heup"        description="Euphotic layer depth"                    unit="m"                            />
+       <field id="Irondep"     description="Iron deposition from dust"               unit="mol/m2/s"                     />
+       <field id="Ironsed"     description="Iron deposition from sediment"           unit="mol/m2/s"  axis_ref="deptht"  />
      </group>
        
@@ -511,5 +527,5 @@
           <field ref="CO3"      />
           <field ref="CO3sat"   />
-          <field ref="PAR"      />
+          <field ref="PAR"   />
           <field ref="PPPHY"    />
           <field ref="PPPHY2"   />
@@ -519,18 +535,9 @@
           <field ref="PFeN"     />
           <field ref="PFeD"     />
+          <field ref="xfracal"  />
           <field ref="PCAL"     />
           <field ref="DCAL"     />
-          <field ref="GRAZ"     />
-          <field ref="Mumax"    />
-          <field ref="MuN"      />
-          <field ref="MuD"      />
-          <field ref="MuNlight" />
-          <field ref="MuDlight" />
-          <field ref="LNnut"    />
-          <field ref="LDnut"    />
-          <field ref="LNFe"     />
-          <field ref="LDFe"     />
-          <field ref="LNlight"  />
-          <field ref="LDlight"  />
+          <field ref="GRAZ1"     />
+          <field ref="GRAZ2"     />
           <field ref="EPC100"   />
           <field ref="EPFE100"  />
@@ -544,5 +551,25 @@
           <field ref="Heup"     />
           <field ref="Irondep"  />
+          <field ref="Ironsed"  />
+          <field ref="Ironice"  />
           <field ref="Nfix"     />
+          <field ref="MuN"      />
+          <field ref="MuD"      />
+          <field ref="LNnut"      />
+          <field ref="LDnut"      />
+          <field ref="LNFe"      />
+          <field ref="LDFe"      />
+          <field ref="LNlight"      />
+          <field ref="LDlight"      />
+          <field ref="pdust"      />
+          <field ref="Fe2"      />
+          <field ref="Fe3"      />
+          <field ref="FeL1"      />
+          <field ref="FeL2"      />
+          <field ref="FeP"      />
+          <field ref="TL1"      />
+          <field ref="TL2"      />
+          <field ref="Sdenit"      />
+          <field ref="Totlig" />
        </file>
 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_pisces
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_pisces	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_pisces	(revision 3680)
@@ -35,31 +35,45 @@
 &nampisbio     !   biological parameters
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   nrdttrc    =  4        ! time step frequency for biology
+   nrdttrc    =  1        ! time step frequency for biology
    wsbio      =  2.       ! POC sinking speed
    xkmort     =  2.E-7    ! half saturation constant for mortality
    ferat3     =  10.E-6   ! Fe/C in zooplankton 
    wsbio2     =  30.      ! Big particles sinking speed
+   niter1max  =  1        ! Maximum number of iterations for POC
+   niter2max  =  1        ! Maximum number of iterations for GOC
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 &nampislim     !   parameters for nutrient limitations
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   conc0      =  1.e-6    ! Phosphate half saturation
-   conc1      =  8E-6     ! Phosphate half saturation for diatoms
-   conc2      =  1E-9     ! Iron half saturation for phyto
-   conc2m     =  3E-9     ! Max iron half saturation for phyto
-   conc3      =  3E-9     ! Iron half saturation for diatoms
-   conc3m     =  8E-9     ! Maxi iron half saturation for diatoms
+   concnno3   =  1.e-6    ! Nitrate half saturation of nanophytoplankton
+   concdno3   =  3.E-6   ! Phosphate half saturation for diatoms
+   concnnh4   =  1.E-7    ! NH4 half saturation for phyto
+   concdnh4   =  3.E-7   ! NH4 half saturation for diatoms
+   concnfer   =  1.E-9     ! Iron half saturation for phyto
+   concdfer   =  3.E-9   ! Iron half saturation for diatoms
+   concbfe    =  1.E-11   ! Half-saturation for Fe limitation of Bacteria
+   concbnh4   =  2.5E-8   ! NH4 half saturation for phyto
+   concbno3   =  2.5E-7   ! Phosphate half saturation for diatoms
    xsizedia   =  1.E-6    ! Minimum size criteria for diatoms
    xsizephy   =  1.E-6    ! Minimum size criteria for phyto
-   concnnh4   =  1.E-7    ! NH4 half saturation for phyto
-   concdnh4   =  8.E-7    ! NH4 half saturation for diatoms
+   xsizern    =  3.0      ! Size ratio for nanophytoplankton
+   xsizerd    =  3.0      ! Size ratio for diatoms
    xksi1      =  2.E-6    ! half saturation constant for Si uptake
-   xksi2      =  3.33E-6  ! half saturation constant for Si/C
+   xksi2      =  20E-6  ! half saturation constant for Si/C
    xkdoc      =  417.E-6  ! half-saturation constant of DOC remineralization
-   concfebac  =  1.E-11   ! Half-saturation for Fe limitation of Bacteria
    qnfelim    =  7.E-6    ! Optimal quota of phyto
    qdfelim    =  7.E-6    ! Optimal quota of diatoms
-   caco3r     =  0.16     ! mean rain ratio
-/
+   caco3r     =  0.3      ! mean rain ratio
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampisopt     !   parameters for optics
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!              !  file name        ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !                   !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_par     = 'par.orca'       ,     24            , 'fr_par'     ,  .true.      , .true. ,   'yearly'  , ''       , ''
+   cn_dir      = './'      !  root directory for the location of the dynamical files
+   ln_varpar   =  .true.   ! boolean for PAR variable
+   parlux      =  0.43      ! Fraction of shortwave as PAR
+/ 
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 &nampisprod     !   parameters for phytoplankton growth
@@ -69,27 +83,27 @@
    excret     =  0.05     ! excretion ratio of phytoplankton
    excret2    =  0.05     ! excretion ratio of diatoms
-   ln_newprod =  .true.  ! Enable new parame. of production (T/F) 
+   ln_newprod =  .true.   ! Enable new parame. of production (T/F) 
    bresp      =  0.00333  ! Basal respiration rate
    chlcnm     =  0.033    ! Minimum Chl/C in nanophytoplankton
    chlcdm     =  0.05     ! Minimum Chl/C in diatoms
-   chlcmin    =  0.0033   ! Maximum Chl/c in phytoplankton
+   chlcmin    =  0.004    ! Maximum Chl/c in phytoplankton
    fecnm      =  40E-6    ! Maximum Fe/C in nanophytoplankton
    fecdm      =  40E-6    ! Minimum Fe/C in diatoms
-   grosip     =  0.151    ! mean Si/C ratio
+   grosip     =  0.159    ! mean Si/C ratio
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 &nampismort     !   parameters for phytoplankton sinks
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   wchl       =  0.001    ! quadratic mortality of phytoplankton
-   wchld      =  0.02     ! maximum quadratic mortality of diatoms
+   wchl       =  0.01    ! quadratic mortality of phytoplankton
+   wchld      =  0.01     ! maximum quadratic mortality of diatoms
+   wchldm     =  0.03     ! maximum quadratic mortality of diatoms
    mprat      =  0.01     ! phytoplankton mortality rate
    mprat2     =  0.01     ! Diatoms mortality rate
-   mpratm     =  0.01     ! Phytoplankton minimum mortality rate
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 &nampismes     !   parameters for mesozooplankton
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   part2      =  0.75    ! part of calcite not dissolved in mesozoo guts
-   grazrat2   =  0.7      ! maximal mesozoo grazing rate
+   part2      =  0.75     ! part of calcite not dissolved in mesozoo guts
+   grazrat2   =  0.75     ! maximal mesozoo grazing rate
    resrat2    =  0.005    ! exsudation rate of mesozooplankton
    mzrat2     =  0.03     ! mesozooplankton mortality rate
@@ -102,5 +116,5 @@
    xthresh2phy = 1E-8     ! nanophyto feeding threshold for mesozooplankton 
    xthresh2poc = 1E-8     ! poc feeding threshold for mesozooplankton 
-   xthresh2   =  2E-7    ! Food threshold for grazing
+   xthresh2   =  3E-7     ! Food threshold for grazing
    xkgraz2    =  20.E-6   ! half sturation constant for meso grazing
    epsher2    =  0.3      ! Efficicency of Mesozoo growth
@@ -115,5 +129,5 @@
    grazrat    =  3.0      ! maximal zoo grazing rate
    resrat     =  0.03     ! exsudation rate of zooplankton
-   mzrat      =  0.001    ! zooplankton mortality rate
+   mzrat      =  0.004    ! zooplankton mortality rate
    xpref2c    =  0.1      ! Microzoo preference for POM
    xpref2p    =  1.       ! Microzoo preference for Nanophyto
@@ -122,5 +136,5 @@
    xthreshphy =  1.E-8    ! Nanophyto feeding threshold for microzooplankton 
    xthreshpoc =  1.E-8    ! POC feeding threshold for microzooplankton 
-   xthresh    =  2.E-7    ! Food threshold for feeding
+   xthresh    =  3.E-7    ! Food threshold for feeding
    xkgraz     =  20.E-6   ! half sturation constant for grazing
    epsher     =  0.3      ! Efficiency of microzoo growth
@@ -129,15 +143,22 @@
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampisfer     !   parameters for iron chemistry
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   ln_fechem =  .false.   ! complex iron chemistry ( T/F )
+   ln_ligvar =  .true.   ! variable ligand concentration
+   xlam1     =  0.005     ! scavenging rate of Iron
+   xlamdust  =  150.0     ! Scavenging rate of dust
+   ligand    =  0.6E-9    ! Ligands concentration 
+/  
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 &nampisrem     !   parameters for remineralization
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   xremik    =  0.25      ! remineralization rate of DOC
+   xremik    =  0.35      ! remineralization rate of DOC
    xremip    =  0.025     ! remineralisation rate of POC
    nitrif    =  0.05      ! NH4 nitrification rate
    xsirem    =  0.003     ! remineralization rate of Si
-   xsiremlab =  0.025     ! fast remineralization rate of Si
-   xsilab    =  0.31      ! Fraction of labile biogenic silica
-   xlam1     =  0.005     ! scavenging rate of Iron
+   xsiremlab =  0.03      ! fast remineralization rate of Si
+   xsilab    =  0.5       ! Fraction of labile biogenic silica
    oxymin    =  1.E-6     ! Half-saturation constant for anoxia
-   ligand    =  0.6E-9    ! Ligands concentration
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
@@ -148,25 +169,37 @@
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampissed     !   parameters for inputs deposition
+&nampissbc     !   parameters for inputs deposition
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
 !              !  file name        ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
 !              !                   !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
    sn_dust     = 'dust.orca'       ,     -1            , 'dust'     ,  .true.      , .true. ,   'yearly'  , ''       , ''
-   sn_riverdic = 'river.orca'      ,    -12            , 'riverdic' ,  .false.     , .true. ,   'yearly'  , ''       , ''
-   sn_riverdoc = 'river.orca'      ,    -12            , 'riverdoc' ,  .false.     , .true. ,   'yearly'  , ''       , ''
+   sn_solub    = 'solubility.orca' ,    -12            , 'solubility1' ,  .false.      , .true. ,   'yearly'  , ''       , ''
+   sn_riverdic = 'river.orca'      ,    120            , 'riverdic' ,  .true.     , .true. ,   'yearly'  , ''       , ''
+   sn_riverdoc = 'river.orca'      ,    120            , 'riverdoc' ,  .true.     , .true. ,   'yearly'  , ''       , ''
+   sn_riverdin = 'river.orca'      ,    120            , 'riverdin' ,  .true.     , .true. ,   'yearly'  , ''       , ''
+   sn_riverdon = 'river.orca'      ,    120            , 'riverdon' ,  .true.     , .true. ,   'yearly'  , ''       , ''
+   sn_riverdip = 'river.orca'      ,    120            , 'riverdip' ,  .true.     , .true. ,   'yearly'  , ''       , ''
+   sn_riverdop = 'river.orca'      ,    120            , 'riverdop' ,  .true.     , .true. ,   'yearly'  , ''       , ''
+   sn_riverdsi = 'river.orca'      ,    120            , 'riverdsi' ,  .true.     , .true. ,   'yearly'  , ''       , ''
    sn_ndepo    = 'ndeposition.orca',    -12            , 'ndep'     ,  .false.     , .true. ,   'yearly'  , ''       , ''
    sn_ironsed  = 'bathy.orca'      ,    -12            , 'bathy'    ,  .false.     , .true. ,   'yearly'  , ''       , ''
+   sn_hydrofe  = 'hydrofe'         ,    -12            , 'epsdb'    ,  .false.     , .true. ,   'yearly'  , ''       , ''
 !
    cn_dir      = './'      !  root directory for the location of the dynamical files
    ln_dust     =  .true.   ! boolean for dust input from the atmosphere
-   ln_river    =  .false.   ! boolean for river input of nutrients
+   ln_solub    =  .true.   ! boolean for variable solubility of atm. Iron
+   ln_river    =  .true.   ! boolean for river input of nutrients
    ln_ndepo    =  .true.   ! boolean for atmospheric deposition of N
    ln_ironsed  =  .true.   ! boolean for Fe input from sediments
+   ln_ironice  =  .true.   ! boolean for Fe input from sea ice
+   ln_hydrofe  =  .false.   ! boolean for from hydrothermal vents
    sedfeinput  =  1E-9     ! Coastal release of Iron
    dustsolub   =  0.02     ! Solubility of the dust
-   wdust       =  2.0      ! Dust sinking speed
+   wdust       =  2.0      ! Dust sinking speed 
+   icefeinput  =  15E-9    ! Iron concentration in sea ice
    nitrfix     =  1E-7     ! Nitrogen fixation rate
    diazolight  =  50.      ! Diazotrophs sensitivity to light (W/m2)
    concfediaz  =  1.E-10   ! Diazotrophs half-saturation Cste for Iron
+   hratio      =  9.E-5    ! Fe to 3He ratio assumed for vent iron supply 
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
@@ -175,4 +208,5 @@
    xkr_eta      = 1.17    ! Sinking  exponent
    xkr_zeta     = 2.28    ! N content exponent
+   xkr_ncontent = 5.7E-6  ! N content factor
    xkr_mass_min = 0.0002  ! Minimum mass for Aggregates
    xkr_mass_max = 1.      ! Maximum mass for Aggregates
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_top
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_top	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_top	(revision 3680)
@@ -85,4 +85,5 @@
    ln_trcadv_ubs    =  .false.  !  UBS scheme
    ln_trcadv_qck    =  .false.  !  QUICKEST scheme
+   ln_traadv_msc_ups=  .false.  !  use upstream scheme within muscl
 /
 !-----------------------------------------------------------------------
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/cpp_ORCA2_LIM_PISCES.fcm
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/cpp_ORCA2_LIM_PISCES.fcm	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/cpp_ORCA2_LIM_PISCES.fcm	(revision 3680)
@@ -1,1 +1,1 @@
-bld::tool::fppkeys key_trabbl key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_zdftke key_zdfddm key_top key_pisces key_iomput 
+bld::tool::fppkeys key_trabbl key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_zdftke key_zdfddm key_zdftmx key_top key_pisces key_iomput 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/iodef.xml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/iodef.xml	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/iodef.xml	(revision 3680)
@@ -19,5 +19,5 @@
      <group id="ptrc_T" axis_ref="deptht" grid_ref="grid_T">
        <field id="DIC"      description="Dissolved inorganic Concentration"        unit="mmol/m3" />
-       <field id="Alkalini" description="Total Alkalinity Concentration"           unit="mmol/m3"    />
+       <field id="Alkalini" description="Total Alkalinity Concentration"           unit="mmol/m3" />
        <field id="O2"       description="Oxygen Concentration"                     unit="mmol/m3" />
        <field id="CaCO3"    description="Calcite Concentration"                    unit="mmol/m3" />
@@ -38,6 +38,6 @@
        <field id="GSi"      description="Sinking biogenic Silicate Concentration"  unit="mmol/m3" />
        <field id="NFe"      description="Nano iron Concentration"                  unit="mmol/m3" />
-       <field id="NCHL"     description="Nano chlorophyl Concentration"            unit="mg/m3" />
-       <field id="DCHL"     description="Diatoms chlorophyl Concentration"         unit="mg/m3" />
+       <field id="NCHL"     description="Nano chlorophyl Concentration"            unit="mg/m3"   />
+       <field id="DCHL"     description="Diatoms chlorophyl Concentration"         unit="mg/m3"   />
        <field id="NO3"      description="Nitrates Concentration"                   unit="mmol/m3" />
        <field id="NH4"      description="Ammonium Concentration"                   unit="mmol/m3" />
@@ -47,42 +47,58 @@
 
      <group id="diad_T" axis_ref="none" grid_ref="grid_T">
-       <field id="PH"          description="PH"                                       unit="-"          axis_ref="deptht" />
-       <field id="CO3"         description="Bicarbonates"                             unit="mol/m3"     axis_ref="deptht" />
-       <field id="CO3sat"      description="CO3 saturation"                           unit="mol/m3"     axis_ref="deptht" />
-       <field id="PAR"         description="Photosynthetically Available Radiation"   unit="W/m2"       axis_ref="deptht" />
-       <field id="PPPHY"       description="Primary production of nanophyto"          unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="PPPHY2"      description="Primary production of diatoms"            unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="PPNEWN"      description="New Primary production of nanophyto"      unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="PPNEWD"      description="New Primary production of diatoms"        unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="PBSi"        description="Primary production of Si diatoms"         unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="PFeN"        description="Primary production of nano iron"          unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="PFeD"        description="Primary production of diatoms iron"       unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="PCAL"        description="Calcite production"                       unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="DCAL"        description="Calcite dissolution"                      unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="GRAZ"        description="Grazing by zooplankton"                   unit="mol/m3/s"   axis_ref="deptht" />
-       <field id="Mumax"       description="Maximum growth rate"                      unit="s-1"        axis_ref="deptht" />
-       <field id="MuN"         description="Realized growth rate for nanophyto"       unit="s-1"        axis_ref="deptht" />
-       <field id="MuD"         description="Realized growth rate for diatomes"        unit="s-1"        axis_ref="deptht" />
-       <field id="MuNlight"    description="Light limited growth rate for nanophyto"  unit="s-1"        axis_ref="deptht" />
-       <field id="MuDlight"    description="Light limited growth rate for diatomes"   unit="s-1"        axis_ref="deptht" />
-       <field id="LNnut"       description="Nutrient limitation term in Nanophyto"    unit="-"          axis_ref="deptht" />
-       <field id="LDnut"       description="Nutrient limitation term in Diatoms"      unit="-"          axis_ref="deptht" />
-       <field id="LNFe"        description="Iron limitation term in Nanophyto"        unit="-"          axis_ref="deptht" />
-       <field id="LDFe"        description="Iron limitation term in Diatoms"          unit="-"          axis_ref="deptht" />
-       <field id="LNlight"     description="Light limitation term in Nanophyto"       unit="-"          axis_ref="deptht" />
-       <field id="LDlight"     description="Light limitation term in Diatoms"         unit="-"          axis_ref="deptht" />
-       <field id="Nfix"        description="Nitrogen fixation at surface"             unit="mol/m2/s"                     />
-       <field id="EPC100"      description="Export of carbon particles at 100 m"      unit="mol/m2/s"                     />
-       <field id="EPFE100"     description="Export of biogenic iron at 100 m"         unit="mol/m2/s"                     />
-       <field id="EPSI100"     description="Export of Silicate at 100 m"              unit="mol/m2/s"                     />
-       <field id="EPCAL100"    description="Export of Calcite at 100 m"               unit="mol/m2/s"                     />
-       <field id="Cflx"        description="DIC flux"                                 unit="mol/m2/s"                     />
-       <field id="Oflx"        description="Oxygen flux"                              unit="mol/m2/s"                     />
-       <field id="Kg"          description="Gas transfer"                             unit="mol/m2/s/uatm"                />
-       <field id="Dpco2"       description="Delta CO2"                                unit="uatm"                         />
-       <field id="Dpo2"        description="Delta O2"                                 unit="uatm"                         />
-       <field id="Heup"        description="Euphotic layer depth"                     unit="m"                            />
-       <field id="Irondep"     description="Iron deposition"                          unit="mol/m2/s"                     />
-     </group>
+       <field id="PH"          description="PH"                                      unit="-"          axis_ref="deptht" />
+       <field id="CO3"         description="Bicarbonates"                            unit="mol/m3"     axis_ref="deptht" />
+       <field id="CO3sat"      description="CO3 saturation"                          unit="mol/m3"     axis_ref="deptht" />
+       <field id="PAR"         description="Photosynthetically Available Radiation"  unit="W/m2"       axis_ref="deptht" />
+       <field id="PPPHY"       description="Primary production of nanophyto"         unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="PPPHY2"      description="Primary production of diatoms"           unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="PPNEWN"      description="New Primary production of nanophyto"     unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="PPNEWD"      description="New Primary production of diatoms"       unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="PBSi"        description="Primary production of Si diatoms"        unit="molSi/m3/s" axis_ref="deptht" />
+       <field id="PFeN"        description="Primary production of nano iron"         unit="molFe/m3/s" axis_ref="deptht" />
+       <field id="PFeD"        description="Primary production of diatoms iron"      unit="molFe/m3/s" axis_ref="deptht" />
+       <field id="xfracal"     description="Calcifying fraction"                     unit="-"          axis_ref="deptht" />
+       <field id="PCAL"        description="Calcite production"                      unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="DCAL"        description="Calcite dissolution"                     unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="GRAZ1"       description="Grazing by microzooplankton"             unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="GRAZ2"       description="Grazing by mesozooplankton"              unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="REMIN"       description="Oxic remineralization of OM"             unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="DENIT"       description="Anoxic remineralization of OM"           unit="molC/m3/s"  axis_ref="deptht" />
+       <field id="Nfix"        description="Nitrogen fixation"                       unit="molN/m3/s"  axis_ref="deptht" />
+       <field id="Mumax"       description="Maximum growth rate"                     unit="s-1"        axis_ref="deptht" />
+       <field id="MuN"         description="Realized growth rate for nanophyto"      unit="s-1"        axis_ref="deptht" />
+       <field id="MuD"         description="Realized growth rate for diatomes"       unit="s-1"        axis_ref="deptht" />
+       <field id="LNnut"       description="Nutrient limitation term in Nanophyto"   unit="-"          axis_ref="deptht" />
+       <field id="LDnut"       description="Nutrient limitation term in Diatoms"     unit="-"          axis_ref="deptht" />
+       <field id="LNFe"        description="Iron limitation term in Nanophyto"       unit="-"          axis_ref="deptht" />
+       <field id="LDFe"        description="Iron limitation term in Diatoms"         unit="-"          axis_ref="deptht" />
+       <field id="LNlight"     description="Light limitation term in Nanophyto"      unit="-"          axis_ref="deptht" />
+       <field id="LDlight"     description="Light limitation term in Diatoms"        unit="-"          axis_ref="deptht" />
+       <field id="Fe2"         description="Iron II concentration"                   unit="nmol/L"     axis_ref="deptht" />
+       <field id="Fe3"         description="Iron III concentration"                  unit="nmol/L"     axis_ref="deptht" />
+       <field id="FeL1"        description="Complexed Iron concentration with L1"    unit="nmol/L"     axis_ref="deptht" />
+       <field id="FeL2"        description="Complexed Iron concentration with L2"    unit="nmol/L"     axis_ref="deptht" />
+       <field id="FeP"         description="Precipitated Iron III"                   unit="nmol/L"     axis_ref="deptht" />
+       <field id="TL1"         description="Total L1 concentration"                  unit="nmol/L"     axis_ref="deptht" />
+       <field id="TL2"         description="Total L2 concentration"                  unit="nmol/L"     axis_ref="deptht" />
+       <field id="pdust"       description="dust concentration"                      unit="g/L"                          />
+       <field id="Totlig"      description="Total ligand concentation"               unit="nmol/L"     axis_ref="deptht" />
+       <field id="Biron"       description="Bioavailable iron"                       unit="nmol/L"     axis_ref="deptht" />
+       <field id="Sdenit"      description="Nitrate reduction in the sediments"      unit="molN/m2/s"                    />
+       <field id="Ironice"     description="Iron input/uptake due to sea ice"        unit="molFe/m2/s"                   />
+       <field id="HYDR"        description="Iron input from hydrothemal vents"       unit="molFe/m2/s"                   />
+       <field id="EPC100"      description="Export of carbon particles at 100 m"     unit="mol/m2/s"                     />
+       <field id="EPFE100"     description="Export of biogenic iron at 100 m"        unit="mol/m2/s"                     />
+       <field id="EPSI100"     description="Export of Silicate at 100 m"             unit="mol/m2/s"                     />
+       <field id="EPCAL100"    description="Export of Calcite at 100 m"              unit="mol/m2/s"                     />
+       <field id="Cflx"        description="DIC flux"                                unit="mol/m2/s"                     />
+       <field id="Oflx"        description="Oxygen flux"                             unit="mol/m2/s"                     />
+       <field id="Kg"          description="Gas transfer"                            unit="mol/m2/s/uatm"                />
+       <field id="Dpco2"       description="Delta CO2"                               unit="uatm"                         />
+       <field id="Dpo2"        description="Delta O2"                                unit="uatm"                         />
+       <field id="Heup"        description="Euphotic layer depth"                    unit="m"                            />
+       <field id="Irondep"     description="Iron deposition from dust"               unit="mol/m2/s"                     />
+       <field id="Ironsed"     description="Iron deposition from sediment"           unit="mol/m2/s"  axis_ref="deptht"  />
+     </group>         
 
       <!-- scalar -->
@@ -107,44 +123,9 @@
 
       <group id="5d" output_freq="432000" output_level="10" enabled=".TRUE.">                      <!-- 5d files -->
-
-        <file id="5d_diad_T" name="auto" description="additional pisces diagnostics" >
-          <field ref="Cflx"     />
-          <field ref="Oflx"     />
-          <field ref="Dpco2"    />
-          <field ref="Dpo2"     />
-          <field ref="Heup"     />
-        </file>
-      
       </group>
  
       <group id="1m" output_freq="-1"     output_level="10" enabled=".TRUE.">                      <!-- real monthly files -->
 
-        <file id="1m_ptrc_T" name="auto" description="pisces sms variables" >
-          <field ref="DIC"      />
-          <field ref="Alkalini" />
-          <field ref="O2"       />
-          <field ref="NCHL"     />
-          <field ref="DCHL"     />
-          <field ref="Fer"      />
-          <field ref="NO3"      />
-       </file>
-
-      </group>
-
-      <group id="2m" output_freq="-2"     output_level="10" enabled=".TRUE.">                      <!-- real 2m files -->
-      </group>
-
-      <group id="3m" output_freq="-3"     output_level="10" enabled=".TRUE.">                      <!-- real 3m files -->
-      </group>
-
-      <group id="4m" output_freq="-4"     output_level="10" enabled=".TRUE.">                      <!-- real 4m files -->
-      </group>
-
-      <group id="6m" output_freq="-6"     output_level="10" enabled=".TRUE.">                      <!-- real 6m files -->
-      </group>
-
-      <group id="1y" output_freq="-12"    output_level="10" enabled=".TRUE.">                      <!-- real yearly files -->
-        
-        <file id="1y_ptrc_T" name="auto" description="pisces sms variables" >
+       <file id="1m_ptrc_T" name="auto" description="pisces sms variables" >
           <field ref="DIC"      />
           <field ref="Alkalini" />
@@ -173,9 +154,9 @@
        </file>
 
-       <file id="1y_diad_T" name="auto" description="additional pisces diagnostics" >
+       <file id="1m_diad_T" name="auto" description="additional pisces diagnostics" >
           <field ref="PH"       />
           <field ref="CO3"      />
           <field ref="CO3sat"   />
-          <field ref="PAR"      />
+          <field ref="PAR"   />
           <field ref="PPPHY"    />
           <field ref="PPPHY2"   />
@@ -185,18 +166,9 @@
           <field ref="PFeN"     />
           <field ref="PFeD"     />
+          <field ref="xfracal"  />
           <field ref="PCAL"     />
           <field ref="DCAL"     />
-          <field ref="GRAZ"     />
-          <field ref="Mumax"    />
-          <field ref="MuN"      />
-          <field ref="MuD"      />
-          <field ref="MuNlight" />
-          <field ref="MuDlight" />
-          <field ref="LNnut"    />
-          <field ref="LDnut"    />
-          <field ref="LNFe"     />
-          <field ref="LDFe"     />
-          <field ref="LNlight"  />
-          <field ref="LDlight"  />
+          <field ref="GRAZ1"     />
+          <field ref="GRAZ2"     />
           <field ref="EPC100"   />
           <field ref="EPFE100"  />
@@ -210,7 +182,41 @@
           <field ref="Heup"     />
           <field ref="Irondep"  />
+          <field ref="Ironsed"  />
+          <field ref="Ironice"  />
           <field ref="Nfix"     />
+          <field ref="MuN"      />
+          <field ref="MuD"      />
+          <field ref="LNnut"      />
+          <field ref="LDnut"      />
+          <field ref="LNFe"      />
+          <field ref="LDFe"      />
+          <field ref="LNlight"      />
+          <field ref="LDlight"      />
+          <field ref="pdust"      />
+          <field ref="Fe2"      />
+          <field ref="Fe3"      />
+          <field ref="FeL1"      />
+          <field ref="FeL2"      />
+          <field ref="FeP"      />
+          <field ref="TL1"      />
+          <field ref="TL2"      />
+          <field ref="Sdenit"      />
+          <field ref="Totlig" />
        </file>
-
+      </group>
+
+      <group id="2m" output_freq="-2"     output_level="10" enabled=".TRUE.">                      <!-- real 2m files -->
+      </group>
+
+      <group id="3m" output_freq="-3"     output_level="10" enabled=".TRUE.">                      <!-- real 3m files -->
+      </group>
+
+      <group id="4m" output_freq="-4"     output_level="10" enabled=".TRUE.">                      <!-- real 4m files -->
+      </group>
+
+      <group id="6m" output_freq="-6"     output_level="10" enabled=".TRUE.">                      <!-- real 6m files -->
+      </group>
+
+      <group id="1y" output_freq="-12"    output_level="10" enabled=".TRUE.">                      <!-- real yearly files -->
       </group>
 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist	(revision 3680)
@@ -24,15 +24,14 @@
 &namrun        !   parameters of the run
 !-----------------------------------------------------------------------
-   nn_no       =       0   !  job number (no more used...)
+   nn_no       =       0   !  job number
    cn_exp      =  "PISCES"  !  experience name 
    nn_it000    =       1   !  first time step
    nn_itend    =    1460   !  last  time step (std 5475)
-   nn_date0    =  010101   !  date at nit_0000 (format yyyymmdd) used if ln_rstart=F or (ln_rstart=T and nn_rstctl=0 or 1)
+   nn_date0    =  010101   !  initial calendar date yymmdd (used if nn_rstctl=1)
    nn_leapy    =       0   !  Leap year calendar (1) or not (0)
    ln_rstart   = .false.   !  start from rest (F) or from a restart file (T)
-   nn_rstctl   =       0   !  restart control => activated only if ln_rstart = T
-                           !    = 0 nn_date0 read in namelist ; nn_it000 : read in namelist
-                           !    = 1 nn_date0 read in namelist ; nn_it000 : check consistancy between namelist and restart
-                           !    = 2 nn_date0 read in restart  ; nn_it000 : check consistancy between namelist and restart
+   nn_rstctl   =       0       !  restart control = 0 nn_it000 is not compared to the restart file value
+                               !                  = 1 use nn_date0 in namelist (not the value in the restart file)
+                               !                  = 2 calendar parameters read in the restart file
    cn_ocerst_in  = "restart"   !  suffix of ocean restart name (input)
    cn_ocerst_out = "restart"   !  suffix of ocean restart name (output)
@@ -65,12 +64,25 @@
 &namzgr_sco    !   s-coordinate or hybrid z-s-coordinate
 !-----------------------------------------------------------------------
-   rn_sbot_min =  300.     !  minimum depth of s-bottom surface (>0) (m)
-   rn_sbot_max = 5250.     !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
-   rn_theta    =    6.0    !  surface control parameter (0<=rn_theta<=20)
-   rn_thetb    =    0.75   !  bottom control parameter  (0<=rn_thetb<= 1)
-   rn_rmax     =    0.15   !  maximum cut-off r-value allowed (0<rn_max<1)
-   ln_s_sigma  = .false.   !  hybrid s-sigma coordinates
-   rn_bb       =    0.8    !  stretching with s-sigma
-   rn_hc       =  150.0    !  critical depth with s-sigma 
+   ln_s_sh94   = .true.    !  Song & Haidvogel 1994 hybrid S-sigma   (T)|
+   ln_s_sf12   = .false.   !  Siddorn & Furner 2012 hybrid S-z-sigma (T)| if both are false the NEMO tanh stretching is applied
+   ln_sigcrit  = .false.   !  use sigma coordinates below critical depth (T) or Z coordinates (F) for Siddorn & Furner stretch
+                           !  stretching coefficients for all functions
+   rn_sbot_min =   10.0    !  minimum depth of s-bottom surface (>0) (m)
+   rn_sbot_max = 7000.0    !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
+   rn_hc       =  150.0    !  critical depth for transition to stretched coordinates
+                        !!!!!!!  Envelop bathymetry
+   rn_rmax     =    0.3    !  maximum cut-off r-value allowed (0<r_max<1)
+                        !!!!!!!  SH94 stretching coefficients  (ln_s_sh94 = .true.)
+   rn_theta    =    6.0    !  surface control parameter (0<=theta<=20)
+   rn_bb       =    0.8    !  stretching with SH94 s-sigma   
+                        !!!!!!!  SF12 stretching coefficient  (ln_s_sf12 = .true.)
+   rn_alpha    =    4.4    !  stretching with SF12 s-sigma
+   rn_efold    =    0.0    !  efold length scale for transition to stretched coord
+   rn_zs       =    1.0    !  depth of surface grid box
+                           !  bottom cell depth (Zb) is a linear function of water depth Zb = H*a + b
+   rn_zb_a     =    0.024  !  bathymetry scaling factor for calculating Zb
+   rn_zb_b     =   -0.2    !  offset for calculating Zb
+                        !!!!!!!! Other stretching (not SH94 or SF12) [also uses rn_theta above]
+   rn_thetb    =    1.0    !  bottom control parameter  (0<=thetb<= 1) 
 /
 !-----------------------------------------------------------------------
@@ -147,5 +159,7 @@
                            !     =2 annual global mean of e-p-r set to zero
                            !     =3 global emp set to zero and spread out over erp area
-   ln_cdgw = .false.       !  Neutral drag coefficient read from wave model (T => fill namsbc_wave )
+   ln_wave = .false.       !  Activate coupling with wave (either Stokes Drift or Drag coefficient, or both)  (T => fill namsbc_wave)
+   ln_cdgw = .false.       !  Neutral drag coefficient read from wave model (T => fill namsbc_wave)
+   ln_sdw  = .false.       !  Computation of 3D stokes drift                (T => fill namsbc_wave)
 /
 !-----------------------------------------------------------------------
@@ -545,28 +559,24 @@
    ln_traadv_ubs    =  .false.  !  UBS scheme                 
    ln_traadv_qck    =  .false.  !  QUICKEST scheme
-/
-!----------------------------------------------------------------------------------
-&namtra_ldf    !   lateral diffusion scheme for tracers
-!----------------------------------------------------------------------------------
-   !                       !  Operator type:
-   ln_traldf_lap    =  .true.   !  laplacian operator
-   ln_traldf_bilap  =  .false.  !  bilaplacian operator
-   !                       !  Direction of action:
-   ln_traldf_level  =  .false.  !  iso-level
-   ln_traldf_hor    =  .false.  !  horizontal (geopotential)   (needs "key_ldfslp" when ln_sco=T)
-   ln_traldf_iso    =  .true.   !  iso-neutral                 (needs "key_ldfslp")
-   !		       	   !  Griffies parameters              (all need "key_ldfslp")
-   ln_traldf_grif   =  .false.  !  use griffies triads
-   ln_traldf_gdia   =  .false.  !  output griffies eddy velocities
-   ln_triad_iso     =  .false.  !  pure lateral mixing in ML
-   ln_botmix_grif   =  .false.  !  lateral mixing on bottom
-   !                       !  Coefficients
-   ! Eddy-induced (GM) advection always used with Griffies; otherwise needs "key_traldf_eiv"
-   ! Value rn_aeiv_0 is ignored unless = 0 with Held-Larichev spatially varying aeiv
-   !                                  (key_traldf_c2d & key_traldf_eiv & key_orca_r2, _r1 or _r05)
-   rn_aeiv_0        =  2000.    !  eddy induced velocity coefficient [m2/s]
+   ln_traadv_msc_ups=  .false.  !  use upstream scheme within muscl
+/
+!-----------------------------------------------------------------------
+&namtra_ldf    !   lateral diffusion scheme for tracer 
+!-----------------------------------------------------------------------
+   !                       !  Type of the operator : 
+   ln_traldf_lap    =  .true.   !  laplacian operator       
+   ln_traldf_bilap  =  .false.  !  bilaplacian operator     
+   !                       !  Direction of action  :
+   ln_traldf_level  =  .false.  !  iso-level                
+   ln_traldf_hor    =  .false.  !  horizontal (geopotential)            (require "key_ldfslp" when ln_sco=T)
+   ln_traldf_iso    =  .true.   !  iso-neutral                          (require "key_ldfslp")
+   ln_traldf_grif   =  .false.  !  griffies skew flux formulation       (require "key_ldfslp")
+   ln_traldf_gdia   =  .false.  !  griffies operator strfn diagnostics  (require "key_ldfslp")
+   ln_triad_iso     =  .true.  !  griffies operator calculates triads twice => pure lateral mixing in ML (require "key_ldfslp")
+   ln_botmix_grif   =  .false.  !  griffies operator with lateral mixing on bottom (require "key_ldfslp")
+                         !  Coefficient
    rn_aht_0         =  2000.    !  horizontal eddy diffusivity for tracers [m2/s]
    rn_ahtb_0        =     0.    !  background eddy diffusivity for ldf_iso [m2/s]
-   !                                           (normally=0; not used with Griffies)
+   rn_aeiv_0        =  2000.    !  eddy induced velocity coefficient [m2/s]    (require "key_traldf_eiv")
 /
 !-----------------------------------------------------------------------
@@ -652,5 +662,6 @@
    sn_sal  = 'dyna_grid_T' ,    120            , 'vosaline' ,  .true.    , .true. ,   'yearly'  , ''       , ''
    sn_mld  = 'dyna_grid_T' ,    120            , 'somixhgt' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_emp  = 'dyna_grid_T' ,    120            , 'sowaflcd' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_emp  = 'dyna_grid_T' ,    120            , 'sowaflup' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_emps = 'dyna_grid_T' ,    120            , 'sowaflcd' ,  .true.    , .true. ,   'yearly'  , ''       , ''
 !  sn_emp  = 'dyna_grid_T' ,    120            , 'sowaflup' ,  .true.    , .true. ,   'yearly'  , ''       , '' ! v3.5+
 !  sn_sfx  = 'dyna_grid_T' ,    120            , 'sosfldow' ,  .true.    , .true. ,   'yearly'  , ''       , '' ! v3.5+
@@ -831,5 +842,5 @@
    nn_bench    =    0      !  Bench mode (1/0): CAUTION use zero except for bench
                            !     (no physical validity of the results)
-   nn_timing   =    1      !  timing by routine activated (=1) creates timing.output file, or not (=0)
+   nn_timing   =    0      !  timing by routine activated (=1) creates timing.output file, or not (=0)
 /
 
@@ -1003,4 +1014,7 @@
 !              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
    sn_cdg      =  'cdg_wave' ,        1          , 'drag_coeff' , .true.   , .false. , 'daily'  ,''         , ''
+   sn_usd      =  'sdw_wave' ,        1          , 'u_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''
+   sn_vsd      =  'sdw_wave' ,        1          , 'v_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''
+   sn_wn       =  'sdw_wave' ,        1          , 'wave_num'   , .true.   , .false. , 'daily'  ,''         , ''
 !
    cn_dir_cdg  = './'  !  root directory for the location of drag coefficient files
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_pisces
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_pisces	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_pisces	(revision 3680)
@@ -40,26 +40,40 @@
    ferat3     =  10.E-6   ! Fe/C in zooplankton 
    wsbio2     =  30.      ! Big particles sinking speed
+   niter1max  =  1        ! Maximum number of iterations for POC
+   niter2max  =  1        ! Maximum number of iterations for GOC
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 &nampislim     !   parameters for nutrient limitations
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   conc0      =  1.e-6    ! Phosphate half saturation
-   conc1      =  8E-6     ! Phosphate half saturation for diatoms
-   conc2      =  1E-9     ! Iron half saturation for phyto
-   conc2m     =  3E-9     ! Max iron half saturation for phyto
-   conc3      =  3E-9     ! Iron half saturation for diatoms
-   conc3m     =  8E-9     ! Maxi iron half saturation for diatoms
+   concnno3   =  1.e-6    ! Nitrate half saturation of nanophytoplankton
+   concdno3   =  3.E-6   ! Phosphate half saturation for diatoms
+   concnnh4   =  1.E-7    ! NH4 half saturation for phyto
+   concdnh4   =  3.E-7   ! NH4 half saturation for diatoms
+   concnfer   =  1.E-9     ! Iron half saturation for phyto
+   concdfer   =  3.E-9   ! Iron half saturation for diatoms
+   concbfe    =  1.E-11   ! Half-saturation for Fe limitation of Bacteria
+   concbnh4   =  2.5E-8   ! NH4 half saturation for phyto
+   concbno3   =  2.5E-7   ! Phosphate half saturation for diatoms
    xsizedia   =  1.E-6    ! Minimum size criteria for diatoms
    xsizephy   =  1.E-6    ! Minimum size criteria for phyto
-   concnnh4   =  1.E-7    ! NH4 half saturation for phyto
-   concdnh4   =  8.E-7    ! NH4 half saturation for diatoms
+   xsizern    =  3.0      ! Size ratio for nanophytoplankton
+   xsizerd    =  3.0      ! Size ratio for diatoms
    xksi1      =  2.E-6    ! half saturation constant for Si uptake
-   xksi2      =  3.33E-6  ! half saturation constant for Si/C
+   xksi2      =  20E-6  ! half saturation constant for Si/C
    xkdoc      =  417.E-6  ! half-saturation constant of DOC remineralization
-   concfebac  =  1.E-11   ! Half-saturation for Fe limitation of Bacteria
    qnfelim    =  7.E-6    ! Optimal quota of phyto
    qdfelim    =  7.E-6    ! Optimal quota of diatoms
-   caco3r     =  0.16     ! mean rain ratio
-/
+   caco3r     =  0.3      ! mean rain ratio
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampisopt     !   parameters for optics
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!              !  file name        ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !                   !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_par     = 'par.orca'       ,     24            , 'fr_par'     ,  .true.      , .true. ,   'yearly'  , ''       , ''
+   cn_dir      = './'      !  root directory for the location of the dynamical files
+   ln_varpar   =  .true.   ! boolean for PAR variable
+   parlux      =  0.43      ! Fraction of shortwave as PAR
+/ 
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 &nampisprod     !   parameters for phytoplankton growth
@@ -69,27 +83,27 @@
    excret     =  0.05     ! excretion ratio of phytoplankton
    excret2    =  0.05     ! excretion ratio of diatoms
-   ln_newprod =  .true.  ! Enable new parame. of production (T/F) 
+   ln_newprod =  .true.   ! Enable new parame. of production (T/F) 
    bresp      =  0.00333  ! Basal respiration rate
    chlcnm     =  0.033    ! Minimum Chl/C in nanophytoplankton
    chlcdm     =  0.05     ! Minimum Chl/C in diatoms
-   chlcmin    =  0.0033   ! Maximum Chl/c in phytoplankton
+   chlcmin    =  0.004    ! Maximum Chl/c in phytoplankton
    fecnm      =  40E-6    ! Maximum Fe/C in nanophytoplankton
    fecdm      =  40E-6    ! Minimum Fe/C in diatoms
-   grosip     =  0.151    ! mean Si/C ratio
+   grosip     =  0.159    ! mean Si/C ratio
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 &nampismort     !   parameters for phytoplankton sinks
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   wchl       =  0.001    ! quadratic mortality of phytoplankton
-   wchld      =  0.02     ! maximum quadratic mortality of diatoms
+   wchl       =  0.01    ! quadratic mortality of phytoplankton
+   wchld      =  0.01     ! maximum quadratic mortality of diatoms
+   wchldm     =  0.03     ! maximum quadratic mortality of diatoms
    mprat      =  0.01     ! phytoplankton mortality rate
    mprat2     =  0.01     ! Diatoms mortality rate
-   mpratm     =  0.01     ! Phytoplankton minimum mortality rate
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 &nampismes     !   parameters for mesozooplankton
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   part2      =  0.75    ! part of calcite not dissolved in mesozoo guts
-   grazrat2   =  0.7      ! maximal mesozoo grazing rate
+   part2      =  0.75     ! part of calcite not dissolved in mesozoo guts
+   grazrat2   =  0.75     ! maximal mesozoo grazing rate
    resrat2    =  0.005    ! exsudation rate of mesozooplankton
    mzrat2     =  0.03     ! mesozooplankton mortality rate
@@ -102,5 +116,5 @@
    xthresh2phy = 1E-8     ! nanophyto feeding threshold for mesozooplankton 
    xthresh2poc = 1E-8     ! poc feeding threshold for mesozooplankton 
-   xthresh2   =  2E-7    ! Food threshold for grazing
+   xthresh2   =  3E-7     ! Food threshold for grazing
    xkgraz2    =  20.E-6   ! half sturation constant for meso grazing
    epsher2    =  0.3      ! Efficicency of Mesozoo growth
@@ -115,5 +129,5 @@
    grazrat    =  3.0      ! maximal zoo grazing rate
    resrat     =  0.03     ! exsudation rate of zooplankton
-   mzrat      =  0.001    ! zooplankton mortality rate
+   mzrat      =  0.004    ! zooplankton mortality rate
    xpref2c    =  0.1      ! Microzoo preference for POM
    xpref2p    =  1.       ! Microzoo preference for Nanophyto
@@ -122,5 +136,5 @@
    xthreshphy =  1.E-8    ! Nanophyto feeding threshold for microzooplankton 
    xthreshpoc =  1.E-8    ! POC feeding threshold for microzooplankton 
-   xthresh    =  2.E-7    ! Food threshold for feeding
+   xthresh    =  3.E-7    ! Food threshold for feeding
    xkgraz     =  20.E-6   ! half sturation constant for grazing
    epsher     =  0.3      ! Efficiency of microzoo growth
@@ -129,15 +143,22 @@
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampisfer     !   parameters for iron chemistry
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   ln_fechem =  .false.   ! complex iron chemistry ( T/F )
+   ln_ligvar =  .true.   ! variable ligand concentration
+   xlam1     =  0.005     ! scavenging rate of Iron
+   xlamdust  =  150.0     ! Scavenging rate of dust
+   ligand    =  0.6E-9    ! Ligands concentration 
+/  
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 &nampisrem     !   parameters for remineralization
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   xremik    =  0.25      ! remineralization rate of DOC
+   xremik    =  0.35      ! remineralization rate of DOC
    xremip    =  0.025     ! remineralisation rate of POC
    nitrif    =  0.05      ! NH4 nitrification rate
    xsirem    =  0.003     ! remineralization rate of Si
-   xsiremlab =  0.025     ! fast remineralization rate of Si
-   xsilab    =  0.31      ! Fraction of labile biogenic silica
-   xlam1     =  0.005     ! scavenging rate of Iron
+   xsiremlab =  0.03      ! fast remineralization rate of Si
+   xsilab    =  0.5       ! Fraction of labile biogenic silica
    oxymin    =  1.E-6     ! Half-saturation constant for anoxia
-   ligand    =  0.6E-9    ! Ligands concentration
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
@@ -148,25 +169,37 @@
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampissed     !   parameters for inputs deposition
+&nampissbc     !   parameters for inputs deposition
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
 !              !  file name        ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
 !              !                   !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
    sn_dust     = 'dust.orca'       ,     -1            , 'dust'     ,  .true.      , .true. ,   'yearly'  , ''       , ''
-   sn_riverdic = 'river.orca'      ,    -12            , 'riverdic' ,  .false.     , .true. ,   'yearly'  , ''       , ''
-   sn_riverdoc = 'river.orca'      ,    -12            , 'riverdoc' ,  .false.     , .true. ,   'yearly'  , ''       , ''
+   sn_solub    = 'solubility.orca' ,    -12            , 'solubility1' ,  .false.      , .true. ,   'yearly'  , ''       , ''
+   sn_riverdic = 'river.orca'      ,    120            , 'riverdic' ,  .true.     , .true. ,   'yearly'  , ''       , ''
+   sn_riverdoc = 'river.orca'      ,    120            , 'riverdoc' ,  .true.     , .true. ,   'yearly'  , ''       , ''
+   sn_riverdin = 'river.orca'      ,    120            , 'riverdin' ,  .true.     , .true. ,   'yearly'  , ''       , ''
+   sn_riverdon = 'river.orca'      ,    120            , 'riverdon' ,  .true.     , .true. ,   'yearly'  , ''       , ''
+   sn_riverdip = 'river.orca'      ,    120            , 'riverdip' ,  .true.     , .true. ,   'yearly'  , ''       , ''
+   sn_riverdop = 'river.orca'      ,    120            , 'riverdop' ,  .true.     , .true. ,   'yearly'  , ''       , ''
+   sn_riverdsi = 'river.orca'      ,    120            , 'riverdsi' ,  .true.     , .true. ,   'yearly'  , ''       , ''
    sn_ndepo    = 'ndeposition.orca',    -12            , 'ndep'     ,  .false.     , .true. ,   'yearly'  , ''       , ''
    sn_ironsed  = 'bathy.orca'      ,    -12            , 'bathy'    ,  .false.     , .true. ,   'yearly'  , ''       , ''
+   sn_hydrofe  = 'hydrofe'         ,    -12            , 'epsdb'    ,  .false.     , .true. ,   'yearly'  , ''       , ''
 !
    cn_dir      = './'      !  root directory for the location of the dynamical files
    ln_dust     =  .true.   ! boolean for dust input from the atmosphere
-   ln_river    =  .false.   ! boolean for river input of nutrients
+   ln_solub    =  .true.   ! boolean for variable solubility of atm. Iron
+   ln_river    =  .true.   ! boolean for river input of nutrients
    ln_ndepo    =  .true.   ! boolean for atmospheric deposition of N
    ln_ironsed  =  .true.   ! boolean for Fe input from sediments
+   ln_ironice  =  .true.   ! boolean for Fe input from sea ice
+   ln_hydrofe  =  .false.   ! boolean for from hydrothermal vents
    sedfeinput  =  1E-9     ! Coastal release of Iron
    dustsolub   =  0.02     ! Solubility of the dust
-   wdust       =  2.0      ! Dust sinking speed
+   wdust       =  2.0      ! Dust sinking speed 
+   icefeinput  =  15E-9    ! Iron concentration in sea ice
    nitrfix     =  1E-7     ! Nitrogen fixation rate
    diazolight  =  50.      ! Diazotrophs sensitivity to light (W/m2)
    concfediaz  =  1.E-10   ! Diazotrophs half-saturation Cste for Iron
+   hratio      =  9.E-5    ! Fe to 3He ratio assumed for vent iron supply 
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
@@ -175,4 +208,5 @@
    xkr_eta      = 1.17    ! Sinking  exponent
    xkr_zeta     = 2.28    ! N content exponent
+   xkr_ncontent = 5.7E-6  ! N content factor
    xkr_mass_min = 0.0002  ! Minimum mass for Aggregates
    xkr_mass_max = 1.      ! Maximum mass for Aggregates
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_top
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_top	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_top	(revision 3680)
@@ -16,14 +16,14 @@
    ln_rsttr      = .false.   !  start from a restart file (T) or not (F)
    nn_rsttr      =   0       !  restart control = 0 initial time step is not compared to the restart file value
-                             !                  = 1 do not use the value in the restart file
-                             !                  = 2 calendar parameters read in the restart file
+                           !                  = 1 do not use the value in the restart file
+                           !                  = 2 calendar parameters read in the restart file
    cn_trcrst_in  = "restart_trc"   !  suffix of pass. sn_tracer restart name (input)
    cn_trcrst_out = "restart_trc"   !  suffix of pass. sn_tracer restart name (output)
-   ln_trcdta     =   .true.  !  Initialisation from data input file (T) or not (F)
+   ln_trcdta     =   .true. !  Initialisation from data input file (T) or not (F)
    ln_trcdmp     =  .false.  !  add a damping termn (T) or not (F)
 !
-!                !    name   !           title of the field              ! initial data ! initial data ! save   !
-!                !           !                                           !  units       ! from file    ! or not ! 
-!                !           !                                           !              ! or not       !        !
+!              !    name   !           title of the field              !   units    ! initial data ! save   !
+!              !           !                                           !            ! from file    ! or not ! 
+!              !           !                                           !            ! or not       !        !
    sn_tracer(1)   = 'DIC     ' , 'Dissolved inorganic Concentration      ',  'mol-C/L' ,  .true.     ,  .true.
    sn_tracer(2)   = 'Alkalini' , 'Total Alkalinity Concentration         ',  'eq/L '   ,  .true.     ,  .true.
@@ -35,5 +35,5 @@
    sn_tracer(8)   = 'PHY     ' , 'Nanophytoplankton Concentration        ',  'mol-C/L' ,  .false.    ,  .true.
    sn_tracer(9)   = 'ZOO     ' , 'Microzooplankton Concentration         ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(10)  = 'DOC     ' , 'Dissolved organic Concentration        ',  'mol-C/L' ,  .true.     ,  .true.
+   sn_tracer(10)  = 'DOC     ' , 'Dissolved organic Concentration        ',  'mol-C/L' ,  .false.    ,  .true.
    sn_tracer(11)  = 'PHY2    ' , 'Diatoms Concentration                  ',  'mol-C/L' ,  .false.    ,  .true.
    sn_tracer(12)  = 'ZOO2    ' , 'Mesozooplankton Concentration          ',  'mol-C/L' ,  .false.    ,  .true.
@@ -59,10 +59,9 @@
    sn_trcdta(1)  = 'data_DIC_nomask'        ,        -12        ,  'DIC'     ,    .false.   , .true. , 'yearly'  , ''       , ''
    sn_trcdta(2)  = 'data_Alkalini_nomask'   ,        -12        ,  'Alkalini',    .false.   , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(3)  = 'data_O2_nomask'         ,        -1         ,  'O2'      ,    .true.    , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(5)  = 'data_PO4_nomask'        ,        -1         ,  'PO4'     ,    .true.    , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(7)  = 'data_Si_nomask'         ,        -1         ,  'Si'      ,    .true.    , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(10) = 'data_DOC_nomask'        ,        -12        ,  'DOC'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(3)  = 'data_1m_O2_nomask'      ,        -1         ,  'O2'      ,    .true.    , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(5)  = 'data_1m_PO4_nomask'     ,        -1         ,  'PO4'     ,    .true.    , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(7)  = 'data_1m_Si_nomask'      ,        -1         ,  'Si'      ,    .true.    , .true. , 'yearly'  , ''       , ''
    sn_trcdta(14) = 'data_Fer_nomask'        ,        -12        ,  'Fer'     ,    .false.   , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(23) = 'data_NO3_nomask'        ,        -1         ,  'NO3'     ,    .true.    , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(23) = 'data_1m_NO3_nomask'     ,        -1         ,  'NO3'     ,    .true.    , .true. , 'yearly'  , ''       , ''
 !
    cn_dir        =  './'      !  root directory for the location of the data files
@@ -72,5 +71,4 @@
    rn_trfac(5)   = 122.0e-06  !  -      -      -     -
    rn_trfac(7)   =   1.0e-06  !  -      -      -     -
-   rn_trfac(10)  =   1.0      !  -      -      -     -
    rn_trfac(14)  =   1.0      !  -      -      -     -
    rn_trfac(23)  =   7.6e-06  !  -      -      -     -
@@ -85,4 +83,5 @@
    ln_trcadv_ubs    =  .false.  !  UBS scheme
    ln_trcadv_qck    =  .false.  !  QUICKEST scheme
+   ln_traadv_msc_ups=  .false.  !  use upstream scheme within muscl
 /
 !-----------------------------------------------------------------------
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/xmlio_server.def
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/xmlio_server.def	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/xmlio_server.def	(revision 3680)
@@ -30,5 +30,5 @@
                               !  setting nn_nchunks_k = jpk will give a chunk size of 1 in the vertical which
                               !  is optimal for postprocessing which works exclusively with horizontal slabs
-   ln_nc4zip      =   .TRUE.  !  (T) use netcdf4 chunking and compression
+   ln_nc4zip      =   .false.  !  (T) use netcdf4 chunking and compression
                               !  (F) ignore chunking information and produce netcdf3-compatible files  
 /
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/cpp_ORCA2_OFF_PISCES.fcm
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/cpp_ORCA2_OFF_PISCES.fcm	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/cpp_ORCA2_OFF_PISCES.fcm	(revision 3680)
@@ -1,1 +1,1 @@
-bld::tool::fppkeys key_trabbl key_orca_r2 key_ldfslp key_traldf_c2d key_traldf_eiv key_top key_offline key_pisces key_iomput 
+bld::tool::fppkeys key_trabbl key_orca_r2 key_ldfslp key_traldf_c2d key_traldf_eiv key_top key_offline key_pisces key_iomput
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/1_namelist
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/1_namelist	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/1_namelist	(revision 3680)
@@ -0,0 +1,869 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/OPA  :  1 - run manager      (namrun)
+!! namelists    2 - Domain           (namzgr, namzgr_sco, namdom, namdta_tem, namdta_sal)
+!!              3 - Surface boundary (namsbc, namsbc_ana, namsbc_flx, namsbc_clio, namsbc_core
+!!                                    namsbc_cpl, namsbc_cpl_co2 namtra_qsr, namsbc_rnf, 
+!!                                    namsbc_apr, namsbc_ssr, namsbc_alb)
+!!              4 - lateral boundary (namlbc, namcla, namobc, namagrif, nambdy, nambdy_tide)
+!!              5 - bottom  boundary (nambfr, nambbc, nambbl)
+!!              6 - Tracer           (nameos, namtra_adv, namtra_ldf, namtra_dmp)
+!!              7 - dynamics         (namdyn_adv, namdyn_vor, namdyn_hpg, namdyn_spg, namdyn_ldf)
+!!              8 - Verical physics  (namzdf, namzdf_ric, namzdf_tke, namzdf_kpp, namzdf_ddm, namzdf_tmx)
+!!              9 - diagnostics      (namnc4, namtrd, namspr, namflo, namptr, namhsb)
+!!             10 - miscellaneous    (namsol, nammpp, nammpp_dyndist, namctl)
+!!             11 - Obs & Assim      (namobs, nam_asminc)
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+!!======================================================================
+!!                   ***  Run management namelists  ***
+!!======================================================================
+!!   namrun        parameters of the run
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namrun        !   parameters of the run
+!-----------------------------------------------------------------------
+   nn_no       =       0   !  job number
+   cn_exp      = "Agulhas" !  experience name 
+   nn_it000    =       1   !  first time step
+   nn_itend    =   10950   !  last  time step
+   nn_date0    =  010101   !  initial calendar date yymmdd (used if nn_rstctl=1)
+   nn_leapy    =       0   !  Leap year calendar (1) or not (0)
+   ln_rstart   = .false.   !  start from rest (F) or from a restart file (T)
+   nn_rstctl   =       0       !  restart control = 0 nn_it000 is not compared to the restart file value
+                               !                  = 1 use nn_date0 in namelist (not the value in the restart file)
+                               !                  = 2 calendar parameters read in the restart file
+   cn_ocerst_in  = "restart"   !  suffix of ocean restart name (input)
+   cn_ocerst_out = "restart"   !  suffix of ocean restart name (output)
+   nn_istate   =       0   !  output the initial state (1) or not (0)
+   nn_stock    =   10950   !  frequency of creation of a restart file (modulo referenced to 1)
+   nn_write    =   10950   !  frequency of write in the output file   (modulo referenced to nn_it000)
+   ln_dimgnnn  = .false.   !  DIMG file format: 1 file for all processors (F) or by processor (T)
+   ln_mskland  = .false.   !  mask land points in NetCDF outputs (costly: + ~15%)
+   ln_clobber  = .false.   !  clobber (overwrite) an existing file
+   nn_chunksz  =       0   !  chunksize (bytes) for NetCDF file (works only with iom_nf90 routines)
+/
+
+!!======================================================================
+!!                      ***  Domain namelists  ***
+!!======================================================================
+!!   namzgr       vertical coordinate
+!!   namzgr_sco   s-coordinate or hybrid z-s-coordinate
+!!   namdom       space and time domain (bathymetry, mesh, timestep)
+!!   namdta_tem   data: temperature                                     ("key_dtatem")
+!!   namdta_sal   data: salinity                                        ("key_dtasal")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namzgr        !   vertical coordinate
+!-----------------------------------------------------------------------
+   ln_zco      = .false.   !  z-coordinate - full    steps   (T/F)      ("key_zco" may also be defined)
+   ln_zps      = .true.    !  z-coordinate - partial steps   (T/F)
+   ln_sco      = .false.   !  s- or hybrid z-s-coordinate    (T/F)
+/
+!-----------------------------------------------------------------------
+&namzgr_sco    !   s-coordinate or hybrid z-s-coordinate
+!-----------------------------------------------------------------------
+   rn_sbot_min =  300.     !  minimum depth of s-bottom surface (>0) (m)
+   rn_sbot_max = 5250.     !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
+   rn_theta    =    6.0    !  surface control parameter (0<=rn_theta<=20)
+   rn_thetb    =    0.75   !  bottom control parameter  (0<=rn_thetb<= 1)
+   rn_rmax     =    0.15   !  maximum cut-off r-value allowed (0<rn_max<1)
+   ln_s_sigma  = .false.   !  hybrid s-sigma coordinates
+   rn_bb       =    0.8    !  stretching with s-sigma
+   rn_hc       =  150.0    !  critical depth with s-sigma 
+/
+!-----------------------------------------------------------------------
+&namdom        !   space and time domain (bathymetry, mesh, timestep)
+!-----------------------------------------------------------------------
+   nn_bathy    =    1      !  compute (=0) or read (=1) the bathymetry file
+   nn_closea    =   0      !  remove (=0) or keep (=1) closed seas and lakes (ORCA)
+   nn_msh      =    0      !  create (=1) a mesh file or not (=0)
+   rn_hmin     =   -3.     !  min depth of the ocean (>0) or min number of ocean level (<0)
+   rn_e3zps_min=   20.     !  partial step thickness is set larger than the minimum of
+   rn_e3zps_rat=    0.1    !  rn_e3zps_min and rn_e3zps_rat*e3t, with 0<rn_e3zps_rat<1
+                           !
+   rn_rdt      = 2880.     !  time step for the dynamics (and tracer if nn_acc=0)
+   nn_baro     =   64      !  number of barotropic time step            ("key_dynspg_ts")
+   rn_atfp     =    0.1    !  asselin time filter parameter
+   nn_acc      =    0      !  acceleration of convergence : =1      used, rdt < rdttra(k)
+                                 !                          =0, not used, rdt = rdttra
+   rn_rdtmin   = 14400.          !  minimum time step on tracers (used if nn_acc=1)
+   rn_rdtmax   = 14400.          !  maximum time step on tracers (used if nn_acc=1)
+   rn_rdth     =  800.           !  depth variation of tracer time step  (used if nn_acc=1)
+/
+!-----------------------------------------------------------------------
+&namdta_tem    !   data : temperature                                   ("key_dtatem")
+!-----------------------------------------------------------------------
+!              ! file name ! frequency (hours)    ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation !
+!              !           !  (if <0  months)     !   name   !  (logical)   ! (T/F) ! 'monthly'  ! filename ! pairing  !
+   sn_tem = 'data_1m_potential_temperature_nomask', -1,'votemper',  .true.  , .true., 'yearly'   , ''      , ' '
+   !
+   cn_dir       = './'     !  root directory for the location of the runoff files
+/
+!-----------------------------------------------------------------------
+&namdta_sal    !   data : salinity                                      ("key_dtasal")
+!-----------------------------------------------------------------------
+!              ! file name ! frequency (hours)    ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation !
+!              !           !  (if <0  months)     !   name   !   (logical)  ! (T/F) ! 'monthly'  ! filename ! pairing  !
+   sn_sal      =  'data_1m_salinity_nomask',  -1  ,'vosaline',    .true.    , .true., 'yearly'   , ''       , ' '
+   !
+   cn_dir      = './'      !  root directory for the location of the runoff files
+/
+
+!!======================================================================
+!!            ***  Surface Boundary Condition namelists  ***
+!!======================================================================
+!!   namsbc          surface boundary condition
+!!   namsbc_ana      analytical         formulation
+!!   namsbc_flx      flux               formulation
+!!   namsbc_clio     CLIO bulk formulea formulation
+!!   namsbc_core     CORE bulk formulea formulation
+!!   namsbc_cpl      CouPLed            formulation                     ("key_coupled")
+!!   namsbc_cpl_co2  coupled ocean/biogeo/atmosphere model              ("key_cpl_carbon_cycle")
+!!   namtra_qsr      penetrative solar radiation
+!!   namsbc_rnf      river runoffs
+!!   namsbc_apr      Atmospheric Pressure
+!!   namsbc_ssr      sea surface restoring term (for T and/or S)
+!!   namsbc_alb      albedo parameters
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namsbc        !   Surface Boundary Condition (surface module)
+!-----------------------------------------------------------------------
+   nn_fsbc     = 5         !  frequency of surface boundary condition computation 
+                           !     (also = the frequency of sea-ice model call)
+   ln_ana      = .false.   !  analytical formulation                    (T => fill namsbc_ana ) 
+   ln_flx      = .false.   !  flux formulation                          (T => fill namsbc_flx )
+   ln_blk_clio = .false.   !  CLIO bulk formulation                     (T => fill namsbc_clio) 
+   ln_blk_core = .true.    !  CORE bulk formulation                     (T => fill namsbc_core) 
+   ln_cpl      = .false.   !  Coupled formulation                       (T => fill namsbc_cpl )
+   ln_apr_dyn  = .false.   !  Patm gradient added in ocean & ice Eqs.   (T => fill namsbc_apr )
+   nn_ice      = 0         !  =0 no ice boundary condition   ,
+                           !  =1 use observed ice-cover      ,
+                           !  =2 ice-model used                         ("key_lim3" or "key_lim2)
+   ln_dm2dc    = .false.   !  daily mean to diurnal cycle on short wave
+   ln_rnf      = .false.   !  runoffs                                   (T => fill namsbc_rnf)
+   ln_ssr      = .false.   !  Sea Surface Restoring on T and/or S       (T => fill namsbc_ssr)
+   nn_fwb      = 0         !  FreshWater Budget: =0 unchecked 
+                           !     =1 global mean of e-p-r set to zero at each time step 
+                           !     =2 annual global mean of e-p-r set to zero
+                           !     =3 global emp set to zero and spread out over erp area
+/
+!-----------------------------------------------------------------------
+&namsbc_ana    !   analytical surface boundary condition
+!-----------------------------------------------------------------------
+   nn_tau000   =   0       !  gently increase the stress over the first ntau_rst time-steps
+   rn_utau0    =   0.5     !  uniform value for the i-stress
+   rn_vtau0    =   0.e0    !  uniform value for the j-stress
+   rn_qns0     =   0.e0    !  uniform value for the total heat flux
+   rn_qsr0     =   0.e0    !  uniform value for the solar radiation
+   rn_emp0     =   0.e0    !  uniform value for the freswater budget (E-P)
+/
+!-----------------------------------------------------------------------
+&namsbc_flx    !   surface boundary condition : flux formulation
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_utau     = 'utau'      ,        24         , 'utau'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_vtau     = 'vtau'      ,        24         , 'vtau'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_qtot     = 'qtot'      ,        24         , 'qtot'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_qsr      = 'qsr'       ,        24         , 'qsr'     , .false.      , .false., 'yearly'  , ''       , ''
+   sn_emp      = 'emp'       ,        24         , 'emp'     , .false.      , .false., 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the flux files
+/      
+!-----------------------------------------------------------------------
+&namsbc_clio   !   namsbc_clio  CLIO bulk formulea
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_utau     = 'taux_1m'   ,       -1          , 'sozotaux',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_vtau     = 'tauy_1m'   ,       -1          , 'sometauy',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_wndm     = 'flx'       ,       -1          , 'socliowi',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_tair     = 'flx'       ,       -1          , 'socliot2',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_humi     = 'flx'       ,       -1          , 'socliohu',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_ccov     = 'flx'       ,       -1          , 'socliocl',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_prec     = 'flx'       ,       -1          , 'socliopl',   .false.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files are
+/
+!-----------------------------------------------------------------------
+&namsbc_core   !   namsbc_core  CORE bulk formulea
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_wndi = 'u_10.15JUNE2009_orca2'       ,  6  , 'U_10_MOD',   .false.    , .true. , 'yearly'  , 'weights_bicub.nc'       , ''
+   sn_wndj = 'v_10.15JUNE2009_orca2'       ,  6  , 'V_10_MOD',   .false.    , .true. , 'yearly'  , 'weights_bicub.nc'       , ''
+   sn_qsr  = 'ncar_rad.15JUNE2009_orca2'   , 24  , 'SWDN_MOD',   .false.    , .true. , 'yearly'  , 'weights_bilin.nc'       , ''
+   sn_qlw  = 'ncar_rad.15JUNE2009_orca2'   , 24  , 'LWDN_MOD',   .false.    , .true. , 'yearly'  , 'weights_bilin.nc'       , ''
+   sn_tair = 't_10.15JUNE2009_orca2'       ,  6  , 'T_10_MOD',   .false.    , .true. , 'yearly'  , 'weights_bilin.nc'       , ''
+   sn_humi = 'q_10.15JUNE2009_orca2'       ,  6  , 'Q_10_MOD',   .false.    , .true. , 'yearly'  , 'weights_bilin.nc'       , ''
+   sn_prec = 'ncar_precip.15JUNE2009_orca2', -1  , 'PRC_MOD1',   .false.    , .true. , 'yearly'  , 'weights_bilin.nc'       , ''
+   sn_snow = 'ncar_precip.15JUNE2009_orca2', -1  , 'SNOW'    ,   .false.    , .true. , 'yearly'  , 'weights_bilin.nc'       , ''
+   sn_tdif = 'taudif_core'                 , 24  , 'taudif'  ,   .false.    , .true. , 'yearly'  , 'weights_bilin.nc'       , ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files
+   ln_2m       = .false.   !  air temperature and humidity referenced at 2m (T) instead 10m (F)
+   ln_taudif   = .false.   !  HF tau contribution: use "mean of stress module - module of the mean stress" data
+   rn_pfac     = 1.        !  multiplicative factor for precipitation (total & snow)
+/
+!-----------------------------------------------------------------------
+&namsbc_cpl    !   coupled ocean/atmosphere model                       ("key_coupled")
+!-----------------------------------------------------------------------
+!                                      ! send
+cn_snd_temperature= 'weighted oce and ice'  !  'oce only' 'weighted oce and ice' 'mixed oce-ice'
+cn_snd_albedo     = 'weighted ice'          !  'none' 'weighted ice' 'mixed oce-ice'
+cn_snd_thickness  = 'none'                  !  'none' 'weighted ice and snow'
+cn_snd_crt_nature = 'none'                  !  'none' 'oce only' 'weighted oce and ice' 'mixed oce-ice'
+cn_snd_crt_refere = 'spherical'             !  'spherical' 'cartesian'
+cn_snd_crt_orient = 'eastward-northward'    !  'eastward-northward' or 'local grid'
+cn_snd_crt_grid   = 'T'                     !  'T'
+!                                      ! receive
+cn_rcv_w10m       = 'none'                  !  'none' 'coupled'
+cn_rcv_taumod     = 'coupled'               !  'none' 'coupled'
+cn_rcv_tau_nature = 'oce only'              !  'oce only' 'oce and ice' 'mixed oce-ice'
+cn_rcv_tau_refere = 'cartesian'             !  'spherical' 'cartesian'
+cn_rcv_tau_orient = 'eastward-northward'    !  'eastward-northward' or 'local grid'
+cn_rcv_tau_grid   = 'U,V'                   !  'T' 'U,V' 'U,V,F' 'U,V,I' 'T,F' 'T,I' 'T,U,V'
+cn_rcv_dqnsdt     = 'coupled'               !  'none' 'coupled'
+cn_rcv_qsr        = 'oce and ice'           !  'conservative' 'oce and ice' 'mixed oce-ice'
+cn_rcv_qns        = 'oce and ice'           !  'conservative' 'oce and ice' 'mixed oce-ice'
+cn_rcv_emp        = 'conservative'          !  'conservative' 'oce and ice' 'mixed oce-ice'
+cn_rcv_rnf        = 'coupled'               !  'coupled' 'climato' 'mixed'
+cn_rcv_cal        = 'coupled'               !  'none' 'coupled'
+/
+!-----------------------------------------------------------------------
+&namsbc_cpl_co2   !   coupled ocean/biogeo/atmosphere model             ("key_cpl_carbon_cycle")
+!-----------------------------------------------------------------------
+   cn_snd_co2     = 'coupled'         ! send    : 'none' 'coupled'
+   cn_rcv_co2     = 'coupled'         ! receive : 'none' 'coupled'
+/
+!-----------------------------------------------------------------------
+&namtra_qsr    !   penetrative solar radiation
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_chl      ='chlorophyll',        -1         , 'CHLA'    ,   .true.     , .true. , 'yearly'  , 'weights_bilin.nc'       , ''
+
+   cn_dir      = './'      !  root directory for the location of the runoff files
+   ln_traqsr   = .true.    !  Light penetration (T) or not (F)
+   ln_qsr_rgb  = .true.    !  RGB (Red-Green-Blue) light penetration
+   ln_qsr_2bd  = .false.   !  2 bands              light penetration
+   ln_qsr_bio  = .false.   !  bio-model light penetration
+   nn_chldta   =      1    !  RGB : Chl data (=1) or cst value (=0)
+   rn_abs      =   0.58    !  RGB & 2 bands: fraction of light (rn_si1)
+   rn_si0      =   0.35    !  RGB & 2 bands: shortess depth of extinction
+   rn_si1      =   23.0    !  2 bands: longest depth of extinction
+/
+!-----------------------------------------------------------------------
+&namsbc_rnf    !   runoffs namelist surface boundary condition
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_rnf      = 'runoff_core_monthly',    -1    , 'sorunoff',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_cnf      = 'runoff_core_monthly',     0    , 'socoefr0',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_s_rnf    = 'runoffs'            ,    24    , 'rosaline',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_t_rnf    = 'runoffs'            ,    24    , 'rotemper',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_dep_rnf  = 'runoffs'            ,     0    , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir       = './'      !  root directory for the location of the runoff files
+   ln_rnf_emp   = .false.   !  runoffs included into precipitation field (T) or into a file (F)
+   ln_rnf_mouth = .true.    !  specific treatment at rivers mouths
+   rn_hrnf      =  15.e0    !  depth over which enhanced vertical mixing is used
+   rn_avt_rnf   =   1.e-3   !  value of the additional vertical mixing coef. [m2/s]
+   rn_rfact     =   1.e0    !  multiplicative factor for runoff
+   ln_rnf_depth = .false.   !  read in depth information for runoff
+   ln_rnf_tem   = .false.   !  read in temperature information for runoff
+   ln_rnf_sal   = .false.   !  read in salinity information for runoff
+/
+!-----------------------------------------------------------------------
+&namsbc_apr    !   Atmospheric pressure used as ocean forcing or in bulk
+!-----------------------------------------------------------------------
+!              ! file name ! frequency (hours) ! variable ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
+!              !           !  (if <0  months)  !   name   !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
+   sn_apr      = 'patm'    ,         -1        ,'somslpre',    .true.      , .true.  , 'yearly'  ,  ''      ,   ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files
+   ln_ref_apr  = .false.   !  ref. pressure: global mean Patm (T) or a constant (F)
+/
+!-----------------------------------------------------------------------
+&namsbc_ssr    !   surface boundary condition : sea surface restoring
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_sst      = 'sst_data'  ,        24         ,  'sst'    ,    .false.   , .false., 'yearly'  , ''       , ''
+   sn_sss      = 'sss_data'  ,        -1         ,  'sss'    ,    .true.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the runoff files
+   nn_sstr     =     0     !  add a retroaction term in the surface heat       flux (=1) or not (=0)
+   nn_sssr     =     2     !  add a damping     term in the surface freshwater flux (=2) 
+                           !  or to SSS only (=1) or no damping term (=0)
+   rn_dqdt     =   -40.    !  magnitude of the retroaction on temperature   [W/m2/K]
+   rn_deds     =   -27.7   !  magnitude of the damping on salinity   [mm/day]
+   ln_sssr_bnd =   .true.  !  flag to bound erp term (associated with nn_sssr=2)
+   rn_sssr_bnd =   4.e0    !  ABS(Max/Min) value of the damping erp term [mm/day]
+/      
+!-----------------------------------------------------------------------
+&namsbc_alb    !   albedo parameters
+!-----------------------------------------------------------------------
+   rn_cloud    =    0.06   !  cloud correction to snow and ice albedo 
+   rn_albice   =    0.53   !  albedo of melting ice in the arctic and antarctic
+   rn_alphd    =    0.80   !  coefficients for linear interpolation used to
+   rn_alphc    =    0.65   !  compute albedo between two extremes values 
+   rn_alphdi   =    0.72   !  (Pyane, 1972)
+/
+
+!!======================================================================
+!!               ***  Lateral boundary condition  ***
+!!======================================================================
+!!   namlbc        lateral momentum boundary condition
+!!   namcla        cross land advection
+!!   namobc        open boundaries parameters                           ("key_obc")
+!!   namagrif      agrif nested grid ( read by child model only )       ("key_agrif") 
+!!   nambdy        Unstructured open boundaries                         ("key_bdy")
+!!   namtide       Tidal forcing at open boundaries                     ("key_bdy_tides")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namlbc        !   lateral momentum boundary condition
+!-----------------------------------------------------------------------
+   rn_shlat    =    2.     !  shlat = 0  !  0 < shlat < 2  !  shlat = 2  !  2 < shlat
+                           !  free slip  !   partial slip  !   no slip   ! strong slip
+/
+!-----------------------------------------------------------------------
+&namcla        !   cross land advection
+!-----------------------------------------------------------------------
+   nn_cla      =    0      !  advection between 2 ocean pts separates by land
+/
+!-----------------------------------------------------------------------
+&namobc        !   open boundaries parameters                           ("key_obc")
+!-----------------------------------------------------------------------
+   ln_obc_clim = .false.   !  climatological obc data files (T) or not (F)
+   ln_vol_cst  = .true.    !  impose the total volume conservation (T) or not (F)
+   ln_obc_fla  = .false.   !  Flather open boundary condition 
+   nn_obcdta   =    1      !  = 0 the obc data are equal to the initial state
+                           !  = 1 the obc data are read in 'obc.dta' files
+   cn_obcdta   = 'annual'  !  set to annual if obc datafile hold 1 year of data
+                           !  set to monthly if obc datafile hold 1 month of data
+   rn_dpein    =    1.     !  damping time scale for inflow at east  open boundary
+   rn_dpwin    =    1.     !     -           -         -       west    -      -
+   rn_dpnin    =    1.     !     -           -         -       north   -      -
+   rn_dpsin    =    1.     !     -           -         -       south   -      -
+   rn_dpeob    = 3000.     !  time relaxation (days) for the east  open boundary
+   rn_dpwob    =   15.     !     -           -         -     west    -      -
+   rn_dpnob    = 3000.     !     -           -         -     north   -      -
+   rn_dpsob    =   15.     !     -           -         -     south   -      -
+   rn_volemp   =    1.     !  = 0 the total volume change with the surface flux (E-P-R)
+                           !  = 1 the total volume remains constant
+/
+!-----------------------------------------------------------------------
+&namagrif      !  AGRIF zoom                                            ("key_agrif")
+!-----------------------------------------------------------------------
+   nn_cln_update =    3    !  baroclinic update frequency
+   ln_spc_dyn    = .true.  !  use 0 as special value for dynamics
+   rn_sponge_tra = 2880.   !  coefficient for tracer   sponge layer [m2/s]
+   rn_sponge_dyn = 2880.   !  coefficient for dynamics sponge layer [m2/s]
+/
+!-----------------------------------------------------------------------
+&nambdy        !  unstructured open boundaries                          ("key_bdy")
+!-----------------------------------------------------------------------
+   cn_mask     =  ''                     !  name of mask file (ln_mask=T)
+   cn_dta_frs_T= 'bdydata_grid_T.nc'     !  name of data file (T-points)
+   cn_dta_frs_U= 'bdydata_grid_U.nc'     !  name of data file (U-points)
+   cn_dta_frs_V= 'bdydata_grid_V.nc'     !  name of data file (V-points)
+   cn_dta_fla_T= 'bdydata_bt_grid_T.nc'  !  name of data file for Flather condition (T-points)
+   cn_dta_fla_U= 'bdydata_bt_grid_U.nc'  !  name of data file for Flather condition (U-points)
+   cn_dta_fla_V= 'bdydata_bt_grid_V.nc'  !  name of data file for Flather condition (V-points)
+
+   ln_clim     = .false.   !  contain 1 (T) or 12 (F) time dumps and be cyclic
+   ln_vol      = .false.   !  total volume correction (see volbdy parameter)
+   ln_mask     = .false.   !  boundary mask from filbdy_mask (T), boundaries are on edges of domain (F)
+   ln_tides    = .false.   !  Apply tidal harmonic forcing with Flather condition
+   ln_dyn_fla  = .false.   !  Apply Flather condition to velocities
+   ln_tra_frs  = .false.   !  Apply FRS condition to temperature and salinity 
+   ln_dyn_frs  = .false.   !  Apply FRS condition to velocities
+   nn_rimwidth =  9        !  width of the relaxation zone
+   nn_dtactl   =  1        !  = 0, bdy data are equal to the initial state
+                           !  = 1, bdy data are read in 'bdydata   .nc' files
+   nn_volctl   =  0        !  = 0, the total water flux across open boundaries is zero
+                           !  = 1, the total volume of the system is conserved
+/
+!-----------------------------------------------------------------------
+&nambdy_tide   !  tidal forcing at unstructured boundaries              
+!-----------------------------------------------------------------------
+   filtide     = 'bdytide_'           !  file name root of tidal forcing files
+   tide_cpt    = 'M2','S1'            !  names of tidal components used
+   tide_speed  = 28.984106, 15.000001 !  phase speeds of tidal components (deg/hour)
+   ln_tide_date= .false.              !  adjust tidal harmonics for start date of run
+/
+
+!!======================================================================
+!!                 ***  Bottom boundary condition  ***
+!!======================================================================
+!!   nambfr        bottom friction
+!!   nambbc        bottom temperature boundary condition               
+!!   nambbl        bottom boundary layer scheme                         ("key_trabbl")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&nambfr        !   bottom friction
+!-----------------------------------------------------------------------
+   nn_bfr      =    1      !  type of bottom friction :   = 0 : free slip,  = 1 : linear friction
+                           !                              = 2 : nonlinear friction
+   rn_bfri1    =    4.e-4  !  bottom drag coefficient (linear case)
+   rn_bfri2    =    1.e-3  !  bottom drag coefficient (non linear case)
+   rn_bfeb2    =    2.5e-3 !  bottom turbulent kinetic energy background  (m2/s2)
+   ln_bfr2d    = .false.   !  horizontal variation of the bottom friction coef (read a 2D mask file )
+   rn_bfrien   =    50.    !  local multiplying factor of bfr (ln_bfr2d=T)
+/
+!-----------------------------------------------------------------------
+&nambbc        !   bottom temperature boundary condition
+!-----------------------------------------------------------------------
+   ln_trabbc   = .true.    !  Apply a geothermal heating at the ocean bottom
+   nn_geoflx   =    2      !  geothermal heat flux: = 0 no flux 
+                           !     = 1 constant flux
+                           !     = 2 variable flux (read in geothermal_heating.nc in mW/m2) 
+   rn_geoflx_cst = 86.4e-3 !  Constant value of geothermal heat flux [W/m2]
+/
+!-----------------------------------------------------------------------
+&nambbl        !   bottom boundary layer scheme
+!-----------------------------------------------------------------------
+   nn_bbl_ldf  =  1      !  diffusive bbl (=1)   or not (=0)
+   nn_bbl_adv  =  0      !  advective bbl (=1/2) or not (=0)
+   rn_ahtbbl   =  1000.  !  lateral mixing coefficient in the bbl  [m2/s]
+   rn_gambbl   =  10.    !  advective bbl coefficient                 [s]
+/
+
+!!======================================================================
+!!                        Tracer (T & S ) namelists
+!!======================================================================
+!!   nameos        equation of state
+!!   namtra_adv    advection scheme
+!!   namtra_ldf    lateral diffusion scheme
+!!   namtra_dmp    T & S newtonian damping                              ("key_tradmp")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&nameos        !   ocean physical parameters
+!-----------------------------------------------------------------------
+   nn_eos      =   0       !  type of equation of state and Brunt-Vaisala frequency
+                           !     = 0, UNESCO (formulation of Jackett and McDougall (1994) and of McDougall (1987) )
+                           !     = 1, linear: rho(T)   = rau0 * ( 1.028 - ralpha * T )
+                           !     = 2, linear: rho(T,S) = rau0 * ( rbeta * S - ralpha * T )
+   rn_alpha    =   2.0e-4  !  thermal expension coefficient (nn_eos= 1 or 2)
+   rn_beta     =   7.7e-4  !  saline  expension coefficient (nn_eos= 2)
+/
+!-----------------------------------------------------------------------
+&namtra_adv    !   advection scheme for tracer 
+!-----------------------------------------------------------------------
+   ln_traadv_cen2   =  .false.  !  2nd order centered scheme   
+   ln_traadv_tvd    =  .true.   !  TVD scheme                
+   ln_traadv_muscl  =  .false.  !  MUSCL scheme             
+   ln_traadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries  
+   ln_traadv_ubs    =  .false.  !  UBS scheme                 
+   ln_traadv_qck    =  .false.  !  QUCIKEST scheme                 
+/
+!-----------------------------------------------------------------------
+&namtra_ldf    !   lateral diffusion scheme for tracer 
+!-----------------------------------------------------------------------
+   !                       !  Type of the operator : 
+   ln_traldf_lap    =  .true.   !  laplacian operator       
+   ln_traldf_bilap  =  .false.  !  bilaplacian operator     
+   !                       !  Direction of action  :
+   ln_traldf_level  =  .false.  !  iso-level                
+   ln_traldf_hor    =  .false.  !  horizontal (geopotential)            (require "key_ldfslp" when ln_sco=T)
+   ln_traldf_iso    =  .true.   !  iso-neutral                          (require "key_ldfslp")
+   ln_traldf_grif   =  .false.  !  griffies skew flux formulation       (require "key_ldfslp")  ! UNDER TEST, DO NOT USE
+   ln_traldf_gdia   =  .false.  !  griffies operator strfn diagnostics  (require "key_ldfslp")  ! UNDER TEST, DO NOT USE
+   !                       !  Coefficient
+   rn_aht_0         =  1000.    !  horizontal eddy diffusivity for tracers [m2/s]
+   rn_ahtb_0        =     0.    !  background eddy diffusivity for ldf_iso [m2/s]
+   rn_aeiv_0        =     0.    !  eddy induced velocity coefficient [m2/s]    (require "key_traldf_eiv")
+/
+!-----------------------------------------------------------------------
+&namtra_dmp    !   tracer: T & S newtonian damping                      ('key_tradmp')
+!-----------------------------------------------------------------------
+   nn_hdmp     =   90      !  horizontal shape =-1, damping in Med and Red Seas only
+                           !                   =XX, damping poleward of XX degrees (XX>0)
+                           !                      + F(distance-to-coast) + Red and Med Seas
+   nn_zdmp     =    1      !  vertical   shape =0    damping throughout the water column
+                           !                   =1 no damping in the mixing layer (kz  criteria)
+                           !                   =2 no damping in the mixed  layer (rho crieria)
+   rn_surf     =   50.     !  surface time scale of damping   [days]
+   rn_bot      =  360.     !  bottom  time scale of damping   [days]
+   rn_dep      =  800.     !  depth of transition between rn_surf and rn_bot [meters]
+   nn_file     =    0      !  create a damping.coeff NetCDF file (=1) or not (=0)
+/
+
+!!======================================================================
+!!                      ***  Dynamics namelists  ***
+!!======================================================================
+!!   namdyn_adv    formulation of the momentum advection
+!!   namdyn_vor    advection scheme
+!!   namdyn_hpg    hydrostatic pressure gradient
+!!   namdyn_spg    surface pressure gradient                            (CPP key only)
+!!   namdyn_ldf    lateral diffusion scheme
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namdyn_adv    !   formulation of the momentum advection
+!-----------------------------------------------------------------------
+   ln_dynadv_vec = .true.  !  vector form (T) or flux form (F)  
+   ln_dynadv_cen2= .false. !  flux form - 2nd order centered scheme
+   ln_dynadv_ubs = .false. !  flux form - 3rd order UBS      scheme 
+/  
+!-----------------------------------------------------------------------
+&namdyn_vor    !   option of physics/algorithm (not control by CPP keys)
+!-----------------------------------------------------------------------
+   ln_dynvor_ene = .false. !  enstrophy conserving scheme  
+   ln_dynvor_ens = .false. !  energy conserving scheme    
+   ln_dynvor_mix = .false. !  mixed scheme               
+   ln_dynvor_een = .true.  !  energy & enstrophy scheme  
+/
+!-----------------------------------------------------------------------
+&namdyn_hpg    !   Hydrostatic pressure gradient option
+!-----------------------------------------------------------------------
+   ln_hpg_zco  = .false.   !  z-coordinate - full steps                   
+   ln_hpg_zps  = .true.    !  z-coordinate - partial steps (interpolation)
+   ln_hpg_sco  = .false.   !  s-coordinate (standard jacobian formulation)
+   ln_hpg_hel  = .false.   !  s-coordinate (helsinki modification)
+   ln_hpg_wdj  = .false.   !  s-coordinate (weighted density jacobian)
+   ln_hpg_djc  = .false.   !  s-coordinate (Density Jacobian with Cubic polynomial)
+   ln_hpg_rot  = .false.   !  s-coordinate (ROTated axes scheme)
+   rn_gamma    = 0.e0      !  weighting coefficient (wdj scheme)
+   ln_dynhpg_imp = .false. !  time stepping: semi-implicit time scheme  (T)
+                                 !           centered      time scheme  (F)
+/
+!-----------------------------------------------------------------------
+!namdyn_spg    !   surface pressure gradient   (CPP key only)
+!-----------------------------------------------------------------------
+!                          !  explicit free surface                     ("key_dynspg_exp")
+!                          !  filtered free surface                     ("key_dynspg_flt")
+!                          !  split-explicit free surface               ("key_dynspg_ts")
+
+!-----------------------------------------------------------------------
+&namdyn_ldf    !   lateral diffusion on momentum
+!-----------------------------------------------------------------------
+   !                       !  Type of the operator : 
+   ln_dynldf_lap    =  .false.  !  laplacian operator         
+   ln_dynldf_bilap  =  .true.   !  bilaplacian operator    
+   !                       !  Direction of action  : 
+   ln_dynldf_level  =  .false.  !  iso-level               
+   ln_dynldf_hor    =  .true.   !  horizontal (geopotential)            (require "key_ldfslp" in s-coord.)
+   ln_dynldf_iso    =  .false.  !  iso-neutral                          (require "key_ldfslp")
+   !                       !  Coefficient
+   rn_ahm_0_lap     = 40000.    !  horizontal laplacian eddy viscosity   [m2/s]
+   rn_ahmb_0        =     0.    !  background eddy viscosity for ldf_iso [m2/s]
+   rn_ahm_0_blp     = -8.5e+11  !  horizontal bilaplacian eddy viscosity [m4/s] 
+/
+
+!!======================================================================
+!!             Tracers & Dynamics vertical physics namelists
+!!======================================================================
+!!    namzdf        vertical physics
+!!    namzdf_ric    richardson number dependent vertical mixing         ("key_zdfric")
+!!    namzdf_tke    TKE dependent vertical mixing                       ("key_zdftke")
+!!    namzdf_kpp    KPP dependent vertical mixing                       ("key_zdfkpp")
+!!    namzdf_ddm    double diffusive mixing parameterization            ("key_zdfddm")
+!!    namzdf_tmx    tidal mixing parameterization                       ("key_zdftmx")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namzdf        !   vertical physics
+!-----------------------------------------------------------------------
+   rn_avm0     =   1.2e-4  !  vertical eddy viscosity   [m2/s]          (background Kz if not "key_zdfcst")
+   rn_avt0     =   1.2e-5  !  vertical eddy diffusivity [m2/s]          (background Kz if not "key_zdfcst")
+   nn_avb      =    0      !  profile for background avt & avm (=1) or not (=0)
+   nn_havtb    =    0      !  horizontal shape for avtb (=1) or not (=0)
+   ln_zdfevd   = .true.    !  enhanced vertical diffusion (evd) (T) or not (F)
+   nn_evdm     =    0      !  evd apply on tracer (=0) or on tracer and momentum (=1)
+   rn_avevd    =  100.     !  evd mixing coefficient [m2/s]
+   ln_zdfnpc   = .false.   !  Non-Penetrative Convective algorithm (T) or not (F)
+   nn_npc      =    1            !  frequency of application of npc
+   nn_npcp     =  365            !  npc control print frequency
+   ln_zdfexp   = .false.   !  time-stepping: split-explicit (T) or implicit (F) time stepping
+   nn_zdfexp   =    3            !  number of sub-timestep for ln_zdfexp=T
+/
+!-----------------------------------------------------------------------
+&namzdf_ric    !   richardson number dependent vertical diffusion       ("key_zdfric" )
+!-----------------------------------------------------------------------
+   rn_avmri    = 100.e-4   !  maximum value of the vertical viscosity
+   rn_alp      =   5.      !  coefficient of the parameterization
+   nn_ric      =   2       !  coefficient of the parameterization
+/
+!-----------------------------------------------------------------------
+&namzdf_tke    !   turbulent eddy kinetic dependent vertical diffusion  ("key_zdftke")
+!-----------------------------------------------------------------------
+   rn_ediff    =   0.1     !  coef. for vertical eddy coef. (avt=rn_ediff*mxl*sqrt(e) )
+   rn_ediss    =   0.7     !  coef. of the Kolmogoroff dissipation
+   rn_ebb      =  67.83    !  coef. of the surface input of tke (=67.83 suggested when ln_mxl0=T)
+   rn_emin     =   1.e-6   !  minimum value of tke [m2/s2]
+   rn_emin0    =   1.e-4   !  surface minimum value of tke [m2/s2]
+   nn_mxl      =   2       !  mixing length: = 0 bounded by the distance to surface and bottom
+                           !                 = 1 bounded by the local vertical scale factor
+                           !                 = 2 first vertical derivative of mixing length bounded by 1
+                           !                 = 3 as =2 with distinct disspipative an mixing length scale
+   nn_pdl      =   1       !  Prandtl number function of richarson number (=1, avt=pdl(Ri)*avm) or not (=0, avt=avm)
+   ln_mxl0     = .true.    !  surface mixing length scale = F(wind stress) (T) or not (F)
+   rn_mxl0     =   0.04    !  surface  buoyancy lenght scale minimum value
+   ln_lc       = .true.    !  Langmuir cell parameterisation (Axell 2002)
+   rn_lc       =   0.15    !  coef. associated to Langmuir cells
+   nn_etau     =   1       !  penetration of tke below the mixed layer (ML) due to internal & intertial waves
+                           !        = 0 no penetration
+                           !        = 1 add a tke source below the ML
+                           !        = 2 add a tke source just at the base of the ML
+                           !        = 3 as = 1 applied on HF part of the stress    ("key_coupled")
+   rn_efr      =   0.05    !  fraction of surface tke value which penetrates below the ML (nn_etau=1 or 2)
+   nn_htau     =   1       !  type of exponential decrease of tke penetration below the ML
+                           !        = 0  constant 10 m length scale
+                           !        = 1  0.5m at the equator to 30m poleward of 40 degrees
+/
+!------------------------------------------------------------------------
+&namzdf_kpp    !   K-Profile Parameterization dependent vertical mixing  ("key_zdfkpp", and optionally:
+!------------------------------------------------------------------------ "key_kppcustom" or "key_kpplktb")
+   ln_kpprimix = .true.    !  shear instability mixing 
+   rn_difmiw   =  1.0e-04  !  constant internal wave viscosity [m2/s]
+   rn_difsiw   =  0.1e-04  !  constant internal wave diffusivity [m2/s]
+   rn_riinfty  =  0.8      !  local Richardson Number limit for shear instability
+   rn_difri    =  0.0050   !  maximum shear mixing at Rig = 0    [m2/s]
+   rn_bvsqcon  = -0.01e-07 !  Brunt-Vaisala squared for maximum convection [1/s2] 
+   rn_difcon   =  1.       !  maximum mixing in interior convection [m2/s] 
+   nn_avb      =  0        !  horizontal averaged (=1) or not (=0) on avt and amv
+   nn_ave      =  1        !  constant (=0) or profile (=1) background on avt
+/
+!-----------------------------------------------------------------------
+&namzdf_gls                !   GLS vertical diffusion                   ("key_zdfgls")
+!-----------------------------------------------------------------------
+   rn_emin       = 1.e-6   !  minimum value of e   [m2/s2]
+   rn_epsmin     = 1.e-12  !  minimum value of eps [m2/s3]
+   ln_length_lim = .true.  !  limit on the dissipation rate under stable stratification (Galperin et al., 1988)
+   rn_clim_galp  = 0.53    !  galperin limit
+   ln_crban      = .true.  !  Use Craig & Banner (1994) surface wave mixing parametrisation
+   ln_sigpsi     = .true.  !  Activate or not Burchard 2001 mods on psi schmidt number in the wb case
+   rn_crban      = 100.    !  Craig and Banner 1994 constant for wb tke flux
+   rn_charn      = 70000.  !  Charnock constant for wb induced roughness length
+   nn_tkebc_surf =   1     !  surface tke condition (0/1/2=Dir/Neum/Dir Mellor-Blumberg)
+   nn_tkebc_bot  =   1     !  bottom tke condition (0/1=Dir/Neum)
+   nn_psibc_surf =   1     !  surface psi condition (0/1/2=Dir/Neum/Dir Mellor-Blumberg)
+   nn_psibc_bot  =   1     !  bottom psi condition (0/1=Dir/Neum)
+   nn_stab_func  =   2     !  stability function (0=Galp, 1= KC94, 2=CanutoA, 3=CanutoB)
+   nn_clos       =   1     !  predefined closure type (0=MY82, 1=k-eps, 2=k-w, 3=Gen)
+/
+!-----------------------------------------------------------------------
+&namzdf_ddm    !   double diffusive mixing parameterization             ("key_zdfddm")
+!-----------------------------------------------------------------------
+   rn_avts     = 1.e-4     !  maximum avs (vertical mixing on salinity)
+   rn_hsbfr    = 1.6       !  heat/salt buoyancy flux ratio
+/
+!-----------------------------------------------------------------------
+&namzdf_tmx    !   tidal mixing parameterization                        ("key_zdftmx")
+!-----------------------------------------------------------------------
+   rn_htmx     = 500.      !  vertical decay scale for turbulence (meters)
+   rn_n2min    = 1.e-8     !  threshold of the Brunt-Vaisala frequency (s-1)
+   rn_tfe      = 0.333     !  tidal dissipation efficiency
+   rn_me       = 0.2       !  mixing efficiency 
+   ln_tmx_itf  = .false.   !  ITF specific parameterisation
+   rn_tfe_itf  = 1.        !  ITF tidal dissipation efficiency
+/
+
+!!======================================================================
+!!                  ***  Miscelaneous namelists  ***
+!!======================================================================
+!!   nammpp            Massively Parallel Processing                    ("key_mpp_mpi)
+!!   nammpp_dyndist    Massively Parallel domain decomposition          ("key_agrif" && "key_mpp_dyndist")
+!!   namctl            Control prints & Benchmark
+!!   namsol            elliptic solver / island / free surface 
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namsol        !   elliptic solver / island / free surface 
+!-----------------------------------------------------------------------
+   nn_solv     =      1    !  elliptic solver: =1 preconditioned conjugate gradient (pcg)
+                           !                   =2 successive-over-relaxation (sor)
+   nn_sol_arp  =      0    !  absolute/relative (0/1) precision convergence test
+   rn_eps      =  1.e-6    !  absolute precision of the solver
+   nn_nmin     =    300    !  minimum of iterations for the SOR solver
+   nn_nmax     =    800    !  maximum of iterations for the SOR solver
+   nn_nmod     =     10    !  frequency of test for the SOR solver
+   rn_resmax   =  1.e-10   !  absolute precision for the SOR solver
+   rn_sor      =  1.92     !  optimal coefficient for SOR solver (to be adjusted with the domain)
+/
+!-----------------------------------------------------------------------
+&nammpp        !   Massively Parallel Processing                        ("key_mpp_mpi)
+!-----------------------------------------------------------------------
+   cn_mpi_send =  'I'      !  mpi send/recieve type   ='S', 'B', or 'I' for standard send,
+                           !  buffer blocking send or immediate non-blocking sends, resp.
+   nn_buffer   =   0       !  size in bytes of exported buffer ('B' case), 0 no exportation
+/
+!-----------------------------------------------------------------------
+&nammpp_dyndist !   Massively Parallel Distribution for AGRIF zoom      ("key_agrif" && "key_mpp_dyndist")
+!-----------------------------------------------------------------------
+   jpni        =    1      !  jpni   number of processors following i
+   jpnj        =    1      !  jpnj   number of processors following j
+   jpnij       =    1      !  jpnij  number of local domains
+/
+!-----------------------------------------------------------------------
+&namctl        !   Control prints & Benchmark
+!-----------------------------------------------------------------------
+   ln_ctl      = .false.   !  trends control print (expensive!)
+   nn_print    =    0      !  level of print (0 no extra print)
+   nn_ictls    =    0      !  start i indice of control sum (use to compare mono versus
+   nn_ictle    =    0      !  end   i indice of control sum        multi processor runs
+   nn_jctls    =    0      !  start j indice of control               over a subdomain)
+   nn_jctle    =    0      !  end   j indice of control
+   nn_isplt    =    1      !  number of processors in i-direction
+   nn_jsplt    =    1      !  number of processors in j-direction
+   nn_bench    =    0      !  Bench mode (1/0): CAUTION use zero except for bench
+                           !     (no physical validity of the results)
+/
+
+!!======================================================================
+!!                  ***  Diagnostics namelists  ***
+!!======================================================================
+!!   namnc4       netcdf4 chunking and compression settings             ("key_netcdf4")
+!!   namtrd       dynamics and/or tracer trends                         ("key_trddyn","key_trdtra","key_trdmld")
+!!   namflo       float parameters                                      ("key_float")
+!!   namptr       Poleward Transport Diagnostics
+!!   namhsb       Heat and salt budgets 
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namnc4        !   netcdf4 chunking and compression settings            ("key_netcdf4")
+!-----------------------------------------------------------------------
+   nn_nchunks_i=   4       !  number of chunks in i-dimension
+   nn_nchunks_j=   4       !  number of chunks in j-dimension
+   nn_nchunks_k=   31      !  number of chunks in k-dimension
+                           !  setting nn_nchunks_k = jpk will give a chunk size of 1 in the vertical which
+                           !  is optimal for postprocessing which works exclusively with horizontal slabs
+   ln_nc4zip   = .true.    !  (T) use netcdf4 chunking and compression
+                           !  (F) ignore chunking information and produce netcdf3-compatible files
+/
+!-----------------------------------------------------------------------
+&namtrd        !   diagnostics on dynamics and/or tracer trends         ("key_trddyn" and/or "key_trdtra")
+!              !       or mixed-layer trends or barotropic vorticity    ("key_trdmld" or     "key_trdvor")
+!-----------------------------------------------------------------------
+   nn_trd      = 365       !  time step frequency dynamics and tracers trends
+   nn_ctls     =   0       !  control surface type in mixed-layer trends (0,1 or n<jpk)
+   rn_ucf      =   1.      !  unit conversion factor (=1 -> /seconds ; =86400. -> /day)
+   cn_trdrst_in      = "restart_mld"   ! suffix of ocean restart name (input)
+   cn_trdrst_out     = "restart_mld"   ! suffix of ocean restart name (output)
+   ln_trdmld_restart = .false.         !  restart for ML diagnostics
+   ln_trdmld_instant = .false.         !  flag to diagnose trends of instantantaneous or mean ML T/S
+/
+!-----------------------------------------------------------------------
+&namflo       !   float parameters                                      ("key_float")
+!-----------------------------------------------------------------------
+   ln_rstflo  = .false.    !  float restart (T) or not (F)
+   nn_writefl =      75    !  frequency of writing in float output file 
+   nn_stockfl =    5475    !  frequency of creation of the float restart file 
+   ln_argo    = .false.    !  Argo type floats (stay at the surface each 10 days)
+   ln_flork4  = .false.    !  trajectories computed with a 4th order Runge-Kutta (T)
+                           !  or computed with Blanke' scheme (F)
+/
+!-----------------------------------------------------------------------
+&namptr       !   Poleward Transport Diagnostic
+!-----------------------------------------------------------------------
+   ln_diaptr  = .false.    !  Poleward heat and salt transport (T) or not (F)
+   ln_diaznl  = .true.     !  Add zonal means and meridional stream functions
+   ln_subbas  = .true.     !  Atlantic/Pacific/Indian basins computation (T) or not 
+                           !  (orca configuration only, need input basins mask file named "subbasins.nc"
+   ln_ptrcomp = .true.     !  Add decomposition : overturning
+   nn_fptr    =  1         !  Frequency of ptr computation [time step]
+   nn_fwri    =  15        !  Frequency of ptr outputs [time step]
+/
+!-----------------------------------------------------------------------
+&namhsb       !  Heat and salt budgets 
+!-----------------------------------------------------------------------
+   ln_diahsb  = .false.    !  check the heat and salt budgets (T) or not (F)
+/
+
+!!======================================================================
+!!            ***  Observation & Assimilation namelists ***
+!!======================================================================
+!!   namobs       observation and model comparison                      ('key_diaobs')
+!!   nam_asminc   assimilation increments                               ('key_asminc')
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namobs       !  observation usage switch                               ('key_diaobs')
+!-----------------------------------------------------------------------
+   ln_t3d     = .false.    ! Logical switch for T profile observations         
+   ln_s3d     = .false.    ! Logical switch for S profile observations          
+   ln_ena     = .false.    ! Logical switch for ENACT insitu data set           
+   !                       !     ln_cor                  Logical switch for Coriolis insitu data set       
+   ln_profb   = .false.    ! Logical switch for feedback insitu data set     
+   ln_sla     = .false.    ! Logical switch for SLA observations               
+
+   ln_sladt   = .false.    ! Logical switch for AVISO SLA data              
+
+   ln_slafb   = .false.    ! Logical switch for feedback SLA data            
+                           !     ln_ssh                  Logical switch for SSH observations              
+
+   ln_sst     = .false.    ! Logical switch for SST observations              
+                           !     ln_reysst               Logical switch for Reynolds observations       
+                           !     ln_ghrsst               Logical switch for GHRSST observations          
+
+   ln_sstfb   = .false.    ! Logical switch for feedback SST data          
+                           !     ln_sss                  Logical switch for SSS observations              
+                           !     ln_seaice               Logical switch for Sea Ice observations        
+                           !     ln_vel3d                Logical switch for velocity observations         
+                           !     ln_velavcur             Logical switch for velocity daily av. cur.    
+                           !     ln_velhrcur             Logical switch for velocity high freq. cur.   
+                           !     ln_velavadcp            Logical switch for velocity daily av. ADCP  
+                           !     ln_velhradcp            Logical switch for velocity high freq. ADCP
+                           !     ln_velfb                Logical switch for feedback velocity data       
+                           !     ln_grid_global          Global distribtion of observations         
+                           !     ln_grid_search_lookup   Logical switch for obs grid search w/lookup table  
+                           !     grid_search_file        Grid search lookup file header 
+                           !     enactfiles              ENACT input observation file names 
+                           !     coriofiles              Coriolis input observation file name  
+   !                       ! profbfiles: Profile feedback input observation file name 
+   profbfiles = 'profiles_01.nc'
+                           !     ln_profb_enatim         Enact feedback input time setting switch    
+                           !     slafilesact             Active SLA input observation file name
+                           !     slafilespas             Passive SLA input observation file name 
+   !                       ! slafbfiles: Feedback SLA input observation file name 
+   slafbfiles = 'sla_01.nc'
+                           !     sstfiles                GHRSST input observation file name       
+   !                       ! sstfbfiles: Feedback SST input observation file name 
+   sstfbfiles = 'sst_01.nc' 'sst_02.nc' 'sst_03.nc' 'sst_04.nc' 'sst_05.nc'
+                           !     seaicefiles             Sea Ice input observation file name 
+                           !     velavcurfiles           Vel. cur. daily av. input file name  
+                           !     velhvcurfiles           Vel. cur. high freq. input file name  
+                           !     velavadcpfiles          Vel. ADCP daily av. input file name    
+                           !     velhvadcpfiles          Vel. ADCP high freq. input file name 
+                           !     velfbfiles              Vel. feedback input observation file name 
+                           !     dobsini                 Initial date in window YYYYMMDD.HHMMSS       
+                           !     dobsend                 Final date in window YYYYMMDD.HHMMSS         
+                           !     n1dint                  Type of vertical interpolation method        
+                           !     n2dint                  Type of horizontal interpolation method       
+                           !     ln_nea                  Rejection of observations near land switch    
+   nmsshc     = 0          ! MSSH correction scheme                         
+                           !     mdtcorr                 MDT  correction                               
+                           !     mdtcutoff               MDT cutoff for computed correction          
+   ln_altbias = .false.    ! Logical switch for alt bias                
+   ln_ignmis  = .true.     ! Logical switch for ignoring missing files   
+                           !     endailyavtypes   ENACT daily average types                    
+   ln_grid_global = .true.
+   ln_grid_search_lookup = .false.
+/ 
+!-----------------------------------------------------------------------
+&nam_asminc   !   assimilation increments                               ('key_asminc')
+!-----------------------------------------------------------------------
+    ln_bkgwri = .false.    !  Logical switch for writing out background state 
+    ln_trjwri = .false.    !  Logical switch for writing out state trajectory
+    ln_trainc = .false.    !  Logical switch for applying tracer increments
+    ln_dyninc = .false.    !  Logical switch for applying velocity increments
+    ln_sshinc = .false.    !  Logical switch for applying SSH increments 
+    ln_asmdin = .false.    !  Logical switch for Direct Initialization (DI)
+    ln_asmiau = .false.    !  Logical switch for Incremental Analysis Updating (IAU)
+    nitbkg    = 0          !  Timestep of background in [0,nitend-nit000-1]
+    nitdin    = 0          !  Timestep of background for DI in [0,nitend-nit000-1]
+    nitiaustr = 1          !  Timestep of start of IAU interval in [0,nitend-nit000-1]
+    nitiaufin = 15         !  Timestep of end of IAU interval in [0,nitend-nit000-1]
+    niaufn    = 0          !  Type of IAU weighting function
+    nittrjfrq = 0          !  Frequency of trajectory output for 4D-VAR
+    ln_salfix = .false.    !  Logical switch for ensuring that the sa > salfixmin
+    salfixmin = -9999      !  Minimum salinity after applying the increments
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/1_namelist_ice_lim2
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/1_namelist_ice_lim2	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/1_namelist_ice_lim2	(revision 3680)
@@ -0,0 +1,138 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/LIM2 :  1 - dynamics/advection/thermo          (namicerun)
+!! namelists    2 - ice intialisation                  (namiceini)
+!!              3 - ice dynamic                        (namicedyn)
+!!              5 - ice advection                      (namicetrp)
+!!              6 - thermodynamic                      (namicethd)
+!!              7 - ice salinity                       (namicesal)
+!!              8 - mechanical redistribution of ice   (namiceitdme)
+!!              3 - ice diagnostics                    (namicedia)
+!!              9 - ice outputs                        (namiceout)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+!-----------------------------------------------------------------------
+&namicerun     !   Share parameters for dynamics/advection/thermo
+!-----------------------------------------------------------------------
+   cn_icerst_in  = "restart_ice_in"   !  suffix of ice restart name (input)
+   cn_icerst_out = "restart_ice"      !  suffix of ice restart name (output)
+   ln_limdyn   = .true.    !  ice dynamics (T) or thermodynamics only (F)
+   ln_limdmp   = .false.   !  restoring ice thickness and fraction leads (T) or not (F)
+   acrit       = 1.0e-06   , 1.0e-06   ! minimum fraction for leads in the Northern (Southern) Hemisphere
+   hsndif      =  0.0      !  computation of temperature in snow (=0.0) or not
+   hicdif      =  0.0      !  computation of temperature in ice  (=0.0) or not (=9999.0)
+/
+!-----------------------------------------------------------------------
+&namiceini     !   ice initialisation
+!-----------------------------------------------------------------------
+   ln_limini   = .false.   !  read the ice initial state in the file 'Ice_initialization.nc' (T) or not (F)
+   ttest       =  2.0      !  threshold water temperature for initial sea ice
+   hninn       =  0.5      !  initial snow thickness in the north
+   hginn       =  3.0      !  initial ice  thickness in the north
+   alinn       =  0.05     !  initial leads area     in the north
+   hnins       =  0.1      !  same  three parameter  in the south
+   hgins       =  1.0      !        "                 "     south   
+   alins       =  0.1      !        "                 "     south
+/
+!-----------------------------------------------------------------------
+&namicedyn     !   ice dynamic
+!-----------------------------------------------------------------------
+   epsd        =   1.0e-20 !  tolerance parameter
+   alpha       =   0.5     !  coefficient for semi-implicit coriolis
+   dm          =   0.6e+03 !  diffusion constant for dynamics
+   nbiter      =   1       !  number of sub-time steps for relaxation
+   nbitdr      = 100       !  maximum number of iterations for relaxation
+   om          =   0.5     !  relaxation constant 
+   resl        =   5.0e-05 !  maximum value for the residual of relaxation
+   cw          =   5.0e-03 !  drag coefficient for oceanic stress
+   angvg       =   0.0     !  turning angle for oceanic stress
+   pstar       =   1.0e+04 !  1st bulk-rheology parameter
+   c_rhg       =  20.0     !  2nd bulk-rhelogy parameter
+   etamn       =   0.0e+07 !  minimun value for viscosity
+   creepl      =   2.0e-08 !  creep limit
+   ecc         =   2.0     !  eccentricity of the elliptical yield curve
+   ahi0        = 350.e0    !  horizontal eddy diffusivity coefficient for sea-ice [m2/s]
+   nevp        =   360     !  number of EVP subcycling iterations
+   telast      =   3600    !  timescale for EVP elastic waves
+   alphaevp    =   1.0     !  coefficient for the solution of EVP int. stresses
+/
+!-----------------------------------------------------------------------
+&namicetrp     !   ice transport
+!-----------------------------------------------------------------------
+   bound       =   0.      !  boundary conditions (=0.0 no-slip, =1.0 free-slip)
+/
+!-----------------------------------------------------------------------
+&namicethd     !   ice thermodynamic
+!-----------------------------------------------------------------------
+!  hmelt       : maximum melting at the bottom
+!  hiccrit(1/2): ice thickness for lateral accretion in the Northern (Southern) Hemisphere
+!                caution 1.0, 1.0 best value to be used!!! (gilles G.)
+!  hicmin      : ice thickness corr. to max. energy stored in brine pocket
+!  hiclim      : minimum ice thickness
+!  amax        : maximum lead fraction
+!  swiqst      : energy stored in brine pocket (=1) or not (=0)	
+!  sbeta       : numerical caracteritic of the scheme for diffusion in ice
+!               Cranck-Nicholson (=0.5), implicit (=1), explicit (=0)
+!  parlat      : percentage of energy used for lateral ablation
+!  hakspl      : slope of distr. for Hakkinen-Mellor's lateral melting
+!  hibspl      : slope of distribution for Hibler's lateral melting
+!  exld        : exponent for leads-closure rate
+!  hakdif      : coefficient for diffusions of ice and snow
+!  thth         : threshold thickness for comp. of eq. thermal conductivity
+!  hnzst       : thickness of the surf. layer in temp. computation
+!  parsub      : switch for snow sublimation or not
+!  alphs       : coefficient for snow density when snow ice formation
+! 
+&namicethd
+   hmelt       = -0.15     !  maximum melting at the bottom
+   hiccrit     = 0.3 , 0.3 !  ice thickness for lateral accretion in the Northern (Southern) Hemisphere
+   hicmin      = 0.2       !  ice thickness corr. to max. energy stored in brine pocket
+   hiclim      = 0.05      !  minimum ice thickness
+   amax        = 0.999     !  maximum lead fraction
+   swiqst      = 1.        !  energy stored in brine pocket (=1) or not (=0)	
+   sbeta       = 1.        !  numerical caracteritic of the scheme for diffusion in ice
+                           !        Cranck-Nicholson (=0.5), implicit (=1), explicit (=0)
+   parlat      = 0.0       !  percentage of energy used for lateral ablation
+   hakspl      = 0.5       !  slope of distr. for Hakkinen-Mellor's lateral melting
+   hibspl      = 0.5       !  slope of distribution for Hibler's lateral melting
+   exld        = 2.0       !  exponent for leads-closure rate
+   hakdif      = 1.0       !  coefficient for diffusions of ice and snow
+   thth        = 0.2       !  threshold thickness for comp. of eq. thermal conductivity
+   hnzst       = 0.1       !  thickness of the surf. layer in temp. computation
+   parsub      = 1.0       !  switch for snow sublimation or not
+   alphs       = 1.0       !  coefficient for snow density when snow ice formation
+/
+!-----------------------------------------------------------------------
+&namicedia     !   ice diagnostics
+!-----------------------------------------------------------------------
+   fmtinf      ='1PE13.5 ' !  format of the output values
+   nfrinf      = 4         !  number of variables written in one line
+   ntmoy       = 1         !  instantaneous values of ice evolution or averaging
+   ninfo       = 1         !  frequency of ouputs on file ice_evolu in case of averaging
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namiceout     !   parameters for outputs
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   noumef      =   19      !  number of fields
+!
+!           !         title of the field           !  name     !   units   !  save  ! multipl. ! additive !
+!           !                                      !           !           ! or not !  factor  !  factor  !
+   field_1  = 'Snow thickness                     ', 'isnowthi', 'm       ',    1   ,  1.0     ,    0.0
+   field_2  = 'Ice thickness                      ', 'iicethic', 'm       ',    1   ,  1.0     ,    0.0
+   field_3  = 'Ice produced                       ', 'iiceprod', 'm/kt    ',    1   ,  1.0     ,    0.0
+   field_4  = 'Ice concentration                  ', 'ileadfra', '%       ',    1   , -1.0     ,    1.0
+   field_5  = 'Ice temperature                    ', 'iicetemp', 'C       ',    1   ,  1.0     , -273.15
+   field_6  = 'Oceanic flux at the ice base       ', 'ioceflxb', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_7  = 'Ice velocity u                     ', 'iicevelu', 'm/s     ',    1   ,  1.0     ,    0.0
+   field_8  = 'Ice velocity v                     ', 'iicevelv', 'm/s     ',    1   ,  1.0     ,    0.0
+   field_9  = 'Sea surface temperature            ', 'isstempe', 'C       ',    1   ,  1.0     , -273.15
+   field_10 = 'Sea surface salinity               ', 'isssalin', 'PSU     ',    1   ,  1.0     ,    0.0
+   field_11 = 'Total flux at ocean surface        ', 'iocetflx', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_12 = 'Solar flux at ocean surface        ', 'iocesflx', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_13 = 'Non-solar flux at ocean surface    ', 'iocwnsfl', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_14 = 'Salt flux at ocean surface         ', 'iocesafl', 'kg/m2/kt',    1   ,  1.0     ,    0.0
+   field_15 = 'Wind stress u                      ', 'iocestru', 'Pa      ',    1   ,  1.0     ,    0.0
+   field_16 = 'Wind stress v                      ', 'iocestrv', 'Pa      ',    1   ,  1.0     ,    0.0 
+   field_17 = 'Solar flux at ice/ocean surface    ', 'iicesflx', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_18 = 'Non-solar flux at ice/ocean surface', 'iicenflx', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_19 = 'Snow precipitation                 ', 'isnowpre', 'kg/day  ',    1   ,  1.0     ,    0.0
+/      
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/AGRIF_FixedGrids.in
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/AGRIF_FixedGrids.in	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/AGRIF_FixedGrids.in	(revision 3680)
@@ -0,0 +1,3 @@
+1
+125 170 36 63 4 4 2
+0
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/CO2.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/CO2.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/CO2.nml	(revision 3680)
@@ -0,0 +1,97 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! ROUTINE: CO2
+!
+! DESCRIPTION
+!   List of parameters values
+!
+! INTERFACE
+! parameter values for mem_CO2 filled by InitCO2
+!
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2007 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+
+&CO2_parameters
+! Initial CO2 concentration in the air [ppm]
+   AtmCO20 = 370.0E0
+! Compute the partial pressure of Atmospheric CO2
+   calcAtmpCO2 = .FALSE.
+   pCO2Method = 1  ! 1=MixRatio*slp, 2=Magnus formula 
+!-----------------------------------------------------------------------------------!
+! Read external data for atmospheric CO2 values  
+          ! Read  !   File   ! NetCDF  !  Var    !  RefTime   ! Input      !   Time   !
+          ! Input !   name   ! Logical !  name   !  yyyymmdd  ! Frequency  !  interp  !
+!AtmCO2_N =    2  , 'CMIP5_Historical_GHG_1765_2005.nc' , .TRUE.  , 'CO2'   , '1764-07-01 00:00' ,  'yearly'  ,  .TRUE.  
+!AtmCO2_N =    2  , 'CMIP5_Historical_GHG_1765_2005.dat' , .FALSE.  , 'CO2'   , '1764-07-01 00:00' ,  'yearly'  ,  .TRUE.  
+! Read external data for atmospheric SLP 
+AtmSLP_N  =    0  , 'AtmSLP.nc' , .TRUE.  ,'AtmSLP' , '1764-07-01 00:00'  , 'dummy' ,  .TRUE.  
+AtmTDP_N  =    0  , 'AtmTDP.nc' , .TRUE.  ,'AtmTDP' , '1764-07-01 00:00'  , 'dummy' ,  .TRUE.  
+!-----------------------------------------------------------------------------------!
+
+! Initial pH value
+   phstart = 8.10E0
+
+! Choice of the acidity constants parameterization
+! K1K2==1 Roy et al. (1993); DOE (1994); pH on total scale
+! K1K2==2 Default
+!         Mehrbach et al (1973) refit by Dickson & Millero (1987)
+!         OCMIP STANDARD; pH on Sea Water Scale
+! K1K2==3 Mehrbach et al (1973) refit by Lueker et al. (2000)
+!         pH on total scale
+! K1K2==4 Hansson (1973b) data as refitted by Dickson and 
+!         Millero (1987); pH on Sea Water Scale
+   K1K2 = 2
+
+! Choice of [H+] numerical computation
+! MethodCalcCO2=1 Approximate static solution
+! MethodCalcCO2=2 Default. Standard OCMIP iteration
+! MethodCalcCO2=3 Follows et al., Ocean Modelling 2006
+!
+! Parameters for MethodCalcCO2=2
+! M2XACC    :  accuracy of the iterative scheme for OCMIP (default 1.E-10)
+! M2PHDELT  :  delta of pH for the root search (realized pH+/-DELT)
+!              in the OCMIP scheme (default 0.5)
+! M2MAXIT   :  maximum number of iterations for OCMIP (default 100 )
+!
+   MethodCalcCO2 = 2
+          M2XACC = 1.0E-10
+        M2PHDELT = 0.3
+         M2MAXIT = 100
+!
+! Calcium ion concentration
+!     [from : "Seawater : Its composition, properties and behaviour"
+!      (2nd Edition), Open University Course Team, 1995]
+!     seawater concentration    = 412 mg / l
+!     atomic weight             = 40.078 g / mol
+!     therefore, concentration  = 10.279 mmol / l
+!                               = 10.279 mol / m3
+        Caconc0 = 10.279E0
+! Normalize Calcium ion concentration by sea water salinity
+        Canorm  = .TRUE.
+/
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/LightAdaptation.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/LightAdaptation.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/LightAdaptation.nml	(revision 3680)
@@ -0,0 +1,55 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: LightAdaptation
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_LightAdaptation filled by InitLightAdaptation
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!  p_isw:  	 Switch between parameterizations
+!  p_chEPLi:  	 Maximum Iopt (W/m2)
+!        :  	    p_clEPLi    =      4.0,    6.0,    5.0,    8.0	# Minimum Iopt (W/m2)
+!  p_clEPLi:  	 Minimum Iopt (W/m2)
+!        :  	    p_ruEPLi    =      0.25,    0.25,   0.5,    0.125	# Maximum daily shift in Iopt (1/d)
+!  p_ruEPLi:  	 Maximum daily shift in Iopt (1/d)
+!  p_addepth:  	 Adaptation depth. Meaningless with high-res models
+
+&LightAdaptation_parameters
+      p_isw = 	1,	1,	1,	1
+  p_addepth = 	50.0,	50.0,	50.0,	50.0
+  p_chEPLi  = 	100.0,	100.0,	100.0,	100.0
+  p_clEPLi  = 	8.0,	10.0,	6.0,	12.0
+  p_ruEPLi  = 	0.2,	0.25,	0.3,	0.15
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/MesoZoo.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/MesoZoo.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/MesoZoo.nml	(revision 3680)
@@ -0,0 +1,86 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: MesoZoo
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_MesoZoo filled by InitMesoZoo
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!        :
+!        :  	 The variable Z3 represents carnivorous mesozooplankton and Z4 represents
+!        :  	 omnivorous mesozooplankton.
+!        :
+!  p_q10:  	 Doubling temperature
+!  p_srs:  	 Respiration rate at 10 degrees C
+!  p_sum:  	 Maximal productivity at 10 degrees C
+!  p_sd:  	 Background natural mortality
+!  p_vum:  	 Specific search volume
+!  p_puI_u:  	 Assimilation efficiency
+!  p_peI_R6:  	 Faeces production
+!  p_sdo:  	 Fractional density-dependent mortality
+!  p_sds:  	 Exponent of density-dependent mortality
+!  p_qpc:  	 Quotum phosphate
+!  p_qnc:  	 Quotum nitrate
+
+&MesoZoo_parameters
+!		Z3	Z4
+       p_q10 =	2.0,	2.0
+       p_srs =	0.01,	0.02
+        p_sd = 	0.01,	0.01
+       p_sum = 	1.6,	2.0
+       p_vum = 	0.016,	0.008
+     p_puI_u = 	0.8,	0.6
+    p_peI_R6 = 	0.2,	0.4
+       p_sdo = 	4.d-4,	4.d-4
+       p_sds = 	2.0,	2.0
+       p_qpc = 	1.67d-3,1.67d-3
+       p_qnc = 	0.015,	0.015
+     p_clO2o = 	30.0,	30.0
+!		P1	P2	P3	P4
+!	Z3
+ p_puPI(1,:) =	0.0,	0.0,	0.0,	0.0
+!	Z4
+ p_puPI(2,:) =	1.0,	0.25,	0.0,	0.0
+!		Z5	Z6
+!	Z3
+p_puMIZ(1,:) =	0.0,	0.0
+!	Z4
+p_puMIZ(2,:)=	1.0,	0.0,
+!		Z3	Z4
+!	Z3
+p_puMEZ(1,:)=	1.0,	1.0
+!	Z4
+p_puMEZ(2,:)=	0.0,	1.0
+
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/MicroZoo.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/MicroZoo.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/MicroZoo.nml	(revision 3680)
@@ -0,0 +1,93 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: MicroZoo
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_MicroZoo filled by InitMicroZoo
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!        :
+!        :  	 The variable Z5 represents microozooplankton and Z6 represents
+!        :  	 heterotrophic nanoflagellates (HNAN)
+!        :
+!  p_q10:  	 Q10 value
+!  p_srs:  	 Respiration rate at 10 degrees Celsius
+!  p_sum:  	 Max. rel daily uptake as a fraction of biomass
+!  p_sdo:  	 Mortality due to oxygen limitation
+!  p_sd:  	 Temperature independent mortality
+!  p_pu_ra:  	 Activity respiration
+!  p_pu_ea:  	 Activity excretion
+!  p_chro:  	 Oxygen saturation where respiration is 0.5
+!  p_chuc:  	 Food concentration where total uptake rate is 0.5
+!  p_minfood:  	 Concentration below which feeding on a particular
+!        :  	 foodsource is depressed
+!  p_qn_mz:  	 Maximum quotum P
+!  p_qp_mz:  	 Maximum quotum N
+!  p_suPI(P1):  	 /day   #relative P1 uptake by zoo
+!  p_suPI(P2):  	 /day   #relative P2 uptake by zoo
+!  p_suPI(P3):  	 /day   #relative P3 uptake by zoo
+!  p_suPI(P4):  	 /day   #relative P4 uptake by zoo
+!  p_suZI(Z5):  	 /day   #relative Z5 uptake by zoo
+!  p_suZI(Z6):  	 /day   #relative Z6 uptake by zoo
+!  p_suB1:  	 /day   #relative B1 uptake by zoo
+
+!       	Z5	Z6
+&MicroZoo_parameters
+       p_q10 = 	2.0,	2.0
+       p_srs = 	0.02,	0.02
+       p_sum = 	2.0,	10.0
+       p_sdo = 	0.05,	0.05
+        p_sd = 	0.0,	0.0
+     p_pu_ra = 	0.25,	0.35
+     p_pu_ea = 	0.25,	0.35
+      p_chro = 	7.8,	7.8
+      p_chuc = 	30.0,	100.0
+   p_minfood = 	10.0,	50.0
+     p_qp_mz = 	1.85d-3,1.85d-3
+     p_qn_mz = 	1.67d-2,1.67d-2
+! Food matrix parameters: take care of the notation
+!		P1	P2	P3	P4
+!	Z5
+ p_suPI(1,:) =	0.0,	1.0,	0.1,	0.0
+!	Z6
+ p_suPI(2,:) =	0.0,	0.2,	1.0,	0.0
+!		Z5	Z6
+!	Z5
+ p_suZI(1,:) = 	1.0,	1.0
+!	Z6
+ p_suZI(2,:) = 	0.0,	0.2
+!		Z5	Z6
+      p_suB1 = 	0.1,	1.0
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/Param.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/Param.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/Param.nml	(revision 3680)
@@ -0,0 +1,128 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: Param
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_Param filled by InitParam
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+&Param_parameters
+                    p_small = 1.0e-20
+                  p_q10diff = 1.49
+                      p_qro = 0.5
+               p_qon_dentri = 1.25
+                p_qon_nitri = 2.0
+                    p_clDxm = 0.001
+       CalcConservationFlag = .FALSE.
+          CalcTransportFlag = .TRUE.
+            CalcPelagicFlag = .TRUE.
+            CalcBenthicFlag = 0
+                    p_poro0 = 0.7 
+       CalcPhytoPlankton(1) = .TRUE.
+       CalcPhytoPlankton(2) = .TRUE.
+       CalcPhytoPlankton(3) = .TRUE.
+       CalcPhytoPlankton(4) = .FALSE.
+               CalcBacteria = .TRUE.
+     CalcMesoZooPlankton(1) = .TRUE.
+     CalcMesoZooPlankton(2) = .TRUE.
+    CalcMicroZooPlankton(1) = .TRUE.
+    CalcMicroZooPlankton(2) = .TRUE.
+           CalcPelChemistry = .TRUE.
+AssignPelBenFluxesInBFMFlag = .TRUE.
+AssignAirPelFluxesInBFMFlag = .TRUE.
+                      p_PAR = 0.40
+                       slp0 = 1013.25E0
+               ChlLightFlag = 2
+           ChlSynthesisFlag = 1
+        ProductionLightFlag = 1
+          LightLocationFlag = 3
+                     p_eps0 = 0.0435
+                   p_epsESS = 0.04d-3
+                 p_InitSink = 100.0
+                    p_d_tot = 0.30
+                  p_d_tot_2 = 0.35
+                  p_clD1D2m = 0.01
+                   p_pe_R1c = 0.60
+                   p_pe_R1n = 0.72
+                   p_pe_R1p = 0.832
+                   p_pe_R1s = 0.06
+                  p_epsChla = 3.0d-2
+                    p_epsR6 = 0.1d-3
+          check_fixed_quota = 0
+!				P1	P2	P3	P4
+                    p_qchlc = 	0.025,	0.015,	0.02,	0.02
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!  p_q10diff:  	 Temperature-dependency porewater diffusion
+!  p_qro:  	 stoichiometry O2-->S2-
+!  p_qon_dentri:  	 stoichiometry O2-->N denitrification
+!  p_qon_nitri:  	 stoichiometry O2-->N nitrification
+!  p_clDxm:  	 minimal value of D?.m for calculation of the alpha
+!        :  	 alpha is used in expo.func and values > 1/0.001 leadt
+!  CalcPelagicFlag:  	 Switch for pelagic system
+!  CalcBenthicFlag:  	 Switch for benthic system
+!  CalcTransportFlag:    Switch for transport
+!  CalcConservationFlag:    Switch for mass conservation check
+!  CalcPhytoPlankton:  	 Switches to turn on/off the calculation of pelagic groups
+!  CalcBacteria:
+!  CalcMesoZooPlankton:
+!  CalcMicroZooPlankton:
+!  CalcPelChemistry:
+!  CalcBenOrganisms:  	 Switches to turn on/off the calculation of benthic organisms
+!  CalcBenBacteria:
+!  AssignPelBenFluxesInBFMFlag:  	 Switches to make choice to define boundary
+!  AssignAirPelFluxesInBFMFlag:  	 fluxes in physical of biological model
+!        :  	     dim2D%
+!  p_PAR:  	 Photosynthetically available radiation
+!  ChlLightFlag:  	 Switch between light prop.(=1) or Chla.(=2) as a state
+!  ChlSynthesisFlag:  	 Switch between types of chl synthesis
+!                        1. PELAGOS; 2. OPATM-BFM; 3. UNIBO
+!  ProductionLightFlag:  Switch between instantaneous light production (=1) 
+!                        and daylength averaged production (=2)
+!  LightLocationFlag:    Switch between different depth-parameterizations
+!  p_qchlc(PhytoPlankton):  Fixed/Maximum quotum Chla:C dependent on 
+!                           ChlLightFlag [mg Chla (mg C)-1]
+!                           p_qchlc%   0.05, 0.03,  0.07,  0.02
+!  p_eps0:  	 Background extinction (abiotic)
+!  p_epsESS:  	 Inorg. suspended matter extinction coeff. (abiotic)
+!  p_InitSink:   parameter to Initialize BenthicSInk var.
+!  p_d_tot:  	 m # Max Thickness of the denitrification layer
+!  p_d_tot_2:  	 m # Thickness of modelled benthic sediment layers
+!  p_clD1D2m:  	 m # minimum distancebetween D1m and D2m
+!  p_pe_R1c:  	 Fraction of excretion going to PLOC
+!  p_pe_R1n:  	 Fraction of excretion going to PLOC
+!  p_pe_R1p:  	 Fraction of excretion going to PLOC
+!  p_epsChla:  	 Chla-contribution to extinction
+!  p_epsR6:  	 (m2/mgC) # Detritus-contribution to extinction
+!  check_fixed_quota       Check whether zooplankton have fixed quota
+!  p_poro0:      Constant porosity for 0D and 1D runs
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/PelBac.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/PelBac.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/PelBac.nml	(revision 3680)
@@ -0,0 +1,84 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: PelBac
+!
+! DESCRIPTION
+!   List of parameters values
+!
+! !AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2008 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!  p_version:  	 Switch for DOM uptake parameterization
+!        :  	 p_version=1 Polimene et al., 2006
+!        :  	 p_version=2 <BFM> standard version
+!  p_q10:  	 Q10-value (temperature dependency)
+!  p_chdo:  	 Michaelis const for O2 dependence (mmol/m3)
+!  p_sd:  	 Independent specific mortality (1/d)
+!  p_sd2:  	 Density dependent mortality (value: 0.009) (1/d)
+!  p_suR1:  	 Specific potential DOM availability (1/d)
+!  p_suR2:  	 Specific potential DOM availability (1/d)
+!  p_suR6:  	 Availability of POM (1/d)
+!  p_sum:  	 Specific potential uptake (1/d)
+!  p_pu_ra:  	 Activity respiration (-)
+!  p_pu_ra_o:  	 Decrease in Ass. efficiency at low O2 conc (-).
+!  p_srs:  	 Specific rest respiration (1/day)
+!  p_qnc:  	 Optimal N/C ratio (model units) 45:9:1
+!  p_qpc:  	 Optimal P/C ratio (model units) C:N:P
+!  p_qlnc:  	 Minimal N/C ratio (model units) 45:9:1 <BFM>
+!  p_qlpc:  	 Minimal P/C ratio (model units) C:N:P (BFM>
+!  p_qun:  	 nutrient affinity ( mmol/mgC/day) <BFM>
+!  p_qup:  	 nutrient affinity ( mmol/mgC/day) <BFM>
+!  p_lN4:  	 ammonium conc. at which nutrate uptake are equal (BFM)
+!  p_pu_ea_R7:   excretion of reg. org. met. (-) <POLIMENE>
+
+&PelBac_parameters
+  p_version = 2
+      p_q10 = 2.95
+     p_chdo = 30.0
+       p_sd = 0.0
+      p_sd2 = 0.009
+    p_suhR1 = 0.5
+    p_sulR1 = 0.25
+     p_suR2 = 0.05
+     p_suR6 = 0.02
+      p_sum = 8.4
+    p_pu_ra = 0.6
+  p_pu_ra_o = 0.2
+ p_pu_ea_R7 = 0.015
+      p_srs = 0.01
+      p_qpc = 1.9d-3
+    p_qlpc  = 9.5d-4
+      p_qnc = 1.2d-2
+     p_qlnc = 6.0d-3
+      p_qun = 0.050
+      p_qup = 0.0050,
+      p_lN4 = 0.05
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!EOP
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/PelChem.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/PelChem.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/PelChem.nml	(revision 3680)
@@ -0,0 +1,56 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: PelChem
+!
+! DESCRIPTION
+!   List of parameter values for peagic chemistry
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+&PelChem_parameters
+    p_sN4N3 = 0.01
+  p_q10N4N3 = 2.367
+  p_q10R6N5 = 1.49
+      p_rOS = 0.05
+    p_clO2o = 10.0
+    p_clN6r = 1.0
+   p_sN3O4n = 0.35
+     p_rPAo = 1.0
+    p_sR6N5 = 0.02
+/
+
+&PelChem_parameters_iron
+  p_q10R6N7 = 1.50
+    p_sR6N7 = 1.0e-03
+  p_scavN7f = 0.7e-04
+   p_N7fsol = 0.6
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/PelGlobal.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/PelGlobal.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/PelGlobal.nml	(revision 3680)
@@ -0,0 +1,48 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! ROUTINE: PelGlobal
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_PelGlobal filled by InitPelGlobal
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!  p_rR6m:  	 m/d   # detritus sinking rate
+!  p_rPIm:  	 m/d   # phytoplankton background sinking rate
+
+&PelGlobal_parameters
+  p_rR6m = 10.0
+!		P1	P2	P3	P4
+  p_rPIm = 	0.0, 	0.0, 	0.0, 	0.0
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/PhotoAvailableRadiation.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/PhotoAvailableRadiation.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/PhotoAvailableRadiation.nml	(revision 3680)
@@ -0,0 +1,46 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: PhotoAvailableRadiation
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_PhotoAvailableRadiation filled by InitPhotoAvailableRadiation
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, the mfstep group, the ERSEM team 
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!  p_iswLtyp:  	 Shape of the productivity function
+
+&PAR_parameters
+!		P1	P2	P3	P4
+  p_iswLtyp = 	5,	5,	5,	5
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/Phyto.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/Phyto.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/Phyto.nml	(revision 3680)
@@ -0,0 +1,126 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: Phyto
+!
+! DESCRIPTION
+!   List of parameter values
+!   for mem_Phyto filled by InitPhyto
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   Copyright (C) 2008 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!        :
+!        :  	 ---------------- Physiological parameters -----------------
+!        :
+!  p_q10:  	 Doubling temperature
+!  p_sum:  	 Maximal productivity at 10 degrees C
+!  p_srs:  	 Respiration rate at 10 degrees C
+!  p_sdmo:  	 Max.specific nutrient-stress lysis rate
+!  p_thdo:  	 Half value for nutrient stress lysis
+!  p_seo:  	 Extra lysis rate for high density cells
+!  p_sheo:  	 Half value for density stress lysis
+!  p_pu_ea:  	 Fraction of pp excreted as PLOC/PDET
+!  p_pu_ra:  	 Activity respiration rate
+!        
+!         	 ---------------- Nutrient parameters in phytoplankton -----------------
+!       
+!  p_netgrowth:  logical switch for nutrient-limited growth (true is default)
+!  p_limnut:  	 switch for nut. limitation (Liebig is default)
+!  p_chPs:  	 half-value of SIO4-lim (mmol Si m-3)
+!  p_qslc:  	 Minimum quotum Si in PI
+!  p_qsRc:  	 Reference quotum Si in PI
+!  p_qus:  	 affinity of PI for Si
+!  p_alpha_chl:  	 Initial slope P-I curve
+!      
+!       	 ------------- Chlorophyll parameters -----------
+!       	 skel: Skeletonema costatum pav: Pavlova lutheri
+!       	 syn: Synechoccus sp. (significant alpha decrease with irradiance)
+!       	 gyr: Gyrodinium sp. iso: Isochrysis galbana
+!       	             skel     iso      syn      gyr
+!  p_sdchl:  	 Specific turnover rate for Chla (d-1)
+!       	p_qchlc =    0.03,    0.025,   0.1,     0.02    # Maximum quotum Chla:C
+!       	            +-0.024  +-0.001  +-0.003  +-0.004
+!       	 Thalassiosira sp. (0.05+-0.01)
+!       	             skel     pav      syn      gyr
+!  p_esNI:  	 Nutrient stress threshold for Sinking
+!       	p_alpha_chl = 1.0d-5, 0.46d-5*2.0, 2.0d-5, 0.68d-5 # Initial slope P-I curve
+!       	 Thalassiosira sp. (0.48-0.63)
+!  p_res:  	Maximum Sinking velocity (m/d)
+!  p_qchlc  = 0.05,      0.03,      0.07,      0.02 # Maximum quotum Chla:C
+!       	 ------------- silicate limitation control: -----------
+!             p_qus > 0.0  : silica limitation is controlled by internal quoata
+!             if p_qus\=0  : simple MM limitation on external concentration
+!                            p_chPs must have a number or an error is generated!
+!                ------------- Iron parameters -----------
+!                conc.=[umol/m3] ratio=[umol Fe/mg C]
+!  p_qflc:       min Fe:C ratio derived from 3 umol Fe/mol C
+!                Sunda & Huntsman (1997), Nature, 390, p 389-392
+
+!               P1	P2	P3	P4
+&Phyto_parameters
+     p_limnut = 1,	1,	1,	1
+  p_netgrowth = .FALSE.,.FALSE.,.FALSE.,.FALSE.
+        p_q10 = 2.0,	2.0,	2.0,	2.0
+        p_sum = 2.0,	2.5,	3.0,	0.5
+        p_srs = 0.01,	0.05,	0.1,	0.1
+       p_sdmo = 0.05,	0.05,	0.05,	0.0
+        p_seo = 0.0,	0.0,	0.0,	0.0
+       p_sheo = 0.0,	0.0,	0.0,	100.0
+      p_pu_ea = 0.05,	0.2,	0.2,	0.15
+      p_pu_ra = 0.1,	0.2,	0.25,	0.1
+ p_switchR1R2 = 1.0,	1.0,	1.0,    1.0
+       p_qnlc = 4.193e-3,4.193e-3,4.193e-3,0.00687
+       p_qnRc = 1.26e-2,1.26e-2,1.26e-2,1.26e-2
+        p_xqn = 2.0,	2.0,	2.0,	2.0
+       p_qplc = 1.80e-4,1.80e-4,1.80e-4,4.29e-4
+       p_qpRc = 7.86e-4,7.86e-4,7.86e-4,7.86e-4
+        p_xqp = 2.0,	2.0,	2.0,	2.0
+       p_qslc = 8.5e-3,	0.0,	0.0,	0.0
+       p_qsRc = 0.01,	0.0,	0.0,	0.0
+        p_qun = 0.025,	0.025,	0.025,	0.025
+        p_qup = 0.025,	0.025,	0.025,	0.025
+        p_qus = 0.0,	0.0,	0.0,	0.0
+       p_esNI = 0.1,	0.00,	0.00,	0.00
+       p_thdo = 0.1,	0.1,	0.1,	0.1
+       p_res  = 5.0,	0.0,	0.0,	0.0
+       p_lN4  = 1.0,	1.0,	0.0,	1.0
+       p_chPs = 1.0,	0.0,	0.0,	0.0
+    p_Contois = 0.0,    0.0,    0.0,    0.0
+  p_alpha_chl = 1.38e-5, 0.46e-5, 1.52e-5, 0.68e-5
+      p_sdchl = 0.2,	0.2,	0.2,	0.2
+    p_EpEk_or = 0.0,    0.0,    0.0,    0.0
+ p_tochl_relt = 0.0,    0.0,    0.0,    0.0
+/
+
+&Phyto_parameters_iron
+       p_qflc = 0.1e-3, 0.1e-3, 0.83e-10,0.25e-3
+       p_qfRc = 0.3e-3, 0.3e-3, 0.18e-4, 0.5e-3
+        p_xqf = 1.0,    1.0,    1.0,     1.0
+        p_quf = 2.0e-4, 2.0e-4, 2.0e-4,  2.0e-4
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/Settling.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/Settling.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/Settling.nml	(revision 3680)
@@ -0,0 +1,48 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! ROUTINE: Settling
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_Settling filled by InitSettling
+!
+! AUTHORS
+!   the BFM team
+!
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!  p_burvel_R6:  	 Bottom Burial Velocity for detritus (m/d)
+!  p_burvel_R2:  	 Bottom Burial Velocity for dissolved (m/d)
+!  p_burvel_PI:  	 Bottom Burial Velocity for plankton (m/d)
+
+&Settling_parameters
+  p_burvel_R6 = 1.5,
+  p_burvel_R2 = 0.0,
+  p_burvel_PI = 1.5
+/
+
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!BOP
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/bfm.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/bfm.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/bfm.nml	(revision 3680)
@@ -0,0 +1,198 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! ROUTINE: Namelist for standalone
+!
+! DESCRIPTION
+!  Parameter values for module standalone filled by init_standalone
+!
+! AUTHORS
+!   Marcello Vichi and Piet Ruardij
+!
+! COPYING
+!   
+!   Copyright (C) 2008 M. Vichi and P. Ruardij
+!   (rua@nioz.nl; vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+
+!-------------------------------------------------------------------------!
+!NAMELIST bfm_nml
+!-------------------------------------------------------------------------!
+!Main initialisation and output specifications
+!NAME           KIND    DESCRIPTION
+!bio_calc       logical Switch on/off BFM (for coupled configurations)
+!bfm_init       integer Initialization state
+!                       0. from constant values in bfm_init_nml below
+!                       1. from restart
+!bio_setup      integer BFM configuration:
+!                       1. pelagic
+!                       2. benthic
+!                       3. pelagic and benthic
+!out_fname      string  Name of NetCDF output file
+!out_dir        string  Path to the output file
+!out_title      string  Name of the experiment in NetCDF file
+!out_delta      integer Output is saved every out_delta timesteps
+!-------------------------------------------------------------------------!
+&bfm_nml
+    bio_calc = .TRUE.
+    bfm_init = 0
+   bio_setup = 1 
+  bfm_rstctl = .FALSE.
+   out_fname = 'PELAGOS'
+     out_dir = '.'
+   out_title = 'PELAGOS'
+   out_delta = 45 
+   parallel_log = .FALSE.
+/
+
+!-------------------------------------------------------------------------!
+!NAMELIST bfm_init_nml
+!-------------------------------------------------------------------------!
+!Pelagic initialisation
+! pelagic  (O)              O2:   Oxygen (mmol/m3)
+! pelagic  (P)              N1:   Phosphate (mmol/m3)
+! pelagic  (N)              N3:   Nitrate (mmol/m3)
+! pelagic  (N)              N4:   Ammonium (mmol/m3)
+! pelagic  (Si)             N5:   Silicate (mmol/m3)
+! pelagic  (R)              N6:   Reduction Equivalents (mmol/m3)
+! pelagic  (N)              O4:   N2-sink (mmol/m3)
+! pelagic  (CNP)            B1:   Pelagic Bacteria
+! pelagic  (CNPSiI)         P1:   Diatoms (group PhytoPlankton))
+! pelagic  (CNPSiI)         P2:   Flagellates (group PhytoPlankton))
+! pelagic  (CNPSiI)         P3:   PicoPhytoPlankton (group PhytoPlankton))
+! pelagic  (CNPSiI)         P4:   Dinoflagellates (group PhytoPlankton))
+! pelagic  (CNP)            Z3:   Carnivorous mesozooplankton (group MesoZooPlankton))
+! pelagic  (CNP)            Z4:   Omnivorous mesozooplankton (group MesoZooPlankton))
+! pelagic  (CNP)            Z5:   Microzooplankton (group MicroZooPlankton))
+! pelagic  (CNP)            Z6:   Heterotrophic nanoflagellates (HNAN) (group MicroZooPlankton))
+! pelagic  (CNPSi)          R1:   Labile Organic Carbon (LOC)
+! pelagic  (C)              R2:   CarboHydrates (sugars)
+! pelagic  (CNPSi)          R6:   Particulate Organic Carbon (POC)
+! pelagic  (C)              R7:   Refractory Disoolved Organic Carbon
+!<variablename>0 = <realvalue>
+!
+! Initialization with InitVar structure
+! BFM variable information for data input
+! availabel fields:
+! integer init: select the initialization
+!               0 = homogeneous
+!               1 = analytical
+!               2 = from file
+! options for init==1
+! real anv1: value in the surface layer
+! real anz1: depth of the surface layer
+! real anv2: value in the bottom layer
+! real anz2: depth of the bottom layer
+! options for init==2 (not used when coupled with NEMO because 
+!                      overridden by values in namelist_top)
+! char filename: name of the input file
+! char  varname: name of the var in input file
+! Options currently used when coupled with NEMO
+! logical obc: variable has open boundary data
+! logical sbc: variable has surface boundary data
+! logical cbc: variable has coastal boundary data
+!-------------------------------------------------------------------------!
+&bfm_init_nml
+   O2o0 = 300.0,
+   InitVar(1)%init = 0,
+   InitVar(1)%sbc  = .false.,
+   InitVar(1)%cbc  = .false.,
+   InitVar(1)%obc  = .false.,
+   N1p0 = 1.0,
+   InitVar(2)%init = 2,
+   InitVar(2)%sbc  = .false.,
+   InitVar(2)%cbc  = .true.,
+   InitVar(2)%obc  = .false.,
+   N3n0 = 5.0,
+   InitVar(3)%init = 2,
+   InitVar(3)%sbc  = .false.,
+   InitVar(3)%cbc  = .true.,
+   InitVar(3)%obc  = .false.,
+   N4n0 = 1.0,
+   N5s0 = 8.0,
+   InitVar(6)%init = 2,
+   InitVar(6)%sbc  = .false.,
+   InitVar(6)%cbc  = .true.,
+   InitVar(6)%obc  = .false.,
+   N7f0 = 0.3,
+   InitVar(8)%init = 2,
+   InitVar(8)%sbc  = .true.,
+   InitVar(8)%cbc  = .true.,
+   InitVar(8)%obc  = .false.,
+   N6r0 = 1.0,
+   O4n0 = 200.0,
+   P1c0 = 1.0,
+   P2c0 = 1.0,
+   P3c0 = 1.0,
+   Z3c0 = 1.0,
+   Z4c0 = 1.0,
+   Z5c0 = 1.0,
+   Z6c0 = 1.0,
+   B1c0 = 1.0,
+   R2c0 = 0.1,
+   R6c0 = 0.1,
+   R7c0 = 1.0,
+   R1c0 = 1.0,
+   InitVar(45)%init = 2,
+   InitVar(45)%sbc  = .false.,
+   InitVar(45)%cbc  = .true.,
+   InitVar(45)%obc  = .false.,
+   O3c0 = 27060.0, ![mgC /m3] 2200 umol/Kg
+   InitVar(56)%init = 2,
+   InitVar(56)%anv1 = 25800.,
+   InitVar(56)%anz1 = 0.,
+   InitVar(56)%anv2 = 27900.,
+   InitVar(56)%anz2 = 1500.,
+   InitVar(56)%sbc  = .false.,
+   InitVar(56)%cbc  = .true.,
+   InitVar(56)%obc  = .false.,
+   O3h0 = 2660.0,  ![mmol eq/m3]  2600 umol/Kg
+   InitVar(57)%init = 2,
+   InitVar(57)%anv1 = 2375.,
+   InitVar(57)%anz1 = 0.,
+   InitVar(57)%anv2 = 2420.,
+   InitVar(57)%anz2 = 2000.,
+   InitVar(57)%sbc  = .false.,
+   InitVar(57)%cbc  = .false.,
+   InitVar(57)%obc  = .false.,
+/
+
+!-------------------------------------------------------------------------!
+!NAMELIST bfm_save_nml
+!-------------------------------------------------------------------------!
+!Stored variables
+!ave_save: average values over the output interval
+!var_save: instantaneous value at the output interval
+!-------------------------------------------------------------------------!
+&bfm_save_nml
+   ave_save = 'O2o','O3c','O3h','DIC','pCO2','pH',
+          'N1p','N3n','N4n','N5s','N7f',
+          'P1c','P1n','P1l','P1f','P2c','P2n','P2l','P3c','P3n','P3l',
+          'Z3c','Z4c','Z5c','Z6c','B1c',
+          'R1c','R2c','R6c','R6f',
+          'Chla','jsurO2o','jsurO3c',
+          'eiPI(iiP1)','eiPI(iiP2)','eiPI(iiP3)',
+          'qlPc(iiP1)','qlPc(iiP2)','qlPc(iiP3)',
+          'qnPc(iiP1)','qnPc(iiP2)','qnPc(iiP3)',
+          'qpPc(iiP1)','qpPc(iiP2)','qpPc(iiP3)',
+          'sunPI(iiP1)','sunPI(iiP2)','sunPI(iiP3)',
+          'EICE','ETW','EIR','EWIND'
+/
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/iodef.xml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/iodef.xml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/iodef.xml	(revision 3680)
@@ -0,0 +1,1130 @@
+<?xml version="1.0"?>
+<simulation> 
+  
+  <context id="nemo">
+    
+    <!-- $id$ -->
+    
+    <!-- 
+============================================================================================================
+=                                  definition of all existing variables                                    =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+    
+    <field_definition level="1" prec="4" operation="ave(X)" enabled=".TRUE."> <!-- time step automaticaly defined -->
+
+      <!-- T grid -->
+      
+      <group id="grid_T" axis_ref="none" grid_ref="grid_T">
+	<field id="toce"         description="temperature"                               unit="degC" axis_ref="deptht"   />
+       	<field id="soce"         description="salinity"                                  unit="psu"  axis_ref="deptht"   />
+	<field id="sst"          description="sea surface temperature"                   unit="degC"                     />
+	<field id="sst2"         description="square of sea surface temperature"         unit="degC2"                    />
+	<field id="sstgrad"      description="module of sst gradient"                    unit="degC/m"                   />
+	<field id="sstgrad2"     description="square of module of sst gradient"          unit="degC2/m2"                 />
+	<field id="sss"          description="sea surface salinity"                      unit="psu"                      />
+	<field id="sss2"         description="square of sea surface salinity"            unit="psu2"                     />
+	<field id="ssh"          description="sea surface height"                        unit="m"                        />
+	<field id="ssh2"         description="square of sea surface height"              unit="m2"                       />
+	<field id="mldkz5"       description="mixing layer depth (Turbocline)"           unit="m"                        />
+	<field id="mldr10_1"     description="Mixed Layer Depth 0.01 ref.10m"            unit="m"                        />
+       	<field id="rhop"         description="potential density (sigma0)"                unit="kg/m3" axis_ref="deptht"  />
+	<!-- next variables available with key_diahth -->
+	<field id="mlddzt"       description="Thermocline Depth (max dT/dz)"             unit="m"                        />
+	<field id="mldr10_3"     description="Mixed Layer Depth dr=0.03 (ref.10m)"       unit="m"                        />
+	<field id="mldr0_1"      description="Mixed Layer Depth dr=0.01 (ref.surf)"      unit="m"                        />
+	<field id="mldr0_3"      description="Mixed Layer Depth dr=0.03 (ref.surf)"      unit="m"                        />
+	<field id="mld_dt02"     description="Mixed Layer Depth |dt|=0.2 (ref.10m)"      unit="m"                        />
+	<field id="topthdep"     description="Top of the thermocline dt=-0.2 (ref.10m)"  unit="m"                        />
+	<field id="pycndep"      description="Pycnocline depth dr~dt=-0.2 (ref.10m)"     unit="m"                        />
+	<field id="BLT"          description="Barrier Layer Thickness"                   unit="m"                        />
+	<field id="tinv"         description="Max of vertical invertion of temperature"  unit="degC"                     />
+	<field id="depti"        description="Depth of max. vert. inv. of temperature"   unit="m"                        />
+        <field id="20d"          description="Depth of 20C isotherm"                     unit="m"                        />
+	<field id="28d"          description="Depth of 28C isotherm"                     unit="m"                        />
+	<field id="hc300"        description="Heat content 300 m"                        unit="W"                        />
+	<!-- variables available with key_diaar5 -->
+	<field id="botpres"      description="Pressure at sea floor"                     unit="dbar"                     />
+	<field id="cellthc"      description="Cell thickness"                            unit="m"     axis_ref="deptht"  />
+     </group>
+
+      <!-- SBC -->
+      
+      <group id="SBC" axis_ref="none" grid_ref="grid_T" > <!-- time step automaticaly defined based on nn_fsbc -->
+
+	<field id="empmr"        description="Net Upward Water Flux"                                        unit="kg/m2/s"  />
+	<field id="empsmr"       description="concentration/dilution water flux"                            unit="kg/m2/s"  />
+	<field id="snowpre"      description="Snow precipitation"                                           unit="kg/m2/s"  />
+	<field id="runoffs"      description="River Runoffs"                                                unit="Kg/m2/s"  />
+
+	<field id="qt"           description="Net Downward Heat Flux"                                       unit="W/m2"     />
+	<field id="qns"          description="non solar Downward Heat Flux"                                 unit="W/m2"     />
+	<field id="qsr"          description="Shortwave Radiation"                                          unit="W/m2"     />
+	<field id="qsr3d"        description="Shortwave Radiation 3D distribution"        axis_ref="deptht" unit="W/m2"     />
+	<field id="qrp"          description="Surface Heat Flux: Damping"                                   unit="W/m2"     />
+	<field id="erp"          description="Surface Water Flux: Damping"                                  unit="Kg/m2/s"  />
+	<field id="taum"         description="wind stress module"                                           unit="N/m2"     />
+	<field id="wspd"         description="Wind speed module at 10 m"                                    unit="m/s"      />
+	
+	<!-- * variable relative to atmospheric pressure forcing : available with ln_apr_dyn -->
+	<field id="ssh_ib"       description="Inverse barometer sea surface height"                         unit="m"        />
+
+	<!-- *_oce variables available with ln_blk_clio or ln_blk_core -->
+	<field id="qns_oce"      description="Non solar Downward Heat Flux over open ocean"                 unit="W/m2"     />
+	<field id="qlw_oce"      description="Longwave Downward Heat Flux over open ocean"                  unit="W/m2"     />
+	<field id="qsb_oce"      description="Sensible Downward Heat Flux over open ocean"                  unit="W/m2"     />
+	<field id="qla_oce"      description="Latent Downward Heat Flux over open ocean"                    unit="W/m2"     />
+	<field id="taum_oce"     description="wind stress module over open ocean"                           unit="N/m2"     />
+
+	<field id="ice_cover"    description="Ice fraction"                                                 unit="1"        />
+
+	<field id="ioceflxb"     description="Oceanic flux at the ice base"                                 unit="W/m2"     />
+	<field id="qsr_ai_cea"   description="Air-Ice downward solar heat flux (cell average)"              unit="W/m2"     />
+	<field id="qns_ai_cea"   description="Air-Ice downward non-solar heat flux (cell average)"          unit="W/m2"     />
+	<field id="qla_ai_cea"   description="Air-Ice downward Latent heat flux (cell average)"             unit="W/m2"     />
+	
+	<field id="qsr_io_cea"   description="Ice-Oce downward solar heat flux (cell average)"              unit="W/m2"     />
+	<field id="qns_io_cea"   description="Ice-Oce downward non-solar heat flux (cell average)"          unit="W/m2"     />
+	
+	<field id="snowthic_cea" description="Snow thickness (cell average)"                                unit="m"        />
+	<field id="icethic_cea"  description="Ice thickness (cell average)"                                 unit="m"        />
+	<field id="iceprod_cea"  description="Ice production (cell average)"                                unit="m/s"      />
+	
+	<field id="ice_pres"     description="Ice presence"                                                 unit="-"        />
+	<field id="ist_cea"      description="Ice surface temperature (cell average)"                       unit="degC"     />
+	<field id="ist_ipa"      description="Ice surface temperature (ice presence average)"               unit="degC"     />      
+	<field id="uice_ipa"     description="Ice velocity along i-axis at I-point (ice presence average)"  unit="m/s"      />      
+	<field id="vice_ipa"     description="Ice velocity along j-axis at I-point (ice presence average)"  unit="m/s"      />      
+	
+	<field id="utau_ice"     description="Wind stress along i-axis over the ice at i-point"             unit="N/m2"     />
+	<field id="vtau_ice"     description="Wind stress along j-axis over the ice at i-point"             unit="N/m2"     />
+	
+	<field id="u_imasstr"    description="Sea-ice mass transport along i-axis"                          unit="kg/s"     />
+	<field id="v_imasstr"    description="Sea-ice mass transport along j-axis"                          unit="kg/s"     />
+
+	<!-- available key_coupled -->
+	<field id="snow_ao_cea"  description="Snow over ice-free ocean (cell average)"                      unit="kg/m2/s"  />
+	<field id="snow_ai_cea"  description="Snow over sea-ice (cell average)"                             unit="kg/m2/s"  />
+	<field id="subl_ai_cea"  description="Sublimation over sea-ice (cell average)"                      unit="kg/m2/s"  />
+	<field id="icealb_cea"   description="Ice albedo (cell average)"                                    unit="1"        />
+	<field id="calving"      description="Calving"                                                      unit="kg/m2/s"  />
+	<!-- available if key_coupled + conservative method -->
+	<field id="rain"         description="Liquid precipitation"                                         unit="Kg/m2/s"  />
+	<field id="evap_ao_cea"  description="Evaporation over ice-free ocean (cell average)"               unit="kg/m2/s"  />
+	<!-- variables available with key_diaar5 -->
+	<field id="isnwmlt_cea"   description="Snow over Ice melting (cell average)"                        unit="kg/m2/s"  />
+	<field id="fsal_virt_cea" description="Virtual salt flux due to ice formation (cell average)"       unit="kg/m2/s"  />
+	<field id="fsal_real_cea" description="Real salt flux due to ice formation (cell average)"          unit="kg/m2/s"  />
+	<field id="hflx_rain_cea" description="heat flux due to rainfall"                                   unit="W/m2"     />
+	<field id="hflx_evap_cea" description="heat flux due to evaporation"                                unit="W/m2"     />
+	<field id="hflx_snow_cea" description="heat flux due to snow falling over ice-free ocean"           unit="W/m2"     />
+	<field id="hflx_ice_cea"  description="heat flux due to ice thermodynamics"                         unit="W/m2"     />
+	<field id="hflx_rnf_cea"  description="heat flux due to runoffs"                                    unit="W/m2"     />
+	<field id="hflx_cal_cea"  description="heat flux due to calving"                                    unit="W/m2"     />
+	<field id="bicemel_cea"  description="Rate of Melt at Sea Ice Base (cell average)"                  unit="kg/m2/s"  />
+	<field id="licepro_cea"  description="Lateral Sea Ice Growth Rate (cell average)"                   unit="kg/m2/s"  />
+	<field id="snowmel_cea"  description="Snow Melt Rate (cell average)"                                unit="kg/m2/s"  />
+	<field id="sntoice_cea"  description="Snow-Ice Formation Rate (cell average)"                       unit="kg/m2/s"  />
+	<field id="ticemel_cea"  description="Rate of Melt at Upper Surface of Sea Ice (cell average)"      unit="kg/m2/s"  />
+
+      </group>
+
+      <!-- U grid -->
+      
+      <group id="grid_U"  axis_ref="depthu" grid_ref="grid_U">
+	<field id="utau"         description="Wind Stress along i-axis"                    unit="N/m2" axis_ref="none" />
+	<field id="uoce"         description="ocean current along i-axis"                  unit="m/s"                  />
+	<field id="uocetr_eff"   description="Effective ocean transport along i-axis"      unit="m3/s"                  />
+	<!-- uoce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="uoce_eiv"     description="EIV ocean current along i-axis"              unit="m/s"                  />
+	<!-- uoce_eiv: available with key_trabbl -->
+	<field id="uoce_bbl"     description="BBL ocean current along i-axis"              unit="m/s"  axis_ref="none" />
+	<field id="ahu_bbl"      description="BBL diffusive flux along i-axis"             unit="m3/s" axis_ref="none" />
+ 	<!-- variables available with key_diaar5 -->
+	<field id="u_masstr"     description="ocean eulerian mass transport along i-axis"  unit="kg/s"                 />
+	<field id="u_heattr"     description="ocean eulerian heat transport along i-axis"  unit="W"    axis_ref="none" />
+	<field id="ueiv_heattr"  description="ocean bolus heat transport along i-axis"     unit="W"    axis_ref="none" />
+	<field id="udiff_heattr" description="ocean diffusion heat transport along i-axis" unit="W"    axis_ref="none" />
+     </group>
+      
+      <!-- V grid -->
+      
+      <group id="grid_V"  axis_ref="depthv" grid_ref="grid_V">
+	<field id="vtau"         description="Wind Stress along j-axis"                    unit="N/m2" axis_ref="none" />
+	<field id="voce"         description="ocean current along j-axis"                  unit="m/s"                  />
+	<field id="vocetr_eff"   description="Effective ocean transport along j-axis"      unit="m3/s"                  />
+	<!-- voce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="voce_eiv"     description="EIV ocean current along j-axis"              unit="m/s"                  />
+	<!-- voce_eiv: available with key_trabbl -->
+	<field id="voce_bbl"     description="BBL ocean current along j-axis"              unit="m/s" axis_ref="none"  />
+	<field id="ahv_bbl"      description="BBL diffusive flux along j-axis"             unit="m3/s" axis_ref="none" />
+	<!-- variables available with key_diaar5 -->
+	<field id="v_masstr"     description="ocean eulerian mass transport along j-axis"  unit="kg/s"                 />
+	<field id="v_heattr"     description="ocean eulerian heat transport along j-axis"  unit="W"    axis_ref="none" />
+	<field id="veiv_heattr"  description="ocean bolus heat transport along j-axis"     unit="W"    axis_ref="none" />
+	<field id="vdiff_heattr" description="ocean diffusion heat transport along j-axis" unit="W"    axis_ref="none" />
+      </group>
+      
+      <!-- W grid -->
+      
+      <group id="grid_W"  axis_ref="depthw" grid_ref="grid_W">
+	<field id="woce"         description="ocean vertical velocity"                     unit="m/s"                  />
+	<field id="wocetr_eff"   description="effective ocean vertical transport"          unit="m3/s"                 />
+	<!-- woce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="woce_eiv"     description="EIV ocean vertical velocity"                 unit="m/s"                  />
+	<!-- woce_eiv: available with key_trabbl_adv -->
+	<field id="avt"          description="vertical eddy diffusivity"                   unit="m2/s"                 />
+	<field id="avm"          description="vertical eddy viscosity"                     unit="m2/s"                 />
+	<!-- avs: available with key_zdfddm -->
+	<field id="avs"          description="salt vertical eddy diffusivity"              unit="m2/s"                 />
+	<!-- avt_evd and avm_evd: available with ln_zdfevd -->
+	<field id="avt_evd"      description="enhanced vertical diffusivity"               unit="m2/s"                 />
+	<field id="avm_evd"      description="enhanced vertical viscosity"                 unit="m2/s"                 />
+	<!-- aht2d and  aht2d_eiv: available with key_traldf_eiv and key_traldf_c2d -->
+	<field id="aht2d"        description="lateral eddy diffusivity"                    unit="m2/s" axis_ref="none" />
+	<field id="aht2d_eiv"    description="EIV lateral eddy diffusivity"                unit="m2/s" axis_ref="none" />
+	<!-- avt_tide: available with key_zdftmx -->
+	<field id="av_tide"      description="tidal vertical diffusivity"                  unit="m2/s"                 />
+	<!-- variables available with key_diaar5 -->   
+	<field id="w_masstr"     description="vertical mass trasport"                      unit="kg/s"                 />
+	<field id="w_masstr2"    description="square of vertical mass trasport"            unit="kg2/s2"               />
+      </group>
+          
+      <!-- scalar -->
+      
+      <!-- variables available with key_diaar5 -->
+      <group id="scalar" axis_ref="none" grid_ref="scalarpoint" zoom_ref="1point" >
+	<field id="voltot"     description="global mean volume"                         unit="m3"   />
+	<field id="sshtot"     description="global mean ssh"                            unit="m"    />
+	<field id="sshsteric"  description="global mean ssh steric"                     unit="m"    />
+	<field id="sshthster"  description="global mean ssh thermosteric"               unit="m"    />
+	<field id="masstot"    description="global mean mass"                           unit="kg"   />
+	<field id="temptot"    description="global mean temperature"                    unit="degC" />
+	<field id="saltot"     description="global mean salinity"                       unit="psu"  />
+	<field id="fram_trans" description="Sea Ice Mass Transport Through Fram Strait" unit="kg/s" />
+      </group>
+
+    </field_definition>
+    
+    <!-- 
+============================================================================================================
+=                                           output files definition                                        =
+=                                            Define your own files                                         =
+=                                         put the variables you want...                                    =
+============================================================================================================
+    -->
+    
+    <file_definition >
+
+      <group id="1h" output_freq="3600"   output_level="10" enabled=".TRUE.">                      <!-- 1h files -->
+      </group>
+      
+      <group id="2h" output_freq="7200"   output_level="10" enabled=".TRUE.">                      <!-- 2h files -->
+      </group>
+      
+      <group id="3h" output_freq="10800"  output_level="10" enabled=".TRUE.">                      <!-- 3h files -->
+      </group>
+      
+      <group id="4h" output_freq="14400"  output_level="10" enabled=".TRUE.">                      <!-- 4h files -->
+      </group>
+      
+      <group id="6h" output_freq="21600"  output_level="10" enabled=".TRUE.">                      <!-- 6h files -->
+      </group>
+      
+      <group id="1d" output_freq="86400"  output_level="10" enabled=".TRUE.">                      <!-- 1d files -->
+
+    <!-- 
+............................................................................................................
+           example of 3 types of 1d files
+............................................................................................................
+    -->
+	<!-- automatic definition of the name based on id="1d_grid_T" 
+	     => this name is used as the radical for all file names of this group
+	     => add a suffix to be sure that all files names of this group are different   -->
+	<group id="1d_grid_T" name="auto" description="ocean T grid variables" >
+	  <!-- mooring: automatic definition of the file name suffix based on id="0n180wT"  -->
+	  <file id="0n180wT" name_suffix="auto" >
+	    <group id="0n180wT" zoom_ref="0n180wT" >    <!-- group of variables sharing the same zoom -->
+	      <field ref="toce" name="votemper"  />
+	      <field ref="uoce" name="vozocrtx"  />     <!-- include a U-grid variable in the list => switch to T-grid -->
+	    </group>
+	  </file>
+	  <!-- Equatorial section: automatic definition of the file name suffix based on id="EqT" -->
+	  <file id="EqT" name_suffix="auto" >
+	    <group id="EqT" zoom_ref="EqT" >
+	      <field ref="toce" name="votemper"  />
+	    </group>
+	  </file>
+	  <!-- global file with different operations on data   -->
+	  <file id="global" >
+	    <field ref="sst"    name="sst_1d_ave"                       />     <!-- mean -->
+	    <field ref="sst"    name="sst_1d_max"  operation="t_max(X)" />     <!-- max -->
+	  </file>
+	</group>
+
+      </group>
+      
+      <group id="3d" output_freq="259200" output_level="10" enabled=".TRUE.">                      <!-- 3d files -->
+      </group>
+      
+      <group id="5d" output_freq="432000" output_level="10" enabled=".TRUE.">                      <!-- 5d files -->
+
+	<file id="5d_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="toce"         name="votemper"  />
+	  <field ref="soce"         name="vosaline"  />
+	  <field ref="sst"          name="sosstsst"  />
+	  <field ref="sss"          name="sosaline"  />
+	  <field ref="ssh"          name="sossheig"  />
+	  <field ref="empmr"        name="sowaflup"  />
+	  <field ref="qsr"          name="soshfldo"  />
+	  <field ref="empsmr"       name="sowaflcd"  />
+	  <field ref="qt"           name="sohefldo"  />
+	  <field ref="mldr10_1"     name="somxl010"  />
+	  <field ref="mldkz5"       name="somixhgt"  />
+	  <field ref="ice_cover"    name="soicecov"  />
+	  <field ref="wspd"         name="sowindsp"  />
+	  <field ref="qrp"          name="sohefldp"  />
+	  <field ref="erp"          name="sowafldp"  />
+	  <field ref="mlddzt"       name="sothedep"  />
+	  <field ref="20d"          name="so20chgt"  />
+	  <field ref="28d"          name="so28chgt"  />
+	  <field ref="hc300"        name="sohtc300"  />
+	  <field ref="ist_ipa"      name="soicetem"  />
+	  <field ref="icealb_cea"   name="soicealb"  />   
+	</file>
+	
+	<file id="5d_grid_U" name="auto" description="ocean U grid variables" >
+	  <field ref="uoce"         name="vozocrtx"  />
+	  <field ref="uoce_eiv"     name="vozoeivu"  />
+	  <field ref="utau"         name="sozotaux"  />
+	</file>
+	
+	<file id="5d_grid_V" name="auto" description="ocean V grid variables" >
+	  <field ref="voce"         name="vomecrty"  />
+	  <field ref="voce_eiv"     name="vomeeivv"  />
+	  <field ref="vtau"         name="sometauy"  />
+	</file>
+	
+	<file id="5d_grid_W" name="auto" description="ocean W grid variables" >
+	  <field ref="woce"         name="vovecrtz" />
+	  <field ref="woce_eiv"     name="voveeivw" />
+	  <field ref="avt"          name="votkeavt" />
+	  <field ref="avt_evd"      name="votkeevd" />
+	  <field ref="avm"          name="votkeavm" />
+	  <field ref="avm_evd"      name="votkeevm" />
+	  <field ref="avs"          name="voddmavs" />
+	  <field ref="aht2d"        name="soleahtw" />
+	  <field ref="aht2d_eiv"    name="soleaeiw" />
+	</file>
+	
+	<file id="5d_icemod" name="auto" description="ice variables" >
+	  <field ref="ice_pres"                     />
+	  <field ref="snowthic_cea" name="isnowthi" />
+	  <field ref="icethic_cea"  name="iicethic" />
+	  <field ref="iceprod_cea"  name="iiceprod" />
+	  <field ref="ist_ipa"      name="iicetemp" />
+	  <field ref="ioceflxb"     name="ioceflxb" />
+	  <field ref="uice_ipa"     name="iicevelu" />
+	  <field ref="vice_ipa"     name="iicevelv" />
+	  <field ref="utau_ice"     name="iicestru" />
+	  <field ref="vtau_ice"     name="iicestrv" />
+	  <field ref="qsr_io_cea"   name="iicesflx" />
+	  <field ref="qns_io_cea"   name="iicenflx" />
+	  <field ref="snowpre"      name="isnowpre" />
+	</file>
+	
+      </group>
+      
+      <group id="1m" output_freq="-1"     output_level="10" enabled=".TRUE.">                      <!-- real monthly files -->
+
+	<file id="1m_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="sst"          name="sosstsst"  />
+	</file>   
+
+      </group>
+
+      <group id="2m" output_freq="-2"     output_level="10" enabled=".TRUE.">                      <!-- real 2m files -->
+      </group>
+
+      <group id="3m" output_freq="-3"     output_level="10" enabled=".TRUE.">                      <!-- real 3m files -->
+      </group>
+
+      <group id="4m" output_freq="-4"     output_level="10" enabled=".TRUE.">                      <!-- real 4m files -->
+      </group>
+
+      <group id="6m" output_freq="-6"     output_level="10" enabled=".TRUE.">                      <!-- real 6m files -->
+      </group>
+
+      <group id="1y" output_freq="-12"    output_level="10" enabled=".TRUE.">                      <!-- real yearly files -->
+
+	<file id="1y_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="mldr10_1"     name="sobowlin"  operation="t_max(X)" />
+	</file>
+
+      </group>
+
+      <group id="2y"  output_freq="-24"   output_level="10" enabled=".TRUE.">                      <!-- real 2y files -->
+      </group>
+
+      <group id="5y"  output_freq="-60"   output_level="10" enabled=".TRUE.">                      <!-- real 5y files -->
+      </group>
+
+      <group id="10y" output_freq="-120"  output_level="10" enabled=".TRUE.">                      <!-- real 10y files -->
+      </group>
+
+    </file_definition>
+    
+    <!-- 
+============================================================================================================
+=                                           grid definition                                                =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+    
+    <axis_definition>  
+      <axis id="deptht" description="Vertical T levels" unit="m" positive=".false." />
+      <axis id="depthu" description="Vertical U levels" unit="m" positive=".false." />
+      <axis id="depthv" description="Vertical V levels" unit="m" positive=".false." />
+      <axis id="depthw" description="Vertical W levels" unit="m" positive=".false." />
+      <axis id="none" description="axe non defini" unit="none" size="1" />
+    </axis_definition> 
+    
+    <grid_definition>
+      <grid id="grid_T" description="grid T" >
+    <!--   Eq section   -->
+	<zoom id="EqT" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+    <!--   TAO   -->
+      <!--   137e   -->
+	<zoom id="2n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   147e   -->
+	<zoom id="0n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   156e   -->
+	<zoom id="5s156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   165e   -->
+	<zoom id="8s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   180w   -->
+	<zoom id="8s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   170w   -->
+	<zoom id="8s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   155w   -->
+	<zoom id="8s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   140w   -->
+	<zoom id="8s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   125w   -->
+	<zoom id="8s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   110w   -->
+	<zoom id="8s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   95w   -->
+	<zoom id="8s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+    <!--   RAMA   -->
+      <!--   55e   -->
+	<zoom id="16s55eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s55eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+ 	<zoom id="8s55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s55eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n55eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   65e   -->
+	<zoom id="15n65eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   67e   -->
+	<zoom id="16s67eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s67eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s67eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n67eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   80.5e   -->
+	<zoom id="16s80.5eT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s80.5eT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s80.5eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n80.5eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   90e   -->
+	<zoom id="1.5s90eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n90eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n90eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="15n90eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   95e   -->
+	<zoom id="16s95eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s95eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s95eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s95eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+    <!--   PIRATA   -->
+      <!--   38w-30w   -->
+	<zoom id="19s34wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="14s32wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s30wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n35wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n38wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n38wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="15n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="20n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   23w   -->
+	<zoom id="0n23wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n23wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n23wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="21n23wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   10w   -->
+	<zoom id="10s10wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="6s10wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n10wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   0e   -->
+	<zoom id="0n0eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      </grid>
+
+      <grid id="grid_U" description="grid U" >
+    <!--   Eq section   -->
+	<zoom id="EqU" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+      </grid>
+
+      <grid id="grid_V" description="grid V" >
+      </grid>
+
+      <grid id="grid_W" description="grid W" >
+    <!--   Eq section   -->
+	<zoom id="EqW" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+      </grid>
+
+      <grid id="scalarpoint" description="scalar" >
+	<zoom id="1point" ibegin="1" jbegin="1" ni="1" nj="1" />
+      </grid>
+
+    </grid_definition>    
+    
+  </context>
+  <context id="1_nemo">
+    
+    <!-- $id$ -->
+    
+    <!-- 
+============================================================================================================
+=                                  definition of all existing variables                                    =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+    
+    <field_definition level="1" prec="4" operation="ave(X)" enabled=".TRUE."> <!-- time step automaticaly defined -->
+
+      <!-- T grid -->
+      
+      <group id="grid_T" axis_ref="none" grid_ref="grid_T">
+	<field id="toce"         description="temperature"                               unit="degC" axis_ref="deptht"   />
+       	<field id="soce"         description="salinity"                                  unit="psu"  axis_ref="deptht"   />
+	<field id="sst"          description="sea surface temperature"                   unit="degC"                     />
+	<field id="sst2"         description="square of sea surface temperature"         unit="degC2"                    />
+	<field id="sstgrad"      description="module of sst gradient"                    unit="degC/m"                   />
+	<field id="sstgrad2"     description="square of module of sst gradient"          unit="degC2/m2"                 />
+	<field id="sss"          description="sea surface salinity"                      unit="psu"                      />
+	<field id="sss2"         description="square of sea surface salinity"            unit="psu2"                     />
+	<field id="ssh"          description="sea surface height"                        unit="m"                        />
+	<field id="ssh2"         description="square of sea surface height"              unit="m2"                       />
+	<field id="mldkz5"       description="mixing layer depth (Turbocline)"           unit="m"                        />
+	<field id="mldr10_1"     description="Mixed Layer Depth 0.01 ref.10m"            unit="m"                        />
+       	<field id="rhop"         description="potential density (sigma0)"                unit="kg/m3" axis_ref="deptht"  />
+	<!-- next variables available with key_diahth -->
+	<field id="mlddzt"       description="Thermocline Depth (max dT/dz)"             unit="m"                        />
+	<field id="mldr10_3"     description="Mixed Layer Depth dr=0.03 (ref.10m)"       unit="m"                        />
+	<field id="mldr0_1"      description="Mixed Layer Depth dr=0.01 (ref.surf)"      unit="m"                        />
+	<field id="mldr0_3"      description="Mixed Layer Depth dr=0.03 (ref.surf)"      unit="m"                        />
+	<field id="mld_dt02"     description="Mixed Layer Depth |dt|=0.2 (ref.10m)"      unit="m"                        />
+	<field id="topthdep"     description="Top of the thermocline dt=-0.2 (ref.10m)"  unit="m"                        />
+	<field id="pycndep"      description="Pycnocline depth dr~dt=-0.2 (ref.10m)"     unit="m"                        />
+	<field id="BLT"          description="Barrier Layer Thickness"                   unit="m"                        />
+	<field id="tinv"         description="Max of vertical invertion of temperature"  unit="degC"                     />
+	<field id="depti"        description="Depth of max. vert. inv. of temperature"   unit="m"                        />
+        <field id="20d"          description="Depth of 20C isotherm"                     unit="m"                        />
+	<field id="28d"          description="Depth of 28C isotherm"                     unit="m"                        />
+	<field id="hc300"        description="Heat content 300 m"                        unit="W"                        />
+	<!-- variables available with key_diaar5 -->
+	<field id="botpres"      description="Pressure at sea floor"                     unit="dbar"                     />
+	<field id="cellthc"      description="Cell thickness"                            unit="m"     axis_ref="deptht"  />
+     </group>
+
+      <!-- SBC -->
+      
+      <group id="SBC" axis_ref="none" grid_ref="grid_T" > <!-- time step automaticaly defined based on nn_fsbc -->
+
+	<field id="empmr"        description="Net Upward Water Flux"                                        unit="kg/m2/s"  />
+	<field id="empsmr"       description="concentration/dilution water flux"                            unit="kg/m2/s"  />
+	<field id="snowpre"      description="Snow precipitation"                                           unit="kg/m2/s"  />
+	<field id="runoffs"      description="River Runoffs"                                                unit="Kg/m2/s"  />
+
+	<field id="qt"           description="Net Downward Heat Flux"                                       unit="W/m2"     />
+	<field id="qns"          description="non solar Downward Heat Flux"                                 unit="W/m2"     />
+	<field id="qsr"          description="Shortwave Radiation"                                          unit="W/m2"     />
+	<field id="qsr3d"        description="Shortwave Radiation 3D distribution"        axis_ref="deptht" unit="W/m2"     />
+	<field id="qrp"          description="Surface Heat Flux: Damping"                                   unit="W/m2"     />
+	<field id="erp"          description="Surface Water Flux: Damping"                                  unit="Kg/m2/s"  />
+	<field id="taum"         description="wind stress module"                                           unit="N/m2"     />
+	<field id="wspd"         description="Wind speed module at 10 m"                                    unit="m/s"      />
+	
+	<!-- * variable relative to atmospheric pressure forcing : available with ln_apr_dyn -->
+	<field id="ssh_ib"       description="Inverse barometer sea surface height"                         unit="m"        />
+
+	<!-- *_oce variables available with ln_blk_clio or ln_blk_core -->
+	<field id="qns_oce"      description="Non solar Downward Heat Flux over open ocean"                 unit="W/m2"     />
+	<field id="qlw_oce"      description="Longwave Downward Heat Flux over open ocean"                  unit="W/m2"     />
+	<field id="qsb_oce"      description="Sensible Downward Heat Flux over open ocean"                  unit="W/m2"     />
+	<field id="qla_oce"      description="Latent Downward Heat Flux over open ocean"                    unit="W/m2"     />
+	<field id="taum_oce"     description="wind stress module over open ocean"                           unit="N/m2"     />
+
+	<field id="ice_cover"    description="Ice fraction"                                                 unit="1"        />
+
+	<field id="ioceflxb"     description="Oceanic flux at the ice base"                                 unit="W/m2"     />
+	<field id="qsr_ai_cea"   description="Air-Ice downward solar heat flux (cell average)"              unit="W/m2"     />
+	<field id="qns_ai_cea"   description="Air-Ice downward non-solar heat flux (cell average)"          unit="W/m2"     />
+	<field id="qla_ai_cea"   description="Air-Ice downward Latent heat flux (cell average)"             unit="W/m2"     />
+	
+	<field id="qsr_io_cea"   description="Ice-Oce downward solar heat flux (cell average)"              unit="W/m2"     />
+	<field id="qns_io_cea"   description="Ice-Oce downward non-solar heat flux (cell average)"          unit="W/m2"     />
+	
+	<field id="snowthic_cea" description="Snow thickness (cell average)"                                unit="m"        />
+	<field id="icethic_cea"  description="Ice thickness (cell average)"                                 unit="m"        />
+	<field id="iceprod_cea"  description="Ice production (cell average)"                                unit="m/s"      />
+	
+	<field id="ice_pres"     description="Ice presence"                                                 unit="-"        />
+	<field id="ist_cea"      description="Ice surface temperature (cell average)"                       unit="degC"     />
+	<field id="ist_ipa"      description="Ice surface temperature (ice presence average)"               unit="degC"     />      
+	<field id="uice_ipa"     description="Ice velocity along i-axis at I-point (ice presence average)"  unit="m/s"      />      
+	<field id="vice_ipa"     description="Ice velocity along j-axis at I-point (ice presence average)"  unit="m/s"      />      
+	
+	<field id="utau_ice"     description="Wind stress along i-axis over the ice at i-point"             unit="N/m2"     />
+	<field id="vtau_ice"     description="Wind stress along j-axis over the ice at i-point"             unit="N/m2"     />
+	
+	<field id="u_imasstr"    description="Sea-ice mass transport along i-axis"                          unit="kg/s"     />
+	<field id="v_imasstr"    description="Sea-ice mass transport along j-axis"                          unit="kg/s"     />
+
+	<!-- available key_coupled -->
+	<field id="snow_ao_cea"  description="Snow over ice-free ocean (cell average)"                      unit="kg/m2/s"  />
+	<field id="snow_ai_cea"  description="Snow over sea-ice (cell average)"                             unit="kg/m2/s"  />
+	<field id="subl_ai_cea"  description="Sublimation over sea-ice (cell average)"                      unit="kg/m2/s"  />
+	<field id="icealb_cea"   description="Ice albedo (cell average)"                                    unit="1"        />
+	<field id="calving"      description="Calving"                                                      unit="kg/m2/s"  />
+	<!-- available if key_coupled + conservative method -->
+	<field id="rain"         description="Liquid precipitation"                                         unit="Kg/m2/s"  />
+	<field id="evap_ao_cea"  description="Evaporation over ice-free ocean (cell average)"               unit="kg/m2/s"  />
+	<!-- variables available with key_diaar5 -->
+	<field id="isnwmlt_cea"   description="Snow over Ice melting (cell average)"                        unit="kg/m2/s"  />
+	<field id="fsal_virt_cea" description="Virtual salt flux due to ice formation (cell average)"       unit="kg/m2/s"  />
+	<field id="fsal_real_cea" description="Real salt flux due to ice formation (cell average)"          unit="kg/m2/s"  />
+	<field id="hflx_rain_cea" description="heat flux due to rainfall"                                   unit="W/m2"     />
+	<field id="hflx_evap_cea" description="heat flux due to evaporation"                                unit="W/m2"     />
+	<field id="hflx_snow_cea" description="heat flux due to snow falling over ice-free ocean"           unit="W/m2"     />
+	<field id="hflx_ice_cea"  description="heat flux due to ice thermodynamics"                         unit="W/m2"     />
+	<field id="hflx_rnf_cea"  description="heat flux due to runoffs"                                    unit="W/m2"     />
+	<field id="hflx_cal_cea"  description="heat flux due to calving"                                    unit="W/m2"     />
+	<field id="bicemel_cea"  description="Rate of Melt at Sea Ice Base (cell average)"                  unit="kg/m2/s"  />
+	<field id="licepro_cea"  description="Lateral Sea Ice Growth Rate (cell average)"                   unit="kg/m2/s"  />
+	<field id="snowmel_cea"  description="Snow Melt Rate (cell average)"                                unit="kg/m2/s"  />
+	<field id="sntoice_cea"  description="Snow-Ice Formation Rate (cell average)"                       unit="kg/m2/s"  />
+	<field id="ticemel_cea"  description="Rate of Melt at Upper Surface of Sea Ice (cell average)"      unit="kg/m2/s"  />
+
+      </group>
+
+      <!-- U grid -->
+      
+      <group id="grid_U"  axis_ref="depthu" grid_ref="grid_U">
+	<field id="utau"         description="Wind Stress along i-axis"                    unit="N/m2" axis_ref="none" />
+	<field id="uoce"         description="ocean current along i-axis"                  unit="m/s"                  />
+	<field id="uocetr_eff"   description="Effective ocean transport along i-axis"      unit="m3/s"                  />
+	<!-- uoce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="uoce_eiv"     description="EIV ocean current along i-axis"              unit="m/s"                  />
+	<!-- uoce_eiv: available with key_trabbl -->
+	<field id="uoce_bbl"     description="BBL ocean current along i-axis"              unit="m/s"  axis_ref="none" />
+	<field id="ahu_bbl"      description="BBL diffusive flux along i-axis"             unit="m3/s" axis_ref="none" />
+ 	<!-- variables available with key_diaar5 -->
+	<field id="u_masstr"     description="ocean eulerian mass transport along i-axis"  unit="kg/s"                 />
+	<field id="u_heattr"     description="ocean eulerian heat transport along i-axis"  unit="W"    axis_ref="none" />
+	<field id="ueiv_heattr"  description="ocean bolus heat transport along i-axis"     unit="W"    axis_ref="none" />
+	<field id="udiff_heattr" description="ocean diffusion heat transport along i-axis" unit="W"    axis_ref="none" />
+     </group>
+      
+      <!-- V grid -->
+      
+      <group id="grid_V"  axis_ref="depthv" grid_ref="grid_V">
+	<field id="vtau"         description="Wind Stress along j-axis"                    unit="N/m2" axis_ref="none" />
+	<field id="voce"         description="ocean current along j-axis"                  unit="m/s"                  />
+	<field id="vocetr_eff"   description="Effective ocean transport along j-axis"      unit="m3/s"                  />
+	<!-- voce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="voce_eiv"     description="EIV ocean current along j-axis"              unit="m/s"                  />
+	<!-- voce_eiv: available with key_trabbl -->
+	<field id="voce_bbl"     description="BBL ocean current along j-axis"              unit="m/s" axis_ref="none"  />
+	<field id="ahv_bbl"      description="BBL diffusive flux along j-axis"             unit="m3/s" axis_ref="none" />
+	<!-- variables available with key_diaar5 -->
+	<field id="v_masstr"     description="ocean eulerian mass transport along j-axis"  unit="kg/s"                 />
+	<field id="v_heattr"     description="ocean eulerian heat transport along j-axis"  unit="W"    axis_ref="none" />
+	<field id="veiv_heattr"  description="ocean bolus heat transport along j-axis"     unit="W"    axis_ref="none" />
+	<field id="vdiff_heattr" description="ocean diffusion heat transport along j-axis" unit="W"    axis_ref="none" />
+      </group>
+      
+      <!-- W grid -->
+      
+      <group id="grid_W"  axis_ref="depthw" grid_ref="grid_W">
+	<field id="woce"         description="ocean vertical velocity"                     unit="m/s"                  />
+	<field id="wocetr_eff"   description="effective ocean vertical transport"          unit="m3/s"                 />
+	<!-- woce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="woce_eiv"     description="EIV ocean vertical velocity"                 unit="m/s"                  />
+	<!-- woce_eiv: available with key_trabbl_adv -->
+	<field id="avt"          description="vertical eddy diffusivity"                   unit="m2/s"                 />
+	<field id="avm"          description="vertical eddy viscosity"                     unit="m2/s"                 />
+	<!-- avs: available with key_zdfddm -->
+	<field id="avs"          description="salt vertical eddy diffusivity"              unit="m2/s"                 />
+	<!-- avt_evd and avm_evd: available with ln_zdfevd -->
+	<field id="avt_evd"      description="enhanced vertical diffusivity"               unit="m2/s"                 />
+	<field id="avm_evd"      description="enhanced vertical viscosity"                 unit="m2/s"                 />
+	<!-- aht2d and  aht2d_eiv: available with key_traldf_eiv and key_traldf_c2d -->
+	<field id="aht2d"        description="lateral eddy diffusivity"                    unit="m2/s" axis_ref="none" />
+	<field id="aht2d_eiv"    description="EIV lateral eddy diffusivity"                unit="m2/s" axis_ref="none" />
+	<!-- avt_tide: available with key_zdftmx -->
+	<field id="av_tide"      description="tidal vertical diffusivity"                  unit="m2/s"                 />
+	<!-- variables available with key_diaar5 -->   
+	<field id="w_masstr"     description="vertical mass trasport"                      unit="kg/s"                 />
+	<field id="w_masstr2"    description="square of vertical mass trasport"            unit="kg2/s2"               />
+      </group>
+          
+      <!-- scalar -->
+      
+      <!-- variables available with key_diaar5 -->
+      <group id="scalar" axis_ref="none" grid_ref="scalarpoint" zoom_ref="1point" >
+	<field id="voltot"     description="global mean volume"                         unit="m3"   />
+	<field id="sshtot"     description="global mean ssh"                            unit="m"    />
+	<field id="sshsteric"  description="global mean ssh steric"                     unit="m"    />
+	<field id="sshthster"  description="global mean ssh thermosteric"               unit="m"    />
+	<field id="masstot"    description="global mean mass"                           unit="kg"   />
+	<field id="temptot"    description="global mean temperature"                    unit="degC" />
+	<field id="saltot"     description="global mean salinity"                       unit="psu"  />
+	<field id="fram_trans" description="Sea Ice Mass Transport Through Fram Strait" unit="kg/s" />
+      </group>
+
+    </field_definition>
+    
+    <!-- 
+============================================================================================================
+=                                           output files definition                                        =
+=                                            Define your own files                                         =
+=                                         put the variables you want...                                    =
+============================================================================================================
+    -->
+    
+    <file_definition >
+
+      <group id="1h" output_freq="3600"   output_level="10" enabled=".TRUE.">                      <!-- 1h files -->
+      </group>
+      
+      <group id="2h" output_freq="7200"   output_level="10" enabled=".TRUE.">                      <!-- 2h files -->
+      </group>
+      
+      <group id="3h" output_freq="10800"  output_level="10" enabled=".TRUE.">                      <!-- 3h files -->
+      </group>
+      
+      <group id="4h" output_freq="14400"  output_level="10" enabled=".TRUE.">                      <!-- 4h files -->
+      </group>
+      
+      <group id="6h" output_freq="21600"  output_level="10" enabled=".TRUE.">                      <!-- 6h files -->
+      </group>
+      
+      <group id="1d" output_freq="86400"  output_level="10" enabled=".TRUE.">                      <!-- 1d files -->
+
+    <!-- 
+............................................................................................................
+           example of 3 types of 1d files
+............................................................................................................
+    -->
+	<!-- automatic definition of the name based on id="1d_grid_T" 
+	     => this name is used as the radical for all file names of this group
+	     => add a suffix to be sure that all files names of this group are different   -->
+	<group id="1d_grid_T" name="auto" description="ocean T grid variables" >
+	  <!-- mooring: automatic definition of the file name suffix based on id="0n180wT"  -->
+	  <file id="0n180wT" name_suffix="auto" >
+	    <group id="0n180wT" zoom_ref="0n180wT" >    <!-- group of variables sharing the same zoom -->
+	      <field ref="toce" name="votemper"  />
+	      <field ref="uoce" name="vozocrtx"  />     <!-- include a U-grid variable in the list => switch to T-grid -->
+	    </group>
+	  </file>
+	  <!-- Equatorial section: automatic definition of the file name suffix based on id="EqT" -->
+<!--
+	  <file id="EqT" name_suffix="auto" >
+	    <group id="EqT" zoom_ref="EqT" >
+	      <field ref="toce" name="votemper"  />
+	    </group>
+	  </file>
+-->	  
+	  <!-- global file with different operations on data   -->
+	  <file id="global" >
+	    <field ref="sst"    name="sst_1d_ave"                       />     <!-- mean -->
+	    <field ref="sst"    name="sst_1d_max"  operation="t_max(X)" />     <!-- max -->
+	  </file>
+	</group>
+
+      </group>
+      
+      <group id="3d" output_freq="259200" output_level="10" enabled=".TRUE.">                      <!-- 3d files -->
+      </group>
+      
+      <group id="5d" output_freq="432000" output_level="10" enabled=".TRUE.">                      <!-- 5d files -->
+
+	<file id="5d_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="toce"         name="votemper"  />
+	  <field ref="soce"         name="vosaline"  />
+	  <field ref="sst"          name="sosstsst"  />
+	  <field ref="sss"          name="sosaline"  />
+	  <field ref="ssh"          name="sossheig"  />
+	  <field ref="empmr"        name="sowaflup"  />
+	  <field ref="qsr"          name="soshfldo"  />
+	  <field ref="empsmr"       name="sowaflcd"  />
+	  <field ref="qt"           name="sohefldo"  />
+	  <field ref="mldr10_1"     name="somxl010"  />
+	  <field ref="mldkz5"       name="somixhgt"  />
+	  <field ref="ice_cover"    name="soicecov"  />
+	  <field ref="wspd"         name="sowindsp"  />
+	  <field ref="qrp"          name="sohefldp"  />
+	  <field ref="erp"          name="sowafldp"  />
+	  <field ref="mlddzt"       name="sothedep"  />
+	  <field ref="20d"          name="so20chgt"  />
+	  <field ref="28d"          name="so28chgt"  />
+	  <field ref="hc300"        name="sohtc300"  />
+	  <field ref="ist_ipa"      name="soicetem"  />
+	  <field ref="icealb_cea"   name="soicealb"  />   
+	</file>
+	
+	<file id="5d_grid_U" name="auto" description="ocean U grid variables" >
+	  <field ref="uoce"         name="vozocrtx"  />
+	  <field ref="uoce_eiv"     name="vozoeivu"  />
+	  <field ref="utau"         name="sozotaux"  />
+	</file>
+	
+	<file id="5d_grid_V" name="auto" description="ocean V grid variables" >
+	  <field ref="voce"         name="vomecrty"  />
+	  <field ref="voce_eiv"     name="vomeeivv"  />
+	  <field ref="vtau"         name="sometauy"  />
+	</file>
+	
+	<file id="5d_grid_W" name="auto" description="ocean W grid variables" >
+	  <field ref="woce"         name="vovecrtz" />
+	  <field ref="woce_eiv"     name="voveeivw" />
+	  <field ref="avt"          name="votkeavt" />
+	  <field ref="avt_evd"      name="votkeevd" />
+	  <field ref="avm"          name="votkeavm" />
+	  <field ref="avm_evd"      name="votkeevm" />
+	  <field ref="avs"          name="voddmavs" />
+	  <field ref="aht2d"        name="soleahtw" />
+	  <field ref="aht2d_eiv"    name="soleaeiw" />
+	</file>
+	
+<!--	
+      <file id="5d_icemod" name="auto" description="ice variables" >
+	  <field ref="ice_pres"                     />
+	  <field ref="snowthic_cea" name="isnowthi" />
+	  <field ref="icethic_cea"  name="iicethic" />
+	  <field ref="iceprod_cea"  name="iiceprod" />
+	  <field ref="ist_ipa"      name="iicetemp" />
+	  <field ref="ioceflxb"     name="ioceflxb" />
+	  <field ref="uice_ipa"     name="iicevelu" />
+	  <field ref="vice_ipa"     name="iicevelv" />
+	  <field ref="utau_ice"     name="iicestru" />
+	  <field ref="vtau_ice"     name="iicestrv" />
+	  <field ref="qsr_io_cea"   name="iicesflx" />
+	  <field ref="qns_io_cea"   name="iicenflx" />
+	  <field ref="snowpre"      name="isnowpre" />
+	</file>
+-->	
+      </group>
+      
+      <group id="1m" output_freq="-1"     output_level="10" enabled=".TRUE.">                      <!-- real monthly files -->
+
+	<file id="1m_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="sst"          name="sosstsst"  />
+	</file>   
+
+      </group>
+
+      <group id="2m" output_freq="-2"     output_level="10" enabled=".TRUE.">                      <!-- real 2m files -->
+      </group>
+
+      <group id="3m" output_freq="-3"     output_level="10" enabled=".TRUE.">                      <!-- real 3m files -->
+      </group>
+
+      <group id="4m" output_freq="-4"     output_level="10" enabled=".TRUE.">                      <!-- real 4m files -->
+      </group>
+
+      <group id="6m" output_freq="-6"     output_level="10" enabled=".TRUE.">                      <!-- real 6m files -->
+      </group>
+
+      <group id="1y" output_freq="-12"    output_level="10" enabled=".TRUE.">                      <!-- real yearly files -->
+
+	<file id="1y_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="mldr10_1"     name="sobowlin"  operation="t_max(X)" />
+	</file>
+
+      </group>
+
+      <group id="2y"  output_freq="-24"   output_level="10" enabled=".TRUE.">                      <!-- real 2y files -->
+      </group>
+
+      <group id="5y"  output_freq="-60"   output_level="10" enabled=".TRUE.">                      <!-- real 5y files -->
+      </group>
+
+      <group id="10y" output_freq="-120"  output_level="10" enabled=".TRUE.">                      <!-- real 10y files -->
+      </group>
+
+    </file_definition>
+    
+    <!-- 
+============================================================================================================
+=                                           grid definition                                                =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+    
+    <axis_definition>  
+      <axis id="deptht" description="Vertical T levels" unit="m" positive=".false." />
+      <axis id="depthu" description="Vertical U levels" unit="m" positive=".false." />
+      <axis id="depthv" description="Vertical V levels" unit="m" positive=".false." />
+      <axis id="depthw" description="Vertical W levels" unit="m" positive=".false." />
+      <axis id="none" description="axe non defini" unit="none" size="1" />
+    </axis_definition> 
+    
+    <grid_definition>
+      <grid id="grid_T" description="grid T" >
+    <!--   Eq section   -->
+	<zoom id="EqT" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+    <!--   TAO   -->
+      <!--   137e   -->
+	<zoom id="2n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   147e   -->
+	<zoom id="0n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   156e   -->
+	<zoom id="5s156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   165e   -->
+	<zoom id="8s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   180w   -->
+	<zoom id="8s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   170w   -->
+	<zoom id="8s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   155w   -->
+	<zoom id="8s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   140w   -->
+	<zoom id="8s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   125w   -->
+	<zoom id="8s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   110w   -->
+	<zoom id="8s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   95w   -->
+	<zoom id="8s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+    <!--   RAMA   -->
+      <!--   55e   -->
+	<zoom id="16s55eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s55eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+ 	<zoom id="8s55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s55eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n55eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   65e   -->
+	<zoom id="15n65eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   67e   -->
+	<zoom id="16s67eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s67eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s67eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n67eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   80.5e   -->
+	<zoom id="16s80.5eT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s80.5eT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s80.5eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n80.5eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   90e   -->
+	<zoom id="1.5s90eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n90eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n90eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="15n90eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   95e   -->
+	<zoom id="16s95eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s95eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s95eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s95eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+    <!--   PIRATA   -->
+      <!--   38w-30w   -->
+	<zoom id="19s34wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="14s32wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s30wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n35wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n38wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n38wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="15n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="20n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   23w   -->
+	<zoom id="0n23wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n23wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n23wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="21n23wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   10w   -->
+	<zoom id="10s10wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="6s10wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n10wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   0e   -->
+	<zoom id="0n0eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      </grid>
+
+      <grid id="grid_U" description="grid U" >
+    <!--   Eq section   -->
+	<zoom id="EqU" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+      </grid>
+
+      <grid id="grid_V" description="grid V" >
+      </grid>
+
+      <grid id="grid_W" description="grid W" >
+    <!--   Eq section   -->
+	<zoom id="EqW" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+      </grid>
+
+      <grid id="scalarpoint" description="scalar" >
+	<zoom id="1point" ibegin="1" jbegin="1" ni="1" nj="1" />
+      </grid>
+
+    </grid_definition>    
+    
+  </context>
+
+</simulation>
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/namelist
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/namelist	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/namelist	(revision 3680)
@@ -0,0 +1,980 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/OPA  :  1 - run manager      (namrun)
+!! namelists    2 - Domain           (namzgr, namzgr_sco, namdom, namtsd)
+!!              3 - Surface boundary (namsbc, namsbc_ana, namsbc_flx, namsbc_clio, namsbc_core
+!!                                    namsbc_cpl, namtra_qsr, namsbc_rnf, 
+!!                                    namsbc_apr, namsbc_ssr, namsbc_alb)
+!!              4 - lateral boundary (namlbc, namcla, namobc, namagrif, nambdy, nambdy_tide)
+!!              5 - bottom  boundary (nambfr, nambbc, nambbl)
+!!              6 - Tracer           (nameos, namtra_adv, namtra_ldf, namtra_dmp)
+!!              7 - dynamics         (namdyn_adv, namdyn_vor, namdyn_hpg, namdyn_spg, namdyn_ldf)
+!!              8 - Verical physics  (namzdf, namzdf_ric, namzdf_tke, namzdf_kpp, namzdf_ddm, namzdf_tmx)
+!!              9 - diagnostics      (namnc4, namtrd, namspr, namflo, namptr, namhsb)
+!!             10 - miscellaneous    (namsol, nammpp, nammpp_dyndist, namctl)
+!!             11 - Obs & Assim      (namobs, nam_asminc)
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+!!======================================================================
+!!                   ***  Run management namelists  ***
+!!======================================================================
+!!   namrun        parameters of the run
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namrun        !   parameters of the run
+!-----------------------------------------------------------------------
+   nn_no       =       0   !  job number
+   cn_exp      =  "ORCA2"  !  experience name 
+   nn_it000    =       1   !  first time step
+   nn_itend    =    450   !  last  time step (std 5475)
+   nn_date0    =  010101   !  initial calendar date yymmdd (used if nn_rstctl=1)
+   nn_leapy    =       0   !  Leap year calendar (1) or not (0)
+   ln_rstart   = .false.   !  start from rest (F) or from a restart file (T)
+   nn_rstctl   =       0       !  restart control = 0 nn_it000 is not compared to the restart file value
+                               !                  = 1 use nn_date0 in namelist (not the value in the restart file)
+                               !                  = 2 calendar parameters read in the restart file
+   cn_ocerst_in  = "restart"   !  suffix of ocean restart name (input)
+   cn_ocerst_out = "restart"   !  suffix of ocean restart name (output)
+   nn_istate   =       0   !  output the initial state (1) or not (0)
+   nn_stock    =     450   !  frequency of creation of a restart file (modulo referenced to 1)
+   nn_write    =     45   !  frequency of write in the output file   (modulo referenced to nn_it000)
+   ln_dimgnnn  = .false.   !  DIMG file format: 1 file for all processors (F) or by processor (T)
+   ln_mskland  = .false.   !  mask land points in NetCDF outputs (costly: + ~15%)
+   ln_clobber  = .false.   !  clobber (overwrite) an existing file
+   nn_chunksz  =       0   !  chunksize (bytes) for NetCDF file (works only with iom_nf90 routines)
+/
+
+!!======================================================================
+!!                      ***  Domain namelists  ***
+!!======================================================================
+!!   namzgr       vertical coordinate
+!!   namzgr_sco   s-coordinate or hybrid z-s-coordinate
+!!   namdom       space and time domain (bathymetry, mesh, timestep)
+!!   namtsd       data: temperature & salinity                         
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namzgr        !   vertical coordinate
+!-----------------------------------------------------------------------
+   ln_zco      = .false.   !  z-coordinate - full    steps   (T/F)      ("key_zco" may also be defined)
+   ln_zps      = .true.    !  z-coordinate - partial steps   (T/F)
+   ln_sco      = .false.   !  s- or hybrid z-s-coordinate    (T/F)
+/
+!-----------------------------------------------------------------------
+&namzgr_sco    !   s-coordinate or hybrid z-s-coordinate
+!-----------------------------------------------------------------------
+   rn_sbot_min =  300.     !  minimum depth of s-bottom surface (>0) (m)
+   rn_sbot_max = 5250.     !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
+   rn_theta    =    6.0    !  surface control parameter (0<=rn_theta<=20)
+   rn_thetb    =    0.75   !  bottom control parameter  (0<=rn_thetb<= 1)
+   rn_rmax     =    0.15   !  maximum cut-off r-value allowed (0<rn_max<1)
+   ln_s_sigma  = .false.   !  hybrid s-sigma coordinates
+   rn_bb       =    0.8    !  stretching with s-sigma
+   rn_hc       =  150.0    !  critical depth with s-sigma 
+/
+!-----------------------------------------------------------------------
+&namdom        !   space and time domain (bathymetry, mesh, timestep)
+!-----------------------------------------------------------------------
+   nn_bathy    =    1      !  compute (=0) or read (=1) the bathymetry file
+   nn_closea    =   0      !  remove (=0) or keep (=1) closed seas and lakes (ORCA)
+   nn_msh      =    0      !  create (=1) a mesh file or not (=0)
+   rn_hmin     =   -3.     !  min depth of the ocean (>0) or min number of ocean level (<0)
+   rn_e3zps_min=   20.     !  partial step thickness is set larger than the minimum of
+   rn_e3zps_rat=    0.1    !  rn_e3zps_min and rn_e3zps_rat*e3t, with 0<rn_e3zps_rat<1
+                           !
+   rn_rdt      = 5760.     !  time step for the dynamics (and tracer if nn_acc=0)
+   nn_baro     =   64      !  number of barotropic time step            ("key_dynspg_ts")
+   rn_atfp     =    0.1    !  asselin time filter parameter
+   nn_acc      =    0      !  acceleration of convergence : =1      used, rdt < rdttra(k)
+                                 !                          =0, not used, rdt = rdttra
+   rn_rdtmin   = 28800.          !  minimum time step on tracers (used if nn_acc=1)
+   rn_rdtmax   = 28800.          !  maximum time step on tracers (used if nn_acc=1)
+   rn_rdth     =  800.           !  depth variation of tracer time step  (used if nn_acc=1)
+/
+!-----------------------------------------------------------------------
+&namtsd    !   data : Temperature  & Salinity                           
+!-----------------------------------------------------------------------
+!          ! file name ! frequency (hours)    ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation !
+!          !           !  (if <0  months)     !   name   !  (logical)   ! (T/F) ! 'monthly'  ! filename ! pairing  !
+   sn_tem  = 'data_1m_potential_temperature_nomask', -1,'votemper',  .true.  , .true., 'yearly'   , ' '      , ' '
+   sn_sal  = 'data_1m_salinity_nomask'             , -1,'vosaline',  .true.  , .true., 'yearly'   , ''       , ' '
+   !
+   cn_dir        = './'     !  root directory for the location of the runoff files
+   ln_tsd_init   = .true.   !  Initialisation of ocean T & S with T &S input data (T) or not (F)
+   ln_tsd_tradmp = .false.  !  damping of ocean T & S toward T &S input data (T) or not (F)
+/
+!!======================================================================
+!!            ***  Surface Boundary Condition namelists  ***
+!!======================================================================
+!!   namsbc          surface boundary condition
+!!   namsbc_ana      analytical         formulation
+!!   namsbc_flx      flux               formulation
+!!   namsbc_clio     CLIO bulk formulae formulation
+!!   namsbc_core     CORE bulk formulae formulation
+!!   namsbc_mfs      MFS  bulk formulae formulation
+!!   namsbc_cpl      CouPLed            formulation                     ("key_coupled")
+!!   namtra_qsr      penetrative solar radiation
+!!   namsbc_rnf      river runoffs
+!!   namsbc_apr      Atmospheric Pressure
+!!   namsbc_ssr      sea surface restoring term (for T and/or S)
+!!   namsbc_alb      albedo parameters
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namsbc        !   Surface Boundary Condition (surface module)
+!-----------------------------------------------------------------------
+   nn_fsbc     = 5         !  frequency of surface boundary condition computation 
+                           !     (also = the frequency of sea-ice model call)
+   ln_ana      = .false.   !  analytical formulation                    (T => fill namsbc_ana ) 
+   ln_flx      = .false.   !  flux formulation                          (T => fill namsbc_flx )
+   ln_blk_clio = .false.   !  CLIO bulk formulation                     (T => fill namsbc_clio) 
+   ln_blk_core = .true.    !  CORE bulk formulation                     (T => fill namsbc_core) 
+   ln_blk_mfs  = .false.   !  MFS bulk formulation                      (T => fill namsbc_mfs )
+   ln_cpl      = .false.   !  Coupled formulation                       (T => fill namsbc_cpl )
+   ln_apr_dyn  = .false.   !  Patm gradient added in ocean & ice Eqs.   (T => fill namsbc_apr )
+   nn_ice      = 2         !  =0 no ice boundary condition   ,
+                           !  =1 use observed ice-cover      ,
+                           !  =2 ice-model used                         ("key_lim3" or "key_lim2)
+   ln_dm2dc    = .false.   !  daily mean to diurnal cycle on short wave
+   ln_rnf      = .true.    !  runoffs                                   (T => fill namsbc_rnf)
+   ln_ssr      = .true.    !  Sea Surface Restoring on T and/or S       (T => fill namsbc_ssr)
+   nn_fwb      = 1         !  FreshWater Budget: =0 unchecked 
+                           !     =1 global mean of e-p-r set to zero at each time step 
+                           !     =2 annual global mean of e-p-r set to zero
+                           !     =3 global emp set to zero and spread out over erp area
+   ln_cdgw = .false.       !  Neutral drag coefficient read from wave model (T => fill namsbc_wave)
+/
+!-----------------------------------------------------------------------
+&namsbc_ana    !   analytical surface boundary condition
+!-----------------------------------------------------------------------
+   nn_tau000   =   0       !  gently increase the stress over the first ntau_rst time-steps
+   rn_utau0    =   0.5     !  uniform value for the i-stress
+   rn_vtau0    =   0.e0    !  uniform value for the j-stress
+   rn_qns0     =   0.e0    !  uniform value for the total heat flux
+   rn_qsr0     =   0.e0    !  uniform value for the solar radiation
+   rn_emp0     =   0.e0    !  uniform value for the freswater budget (E-P)
+/
+!-----------------------------------------------------------------------
+&namsbc_flx    !   surface boundary condition : flux formulation
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_utau     = 'utau'      ,        24         , 'utau'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_vtau     = 'vtau'      ,        24         , 'vtau'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_qtot     = 'qtot'      ,        24         , 'qtot'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_qsr      = 'qsr'       ,        24         , 'qsr'     , .false.      , .false., 'yearly'  , ''       , ''
+   sn_emp      = 'emp'       ,        24         , 'emp'     , .false.      , .false., 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the flux files
+/      
+!-----------------------------------------------------------------------
+&namsbc_clio   !   namsbc_clio  CLIO bulk formulae
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_utau     = 'taux_1m'   ,       -1          , 'sozotaux',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_vtau     = 'tauy_1m'   ,       -1          , 'sometauy',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_wndm     = 'flx'       ,       -1          , 'socliowi',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_tair     = 'flx'       ,       -1          , 'socliot2',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_humi     = 'flx'       ,       -1          , 'socliohu',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_ccov     = 'flx'       ,       -1          , 'socliocl',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_prec     = 'flx'       ,       -1          , 'socliopl',   .false.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files are
+/
+!-----------------------------------------------------------------------
+&namsbc_core   !   namsbc_core  CORE bulk formulae
+!-----------------------------------------------------------------------
+!              !  file name                    ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !                               !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_wndi     = 'u_10.15JUNE2009_orca2'       ,         6         , 'U_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Uwnd'
+   sn_wndj     = 'v_10.15JUNE2009_orca2'       ,         6         , 'V_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Vwnd'
+   sn_qsr      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'SWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_qlw      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'LWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_tair     = 't_10.15JUNE2009_orca2'       ,         6         , 'T_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_humi     = 'q_10.15JUNE2009_orca2'       ,         6         , 'Q_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_prec     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'PRC_MOD1',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_snow     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'SNOW'    ,   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_tdif     = 'taudif_core'                 ,        24         , 'taudif'  ,   .false.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files
+   ln_2m       = .false.   !  air temperature and humidity referenced at 2m (T) instead 10m (F)
+   ln_taudif   = .false.   !  HF tau contribution: use "mean of stress module - module of the mean stress" data
+   rn_pfac     = 1.        !  multiplicative factor for precipitation (total & snow)
+/
+!-----------------------------------------------------------------------
+&namsbc_mfs   !   namsbc_mfs  MFS bulk formulae
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_wndi     =   'ecmwf'   ,        6          , 'u10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
+   sn_wndj     =   'ecmwf'   ,        6          , 'v10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
+   sn_clc      =   'ecmwf'   ,        6          , 'clc'     ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''
+   sn_msl      =   'ecmwf'   ,        6          , 'msl'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
+   sn_tair     =   'ecmwf'   ,        6          , 't2'      ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
+   sn_rhm      =   'ecmwf'   ,        6          , 'rh'      ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''
+   sn_prec     =   'ecmwf'   ,        6          , 'precip'  ,    .true.    , .true.  , 'daily'  ,'bicubic.nc' , ''
+
+   cn_dir      = './ECMWF/'      !  root directory for the location of the bulk files
+/
+!-----------------------------------------------------------------------
+&namsbc_cpl    !   coupled ocean/atmosphere model                       ("key_coupled")
+!-----------------------------------------------------------------------
+!                    !     description       !  multiple  !    vector   !      vector          ! vector !
+!                    !                       ! categories !  reference  !    orientation       ! grids  !
+! send
+sn_snd_temp   =       'weighted oce and ice' ,    'no'    ,     ''      ,         ''           ,   ''    
+sn_snd_alb    =       'weighted ice'         ,    'no'    ,     ''      ,         ''           ,   ''    
+sn_snd_thick  =       'none'                 ,    'no'   ,     ''      ,         ''           ,   ''    
+sn_snd_crt    =       'none'                 ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'       
+sn_snd_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''           ,   ''        
+! receive
+sn_rcv_w10m   =       'none'                 ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_taumod =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_tau    =       'oce only'             ,    'no'    , 'cartesian' , 'eastward-northward',  'U,V'   
+sn_rcv_dqnsdt =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_qsr    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_qns    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_emp    =       'conservative'         ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_rnf    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_cal    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+/
+!-----------------------------------------------------------------------
+&namtra_qsr    !   penetrative solar radiation
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_chl      ='chlorophyll',        -1         , 'CHLA'    ,   .true.     , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the runoff files
+   ln_traqsr   = .true.    !  Light penetration (T) or not (F)
+   ln_qsr_rgb  = .true.    !  RGB (Red-Green-Blue) light penetration
+   ln_qsr_2bd  = .false.   !  2 bands              light penetration
+   ln_qsr_bio  = .false.   !  bio-model light penetration
+   nn_chldta   =      1    !  RGB : Chl data (=1) or cst value (=0)
+   rn_abs      =   0.58    !  RGB & 2 bands: fraction of light (rn_si1)
+   rn_si0      =   0.35    !  RGB & 2 bands: shortess depth of extinction
+   rn_si1      =   23.0    !  2 bands: longest depth of extinction
+/
+!-----------------------------------------------------------------------
+&namsbc_rnf    !   runoffs namelist surface boundary condition
+!-----------------------------------------------------------------------
+!              !  file name           ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !                      !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_rnf      = 'runoff_core_monthly',        -1         , 'sorunoff',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_cnf      = 'runoff_core_monthly',         0         , 'socoefr0',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_s_rnf    = 'runoffs'            ,        24         , 'rosaline',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_t_rnf    = 'runoffs'            ,        24         , 'rotemper',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_dep_rnf  = 'runoffs'            ,         0         , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir       = './'      !  root directory for the location of the runoff files
+   ln_rnf_emp   = .false.   !  runoffs included into precipitation field (T) or into a file (F)
+   ln_rnf_mouth = .true.    !  specific treatment at rivers mouths
+   rn_hrnf      =  15.e0    !  depth over which enhanced vertical mixing is used
+   rn_avt_rnf   =   1.e-3   !  value of the additional vertical mixing coef. [m2/s]
+   rn_rfact     =   1.e0    !  multiplicative factor for runoff
+   ln_rnf_depth = .false.   !  read in depth information for runoff
+   ln_rnf_tem   = .false.   !  read in temperature information for runoff
+   ln_rnf_sal   = .false.   !  read in salinity information for runoff
+/
+!-----------------------------------------------------------------------
+&namsbc_apr    !   Atmospheric pressure used as ocean forcing or in bulk
+!-----------------------------------------------------------------------
+!              ! file name ! frequency (hours) ! variable ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
+!              !           !  (if <0  months)  !   name   !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
+   sn_apr      = 'patm'    ,         -1        ,'somslpre',    .true.      , .true.  , 'yearly'  ,  ''      ,   ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files
+   ln_ref_apr  = .false.   !  ref. pressure: global mean Patm (T) or a constant (F)
+/
+!-----------------------------------------------------------------------
+&namsbc_ssr    !   surface boundary condition : sea surface restoring
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_sst      = 'sst_data'  ,        24         ,  'sst'    ,    .false.   , .false., 'yearly'  , ''       , ''
+   sn_sss      = 'sss_data'  ,        -1         ,  'sss'    ,    .true.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the runoff files
+   nn_sstr     =     0     !  add a retroaction term in the surface heat       flux (=1) or not (=0)
+   nn_sssr     =     0     !  add a damping     term in the surface freshwater flux (=2) 
+                           !  or to SSS only (=1) or no damping term (=0)
+   rn_dqdt     =   -40.    !  magnitude of the retroaction on temperature   [W/m2/K]
+   rn_deds     =  -166.67  !  magnitude of the damping on salinity   [mm/day]
+   ln_sssr_bnd =   .true.  !  flag to bound erp term (associated with nn_sssr=2)
+   rn_sssr_bnd =   4.e0    !  ABS(Max/Min) value of the damping erp term [mm/day]
+/      
+!-----------------------------------------------------------------------
+&namsbc_alb    !   albedo parameters
+!-----------------------------------------------------------------------
+   rn_cloud    =    0.06   !  cloud correction to snow and ice albedo 
+   rn_albice   =    0.53   !  albedo of melting ice in the arctic and antarctic
+   rn_alphd    =    0.80   !  coefficients for linear interpolation used to
+   rn_alphc    =    0.65   !  compute albedo between two extremes values 
+   rn_alphdi   =    0.72   !  (Pyane, 1972)
+/
+
+!!======================================================================
+!!               ***  Lateral boundary condition  ***
+!!======================================================================
+!!   namlbc        lateral momentum boundary condition
+!!   namcla        cross land advection
+!!   namobc        open boundaries parameters                           ("key_obc")
+!!   namagrif      agrif nested grid ( read by child model only )       ("key_agrif") 
+!!   nambdy        Unstructured open boundaries                         ("key_bdy")
+!!   namtide       Tidal forcing at open boundaries                     ("key_bdy_tides")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namlbc        !   lateral momentum boundary condition
+!-----------------------------------------------------------------------
+   rn_shlat    =    2.     !  shlat = 0  !  0 < shlat < 2  !  shlat = 2  !  2 < shlat
+                           !  free slip  !   partial slip  !   no slip   ! strong slip
+   ln_vorlat   = .false.   !  consistency of vorticity boundary condition with analytical eqs.
+/
+!-----------------------------------------------------------------------
+&namcla        !   cross land advection
+!-----------------------------------------------------------------------
+   nn_cla      =    0      !  advection between 2 ocean pts separates by land
+/
+!-----------------------------------------------------------------------
+&namobc        !   open boundaries parameters                           ("key_obc")
+!-----------------------------------------------------------------------
+   ln_obc_clim = .false.   !  climatological obc data files (T) or not (F)
+   ln_vol_cst  = .true.    !  impose the total volume conservation (T) or not (F)
+   ln_obc_fla  = .false.   !  Flather open boundary condition 
+   nn_obcdta   =    1      !  = 0 the obc data are equal to the initial state
+                           !  = 1 the obc data are read in 'obc.dta' files
+   cn_obcdta   = 'annual'  !  set to annual if obc datafile hold 1 year of data
+                           !  set to monthly if obc datafile hold 1 month of data
+   rn_dpein    =    1.     !  damping time scale for inflow at east  open boundary
+   rn_dpwin    =    1.     !     -           -         -       west    -      -
+   rn_dpnin    =    1.     !     -           -         -       north   -      -
+   rn_dpsin    =    1.     !     -           -         -       south   -      -
+   rn_dpeob    = 3000.     !  time relaxation (days) for the east  open boundary
+   rn_dpwob    =   15.     !     -           -         -     west    -      -
+   rn_dpnob    = 3000.     !     -           -         -     north   -      -
+   rn_dpsob    =   15.     !     -           -         -     south   -      -
+   rn_volemp   =    1.     !  = 0 the total volume change with the surface flux (E-P-R)
+                           !  = 1 the total volume remains constant
+/
+!-----------------------------------------------------------------------
+&namagrif      !  AGRIF zoom                                            ("key_agrif")
+!-----------------------------------------------------------------------
+   nn_cln_update =    3    !  baroclinic update frequency
+   ln_spc_dyn    = .true.  !  use 0 as special value for dynamics
+   rn_sponge_tra = 2880.   !  coefficient for tracer   sponge layer [m2/s]
+   rn_sponge_dyn = 2880.   !  coefficient for dynamics sponge layer [m2/s]
+/
+!-----------------------------------------------------------------------
+&nam_tide      !   tide parameters (#ifdef key_tide)
+!-----------------------------------------------------------------------
+   ln_tide_pot   = .true.   !  use tidal potential forcing
+   nb_harmo      =    11    !  number of constituents used
+   clname(1)     =   'M2'   !  name of constituent
+   clname(2)     =   'S2'
+   clname(3)     =   'N2'
+   clname(4)     =   'K1'
+   clname(5)     =   'O1'
+   clname(6)     =   'Q1'
+   clname(7)     =   'M4'
+   clname(8)     =   'K2'
+   clname(9)     =   'P1'
+   clname(10)    =   'Mf'
+   clname(11)    =   'Mm'
+/
+!-----------------------------------------------------------------------
+&nambdy        !  unstructured open boundaries                          ("key_bdy")
+!-----------------------------------------------------------------------
+    nb_bdy = 1                            !  number of open boundary sets       
+    ln_coords_file = .true.               !  =T : read bdy coordinates from file
+    cn_coords_file = 'coordinates.bdy.nc' !  bdy coordinates files
+    ln_mask_file = .false.                !  =T : read mask from file
+    cn_mask_file = ''                     !  name of mask file (if ln_mask_file=.TRUE.)
+    nn_dyn2d      =  2                    !  boundary conditions for barotropic fields
+    nn_dyn2d_dta  =  3                    !  = 0, bdy data are equal to the initial state
+                                          !  = 1, bdy data are read in 'bdydata   .nc' files
+                                          !  = 2, use tidal harmonic forcing data from files
+                                          !  = 3, use external data AND tidal harmonic forcing
+    nn_dyn3d      =  0                    !  boundary conditions for baroclinic velocities
+    nn_dyn3d_dta  =  0                    !  = 0, bdy data are equal to the initial state
+                           !  = 1, bdy data are read in 'bdydata   .nc' files
+    nn_tra        =  1                    !  boundary conditions for T and S
+    nn_tra_dta    =  1                    !  = 0, bdy data are equal to the initial state
+                           !  = 1, bdy data are read in 'bdydata   .nc' files
+    nn_rimwidth  = 10                      !  width of the relaxation zone
+    ln_vol     = .false.                  !  total volume correction (see nn_volctl parameter)
+    nn_volctl  = 1                        !  = 0, the total water flux across open boundaries is zero
+/
+!-----------------------------------------------------------------------
+&nambdy_dta      !  open boundaries - external data           ("key_bdy")
+!-----------------------------------------------------------------------
+!              !   file name    ! frequency (hours) !  variable  ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
+!              !                !  (if <0  months)  !    name    !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
+   bn_ssh =     'amm12_bdyT_u2d' ,         24        , 'sossheig' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_u2d =     'amm12_bdyU_u2d' ,         24        , 'vobtcrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_v2d =     'amm12_bdyV_u2d' ,         24        , 'vobtcrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_u3d  =    'amm12_bdyU_u3d' ,         24        , 'vozocrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_v3d  =    'amm12_bdyV_u3d' ,         24        , 'vomecrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_tem  =    'amm12_bdyT_tra' ,         24        , 'votemper' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_sal  =    'amm12_bdyT_tra' ,         24        , 'vosaline' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   cn_dir  =    'bdydta/'
+   ln_full_vel = .false.
+/
+!-----------------------------------------------------------------------
+&nambdy_tide     ! tidal forcing at open boundaries              
+!-----------------------------------------------------------------------
+   filtide      = 'bdydta/amm12_bdytide_'         !  file name root of tidal forcing files
+    tide_cpt(1)   ='Q1'  !  names of tidal components used
+    tide_cpt(2)   ='O1'  !  names of tidal components used
+    tide_cpt(3)   ='P1'  !  names of tidal components used
+    tide_cpt(4)   ='S1'  !  names of tidal components used
+    tide_cpt(5)   ='K1'  !  names of tidal components used
+    tide_cpt(6)   ='2N2' !  names of tidal components used
+    tide_cpt(7)   ='MU2' !  names of tidal components used
+    tide_cpt(8)   ='N2'  !  names of tidal components used
+    tide_cpt(9)   ='NU2' !  names of tidal components used
+    tide_cpt(10)   ='M2'  !  names of tidal components used
+    tide_cpt(11)   ='L2'  !  names of tidal components used
+    tide_cpt(12)   ='T2'  !  names of tidal components used
+    tide_cpt(13)   ='S2'  !  names of tidal components used
+    tide_cpt(14)   ='K2'  !  names of tidal components used
+    tide_cpt(15)   ='M4'  !  names of tidal components used
+    tide_speed(1)   = 13.398661 !  phase speeds of tidal components (deg/hour)
+    tide_speed(2)   = 13.943036 !  phase speeds of tidal components (deg/hour)
+    tide_speed(3)   = 14.958932 !  phase speeds of tidal components (deg/hour)
+    tide_speed(4)   = 15.000001 !  phase speeds of tidal components (deg/hour)
+    tide_speed(5)   = 15.041069 !  phase speeds of tidal components (deg/hour)
+    tide_speed(6)   = 27.895355 !  phase speeds of tidal components (deg/hour)
+    tide_speed(7)   = 27.968210 !  phase speeds of tidal components (deg/hour)
+    tide_speed(8)   = 28.439730 !  phase speeds of tidal components (deg/hour)
+    tide_speed(9)   = 28.512585 !  phase speeds of tidal components (deg/hour)
+    tide_speed(10)   = 28.984106 !  phase speeds of tidal components (deg/hour)
+    tide_speed(11)   = 29.528479 !  phase speeds of tidal components (deg/hour)
+    tide_speed(12)   = 29.958935 !  phase speeds of tidal components (deg/hour)
+    tide_speed(13)   = 30.000002 !  phase speeds of tidal components (deg/hour)
+    tide_speed(14)   = 30.082138 !  phase speeds of tidal components (deg/hour)
+    tide_speed(15)   = 57.968212 !  phase speeds of tidal components (deg/hour)
+    ln_tide_date = .true.               !  adjust tidal harmonics for start date of run
+/
+!!======================================================================
+!!                 ***  Bottom boundary condition  ***
+!!======================================================================
+!!   nambfr        bottom friction
+!!   nambbc        bottom temperature boundary condition               
+!!   nambbl        bottom boundary layer scheme                         ("key_trabbl")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&nambfr        !   bottom friction
+!-----------------------------------------------------------------------
+   nn_bfr      =    1      !  type of bottom friction :   = 0 : free slip,  = 1 : linear friction
+                           !                              = 2 : nonlinear friction
+   rn_bfri1    =    4.e-4  !  bottom drag coefficient (linear case)
+   rn_bfri2    =    1.e-3  !  bottom drag coefficient (non linear case)
+   rn_bfeb2    =    2.5e-3 !  bottom turbulent kinetic energy background  (m2/s2)
+   ln_bfr2d    = .false.   !  horizontal variation of the bottom friction coef (read a 2D mask file )
+   rn_bfrien   =    50.    !  local multiplying factor of bfr (ln_bfr2d=T)
+   ln_bfrimp   = .true.    !  implicit bottom friction (requires ln_zdfexp = .false. if true)
+/
+!-----------------------------------------------------------------------
+&nambbc        !   bottom temperature boundary condition
+!-----------------------------------------------------------------------
+   ln_trabbc   = .true.    !  Apply a geothermal heating at the ocean bottom
+   nn_geoflx   =    2      !  geothermal heat flux: = 0 no flux 
+                           !     = 1 constant flux
+                           !     = 2 variable flux (read in geothermal_heating.nc in mW/m2) 
+   rn_geoflx_cst = 86.4e-3 !  Constant value of geothermal heat flux [W/m2]
+/
+!-----------------------------------------------------------------------
+&nambbl        !   bottom boundary layer scheme
+!-----------------------------------------------------------------------
+   nn_bbl_ldf  =  1      !  diffusive bbl (=1)   or not (=0)
+   nn_bbl_adv  =  0      !  advective bbl (=1/2) or not (=0)
+   rn_ahtbbl   =  1000.  !  lateral mixing coefficient in the bbl  [m2/s]
+   rn_gambbl   =  10.    !  advective bbl coefficient                 [s]
+/
+
+!!======================================================================
+!!                        Tracer (T & S ) namelists
+!!======================================================================
+!!   nameos        equation of state
+!!   namtra_adv    advection scheme
+!!   namtra_ldf    lateral diffusion scheme
+!!   namtra_dmp    T & S newtonian damping                        
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&nameos        !   ocean physical parameters
+!-----------------------------------------------------------------------
+   nn_eos      =   0       !  type of equation of state and Brunt-Vaisala frequency
+                           !     = 0, UNESCO (formulation of Jackett and McDougall (1994) and of McDougall (1987) )
+                           !     = 1, linear: rho(T)   = rau0 * ( 1.028 - ralpha * T )
+                           !     = 2, linear: rho(T,S) = rau0 * ( rbeta * S - ralpha * T )
+   rn_alpha    =   2.0e-4  !  thermal expension coefficient (nn_eos= 1 or 2)
+   rn_beta     =   7.7e-4  !  saline  expension coefficient (nn_eos= 2)
+/
+!-----------------------------------------------------------------------
+&namtra_adv    !   advection scheme for tracer 
+!-----------------------------------------------------------------------
+   ln_traadv_cen2   =  .false.  !  2nd order centered scheme   
+   ln_traadv_tvd    =  .false.  !  TVD scheme                
+   ln_traadv_muscl  =  .true.   !  MUSCL scheme             
+   ln_traadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries  
+   ln_traadv_ubs    =  .false.  !  UBS scheme                 
+   ln_traadv_qck    =  .false.  !  QUICKEST scheme                 
+/
+!-----------------------------------------------------------------------
+&namtra_ldf    !   lateral diffusion scheme for tracer 
+!-----------------------------------------------------------------------
+   !                       !  Type of the operator : 
+   ln_traldf_lap    =  .true.   !  laplacian operator       
+   ln_traldf_bilap  =  .false.  !  bilaplacian operator     
+   !                       !  Direction of action  :
+   ln_traldf_level  =  .false.  !  iso-level                
+   ln_traldf_hor    =  .false.  !  horizontal (geopotential)            (require "key_ldfslp" when ln_sco=T)
+   ln_traldf_iso    =  .true.   !  iso-neutral                          (require "key_ldfslp")
+   ln_traldf_grif   =  .false.  !  griffies skew flux formulation       (require "key_ldfslp")
+   ln_traldf_gdia   =  .false.  !  griffies operator strfn diagnostics  (require "key_ldfslp")
+   ln_triad_iso     =  .false.  !  griffies operator calculates triads twice => pure lateral mixing in ML (require "key_ldfslp")
+   ln_botmix_grif   =  .false.  !  griffies operator with lateral mixing on bottom (require "key_ldfslp")
+                         !  Coefficient
+   rn_aht_0         =  2000.    !  horizontal eddy diffusivity for tracers [m2/s]
+   rn_ahtb_0        =     0.    !  background eddy diffusivity for ldf_iso [m2/s]
+   rn_aeiv_0        =  2000.    !  eddy induced velocity coefficient [m2/s]    (require "key_traldf_eiv")
+/
+!-----------------------------------------------------------------------
+&namtra_dmp    !   tracer: T & S newtonian damping                  
+!-----------------------------------------------------------------------
+   ln_tradmp   =  .false.  !  add a damping termn (T) or not (F)
+   nn_hdmp     =   -2      !  horizontal shape =-1, damping in Med and Red Seas only
+                           !                   =XX, damping poleward of XX degrees (XX>0)
+                           !                      + F(distance-to-coast) + Red and Med Seas
+   nn_zdmp     =    0      !  vertical   shape =0    damping throughout the water column
+                           !                   =1 no damping in the mixing layer (kz  criteria)
+                           !                   =2 no damping in the mixed  layer (rho crieria)
+   rn_surf     =   50.     !  surface time scale of damping   [days]
+   rn_bot      =  360.     !  bottom  time scale of damping   [days]
+   rn_dep      =  800.     !  depth of transition between rn_surf and rn_bot [meters]
+   nn_file     =    0      !  create a damping.coeff NetCDF file (=1) or not (=0)
+/
+
+!!======================================================================
+!!                      ***  Dynamics namelists  ***
+!!======================================================================
+!!   namdyn_adv    formulation of the momentum advection
+!!   namdyn_vor    advection scheme
+!!   namdyn_hpg    hydrostatic pressure gradient
+!!   namdyn_spg    surface pressure gradient                            (CPP key only)
+!!   namdyn_ldf    lateral diffusion scheme
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namdyn_adv    !   formulation of the momentum advection
+!-----------------------------------------------------------------------
+   ln_dynadv_vec = .true.  !  vector form (T) or flux form (F)  
+   ln_dynadv_cen2= .false. !  flux form - 2nd order centered scheme
+   ln_dynadv_ubs = .false. !  flux form - 3rd order UBS      scheme 
+/  
+!-----------------------------------------------------------------------
+&namdyn_vor    !   option of physics/algorithm (not control by CPP keys)
+!-----------------------------------------------------------------------
+   ln_dynvor_ene = .false. !  enstrophy conserving scheme  
+   ln_dynvor_ens = .false. !  energy conserving scheme    
+   ln_dynvor_mix = .false. !  mixed scheme               
+   ln_dynvor_een = .true.  !  energy & enstrophy scheme  
+/
+!-----------------------------------------------------------------------
+&namdyn_hpg    !   Hydrostatic pressure gradient option
+!-----------------------------------------------------------------------
+   ln_hpg_zco  = .false.   !  z-coordinate - full steps                   
+   ln_hpg_zps  = .true.    !  z-coordinate - partial steps (interpolation)
+   ln_hpg_sco  = .false.   !  s-coordinate (standard jacobian formulation)
+   ln_hpg_djc  = .false.   !  s-coordinate (Density Jacobian with Cubic polynomial)
+   ln_hpg_prj  = .false.   !  s-coordinate (Pressure Jacobian scheme)
+   ln_dynhpg_imp = .false. !  time stepping: semi-implicit time scheme  (T)
+                                 !           centered      time scheme  (F)
+/
+!-----------------------------------------------------------------------
+!namdyn_spg    !   surface pressure gradient   (CPP key only)
+!-----------------------------------------------------------------------
+!                          !  explicit free surface                     ("key_dynspg_exp")
+!                          !  filtered free surface                     ("key_dynspg_flt")
+!                          !  split-explicit free surface               ("key_dynspg_ts")
+
+!-----------------------------------------------------------------------
+&namdyn_ldf    !   lateral diffusion on momentum
+!-----------------------------------------------------------------------
+   !                       !  Type of the operator : 
+   ln_dynldf_lap    =  .true.   !  laplacian operator         
+   ln_dynldf_bilap  =  .false.  !  bilaplacian operator    
+   !                       !  Direction of action  : 
+   ln_dynldf_level  =  .false.  !  iso-level               
+   ln_dynldf_hor    =  .true.   !  horizontal (geopotential)            (require "key_ldfslp" in s-coord.)
+   ln_dynldf_iso    =  .false.  !  iso-neutral                          (require "key_ldfslp")
+   !                       !  Coefficient
+   rn_ahm_0_lap     = 40000.    !  horizontal laplacian eddy viscosity   [m2/s]
+   rn_ahmb_0        =     0.    !  background eddy viscosity for ldf_iso [m2/s]
+   rn_ahm_0_blp     =     0.    !  horizontal bilaplacian eddy viscosity [m4/s] 
+/
+
+!!======================================================================
+!!             Tracers & Dynamics vertical physics namelists
+!!======================================================================
+!!    namzdf        vertical physics
+!!    namzdf_ric    richardson number dependent vertical mixing         ("key_zdfric")
+!!    namzdf_tke    TKE dependent vertical mixing                       ("key_zdftke")
+!!    namzdf_kpp    KPP dependent vertical mixing                       ("key_zdfkpp")
+!!    namzdf_ddm    double diffusive mixing parameterization            ("key_zdfddm")
+!!    namzdf_tmx    tidal mixing parameterization                       ("key_zdftmx")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namzdf        !   vertical physics
+!-----------------------------------------------------------------------
+   rn_avm0     =   1.2e-4  !  vertical eddy viscosity   [m2/s]          (background Kz if not "key_zdfcst")
+   rn_avt0     =   1.2e-5  !  vertical eddy diffusivity [m2/s]          (background Kz if not "key_zdfcst")
+   nn_avb      =    0      !  profile for background avt & avm (=1) or not (=0)
+   nn_havtb    =    0      !  horizontal shape for avtb (=1) or not (=0)
+   ln_zdfevd   = .true.    !  enhanced vertical diffusion (evd) (T) or not (F)
+   nn_evdm     =    0      !  evd apply on tracer (=0) or on tracer and momentum (=1)
+   rn_avevd    =  100.     !  evd mixing coefficient [m2/s]
+   ln_zdfnpc   = .false.   !  Non-Penetrative Convective algorithm (T) or not (F)
+   nn_npc      =    1            !  frequency of application of npc
+   nn_npcp     =  365            !  npc control print frequency
+   ln_zdfexp   = .false.   !  time-stepping: split-explicit (T) or implicit (F) time stepping
+   nn_zdfexp   =    3            !  number of sub-timestep for ln_zdfexp=T
+/
+!-----------------------------------------------------------------------
+&namzdf_ric    !   richardson number dependent vertical diffusion       ("key_zdfric" )
+!-----------------------------------------------------------------------
+   rn_avmri    = 100.e-4   !  maximum value of the vertical viscosity
+   rn_alp      =   5.      !  coefficient of the parameterization
+   nn_ric      =   2       !  coefficient of the parameterization
+   rn_ekmfc    =   0.7     !  Factor in the Ekman depth Equation
+   rn_mldmin   =   1.0     !  minimum allowable mixed-layer depth estimate (m)
+   rn_mldmax   =1000.0     !  maximum allowable mixed-layer depth estimate (m)
+   rn_wtmix    =  10.0     !  vertical eddy viscosity coeff [m2/s] in the mixed-layer
+   rn_wvmix    =  10.0     !  vertical eddy diffusion coeff [m2/s] in the mixed-layer
+   ln_mldw     = .true.    !  Flag to use or not the mized layer depth param.
+/
+!-----------------------------------------------------------------------
+&namzdf_tke    !   turbulent eddy kinetic dependent vertical diffusion  ("key_zdftke")
+!-----------------------------------------------------------------------
+   rn_ediff    =   0.1     !  coef. for vertical eddy coef. (avt=rn_ediff*mxl*sqrt(e) )
+   rn_ediss    =   0.7     !  coef. of the Kolmogoroff dissipation
+   rn_ebb      =  67.83    !  coef. of the surface input of tke (=67.83 suggested when ln_mxl0=T)
+   rn_emin     =   1.e-6   !  minimum value of tke [m2/s2]
+   rn_emin0    =   1.e-4   !  surface minimum value of tke [m2/s2]
+   nn_mxl      =   2       !  mixing length: = 0 bounded by the distance to surface and bottom
+                           !                 = 1 bounded by the local vertical scale factor
+                           !                 = 2 first vertical derivative of mixing length bounded by 1
+                           !                 = 3 as =2 with distinct disspipative an mixing length scale
+   nn_pdl      =   1       !  Prandtl number function of richarson number (=1, avt=pdl(Ri)*avm) or not (=0, avt=avm)
+   ln_mxl0     = .true.    !  surface mixing length scale = F(wind stress) (T) or not (F)
+   rn_mxl0     =   0.04    !  surface  buoyancy lenght scale minimum value
+   ln_lc       = .true.    !  Langmuir cell parameterisation (Axell 2002)
+   rn_lc       =   0.15    !  coef. associated to Langmuir cells
+   nn_etau     =   1       !  penetration of tke below the mixed layer (ML) due to internal & intertial waves
+                           !        = 0 no penetration
+                           !        = 1 add a tke source below the ML
+                           !        = 2 add a tke source just at the base of the ML
+                           !        = 3 as = 1 applied on HF part of the stress    ("key_coupled")
+   rn_efr      =   0.05    !  fraction of surface tke value which penetrates below the ML (nn_etau=1 or 2)
+   nn_htau     =   1       !  type of exponential decrease of tke penetration below the ML
+                           !        = 0  constant 10 m length scale
+                           !        = 1  0.5m at the equator to 30m poleward of 40 degrees
+/
+!------------------------------------------------------------------------
+&namzdf_kpp    !   K-Profile Parameterization dependent vertical mixing  ("key_zdfkpp", and optionally:
+!------------------------------------------------------------------------ "key_kppcustom" or "key_kpplktb")
+   ln_kpprimix = .true.    !  shear instability mixing 
+   rn_difmiw   =  1.0e-04  !  constant internal wave viscosity [m2/s]
+   rn_difsiw   =  0.1e-04  !  constant internal wave diffusivity [m2/s]
+   rn_riinfty  =  0.8      !  local Richardson Number limit for shear instability
+   rn_difri    =  0.0050   !  maximum shear mixing at Rig = 0    [m2/s]
+   rn_bvsqcon  = -0.01e-07 !  Brunt-Vaisala squared for maximum convection [1/s2] 
+   rn_difcon   =  1.       !  maximum mixing in interior convection [m2/s] 
+   nn_avb      =  0        !  horizontal averaged (=1) or not (=0) on avt and amv
+   nn_ave      =  1        !  constant (=0) or profile (=1) background on avt
+/
+!-----------------------------------------------------------------------
+&namzdf_gls                !   GLS vertical diffusion                   ("key_zdfgls")
+!-----------------------------------------------------------------------
+   rn_emin       = 1.e-6   !  minimum value of e   [m2/s2]
+   rn_epsmin     = 1.e-12  !  minimum value of eps [m2/s3]
+   ln_length_lim = .true.  !  limit on the dissipation rate under stable stratification (Galperin et al., 1988)
+   rn_clim_galp  = 0.53    !  galperin limit
+   ln_crban      = .true.  !  Use Craig & Banner (1994) surface wave mixing parametrisation
+   ln_sigpsi     = .true.  !  Activate or not Burchard 2001 mods on psi schmidt number in the wb case
+   rn_crban      = 100.    !  Craig and Banner 1994 constant for wb tke flux
+   rn_charn      = 70000.  !  Charnock constant for wb induced roughness length
+   nn_tkebc_surf =   1     !  surface tke condition (0/1/2=Dir/Neum/Dir Mellor-Blumberg)
+   nn_tkebc_bot  =   1     !  bottom tke condition (0/1=Dir/Neum)
+   nn_psibc_surf =   1     !  surface psi condition (0/1/2=Dir/Neum/Dir Mellor-Blumberg)
+   nn_psibc_bot  =   1     !  bottom psi condition (0/1=Dir/Neum)
+   nn_stab_func  =   2     !  stability function (0=Galp, 1= KC94, 2=CanutoA, 3=CanutoB)
+   nn_clos       =   1     !  predefined closure type (0=MY82, 1=k-eps, 2=k-w, 3=Gen)
+/
+!-----------------------------------------------------------------------
+&namzdf_ddm    !   double diffusive mixing parameterization             ("key_zdfddm")
+!-----------------------------------------------------------------------
+   rn_avts     = 1.e-4     !  maximum avs (vertical mixing on salinity)
+   rn_hsbfr    = 1.6       !  heat/salt buoyancy flux ratio
+/
+!-----------------------------------------------------------------------
+&namzdf_tmx    !   tidal mixing parameterization                        ("key_zdftmx")
+!-----------------------------------------------------------------------
+   rn_htmx     = 500.      !  vertical decay scale for turbulence (meters)
+   rn_n2min    = 1.e-8     !  threshold of the Brunt-Vaisala frequency (s-1)
+   rn_tfe      = 0.333     !  tidal dissipation efficiency
+   rn_me       = 0.2       !  mixing efficiency 
+   ln_tmx_itf  = .true.    !  ITF specific parameterisation
+   rn_tfe_itf  = 1.        !  ITF tidal dissipation efficiency
+/
+
+!!======================================================================
+!!                  ***  Miscellaneous namelists  ***
+!!======================================================================
+!!   nammpp            Massively Parallel Processing                    ("key_mpp_mpi)
+!!   namctl            Control prints & Benchmark
+!!   namsol            elliptic solver / island / free surface 
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namsol        !   elliptic solver / island / free surface 
+!-----------------------------------------------------------------------
+   nn_solv     =      1    !  elliptic solver: =1 preconditioned conjugate gradient (pcg)
+                           !                   =2 successive-over-relaxation (sor)
+   nn_sol_arp  =      0    !  absolute/relative (0/1) precision convergence test
+   rn_eps      =  1.e-6    !  absolute precision of the solver
+   nn_nmin     =    300    !  minimum of iterations for the SOR solver
+   nn_nmax     =    800    !  maximum of iterations for the SOR solver
+   nn_nmod     =     10    !  frequency of test for the SOR solver
+   rn_resmax   =  1.e-10   !  absolute precision for the SOR solver
+   rn_sor      =  1.92     !  optimal coefficient for SOR solver (to be adjusted with the domain)
+/
+!-----------------------------------------------------------------------
+&nammpp        !   Massively Parallel Processing                        ("key_mpp_mpi)
+!-----------------------------------------------------------------------
+   cn_mpi_send =  'I'      !  mpi send/recieve type   ='S', 'B', or 'I' for standard send,
+                           !  buffer blocking send or immediate non-blocking sends, resp.
+   nn_buffer   =   0       !  size in bytes of exported buffer ('B' case), 0 no exportation
+   ln_nnogather=  .false.  !  activate code to avoid mpi_allgather use at the northfold
+   jpni        =   0       !  jpni   number of processors following i (set automatically if < 1)
+   jpnj        =   0       !  jpnj   number of processors following j (set automatically if < 1)
+   jpnij       =   0       !  jpnij  number of local domains (set automatically if < 1)
+/
+!-----------------------------------------------------------------------
+&namctl        !   Control prints & Benchmark
+!-----------------------------------------------------------------------
+   ln_ctl      = .false.   !  trends control print (expensive!)
+   nn_print    =    0      !  level of print (0 no extra print)
+   nn_ictls    =    0      !  start i indice of control sum (use to compare mono versus
+   nn_ictle    =    0      !  end   i indice of control sum        multi processor runs
+   nn_jctls    =    0      !  start j indice of control               over a subdomain)
+   nn_jctle    =    0      !  end   j indice of control
+   nn_isplt    =    1      !  number of processors in i-direction
+   nn_jsplt    =    1      !  number of processors in j-direction
+   nn_bench    =    0      !  Bench mode (1/0): CAUTION use zero except for bench
+                           !     (no physical validity of the results)
+   nn_timing   =    1      !  timing by routine activated (=1) creates timing.output file, or not (=0)
+/
+
+!!======================================================================
+!!                  ***  Diagnostics namelists  ***
+!!======================================================================
+!!   namnc4       netcdf4 chunking and compression settings             ("key_netcdf4")
+!!   namtrd       dynamics and/or tracer trends                         ("key_trddyn","key_trdtra","key_trdmld")
+!!   namflo       float parameters                                      ("key_float")
+!!   namptr       Poleward Transport Diagnostics
+!!   namhsb       Heat and salt budgets 
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namnc4        !   netcdf4 chunking and compression settings            ("key_netcdf4")
+!-----------------------------------------------------------------------
+   nn_nchunks_i=   4       !  number of chunks in i-dimension
+   nn_nchunks_j=   4       !  number of chunks in j-dimension
+   nn_nchunks_k=   31      !  number of chunks in k-dimension
+                           !  setting nn_nchunks_k = jpk will give a chunk size of 1 in the vertical which
+                           !  is optimal for postprocessing which works exclusively with horizontal slabs
+   ln_nc4zip   = .true.    !  (T) use netcdf4 chunking and compression
+                           !  (F) ignore chunking information and produce netcdf3-compatible files
+/
+!-----------------------------------------------------------------------
+&namtrd        !   diagnostics on dynamics and/or tracer trends         ("key_trddyn" and/or "key_trdtra")
+!              !       or mixed-layer trends or barotropic vorticity    ("key_trdmld" or     "key_trdvor")
+!-----------------------------------------------------------------------
+   nn_trd      = 365       !  time step frequency dynamics and tracers trends
+   nn_ctls     =   0       !  control surface type in mixed-layer trends (0,1 or n<jpk)
+   rn_ucf      =   1.      !  unit conversion factor (=1 -> /seconds ; =86400. -> /day)
+   cn_trdrst_in      = "restart_mld"   ! suffix of ocean restart name (input)
+   cn_trdrst_out     = "restart_mld"   ! suffix of ocean restart name (output)
+   ln_trdmld_restart = .false.         !  restart for ML diagnostics
+   ln_trdmld_instant = .false.         !  flag to diagnose trends of instantantaneous or mean ML T/S
+/
+!-----------------------------------------------------------------------
+&namflo       !   float parameters                                      ("key_float")
+!-----------------------------------------------------------------------
+   jpnfl         = 1          !  total number of floats during the run
+   jpnnewflo     = 0          !  number of floats for the restart
+   ln_rstflo     = .false.    !  float restart (T) or not (F)
+   nn_writefl    =      75    !  frequency of writing in float output file 
+   nn_stockfl    =    5475    !  frequency of creation of the float restart file 
+   ln_argo       = .false.    !  Argo type floats (stay at the surface each 10 days)
+   ln_flork4     = .false.    !  trajectories computed with a 4th order Runge-Kutta (T)
+                              !  or computed with Blanke' scheme (F)
+   ln_ariane     = .true.     !  Input with Ariane tool convention(T)
+   ln_flo_ascii  = .true.     !  Output with Ariane tool netcdf convention(F) or ascii file (T)
+/
+!-----------------------------------------------------------------------
+&namptr       !   Poleward Transport Diagnostic
+!-----------------------------------------------------------------------
+   ln_diaptr  = .false.    !  Poleward heat and salt transport (T) or not (F)
+   ln_diaznl  = .true.     !  Add zonal means and meridional stream functions
+   ln_subbas  = .true.     !  Atlantic/Pacific/Indian basins computation (T) or not 
+                           !  (orca configuration only, need input basins mask file named "subbasins.nc"
+   ln_ptrcomp = .true.     !  Add decomposition : overturning
+   nn_fptr    =  1         !  Frequency of ptr computation [time step]
+   nn_fwri    =  15        !  Frequency of ptr outputs [time step]
+/
+!-----------------------------------------------------------------------
+&namhsb       !  Heat and salt budgets 
+!-----------------------------------------------------------------------
+   ln_diahsb  = .false.    !  check the heat and salt budgets (T) or not (F)
+/
+!-----------------------------------------------------------------------
+&nam_diaharm   !   Harmonic analysis of tidal constituents ('key_diaharm')
+!-----------------------------------------------------------------------
+    nit000_han = 1         ! First time step used for harmonic analysis
+    nitend_han = 75        ! Last time step used for harmonic analysis
+    nstep_han  = 15        ! Time step frequency for harmonic analysis
+    tname(1)   = 'M2'      ! Name of tidal constituents
+    tname(2)   = 'K1'
+/
+!-----------------------------------------------------------------------
+&namdct        ! transports through sections
+!-----------------------------------------------------------------------
+    nn_dct      = 15       !  time step frequency for transports computing
+    nn_dctwri   = 15       !  time step frequency for transports writing
+    nn_secdebug = 112      !      0 : no section to debug
+                           !     -1 : debug all section
+                           !  0 < n : debug section number n
+/
+
+!!======================================================================
+!!            ***  Observation & Assimilation namelists ***
+!!======================================================================
+!!   namobs       observation and model comparison                      ('key_diaobs')
+!!   nam_asminc   assimilation increments                               ('key_asminc')
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namobs       !  observation usage switch                               ('key_diaobs')
+!-----------------------------------------------------------------------
+   ln_t3d     = .false.    ! Logical switch for T profile observations         
+   ln_s3d     = .false.    ! Logical switch for S profile observations          
+   ln_ena     = .false.    ! Logical switch for ENACT insitu data set           
+   !                       !     ln_cor                  Logical switch for Coriolis insitu data set       
+   ln_profb   = .false.    ! Logical switch for feedback insitu data set     
+   ln_sla     = .false.    ! Logical switch for SLA observations               
+
+   ln_sladt   = .false.    ! Logical switch for AVISO SLA data              
+
+   ln_slafb   = .false.    ! Logical switch for feedback SLA data            
+                           !     ln_ssh                  Logical switch for SSH observations              
+
+   ln_sst     = .false.    ! Logical switch for SST observations              
+                           !     ln_reysst               Logical switch for Reynolds observations       
+                           !     ln_ghrsst               Logical switch for GHRSST observations          
+
+   ln_sstfb   = .false.    ! Logical switch for feedback SST data          
+                           !     ln_sss                  Logical switch for SSS observations              
+                           !     ln_seaice               Logical switch for Sea Ice observations        
+                           !     ln_vel3d                Logical switch for velocity observations         
+                           !     ln_velavcur             Logical switch for velocity daily av. cur.    
+                           !     ln_velhrcur             Logical switch for velocity high freq. cur.   
+                           !     ln_velavadcp            Logical switch for velocity daily av. ADCP  
+                           !     ln_velhradcp            Logical switch for velocity high freq. ADCP
+                           !     ln_velfb                Logical switch for feedback velocity data       
+                           !     ln_grid_global          Global distribtion of observations         
+                           !     ln_grid_search_lookup   Logical switch for obs grid search w/lookup table  
+                           !     grid_search_file        Grid search lookup file header 
+                           !     enactfiles              ENACT input observation file names 
+                           !     coriofiles              Coriolis input observation file name  
+   !                       ! profbfiles: Profile feedback input observation file name 
+   profbfiles = 'profiles_01.nc'
+                           !     ln_profb_enatim         Enact feedback input time setting switch    
+                           !     slafilesact             Active SLA input observation file name
+                           !     slafilespas             Passive SLA input observation file name 
+   !                       ! slafbfiles: Feedback SLA input observation file name 
+   slafbfiles = 'sla_01.nc'
+                           !     sstfiles                GHRSST input observation file name       
+   !                       ! sstfbfiles: Feedback SST input observation file name 
+   sstfbfiles = 'sst_01.nc' 'sst_02.nc' 'sst_03.nc' 'sst_04.nc' 'sst_05.nc'
+                           !     seaicefiles             Sea Ice input observation file name 
+                           !     velavcurfiles           Vel. cur. daily av. input file name  
+                           !     velhvcurfiles           Vel. cur. high freq. input file name  
+                           !     velavadcpfiles          Vel. ADCP daily av. input file name    
+                           !     velhvadcpfiles          Vel. ADCP high freq. input file name 
+                           !     velfbfiles              Vel. feedback input observation file name 
+                           !     dobsini                 Initial date in window YYYYMMDD.HHMMSS       
+                           !     dobsend                 Final date in window YYYYMMDD.HHMMSS         
+                           !     n1dint                  Type of vertical interpolation method        
+                           !     n2dint                  Type of horizontal interpolation method       
+                           !     ln_nea                  Rejection of observations near land switch    
+   nmsshc     = 0          ! MSSH correction scheme                         
+                           !     mdtcorr                 MDT  correction                               
+                           !     mdtcutoff               MDT cutoff for computed correction          
+   ln_altbias = .false.    ! Logical switch for alt bias                
+   ln_ignmis  = .true.     ! Logical switch for ignoring missing files   
+                           !     endailyavtypes   ENACT daily average types                    
+   ln_grid_global = .true.
+   ln_grid_search_lookup = .false.
+/ 
+!-----------------------------------------------------------------------
+&nam_asminc   !   assimilation increments                               ('key_asminc')
+!-----------------------------------------------------------------------
+    ln_bkgwri = .false.    !  Logical switch for writing out background state 
+    ln_trjwri = .false.    !  Logical switch for writing out state trajectory
+    ln_trainc = .false.    !  Logical switch for applying tracer increments
+    ln_dyninc = .false.    !  Logical switch for applying velocity increments
+    ln_sshinc = .false.    !  Logical switch for applying SSH increments 
+    ln_asmdin = .false.    !  Logical switch for Direct Initialization (DI)
+    ln_asmiau = .false.    !  Logical switch for Incremental Analysis Updating (IAU)
+    nitbkg    = 0          !  Timestep of background in [0,nitend-nit000-1]
+    nitdin    = 0          !  Timestep of background for DI in [0,nitend-nit000-1]
+    nitiaustr = 1          !  Timestep of start of IAU interval in [0,nitend-nit000-1]
+    nitiaufin = 15         !  Timestep of end of IAU interval in [0,nitend-nit000-1]
+    niaufn    = 0          !  Type of IAU weighting function
+    nittrjfrq = 0          !  Frequency of trajectory output for 4D-VAR
+    ln_salfix = .false.    !  Logical switch for ensuring that the sa > salfixmin
+    salfixmin = -9999      !  Minimum salinity after applying the increments
+    nn_divdmp = 0          !  Number of iterations of divergence damping operator
+/
+!-----------------------------------------------------------------------
+&namsbc_wave   ! External fields from wave model
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_cdg      =  'cdg_wave' ,        1          , 'drag_coeff' , .true.   , .false. , 'daily'  ,''         , ''
+!
+   cn_dir_cdg  = './'  !  root directory for the location of drag coefficient files
+/
+!-----------------------------------------------------------------------
+&namdyn_nept  !   Neptune effect (simplified: lateral and vertical diffusions removed)
+!-----------------------------------------------------------------------
+   ! Suggested lengthscale values are those of Eby & Holloway (1994) for a coarse model
+   ln_neptsimp       = .false.  ! yes/no use simplified neptune
+
+   ln_smooth_neptvel = .false.  ! yes/no smooth zunep, zvnep
+   rn_tslse          =  1.2e4   ! value of lengthscale L at the equator
+   rn_tslsp          =  3.0e3   ! value of lengthscale L at the pole
+   ! Specify whether to ramp down the Neptune velocity in shallow
+   ! water, and if so the depth range controlling such ramping down
+   ln_neptramp       = .true.   ! ramp down Neptune velocity in shallow water
+   rn_htrmin         =  100.0   ! min. depth of transition range
+   rn_htrmax         =  200.0   ! max. depth of transition range
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/namelist_ice
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/namelist_ice	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/namelist_ice	(revision 3680)
@@ -0,0 +1,1 @@
+link namelist_ice_lim2
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/namelist_ice_lim2
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/namelist_ice_lim2	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/namelist_ice_lim2	(revision 3680)
@@ -0,0 +1,129 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/LIM-2 : 1 - dynamics/advection/thermo          (namicerun)
+!! namelists    2 - ice intialisation                  (namiceini)
+!!              3 - ice dynamic                        (namicedyn)
+!!              4 - ice advection                      (namicetrp)
+!!              5 - thermodynamic                      (namicethd)
+!!              6 - ice damping                        (namice_dmp)
+!!              7 - ice diagnostics                    (namicedia)
+!!              8 - ice outputs                        (namiceout)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+!-----------------------------------------------------------------------
+&namicerun     !   Share parameters for dynamics/advection/thermo
+!-----------------------------------------------------------------------
+   cn_icerst_in  = "restart_ice_in"   !  suffix of ice restart name (input)
+   cn_icerst_out = "restart_ice"      !  suffix of ice restart name (output)
+   ln_limdyn     = .true.             !  ice dynamics (T) or thermodynamics only (F)
+   ln_limdmp     = .false.            !  restoring ice thickness and fraction leads   (T => fill  namice_dmp)
+   acrit         = 1.0e-06 , 1.0e-06  !  minimum lead fraction in the Northern & Southern Hemispheres
+   hsndif        =  0.e0              !  computation of temperature in snow (=0.0) or not
+   hicdif        =  0.e0              !  computation of temperature in ice  (=0.0) or not (=9999.0)
+/
+!-----------------------------------------------------------------------
+&namiceini     !   ice initialisation
+!-----------------------------------------------------------------------
+   ln_limini   = .false.   !  read the initial state in 'Ice_initialization.nc' (T) or not (F)
+   ttest       =  2.0      !  threshold water temperature for initial sea ice
+   hninn       =  0.5      !  initial snow thickness in the north
+   hginn       =  3.0      !  initial ice  thickness in the north
+   alinn       =  0.05     !  initial leads area     in the north
+   hnins       =  0.1      !  same  three parameter  in the south
+   hgins       =  1.0      !        "                 "     south   
+   alins       =  0.1      !        "                 "     south
+/
+!-----------------------------------------------------------------------
+&namicedyn     !   ice dynamic
+!-----------------------------------------------------------------------
+   epsd        =   1.0e-20 !  tolerance parameter
+   alpha       =   0.5     !  coefficient for semi-implicit coriolis
+   dm          =   0.6e+03 !  diffusion constant for dynamics
+   nbiter      =   1       !  number of sub-time steps for relaxation
+   nbitdr      = 100       !  maximum number of iterations for relaxation
+   om          =   0.5     !  relaxation constant 
+   resl        =   5.0e-05 !  maximum value for the residual of relaxation
+   cw          =   5.0e-03 !  drag coefficient for oceanic stress
+   angvg       =   0.0     !  turning angle for oceanic stress
+   pstar       =   1.0e+04 !  1st bulk-rheology parameter
+   c_rhg       =  20.0     !  2nd bulk-rhelogy parameter
+   etamn       =   0.0e+07 !  minimun value for viscosity
+   creepl      =   1.0e-08 !  creep limit
+   ecc         =   2.0     !  eccentricity of the elliptical yield curve
+   ahi0        = 350.e0    !  horizontal eddy diffusivity coefficient for sea-ice [m2/s]
+   nevp        =   120     !  number of EVP subcycling iterations
+   telast      =   9600    !  timescale for EVP elastic waves
+   alphaevp    =   1.0     !  coefficient for the solution of EVP int. stresses
+/
+!-----------------------------------------------------------------------
+&namicetrp     !   ice transport
+!-----------------------------------------------------------------------
+   bound       =   0.0     !  boundary conditions (=0. no-slip, =1. free-slip)
+/
+!-----------------------------------------------------------------------
+&namicethd     !   ice thermodynamic
+!-----------------------------------------------------------------------
+   hmelt       = -0.15     !  maximum melting at the bottom
+   hiccrit     = 0.3 , 0.3 !  ice thickness for lateral accretion in the Northern (Southern) Hemisphere
+   !                       !  (caution 1.0, 1.0 best value to be used!!! (gilles G.))
+   hicmin      = 0.2       !  ice thickness corr. to max. energy stored in brine pocket
+   hiclim      = 0.05      !  minimum ice thickness
+   amax        = 0.999     !  maximum lead fraction
+   swiqst      = 1.        !  energy stored in brine pocket (=1) or not (=0)	
+   sbeta       = 1.        !  numerical caracteritic of the scheme for diffusion in ice
+                           !        Cranck-Nicholson (=0.5), implicit (=1), explicit (=0)
+   parlat      = 0.0       !  percentage of energy used for lateral ablation
+   hakspl      = 0.5       !  slope of distr. for Hakkinen-Mellor's lateral melting
+   hibspl      = 0.5       !  slope of distribution for Hibler's lateral melting
+   exld        = 2.0       !  exponent for leads-closure rate
+   hakdif      = 1.0       !  coefficient for diffusions of ice and snow
+   thth        = 0.2       !  threshold thickness for comp. of eq. thermal conductivity
+   hnzst       = 0.1       !  thickness of the surf. layer in temp. computation
+   parsub      = 1.0       !  switch for snow sublimation or not
+   alphs       = 1.0       !  coefficient for snow density when snow ice formation
+/
+!-----------------------------------------------------------------------
+&namice_dmp    !   damping of sea ice alone open boundaries
+!              !   (hard coded damping area: check if it fit your config)
+!-----------------------------------------------------------------------
+!              !  file name   ! frequency (hours) ! variable ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !              !  (if <0  months)  !   name   !  (logical)   !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_hicif    = 'ice_damping',  -1.              , 'hicif'  ,   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_cnf      = 'ice_damping',  -1.              , 'frld'   ,   .true.     , .true. , 'yearly'  , ''       , ''
+!
+   cn_dir      = './'      !  root directory for the location of the runoff files
+/
+!-----------------------------------------------------------------------
+&namicedia     !   ice diagnostics
+!-----------------------------------------------------------------------
+   fmtinf      = '1PE13.5' !  format of the output values
+   nfrinf      =  4        !  number of variables written in one line
+   ntmoy       =  1        !  instantaneous values of ice evolution or averaging
+   ninfo       =  1        !  frequency of ouputs on file ice_evolu in case of averaging
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namiceout     !   parameters for outputs
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!              !         title of the field           !  name     !   units   !  save  ! multipl. ! additive !
+!              !                                      !           !           ! or not !  factor  !  factor  !
+   field_1     = 'Snow thickness                     ', 'isnowthi', 'm       ',    1   ,  1.0     ,    0.0
+   field_2     = 'Ice thickness                      ', 'iicethic', 'm       ',    1   ,  1.0     ,    0.0
+   field_3     = 'Ice produced                       ', 'iiceprod', 'm/kt    ',    1   ,  1.0     ,    0.0
+   field_4     = 'Ice concentration                  ', 'ileadfra', '%       ',    1   , -1.0     ,    1.0
+   field_5     = 'Ice temperature                    ', 'iicetemp', 'C       ',    1   ,  1.0     , -273.15
+   field_6     = 'Oceanic flux at the ice base       ', 'ioceflxb', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_7     = 'Ice velocity u                     ', 'iicevelu', 'm/s     ',    1   ,  1.0     ,    0.0
+   field_8     = 'Ice velocity v                     ', 'iicevelv', 'm/s     ',    1   ,  1.0     ,    0.0
+   field_9     = 'Sea surface temperature            ', 'isstempe', 'C       ',    1   ,  1.0     , -273.15
+   field_10    = 'Sea surface salinity               ', 'isssalin', 'PSU     ',    1   ,  1.0     ,    0.0
+   field_11    = 'Total flux at ocean surface        ', 'iocetflx', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_12    = 'Solar flux at ocean surface        ', 'iocesflx', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_13    = 'Non-solar flux at ocean surface    ', 'iocwnsfl', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_14    = 'Salt flux at ocean surface         ', 'iocesafl', 'kg/m2/kt',    1   ,  1.0     ,    0.0
+   field_15    = 'Wind stress u                      ', 'iocestru', 'Pa      ',    1   ,  1.0     ,    0.0
+   field_16    = 'Wind stress v                      ', 'iocestrv', 'Pa      ',    1   ,  1.0     ,    0.0 
+   field_17    = 'Solar flux at ice/ocean surface    ', 'iicesflx', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_18    = 'Non-solar flux at ice/ocean surface', 'iicenflx', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_19    = 'Snow precipitation                 ', 'isnowpre', 'kg/day  ',    1   ,  1.0     ,    0.0
+!
+   noumef      =   19      !  number of fields
+/      
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/namelist_ice_lim3
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/namelist_ice_lim3	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/namelist_ice_lim3	(revision 3680)
@@ -0,0 +1,193 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/LIM3 :  1 - dynamics/advection/thermo          (namicerun)
+!! namelists    2 - ice intialisation                  (namiceini)
+!!              3 - ice dynamic                        (namicedyn)
+!!              4 - ice advection                      (namicetrp)
+!!              5 - thermodynamic                      (namicethd)
+!!              6 - ice salinity                       (namicesal)
+!!              7 - mechanical redistribution of ice   (namiceitdme)
+!!              8 - ice diagnostics                    (namicedia)
+!!              9 - ice outputs                        (namiceout)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+!-----------------------------------------------------------------------
+&namicerun     !   Share parameters for dynamics/advection/thermo
+!-----------------------------------------------------------------------
+   cn_icerst_in  = "restart_ice_in"   !  suffix of ice restart name (input)
+   cn_icerst_out = "restart_ice"      !  suffix of ice restart name (output)
+   ln_limdyn   = .true.    !  ice dynamics (T) or thermodynamics only (F)
+   acrit       =  1.0e-02 , 1.0e-02  !  minimum fraction for leads in the Northern (Southern) Hemisphere
+   hsndif      =  0.0      !  computation of temperature in snow (=0.0) or not
+   hicdif      =  0.0      !  computation of temperature in ice  (=0.0) or not (=9999.0)
+   cai         =  1.40e-3  !  atmospheric drag over sea ice
+   cao         =  1.00e-3  !  atmospheric drag over ocean
+   ln_nicep    = .false.   !  Ice points output for debug (yes or no)
+/
+!-----------------------------------------------------------------------
+&namiceini     !   ice initialisation
+!-----------------------------------------------------------------------
+   ttest       =  2.0      !  threshold water temperature for initial sea ice
+   hninn       =  0.3      !  initial snow thickness in the north
+   hnins       =  0.1      !        "            "          south
+   hginn_u     =  3.50     !  initial undeformed ice thickness in the north
+   hgins_u     =  1.0      !        "            "              "     south
+   aginn_u     =  0.95     !  initial undeformed ice concentration in the north
+   agins_u     =  0.9      !        "            "              "         south
+   hginn_d     =  0.0      !  initial  deformed  ice thickness     in the north
+   hgins_d     =  0.0      !  
+   aginn_d     =  0.00     !  initial  deformed  ice concentration in the north
+   agins_d     =  0.00     !        "            "              "         south
+   sinn        =  6.301    !  initial salinity in the north
+   sins        =  6.301    !        "            "    south
+/
+!-----------------------------------------------------------------------
+&namicedyn     !   ice dynamic
+!-----------------------------------------------------------------------
+   epsd        =   1.0e-20 !  tolerance parameter
+   alpha       =   0.5     !  coefficient for semi-implicit coriolis
+   dm          =   0.6e+03 !  diffusion constant for dynamics
+   nbiter      =   1       !  number of sub-time steps for relaxation
+   nbitdr      = 500       !  maximum number of iterations for relaxation
+   om          =   0.5     !  relaxation constant 
+   resl        =   5.0e-05 !  maximum value for the residual of relaxation
+   cw          =   5.0e-03 !  drag coefficient for oceanic stress
+   angvg       =   0.0     !  turning angle for oceanic stress
+   pstar       =   4.0e+04 !  1st bulk-rheology parameter
+   c_rhg       =  20.0     !  2nd bulk-rhelogy parameter
+   etamn       =   0.0e+07 !  minimun value for viscosity
+   creepl      =   1.0e-12 !  creep limit
+   ecc         =   2.0     !  eccentricity of the elliptical yield curve
+   ahi0        = 350.e0    !  horizontal eddy diffusivity coefficient for sea-ice [m2/s]
+   nevp        = 300       !  number of iterations for subcycling in EVP, SB, 400
+   telast      =9600.0     !  timescale for elastic waves, SB, 720.0
+   alphaevp    =   1.0     !  coefficient for the solution of internal ice stresses
+/
+!-----------------------------------------------------------------------
+&namicetrp     !   ice transport
+!-----------------------------------------------------------------------
+   bound       =   0.      !  boundary conditions (=0.0 no-slip, =1.0 free-slip)
+/
+!-----------------------------------------------------------------------
+&namicethd     !   ice thermodynamic
+!-----------------------------------------------------------------------
+   hmelt       = -0.15     !  maximum melting at the bottom
+   hiccrit     = 0.1 , 0.1 !  ice thickness for lateral accretion in the Northern (Southern) Hemisphere
+                           !         caution 1.0, 1.0 best value to be used!!! (gilles G.)  ????
+   fraz_swi    = 0.0       !  use of frazil ice collection thickness in function of wind (1.0) or not (0.0)
+   maxfrazb    = 0.0       !  maximum portion of frazil ice collecting at the ice bottom
+   vfrazb      = 0.4166667 !  thresold drift speed for frazil ice collecting at the ice bottom
+   Cfrazb      = 5.0       !  squeezing coefficient for frazil ice collecting at the ice bottom
+   hicmin      = 0.2       !  ice thickness corr. to max. energy stored in brine pocket
+   hiclim      = 0.10      !  minimum ice thickness
+   amax        = 0.999     !  maximum lead fraction
+   sbeta       = 1.        !  numerical caracteritic of the scheme for diffusion in ice
+                           !        Cranck-Nicholson (=0.5), implicit (=1), explicit (=0)
+   parlat      = 0.0       !  percentage of energy used for lateral ablation
+   hakspl      = 0.25      !  slope of distr. for Hakkinen-Mellor's lateral melting
+   hibspl      = 0.5       !  slope of distribution for Hibler's lateral melting
+   exld        = 2.0       !  exponent for leads-closure rate
+   hakdif      = 1.0       !  coefficient for diffusions of ice and snow
+   thth        = 0.2       !  threshold thickness for comp. of eq. thermal conductivity
+   hnzst       = 0.1       !  thickness of the surf. layer in temp. computation
+   parsub      = 1.0       !  switch for snow sublimation or not
+   alphs       = 1.0       !  coefficient for snow density when snow ice formation
+   betas       = 0.6       !  exponent in lead-ice fractionation of snow precipitation 0.66
+                           !        betas = 1 -> equipartition, betas < 1 -> more on leads
+   kappa_i     = 1.0       !  extinction radiation parameter in sea ice (1.0)
+   nconv_i_thd = 50        !  maximal number of iterations for heat diffusion computation
+   maxer_i_thd = 0.0001    !  maximal error in temperature for heat diffusion computation
+   thcon_i_swi = 1         !  switch for computation of thermal conductivity in the ice
+                           !        (0) Untersteiner (1964), (1) Pringle et al. (2007)
+/
+!-----------------------------------------------------------------------
+&namicesal     !   ice salinity
+!-----------------------------------------------------------------------
+   num_sal     =  2        !  salinity option: 1 -> S = bulk_sal
+                           !                   2 -> S = S(z,t) with a simple parameterization
+                           !                   3 -> S = S(z) profile of Scwharzacher [1959]
+                           !                   4 -> S = S(h) Cox and Weeks [1974]
+   bulk_sal    =  4.0      !  if 1 is used, it represents the ice salinity
+   sal_G       =  5.00     !  restoring salinity for GD
+   time_G      =  1.728e+6 !  restoring time for GD
+   sal_F       =  2.00     !  restoring salinity for flushing
+   time_F      =  8.640e+5 !  restoring time for flushing
+   s_i_max     = 20.0      !  Maximum salinity 
+   s_i_min     =  0.1      !  Minimum tolerated ice salinity
+   s_i_0       =  3.5      !  1st salinity for salinity profile
+   s_i_1       =  4.5      !  2nd salinity for salinity profile
+/
+!-----------------------------------------------------------------------
+&namiceitdme   !   parameters for mechanical redistribution of ice 
+!-----------------------------------------------------------------------
+   ridge_scheme_swi = 0      !  which ridging scheme using (1=Rothrock,else=Hibler79)
+   Cs               =   0.50 !  shearing energy contribution to ridging
+   Cf               =  17.0  !  ratio of ridging work to PE change in ridging
+   fsnowrdg         =   0.5  !  snow fraction that survives in ridging
+   fsnowrft         =   0.5  !  snow fraction that survives in rafting
+   Gstar            =   0.15 !  fractional area of thin ice being ridged
+   astar            =   0.05 !  equivalent of gstar (0.05 for TH75 and 0.03 for weaker ice)
+   Hstar            = 100.0  !  parameter determining the maximum thickness of ridged ice
+   raftswi          =   1    !  rafting or not
+   hparmeter        =   0.75 !  threshold thickness for rafting or not
+   Craft            =   5.0  !  coefficient used in the rafting function
+   ridge_por        =   0.3  !  initial porosity of the ridged ice (typically 0.30)
+   sal_max_ridge    =  15.0  !  maximum ridged ice salinity
+   partfun_swi      =   1    !  participation function linear, TH75 (0) or exponential Letal07 (1)
+   transfun_swi     =   0    !  transfer function uniform of H80 (0) or exponential Letal07 (1)
+   brinstren_swi    =   0    !  (1) use brine volume to diminish ice strength
+/
+!-----------------------------------------------------------------------
+&namicedia     !   ice diagnostics
+!-----------------------------------------------------------------------
+   fmtinf      ='1PE13.5 ' !  format of the output values
+   nfrinf      = 4         !  number of variables written in one line
+   ntmoy       = 1         !  instantaneous values of ice evolution or averaging
+   ninfo       = 1         !  frequency of ouputs on file ice_evolu in case of averaging
+/
+!-----------------------------------------------------------------------
+&namiceout     !   parameters for outputs
+!-----------------------------------------------------------------------
+   noumef      =   37      !  number of fields
+   add_diag_swi=    1      !  1 -> diagnose distribution in thickness space
+                           !  0 -> only simple diagnostics
+!
+!           !         title of the field           !  name     !   units   !  save  ! multipl. ! additive !
+!           !                                      !           !           ! or not !  factor  !  factor  !
+   field_1  = 'Ice concentration                  ', 'iiceconc', '%       ',    1   ,  1.0     ,    0.0
+   field_2  = 'Ice thickness                      ', 'iicethic', 'm       ',    1   ,  1.0     ,    0.0
+   field_3  = 'Snow thickness                     ', 'isnowthi', 'm       ',    1   ,  1.0     ,    0.0
+   field_4  = 'Daily bottom thermo ice production ', 'iicebopr', 'cm/day  ',    1   , 100.     ,    0.0
+   field_5  = 'Daily dynamic ice production       ', 'iicedypr', 'cm/day  ',    1   , 100.     ,    0.0
+   field_6  = 'Oceanic flux at the ice base       ', 'ioceflxb', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_7  = 'Ice velocity u                     ', 'iicevelu', 'm/s     ',    1   ,  1.0     ,    0.0
+   field_8  = 'Ice velocity v                     ', 'iicevelv', 'm/s     ',    1   ,  1.0     ,    0.0
+   field_9  = 'Sea surface temperature            ', 'isstempe', 'C       ',    1   ,  1.0     , -273.15
+   field_10 = 'Sea surface salinity               ', 'isssalin', 'PSU     ',    1   ,  1.0     ,    0.0
+   field_11 = 'Total flux at ocean surface        ', 'iocetflx', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_12 = 'Solar flux at ocean surface        ', 'iocesflx', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_13 = 'Non-solar flux at ocean surface    ', 'iocwnsfl', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_14 = 'Heat flux due to brine release     ', 'iocehebr', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_15 = 'Wind stress u                      ', 'iocestru', 'Pa      ',    1   ,  1.0     ,    0.0
+   field_16 = 'Wind stress v                      ', 'iocestrv', 'Pa      ',    1   ,  1.0     ,    0.0 
+   field_17 = 'Solar flux at ice/ocean surface    ', 'iicesflx', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_18 = 'Non-solar flux at ice/ocean surface', 'iicenflx', 'w/m2    ',    1   ,  1.0     ,    0.0
+   field_19 = 'Snow precipitation                 ', 'isnowpre', 'kg/day  ',    1   ,  1.0     ,    0.0
+   field_20 = 'Mean ice salinity                  ', 'iicesali', 'psu     ',    1   ,  1.0     ,    0.0
+   field_21 = 'Mean ice age                       ', 'iiceages', 'years   ',    1   ,  0.002739,    0.0
+   field_22 = 'Daily lateral thermo ice prod.     ', 'iicelapr', 'cm/day  ',    1   ,100.      ,    0.0
+   field_23 = 'Daily snowice ice production       ', 'iicesipr', 'cm/day  ',    1   ,100.      ,    0.0
+   field_24 = 'Mean ice temperature               ', 'iicetemp', 'C       ',    1   ,  1.0     , -273.15
+   field_25 = 'Ice total heat content             ', 'iiceheco', '10^9 J  ',    1   ,  1.0     ,    0.0
+   field_26 = 'Ice surface temperature            ', 'iicesurt', 'C       ',    1   ,  1.0     , -273.15
+   field_27 = 'Snow temperature                   ', 'isnotem2', 'C       ',    1   ,  1.0     , -273.15
+   field_28 = 'Fsbri - brine salt flux            ', 'iicfsbri', 'kg/m2/s ',    1   ,  1.0     ,    0.0
+   field_29 = 'Fseqv - equivalent FW salt flux    ', 'iicfseqv', 'kg/m2/s ',    1   ,  1.0     ,    0.0
+   field_30 = 'Brine volume                       ', 'ibrinvol', '%       ',    1   ,  100.0   ,    0.0
+   field_31 = 'Frazil ice collection thickness    ', 'iicecolf', 'm       ',    1   ,  1.0     ,    0.0
+   field_32 = 'Ice strength                       ', 'iicestre', 'N/m     ',    1   ,  0.001   ,    0.0
+   field_33 = 'Ice velocity                       ', 'iicevelo', 'm/s     ',    1   ,  1.0     ,    0.0
+   field_34 = 'Surface melt                       ', 'iicesume', 'cm/day  ',    1   ,100.      ,    0.0
+   field_35 = 'Bottom melt                        ', 'iicebome', 'cm/day  ',    1   ,100.      ,    0.0
+   field_36 = 'Divergence                         ', 'iicedive', '10-8s-1 ',    1   ,  1.0e8   ,    0.0
+   field_37 = 'Shear                              ', 'iiceshea', '10-8s-1 ',    1   ,  1.0e8   ,    0.0
+/      
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/namelist_top
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/namelist_top	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/namelist_top	(revision 3680)
@@ -0,0 +1,143 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/TOP1 :  1 - tracer definition                     (namtrc    )
+!!              2 - tracer data initialisation            (namtrc_dta)
+!!              3 - tracer advection                      (namtrc_adv)
+!!              4 - tracer lateral diffusion              (namtrc_ldf)
+!!              5 - tracer vertical physics               (namtrc_zdf)
+!!              6 - tracer newtonian damping              (namtrc_dmp)
+!!              7 - dynamical tracer trends               (namtrc_trd)
+!!              8 - tracer output diagonstics             (namtrc_dia)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namtrc     !   tracers definition
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   nn_dttrc      =  1        !  time step frequency for passive sn_tracers      
+   ln_top_euler  = .true.    !  Euler timestepping
+!
+!                !    name   ! title of the field   ! initial data ! initial data ! save   !
+!                !           !                                           !  units       ! from file    ! or not ! 
+!                !           !                                           !              ! or not       !        !
+   sn_tracer(1)   = 'DUMMY'  , 'Dummy tracer'                      ,       'dummy units',  .false.     ,  .true.
+/
+!-----------------------------------------------------------------------
+&namtrc_dta      !    Initialisation from data input file
+!-----------------------------------------------------------------------
+!
+!                !  file name               ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!                !                          !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_trcdta(1)  = 'data_1m_O2_nomask'      ,        -1         ,  'O2'      ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(2)  = 'data_1m_PO4_nomask'     ,        -1         ,  'PO4'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(3)  = 'data_1m_NO3_nomask'     ,        -1         ,  'NO3'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(6)  = 'data_1m_Si_nomask'      ,        -1         ,  'Si'      ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(8)  = 'data_1m_Fer_nomask'     ,        -12        ,  'Fer'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(45) = 'data_1m_DOC_nomask'     ,        -12        ,  'DOC'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(56) = 'data_1m_DIC_nomask'     ,        -12        ,  'DIC'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(57) = 'data_1m_Alkalini_nomask',        -12        ,  'Alkalini',    .false.   , .true. , 'yearly'  , ''       , ''
+!
+   cn_dir        =  './'      !  root directory for the location of the data files
+   rn_trfac(1)   =   22.4  !  conversion factor from ml/l to mmol m3 (1 mol O2 = 22.4 l) 
+   rn_trfac(2)   =   1.0   !  -      -      -     -
+   rn_trfac(3)   =   1.0   !  -      -      -     -
+   rn_trfac(6)   =   1.0   !  -      -      -     -
+   rn_trfac(8)   =   1.e9  !  conversion factor from mol/l to umol/m3
+   rn_trfac(45)  =  12.e6  !  conversion factor from mol/l to mg/m3
+   rn_trfac(56)  =  12.0   !  conversion factor from umol/l to mg/m3
+   rn_trfac(57)  =   1.0   !  -      -      -     -
+/
+!-----------------------------------------------------------------------
+&namtrc_bc
+!-----------------------------------------------------------------------
+!              ! file name                ! frequency (hr) ! variable ! time interp. ! clim    !'yearly' or ! weights  ! rotation
+!              !                          !  (if <0 mon)   !   name   !  (logical)   ! (T/F)   ! 'monthly'  ! filename ! pairing
+   sn_trcsbc(3)  = 'ndeposition.orca'     ,        -1      ,  'ndep'      ,  .false.  , .true.  , 'yearly'   , ''       , ''
+   sn_trcsbc(8)  = 'dust.orca'            ,        -1      ,  'dust'      ,  .false.  , .true.  , 'yearly'   , ''       , ''
+
+   rn_trsfac(3)  = 1.0
+   rn_trsfac(8)  = 5.8866e+05             ! conversion factor from kg Fe/m2/mon to umol/m2/d = 1.e9/(55.85)*12/365
+   !
+   sn_trccbc(2)  = 'river'                 ,       -12      ,  'RIVERPHOS'  ,  .false.  , .true.  , 'yearly'   , ''       , ''
+   sn_trccbc(3)  = 'river'                 ,       -12      ,  'RIVERNIT'   ,  .false.  , .true.  , 'yearly'   , ''       , ''
+   sn_trccbc(6)  = 'river'                 ,       -12      ,  'RIVERSIL'   ,  .false.  , .true.  , 'yearly'   , ''       , ''
+   sn_trccbc(8)  = 'river'                 ,       -12      ,  'RIVERFe80'  ,  .false.  , .true.  , 'yearly'   , ''       , ''
+   sn_trccbc(45) = 'river'                 ,       -12      ,  'RIVERDOC'   ,  .false.  , .true.  , 'yearly'   , ''       , ''
+   sn_trccbc(56) = 'river'                 ,       -12      ,  'RIVERDIC'   ,  .false.  , .true.  , 'yearly'   , ''       , ''
+   rn_trcfac(2)  =  8.8464e+10     ! 1 mol P = 30.97 g; 1.e12*1.e3/30.97/365 conversion factor from Tg/y to mmol/d
+   rn_trcfac(3)  =  1.9556e+11     ! 1 mol N = 14.01 g; 1.e12*1.e3/14.01/365 conversion factor from Tg/y to mmol/d
+   rn_trcfac(6)  =  9.7534e+10     ! 1 mol Si = 28.09 g; 1.e12*1.e3/28.09/365 conversion factor from Tg/y to mmol/d
+   rn_trcfac(8)  =  4.9055e+13     ! 1 mol Fe = 55.85 g; 1.e12*1.e6/55.85/365 conversion factor from Tg/y to umol/d
+   rn_trcfac(45) =  2.7397e+12     ! 1.e15/365 ! conversion factor from Tg/y to mg/d
+   rn_trcfac(56) =  2.7397e+12     ! 1.e15/365 ! conversion factor from Tg/y to mg/d
+   cn_dir       = './'     !  root directory for the location of the boundary condition files
+/
+!-----------------------------------------------------------------------
+&namtrc_adv    !   advection scheme for passive tracer 
+!-----------------------------------------------------------------------
+   ln_trcadv_cen2   =  .false.  !  2nd order centered scheme   
+   ln_trcadv_tvd    =  .false.  !  TVD scheme
+   ln_trcadv_muscl  =  .true.   !  MUSCL scheme
+   ln_trcadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries
+   ln_trcadv_ubs    =  .false.  !  UBS scheme
+   ln_trcadv_qck    =  .false.  !  QUICKEST scheme
+/
+!-----------------------------------------------------------------------
+&namtrc_ldf    !   lateral diffusion scheme for passive tracer 
+!-----------------------------------------------------------------------
+   ln_trcldf_diff   =  .true.   !  performs lateral diffusion (T) or not (F)
+!                               !  Type of the operator : 
+   ln_trcldf_lap    =  .true.   !     laplacian operator       
+   ln_trcldf_bilap  =  .false.  !     bilaplacian operator     
+                                !  Direction of action  :
+   ln_trcldf_level  =  .false.  !     iso-level                
+   ln_trcldf_hor    =  .false.  !     horizontal (geopotential)         (require "key_ldfslp" when ln_sco=T)
+   ln_trcldf_iso    =  .true.   !     iso-neutral                       (require "key_ldfslp")
+!                               !  Coefficient
+   rn_ahtrc_0       =  2000.    !  horizontal eddy diffusivity for tracers [m2/s]
+   rn_ahtrb_0       =     0.    !     background eddy diffusivity for ldf_iso [m2/s]
+/
+!-----------------------------------------------------------------------
+&namtrc_zdf        !   vertical physics
+!-----------------------------------------------------------------------
+   ln_trczdf_exp   =  .false.  !  split explicit (T) or implicit (F) time stepping
+   nn_trczdf_exp   =   3       !  number of sub-timestep for ln_trczdfexp=T
+/
+!-----------------------------------------------------------------------
+&namtrc_rad        !  treatment of negative concentrations 
+!-----------------------------------------------------------------------
+   ln_trcrad   =  .true.  !  artificially correct negative concentrations (T) or not (F)
+/
+!-----------------------------------------------------------------------
+&namtrc_dmp    !   passive tracer newtonian damping   
+!-----------------------------------------------------------------------
+   ln_trcdmp   =  .false.  !  add a damping term (T) or not (F)
+   nn_hdmp_tr  =   -1      !  horizontal shape =-1, damping in Med and Red Seas only
+                           !                   =XX, damping poleward of XX degrees (XX>0)
+                           !                      + F(distance-to-coast) + Red and Med Seas
+   nn_zdmp_tr  =    1      !  vertical   shape =0    damping throughout the water column
+                           !                   =1 no damping in the mixing layer (kz  criteria)
+                           !                   =2 no damping in the mixed  layer (rho crieria)
+   rn_surf_tr  =   50.     !  surface time scale of damping   [days]
+   rn_bot_tr   =  360.     !  bottom  time scale of damping   [days]
+   rn_dep_tr   =  800.     !  depth of transition between rn_surf and rn_bot [meters]
+   nn_file_tr  =    0      !  create a damping.coeff NetCDF file (=1) or not (=0)
+/
+!-----------------------------------------------------------------------
+&namtrc_trd       !   diagnostics on tracer trends        ('key_trdtrc')
+!                          or mixed-layer trends          ('key_trdmld_trc')
+!----------------------------------------------------------------------
+   nn_trd_trc  =  360       !  time step frequency and tracers trends
+   nn_ctls_trc =   0        !  control surface type in mixed-layer trends (0,1 or n<jpk)
+   rn_ucf_trc  =   86400    !  unit conversion factor (=1 -> /seconds ; =86400. -> /day)
+   ln_trdmld_trc_restart = .false.  !  restart for ML diagnostics
+   ln_trdmld_trc_instant = .false.  !  flag to diagnose trends of instantantaneous or mean ML T/S
+   ln_trdtrc(1)  =   .true.
+   ln_trdtrc(2)  =   .true.
+   ln_trdtrc(23) =   .true.
+/
+!-----------------------------------------------------------------------
+&namtrc_dia       !   parameters for passive tracer additional diagnostics
+!----------------------------------------------------------------------
+   ln_diatrc     =  .false.   !  save additional diag. (T) or not (F)
+   ln_diabio     =  .false.
+   nn_writedia   =  5475     !  time step frequency for diagnostics
+   nn_writebio   =  5475
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/runscript
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/runscript	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/runscript	(revision 3680)
@@ -0,0 +1,37 @@
+#! /bin/sh -x
+
+#BSUB -a poe
+#BSUB -J PELAGOS          # Name of the job.
+#BSUB -o PELAGOS_%J.out  # Appends std output to file %J.out.
+#BSUB -e PELAGOS_%J.err  # Appends std error to file %J.out.
+#BSUB -P nemo
+#BSUB -q poe_short    # queue
+#BSUB -n 128          # Number of CPUs
+#BSUB -x 
+#BSUB -R "span[ptile=64]"
+
+export MP_WAIT_MODE=poll
+export MP_POLLING_INTERVAL=30000000
+export MP_SHARED_MEMORY=yes
+export MP_EUILIB=us
+export MP_EUIDEVICE=sn_all
+export LDR_CNTRL=TEXTPSIZE=64K@STACKPSIZE=64K@DATAPSIZE=64K
+export MP_TASK_AFFINITY=core
+
+EXP="EXP00"
+
+workdir="/data/ans017/EXPERIMENTS/PELAGOS/${EXP}"
+datadir="/users/home/ans017/WORKS/GIT/ORCA2-DATA"
+execdir=`pwd`
+
+if [ ! -d ${workdir} ] ; then
+  mkdir -p ${workdir}
+fi
+
+cd $workdir
+rm -rf *
+cp ${execdir}/* ./
+ln -sf ${datadir}/* ./
+ln -sf ${datadir}/ORCA2-TOP/* ./
+
+time mpirun.lsf opa
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/xmlio_server.def
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/xmlio_server.def	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/EXP00/xmlio_server.def	(revision 3680)
@@ -0,0 +1,35 @@
+! xmlio_server namelist
+!
+! using_server: .TRUE.(.FALSE.) to use(bypass) the io_server
+! using_oasis : .TRUE.(.FALSE.) if nemo is coupled through OASIS
+! client_id   : used only for OASIS, NEMO      id in the namecouple 
+! server_id   : used only for OASIS, io_server id in the namecouple
+!
+&coupling_param
+  using_server = .FALSE.
+  using_oasis  = .FALSE.
+  client_id    = 'nemo.x'
+  server_id    = 'ionemo'
+/
+
+! global_mpi_buffer_size: size in Mo of the MPI buffer used by the io_server
+&mpi_param
+  global_mpi_buffer_size = 512
+/  
+
+!!======================================================================
+!!   namnc4            netcdf4 chunking and compression settings
+!!======================================================================
+!-----------------------------------------------------------------------
+&namnc4         !  netcdf4 chunking and compression settings
+                !  (benign if "key_netcdf4" is not used)
+!-----------------------------------------------------------------------
+   nn_nchunks_i   =   4       !  number of chunks in i-dimension
+   nn_nchunks_j   =   4       !  number of chunks in j-dimension
+   nn_nchunks_k   =   31      !  number of chunks in k-dimension
+                              !  setting nn_nchunks_k = jpk will give a chunk size of 1 in the vertical which
+                              !  is optimal for postprocessing which works exclusively with horizontal slabs
+   ln_nc4zip      =   .TRUE.  !  (T) use netcdf4 chunking and compression
+                              !  (F) ignore chunking information and produce netcdf3-compatible files  
+/
+  
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/README
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/README	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/README	(revision 3680)
@@ -0,0 +1,4 @@
+To compile with the BFM:
+export BFMDIR=path/to/bfm
+cd ..
+./makenemo -n PELAGOS -m ARCHFILE -e $BFMDIR/src/nemo -j 8
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/cpp_PELAGOS.fcm
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/cpp_PELAGOS.fcm	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS/cpp_PELAGOS.fcm	(revision 3680)
@@ -0,0 +1,2 @@
+bld::tool::fppkeys key_trabbl key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_zdftke key_zdfddm key_diahth key_mpp_mpi key_vectopt_loop key_top key_my_trc
+inc $BFMDIR/src/nemo/bfm.fcm
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/CO2.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/CO2.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/CO2.nml	(revision 3680)
@@ -0,0 +1,97 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! ROUTINE: CO2
+!
+! DESCRIPTION
+!   List of parameters values
+!
+! INTERFACE
+! parameter values for mem_CO2 filled by InitCO2
+!
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2007 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+
+&CO2_parameters
+! Initial CO2 concentration in the air [ppm]
+   AtmCO20 = 370.0E0
+! Compute the partial pressure of Atmospheric CO2
+   calcAtmpCO2 = .FALSE.
+   pCO2Method = 1  ! 1=MixRatio*slp, 2=Magnus formula 
+!-----------------------------------------------------------------------------------!
+! Read external data for atmospheric CO2 values  
+          ! Read  !   File   ! NetCDF  !  Var    !  RefTime   ! Input      !   Time   !
+          ! Input !   name   ! Logical !  name   !  yyyymmdd  ! Frequency  !  interp  !
+!AtmCO2_N =    2  , 'CMIP5_Historical_GHG_1765_2005.nc' , .TRUE.  , 'CO2'   , '1764-07-01 00:00' ,  'yearly'  ,  .TRUE.  
+!AtmCO2_N =    2  , 'CMIP5_Historical_GHG_1765_2005.dat' , .FALSE.  , 'CO2'   , '1764-07-01 00:00' ,  'yearly'  ,  .TRUE.  
+! Read external data for atmospheric SLP 
+AtmSLP_N  =    0  , 'AtmSLP.nc' , .TRUE.  ,'AtmSLP' , '1764-07-01 00:00'  , 'dummy' ,  .TRUE.  
+AtmTDP_N  =    0  , 'AtmTDP.nc' , .TRUE.  ,'AtmTDP' , '1764-07-01 00:00'  , 'dummy' ,  .TRUE.  
+!-----------------------------------------------------------------------------------!
+
+! Initial pH value
+   phstart = 8.10E0
+
+! Choice of the acidity constants parameterization
+! K1K2==1 Roy et al. (1993); DOE (1994); pH on total scale
+! K1K2==2 Default
+!         Mehrbach et al (1973) refit by Dickson & Millero (1987)
+!         OCMIP STANDARD; pH on Sea Water Scale
+! K1K2==3 Mehrbach et al (1973) refit by Lueker et al. (2000)
+!         pH on total scale
+! K1K2==4 Hansson (1973b) data as refitted by Dickson and 
+!         Millero (1987); pH on Sea Water Scale
+   K1K2 = 2
+
+! Choice of [H+] numerical computation
+! MethodCalcCO2=1 Approximate static solution
+! MethodCalcCO2=2 Default. Standard OCMIP iteration
+! MethodCalcCO2=3 Follows et al., Ocean Modelling 2006
+!
+! Parameters for MethodCalcCO2=2
+! M2XACC    :  accuracy of the iterative scheme for OCMIP (default 1.E-10)
+! M2PHDELT  :  delta of pH for the root search (realized pH+/-DELT)
+!              in the OCMIP scheme (default 0.5)
+! M2MAXIT   :  maximum number of iterations for OCMIP (default 100 )
+!
+   MethodCalcCO2 = 2
+          M2XACC = 1.0E-10
+        M2PHDELT = 0.3
+         M2MAXIT = 100
+!
+! Calcium ion concentration
+!     [from : "Seawater : Its composition, properties and behaviour"
+!      (2nd Edition), Open University Course Team, 1995]
+!     seawater concentration    = 412 mg / l
+!     atomic weight             = 40.078 g / mol
+!     therefore, concentration  = 10.279 mmol / l
+!                               = 10.279 mol / m3
+        Caconc0 = 10.279E0
+! Normalize Calcium ion concentration by sea water salinity
+        Canorm  = .TRUE.
+/
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/LightAdaptation.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/LightAdaptation.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/LightAdaptation.nml	(revision 3680)
@@ -0,0 +1,55 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: LightAdaptation
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_LightAdaptation filled by InitLightAdaptation
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!  p_isw:  	 Switch between parameterizations
+!  p_chEPLi:  	 Maximum Iopt (W/m2)
+!        :  	    p_clEPLi    =      4.0,    6.0,    5.0,    8.0	# Minimum Iopt (W/m2)
+!  p_clEPLi:  	 Minimum Iopt (W/m2)
+!        :  	    p_ruEPLi    =      0.25,    0.25,   0.5,    0.125	# Maximum daily shift in Iopt (1/d)
+!  p_ruEPLi:  	 Maximum daily shift in Iopt (1/d)
+!  p_addepth:  	 Adaptation depth. Meaningless with high-res models
+
+&LightAdaptation_parameters
+      p_isw = 	1,	1,	1,	1
+  p_addepth = 	50.0,	50.0,	50.0,	50.0
+  p_chEPLi  = 	100.0,	100.0,	100.0,	100.0
+  p_clEPLi  = 	8.0,	10.0,	6.0,	12.0
+  p_ruEPLi  = 	0.2,	0.25,	0.3,	0.15
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/MesoZoo.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/MesoZoo.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/MesoZoo.nml	(revision 3680)
@@ -0,0 +1,86 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: MesoZoo
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_MesoZoo filled by InitMesoZoo
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!        :
+!        :  	 The variable Z3 represents carnivorous mesozooplankton and Z4 represents
+!        :  	 omnivorous mesozooplankton.
+!        :
+!  p_q10:  	 Doubling temperature
+!  p_srs:  	 Respiration rate at 10 degrees C
+!  p_sum:  	 Maximal productivity at 10 degrees C
+!  p_sd:  	 Background natural mortality
+!  p_vum:  	 Specific search volume
+!  p_puI_u:  	 Assimilation efficiency
+!  p_peI_R6:  	 Faeces production
+!  p_sdo:  	 Fractional density-dependent mortality
+!  p_sds:  	 Exponent of density-dependent mortality
+!  p_qpc:  	 Quotum phosphate
+!  p_qnc:  	 Quotum nitrate
+
+&MesoZoo_parameters
+!		Z3	Z4
+       p_q10 =	2.0,	2.0
+       p_srs =	0.01,	0.02
+        p_sd = 	0.01,	0.01
+       p_sum = 	1.6,	2.0
+       p_vum = 	0.016,	0.008
+     p_puI_u = 	0.8,	0.6
+    p_peI_R6 = 	0.2,	0.4
+       p_sdo = 	4.d-4,	4.d-4
+       p_sds = 	2.0,	2.0
+       p_qpc = 	1.67d-3,1.67d-3
+       p_qnc = 	0.015,	0.015
+     p_clO2o = 	30.0,	30.0
+!		P1	P2	P3	P4
+!	Z3
+ p_puPI(1,:) =	0.0,	0.0,	0.0,	0.0
+!	Z4
+ p_puPI(2,:) =	1.0,	0.25,	0.0,	0.0
+!		Z5	Z6
+!	Z3
+p_puMIZ(1,:) =	0.0,	0.0
+!	Z4
+p_puMIZ(2,:)=	1.0,	0.0,
+!		Z3	Z4
+!	Z3
+p_puMEZ(1,:)=	1.0,	1.0
+!	Z4
+p_puMEZ(2,:)=	0.0,	1.0
+
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/MicroZoo.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/MicroZoo.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/MicroZoo.nml	(revision 3680)
@@ -0,0 +1,93 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: MicroZoo
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_MicroZoo filled by InitMicroZoo
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!        :
+!        :  	 The variable Z5 represents microozooplankton and Z6 represents
+!        :  	 heterotrophic nanoflagellates (HNAN)
+!        :
+!  p_q10:  	 Q10 value
+!  p_srs:  	 Respiration rate at 10 degrees Celsius
+!  p_sum:  	 Max. rel daily uptake as a fraction of biomass
+!  p_sdo:  	 Mortality due to oxygen limitation
+!  p_sd:  	 Temperature independent mortality
+!  p_pu_ra:  	 Activity respiration
+!  p_pu_ea:  	 Activity excretion
+!  p_chro:  	 Oxygen saturation where respiration is 0.5
+!  p_chuc:  	 Food concentration where total uptake rate is 0.5
+!  p_minfood:  	 Concentration below which feeding on a particular
+!        :  	 foodsource is depressed
+!  p_qn_mz:  	 Maximum quotum P
+!  p_qp_mz:  	 Maximum quotum N
+!  p_suPI(P1):  	 /day   #relative P1 uptake by zoo
+!  p_suPI(P2):  	 /day   #relative P2 uptake by zoo
+!  p_suPI(P3):  	 /day   #relative P3 uptake by zoo
+!  p_suPI(P4):  	 /day   #relative P4 uptake by zoo
+!  p_suZI(Z5):  	 /day   #relative Z5 uptake by zoo
+!  p_suZI(Z6):  	 /day   #relative Z6 uptake by zoo
+!  p_suB1:  	 /day   #relative B1 uptake by zoo
+
+!       	Z5	Z6
+&MicroZoo_parameters
+       p_q10 = 	2.0,	2.0
+       p_srs = 	0.02,	0.02
+       p_sum = 	2.0,	10.0
+       p_sdo = 	0.05,	0.05
+        p_sd = 	0.0,	0.0
+     p_pu_ra = 	0.25,	0.35
+     p_pu_ea = 	0.25,	0.35
+      p_chro = 	7.8,	7.8
+      p_chuc = 	30.0,	100.0
+   p_minfood = 	10.0,	50.0
+     p_qp_mz = 	1.85d-3,1.85d-3
+     p_qn_mz = 	1.67d-2,1.67d-2
+! Food matrix parameters: take care of the notation
+!		P1	P2	P3	P4
+!	Z5
+ p_suPI(1,:) =	0.0,	1.0,	0.1,	0.0
+!	Z6
+ p_suPI(2,:) =	0.0,	0.2,	1.0,	0.0
+!		Z5	Z6
+!	Z5
+ p_suZI(1,:) = 	1.0,	1.0
+!	Z6
+ p_suZI(2,:) = 	0.0,	0.2
+!		Z5	Z6
+      p_suB1 = 	0.1,	1.0
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/Param.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/Param.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/Param.nml	(revision 3680)
@@ -0,0 +1,128 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: Param
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_Param filled by InitParam
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+&Param_parameters
+                    p_small = 1.0e-20
+                  p_q10diff = 1.49
+                      p_qro = 0.5
+               p_qon_dentri = 1.25
+                p_qon_nitri = 2.0
+                    p_clDxm = 0.001
+       CalcConservationFlag = .FALSE.
+          CalcTransportFlag = .TRUE.
+            CalcPelagicFlag = .TRUE.
+            CalcBenthicFlag = 0
+                    p_poro0 = 0.7 
+       CalcPhytoPlankton(1) = .FALSE.
+       CalcPhytoPlankton(2) = .FALSE.
+       CalcPhytoPlankton(3) = .FALSE.
+       CalcPhytoPlankton(4) = .FALSE.
+               CalcBacteria = .FALSE.
+     CalcMesoZooPlankton(1) = .FALSE.
+     CalcMesoZooPlankton(2) = .FALSE.
+    CalcMicroZooPlankton(1) = .FALSE.
+    CalcMicroZooPlankton(2) = .FALSE.
+           CalcPelChemistry = .TRUE.
+AssignPelBenFluxesInBFMFlag = .TRUE.
+AssignAirPelFluxesInBFMFlag = .TRUE.
+                      p_PAR = 0.50
+                       slp0 = 1013.25E0
+               ChlLightFlag = 2
+           ChlSynthesisFlag = 1
+        ProductionLightFlag = 1
+          LightLocationFlag = 3
+                     p_eps0 = 0.0435
+                   p_epsESS = 0.04d-3
+                 p_InitSink = 100.0
+                    p_d_tot = 0.30
+                  p_d_tot_2 = 0.35
+                  p_clD1D2m = 0.01
+                   p_pe_R1c = 0.60
+                   p_pe_R1n = 0.72
+                   p_pe_R1p = 0.832
+                   p_pe_R1s = 0.06
+                  p_epsChla = 3.0d-2
+                    p_epsR6 = 0.1d-3
+          check_fixed_quota = 0
+!				P1	P2	P3	P4
+                    p_qchlc = 	0.025,	0.015,	0.02,	0.02
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!  p_q10diff:  	 Temperature-dependency porewater diffusion
+!  p_qro:  	 stoichiometry O2-->S2-
+!  p_qon_dentri:  	 stoichiometry O2-->N denitrification
+!  p_qon_nitri:  	 stoichiometry O2-->N nitrification
+!  p_clDxm:  	 minimal value of D?.m for calculation of the alpha
+!        :  	 alpha is used in expo.func and values > 1/0.001 leadt
+!  CalcPelagicFlag:  	 Switch for pelagic system
+!  CalcBenthicFlag:  	 Switch for benthic system
+!  CalcTransportFlag:    Switch for transport
+!  CalcConservationFlag:    Switch for mass conservation check
+!  CalcPhytoPlankton:  	 Switches to turn on/off the calculation of pelagic groups
+!  CalcBacteria:
+!  CalcMesoZooPlankton:
+!  CalcMicroZooPlankton:
+!  CalcPelChemistry:
+!  CalcBenOrganisms:  	 Switches to turn on/off the calculation of benthic organisms
+!  CalcBenBacteria:
+!  AssignPelBenFluxesInBFMFlag:  	 Switches to make choice to define boundary
+!  AssignAirPelFluxesInBFMFlag:  	 fluxes in physical of biological model
+!        :  	     dim2D%
+!  p_PAR:  	 Photosynthetically available radiation
+!  ChlLightFlag:  	 Switch between light prop.(=1) or Chla.(=2) as a state
+!  ChlSynthesisFlag:  	 Switch between types of chl synthesis
+!                        1. PELAGOS; 2. OPATM-BFM; 3. UNIBO
+!  ProductionLightFlag:  Switch between instantaneous light production (=1) 
+!                        and daylength averaged production (=2)
+!  LightLocationFlag:    Switch between different depth-parameterizations
+!  p_qchlc(PhytoPlankton):  Fixed/Maximum quotum Chla:C dependent on 
+!                           ChlLightFlag [mg Chla (mg C)-1]
+!                           p_qchlc%   0.05, 0.03,  0.07,  0.02
+!  p_eps0:  	 Background extinction (abiotic)
+!  p_epsESS:  	 Inorg. suspended matter extinction coeff. (abiotic)
+!  p_InitSink:   parameter to Initialize BenthicSInk var.
+!  p_d_tot:  	 m # Max Thickness of the denitrification layer
+!  p_d_tot_2:  	 m # Thickness of modelled benthic sediment layers
+!  p_clD1D2m:  	 m # minimum distancebetween D1m and D2m
+!  p_pe_R1c:  	 Fraction of excretion going to PLOC
+!  p_pe_R1n:  	 Fraction of excretion going to PLOC
+!  p_pe_R1p:  	 Fraction of excretion going to PLOC
+!  p_epsChla:  	 Chla-contribution to extinction
+!  p_epsR6:  	 (m2/mgC) # Detritus-contribution to extinction
+!  check_fixed_quota       Check whether zooplankton have fixed quota
+!  p_poro0:      Constant porosity for 0D and 1D runs
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/PelBac.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/PelBac.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/PelBac.nml	(revision 3680)
@@ -0,0 +1,84 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: PelBac
+!
+! DESCRIPTION
+!   List of parameters values
+!
+! !AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2008 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!  p_version:  	 Switch for DOM uptake parameterization
+!        :  	 p_version=1 Polimene et al., 2006
+!        :  	 p_version=2 <BFM> standard version
+!  p_q10:  	 Q10-value (temperature dependency)
+!  p_chdo:  	 Michaelis const for O2 dependence (mmol/m3)
+!  p_sd:  	 Independent specific mortality (1/d)
+!  p_sd2:  	 Density dependent mortality (value: 0.009) (1/d)
+!  p_suR1:  	 Specific potential DOM availability (1/d)
+!  p_suR2:  	 Specific potential DOM availability (1/d)
+!  p_suR6:  	 Availability of POM (1/d)
+!  p_sum:  	 Specific potential uptake (1/d)
+!  p_pu_ra:  	 Activity respiration (-)
+!  p_pu_ra_o:  	 Decrease in Ass. efficiency at low O2 conc (-).
+!  p_srs:  	 Specific rest respiration (1/day)
+!  p_qnc:  	 Optimal N/C ratio (model units) 45:9:1
+!  p_qpc:  	 Optimal P/C ratio (model units) C:N:P
+!  p_qlnc:  	 Minimal N/C ratio (model units) 45:9:1 <BFM>
+!  p_qlpc:  	 Minimal P/C ratio (model units) C:N:P (BFM>
+!  p_qun:  	 nutrient affinity ( mmol/mgC/day) <BFM>
+!  p_qup:  	 nutrient affinity ( mmol/mgC/day) <BFM>
+!  p_lN4:  	 ammonium conc. at which nutrate uptake are equal (BFM)
+!  p_pu_ea_R7:   excretion of reg. org. met. (-) <POLIMENE>
+
+&PelBac_parameters
+  p_version = 2
+      p_q10 = 2.95
+     p_chdo = 30.0
+       p_sd = 0.0
+      p_sd2 = 0.009
+    p_suhR1 = 0.5
+    p_sulR1 = 0.25
+     p_suR2 = 0.05
+     p_suR6 = 0.02
+      p_sum = 8.4
+    p_pu_ra = 0.6
+  p_pu_ra_o = 0.2
+ p_pu_ea_R7 = 0.015
+      p_srs = 0.01
+      p_qpc = 1.9d-3
+    p_qlpc  = 9.5d-4
+      p_qnc = 1.2d-2
+     p_qlnc = 6.0d-3
+      p_qun = 0.050
+      p_qup = 0.0050,
+      p_lN4 = 0.05
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!EOP
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/PelChem.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/PelChem.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/PelChem.nml	(revision 3680)
@@ -0,0 +1,56 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: PelChem
+!
+! DESCRIPTION
+!   List of parameter values for peagic chemistry
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+&PelChem_parameters
+    p_sN4N3 = 0.01
+  p_q10N4N3 = 2.367
+  p_q10R6N5 = 1.49
+      p_rOS = 0.05
+    p_clO2o = 10.0
+    p_clN6r = 1.0
+   p_sN3O4n = 0.35
+     p_rPAo = 1.0
+    p_sR6N5 = 0.02
+/
+
+&PelChem_parameters_iron
+  p_q10R6N7 = 1.50
+    p_sR6N7 = 1.0e-03
+  p_scavN7f = 0.7e-04
+   p_N7fsol = 0.6
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/PelGlobal.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/PelGlobal.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/PelGlobal.nml	(revision 3680)
@@ -0,0 +1,48 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! ROUTINE: PelGlobal
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_PelGlobal filled by InitPelGlobal
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!  p_rR6m:  	 m/d   # detritus sinking rate
+!  p_rPIm:  	 m/d   # phytoplankton background sinking rate
+
+&PelGlobal_parameters
+  p_rR6m = 10.0
+!		P1	P2	P3	P4
+  p_rPIm = 	0.0, 	0.0, 	0.0, 	0.0
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/PhotoAvailableRadiation.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/PhotoAvailableRadiation.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/PhotoAvailableRadiation.nml	(revision 3680)
@@ -0,0 +1,46 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: PhotoAvailableRadiation
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_PhotoAvailableRadiation filled by InitPhotoAvailableRadiation
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   
+!   Copyright (C) 2006 P. Ruardij, the mfstep group, the ERSEM team 
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!  p_iswLtyp:  	 Shape of the productivity function
+
+&PAR_parameters
+!		P1	P2	P3	P4
+  p_iswLtyp = 	5,	5,	5,	5
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/Phyto.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/Phyto.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/Phyto.nml	(revision 3680)
@@ -0,0 +1,126 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! !ROUTINE: Phyto
+!
+! DESCRIPTION
+!   List of parameter values
+!   for mem_Phyto filled by InitPhyto
+!
+! AUTHORS
+!   the BFM team
+!
+! COPYING
+!   Copyright (C) 2008 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!        :
+!        :  	 ---------------- Physiological parameters -----------------
+!        :
+!  p_q10:  	 Doubling temperature
+!  p_sum:  	 Maximal productivity at 10 degrees C
+!  p_srs:  	 Respiration rate at 10 degrees C
+!  p_sdmo:  	 Max.specific nutrient-stress lysis rate
+!  p_thdo:  	 Half value for nutrient stress lysis
+!  p_seo:  	 Extra lysis rate for high density cells
+!  p_sheo:  	 Half value for density stress lysis
+!  p_pu_ea:  	 Fraction of pp excreted as PLOC/PDET
+!  p_pu_ra:  	 Activity respiration rate
+!        
+!         	 ---------------- Nutrient parameters in phytoplankton -----------------
+!       
+!  p_netgrowth:  logical switch for nutrient-limited growth (true is default)
+!  p_limnut:  	 switch for nut. limitation (Liebig is default)
+!  p_chPs:  	 half-value of SIO4-lim (mmol Si m-3)
+!  p_qslc:  	 Minimum quotum Si in PI
+!  p_qsRc:  	 Reference quotum Si in PI
+!  p_qus:  	 affinity of PI for Si
+!  p_alpha_chl:  	 Initial slope P-I curve
+!      
+!       	 ------------- Chlorophyll parameters -----------
+!       	 skel: Skeletonema costatum pav: Pavlova lutheri
+!       	 syn: Synechoccus sp. (significant alpha decrease with irradiance)
+!       	 gyr: Gyrodinium sp. iso: Isochrysis galbana
+!       	             skel     iso      syn      gyr
+!  p_sdchl:  	 Specific turnover rate for Chla (d-1)
+!       	p_qchlc =    0.03,    0.025,   0.1,     0.02    # Maximum quotum Chla:C
+!       	            +-0.024  +-0.001  +-0.003  +-0.004
+!       	 Thalassiosira sp. (0.05+-0.01)
+!       	             skel     pav      syn      gyr
+!  p_esNI:  	 Nutrient stress threshold for Sinking
+!       	p_alpha_chl = 1.0d-5, 0.46d-5*2.0, 2.0d-5, 0.68d-5 # Initial slope P-I curve
+!       	 Thalassiosira sp. (0.48-0.63)
+!  p_res:  	Maximum Sinking velocity (m/d)
+!  p_qchlc  = 0.05,      0.03,      0.07,      0.02 # Maximum quotum Chla:C
+!       	 ------------- silicate limitation control: -----------
+!             p_qus > 0.0  : silica limitation is controlled by internal quoata
+!             if p_qus\=0  : simple MM limitation on external concentration
+!                            p_chPs must have a number or an error is generated!
+!                ------------- Iron parameters -----------
+!                conc.=[umol/m3] ratio=[umol Fe/mg C]
+!  p_qflc:       min Fe:C ratio derived from 3 umol Fe/mol C
+!                Sunda & Huntsman (1997), Nature, 390, p 389-392
+
+!               P1	P2	P3	P4
+&Phyto_parameters
+     p_limnut = 1,	1,	1,	1
+  p_netgrowth = .FALSE.,.FALSE.,.FALSE.,.FALSE.
+        p_q10 = 2.0,	2.0,	2.0,	2.0
+        p_sum = 2.0,	2.5,	3.0,	0.5
+        p_srs = 0.01,	0.05,	0.1,	0.1
+       p_sdmo = 0.05,	0.05,	0.05,	0.0
+        p_seo = 0.0,	0.0,	0.0,	0.0
+       p_sheo = 0.0,	0.0,	0.0,	100.0
+      p_pu_ea = 0.05,	0.2,	0.2,	0.15
+      p_pu_ra = 0.1,	0.2,	0.25,	0.1
+ p_switchR1R2 = 1.0,	1.0,	1.0,    1.0
+       p_qnlc = 4.193e-3,4.193e-3,4.193e-3,0.00687
+       p_qnRc = 1.26e-2,1.26e-2,1.26e-2,1.26e-2
+        p_xqn = 2.0,	2.0,	2.0,	2.0
+       p_qplc = 1.80e-4,1.80e-4,1.80e-4,4.29e-4
+       p_qpRc = 7.86e-4,7.86e-4,7.86e-4,7.86e-4
+        p_xqp = 2.0,	2.0,	2.0,	2.0
+       p_qslc = 8.5e-3,	0.0,	0.0,	0.0
+       p_qsRc = 0.01,	0.0,	0.0,	0.0
+        p_qun = 0.025,	0.025,	0.025,	0.025
+        p_qup = 0.025,	0.025,	0.025,	0.025
+        p_qus = 0.0,	0.0,	0.0,	0.0
+       p_esNI = 0.1,	0.00,	0.00,	0.00
+       p_thdo = 0.1,	0.1,	0.1,	0.1
+       p_res  = 5.0,	0.0,	0.0,	0.0
+       p_lN4  = 1.0,	1.0,	0.0,	1.0
+       p_chPs = 1.0,	0.0,	0.0,	0.0
+    p_Contois = 0.0,    0.0,    0.0,    0.0
+  p_alpha_chl = 1.38e-5, 0.46e-5, 1.52e-5, 0.68e-5
+      p_sdchl = 0.2,	0.2,	0.2,	0.2
+    p_EpEk_or = 0.0,    0.0,    0.0,    0.0
+ p_tochl_relt = 0.0,    0.0,    0.0,    0.0
+/
+
+&Phyto_parameters_iron
+       p_qflc = 0.1e-3, 0.1e-3, 0.83e-10,0.25e-3
+       p_qfRc = 0.3e-3, 0.3e-3, 0.18e-4, 0.5e-3
+        p_xqf = 1.0,    1.0,    1.0,     1.0
+        p_quf = 2.0e-4, 2.0e-4, 2.0e-4,  2.0e-4
+/
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/Settling.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/Settling.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/Settling.nml	(revision 3680)
@@ -0,0 +1,48 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! ROUTINE: Settling
+!
+! DESCRIPTION
+!   List of parameters values
+!   for mem_Settling filled by InitSettling
+!
+! AUTHORS
+!   the BFM team
+!
+!   Copyright (C) 2006 P. Ruardij, M. Vichi
+!   (rua@nioz.nl, vichi@bo.ingv.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+!
+!
+!  p_burvel_R6:  	 Bottom Burial Velocity for detritus (m/d)
+!  p_burvel_R2:  	 Bottom Burial Velocity for dissolved (m/d)
+!  p_burvel_PI:  	 Bottom Burial Velocity for plankton (m/d)
+
+&Settling_parameters
+  p_burvel_R6 = 1.5,
+  p_burvel_R2 = 0.0,
+  p_burvel_PI = 1.5
+/
+
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!END namelist
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+!BOP
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model 
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/bfm.nml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/bfm.nml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/bfm.nml	(revision 3680)
@@ -0,0 +1,222 @@
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+!BOP
+!
+! ROUTINE: Namelist for BFM in configuration PELAGOS_OFF
+!
+! DESCRIPTION
+!  Parameter values for simulation control
+!
+! AUTHORS
+!   Marcello Vichi 
+!
+! COPYING
+!   
+!   Copyright (C) 2012 The BFM System Team
+!   (marcello.vichi@cmcc.it)
+!
+!   This program is free software; you can redistribute it and/or modify
+!   it under the terms of the GNU General Public License as published by
+!   the Free Software Foundation;
+!   This program is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTEABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!   GNU General Public License for more details.
+!
+!EOP
+!-------------------------------------------------------------------------!
+!BOC
+
+!-------------------------------------------------------------------------!
+!NAMELIST bfm_nml
+!-------------------------------------------------------------------------!
+!Main initialisation and output specifications
+!NAME           KIND    DESCRIPTION
+!bio_calc       logical Switch on/off BFM (for coupled configurations)
+!bfm_init       integer Initialization state
+!                       0. from constant values in bfm_init_nml below
+!                       1. from restart
+!bfm_rstctl     logical Save initial state of bfm in the output file.
+!bio_setup      integer BFM configuration:
+!                       1. pelagic
+!                       2. benthic
+!                       3. pelagic and benthic
+!out_fname      string  Name of NetCDF output file
+!out_dir        string  Path to the output file
+!out_title      string  Name of the experiment in NetCDF file
+!out_delta      integer Output is saved every out_delta timesteps
+!parallel_log   logical Set to .FALSE. to produce a log file for each
+!                       parallel process
+!-------------------------------------------------------------------------!
+&bfm_nml
+    bio_calc = .TRUE.
+    bfm_init = 0
+  bfm_rstctl = .FALSE.                                                                                                              
+   bio_setup = 1                                                                                                                    
+   out_fname = 'PEL_OFF'                                                                                                           
+     out_dir = '.'                                                                                                                  
+   out_title = 'PELAGOS_OFFLINE'                                                                                                            
+   out_delta = 100 
+parallel_log = .FALSE.
+/
+
+!-------------------------------------------------------------------------!
+!NAMELIST bfm_init_nml
+!-------------------------------------------------------------------------!
+!Pelagic initialisation
+! pelagic  (O)              O2:   Oxygen (mmol/m3)
+! pelagic  (P)              N1:   Phosphate (mmol/m3)
+! pelagic  (N)              N3:   Nitrate (mmol/m3)
+! pelagic  (N)              N4:   Ammonium (mmol/m3)
+! pelagic  (Si)             N5:   Silicate (mmol/m3)
+! pelagic  (R)              N6:   Reduction Equivalents (mmol/m3)
+! pelagic  (N)              O4:   N2-sink (mmol/m3)
+! pelagic  (CNP)            B1:   Pelagic Bacteria
+! pelagic  (CNPSiI)         P1:   Diatoms (group PhytoPlankton))
+! pelagic  (CNPSiI)         P2:   Flagellates (group PhytoPlankton))
+! pelagic  (CNPSiI)         P3:   PicoPhytoPlankton (group PhytoPlankton))
+! pelagic  (CNPSiI)         P4:   Dinoflagellates (group PhytoPlankton))
+! pelagic  (CNP)            Z3:   Carnivorous mesozooplankton (group MesoZooPlankton))
+! pelagic  (CNP)            Z4:   Omnivorous mesozooplankton (group MesoZooPlankton))
+! pelagic  (CNP)            Z5:   Microzooplankton (group MicroZooPlankton))
+! pelagic  (CNP)            Z6:   Heterotrophic nanoflagellates (HNAN) (group MicroZooPlankton))
+! pelagic  (CNPSi)          R1:   Labile Organic Carbon (LOC)
+! pelagic  (C)              R2:   CarboHydrates (sugars)
+! pelagic  (CNPSi)          R6:   Particulate Organic Carbon (POC)
+! pelagic  (C)              R7:   Refractory Disoolved Organic Carbon
+!<variablename>0 = <realvalue>
+!
+! Initialization with InitVar structure
+! BFM variable information for data input
+! availabel fields:
+! integer init: select the initialization
+!               0 = homogeneous
+!               1 = analytical
+!               2 = from file
+! options for init==1
+! real anv1: value in the surface layer
+! real anz1: depth of the surface layer
+! real anv2: value in the bottom layer
+! real anz2: depth of the bottom layer
+! options for init==2 (not used when coupled with NEMO because 
+!                      overridden by values in namelist_top)
+! char filename: name of the input file
+! char  varname: name of the var in input file
+! Options currently used when coupled with NEMO
+! logical obc: variable has open boundary data
+! logical sbc: variable has surface boundary data
+! logical cbc: variable has coastal boundary data
+!-------------------------------------------------------------------------!
+&bfm_init_nml
+   O2o0 = 300.0,
+   InitVar(1)%init = 0,
+   InitVar(1)%sbc  = .false.,
+   InitVar(1)%cbc  = .false.,
+   InitVar(1)%obc  = .false.,
+   N1p0 = 0.5,
+   InitVar(2)%init = 2,
+   InitVar(2)%sbc  = .false.,
+   InitVar(2)%cbc  = .true.,
+   InitVar(2)%obc  = .false.,
+   N3n0 = 5.0,
+   InitVar(3)%init = 2,
+   InitVar(3)%sbc  = .false.,
+   InitVar(3)%cbc  = .true.,
+   InitVar(3)%obc  = .false.,
+   N4n0 = 1.0,
+   N5s0 = 8.0,
+   InitVar(6)%init = 2,
+   InitVar(6)%sbc  = .false.,
+   InitVar(6)%cbc  = .true.,
+   InitVar(6)%obc  = .false.,
+   N7f0 = 0.3,
+   InitVar(8)%init = 2,
+   InitVar(8)%sbc  = .true.,
+   InitVar(8)%cbc  = .true.,
+   InitVar(8)%obc  = .false.,
+   N6r0 = 1.0,
+   O4n0 = 200.0,
+   P1c0 = 1.0,
+   P2c0 = 1.0,
+   P3c0 = 1.0,
+   Z3c0 = 1.0,
+   Z4c0 = 1.0,
+   Z5c0 = 1.0,
+   Z6c0 = 1.0,
+   B1c0 = 1.0,
+   R2c0 = 0.1,
+   R6c0 = 0.1,
+   R7c0 = 1.0,
+   R1c0 = 1.0,
+   InitVar(45)%init = 2,
+   InitVar(45)%sbc  = .false.,
+   InitVar(45)%cbc  = .true.,
+   InitVar(45)%obc  = .false.,
+   O3c0 = 0.0,
+   InitVar(56)%init = 2,
+   InitVar(56)%sbc  = .false.,
+   InitVar(56)%cbc  = .true.,
+   InitVar(56)%obc  = .false.,
+   O3h0 = 0.0,
+   InitVar(57)%init = 2,
+   InitVar(57)%sbc  = .false.,
+   InitVar(57)%cbc  = .false.,
+   InitVar(57)%obc  = .false.,
+/
+
+!-------------------------------------------------------------------------!
+!NAMELIST bfm_save_nml
+!-------------------------------------------------------------------------!
+!Stored variables
+!ave_save: average values over the output interval
+!var_save: instantaneous value at the output interval
+!-------------------------------------------------------------------------!
+&bfm_save_nml
+   ave_save = 'ETW','O2o','O3c','O3h',
+          'DIC','Ac','pCO2','pH',
+          'EIR',
+          'N1p',
+          'N3n',
+          'N4n',
+          'N5s',
+          'N7f',
+          'P1c',
+          'P1f',
+          'P2c',
+          'P3c',
+          'Z3c',
+          'Z4c',
+          'Z5c',
+          'Z6c',
+          'R1c',
+          'R2c',
+          'R6c',
+          'R6f',
+          'P1l',
+          'P2l',
+          'P3l',
+          'xEPS',
+          'Chla',
+          'eiPI(iiP1)',
+          'eiPI(iiP2)',
+          'eiPI(iiP3)',
+          'qlPc(iiP1)',
+          'qlPc(iiP2)',
+          'qlPc(iiP3)',
+          'qnPc(iiP1)',
+          'qnPc(iiP2)',
+          'qnPc(iiP3)',
+          'qpPc(iiP1)',
+          'qpPc(iiP2)',
+          'qpPc(iiP3)',
+          'sunPI(iiP1)','sunPI(iiP2)','sunPI(iiP3)',
+          'EICE','jsurO2o','jsurO3c','EWIND',
+          'ruPTc','ruPTn','ruPTp','exPP','resZT','resBc','netZTc',
+          'rrPTo','rePTn','rePTp','ruBc','ruBn','ruBp'
+/
+
+!EOC
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+! MODEL  BFM - Biogeochemical Flux Model
+!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/iodef.xml
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/iodef.xml	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/iodef.xml	(revision 3680)
@@ -0,0 +1,1130 @@
+<?xml version="1.0"?>
+<simulation> 
+  
+  <context id="nemo">
+    
+    <!-- $id$ -->
+    
+    <!-- 
+============================================================================================================
+=                                  definition of all existing variables                                    =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+    
+    <field_definition level="1" prec="4" operation="ave(X)" enabled=".TRUE."> <!-- time step automaticaly defined -->
+
+      <!-- T grid -->
+      
+      <group id="grid_T" axis_ref="none" grid_ref="grid_T">
+	<field id="toce"         description="temperature"                               unit="degC" axis_ref="deptht"   />
+       	<field id="soce"         description="salinity"                                  unit="psu"  axis_ref="deptht"   />
+	<field id="sst"          description="sea surface temperature"                   unit="degC"                     />
+	<field id="sst2"         description="square of sea surface temperature"         unit="degC2"                    />
+	<field id="sstgrad"      description="module of sst gradient"                    unit="degC/m"                   />
+	<field id="sstgrad2"     description="square of module of sst gradient"          unit="degC2/m2"                 />
+	<field id="sss"          description="sea surface salinity"                      unit="psu"                      />
+	<field id="sss2"         description="square of sea surface salinity"            unit="psu2"                     />
+	<field id="ssh"          description="sea surface height"                        unit="m"                        />
+	<field id="ssh2"         description="square of sea surface height"              unit="m2"                       />
+	<field id="mldkz5"       description="mixing layer depth (Turbocline)"           unit="m"                        />
+	<field id="mldr10_1"     description="Mixed Layer Depth 0.01 ref.10m"            unit="m"                        />
+       	<field id="rhop"         description="potential density (sigma0)"                unit="kg/m3" axis_ref="deptht"  />
+	<!-- next variables available with key_diahth -->
+	<field id="mlddzt"       description="Thermocline Depth (max dT/dz)"             unit="m"                        />
+	<field id="mldr10_3"     description="Mixed Layer Depth dr=0.03 (ref.10m)"       unit="m"                        />
+	<field id="mldr0_1"      description="Mixed Layer Depth dr=0.01 (ref.surf)"      unit="m"                        />
+	<field id="mldr0_3"      description="Mixed Layer Depth dr=0.03 (ref.surf)"      unit="m"                        />
+	<field id="mld_dt02"     description="Mixed Layer Depth |dt|=0.2 (ref.10m)"      unit="m"                        />
+	<field id="topthdep"     description="Top of the thermocline dt=-0.2 (ref.10m)"  unit="m"                        />
+	<field id="pycndep"      description="Pycnocline depth dr~dt=-0.2 (ref.10m)"     unit="m"                        />
+	<field id="BLT"          description="Barrier Layer Thickness"                   unit="m"                        />
+	<field id="tinv"         description="Max of vertical invertion of temperature"  unit="degC"                     />
+	<field id="depti"        description="Depth of max. vert. inv. of temperature"   unit="m"                        />
+        <field id="20d"          description="Depth of 20C isotherm"                     unit="m"                        />
+	<field id="28d"          description="Depth of 28C isotherm"                     unit="m"                        />
+	<field id="hc300"        description="Heat content 300 m"                        unit="W"                        />
+	<!-- variables available with key_diaar5 -->
+	<field id="botpres"      description="Pressure at sea floor"                     unit="dbar"                     />
+	<field id="cellthc"      description="Cell thickness"                            unit="m"     axis_ref="deptht"  />
+     </group>
+
+      <!-- SBC -->
+      
+      <group id="SBC" axis_ref="none" grid_ref="grid_T" > <!-- time step automaticaly defined based on nn_fsbc -->
+
+	<field id="empmr"        description="Net Upward Water Flux"                                        unit="kg/m2/s"  />
+	<field id="empsmr"       description="concentration/dilution water flux"                            unit="kg/m2/s"  />
+	<field id="snowpre"      description="Snow precipitation"                                           unit="kg/m2/s"  />
+	<field id="runoffs"      description="River Runoffs"                                                unit="Kg/m2/s"  />
+
+	<field id="qt"           description="Net Downward Heat Flux"                                       unit="W/m2"     />
+	<field id="qns"          description="non solar Downward Heat Flux"                                 unit="W/m2"     />
+	<field id="qsr"          description="Shortwave Radiation"                                          unit="W/m2"     />
+	<field id="qsr3d"        description="Shortwave Radiation 3D distribution"        axis_ref="deptht" unit="W/m2"     />
+	<field id="qrp"          description="Surface Heat Flux: Damping"                                   unit="W/m2"     />
+	<field id="erp"          description="Surface Water Flux: Damping"                                  unit="Kg/m2/s"  />
+	<field id="taum"         description="wind stress module"                                           unit="N/m2"     />
+	<field id="wspd"         description="Wind speed module at 10 m"                                    unit="m/s"      />
+	
+	<!-- * variable relative to atmospheric pressure forcing : available with ln_apr_dyn -->
+	<field id="ssh_ib"       description="Inverse barometer sea surface height"                         unit="m"        />
+
+	<!-- *_oce variables available with ln_blk_clio or ln_blk_core -->
+	<field id="qns_oce"      description="Non solar Downward Heat Flux over open ocean"                 unit="W/m2"     />
+	<field id="qlw_oce"      description="Longwave Downward Heat Flux over open ocean"                  unit="W/m2"     />
+	<field id="qsb_oce"      description="Sensible Downward Heat Flux over open ocean"                  unit="W/m2"     />
+	<field id="qla_oce"      description="Latent Downward Heat Flux over open ocean"                    unit="W/m2"     />
+	<field id="taum_oce"     description="wind stress module over open ocean"                           unit="N/m2"     />
+
+	<field id="ice_cover"    description="Ice fraction"                                                 unit="1"        />
+
+	<field id="ioceflxb"     description="Oceanic flux at the ice base"                                 unit="W/m2"     />
+	<field id="qsr_ai_cea"   description="Air-Ice downward solar heat flux (cell average)"              unit="W/m2"     />
+	<field id="qns_ai_cea"   description="Air-Ice downward non-solar heat flux (cell average)"          unit="W/m2"     />
+	<field id="qla_ai_cea"   description="Air-Ice downward Latent heat flux (cell average)"             unit="W/m2"     />
+	
+	<field id="qsr_io_cea"   description="Ice-Oce downward solar heat flux (cell average)"              unit="W/m2"     />
+	<field id="qns_io_cea"   description="Ice-Oce downward non-solar heat flux (cell average)"          unit="W/m2"     />
+	
+	<field id="snowthic_cea" description="Snow thickness (cell average)"                                unit="m"        />
+	<field id="icethic_cea"  description="Ice thickness (cell average)"                                 unit="m"        />
+	<field id="iceprod_cea"  description="Ice production (cell average)"                                unit="m/s"      />
+	
+	<field id="ice_pres"     description="Ice presence"                                                 unit="-"        />
+	<field id="ist_cea"      description="Ice surface temperature (cell average)"                       unit="degC"     />
+	<field id="ist_ipa"      description="Ice surface temperature (ice presence average)"               unit="degC"     />      
+	<field id="uice_ipa"     description="Ice velocity along i-axis at I-point (ice presence average)"  unit="m/s"      />      
+	<field id="vice_ipa"     description="Ice velocity along j-axis at I-point (ice presence average)"  unit="m/s"      />      
+	
+	<field id="utau_ice"     description="Wind stress along i-axis over the ice at i-point"             unit="N/m2"     />
+	<field id="vtau_ice"     description="Wind stress along j-axis over the ice at i-point"             unit="N/m2"     />
+	
+	<field id="u_imasstr"    description="Sea-ice mass transport along i-axis"                          unit="kg/s"     />
+	<field id="v_imasstr"    description="Sea-ice mass transport along j-axis"                          unit="kg/s"     />
+
+	<!-- available key_coupled -->
+	<field id="snow_ao_cea"  description="Snow over ice-free ocean (cell average)"                      unit="kg/m2/s"  />
+	<field id="snow_ai_cea"  description="Snow over sea-ice (cell average)"                             unit="kg/m2/s"  />
+	<field id="subl_ai_cea"  description="Sublimation over sea-ice (cell average)"                      unit="kg/m2/s"  />
+	<field id="icealb_cea"   description="Ice albedo (cell average)"                                    unit="1"        />
+	<field id="calving"      description="Calving"                                                      unit="kg/m2/s"  />
+	<!-- available if key_coupled + conservative method -->
+	<field id="rain"         description="Liquid precipitation"                                         unit="Kg/m2/s"  />
+	<field id="evap_ao_cea"  description="Evaporation over ice-free ocean (cell average)"               unit="kg/m2/s"  />
+	<!-- variables available with key_diaar5 -->
+	<field id="isnwmlt_cea"   description="Snow over Ice melting (cell average)"                        unit="kg/m2/s"  />
+	<field id="fsal_virt_cea" description="Virtual salt flux due to ice formation (cell average)"       unit="kg/m2/s"  />
+	<field id="fsal_real_cea" description="Real salt flux due to ice formation (cell average)"          unit="kg/m2/s"  />
+	<field id="hflx_rain_cea" description="heat flux due to rainfall"                                   unit="W/m2"     />
+	<field id="hflx_evap_cea" description="heat flux due to evaporation"                                unit="W/m2"     />
+	<field id="hflx_snow_cea" description="heat flux due to snow falling over ice-free ocean"           unit="W/m2"     />
+	<field id="hflx_ice_cea"  description="heat flux due to ice thermodynamics"                         unit="W/m2"     />
+	<field id="hflx_rnf_cea"  description="heat flux due to runoffs"                                    unit="W/m2"     />
+	<field id="hflx_cal_cea"  description="heat flux due to calving"                                    unit="W/m2"     />
+	<field id="bicemel_cea"  description="Rate of Melt at Sea Ice Base (cell average)"                  unit="kg/m2/s"  />
+	<field id="licepro_cea"  description="Lateral Sea Ice Growth Rate (cell average)"                   unit="kg/m2/s"  />
+	<field id="snowmel_cea"  description="Snow Melt Rate (cell average)"                                unit="kg/m2/s"  />
+	<field id="sntoice_cea"  description="Snow-Ice Formation Rate (cell average)"                       unit="kg/m2/s"  />
+	<field id="ticemel_cea"  description="Rate of Melt at Upper Surface of Sea Ice (cell average)"      unit="kg/m2/s"  />
+
+      </group>
+
+      <!-- U grid -->
+      
+      <group id="grid_U"  axis_ref="depthu" grid_ref="grid_U">
+	<field id="utau"         description="Wind Stress along i-axis"                    unit="N/m2" axis_ref="none" />
+	<field id="uoce"         description="ocean current along i-axis"                  unit="m/s"                  />
+	<field id="uocetr_eff"   description="Effective ocean transport along i-axis"      unit="m3/s"                  />
+	<!-- uoce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="uoce_eiv"     description="EIV ocean current along i-axis"              unit="m/s"                  />
+	<!-- uoce_eiv: available with key_trabbl -->
+	<field id="uoce_bbl"     description="BBL ocean current along i-axis"              unit="m/s"  axis_ref="none" />
+	<field id="ahu_bbl"      description="BBL diffusive flux along i-axis"             unit="m3/s" axis_ref="none" />
+ 	<!-- variables available with key_diaar5 -->
+	<field id="u_masstr"     description="ocean eulerian mass transport along i-axis"  unit="kg/s"                 />
+	<field id="u_heattr"     description="ocean eulerian heat transport along i-axis"  unit="W"    axis_ref="none" />
+	<field id="ueiv_heattr"  description="ocean bolus heat transport along i-axis"     unit="W"    axis_ref="none" />
+	<field id="udiff_heattr" description="ocean diffusion heat transport along i-axis" unit="W"    axis_ref="none" />
+     </group>
+      
+      <!-- V grid -->
+      
+      <group id="grid_V"  axis_ref="depthv" grid_ref="grid_V">
+	<field id="vtau"         description="Wind Stress along j-axis"                    unit="N/m2" axis_ref="none" />
+	<field id="voce"         description="ocean current along j-axis"                  unit="m/s"                  />
+	<field id="vocetr_eff"   description="Effective ocean transport along j-axis"      unit="m3/s"                  />
+	<!-- voce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="voce_eiv"     description="EIV ocean current along j-axis"              unit="m/s"                  />
+	<!-- voce_eiv: available with key_trabbl -->
+	<field id="voce_bbl"     description="BBL ocean current along j-axis"              unit="m/s" axis_ref="none"  />
+	<field id="ahv_bbl"      description="BBL diffusive flux along j-axis"             unit="m3/s" axis_ref="none" />
+	<!-- variables available with key_diaar5 -->
+	<field id="v_masstr"     description="ocean eulerian mass transport along j-axis"  unit="kg/s"                 />
+	<field id="v_heattr"     description="ocean eulerian heat transport along j-axis"  unit="W"    axis_ref="none" />
+	<field id="veiv_heattr"  description="ocean bolus heat transport along j-axis"     unit="W"    axis_ref="none" />
+	<field id="vdiff_heattr" description="ocean diffusion heat transport along j-axis" unit="W"    axis_ref="none" />
+      </group>
+      
+      <!-- W grid -->
+      
+      <group id="grid_W"  axis_ref="depthw" grid_ref="grid_W">
+	<field id="woce"         description="ocean vertical velocity"                     unit="m/s"                  />
+	<field id="wocetr_eff"   description="effective ocean vertical transport"          unit="m3/s"                 />
+	<!-- woce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="woce_eiv"     description="EIV ocean vertical velocity"                 unit="m/s"                  />
+	<!-- woce_eiv: available with key_trabbl_adv -->
+	<field id="avt"          description="vertical eddy diffusivity"                   unit="m2/s"                 />
+	<field id="avm"          description="vertical eddy viscosity"                     unit="m2/s"                 />
+	<!-- avs: available with key_zdfddm -->
+	<field id="avs"          description="salt vertical eddy diffusivity"              unit="m2/s"                 />
+	<!-- avt_evd and avm_evd: available with ln_zdfevd -->
+	<field id="avt_evd"      description="enhanced vertical diffusivity"               unit="m2/s"                 />
+	<field id="avm_evd"      description="enhanced vertical viscosity"                 unit="m2/s"                 />
+	<!-- aht2d and  aht2d_eiv: available with key_traldf_eiv and key_traldf_c2d -->
+	<field id="aht2d"        description="lateral eddy diffusivity"                    unit="m2/s" axis_ref="none" />
+	<field id="aht2d_eiv"    description="EIV lateral eddy diffusivity"                unit="m2/s" axis_ref="none" />
+	<!-- avt_tide: available with key_zdftmx -->
+	<field id="av_tide"      description="tidal vertical diffusivity"                  unit="m2/s"                 />
+	<!-- variables available with key_diaar5 -->   
+	<field id="w_masstr"     description="vertical mass trasport"                      unit="kg/s"                 />
+	<field id="w_masstr2"    description="square of vertical mass trasport"            unit="kg2/s2"               />
+      </group>
+          
+      <!-- scalar -->
+      
+      <!-- variables available with key_diaar5 -->
+      <group id="scalar" axis_ref="none" grid_ref="scalarpoint" zoom_ref="1point" >
+	<field id="voltot"     description="global mean volume"                         unit="m3"   />
+	<field id="sshtot"     description="global mean ssh"                            unit="m"    />
+	<field id="sshsteric"  description="global mean ssh steric"                     unit="m"    />
+	<field id="sshthster"  description="global mean ssh thermosteric"               unit="m"    />
+	<field id="masstot"    description="global mean mass"                           unit="kg"   />
+	<field id="temptot"    description="global mean temperature"                    unit="degC" />
+	<field id="saltot"     description="global mean salinity"                       unit="psu"  />
+	<field id="fram_trans" description="Sea Ice Mass Transport Through Fram Strait" unit="kg/s" />
+      </group>
+
+    </field_definition>
+    
+    <!-- 
+============================================================================================================
+=                                           output files definition                                        =
+=                                            Define your own files                                         =
+=                                         put the variables you want...                                    =
+============================================================================================================
+    -->
+    
+    <file_definition >
+
+      <group id="1h" output_freq="3600"   output_level="10" enabled=".TRUE.">                      <!-- 1h files -->
+      </group>
+      
+      <group id="2h" output_freq="7200"   output_level="10" enabled=".TRUE.">                      <!-- 2h files -->
+      </group>
+      
+      <group id="3h" output_freq="10800"  output_level="10" enabled=".TRUE.">                      <!-- 3h files -->
+      </group>
+      
+      <group id="4h" output_freq="14400"  output_level="10" enabled=".TRUE.">                      <!-- 4h files -->
+      </group>
+      
+      <group id="6h" output_freq="21600"  output_level="10" enabled=".TRUE.">                      <!-- 6h files -->
+      </group>
+      
+      <group id="1d" output_freq="86400"  output_level="10" enabled=".TRUE.">                      <!-- 1d files -->
+
+    <!-- 
+............................................................................................................
+           example of 3 types of 1d files
+............................................................................................................
+    -->
+	<!-- automatic definition of the name based on id="1d_grid_T" 
+	     => this name is used as the radical for all file names of this group
+	     => add a suffix to be sure that all files names of this group are different   -->
+	<group id="1d_grid_T" name="auto" description="ocean T grid variables" >
+	  <!-- mooring: automatic definition of the file name suffix based on id="0n180wT"  -->
+	  <file id="0n180wT" name_suffix="auto" >
+	    <group id="0n180wT" zoom_ref="0n180wT" >    <!-- group of variables sharing the same zoom -->
+	      <field ref="toce" name="votemper"  />
+	      <field ref="uoce" name="vozocrtx"  />     <!-- include a U-grid variable in the list => switch to T-grid -->
+	    </group>
+	  </file>
+	  <!-- Equatorial section: automatic definition of the file name suffix based on id="EqT" -->
+	  <file id="EqT" name_suffix="auto" >
+	    <group id="EqT" zoom_ref="EqT" >
+	      <field ref="toce" name="votemper"  />
+	    </group>
+	  </file>
+	  <!-- global file with different operations on data   -->
+	  <file id="global" >
+	    <field ref="sst"    name="sst_1d_ave"                       />     <!-- mean -->
+	    <field ref="sst"    name="sst_1d_max"  operation="t_max(X)" />     <!-- max -->
+	  </file>
+	</group>
+
+      </group>
+      
+      <group id="3d" output_freq="259200" output_level="10" enabled=".TRUE.">                      <!-- 3d files -->
+      </group>
+      
+      <group id="5d" output_freq="432000" output_level="10" enabled=".TRUE.">                      <!-- 5d files -->
+
+	<file id="5d_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="toce"         name="votemper"  />
+	  <field ref="soce"         name="vosaline"  />
+	  <field ref="sst"          name="sosstsst"  />
+	  <field ref="sss"          name="sosaline"  />
+	  <field ref="ssh"          name="sossheig"  />
+	  <field ref="empmr"        name="sowaflup"  />
+	  <field ref="qsr"          name="soshfldo"  />
+	  <field ref="empsmr"       name="sowaflcd"  />
+	  <field ref="qt"           name="sohefldo"  />
+	  <field ref="mldr10_1"     name="somxl010"  />
+	  <field ref="mldkz5"       name="somixhgt"  />
+	  <field ref="ice_cover"    name="soicecov"  />
+	  <field ref="wspd"         name="sowindsp"  />
+	  <field ref="qrp"          name="sohefldp"  />
+	  <field ref="erp"          name="sowafldp"  />
+	  <field ref="mlddzt"       name="sothedep"  />
+	  <field ref="20d"          name="so20chgt"  />
+	  <field ref="28d"          name="so28chgt"  />
+	  <field ref="hc300"        name="sohtc300"  />
+	  <field ref="ist_ipa"      name="soicetem"  />
+	  <field ref="icealb_cea"   name="soicealb"  />   
+	</file>
+	
+	<file id="5d_grid_U" name="auto" description="ocean U grid variables" >
+	  <field ref="uoce"         name="vozocrtx"  />
+	  <field ref="uoce_eiv"     name="vozoeivu"  />
+	  <field ref="utau"         name="sozotaux"  />
+	</file>
+	
+	<file id="5d_grid_V" name="auto" description="ocean V grid variables" >
+	  <field ref="voce"         name="vomecrty"  />
+	  <field ref="voce_eiv"     name="vomeeivv"  />
+	  <field ref="vtau"         name="sometauy"  />
+	</file>
+	
+	<file id="5d_grid_W" name="auto" description="ocean W grid variables" >
+	  <field ref="woce"         name="vovecrtz" />
+	  <field ref="woce_eiv"     name="voveeivw" />
+	  <field ref="avt"          name="votkeavt" />
+	  <field ref="avt_evd"      name="votkeevd" />
+	  <field ref="avm"          name="votkeavm" />
+	  <field ref="avm_evd"      name="votkeevm" />
+	  <field ref="avs"          name="voddmavs" />
+	  <field ref="aht2d"        name="soleahtw" />
+	  <field ref="aht2d_eiv"    name="soleaeiw" />
+	</file>
+	
+	<file id="5d_icemod" name="auto" description="ice variables" >
+	  <field ref="ice_pres"                     />
+	  <field ref="snowthic_cea" name="isnowthi" />
+	  <field ref="icethic_cea"  name="iicethic" />
+	  <field ref="iceprod_cea"  name="iiceprod" />
+	  <field ref="ist_ipa"      name="iicetemp" />
+	  <field ref="ioceflxb"     name="ioceflxb" />
+	  <field ref="uice_ipa"     name="iicevelu" />
+	  <field ref="vice_ipa"     name="iicevelv" />
+	  <field ref="utau_ice"     name="iicestru" />
+	  <field ref="vtau_ice"     name="iicestrv" />
+	  <field ref="qsr_io_cea"   name="iicesflx" />
+	  <field ref="qns_io_cea"   name="iicenflx" />
+	  <field ref="snowpre"      name="isnowpre" />
+	</file>
+	
+      </group>
+      
+      <group id="1m" output_freq="-1"     output_level="10" enabled=".TRUE.">                      <!-- real monthly files -->
+
+	<file id="1m_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="sst"          name="sosstsst"  />
+	</file>   
+
+      </group>
+
+      <group id="2m" output_freq="-2"     output_level="10" enabled=".TRUE.">                      <!-- real 2m files -->
+      </group>
+
+      <group id="3m" output_freq="-3"     output_level="10" enabled=".TRUE.">                      <!-- real 3m files -->
+      </group>
+
+      <group id="4m" output_freq="-4"     output_level="10" enabled=".TRUE.">                      <!-- real 4m files -->
+      </group>
+
+      <group id="6m" output_freq="-6"     output_level="10" enabled=".TRUE.">                      <!-- real 6m files -->
+      </group>
+
+      <group id="1y" output_freq="-12"    output_level="10" enabled=".TRUE.">                      <!-- real yearly files -->
+
+	<file id="1y_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="mldr10_1"     name="sobowlin"  operation="t_max(X)" />
+	</file>
+
+      </group>
+
+      <group id="2y"  output_freq="-24"   output_level="10" enabled=".TRUE.">                      <!-- real 2y files -->
+      </group>
+
+      <group id="5y"  output_freq="-60"   output_level="10" enabled=".TRUE.">                      <!-- real 5y files -->
+      </group>
+
+      <group id="10y" output_freq="-120"  output_level="10" enabled=".TRUE.">                      <!-- real 10y files -->
+      </group>
+
+    </file_definition>
+    
+    <!-- 
+============================================================================================================
+=                                           grid definition                                                =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+    
+    <axis_definition>  
+      <axis id="deptht" description="Vertical T levels" unit="m" positive=".false." />
+      <axis id="depthu" description="Vertical U levels" unit="m" positive=".false." />
+      <axis id="depthv" description="Vertical V levels" unit="m" positive=".false." />
+      <axis id="depthw" description="Vertical W levels" unit="m" positive=".false." />
+      <axis id="none" description="axe non defini" unit="none" size="1" />
+    </axis_definition> 
+    
+    <grid_definition>
+      <grid id="grid_T" description="grid T" >
+    <!--   Eq section   -->
+	<zoom id="EqT" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+    <!--   TAO   -->
+      <!--   137e   -->
+	<zoom id="2n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   147e   -->
+	<zoom id="0n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   156e   -->
+	<zoom id="5s156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   165e   -->
+	<zoom id="8s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   180w   -->
+	<zoom id="8s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   170w   -->
+	<zoom id="8s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   155w   -->
+	<zoom id="8s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   140w   -->
+	<zoom id="8s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   125w   -->
+	<zoom id="8s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   110w   -->
+	<zoom id="8s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   95w   -->
+	<zoom id="8s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+    <!--   RAMA   -->
+      <!--   55e   -->
+	<zoom id="16s55eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s55eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+ 	<zoom id="8s55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s55eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n55eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   65e   -->
+	<zoom id="15n65eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   67e   -->
+	<zoom id="16s67eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s67eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s67eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n67eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   80.5e   -->
+	<zoom id="16s80.5eT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s80.5eT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s80.5eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n80.5eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   90e   -->
+	<zoom id="1.5s90eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n90eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n90eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="15n90eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   95e   -->
+	<zoom id="16s95eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s95eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s95eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s95eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+    <!--   PIRATA   -->
+      <!--   38w-30w   -->
+	<zoom id="19s34wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="14s32wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s30wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n35wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n38wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n38wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="15n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="20n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   23w   -->
+	<zoom id="0n23wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n23wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n23wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="21n23wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   10w   -->
+	<zoom id="10s10wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="6s10wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n10wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   0e   -->
+	<zoom id="0n0eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      </grid>
+
+      <grid id="grid_U" description="grid U" >
+    <!--   Eq section   -->
+	<zoom id="EqU" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+      </grid>
+
+      <grid id="grid_V" description="grid V" >
+      </grid>
+
+      <grid id="grid_W" description="grid W" >
+    <!--   Eq section   -->
+	<zoom id="EqW" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+      </grid>
+
+      <grid id="scalarpoint" description="scalar" >
+	<zoom id="1point" ibegin="1" jbegin="1" ni="1" nj="1" />
+      </grid>
+
+    </grid_definition>    
+    
+  </context>
+  <context id="1_nemo">
+    
+    <!-- $id$ -->
+    
+    <!-- 
+============================================================================================================
+=                                  definition of all existing variables                                    =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+    
+    <field_definition level="1" prec="4" operation="ave(X)" enabled=".TRUE."> <!-- time step automaticaly defined -->
+
+      <!-- T grid -->
+      
+      <group id="grid_T" axis_ref="none" grid_ref="grid_T">
+	<field id="toce"         description="temperature"                               unit="degC" axis_ref="deptht"   />
+       	<field id="soce"         description="salinity"                                  unit="psu"  axis_ref="deptht"   />
+	<field id="sst"          description="sea surface temperature"                   unit="degC"                     />
+	<field id="sst2"         description="square of sea surface temperature"         unit="degC2"                    />
+	<field id="sstgrad"      description="module of sst gradient"                    unit="degC/m"                   />
+	<field id="sstgrad2"     description="square of module of sst gradient"          unit="degC2/m2"                 />
+	<field id="sss"          description="sea surface salinity"                      unit="psu"                      />
+	<field id="sss2"         description="square of sea surface salinity"            unit="psu2"                     />
+	<field id="ssh"          description="sea surface height"                        unit="m"                        />
+	<field id="ssh2"         description="square of sea surface height"              unit="m2"                       />
+	<field id="mldkz5"       description="mixing layer depth (Turbocline)"           unit="m"                        />
+	<field id="mldr10_1"     description="Mixed Layer Depth 0.01 ref.10m"            unit="m"                        />
+       	<field id="rhop"         description="potential density (sigma0)"                unit="kg/m3" axis_ref="deptht"  />
+	<!-- next variables available with key_diahth -->
+	<field id="mlddzt"       description="Thermocline Depth (max dT/dz)"             unit="m"                        />
+	<field id="mldr10_3"     description="Mixed Layer Depth dr=0.03 (ref.10m)"       unit="m"                        />
+	<field id="mldr0_1"      description="Mixed Layer Depth dr=0.01 (ref.surf)"      unit="m"                        />
+	<field id="mldr0_3"      description="Mixed Layer Depth dr=0.03 (ref.surf)"      unit="m"                        />
+	<field id="mld_dt02"     description="Mixed Layer Depth |dt|=0.2 (ref.10m)"      unit="m"                        />
+	<field id="topthdep"     description="Top of the thermocline dt=-0.2 (ref.10m)"  unit="m"                        />
+	<field id="pycndep"      description="Pycnocline depth dr~dt=-0.2 (ref.10m)"     unit="m"                        />
+	<field id="BLT"          description="Barrier Layer Thickness"                   unit="m"                        />
+	<field id="tinv"         description="Max of vertical invertion of temperature"  unit="degC"                     />
+	<field id="depti"        description="Depth of max. vert. inv. of temperature"   unit="m"                        />
+        <field id="20d"          description="Depth of 20C isotherm"                     unit="m"                        />
+	<field id="28d"          description="Depth of 28C isotherm"                     unit="m"                        />
+	<field id="hc300"        description="Heat content 300 m"                        unit="W"                        />
+	<!-- variables available with key_diaar5 -->
+	<field id="botpres"      description="Pressure at sea floor"                     unit="dbar"                     />
+	<field id="cellthc"      description="Cell thickness"                            unit="m"     axis_ref="deptht"  />
+     </group>
+
+      <!-- SBC -->
+      
+      <group id="SBC" axis_ref="none" grid_ref="grid_T" > <!-- time step automaticaly defined based on nn_fsbc -->
+
+	<field id="empmr"        description="Net Upward Water Flux"                                        unit="kg/m2/s"  />
+	<field id="empsmr"       description="concentration/dilution water flux"                            unit="kg/m2/s"  />
+	<field id="snowpre"      description="Snow precipitation"                                           unit="kg/m2/s"  />
+	<field id="runoffs"      description="River Runoffs"                                                unit="Kg/m2/s"  />
+
+	<field id="qt"           description="Net Downward Heat Flux"                                       unit="W/m2"     />
+	<field id="qns"          description="non solar Downward Heat Flux"                                 unit="W/m2"     />
+	<field id="qsr"          description="Shortwave Radiation"                                          unit="W/m2"     />
+	<field id="qsr3d"        description="Shortwave Radiation 3D distribution"        axis_ref="deptht" unit="W/m2"     />
+	<field id="qrp"          description="Surface Heat Flux: Damping"                                   unit="W/m2"     />
+	<field id="erp"          description="Surface Water Flux: Damping"                                  unit="Kg/m2/s"  />
+	<field id="taum"         description="wind stress module"                                           unit="N/m2"     />
+	<field id="wspd"         description="Wind speed module at 10 m"                                    unit="m/s"      />
+	
+	<!-- * variable relative to atmospheric pressure forcing : available with ln_apr_dyn -->
+	<field id="ssh_ib"       description="Inverse barometer sea surface height"                         unit="m"        />
+
+	<!-- *_oce variables available with ln_blk_clio or ln_blk_core -->
+	<field id="qns_oce"      description="Non solar Downward Heat Flux over open ocean"                 unit="W/m2"     />
+	<field id="qlw_oce"      description="Longwave Downward Heat Flux over open ocean"                  unit="W/m2"     />
+	<field id="qsb_oce"      description="Sensible Downward Heat Flux over open ocean"                  unit="W/m2"     />
+	<field id="qla_oce"      description="Latent Downward Heat Flux over open ocean"                    unit="W/m2"     />
+	<field id="taum_oce"     description="wind stress module over open ocean"                           unit="N/m2"     />
+
+	<field id="ice_cover"    description="Ice fraction"                                                 unit="1"        />
+
+	<field id="ioceflxb"     description="Oceanic flux at the ice base"                                 unit="W/m2"     />
+	<field id="qsr_ai_cea"   description="Air-Ice downward solar heat flux (cell average)"              unit="W/m2"     />
+	<field id="qns_ai_cea"   description="Air-Ice downward non-solar heat flux (cell average)"          unit="W/m2"     />
+	<field id="qla_ai_cea"   description="Air-Ice downward Latent heat flux (cell average)"             unit="W/m2"     />
+	
+	<field id="qsr_io_cea"   description="Ice-Oce downward solar heat flux (cell average)"              unit="W/m2"     />
+	<field id="qns_io_cea"   description="Ice-Oce downward non-solar heat flux (cell average)"          unit="W/m2"     />
+	
+	<field id="snowthic_cea" description="Snow thickness (cell average)"                                unit="m"        />
+	<field id="icethic_cea"  description="Ice thickness (cell average)"                                 unit="m"        />
+	<field id="iceprod_cea"  description="Ice production (cell average)"                                unit="m/s"      />
+	
+	<field id="ice_pres"     description="Ice presence"                                                 unit="-"        />
+	<field id="ist_cea"      description="Ice surface temperature (cell average)"                       unit="degC"     />
+	<field id="ist_ipa"      description="Ice surface temperature (ice presence average)"               unit="degC"     />      
+	<field id="uice_ipa"     description="Ice velocity along i-axis at I-point (ice presence average)"  unit="m/s"      />      
+	<field id="vice_ipa"     description="Ice velocity along j-axis at I-point (ice presence average)"  unit="m/s"      />      
+	
+	<field id="utau_ice"     description="Wind stress along i-axis over the ice at i-point"             unit="N/m2"     />
+	<field id="vtau_ice"     description="Wind stress along j-axis over the ice at i-point"             unit="N/m2"     />
+	
+	<field id="u_imasstr"    description="Sea-ice mass transport along i-axis"                          unit="kg/s"     />
+	<field id="v_imasstr"    description="Sea-ice mass transport along j-axis"                          unit="kg/s"     />
+
+	<!-- available key_coupled -->
+	<field id="snow_ao_cea"  description="Snow over ice-free ocean (cell average)"                      unit="kg/m2/s"  />
+	<field id="snow_ai_cea"  description="Snow over sea-ice (cell average)"                             unit="kg/m2/s"  />
+	<field id="subl_ai_cea"  description="Sublimation over sea-ice (cell average)"                      unit="kg/m2/s"  />
+	<field id="icealb_cea"   description="Ice albedo (cell average)"                                    unit="1"        />
+	<field id="calving"      description="Calving"                                                      unit="kg/m2/s"  />
+	<!-- available if key_coupled + conservative method -->
+	<field id="rain"         description="Liquid precipitation"                                         unit="Kg/m2/s"  />
+	<field id="evap_ao_cea"  description="Evaporation over ice-free ocean (cell average)"               unit="kg/m2/s"  />
+	<!-- variables available with key_diaar5 -->
+	<field id="isnwmlt_cea"   description="Snow over Ice melting (cell average)"                        unit="kg/m2/s"  />
+	<field id="fsal_virt_cea" description="Virtual salt flux due to ice formation (cell average)"       unit="kg/m2/s"  />
+	<field id="fsal_real_cea" description="Real salt flux due to ice formation (cell average)"          unit="kg/m2/s"  />
+	<field id="hflx_rain_cea" description="heat flux due to rainfall"                                   unit="W/m2"     />
+	<field id="hflx_evap_cea" description="heat flux due to evaporation"                                unit="W/m2"     />
+	<field id="hflx_snow_cea" description="heat flux due to snow falling over ice-free ocean"           unit="W/m2"     />
+	<field id="hflx_ice_cea"  description="heat flux due to ice thermodynamics"                         unit="W/m2"     />
+	<field id="hflx_rnf_cea"  description="heat flux due to runoffs"                                    unit="W/m2"     />
+	<field id="hflx_cal_cea"  description="heat flux due to calving"                                    unit="W/m2"     />
+	<field id="bicemel_cea"  description="Rate of Melt at Sea Ice Base (cell average)"                  unit="kg/m2/s"  />
+	<field id="licepro_cea"  description="Lateral Sea Ice Growth Rate (cell average)"                   unit="kg/m2/s"  />
+	<field id="snowmel_cea"  description="Snow Melt Rate (cell average)"                                unit="kg/m2/s"  />
+	<field id="sntoice_cea"  description="Snow-Ice Formation Rate (cell average)"                       unit="kg/m2/s"  />
+	<field id="ticemel_cea"  description="Rate of Melt at Upper Surface of Sea Ice (cell average)"      unit="kg/m2/s"  />
+
+      </group>
+
+      <!-- U grid -->
+      
+      <group id="grid_U"  axis_ref="depthu" grid_ref="grid_U">
+	<field id="utau"         description="Wind Stress along i-axis"                    unit="N/m2" axis_ref="none" />
+	<field id="uoce"         description="ocean current along i-axis"                  unit="m/s"                  />
+	<field id="uocetr_eff"   description="Effective ocean transport along i-axis"      unit="m3/s"                  />
+	<!-- uoce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="uoce_eiv"     description="EIV ocean current along i-axis"              unit="m/s"                  />
+	<!-- uoce_eiv: available with key_trabbl -->
+	<field id="uoce_bbl"     description="BBL ocean current along i-axis"              unit="m/s"  axis_ref="none" />
+	<field id="ahu_bbl"      description="BBL diffusive flux along i-axis"             unit="m3/s" axis_ref="none" />
+ 	<!-- variables available with key_diaar5 -->
+	<field id="u_masstr"     description="ocean eulerian mass transport along i-axis"  unit="kg/s"                 />
+	<field id="u_heattr"     description="ocean eulerian heat transport along i-axis"  unit="W"    axis_ref="none" />
+	<field id="ueiv_heattr"  description="ocean bolus heat transport along i-axis"     unit="W"    axis_ref="none" />
+	<field id="udiff_heattr" description="ocean diffusion heat transport along i-axis" unit="W"    axis_ref="none" />
+     </group>
+      
+      <!-- V grid -->
+      
+      <group id="grid_V"  axis_ref="depthv" grid_ref="grid_V">
+	<field id="vtau"         description="Wind Stress along j-axis"                    unit="N/m2" axis_ref="none" />
+	<field id="voce"         description="ocean current along j-axis"                  unit="m/s"                  />
+	<field id="vocetr_eff"   description="Effective ocean transport along j-axis"      unit="m3/s"                  />
+	<!-- voce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="voce_eiv"     description="EIV ocean current along j-axis"              unit="m/s"                  />
+	<!-- voce_eiv: available with key_trabbl -->
+	<field id="voce_bbl"     description="BBL ocean current along j-axis"              unit="m/s" axis_ref="none"  />
+	<field id="ahv_bbl"      description="BBL diffusive flux along j-axis"             unit="m3/s" axis_ref="none" />
+	<!-- variables available with key_diaar5 -->
+	<field id="v_masstr"     description="ocean eulerian mass transport along j-axis"  unit="kg/s"                 />
+	<field id="v_heattr"     description="ocean eulerian heat transport along j-axis"  unit="W"    axis_ref="none" />
+	<field id="veiv_heattr"  description="ocean bolus heat transport along j-axis"     unit="W"    axis_ref="none" />
+	<field id="vdiff_heattr" description="ocean diffusion heat transport along j-axis" unit="W"    axis_ref="none" />
+      </group>
+      
+      <!-- W grid -->
+      
+      <group id="grid_W"  axis_ref="depthw" grid_ref="grid_W">
+	<field id="woce"         description="ocean vertical velocity"                     unit="m/s"                  />
+	<field id="wocetr_eff"   description="effective ocean vertical transport"          unit="m3/s"                 />
+	<!-- woce_eiv: available with key_traldf_eiv and key_diaeiv -->
+	<field id="woce_eiv"     description="EIV ocean vertical velocity"                 unit="m/s"                  />
+	<!-- woce_eiv: available with key_trabbl_adv -->
+	<field id="avt"          description="vertical eddy diffusivity"                   unit="m2/s"                 />
+	<field id="avm"          description="vertical eddy viscosity"                     unit="m2/s"                 />
+	<!-- avs: available with key_zdfddm -->
+	<field id="avs"          description="salt vertical eddy diffusivity"              unit="m2/s"                 />
+	<!-- avt_evd and avm_evd: available with ln_zdfevd -->
+	<field id="avt_evd"      description="enhanced vertical diffusivity"               unit="m2/s"                 />
+	<field id="avm_evd"      description="enhanced vertical viscosity"                 unit="m2/s"                 />
+	<!-- aht2d and  aht2d_eiv: available with key_traldf_eiv and key_traldf_c2d -->
+	<field id="aht2d"        description="lateral eddy diffusivity"                    unit="m2/s" axis_ref="none" />
+	<field id="aht2d_eiv"    description="EIV lateral eddy diffusivity"                unit="m2/s" axis_ref="none" />
+	<!-- avt_tide: available with key_zdftmx -->
+	<field id="av_tide"      description="tidal vertical diffusivity"                  unit="m2/s"                 />
+	<!-- variables available with key_diaar5 -->   
+	<field id="w_masstr"     description="vertical mass trasport"                      unit="kg/s"                 />
+	<field id="w_masstr2"    description="square of vertical mass trasport"            unit="kg2/s2"               />
+      </group>
+          
+      <!-- scalar -->
+      
+      <!-- variables available with key_diaar5 -->
+      <group id="scalar" axis_ref="none" grid_ref="scalarpoint" zoom_ref="1point" >
+	<field id="voltot"     description="global mean volume"                         unit="m3"   />
+	<field id="sshtot"     description="global mean ssh"                            unit="m"    />
+	<field id="sshsteric"  description="global mean ssh steric"                     unit="m"    />
+	<field id="sshthster"  description="global mean ssh thermosteric"               unit="m"    />
+	<field id="masstot"    description="global mean mass"                           unit="kg"   />
+	<field id="temptot"    description="global mean temperature"                    unit="degC" />
+	<field id="saltot"     description="global mean salinity"                       unit="psu"  />
+	<field id="fram_trans" description="Sea Ice Mass Transport Through Fram Strait" unit="kg/s" />
+      </group>
+
+    </field_definition>
+    
+    <!-- 
+============================================================================================================
+=                                           output files definition                                        =
+=                                            Define your own files                                         =
+=                                         put the variables you want...                                    =
+============================================================================================================
+    -->
+    
+    <file_definition >
+
+      <group id="1h" output_freq="3600"   output_level="10" enabled=".TRUE.">                      <!-- 1h files -->
+      </group>
+      
+      <group id="2h" output_freq="7200"   output_level="10" enabled=".TRUE.">                      <!-- 2h files -->
+      </group>
+      
+      <group id="3h" output_freq="10800"  output_level="10" enabled=".TRUE.">                      <!-- 3h files -->
+      </group>
+      
+      <group id="4h" output_freq="14400"  output_level="10" enabled=".TRUE.">                      <!-- 4h files -->
+      </group>
+      
+      <group id="6h" output_freq="21600"  output_level="10" enabled=".TRUE.">                      <!-- 6h files -->
+      </group>
+      
+      <group id="1d" output_freq="86400"  output_level="10" enabled=".TRUE.">                      <!-- 1d files -->
+
+    <!-- 
+............................................................................................................
+           example of 3 types of 1d files
+............................................................................................................
+    -->
+	<!-- automatic definition of the name based on id="1d_grid_T" 
+	     => this name is used as the radical for all file names of this group
+	     => add a suffix to be sure that all files names of this group are different   -->
+	<group id="1d_grid_T" name="auto" description="ocean T grid variables" >
+	  <!-- mooring: automatic definition of the file name suffix based on id="0n180wT"  -->
+	  <file id="0n180wT" name_suffix="auto" >
+	    <group id="0n180wT" zoom_ref="0n180wT" >    <!-- group of variables sharing the same zoom -->
+	      <field ref="toce" name="votemper"  />
+	      <field ref="uoce" name="vozocrtx"  />     <!-- include a U-grid variable in the list => switch to T-grid -->
+	    </group>
+	  </file>
+	  <!-- Equatorial section: automatic definition of the file name suffix based on id="EqT" -->
+<!--
+	  <file id="EqT" name_suffix="auto" >
+	    <group id="EqT" zoom_ref="EqT" >
+	      <field ref="toce" name="votemper"  />
+	    </group>
+	  </file>
+-->	  
+	  <!-- global file with different operations on data   -->
+	  <file id="global" >
+	    <field ref="sst"    name="sst_1d_ave"                       />     <!-- mean -->
+	    <field ref="sst"    name="sst_1d_max"  operation="t_max(X)" />     <!-- max -->
+	  </file>
+	</group>
+
+      </group>
+      
+      <group id="3d" output_freq="259200" output_level="10" enabled=".TRUE.">                      <!-- 3d files -->
+      </group>
+      
+      <group id="5d" output_freq="432000" output_level="10" enabled=".TRUE.">                      <!-- 5d files -->
+
+	<file id="5d_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="toce"         name="votemper"  />
+	  <field ref="soce"         name="vosaline"  />
+	  <field ref="sst"          name="sosstsst"  />
+	  <field ref="sss"          name="sosaline"  />
+	  <field ref="ssh"          name="sossheig"  />
+	  <field ref="empmr"        name="sowaflup"  />
+	  <field ref="qsr"          name="soshfldo"  />
+	  <field ref="empsmr"       name="sowaflcd"  />
+	  <field ref="qt"           name="sohefldo"  />
+	  <field ref="mldr10_1"     name="somxl010"  />
+	  <field ref="mldkz5"       name="somixhgt"  />
+	  <field ref="ice_cover"    name="soicecov"  />
+	  <field ref="wspd"         name="sowindsp"  />
+	  <field ref="qrp"          name="sohefldp"  />
+	  <field ref="erp"          name="sowafldp"  />
+	  <field ref="mlddzt"       name="sothedep"  />
+	  <field ref="20d"          name="so20chgt"  />
+	  <field ref="28d"          name="so28chgt"  />
+	  <field ref="hc300"        name="sohtc300"  />
+	  <field ref="ist_ipa"      name="soicetem"  />
+	  <field ref="icealb_cea"   name="soicealb"  />   
+	</file>
+	
+	<file id="5d_grid_U" name="auto" description="ocean U grid variables" >
+	  <field ref="uoce"         name="vozocrtx"  />
+	  <field ref="uoce_eiv"     name="vozoeivu"  />
+	  <field ref="utau"         name="sozotaux"  />
+	</file>
+	
+	<file id="5d_grid_V" name="auto" description="ocean V grid variables" >
+	  <field ref="voce"         name="vomecrty"  />
+	  <field ref="voce_eiv"     name="vomeeivv"  />
+	  <field ref="vtau"         name="sometauy"  />
+	</file>
+	
+	<file id="5d_grid_W" name="auto" description="ocean W grid variables" >
+	  <field ref="woce"         name="vovecrtz" />
+	  <field ref="woce_eiv"     name="voveeivw" />
+	  <field ref="avt"          name="votkeavt" />
+	  <field ref="avt_evd"      name="votkeevd" />
+	  <field ref="avm"          name="votkeavm" />
+	  <field ref="avm_evd"      name="votkeevm" />
+	  <field ref="avs"          name="voddmavs" />
+	  <field ref="aht2d"        name="soleahtw" />
+	  <field ref="aht2d_eiv"    name="soleaeiw" />
+	</file>
+	
+<!--	
+      <file id="5d_icemod" name="auto" description="ice variables" >
+	  <field ref="ice_pres"                     />
+	  <field ref="snowthic_cea" name="isnowthi" />
+	  <field ref="icethic_cea"  name="iicethic" />
+	  <field ref="iceprod_cea"  name="iiceprod" />
+	  <field ref="ist_ipa"      name="iicetemp" />
+	  <field ref="ioceflxb"     name="ioceflxb" />
+	  <field ref="uice_ipa"     name="iicevelu" />
+	  <field ref="vice_ipa"     name="iicevelv" />
+	  <field ref="utau_ice"     name="iicestru" />
+	  <field ref="vtau_ice"     name="iicestrv" />
+	  <field ref="qsr_io_cea"   name="iicesflx" />
+	  <field ref="qns_io_cea"   name="iicenflx" />
+	  <field ref="snowpre"      name="isnowpre" />
+	</file>
+-->	
+      </group>
+      
+      <group id="1m" output_freq="-1"     output_level="10" enabled=".TRUE.">                      <!-- real monthly files -->
+
+	<file id="1m_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="sst"          name="sosstsst"  />
+	</file>   
+
+      </group>
+
+      <group id="2m" output_freq="-2"     output_level="10" enabled=".TRUE.">                      <!-- real 2m files -->
+      </group>
+
+      <group id="3m" output_freq="-3"     output_level="10" enabled=".TRUE.">                      <!-- real 3m files -->
+      </group>
+
+      <group id="4m" output_freq="-4"     output_level="10" enabled=".TRUE.">                      <!-- real 4m files -->
+      </group>
+
+      <group id="6m" output_freq="-6"     output_level="10" enabled=".TRUE.">                      <!-- real 6m files -->
+      </group>
+
+      <group id="1y" output_freq="-12"    output_level="10" enabled=".TRUE.">                      <!-- real yearly files -->
+
+	<file id="1y_grid_T" name="auto" description="ocean T grid variables" >
+	  <field ref="mldr10_1"     name="sobowlin"  operation="t_max(X)" />
+	</file>
+
+      </group>
+
+      <group id="2y"  output_freq="-24"   output_level="10" enabled=".TRUE.">                      <!-- real 2y files -->
+      </group>
+
+      <group id="5y"  output_freq="-60"   output_level="10" enabled=".TRUE.">                      <!-- real 5y files -->
+      </group>
+
+      <group id="10y" output_freq="-120"  output_level="10" enabled=".TRUE.">                      <!-- real 10y files -->
+      </group>
+
+    </file_definition>
+    
+    <!-- 
+============================================================================================================
+=                                           grid definition                                                =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+    
+    <axis_definition>  
+      <axis id="deptht" description="Vertical T levels" unit="m" positive=".false." />
+      <axis id="depthu" description="Vertical U levels" unit="m" positive=".false." />
+      <axis id="depthv" description="Vertical V levels" unit="m" positive=".false." />
+      <axis id="depthw" description="Vertical W levels" unit="m" positive=".false." />
+      <axis id="none" description="axe non defini" unit="none" size="1" />
+    </axis_definition> 
+    
+    <grid_definition>
+      <grid id="grid_T" description="grid T" >
+    <!--   Eq section   -->
+	<zoom id="EqT" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+    <!--   TAO   -->
+      <!--   137e   -->
+	<zoom id="2n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n137eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   147e   -->
+	<zoom id="0n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n147eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   156e   -->
+	<zoom id="5s156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n156eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   165e   -->
+	<zoom id="8s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n165eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   180w   -->
+	<zoom id="8s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n180wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   170w   -->
+	<zoom id="8s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n170wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   155w   -->
+	<zoom id="8s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n155wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   140w   -->
+	<zoom id="8s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n140wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   125w   -->
+	<zoom id="8s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n125wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   110w   -->
+	<zoom id="8s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n110wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   95w   -->
+	<zoom id="8s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2s95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="2n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n95wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+    <!--   RAMA   -->
+      <!--   55e   -->
+	<zoom id="16s55eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s55eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+ 	<zoom id="8s55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s55eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n55eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n55eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   65e   -->
+	<zoom id="15n65eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   67e   -->
+	<zoom id="16s67eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s67eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s67eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n67eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n67eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   80.5e   -->
+	<zoom id="16s80.5eT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s80.5eT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4s80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5s80.5eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n80.5eT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n80.5eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   90e   -->
+	<zoom id="1.5s90eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="1.5n90eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n90eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n90eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="15n90eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   95e   -->
+	<zoom id="16s95eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12s95eT"    ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s95eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="5s95eT"     ibegin="0000" jbegin="0000" ni="1" nj="1" />
+    <!--   PIRATA   -->
+      <!--   38w-30w   -->
+	<zoom id="19s34wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="14s32wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8s30wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n35wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n38wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="8n38wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="15n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="20n38wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   23w   -->
+	<zoom id="0n23wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="4n23wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="12n23wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="21n23wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   10w   -->
+	<zoom id="10s10wT" ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="6s10wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+	<zoom id="0n10wT"  ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      <!--   0e   -->
+	<zoom id="0n0eT"   ibegin="0000" jbegin="0000" ni="1" nj="1" />
+      </grid>
+
+      <grid id="grid_U" description="grid U" >
+    <!--   Eq section   -->
+	<zoom id="EqU" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+      </grid>
+
+      <grid id="grid_V" description="grid V" >
+      </grid>
+
+      <grid id="grid_W" description="grid W" >
+    <!--   Eq section   -->
+	<zoom id="EqW" ibegin="1" jbegin="0000" ni="0000" nj="1" />
+      </grid>
+
+      <grid id="scalarpoint" description="scalar" >
+	<zoom id="1point" ibegin="1" jbegin="1" ni="1" nj="1" />
+      </grid>
+
+    </grid_definition>    
+    
+  </context>
+
+</simulation>
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/namelist
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/namelist	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/namelist	(revision 3680)
@@ -0,0 +1,1012 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/OPA  :  1 - run manager      (namrun)
+!! namelists    2 - Domain           (namzgr, namzgr_sco, namdom, namtsd)
+!!              3 - Surface boundary (namsbc, namsbc_ana, namsbc_flx, namsbc_clio, namsbc_core
+!!                                    namsbc_cpl, namtra_qsr, namsbc_rnf, 
+!!                                    namsbc_apr, namsbc_ssr, namsbc_alb)
+!!              4 - lateral boundary (namlbc, namcla, namobc, namagrif, nambdy, nambdy_tide)
+!!              5 - bottom  boundary (nambfr, nambbc, nambbl)
+!!              6 - Tracer           (nameos, namtra_adv, namtra_ldf, namtra_dmp)
+!!              7 - dynamics         (namdyn_adv, namdyn_vor, namdyn_hpg, namdyn_spg, namdyn_ldf)
+!!              8 - Verical physics  (namzdf, namzdf_ric, namzdf_tke, namzdf_kpp, namzdf_ddm, namzdf_tmx)
+!!              9 - diagnostics      (namnc4, namtrd, namspr, namflo, namptr, namhsb)
+!!             10 - miscellaneous    (namsol, nammpp, nammpp_dyndist, namctl)
+!!             11 - Obs & Assim      (namobs, nam_asminc)
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+!!======================================================================
+!!                   ***  Run management namelists  ***
+!!======================================================================
+!!   namrun        parameters of the run
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namrun        !   parameters of the run
+!-----------------------------------------------------------------------
+   nn_no       =       0   !  job number (no more used...)
+   cn_exp      =  "PELAGOS_OFF"  !  experience name 
+   nn_it000    =       1   !  first time step
+   nn_itend    =    3650   !  last  time step (std 5475)
+   nn_date0    =  010101   !  date at nit_0000 (format yyyymmdd) used if ln_rstart=F or (ln_rstart=T and nn_rstctl=0 or 1)
+   nn_leapy    =       0   !  Leap year calendar (1) or not (0)
+   ln_rstart   = .false.   !  start from rest (F) or from a restart file (T)
+   nn_rstctl   =       0   !  restart control => activated only if ln_rstart = T
+                           !    = 0 nn_date0 read in namelist ; nn_it000 : read in namelist
+                           !    = 1 nn_date0 read in namelist ; nn_it000 : check consistancy between namelist and restart
+                           !    = 2 nn_date0 read in restart  ; nn_it000 : check consistancy between namelist and restart
+   cn_ocerst_in  = "restart"   !  suffix of ocean restart name (input)
+   cn_ocerst_out = "restart"   !  suffix of ocean restart name (output)
+   nn_istate   =       0   !  output the initial state (1) or not (0)
+   nn_stock    =    3650   !  frequency of creation of a restart file (modulo referenced to 1)
+   nn_write    =    3650   !  frequency of write in the output file   (modulo referenced to nn_it000)
+   ln_dimgnnn  = .false.   !  DIMG file format: 1 file for all processors (F) or by processor (T)
+   ln_mskland  = .false.   !  mask land points in NetCDF outputs (costly: + ~15%)
+   ln_clobber  = .false.   !  clobber (overwrite) an existing file
+   nn_chunksz  =       0   !  chunksize (bytes) for NetCDF file (works only with iom_nf90 routines)
+/
+
+!!======================================================================
+!!                      ***  Domain namelists  ***
+!!======================================================================
+!!   namzgr       vertical coordinate
+!!   namzgr_sco   s-coordinate or hybrid z-s-coordinate
+!!   namdom       space and time domain (bathymetry, mesh, timestep)
+!!   namtsd       data: temperature & salinity                         
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namzgr        !   vertical coordinate
+!-----------------------------------------------------------------------
+   ln_zco      = .false.   !  z-coordinate - full    steps   (T/F)      ("key_zco" may also be defined)
+   ln_zps      = .true.    !  z-coordinate - partial steps   (T/F)
+   ln_sco      = .false.   !  s- or hybrid z-s-coordinate    (T/F)
+/
+!-----------------------------------------------------------------------
+&namzgr_sco    !   s-coordinate or hybrid z-s-coordinate
+!-----------------------------------------------------------------------
+   rn_sbot_min =  300.     !  minimum depth of s-bottom surface (>0) (m)
+   rn_sbot_max = 5250.     !  maximum depth of s-bottom surface (= ocean depth) (>0) (m)
+   rn_theta    =    6.0    !  surface control parameter (0<=rn_theta<=20)
+   rn_thetb    =    0.75   !  bottom control parameter  (0<=rn_thetb<= 1)
+   rn_rmax     =    0.15   !  maximum cut-off r-value allowed (0<rn_max<1)
+   ln_s_sigma  = .false.   !  hybrid s-sigma coordinates
+   rn_bb       =    0.8    !  stretching with s-sigma
+   rn_hc       =  150.0    !  critical depth with s-sigma 
+/
+!-----------------------------------------------------------------------
+&namdom        !   space and time domain (bathymetry, mesh, timestep)
+!-----------------------------------------------------------------------
+   nn_bathy    =    1      !  compute (=0) or read (=1) the bathymetry file
+   nn_closea    =   0      !  remove (=0) or keep (=1) closed seas and lakes (ORCA)
+   nn_msh      =    1      !  create (=1) a mesh file or not (=0)
+   rn_hmin     =   -3.     !  min depth of the ocean (>0) or min number of ocean level (<0)
+   rn_e3zps_min=   20.     !  partial step thickness is set larger than the minimum of
+   rn_e3zps_rat=    0.1    !  rn_e3zps_min and rn_e3zps_rat*e3t, with 0<rn_e3zps_rat<1
+                           !
+   rn_rdt      = 8640.    !  time step for the dynamics (and tracer if nn_acc=0)
+   nn_baro     =   64      !  number of barotropic time step            ("key_dynspg_ts")
+   rn_atfp     =    0.1    !  asselin time filter parameter
+   nn_acc      =    0      !  acceleration of convergence : =1      used, rdt < rdttra(k)
+                                 !                          =0, not used, rdt = rdttra
+   rn_rdtmin   = 5760.          !  minimum time step on tracers (used if nn_acc=1)
+   rn_rdtmax   = 5760.          !  maximum time step on tracers (used if nn_acc=1)
+   rn_rdth     =  800.           !  depth variation of tracer time step  (used if nn_acc=1)
+/
+!-----------------------------------------------------------------------
+&namtsd    !   data : Temperature  & Salinity                           
+!-----------------------------------------------------------------------
+!          ! file name ! frequency (hours)    ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation !
+!          !           !  (if <0  months)     !   name   !  (logical)   ! (T/F) ! 'monthly'  ! filename ! pairing  !
+   sn_tem  = 'data_1m_potential_temperature_nomask', -1,'votemper',  .true.  , .true., 'yearly'   , ' '      , ' '
+   sn_sal  = 'data_1m_salinity_nomask'             , -1,'vosaline',  .true.  , .true., 'yearly'   , ''       , ' '
+   !
+   cn_dir        = './'     !  root directory for the location of the runoff files
+   ln_tsd_init   = .true.   !  Initialisation of ocean T & S with T &S input data (T) or not (F)
+   ln_tsd_tradmp = .true.   !  damping of ocean T & S toward T &S input data (T) or not (F)
+/
+!!======================================================================
+!!            ***  Surface Boundary Condition namelists  ***
+!!======================================================================
+!!   namsbc          surface boundary condition
+!!   namsbc_ana      analytical         formulation
+!!   namsbc_flx      flux               formulation
+!!   namsbc_clio     CLIO bulk formulae formulation
+!!   namsbc_core     CORE bulk formulae formulation
+!!   namsbc_mfs      MFS  bulk formulae formulation
+!!   namsbc_cpl      CouPLed            formulation                     ("key_coupled")
+!!   namtra_qsr      penetrative solar radiation
+!!   namsbc_rnf      river runoffs
+!!   namsbc_apr      Atmospheric Pressure
+!!   namsbc_ssr      sea surface restoring term (for T and/or S)
+!!   namsbc_alb      albedo parameters
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namsbc        !   Surface Boundary Condition (surface module)
+!-----------------------------------------------------------------------
+   nn_fsbc     = 1         !  frequency of surface boundary condition computation 
+                           !     (also = the frequency of sea-ice model call)
+   ln_ana      = .false.   !  analytical formulation                    (T => fill namsbc_ana ) 
+   ln_flx      = .false.   !  flux formulation                          (T => fill namsbc_flx )
+   ln_blk_clio = .false.   !  CLIO bulk formulation                     (T => fill namsbc_clio) 
+   ln_blk_core = .true.    !  CORE bulk formulation                     (T => fill namsbc_core) 
+   ln_blk_mfs  = .false.   !  MFS bulk formulation                      (T => fill namsbc_mfs )
+   ln_cpl      = .false.   !  Coupled formulation                       (T => fill namsbc_cpl )
+   ln_apr_dyn  = .false.   !  Patm gradient added in ocean & ice Eqs.   (T => fill namsbc_apr )
+   nn_ice      = 2         !  =0 no ice boundary condition   ,
+                           !  =1 use observed ice-cover      ,
+                           !  =2 ice-model used                         ("key_lim3" or "key_lim2)
+   ln_dm2dc    = .false.   !  daily mean to diurnal cycle on short wave
+   ln_rnf      = .true.    !  runoffs                                   (T => fill namsbc_rnf)
+   ln_ssr      = .true.    !  Sea Surface Restoring on T and/or S       (T => fill namsbc_ssr)
+   nn_fwb      = 3         !  FreshWater Budget: =0 unchecked 
+                           !     =1 global mean of e-p-r set to zero at each time step 
+                           !     =2 annual global mean of e-p-r set to zero
+                           !     =3 global emp set to zero and spread out over erp area
+   ln_cdgw = .false.       !  Neutral drag coefficient read from wave model (T => fill namsbc_wave )
+/
+!-----------------------------------------------------------------------
+&namsbc_ana    !   analytical surface boundary condition
+!-----------------------------------------------------------------------
+   nn_tau000   =   0       !  gently increase the stress over the first ntau_rst time-steps
+   rn_utau0    =   0.5     !  uniform value for the i-stress
+   rn_vtau0    =   0.e0    !  uniform value for the j-stress
+   rn_qns0     =   0.e0    !  uniform value for the total heat flux
+   rn_qsr0     =   0.e0    !  uniform value for the solar radiation
+   rn_emp0     =   0.e0    !  uniform value for the freswater budget (E-P)
+/
+!-----------------------------------------------------------------------
+&namsbc_flx    !   surface boundary condition : flux formulation
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_utau     = 'utau'      ,        24         , 'utau'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_vtau     = 'vtau'      ,        24         , 'vtau'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_qtot     = 'qtot'      ,        24         , 'qtot'    , .false.      , .false., 'yearly'  , ''       , ''
+   sn_qsr      = 'qsr'       ,        24         , 'qsr'     , .false.      , .false., 'yearly'  , ''       , ''
+   sn_emp      = 'emp'       ,        24         , 'emp'     , .false.      , .false., 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the flux files
+/      
+!-----------------------------------------------------------------------
+&namsbc_clio   !   namsbc_clio  CLIO bulk formulae
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_utau     = 'taux_1m'   ,       -1          , 'sozotaux',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_vtau     = 'tauy_1m'   ,       -1          , 'sometauy',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_wndm     = 'flx'       ,       -1          , 'socliowi',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_tair     = 'flx'       ,       -1          , 'socliot2',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_humi     = 'flx'       ,       -1          , 'socliohu',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_ccov     = 'flx'       ,       -1          , 'socliocl',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_prec     = 'flx'       ,       -1          , 'socliopl',   .false.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files are
+/
+!-----------------------------------------------------------------------
+&namsbc_core   !   namsbc_core  CORE bulk formulae
+!-----------------------------------------------------------------------
+!              !  file name                    ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !                               !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_wndi     = 'u_10.15JUNE2009_orca2'       ,         6         , 'U_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Uwnd'
+   sn_wndj     = 'v_10.15JUNE2009_orca2'       ,         6         , 'V_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Vwnd'
+   sn_qsr      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'SWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_qlw      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'LWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_tair     = 't_10.15JUNE2009_orca2'       ,         6         , 'T_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_humi     = 'q_10.15JUNE2009_orca2'       ,         6         , 'Q_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_prec     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'PRC_MOD1',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_snow     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'SNOW'    ,   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_tdif     = 'taudif_core'                 ,        24         , 'taudif'  ,   .false.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files
+   ln_2m       = .false.   !  air temperature and humidity referenced at 2m (T) instead 10m (F)
+   ln_taudif   = .false.   !  HF tau contribution: use "mean of stress module - module of the mean stress" data
+   rn_pfac     = 1.        !  multiplicative factor for precipitation (total & snow)
+/
+!-----------------------------------------------------------------------
+&namsbc_mfs   !   namsbc_mfs  MFS bulk formulae
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_wndi     =   'ecmwf'   ,        6          , 'u10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
+   sn_wndj     =   'ecmwf'   ,        6          , 'v10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
+   sn_clc      =   'ecmwf'   ,        6          , 'clc'     ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''
+   sn_msl      =   'ecmwf'   ,        6          , 'msl'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
+   sn_tair     =   'ecmwf'   ,        6          , 't2'      ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
+   sn_rhm      =   'ecmwf'   ,        6          , 'rh'      ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''
+   sn_prec     =   'ecmwf'   ,        6          , 'precip'  ,    .true.    , .true.  , 'daily'  ,'bicubic.nc' , ''
+
+   cn_dir      = './ECMWF/'      !  root directory for the location of the bulk files
+/
+!-----------------------------------------------------------------------
+&namsbc_cpl    !   coupled ocean/atmosphere model                       ("key_coupled")
+!-----------------------------------------------------------------------
+!                    !     description       !  multiple  !    vector   !      vector          ! vector !
+!                    !                       ! categories !  reference  !    orientation       ! grids  !
+! send
+sn_snd_temp   =       'weighted oce and ice' ,    'no'    ,     ''      ,         ''           ,   ''    
+sn_snd_alb    =       'weighted ice'         ,    'no'    ,     ''      ,         ''           ,   ''    
+sn_snd_thick  =       'none'                 ,    'no'   ,     ''      ,         ''           ,   ''    
+sn_snd_crt    =       'none'                 ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'       
+sn_snd_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''           ,   ''        
+! receive
+sn_rcv_w10m   =       'none'                 ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_taumod =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_tau    =       'oce only'             ,    'no'    , 'cartesian' , 'eastward-northward',  'U,V'   
+sn_rcv_dqnsdt =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_qsr    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_qns    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_emp    =       'conservative'         ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_rnf    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_cal    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+/
+!-----------------------------------------------------------------------
+&namtra_qsr    !   penetrative solar radiation
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_chl      ='chlorophyll',        -1         , 'CHLA'    ,   .true.     , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the runoff files
+   ln_traqsr   = .false.   !  Light penetration (T) or not (F)
+   ln_qsr_rgb  = .true.    !  RGB (Red-Green-Blue) light penetration
+   ln_qsr_2bd  = .false.   !  2 bands              light penetration
+   ln_qsr_bio  = .false.   !  bio-model light penetration
+   nn_chldta   =      1    !  RGB : Chl data (=1) or cst value (=0)
+   rn_abs      =   0.58    !  RGB & 2 bands: fraction of light (rn_si1)
+   rn_si0      =   0.35    !  RGB & 2 bands: shortess depth of extinction
+   rn_si1      =   23.0    !  2 bands: longest depth of extinction
+/
+!-----------------------------------------------------------------------
+&namsbc_rnf    !   runoffs namelist surface boundary condition
+!-----------------------------------------------------------------------
+!              !  file name           ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !                      !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_rnf      = 'runoff_core_monthly',        -1         , 'sorunoff',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_cnf      = 'runoff_core_monthly',         0         , 'socoefr0',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_s_rnf    = 'runoffs'            ,        24         , 'rosaline',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_t_rnf    = 'runoffs'            ,        24         , 'rotemper',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_dep_rnf  = 'runoffs'            ,         0         , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir       = './'      !  root directory for the location of the runoff files
+   ln_rnf_emp   = .false.   !  runoffs included into precipitation field (T) or into a file (F)
+   ln_rnf_mouth = .true.    !  specific treatment at rivers mouths
+   rn_hrnf      =  15.e0    !  depth over which enhanced vertical mixing is used
+   rn_avt_rnf   =   1.e-3   !  value of the additional vertical mixing coef. [m2/s]
+   rn_rfact     =   1.e0    !  multiplicative factor for runoff
+   ln_rnf_depth = .false.   !  read in depth information for runoff
+   ln_rnf_tem   = .false.   !  read in temperature information for runoff
+   ln_rnf_sal   = .false.   !  read in salinity information for runoff
+/
+!-----------------------------------------------------------------------
+&namsbc_apr    !   Atmospheric pressure used as ocean forcing or in bulk
+!-----------------------------------------------------------------------
+!              ! file name ! frequency (hours) ! variable ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
+!              !           !  (if <0  months)  !   name   !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
+   sn_apr      = 'patm'    ,         -1        ,'somslpre',    .true.      , .true.  , 'yearly'  ,  ''      ,   ''
+
+   cn_dir      = './'      !  root directory for the location of the bulk files
+   ln_ref_apr  = .false.   !  ref. pressure: global mean Patm (T) or a constant (F)
+/
+!-----------------------------------------------------------------------
+&namsbc_ssr    !   surface boundary condition : sea surface restoring
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_sst      = 'sst_data'  ,        24         ,  'sst'    ,    .false.   , .false., 'yearly'  , ''       , ''
+   sn_sss      = 'sss_data'  ,        -1         ,  'sss'    ,    .true.    , .true. , 'yearly'  , ''       , ''
+
+   cn_dir      = './'      !  root directory for the location of the runoff files
+   nn_sstr     =     0     !  add a retroaction term in the surface heat       flux (=1) or not (=0)
+   nn_sssr     =     2     !  add a damping     term in the surface freshwater flux (=2) 
+                           !  or to SSS only (=1) or no damping term (=0)
+   rn_dqdt     =   -40.    !  magnitude of the retroaction on temperature   [W/m2/K]
+   rn_deds     =  -166.67  !  magnitude of the damping on salinity   [mm/day]
+   ln_sssr_bnd =   .true.  !  flag to bound erp term (associated with nn_sssr=2)
+   rn_sssr_bnd =   4.e0    !  ABS(Max/Min) value of the damping erp term [mm/day]
+/      
+!-----------------------------------------------------------------------
+&namsbc_alb    !   albedo parameters
+!-----------------------------------------------------------------------
+   rn_cloud    =    0.06   !  cloud correction to snow and ice albedo 
+   rn_albice   =    0.53   !  albedo of melting ice in the arctic and antarctic
+   rn_alphd    =    0.80   !  coefficients for linear interpolation used to
+   rn_alphc    =    0.65   !  compute albedo between two extremes values 
+   rn_alphdi   =    0.72   !  (Pyane, 1972)
+/
+
+!!======================================================================
+!!               ***  Lateral boundary condition  ***
+!!======================================================================
+!!   namlbc        lateral momentum boundary condition
+!!   namcla        cross land advection
+!!   namobc        open boundaries parameters                           ("key_obc")
+!!   namagrif      agrif nested grid ( read by child model only )       ("key_agrif") 
+!!   nambdy        Unstructured open boundaries                         ("key_bdy")
+!!   namtide       Tidal forcing at open boundaries                     ("key_bdy_tides")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namlbc        !   lateral momentum boundary condition
+!-----------------------------------------------------------------------
+   rn_shlat    =    2.     !  shlat = 0  !  0 < shlat < 2  !  shlat = 2  !  2 < shlat
+                           !  free slip  !   partial slip  !   no slip   ! strong slip
+   ln_vorlat   = .false.   !  consistency of vorticity boundary condition with analytical eqs.
+/
+!-----------------------------------------------------------------------
+&namcla        !   cross land advection
+!-----------------------------------------------------------------------
+   nn_cla      =    0      !  advection between 2 ocean pts separates by land
+/
+!-----------------------------------------------------------------------
+&namobc        !   open boundaries parameters                           ("key_obc")
+!-----------------------------------------------------------------------
+   ln_obc_clim = .false.   !  climatological obc data files (T) or not (F)
+   ln_vol_cst  = .true.    !  impose the total volume conservation (T) or not (F)
+   ln_obc_fla  = .false.   !  Flather open boundary condition 
+   nn_obcdta   =    1      !  = 0 the obc data are equal to the initial state
+                           !  = 1 the obc data are read in 'obc.dta' files
+   cn_obcdta   = 'annual'  !  set to annual if obc datafile hold 1 year of data
+                           !  set to monthly if obc datafile hold 1 month of data
+   rn_dpein    =    1.     !  damping time scale for inflow at east  open boundary
+   rn_dpwin    =    1.     !     -           -         -       west    -      -
+   rn_dpnin    =    1.     !     -           -         -       north   -      -
+   rn_dpsin    =    1.     !     -           -         -       south   -      -
+   rn_dpeob    = 3000.     !  time relaxation (days) for the east  open boundary
+   rn_dpwob    =   15.     !     -           -         -     west    -      -
+   rn_dpnob    = 3000.     !     -           -         -     north   -      -
+   rn_dpsob    =   15.     !     -           -         -     south   -      -
+   rn_volemp   =    1.     !  = 0 the total volume change with the surface flux (E-P-R)
+                           !  = 1 the total volume remains constant
+/
+!-----------------------------------------------------------------------
+&namagrif      !  AGRIF zoom                                            ("key_agrif")
+!-----------------------------------------------------------------------
+   nn_cln_update =    3    !  baroclinic update frequency
+   ln_spc_dyn    = .true.  !  use 0 as special value for dynamics
+   rn_sponge_tra = 2880.   !  coefficient for tracer   sponge layer [m2/s]
+   rn_sponge_dyn = 2880.   !  coefficient for dynamics sponge layer [m2/s]
+/
+!-----------------------------------------------------------------------
+&nam_tide      !   tide parameters (#ifdef key_tide)
+!-----------------------------------------------------------------------
+   ln_tide_pot   = .true.   !  use tidal potential forcing
+   nb_harmo      =    11    !  number of constituents used
+   clname(1)     =   'M2'   !  name of constituent
+   clname(2)     =   'S2'
+   clname(3)     =   'N2'
+   clname(4)     =   'K1'
+   clname(5)     =   'O1'
+   clname(6)     =   'Q1'
+   clname(7)     =   'M4'
+   clname(8)     =   'K2'
+   clname(9)     =   'P1'
+   clname(10)    =   'Mf'
+   clname(11)    =   'Mm'
+/
+!-----------------------------------------------------------------------
+&nambdy        !  unstructured open boundaries                          ("key_bdy")
+!-----------------------------------------------------------------------
+    nb_bdy = 1                            !  number of open boundary sets       
+    ln_coords_file = .true.               !  =T : read bdy coordinates from file
+    cn_coords_file = 'coordinates.bdy.nc' !  bdy coordinates files
+    ln_mask_file = .false.                !  =T : read mask from file
+    cn_mask_file = ''                     !  name of mask file (if ln_mask_file=.TRUE.)
+    nn_dyn2d      =  2                    !  boundary conditions for barotropic fields
+    nn_dyn2d_dta  =  3                    !  = 0, bdy data are equal to the initial state
+                                          !  = 1, bdy data are read in 'bdydata   .nc' files
+                                          !  = 2, use tidal harmonic forcing data from files
+                                          !  = 3, use external data AND tidal harmonic forcing
+    nn_dyn3d      =  0                    !  boundary conditions for baroclinic velocities
+    nn_dyn3d_dta  =  0                    !  = 0, bdy data are equal to the initial state
+                           !  = 1, bdy data are read in 'bdydata   .nc' files
+    nn_tra        =  1                    !  boundary conditions for T and S
+    nn_tra_dta    =  1                    !  = 0, bdy data are equal to the initial state
+                           !  = 1, bdy data are read in 'bdydata   .nc' files
+    nn_rimwidth  = 10                      !  width of the relaxation zone
+    ln_vol     = .false.                  !  total volume correction (see nn_volctl parameter)
+    nn_volctl  = 1                        !  = 0, the total water flux across open boundaries is zero
+/
+!-----------------------------------------------------------------------
+&nambdy_dta      !  open boundaries - external data           ("key_bdy")
+!-----------------------------------------------------------------------
+!              !   file name    ! frequency (hours) !  variable  ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
+!              !                !  (if <0  months)  !    name    !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
+   bn_ssh =     'amm12_bdyT_u2d' ,         24        , 'sossheig' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_u2d =     'amm12_bdyU_u2d' ,         24        , 'vobtcrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_v2d =     'amm12_bdyV_u2d' ,         24        , 'vobtcrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_u3d  =    'amm12_bdyU_u3d' ,         24        , 'vozocrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_v3d  =    'amm12_bdyV_u3d' ,         24        , 'vomecrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_tem  =    'amm12_bdyT_tra' ,         24        , 'votemper' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   bn_sal  =    'amm12_bdyT_tra' ,         24        , 'vosaline' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+   cn_dir  =    'bdydta/'
+   ln_full_vel = .false.
+/
+!-----------------------------------------------------------------------
+&nambdy_tide     ! tidal forcing at open boundaries              
+!-----------------------------------------------------------------------
+   filtide      = 'bdydta/amm12_bdytide_'         !  file name root of tidal forcing files
+    tide_cpt(1)   ='Q1'  !  names of tidal components used
+    tide_cpt(2)   ='O1'  !  names of tidal components used
+    tide_cpt(3)   ='P1'  !  names of tidal components used
+    tide_cpt(4)   ='S1'  !  names of tidal components used
+    tide_cpt(5)   ='K1'  !  names of tidal components used
+    tide_cpt(6)   ='2N2' !  names of tidal components used
+    tide_cpt(7)   ='MU2' !  names of tidal components used
+    tide_cpt(8)   ='N2'  !  names of tidal components used
+    tide_cpt(9)   ='NU2' !  names of tidal components used
+    tide_cpt(10)   ='M2'  !  names of tidal components used
+    tide_cpt(11)   ='L2'  !  names of tidal components used
+    tide_cpt(12)   ='T2'  !  names of tidal components used
+    tide_cpt(13)   ='S2'  !  names of tidal components used
+    tide_cpt(14)   ='K2'  !  names of tidal components used
+    tide_cpt(15)   ='M4'  !  names of tidal components used
+    tide_speed(1)   = 13.398661 !  phase speeds of tidal components (deg/hour)
+    tide_speed(2)   = 13.943036 !  phase speeds of tidal components (deg/hour)
+    tide_speed(3)   = 14.958932 !  phase speeds of tidal components (deg/hour)
+    tide_speed(4)   = 15.000001 !  phase speeds of tidal components (deg/hour)
+    tide_speed(5)   = 15.041069 !  phase speeds of tidal components (deg/hour)
+    tide_speed(6)   = 27.895355 !  phase speeds of tidal components (deg/hour)
+    tide_speed(7)   = 27.968210 !  phase speeds of tidal components (deg/hour)
+    tide_speed(8)   = 28.439730 !  phase speeds of tidal components (deg/hour)
+    tide_speed(9)   = 28.512585 !  phase speeds of tidal components (deg/hour)
+    tide_speed(10)   = 28.984106 !  phase speeds of tidal components (deg/hour)
+    tide_speed(11)   = 29.528479 !  phase speeds of tidal components (deg/hour)
+    tide_speed(12)   = 29.958935 !  phase speeds of tidal components (deg/hour)
+    tide_speed(13)   = 30.000002 !  phase speeds of tidal components (deg/hour)
+    tide_speed(14)   = 30.082138 !  phase speeds of tidal components (deg/hour)
+    tide_speed(15)   = 57.968212 !  phase speeds of tidal components (deg/hour)
+    ln_tide_date = .true.               !  adjust tidal harmonics for start date of run
+/
+!!======================================================================
+!!                 ***  Bottom boundary condition  ***
+!!======================================================================
+!!   nambfr        bottom friction
+!!   nambbc        bottom temperature boundary condition               
+!!   nambbl        bottom boundary layer scheme                         ("key_trabbl")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&nambfr        !   bottom friction
+!-----------------------------------------------------------------------
+   nn_bfr      =    1      !  type of bottom friction :   = 0 : free slip,  = 1 : linear friction
+                           !                              = 2 : nonlinear friction
+   rn_bfri1    =    4.e-4  !  bottom drag coefficient (linear case)
+   rn_bfri2    =    1.e-3  !  bottom drag coefficient (non linear case)
+   rn_bfeb2    =    2.5e-3 !  bottom turbulent kinetic energy background  (m2/s2)
+   ln_bfr2d    = .false.   !  horizontal variation of the bottom friction coef (read a 2D mask file )
+   rn_bfrien   =    50.    !  local multiplying factor of bfr (ln_bfr2d=T)
+   ln_bfrimp   = .true.    !  implicit bottom friction (requires ln_zdfexp = .false. if true)
+/
+!-----------------------------------------------------------------------
+&nambbc        !   bottom temperature boundary condition
+!-----------------------------------------------------------------------
+   ln_trabbc   = .true.    !  Apply a geothermal heating at the ocean bottom
+   nn_geoflx   =    2      !  geothermal heat flux: = 0 no flux 
+                           !     = 1 constant flux
+                           !     = 2 variable flux (read in geothermal_heating.nc in mW/m2) 
+   rn_geoflx_cst = 86.4e-3 !  Constant value of geothermal heat flux [W/m2]
+/
+!-----------------------------------------------------------------------
+&nambbl        !   bottom boundary layer scheme
+!-----------------------------------------------------------------------
+   nn_bbl_ldf  =  1      !  diffusive bbl (=1)   or not (=0)
+   nn_bbl_adv  =  0      !  advective bbl (=1/2) or not (=0)
+   rn_ahtbbl   =  1000.  !  lateral mixing coefficient in the bbl  [m2/s]
+   rn_gambbl   =  10.    !  advective bbl coefficient                 [s]
+/
+
+!!======================================================================
+!!                        Tracer (T & S ) namelists
+!!======================================================================
+!!   nameos        equation of state
+!!   namtra_adv    advection scheme
+!!   namtra_ldf    lateral diffusion scheme
+!!   namtra_dmp    T & S newtonian damping                        
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&nameos        !   ocean physical parameters
+!-----------------------------------------------------------------------
+   nn_eos      =   0       !  type of equation of state and Brunt-Vaisala frequency
+                           !     = 0, UNESCO (formulation of Jackett and McDougall (1994) and of McDougall (1987) )
+                           !     = 1, linear: rho(T)   = rau0 * ( 1.028 - ralpha * T )
+                           !     = 2, linear: rho(T,S) = rau0 * ( rbeta * S - ralpha * T )
+   rn_alpha    =   2.0e-4  !  thermal expension coefficient (nn_eos= 1 or 2)
+   rn_beta     =   7.7e-4  !  saline  expension coefficient (nn_eos= 2)
+/
+!-----------------------------------------------------------------------
+&namtra_adv    !   advection scheme for tracer 
+!-----------------------------------------------------------------------
+   ln_traadv_cen2   =  .false.  !  2nd order centered scheme   
+   ln_traadv_tvd    =  .true.   !  TVD scheme                
+   ln_traadv_muscl  =  .false.  !  MUSCL scheme             
+   ln_traadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries  
+   ln_traadv_ubs    =  .false.  !  UBS scheme                 
+   ln_traadv_qck    =  .false.  !  QUICKEST scheme                 
+/
+!----------------------------------------------------------------------------------
+&namtra_ldf    !   lateral diffusion scheme for tracers
+!----------------------------------------------------------------------------------
+   !                       !  Operator type:
+   ln_traldf_lap    =  .true.   !  laplacian operator
+   ln_traldf_bilap  =  .false.  !  bilaplacian operator
+   !                       !  Direction of action:
+   ln_traldf_level  =  .false.  !  iso-level
+   ln_traldf_hor    =  .false.  !  horizontal (geopotential)   (needs "key_ldfslp" when ln_sco=T)
+   ln_traldf_iso    =  .true.   !  iso-neutral                 (needs "key_ldfslp")
+   !		       	   !  Griffies parameters              (all need "key_ldfslp")
+   ln_traldf_grif   =  .false.  !  use griffies triads
+   ln_traldf_gdia   =  .false.  !  output griffies eddy velocities
+   ln_triad_iso     =  .false.  !  pure lateral mixing in ML
+   ln_botmix_grif   =  .false.  !  lateral mixing on bottom
+   !                       !  Coefficients
+   ! Eddy-induced (GM) advection always used with Griffies; otherwise needs "key_traldf_eiv"
+   ! Value rn_aeiv_0 is ignored unless = 0 with Held-Larichev spatially varying aeiv
+   !                                  (key_traldf_c2d & key_traldf_eiv & key_orca_r2, _r1 or _r05)
+   rn_aeiv_0        =  2000.    !  eddy induced velocity coefficient [m2/s]
+   rn_aht_0         =  2000.    !  horizontal eddy diffusivity for tracers [m2/s]
+   rn_ahtb_0        =     0.    !  background eddy diffusivity for ldf_iso [m2/s]
+   !                                           (normally=0; not used with Griffies)
+/
+!-----------------------------------------------------------------------
+&namtra_dmp    !   tracer: T & S newtonian damping                  
+!-----------------------------------------------------------------------
+   ln_tradmp   =  .true.   !  add a damping termn (T) or not (F)
+   nn_hdmp     =   -1      !  horizontal shape =-1, damping in Med and Red Seas only
+                           !                   =XX, damping poleward of XX degrees (XX>0)
+                           !                      + F(distance-to-coast) + Red and Med Seas
+   nn_zdmp     =    0      !  vertical   shape =0    damping throughout the water column
+                           !                   =1 no damping in the mixing layer (kz  criteria)
+                           !                   =2 no damping in the mixed  layer (rho crieria)
+   rn_surf     =   50.     !  surface time scale of damping   [days]
+   rn_bot      =  360.     !  bottom  time scale of damping   [days]
+   rn_dep      =  800.     !  depth of transition between rn_surf and rn_bot [meters]
+   nn_file     =    0      !  create a damping.coeff NetCDF file (=1) or not (=0)
+/
+
+!!======================================================================
+!!                      ***  Dynamics namelists  ***
+!!======================================================================
+!!   namdyn_adv    formulation of the momentum advection
+!!   namdyn_vor    advection scheme
+!!   namdyn_hpg    hydrostatic pressure gradient
+!!   namdyn_spg    surface pressure gradient                            (CPP key only)
+!!   namdyn_ldf    lateral diffusion scheme
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namdyn_adv    !   formulation of the momentum advection
+!-----------------------------------------------------------------------
+   ln_dynadv_vec = .true.  !  vector form (T) or flux form (F)  
+   ln_dynadv_cen2= .false. !  flux form - 2nd order centered scheme
+   ln_dynadv_ubs = .false. !  flux form - 3rd order UBS      scheme 
+/  
+!-----------------------------------------------------------------------
+&namdyn_vor    !   option of physics/algorithm (not control by CPP keys)
+!-----------------------------------------------------------------------
+   ln_dynvor_ene = .false. !  enstrophy conserving scheme  
+   ln_dynvor_ens = .false. !  energy conserving scheme    
+   ln_dynvor_mix = .false. !  mixed scheme               
+   ln_dynvor_een = .true.  !  energy & enstrophy scheme  
+/
+!-----------------------------------------------------------------------
+&namdyn_hpg    !   Hydrostatic pressure gradient option
+!-----------------------------------------------------------------------
+   ln_hpg_zco  = .false.   !  z-coordinate - full steps                   
+   ln_hpg_zps  = .true.    !  z-coordinate - partial steps (interpolation)
+   ln_hpg_sco  = .false.   !  s-coordinate (standard jacobian formulation)
+   ln_hpg_djc  = .false.   !  s-coordinate (Density Jacobian with Cubic polynomial)
+   ln_hpg_prj  = .false.   !  s-coordinate (Pressure Jacobian scheme)
+   ln_dynhpg_imp = .false. !  time stepping: semi-implicit time scheme  (T)
+                                 !           centered      time scheme  (F)
+/
+!-----------------------------------------------------------------------
+!namdyn_spg    !   surface pressure gradient   (CPP key only)
+!-----------------------------------------------------------------------
+!                          !  explicit free surface                     ("key_dynspg_exp")
+!                          !  filtered free surface                     ("key_dynspg_flt")
+!                          !  split-explicit free surface               ("key_dynspg_ts")
+
+!-----------------------------------------------------------------------
+&namdyn_ldf    !   lateral diffusion on momentum
+!-----------------------------------------------------------------------
+   !                       !  Type of the operator : 
+   ln_dynldf_lap    =  .true.   !  laplacian operator         
+   ln_dynldf_bilap  =  .false.  !  bilaplacian operator    
+   !                       !  Direction of action  : 
+   ln_dynldf_level  =  .false.  !  iso-level               
+   ln_dynldf_hor    =  .true.   !  horizontal (geopotential)            (require "key_ldfslp" in s-coord.)
+   ln_dynldf_iso    =  .false.  !  iso-neutral                          (require "key_ldfslp")
+   !                       !  Coefficient
+   rn_ahm_0_lap     = 40000.    !  horizontal laplacian eddy viscosity   [m2/s]
+   rn_ahmb_0        =     0.    !  background eddy viscosity for ldf_iso [m2/s]
+   rn_ahm_0_blp     =     0.    !  horizontal bilaplacian eddy viscosity [m4/s] 
+/
+!-----------------------------------------------------------------------
+&namdta_dyn        !   offline dynamics read in files                ("key_offline")
+!-----------------------------------------------------------------------
+!            !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!            !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_tem  = 'ORCA2_1d_grid_T' ,    24            , 'votemper' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_sal  = 'ORCA2_1d_grid_T' ,    24            , 'vosaline' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_mld  = 'ORCA2_1d_grid_T' ,    24            , 'somixhgt' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_emp  = 'ORCA2_1d_grid_T' ,    24            , 'sowaflcd' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_ice  = 'ORCA2_1d_grid_T' ,    24            , 'soicecov' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_qsr  = 'ORCA2_1d_grid_T' ,    24            , 'soshfldo' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_wnd  = 'ORCA2_1d_grid_T' ,    24            , 'sowindsp' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_uwd  = 'ORCA2_1d_grid_U' ,    24            , 'vozocrtx' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_vwd  = 'ORCA2_1d_grid_V' ,    24            , 'vomecrty' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_wwd  = 'ORCA2_1d_grid_W' ,    24            , 'vovecrtz' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_avt  = 'ORCA2_1d_grid_W' ,    24            , 'votkeavt' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_ubl  = 'ORCA2_1d_grid_U' ,    24            , 'sobblcox' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_vbl  = 'ORCA2_1d_grid_V' ,    24            , 'sobblcoy' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_eiu  = 'ORCA2_1d_grid_U' ,    24            , 'vozoeivu' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_eiv  = 'ORCA2_1d_grid_V' ,    24            , 'vomeeivv' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+   sn_eiw  = 'ORCA2_1d_grid_W' ,    24            , 'voveeivw' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+!
+   cn_dir      = './'      !  root directory for the location of the dynamical files
+   ln_degrad   =  .false.  !  flag for degradation -                requires ("key_degrad")
+   ln_dynwzv   =  .true.   !  computation of vertical velocity instead of using the one read in file
+   ln_dynbbl   =  .true.   !  bbl coef are in files, so read them - requires ("key_trabbl")
+/
+!!======================================================================
+!!             Tracers & Dynamics vertical physics namelists
+!!======================================================================
+!!    namzdf        vertical physics
+!!    namzdf_ric    richardson number dependent vertical mixing         ("key_zdfric")
+!!    namzdf_tke    TKE dependent vertical mixing                       ("key_zdftke")
+!!    namzdf_kpp    KPP dependent vertical mixing                       ("key_zdfkpp")
+!!    namzdf_ddm    double diffusive mixing parameterization            ("key_zdfddm")
+!!    namzdf_tmx    tidal mixing parameterization                       ("key_zdftmx")
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namzdf        !   vertical physics
+!-----------------------------------------------------------------------
+   rn_avm0     =   1.2e-4  !  vertical eddy viscosity   [m2/s]          (background Kz if not "key_zdfcst")
+   rn_avt0     =   1.2e-5  !  vertical eddy diffusivity [m2/s]          (background Kz if not "key_zdfcst")
+   nn_avb      =    0      !  profile for background avt & avm (=1) or not (=0)
+   nn_havtb    =    0      !  horizontal shape for avtb (=1) or not (=0)
+   ln_zdfevd   = .true.    !  enhanced vertical diffusion (evd) (T) or not (F)
+   nn_evdm     =    0      !  evd apply on tracer (=0) or on tracer and momentum (=1)
+   rn_avevd    =  100.     !  evd mixing coefficient [m2/s]
+   ln_zdfnpc   = .false.   !  Non-Penetrative Convective algorithm (T) or not (F)
+   nn_npc      =    1            !  frequency of application of npc
+   nn_npcp     =  365            !  npc control print frequency
+   ln_zdfexp   = .false.   !  time-stepping: split-explicit (T) or implicit (F) time stepping
+   nn_zdfexp   =    3            !  number of sub-timestep for ln_zdfexp=T
+/
+!-----------------------------------------------------------------------
+&namzdf_ric    !   richardson number dependent vertical diffusion       ("key_zdfric" )
+!-----------------------------------------------------------------------
+   rn_avmri    = 100.e-4   !  maximum value of the vertical viscosity
+   rn_alp      =   5.      !  coefficient of the parameterization
+   nn_ric      =   2       !  coefficient of the parameterization
+   rn_ekmfc    =   0.7     !  Factor in the Ekman depth Equation
+   rn_mldmin   =   1.0     !  minimum allowable mixed-layer depth estimate (m)
+   rn_mldmax   =1000.0     !  maximum allowable mixed-layer depth estimate (m)
+   rn_wtmix    =  10.0     !  vertical eddy viscosity coeff [m2/s] in the mixed-layer
+   rn_wvmix    =  10.0     !  vertical eddy diffusion coeff [m2/s] in the mixed-layer
+   ln_mldw     = .true.    !  Flag to use or not the mized layer depth param.
+/
+!-----------------------------------------------------------------------
+&namzdf_tke    !   turbulent eddy kinetic dependent vertical diffusion  ("key_zdftke")
+!-----------------------------------------------------------------------
+   rn_ediff    =   0.1     !  coef. for vertical eddy coef. (avt=rn_ediff*mxl*sqrt(e) )
+   rn_ediss    =   0.7     !  coef. of the Kolmogoroff dissipation
+   rn_ebb      =  67.83    !  coef. of the surface input of tke (=67.83 suggested when ln_mxl0=T)
+   rn_emin     =   1.e-6   !  minimum value of tke [m2/s2]
+   rn_emin0    =   1.e-4   !  surface minimum value of tke [m2/s2]
+   nn_mxl      =   2       !  mixing length: = 0 bounded by the distance to surface and bottom
+                           !                 = 1 bounded by the local vertical scale factor
+                           !                 = 2 first vertical derivative of mixing length bounded by 1
+                           !                 = 3 as =2 with distinct disspipative an mixing length scale
+   nn_pdl      =   1       !  Prandtl number function of richarson number (=1, avt=pdl(Ri)*avm) or not (=0, avt=avm)
+   ln_mxl0     = .true.    !  surface mixing length scale = F(wind stress) (T) or not (F)
+   rn_mxl0     =   0.04    !  surface  buoyancy lenght scale minimum value
+   ln_lc       = .true.    !  Langmuir cell parameterisation (Axell 2002)
+   rn_lc       =   0.15    !  coef. associated to Langmuir cells
+   nn_etau     =   1       !  penetration of tke below the mixed layer (ML) due to internal & intertial waves
+                           !        = 0 no penetration
+                           !        = 1 add a tke source below the ML
+                           !        = 2 add a tke source just at the base of the ML
+                           !        = 3 as = 1 applied on HF part of the stress    ("key_coupled")
+   rn_efr      =   0.05    !  fraction of surface tke value which penetrates below the ML (nn_etau=1 or 2)
+   nn_htau     =   1       !  type of exponential decrease of tke penetration below the ML
+                           !        = 0  constant 10 m length scale
+                           !        = 1  0.5m at the equator to 30m poleward of 40 degrees
+/
+!------------------------------------------------------------------------
+&namzdf_kpp    !   K-Profile Parameterization dependent vertical mixing  ("key_zdfkpp", and optionally:
+!------------------------------------------------------------------------ "key_kppcustom" or "key_kpplktb")
+   ln_kpprimix = .true.    !  shear instability mixing 
+   rn_difmiw   =  1.0e-04  !  constant internal wave viscosity [m2/s]
+   rn_difsiw   =  0.1e-04  !  constant internal wave diffusivity [m2/s]
+   rn_riinfty  =  0.8      !  local Richardson Number limit for shear instability
+   rn_difri    =  0.0050   !  maximum shear mixing at Rig = 0    [m2/s]
+   rn_bvsqcon  = -0.01e-07 !  Brunt-Vaisala squared for maximum convection [1/s2] 
+   rn_difcon   =  1.       !  maximum mixing in interior convection [m2/s] 
+   nn_avb      =  0        !  horizontal averaged (=1) or not (=0) on avt and amv
+   nn_ave      =  1        !  constant (=0) or profile (=1) background on avt
+/
+!-----------------------------------------------------------------------
+&namzdf_gls                !   GLS vertical diffusion                   ("key_zdfgls")
+!-----------------------------------------------------------------------
+   rn_emin       = 1.e-6   !  minimum value of e   [m2/s2]
+   rn_epsmin     = 1.e-12  !  minimum value of eps [m2/s3]
+   ln_length_lim = .true.  !  limit on the dissipation rate under stable stratification (Galperin et al., 1988)
+   rn_clim_galp  = 0.53    !  galperin limit
+   ln_crban      = .true.  !  Use Craig & Banner (1994) surface wave mixing parametrisation
+   ln_sigpsi     = .true.  !  Activate or not Burchard 2001 mods on psi schmidt number in the wb case
+   rn_crban      = 100.    !  Craig and Banner 1994 constant for wb tke flux
+   rn_charn      = 70000.  !  Charnock constant for wb induced roughness length
+   nn_tkebc_surf =   1     !  surface tke condition (0/1/2=Dir/Neum/Dir Mellor-Blumberg)
+   nn_tkebc_bot  =   1     !  bottom tke condition (0/1=Dir/Neum)
+   nn_psibc_surf =   1     !  surface psi condition (0/1/2=Dir/Neum/Dir Mellor-Blumberg)
+   nn_psibc_bot  =   1     !  bottom psi condition (0/1=Dir/Neum)
+   nn_stab_func  =   2     !  stability function (0=Galp, 1= KC94, 2=CanutoA, 3=CanutoB)
+   nn_clos       =   1     !  predefined closure type (0=MY82, 1=k-eps, 2=k-w, 3=Gen)
+/
+!-----------------------------------------------------------------------
+&namzdf_ddm    !   double diffusive mixing parameterization             ("key_zdfddm")
+!-----------------------------------------------------------------------
+   rn_avts     = 1.e-4     !  maximum avs (vertical mixing on salinity)
+   rn_hsbfr    = 1.6       !  heat/salt buoyancy flux ratio
+/
+!-----------------------------------------------------------------------
+&namzdf_tmx    !   tidal mixing parameterization                        ("key_zdftmx")
+!-----------------------------------------------------------------------
+   rn_htmx     = 500.      !  vertical decay scale for turbulence (meters)
+   rn_n2min    = 1.e-8     !  threshold of the Brunt-Vaisala frequency (s-1)
+   rn_tfe      = 0.333     !  tidal dissipation efficiency
+   rn_me       = 0.2       !  mixing efficiency 
+   ln_tmx_itf  = .true.    !  ITF specific parameterisation
+   rn_tfe_itf  = 1.        !  ITF tidal dissipation efficiency
+/
+
+!!======================================================================
+!!                  ***  Miscellaneous namelists  ***
+!!======================================================================
+!!   nammpp            Massively Parallel Processing                    ("key_mpp_mpi)
+!!   namctl            Control prints & Benchmark
+!!   namsol            elliptic solver / island / free surface 
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namsol        !   elliptic solver / island / free surface 
+!-----------------------------------------------------------------------
+   nn_solv     =      1    !  elliptic solver: =1 preconditioned conjugate gradient (pcg)
+                           !                   =2 successive-over-relaxation (sor)
+   nn_sol_arp  =      0    !  absolute/relative (0/1) precision convergence test
+   rn_eps      =  1.e-6    !  absolute precision of the solver
+   nn_nmin     =    300    !  minimum of iterations for the SOR solver
+   nn_nmax     =    800    !  maximum of iterations for the SOR solver
+   nn_nmod     =     10    !  frequency of test for the SOR solver
+   rn_resmax   =  1.e-10   !  absolute precision for the SOR solver
+   rn_sor      =  1.92     !  optimal coefficient for SOR solver (to be adjusted with the domain)
+/
+!-----------------------------------------------------------------------
+&nammpp        !   Massively Parallel Processing                        ("key_mpp_mpi)
+!-----------------------------------------------------------------------
+   cn_mpi_send =  'I'      !  mpi send/recieve type   ='S', 'B', or 'I' for standard send,
+                           !  buffer blocking send or immediate non-blocking sends, resp.
+   nn_buffer   =   0       !  size in bytes of exported buffer ('B' case), 0 no exportation
+   ln_nnogather=  .false.  !  activate code to avoid mpi_allgather use at the northfold
+   jpni        =   0       !  jpni   number of processors following i (set automatically if < 1)
+   jpnj        =   0       !  jpnj   number of processors following j (set automatically if < 1)
+   jpnij       =   0       !  jpnij  number of local domains (set automatically if < 1)
+/
+!-----------------------------------------------------------------------
+&namctl        !   Control prints & Benchmark
+!-----------------------------------------------------------------------
+   ln_ctl      = .false.   !  trends control print (expensive!)
+   nn_print    =    0      !  level of print (0 no extra print)
+   nn_ictls    =    0      !  start i indice of control sum (use to compare mono versus
+   nn_ictle    =    0      !  end   i indice of control sum        multi processor runs
+   nn_jctls    =    0      !  start j indice of control               over a subdomain)
+   nn_jctle    =    0      !  end   j indice of control
+   nn_isplt    =    1      !  number of processors in i-direction
+   nn_jsplt    =    1      !  number of processors in j-direction
+   nn_bench    =    0      !  Bench mode (1/0): CAUTION use zero except for bench
+                           !     (no physical validity of the results)
+   nn_timing   =    1      !  timing by routine activated (=1) creates timing.output file, or not (=0)
+/
+
+!!======================================================================
+!!                  ***  Diagnostics namelists  ***
+!!======================================================================
+!!   namnc4       netcdf4 chunking and compression settings             ("key_netcdf4")
+!!   namtrd       dynamics and/or tracer trends                         ("key_trddyn","key_trdtra","key_trdmld")
+!!   namflo       float parameters                                      ("key_float")
+!!   namptr       Poleward Transport Diagnostics
+!!   namhsb       Heat and salt budgets 
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namnc4        !   netcdf4 chunking and compression settings            ("key_netcdf4")
+!-----------------------------------------------------------------------
+   nn_nchunks_i=   4       !  number of chunks in i-dimension
+   nn_nchunks_j=   4       !  number of chunks in j-dimension
+   nn_nchunks_k=   31      !  number of chunks in k-dimension
+                           !  setting nn_nchunks_k = jpk will give a chunk size of 1 in the vertical which
+                           !  is optimal for postprocessing which works exclusively with horizontal slabs
+   ln_nc4zip   = .true.    !  (T) use netcdf4 chunking and compression
+                           !  (F) ignore chunking information and produce netcdf3-compatible files
+/
+!-----------------------------------------------------------------------
+&namtrd        !   diagnostics on dynamics and/or tracer trends         ("key_trddyn" and/or "key_trdtra")
+!              !       or mixed-layer trends or barotropic vorticity    ("key_trdmld" or     "key_trdvor")
+!-----------------------------------------------------------------------
+   nn_trd      = 365       !  time step frequency dynamics and tracers trends
+   nn_ctls     =   0       !  control surface type in mixed-layer trends (0,1 or n<jpk)
+   rn_ucf      =   1.      !  unit conversion factor (=1 -> /seconds ; =86400. -> /day)
+   cn_trdrst_in      = "restart_mld"   ! suffix of ocean restart name (input)
+   cn_trdrst_out     = "restart_mld"   ! suffix of ocean restart name (output)
+   ln_trdmld_restart = .false.         !  restart for ML diagnostics
+   ln_trdmld_instant = .false.         !  flag to diagnose trends of instantantaneous or mean ML T/S
+/
+!-----------------------------------------------------------------------
+&namflo       !   float parameters                                      ("key_float")
+!-----------------------------------------------------------------------
+   jpnfl         = 1          !  total number of floats during the run
+   jpnnewflo     = 0          !  number of floats for the restart
+   ln_rstflo     = .false.    !  float restart (T) or not (F)
+   nn_writefl    =      75    !  frequency of writing in float output file 
+   nn_stockfl    =    5475    !  frequency of creation of the float restart file 
+   ln_argo       = .false.    !  Argo type floats (stay at the surface each 10 days)
+   ln_flork4     = .false.    !  trajectories computed with a 4th order Runge-Kutta (T)
+                              !  or computed with Blanke' scheme (F)
+   ln_ariane     = .true.     !  Input with Ariane tool convention(T)
+   ln_flo_ascii  = .true.     !  Output with Ariane tool netcdf convention(F) or ascii file (T)
+/
+!-----------------------------------------------------------------------
+&namptr       !   Poleward Transport Diagnostic
+!-----------------------------------------------------------------------
+   ln_diaptr  = .false.    !  Poleward heat and salt transport (T) or not (F)
+   ln_diaznl  = .true.     !  Add zonal means and meridional stream functions
+   ln_subbas  = .true.     !  Atlantic/Pacific/Indian basins computation (T) or not 
+                           !  (orca configuration only, need input basins mask file named "subbasins.nc"
+   ln_ptrcomp = .true.     !  Add decomposition : overturning
+   nn_fptr    =  1         !  Frequency of ptr computation [time step]
+   nn_fwri    =  15        !  Frequency of ptr outputs [time step]
+/
+!-----------------------------------------------------------------------
+&namhsb       !  Heat and salt budgets 
+!-----------------------------------------------------------------------
+   ln_diahsb  = .false.    !  check the heat and salt budgets (T) or not (F)
+/
+!-----------------------------------------------------------------------
+&nam_diaharm   !   Harmonic analysis of tidal constituents ('key_diaharm')
+!-----------------------------------------------------------------------
+    nit000_han = 1         ! First time step used for harmonic analysis
+    nitend_han = 75        ! Last time step used for harmonic analysis
+    nstep_han  = 15        ! Time step frequency for harmonic analysis
+    tname(1)   = 'M2'      ! Name of tidal constituents
+    tname(2)   = 'K1'
+/
+!-----------------------------------------------------------------------
+&namdct        ! transports through sections
+!-----------------------------------------------------------------------
+    nn_dct      = 15       !  time step frequency for transports computing
+    nn_dctwri   = 15       !  time step frequency for transports writing
+    nn_secdebug = 112      !      0 : no section to debug
+                           !     -1 : debug all section
+                           !  0 < n : debug section number n
+/
+
+!!======================================================================
+!!            ***  Observation & Assimilation namelists ***
+!!======================================================================
+!!   namobs       observation and model comparison                      ('key_diaobs')
+!!   nam_asminc   assimilation increments                               ('key_asminc')
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namobs       !  observation usage switch                               ('key_diaobs')
+!-----------------------------------------------------------------------
+   ln_t3d     = .false.    ! Logical switch for T profile observations         
+   ln_s3d     = .false.    ! Logical switch for S profile observations          
+   ln_ena     = .false.    ! Logical switch for ENACT insitu data set           
+   !                       !     ln_cor                  Logical switch for Coriolis insitu data set       
+   ln_profb   = .false.    ! Logical switch for feedback insitu data set     
+   ln_sla     = .false.    ! Logical switch for SLA observations               
+
+   ln_sladt   = .false.    ! Logical switch for AVISO SLA data              
+
+   ln_slafb   = .false.    ! Logical switch for feedback SLA data            
+                           !     ln_ssh                  Logical switch for SSH observations              
+
+   ln_sst     = .false.    ! Logical switch for SST observations              
+                           !     ln_reysst               Logical switch for Reynolds observations       
+                           !     ln_ghrsst               Logical switch for GHRSST observations          
+
+   ln_sstfb   = .false.    ! Logical switch for feedback SST data          
+                           !     ln_sss                  Logical switch for SSS observations              
+                           !     ln_seaice               Logical switch for Sea Ice observations        
+                           !     ln_vel3d                Logical switch for velocity observations         
+                           !     ln_velavcur             Logical switch for velocity daily av. cur.    
+                           !     ln_velhrcur             Logical switch for velocity high freq. cur.   
+                           !     ln_velavadcp            Logical switch for velocity daily av. ADCP  
+                           !     ln_velhradcp            Logical switch for velocity high freq. ADCP
+                           !     ln_velfb                Logical switch for feedback velocity data       
+                           !     ln_grid_global          Global distribtion of observations         
+                           !     ln_grid_search_lookup   Logical switch for obs grid search w/lookup table  
+                           !     grid_search_file        Grid search lookup file header 
+                           !     enactfiles              ENACT input observation file names 
+                           !     coriofiles              Coriolis input observation file name  
+   !                       ! profbfiles: Profile feedback input observation file name 
+   profbfiles = 'profiles_01.nc'
+                           !     ln_profb_enatim         Enact feedback input time setting switch    
+                           !     slafilesact             Active SLA input observation file name
+                           !     slafilespas             Passive SLA input observation file name 
+   !                       ! slafbfiles: Feedback SLA input observation file name 
+   slafbfiles = 'sla_01.nc'
+                           !     sstfiles                GHRSST input observation file name       
+   !                       ! sstfbfiles: Feedback SST input observation file name 
+   sstfbfiles = 'sst_01.nc' 'sst_02.nc' 'sst_03.nc' 'sst_04.nc' 'sst_05.nc'
+                           !     seaicefiles             Sea Ice input observation file name 
+                           !     velavcurfiles           Vel. cur. daily av. input file name  
+                           !     velhvcurfiles           Vel. cur. high freq. input file name  
+                           !     velavadcpfiles          Vel. ADCP daily av. input file name    
+                           !     velhvadcpfiles          Vel. ADCP high freq. input file name 
+                           !     velfbfiles              Vel. feedback input observation file name 
+                           !     dobsini                 Initial date in window YYYYMMDD.HHMMSS       
+                           !     dobsend                 Final date in window YYYYMMDD.HHMMSS         
+                           !     n1dint                  Type of vertical interpolation method        
+                           !     n2dint                  Type of horizontal interpolation method       
+                           !     ln_nea                  Rejection of observations near land switch    
+   nmsshc     = 0          ! MSSH correction scheme                         
+                           !     mdtcorr                 MDT  correction                               
+                           !     mdtcutoff               MDT cutoff for computed correction          
+   ln_altbias = .false.    ! Logical switch for alt bias                
+   ln_ignmis  = .true.     ! Logical switch for ignoring missing files   
+                           !     endailyavtypes   ENACT daily average types                    
+   ln_grid_global = .true.
+   ln_grid_search_lookup = .false.
+/ 
+!-----------------------------------------------------------------------
+&nam_asminc   !   assimilation increments                               ('key_asminc')
+!-----------------------------------------------------------------------
+    ln_bkgwri = .false.    !  Logical switch for writing out background state 
+    ln_trjwri = .false.    !  Logical switch for writing out state trajectory
+    ln_trainc = .false.    !  Logical switch for applying tracer increments
+    ln_dyninc = .false.    !  Logical switch for applying velocity increments
+    ln_sshinc = .false.    !  Logical switch for applying SSH increments 
+    ln_asmdin = .false.    !  Logical switch for Direct Initialization (DI)
+    ln_asmiau = .false.    !  Logical switch for Incremental Analysis Updating (IAU)
+    nitbkg    = 0          !  Timestep of background in [0,nitend-nit000-1]
+    nitdin    = 0          !  Timestep of background for DI in [0,nitend-nit000-1]
+    nitiaustr = 1          !  Timestep of start of IAU interval in [0,nitend-nit000-1]
+    nitiaufin = 15         !  Timestep of end of IAU interval in [0,nitend-nit000-1]
+    niaufn    = 0          !  Type of IAU weighting function
+    nittrjfrq = 0          !  Frequency of trajectory output for 4D-VAR
+    ln_salfix = .false.    !  Logical switch for ensuring that the sa > salfixmin
+    salfixmin = -9999      !  Minimum salinity after applying the increments
+    nn_divdmp = 0          !  Number of iterations of divergence damping operator
+/
+!-----------------------------------------------------------------------
+&namsbc_wave   ! External fields from wave model
+!-----------------------------------------------------------------------
+!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_cdg      =  'cdg_wave' ,        1          , 'drag_coeff' , .true.   , .false. , 'daily'  ,''         , ''
+!
+   cn_dir_cdg  = './'  !  root directory for the location of drag coefficient files
+/
+!-----------------------------------------------------------------------
+&namdyn_nept  !   Neptune effect (simplified: lateral and vertical diffusions removed)
+!-----------------------------------------------------------------------
+   ! Suggested lengthscale values are those of Eby & Holloway (1994) for a coarse model
+   ln_neptsimp       = .false.  ! yes/no use simplified neptune
+
+   ln_smooth_neptvel = .false.  ! yes/no smooth zunep, zvnep
+   rn_tslse          =  1.2e4   ! value of lengthscale L at the equator
+   rn_tslsp          =  3.0e3   ! value of lengthscale L at the pole
+   ! Specify whether to ramp down the Neptune velocity in shallow
+   ! water, and if so the depth range controlling such ramping down
+   ln_neptramp       = .false.   ! ramp down Neptune velocity in shallow water
+   rn_htrmin         =  100.0   ! min. depth of transition range
+   rn_htrmax         =  200.0   ! max. depth of transition range
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/namelist_top
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/namelist_top	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/namelist_top	(revision 3680)
@@ -0,0 +1,143 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/TOP1 :  1 - tracer definition                     (namtrc    )
+!!              2 - tracer data initialisation            (namtrc_dta)
+!!              3 - tracer advection                      (namtrc_adv)
+!!              4 - tracer lateral diffusion              (namtrc_ldf)
+!!              5 - tracer vertical physics               (namtrc_zdf)
+!!              6 - tracer newtonian damping              (namtrc_dmp)
+!!              7 - dynamical tracer trends               (namtrc_trd)
+!!              8 - tracer output diagonstics             (namtrc_dia)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namtrc     !   tracers definition
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   nn_dttrc      =  1        !  time step frequency for passive sn_tracers      
+   ln_top_euler  = .true.    !  Euler timestepping
+!
+!                !    name   ! title of the field   ! initial data ! initial data ! save   !
+!                !           !                                           !  units       ! from file    ! or not ! 
+!                !           !                                           !              ! or not       !        !
+   sn_tracer(1)   = 'DUMMY'  , 'Dummy tracer'                      ,       'dummy units',  .false.     ,  .true.
+/
+!-----------------------------------------------------------------------
+&namtrc_dta      !    Initialisation from data input file
+!-----------------------------------------------------------------------
+!
+!                !  file name               ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!                !                          !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_trcdta(1)  = 'data_1m_O2_nomask'      ,        -1         ,  'O2'      ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(2)  = 'data_1m_PO4_nomask'     ,        -1         ,  'PO4'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(3)  = 'data_1m_NO3_nomask'     ,        -1         ,  'NO3'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(6)  = 'data_1m_Si_nomask'      ,        -1         ,  'Si'      ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(8)  = 'data_1m_Fer_nomask'     ,        -12        ,  'Fer'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(45) = 'data_1m_DOC_nomask'     ,        -12        ,  'DOC'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(56) = 'data_1m_DIC_nomask'     ,        -12        ,  'DIC'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(57) = 'data_1m_Alkalini_nomask',        -12        ,  'Alkalini',    .false.   , .true. , 'yearly'  , ''       , ''
+!
+   cn_dir        =  './'      !  root directory for the location of the data files
+   rn_trfac(1)   =   22.4  !  conversion factor from ml/l to mmol m3 (1 mol O2 = 22.4 l) 
+   rn_trfac(2)   =   1.0   !  -      -      -     -
+   rn_trfac(3)   =   1.0   !  -      -      -     -
+   rn_trfac(6)   =   1.0   !  -      -      -     -
+   rn_trfac(8)   =   1.e9  !  conversion factor from mol/l to umol/m3
+   rn_trfac(45)  =  12.e6  !  conversion factor from mol/l to mg/m3
+   rn_trfac(56)  =  12.0   !  conversion factor from umol/l to mg/m3
+   rn_trfac(57)  =   1.0   !  -      -      -     -
+/
+!-----------------------------------------------------------------------
+&namtrc_bc
+!-----------------------------------------------------------------------
+!              ! file name                ! frequency (hr) ! variable ! time interp. ! clim    !'yearly' or ! weights  ! rotation
+!              !                          !  (if <0 mon)   !   name   !  (logical)   ! (T/F)   ! 'monthly'  ! filename ! pairing
+   sn_trcsbc(3)  = 'ndeposition.orca'     ,        -1      ,  'ndep'      ,  .false.  , .true.  , 'yearly'   , ''       , ''
+   sn_trcsbc(8)  = 'dust.orca'            ,        -1      ,  'dust'      ,  .false.  , .true.  , 'yearly'   , ''       , ''
+
+   rn_trsfac(3)  = 1.0
+   rn_trsfac(8)  = 5.8866e+05             ! conversion factor from kg Fe/m2/mon to umol/m2/d = 1.e9/(55.85)*12/365
+   !
+   sn_trccbc(2)  = 'river'                 ,       -12      ,  'RIVERPHOS'  ,  .false.  , .true.  , 'yearly'   , ''       , ''
+   sn_trccbc(3)  = 'river'                 ,       -12      ,  'RIVERNIT'   ,  .false.  , .true.  , 'yearly'   , ''       , ''
+   sn_trccbc(6)  = 'river'                 ,       -12      ,  'RIVERSIL'   ,  .false.  , .true.  , 'yearly'   , ''       , ''
+   sn_trccbc(8)  = 'river'                 ,       -12      ,  'RIVERFe80'  ,  .false.  , .true.  , 'yearly'   , ''       , ''
+   sn_trccbc(45) = 'river'                 ,       -12      ,  'RIVERDOC'   ,  .false.  , .true.  , 'yearly'   , ''       , ''
+   sn_trccbc(56) = 'river'                 ,       -12      ,  'RIVERDIC'   ,  .false.  , .true.  , 'yearly'   , ''       , ''
+   rn_trcfac(2)  =  8.8464e+10     ! 1 mol P = 30.97 g; 1.e12*1.e3/30.97/365 conversion factor from Tg/y to mmol/d
+   rn_trcfac(3)  =  1.9556e+11     ! 1 mol N = 14.01 g; 1.e12*1.e3/14.01/365 conversion factor from Tg/y to mmol/d
+   rn_trcfac(6)  =  9.7534e+10     ! 1 mol Si = 28.09 g; 1.e12*1.e3/28.09/365 conversion factor from Tg/y to mmol/d
+   rn_trcfac(8)  =  4.9055e+13     ! 1 mol Fe = 55.85 g; 1.e12*1.e6/55.85/365 conversion factor from Tg/y to umol/d
+   rn_trcfac(45) =  2.7397e+12     ! 1.e15/365 ! conversion factor from Tg/y to mg/d
+   rn_trcfac(56) =  2.7397e+12     ! 1.e15/365 ! conversion factor from Tg/y to mg/d
+   cn_dir       = './'     !  root directory for the location of the boundary condition files
+/
+!-----------------------------------------------------------------------
+&namtrc_adv    !   advection scheme for passive tracer 
+!-----------------------------------------------------------------------
+   ln_trcadv_cen2   =  .false.  !  2nd order centered scheme   
+   ln_trcadv_tvd    =  .false.  !  TVD scheme
+   ln_trcadv_muscl  =  .true.   !  MUSCL scheme
+   ln_trcadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries
+   ln_trcadv_ubs    =  .false.  !  UBS scheme
+   ln_trcadv_qck    =  .false.  !  QUICKEST scheme
+/
+!-----------------------------------------------------------------------
+&namtrc_ldf    !   lateral diffusion scheme for passive tracer 
+!-----------------------------------------------------------------------
+   ln_trcldf_diff   =  .true.   !  performs lateral diffusion (T) or not (F)
+!                               !  Type of the operator : 
+   ln_trcldf_lap    =  .true.   !     laplacian operator       
+   ln_trcldf_bilap  =  .false.  !     bilaplacian operator     
+                                !  Direction of action  :
+   ln_trcldf_level  =  .false.  !     iso-level                
+   ln_trcldf_hor    =  .false.  !     horizontal (geopotential)         (require "key_ldfslp" when ln_sco=T)
+   ln_trcldf_iso    =  .true.   !     iso-neutral                       (require "key_ldfslp")
+!                               !  Coefficient
+   rn_ahtrc_0       =  2000.    !  horizontal eddy diffusivity for tracers [m2/s]
+   rn_ahtrb_0       =     0.    !     background eddy diffusivity for ldf_iso [m2/s]
+/
+!-----------------------------------------------------------------------
+&namtrc_zdf        !   vertical physics
+!-----------------------------------------------------------------------
+   ln_trczdf_exp   =  .false.  !  split explicit (T) or implicit (F) time stepping
+   nn_trczdf_exp   =   3       !  number of sub-timestep for ln_trczdfexp=T
+/
+!-----------------------------------------------------------------------
+&namtrc_rad        !  treatment of negative concentrations 
+!-----------------------------------------------------------------------
+   ln_trcrad   =  .true.  !  artificially correct negative concentrations (T) or not (F)
+/
+!-----------------------------------------------------------------------
+&namtrc_dmp    !   passive tracer newtonian damping   
+!-----------------------------------------------------------------------
+   ln_trcdmp   =  .false.  !  add a damping term (T) or not (F)
+   nn_hdmp_tr  =   -1      !  horizontal shape =-1, damping in Med and Red Seas only
+                           !                   =XX, damping poleward of XX degrees (XX>0)
+                           !                      + F(distance-to-coast) + Red and Med Seas
+   nn_zdmp_tr  =    1      !  vertical   shape =0    damping throughout the water column
+                           !                   =1 no damping in the mixing layer (kz  criteria)
+                           !                   =2 no damping in the mixed  layer (rho crieria)
+   rn_surf_tr  =   50.     !  surface time scale of damping   [days]
+   rn_bot_tr   =  360.     !  bottom  time scale of damping   [days]
+   rn_dep_tr   =  800.     !  depth of transition between rn_surf and rn_bot [meters]
+   nn_file_tr  =    0      !  create a damping.coeff NetCDF file (=1) or not (=0)
+/
+!-----------------------------------------------------------------------
+&namtrc_trd       !   diagnostics on tracer trends        ('key_trdtrc')
+!                          or mixed-layer trends          ('key_trdmld_trc')
+!----------------------------------------------------------------------
+   nn_trd_trc  =  360       !  time step frequency and tracers trends
+   nn_ctls_trc =   0        !  control surface type in mixed-layer trends (0,1 or n<jpk)
+   rn_ucf_trc  =   86400    !  unit conversion factor (=1 -> /seconds ; =86400. -> /day)
+   ln_trdmld_trc_restart = .false.  !  restart for ML diagnostics
+   ln_trdmld_trc_instant = .false.  !  flag to diagnose trends of instantantaneous or mean ML T/S
+   ln_trdtrc(1)  =   .true.
+   ln_trdtrc(2)  =   .true.
+   ln_trdtrc(23) =   .true.
+/
+!-----------------------------------------------------------------------
+&namtrc_dia       !   parameters for passive tracer additional diagnostics
+!----------------------------------------------------------------------
+   ln_diatrc     =  .false.   !  save additional diag. (T) or not (F)
+   ln_diabio     =  .false.
+   nn_writedia   =  5475     !  time step frequency for diagnostics
+   nn_writebio   =  5475
+/
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/runscript
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/runscript	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/runscript	(revision 3680)
@@ -0,0 +1,40 @@
+#! /bin/sh -x
+
+#BSUB -a poe
+#BSUB -J PEL_OFF          # Name of the job.
+#BSUB -o PELAGOS_%J.out  # Appends std output to file %J.out.
+#BSUB -e PELAGOS_%J.err  # Appends std error to file %J.out.
+#BSUB -P nemo
+#BSUB -q poe_short    # queue
+#BSUB -n 128          # Number of CPUs
+#BSUB -x 
+#BSUB -R "span[ptile=64]"
+
+export MP_WAIT_MODE=poll
+export MP_POLLING_INTERVAL=30000000
+export MP_SHARED_MEMORY=yes
+export MP_EUILIB=us
+export MP_EUIDEVICE=sn_all
+export LDR_CNTRL=TEXTPSIZE=64K@STACKPSIZE=64K@DATAPSIZE=64K
+export MP_TASK_AFFINITY=core
+
+EXP="EXP00_OFF"
+
+workdir="/data/ans017/EXPERIMENTS/PELAGOS/${EXP}"
+datadir="/users/home/ans017/WORKS/GIT/ORCA2-DATA"
+execdir=`pwd`
+
+if [ ! -d ${workdir} ] ; then
+  mkdir -p ${workdir}
+fi
+
+cd ${workdir}
+rm -rf *
+# Copy input files to exp folder
+cp ${execdir}/* ./
+ln -sf ${datadir}/* ./
+ln -sf ${datadir}/ORCA2-TOP/* ./
+# Get the offline physical data and the mesh_mask
+ln -sf /data/ans017/EXPERIMENTS/ORCA2_LIM/*.nc ./
+
+time mpirun.lsf opa
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/xmlio_server.def
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/xmlio_server.def	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/EXP00/xmlio_server.def	(revision 3680)
@@ -0,0 +1,35 @@
+! xmlio_server namelist
+!
+! using_server: .TRUE.(.FALSE.) to use(bypass) the io_server
+! using_oasis : .TRUE.(.FALSE.) if nemo is coupled through OASIS
+! client_id   : used only for OASIS, NEMO      id in the namecouple 
+! server_id   : used only for OASIS, io_server id in the namecouple
+!
+&coupling_param
+  using_server = .FALSE.
+  using_oasis  = .FALSE.
+  client_id    = 'nemo.x'
+  server_id    = 'ionemo'
+/
+
+! global_mpi_buffer_size: size in Mo of the MPI buffer used by the io_server
+&mpi_param
+  global_mpi_buffer_size = 512
+/  
+
+!!======================================================================
+!!   namnc4            netcdf4 chunking and compression settings
+!!======================================================================
+!-----------------------------------------------------------------------
+&namnc4         !  netcdf4 chunking and compression settings
+                !  (benign if "key_netcdf4" is not used)
+!-----------------------------------------------------------------------
+   nn_nchunks_i   =   4       !  number of chunks in i-dimension
+   nn_nchunks_j   =   4       !  number of chunks in j-dimension
+   nn_nchunks_k   =   31      !  number of chunks in k-dimension
+                              !  setting nn_nchunks_k = jpk will give a chunk size of 1 in the vertical which
+                              !  is optimal for postprocessing which works exclusively with horizontal slabs
+   ln_nc4zip      =   .TRUE.  !  (T) use netcdf4 chunking and compression
+                              !  (F) ignore chunking information and produce netcdf3-compatible files  
+/
+  
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/cpp_PELAGOS_OFF.fcm
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/cpp_PELAGOS_OFF.fcm	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/PELAGOS_OFF/cpp_PELAGOS_OFF.fcm	(revision 3680)
@@ -0,0 +1,2 @@
+bld::tool::fppkeys key_trabbl key_orca_r2 key_ldfslp key_traldf_c2d key_traldf_eiv key_top key_offline key_my_trc key_iomput key_mpp_mpi
+inc $BFMDIR/src/nemo/bfm.fcm
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/cfg.txt
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/cfg.txt	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/cfg.txt	(revision 3680)
@@ -1,10 +1,13 @@
-GYRE OPA_SRC
-GYRE_LOBSTER OPA_SRC TOP_SRC
 ORCA2_LIM3 OPA_SRC LIM_SRC_3
 AMM12 OPA_SRC
+GYRE_PISCES OPA_SRC TOP_SRC
+GYRE OPA_SRC
+ORCA2_OFF_PISCES OPA_SRC OFF_SRC TOP_SRC
 ORCA2_LIM_PISCES OPA_SRC LIM_SRC_2 NST_SRC TOP_SRC
-AMM12_PISCES OPA_SRC TOP_SRC
-ORCA2_OFF_PISCES OPA_SRC OFF_SRC TOP_SRC
-ORCA2_LIM OPA_SRC LIM_SRC_2 NST_SRC
 ORCA2_SAS_LIM OPA_SRC SAS_SRC LIM_SRC_2 NST_SRC
 ORCA2_SAS_LIM3 OPA_SRC SAS_SRC LIM_SRC_3 NST_SRC
+ORCA2_LIM_CFC_C14b OPA_SRC LIM_SRC_2 NST_SRC TOP_SRC
+GYRE_BFM OPA_SRC TOP_SRC
+PELAGOS_OFF OPA_SRC OFF_SRC TOP_SRC
+PELAGOS OPA_SRC LIM_SRC_2 NST_SRC TOP_SRC
+ORCA2_LIM OPA_SRC LIM_SRC_2 NST_SRC
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/makenemo
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/makenemo	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/CONFIG/makenemo	(revision 3680)
@@ -302,6 +302,12 @@
 #if AGRIF we do a first preprocessing
     if [ ${#x_c} -eq 0 ]; then
-        [ "$AGRIFUSE" == 1 ] && fcm build --ignore-lock -s 2 ${COMPIL_DIR}/$USEBLD
-        [ "$AGRIFUSE" == 1 ] && rm -rf  ${NEMO_TDIR}/${NEW_CONF}/BLD/*
+       if [ "$AGRIFUSE" == 1 ]; then 
+          fcm build --ignore-lock  -j 1 ${COMPIL_DIR}/bld_preproagr.cfg ||{ cd - ; exit ;}
+          echo ""
+          echo "---------------------------------"
+          echo "CONV preprocessing successfull !!"
+          echo "---------------------------------"
+          echo ""
+       fi
     fi
     fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD || cd -
@@ -311,4 +317,5 @@
 #add remove for clean option
     if  [ ${#x_c} -ne 0 ]; then
+        rm -rf ${NEMO_TDIR}/${NEW_CONF}/OPAFILES
         rm -rf ${NEMO_TDIR}/${NEW_CONF}/WORK
         rm -rf ${NEMO_TDIR}/${NEW_CONF}/BLD
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/EXTERNAL/IOIPSL/tools/flio_rbld.f90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/EXTERNAL/IOIPSL/tools/flio_rbld.f90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/EXTERNAL/IOIPSL/tools/flio_rbld.f90	(revision 3680)
@@ -678,4 +678,12 @@
               io_sl(v_d_ul(iv))=it
             ENDIF
+          ENDIF
+!-------- Initialize to zero variables data 
+          ! approximate dimension
+          IF ( it == 1 .AND. l_cgd) THEN
+          ! Enter I*J I*J is larger thant total number of single files
+            if ( ((f_d_l(1)/(d_s_l(1,1)-3)) * (f_d_l(2)/(d_s_l(2,1)-3) )) .gt. d_n_t ) then 
+              CALL ZeroFill (f_id_o, f_v_nm(iv), f_d_l, v_d_nb(iv), v_type(iv), v_d_i(1:v_d_nb(iv),iv))
+            endif
           ENDIF
         ENDIF
@@ -1621,4 +1629,156 @@
 END SUBROUTINE flrb_rg
 !===
+SUBROUTINE ZeroFill(f_id_o,f_v_nm,f_d_l,v_d_nb,v_type,v_d_i)
+
+  IMPLICIT NONE
+! Character length
+  INTEGER,PARAMETER :: chlen=256
+
+  INTEGER              :: v_d_nb, v_type ! variable # of dims, variable type, var Unlim dimension
+  INTEGER              :: f_id_o         ! Output file ID
+  INTEGER,DIMENSION(:) :: f_d_l, v_d_i    ! Global dimensions, variable dimensio ID
+  CHARACTER(LEN=chlen) :: f_v_nm         ! Variable name
+  INTEGER,DIMENSION(:),ALLOCATABLE :: dims
+
+  INTEGER(KIND=i_2) :: i2_0d
+  INTEGER(KIND=i_2), ALLOCATABLE :: i2_1d(:), i2_2d(:,:), i2_3d(:,:,:), i2_4d(:,:,:,:), i2_5d(:,:,:,:,:)
+  INTEGER(KIND=i_4) :: i4_0d
+  INTEGER(KIND=i_4), ALLOCATABLE :: i4_1d(:), i4_2d(:,:), i4_3d(:,:,:), i4_4d(:,:,:,:), i4_5d(:,:,:,:,:)
+  REAL(KIND=r_4) :: r4_0d
+  REAL(KIND=r_4), ALLOCATABLE    :: r4_1d(:), r4_2d(:,:), r4_3d(:,:,:), r4_4d(:,:,:,:), r4_5d(:,:,:,:,:)
+  REAL(KIND=r_8) :: r8_0d
+  REAL(KIND=r_8), ALLOCATABLE    :: r8_1d(:), r8_2d(:,:), r8_3d(:,:,:), r8_4d(:,:,:,:), r8_5d(:,:,:,:,:)
+  
+  ! write(*,*) ' Into my sub... TOM'
+  ! write(*,*) f_id_o, TRIM(f_v_nm), v_d_nb , v_type
+  write(*,*) 'Variable: ',TRIM(f_v_nm), ' intiliazed to zero'
+  write(*,*)
+
+  ! define variable dimension
+  ALLOCATE(dims(v_d_nb)) 
+  dims=f_d_l(v_d_i)
+  SELECT CASE(v_type) 
+    ! INTEGER 1 and 2 
+    CASE (flio_i1,flio_i2)
+      SELECT CASE (v_d_nb)
+       CASE(1)
+         ALLOCATE(i2_1d(dims(1)))
+         i2_1d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),i2_1d)
+         DEALLOCATE(i2_1d)
+       CASE(2)
+         ALLOCATE(i2_2d(dims(1),dims(2)))
+         i2_2d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),i2_2d) 
+         DEALLOCATE(i2_2d)
+       CASE(3)
+         ALLOCATE(i2_3d(dims(1),dims(2),dims(3)))
+         i2_3d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),i2_3d)
+         DEALLOCATE(i2_3d)
+       CASE(4)
+         ALLOCATE(i2_4d(dims(1),dims(2),dims(3),dims(4)))
+         i2_4d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),i2_4d)
+         DEALLOCATE(i2_4d)
+       CASE(5)
+         ALLOCATE(i2_5d(dims(1),dims(2),dims(3),dims(4),dims(5)))
+         i2_5d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),i2_5d)
+         DEALLOCATE(i2_5d)
+      END SELECT
+    ! INTEGER 4
+    CASE (flio_i4)
+      SELECT CASE (v_d_nb)
+       CASE(1)
+         ALLOCATE(i4_1d(dims(1)))
+         i4_1d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),i4_1d)
+         DEALLOCATE(i4_1d)
+       CASE(2)
+         ALLOCATE(i4_2d(dims(1),dims(2)))
+         i4_2d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),i4_2d)
+         DEALLOCATE(i4_2d)
+       CASE(3)
+         ALLOCATE(i4_3d(dims(1),dims(2),dims(3)))
+         i4_3d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),i4_3d)
+         DEALLOCATE(i4_3d)
+       CASE(4)
+         ALLOCATE(i4_4d(dims(1),dims(2),dims(3),dims(4)))
+         i4_4d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),i4_4d)
+         DEALLOCATE(i4_4d)
+       CASE(5)
+         ALLOCATE(i4_5d(dims(1),dims(2),dims(3),dims(4),dims(5)))
+         i4_5d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),i4_5d)
+         DEALLOCATE(i4_5d)
+      END SELECT
+    ! FLOAT 4
+    CASE (flio_r4)
+      SELECT CASE (v_d_nb)
+       CASE(1)
+         ALLOCATE(r4_1d(dims(1)))
+         r4_1d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),r4_1d) 
+         DEALLOCATE(r4_1d)
+       CASE(2)
+         ALLOCATE(r4_2d(dims(1),dims(2)))
+         r4_2d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),r4_2d) 
+         DEALLOCATE(r4_2d)
+       CASE(3)
+         ALLOCATE(r4_3d(dims(1),dims(2),dims(3)))
+         r4_3d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),r4_3d) 
+         DEALLOCATE(r4_3d)
+       CASE(4)
+         ALLOCATE(r4_4d(dims(1),dims(2),dims(3),dims(4)))
+         r4_4d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),r4_4d)
+         DEALLOCATE(r4_4d)
+       CASE(5)
+         ALLOCATE(r4_5d(dims(1),dims(2),dims(3),dims(4),dims(5)))
+         r4_5d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),r4_5d)
+         DEALLOCATE(r4_5d)
+      END SELECT
+    ! FLOAT 8
+    CASE (flio_r8)
+      SELECT CASE (v_d_nb)
+       CASE(1)
+         ALLOCATE(r8_1d(dims(1)))
+         r8_1d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),r8_1d)
+         DEALLOCATE(r8_1d)
+       CASE(2)
+         ALLOCATE(r8_2d(dims(1),dims(2)))
+         r8_2d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),r8_2d) 
+         DEALLOCATE(r8_2d)
+       CASE(3)
+         ALLOCATE(r8_3d(dims(1),dims(2),dims(3)))
+         r8_3d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),r8_3d)
+         DEALLOCATE(r8_3d)
+       CASE(4)
+         ALLOCATE(r8_4d(dims(1),dims(2),dims(3),dims(4)))
+         r8_4d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),r8_4d)
+         DEALLOCATE(r8_4d)
+       CASE(5)
+         ALLOCATE(r8_5d(dims(1),dims(2),dims(3),dims(4),dims(5)))
+         r8_5d=0
+         CALL flioputv (f_id_o,TRIM(f_v_nm),r8_5d)
+         DEALLOCATE(r8_5d)
+      END SELECT
+  END SELECT
+
+  DEALLOCATE (dims)
+
+END SUBROUTINE
+!===
 !--------------------
 END PROGRAM flio_rbld
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/LIM_SRC_2/limrhg_2.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/LIM_SRC_2/limrhg_2.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/LIM_SRC_2/limrhg_2.F90	(revision 3680)
@@ -32,4 +32,7 @@
    USE oce     , ONLY : snwice_mass, snwice_mass_b
    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
+#if defined key_agrif
+   USE agrif_lim2_interp ! nesting
+#endif
 
    IMPLICIT NONE
@@ -148,4 +151,8 @@
          zpice(:,:) = ssh_m(:,:)
       ENDIF
+#if defined key_agrif
+      ! load the boundary value of velocity in special array zuive and zvice
+      CALL agrif_rhg_lim2_load
+#endif
 
       ! Ice mass, ice strength, and wind stress at the center            |
@@ -552,4 +559,10 @@
             CALL lbc_lnk( zv_n(:,1:jpj), 'I', -1. )
 
+#if defined key_agrif
+            ! copy the boundary value from u_ice_nst and v_ice_nst to u_ice and v_ice
+            ! before next interations
+            CALL agrif_rhg_lim2(zu_n,zv_n)
+#endif
+
             ! Test of Convergence
             DO jj = k_j1+1 , k_jpj-1
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/LIM_SRC_2/limtrp_2.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/LIM_SRC_2/limtrp_2.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/LIM_SRC_2/limtrp_2.F90	(revision 3680)
@@ -28,4 +28,7 @@
    USE lib_mpp         ! MPP library
    USE wrk_nemo        ! work arrays
+# if defined key_agrif
+   USE agrif_lim2_interp ! nesting
+# endif
 
    IMPLICIT NONE
@@ -80,4 +83,8 @@
 
       IF( kt == nit000  )   CALL lim_trp_init_2      ! Initialization (first time-step only)
+
+# if defined key_agrif
+      CALL agrif_trp_lim2_load      ! First interpolation
+# endif
 
       zsm(:,:) = area(:,:)
@@ -269,4 +276,8 @@
       ENDIF
       !
+# if defined key_agrif
+      CALL agrif_trp_lim2      ! Fill boundaries of the fine grid
+# endif
+      ! 
       CALL wrk_dealloc( jpi, jpj, zui_u , zvi_v , zsm, zs0ice, zs0sn , zs0a, zs0c0 , zs0c1 , zs0c2 , zs0st )
       !
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90	(revision 3680)
@@ -8,5 +8,6 @@
    !!             -   !  2008-11  (M. Vancoppenolle, S. Bouillon, Y. Aksenov) add surface tilt in ice rheolohy 
    !!            3.3  !  2009-05  (G.Garric) addition of the lim2_evp cas
-   !!            4.0  !  2011-01  (A Porter)  dynamical allocation 
+   !!            3.4  !  2011-01  (A. Porter)  dynamical allocation 
+   !!            3.5  !  2012-08  (R. Benshila)  AGRIF 
    !!----------------------------------------------------------------------
 #if defined key_lim3 || (  defined key_lim2 && ! defined key_lim2_vp )
@@ -37,4 +38,7 @@
    USE prtctl         ! Print control
    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
+#if defined key_agrif && defined key_lim2
+   USE agrif_lim2_interp
+#endif
 
    IMPLICIT NONE
@@ -168,4 +172,7 @@
      at_i(:,:) = 1. - frld(:,:)
 #endif
+#if defined key_agrif && defined key_lim2 
+    CALL agrif_rhg_lim2_load      ! First interpolation of coarse values
+#endif
       !
       !------------------------------------------------------------------------------!
@@ -510,4 +517,7 @@
 
             CALL lbc_lnk( u_ice(:,:), 'U', -1. )
+#if defined key_agrif
+            CALL agrif_rhg_lim2( jter, nevp, 'U' )
+#endif
 
 !CDIR NOVERRCHK
@@ -535,4 +545,7 @@
 
             CALL lbc_lnk( v_ice(:,:), 'V', -1. )
+#if defined key_agrif
+            CALL agrif_rhg_lim2( jter, nevp, 'V' )
+#endif
 
          ELSE 
@@ -561,4 +574,7 @@
 
             CALL lbc_lnk( v_ice(:,:), 'V', -1. )
+#if defined key_agrif
+            CALL agrif_rhg_lim2( jter, nevp , 'V' )
+#endif
 
 !CDIR NOVERRCHK
@@ -589,4 +605,7 @@
 
             CALL lbc_lnk( u_ice(:,:), 'U', -1. )
+#if defined key_agrif
+            CALL agrif_rhg_lim2( jter, nevp, 'U' )
+#endif
 
          ENDIF
@@ -629,4 +648,8 @@
       CALL lbc_lnk( u_ice(:,:), 'U', -1. ) 
       CALL lbc_lnk( v_ice(:,:), 'V', -1. ) 
+#if defined key_agrif
+      CALL agrif_rhg_lim2( nevp , nevp, 'U' )
+      CALL agrif_rhg_lim2( nevp , nevp, 'V' )
+#endif
 
       DO jj = k_j1+1, k_jpj-1 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif2model.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif2model.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif2model.F90	(revision 3680)
@@ -5,4 +5,9 @@
    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
+   SUBROUTINE Agrif2Model
+      !!---------------------------------------------
+      !!   *** ROUTINE Agrif2Model ***
+      !!--------------------------------------------- 
+   END SUBROUTINE Agrif2model
 
    SUBROUTINE Agrif_Set_numberofcells(Agrif_Gr)
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_ice.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_ice.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_ice.F90	(revision 3680)
@@ -0,0 +1,63 @@
+MODULE agrif_ice
+   !!======================================================================
+   !!                       ***  MODULE agrif_ice  ***
+   !! AGRIF :   define in memory AGRIF variables for sea-ice
+   !!----------------------------------------------------------------------
+   !! History :  3.4  ! 2012-08  (R. Benshila)  Original code
+   !!----------------------------------------------------------------------
+#if defined key_agrif && defined key_lim2
+   !!----------------------------------------------------------------------
+   !!   'key_agrif'                                              AGRIF zoom
+   !!----------------------------------------------------------------------
+   USE par_oce      ! ocean parameters
+   
+   IMPLICIT NONE
+   PRIVATE 
+
+   PUBLIC agrif_ice_alloc ! routine called by nemo_init in nemogcm.F90
+
+   INTEGER, PUBLIC :: u_ice_id, v_ice_id, adv_ice_id
+   REAL(wp), PUBLIC :: lim_nbstep = 0.    ! child time position in sea-ice model
+#if defined key_lim2_vp
+   REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:)     :: u_ice_nst, v_ice_nst   
+#else
+   REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:,:)   :: u_ice_oe, u_ice_sn     !: boundaries arrays
+   REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:,:)   :: v_ice_oe, v_ice_sn     !:  "          " 
+#endif
+   REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:,:,:) :: adv_ice_oe, adv_ice_sn !:  "          "
+
+   !!----------------------------------------------------------------------
+   !! NEMO/NST 3.3.4 , NEMO Consortium (2012)
+   !! $Id$
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS 
+
+   INTEGER FUNCTION agrif_ice_alloc()
+      !!----------------------------------------------------------------------
+      !!                ***  FUNCTION agrif_ice_alloc  ***
+      !!----------------------------------------------------------------------
+#if defined key_lim2_vp
+      ALLOCATE( u_ice_nst(jpi,jpj), v_ice_nst(jpi,jpj) ,   &
+#else
+      ALLOCATE( u_ice_oe(4,jpj,2) , v_ice_oe(4,jpj,2) ,    &
+         &      u_ice_sn(jpi,4,2) , v_ice_sn(jpi,4,2) ,    &
+#endif
+         &      adv_ice_oe (4,jpj,7,2) , adv_ice_sn (jpi,4,7,2) ,   &
+         &      STAT = agrif_ice_alloc)
+
+#if ! defined key_lim2_vp
+      u_ice_oe(:,:,:) =  0.e0
+      v_ice_oe(:,:,:) =  0.e0
+      u_ice_sn(:,:,:) =  0.e0
+      v_ice_sn(:,:,:) =  0.e0
+#endif
+      adv_ice_oe (:,:,:,:) = 0.e0 
+      adv_ice_sn (:,:,:,:) = 0.e0 
+      !
+   END FUNCTION agrif_ice_alloc
+
+#endif
+   !!======================================================================
+END MODULE agrif_ice
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_lim2_interp.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_lim2_interp.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_lim2_interp.F90	(revision 3680)
@@ -0,0 +1,610 @@
+MODULE agrif_lim2_interp
+   !!======================================================================
+   !!                       ***  MODULE agrif_lim2_update ***
+   !! Nesting module :  update surface ocean boundary condition over ice
+   !!                   from a child grif
+   !! Sea-Ice model  :  LIM 2.0 Sea ice model time-stepping
+   !!======================================================================
+   !! History :  2.0   !  04-2008  (F. Dupont)  initial version
+   !!            3.4   !  09-2012  (R. Benshila, C. Herbaut) update and EVP
+   !!----------------------------------------------------------------------
+#if defined key_agrif && defined key_lim2
+   !!----------------------------------------------------------------------
+   !!   'key_lim2'  :                                 LIM 2.0 sea-ice model
+   !!   'key_agrif' :                                 AGRIF library
+   !!----------------------------------------------------------------------
+   !!   agrif_interp_lim2   : update sea-ice model on boundaries or total
+   !!                         sea-ice area
+   !!  agrif_rhg_lim2_load  : interpolcation of ice velocities using Agrif
+   !!  agrif_rhg_lim2       : sub-interpolation of ice velocities for both 
+   !!                         splitting time and sea-ice time step
+   !!  agrif_interp_u_ice   : atomic routine to interpolate u_ice 
+   !!  agrif_interp_u_ice   : atomic routine to interpolate v_ice 
+   !!  agrif_trp_lim2_load  : interpolcation of ice properties using Agrif
+   !!  agrif_trp_lim2       : sub-interpolation of ice properties for  
+   !!                         sea-ice time step
+   !!  agrif_interp_u_ice   : atomic routine to interpolate ice properties 
+   !!----------------------------------------------------------------------
+   USE par_oce
+   USE dom_oce
+   USE sbc_oce
+   USE ice_2
+   USE dom_ice_2
+   USE agrif_ice
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC agrif_rhg_lim2_load, agrif_rhg_lim2
+   PUBLIC agrif_trp_lim2_load, agrif_trp_lim2
+   PUBLIC interp_u_ice, interp_v_ice
+   PUBLIC interp_adv_ice
+
+   !!----------------------------------------------------------------------
+   !! NEMO/NST 3.4 , NEMO Consortium (2012)
+   !! $Id$
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+# if defined key_lim2_vp
+   SUBROUTINE agrif_rhg_lim2_load
+      !!-----------------------------------------------------------------------
+      !!              *** ROUTINE agrif_rhg_lim2_load ***
+      !!
+      !!  ** Method  : need a special routine for dealing with exchanging data
+      !! between the child and parent grid during ice step
+      !!
+      !!-----------------------------------------------------------------------
+      !
+      IF (Agrif_Root()) RETURN
+
+      Agrif_SpecialValue=0.
+      Agrif_UseSpecialValue = .FALSE.
+      u_ice_nst(:,:) = 0.
+      v_ice_nst(:,:) = 0.
+      CALL Agrif_Bc_variable( u_ice_nst, u_ice_id ,procname=interp_u_ice, calledweight=1. )
+      CALL Agrif_Bc_variable( v_ice_nst, v_ice_id ,procname=interp_v_ice, calledweight=1. )
+      Agrif_SpecialValue=0.
+      Agrif_UseSpecialValue = .FALSE.
+      !
+   END SUBROUTINE agrif_rhg_lim2_load
+
+
+   SUBROUTINE agrif_rhg_lim2(pu_n,pv_n)
+      !!-----------------------------------------------------------------------
+      !!                 *** ROUTINE agrif_rhg_lim2 ***
+      !!
+      !!  ** Method  : we feel the boundaries with values stored above
+      !!-----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,0:jpj+1), INTENT(inout) :: pu_n, pv_n
+      !!
+      REAL(wp) :: zrhox, zrhoy
+      INTEGER :: ji,jj
+      !!-----------------------------------------------------------------------
+      !
+      IF (Agrif_Root()) RETURN
+
+      zrhox = Agrif_Rhox()
+      zrhoy = Agrif_Rhoy()
+
+      IF((nbondi == -1).OR.(nbondi == 2)) THEN
+         DO jj=2,jpj
+            pu_n(3,jj) = u_ice_nst(3,jj)/(zrhoy*e2f(2,jj-1))*tmu(3,jj)
+         END DO
+         DO jj=2,jpj
+            pv_n(3,jj) = v_ice_nst(3,jj)/(zrhox*e1f(2,jj-1))*tmu(3,jj)
+         END DO
+      ENDIF
+
+      IF((nbondi == 1).OR.(nbondi == 2)) THEN
+         DO jj=2,jpj
+            pu_n(nlci-1,jj) = u_ice_nst(nlci-1,jj)/(zrhoy*e2f(nlci-2,jj-1))*tmu(nlci-1,jj)
+         END DO
+         DO jj=2,jpj
+            pv_n(nlci-1,jj) = v_ice_nst(nlci-1,jj)/(zrhox*e1f(nlci-2,jj-1))*tmu(nlci-1,jj)
+         END DO
+      ENDIF
+
+      IF((nbondj == -1).OR.(nbondj == 2)) THEN
+         DO ji=2,jpi
+            pv_n(ji,3) = v_ice_nst(ji,3)/(zrhox*e1f(ji-1,2))*tmu(ji,3)
+         END DO
+         DO ji=2,jpi
+            pu_n(ji,3) = u_ice_nst(ji,3)/(zrhoy*e2f(ji-1,2))*tmu(ji,3)
+         END DO
+      ENDIF
+
+      IF((nbondj == 1).OR.(nbondj == 2)) THEN
+         DO ji=2,jpi
+            pv_n(ji,nlcj-1) = v_ice_nst(ji,nlcj-1)/(zrhox*e1f(ji-1,nlcj-2))*tmu(ji,nlcj-1)
+         END DO
+         DO ji=2,jpi
+            pu_n(ji,nlcj-1) = u_ice_nst(ji,nlcj-1)/(zrhoy*e2f(ji-1,nlcj-2))*tmu(ji,nlcj-1)
+         END DO
+      ENDIF
+      !
+   END SUBROUTINE agrif_rhg_lim2
+
+#else
+   SUBROUTINE agrif_rhg_lim2_load
+      !!-----------------------------------------------------------------------
+      !!              *** ROUTINE agrif_rhg_lim2_load ***
+      !!
+      !!  ** Method  : need a special routine for dealing with exchanging data
+      !!  between the child and parent grid during ice step
+      !!               we interpolate and store the boundary if needed, ie if
+      !!  we are in inside a new parent ice time step
+      !!-----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj) :: zuice, zvice
+      INTEGER :: ji,jj
+      REAL(wp) :: zrhox, zrhoy
+      !!-----------------------------------------------------------------------
+      !
+      IF (Agrif_Root()) RETURN
+
+      IF( lim_nbstep == 1. ) THEN
+         !
+         ! switch old values by hand
+         u_ice_oe(:,:,1) =  u_ice_oe(:,:,2)
+         v_ice_oe(:,:,1) =  v_ice_oe(:,:,2)
+         u_ice_sn(:,:,1) =  u_ice_sn(:,:,2)
+         v_ice_sn(:,:,1) =  v_ice_sn(:,:,2)
+         ! interpolation of boundaries (called weight prevents AGRIF interpolation)
+         Agrif_SpecialValue=-9999.
+         Agrif_UseSpecialValue = .TRUE.
+         zuice = 0.
+         zvice = 0.
+         CALL Agrif_Bc_variable(zuice,u_ice_id,procname=interp_u_ice, calledweight=1.)
+         CALL Agrif_Bc_variable(zvice,v_ice_id,procname=interp_v_ice, calledweight=1.)
+         Agrif_SpecialValue=0.
+         Agrif_UseSpecialValue = .FALSE.
+         !  
+         zrhox = agrif_rhox() ;    zrhoy = agrif_rhoy()      
+         zuice(:,:) =  zuice(:,:)/(zrhoy*e2u(:,:))*umask(:,:,1)
+         zvice(:,:) =  zvice(:,:)/(zrhox*e1v(:,:))*vmask(:,:,1)
+         ! fill  boundaries
+         DO jj = 1, jpj
+            DO ji = 1, 2
+               u_ice_oe(ji,  jj,2) = zuice(ji       ,jj) 
+               u_ice_oe(ji+2,jj,2) = zuice(nlci+ji-3,jj)
+            END DO
+         END DO
+         DO jj = 1, jpj
+            v_ice_oe(2,jj,2) = zvice(2     ,jj) 
+            v_ice_oe(4,jj,2) = zvice(nlci-1,jj)
+         END DO
+         DO ji = 1, jpi
+            u_ice_sn(ji,2,2) = zuice(ji,2     ) 
+            u_ice_sn(ji,4,2) = zuice(ji,nlcj-1)
+         END DO
+         DO jj = 1, 2
+            DO ji = 1, jpi
+               v_ice_sn(ji,jj  ,2) = zvice(ji,jj       ) 
+               v_ice_sn(ji,jj+2,2) = zvice(ji,nlcj+jj-3)
+            END DO
+         END DO
+         !
+      ENDIF
+      !
+   END SUBROUTINE agrif_rhg_lim2_load
+
+
+   SUBROUTINE agrif_rhg_lim2( kiter, kitermax, cd_type)
+      !!-----------------------------------------------------------------------
+      !!                 *** ROUTINE agrif_rhg_lim2  ***
+      !!
+      !!  ** Method  : simple call to atomic routines using stored values to
+      !!  fill the boundaries depending of the position of the point and 
+      !!  computing factor for time interpolation 
+      !!-----------------------------------------------------------------------
+      INTEGER, INTENT(in) :: kiter, kitermax
+      CHARACTER(len=1), INTENT( in ) :: cd_type
+      !!    
+      REAL(wp) :: zalpha, zbeta
+      !!-----------------------------------------------------------------------
+      !
+      IF (Agrif_Root()) RETURN
+      zalpha = REAL(lim_nbstep,wp) / (Agrif_Rhot()*Agrif_PArent(nn_fsbc)/REAL(nn_fsbc))
+      zbeta  = REAL(kiter,wp) / kitermax
+      zbeta = zalpha * zbeta
+      SELECT CASE(cd_type)
+      CASE('U')
+         CALL ParcoursU( zbeta )
+      CASE('V')
+         CALL ParcoursV( zbeta )
+      END SELECT
+      !
+   END SUBROUTINE agrif_rhg_lim2
+
+
+   SUBROUTINE ParcoursU( pbeta )
+      !!-----------------------------------------------------------------------
+      !!                    *** ROUTINE parcoursU ***
+      !!
+      !!  ** Method  : time and spatial interpolation for U-point using values
+      !!  interpolated from the coarse grid and inside dvalues     
+      !!-----------------------------------------------------------------------
+      REAL(wp), INTENT(in) :: pbeta
+      !!
+      INTEGER :: ji, jj
+      !!-----------------------------------------------------------------------
+      !
+      IF((nbondi == -1).OR.(nbondi == 2)) THEN
+         DO jj=1,jpj
+            DO ji=1,2
+               u_ice(ji,jj) = (1-pbeta) * u_ice_oe(ji,jj,1) + pbeta * u_ice_oe(ji,jj,2)
+            END DO
+         END DO
+         DO jj=1,jpj
+            u_ice(2,jj) = 0.25*(u_ice(1,jj)+2.*u_ice(2,jj)+u_ice(3,jj))
+            u_ice(2,jj) = u_ice(2,jj) * umask(2,jj,1)
+         END DO
+      ENDIF
+
+      IF((nbondi == 1).OR.(nbondi == 2)) THEN
+         DO jj=1,jpj
+            DO ji=1,2
+               u_ice(nlci+ji-3,jj) = (1-pbeta) * u_ice_oe(ji+2,jj,1) + pbeta * u_ice_oe(ji+2,jj,2)
+            END DO
+         END DO
+         DO jj=1,jpj
+            u_ice(nlci-2,jj) = 0.25*(u_ice(nlci-3,jj)+2.*u_ice(nlci-2,jj)+u_ice(nlci-1,jj))
+            u_ice(nlci-2,jj) = u_ice(nlci-2,jj) * umask(nlci-2,jj,1)
+         END DO
+      ENDIF
+
+      IF((nbondj == -1).OR.(nbondj == 2)) THEN
+         DO ji=1,jpi
+            u_ice(ji,2) = (1-pbeta) * u_ice_sn(ji,2,1) + pbeta * u_ice_sn(ji,2,2)
+            u_ice(ji,2) = u_ice(ji,2)*umask(ji,2,1)
+         END DO
+      ENDIF
+
+      IF((nbondj == 1).OR.(nbondj == 2)) THEN
+         DO ji=1,jpi
+            u_ice(ji,nlcj-1) = (1-pbeta) * u_ice_sn(ji,4,1) + pbeta * u_ice_sn(ji,4,2)
+            u_ice(ji,nlcj-1) = u_ice(ji,nlcj-1)*umask(ji,nlcj-1,1)
+         END DO
+      ENDIF
+      !
+   END SUBROUTINE ParcoursU
+
+
+   SUBROUTINE ParcoursV( pbeta )
+      !!-----------------------------------------------------------------------
+      !!                    *** ROUTINE parcoursV ***
+      !! 
+      !!  ** Method  : time and spatial interpolation for V-point using values
+      !!  interpolated from the coarse grid and inside dvalues     
+      !!-----------------------------------------------------------------------
+      REAL(wp), INTENT(in) :: pbeta
+      !!
+      INTEGER :: ji, jj
+      !!-----------------------------------------------------------------------
+      !
+      IF((nbondi == -1).OR.(nbondi == 2)) THEN
+         DO jj=1,jpj
+            v_ice(2,jj) = (1-pbeta) * v_ice_oe(2,jj,1) + pbeta * v_ice_oe(2,jj,2)
+            v_ice(2,jj) = v_ice(2,jj) * vmask(2,jj,1)
+         END DO
+      ENDIF
+
+      IF((nbondi == 1).OR.(nbondi == 2)) THEN
+         DO jj=1,jpj
+            v_ice(nlci-1,jj) = (1-pbeta) * v_ice_oe(4,jj,1) + pbeta * v_ice_oe(4,jj,2)
+            v_ice(nlci-1,jj) = v_ice(nlci-1,jj)*vmask(nlci-1,jj,1)
+         END DO
+      ENDIF
+
+      IF((nbondj == -1).OR.(nbondj == 2)) THEN
+         DO jj=1,2
+            DO ji=1,jpi
+               v_ice(ji,jj) = (1-pbeta) * v_ice_sn(ji,jj,1) + pbeta * v_ice_sn(ji,jj,2)
+            END DO
+         END DO
+         DO ji=1,jpi
+            v_ice(ji,2)=0.25*(v_ice(ji,1)+2.*v_ice(ji,2)+v_ice(ji,3))
+            v_ice(ji,2)=v_ice(ji,2)*vmask(ji,2,1)
+         END DO
+      ENDIF
+
+      IF((nbondj == 1).OR.(nbondj == 2)) THEN
+         DO jj=1,2
+            DO ji=1,jpi
+               v_ice(ji,nlcj+jj-3) = (1-pbeta) * v_ice_sn(ji,jj+2,1) + pbeta * v_ice_sn(ji,jj+2,2)
+            END DO
+         END DO
+         DO ji=1,jpi
+            v_ice(ji,nlcj-2)=0.25*(v_ice(ji,nlcj-3)+2.*v_ice(ji,nlcj-2)+v_ice(ji,nlcj-1))
+            v_ice(ji,nlcj-2) = v_ice(ji,nlcj-2) * vmask(ji,nlcj-2,1)
+         END DO
+      ENDIF
+      !
+   END SUBROUTINE ParcoursV
+# endif
+   SUBROUTINE agrif_trp_lim2_load
+      !!-----------------------------------------------------------------------
+      !!                 *** ROUTINE agrif_trp_lim2_load ***
+      !!
+      !!  ** Method  : need a special routine for dealing with exchanging data
+      !!  between the child and parent grid during ice step
+      !!               we interpolate and store the boundary if needed, ie if
+      !!  we are in inside a new parent ice time step
+     !!-----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj,7) :: ztab 
+      INTEGER :: ji,jj,jn
+      !!-----------------------------------------------------------------------
+      !
+      IF (Agrif_Root()) RETURN
+      IF( lim_nbstep == 1. ) THEN
+         !
+         ! switch old values
+         adv_ice_oe(:,:,:,1) =  adv_ice_oe(:,:,:,2)
+         adv_ice_sn(:,:,:,1) =  adv_ice_sn(:,:,:,2)
+         ! interpolation of boundaries
+         ztab(:,:,:) = 0.
+         Agrif_SpecialValue=-9999.
+         Agrif_UseSpecialValue = .TRUE.
+         CALL Agrif_Bc_variable( ztab, adv_ice_id ,procname=interp_adv_ice,calledweight=1. )
+         Agrif_SpecialValue=0.
+         Agrif_UseSpecialValue = .FALSE.
+         !  
+         ! fill  boundaries
+         DO jn =1,7
+            DO jj = 1, jpj
+               DO ji=1,2
+                  adv_ice_oe(ji  ,jj,jn,2) = ztab(ji       ,jj,jn) 
+                  adv_ice_oe(ji+2,jj,jn,2) = ztab(nlci-2+ji,jj,jn)
+               END DO
+            END DO
+         END DO
+
+         Do jn =1,7
+            Do jj =1,2
+               DO ji = 1, jpi
+                  adv_ice_sn(ji,jj  ,jn,2) = ztab(ji,jj       ,jn) 
+                  adv_ice_sn(ji,jj+2,jn,2) = ztab(ji,nlcj-2+jj,jn)
+               END DO
+            END DO
+         END DO
+         !
+      ENDIF
+      !
+   END SUBROUTINE agrif_trp_lim2_load
+
+
+   SUBROUTINE agrif_trp_lim2
+      !!-----------------------------------------------------------------------
+      !!                  *** ROUTINE agrif_trp_lim2 ***
+      !!
+      !!  ** Method  : time coefficient and call to atomic routines
+      !!-----------------------------------------------------------------------
+      INTEGER :: ji,jj,jn
+      REAL(wp) :: zalpha
+      REAL(wp), DIMENSION(jpi,jpj,7) :: ztab 
+      !!-----------------------------------------------------------------------      
+      !
+      IF (Agrif_Root()) RETURN
+
+      zalpha = REAL(lim_nbstep,wp) / (Agrif_Rhot()*Agrif_PArent(nn_fsbc)/REAL(nn_fsbc))
+      !
+      ztab(:,:,:) = 0.e0
+      DO jn =1,7
+         DO jj =1,2
+            DO ji = 1, jpi
+               ztab(ji,jj        ,jn) = (1-zalpha)*adv_ice_sn(ji,jj  ,jn,1) + zalpha*adv_ice_sn(ji,jj  ,jn,2) 
+               ztab(ji,nlcj-2+jj ,jn) = (1-zalpha)*adv_ice_sn(ji,jj+2,jn,1) + zalpha*adv_ice_sn(ji,jj+2,jn,2) 
+            END DO
+         END DO
+      END DO
+
+      DO jn =1,7
+         DO jj = 1, jpj
+            DO ji=1,2
+               ztab(ji       ,jj,jn) = (1-zalpha)*adv_ice_oe(ji  ,jj,jn,1) + zalpha*adv_ice_oe(ji  ,jj,jn,2) 
+               ztab(nlci-2+ji,jj,jn) = (1-zalpha)*adv_ice_oe(ji+2,jj,jn,1) + zalpha*adv_ice_oe(ji+2,jj,jn,2) 
+            END DO
+         END DO
+      END DO
+      !
+      CALL parcoursT( ztab(:,:, 1), frld  )
+      CALL parcoursT( ztab(:,:, 2), hicif )
+      CALL parcoursT( ztab(:,:, 3), hsnif )
+      CALL parcoursT( ztab(:,:, 4), tbif(:,:,1) )
+      CALL parcoursT( ztab(:,:, 5), tbif(:,:,2) )
+      CALL parcoursT( ztab(:,:, 6), tbif(:,:,3) )
+      CALL parcoursT( ztab(:,:, 7), qstoif )
+      !
+   END SUBROUTINE agrif_trp_lim2
+
+
+   SUBROUTINE parcoursT ( pinterp, pfinal )
+      !!-----------------------------------------------------------------------
+      !!                    *** ROUTINE parcoursT ***
+      !!
+      !!  ** Method  : fill boundaries for T points
+      !!-----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(in)    :: pinterp
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pfinal
+      !!
+      REAL(wp) :: zbound, zvbord
+      REAL(wp), DIMENSION(jpi,jpj) ::  zui_u, zvi_v
+      INTEGER :: ji, jj
+      !!-----------------------------------------------------------------------
+      !
+      zui_u = 0.e0
+      zvi_v = 0.e0
+      ! zvbord factor between 1 and 2 to take into account slip or no-slip boundary conditions.
+      zbound=0.
+      zvbord = 1.0 + ( 1.0 - zbound )
+#if defined key_lim2_vp
+      DO jj = 1, jpjm1
+         DO ji = 1, jpim1
+            zui_u(ji,jj) = ( u_ice(ji+1,jj  ) + u_ice(ji+1,jj+1) ) / ( MAX( tmu(ji+1,jj  ) + tmu(ji+1,jj+1), zvbord ) )
+            zvi_v(ji,jj) = ( v_ice(ji  ,jj+1) + v_ice(ji+1,jj+1) ) / ( MAX( tmu(ji  ,jj+1) + tmu(ji+1,jj+1), zvbord ) )
+         END DO
+      END DO
+#else
+      zui_u(:,:) = u_ice(:,:)
+      zvi_v(:,:) = v_ice(:,:)
+#endif
+
+      IF((nbondi == -1).OR.(nbondi == 2)) THEN
+         DO jj=1,jpj
+            !            IF (zui_u(2,jj).EQ.0.) THEN
+            !               pfinal (2,jj) = pfinal (1,jj) * tms(2,jj)
+            !            ELSE
+            pfinal(2,jj) = 0.25* pinterp(1,jj) + 0.5 *  pinterp(2,jj) + 0.25 *pfinal(3,jj)
+            !            ENDIF
+         END DO
+      ENDIF
+
+      IF((nbondj == -1).OR.(nbondj == 2)) THEN
+         DO ji=1,jpi
+            !            IF (zvi_v(ji,2).EQ.0.) THEN
+            !               pfinal (ji,2) = pfinal (ji,1) * tms(ji,2)
+            !            ELSE
+            pfinal(ji,2) = 0.25* pinterp(ji,1) + 0.5 *  pinterp(ji,2) + 0.25 *pfinal(ji,3)
+            !            ENDIF 
+         END DO
+      ENDIF
+
+
+      IF((nbondi == 1).OR.(nbondi == 2)) THEN
+         DO jj=1,jpj
+            !            IF (zui_u(nlci-2,jj).EQ.0.) THEN
+            !               pfinal(nlci-1,jj) = pfinal (nlci,jj) * tms(nlci-1,jj)
+            !            ELSE
+            pfinal(nlci-1,jj) = 0.25* pinterp(nlci,jj) + 0.5 *  pinterp(nlci-1,jj) + 0.25 *pfinal(nlci-2,jj)
+            !           ENDIF
+         END DO
+      ENDIF
+
+      IF((nbondj == 1).OR.(nbondj == 2)) THEN
+         DO ji=1,jpi
+            !            IF (zvi_v(ji,nlcj-2).EQ.0.) THEN
+            !               pfinal (ji,nlcj-1) =  pfinal(ji,nlcj) * tms(ji,nlcj-1)
+            !            ELSE
+            pfinal(ji,nlcj-1) = 0.25* pinterp(ji,nlcj) + 0.5 *  pinterp(ji,nlcj-1) + 0.25 *pfinal(ji,nlcj-2)
+            !            ENDIF
+         END DO
+      ENDIF
+
+
+      pfinal (:,:) = pfinal (:,:) * tms(:,:)
+      ! 
+   END SUBROUTINE parcoursT
+
+
+   SUBROUTINE interp_u_ice( tabres, i1, i2, j1, j2 )
+      !!-----------------------------------------------------------------------
+      !!                     *** ROUTINE interp_u_ice ***
+      !!-----------------------------------------------------------------------
+      INTEGER, INTENT(in) :: i1, i2, j1, j2
+      REAL(wp), DIMENSION(i1:i2,j1:j2), INTENT(inout) :: tabres
+      !!
+      INTEGER :: ji,jj
+      !!-----------------------------------------------------------------------
+      !
+#if defined key_lim2_vp
+      DO jj=MAX(j1,2),j2
+         DO ji=MAX(i1,2),i2
+            IF( tmu(ji,jj) == 0. ) THEN
+               tabres(ji,jj) = -9999.
+            ELSE
+               tabres(ji,jj) = e2f(ji-1,jj-1) * u_ice(ji,jj)
+            ENDIF
+         END DO
+      END DO
+#else
+      DO jj= j1, j2
+         DO ji= i1, i2
+            IF( umask(ji,jj,1) == 0. ) THEN
+               tabres(ji,jj) = -9999.
+            ELSE
+               tabres(ji,jj) = e2u(ji,jj) * u_ice(ji,jj)
+            ENDIF
+         END DO
+      END DO
+#endif
+   END SUBROUTINE interp_u_ice
+
+
+   SUBROUTINE interp_v_ice( tabres, i1, i2, j1, j2 )
+      !!-----------------------------------------------------------------------
+      !!                    *** ROUTINE interp_v_ice ***
+      !!-----------------------------------------------------------------------      
+      INTEGER, INTENT(in) :: i1, i2, j1, j2
+      REAL(wp), DIMENSION(i1:i2,j1:j2), INTENT(inout) :: tabres
+      !!
+      INTEGER :: ji, jj
+      !!-----------------------------------------------------------------------
+      !
+#if defined key_lim2_vp
+      DO jj=MAX(j1,2),j2
+         DO ji=MAX(i1,2),i2
+            IF( tmu(ji,jj) == 0. ) THEN
+               tabres(ji,jj) = -9999.
+            ELSE
+               tabres(ji,jj) = e1f(ji-1,jj-1) * v_ice(ji,jj)
+            ENDIF
+         END DO
+      END DO
+#else
+      DO jj= j1 ,j2
+         DO ji = i1, i2
+            IF( vmask(ji,jj,1) == 0. ) THEN
+               tabres(ji,jj) = -9999.
+            ELSE
+               tabres(ji,jj) = e1v(ji,jj) * v_ice(ji,jj)
+            ENDIF
+         END DO
+      END DO
+#endif
+   END SUBROUTINE interp_v_ice
+
+
+   SUBROUTINE interp_adv_ice( tabres, i1, i2, j1, j2 )
+      !!-----------------------------------------------------------------------
+      !!                    *** ROUTINE interp_adv_ice ***                           
+      !!
+      !! ** Purpose : fill an array with  ice variables
+      !!              to be advected
+      !!              put -9999 where no ice for correct extrapolation             
+      !!-----------------------------------------------------------------------
+      INTEGER, INTENT(in) :: i1, i2, j1, j2
+      REAL(wp), DIMENSION(i1:i2,j1:j2,7), INTENT(inout) :: tabres
+      !!
+      INTEGER :: ji, jj, jk
+      !!-----------------------------------------------------------------------
+      !
+      DO jj=j1,j2
+         DO ji=i1,i2
+            IF( tms(ji,jj) == 0. ) THEN
+               tabres(ji,jj,:) = -9999. 
+            ELSE
+               tabres(ji,jj, 1) = frld  (ji,jj)
+               tabres(ji,jj, 2) = hicif (ji,jj)
+               tabres(ji,jj, 3) = hsnif (ji,jj)
+               tabres(ji,jj, 4) = tbif  (ji,jj,1)
+               tabres(ji,jj, 5) = tbif  (ji,jj,2)
+               tabres(ji,jj, 6) = tbif  (ji,jj,3)
+               tabres(ji,jj, 7) = qstoif(ji,jj)
+            ENDIF
+         END DO
+      END DO
+      !
+   END SUBROUTINE interp_adv_ice
+
+#else
+CONTAINS
+   SUBROUTINE agrif_lim2_interp_empty
+      !!---------------------------------------------
+      !!   *** ROUTINE agrif_lim2_interp_empty ***
+      !!---------------------------------------------
+      WRITE(*,*)  'agrif_lim2_interp : You should not have seen this print! error?'
+   END SUBROUTINE agrif_lim2_interp_empty
+#endif
+END MODULE agrif_lim2_interp
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_lim2_update.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_lim2_update.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_lim2_update.F90	(revision 3680)
@@ -0,0 +1,267 @@
+#define TWO_WAY
+
+MODULE agrif_lim2_update
+   !!======================================================================
+   !!                       ***  MODULE agrif_lim2_update ***
+   !! Nesting module :  update surface ocean boundary condition over ice
+   !!                   from a child grif
+   !! Sea-Ice model  :  LIM 2.0 Sea ice model time-stepping
+   !!======================================================================
+   !! History :  2.0   !  04-2008  (F. Dupont)  initial version
+   !!            3.4   !  08-2012  (R. Benshila, C. Herbaut) update and EVP
+   !!----------------------------------------------------------------------
+#if defined key_agrif && defined key_lim2
+   !!----------------------------------------------------------------------
+   !!   'key_lim2'  :                                 LIM 2.0 sea-ice model
+   !!   'key_agrif' :                                 AGRIF library 
+   !!----------------------------------------------------------------------
+   !!   agrif_update_lim2  : update sea-ice model on boundaries or total
+   !!                        sea-ice area for velocities and ice properties
+   !!   update_adv_ice     : sea-ice properties
+   !!   update_u_ice       : zonal ice velocity
+   !!   update_v_ice       : meridional ice velocity
+   !!----------------------------------------------------------------------
+   USE ice_2
+   USE dom_ice_2
+   USE sbc_oce
+   USE dom_oce
+   USE agrif_oce
+   USE agrif_ice 
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC agrif_update_lim2
+
+   !!----------------------------------------------------------------------
+   !! NEMO/NST 3.4 , LOCEAN-IPSL (2012)
+   !! $Id$
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE agrif_update_lim2 ( kt )
+      !!----------------------------------------------------------------------
+      !!                     *** ROUTINE agrif_update_lim2 ***
+      !! ** Method  :   Call the hydrostaticupdate pressure at the boundary or
+      !!                the entire domain 
+      !!
+      !! ** Action : - Update (u_ice,v_ice) and ice tracers
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) :: kt
+      !!
+      REAL(wp), DIMENSION(jpi,jpj)  :: zvel
+      REAL(wp), DIMENSION(jpi,jpj,7):: zadv
+      !!----------------------------------------------------------------------
+      !
+      IF((Agrif_NbStepint() .NE. (Agrif_irhot()-1)).AND.(kt /= 0)) RETURN
+
+      Agrif_UseSpecialValueInUpdate = .TRUE.
+      Agrif_SpecialValueFineGrid = 0.
+
+# if defined TWO_WAY
+      IF( MOD(nbcline,nbclineupdate) == 0) THEN
+         CALL Agrif_Update_Variable( zadv , adv_ice_id , procname = update_adv_ice  )
+         CALL Agrif_Update_Variable( zvel , u_ice_id   , procname = update_u_ice    )
+         CALL Agrif_Update_Variable( zvel , v_ice_id   , procname = update_v_ice    )
+      ELSE
+         CALL Agrif_Update_Variable( zadv , adv_ice_id , locupdate=(/0,2/), procname = update_adv_ice  )
+         CALL Agrif_Update_Variable( zvel , u_ice_id   , locupdate=(/0,1/), procname = update_u_ice    )
+         CALL Agrif_Update_Variable( zvel , v_ice_id   , locupdate=(/0,1/), procname = update_v_ice    )
+      ENDIF
+# endif
+      !
+   END SUBROUTINE agrif_update_lim2
+
+
+   SUBROUTINE update_adv_ice( tabres, i1, i2, j1, j2, before )
+      !!-----------------------------------------------------------------------
+      !!                        *** ROUTINE update_adv_ice ***
+      !! ** Method  : Compute the mass properties on the fine grid and recover
+      !!              the properties per mass on the coarse grid
+      !!-----------------------------------------------------------------------
+      INTEGER, INTENT(in) :: i1, i2, j1, j2
+      REAL(wp), DIMENSION(i1:i2,j1:j2,7), INTENT(inout) :: tabres
+      LOGICAL, INTENT(in) :: before
+      !!
+      INTEGER :: ji, jj
+      REAL(wp) :: zrhox, zrhoy
+      REAL(wp) :: z1_area
+      !!-----------------------------------------------------------------------
+      !
+      IF( before ) THEN
+         zrhox = Agrif_Rhox()
+         zrhoy = Agrif_Rhoy()
+         DO jj=j1,j2
+            DO ji=i1,i2
+               tabres(ji,jj, 1) = frld  (ji,jj  ) * area(ji,jj)
+               tabres(ji,jj, 2) = hicif (ji,jj  ) * area(ji,jj)
+               tabres(ji,jj, 3) = hsnif (ji,jj  ) * area(ji,jj)
+               tabres(ji,jj, 4) = tbif  (ji,jj,1) * area(ji,jj)
+               tabres(ji,jj, 5) = tbif  (ji,jj,2) * area(ji,jj)
+               tabres(ji,jj, 6) = tbif  (ji,jj,3) * area(ji,jj)
+               tabres(ji,jj, 7) = qstoif(ji,jj  ) * area(ji,jj)
+            END DO
+         END DO
+         tabres = zrhox * zrhoy * tabres
+      ELSE
+         DO jj=j1,j2
+            DO ji=i1,i2
+               z1_area = 1. / area(ji,jj) * tms(ji,jj)
+               frld  (ji,jj)   = tabres(ji,jj, 1) * z1_area
+               hicif (ji,jj)   = tabres(ji,jj, 2) * z1_area
+               hsnif (ji,jj)   = tabres(ji,jj, 3) * z1_area
+               tbif  (ji,jj,1) = tabres(ji,jj, 4) * z1_area
+               tbif  (ji,jj,2) = tabres(ji,jj, 5) * z1_area
+               tbif  (ji,jj,3) = tabres(ji,jj, 6) * z1_area
+               qstoif(ji,jj)   = tabres(ji,jj, 7) * z1_area
+            END DO
+         END DO
+      ENDIF
+      !
+   END SUBROUTINE update_adv_ice
+
+
+# if defined key_lim2_vp
+   SUBROUTINE update_u_ice( tabres, i1, i2, j1, j2, before )
+      !!-----------------------------------------------------------------------
+      !!                        *** ROUTINE update_u_ice ***
+      !! ** Method  : Update the fluxes and recover the properties (B-grid)
+      !!-----------------------------------------------------------------------
+      INTEGER, INTENT(in) :: i1, i2, j1, j2
+      REAL(wp), DIMENSION(i1:i2,j1:j2), INTENT(inout) :: tabres
+      LOGICAL, INTENT(in) :: before
+      !!
+      INTEGER :: ji, jj
+      REAL(wp) :: zrhoy
+      !!-----------------------------------------------------------------------
+      !
+      IF( before ) THEN
+         zrhoy = Agrif_Rhoy()
+         DO jj=MAX(j1,2),j2
+            DO ji=MAX(i1,2),i2
+               tabres(ji,jj) = e2f(ji-1,jj-1) * u_ice(ji,jj)
+            END DO
+         END DO
+         tabres = zrhoy * tabres
+      ELSE
+         DO jj= MAX(j1,2),j2
+            DO ji=MAX(i1,2),i2
+               u_ice(ji,jj) = tabres(ji,jj) / (e2f(ji-1,jj-1))
+               u_ice(ji,jj) = u_ice(ji,jj) * tmu(ji,jj)
+            END DO
+         END DO
+      ENDIF
+      !
+   END SUBROUTINE update_u_ice
+
+
+   SUBROUTINE update_v_ice( tabres, i1, i2, j1, j2, before )
+      !!-----------------------------------------------------------------------
+      !!                    *** ROUTINE update_v_ice ***
+      !! ** Method  : Update the fluxes and recover the properties (B-grid)
+      !!-----------------------------------------------------------------------
+      INTEGER, INTENT(in) :: i1,i2,j1,j2
+      REAL(wp), DIMENSION(i1:i2,j1:j2),  INTENT(inout) :: tabres
+      LOGICAL, INTENT(in) :: before
+      !!
+      INTEGER :: ji, jj
+      REAL(wp) :: zrhox
+      !!-----------------------------------------------------------------------
+      !
+      IF( before ) THEN
+         zrhox = Agrif_Rhox()
+         DO jj=MAX(j1,2),j2
+            DO ji=MAX(i1,2),i2
+               tabres(ji,jj) = e1f(ji-1,jj-1) * v_ice(ji,jj)
+            END DO
+         END DO
+         tabres = zrhox * tabres
+      ELSE
+         DO jj=j1,j2
+            DO ji=i1,i2
+               v_ice(ji,jj) = tabres(ji,jj) / (e1f(ji-1,jj-1))
+               v_ice(ji,jj) = v_ice(ji,jj) * tmu(ji,jj)
+            END DO
+         END DO
+      ENDIF
+      !
+   END SUBROUTINE update_v_ice
+# else
+   SUBROUTINE update_u_ice( tabres, i1, i2, j1, j2, before )
+      !!-----------------------------------------------------------------------
+      !!                        *** ROUTINE update_u_ice ***
+      !! ** Method  : Update the fluxes and recover the properties (C-grid)
+      !!-----------------------------------------------------------------------
+      INTEGER, INTENT(in) :: i1, i2, j1, j2
+      REAL(wp), DIMENSION(i1:i2,j1:j2), INTENT(inout) :: tabres
+      LOGICAL, INTENT(in) :: before
+      !!
+      INTEGER :: ji, jj
+      REAL(wp) :: zrhoy
+      !!-----------------------------------------------------------------------
+      !
+      IF( before ) THEN
+         zrhoy = Agrif_Rhoy()
+         DO jj=MAX(j1,2),j2
+            DO ji=MAX(i1,2),i2
+               tabres(ji,jj) = e2u(ji,jj) * u_ice(ji,jj)
+            END DO
+         END DO
+         tabres = zrhoy * tabres
+      ELSE
+         DO jj=MAX(j1,2),j2
+            DO ji=MAX(i1,2),i2
+               u_ice(ji,jj) = tabres(ji,jj) / (e2u(ji,jj))
+               u_ice(ji,jj) = u_ice(ji,jj) * tmu(ji,jj)
+            END DO
+         END DO
+      ENDIF
+      ! 
+   END SUBROUTINE update_u_ice
+
+
+   SUBROUTINE update_v_ice( tabres, i1, i2, j1, j2, before )
+      !!-----------------------------------------------------------------------
+      !!                    *** ROUTINE update_v_ice ***
+      !! ** Method  : Update the fluxes and recover the properties (C-grid)
+      !!-----------------------------------------------------------------------
+      INTEGER, INTENT(in) :: i1,i2,j1,j2
+      REAL(wp), DIMENSION(i1:i2,j1:j2),  INTENT(inout) :: tabres
+      LOGICAL, INTENT(in) :: before
+      !!
+      INTEGER :: ji, jj
+      REAL(wp) :: zrhox
+      !!-----------------------------------------------------------------------
+      !
+      IF( before ) THEN
+         zrhox = Agrif_Rhox()
+         DO jj=MAX(j1,2),j2
+            DO ji=MAX(i1,2),i2
+               tabres(ji,jj) = e1v(ji,jj) * v_ice(ji,jj)
+            END DO
+         END DO
+         tabres = zrhox * tabres
+      ELSE
+         DO jj=j1,j2
+            DO ji=i1,i2
+               v_ice(ji,jj) = tabres(ji,jj) / (e1v(ji,jj))
+               v_ice(ji,jj) = v_ice(ji,jj) * tmv(ji,jj)
+            END DO
+         END DO
+      ENDIF
+      !
+   END SUBROUTINE update_v_ice
+# endif
+
+#else
+CONTAINS
+   SUBROUTINE agrif_lim2_update_empty
+      !!---------------------------------------------
+      !!   *** ROUTINE agrif_lim2_update_empty ***
+      !!---------------------------------------------
+      WRITE(*,*)  'agrif_lim2_update : You should not have seen this print! error?'
+   END SUBROUTINE agrif_lim2_update_empty
+#endif
+END MODULE agrif_lim2_update
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_oce.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_oce.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_oce.F90	(revision 3680)
@@ -25,4 +25,5 @@
 
    !                                              !!! OLD namelist names
+   INTEGER , PUBLIC ::   nbcline = 0               !: update counter
    INTEGER , PUBLIC ::   nbclineupdate             !: update frequency 
    REAL(wp), PUBLIC ::   visc_tra                  !: sponge coeff. for tracers
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_opa_sponge.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_opa_sponge.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_opa_sponge.F90	(revision 3680)
@@ -1,3 +1,3 @@
-#define SPONGE
+#define SPONGE && define SPONGE_TOP
 
 Module agrif_opa_sponge
@@ -13,6 +13,8 @@
    PRIVATE
 
-   PUBLIC Agrif_Sponge_Tra, Agrif_Sponge_Dyn, interptsn, interpun, interpvn
-
+   PUBLIC Agrif_Sponge, Agrif_Sponge_Tra, Agrif_Sponge_Dyn, interptsn, interpun, interpvn
+
+  !! * Substitutions
+#  include "domzgr_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/NST 3.3 , NEMO Consortium (2010)
@@ -27,11 +29,8 @@
       !!   *** ROUTINE Agrif_Sponge_Tra ***
       !!---------------------------------------------
-#include "domzgr_substitute.h90"
       !!
       INTEGER :: ji,jj,jk,jn
-      INTEGER :: spongearea
       REAL(wp) :: timecoeff
       REAL(wp) :: ztsa, zabe1, zabe2, zbtr
-      REAL(wp), POINTER, DIMENSION(:,:    ) :: localviscsponge
       REAL(wp), POINTER, DIMENSION(:,:    ) :: ztu, ztv
       REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztab
@@ -39,5 +38,5 @@
 
 #if defined SPONGE
-      CALL wrk_alloc( jpi, jpj, localviscsponge, ztu, ztv )
+      CALL wrk_alloc( jpi, jpj, ztu, ztv )
       CALL wrk_alloc( jpi, jpj, jpk, jpts, ztab, tsbdiff  )
 
@@ -52,72 +51,5 @@
       tsbdiff(:,:,:,:) = tsb(:,:,:,:) - ztab(:,:,:,:)
 
-      spongearea = 2 + 2 * Agrif_irhox()
-
-      localviscsponge = 0.
-      
-      IF (.NOT. spongedoneT) THEN
-         spe1ur(:,:) = 0.
-         spe2vr(:,:) = 0.
-
-      IF ((nbondi == -1).OR.(nbondi == 2)) THEN
-         DO ji = 2, spongearea
-            localviscsponge(ji,:) = visc_tra * (spongearea-ji)/real(spongearea-2)
-         ENDDO
-	 
-	 spe1ur(2:spongearea-1,:)=0.5 * (localviscsponge(2:spongearea-1,:) + localviscsponge(3:spongearea,:)) &
-	       * e2u(2:spongearea-1,:) / e1u(2:spongearea-1,:)
-
-         spe2vr(2:spongearea,1:jpjm1) = 0.5 * (localviscsponge(2:spongearea,1:jpjm1) + &
-	          localviscsponge(2:spongearea,2:jpj)) &
-	        * e1v(2:spongearea,1:jpjm1) / e2v(2:spongearea,1:jpjm1)
-      ENDIF
-
-      IF ((nbondi == 1).OR.(nbondi == 2)) THEN
-         DO ji = nlci-spongearea + 1,nlci-1
-            localviscsponge(ji,:) = visc_tra * (ji - (nlci-spongearea+1))/real(spongearea-2)
-         ENDDO
-	 
-	 spe1ur(nlci-spongearea + 1:nlci-2,:)=0.5 * (localviscsponge(nlci-spongearea + 1:nlci-2,:) + &
-	        localviscsponge(nlci-spongearea + 2:nlci-1,:)) &
-	       * e2u(nlci-spongearea + 1:nlci-2,:) / e1u(nlci-spongearea + 1:nlci-2,:)
-
-         spe2vr(nlci-spongearea + 1:nlci-1,1:jpjm1) = 0.5 * (localviscsponge(nlci-spongearea + 1:nlci-1,1:jpjm1) &
-	           + localviscsponge(nlci-spongearea + 1:nlci-1,2:jpj)) &
-	        * e1v(nlci-spongearea + 1:nlci-1,1:jpjm1) / e2v(nlci-spongearea + 1:nlci-1,1:jpjm1)
-      ENDIF
-
-
-      IF ((nbondj == -1).OR.(nbondj == 2)) THEN
-         DO jj = 2, spongearea
-            localviscsponge(:,jj) = visc_tra * (spongearea-jj)/real(spongearea-2)
-         ENDDO
-	 
-	 spe1ur(1:jpim1,2:spongearea)=0.5 * (localviscsponge(1:jpim1,2:spongearea) + &
-	        localviscsponge(2:jpi,2:spongearea)) &
-	       * e2u(1:jpim1,2:spongearea) / e1u(1:jpim1,2:spongearea)
-
-         spe2vr(:,2:spongearea-1) = 0.5 * (localviscsponge(:,2:spongearea-1) + &
-	          localviscsponge(:,3:spongearea)) &
-	        * e1v(:,2:spongearea-1) / e2v(:,2:spongearea-1)
-      ENDIF
-
-      IF ((nbondj == 1).OR.(nbondj == 2)) THEN
-         DO jj = nlcj-spongearea + 1,nlcj-1
-            localviscsponge(:,jj) = visc_tra * (jj - (nlcj-spongearea+1))/real(spongearea-2)
-         ENDDO
-	 
-	 spe1ur(1:jpim1,nlcj-spongearea + 1:nlcj-1)=0.5 * (localviscsponge(1:jpim1,nlcj-spongearea + 1:nlcj-1) + &
-	         localviscsponge(2:jpi,nlcj-spongearea + 1:nlcj-1)) &
-	       * e2u(1:jpim1,nlcj-spongearea + 1:nlcj-1) / e1u(1:jpim1,nlcj-spongearea + 1:nlcj-1)
-
-         spe2vr(:,nlcj-spongearea + 1:nlcj-2) = 0.5 * (localviscsponge(:,nlcj-spongearea + 1:nlcj-2) + &
-	         localviscsponge(:,nlcj-spongearea + 2:nlcj-1)) &
-	        * e1v(:,nlcj-spongearea + 1:nlcj-2) / e2v(:,nlcj-spongearea + 1:nlcj-2)
-      ENDIF
-      
-         spbtr2(:,:) = 1. / ( e1t(:,:) * e2t(:,:))
-
-         spongedoneT = .TRUE.
-      ENDIF
+      CALL Agrif_Sponge
 
       DO jn = 1, jpts
@@ -147,5 +79,5 @@
       ENDDO
 
-      CALL wrk_dealloc( jpi, jpj, localviscsponge, ztu, ztv )
+      CALL wrk_dealloc( jpi, jpj, ztu, ztv )
       CALL wrk_dealloc( jpi, jpj, jpk, jpts, ztab, tsbdiff  )
 #endif
@@ -157,11 +89,8 @@
       !!   *** ROUTINE Agrif_Sponge_dyn ***
       !!---------------------------------------------
-#include "domzgr_substitute.h90"
       !!
       INTEGER :: ji,jj,jk
-      INTEGER :: spongearea
       REAL(wp) :: timecoeff
       REAL(wp) :: ze2u, ze1v, zua, zva, zbtr
-      REAL(wp), POINTER, DIMENSION(:,:) :: localviscsponge
       REAL(wp), POINTER, DIMENSION(:,:,:) :: ubdiff, vbdiff
       REAL(wp), POINTER, DIMENSION(:,:,:) :: rotdiff, hdivdiff
@@ -169,5 +98,4 @@
 
 #if defined SPONGE
-      CALL wrk_alloc( jpi, jpj, localviscsponge )
       CALL wrk_alloc( jpi, jpj, jpk, ztab, ubdiff, vbdiff, rotdiff, hdivdiff )
 
@@ -180,5 +108,5 @@
       Agrif_UseSpecialValue = .FALSE.
 
-      ubdiff(:,:,:) = (ub(:,:,:) - ztab(:,:,:))*umask(:,:,:)
+      ubdiff(:,:,:) = ( ub(:,:,:) - ztab(:,:,:) ) * umask(:,:,:)
 
       ztab = 0.e0
@@ -188,74 +116,11 @@
       Agrif_UseSpecialValue = .FALSE.
 
-      vbdiff(:,:,:) = (vb(:,:,:) - ztab(:,:,:))*vmask(:,:,:)
-
-      spongearea = 2 + 2 * Agrif_irhox()
-
-      localviscsponge = 0.
-
-      IF (.NOT. spongedoneU) THEN
-         spe1ur2(:,:) = 0.
-         spe2vr2(:,:) = 0.
-
-      IF ((nbondi == -1).OR.(nbondi == 2)) THEN
-         DO ji = 2, spongearea
-            localviscsponge(ji,:) = visc_dyn * (spongearea-ji)/real(spongearea-2)
-         ENDDO
-	 
-	 spe1ur2(2:spongearea-1,:)=0.5 * (localviscsponge(2:spongearea-1,:) + localviscsponge(3:spongearea,:))
-
-         spe2vr2(2:spongearea,1:jpjm1) = 0.5 * (localviscsponge(2:spongearea,1:jpjm1) + &
-	          localviscsponge(2:spongearea,2:jpj))
-      ENDIF
-
-      IF ((nbondi == 1).OR.(nbondi == 2)) THEN
-         DO ji = nlci-spongearea + 1,nlci-1
-            localviscsponge(ji,:) = visc_dyn * (ji - (nlci-spongearea+1))/real(spongearea-2)
-         ENDDO
-	 
-	 spe1ur2(nlci-spongearea + 1:nlci-2,:)=0.5 * (localviscsponge(nlci-spongearea + 1:nlci-2,:) + &
-	        localviscsponge(nlci-spongearea + 2:nlci-1,:))
-
-         spe2vr2(nlci-spongearea + 1:nlci-1,1:jpjm1) = 0.5 * (localviscsponge(nlci-spongearea + 1:nlci-1,1:jpjm1) &
-	           + localviscsponge(nlci-spongearea + 1:nlci-1,2:jpj))
-      ENDIF
-
-
-      IF ((nbondj == -1).OR.(nbondj == 2)) THEN
-         DO jj = 2, spongearea
-            localviscsponge(:,jj) = visc_dyn * (spongearea-jj)/real(spongearea-2)
-         ENDDO
-	 
-	 spe1ur2(1:jpim1,2:spongearea)=0.5 * (localviscsponge(1:jpim1,2:spongearea) + &
-	        localviscsponge(2:jpi,2:spongearea))
-
-         spe2vr2(:,2:spongearea-1) = 0.5 * (localviscsponge(:,2:spongearea-1) + &
-	          localviscsponge(:,3:spongearea))
-      ENDIF
-
-      IF ((nbondj == 1).OR.(nbondj == 2)) THEN
-         DO jj = nlcj-spongearea + 1,nlcj-1
-            localviscsponge(:,jj) = visc_dyn * (jj - (nlcj-spongearea+1))/real(spongearea-2)
-         ENDDO
-	 
-	 spe1ur2(1:jpim1,nlcj-spongearea + 1:nlcj-1)=0.5 * (localviscsponge(1:jpim1,nlcj-spongearea + 1:nlcj-1) + &
-	         localviscsponge(2:jpi,nlcj-spongearea + 1:nlcj-1))
-
-         spe2vr2(:,nlcj-spongearea + 1:nlcj-2) = 0.5 * (localviscsponge(:,nlcj-spongearea + 1:nlcj-2) + &
-	         localviscsponge(:,nlcj-spongearea + 2:nlcj-1))
-      ENDIF
-
-         spongedoneU = .TRUE.
-	 
-	  spbtr3(:,:) = 1./( e1f(:,:) * e2f(:,:))
-      ENDIF
-      
-      IF (.NOT. spongedoneT) THEN
-        spbtr2(:,:) = 1. / ( e1t(:,:) * e2t(:,:))      
-      ENDIF
-      
-      DO jk=1,jpkm1
-      ubdiff(:,:,jk) = ubdiff(:,:,jk) * spe1ur2(:,:)
-      vbdiff(:,:,jk) = vbdiff(:,:,jk) * spe2vr2(:,:)
+      vbdiff(:,:,:) = ( vb(:,:,:) - ztab(:,:,:) ) * vmask(:,:,:)
+
+      CALL Agrif_Sponge
+
+      DO jk = 1,jpkm1
+         ubdiff(:,:,jk) = ubdiff(:,:,jk) * spe1ur2(:,:)
+         vbdiff(:,:,jk) = vbdiff(:,:,jk) * spe2vr2(:,:)
       ENDDO
       
@@ -272,11 +137,8 @@
             DO ji = 2, jpim1   ! vector opt.
                zbtr = spbtr2(ji,jj) / fse3t(ji,jj,jk)
-               hdivdiff(ji,jj,jk) =   &
-                  (  e2u(ji,jj)*fse3u(ji,jj,jk) * & 
-                  ubdiff(ji,jj,jk) - e2u(ji-1,jj  )* &
-                  fse3u(ji-1,jj  ,jk)  * ubdiff(ji-1,jj  ,jk)       &
-                  + e1v(ji,jj)*fse3v(ji,jj,jk) * &
-                  vbdiff(ji,jj,jk) - e1v(ji  ,jj-1)* &
-                  fse3v(ji  ,jj-1,jk)  * vbdiff(ji  ,jj-1,jk)  ) * zbtr
+               hdivdiff(ji,jj,jk) =  (  e2u(ji  ,jj  ) * fse3u(ji  ,jj  ,jk) * ubdiff(ji  ,jj  ,jk)     &
+                  &                   - e2u(ji-1,jj  ) * fse3u(ji-1,jj  ,jk) * ubdiff(ji-1,jj  ,jk)     &
+                  &                   + e1v(ji  ,jj  ) * fse3v(ji  ,jj  ,jk) * vbdiff(ji  ,jj  ,jk)     &
+                  &                   - e1v(ji  ,jj-1) * fse3v(ji  ,jj-1,jk) * vbdiff(ji  ,jj-1,jk)  ) * zbtr
             END DO
          END DO
@@ -286,6 +148,6 @@
                zbtr = spbtr3(ji,jj) * fse3f(ji,jj,jk)
                rotdiff(ji,jj,jk) = (  e2v(ji+1,jj  ) * vbdiff(ji+1,jj  ,jk) - e2v(ji,jj) * vbdiff(ji,jj,jk)    &
-                  &              - e1u(ji  ,jj+1) * ubdiff(ji  ,jj+1,jk) + e1u(ji,jj) * ubdiff(ji,jj,jk)  ) &
-                  &           * fmask(ji,jj,jk) * zbtr
+                  &                 - e1u(ji  ,jj+1) * ubdiff(ji  ,jj+1,jk) + e1u(ji,jj) * ubdiff(ji,jj,jk)  ) &
+                  &               * fmask(ji,jj,jk) * zbtr
             END DO
          END DO
@@ -298,15 +160,10 @@
          DO jj = 2, jpjm1
             DO ji = 2, jpim1   ! vector opt.
-               ze2u = rotdiff (ji,jj,jk)
-               ze1v = hdivdiff(ji,jj,jk)
                ! horizontal diffusive trends
-               zua = - ( ze2u - rotdiff (ji,jj-1,jk)) / ( e2u(ji,jj) * fse3u(ji,jj,jk) )   &
-                  + ( hdivdiff(ji+1,jj,jk) - ze1v      &
-                  ) / e1u(ji,jj)
-
-               zva = + ( ze2u - rotdiff (ji-1,jj,jk)) / ( e1v(ji,jj) * fse3v(ji,jj,jk) )   &
-                  + ( hdivdiff(ji,jj+1,jk) - ze1v    &
-                  ) / e2v(ji,jj)
-
+               zua = - ( rotdiff (ji  ,jj,jk) - rotdiff (ji,jj-1,jk) ) / ( e2u(ji,jj) * fse3u(ji,jj,jk) )   &
+                     + ( hdivdiff(ji+1,jj,jk) - hdivdiff(ji,jj  ,jk) ) / e1u(ji,jj)
+
+               zva = + ( rotdiff (ji,jj  ,jk) - rotdiff (ji-1,jj,jk) ) / ( e1v(ji,jj) * fse3v(ji,jj,jk) )   &
+                     + ( hdivdiff(ji,jj+1,jk) - hdivdiff(ji  ,jj,jk) ) / e2v(ji,jj)
                ! add it to the general momentum trends
                ua(ji,jj,jk) = ua(ji,jj,jk) + zua
@@ -317,17 +174,130 @@
       END DO                                           !   End of slab
       !                                                ! ===============
-      CALL wrk_dealloc( jpi, jpj, localviscsponge )
       CALL wrk_dealloc( jpi, jpj, jpk, ztab, ubdiff, vbdiff, rotdiff, hdivdiff )
-
 #endif
 
    END SUBROUTINE Agrif_Sponge_dyn
 
+   SUBROUTINE Agrif_Sponge
+      !!---------------------------------------------
+      !!   *** ROUTINE  Agrif_Sponge ***
+      !!---------------------------------------------
+      INTEGER  :: ji,jj,jk
+      INTEGER  :: ispongearea, ilci, ilcj
+      REAL(wp) :: z1spongearea
+      REAL(wp), POINTER, DIMENSION(:,:) :: zlocalviscsponge
+
+#if defined SPONGE || defined SPONGE_TOP
+
+      CALL wrk_alloc( jpi, jpj, zlocalviscsponge )
+
+      ispongearea  = 2 + 2 * Agrif_irhox()
+      ilci = nlci - ispongearea
+      ilcj = nlcj - ispongearea 
+      z1spongearea = 1._wp / REAL( ispongearea - 2 )
+      spbtr2(:,:) = 1. / ( e1t(:,:) * e2t(:,:) )
+
+      ! Tracers
+      IF( .NOT. spongedoneT ) THEN
+         zlocalviscsponge(:,:) = 0.
+         spe1ur(:,:) = 0.
+         spe2vr(:,:) = 0.
+
+         IF( (nbondi == -1) .OR. (nbondi == 2) ) THEN
+            DO ji = 2, ispongearea
+               zlocalviscsponge(ji,:) = visc_tra * ( ispongearea-ji ) * z1spongearea
+            ENDDO
+            spe1ur(2:ispongearea-1,:      ) = 0.5 * ( zlocalviscsponge(2:ispongearea-1,:      ) + zlocalviscsponge(3:ispongearea,:    ) ) &
+               &                         * e2u(2:ispongearea-1,:      ) / e1u(2:ispongearea-1,:      )
+            spe2vr(2:ispongearea  ,1:jpjm1) = 0.5 * ( zlocalviscsponge(2:ispongearea  ,1:jpjm1) + zlocalviscsponge(2:ispongearea,2:jpj) ) &
+               &                         * e1v(2:ispongearea  ,1:jpjm1) / e2v(2:ispongearea  ,1:jpjm1)
+         ENDIF
+
+         IF( (nbondi == 1) .OR. (nbondi == 2) ) THEN
+            DO ji = ilci+1,nlci-1
+               zlocalviscsponge(ji,:) = visc_tra * (ji - (ilci+1) ) * z1spongearea
+            ENDDO
+  
+            spe1ur(ilci+1:nlci-2,:      ) = 0.5 * (  zlocalviscsponge(ilci+1:nlci-2,:) + zlocalviscsponge(ilci+2:nlci-1,:) )  &
+               &                                   * e2u(ilci+1:nlci-2,:) / e1u(ilci+1:nlci-2,:)
+
+            spe2vr(ilci+1:nlci-1,1:jpjm1) = 0.5 * (  zlocalviscsponge(ilci+1:nlci-1,1:jpjm1) + zlocalviscsponge(ilci+1:nlci-1,2:jpj  )  ) & 
+               &                                   * e1v(ilci+1:nlci-1,1:jpjm1) / e2v(ilci+1:nlci-1,1:jpjm1)
+         ENDIF
+
+         IF( (nbondj == -1) .OR. (nbondj == 2) ) THEN
+            DO jj = 2, ispongearea
+               zlocalviscsponge(:,jj) = visc_tra * ( ispongearea-jj ) * z1spongearea
+            ENDDO
+            spe1ur(1:jpim1,2:ispongearea  ) = 0.5 * ( zlocalviscsponge(1:jpim1,2:ispongearea) + zlocalviscsponge(2:jpi,2:ispongearea) ) &
+               &                                * e2u(1:jpim1,2:ispongearea) / e1u(1:jpim1,2:ispongearea)
+   
+            spe2vr(:      ,2:ispongearea-1) = 0.5 * ( zlocalviscsponge(:,2:ispongearea-1)     + zlocalviscsponge(:,3:ispongearea)     ) &
+               &                                  * e1v(:,2:ispongearea-1) / e2v(:,2:ispongearea-1)
+         ENDIF
+
+         IF( (nbondj == 1) .OR. (nbondj == 2) ) THEN
+            DO jj = ilcj+1,nlcj-1
+               zlocalviscsponge(:,jj) = visc_tra * (jj - (ilcj+1) ) * z1spongearea
+            ENDDO
+            spe1ur(1:jpim1,ilcj+1:nlcj-1) = 0.5 * ( zlocalviscsponge(1:jpim1,ilcj+1:nlcj-1) + zlocalviscsponge(2:jpi,ilcj+1:nlcj-1) ) &
+               &                                * e2u(1:jpim1,ilcj+1:nlcj-1) / e1u(1:jpim1,ilcj+1:nlcj-1)
+            spe2vr(:      ,ilcj+1:nlcj-2) = 0.5 * ( zlocalviscsponge(:,ilcj+1:nlcj-2      ) + zlocalviscsponge(:,ilcj+2:nlcj-1)     ) &
+               &                                * e1v(:,ilcj+1:nlcj-2) / e2v(:,ilcj+1:nlcj-2)
+         ENDIF
+         spongedoneT = .TRUE.
+      ENDIF
+
+      ! Dynamics
+      IF( .NOT. spongedoneU ) THEN
+         zlocalviscsponge(:,:) = 0.
+         spe1ur2(:,:) = 0.
+         spe2vr2(:,:) = 0.
+
+         IF( (nbondi == -1) .OR. (nbondi == 2) ) THEN
+            DO ji = 2, ispongearea
+               zlocalviscsponge(ji,:) = visc_dyn * ( ispongearea-ji ) * z1spongearea
+            ENDDO
+            spe1ur2(2:ispongearea-1,:      ) = 0.5 * ( zlocalviscsponge(2:ispongearea-1,:      ) + zlocalviscsponge(3:ispongearea,:    ) )
+            spe2vr2(2:ispongearea  ,1:jpjm1) = 0.5 * ( zlocalviscsponge(2:ispongearea  ,1:jpjm1) + zlocalviscsponge(2:ispongearea,2:jpj) ) 
+         ENDIF
+
+         IF( (nbondi == 1) .OR. (nbondi == 2) ) THEN
+            DO ji = ilci+1,nlci-1
+               zlocalviscsponge(ji,:) = visc_dyn * (ji - (ilci+1) ) * z1spongearea
+            ENDDO
+            spe1ur2(ilci+1:nlci-2,:      ) = 0.5 * (  zlocalviscsponge(ilci+1:nlci-2,:) + zlocalviscsponge(ilci+2:nlci-1,:) )  
+            spe2vr2(ilci+1:nlci-1,1:jpjm1) = 0.5 * (  zlocalviscsponge(ilci+1:nlci-1,1:jpjm1) + zlocalviscsponge(ilci+1:nlci-1,2:jpj  )  ) 
+         ENDIF
+
+         IF( (nbondj == -1) .OR. (nbondj == 2) ) THEN
+            DO jj = 2, ispongearea
+               zlocalviscsponge(:,jj) = visc_dyn * ( ispongearea-jj ) * z1spongearea
+            ENDDO
+            spe1ur2(1:jpim1,2:ispongearea  ) = 0.5 * ( zlocalviscsponge(1:jpim1,2:ispongearea) + zlocalviscsponge(2:jpi,2:ispongearea) ) 
+            spe2vr2(:      ,2:ispongearea-1) = 0.5 * ( zlocalviscsponge(:,2:ispongearea-1)     + zlocalviscsponge(:,3:ispongearea)     )
+         ENDIF
+
+         IF( (nbondj == 1) .OR. (nbondj == 2) ) THEN
+            DO jj = ilcj+1,nlcj-1
+               zlocalviscsponge(:,jj) = visc_dyn * (jj - (ilcj+1) ) * z1spongearea
+            ENDDO
+            spe1ur2(1:jpim1,ilcj+1:nlcj-1) = 0.5 * ( zlocalviscsponge(1:jpim1,ilcj+1:nlcj-1) + zlocalviscsponge(2:jpi,ilcj+1:nlcj-1) ) 
+            spe2vr2(:      ,ilcj+1:nlcj-2) = 0.5 * ( zlocalviscsponge(:,ilcj+1:nlcj-2      ) + zlocalviscsponge(:,ilcj+2:nlcj-1)     )
+         ENDIF
+         spongedoneU = .TRUE.
+         spbtr3(:,:) = 1. / ( e1f(:,:) * e2f(:,:) )
+      ENDIF
+      !
+      CALL wrk_dealloc( jpi, jpj, zlocalviscsponge )
+      !
+#endif
+
+   END SUBROUTINE Agrif_Sponge
+
    SUBROUTINE interptsn(tabres,i1,i2,j1,j2,k1,k2,n1,n2)
       !!---------------------------------------------
       !!   *** ROUTINE interptsn ***
       !!---------------------------------------------
-#  include "domzgr_substitute.h90"       
-      
       INTEGER, INTENT(in) :: i1,i2,j1,j2,k1,k2,n1,n2
       REAL(wp), DIMENSION(i1:i2,j1:j2,k1:k2,n1:n2), INTENT(inout) :: tabres
@@ -341,6 +311,4 @@
       !!   *** ROUTINE interpun ***
       !!---------------------------------------------
-#  include "domzgr_substitute.h90"       
-      
       INTEGER, INTENT(in) :: i1,i2,j1,j2,k1,k2
       REAL(wp), DIMENSION(i1:i2,j1:j2,k1:k2), INTENT(inout) :: tabres
@@ -354,6 +322,4 @@
       !!   *** ROUTINE interpvn ***
       !!---------------------------------------------
-#  include "domzgr_substitute.h90"       
-      
       INTEGER, INTENT(in) :: i1,i2,j1,j2,k1,k2
       REAL(wp), DIMENSION(i1:i2,j1:j2,k1:k2), INTENT(inout) :: tabres
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_top_interp.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_top_interp.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_top_interp.F90	(revision 3680)
@@ -27,49 +27,86 @@
 
    SUBROUTINE Agrif_trc
-      !!---------------------------------------------
-      !!   *** ROUTINE Agrif_trc ***
-      !!---------------------------------------------
-      
-      INTEGER :: ji,jj,jk,jn
-      REAL(wp) :: zrhox
-      REAL(wp) :: alpha1, alpha2, alpha3, alpha4
-      REAL(wp) :: alpha5, alpha6, alpha7
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE Agrif_Tra  ***
+      !!----------------------------------------------------------------------
+      !!
+      INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
+      REAL(wp) ::   zrhox , alpha1, alpha2, alpha3
+      REAL(wp) ::   alpha4, alpha5, alpha6, alpha7
       REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztra
-           
-      IF (Agrif_Root()) RETURN
+      !!----------------------------------------------------------------------
+      !
+      IF( Agrif_Root() )   RETURN
 
       CALL wrk_alloc( jpi, jpj, jpk, jptra, ztra )
 
-      Agrif_SpecialValue=0.
+      Agrif_SpecialValue    = 0.e0
       Agrif_UseSpecialValue = .TRUE.
-      ztra = 0.e0
+      ztra(:,:,:,:) = 0.e0
 
-      CALL Agrif_Bc_variable(ztra,trn_id, procname = interptrn )
+      CALL Agrif_Bc_variable( ztra, trn_id, procname=interptrn )
       Agrif_UseSpecialValue = .FALSE.
 
       zrhox = Agrif_Rhox()
 
-      alpha1 = (zrhox-1.)/2.
-      alpha2 = 1.-alpha1
+      alpha1 = ( zrhox - 1. ) * 0.5
+      alpha2 = 1. - alpha1
 
-      alpha3 = (zrhox-1)/(zrhox+1)
-      alpha4 = 1.-alpha3
+      alpha3 = ( zrhox - 1. ) / ( zrhox + 1. )
+      alpha4 = 1. - alpha3
 
-      alpha6 = 2.*(zrhox-1.)/(zrhox+1.)
-      alpha7 = -(zrhox-1)/(zrhox+3)
+      alpha6 = 2. * ( zrhox - 1. ) / ( zrhox + 1. )
+      alpha7 =    - ( zrhox - 1. ) / ( zrhox + 3. )
       alpha5 = 1. - alpha6 - alpha7
+      IF( nbondi == 1 .OR. nbondi == 2 ) THEN
 
-      IF ((nbondi == 1).OR.(nbondi == 2)) THEN
-         tra(nlci,:,:,:) = alpha1 * ztra(nlci,:,:,:) + alpha2 * ztra(nlci-1,:,:,:)
-         DO jn=1,jptra 
-            DO jk=1,jpk      
-               DO jj=1,jpj
-                  IF (umask(nlci-2,jj,jk).EQ.0.) THEN
+         DO jn = 1, jptra
+            tra(nlci,:,:,jn) = alpha1 * ztra(nlci,:,:,jn) + alpha2 * ztra(nlci-1,:,:,jn)
+            DO jk = 1, jpkm1
+               DO jj = 1, jpj
+                  IF( umask(nlci-2,jj,jk) == 0.e0 ) THEN
                      tra(nlci-1,jj,jk,jn) = tra(nlci,jj,jk,jn) * tmask(nlci-1,jj,jk)
                   ELSE
                      tra(nlci-1,jj,jk,jn)=(alpha4*tra(nlci,jj,jk,jn)+alpha3*tra(nlci-2,jj,jk,jn))*tmask(nlci-1,jj,jk)
-                     IF (un(nlci-2,jj,jk).GT.0.) THEN
-                        tra(nlci-1,jj,jk,jn)=(alpha6*tra(nlci-2,jj,jk,jn)+alpha5*tra(nlci,jj,jk,jn) &
-                           +alpha7*tra(nlci-3,jj,jk,jn))*tmask(nlci-1,jj,jk)
+                     IF( un(nlci-2,jj,jk) > 0.e0 ) THEN
+                        tra(nlci-1,jj,jk,jn)=( alpha6*tra(nlci-2,jj,jk,jn)+alpha5*tra(nlci,jj,jk,jn)  &
+                           &                 + alpha7*tra(nlci-3,jj,jk,jn) ) * tmask(nlci-1,jj,jk)
+                     ENDIF
+                  ENDIF
+               END DO
+            END DO
+         ENDDO
+      ENDIF
+
+      IF( nbondj == 1 .OR. nbondj == 2 ) THEN
+
+         DO jn = 1, jptra
+            tra(:,nlcj,:,jn) = alpha1 * ztra(:,nlcj,:,jn) + alpha2 * ztra(:,nlcj-1,:,jn)
+            DO jk = 1, jpkm1
+               DO ji = 1, jpi
+                  IF( vmask(ji,nlcj-2,jk) == 0.e0 ) THEN
+                     tra(ji,nlcj-1,jk,jn) = tra(ji,nlcj,jk,jn) * tmask(ji,nlcj-1,jk)
+                  ELSE
+                     tra(ji,nlcj-1,jk,jn)=(alpha4*tra(ji,nlcj,jk,jn)+alpha3*tra(ji,nlcj-2,jk,jn))*tmask(ji,nlcj-1,jk)
+                     IF (vn(ji,nlcj-2,jk) > 0.e0 ) THEN
+                        tra(ji,nlcj-1,jk,jn)=( alpha6*tra(ji,nlcj-2,jk,jn)+alpha5*tra(ji,nlcj,jk,jn)  &
+                           &                 + alpha7*tra(ji,nlcj-3,jk,jn) ) * tmask(ji,nlcj-1,jk)
+                     ENDIF
+                  ENDIF
+               END DO
+            END DO
+         ENDDO
+      ENDIF
+      IF( nbondi == -1 .OR. nbondi == 2 ) THEN
+         DO jn = 1, jptra
+            tra(1,:,:,jn) = alpha1 * ztra(1,:,:,jn) + alpha2 * ztra(2,:,:,jn)
+            DO jk = 1, jpkm1
+               DO jj = 1, jpj
+                  IF( umask(2,jj,jk) == 0.e0 ) THEN
+                     tra(2,jj,jk,jn) = tra(1,jj,jk,jn) * tmask(2,jj,jk)
+                  ELSE
+                     tra(2,jj,jk,jn)=(alpha4*tra(1,jj,jk,jn)+alpha3*tra(3,jj,jk,jn))*tmask(2,jj,jk)
+                     IF( un(2,jj,jk) < 0.e0 ) THEN
+                        tra(2,jj,jk,jn)=(alpha6*tra(3,jj,jk,jn)+alpha5*tra(1,jj,jk,jn)+alpha7*tra(4,jj,jk,jn))*tmask(2,jj,jk)
                      ENDIF
                   ENDIF
@@ -79,62 +116,24 @@
       ENDIF
 
-      IF ((nbondj == 1).OR.(nbondj == 2)) THEN
-         tra(:,nlcj,:,:) = alpha1 * ztra(:,nlcj,:,:) + alpha2 * ztra(:,nlcj-1,:,:)
-         DO jn=1, jptra            
-            DO jk=1,jpk      
+      IF( nbondj == -1 .OR. nbondj == 2 ) THEN
+         DO jn = 1, jptra
+            tra(:,1,:,jn) = alpha1 * ztra(:,1,:,jn) + alpha2 * ztra(:,2,:,jn)
+            DO jk=1,jpk
                DO ji=1,jpi
-                  IF (vmask(ji,nlcj-2,jk).EQ.0.) THEN
-                     tra(ji,nlcj-1,jk,jn) = tra(ji,nlcj,jk,jn) * tmask(ji,nlcj-1,jk)
+                  IF( vmask(ji,2,jk) == 0.e0 ) THEN
+                     tra(ji,2,jk,jn)=tra(ji,1,jk,jn) * tmask(ji,2,jk)
                   ELSE
-                     tra(ji,nlcj-1,jk,jn)=(alpha4*tra(ji,nlcj,jk,jn)+alpha3*tra(ji,nlcj-2,jk,jn))*tmask(ji,nlcj-1,jk)        
-                     IF (vn(ji,nlcj-2,jk) .GT. 0.) THEN
-                        tra(ji,nlcj-1,jk,jn)=(alpha6*tra(ji,nlcj-2,jk,jn)+alpha5*tra(ji,nlcj,jk,jn) &
-                           +alpha7*tra(ji,nlcj-3,jk,jn))*tmask(ji,nlcj-1,jk)
+                     tra(ji,2,jk,jn)=(alpha4*tra(ji,1,jk,jn)+alpha3*tra(ji,3,jk,jn))*tmask(ji,2,jk)
+                     IF( vn(ji,2,jk) < 0.e0 ) THEN
+                        tra(ji,2,jk,jn)=(alpha6*tra(ji,3,jk,jn)+alpha5*tra(ji,1,jk,jn)+alpha7*tra(ji,4,jk,jn))*tmask(ji,2,jk)
                      ENDIF
                   ENDIF
                END DO
             END DO
-         END DO
+         ENDDO
       ENDIF
-
-      IF ((nbondi == -1).OR.(nbondi == 2)) THEN
-         tra(1,:,:,:) = alpha1 * ztra(1,:,:,:) + alpha2 * ztra(2,:,:,:)
-         DO jn=1, jptra
-            DO jk=1,jpk      
-               DO jj=1,jpj
-                  IF (umask(2,jj,jk).EQ.0.) THEN
-                     tra(2,jj,jk,jn) = tra(1,jj,jk,jn) * tmask(2,jj,jk)
-                  ELSE
-                     tra(2,jj,jk,jn)=(alpha4*tra(1,jj,jk,jn)+alpha3*tra(3,jj,jk,jn))*tmask(2,jj,jk)        
-                     IF (un(2,jj,jk).LT.0.) THEN
-                        tra(2,jj,jk,jn)=(alpha6*tra(3,jj,jk,jn)+alpha5*tra(1,jj,jk,jn) &
-                           +alpha7*tra(4,jj,jk,jn))*tmask(2,jj,jk)
-                     ENDIF
-                  ENDIF
-               END DO
-            END DO
-         END DO
-      ENDIF
-
-      IF ((nbondj == -1).OR.(nbondj == 2)) THEN
-         tra(:,1,:,:) = alpha1 * ztra(:,1,:,:) + alpha2 * ztra(:,2,:,:)
-         DO jn=1, jptra  
-            DO jk=1,jpk      
-               DO ji=1,jpi
-                  IF (vmask(ji,2,jk).EQ.0.) THEN
-                     tra(ji,2,jk,jn)=tra(ji,1,jk,jn) * tmask(ji,2,jk)
-                  ELSE
-                     tra(ji,2,jk,jn)=(alpha4*tra(ji,1,jk,jn)+alpha3*tra(ji,3,jk,jn))*tmask(ji,2,jk)
-                     IF (vn(ji,2,jk) .LT. 0.) THEN
-                        tra(ji,2,jk,jn)=(alpha6*tra(ji,3,jk,jn)+alpha5*tra(ji,1,jk,jn)&
-                           +alpha7*tra(ji,4,jk,jn))*tmask(ji,2,jk)
-                     ENDIF
-                  ENDIF
-               END DO
-            END DO
-         END DO
-      ENDIF
-
+      !
       CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztra )
+      !
 
    END SUBROUTINE Agrif_trc
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_top_sponge.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_top_sponge.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_top_sponge.F90	(revision 3680)
@@ -8,4 +8,5 @@
    USE in_out_manager
    USE agrif_oce
+   USE agrif_opa_sponge
    USE trc
    USE lib_mpp
@@ -17,4 +18,6 @@
    PUBLIC Agrif_Sponge_Trc, interptrn
 
+  !! * Substitutions
+#  include "domzgr_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/NST 3.3 , NEMO Consortium (2010)
@@ -29,16 +32,15 @@
       !!   *** ROUTINE Agrif_Sponge_Trc ***
       !!---------------------------------------------
-#include "domzgr_substitute.h90"
       !! 
-      INTEGER :: ji,jj,jk,jl
-      INTEGER :: spongearea
+      INTEGER :: ji,jj,jk,jn
       REAL(wp) :: timecoeff
       REAL(wp) :: ztra, zabe1, zabe2, zbtr
-      REAL(wp), POINTER, DIMENSION(:,:) :: localviscsponge
-      REAL(wp), POINTER, DIMENSION(:,:,:,:) :: trbdiff, ztru, ztrv, ztab
+      REAL(wp), POINTER, DIMENSION(:,:) :: ztru, ztrv
+      REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztabr
+      REAL(wp), POINTER, DIMENSION(:,:,:,:) :: trbdiff
 
 #if defined SPONGE_TOP
-      CALL wrk_alloc( jpi, jpj, localviscsponge )
-      CALL wrk_alloc( jpi, jpj, jpk, jptra, trbdiff, ztru, ztrv, ztab )
+      CALL wrk_alloc( jpi, jpj, ztru, ztrv )
+      CALL wrk_alloc( jpi, jpj, jpk, jptra, ztabr, trbdiff )
 
       timecoeff = REAL(Agrif_NbStepint(),wp)/Agrif_rhot()
@@ -46,106 +48,39 @@
       Agrif_SpecialValue=0.
       Agrif_UseSpecialValue = .TRUE.
-      ztab = 0.e0
-      CALL Agrif_Bc_Variable(ztab, tra_id,calledweight=timecoeff,procname=interptrn)
+      ztabr = 0.e0
+      CALL Agrif_Bc_Variable(ztabr, tra_id,calledweight=timecoeff,procname=interptrn)
       Agrif_UseSpecialValue = .FALSE.
 
-      trbdiff(:,:,:,:) = trb(:,:,:,:) - ztab(:,:,:,:)
+      trbdiff(:,:,:,:) = trb(:,:,:,:) - ztabr(:,:,:,:)
 
-      spongearea = 2 + 2 * Agrif_irhox()
+      CALL Agrif_sponge
 
-      localviscsponge = 0.
-      
-      IF (.NOT. spongedoneT) THEN
-         spe1ur(:,:) = 0.
-         spe2vr(:,:) = 0.
+      DO jn = 1, jptra
+         DO jk = 1, jpkm1
+            !
+            DO jj = 1, jpjm1
+               DO ji = 1, jpim1
+                  zabe1 = umask(ji,jj,jk) * spe1ur(ji,jj) * fse3u(ji,jj,jk)
+                  zabe2 = vmask(ji,jj,jk) * spe2vr(ji,jj) * fse3v(ji,jj,jk)
+                  ztru(ji,jj) = zabe1 * ( trbdiff(ji+1,jj  ,jk,jn) - trbdiff(ji,jj,jk,jn) )
+                  ztrv(ji,jj) = zabe2 * ( trbdiff(ji  ,jj+1,jk,jn) - trbdiff(ji,jj,jk,jn) )
+               ENDDO
+            ENDDO
 
-      IF ((nbondi == -1).OR.(nbondi == 2)) THEN
-         DO ji = 2, spongearea
-            localviscsponge(ji,:) = visc_tra * (spongearea-ji)/real(spongearea-2)
+            DO jj = 2,jpjm1
+               DO ji = 2,jpim1
+                  zbtr = spbtr2(ji,jj) / fse3t(ji,jj,jk)
+                  ! horizontal diffusive trends
+                  ztra = zbtr * ( ztru(ji,jj) - ztru(ji-1,jj) + ztrv(ji,jj) - ztrv(ji,jj-1)  )
+                  ! add it to the general tracer trends
+                  tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra
+               END DO
+            END DO
+            !
          ENDDO
-	 
-	 spe1ur(2:spongearea-1,:)=0.5 * (localviscsponge(2:spongearea-1,:) + localviscsponge(3:spongearea,:)) &
-	       * e2u(2:spongearea-1,:) / e1u(2:spongearea-1,:)
-
-         spe2vr(2:spongearea,1:jpjm1) = 0.5 * (localviscsponge(2:spongearea,1:jpjm1) + &
-	          localviscsponge(2:spongearea,2:jpj)) &
-	        * e1v(2:spongearea,1:jpjm1) / e2v(2:spongearea,1:jpjm1)
-      ENDIF
-
-      IF ((nbondi == 1).OR.(nbondi == 2)) THEN
-         DO ji = nlci-spongearea + 1,nlci-1
-            localviscsponge(ji,:) = visc_tra * (ji - (nlci-spongearea+1))/real(spongearea-2)
-         ENDDO
-	 
-	 spe1ur(nlci-spongearea + 1:nlci-2,:)=0.5 * (localviscsponge(nlci-spongearea + 1:nlci-2,:) + &
-	        localviscsponge(nlci-spongearea + 2:nlci-1,:)) &
-	       * e2u(nlci-spongearea + 1:nlci-2,:) / e1u(nlci-spongearea + 1:nlci-2,:)
-
-         spe2vr(nlci-spongearea + 1:nlci-1,1:jpjm1) = 0.5 * (localviscsponge(nlci-spongearea + 1:nlci-1,1:jpjm1) &
-	           + localviscsponge(nlci-spongearea + 1:nlci-1,2:jpj)) &
-	        * e1v(nlci-spongearea + 1:nlci-1,1:jpjm1) / e2v(nlci-spongearea + 1:nlci-1,1:jpjm1)
-      ENDIF
-
-
-      IF ((nbondj == -1).OR.(nbondj == 2)) THEN
-         DO jj = 2, spongearea
-            localviscsponge(:,jj) = visc_tra * (spongearea-jj)/real(spongearea-2)
-         ENDDO
-	 
-	 spe1ur(1:jpim1,2:spongearea)=0.5 * (localviscsponge(1:jpim1,2:spongearea) + &
-	        localviscsponge(2:jpi,2:spongearea)) &
-	       * e2u(1:jpim1,2:spongearea) / e1u(1:jpim1,2:spongearea)
-
-         spe2vr(:,2:spongearea-1) = 0.5 * (localviscsponge(:,2:spongearea-1) + &
-	          localviscsponge(:,3:spongearea)) &
-	        * e1v(:,2:spongearea-1) / e2v(:,2:spongearea-1)
-      ENDIF
-
-      IF ((nbondj == 1).OR.(nbondj == 2)) THEN
-         DO jj = nlcj-spongearea + 1,nlcj-1
-            localviscsponge(:,jj) = visc_tra * (jj - (nlcj-spongearea+1))/real(spongearea-2)
-         ENDDO
-	 
-	 spe1ur(1:jpim1,nlcj-spongearea + 1:nlcj-1)=0.5 * (localviscsponge(1:jpim1,nlcj-spongearea + 1:nlcj-1) + &
-	         localviscsponge(2:jpi,nlcj-spongearea + 1:nlcj-1)) &
-	       * e2u(1:jpim1,nlcj-spongearea + 1:nlcj-1) / e1u(1:jpim1,nlcj-spongearea + 1:nlcj-1)
-
-         spe2vr(:,nlcj-spongearea + 1:nlcj-2) = 0.5 * (localviscsponge(:,nlcj-spongearea + 1:nlcj-2) + &
-	         localviscsponge(:,nlcj-spongearea + 2:nlcj-1)) &
-	        * e1v(:,nlcj-spongearea + 1:nlcj-2) / e2v(:,nlcj-spongearea + 1:nlcj-2)
-      ENDIF
-      
-         spbtr2(:,:) = 1. / ( e1t(:,:) * e2t(:,:))
-
-         spongedoneT = .TRUE.
-      ENDIF
-
-      DO jl = 1, jptra
-      DO jk = 1, jpkm1
-         DO jj = 1, jpjm1
-            DO ji = 1, jpim1
-               zabe1 = umask(ji,jj,jk) * spe1ur(ji,jj) * fse3u(ji,jj,jk)
-               zabe2 = vmask(ji,jj,jk) * spe2vr(ji,jj) * fse3v(ji,jj,jk)
-               ztru(ji,jj,jk,jl) = zabe1 * ( trbdiff(ji+1,jj  ,jk,jl) - trbdiff(ji,jj,jk,jl) )
-               ztrv(ji,jj,jk,jl) = zabe2 * ( trbdiff(ji  ,jj+1,jk,jl) - trbdiff(ji,jj,jk,jl) )
-            ENDDO
-         ENDDO
-
-         DO jj = 2,jpjm1
-            DO ji = 2,jpim1
-               zbtr = spbtr2(ji,jj) / fse3t(ji,jj,jk)
-               ! horizontal diffusive trends
-               ztra = zbtr * (  ztru(ji,jj,jk,jl) - ztru(ji-1,jj,jk,jl)   &
-                  &          + ztrv(ji,jj,jk,jl) - ztrv(ji,jj-1,jk,jl)  )
-               ! add it to the general tracer trends
-               tra(ji,jj,jk,jl) = (tra(ji,jj,jk,jl) + ztra)
-            END DO
-         END DO
-
-      ENDDO
       ENDDO
  
-      CALL wrk_dealloc( jpi, jpj, localviscsponge )
-      CALL wrk_dealloc( jpi, jpj, jpk, jptra, trbdiff, ztru, ztrv, ztab )
+      CALL wrk_dealloc( jpi, jpj, ztru, ztrv )
+      CALL wrk_dealloc( jpi, jpj, jpk, jptra, trbdiff, ztabr )
 
 #endif
@@ -153,14 +88,12 @@
    END SUBROUTINE Agrif_Sponge_Trc
 
-   SUBROUTINE interptrn(tabres,i1,i2,j1,j2,k1,k2,l1,l2)
+   SUBROUTINE interptrn(tabres,i1,i2,j1,j2,k1,k2,n1,n2)
       !!---------------------------------------------
       !!   *** ROUTINE interptn ***
       !!---------------------------------------------
-#  include "domzgr_substitute.h90"       
-      
-      INTEGER, INTENT(in) :: i1,i2,j1,j2,k1,k2,l1,l2
-      REAL(wp), DIMENSION(i1:i2,j1:j2,k1:k2,l1:l2), INTENT(inout) :: tabres
-
-      tabres(i1:i2,j1:j2,k1:k2,l1:l2) = trn(i1:i2,j1:j2,k1:k2,l1:l2)
+      INTEGER, INTENT(in) :: i1,i2,j1,j2,k1,k2,n1,n2
+      REAL(wp), DIMENSION(i1:i2,j1:j2,k1:k2,n1:n2), INTENT(inout) :: tabres
+      !
+      tabres(i1:i2,j1:j2,k1:k2,n1:n2) = trn(i1:i2,j1:j2,k1:k2,n1:n2)
 
    END SUBROUTINE interptrn
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_top_update.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_top_update.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_top_update.F90	(revision 3680)
@@ -38,5 +38,5 @@
 
 #if defined TWO_WAY
-      CALL wrk_alloc( jpi, jpj, jpk, jpts, ztra )
+      CALL wrk_alloc( jpi, jpj, jpk, jptra, ztra )
 
       Agrif_UseSpecialValueInUpdate = .TRUE.
@@ -52,27 +52,25 @@
       nbcline_trc = nbcline_trc + 1
 
-      CALL wrk_dealloc( jpi, jpj, jpk, jpts, ztra )
+      CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztra )
 #endif
 
    END SUBROUTINE Agrif_Update_Trc
 
-   SUBROUTINE updateTRC(tabres,i1,i2,j1,j2,k1,k2,l1,l2,before)
+   SUBROUTINE updateTRC(tabres,i1,i2,j1,j2,k1,k2,n1,n2,before)
       !!---------------------------------------------
       !!   *** ROUTINE UpdateTrc ***
       !!---------------------------------------------
-#  include "domzgr_substitute.h90"
-
-      INTEGER, INTENT(in) :: i1,i2,j1,j2,k1,k2,l1,l2
-      REAL, DIMENSION(i1:i2,j1:j2,k1:k2,l1:l2), INTENT(inout) :: tabres
+      INTEGER, INTENT(in) :: i1,i2,j1,j2,k1,k2,n1,n2
+      REAL, DIMENSION(i1:i2,j1:j2,k1:k2,n1:n2), INTENT(inout) :: tabres
       LOGICAL, INTENT(in) :: before
    
-      INTEGER :: ji,jj,jk,jl
+      INTEGER :: ji,jj,jk,jn
 
-         IF (before) THEN
-            DO jl=l1,l2
-               DO jk=k1,k2
-                  DO jj=j1,j2
-                     DO ji=i1,i2
-                        tabres(ji,jj,jk,jl) = trn(ji,jj,jk,jl)
+         IF( before ) THEN
+            DO jn = n1, n2
+               DO jk = k1, k2
+                  DO jj = j1, j2
+                     DO ji = i1, i2
+                        tabres(ji,jj,jk,jn) = trn(ji,jj,jk,jn)
                      ENDDO
                   ENDDO
@@ -80,10 +78,10 @@
             ENDDO
          ELSE
-            DO jl=l1,l2
-               DO jk=k1,k2
-                  DO jj=j1,j2
-                     DO ji=i1,i2
-                        IF (tabres(ji,jj,jk,jl).NE.0.) THEN
-                           trn(ji,jj,jk,jl) = tabres(ji,jj,jk,jl) * tmask(ji,jj,jk)
+            DO jn = n1, n2
+               DO jk = k1, k2
+                  DO jj = j1, j2
+                     DO ji = i1, i2
+                        IF( tabres(ji,jj,jk,jn) .NE. 0. ) THEN
+                           trn(ji,jj,jk,jn) = tabres(ji,jj,jk,jn) * tmask(ji,jj,jk)
                         ENDIF
                      ENDDO
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_user.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_user.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/NST_SRC/agrif_user.F90	(revision 3680)
@@ -1,502 +1,648 @@
 #if defined key_agrif
-   !!----------------------------------------------------------------------
-   !! NEMO/NST 3.3 , NEMO Consortium (2010)
-   !! $Id$
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-   SUBROUTINE agrif_before_regridding
-   END SUBROUTINE
-
-   SUBROUTINE Agrif_InitWorkspace
-      !!----------------------------------------------------------------------
-      !!                 *** ROUTINE Agrif_InitWorkspace ***
-      !!----------------------------------------------------------------------
-      USE par_oce
-      USE dom_oce
-      USE Agrif_Util
-      USE nemogcm
-      !
-      IMPLICIT NONE
-      !!----------------------------------------------------------------------
-      !
-      IF( .NOT. Agrif_Root() ) THEN
-         jpni = Agrif_Parent(jpni)
-         jpnj = Agrif_Parent(jpnj)
-         jpnij = Agrif_Parent(jpnij)
-         jpiglo  = nbcellsx + 2 + 2*nbghostcells
-         jpjglo  = nbcellsy + 2 + 2*nbghostcells
-         jpi     = ( jpiglo-2*jpreci + (jpni-1+0) ) / jpni + 2*jpreci
-         jpj     = ( jpjglo-2*jprecj + (jpnj-1+0) ) / jpnj + 2*jprecj
-         jpk     = jpkdta
-         jpim1   = jpi-1
-         jpjm1   = jpj-1
-         jpkm1   = jpk-1                                        
-         jpij    = jpi*jpj
-         jpidta  = jpiglo
-         jpjdta  = jpjglo
-         jpizoom = 1
-         jpjzoom = 1
-         nperio  = 0
-         jperio  = 0
-      ENDIF
-      !
-   END SUBROUTINE Agrif_InitWorkspace
-
-
-   SUBROUTINE Agrif_InitValues
-      !!----------------------------------------------------------------------
-      !!                 *** ROUTINE Agrif_InitValues ***
-      !!
-      !! ** Purpose :: Declaration of variables to be interpolated
-      !!----------------------------------------------------------------------
-      USE Agrif_Util
-      USE oce 
-      USE dom_oce
-      USE nemogcm
-      USE tradmp
-      USE obc_par
-      USE bdy_par
-
-      IMPLICIT NONE
-      !!----------------------------------------------------------------------
-
-      ! 0. Initializations
-      !-------------------
+!!----------------------------------------------------------------------
+!! NEMO/NST 3.4 , NEMO Consortium (2012)
+!! $Id$
+!! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+!!----------------------------------------------------------------------
+SUBROUTINE agrif_user
+END SUBROUTINE agrif_user
+
+SUBROUTINE agrif_before_regridding
+END SUBROUTINE agrif_before_regridding
+
+SUBROUTINE Agrif_InitWorkspace
+   !!----------------------------------------------------------------------
+   !!                 *** ROUTINE Agrif_InitWorkspace ***
+   !!----------------------------------------------------------------------
+   USE par_oce
+   USE dom_oce
+   USE Agrif_Util
+   USE nemogcm
+   !
+   IMPLICIT NONE
+   !!----------------------------------------------------------------------
+   !
+   IF( .NOT. Agrif_Root() ) THEN
+      jpni = Agrif_Parent(jpni)
+      jpnj = Agrif_Parent(jpnj)
+      jpnij = Agrif_Parent(jpnij)
+      jpiglo  = nbcellsx + 2 + 2*nbghostcells
+      jpjglo  = nbcellsy + 2 + 2*nbghostcells
+      jpi     = ( jpiglo-2*jpreci + (jpni-1+0) ) / jpni + 2*jpreci
+      jpj     = ( jpjglo-2*jprecj + (jpnj-1+0) ) / jpnj + 2*jprecj
+      jpk     = jpkdta
+      jpim1   = jpi-1
+      jpjm1   = jpj-1
+      jpkm1   = jpk-1                                        
+      jpij    = jpi*jpj
+      jpidta  = jpiglo
+      jpjdta  = jpjglo
+      jpizoom = 1
+      jpjzoom = 1
+      nperio  = 0
+      jperio  = 0
+   ENDIF
+   !
+END SUBROUTINE Agrif_InitWorkspace
+
+
+SUBROUTINE Agrif_InitValues
+   !!----------------------------------------------------------------------
+   !!                 *** ROUTINE Agrif_InitValues ***
+   !!
+   !! ** Purpose :: Declaration of variables to be interpolated
+   !!----------------------------------------------------------------------
+   USE Agrif_Util
+   USE oce 
+   USE dom_oce
+   USE nemogcm
+   USE tradmp
+   USE obc_par
+   USE bdy_par
+
+   IMPLICIT NONE
+   !!----------------------------------------------------------------------
+
+   ! 0. Initializations
+   !-------------------
 #if defined key_orca_r025 || defined key_orca_r05 || defined key_orca_r2 || defined key_orca_r4
-      jp_cfg = -1    ! set special value for jp_cfg on fine grids
-      cp_cfg = "default"
+   jp_cfg = -1    ! set special value for jp_cfg on fine grids
+   cp_cfg = "default"
 #endif
 
-      ! Specific fine grid Initializations
-      ! no tracer damping on fine grids
-      ln_tradmp = .FALSE.
-      ! no open boundary on fine grids
-      lk_obc = .FALSE.
-      lk_bdy = .FALSE.
-
-      CALL nemo_init  ! Initializations of each fine grid
-      CALL agrif_nemo_init
+   ! Specific fine grid Initializations
+   ! no tracer damping on fine grids
+   ln_tradmp = .FALSE.
+   ! no open boundary on fine grids
+   lk_obc = .FALSE.
+   lk_bdy = .FALSE.
+
+   CALL nemo_init  ! Initializations of each fine grid
+   CALL agrif_nemo_init
+   CALL Agrif_InitValues_cont_dom
 # if ! defined key_offline
-      CALL Agrif_InitValues_cont
+   CALL Agrif_InitValues_cont
 # endif       
 # if defined key_top
-      CALL Agrif_InitValues_cont_top
+   CALL Agrif_InitValues_cont_top
 # endif      
-   END SUBROUTINE Agrif_initvalues
+END SUBROUTINE Agrif_initvalues
+
+
+SUBROUTINE Agrif_InitValues_cont_dom
+   !!----------------------------------------------------------------------
+   !!                 *** ROUTINE Agrif_InitValues_cont ***
+   !!
+   !! ** Purpose ::   Declaration of variables to be interpolated
+   !!----------------------------------------------------------------------
+   USE Agrif_Util
+   USE oce 
+   USE dom_oce
+   USE nemogcm
+   USE sol_oce
+   USE in_out_manager
+   USE agrif_opa_update
+   USE agrif_opa_interp
+   USE agrif_opa_sponge
+   !
+   IMPLICIT NONE
+   !
+   !!----------------------------------------------------------------------
+
+   ! Declaration of the type of variable which have to be interpolated
+   !---------------------------------------------------------------------
+   CALL agrif_declare_var_dom
+   !
+END SUBROUTINE Agrif_InitValues_cont_dom
+
+
+SUBROUTINE agrif_declare_var_dom
+   !!----------------------------------------------------------------------
+   !!                 *** ROUTINE agrif_declarE_var ***
+   !!
+   !! ** Purpose :: Declaration of variables to be interpolated
+   !!----------------------------------------------------------------------
+   USE agrif_util
+   USE par_oce       !   ONLY : jpts
+   USE oce
+   IMPLICIT NONE
+   !!----------------------------------------------------------------------
+
+   ! 1. Declaration of the type of variable which have to be interpolated
+   !---------------------------------------------------------------------
+   CALL agrif_declare_variable((/1,2/),(/2,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),e1u_id)
+   CALL agrif_declare_variable((/2,1/),(/3,2/),(/'x','y'/),(/1,1/),(/jpi,jpj/),e2v_id)
+
+
+   ! 2. Type of interpolation
+   !-------------------------
+   Call Agrif_Set_bcinterp(e1u_id,interp1=Agrif_linear,interp2=AGRIF_ppm)
+   Call Agrif_Set_bcinterp(e2v_id,interp1=AGRIF_ppm,interp2=Agrif_linear)
+
+   ! 3. Location of interpolation
+   !-----------------------------
+   Call Agrif_Set_bc(e1u_id,(/0,0/))
+   Call Agrif_Set_bc(e2v_id,(/0,0/))
+
+   ! 5. Update type
+   !--------------- 
+   Call Agrif_Set_Updatetype(e1u_id,update1 = Agrif_Update_Copy, update2=Agrif_Update_Average)
+   Call Agrif_Set_Updatetype(e2v_id,update1 = Agrif_Update_Average, update2=Agrif_Update_Copy)
+
+END SUBROUTINE agrif_declare_var_dom
+
 
 # if ! defined key_offline
 
-   SUBROUTINE Agrif_InitValues_cont
-      !!----------------------------------------------------------------------
-      !!                 *** ROUTINE Agrif_InitValues_cont ***
-      !!
-      !! ** Purpose ::   Declaration of variables to be interpolated
-      !!----------------------------------------------------------------------
-      USE Agrif_Util
-      USE oce 
-      USE dom_oce
-      USE nemogcm
-      USE sol_oce
-      USE in_out_manager
-      USE agrif_opa_update
-      USE agrif_opa_interp
-      USE agrif_opa_sponge
-      !
-      IMPLICIT NONE
-      !
-      REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: tabtstemp
-      REAL(wp), DIMENSION(:,:,:  ), ALLOCATABLE :: tabuvtemp
-      LOGICAL :: check_namelist
-      !!----------------------------------------------------------------------
-
-      ALLOCATE( tabtstemp(jpi, jpj, jpk, jpts) )
-      ALLOCATE( tabuvtemp(jpi, jpj, jpk)       )
-
-
-      ! 1. Declaration of the type of variable which have to be interpolated
-      !---------------------------------------------------------------------
-      CALL agrif_declare_var
-
-      ! 2. First interpolations of potentially non zero fields
-      !-------------------------------------------------------
-      Agrif_SpecialValue=0.
-      Agrif_UseSpecialValue = .TRUE.
-      Call Agrif_Bc_variable(tabtstemp,tsn_id,calledweight=1.,procname=interptsn)
-      Call Agrif_Bc_variable(tabtstemp,tsa_id,calledweight=1.,procname=interptsn)
-
-      Call Agrif_Bc_variable(tabuvtemp,un_id,calledweight=1.,procname=interpu)
-      Call Agrif_Bc_variable(tabuvtemp,vn_id,calledweight=1.,procname=interpv)
-      Call Agrif_Bc_variable(tabuvtemp,ua_id,calledweight=1.,procname=interpun)
-      Call Agrif_Bc_variable(tabuvtemp,va_id,calledweight=1.,procname=interpvn)
-      Agrif_UseSpecialValue = .FALSE.
-
-      ! 3. Some controls
-      !-----------------
-      check_namelist = .true.
-            
-      IF( check_namelist ) THEN
-     
-         ! Check time steps           
-         IF( NINT(Agrif_Rhot()) * nint(rdt) /= Agrif_Parent(rdt) ) THEN
-            WRITE(*,*) 'incompatible time step between grids'
-            WRITE(*,*) 'parent grid value : ',Agrif_Parent(rdt)
-            WRITE(*,*) 'child  grid value : ',nint(rdt)
-            WRITE(*,*) 'value on parent grid should be : ',rdt*Agrif_Rhot()
+SUBROUTINE Agrif_InitValues_cont
+   !!----------------------------------------------------------------------
+   !!                 *** ROUTINE Agrif_InitValues_cont ***
+   !!
+   !! ** Purpose ::   Declaration of variables to be interpolated
+   !!----------------------------------------------------------------------
+   USE Agrif_Util
+   USE oce 
+   USE dom_oce
+   USE nemogcm
+   USE sol_oce
+   USE in_out_manager
+   USE agrif_opa_update
+   USE agrif_opa_interp
+   USE agrif_opa_sponge
+   !
+   IMPLICIT NONE
+   !
+   REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: tabtstemp
+   REAL(wp), DIMENSION(:,:,:  ), ALLOCATABLE :: tabuvtemp
+   LOGICAL :: check_namelist
+   !!----------------------------------------------------------------------
+
+   ALLOCATE( tabtstemp(jpi, jpj, jpk, jpts) )
+   ALLOCATE( tabuvtemp(jpi, jpj, jpk)       )
+
+
+   ! 1. Declaration of the type of variable which have to be interpolated
+   !---------------------------------------------------------------------
+   CALL agrif_declare_var
+
+   ! 2. First interpolations of potentially non zero fields
+   !-------------------------------------------------------
+   Agrif_SpecialValue=0.
+   Agrif_UseSpecialValue = .TRUE.
+   Call Agrif_Bc_variable(tabtstemp,tsn_id,calledweight=1.,procname=interptsn)
+   Call Agrif_Bc_variable(tabtstemp,tsa_id,calledweight=1.,procname=interptsn)
+
+   Call Agrif_Bc_variable(tabuvtemp,un_id,calledweight=1.,procname=interpu)
+   Call Agrif_Bc_variable(tabuvtemp,vn_id,calledweight=1.,procname=interpv)
+   Call Agrif_Bc_variable(tabuvtemp,ua_id,calledweight=1.,procname=interpun)
+   Call Agrif_Bc_variable(tabuvtemp,va_id,calledweight=1.,procname=interpvn)
+   Agrif_UseSpecialValue = .FALSE.
+
+   ! 3. Some controls
+   !-----------------
+   check_namelist = .true.
+
+   IF( check_namelist ) THEN
+
+      ! Check time steps           
+      IF( NINT(Agrif_Rhot()) * nint(rdt) /= Agrif_Parent(rdt) ) THEN
+         WRITE(*,*) 'incompatible time step between grids'
+         WRITE(*,*) 'parent grid value : ',Agrif_Parent(rdt)
+         WRITE(*,*) 'child  grid value : ',nint(rdt)
+         WRITE(*,*) 'value on parent grid should be : ',rdt*Agrif_Rhot()
+         STOP
+      ENDIF
+
+      ! Check run length
+      IF( Agrif_IRhot() * (Agrif_Parent(nitend)- &
+           Agrif_Parent(nit000)+1) .ne. (nitend-nit000+1) ) THEN
+         WRITE(*,*) 'incompatible run length between grids'
+         WRITE(*,*) 'parent grid value : ',(Agrif_Parent(nitend)- &
+              Agrif_Parent(nit000)+1),' time step'
+         WRITE(*,*) 'child  grid value : ', &
+              (nitend-nit000+1),' time step'
+         WRITE(*,*) 'value on child grid should be : ', &
+              Agrif_IRhot() * (Agrif_Parent(nitend)- &
+              Agrif_Parent(nit000)+1)
+         STOP
+      ENDIF
+
+      ! Check coordinates
+      IF( ln_zps ) THEN
+         ! check parameters for partial steps 
+         IF( Agrif_Parent(e3zps_min) .ne. e3zps_min ) THEN
+            WRITE(*,*) 'incompatible e3zps_min between grids'
+            WRITE(*,*) 'parent grid :',Agrif_Parent(e3zps_min)
+            WRITE(*,*) 'child grid  :',e3zps_min
+            WRITE(*,*) 'those values should be identical'
             STOP
          ENDIF
-         
-         ! Check run length
-         IF( Agrif_IRhot() * (Agrif_Parent(nitend)- &
-            Agrif_Parent(nit000)+1) .ne. (nitend-nit000+1) ) THEN
-            WRITE(*,*) 'incompatible run length between grids'
-            WRITE(*,*) 'parent grid value : ',(Agrif_Parent(nitend)- &
-               Agrif_Parent(nit000)+1),' time step'
-            WRITE(*,*) 'child  grid value : ', &
-               (nitend-nit000+1),' time step'
-            WRITE(*,*) 'value on child grid should be : ', &
-               Agrif_IRhot() * (Agrif_Parent(nitend)- &
-               Agrif_Parent(nit000)+1)
+         IF( Agrif_Parent(e3zps_rat) /= e3zps_rat ) THEN
+            WRITE(*,*) 'incompatible e3zps_rat between grids'
+            WRITE(*,*) 'parent grid :',Agrif_Parent(e3zps_rat)
+            WRITE(*,*) 'child grid  :',e3zps_rat
+            WRITE(*,*) 'those values should be identical'                  
             STOP
          ENDIF
-         
-         ! Check coordinates
-         IF( ln_zps ) THEN
-            ! check parameters for partial steps 
-            IF( Agrif_Parent(e3zps_min) .ne. e3zps_min ) THEN
-               WRITE(*,*) 'incompatible e3zps_min between grids'
-               WRITE(*,*) 'parent grid :',Agrif_Parent(e3zps_min)
-               WRITE(*,*) 'child grid  :',e3zps_min
-               WRITE(*,*) 'those values should be identical'
-               STOP
-            ENDIF          
-            IF( Agrif_Parent(e3zps_rat) /= e3zps_rat ) THEN
-               WRITE(*,*) 'incompatible e3zps_rat between grids'
-               WRITE(*,*) 'parent grid :',Agrif_Parent(e3zps_rat)
-               WRITE(*,*) 'child grid  :',e3zps_rat
-               WRITE(*,*) 'those values should be identical'                  
-               STOP
-            ENDIF
+      ENDIF
+   ENDIF
+
+   CALL Agrif_Update_tra(0)
+   CALL Agrif_Update_dyn(0)
+
+   nbcline = 0
+   !
+   DEALLOCATE(tabtstemp)
+   DEALLOCATE(tabuvtemp)
+   !
+END SUBROUTINE Agrif_InitValues_cont
+
+
+SUBROUTINE agrif_declare_var
+   !!----------------------------------------------------------------------
+   !!                 *** ROUTINE agrif_declarE_var ***
+   !!
+   !! ** Purpose :: Declaration of variables to be interpolated
+   !!----------------------------------------------------------------------
+   USE agrif_util
+   USE par_oce       !   ONLY : jpts
+   USE oce
+   IMPLICIT NONE
+   !!----------------------------------------------------------------------
+
+   ! 1. Declaration of the type of variable which have to be interpolated
+   !---------------------------------------------------------------------
+   CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jpts/),tsn_id)
+   CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jpts/),tsa_id)
+   CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jpts/),tsb_id)
+
+   CALL agrif_declare_variable((/1,2,0/),(/2,3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),un_id)
+   CALL agrif_declare_variable((/2,1,0/),(/3,2,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),vn_id)
+   CALL agrif_declare_variable((/1,2,0/),(/2,3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),ua_id)
+   CALL agrif_declare_variable((/2,1,0/),(/3,2,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),va_id)
+
+   CALL agrif_declare_variable((/2,2/),(/3,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),sshn_id)
+   CALL agrif_declare_variable((/2,2/),(/3,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),gcb_id)
+
+   ! 2. Type of interpolation
+   !-------------------------
+   CALL Agrif_Set_bcinterp(tsn_id,interp=AGRIF_linear)
+   CALL Agrif_Set_bcinterp(tsa_id,interp=AGRIF_linear)
+
+   Call Agrif_Set_bcinterp(un_id,interp1=Agrif_linear,interp2=AGRIF_ppm)
+   Call Agrif_Set_bcinterp(vn_id,interp1=AGRIF_ppm,interp2=Agrif_linear)
+
+   Call Agrif_Set_bcinterp(ua_id,interp1=Agrif_linear,interp2=AGRIF_ppm)
+   Call Agrif_Set_bcinterp(va_id,interp1=AGRIF_ppm,interp2=Agrif_linear)
+
+   ! 3. Location of interpolation
+   !-----------------------------
+   Call Agrif_Set_bc(un_id,(/0,1/))
+   Call Agrif_Set_bc(vn_id,(/0,1/))
+
+   Call Agrif_Set_bc(tsn_id,(/0,1/))
+   Call Agrif_Set_bc(tsa_id,(/-3*Agrif_irhox(),0/))
+
+   Call Agrif_Set_bc(ua_id,(/-2*Agrif_irhox(),0/))
+   Call Agrif_Set_bc(va_id,(/-2*Agrif_irhox(),0/))
+
+   ! 5. Update type
+   !--------------- 
+   Call Agrif_Set_Updatetype(tsn_id, update = AGRIF_Update_Average)
+   Call Agrif_Set_Updatetype(tsb_id, update = AGRIF_Update_Average)
+
+   Call Agrif_Set_Updatetype(sshn_id, update = AGRIF_Update_Average)
+   Call Agrif_Set_Updatetype(gcb_id,update = AGRIF_Update_Average)
+
+   Call Agrif_Set_Updatetype(un_id,update1 = Agrif_Update_Copy, update2 = Agrif_Update_Average)
+   Call Agrif_Set_Updatetype(vn_id,update1 = Agrif_Update_Average, update2 = Agrif_Update_Copy)
+
+END SUBROUTINE agrif_declare_var
+# endif
+
+#  if defined key_lim2
+SUBROUTINE Agrif_InitValues_cont_lim2
+   !!----------------------------------------------------------------------
+   !!                 *** ROUTINE Agrif_InitValues_cont_lim2 ***
+   !!
+   !! ** Purpose :: Initialisation of variables to be interpolated for LIM2
+   !!----------------------------------------------------------------------
+   USE Agrif_Util
+   USE ice_2
+   USE agrif_ice
+   USE in_out_manager
+   USE agrif_lim2_update
+   USE agrif_lim2_interp
+   USE lib_mpp
+   !
+   IMPLICIT NONE
+   !
+   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE :: zvel
+   REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zadv
+   !!----------------------------------------------------------------------
+
+   ALLOCATE( zvel(jpi,jpj), zadv(jpi,jpj,7))
+
+   ! 1. Declaration of the type of variable which have to be interpolated
+   !---------------------------------------------------------------------
+   CALL agrif_declare_var_lim2
+
+   ! 2. First interpolations of potentially non zero fields
+   !-------------------------------------------------------
+   Agrif_SpecialValue=-9999.
+   Agrif_UseSpecialValue = .TRUE.
+   !     Call Agrif_Bc_variable(zadv ,adv_ice_id ,calledweight=1.,procname=interp_adv_ice )
+   !     Call Agrif_Bc_variable(zvel ,u_ice_id   ,calledweight=1.,procname=interp_u_ice   )
+   !     Call Agrif_Bc_variable(zvel ,v_ice_id   ,calledweight=1.,procname=interp_v_ice   )
+   Agrif_SpecialValue=0.
+   Agrif_UseSpecialValue = .FALSE.
+
+   ! 3. Some controls
+   !-----------------
+
+#   if ! defined key_lim2_vp
+   lim_nbstep = 1.
+   CALL agrif_rhg_lim2_load
+   CALL agrif_trp_lim2_load
+   lim_nbstep = 0.
+#   endif
+   !RB mandatory but why ???
+   !      IF( nbclineupdate /= nn_fsbc .AND. nn_ice == 2 )THEN
+   !         CALL ctl_warn ('With ice model on child grid, nbclineupdate is set to nn_fsbc')
+   !         nbclineupdate = nn_fsbc
+   !       ENDIF
+   CALL Agrif_Update_lim2(0)
+   !
+   DEALLOCATE( zvel, zadv )
+   !
+END SUBROUTINE Agrif_InitValues_cont_lim2
+
+SUBROUTINE agrif_declare_var_lim2
+   !!----------------------------------------------------------------------
+   !!                 *** ROUTINE agrif_declare_var_lim2 ***
+   !!
+   !! ** Purpose :: Declaration of variables to be interpolated for LIM2
+   !!----------------------------------------------------------------------
+   USE agrif_util
+   USE ice_2
+
+   IMPLICIT NONE
+   !!----------------------------------------------------------------------
+
+   ! 1. Declaration of the type of variable which have to be interpolated
+   !---------------------------------------------------------------------
+   CALL agrif_declare_variable((/2,2,0/),(/3,3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj, 7/),adv_ice_id )
+#   if defined key_lim2_vp
+   CALL agrif_declare_variable((/1,1/),(/3,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),u_ice_id)
+   CALL agrif_declare_variable((/1,1/),(/3,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),v_ice_id)
+#   else
+   CALL agrif_declare_variable((/1,2/),(/2,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),u_ice_id)
+   CALL agrif_declare_variable((/2,1/),(/3,2/),(/'x','y'/),(/1,1/),(/jpi,jpj/),v_ice_id)
+#   endif
+
+   ! 2. Type of interpolation
+   !-------------------------
+   CALL Agrif_Set_bcinterp(adv_ice_id ,interp=AGRIF_linear)
+   Call Agrif_Set_bcinterp(u_ice_id,interp1=Agrif_linear,interp2=AGRIF_ppm)
+   Call Agrif_Set_bcinterp(v_ice_id,interp1=AGRIF_ppm,interp2=Agrif_linear)
+
+   ! 3. Location of interpolation
+   !-----------------------------
+   Call Agrif_Set_bc(adv_ice_id ,(/0,1/))
+   Call Agrif_Set_bc(u_ice_id,(/0,1/))
+   Call Agrif_Set_bc(v_ice_id,(/0,1/))
+
+   ! 5. Update type
+   !---------------
+   Call Agrif_Set_Updatetype(adv_ice_id , update = AGRIF_Update_Average)
+   Call Agrif_Set_Updatetype(u_ice_id,update1 = Agrif_Update_Copy, update2 = Agrif_Update_Average)
+   Call Agrif_Set_Updatetype(v_ice_id,update1 = Agrif_Update_Average, update2 = Agrif_Update_Copy)
+
+END SUBROUTINE agrif_declare_var_lim2
+#  endif
+
+
+# if defined key_top
+SUBROUTINE Agrif_InitValues_cont_top
+   !!----------------------------------------------------------------------
+   !!                 *** ROUTINE Agrif_InitValues_cont_top ***
+   !!
+   !! ** Purpose :: Declaration of variables to be interpolated
+   !!----------------------------------------------------------------------
+   USE Agrif_Util
+   USE oce 
+   USE dom_oce
+   USE nemogcm
+   USE par_trc
+   USE trc
+   USE in_out_manager
+   USE agrif_top_update
+   USE agrif_top_interp
+   USE agrif_top_sponge
+   !
+   IMPLICIT NONE
+   !
+   REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: tabtrtemp
+   LOGICAL :: check_namelist
+   !!----------------------------------------------------------------------
+
+   ALLOCATE( tabtrtemp(jpi,jpj,jpk,jptra) )
+
+
+   ! 1. Declaration of the type of variable which have to be interpolated
+   !---------------------------------------------------------------------
+   CALL agrif_declare_var_top
+
+   ! 2. First interpolations of potentially non zero fields
+   !-------------------------------------------------------
+   Agrif_SpecialValue=0.
+   Agrif_UseSpecialValue = .TRUE.
+   Call Agrif_Bc_variable(tabtrtemp,trn_id,calledweight=1.,procname=interptrn)
+   Call Agrif_Bc_variable(tabtrtemp,tra_id,calledweight=1.,procname=interptrn)
+   Agrif_UseSpecialValue = .FALSE.
+
+   ! 3. Some controls
+   !-----------------
+   check_namelist = .true.
+
+   IF( check_namelist ) THEN
+#  if defined offline     
+      ! Check time steps
+      IF( nint(Agrif_Rhot()) * nint(rdt) .ne. Agrif_Parent(rdt) ) THEN
+         WRITE(*,*) 'incompatible time step between grids'
+         WRITE(*,*) 'parent grid value : ',Agrif_Parent(rdt)
+         WRITE(*,*) 'child  grid value : ',nint(rdt)
+         WRITE(*,*) 'value on parent grid should be : ',rdt*Agrif_Rhot()
+         STOP
+      ENDIF
+
+      ! Check run length
+      IF( Agrif_IRhot() * (Agrif_Parent(nitend)- &
+           Agrif_Parent(nit000)+1) .ne. (nitend-nit000+1) ) THEN
+         WRITE(*,*) 'incompatible run length between grids'
+         WRITE(*,*) 'parent grid value : ',(Agrif_Parent(nitend)- &
+              Agrif_Parent(nit000)+1),' time step'
+         WRITE(*,*) 'child  grid value : ', &
+              (nitend-nit000+1),' time step'
+         WRITE(*,*) 'value on child grid should be : ', &
+              Agrif_IRhot() * (Agrif_Parent(nitend)- &
+              Agrif_Parent(nit000)+1)
+         STOP
+      ENDIF
+
+      ! Check coordinates
+      IF( ln_zps ) THEN
+         ! check parameters for partial steps 
+         IF( Agrif_Parent(e3zps_min) .ne. e3zps_min ) THEN
+            WRITE(*,*) 'incompatible e3zps_min between grids'
+            WRITE(*,*) 'parent grid :',Agrif_Parent(e3zps_min)
+            WRITE(*,*) 'child grid  :',e3zps_min
+            WRITE(*,*) 'those values should be identical'
+            STOP
+         ENDIF
+         IF( Agrif_Parent(e3zps_rat) .ne. e3zps_rat ) THEN
+            WRITE(*,*) 'incompatible e3zps_rat between grids'
+            WRITE(*,*) 'parent grid :',Agrif_Parent(e3zps_rat)
+            WRITE(*,*) 'child grid  :',e3zps_rat
+            WRITE(*,*) 'those values should be identical'                  
+            STOP
          ENDIF
       ENDIF
-       
-      CALL Agrif_Update_tra(0)
-      CALL Agrif_Update_dyn(0)
-
-      nbcline = 0
-      !
-      DEALLOCATE(tabtstemp)
-      DEALLOCATE(tabuvtemp)
-      !
-   END SUBROUTINE Agrif_InitValues_cont
-
-
-   SUBROUTINE agrif_declare_var
-      !!----------------------------------------------------------------------
-      !!                 *** ROUTINE agrif_declarE_var ***
-      !!
-      !! ** Purpose :: Declaration of variables to be interpolated
-      !!----------------------------------------------------------------------
-      USE agrif_util
-      USE par_oce       !   ONLY : jpts
-      USE oce
-      IMPLICIT NONE
-      !!----------------------------------------------------------------------
-   
-      ! 1. Declaration of the type of variable which have to be interpolated
-      !---------------------------------------------------------------------
-      CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jpts/),tsn_id)
-      CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jpts/),tsa_id)
-      CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jpts/),tsb_id)
-
-      CALL agrif_declare_variable((/1,2,0/),(/2,3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),un_id)
-      CALL agrif_declare_variable((/2,1,0/),(/3,2,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),vn_id)
-      CALL agrif_declare_variable((/1,2,0/),(/2,3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),ua_id)
-      CALL agrif_declare_variable((/2,1,0/),(/3,2,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),va_id)
-   
-      CALL agrif_declare_variable((/1,2/),(/2,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),e1u_id)
-      CALL agrif_declare_variable((/2,1/),(/3,2/),(/'x','y'/),(/1,1/),(/jpi,jpj/),e2v_id)
-
-      CALL agrif_declare_variable((/2,2/),(/3,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),sshn_id)
-      CALL agrif_declare_variable((/2,2/),(/3,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),gcb_id)
-       
-      ! 2. Type of interpolation
-      !-------------------------
-      CALL Agrif_Set_bcinterp(tsn_id,interp=AGRIF_linear)
-      CALL Agrif_Set_bcinterp(tsa_id,interp=AGRIF_linear)
-   
-      Call Agrif_Set_bcinterp(un_id,interp1=Agrif_linear,interp2=AGRIF_ppm)
-      Call Agrif_Set_bcinterp(vn_id,interp1=AGRIF_ppm,interp2=Agrif_linear)
-
-      Call Agrif_Set_bcinterp(ua_id,interp1=Agrif_linear,interp2=AGRIF_ppm)
-      Call Agrif_Set_bcinterp(va_id,interp1=AGRIF_ppm,interp2=Agrif_linear)
-
-      Call Agrif_Set_bcinterp(e1u_id,interp1=Agrif_linear,interp2=AGRIF_ppm)
-      Call Agrif_Set_bcinterp(e2v_id,interp1=AGRIF_ppm,interp2=Agrif_linear)
-
-      ! 3. Location of interpolation
-      !-----------------------------
-      Call Agrif_Set_bc(un_id,(/0,1/))
-      Call Agrif_Set_bc(vn_id,(/0,1/))
-
-      Call Agrif_Set_bc(e1u_id,(/0,0/))
-      Call Agrif_Set_bc(e2v_id,(/0,0/))
-
-      Call Agrif_Set_bc(tsn_id,(/0,1/))
-      Call Agrif_Set_bc(tsa_id,(/-3*Agrif_irhox(),0/))
-
-      Call Agrif_Set_bc(ua_id,(/-2*Agrif_irhox(),0/))
-      Call Agrif_Set_bc(va_id,(/-2*Agrif_irhox(),0/))
-
-      ! 5. Update type
-      !--------------- 
-      Call Agrif_Set_Updatetype(tsn_id, update = AGRIF_Update_Average)
-      Call Agrif_Set_Updatetype(tsb_id, update = AGRIF_Update_Average)
-
-      Call Agrif_Set_Updatetype(sshn_id, update = AGRIF_Update_Average)
-      Call Agrif_Set_Updatetype(gcb_id,update = AGRIF_Update_Average)
-
-      Call Agrif_Set_Updatetype(un_id,update1 = Agrif_Update_Copy, update2 = Agrif_Update_Average)
-      Call Agrif_Set_Updatetype(vn_id,update1 = Agrif_Update_Average, update2 = Agrif_Update_Copy)
-
-      Call Agrif_Set_Updatetype(e1u_id,update1 = Agrif_Update_Copy, update2=Agrif_Update_Average)
-      Call Agrif_Set_Updatetype(e2v_id,update1 = Agrif_Update_Average, update2=Agrif_Update_Copy)
-
-   END SUBROUTINE agrif_declare_var
+#  endif         
+      ! Check passive tracer cell
+      IF( nn_dttrc .ne. 1 ) THEN
+         WRITE(*,*) 'nn_dttrc should be equal to 1'
+      ENDIF
+   ENDIF
+
+!ch   CALL Agrif_Update_trc(0)
+   nbcline_trc = 0
+   !
+   DEALLOCATE(tabtrtemp)
+   !
+END SUBROUTINE Agrif_InitValues_cont_top
+
+
+SUBROUTINE agrif_declare_var_top
+   !!----------------------------------------------------------------------
+   !!                 *** ROUTINE agrif_declare_var_top ***
+   !!
+   !! ** Purpose :: Declaration of TOP variables to be interpolated
+   !!----------------------------------------------------------------------
+   USE agrif_util
+   USE dom_oce
+   USE trc
+
+   IMPLICIT NONE
+
+   ! 1. Declaration of the type of variable which have to be interpolated
+   !---------------------------------------------------------------------
+   CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jptra/),trn_id)
+   CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jptra/),trb_id)
+   CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jptra/),tra_id)
+
+   ! 2. Type of interpolation
+   !-------------------------
+   CALL Agrif_Set_bcinterp(trn_id,interp=AGRIF_linear)
+   CALL Agrif_Set_bcinterp(tra_id,interp=AGRIF_linear)
+
+   ! 3. Location of interpolation
+   !-----------------------------
+   Call Agrif_Set_bc(trn_id,(/0,1/))
+   Call Agrif_Set_bc(tra_id,(/-3*Agrif_irhox(),0/))
+
+   ! 5. Update type
+   !--------------- 
+   Call Agrif_Set_Updatetype(trn_id, update = AGRIF_Update_Average)
+   Call Agrif_Set_Updatetype(trb_id, update = AGRIF_Update_Average)
+
+
+END SUBROUTINE agrif_declare_var_top
 # endif
-   
-# if defined key_top
-   SUBROUTINE Agrif_InitValues_cont_top
-      !!----------------------------------------------------------------------
-      !!                 *** ROUTINE Agrif_InitValues_cont_top ***
-      !!
-      !! ** Purpose :: Declaration of variables to be interpolated
-      !!----------------------------------------------------------------------
-      USE Agrif_Util
-      USE oce 
-      USE dom_oce
-      USE nemogcm
-      USE trc
-      USE in_out_manager
-      USE agrif_top_update
-      USE agrif_top_interp
-      USE agrif_top_sponge
-      !
-      IMPLICIT NONE
-      !
-      REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: tabtrtemp
-      LOGICAL :: check_namelist
-      !!----------------------------------------------------------------------
-
-      ALLOCATE( tabtrtemp(jpi,jpj,jpk,jptra) )
-      
-      
-      ! 1. Declaration of the type of variable which have to be interpolated
-      !---------------------------------------------------------------------
-      CALL agrif_declare_var_top
-
-      ! 2. First interpolations of potentially non zero fields
-      !-------------------------------------------------------
-      Agrif_SpecialValue=0.
-      Agrif_UseSpecialValue = .TRUE.
-      Call Agrif_Bc_variable(tabtrtemp,trn_id,calledweight=1.)
-      Call Agrif_Bc_variable(tabtrtemp,tra_id,calledweight=1.,procname=interptrn)
-      Agrif_UseSpecialValue = .FALSE.
-
-      ! 3. Some controls
-      !-----------------
-      check_namelist = .true.
-            
-      IF( check_namelist ) THEN
-#  if defined offline     
-         ! Check time steps
-         IF( nint(Agrif_Rhot()) * nint(rdt) .ne. Agrif_Parent(rdt) ) THEN
-            WRITE(*,*) 'incompatible time step between grids'
-            WRITE(*,*) 'parent grid value : ',Agrif_Parent(rdt)
-            WRITE(*,*) 'child  grid value : ',nint(rdt)
-            WRITE(*,*) 'value on parent grid should be : ',rdt*Agrif_Rhot()
-            STOP
-         ENDIF
-
-         ! Check run length
-         IF( Agrif_IRhot() * (Agrif_Parent(nitend)- &
-            Agrif_Parent(nit000)+1) .ne. (nitend-nit000+1) ) THEN
-            WRITE(*,*) 'incompatible run length between grids'
-            WRITE(*,*) 'parent grid value : ',(Agrif_Parent(nitend)- &
-               Agrif_Parent(nit000)+1),' time step'
-            WRITE(*,*) 'child  grid value : ', &
-               (nitend-nit000+1),' time step'
-            WRITE(*,*) 'value on child grid should be : ', &
-               Agrif_IRhot() * (Agrif_Parent(nitend)- &
-               Agrif_Parent(nit000)+1)
-            STOP
-         ENDIF
-         
-         ! Check coordinates
-         IF( ln_zps ) THEN
-            ! check parameters for partial steps 
-            IF( Agrif_Parent(e3zps_min) .ne. e3zps_min ) THEN
-               WRITE(*,*) 'incompatible e3zps_min between grids'
-               WRITE(*,*) 'parent grid :',Agrif_Parent(e3zps_min)
-               WRITE(*,*) 'child grid  :',e3zps_min
-               WRITE(*,*) 'those values should be identical'
-               STOP
-            ENDIF          
-            IF( Agrif_Parent(e3zps_rat) .ne. e3zps_rat ) THEN
-               WRITE(*,*) 'incompatible e3zps_rat between grids'
-               WRITE(*,*) 'parent grid :',Agrif_Parent(e3zps_rat)
-               WRITE(*,*) 'child grid  :',e3zps_rat
-               WRITE(*,*) 'those values should be identical'                  
-               STOP
-            ENDIF
-         ENDIF
-#  endif         
-        ! Check passive tracer cell
-        IF( nn_dttrc .ne. 1 ) THEN
-           WRITE(*,*) 'nn_dttrc should be equal to 1'
-        ENDIF
-      ENDIF
-       
-      CALL Agrif_Update_trc(0)
-      nbcline_trc = 0
-      !
-      DEALLOCATE(tabtrtemp)
-      !
-   END SUBROUTINE Agrif_InitValues_cont_top
-
-
-   SUBROUTINE agrif_declare_var_top
-      !!----------------------------------------------------------------------
-      !!                 *** ROUTINE agrif_declare_var_top ***
-      !!
-      !! ** Purpose :: Declaration of TOP variables to be interpolated
-      !!----------------------------------------------------------------------
-      USE agrif_util
-      USE dom_oce
-      USE trc
-      
-      IMPLICIT NONE
-   
-      ! 1. Declaration of the type of variable which have to be interpolated
-      !---------------------------------------------------------------------
-      CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jptra/),trn_id)
-      CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jptra/),trb_id)
-      CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jptra/),tra_id)
-#  if defined key_offline
-      CALL agrif_declare_variable((/1,2/),(/2,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),e1u_id)
-      CALL agrif_declare_variable((/2,1/),(/3,2/),(/'x','y'/),(/1,1/),(/jpi,jpj/),e2v_id)
-#  endif
-       
-      ! 2. Type of interpolation
-      !-------------------------
-      CALL Agrif_Set_bcinterp(trn_id,interp=AGRIF_linear)
-      CALL Agrif_Set_bcinterp(tra_id,interp=AGRIF_linear)
-   
-#  if defined key_offline
-      Call Agrif_Set_bcinterp(e1u_id,interp1=Agrif_linear,interp2=AGRIF_ppm)
-      Call Agrif_Set_bcinterp(e2v_id,interp1=AGRIF_ppm,interp2=Agrif_linear)
-#  endif
-
-      ! 3. Location of interpolation
-      !-----------------------------
-#  if defined key_offline
-      Call Agrif_Set_bc(e1u_id,(/0,0/))
-      Call Agrif_Set_bc(e2v_id,(/0,0/))
-#  endif
-      Call Agrif_Set_bc(trn_id,(/0,1/))
-      Call Agrif_Set_bc(tra_id,(/-3*Agrif_irhox(),0/))
-
-      ! 5. Update type
-      !--------------- 
-      Call Agrif_Set_Updatetype(trn_id, update = AGRIF_Update_Average)
-      Call Agrif_Set_Updatetype(trb_id, update = AGRIF_Update_Average)
-
-#  if defined key_offline
-      Call Agrif_Set_Updatetype(e1u_id,update1 = Agrif_Update_Copy, update2=Agrif_Update_Average)
-      Call Agrif_Set_Updatetype(e2v_id,update1 = Agrif_Update_Average, update2=Agrif_Update_Copy)
-#  endif
-
-   END SUBROUTINE agrif_declare_var_top
+
+SUBROUTINE Agrif_detect( kg, ksizex )
+   !!----------------------------------------------------------------------
+   !!   *** ROUTINE Agrif_detect ***
+   !!----------------------------------------------------------------------
+   USE Agrif_Types
+   !
+   INTEGER, DIMENSION(2) :: ksizex
+   INTEGER, DIMENSION(ksizex(1),ksizex(2)) :: kg 
+   !!----------------------------------------------------------------------
+   !
+   RETURN
+   !
+END SUBROUTINE Agrif_detect
+
+
+SUBROUTINE agrif_nemo_init
+   !!----------------------------------------------------------------------
+   !!                     *** ROUTINE agrif_init ***
+   !!----------------------------------------------------------------------
+   USE agrif_oce 
+   USE agrif_ice
+   USE in_out_manager
+   USE lib_mpp
+   IMPLICIT NONE
+   !
+   NAMELIST/namagrif/ nn_cln_update, rn_sponge_tra, rn_sponge_dyn, ln_spc_dyn
+   !!----------------------------------------------------------------------
+   !
+   REWIND( numnam )                ! Read namagrif namelist
+   READ  ( numnam, namagrif )
+   !
+   IF(lwp) THEN                    ! control print
+      WRITE(numout,*)
+      WRITE(numout,*) 'agrif_nemo_init : AGRIF parameters'
+      WRITE(numout,*) '~~~~~~~~~~~~~~~'
+      WRITE(numout,*) '   Namelist namagrif : set AGRIF parameters'
+      WRITE(numout,*) '      baroclinic update frequency       nn_cln_update = ', nn_cln_update
+      WRITE(numout,*) '      sponge coefficient for tracers    rn_sponge_tra = ', rn_sponge_tra, ' s'
+      WRITE(numout,*) '      sponge coefficient for dynamics   rn_sponge_tra = ', rn_sponge_dyn, ' s'
+      WRITE(numout,*) '      use special values for dynamics   ln_spc_dyn    = ', ln_spc_dyn
+      WRITE(numout,*) 
+   ENDIF
+   !
+   ! convert DOCTOR namelist name into OLD names
+   nbclineupdate = nn_cln_update
+   visc_tra      = rn_sponge_tra
+   visc_dyn      = rn_sponge_dyn
+   !
+   IF( agrif_oce_alloc()  > 0 )   CALL ctl_warn('agrif sol_oce_alloc: allocation of arrays failed')
+# if defined key_lim2
+   IF( agrif_ice_alloc()  > 0 )   CALL ctl_stop('agrif agrif_ice_alloc: allocation of arrays failed')
 # endif
-   
-   SUBROUTINE Agrif_detect( kg, ksizex )
-      !!----------------------------------------------------------------------
-      !!   *** ROUTINE Agrif_detect ***
-      !!----------------------------------------------------------------------
-      USE Agrif_Types
-      !
-      INTEGER, DIMENSION(2) :: ksizex
-      INTEGER, DIMENSION(ksizex(1),ksizex(2)) :: kg 
-      !!----------------------------------------------------------------------
-      !
-      RETURN
-      !
-   END SUBROUTINE Agrif_detect
-
-
-   SUBROUTINE agrif_nemo_init
-      !!----------------------------------------------------------------------
-      !!                     *** ROUTINE agrif_init ***
-      !!----------------------------------------------------------------------
-      USE agrif_oce 
-      USE in_out_manager
-      USE lib_mpp
-      IMPLICIT NONE
-      !
-      NAMELIST/namagrif/ nn_cln_update, rn_sponge_tra, rn_sponge_dyn, ln_spc_dyn
-      !!----------------------------------------------------------------------
-      !
-      REWIND( numnam )                ! Read namagrif namelist
-      READ  ( numnam, namagrif )
-      !
-      IF(lwp) THEN                    ! control print
-         WRITE(numout,*)
-         WRITE(numout,*) 'agrif_nemo_init : AGRIF parameters'
-         WRITE(numout,*) '~~~~~~~~~~~~~~~'
-         WRITE(numout,*) '   Namelist namagrif : set AGRIF parameters'
-         WRITE(numout,*) '      baroclinic update frequency       nn_cln_update = ', nn_cln_update
-         WRITE(numout,*) '      sponge coefficient for tracers    rn_sponge_tra = ', rn_sponge_tra, ' s'
-         WRITE(numout,*) '      sponge coefficient for dynamics   rn_sponge_tra = ', rn_sponge_dyn, ' s'
-         WRITE(numout,*) '      use special values for dynamics   ln_spc_dyn    = ', ln_spc_dyn
-         WRITE(numout,*) 
-      ENDIF
-      !
-      ! convert DOCTOR namelist name into OLD names
-      nbclineupdate = nn_cln_update
-      visc_tra      = rn_sponge_tra
-      visc_dyn      = rn_sponge_dyn
-      !
-      IF( agrif_oce_alloc()  > 0 )   CALL ctl_warn('agrif sol_oce_alloc: allocation of arrays failed')
-      !
-    END SUBROUTINE agrif_nemo_init
+   !
+END SUBROUTINE agrif_nemo_init
 
 # if defined key_mpp_mpi
 
-   SUBROUTINE Agrif_InvLoc( indloc, nprocloc, i, indglob )
-      !!----------------------------------------------------------------------
-      !!                     *** ROUTINE Agrif_detect ***
-      !!----------------------------------------------------------------------
-      USE dom_oce
-      IMPLICIT NONE
-      !
-      INTEGER :: indglob, indloc, nprocloc, i
-      !!----------------------------------------------------------------------
-      !
-      SELECT CASE( i )
-      CASE(1)   ;   indglob = indloc + nimppt(nprocloc+1) - 1
-      CASE(2)   ;   indglob = indloc + njmppt(nprocloc+1) - 1 
-      CASE(3)   ;   indglob = indloc
-      CASE(4)   ;   indglob = indloc
-      END SELECT
-      !
-   END SUBROUTINE Agrif_InvLoc
+SUBROUTINE Agrif_InvLoc( indloc, nprocloc, i, indglob )
+   !!----------------------------------------------------------------------
+   !!                     *** ROUTINE Agrif_detect ***
+   !!----------------------------------------------------------------------
+   USE dom_oce
+   IMPLICIT NONE
+   !
+   INTEGER :: indglob, indloc, nprocloc, i
+   !!----------------------------------------------------------------------
+   !
+   SELECT CASE( i )
+   CASE(1)   ;   indglob = indloc + nimppt(nprocloc+1) - 1
+   CASE(2)   ;   indglob = indloc + njmppt(nprocloc+1) - 1 
+   CASE(3)   ;   indglob = indloc
+   CASE(4)   ;   indglob = indloc
+   END SELECT
+   !
+END SUBROUTINE Agrif_InvLoc
 
 # endif
 
 #else
-   SUBROUTINE Subcalledbyagrif
-      !!----------------------------------------------------------------------
-      !!                   *** ROUTINE Subcalledbyagrif ***
-      !!----------------------------------------------------------------------
-      WRITE(*,*) 'Impossible to be here'
-   END SUBROUTINE Subcalledbyagrif
+SUBROUTINE Subcalledbyagrif
+   !!----------------------------------------------------------------------
+   !!                   *** ROUTINE Subcalledbyagrif ***
+   !!----------------------------------------------------------------------
+   WRITE(*,*) 'Impossible to be here'
+END SUBROUTINE Subcalledbyagrif
 #endif
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OFF_SRC/domrea.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OFF_SRC/domrea.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OFF_SRC/domrea.F90	(revision 3680)
@@ -113,4 +113,9 @@
          CALL iom_get( inum2, jpdom_data, 'vmask', vmask )
          CALL iom_get( inum2, jpdom_data, 'fmask', fmask )
+
+         CALL lbc_lnk( tmask, 'T', 1._wp )    ! Lateral boundary conditions
+         CALL lbc_lnk( umask, 'U', 1._wp )      
+         CALL lbc_lnk( vmask, 'V', 1._wp )
+         CALL lbc_lnk( fmask, 'F', 1._wp )
 
 #if defined key_c1d
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OFF_SRC/dtadyn.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OFF_SRC/dtadyn.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OFF_SRC/dtadyn.F90	(revision 3680)
@@ -61,4 +61,5 @@
    INTEGER  , SAVE      ::   jf_mld         ! index of mixed layer deptht
    INTEGER  , SAVE      ::   jf_emp         ! index of water flux
+   INTEGER  , SAVE      ::   jf_emps        ! index of water flux - concentr/dilution
    INTEGER  , SAVE      ::   jf_qsr         ! index of solar radiation
    INTEGER  , SAVE      ::   jf_wnd         ! index of wind speed
@@ -242,13 +243,13 @@
       ENDIF
       !
-      tsn(:,:,:,jp_tem) = sf_dyn(jf_tem)%fnow(:,:,:) * tmask(:,:,:)    ! temperature
-      tsn(:,:,:,jp_sal) = sf_dyn(jf_sal)%fnow(:,:,:) * tmask(:,:,:)    ! salinity
+      tsn(:,:,:,jp_tem) = sf_dyn(jf_tem)%fnow(:,:,:)  * tmask(:,:,:)    ! temperature
+      tsn(:,:,:,jp_sal) = sf_dyn(jf_sal)%fnow(:,:,:)  * tmask(:,:,:)    ! salinity
       !
       CALL eos    ( tsn, rhd, rhop )                                       ! In any case, we need rhop
       CALL zdf_mxl( kt )                                                   ! In any case, we need mxl 
       !
-      avt(:,:,:)       = sf_dyn(jf_avt)%fnow(:,:,:) * tmask(:,:,:)    ! vertical diffusive coefficient 
-      un (:,:,:)       = sf_dyn(jf_uwd)%fnow(:,:,:) * umask(:,:,:)    ! u-velocity
-      vn (:,:,:)       = sf_dyn(jf_vwd)%fnow(:,:,:) * vmask(:,:,:)    ! v-velocity 
+      avt(:,:,:)       = sf_dyn(jf_avt)%fnow(:,:,:)  * tmask(:,:,:)    ! vertical diffusive coefficient 
+      un (:,:,:)       = sf_dyn(jf_uwd)%fnow(:,:,:)  * umask(:,:,:)    ! u-velocity
+      vn (:,:,:)       = sf_dyn(jf_vwd)%fnow(:,:,:)  * vmask(:,:,:)    ! v-velocity 
       IF( .NOT.ln_dynwzv ) &                                          ! w-velocity read in file 
          wn (:,:,:)    = sf_dyn(jf_wwd)%fnow(:,:,:) * tmask(:,:,:)    
@@ -305,4 +306,5 @@
          CALL prt_ctl(tab2d_1=hmld             , clinfo1=' hmld    - : ', mask1=tmask, ovlap=1 )
          CALL prt_ctl(tab2d_1=sfx              , clinfo1=' sfx     - : ', mask1=tmask, ovlap=1 )
+         CALL prt_ctl(tab2d_1=emp              , clinfo1=' emp     - : ', mask1=tmask, ovlap=1 )
          CALL prt_ctl(tab2d_1=wndm             , clinfo1=' wspd    - : ', mask1=tmask, ovlap=1 )
          CALL prt_ctl(tab2d_1=qsr              , clinfo1=' qsr     - : ', mask1=tmask, ovlap=1 )
@@ -349,5 +351,6 @@
       sn_sal  = FLD_N( 'dyna_grid_T' ,    120    , 'vosaline' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
       sn_mld  = FLD_N( 'dyna_grid_T' ,    120    , 'somixght' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
-      sn_emp  = FLD_N( 'dyna_grid_T' ,    120    , 'sowaflcd' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
+      sn_emp  = FLD_N( 'dyna_grid_T' ,    120    , 'sowaflup' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
+      sn_emps = FLD_N( 'dyna_grid_T' ,    120    , 'sowaflcd' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
 !!    sn_emp  = FLD_N( 'dyna_grid_T' ,    120    , 'sowaflup' ,  .true.    , .true. ,   'yearly'  , ''       , ''         ) ! v3.5+
       sn_sfx  = FLD_N( 'dyna_grid_T' ,    120    , 'sosfldow' ,  .true.    , .true. ,   'yearly'  , ''       , ''         ) ! v3.5+
@@ -392,39 +395,39 @@
       ENDIF
 
-      jf_tem = 1   ;   jf_sal = 2   ;  jf_mld = 3   ;  jf_emp = 4   ;   jf_ice = 5   ;   jf_qsr = 6 
-      jf_wnd = 7   ;   jf_uwd = 8   ;  jf_vwd = 9   ;  jf_wwd = 10  ;   jf_avt = 11  ;   jfld  = 11
-      !
-      slf_d(jf_tem) = sn_tem   ;   slf_d(jf_sal) = sn_sal   ;   slf_d(jf_mld) = sn_mld
-      slf_d(jf_emp) = sn_emp   ;   slf_d(jf_ice) = sn_ice   ;   slf_d(jf_qsr) = sn_qsr
-      slf_d(jf_wnd) = sn_wnd   ;   slf_d(jf_uwd) = sn_uwd   ;   slf_d(jf_vwd) = sn_vwd
-      slf_d(jf_wwd) = sn_wwd   ;   slf_d(jf_avt) = sn_avt 
+      jf_tem = 1   ;   jf_sal = 2   ;  jf_mld = 3   ;  jf_emp = 4   ;   jf_emps = 5   ;  jf_ice = 6   ;   jf_qsr = 7
+      jf_wnd = 8   ;   jf_uwd = 9   ;  jf_vwd = 10  ;  jf_wwd = 11  ;   jf_avt  = 12  ;  jfld  = 12
+      !
+      slf_d(jf_tem) = sn_tem   ;   slf_d(jf_sal)  = sn_sal   ;   slf_d(jf_mld) = sn_mld
+      slf_d(jf_emp) = sn_emp   ;   slf_d(jf_emps) = sn_emps  ;   slf_d(jf_ice) = sn_ice 
+      slf_d(jf_qsr) = sn_qsr   ;   slf_d(jf_wnd)  = sn_wnd   ;   slf_d(jf_avt) = sn_avt 
+      slf_d(jf_uwd) = sn_uwd   ;   slf_d(jf_vwd)  = sn_vwd   ;   slf_d(jf_wwd) = sn_wwd
       !
       IF( .NOT.ln_degrad ) THEN     ! no degrad option
          IF( lk_traldf_eiv .AND. ln_dynbbl ) THEN        ! eiv & bbl
-                 jf_ubl  = 12      ;         jf_vbl  = 13      ;         jf_eiw  = 14   ;   jfld = 14
+                 jf_ubl  = 13      ;         jf_vbl  = 14      ;         jf_eiw  = 15   ;   jfld = 15
            slf_d(jf_ubl) = sn_ubl  ;   slf_d(jf_vbl) = sn_vbl  ;   slf_d(jf_eiw) = sn_eiw
          ENDIF
          IF( .NOT.lk_traldf_eiv .AND. ln_dynbbl ) THEN   ! no eiv & bbl
-                 jf_ubl  = 12      ;         jf_vbl  = 13      ;   jfld = 13
+                 jf_ubl  = 13      ;         jf_vbl  = 14      ;   jfld = 14
            slf_d(jf_ubl) = sn_ubl  ;   slf_d(jf_vbl) = sn_vbl
          ENDIF
          IF( lk_traldf_eiv .AND. .NOT.ln_dynbbl ) THEN   ! eiv & no bbl
-           jf_eiw = 12   ;   jfld = 12   ;   slf_d(jf_eiw) = sn_eiw
+           jf_eiw = 13   ;   jfld = 13   ;   slf_d(jf_eiw) = sn_eiw
          ENDIF
       ELSE
-              jf_ahu  = 12      ;         jf_ahv  = 13      ;         jf_ahw  = 14   ;   jfld = 14
+              jf_ahu  = 13      ;         jf_ahv  = 14      ;         jf_ahw  = 15   ;   jfld = 15
         slf_d(jf_ahu) = sn_ahu  ;   slf_d(jf_ahv) = sn_ahv  ;   slf_d(jf_ahw) = sn_ahw
         IF( lk_traldf_eiv .AND. ln_dynbbl ) THEN         ! eiv & bbl
-                 jf_ubl  = 15      ;         jf_vbl  = 16      
+                 jf_ubl  = 16      ;         jf_vbl  = 17      
            slf_d(jf_ubl) = sn_ubl  ;   slf_d(jf_vbl) = sn_vbl  
-                 jf_eiu  = 17      ;         jf_eiv  = 18      ;          jf_eiw  = 19   ;   jfld = 19
+                 jf_eiu  = 18      ;         jf_eiv  = 19      ;          jf_eiw  = 20   ;   jfld = 20
            slf_d(jf_eiu) = sn_eiu  ;   slf_d(jf_eiv) = sn_eiv  ;    slf_d(jf_eiw) = sn_eiw
         ENDIF
         IF( .NOT.lk_traldf_eiv .AND. ln_dynbbl ) THEN    ! no eiv & bbl
-                 jf_ubl  = 15      ;         jf_vbl  = 16      ;   jfld = 16
+                 jf_ubl  = 16      ;         jf_vbl  = 17      ;   jfld = 17
            slf_d(jf_ubl) = sn_ubl  ;   slf_d(jf_vbl) = sn_vbl
         ENDIF
         IF( lk_traldf_eiv .AND. .NOT.ln_dynbbl ) THEN    ! eiv & no bbl
-                 jf_eiu  = 15      ;         jf_eiv  = 16      ;         jf_eiw  = 17   ;   jfld = 17
+                 jf_eiu  = 16      ;         jf_eiv  = 17      ;         jf_eiw  = 18   ;   jfld = 18
            slf_d(jf_eiu) = sn_eiu  ;   slf_d(jf_eiv) = sn_eiv  ;   slf_d(jf_eiw) = sn_eiw
         ENDIF
@@ -440,5 +443,5 @@
       ! Open file for each variable to get his number of dimension
       DO ifpr = 1, jfld
-         CALL iom_open( slf_d(ifpr)%clname, inum )
+         CALL iom_open( TRIM( cn_dir )//TRIM( slf_d(ifpr)%clname ), inum )
          idv   = iom_varid( inum , slf_d(ifpr)%clvar )  ! id of the variable sdjf%clvar
          idimv = iom_file ( inum )%ndims(idv)             ! number of dimension for variable sdjf%clvar
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OFF_SRC/nemogcm.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OFF_SRC/nemogcm.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OFF_SRC/nemogcm.F90	(revision 3680)
@@ -184,8 +184,8 @@
          !
          WRITE(numout,*)
-         WRITE(numout,*) '         CNRS - NERC - Met OFFICE - MERCATOR-ocean'
+         WRITE(numout,*) '   CNRS - NERC - Met OFFICE - MERCATOR-ocean - INGV - CMCC'
          WRITE(numout,*) '                       NEMO team'
          WRITE(numout,*) '            Ocean General Circulation Model'
-         WRITE(numout,*) '                  version 3.3  (2010) '
+         WRITE(numout,*) '                  version 3.5  (2012) '
          WRITE(numout,*)
          WRITE(numout,*)
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn2d.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn2d.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn2d.F90	(revision 3680)
@@ -5,4 +5,5 @@
    !!======================================================================
    !! History :  3.4  !  2011     (D. Storkey) new module as part of BDY rewrite
+   !!            3.5  !  2012     (S. Mocavero, I. Epicoco) Optimization of BDY communications
    !!----------------------------------------------------------------------
 #if defined key_bdy 
@@ -51,7 +52,7 @@
             CYCLE
          CASE(jp_frs)
-            CALL bdy_dyn2d_frs( idx_bdy(ib_bdy), dta_bdy(ib_bdy) )
+            CALL bdy_dyn2d_frs( idx_bdy(ib_bdy), dta_bdy(ib_bdy), ib_bdy )
          CASE(jp_flather)
-            CALL bdy_dyn2d_fla( idx_bdy(ib_bdy), dta_bdy(ib_bdy) )
+            CALL bdy_dyn2d_fla( idx_bdy(ib_bdy), dta_bdy(ib_bdy), ib_bdy )
          CASE DEFAULT
             CALL ctl_stop( 'bdy_dyn2d : unrecognised option for open boundaries for barotropic variables' )
@@ -61,5 +62,5 @@
    END SUBROUTINE bdy_dyn2d
 
-   SUBROUTINE bdy_dyn2d_frs( idx, dta )
+   SUBROUTINE bdy_dyn2d_frs( idx, dta, ib_bdy )
       !!----------------------------------------------------------------------
       !!                  ***  SUBROUTINE bdy_dyn2d_frs  ***
@@ -74,4 +75,5 @@
       TYPE(OBC_INDEX), INTENT(in) ::   idx  ! OBC indices
       TYPE(OBC_DATA),  INTENT(in) ::   dta  ! OBC external data
+      INTEGER,         INTENT(in) ::   ib_bdy  ! BDY set index
       !!
       INTEGER  ::   jb, jk         ! dummy loop indices
@@ -97,6 +99,6 @@
          pv2d(ii,ij) = ( pv2d(ii,ij) + zwgt * ( dta%v2d(jb) - pv2d(ii,ij) ) ) * vmask(ii,ij,1)
       END DO 
-      CALL lbc_lnk( pu2d, 'U', -1. ) 
-      CALL lbc_lnk( pv2d, 'V', -1. )   ! Boundary points should be updated
+      CALL lbc_bdy_lnk( pu2d, 'U', -1., ib_bdy ) 
+      CALL lbc_bdy_lnk( pv2d, 'V', -1., ib_bdy)   ! Boundary points should be updated
       !
       IF( nn_timing == 1 ) CALL timing_stop('bdy_dyn2d_frs')
@@ -106,5 +108,5 @@
 
 
-   SUBROUTINE bdy_dyn2d_fla( idx, dta )
+   SUBROUTINE bdy_dyn2d_fla( idx, dta, ib_bdy )
       !!----------------------------------------------------------------------
       !!                 ***  SUBROUTINE bdy_dyn2d_fla  ***
@@ -127,4 +129,5 @@
       TYPE(OBC_INDEX),              INTENT(in) ::   idx  ! OBC indices
       TYPE(OBC_DATA),               INTENT(in) ::   dta  ! OBC external data
+      INTEGER,                      INTENT(in) ::   ib_bdy  ! BDY set index
 
       INTEGER  ::   jb, igrd                         ! dummy loop indices
@@ -177,6 +180,6 @@
          pv2d(ii,ij) = zforc + zcorr * vmask(ii,ij,1)
       END DO
-      CALL lbc_lnk( pu2d, 'U', -1. )   ! Boundary points should be updated
-      CALL lbc_lnk( pv2d, 'V', -1. )   !
+      CALL lbc_bdy_lnk( pu2d, 'U', -1., ib_bdy )   ! Boundary points should be updated
+      CALL lbc_bdy_lnk( pv2d, 'V', -1., ib_bdy )   !
       !
       IF( nn_timing == 1 ) CALL timing_stop('bdy_dyn2d_fla')
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn3d.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn3d.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn3d.F90	(revision 3680)
@@ -5,4 +5,5 @@
    !!======================================================================
    !! History :  3.4  !  2011     (D. Storkey) new module as part of BDY rewrite 
+   !!            3.5  !  2012     (S. Mocavero, I. Epicoco) Optimization of BDY communications
    !!----------------------------------------------------------------------
 #if defined key_bdy 
@@ -59,9 +60,9 @@
             CYCLE
          CASE(jp_frs)
-            CALL bdy_dyn3d_frs( idx_bdy(ib_bdy), dta_bdy(ib_bdy), kt )
+            CALL bdy_dyn3d_frs( idx_bdy(ib_bdy), dta_bdy(ib_bdy), kt, ib_bdy )
          CASE(2)
-            CALL bdy_dyn3d_spe( idx_bdy(ib_bdy), dta_bdy(ib_bdy), kt )
+            CALL bdy_dyn3d_spe( idx_bdy(ib_bdy), dta_bdy(ib_bdy), kt, ib_bdy )
          CASE(3)
-            CALL bdy_dyn3d_zro( idx_bdy(ib_bdy), dta_bdy(ib_bdy), kt )
+            CALL bdy_dyn3d_zro( idx_bdy(ib_bdy), dta_bdy(ib_bdy), kt, ib_bdy )
          CASE DEFAULT
             CALL ctl_stop( 'bdy_dyn3d : unrecognised option for open boundaries for baroclinic velocities' )
@@ -71,5 +72,5 @@
    END SUBROUTINE bdy_dyn3d
 
-   SUBROUTINE bdy_dyn3d_spe( idx, dta, kt )
+   SUBROUTINE bdy_dyn3d_spe( idx, dta, kt , ib_bdy )
       !!----------------------------------------------------------------------
       !!                  ***  SUBROUTINE bdy_dyn3d_spe  ***
@@ -82,4 +83,5 @@
       TYPE(OBC_INDEX), INTENT(in) ::   idx  ! OBC indices
       TYPE(OBC_DATA),  INTENT(in) ::   dta  ! OBC external data
+      INTEGER,         INTENT(in) ::   ib_bdy  ! BDY set index
       !!
       INTEGER  ::   jb, jk         ! dummy loop indices
@@ -107,5 +109,5 @@
          END DO
       END DO
-      CALL lbc_lnk( ua, 'U', -1. )   ;   CALL lbc_lnk( va, 'V', -1. )   ! Boundary points should be updated
+      CALL lbc_bdy_lnk( ua, 'U', -1., ib_bdy )   ;   CALL lbc_bdy_lnk( va, 'V', -1.,ib_bdy )   ! Boundary points should be updated
       !
       IF( kt .eq. nit000 ) CLOSE( unit = 102 )
@@ -115,5 +117,5 @@
    END SUBROUTINE bdy_dyn3d_spe
 
-   SUBROUTINE bdy_dyn3d_zro( idx, dta, kt )
+   SUBROUTINE bdy_dyn3d_zro( idx, dta, kt, ib_bdy )
       !!----------------------------------------------------------------------
       !!                  ***  SUBROUTINE bdy_dyn3d_zro  ***
@@ -125,4 +127,5 @@
       TYPE(OBC_INDEX), INTENT(in) ::   idx  ! OBC indices
       TYPE(OBC_DATA),  INTENT(in) ::   dta  ! OBC external data
+      INTEGER,         INTENT(in) ::   ib_bdy  ! BDY set index
       !!
       INTEGER  ::   ib, ik         ! dummy loop indices
@@ -151,5 +154,5 @@
       END DO
       !
-      CALL lbc_lnk( ua, 'U', -1. )   ;   CALL lbc_lnk( va, 'V', -1. )   ! Boundary points should be updated
+      CALL lbc_bdy_lnk( ua, 'U', -1., ib_bdy )   ;   CALL lbc_bdy_lnk( va, 'V', -1.,ib_bdy )   ! Boundary points should be updated
       !
       IF( kt .eq. nit000 ) CLOSE( unit = 102 )
@@ -159,5 +162,5 @@
    END SUBROUTINE bdy_dyn3d_zro
 
-   SUBROUTINE bdy_dyn3d_frs( idx, dta, kt )
+   SUBROUTINE bdy_dyn3d_frs( idx, dta, kt, ib_bdy )
       !!----------------------------------------------------------------------
       !!                  ***  SUBROUTINE bdy_dyn3d_frs  ***
@@ -173,4 +176,5 @@
       TYPE(OBC_INDEX), INTENT(in) ::   idx  ! OBC indices
       TYPE(OBC_DATA),  INTENT(in) ::   dta  ! OBC external data
+      INTEGER,         INTENT(in) ::   ib_bdy  ! BDY set index
       !!
       INTEGER  ::   jb, jk         ! dummy loop indices
@@ -200,5 +204,5 @@
          END DO
       END DO 
-      CALL lbc_lnk( ua, 'U', -1. )   ;   CALL lbc_lnk( va, 'V', -1. )   ! Boundary points should be updated
+      CALL lbc_bdy_lnk( ua, 'U', -1., ib_bdy )   ;   CALL lbc_bdy_lnk( va, 'V', -1.,ib_bdy )   ! Boundary points should be updated
       !
       IF( kt .eq. nit000 ) CLOSE( unit = 102 )
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/BDY/bdyice_lim2.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/BDY/bdyice_lim2.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/BDY/bdyice_lim2.F90	(revision 3680)
@@ -6,4 +6,5 @@
    !!  History :  3.3  !  2010-09 (D. Storkey)  Original code
    !!             3.4  !  2011    (D. Storkey) rewrite in preparation for OBC-BDY merge
+   !!             3.5  !  2012    (S. Mocavero, I. Epicoco) Optimization of BDY communications
    !!----------------------------------------------------------------------
 #if defined   key_bdy   &&   defined key_lim2
@@ -53,5 +54,5 @@
             CYCLE
          CASE(jp_frs)
-            CALL bdy_ice_frs( idx_bdy(ib_bdy), dta_bdy(ib_bdy) )
+            CALL bdy_ice_frs( idx_bdy(ib_bdy), dta_bdy(ib_bdy), ib_bdy )
          CASE DEFAULT
             CALL ctl_stop( 'bdy_ice_lim_2 : unrecognised option for open boundaries for ice fields' )
@@ -61,5 +62,5 @@
    END SUBROUTINE bdy_ice_lim_2
 
-   SUBROUTINE bdy_ice_frs( idx, dta )
+   SUBROUTINE bdy_ice_frs( idx, dta, ib_bdy )
       !!------------------------------------------------------------------------------
       !!                 ***  SUBROUTINE bdy_ice_frs  ***
@@ -73,4 +74,5 @@
       TYPE(OBC_INDEX), INTENT(in) ::   idx  ! OBC indices
       TYPE(OBC_DATA),  INTENT(in) ::   dta  ! OBC external data
+      INTEGER,         INTENT(in) ::   ib_bdy  ! BDY set index
       !!
       INTEGER  ::   jb, jk, jgrd   ! dummy loop indices
@@ -94,6 +96,6 @@
          END DO
       END DO 
-      CALL lbc_lnk( frld, 'T', 1. )                                         ! lateral boundary conditions
-      CALL lbc_lnk( hicif, 'T', 1. )   ;   CALL lbc_lnk( hsnif, 'T', 1. )
+      CALL lbc_bdy_lnk( frld, 'T', 1., ib_bdy )                                         ! lateral boundary conditions
+      CALL lbc_bdy_lnk( hicif, 'T', 1., ib_bdy )   ;   CALL lbc_bdy_lnk( hsnif, 'T', 1., ib_bdy )
       !      
       IF( nn_timing == 1 ) CALL timing_stop('bdy_ice_frs')
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/BDY/bdyini.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/BDY/bdyini.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/BDY/bdyini.F90	(revision 3680)
@@ -12,4 +12,6 @@
    !!            3.4  !  2011     (D. Storkey) rewrite in preparation for OBC-BDY merge
    !!            3.4  !  2012     (J. Chanut) straight open boundary case update
+   !!            3.5  !  2012     (S. Mocavero, I. Epicoco) Updates for the 
+   !!                             optimization of BDY communications
    !!----------------------------------------------------------------------
 #if defined key_bdy
@@ -85,4 +87,8 @@
       INTEGER, ALLOCATABLE, DIMENSION(:,:,:)  ::   nbrdta           ! Discrete distance from rim points
       CHARACTER(LEN=1),DIMENSION(jpbgrd)      ::   cgrid
+      INTEGER :: com_east, com_west, com_south, com_north          ! Flags for boundaries sending
+      INTEGER :: com_east_b, com_west_b, com_south_b, com_north_b  ! Flags for boundaries receiving
+      INTEGER :: iw_b(4), ie_b(4), is_b(4), in_b(4)                ! Arrays for neighbours coordinates
+
       !!
       NAMELIST/nambdy/ nb_bdy, ln_coords_file, cn_coords_file,             &
@@ -673,4 +679,58 @@
       in = mjg(1) + nlcj - jpjzoom - 1  ! if monotasking and no zoom, in=jpjm1
 
+      ALLOCATE( nbondi_bdy(nb_bdy))
+      ALLOCATE( nbondj_bdy(nb_bdy))
+      nbondi_bdy(:)=2
+      nbondj_bdy(:)=2
+      ALLOCATE( nbondi_bdy_b(nb_bdy))
+      ALLOCATE( nbondj_bdy_b(nb_bdy))
+      nbondi_bdy_b(:)=2
+      nbondj_bdy_b(:)=2
+
+      ! Work out dimensions of boundary data on each neighbour process
+      IF(nbondi .eq. 0) THEN
+         iw_b(1) = jpizoom + nimppt(nowe+1)
+         ie_b(1) = jpizoom + nimppt(nowe+1)+nlcit(nowe+1)-3
+         is_b(1) = jpjzoom + njmppt(nowe+1)
+         in_b(1) = jpjzoom + njmppt(nowe+1)+nlcjt(nowe+1)-3
+
+         iw_b(2) = jpizoom + nimppt(noea+1)
+         ie_b(2) = jpizoom + nimppt(noea+1)+nlcit(noea+1)-3
+         is_b(2) = jpjzoom + njmppt(noea+1)
+         in_b(2) = jpjzoom + njmppt(noea+1)+nlcjt(noea+1)-3
+      ELSEIF(nbondi .eq. 1) THEN
+         iw_b(1) = jpizoom + nimppt(nowe+1)
+         ie_b(1) = jpizoom + nimppt(nowe+1)+nlcit(nowe+1)-3
+         is_b(1) = jpjzoom + njmppt(nowe+1)
+         in_b(1) = jpjzoom + njmppt(nowe+1)+nlcjt(nowe+1)-3
+      ELSEIF(nbondi .eq. -1) THEN
+         iw_b(2) = jpizoom + nimppt(noea+1)
+         ie_b(2) = jpizoom + nimppt(noea+1)+nlcit(noea+1)-3
+         is_b(2) = jpjzoom + njmppt(noea+1)
+         in_b(2) = jpjzoom + njmppt(noea+1)+nlcjt(noea+1)-3
+      ENDIF
+
+      IF(nbondj .eq. 0) THEN
+         iw_b(3) = jpizoom + nimppt(noso+1)
+         ie_b(3) = jpizoom + nimppt(noso+1)+nlcit(noso+1)-3
+         is_b(3) = jpjzoom + njmppt(noso+1)
+         in_b(3) = jpjzoom + njmppt(noso+1)+nlcjt(noso+1)-3
+
+         iw_b(4) = jpizoom + nimppt(nono+1)
+         ie_b(4) = jpizoom + nimppt(nono+1)+nlcit(nono+1)-3
+         is_b(4) = jpjzoom + njmppt(nono+1)
+         in_b(4) = jpjzoom + njmppt(nono+1)+nlcjt(nono+1)-3
+      ELSEIF(nbondj .eq. 1) THEN
+         iw_b(3) = jpizoom + nimppt(noso+1)
+         ie_b(3) = jpizoom + nimppt(noso+1)+nlcit(noso+1)-3
+         is_b(3) = jpjzoom + njmppt(noso+1)
+         in_b(3) = jpjzoom + njmppt(noso+1)+nlcjt(noso+1)-3
+      ELSEIF(nbondj .eq. -1) THEN
+         iw_b(4) = jpizoom + nimppt(nono+1)
+         ie_b(4) = jpizoom + nimppt(nono+1)+nlcit(nono+1)-3
+         is_b(4) = jpjzoom + njmppt(nono+1)
+         in_b(4) = jpjzoom + njmppt(nono+1)+nlcjt(nono+1)-3
+      ENDIF
+
       DO ib_bdy = 1, nb_bdy
          DO igrd = 1, jpbgrd
@@ -716,4 +776,13 @@
          ! -----------------------------------------------------------------
 
+         com_east = 0
+         com_west = 0
+         com_south = 0
+         com_north = 0
+
+         com_east_b = 0
+         com_west_b = 0
+         com_south_b = 0
+         com_north_b = 0
          DO igrd = 1, jpbgrd
             icount  = 0
@@ -734,10 +803,171 @@
                      idx_bdy(ib_bdy)%nbi(icount,igrd)   = nbidta(ib,igrd,ib_bdy)- mig(1)+jpizoom
                      idx_bdy(ib_bdy)%nbj(icount,igrd)   = nbjdta(ib,igrd,ib_bdy)- mjg(1)+jpjzoom
+                     ! check if point has to be sent
+                     ii = idx_bdy(ib_bdy)%nbi(icount,igrd)
+                     ij = idx_bdy(ib_bdy)%nbj(icount,igrd)
+                     if((com_east .ne. 1) .and. (ii .eq. (nlci-1)) .and. (nbondi .le. 0)) then
+                        com_east = 1
+                     elseif((com_west .ne. 1) .and. (ii .eq. 2) .and. (nbondi .ge. 0) .and. (nbondi .ne. 2)) then
+                        com_west = 1
+                     endif 
+                     if((com_south .ne. 1) .and. (ij .eq. 2) .and. (nbondj .ge. 0) .and. (nbondj .ne. 2)) then
+                        com_south = 1
+                     elseif((com_north .ne. 1) .and. (ij .eq. (nlcj-1)) .and. (nbondj .le. 0)) then
+                        com_north = 1
+                     endif 
                      idx_bdy(ib_bdy)%nbr(icount,igrd)   = nbrdta(ib,igrd,ib_bdy)
                      idx_bdy(ib_bdy)%nbmap(icount,igrd) = ib
                   ENDIF
+                  ! check if point has to be received from a neighbour
+                  IF(nbondi .eq. 0) THEN
+                     IF( nbidta(ib,igrd,ib_bdy) >= iw_b(1) .AND. nbidta(ib,igrd,ib_bdy) <= ie_b(1) .AND.   &
+                       & nbjdta(ib,igrd,ib_bdy) >= is_b(1) .AND. nbjdta(ib,igrd,ib_bdy) <= in_b(1) .AND.   &
+                       & nbrdta(ib,igrd,ib_bdy) == ir  ) THEN
+                       ii = nbidta(ib,igrd,ib_bdy)- iw_b(1)+2
+                       if((com_west_b .ne. 1) .and. (ii .eq. (nlcit(nowe+1)-1))) then
+                          ij = nbjdta(ib,igrd,ib_bdy) - is_b(1)+2
+                          if((ij .eq. 2) .and. (nbondj .eq. 0 .or. nbondj .eq. 1)) then
+                            com_south = 1
+                          elseif((ij .eq. nlcjt(nowe+1)-1) .and. (nbondj .eq. 0 .or. nbondj .eq. -1)) then
+                            com_north = 1
+                          endif
+                          com_west_b = 1
+                       endif 
+                     ENDIF
+                     IF( nbidta(ib,igrd,ib_bdy) >= iw_b(2) .AND. nbidta(ib,igrd,ib_bdy) <= ie_b(2) .AND.   &
+                       & nbjdta(ib,igrd,ib_bdy) >= is_b(2) .AND. nbjdta(ib,igrd,ib_bdy) <= in_b(2) .AND.   &
+                       & nbrdta(ib,igrd,ib_bdy) == ir  ) THEN
+                       ii = nbidta(ib,igrd,ib_bdy)- iw_b(2)+2
+                       if((com_east_b .ne. 1) .and. (ii .eq. 2)) then
+                          ij = nbjdta(ib,igrd,ib_bdy) - is_b(2)+2
+                          if((ij .eq. 2) .and. (nbondj .eq. 0 .or. nbondj .eq. 1)) then
+                            com_south = 1
+                          elseif((ij .eq. nlcjt(noea+1)-1) .and. (nbondj .eq. 0 .or. nbondj .eq. -1)) then
+                            com_north = 1
+                          endif
+                          com_east_b = 1
+                       endif 
+                     ENDIF
+                  ELSEIF(nbondi .eq. 1) THEN
+                     IF( nbidta(ib,igrd,ib_bdy) >= iw_b(1) .AND. nbidta(ib,igrd,ib_bdy) <= ie_b(1) .AND.   &
+                       & nbjdta(ib,igrd,ib_bdy) >= is_b(1) .AND. nbjdta(ib,igrd,ib_bdy) <= in_b(1) .AND.   &
+                       & nbrdta(ib,igrd,ib_bdy) == ir  ) THEN
+                       ii = nbidta(ib,igrd,ib_bdy)- iw_b(1)+2
+                       if((com_west_b .ne. 1) .and. (ii .eq. (nlcit(nowe+1)-1))) then
+                          ij = nbjdta(ib,igrd,ib_bdy) - is_b(1)+2
+                          if((ij .eq. 2) .and. (nbondj .eq. 0 .or. nbondj .eq. 1)) then
+                            com_south = 1
+                          elseif((ij .eq. nlcjt(nowe+1)-1) .and. (nbondj .eq. 0 .or. nbondj .eq. -1)) then
+                            com_north = 1
+                          endif
+                          com_west_b = 1
+                       endif 
+                     ENDIF
+                  ELSEIF(nbondi .eq. -1) THEN
+                     IF( nbidta(ib,igrd,ib_bdy) >= iw_b(2) .AND. nbidta(ib,igrd,ib_bdy) <= ie_b(2) .AND.   &
+                       & nbjdta(ib,igrd,ib_bdy) >= is_b(2) .AND. nbjdta(ib,igrd,ib_bdy) <= in_b(2) .AND.   &
+                       & nbrdta(ib,igrd,ib_bdy) == ir  ) THEN
+                       ii = nbidta(ib,igrd,ib_bdy)- iw_b(2)+2
+                       if((com_east_b .ne. 1) .and. (ii .eq. 2)) then
+                          ij = nbjdta(ib,igrd,ib_bdy) - is_b(2)+2
+                          if((ij .eq. 2) .and. (nbondj .eq. 0 .or. nbondj .eq. 1)) then
+                            com_south = 1
+                          elseif((ij .eq. nlcjt(noea+1)-1) .and. (nbondj .eq. 0 .or. nbondj .eq. -1)) then
+                            com_north = 1
+                          endif
+                          com_east_b = 1
+                       endif 
+                     ENDIF
+                  ENDIF
+                  IF(nbondj .eq. 0) THEN
+                     IF(com_north_b .ne. 1 .AND. (nbidta(ib,igrd,ib_bdy) == iw_b(4)-1 .OR. nbidta(ib,igrd,ib_bdy) == ie_b(4)+1) .AND. &
+                       & nbjdta(ib,igrd,ib_bdy) == is_b(4) .AND. nbrdta(ib,igrd,ib_bdy) == ir) THEN
+                       com_north_b = 1 
+                     ENDIF
+                     IF(com_south_b .ne. 1 .AND. (nbidta(ib,igrd,ib_bdy) == iw_b(3)-1 .OR. nbidta(ib,igrd,ib_bdy) == ie_b(3)+1) .AND. &
+                       & nbjdta(ib,igrd,ib_bdy) == in_b(3) .AND. nbrdta(ib,igrd,ib_bdy) == ir) THEN
+                       com_south_b = 1 
+                     ENDIF
+                     IF( nbidta(ib,igrd,ib_bdy) >= iw_b(3) .AND. nbidta(ib,igrd,ib_bdy) <= ie_b(3) .AND.   &
+                       & nbjdta(ib,igrd,ib_bdy) >= is_b(3) .AND. nbjdta(ib,igrd,ib_bdy) <= in_b(3) .AND.   &
+                       & nbrdta(ib,igrd,ib_bdy) == ir  ) THEN
+                       ij = nbjdta(ib,igrd,ib_bdy)- is_b(3)+2
+                       if((com_south_b .ne. 1) .and. (ij .eq. (nlcjt(noso+1)-1))) then
+                          com_south_b = 1
+                       endif 
+                     ENDIF
+                     IF( nbidta(ib,igrd,ib_bdy) >= iw_b(4) .AND. nbidta(ib,igrd,ib_bdy) <= ie_b(4) .AND.   &
+                       & nbjdta(ib,igrd,ib_bdy) >= is_b(4) .AND. nbjdta(ib,igrd,ib_bdy) <= in_b(4) .AND.   &
+                       & nbrdta(ib,igrd,ib_bdy) == ir  ) THEN
+                       ij = nbjdta(ib,igrd,ib_bdy)- is_b(4)+2
+                       if((com_north_b .ne. 1) .and. (ij .eq. 2)) then
+                          com_north_b = 1
+                       endif 
+                     ENDIF
+                  ELSEIF(nbondj .eq. 1) THEN
+                     IF(com_south_b .ne. 1 .AND. (nbidta(ib,igrd,ib_bdy) == iw_b(3)-1 .OR. nbidta(ib,igrd,ib_bdy) == ie_b(3)+1) .AND. &
+                       & nbjdta(ib,igrd,ib_bdy) == in_b(3) .AND. nbrdta(ib,igrd,ib_bdy) == ir) THEN
+                       com_south_b = 1 
+                     ENDIF
+                     IF( nbidta(ib,igrd,ib_bdy) >= iw_b(3) .AND. nbidta(ib,igrd,ib_bdy) <= ie_b(3) .AND.   &
+                       & nbjdta(ib,igrd,ib_bdy) >= is_b(3) .AND. nbjdta(ib,igrd,ib_bdy) <= in_b(3) .AND.   &
+                       & nbrdta(ib,igrd,ib_bdy) == ir  ) THEN
+                       ij = nbjdta(ib,igrd,ib_bdy)- is_b(3)+2
+                       if((com_south_b .ne. 1) .and. (ij .eq. (nlcjt(noso+1)-1))) then
+                          com_south_b = 1
+                       endif 
+                     ENDIF
+                  ELSEIF(nbondj .eq. -1) THEN
+                     IF(com_north_b .ne. 1 .AND. (nbidta(ib,igrd,ib_bdy) == iw_b(4)-1 .OR. nbidta(ib,igrd,ib_bdy) == ie_b(4)+1) .AND. &
+                       & nbjdta(ib,igrd,ib_bdy) == is_b(4) .AND. nbrdta(ib,igrd,ib_bdy) == ir) THEN
+                       com_north_b = 1 
+                     ENDIF
+                     IF( nbidta(ib,igrd,ib_bdy) >= iw_b(4) .AND. nbidta(ib,igrd,ib_bdy) <= ie_b(4) .AND.   &
+                       & nbjdta(ib,igrd,ib_bdy) >= is_b(4) .AND. nbjdta(ib,igrd,ib_bdy) <= in_b(4) .AND.   &
+                       & nbrdta(ib,igrd,ib_bdy) == ir  ) THEN
+                       ij = nbjdta(ib,igrd,ib_bdy)- is_b(4)+2
+                       if((com_north_b .ne. 1) .and. (ij .eq. 2)) then
+                          com_north_b = 1
+                       endif 
+                     ENDIF
+                  ENDIF
                ENDDO
             ENDDO
          ENDDO 
+         ! definition of the i- and j- direction local boundaries arrays
+         ! used for sending the boudaries
+         IF((com_east .eq. 1) .and. (com_west .eq. 1)) THEN
+            nbondi_bdy(ib_bdy) = 0
+         ELSEIF ((com_east .eq. 1) .and. (com_west .eq. 0)) THEN
+            nbondi_bdy(ib_bdy) = -1
+         ELSEIF ((com_east .eq. 0) .and. (com_west .eq. 1)) THEN
+            nbondi_bdy(ib_bdy) = 1
+         ENDIF
+
+         IF((com_north .eq. 1) .and. (com_south .eq. 1)) THEN
+            nbondj_bdy(ib_bdy) = 0
+         ELSEIF ((com_north .eq. 1) .and. (com_south .eq. 0)) THEN
+            nbondj_bdy(ib_bdy) = -1
+         ELSEIF ((com_north .eq. 0) .and. (com_south .eq. 1)) THEN
+            nbondj_bdy(ib_bdy) = 1
+         ENDIF
+
+         ! definition of the i- and j- direction local boundaries arrays
+         ! used for receiving the boudaries
+         IF((com_east_b .eq. 1) .and. (com_west_b .eq. 1)) THEN
+            nbondi_bdy_b(ib_bdy) = 0
+         ELSEIF ((com_east_b .eq. 1) .and. (com_west_b .eq. 0)) THEN
+            nbondi_bdy_b(ib_bdy) = -1
+         ELSEIF ((com_east_b .eq. 0) .and. (com_west_b .eq. 1)) THEN
+            nbondi_bdy_b(ib_bdy) = 1
+         ENDIF
+
+         IF((com_north_b .eq. 1) .and. (com_south_b .eq. 1)) THEN
+            nbondj_bdy_b(ib_bdy) = 0
+         ELSEIF ((com_north_b .eq. 1) .and. (com_south_b .eq. 0)) THEN
+            nbondj_bdy_b(ib_bdy) = -1
+         ELSEIF ((com_north_b .eq. 0) .and. (com_south_b .eq. 1)) THEN
+            nbondj_bdy_b(ib_bdy) = 1
+         ENDIF
 
          ! Compute rim weights for FRS scheme
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/BDY/bdytra.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/BDY/bdytra.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/BDY/bdytra.F90	(revision 3680)
@@ -7,4 +7,5 @@
    !!            3.0  !  2008-04  (NEMO team)  add in the reference version
    !!            3.4  !  2011     (D. Storkey) rewrite in preparation for OBC-BDY merge
+   !!            3.5  !  2012     (S. Mocavero, I. Epicoco) Optimization of BDY communications
    !!----------------------------------------------------------------------
 #if defined key_bdy
@@ -54,5 +55,5 @@
             CYCLE
          CASE(jp_frs)
-            CALL bdy_tra_frs( idx_bdy(ib_bdy), dta_bdy(ib_bdy), kt )
+            CALL bdy_tra_frs( idx_bdy(ib_bdy), dta_bdy(ib_bdy), kt, ib_bdy )
          CASE(2)
             CALL bdy_tra_spe( idx_bdy(ib_bdy), dta_bdy(ib_bdy), kt )
@@ -72,5 +73,5 @@
    END SUBROUTINE bdy_tra
 
-   SUBROUTINE bdy_tra_frs( idx, dta, kt )
+   SUBROUTINE bdy_tra_frs( idx, dta, kt, ib_bdy )
       !!----------------------------------------------------------------------
       !!                 ***  SUBROUTINE bdy_tra_frs  ***
@@ -83,4 +84,5 @@
       TYPE(OBC_INDEX), INTENT(in) ::   idx  ! OBC indices
       TYPE(OBC_DATA),  INTENT(in) ::   dta  ! OBC external data
+      INTEGER,         INTENT(in) ::   ib_bdy  ! BDY set index
       !! 
       REAL(wp) ::   zwgt           ! boundary weight
@@ -101,4 +103,5 @@
          END DO
       END DO 
+      CALL lbc_bdy_lnk( tsa(:,:,:,jp_tem), 'T', 1., ib_bdy )   ; CALL lbc_bdy_lnk( tsa(:,:,:,jp_sal), 'T', 1., ib_bdy )    ! Boundary points should be updated
       !
       IF( kt .eq. nit000 ) CLOSE( unit = 102 )
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/C1D/step_c1d.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/C1D/step_c1d.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/C1D/step_c1d.F90	(revision 3680)
@@ -19,4 +19,5 @@
    USE dyncor_c1d      ! Coriolis term (c1d case)         (dyn_cor_1d     )
    USE dynnxt_c1d      ! time-stepping                    (dyn_nxt routine)
+   USE restart         ! restart 
 
    IMPLICIT NONE
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90	(revision 3680)
@@ -21,11 +21,11 @@
   !!----------------------------------------------------------------------
   !!----------------------------------------------------------------------
-  !!   dia_dct      :  compute the transport through a sec.
-  !!   dia_dct_init :  read namelist.
-  !!   readsec      :  read sections description and pathway
-  !!   removepoints :  remove points which are common to 2 procs
+  !!   dia_dct      :  Compute the transport through a sec.
+  !!   dia_dct_init :  Read namelist.
+  !!   readsec      :  Read sections description and pathway
+  !!   removepoints :  Remove points which are common to 2 procs
   !!   transport    :  Compute transport for each sections
-  !!   dia_dct_wri  :  write tranports results in ascii files
-  !!   interp       :  compute Temperature/Salinity/density on U-point or V-point
+  !!   dia_dct_wri  :  Write tranports results in ascii files
+  !!   interp       :  Compute temperature/salinity/density at U-point or V-point
   !!   
   !!----------------------------------------------------------------------
@@ -52,6 +52,7 @@
 
   !! * Routine accessibility
-  PUBLIC   dia_dct     ! routine called by step.F90
-  PUBLIC   dia_dct_init! routine called by opa.F90
+  PUBLIC   dia_dct      ! routine called by step.F90
+  PUBLIC   dia_dct_init ! routine called by opa.F90
+  PUBLIC   diadct_alloc ! routine called by nemo_init in nemogcm.F90 
   PRIVATE  readsec
   PRIVATE  removepoints
@@ -72,5 +73,7 @@
   INTEGER, PARAMETER :: nb_sec_max    = 150
   INTEGER, PARAMETER :: nb_point_max  = 2000
-  INTEGER, PARAMETER :: nb_type_class = 14
+  INTEGER, PARAMETER :: nb_type_class = 10
+  INTEGER, PARAMETER :: nb_3d_vars    = 3 
+  INTEGER, PARAMETER :: nb_2d_vars    = 2 
   INTEGER            :: nb_sec 
 
@@ -92,5 +95,5 @@
      INTEGER                                      :: nb_class          ! number of boundaries for density classes
      INTEGER, DIMENSION(nb_point_max)             :: direction         ! vector direction of the point in the section
-     CHARACTER(len=40),DIMENSION(nb_class_max)    :: classname         ! caracteristics of the class
+     CHARACTER(len=40),DIMENSION(nb_class_max)    :: classname         ! characteristics of the class
      REAL(wp), DIMENSION(nb_class_max)            :: zsigi           ,&! in-situ   density classes    (99 if you don't want)
                                                      zsigp           ,&! potential density classes    (99 if you don't want)
@@ -106,6 +109,24 @@
   TYPE(SECTION),DIMENSION(nb_sec_max) :: secs ! Array of sections
  
- 
+  REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::  transports_3d 
+  REAL(wp), ALLOCATABLE, DIMENSION(:,:,:)   ::  transports_2d  
+
 CONTAINS
+
+ 
+  INTEGER FUNCTION diadct_alloc() 
+     !!---------------------------------------------------------------------- 
+     !!                   ***  FUNCTION diadct_alloc  *** 
+     !!---------------------------------------------------------------------- 
+     INTEGER :: ierr(2) 
+     !!---------------------------------------------------------------------- 
+
+     ALLOCATE(transports_3d(nb_3d_vars,nb_sec_max,nb_point_max,jpk), STAT=ierr(1) ) 
+     ALLOCATE(transports_2d(nb_2d_vars,nb_sec_max,nb_point_max)    , STAT=ierr(2) ) 
+
+     diadct_alloc = MAXVAL( ierr ) 
+     IF( diadct_alloc /= 0 )   CALL ctl_warn('diadct_alloc: failed to allocate arrays') 
+ 
+  END FUNCTION diadct_alloc 
 
   SUBROUTINE dia_dct_init
@@ -113,5 +134,5 @@
      !!               ***  ROUTINE diadct  ***  
      !!
-     !!  ** Purpose: Read the namelist parametres
+     !!  ** Purpose: Read the namelist parameters
      !!              Open output files
      !!
@@ -154,4 +175,8 @@
      ENDIF
 
+     ! Initialise arrays to zero 
+     transports_3d(:,:,:,:)=0.0 
+     transports_2d(:,:,:)  =0.0 
+
      IF( nn_timing == 1 )   CALL timing_stop('dia_dct_init')
      !
@@ -163,5 +188,16 @@
      !!               ***  ROUTINE diadct  ***  
      !!
-     !!  ** Purpose: Compute sections tranport and write it in numdct file
+     !!  Purpose :: Compute section transports and write it in numdct files 
+     !!   
+     !!  Method  :: All arrays initialised to zero in dct_init 
+     !!             Each nn_dct time step call subroutine 'transports' for 
+     !!               each section to sum the transports over each grid cell. 
+     !!             Each nn_dctwri time step: 
+     !!               Divide the arrays by the number of summations to gain 
+     !!               an average value 
+     !!               Call dia_dct_sum to sum relevant grid boxes to obtain 
+     !!               totals for each class (density, depth, temp or sal) 
+     !!               Call dia_dct_wri to write the transports into file 
+     !!               Reinitialise all relevant arrays to zero 
      !!---------------------------------------------------------------------
      !! * Arguments
@@ -170,9 +206,6 @@
      !! * Local variables
      INTEGER             :: jsec,            &! loop on sections
-                            iost,            &! error for opening fileout
                             itotal            ! nb_sec_max*nb_type_class*nb_class_max
      LOGICAL             :: lldebug =.FALSE.  ! debug a section  
-     CHARACTER(len=160)  :: clfileout         ! fileout name
-
      
      INTEGER , DIMENSION(1)             :: ish   ! tmp array for mpp_sum
@@ -190,4 +223,8 @@
      ENDIF    
  
+     ! Initialise arrays
+     zwork(:) = 0.0 
+     zsum(:,:,:) = 0.0
+
      IF( lwp .AND. kt==nit000+nn_dct-1 ) THEN
          WRITE(numout,*) " "
@@ -208,5 +245,5 @@
 
            !Compute transport through section  
-           CALL transport(secs(jsec),lldebug) 
+           CALL transport(secs(jsec),lldebug,jsec) 
 
         ENDDO
@@ -214,6 +251,15 @@
         IF( MOD(kt,nn_dctwri)==0 )THEN
 
-           IF( lwp .AND. kt==nit000+nn_dctwri-1 )WRITE(numout,*)"      diadct: write at kt = ",kt         
+           IF( lwp .AND. kt==nit000+nn_dctwri-1 )WRITE(numout,*)"      diadct: average transports and write at kt = ",kt         
   
+           !! divide arrays by nn_dctwri/nn_dct to obtain average 
+           transports_3d(:,:,:,:)=transports_3d(:,:,:,:)/(nn_dctwri/nn_dct) 
+           transports_2d(:,:,:)  =transports_2d(:,:,:)  /(nn_dctwri/nn_dct) 
+ 
+           ! Sum over each class 
+           DO jsec=1,nb_sec 
+              CALL dia_dct_sum(secs(jsec),jsec) 
+           ENDDO 
+
            !Sum on all procs 
            IF( lk_mpp )THEN
@@ -233,4 +279,6 @@
             
               !nullify transports values after writing
+              transports_3d(:,jsec,:,:)=0.
+              transports_2d(:,jsec,:  )=0.
               secs(jsec)%transport(:,:)=0.  
 
@@ -265,5 +313,4 @@
      INTEGER :: isec, iiglo, ijglo, iiloc, ijloc,iost,i1 ,i2  ! temporary  integer
      INTEGER :: jsec, jpt                                     ! dummy loop indices
-                                                              ! heat/salt tranport is actived
 
      INTEGER, DIMENSION(2) :: icoord 
@@ -457,7 +504,5 @@
      !!             *** function removepoints
      !!
-     !!   ** Purpose ::
-     !!              remove points which are common to 2 procs
-     !!
+     !!   ** Purpose :: Remove points which are common to 2 procs
      !!
      !----------------------------------------------------------------------------
@@ -535,28 +580,22 @@
   END SUBROUTINE removepoints
 
-  SUBROUTINE transport(sec,ld_debug)
+  SUBROUTINE transport(sec,ld_debug,jsec)
      !!-------------------------------------------------------------------------------------------
      !!                     ***  ROUTINE transport  ***
      !!
-     !!  ** Purpose : Compute the transport through a section
-     !!
-     !!  ** Method  :Transport through a given section is equal to the sum of transports
-     !!              computed on each proc.
-     !!              On each proc,transport is equal to the sum of transport computed through
-     !!	             segments linking each point of sec%listPoint  with the next one.   
-     !!
-     !!              !BE carefull :          
-     !!              one section is a sum of segments
-     !!              one segment is defined by 2 consectuve points in sec%listPoint
-     !!              all points of sec%listPoint are positioned on the F-point of the cell. 
+     !!  Purpose ::  Compute the transport for each point in a section 
      !! 
-     !!              There are several loops:                 
-     !!              loop on the density/temperature/salinity/level classes
-     !!              loop on the segment between 2 nodes
-     !!              loop on the level jk
-     !!              test on the density/temperature/salinity/level
-     !!
-     !! ** Output: sec%transport: volume/mass/ice/heat/salt transport in the 2 directions
-     !!
+     !!  Method  ::  Loop over each segment, and each vertical level and add the transport 
+     !!              Be aware :           
+     !!              One section is a sum of segments 
+     !!              One segment is defined by 2 consecutive points in sec%listPoint 
+     !!              All points of sec%listPoint are positioned on the F-point of the cell 
+     !! 
+     !!              There are two loops:                  
+     !!              loop on the segment between 2 nodes 
+     !!              loop on the level jk !!
+     !! 
+     !!  Output  ::  Arrays containing the volume,density,heat,salt transports for each i
+     !!              point in a section, summed over each nn_dct. 
      !!
      !!-------------------------------------------------------------------------------------------
@@ -564,34 +603,18 @@
      TYPE(SECTION),INTENT(INOUT) :: sec
      LOGICAL      ,INTENT(IN)    :: ld_debug
+     INTEGER      ,INTENT(IN)    :: jsec        ! numeric identifier of section
     
      !! * Local variables
-     INTEGER             :: jk,jseg,jclass,   &!loop on level/segment/classes 
-                            isgnu  , isgnv     !
-     INTEGER :: ii, ij ! local integer
-     REAL(wp):: zumid        , zvmid        ,&!U/V velocity on a cell segment
-                zumid_ice    , zvmid_ice    ,&!U/V ice velocity
-                zTnorm                      ,&!transport of velocity through one cell's sides
-                ztransp1     , ztransp2     ,&!total        transport in directions 1 and 2
-                ztemp1       , ztemp2       ,&!temperature  transport     "
-                zrhoi1       , zrhoi2       ,&!mass         transport     "
-                zrhop1       , zrhop2       ,&!mass         transport     "
-                zsal1        , zsal2        ,&!salinity     transport     "
-                zice_vol_pos , zice_vol_neg ,&!volume  ice  transport     "
-                zice_surf_pos, zice_surf_neg  !surface ice  transport     "
-     REAL(wp):: ztn, zsn, zrhoi, zrhop, zsshn, zfsdep ! temperature/salinity/ssh/potential density /depth at u/v point
+     INTEGER             :: jk, jseg, jclass,                    &!loop on level/segment/classes  
+                            isgnu, isgnv                          ! 
+     REAL(wp)            :: zumid, zvmid,                        &!U/V velocity on a cell segment 
+                            zumid_ice, zvmid_ice,                &!U/V ice velocity 
+                            zTnorm                                !transport of velocity through one cell's sides 
+     REAL(wp)            :: ztn, zsn, zrhoi, zrhop, zsshn, zfsdep !temperature/salinity/potential density/ssh/depth at u/v point
 
      TYPE(POINT_SECTION) :: k
-     REAL(wp), POINTER, DIMENSION(:,:):: zsum ! 2D work array
      !!--------------------------------------------------------
-     CALL wrk_alloc( nb_type_class , nb_class_max , zsum   )
 
      IF( ld_debug )WRITE(numout,*)'      Compute transport'
-
-     !----------------!
-     ! INITIALIZATION !
-     !----------------!
-     zsum    = 0._wp
-     zice_surf_neg = 0._wp ; zice_surf_pos = 0._wp
-     zice_vol_pos  = 0._wp ; zice_vol_neg  = 0._wp
 
      !---------------------------!
@@ -670,127 +693,60 @@
            END SELECT
 
-           !-------------------------------
-           !  LOOP ON THE DENSITY CLASSES |
-           !-------------------------------
-           !The computation is made for each density class
-           DO jclass=1,MAX(1,sec%nb_class-1)
-
-              ztransp1=0._wp ; zrhoi1=0._wp ; zrhop1=0._wp ; ztemp1=0._wp ;zsal1=0._wp
-              ztransp2=0._wp ; zrhoi2=0._wp ; zrhop2=0._wp ; ztemp2=0._wp ;zsal2=0._wp
-    
-              !---------------------------|
-              !     LOOP ON THE LEVEL     |
-              !---------------------------|
-              !Sum of the transport on the vertical 
-              DO jk=1,jpk
-                    
-
-                 ! compute temparature, salinity, insitu & potential density, ssh and depth at U/V point
-                 SELECT CASE( sec%direction(jseg) )
-                 CASE(0,1)
-                    ztn   = interp(k%I,k%J,jk,'V',tsn(:,:,:,jp_tem) )
-                    zsn   = interp(k%I,k%J,jk,'V',tsn(:,:,:,jp_sal) )
-                    zrhop = interp(k%I,k%J,jk,'V',rhop)
-                    zrhoi = interp(k%I,k%J,jk,'V',rhd*rau0+rau0)
-                    zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I,k%J+1)    ) * vmask(k%I,k%J,1)
-                 CASE(2,3)
-                    ztn   = interp(k%I,k%J,jk,'U',tsn(:,:,:,jp_tem) )
-                    zsn   = interp(k%I,k%J,jk,'U',tsn(:,:,:,jp_sal) )
-                    zrhop = interp(k%I,k%J,jk,'U',rhop)
-                    zrhoi = interp(k%I,k%J,jk,'U',rhd*rau0+rau0)
-                    zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I+1,k%J)    ) * umask(k%I,k%J,1) 
-                 END SELECT
-
-                 zfsdep= gdept(k%I,k%J,jk)
- 
-                 !----------------------------------------------!
-                 !TEST ON THE DENSITY/SALINITY/TEMPERATURE/LEVEL! 
-                 !----------------------------------------------!
- 
-                 IF ( (    ((( zrhop .GE. (sec%zsigp(jclass)+1000.  )) .AND.    &
-                           (   zrhop .LE. (sec%zsigp(jclass+1)+1000. ))) .OR.    &
-                           ( sec%zsigp(jclass) .EQ. 99.)) .AND.                 &
-                           ((( zrhoi .GE. (sec%zsigi(jclass) + 1000.  )) .AND.    &
-                           (   zrhoi .LE. (sec%zsigi(jclass+1)+1000. ))) .OR.    &
-                           ( sec%zsigi(jclass) .EQ. 99.)) .AND.                 &
-                           ((( zsn .GT. sec%zsal(jclass)) .AND.                &
-                           (   zsn .LE. sec%zsal(jclass+1))) .OR.              &
-                           ( sec%zsal(jclass) .EQ. 99.)) .AND.                 &
-                           ((( ztn .GE. sec%ztem(jclass)) .AND.                &
-                           (   ztn .LE. sec%ztem(jclass+1))) .OR.              &
-                           ( sec%ztem(jclass) .EQ.99.)) .AND.                  &
-                           ((( zfsdep .GE. sec%zlay(jclass)) .AND.            &
-                           (   zfsdep .LE. sec%zlay(jclass+1))) .OR.          &
-                           ( sec%zlay(jclass) .EQ. 99. ))))   THEN
-
-
-                    !compute velocity with the correct direction
-                    SELECT CASE( sec%direction(jseg) )
-                    CASE(0,1)  
-                       zumid=0.
-                       zvmid=isgnv*vn(k%I,k%J,jk)*vmask(k%I,k%J,jk)
-                    CASE(2,3)
-                       zumid=isgnu*un(k%I,k%J,jk)*umask(k%I,k%J,jk)
-                       zvmid=0.
-                    END SELECT
-
-                    !velocity* cell's length * cell's thickness
-                    zTnorm=zumid*e2u(k%I,k%J)*  fse3u(k%I,k%J,jk)+     &
-                           zvmid*e1v(k%I,k%J)*  fse3v(k%I,k%J,jk)
+           !---------------------------| 
+           !     LOOP ON THE LEVEL     | 
+           !---------------------------| 
+           !Sum of the transport on the vertical  
+           DO jk=1,mbathy(k%I,k%J) 
+ 
+              ! compute temperature, salinity, insitu & potential density, ssh and depth at U/V point 
+              SELECT CASE( sec%direction(jseg) ) 
+              CASE(0,1) 
+                 ztn   = interp(k%I,k%J,jk,'V',tsn(:,:,:,jp_tem) ) 
+                 zsn   = interp(k%I,k%J,jk,'V',tsn(:,:,:,jp_sal) ) 
+                 zrhop = interp(k%I,k%J,jk,'V',rhop) 
+                 zrhoi = interp(k%I,k%J,jk,'V',rhd*rau0+rau0) 
+                 zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I,k%J+1)    ) * vmask(k%I,k%J,1) 
+              CASE(2,3) 
+                 ztn   = interp(k%I,k%J,jk,'U',tsn(:,:,:,jp_tem) ) 
+                 zsn   = interp(k%I,k%J,jk,'U',tsn(:,:,:,jp_sal) ) 
+                 zrhop = interp(k%I,k%J,jk,'U',rhop) 
+                 zrhoi = interp(k%I,k%J,jk,'U',rhd*rau0+rau0) 
+                 zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I+1,k%J)    ) * umask(k%I,k%J,1)  
+              END SELECT 
+ 
+              zfsdep= gdept(k%I,k%J,jk) 
+  
+              !compute velocity with the correct direction 
+              SELECT CASE( sec%direction(jseg) ) 
+              CASE(0,1)   
+                 zumid=0. 
+                 zvmid=isgnv*vn(k%I,k%J,jk)*vmask(k%I,k%J,jk) 
+              CASE(2,3) 
+                 zumid=isgnu*un(k%I,k%J,jk)*umask(k%I,k%J,jk) 
+                 zvmid=0. 
+              END SELECT 
+ 
+              !zTnorm=transport through one cell; 
+              !velocity* cell's length * cell's thickness 
+              zTnorm=zumid*e2u(k%I,k%J)*  fse3u(k%I,k%J,jk)+     & 
+                     zvmid*e1v(k%I,k%J)*  fse3v(k%I,k%J,jk) 
 
 #if ! defined key_vvl
-                    !add transport due to free surface
-                    IF( jk==1 )THEN
-                       zTnorm = zTnorm + zumid* e2u(k%I,k%J) * zsshn * umask(k%I,k%J,jk) + &
-                                         zvmid* e1v(k%I,k%J) * zsshn * vmask(k%I,k%J,jk)
-                    ENDIF
+              !add transport due to free surface 
+              IF( jk==1 )THEN 
+                 zTnorm = zTnorm + zumid* e2u(k%I,k%J) * zsshn * umask(k%I,k%J,jk) + & 
+                                   zvmid* e1v(k%I,k%J) * zsshn * vmask(k%I,k%J,jk) 
+              ENDIF 
 #endif
-                    !COMPUTE TRANSPORT 
-                    !zTnorm=transport through one cell for one class
-                    !ztransp1 or ztransp2=transport through one cell i
-                    !                     for one class for one direction
-                    IF( zTnorm .GE. 0 )THEN
-
-                       ztransp1=zTnorm+ztransp1
- 
-                       IF ( sec%llstrpond ) THEN
-                          ztemp1 = ztemp1  + zTnorm * ztn 
-                          zsal1  = zsal1   + zTnorm * zsn
-                          zrhoi1 = zrhoi1  + zTnorm * zrhoi
-                          zrhop1 = zrhop1  + zTnorm * zrhop
-                       ENDIF
-
-                    ELSE
-
-                       ztransp2=(zTnorm)+ztransp2
-
-                       IF ( sec%llstrpond ) THEN
-                          ztemp2 = ztemp2  + zTnorm * ztn 
-                          zsal2  = zsal2   + zTnorm * zsn
-                          zrhoi2 = zrhoi2  + zTnorm * zrhoi
-                          zrhop2 = zrhop2  + zTnorm * zrhop
-                       ENDIF
-                    ENDIF
- 
-            
-                 ENDIF ! end of density test
-              ENDDO!end of loop on the level
-
-              !ZSUM=TRANSPORT FOR EACH CLASSES FOR THE  DIRECTIONS
-              !---------------------------------------------------
-              zsum(1,jclass)     = zsum(1,jclass)+ztransp1
-              zsum(2,jclass)     = zsum(2,jclass)+ztransp2
-              IF( sec%llstrpond )THEN
-                 zsum(3 ,jclass) = zsum( 3,jclass)+zrhoi1
-                 zsum(4 ,jclass) = zsum( 4,jclass)+zrhoi2
-                 zsum(5 ,jclass) = zsum( 5,jclass)+zrhop1
-                 zsum(6 ,jclass) = zsum( 6,jclass)+zrhop2
-                 zsum(7 ,jclass) = zsum( 7,jclass)+ztemp1
-                 zsum(8 ,jclass) = zsum( 8,jclass)+ztemp2
-                 zsum(9 ,jclass) = zsum( 9,jclass)+zsal1
-                 zsum(10,jclass) = zsum(10,jclass)+zsal2
+              !COMPUTE TRANSPORT  
+ 
+              transports_3d(1,jsec,jseg,jk) = transports_3d(1,jsec,jseg,jk) + zTnorm 
+  
+              IF ( sec%llstrpond ) THEN 
+                 transports_3d(2,jsec,jseg,jk) = transports_3d(2,jsec,jseg,jk)  + zTnorm * ztn * zrhop * rcp
+                 transports_3d(3,jsec,jseg,jk) = transports_3d(3,jsec,jseg,jk)  + zTnorm * zsn * zrhop * 0.001
               ENDIF
    
-           ENDDO !end of loop on the density classes
+           ENDDO !end of loop on the level
 
 #if defined key_lim2 || defined key_lim3
@@ -816,28 +772,10 @@
               zTnorm=zumid_ice*e2u(k%I,k%J)+zvmid_ice*e1v(k%I,k%J)
    
-              IF( zTnorm .GE. 0)THEN
-                 zice_vol_pos = (zTnorm)*   &
-                                      (1.0 - frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))  &
-                                     *(hsnif(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J) +  &
-                                       hicif(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J)) &
-                                      +zice_vol_pos
-                 zice_surf_pos = (zTnorm)*   &
-                                       (1.0 -  frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))  &
-                                      +zice_surf_pos
-              ELSE
-                 zice_vol_neg=(zTnorm)*   &
-                                   (1.0 - frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))  &
-                                  *(hsnif(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J) +  &
-                                    hicif(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J)) &
-                                  +zice_vol_neg
-                 zice_surf_neg=(zTnorm)*   &
-                                    (1.0 - frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))  &
-                                     +zice_surf_neg
-              ENDIF
-   
-              zsum(11,1) = zsum(11,1)+zice_vol_pos
-              zsum(12,1) = zsum(12,1)+zice_vol_neg
-              zsum(13,1) = zsum(13,1)+zice_surf_pos
-              zsum(14,1) = zsum(14,1)+zice_surf_neg
+              transports_2d(1,jsec,jseg) = transports_2d(1,jsec,jseg) + (zTnorm)*   & 
+                                   (1.0 - frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))  & 
+                                  *(hsnif(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J) +  & 
+                                    hicif(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))
+              transports_2d(2,jsec,jseg) = transports_2d(2,jsec,jseg) + (zTnorm)*   & 
+                                    (1.0 -  frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))
    
            ENDIF !end of ice case
@@ -846,51 +784,199 @@
         ENDDO !end of loop on the segment
 
-
-     ELSE  !if sec%nb_point =0
-        zsum(1:2,:)=0.
-        IF (sec%llstrpond) zsum(3:10,:)=0.
-        zsum( 11:14,:)=0.
-     ENDIF   !end of sec%nb_point =0 case
-
-     !-------------------------------|
-     !FINISH COMPUTING TRANSPORTS    |
-     !-------------------------------|
-     DO jclass=1,MAX(1,sec%nb_class-1)
-        sec%transport(1,jclass)=sec%transport(1,jclass)+zsum(1,jclass)*1.E-6
-        sec%transport(2,jclass)=sec%transport(2,jclass)+zsum(2,jclass)*1.E-6
-        IF( sec%llstrpond ) THEN
-           IF( zsum(1,jclass) .NE. 0._wp ) THEN
-              sec%transport( 3,jclass) = sec%transport( 3,jclass) + zsum( 3,jclass)/zsum(1,jclass)
-              sec%transport( 5,jclass) = sec%transport( 5,jclass) + zsum( 5,jclass)/zsum(1,jclass)
-              sec%transport( 7,jclass) = sec%transport( 7,jclass) + zsum( 7,jclass)
-              sec%transport( 9,jclass) = sec%transport( 9,jclass) + zsum( 9,jclass)
-           ENDIF
-           IF( zsum(2,jclass) .NE. 0._wp )THEN
-              sec%transport( 4,jclass) = sec%transport( 4,jclass) + zsum( 4,jclass)/zsum(2,jclass)
-              sec%transport( 6,jclass) = sec%transport( 6,jclass) + zsum( 6,jclass)/zsum(2,jclass)
-              sec%transport( 8,jclass) = sec%transport( 8,jclass) + zsum( 8,jclass)
-              sec%transport(10,jclass) = sec%transport(10,jclass) + zsum(10,jclass)
-           ENDIF
-        ELSE
-           sec%transport( 3,jclass) = 0._wp
-           sec%transport( 4,jclass) = 0._wp
-           sec%transport( 5,jclass) = 0._wp
-           sec%transport( 6,jclass) = 0._wp
-           sec%transport( 7,jclass) = 0._wp
-           sec%transport( 8,jclass) = 0._wp
-           sec%transport(10,jclass) = 0._wp
-        ENDIF
-     ENDDO   
-
-     IF( sec%ll_ice_section ) THEN
-        sec%transport( 9,1)=sec%transport( 9,1)+zsum( 9,1)*1.E-6
-        sec%transport(10,1)=sec%transport(10,1)+zsum(10,1)*1.E-6
-        sec%transport(11,1)=sec%transport(11,1)+zsum(11,1)*1.E-6
-        sec%transport(12,1)=sec%transport(12,1)+zsum(12,1)*1.E-6
-     ENDIF
-
-     CALL wrk_dealloc( nb_type_class , nb_class_max , zsum   )
+     ENDIF !end of sec%nb_point =0 case
      !
   END SUBROUTINE transport
+  
+  SUBROUTINE dia_dct_sum(sec,jsec) 
+     !!------------------------------------------------------------- 
+     !! Purpose: Average the transport over nn_dctwri time steps  
+     !! and sum over the density/salinity/temperature/depth classes 
+     !! 
+     !! Method:   Sum over relevant grid cells to obtain values  
+     !!           for each class
+     !!              There are several loops:                  
+     !!              loop on the segment between 2 nodes 
+     !!              loop on the level jk 
+     !!              loop on the density/temperature/salinity/level classes 
+     !!              test on the density/temperature/salinity/level 
+     !! 
+     !!  Note:    Transport through a given section is equal to the sum of transports 
+     !!           computed on each proc. 
+     !!           On each proc,transport is equal to the sum of transport computed through 
+     !!           segments linking each point of sec%listPoint  with the next one.    
+     !! 
+     !!------------------------------------------------------------- 
+     !! * arguments 
+     TYPE(SECTION),INTENT(INOUT) :: sec 
+     INTEGER      ,INTENT(IN)    :: jsec        ! numeric identifier of section 
+ 
+     TYPE(POINT_SECTION) :: k 
+     INTEGER  :: jk,jseg,jclass                        ! dummy variables for looping on level/segment/classes  
+     REAL(wp) :: ztn, zsn, zrhoi, zrhop, zsshn, zfsdep ! temperature/salinity/ssh/potential density /depth at u/v point 
+     !!------------------------------------------------------------- 
+ 
+     !! Sum the relevant segments to obtain values for each class 
+     IF(sec%nb_point .NE. 0)THEN    
+ 
+        !--------------------------------------! 
+        ! LOOP ON THE SEGMENT BETWEEN 2 NODES  ! 
+        !--------------------------------------! 
+        DO jseg=1,MAX(sec%nb_point-1,0) 
+            
+           !------------------------------------------------------------------------------------------- 
+           ! Select the appropriate coordinate for computing the velocity of the segment 
+           ! 
+           !                      CASE(0)                                    Case (2) 
+           !                      -------                                    -------- 
+           !  listPoint(jseg)                 listPoint(jseg+1)       listPoint(jseg)  F(i,j)       
+           !      F(i,j)----------V(i+1,j)-------F(i+1,j)                               | 
+           !                                                                            | 
+           !                                                                            | 
+           !                                                                            | 
+           !                      Case (3)                                            U(i,j) 
+           !                      --------                                              | 
+           !                                                                            | 
+           !  listPoint(jseg+1) F(i,j+1)                                                | 
+           !                        |                                                   | 
+           !                        |                                                   | 
+           !                        |                                 listPoint(jseg+1) F(i,j-1) 
+           !                        |                                             
+           !                        |                                             
+           !                     U(i,j+1)                                             
+           !                        |                                       Case(1)      
+           !                        |                                       ------       
+           !                        |                                             
+           !                        |                 listPoint(jseg+1)             listPoint(jseg)                            
+           !                        |                 F(i-1,j)-----------V(i,j) -------f(jseg)                            
+           ! listPoint(jseg)     F(i,j) 
+           !  
+           !------------------------------------------------------------------------------------------- 
+ 
+           SELECT CASE( sec%direction(jseg) ) 
+           CASE(0)  ;   k = sec%listPoint(jseg) 
+           CASE(1)  ;   k = POINT_SECTION(sec%listPoint(jseg)%I+1,sec%listPoint(jseg)%J) 
+           CASE(2)  ;   k = sec%listPoint(jseg) 
+           CASE(3)  ;   k = POINT_SECTION(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J+1) 
+           END SELECT 
+ 
+           !---------------------------| 
+           !     LOOP ON THE LEVEL     | 
+           !---------------------------| 
+           !Sum of the transport on the vertical  
+           DO jk=1,mbathy(k%I,k%J) 
+ 
+              ! compute temperature, salinity, insitu & potential density, ssh and depth at U/V point 
+              SELECT CASE( sec%direction(jseg) ) 
+              CASE(0,1) 
+                 ztn   = interp(k%I,k%J,jk,'V',tsn(:,:,:,jp_tem) ) 
+                 zsn   = interp(k%I,k%J,jk,'V',tsn(:,:,:,jp_sal) ) 
+                 zrhop = interp(k%I,k%J,jk,'V',rhop) 
+                 zrhoi = interp(k%I,k%J,jk,'V',rhd*rau0+rau0) 
+
+              CASE(2,3) 
+                 ztn   = interp(k%I,k%J,jk,'U',tsn(:,:,:,jp_tem) ) 
+                 zsn   = interp(k%I,k%J,jk,'U',tsn(:,:,:,jp_sal) ) 
+                 zrhop = interp(k%I,k%J,jk,'U',rhop) 
+                 zrhoi = interp(k%I,k%J,jk,'U',rhd*rau0+rau0) 
+                 zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I+1,k%J)    ) * umask(k%I,k%J,1)  
+              END SELECT 
+ 
+              zfsdep= gdept(k%I,k%J,jk) 
+  
+              !------------------------------- 
+              !  LOOP ON THE DENSITY CLASSES | 
+              !------------------------------- 
+              !The computation is made for each density/temperature/salinity/depth class 
+              DO jclass=1,MAX(1,sec%nb_class-1) 
+ 
+                 !----------------------------------------------! 
+                 !TEST ON THE DENSITY/SALINITY/TEMPERATURE/LEVEL!  
+                 !----------------------------------------------! 
+
+                 IF ( (                                                    & 
+                    ((( zrhop .GE. (sec%zsigp(jclass)+1000.  )) .AND.      & 
+                    (   zrhop .LE. (sec%zsigp(jclass+1)+1000. ))) .OR.     & 
+                    ( sec%zsigp(jclass) .EQ. 99.)) .AND.                   & 
+ 
+                    ((( zrhoi .GE. (sec%zsigi(jclass) + 1000.  )) .AND.    & 
+                    (   zrhoi .LE. (sec%zsigi(jclass+1)+1000. ))) .OR.     & 
+                    ( sec%zsigi(jclass) .EQ. 99.)) .AND.                   & 
+ 
+                    ((( zsn .GT. sec%zsal(jclass)) .AND.                   & 
+                    (   zsn .LE. sec%zsal(jclass+1))) .OR.                 & 
+                    ( sec%zsal(jclass) .EQ. 99.)) .AND.                    & 
+ 
+                    ((( ztn .GE. sec%ztem(jclass)) .AND.                   & 
+                    (   ztn .LE. sec%ztem(jclass+1))) .OR.                 & 
+                    ( sec%ztem(jclass) .EQ.99.)) .AND.                     & 
+ 
+                    ((( zfsdep .GE. sec%zlay(jclass)) .AND.                & 
+                    (   zfsdep .LE. sec%zlay(jclass+1))) .OR.              & 
+                    ( sec%zlay(jclass) .EQ. 99. ))                         & 
+                                                                   ))   THEN 
+ 
+                    !SUM THE TRANSPORTS FOR EACH CLASSES FOR THE POSITIVE AND NEGATIVE DIRECTIONS 
+                    !---------------------------------------------------------------------------- 
+                    IF (transports_3d(1,jsec,jseg,jk) .GE. 0.0) THEN  
+                       sec%transport(1,jclass) = sec%transport(1,jclass)+transports_3d(1,jsec,jseg,jk)*1.E-6 
+                    ELSE 
+                       sec%transport(2,jclass) = sec%transport(2,jclass)+transports_3d(1,jsec,jseg,jk)*1.E-6 
+                    ENDIF 
+                    IF( sec%llstrpond )THEN 
+ 
+                       IF ( transports_3d(2,jsec,jseg,jk) .GE. 0.0 ) THEN 
+                          sec%transport(3,jclass) = sec%transport(3,jclass)+transports_3d(2,jsec,jseg,jk) 
+                       ELSE 
+                          sec%transport(4,jclass) = sec%transport(4,jclass)+transports_3d(2,jsec,jseg,jk) 
+                       ENDIF 
+ 
+                       IF ( transports_3d(3,jsec,jseg,jk) .GE. 0.0 ) THEN 
+                          sec%transport(5,jclass) = sec%transport(5,jclass)+transports_3d(3,jsec,jseg,jk) 
+                       ELSE 
+                          sec%transport(6,jclass) = sec%transport(6,jclass)+transports_3d(3,jsec,jseg,jk) 
+                       ENDIF 
+ 
+                    ELSE 
+                       sec%transport( 3,jclass) = 0._wp 
+                       sec%transport( 4,jclass) = 0._wp 
+                       sec%transport( 5,jclass) = 0._wp 
+                       sec%transport( 6,jclass) = 0._wp 
+                    ENDIF 
+ 
+                 ENDIF ! end of test if point is in class 
+    
+              ENDDO ! end of loop on the classes 
+ 
+           ENDDO ! loop over jk 
+ 
+#if defined key_lim2 || defined key_lim3 
+ 
+           !ICE CASE     
+           IF( sec%ll_ice_section )THEN 
+ 
+              IF ( transports_2d(1,jsec,jseg) .GE. 0.0 ) THEN 
+                 sec%transport( 7,1) = sec%transport( 7,1)+transports_2d(1,jsec,jseg)*1.E-6 
+              ELSE 
+                 sec%transport( 8,1) = sec%transport( 8,1)+transports_2d(1,jsec,jseg)*1.E-6 
+              ENDIF 
+ 
+              IF ( transports_2d(3,jsec,jseg) .GE. 0.0 ) THEN 
+                 sec%transport( 9,1) = sec%transport( 9,1)+transports_2d(2,jsec,jseg)*1.E-6 
+              ELSE 
+                 sec%transport(10,1) = sec%transport(10,1)+transports_2d(2,jsec,jseg)*1.E-6 
+              ENDIF 
+ 
+           ENDIF !end of ice case 
+#endif 
+  
+        ENDDO !end of loop on the segment 
+ 
+     ELSE  !if sec%nb_point =0 
+        sec%transport(1:2,:)=0. 
+        IF (sec%llstrpond) sec%transport(3:6,:)=0. 
+        IF (sec%ll_ice_section) sec%transport(7:10,:)=0. 
+     ENDIF !end of sec%nb_point =0 case 
+ 
+  END SUBROUTINE dia_dct_sum 
   
   SUBROUTINE dia_dct_wri(kt,ksec,sec)
@@ -905,8 +991,8 @@
      !! 
      !!        2. Write heat transports in "heat_transport"
-     !!           Unit: Peta W : area * Velocity * T * rhau * Cp / 1.e15
+     !!           Unit: Peta W : area * Velocity * T * rhop * Cp * 1.e-15
      !! 
      !!        3. Write salt transports in "salt_transport"
-     !!           Unit: 10^9 g m^3 / s : area * Velocity * S / 1.e6
+     !!           Unit: 10^9 Kg/m^2/s : area * Velocity * S * rhop * 1.e-9 
      !!
      !!------------------------------------------------------------- 
@@ -917,68 +1003,66 @@
 
      !!local declarations
-     INTEGER               :: jcl,ji             ! Dummy loop
+     INTEGER               :: jclass             ! Dummy loop
      CHARACTER(len=2)      :: classe             ! Classname 
      REAL(wp)              :: zbnd1,zbnd2        ! Class bounds
      REAL(wp)              :: zslope             ! section's slope coeff
      !
-     REAL(wp), POINTER, DIMENSION(:):: zsumclass ! 1D workspace 
+     REAL(wp), POINTER, DIMENSION(:):: zsumclasses ! 1D workspace 
      !!------------------------------------------------------------- 
-     CALL wrk_alloc(nb_type_class , zsumclass )  
-
-     zsumclass(:)=0._wp
+     CALL wrk_alloc(nb_type_class , zsumclasses )  
+
+     zsumclasses(:)=0._wp
      zslope = sec%slopeSection       
 
  
-     DO jcl=1,MAX(1,sec%nb_class-1)
-
-        ! Mean computation
-        sec%transport(:,jcl)=sec%transport(:,jcl)/(nn_dctwri/nn_dct)
+     DO jclass=1,MAX(1,sec%nb_class-1)
+
         classe   = 'N       '
         zbnd1   = 0._wp
         zbnd2   = 0._wp
-        zsumclass(1:nb_type_class)=zsumclass(1:nb_type_class)+sec%transport(1:nb_type_class,jcl)
+        zsumclasses(1:nb_type_class)=zsumclasses(1:nb_type_class)+sec%transport(1:nb_type_class,jclass)
 
    
         !insitu density classes transports
-        IF( ( sec%zsigi(jcl)   .NE. 99._wp ) .AND. &
-            ( sec%zsigi(jcl+1) .NE. 99._wp )       )THEN
+        IF( ( sec%zsigi(jclass)   .NE. 99._wp ) .AND. &
+            ( sec%zsigi(jclass+1) .NE. 99._wp )       )THEN
            classe = 'DI       '
-           zbnd1 = sec%zsigi(jcl)
-           zbnd2 = sec%zsigi(jcl+1)
+           zbnd1 = sec%zsigi(jclass)
+           zbnd2 = sec%zsigi(jclass+1)
         ENDIF
         !potential density classes transports
-        IF( ( sec%zsigp(jcl)   .NE. 99._wp ) .AND. &
-            ( sec%zsigp(jcl+1) .NE. 99._wp )       )THEN
+        IF( ( sec%zsigp(jclass)   .NE. 99._wp ) .AND. &
+            ( sec%zsigp(jclass+1) .NE. 99._wp )       )THEN
            classe = 'DP      '
-           zbnd1 = sec%zsigp(jcl)
-           zbnd2 = sec%zsigp(jcl+1)
+           zbnd1 = sec%zsigp(jclass)
+           zbnd2 = sec%zsigp(jclass+1)
         ENDIF
         !depth classes transports
-        IF( ( sec%zlay(jcl)    .NE. 99._wp ) .AND. &
-            ( sec%zlay(jcl+1)  .NE. 99._wp )       )THEN 
+        IF( ( sec%zlay(jclass)    .NE. 99._wp ) .AND. &
+            ( sec%zlay(jclass+1)  .NE. 99._wp )       )THEN 
            classe = 'Z       '
-           zbnd1 = sec%zlay(jcl)
-           zbnd2 = sec%zlay(jcl+1)
+           zbnd1 = sec%zlay(jclass)
+           zbnd2 = sec%zlay(jclass+1)
         ENDIF
         !salinity classes transports
-        IF( ( sec%zsal(jcl) .NE. 99._wp    ) .AND. &
-            ( sec%zsal(jcl+1) .NE. 99._wp  )       )THEN
+        IF( ( sec%zsal(jclass) .NE. 99._wp    ) .AND. &
+            ( sec%zsal(jclass+1) .NE. 99._wp  )       )THEN
            classe = 'S       '
-           zbnd1 = sec%zsal(jcl)
-           zbnd2 = sec%zsal(jcl+1)   
+           zbnd1 = sec%zsal(jclass)
+           zbnd2 = sec%zsal(jclass+1)   
         ENDIF
         !temperature classes transports
-        IF( ( sec%ztem(jcl) .NE. 99._wp     ) .AND. &
-            ( sec%ztem(jcl+1) .NE. 99._wp     )       ) THEN
+        IF( ( sec%ztem(jclass) .NE. 99._wp     ) .AND. &
+            ( sec%ztem(jclass+1) .NE. 99._wp     )       ) THEN
            classe = 'T       '
-           zbnd1 = sec%ztem(jcl)
-           zbnd2 = sec%ztem(jcl+1)
+           zbnd1 = sec%ztem(jclass)
+           zbnd2 = sec%ztem(jclass+1)
         ENDIF
                   
         !write volume transport per class
         WRITE(numdct_vol,118) ndastp,kt,ksec,sec%name,zslope, &
-                              jcl,classe,zbnd1,zbnd2,&
-                              sec%transport(1,jcl),sec%transport(2,jcl), &
-                              sec%transport(1,jcl)+sec%transport(2,jcl)
+                              jclass,classe,zbnd1,zbnd2,&
+                              sec%transport(1,jclass),sec%transport(2,jclass), &
+                              sec%transport(1,jclass)+sec%transport(2,jclass)
 
         IF( sec%llstrpond )THEN
@@ -986,12 +1070,12 @@
            !write heat transport per class:
            WRITE(numdct_heat,119) ndastp,kt,ksec,sec%name,zslope,  &
-                              jcl,classe,zbnd1,zbnd2,&
-                              sec%transport(7,jcl)*1000._wp*rcp/1.e15,sec%transport(8,jcl)*1000._wp*rcp/1.e15, &
-                              ( sec%transport(7,jcl)+sec%transport(8,jcl) )*1000._wp*rcp/1.e15
+                              jclass,classe,zbnd1,zbnd2,&
+                              sec%transport(3,jclass)*1.e-15,sec%transport(4,jclass)*1.e-15, &
+                              ( sec%transport(3,jclass)+sec%transport(4,jclass) )*1.e-15
            !write salt transport per class
            WRITE(numdct_salt,119) ndastp,kt,ksec,sec%name,zslope,  &
-                              jcl,classe,zbnd1,zbnd2,&
-                              sec%transport(9,jcl)*1000._wp/1.e9,sec%transport(10,jcl)*1000._wp/1.e9,&
-                              (sec%transport(9,jcl)+sec%transport(10,jcl))*1000._wp/1.e9
+                              jclass,classe,zbnd1,zbnd2,&
+                              sec%transport(5,jclass)*1.e-9,sec%transport(6,jclass)*1.e-9,&
+                              (sec%transport(5,jclass)+sec%transport(6,jclass))*1.e-9
         ENDIF
 
@@ -1000,10 +1084,10 @@
      zbnd1 = 0._wp
      zbnd2 = 0._wp
-     jcl=0
+     jclass=0
 
      !write total volume transport
      WRITE(numdct_vol,118) ndastp,kt,ksec,sec%name,zslope, &
-                           jcl,"total",zbnd1,zbnd2,&
-                           zsumclass(1),zsumclass(2),zsumclass(1)+zsumclass(2)
+                           jclass,"total",zbnd1,zbnd2,&
+                           zsumclasses(1),zsumclasses(2),zsumclasses(1)+zsumclasses(2)
 
      IF( sec%llstrpond )THEN
@@ -1011,12 +1095,12 @@
         !write total heat transport
         WRITE(numdct_heat,119) ndastp,kt,ksec,sec%name,zslope, &
-                           jcl,"total",zbnd1,zbnd2,&
-                           zsumclass(7)* 1000._wp*rcp/1.e15,zsumclass(8)* 1000._wp*rcp/1.e15,&
-                           (zsumclass(7)+zsumclass(8) )* 1000._wp*rcp/1.e15
+                           jclass,"total",zbnd1,zbnd2,&
+                           zsumclasses(3)*1.e-15,zsumclasses(4)*1.e-15,&
+                           (zsumclasses(3)+zsumclasses(4) )*1.e-15
         !write total salt transport
         WRITE(numdct_salt,119) ndastp,kt,ksec,sec%name,zslope, &
-                           jcl,"total",zbnd1,zbnd2,&
-                           zsumclass(9)*1000._wp/1.e9,zsumclass(10)*1000._wp/1.e9,&
-                           (zsumclass(9)+zsumclass(10))*1000._wp/1.e9
+                           jclass,"total",zbnd1,zbnd2,&
+                           zsumclasses(5)*1.e-9,zsumclasses(6)*1.e-9,&
+                           (zsumclasses(5)+zsumclasses(6))*1.e-9
      ENDIF
 
@@ -1025,12 +1109,12 @@
         !write total ice volume transport
         WRITE(numdct_vol,118) ndastp,kt,ksec,sec%name,zslope,&
-                              jcl,"ice_vol",zbnd1,zbnd2,&
-                              sec%transport(9,1),sec%transport(10,1),&
-                              sec%transport(9,1)+sec%transport(10,1)
+                              jclass,"ice_vol",zbnd1,zbnd2,&
+                              sec%transport(7,1),sec%transport(8,1),&
+                              sec%transport(7,1)+sec%transport(8,1)
         !write total ice surface transport
         WRITE(numdct_vol,118) ndastp,kt,ksec,sec%name,zslope,&
-                              jcl,"ice_surf",zbnd1,zbnd2,&
-                              sec%transport(11,1),sec%transport(12,1), &
-                              sec%transport(11,1)+sec%transport(12,1) 
+                              jclass,"ice_surf",zbnd1,zbnd2,&
+                              sec%transport(9,1),sec%transport(10,1), &
+                              sec%transport(9,1)+sec%transport(10,1) 
      ENDIF
                                               
@@ -1038,5 +1122,5 @@
 119 FORMAT(I8,1X,I8,1X,I4,1X,A30,1X,f9.2,1X,I4,3X,A8,1X,2F12.4,5X,3E15.6)
 
-     CALL wrk_dealloc(nb_type_class , zsumclass )  
+     CALL wrk_dealloc(nb_type_class , zsumclasses )  
   END SUBROUTINE dia_dct_wri
 
@@ -1044,5 +1128,5 @@
   !!----------------------------------------------------------------------
   !!
-  !!   Purpose: compute Temperature/Salinity/density at U-point or V-point
+  !!   Purpose: compute temperature/salinity/density at U-point or V-point
   !!   --------
   !!
@@ -1053,7 +1137,7 @@
   !! 
   !!
-  !!    |    I          |    I+1           |    Z=Temperature/Salinity/density at U-poinT
+  !!    |    I          |    I+1           |    Z=temperature/salinity/density at U-poinT
   !!    |               |                  |
-  !!  ----------------------------------------  1. Veritcale interpolation: compute zbis
+  !!  ----------------------------------------  1. Veritcal interpolation: compute zbis
   !!    |               |                  |       interpolation between ptab(I,J,K) and ptab(I,J,K+1)
   !!    |               |                  |       zbis = 
@@ -1136,5 +1220,5 @@
      zdep2 = fsdept(ii2,ij2,kk) - zdepu
 
-     !weights
+     ! weights
      zwgt1 = SQRT( ( 0.5 * zet1 ) * ( 0.5 * zet1 ) + ( zdep1 * zdep1 ) )
      zwgt2 = SQRT( ( 0.5 * zet2 ) * ( 0.5 * zet2 ) + ( zdep2 * zdep2 ) )
@@ -1163,10 +1247,10 @@
 
         IF( ze3t >= 0. )THEN 
-           !zbis
+           ! zbis
            zbis = ptab(ii2,ij2,kk) + zwgt1 * ( ptab(ii2,ij2,kk-1) - ptab(ii2,ij2,kk) ) 
            ! result
             interp = umask(ii1,ij1,kk) * ( zet2 * ptab(ii1,ij1,kk) + zet1 * zbis )/( zet1 + zet2 )
         ELSE
-           !zbis
+           ! zbis
            zbis = ptab(ii1,ij1,kk) + zwgt2 * ( ptab(ii1,ij1,kk-1) - ptab(ii1,ij2,kk) )
            ! result
@@ -1195,6 +1279,6 @@
    END SUBROUTINE dia_dct_init
 
-   SUBROUTINE dia_dct( kt )           ! Dummy routine
-      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
+   SUBROUTINE dia_dct( kt )         ! Dummy routine
+      INTEGER, INTENT( in ) :: kt   ! ocean time-step index
       WRITE(*,*) 'dia_dct: You should not have seen this print! error?', kt
    END SUBROUTINE dia_dct
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90	(revision 3680)
@@ -32,7 +32,7 @@
    USE ioipsl, ONLY :   ymds2ju   ! for calendar
    USE prtctl          ! Print control
-   USE restart         ! 
    USE trc_oce, ONLY : lk_offline ! offline flag
    USE timing          ! Timing
+   USE restart         ! restart
 
    IMPLICIT NONE
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90	(revision 3680)
@@ -8,4 +8,6 @@
    !!            3.3  ! 2010-11  (G. Madec) add mbk. arrays associated to the deepest ocean level
    !!            4.0  ! 2011-01  (A. R. Porter, STFC Daresbury) dynamical allocation
+   !!            3.5  ! 2012     (S. Mocavero, I. Epicoco) Add arrays associated
+   !!                             to the optimization of BDY communications
    !!----------------------------------------------------------------------
 
@@ -80,4 +82,9 @@
    INTEGER, PUBLIC ::   narea             !: number for local area
    INTEGER, PUBLIC ::   nbondi, nbondj    !: mark of i- and j-direction local boundaries
+   INTEGER, ALLOCATABLE, PUBLIC ::   nbondi_bdy(:)    !: mark i-direction local boundaries for BDY open boundaries
+   INTEGER, ALLOCATABLE, PUBLIC ::   nbondj_bdy(:)    !: mark j-direction local boundaries for BDY open boundaries
+   INTEGER, ALLOCATABLE, PUBLIC ::   nbondi_bdy_b(:)  !: mark i-direction of neighbours local boundaries for BDY open boundaries  
+   INTEGER, ALLOCATABLE, PUBLIC ::   nbondj_bdy_b(:)  !: mark j-direction of neighbours local boundaries for BDY open boundaries  
+
    INTEGER, PUBLIC ::   npolj             !: north fold mark (0, 3 or 4)
    INTEGER, PUBLIC ::   nlci, nldi, nlei  !: i-dimensions of the local subdomain and its first and last indoor indices
@@ -174,4 +181,5 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hifv  , hiff     !: interface depth between stretching at  V--F
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hift  , hifu     !: and quasi-uniform spacing              T--U  points (m)
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rx1              !: Maximum grid stiffness ratio
 
    !!----------------------------------------------------------------------
@@ -294,5 +302,5 @@
          &      scosrf(jpi,jpj) , scobot(jpi,jpj) ,     &
          &      hifv  (jpi,jpj) , hiff  (jpi,jpj) ,     &
-         &      hift  (jpi,jpj) , hifu  (jpi,jpj) , STAT=ierr(8) )
+         &      hift  (jpi,jpj) , hifu  (jpi,jpj) , rx1 (jpi,jpj) , STAT=ierr(8) )
 
       ALLOCATE( mbathy(jpi,jpj) , bathy(jpi,jpj) ,                     &
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 3680)
@@ -36,4 +36,5 @@
    USE dyncor_c1d      ! Coriolis term (c1d case)         (cor_c1d routine)
    USE timing          ! Timing
+   USE lbclnk          ! ocean lateral boundary condition (or mpp link)
 
    IMPLICIT NONE
@@ -84,4 +85,5 @@
                              CALL dom_zgr      ! Vertical mesh and bathymetry
                              CALL dom_msk      ! Masks
+      IF( ln_sco )           CALL dom_stiff    ! Maximum stiffness ratio/hydrostatic consistency
       IF( lk_vvl         )   CALL dom_vvl      ! Vertical variable mesh
       !
@@ -322,4 +324,67 @@
    END SUBROUTINE dom_ctl
 
+   SUBROUTINE dom_stiff
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE dom_stiff  ***
+      !!                     
+      !! ** Purpose :   Diagnose maximum grid stiffness/hydrostatic consistency
+      !!
+      !! ** Method  :   Compute Haney (1991) hydrostatic condition ratio
+      !!                Save the maximum in the vertical direction
+      !!                (this number is only relevant in s-coordinates)
+      !!
+      !!                Haney, R. L., 1991: On the pressure gradient force
+      !!                over steep topography in sigma coordinate ocean models. 
+      !!                J. Phys. Oceanogr., 21, 610???619.
+      !!----------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk 
+      REAL(wp) ::   zrxmax
+      REAL(wp), DIMENSION(4) :: zr1
+      !!----------------------------------------------------------------------
+      rx1(:,:) = 0.e0
+      zrxmax   = 0.e0
+      zr1(:)   = 0.e0
+      
+      DO ji = 2, jpim1
+         DO jj = 2, jpjm1
+            DO jk = 1, jpkm1
+               zr1(1) = umask(ji-1,jj  ,jk) *abs( (gdepw(ji  ,jj  ,jk  )-gdepw(ji-1,jj  ,jk  )  & 
+                    &                         +gdepw(ji  ,jj  ,jk+1)-gdepw(ji-1,jj  ,jk+1)) &
+                    &                        /(gdepw(ji  ,jj  ,jk  )+gdepw(ji-1,jj  ,jk  )  &
+                    &                         -gdepw(ji  ,jj  ,jk+1)-gdepw(ji-1,jj  ,jk+1) + rsmall) )
+               zr1(2) = umask(ji  ,jj  ,jk) *abs( (gdepw(ji+1,jj  ,jk  )-gdepw(ji  ,jj  ,jk  )  &
+                    &                         +gdepw(ji+1,jj  ,jk+1)-gdepw(ji  ,jj  ,jk+1)) &
+                    &                        /(gdepw(ji+1,jj  ,jk  )+gdepw(ji  ,jj  ,jk  )  &
+                    &                         -gdepw(ji+1,jj  ,jk+1)-gdepw(ji  ,jj  ,jk+1) + rsmall) )
+               zr1(3) = vmask(ji  ,jj  ,jk) *abs( (gdepw(ji  ,jj+1,jk  )-gdepw(ji  ,jj  ,jk  )  &
+                    &                         +gdepw(ji  ,jj+1,jk+1)-gdepw(ji  ,jj  ,jk+1)) &
+                    &                        /(gdepw(ji  ,jj+1,jk  )+gdepw(ji  ,jj  ,jk  )  &
+                    &                         -gdepw(ji  ,jj+1,jk+1)-gdepw(ji  ,jj  ,jk+1) + rsmall) )
+               zr1(4) = vmask(ji  ,jj-1,jk) *abs( (gdepw(ji  ,jj  ,jk  )-gdepw(ji  ,jj-1,jk  )  &
+                    &                         +gdepw(ji  ,jj  ,jk+1)-gdepw(ji  ,jj-1,jk+1)) &
+                    &                        /(gdepw(ji  ,jj  ,jk  )+gdepw(ji  ,jj-1,jk  )  &
+                    &                         -gdepw(ji,  jj  ,jk+1)-gdepw(ji  ,jj-1,jk+1) + rsmall) )
+               zrxmax = MAXVAL(zr1(1:4))
+               rx1(ji,jj) = MAX(rx1(ji,jj), zrxmax)
+            END DO
+         END DO
+      END DO
+
+      CALL lbc_lnk( rx1, 'T', 1. )
+
+      zrxmax = MAXVAL(rx1)
+
+      IF( lk_mpp )   CALL mpp_max( zrxmax ) ! max over the global domain
+
+      IF(lwp) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) 'dom_stiff : maximum grid stiffness ratio: ', zrxmax
+         WRITE(numout,*) '~~~~~~~~~'
+      ENDIF
+
+   END SUBROUTINE dom_stiff
+
+
+
    !!======================================================================
 END MODULE domain
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/domwri.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/domwri.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/domwri.F90	(revision 3680)
@@ -172,6 +172,6 @@
             
       IF( ln_sco ) THEN                                         ! s-coordinate
-         CALL iom_rstput( 0, 0, inum4, 'hbatt', hbatt )         !    ! depth
-         CALL iom_rstput( 0, 0, inum4, 'hbatu', hbatu ) 
+         CALL iom_rstput( 0, 0, inum4, 'hbatt', hbatt )
+         CALL iom_rstput( 0, 0, inum4, 'hbatu', hbatu )
          CALL iom_rstput( 0, 0, inum4, 'hbatv', hbatv )
          CALL iom_rstput( 0, 0, inum4, 'hbatf', hbatf )
@@ -187,7 +187,8 @@
          CALL iom_rstput( 0, 0, inum4, 'e3v', e3v )
          CALL iom_rstput( 0, 0, inum4, 'e3w', e3w )
-         !
-         CALL iom_rstput( 0, 0, inum4, 'gdept_0' , gdept_0 )    !    ! stretched system
-         CALL iom_rstput( 0, 0, inum4, 'gdepw_0' , gdepw_0 )
+         CALL iom_rstput( 0, 0, inum4, 'rx1', rx1 )             !    ! Max. grid stiffness ratio
+         !
+         CALL iom_rstput( 0, 0, inum4, 'gdept' , gdept )    !    ! stretched system
+         CALL iom_rstput( 0, 0, inum4, 'gdepw' , gdepw )
       ENDIF
       
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90	(revision 3680)
@@ -15,4 +15,5 @@
    !!            3.2  ! 2009-07  (R. Benshila) Suppression of rigid-lid option
    !!            3.3  ! 2010-11  (G. Madec) add mbk. arrays associated to the deepest ocean level
+   !!            3.4  ! 2012-08  (J. Siddorn) added Siddorn and Furner stretching function
    !!----------------------------------------------------------------------
 
@@ -27,6 +28,7 @@
    !!       zgr_zps      : z-coordinate with partial steps
    !!       zgr_sco      : s-coordinate
-   !!       fssig        : sigma coordinate non-dimensional function
-   !!       dfssig       : derivative of the sigma coordinate function    !!gm  (currently missing!)
+   !!       fssig        : tanh stretch function
+   !!       fssig1       : Song and Haidvogel 1994 stretch function
+   !!       fgamma       : Siddorn and Furner 2012 stretching function
    !!---------------------------------------------------------------------
    USE oce               ! ocean variables
@@ -47,13 +49,24 @@
 
    !                                       !!* Namelist namzgr_sco *
+   LOGICAL  ::   ln_s_sh94   = .false.      ! use hybrid s-sig Song and Haidvogel 1994 stretching function fssig1 (ln_sco=T)
+   LOGICAL  ::   ln_s_sf12   = .true.       ! use hybrid s-z-sig Siddorn and Furner 2012 stretching function fgamma (ln_sco=T)
+   !
    REAL(wp) ::   rn_sbot_min =  300._wp     ! minimum depth of s-bottom surface (>0) (m)
    REAL(wp) ::   rn_sbot_max = 5250._wp     ! maximum depth of s-bottom surface (= ocean depth) (>0) (m)
+   REAL(wp) ::   rn_rmax     =    0.15_wp   ! maximum cut-off r-value allowed (0<rn_rmax<1)
+   REAL(wp) ::   rn_hc       =  150._wp     ! Critical depth for transition from sigma to stretched coordinates
+   ! Song and Haidvogel 1994 stretching parameters
    REAL(wp) ::   rn_theta    =    6.00_wp   ! surface control parameter (0<=rn_theta<=20)
    REAL(wp) ::   rn_thetb    =    0.75_wp   ! bottom control parameter  (0<=rn_thetb<= 1)
-   REAL(wp) ::   rn_rmax     =    0.15_wp   ! maximum cut-off r-value allowed (0<rn_rmax<1)
-   LOGICAL  ::   ln_s_sigma  = .false.      ! use hybrid s-sigma -coordinate & stretching function fssig1 (ln_sco=T)
-   REAL(wp) ::   rn_bb       =    0.80_wp   ! stretching parameter for song and haidvogel stretching
+   REAL(wp) ::   rn_bb       =    0.80_wp   ! stretching parameter 
    !                                        ! ( rn_bb=0; top only, rn_bb =1; top and bottom)
-   REAL(wp) ::   rn_hc       =  150._wp     ! Critical depth for s-sigma coordinates
+   ! Siddorn and Furner stretching parameters
+   LOGICAL  ::   ln_sigcrit  = .false.      ! use sigma coordinates below critical depth (T) or Z coordinates (F) for Siddorn & Furner stretch 
+   REAL(wp) ::   rn_alpha    =    4.4_wp    ! control parameter ( > 1 stretch towards surface, < 1 towards seabed)
+   REAL(wp) ::   rn_efold    =    0.0_wp    !  efold length scale for transition to stretched coord
+   REAL(wp) ::   rn_zs       =    1.0_wp    !  depth of surface grid box
+                           !  bottom cell depth (Zb) is a linear function of water depth Zb = H*a + b
+   REAL(wp) ::   rn_zb_a     =    0.024_wp  !  bathymetry scaling factor for calculating Zb
+   REAL(wp) ::   rn_zb_b     =   -0.2_wp    !  offset for calculating Zb
 
   !! * Substitutions
@@ -1034,56 +1047,4 @@
    END SUBROUTINE zgr_zps
 
-
-   FUNCTION fssig( pk ) RESULT( pf )
-      !!----------------------------------------------------------------------
-      !!                 ***  ROUTINE eos_init  ***
-      !!       
-      !! ** Purpose :   provide the analytical function in s-coordinate
-      !!          
-      !! ** Method  :   the function provide the non-dimensional position of
-      !!                T and W (i.e. between 0 and 1)
-      !!                T-points at integer values (between 1 and jpk)
-      !!                W-points at integer values - 1/2 (between 0.5 and jpk-0.5)
-      !!----------------------------------------------------------------------
-      REAL(wp), INTENT(in) ::   pk   ! continuous "k" coordinate
-      REAL(wp)             ::   pf   ! sigma value
-      !!----------------------------------------------------------------------
-      !
-      pf =   (   TANH( rn_theta * ( -(pk-0.5_wp) / REAL(jpkm1) + rn_thetb )  )   &
-         &     - TANH( rn_thetb * rn_theta                                )  )   &
-         & * (   COSH( rn_theta                           )                      &
-         &     + COSH( rn_theta * ( 2._wp * rn_thetb - 1._wp ) )  )              &
-         & / ( 2._wp * SINH( rn_theta ) )
-      !
-   END FUNCTION fssig
-
-
-   FUNCTION fssig1( pk1, pbb ) RESULT( pf1 )
-      !!----------------------------------------------------------------------
-      !!                 ***  ROUTINE eos_init  ***
-      !!
-      !! ** Purpose :   provide the Song and Haidvogel version of the analytical function in s-coordinate
-      !!
-      !! ** Method  :   the function provides the non-dimensional position of
-      !!                T and W (i.e. between 0 and 1)
-      !!                T-points at integer values (between 1 and jpk)
-      !!                W-points at integer values - 1/2 (between 0.5 and jpk-0.5)
-      !!----------------------------------------------------------------------
-      REAL(wp), INTENT(in) ::   pk1   ! continuous "k" coordinate
-      REAL(wp), INTENT(in) ::   pbb   ! Stretching coefficient
-      REAL(wp)             ::   pf1   ! sigma value
-      !!----------------------------------------------------------------------
-      !
-      IF ( rn_theta == 0 ) then      ! uniform sigma
-         pf1 = - ( pk1 - 0.5_wp ) / REAL( jpkm1 )
-      ELSE                        ! stretched sigma
-         pf1 =   ( 1._wp - pbb ) * ( SINH( rn_theta*(-(pk1-0.5_wp)/REAL(jpkm1)) ) ) / SINH( rn_theta )              &
-            &  + pbb * (  (TANH( rn_theta*( (-(pk1-0.5_wp)/REAL(jpkm1)) + 0.5_wp) ) - TANH( 0.5_wp * rn_theta )  )  &
-            &        / ( 2._wp * TANH( 0.5_wp * rn_theta ) )  )
-      ENDIF
-      !
-   END FUNCTION fssig1
-
-
    SUBROUTINE zgr_sco
       !!----------------------------------------------------------------------
@@ -1104,35 +1065,44 @@
       !!            hbatv = mj( hbatt )
       !!            hbatf = mi( mj( hbatt ) )
-      !!          - Compute gsigt, gsigw, esigt, esigw from an analytical
+      !!          - Compute z_gsigt, z_gsigw, z_esigt, z_esigw from an analytical
       !!         function and its derivative given as function.
-      !!            gsigt(k) = fssig (k    )
-      !!            gsigw(k) = fssig (k-0.5)
-      !!            esigt(k) = fsdsig(k    )
-      !!            esigw(k) = fsdsig(k-0.5)
-      !!      This routine is given as an example, it must be modified
-      !!      following the user s desiderata. nevertheless, the output as
+      !!            z_gsigt(k) = fssig (k    )
+      !!            z_gsigw(k) = fssig (k-0.5)
+      !!            z_esigt(k) = fsdsig(k    )
+      !!            z_esigw(k) = fsdsig(k-0.5)
+      !!      Three options for stretching are give, and they can be modified
+      !!      following the users requirements. Nevertheless, the output as
       !!      well as the way to compute the model levels and scale factors
-      !!      must be respected in order to insure second order a!!uracy
+      !!      must be respected in order to insure second order accuracy
       !!      schemes.
       !!
-      !! Reference : Madec, Lott, Delecluse and Crepon, 1996. JPO, 26, 1393-1408.
+      !!      The three methods for stretching available are:
+      !! 
+      !!           s_sh94 (Song and Haidvogel 1994)
+      !!                a sinh/tanh function that allows sigma and stretched sigma
+      !!
+      !!           s_sf12 (Siddorn and Furner 2012?)
+      !!                allows the maintenance of fixed surface and or
+      !!                bottom cell resolutions (cf. geopotential coordinates) 
+      !!                within an analytically derived stretched S-coordinate framework.
+      !! 
+      !!          s_tanh  (Madec et al 1996)
+      !!                a cosh/tanh function that gives stretched coordinates        
+      !!
       !!----------------------------------------------------------------------
       !
       INTEGER  ::   ji, jj, jk, jl           ! dummy loop argument
       INTEGER  ::   iip1, ijp1, iim1, ijm1   ! temporary integers
-      REAL(wp) ::   zcoeft, zcoefw, zrmax, ztaper   ! temporary scalars
+      REAL(wp) ::   zrmax, ztaper   ! temporary scalars
       !
       REAL(wp), POINTER, DIMENSION(:,:  ) :: zenv, ztmp, zmsk, zri, zrj, zhbat
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: gsigw3, gsigt3, gsi3w3
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: esigt3, esigw3, esigtu3, esigtv3, esigtf3, esigwu3, esigwv3           
-
-      NAMELIST/namzgr_sco/ rn_sbot_max, rn_sbot_min, rn_theta, rn_thetb, rn_rmax, ln_s_sigma, rn_bb, rn_hc
-      !!----------------------------------------------------------------------
+
+      NAMELIST/namzgr_sco/ln_s_sh94, ln_s_sf12, ln_sigcrit, rn_sbot_min, rn_sbot_max, rn_hc, rn_rmax,rn_theta, &
+                           rn_thetb, rn_bb, rn_alpha, rn_efold, rn_zs, rn_zb_a, rn_zb_b
+     !!----------------------------------------------------------------------
       !
       IF( nn_timing == 1 )  CALL timing_start('zgr_sco')
       !
       CALL wrk_alloc( jpi, jpj,      zenv, ztmp, zmsk, zri, zrj, zhbat                           )
-      CALL wrk_alloc( jpi, jpj, jpk, gsigw3, gsigt3, gsi3w3                                      )
-      CALL wrk_alloc( jpi, jpj, jpk, esigt3, esigw3, esigtu3, esigtv3, esigtf3, esigwu3, esigwv3 )
       !
       REWIND( numnam )                       ! Read Namelist namzgr_sco : sigma-stretching parameters
@@ -1144,19 +1114,24 @@
          WRITE(numout,*) '~~~~~~~~~~~'
          WRITE(numout,*) '   Namelist namzgr_sco'
-         WRITE(numout,*) '      sigma-stretching coeffs '
-         WRITE(numout,*) '      maximum depth of s-bottom surface (>0)       rn_sbot_max   = ' ,rn_sbot_max
-         WRITE(numout,*) '      minimum depth of s-bottom surface (>0)       rn_sbot_min   = ' ,rn_sbot_min
-         WRITE(numout,*) '      surface control parameter (0<=rn_theta<=20)  rn_theta      = ', rn_theta
-         WRITE(numout,*) '      bottom  control parameter (0<=rn_thetb<= 1)  rn_thetb      = ', rn_thetb
-         WRITE(numout,*) '      maximum cut-off r-value allowed              rn_rmax       = ', rn_rmax
-         WRITE(numout,*) '      Hybrid s-sigma-coordinate                    ln_s_sigma    = ', ln_s_sigma
-         WRITE(numout,*) '      stretching parameter (song and haidvogel)    rn_bb         = ', rn_bb
-         WRITE(numout,*) '      Critical depth                               rn_hc         = ', rn_hc
-      ENDIF
-
-      gsigw3  = 0._wp   ;   gsigt3  = 0._wp   ;   gsi3w3  = 0._wp
-      esigt3  = 0._wp   ;   esigw3  = 0._wp 
-      esigtu3 = 0._wp   ;   esigtv3 = 0._wp   ;   esigtf3 = 0._wp
-      esigwu3 = 0._wp   ;   esigwv3 = 0._wp
+         WRITE(numout,*) '     stretching coeffs '
+         WRITE(numout,*) '        maximum depth of s-bottom surface (>0)       rn_sbot_max   = ',rn_sbot_max
+         WRITE(numout,*) '        minimum depth of s-bottom surface (>0)       rn_sbot_min   = ',rn_sbot_min
+         WRITE(numout,*) '        Critical depth                               rn_hc         = ',rn_hc
+         WRITE(numout,*) '        maximum cut-off r-value allowed              rn_rmax       = ',rn_rmax
+         WRITE(numout,*) '     Song and Haidvogel 1994 stretching              ln_s_sh94     = ',ln_s_sh94
+         WRITE(numout,*) '        Song and Haidvogel 1994 stretching coefficients'
+         WRITE(numout,*) '        surface control parameter (0<=rn_theta<=20)  rn_theta      = ',rn_theta
+         WRITE(numout,*) '        bottom  control parameter (0<=rn_thetb<= 1)  rn_thetb      = ',rn_thetb
+         WRITE(numout,*) '        stretching parameter (song and haidvogel)    rn_bb         = ',rn_bb
+         WRITE(numout,*) '     Siddorn and Furner 2012 stretching              ln_s_sf12     = ',ln_s_sf12
+         WRITE(numout,*) '        switching to sigma (T) or Z (F) at H<Hc      ln_sigcrit    = ',ln_sigcrit
+         WRITE(numout,*) '        Siddorn and Furner 2012 stretching coefficients'
+         WRITE(numout,*) '        stretchin parameter ( >1 surface; <1 bottom) rn_alpha      = ',rn_alpha
+         WRITE(numout,*) '        e-fold length scale for transition region    rn_efold      = ',rn_efold
+         WRITE(numout,*) '        Surface cell depth (Zs) (m)                  rn_zs         = ',rn_zs
+         WRITE(numout,*) '        Bathymetry multiplier for Zb                 rn_zb_a       = ',rn_zb_a
+         WRITE(numout,*) '        Offset for Zb                                rn_zb_b       = ',rn_zb_b
+         WRITE(numout,*) '        Bottom cell (Zb) (m) = H*rn_zb_a + rn_zb_b'
+      ENDIF
 
       hift(:,:) = rn_sbot_min                     ! set the minimum depth for the s-coordinate
@@ -1352,139 +1327,28 @@
       ! non-dimensional "sigma" for model level depth at w- and t-levels
 
-      IF( ln_s_sigma ) THEN        ! Song and Haidvogel style stretched sigma for depths
-         !                         ! below rn_hc, with uniform sigma in shallower waters
-         DO ji = 1, jpi
-            DO jj = 1, jpj
-
-               IF( hbatt(ji,jj) > rn_hc ) THEN    !deep water, stretched sigma
-                  DO jk = 1, jpk
-                     gsigw3(ji,jj,jk) = -fssig1( REAL(jk,wp)-0.5_wp, rn_bb )
-                     gsigt3(ji,jj,jk) = -fssig1( REAL(jk,wp)       , rn_bb )
-                  END DO
-               ELSE ! shallow water, uniform sigma
-                  DO jk = 1, jpk
-                     gsigw3(ji,jj,jk) =   REAL(jk-1,wp)            / REAL(jpk-1,wp)
-                     gsigt3(ji,jj,jk) = ( REAL(jk-1,wp) + 0.5_wp ) / REAL(jpk-1,wp)
-                  END DO
-               ENDIF
-               IF( nprint == 1 .AND. lwp )   WRITE(numout,*) 'gsigw3 1 jpk    ', gsigw3(ji,jj,1), gsigw3(ji,jj,jpk)
-               !
-               DO jk = 1, jpkm1
-                  esigt3(ji,jj,jk  ) = gsigw3(ji,jj,jk+1) - gsigw3(ji,jj,jk)
-                  esigw3(ji,jj,jk+1) = gsigt3(ji,jj,jk+1) - gsigt3(ji,jj,jk)
-               END DO
-               esigw3(ji,jj,1  ) = 2._wp * ( gsigt3(ji,jj,1  ) - gsigw3(ji,jj,1  ) )
-               esigt3(ji,jj,jpk) = 2._wp * ( gsigt3(ji,jj,jpk) - gsigw3(ji,jj,jpk) )
-               !
-               ! Coefficients for vertical depth as the sum of e3w scale factors
-               gsi3w3(ji,jj,1) = 0.5_wp * esigw3(ji,jj,1)
-               DO jk = 2, jpk
-                  gsi3w3(ji,jj,jk) = gsi3w3(ji,jj,jk-1) + esigw3(ji,jj,jk)
-               END DO
-               !
-               DO jk = 1, jpk
-                  zcoeft = ( REAL(jk,wp) - 0.5_wp ) / REAL(jpkm1,wp)
-                  zcoefw = ( REAL(jk,wp) - 1.0_wp ) / REAL(jpkm1,wp)
-                  gdept (ji,jj,jk) = ( scosrf(ji,jj) + (hbatt(ji,jj)-rn_hc)*gsigt3(ji,jj,jk)+rn_hc*zcoeft )
-                  gdepw (ji,jj,jk) = ( scosrf(ji,jj) + (hbatt(ji,jj)-rn_hc)*gsigw3(ji,jj,jk)+rn_hc*zcoefw )
-                  gdep3w(ji,jj,jk) = ( scosrf(ji,jj) + (hbatt(ji,jj)-rn_hc)*gsi3w3(ji,jj,jk)+rn_hc*zcoeft )
-               END DO
-               !
-            END DO   ! for all jj's
-         END DO    ! for all ji's
-
-         DO ji = 1, jpim1
-            DO jj = 1, jpjm1
-               DO jk = 1, jpk
-                  esigtu3(ji,jj,jk) = ( hbatt(ji,jj)*esigt3(ji,jj,jk)+hbatt(ji+1,jj)*esigt3(ji+1,jj,jk) )   &
-                     &              / ( hbatt(ji,jj)+hbatt(ji+1,jj) )
-                  esigtv3(ji,jj,jk) = ( hbatt(ji,jj)*esigt3(ji,jj,jk)+hbatt(ji,jj+1)*esigt3(ji,jj+1,jk) )   &
-                     &              / ( hbatt(ji,jj)+hbatt(ji,jj+1) )
-                  esigtf3(ji,jj,jk) = ( hbatt(ji,jj)*esigt3(ji,jj,jk)+hbatt(ji+1,jj)*esigt3(ji+1,jj,jk)     &
-                     &                + hbatt(ji,jj+1)*esigt3(ji,jj+1,jk)+hbatt(ji+1,jj+1)*esigt3(ji+1,jj+1,jk) )   &
-                     &              / ( hbatt(ji,jj)+hbatt(ji+1,jj)+hbatt(ji,jj+1)+hbatt(ji+1,jj+1) )
-                  esigwu3(ji,jj,jk) = ( hbatt(ji,jj)*esigw3(ji,jj,jk)+hbatt(ji+1,jj)*esigw3(ji+1,jj,jk) )   &
-                     &              / ( hbatt(ji,jj)+hbatt(ji+1,jj) )
-                  esigwv3(ji,jj,jk) = ( hbatt(ji,jj)*esigw3(ji,jj,jk)+hbatt(ji,jj+1)*esigw3(ji,jj+1,jk) )   &
-                     &              / ( hbatt(ji,jj)+hbatt(ji,jj+1) )
-                  !
-                  e3t(ji,jj,jk) = ( (hbatt(ji,jj)-rn_hc)*esigt3 (ji,jj,jk) + rn_hc/FLOAT(jpkm1) )
-                  e3u(ji,jj,jk) = ( (hbatu(ji,jj)-rn_hc)*esigtu3(ji,jj,jk) + rn_hc/FLOAT(jpkm1) )
-                  e3v(ji,jj,jk) = ( (hbatv(ji,jj)-rn_hc)*esigtv3(ji,jj,jk) + rn_hc/FLOAT(jpkm1) )
-                  e3f(ji,jj,jk) = ( (hbatf(ji,jj)-rn_hc)*esigtf3(ji,jj,jk) + rn_hc/FLOAT(jpkm1) )
-                  !
-                  e3w (ji,jj,jk) = ( (hbatt(ji,jj)-rn_hc)*esigw3 (ji,jj,jk) + rn_hc/FLOAT(jpkm1) )
-                  e3uw(ji,jj,jk) = ( (hbatu(ji,jj)-rn_hc)*esigwu3(ji,jj,jk) + rn_hc/FLOAT(jpkm1) )
-                  e3vw(ji,jj,jk) = ( (hbatv(ji,jj)-rn_hc)*esigwv3(ji,jj,jk) + rn_hc/FLOAT(jpkm1) )
-               END DO
-            END DO
-         END DO
-
-         CALL lbc_lnk( e3t , 'T', 1._wp )
-         CALL lbc_lnk( e3u , 'U', 1._wp )
-         CALL lbc_lnk( e3v , 'V', 1._wp )
-         CALL lbc_lnk( e3f , 'F', 1._wp )
-         CALL lbc_lnk( e3w , 'W', 1._wp )
-         CALL lbc_lnk( e3uw, 'U', 1._wp )
-         CALL lbc_lnk( e3vw, 'V', 1._wp )
-
-         !
-      ELSE   ! not ln_s_sigma
-         !
-         DO jk = 1, jpk
-           gsigw(jk) = -fssig( REAL(jk,wp)-0.5_wp )
-           gsigt(jk) = -fssig( REAL(jk,wp)        )
-         END DO
-         IF( nprint == 1 .AND. lwp )   WRITE(numout,*) 'gsigw 1 jpk    ', gsigw(1), gsigw(jpk)
-         !
-         ! Coefficients for vertical scale factors at w-, t- levels
-!!gm bug :  define it from analytical function, not like juste bellow....
-!!gm        or betteroffer the 2 possibilities....
-         DO jk = 1, jpkm1
-            esigt(jk  ) = gsigw(jk+1) - gsigw(jk)
-            esigw(jk+1) = gsigt(jk+1) - gsigt(jk)
-         END DO
-         esigw( 1 ) = 2._wp * ( gsigt(1  ) - gsigw(1  ) ) 
-         esigt(jpk) = 2._wp * ( gsigt(jpk) - gsigw(jpk) )
-
-!!gm  original form
-!!org DO jk = 1, jpk
-!!org    esigt(jk)=fsdsig( FLOAT(jk)     )
-!!org    esigw(jk)=fsdsig( FLOAT(jk)-0.5 )
-!!org END DO
-!!gm
-         !
-         ! Coefficients for vertical depth as the sum of e3w scale factors
-         gsi3w(1) = 0.5_wp * esigw(1)
-         DO jk = 2, jpk
-            gsi3w(jk) = gsi3w(jk-1) + esigw(jk)
-         END DO
-!!gm: depuw, depvw can be suppressed (modif in ldfslp) and depw=dep3w can be set (save 3 3D arrays)
-         DO jk = 1, jpk
-            zcoeft = ( REAL(jk,wp) - 0.5_wp ) / REAL(jpkm1,wp)
-            zcoefw = ( REAL(jk,wp) - 1.0_wp ) / REAL(jpkm1,wp)
-            gdept (:,:,jk) = ( scosrf(:,:) + (hbatt(:,:)-hift(:,:))*gsigt(jk) + hift(:,:)*zcoeft )
-            gdepw (:,:,jk) = ( scosrf(:,:) + (hbatt(:,:)-hift(:,:))*gsigw(jk) + hift(:,:)*zcoefw )
-            gdep3w(:,:,jk) = ( scosrf(:,:) + (hbatt(:,:)-hift(:,:))*gsi3w(jk) + hift(:,:)*zcoeft )
-         END DO
-!!gm: e3uw, e3vw can be suppressed  (modif in dynzdf, dynzdf_iso, zdfbfr) (save 2 3D arrays)
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               DO jk = 1, jpk
-                 e3t(ji,jj,jk) = ( (hbatt(ji,jj)-hift(ji,jj))*esigt(jk) + hift(ji,jj)/REAL(jpkm1,wp) )
-                 e3u(ji,jj,jk) = ( (hbatu(ji,jj)-hifu(ji,jj))*esigt(jk) + hifu(ji,jj)/REAL(jpkm1,wp) )
-                 e3v(ji,jj,jk) = ( (hbatv(ji,jj)-hifv(ji,jj))*esigt(jk) + hifv(ji,jj)/REAL(jpkm1,wp) )
-                 e3f(ji,jj,jk) = ( (hbatf(ji,jj)-hiff(ji,jj))*esigt(jk) + hiff(ji,jj)/REAL(jpkm1,wp) )
-                 !
-                 e3w (ji,jj,jk) = ( (hbatt(ji,jj)-hift(ji,jj))*esigw(jk) + hift(ji,jj)/REAL(jpkm1,wp) )
-                 e3uw(ji,jj,jk) = ( (hbatu(ji,jj)-hifu(ji,jj))*esigw(jk) + hifu(ji,jj)/REAL(jpkm1,wp) )
-                 e3vw(ji,jj,jk) = ( (hbatv(ji,jj)-hifv(ji,jj))*esigw(jk) + hifv(ji,jj)/REAL(jpkm1,wp) )
-               END DO
-            END DO
-         END DO
-         !
-      ENDIF ! ln_s_sigma
-
-
+
+!========================================================================
+! Song and Haidvogel  1994 (ln_s_sh94=T)
+! Siddorn and Furner 2012 (ln_sf12=T)
+! or  tanh function       (both false)                    
+!========================================================================
+      IF      ( ln_s_sh94 ) THEN 
+                           CALL s_sh94()
+      ELSE IF ( ln_s_sf12 ) THEN
+                           CALL s_sf12()
+      ELSE                 
+                           CALL s_tanh()
+      ENDIF 
+
+      CALL lbc_lnk( e3t , 'T', 1._wp )
+      CALL lbc_lnk( e3u , 'U', 1._wp )
+      CALL lbc_lnk( e3v , 'V', 1._wp )
+      CALL lbc_lnk( e3f , 'F', 1._wp )
+      CALL lbc_lnk( e3w , 'W', 1._wp )
+      CALL lbc_lnk( e3uw, 'U', 1._wp )
+      CALL lbc_lnk( e3vw, 'V', 1._wp )
+
+      fsdepw(:,:,:) = gdepw (:,:,:)
+      fsde3w(:,:,:) = gdep3w(:,:,:)
       !
       where (e3t   (:,:,:).eq.0.0)  e3t(:,:,:) = 1.0
@@ -1520,12 +1384,4 @@
          &                                                       ' MAX ', MAXVAL( mbathy(:,:) )
 
-      !                                               ! =============
-      IF(lwp) THEN                                    ! Control print
-         !                                            ! =============
-         WRITE(numout,*) 
-         WRITE(numout,*) ' domzgr: vertical coefficients for model level'
-         WRITE(numout, "(9x,'  level    gsigt      gsigw      esigt      esigw      gsi3w')" )
-         WRITE(numout, "(10x,i4,5f11.4)" ) ( jk, gsigt(jk), gsigw(jk), esigt(jk), esigw(jk), gsi3w(jk), jk=1,jpk )
-      ENDIF
       IF( nprint == 1  .AND. lwp )   THEN         ! min max values over the local domain
          WRITE(numout,*) ' MIN val mbathy  ', MINVAL( mbathy(:,:)   ), ' MAX ', MAXVAL( mbathy(:,:) )
@@ -1544,5 +1400,5 @@
             &                          ' w ', MAXVAL( fse3w (:,:,:) )
       ENDIF
-      !
+      !  END DO
       IF(lwp) THEN                                  ! selected vertical profiles
          WRITE(numout,*)
@@ -1574,28 +1430,461 @@
       ENDIF
 
-!!gm bug?  no more necessary?  if ! defined key_helsinki
+!================================================================================
+! check the coordinate makes sense
+!================================================================================
+      DO ji = 1, jpi
+         DO jj = 1, jpj
+
+            IF( hbatt(ji,jj) > 0._wp) THEN
+               DO jk = 1, mbathy(ji,jj)
+                 ! check coordinate is monotonically increasing
+                 IF (fse3w(ji,jj,jk) <= 0._wp .OR. fse3t(ji,jj,jk) <= 0._wp ) THEN
+                    WRITE(ctmp1,*) 'ERROR zgr_sco :   e3w   or e3t   =< 0  at point (i,j,k)= ', ji, jj, jk
+                    WRITE(numout,*) 'ERROR zgr_sco :   e3w   or e3t   =< 0  at point (i,j,k)= ', ji, jj, jk
+                    WRITE(numout,*) 'e3w',fse3w(ji,jj,:)
+                    WRITE(numout,*) 'e3t',fse3t(ji,jj,:)
+                    CALL ctl_stop( ctmp1 )
+                 ENDIF
+                 ! and check it has never gone negative
+                 IF( fsdepw(ji,jj,jk) < 0._wp .OR. fsdept(ji,jj,jk) < 0._wp ) THEN
+                    WRITE(ctmp1,*) 'ERROR zgr_sco :   gdepw or gdept =< 0  at point (i,j,k)= ', ji, jj, jk
+                    WRITE(numout,*) 'ERROR zgr_sco :   gdepw   or gdept   =< 0  at point (i,j,k)= ', ji, jj, jk
+                    WRITE(numout,*) 'gdepw',fsdepw(ji,jj,:)
+                    WRITE(numout,*) 'gdept',fsdept(ji,jj,:)
+                    CALL ctl_stop( ctmp1 )
+                 ENDIF
+                 ! and check it never exceeds the total depth
+                 IF( fsdepw(ji,jj,jk) > hbatt(ji,jj) ) THEN
+                    WRITE(ctmp1,*) 'ERROR zgr_sco :   gdepw > hbatt  at point (i,j,k)= ', ji, jj, jk
+                    WRITE(numout,*) 'ERROR zgr_sco :   gdepw > hbatt  at point (i,j,k)= ', ji, jj, jk
+                    WRITE(numout,*) 'gdepw',fsdepw(ji,jj,:)
+                    CALL ctl_stop( ctmp1 )
+                 ENDIF
+               END DO
+
+               DO jk = 1, mbathy(ji,jj)-1
+                 ! and check it never exceeds the total depth
+                IF( fsdept(ji,jj,jk) > hbatt(ji,jj) ) THEN
+                    WRITE(ctmp1,*) 'ERROR zgr_sco :   gdept > hbatt  at point (i,j,k)= ', ji, jj, jk
+                    WRITE(numout,*) 'ERROR zgr_sco :   gdept > hbatt  at point (i,j,k)= ', ji, jj, jk
+                    WRITE(numout,*) 'gdept',fsdept(ji,jj,:)
+                    CALL ctl_stop( ctmp1 )
+                 ENDIF
+               END DO
+
+            ENDIF
+
+         END DO
+      END DO
+      !
+      CALL wrk_dealloc( jpi, jpj,      zenv, ztmp, zmsk, zri, zrj, zhbat                           )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('zgr_sco')
+      !
+   END SUBROUTINE zgr_sco
+
+!!======================================================================
+   SUBROUTINE s_sh94()
+
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE s_sh94  ***
+      !!                     
+      !! ** Purpose :   stretch the s-coordinate system
+      !!
+      !! ** Method  :   s-coordinate stretch using the Song and Haidvogel 1994
+      !!                mixed S/sigma coordinate
+      !!
+      !! Reference : Song and Haidvogel 1994. 
+      !!----------------------------------------------------------------------
+      !
+      INTEGER  ::   ji, jj, jk           ! dummy loop argument
+      REAL(wp) ::   zcoeft, zcoefw   ! temporary scalars
+      !
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: z_gsigw3, z_gsigt3, z_gsi3w3
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: z_esigt3, z_esigw3, z_esigtu3, z_esigtv3, z_esigtf3, z_esigwu3, z_esigwv3           
+
+      CALL wrk_alloc( jpi, jpj, jpk, z_gsigw3, z_gsigt3, z_gsi3w3                                      )
+      CALL wrk_alloc( jpi, jpj, jpk, z_esigt3, z_esigw3, z_esigtu3, z_esigtv3, z_esigtf3, z_esigwu3, z_esigwv3 )
+
+      z_gsigw3  = 0._wp   ;   z_gsigt3  = 0._wp   ;   z_gsi3w3  = 0._wp
+      z_esigt3  = 0._wp   ;   z_esigw3  = 0._wp 
+      z_esigtu3 = 0._wp   ;   z_esigtv3 = 0._wp   ;   z_esigtf3 = 0._wp
+      z_esigwu3 = 0._wp   ;   z_esigwv3 = 0._wp
+
+      DO ji = 1, jpi
+         DO jj = 1, jpj
+
+            IF( hbatt(ji,jj) > rn_hc ) THEN    !deep water, stretched sigma
+               DO jk = 1, jpk
+                  z_gsigw3(ji,jj,jk) = -fssig1( REAL(jk,wp)-0.5_wp, rn_bb )
+                  z_gsigt3(ji,jj,jk) = -fssig1( REAL(jk,wp)       , rn_bb )
+               END DO
+            ELSE ! shallow water, uniform sigma
+               DO jk = 1, jpk
+                  z_gsigw3(ji,jj,jk) =   REAL(jk-1,wp)            / REAL(jpk-1,wp)
+                  z_gsigt3(ji,jj,jk) = ( REAL(jk-1,wp) + 0.5_wp ) / REAL(jpk-1,wp)
+                  END DO
+            ENDIF
+            !
+            DO jk = 1, jpkm1
+               z_esigt3(ji,jj,jk  ) = z_gsigw3(ji,jj,jk+1) - z_gsigw3(ji,jj,jk)
+               z_esigw3(ji,jj,jk+1) = z_gsigt3(ji,jj,jk+1) - z_gsigt3(ji,jj,jk)
+            END DO
+            z_esigw3(ji,jj,1  ) = 2._wp * ( z_gsigt3(ji,jj,1  ) - z_gsigw3(ji,jj,1  ) )
+            z_esigt3(ji,jj,jpk) = 2._wp * ( z_gsigt3(ji,jj,jpk) - z_gsigw3(ji,jj,jpk) )
+            !
+            ! Coefficients for vertical depth as the sum of e3w scale factors
+            z_gsi3w3(ji,jj,1) = 0.5_wp * z_esigw3(ji,jj,1)
+            DO jk = 2, jpk
+               z_gsi3w3(ji,jj,jk) = z_gsi3w3(ji,jj,jk-1) + z_esigw3(ji,jj,jk)
+            END DO
+            !
+            DO jk = 1, jpk
+               zcoeft = ( REAL(jk,wp) - 0.5_wp ) / REAL(jpkm1,wp)
+               zcoefw = ( REAL(jk,wp) - 1.0_wp ) / REAL(jpkm1,wp)
+               gdept (ji,jj,jk) = ( scosrf(ji,jj) + (hbatt(ji,jj)-rn_hc)*z_gsigt3(ji,jj,jk)+rn_hc*zcoeft )
+               gdepw (ji,jj,jk) = ( scosrf(ji,jj) + (hbatt(ji,jj)-rn_hc)*z_gsigw3(ji,jj,jk)+rn_hc*zcoefw )
+               gdep3w(ji,jj,jk) = ( scosrf(ji,jj) + (hbatt(ji,jj)-rn_hc)*z_gsi3w3(ji,jj,jk)+rn_hc*zcoeft )
+            END DO
+           !
+         END DO   ! for all jj's
+      END DO    ! for all ji's
+
+      DO ji = 1, jpim1
+         DO jj = 1, jpjm1
+            DO jk = 1, jpk
+               z_esigtu3(ji,jj,jk) = ( hbatt(ji,jj)*z_esigt3(ji,jj,jk)+hbatt(ji+1,jj)*z_esigt3(ji+1,jj,jk) )   &
+                  &              / ( hbatt(ji,jj)+hbatt(ji+1,jj) )
+               z_esigtv3(ji,jj,jk) = ( hbatt(ji,jj)*z_esigt3(ji,jj,jk)+hbatt(ji,jj+1)*z_esigt3(ji,jj+1,jk) )   &
+                  &              / ( hbatt(ji,jj)+hbatt(ji,jj+1) )
+               z_esigtf3(ji,jj,jk) = ( hbatt(ji,jj)*z_esigt3(ji,jj,jk)+hbatt(ji+1,jj)*z_esigt3(ji+1,jj,jk)     &
+                  &                + hbatt(ji,jj+1)*z_esigt3(ji,jj+1,jk)+hbatt(ji+1,jj+1)*z_esigt3(ji+1,jj+1,jk) )   &
+                  &              / ( hbatt(ji,jj)+hbatt(ji+1,jj)+hbatt(ji,jj+1)+hbatt(ji+1,jj+1) )
+               z_esigwu3(ji,jj,jk) = ( hbatt(ji,jj)*z_esigw3(ji,jj,jk)+hbatt(ji+1,jj)*z_esigw3(ji+1,jj,jk) )   &
+                  &              / ( hbatt(ji,jj)+hbatt(ji+1,jj) )
+               z_esigwv3(ji,jj,jk) = ( hbatt(ji,jj)*z_esigw3(ji,jj,jk)+hbatt(ji,jj+1)*z_esigw3(ji,jj+1,jk) )   &
+                  &              / ( hbatt(ji,jj)+hbatt(ji,jj+1) )
+               !
+               e3t(ji,jj,jk) = ( (hbatt(ji,jj)-rn_hc)*z_esigt3 (ji,jj,jk) + rn_hc/REAL(jpkm1,wp) )
+               e3u(ji,jj,jk) = ( (hbatu(ji,jj)-rn_hc)*z_esigtu3(ji,jj,jk) + rn_hc/REAL(jpkm1,wp) )
+               e3v(ji,jj,jk) = ( (hbatv(ji,jj)-rn_hc)*z_esigtv3(ji,jj,jk) + rn_hc/REAL(jpkm1,wp) )
+               e3f(ji,jj,jk) = ( (hbatf(ji,jj)-rn_hc)*z_esigtf3(ji,jj,jk) + rn_hc/REAL(jpkm1,wp) )
+               !
+               e3w (ji,jj,jk) = ( (hbatt(ji,jj)-rn_hc)*z_esigw3 (ji,jj,jk) + rn_hc/REAL(jpkm1,wp) )
+               e3uw(ji,jj,jk) = ( (hbatu(ji,jj)-rn_hc)*z_esigwu3(ji,jj,jk) + rn_hc/REAL(jpkm1,wp) )
+               e3vw(ji,jj,jk) = ( (hbatv(ji,jj)-rn_hc)*z_esigwv3(ji,jj,jk) + rn_hc/REAL(jpkm1,wp) )
+            END DO
+        END DO
+      END DO
+
+      CALL wrk_dealloc( jpi, jpj, jpk, z_gsigw3, z_gsigt3, z_gsi3w3                                      )
+      CALL wrk_dealloc( jpi, jpj, jpk, z_esigt3, z_esigw3, z_esigtu3, z_esigtv3, z_esigtf3, z_esigwu3, z_esigwv3 )
+
+   END SUBROUTINE s_sh94
+
+   SUBROUTINE s_sf12
+
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE s_sf12 *** 
+      !!                     
+      !! ** Purpose :   stretch the s-coordinate system
+      !!
+      !! ** Method  :   s-coordinate stretch using the Siddorn and Furner 2012?
+      !!                mixed S/sigma/Z coordinate
+      !!
+      !!                This method allows the maintenance of fixed surface and or
+      !!                bottom cell resolutions (cf. geopotential coordinates) 
+      !!                within an analytically derived stretched S-coordinate framework.
+      !!
+      !!
+      !! Reference : Siddorn and Furner 2012 (submitted Ocean modelling).
+      !!----------------------------------------------------------------------
+      !
+      INTEGER  ::   ji, jj, jk           ! dummy loop argument
+      REAL(wp) ::   zsmth               ! smoothing around critical depth
+      REAL(wp) ::   zzs, zzb           ! Surface and bottom cell thickness in sigma space
+      !
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: z_gsigw3, z_gsigt3, z_gsi3w3
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: z_esigt3, z_esigw3, z_esigtu3, z_esigtv3, z_esigtf3, z_esigwu3, z_esigwv3           
+
+      !
+      CALL wrk_alloc( jpi, jpj, jpk, z_gsigw3, z_gsigt3, z_gsi3w3                                      )
+      CALL wrk_alloc( jpi, jpj, jpk, z_esigt3, z_esigw3, z_esigtu3, z_esigtv3, z_esigtf3, z_esigwu3, z_esigwv3 )
+
+      z_gsigw3  = 0._wp   ;   z_gsigt3  = 0._wp   ;   z_gsi3w3  = 0._wp
+      z_esigt3  = 0._wp   ;   z_esigw3  = 0._wp 
+      z_esigtu3 = 0._wp   ;   z_esigtv3 = 0._wp   ;   z_esigtf3 = 0._wp
+      z_esigwu3 = 0._wp   ;   z_esigwv3 = 0._wp
+
+      DO ji = 1, jpi
+         DO jj = 1, jpj
+
+          IF (hbatt(ji,jj)>rn_hc) THEN !deep water, stretched sigma
+              
+              zzb = hbatt(ji,jj)*rn_zb_a + rn_zb_b   ! this forces a linear bottom cell depth relationship with H,.
+                                                     ! could be changed by users but care must be taken to do so carefully
+              zzb = 1.0_wp-(zzb/hbatt(ji,jj))
+            
+              zzs = rn_zs / hbatt(ji,jj) 
+              
+              IF (rn_efold /= 0.0_wp) THEN
+                zsmth   = tanh( (hbatt(ji,jj)- rn_hc ) / rn_efold )
+              ELSE
+                zsmth = 1.0_wp 
+              ENDIF
+               
+              DO jk = 1, jpk
+                z_gsigw3(ji,jj,jk) =  REAL(jk-1,wp)        /REAL(jpk-1,wp)
+                z_gsigt3(ji,jj,jk) = (REAL(jk-1,wp)+0.5_wp)/REAL(jpk-1,wp)
+              ENDDO
+              z_gsigw3(ji,jj,:) = fgamma( z_gsigw3(ji,jj,:), zzb, zzs, zsmth  )
+              z_gsigt3(ji,jj,:) = fgamma( z_gsigt3(ji,jj,:), zzb, zzs, zsmth  )
+ 
+          ELSE IF (ln_sigcrit) THEN ! shallow water, uniform sigma
+
+            DO jk = 1, jpk
+              z_gsigw3(ji,jj,jk) =  REAL(jk-1,wp)     /REAL(jpk-1,wp)
+              z_gsigt3(ji,jj,jk) = (REAL(jk-1,wp)+0.5)/REAL(jpk-1,wp)
+            END DO
+
+          ELSE  ! shallow water, z coordinates
+
+            DO jk = 1, jpk
+              z_gsigw3(ji,jj,jk) =  REAL(jk-1,wp)        /REAL(jpk-1,wp)*(rn_hc/hbatt(ji,jj))
+              z_gsigt3(ji,jj,jk) = (REAL(jk-1,wp)+0.5_wp)/REAL(jpk-1,wp)*(rn_hc/hbatt(ji,jj))
+            END DO
+
+          ENDIF
+
+          DO jk = 1, jpkm1
+             z_esigt3(ji,jj,jk) = z_gsigw3(ji,jj,jk+1) - z_gsigw3(ji,jj,jk)
+             z_esigw3(ji,jj,jk+1) = z_gsigt3(ji,jj,jk+1) - z_gsigt3(ji,jj,jk)
+          END DO
+          z_esigw3(ji,jj,1  ) = 2.0_wp * (z_gsigt3(ji,jj,1  ) - z_gsigw3(ji,jj,1  ))
+          z_esigt3(ji,jj,jpk) = 2.0_wp * (z_gsigt3(ji,jj,jpk) - z_gsigw3(ji,jj,jpk))
+
+          ! Coefficients for vertical depth as the sum of e3w scale factors
+          z_gsi3w3(ji,jj,1) = 0.5 * z_esigw3(ji,jj,1)
+          DO jk = 2, jpk
+             z_gsi3w3(ji,jj,jk) = z_gsi3w3(ji,jj,jk-1) + z_esigw3(ji,jj,jk)
+          END DO
+
+          DO jk = 1, jpk
+             gdept (ji,jj,jk) = (scosrf(ji,jj)+hbatt(ji,jj))*z_gsigt3(ji,jj,jk)
+             gdepw (ji,jj,jk) = (scosrf(ji,jj)+hbatt(ji,jj))*z_gsigw3(ji,jj,jk)
+             gdep3w(ji,jj,jk) = (scosrf(ji,jj)+hbatt(ji,jj))*z_gsi3w3(ji,jj,jk)
+          END DO
+
+        ENDDO   ! for all jj's
+      ENDDO    ! for all ji's
+
+      DO ji=1,jpi
+        DO jj=1,jpj
+
+          DO jk = 1, jpk
+                z_esigtu3(ji,jj,jk) = ( hbatt(ji,jj)*z_esigt3(ji,jj,jk)+hbatt(ji+1,jj)*z_esigt3(ji+1,jj,jk) ) / &
+                                    ( hbatt(ji,jj)+hbatt(ji+1,jj) )
+                z_esigtv3(ji,jj,jk) = ( hbatt(ji,jj)*z_esigt3(ji,jj,jk)+hbatt(ji,jj+1)*z_esigt3(ji,jj+1,jk) ) / &
+                                    ( hbatt(ji,jj)+hbatt(ji,jj+1) )
+                z_esigtf3(ji,jj,jk) = ( hbatt(ji,jj)*z_esigt3(ji,jj,jk)+hbatt(ji+1,jj)*z_esigt3(ji+1,jj,jk) +  &
+                                      hbatt(ji,jj+1)*z_esigt3(ji,jj+1,jk)+hbatt(ji+1,jj+1)*z_esigt3(ji+1,jj+1,jk) ) / &
+                                    ( hbatt(ji,jj)+hbatt(ji+1,jj)+hbatt(ji,jj+1)+hbatt(ji+1,jj+1) )
+                z_esigwu3(ji,jj,jk) = ( hbatt(ji,jj)*z_esigw3(ji,jj,jk)+hbatt(ji+1,jj)*z_esigw3(ji+1,jj,jk) ) / &
+                                    ( hbatt(ji,jj)+hbatt(ji+1,jj) )
+                z_esigwv3(ji,jj,jk) = ( hbatt(ji,jj)*z_esigw3(ji,jj,jk)+hbatt(ji,jj+1)*z_esigw3(ji,jj+1,jk) ) / &
+                                    ( hbatt(ji,jj)+hbatt(ji,jj+1) )
+
+             e3t(ji,jj,jk)=(scosrf(ji,jj)+hbatt(ji,jj))*z_esigt3(ji,jj,jk)
+             e3u(ji,jj,jk)=(scosrf(ji,jj)+hbatu(ji,jj))*z_esigtu3(ji,jj,jk)
+             e3v(ji,jj,jk)=(scosrf(ji,jj)+hbatv(ji,jj))*z_esigtv3(ji,jj,jk)
+             e3f(ji,jj,jk)=(scosrf(ji,jj)+hbatf(ji,jj))*z_esigtf3(ji,jj,jk)
+             !
+             e3w(ji,jj,jk)=hbatt(ji,jj)*z_esigw3(ji,jj,jk)
+             e3uw(ji,jj,jk)=hbatu(ji,jj)*z_esigwu3(ji,jj,jk)
+             e3vw(ji,jj,jk)=hbatv(ji,jj)*z_esigwv3(ji,jj,jk)
+          END DO
+
+        ENDDO
+      ENDDO
+      !                                               ! =============
+
+      CALL wrk_dealloc( jpi, jpj, jpk, z_gsigw3, z_gsigt3, z_gsi3w3                                      )
+      CALL wrk_dealloc( jpi, jpj, jpk, z_esigt3, z_esigw3, z_esigtu3, z_esigtv3, z_esigtf3, z_esigwu3, z_esigwv3 )
+
+   END SUBROUTINE s_sf12
+
+   SUBROUTINE s_tanh()
+
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE s_tanh*** 
+      !!                     
+      !! ** Purpose :   stretch the s-coordinate system
+      !!
+      !! ** Method  :   s-coordinate stretch 
+      !!
+      !! Reference : Madec, Lott, Delecluse and Crepon, 1996. JPO, 26, 1393-1408.
+      !!----------------------------------------------------------------------
+
+      INTEGER  ::   ji, jj, jk           ! dummy loop argument
+      REAL(wp) ::   zcoeft, zcoefw   ! temporary scalars
+
+      REAL(wp), POINTER, DIMENSION(:) :: z_gsigw, z_gsigt, z_gsi3w
+      REAL(wp), POINTER, DIMENSION(:) :: z_esigt, z_esigw
+
+      CALL wrk_alloc( jpk, z_gsigw, z_gsigt, z_gsi3w                                      )
+      CALL wrk_alloc( jpk, z_esigt, z_esigw                                               )
+
+      z_gsigw  = 0._wp   ;   z_gsigt  = 0._wp   ;   z_gsi3w  = 0._wp
+      z_esigt  = 0._wp   ;   z_esigw  = 0._wp 
+
       DO jk = 1, jpk
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               IF( fse3w(ji,jj,jk) <= 0._wp .OR. fse3t(ji,jj,jk) <= 0._wp ) THEN
-                  WRITE(ctmp1,*) 'zgr_sco :   e3w   or e3t   =< 0  at point (i,j,k)= ', ji, jj, jk
-                  CALL ctl_stop( ctmp1 )
-               ENDIF
-               IF( fsdepw(ji,jj,jk) < 0._wp .OR. fsdept(ji,jj,jk) < 0._wp ) THEN
-                  WRITE(ctmp1,*) 'zgr_sco :   gdepw or gdept =< 0  at point (i,j,k)= ', ji, jj, jk
-                  CALL ctl_stop( ctmp1 )
-               ENDIF
-            END DO
-         END DO
-      END DO
-!!gm bug    #endif
-      !
-      CALL wrk_dealloc( jpi, jpj,      zenv, ztmp, zmsk, zri, zrj, zhbat                           )
-      CALL wrk_dealloc( jpi, jpj, jpk, gsigw3, gsigt3, gsi3w3                                      )
-      CALL wrk_dealloc( jpi, jpj, jpk, esigt3, esigw3, esigtu3, esigtv3, esigtf3, esigwu3, esigwv3 )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('zgr_sco')
-      !
-   END SUBROUTINE zgr_sco
+        z_gsigw(jk) = -fssig( REAL(jk,wp)-0.5_wp )
+        z_gsigt(jk) = -fssig( REAL(jk,wp)        )
+      END DO
+      IF( nprint == 1 .AND. lwp )   WRITE(numout,*) 'z_gsigw 1 jpk    ', z_gsigw(1), z_gsigw(jpk)
+      !
+      ! Coefficients for vertical scale factors at w-, t- levels
+!!gm bug :  define it from analytical function, not like juste bellow....
+!!gm        or betteroffer the 2 possibilities....
+      DO jk = 1, jpkm1
+         z_esigt(jk  ) = z_gsigw(jk+1) - z_gsigw(jk)
+         z_esigw(jk+1) = z_gsigt(jk+1) - z_gsigt(jk)
+      END DO
+      z_esigw( 1 ) = 2._wp * ( z_gsigt(1  ) - z_gsigw(1  ) ) 
+      z_esigt(jpk) = 2._wp * ( z_gsigt(jpk) - z_gsigw(jpk) )
+      !
+      ! Coefficients for vertical depth as the sum of e3w scale factors
+      z_gsi3w(1) = 0.5_wp * z_esigw(1)
+      DO jk = 2, jpk
+         z_gsi3w(jk) = z_gsi3w(jk-1) + z_esigw(jk)
+      END DO
+!!gm: depuw, depvw can be suppressed (modif in ldfslp) and depw=dep3w can be set (save 3 3D arrays)
+      DO jk = 1, jpk
+         zcoeft = ( REAL(jk,wp) - 0.5_wp ) / REAL(jpkm1,wp)
+         zcoefw = ( REAL(jk,wp) - 1.0_wp ) / REAL(jpkm1,wp)
+         gdept (:,:,jk) = ( scosrf(:,:) + (hbatt(:,:)-hift(:,:))*z_gsigt(jk) + hift(:,:)*zcoeft )
+         gdepw (:,:,jk) = ( scosrf(:,:) + (hbatt(:,:)-hift(:,:))*z_gsigw(jk) + hift(:,:)*zcoefw )
+         gdep3w(:,:,jk) = ( scosrf(:,:) + (hbatt(:,:)-hift(:,:))*z_gsi3w(jk) + hift(:,:)*zcoeft )
+      END DO
+!!gm: e3uw, e3vw can be suppressed  (modif in dynzdf, dynzdf_iso, zdfbfr) (save 2 3D arrays)
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            DO jk = 1, jpk
+              e3t(ji,jj,jk) = ( (hbatt(ji,jj)-hift(ji,jj))*z_esigt(jk) + hift(ji,jj)/REAL(jpkm1,wp) )
+              e3u(ji,jj,jk) = ( (hbatu(ji,jj)-hifu(ji,jj))*z_esigt(jk) + hifu(ji,jj)/REAL(jpkm1,wp) )
+              e3v(ji,jj,jk) = ( (hbatv(ji,jj)-hifv(ji,jj))*z_esigt(jk) + hifv(ji,jj)/REAL(jpkm1,wp) )
+              e3f(ji,jj,jk) = ( (hbatf(ji,jj)-hiff(ji,jj))*z_esigt(jk) + hiff(ji,jj)/REAL(jpkm1,wp) )
+              !
+              e3w (ji,jj,jk) = ( (hbatt(ji,jj)-hift(ji,jj))*z_esigw(jk) + hift(ji,jj)/REAL(jpkm1,wp) )
+              e3uw(ji,jj,jk) = ( (hbatu(ji,jj)-hifu(ji,jj))*z_esigw(jk) + hifu(ji,jj)/REAL(jpkm1,wp) )
+              e3vw(ji,jj,jk) = ( (hbatv(ji,jj)-hifv(ji,jj))*z_esigw(jk) + hifv(ji,jj)/REAL(jpkm1,wp) )
+            END DO
+         END DO
+      END DO
+
+      CALL wrk_dealloc( jpk, z_gsigw, z_gsigt, z_gsi3w                                      )
+      CALL wrk_dealloc( jpk, z_esigt, z_esigw                                               )
+
+   END SUBROUTINE s_tanh
+
+   FUNCTION fssig( pk ) RESULT( pf )
+      !!----------------------------------------------------------------------
+      !!                 ***  ROUTINE fssig ***
+      !!       
+      !! ** Purpose :   provide the analytical function in s-coordinate
+      !!          
+      !! ** Method  :   the function provide the non-dimensional position of
+      !!                T and W (i.e. between 0 and 1)
+      !!                T-points at integer values (between 1 and jpk)
+      !!                W-points at integer values - 1/2 (between 0.5 and jpk-0.5)
+      !!----------------------------------------------------------------------
+      REAL(wp), INTENT(in) ::   pk   ! continuous "k" coordinate
+      REAL(wp)             ::   pf   ! sigma value
+      !!----------------------------------------------------------------------
+      !
+      pf =   (   TANH( rn_theta * ( -(pk-0.5_wp) / REAL(jpkm1) + rn_thetb )  )   &
+         &     - TANH( rn_thetb * rn_theta                                )  )   &
+         & * (   COSH( rn_theta                           )                      &
+         &     + COSH( rn_theta * ( 2._wp * rn_thetb - 1._wp ) )  )              &
+         & / ( 2._wp * SINH( rn_theta ) )
+      !
+   END FUNCTION fssig
+
+
+   FUNCTION fssig1( pk1, pbb ) RESULT( pf1 )
+      !!----------------------------------------------------------------------
+      !!                 ***  ROUTINE fssig1 ***
+      !!
+      !! ** Purpose :   provide the Song and Haidvogel version of the analytical function in s-coordinate
+      !!
+      !! ** Method  :   the function provides the non-dimensional position of
+      !!                T and W (i.e. between 0 and 1)
+      !!                T-points at integer values (between 1 and jpk)
+      !!                W-points at integer values - 1/2 (between 0.5 and jpk-0.5)
+      !!----------------------------------------------------------------------
+      REAL(wp), INTENT(in) ::   pk1   ! continuous "k" coordinate
+      REAL(wp), INTENT(in) ::   pbb   ! Stretching coefficient
+      REAL(wp)             ::   pf1   ! sigma value
+      !!----------------------------------------------------------------------
+      !
+      IF ( rn_theta == 0 ) then      ! uniform sigma
+         pf1 = - ( pk1 - 0.5_wp ) / REAL( jpkm1 )
+      ELSE                        ! stretched sigma
+         pf1 =   ( 1._wp - pbb ) * ( SINH( rn_theta*(-(pk1-0.5_wp)/REAL(jpkm1)) ) ) / SINH( rn_theta )              &
+            &  + pbb * (  (TANH( rn_theta*( (-(pk1-0.5_wp)/REAL(jpkm1)) + 0.5_wp) ) - TANH( 0.5_wp * rn_theta )  )  &
+            &        / ( 2._wp * TANH( 0.5_wp * rn_theta ) )  )
+      ENDIF
+      !
+   END FUNCTION fssig1
+
+
+   FUNCTION fgamma( pk1, pzb, pzs, psmth) RESULT( p_gamma )
+      !!----------------------------------------------------------------------
+      !!                 ***  ROUTINE fgamma  ***
+      !!
+      !! ** Purpose :   provide analytical function for the s-coordinate
+      !!
+      !! ** Method  :   the function provides the non-dimensional position of
+      !!                T and W (i.e. between 0 and 1)
+      !!                T-points at integer values (between 1 and jpk)
+      !!                W-points at integer values - 1/2 (between 0.5 and jpk-0.5)
+      !!
+      !!                This method allows the maintenance of fixed surface and or
+      !!                bottom cell resolutions (cf. geopotential coordinates) 
+      !!                within an analytically derived stretched S-coordinate framework.
+      !!
+      !! Reference  :   Siddorn and Furner, in prep
+      !!----------------------------------------------------------------------
+      REAL(wp), INTENT(in   ) ::   pk1(jpk)       ! continuous "k" coordinate
+      REAL(wp)                ::   p_gamma(jpk)   ! stretched coordinate
+      REAL(wp), INTENT(in   ) ::   pzb           ! Bottom box depth
+      REAL(wp), INTENT(in   ) ::   pzs           ! surface box depth
+      REAL(wp), INTENT(in   ) ::   psmth       ! Smoothing parameter
+      REAL(wp)                ::   za1,za2,za3    ! local variables
+      REAL(wp)                ::   zn1,zn2        ! local variables
+      REAL(wp)                ::   za,zb,zx       ! local variables
+      integer                 ::   jk
+      !!----------------------------------------------------------------------
+      !
+
+      zn1  =  1./(jpk-1.)
+      zn2  =  1. -  zn1
+
+      za1 = (rn_alpha+2.0_wp)*zn1**(rn_alpha+1.0_wp)-(rn_alpha+1.0_wp)*zn1**(rn_alpha+2.0_wp) 
+      za2 = (rn_alpha+2.0_wp)*zn2**(rn_alpha+1.0_wp)-(rn_alpha+1.0_wp)*zn2**(rn_alpha+2.0_wp)
+      za3 = (zn2**3.0_wp - za2)/( zn1**3.0_wp - za1)
+     
+      za = pzb - za3*(pzs-za1)-za2
+      za = za/( zn2-0.5_wp*(za2+zn2**2.0_wp) - za3*(zn1-0.5_wp*(za1+zn1**2.0_wp) ) )
+      zb = (pzs - za1 - za*( zn1-0.5_wp*(za1+zn1**2.0_wp ) ) ) / (zn1**3.0_wp - za1)
+      zx = 1.0_wp-za/2.0_wp-zb
+ 
+      DO jk = 1, jpk
+        p_gamma(jk) = za*(pk1(jk)*(1.0_wp-pk1(jk)/2.0_wp))+zb*pk1(jk)**3.0_wp + zx*( (rn_alpha+2.0_wp)*pk1(jk)**(rn_alpha+1.0_wp)-(rn_alpha+1.0_wp)*pk1(jk)**(rn_alpha+2.0_wp) )
+        p_gamma(jk) = p_gamma(jk)*psmth+pk1(jk)*(1.0_wp-psmth)
+      ENDDO 
+
+      !
+   END FUNCTION fgamma
 
    !!======================================================================
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/istate.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/istate.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/istate.F90	(revision 3680)
@@ -32,5 +32,4 @@
    USE phycst          ! physical constants
    USE dtatsd          ! data temperature and salinity   (dta_tsd routine)
-   USE restart         ! ocean restart                   (rst_read routine)
    USE in_out_manager  ! I/O manager
    USE iom             ! I/O library
@@ -43,4 +42,5 @@
    USE dynspg_ts       ! pressure gradient schemes
    USE lib_mpp         ! MPP library
+   USE restart         ! restart
    USE wrk_nemo        ! Memory allocation
    USE timing          ! Timing
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_exp.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_exp.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_exp.F90	(revision 3680)
@@ -27,5 +27,4 @@
    USE prtctl          ! Print control
    USE iom             ! I/O library
-   USE restart         ! only for lrst_oce
    USE timing          ! Timing
 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_flt.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_flt.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_flt.F90	(revision 3680)
@@ -45,5 +45,4 @@
    USE prtctl          ! Print control
    USE iom
-   USE restart         ! only for lrst_oce
    USE lib_fortran
 #if defined key_agrif
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90	(revision 3680)
@@ -41,5 +41,4 @@
    USE in_out_manager  ! I/O manager
    USE iom             ! IOM library
-   USE restart         ! only for lrst_oce
    USE zdf_oce         ! Vertical diffusion
    USE wrk_nemo        ! Memory Allocation
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DYN/sshwzv.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DYN/sshwzv.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/DYN/sshwzv.F90	(revision 3680)
@@ -20,5 +20,4 @@
    USE divcur          ! hor. divergence and curl      (div & cur routines)
    USE iom             ! I/O library
-   USE restart         ! only for lrst_oce
    USE in_out_manager  ! I/O manager
    USE prtctl          ! Print control
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/IOM/in_out_manager.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/IOM/in_out_manager.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/IOM/in_out_manager.F90	(revision 3680)
@@ -80,5 +80,7 @@
    !! was in restart but moved here because of the OFF line... better solution should be found...
    !!----------------------------------------------------------------------
-   INTEGER ::   nitrst   !: time step at which restart file should be written
+   INTEGER ::   nitrst                !: time step at which restart file should be written
+   LOGICAL ::   lrst_oce              !: logical to control the oce restart write 
+   INTEGER ::   numror, numrow        !: logical unit for cean restart (read and write)
 
    !!----------------------------------------------------------------------
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/IOM/iom_def.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/IOM/iom_def.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/IOM/iom_def.F90	(revision 3680)
@@ -43,5 +43,5 @@
    INTEGER, PARAMETER, PUBLIC ::   jp_i1    = 204      !: write INTEGER(1)
 
-   INTEGER, PARAMETER, PUBLIC ::   jpmax_files  = 50   !: maximum number of simultaneously opened file
+   INTEGER, PARAMETER, PUBLIC ::   jpmax_files  = 100   !: maximum number of simultaneously opened file
    INTEGER, PARAMETER, PUBLIC ::   jpmax_vars   = 360  !: maximum number of variables in one file
    INTEGER, PARAMETER, PUBLIC ::   jpmax_dims   =  4   !: maximum number of dimensions for one variable
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/IOM/prtctl.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/IOM/prtctl.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/IOM/prtctl.F90	(revision 3680)
@@ -33,4 +33,5 @@
    PUBLIC prt_ctl_info    ! called by all subroutines
    PUBLIC prt_ctl_init    ! called by opa.F90
+   PUBLIC sub_dom         ! called by opa.F90
 
    !!----------------------------------------------------------------------
@@ -422,8 +423,11 @@
          nrecil, nrecjl, nldil, nleil, nldjl, nlejl
 
-      INTEGER, DIMENSION(:,:), ALLOCATABLE ::   iimpptl, ijmpptl, ilcitl, ilcjtl   ! workspace
+      INTEGER, POINTER, DIMENSION(:,:) ::   iimpptl, ijmpptl, ilcitl, ilcjtl   ! workspace
       REAL(wp) ::   zidom, zjdom            ! temporary scalars
       !!----------------------------------------------------------------------
 
+      !
+      CALL wrk_alloc( isplt, jsplt, ilcitl, ilcjtl, iimpptl, ijmpptl )
+      !
       !  1. Dimension arrays for subdomains
       ! -----------------------------------
@@ -442,6 +446,4 @@
 #endif
 
-      ALLOCATE(ilcitl (isplt,jsplt))
-      ALLOCATE(ilcjtl (isplt,jsplt))
 
       nrecil  = 2 * jpreci
@@ -516,7 +518,4 @@
       ! -------------------------------
 
-      ALLOCATE(iimpptl(isplt,jsplt))
-      ALLOCATE(ijmpptl(isplt,jsplt))
-      
       iimpptl(:,:) = 1
       ijmpptl(:,:) = 1
@@ -576,5 +575,7 @@
       END DO
       !
-      DEALLOCATE( iimpptl, ijmpptl, ilcitl, ilcjtl )
+      !
+      CALL wrk_dealloc( isplt, jsplt, ilcitl, ilcjtl, iimpptl, ijmpptl )
+      !
       !
    END SUBROUTINE sub_dom
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90	(revision 3680)
@@ -24,4 +24,5 @@
    USE trdmld_oce      ! ocean active mixed layer tracers trends variables
    USE domvvl          ! variable volume
+   USE divcur          ! hor. divergence and curl      (div & cur routines)
 
    IMPLICIT NONE
@@ -31,7 +32,4 @@
    PUBLIC   rst_write  ! routine called by step module
    PUBLIC   rst_read   ! routine called by opa  module
-
-   LOGICAL, PUBLIC ::   lrst_oce =  .FALSE.   !: logical to control the oce restart write 
-   INTEGER, PUBLIC ::   numror, numrow        !: logical unit for cean restart (read and write)
 
    !! * Substitutions
@@ -183,26 +181,38 @@
       ENDIF
       ! 
-                     CALL iom_get( numror, jpdom_autoglo, 'ub'     , ub      )   ! before fields
-                     CALL iom_get( numror, jpdom_autoglo, 'vb'     , vb      )
-                     CALL iom_get( numror, jpdom_autoglo, 'tb'     , tsb(:,:,:,jp_tem) )
-                     CALL iom_get( numror, jpdom_autoglo, 'sb'     , tsb(:,:,:,jp_sal) )
-                     CALL iom_get( numror, jpdom_autoglo, 'rotb'   , rotb    )
-                     CALL iom_get( numror, jpdom_autoglo, 'hdivb'  , hdivb   )
-                     CALL iom_get( numror, jpdom_autoglo, 'sshb'   , sshb    )
-      IF( lk_vvl )   CALL iom_get( numror, jpdom_autoglo, 'fse3t_b', fse3t_b(:,:,:) )
-                     !
-                     CALL iom_get( numror, jpdom_autoglo, 'un'     , un      )   ! now    fields
-                     CALL iom_get( numror, jpdom_autoglo, 'vn'     , vn      )
-                     CALL iom_get( numror, jpdom_autoglo, 'tn'     , tsn(:,:,:,jp_tem) )
-                     CALL iom_get( numror, jpdom_autoglo, 'sn'     , tsn(:,:,:,jp_sal) )
-                     CALL iom_get( numror, jpdom_autoglo, 'rotn'   , rotn    )
-                     CALL iom_get( numror, jpdom_autoglo, 'hdivn'  , hdivn   )
-                     CALL iom_get( numror, jpdom_autoglo, 'sshn'   , sshn    )
-                     CALL iom_get( numror, jpdom_autoglo, 'rhop'   , rhop    )   ! now    potential density
+      IF( iom_varid( numror, 'ub', ldstop = .FALSE. ) > 0 ) THEN
+         CALL iom_get( numror, jpdom_autoglo, 'ub'     , ub      )   ! before fields
+         CALL iom_get( numror, jpdom_autoglo, 'vb'     , vb      )
+         CALL iom_get( numror, jpdom_autoglo, 'tb'     , tsb(:,:,:,jp_tem) )
+         CALL iom_get( numror, jpdom_autoglo, 'sb'     , tsb(:,:,:,jp_sal) )
+         CALL iom_get( numror, jpdom_autoglo, 'rotb'   , rotb    )
+         CALL iom_get( numror, jpdom_autoglo, 'hdivb'  , hdivb   )
+         CALL iom_get( numror, jpdom_autoglo, 'sshb'   , sshb    )
+         IF( lk_vvl )   CALL iom_get( numror, jpdom_autoglo, 'fse3t_b', fse3t_b(:,:,:) )
+      ELSE
+         neuler = 0
+      ENDIF
+      !
+      CALL iom_get( numror, jpdom_autoglo, 'un'     , un      )   ! now    fields
+      CALL iom_get( numror, jpdom_autoglo, 'vn'     , vn      )
+      CALL iom_get( numror, jpdom_autoglo, 'tn'     , tsn(:,:,:,jp_tem) )
+      CALL iom_get( numror, jpdom_autoglo, 'sn'     , tsn(:,:,:,jp_sal) )
+      CALL iom_get( numror, jpdom_autoglo, 'sshn'   , sshn    )
+      IF( iom_varid( numror, 'rotn', ldstop = .FALSE. ) > 0 ) THEN
+         CALL iom_get( numror, jpdom_autoglo, 'rotn'   , rotn    )
+         CALL iom_get( numror, jpdom_autoglo, 'hdivn'  , hdivn   )
+      ELSE
+         CALL div_cur( 0 )                              ! Horizontal divergence & Relative vorticity
+      ENDIF
+      IF( iom_varid( numror, 'rhop', ldstop = .FALSE. ) > 0 ) THEN
+         CALL iom_get( numror, jpdom_autoglo, 'rhop'   , rhop    )   ! now    potential density
+      ELSE
+         CALL eos    ( tsn, rhd, rhop )   
+      ENDIF
 #if defined key_zdfkpp
       IF( iom_varid( numror, 'rhd', ldstop = .FALSE. ) > 0 ) THEN
-                     CALL iom_get( numror, jpdom_autoglo, 'rhd'    , rhd     )   ! now    in situ density anomaly
-      ELSE
-                     CALL eos( tsn, rhd )   ! compute rhd
+         CALL iom_get( numror, jpdom_autoglo, 'rhd'    , rhd     )   ! now    in situ density anomaly
+      ELSE
+         CALL eos( tsn, rhd )   ! compute rhd
       ENDIF
 #endif
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/LBC/lbclnk.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/LBC/lbclnk.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/LBC/lbclnk.F90	(revision 3680)
@@ -7,4 +7,7 @@
    !!   NEMO     1.0  ! 2002-09  (G. Madec)     F90: Free form and module
    !!            3.2  ! 2009-03  (R. Benshila)  External north fold treatment  
+   !!            3.5  ! 2012     (S.Mocavero, I. Epicoco) Add 'lbc_bdy_lnk' 
+   !!                            and lbc_obc_lnk' routine to optimize  
+   !!                            the BDY/OBC communications
    !!----------------------------------------------------------------------
 #if   defined key_mpp_mpi
@@ -14,4 +17,6 @@
    !!   lbc_lnk      : generic interface for mpp_lnk_3d and mpp_lnk_2d routines defined in lib_mpp
    !!   lbc_lnk_e    : generic interface for mpp_lnk_2d_e routine defined in lib_mpp
+   !!   lbc_bdy_lnk  : generic interface for mpp_lnk_bdy_2d and mpp_lnk_bdy_3d routines defined in lib_mpp
+   !!   lbc_obc_lnk  : generic interface for mpp_lnk_obc_2d and mpp_lnk_obc_3d routines defined in lib_mpp
    !!----------------------------------------------------------------------
    USE lib_mpp          ! distributed memory computing library
@@ -21,4 +26,11 @@
    END INTERFACE
 
+   INTERFACE lbc_bdy_lnk
+      MODULE PROCEDURE mpp_lnk_bdy_2d, mpp_lnk_bdy_3d
+   END INTERFACE
+   INTERFACE lbc_obc_lnk
+      MODULE PROCEDURE mpp_lnk_obc_2d, mpp_lnk_obc_3d
+   END INTERFACE
+
    INTERFACE lbc_lnk_e
       MODULE PROCEDURE mpp_lnk_2d_e
@@ -27,4 +39,6 @@
    PUBLIC lbc_lnk       ! ocean lateral boundary conditions
    PUBLIC lbc_lnk_e
+   PUBLIC lbc_bdy_lnk   ! ocean lateral BDY boundary conditions
+   PUBLIC lbc_obc_lnk   ! ocean lateral BDY boundary conditions
 
    !!----------------------------------------------------------------------
@@ -41,4 +55,6 @@
    !!   lbc_lnk_3d   : set the lateral boundary condition on a 3D variable on ocean mesh
    !!   lbc_lnk_2d   : set the lateral boundary condition on a 2D variable on ocean mesh
+   !!   lbc_bdy_lnk  : set the lateral BDY boundary condition
+   !!   lbc_obc_lnk  : set the lateral OBC boundary condition
    !!----------------------------------------------------------------------
    USE oce             ! ocean dynamics and tracers   
@@ -58,6 +74,15 @@
    END INTERFACE
 
+   INTERFACE lbc_bdy_lnk
+      MODULE PROCEDURE lbc_bdy_lnk_2d, lbc_bdy_lnk_3d
+   END INTERFACE
+   INTERFACE lbc_obc_lnk
+      MODULE PROCEDURE lbc_lnk_2d, lbc_lnk_3d
+   END INTERFACE
+
    PUBLIC   lbc_lnk       ! ocean/ice  lateral boundary conditions
    PUBLIC   lbc_lnk_e 
+   PUBLIC   lbc_bdy_lnk   ! ocean lateral BDY boundary conditions
+   PUBLIC   lbc_obc_lnk   ! ocean lateral OBC boundary conditions
    
    !!----------------------------------------------------------------------
@@ -180,4 +205,37 @@
    END SUBROUTINE lbc_lnk_3d
 
+   SUBROUTINE lbc_bdy_lnk_3d( pt3d, cd_type, psgn, ib_bdy )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE lbc_bdy_lnk  ***
+      !!
+      !! ** Purpose :   wrapper rountine to 'lbc_lnk_3d'. This wrapper is used
+      !!                to maintain the same interface with regards to the mpp case
+      !!
+      !!----------------------------------------------------------------------
+      CHARACTER(len=1)                , INTENT(in   )           ::   cd_type   ! nature of pt3d grid-points
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout)           ::   pt3d      ! 3D array on which the lbc is applied
+      REAL(wp)                        , INTENT(in   )           ::   psgn      ! control of the sign 
+      INTEGER                                                   ::   ib_bdy    ! BDY boundary set
+      !!
+      CALL lbc_lnk_3d( pt3d, cd_type, psgn)
+
+   END SUBROUTINE lbc_bdy_lnk_3d
+
+   SUBROUTINE lbc_bdy_lnk_2d( pt2d, cd_type, psgn, ib_bdy )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE lbc_bdy_lnk  ***
+      !!
+      !! ** Purpose :   wrapper rountine to 'lbc_lnk_3d'. This wrapper is used
+      !!                to maintain the same interface with regards to the mpp case
+      !!
+      !!----------------------------------------------------------------------
+      CHARACTER(len=1)                , INTENT(in   )           ::   cd_type   ! nature of pt3d grid-points
+      REAL(wp), DIMENSION(jpi,jpj),     INTENT(inout)           ::   pt2d      ! 3D array on which the lbc is applied
+      REAL(wp)                        , INTENT(in   )           ::   psgn      ! control of the sign 
+      INTEGER                                                   ::   ib_bdy    ! BDY boundary set
+      !!
+      CALL lbc_lnk_2d( pt2d, cd_type, psgn)
+
+   END SUBROUTINE lbc_bdy_lnk_2d
 
    SUBROUTINE lbc_lnk_2d( pt2d, cd_type, psgn, cd_mpp, pval )
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 3680)
@@ -19,4 +19,7 @@
    !!            3.2  !  2009  (O. Marti)    add mpp_ini_znl 
    !!            4.0  !  2011  (G. Madec)  move ctl_ routines from in_out_manager
+   !!            3.5  !  2012  (S.Mocavero, I. Epicoco) Add 'mpp_lnk_bdy_3d', 'mpp_lnk_obc_3d', 
+   !!                          'mpp_lnk_bdy_2d' and 'mpp_lnk_obc_2d' routines and update
+   !!                          the mppobc routine to optimize the BDY and OBC communications
    !!----------------------------------------------------------------------
 
@@ -69,4 +72,6 @@
    PUBLIC   mppsend, mpprecv                          ! needed by ICB routines
    PUBLIC   lib_mpp_alloc   ! Called in nemogcm.F90
+   PUBLIC   mpp_lnk_bdy_2d, mpp_lnk_bdy_3d
+   PUBLIC   mpp_lnk_obc_2d, mpp_lnk_obc_3d
 
    !! * Interfaces
@@ -348,12 +353,11 @@
    END FUNCTION mynode
 
-
-   SUBROUTINE mpp_lnk_3d( ptab, cd_type, psgn, cd_mpp, pval )
-      !!----------------------------------------------------------------------
-      !!                  ***  routine mpp_lnk_3d  ***
+   SUBROUTINE mpp_lnk_obc_3d( ptab, cd_type, psgn )
+      !!----------------------------------------------------------------------
+      !!                  ***  routine mpp_lnk_obc_3d  ***
       !!
       !! ** Purpose :   Message passing manadgement
       !!
-      !! ** Method  :   Use mppsend and mpprecv function for passing mask 
+      !! ** Method  :   Use mppsend and mpprecv function for passing OBC boundaries 
       !!      between processors following neighboring subdomains.
       !!            domain parameters
@@ -375,6 +379,4 @@
       REAL(wp)                        , INTENT(in   ) ::   psgn     ! =-1 the sign change across the north fold boundary
       !                                                             ! =  1. , the sign is kept
-      CHARACTER(len=3), OPTIONAL      , INTENT(in   ) ::   cd_mpp   ! fill the overlap area only 
-      REAL(wp)        , OPTIONAL      , INTENT(in   ) ::   pval     ! background value (used at closed boundaries)
       !!
       INTEGER  ::   ji, jj, jk, jl             ! dummy loop indices
@@ -385,41 +387,26 @@
       !!----------------------------------------------------------------------
 
-      IF( PRESENT( pval ) ) THEN   ;   zland = pval      ! set land value
-      ELSE                         ;   zland = 0.e0      ! zero by default
-      ENDIF
+      zland = 0.e0      ! zero by default
 
       ! 1. standard boundary treatment
       ! ------------------------------
-      IF( PRESENT( cd_mpp ) ) THEN      ! only fill added line/raw with existing values
-         !
-         ! WARNING ptab is defined only between nld and nle
-         DO jk = 1, jpk
-            DO jj = nlcj+1, jpj                 ! added line(s)   (inner only)
-               ptab(nldi  :nlei  , jj          ,jk) = ptab(nldi:nlei,     nlej,jk)   
-               ptab(1     :nldi-1, jj          ,jk) = ptab(nldi     ,     nlej,jk)
-               ptab(nlei+1:nlci  , jj          ,jk) = ptab(     nlei,     nlej,jk)
-            END DO
-            DO ji = nlci+1, jpi                 ! added column(s) (full)
-               ptab(ji           ,nldj  :nlej  ,jk) = ptab(     nlei,nldj:nlej,jk)
-               ptab(ji           ,1     :nldj-1,jk) = ptab(     nlei,nldj     ,jk)
-               ptab(ji           ,nlej+1:jpj   ,jk) = ptab(     nlei,     nlej,jk)
-            END DO
-         END DO
-         !
-      ELSE                              ! standard close or cyclic treatment 
-         !
-         !                                   ! East-West boundaries
-         !                                        !* Cyclic east-west
-         IF( nbondi == 2 .AND. (nperio == 1 .OR. nperio == 4 .OR. nperio == 6) ) THEN
-            ptab( 1 ,:,:) = ptab(jpim1,:,:)
-            ptab(jpi,:,:) = ptab(  2  ,:,:)
-         ELSE                                     !* closed
-            IF( .NOT. cd_type == 'F' )   ptab(     1       :jpreci,:,:) = zland    ! south except F-point
-                                         ptab(nlci-jpreci+1:jpi   ,:,:) = zland    ! north
-         ENDIF
-         !                                   ! North-South boundaries (always closed)
-         IF( .NOT. cd_type == 'F' )   ptab(:,     1       :jprecj,:) = zland       ! south except F-point
-                                      ptab(:,nlcj-jprecj+1:jpj   ,:) = zland       ! north
-         !
+      IF( nbondi == 2) THEN
+        IF (nperio == 1 .OR. nperio == 4 .OR. nperio == 6) THEN
+          ptab( 1 ,:,:) = ptab(jpim1,:,:)
+          ptab(jpi,:,:) = ptab(  2  ,:,:)
+        ELSE
+          IF( .NOT. cd_type == 'F' )   ptab(     1       :jpreci,:,:) = zland    ! south except F-point
+          ptab(nlci-jpreci+1:jpi   ,:,:) = zland    ! north
+        ENDIF
+      ELSEIF(nbondi == -1) THEN
+        IF( .NOT. cd_type == 'F' )   ptab(     1       :jpreci,:,:) = zland    ! south except F-point
+      ELSEIF(nbondi == 1) THEN
+        ptab(nlci-jpreci+1:jpi   ,:,:) = zland    ! north
+      ENDIF                                     !* closed
+
+      IF (nbondj == 2 .OR. nbondj == -1) THEN
+        IF( .NOT. cd_type == 'F' )   ptab(:,     1       :jprecj,:) = zland       ! south except F-point
+      ELSEIF (nbondj == 2 .OR. nbondj == 1) THEN
+        ptab(:,nlcj-jprecj+1:jpj   ,:) = zland       ! north
       ENDIF
 
@@ -428,4 +415,5 @@
       ! we play with the neigbours AND the row number because of the periodicity 
       !
+      IF(nbondj .ne. 0) THEN
       SELECT CASE ( nbondi )      ! Read Dirichlet lateral conditions
       CASE ( -1, 0, 1 )                ! all exept 2 (i.e. close case)
@@ -466,5 +454,5 @@
             ptab(iihom+jl,:,:) = t3ew(:,jl,:,2)
          END DO
-      CASE ( 0 ) 
+      CASE ( 0 )
          DO jl = 1, jpreci
             ptab(jl      ,:,:) = t3we(:,jl,:,2)
@@ -476,4 +464,5 @@
          END DO
       END SELECT
+      ENDIF
 
 
@@ -482,4 +471,5 @@
       ! always closed : we play only with the neigbours
       !
+      IF(nbondi .ne. 0) THEN
       IF( nbondj /= 2 ) THEN      ! Read Dirichlet lateral conditions
          ijhom = nlcj-nrecj
@@ -519,5 +509,5 @@
             ptab(:,ijhom+jl,:) = t3ns(:,jl,:,2)
          END DO
-      CASE ( 0 ) 
+      CASE ( 0 )
          DO jl = 1, jprecj
             ptab(:,jl      ,:) = t3sn(:,jl,:,2)
@@ -529,4 +519,5 @@
          END DO
       END SELECT
+      ENDIF
 
 
@@ -534,5 +525,5 @@
       ! -----------------------
       !
-      IF( npolj /= 0 .AND. .NOT. PRESENT(cd_mpp) ) THEN
+      IF( npolj /= 0 ) THEN
          !
          SELECT CASE ( jpni )
@@ -543,14 +534,14 @@
       ENDIF
       !
-   END SUBROUTINE mpp_lnk_3d
-
-
-   SUBROUTINE mpp_lnk_2d( pt2d, cd_type, psgn, cd_mpp, pval )
-      !!----------------------------------------------------------------------
-      !!                  ***  routine mpp_lnk_2d  ***
+   END SUBROUTINE mpp_lnk_obc_3d
+
+
+   SUBROUTINE mpp_lnk_obc_2d( pt2d, cd_type, psgn )
+      !!----------------------------------------------------------------------
+      !!                  ***  routine mpp_lnk_obc_2d  ***
       !!                  
       !! ** Purpose :   Message passing manadgement for 2d array
       !!
-      !! ** Method  :   Use mppsend and mpprecv function for passing mask 
+      !! ** Method  :   Use mppsend and mpprecv function for passing OBC boundaries 
       !!      between processors following neighboring subdomains.
       !!            domain parameters
@@ -570,6 +561,4 @@
       REAL(wp)                    , INTENT(in   ) ::   psgn     ! =-1 the sign change across the north fold boundary
       !                                                         ! =  1. , the sign is kept
-      CHARACTER(len=3), OPTIONAL  , INTENT(in   ) ::   cd_mpp   ! fill the overlap area only 
-      REAL(wp)        , OPTIONAL  , INTENT(in   ) ::   pval     ! background value (used at closed boundaries)
       !!
       INTEGER  ::   ji, jj, jl   ! dummy loop indices
@@ -580,40 +569,27 @@
       !!----------------------------------------------------------------------
 
-      IF( PRESENT( pval ) ) THEN   ;   zland = pval      ! set land value
-      ELSE                         ;   zland = 0.e0      ! zero by default
-      ENDIF
+      zland = 0.e0      ! zero by default
 
       ! 1. standard boundary treatment
       ! ------------------------------
       !
-      IF( PRESENT( cd_mpp ) ) THEN      ! only fill added line/raw with existing values
-         !
-         ! WARNING pt2d is defined only between nld and nle
-         DO jj = nlcj+1, jpj                 ! added line(s)   (inner only)
-            pt2d(nldi  :nlei  , jj          ) = pt2d(nldi:nlei,     nlej)   
-            pt2d(1     :nldi-1, jj          ) = pt2d(nldi     ,     nlej)
-            pt2d(nlei+1:nlci  , jj          ) = pt2d(     nlei,     nlej)
-         END DO
-         DO ji = nlci+1, jpi                 ! added column(s) (full)
-            pt2d(ji           ,nldj  :nlej  ) = pt2d(     nlei,nldj:nlej)
-            pt2d(ji           ,1     :nldj-1) = pt2d(     nlei,nldj     )
-            pt2d(ji           ,nlej+1:jpj   ) = pt2d(     nlei,     nlej)
-         END DO
-         !
-      ELSE                              ! standard close or cyclic treatment 
-         !
-         !                                   ! East-West boundaries
-         IF( nbondi == 2 .AND.   &                ! Cyclic east-west
-            &    (nperio == 1 .OR. nperio == 4 .OR. nperio == 6) ) THEN
-            pt2d( 1 ,:) = pt2d(jpim1,:)                                    ! west
-            pt2d(jpi,:) = pt2d(  2  ,:)                                    ! east
-         ELSE                                     ! closed
-            IF( .NOT. cd_type == 'F' )   pt2d(     1       :jpreci,:) = zland    ! south except F-point
-                                         pt2d(nlci-jpreci+1:jpi   ,:) = zland    ! north
-         ENDIF
-         !                                   ! North-South boundaries (always closed)
-            IF( .NOT. cd_type == 'F' )   pt2d(:,     1       :jprecj) = zland    !south except F-point
-                                         pt2d(:,nlcj-jprecj+1:jpj   ) = zland    ! north
-         !
+      IF( nbondi == 2) THEN
+        IF (nperio == 1 .OR. nperio == 4 .OR. nperio == 6) THEN
+          pt2d( 1 ,:) = pt2d(jpim1,:)
+          pt2d(jpi,:) = pt2d(  2  ,:)
+        ELSE
+          IF( .NOT. cd_type == 'F' )   pt2d(     1       :jpreci,:) = zland    ! south except F-point
+          pt2d(nlci-jpreci+1:jpi   ,:) = zland    ! north
+        ENDIF
+      ELSEIF(nbondi == -1) THEN
+        IF( .NOT. cd_type == 'F' )   pt2d(     1       :jpreci,:) = zland    ! south except F-point
+      ELSEIF(nbondi == 1) THEN
+        pt2d(nlci-jpreci+1:jpi   ,:) = zland    ! north
+      ENDIF                                     !* closed
+
+      IF (nbondj == 2 .OR. nbondj == -1) THEN
+        IF( .NOT. cd_type == 'F' )   pt2d(:,     1       :jprecj) = zland       ! south except F-point
+      ELSEIF (nbondj == 2 .OR. nbondj == 1) THEN
+        pt2d(:,nlcj-jprecj+1:jpj) = zland       ! north
       ENDIF
 
@@ -728,4 +704,394 @@
       ! -----------------------
       !
+      IF( npolj /= 0 ) THEN
+         !
+         SELECT CASE ( jpni )
+         CASE ( 1 )     ;   CALL lbc_nfd      ( pt2d, cd_type, psgn )   ! only 1 northern proc, no mpp
+         CASE DEFAULT   ;   CALL mpp_lbc_north( pt2d, cd_type, psgn )   ! for all northern procs.
+         END SELECT
+         !
+      ENDIF
+      !
+   END SUBROUTINE mpp_lnk_obc_2d
+
+   SUBROUTINE mpp_lnk_3d( ptab, cd_type, psgn, cd_mpp, pval )
+      !!----------------------------------------------------------------------
+      !!                  ***  routine mpp_lnk_3d  ***
+      !!
+      !! ** Purpose :   Message passing manadgement
+      !!
+      !! ** Method  :   Use mppsend and mpprecv function for passing mask 
+      !!      between processors following neighboring subdomains.
+      !!            domain parameters
+      !!                    nlci   : first dimension of the local subdomain
+      !!                    nlcj   : second dimension of the local subdomain
+      !!                    nbondi : mark for "east-west local boundary"
+      !!                    nbondj : mark for "north-south local boundary"
+      !!                    noea   : number for local neighboring processors 
+      !!                    nowe   : number for local neighboring processors
+      !!                    noso   : number for local neighboring processors
+      !!                    nono   : number for local neighboring processors
+      !!
+      !! ** Action  :   ptab with update value at its periphery
+      !!
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   ptab     ! 3D array on which the boundary condition is applied
+      CHARACTER(len=1)                , INTENT(in   ) ::   cd_type  ! define the nature of ptab array grid-points
+      !                                                             ! = T , U , V , F , W points
+      REAL(wp)                        , INTENT(in   ) ::   psgn     ! =-1 the sign change across the north fold boundary
+      !                                                             ! =  1. , the sign is kept
+      CHARACTER(len=3), OPTIONAL      , INTENT(in   ) ::   cd_mpp   ! fill the overlap area only 
+      REAL(wp)        , OPTIONAL      , INTENT(in   ) ::   pval     ! background value (used at closed boundaries)
+      !!
+      INTEGER  ::   ji, jj, jk, jl             ! dummy loop indices
+      INTEGER  ::   imigr, iihom, ijhom        ! temporary integers
+      INTEGER  ::   ml_req1, ml_req2, ml_err   ! for key_mpi_isend
+      REAL(wp) ::   zland
+      INTEGER, DIMENSION(MPI_STATUS_SIZE) ::   ml_stat   ! for key_mpi_isend
+      !!----------------------------------------------------------------------
+
+      IF( PRESENT( pval ) ) THEN   ;   zland = pval      ! set land value
+      ELSE                         ;   zland = 0.e0      ! zero by default
+      ENDIF
+
+      ! 1. standard boundary treatment
+      ! ------------------------------
+      IF( PRESENT( cd_mpp ) ) THEN      ! only fill added line/raw with existing values
+         !
+         ! WARNING ptab is defined only between nld and nle
+         DO jk = 1, jpk
+            DO jj = nlcj+1, jpj                 ! added line(s)   (inner only)
+               ptab(nldi  :nlei  , jj          ,jk) = ptab(nldi:nlei,     nlej,jk)   
+               ptab(1     :nldi-1, jj          ,jk) = ptab(nldi     ,     nlej,jk)
+               ptab(nlei+1:nlci  , jj          ,jk) = ptab(     nlei,     nlej,jk)
+            END DO
+            DO ji = nlci+1, jpi                 ! added column(s) (full)
+               ptab(ji           ,nldj  :nlej  ,jk) = ptab(     nlei,nldj:nlej,jk)
+               ptab(ji           ,1     :nldj-1,jk) = ptab(     nlei,nldj     ,jk)
+               ptab(ji           ,nlej+1:jpj   ,jk) = ptab(     nlei,     nlej,jk)
+            END DO
+         END DO
+         !
+      ELSE                              ! standard close or cyclic treatment 
+         !
+         !                                   ! East-West boundaries
+         !                                        !* Cyclic east-west
+         IF( nbondi == 2 .AND. (nperio == 1 .OR. nperio == 4 .OR. nperio == 6) ) THEN
+            ptab( 1 ,:,:) = ptab(jpim1,:,:)
+            ptab(jpi,:,:) = ptab(  2  ,:,:)
+         ELSE                                     !* closed
+            IF( .NOT. cd_type == 'F' )   ptab(     1       :jpreci,:,:) = zland    ! south except F-point
+                                         ptab(nlci-jpreci+1:jpi   ,:,:) = zland    ! north
+         ENDIF
+         !                                   ! North-South boundaries (always closed)
+         IF( .NOT. cd_type == 'F' )   ptab(:,     1       :jprecj,:) = zland       ! south except F-point
+                                      ptab(:,nlcj-jprecj+1:jpj   ,:) = zland       ! north
+         !
+      ENDIF
+
+      ! 2. East and west directions exchange
+      ! ------------------------------------
+      ! we play with the neigbours AND the row number because of the periodicity 
+      !
+      SELECT CASE ( nbondi )      ! Read Dirichlet lateral conditions
+      CASE ( -1, 0, 1 )                ! all exept 2 (i.e. close case)
+         iihom = nlci-nreci
+         DO jl = 1, jpreci
+            t3ew(:,jl,:,1) = ptab(jpreci+jl,:,:)
+            t3we(:,jl,:,1) = ptab(iihom +jl,:,:)
+         END DO
+      END SELECT  
+      !
+      !                           ! Migrations
+      imigr = jpreci * jpj * jpk
+      !
+      SELECT CASE ( nbondi ) 
+      CASE ( -1 )
+         CALL mppsend( 2, t3we(1,1,1,1), imigr, noea, ml_req1 )
+         CALL mpprecv( 1, t3ew(1,1,1,2), imigr, noea )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+      CASE ( 0 )
+         CALL mppsend( 1, t3ew(1,1,1,1), imigr, nowe, ml_req1 )
+         CALL mppsend( 2, t3we(1,1,1,1), imigr, noea, ml_req2 )
+         CALL mpprecv( 1, t3ew(1,1,1,2), imigr, noea )
+         CALL mpprecv( 2, t3we(1,1,1,2), imigr, nowe )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req2, ml_stat, ml_err)
+      CASE ( 1 )
+         CALL mppsend( 1, t3ew(1,1,1,1), imigr, nowe, ml_req1 )
+         CALL mpprecv( 2, t3we(1,1,1,2), imigr, nowe )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+      END SELECT
+      !
+      !                           ! Write Dirichlet lateral conditions
+      iihom = nlci-jpreci
+      !
+      SELECT CASE ( nbondi )
+      CASE ( -1 )
+         DO jl = 1, jpreci
+            ptab(iihom+jl,:,:) = t3ew(:,jl,:,2)
+         END DO
+      CASE ( 0 ) 
+         DO jl = 1, jpreci
+            ptab(jl      ,:,:) = t3we(:,jl,:,2)
+            ptab(iihom+jl,:,:) = t3ew(:,jl,:,2)
+         END DO
+      CASE ( 1 )
+         DO jl = 1, jpreci
+            ptab(jl      ,:,:) = t3we(:,jl,:,2)
+         END DO
+      END SELECT
+
+
+      ! 3. North and south directions
+      ! -----------------------------
+      ! always closed : we play only with the neigbours
+      !
+      IF( nbondj /= 2 ) THEN      ! Read Dirichlet lateral conditions
+         ijhom = nlcj-nrecj
+         DO jl = 1, jprecj
+            t3sn(:,jl,:,1) = ptab(:,ijhom +jl,:)
+            t3ns(:,jl,:,1) = ptab(:,jprecj+jl,:)
+         END DO
+      ENDIF
+      !
+      !                           ! Migrations
+      imigr = jprecj * jpi * jpk
+      !
+      SELECT CASE ( nbondj )     
+      CASE ( -1 )
+         CALL mppsend( 4, t3sn(1,1,1,1), imigr, nono, ml_req1 )
+         CALL mpprecv( 3, t3ns(1,1,1,2), imigr, nono )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+      CASE ( 0 )
+         CALL mppsend( 3, t3ns(1,1,1,1), imigr, noso, ml_req1 )
+         CALL mppsend( 4, t3sn(1,1,1,1), imigr, nono, ml_req2 )
+         CALL mpprecv( 3, t3ns(1,1,1,2), imigr, nono )
+         CALL mpprecv( 4, t3sn(1,1,1,2), imigr, noso )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req2, ml_stat, ml_err)
+      CASE ( 1 ) 
+         CALL mppsend( 3, t3ns(1,1,1,1), imigr, noso, ml_req1 )
+         CALL mpprecv( 4, t3sn(1,1,1,2), imigr, noso )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+      END SELECT
+      !
+      !                           ! Write Dirichlet lateral conditions
+      ijhom = nlcj-jprecj
+      !
+      SELECT CASE ( nbondj )
+      CASE ( -1 )
+         DO jl = 1, jprecj
+            ptab(:,ijhom+jl,:) = t3ns(:,jl,:,2)
+         END DO
+      CASE ( 0 ) 
+         DO jl = 1, jprecj
+            ptab(:,jl      ,:) = t3sn(:,jl,:,2)
+            ptab(:,ijhom+jl,:) = t3ns(:,jl,:,2)
+         END DO
+      CASE ( 1 )
+         DO jl = 1, jprecj
+            ptab(:,jl,:) = t3sn(:,jl,:,2)
+         END DO
+      END SELECT
+
+
+      ! 4. north fold treatment
+      ! -----------------------
+      !
+      IF( npolj /= 0 .AND. .NOT. PRESENT(cd_mpp) ) THEN
+         !
+         SELECT CASE ( jpni )
+         CASE ( 1 )     ;   CALL lbc_nfd      ( ptab, cd_type, psgn )   ! only 1 northern proc, no mpp
+         CASE DEFAULT   ;   CALL mpp_lbc_north( ptab, cd_type, psgn )   ! for all northern procs.
+         END SELECT
+         !
+      ENDIF
+      !
+   END SUBROUTINE mpp_lnk_3d
+
+
+   SUBROUTINE mpp_lnk_2d( pt2d, cd_type, psgn, cd_mpp, pval )
+      !!----------------------------------------------------------------------
+      !!                  ***  routine mpp_lnk_2d  ***
+      !!                  
+      !! ** Purpose :   Message passing manadgement for 2d array
+      !!
+      !! ** Method  :   Use mppsend and mpprecv function for passing mask 
+      !!      between processors following neighboring subdomains.
+      !!            domain parameters
+      !!                    nlci   : first dimension of the local subdomain
+      !!                    nlcj   : second dimension of the local subdomain
+      !!                    nbondi : mark for "east-west local boundary"
+      !!                    nbondj : mark for "north-south local boundary"
+      !!                    noea   : number for local neighboring processors 
+      !!                    nowe   : number for local neighboring processors
+      !!                    noso   : number for local neighboring processors
+      !!                    nono   : number for local neighboring processors
+      !!
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) ::   pt2d     ! 2D array on which the boundary condition is applied
+      CHARACTER(len=1)            , INTENT(in   ) ::   cd_type  ! define the nature of ptab array grid-points
+      !                                                         ! = T , U , V , F , W and I points
+      REAL(wp)                    , INTENT(in   ) ::   psgn     ! =-1 the sign change across the north fold boundary
+      !                                                         ! =  1. , the sign is kept
+      CHARACTER(len=3), OPTIONAL  , INTENT(in   ) ::   cd_mpp   ! fill the overlap area only 
+      REAL(wp)        , OPTIONAL  , INTENT(in   ) ::   pval     ! background value (used at closed boundaries)
+      !!
+      INTEGER  ::   ji, jj, jl   ! dummy loop indices
+      INTEGER  ::   imigr, iihom, ijhom        ! temporary integers
+      INTEGER  ::   ml_req1, ml_req2, ml_err   ! for key_mpi_isend
+      REAL(wp) ::   zland
+      INTEGER, DIMENSION(MPI_STATUS_SIZE) ::   ml_stat   ! for key_mpi_isend
+      !!----------------------------------------------------------------------
+
+      IF( PRESENT( pval ) ) THEN   ;   zland = pval      ! set land value
+      ELSE                         ;   zland = 0.e0      ! zero by default
+      ENDIF
+
+      ! 1. standard boundary treatment
+      ! ------------------------------
+      !
+      IF( PRESENT( cd_mpp ) ) THEN      ! only fill added line/raw with existing values
+         !
+         ! WARNING pt2d is defined only between nld and nle
+         DO jj = nlcj+1, jpj                 ! added line(s)   (inner only)
+            pt2d(nldi  :nlei  , jj          ) = pt2d(nldi:nlei,     nlej)   
+            pt2d(1     :nldi-1, jj          ) = pt2d(nldi     ,     nlej)
+            pt2d(nlei+1:nlci  , jj          ) = pt2d(     nlei,     nlej)
+         END DO
+         DO ji = nlci+1, jpi                 ! added column(s) (full)
+            pt2d(ji           ,nldj  :nlej  ) = pt2d(     nlei,nldj:nlej)
+            pt2d(ji           ,1     :nldj-1) = pt2d(     nlei,nldj     )
+            pt2d(ji           ,nlej+1:jpj   ) = pt2d(     nlei,     nlej)
+         END DO
+         !
+      ELSE                              ! standard close or cyclic treatment 
+         !
+         !                                   ! East-West boundaries
+         IF( nbondi == 2 .AND.   &                ! Cyclic east-west
+            &    (nperio == 1 .OR. nperio == 4 .OR. nperio == 6) ) THEN
+            pt2d( 1 ,:) = pt2d(jpim1,:)                                    ! west
+            pt2d(jpi,:) = pt2d(  2  ,:)                                    ! east
+         ELSE                                     ! closed
+            IF( .NOT. cd_type == 'F' )   pt2d(     1       :jpreci,:) = zland    ! south except F-point
+                                         pt2d(nlci-jpreci+1:jpi   ,:) = zland    ! north
+         ENDIF
+         !                                   ! North-South boundaries (always closed)
+            IF( .NOT. cd_type == 'F' )   pt2d(:,     1       :jprecj) = zland    !south except F-point
+                                         pt2d(:,nlcj-jprecj+1:jpj   ) = zland    ! north
+         !
+      ENDIF
+
+      ! 2. East and west directions exchange
+      ! ------------------------------------
+      ! we play with the neigbours AND the row number because of the periodicity 
+      !
+      SELECT CASE ( nbondi )      ! Read Dirichlet lateral conditions
+      CASE ( -1, 0, 1 )                ! all exept 2 (i.e. close case)
+         iihom = nlci-nreci
+         DO jl = 1, jpreci
+            t2ew(:,jl,1) = pt2d(jpreci+jl,:)
+            t2we(:,jl,1) = pt2d(iihom +jl,:)
+         END DO
+      END SELECT
+      !
+      !                           ! Migrations
+      imigr = jpreci * jpj
+      !
+      SELECT CASE ( nbondi )
+      CASE ( -1 )
+         CALL mppsend( 2, t2we(1,1,1), imigr, noea, ml_req1 )
+         CALL mpprecv( 1, t2ew(1,1,2), imigr, noea )
+         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+      CASE ( 0 )
+         CALL mppsend( 1, t2ew(1,1,1), imigr, nowe, ml_req1 )
+         CALL mppsend( 2, t2we(1,1,1), imigr, noea, ml_req2 )
+         CALL mpprecv( 1, t2ew(1,1,2), imigr, noea )
+         CALL mpprecv( 2, t2we(1,1,2), imigr, nowe )
+         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
+      CASE ( 1 )
+         CALL mppsend( 1, t2ew(1,1,1), imigr, nowe, ml_req1 )
+         CALL mpprecv( 2, t2we(1,1,2), imigr, nowe )
+         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+      END SELECT
+      !
+      !                           ! Write Dirichlet lateral conditions
+      iihom = nlci - jpreci
+      !
+      SELECT CASE ( nbondi )
+      CASE ( -1 )
+         DO jl = 1, jpreci
+            pt2d(iihom+jl,:) = t2ew(:,jl,2)
+         END DO
+      CASE ( 0 )
+         DO jl = 1, jpreci
+            pt2d(jl      ,:) = t2we(:,jl,2)
+            pt2d(iihom+jl,:) = t2ew(:,jl,2)
+         END DO
+      CASE ( 1 )
+         DO jl = 1, jpreci
+            pt2d(jl      ,:) = t2we(:,jl,2)
+         END DO
+      END SELECT
+
+
+      ! 3. North and south directions
+      ! -----------------------------
+      ! always closed : we play only with the neigbours
+      !
+      IF( nbondj /= 2 ) THEN      ! Read Dirichlet lateral conditions
+         ijhom = nlcj-nrecj
+         DO jl = 1, jprecj
+            t2sn(:,jl,1) = pt2d(:,ijhom +jl)
+            t2ns(:,jl,1) = pt2d(:,jprecj+jl)
+         END DO
+      ENDIF
+      !
+      !                           ! Migrations
+      imigr = jprecj * jpi
+      !
+      SELECT CASE ( nbondj )
+      CASE ( -1 )
+         CALL mppsend( 4, t2sn(1,1,1), imigr, nono, ml_req1 )
+         CALL mpprecv( 3, t2ns(1,1,2), imigr, nono )
+         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+      CASE ( 0 )
+         CALL mppsend( 3, t2ns(1,1,1), imigr, noso, ml_req1 )
+         CALL mppsend( 4, t2sn(1,1,1), imigr, nono, ml_req2 )
+         CALL mpprecv( 3, t2ns(1,1,2), imigr, nono )
+         CALL mpprecv( 4, t2sn(1,1,2), imigr, noso )
+         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
+      CASE ( 1 )
+         CALL mppsend( 3, t2ns(1,1,1), imigr, noso, ml_req1 )
+         CALL mpprecv( 4, t2sn(1,1,2), imigr, noso )
+         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+      END SELECT
+      !
+      !                           ! Write Dirichlet lateral conditions
+      ijhom = nlcj - jprecj
+      !
+      SELECT CASE ( nbondj )
+      CASE ( -1 )
+         DO jl = 1, jprecj
+            pt2d(:,ijhom+jl) = t2ns(:,jl,2)
+         END DO
+      CASE ( 0 )
+         DO jl = 1, jprecj
+            pt2d(:,jl      ) = t2sn(:,jl,2)
+            pt2d(:,ijhom+jl) = t2ns(:,jl,2)
+         END DO
+      CASE ( 1 ) 
+         DO jl = 1, jprecj
+            pt2d(:,jl      ) = t2sn(:,jl,2)
+         END DO
+      END SELECT
+
+
+      ! 4. north fold treatment
+      ! -----------------------
+      !
       IF( npolj /= 0 .AND. .NOT. PRESENT(cd_mpp) ) THEN
          !
@@ -1782,4 +2148,5 @@
       INTEGER ::   ml_stat(MPI_STATUS_SIZE)    ! for key_mpi_isend
       REAL(wp), POINTER, DIMENSION(:,:) ::   ztab   ! temporary workspace
+      LOGICAL :: lmigr ! is true for those processors that have to migrate the OB
       !!----------------------------------------------------------------------
 
@@ -1807,9 +2174,18 @@
          CALL mppstop
       ENDIF
-      
+
       ! Communication level by level
       ! ----------------------------
 !!gm Remark : this is very time consumming!!!
       !                                         ! ------------------------ !
+            IF( ijpt0 > ijpt1 .OR. iipt0 > iipt1 ) THEN
+            ! there is nothing to be migrated
+               lmigr = .FALSE.
+            ELSE
+              lmigr = .TRUE.
+            ENDIF
+
+      IF( lmigr ) THEN
+
       DO jk = 1, kk                             !   Loop over the levels   !
          !                                      ! ------------------------ !
@@ -1833,14 +2209,14 @@
          ! ---------------------------
          !
+       IF( ktype == 1 ) THEN
+
          IF( nbondi /= 2 ) THEN         ! Read Dirichlet lateral conditions
             iihom = nlci-nreci
-            DO jl = 1, jpreci
-               t2ew(:,jl,1) = ztab(jpreci+jl,:)
-               t2we(:,jl,1) = ztab(iihom +jl,:)
-            END DO
+            t2ew(1:jpreci,1,1) = ztab(jpreci+1:nreci, ijpt0)
+            t2we(1:jpreci,1,1) = ztab(iihom+1:iihom+jpreci, ijpt0)
          ENDIF
          !
          !                              ! Migrations
-         imigr=jpreci*jpj
+         imigr = jpreci
          !
          IF( nbondi == -1 ) THEN
@@ -1865,28 +2241,23 @@
          !
          IF( nbondi == 0 .OR. nbondi == 1 ) THEN
-            DO jl = 1, jpreci
-               ztab(jl,:) = t2we(:,jl,2)
-            END DO
+            ztab(1:jpreci, ijpt0) = t2we(1:jpreci,1,2)
          ENDIF
          IF( nbondi == -1 .OR. nbondi == 0 ) THEN
-            DO jl = 1, jpreci
-               ztab(iihom+jl,:) = t2ew(:,jl,2)
-            END DO
+            ztab(iihom+1:iihom+jpreci, ijpt0) = t2ew(1:jpreci,1,2)
          ENDIF
-
+       ENDIF  ! (ktype == 1)
 
          ! 2. North and south directions
          ! -----------------------------
          !
+       IF(ktype == 2 ) THEN
          IF( nbondj /= 2 ) THEN         ! Read Dirichlet lateral conditions
             ijhom = nlcj-nrecj
-            DO jl = 1, jprecj
-               t2sn(:,jl,1) = ztab(:,ijhom +jl)
-               t2ns(:,jl,1) = ztab(:,jprecj+jl)
-            END DO
+            t2sn(1:jprecj,1,1) = ztab(iipt0, ijhom+1:ijhom+jprecj)
+            t2ns(1:jprecj,1,1) = ztab(iipt0, jprecj+1:nrecj)
          ENDIF
          !
          !                              ! Migrations
-         imigr = jprecj * jpi
+         imigr = jprecj
          !
          IF( nbondj == -1 ) THEN
@@ -1910,17 +2281,14 @@
          ijhom = nlcj - jprecj
          IF( nbondj == 0 .OR. nbondj == 1 ) THEN
-            DO jl = 1, jprecj
-               ztab(:,jl) = t2sn(:,jl,2)
-            END DO
+            ztab(iipt0,1:jprecj) = t2sn(1:jprecj,1,2)
          ENDIF
          IF( nbondj == 0 .OR. nbondj == -1 ) THEN
-            DO jl = 1, jprecj
-               ztab(:,ijhom+jl) = t2ns(:,jl,2)
-            END DO
+            ztab(iipt0, ijhom+1:ijhom+jprecj) = t2ns(1:jprecj,1,2)
          ENDIF
+         ENDIF    ! (ktype == 2)
          IF( ktype==1 .AND. kd1 <= jpi+nimpp-1 .AND. nimpp <= kd2 ) THEN
             DO jj = ijpt0, ijpt1            ! north/south boundaries
                DO ji = iipt0,ilpt1
-                  ptab(ji,jk) = ztab(ji,jj)  
+                  ptab(ji,jk) = ztab(ji,jj)
                END DO
             END DO
@@ -1928,5 +2296,5 @@
             DO jj = ijpt0, ilpt1            ! east/west boundaries
                DO ji = iipt0,iipt1
-                  ptab(jj,jk) = ztab(ji,jj) 
+                  ptab(jj,jk) = ztab(ji,jj)
                END DO
             END DO
@@ -1935,4 +2303,5 @@
       END DO
       !
+      ENDIF ! ( lmigr )
       CALL wrk_dealloc( jpi,jpj, ztab )
       !
@@ -2534,4 +2903,431 @@
    END SUBROUTINE mpp_lbc_north_e
 
+      SUBROUTINE mpp_lnk_bdy_3d( ptab, cd_type, psgn, ib_bdy )
+      !!----------------------------------------------------------------------
+      !!                  ***  routine mpp_lnk_bdy_3d  ***
+      !!
+      !! ** Purpose :   Message passing management
+      !!
+      !! ** Method  :   Use mppsend and mpprecv function for passing BDY boundaries 
+      !!      between processors following neighboring subdomains.
+      !!            domain parameters
+      !!                    nlci   : first dimension of the local subdomain
+      !!                    nlcj   : second dimension of the local subdomain
+      !!                    nbondi_bdy : mark for "east-west local boundary"
+      !!                    nbondj_bdy : mark for "north-south local boundary"
+      !!                    noea   : number for local neighboring processors 
+      !!                    nowe   : number for local neighboring processors
+      !!                    noso   : number for local neighboring processors
+      !!                    nono   : number for local neighboring processors
+      !!
+      !! ** Action  :   ptab with update value at its periphery
+      !!
+      !!----------------------------------------------------------------------
+
+      USE lbcnfd          ! north fold
+
+      INCLUDE 'mpif.h'
+
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   ptab     ! 3D array on which the boundary condition is applied
+      CHARACTER(len=1)                , INTENT(in   ) ::   cd_type  ! define the nature of ptab array grid-points
+      !                                                             ! = T , U , V , F , W points
+      REAL(wp)                        , INTENT(in   ) ::   psgn     ! =-1 the sign change across the north fold boundary
+      !                                                             ! =  1. , the sign is kept
+      INTEGER                         , INTENT(in   ) ::   ib_bdy   ! BDY boundary set
+      INTEGER  ::   ji, jj, jk, jl             ! dummy loop indices
+      INTEGER  ::   imigr, iihom, ijhom        ! temporary integers
+      INTEGER  ::   ml_req1, ml_req2, ml_err   ! for key_mpi_isend
+      REAL(wp) ::   zland
+      INTEGER, DIMENSION(MPI_STATUS_SIZE) ::   ml_stat   ! for key_mpi_isend
+      !!----------------------------------------------------------------------
+
+      zland = 0.e0
+
+      ! 1. standard boundary treatment
+      ! ------------------------------
+      
+      !                                   ! East-West boundaries
+      !                                        !* Cyclic east-west
+
+      IF( nbondi == 2) THEN
+        IF (nperio == 1 .OR. nperio == 4 .OR. nperio == 6) THEN
+          ptab( 1 ,:,:) = ptab(jpim1,:,:)
+          ptab(jpi,:,:) = ptab(  2  ,:,:)
+        ELSE
+          IF( .NOT. cd_type == 'F' )   ptab(     1       :jpreci,:,:) = zland    ! south except F-point
+          ptab(nlci-jpreci+1:jpi   ,:,:) = zland    ! north
+        ENDIF
+      ELSEIF(nbondi == -1) THEN
+        IF( .NOT. cd_type == 'F' )   ptab(     1       :jpreci,:,:) = zland    ! south except F-point
+      ELSEIF(nbondi == 1) THEN
+        ptab(nlci-jpreci+1:jpi   ,:,:) = zland    ! north
+      ENDIF                                     !* closed
+
+      IF (nbondj == 2 .OR. nbondj == -1) THEN
+        IF( .NOT. cd_type == 'F' )   ptab(:,     1       :jprecj,:) = zland       ! south except F-point
+      ELSEIF (nbondj == 2 .OR. nbondj == 1) THEN
+        ptab(:,nlcj-jprecj+1:jpj   ,:) = zland       ! north
+      ENDIF
+      
+      !
+
+      ! 2. East and west directions exchange
+      ! ------------------------------------
+      ! we play with the neigbours AND the row number because of the periodicity 
+      !
+      SELECT CASE ( nbondi_bdy(ib_bdy) )      ! Read Dirichlet lateral conditions
+      CASE ( -1, 0, 1 )                ! all exept 2 (i.e. close case)
+         iihom = nlci-nreci
+         DO jl = 1, jpreci
+            t3ew(:,jl,:,1) = ptab(jpreci+jl,:,:)
+            t3we(:,jl,:,1) = ptab(iihom +jl,:,:)
+         END DO
+      END SELECT
+      !
+      !                           ! Migrations
+      imigr = jpreci * jpj * jpk
+      !
+      SELECT CASE ( nbondi_bdy(ib_bdy) )
+      CASE ( -1 )
+         CALL mppsend( 2, t3we(1,1,1,1), imigr, noea, ml_req1 )
+      CASE ( 0 )
+         CALL mppsend( 1, t3ew(1,1,1,1), imigr, nowe, ml_req1 )
+         CALL mppsend( 2, t3we(1,1,1,1), imigr, noea, ml_req2 )
+      CASE ( 1 )
+         CALL mppsend( 1, t3ew(1,1,1,1), imigr, nowe, ml_req1 )
+      END SELECT
+      !
+      SELECT CASE ( nbondi_bdy_b(ib_bdy) )
+      CASE ( -1 )
+         CALL mpprecv( 1, t3ew(1,1,1,2), imigr, noea )
+      CASE ( 0 )
+         CALL mpprecv( 1, t3ew(1,1,1,2), imigr, noea )
+         CALL mpprecv( 2, t3we(1,1,1,2), imigr, nowe )
+      CASE ( 1 )
+         CALL mpprecv( 2, t3we(1,1,1,2), imigr, nowe )
+      END SELECT
+      !
+      SELECT CASE ( nbondi_bdy(ib_bdy) )
+      CASE ( -1 )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+      CASE ( 0 )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req2, ml_stat, ml_err)
+      CASE ( 1 )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+      END SELECT
+      !
+      !                           ! Write Dirichlet lateral conditions
+      iihom = nlci-jpreci
+      !
+      SELECT CASE ( nbondi_bdy_b(ib_bdy) )
+      CASE ( -1 )
+         DO jl = 1, jpreci
+            ptab(iihom+jl,:,:) = t3ew(:,jl,:,2)
+         END DO
+      CASE ( 0 )
+         DO jl = 1, jpreci
+            ptab(jl      ,:,:) = t3we(:,jl,:,2)
+            ptab(iihom+jl,:,:) = t3ew(:,jl,:,2)
+         END DO
+      CASE ( 1 )
+         DO jl = 1, jpreci
+            ptab(jl      ,:,:) = t3we(:,jl,:,2)
+         END DO
+      END SELECT
+
+
+      ! 3. North and south directions
+      ! -----------------------------
+      ! always closed : we play only with the neigbours
+      !
+      IF( nbondj_bdy(ib_bdy) /= 2 ) THEN      ! Read Dirichlet lateral conditions
+         ijhom = nlcj-nrecj
+         DO jl = 1, jprecj
+            t3sn(:,jl,:,1) = ptab(:,ijhom +jl,:)
+            t3ns(:,jl,:,1) = ptab(:,jprecj+jl,:)
+         END DO
+      ENDIF
+      !
+      !                           ! Migrations
+      imigr = jprecj * jpi * jpk
+      !
+      SELECT CASE ( nbondj_bdy(ib_bdy) )
+      CASE ( -1 )
+         CALL mppsend( 4, t3sn(1,1,1,1), imigr, nono, ml_req1 )
+      CASE ( 0 )
+         CALL mppsend( 3, t3ns(1,1,1,1), imigr, noso, ml_req1 )
+         CALL mppsend( 4, t3sn(1,1,1,1), imigr, nono, ml_req2 )
+      CASE ( 1 )
+         CALL mppsend( 3, t3ns(1,1,1,1), imigr, noso, ml_req1 )
+      END SELECT
+      !
+      SELECT CASE ( nbondj_bdy_b(ib_bdy) )
+      CASE ( -1 )
+         CALL mpprecv( 3, t3ns(1,1,1,2), imigr, nono )
+      CASE ( 0 )
+         CALL mpprecv( 3, t3ns(1,1,1,2), imigr, nono )
+         CALL mpprecv( 4, t3sn(1,1,1,2), imigr, noso )
+      CASE ( 1 )
+         CALL mpprecv( 4, t3sn(1,1,1,2), imigr, noso )
+      END SELECT
+      !
+      SELECT CASE ( nbondj_bdy(ib_bdy) )
+      CASE ( -1 )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+      CASE ( 0 )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req2, ml_stat, ml_err)
+      CASE ( 1 )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+      END SELECT
+      !
+      !                           ! Write Dirichlet lateral conditions
+      ijhom = nlcj-jprecj
+      !
+      SELECT CASE ( nbondj_bdy_b(ib_bdy) )
+      CASE ( -1 )
+         DO jl = 1, jprecj
+            ptab(:,ijhom+jl,:) = t3ns(:,jl,:,2)
+         END DO
+      CASE ( 0 )
+         DO jl = 1, jprecj
+            ptab(:,jl      ,:) = t3sn(:,jl,:,2)
+            ptab(:,ijhom+jl,:) = t3ns(:,jl,:,2)
+         END DO
+      CASE ( 1 )
+         DO jl = 1, jprecj
+            ptab(:,jl,:) = t3sn(:,jl,:,2)
+         END DO
+      END SELECT
+
+
+      ! 4. north fold treatment
+      ! -----------------------
+      !
+      IF( npolj /= 0) THEN
+         !
+         SELECT CASE ( jpni )
+         CASE ( 1 )     ;   CALL lbc_nfd      ( ptab, cd_type, psgn )   ! only 1 northern proc, no mpp
+         CASE DEFAULT   ;   CALL mpp_lbc_north( ptab, cd_type, psgn )   ! for all northern procs.
+         END SELECT
+         !
+      ENDIF
+      !
+   END SUBROUTINE mpp_lnk_bdy_3d
+
+      SUBROUTINE mpp_lnk_bdy_2d( ptab, cd_type, psgn, ib_bdy )
+      !!----------------------------------------------------------------------
+      !!                  ***  routine mpp_lnk_bdy_2d  ***
+      !!
+      !! ** Purpose :   Message passing management
+      !!
+      !! ** Method  :   Use mppsend and mpprecv function for passing BDY boundaries 
+      !!      between processors following neighboring subdomains.
+      !!            domain parameters
+      !!                    nlci   : first dimension of the local subdomain
+      !!                    nlcj   : second dimension of the local subdomain
+      !!                    nbondi_bdy : mark for "east-west local boundary"
+      !!                    nbondj_bdy : mark for "north-south local boundary"
+      !!                    noea   : number for local neighboring processors 
+      !!                    nowe   : number for local neighboring processors
+      !!                    noso   : number for local neighboring processors
+      !!                    nono   : number for local neighboring processors
+      !!
+      !! ** Action  :   ptab with update value at its periphery
+      !!
+      !!----------------------------------------------------------------------
+
+      USE lbcnfd          ! north fold
+
+      INCLUDE 'mpif.h'
+
+      REAL(wp), DIMENSION(jpi,jpj)    , INTENT(inout) ::   ptab     ! 3D array on which the boundary condition is applied
+      CHARACTER(len=1)                , INTENT(in   ) ::   cd_type  ! define the nature of ptab array grid-points
+      !                                                             ! = T , U , V , F , W points
+      REAL(wp)                        , INTENT(in   ) ::   psgn     ! =-1 the sign change across the north fold boundary
+      !                                                             ! =  1. , the sign is kept
+      INTEGER                         , INTENT(in   ) ::   ib_bdy   ! BDY boundary set
+      INTEGER  ::   ji, jj, jl             ! dummy loop indices
+      INTEGER  ::   imigr, iihom, ijhom        ! temporary integers
+      INTEGER  ::   ml_req1, ml_req2, ml_err   ! for key_mpi_isend
+      REAL(wp) ::   zland
+      INTEGER, DIMENSION(MPI_STATUS_SIZE) ::   ml_stat   ! for key_mpi_isend
+      !!----------------------------------------------------------------------
+
+      zland = 0.e0
+
+      ! 1. standard boundary treatment
+      ! ------------------------------
+      
+      !                                   ! East-West boundaries
+      !                                        !* Cyclic east-west
+
+      IF( nbondi == 2) THEN
+        IF (nperio == 1 .OR. nperio == 4 .OR. nperio == 6) THEN
+          ptab( 1 ,:) = ptab(jpim1,:)
+          ptab(jpi,:) = ptab(  2  ,:)
+        ELSE
+          IF( .NOT. cd_type == 'F' )   ptab(     1       :jpreci,:) = zland    ! south except F-point
+          ptab(nlci-jpreci+1:jpi   ,:) = zland    ! north
+        ENDIF
+      ELSEIF(nbondi == -1) THEN
+        IF( .NOT. cd_type == 'F' )   ptab(     1       :jpreci,:) = zland    ! south except F-point
+      ELSEIF(nbondi == 1) THEN
+        ptab(nlci-jpreci+1:jpi   ,:) = zland    ! north
+      ENDIF                                     !* closed
+
+      IF (nbondj == 2 .OR. nbondj == -1) THEN
+        IF( .NOT. cd_type == 'F' )   ptab(:,     1       :jprecj) = zland       ! south except F-point
+      ELSEIF (nbondj == 2 .OR. nbondj == 1) THEN
+        ptab(:,nlcj-jprecj+1:jpj) = zland       ! north
+      ENDIF
+      
+      !
+
+      ! 2. East and west directions exchange
+      ! ------------------------------------
+      ! we play with the neigbours AND the row number because of the periodicity 
+      !
+      SELECT CASE ( nbondi_bdy(ib_bdy) )      ! Read Dirichlet lateral conditions
+      CASE ( -1, 0, 1 )                ! all exept 2 (i.e. close case)
+         iihom = nlci-nreci
+         DO jl = 1, jpreci
+            t2ew(:,jl,1) = ptab(jpreci+jl,:)
+            t2we(:,jl,1) = ptab(iihom +jl,:)
+         END DO
+      END SELECT
+      !
+      !                           ! Migrations
+      imigr = jpreci * jpj
+      !
+      SELECT CASE ( nbondi_bdy(ib_bdy) )
+      CASE ( -1 )
+         CALL mppsend( 2, t2we(1,1,1), imigr, noea, ml_req1 )
+      CASE ( 0 )
+         CALL mppsend( 1, t2ew(1,1,1), imigr, nowe, ml_req1 )
+         CALL mppsend( 2, t2we(1,1,1), imigr, noea, ml_req2 )
+      CASE ( 1 )
+         CALL mppsend( 1, t2ew(1,1,1), imigr, nowe, ml_req1 )
+      END SELECT
+      !
+      SELECT CASE ( nbondi_bdy_b(ib_bdy) )
+      CASE ( -1 )
+         CALL mpprecv( 1, t2ew(1,1,2), imigr, noea )
+      CASE ( 0 )
+         CALL mpprecv( 1, t2ew(1,1,2), imigr, noea )
+         CALL mpprecv( 2, t2we(1,1,2), imigr, nowe )
+      CASE ( 1 )
+         CALL mpprecv( 2, t2we(1,1,2), imigr, nowe )
+      END SELECT
+      !
+      SELECT CASE ( nbondi_bdy(ib_bdy) )
+      CASE ( -1 )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+      CASE ( 0 )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req2, ml_stat, ml_err)
+      CASE ( 1 )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+      END SELECT
+      !
+      !                           ! Write Dirichlet lateral conditions
+      iihom = nlci-jpreci
+      !
+      SELECT CASE ( nbondi_bdy_b(ib_bdy) )
+      CASE ( -1 )
+         DO jl = 1, jpreci
+            ptab(iihom+jl,:) = t2ew(:,jl,2)
+         END DO
+      CASE ( 0 )
+         DO jl = 1, jpreci
+            ptab(jl      ,:) = t2we(:,jl,2)
+            ptab(iihom+jl,:) = t2ew(:,jl,2)
+         END DO
+      CASE ( 1 )
+         DO jl = 1, jpreci
+            ptab(jl      ,:) = t2we(:,jl,2)
+         END DO
+      END SELECT
+
+
+      ! 3. North and south directions
+      ! -----------------------------
+      ! always closed : we play only with the neigbours
+      !
+      IF( nbondj_bdy(ib_bdy) /= 2 ) THEN      ! Read Dirichlet lateral conditions
+         ijhom = nlcj-nrecj
+         DO jl = 1, jprecj
+            t2sn(:,jl,1) = ptab(:,ijhom +jl)
+            t2ns(:,jl,1) = ptab(:,jprecj+jl)
+         END DO
+      ENDIF
+      !
+      !                           ! Migrations
+      imigr = jprecj * jpi
+      !
+      SELECT CASE ( nbondj_bdy(ib_bdy) )
+      CASE ( -1 )
+         CALL mppsend( 4, t2sn(1,1,1), imigr, nono, ml_req1 )
+      CASE ( 0 )
+         CALL mppsend( 3, t2ns(1,1,1), imigr, noso, ml_req1 )
+         CALL mppsend( 4, t2sn(1,1,1), imigr, nono, ml_req2 )
+      CASE ( 1 )
+         CALL mppsend( 3, t2ns(1,1,1), imigr, noso, ml_req1 )
+      END SELECT
+      !
+      SELECT CASE ( nbondj_bdy_b(ib_bdy) )
+      CASE ( -1 )
+         CALL mpprecv( 3, t2ns(1,1,2), imigr, nono )
+      CASE ( 0 )
+         CALL mpprecv( 3, t2ns(1,1,2), imigr, nono )
+         CALL mpprecv( 4, t2sn(1,1,2), imigr, noso )
+      CASE ( 1 )
+         CALL mpprecv( 4, t2sn(1,1,2), imigr, noso )
+      END SELECT
+      !
+      SELECT CASE ( nbondj_bdy(ib_bdy) )
+      CASE ( -1 )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+      CASE ( 0 )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req2, ml_stat, ml_err)
+      CASE ( 1 )
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+      END SELECT
+      !
+      !                           ! Write Dirichlet lateral conditions
+      ijhom = nlcj-jprecj
+      !
+      SELECT CASE ( nbondj_bdy_b(ib_bdy) )
+      CASE ( -1 )
+         DO jl = 1, jprecj
+            ptab(:,ijhom+jl) = t2ns(:,jl,2)
+         END DO
+      CASE ( 0 )
+         DO jl = 1, jprecj
+            ptab(:,jl      ) = t2sn(:,jl,2)
+            ptab(:,ijhom+jl) = t2ns(:,jl,2)
+         END DO
+      CASE ( 1 )
+         DO jl = 1, jprecj
+            ptab(:,jl) = t2sn(:,jl,2)
+         END DO
+      END SELECT
+
+
+      ! 4. north fold treatment
+      ! -----------------------
+      !
+      IF( npolj /= 0) THEN
+         !
+         SELECT CASE ( jpni )
+         CASE ( 1 )     ;   CALL lbc_nfd      ( ptab, cd_type, psgn )   ! only 1 northern proc, no mpp
+         CASE DEFAULT   ;   CALL mpp_lbc_north( ptab, cd_type, psgn )   ! for all northern procs.
+         END SELECT
+         !
+      ENDIF
+      !
+   END SUBROUTINE mpp_lnk_bdy_2d
 
    SUBROUTINE mpi_init_opa( ldtxt, ksft, code )
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/OBC/obcdyn.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/OBC/obcdyn.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/OBC/obcdyn.F90	(revision 3680)
@@ -5,5 +5,6 @@
    !! Ocean dynamics:   Radiation of velocities on each open boundary
    !!=================================================================================
-
+   !! History :  3.5  !  2012     (S. Mocavero, I. Epicoco) Updates for the 
+   !!                             optimization of OBC communications
    !!---------------------------------------------------------------------------------
    !!   obc_dyn        : call the subroutine for each open boundary
@@ -105,9 +106,9 @@
       IF( lk_mpp ) THEN
          IF( kt >= nit000+3 .AND. ln_rstart ) THEN
-            CALL lbc_lnk( ub, 'U', -1. )
-            CALL lbc_lnk( vb, 'V', -1. )
+            CALL lbc_obc_lnk( ub, 'U', -1. )
+            CALL lbc_obc_lnk( vb, 'V', -1. )
          END IF
-         CALL lbc_lnk( ua, 'U', -1. )
-         CALL lbc_lnk( va, 'V', -1. )
+         CALL lbc_obc_lnk( ua, 'U', -1. )
+         CALL lbc_obc_lnk( va, 'V', -1. )
       ENDIF
 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/OBC/obcdyn_bt.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/OBC/obcdyn_bt.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/OBC/obcdyn_bt.F90	(revision 3680)
@@ -5,4 +5,6 @@
    !!======================================================================
    !! History :  1.0  ! 2005-12  (V. Garnier) original code
+   !!            3.5  ! 2012     (S. Mocavero, I. Epicoco) Updates for the 
+   !!                             optimization of OBC communications
    !!----------------------------------------------------------------------
 #if ( defined key_dynspg_ts || defined key_dynspg_exp ) && defined key_obc
@@ -65,11 +67,11 @@
       IF( lk_mpp ) THEN
          IF( kt >= nit000+3 .AND. ln_rstart ) THEN
-            CALL lbc_lnk( sshb, 'T',  1. )
-            CALL lbc_lnk( ub  , 'U', -1. )
-            CALL lbc_lnk( vb  , 'V', -1. )
+            CALL lbc_obc_lnk( sshb, 'T',  1. )
+            CALL lbc_obc_lnk( ub  , 'U', -1. )
+            CALL lbc_obc_lnk( vb  , 'V', -1. )
          END IF
-         CALL lbc_lnk( sshn, 'T',  1. )
-         CALL lbc_lnk( ua  , 'U', -1. )
-         CALL lbc_lnk( va  , 'V', -1. )
+         CALL lbc_obc_lnk( sshn, 'T',  1. )
+         CALL lbc_obc_lnk( ua  , 'U', -1. )
+         CALL lbc_obc_lnk( va  , 'V', -1. )
       ENDIF
 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/OBC/obctra.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/OBC/obctra.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/OBC/obctra.F90	(revision 3680)
@@ -4,4 +4,6 @@
    !! Ocean tracers:   Radiation of tracers on each open boundary
    !!=================================================================================
+   !! History :  3.5  !  2012     (S. Mocavero, I. Epicoco) Updates for the 
+   !!                             optimization of OBC communications
 #if defined key_obc
    !!---------------------------------------------------------------------------------
@@ -101,9 +103,9 @@
       IF( lk_mpp ) THEN                  !!bug ???
          IF( kt >= nit000+3 .AND. ln_rstart ) THEN
-            CALL lbc_lnk( tsb(:,:,:,jp_tem), 'T', 1. )
-            CALL lbc_lnk( tsb(:,:,:,jp_sal), 'T', 1. )
+            CALL lbc_obc_lnk( tsb(:,:,:,jp_tem), 'T', 1. )
+            CALL lbc_obc_lnk( tsb(:,:,:,jp_sal), 'T', 1. )
          END IF
-         CALL lbc_lnk( tsa(:,:,:,jp_tem), 'T', 1. )
-         CALL lbc_lnk( tsa(:,:,:,jp_sal), 'T', 1. )
+         CALL lbc_obc_lnk( tsa(:,:,:,jp_tem), 'T', 1. )
+         CALL lbc_obc_lnk( tsa(:,:,:,jp_sal), 'T', 1. )
       ENDIF
 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/cyclone.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/cyclone.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/cyclone.F90	(revision 3680)
@@ -0,0 +1,283 @@
+MODULE cyclone
+   !!======================================================================
+   !!                       ***  MODULE  cyclone  ***
+   !! add the Tropical Cyclones along tracks to the surface wind forcing
+   !!                 
+   !!======================================================================
+   !! History : 3.3  ! 2010-05  (E Vincent, G Madec, S Masson)  Original code
+   !!----------------------------------------------------------------------
+
+#if defined key_cyclone
+   !!----------------------------------------------------------------------
+   !!  'key_cyclone' : key option add Tropical Cyclones in the wind forcing
+   !!----------------------------------------------------------------------
+   !!   wnd_cyc      : 1 module subroutine
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and active tracers
+   USE sbc_oce         ! surface boundary condition: ocean
+   USE dom_oce         ! ocean space domain variables
+   USE phycst          ! physical constant
+   USE fldread         ! read input fields
+   USE in_out_manager  ! I/O manager
+   USE geo2ocean       ! tools for projection on ORCA grid
+   USE wrk_nemo        ! work arrays
+   USE lib_mpp       
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   wnd_cyc   ! routine called in sbcblk_core.F90 module
+
+   INTEGER , PARAMETER ::   jp_is1  = 1   ! index of presence 1 or absence 0 of a TC record
+   INTEGER , PARAMETER ::   jp_lon  = 2   ! index of longitude for present TCs
+   INTEGER , PARAMETER ::   jp_lat  = 3   ! index of latitude  for present TCs
+   INTEGER , PARAMETER ::   jp_vmax = 4   ! index of max wind  for present TCs
+   INTEGER , PARAMETER ::   jp_pres = 5   ! index of eye-pres  for present TCs
+
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf   ! structure of input fields (file informations, fields read)
+
+   !! * Substitutions
+#  include "vectopt_loop_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010) 
+   !! $Id: module_example 1146 2008-06-25 11:42:56Z rblod $ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE wnd_cyc( kt, pwnd_i, pwnd_j )
+      !!----------------------------------------------------------------------
+      !!                    ***  ROUTINE wnd_cyc  ***
+      !!
+      !! ** Purpose :  Add cyclone winds on the ORCA grid
+      !!
+      !! ** Action  : - open TC data, find TCs for the current timestep
+      !!              - for each potential TC, add the winds on the grid
+      !!----------------------------------------------------------------------
+      INTEGER , INTENT(in)                      ::   kt       ! time step index 
+      REAL(wp), INTENT(out), DIMENSION(jpi,jpj) ::   pwnd_i   ! wind speed i-components at T-point ORCA direction
+      REAL(wp), INTENT(out), DIMENSION(jpi,jpj) ::   pwnd_j   ! wind speed j-components at T-point ORCA direction
+      ! 
+      !!
+      INTEGER  ::   ji, jj , jtc        ! loop arguments
+      INTEGER  ::   ierror              ! loop arguments
+      INTEGER  ::   vortex=1            ! vortex shape to be used: 0=Holland 1=Willoughby
+      REAL(wp) ::   zrout1=1.5e6        ! distance from center where we begin to kill vortex (m)
+      REAL(wp) ::   zrout2=2.5e6        ! distance from center where we bring vortex to zero (m)
+      REAL(wp) ::   zb                  ! power in Holland vortex shape
+      REAL(wp) ::   zA                  ! shape parameter in Willoughby vortex : A transtion between first and second outter exp
+      REAL(wp) ::   zn                  ! shape parameter in Willoughby vortex : n power law in the eye
+      REAL(wp) ::   zXX1                ! shape parameter in Willoughby vortex : decay length second outter exponential
+      REAL(wp) ::   zXX2                ! shape parameter in Willoughby vortex : decay length first  outter exponential
+      REAL(wp) ::   zztmp               ! temporary 
+      REAL(wp) ::   zzrglam, zzrgphi    ! temporary 
+      REAL(wp) ::   ztheta              ! azimuthal angle
+      REAL(wp) ::   zdist               ! dist to the TC center
+      REAL(wp) ::   zhemi               ! 1 for NH ;  -1 for SH
+      REAL(wp) ::   zinfl               ! clim inflow angle in TCs
+      REAL(wp) ::   zrmw                ! mean radius of Max wind of a tropical cyclone (Willoughby 2004) [m]
+      REAL(wp) ::   zwnd_r, zwnd_t      ! radial and tangential components of the wind
+      REAL(wp) ::   zvmax               ! timestep interpolated vmax
+      REAL(wp) ::   zrlon, zrlat        ! temporary 
+      REAL(wp), DIMENSION(:,:), POINTER ::   zwnd_x, zwnd_y   ! zonal and meridional components of the wind
+      REAL(wp), DIMENSION(14,5)    ::   ztct                ! tropical cyclone track data at kt
+      !
+      CHARACTER(len=100) ::  cn_dir            ! Root directory for location of files
+      TYPE(FLD_N), DIMENSION(1) ::   slf_i     ! array of namelist informations on the TC position
+      TYPE(FLD_N) ::   sn_tc                   ! informations about the fields to be read
+      !      NAMELIST/namsbc_tc/ cn_dir , sn_tc
+      !!--------------------------------------------------------------------
+
+      CALL wrk_alloc( jpi,jpj, zwnd_x, zwnd_y )
+
+      !                                         ! ====================== !
+      IF( kt == nit000 ) THEN                   !  First call kt=nit000  !
+         !                                      ! ====================== !
+         ! set file information (default values)
+         cn_dir = './'       ! directory in which the model is executed
+         !
+         ! (NB: frequency positive => hours, negative => months)
+         !          !    file     ! frequency !  variable ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   !
+         !          !    name     !  (hours)  !   name    !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      !
+         sn_tc = FLD_N( 'tc_track',     6     ,  'tc'     ,  .true.    , .false. ,   'yearly'  , ''       , ''         )
+         !
+         !         REWIND( numnam )                    ! ... read in namlist namsbc_core
+         !         READ  ( numnam, namsbc_tc )
+         !
+         ! set sf structure
+         ALLOCATE( sf(1), STAT=ierror )
+         IF( ierror > 0 ) THEN
+            CALL ctl_stop( 'wnd_cyc: unable to allocate sf structure' )   ;   RETURN
+         ENDIF
+         ALLOCATE( sf(1)%fnow(14,5,1) )
+         ALLOCATE( sf(1)%fdta(14,5,1,2) )
+         slf_i(1) = sn_tc
+         !
+         ! fill sf with slf_i and control print
+         CALL fld_fill( sf, slf_i, cn_dir, 'sbc_blk_tc', 'tropical cyclone track', 'namsbc_tc' )
+         !
+      ENDIF
+
+
+      !       Interpolation of lon lat vmax... at the current timestep
+      !       ***************************************************************
+
+      CALL fld_read( kt, nn_fsbc, sf )                   ! input fields provided at the current time-step
+
+      ztct(:,:) = sf(1)%fnow(:,:,1)
+
+      !       Add TC wind on the grid
+      !       ***************************************************************
+
+      zwnd_x(:,:) = 0.e0  
+      zwnd_y(:,:) = 0.e0 
+      
+      DO jtc = 1, 14
+         !
+         IF( ztct(jtc,jp_is1) == 1 ) THEN                ! cyclone is defined in this slot ? yes--> begin
+
+            zvmax =       ztct(jtc,jp_vmax)
+            zrlon = rad * ztct(jtc,jp_lon )
+            zrlat = rad * ztct(jtc,jp_lat )
+            zhemi = SIGN( 1. , zrlat )
+            zinfl = 15.* rad                             ! clim inflow angle in Tropical Cyclones
+         IF ( vortex == 0 ) THEN
+
+            ! Vortex Holland reconstruct wind at each lon-lat position
+            ! ********************************************************
+            zrmw = 51.6 * EXP( -0.0223*zvmax + 0.0281* ABS( ztct(jtc,jp_lat) ) ) * 1000.
+            ! climatological ZRMW of cyclones as a function of wind and latitude (Willoughby 2004)             
+            ! zb = 1.0036 + 0.0173 * zvmax - 0.0313 * LOG(zrmw/1000.) + 0.0087 * ABS( ztct(jtc,jp_lat) ) 
+            ! fitted B parameter (Willoughby 2004)
+            zb = 2.
+
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+
+                  ! calc distance between TC center and any point following great circle
+                  ! source : http://www.movable-type.co.uk/scripts/latlong.html
+                  zzrglam = rad * glamt(ji,jj) - zrlon
+                  zzrgphi = rad * gphit(ji,jj)
+                  zdist = ra * ACOS(  SIN( zrlat ) * SIN( zzrgphi )   &
+                     &              + COS( zrlat ) * COS( zzrgphi ) * COS( zzrglam ) )
+
+                 IF (zdist < zrout2) THEN ! calculation of wind only to a given max radius
+                  ! shape of the wind profile
+                  zztmp = ( zrmw / ( zdist + 1.e-12 ) )**zb
+                  zztmp =  zvmax * SQRT( zztmp * EXP(1. - zztmp) )    
+
+                  IF (zdist > zrout1) THEN ! bring to zero between r_out1 and r_out2
+                     zztmp = zztmp * ( (zrout2-zdist)*1.e-6 )
+                  ENDIF
+
+                  ! !!! KILL EQ WINDS
+                  ! IF (SIGN( 1. , zrlat ) /= zhemi) THEN
+                  !    zztmp = 0.                              ! winds in other hemisphere
+                  !    IF (ABS(gphit(ji,jj)) <= 5.) zztmp=0.   ! kill between 5N-5S
+                  ! ENDIF
+                  ! IF (ABS(gphit(ji,jj)) <= 10. .and. ABS(gphit(ji,jj)) > 5.) THEN
+                  !    zztmp = zztmp * ( 1./5. * (ABS(gphit(ji,jj)) - 5.) ) 
+                  !    !linear to zero between 10 and 5
+                  ! ENDIF
+                  ! !!! / KILL EQ
+
+                  IF (ABS(gphit(ji,jj)) >= 55.) zztmp = 0. ! kill weak spurious winds at high latitude
+
+                  zwnd_t =   COS( zinfl ) * zztmp    
+                  zwnd_r = - SIN( zinfl ) * zztmp
+
+                  ! Project radial-tangential components on zonal-meridional components
+                  ! -------------------------------------------------------------------
+                  
+                  ! ztheta = azimuthal angle of the great circle between two points
+                  zztmp = COS( zrlat ) * SIN( zzrgphi ) &
+                     &  - SIN( zrlat ) * COS( zzrgphi ) * COS( zzrglam )
+                  ztheta = ATAN2(        COS( zzrgphi ) * SIN( zzrglam ) , zztmp )
+
+                  zwnd_x(ji,jj) = zwnd_x(ji,jj) - zhemi * COS(ztheta)*zwnd_t + SIN(ztheta)*zwnd_r
+                  zwnd_y(ji,jj) = zwnd_y(ji,jj) + zhemi * SIN(ztheta)*zwnd_t + COS(ztheta)*zwnd_r
+                 ENDIF
+               END DO
+            END DO
+         
+         ELSE IF ( vortex == 1 ) THEN
+
+            ! Vortex Willoughby reconstruct wind at each lon-lat position
+            ! ***********************************************************
+            zrmw = 46.4 * EXP( -0.0155*zvmax + 0.0169* ABS( ztct(jtc,jp_lat) ) )*1000.
+            ! climatological ZRMW of cyclones as a function of wind and latitude (Willoughby 2006)
+            zXX2 = 25.*1000.                                              ! 25km fixed "near-eye" exponential decay
+            zXX1 = ( 287.6  - 1.942 *zvmax + 7.799 *LOG(zrmw/1000.) + 1.819 *ABS( ztct(jtc,jp_lat) ) )*1000.    
+            zn   =   2.1340 + 0.0077*zvmax - 0.4522*LOG(zrmw/1000.) - 0.0038*ABS( ztct(jtc,jp_lat) )            
+            zA   =   0.5913 + 0.0029*zvmax - 0.1361*LOG(zrmw/1000.) - 0.0042*ABS( ztct(jtc,jp_lat) )  
+            IF (zA < 0) THEN 
+               zA=0
+            ENDIF           
+        
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                                  
+                  zzrglam = rad * glamt(ji,jj) - zrlon
+                  zzrgphi = rad * gphit(ji,jj)
+                  zdist = ra * ACOS(  SIN( zrlat ) * SIN( zzrgphi )   &
+                     &              + COS( zrlat ) * COS( zzrgphi ) * COS( zzrglam ) )
+
+                 IF (zdist < zrout2) THEN ! calculation of wind only to a given max radius
+               
+                  ! shape of the wind profile                     
+                  IF (zdist <= zrmw) THEN     ! inside the Radius of Maximum Wind
+                     zztmp  = zvmax * (zdist/zrmw)**zn
+                  ELSE 
+                     zztmp  = zvmax * ( (1-zA) * EXP(- (zdist-zrmw)/zXX1 ) + zA * EXP(- (zdist-zrmw)/zXX2 ) )
+                  ENDIF
+
+                  IF (zdist > zrout1) THEN ! bring to zero between r_out1 and r_out2
+                     zztmp = zztmp * ( (zrout2-zdist)*1.e-6 )
+                  ENDIF
+
+                  ! !!! KILL EQ WINDS
+                  ! IF (SIGN( 1. , zrlat ) /= zhemi) THEN
+                  !    zztmp = 0.                              ! winds in other hemisphere
+                  !    IF (ABS(gphit(ji,jj)) <= 5.) zztmp=0.   ! kill between 5N-5S
+                  ! ENDIF
+                  ! IF (ABS(gphit(ji,jj)) <= 10. .and. ABS(gphit(ji,jj)) > 5.) THEN
+                  !    zztmp = zztmp * ( 1./5. * (ABS(gphit(ji,jj)) - 5.) ) 
+                  !    !linear to zero between 10 and 5
+                  ! ENDIF
+                  ! !!! / KILL EQ
+
+                  IF (ABS(gphit(ji,jj)) >= 55.) zztmp = 0. ! kill weak spurious winds at high latitude
+
+                  zwnd_t =   COS( zinfl ) * zztmp    
+                  zwnd_r = - SIN( zinfl ) * zztmp
+
+                  ! Project radial-tangential components on zonal-meridional components
+                  ! -------------------------------------------------------------------
+                  
+                  ! ztheta = azimuthal angle of the great circle between two points
+                  zztmp = COS( zrlat ) * SIN( zzrgphi ) &
+                     &  - SIN( zrlat ) * COS( zzrgphi ) * COS( zzrglam )
+                  ztheta = ATAN2(        COS( zzrgphi ) * SIN( zzrglam ) , zztmp )
+
+                  zwnd_x(ji,jj) = zwnd_x(ji,jj) - zhemi * COS(ztheta)*zwnd_t + SIN(ztheta)*zwnd_r
+                  zwnd_y(ji,jj) = zwnd_y(ji,jj) + zhemi * SIN(ztheta)*zwnd_t + COS(ztheta)*zwnd_r
+                  
+                 ENDIF
+               END DO
+            END DO
+         ENDIF                                         ! / vortex Holland or Wiloughby
+         ENDIF                                           ! / cyclone is defined in this slot ? yes--> begin
+      END DO ! / end simultaneous cyclones loop
+
+      CALL rot_rep ( zwnd_x, zwnd_y, 'T', 'en->i', pwnd_i ) !rotation of components on ORCA grid
+      CALL rot_rep ( zwnd_x, zwnd_y, 'T', 'en->j', pwnd_j ) !rotation of components on ORCA grid
+
+      CALL wrk_dealloc( jpi,jpj, zwnd_x, zwnd_y )
+
+   END SUBROUTINE wnd_cyc
+
+#endif
+
+   !!======================================================================
+END MODULE cyclone
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/fldread.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/fldread.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/fldread.F90	(revision 3680)
@@ -629,8 +629,9 @@
       INTEGER                  ::   ipk    ! number of vertical levels of sdjf%fdta ( 2D: ipk=1 ; 3D: ipk=jpk )
       INTEGER                  ::   iw     ! index into wgts array
-      !!---------------------------------------------------------------------
-            
+      INTEGER                  ::   ipdom  ! index of the domain
+      !!---------------------------------------------------------------------
+      !      
       ipk = SIZE( sdjf%fnow, 3 )
-
+      !
       IF( PRESENT(map) ) THEN
          IF( sdjf%ln_tint ) THEN   ;   CALL fld_map( sdjf%num, sdjf%clvar, sdjf%fdta(:,:,:,2), sdjf%nrec_a(1), map )
@@ -643,12 +644,15 @@
          ENDIF
       ELSE
+         IF( SIZE(sdjf%fnow, 1) == jpi ) THEN  ;  ipdom = jpdom_data
+         ELSE                                  ;  ipdom = jpdom_unknown
+         ENDIF
          SELECT CASE( ipk )
-         CASE(1)   
-            IF( sdjf%ln_tint ) THEN   ;   CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,1,2), sdjf%nrec_a(1) )
-            ELSE                      ;   CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fnow(:,:,1  ), sdjf%nrec_a(1) )
+         CASE(1)
+            IF( sdjf%ln_tint ) THEN   ;   CALL iom_get( sdjf%num, ipdom, sdjf%clvar, sdjf%fdta(:,:,1,2), sdjf%nrec_a(1) )
+            ELSE                      ;   CALL iom_get( sdjf%num, ipdom, sdjf%clvar, sdjf%fnow(:,:,1  ), sdjf%nrec_a(1) )
             ENDIF
          CASE DEFAULT
-            IF( sdjf%ln_tint ) THEN   ;   CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,:,2), sdjf%nrec_a(1) )
-            ELSE                      ;   CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fnow(:,:,:  ), sdjf%nrec_a(1) )
+            IF( sdjf%ln_tint ) THEN   ;   CALL iom_get( sdjf%num, ipdom, sdjf%clvar, sdjf%fdta(:,:,:,2), sdjf%nrec_a(1) )
+            ELSE                      ;   CALL iom_get( sdjf%num, ipdom, sdjf%clvar, sdjf%fnow(:,:,:  ), sdjf%nrec_a(1) )
             ENDIF
          END SELECT
@@ -850,4 +854,5 @@
          IF( LEN( TRIM(sdf_n(jf)%wname) ) > 0 )   sdf(jf)%wgtname = TRIM( cdir )//TRIM( sdf_n(jf)%wname )
          sdf(jf)%vcomp   = sdf_n(jf)%vcomp
+         sdf(jf)%rotn    = .FALSE.
       END DO
 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90	(revision 3680)
@@ -49,5 +49,7 @@
    !                                             !:  = 1 global mean of e-p-r set to zero at each nn_fsbc time step
    !                                             !:  = 2 annual global mean of e-p-r set to zero
-   LOGICAL , PUBLIC ::   ln_cdgw     = .FALSE.   !: true if neutral drag coefficient read from wave model
+   LOGICAL , PUBLIC ::   ln_wave     = .FALSE.   !: true if some coupling with wave model
+   LOGICAL , PUBLIC ::   ln_cdgw     = .FALSE.   !: true if neutral drag coefficient from wave model
+   LOGICAL , PUBLIC ::   ln_sdw      = .FALSE.   !: true if 3d stokes drift from wave model
 
    !!----------------------------------------------------------------------
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90	(revision 3680)
@@ -20,5 +20,4 @@
    USE iom             ! IOM library
    USE lib_mpp         ! MPP library
-   USE restart         ! ocean restart
 
    IMPLICIT NONE
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 3680)
@@ -29,4 +29,5 @@
    USE fldread         ! read input fields
    USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE cyclone         ! Cyclone 10m wind form trac of cyclone centres
    USE sbcdcy          ! surface boundary condition: diurnal cycle
    USE iom             ! I/O manager library
@@ -186,5 +187,5 @@
 
       !                                            ! compute the surface ocean fluxes using CORE bulk formulea
-      IF( MOD( kt - 1, nn_fsbc ) == 0 )   CALL blk_oce_core( sf, sst_m, ssu_m, ssv_m )
+      IF( MOD( kt - 1, nn_fsbc ) == 0 )   CALL blk_oce_core( kt, sf, sst_m, ssu_m, ssv_m )
 
 #if defined key_cice
@@ -204,5 +205,5 @@
    
    
-   SUBROUTINE blk_oce_core( sf, pst, pu, pv )
+   SUBROUTINE blk_oce_core( kt, sf, pst, pu, pv )
       !!---------------------------------------------------------------------
       !!                     ***  ROUTINE blk_core  ***
@@ -225,8 +226,9 @@
       !!  ** Nota  :   sf has to be a dummy argument for AGRIF on NEC
       !!---------------------------------------------------------------------
-      TYPE(fld), INTENT(in), DIMENSION(:)   ::   sf    ! input data
-      REAL(wp) , INTENT(in), DIMENSION(:,:) ::   pst   ! surface temperature                      [Celcius]
-      REAL(wp) , INTENT(in), DIMENSION(:,:) ::   pu    ! surface current at U-point (i-component) [m/s]
-      REAL(wp) , INTENT(in), DIMENSION(:,:) ::   pv    ! surface current at V-point (j-component) [m/s]
+      INTEGER  , INTENT(in   )                 ::   kt    ! time step index
+      TYPE(fld), INTENT(inout), DIMENSION(:)   ::   sf    ! input data
+      REAL(wp) , INTENT(in)   , DIMENSION(:,:) ::   pst   ! surface temperature                      [Celcius]
+      REAL(wp) , INTENT(in)   , DIMENSION(:,:) ::   pu    ! surface current at U-point (i-component) [m/s]
+      REAL(wp) , INTENT(in)   , DIMENSION(:,:) ::   pv    ! surface current at V-point (j-component) [m/s]
       !
       INTEGER  ::   ji, jj               ! dummy loop indices
@@ -261,4 +263,16 @@
       zwnd_i(:,:) = 0.e0  
       zwnd_j(:,:) = 0.e0
+#if defined key_cyclone
+# if defined key_vectopt_loop
+!CDIR COLLAPSE
+# endif
+      CALL wnd_cyc( kt, zwnd_i, zwnd_j )    ! add Manu !
+      DO jj = 2, jpjm1
+         DO ji = fs_2, fs_jpim1   ! vect. opt.
+            sf(jp_wndi)%fnow(ji,jj,1) = sf(jp_wndi)%fnow(ji,jj,1) + zwnd_i(ji,jj)
+            sf(jp_wndj)%fnow(ji,jj,1) = sf(jp_wndj)%fnow(ji,jj,1) + zwnd_j(ji,jj)
+         END DO
+      END DO
+#endif
 #if defined key_vectopt_loop
 !CDIR COLLAPSE
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 3680)
@@ -41,5 +41,4 @@
 #endif
    USE geo2ocean       ! 
-   USE restart         !
    USE oce   , ONLY : tsn, un, vn
    USE albedo          !
@@ -381,4 +380,11 @@
          &     srcv( (/jpr_otz1, jpr_otz2, jpr_itz1, jpr_itz2/) )%laction = .FALSE. 
       !
+      IF( TRIM( sn_rcv_tau%clvor  ) == 'local grid' ) THEN        ! already on local grid -> no need of the second grid
+            srcv(jpr_otx2:jpr_otz2)%laction = .FALSE. 
+            srcv(jpr_itx2:jpr_itz2)%laction = .FALSE. 
+            srcv(jpr_oty1)%clgrid = srcv(jpr_oty2)%clgrid   ! not needed but cleaner...
+            srcv(jpr_ity1)%clgrid = srcv(jpr_ity2)%clgrid   ! not needed but cleaner...
+      ENDIF
+      !
       IF( TRIM( sn_rcv_tau%cldes ) /= 'oce and ice' ) THEN        ! 'oce and ice' case ocean stress on ocean mesh used
          srcv(jpr_itx1:jpr_itz2)%laction = .FALSE.    ! ice components not received
@@ -520,4 +526,5 @@
       ssnd(jps_tmix)%clname = 'O_TepMix'
       SELECT CASE( TRIM( sn_snd_temp%cldes ) )
+      CASE( 'none'         )       ! nothing to do
       CASE( 'oce only'             )   ;   ssnd(   jps_toce             )%laction = .TRUE.
       CASE( 'weighted oce and ice' )
@@ -562,5 +569,6 @@
 
       SELECT CASE ( TRIM( sn_snd_thick%cldes ) )
-      CASE ( 'ice and snow' ) 
+      CASE( 'none'         )       ! nothing to do
+      CASE( 'ice and snow' ) 
          ssnd(jps_hice:jps_hsnw)%laction = .TRUE.
          IF ( TRIM( sn_snd_thick%clcat ) == 'yes' ) THEN
@@ -568,5 +576,5 @@
          ELSE
             IF ( jpl > 1 ) THEN
-               CALL ctl_stop( 'sbc_cpl_init: use weighted ice and snow option for sn_snd_thick%cldes if not exchanging category fields' )
+CALL ctl_stop( 'sbc_cpl_init: use weighted ice and snow option for sn_snd_thick%cldes if not exchanging category fields' )
             ENDIF
          ENDIF
@@ -1357,27 +1365,29 @@
       !                                                      !    Surface temperature    !   in Kelvin
       !                                                      ! ------------------------- !
-      SELECT CASE( sn_snd_temp%cldes)
-      CASE( 'oce only'             )   ;   ztmp1(:,:) =   tsn(:,:,1,jp_tem) + rt0
-      CASE( 'weighted oce and ice' )   ;   ztmp1(:,:) = ( tsn(:,:,1,jp_tem) + rt0 ) * zfr_l(:,:)   
-         SELECT CASE( sn_snd_temp%clcat )
-         CASE( 'yes' )   
-            ztmp3(:,:,1:jpl) = tn_ice(:,:,1:jpl) * a_i(:,:,1:jpl)
-         CASE( 'no' )
-            ztmp3(:,:,:) = 0._wp
+      IF( ssnd(jps_toce)%laction .OR. ssnd(jps_tice)%laction .OR. ssnd(jps_tmix)%laction ) THEN
+         SELECT CASE( sn_snd_temp%cldes)
+         CASE( 'oce only'             )   ;   ztmp1(:,:) =   tsn(:,:,1,jp_tem) + rt0
+         CASE( 'weighted oce and ice' )   ;   ztmp1(:,:) = ( tsn(:,:,1,jp_tem) + rt0 ) * zfr_l(:,:)   
+            SELECT CASE( sn_snd_temp%clcat )
+            CASE( 'yes' )   
+               ztmp3(:,:,1:jpl) = tn_ice(:,:,1:jpl) * a_i(:,:,1:jpl)
+            CASE( 'no' )
+               ztmp3(:,:,:) = 0.0
+               DO jl=1,jpl
+                  ztmp3(:,:,1) = ztmp3(:,:,1) + tn_ice(:,:,jl) * a_i(:,:,jl)
+               ENDDO
+            CASE default                  ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_temp%clcat' )
+            END SELECT
+         CASE( 'mixed oce-ice'        )   
+            ztmp1(:,:) = ( tsn(:,:,1,1) + rt0 ) * zfr_l(:,:) 
             DO jl=1,jpl
-               ztmp3(:,:,1) = ztmp3(:,:,1) + tn_ice(:,:,jl) * a_i(:,:,jl)
+               ztmp1(:,:) = ztmp1(:,:) + tn_ice(:,:,jl) * a_i(:,:,jl)
             ENDDO
-         CASE default                  ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_temp%clcat' )
+         CASE default                     ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_temp%cldes' )
          END SELECT
-      CASE( 'mixed oce-ice'        )   
-         ztmp1(:,:) = ( tsn(:,:,1,1) + rt0 ) * zfr_l(:,:) 
-         DO jl=1,jpl
-            ztmp1(:,:) = ztmp1(:,:) + tn_ice(:,:,jl) * a_i(:,:,jl)
-         ENDDO
-      CASE default                     ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_temp%cldes' )
-      END SELECT
-      IF( ssnd(jps_toce)%laction )   CALL cpl_prism_snd( jps_toce, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
-      IF( ssnd(jps_tice)%laction )   CALL cpl_prism_snd( jps_tice, isec, ztmp3, info )
-      IF( ssnd(jps_tmix)%laction )   CALL cpl_prism_snd( jps_tmix, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
+         IF( ssnd(jps_toce)%laction )   CALL cpl_prism_snd( jps_toce, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
+         IF( ssnd(jps_tice)%laction )   CALL cpl_prism_snd( jps_tice, isec, ztmp3, info )
+         IF( ssnd(jps_tmix)%laction )   CALL cpl_prism_snd( jps_tmix, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
+      ENDIF
       !
       !                                                      ! ------------------------- !
@@ -1399,35 +1409,38 @@
       !                                                      ! ------------------------- !
       ! Send ice fraction field 
-      SELECT CASE( sn_snd_thick%clcat )
-         CASE( 'yes' )   
-            ztmp3(:,:,1:jpl) =  a_i(:,:,1:jpl)
-         CASE( 'no' )
-            ztmp3(:,:,1) = fr_i(:,:)
-      CASE default                     ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_thick%clcat' )
-      END SELECT
-      IF( ssnd(jps_fice)%laction ) CALL cpl_prism_snd( jps_fice, isec, ztmp3, info )
+      IF( ssnd(jps_fice)%laction ) THEN
+         SELECT CASE( sn_snd_thick%clcat )
+         CASE( 'yes' )   ;   ztmp3(:,:,1:jpl) =  a_i(:,:,1:jpl)
+         CASE( 'no'  )   ;   ztmp3(:,:,1    ) = fr_i(:,:      )
+         CASE default    ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_thick%clcat' )
+         END SELECT
+         CALL cpl_prism_snd( jps_fice, isec, ztmp3, info )
+      ENDIF
 
       ! Send ice and snow thickness field 
-      SELECT CASE( sn_snd_thick%cldes)
-      CASE( 'weighted ice and snow' )   
-         SELECT CASE( sn_snd_thick%clcat )
-         CASE( 'yes' )   
-            ztmp3(:,:,1:jpl) =  ht_i(:,:,1:jpl) * a_i(:,:,1:jpl)
-            ztmp4(:,:,1:jpl) =  ht_s(:,:,1:jpl) * a_i(:,:,1:jpl)
-         CASE( 'no' )
-            ztmp3(:,:,:) = 0._wp   ;  ztmp4(:,:,:) = 0._wp
-            DO jl=1,jpl
-               ztmp3(:,:,1) = ztmp3(:,:,1) + ht_i(:,:,jl) * a_i(:,:,jl)
-               ztmp4(:,:,1) = ztmp4(:,:,1) + ht_s(:,:,jl) * a_i(:,:,jl)
-            ENDDO
-         CASE default                  ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_thick%clcat' )
+      IF( ssnd(jps_hice)%laction .OR. ssnd(jps_hsnw)%laction ) THEN 
+         SELECT CASE( sn_snd_thick%cldes)
+         CASE( 'none'                  )       ! nothing to do
+         CASE( 'weighted ice and snow' )   
+            SELECT CASE( sn_snd_thick%clcat )
+            CASE( 'yes' )   
+               ztmp3(:,:,1:jpl) =  ht_i(:,:,1:jpl) * a_i(:,:,1:jpl)
+               ztmp4(:,:,1:jpl) =  ht_s(:,:,1:jpl) * a_i(:,:,1:jpl)
+            CASE( 'no' )
+               ztmp3(:,:,:) = 0.0   ;  ztmp4(:,:,:) = 0.0
+               DO jl=1,jpl
+                  ztmp3(:,:,1) = ztmp3(:,:,1) + ht_i(:,:,jl) * a_i(:,:,jl)
+                  ztmp4(:,:,1) = ztmp4(:,:,1) + ht_s(:,:,jl) * a_i(:,:,jl)
+               ENDDO
+            CASE default                  ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_thick%clcat' )
+            END SELECT
+         CASE( 'ice and snow'         )   
+            ztmp3(:,:,1:jpl) = ht_i(:,:,1:jpl)
+            ztmp4(:,:,1:jpl) = ht_s(:,:,1:jpl)
+         CASE default                     ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_thick%cldes' )
          END SELECT
-      CASE( 'ice and snow'         )   
-         ztmp3(:,:,1:jpl) = ht_i(:,:,1:jpl)
-         ztmp4(:,:,1:jpl) = ht_s(:,:,1:jpl)
-      CASE default                     ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_thick%cldes' )
-      END SELECT
-      IF( ssnd(jps_hice)%laction )   CALL cpl_prism_snd( jps_hice, isec, ztmp3, info )
-      IF( ssnd(jps_hsnw)%laction )   CALL cpl_prism_snd( jps_hsnw, isec, ztmp4, info )
+         IF( ssnd(jps_hice)%laction )   CALL cpl_prism_snd( jps_hice, isec, ztmp3, info )
+         IF( ssnd(jps_hsnw)%laction )   CALL cpl_prism_snd( jps_hsnw, isec, ztmp4, info )
+      ENDIF
       !
 #if defined key_cpl_carbon_cycle
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90	(revision 3680)
@@ -48,4 +48,9 @@
    USE in_out_manager   ! I/O manager
    USE prtctl           ! Print control
+
+# if defined key_agrif
+   USE agrif_ice
+   USE agrif_lim2_update
+# endif
 
    IMPLICIT NONE
@@ -101,4 +106,8 @@
          !
          CALL ice_init_2
+         !
+# if defined key_agrif
+         IF( .NOT. Agrif_Root() ) CALL Agrif_InitValues_cont_lim2   ! AGRIF: set the meshes
+# endif
       ENDIF
 
@@ -106,4 +115,8 @@
       IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN     !  Ice time-step only  !
          !                                     !----------------------!
+# if defined key_agrif
+         IF( .NOT. Agrif_Root() ) lim_nbstep = MOD(lim_nbstep,Agrif_rhot()&
+         &*Agrif_PArent(nn_fsbc)/REAL(nn_fsbc)) + 1
+# endif
          !  Bulk Formulea !
          !----------------!
@@ -211,4 +224,8 @@
          IF( lrst_ice  )   CALL lim_rst_write_2( kt )      ! Ice restart file
          !
+# if defined key_agrif && defined key_lim2
+         IF( .NOT. Agrif_Root() )   CALL agrif_update_lim2( kt )
+# endif
+         !
       ENDIF                                    ! End sea-ice time step only
       !
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 3680)
@@ -47,5 +47,4 @@
 
    USE prtctl           ! Print control                    (prt_ctl routine)
-   USE restart          ! ocean restart
    USE iom              ! IOM library
    USE in_out_manager   ! I/O manager
@@ -87,5 +86,5 @@
       NAMELIST/namsbc/ nn_fsbc   , ln_ana    , ln_flx,  ln_blk_clio, ln_blk_core, ln_cpl,   &
          &             ln_blk_mfs, ln_apr_dyn, nn_ice,  nn_ice_embd, ln_dm2dc   , ln_rnf,   &
-         &             ln_ssr    , nn_fwb    , ln_cdgw
+         &             ln_ssr    , nn_fwb    , ln_cdgw , ln_wave , ln_sdw
       !!----------------------------------------------------------------------
 
@@ -96,6 +95,8 @@
       ENDIF
 
+      call flush(numout)
       REWIND( numnam )           ! Read Namelist namsbc
       READ  ( numnam, namsbc )
+      call flush(numout)
 
       !                          ! overwrite namelist parameter using CPP key information
@@ -176,7 +177,17 @@
          &   CALL ctl_warn( 'diurnal cycle for qsr: the sampling of the diurnal cycle is too small...' )
 
-       !drag coefficient read from wave model definable only with mfs bulk formulae and core 
-       IF(ln_cdgw .AND. .NOT.(ln_blk_mfs .OR. ln_blk_core) )              &
-          &   CALL ctl_stop( 'drag coefficient read from wave model definable only with mfs bulk formulae and core')
+      IF ( ln_wave ) THEN
+      !Activated wave module but neither drag nor stokes drift activated
+         IF ( .NOT.(ln_cdgw .OR. ln_sdw) )   THEN
+            CALL ctl_warn( 'Ask for wave coupling but nor drag coefficient (ln_cdgw=F) neither stokes drift activated (ln_sdw=F)' )
+      !drag coefficient read from wave model definable only with mfs bulk formulae and core 
+         ELSEIF (ln_cdgw .AND. .NOT.(ln_blk_mfs .OR. ln_blk_core) )       THEN       
+             CALL ctl_stop( 'drag coefficient read from wave model definable only with mfs bulk formulae and core')
+         ENDIF
+      ELSE
+      IF ( ln_cdgw .OR. ln_sdw  )                                         & 
+         &   CALL ctl_stop('Not Activated Wave Module (ln_wave=F) but     &
+         & asked coupling with drag coefficient (ln_cdgw =T) or Stokes drift (ln_sdw=T) ')
+      ENDIF 
       
       !                          ! Choice of the Surface Boudary Condition (set nsbc)
@@ -266,5 +277,5 @@
       !                                                  ! averaged over nf_sbc time-step
 
-      IF (ln_cdgw) CALL sbc_wave( kt )
+      IF (ln_wave) CALL sbc_wave( kt )
                                                    !==  sbc formulation  ==!
                                                             
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 3680)
@@ -21,5 +21,4 @@
    USE closea          ! closed seas
    USE fldread         ! read input field at current time step
-   USE restart         ! restart
    USE in_out_manager  ! I/O manager
    USE iom             ! I/O module
@@ -57,7 +56,7 @@
    
 
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_rnf       ! structure: river runoff (file information, fields read)
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_s_rnf     ! structure: river runoff salinity (file information, fields read)  
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_t_rnf     ! structure: river runoff temperature (file information, fields read)  
+   TYPE(FLD), PUBLIC, ALLOCATABLE, DIMENSION(:) ::   sf_rnf       ! structure: river runoff (file information, fields read)
+   TYPE(FLD), PUBLIC, ALLOCATABLE, DIMENSION(:) ::   sf_s_rnf     ! structure: river runoff salinity (file information, fields read)  
+   TYPE(FLD), PUBLIC, ALLOCATABLE, DIMENSION(:) ::   sf_t_rnf     ! structure: river runoff temperature (file information, fields read)  
  
    !! * Substitutions  
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssm.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssm.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssm.F90	(revision 3680)
@@ -18,5 +18,4 @@
    USE sbcapr          ! surface boundary condition: atmospheric pressure
    USE prtctl          ! Print control                    (prt_ctl routine)
-   USE restart         ! ocean restart
    USE iom
    USE in_out_manager  ! I/O manager
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcwave.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcwave.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcwave.F90	(revision 3680)
@@ -4,5 +4,6 @@
    !! Wave module 
    !!======================================================================
-   !! History :  3.3.1  !   2011-09  (Adani M)  Original code
+   !! History :  3.3.1  !   2011-09  (Adani M)  Original code: Drag Coefficient 
+   !!         :  3.4    !   2012-10  (Adani M)                 Stokes Drift 
    !!----------------------------------------------------------------------
    USE iom             ! I/O manager library
@@ -10,5 +11,7 @@
    USE lib_mpp         ! distribued memory computing library
    USE fldread	       ! read input fields
+   USE oce
    USE sbc_oce	       ! Surface boundary condition: ocean fields
+   USE domvvl
 
    
@@ -22,7 +25,16 @@
    PUBLIC   sbc_wave    ! routine called in sbc_blk_core or sbc_blk_mfs
    
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:)  :: sf_wave	  ! structure of input fields (file informations, fields read)
+   INTEGER , PARAMETER ::   jpfld  = 3           ! maximum number of files to read for srokes drift
+   INTEGER , PARAMETER ::   jp_usd = 1           ! index of stokes drift  (i-component) (m/s)    at T-point
+   INTEGER , PARAMETER ::   jp_vsd = 2           ! index of stokes drift  (j-component) (m/s)    at T-point
+   INTEGER , PARAMETER ::   jp_wn  = 3           ! index of wave number                 (1/m)    at T-point
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:)  :: sf_cd	  ! structure of input fields (file informations, fields read) Drag Coefficient
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:)  :: sf_sd	  ! structure of input fields (file informations, fields read) Stokes Drift
    REAL(wp),PUBLIC,ALLOCATABLE,DIMENSION (:,:)       :: cdn_wave 
+   REAL(wp),ALLOCATABLE,DIMENSION (:,:)              :: usd2d,vsd2d,uwavenum,vwavenum 
+   REAL(wp),PUBLIC,ALLOCATABLE,DIMENSION (:,:,:)     :: usd3d,vsd3d,wsd3d 
 
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OPA 4.0 , NEMO Consortium (2011) 
@@ -40,13 +52,26 @@
       !! ** Method  : - Read namelist namsbc_wave
       !!              - Read Cd_n10 fields in netcdf files 
+      !!              - Read stokes drift 2d in netcdf files 
+      !!              - Read wave number      in netcdf files 
+      !!              - Compute 3d stokes drift using monochromatic
       !! ** action  :   
       !!               
       !!---------------------------------------------------------------------
-      INTEGER, INTENT( in  ) ::  kt   ! ocean time step
+      USE oce,  ONLY : un,vn,hdivn,rotn
+      USE divcur
+      USE wrk_nemo
+#if defined key_bdy
+      USE bdy_oce, ONLY : bdytmask
+#endif
+      INTEGER, INTENT( in  ) ::  kt       ! ocean time step
       INTEGER                ::  ierror   ! return error code
-      CHARACTER(len=100)     ::  cn_dir_cdg                       ! Root directory for location of drag coefficient files
-      TYPE(FLD_N)            ::  sn_cdg                          ! informations about the fields to be read
+      INTEGER                ::  ifpr, jj,ji,jk 
+      REAL(wp),DIMENSION(:,:,:),POINTER             ::  udummy,vdummy,hdivdummy,rotdummy
+      REAL                                          ::  z2dt,z1_2dt
+      TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i     ! array of namelist informations on the fields to read
+      CHARACTER(len=100)     ::  cn_dir                          ! Root directory for location of drag coefficient files
+      TYPE(FLD_N)            ::  sn_cdg, sn_usd, sn_vsd, sn_wn   ! informations about the fields to be read
       !!---------------------------------------------------------------------
-      NAMELIST/namsbc_wave/  sn_cdg, cn_dir_cdg
+      NAMELIST/namsbc_wave/  sn_cdg, cn_dir, sn_usd, sn_vsd, sn_wn
       !!---------------------------------------------------------------------
 
@@ -62,5 +87,8 @@
          !              !   name   !  (hours)  !   name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs    !
          sn_cdg = FLD_N('cdg_wave'  ,    1     ,'drag_coeff',  .true.    , .false. ,   'daily'   , ''       , ''       )
-         cn_dir_cdg = './'          ! directory in which the Patm data are 
+         sn_usd = FLD_N('sdw_wave'  ,    1     ,'u_sd2d',      .true.    , .false. ,   'daily'   , ''       , ''       )
+         sn_vsd = FLD_N('sdw_wave'  ,    1     ,'v_sd2d',      .true.    , .false. ,   'daily'   , ''       , ''       )
+         sn_wn = FLD_N( 'sdw_wave'  ,    1     ,'wave_num',    .true.    , .false. ,   'daily'   , ''       , ''       )
+         cn_dir = './'          ! directory in which the wave data are 
          
 
@@ -69,18 +97,100 @@
          !
 
-         ALLOCATE( sf_wave(1), STAT=ierror )           !* allocate and fill sf_wave with sn_cdg
-         IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_wave: unable to allocate sf_wave structure' )
-         !
-         CALL fld_fill( sf_wave, (/ sn_cdg /), cn_dir_cdg, 'sbc_wave', 'Wave module ', 'namsbc_wave' )
-                                ALLOCATE( sf_wave(1)%fnow(jpi,jpj,1)   )
-         IF( sn_cdg%ln_tint )   ALLOCATE( sf_wave(1)%fdta(jpi,jpj,1,2) )
-         ALLOCATE( cdn_wave(jpi,jpj) )
-         cdn_wave(:,:) = 0.0
+         IF ( ln_cdgw ) THEN
+            ALLOCATE( sf_cd(1), STAT=ierror )           !* allocate and fill sf_wave with sn_cdg
+            IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_wave: unable to allocate sf_wave structure' )
+            !
+                                   ALLOCATE( sf_cd(1)%fnow(jpi,jpj,1)   )
+            IF( sn_cdg%ln_tint )   ALLOCATE( sf_cd(1)%fdta(jpi,jpj,1,2) )
+            CALL fld_fill( sf_cd, (/ sn_cdg /), cn_dir, 'sbc_wave', 'Wave module ', 'namsbc_wave' )
+            ALLOCATE( cdn_wave(jpi,jpj) )
+            cdn_wave(:,:) = 0.0
+        ENDIF
+         IF ( ln_sdw ) THEN
+            slf_i(jp_usd) = sn_usd ; slf_i(jp_vsd) = sn_vsd; slf_i(jp_wn) = sn_wn
+            ALLOCATE( sf_sd(3), STAT=ierror )           !* allocate and fill sf_wave with sn_cdg
+            IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_wave: unable to allocate sf_wave structure' )
+            !
+            DO ifpr= 1, jpfld
+               ALLOCATE( sf_sd(ifpr)%fnow(jpi,jpj,1) )
+               IF( slf_i(ifpr)%ln_tint )   ALLOCATE( sf_sd(ifpr)%fdta(jpi,jpj,1,2) )
+            END DO
+            CALL fld_fill( sf_sd, slf_i, cn_dir, 'sbc_wave', 'Wave module ', 'namsbc_wave' )
+            ALLOCATE( usd2d(jpi,jpj),vsd2d(jpi,jpj),uwavenum(jpi,jpj),vwavenum(jpi,jpj) )
+            ALLOCATE( usd3d(jpi,jpj,jpk),vsd3d(jpi,jpj,jpk),wsd3d(jpi,jpj,jpk) )
+            usd2d(:,:) = 0.0 ;  vsd2d(:,:) = 0.0 ; uwavenum(:,:) = 0.0 ; vwavenum(:,:) = 0.0
+            usd3d(:,:,:) = 0.0 ;vsd3d(:,:,:) = 0.0 ; wsd3d(:,:,:) = 0.0
+         ENDIF
       ENDIF
          !
          !
-      CALL fld_read( kt, nn_fsbc, sf_wave )      !* read drag coefficient from external forcing
-      cdn_wave(:,:) = sf_wave(1)%fnow(:,:,1)
+      IF ( ln_cdgw ) THEN
+         CALL fld_read( kt, nn_fsbc, sf_cd )      !* read drag coefficient from external forcing
+         cdn_wave(:,:) = sf_cd(1)%fnow(:,:,1)
+      ENDIF
+      IF ( ln_sdw )  THEN
+          CALL fld_read( kt, nn_fsbc, sf_sd )      !* read drag coefficient from external forcing
 
+         ! Interpolate wavenumber, stokes drift into the grid_V and grid_V
+         !-------------------------------------------------
+
+         DO jj = 1, jpjm1
+            DO ji = 1, jpim1
+               uwavenum(ji,jj)=0.5 * ( 2. - umask(ji,jj,1) ) * ( sf_sd(3)%fnow(ji,jj,1) * tmask(ji,jj,1) &
+               &                                + sf_sd(3)%fnow(ji+1,jj,1) * tmask(ji+1,jj,1) )
+
+               vwavenum(ji,jj)=0.5 * ( 2. - vmask(ji,jj,1) ) * ( sf_sd(3)%fnow(ji,jj,1) * tmask(ji,jj,1) &
+               &                                + sf_sd(3)%fnow(ji,jj+1,1) * tmask(ji,jj+1,1) )
+
+               usd2d(ji,jj) = 0.5 * ( 2. - umask(ji,jj,1) ) * ( sf_sd(1)%fnow(ji,jj,1) * tmask(ji,jj,1) &
+               &                                + sf_sd(1)%fnow(ji+1,jj,1) * tmask(ji+1,jj,1) )
+
+               vsd2d(ji,jj) = 0.5 * ( 2. - vmask(ji,jj,1) ) * ( sf_sd(2)%fnow(ji,jj,1) * tmask(ji,jj,1) &
+               &                                + sf_sd(2)%fnow(ji,jj+1,1) * tmask(ji,jj+1,1) )
+            END DO
+         END DO
+
+          !Computation of the 3d Stokes Drift
+          DO jk = 1, jpk
+             DO jj = 1, jpj-1
+                DO ji = 1, jpi-1
+                   usd3d(ji,jj,jk) = usd2d(ji,jj)*exp(2.0*uwavenum(ji,jj)*(-MIN( gdept(ji,jj,jk) , gdept(ji+1,jj  ,jk))))
+                   vsd3d(ji,jj,jk) = vsd2d(ji,jj)*exp(2.0*vwavenum(ji,jj)*(-MIN( gdept(ji,jj,jk) , gdept(ji  ,jj+1,jk))))
+                END DO
+             END DO
+             usd3d(jpi,:,jk) = usd2d(jpi,:)*exp( 2.0*uwavenum(jpi,:)*(-gdept(jpi,:,jk)) )
+             vsd3d(:,jpj,jk) = vsd2d(:,jpj)*exp( 2.0*vwavenum(:,jpj)*(-gdept(:,jpj,jk)) )
+          END DO
+
+          CALL wrk_alloc( jpi,jpj,jpk,udummy,vdummy,hdivdummy,rotdummy)
+          
+          udummy(:,:,:)=un(:,:,:)
+          vdummy(:,:,:)=vn(:,:,:)
+          hdivdummy(:,:,:)=hdivn(:,:,:)
+          rotdummy(:,:,:)=rotn(:,:,:)
+          un(:,:,:)=usd3d(:,:,:)
+          vn(:,:,:)=vsd3d(:,:,:)
+          CALL div_cur(kt)
+      !                                           !------------------------------!
+      !                                           !     Now Vertical Velocity    !
+      !                                           !------------------------------!
+          z2dt = 2._wp * rdt                              ! set time step size (Euler/Leapfrog)
+
+          z1_2dt = 1.e0 / z2dt
+          DO jk = jpkm1, 1, -1                             ! integrate from the bottom the hor. divergence
+             ! - ML - need 3 lines here because replacement of fse3t by its expression yields too long lines otherwise
+             wsd3d(:,:,jk) = wsd3d(:,:,jk+1) -   fse3t_n(:,:,jk) * hdivn(:,:,jk)        &
+                &                      - ( fse3t_a(:,:,jk) - fse3t_b(:,:,jk) )    &
+                &                         * tmask(:,:,jk) * z1_2dt
+#if defined key_bdy
+             wsd3d(:,:,jk) = wsd3d(:,:,jk) * bdytmask(:,:)
+#endif
+          END DO
+          hdivn(:,:,:)=hdivdummy(:,:,:)
+          rotn(:,:,:)=rotdummy(:,:,:)
+          vn(:,:,:)=vdummy(:,:,:)
+          un(:,:,:)=udummy(:,:,:)
+          CALL wrk_dealloc( jpi,jpj,jpk,udummy,vdummy,hdivdummy,rotdummy)
+      ENDIF
    END SUBROUTINE sbc_wave
       
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRA/traadv.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRA/traadv.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRA/traadv.F90	(revision 3680)
@@ -45,4 +45,5 @@
    LOGICAL ::   ln_traadv_qck    = .FALSE.   ! QUICKEST scheme flag
 
+
    INTEGER ::   nadv   ! choice of the type of advection scheme
 
@@ -152,5 +153,6 @@
       NAMELIST/namtra_adv/ ln_traadv_cen2 , ln_traadv_tvd,     &
          &                 ln_traadv_muscl, ln_traadv_muscl2,  &
-         &                 ln_traadv_ubs  , ln_traadv_qck
+         &                 ln_traadv_ubs  , ln_traadv_qck,     &
+         &                 ln_traadv_msc_ups
       !!----------------------------------------------------------------------
 
@@ -169,4 +171,5 @@
          WRITE(numout,*) '      UBS    advection scheme        ln_traadv_ubs    = ', ln_traadv_ubs
          WRITE(numout,*) '      QUICKEST advection scheme      ln_traadv_qck    = ', ln_traadv_qck
+         WRITE(numout,*) '      upstream scheme within muscl   ln_traadv_msc_ups= ', ln_traadv_msc_ups
       ENDIF
 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_cen2.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_cen2.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_cen2.F90	(revision 3680)
@@ -29,5 +29,4 @@
    USE diaptr          ! poleward transport diagnostics
    USE zdf_oce         ! ocean vertical physics
-   USE restart         ! ocean restart
    USE trc_oce         ! share passive tracers/Ocean variables
    USE lib_mpp         ! MPP library
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_muscl.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_muscl.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_muscl.F90	(revision 3680)
@@ -8,4 +8,5 @@
    !!   NEMO     1.0  !  2002-06  (G. Madec)  F90: Free form and module
    !!            3.2  !  2010-05  (C. Ethe, G. Madec)  merge TRC-TRA + switch from velocity to transport
+   !!            3.4  !  2012-06  (P. Oddo, M. Vichi) include the upstream where needed
    !!----------------------------------------------------------------------
 
@@ -28,4 +29,6 @@
    USE timing         ! Timing
    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
+   USE eosbn2          ! equation of state
+   USE sbcrnf          ! river runoffs
 
    IMPLICIT NONE
@@ -34,6 +37,10 @@
    PUBLIC   tra_adv_muscl  ! routine called by step.F90
 
-   LOGICAL  :: l_trd       ! flag to compute trends
-
+   LOGICAL  :: l_trd                        ! flag to compute trends
+   LOGICAL, PUBLIC  :: ln_traadv_msc_ups= .FALSE.   ! use upstream scheme within muscl
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: upsmsk !: mixed upstream/centered scheme near some straits
+   !                                                             !  and in closed seas (orca 2 and 4 configurations)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: zind         !: mixed upstream/centered index
    !! * Substitutions
 #  include "domzgr_substitute.h90"
@@ -79,4 +86,5 @@
       REAL(wp) ::   ztra, zbtr, zdt, zalpha   !   -      -
       REAL(wp), POINTER, DIMENSION(:,:,:) :: zslpx, zslpy
+      INTEGER  ::   ierr
       !!----------------------------------------------------------------------
       !
@@ -89,10 +97,44 @@
          IF(lwp) WRITE(numout,*)
          IF(lwp) WRITE(numout,*) 'tra_adv : MUSCL advection scheme on ', cdtype
+         IF(lwp) WRITE(numout,*) '        : xed up-stream            ' , ln_traadv_msc_ups
          IF(lwp) WRITE(numout,*) '~~~~~~~'
+         IF(lwp) WRITE(numout,*)
+         !
+         !
+         IF(ln_traadv_msc_ups) THEN
+           IF (.not. ALLOCATED(upsmsk))THEN
+               ALLOCATE( upsmsk(jpi,jpj), STAT=ierr )
+               IF( ierr /= 0 )   CALL ctl_stop('STOP', 'tra_adv_muscl: unable to allocate upsmsk array')
+           ENDIF
+           upsmsk(:,:) = 0._wp                             ! not upstream by default
+         ENDIF
+
+         IF (.not. ALLOCATED(zind))THEN
+             ALLOCATE( zind(jpi,jpj,jpk), STAT=ierr )
+             IF( ierr /= 0 )   CALL ctl_stop('STOP', 'tra_adv_muscl: unable to allocate zind array')
+         ENDIF
+         !
          !
          l_trd = .FALSE.
          IF( ( cdtype == 'TRA' .AND. l_trdtra ) .OR. ( cdtype == 'TRC' .AND. l_trdtrc ) ) l_trd = .TRUE.
-      ENDIF
-
+
+      !
+      ! Upstream / centered scheme indicator
+      ! ------------------------------------
+         zind(:,:,:) = 1._wp                             ! set equal to 0 where up-stream is needed
+
+         IF(ln_traadv_msc_ups) THEN
+           DO jk = 1, jpk
+              DO jj = 1, jpj
+                 DO ji = 1, jpi
+                    zind(ji,jj,jk) = 1  - MAX (           &
+                       rnfmsk(ji,jj) * rnfmsk_z(jk),      &  ! near runoff mouths (& closed sea outflows)
+                       upsmsk(ji,jj) ) * tmask(ji,jj,jk)     ! some of some straits
+                 END DO
+              END DO
+           END DO
+         ENDIF 
+      !
+      ENDIF ! end kit000
       !                                                     ! ===========
       DO jn = 1, kjpt                                       ! tracer loop
@@ -149,6 +191,6 @@
                   zalpha = 0.5 - z0u
                   zu  = z0u - 0.5 * pun(ji,jj,jk) * zdt / ( e1u(ji,jj) * e2u(ji,jj) * fse3u(ji,jj,jk) )
-                  zzwx = ptb(ji+1,jj,jk,jn) + zu * zslpx(ji+1,jj,jk)
-                  zzwy = ptb(ji  ,jj,jk,jn) + zu * zslpx(ji  ,jj,jk)
+                  zzwx = ptb(ji+1,jj,jk,jn) + zind(ji,jj,jk) * (zu * zslpx(ji+1,jj,jk))
+                  zzwy = ptb(ji  ,jj,jk,jn) + zind(ji,jj,jk) * (zu * zslpx(ji  ,jj,jk))
                   zwx(ji,jj,jk) = pun(ji,jj,jk) * ( zalpha * zzwx + (1.-zalpha) * zzwy )
                   !
@@ -156,6 +198,6 @@
                   zalpha = 0.5 - z0v
                   zv  = z0v - 0.5 * pvn(ji,jj,jk) * zdt / ( e1v(ji,jj) * e2v(ji,jj) * fse3v(ji,jj,jk) )
-                  zzwx = ptb(ji,jj+1,jk,jn) + zv * zslpy(ji,jj+1,jk)
-                  zzwy = ptb(ji,jj  ,jk,jn) + zv * zslpy(ji,jj  ,jk) 
+                  zzwx = ptb(ji,jj+1,jk,jn) + zind(ji,jj,jk) * (zv * zslpy(ji,jj+1,jk))
+                  zzwy = ptb(ji,jj  ,jk,jn) + zind(ji,jj,jk) * (zv * zslpy(ji,jj  ,jk))
                   zwy(ji,jj,jk) = pvn(ji,jj,jk) * ( zalpha * zzwx + (1.-zalpha) * zzwy )
                END DO
@@ -231,6 +273,6 @@
                   zalpha = 0.5 + z0w
                   zw  = z0w - 0.5 * pwn(ji,jj,jk+1) * zdt * zbtr 
-                  zzwx = ptb(ji,jj,jk+1,jn) + zw * zslpx(ji,jj,jk+1)
-                  zzwy = ptb(ji,jj,jk  ,jn) + zw * zslpx(ji,jj,jk  )
+                  zzwx = ptb(ji,jj,jk+1,jn) + zind(ji,jj,jk) * (zw * zslpx(ji,jj,jk+1))
+                  zzwy = ptb(ji,jj,jk  ,jn) + zind(ji,jj,jk) * (zw * zslpx(ji,jj,jk  ))
                   zwx(ji,jj,jk+1) = pwn(ji,jj,jk+1) * ( zalpha * zzwx + (1.-zalpha) * zzwy )
                END DO 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 3680)
@@ -27,5 +27,4 @@
    USE iom             ! I/O manager
    USE fldread         ! read input fields
-   USE restart         ! ocean restart
    USE lib_mpp         ! MPP library
    USE wrk_nemo       ! Memory Allocation
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90	(revision 3680)
@@ -23,5 +23,4 @@
    USE in_out_manager  ! I/O manager
    USE prtctl          ! Print control
-   USE restart         ! ocean restart
    USE sbcrnf          ! River runoff  
    USE sbcmod          ! ln_rnf  
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRD/trdmld.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRD/trdmld.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRD/trdmld.F90	(revision 3680)
@@ -36,5 +36,4 @@
    USE trdmld_rst      ! restart for diagnosing the ML trends
    USE prtctl          ! Print control
-   USE restart         ! for lrst_oce
    USE lib_mpp         ! MPP library
    USE wrk_nemo        ! Memory allocation
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRD/trdmld_rst.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRD/trdmld_rst.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/TRD/trdmld_rst.F90	(revision 3680)
@@ -12,5 +12,4 @@
    USE in_out_manager  ! I/O manager
    USE iom             ! I/O module
-   USE restart         ! only for lrst_oce
 
    IMPLICIT NONE
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfgls.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfgls.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfgls.F90	(revision 3680)
@@ -23,5 +23,4 @@
    USE phycst         ! physical constants
    USE zdfmxl         ! mixed layer
-   USE restart        ! only for lrst_oce
    USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
    USE lib_mpp        ! MPP manager
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfini.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfini.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfini.F90	(revision 3680)
@@ -26,5 +26,4 @@
    USE tranpc          ! convection: non penetrative adjustment
    USE ldfslp          ! iso-neutral slopes
-   USE restart         ! ocean restart
 
    USE in_out_manager  ! I/O manager
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90	(revision 3680)
@@ -44,5 +44,4 @@
    USE zdf_oce        ! vertical physics: ocean variables
    USE zdfmxl         ! vertical physics: mixed layer
-   USE restart        ! ocean restart
    USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
    USE prtctl         ! Print control
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/lib_cray.f90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/lib_cray.f90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/lib_cray.f90	(revision 3680)
@@ -10,4 +10,8 @@
 !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
 !!----------------------------------------------------------------------
+SUBROUTINE lib_cray
+      WRITE(*,*) 'lib_cray: You should not have seen this print! error?'
+END SUBROUTINE lib_cray
+
 SUBROUTINE wheneq ( i, x, j, t, ind, nn )
         IMPLICIT NONE
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 3680)
@@ -124,7 +124,11 @@
       !                            !-----------------------!
 #if defined key_agrif
-      CALL Agrif_Declare_Var       ! AGRIF: set the meshes
+      CALL Agrif_Declare_Var_dom   ! AGRIF: set the meshes for DOM
+      CALL Agrif_Declare_Var       !  "      "   "   "      "  DYN/TRA 
 # if defined key_top
-      CALL Agrif_Declare_Var_Top   ! AGRIF: set the meshes
+      CALL Agrif_Declare_Var_top   !  "      "   "   "      "  TOP
+# endif
+# if defined key_lim2
+      CALL Agrif_Declare_Var_lim2  !  "      "   "   "      "  LIM
 # endif
 #endif
@@ -525,4 +529,7 @@
       USE ldftra_oce, ONLY: ldftra_oce_alloc
       USE trc_oce   , ONLY: trc_oce_alloc
+#if defined key_diadct 
+      USE diadct    , ONLY: diadct_alloc 
+#endif 
       !
       INTEGER :: ierr
@@ -538,4 +545,8 @@
       ierr = ierr + lib_mpp_alloc   (numout)    ! mpp exchanges
       ierr = ierr + trc_oce_alloc   ()          ! shared TRC / TRA arrays
+      !
+#if defined key_diadct 
+      ierr = ierr + diadct_alloc    ()          ! 
+#endif 
       !
       IF( lk_mpp    )   CALL mpp_sum( ierr )
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/par_AMM_12km.h90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/par_AMM_12km.h90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/par_AMM_12km.h90	(revision 3680)
@@ -19,5 +19,5 @@
       jpidta  = 198,        &  !: first horizontal dimension > or = to jpi
       jpjdta  = 224,        &  !: second                     > or = to jpj
-      jpkdta  = 33,         &  !: number of levels           > or = to jpk
+      jpkdta  = 51,         &  !: number of levels           > or = to jpk
       ! total domain matrix size
       jpiglo  = jpidta,      &  !: first  dimension of global domain --> i
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/step.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 3680)
@@ -36,4 +36,5 @@
    USE agrif_opa_sponge ! Momemtum and tracers sponges
 #endif
+   USE restart          ! restart
 
    IMPLICIT NONE
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/step_oce.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/step_oce.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/step_oce.F90	(revision 3680)
@@ -100,5 +100,4 @@
 
    USE stpctl           ! time stepping control            (stp_ctl routine)
-   USE restart          ! ocean restart                    (rst_wri routine)
    USE prtctl           ! Print control                    (prt_ctl routine)
 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/C14b/par_c14b.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/C14b/par_c14b.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/C14b/par_c14b.F90	(revision 3680)
@@ -6,9 +6,4 @@
    !! History :   2.0  !  2008-12  (C. Ethe, G. Madec)  revised architecture
    !!----------------------------------------------------------------------
-   USE par_lobster, ONLY : jp_lobster      !: number of tracers in LOBSTER
-   USE par_lobster, ONLY : jp_lobster_2d   !: number of 2D diag in LOBSTER
-   USE par_lobster, ONLY : jp_lobster_3d   !: number of 3D diag in LOBSTER
-   USE par_lobster, ONLY : jp_lobster_trd  !: number of biological diag in LOBSTER
-
    USE par_pisces , ONLY : jp_pisces       !: number of tracers in PISCES
    USE par_pisces , ONLY : jp_pisces_2d    !: number of 2D diag in PISCES
@@ -24,8 +19,8 @@
    IMPLICIT NONE
 
-   INTEGER, PARAMETER ::   jp_lb      = jp_lobster     + jp_pisces     + jp_cfc     !: cum. number of pass. tracers
-   INTEGER, PARAMETER ::   jp_lb_2d   = jp_lobster_2d  + jp_pisces_2d  + jp_cfc_2d  !:
-   INTEGER, PARAMETER ::   jp_lb_3d   = jp_lobster_3d  + jp_pisces_3d  + jp_cfc_3d  !:
-   INTEGER, PARAMETER ::   jp_lb_trd  = jp_lobster_trd + jp_pisces_trd + jp_cfc_trd !:
+   INTEGER, PARAMETER ::   jp_lb      =  jp_pisces     + jp_cfc     !: cum. number of pass. tracers
+   INTEGER, PARAMETER ::   jp_lb_2d   =  jp_pisces_2d  + jp_cfc_2d  !:
+   INTEGER, PARAMETER ::   jp_lb_3d   =  jp_pisces_3d  + jp_cfc_3d  !:
+   INTEGER, PARAMETER ::   jp_lb_trd  =  jp_pisces_trd + jp_cfc_trd !:
    
 #if defined key_c14b
Index: anches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/C14b/trcrst_c14b.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/C14b/trcrst_c14b.F90	(revision 3679)
+++ 	(revision )
@@ -1,85 +1,0 @@
-MODULE trcrst_c14b
-   !!======================================================================
-   !!                       ***  MODULE trcrst_c14b  ***
-   !! TOP :   create, write, read the restart files of c14b tracer
-   !!======================================================================
-   !! History :   1.0  !  2010-01 (C. Ethe) Original
-   !!----------------------------------------------------------------------
-#if defined key_c14b
-   !!----------------------------------------------------------------------
-   !!   'key_c14b'                                               c14b tracers
-   !!----------------------------------------------------------------------
-   !!   trc_rst_read_c14b   : read  restart file
-   !!   trc_rst_wri_c14b    : write restart file
-   !!----------------------------------------------------------------------
-   USE oce_trc         ! Ocean variables
-   USE par_trc         ! TOP parameters
-   USE trc             ! TOP variables
-   USE trcsms_c14b          ! c14b sms trends
-   USE iom
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC  trc_rst_read_c14b   ! called by trcini.F90 module
-   PUBLIC  trc_rst_wri_c14b   ! called by trcini.F90 module
-
-CONTAINS
-   
-   SUBROUTINE trc_rst_read_c14b( knum ) 
-      !!----------------------------------------------------------------------
-      !!                     ***  trc_rst_read_c14b  ***  
-      !!
-      !! ** Purpose : Read in restart file specific variables from c14b model
-      !!
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in)  :: knum  ! unit of the restart file
-      INTEGER              :: jn    ! dummy loop indices
-      !!----------------------------------------------------------------------
-
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) ' trc_rst_read_c14b : Read specific variables from c14b model '
-      IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
-      
-      CALL iom_get( knum, jpdom_autoglo, 'qint_c14', qint_c14 ) 
-
-   END SUBROUTINE trc_rst_read_c14b
-
-   SUBROUTINE trc_rst_wri_c14b( kt, kitrst, knum )
-      !!----------------------------------------------------------------------
-      !!                     ***  trc_rst_read_c14b  ***
-      !!
-      !! ** Purpose : Read in restart file specific variables from c14b model
-      !!
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in)  :: kt      ! time step
-      INTEGER, INTENT(in)  :: kitrst  ! time step of restart write
-      INTEGER, INTENT(in)  :: knum    ! unit of the restart file
-      !!----------------------------------------------------------------------
-
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) ' trc_rst_wri_c14b : Write specific variables from c14b model '
-      IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
-
-      CALL iom_rstput( kt, kitrst, knum, 'qint_c14', qint_c14 )
-
-   END SUBROUTINE trc_rst_wri_c14b
-
-#else
-   !!----------------------------------------------------------------------
-   !!  Dummy module :                                     No passive tracer
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_rst_read_c14b( knum )
-     INTEGER, INTENT(in)  :: knum
-     WRITE(*,*) 'trc_rst_wri_c14b: You should not have seen this print! error?', knum
-   END SUBROUTINE trc_rst_read_c14b
-
-   SUBROUTINE trc_rst_wri_c14b( kt, kitrst, knum )
-     INTEGER, INTENT(in)  :: kt, kitrst, knum
-     WRITE(*,*) 'trc_rst_wri_c14b: You should not have seen this print! error?', kt, kitrst, knum
-   END SUBROUTINE trc_rst_wri_c14b
-#endif
-
-   !!======================================================================
-END MODULE trcrst_c14b
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90	(revision 3680)
@@ -125,4 +125,14 @@
          xdecay  = EXP( - xlambda * rdt )
          xaccum  = 1._wp -  xdecay
+         !
+         IF( ln_rsttr ) THEN
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) ' Read specific variables from C14b model '
+            IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
+            CALL iom_get( numrtr, jpdom_autoglo, 'qint_c14', qint_c14 )
+         ENDIF
+         !
+         IF(lwp) WRITE(numout,*)
+         !
       ENDIF
 
@@ -271,4 +281,13 @@
       END DO
 
+      !
+      IF( lrst_trc ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'trc_sms_c14b : cumulated input function fields written in ocean restart file ',   &
+            &                    'at it= ', kt,' date= ', ndastp
+         IF(lwp) WRITE(numout,*) '~~~~'
+         CALL iom_rstput( kt, nitrst, numrtw, 'qint_c14', qint_c14 )
+      ENDIF
+      !    
       IF( ln_diatrc ) THEN
          IF( lk_iomput ) THEN
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/C14b/trcwri_c14b.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/C14b/trcwri_c14b.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/C14b/trcwri_c14b.F90	(revision 3680)
@@ -0,0 +1,58 @@
+MODULE trcwri_c14b
+   !!======================================================================
+   !!                       *** MODULE trcwri ***
+   !!    c14b :   Output of c14b tracers
+   !!======================================================================
+   !! History :   1.0  !  2009-05 (C. Ethe)  Original code
+   !!----------------------------------------------------------------------
+#if defined key_top && key_c14b && defined key_iomput
+   !!----------------------------------------------------------------------
+   !!   'key_c14b'                                           c14b model
+   !!----------------------------------------------------------------------
+   !! trc_wri_c14b   :  outputs of concentration fields
+   !!----------------------------------------------------------------------
+   USE trc         ! passive tracers common variables 
+   USE iom         ! I/O manager
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC trc_wri_c14b 
+
+CONTAINS
+
+   SUBROUTINE trc_wri_c14b
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_wri_trc  ***
+      !!
+      !! ** Purpose :   output passive tracers fields 
+      !!---------------------------------------------------------------------
+      CHARACTER (len=20)   :: cltra
+      INTEGER              :: jn
+      !!---------------------------------------------------------------------
+ 
+      ! write the tracer concentrations in the file
+      ! ---------------------------------------
+      DO jn = jp_c14b0, jp_c14b1
+         cltra = TRIM( ctrcnm(jn) )                  ! short title for tracer
+         CALL iom_put( cltra, trn(:,:,:,jn) )
+      END DO
+      !
+   END SUBROUTINE trc_wri_c14b
+
+#else
+   !!----------------------------------------------------------------------
+   !!  Dummy module :                                     No passive tracer
+   !!----------------------------------------------------------------------
+   PUBLIC trc_wri_c14b
+CONTAINS
+   SUBROUTINE trc_wri_c14b                     ! Empty routine  
+   END SUBROUTINE trc_wri_c14b
+#endif
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: trcwri_c14b.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!======================================================================
+END MODULE trcwri_c14b
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/CFC/par_cfc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/CFC/par_cfc.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/CFC/par_cfc.F90	(revision 3680)
@@ -10,9 +10,4 @@
    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
-   USE par_lobster, ONLY : jp_lobster      !: number of tracers in LOBSTER
-   USE par_lobster, ONLY : jp_lobster_2d   !: number of 2D diag in LOBSTER
-   USE par_lobster, ONLY : jp_lobster_3d   !: number of 3D diag in LOBSTER
-   USE par_lobster, ONLY : jp_lobster_trd  !: number of biological diag in LOBSTER
-
    USE par_pisces , ONLY : jp_pisces       !: number of tracers in PISCES
    USE par_pisces , ONLY : jp_pisces_2d    !: number of 2D diag in PISCES
@@ -22,8 +17,8 @@
    IMPLICIT NONE
 
-   INTEGER, PARAMETER ::   jp_lc      = jp_lobster     + jp_pisces     !: cumulative number of passive tracers
-   INTEGER, PARAMETER ::   jp_lc_2d   = jp_lobster_2d  + jp_pisces_2d  !:
-   INTEGER, PARAMETER ::   jp_lc_3d   = jp_lobster_3d  + jp_pisces_3d  !:
-   INTEGER, PARAMETER ::   jp_lc_trd  = jp_lobster_trd + jp_pisces_trd !:
+   INTEGER, PARAMETER ::   jp_lc      =  jp_pisces     !: cumulative number of passive tracers
+   INTEGER, PARAMETER ::   jp_lc_2d   =  jp_pisces_2d  !:
+   INTEGER, PARAMETER ::   jp_lc_3d   =  jp_pisces_3d  !:
+   INTEGER, PARAMETER ::   jp_lc_trd  =  jp_pisces_trd !:
    
 #if defined key_cfc
Index: anches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/CFC/trcrst_cfc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/CFC/trcrst_cfc.F90	(revision 3679)
+++ 	(revision )
@@ -1,90 +1,0 @@
-MODULE trcrst_cfc
-   !!======================================================================
-   !!                       ***  MODULE trcrst_cfc  ***
-   !! TOP :   create, write, read the restart files of CFC tracer
-   !!======================================================================
-   !! History :   1.0  !  2010-01 (C. Ethe) Original
-   !!----------------------------------------------------------------------
-#if defined key_cfc
-   !!----------------------------------------------------------------------
-   !!   'key_cfc'                                               CFC tracers
-   !!----------------------------------------------------------------------
-   !!   trc_rst_read_cfc   : read  restart file
-   !!   trc_rst_wri_cfc    : write restart file
-   !!----------------------------------------------------------------------
-   USE oce_trc         ! Ocean variables
-   USE par_trc         ! TOP parameters
-   USE trc             ! TOP variables
-   USE trcsms_cfc          ! CFC sms trends
-   USE iom
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC  trc_rst_read_cfc   ! called by trcini.F90 module
-   PUBLIC  trc_rst_wri_cfc   ! called by trcini.F90 module
-
-CONTAINS
-   
-   SUBROUTINE trc_rst_read_cfc( knum ) 
-      !!----------------------------------------------------------------------
-      !!                     ***  trc_rst_read_cfc  ***  
-      !!
-      !! ** Purpose : Read in restart file specific variables from CFC model
-      !!
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in)  :: knum  ! unit of the restart file
-      INTEGER              :: jn    ! dummy loop indices
-      !!----------------------------------------------------------------------
-
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) ' trc_rst_read_cfc : Read specific variables from CFC model '
-      IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
-      
-      DO jn = jp_cfc0, jp_cfc1
-         CALL iom_get( knum, jpdom_autoglo, 'qint_'//ctrcnm(jn), qint_cfc(:,:,jn) ) 
-      END DO
-
-   END SUBROUTINE trc_rst_read_cfc
-
-   SUBROUTINE trc_rst_wri_cfc( kt, kitrst, knum )
-      !!----------------------------------------------------------------------
-      !!                     ***  trc_rst_read_cfc  ***
-      !!
-      !! ** Purpose : Read in restart file specific variables from CFC model
-      !!
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in)  :: kt      ! time step
-      INTEGER, INTENT(in)  :: kitrst  ! time step of restart write
-      INTEGER, INTENT(in)  :: knum    ! unit of the restart file
-      INTEGER              :: jn      ! dummy loop indices
-      !!----------------------------------------------------------------------
-
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) ' trc_rst_wri_cfc : Write specific variables from CFC model '
-      IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
-
-      DO jn = jp_cfc0, jp_cfc1
-         CALL iom_rstput( kt, kitrst, knum, 'qint_'//ctrcnm(jn), qint_cfc(:,:,jn) )
-      END DO
-
-   END SUBROUTINE trc_rst_wri_cfc
-
-#else
-   !!----------------------------------------------------------------------
-   !!  Dummy module :                                     No passive tracer
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_rst_read_cfc( knum )
-     INTEGER, INTENT(in)  :: knum
-     WRITE(*,*) 'trc_rst_wri_cfc: You should not have seen this print! error?', knum
-   END SUBROUTINE trc_rst_read_cfc
-
-   SUBROUTINE trc_rst_wri_cfc( kt, kitrst, knum )
-     INTEGER, INTENT(in)  :: kt, kitrst, knum
-     WRITE(*,*) 'trc_rst_wri_cfc: You should not have seen this print! error?', kt, kitrst, knum
-   END SUBROUTINE trc_rst_wri_cfc
-#endif
-
-   !!======================================================================
-END MODULE trcrst_cfc
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90	(revision 3680)
@@ -13,5 +13,5 @@
    !!----------------------------------------------------------------------
    !!   trc_sms_cfc  :  compute and add CFC suface forcing to CFC trends
-   !!   trc_cfc_cst  :  sets constants for CFC surface forcing computation
+   !!   cfc_init     :  sets constants for CFC surface forcing computation
    !!----------------------------------------------------------------------
    USE oce_trc       ! Ocean variables
@@ -99,5 +99,5 @@
       ENDIF
 
-      IF( kt == nittrc000 )   CALL trc_cfc_cst
+      IF( kt == nittrc000 )   CALL cfc_init
 
       ! Temporal interpolation
@@ -176,5 +176,15 @@
          !                                                  !----------------!
       END DO                                                !  end CFC loop  !
-      !                                                     !----------------!
+      !
+      IF( lrst_trc ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'trc_sms_cfc : cumulated input function fields written in ocean restart file ',   &
+            &                    'at it= ', kt,' date= ', ndastp
+         IF(lwp) WRITE(numout,*) '~~~~'
+         DO jn = jp_cfc0, jp_cfc1
+            CALL iom_rstput( kt, nitrst, numrtw, 'qint_'//ctrcnm(jn), qint_cfc(:,:,jn) )
+         END DO
+      ENDIF
+      !                                              
       IF( ln_diatrc ) THEN
         !
@@ -200,10 +210,11 @@
 
 
-   SUBROUTINE trc_cfc_cst
+   SUBROUTINE cfc_init
       !!---------------------------------------------------------------------
-      !!                     ***  trc_cfc_cst  ***  
+      !!                     ***  cfc_init  ***  
       !!
       !! ** Purpose : sets constants for CFC model
       !!---------------------------------------------------------------------
+      INTEGER :: jn
 
       ! coefficient for CFC11 
@@ -245,5 +256,16 @@
       sca(4,2) =  -0.067430
 
-   END SUBROUTINE trc_cfc_cst
+      IF( ln_rsttr ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) ' Read specific variables from CFC model '
+         IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
+         !
+         DO jn = jp_cfc0, jp_cfc1
+            CALL iom_get( numrtr, jpdom_autoglo, 'qint_'//ctrcnm(jn), qint_cfc(:,:,jn) ) 
+         END DO
+      ENDIF
+      IF(lwp) WRITE(numout,*)
+      !
+   END SUBROUTINE cfc_init
 
 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/CFC/trcwri_cfc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/CFC/trcwri_cfc.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/CFC/trcwri_cfc.F90	(revision 3680)
@@ -0,0 +1,58 @@
+MODULE trcwri_cfc
+   !!======================================================================
+   !!                       *** MODULE trcwri ***
+   !!    cfc :   Output of cfc tracers
+   !!======================================================================
+   !! History :   1.0  !  2009-05 (C. Ethe)  Original code
+   !!----------------------------------------------------------------------
+#if defined key_top && key_cfc && defined key_iomput
+   !!----------------------------------------------------------------------
+   !!   'key_cfc'                                           cfc model
+   !!----------------------------------------------------------------------
+   !! trc_wri_cfc   :  outputs of concentration fields
+   !!----------------------------------------------------------------------
+   USE trc         ! passive tracers common variables 
+   USE iom         ! I/O manager
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC trc_wri_cfc 
+
+CONTAINS
+
+   SUBROUTINE trc_wri_cfc
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_wri_trc  ***
+      !!
+      !! ** Purpose :   output passive tracers fields 
+      !!---------------------------------------------------------------------
+      CHARACTER (len=20)   :: cltra
+      INTEGER              :: jn
+      !!---------------------------------------------------------------------
+ 
+      ! write the tracer concentrations in the file
+      ! ---------------------------------------
+      DO jn = jp_cfc0, jp_cfc1
+         cltra = TRIM( ctrcnm(jn) )                  ! short title for tracer
+         CALL iom_put( cltra, trn(:,:,:,jn) )
+      END DO
+      !
+   END SUBROUTINE trc_wri_cfc
+
+#else
+   !!----------------------------------------------------------------------
+   !!  Dummy module :                                     No passive tracer
+   !!----------------------------------------------------------------------
+   PUBLIC trc_wri_cfc
+CONTAINS
+   SUBROUTINE trc_wri_cfc                     ! Empty routine  
+   END SUBROUTINE trc_wri_cfc
+#endif
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: trcwri_cfc.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!======================================================================
+END MODULE trcwri_cfc
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/MY_TRC/par_my_trc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/MY_TRC/par_my_trc.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/MY_TRC/par_my_trc.F90	(revision 3680)
@@ -10,9 +10,4 @@
    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
-   USE par_lobster, ONLY : jp_lobster      !: number of tracers in LOBSTER
-   USE par_lobster, ONLY : jp_lobster_2d   !: number of 2D diag in LOBSTER
-   USE par_lobster, ONLY : jp_lobster_3d   !: number of 3D diag in LOBSTER
-   USE par_lobster, ONLY : jp_lobster_trd  !: number of biological diag in LOBSTER
-
    USE par_pisces , ONLY : jp_pisces       !: number of tracers in PISCES
    USE par_pisces , ONLY : jp_pisces_2d    !: number of 2D diag in PISCES
@@ -32,8 +27,8 @@
    IMPLICIT NONE
 
-   INTEGER, PARAMETER ::   jp_lm      = jp_lobster     + jp_pisces     + jp_cfc     + jp_c14b     !: 
-   INTEGER, PARAMETER ::   jp_lm_2d   = jp_lobster_2d  + jp_pisces_2d  + jp_cfc_2d  + jp_c14b_2d  !:
-   INTEGER, PARAMETER ::   jp_lm_3d   = jp_lobster_3d  + jp_pisces_3d  + jp_cfc_3d  + jp_c14b_3d  !:
-   INTEGER, PARAMETER ::   jp_lm_trd  = jp_lobster_trd + jp_pisces_trd + jp_cfc_trd + jp_c14b_trd !:
+   INTEGER, PARAMETER ::   jp_lm      =  jp_pisces     + jp_cfc     + jp_c14b     !: 
+   INTEGER, PARAMETER ::   jp_lm_2d   =  jp_pisces_2d  + jp_cfc_2d  + jp_c14b_2d  !:
+   INTEGER, PARAMETER ::   jp_lm_3d   =  jp_pisces_3d  + jp_cfc_3d  + jp_c14b_3d  !:
+   INTEGER, PARAMETER ::   jp_lm_trd  =  jp_pisces_trd + jp_cfc_trd + jp_c14b_trd !:
 
 #if defined key_my_trc
@@ -42,5 +37,5 @@
    !!---------------------------------------------------------------------
    LOGICAL, PUBLIC, PARAMETER ::   lk_my_trc     = .TRUE.   !: PTS flag 
-   INTEGER, PUBLIC, PARAMETER ::   jp_my_trc     =  2       !: number of PTS tracers
+   INTEGER, PUBLIC, PARAMETER ::   jp_my_trc     =  1       !: number of PTS tracers
    INTEGER, PUBLIC, PARAMETER ::   jp_my_trc_2d  =  0       !: additional 2d output arrays ('key_trc_diaadd')
    INTEGER, PUBLIC, PARAMETER ::   jp_my_trc_3d  =  0       !: additional 3d output arrays ('key_trc_diaadd')
@@ -49,5 +44,4 @@
    ! assign an index in trc arrays for each PTS prognostic variables
    INTEGER, PUBLIC, PARAMETER ::   jpmyt1 = jp_lm + 1     !: 1st MY_TRC tracer
-   INTEGER, PUBLIC, PARAMETER ::   jpmyt2 = jp_lm + 2     !: 2nd MY_TRC tracer
 
 #else
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcnam_my_trc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcnam_my_trc.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcnam_my_trc.F90	(revision 3680)
@@ -2,5 +2,5 @@
    !!======================================================================
    !!                      ***  MODULE trcnam_my_trc  ***
-   !! TOP :   initialisation of some run parameters for LOBSTER bio-model
+   !! TOP :   initialisation of some run parameters for MY_TRC bio-model
    !!======================================================================
    !! History :   2.0  !  2007-12  (C. Ethe, G. Madec) Original code
Index: anches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcrst_my_trc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcrst_my_trc.F90	(revision 3679)
+++ 	(revision )
@@ -1,51 +1,0 @@
-MODULE trcrst_my_trc
-   !!======================================================================
-   !!                       ***  MODULE trcrst_my_trc  ***
-   !! TOP :   create, write, read the restart files of MY_TRC tracer
-   !!======================================================================
-   !! History :   1.0  !  2010-01 (C. Ethe)  Original
-   !!----------------------------------------------------------------------
-#if defined key_my_trc
-   !!----------------------------------------------------------------------
-   !!   'key_my_trc'                                               CFC tracers
-   !!----------------------------------------------------------------------
-   !!   trc_rst_read_my_trc   : read  restart file
-   !!   trc_rst_wri_my_trc    : write restart file
-   !!----------------------------------------------------------------------
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC  trc_rst_read_my_trc   ! called by trcini.F90 module
-   PUBLIC  trc_rst_wri_my_trc   ! called by trcini.F90 module
-
-CONTAINS
-   
-   SUBROUTINE trc_rst_read_my_trc( knum ) 
-     INTEGER, INTENT(in)  :: knum
-     WRITE(*,*) 'trc_rst_read_my_trc: No specific variables to read on unit', knum
-   END SUBROUTINE trc_rst_read_my_trc
-
-   SUBROUTINE trc_rst_wri_my_trc( kt, kirst, knum )
-     INTEGER, INTENT(in)  :: kt, kirst, knum
-     WRITE(*,*) 'trc_rst_wri_my_trc: No specific variables to write on unit' ,knum, ' at time ', kt, kirst
-   END SUBROUTINE trc_rst_wri_my_trc
-
-#else
-   !!----------------------------------------------------------------------
-   !!  Dummy module :                                     No passive tracer
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_rst_read_my_trc( knum )
-     INTEGER, INTENT(in)  :: knum
-     WRITE(*,*) 'trc_rst_read_my_trc: You should not have seen this print! error?', knum
-   END SUBROUTINE trc_rst_read_my_trc
-
-   SUBROUTINE trc_rst_wri_my_trc( kt, kirst, knum )
-     INTEGER, INTENT(in)  :: kt, kirst, knum
-     WRITE(*,*) 'trc_rst_wri_my_trc: You should not have seen this print! error?', kt, kirst, knum
-   END SUBROUTINE trc_rst_wri_my_trc
-#endif
-
-   !!======================================================================
-END MODULE trcrst_my_trc
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcsms_my_trc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcsms_my_trc.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcsms_my_trc.F90	(revision 3680)
@@ -62,10 +62,4 @@
       END WHERE
 
-      WHERE( ((glamt <= -165) .OR. (glamt >= 160)) .AND. (gphit <= -76) .AND. (gphit >=-80))
-        trn(:,:,1,jpmyt2) = 1._wp
-        trb(:,:,1,jpmyt2) = 1._wp
-        tra(:,:,1,jpmyt2) = 0._wp
-      END WHERE
-
       IF( l_trdtrc ) THEN      ! Save the trends in the ixed layer
           DO jn = jp_myt0, jp_myt1
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcwri_my_trc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcwri_my_trc.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcwri_my_trc.F90	(revision 3680)
@@ -0,0 +1,58 @@
+MODULE trcwri_my_trc
+   !!======================================================================
+   !!                       *** MODULE trcwri ***
+   !!    my_trc :   Output of my_trc tracers
+   !!======================================================================
+   !! History :   1.0  !  2009-05 (C. Ethe)  Original code
+   !!----------------------------------------------------------------------
+#if defined key_top && key_my_trc && defined key_iomput
+   !!----------------------------------------------------------------------
+   !!   'key_my_trc'                                           my_trc model
+   !!----------------------------------------------------------------------
+   !! trc_wri_my_trc   :  outputs of concentration fields
+   !!----------------------------------------------------------------------
+   USE trc         ! passive tracers common variables 
+   USE iom         ! I/O manager
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC trc_wri_my_trc 
+
+CONTAINS
+
+   SUBROUTINE trc_wri_my_trc
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_wri_trc  ***
+      !!
+      !! ** Purpose :   output passive tracers fields 
+      !!---------------------------------------------------------------------
+      CHARACTER (len=20)   :: cltra
+      INTEGER              :: jn
+      !!---------------------------------------------------------------------
+ 
+      ! write the tracer concentrations in the file
+      ! ---------------------------------------
+      DO jn = jp_myt0, jp_myt1
+         cltra = TRIM( ctrcnm(jn) )                  ! short title for tracer
+         CALL iom_put( cltra, trn(:,:,:,jn) )
+      END DO
+      !
+   END SUBROUTINE trc_wri_my_trc
+
+#else
+   !!----------------------------------------------------------------------
+   !!  Dummy module :                                     No passive tracer
+   !!----------------------------------------------------------------------
+   PUBLIC trc_wri_my_trc
+CONTAINS
+   SUBROUTINE trc_wri_my_trc                     ! Empty routine  
+   END SUBROUTINE trc_wri_my_trc
+#endif
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: trcwri_my_trc.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!======================================================================
+END MODULE trcwri_my_trc
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zbio.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zbio.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zbio.F90	(revision 3680)
@@ -0,0 +1,568 @@
+MODULE p2zbio
+   !!======================================================================
+   !!                         ***  MODULE p2zbio  ***
+   !! TOP :   LOBSTER
+   !!======================================================================
+   !! History :    -   !  1999-07  (M. Levy) Original code
+   !!              -   !  2000-12  (E. Kestenare) assign a parameter to name individual tracers
+   !!              -   !  2001-03  (M. Levy)  LNO3 + dia2d 
+   !!             2.0  !  2007-12  (C. Deltel, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces_reduced
+   !!----------------------------------------------------------------------
+   !!   'key_pisces_reduced'                                     LOBSTER bio-model
+   !!----------------------------------------------------------------------
+   !!   p2z_bio        :  
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trc             ! 
+   USE sms_pisces
+   USE p2zopt
+   USE lbclnk          ! 
+   USE prtctl_trc      ! Print control for debbuging
+   USE trdmod_oce
+   USE trdmod_trc
+   USE iom
+   
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p2z_bio         ! called in ???
+   PUBLIC   p2z_bio_init    ! called in ???
+
+   REAL(wp) ::   tmumax     = 1.21e-5    ! maximal phytoplankton growth rate            [s-1]
+   REAL(wp) ::   rgamma     =  0.05      ! phytoplankton exudation fraction             [%]
+   REAL(wp) ::   fphylab    =  0.75      ! NH4 fraction of phytoplankton exsudation
+   REAL(wp) ::   tmminp     =  5.8e-7    ! minimal phytoplancton mortality rate         [0.05/86400 s-1=20 days]
+   REAL(wp) ::   aki        =  33.       ! light photosynthesis half saturation constant[W/m2]
+   !
+   REAL(wp) ::   akno3      =  0.7       ! nitrate limitation half-saturation value     [mmol/m3]
+   REAL(wp) ::   aknh4      =  0.001     ! ammonium limitation half-saturation value    [mmol/m3]
+   REAL(wp) ::   taunn      =  5.80e-7   ! nitrification rate                           [s-1]
+   REAL(wp) ::   psinut     =  3.        ! inhibition of nitrate uptake by ammonium
+   !
+   REAL(wp) ::   taudn      = 5.80e-7    ! detritus breakdown rate                        [0.1/86400 s-1=10 days]
+   REAL(wp) ::   fdetlab    = 0.         ! NH4 fraction of detritus dissolution
+   !
+   REAL(wp) ::   taudomn    = 6.43e-8    ! DOM breakdown rate                             [s-1]
+   !                                     ! slow remineralization rate of semi-labile dom to nh4 (1 month)
+   !
+   REAL(wp) ::   rppz       = 0.         ! ivlev coeff for zoo mortality
+   REAL(wp) ::   taus       = 9.26E-6    ! specific zooplankton maximal grazing rate              [s-1]
+   !                                     ! 0.75/86400 s-1=8.680555E-6    1/86400 = 1.15e-5
+   REAL(wp) ::   aks        = 1.         ! half-saturation constant for total zooplankton grazing [mmolN.m-3]
+   REAL(wp) ::   rpnaz      = 0.3        ! non-assimilated phytoplankton by zooplancton           [%]
+   REAL(wp) ::   rdnaz      = 0.3        ! non-assimilated detritus by zooplankton                [%]
+   REAL(wp) ::   tauzn      = 8.1e-7     ! zooplancton specific excretion rate                    [0.1/86400 s-1=10 days]
+   REAL(wp) ::   tmminz     = 2.31e-6    ! minimal zooplankton mortality rate                     [(mmolN/m3)-1 d-1]
+   REAL(wp) ::   fzoolab    = 0.5        ! NH4 fraction of zooplankton excretion
+   REAL(wp) ::   fdbod      = 0.5        ! zooplankton mortality fraction that goes to detritus
+
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p2zbio.F90 3294 2012-01-28 16:44:18Z rblod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p2z_bio( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p2z_bio  ***
+      !!
+      !! ** Purpose :   compute the now trend due to biogeochemical processes
+      !!              and add it to the general trend of passive tracers equations
+      !!
+      !! ** Method  :   each now biological flux is calculated in function of now
+      !!              concentrations of tracers.
+      !!              depending on the tracer, these fluxes are sources or sinks.
+      !!              the total of the sources and sinks for each tracer
+      !!              is added to the general trend.
+      !!        
+      !!                      tra = tra + zf...tra - zftra...
+      !!                                     |         |
+      !!                                     |         |
+      !!                                  source      sink
+      !!        
+      !!              IF 'key_diabio' defined , the biogeochemical trends
+      !!              for passive tracers are saved for futher diagnostics.
+      !!---------------------------------------------------------------------
+      !!
+      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
+      !!
+      INTEGER  ::   ji, jj, jk, jl
+      REAL(wp) ::   zdet, zzoo, zphy, zno3, znh4, zdom      ! now concentrations
+      REAL(wp) ::   zlno3, zlnh4, zle, zlt                  ! limitation terms for phyto
+      REAL(wp) ::   zno3phy, znh4phy, zphynh4, zphydom
+      REAL(wp) ::   zphydet, zphyzoo, zdetzoo
+      REAL(wp) ::   zzoonh4, zzoodom, zzoodet, zdetnh4, zdetdom
+      REAL(wp) ::   znh4no3, zdomnh4, zppz, zpdz, zpppz, zppdz, zfood
+      REAL(wp) ::   zfilpz, zfildz, zphya, zzooa, zno3a
+      REAL(wp) ::   znh4a, zdeta, zdoma, zzoobod, zboddet, zdomaju
+      REAL(wp) ::   ze3t
+      REAL(wp), POINTER,   DIMENSION(:,:,:) :: zw2d
+      REAL(wp), POINTER, DIMENSION(:,:,:,:) :: zw3d
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p2z_bio')
+      !
+      IF( ln_diatrc ) THEN
+         CALL wrk_alloc( jpi, jpj,     17, zw2d )
+         CALL wrk_alloc( jpi, jpj, jpk, 3, zw3d )
+      ENDIF
+
+      IF( kt == nittrc000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) ' p2z_bio: LOBSTER bio-model'
+         IF(lwp) WRITE(numout,*) ' ~~~~~~~'
+      ENDIF
+
+      xksi(:,:) = 0.e0        ! zooplakton closure ( fbod)
+      IF( ln_diatrc ) THEN
+         zw2d  (:,:,:) = 0.e0
+         zw3d(:,:,:,:) = 0.e0
+      ENDIF
+
+      !                                      ! -------------------------- !
+      DO jk = 1, jpkbm1                      !  Upper ocean (bio-layers)  !
+         !                                   ! -------------------------- !
+         DO jj = 2, jpjm1
+            DO ji = fs_2, fs_jpim1 
+               ! trophic variables( det, zoo, phy, no3, nh4, dom)
+               ! ------------------------------------------------
+
+               ! negative trophic variables DO not contribute to the fluxes
+               zdet = MAX( 0.e0, trn(ji,jj,jk,jpdet) )
+               zzoo = MAX( 0.e0, trn(ji,jj,jk,jpzoo) )
+               zphy = MAX( 0.e0, trn(ji,jj,jk,jpphy) )
+               zno3 = MAX( 0.e0, trn(ji,jj,jk,jpno3) )
+               znh4 = MAX( 0.e0, trn(ji,jj,jk,jpnh4) )
+               zdom = MAX( 0.e0, trn(ji,jj,jk,jpdom) )
+
+               ! Limitations
+               zlt   = 1.
+               zle   = 1. - EXP( -etot(ji,jj,jk) / aki / zlt )
+               ! psinut,akno3,aknh4 added by asklod AS Kremeur 2005-03
+               zlno3 = zno3 * EXP( -psinut * znh4 ) / ( akno3 + zno3 )
+               zlnh4 = znh4 / (znh4+aknh4)  
+
+               ! sinks and sources
+               !    phytoplankton production and exsudation
+               zno3phy = tmumax * zle * zlt * zlno3 * zphy
+               znh4phy = tmumax * zle * zlt * zlnh4 * zphy
+
+               !    fphylab added by asklod AS Kremeur 2005-03
+               zphydom = rgamma * (1 - fphylab) * (zno3phy + znh4phy)
+               zphynh4 = rgamma * fphylab * (zno3phy + znh4phy)
+               ! zooplankton production
+               !    preferences
+               zppz = rppz
+               zpdz = 1. - rppz
+               zpppz = ( zppz * zphy ) / ( ( zppz * zphy + zpdz * zdet ) + 1.e-13 )
+               zppdz = ( zpdz * zdet ) / ( ( zppz * zphy + zpdz * zdet ) + 1.e-13 )
+               zfood = zpppz * zphy + zppdz * zdet
+               !    filtration 
+               zfilpz = taus * zpppz / (aks + zfood)
+               zfildz = taus * zppdz / (aks + zfood)
+               !    grazing
+               zphyzoo = zfilpz * zphy * zzoo
+               zdetzoo = zfildz * zdet * zzoo
+
+               ! fecal pellets production
+               zzoodet = rpnaz * zphyzoo + rdnaz * zdetzoo
+
+               ! zooplankton liquide excretion
+               zzoonh4 = tauzn * fzoolab * zzoo  
+               zzoodom = tauzn * (1 - fzoolab) * zzoo
+
+               ! mortality
+               !    phytoplankton mortality
+               zphydet = tmminp * zphy
+
+               !    zooplankton mortality
+               !    closure : flux grazing is redistributed below level jpkbio
+               zzoobod = tmminz * zzoo * zzoo
+               xksi(ji,jj) = xksi(ji,jj) + (1-fdbod) * zzoobod * fse3t(ji,jj,jk)
+               zboddet = fdbod * zzoobod
+
+               ! detritus and dom breakdown
+               zdetnh4 = taudn * fdetlab * zdet
+               zdetdom = taudn * (1 - fdetlab) * zdet
+
+               zdomnh4 = taudomn * zdom
+
+               ! flux added to express how the excess of nitrogen from 
+               ! PHY, ZOO and DET to DOM goes directly to NH4 (flux of ajustment)
+               zdomaju = (1 - redf/reddom) * (zphydom + zzoodom + zdetdom)
+
+               ! Nitrification 
+               znh4no3 = taunn * znh4
+
+               ! determination of trends
+               !    total trend for each biological tracer
+               zphya =   zno3phy + znh4phy - zphynh4 - zphydom - zphyzoo - zphydet
+               zzooa =   zphyzoo + zdetzoo - zzoodet - zzoodom - zzoonh4 - zzoobod
+               zno3a = - zno3phy + znh4no3
+               znh4a = - znh4phy - znh4no3 + zphynh4 + zzoonh4 + zdomnh4 + zdetnh4 + zdomaju
+               zdeta =   zphydet + zzoodet - zdetzoo - zdetnh4 - zdetdom + zboddet
+               zdoma =   zphydom + zzoodom + zdetdom - zdomnh4 - zdomaju
+
+               ! tracer flux at totox-point added to the general trend
+               tra(ji,jj,jk,jpdet) = tra(ji,jj,jk,jpdet) + zdeta
+               tra(ji,jj,jk,jpzoo) = tra(ji,jj,jk,jpzoo) + zzooa
+               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) + zphya
+               tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) + zno3a
+               tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) + znh4a
+               tra(ji,jj,jk,jpdom) = tra(ji,jj,jk,jpdom) + zdoma
+
+
+               IF( ( ln_diabio .AND. .NOT. lk_iomput ) .OR. l_trdtrc ) THEN
+                  trbio(ji,jj,jk,jp_pcs0_trd     ) = zno3phy
+                  trbio(ji,jj,jk,jp_pcs0_trd +  1) = znh4phy
+                  trbio(ji,jj,jk,jp_pcs0_trd +  2) = zphynh4
+                  trbio(ji,jj,jk,jp_pcs0_trd +  3) = zphydom
+                  trbio(ji,jj,jk,jp_pcs0_trd +  4) = zphyzoo
+                  trbio(ji,jj,jk,jp_pcs0_trd +  5) = zphydet
+                  trbio(ji,jj,jk,jp_pcs0_trd +  6) = zdetzoo
+                  !  trend number 8 in p2zsed
+                  trbio(ji,jj,jk,jp_pcs0_trd +  8) = zzoodet
+                  trbio(ji,jj,jk,jp_pcs0_trd +  9) = zzoobod
+                  trbio(ji,jj,jk,jp_pcs0_trd + 10) = zzoonh4
+                  trbio(ji,jj,jk,jp_pcs0_trd + 11) = zzoodom
+                  trbio(ji,jj,jk,jp_pcs0_trd + 12) = znh4no3
+                  trbio(ji,jj,jk,jp_pcs0_trd + 13) = zdomnh4
+                  trbio(ji,jj,jk,jp_pcs0_trd + 14) = zdetnh4
+                  trbio(ji,jj,jk,jp_pcs0_trd + 15) = zdetdom
+                  !  trend number 17 in p2zexp
+                ENDIF
+                IF( ln_diatrc ) THEN
+                  ! convert fluxes in per day
+                  ze3t = fse3t(ji,jj,jk) * 86400.
+                  zw2d(ji,jj,1)  = zw2d(ji,jj,1)  + zno3phy * ze3t
+                  zw2d(ji,jj,2)  = zw2d(ji,jj,2)  + znh4phy * ze3t
+                  zw2d(ji,jj,3)  = zw2d(ji,jj,3)  + zphydom * ze3t
+                  zw2d(ji,jj,4)  = zw2d(ji,jj,4)  + zphynh4 * ze3t
+                  zw2d(ji,jj,5)  = zw2d(ji,jj,5)  + zphyzoo * ze3t
+                  zw2d(ji,jj,6)  = zw2d(ji,jj,6)  + zphydet * ze3t
+                  zw2d(ji,jj,7)  = zw2d(ji,jj,7)  + zdetzoo * ze3t
+                  zw2d(ji,jj,8)  = zw2d(ji,jj,8)  + zzoodet * ze3t
+                  zw2d(ji,jj,9)  = zw2d(ji,jj,9)  + zzoobod * ze3t
+                  zw2d(ji,jj,10) = zw2d(ji,jj,10) + zzoonh4 * ze3t
+                  zw2d(ji,jj,11) = zw2d(ji,jj,11) + zzoodom * ze3t
+                  zw2d(ji,jj,12) = zw2d(ji,jj,12) + znh4no3 * ze3t
+                  zw2d(ji,jj,13) = zw2d(ji,jj,13) + zdomnh4 * ze3t
+                  zw2d(ji,jj,14) = zw2d(ji,jj,14) + zdetnh4 * ze3t
+                  zw2d(ji,jj,15) = zw2d(ji,jj,15) + ( zno3phy + znh4phy - zphynh4 - zphydom - zphyzoo - zphydet ) * ze3t
+                  zw2d(ji,jj,16) = zw2d(ji,jj,16) + ( zphyzoo + zdetzoo - zzoodet - zzoobod - zzoonh4 - zzoodom ) * ze3t
+                  zw2d(ji,jj,17) = zw2d(ji,jj,17) + zdetdom * ze3t
+                  !   
+                  zw3d(ji,jj,jk,1) = zno3phy * 86400
+                  zw3d(ji,jj,jk,2) = znh4phy * 86400     
+                  zw3d(ji,jj,jk,3) = znh4no3 * 86400   
+                   ! 
+                ENDIF
+            END DO
+         END DO
+      END DO
+
+      !                                      ! -------------------------- !
+      DO jk = jpkb, jpkm1                    !  Upper ocean (bio-layers)  !
+         !                                   ! -------------------------- !
+         DO jj = 2, jpjm1
+            DO ji = fs_2, fs_jpim1 
+               ! remineralisation of all quantities towards nitrate 
+
+               !    trophic variables( det, zoo, phy, no3, nh4, dom)
+               !       negative trophic variables DO not contribute to the fluxes
+               zdet = MAX( 0.e0, trn(ji,jj,jk,jpdet) )
+               zzoo = MAX( 0.e0, trn(ji,jj,jk,jpzoo) )
+               zphy = MAX( 0.e0, trn(ji,jj,jk,jpphy) )
+               zno3 = MAX( 0.e0, trn(ji,jj,jk,jpno3) )
+               znh4 = MAX( 0.e0, trn(ji,jj,jk,jpnh4) )
+               zdom = MAX( 0.e0, trn(ji,jj,jk,jpdom) )
+
+               !    Limitations
+               zlt   = 0.e0
+               zle   = 0.e0
+               zlno3 = 0.e0
+               zlnh4 = 0.e0
+
+               !    sinks and sources
+               !       phytoplankton production and exsudation
+               zno3phy = 0.e0
+               znh4phy = 0.e0
+               zphydom = 0.e0
+               zphynh4 = 0.e0
+
+               !    zooplankton production
+               zphyzoo = 0.e0      ! grazing
+               zdetzoo = 0.e0
+
+               zzoodet = 0.e0      ! fecal pellets production
+
+               zzoonh4 = tauzn * fzoolab * zzoo         ! zooplankton liquide excretion
+               zzoodom = tauzn * (1 - fzoolab) * zzoo
+
+               !    mortality
+               zphydet = tmminp * zphy      ! phytoplankton mortality
+
+               zzoobod = 0.e0               ! zooplankton mortality
+               zboddet = 0.e0               ! closure : flux fbod is redistributed below level jpkbio
+
+               !    detritus and dom breakdown
+               zdetnh4 = taudn * fdetlab * zdet
+               zdetdom = taudn * (1 - fdetlab) * zdet
+
+               zdomnh4 = taudomn * zdom
+               zdomaju = (1 - redf/reddom) * (zphydom + zzoodom + zdetdom)
+
+               !    Nitrification
+               znh4no3 = taunn * znh4
+
+
+               ! determination of trends
+               !     total trend for each biological tracer
+               zphya =   zno3phy + znh4phy - zphynh4 - zphydom - zphyzoo - zphydet
+               zzooa =   zphyzoo + zdetzoo - zzoodet - zzoodom - zzoonh4 - zzoobod
+               zno3a = - zno3phy + znh4no3 
+               znh4a = - znh4phy - znh4no3 + zphynh4 + zzoonh4 + zdomnh4 + zdetnh4 + zdomaju
+               zdeta = zphydet + zzoodet  - zdetzoo - zdetnh4 - zdetdom + zboddet
+               zdoma = zphydom + zzoodom + zdetdom - zdomnh4 - zdomaju
+
+               ! tracer flux at totox-point added to the general trend
+               tra(ji,jj,jk,jpdet) = tra(ji,jj,jk,jpdet) + zdeta
+               tra(ji,jj,jk,jpzoo) = tra(ji,jj,jk,jpzoo) + zzooa
+               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) + zphya
+               tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) + zno3a
+               tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) + znh4a
+               tra(ji,jj,jk,jpdom) = tra(ji,jj,jk,jpdom) + zdoma
+               !
+               IF( ( ln_diabio .AND. .NOT. lk_iomput ) .OR. l_trdtrc ) THEN
+                  trbio(ji,jj,jk,jp_pcs0_trd     ) = zno3phy
+                  trbio(ji,jj,jk,jp_pcs0_trd +  1) = znh4phy
+                  trbio(ji,jj,jk,jp_pcs0_trd +  2) = zphynh4
+                  trbio(ji,jj,jk,jp_pcs0_trd +  3) = zphydom
+                  trbio(ji,jj,jk,jp_pcs0_trd +  4) = zphyzoo
+                  trbio(ji,jj,jk,jp_pcs0_trd +  5) = zphydet
+                  trbio(ji,jj,jk,jp_pcs0_trd +  6) = zdetzoo
+                  !  trend number 8 in p2zsed
+                  trbio(ji,jj,jk,jp_pcs0_trd +  8) = zzoodet
+                  trbio(ji,jj,jk,jp_pcs0_trd +  9) = zzoobod
+                  trbio(ji,jj,jk,jp_pcs0_trd + 10) = zzoonh4
+                  trbio(ji,jj,jk,jp_pcs0_trd + 11) = zzoodom
+                  trbio(ji,jj,jk,jp_pcs0_trd + 12) = znh4no3
+                  trbio(ji,jj,jk,jp_pcs0_trd + 13) = zdomnh4
+                  trbio(ji,jj,jk,jp_pcs0_trd + 14) = zdetnh4
+                  trbio(ji,jj,jk,jp_pcs0_trd + 15) = zdetdom
+                  !  trend number 17 in p2zexp 
+                ENDIF
+                IF( ln_diatrc ) THEN
+                  ! convert fluxes in per day
+                  ze3t = fse3t(ji,jj,jk) * 86400.
+                  zw2d(ji,jj,1)  = zw2d(ji,jj,1)  + zno3phy * ze3t
+                  zw2d(ji,jj,2)  = zw2d(ji,jj,2)  + znh4phy * ze3t
+                  zw2d(ji,jj,3)  = zw2d(ji,jj,3)  + zphydom * ze3t
+                  zw2d(ji,jj,4)  = zw2d(ji,jj,4)  + zphynh4 * ze3t
+                  zw2d(ji,jj,5)  = zw2d(ji,jj,5)  + zphyzoo * ze3t
+                  zw2d(ji,jj,6)  = zw2d(ji,jj,6)  + zphydet * ze3t
+                  zw2d(ji,jj,7)  = zw2d(ji,jj,7)  + zdetzoo * ze3t
+                  zw2d(ji,jj,8)  = zw2d(ji,jj,8)  + zzoodet * ze3t
+                  zw2d(ji,jj,9)  = zw2d(ji,jj,9)  + zzoobod * ze3t
+                  zw2d(ji,jj,10) = zw2d(ji,jj,10) + zzoonh4 * ze3t
+                  zw2d(ji,jj,11) = zw2d(ji,jj,11) + zzoodom * ze3t
+                  zw2d(ji,jj,12) = zw2d(ji,jj,12) + znh4no3 * ze3t
+                  zw2d(ji,jj,13) = zw2d(ji,jj,13) + zdomnh4 * ze3t
+                  zw2d(ji,jj,14) = zw2d(ji,jj,14) + zdetnh4 * ze3t
+                  zw2d(ji,jj,15) = zw2d(ji,jj,15) + ( zno3phy + znh4phy - zphynh4 - zphydom - zphyzoo - zphydet ) * ze3t
+                  zw2d(ji,jj,16) = zw2d(ji,jj,16) + ( zphyzoo + zdetzoo - zzoodet - zzoobod - zzoonh4 - zzoodom ) * ze3t
+                  zw2d(ji,jj,17) = zw2d(ji,jj,17) + zdetdom * ze3t
+                  !   
+                  zw3d(ji,jj,jk,1) = zno3phy * 86400
+                  zw3d(ji,jj,jk,2) = znh4phy * 86400
+                  zw3d(ji,jj,jk,3) = znh4no3 * 86400
+                   !
+                ENDIF
+            END DO
+         END DO
+      END DO
+
+      IF( ln_diatrc ) THEN
+         !
+         DO jl = 1, 17 
+            CALL lbc_lnk( zw2d(:,:,jl),'T', 1. )
+         END DO
+         DO jl = 1, 3
+            CALL lbc_lnk( zw3d(:,:,:,jl),'T', 1. )
+         END DO
+         IF( lk_iomput ) THEN
+            ! Save diagnostics
+            CALL iom_put( "TNO3PHY", zw2d(:,:,1) )
+            CALL iom_put( "TNH4PHY", zw2d(:,:,2) )
+            CALL iom_put( "TPHYDOM", zw2d(:,:,3) )
+            CALL iom_put( "TPHYNH4", zw2d(:,:,4) )
+            CALL iom_put( "TPHYZOO", zw2d(:,:,5) )
+            CALL iom_put( "TPHYDET", zw2d(:,:,6) )
+            CALL iom_put( "TDETZOO", zw2d(:,:,7) )
+            CALL iom_put( "TZOODET", zw2d(:,:,8) )
+            CALL iom_put( "TZOOBOD", zw2d(:,:,9) )
+            CALL iom_put( "TZOONH4", zw2d(:,:,10) )
+            CALL iom_put( "TZOODOM", zw2d(:,:,11) )
+            CALL iom_put( "TNH4NO3", zw2d(:,:,12) )
+            CALL iom_put( "TDOMNH4", zw2d(:,:,13) )
+            CALL iom_put( "TDETNH4", zw2d(:,:,14) )
+            CALL iom_put( "TPHYTOT", zw2d(:,:,15) )
+            CALL iom_put( "TZOOTOT", zw2d(:,:,16) )
+            ! 
+            CALL iom_put( "FNO3PHY", zw3d(:,:,:,1) )
+            CALL iom_put( "FNH4PHY", zw3d(:,:,:,2) )
+            CALL iom_put( "FNH4NO3", zw3d(:,:,:,3) )
+            !
+         ELSE
+            !
+            trc2d(:,:,jp_pcs0_2d    ) = zw2d(:,:,1) 
+            trc2d(:,:,jp_pcs0_2d + 1) = zw2d(:,:,2) 
+            trc2d(:,:,jp_pcs0_2d + 2) = zw2d(:,:,3) 
+            trc2d(:,:,jp_pcs0_2d + 3) = zw2d(:,:,4) 
+            trc2d(:,:,jp_pcs0_2d + 4) = zw2d(:,:,5) 
+            trc2d(:,:,jp_pcs0_2d + 5) = zw2d(:,:,6) 
+            trc2d(:,:,jp_pcs0_2d + 6) = zw2d(:,:,7) 
+                     ! trend number 8 is in p2zsed.F
+            trc2d(:,:,jp_pcs0_2d +  8) = zw2d(:,:,8) 
+            trc2d(:,:,jp_pcs0_2d +  9) = zw2d(:,:,9) 
+            trc2d(:,:,jp_pcs0_2d + 10) = zw2d(:,:,10) 
+            trc2d(:,:,jp_pcs0_2d + 11) = zw2d(:,:,11) 
+            trc2d(:,:,jp_pcs0_2d + 12) = zw2d(:,:,12) 
+            trc2d(:,:,jp_pcs0_2d + 13) = zw2d(:,:,13) 
+            trc2d(:,:,jp_pcs0_2d + 14) = zw2d(:,:,14) 
+            trc2d(:,:,jp_pcs0_2d + 15) = zw2d(:,:,15) 
+            trc2d(:,:,jp_pcs0_2d + 16) = zw2d(:,:,16) 
+            trc2d(:,:,jp_pcs0_2d + 17) = zw2d(:,:,17) 
+            ! trend number 19 is in p2zexp.F
+            trc3d(:,:,:,jp_pcs0_3d    ) = zw3d(:,:,:,1) 
+            trc3d(:,:,:,jp_pcs0_3d + 1) = zw3d(:,:,:,2) 
+            trc3d(:,:,:,jp_pcs0_3d + 2) = zw3d(:,:,:,3) 
+         ENDIF
+        !
+      ENDIF
+
+      IF( ln_diabio .AND. .NOT. lk_iomput )  THEN
+         DO jl = jp_pcs0_trd, jp_pcs1_trd
+            CALL lbc_lnk( trbio(:,:,1,jl),'T', 1. )
+         END DO 
+      ENDIF
+      !
+      IF( l_trdtrc ) THEN
+         DO jl = jp_pcs0_trd, jp_pcs1_trd
+            CALL trd_mod_trc( trbio(:,:,:,jl), jl, kt )   ! handle the trend
+         END DO
+      ENDIF
+
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('bio')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      IF( ln_diatrc ) THEN
+         CALL wrk_dealloc( jpi, jpj,     17, zw2d )
+         CALL wrk_dealloc( jpi, jpj, jpk, 3, zw3d )
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p2z_bio')
+      !
+   END SUBROUTINE p2z_bio
+
+   SUBROUTINE p2z_bio_init
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p2z_bio_init  ***
+      !!
+      !! ** Purpose :  bilogical parameters 
+      !!
+      !! ** Method  :   Read namelist and check the parameters
+      !!
+      !!----------------------------------------------------------------------
+      NAMELIST/namlobphy/ tmumax, rgamma, fphylab, tmminp, aki
+      NAMELIST/namlobnut/ akno3, aknh4, taunn, psinut
+      NAMELIST/namlobzoo/ rppz, taus, aks, rpnaz, rdnaz, tauzn, fzoolab, fdbod, tmminz
+      NAMELIST/namlobdet/  taudn, fdetlab
+      NAMELIST/namlobdom/ taudomn
+      !!----------------------------------------------------------------------
+
+      REWIND( numnatp )
+      READ  ( numnatp, namlobphy )
+
+      IF(lwp) THEN
+          WRITE(numout,*) ' Namelist namlobphy'
+          WRITE(numout,*) '    phyto max growth rate                                tmumax    =', 86400 * tmumax, ' d'
+          WRITE(numout,*) '    phytoplankton exudation fraction                     rgamma    =', rgamma
+          WRITE(numout,*) '    NH4 fraction of phytoplankton exsudation             fphylab   =', fphylab
+          WRITE(numout,*) '    minimal phyto mortality rate                         tmminp    =', 86400 * tmminp
+          WRITE(numout,*) '    light hlaf saturation constant                       aki       =', aki
+          WRITE(numout,*) ' '
+      ENDIF
+
+      REWIND( numnatp )
+      READ  ( numnatp, namlobnut )
+      IF(lwp) THEN
+          WRITE(numout,*) ' Namelist namlobnut'
+          WRITE(numout,*) '    half-saturation nutrient for no3 uptake              akno3     =', akno3
+          WRITE(numout,*) '    half-saturation nutrient for nh4 uptake              aknh4     =', aknh4
+          WRITE(numout,*) '    nitrification rate                                   taunn     =', taunn
+          WRITE(numout,*) '    inhibition of no3 uptake by nh4                      psinut    =', psinut
+          WRITE(numout,*) ' '
+      ENDIF
+
+      REWIND( numnatp )
+      READ  ( numnatp, namlobzoo )
+
+      IF(lwp) THEN
+          WRITE(numout,*) ' Namelist namlobzoo'
+          WRITE(numout,*) '    zoo preference for phyto                             rppz      =', rppz
+          WRITE(numout,*) '    maximal zoo grazing rate                             taus      =', 86400 * taus, ' d'
+          WRITE(numout,*) '    half saturation constant for zoo food                aks       =', aks
+          WRITE(numout,*) '    non-assimilated phyto by zoo                         rpnaz     =', rpnaz
+          WRITE(numout,*) '    non-assimilated detritus by zoo                      rdnaz     =', rdnaz
+          WRITE(numout,*) '    zoo specific excretion rate                          tauzn     =', 86400 * tauzn
+          WRITE(numout,*) '    minimal zoo mortality rate                           tmminz    =', 86400 * tmminz
+          WRITE(numout,*) '    NH4 fraction of zooplankton excretion                fzoolab   =', fzoolab
+          WRITE(numout,*) '    Zooplankton mortality fraction that goes to detritus fdbod     =', fdbod
+          WRITE(numout,*) ' '
+      ENDIF
+
+      REWIND( numnatp )
+      READ  ( numnatp, namlobdet )
+
+      IF(lwp) THEN
+          WRITE(numout,*) ' Namelist namlobdet'
+          WRITE(numout,*) '    detrital breakdown rate                              taudn     =', 86400 * taudn , ' d'
+          WRITE(numout,*) '    NH4 fraction of detritus dissolution                 fdetlab   =', fdetlab
+          WRITE(numout,*) ' '
+      ENDIF
+
+      REWIND( numnatp )
+      READ  ( numnatp, namlobdom )
+
+      IF(lwp) THEN
+          WRITE(numout,*) ' Namelist namlobdom'
+          WRITE(numout,*) '    DOM breakdown rate                                 taudomn     =', 86400 * taudn , ' d'
+          WRITE(numout,*) ' '
+      ENDIF
+      !
+   END SUBROUTINE p2z_bio_init
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p2z_bio( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'p2z_bio: You should not have seen this print! error?', kt
+   END SUBROUTINE p2z_bio
+#endif 
+
+   !!======================================================================
+END MODULE  p2zbio
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zexp.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zexp.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zexp.F90	(revision 3680)
@@ -0,0 +1,296 @@
+MODULE p2zexp
+   !!======================================================================
+   !!                         ***  MODULE p2zsed  ***
+   !! TOP :   LOBSTER Compute loss of organic matter in the sediments
+   !!======================================================================
+   !! History :    -   !  1999    (O. Aumont, C. Le Quere)  original code
+   !!              -   !  2001-05 (O. Aumont, E. Kestenare) add sediment computations
+   !!             1.0  !  2005-06 (A.-S. Kremeur) new temporal integration for sedpoc
+   !!             2.0  !  2007-12  (C. Deltel, G. Madec)  F90
+   !!             3.5  !  2012-03  (C. Ethe)  Merge PISCES-LOBSTER
+   !!----------------------------------------------------------------------
+#if defined key_pisces_reduced
+   !!----------------------------------------------------------------------
+   !!   'key_pisces_reduced'                                     LOBSTER bio-model
+   !!----------------------------------------------------------------------
+   !!   p2z_exp        :  Compute loss of organic matter in the sediments
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trc
+   USE sms_pisces
+   USE p2zsed
+   USE lbclnk
+   USE prtctl_trc      ! Print control for debbuging
+   USE trdmod_oce
+   USE trdmod_trc
+   USE iom
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p2z_exp    
+   PUBLIC   p2z_exp_init 
+   PUBLIC   p2z_exp_alloc
+
+   !
+   REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   dminl     !: fraction of sinking POC released in sediments
+   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   dmin3     !: fraction of sinking POC released at each level
+   REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   sedpocb   !: mass of POC in sediments
+   REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   sedpocn   !: mass of POC in sediments
+   REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   cmask     !: Coastal mask area
+   REAL(wp)                                ::   areacot   !: surface coastal area
+
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: trcexp.F90 3294 2012-01-28 16:44:18Z rblod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p2z_exp( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p2z_exp  ***
+      !!
+      !! ** Purpose :   MODELS EXPORT OF BIOGENIC MATTER (POC ''SOFT
+      !!              TISSUE'') AND ITS DISTRIBUTION IN WATER COLUMN
+      !!
+      !! ** Method  : - IN THE SURFACE LAYER POC IS PRODUCED ACCORDING TO
+      !!              NURTRIENTS AVAILABLE AND GROWTH CONDITIONS. NUTRIENT UPTAKE
+      !!              KINETICS FOLLOW MICHAELIS-MENTON FORMULATION. 
+      !!              THE TOTAL PARTICLE AMOUNT PRODUCED, IS DISTRIBUTED IN THE WATER
+      !!              COLUMN BELOW THE SURFACE LAYER.
+      !!---------------------------------------------------------------------
+      !!
+      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
+      !!
+      INTEGER  ::   ji, jj, jk, jl, ikt
+      REAL(wp) ::   zgeolpoc, zfact, zwork, ze3t, zsedpocd, zmaskt
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrbio
+      REAL(wp), POINTER, DIMENSION(:,:)   ::  zsedpoca
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p2z_exp')
+      !
+      IF( kt == nittrc000 )   CALL p2z_exp_init
+
+      CALL wrk_alloc( jpi, jpj, zsedpoca ) 
+      zsedpoca(:,:) = 0.
+
+      IF( l_trdtrc )  THEN
+         CALL wrk_alloc( jpi, jpj, jpk, ztrbio )   ! temporary save of trends
+         ztrbio(:,:,:) = tra(:,:,:,jpno3)
+      ENDIF
+
+      ! VERTICAL DISTRIBUTION OF NEWLY PRODUCED BIOGENIC
+      ! POC IN THE WATER COLUMN
+      ! (PARTS OF NEWLY FORMED MATTER REMAINING IN THE DIFFERENT
+      ! LAYERS IS DETERMINED BY DMIN3 DEFINED IN sms_p2z.F90
+      ! ----------------------------------------------------------------------
+      DO jk = 1, jpkm1
+         DO jj = 2, jpjm1
+            DO ji = fs_2, fs_jpim1
+               ze3t = 1. / fse3t(ji,jj,jk)
+               tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) + ze3t * dmin3(ji,jj,jk) * xksi(ji,jj)
+            END DO
+         END DO
+      END DO
+
+      ! Find the last level of the water column
+      ! Compute fluxes due to sinking particles (slow)
+   
+
+      zgeolpoc = 0.e0         !     Initialization
+      ! Release of nutrients from the "simple" sediment
+      DO jj = 2, jpjm1
+         DO ji = fs_2, fs_jpim1
+            ikt = mbkt(ji,jj) 
+            tra(ji,jj,ikt,jpno3) = tra(ji,jj,ikt,jpno3) + sedlam * sedpocn(ji,jj) / fse3t(ji,jj,ikt) 
+            ! Deposition of organic matter in the sediment
+            zwork = vsed * trn(ji,jj,ikt,jpdet)
+            zsedpoca(ji,jj) = ( zwork + dminl(ji,jj) * xksi(ji,jj)   &
+               &           - sedlam * sedpocn(ji,jj) - sedlostpoc * sedpocn(ji,jj) ) * rdt
+            zgeolpoc = zgeolpoc + sedlostpoc * sedpocn(ji,jj) * e1e2t(ji,jj)
+         END DO
+      END DO
+
+      DO jj = 2, jpjm1
+         DO ji = fs_2, fs_jpim1
+            tra(ji,jj,1,jpno3) = tra(ji,jj,1,jpno3) + zgeolpoc * cmask(ji,jj) / areacot / fse3t(ji,jj,1)
+         END DO
+      END DO
+
+      CALL lbc_lnk( sedpocn, 'T', 1. )
+ 
+      ! Oa & Ek: diagnostics depending on jpdia2d !          left as example
+      IF( ln_diatrc ) THEN
+         IF( lk_iomput ) THEN   ;   CALL iom_put( "SEDPOC" , sedpocn )
+         ELSE                   ;   trc2d(:,:,jp_pcs0_2d + 18) = sedpocn(:,:)
+         ENDIF
+      ENDIF
+
+      
+      ! Time filter and swap of arrays
+      ! ------------------------------
+      IF( neuler == 0 .AND. kt == nittrc000 ) THEN        ! Euler time-stepping at first time-step
+        !                                             ! (only swap)
+        sedpocn(:,:) = zsedpoca(:,:)
+        !                                              
+      ELSE
+        !
+        DO jj = 1, jpj
+           DO ji = 1, jpi
+              zsedpocd = zsedpoca(ji,jj) - 2. * sedpocn(ji,jj) + sedpocb(ji,jj)      ! time laplacian on tracers
+              sedpocb(ji,jj) = sedpocn(ji,jj) + atfp * zsedpocd                     ! sedpocb <-- filtered sedpocn
+              sedpocn(ji,jj) = zsedpoca(ji,jj)                                       ! sedpocn <-- sedpoca
+           END DO
+        END DO
+        ! 
+      ENDIF
+      !
+      IF( lrst_trc ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'p2z_exp : POC in sediment fields written in ocean restart file ',   &
+            &                    'at it= ', kt,' date= ', ndastp
+         IF(lwp) WRITE(numout,*) '~~~~'
+         CALL iom_rstput( kt, nitrst, numrtw, 'SEDB'//ctrcnm(jpdet), sedpocb(:,:) )
+         CALL iom_rstput( kt, nitrst, numrtw, 'SEDN'//ctrcnm(jpdet), sedpocn(:,:) )
+      ENDIF
+      !
+      IF( l_trdtrc ) THEN
+         ztrbio(:,:,:) = tra(:,:,:,jpno3) - ztrbio(:,:,:)
+         jl = jp_pcs0_trd + 16
+         CALL trd_mod_trc( ztrbio, jl, kt )   ! handle the trend
+         CALL wrk_dealloc( jpi, jpj, jpk, ztrbio )   ! temporary save of trends
+      ENDIF
+      !
+      CALL wrk_dealloc( jpi, jpj, zsedpoca)   ! temporary save of trends
+
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('exp')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p2z_exp')
+      !
+   END SUBROUTINE p2z_exp
+
+   SUBROUTINE p2z_exp_init
+      !!----------------------------------------------------------------------
+      !!                    ***  ROUTINE p4z_exp_init  ***
+      !! ** purpose :   specific initialisation for export
+      !!----------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zmaskt, zfluo, zfluu
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zrro
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zdm0
+      !!---------------------------------------------------------------------
+
+      IF(lwp) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) ' p2z_exp: LOBSTER export'
+         WRITE(numout,*) ' ~~~~~~~'
+         WRITE(numout,*) '  compute remineralisation-damping arrays for tracers'
+      ENDIF
+      !
+      ! Allocate temporary workspace
+      CALL wrk_alloc( jpi, jpj,      zrro )
+      CALL wrk_alloc( jpi, jpj, jpk, zdm0 )
+
+
+      ! Calculate vertical distribution of newly formed biogenic poc
+      ! in the water column in the case of max. possible bottom depth
+      ! ------------------------------------------------------------
+      zdm0 = 0._wp
+      zrro = 1._wp
+      DO jk = jpkb, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zfluo = ( fsdepw(ji,jj,jk  ) / fsdepw(ji,jj,jpkb) )**xhr
+               zfluu = ( fsdepw(ji,jj,jk+1) / fsdepw(ji,jj,jpkb) )**xhr
+               IF( zfluo.GT.1. )   zfluo = 1._wp
+               zdm0(ji,jj,jk) = zfluo - zfluu
+               IF( jk <= jpkb-1 )   zdm0(ji,jj,jk) = 0._wp
+               zrro(ji,jj) = zrro(ji,jj) - zdm0(ji,jj,jk)
+            END DO
+         END DO
+      END DO
+      !
+      zdm0(:,:,jpk) = zrro(:,:)
+
+      ! Calculate vertical distribution of newly formed biogenic poc
+      ! in the water column with realistic topography (first "dry" layer
+      ! contains total fraction, which has passed to the upper layers)
+      ! ----------------------------------------------------------------------
+      dminl(:,:)   = 0._wp
+      dmin3(:,:,:) = zdm0
+      DO jk = 1, jpk
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( tmask(ji,jj,jk) == 0._wp ) THEN
+                  dminl(ji,jj) = dminl(ji,jj) + dmin3(ji,jj,jk)
+                  dmin3(ji,jj,jk) = 0._wp
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            IF( tmask(ji,jj,1) == 0 )   dmin3(ji,jj,1) = 0._wp
+         END DO
+      END DO
+
+      ! Coastal mask 
+      cmask(:,:) = 0._wp
+      DO jj = 2, jpjm1
+         DO ji = fs_2, fs_jpim1
+            IF( tmask(ji,jj,1) /= 0. ) THEN
+               zmaskt = tmask(ji+1,jj,1) * tmask(ji-1,jj,1) * tmask(ji,jj+1,1) * tmask(ji,jj-1,1) 
+               IF( zmaskt == 0. )   cmask(ji,jj) = 1._wp
+            END IF
+         END DO
+      END DO
+      CALL lbc_lnk( cmask , 'T', 1. )      ! lateral boundary conditions on cmask   (sign unchanged)
+      areacot = glob_sum( e1e2t(:,:) * cmask(:,:) )
+      !
+      IF( ln_rsttr ) THEN
+         CALL iom_get( numrtr, jpdom_autoglo, 'SEDB'//ctrcnm(jpdet), sedpocb(:,:) )
+         CALL iom_get( numrtr, jpdom_autoglo, 'SEDN'//ctrcnm(jpdet), sedpocn(:,:) )
+      ELSE
+         sedpocb(:,:) = 0._wp
+         sedpocn(:,:) = 0._wp
+      ENDIF
+      !
+      CALL wrk_dealloc( jpi, jpj,      zrro )
+      CALL wrk_dealloc( jpi, jpj, jpk, zdm0 )
+      !
+   END SUBROUTINE p2z_exp_init
+
+   INTEGER FUNCTION p2z_exp_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p2z_exp_alloc  ***
+      !!----------------------------------------------------------------------
+      ALLOCATE( cmask(jpi,jpj) , dminl(jpi,jpj) , dmin3(jpi,jpj,jpk), &
+         &      sedpocb(jpi,jpj) , sedpocn(jpi,jpj),   STAT=p2z_exp_alloc )
+      IF( p2z_exp_alloc /= 0 ) CALL ctl_warn('p2z_exp_alloc : failed to allocate arrays.')
+      !
+   END FUNCTION p2z_exp_alloc
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p2z_exp( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'p2z_exp: You should not have seen this print! error?', kt
+   END SUBROUTINE p2z_exp
+#endif 
+
+   !!======================================================================
+END MODULE  p2zexp
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zopt.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zopt.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zopt.F90	(revision 3680)
@@ -0,0 +1,209 @@
+MODULE p2zopt
+   !!======================================================================
+   !!                         ***  MODULE p2zopt  ***
+   !! TOP :   LOBSTER Compute the light availability in the water column
+   !!======================================================================
+   !! History :    -   !  1995-05  (M. Levy) Original code
+   !!              -   !  1999-09  (J.-M. Andre, M. Levy) 
+   !!              -   !  1999-11  (C. Menkes, M.-A. Foujols) itabe initial
+   !!              -   !  2000-02  (M.A. Foujols) change x**y par exp(y*log(x))
+   !!   NEMO      2.0  !  2007-12  (C. Deltel, G. Madec)  F90
+   !!             3.2  !  2009-04  (C. Ethe, G. Madec)  minor optimisation + style
+   !!----------------------------------------------------------------------
+#if defined key_pisces_reduced
+   !!----------------------------------------------------------------------
+   !!   'key_pisces_reduced'                                     LOBSTER bio-model
+   !!----------------------------------------------------------------------
+   !!   p2z_opt        :   Compute the light availability in the water column
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trc
+   USE sms_pisces
+   USE prtctl_trc      ! Print control for debbuging
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p2z_opt   !
+   PUBLIC   p2z_opt_init   !
+
+   REAL(wp), PUBLIC ::  xkr0   = 0.0232_wp   !: water coefficient absorption in red      
+   REAL(wp), PUBLIC ::  xkg0   = 0.225_wp    !: water coefficient absorption in green    
+   REAL(wp), PUBLIC ::  xkrp   = 0.074_wp    !: pigment coefficient absorption in red    
+   REAL(wp), PUBLIC ::  xkgp   = 0.037_wp    !: pigment coefficient absorption in green  
+   REAL(wp), PUBLIC ::  xlr    = 0.674_wp    !: exposant for pigment absorption in red  
+   REAL(wp), PUBLIC ::  xlg    = 0.629_wp    !: exposant for pigment absorption in green 
+   REAL(wp), PUBLIC ::  rpig   = 0.7_wp      !: chla/chla+phea ratio    
+   !                 
+   REAL(wp), PUBLIC ::  rcchl  =  60_wp      ! Carbone/Chlorophyl ratio [mgC.mgChla-1]
+   REAL(wp), PUBLIC ::  redf   = 6.56_wp     ! redfield ratio (C:N) for phyto
+   REAL(wp), PUBLIC ::  reddom = 6.56_wp     ! redfield ratio (C:N) for DOM
+
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: trcopt.F90 3294 2012-01-28 16:44:18Z rblod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p2z_opt( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p2z_opt  ***
+      !!
+      !! ** Purpose :   computes the light propagation in the water column
+      !!              and the euphotic layer depth
+      !!
+      !! ** Method  :   local par is computed in w layers using light propagation
+      !!              mean par in t layers are computed by integration
+      !!
+!!gm please remplace the '???' by true comments
+      !! ** Action  :   etot   ???
+      !!                neln   ???
+      !!---------------------------------------------------------------------
+      !!
+      INTEGER, INTENT( in ) ::   kt   ! index of the time stepping
+      !!
+      INTEGER  ::   ji, jj, jk          ! dummy loop indices
+      CHARACTER (len=25) ::   charout   ! temporary character
+      REAL(wp) ::   zpig                ! log of the total pigment
+      REAL(wp) ::   zkr, zkg            ! total absorption coefficient in red and green
+      REAL(wp) ::   zcoef               ! temporary scalar
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zpar100, zpar0m
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zparr, zparg
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p2z_opt')
+      !
+      ! Allocate temporary workspace
+      CALL wrk_alloc( jpi, jpj,      zpar100, zpar0m )
+      CALL wrk_alloc( jpi, jpj, jpk, zparr, zparg    )
+
+      IF( kt == nittrc000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) ' p2z_opt : LOBSTER optic-model'
+         IF(lwp) WRITE(numout,*) ' ~~~~~~~ '
+      ENDIF
+
+      !                                          ! surface irradiance
+      zpar0m (:,:)   = qsr   (:,:) * 0.43        ! ------------------
+      zpar100(:,:)   = zpar0m(:,:) * 0.01
+      zparr  (:,:,1) = zpar0m(:,:) * 0.5
+      zparg  (:,:,1) = zpar0m(:,:) * 0.5
+
+      !                                          ! Photosynthetically Available Radiation (PAR)
+      zcoef = 12 * redf / rcchl / rpig           ! --------------------------------------
+      DO jk = 2, jpk                                  ! local par at w-levels
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zpig = LOG(  MAX( TINY(0.), trn(ji,jj,jk-1,jpphy) ) * zcoef  )
+               zkr  = xkr0 + xkrp * EXP( xlr * zpig )
+               zkg  = xkg0 + xkgp * EXP( xlg * zpig )
+               zparr(ji,jj,jk) = zparr(ji,jj,jk-1) * EXP( -zkr * fse3t(ji,jj,jk-1) )
+               zparg(ji,jj,jk) = zparg(ji,jj,jk-1) * EXP( -zkg * fse3t(ji,jj,jk-1) )
+            END DO
+        END DO
+      END DO
+      DO jk = 1, jpkm1                                ! mean par at t-levels
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zpig = LOG(  MAX( TINY(0.), trn(ji,jj,jk,jpphy) ) * zcoef  )
+               zkr  = xkr0 + xkrp * EXP( xlr * zpig )
+               zkg  = xkg0 + xkgp * EXP( xlg * zpig )
+               zparr(ji,jj,jk) = zparr(ji,jj,jk) / ( zkr * fse3t(ji,jj,jk) ) * ( 1 - EXP( -zkr * fse3t(ji,jj,jk) ) )
+               zparg(ji,jj,jk) = zparg(ji,jj,jk) / ( zkg * fse3t(ji,jj,jk) ) * ( 1 - EXP( -zkg * fse3t(ji,jj,jk) ) )
+               etot (ji,jj,jk) = MAX( zparr(ji,jj,jk) + zparg(ji,jj,jk), 1.e-15 )
+            END DO
+         END DO
+      END DO
+
+      !                                          ! Euphotic layer
+      !                                          ! --------------
+      neln(:,:) = 1                                   ! euphotic layer level
+      DO jk = 1, jpk                                  ! (i.e. 1rst T-level strictly below EL bottom)
+         DO jj = 1, jpj
+           DO ji = 1, jpi
+              IF( etot(ji,jj,jk) >= zpar100(ji,jj) )   neln(ji,jj) = jk + 1 
+              !                                       ! nb. this is to ensure compatibility with
+              !                                       ! nmld_trc definition in trd_mld_trc_zint
+           END DO
+         END DO
+      END DO
+      !                                               ! Euphotic layer depth
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            heup(ji,jj) = fsdepw(ji,jj,neln(ji,jj))
+         END DO
+      END DO 
+
+
+      IF(ln_ctl) THEN      ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('opt')")
+         CALL prt_ctl_trc_info( charout )
+         CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm )
+      ENDIF
+      !
+      CALL wrk_dealloc( jpi, jpj,      zpar100, zpar0m )
+      CALL wrk_dealloc( jpi, jpj, jpk, zparr, zparg    )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p2z_opt')
+      !
+   END SUBROUTINE p2z_opt
+
+   SUBROUTINE p2z_opt_init
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p2z_opt_init  ***
+      !!
+      !! ** Purpose :  optical parameters 
+      !!
+      !! ** Method  :   Read the namlobopt namelist and check the parameters
+      !!
+      !!----------------------------------------------------------------------
+      NAMELIST/namlobopt/ xkg0, xkr0, xkgp, xkrp, xlg, xlr, rpig
+      NAMELIST/namlobrat/ rcchl, redf, reddom
+      !!----------------------------------------------------------------------
+
+      REWIND( numnatp )
+      READ  ( numnatp, namlobopt )
+
+      IF(lwp) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) ' Namelist namlobopt'
+         WRITE(numout,*) '    green   water absorption coeff                       xkg0  = ', xkg0
+         WRITE(numout,*) '    red water absorption coeff                           xkr0  = ', xkr0
+         WRITE(numout,*) '    pigment red absorption coeff                         xkrp  = ', xkrp
+         WRITE(numout,*) '    pigment green absorption coeff                       xkgp  = ', xkgp
+         WRITE(numout,*) '    green chl exposant                                   xlg   = ', xlg
+         WRITE(numout,*) '    red   chl exposant                                   xlr   = ', xlr
+         WRITE(numout,*) '    chla/chla+phea ratio                                 rpig  = ', rpig
+         WRITE(numout,*) ' '
+      ENDIF
+      !
+      REWIND( numnatp )
+      READ  ( numnatp, namlobrat )
+
+      IF(lwp) THEN
+          WRITE(numout,*) ' Namelist namlobrat'
+         WRITE(numout,*) '     carbone/chlorophyl ratio                             rcchl = ', rcchl
+          WRITE(numout,*) '    redfield ratio  c:n for phyto                        redf      =', redf
+          WRITE(numout,*) '    redfield ratio  c:n for DOM                          reddom    =', reddom
+          WRITE(numout,*) ' '
+      ENDIF
+      !
+   END SUBROUTINE p2z_opt_init
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p2z_opt( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'p2z_opt: You should not have seen this print! error?', kt
+   END SUBROUTINE p2z_opt
+#endif 
+
+   !!======================================================================
+END MODULE  p2zopt
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zsed.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zsed.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zsed.F90	(revision 3680)
@@ -0,0 +1,180 @@
+MODULE p2zsed
+   !!======================================================================
+   !!                         ***  MODULE p2zsed  ***
+   !! TOP :   PISCES Compute loss of organic matter in the sediments
+   !!======================================================================
+   !! History :    -   !  1995-06 (M. Levy)  original code
+   !!              -   !  2000-12 (E. Kestenare)  clean up
+   !!             2.0  !  2007-12  (C. Deltel, G. Madec)  F90 + simplifications
+   !!----------------------------------------------------------------------
+#if defined key_pisces_reduced
+   !!----------------------------------------------------------------------
+   !!   'key_pisces_reduced'                                     LOBSTER bio-model
+   !!----------------------------------------------------------------------
+   !!   p2z_sed        :  Compute loss of organic matter in the sediments
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trc
+   USE sms_pisces
+   USE lbclnk
+   USE trdmod_oce
+   USE trdmod_trc
+   USE iom
+   USE prtctl_trc      ! Print control for debbuging
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p2z_sed         ! called in ???
+   PUBLIC   p2z_sed_init    ! called in ???
+
+   REAL(wp), PUBLIC ::   sedlam     = 3.86e-7   !: time coefficient of POC remineralization in sediments
+   REAL(wp), PUBLIC ::   sedlostpoc = 0.        ! mass of POC lost in sediments 
+   REAL(wp), PUBLIC ::   vsed       = 3.47e-5   ! detritus sedimentation speed [m/s] 
+   REAL(wp), PUBLIC ::   xhr        = -0.858    ! coeff for martin''s remineralisation profile
+
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p2z_sed.F90 3294 2012-01-28 16:44:18Z rblod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p2z_sed( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p2z_sed  ***
+      !!
+      !! ** Purpose :   compute the now trend due to the vertical sedimentation of
+      !!              detritus and add it to the general trend of detritus equations
+      !!
+      !! ** Method  :   this ROUTINE compute not exactly the advection but the
+      !!              transport term, i.e.  dz(wt) and dz(ws)., dz(wtr)
+      !!              using an upstream scheme
+      !!              the now vertical advection of tracers is given by:
+      !!                      dz(trn wn) = 1/bt dk+1( e1t e2t vsed (trn) )
+      !!              add this trend now to the general trend of tracer (ta,sa,tra):
+      !!                             tra = tra + dz(trn wn)
+      !!        
+      !!              IF 'key_diabio' is defined, the now vertical advection
+      !!              trend of passive tracers is saved for futher diagnostics.
+      !!---------------------------------------------------------------------
+      !!
+      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
+      !!
+      INTEGER  ::   ji, jj, jk, jl, ierr
+      CHARACTER (len=25) :: charout
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zw2d
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zwork, ztra, ztrbio
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p2z_sed')
+      !
+      IF( kt == nittrc000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) ' p2z_sed: LOBSTER sedimentation'
+         IF(lwp) WRITE(numout,*) ' ~~~~~~~'
+      ENDIF
+
+      ! Allocate temporary workspace
+                       CALL wrk_alloc( jpi, jpj, jpk, zwork, ztra )
+      IF( ln_diatrc )  CALL wrk_alloc( jpi, jpj, zw2d )
+      IF( l_trdtrc ) THEN
+         CALL wrk_alloc( jpi, jpj, jpk, ztrbio )
+         ztrbio(:,:,:) = tra(:,:,:,jpdet)
+      ENDIF
+
+      ! sedimentation of detritus  : upstream scheme
+      ! --------------------------------------------
+
+      ! for detritus sedimentation only - jpdet
+      zwork(:,:,1  ) = 0.e0      ! surface value set to zero
+      zwork(:,:,jpk) = 0.e0      ! bottom value  set to zero
+
+      ! tracer flux at w-point: we use -vsed (downward flux)  with simplification : no e1*e2
+      DO jk = 2, jpkm1
+         zwork(:,:,jk) = -vsed * trn(:,:,jk-1,jpdet)
+      END DO
+
+      ! tracer flux divergence at t-point added to the general trend
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ztra(ji,jj,jk)  = - ( zwork(ji,jj,jk) - zwork(ji,jj,jk+1) ) / fse3t(ji,jj,jk)
+               tra(ji,jj,jk,jpdet) = tra(ji,jj,jk,jpdet) + ztra(ji,jj,jk) 
+            END DO
+         END DO
+      END DO
+
+      IF( ln_diatrc ) THEN 
+         DO jk = 1, jpkm1
+            zw2d(:,:) = zw2d(:,:) + ztra(:,:,jk) * fse3t(:,:,jk) * 86400.
+         END DO
+         IF( lk_iomput )  THEN
+           CALL iom_put( "TDETSED", zw2d )
+         ELSE
+           trc2d(:,:,jp_pcs0_2d + 7) = zw2d(:,:)
+         ENDIF
+         CALL wrk_dealloc( jpi, jpj, zw2d )
+      ENDIF
+      !
+      IF( ln_diabio )  trbio(:,:,:,jp_pcs0_trd + 7) = ztra(:,:,:)
+      CALL wrk_dealloc( jpi, jpj, jpk, zwork, ztra )
+      !
+      IF( l_trdtrc ) THEN
+         ztrbio(:,:,:) = tra(:,:,:,jpdet) - ztrbio(:,:,:)
+         jl = jp_pcs0_trd + 7
+         CALL trd_mod_trc( ztrbio, jl, kt )   ! handle the trend
+         CALL wrk_dealloc( jpi, jpj, jpk, ztrbio )
+      ENDIF
+
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('sed')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p2z_sed')
+      !
+   END SUBROUTINE p2z_sed
+
+   SUBROUTINE p2z_sed_init
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p2z_sed_init  ***
+      !!
+      !! ** Purpose :   Parameters from aphotic layers to sediment
+      !!
+      !! ** Method  :   Read the namlobsed namelist and check the parameters
+      !!
+      !!----------------------------------------------------------------------
+      NAMELIST/namlobsed/ sedlam, sedlostpoc, vsed, xhr
+
+      REWIND( numnatp )
+      READ  ( numnatp, namlobsed )
+
+      IF(lwp) THEN
+          WRITE(numout,*) ' Namelist namlobsed'
+          WRITE(numout,*) '    time coeff of POC in sediments                       sedlam    =', sedlam
+          WRITE(numout,*) '    Sediment geol loss for POC                           sedlostpoc=', sedlostpoc
+          WRITE(numout,*) '    detritus sedimentation speed                         vsed      =', 86400 * vsed  , ' d'
+          WRITE(numout,*) '    coeff for martin''s remineralistion                  xhr       =', xhr
+          WRITE(numout,*) ' '
+      ENDIF
+      !
+   END SUBROUTINE p2z_sed_init
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p2z_sed( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'p2z_sed: You should not have seen this print! error?', kt
+   END SUBROUTINE p2z_sed
+#endif 
+
+   !!======================================================================
+END MODULE  p2zsed
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zsms.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zsms.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zsms.F90	(revision 3680)
@@ -0,0 +1,84 @@
+MODULE p2zsms
+   !!======================================================================
+   !!                         ***  MODULE p2zsms  ***
+   !! TOP :   Time loop of LOBSTER model
+   !!======================================================================
+   !! History :   1.0  !            M. Levy
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  revised architecture
+   !!----------------------------------------------------------------------
+#if defined key_pisces_reduced
+   !!----------------------------------------------------------------------
+   !!   'key_pisces_reduced'                              LOBSTER bio-model
+   !!----------------------------------------------------------------------
+   !!   p2zsms        :  Time loop of passive tracers sms
+   !!----------------------------------------------------------------------
+   USE oce_trc          !
+   USE trc
+   USE p2zbio
+   USE p2zopt
+   USE p2zsed
+   USE p2zexp
+   USE trdmod_oce
+   USE trdmod_trc_oce
+   USE trdmod_trc
+   USE trdmld_trc
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p2z_sms    ! called in p2zsms.F90
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p2zsms.F90 3294 2012-01-28 16:44:18Z rblod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE p2z_sms( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p2z_sms  ***
+      !!
+      !! ** Purpose :  Managment of the call to Biological sources and sinks 
+      !!               routines of LOBSTER bio-model 
+      !!
+      !! ** Method  : - ???
+      !! --------------------------------------------------------------------
+      !!
+      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
+      !
+      INTEGER :: jn
+      !! --------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p2z_sms')
+      !
+      CALL p2z_opt( kt )      ! optical model
+      CALL p2z_bio( kt )      ! biological model
+      CALL p2z_sed( kt )      ! sedimentation model
+      CALL p2z_exp( kt )      ! export
+
+      IF( l_trdtrc ) THEN
+         DO jn = jp_pcs0, jp_pcs1
+           CALL trd_mod_trc( tra(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends
+         END DO
+      END IF
+
+      IF( lk_trdmld_trc )  CALL trd_mld_bio( kt )   ! trends: Mixed-layer
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p2z_sms')
+      !
+   END SUBROUTINE p2z_sms
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                     No passive tracer
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p2z_sms( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'p2z_sms: You should not have seen this print! error?', kt
+   END SUBROUTINE p2z_sms
+#endif 
+
+   !!======================================================================
+END MODULE  p2zsms
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zbio.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zbio.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zbio.F90	(revision 3680)
@@ -0,0 +1,149 @@
+MODULE p4zbio
+   !!======================================================================
+   !!                         ***  MODULE p4zbio  ***
+   !! TOP :   PISCES bio-model
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_bio        :   computes the interactions between the different
+   !!                      compartments of PISCES
+   !!----------------------------------------------------------------------
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zsink         !  vertical flux of particulate matter due to sinking
+   USE p4zopt          !  optical model
+   USE p4zlim          !  Co-limitations of differents nutrients
+   USE p4zprod         !  Growth rate of the 2 phyto groups
+   USE p4zmort         !  Mortality terms for phytoplankton
+   USE p4zmicro        !  Sources and sinks of microzooplankton
+   USE p4zmeso         !  Sources and sinks of mesozooplankton
+   USE p4zrem          !  Remineralisation of organic matter
+   USE p4zfechem
+   USE prtctl_trc      !  print control for debugging
+   USE iom             !  I/O manager
+  
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC  p4z_bio    
+
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zbio.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_bio ( kt, jnt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_bio  ***
+      !!
+      !! ** Purpose :   Ecosystem model in the whole ocean: computes the
+      !!              different interactions between the different compartments
+      !!              of PISCES
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in) :: kt, jnt
+      INTEGER  ::  ji, jj, jk, jn
+      REAL(wp) ::  ztra
+#if defined key_kriest
+      REAL(wp) ::  zcoef1, zcoef2
+#endif
+      CHARACTER (len=25) :: charout
+
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_bio')
+      !
+      !     ASSIGN THE SHEAR RATE THAT IS USED FOR AGGREGATION
+      !     OF PHYTOPLANKTON AND DETRITUS
+
+      xdiss(:,:,:) = 1.
+!!gm the use of nmld should be better here?
+      DO jk = 2, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( fsdepw(ji,jj,jk+1) > hmld(ji,jj) )   xdiss(ji,jj,jk) = 0.01
+            END DO 
+         END DO
+      END DO
+
+          
+      CALL p4z_opt  ( kt, jnt )     ! Optic: PAR in the water column
+      CALL p4z_sink ( kt, jnt )     ! vertical flux of particulate organic matter
+      CALL p4z_fechem(kt, jnt )     ! Iron chemistry/scavenging
+      CALL p4z_lim  ( kt, jnt )     ! co-limitations by the various nutrients
+      CALL p4z_prod ( kt, jnt )     ! phytoplankton growth rate over the global ocean. 
+      !                             ! (for each element : C, Si, Fe, Chl )
+      CALL p4z_rem  ( kt, jnt )     ! remineralization terms of organic matter+scavenging of Fe
+      CALL p4z_mort ( kt      )     ! phytoplankton mortality
+      !                             ! zooplankton sources/sinks routines 
+      CALL p4z_micro( kt, jnt )           ! microzooplankton
+      CALL p4z_meso ( kt, jnt )           ! mesozooplankton
+
+      !                             ! test if tracers concentrations fall below 0.
+      xnegtr(:,:,:) = 1.e0
+      DO jn = jp_pcs0, jp_pcs1
+         DO jk = 1, jpk
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  IF( ( trn(ji,jj,jk,jn) + tra(ji,jj,jk,jn) ) < 0.e0 ) THEN
+                     ztra             = ABS( trn(ji,jj,jk,jn) ) / ( ABS( tra(ji,jj,jk,jn) ) + rtrn )
+
+                     xnegtr(ji,jj,jk) = MIN( xnegtr(ji,jj,jk),  ztra )
+                  ENDIF
+              END DO
+            END DO
+         END DO
+      END DO
+      !                                ! where at least 1 tracer concentration becomes negative
+      !                                ! 
+      DO jn = jp_pcs0, jp_pcs1
+         trn(:,:,:,jn) = trn(:,:,:,jn) + xnegtr(:,:,:) * tra(:,:,:,jn)
+      END DO
+
+
+      tra(:,:,:,:) = 0.e0
+
+#if defined key_kriest
+      ! 
+      zcoef1 = 1.e0 / xkr_massp 
+      zcoef2 = 1.e0 / xkr_massp / 1.1
+      DO jk = 1,jpkm1
+         trn(:,:,jk,jpnum) = MAX(  trn(:,:,jk,jpnum), trn(:,:,jk,jppoc) * zcoef1 / xnumm(jk)  )
+         trn(:,:,jk,jpnum) = MIN(  trn(:,:,jk,jpnum), trn(:,:,jk,jppoc) * zcoef2              )
+      END DO
+#endif
+
+      !
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('bio ')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=trn, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_bio')
+      !
+   END SUBROUTINE p4z_bio
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_bio                         ! Empty routine
+   END SUBROUTINE p4z_bio
+#endif 
+
+   !!======================================================================
+END MODULE  p4zbio
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zche.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zche.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zche.F90	(revision 3680)
@@ -0,0 +1,398 @@
+MODULE p4zche
+   !!======================================================================
+   !!                         ***  MODULE p4zche  ***
+   !! TOP :   PISCES Sea water chemistry computed following OCMIP protocol
+   !!======================================================================
+   !! History :   OPA  !  1988     (E. Maier-Reimer)  Original code
+   !!              -   !  1998     (O. Aumont)  addition
+   !!              -   !  1999     (C. Le Quere)  modification
+   !!   NEMO      1.0  !  2004     (O. Aumont)  modification
+   !!              -   !  2006     (R. Gangsto)  modification
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!                  !  2011-02  (J. Simeon, J.Orr ) update O2 solubility constants
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_che      :  Sea water chemistry computed following OCMIP protocol
+   !!----------------------------------------------------------------------
+   USE oce_trc       !  shared variables between ocean and passive tracers
+   USE trc           !  passive tracers common variables
+   USE sms_pisces    !  PISCES Source Minus Sink variables
+   USE lib_mpp       !  MPP library
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_che         !
+   PUBLIC   p4z_che_alloc   !
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sio3eq   ! chemistry of Si
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   fekeq    ! chemistry of Fe
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   chemc    ! Solubilities of O2 and CO2
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   chemo2    ! Solubilities of O2 and CO2
+
+   REAL(wp), PUBLIC ::   atcox  = 0.20946         ! units atm
+
+   REAL(wp) ::   salchl = 1. / 1.80655    ! conversion factor for salinity --> chlorinity (Wooster et al. 1969)
+   REAL(wp) ::   o2atm  = 1. / ( 1000. * 0.20946 )  
+
+   REAL(wp) ::   akcc1  = -171.9065       ! coeff. for apparent solubility equilibrium
+   REAL(wp) ::   akcc2  =   -0.077993     ! Millero et al. 1995 from Mucci 1983
+   REAL(wp) ::   akcc3  = 2839.319        
+   REAL(wp) ::   akcc4  =   71.595        
+   REAL(wp) ::   akcc5  =   -0.77712      
+   REAL(wp) ::   akcc6  =    0.00284263   
+   REAL(wp) ::   akcc7  =  178.34        
+   REAL(wp) ::   akcc8  =   -0.07711     
+   REAL(wp) ::   akcc9  =    0.0041249   
+
+   REAL(wp) ::   rgas   = 83.143         ! universal gas constants
+   REAL(wp) ::   oxyco  = 1. / 22.4144   ! converts from liters of an ideal gas to moles
+
+   REAL(wp) ::   bor1   = 0.00023        ! borat constants
+   REAL(wp) ::   bor2   = 1. / 10.82
+
+   REAL(wp) ::   ca0    = -162.8301      ! WEISS & PRICE 1980, units mol/(kg atm)
+   REAL(wp) ::   ca1    =  218.2968
+   REAL(wp) ::   ca2    =   90.9241
+   REAL(wp) ::   ca3    =   -1.47696
+   REAL(wp) ::   ca4    =    0.025695
+   REAL(wp) ::   ca5    =   -0.025225
+   REAL(wp) ::   ca6    =    0.0049867
+
+   REAL(wp) ::   c10    = -3670.7        ! Coeff. for 1. dissoc. of carbonic acid (Edmond and Gieskes, 1970)   
+   REAL(wp) ::   c11    =    62.008     
+   REAL(wp) ::   c12    =    -9.7944    
+   REAL(wp) ::   c13    =     0.0118     
+   REAL(wp) ::   c14    =    -0.000116
+
+   REAL(wp) ::   c20    = -1394.7       ! coeff. for 2. dissoc. of carbonic acid (Millero, 1995)   
+   REAL(wp) ::   c21    =    -4.777   
+   REAL(wp) ::   c22    =     0.0184   
+   REAL(wp) ::   c23    =    -0.000118
+
+   REAL(wp) ::   st1    =      0.14     ! constants for calculate concentrations for sulfate
+   REAL(wp) ::   st2    =  1./96.062    !  (Morris & Riley 1966)
+   REAL(wp) ::   ks0    =    141.328 
+   REAL(wp) ::   ks1    =  -4276.1  
+   REAL(wp) ::   ks2    =    -23.093
+   REAL(wp) ::   ks3    = -13856.  
+   REAL(wp) ::   ks4    =   324.57 
+   REAL(wp) ::   ks5    =   -47.986
+   REAL(wp) ::   ks6    =  35474. 
+   REAL(wp) ::   ks7    =   -771.54
+   REAL(wp) ::   ks8    =    114.723
+   REAL(wp) ::   ks9    =  -2698.  
+   REAL(wp) ::   ks10   =   1776. 
+   REAL(wp) ::   ks11   =      1.
+   REAL(wp) ::   ks12   =     -0.001005 
+
+   REAL(wp) ::   ft1    =    0.000067   ! constants for calculate concentrations for fluorides
+   REAL(wp) ::   ft2    = 1./18.9984    ! (Dickson & Riley 1979 )
+   REAL(wp) ::   kf0    =  -12.641    
+   REAL(wp) ::   kf1    = 1590.2    
+   REAL(wp) ::   kf2    =    1.525    
+   REAL(wp) ::   kf3    =    1.0     
+   REAL(wp) ::   kf4    =   -0.001005
+
+   REAL(wp) ::   cb0    = -8966.90      ! Coeff. for 1. dissoc. of boric acid 
+   REAL(wp) ::   cb1    = -2890.53      ! (Dickson and Goyet, 1994)
+   REAL(wp) ::   cb2    =   -77.942
+   REAL(wp) ::   cb3    =     1.728
+   REAL(wp) ::   cb4    =    -0.0996
+   REAL(wp) ::   cb5    =   148.0248
+   REAL(wp) ::   cb6    =   137.1942
+   REAL(wp) ::   cb7    =     1.62142
+   REAL(wp) ::   cb8    =   -24.4344
+   REAL(wp) ::   cb9    =   -25.085
+   REAL(wp) ::   cb10   =    -0.2474 
+   REAL(wp) ::   cb11   =     0.053105
+
+   REAL(wp) ::   cw0    = -13847.26     ! Coeff. for dissoc. of water (Dickson and Riley, 1979 )
+   REAL(wp) ::   cw1    =    148.9652  
+   REAL(wp) ::   cw2    =    -23.6521
+   REAL(wp) ::   cw3    =    118.67 
+   REAL(wp) ::   cw4    =     -5.977 
+   REAL(wp) ::   cw5    =      1.0495  
+   REAL(wp) ::   cw6    =     -0.01615
+
+   !                                    ! volumetric solubility constants for o2 in ml/L  
+   REAL(wp) ::   ox0    =  2.00856      ! from Table 1 for Eq 8 of Garcia and Gordon, 1992.
+   REAL(wp) ::   ox1    =  3.22400      ! corrects for moisture and fugacity, but not total atmospheric pressure
+   REAL(wp) ::   ox2    =  3.99063      !      Original PISCES code noted this was a solubility, but 
+   REAL(wp) ::   ox3    =  4.80299      ! was in fact a bunsen coefficient with units L-O2/(Lsw atm-O2)
+   REAL(wp) ::   ox4    =  9.78188e-1   ! Hence, need to divide EXP( zoxy ) by 1000, ml-O2 => L-O2
+   REAL(wp) ::   ox5    =  1.71069      ! and atcox = 0.20946 to add the 1/atm dimension.
+   REAL(wp) ::   ox6    = -6.24097e-3   
+   REAL(wp) ::   ox7    = -6.93498e-3 
+   REAL(wp) ::   ox8    = -6.90358e-3
+   REAL(wp) ::   ox9    = -4.29155e-3 
+   REAL(wp) ::   ox10   = -3.11680e-7 
+
+   !                                    ! coeff. for seawater pressure correction : millero 95
+   !                                    ! AGRIF doesn't like the DATA instruction
+   REAL(wp) :: devk11  = -25.5
+   REAL(wp) :: devk12  = -15.82
+   REAL(wp) :: devk13  = -29.48
+   REAL(wp) :: devk14  = -25.60
+   REAL(wp) :: devk15  = -48.76
+   !
+   REAL(wp) :: devk21  = 0.1271
+   REAL(wp) :: devk22  = -0.0219
+   REAL(wp) :: devk23  = 0.1622
+   REAL(wp) :: devk24  = 0.2324
+   REAL(wp) :: devk25  = 0.5304
+   !
+   REAL(wp) :: devk31  = 0.
+   REAL(wp) :: devk32  = 0.
+   REAL(wp) :: devk33  = 2.608E-3
+   REAL(wp) :: devk34  = -3.6246E-3
+   REAL(wp) :: devk35  = 0.
+   !
+   REAL(wp) :: devk41  = -3.08E-3
+   REAL(wp) :: devk42  = 1.13E-3
+   REAL(wp) :: devk43  = -2.84E-3
+   REAL(wp) :: devk44  = -5.13E-3
+   REAL(wp) :: devk45  = -11.76E-3
+   !
+   REAL(wp) :: devk51  = 0.0877E-3
+   REAL(wp) :: devk52  = -0.1475E-3     
+   REAL(wp) :: devk53  = 0.
+   REAL(wp) :: devk54  = 0.0794E-3      
+   REAL(wp) :: devk55  = 0.3692E-3      
+
+   !!* Substitution
+#include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zche.F90 3294 2012-01-28 16:44:18Z rblod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE p4z_che
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_che  ***
+      !!
+      !! ** Purpose :   Sea water chemistry computed following OCMIP protocol
+      !!
+      !! ** Method  : - ...
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   ztkel, zt   , zt2   , zsal  , zsal2 , zbuf1 , zbuf2
+      REAL(wp) ::   ztgg , ztgg2, ztgg3 , ztgg4 , ztgg5
+      REAL(wp) ::   zpres, ztc  , zcl   , zcpexp, zoxy  , zcpexp2
+      REAL(wp) ::   zsqrt, ztr  , zlogt , zcek1
+      REAL(wp) ::   zis  , zis2 , zsal15, zisqrt
+      REAL(wp) ::   zckb , zck1 , zck2  , zckw  , zak1 , zak2  , zakb , zaksp0, zakw
+      REAL(wp) ::   zst  , zft  , zcks  , zckf  , zaksp1
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_che')
+      !
+      ! CHEMICAL CONSTANTS - SURFACE LAYER
+      ! ----------------------------------
+!CDIR NOVERRCHK
+      DO jj = 1, jpj
+!CDIR NOVERRCHK
+         DO ji = 1, jpi
+            !                             ! SET ABSOLUTE TEMPERATURE
+            ztkel = tsn(ji,jj,1,jp_tem) + 273.16
+            zt    = ztkel * 0.01
+            zt2   = zt * zt
+            zsal  = tsn(ji,jj,1,jp_sal) + ( 1.- tmask(ji,jj,1) ) * 35.
+            zsal2 = zsal * zsal
+            zlogt = LOG( zt )
+            !                             ! LN(K0) OF SOLUBILITY OF CO2 (EQ. 12, WEISS, 1980)
+            !                             !     AND FOR THE ATMOSPHERE FOR NON IDEAL GAS
+            zcek1 = ca0 + ca1 / zt + ca2 * zlogt + ca3 * zt2 + zsal * ( ca4 + ca5 * zt + ca6 * zt2 )
+            !                             ! LN(K0) OF SOLUBILITY OF O2 and N2 in ml/L (EQ. 8, GARCIA AND GORDON, 1992)
+            ztgg  = LOG( ( 298.15 - tsn(ji,jj,1,jp_tem) ) / ztkel )  ! Set the GORDON & GARCIA scaled temperature
+            ztgg2 = ztgg  * ztgg
+            ztgg3 = ztgg2 * ztgg
+            ztgg4 = ztgg3 * ztgg
+            ztgg5 = ztgg4 * ztgg
+            zoxy  = ox0 + ox1 * ztgg + ox2 * ztgg2 + ox3 * ztgg3 + ox4 * ztgg4 + ox5 * ztgg5   &
+                   + zsal * ( ox6 + ox7 * ztgg + ox8 * ztgg2 + ox9 * ztgg3 ) +  ox10 * zsal2
+
+            !                             ! SET SOLUBILITIES OF O2 AND CO2 
+            chemc(ji,jj,1) = EXP( zcek1 ) * 1.e-6 * rhop(ji,jj,1) / 1000.  ! mol/(L uatm)
+            chemc(ji,jj,2) = ( EXP( zoxy  ) * o2atm ) * oxyco              ! mol/(L atm)
+            !
+         END DO
+      END DO
+
+      ! OXYGEN SOLUBILITY - DEEP OCEAN
+      ! -------------------------------
+!CDIR NOVERRCHK
+      DO jk = 1, jpk
+!CDIR NOVERRCHK
+         DO jj = 1, jpj
+!CDIR NOVERRCHK
+            DO ji = 1, jpi
+              ztkel = tsn(ji,jj,jk,jp_tem) + 273.16
+              zsal  = tsn(ji,jj,jk,jp_sal) + ( 1.- tmask(ji,jj,jk) ) * 35.
+              zsal2 = zsal * zsal
+              ztgg  = LOG( ( 298.15 - tsn(ji,jj,jk,jp_tem) ) / ztkel )  ! Set the GORDON & GARCIA scaled temperature
+              ztgg2 = ztgg  * ztgg
+              ztgg3 = ztgg2 * ztgg
+              ztgg4 = ztgg3 * ztgg
+              ztgg5 = ztgg4 * ztgg
+              zoxy  = ox0 + ox1 * ztgg + ox2 * ztgg2 + ox3 * ztgg3 + ox4 * ztgg4 + ox5 * ztgg5   &
+                     + zsal * ( ox6 + ox7 * ztgg + ox8 * ztgg2 + ox9 * ztgg3 ) +  ox10 * zsal2
+              chemo2(ji,jj,jk) = ( EXP( zoxy ) * o2atm ) * oxyco * atcox     ! mol/(L atm)
+            END DO
+          END DO
+        END DO
+
+
+
+      ! CHEMICAL CONSTANTS - DEEP OCEAN
+      ! -------------------------------
+!CDIR NOVERRCHK
+      DO jk = 1, jpk
+!CDIR NOVERRCHK
+         DO jj = 1, jpj
+!CDIR NOVERRCHK
+            DO ji = 1, jpi
+
+               ! SET PRESSION
+               zpres   = 1.025e-1 * fsdept(ji,jj,jk)
+
+               ! SET ABSOLUTE TEMPERATURE
+               ztkel   = tsn(ji,jj,jk,jp_tem) + 273.16
+               zsal    = tsn(ji,jj,jk,jp_sal) + ( 1.-tmask(ji,jj,jk) ) * 35.
+               zsqrt  = SQRT( zsal )
+               zsal15  = zsqrt * zsal
+               zlogt  = LOG( ztkel )
+               ztr    = 1. / ztkel
+               zis    = 19.924 * zsal / ( 1000.- 1.005 * zsal )
+               zis2   = zis * zis
+               zisqrt = SQRT( zis )
+               ztc     = tsn(ji,jj,jk,jp_tem) + ( 1.- tmask(ji,jj,jk) ) * 20.
+
+               ! CHLORINITY (WOOSTER ET AL., 1969)
+               zcl     = zsal * salchl
+
+               ! TOTAL SULFATE CONCENTR. [MOLES/kg soln]
+               zst     = st1 * zcl * st2
+
+               ! TOTAL FLUORIDE CONCENTR. [MOLES/kg soln]
+               zft     = ft1 * zcl * ft2
+
+               ! DISSOCIATION CONSTANT FOR SULFATES on free H scale (Dickson 1990)
+               zcks    = EXP(  ks1 * ztr + ks0 + ks2 * zlogt                           &
+                  &                     + ( ks3 * ztr + ks4 + ks5 * zlogt ) * zisqrt   &
+                  &                     + ( ks6 * ztr + ks7 + ks8 * zlogt ) * zis      &
+                  &                     + ks9 * ztr * zis * zisqrt + ks10 * ztr *zis2 + LOG( ks11 + ks12 *zsal )  )
+
+               ! DISSOCIATION CONSTANT FOR FLUORIDES on free H scale (Dickson and Riley 79)
+               zckf    = EXP(  kf1 * ztr + kf0 + kf2 * zisqrt + LOG( kf3 + kf4 * zsal )  )
+
+               ! DISSOCIATION CONSTANT FOR CARBONATE AND BORATE
+               zckb    = ( cb0 + cb1 * zsqrt + cb2  * zsal + cb3 * zsal15 + cb4 * zsal * zsal ) * ztr   &
+                  &    + ( cb5 + cb6 * zsqrt + cb7  * zsal )                                            &
+                  &    + ( cb8 + cb9 * zsqrt + cb10 * zsal ) * zlogt + cb11 * zsqrt * ztkel             &
+                  &    + LOG(  ( 1.+ zst / zcks + zft / zckf ) / ( 1.+ zst / zcks )  )
+
+               zck1    = c10 * ztr + c11 + c12 * zlogt + c13 * zsal + c14 * zsal * zsal
+               zck2    = c20 * ztr + c21 + c22 * zsal   + c23 * zsal**2
+
+               ! PKW (H2O) (DICKSON AND RILEY, 1979)
+               zckw    = cw0 * ztr + cw1 + cw2 * zlogt + ( cw3 * ztr + cw4 + cw5 * zlogt ) * zsqrt + cw6 * zsal
+
+
+               ! APPARENT SOLUBILITY PRODUCT K'SP OF CALCITE IN SEAWATER
+               !       (S=27-43, T=2-25 DEG C) at pres =0 (atmos. pressure) (MUCCI 1983)
+               zaksp0  = akcc1 + akcc2 * ztkel + akcc3 * ztr + akcc4 * LOG10( ztkel )   &
+                  &   + ( akcc5 + akcc6 * ztkel + akcc7 * ztr ) * zsqrt + akcc8 * zsal + akcc9 * zsal15
+
+               ! K1, K2 OF CARBONIC ACID, KB OF BORIC ACID, KW (H2O) (LIT.?)
+               zak1    = 10**(zck1)
+               zak2    = 10**(zck2)
+               zakb    = EXP( zckb  )
+               zakw    = EXP( zckw )
+               zaksp1  = 10**(zaksp0)
+
+               ! FORMULA FOR CPEXP AFTER EDMOND & GIESKES (1970)
+               !        (REFERENCE TO CULBERSON & PYTKOQICZ (1968) AS MADE
+               !        IN BROECKER ET AL. (1982) IS INCORRECT; HERE RGAS IS
+               !        TAKEN TENFOLD TO CORRECT FOR THE NOTATION OF pres  IN
+               !        DBAR INSTEAD OF BAR AND THE EXPRESSION FOR CPEXP IS
+               !        MULTIPLIED BY LN(10.) TO ALLOW USE OF EXP-FUNCTION
+               !        WITH BASIS E IN THE FORMULA FOR AKSPP (CF. EDMOND
+               !        & GIESKES (1970), P. 1285-1286 (THE SMALL
+               !        FORMULA ON P. 1286 IS RIGHT AND CONSISTENT WITH THE
+               !        SIGN IN PARTIAL MOLAR VOLUME CHANGE AS SHOWN ON P. 1285))
+               zcpexp  = zpres /(rgas*ztkel)
+               zcpexp2 = zpres * zpres/(rgas*ztkel)
+
+               ! KB OF BORIC ACID, K1,K2 OF CARBONIC ACID PRESSURE
+               !        CORRECTION AFTER CULBERSON AND PYTKOWICZ (1968)
+               !        (CF. BROECKER ET AL., 1982)
+
+               zbuf1  = -     ( devk11 + devk21 * ztc + devk31 * ztc * ztc )
+               zbuf2  = 0.5 * ( devk41 + devk51 * ztc )
+               ak13(ji,jj,jk) = zak1 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               zbuf1  =     - ( devk12 + devk22 * ztc + devk32 * ztc * ztc )
+               zbuf2  = 0.5 * ( devk42 + devk52 * ztc )
+               ak23(ji,jj,jk) = zak2 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               zbuf1  =     - ( devk13 + devk23 * ztc + devk33 * ztc * ztc )
+               zbuf2  = 0.5 * ( devk43 + devk53 * ztc )
+               akb3(ji,jj,jk) = zakb * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               zbuf1  =     - ( devk14 + devk24 * ztc + devk34 * ztc * ztc )
+               zbuf2  = 0.5 * ( devk44 + devk54 * ztc )
+               akw3(ji,jj,jk) = zakw * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+
+               ! APPARENT SOLUBILITY PRODUCT K'SP OF CALCITE 
+               !        AS FUNCTION OF PRESSURE FOLLOWING MILLERO
+               !        (P. 1285) AND BERNER (1976)
+               zbuf1  =     - ( devk15 + devk25 * ztc + devk35 * ztc * ztc )
+               zbuf2  = 0.5 * ( devk45 + devk55 * ztc )
+               aksp(ji,jj,jk) = zaksp1 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               ! TOTAL BORATE CONCENTR. [MOLES/L]
+               borat(ji,jj,jk) = bor1 * zcl * bor2
+
+               ! Iron and SIO3 saturation concentration from ...
+               sio3eq(ji,jj,jk) = EXP(  LOG( 10.) * ( 6.44 - 968. / ztkel )  ) * 1.e-6
+               fekeq (ji,jj,jk) = 10**( 17.27 - 1565.7 / ( 273.15 + ztc ) )
+
+            END DO
+         END DO
+      END DO
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_che')
+      !
+   END SUBROUTINE p4z_che
+
+
+   INTEGER FUNCTION p4z_che_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_che_alloc  ***
+      !!----------------------------------------------------------------------
+      ALLOCATE( sio3eq(jpi,jpj,jpk), fekeq(jpi,jpj,jpk), chemc(jpi,jpj,2), chemo2(jpi,jpj,jpk), STAT=p4z_che_alloc )
+      !
+      IF( p4z_che_alloc /= 0 )   CALL ctl_warn('p4z_che_alloc : failed to allocate arrays.')
+      !
+   END FUNCTION p4z_che_alloc
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_che( kt )                   ! Empty routine
+      INTEGER, INTENT(in) ::   kt
+      WRITE(*,*) 'p4z_che: You should not have seen this print! error?', kt
+   END SUBROUTINE p4z_che
+#endif 
+
+   !!======================================================================
+END MODULE  p4zche
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zfechem.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zfechem.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zfechem.F90	(revision 3680)
@@ -0,0 +1,396 @@
+MODULE p4zfechem
+   !!======================================================================
+   !!                         ***  MODULE p4zfechem  ***
+   !! TOP :   PISCES Compute iron chemistry and scavenging
+   !!======================================================================
+   !! History :   3.5  !  2012-07 (O. Aumont, A. Tagliabue, C. Ethe) Original code
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_top'       and                                      TOP models
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_fechem       :  Compute remineralization/scavenging of iron
+   !!   p4z_fechem_init  :  Initialisation of parameters for remineralisation
+   !!   p4z_fechem_alloc :  Allocate remineralisation variables
+   !!----------------------------------------------------------------------
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zopt          !  optical model
+   USE p4zche          !  chemical model
+   USE p4zsbc          !  Boundary conditions from sediments
+   USE prtctl_trc      !  print control for debugging
+   USE iom             !  I/O manager
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_fechem      ! called in p4zbio.F90
+   PUBLIC   p4z_fechem_init ! called in trcsms_pisces.F90
+
+   !! * Shared module variables
+   LOGICAL          ::  ln_fechem  = .FALSE.    !: boolean for complex iron chemistry following Tagliabue and voelker
+   LOGICAL          ::  ln_ligvar  = .FALSE.    !: boolean for variable ligand concentration following Tagliabue and voelker
+   REAL(wp), PUBLIC ::  xlam1      = 0.005_wp   !: scavenging rate of Iron 
+   REAL(wp), PUBLIC ::  xlamdust   = 150.0_wp   !: scavenging rate of Iron by dust 
+   REAL(wp), PUBLIC ::  ligand     = 0.6E-9_wp  !: ligand concentration in the ocean 
+
+   REAL(wp) :: kl1, kl2, kb1, kb2, ks, kpr, spd, con, kth
+
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zrem.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE p4z_fechem( kt, jnt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_fechem  ***
+      !!
+      !! ** Purpose :   Compute remineralization/scavenging of iron
+      !!
+      !! ** Method  :   2 different chemistry models are available for iron
+      !!                (1) The simple chemistry model of Aumont and Bopp (2006)
+      !!                    based on one ligand and one inorganic form
+      !!                (2) The complex chemistry model of Tagliabue and 
+      !!                    Voelker (2009) based on 2 ligands, 2 inorganic forms
+      !!                    and one particulate form (ln_fechem)
+      !!---------------------------------------------------------------------
+      !
+      INTEGER, INTENT(in) ::   kt, jnt ! ocean time step
+      !
+      INTEGER  ::   ji, jj, jk, jic
+      REAL(wp) ::   zdep, zlam1a, zlam1b, zlamfac
+      REAL(wp) ::   zkeq, zfeequi, zfesatur, zfecoll
+      REAL(wp) ::   zdenom1, zscave, zaggdfea, zaggdfeb, zcoag
+      REAL(wp) ::   ztrc, zdust
+#if ! defined key_kriest
+      REAL(wp) ::   zdenom, zdenom2
+#endif
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zTL1, zFe3, ztotlig
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zFeL1, zFeL2, zTL2, zFe2, zFeP
+      REAL(wp) :: zkox, zkph1, zkph2, zph, zionic, ztligand
+      REAL(wp) :: za, zb, zc, zkappa1, zkappa2, za0, za1, za2
+      REAL(wp) :: zxs, zfunc, zp, zq, zd, zr, zphi, zfff, zp3, zq2
+      REAL(wp) :: ztfe, zoxy
+      REAL(wp) :: zstep
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_fechem')
+      !
+      ! Allocate temporary workspace
+      CALL wrk_alloc( jpi, jpj, jpk, zFe3, zFeL1, zTL1, ztotlig )
+      zFe3 (:,:,:) = 0.
+      zFeL1(:,:,:) = 0.
+      zTL1 (:,:,:) = 0.
+      IF( ln_fechem ) THEN
+         CALL wrk_alloc( jpi, jpj, jpk, zFe2, zFeL2, zTL2, zFeP )
+         zFe2 (:,:,:) = 0.
+         zFeL2(:,:,:) = 0.
+         zTL2 (:,:,:) = 0.
+         zFeP (:,:,:) = 0.
+      ENDIF
+
+      ! Total ligand concentration : Ligands can be chosen to be constant or variable
+      ! Parameterization from Tagliabue and Voelker (2011)
+      ! -------------------------------------------------
+      IF( ln_ligvar ) THEN
+         ztotlig(:,:,:) =  0.09 * trn(:,:,:,jpdoc) * 1E6 + ligand * 1E9
+         ztotlig(:,:,:) =  MIN( ztotlig(:,:,:), 10. )
+      ELSE
+         ztotlig(:,:,:) = ligand * 1E9
+      ENDIF
+
+      IF( ln_fechem ) THEN
+         ! ------------------------------------------------------------
+         ! NEW FE CHEMISTRY ROUTINE from Tagliabue and Volker (2009)
+         ! This model is based on two ligands, Fe2+, Fe3+ and Fep
+         ! Chemistry is supposed to be fast enough to be at equilibrium
+         ! ------------------------------------------------------------
+!CDIR NOVERRCHK
+         DO jk = 1, jpkm1
+!CDIR NOVERRCHK
+            DO jj = 1, jpj
+!CDIR NOVERRCHK
+               DO ji = 1, jpi
+                  ! Calculate ligand concentrations : assume 2/3rd of excess goes to
+                  ! strong ligands (L1) and 1/3rd to weak ligands (L2)
+                  ztligand       = ztotlig(ji,jj,jk) - ligand * 1E9
+                  zTL1(ji,jj,jk) =                0.000001 + 0.67 * ztligand
+                  zTL2(ji,jj,jk) = ligand * 1E9 - 0.000001 + 0.33 * ztligand
+                  ! ionic strength from Millero et al. 1987
+                  zionic = 19.9201 * tsn(ji,jj,jk,jp_sal) / ( 1000. - 1.00488 * tsn(ji,jj,jk,jp_sal) + rtrn )
+                  zph    = -LOG10( MAX( hi(ji,jj,jk), rtrn) )
+                  zoxy   = trn(ji,jj,jk,jpoxy) * ( rhop(ji,jj,jk) / 1.e3 )
+                  ! Fe2+ oxydation rate from Santana-Casiano et al. (2005)
+                  zkox   = 35.407 - 6.7109 * zph + 0.5342 * zph * zph - 5362.6 / ( tsn(ji,jj,1,jp_tem) + 273.15 )  &
+                    &    - 0.04406 * SQRT( tsn(ji,jj,jk,jp_sal) ) - 0.002847 * tsn(ji,jj,jk,jp_sal)
+                  zkox   = ( 10.** zkox ) * spd
+                  zkox   = zkox * MAX( 1.e-6, zoxy) / ( chemo2(ji,jj,jk) + rtrn )
+                  ! PHOTOREDUCTION of complexed iron : Tagliabue and Arrigo (2006)
+                  zkph2 = MAX( 0., 15. * etot(ji,jj,jk) / ( etot(ji,jj,jk) + 2. ) )
+                  zkph1 = zkph2 / 5.
+                  ! pass the dfe concentration from PISCES
+                  ztfe = trn(ji,jj,jk,jpfer) * 1e9
+                  ! ----------------------------------------------------------
+                  ! ANALYTICAL SOLUTION OF ROOTS OF THE FE3+ EQUATION
+                  ! As shown in Tagliabue and Voelker (2009), Fe3+ is the root of a 3rd order polynom. 
+                  ! ----------------------------------------------------------
+                  ! calculate some parameters
+                  za = 1 + ks / kpr
+                  zb = 1 + ( zkph1 + kth ) / ( zkox + rtrn )
+                  zc = 1 + zkph2 / ( zkox + rtrn )
+                  zkappa1 = ( kb1 + zkph1 + kth ) / kl1
+                  zkappa2 = ( kb2 + zkph2 ) / kl2
+                  za2 = zTL1(ji,jj,jk) * zb / za + zTL2(ji,jj,jk) * zc / za + zkappa1 + zkappa2 - ztfe / za
+                  za1 = zkappa2 * zTL1(ji,jj,jk) * zb / za + zkappa1 * zTL2(ji,jj,jk) * zc / za &
+                      & + zkappa1 * zkappa2 - ( zkappa1 + zkappa2 ) * ztfe / za
+                  za0 = -zkappa1 * zkappa2 * ztfe / za
+                  zp  = za1 - za2 * za2 / 3.
+                  zq  = za2 * za2 * za2 * 2. / 27. - za2 * za1 / 3. + za0
+                  zp3 = zp / 3.
+                  zq2 = zq / 2.
+                  zd  = zp3 * zp3 * zp3 + zq2 * zq2
+                  zr  = zq / ABS( zq ) * SQRT( ABS( zp ) / 3. )
+                  ! compute the roots
+                  IF( zp > 0.) THEN
+                     ! zphi = ASINH( zq / ( 2. * zr * zr * zr ) )
+                     zphi =  zq / ( 2. * zr * zr * zr ) 
+                     zphi = LOG( zphi + SQRT( zphi * zphi + 1 ) )  ! asinh(x) = log(x + sqrt(x^2+1))
+                     zxs  = -2. * zr * SINH( zphi / 3. ) - za1 / 3.
+                  ELSE
+                     IF( zd > 0. ) THEN
+                        zfff = MAX( 1., zq / ( 2. * zr * zr * zr ) )
+                        ! zphi = ACOSH( zfff )
+                        zphi = LOG( zfff + SQRT( zfff * zfff - 1 ) )  ! acosh(x) = log(x + sqrt(x^2-1))
+                        zxs = -2. * zr * COSH( zphi / 3. ) - za1 / 3.
+                     ELSE
+                        zfff = MIN( 1., zq / ( 2. * zr * zr * zr ) )
+                        zphi = ACOS( zfff )
+                        DO jic = 1, 3
+                           zfunc = -2 * zr * COS( zphi / 3. + 2. * FLOAT( jic - 1 ) * rpi / 3. ) - za2 / 3.
+                           IF( zfunc > 0. .AND. zfunc <= ztfe)  zxs = zfunc
+                        END DO
+                     ENDIF
+                  ENDIF
+                  ! solve for the other Fe species
+                  zFe3(ji,jj,jk) = MAX( 0., zxs ) 
+                  zFep(ji,jj,jk) = MAX( 0., ( ks * zFe3(ji,jj,jk) / kpr ) )
+                  zkappa2 = ( kb2 + zkph2 ) / kl2
+                  zFeL2(ji,jj,jk) = MAX( 0., ( zFe3(ji,jj,jk) * zTL2(ji,jj,jk) ) / ( zkappa2 + zFe3(ji,jj,jk) ) )
+                  zFeL1(ji,jj,jk) = MAX( 0., ( ztfe / zb - za / zb * zFe3(ji,jj,jk) - zc / zb * zFeL2(ji,jj,jk) ) )
+                  zFe2 (ji,jj,jk) = MAX( 0., ( ( zkph1 * zFeL1(ji,jj,jk) + zkph2 * zFeL2(ji,jj,jk) ) / zkox ) )
+               END DO
+            END DO
+         END DO
+      ELSE
+         ! ------------------------------------------------------------
+         ! OLD FE CHEMISTRY ROUTINE from Aumont and Bopp (2006)
+         ! This model is based on one ligand and Fe' 
+         ! Chemistry is supposed to be fast enough to be at equilibrium
+         ! ------------------------------------------------------------
+!CDIR NOVERRCHK
+         DO jk = 1, jpkm1
+!CDIR NOVERRCHK
+            DO jj = 1, jpj
+!CDIR NOVERRCHK
+               DO ji = 1, jpi
+                  zTL1(ji,jj,jk) = ztotlig(ji,jj,jk)
+                  zkeq           = fekeq(ji,jj,jk)
+                  zfesatur       = zTL1(ji,jj,jk) * 1E-9
+                  ztfe           = trn(ji,jj,jk,jpfer) 
+                  ! Fe' is the root of a 2nd order polynom
+                  zFe3 (ji,jj,jk) = ( -( 1. + zfesatur * zkeq - zkeq * ztfe )               &
+                     &             + SQRT( ( 1. + zfesatur * zkeq - zkeq * ztfe )**2       &
+                     &               + 4. * ztfe * zkeq) ) / ( 2. * zkeq )
+                  zFe3 (ji,jj,jk) = zFe3(ji,jj,jk) * 1E9
+                  zFeL1(ji,jj,jk) = MAX( 0., trn(ji,jj,jk,jpfer) * 1E9 - zFe3(ji,jj,jk) )
+              END DO
+            END DO
+         END DO
+         !
+      ENDIF
+
+      zdust = 0.         ! if no dust available
+!CDIR NOVERRCHK
+      DO jk = 1, jpkm1
+!CDIR NOVERRCHK
+         DO jj = 1, jpj
+!CDIR NOVERRCHK
+            DO ji = 1, jpi
+               zstep = xstep
+# if defined key_degrad
+               zstep = zstep * facvol(ji,jj,jk)
+# endif
+               ! Scavenging rate of iron. This scavenging rate depends on the load of particles of sea water. 
+               ! This parameterization assumes a simple second order kinetics (k[Particles][Fe]).
+               ! Scavenging onto dust is also included as evidenced from the DUNE experiments.
+               ! --------------------------------------------------------------------------------------
+               IF( ln_fechem ) THEN
+                  zfeequi = ( zFe3(ji,jj,jk) + zFe2(ji,jj,jk) ) * 1E-9
+                  zfecoll = ( 0.3 * zFeL1(ji,jj,jk) + 0.5 * zFeL2(ji,jj,jk) ) * 1E-9
+               ELSE
+                  zfeequi = zFe3(ji,jj,jk) * 1E-9 
+                  zfecoll = 0.5 * zFeL1(ji,jj,jk) * 1E-9
+               ENDIF
+#if defined key_kriest
+               ztrc   = ( trn(ji,jj,jk,jppoc) + trn(ji,jj,jk,jpcal) + trn(ji,jj,jk,jpgsi) ) * 1.e6 
+#else
+               ztrc   = ( trn(ji,jj,jk,jppoc) + trn(ji,jj,jk,jpgoc) + trn(ji,jj,jk,jpcal) + trn(ji,jj,jk,jpgsi) ) * 1.e6 
+#endif
+               IF( ln_dust )  zdust  = dust(ji,jj) / ( wdust * 30.42 * 0.035 ) * tmask(ji,jj,jk)
+               zlam1b = 3.e-5 + xlamdust * zdust + xlam1 * ztrc
+               zscave = zfeequi * zlam1b * zstep
+
+               ! Compute the different ratios for scavenging of iron
+               ! to later allocate scavenged iron to the different organic pools
+               ! ---------------------------------------------------------
+               zdenom1 = xlam1 * trn(ji,jj,jk,jppoc) / zlam1b
+#if  defined key_kriest
+               zdenom2 = xlam1 * trn(ji,jj,jk,jpgoc) / zlam1b
+#endif
+
+               !  Increased scavenging for very high iron concentrations found near the coasts 
+               !  due to increased lithogenic particles and let say it is unknown processes (precipitation, ...)
+               !  -----------------------------------------------------------
+               zlamfac = MAX( 0.e0, ( gphit(ji,jj) + 55.) / 30. )
+               zlamfac = MIN( 1.  , zlamfac )
+               zdep    = MIN( 1., 1000. / fsdept(ji,jj,jk) )
+               zlam1b  = xlam1 * MAX( 0.e0, ( trn(ji,jj,jk,jpfer) * 1.e9 - ztotlig(ji,jj,jk) ) )
+               zcoag   = zfeequi * zlam1b * zstep + 1E-4 * ( 1. - zlamfac ) * zdep * zstep *zfecoll
+
+               !  Compute the coagulation of colloidal iron. This parameterization 
+               !  could be thought as an equivalent of colloidal pumping.
+               !  It requires certainly some more work as it is very poorly constrained.
+               !  ----------------------------------------------------------------
+               zlam1a  = ( 0.369  * 0.3 * trn(ji,jj,jk,jpdoc) + 102.4  * trn(ji,jj,jk,jppoc) ) * xdiss(ji,jj,jk)    &
+                   &   + ( 114.   * 0.3 * trn(ji,jj,jk,jpdoc) + 5.09E3 * trn(ji,jj,jk,jppoc) )
+               zaggdfea = zlam1a * zstep * zfecoll
+#if defined key_kriest
+               zaggdfeb = 0.
+               !
+               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) - zscave - zaggdfea - zaggdfeb - zcoag
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zscave * zdenom1 + zaggdfea + zaggdfeb
+#else
+               zlam1b = 3.53E3 *   trn(ji,jj,jk,jpgoc) * xdiss(ji,jj,jk) + 1E-4 * ( 1. - zlamfac ) * zdep 
+               zaggdfeb = zlam1b * zstep * zfecoll
+               !
+               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) - zscave - zaggdfea - zaggdfeb - zcoag
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zscave * zdenom1 + zaggdfea
+               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zscave * zdenom2 + zaggdfeb
+#endif
+            END DO
+         END DO
+      END DO
+      !
+      !  Define the bioavailable fraction of iron
+      !  ----------------------------------------
+      IF( ln_fechem ) THEN
+          biron(:,:,:) = MAX( 0., trn(:,:,:,jpfer) - zFeP(:,:,:) * 1E-9 )
+      ELSE
+          biron(:,:,:) = trn(:,:,:,jpfer) 
+      ENDIF
+
+      !  Output of some diagnostics variables
+      !     ---------------------------------
+      IF( ln_diatrc .AND. lk_iomput ) THEN
+         IF( jnt == nrdttrc ) THEN
+            CALL iom_put("Fe3"    , zFe3   (:,:,:)       * tmask(:,:,:) )   ! Fe3+
+            CALL iom_put("FeL1"   , zFeL1  (:,:,:)       * tmask(:,:,:) )   ! FeL1
+            CALL iom_put("TL1"    , zTL1   (:,:,:)       * tmask(:,:,:) )   ! TL1
+            CALL iom_put("Totlig" , ztotlig(:,:,:)       * tmask(:,:,:) )   ! TL
+            CALL iom_put("Biron"  , biron  (:,:,:) * 1e9 * tmask(:,:,:) )   ! biron
+            IF( ln_fechem ) THEN
+               CALL iom_put("Fe2" , zFe2   (:,:,:)       * tmask(:,:,:) )   ! Fe2+
+               CALL iom_put("FeL2", zFeL2  (:,:,:)       * tmask(:,:,:) )   ! FeL2
+               CALL iom_put("FeP" , zFeP   (:,:,:)       * tmask(:,:,:) )   ! FeP
+               CALL iom_put("TL2" , zTL2   (:,:,:)       * tmask(:,:,:) )   ! TL2
+            ENDIF
+         ENDIF
+      ENDIF
+
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('fechem')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+                       CALL wrk_dealloc( jpi, jpj, jpk, zFe3, zFeL1, zTL1, ztotlig )
+      IF( ln_fechem )  CALL wrk_dealloc( jpi, jpj, jpk, zFe2, zFeL2, zTL2, zFeP )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_fechem')
+      !
+   END SUBROUTINE p4z_fechem
+
+
+   SUBROUTINE p4z_fechem_init
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_fechem_init  ***
+      !!
+      !! ** Purpose :   Initialization of iron chemistry parameters
+      !!
+      !! ** Method  :   Read the nampisfer namelist and check the parameters
+      !!      called at the first timestep
+      !!
+      !! ** input   :   Namelist nampisfer
+      !!
+      !!----------------------------------------------------------------------
+      NAMELIST/nampisfer/ ln_fechem, ln_ligvar, xlam1, xlamdust, ligand 
+
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampisfer )
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist parameters for Iron chemistry, nampisfer'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    enable complex iron chemistry scheme      ln_fechem =', ln_fechem
+         WRITE(numout,*) '    variable concentration of ligand          ln_ligvar =', ln_ligvar
+         WRITE(numout,*) '    scavenging rate of Iron                   xlam1     =', xlam1
+         WRITE(numout,*) '    scavenging rate of Iron by dust           xlamdust  =', xlamdust
+         WRITE(numout,*) '    ligand concentration in the ocean         ligand    =', ligand
+      ENDIF
+      !
+      IF( ln_fechem ) THEN
+         ! initialization of some constants used by the complexe chemistry scheme
+         ! ----------------------------------------------------------------------
+         spd = 3600. * 24.
+         con = 1.E9
+         ! LIGAND KINETICS (values from Witter et al. 2000)
+         ! Weak (L2) ligands
+         ! Phaeophytin
+         kl2 = 12.2E5  * spd / con
+         kb2 = 12.3E-6 * spd
+         ! Strong (L1) ligands
+         ! Saccharides
+         ! kl1 = 12.2E5  * spd / con
+         ! kb1 = 12.3E-6 * spd
+         ! DFOB-
+         kl1 = 19.6e5  * spd / con
+         kb1 = 1.5e-6  * spd
+         ! pcp and remin of Fe3p
+         ks  = 0.075
+         kpr = 0.05
+         ! thermal reduction of Fe3
+         kth = 0.0048 * 24.
+         !
+      ENDIF
+      !
+   END SUBROUTINE p4z_fechem_init
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_fechem                    ! Empty routine
+   END SUBROUTINE p4z_fechem
+#endif 
+
+   !!======================================================================
+END MODULE p4zfechem
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zflx.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zflx.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zflx.F90	(revision 3680)
@@ -0,0 +1,372 @@
+MODULE p4zflx
+   !!======================================================================
+   !!                         ***  MODULE p4zflx  ***
+   !! TOP :   PISCES CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE
+   !!======================================================================
+   !! History :    -   !  1988-07  (E. MAIER-REIMER) Original code
+   !!              -   !  1998     (O. Aumont) additions
+   !!              -   !  1999     (C. Le Quere) modifications
+   !!             1.0  !  2004     (O. Aumont) modifications
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!                  !  2011-02  (J. Simeon, J. Orr) Include total atm P correction 
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_flx       :   CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE
+   !!   p4z_flx_init  :   Read the namelist
+   !!   p4z_patm      :   Read sfc atm pressure [atm] for each grid cell
+   !!----------------------------------------------------------------------
+   USE oce_trc                      !  shared variables between ocean and passive tracers 
+   USE trc                          !  passive tracers common variables
+   USE sms_pisces                   !  PISCES Source Minus Sink variables
+   USE p4zche                       !  Chemical model
+   USE prtctl_trc                   !  print control for debugging
+   USE iom                          !  I/O manager
+   USE fldread                      !  read input fields
+#if defined key_cpl_carbon_cycle
+   USE sbc_oce, ONLY :  atm_co2     !  atmospheric pCO2               
+#endif
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_flx  
+   PUBLIC   p4z_flx_init  
+   PUBLIC   p4z_flx_alloc  
+
+   !                                      !!** Namelist  nampisext  **
+   REAL(wp)          ::  atcco2    = 278._wp       !: pre-industrial atmospheric [co2] (ppm) 	
+   LOGICAL           ::  ln_co2int = .FALSE.       !: flag to read in a file and interpolate atmospheric pco2 or not
+   CHARACTER(len=34) ::  clname    = 'atcco2.txt'  !: filename of pco2 values
+   INTEGER           ::  nn_offset = 0             !: Offset model-data start year (default = 0) 
+
+   !!  Variables related to reading atmospheric CO2 time history    
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) :: atcco2h, years
+   INTEGER  :: nmaxrec, numco2
+
+   !                                         !!* nampisatm namelist (Atmospheric PRessure) *
+   LOGICAL, PUBLIC ::   ln_presatm = .true.  !: ref. pressure: global mean Patm (F) or a constant (F)
+
+   REAL(wp) , ALLOCATABLE, SAVE, DIMENSION(:,:)  ::  patm      ! atmospheric pressure at kt                 [N/m2]
+   TYPE(FLD), ALLOCATABLE,       DIMENSION(:)    ::  sf_patm   ! structure of input fields (file informations, fields read)
+
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: oce_co2   !: ocean carbon flux 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: satmco2   !: atmospheric pco2 
+
+   REAL(wp) ::  xconv  = 0.01_wp / 3600._wp !: coefficients for conversion 
+
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zflx.F90 3294 2012-01-28 16:44:18Z rblod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE p4z_flx ( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_flx  ***
+      !!
+      !! ** Purpose :   CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE
+      !!
+      !! ** Method  : 
+      !!              - Include total atm P correction via Esbensen & Kushnir (1981) 
+      !!              - Pressure correction NOT done for key_cpl_carbon_cycle
+      !!              - Remove Wanninkhof chemical enhancement;
+      !!              - Add option for time-interpolation of atcco2.txt  
+      !!---------------------------------------------------------------------
+      !
+      INTEGER, INTENT(in) ::   kt   !
+      !
+      INTEGER  ::   ji, jj, jm, iind, iindm1
+      REAL(wp) ::   ztc, ztc2, ztc3, zws, zkgwan
+      REAL(wp) ::   zfld, zflu, zfld16, zflu16, zfact
+      REAL(wp) ::   zph, zah2, zbot, zdic, zalk, zsch_o2, zalka, zsch_co2
+      REAL(wp) ::   zyr_dec, zdco2dt
+      CHARACTER (len=25) :: charout
+      REAL(wp), POINTER, DIMENSION(:,:) :: zkgco2, zkgo2, zh2co3, zoflx 
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_flx')
+      !
+      CALL wrk_alloc( jpi, jpj, zkgco2, zkgo2, zh2co3, zoflx )
+      !
+
+      ! SURFACE CHEMISTRY (PCO2 AND [H+] IN
+      !     SURFACE LAYER); THE RESULT OF THIS CALCULATION
+      !     IS USED TO COMPUTE AIR-SEA FLUX OF CO2
+
+      IF( kt /= nit000 ) CALL p4z_patm( kt )    ! Get sea-level pressure (E&K [1981] climatology) for use in flux calcs
+
+      IF( ln_co2int ) THEN 
+         ! Linear temporal interpolation  of atmospheric pco2.  atcco2.txt has annual values.
+         ! Caveats: First column of .txt must be in years, decimal  years preferably. 
+         ! For nn_offset, if your model year is iyy, nn_offset=(years(1)-iyy) 
+         ! then the first atmospheric CO2 record read is at years(1)
+         zyr_dec = REAL( nyear + nn_offset, wp ) + REAL( nday_year, wp ) / REAL( nyear_len(1), wp )
+         jm = 2
+         DO WHILE( jm <= nmaxrec .AND. years(jm-1) < zyr_dec .AND. years(jm) >= zyr_dec ) ;  jm = jm + 1 ;  END DO
+         iind = jm  ;   iindm1 = jm - 1
+         zdco2dt = ( atcco2h(iind) - atcco2h(iindm1) ) / ( years(iind) - years(iindm1) + rtrn )
+         atcco2  = zdco2dt * ( zyr_dec - years(iindm1) ) + atcco2h(iindm1)
+         satmco2(:,:) = atcco2 
+      ENDIF
+
+#if defined key_cpl_carbon_cycle
+      satmco2(:,:) = atm_co2(:,:)
+#endif
+
+      DO jm = 1, 10
+!CDIR NOVERRCHK
+         DO jj = 1, jpj
+!CDIR NOVERRCHK
+            DO ji = 1, jpi
+
+               ! DUMMY VARIABLES FOR DIC, H+, AND BORATE
+               zbot  = borat(ji,jj,1)
+               zfact = rhop(ji,jj,1) / 1000. + rtrn
+               zdic  = trn(ji,jj,1,jpdic) / zfact
+               zph   = MAX( hi(ji,jj,1), 1.e-10 ) / zfact
+               zalka = trn(ji,jj,1,jptal) / zfact
+
+               ! CALCULATE [ALK]([CO3--], [HCO3-])
+               zalk  = zalka - (  akw3(ji,jj,1) / zph - zph + zbot / ( 1.+ zph / akb3(ji,jj,1) )  )
+
+               ! CALCULATE [H+] AND [H2CO3]
+               zah2   = SQRT(  (zdic-zalk)**2 + 4.* ( zalk * ak23(ji,jj,1)   &
+                  &                                        / ak13(ji,jj,1) ) * ( 2.* zdic - zalk )  )
+               zah2   = 0.5 * ak13(ji,jj,1) / zalk * ( ( zdic - zalk ) + zah2 )
+               zh2co3(ji,jj) = ( 2.* zdic - zalk ) / ( 2.+ ak13(ji,jj,1) / zah2 ) * zfact
+               hi(ji,jj,1)   = zah2 * zfact
+            END DO
+         END DO
+      END DO
+
+
+      ! --------------
+      ! COMPUTE FLUXES
+      ! --------------
+
+      ! FIRST COMPUTE GAS EXCHANGE COEFFICIENTS
+      ! -------------------------------------------
+
+!CDIR NOVERRCHK
+      DO jj = 1, jpj
+!CDIR NOVERRCHK
+         DO ji = 1, jpi
+            ztc  = MIN( 35., tsn(ji,jj,1,jp_tem) )
+            ztc2 = ztc * ztc
+            ztc3 = ztc * ztc2 
+            ! Compute the schmidt Number both O2 and CO2
+            zsch_co2 = 2073.1 - 125.62 * ztc + 3.6276 * ztc2 - 0.043126 * ztc3
+            zsch_o2  = 1953.4 - 128.0  * ztc + 3.9918 * ztc2 - 0.050091 * ztc3
+            !  wind speed 
+            zws  = wndm(ji,jj) * wndm(ji,jj)
+            ! Compute the piston velocity for O2 and CO2
+            zkgwan = 0.3 * zws  + 2.5 * ( 0.5246 + 0.016256 * ztc + 0.00049946  * ztc2 )
+            zkgwan = zkgwan * xconv * ( 1.- fr_i(ji,jj) ) * tmask(ji,jj,1)
+# if defined key_degrad
+            zkgwan = zkgwan * facvol(ji,jj,1)
+#endif 
+            ! compute gas exchange for CO2 and O2
+            zkgco2(ji,jj) = zkgwan * SQRT( 660./ zsch_co2 )
+            zkgo2 (ji,jj) = zkgwan * SQRT( 660./ zsch_o2 )
+         END DO
+      END DO
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            ! Compute CO2 flux for the sea and air
+            zfld = satmco2(ji,jj) * patm(ji,jj) * tmask(ji,jj,1) * chemc(ji,jj,1) * zkgco2(ji,jj)   ! (mol/L) * (m/s)
+            zflu = zh2co3(ji,jj) * tmask(ji,jj,1) * zkgco2(ji,jj)                                   ! (mol/L) (m/s) ?
+            oce_co2(ji,jj) = ( zfld - zflu ) * rfact * e1e2t(ji,jj) * tmask(ji,jj,1) * 1000.
+            ! compute the trend
+            tra(ji,jj,1,jpdic) = tra(ji,jj,1,jpdic) + ( zfld - zflu ) / fse3t(ji,jj,1)
+
+            ! Compute O2 flux 
+            zfld16 = atcox * patm(ji,jj) * chemc(ji,jj,2) * tmask(ji,jj,1) * zkgo2(ji,jj)          ! (mol/L) * (m/s)
+            zflu16 = trn(ji,jj,1,jpoxy) * tmask(ji,jj,1) * zkgo2(ji,jj)
+            zoflx(ji,jj) = zfld16 - zflu16
+            tra(ji,jj,1,jpoxy) = tra(ji,jj,1,jpoxy) + zoflx(ji,jj) / fse3t(ji,jj,1)
+         END DO
+      END DO
+
+      t_oce_co2_flx = t_oce_co2_flx + glob_sum( oce_co2(:,:) )            ! Cumulative Total Flux of Carbon
+      t_atm_co2_flx = glob_sum( satmco2(:,:) * patm(:,:) * e1e2t(:,:) )   ! Total atmospheric pCO2
+
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('flx ')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+
+      IF( ln_diatrc ) THEN
+         IF( lk_iomput ) THEN
+            CALL iom_put( "Cflx" , oce_co2(:,:) / e1e2t(:,:) / rfact ) 
+            CALL iom_put( "Oflx" , zoflx(:,:) * 1000 * tmask(:,:,1)  )
+            CALL iom_put( "Kg"   , zkgco2(:,:) * tmask(:,:,1) )
+            CALL iom_put( "Dpco2", ( satmco2(:,:) * patm(:,:) - zh2co3(:,:) / ( chemc(:,:,1) + rtrn ) ) * tmask(:,:,1) )
+            CALL iom_put( "Dpo2" , ( atcox * patm(:,:) - trn(:,:,1,jpoxy) / ( chemc(:,:,2) + rtrn ) ) * tmask(:,:,1) )
+         ELSE
+            trc2d(:,:,jp_pcs0_2d    ) = oce_co2(:,:) / e1e2t(:,:) / rfact 
+            trc2d(:,:,jp_pcs0_2d + 1) = zoflx(:,:) * 1000 * tmask(:,:,1) 
+            trc2d(:,:,jp_pcs0_2d + 2) = zkgco2(:,:) * tmask(:,:,1) 
+            trc2d(:,:,jp_pcs0_2d + 3) = ( satmco2(:,:) * patm(:,:) - zh2co3(:,:) / ( chemc(:,:,1) + rtrn ) ) * tmask(:,:,1) 
+         ENDIF
+      ENDIF
+      !
+      CALL wrk_dealloc( jpi, jpj, zkgco2, zkgo2, zh2co3, zoflx )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_flx')
+      !
+   END SUBROUTINE p4z_flx
+
+
+   SUBROUTINE p4z_flx_init
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_flx_init  ***
+      !!
+      !! ** Purpose :   Initialization of atmospheric conditions
+      !!
+      !! ** Method  :   Read the nampisext namelist and check the parameters
+      !!      called at the first timestep (nittrc000)
+      !! ** input   :   Namelist nampisext
+      !!----------------------------------------------------------------------
+      NAMELIST/nampisext/ln_co2int, atcco2, clname, nn_offset
+      INTEGER :: jm
+      !!----------------------------------------------------------------------
+      !
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampisext )
+      !
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist parameters for air-sea exchange, nampisext'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    Choice for reading in the atm pCO2 file or constant value, ln_co2int =', ln_co2int
+         WRITE(numout,*) ' '
+      ENDIF
+      IF( .NOT.ln_co2int ) THEN
+         IF(lwp) THEN                         ! control print
+            WRITE(numout,*) '    Constant Atmospheric pCO2 value  atcco2    =', atcco2
+            WRITE(numout,*) ' '
+         ENDIF
+         satmco2(:,:)  = atcco2      ! Initialisation of atmospheric pco2
+      ELSE
+         IF(lwp)  THEN
+            WRITE(numout,*) '    Atmospheric pCO2 value  from file clname      =', TRIM( clname )
+            WRITE(numout,*) '    Offset model-data start year      nn_offset   =', nn_offset
+            WRITE(numout,*) ' '
+         ENDIF
+         CALL ctl_opn( numco2, TRIM( clname) , 'OLD', 'FORMATTED', 'SEQUENTIAL', -1 , numout, lwp )
+         jm = 0                      ! Count the number of record in co2 file
+         DO
+           READ(numco2,*,END=100) 
+           jm = jm + 1
+         END DO
+ 100     nmaxrec = jm - 1 
+         ALLOCATE( years  (nmaxrec) )     ;      years  (:) = 0._wp
+         ALLOCATE( atcco2h(nmaxrec) )     ;      atcco2h(:) = 0._wp
+
+         REWIND(numco2)
+         DO jm = 1, nmaxrec          ! get  xCO2 data
+            READ(numco2, *)  years(jm), atcco2h(jm)
+            IF(lwp) WRITE(numout, '(f6.0,f7.2)')  years(jm), atcco2h(jm)
+         END DO
+         CLOSE(numco2)
+      ENDIF
+      !
+      oce_co2(:,:)  = 0._wp                ! Initialization of Flux of Carbon
+      t_atm_co2_flx = 0._wp
+      t_oce_co2_flx = 0._wp
+      !
+      CALL p4z_patm( nit000 )
+      !
+   END SUBROUTINE p4z_flx_init
+
+   SUBROUTINE p4z_patm( kt )
+
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_atm  ***
+      !!
+      !! ** Purpose :   Read and interpolate the external atmospheric sea-levl pressure
+      !! ** Method  :   Read the files and interpolate the appropriate variables
+      !!
+      !!----------------------------------------------------------------------
+      !! * arguments
+      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
+      !
+      INTEGER            ::  ierr
+      CHARACTER(len=100) ::  cn_dir   ! Root directory for location of ssr files
+      TYPE(FLD_N)        ::  sn_patm  ! informations about the fields to be read
+      !!
+      NAMELIST/nampisatm/ ln_presatm, sn_patm, cn_dir
+
+      !                                         ! -------------------- !
+      IF( kt == nit000 ) THEN                   ! First call kt=nittrc000 !
+         !                                      ! -------------------- !
+         !                                            !* set file information (default values)
+         ! ... default values (NB: frequency positive => hours, negative => months)
+         !            !   file   ! frequency !  variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation !
+         !            !   name   !  (hours)  !   name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs    !
+         sn_patm = FLD_N( 'pres'  ,    24     ,  'patm'    ,  .false.   , .true.  ,   'yearly'  , ''       , ''       )
+         cn_dir  = './'          ! directory in which the Patm data are 
+
+         REWIND( numnatp )                             !* read in namlist nampisatm
+         READ  ( numnatp, nampisatm ) 
+         !
+         !
+         IF(lwp) THEN                                 !* control print
+            WRITE(numout,*)
+            WRITE(numout,*) '   Namelist nampisatm : Atmospheric Pressure as external forcing'
+            WRITE(numout,*) '      constant atmopsheric pressure (F) or from a file (T)  ln_presatm = ', ln_presatm
+            WRITE(numout,*)
+         ENDIF
+         !
+         IF( ln_presatm ) THEN
+            ALLOCATE( sf_patm(1), STAT=ierr )           !* allocate and fill sf_patm (forcing structure) with sn_patm
+            IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'p4z_flx: unable to allocate sf_patm structure' )
+            !
+            CALL fld_fill( sf_patm, (/ sn_patm /), cn_dir, 'p4z_flx', 'Atmospheric pressure ', 'nampisatm' )
+                                   ALLOCATE( sf_patm(1)%fnow(jpi,jpj,1)   )
+            IF( sn_patm%ln_tint )  ALLOCATE( sf_patm(1)%fdta(jpi,jpj,1,2) )
+         ENDIF
+         !                                         
+         IF( .NOT.ln_presatm )   patm(:,:) = 1.e0    ! Initialize patm if no reading from a file
+         !
+      ENDIF
+      !
+      IF( ln_presatm ) THEN
+         CALL fld_read( kt, 1, sf_patm )               !* input Patm provided at kt + 1/2
+         patm(:,:) = sf_patm(1)%fnow(:,:,1)                        ! atmospheric pressure
+      ENDIF
+      !
+   END SUBROUTINE p4z_patm
+
+   INTEGER FUNCTION p4z_flx_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_flx_alloc  ***
+      !!----------------------------------------------------------------------
+      ALLOCATE( oce_co2(jpi,jpj), satmco2(jpi,jpj), patm(jpi,jpj), STAT=p4z_flx_alloc )
+      !
+      IF( p4z_flx_alloc /= 0 )   CALL ctl_warn('p4z_flx_alloc : failed to allocate arrays')
+      !
+   END FUNCTION p4z_flx_alloc
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_flx( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'p4z_flx: You should not have seen this print! error?', kt
+   END SUBROUTINE p4z_flx
+#endif 
+
+   !!======================================================================
+END MODULE  p4zflx
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zint.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zint.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zint.F90	(revision 3680)
@@ -0,0 +1,83 @@
+MODULE p4zint
+   !!======================================================================
+   !!                         ***  MODULE p4zint  ***
+   !! TOP :   PISCES interpolation and computation of various accessory fields
+   !!======================================================================
+   !! History :   1.0  !  2004-03 (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_int        :  interpolation and computation of various accessory fields
+   !!----------------------------------------------------------------------
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE iom
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_int  
+   REAL(wp) ::   xksilim = 16.5e-6_wp   ! Half-saturation constant for the Si half-saturation constant computation
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zint.F90 3294 2012-01-28 16:44:18Z rblod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE p4z_int( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_int  ***
+      !!
+      !! ** Purpose :   interpolation and computation of various accessory fields
+      !!
+      !!---------------------------------------------------------------------
+      !
+      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
+      !
+      INTEGER  :: ji, jj                 ! dummy loop indices
+      REAL(wp) :: zvar                   ! local variable
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_int')
+      !
+      ! Computation of phyto and zoo metabolic rate
+      ! -------------------------------------------
+      tgfunc (:,:,:) = EXP( 0.063913 * tsn(:,:,:,jp_tem) )
+      tgfunc2(:,:,:) = EXP( 0.07608  * tsn(:,:,:,jp_tem) )
+
+      ! Computation of the silicon dependant half saturation  constant for silica uptake
+      ! ---------------------------------------------------
+      DO ji = 1, jpi
+         DO jj = 1, jpj
+            zvar = trn(ji,jj,1,jpsil) * trn(ji,jj,1,jpsil)
+            xksimax(ji,jj) = MAX( xksimax(ji,jj), ( 1.+ 7.* zvar / ( xksilim * xksilim + zvar ) ) * 1e-6 )
+         END DO
+      END DO
+      !
+      IF( nday_year == nyear_len(1) ) THEN
+         xksi   (:,:) = xksimax(:,:)
+         xksimax(:,:) = 0._wp
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_int')
+      !
+   END SUBROUTINE p4z_int
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_int                   ! Empty routine
+      WRITE(*,*) 'p4z_int: You should not have seen this print! error?'
+   END SUBROUTINE p4z_int
+#endif 
+
+   !!======================================================================
+END MODULE  p4zint
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zlim.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zlim.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zlim.F90	(revision 3680)
@@ -0,0 +1,260 @@
+MODULE p4zlim
+   !!======================================================================
+   !!                         ***  MODULE p4zlim  ***
+   !! TOP :   PISCES 
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!             3.4  !  2011-04  (O. Aumont, C. Ethe) Limitation for iron modelled in quota 
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_lim        :   Compute the nutrients limitation terms 
+   !!   p4z_lim_init   :   Read the namelist 
+   !!----------------------------------------------------------------------
+   USE oce_trc         ! Shared ocean-passive tracers variables
+   USE trc             ! Tracers defined
+   USE sms_pisces      ! PISCES variables
+   USE p4zopt          ! Optical
+   USE iom             !  I/O manager
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC p4z_lim    
+   PUBLIC p4z_lim_init    
+
+   !! * Shared module variables
+   REAL(wp), PUBLIC ::  concnno3  = 1.e-6_wp      !:  NO3, PO4 half saturation   
+   REAL(wp), PUBLIC ::  concdno3  = 2.e-6_wp      !:  Phosphate half saturation for diatoms  
+   REAL(wp), PUBLIC ::  concnnh4  = 1.e-7_wp      !:  NH4 half saturation for phyto  
+   REAL(wp), PUBLIC ::  concdnh4  = 2.e-7_wp      !:  NH4 half saturation for diatoms
+   REAL(wp), PUBLIC ::  concnfer  = 1.e-9_wp      !:  Iron half saturation for nanophyto 
+   REAL(wp), PUBLIC ::  concdfer  = 2.e-9_wp      !:  Iron half saturation for diatoms  
+   REAL(wp), PUBLIC ::  concbno3  = 2.5e-7_wp      !:  NO3 half saturation  for bacteria 
+   REAL(wp), PUBLIC ::  concbnh4  = 2.5e-8_wp      !:  NH4 half saturation for bacteria
+   REAL(wp), PUBLIC ::  xsizedia  = 5.e-7_wp      !:  Minimum size criteria for diatoms
+   REAL(wp), PUBLIC ::  xsizephy  = 1.e-6_wp      !:  Minimum size criteria for nanophyto
+   REAL(wp), PUBLIC ::  xsizern   = 3.0_wp        !:  Size ratio for nanophytoplankton
+   REAL(wp), PUBLIC ::  xsizerd   = 4.0_wp        !:  Size ratio for diatoms
+   REAL(wp), PUBLIC ::  xksi1     = 2.E-6_wp      !:  half saturation constant for Si uptake 
+   REAL(wp), PUBLIC ::  xksi2     = 3.33e-6_wp    !:  half saturation constant for Si/C 
+   REAL(wp), PUBLIC ::  xkdoc     = 417.e-6_wp    !:  2nd half-sat. of DOC remineralization  
+   REAL(wp), PUBLIC ::  concbfe   = 1.E-11_wp     !:  Fe half saturation for bacteria 
+   REAL(wp), PUBLIC ::  qnfelim   = 7.E-6_wp      !:  optimal Fe quota for nanophyto
+   REAL(wp), PUBLIC ::  qdfelim   = 7.E-6_wp      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  caco3r    = 0.16_wp       !:  mean rainratio 
+
+   ! Coefficient for iron limitation
+   REAL(wp) ::  xcoef1   = 0.0016  / 55.85  
+   REAL(wp) ::  xcoef2   = 1.21E-5 * 14. / 55.85 / 7.625 * 0.5 * 1.5
+   REAL(wp) ::  xcoef3   = 1.15E-4 * 14. / 55.85 / 7.625 * 0.5 
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zlim.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_lim( kt, jnt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_lim  ***
+      !!
+      !! ** Purpose :   Compute the co-limitations by the various nutrients
+      !!              for the various phytoplankton species
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      !
+      INTEGER, INTENT(in)  :: kt, jnt
+      !
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zlim1, zlim2, zlim3, zlim4, zno3, zferlim
+      REAL(wp) ::   zconcd, zconcd2, zconcn, zconcn2
+      REAL(wp) ::   z1_trndia, z1_trnphy, ztem1, ztem2, zetot1, zetot2
+      REAL(wp) ::   zdenom, zratio, zironmin
+      REAL(wp) ::   zconc1d, zconc1dnh4, zconc0n, zconc0nnh4   
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_lim')
+      !
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               
+               ! Tuning of the iron concentration to a minimum level that is set to the detection limit
+               !-------------------------------------
+               zno3    = trn(ji,jj,jk,jpno3) / 40.e-6
+               zferlim = MAX( 3e-11 * zno3 * zno3, 5e-12 )
+               zferlim = MIN( zferlim, 5e-11 )
+               trn(ji,jj,jk,jpfer) = MAX( trn(ji,jj,jk,jpfer), zferlim )
+
+               ! Computation of a variable Ks for iron on diatoms taking into account
+               ! that increasing biomass is made of generally bigger cells
+               !------------------------------------------------
+               zconcd   = MAX( 0.e0 , trn(ji,jj,jk,jpdia) - xsizedia )
+               zconcd2  = trn(ji,jj,jk,jpdia) - zconcd
+               zconcn   = MAX( 0.e0 , trn(ji,jj,jk,jpphy) - xsizephy )
+               zconcn2  = trn(ji,jj,jk,jpphy) - zconcn
+               z1_trnphy   = 1. / ( trn(ji,jj,jk,jpphy) + rtrn )
+               z1_trndia   = 1. / ( trn(ji,jj,jk,jpdia) + rtrn )
+
+               concdfe(ji,jj,jk) = MAX( concdfer, ( zconcd2 * concdfer + concdfer * xsizerd * zconcd ) * z1_trndia )
+               zconc1d           = MAX( concdno3, ( zconcd2 * concdno3 + concdno3 * xsizerd * zconcd ) * z1_trndia )
+               zconc1dnh4        = MAX( concdnh4, ( zconcd2 * concdnh4 + concdnh4 * xsizerd * zconcd ) * z1_trndia )
+
+               concnfe(ji,jj,jk) = MAX( concnfer, ( zconcn2 * concnfer + concnfer * xsizern * zconcn ) * z1_trnphy )
+               zconc0n           = MAX( concnno3, ( zconcn2 * concnno3 + concnno3 * xsizern * zconcn ) * z1_trnphy )
+               zconc0nnh4        = MAX( concnnh4, ( zconcn2 * concnnh4 + concnnh4 * xsizern * zconcn ) * z1_trnphy )
+
+               ! Michaelis-Menten Limitation term for nutrients Small bacteria
+               ! -------------------------------------------------------------
+               zdenom = 1. /  ( concbno3 * concbnh4 + concbnh4 * trn(ji,jj,jk,jpno3) + concbno3 * trn(ji,jj,jk,jpnh4) )
+               xnanono3(ji,jj,jk) = trn(ji,jj,jk,jpno3) * concbnh4 * zdenom
+               xnanonh4(ji,jj,jk) = trn(ji,jj,jk,jpnh4) * concbno3 * zdenom
+               !
+               zlim1    = xnanono3(ji,jj,jk) + xnanonh4(ji,jj,jk)
+               zlim2    = trn(ji,jj,jk,jppo4) / ( trn(ji,jj,jk,jppo4) + concbnh4 )
+               zlim3    = trn(ji,jj,jk,jpfer) / ( concbfe + trn(ji,jj,jk,jpfer) )
+               zlim4    = trn(ji,jj,jk,jpdoc) / ( xkdoc   + trn(ji,jj,jk,jpdoc) )
+               xlimbacl(ji,jj,jk) = MIN( zlim1, zlim2, zlim3 )
+               xlimbac (ji,jj,jk) = MIN( zlim1, zlim2, zlim3 ) * zlim4
+
+               ! Michaelis-Menten Limitation term for nutrients Small flagellates
+               ! -----------------------------------------------
+               zdenom = 1. /  ( zconc0n * zconc0nnh4 + zconc0nnh4 * trn(ji,jj,jk,jpno3) + zconc0n * trn(ji,jj,jk,jpnh4) )
+               xnanono3(ji,jj,jk) = trn(ji,jj,jk,jpno3) * zconc0nnh4 * zdenom
+               xnanonh4(ji,jj,jk) = trn(ji,jj,jk,jpnh4) * zconc0n    * zdenom
+               !
+               zlim1    = xnanono3(ji,jj,jk) + xnanonh4(ji,jj,jk)
+               zlim2    = trn(ji,jj,jk,jppo4) / ( trn(ji,jj,jk,jppo4) + zconc0nnh4 )
+               zratio   = trn(ji,jj,jk,jpnfe) * z1_trnphy 
+               zironmin = xcoef1 * trn(ji,jj,jk,jpnch) * z1_trnphy + xcoef2 * zlim1 + xcoef3 * xnanono3(ji,jj,jk)
+               zlim3    = MAX( 0.,( zratio - zironmin ) / qnfelim )
+               xlimnfe(ji,jj,jk) = MIN( 1., zlim3 )
+               xlimphy(ji,jj,jk) = MIN( zlim1, zlim2, zlim3 )
+               !
+               !   Michaelis-Menten Limitation term for nutrients Diatoms
+               !   ----------------------------------------------
+               zdenom   = 1. / ( zconc1d * zconc1dnh4 + zconc1dnh4 * trn(ji,jj,jk,jpno3) + zconc1d * trn(ji,jj,jk,jpnh4) )
+               xdiatno3(ji,jj,jk) = trn(ji,jj,jk,jpno3) * zconc1dnh4 * zdenom
+               xdiatnh4(ji,jj,jk) = trn(ji,jj,jk,jpnh4) * zconc1d    * zdenom
+               !
+               zlim1    = xdiatno3(ji,jj,jk) + xdiatnh4(ji,jj,jk)
+               zlim2    = trn(ji,jj,jk,jppo4) / ( trn(ji,jj,jk,jppo4) + zconc1dnh4  )
+               zlim3    = trn(ji,jj,jk,jpsil) / ( trn(ji,jj,jk,jpsil) + xksi(ji,jj) )
+               zratio   = trn(ji,jj,jk,jpdfe) * z1_trndia
+               zironmin = xcoef1 * trn(ji,jj,jk,jpdch) * z1_trndia + xcoef2 * zlim1 + xcoef3 * xdiatno3(ji,jj,jk)
+               zlim4    = MAX( 0., ( zratio - zironmin ) / qdfelim )
+               xlimdfe(ji,jj,jk) = MIN( 1., zlim4 )
+               xlimdia(ji,jj,jk) = MIN( zlim1, zlim2, zlim3, zlim4 )
+               xlimsi(ji,jj,jk)  = MIN( zlim1, zlim2, zlim4 )
+           END DO
+         END DO
+      END DO
+
+      ! Compute the fraction of nanophytoplankton that is made of calcifiers
+      ! --------------------------------------------------------------------
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zlim1 =  ( trn(ji,jj,jk,jpno3) * concnnh4 + trn(ji,jj,jk,jpnh4) * concnno3 )    &
+                  &   / ( concnno3 * concnnh4 + concnnh4 * trn(ji,jj,jk,jpno3) + concnno3 * trn(ji,jj,jk,jpnh4) ) 
+               zlim2  = trn(ji,jj,jk,jppo4) / ( trn(ji,jj,jk,jppo4) + concnnh4 )
+               zlim3  = trn(ji,jj,jk,jpfer) / ( trn(ji,jj,jk,jpfer) +  5.E-11   )
+               ztem1  = MAX( 0., tsn(ji,jj,jk,jp_tem) )
+               ztem2  = tsn(ji,jj,jk,jp_tem) - 10.
+               zetot1 = MAX( 0., etot(ji,jj,jk) - 1.) / ( 4. + etot(ji,jj,jk) ) 
+               zetot2 = 30. / ( 30. + etot(ji,jj,jk) ) 
+
+               xfracal(ji,jj,jk) = caco3r * MIN( zlim1, zlim2, zlim3 )                  &
+                  &                       * ztem1 / ( 0.1 + ztem1 )                     &
+                  &                       * MAX( 1., trn(ji,jj,jk,jpphy) * 1.e6 / 2. )  &
+                  &                       * zetot1 * zetot2               &
+                  &                       * ( 1. + EXP(-ztem2 * ztem2 / 25. ) )         &
+                  &                       * MIN( 1., 50. / ( hmld(ji,jj) + rtrn ) )
+               xfracal(ji,jj,jk) = MIN( 0.8 , xfracal(ji,jj,jk) )
+               xfracal(ji,jj,jk) = MAX( 0.02, xfracal(ji,jj,jk) )
+            END DO
+         END DO
+      END DO
+      !
+      IF( ln_diatrc .AND. lk_iomput .AND. jnt == nrdttrc ) THEN        ! save output diagnostics
+        !
+        CALL iom_put( "xfracal", xfracal(:,:,:) * tmask(:,:,:) )  ! euphotic layer deptht
+        CALL iom_put( "LNnut"  , xlimphy(:,:,:) * tmask(:,:,:) )  ! Nutrient limitation term
+        CALL iom_put( "LDnut"  , xlimdia(:,:,:) * tmask(:,:,:) )  ! Nutrient limitation term
+        CALL iom_put( "LNFe"   , xlimnfe(:,:,:) * tmask(:,:,:) )  ! Iron limitation term
+        CALL iom_put( "LDFe"   , xlimdfe(:,:,:) * tmask(:,:,:) )  ! Iron limitation term
+        !
+      ENDIF
+
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_lim')
+      !
+   END SUBROUTINE p4z_lim
+
+   SUBROUTINE p4z_lim_init
+
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_lim_init  ***
+      !!
+      !! ** Purpose :   Initialization of nutrient limitation parameters
+      !!
+      !! ** Method  :   Read the nampislim namelist and check the parameters
+      !!      called at the first timestep (nittrc000)
+      !!
+      !! ** input   :   Namelist nampislim
+      !!
+      !!----------------------------------------------------------------------
+
+      NAMELIST/nampislim/ concnno3, concdno3, concnnh4, concdnh4, concnfer, concdfer, concbfe,   &
+         &                concbno3, concbnh4, xsizedia, xsizephy, xsizern, xsizerd,          & 
+         &                xksi1, xksi2, xkdoc, qnfelim, qdfelim, caco3r
+
+      REWIND( numnatp )                     ! read numnat
+      READ  ( numnatp, nampislim )
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist parameters for nutrient limitations, nampislim'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    mean rainratio                           caco3r    = ', caco3r
+         WRITE(numout,*) '    NO3 half saturation of nanophyto         concnno3  = ', concnno3
+         WRITE(numout,*) '    NO3 half saturation of diatoms           concdno3  = ', concdno3
+         WRITE(numout,*) '    NH4 half saturation for phyto            concnnh4  = ', concnnh4
+         WRITE(numout,*) '    NH4 half saturation for diatoms          concdnh4  = ', concdnh4
+         WRITE(numout,*) '    half saturation constant for Si uptake   xksi1     = ', xksi1
+         WRITE(numout,*) '    half saturation constant for Si/C        xksi2     = ', xksi2
+         WRITE(numout,*) '    half-sat. of DOC remineralization        xkdoc     = ', xkdoc
+         WRITE(numout,*) '    Iron half saturation for nanophyto       concnfer  = ', concnfer
+         WRITE(numout,*) '    Iron half saturation for diatoms         concdfer  = ', concdfer
+         WRITE(numout,*) '    size ratio for nanophytoplankton         xsizern   = ', xsizern
+         WRITE(numout,*) '    size ratio for diatoms                   xsizerd   = ', xsizerd
+         WRITE(numout,*) '    NO3 half saturation of bacteria          concbno3  = ', concbno3
+         WRITE(numout,*) '    NH4 half saturation for bacteria         concbnh4  = ', concbnh4
+         WRITE(numout,*) '    Minimum size criteria for diatoms        xsizedia  = ', xsizedia
+         WRITE(numout,*) '    Minimum size criteria for nanophyto      xsizephy  = ', xsizephy
+         WRITE(numout,*) '    Fe half saturation for bacteria          concbfe   = ', concbfe
+         WRITE(numout,*) '    optimal Fe quota for nano.               qnfelim   = ', qnfelim
+         WRITE(numout,*) '    Optimal Fe quota for diatoms             qdfelim   = ', qdfelim
+      ENDIF
+
+   END SUBROUTINE p4z_lim_init
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_lim                   ! Empty routine
+   END SUBROUTINE p4z_lim
+#endif 
+
+   !!======================================================================
+END MODULE  p4zlim
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zlys.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zlys.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zlys.F90	(revision 3680)
@@ -0,0 +1,223 @@
+MODULE p4zlys
+   !!======================================================================
+   !!                         ***  MODULE p4zlys  ***
+   !! TOP :   PISCES 
+   !!======================================================================
+   !! History :    -   !  1988-07  (E. MAIER-REIMER) Original code
+   !!              -   !  1998     (O. Aumont) additions
+   !!              -   !  1999     (C. Le Quere) modifications
+   !!             1.0  !  2004     (O. Aumont) modifications
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!                  !  2011-02  (J. Simeon, J. Orr)  Calcon salinity dependence
+   !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Improvment of calcite dissolution
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_lys        :   Compute the CaCO3 dissolution 
+   !!   p4z_lys_init   :   Read the namelist parameters
+   !!----------------------------------------------------------------------
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE prtctl_trc      !  print control for debugging
+   USE iom             !  I/O manager
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_lys         ! called in trcsms_pisces.F90
+   PUBLIC   p4z_lys_init    ! called in trcsms_pisces.F90
+
+   !! * Shared module variables
+   REAL(wp), PUBLIC :: kdca = 0.327e3_wp  !: diss. rate constant calcite
+   REAL(wp), PUBLIC :: nca  = 1.0_wp      !: order of reaction for calcite dissolution
+
+   !! * Module variables
+   REAL(wp) :: calcon = 1.03E-2           !: mean calcite concentration [Ca2+] in sea water [mole/kg solution]
+ 
+   INTEGER  :: rmtss                      !: number of seconds per month 
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zlys.F90 3321 2012-03-05 17:10:55Z cetlod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_lys( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_lys  ***
+      !!
+      !! ** Purpose :   CALCULATES DEGREE OF CACO3 SATURATION IN THE WATER
+      !!                COLUMN, DISSOLUTION/PRECIPITATION OF CACO3 AND LOSS
+      !!                OF CACO3 TO THE CACO3 SEDIMENT POOL.
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      !
+      INTEGER, INTENT(in) ::   kt ! ocean time step
+      INTEGER  ::   ji, jj, jk, jn
+      REAL(wp) ::   zalk, zdic, zph, zah2
+      REAL(wp) ::   zdispot, zfact, zcalcon, zalka, zaldi
+      REAL(wp) ::   zomegaca, zexcess, zexcess0
+      REAL(wp) ::   zrfact2
+      CHARACTER (len=25) :: charout
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zco3, zcaldiss   
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_lys')
+      !
+      CALL wrk_alloc( jpi, jpj, jpk, zco3, zcaldiss )
+      !
+      zco3    (:,:,:) = 0.
+      zcaldiss(:,:,:) = 0.
+      !     -------------------------------------------
+      !     COMPUTE [CO3--] and [H+] CONCENTRATIONS
+      !     -------------------------------------------
+      
+      DO jn = 1, 5                               !  BEGIN OF ITERATION
+         !
+!CDIR NOVERRCHK
+         DO jk = 1, jpkm1
+!CDIR NOVERRCHK
+            DO jj = 1, jpj
+!CDIR NOVERRCHK
+               DO ji = 1, jpi
+                  zfact = rhop(ji,jj,jk) / 1000. + rtrn
+                  zph  = hi(ji,jj,jk) * tmask(ji,jj,jk) / zfact + ( 1.-tmask(ji,jj,jk) ) * 1.e-9 ! [H+]
+                  zdic  = trn(ji,jj,jk,jpdic) / zfact
+                  zalka = trn(ji,jj,jk,jptal) / zfact
+                  ! CALCULATE [ALK]([CO3--], [HCO3-])
+                  zalk  = zalka - ( akw3(ji,jj,jk) / zph - zph + borat(ji,jj,jk) / ( 1. + zph / akb3(ji,jj,jk) ) )
+                  ! CALCULATE [H+] and [CO3--]
+                  zaldi = zdic - zalk
+                  zah2  = SQRT( zaldi * zaldi + 4.* ( zalk * ak23(ji,jj,jk) / ak13(ji,jj,jk) ) * ( zdic + zaldi ) )
+                  zah2  = 0.5 * ak13(ji,jj,jk) / zalk * ( zaldi + zah2 )
+                  !
+                  zco3(ji,jj,jk) = zalk / ( 2. + zah2 / ak23(ji,jj,jk) ) * zfact
+                  hi(ji,jj,jk)   = zah2 * zfact
+               END DO
+            END DO
+         END DO
+         !
+      END DO 
+
+      !     ---------------------------------------------------------
+      !        CALCULATE DEGREE OF CACO3 SATURATION AND CORRESPONDING
+      !        DISSOLOUTION AND PRECIPITATION OF CACO3 (BE AWARE OF
+      !        MGCO3)
+      !     ---------------------------------------------------------
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+               ! DEVIATION OF [CO3--] FROM SATURATION VALUE
+               ! Salinity dependance in zomegaca and divide by rhop/1000 to have good units
+               zcalcon  = calcon * ( tsn(ji,jj,jk,jp_sal) / 35._wp )
+               zfact    = rhop(ji,jj,jk) / 1000._wp
+               zomegaca = ( zcalcon * zco3(ji,jj,jk) * zfact ) / aksp(ji,jj,jk) 
+
+               ! SET DEGREE OF UNDER-/SUPERSATURATION
+               excess(ji,jj,jk) = 1._wp - zomegaca
+               zexcess0 = MAX( 0., excess(ji,jj,jk) )
+               zexcess  = zexcess0**nca
+
+               ! AMOUNT CACO3 (12C) THAT RE-ENTERS SOLUTION
+               !       (ACCORDING TO THIS FORMULATION ALSO SOME PARTICULATE
+               !       CACO3 GETS DISSOLVED EVEN IN THE CASE OF OVERSATURATION)
+               zdispot = kdca * zexcess * trn(ji,jj,jk,jpcal)
+# if defined key_degrad
+               zdispot = zdispot * facvol(ji,jj,jk)
+# endif
+              !  CHANGE OF [CO3--] , [ALK], PARTICULATE [CACO3],
+              !       AND [SUM(CO2)] DUE TO CACO3 DISSOLUTION/PRECIPITATION
+              zcaldiss(ji,jj,jk)  = zdispot / rmtss  ! calcite dissolution
+              zco3(ji,jj,jk)      = zco3(ji,jj,jk) + zcaldiss(ji,jj,jk) * rfact
+              !
+              tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + 2. * zcaldiss(ji,jj,jk)
+              tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) -      zcaldiss(ji,jj,jk)
+              tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) +      zcaldiss(ji,jj,jk)
+            END DO
+         END DO
+      END DO
+      !
+      IF( ln_diatrc )  THEN
+         !
+         IF( lk_iomput ) THEN
+            zrfact2 = 1.e3 * rfact2r
+            CALL iom_put( "PH"    , -1. * LOG10( hi(:,:,:) )                * tmask(:,:,:) )
+            CALL iom_put( "CO3"   ,        zco3    (:,:,:) * 1e+3           * tmask(:,:,:) )
+            CALL iom_put( "CO3sat",        aksp    (:,:,:) * 1e+3 / calcon  * tmask(:,:,:) )
+            CALL iom_put( "DCAL"  ,        zcaldiss(:,:,:) * zrfact2        * tmask(:,:,:) )
+         ELSE
+            trc3d(:,:,:,jp_pcs0_3d    ) = -1. * LOG10( hi(:,:,:) ) * tmask(:,:,:)
+            trc3d(:,:,:,jp_pcs0_3d + 1) = zco3(:,:,:)              * tmask(:,:,:)
+            trc3d(:,:,:,jp_pcs0_3d + 2) = aksp(:,:,:) / calcon     * tmask(:,:,:)
+         ENDIF
+         !
+      ENDIF
+      !
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+        WRITE(charout, FMT="('lys ')")
+        CALL prt_ctl_trc_info(charout)
+        CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      CALL wrk_dealloc( jpi, jpj, jpk, zco3, zcaldiss )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_lys')
+      !
+   END SUBROUTINE p4z_lys
+
+   SUBROUTINE p4z_lys_init
+
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_lys_init  ***
+      !!
+      !! ** Purpose :   Initialization of CaCO3 dissolution parameters
+      !!
+      !! ** Method  :   Read the nampiscal namelist and check the parameters
+      !!      called at the first timestep (nittrc000)
+      !!
+      !! ** input   :   Namelist nampiscal
+      !!
+      !!----------------------------------------------------------------------
+      INTEGER  ::  ji, jj, jk
+      REAL(wp) ::  zcaralk, zbicarb, zco3
+      REAL(wp) ::  ztmas, ztmas1
+
+      NAMELIST/nampiscal/ kdca, nca
+      !!----------------------------------------------------------------------
+
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampiscal )
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist parameters for CaCO3 dissolution, nampiscal'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    diss. rate constant calcite (per month)   kdca      =', kdca
+         WRITE(numout,*) '    order of reaction for calcite dissolution nca       =', nca
+      ENDIF
+
+      ! Number of seconds per month 
+      rmtss =  nyear_len(1) * rday / raamo
+      !
+   END SUBROUTINE p4z_lys_init
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_lys( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'p4z_lys: You should not have seen this print! error?', kt
+   END SUBROUTINE p4z_lys
+#endif 
+   !!======================================================================
+END MODULE  p4zlys
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmeso.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmeso.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmeso.F90	(revision 3680)
@@ -0,0 +1,297 @@
+MODULE p4zmeso
+   !!======================================================================
+   !!                         ***  MODULE p4zmeso  ***
+   !! TOP :   PISCES Compute the sources/sinks for mesozooplankton
+   !!======================================================================
+   !! History :   1.0  !  2002     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Quota model for iron
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_meso       :   Compute the sources/sinks for mesozooplankton
+   !!   p4z_meso_init  :   Initialization of the parameters for mesozooplankton
+   !!----------------------------------------------------------------------
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zsink         !  vertical flux of particulate matter due to sinking
+   USE p4zint          !  interpolation and computation of various fields
+   USE p4zprod         !  production
+   USE prtctl_trc      !  print control for debugging
+   USE iom             !  I/O manager
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_meso              ! called in p4zbio.F90
+   PUBLIC   p4z_meso_init         ! called in trcsms_pisces.F90
+
+   !! * Shared module variables
+   REAL(wp), PUBLIC ::  part2       = 0.5_wp     !: part of calcite not dissolved in mesozoo guts
+   REAL(wp), PUBLIC ::  xprefc      = 1.0_wp     !: mesozoo preference for POC 
+   REAL(wp), PUBLIC ::  xprefp      = 0.3_wp     !: mesozoo preference for nanophyto
+   REAL(wp), PUBLIC ::  xprefz      = 1.0_wp     !: mesozoo preference for diatoms
+   REAL(wp), PUBLIC ::  xprefpoc    = 0.3_wp     !: mesozoo preference for POC 
+   REAL(wp), PUBLIC ::  xthresh2zoo = 1E-8_wp    !: zoo feeding threshold for mesozooplankton 
+   REAL(wp), PUBLIC ::  xthresh2dia = 1E-8_wp    !: diatoms feeding threshold for mesozooplankton 
+   REAL(wp), PUBLIC ::  xthresh2phy = 2E-7_wp    !: nanophyto feeding threshold for mesozooplankton 
+   REAL(wp), PUBLIC ::  xthresh2poc = 1E-8_wp    !: poc feeding threshold for mesozooplankton 
+   REAL(wp), PUBLIC ::  xthresh2    = 0._wp      !: feeding threshold for mesozooplankton 
+   REAL(wp), PUBLIC ::  resrat2     = 0.005_wp   !: exsudation rate of mesozooplankton
+   REAL(wp), PUBLIC ::  mzrat2      = 0.04_wp    !: microzooplankton mortality rate 
+   REAL(wp), PUBLIC ::  grazrat2    = 0.9_wp     !: maximal mesozoo grazing rate
+   REAL(wp), PUBLIC ::  xkgraz2     = 20E-6_wp   !: non assimilated fraction of P by mesozoo 
+   REAL(wp), PUBLIC ::  unass2      = 0.3_wp     !: Efficicency of mesozoo growth 
+   REAL(wp), PUBLIC ::  sigma2      = 0.6_wp     !: Fraction of mesozoo excretion as DOM 
+   REAL(wp), PUBLIC ::  epsher2     = 0.3_wp     !: half sturation constant for grazing 2
+   REAL(wp), PUBLIC ::  grazflux    = 3.E3_wp    !: mesozoo flux feeding rate
+
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zmeso.F90 3295 2012-01-30 15:49:07Z cetlod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_meso( kt, jnt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_meso  ***
+      !!
+      !! ** Purpose :   Compute the sources/sinks for mesozooplankton
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt, jnt ! ocean time step
+      INTEGER  :: ji, jj, jk
+      REAL(wp) :: zcompadi, zcompaph, zcompapoc, zcompaz, zcompam
+      REAL(wp) :: zgraze2 , zdenom, zdenom2, zncratio
+      REAL(wp) :: zfact   , zstep, zfood, zfoodlim
+      REAL(wp) :: zepshert, zepsherv, zgrarsig, zgraztot, zgraztotf
+      REAL(wp) :: zgrarem2, zgrafer2, zgrapoc2, zprcaca, zmortz2, zgrasrat
+#if defined key_kriest
+      REAL znumpoc
+#endif
+      REAL(wp) :: zrespz2, ztortz2, zgrazd, zgrazz, zgrazpof
+      REAL(wp) :: zgrazn, zgrazpoc, zgraznf, zgrazf
+      REAL(wp) :: zgrazfff, zgrazffe
+      REAL(wp) :: zrfact2
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zgrazing
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_meso')
+      !
+      IF( ln_diatrc .AND. lk_iomput )  CALL wrk_alloc( jpi, jpj, jpk, zgrazing )
+      !
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zcompam   = MAX( ( trn(ji,jj,jk,jpmes) - 1.e-8 ), 0.e0 )
+# if defined key_degrad
+               zstep     = xstep * facvol(ji,jj,jk)
+# else
+               zstep     = xstep
+# endif
+               zfact     = zstep * tgfunc(ji,jj,jk) * zcompam
+
+               !  Respiration rates of both zooplankton
+               !  -------------------------------------
+               zrespz2   = resrat2 * zfact * trn(ji,jj,jk,jpmes) / ( xkmort + trn(ji,jj,jk,jpmes) )  &
+                  &      + resrat2 * zfact * 3. * nitrfac(ji,jj,jk)
+
+               !  Zooplankton mortality. A square function has been selected with
+               !  no real reason except that it seems to be more stable and may mimic predation
+               !  ---------------------------------------------------------------
+               ztortz2   = mzrat2 * 1.e6 * zfact * trn(ji,jj,jk,jpmes)
+               !
+
+               zcompadi  = MAX( ( trn(ji,jj,jk,jpdia) - xthresh2dia ), 0.e0 )
+               zcompaz   = MAX( ( trn(ji,jj,jk,jpzoo) - xthresh2zoo ), 0.e0 )
+               zcompaph  = MAX( ( trn(ji,jj,jk,jpphy) - xthresh2phy ), 0.e0 )
+               zcompapoc = MAX( ( trn(ji,jj,jk,jppoc) - xthresh2poc ), 0.e0 )
+
+               zfood     = xprefc * zcompadi + xprefz * zcompaz + xprefp * zcompaph + xprefpoc * zcompapoc 
+               zfoodlim  = MAX( 0., zfood - MIN( 0.5 * zfood , xthresh2 ) )
+               zdenom    = zfoodlim / ( xkgraz2 + zfoodlim )
+               zdenom2   = zdenom / ( zfood + rtrn )
+               zgraze2   = grazrat2 * zstep * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jpmes) 
+
+               zgrazd    = zgraze2  * xprefc   * zcompadi  * zdenom2 
+               zgrazz    = zgraze2  * xprefz   * zcompaz   * zdenom2 
+               zgrazn    = zgraze2  * xprefp   * zcompaph  * zdenom2 
+               zgrazpoc  = zgraze2  * xprefpoc * zcompapoc * zdenom2 
+
+               zgraznf   = zgrazn   * trn(ji,jj,jk,jpnfe) / ( trn(ji,jj,jk,jpphy) + rtrn)
+               zgrazf    = zgrazd   * trn(ji,jj,jk,jpdfe) / ( trn(ji,jj,jk,jpdia) + rtrn)
+               zgrazpof  = zgrazpoc * trn(ji,jj,jk,jpsfe) / ( trn(ji,jj,jk,jppoc) + rtrn)
+
+               !  Mesozooplankton flux feeding on GOC
+               !  ----------------------------------
+# if ! defined key_kriest
+               zgrazffe  = grazflux * zstep * wsbio4(ji,jj,jk)          &
+                 &                 * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jpgoc) * trn(ji,jj,jk,jpmes)
+               zgrazfff  = zgrazffe * trn(ji,jj,jk,jpbfe) / (trn(ji,jj,jk,jpgoc) + rtrn)
+# else
+               zgrazffe = grazflux * zstep * wsbio3(ji,jj,jk)     &
+                 &                 * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpmes)
+               zgrazfff   = zgrazffe * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn)
+# endif
+              !
+              zgraztot   = zgrazd + zgrazz + zgrazn + zgrazpoc + zgrazffe
+              zgraztotf  = zgrazf + zgraznf + zgrazz * ferat3 + zgrazpof + zgrazfff 
+
+              ! Total grazing ( grazing by microzoo is already computed in p4zmicro )
+              IF( ln_diatrc .AND. lk_iomput )  zgrazing(ji,jj,jk) = zgraztot
+
+              !    Mesozooplankton efficiency
+              !    --------------------------
+              zgrasrat   =  zgraztotf / ( zgraztot + rtrn )
+              zncratio   = (  xprefc   * zcompadi * quotad(ji,jj,jk)  &
+                  &         + xprefp   * zcompaph * quotan(ji,jj,jk)  &
+                  &         + xprefz   * zcompaz                      &
+                  &         + xprefpoc * zcompapoc   ) / ( zfood + rtrn )
+               zepshert  = epsher2 * MIN( 1., zncratio )
+               zepsherv  = zepshert * MIN( 1., zgrasrat / ferat3 )
+               zgrarem2  = zgraztot * ( 1. - zepsherv - unass2 )
+               zgrafer2  = zgraztot * MAX( 0. , ( 1. - unass2 ) * zgrasrat - ferat3 * zepshert ) 
+               zgrapoc2  = zgraztot * unass2
+
+               !   Update the arrays TRA which contain the biological sources and sinks
+               zgrarsig  = zgrarem2 * sigma2
+               tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) + zgrarsig
+               tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) + zgrarsig
+               tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + zgrarem2 - zgrarsig
+               tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) - o2ut * zgrarsig
+               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + zgrafer2
+               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) + zgrarsig
+               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3 * zgrarsig              
+#if defined key_kriest
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zgrapoc2
+               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + zgrapoc2 * xkr_dmeso
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zgraztotf * unass2
+#else
+               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zgrapoc2
+               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zgraztotf * unass2
+#endif
+               zmortz2 = ztortz2 + zrespz2
+               tra(ji,jj,jk,jpmes) = tra(ji,jj,jk,jpmes) - zmortz2 + zepsherv * zgraztot 
+               tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) - zgrazd
+               tra(ji,jj,jk,jpzoo) = tra(ji,jj,jk,jpzoo) - zgrazz
+               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) - zgrazn
+               tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) - zgrazn * trn(ji,jj,jk,jpnch) / ( trn(ji,jj,jk,jpphy) + rtrn )
+               tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) - zgrazd * trn(ji,jj,jk,jpdch) / ( trn(ji,jj,jk,jpdia) + rtrn )
+               tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) - zgrazd * trn(ji,jj,jk,jpdsi) / ( trn(ji,jj,jk,jpdia) + rtrn )
+               tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) + zgrazd * trn(ji,jj,jk,jpdsi) / ( trn(ji,jj,jk,jpdia) + rtrn )
+               tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) - zgraznf
+               tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) - zgrazf
+
+               zprcaca = xfracal(ji,jj,jk) * zgrazn
+               ! calcite production
+               prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo)
+               !
+               zprcaca = part2 * zprcaca
+               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprcaca
+               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) - 2. * zprcaca
+               tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) + zprcaca
+#if defined key_kriest
+               znumpoc = trn(ji,jj,jk,jpnum) / ( trn(ji,jj,jk,jppoc) + rtrn )
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortz2 - zgrazpoc - zgrazffe
+               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) - zgrazpoc * znumpoc &
+                  &    + zmortz2  * xkr_dmeso - zgrazffe * znumpoc * wsbio4(ji,jj,jk) / ( wsbio3(ji,jj,jk) + rtrn )
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + ferat3 * zmortz2 - zgrazfff - zgrazpof
+#else
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) - zgrazpoc
+               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zmortz2 - zgrazffe
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) - zgrazpof
+               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + ferat3 * zmortz2 - zgrazfff
+#endif
+
+            END DO
+         END DO
+      END DO
+      !
+      IF( ln_diatrc .AND. lk_iomput .AND. jnt == nrdttrc ) THEN
+         zrfact2 = 1.e3 * rfact2r
+         CALL iom_put( "GRAZ2", zgrazing(:,:,:) * zrfact2 * tmask(:,:,:) )  ! Total grazing of phyto by zooplankton
+         CALL iom_put( "PCAL" , prodcal(:,:,:)  * zrfact2 * tmask(:,:,:) )  ! Calcite production
+      ENDIF
+      !
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+        WRITE(charout, FMT="('meso')")
+        CALL prt_ctl_trc_info(charout)
+        CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      IF( ln_diatrc .AND. lk_iomput )  CALL wrk_dealloc( jpi, jpj, jpk, zgrazing )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_meso')
+      !
+   END SUBROUTINE p4z_meso
+
+   SUBROUTINE p4z_meso_init
+
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_meso_init  ***
+      !!
+      !! ** Purpose :   Initialization of mesozooplankton parameters
+      !!
+      !! ** Method  :   Read the nampismes namelist and check the parameters
+      !!      called at the first timestep (nittrc000)
+      !!
+      !! ** input   :   Namelist nampismes
+      !!
+      !!----------------------------------------------------------------------
+
+      NAMELIST/nampismes/ part2, grazrat2, resrat2, mzrat2, xprefc, xprefp, xprefz,   &
+         &                xprefpoc, xthresh2dia, xthresh2phy, xthresh2zoo, xthresh2poc, &
+         &                xthresh2, xkgraz2, epsher2, sigma2, unass2, grazflux
+
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampismes )
+
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' ' 
+         WRITE(numout,*) ' Namelist parameters for mesozooplankton, nampismes'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    part of calcite not dissolved in mesozoo guts  part2        =', part2
+         WRITE(numout,*) '    mesozoo preference for phyto                   xprefc       =', xprefc
+         WRITE(numout,*) '    mesozoo preference for POC                     xprefp       =', xprefp
+         WRITE(numout,*) '    mesozoo preference for zoo                     xprefz       =', xprefz
+         WRITE(numout,*) '    mesozoo preference for poc                     xprefpoc     =', xprefpoc
+         WRITE(numout,*) '    microzoo feeding threshold  for mesozoo        xthresh2zoo  =', xthresh2zoo
+         WRITE(numout,*) '    diatoms feeding threshold  for mesozoo         xthresh2dia  =', xthresh2dia
+         WRITE(numout,*) '    nanophyto feeding threshold for mesozoo        xthresh2phy  =', xthresh2phy
+         WRITE(numout,*) '    poc feeding threshold for mesozoo              xthresh2poc  =', xthresh2poc
+         WRITE(numout,*) '    feeding threshold for mesozooplankton          xthresh2     =', xthresh2
+         WRITE(numout,*) '    exsudation rate of mesozooplankton             resrat2      =', resrat2
+         WRITE(numout,*) '    mesozooplankton mortality rate                 mzrat2       =', mzrat2
+         WRITE(numout,*) '    maximal mesozoo grazing rate                   grazrat2     =', grazrat2
+         WRITE(numout,*) '    mesozoo flux feeding rate                      grazflux     =', grazflux
+         WRITE(numout,*) '    non assimilated fraction of P by mesozoo       unass2       =', unass2
+         WRITE(numout,*) '    Efficicency of Mesozoo growth                  epsher2      =', epsher2
+         WRITE(numout,*) '    Fraction of mesozoo excretion as DOM           sigma2       =', sigma2
+         WRITE(numout,*) '    half sturation constant for grazing 2          xkgraz2      =', xkgraz2
+      ENDIF
+
+
+   END SUBROUTINE p4z_meso_init
+
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_meso                    ! Empty routine
+   END SUBROUTINE p4z_meso
+#endif 
+
+   !!======================================================================
+END MODULE  p4zmeso
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmicro.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmicro.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmicro.F90	(revision 3680)
@@ -0,0 +1,264 @@
+MODULE p4zmicro
+   !!======================================================================
+   !!                         ***  MODULE p4zmicro  ***
+   !! TOP :   PISCES Compute the sources/sinks for microzooplankton
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Quota model for iron
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_micro       :   Compute the sources/sinks for microzooplankton
+   !!   p4z_micro_init  :   Initialize and read the appropriate namelist
+   !!----------------------------------------------------------------------
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zlim          !  Co-limitations
+   USE p4zsink         !  vertical flux of particulate matter due to sinking
+   USE p4zint          !  interpolation and computation of various fields
+   USE p4zprod         !  production
+   USE iom             !  I/O manager
+   USE prtctl_trc      !  print control for debugging
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_micro         ! called in p4zbio.F90
+   PUBLIC   p4z_micro_init    ! called in trcsms_pisces.F90
+
+   !! * Shared module variables
+   REAL(wp), PUBLIC ::  part       = 0.5_wp     !: part of calcite not dissolved in microzoo guts
+   REAL(wp), PUBLIC ::  xpref2c    = 0.2_wp     !: microzoo preference for POC 
+   REAL(wp), PUBLIC ::  xpref2p    = 1.0_wp     !: microzoo preference for nanophyto
+   REAL(wp), PUBLIC ::  xpref2d    = 0.6_wp     !: microzoo preference for diatoms
+   REAL(wp), PUBLIC ::  xthreshdia = 1E-8_wp    !: diatoms feeding threshold for microzooplankton 
+   REAL(wp), PUBLIC ::  xthreshphy = 2E-7_wp    !: nanophyto threshold for microzooplankton 
+   REAL(wp), PUBLIC ::  xthreshpoc = 1E-8_wp    !: poc threshold for microzooplankton 
+   REAL(wp), PUBLIC ::  xthresh    = 0._wp      !: feeding threshold for microzooplankton 
+   REAL(wp), PUBLIC ::  resrat     = 0.03_wp    !: exsudation rate of microzooplankton
+   REAL(wp), PUBLIC ::  mzrat      = 0.0_wp     !: microzooplankton mortality rate 
+   REAL(wp), PUBLIC ::  grazrat    = 3.0_wp     !: maximal microzoo grazing rate
+   REAL(wp), PUBLIC ::  xkgraz     = 20E-6_wp   !: non assimilated fraction of P by microzoo 
+   REAL(wp), PUBLIC ::  unass      = 0.3_wp     !: Efficicency of microzoo growth 
+   REAL(wp), PUBLIC ::  sigma1     = 0.6_wp     !: Fraction of microzoo excretion as DOM 
+   REAL(wp), PUBLIC ::  epsher     = 0.3_wp     !: half sturation constant for grazing 1 
+
+
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zmicro.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_micro( kt, jnt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_micro  ***
+      !!
+      !! ** Purpose :   Compute the sources/sinks for microzooplankton
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in) ::  kt  ! ocean time step
+      INTEGER, INTENT(in) ::  jnt 
+      !
+      INTEGER  :: ji, jj, jk
+      REAL(wp) :: zcompadi, zcompaz , zcompaph, zcompapoc
+      REAL(wp) :: zgraze  , zdenom, zdenom2, zncratio
+      REAL(wp) :: zfact   , zstep, zfood, zfoodlim
+      REAL(wp) :: zepshert, zepsherv, zgrarsig, zgraztot, zgraztotf
+      REAL(wp) :: zgrarem, zgrafer, zgrapoc, zprcaca, zmortz
+      REAL(wp) :: zrespz, ztortz, zgrasrat
+      REAL(wp) :: zgrazp, zgrazm, zgrazsd
+      REAL(wp) :: zgrazmf, zgrazsf, zgrazpf
+      REAL(wp) :: zrfact2
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zgrazing
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_micro')
+      !
+      IF( ln_diatrc .AND. lk_iomput )  CALL wrk_alloc( jpi, jpj, jpk, zgrazing )
+      !
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zcompaz = MAX( ( trn(ji,jj,jk,jpzoo) - 1.e-8 ), 0.e0 )
+               zstep   = xstep
+# if defined key_degrad
+               zstep = zstep * facvol(ji,jj,jk)
+# endif
+               zfact   = zstep * tgfunc2(ji,jj,jk) * zcompaz
+
+               !  Respiration rates of both zooplankton
+               !  -------------------------------------
+               zrespz = resrat * zfact * trn(ji,jj,jk,jpzoo) / ( xkmort + trn(ji,jj,jk,jpzoo) )  &
+                  &   + resrat * zfact * 3. * nitrfac(ji,jj,jk)
+
+               !  Zooplankton mortality. A square function has been selected with
+               !  no real reason except that it seems to be more stable and may mimic predation.
+               !  ---------------------------------------------------------------
+               ztortz = mzrat * 1.e6 * zfact * trn(ji,jj,jk,jpzoo)
+
+               zcompadi  = MIN( MAX( ( trn(ji,jj,jk,jpdia) - xthreshdia ), 0.e0 ), xsizedia )
+               zcompaph  = MAX( ( trn(ji,jj,jk,jpphy) - xthreshphy ), 0.e0 )
+               zcompapoc = MAX( ( trn(ji,jj,jk,jppoc) - xthreshpoc ), 0.e0 )
+               
+               !     Microzooplankton grazing
+               !     ------------------------
+               zfood     = xpref2p * zcompaph + xpref2c * zcompapoc + xpref2d * zcompadi
+               zfoodlim  = MAX( 0. , zfood - min(xthresh,0.5*zfood) )
+               zdenom    = zfoodlim / ( xkgraz + zfoodlim )
+               zdenom2   = zdenom / ( zfood + rtrn )
+               zgraze    = grazrat * zstep * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jpzoo) 
+
+               zgrazp    = zgraze  * xpref2p * zcompaph  * zdenom2 
+               zgrazm    = zgraze  * xpref2c * zcompapoc * zdenom2 
+               zgrazsd   = zgraze  * xpref2d * zcompadi  * zdenom2 
+
+               zgrazpf   = zgrazp  * trn(ji,jj,jk,jpnfe) / (trn(ji,jj,jk,jpphy) + rtrn)
+               zgrazmf   = zgrazm  * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn)
+               zgrazsf   = zgrazsd * trn(ji,jj,jk,jpdfe) / (trn(ji,jj,jk,jpdia) + rtrn)
+               !
+               zgraztot  = zgrazp  + zgrazm  + zgrazsd 
+               zgraztotf = zgrazpf + zgrazsf + zgrazmf 
+
+               ! Grazing by microzooplankton
+               IF( ln_diatrc .AND. lk_iomput )  zgrazing(ji,jj,jk) = zgraztot
+
+               !    Various remineralization and excretion terms
+               !    --------------------------------------------
+               zgrasrat  = zgraztotf / ( zgraztot + rtrn )
+               zncratio  = ( xpref2p * zcompaph * quotan(ji,jj,jk) &
+                  &        + xpref2d * zcompadi * quotad(ji,jj,jk) + xpref2c * zcompapoc ) / ( zfood + rtrn )
+               zepshert  = epsher * MIN( 1., zncratio )
+               zepsherv  = zepshert * MIN( 1., zgrasrat / ferat3 )
+               zgrafer   = zgraztot * MAX( 0. , ( 1. - unass ) * zgrasrat - ferat3 * zepshert ) 
+               zgrarem   = zgraztot * ( 1. - zepsherv - unass )
+               zgrapoc   = zgraztot * unass
+
+               !  Update of the TRA arrays
+               !  ------------------------
+               zgrarsig  = zgrarem * sigma1
+               tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) + zgrarsig
+               tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) + zgrarsig
+               tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + zgrarem - zgrarsig
+               tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) - o2ut * zgrarsig
+               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + zgrafer
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zgrapoc
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zgraztotf * unass
+               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) + zgrarsig
+               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3 * zgrarsig
+#if defined key_kriest
+               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + zgrapoc * xkr_dmicro
+#endif
+               !   Update the arrays TRA which contain the biological sources and sinks
+               !   --------------------------------------------------------------------
+               zmortz = ztortz + zrespz
+               tra(ji,jj,jk,jpzoo) = tra(ji,jj,jk,jpzoo) - zmortz + zepsherv * zgraztot 
+               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) - zgrazp
+               tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) - zgrazsd
+               tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) - zgrazp  * trn(ji,jj,jk,jpnch)/(trn(ji,jj,jk,jpphy)+rtrn)
+               tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) - zgrazsd * trn(ji,jj,jk,jpdch)/(trn(ji,jj,jk,jpdia)+rtrn)
+               tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) - zgrazsd * trn(ji,jj,jk,jpdsi)/(trn(ji,jj,jk,jpdia)+rtrn)
+               tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) + zgrazsd * trn(ji,jj,jk,jpdsi)/(trn(ji,jj,jk,jpdia)+rtrn)
+               tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) - zgrazpf
+               tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) - zgrazsf
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortz - zgrazm
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + ferat3 * zmortz - zgrazmf
+               zprcaca = xfracal(ji,jj,jk) * zgrazp
+               !
+               ! calcite production
+               prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo)
+               !
+               zprcaca = part * zprcaca
+               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprcaca
+               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) - 2. * zprcaca
+               tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) + zprcaca
+#if defined key_kriest
+               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + ( zmortz - zgrazm ) * xkr_dmicro
+#endif
+            END DO
+         END DO
+      END DO
+      !
+      IF( ln_diatrc .AND. lk_iomput .AND. jnt == nrdttrc ) THEN
+         zrfact2 = 1.e3 * rfact2r
+         CALL iom_put( "GRAZ1" , zgrazing(:,:,:) * zrfact2 * tmask(:,:,:) )  ! Total grazing of phyto by zooplankton
+      ENDIF
+      !
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('micro')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      IF( ln_diatrc .AND. lk_iomput )  CALL wrk_dealloc( jpi, jpj, jpk, zgrazing )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_micro')
+      !
+   END SUBROUTINE p4z_micro
+
+
+   SUBROUTINE p4z_micro_init
+
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_micro_init  ***
+      !!
+      !! ** Purpose :   Initialization of microzooplankton parameters
+      !!
+      !! ** Method  :   Read the nampiszoo namelist and check the parameters
+      !!                called at the first timestep (nittrc000)
+      !!
+      !! ** input   :   Namelist nampiszoo
+      !!
+      !!----------------------------------------------------------------------
+
+      NAMELIST/nampiszoo/ part, grazrat, resrat, mzrat, xpref2c, xpref2p, &
+         &                xpref2d,  xthreshdia,  xthreshphy,  xthreshpoc, &
+         &                xthresh, xkgraz, epsher, sigma1, unass
+
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampiszoo )
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist parameters for microzooplankton, nampiszoo'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    part of calcite not dissolved in microzoo guts  part        =', part
+         WRITE(numout,*) '    microzoo preference for POC                     xpref2c     =', xpref2c
+         WRITE(numout,*) '    microzoo preference for nano                    xpref2p     =', xpref2p
+         WRITE(numout,*) '    microzoo preference for diatoms                 xpref2d     =', xpref2d
+         WRITE(numout,*) '    diatoms feeding threshold  for microzoo         xthreshdia  =', xthreshdia
+         WRITE(numout,*) '    nanophyto feeding threshold for microzoo        xthreshphy  =', xthreshphy
+         WRITE(numout,*) '    poc feeding threshold for microzoo              xthreshpoc  =', xthreshpoc
+         WRITE(numout,*) '    feeding threshold for microzooplankton          xthresh     =', xthresh
+         WRITE(numout,*) '    exsudation rate of microzooplankton             resrat      =', resrat
+         WRITE(numout,*) '    microzooplankton mortality rate                 mzrat       =', mzrat
+         WRITE(numout,*) '    maximal microzoo grazing rate                   grazrat     =', grazrat
+         WRITE(numout,*) '    non assimilated fraction of P by microzoo       unass       =', unass
+         WRITE(numout,*) '    Efficicency of microzoo growth                  epsher      =', epsher
+         WRITE(numout,*) '    Fraction of microzoo excretion as DOM           sigma1      =', sigma1
+         WRITE(numout,*) '    half sturation constant for grazing 1           xkgraz      =', xkgraz
+      ENDIF
+
+   END SUBROUTINE p4z_micro_init
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_micro                    ! Empty routine
+   END SUBROUTINE p4z_micro
+#endif 
+
+   !!======================================================================
+END MODULE  p4zmicro
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmort.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmort.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmort.F90	(revision 3680)
@@ -0,0 +1,268 @@
+MODULE p4zmort
+   !!======================================================================
+   !!                         ***  MODULE p4zmort  ***
+   !! TOP :   PISCES Compute the mortality terms for phytoplankton
+   !!======================================================================
+   !! History :   1.0  !  2002     (O. Aumont)  Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_mort       :   Compute the mortality terms for phytoplankton
+   !!   p4z_mort_init  :   Initialize the mortality params for phytoplankton
+   !!----------------------------------------------------------------------
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zsink         !  vertical flux of particulate matter due to sinking
+   USE prtctl_trc      !  print control for debugging
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_mort    
+   PUBLIC   p4z_mort_init    
+
+   !! * Shared module variables
+   REAL(wp), PUBLIC :: wchl   = 0.001_wp  !:
+   REAL(wp), PUBLIC :: wchld  = 0.02_wp   !:
+   REAL(wp), PUBLIC :: wchldm = 0.05_wp   !:
+   REAL(wp), PUBLIC :: mprat  = 0.01_wp   !:
+   REAL(wp), PUBLIC :: mprat2 = 0.01_wp   !:
+
+
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zmort.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_mort( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_mort  ***
+      !!
+      !! ** Purpose :   Calls the different subroutine to initialize and compute
+      !!                the different phytoplankton mortality terms
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt ! ocean time step
+      !!---------------------------------------------------------------------
+
+      CALL p4z_nano            ! nanophytoplankton
+
+      CALL p4z_diat            ! diatoms
+
+   END SUBROUTINE p4z_mort
+
+
+   SUBROUTINE p4z_nano
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_nano  ***
+      !!
+      !! ** Purpose :   Compute the mortality terms for nanophytoplankton
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  :: ji, jj, jk
+      REAL(wp) :: zcompaph
+      REAL(wp) :: zfactfe, zfactch, zprcaca, zfracal
+      REAL(wp) :: ztortp , zrespp , zmortp , zstep
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_nano')
+      !
+      prodcal(:,:,:) = 0.  !: calcite production variable set to zero
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zcompaph = MAX( ( trn(ji,jj,jk,jpphy) - 1e-8 ), 0.e0 )
+               zstep    = xstep
+# if defined key_degrad
+               zstep    = zstep * facvol(ji,jj,jk)
+# endif
+               !     Squared mortality of Phyto similar to a sedimentation term during
+               !     blooms (Doney et al. 1996)
+               zrespp = wchl * 1.e6 * zstep * xdiss(ji,jj,jk) * zcompaph * trn(ji,jj,jk,jpphy) 
+
+               !     Phytoplankton mortality. This mortality loss is slightly
+               !     increased when nutrients are limiting phytoplankton growth
+               !     as observed for instance in case of iron limitation.
+               ztortp = mprat * xstep * trn(ji,jj,jk,jpphy) / ( xkmort + trn(ji,jj,jk,jpphy) ) * zcompaph
+
+               zmortp = zrespp + ztortp
+
+               !   Update the arrays TRA which contains the biological sources and sinks
+
+               zfactfe = trn(ji,jj,jk,jpnfe)/(trn(ji,jj,jk,jpphy)+rtrn)
+               zfactch = trn(ji,jj,jk,jpnch)/(trn(ji,jj,jk,jpphy)+rtrn)
+               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) - zmortp
+               tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) - zmortp * zfactch
+               tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) - zmortp * zfactfe
+               zprcaca = xfracal(ji,jj,jk) * zmortp
+               !
+               prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo)
+               !
+               zfracal = 0.5 * xfracal(ji,jj,jk)
+               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprcaca
+               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) - 2. * zprcaca
+               tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) + zprcaca
+#if defined key_kriest
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortp
+               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + ztortp * xkr_dnano + zrespp * xkr_ddiat
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zmortp * zfactfe
+#else
+               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zfracal * zmortp
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + ( 1. - zfracal ) * zmortp
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + ( 1. - zfracal ) * zmortp * zfactfe
+               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zfracal * zmortp * zfactfe
+#endif
+            END DO
+         END DO
+      END DO
+      !
+       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('nano')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+       ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_nano')
+      !
+   END SUBROUTINE p4z_nano
+
+   SUBROUTINE p4z_diat
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_diat  ***
+      !!
+      !! ** Purpose :   Compute the mortality terms for diatoms
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::  ji, jj, jk
+      REAL(wp) ::  zfactfe,zfactsi,zfactch, zcompadi
+      REAL(wp) ::  zrespp2, ztortp2, zmortp2, zstep
+      REAL(wp) ::  zlim2, zlim1
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_diat')
+      !
+
+      !    Aggregation term for diatoms is increased in case of nutrient
+      !    stress as observed in reality. The stressed cells become more
+      !    sticky and coagulate to sink quickly out of the euphotic zone
+      !     ------------------------------------------------------------
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+               zcompadi = MAX( ( trn(ji,jj,jk,jpdia) - 1e-8), 0. )
+
+               !    Aggregation term for diatoms is increased in case of nutrient
+               !    stress as observed in reality. The stressed cells become more
+               !    sticky and coagulate to sink quickly out of the euphotic zone
+               !     ------------------------------------------------------------
+               zstep   = xstep
+# if defined key_degrad
+               zstep = zstep * facvol(ji,jj,jk)
+# endif
+               !  Phytoplankton respiration 
+               !     ------------------------
+               zlim2   = xlimdia(ji,jj,jk) * xlimdia(ji,jj,jk)
+               zlim1   = 0.25 * ( 1. - zlim2 ) / ( 0.25 + zlim2 ) 
+               zrespp2 = 1.e6 * zstep * (  wchld + wchldm * zlim1 ) * xdiss(ji,jj,jk) * zcompadi * trn(ji,jj,jk,jpdia)
+              ! zlim1   = 1.0 - xlimdia(ji,jj,jk) 
+              ! zrespp2 = 1.e6 * zstep * (  wchl + wchld * zlim1 ) * xdiss(ji,jj,jk) * zcompadi * trn(ji,jj,jk,jpdia)
+
+               !     Phytoplankton mortality. 
+               !     ------------------------
+               ztortp2 = mprat2 * zstep * trn(ji,jj,jk,jpdia)  / ( xkmort + trn(ji,jj,jk,jpdia) ) * zcompadi 
+
+               zmortp2 = zrespp2 + ztortp2
+
+               !   Update the arrays tra which contains the biological sources and sinks
+               !   ---------------------------------------------------------------------
+               zfactch = trn(ji,jj,jk,jpdch) / ( trn(ji,jj,jk,jpdia) + rtrn )
+               zfactfe = trn(ji,jj,jk,jpdfe) / ( trn(ji,jj,jk,jpdia) + rtrn )
+               zfactsi = trn(ji,jj,jk,jpdsi) / ( trn(ji,jj,jk,jpdia) + rtrn )
+               tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) - zmortp2 
+               tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) - zmortp2 * zfactch
+               tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) - zmortp2 * zfactfe
+               tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) - zmortp2 * zfactsi
+               tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) + zmortp2 * zfactsi
+#if defined key_kriest
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortp2  
+               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + ztortp2 * xkr_ddiat + zrespp2 * xkr_daggr
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zmortp2 * zfactfe
+#else
+               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zrespp2 + 0.5 * ztortp2
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + 0.5 * ztortp2
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + 0.5 * ztortp2 * zfactfe
+               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + ( zrespp2 + 0.5 * ztortp2 ) * zfactfe
+#endif
+            END DO
+         END DO
+      END DO
+      !
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('diat')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_diat')
+      !
+   END SUBROUTINE p4z_diat
+
+   SUBROUTINE p4z_mort_init
+
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_mort_init  ***
+      !!
+      !! ** Purpose :   Initialization of phytoplankton parameters
+      !!
+      !! ** Method  :   Read the nampismort namelist and check the parameters
+      !!      called at the first timestep
+      !!
+      !! ** input   :   Namelist nampismort
+      !!
+      !!----------------------------------------------------------------------
+
+      NAMELIST/nampismort/ wchl, wchld, wchldm, mprat, mprat2
+
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampismort )
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist parameters for phytoplankton mortality, nampismort'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    quadratic mortality of phytoplankton      wchl      =', wchl
+         WRITE(numout,*) '    maximum quadratic mortality of diatoms    wchld     =', wchld
+         WRITE(numout,*) '    maximum quadratic mortality of diatoms    wchldm    =', wchldm
+         WRITE(numout,*) '    phytoplankton mortality rate              mprat     =', mprat
+         WRITE(numout,*) '    Diatoms mortality rate                    mprat2    =', mprat2
+      ENDIF
+
+   END SUBROUTINE p4z_mort_init
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_mort                    ! Empty routine
+   END SUBROUTINE p4z_mort
+#endif 
+
+   !!======================================================================
+END MODULE  p4zmort
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zopt.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zopt.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zopt.F90	(revision 3680)
@@ -0,0 +1,404 @@
+MODULE p4zopt
+   !!======================================================================
+   !!                         ***  MODULE p4zopt  ***
+   !! TOP - PISCES : Compute the light availability in the water column
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!             3.2  !  2009-04  (C. Ethe, G. Madec)  optimisation
+   !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Improve light availability of nano & diat
+   !!----------------------------------------------------------------------
+#if defined  key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_opt       : light availability in the water column
+   !!----------------------------------------------------------------------
+   USE trc            ! tracer variables
+   USE oce_trc        ! tracer-ocean share variables
+   USE sms_pisces     ! Source Minus Sink of PISCES
+   USE iom            ! I/O manager
+   USE fldread         !  time interpolation
+   USE prtctl_trc      !  print control for debugging
+
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_opt        ! called in p4zbio.F90 module
+   PUBLIC   p4z_opt_init   ! called in trcsms_pisces.F90 module
+   PUBLIC   p4z_opt_alloc
+
+   !! * Shared module variables
+
+   LOGICAL  :: ln_varpar = .FALSE.    !: boolean for variable PAR fraction
+   REAL(wp) :: parlux    = 0.43_wp    !: Fraction of shortwave as PAR
+   REAL(wp) :: xparsw                 !: parlux/3
+
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_par      ! structure of input par
+   INTEGER , PARAMETER :: nbtimes = 365  !: maximum number of times record in a file
+   INTEGER  :: ntimes_par                ! number of time steps in a file
+   REAL(wp), ALLOCATABLE, SAVE,   DIMENSION(:,:) :: par_varsw    !: PAR fraction of shortwave
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: enano, ediat   !: PAR for phyto, nano and diat 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: emoy           !: averaged PAR in the mixed layer
+
+   INTEGER  ::   nksrp   ! levels below which the light cannot penetrate ( depth larger than 391 m)
+
+   REAL(wp), DIMENSION(3,61), PUBLIC ::   xkrgb   !: tabulated attenuation coefficients for RGB absorption
+   
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zopt.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE p4z_opt( kt, jnt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_opt  ***
+      !!
+      !! ** Purpose :   Compute the light availability in the water column
+      !!              depending on the depth and the chlorophyll concentration
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      !
+      INTEGER, INTENT(in) ::   kt, jnt   ! ocean time step
+      !
+      INTEGER  ::   ji, jj, jk
+      INTEGER  ::   irgb
+      REAL(wp) ::   zchl, zxsi0r
+      REAL(wp) ::   zc0 , zc1 , zc2, zc3, z1_dep
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zdepmoy, zetmp, zetmp1, zetmp2
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zekg, zekr, zekb, ze0, ze1, ze2, ze3
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_opt')
+      !
+      ! Allocate temporary workspace
+      CALL wrk_alloc( jpi, jpj,      zdepmoy, zetmp, zetmp1, zetmp2 ) 
+      CALL wrk_alloc( jpi, jpj, jpk, zekg, zekr, zekb, ze0, ze1, ze2, ze3 )
+
+      IF( jnt == 1 .AND. ln_varpar ) CALL p4z_optsbc( kt )
+
+      !     Initialisation of variables used to compute PAR
+      !     -----------------------------------------------
+      ze1(:,:,jpk) = 0._wp
+      ze2(:,:,jpk) = 0._wp
+      ze3(:,:,jpk) = 0._wp
+
+      !                                        !* attenuation coef. function of Chlorophyll and wavelength (Red-Green-Blue)
+      DO jk = 1, jpkm1                         !  --------------------------------------------------------
+!CDIR NOVERRCHK
+         DO jj = 1, jpj
+!CDIR NOVERRCHK
+            DO ji = 1, jpi
+               zchl = ( trn(ji,jj,jk,jpnch) + trn(ji,jj,jk,jpdch) + rtrn ) * 1.e6
+               zchl = MIN(  10. , MAX( 0.05, zchl )  )
+               irgb = NINT( 41 + 20.* LOG10( zchl ) + rtrn )
+               !                                                         
+               zekb(ji,jj,jk) = xkrgb(1,irgb) * fse3t(ji,jj,jk)
+               zekg(ji,jj,jk) = xkrgb(2,irgb) * fse3t(ji,jj,jk)
+               zekr(ji,jj,jk) = xkrgb(3,irgb) * fse3t(ji,jj,jk)
+            END DO
+         END DO
+      END DO
+
+
+      !                                        !* Photosynthetically Available Radiation (PAR)
+      !                                        !  --------------------------------------
+      IF( ln_varpar ) THEN
+         ze1(:,:,1) = par_varsw(:,:) * qsr(:,:) * EXP( -0.5 * zekb(:,:,1) )
+         ze2(:,:,1) = par_varsw(:,:) * qsr(:,:) * EXP( -0.5 * zekg(:,:,1) )
+         ze3(:,:,1) = par_varsw(:,:) * qsr(:,:) * EXP( -0.5 * zekr(:,:,1) )
+      ELSE
+         ze1(:,:,1) = xparsw         * qsr(:,:) * EXP( -0.5 * zekb(:,:,1) )
+         ze2(:,:,1) = xparsw         * qsr(:,:) * EXP( -0.5 * zekg(:,:,1) )
+         ze3(:,:,1) = xparsw         * qsr(:,:) * EXP( -0.5 * zekr(:,:,1) )
+      ENDIF
+
+!CDIR NOVERRCHK
+      DO jj = 1, jpj
+!CDIR NOVERRCHK
+         DO ji = 1, jpi
+            zc1 = ze1(ji,jj,1)
+            zc2 = ze2(ji,jj,1) 
+            zc3 = ze3(ji,jj,1)
+            etot (ji,jj,1) = (       zc1 +        zc2 +       zc3 )
+            enano(ji,jj,1) = ( 2.1 * zc1 + 0.42 * zc2 + 0.4 * zc3 )
+            ediat(ji,jj,1) = ( 1.6 * zc1 + 0.69 * zc2 + 0.7 * zc3 )
+         END DO
+      END DO
+
+    
+      DO jk = 2, nksrp      
+!CDIR NOVERRCHK
+         DO jj = 1, jpj
+!CDIR NOVERRCHK
+            DO ji = 1, jpi
+               zc1 = ze1(ji,jj,jk-1) * EXP( -0.5 * ( zekb(ji,jj,jk-1) + zekb(ji,jj,jk) ) )
+               zc2 = ze2(ji,jj,jk-1) * EXP( -0.5 * ( zekg(ji,jj,jk-1) + zekg(ji,jj,jk) ) )
+               zc3 = ze3(ji,jj,jk-1) * EXP( -0.5 * ( zekr(ji,jj,jk-1) + zekr(ji,jj,jk) ) )
+               ze1  (ji,jj,jk) = zc1
+               ze2  (ji,jj,jk) = zc2
+               ze3  (ji,jj,jk) = zc3
+               etot (ji,jj,jk) = (       zc1 +        zc2 +       zc3 )
+               enano(ji,jj,jk) = ( 2.1 * zc1 + 0.42 * zc2 + 0.4 * zc3 )
+               ediat(ji,jj,jk) = ( 1.6 * zc1 + 0.69 * zc2 + 0.7 * zc3 )
+            END DO
+         END DO
+      END DO
+
+      IF( ln_qsr_bio ) THEN                    !* heat flux accros w-level (used in the dynamics)
+         !                                     !  ------------------------
+         zxsi0r = 1.e0 / rn_si0
+         !
+         ze0(:,:,1) = rn_abs * qsr(:,:)
+         !                                                    ! surface value : separation in R-G-B + near surface
+         IF( ln_varpar ) THEN
+            ze0(:,:,1) = ( 1. - 3. * par_varsw(:,:) ) * qsr(:,:)
+            ze1(:,:,1) = par_varsw(:,:)               * qsr(:,:)         
+            ze2(:,:,1) = par_varsw(:,:)               * qsr(:,:)
+            ze3(:,:,1) = par_varsw(:,:)               * qsr(:,:)
+         ELSE
+            ze0(:,:,1) = ( 1. - 3. * xparsw )  * qsr(:,:)
+            ze1(:,:,1) = xparsw                * qsr(:,:)         
+            ze2(:,:,1) = xparsw                * qsr(:,:)
+            ze3(:,:,1) = xparsw                * qsr(:,:)
+         ENDIF
+         etot3(:,:,1) =  qsr(:,:) * tmask(:,:,1)
+         !
+         !
+         DO jk = 2, nksrp + 1
+!CDIR NOVERRCHK
+            DO jj = 1, jpj
+!CDIR NOVERRCHK
+               DO ji = 1, jpi
+                  zc0 = ze0(ji,jj,jk-1) * EXP( -fse3t(ji,jj,jk-1) * zxsi0r )
+                  zc1 = ze1(ji,jj,jk-1) * EXP( -zekb(ji,jj,jk-1 ) )
+                  zc2 = ze2(ji,jj,jk-1) * EXP( -zekg(ji,jj,jk-1 ) )
+                  zc3 = ze3(ji,jj,jk-1) * EXP( -zekr(ji,jj,jk-1 ) )
+                  ze0(ji,jj,jk) = zc0
+                  ze1(ji,jj,jk) = zc1
+                  ze2(ji,jj,jk) = zc2
+                  ze3(ji,jj,jk) = zc3
+                  etot3(ji,jj,jk) = ( zc0 + zc1 + zc2 + zc3 ) * tmask(ji,jj,jk)
+              END DO
+              !
+            END DO
+            !
+        END DO
+        !
+      ENDIF
+
+      !                                        !* Euphotic depth and level
+      neln(:,:) = 1                            !  ------------------------
+      heup(:,:) = 300.
+
+      DO jk = 2, nksrp
+         DO jj = 1, jpj
+           DO ji = 1, jpi
+              IF( etot(ji,jj,jk) >= 0.0043 * qsr(ji,jj) )  THEN
+                 neln(ji,jj) = jk+1                    ! Euphotic level : 1rst T-level strictly below Euphotic layer
+                 !                                     ! nb: ensure the compatibility with nmld_trc definition in trd_mld_trc_zint
+                 heup(ji,jj) = fsdepw(ji,jj,jk+1)      ! Euphotic layer depth
+              ENDIF
+           END DO
+        END DO
+      END DO
+ 
+      heup(:,:) = MIN( 300., heup(:,:) )
+
+      !                                        !* mean light over the mixed layer
+      zdepmoy(:,:)   = 0.e0                    !  -------------------------------
+      zetmp  (:,:)   = 0.e0
+      zetmp1 (:,:)   = 0.e0
+      zetmp2 (:,:)   = 0.e0
+
+      DO jk = 1, nksrp
+!CDIR NOVERRCHK
+         DO jj = 1, jpj
+!CDIR NOVERRCHK
+            DO ji = 1, jpi
+               IF( fsdepw(ji,jj,jk+1) <= hmld(ji,jj) ) THEN
+                  zetmp  (ji,jj) = zetmp  (ji,jj) + etot (ji,jj,jk) * fse3t(ji,jj,jk)
+                  zetmp1 (ji,jj) = zetmp1 (ji,jj) + enano(ji,jj,jk) * fse3t(ji,jj,jk)
+                  zetmp2 (ji,jj) = zetmp2 (ji,jj) + ediat(ji,jj,jk) * fse3t(ji,jj,jk)
+                  zdepmoy(ji,jj) = zdepmoy(ji,jj) + fse3t(ji,jj,jk)
+               ENDIF
+            END DO
+         END DO
+      END DO
+      !
+      emoy(:,:,:) = etot(:,:,:)
+      !
+      DO jk = 1, nksrp
+!CDIR NOVERRCHK
+         DO jj = 1, jpj
+!CDIR NOVERRCHK
+            DO ji = 1, jpi
+               IF( fsdepw(ji,jj,jk+1) <= hmld(ji,jj) ) THEN
+                  z1_dep = 1. / ( zdepmoy(ji,jj) + rtrn )
+                  emoy (ji,jj,jk) = zetmp (ji,jj) * z1_dep
+                  enano(ji,jj,jk) = zetmp1(ji,jj) * z1_dep
+                  ediat(ji,jj,jk) = zetmp2(ji,jj) * z1_dep
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      IF( ln_diatrc ) THEN        ! save output diagnostics
+        !
+        IF( lk_iomput ) THEN
+           IF( jnt == nrdttrc ) THEN
+              CALL iom_put( "Heup", heup(:,:  ) * tmask(:,:,1) )  ! euphotic layer deptht
+              CALL iom_put( "PAR" , emoy(:,:,:) * tmask(:,:,:) )  ! Photosynthetically Available Radiation
+           ENDIF
+        ELSE
+           trc2d(:,:,  jp_pcs0_2d + 10) = heup(:,:  ) * tmask(:,:,1)  
+           trc3d(:,:,:,jp_pcs0_3d + 3)  = etot(:,:,:) * tmask(:,:,:)
+        ENDIF
+        !
+      ENDIF
+      !
+      CALL wrk_dealloc( jpi, jpj,      zdepmoy, zetmp, zetmp1, zetmp2 )
+      CALL wrk_dealloc( jpi, jpj, jpk, zekg, zekr, zekb, ze0, ze1, ze2, ze3 )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_opt')
+      !
+   END SUBROUTINE p4z_opt
+
+   SUBROUTINE p4z_optsbc( kt )
+      !!----------------------------------------------------------------------
+      !!                  ***  routine p4z_optsbc  ***
+      !!
+      !! ** purpose :   read and interpolate the variable PAR fraction
+      !!                of shortwave radiation
+      !!
+      !! ** method  :   read the files and interpolate the appropriate variables
+      !!
+      !! ** input   :   external netcdf files
+      !!
+      !!----------------------------------------------------------------------
+      !! * arguments
+      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
+
+      !! * local declarations
+      INTEGER  :: ji,jj
+      REAL(wp) :: zcoef
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_optsbc')
+      !
+      ! Compute par_varsw at nit000 or only if there is more than 1 time record in par coefficient file
+      IF( ln_varpar ) THEN
+         IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_par > 1 ) ) THEN
+            CALL fld_read( kt, 1, sf_par )
+            par_varsw(:,:) = ( sf_par(1)%fnow(:,:,1) )/3.0
+         ENDIF
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_optsbc')
+      !
+   END SUBROUTINE p4z_optsbc
+
+   SUBROUTINE p4z_opt_init
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_opt_init  ***
+      !!
+      !! ** Purpose :   Initialization of tabulated attenuation coef
+      !!                and of the percentage of PAR in Shortwave
+      !!
+      !! ** Input   :   external ascii and netcdf files
+      !!----------------------------------------------------------------------
+      !
+      INTEGER :: numpar
+      INTEGER :: ierr
+      REAL(wp), DIMENSION(nbtimes) :: zsteps                 ! times records
+      !
+      CHARACTER(len=100) ::  cn_dir          ! Root directory for location of ssr files
+      TYPE(FLD_N) ::   sn_par                ! informations about the fields to be read
+      !
+      NAMELIST/nampisopt/cn_dir, sn_par, ln_varpar, parlux
+
+      !!----------------------------------------------------------------------
+
+      IF( nn_timing == 1 )  CALL timing_start('p4z_opt_init')
+
+      cn_dir  = './'            ! directory in which the model is executed
+      ! ... default values (NB: frequency positive => hours, negative => months)
+      !                  !   file       ! frequency !  variable   ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   !
+      !                  !   name       !  (hours)  !   name      !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      !
+      sn_par     = FLD_N( 'par_fraction',    24     ,  'fr_par'     ,  .true.    , .true.  ,   'yearly'  , ''       , ''         )
+
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampisopt )
+
+      IF(lwp) THEN
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' namelist : nampisopt '
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~ '
+         WRITE(numout,*) '    PAR as a variable fraction of SW     ln_varpar      = ', ln_varpar
+         WRITE(numout,*) '    Default value for the PAR fraction   parlux         = ', parlux
+      ENDIF
+      !
+      xparsw = parlux / 3.0
+      !
+      ! Variable PAR at the surface of the ocean
+      ! ----------------------------------------
+      IF( ln_varpar ) THEN
+         IF(lwp) WRITE(numout,*) '    initialize variable par fraction '
+         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         !
+         ALLOCATE( par_varsw(jpi,jpj) )
+         !
+         ALLOCATE( sf_par(1), STAT=ierr )           !* allocate and fill sf_sst (forcing structure) with sn_sst
+         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'p4z_opt_init: unable to allocate sf_par structure' )
+         !
+         CALL fld_fill( sf_par, (/ sn_par /), cn_dir, 'p4z_opt_init', 'Variable PAR fraction ', 'nampisopt' )
+                                   ALLOCATE( sf_par(1)%fnow(jpi,jpj,1)   )
+         IF( sn_par%ln_tint )      ALLOCATE( sf_par(1)%fdta(jpi,jpj,1,2) )
+
+         CALL iom_open (  TRIM( sn_par%clname ) , numpar )
+         CALL iom_gettime( numpar, zsteps, kntime=ntimes_par)  ! get number of record in file
+      ENDIF
+      !
+      CALL trc_oce_rgb( xkrgb )                  ! tabulated attenuation coefficients
+      nksrp = trc_oce_ext_lev( r_si2, 0.33e2 )     ! max level of light extinction (Blue Chl=0.01)
+      !
+      IF(lwp) WRITE(numout,*) '        level of light extinction = ', nksrp, ' ref depth = ', gdepw_0(nksrp+1), ' m'
+      !
+                         etot (:,:,:) = 0._wp
+                         enano(:,:,:) = 0._wp
+                         ediat(:,:,:) = 0._wp
+      IF( ln_qsr_bio )   etot3(:,:,:) = 0._wp
+      ! 
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_opt_init')
+      !
+   END SUBROUTINE p4z_opt_init
+
+
+   INTEGER FUNCTION p4z_opt_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_opt_alloc  ***
+      !!----------------------------------------------------------------------
+      ALLOCATE( enano(jpi,jpj,jpk), ediat(jpi,jpj,jpk), emoy (jpi,jpj,jpk), STAT=p4z_opt_alloc ) 
+         !
+      IF( p4z_opt_alloc /= 0 ) CALL ctl_warn('p4z_opt_alloc : failed to allocate arrays.')
+      !
+   END FUNCTION p4z_opt_alloc
+
+#else
+   !!----------------------------------------------------------------------
+   !!  Dummy module :                                   No PISCES bio-model
+   !!----------------------------------------------------------------------
+CONTAINS
+   SUBROUTINE p4z_opt                   ! Empty routine
+   END SUBROUTINE p4z_opt
+#endif 
+
+   !!======================================================================
+END MODULE  p4zopt
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zprod.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zprod.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zprod.F90	(revision 3680)
@@ -0,0 +1,525 @@
+MODULE p4zprod
+   !!======================================================================
+   !!                         ***  MODULE p4zprod  ***
+   !! TOP :  Growth Rate of the two phytoplanktons groups 
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!             3.4  !  2011-05  (O. Aumont, C. Ethe) New parameterization of light limitation
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_prod       :   Compute the growth Rate of the two phytoplanktons groups
+   !!   p4z_prod_init  :   Initialization of the parameters for growth
+   !!   p4z_prod_alloc :   Allocate variables for growth
+   !!----------------------------------------------------------------------
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zopt          !  optical model
+   USE p4zlim          !  Co-limitations of differents nutrients
+   USE prtctl_trc      !  print control for debugging
+   USE iom             !  I/O manager
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_prod         ! called in p4zbio.F90
+   PUBLIC   p4z_prod_init    ! called in trcsms_pisces.F90
+   PUBLIC   p4z_prod_alloc
+
+   !! * Shared module variables
+   LOGICAL , PUBLIC ::  ln_newprod = .FALSE.
+   REAL(wp), PUBLIC ::  pislope    = 3.0_wp            !:
+   REAL(wp), PUBLIC ::  pislope2   = 3.0_wp            !:
+   REAL(wp), PUBLIC ::  excret     = 10.e-5_wp         !:
+   REAL(wp), PUBLIC ::  excret2    = 0.05_wp           !:
+   REAL(wp), PUBLIC ::  bresp      = 0.00333_wp        !:
+   REAL(wp), PUBLIC ::  chlcnm     = 0.033_wp          !:
+   REAL(wp), PUBLIC ::  chlcdm     = 0.05_wp           !:
+   REAL(wp), PUBLIC ::  chlcmin    = 0.00333_wp        !:
+   REAL(wp), PUBLIC ::  fecnm      = 10.E-6_wp         !:
+   REAL(wp), PUBLIC ::  fecdm      = 15.E-6_wp         !:
+   REAL(wp), PUBLIC ::  grosip     = 0.151_wp          !:
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   prmax    !: optimal production = f(temperature)
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   quotan   !: proxy of N quota in Nanophyto
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   quotad   !: proxy of N quota in diatomee
+   
+   REAL(wp) :: r1_rday                !: 1 / rday
+   REAL(wp) :: texcret                !: 1 - excret 
+   REAL(wp) :: texcret2               !: 1 - excret2        
+
+
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zprod.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE p4z_prod( kt , jnt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_prod  ***
+      !!
+      !! ** Purpose :   Compute the phytoplankton production depending on
+      !!              light, temperature and nutrient availability
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      !
+      INTEGER, INTENT(in) :: kt, jnt
+      !
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zsilfac, znanotot, zdiattot, zconctemp, zconctemp2
+      REAL(wp) ::   zratio, zmax, zsilim, ztn, zadap
+      REAL(wp) ::   zlim, zsilfac2, zsiborn, zprod, zproreg, zproreg2
+      REAL(wp) ::   zmxltst, zmxlday, zmaxday
+      REAL(wp) ::   zpislopen  , zpislope2n
+      REAL(wp) ::   zrum, zcodel, zargu, zval
+      REAL(wp) ::   zrfact2
+      CHARACTER (len=25) :: charout
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zmixnano, zmixdiat, zstrn
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zpislopead, zpislopead2, zprdia, zprbio, zprdch, zprnch, zysopt   
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zprorca, zprorcad, zprofed, zprofen, zprochln, zprochld, zpronew, zpronewd
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_prod')
+      !
+      !  Allocate temporary workspace
+      CALL wrk_alloc( jpi, jpj,      zmixnano, zmixdiat, zstrn                                                  )
+      CALL wrk_alloc( jpi, jpj, jpk, zpislopead, zpislopead2, zprdia, zprbio, zprdch, zprnch, zysopt            ) 
+      CALL wrk_alloc( jpi, jpj, jpk, zprorca, zprorcad, zprofed, zprofen, zprochln, zprochld, zpronew, zpronewd )
+      !
+      zprorca (:,:,:) = 0._wp
+      zprorcad(:,:,:) = 0._wp
+      zprofed (:,:,:) = 0._wp
+      zprofen (:,:,:) = 0._wp
+      zprochln(:,:,:) = 0._wp
+      zprochld(:,:,:) = 0._wp
+      zpronew (:,:,:) = 0._wp
+      zpronewd(:,:,:) = 0._wp
+      zprdia  (:,:,:) = 0._wp
+      zprbio  (:,:,:) = 0._wp
+      zprdch  (:,:,:) = 0._wp
+      zprnch  (:,:,:) = 0._wp
+      zysopt  (:,:,:) = 0._wp
+
+      ! Computation of the optimal production
+      prmax(:,:,:) = 0.6_wp * r1_rday * tgfunc(:,:,:) 
+      IF( lk_degrad )  prmax(:,:,:) = prmax(:,:,:) * facvol(:,:,:) 
+
+      ! compute the day length depending on latitude and the day
+      zrum = REAL( nday_year - 80, wp ) / REAL( nyear_len(1), wp )
+      zcodel = ASIN(  SIN( zrum * rpi * 2._wp ) * SIN( rad * 23.5_wp )  )
+
+      ! day length in hours
+      zstrn(:,:) = 0.
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            zargu = TAN( zcodel ) * TAN( gphit(ji,jj) * rad )
+            zargu = MAX( -1., MIN(  1., zargu ) )
+            zstrn(ji,jj) = MAX( 0.0, 24. - 2. * ACOS( zargu ) / rad / 15. )
+         END DO
+      END DO
+
+      IF( ln_newprod ) THEN
+         ! Impact of the day duration on phytoplankton growth
+         DO jk = 1, jpkm1
+            DO jj = 1 ,jpj
+               DO ji = 1, jpi
+                  IF( etot(ji,jj,jk) > 1.E-3 ) THEN
+                     zval = MAX( 1., zstrn(ji,jj) )
+                     zval = 1.5 * zval / ( 12. + zval )
+                     zprbio(ji,jj,jk) = prmax(ji,jj,jk) * zval
+                     zprdia(ji,jj,jk) = zprbio(ji,jj,jk)
+                  ENDIF
+               END DO
+            END DO
+         END DO
+      ENDIF
+
+      ! Maximum light intensity
+      WHERE( zstrn(:,:) < 1.e0 ) zstrn(:,:) = 24.
+      zstrn(:,:) = 24. / zstrn(:,:)
+
+      IF( ln_newprod ) THEN
+!CDIR NOVERRCHK
+         DO jk = 1, jpkm1
+!CDIR NOVERRCHK
+            DO jj = 1, jpj
+!CDIR NOVERRCHK
+               DO ji = 1, jpi
+                  ! Computation of the P-I slope for nanos and diatoms
+                  IF( etot(ji,jj,jk) > 1.E-3 ) THEN
+                      ztn         = MAX( 0., tsn(ji,jj,jk,jp_tem) - 15. )
+                      zadap       = ztn / ( 2.+ ztn )
+                      zconctemp   = MAX( 0.e0 , trn(ji,jj,jk,jpdia) - xsizedia )
+                      zconctemp2  = trn(ji,jj,jk,jpdia) - zconctemp
+                      znanotot    = enano(ji,jj,jk) * zstrn(ji,jj)
+                      zdiattot    = ediat(ji,jj,jk) * zstrn(ji,jj)
+                      !
+                      zpislopead (ji,jj,jk) = pislope * ( 1.+ zadap  * EXP( -znanotot ) )  &
+                         &                   * trn(ji,jj,jk,jpnch) /( trn(ji,jj,jk,jpphy) * 12. + rtrn)
+                      !
+                      zpislopead2(ji,jj,jk) = (pislope * zconctemp2 + pislope2 * zconctemp) / ( trn(ji,jj,jk,jpdia) + rtrn )   &
+                         &                   * trn(ji,jj,jk,jpdch) /( trn(ji,jj,jk,jpdia) * 12. + rtrn)
+
+                      ! Computation of production function for Carbon
+                      !  ---------------------------------------------
+                      zpislopen  = zpislopead (ji,jj,jk) / ( ( r1_rday + bresp * r1_rday ) * rday + rtrn)
+                      zpislope2n = zpislopead2(ji,jj,jk) / ( ( r1_rday + bresp * r1_rday ) * rday + rtrn)
+                      zprbio(ji,jj,jk) = zprbio(ji,jj,jk) * ( 1.- EXP( -zpislopen  * znanotot )  )
+                      zprdia(ji,jj,jk) = zprdia(ji,jj,jk) * ( 1.- EXP( -zpislope2n * zdiattot )  )
+
+                      !  Computation of production function for Chlorophyll
+                      !--------------------------------------------------
+                      zmaxday  = 1._wp / ( prmax(ji,jj,jk) * rday + rtrn )
+                      zprnch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislopead (ji,jj,jk) * zmaxday * znanotot ) )
+                      zprdch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislopead2(ji,jj,jk) * zmaxday * zdiattot ) )
+                  ENDIF
+               END DO
+            END DO
+         END DO
+      ELSE
+!CDIR NOVERRCHK
+         DO jk = 1, jpkm1
+!CDIR NOVERRCHK
+            DO jj = 1, jpj
+!CDIR NOVERRCHK
+               DO ji = 1, jpi
+
+                  ! Computation of the P-I slope for nanos and diatoms
+                  IF( etot(ji,jj,jk) > 1.E-3 ) THEN
+                      ztn         = MAX( 0., tsn(ji,jj,jk,jp_tem) - 15. )
+                      zadap       = ztn / ( 2.+ ztn )
+                      zconctemp   = MAX( 0.e0 , trn(ji,jj,jk,jpdia) - xsizedia )
+                      zconctemp2  = trn(ji,jj,jk,jpdia) - zconctemp
+                      !
+                      zpislopead (ji,jj,jk) = pislope  * ( 1.+ zadap  * EXP( enano(ji,jj,jk) ) )
+                      zpislopead2(ji,jj,jk) = (pislope * zconctemp2 + pislope2 * zconctemp)  / ( trn(ji,jj,jk,jpdia) + rtrn )
+
+                      zpislopen =  zpislopead(ji,jj,jk) * trn(ji,jj,jk,jpnch)                &
+                        &          / ( trn(ji,jj,jk,jpphy) * 12.                  + rtrn )   &
+                        &          / ( prmax(ji,jj,jk) * rday * xlimphy(ji,jj,jk) + rtrn )
+
+                      zpislope2n = zpislopead2(ji,jj,jk) * trn(ji,jj,jk,jpdch)                &
+                        &          / ( trn(ji,jj,jk,jpdia) * 12.                  + rtrn )   &
+                        &          / ( prmax(ji,jj,jk) * rday * xlimdia(ji,jj,jk) + rtrn )
+
+                      ! Computation of production function for Carbon
+                      !  ---------------------------------------------
+                      zprbio(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislopen  * enano(ji,jj,jk) ) )
+                      zprdia(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislope2n * ediat(ji,jj,jk) ) )
+
+                      !  Computation of production function for Chlorophyll
+                      !--------------------------------------------------
+                      zprnch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislopen  * enano(ji,jj,jk) * zstrn(ji,jj) ) )
+                      zprdch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislope2n * ediat(ji,jj,jk) * zstrn(ji,jj) ) )
+                  ENDIF
+               END DO
+            END DO
+         END DO
+      ENDIF
+
+      !  Computation of a proxy of the N/C ratio
+      !  ---------------------------------------
+!CDIR NOVERRCHK
+      DO jk = 1, jpkm1
+!CDIR NOVERRCHK
+         DO jj = 1, jpj
+!CDIR NOVERRCHK
+            DO ji = 1, jpi
+                zval = ( xnanonh4(ji,jj,jk) + xnanono3(ji,jj,jk) ) * prmax(ji,jj,jk) / ( zprbio(ji,jj,jk) + rtrn )
+                quotan(ji,jj,jk) = MIN( 1., 0.5 + 0.5 * zval )
+                zval = ( xdiatnh4(ji,jj,jk) + xdiatno3(ji,jj,jk) ) * prmax(ji,jj,jk) / ( zprdia(ji,jj,jk) + rtrn )
+                quotad(ji,jj,jk) = MIN( 1., 0.5 + 0.5 * zval )
+            END DO
+         END DO
+      END DO
+
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+                IF( etot(ji,jj,jk) > 1.E-3 ) THEN
+                   !    Si/C of diatoms
+                   !    ------------------------
+                   !    Si/C increases with iron stress and silicate availability
+                   !    Si/C is arbitrariliy increased for very high Si concentrations
+                   !    to mimic the very high ratios observed in the Southern Ocean (silpot2)
+                  zlim  = trn(ji,jj,jk,jpsil) / ( trn(ji,jj,jk,jpsil) + xksi1 )
+                  zsilim = MIN( zprdia(ji,jj,jk) / ( prmax(ji,jj,jk) + rtrn ), xlimsi(ji,jj,jk) )
+                  zsilfac = 4.4 * EXP( -4.23 * zsilim ) * MAX( 0.e0, MIN( 1., 2.2 * ( zlim - 0.5 ) )  ) + 1.e0
+                  zsiborn = trn(ji,jj,jk,jpsil) * trn(ji,jj,jk,jpsil) * trn(ji,jj,jk,jpsil)
+                  IF (gphit(ji,jj) < -30 ) THEN
+                    zsilfac2 = 1. + 2. * zsiborn / ( zsiborn + xksi2**3 )
+                  ELSE
+                    zsilfac2 = 1. +      zsiborn / ( zsiborn + xksi2**3 )
+                  ENDIF
+                  zysopt(ji,jj,jk) = grosip * zlim * zsilfac * zsilfac2
+              ENDIF
+            END DO
+         END DO
+      END DO
+
+      !  Computation of the limitation term due to a mixed layer deeper than the euphotic depth
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            zmxltst = MAX( 0.e0, hmld(ji,jj) - heup(ji,jj) )
+            zmxlday = zmxltst * zmxltst * r1_rday
+            zmixnano(ji,jj) = 1. - zmxlday / ( 3. + zmxlday )
+            zmixdiat(ji,jj) = 1. - zmxlday / ( 4. + zmxlday )
+         END DO
+      END DO
+ 
+      !  Mixed-layer effect on production                                                                               
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( fsdepw(ji,jj,jk+1) <= hmld(ji,jj) ) THEN
+                  zprbio(ji,jj,jk) = zprbio(ji,jj,jk) * zmixnano(ji,jj)
+                  zprdia(ji,jj,jk) = zprdia(ji,jj,jk) * zmixdiat(ji,jj)
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      ! Computation of the various production terms 
+!CDIR NOVERRCHK
+      DO jk = 1, jpkm1
+!CDIR NOVERRCHK
+         DO jj = 1, jpj
+!CDIR NOVERRCHK
+            DO ji = 1, jpi
+               IF( etot(ji,jj,jk) > 1.E-3 ) THEN
+                  !  production terms for nanophyto.
+                  zprorca(ji,jj,jk) = zprbio(ji,jj,jk)  * xlimphy(ji,jj,jk) * trn(ji,jj,jk,jpphy) * rfact2
+                  zpronew(ji,jj,jk) = zprorca(ji,jj,jk) * xnanono3(ji,jj,jk) / ( xnanono3(ji,jj,jk) + xnanonh4(ji,jj,jk) + rtrn )
+                  !
+                  zratio = trn(ji,jj,jk,jpnfe) / ( trn(ji,jj,jk,jpphy) + rtrn )
+                  zratio = zratio / fecnm 
+                  zmax   = MAX( 0., ( 1. - zratio ) / ABS( 1.05 - zratio ) ) 
+                  zprofen(ji,jj,jk) = fecnm * prmax(ji,jj,jk)  &
+                  &             * ( 4. - 4.5 * xlimnfe(ji,jj,jk) / ( xlimnfe(ji,jj,jk) + 0.5 ) )    &
+                  &             * biron(ji,jj,jk) / ( biron(ji,jj,jk) + concnfe(ji,jj,jk) )  &
+                  &             * zmax * trn(ji,jj,jk,jpphy) * rfact2
+                  !  production terms for diatomees
+                  zprorcad(ji,jj,jk) = zprdia(ji,jj,jk) * xlimdia(ji,jj,jk) * trn(ji,jj,jk,jpdia) * rfact2
+                  zpronewd(ji,jj,jk) = zprorcad(ji,jj,jk) * xdiatno3(ji,jj,jk) / ( xdiatno3(ji,jj,jk) + xdiatnh4(ji,jj,jk) + rtrn )
+                  !
+                  zratio = trn(ji,jj,jk,jpdfe) / ( trn(ji,jj,jk,jpdia) + rtrn )
+                  zratio = zratio / fecdm 
+                  zmax   = MAX( 0., ( 1. - zratio ) / ABS( 1.05 - zratio ) ) 
+                  zprofed(ji,jj,jk) = fecdm * prmax(ji,jj,jk)  &
+                  &             * ( 4. - 4.5 * xlimdfe(ji,jj,jk) / ( xlimdfe(ji,jj,jk) + 0.5 ) )    &
+                  &             * biron(ji,jj,jk) / ( biron(ji,jj,jk) + concdfe(ji,jj,jk) )  &
+                  &             * zmax * trn(ji,jj,jk,jpdia) * rfact2
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      IF( ln_newprod ) THEN
+!CDIR NOVERRCHK
+         DO jk = 1, jpkm1
+!CDIR NOVERRCHK
+            DO jj = 1, jpj
+!CDIR NOVERRCHK
+               DO ji = 1, jpi
+                  IF( fsdepw(ji,jj,jk+1) <= hmld(ji,jj) ) THEN
+                     zprnch(ji,jj,jk) = zprnch(ji,jj,jk) * zmixnano(ji,jj)
+                     zprdch(ji,jj,jk) = zprdch(ji,jj,jk) * zmixdiat(ji,jj)
+                  ENDIF
+                  IF( etot(ji,jj,jk) > 1.E-3 ) THEN
+                     !  production terms for nanophyto. ( chlorophyll )
+                     znanotot = enano(ji,jj,jk) * zstrn(ji,jj)
+                     zprod    = rday * zprorca(ji,jj,jk) * zprnch(ji,jj,jk) * xlimphy(ji,jj,jk)
+                     zprochln(ji,jj,jk) = chlcmin * 12. * zprorca (ji,jj,jk)
+                     zprochln(ji,jj,jk) = zprochln(ji,jj,jk) + (chlcnm-chlcmin) * 12. * zprod / (  zpislopead(ji,jj,jk) * znanotot +rtrn)
+                     !  production terms for diatomees ( chlorophyll )
+                     zdiattot = ediat(ji,jj,jk) * zstrn(ji,jj)
+                     zprod = rday * zprorcad(ji,jj,jk) * zprdch(ji,jj,jk) * xlimdia(ji,jj,jk)
+                     zprochld(ji,jj,jk) = chlcmin * 12. * zprorcad(ji,jj,jk)
+                     zprochld(ji,jj,jk) = zprochld(ji,jj,jk) + (chlcdm-chlcmin) * 12. * zprod / ( zpislopead2(ji,jj,jk) * zdiattot +rtrn )
+                  ENDIF
+               END DO
+            END DO
+         END DO
+      ELSE
+!CDIR NOVERRCHK
+         DO jk = 1, jpkm1
+!CDIR NOVERRCHK
+            DO jj = 1, jpj
+!CDIR NOVERRCHK
+               DO ji = 1, jpi
+                  IF( etot(ji,jj,jk) > 1.E-3 ) THEN
+                     !  production terms for nanophyto. ( chlorophyll )
+                     znanotot = enano(ji,jj,jk) * zstrn(ji,jj)
+                     zprod = rday * zprorca(ji,jj,jk) * zprnch(ji,jj,jk) * trn(ji,jj,jk,jpphy) * xlimphy(ji,jj,jk)
+                     zprochln(ji,jj,jk) = chlcmin * 12. * zprorca (ji,jj,jk)
+                     zprochln(ji,jj,jk) = zprochln(ji,jj,jk) + (chlcnm-chlcmin) * 144. * zprod            &
+                     &                    / ( zpislopead(ji,jj,jk) * trn(ji,jj,jk,jpnch) * znanotot +rtrn )
+                     !  production terms for diatomees ( chlorophyll )
+                     zdiattot = ediat(ji,jj,jk) * zstrn(ji,jj)
+                     zprod = rday * zprorcad(ji,jj,jk) * zprdch(ji,jj,jk) * trn(ji,jj,jk,jpdia) * xlimdia(ji,jj,jk)
+                     zprochld(ji,jj,jk) = chlcmin * 12. * zprorcad(ji,jj,jk)
+                     zprochld(ji,jj,jk) = zprochld(ji,jj,jk) + (chlcdm-chlcmin) * 144. * zprod             &
+                     &                    / ( zpislopead2(ji,jj,jk) * trn(ji,jj,jk,jpdch) * zdiattot +rtrn )
+                  ENDIF
+               END DO
+            END DO
+         END DO
+      ENDIF
+
+      !   Update the arrays TRA which contain the biological sources and sinks
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+           DO ji =1 ,jpi
+              zproreg  = zprorca(ji,jj,jk) - zpronew(ji,jj,jk)
+              zproreg2 = zprorcad(ji,jj,jk) - zpronewd(ji,jj,jk)
+              tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) - zprorca(ji,jj,jk) - zprorcad(ji,jj,jk)
+              tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) - zpronew(ji,jj,jk) - zpronewd(ji,jj,jk)
+              tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) - zproreg - zproreg2
+              tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) + zprorca(ji,jj,jk) * texcret
+              tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) + zprochln(ji,jj,jk) * texcret
+              tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) + zprofen(ji,jj,jk) * texcret
+              tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) + zprorcad(ji,jj,jk) * texcret2
+              tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) + zprochld(ji,jj,jk) * texcret2
+              tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) + zprofed(ji,jj,jk) * texcret2
+              tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) + zprorcad(ji,jj,jk) * zysopt(ji,jj,jk) * texcret2
+              tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + excret2 * zprorcad(ji,jj,jk) + excret * zprorca(ji,jj,jk)
+              tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) + o2ut * ( zproreg + zproreg2) &
+                 &                + ( o2ut + o2nit ) * ( zpronew(ji,jj,jk) + zpronewd(ji,jj,jk) )
+              tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) - texcret * zprofen(ji,jj,jk) - texcret2 * zprofed(ji,jj,jk)
+              tra(ji,jj,jk,jpsil) = tra(ji,jj,jk,jpsil) - texcret2 * zprorcad(ji,jj,jk) * zysopt(ji,jj,jk)
+              tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprorca(ji,jj,jk) - zprorcad(ji,jj,jk)
+              tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3 * ( zpronew(ji,jj,jk) + zpronewd(ji,jj,jk) ) &
+                 &                                      - rno3 * ( zproreg + zproreg2 )
+          END DO
+        END DO
+     END DO
+
+     ! Total primary production per year
+     tpp = tpp + glob_sum( ( zprorca(:,:,:) + zprorcad(:,:,:) ) * cvol(:,:,:) )
+
+     IF( ln_diatrc ) THEN
+         !
+         zrfact2 = 1.e3 * rfact2r  ! conversion from mol/L/timestep into mol/m3/s
+         IF( lk_iomput ) THEN
+           IF( jnt == nrdttrc ) THEN
+              CALL iom_put( "PPPHY"  , zprorca (:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by nanophyto
+              CALL iom_put( "PPPHY2" , zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by diatom
+              CALL iom_put( "PPNEWN" , zpronew (:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by nanophyto
+              CALL iom_put( "PPNEWD" , zpronewd(:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by diatom
+              CALL iom_put( "PBSi"   , zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:) ) ! biogenic silica production
+              CALL iom_put( "PFeD"   , zprofed (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by diatom
+              CALL iom_put( "PFeN"   , zprofen (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by nanophyto
+              CALL iom_put( "Mumax"  , prmax(:,:,:) * tmask(:,:,:) )  ! Maximum growth rate
+              CALL iom_put( "MuN"    , zprbio(:,:,:) * xlimphy(:,:,:) * tmask(:,:,:) )  ! Realized growth rate for nanophyto
+              CALL iom_put( "MuD"    , zprdia(:,:,:) * xlimdia(:,:,:) * tmask(:,:,:) )  ! Realized growth rate for diatoms
+              CALL iom_put( "LNlight", zprbio (:,:,:) / (prmax(:,:,:) + rtrn) * tmask(:,:,:) )  ! light limitation term
+              CALL iom_put( "LDlight", zprdia (:,:,:) / (prmax(:,:,:) + rtrn) * tmask(:,:,:) )  ! light limitation term
+           ENDIF
+         ELSE
+              trc3d(:,:,:,jp_pcs0_3d + 4)  = zprorca (:,:,:) * zrfact2 * tmask(:,:,:)
+              trc3d(:,:,:,jp_pcs0_3d + 5)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:)
+              trc3d(:,:,:,jp_pcs0_3d + 6)  = zpronew (:,:,:) * zrfact2 * tmask(:,:,:)
+              trc3d(:,:,:,jp_pcs0_3d + 7)  = zpronewd(:,:,:) * zrfact2 * tmask(:,:,:)
+              trc3d(:,:,:,jp_pcs0_3d + 8)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:)
+              trc3d(:,:,:,jp_pcs0_3d + 9)  = zprofed (:,:,:) * zrfact2 * tmask(:,:,:)
+#  if ! defined key_kriest
+              trc3d(:,:,:,jp_pcs0_3d + 10) = zprofen (:,:,:) * zrfact2 * tmask(:,:,:)
+#  endif
+         ENDIF
+         !
+      ENDIF
+
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('prod')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      CALL wrk_dealloc( jpi, jpj,      zmixnano, zmixdiat, zstrn                                                  )
+      CALL wrk_dealloc( jpi, jpj, jpk, zpislopead, zpislopead2, zprdia, zprbio, zprdch, zprnch, zysopt            ) 
+      CALL wrk_dealloc( jpi, jpj, jpk, zprorca, zprorcad, zprofed, zprofen, zprochln, zprochld, zpronew, zpronewd )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_prod')
+      !
+   END SUBROUTINE p4z_prod
+
+
+   SUBROUTINE p4z_prod_init
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_prod_init  ***
+      !!
+      !! ** Purpose :   Initialization of phytoplankton production parameters
+      !!
+      !! ** Method  :   Read the nampisprod namelist and check the parameters
+      !!      called at the first timestep (nittrc000)
+      !!
+      !! ** input   :   Namelist nampisprod
+      !!----------------------------------------------------------------------
+      !
+      NAMELIST/nampisprod/ pislope, pislope2, ln_newprod, bresp, excret, excret2,  &
+         &                 chlcnm, chlcdm, chlcmin, fecnm, fecdm, grosip
+      !!----------------------------------------------------------------------
+
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampisprod )
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist parameters for phytoplankton growth, nampisprod'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    Enable new parame. of production (T/F)   ln_newprod   =', ln_newprod
+         WRITE(numout,*) '    mean Si/C ratio                           grosip       =', grosip
+         WRITE(numout,*) '    P-I slope                                 pislope      =', pislope
+         WRITE(numout,*) '    excretion ratio of nanophytoplankton      excret       =', excret
+         WRITE(numout,*) '    excretion ratio of diatoms                excret2      =', excret2
+         IF( ln_newprod )  THEN
+            WRITE(numout,*) '    basal respiration in phytoplankton        bresp        =', bresp
+            WRITE(numout,*) '    Maximum Chl/C in phytoplankton            chlcmin      =', chlcmin
+         ENDIF
+         WRITE(numout,*) '    P-I slope  for diatoms                    pislope2     =', pislope2
+         WRITE(numout,*) '    Minimum Chl/C in nanophytoplankton        chlcnm       =', chlcnm
+         WRITE(numout,*) '    Minimum Chl/C in diatoms                  chlcdm       =', chlcdm
+         WRITE(numout,*) '    Maximum Fe/C in nanophytoplankton         fecnm        =', fecnm
+         WRITE(numout,*) '    Minimum Fe/C in diatoms                   fecdm        =', fecdm
+      ENDIF
+      !
+      r1_rday   = 1._wp / rday 
+      texcret   = 1._wp - excret
+      texcret2  = 1._wp - excret2
+      tpp       = 0._wp
+      !
+   END SUBROUTINE p4z_prod_init
+
+
+   INTEGER FUNCTION p4z_prod_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_prod_alloc  ***
+      !!----------------------------------------------------------------------
+      ALLOCATE( prmax(jpi,jpj,jpk), quotan(jpi,jpj,jpk), quotad(jpi,jpj,jpk), STAT = p4z_prod_alloc )
+      !
+      IF( p4z_prod_alloc /= 0 ) CALL ctl_warn('p4z_prod_alloc : failed to allocate arrays.')
+      !
+   END FUNCTION p4z_prod_alloc
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_prod                    ! Empty routine
+   END SUBROUTINE p4z_prod
+#endif 
+
+   !!======================================================================
+END MODULE  p4zprod
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zrem.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zrem.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zrem.F90	(revision 3680)
@@ -0,0 +1,395 @@
+MODULE p4zrem
+   !!======================================================================
+   !!                         ***  MODULE p4zrem  ***
+   !! TOP :   PISCES Compute remineralization/dissolution of organic compounds
+   !!=========================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Quota model for iron
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_top'       and                                      TOP models
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_rem       :  Compute remineralization/dissolution of organic compounds
+   !!   p4z_rem_init  :  Initialisation of parameters for remineralisation
+   !!   p4z_rem_alloc :  Allocate remineralisation variables
+   !!----------------------------------------------------------------------
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zopt          !  optical model
+   USE p4zche          !  chemical model
+   USE p4zprod         !  Growth rate of the 2 phyto groups
+   USE p4zmeso         !  Sources and sinks of mesozooplankton
+   USE p4zint          !  interpolation and computation of various fields
+   USE p4zlim
+   USE prtctl_trc      !  print control for debugging
+   USE iom             !  I/O manager
+
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_rem         ! called in p4zbio.F90
+   PUBLIC   p4z_rem_init    ! called in trcsms_pisces.F90
+   PUBLIC   p4z_rem_alloc
+
+   !! * Shared module variables
+   REAL(wp), PUBLIC ::  xremik    = 0.3_wp     !: remineralisation rate of POC 
+   REAL(wp), PUBLIC ::  xremip    = 0.025_wp   !: remineralisation rate of DOC
+   REAL(wp), PUBLIC ::  nitrif    = 0.05_wp    !: NH4 nitrification rate 
+   REAL(wp), PUBLIC ::  xsirem    = 0.003_wp   !: remineralisation rate of POC 
+   REAL(wp), PUBLIC ::  xsiremlab = 0.025_wp   !: fast remineralisation rate of POC 
+   REAL(wp), PUBLIC ::  xsilab    = 0.31_wp    !: fraction of labile biogenic silica 
+   REAL(wp), PUBLIC ::  oxymin    = 1.e-6_wp   !: halk saturation constant for anoxia 
+
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   denitr     !: denitrification array
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   denitnh4   !: -    -    -    -   -
+
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zrem.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE p4z_rem( kt, jnt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_rem  ***
+      !!
+      !! ** Purpose :   Compute remineralization/scavenging of organic compounds
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      !
+      INTEGER, INTENT(in) ::   kt, jnt ! ocean time step
+      !
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zremip, zremik, zsiremin 
+      REAL(wp) ::   zsatur, zsatur2, znusil, znusil2, zdep, zdepmin, zfactdep
+      REAL(wp) ::   zbactfer, zorem, zorem2, zofer, zolimit
+      REAL(wp) ::   zosil, ztem
+#if ! defined key_kriest
+      REAL(wp) ::   zofer2
+#endif
+      REAL(wp) ::   zonitr, zstep, zrfact2
+      CHARACTER (len=25) :: charout
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: ztempbac 
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zdepbac, zolimi, zdepprod
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_rem')
+      !
+      ! Allocate temporary workspace
+      CALL wrk_alloc( jpi, jpj,      ztempbac                  )
+      CALL wrk_alloc( jpi, jpj, jpk, zdepbac, zdepprod, zolimi )
+
+      ! Initialisation of temprary arrys
+      zdepprod(:,:,:) = 1._wp
+      ztempbac(:,:)   = 0._wp
+
+      ! Computation of the mean phytoplankton concentration as
+      ! a crude estimate of the bacterial biomass
+      ! this parameterization has been deduced from a model version
+      ! that was modeling explicitely bacteria
+      ! -------------------------------------------------------
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zdep = MAX( hmld(ji,jj), heup(ji,jj) )
+               IF( fsdept(ji,jj,jk) < zdep ) THEN
+                  zdepbac(ji,jj,jk) = MIN( 0.7 * ( trn(ji,jj,jk,jpzoo) + 2.* trn(ji,jj,jk,jpmes) ), 4.e-6 )
+                  ztempbac(ji,jj)   = zdepbac(ji,jj,jk)
+               ELSE
+                  zdepmin = MIN( 1., zdep / fsdept(ji,jj,jk) )
+                  zdepbac (ji,jj,jk) = zdepmin**0.683 * ztempbac(ji,jj)
+                  zdepprod(ji,jj,jk) = zdepmin**0.273
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ! denitrification factor computed from O2 levels
+               nitrfac(ji,jj,jk) = MAX(  0.e0, 0.4 * ( 6.e-6  - trn(ji,jj,jk,jpoxy) )    &
+                  &                                / ( oxymin + trn(ji,jj,jk,jpoxy) )  )
+               nitrfac(ji,jj,jk) = MIN( 1., nitrfac(ji,jj,jk) )
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zstep   = xstep
+# if defined key_degrad
+               zstep = zstep * facvol(ji,jj,jk)
+# endif
+               ! DOC ammonification. Depends on depth, phytoplankton biomass
+               ! and a limitation term which is supposed to be a parameterization
+               !     of the bacterial activity. 
+               zremik = xremik * zstep / 1.e-6 * xlimbac(ji,jj,jk) * zdepbac(ji,jj,jk) 
+               zremik = MAX( zremik, 2.74e-4 * xstep )
+               ! Ammonification in oxic waters with oxygen consumption
+               ! -----------------------------------------------------
+               zolimit = zremik * ( 1.- nitrfac(ji,jj,jk) ) * trn(ji,jj,jk,jpdoc) 
+               zolimi(ji,jj,jk) = MIN( ( trn(ji,jj,jk,jpoxy) - rtrn ) / o2ut, zolimit ) 
+               ! Ammonification in suboxic waters with denitrification
+               ! -------------------------------------------------------
+               denitr(ji,jj,jk)  = MIN(  ( trn(ji,jj,jk,jpno3) - rtrn ) / rdenit,   &
+                  &                     zremik * nitrfac(ji,jj,jk) * trn(ji,jj,jk,jpdoc)  )
+               !
+               zolimi (ji,jj,jk) = MAX( 0.e0, zolimi (ji,jj,jk) )
+               denitr (ji,jj,jk) = MAX( 0.e0, denitr (ji,jj,jk) )
+               !
+            END DO
+         END DO
+      END DO
+
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zstep   = xstep
+# if defined key_degrad
+               zstep = zstep * facvol(ji,jj,jk)
+# endif
+               ! NH4 nitrification to NO3. Ceased for oxygen concentrations
+               ! below 2 umol/L. Inhibited at strong light 
+               ! ----------------------------------------------------------
+               zonitr  =nitrif * zstep * trn(ji,jj,jk,jpnh4) / ( 1.+ emoy(ji,jj,jk) ) * ( 1.- nitrfac(ji,jj,jk) ) 
+               denitnh4(ji,jj,jk) = nitrif * zstep * trn(ji,jj,jk,jpnh4) * nitrfac(ji,jj,jk) 
+               ! Update of the tracers trends
+               ! ----------------------------
+               tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) - zonitr - denitnh4(ji,jj,jk)
+               tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) + zonitr - rdenita * denitnh4(ji,jj,jk)
+               tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) - o2nit * zonitr
+               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) - 2 * rno3 * zonitr + rno3 * ( rdenita - 1. ) * denitnh4(ji,jj,jk)
+            END DO
+         END DO
+      END DO
+
+       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('rem1')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+       ENDIF
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+               ! Bacterial uptake of iron. No iron is available in DOC. So
+               ! Bacteries are obliged to take up iron from the water. Some
+               ! studies (especially at Papa) have shown this uptake to be significant
+               ! ----------------------------------------------------------
+               zbactfer = 10.e-6 *  rfact2 * prmax(ji,jj,jk) * xlimbacl(ji,jj,jk)             &
+                  &              * trn(ji,jj,jk,jpfer) / ( 2.5E-10 + trn(ji,jj,jk,jpfer) )    &
+                  &              * zdepprod(ji,jj,jk) * zdepbac(ji,jj,jk)
+#if defined key_kriest
+               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) - zbactfer*0.05
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zbactfer*0.05
+#else
+               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) - zbactfer*0.16
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zbactfer*0.12
+               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zbactfer*0.04
+#endif
+            END DO
+         END DO
+      END DO
+
+       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('rem2')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+       ENDIF
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zstep   = xstep
+# if defined key_degrad
+               zstep = zstep * facvol(ji,jj,jk)
+# endif
+               ! POC disaggregation by turbulence and bacterial activity. 
+               ! --------------------------------------------------------
+               zremip = xremip * zstep * tgfunc(ji,jj,jk) * ( 1.- 0.55 * nitrfac(ji,jj,jk) ) 
+
+               ! POC disaggregation rate is reduced in anoxic zone as shown by
+               ! sediment traps data. In oxic area, the exponent of the martin s
+               ! law is around -0.87. In anoxic zone, it is around -0.35. This
+               ! means a disaggregation constant about 0.5 the value in oxic zones
+               ! -----------------------------------------------------------------
+               zorem  = zremip * trn(ji,jj,jk,jppoc)
+               zofer  = zremip * trn(ji,jj,jk,jpsfe)
+#if ! defined key_kriest
+               zorem2 = zremip * trn(ji,jj,jk,jpgoc)
+               zofer2 = zremip * trn(ji,jj,jk,jpbfe)
+#else
+               zorem2 = zremip * trn(ji,jj,jk,jpnum)
+#endif
+
+               ! Update the appropriate tracers trends
+               ! -------------------------------------
+
+               tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + zorem
+               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + zofer
+#if defined key_kriest
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) - zorem
+               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) - zorem2
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) - zofer
+#else
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zorem2 - zorem
+               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) - zorem2
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zofer2 - zofer
+               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) - zofer2
+#endif
+
+            END DO
+         END DO
+      END DO
+
+       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('rem3')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+       ENDIF
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zstep   = xstep
+# if defined key_degrad
+               zstep = zstep * facvol(ji,jj,jk)
+# endif
+               ! Remineralization rate of BSi depedant on T and saturation
+               ! ---------------------------------------------------------
+               zsatur   = ( sio3eq(ji,jj,jk) - trn(ji,jj,jk,jpsil) ) / ( sio3eq(ji,jj,jk) + rtrn )
+               zsatur   = MAX( rtrn, zsatur )
+               zsatur2  = ( 1. + tsn(ji,jj,jk,jp_tem) / 400.)**37
+               znusil   = 0.225  * ( 1. + tsn(ji,jj,jk,jp_tem) / 15.) * zsatur + 0.775 * zsatur2 * zsatur**9.25
+               znusil2  = 0.225  * ( 1. + tsn(ji,jj,1,jp_tem) / 15.) + 0.775 * zsatur2
+
+               ! Two classes of BSi are considered : a labile fraction and 
+               ! a more refractory one. The ratio between both fractions is
+               ! constant and specified in the namelist.
+               ! ----------------------------------------------------------
+               zdep     = MAX( hmld(ji,jj), heup(ji,jj) ) 
+               zdep     = MAX( 0., fsdept(ji,jj,jk) - zdep )
+               ztem     = MAX( tsn(ji,jj,1,jp_tem), 0. )
+               zfactdep = xsilab * EXP(-( xsiremlab - xsirem ) * znusil2 * zdep / wsbio2 ) * ztem / ( ztem + 10. )
+               zsiremin = ( xsiremlab * zfactdep + xsirem * ( 1. - zfactdep ) ) * zstep * znusil
+               zosil    = zsiremin * trn(ji,jj,jk,jpgsi)
+               !
+               tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) - zosil
+               tra(ji,jj,jk,jpsil) = tra(ji,jj,jk,jpsil) + zosil
+               !
+            END DO
+         END DO
+      END DO
+
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('rem4')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+       ENDIF
+
+      ! Update the arrays TRA which contain the biological sources and sinks
+      ! --------------------------------------------------------------------
+
+      DO jk = 1, jpkm1
+         tra(:,:,jk,jppo4) = tra(:,:,jk,jppo4) + zolimi (:,:,jk) + denitr(:,:,jk)
+         tra(:,:,jk,jpnh4) = tra(:,:,jk,jpnh4) + zolimi (:,:,jk) + denitr(:,:,jk)
+         tra(:,:,jk,jpno3) = tra(:,:,jk,jpno3) - denitr (:,:,jk) * rdenit
+         tra(:,:,jk,jpdoc) = tra(:,:,jk,jpdoc) - zolimi (:,:,jk) - denitr(:,:,jk)
+         tra(:,:,jk,jpoxy) = tra(:,:,jk,jpoxy) - zolimi (:,:,jk) * o2ut
+         tra(:,:,jk,jpdic) = tra(:,:,jk,jpdic) + zolimi (:,:,jk) + denitr(:,:,jk)
+         tra(:,:,jk,jptal) = tra(:,:,jk,jptal) + rno3 * ( zolimi(:,:,jk) + ( rdenit + 1.) * denitr(:,:,jk) )
+      END DO
+
+      IF( ln_diatrc .AND. lk_iomput .AND. jnt == nrdttrc ) THEN
+          zrfact2 = 1.e3 * rfact2r
+          CALL iom_put( "REMIN" , zolimi(:,:,:) * tmask(:,:,:) * zrfact2 )  ! Remineralisation rate
+          CALL iom_put( "DENIT" , denitr(:,:,:) * rdenit * rno3 * tmask(:,:,:) * zrfact2  )  ! Denitrification
+      ENDIF
+
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('rem6')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      CALL wrk_dealloc( jpi, jpj,      ztempbac                  )
+      CALL wrk_dealloc( jpi, jpj, jpk, zdepbac, zdepprod, zolimi )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_rem')
+      !
+   END SUBROUTINE p4z_rem
+
+
+   SUBROUTINE p4z_rem_init
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_rem_init  ***
+      !!
+      !! ** Purpose :   Initialization of remineralization parameters
+      !!
+      !! ** Method  :   Read the nampisrem namelist and check the parameters
+      !!      called at the first timestep
+      !!
+      !! ** input   :   Namelist nampisrem
+      !!
+      !!----------------------------------------------------------------------
+      NAMELIST/nampisrem/ xremik, xremip, nitrif, xsirem, xsiremlab, xsilab,   &
+      &                   oxymin
+
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampisrem )
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist parameters for remineralization, nampisrem'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    remineralisation rate of POC              xremip    =', xremip
+         WRITE(numout,*) '    remineralization rate of DOC              xremik    =', xremik
+         WRITE(numout,*) '    remineralization rate of Si               xsirem    =', xsirem
+         WRITE(numout,*) '    fast remineralization rate of Si          xsiremlab =', xsiremlab
+         WRITE(numout,*) '    fraction of labile biogenic silica        xsilab    =', xsilab
+         WRITE(numout,*) '    NH4 nitrification rate                    nitrif    =', nitrif
+         WRITE(numout,*) '    halk saturation constant for anoxia       oxymin    =', oxymin
+      ENDIF
+      !
+      nitrfac (:,:,:) = 0._wp
+      denitr  (:,:,:) = 0._wp
+      denitnh4(:,:,:) = 0._wp
+      !
+   END SUBROUTINE p4z_rem_init
+
+
+   INTEGER FUNCTION p4z_rem_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_rem_alloc  ***
+      !!----------------------------------------------------------------------
+      ALLOCATE( denitr(jpi,jpj,jpk), denitnh4(jpi,jpj,jpk), STAT=p4z_rem_alloc )
+      !
+      IF( p4z_rem_alloc /= 0 )   CALL ctl_warn('p4z_rem_alloc: failed to allocate arrays')
+      !
+   END FUNCTION p4z_rem_alloc
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_rem                    ! Empty routine
+   END SUBROUTINE p4z_rem
+#endif 
+
+   !!======================================================================
+END MODULE p4zrem
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsbc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsbc.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsbc.F90	(revision 3680)
@@ -0,0 +1,527 @@
+MODULE p4zsbc
+   !!======================================================================
+   !!                         ***  MODULE p4sbc  ***
+   !! TOP :   PISCES surface boundary conditions of external inputs of nutrients
+   !!======================================================================
+   !! History :   3.5  !  2012-07 (O. Aumont, C. Ethe) Original code
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_sbc        :  Read and interpolate time-varying nutrients fluxes
+   !!   p4z_sbc_init   :  Initialization of p4z_sbc
+   !!----------------------------------------------------------------------
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE iom             !  I/O manager
+   USE fldread         !  time interpolation
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_sbc
+   PUBLIC   p4z_sbc_init   
+
+   !! * Shared module variables
+   LOGICAL , PUBLIC  :: ln_dust     = .FALSE.    !: boolean for dust input from the atmosphere
+   LOGICAL , PUBLIC  :: ln_solub    = .FALSE.    !: boolean for variable solubility of atmospheric iron
+   LOGICAL , PUBLIC  :: ln_river    = .FALSE.    !: boolean for river input of nutrients
+   LOGICAL , PUBLIC  :: ln_ndepo    = .FALSE.    !: boolean for atmospheric deposition of N
+   LOGICAL , PUBLIC  :: ln_ironsed  = .FALSE.    !: boolean for Fe input from sediments
+   LOGICAL , PUBLIC  :: ln_hydrofe  = .FALSE.    !: boolean for Fe input from hydrothermal vents
+   LOGICAL , PUBLIC  :: ln_ironice  = .FALSE.    !: boolean for Fe input from sea ice
+   REAL(wp), PUBLIC  :: sedfeinput  = 1.E-9_wp   !: Coastal release of Iron
+   REAL(wp), PUBLIC  :: dustsolub   = 0.014_wp   !: Solubility of the dust
+   REAL(wp), PUBLIC  :: icefeinput  = 10E-9_wp   !: Iron concentration in sea ice
+   REAL(wp), PUBLIC  :: wdust       = 2.0_wp     !: Sinking speed of the dust 
+   REAL(wp), PUBLIC  :: nitrfix     = 1E-7_wp    !: Nitrogen fixation rate   
+   REAL(wp), PUBLIC  :: diazolight  = 50._wp     !: Nitrogen fixation sensitivty to light 
+   REAL(wp), PUBLIC  :: concfediaz  = 1.E-10_wp  !: Fe half-saturation Cste for diazotrophs 
+   REAL(wp)          :: hratio      = 9.E-5_wp   !: Fe:3He ratio assumed for vent iron supply
+
+   LOGICAL , PUBLIC  :: ll_sbc
+
+   !! * Module variables
+   LOGICAL  ::  ll_solub
+
+   INTEGER , PARAMETER  :: jpriv  = 7   !: Maximum number of river input fields
+   INTEGER , PARAMETER  :: jr_dic = 1   !: index of dissolved inorganic carbon
+   INTEGER , PARAMETER  :: jr_doc = 2   !: index of dissolved organic carbon
+   INTEGER , PARAMETER  :: jr_din = 3   !: index of dissolved inorganic nitrogen
+   INTEGER , PARAMETER  :: jr_don = 4   !: index of dissolved organic nitrogen
+   INTEGER , PARAMETER  :: jr_dip = 5   !: index of dissolved inorganic phosporus
+   INTEGER , PARAMETER  :: jr_dop = 6   !: index of dissolved organic phosphorus
+   INTEGER , PARAMETER  :: jr_dsi = 7   !: index of dissolved silicate
+
+
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_dust      ! structure of input dust
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_solub      ! structure of input dust
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_river  ! structure of input riverdic
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_ndepo     ! structure of input nitrogen deposition
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_ironsed   ! structure of input iron from sediment
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_hydrofe   ! structure of input iron from hydrothermal vents
+
+   INTEGER , PARAMETER :: nbtimes = 365  !: maximum number of times record in a file
+   INTEGER  :: ntimes_dust, ntimes_riv, ntimes_ndep       ! number of time steps in a file
+   INTEGER  :: ntimes_solub, ntimes_hydro                 ! number of time steps in a file
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: dust, solub       !: dust fields
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: rivdic, rivalk    !: river input fields
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: rivdin, rivdip    !: river input fields
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: rivdsi    !: river input fields
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: nitdep    !: atmospheric N deposition 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ironsed   !: Coastal supply of iron
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: hydrofe   !: Hydrothermal vent supply of iron
+
+   REAL(wp), PUBLIC :: sumdepsi, rivalkinput, rivdicinput, nitdepinput
+   REAL(wp), PUBLIC :: rivdininput, rivdipinput, rivdsiinput
+
+   REAL(wp) :: ryyss                    !: number of seconds per year 
+
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_sbc( kt )
+      !!----------------------------------------------------------------------
+      !!                  ***  routine p4z_sbc  ***
+      !!
+      !! ** purpose :   read and interpolate the external sources of nutrients
+      !!
+      !! ** method  :   read the files and interpolate the appropriate variables
+      !!
+      !! ** input   :   external netcdf files
+      !!
+      !!----------------------------------------------------------------------
+      !! * arguments
+      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
+
+      !! * local declarations
+      INTEGER  :: ji,jj 
+      REAL(wp) :: zcoef, zyyss
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_sbc')
+
+      !
+      ! Compute dust at nit000 or only if there is more than 1 time record in dust file
+      IF( ln_dust ) THEN
+         IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_dust > 1 ) ) THEN
+            CALL fld_read( kt, 1, sf_dust )
+            dust(:,:) = sf_dust(1)%fnow(:,:,1)
+         ENDIF
+      ENDIF
+
+      IF( ll_solub ) THEN
+         IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_solub > 1 ) ) THEN
+            CALL fld_read( kt, 1, sf_solub )
+            solub(:,:) = sf_solub(1)%fnow(:,:,1)
+         ENDIF
+      ENDIF
+
+      ! N/P and Si releases due to coastal rivers
+      ! Compute river at nit000 or only if there is more than 1 time record in river file
+      ! -----------------------------------------
+      IF( ln_river ) THEN
+         IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_riv > 1 ) ) THEN
+            CALL fld_read( kt, 1, sf_river )
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  zcoef = ryyss * cvol(ji,jj,1) 
+                  rivalk(ji,jj) =   sf_river(jr_dic)%fnow(ji,jj,1)                                    &
+                     &              * 1.E3        / ( 12. * zcoef + rtrn )
+                  rivdic(ji,jj) = ( sf_river(jr_dic)%fnow(ji,jj,1) + sf_river(jr_doc)%fnow(ji,jj,1) ) &
+                     &              * 1.E3         / ( 12. * zcoef + rtrn )
+                  rivdin(ji,jj) = ( sf_river(jr_din)%fnow(ji,jj,1) + sf_river(jr_don)%fnow(ji,jj,1) ) &
+                     &              * 1.E3 / rno3 / ( 14. * zcoef + rtrn )
+                  rivdip(ji,jj) = ( sf_river(jr_dip)%fnow(ji,jj,1) + sf_river(jr_dop)%fnow(ji,jj,1) ) &
+                     &              * 1.E3 / po4r / ( 31. * zcoef + rtrn )
+                  rivdsi(ji,jj) =   sf_river(jr_dsi)%fnow(ji,jj,1)                                    &
+                     &              * 1.E3        / ( 28.1 * zcoef + rtrn )
+               END DO
+            END DO
+         ENDIF
+      ENDIF
+
+      ! Compute N deposition at nit000 or only if there is more than 1 time record in N deposition file
+      IF( ln_ndepo ) THEN
+         IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_ndep > 1 ) ) THEN
+            CALL fld_read( kt, 1, sf_ndepo )
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  nitdep(ji,jj) = sf_ndepo(1)%fnow(ji,jj,1) / rno3 / ( 14E6 * ryyss * fse3t(ji,jj,1) + rtrn )
+               END DO
+            END DO
+         ENDIF
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_sbc')
+      !
+   END SUBROUTINE p4z_sbc
+
+   SUBROUTINE p4z_sbc_init
+
+      !!----------------------------------------------------------------------
+      !!                  ***  routine p4z_sbc_init  ***
+      !!
+      !! ** purpose :   initialization of the external sources of nutrients
+      !!
+      !! ** method  :   read the files and compute the budget
+      !!                called at the first timestep (nittrc000)
+      !!
+      !! ** input   :   external netcdf files
+      !!
+      !!----------------------------------------------------------------------
+      !
+      INTEGER  :: ji, jj, jk, jm, ifpr
+      INTEGER  :: ii0, ii1, ij0, ij1
+      INTEGER  :: numdust, numsolub, numriv, numiron, numdepo, numhydro
+      INTEGER  :: ierr, ierr1, ierr2, ierr3
+      REAL(wp) :: zexpide, zdenitide, zmaskt
+      REAL(wp) :: ztimes_dust, ztimes_riv, ztimes_ndep 
+      REAL(wp), DIMENSION(nbtimes) :: zsteps                 ! times records
+      REAL(wp), DIMENSION(:), ALLOCATABLE :: rivinput
+      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zdust, zndepo, zriver, zcmask
+      !
+      CHARACTER(len=100) ::  cn_dir          ! Root directory for location of ssr files
+      TYPE(FLD_N), DIMENSION(jpriv) ::  slf_river    ! array of namelist informations on the fields to read
+      TYPE(FLD_N) ::   sn_dust, sn_solub, sn_ndepo, sn_ironsed, sn_hydrofe   ! informations about the fields to be read
+      TYPE(FLD_N) ::   sn_riverdoc, sn_riverdic, sn_riverdsi   ! informations about the fields to be read
+      TYPE(FLD_N) ::   sn_riverdin, sn_riverdon, sn_riverdip, sn_riverdop
+      !
+      NAMELIST/nampissbc/cn_dir, sn_dust, sn_solub, sn_riverdic, sn_riverdoc, sn_riverdin, sn_riverdon,     &
+        &                sn_riverdip, sn_riverdop, sn_riverdsi, sn_ndepo, sn_ironsed, sn_hydrofe, &
+        &                ln_dust, ln_solub, ln_river, ln_ndepo, ln_ironsed, ln_ironice, ln_hydrofe,    &
+        &                sedfeinput, dustsolub, icefeinput, wdust, nitrfix, diazolight, concfediaz, hratio
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_sbc_init')
+      !
+      ryyss   = nyear_len(1) * rday    ! number of seconds per year and per month
+      !
+      !                            !* set file information
+      cn_dir  = './'            ! directory in which the model is executed
+      ! ... default values (NB: frequency positive => hours, negative => months)
+      !                  !   file       ! frequency !  variable   ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   !
+      !                  !   name       !  (hours)  !   name      !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      !
+      sn_dust     = FLD_N( 'dust'       ,    -1     ,  'dust'     ,  .true.    , .true.  ,   'yearly'  , ''       , ''         )
+      sn_solub    = FLD_N( 'solubility' ,    -12    ,  'solub'    ,  .true.    , .true.  ,   'yearly'  , ''       , ''         )
+      sn_riverdic = FLD_N( 'river'      ,   -12     ,  'riverdic' ,  .false.   , .true.  ,   'yearly'  , ''       , ''         )
+      sn_riverdoc = FLD_N( 'river'      ,   -12     ,  'riverdoc' ,  .false.   , .true.  ,   'yearly'  , ''       , ''         )
+      sn_riverdin = FLD_N( 'river'      ,   -12     ,  'riverdin' ,  .false.   , .true.  ,   'yearly'  , ''       , ''         )
+      sn_riverdon = FLD_N( 'river'      ,   -12     ,  'riverdon' ,  .false.   , .true.  ,   'yearly'  , ''       , ''         )
+      sn_riverdip = FLD_N( 'river'      ,   -12     ,  'riverdip' ,  .false.   , .true.  ,   'yearly'  , ''       , ''         )
+      sn_riverdop = FLD_N( 'river'      ,   -12     ,  'riverdop' ,  .false.   , .true.  ,   'yearly'  , ''       , ''         )
+      sn_riverdsi = FLD_N( 'river'      ,   -12     ,  'riverdsi' ,  .false.   , .true.  ,   'yearly'  , ''       , ''         )
+      sn_ndepo    = FLD_N( 'ndeposition',   -12     ,  'ndep'     ,  .false.   , .true.  ,   'yearly'  , ''       , ''         )
+      sn_ironsed  = FLD_N( 'ironsed'    ,   -12     ,  'bathy'    ,  .false.   , .true.  ,   'yearly'  , ''       , ''         )
+      sn_hydrofe  = FLD_N( 'hydrofe'    ,   -12     ,  'hydro'    ,  .false.   , .true.  ,   'yearly'  , ''       , ''         )
+
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampissbc )
+
+      IF(lwp) THEN
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' namelist : nampissbc '
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~ '
+         WRITE(numout,*) '    dust input from the atmosphere           ln_dust     = ', ln_dust
+         WRITE(numout,*) '    Variable solubility of iron input        ln_solub    = ', ln_solub
+         WRITE(numout,*) '    river input of nutrients                 ln_river    = ', ln_river
+         WRITE(numout,*) '    atmospheric deposition of n              ln_ndepo    = ', ln_ndepo
+         WRITE(numout,*) '    Fe input from sediments                  ln_ironsed  = ', ln_ironsed
+         WRITE(numout,*) '    Fe input from seaice                     ln_ironice  = ', ln_ironice
+         WRITE(numout,*) '    fe input from hydrothermal vents         ln_hydrofe  = ', ln_hydrofe
+         WRITE(numout,*) '    coastal release of iron                  sedfeinput  = ', sedfeinput
+         WRITE(numout,*) '    solubility of the dust                   dustsolub   = ', dustsolub
+         WRITE(numout,*) '    Iron concentration in sea ice            icefeinput  = ', icefeinput
+         WRITE(numout,*) '    sinking speed of the dust                wdust       = ', wdust
+         WRITE(numout,*) '    nitrogen fixation rate                   nitrfix     = ', nitrfix
+         WRITE(numout,*) '    nitrogen fixation sensitivty to light    diazolight  = ', diazolight
+         WRITE(numout,*) '    fe half-saturation cste for diazotrophs  concfediaz  = ', concfediaz
+         WRITE(numout,*) '    Fe to 3He ratio assumed for vent iron supply hratio  = ', hratio
+      END IF
+
+      IF( ln_dust .OR. ln_river .OR. ln_ndepo ) THEN  ;  ll_sbc = .TRUE.
+      ELSE                                            ;  ll_sbc = .FALSE.
+      ENDIF
+
+      IF( ln_dust .AND. ln_solub ) THEN               ;  ll_solub = .TRUE.
+      ELSE                                            ;  ll_solub = .FALSE.
+      ENDIF
+
+      ! dust input from the atmosphere
+      ! ------------------------------
+      IF( ln_dust ) THEN 
+         !
+         IF(lwp) WRITE(numout,*) '    initialize dust input from atmosphere '
+         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '
+         !
+         ALLOCATE( dust(jpi,jpj) )    ! allocation
+         !
+         ALLOCATE( sf_dust(1), STAT=ierr )           !* allocate and fill sf_sst (forcing structure) with sn_sst
+         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'p4z_sed_init: unable to allocate sf_dust structure' )
+         !
+         CALL fld_fill( sf_dust, (/ sn_dust /), cn_dir, 'p4z_sed_init', 'Atmospheric dust deposition', 'nampissed' )
+                                   ALLOCATE( sf_dust(1)%fnow(jpi,jpj,1)   )
+         IF( sn_dust%ln_tint )     ALLOCATE( sf_dust(1)%fdta(jpi,jpj,1,2) )
+         !
+         IF( Agrif_Root() ) THEN   !  Only on the master grid
+            ! Get total input dust ; need to compute total atmospheric supply of Si in a year
+            CALL iom_open (  TRIM( sn_dust%clname ) , numdust )
+            CALL iom_gettime( numdust, zsteps, kntime=ntimes_dust)  ! get number of record in file
+            ALLOCATE( zdust(jpi,jpj,ntimes_dust) )
+            DO jm = 1, ntimes_dust
+               CALL iom_get( numdust, jpdom_data, TRIM( sn_dust%clvar ), zdust(:,:,jm), jm )
+            END DO
+            CALL iom_close( numdust )
+            ztimes_dust = 1._wp / FLOAT( ntimes_dust ) 
+            sumdepsi = 0.e0
+            DO jm = 1, ntimes_dust
+               sumdepsi = sumdepsi + glob_sum( zdust(:,:,jm) * e1e2t(:,:) * tmask(:,:,1) * ztimes_dust )
+            ENDDO
+            sumdepsi = sumdepsi / ( nyear_len(1) * rday ) * 12. * 8.8 * 0.075 / 28.1 
+            DEALLOCATE( zdust)
+         ENDIF
+      ELSE
+         sumdepsi  = 0._wp
+      END IF
+
+      ! Solubility of dust deposition of iron
+      ! Only if ln_dust and ln_solubility set to true (ll_solub = .true.)
+      ! -----------------------------------------------------------------
+      IF( ll_solub ) THEN
+         !
+         IF(lwp) WRITE(numout,*) '    initialize variable solubility of Fe '
+         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '
+         !
+         ALLOCATE( solub(jpi,jpj) )    ! allocation
+         !
+         ALLOCATE( sf_solub(1), STAT=ierr )           !* allocate and fill sf_sst (forcing structure) with sn_sst
+         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'p4z_sed_init: unable to allocate sf_solub structure' )
+         !
+         CALL fld_fill( sf_solub, (/ sn_solub /), cn_dir, 'p4z_sed_init', 'Solubility of atm. iron ', 'nampissed' )
+                                   ALLOCATE( sf_solub(1)%fnow(jpi,jpj,1)   )
+         IF( sn_solub%ln_tint )    ALLOCATE( sf_solub(1)%fdta(jpi,jpj,1,2) )
+         ! get number of record in file
+         CALL iom_open (  TRIM( sn_solub%clname ) , numsolub )
+         CALL iom_gettime( numsolub, zsteps, kntime=ntimes_solub)  ! get number of record in file
+         CALL iom_close( numsolub )
+      ENDIF
+
+      ! nutrient input from rivers
+      ! --------------------------
+      IF( ln_river ) THEN
+         !
+         slf_river(jr_dic) = sn_riverdic  ;  slf_river(jr_doc) = sn_riverdoc  ;  slf_river(jr_din) = sn_riverdin 
+         slf_river(jr_don) = sn_riverdon  ;  slf_river(jr_dip) = sn_riverdip  ;  slf_river(jr_dop) = sn_riverdop
+         slf_river(jr_dsi) = sn_riverdsi  
+         !
+         ALLOCATE( rivdic(jpi,jpj), rivalk(jpi,jpj), rivdin(jpi,jpj), rivdip(jpi,jpj), rivdsi(jpi,jpj) ) 
+         !
+         ALLOCATE( sf_river(jpriv), rivinput(jpriv), STAT=ierr1 )           !* allocate and fill sf_river (forcing structure) with sn_river_
+         rivinput(:) = 0.0
+
+         IF( ierr1 > 0 )   CALL ctl_stop( 'STOP', 'p4z_sed_init: unable to allocate sf_irver structure' )
+         !
+         CALL fld_fill( sf_river, slf_river, cn_dir, 'p4z_sed_init', 'Input from river ', 'nampissed' )
+         DO ifpr = 1, jpriv
+                                          ALLOCATE( sf_river(ifpr)%fnow(jpi,jpj,1  ) )
+            IF( slf_river(ifpr)%ln_tint ) ALLOCATE( sf_river(ifpr)%fdta(jpi,jpj,1,2) )
+         END DO
+         IF( Agrif_Root() ) THEN   !  Only on the master grid
+            ! Get total input rivers ; need to compute total river supply in a year
+            DO ifpr = 1, jpriv
+               CALL iom_open ( TRIM( slf_river(ifpr)%clname ), numriv )
+               CALL iom_gettime( numriv, zsteps, kntime=ntimes_riv)
+               ALLOCATE( zriver(jpi,jpj,ntimes_riv) )
+               DO jm = 1, ntimes_riv
+                  CALL iom_get( numriv, jpdom_data, TRIM( slf_river(ifpr)%clvar ), zriver(:,:,jm), jm )
+               END DO
+               CALL iom_close( numriv )
+               ztimes_riv = 1._wp / FLOAT(ntimes_riv) 
+               DO jm = 1, ntimes_riv
+                  rivinput(ifpr) = rivinput(ifpr) + glob_sum( zriver(:,:,jm) * tmask(:,:,1) * ztimes_riv ) 
+               END DO
+               DEALLOCATE( zriver)
+            END DO
+            ! N/P and Si releases due to coastal rivers
+            ! -----------------------------------------
+            rivdicinput = (rivinput(jr_dic) + rivinput(jr_doc) ) * 1E3 / 12._wp
+            rivdininput = (rivinput(jr_din) + rivinput(jr_don) ) * 1E3 / rno3 / 14._wp
+            rivdipinput = (rivinput(jr_dip) + rivinput(jr_dop) ) * 1E3 / po4r / 31._wp
+            rivdsiinput = rivinput(jr_dsi) * 1E3 / 28.1_wp
+            rivalkinput = rivinput(jr_dic) * 1E3 / 12._wp
+            !
+         ENDIF
+      ELSE
+         rivdicinput = 0._wp
+         rivdininput = 0._wp
+         rivdipinput = 0._wp
+         rivdsiinput = 0._wp
+         rivalkinput = 0._wp
+      END IF 
+
+      ! nutrient input from dust
+      ! ------------------------
+      IF( ln_ndepo ) THEN
+         !
+         IF(lwp) WRITE(numout,*) '    initialize the nutrient input by dust from ndeposition.orca.nc'
+         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         !
+         ALLOCATE( nitdep(jpi,jpj) )    ! allocation
+         !
+         ALLOCATE( sf_ndepo(1), STAT=ierr3 )           !* allocate and fill sf_sst (forcing structure) with sn_sst
+         IF( ierr3 > 0 )   CALL ctl_stop( 'STOP', 'p4z_sed_init: unable to allocate sf_ndepo structure' )
+         !
+         CALL fld_fill( sf_ndepo, (/ sn_ndepo /), cn_dir, 'p4z_sed_init', 'Nutrient atmospheric depositon ', 'nampissed' )
+                                   ALLOCATE( sf_ndepo(1)%fnow(jpi,jpj,1)   )
+         IF( sn_ndepo%ln_tint )    ALLOCATE( sf_ndepo(1)%fdta(jpi,jpj,1,2) )
+         !
+         IF( Agrif_Root() ) THEN   !  Only on the master grid
+            ! Get total input dust ; need to compute total atmospheric supply of N in a year
+            CALL iom_open ( TRIM( sn_ndepo%clname ), numdepo )
+            CALL iom_gettime( numdepo, zsteps, kntime=ntimes_ndep)
+            ALLOCATE( zndepo(jpi,jpj,ntimes_ndep) )
+            DO jm = 1, ntimes_ndep
+               CALL iom_get( numdepo, jpdom_data, TRIM( sn_ndepo%clvar ), zndepo(:,:,jm), jm )
+            END DO
+            CALL iom_close( numdepo )
+            ztimes_ndep = 1._wp / FLOAT( ntimes_ndep ) 
+            nitdepinput = 0._wp
+            DO jm = 1, ntimes_ndep
+              nitdepinput = nitdepinput + glob_sum( zndepo(:,:,jm) * e1e2t(:,:) * tmask(:,:,1) * ztimes_ndep )
+            ENDDO
+            nitdepinput = nitdepinput / rno3 / 14E6 
+            DEALLOCATE( zndepo)
+         ENDIF
+      ELSE
+         nitdepinput = 0._wp
+      ENDIF
+
+      ! coastal and island masks
+      ! ------------------------
+      IF( ln_ironsed ) THEN     
+         !
+         IF(lwp) WRITE(numout,*) '    computation of an island mask to enhance coastal supply of iron'
+         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         !
+         ALLOCATE( ironsed(jpi,jpj,jpk) )    ! allocation
+         !
+         CALL iom_open ( TRIM( sn_ironsed%clname ), numiron )
+         ALLOCATE( zcmask(jpi,jpj,jpk) )
+         CALL iom_get  ( numiron, jpdom_data, TRIM( sn_ironsed%clvar ), zcmask(:,:,:), 1 )
+         CALL iom_close( numiron )
+         !
+         DO jk = 1, 5
+            DO jj = 2, jpjm1
+               DO ji = fs_2, fs_jpim1
+                  IF( tmask(ji,jj,jk) /= 0. ) THEN
+                     zmaskt = tmask(ji+1,jj,jk) * tmask(ji-1,jj,jk) * tmask(ji,jj+1,jk)    &
+                        &                       * tmask(ji,jj-1,jk) * tmask(ji,jj,jk+1)
+                     IF( zmaskt == 0. )   zcmask(ji,jj,jk ) = MAX( 0.1, zcmask(ji,jj,jk) ) 
+                  END IF
+               END DO
+            END DO
+         END DO
+         IF( cp_cfg == 'orca' .AND. jp_cfg == 2 ) THEN
+            ii0 = 176   ;   ii1 =  176        ! Southern Island : Kerguelen
+            ij0 =  37   ;   ij1 =   37  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp  
+            !
+            ii0 = 119   ;   ii1 =  119        ! South Georgia
+            ij0 =  29   ;   ij1 =   29  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp  
+            !
+            ii0 = 111   ;   ii1 =  111        ! Falklands
+            ij0 =  35   ;   ij1 =   35  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp  
+            !
+            ii0 = 168   ;   ii1 =  168        ! Crozet
+            ij0 =  40   ;   ij1 =   40  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp  
+            !
+            ii0 = 119   ;   ii1 =  119        ! South Orkney
+            ij0 =  28   ;   ij1 =   28  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp  
+            !
+            ii0 = 140   ;   ii1 =  140        ! Bouvet Island
+            ij0 =  33   ;   ij1 =   33  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp  
+            !
+            ii0 = 178   ;   ii1 =  178        ! Prince edwards
+            ij0 =  34   ;   ij1 =   34  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp  
+            !
+            ii0 =  43   ;   ii1 =   43        ! Balleny islands
+            ij0 =  21   ;   ij1 =   21  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp  
+         ENDIF
+         CALL lbc_lnk( zcmask , 'T', 1. )      ! lateral boundary conditions on cmask   (sign unchanged)
+         DO jk = 1, jpk
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  zexpide   = MIN( 8.,( fsdept(ji,jj,jk) / 500. )**(-1.5) )
+                  zdenitide = -0.9543 + 0.7662 * LOG( zexpide ) - 0.235 * LOG( zexpide )**2
+                  zcmask(ji,jj,jk) = zcmask(ji,jj,jk) * MIN( 1., EXP( zdenitide ) / 0.5 )
+               END DO
+            END DO
+         END DO
+         ! Coastal supply of iron
+         ! -------------------------
+         ironsed(:,:,jpk) = 0._wp
+         DO jk = 1, jpkm1
+            ironsed(:,:,jk) = sedfeinput * zcmask(:,:,jk) / ( fse3t(:,:,jk) * rday )
+         END DO
+         DEALLOCATE( zcmask)
+      ENDIF
+      !
+      ! Iron from Hydrothermal vents
+      ! ------------------------
+      IF( ln_hydrofe ) THEN
+         !
+         IF(lwp) WRITE(numout,*) '    Input of iron from hydrothermal vents '
+         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         !
+         ALLOCATE( hydrofe(jpi,jpj,jpk) )    ! allocation
+         !
+         CALL iom_open ( TRIM( sn_hydrofe%clname ), numhydro )
+         CALL iom_get  ( numhydro, jpdom_data, TRIM( sn_hydrofe%clvar ), hydrofe(:,:,:), 1 )
+         CALL iom_close( numhydro )
+         !
+         hydrofe(:,:,:) = ( hydrofe(:,:,:) * hratio ) / ( cvol(:,:,:) * ryyss + rtrn ) / fse3t(:,:,:)
+         !
+      ENDIF
+      ! 
+      IF( ll_sbc ) CALL p4z_sbc( nit000 ) 
+      !
+      IF(lwp) THEN 
+         WRITE(numout,*)
+         WRITE(numout,*) '    Total input of elements from river supply'
+         WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    N Supply   : ', rivdininput*rno3*1E3/1E12*14.,' TgN/yr'
+         WRITE(numout,*) '    Si Supply  : ', rivdsiinput*1E3/1E12*28.1,' TgSi/yr'
+         WRITE(numout,*) '    P Supply   : ', rivdipinput*1E3*po4r/1E12*31.,' TgP/yr'
+         WRITE(numout,*) '    Alk Supply : ', rivalkinput*1E3/1E12,' Teq/yr'
+         WRITE(numout,*) '    DIC Supply : ', rivdicinput*1E3*12./1E12,'TgC/yr'
+         WRITE(numout,*) 
+         WRITE(numout,*) '    Total input of elements from atmospheric supply'
+         WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    N Supply   : ', nitdepinput*rno3*1E3/1E12*14.,' TgN/yr'
+         WRITE(numout,*) 
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_sbc_init')
+      !
+   END SUBROUTINE p4z_sbc_init
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_sbc                         ! Empty routine
+   END SUBROUTINE p4z_sbc
+#endif 
+
+   !!======================================================================
+END MODULE  p4zsbc
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsed.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsed.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsed.F90	(revision 3680)
@@ -0,0 +1,398 @@
+MODULE p4zsed
+   !!======================================================================
+   !!                         ***  MODULE p4sed  ***
+   !! TOP :   PISCES Compute loss of organic matter in the sediments
+   !!======================================================================
+   !! History :   1.0  !  2004-03 (O. Aumont) Original code
+   !!             2.0  !  2007-12 (C. Ethe, G. Madec)  F90
+   !!             3.4  !  2011-06 (C. Ethe) USE of fldread
+   !!             3.5  !  2012-07 (O. Aumont) improvment of river input of nutrients 
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_sed        :  Compute loss of organic matter in the sediments
+   !!----------------------------------------------------------------------
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zsink         !  vertical flux of particulate matter due to sinking
+   USE p4zopt          !  optical model
+   USE p4zlim          !  Co-limitations of differents nutrients
+   USE p4zrem          !  Remineralisation of organic matter
+   USE p4zsbc          !  External source of nutrients 
+   USE p4zint          !  interpolation and computation of various fields
+   USE iom             !  I/O manager
+   USE prtctl_trc      !  print control for debugging
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_sed   
+
+   !! * Module variables
+   REAL(wp) :: ryyss                    !: number of seconds per year 
+   REAL(wp) :: r1_ryyss                 !: inverse of ryyss
+   REAL(wp) :: rmtss                    !: number of seconds per month
+   REAL(wp) :: r1_rday                  !: inverse of rday
+
+   INTEGER ::  numnit  
+
+
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE p4z_sed( kt, jnt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_sed  ***
+      !!
+      !! ** Purpose :   Compute loss of organic matter in the sediments. This
+      !!              is by no way a sediment model. The loss is simply 
+      !!              computed to balance the inout from rivers and dust
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      !
+      INTEGER, INTENT(in) ::   kt, jnt ! ocean time step
+      INTEGER  ::   ji, jj, jk, ikt
+#if ! defined key_sed
+      REAL(wp) ::   zsumsedsi, zsumsedpo4, zsumsedcal
+      REAL(wp) ::   zrivalk, zrivsil, zrivno3
+#endif
+      REAL(wp) ::  zwflux, zfminus, zfplus
+      REAL(wp) ::  zlim, zfact, zfactcal
+      REAL(wp) ::  zo2, zno3, zflx, zpdenit, z1pdenit
+      REAL(wp) ::  zsiloss, zcaloss, zwsbio3, zwsbio4, zwscal, zdep, zwstpoc
+      REAL(wp) ::  ztrfer, ztrpo4, zwdust
+      REAL(wp) ::  zrdenittot, zsdenittot, znitrpottot
+      !
+      CHARACTER (len=25) :: charout
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zpdep, zsidep, zwork1, zwork2, zwork3, zwork4
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zdenit2d, zironice
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: znitrpot, zirondep
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_sed')
+      !
+      IF( kt == nit000 .AND. jnt == 1 )  THEN
+         ryyss    = nyear_len(1) * rday    ! number of seconds per year and per month
+         rmtss    = ryyss / raamo
+         r1_rday  = 1. / rday
+         r1_ryyss = 1. / ryyss
+         IF( ln_check_mass .AND. lwp)  &
+           &  CALL ctl_opn( numnit, 'nitrogen.budget', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea )
+      ENDIF
+      !
+      ! Allocate temporary workspace
+      CALL wrk_alloc( jpi, jpj, zdenit2d, zwork1, zwork2, zwork3, zwork4 )
+      CALL wrk_alloc( jpi, jpj, jpk, znitrpot )
+      zdenit2d(:,:) = 0.e0
+
+      ! Iron input/uptake due to sea ice : Crude parameterization based on Lancelot et al.
+      ! ----------------------------------------------------
+      IF( ln_ironice ) THEN  
+         !                                              
+         CALL wrk_alloc( jpi, jpj, zironice )
+         !                                              
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zdep    = rfact2 / fse3t(ji,jj,1)
+    !           zwflux  = ( emps(ji,jj) - emp(ji,jj) ) &
+    !           &        * tsn(ji,jj,1,jp_sal) / ( tsn(ji,jj,1,jp_sal) - 6.0 ) / 1000.
+               zwflux = 0.
+               zfminus = MIN( 0., -zwflux ) * trn(ji,jj,1,jpfer) * zdep
+               zfplus  = MAX( 0., -zwflux ) * 10E-9 * zdep
+               zironice(ji,jj) =  zfplus + zfminus
+            END DO
+         END DO
+         !
+         trn(:,:,1,jpfer) = trn(:,:,1,jpfer) + zironice(:,:) 
+         !                                              
+         IF( ln_diatrc .AND. lk_iomput .AND. jnt == nrdttrc )   &
+            &   CALL iom_put( "Ironice", zironice(:,:) * 1.e+3 * rfact2r * fse3t(:,:,1) * tmask(:,:,1) ) ! iron flux from ice
+         CALL wrk_dealloc( jpi, jpj, zironice )
+         !                                              
+      ENDIF
+
+      ! Add the external input of nutrients from dust deposition
+      ! ----------------------------------------------------------
+      IF( ln_dust ) THEN
+         !                                              
+         CALL wrk_alloc( jpi, jpj,      zpdep, zsidep )
+         CALL wrk_alloc( jpi, jpj, jpk, zirondep      )
+         !                                              ! Iron and Si deposition at the surface
+         IF( ln_solub ) THEN
+            zirondep(:,:,1) = solub(:,:) * dust(:,:) * rfact2 / fse3t(:,:,1) / ( 55.85 * rmtss ) + 3.e-10 * r1_ryyss 
+         ELSE
+            zirondep(:,:,1) = dustsolub  * dust(:,:) * rfact2 / fse3t(:,:,1) / ( 55.85 * rmtss ) + 3.e-10 * r1_ryyss 
+         ENDIF
+         zsidep(:,:) = 8.8 * 0.075 * dust(:,:) * rfact2 / fse3t(:,:,1) / ( 28.1  * rmtss )
+         zpdep (:,:) = 0.1 * 0.021 * dust(:,:) * rfact2 / fse3t(:,:,1) / ( 31.   * rmtss )
+         !                                              ! Iron solubilization of particles in the water column
+         zwdust = 0.005 / ( wdust * 55.85 * 30.42 ) / ( 45. * rday ) 
+         DO jk = 2, jpkm1
+            zirondep(:,:,jk) = dust(:,:) * zwdust * rfact2 * EXP( -fsdept(:,:,jk) / 1000. )
+         END DO
+         !                                              ! Iron solubilization of particles in the water column
+         trn(:,:,1,jppo4) = trn(:,:,1,jppo4) + zpdep   (:,:)
+         trn(:,:,1,jpsil) = trn(:,:,1,jpsil) + zsidep  (:,:)
+         trn(:,:,:,jpfer) = trn(:,:,:,jpfer) + zirondep(:,:,:) 
+         !                                              
+         IF( ln_diatrc ) THEN
+            zfact = 1.e+3 * rfact2r
+            IF( lk_iomput .AND. jnt == nrdttrc ) THEN
+               CALL iom_put( "Irondep", zirondep(:,:,1) * zfact * fse3t(:,:,1) * tmask(:,:,1) ) ! surface downward dust depo of iron
+               CALL iom_put( "pdust"  , dust(:,:) / ( wdust * 30.42 * 0.035 )  * tmask(:,:,1) ) ! dust concentration at surface
+            ELSE
+               trc2d(:,:,jp_pcs0_2d + 11) = zirondep(:,:,1) * zfact * fse3t(:,:,1) * tmask(:,:,1)
+            ENDIF
+         ENDIF
+         CALL wrk_dealloc( jpi, jpj,      zpdep, zsidep )
+         CALL wrk_dealloc( jpi, jpj, jpk, zirondep      )
+         !                                              
+      ENDIF
+     
+      ! Add the external input of nutrients from river
+      ! ----------------------------------------------------------
+      IF( ln_river ) THEN
+         trn(:,:,1,jppo4) = trn(:,:,1,jppo4) + rivdip(:,:) * rfact2
+         trn(:,:,1,jpno3) = trn(:,:,1,jpno3) + rivdin(:,:) * rfact2
+         trn(:,:,1,jpfer) = trn(:,:,1,jpfer) + rivdic(:,:) * 5.e-5 * rfact2
+         trn(:,:,1,jpsil) = trn(:,:,1,jpsil) + rivdsi(:,:) * rfact2
+         trn(:,:,1,jpdic) = trn(:,:,1,jpdic) + rivdic(:,:) * rfact2
+         trn(:,:,1,jptal) = trn(:,:,1,jptal) + ( rivalk(:,:) - rno3 * rivdin(:,:) ) * rfact2
+      ENDIF
+      
+      ! Add the external input of nutrients from nitrogen deposition
+      ! ----------------------------------------------------------
+      IF( ln_ndepo ) THEN
+         trn(:,:,1,jpno3) = trn(:,:,1,jpno3) + nitdep(:,:) * rfact2
+         trn(:,:,1,jptal) = trn(:,:,1,jptal) - rno3 * nitdep(:,:) * rfact2
+      ENDIF
+
+      ! Add the external input of iron from sediment mobilization
+      ! ------------------------------------------------------
+      IF( ln_ironsed ) THEN
+         trn(:,:,:,jpfer) = trn(:,:,:,jpfer) + ironsed(:,:,:) * rfact2
+         !
+         IF( ln_diatrc .AND. lk_iomput .AND. jnt == nrdttrc )   &
+            &   CALL iom_put( "Ironsed", ironsed(:,:,:) * 1.e+3 * tmask(:,:,:) ) ! iron inputs from sediments
+      ENDIF
+
+      ! Add the external input of iron from hydrothermal vents
+      ! ------------------------------------------------------
+      IF( ln_hydrofe ) THEN
+         trn(:,:,:,jpfer) = trn(:,:,:,jpfer) + hydrofe(:,:,:) * rfact2
+         !
+         IF( ln_diatrc .AND. lk_iomput .AND. jnt == nrdttrc )   &
+            &   CALL iom_put( "HYDR", hydrofe(:,:,:) * 1.e+3 * tmask(:,:,:) ) ! hydrothermal iron input
+      ENDIF
+
+#if ! defined key_sed
+      ! Computation of the sediment denitrification proportion: The metamodel from midlleburg (2006) is being used
+      ! -------------------------------------------------------
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+           IF( tmask(ji,jj,1) == 1 ) THEN
+              ikt = mbkt(ji,jj)
+# if defined key_kriest
+              zflx =    trn(ji,jj,ikt,jppoc) * wsbio3(ji,jj,ikt)    * 1E3 * 1E6 / 1E4
+# else
+              zflx = (  trn(ji,jj,ikt,jpgoc) * wsbio4(ji,jj,ikt)   &
+                &     + trn(ji,jj,ikt,jppoc) * wsbio3(ji,jj,ikt) )  * 1E3 * 1E6 / 1E4
+#endif
+              zflx  = LOG10( MAX( 1E-3, zflx ) )
+              zo2   = LOG10( MAX( 10. , trn(ji,jj,ikt,jpoxy) * 1E6 ) )
+              zno3  = LOG10( MAX( 1.  , trn(ji,jj,ikt,jpno3) * 1E6 * rno3 ) )
+              zdep  = LOG10( fsdepw(ji,jj,ikt+1) )
+              zdenit2d(ji,jj) = -2.2567 - 1.185 * zflx - 0.221 * zflx**2 - 0.3995 * zno3 * zo2 + 1.25 * zno3    &
+              &                + 0.4721 * zo2 - 0.0996 * zdep + 0.4256 * zflx * zo2
+              zdenit2d(ji,jj) = 10.0**( zdenit2d(ji,jj) )
+           ENDIF
+         END DO
+      END DO 
+      ! Loss of biogenic silicon, Caco3 organic carbon in the sediments. 
+      ! First, the total loss is computed.
+      ! The factor for calcite comes from the alkalinity effect
+      ! -------------------------------------------------------------
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            ikt = mbkt(ji,jj) 
+# if defined key_kriest
+            zwork1(ji,jj) = trn(ji,jj,ikt,jpgsi) * wscal (ji,jj,ikt)
+            zwork2(ji,jj) = trn(ji,jj,ikt,jppoc) * wsbio3(ji,jj,ikt)
+# else
+            zwork1(ji,jj) = trn(ji,jj,ikt,jpgsi) * wsbio4(ji,jj,ikt)
+            zwork2(ji,jj) = trn(ji,jj,ikt,jpgoc) * wsbio4(ji,jj,ikt) + trn(ji,jj,ikt,jppoc) * wsbio3(ji,jj,ikt) 
+# endif
+            ! For calcite, burial efficiency is made a function of saturation
+            zfactcal      = MIN( excess(ji,jj,ikt), 0.2 )
+            zfactcal      = MIN( 1., 1.3 * ( 0.2 - zfactcal ) / ( 0.4 - zfactcal ) )
+            zwork3(ji,jj) = trn(ji,jj,ikt,jpcal) * wscal (ji,jj,ikt) * 2.e0 * zfactcal
+         END DO
+      END DO
+      zsumsedsi  = glob_sum( zwork1(:,:) * e1e2t(:,:) ) * r1_rday
+      zsumsedpo4 = glob_sum( zwork2(:,:) * e1e2t(:,:) ) * r1_rday
+      zsumsedcal = glob_sum( zwork3(:,:) * e1e2t(:,:) ) * r1_rday
+#endif
+
+      ! THEN this loss is scaled at each bottom grid cell for
+      ! equilibrating the total budget of silica in the ocean.
+      ! Thus, the amount of silica lost in the sediments equal
+      ! the supply at the surface (dust+rivers)
+      ! ------------------------------------------------------
+#if ! defined key_sed
+      zrivsil =  1._wp - ( sumdepsi + rivdsiinput * r1_ryyss ) / zsumsedsi
+      zrivno3 =  1._wp - ( rivdininput * r1_ryyss ) / zsumsedpo4
+#endif
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            ikt  = mbkt(ji,jj)
+            zdep = xstep / fse3t(ji,jj,ikt)
+            zwsbio4 = wsbio4(ji,jj,ikt) * zdep
+            zwscal  = wscal (ji,jj,ikt) * zdep
+# if defined key_kriest
+            zsiloss = trn(ji,jj,ikt,jpgsi) * zwsbio4
+# else
+            zsiloss = trn(ji,jj,ikt,jpgsi) * zwscal
+# endif
+            zcaloss = trn(ji,jj,ikt,jpcal) * zwscal
+            !
+            trn(ji,jj,ikt,jpgsi) = trn(ji,jj,ikt,jpgsi) - zsiloss
+            trn(ji,jj,ikt,jpcal) = trn(ji,jj,ikt,jpcal) - zcaloss
+#if ! defined key_sed
+            trn(ji,jj,ikt,jpsil) = trn(ji,jj,ikt,jpsil) + zsiloss * zrivsil 
+            zfactcal = MIN( excess(ji,jj,ikt), 0.2 )
+            zfactcal = MIN( 1., 1.3 * ( 0.2 - zfactcal ) / ( 0.4 - zfactcal ) )
+            zrivalk  =  1._wp - ( rivalkinput * r1_ryyss ) * zfactcal / zsumsedcal 
+            trn(ji,jj,ikt,jptal) =  trn(ji,jj,ikt,jptal) + zcaloss * zrivalk * 2.0
+            trn(ji,jj,ikt,jpdic) =  trn(ji,jj,ikt,jpdic) + zcaloss * zrivalk
+#endif
+         END DO
+      END DO
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            ikt     = mbkt(ji,jj)
+            zdep    = xstep / fse3t(ji,jj,ikt)
+            zwsbio4 = wsbio4(ji,jj,ikt) * zdep
+            zwsbio3 = wsbio3(ji,jj,ikt) * zdep
+# if ! defined key_kriest
+            trn(ji,jj,ikt,jpgoc) = trn(ji,jj,ikt,jpgoc) - trn(ji,jj,ikt,jpgoc) * zwsbio4
+            trn(ji,jj,ikt,jppoc) = trn(ji,jj,ikt,jppoc) - trn(ji,jj,ikt,jppoc) * zwsbio3
+            trn(ji,jj,ikt,jpbfe) = trn(ji,jj,ikt,jpbfe) - trn(ji,jj,ikt,jpbfe) * zwsbio4
+            trn(ji,jj,ikt,jpsfe) = trn(ji,jj,ikt,jpsfe) - trn(ji,jj,ikt,jpsfe) * zwsbio3
+            zwstpoc =  trn(ji,jj,ikt,jpgoc) * zwsbio4 + trn(ji,jj,ikt,jppoc) * zwsbio3 
+# else
+            trn(ji,jj,ikt,jpnum) = trn(ji,jj,ikt,jpnum) - trn(ji,jj,ikt,jpnum) * zwsbio4
+            trn(ji,jj,ikt,jppoc) = trn(ji,jj,ikt,jppoc) - trn(ji,jj,ikt,jppoc) * zwsbio3
+            trn(ji,jj,ikt,jpsfe) = trn(ji,jj,ikt,jpsfe) - trn(ji,jj,ikt,jpsfe) * zwsbio3
+            zwstpoc = trn(ji,jj,ikt,jppoc) * zwsbio3 
+# endif
+
+#if ! defined key_sed
+            zpdenit  = MIN( ( trn(ji,jj,ikt,jpno3) - rtrn ) / rdenit, zdenit2d(ji,jj) * zwstpoc * zrivno3 )
+            z1pdenit = zwstpoc * zrivno3 - zpdenit
+            trn(ji,jj,ikt,jpdoc) = trn(ji,jj,ikt,jpdoc) + z1pdenit
+            trn(ji,jj,ikt,jppo4) = trn(ji,jj,ikt,jppo4) + zpdenit
+            trn(ji,jj,ikt,jpnh4) = trn(ji,jj,ikt,jpnh4) + zpdenit
+            trn(ji,jj,ikt,jpno3) = trn(ji,jj,ikt,jpno3) - rdenit * zpdenit
+            trn(ji,jj,ikt,jptal) = trn(ji,jj,ikt,jptal) + rno3 * ( 1. + rdenit ) * zpdenit
+            trn(ji,jj,ikt,jpdic) = trn(ji,jj,ikt,jpdic) + zpdenit
+            zwork4(ji,jj) = rdenit * zpdenit * fse3t(ji,jj,ikt)
+#endif
+         END DO
+      END DO
+
+      ! Nitrogen fixation process
+      !-----------------------------------
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               !                                       ! Potential nitrogen fixation dependant on temperature and iron
+               zlim = ( 1.- xnanono3(ji,jj,jk) - xnanonh4(ji,jj,jk) )
+               IF( zlim <= 0.2 )   zlim = 0.01
+#if defined key_degrad
+               zfact = zlim * rfact2 * facvol(ji,jj,jk)
+#else
+               zfact = zlim * rfact2
+#endif
+               ztrfer = biron(ji,jj,jk)       / ( concfediaz + biron(ji,jj,jk)       )
+               ztrpo4 = trn  (ji,jj,jk,jppo4) / ( concnnh4   + trn  (ji,jj,jk,jppo4) ) 
+               znitrpot(ji,jj,jk) =  MAX( 0.e0, ( 0.6 * tgfunc(ji,jj,jk) - 2.15 ) * r1_rday )   &
+                 &         *  zfact * MIN( ztrfer, ztrpo4 ) * ( 1.- EXP( -etot(ji,jj,jk) / diazolight ) )
+            END DO
+         END DO
+      END DO
+ 
+      IF( ln_check_mass ) THEN
+         ! The total gain from nitrogen fixation is scaled to balance the loss by denitrification
+         ! -------------------------------------------------------------
+         zrdenittot   = glob_sum ( denitr(:,:,:) * rdenit * xnegtr(:,:,:) * cvol(:,:,:) )
+         zsdenittot   = glob_sum ( zwork4(:,:)   * e1e2t(:,:) )
+         znitrpottot  = glob_sum ( znitrpot(:,:,:)                        * cvol(:,:,:) )
+         IF( kt == nitend .AND. jnt == nrdttrc ) THEN
+            zfact = 1.e+3 * rfact2r * rno3 * 365. * 86400. * 14. / 1e12
+            IF(lwp) WRITE(numnit,9100) ndastp, znitrpottot * nitrfix * zfact, zrdenittot * zfact , zsdenittot * zfact
+         ENDIF
+       ENDIF
+
+      ! Nitrogen change due to nitrogen fixation
+      ! ----------------------------------------
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ! zfact = znitrpot(ji,jj,jk) * ( zrdenittot + zsdenittot ) / znitrpottot
+               zfact = znitrpot(ji,jj,jk) * nitrfix
+               trn(ji,jj,jk,jpnh4) = trn(ji,jj,jk,jpnh4) +             zfact
+               trn(ji,jj,jk,jptal) = trn(ji,jj,jk,jptal) + rno3      * zfact
+               trn(ji,jj,jk,jpoxy) = trn(ji,jj,jk,jpoxy) + o2nit     * zfact 
+               trn(ji,jj,jk,jppo4) = trn(ji,jj,jk,jppo4) + 30. / 46. * zfact
+           END DO
+         END DO 
+      END DO
+      !
+      IF( ln_diatrc ) THEN
+         zfact = 1.e+3 * rfact2r
+         IF( lk_iomput .AND. jnt == nrdttrc ) THEN
+            CALL iom_put( "Nfix"  , znitrpot(:,:,:) * nitrfix * rno3 * zfact * tmask(:,:,:) )  ! nitrogen fixation 
+            CALL iom_put( "Sdenit", zwork4(:,:)               * rno3 * zfact * tmask(:,:,1) )  ! Nitrate reduction in the sediments
+         ELSE
+            trc2d(:,:,jp_pcs0_2d + 12) = znitrpot(:,:,1) * nitrfix * zfact * fse3t(:,:,1) * tmask(:,:,1)
+         ENDIF
+      ENDIF
+      !
+      IF(ln_ctl) THEN  ! print mean trends (USEd for debugging)
+         WRITE(charout, fmt="('sed ')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=trn, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      CALL wrk_dealloc( jpi, jpj, zdenit2d, zwork1, zwork2, zwork3, zwork4 )
+      CALL wrk_dealloc( jpi, jpj, jpk, znitrpot )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_sed')
+      !
+ 9100  FORMAT(i8,3f10.5)
+      !
+   END SUBROUTINE p4z_sed
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_sed                         ! Empty routine
+   END SUBROUTINE p4z_sed
+#endif 
+
+   !!======================================================================
+END MODULE  p4zsed
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsink.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsink.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsink.F90	(revision 3680)
@@ -0,0 +1,817 @@
+MODULE p4zsink
+   !!======================================================================
+   !!                         ***  MODULE p4zsink  ***
+   !! TOP :  PISCES  vertical flux of particulate matter due to gravitational sinking
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Change aggregation formula
+   !!             3.5  !  2012-07  (O. Aumont) Introduce potential time-splitting
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   p4z_sink       :  Compute vertical flux of particulate matter due to gravitational sinking
+   !!   p4z_sink_init  :  Unitialisation of sinking speed parameters
+   !!   p4z_sink_alloc :  Allocate sinking speed variables
+   !!----------------------------------------------------------------------
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE prtctl_trc      !  print control for debugging
+   USE iom             !  I/O manager
+   USE lib_mpp
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_sink         ! called in p4zbio.F90
+   PUBLIC   p4z_sink_init    ! called in trcsms_pisces.F90
+   PUBLIC   p4z_sink_alloc
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   wsbio3   !: POC sinking speed 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   wsbio4   !: GOC sinking speed
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   wscal    !: Calcite and BSi sinking speeds
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sinking, sinking2  !: POC sinking fluxes 
+   !                                                          !  (different meanings depending on the parameterization)
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sinkcal, sinksil   !: CaCO3 and BSi sinking fluxes
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sinkfer            !: Small BFe sinking fluxes
+#if ! defined key_kriest
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sinkfer2           !: Big iron sinking fluxes
+#endif
+
+   INTEGER  :: iksed  = 10
+
+#if  defined key_kriest
+   REAL(wp) ::  xkr_sfact    = 250.     !: Sinking factor
+   REAL(wp) ::  xkr_stick    = 0.2      !: Stickiness
+   REAL(wp) ::  xkr_nnano    = 2.337    !: Nbr of cell in nano size class
+   REAL(wp) ::  xkr_ndiat    = 3.718    !: Nbr of cell in diatoms size class
+   REAL(wp) ::  xkr_nmicro   = 3.718    !: Nbr of cell in microzoo size class
+   REAL(wp) ::  xkr_nmeso    = 7.147    !: Nbr of cell in mesozoo  size class
+   REAL(wp) ::  xkr_naggr    = 9.877    !: Nbr of cell in aggregates  size class
+
+   REAL(wp) ::  xkr_frac 
+
+   REAL(wp), PUBLIC ::  xkr_dnano       !: Size of particles in nano pool
+   REAL(wp), PUBLIC ::  xkr_ddiat       !: Size of particles in diatoms pool
+   REAL(wp), PUBLIC ::  xkr_dmicro      !: Size of particles in microzoo pool
+   REAL(wp), PUBLIC ::  xkr_dmeso       !: Size of particles in mesozoo pool
+   REAL(wp), PUBLIC ::  xkr_daggr       !: Size of particles in aggregates pool
+   REAL(wp), PUBLIC ::  xkr_wsbio_min   !: min vertical particle speed
+   REAL(wp), PUBLIC ::  xkr_wsbio_max   !: max vertical particle speed
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   xnumm   !:  maximum number of particles in aggregates
+#endif
+
+   !!* Substitution
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zsink.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+#if ! defined key_kriest
+   !!----------------------------------------------------------------------
+   !!   'standard sinking parameterisation'                  ???
+   !!----------------------------------------------------------------------
+
+   SUBROUTINE p4z_sink ( kt, jnt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_sink  ***
+      !!
+      !! ** Purpose :   Compute vertical flux of particulate matter due to 
+      !!                gravitational sinking
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in) :: kt, jnt
+      INTEGER  ::   ji, jj, jk, jit
+      INTEGER  ::   iiter1, iiter2
+      REAL(wp) ::   zagg1, zagg2, zagg3, zagg4
+      REAL(wp) ::   zagg , zaggfe, zaggdoc, zaggdoc2, zaggdoc3
+      REAL(wp) ::   zfact, zwsmax, zmax, zstep
+      REAL(wp) ::   zrfact2
+      INTEGER  ::   ik1
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_sink')
+      !
+      !    Sinking speeds of detritus is increased with depth as shown
+      !    by data and from the coagulation theory
+      !    -----------------------------------------------------------
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1,jpi
+               zmax  = MAX( heup(ji,jj), hmld(ji,jj) )
+               zfact = MAX( 0., fsdepw(ji,jj,jk+1) - zmax ) / 5000._wp
+               wsbio4(ji,jj,jk) = wsbio2 + ( 200.- wsbio2 ) * zfact
+            END DO
+         END DO
+      END DO
+
+      ! limit the values of the sinking speeds to avoid numerical instabilities  
+      wsbio3(:,:,:) = wsbio
+      wscal (:,:,:) = wsbio4(:,:,:)
+      !
+      ! OA This is (I hope) a temporary solution for the problem that may 
+      ! OA arise in specific situation where the CFL criterion is broken 
+      ! OA for vertical sedimentation of particles. To avoid this, a time
+      ! OA splitting algorithm has been coded. A specific maximum
+      ! OA iteration number is provided and may be specified in the namelist 
+      ! OA This is to avoid very large iteration number when explicit free
+      ! OA surface is used (for instance). When niter?max is set to 1, 
+      ! OA this computation is skipped. The crude old threshold method is 
+      ! OA then applied. This also happens when niter exceeds nitermax.
+      IF( MAX( niter1max, niter2max ) == 1 ) THEN
+        iiter1 = 1
+        iiter2 = 1
+      ELSE
+        iiter1 = 1
+        iiter2 = 1
+        DO jk = 1, jpkm1
+          DO jj = 1, jpj
+             DO ji = 1, jpi
+                IF( tmask(ji,jj,jk) == 1) THEN
+                   zwsmax =  0.8 * fse3t(ji,jj,jk) / xstep
+                   iiter1 =  MAX( iiter1, INT( wsbio3(ji,jj,jk) / zwsmax ) )
+                   iiter2 =  MAX( iiter2, INT( wsbio4(ji,jj,jk) / zwsmax ) )
+                ENDIF
+             END DO
+          END DO
+        END DO
+        IF( lk_mpp ) THEN
+           CALL mpp_max( iiter1 )
+           CALL mpp_max( iiter2 )
+        ENDIF
+        iiter1 = MIN( iiter1, niter1max )
+        iiter2 = MIN( iiter2, niter2max )
+      ENDIF
+
+      DO jk = 1,jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( tmask(ji,jj,jk) == 1 ) THEN
+                 zwsmax = 0.8 * fse3t(ji,jj,jk) / xstep
+                 wsbio3(ji,jj,jk) = MIN( wsbio3(ji,jj,jk), zwsmax * FLOAT( iiter1 ) )
+                 wsbio4(ji,jj,jk) = MIN( wsbio4(ji,jj,jk), zwsmax * FLOAT( iiter2 ) )
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      !  Initializa to zero all the sinking arrays 
+      !   -----------------------------------------
+      sinking (:,:,:) = 0.e0
+      sinking2(:,:,:) = 0.e0
+      sinkcal (:,:,:) = 0.e0
+      sinkfer (:,:,:) = 0.e0
+      sinksil (:,:,:) = 0.e0
+      sinkfer2(:,:,:) = 0.e0
+
+      !   Compute the sedimentation term using p4zsink2 for all the sinking particles
+      !   -----------------------------------------------------
+      DO jit = 1, iiter1
+        CALL p4z_sink2( wsbio3, sinking , jppoc, iiter1 )
+        CALL p4z_sink2( wsbio3, sinkfer , jpsfe, iiter1 )
+      END DO
+
+      DO jit = 1, iiter2
+        CALL p4z_sink2( wsbio4, sinking2, jpgoc, iiter2 )
+        CALL p4z_sink2( wsbio4, sinkfer2, jpbfe, iiter2 )
+        CALL p4z_sink2( wsbio4, sinksil , jpgsi, iiter2 )
+        CALL p4z_sink2( wscal , sinkcal , jpcal, iiter2 )
+      END DO
+
+      !  Exchange between organic matter compartments due to coagulation/disaggregation
+      !  ---------------------------------------------------
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               !
+               zstep = xstep 
+# if defined key_degrad
+               zstep = zstep * facvol(ji,jj,jk)
+# endif
+               zfact = zstep * xdiss(ji,jj,jk)
+               !  Part I : Coagulation dependent on turbulence
+               zagg1 = 25.9  * zfact * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jppoc)
+               zagg2 = 4452. * zfact * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpgoc)
+
+               ! Part II : Differential settling
+
+               !  Aggregation of small into large particles
+               zagg3 =  47.1 * zstep * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpgoc)
+               zagg4 =  3.3  * zstep * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jppoc)
+
+               zagg   = zagg1 + zagg2 + zagg3 + zagg4
+               zaggfe = zagg * trn(ji,jj,jk,jpsfe) / ( trn(ji,jj,jk,jppoc) + rtrn )
+
+               ! Aggregation of DOC to POC : 
+               ! 1st term is shear aggregation of DOC-DOC
+               ! 2nd term is shear aggregation of DOC-POC
+               ! 3rd term is differential settling of DOC-POC
+               zaggdoc  = ( ( 0.369 * 0.3 * trn(ji,jj,jk,jpdoc) + 102.4 * trn(ji,jj,jk,jppoc) ) * zfact       &
+               &            + 2.4 * zstep * trn(ji,jj,jk,jppoc) ) * 0.3 * trn(ji,jj,jk,jpdoc)
+!               zaggdoc  = ( 0.83 * trn(ji,jj,jk,jpdoc) + 271. * trn(ji,jj,jk,jppoc) ) * zfact * trn(ji,jj,jk,jpdoc)
+               ! transfer of DOC to GOC : 
+               ! 1st term is shear aggregation
+               ! 2nd term is differential settling 
+               zaggdoc2 = ( 3.53E3 * zfact + 0.1 * zstep ) * trn(ji,jj,jk,jpgoc) * 0.3 * trn(ji,jj,jk,jpdoc)
+!               zaggdoc2 = 1.07e4 * zfact * trn(ji,jj,jk,jpgoc) * trn(ji,jj,jk,jpdoc)
+               ! tranfer of DOC to POC due to brownian motion
+!               zaggdoc3 =   0.02 * ( 16706. * trn(ji,jj,jk,jppoc) + 231. * trn(ji,jj,jk,jpdoc) ) * zstep * trn(ji,jj,jk,jpdoc)
+               zaggdoc3 =  ( 5095. * trn(ji,jj,jk,jppoc) + 114. * 0.3 * trn(ji,jj,jk,jpdoc) ) *zstep * 0.3 * trn(ji,jj,jk,jpdoc)
+
+               !  Update the trends
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) - zagg + zaggdoc + zaggdoc3
+               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zagg + zaggdoc2
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) - zaggfe
+               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zaggfe
+               tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) - zaggdoc - zaggdoc2 - zaggdoc3
+               !
+            END DO
+         END DO
+      END DO
+
+     ! Total primary production per year
+     t_oce_co2_exp = t_oce_co2_exp + glob_sum( ( sinking(:,:,iksed+1) + sinking2(:,:,iksed+1) ) * e1e2t(:,:) * tmask(:,:,1) )
+     !
+     IF( ln_diatrc ) THEN
+         zrfact2 = 1.e3 * rfact2r
+         ik1  = iksed + 1
+         IF( lk_iomput ) THEN
+           IF( jnt == nrdttrc ) THEN
+              CALL iom_put( "EPC100"  , ( sinking(:,:,ik1) + sinking2(:,:,ik1) ) * zrfact2 * tmask(:,:,1) ) ! Export of carbon at 100m
+              CALL iom_put( "EPFE100" , ( sinkfer(:,:,ik1) + sinkfer2(:,:,ik1) ) * zrfact2 * tmask(:,:,1) ) ! Export of iron at 100m
+              CALL iom_put( "EPCAL100",   sinkcal(:,:,ik1)                       * zrfact2 * tmask(:,:,1) ) ! Export of calcite  at 100m
+              CALL iom_put( "EPSI100" ,   sinksil(:,:,ik1)                       * zrfact2 * tmask(:,:,1) ) ! Export of biogenic silica at 100m
+           ENDIF
+         ELSE
+           trc2d(:,:,jp_pcs0_2d + 4) = sinking (:,:,ik1) * zrfact2 * tmask(:,:,1)
+           trc2d(:,:,jp_pcs0_2d + 5) = sinking2(:,:,ik1) * zrfact2 * tmask(:,:,1)
+           trc2d(:,:,jp_pcs0_2d + 6) = sinkfer (:,:,ik1) * zrfact2 * tmask(:,:,1)
+           trc2d(:,:,jp_pcs0_2d + 7) = sinkfer2(:,:,ik1) * zrfact2 * tmask(:,:,1)
+           trc2d(:,:,jp_pcs0_2d + 8) = sinksil (:,:,ik1) * zrfact2 * tmask(:,:,1)
+           trc2d(:,:,jp_pcs0_2d + 9) = sinkcal (:,:,ik1) * zrfact2 * tmask(:,:,1)
+         ENDIF
+      ENDIF
+      !
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('sink')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_sink')
+      !
+   END SUBROUTINE p4z_sink
+
+   SUBROUTINE p4z_sink_init
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_sink_init  ***
+      !!----------------------------------------------------------------------
+
+      t_oce_co2_exp = 0._wp
+      !
+   END SUBROUTINE p4z_sink_init
+
+#else
+   !!----------------------------------------------------------------------
+   !!   'Kriest sinking parameterisation'        key_kriest          ???
+   !!----------------------------------------------------------------------
+
+   SUBROUTINE p4z_sink ( kt, jnt )
+      !!---------------------------------------------------------------------
+      !!                ***  ROUTINE p4z_sink  ***
+      !!
+      !! ** Purpose :   Compute vertical flux of particulate matter due to
+      !!              gravitational sinking - Kriest parameterization
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      !
+      INTEGER, INTENT(in) :: kt, jnt
+      !
+      INTEGER  :: ji, jj, jk, jit, niter1, niter2
+      REAL(wp) :: zagg1, zagg2, zagg3, zagg4, zagg5, zfract, zaggsi, zaggsh
+      REAL(wp) :: zagg , zaggdoc, zaggdoc1, znumdoc
+      REAL(wp) :: znum , zeps, zfm, zgm, zsm
+      REAL(wp) :: zdiv , zdiv1, zdiv2, zdiv3, zdiv4, zdiv5
+      REAL(wp) :: zval1, zval2, zval3, zval4
+      REAL(wp) :: zrfact2
+      INTEGER  :: ik1
+      CHARACTER (len=25) :: charout
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: znum3d 
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_sink')
+      !
+      CALL wrk_alloc( jpi, jpj, jpk, znum3d )
+      !
+      !     Initialisation of variables used to compute Sinking Speed
+      !     ---------------------------------------------------------
+
+      znum3d(:,:,:) = 0.e0
+      zval1 = 1. + xkr_zeta
+      zval2 = 1. + xkr_zeta + xkr_eta
+      zval3 = 1. + xkr_eta
+
+      !     Computation of the vertical sinking speed : Kriest et Evans, 2000
+      !     -----------------------------------------------------------------
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( tmask(ji,jj,jk) /= 0.e0 ) THEN
+                  znum = trn(ji,jj,jk,jppoc) / ( trn(ji,jj,jk,jpnum) + rtrn ) / xkr_massp
+                  ! -------------- To avoid sinking speed over 50 m/day -------
+                  znum  = MIN( xnumm(jk), znum )
+                  znum  = MAX( 1.1      , znum )
+                  znum3d(ji,jj,jk) = znum
+                  !------------------------------------------------------------
+                  zeps  = ( zval1 * znum - 1. )/ ( znum - 1. )
+                  zfm   = xkr_frac**( 1. - zeps )
+                  zgm   = xkr_frac**( zval1 - zeps )
+                  zdiv  = MAX( 1.e-4, ABS( zeps - zval2 ) ) * SIGN( 1., ( zeps - zval2 ) )
+                  zdiv1 = zeps - zval3
+                  wsbio3(ji,jj,jk) = xkr_wsbio_min * ( zeps - zval1 ) / zdiv    &
+                     &             - xkr_wsbio_max *   zgm * xkr_eta  / zdiv
+                  wsbio4(ji,jj,jk) = xkr_wsbio_min *   ( zeps-1. )    / zdiv1   &
+                     &             - xkr_wsbio_max *   zfm * xkr_eta  / zdiv1
+                  IF( znum == 1.1)   wsbio3(ji,jj,jk) = wsbio4(ji,jj,jk)
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      wscal(:,:,:) = MAX( wsbio3(:,:,:), 30._wp )
+
+      !   INITIALIZE TO ZERO ALL THE SINKING ARRAYS
+      !   -----------------------------------------
+
+      sinking (:,:,:) = 0.e0
+      sinking2(:,:,:) = 0.e0
+      sinkcal (:,:,:) = 0.e0
+      sinkfer (:,:,:) = 0.e0
+      sinksil (:,:,:) = 0.e0
+
+     !   Compute the sedimentation term using p4zsink2 for all the sinking particles
+     !   -----------------------------------------------------
+
+      niter1 = niter1max
+      niter2 = niter2max
+
+      DO jit = 1, niter1
+        CALL p4z_sink2( wsbio3, sinking , jppoc, niter1 )
+        CALL p4z_sink2( wsbio3, sinkfer , jpsfe, niter1 )
+        CALL p4z_sink2( wscal , sinksil , jpgsi, niter1 )
+        CALL p4z_sink2( wscal , sinkcal , jpcal, niter1 )
+      END DO
+
+      DO jit = 1, niter2
+        CALL p4z_sink2( wsbio4, sinking2, jpnum, niter2 )
+      END DO
+
+     !  Exchange between organic matter compartments due to coagulation/disaggregation
+     !  ---------------------------------------------------
+
+      zval1 = 1. + xkr_zeta
+      zval2 = 1. + xkr_eta
+      zval3 = 3. + xkr_eta
+      zval4 = 4. + xkr_eta
+
+      DO jk = 1,jpkm1
+         DO jj = 1,jpj
+            DO ji = 1,jpi
+               IF( tmask(ji,jj,jk) /= 0.e0 ) THEN
+
+                  znum = trn(ji,jj,jk,jppoc)/(trn(ji,jj,jk,jpnum)+rtrn) / xkr_massp
+                  !-------------- To avoid sinking speed over 50 m/day -------
+                  znum  = min(xnumm(jk),znum)
+                  znum  = MAX( 1.1,znum)
+                  !------------------------------------------------------------
+                  zeps  = ( zval1 * znum - 1.) / ( znum - 1.)
+                  zdiv  = MAX( 1.e-4, ABS( zeps - zval3) ) * SIGN( 1., zeps - zval3 )
+                  zdiv1 = MAX( 1.e-4, ABS( zeps - 4.   ) ) * SIGN( 1., zeps - 4.    )
+                  zdiv2 = zeps - 2.
+                  zdiv3 = zeps - 3.
+                  zdiv4 = zeps - zval2
+                  zdiv5 = 2.* zeps - zval4
+                  zfm   = xkr_frac**( 1.- zeps )
+                  zsm   = xkr_frac**xkr_eta
+
+                  !    Part I : Coagulation dependant on turbulence
+                  !    ----------------------------------------------
+
+                  zagg1 =  0.163 * trn(ji,jj,jk,jpnum)**2               &
+                     &            * 2.*( (zfm-1.)*(zfm*xkr_mass_max**3-xkr_mass_min**3)    &
+                     &            * (zeps-1)/zdiv1 + 3.*(zfm*xkr_mass_max-xkr_mass_min)    &
+                     &            * (zfm*xkr_mass_max**2-xkr_mass_min**2)                  &
+                     &            * (zeps-1.)**2/(zdiv2*zdiv3)) 
+                  zagg2 =  2*0.163*trn(ji,jj,jk,jpnum)**2*zfm*                       &
+                     &                   ((xkr_mass_max**3+3.*(xkr_mass_max**2          &
+                     &                    *xkr_mass_min*(zeps-1.)/zdiv2                 &
+                     &                    +xkr_mass_max*xkr_mass_min**2*(zeps-1.)/zdiv3)    &
+                     &                    +xkr_mass_min**3*(zeps-1)/zdiv1)                  &
+                     &                    -zfm*xkr_mass_max**3*(1.+3.*((zeps-1.)/           &
+                     &                    (zeps-2.)+(zeps-1.)/zdiv3)+(zeps-1.)/zdiv1))    
+
+                  zagg3 =  0.163*trn(ji,jj,jk,jpnum)**2*zfm**2*8. * xkr_mass_max**3  
+                  
+                 !    Aggregation of small into large particles
+                 !    Part II : Differential settling
+                 !    ----------------------------------------------
+
+                  zagg4 =  2.*3.141*0.125*trn(ji,jj,jk,jpnum)**2*                       &
+                     &                 xkr_wsbio_min*(zeps-1.)**2                         &
+                     &                 *(xkr_mass_min**2*((1.-zsm*zfm)/(zdiv3*zdiv4)      &
+                     &                 -(1.-zfm)/(zdiv*(zeps-1.)))-                       &
+                     &                 ((zfm*zfm*xkr_mass_max**2*zsm-xkr_mass_min**2)     &
+                     &                 *xkr_eta)/(zdiv*zdiv3*zdiv5) )   
+
+                  zagg5 =   2.*3.141*0.125*trn(ji,jj,jk,jpnum)**2                         &
+                     &                 *(zeps-1.)*zfm*xkr_wsbio_min                        &
+                     &                 *(zsm*(xkr_mass_min**2-zfm*xkr_mass_max**2)         &
+                     &                 /zdiv3-(xkr_mass_min**2-zfm*zsm*xkr_mass_max**2)    &
+                     &                 /zdiv)  
+
+                  !
+                  !     Fractionnation by swimming organisms
+                  !     ------------------------------------
+
+                  zfract = 2.*3.141*0.125*trn(ji,jj,jk,jpmes)*12./0.12/0.06**3*trn(ji,jj,jk,jpnum)  &
+                    &      * (0.01/xkr_mass_min)**(1.-zeps)*0.1**2  &
+                    &      * 10000.*xstep
+
+                  !     Aggregation of DOC to small particles
+                  !     --------------------------------------
+
+                  zaggdoc = 0.83 * trn(ji,jj,jk,jpdoc) * xstep * xdiss(ji,jj,jk) * trn(ji,jj,jk,jpdoc)   &
+                     &        + 0.005 * 231. * trn(ji,jj,jk,jpdoc) * xstep * trn(ji,jj,jk,jpdoc)
+                  zaggdoc1 = 271. * trn(ji,jj,jk,jppoc) * xstep * xdiss(ji,jj,jk) * trn(ji,jj,jk,jpdoc)  &
+                     &  + 0.02 * 16706. * trn(ji,jj,jk,jppoc) * xstep * trn(ji,jj,jk,jpdoc)
+
+# if defined key_degrad
+                   zagg1   = zagg1   * facvol(ji,jj,jk)                 
+                   zagg2   = zagg2   * facvol(ji,jj,jk)                 
+                   zagg3   = zagg3   * facvol(ji,jj,jk)                 
+                   zagg4   = zagg4   * facvol(ji,jj,jk)                 
+                   zagg5   = zagg5   * facvol(ji,jj,jk)                 
+                   zaggdoc = zaggdoc * facvol(ji,jj,jk)                 
+                   zaggdoc1 = zaggdoc1 * facvol(ji,jj,jk)
+# endif
+                  zaggsh = ( zagg1 + zagg2 + zagg3 ) * rfact2 * xdiss(ji,jj,jk) / 1000.
+                  zaggsi = ( zagg4 + zagg5 ) * xstep / 10.
+                  zagg = 0.5 * xkr_stick * ( zaggsh + zaggsi )
+                  !
+                  znumdoc = trn(ji,jj,jk,jpnum) / ( trn(ji,jj,jk,jppoc) + rtrn )
+                  tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zaggdoc + zaggdoc1
+                  tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + zfract + zaggdoc / xkr_massp - zagg
+                  tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) - zaggdoc - zaggdoc1
+
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+     ! Total primary production per year
+     t_oce_co2_exp = t_oce_co2_exp + glob_sum( ( sinking(:,:,:) ) * cvol(:,:,:) )
+     !
+      IF( ln_diatrc ) THEN
+         !
+         ik1 = iksed + 1
+         zrfact2 = 1.e3 * rfact2r
+         IF( jnt == nrdttrc ) THEN
+           CALL iom_put( "POCFlx"  , sinking (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! POC export
+           CALL iom_put( "NumFlx"  , sinking2 (:,:,:)     * zrfact2 * tmask(:,:,:) )  ! Num export
+           CALL iom_put( "SiFlx"   , sinksil (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! Silica export
+           CALL iom_put( "CaCO3Flx", sinkcal (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! Calcite export
+           CALL iom_put( "xnum"    , znum3d  (:,:,:)                * tmask(:,:,:) )  ! Number of particles in aggregats
+           CALL iom_put( "W1"      , wsbio3  (:,:,:)                * tmask(:,:,:) )  ! sinking speed of POC
+           CALL iom_put( "W2"      , wsbio4  (:,:,:)                * tmask(:,:,:) )  ! sinking speed of aggregats
+           CALL iom_put( "PMO"     , sinking (:,:,ik1)    * zrfact2 * tmask(:,:,1) )  ! POC export at 100m
+           CALL iom_put( "PMO2"    , sinking2(:,:,ik1)    * zrfact2 * tmask(:,:,1) )  ! Num export at 100m
+           CALL iom_put( "ExpFe1"  , sinkfer (:,:,ik1)    * zrfact2 * tmask(:,:,1) )  ! Export of iron at 100m
+           CALL iom_put( "ExpSi"   , sinksil (:,:,ik1)    * zrfact2 * tmask(:,:,1) )  ! export of silica at 100m
+           CALL iom_put( "ExpCaCO3", sinkcal (:,:,ik1)    * zrfact2 * tmask(:,:,1) )  ! export of calcite at 100m
+         ENDIF
+# if ! defined key_iomput
+         trc2d(:,:  ,jp_pcs0_2d + 4)  = sinking (:,:,ik1)    * zrfact2 * tmask(:,:,1)
+         trc2d(:,:  ,jp_pcs0_2d + 5)  = sinking2(:,:,ik1)    * zrfact2 * tmask(:,:,1)
+         trc2d(:,:  ,jp_pcs0_2d + 6)  = sinkfer (:,:,ik1)    * zrfact2 * tmask(:,:,1)
+         trc2d(:,:  ,jp_pcs0_2d + 7)  = sinksil (:,:,ik1)    * zrfact2 * tmask(:,:,1)
+         trc2d(:,:  ,jp_pcs0_2d + 8)  = sinkcal (:,:,ik1)    * zrfact2 * tmask(:,:,1)
+         trc3d(:,:,:,jp_pcs0_3d + 11) = sinking (:,:,:)      * zrfact2 * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 12) = sinking2(:,:,:)      * zrfact2 * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 13) = sinksil (:,:,:)      * zrfact2 * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 14) = sinkcal (:,:,:)      * zrfact2 * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 15) = znum3d  (:,:,:)                * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 16) = wsbio3  (:,:,:)                * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 17) = wsbio4  (:,:,:)                * tmask(:,:,:)
+# endif
+        !
+      ENDIF
+      !
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('sink')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      CALL wrk_dealloc( jpi, jpj, jpk, znum3d )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_sink')
+      !
+   END SUBROUTINE p4z_sink
+
+
+   SUBROUTINE p4z_sink_init
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_sink_init  ***
+      !!
+      !! ** Purpose :   Initialization of sinking parameters
+      !!                Kriest parameterization only
+      !!
+      !! ** Method  :   Read the nampiskrs namelist and check the parameters
+      !!      called at the first timestep 
+      !!
+      !! ** input   :   Namelist nampiskrs
+      !!----------------------------------------------------------------------
+      INTEGER  ::   jk, jn, kiter
+      REAL(wp) ::   znum, zdiv
+      REAL(wp) ::   zws, zwr, zwl,wmax, znummax
+      REAL(wp) ::   zmin, zmax, zl, zr, xacc
+      !
+      NAMELIST/nampiskrs/ xkr_sfact, xkr_stick ,  &
+         &                xkr_nnano, xkr_ndiat, xkr_nmicro, xkr_nmeso, xkr_naggr
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_sink_init')
+      !
+      REWIND( numnatp )                     ! read nampiskrs
+      READ  ( numnatp, nampiskrs )
+
+      IF(lwp) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) ' Namelist : nampiskrs'
+         WRITE(numout,*) '    Sinking factor                           xkr_sfact    = ', xkr_sfact
+         WRITE(numout,*) '    Stickiness                               xkr_stick    = ', xkr_stick
+         WRITE(numout,*) '    Nbr of cell in nano size class           xkr_nnano    = ', xkr_nnano
+         WRITE(numout,*) '    Nbr of cell in diatoms size class        xkr_ndiat    = ', xkr_ndiat
+         WRITE(numout,*) '    Nbr of cell in microzoo size class       xkr_nmicro   = ', xkr_nmicro
+         WRITE(numout,*) '    Nbr of cell in mesozoo size class        xkr_nmeso    = ', xkr_nmeso
+         WRITE(numout,*) '    Nbr of cell in aggregates size class     xkr_naggr    = ', xkr_naggr
+      ENDIF
+
+
+      ! max and min vertical particle speed
+      xkr_wsbio_min = xkr_sfact * xkr_mass_min**xkr_eta
+      xkr_wsbio_max = xkr_sfact * xkr_mass_max**xkr_eta
+      IF (lwp) WRITE(numout,*) ' max and min vertical particle speed ', xkr_wsbio_min, xkr_wsbio_max
+
+      !
+      !    effect of the sizes of the different living pools on particle numbers
+      !    nano = 2um-20um -> mean size=6.32 um -> ws=2.596 -> xnum=xnnano=2.337
+      !    diat and microzoo = 10um-200um -> 44.7 -> 8.732 -> xnum=xndiat=3.718
+      !    mesozoo = 200um-2mm -> 632.45 -> 45.14 -> xnum=xnmeso=7.147
+      !    aggregates = 200um-10mm -> 1414 -> 74.34 -> xnum=xnaggr=9.877
+      !    doc aggregates = 1um
+      ! ----------------------------------------------------------
+
+      xkr_dnano = 1. / ( xkr_massp * xkr_nnano )
+      xkr_ddiat = 1. / ( xkr_massp * xkr_ndiat )
+      xkr_dmicro = 1. / ( xkr_massp * xkr_nmicro )
+      xkr_dmeso = 1. / ( xkr_massp * xkr_nmeso )
+      xkr_daggr = 1. / ( xkr_massp * xkr_naggr )
+
+      !!---------------------------------------------------------------------
+      !!    'key_kriest'                                                  ???
+      !!---------------------------------------------------------------------
+      !  COMPUTATION OF THE VERTICAL PROFILE OF MAXIMUM SINKING SPEED
+      !  Search of the maximum number of particles in aggregates for each k-level.
+      !  Bissection Method
+      !--------------------------------------------------------------------
+      IF (lwp) THEN
+        WRITE(numout,*)
+        WRITE(numout,*)'    kriest : Compute maximum number of particles in aggregates'
+      ENDIF
+
+      xacc     =  0.001_wp
+      kiter    = 50
+      zmin     =  1.10_wp
+      zmax     = xkr_mass_max / xkr_mass_min
+      xkr_frac = zmax
+
+      DO jk = 1,jpk
+         zl = zmin
+         zr = zmax
+         wmax = 0.5 * fse3t(1,1,jk) * rday * float(niter1max) / rfact2
+         zdiv = xkr_zeta + xkr_eta - xkr_eta * zl
+         znum = zl - 1.
+         zwl =  xkr_wsbio_min * xkr_zeta / zdiv &
+            & - ( xkr_wsbio_max * xkr_eta * znum * &
+            &     xkr_frac**( -xkr_zeta / znum ) / zdiv ) &
+            & - wmax
+
+         zdiv = xkr_zeta + xkr_eta - xkr_eta * zr
+         znum = zr - 1.
+         zwr =  xkr_wsbio_min * xkr_zeta / zdiv &
+            & - ( xkr_wsbio_max * xkr_eta * znum * &
+            &     xkr_frac**( -xkr_zeta / znum ) / zdiv ) &
+            & - wmax
+iflag:   DO jn = 1, kiter
+            IF    ( zwl == 0._wp ) THEN   ;   znummax = zl
+            ELSEIF( zwr == 0._wp ) THEN   ;   znummax = zr
+            ELSE
+               znummax = ( zr + zl ) / 2.
+               zdiv = xkr_zeta + xkr_eta - xkr_eta * znummax
+               znum = znummax - 1.
+               zws =  xkr_wsbio_min * xkr_zeta / zdiv &
+                  & - ( xkr_wsbio_max * xkr_eta * znum * &
+                  &     xkr_frac**( -xkr_zeta / znum ) / zdiv ) &
+                  & - wmax
+               IF( zws * zwl < 0. ) THEN   ;   zr = znummax
+               ELSE                        ;   zl = znummax
+               ENDIF
+               zdiv = xkr_zeta + xkr_eta - xkr_eta * zl
+               znum = zl - 1.
+               zwl =  xkr_wsbio_min * xkr_zeta / zdiv &
+                  & - ( xkr_wsbio_max * xkr_eta * znum * &
+                  &     xkr_frac**( -xkr_zeta / znum ) / zdiv ) &
+                  & - wmax
+
+               zdiv = xkr_zeta + xkr_eta - xkr_eta * zr
+               znum = zr - 1.
+               zwr =  xkr_wsbio_min * xkr_zeta / zdiv &
+                  & - ( xkr_wsbio_max * xkr_eta * znum * &
+                  &     xkr_frac**( -xkr_zeta / znum ) / zdiv ) &
+                  & - wmax
+               !
+               IF ( ABS ( zws )  <= xacc ) EXIT iflag
+               !
+            ENDIF
+            !
+         END DO iflag
+
+         xnumm(jk) = znummax
+         IF (lwp) WRITE(numout,*) '       jk = ', jk, ' wmax = ', wmax,' xnum max = ', xnumm(jk)
+         !
+      END DO
+      !
+      t_oce_co2_exp = 0._wp
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_sink_init')
+      !
+  END SUBROUTINE p4z_sink_init
+
+#endif
+
+   SUBROUTINE p4z_sink2( pwsink, psinkflx, jp_tra, kiter )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_sink2  ***
+      !!
+      !! ** Purpose :   Compute the sedimentation terms for the various sinking
+      !!     particles. The scheme used to compute the trends is based
+      !!     on MUSCL.
+      !!
+      !! ** Method  : - this ROUTINE compute not exactly the advection but the
+      !!      transport term, i.e.  div(u*tra).
+      !!---------------------------------------------------------------------
+      !
+      INTEGER , INTENT(in   )                         ::   jp_tra    ! tracer index index      
+      INTEGER , INTENT(in   )                         ::   kiter     ! number of iterations for time-splitting 
+      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj,jpk) ::   pwsink    ! sinking speed
+      REAL(wp), INTENT(inout), DIMENSION(jpi,jpj,jpk) ::   psinkflx  ! sinking fluxe
+      !!
+      INTEGER  ::   ji, jj, jk, jn
+      REAL(wp) ::   zigma,zew,zign, zflx, zstep
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: ztraz, zakz, zwsink2, ztrb 
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_sink2')
+      !
+      ! Allocate temporary workspace
+      CALL wrk_alloc( jpi, jpj, jpk, ztraz, zakz, zwsink2, ztrb )
+
+      zstep = rfact2 / FLOAT( kiter ) / 2.
+
+      ztraz(:,:,:) = 0.e0
+      zakz (:,:,:) = 0.e0
+      ztrb (:,:,:) = trn(:,:,:,jp_tra)
+
+      DO jk = 1, jpkm1
+         zwsink2(:,:,jk+1) = -pwsink(:,:,jk) / rday * tmask(:,:,jk+1) 
+      END DO
+      zwsink2(:,:,1) = 0.e0
+      IF( lk_degrad ) THEN
+         zwsink2(:,:,:) = zwsink2(:,:,:) * facvol(:,:,:)
+      ENDIF
+
+
+      ! Vertical advective flux
+      DO jn = 1, 2
+         !  first guess of the slopes interior values
+         DO jk = 2, jpkm1
+            ztraz(:,:,jk) = ( trn(:,:,jk-1,jp_tra) - trn(:,:,jk,jp_tra) ) * tmask(:,:,jk)
+         END DO
+         ztraz(:,:,1  ) = 0.0
+         ztraz(:,:,jpk) = 0.0
+
+         ! slopes
+         DO jk = 2, jpkm1
+            DO jj = 1,jpj
+               DO ji = 1, jpi
+                  zign = 0.25 + SIGN( 0.25, ztraz(ji,jj,jk) * ztraz(ji,jj,jk+1) )
+                  zakz(ji,jj,jk) = ( ztraz(ji,jj,jk) + ztraz(ji,jj,jk+1) ) * zign
+               END DO
+            END DO
+         END DO
+         
+         ! Slopes limitation
+         DO jk = 2, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  zakz(ji,jj,jk) = SIGN( 1., zakz(ji,jj,jk) ) *        &
+                     &             MIN( ABS( zakz(ji,jj,jk) ), 2. * ABS(ztraz(ji,jj,jk+1)), 2. * ABS(ztraz(ji,jj,jk) ) )
+               END DO
+            END DO
+         END DO
+         
+         ! vertical advective flux
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj      
+               DO ji = 1, jpi    
+                  zigma = zwsink2(ji,jj,jk+1) * zstep / fse3w(ji,jj,jk+1)
+                  zew   = zwsink2(ji,jj,jk+1)
+                  psinkflx(ji,jj,jk+1) = -zew * ( trn(ji,jj,jk,jp_tra) - 0.5 * ( 1 + zigma ) * zakz(ji,jj,jk) ) * zstep
+               END DO
+            END DO
+         END DO
+         !
+         ! Boundary conditions
+         psinkflx(:,:,1  ) = 0.e0
+         psinkflx(:,:,jpk) = 0.e0
+         
+         DO jk=1,jpkm1
+            DO jj = 1,jpj
+               DO ji = 1, jpi
+                  zflx = ( psinkflx(ji,jj,jk) - psinkflx(ji,jj,jk+1) ) / fse3t(ji,jj,jk)
+                  trn(ji,jj,jk,jp_tra) = trn(ji,jj,jk,jp_tra) + zflx
+               END DO
+            END DO
+         END DO
+
+      ENDDO
+
+      DO jk = 1,jpkm1
+         DO jj = 1,jpj
+            DO ji = 1, jpi
+               zflx = ( psinkflx(ji,jj,jk) - psinkflx(ji,jj,jk+1) ) / fse3t(ji,jj,jk)
+               ztrb(ji,jj,jk) = ztrb(ji,jj,jk) + 2. * zflx
+            END DO
+         END DO
+      END DO
+
+      trn(:,:,:,jp_tra) = ztrb(:,:,:)
+      psinkflx(:,:,:)   = 2. * psinkflx(:,:,:)
+      !
+      CALL wrk_dealloc( jpi, jpj, jpk, ztraz, zakz, zwsink2, ztrb )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_sink2')
+      !
+   END SUBROUTINE p4z_sink2
+
+
+   INTEGER FUNCTION p4z_sink_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_sink_alloc  ***
+      !!----------------------------------------------------------------------
+      ALLOCATE( wsbio3 (jpi,jpj,jpk) , wsbio4  (jpi,jpj,jpk) , wscal(jpi,jpj,jpk) ,     &
+         &      sinking(jpi,jpj,jpk) , sinking2(jpi,jpj,jpk)                      ,     &                
+         &      sinkcal(jpi,jpj,jpk) , sinksil (jpi,jpj,jpk)                      ,     &                
+#if defined key_kriest
+         &      xnumm(jpk)                                                        ,     &                
+#else
+         &      sinkfer2(jpi,jpj,jpk)                                             ,     &                
+#endif
+         &      sinkfer(jpi,jpj,jpk)                                              , STAT=p4z_sink_alloc )                
+         !
+      IF( p4z_sink_alloc /= 0 ) CALL ctl_warn('p4z_sink_alloc : failed to allocate arrays.')
+      !
+   END FUNCTION p4z_sink_alloc
+   
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_sink                    ! Empty routine
+   END SUBROUTINE p4z_sink
+#endif 
+
+   !!======================================================================
+END MODULE  p4zsink
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsms.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsms.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsms.F90	(revision 3680)
@@ -0,0 +1,548 @@
+MODULE p4zsms
+   !!======================================================================
+   !!                         ***  MODULE p4zsms  ***
+   !! TOP :   PISCES Source Minus Sink manager
+   !!======================================================================
+   !! History :   1.0  !  2004-03 (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4zsms        :  Time loop of passive tracers sms
+   !!----------------------------------------------------------------------
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE trcdta
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zbio          !  Biological model
+   USE p4zche          !  Chemical model
+   USE p4zlys          !  Calcite saturation
+   USE p4zflx          !  Gas exchange
+   USE p4zsbc          !  External source of nutrients
+   USE p4zsed          !  Sedimentation
+   USE p4zint          !  time interpolation
+   USE iom             !  I/O manager
+   USE trdmod_oce      !  Ocean trends variables
+   USE trdmod_trc      !  TOP trends variables
+   USE sedmodel        !  Sediment model
+   USE prtctl_trc      !  print control for debugging
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_sms_init    ! called in p4zsms.F90
+   PUBLIC   p4z_sms    ! called in p4zsms.F90
+
+   REAL(wp) :: alkbudget, no3budget, silbudget, ferbudget
+   INTEGER ::  numco2, numnut  !: logical unit for co2 budget
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zsms.F90 3320 2012-03-05 16:37:52Z cetlod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_sms( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_sms  ***
+      !!
+      !! ** Purpose :   Managment of the call to Biological sources and sinks 
+      !!              routines of PISCES bio-model
+      !!
+      !! ** Method  : - at each new day ...
+      !!              - several calls of bio and sed ???
+      !!              - ...
+      !!---------------------------------------------------------------------
+      !
+      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
+      !!
+      INTEGER ::   jnt, jn, jl
+      CHARACTER (len=25) :: charout
+      REAL(wp), POINTER, DIMENSION(:,:,:,:)  :: ztrdpis
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_sms')
+      !
+      IF( l_trdtrc )  THEN
+         CALL wrk_alloc( jpi, jpj, jpk, jp_pisces, ztrdpis ) 
+         DO jn = 1, jp_pisces
+            jl = jn + jp_pcs0 - 1
+            ztrdpis(:,:,:,jn) = trn(:,:,:,jl)
+         ENDDO
+      ENDIF
+      !
+      IF( ln_rsttr .AND. kt == nittrc000 )                         CALL p4z_rst( nittrc000, 'READ' )  !* read or initialize all required fields 
+      IF( ln_rsttr  .AND. ln_pisclo )                              CALL p4z_clo            ! damping on closed seas
+      IF( ln_pisdmp .AND. MOD( kt - nn_dttrc, nn_pisdmp ) == 0 )   CALL p4z_dmp( kt )      ! Relaxation of some tracers
+      !
+      IF( ndayflxtr /= nday_year ) THEN      ! New days
+         !
+         ndayflxtr = nday_year
+
+         IF(lwp) write(numout,*)
+         IF(lwp) write(numout,*) ' New chemical constants and various rates for biogeochemistry at new day : ', nday_year
+         IF(lwp) write(numout,*) '~~~~~~'
+
+         CALL p4z_che              ! computation of chemical constants
+         CALL p4z_int( kt )        ! computation of various rates for biogeochemistry
+         !
+      ENDIF
+
+      IF( ll_sbc ) CALL p4z_sbc( kt )   ! external sources of nutrients 
+
+      DO jnt = 1, nrdttrc          ! Potential time splitting if requested
+         !
+         CALL p4z_bio (kt, jnt)    ! Biology
+         CALL p4z_sed (kt, jnt)    ! Sedimentation
+         !
+         DO jn = jp_pcs0, jp_pcs1
+            trb(:,:,:,jn) = trn(:,:,:,jn)
+         ENDDO
+         !
+      END DO
+
+      IF( l_trdtrc )  THEN
+         DO jn = 1, jp_pisces
+            jl = jn + jp_pcs0 - 1
+            ztrdpis(:,:,:,jn) = ( ztrdpis(:,:,:,jn) - trn(:,:,:,jl) ) * rfact2r
+         ENDDO
+      ENDIF
+
+      CALL p4z_lys( kt )             ! Compute CaCO3 saturation
+      CALL p4z_flx( kt )             ! Compute surface fluxes
+
+      DO jn = jp_pcs0, jp_pcs1
+        CALL lbc_lnk( trn(:,:,:,jn), 'T', 1. )
+        CALL lbc_lnk( trb(:,:,:,jn), 'T', 1. )
+        CALL lbc_lnk( tra(:,:,:,jn), 'T', 1. )
+      END DO
+      !
+      IF( lk_sed ) THEN 
+         !
+         CALL sed_model( kt )     !  Main program of Sediment model
+         !
+         DO jn = jp_pcs0, jp_pcs1
+           CALL lbc_lnk( trn(:,:,:,jn), 'T', 1. )
+         END DO
+         !
+      ENDIF
+      !
+      IF( lrst_trc )  CALL p4z_rst( kt, 'WRITE' )  !* Write PISCES informations in restart file 
+      !
+      IF( l_trdtrc ) THEN
+         DO jn = 1, jp_pisces
+            jl = jn + jp_pcs0 - 1
+             ztrdpis(:,:,:,jn) = ztrdpis(:,:,:,jn) + tra(:,:,:,jl)
+             CALL trd_mod_trc( ztrdpis(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends
+          END DO
+          CALL wrk_dealloc( jpi, jpj, jpk, jp_pisces, ztrdpis ) 
+      END IF
+      !
+      CALL p4z_chk_mass( kt ) ! Mass conservation checking
+
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_sms')
+      !
+      !
+   END SUBROUTINE p4z_sms
+
+   SUBROUTINE p4z_sms_init
+      !!----------------------------------------------------------------------
+      !!                     ***  p4z_sms_init  ***  
+      !!
+      !! ** Purpose :   read PISCES namelist
+      !!
+      !! ** input   :   file 'namelist.trc.s' containing the following
+      !!             namelist: natext, natbio, natsms
+      !!                       natkriest ("key_kriest")
+      !!----------------------------------------------------------------------
+      NAMELIST/nampisbio/ nrdttrc, wsbio, xkmort, ferat3, wsbio2, niter1max, niter2max
+#if defined key_kriest
+      NAMELIST/nampiskrp/ xkr_eta, xkr_zeta, xkr_ncontent, xkr_mass_min, xkr_mass_max
+#endif
+      NAMELIST/nampisdmp/ ln_pisdmp, nn_pisdmp, ln_pisclo
+      NAMELIST/nampismass/ ln_check_mass
+      !!----------------------------------------------------------------------
+
+
+      REWIND( numnatp )
+      READ  ( numnatp, nampisbio )
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' Namelist : nampisbio'
+         WRITE(numout,*) '    frequence pour la biologie                nrdttrc   =', nrdttrc
+         WRITE(numout,*) '    POC sinking speed                         wsbio     =', wsbio
+         WRITE(numout,*) '    half saturation constant for mortality    xkmort    =', xkmort
+         WRITE(numout,*) '    Fe/C in zooplankton                       ferat3    =', ferat3
+         WRITE(numout,*) '    Big particles sinking speed               wsbio2    =', wsbio2
+         WRITE(numout,*) '    Maximum number of iterations for POC      niter1max =', niter1max
+         WRITE(numout,*) '    Maximum number of iterations for GOC      niter2max =', niter2max
+      ENDIF
+
+#if defined key_kriest
+
+      !                               ! nampiskrp : kriest parameters
+      !                               ! -----------------------------
+      xkr_eta      = 0.62
+      xkr_zeta     = 1.62
+      xkr_ncontent = 5.7E-6
+      xkr_mass_min = 0.0002
+      xkr_mass_max = 1.
+
+      REWIND( numnatp )                     ! read natkriest
+      READ  ( numnatp, nampiskrp )
+
+      IF(lwp) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) ' Namelist : nampiskrp'
+         WRITE(numout,*) '    Sinking  exponent                        xkr_eta      = ', xkr_eta
+         WRITE(numout,*) '    N content exponent                       xkr_zeta     = ', xkr_zeta
+         WRITE(numout,*) '    N content factor                         xkr_ncontent = ', xkr_ncontent
+         WRITE(numout,*) '    Minimum mass for Aggregates              xkr_mass_min = ', xkr_mass_min
+         WRITE(numout,*) '    Maximum mass for Aggregates              xkr_mass_max = ', xkr_mass_max
+         WRITE(numout,*)
+     ENDIF
+
+
+     ! Computation of some variables
+     xkr_massp = xkr_ncontent * 7.625 * xkr_mass_min**xkr_zeta
+
+#endif
+
+      ln_pisdmp = .true.
+      nn_pisdmp = 1
+      ln_pisclo = .false.
+
+      REWIND( numnatp )
+      READ  ( numnatp, nampisdmp )
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*)
+         WRITE(numout,*) ' Namelist : nampisdmp'
+         WRITE(numout,*) '    Relaxation of tracer to glodap mean value             ln_pisdmp      =', ln_pisdmp
+         WRITE(numout,*) '    Frequency of Relaxation                               nn_pisdmp      =', nn_pisdmp
+         WRITE(numout,*) '    Restoring of tracer to initial value  on closed seas  ln_pisclo      =', ln_pisclo
+         WRITE(numout,*) ' '
+      ENDIF
+
+      ln_check_mass = .false.
+      REWIND( numnatp )       
+      READ  ( numnatp, nampismass )
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist parameter for mass conservation checking'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    Flag to check mass conservation of NO3/Si/TALK ln_check_mass = ', ln_check_mass
+      ENDIF
+
+   END SUBROUTINE p4z_sms_init
+
+   SUBROUTINE p4z_rst( kt, cdrw )
+      !!---------------------------------------------------------------------
+      !!                   ***  ROUTINE p4z_rst  ***
+      !!
+      !!  ** Purpose : Read or write variables in restart file:
+      !!
+      !!  WRITE(READ) mode:
+      !!       kt        : number of time step since the begining of the experiment at the
+      !!                   end of the current(previous) run
+      !!---------------------------------------------------------------------
+      INTEGER         , INTENT(in) ::   kt         ! ocean time-step
+      CHARACTER(len=*), INTENT(in) ::   cdrw       ! "READ"/"WRITE" flag
+      !
+      INTEGER  ::  ji, jj, jk
+      REAL(wp) ::  zcaralk, zbicarb, zco3
+      REAL(wp) ::  ztmas, ztmas1
+      !!---------------------------------------------------------------------
+
+      IF( TRIM(cdrw) == 'READ' ) THEN
+         !
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) ' p4z_rst : Read specific variables from pisces model '
+         IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
+         ! 
+         IF( iom_varid( numrtr, 'PH', ldstop = .FALSE. ) > 0 ) THEN
+            CALL iom_get( numrtr, jpdom_autoglo, 'PH' , hi(:,:,:)  )
+         ELSE
+!            hi(:,:,:) = 1.e-9 
+            ! Set PH from  total alkalinity, borat (???), akb3 (???) and ak23 (???)
+            ! --------------------------------------------------------
+            DO jk = 1, jpk
+               DO jj = 1, jpj
+                  DO ji = 1, jpi
+                     ztmas   = tmask(ji,jj,jk)
+                     ztmas1  = 1. - tmask(ji,jj,jk)
+                     zcaralk = trn(ji,jj,jk,jptal) - borat(ji,jj,jk) / (  1. + 1.E-8 / ( rtrn + akb3(ji,jj,jk) )  )
+                     zco3    = ( zcaralk - trn(ji,jj,jk,jpdic) ) * ztmas + 0.5e-3 * ztmas1
+                     zbicarb = ( 2. * trn(ji,jj,jk,jpdic) - zcaralk )
+                     hi(ji,jj,jk) = ( ak23(ji,jj,jk) * zbicarb / zco3 ) * ztmas + 1.e-9 * ztmas1
+                  END DO
+               END DO
+            END DO
+         ENDIF
+         CALL iom_get( numrtr, jpdom_autoglo, 'Silicalim', xksi(:,:) )
+         IF( iom_varid( numrtr, 'Silicamax', ldstop = .FALSE. ) > 0 ) THEN
+            CALL iom_get( numrtr, jpdom_autoglo, 'Silicamax' , xksimax(:,:)  )
+         ELSE
+            xksimax(:,:) = xksi(:,:)
+         ENDIF
+         !
+      ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN
+         IF( kt == nitrst ) THEN
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) 'p4z_rst : write pisces restart file  kt =', kt
+            IF(lwp) WRITE(numout,*) '~~~~~~~'
+         ENDIF
+         CALL iom_rstput( kt, nitrst, numrtw, 'PH', hi(:,:,:) )
+         CALL iom_rstput( kt, nitrst, numrtw, 'Silicalim', xksi(:,:) )
+         CALL iom_rstput( kt, nitrst, numrtw, 'Silicamax', xksimax(:,:) )
+      ENDIF
+      !
+   END SUBROUTINE p4z_rst
+
+   SUBROUTINE p4z_dmp( kt )
+      !!----------------------------------------------------------------------
+      !!                    ***  p4z_dmp  ***
+      !!
+      !! ** purpose  : Relaxation of some tracers
+      !!----------------------------------------------------------------------
+      !
+      INTEGER, INTENT( in )  ::     kt ! time step
+      !
+      REAL(wp) ::  alkmean = 2426.     ! mean value of alkalinity ( Glodap ; for Goyet 2391. )
+      REAL(wp) ::  po4mean = 2.165     ! mean value of phosphates
+      REAL(wp) ::  no3mean = 30.90     ! mean value of nitrate
+      REAL(wp) ::  silmean = 91.51     ! mean value of silicate
+      !
+      REAL(wp) :: zarea, zalksum, zpo4sum, zno3sum, zsilsum
+      !!---------------------------------------------------------------------
+
+
+      IF(lwp)  WRITE(numout,*)
+      IF(lwp)  WRITE(numout,*) ' p4z_dmp : Restoring of nutrients at time-step kt = ', kt
+      IF(lwp)  WRITE(numout,*)
+
+      IF( cp_cfg == "orca" .AND. .NOT. lk_c1d ) THEN      ! ORCA configuration (not 1D) !
+         !                                                    ! --------------------------- !
+         ! set total alkalinity, phosphate, nitrate & silicate
+         zarea          = 1._wp / glob_sum( cvol(:,:,:) ) * 1e6              
+
+         zalksum = glob_sum( trn(:,:,:,jptal) * cvol(:,:,:)  ) * zarea
+         zpo4sum = glob_sum( trn(:,:,:,jppo4) * cvol(:,:,:)  ) * zarea * po4r
+         zno3sum = glob_sum( trn(:,:,:,jpno3) * cvol(:,:,:)  ) * zarea * rno3
+         zsilsum = glob_sum( trn(:,:,:,jpsil) * cvol(:,:,:)  ) * zarea
+ 
+         IF(lwp) WRITE(numout,*) '       TALK mean : ', zalksum
+         trn(:,:,:,jptal) = trn(:,:,:,jptal) * alkmean / zalksum
+
+         IF(lwp) WRITE(numout,*) '       PO4  mean : ', zpo4sum
+         trn(:,:,:,jppo4) = trn(:,:,:,jppo4) * po4mean / zpo4sum
+
+         IF(lwp) WRITE(numout,*) '       NO3  mean : ', zno3sum
+         trn(:,:,:,jpno3) = trn(:,:,:,jpno3) * no3mean / zno3sum
+
+         IF(lwp) WRITE(numout,*) '       SiO3 mean : ', zsilsum
+         trn(:,:,:,jpsil) = MIN( 400.e-6,trn(:,:,:,jpsil) * silmean / zsilsum )
+         !
+      ENDIF
+
+   END SUBROUTINE p4z_dmp
+
+
+   SUBROUTINE p4z_chk_mass( kt )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_chk_mass  ***
+      !!
+      !! ** Purpose :  Mass conservation check 
+      !!
+      !!---------------------------------------------------------------------
+      !
+      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
+      !!
+      !!---------------------------------------------------------------------
+
+      IF( kt == nittrc000 ) THEN 
+         IF( ln_check_mass .AND. lwp) THEN      !   Open budget file of NO3, ALK, Si, Fer
+            CALL ctl_opn( numco2, 'carbon.budget'  , 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea )
+            CALL ctl_opn( numnut, 'nutrient.budget', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea )
+         ENDIF
+      ENDIF
+
+      IF( ln_check_mass .AND. kt == nitend ) THEN      !   Compute the budget of NO3, ALK, Si, Fer
+         no3budget = glob_sum( (    trn(:,:,:,jpno3) + trn(:,:,:,jpnh4)  &
+            &                     + trn(:,:,:,jpphy) + trn(:,:,:,jpdia)  &
+            &                     + trn(:,:,:,jpzoo) + trn(:,:,:,jpmes)  &
+#if ! defined key_kriest
+            &                     + trn(:,:,:,jppoc) + trn(:,:,:,jpgoc)  &
+#else
+            &                     + trn(:,:,:,jppoc)                     &
+#endif
+            &                     + trn(:,:,:,jpdoc)                     ) * cvol(:,:,:)  ) 
+         ! 
+         silbudget = glob_sum( (   trn(:,:,:,jpsil) + trn(:,:,:,jpgsi)  &
+            &                     + trn(:,:,:,jpdsi)                     ) * cvol(:,:,:)  )
+         ! 
+         alkbudget = glob_sum( (   trn(:,:,:,jpno3) * rno3              &
+            &                     + trn(:,:,:,jptal)                     &
+            &                     + trn(:,:,:,jpcal) * 2.                ) * cvol(:,:,:)  )
+         ! 
+         ferbudget = glob_sum( (   trn(:,:,:,jpfer) + trn(:,:,:,jpnfe)  &
+            &                     + trn(:,:,:,jpdfe) + trn(:,:,:,jpbfe)  &
+            &                     + trn(:,:,:,jpsfe)                    &
+            &                     + trn(:,:,:,jpzoo)                     &
+            &                     + trn(:,:,:,jpmes) * ferat3            ) * cvol(:,:,:)  )
+
+         !
+         t_atm_co2_flx  = t_atm_co2_flx / glob_sum( e1e2t(:,:) )
+         t_oce_co2_flx  = t_oce_co2_flx         * 12. / 1.e15 * (-1 )
+         tpp            = tpp           * 1000. * 12. / 1.E15
+         t_oce_co2_exp  = t_oce_co2_exp * 1000. * 12. / 1.E15
+         !
+         no3budget = no3budget / areatot
+         silbudget = silbudget / areatot
+         alkbudget = alkbudget / areatot
+         ferbudget = ferbudget / areatot
+         !
+         IF(lwp) THEN
+            WRITE(numco2,9000) ndastp, t_atm_co2_flx, t_oce_co2_flx, tpp, t_oce_co2_exp
+            WRITE(numnut,9500) ndastp, alkbudget, no3budget, silbudget, ferbudget
+         ENDIF
+         !
+      ENDIF
+       !
+ 9000  FORMAT(i8,f10.5,e18.10,f10.5,f10.5)
+ 9500  FORMAT(i8,4e18.10)     
+       !
+   END SUBROUTINE p4z_chk_mass
+
+   SUBROUTINE p4z_clo   
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_clo  ***
+      !!
+      !! ** Purpose :   Closed sea domain initialization
+      !!
+      !! ** Method  :   if a closed sea is located only in a model grid point
+      !!                we restore to initial data
+      !!
+      !! ** Action  :   ictsi1(), ictsj1() : south-west closed sea limits (i,j)
+      !!                ictsi2(), ictsj2() : north-east Closed sea limits (i,j)
+      !!----------------------------------------------------------------------
+      INTEGER, PARAMETER           ::   npicts   = 4        ! number of closed sea
+      INTEGER, DIMENSION(npicts)   ::   ictsi1, ictsj1      ! south-west closed sea limits (i,j)
+      INTEGER, DIMENSION(npicts)   ::   ictsi2, ictsj2      ! north-east closed sea limits (i,j)
+      INTEGER :: ji, jj, jk, jn, jl, jc                     ! dummy loop indices
+      INTEGER :: ierr                                       ! local integer
+      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::  ztrcdta     ! 4D  workspace
+      !!----------------------------------------------------------------------
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*)' p4z_clo : closed seas '
+      IF(lwp) WRITE(numout,*)'~~~~~~~'
+
+      ! initial values
+      ictsi1(:) = 1  ;  ictsi2(:) = 1 
+      ictsj1(:) = 1  ;  ictsj2(:) = 1 
+
+      ! set the closed seas (in data domain indices)
+      ! -------------------
+
+      IF( cp_cfg == "orca" ) THEN
+         !
+         SELECT CASE ( jp_cfg )
+         !                                           ! =======================
+         CASE ( 2 )                                  !  ORCA_R2 configuration
+            !                                        ! =======================
+            !                                            ! Caspian Sea
+            ictsi1(1)   =  11  ;  ictsj1(1)   = 103
+            ictsi2(1)   =  17  ;  ictsj2(1)   = 112
+            !                                            ! Great North American Lakes
+            ictsi1(2)   =  97  ;  ictsj1(2)   = 107
+            ictsi2(2)   = 103  ;  ictsj2(2)   = 111
+            !                                            ! Black Sea 1 : west part of the Black Sea
+            ictsi1(3)   = 174  ; ictsj1(3)   = 107
+            ictsi2(3)   = 181  ; ictsj2(3)   = 112
+            !                                            ! Black Sea 2 : est part of the Black Sea
+            ictsi1(4)   =   2  ;  ictsj1(4)   = 107
+            ictsi2(4)   =   6  ;  ictsj2(4)   = 112
+            !                                        ! =======================
+         CASE ( 4 )                                  !  ORCA_R4 configuration
+            !                                        ! =======================
+            !                                            ! Caspian Sea
+            ictsi1(1)   =  4  ;  ictsj1(1)   = 53
+            ictsi2(1)   =  4  ;  ictsj2(1)   = 56
+            !                                            ! Great North American Lakes
+            ictsi1(2)   = 49  ;  ictsj1(2)   = 55
+            ictsi2(2)   = 51  ;  ictsj2(2)   = 56
+            !                                            ! Black Sea
+            ictsi1(3)   = 88  ;  ictsj1(3)   = 55
+            ictsi2(3)   = 91  ;  ictsj2(3)   = 56
+            !                                            ! Baltic Sea
+            ictsi1(4)   = 75  ;  ictsj1(4)   = 59
+            ictsi2(4)   = 76  ;  ictsj2(4)   = 61
+            !                                        ! =======================
+            !                                        ! =======================
+         CASE ( 025 )                                ! ORCA_R025 configuration
+            !                                        ! =======================
+                                                     ! Caspian + Aral sea
+            ictsi1(1)   = 1330 ; ictsj1(1)   = 645
+            ictsi2(1)   = 1400 ; ictsj2(1)   = 795
+            !                                        ! Azov Sea
+            ictsi1(2)   = 1284 ; ictsj1(2)   = 722
+            ictsi2(2)   = 1304 ; ictsj2(2)   = 747
+            !
+         END SELECT
+         !
+      ENDIF
+
+      ! convert the position in local domain indices
+      ! --------------------------------------------
+      DO jc = 1, npicts 
+         ictsi1(jc)   = mi0( ictsi1(jc) )
+         ictsj1(jc)   = mj0( ictsj1(jc) )
+
+         ictsi2(jc)   = mi1( ictsi2(jc) )
+         ictsj2(jc)   = mj1( ictsj2(jc) )
+      END DO
+
+      ! Restore close seas values to initial data
+      IF( ln_trcdta .AND. nb_trcdta > 0 )  THEN   ! Initialisation of tracer from a file that may also be used for damping
+         !
+         CALL wrk_alloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )   ! Memory allocation
+         !
+         CALL trc_dta( nittrc000, ztrcdta )   ! read tracer data at nittrc000
+         !
+         DO jn = 1, jptra
+            IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
+                jl = n_trc_index(jn)
+                DO jc = 1, npicts
+                   DO jk = 1, jpkm1
+                      DO jj = ictsj1(jc), ictsj2(jc)
+                         DO ji = ictsi1(jc), ictsi2(jc)
+                            trn(ji,jj,jk,jn) = ztrcdta(ji,jj,jk,jl) * tmask(ji,jj,jk)
+                            trb(ji,jj,jk,jn) = trn(ji,jj,jk,jn)
+                         ENDDO
+                      ENDDO
+                   ENDDO
+                ENDDO
+             ENDIF
+          ENDDO
+          CALL wrk_dealloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )
+      ENDIF
+      !
+   END SUBROUTINE p4z_clo
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_sms( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'p4z_sms: You should not have seen this print! error?', kt
+   END SUBROUTINE p4z_sms
+#endif 
+
+   !!======================================================================
+END MODULE p4zsms 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/par_sed.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/par_sed.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/par_sed.F90	(revision 3680)
@@ -0,0 +1,66 @@
+MODULE par_sed
+   !!======================================================================
+   !!                        ***  par_sed  ***
+   !! Sediment :   set sediment parameter
+   !!======================================================================
+   !! History :
+   !!        !  06-12  (C. Ethe)  Orignal
+   !!----------------------------------------------------------------------
+#if defined key_sed
+   !! Domain characteristics
+   USE par_kind
+   USE par_oce , ONLY :       &
+      jpi      =>   jpi   ,  & !: first  dimension of grid --> i
+      jpj      =>   jpj   ,  & !: second dimension of grid --> j
+      jpim1    =>   jpim1 ,  & !: jpi - 1
+      jpjm1    =>   jpjm1 ,  & !: jpj - 1
+      jpij     =>   jpij       !: jpi x jpj
+      jp_tem   =>   jp_tem     !: indice of temperature
+      jp_sal   =>   jp_sal     !: indice of salintity
+
+#if ! defined key_sed_off
+   USE par_pisces
+#endif
+
+#if defined key_kriest
+   INTEGER, PARAMETER :: jpdta = 11
+#else
+   INTEGER, PARAMETER :: jpdta = 12
+#endif
+
+
+   ! Vertical sediment geometry
+   INTEGER, PARAMETER :: &
+      jpksed   = 11         ,   & !: number of sediment layers
+      jpksedm1 = jpksed - 1 
+      
+   ! sediment tracer species
+   INTEGER, PARAMETER :: &
+      jpsol = 4,         &  !: number of solid component
+      jpwat = 7,         &   !: number of pore water component
+      jpwatp1 = jpwat + 1
+
+   
+   ! pore water components       
+   INTEGER, PARAMETER :: &
+      jwsil  = 1,        & !: silic acid
+      jwoxy  = 2,        & !: oxygen
+      jwdic  = 3,        & !: dissolved inorganic carbon
+      jwno3  = 4,        & !: nitrate
+      jwpo4  = 5,        & !: phosphate
+      jwalk  = 6,        & !: alkalinity
+      jwc13  = 7           !: dissolved inorganic carbon 13
+
+   ! solid components       
+   INTEGER, PARAMETER ::  &
+      jsopal  = 1,        & !: opal sediment
+      jsclay  = 2,        & !: clay
+      jspoc   = 3,        & !: organic carbon
+      jscal   = 4           !: calcite
+
+   INTEGER, PARAMETER ::  &
+      jptrased   = jpsol + jpwat , &
+      jpdia3dsed = 3          , &
+      jpdia2dsed = 7
+#endif
+END MODULE par_sed
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sed.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sed.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sed.F90	(revision 3680)
@@ -0,0 +1,191 @@
+MODULE sed
+   !!======================================================================
+   !!                        ***  sed  ***
+   !! Sediment :   set sediment global variables
+   !!======================================================================
+#if defined key_sed
+   !! History :
+   !!        !  06-12  (C. Ethe)  Orignal
+   !!----------------------------------------------------------------------
+   USE par_sed
+   USE in_out_manager
+
+   IMPLICIT NONE
+   PUBLIC
+
+   PUBLIC sed_alloc   
+
+   USE dom_oce , ONLY :   nidom     =>   nidom          !:
+   USE dom_oce , ONLY :   glamt     =>   glamt          !: longitude of t-point (degre)
+   USE dom_oce , ONLY :   gphit     =>   gphit          !: latitude  of t-point (degre)
+   USE dom_oce , ONLY :   e3t_0     =>   e3t_0          !: reference depth of t-points (m)
+   USE dom_oce , ONLY :   mbkt      =>   mbkt           !: vertical index of the bottom last T- ocean level
+   USE dom_oce , ONLY :   tmask     =>   tmask          !: land/ocean mask at t-points
+   USE dom_oce , ONLY :   rdt       =>   rdt            !: time step for the dynamics
+   USE dom_oce , ONLY :   nyear     =>   nyear          !: Current year
+   USE dom_oce , ONLY :   nmonth    =>   nmonth         !: Current month
+   USE dom_oce , ONLY :   nday      =>   nday           !: Current day
+   USE dom_oce , ONLY :   ndastp    =>   ndastp         !: time step date in year/month/day aammjj
+   USE dom_oce , ONLY :   nday_year =>   nday_year      !: curent day counted from jan 1st of the current year
+   USE dom_oce , ONLY :   adatrj    =>   adatrj         !: number of elapsed days since the begining of the run
+   !                                !: it is the accumulated duration of previous runs
+   !                                !: that may have been run with different time steps.
+
+#if ! defined key_sed_off
+
+   USE oce     , ONLY :  tsn        =>   tsn             !: pot. temperature (celsius) and salinity (psu)
+
+   USE trc     , ONLY :  trn        =>   trc             !: tracer 
+   USE trc     , ONLY :  nwritetrc  =>   nwritetrc       !: outputs frequency of tracer model
+
+   USE p4zsink , ONLY :  sinking    =>   sinking         !: sinking flux for POC
+#if ! defined key_kriest
+   USE p4zsink , ONLY :  sinking2   =>   sinking2        !: sinking flux for GOC
+#endif
+   USE p4zsink , ONLY :  sinkcal    =>   sinkcal         !: sinking flux for calcite
+   USE p4zsink , ONLY :  sinksil    =>   sinksil         !: sinking flux for opal ( dsi )
+
+   USE sms_pisces, ONLY : akb3      =>   akb3            !: Chemical constants  
+   USE sms_pisces, ONLY : ak13      =>   ak13            !: Chemical constants  
+   USE sms_pisces, ONLY : ak23      =>   ak23            !: Chemical constants  
+   USE sms_pisces, ONLY : akw3      =>   akw3            !: Chemical constants  
+   USE sms_pisces, ONLY : aksp      =>   aksp            !: Chemical constants  
+   USE sms_pisces, ONLY : borat     =>   borat           !: Chemical constants ( borat ) 
+
+#endif   
+
+
+   !! Namelist
+   REAL(wp), PUBLIC, DIMENSION(5) ::  reac                !: reactivity rc in  [l.mol-1.s-1]
+   REAL(wp), PUBLIC               ::  reac_sil            !: reactivity of silicate in  [l.mol-1.s-1]
+   REAL(wp), PUBLIC               ::  reac_clay           !: reactivity of clay in  [l.mol-1.s-1]
+   REAL(wp), PUBLIC               ::  reac_poc            !: reactivity of poc in  [l.mol-1.s-1]
+   REAL(wp), PUBLIC               ::  reac_no3            !: reactivity of no3 in  [l.mol-1.s-1]
+   REAL(wp), PUBLIC               ::  reac_cal            !: reactivity of cal in  [l.mol-1.s-1]
+   REAL(wp), PUBLIC               ::  sat_sil             !: saturation concentration for silicate in [mol.l-1]
+   REAL(wp), PUBLIC               ::  sat_clay            !: saturation concentration for clay in [mol.l-1]
+   REAL(wp), PUBLIC               ::  so2ut 
+   REAL(wp), PUBLIC               ::  srno3 
+   REAL(wp), PUBLIC               ::  spo4r 
+   REAL(wp), PUBLIC               ::  srDnit 
+   REAL(wp), PUBLIC               ::  sthro2              !: threshold O2 concen. in [mol.l-1]
+   REAL(wp), PUBLIC               ::  pdb = 0.0112372     !: 13C/12C in PD Belemnite
+   REAL(wp), PUBLIC               ::  rc13P  = 0.980      !: 13C/12C in POC = rc13P*PDB
+   REAL(wp), PUBLIC               ::  rc13Ca = 1.001      !: 13C/12C in CaCO3 = rc13Ca*PDB
+   REAL(wp), PUBLIC               ::  dtsed               !: sedimentation time step
+   REAL(wp), PUBLIC               ::  db                  !: bioturb coefficient in [cm2.s-1]
+
+   INTEGER , PUBLIC               ::  nitsed000
+   INTEGER , PUBLIC               ::  nitsedend
+   INTEGER , PUBLIC               ::  nwrised
+   INTEGER , PUBLIC               ::  nfreq
+   REAL(wp), PUBLIC               ::  dens                !: density of solid material
+   !
+   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::  pwcp       !: pore water sediment data at given time-step
+   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::  pwcp0      !: pore water sediment data at initial time
+   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::  solcp      !: solid sediment data at given time-step
+   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::  solcp0     !: solid sediment data at initial time
+
+   !! * Shared module variables
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  pwcp_dta   !: pore water data at given time-step
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  rainrm_dta !: rain data at at initial time
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  rainrm     !: rain data at given time-step
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  rainrg     !: rain of each solid component in [g/(cm**2.s)]
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  fromsed    !:
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  tosed      !:
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  rloss      !: 
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  tokbot        
+   !
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  temp       !: temperature
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  salt       !: salinity
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  press      !: pressure
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  raintg     !: total massic flux rained in each cell (sum of sol. comp.)
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  dzdep      !: total thickness of solid material rained [cm] in each cell
+   !
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  hipor      !: [h+] in mol/kg*densSW 
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  co3por     !: [co3--]solid sediment at initial time
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  dz3d       !:  ???
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  volw3d     !:  ???
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  vols3d     !:  ???
+
+
+   !! Chemistry
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  densSW 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  borats 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  calcon2
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  akbs  
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  ak1s 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  ak2s   
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  akws  
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  ak12s  
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  ak1ps 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  ak2ps  
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  ak3ps 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  ak12ps 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  ak123ps
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  aksis 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  aksps 
+
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  mol_wgt    !: molecular weight of solid sediment data
+ 
+   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::  trc_data    !: tracer data to share with sediment model
+   !! Geometry
+   INTEGER , PUBLIC, SAVE                          ::  jpoce, indoce !: Ocean points ( number/indices )
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  iarroce       !: Computation of 1D array of sediments points
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  epkbot        !: ocean bottom layer thickness
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  dzkbot        !: ocean bottom layer thickness in meters
+   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::  tmasksed      !: sediment mask
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  sbathy        !: bathymetry
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  dz            !: sediment layers thickness
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  por           !: porosity profile     
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  por1          !: 1-por 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  profsed       !: depth of middle of each layer
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  volw          !: volume of pore water cell fraction
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  vols          !: volume of solid cell fraction
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  diff          !: diffusion ceofficient
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  rdtsed        !:  sediment model time-step
+   REAL(wp)  ::   dens               !: density of solid material
+   !! Inputs / Outputs
+   CHARACTER( len = 80 ), DIMENSION(jptrased  ) ::  sedtrcl
+   CHARACTER( len = 20 ), DIMENSION(jptrased  ) ::  sedtrcd , sedtrcu
+   CHARACTER( len = 80 ), DIMENSION(jpdia3dsed) ::  seddia3l 
+   CHARACTER( len = 20 ), DIMENSION(jpdia3dsed) ::  seddia3d, seddia3u
+   CHARACTER( len = 80 ), DIMENSION(jpdia2dsed) ::  seddia2l 
+   CHARACTER( len = 20 ), DIMENSION(jpdia2dsed) ::  seddia2d, seddia2u
+   !
+   REAL(wp), PUBLIC, DIMENSION(:,:,:,:), ALLOCATABLE ::  trcsedi
+   REAL(wp), PUBLIC, DIMENSION(:,:,:,:), ALLOCATABLE ::  flxsedi3d
+   REAL(wp), PUBLIC, DIMENSION(:,:,:  ), ALLOCATABLE ::  flxsedi2d
+
+   INTEGER, PUBLIC ::  numsed = 27    ! units
+
+CONTAINS
+
+   INTEGER FUNCTION sed_alloc()
+      !!-------------------------------------------------------------------
+      !!                    *** ROUTINE sed_alloc ***
+      !!-------------------------------------------------------------------
+      USE lib_mpp, ONLY: ctl_warn
+      !!-------------------------------------------------------------------
+      !
+      ALLOCATE( trc_dta(jpi,jpj,jdta)                                     ,   &
+         &      epkbot(jpi,jpj), sbathy(jpi,jpj)                          ,   &
+         &      tmasksed(jpi,jpj,jpksed)                                  ,   &
+         &      dz(jpksed)  , por(jpksed) , por1(jpksed), profsed(jpksed) ,   &
+         &      volw(jpksed), vols(jpksed), diff(jpksed), rdtsed(jpksed)  ,   &
+         &      trcsedi  (jpi,jpj,jpksed,jptrased)                        ,   &
+         &      flxsedi3d(jpi,jpj,jpksed,jpdia3dsed)                      ,   &
+         &      flxsedi2d(jpi,jpj,jpksed,jpdia2dsed)                      ,   &
+         &      mol_wgt(jpsol),                                           STAT=sed_alloc )
+
+      IF( sed_alloc /= 0 )   CALL ctl_warn('sed_alloc: failed to allocate arrays')
+      !
+   END FUNCTION sed_alloc
+
+#else
+   !!======================================================================
+   !! No Sediment model
+   !!======================================================================
+#endif
+
+END MODULE sed
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedadv.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedadv.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedadv.F90	(revision 3680)
@@ -0,0 +1,449 @@
+MODULE sedadv
+#if defined key_sed
+   !!======================================================================
+   !!              ***  MODULE  sedadv  ***
+   !!    Sediment : vertical advection and burial
+   !!=====================================================================
+   !! * Modules used
+   !!----------------------------------------------------------------------
+   !!   sed_adv :
+   !!----------------------------------------------------------------------
+   USE sed     ! sediment global variable
+
+   PUBLIC sed_adv
+
+   !! * Module variable
+   INTEGER, PARAMETER  ::  nztime = jpksed         ! number of time step between sunrise and sunset
+
+   REAL(wp), DIMENSION(jpksed), SAVE :: dvolsp, dvolsm
+   REAL(wp), DIMENSION(jpksed), SAVE :: c2por, ckpor
+
+   REAL(wp) :: cpor
+   REAL(wp) :: por1clay 
+   REAL(wp) :: eps = 1.e-13
+
+CONTAINS
+
+   SUBROUTINE sed_adv( kt )
+      !!-------------------------------------------------------------------------
+      !!                  ***  ROUTINE sed_adv  ***
+      !!
+      !! ** Purpose : vertical solid sediment advection and burial 
+      !!
+      !! ** Method  : At each grid point the 1-dimensional solid sediment column
+      !!              is shifted according the rain added to the top layer and
+      !!              the gaps produced through redissolution so that in the end
+      !!              the original sediment mixed layer geometry is reestablished.
+      !!
+      !!
+      !!   History :
+      !!        !  98-08 (E. Maier-Reimer, Christoph Heinze )  Original code
+      !!        !  04-10 (N. Emprin, M. Gehlen ) F90
+      !!        !  06-04 (C. Ethe)  Re-organization
+      !!-------------------------------------------------------------------------
+      !!* Arguments
+      INTEGER, INTENT(in) ::  &
+         kt                     ! time step
+      ! * local variables
+      INTEGER :: ji, jk, js 
+      INTEGER :: jn, ntimes, ikwneg
+      
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE :: zsolcpno
+      REAL(wp), DIMENSION(:  ), ALLOCATABLE :: zfilled, zfull, zfromup, zempty
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE :: zgap, zwb
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE :: zrainrf
+      REAL(wp), DIMENSION(nztime) ::  zraipush
+
+      REAL(wp) :: zkwnup, zkwnlo, zfrac,  zfromce, zrest
+
+      !------------------------------------------------------------------------
+
+
+      IF( kt == nitsed000 ) THEN
+         WRITE(numsed,*) ' '
+         WRITE(numsed,*) ' sed_adv : vertical sediment advection  '
+         WRITE(numsed,*) ' '
+         por1clay = dens * por1(jpksed) * dz(jpksed) / mol_wgt(jsclay)
+         cpor     = por1(jpksed) / por1(2)
+         DO jk = 2, jpksed
+            c2por(jk) = por1(2)      / por1(jk)
+            ckpor(jk) = por1(jpksed) / por1(jk)
+         ENDDO
+         DO jk = jpksedm1, 2, -1
+            dvolsp(jk) = vols(jk+1) / vols(jk)
+         ENDDO
+         DO jk = 3, jpksed
+           dvolsm(jk) = vols(jk-1) / vols(jk)
+        ENDDO
+      ENDIF
+
+      ALLOCATE( zsolcpno(jpksed,jpsol), zrainrf(jpoce,jpsol) )
+      ALLOCATE( zfilled(jpksed), zfull(jpksed), zfromup(jpksed), zempty(jpksed) )
+      ALLOCATE( zgap (jpoce,jpksed)   , zwb(jpoce,jpksed)  )  
+
+      ! Initialization of data for mass balance calculation
+      !---------------------------------------------------
+      fromsed(:,:) = 0.
+      tosed  (:,:) = 0. 
+      rloss  (:,:) = 0.
+
+
+      ! Initiate gap 
+      !--------------
+      zgap(:,:) = 0.
+      DO js = 1, jpsol
+         DO jk = 1, jpksed
+            DO ji = 1, jpoce
+               zgap(ji,jk) = zgap(ji,jk) + solcp(ji,jk,js)
+            END DO
+         ENDDO
+      ENDDO
+
+      zgap(1:jpoce,1:jpksed) = 1. - zgap(1:jpoce,1:jpksed)   
+
+
+      ! Initiate burial rates
+      !-----------------------
+      zwb(:,:) = 0.
+      DO jk = 2, jpksed
+         zfrac =  dtsed / ( dens * por1(jk) )     
+         DO ji = 1, jpoce
+            zwb(ji,jk) = zfrac * raintg(ji)
+         END DO
+      ENDDO
+
+
+      DO ji = 1, jpoce
+         zwb(ji,2) = zwb(ji,2) - zgap(ji,2) * dz(2)
+      ENDDO
+
+      DO jk = 3, jpksed
+         zfrac = por1(jk-1) / por1(jk)
+         DO ji = 1, jpoce
+            zwb(ji,jk) = zwb(ji,jk-1) * zfrac - zgap(ji,jk) * dz(jk)
+         END DO
+      ENDDO
+
+
+      zrainrf(:,:) = 0.
+      DO ji = 1, jpoce
+         IF( raintg(ji) /= 0. )  &
+            &   zrainrf(ji,:) = rainrg(ji,:) / raintg(ji)
+      ENDDO
+
+
+      ! Computation of full and empty solid fraction in each layer
+      ! for all 'burial' case
+      !----------------------------------------------------------
+
+
+      DO ji = 1, jpoce
+
+         ! computation of total weight fraction in sediment
+         !-------------------------------------------------
+         zfilled(:) = 0.
+         DO js = 1, jpsol
+            DO jk = 2, jpksed
+               zfilled(jk) = zfilled(jk) + solcp(ji,jk,js)
+            ENDDO
+         ENDDO
+         
+         DO js = 1, jpsol
+            DO jk = 2, jpksed
+               zsolcpno(jk,js) = solcp(ji,jk,js) / zfilled(jk)
+            ENDDO
+         ENDDO
+
+         ! burial  3 cases: 
+         ! zwb > 0 ==> rain > total rection loss 
+         ! zwb = 0 ==> rain = 0
+         ! zwb < 0 ==> rain > 0 and rain < total reaction loss
+         !----------------------------------------------------------------
+
+         IF( zwb(ji,jpksed) > 0. ) THEN
+
+            zfull (jpksed) = zfilled(jpksed)
+            zempty(jpksed) = 1. - zfull(jpksed)
+            DO jk = jpksedm1, 2, -1
+               zfull (jk) = zfilled(jk)
+               zfull (jk) = zfull(jk) - zempty(jk+1) * dvolsp(jk)
+               zempty(jk) = 1. - zfull(jk)
+            ENDDO
+
+            ! Computation of solid sediment species
+            !--------------------------------------
+            ! push entire sediment column downward to account rest of rain
+            DO js = 1, jpsol
+               DO jk = jpksed, 3, -1
+                  solcp(ji,jk,js) = zfull(jk) * zsolcpno(jk,js) + zempty(jk) * zsolcpno(jk-1,js)
+               ENDDO
+
+               solcp(ji,2,js) = zfull(2) * zsolcpno(2,js) + zempty(2) * zrainrf(ji,js)
+
+               DO jk = 2, jpksed
+                  zsolcpno(jk,js) = solcp(ji,jk,js)
+               END DO
+            ENDDO
+
+            zrest = zwb(ji,jpksed) * cpor
+            ! what is remaining is less than dz(2)
+            IF( zrest <= dz(2) ) THEN           
+
+               zfromup(2) = zrest / dz(2)
+               DO jk = 3, jpksed
+                  zfromup(jk) = zwb(ji,jpksed) * ckpor(jk) / dz(jk)
+               ENDDO
+               DO js = 1, jpsol
+                  zfromce = 1. - zfromup(2)
+                  solcp(ji,2,js) = zfromce * zsolcpno(2,js) + zfromup(2) * zrainrf(ji,js)
+                  DO jk = 3, jpksed
+                     zfromce = 1. - zfromup(jk)
+                     solcp(ji,jk,js) = zfromce * zsolcpno(jk,js) + zfromup(jk) * zsolcpno(jk-1,js)
+                  ENDDO
+                  fromsed(ji,js) = 0.
+                  ! quantities to push in deeper sediment
+                  tosed  (ji,js) = zsolcpno(jpksed,js) &
+                     &           * zwb(ji,jpksed) * dens * por1(jpksed) / mol_wgt(js)
+               ENDDO
+               
+            ELSE ! what is remaining is great than dz(2)
+
+               ntimes = INT( zrest / dz(2) ) + 1
+               IF( ntimes > nztime ) THEN
+                  WRITE( numsed,* ) ' sedadv : rest too large at sediment point ji = ', ji
+                  STOP
+               ENDIF
+               zraipush(1) = dz(2)
+               zrest = zrest - zraipush(1)
+               DO jn = 2, ntimes
+                  IF( zrest >= dz(2) ) THEN
+                     zraipush(jn) = dz(2)
+                     zrest = zrest - zraipush(jn)
+                  ELSE
+                     zraipush(jn) = zrest
+                     zrest = 0.
+                  ENDIF
+               ENDDO
+
+               DO jn = 1, ntimes
+                  DO js = 1, jpsol
+                     DO jk = 2, jpksed
+                        zsolcpno(jk,js) = solcp(ji,jk,js)
+                     END DO
+                  ENDDO
+                  
+                  zfromup(2) = zraipush(jn) / dz(2)
+                  DO jk = 3, jpksed
+                     zfromup(jk) = ( zraipush(jn) / dz(jk) ) * c2por(jk)
+                  ENDDO
+
+                  DO js = 1, jpsol
+                     zfromce = 1. - zfromup(2)
+                     solcp(ji,2,js) = zfromce * zsolcpno(2,js) + zfromup(2) * zrainrf(ji,js)
+                     DO jk = 3, jpksed
+                        zfromce = 1. - zfromup(jk)
+                        solcp(ji,jk,js) = zfromce * zsolcpno(jk,js) + zfromup(jk) * zsolcpno(jk-1,js)
+                     ENDDO
+                     fromsed(ji,js) = 0.
+                     tosed  (ji,js) = tosed(ji,js) + zsolcpno(jpksed,js) * zraipush(jn) &
+                        &             * dens * por1(2) / mol_wgt(js)
+                  ENDDO
+               ENDDO
+ 
+            ENDIF
+
+         ELSE IF( raintg(ji) < eps ) THEN ! rain  = 0
+!! Nadia    rloss(:,:) = rainrm(:,:)   bug ??????           
+
+            rloss(ji,1:jpsol) = rainrm(ji,1:jpsol)
+
+            zfull (2) = zfilled(2)
+            zempty(2) = 1. - zfull(2)
+            DO jk = 3, jpksed
+               zfull (jk) = zfilled(jk)
+               zfull (jk) = zfull (jk) - zempty(jk-1) * dvolsm(jk)
+               zempty(jk) = 1. - zfull(jk)
+            ENDDO
+
+            ! fill boxes with weight fraction from underlying box
+            DO js = 1, jpsol
+               DO jk = 2, jpksedm1
+                  solcp(ji,jk,js) = zfull(jk) * zsolcpno(jk,js) + zempty(jk) * zsolcpno(jk+1,js)
+               END DO
+               solcp(ji,jpksed,js) = zsolcpno(jpksed,js) * zfull(jpksed)
+               tosed  (ji,js) = 0.
+               fromsed(ji,js) = 0.
+            ENDDO
+            ! for the last layer, one make go up clay 
+            solcp(ji,jpksed,jsclay) = solcp(ji,jpksed,jsclay) + zempty(jpksed) * 1.
+            !! C. Heinze      fromsed(ji,jsclay) = zempty(jpksed) * 1. * dens * por1(jpksed) / mol_wgt(jsclay)
+            fromsed(ji,jsclay) = zempty(jpksed) * 1. * por1clay
+
+         ELSE  ! rain > 0 and rain < total reaction loss
+
+
+            DO jk = 2, jpksed
+               zfull (jk) = zfilled(jk)
+               zempty(jk) = 1. - zfull(jk)
+            ENDDO
+
+            ! Determination of indice of layer - ikwneg - where advection is reversed
+            !------------------------------------------------------------------------
+ iflag:     DO jk = 2, jpksed
+               IF( zwb(ji,jk) < 0.  ) THEN
+                  ikwneg = jk
+                  EXIT iflag
+               ENDIF
+            ENDDO iflag
+
+            ! computation of zfull and zempty 
+            ! 3 cases : a/ ikwneg=2, b/ikwneg=3...jpksedm1, c/ikwneg=jpksed    
+            !-------------------------------------------------------------      
+            IF( ikwneg == 2 ) THEN ! advection is reversed in the first sediment layer
+
+               zkwnup = rdtsed(ikwneg) * raintg(ji) / dz(ikwneg)
+               zkwnlo = ABS( zwb(ji,ikwneg) ) / dz(ikwneg)
+               zfull (ikwneg+1) = zfilled(ikwneg+1) - zkwnlo * dvolsm(ikwneg+1)
+               zempty(ikwneg+1) = 1. - zfull(ikwneg+1)
+               DO jk = ikwneg+2, jpksed
+                  zfull (jk) = zfilled(jk) - zempty(jk-1) * dvolsm(jk)
+                  zempty(jk) = 1. - zfull(jk)
+               ENDDO
+               DO js = 1, jpsol
+                  solcp(ji,2,js) = zfull(2) * zsolcpno(2,js)+ zkwnlo * zsolcpno(3,js) &
+                     &                                      + zkwnup * zrainrf(ji,js)
+                  DO jk = 3, jpksedm1
+                     solcp(ji,jk,js) = zfull(jk) * zsolcpno(jk,js) + zempty(jk) * zsolcpno(jk+1,js)
+                  ENDDO
+                  solcp(ji,jpksed,js) = zfull(jpksed) * zsolcpno(jpksed,js)
+                  tosed(ji,js)   = 0.
+                  fromsed(ji,js) = 0.
+               ENDDO
+               solcp(ji,jpksed,jsclay) =  solcp(ji,jpksed,jsclay) + zempty(jpksed) * 1.
+               !! C. Heinze  fromsed(ji,jsclay) = zempty(jpksed) * 1. * dens * por1(jpksed) / mol_wgt(jsclay)
+               fromsed(ji,jsclay) = zempty(jpksed) * 1. * por1clay
+               
+            ELSE IF( ikwneg == jpksed ) THEN
+
+               zkwnup = ABS( zwb(ji,ikwneg-1) ) * dvolsm(ikwneg) / dz(ikwneg)
+               zkwnlo = ABS( zwb(ji,ikwneg) ) / dz(ikwneg)
+               zfull (ikwneg-1) = zfilled(ikwneg-1) - zkwnup * dvolsp(ikwneg-1)
+               zempty(ikwneg-1) = 1. - zfull(ikwneg-1)
+               DO jk = ikwneg-2, 2, -1
+                  zfull (jk) = zfilled(jk) - zempty(jk+1) * dvolsp(jk)
+                  zempty(jk) = 1. - zfull(jk) 
+               ENDDO
+               DO  js = 1, jpsol
+                  solcp(ji,2,js) = zfull(2) * zsolcpno(2,js) + zempty(2) * zrainrf(ji,js)
+               ENDDO
+               DO  js = 1, jpsol              
+                  DO jk = jpksedm1, 3, -1
+                     solcp(ji,jk,js) = zfull(jk) * zsolcpno(jk,js) + zempty(jk) * zsolcpno(jk-1,js)
+                  ENDDO
+                  solcp(ji,jpksed,js) = zfull(jpksed) * zsolcpno(jpksed,js) &
+                     &                       + zkwnup * zsolcpno(jpksedm1,js)
+                  tosed(ji,js)   = 0.
+                  fromsed(ji,js) = 0.
+               ENDDO
+               solcp(ji,jpksed,jsclay) = solcp(ji,jpksed,jsclay) + zkwnlo * 1.
+               ! Heinze  fromsed(ji,jsclay) = zkwnlo * 1. * dens * por1(jpksed) / mol_wgt(jsclay)
+               fromsed(ji,jsclay) = zkwnlo * 1.* por1clay
+            ELSE   ! 2 < ikwneg(ji) <= jpksedm1
+
+               zkwnup = ABS( zwb(ji,ikwneg-1) ) * por1(ikwneg-1) / ( dz(ikwneg) * por1(ikwneg) )
+               zkwnlo = ABS( zwb(ji,ikwneg) ) / dz(ikwneg)
+
+               IF( ikwneg > 3 ) THEN
+
+                  zfull (ikwneg-1) = zfilled(ikwneg-1) - zkwnup * dvolsp(ikwneg-1)
+                  zempty(ikwneg-1) = 1. - zfull(ikwneg-1) 
+                  DO jk = ikwneg-2, 2, -1
+                     zfull (jk) = zfilled(jk) - zempty(jk+1) * dvolsp(jk)
+                     zempty(jk)    = 1. - zfull(jk) 
+                  ENDDO
+                  DO js = 1, jpsol
+                     solcp(ji,2,js) = zfull(2) * zsolcpno(2,js) + zempty(2) * zrainrf(ji,js)
+                  ENDDO
+                  DO js = 1, jpsol
+                     DO jk = ikwneg-1, 3, -1
+                        solcp(ji,jk,js) = zfull(jk) * zsolcpno(jk,js) + zempty(jk) * zsolcpno(jk-1,js)
+                     ENDDO
+                  ENDDO
+               ELSE ! ikw = 3
+
+
+                  zfull (2) = zfilled(2) - zkwnup * dvolsm(3)
+                  zempty(2) = 1. - zfull(2)
+                  DO js = 1, jpsol
+                     solcp(ji,2,js) = zfull(2) * zsolcpno(2,js) + zempty(2) * zrainrf(ji,js)
+                  ENDDO
+               ENDIF
+
+               IF( ikwneg < jpksedm1) THEN
+
+                  zfull (ikwneg+1) = zfilled(ikwneg+1) - zkwnlo * dvolsm(ikwneg+1)
+                  zempty(ikwneg+1) = 1. - zfull(ikwneg+1) 
+                  DO jk = ikwneg+2, jpksed
+                     zfull (jk) = zfilled(jk) - zempty(jk-1) * dvolsm(jk)
+                     zempty(jk) = 1. - zfull(jk)
+                  ENDDO
+                  DO js = 1, jpsol
+                     DO jk = ikwneg+1, jpksedm1
+                        solcp(ji,jk,js) = zfull(jk) * zsolcpno(jk,js) + zempty(jk) * zsolcpno(jk+1,js) 
+                     ENDDO
+                     solcp(ji,jpksed,js) = zfull(jpksed) * zsolcpno(jpksed,js)
+                  ENDDO
+                  solcp(ji,jpksed,jsclay) = solcp(ji,jpksed,jsclay) + zempty(jpksed) * 1.
+               ELSE
+
+                  zfull (jpksed) = zfilled(jpksed) - zkwnlo * dvolsm(jpksed)
+                  zempty(jpksed) = 1. - zfull(jpksed)                
+                  DO js = 1, jpsol
+                     solcp(ji,jpksed,js) = zfull(jpksed) * zsolcpno(jpksed,js)
+                  ENDDO
+                  solcp(ji,jpksed,jsclay) = solcp(ji,jpksed,jsclay) + zempty(jpksed) * 1.
+               ENDIF ! jpksedm1
+               
+               ! ikwneg = jpksedm1  ; ikwneg+1 = jpksed ; ikwneg-1 = jpksed - 2
+               DO js = 1, jpsol
+                  solcp(ji,ikwneg,js) =  zfull(ikwneg) * zsolcpno(ikwneg  ,js) &
+                     &                +  zkwnup        * zsolcpno(ikwneg-1,js) &
+                     &                +  zkwnlo        * zsolcpno(ikwneg+1,js)   
+                  tosed  (ji,js)   = 0.
+                  fromsed(ji,js)   = 0.
+               ENDDO
+               ! Heinze  fromsed(ji,jsclay) = zempty * 1. * dens * por1(jpksed) / mol_wgt(jsclay)
+               fromsed(ji,jsclay) = zempty(jpksed) * 1. * por1clay
+            ENDIF ! ikwneg(ji) = 2
+         ENDIF  ! zwb > 0
+      ENDDO  ! ji = 1, jpoce
+
+      rainrm(:,:) = 0.
+      rainrg(:,:) = 0.
+      raintg(:)   = 0.
+
+      DEALLOCATE( zsolcpno )   
+      DEALLOCATE( zrainrf  )
+      DEALLOCATE( zfilled  )
+      DEALLOCATE( zfull    )
+      DEALLOCATE( zfromup  )
+      DEALLOCATE( zempty   )
+      DEALLOCATE( zgap     )  
+      DEALLOCATE( zwb      )
+
+
+   END SUBROUTINE sed_adv
+#else
+   !!======================================================================
+   !! MODULE sedbtb  :   Dummy module 
+   !!======================================================================
+CONTAINS
+   SUBROUTINE sed_adv( kt )         ! Empty routine
+      INTEGER, INTENT(in) :: kt
+      WRITE(*,*) 'sed_adv: You should not have seen this print! error?', kt
+   END SUBROUTINE sed_adv
+
+   !!======================================================================
+
+#endif
+END MODULE sedadv
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedarr.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedarr.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedarr.F90	(revision 3680)
@@ -0,0 +1,129 @@
+MODULE sedarr
+   !!======================================================================
+   !!                       ***  MODULE sedarr   ***
+   !!              transform 1D (2D) array to a 2D (1D) table
+   !!======================================================================
+#if defined key_sed
+   !!----------------------------------------------------------------------
+   !!   arr_2d_1d  : 2-D to 1-D
+   !!   arr_1d_2d  : 1-D to 2-D
+   !!----------------------------------------------------------------------
+   !! * Modules used
+   USE par_sed
+
+   IMPLICIT NONE
+   PRIVATE
+
+   INTERFACE pack_arr
+      MODULE PROCEDURE pack_arr_2d_1d , pack_arr_3d_2d 
+   END INTERFACE
+
+   INTERFACE unpack_arr
+      MODULE PROCEDURE unpack_arr_1d_2d , unpack_arr_2d_3d 
+   END INTERFACE
+
+   !! * Routine accessibility
+   PUBLIC pack_arr
+   PUBLIC unpack_arr
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limtab.F90,v 1.2 2005/03/27 18:34:42 opalod Exp $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE pack_arr_2d_1d ( ndim1d, tab1d, tab2d, tab_ind )
+
+      INTEGER, INTENT(in) ::  ndim1d
+      REAL(wp), DIMENSION (jpi, jpj), INTENT(in) :: tab2d
+      INTEGER, DIMENSION (ndim1d), INTENT (in) :: tab_ind
+      REAL(wp), DIMENSION(ndim1d), INTENT (out) ::  tab1d
+
+      INTEGER ::  jn, jid, jjd
+        
+      DO jn = 1, ndim1d
+         jid        = MOD( tab_ind(jn) - 1, jpi ) + 1
+         jjd        = ( tab_ind(jn) - 1 ) / jpi + 1
+         tab1d(jn)  = tab2d(jid, jjd)
+      END DO 
+
+   END SUBROUTINE pack_arr_2d_1d
+
+   SUBROUTINE unpack_arr_1d_2d ( ndim1d, tab2d, tab_ind, tab1d )
+
+      INTEGER, INTENT ( in) ::  ndim1d
+      INTEGER, DIMENSION (ndim1d) , INTENT (in) ::   tab_ind
+      REAL(wp), DIMENSION(ndim1d), INTENT (in) ::   tab1d  
+      REAL(wp), DIMENSION (jpi, jpj), INTENT ( out) ::  tab2d
+      INTEGER ::  jn, jid, jjd
+
+      DO jn = 1, ndim1d
+         jid             = MOD( tab_ind(jn) - 1, jpi) + 1
+         jjd             =    ( tab_ind(jn) - 1 ) / jpi  + 1
+         tab2d(jid, jjd) = tab1d(jn)
+      END DO
+
+   END SUBROUTINE unpack_arr_1d_2d
+
+   SUBROUTINE pack_arr_3d_2d ( ndim1d, tab2d, tab3d, tab_ind )
+
+      INTEGER, INTENT(in) :: ndim1d      
+      REAL(wp), DIMENSION(jpi,jpj,jpksed), INTENT(in) ::   tab3d      
+      INTEGER, DIMENSION(ndim1d), INTENT (in) ::   tab_ind      
+      REAL(wp), DIMENSION(ndim1d,jpksed), INTENT (out) ::    tab2d 
+      INTEGER, DIMENSION(ndim1d) ::  jid, jjd        
+      INTEGER ::    jk, jn , ji, jj
+      
+      DO jn = 1, ndim1d
+         jid(jn) = MOD( tab_ind(jn) - 1, jpi ) + 1
+         jjd(jn) = ( tab_ind(jn) - 1 ) / jpi + 1
+      END DO
+ 
+      DO jk = 1, jpksed
+         DO jn = 1, ndim1d
+            ji = jid(jn)
+            jj = jjd(jn)
+            tab2d(jn,jk)  = tab3d(ji,jj,jk) 
+         ENDDO
+      ENDDO
+      
+   END SUBROUTINE pack_arr_3d_2d
+
+
+   SUBROUTINE unpack_arr_2d_3d ( ndim1d, tab3d, tab_ind, tab2d )
+
+      INTEGER, INTENT(in) :: ndim1d      
+      REAL(wp), DIMENSION(ndim1d,jpksed), INTENT(in) ::   tab2d      
+      INTEGER, DIMENSION(ndim1d), INTENT (in) ::   tab_ind      
+      REAL(wp), DIMENSION(jpi,jpj,jpksed), INTENT (out) ::    tab3d 
+      INTEGER, DIMENSION(ndim1d) ::  jid, jjd        
+      INTEGER ::   jk, jn , ji, jj
+
+     DO jn = 1, ndim1d
+         jid(jn) = MOD( tab_ind(jn) - 1, jpi ) + 1
+         jjd(jn) = ( tab_ind(jn) - 1 ) / jpi + 1
+      END DO
+ 
+      DO jk = 1, jpksed
+         DO jn = 1, ndim1d
+            ji = jid(jn)
+            jj = jjd(jn)
+            tab3d(ji, jj, jk) = tab2d(jn,jk)
+         ENDDO
+      ENDDO
+
+   END SUBROUTINE unpack_arr_2d_3d
+
+#else
+   !!======================================================================
+   !! MODULE sedarr  :   Dummy module
+   !!======================================================================
+CONTAINS
+   SUBROUTINE pack_arr         ! Empty routine
+   END SUBROUTINE  pack_arr
+   SUBROUTINE unpack_arr         ! Empty routine
+   END SUBROUTINE  unpack_arr
+   !!======================================================================
+#endif
+END MODULE sedarr
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedbtb.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedbtb.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedbtb.F90	(revision 3680)
@@ -0,0 +1,88 @@
+MODULE sedbtb
+#if defined key_sed
+   !!======================================================================
+   !!              ***  MODULE  sedbtb  ***
+   !!    Sediment : bioturbation of the solid components
+   !!=====================================================================
+   !! * Modules used
+   USE sed     ! sediment global variable
+   USE sedmat  ! linear system of equations
+
+   PUBLIC sed_btb
+
+
+CONTAINS
+   
+   SUBROUTINE sed_btb( kt )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE sed_btb  ***
+      !!
+      !! ** Purpose :  performs bioturbation of the solid sediment components
+      !!
+      !! ** Method  :  ``diffusion'' of solid sediment components. 
+      !!
+      !!   History :
+      !!        !  98-08 (E. Maier-Reimer, Christoph Heinze )  Original code
+      !!        !  04-10 (N. Emprin, M. Gehlen ) F90
+      !!        !  06-04 (C. Ethe)  Re-organization
+      !!----------------------------------------------------------------------
+      !!* Arguments
+      INTEGER, INTENT(in) ::  kt              ! time step
+
+      ! * local variables
+      INTEGER :: ji, jk, js
+      REAL(wp), DIMENSION(:,:,:) , ALLOCATABLE ::  zsol  !   solution
+      !------------------------------------------------------------------------
+
+      IF( kt == nitsed000 ) THEN
+         WRITE(numsed,*) ' sed_btb : Bioturbation  '
+         WRITE(numsed,*) ' '
+      ENDIF
+
+      ! Initializations
+      !----------------
+      ALLOCATE( zsol(jpoce,jpksedm1,jpsol) )
+
+      zsol(:,:,:) = 0.
+
+
+      ! right hand side of coefficient matrix
+      !--------------------------------------
+      DO js = 1, jpsol
+         DO jk = 1, jpksedm1
+            DO ji = 1, jpoce
+               zsol(ji,jk,js) = solcp(ji,jk+1,js)
+            ENDDO
+         ENDDO
+      ENDDO
+
+      CALL sed_mat( jpsol, jpoce, jpksedm1, zsol )
+
+
+      ! store solution of the tridiagonal system
+      !------------------------
+      DO js = 1, jpsol
+         DO jk = 1, jpksedm1
+            DO ji = 1, jpoce
+               solcp(ji,jk+1,js) = zsol(ji,jk,js)
+            ENDDO
+         ENDDO
+      ENDDO
+     
+      DEALLOCATE( zsol )
+
+   END SUBROUTINE sed_btb
+#else
+   !!======================================================================
+   !! MODULE sedbtb  :   Dummy module 
+   !!======================================================================
+CONTAINS
+   SUBROUTINE sed_btb( kt )         ! Empty routine
+      INTEGER, INTENT(in) :: kt
+      WRITE(*,*) 'sed_btb: You should not have seen this print! error?', kt
+   END SUBROUTINE sed_btb
+
+   !!======================================================================
+
+#endif
+END MODULE sedbtb
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedchem.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedchem.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedchem.F90	(revision 3680)
@@ -0,0 +1,571 @@
+MODULE sedchem
+
+#if defined key_sed 
+   !!======================================================================
+   !!                        ***  Module sedchem  ***
+   !! sediment :   Variable for chemistry of the CO2 cycle
+   !!======================================================================
+   !!   modules used
+   USE sed     ! sediment global variable
+   USE sedarr
+
+   !! * Accessibility
+   PUBLIC sed_chem   
+
+   !! * Module variables
+   REAL(wp) :: &
+      salchl = 1./1.80655 , & ! conversion factor for salinity --> chlorinity (Wooster et al. 1969)
+      calcon = 1.03E-2        ! mean calcite concentration [Ca2+] in sea water [mole/kg solution] 
+
+   REAL(wp) :: &              ! coeff. for 1. dissoc. of carbonic acid (Millero, 1995)   
+      c10 = 3670.7   , &
+      c11 = 62.008   , &
+      c12 = 9.7944   , &
+      c13 = 0.0118   , &
+      c14 = 0.000116
+
+   REAL(wp) :: &              ! coeff. for 2. dissoc. of carbonic acid (Millero, 1995)   
+      c20 = 1394.7   , &
+      c21 = 4.777    , &
+      c22 = 0.       , &
+      c23 = 0.0184   , &
+      c24 = 0.000118
+
+   REAL(wp) :: &              ! coeff. for 1. dissoc. of boric acid (Dickson and Goyet, 1994)
+      cb0  = -8966.90, &
+      cb1  = -2890.53, &
+      cb2  = -77.942 , &
+      cb3  = 1.728   , &
+      cb4  = -0.0996 , &
+      cb5  = 148.0248, &
+      cb6  = 137.1942, &
+      cb7  = 1.62142 , &
+      cb8  = -24.4344, &
+      cb9  = -25.085 , &
+      cb10 = -0.2474 , &
+      cb11 = 0.053105
+
+   REAL(wp) :: &             ! borat constants
+      bor1 = 0.000232, &
+      bor2 = 1./10.811
+
+   REAL(wp) :: &             ! constants for calculate concentrations 
+      st1  = 0.14     , &    ! for sulfate (Morris & Riley 1966)
+      st2  = 1./96.062, &
+      ks0  = 141.328  , &
+      ks1  = -4276.1  , &
+      ks2  = -23.093  , &
+      ks3  = -13856.  , &
+      ks4  = 324.57   , &
+      ks5  = -47.986  , &
+      ks6  = 35474.   , &
+      ks7  = -771.54  , &
+      ks8  = 114.723  , &
+      ks9  = -2698.   , &
+      ks10 = 1776.    , &
+      ks11 = 1.       , &
+      ks12 = -0.001005 
+
+   REAL(wp) :: &             ! constants for calculate concentrations 
+      ft1  = 0.000067   , &  ! fluorides (Dickson & Riley 1979 )
+      ft2  = 1./18.9984 , &
+      kf0  = -12.641    , &
+      kf1  = 1590.2     , &
+      kf2  = 1.525      , &
+      kf3  = 1.0        , &
+      kf4  =-0.001005
+
+   REAL(wp) :: &             ! coeff. for dissoc. of water (Dickson and Riley, 1979 )
+      cw0 = -13847.26  , &
+      cw1 = 148.9802   , &
+      cw2 = -23.6521   , &
+      cw3 = 118.67     , &
+      cw4 = -5.977     , &
+      cw5 = 1.0495     , &
+      cw6 = -0.01615
+ 
+   REAL(wp) :: &             ! coeff. for dissoc. of phosphate (Millero (1974)
+      cp10 = 115.54    , &
+      cp11 = -4576.752 , &
+      cp12 = -18.453   , &
+      cp13 = -106.736  , &
+      cp14 = 0.69171   , &
+      cp15 = -0.65643  , &
+      cp16 = -0.01844  , &
+      cp20 = 172.1033  , &
+      cp21 = -8814.715 , &
+      cp22 = -27.927   , &
+      cp23 = -160.340  , &
+      cp24 = 1.3566    , &
+      cp25 = 0.37335   , &
+      cp26 = -0.05778  , &
+      cp30 = -18.126   , &
+      cp31 = -3070.75  , &
+      cp32 = 17.27039  , &
+      cp33 = 2.81197   , &
+      cp34 = -44.99486 , &
+      cp35 = -0.09984
+
+   REAL(wp) :: &             ! coeff. for dissoc. of silicates (Millero (1974)  
+      cs10 = 117.40    , &  
+      cs11 = -8904.2   , & 
+      cs12 = -19.334   , & 
+      cs13 = -458.79   , & 
+      cs14 = 3.5913    , & 
+      cs15 = 188.74    , & 
+      cs16 = -1.5998   , & 
+      cs17 = -12.1652  , & 
+      cs18 = 0.07871   , & 
+      cs19 = 0.        , & 
+      cs20 = 1.        , & 
+      cs21 = -0.001005
+
+   REAL(wp) :: &            ! coeff. for apparent solubility equilibrium 
+      ! akcc1 = -34.452 , & ! of calcite (Ingle,1975,  1800, eq. 6)
+      ! akcc2 = -39.866 , &  
+      ! akcc3 = 110.21  , &  
+      ! akcc4 = -7.5752E-6  
+      akcc1 = -171.9065 , &    ! Millero et al. 1995 from Mucci 1983
+      akcc2 = -0.077993 , &  
+      akcc3 = 2839.319  , &  
+      akcc4 = 71.595    , &  
+      akcc5 = -0.77712  , &  
+      akcc6 = 0.0028426 , &  
+      akcc7 = 178.34    , &  
+      akcc8 = -0.07711  , &  
+      akcc9 = 0.0041249
+
+   REAL(wp) :: &                 ! universal gas constant
+      rgas = 83.145              ! bar.cm3/(mol.K) or R=8.31451 J/(g.mol.K)
+
+
+   ! coeff. for seawater pressure correction (millero 95)		
+   REAL(wp), DIMENSION(8)  :: & 
+      devk1, devk2, devk3, devk4, devk5
+
+   DATA devk1/ -25.5   , -15.82    , -29.48  , -25.60    , -48.76    , -14.51   , -23.12   , -26.57   /   
+   DATA devk2/ 0.1271  , -0.0219   , 0.1622  , 0.2324    , -0.5304   , 0.1211   ,  0.1758  , 0.2020   /   
+   DATA devk3/ 0.      , 0.        , 2.608E-3, -3.6246E-3, 0.        , -0.321E-3, -2.647E-3, -3.042E-3/   
+   DATA devk4/-3.08E-3 , 1.13E-3   , -2.84E-3, -5.13E-3  , -11.76E-3 , -2.67E-3 , -5.15E-3 , -4.08E-3 /   
+   DATA devk5/0.0877E-3, -0.1475E-3, 0.      , 0.0794E-3 , -0.3692E-3, 0.0427E-3,  0.09E-3 , 0.0714E-3/
+
+
+   ! coeff. for density of sea water (Millero & Poisson 1981) 
+   REAL(wp), DIMENSION(5)  :: Adsw                       
+   DATA Adsw/8.24493E-1, -4.0899E-3, 7.6438E-5 , -8.246E-7, 5.3875E-9 /
+
+   REAL(wp), DIMENSION(3)  :: Bdsw 
+   DATA Bdsw / -5.72466E-3, 1.0227E-4, -1.6546E-6 /
+
+   REAL(wp)  :: Cdsw = 4.8314E-4
+
+   REAL(wp), DIMENSION(6)  :: Ddsw                    
+   DATA Ddsw / 999.842594 , 6.793952E-2 , -9.095290E-3, 1.001685E-4, -1.120083E-6, 6.536332E-9/
+
+CONTAINS
+
+   SUBROUTINE sed_chem( kt )
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE sed_chem  ***
+      !!
+      !! ** Purpose :   set chemical constants
+      !!
+      !!   History :
+      !!        !  04-10  (N. Emprin, M. Gehlen )  Original code
+      !!        !  06-04  (C. Ethe)  Re-organization
+      !!----------------------------------------------------------------------
+      !!* Arguments
+      INTEGER, INTENT(in) :: kt                     ! time step
+
+#if ! defined key_sed_off
+      INTEGER  :: ji, jj, ikt
+      REAL(wp) :: ztkel, ztc, ztc2, zpres, ztr 
+      REAL(wp) :: zsal, zsal2, zsqrt, zsal15  
+      REAL(wp) :: zis, zis2, zisqrt          
+      REAL(wp) :: zdens0, zaw, zbw, zcw    
+      REAL(wp) :: zbuf1, zbuf2 
+      REAL(wp) :: zcpexp, zcpexp2
+      REAL(wp) :: zck1p, zck2p, zck3p, zcksi   
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   zchem_data
+
+#endif
+      !!----------------------------------------------------------------------
+
+      IF( MOD( kt - 1, nfreq ) /= 0 ) RETURN
+
+      WRITE(numsed,*) ' Getting Chemical constants from tracer model at time kt = ', kt
+      WRITE(numsed,*) ' '
+
+
+#if defined key_sed_off
+      CALL sed_chem_off
+#else
+      ! reading variables
+      ALLOCATE( zchem_data(jpi,jpj,6) )   ;   zchem_data(:,:,:) = 0.
+
+      DO jj = 1,jpj
+         DO ji = 1, jpi
+            ikt = mbkt(ji,jj) 
+            IF ( tmask(ji,jj,ikt) == 1 ) THEN
+               zchem_data(ji,jj,1) = ak13 (ji,jj,ikt)
+               zchem_data(ji,jj,2) = ak23 (ji,jj,ikt)
+               zchem_data(ji,jj,3) = akb3 (ji,jj,ikt)
+               zchem_data(ji,jj,4) = akw3 (ji,jj,ikt)
+               zchem_data(ji,jj,5) = aksp (ji,jj,ikt)
+               zchem_data(ji,jj,6) = borat(ji,jj,ikt)
+            ENDIF
+         ENDDO
+      ENDDO
+
+      CALL pack_arr ( jpoce, ak1s  (1:jpoce), zchem_data(1:jpi,1:jpj,1), iarroce(1:jpoce) )
+      CALL pack_arr ( jpoce, ak2s  (1:jpoce), zchem_data(1:jpi,1:jpj,2), iarroce(1:jpoce) )
+      CALL pack_arr ( jpoce, akbs  (1:jpoce), zchem_data(1:jpi,1:jpj,3), iarroce(1:jpoce) )
+      CALL pack_arr ( jpoce, akws  (1:jpoce), zchem_data(1:jpi,1:jpj,4), iarroce(1:jpoce) )
+      CALL pack_arr ( jpoce, aksps (1:jpoce), zchem_data(1:jpi,1:jpj,5), iarroce(1:jpoce) )
+      CALL pack_arr ( jpoce, borats(1:jpoce), zchem_data(1:jpi,1:jpj,6), iarroce(1:jpoce) )
+
+      DEALLOCATE( zchem_data )
+
+      DO ji = 1, jpoce
+         ztkel   = temp(ji) + 273.16
+         ztc     = temp(ji)
+         ztc2    = ztc * ztc
+         zpres   = press(ji)
+         ! zqtt    = ztkel * 0.01
+         zsal    = salt(ji)
+         zsal2   = zsal * zsal 
+         zsqrt   = SQRT( zsal )
+         zsal15  = zsqrt * zsal
+         zlogt   = LOG( ztkel )
+         ztr     = 1./ ztkel
+         ! zis=ionic strength (ORNL/CDIAC-74, DOE 94,Dickson and Goyet)
+         zis     = 19.924 * zsal / ( 1000. - 1.005 * zsal )
+         zis2    = zis * zis
+         zisqrt  = SQRT( zis )
+
+         ! Density of Sea Water - F(temp,sal) [kg/m3]
+         zdens0 =  Ddsw(1) + Ddsw(2) * ztc + Ddsw(3) * ztc2 &
+                  + Ddsw(4) * ztc * ztc2 + Ddsw(5) * ztc2 * ztc2 &
+                  + Ddsw(6) * ztc * ztc2 * ztc2
+         zaw =  Adsw(1) + Adsw(2) * ztc + Adsw(3)* ztc2 + Adsw(4) * ztc * ztc2 &
+              + Adsw(5) * ztc2 * ztc2
+         zbw =  Bdsw(1) + Bdsw(2) * ztc + Bdsw(3) * ztc2
+         zcw =  Cdsw
+         densSW(ji) = zdens0 + zaw * zsal + zbw * zsal15 + zcw * zsal * zsal
+         densSW(ji) = densSW(ji) * 1E-3   ! to get dens in [kg/l]
+
+         ! FORMULA FOR CPEXP AFTER EDMOND AND GIESKES (1970) 
+         ! (REFERENCE TO CULBERSON AND PYTKOQICZ (1968) AS MADE IN BROECKER ET AL. (1982) 
+         ! IS INCORRECT; HERE RGAS IS TAKEN TENFOLD TO CORRECT FOR THE NOTATION OF pres  IN
+         ! DBAR INSTEAD OF BAR AND THE EXPRESSION FOR CPEXP IS MULTIPLIED BY LN(10.) 
+         ! TO ALLOW USE OF EXP-FUNCTION WITH BASIS E IN THE FORMULA FOR AKSPP 
+         ! (CF. EDMOND AND GIESKES (1970), P. 1285 AND P. 1286 (THE SMALL FORMULA ON P. 1286 
+         ! IS RIGHT AND CONSISTENT WITH THE SIGN IN PARTIAL MOLAR VOLUME CHANGE AS SHOWN ON P. 1285)
+         !-----------------------------------------------------------------------------------------
+         zcpexp  = zpres / ( rgas*ztkel )
+         zcpexp2 = zpres * zcpexp
+
+         ! For Phodphates (phosphoric acid) (DOE 1994)
+         !----------------------------------------------
+         zck1p = cp10 + cp11*ztr + cp12*zlogt + ( cp13*ztr + cp14 ) * zsqrt &
+            &      + ( cp15*ztr + cp16 ) * zsal
+         zck2p = cp20 + cp21*ztr + cp22*zlogt + ( cp23*ztr + cp24 ) * zsqrt &
+            &      + ( cp25*ztr + cp26 ) * zsal
+         zck3p = cp30 + cp31*ztr + ( cp32*ztr + cp33 ) *  zsqrt &
+            &      + ( cp34*ztr + cp35 ) * zsal
+
+         ! For silicates (DOE 1994) change to mol/kg soln) (OCMIP)
+         !--------------------------------------------------------
+         zcksi = cs10 + cs11*ztr + cs12*zlogt + ( cs13*ztr + cs14) * zisqrt &
+            &      + ( cs15*ztr + cs16 ) * zis &
+            &      + ( cs17*ztr + cs18 ) * zis2 &
+            &      + LOG( 1. + cs19*zsal ) + LOG( cs20 + cs21*zsal )
+
+
+         !K1, K2 of carbonic acid, KB of boric acid, KW (H2O)
+         !---------------------------------------------------
+         zak1p  = EXP ( zck1p  )
+         zak2p  = EXP ( zck2p  )
+         zak3p  = EXP ( zck3p  )
+         zaksil = EXP ( zcksi  )
+
+         zbuf1       = - ( devk1(3) + devk2(3)*ztc + devk3(3)*ztc2 )
+         zbuf2       = 0.5 * ( devk4(3) + devk5(3)*ztc )
+         aksis(ji)     = zaksil * EXP( zbuf1*zcpexp + zbuf2*zcpexp2 )
+
+         zbuf1       = - ( devk1(6) + devk2(6)*ztc + devk3(6)*ztc2 )
+         zbuf2       = 0.5 * ( devk4(6) + devk5(6)*ztc )
+         ak1ps(ji)   = zak1p * EXP( zbuf1*zcpexp + zbuf2*zcpexp2 )
+ 
+         zbuf1       = - ( devk1(7) + devk2(7)*ztc + devk3(7)*ztc2 )
+         zbuf2       = 0.5 * ( devk4(7) + devk5(7)*ztc )
+         ak2ps(ji)   = zak2p * EXP( zbuf1*zcpexp + zbuf2*zcpexp2 )
+
+         zbuf1       = - ( devk1(8) + devk2(8)*ztc + devk3(8)*ztc2 )
+         zbuf2       = 0.5 * ( devk4(8) + devk5(8)*ztc )
+         ak3ps(ji)   = zak3p * EXP( zbuf1*zcpexp + zbuf2*zcpexp2 )
+
+         ak12s  (ji) = ak1s (ji) * ak2s (ji)
+         ak12ps (ji) = ak1ps(ji) * ak2ps(ji)
+         ak123ps(ji) = ak1ps(ji) * ak2ps(ji) * ak3ps(ji)
+
+         calcon2(ji) = 0.01028 * ( salt(ji) / 35. ) * densSW(ji)
+      ENDDO
+
+       
+#endif
+
+   END SUBROUTINE sed_chem
+
+#if defined key_sed_off
+
+   SUBROUTINE sed_chem_off
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE sed_chem_off  ***
+      !!                    
+      !! ** Purpose :   compute chemical constants
+      !!
+      !!   History :
+      !!        !  04-10  (N. Emprin, M. Gehlen )  Original code
+      !!        !  06-04  (C. Ethe)  Re-organization 
+      !!----------------------------------------------------------------------  
+      !! * Local declarations
+      INTEGER :: ji
+
+      REAL(wp) ::  ztkel, ztc, ztc2, zpres, ztr 
+      REAL(wp) ::  zsal, zsal2, zsqrt, zsal15   
+      REAL(wp) ::  zis, zis2, zisqrt            
+      REAL(wp) ::  zdens0, zaw, zbw, zcw        
+      REAL(wp) ::  zchl, zst, zft, zbuf1, zbuf2 
+      REAL(wp) ::  zcpexp, zcpexp2              
+      REAL(wp) ::  zckb, zck1, zck2, zckw       
+      REAL(wp) ::  zck1p, zck2p, zck3p, zcksi   
+      REAL(wp) ::  zak1, zak2, zakb, zakw              
+      REAL(wp) ::  zaksp0, zksp, zks, zkf 
+
+
+      ! CHEMICAL CONSTANTS - DEEP OCEAN
+      !-------------------------------------
+      ! [chem constants]=mol/kg solution (or (mol/kg sol)2 for akws and aksp)
+
+      DO ji = 1, jpoce
+         ztkel   = temp(ji) + 273.16
+         ztc     = temp(ji)
+         ztc2    = ztc * ztc
+         zpres   = press(ji)
+         ! zqtt    = ztkel * 0.01
+         zsal    = salt(ji)
+         zsal2   = zsal * zsal 
+         zsqrt   = SQRT( zsal )
+         zsal15  = zsqrt * zsal
+         zlogt   = LOG( ztkel )
+         ztr     = 1./ ztkel
+         ! zis=ionic strength (ORNL/CDIAC-74, DOE 94,Dickson and Goyet)
+         zis     = 19.924 * zsal / ( 1000. - 1.005 * zsal )
+         zis2    = zis * zis
+         zisqrt  = SQRT( zis )
+
+
+         ! Density of Sea Water - F(temp,sal) [kg/m3]
+         zdens0 =  Ddsw(1) + Ddsw(2) * ztc + Ddsw(3) * ztc2 &
+                  + Ddsw(4) * ztc * ztc2 + Ddsw(5) * ztc2 * ztc2 &
+                  + Ddsw(6) * ztc * ztc2 * ztc2
+         zaw =  Adsw(1) + Adsw(2) * ztc + Adsw(3)* ztc2 + Adsw(4) * ztc * ztc2 &
+              + Adsw(5) * ztc2 * ztc2
+         zbw =  Bdsw(1) + Bdsw(2) * ztc + Bdsw(3) * ztc2
+         zcw =  Cdsw
+         densSW(ji) = zdens0 + zaw * zsal + zbw * zsal15 + zcw * zsal * zsal
+         densSW(ji) = densSW(ji) * 1E-3   ! to get dens in [kg/l]
+
+
+         ! FORMULA FOR CPEXP AFTER EDMOND AND GIESKES (1970) 
+         ! (REFERENCE TO CULBERSON AND PYTKOQICZ (1968) AS MADE IN BROECKER ET AL. (1982) 
+         ! IS INCORRECT; HERE RGAS IS TAKEN TENFOLD TO CORRECT FOR THE NOTATION OF pres  IN
+         ! DBAR INSTEAD OF BAR AND THE EXPRESSION FOR CPEXP IS MULTIPLIED BY LN(10.) 
+         ! TO ALLOW USE OF EXP-FUNCTION WITH BASIS E IN THE FORMULA FOR AKSPP 
+         ! (CF. EDMOND AND GIESKES (1970), P. 1285 AND P. 1286 (THE SMALL FORMULA ON P. 1286 
+         ! IS RIGHT AND CONSISTENT WITH THE SIGN IN PARTIAL MOLAR VOLUME CHANGE AS SHOWN ON P. 1285)
+         !-----------------------------------------------------------------------------------------
+         zcpexp  = zpres / ( rgas*ztkel )
+         zcpexp2 = zpres * zcpexp
+
+
+         ! chlorinity (WOOSTER ET AL., 1969)
+         !---------------------------------------
+         zchl = zsal * salchl
+
+         ! total sulfate concentration [mol/kg soln]
+         ! --------------------------------------
+         zst = st1 * zchl * st2
+
+         ! total fluoride concentration [mol/kg soln]
+         ! --------------------------------------
+         zft = ft1 * zchl * ft2
+
+         ! dissociation constant for carbonate (Mehrback 74 - Dickson & Millero 87)
+         !---------------------------------------------------------------------------
+         zck1 = c10*ztr - c11 + c12*zlogt - c13*zsal + c14*zsal2
+         zck2 = c20*ztr + c21 - c22*zlogt - c23*zsal + c24*zsal2
+
+         ! dissociation constant for sulfates (Dickson 1990)
+         !--------------------------------------------------
+         zks = EXP(  ks0 + ks1*ztr + ks2*zlogt &
+            &    + ( ks3*ztr + ks4 + ks5*zlogt ) * zisqrt &
+            &    + ( ks6*ztr + ks7 + ks8*zlogt ) * zis    &
+            &    +   ks9*ztr*zis*zisqrt + ks10*ztr*zis2   &
+            &    +   LOG( ks11 + ks12*zsal ) )
+
+         ! dissociation constant for fluorides (Dickson and Riley 79)
+         !--------------------------------------------------
+         zkf = EXP( kf0 + kf1*ztr + kf2*zisqrt + LOG( kf3 + kf4*zsal ) )
+
+         ! dissociation constant for borates (Doe 94)
+         !--------------------------------------------------
+         zckb = (  cb0 + cb1*zsqrt + cb2*zsal + cb3*zsal15 + cb4*zsal2) * ztr &
+            &  + ( cb5 + cb6*zsqrt + cb7*zsal) &
+            &  + ( cb8 + cb9*zsqrt + cb10*zsal) * zlogt &
+            &  +   cb11*zsqrt*ztkel + LOG( ( 1. + zst/zks + zft/zkf ) / ( 1. + zst/zks ) ) 
+
+         ! PKW (H2O) (DICKSON AND RILEY, 1979)
+         !--------------------------------------
+         zckw =   cw0*ztr + cw1 + cw2*zlogt &
+            & +( cw3*ztr + cw4 + cw5*zlogt )* zsqrt + cw6*zsal
+         
+         ! For Phodphates (phosphoric acid) (DOE 1994)
+         !----------------------------------------------
+         zck1p = cp10 + cp11*ztr + cp12*zlogt + ( cp13*ztr + cp14 ) * zsqrt &
+            &      + ( cp15*ztr + cp16 ) * zsal
+         zck2p = cp20 + cp21*ztr + cp22*zlogt + ( cp23*ztr + cp24 ) * zsqrt &
+            &      + ( cp25*ztr + cp26 ) * zsal
+         zck3p = cp30 + cp31*ztr + ( cp32*ztr + cp33 ) *  zsqrt &
+            &      + ( cp34*ztr + cp35 ) * zsal
+
+         ! For silicates (DOE 1994) change to mol/kg soln) (OCMIP)
+         !--------------------------------------------------------
+         zcksi = cs10 + cs11*ztr + cs12*zlogt + ( cs13*ztr + cs14) * zisqrt &
+            &      + ( cs15*ztr + cs16 ) * zis &
+            &      + ( cs17*ztr + cs18 ) * zis2 &
+            &      + LOG( 1. + cs19*zsal ) + LOG( cs20 + cs21*zsal )
+
+         ! apparent solublity product K'SP of calcite in seawater
+         ! (S=27-43, T=2-25 DEG C) AT pres =0 (INGLE, 1975, EQ. 6)
+         ! prob: olivier a log = ln et C. Heize a LOG10(sal)
+         ! aksp0 = 1.E-7*(akcc1+akcc2*sal**(1./3.)+akcc3*log(sal)+akcc4*tkel*tkel)
+         ! aksp0 = 1.E-7*(akcc1+akcc2*sal**(1./3.)+akcc3*log10(sal)+akcc4*tkel*tkel)
+         !--------------------------------------------------------------------
+         zaksp0 = akcc1 + akcc2*ztkel + akcc3*ztr + akcc4 * LOG10(ztkel) &
+            &  + ( akcc5 + akcc6*ztkel+ akcc7*ztr ) * zsqrt &
+            &  +  akcc8*zsal + akcc9*zsal15
+
+         !K1, K2 of carbonic acid, KB of boric acid, KW (H2O)
+         !---------------------------------------------------
+         zak1   = 10**( -zck1  )
+         zak2   = 10**( -zck2  )
+         zakb   = EXP ( zckb   ) 
+         zakw   = EXP ( zckw   )
+         zksp   = 10**( zaksp0 )
+
+
+
+         ! KB of boric acid, K1,K2 of carbonic acid pressure correction 
+         ! after Culberson and  AND Pytkowicz (1968) (CF. BROECKER ET AL., 1982) Millero 95
+         !--------------------------------------------------------------------------------
+         zbuf1       = - ( devk1(1) + devk2(1)*ztc + devk3(1)*ztc2 )
+         zbuf2       = 0.5 * ( devk4(1) + devk5(1)*ztc )
+         ak1s(ji)    = zak1 * EXP( zbuf1*zcpexp + zbuf2*zcpexp2 )
+
+         zbuf1       = -( devk1(2) + devk2(2)*ztc + devk3(2)*ztc2 )
+         zbuf2       = 0.5 * ( devk4(2) + devk5(2)*ztc )
+         ak2s(ji)    = zak2 * EXP( zbuf1*zcpexp + zbuf2*zcpexp2 )
+
+         zbuf1       = - ( devk1(3) + devk2(3)*ztc + devk3(3)*ztc2 )
+         zbuf2       = 0.5 * ( devk4(3) + devk5(3) * ztc )
+         akbs(ji)    = zakb * EXP( zbuf1*zcpexp + zbuf2*zcpexp2 )
+
+         zbuf1       = - ( devk1(4) + devk2(4)*ztc + devk3(4)*ztc2 )
+         zbuf2       = 0.5 * ( devk4(4) + devk5(4)*ztc )
+         akws(ji)    = zakw * EXP( zbuf1*zcpexp + zbuf2*zcpexp2 )
+
+
+         ! APPARENT SOLUBILITY PRODUCT K''SP OF CALCITE (OR ARAGONITE)
+         ! AS FUNCTION OF PRESSURE FOLLWING EDMOND AND GIESKES (1970)
+         ! (P. 1285) AND BERNER (1976)
+         !-----------------------------------------------------------------
+         ! aksp(ji) = aksp0*exp(zcpexp*(devks-devkst*tc))
+         ! or following Mucci
+         zbuf1      = - ( devk1(5) + devk2(5)*ztc + devk3(5)*ztc2 )
+         zbuf2      = 0.5 *( devk4(5) + devk5(5)*ztc )
+         aksps(ji)   = zksp * EXP( zbuf1*zcpexp + zbuf2*zcpexp2 )
+
+         ! For Phodphates (phosphoric acid) (DOE 1994)
+         !----------------------------------------------
+         zck1p = cp10 + cp11*ztr + cp12*zlogt + ( cp13*ztr + cp14 ) * zsqrt &
+            &      + ( cp15*ztr + cp16 ) * zsal
+         zck2p = cp20 + cp21*ztr + cp22*zlogt + ( cp23*ztr + cp24 ) * zsqrt &
+            &      + ( cp25*ztr + cp26 ) * zsal
+         zck3p = cp30 + cp31*ztr + ( cp32*ztr + cp33 ) *  zsqrt &
+            &      + ( cp34*ztr + cp35 ) * zsal
+
+         ! For silicates (DOE 1994) change to mol/kg soln) (OCMIP)
+         !--------------------------------------------------------
+         zcksi = cs10 + cs11*ztr + cs12*zlogt + ( cs13*ztr + cs14) * zisqrt &
+            &      + ( cs15*ztr + cs16 ) * zis &
+            &      + ( cs17*ztr + cs18 ) * zis2 &
+            &      + LOG( 1. + cs19*zsal ) + LOG( cs20 + cs21*zsal )
+
+
+         !K1, K2 of carbonic acid, KB of boric acid, KW (H2O)
+         !---------------------------------------------------
+         zak1p  = EXP ( zck1p  )
+         zak2p  = EXP ( zck2p  )
+         zak3p  = EXP ( zck3p  )
+         zaksil = EXP ( zcksi  )
+
+         zbuf1       = - ( devk1(3) + devk2(3)*ztc + devk3(3)*ztc2 )
+         zbuf2       = 0.5 * ( devk4(3) + devk5(3)*ztc )
+         aksis(ji)     = zaksil * EXP( zbuf1*zcpexp + zbuf2*zcpexp2 )
+
+         zbuf1       = - ( devk1(6) + devk2(6)*ztc + devk3(6)*ztc2 )
+         zbuf2       = 0.5 * ( devk4(6) + devk5(6)*ztc )
+         ak1ps(ji)   = zak1p * EXP( zbuf1*zcpexp + zbuf2*zcpexp2 )
+ 
+         zbuf1       = - ( devk1(7) + devk2(7)*ztc + devk3(7)*ztc2 )
+         zbuf2       = 0.5 * ( devk4(7) + devk5(7)*ztc )
+         ak2ps(ji)   = zak2p * EXP( zbuf1*zcpexp + zbuf2*zcpexp2 )
+
+         zbuf1       = - ( devk1(8) + devk2(8)*ztc + devk3(8)*ztc2 )
+         zbuf2       = 0.5 * ( devk4(8) + devk5(8)*ztc )
+         ak3ps(ji)   = zak3p * EXP( zbuf1*zcpexp + zbuf2*zcpexp2 )
+
+         ! total borat concentration. [mol/l]
+         ! or from Millero 1995 [mol/l] : borat(l) = 0.000416_8*(sal/35._8)*densSW(l)
+         ! --------------------------------------------------------------------------
+         borats(ji) = bor1 * zchl * bor2 * densSW(ji)
+
+         ak12s  (ji) = ak1s (ji) * ak2s (ji)
+         ak12ps (ji) = ak1ps(ji) * ak2ps(ji)
+         ak123ps(ji) = ak1ps(ji) * ak2ps(ji) * ak3ps(ji)
+
+         calcon2(ji) = 0.01028 * ( zsal / 35. ) * densSW(ji)
+
+      ENDDO
+
+   END SUBROUTINE sed_chem_off
+
+#endif
+
+#else
+   !!======================================================================
+   !! MODULE sedchem  :   Dummy module 
+   !!======================================================================
+CONTAINS
+   SUBROUTINE sed_chem( kt )         ! Empty routine
+      INTEGER, INTENT(in) :: kt
+      WRITE(*,*) 'trc_stp: You should not have seen this print! error?', kt
+   END SUBROUTINE sed_chem
+
+   !!======================================================================
+
+#endif
+
+END MODULE sedchem
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedco3.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedco3.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedco3.F90	(revision 3680)
@@ -0,0 +1,200 @@
+MODULE sedco3
+#if defined key_sed
+   !!======================================================================
+   !!              ***  MODULE  sedco3  ***
+   !!    Sediment : carbonate in sediment pore water
+   !!=====================================================================
+   !! * Modules used
+   USE sed     ! sediment global variable
+
+
+   IMPLICIT NONE
+   PRIVATE
+
+   !! *  Routine accessibility
+   PUBLIC sed_co3     
+
+
+   !! * Module variables
+   REAL(wp) :: epsmax   =  1.e-12      ! convergence limite value
+
+   !!----------------------------------------------------------------------
+   !!   OPA 9.0   !   LODYC-IPSL   (2003)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+
+   SUBROUTINE sed_co3( kt )
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE sed_co3  ***
+      !!
+      !! ** Purpose :  carbonate ion and proton concentration 
+      !!               in sediment pore water
+      !!
+      !! ** Methode :  - solving nonlinear equation for [H+] with given alkalinity
+      !!               and total co2 
+      !!               - one dimensional newton-raphson algorithm for [H+])
+      !!
+      !!   History :
+      !!        !  98-08 (E. Maier-Reimer, Christoph Heinze )  Original code
+      !!        !  04-10 (N. Emprin, M. Gehlen ) coupled with PISCES
+      !!        !  06-04 (C. Ethe)  Re-organization
+      !!----------------------------------------------------------------------
+      !! * Arguments
+      INTEGER, INTENT(in)  :: kt   ! time step
+
+      !
+      !---Local variables
+      INTEGER  :: jiter, ji, jk, ipt  ! dummy loop indices
+
+      INTEGER  :: itermax             ! maximum number of Newton-Raphson iterations
+      INTEGER  :: itime               ! number of time to perform Newton-Raphson algorithm
+      LOGICAL  :: lconv = .FALSE.     ! flag for convergence
+      REAL(wp) :: brems               !  relaxation. parameter
+      REAL(wp) :: zresm, zresm1, zhipor_min 
+      REAL(wp) :: zalk, zbor, zsil, zpo4, zdic
+      REAL(wp) :: zh_old, zh_old2, zh_old3, zh_old4
+      REAL(wp) :: zuu, zvv, zduu, zdvv 
+      REAL(wp) :: zup, zvp, zdup, zdvp
+      REAL(wp) :: zah_old, zah_olds
+      REAL(wp) :: zh_new, zh_new2, zco3
+
+     !!----------------------------------------------------------------------
+
+      IF( kt == nitsed000 ) THEN
+         WRITE(numsed,*) ' sed_co3 : carbonate ion and proton concentration calculation  '
+         WRITE(numsed,*) ' '
+      ENDIF
+
+      itermax     = 30
+      brems       = 1.
+      itime       = 0
+
+
+      DO jk = 1, jpksed
+10001    CONTINUE
+         IF( itime <= 2 ) THEN
+            lconv  = .FALSE.
+            IF( itime > 0 ) THEN  
+               ! increase max number of iterations and relaxation parameter
+               itermax = 200
+!!               brems   = 0.3
+               IF( itime == 2 ) hipor(1:jpoce,jk) = 3.e-9 ! re-initilazation of [H] values
+            ENDIF
+
+iflag:      DO jiter = 1, itermax
+
+                ! Store previous hi field.   
+               zresm = -1.e10
+               ipt = 1
+               DO ji = 1, jpoce
+                  ! dissociation constant are in mol/kg of solution
+                  ! convert pwcp concentration [mol/l] in mol/kg for solution
+                  zalk    = pwcp(ji,jk,jwalk) / densSW(ji)
+                  zh_old  = hipor(ji,jk) / densSW(ji)
+                  zh_old2 = zh_old  * zh_old
+                  zh_old3 = zh_old2 * zh_old
+                  zh_old4 = zh_old3 * zh_old
+                  zbor    = borats(ji) / densSW(ji)
+                  zsil    = pwcp(ji,jk,jwsil) / densSW(ji)
+                  zpo4    = pwcp(ji,jk,jwpo4) / densSW(ji)
+                  zdic    = pwcp(ji,jk,jwdic) / densSW(ji)               
+                  ! intermediate calculation 
+                  zuu     = zdic * ( ak1s(ji) / zh_old + 2.* ak12s(ji) / zh_old2 )
+                  zvv     = 1. + ak1s(ji) / zh_old + ak12s(ji) / zh_old2
+                  zduu    = zdic * ( -ak1s(ji) / zh_old2 - 4. * ak12s(ji) / zh_old3 )
+                  zdvv    = -ak1s(ji) / zh_old2 - 2. * ak12s(ji) / zh_old3
+                  zup     = zpo4 * ( ak12ps(ji) / zh_old2 + 2. * ak123ps(ji) / zh_old3 - 1.)
+                  zvp     = 1. + ak1ps(ji) / zh_old + ak12ps(ji) / zh_old2 + ak123ps(ji) / zh_old3
+                  zdup    = zpo4 * ( -2. * ak12ps(ji) / zh_old3 - 6. * ak123ps(ji) / zh_old4 )
+                  zdvp    = -ak1ps(ji) / zh_old2 - 2.* ak12ps(ji) / zh_old3 - 3. * ak123ps(ji) / zh_old4
+                  
+                  zah_old  = zuu / zvv + zbor / ( 1. + zh_old / akbs(ji) ) + &
+                     &      akws(ji) / zh_old - zh_old + zsil / ( 1. + zh_old / aksis(ji) ) + &
+                     &      zup / zvp
+                  
+                  zah_olds = ( ( zduu * zvv - zdvv * zuu ) / ( zvv * zvv ) )      - &
+                     &        zbor / akbs(ji) * ( 1. + zh_old / akbs(ji) )**(-2) - &
+                     &        akws(ji) / zh_old2 - 1. -                            &
+                     &        zsil / aksis(ji) * ( 1. + zh_old / aksis(ji) )**(-2) + &
+                     &       ( ( zdup * zvp - zdvp * zup ) / ( zvp * zvp ) )
+                  !
+                  zh_new = zh_old - brems * ( zah_old - zalk ) / zah_olds
+                  ! 
+                  zresm1 = ABS( zh_new - zh_old )
+                  IF( zresm1 > zresm ) THEN 
+                     zresm = zresm1  
+                  ENDIF
+                  !
+                  zh_new2  = zh_new * zh_new
+                  zco3   = ( ak12s(ji) * zdic ) / ( ak12s(ji) + ak1s(ji) * zh_new + zh_new2)
+                  ! again in mol/l
+                  hipor (ji,jk) = zh_new * densSW(ji)
+                  co3por(ji,jk) = zco3   * densSW(ji)
+                  
+               ENDDO  ! end loop ji
+               
+               ! convergence test
+               IF( zresm <= epsmax ) THEN
+                  lconv = .TRUE.
+                  !minimum value of hipor
+                  zhipor_min = MINVAL( hipor(1:jpoce,jk ) )
+                  EXIT iflag
+               ENDIF
+
+            ENDDO iflag
+
+            IF( lconv ) THEN
+!               WRITE(numsed,*) ' convergence after iter =', jiter, ' iterations ;  res =',zresm  
+               IF( zhipor_min < 0. ) THEN 
+                  IF ( itime == 0 ) THEN
+!                     WRITE(numsed,*) '    but hipor < 0 ; try one more time for jk = ', jk 
+!                     WRITE(numsed,*) '    with re-initialization of initial PH field '       
+                     itime = 2
+                     GOTO 10001
+                  ELSE
+!                     WRITE(numsed,*) ' convergence after iter =', jiter, ' iterations ;  res =',zresm 
+!                     WRITE(numsed,*) '    but hipor < 0, again for second time for jk = ', jk 
+!                     WRITE(numsed,*) ' We stop : STOP '
+                     STOP
+                  ENDIF
+               ELSE
+!                  WRITE(numsed,*) ' successfull convergence for level jk = ',jk,&
+!                     &               '  after iter =', jiter, ' iterations ;  res =',zresm  
+!                  WRITE(numsed,*) ' '
+                  itime = 0
+               ENDIF
+            ELSE
+               itime = itime + 1
+               WRITE(numsed,*) ' No convergence for jk = ', jk, ' after ', itime, '  try'            
+               IF ( itime == 1 ) THEN
+                  WRITE(numsed,*) ' try one more time with more iterations and higher relax. value'
+                  GOTO 10001
+               ELSE IF ( itime == 2 ) THEN
+                  WRITE(numsed,*) ' try one more time for with more iterations, higher relax. value'               
+                  WRITE(numsed,*) ' and with re-initialization of initial PH field ' 
+               ELSE       
+                  WRITE(numsed,*) ' No more... we stop '
+                  STOP
+               ENDIF
+            ENDIF
+         ENDIF
+     ENDDO
+
+   END SUBROUTINE sed_co3
+#else
+   !!======================================================================
+   !! MODULE sedco3  :   Dummy module 
+   !!======================================================================
+CONTAINS
+   SUBROUTINE sed_co3( kt )         ! Empty routine
+      INTEGER, INTENT(in) :: kt
+      WRITE(*,*) 'sed_co3: You should not have seen this print! error?', kt
+   END SUBROUTINE sed_co3
+
+   !!======================================================================
+
+#endif
+
+END MODULE sedco3
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/seddsr.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/seddsr.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/seddsr.F90	(revision 3680)
@@ -0,0 +1,539 @@
+MODULE seddsr
+#if defined key_sed
+   !!======================================================================
+   !!              ***  MODULE  seddsr  ***
+   !!    Sediment : dissolution and reaction in pore water
+   !!=====================================================================
+   !! * Modules used
+   USE sed     ! sediment global variable
+   USE sedmat  ! linear system of equations
+   USE sedco3  ! carbonate ion and proton concentration 
+
+   PUBLIC sed_dsr
+
+   !! * Module variables
+
+   REAL(wp), DIMENSION(:), ALLOCATABLE, PUBLIC :: cons_o2
+   REAL(wp), DIMENSION(:), ALLOCATABLE, PUBLIC :: cons_no3
+   REAL(wp), DIMENSION(:), ALLOCATABLE, PUBLIC :: sour_no3
+   REAL(wp), DIMENSION(:), ALLOCATABLE, PUBLIC :: sour_c13
+   REAL(wp), DIMENSION(:), ALLOCATABLE, PUBLIC ::  dens_mol_wgt  ! molecular density 
+
+CONTAINS
+   
+   SUBROUTINE sed_dsr( kt ) 
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE sed_dsr  ***
+      !! 
+      !!  ** Purpose :  computes pore water dissolution and reaction
+      !!
+      !!  ** Methode :  implicit simultaneous computation of undersaturation
+      !!               resulting from diffusive pore water transport and chemical
+      !!               pore water reactions. Solid material is consumed according
+      !!               to redissolution and remineralisation
+      !!
+      !!  ** Remarks :
+      !!              - undersaturation : deviation from saturation concentration
+      !!              - reaction rate   : sink of undersaturation from dissolution
+      !!                                 of solid material 
+      !!
+      !!   History :
+      !!        !  98-08 (E. Maier-Reimer, Christoph Heinze )  Original code
+      !!        !  04-10 (N. Emprin, M. Gehlen ) f90
+      !!        !  06-04 (C. Ethe)  Re-organization
+      !!----------------------------------------------------------------------
+      !! Arguments
+      INTEGER, INTENT(in) ::   kt       ! number of iteration
+      ! --- local variables
+      INTEGER :: ji, jk, js, jw   ! dummy looop indices
+      INTEGER :: nv               ! number of variables in linear tridiagonal eq
+
+      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zrearat    ! reaction rate in pore water
+      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zundsat    ! undersaturation ; indice jpwatp1 is for calcite   
+      REAL(wp), DIMENSION(:    ), ALLOCATABLE :: zmo2_0, zmo2_1  ! temp. array for mass balance calculation
+      REAL(wp), DIMENSION(:    ), ALLOCATABLE :: zmno3_0, zmno3_1, zmno3_2
+      REAL(wp), DIMENSION(:    ), ALLOCATABLE :: zmc13_0, zmc13_1, zmc13_2, zmc13_3
+      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zvolc    ! temp. variables
+      REAL(wp)  ::  zsolid1, zsolid2, zsolid3, zvolw, zreasat
+
+      !!
+      !!----------------------------------------------------------------------
+
+      IF( kt == nitsed000 ) THEN
+         WRITE(numsed,*) ' sed_dsr : Dissolution reaction '
+         WRITE(numsed,*) ' '
+         ! 
+         ALLOCATE( dens_mol_wgt((jpoce) ) 
+         dens_mol_wgt(1:jpsol) = dens / mol_wgt(1:jpsol)
+         ! 
+         ALLOCATE( cons_o2 (jpoce) ) ;   ALLOCATE( cons_no3(jpoce) ) 
+         ALLOCATE( sour_no3(jpoce) ) ;   ALLOCATE( sour_c13(jpoce) )  
+      ENDIF
+
+      ! Initialization of data for mass balance calculation
+      !---------------------------------------------------
+
+      tokbot(:,:)  = 0.
+      cons_o2 (:)  = 0. 
+      cons_no3(:)  = 0.  
+      sour_no3(:)  = 0.  
+      sour_c13(:)  = 0.       
+   
+      ! Initializations
+      !----------------------
+      ALLOCATE( zmo2_0 (jpoce) ) ;  ALLOCATE( zmo2_1 (jpoce) ) 
+      ALLOCATE( zmno3_0(jpoce) ) ;  ALLOCATE( zmno3_1(jpoce) )  ;  ALLOCATE( zmno3_2(jpoce) ) 
+      ALLOCATE( zmc13_0(jpoce) ) ;  ALLOCATE( zmc13_1(jpoce) )  ;  ALLOCATE( zmc13_2(jpoce) ) ;  ALLOCATE( zmc13_3(jpoce) ) 
+
+      zmo2_0 (:) = 0.  ; zmo2_1 (:) = 0.
+      zmno3_0(:) = 0.  ; zmno3_1(:) = 0.  ;  zmno3_2(:) = 0.
+      zmc13_0(:) = 0.  ; zmc13_1(:) = 0.  ;  zmc13_2(:) = 0.  ; zmc13_3(:) = 0.
+      
+      ALLOCATE( zrearat(jpoce,jpksed,3) ) ;  ALLOCATE( zundsat(jpoce,jpksed,3) )      
+      zrearat(:,:,:)   = 0.    ;   zundsat(:,:,:) = 0. 
+
+
+      ALLOCATE( zvolc(jpoce,jpksed,jpsol) ) 
+      zvolc(:,:,:)   = 0.
+
+      !--------------------------------------------------------------------
+      ! Temporary accomodation to take account of  particule rain deposition
+      !---------------------------------------------------------------------
+      
+      
+      ! 1. Change of geometry
+      !    Increase of dz3d(2) thickness : dz3d(2) = dz3d(2)+dzdep
+      !    Warning : no change for dz(2)
+      !---------------------------------------------------------
+      dz3d(1:jpoce,2) = dz3d(1:jpoce,2) + dzdep(1:jpoce)
+
+      
+      ! New values for volw3d(:,2) and vols3d(:,2)
+      ! Warning : no change neither for volw(2) nor  vols(2)
+      !------------------------------------------------------
+      volw3d(1:jpoce,2) = dz3d(1:jpoce,2) * por(2)
+      vols3d(1:jpoce,2) = dz3d(1:jpoce,2) * por1(2)
+
+      ! Conversion of volume units
+      !----------------------------
+      DO js = 1, jpsol
+         DO jk = 1, jpksed
+            DO ji = 1, jpoce    
+               zvolc(ji,jk,js) = ( vols3d(ji,jk) * dens_mol_wgt(js) ) /  &
+                  &              ( volw3d(ji,jk) * 1.e-3 )     
+            ENDDO
+         ENDDO
+      ENDDO
+
+      ! 2. Change of previous solid fractions (due to volum changes) for k=2
+      !---------------------------------------------------------------------
+
+      DO js = 1, jpsol
+         DO ji = 1, jpoce
+            solcp(ji,2,js) = solcp(ji,2,js) * dz(2) / dz3d(ji,2)
+         ENDDO
+      END DO
+
+      ! 3. New solid fractions (including solid rain fractions) for k=2  
+      !------------------------------------------------------------------   
+      DO js = 1, jpsol
+         DO ji = 1, jpoce
+            solcp(ji,2,js) = solcp(ji,2,js) + &
+            &           ( rainrg(ji,js) / raintg(ji) ) * ( dzdep(ji) / dz3d(ji,2) )
+            ! rainrm are temporary cancel
+            rainrm(ji,js) = 0.
+         END DO
+      ENDDO
+
+      ! 4.  Adjustment of bottom water concen.(pwcp(1)): 
+      !     We impose that pwcp(2) is constant. Including dzdep in dz3d(:,2) we assume 
+      !     that dzdep has got a porosity of por(2). So pore water volum of jk=2 increase.
+      !     To keep pwcp(2) cste we must compensate this "increase" by a slight adjusment
+      !     of bottom water concentration.
+      !     This adjustment is compensate at the end of routine
+      !-------------------------------------------------------------
+      DO jw = 1, jpwat
+         DO ji = 1, jpoce
+            pwcp(ji,1,jw) = pwcp(ji,1,jw) - &
+               &            pwcp(ji,2,jw) * dzdep(ji) * por(2) / dzkbot(ji)
+         END DO
+      ENDDO
+
+ 
+      !----------------------------------------------------------
+      ! 5.  Beginning of  Pore Water diffusion and solid reaction
+      !---------------------------------------------------------
+      
+      !-----------------------------------------------------------------------------
+      ! For jk=2,jpksed, and for couple 
+      !  1 : jwsil/jsopal  ( SI/Opal )
+      !  2 : jsclay/jsclay ( clay/clay ) 
+      !  3 : jwoxy/jspoc   ( O2/POC )
+      !  reaction rate is a function of solid=concentration in solid reactif in [mol/l] 
+      !  and undersaturation in [mol/l].
+      !  Solid weight fractions should be in ie [mol/l])
+      !  second member and solution are in zundsat variable
+      !-------------------------------------------------------------------------
+
+      !number of variables
+      nv  = 3
+     
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce
+            ! For Silicic Acid and clay
+            zundsat(ji,jk,1) = sat_sil   - pwcp(ji,jk,jwsil)
+            zundsat(ji,jk,2) = sat_clay
+            ! For O2
+            zundsat(ji,jk,3) = pwcp(ji,jk,jwoxy) / so2ut 
+         ENDDO
+      ENDDO
+      
+      
+      ! Definition of reaction rates [rearat]=sans dim 
+      ! For jk=1 no reaction (pure water without solid) for each solid compo
+      DO ji = 1, jpoce
+         zrearat(ji,1,:) = 0.
+      ENDDO
+
+
+      ! left hand side of coefficient matrix
+      DO jk = 2, jpksed
+         DO ji = 1, jpoce
+            zsolid1 = zvolc(ji,jk,jsopal) * solcp(ji,jk,jsopal)
+            zsolid2 = zvolc(ji,jk,jsclay) * solcp(ji,jk,jsclay)
+            zsolid3 = zvolc(ji,jk,jspoc)  * solcp(ji,jk,jspoc)
+
+            zrearat(ji,jk,1)  = ( reac_sil * dtsed * zsolid1 ) / &
+               &                ( 1. + reac_sil * dtsed * zundsat(ji,jk,1 ) )
+            zrearat(ji,jk,2)  = ( reac_clay * dtsed * zsolid2 ) / &
+               &                ( 1. + reac_clay * dtsed * zundsat(ji,jk,2 ) )
+            zrearat(ji,jk,3)  = ( reac_poc  * dtsed * zsolid3 ) / &
+               &                ( 1. + reac_poc  * dtsed * zundsat(ji,jk,3 ) )
+         ENDDO
+      ENDDO
+
+
+      CALL sed_mat( nv, jpoce, jpksed, zrearat, zundsat )
+
+
+      ! New solid concentration values (jk=2 to jksed) for each couple 
+      DO js = 1, nv
+         DO jk = 2, jpksed
+            DO ji = 1, jpoce
+               zreasat = zrearat(ji,jk,js) * zundsat(ji,jk,js) / zvolc(ji,jk,js)
+               solcp(ji,jk,js) = solcp(ji,jk,js) - zreasat
+            ENDDO
+         ENDDO
+      ENDDO
+      ! mass of O2/NO3 before POC remin. for mass balance check 
+      ! det. of o2 consomation/NO3 production Mc13
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce
+            zvolw = volw3d(ji,jk) * 1.e-3
+            zmo2_0 (ji)  = zmo2_0 (ji) + pwcp(ji,jk,jwoxy) * zvolw
+            zmno3_0(ji)  = zmno3_0(ji) + pwcp(ji,jk,jwno3) * zvolw
+            zmc13_0(ji)  = zmc13_0(ji) + pwcp(ji,jk,jwc13) * zvolw
+         ENDDO
+      ENDDO
+
+      ! New pore water concentrations    
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce
+            ! Acid Silicic 
+            pwcp(ji,jk,jwsil)  = sat_sil - zundsat(ji,jk,1)            
+            ! For O2 (in mol/l)
+            pwcp(ji,jk,jwoxy)  = zundsat(ji,jk,3) * so2ut 
+            zreasat = zrearat(ji,jk,3) * zundsat(ji,jk,3)    ! oxygen         
+            ! For DIC
+            pwcp(ji,jk,jwdic)  = pwcp(ji,jk,jwdic) + zreasat
+            ! For nitrates
+            pwcp(ji,jk,jwno3)  = pwcp(ji,jk,jwno3) + zreasat * srno3            
+            ! For Phosphate (in mol/l)
+            pwcp(ji,jk,jwpo4)  = pwcp(ji,jk,jwpo4) + zreasat * spo4r            
+            ! For alkalinity
+            pwcp(ji,jk,jwalk)  = pwcp(ji,jk,jwalk) - zreasat * ( srno3 + 2.* spo4r )           
+            ! For DIC13
+            pwcp(ji,jk,jwc13)  = pwcp(ji,jk,jwc13) + zreasat * rc13P * pdb
+         ENDDO
+      ENDDO
+
+
+      ! Mass of O2 for mass balance check and det. of o2 consomation
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce
+            zvolw = volw3d(ji,jk) * 1.e-3
+            zmo2_1 (ji) = zmo2_1 (ji) + pwcp(ji,jk,jwoxy) * zvolw
+            zmno3_1(ji) = zmno3_1(ji) + pwcp(ji,jk,jwno3) * zvolw
+            zmc13_1(ji) = zmc13_1(ji) + pwcp(ji,jk,jwc13) * zvolw
+         ENDDO
+      ENDDO
+
+      DO ji = 1, jpoce
+         cons_o2 (ji) = zmo2_0 (ji) - zmo2_1 (ji)
+         sour_no3(ji) = zmno3_1(ji) - zmno3_0(ji)     
+         sour_c13(ji) = zmc13_1(ji) - zmc13_0(ji) 
+      ENDDO
+ 
+
+      !--------------------------------------------------------------------
+      ! Begining POC denitrification and NO3- diffusion
+      ! (indice n°5 for couple POC/NO3- ie solcp(:,:,jspoc)/pwcp(:,:,jwno3))
+      !--------------------------------------------------------------------
+
+      nv = 1
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce
+            zundsat(ji,jk,1) = pwcp(ji,jk,jwno3) / srDnit
+         ENDDO
+      ENDDO
+      DO jk = 2, jpksed
+         DO ji = 1, jpoce
+            IF( pwcp(ji,jk,jwoxy) < sthrO2 ) THEN
+               zsolid1 = zvolc(ji,jk,jspoc) * solcp(ji,jk,jspoc)
+               zrearat(ji,jk,1) = ( reac_no3 * dtsed * zsolid1 ) / &
+                  &                    ( 1. + reac_no3 * dtsed * zundsat(ji,jk,1 ) )
+            ELSE
+               zrearat(ji,jk,1) = 0.
+            ENDIF
+         END DO
+      END DO
+
+
+      ! solves tridiagonal system
+      CALL sed_mat( nv, jpoce, jpksed, zrearat, zundsat )
+
+
+      ! New solid concentration values (jk=2 to jksed) for each couple 
+      DO jk = 2, jpksed
+         DO ji = 1, jpoce
+            zreasat = zrearat(ji,jk,1) * zundsat(ji,jk,1) / zvolc(ji,jk,jspoc)
+            solcp(ji,jk,jspoc) = solcp(ji,jk,jspoc) - zreasat
+         ENDDO
+      ENDDO
+
+      ! New dissolved concentrations
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce
+            zreasat = zrearat(ji,jk,1) * zundsat(ji,jk,1)    
+            ! For nitrates
+            pwcp(ji,jk,jwno3)  =  zundsat(ji,jk,1) * srDnit
+            ! For DIC
+            pwcp(ji,jk,jwdic)  = pwcp(ji,jk,jwdic) + zreasat
+            ! For Phosphate (in mol/l)
+            pwcp(ji,jk,jwpo4)  = pwcp(ji,jk,jwpo4) + zreasat * spo4r            
+            ! For alkalinity
+            pwcp(ji,jk,jwalk)  = pwcp(ji,jk,jwalk) + zreasat * ( srDnit - 2.* spo4r )           
+            ! For DIC13
+            pwcp(ji,jk,jwc13)  = pwcp(ji,jk,jwc13) + zreasat * rc13P * pdb
+         ENDDO
+      ENDDO
+
+
+      ! Mass of O2 for mass balance check and det. of o2 consomation
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce
+            zvolw = volw3d(ji,jk) * 1.e-3
+            zmno3_2(ji) = zmno3_2(ji) + pwcp(ji,jk ,jwno3) * zvolw
+            zmc13_2(ji) = zmc13_2(ji) + pwcp(ji,jk ,jwc13) * zvolw   
+         ENDDO
+      ENDDO
+
+      DO ji = 1, jpoce
+         cons_no3(ji) = zmno3_1(ji) - zmno3_2(ji)  
+         sour_c13(ji) = sour_c13(ji) + zmc13_2(ji) - zmc13_1(ji)     
+      ENDDO
+
+
+      !---------------------------
+      ! Solves PO4 diffusion 
+      !----------------------------
+
+      nv = 1
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce
+            zundsat(ji,jk,1) = pwcp(ji,jk,jwpo4)
+            zrearat(ji,jk,1) = 0.
+         ENDDO
+      ENDDO
+
+
+      ! solves tridiagonal system
+      CALL sed_mat( nv, jpoce, jpksed, zrearat, zundsat )
+
+
+      ! New undsaturation values and dissolved concentrations
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce
+            pwcp(ji,jk,jwpo4) = zundsat(ji,jk,1)
+         ENDDO
+      ENDDO
+
+
+      !---------------------------------------------------------------
+      ! Performs CaCO3 particle deposition and redissolution (indice 9)
+      !--------------------------------------------------------------
+
+      ! computes co3por from the updated pwcp concentrations (note [co3por] = mol/l)
+
+      CALL sed_co3( kt )
+
+
+      nv = 1
+      ! *densSW(l)**2 converts aksps [mol2/kg sol2] into [mol2/l2] to get [undsat] in [mol/l]
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce
+            zundsat(ji,jk,1) = aksps(ji) * densSW(ji) * densSW(ji) / calcon2(ji) &
+               &                     - co3por(ji,jk)
+            ! positive values of undersaturation
+            zundsat(ji,jk,1) = MAX( 0., zundsat(ji,jk,1) )            
+         ENDDO
+      ENDDO
+
+      DO jk = 2, jpksed
+         DO ji = 1, jpoce
+            zsolid1 = zvolc(ji,jk,jscal) * solcp(ji,jk,jscal)
+            zrearat(ji,jk,1) = ( reac_cal * dtsed * zsolid1 ) / &
+                  &               ( 1. + reac_cal * dtsed * zundsat(ji,jk,1) )
+         END DO
+      END DO
+
+
+      ! solves tridiagonal system
+      CALL sed_mat( nv, jpoce, jpksed, zrearat, zundsat )
+
+
+      ! New solid concentration values (jk=2 to jksed) for cacO3
+      DO jk = 2, jpksed
+         DO ji = 1, jpoce
+            zreasat = zrearat(ji,jk,1) * zundsat(ji,jk,1) / zvolc(ji,jk,jscal)
+            solcp(ji,jk,jscal) = solcp(ji,jk,jscal) - zreasat
+         ENDDO
+      ENDDO
+
+      ! New dissolved concentrations
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce
+            zreasat = zrearat(ji,jk,1) * zundsat(ji,jk,1)    
+            ! For DIC
+            pwcp(ji,jk,jwdic)  = pwcp(ji,jk,jwdic) + zreasat
+            ! For alkalinity
+            pwcp(ji,jk,jwalk)  = pwcp(ji,jk,jwalk) + 2.* zreasat 
+            ! For DIC13
+            pwcp(ji,jk,jwc13)  = pwcp(ji,jk,jwc13) + zreasat * rc13Ca * pdb
+         ENDDO
+      ENDDO
+
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce
+            zmc13_3(ji) = zmc13_3(ji) + pwcp(ji,jk,jwc13) * volw3d(ji,jk) * 1.e-3                  
+         ENDDO
+      ENDDO
+
+      DO ji = 1, jpoce     
+         sour_c13(ji) = sour_c13(ji) + zmc13_3(ji) - zmc13_2(ji)   
+      ENDDO
+      
+      !-------------------------------------------------
+      ! Beginning DIC, Alkalinity and DIC13 diffusion
+      !-------------------------------------------------
+      
+      nv = 3
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce      
+            zundsat(ji,jk,1) = pwcp(ji,jk,jwdic)
+            zundsat(ji,jk,2) = pwcp(ji,jk,jwalk)
+            zundsat(ji,jk,3) = pwcp(ji,jk,jwc13)
+      
+            zrearat(ji,jk,1) = 0.
+            zrearat(ji,jk,2) = 0.
+            zrearat(ji,jk,3) = 0.
+      
+         ENDDO
+      ENDDO
+
+
+      ! solves tridiagonal system
+      CALL sed_mat( nv, jpoce, jpksed, zrearat, zundsat )
+
+
+      ! New dissolved concentrations      
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce                      
+            pwcp(ji,jk,jwdic) = zundsat(ji,jk,1)
+            pwcp(ji,jk,jwalk) = zundsat(ji,jk,2)
+            pwcp(ji,jk,jwc13) = zundsat(ji,jk,3)
+         ENDDO
+      ENDDO            
+      
+      !----------------------------------
+      !   Back to initial geometry
+      !-----------------------------
+      
+      !---------------------------------------------------------------------
+      !   1/ Compensation for ajustement of the bottom water concentrations
+      !      (see note n° 1 about *por(2))
+      !--------------------------------------------------------------------
+      DO jw = 1, jpwat
+         DO ji = 1, jpoce
+            pwcp(ji,1,jw) = pwcp(ji,1,jw) + &
+               &            pwcp(ji,2,jw) * dzdep(ji) * por(2) / dzkbot(ji)
+         END DO
+      ENDDO
+      
+      !-----------------------------------------------------------------------
+      !    2/ Det of new rainrg taking account of the new weight fraction obtained 
+      !      in dz3d(2) after diffusion/reaction (react/diffu are also in dzdep!)
+      !      This new rain (rgntg rm) will be used in advection/burial routine
+      !------------------------------------------------------------------------
+      DO js = 1, jpsol
+         DO ji = 1, jpoce
+            rainrg(ji,js) = raintg(ji) * solcp(ji,2,js)
+            rainrm(ji,js) = rainrg(ji,js) / mol_wgt(js)
+         END DO
+      ENDDO
+      
+      !  New raintg
+      raintg(:) = 0.
+      DO js = 1, jpsol
+         DO ji = 1, jpoce
+            raintg(ji) = raintg(ji) + rainrg(ji,js)
+         END DO
+      ENDDO
+      
+      !--------------------------------
+      !    3/ back to initial geometry
+      !--------------------------------
+      DO ji = 1, jpoce
+         dz3d  (ji,2) = dz(2)
+         volw3d(ji,2) = dz3d(ji,2) * por(2)
+         vols3d(ji,2) = dz3d(ji,2) * por1(2)
+      ENDDO
+      
+      !----------------------------------------------------------------------
+      !    4/ Saving new amount of material in dzkbot for mass balance check
+      !       tokbot in [mol] (implicit *1cm*1cm for spacial dim)
+      !----------------------------------------------------------------------
+      DO jw = 1, jpwat 
+         DO ji = 1, jpoce
+            tokbot(ji,jw) = pwcp(ji,1,jw) * 1.e-3 * dzkbot(ji)
+         END DO
+      ENDDO
+
+      DEALLOCATE( zmo2_0  ) ;  DEALLOCATE( zmno3_1 )  ;  DEALLOCATE( zmno3_2 ) 
+      DEALLOCATE( zmc13_0 ) ;  DEALLOCATE( zmc13_1 )  ;  DEALLOCATE( zmc13_2 ) ;  DEALLOCATE( zmc13_3 ) 
+      
+      DEALLOCATE( zrearat ) ;  DEALLOCATE( zundsat )  ;  DEALLOCATE( zvolc )   
+      
+   END SUBROUTINE sed_dsr
+#else
+   !!======================================================================
+   !! MODULE seddsr  :   Dummy module 
+   !!======================================================================
+CONTAINS
+   SUBROUTINE sed_dsr ( kt )
+     INTEGER, INTENT(in) :: kt
+     WRITE(*,*) 'sed_dsr: You should not have seen this print! error?', kt
+  END SUBROUTINE sed_dsr
+#endif
+   
+END MODULE seddsr
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/seddta.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/seddta.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/seddta.F90	(revision 3680)
@@ -0,0 +1,277 @@
+MODULE seddta
+   !!======================================================================
+   !!                     ***  MODULE  seddta  ***
+   !! Sediment data  :  read sediment input data from a file
+   !!=====================================================================
+#if defined key_sed
+   !! * Modules used
+   USE sed
+   USE sedarr
+   USE iom
+
+   IMPLICIT NONE
+   PRIVATE
+
+   !! * Routine accessibility
+   PUBLIC sed_dta   ! 
+
+   !! *  Module variables
+   REAL(wp), DIMENSION(:), ALLOCATABLE ::  smask       ! mask for sediments points
+   REAL(wp) ::  rsecday  ! number of second per a day
+   REAL(wp) ::  conv1    ! [m/day]--->[cm/s]  
+   REAL(wp) ::  conv2    ! [kg/m2/month]-->[g/cm2/s] ( 1 month has 30 days )
+
+   INTEGER ::  numbio
+
+#if defined key_sed_off
+   INTEGER ::  numoce
+#endif
+
+CONTAINS
+
+   !!---------------------------------------------------------------------------
+   !!   sed_dta  : read the NetCDF data file in online version using module iom
+   !!---------------------------------------------------------------------------
+
+   SUBROUTINE sed_dta( kt )
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE sed_dta  ***
+      !!                    
+      !! ** Purpose :   Reads data from a netcdf file and 
+      !!                initialization of rain and pore water (k=1) components
+      !! 
+      !!
+      !!   History :
+      !!        !  04-10  (N. Emprin, M. Gehlen )  Original code
+      !!        !  06-04  (C. Ethe)  Re-organization ; Use of iom
+      !!----------------------------------------------------------------------
+
+      !! Arguments
+      INTEGER, INTENT(in) ::  kt    ! time-step
+
+      !! * Local declarations
+      INTEGER  ::  ji, jj, js, jw, ikt
+
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE :: zdta
+#if ! defined key_kriest
+      REAL(wp), DIMENSION(:)  , ALLOCATABLE :: zdtap, zdtag
+#endif 
+
+
+      !----------------------------------------------------------------------
+
+      ! Initialization of sediment variable 
+      ! Spatial dimension is merged, and unity converted if needed
+      !-------------------------------------------------------------
+
+      WRITE(numsed,*)
+      WRITE(numsed,*) ' sed_dta : Bottom layer fields'
+      WRITE(numsed,*) ' ~~~~~~'
+      WRITE(numsed,*) ' Data from SMS model'
+      WRITE(numsed,*)
+
+
+      ! open file
+      IF( kt == nitsed000 ) THEN
+         WRITE(numsed,*) ' sed_dta : Sediment fields'
+         CALL iom_open ( 'data_bio_bot'     , numbio )
+#if defined key_sed_off
+         CALL iom_open( 'data_oce_bot', numoce)
+#endif
+         rsecday = 60.* 60. * 24.
+         conv1   = 1.0e+2 / rsecday 
+         conv2   = 1.0e+3 / ( 1.0e+4 * rsecday * 30. ) 
+
+         ! Compute sediment mask
+         ALLOCATE( zdta(jpi,jpj) ) 
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ikt = MAX( INT( sbathy(ji,jj) ) - 1, 1 )
+               zdta(ji,jj) = tmask(ji,jj,ikt) 
+            ENDDO
+         ENDDO
+         ALLOCATE( smask(jpoce) )
+         smask(:) = 0.
+         CALL pack_arr( jpoce, smask(1:jpoce), zdta(1:jpi,1:jpj), iarroce(1:jpoce) )
+      ENDIF
+
+
+#if ! defined key_kriest   
+      ! Initialization of temporaries arrays  
+      ALLOCATE( zdtap(jpoce) )    ;   zdtap(:)    = 0. 
+      ALLOCATE( zdtag(jpoce) )    ;   zdtag(:)    = 0.  
+#endif
+
+
+      IF( MOD( kt - 1, nfreq ) == 0 ) THEN
+         ! reading variables
+         WRITE(numsed,*)
+         WRITE(numsed,*) ' sed_dta : Bottom layer fields at time  kt = ', kt
+         ! reading variables
+         trc_data(:,:,:) = 0.
+#if ! defined key_sed_off
+         DO jj = 1,jpj
+            DO ji = 1, jpi
+               ikt = mbkt(ji,jj)
+               IF ( tmask(ji,jj,ikt) == 1 ) THEN
+                  trc_data(ji,jj,1)  = trn  (ji,jj,ikt,jptal)
+                  trc_data(ji,jj,2)  = trn  (ji,jj,ikt,jpdic)
+                  trc_data(ji,jj,3)  = trn  (ji,jj,ikt,jpno3) / 7.6
+                  trc_data(ji,jj,4)  = trn  (ji,jj,ikt,jppo4) / 122.
+                  trc_data(ji,jj,5)  = trn  (ji,jj,ikt,jpoxy)
+                  trc_data(ji,jj,6)  = trn  (ji,jj,ikt,jpsil)
+#   if ! defined key_kriest
+                  trc_data(ji,jj,7 ) = sinksil (ji,jj,ikt)
+                  trc_data(ji,jj,8 ) = sinking (ji,jj,ikt)
+                  trc_data(ji,jj,9 ) = sinking2(ji,jj,ikt)
+                  trc_data(ji,jj,10) = sinkcal (ji,jj,ikt)
+                  trc_data(ji,jj,11) = tsn     (ji,jj,ikt,jp_tem)
+                  trc_data(ji,jj,12) = tsn     (ji,jj,ikt,jp_sal)
+#   else
+                  trc_data(ji,jj,7 ) = sinksil (ji,jj,ikt)
+                  trc_data(ji,jj,8 ) = sinking (ji,jj,ikt)
+                  trc_data(ji,jj,9 ) = sinkcal (ji,jj,ikt)
+                  trc_data(ji,jj,10) = tsn     (ji,jj,ikt,jp_tem)
+                  trc_data(ji,jj,11) = tsn     (ji,jj,ikt,jp_sal)       
+#   endif
+               ENDIF
+            ENDDO
+         ENDDO
+
+#else
+         CALL iom_get( numbio, jpdom_data, 'ALKBOT'     , trc_data(:,:,1 ) )
+         CALL iom_get( numbio, jpdom_data, 'DICBOT'     , trc_data(:,:,2 ) )
+         CALL iom_get( numbio, jpdom_data, 'NO3BOT'     , trc_data(:,:,3 ) )
+         CALL iom_get( numbio, jpdom_data, 'PO4BOT'     , trc_data(:,:,4 ) )
+         CALL iom_get( numbio, jpdom_data, 'O2BOT'      , trc_data(:,:,5 ) )
+         CALL iom_get( numbio, jpdom_data, 'SIBOT'      , trc_data(:,:,6 ) )
+#   if ! defined key_kriest
+         CALL iom_get( numbio, jpdom_data, 'OPALFLXBOT' , trc_data(:,:,7 ) ) 
+         CALL iom_get( numbio, jpdom_data, 'POCFLXBOT'  , trc_data(:,:,8 ) ) 
+         CALL iom_get( numbio, jpdom_data, 'GOCFLXBOT'  , trc_data(:,:,9 ) ) 
+         CALL iom_get( numbio, jpdom_data, 'CACO3FLXBOT', trc_data(:,:,10) ) 
+         CALL iom_get( numoce, jpdom_data, 'TBOT'       , trc_data(:,:,11) ) 
+         CALL iom_get( numoce, jpdom_data, 'SBOT'       , trc_data(:,:,12) ) 
+#   else
+         CALL iom_get( numbio, jpdom_data, 'OPALFLXBOT' , trc_data(:,:,7 ) ) 
+         CALL iom_get( numbio, jpdom_data, 'POCFLXBOT'  , trc_data(:,:,8 ) ) 
+         CALL iom_get( numbio, jpdom_data, 'CACO3FLXBOT', trc_data(:,:,9 ) ) 
+         CALL iom_get( numoce, jpdom_data, 'TBOT'       , trc_data(:,:,10) ) 
+         CALL iom_get( numoce, jpdom_data, 'SBOT'       , trc_data(:,:,11) ) 
+#   endif
+#endif
+
+         ! Pore water initial concentration [mol/l] in  k=1
+         !-------------------------------------------------
+
+          ! Alkalinity ( 1 umol = 10-6equivalent )
+         CALL pack_arr ( jpoce,  pwcp_dta(1:jpoce,jwalk), trc_data(1:jpi,1:jpj,1), iarroce(1:jpoce) )
+         ! DIC 
+         CALL pack_arr ( jpoce,  pwcp_dta(1:jpoce,jwdic), trc_data(1:jpi,1:jpj,2), iarroce(1:jpoce) )
+         ! Nitrates (1 umol/l = 10-6 mol/l)
+         CALL pack_arr ( jpoce,  pwcp_dta(1:jpoce,jwno3), trc_data(1:jpi,1:jpj,3), iarroce(1:jpoce) )
+         ! Phosphates (1 umol/l = 10-6 mol/l)
+         CALL pack_arr ( jpoce,  pwcp_dta(1:jpoce,jwpo4), trc_data(1:jpi,1:jpj,4), iarroce(1:jpoce) )
+         ! Oxygen (1 umol/l = 10-6 mol/l)
+         CALL pack_arr ( jpoce,  pwcp_dta(1:jpoce,jwoxy), trc_data(1:jpi,1:jpj,5), iarroce(1:jpoce) )        
+         ! Silicic Acid [mol.l-1]
+         CALL pack_arr ( jpoce,  pwcp_dta(1:jpoce,jwsil), trc_data(1:jpi,1:jpj,6), iarroce(1:jpoce) )                  
+         ! DIC13 (mol/l)obtained from dc13 and DIC (12) and PDB 
+         CALL iom_get ( numbio,jpdom_data,'DC13',zdta(:,:) )
+         CALL pack_arr ( jpoce,  pwcp_dta(1:jpoce,jwc13), zdta(1:jpi,1:jpj), iarroce(1:jpoce) )
+         pwcp_dta(1:jpoce,jwc13) = pdb * ( pwcp_dta(1:jpoce,jwc13) * 1.0e-3 + 1.0 )  &
+            &                          *   pwcp_dta(1:jpoce,jwdic)         
+         
+         !  Solid components : 
+         !-----------------------
+#if ! defined key_kriest
+         !  Sinking fluxes for OPAL in mol.m-2.s-1 ; conversion in mol.cm-2.s-1
+         CALL pack_arr ( jpoce, rainrm_dta(1:jpoce,jsopal), trc_data(1:jpi,1:jpj,7), iarroce(1:jpoce) ) 
+         rainrm_dta(1:jpoce,jsopal) = rainrm_dta(1:jpoce,jsopal) * 1e-4
+         !  Sinking fluxes for POC in mol.m-2.s-1 ; conversion in mol.cm-2.s-1
+         CALL pack_arr ( jpoce, zdtap(1:jpoce), trc_data(1:jpi,1:jpj,8) , iarroce(1:jpoce) )      
+         CALL pack_arr ( jpoce, zdtag(1:jpoce), trc_data(1:jpi,1:jpj,9) , iarroce(1:jpoce) )
+         rainrm_dta(1:jpoce,jspoc) =   ( zdtap(1:jpoce) +  zdtag(1:jpoce) ) * 1e-4
+         !  Sinking fluxes for Calcite in mol.m-2.s-1 ; conversion in mol.cm-2.s-1
+         CALL pack_arr ( jpoce,  rainrm_dta(1:jpoce,jscal), trc_data(1:jpi,1:jpj,10), iarroce(1:jpoce) )
+         rainrm_dta(1:jpoce,jscal) = rainrm_dta(1:jpoce,jscal) * 1e-4
+         ! vector temperature [°C] and salinity 
+         CALL pack_arr ( jpoce,  temp(1:jpoce), trc_data(1:jpi,1:jpj,11), iarroce(1:jpoce) )
+         CALL pack_arr ( jpoce,  salt(1:jpoce), trc_data(1:jpi,1:jpj,12), iarroce(1:jpoce) )
+#else
+         !  Sinking fluxes for OPAL in mol.m-2.s-1 ; conversion in mol.cm-2.s-1
+         CALL pack_arr ( jpoce, rainrm_dta(1:jpoce,jsopal), trc_data(1:jpi,1:jpj,7), iarroce(1:jpoce) ) 
+         rainrm_dta(1:jpoce,jsopal) = rainrm_dta(1:jpoce,jsopal) * 1e-4
+         !  Sinking fluxes for POC in mol.m-2.s-1 ; conversion in mol.cm-2.s-1
+         CALL pack_arr ( jpoce, rainrm_dta(1:jpoce,jspoc), trc_data(1:jpi,1:jpj,8) , iarroce(1:jpoce) )      
+         rainrm_dta(1:jpoce,jspoc) = rainrm_dta(1:jpoce,jspoc) * 1e-4
+         !  Sinking fluxes for Calcite in mol.m-2.s-1 ; conversion in mol.cm-2.s-1
+         CALL pack_arr ( jpoce,  rainrm_dta(1:jpoce,jscal), trc_data(1:jpi,1:jpj,9), iarroce(1:jpoce) )
+         rainrm_dta(1:jpoce,jscal) = rainrm_dta(1:jpoce,jscal) * 1e-4
+         ! vector temperature [°C] and salinity 
+         CALL pack_arr ( jpoce,  temp(1:jpoce), trc_data(1:jpi,1:jpj,10), iarroce(1:jpoce) )
+         CALL pack_arr ( jpoce,  salt(1:jpoce), trc_data(1:jpi,1:jpj,11), iarroce(1:jpoce) )
+
+#endif
+        
+         ! Clay rain rate in [mol/(cm**2.s)] 
+         ! inputs data in [kg.m-2.mois-1] ---> 1e+3/(1e+4*60*24*60*60) [g.cm-2.s-1]   
+         ! divided after by molecular weight g.mol-1      
+         zdta(:,:)   = 0.
+         CALL iom_get( numbio, jpdom_data, 'CLAY', zdta(:,:) ) 
+         CALL pack_arr ( jpoce, rainrm_dta(1:jpoce,jsclay) , zdta(1:jpi,1:jpj), iarroce(1:jpoce) )      
+         rainrm_dta(1:jpoce,jsclay) = rainrm_dta(1:jpoce,jsclay) * conv2 / mol_wgt(jsclay)
+
+      ENDIF
+
+      ! sediment pore water at 1st layer (k=1)
+      DO jw = 1, jpwat
+         pwcp(1:jpoce,1,jw) = pwcp_dta(1:jpoce,jw) * smask(1:jpoce)
+      ENDDO
+
+      !  rain
+      DO js = 1, jpsol
+         rainrm(1:jpoce,js) = rainrm_dta(1:jpoce,js) * smask(1:jpoce)
+      ENDDO
+
+      ! Calculation of raintg of each sol. comp.: rainrm in [g/(cm**2.s)]
+      DO js = 1, jpsol
+         rainrg(1:jpoce,js) = rainrm(1:jpoce,js) *  mol_wgt(js)
+      ENDDO
+
+      ! Calculation of raintg = total massic flux rained in each cell (sum of sol. comp.)
+      raintg(:) = 0.
+      DO js = 1, jpsol
+         raintg(1:jpoce) = raintg(1:jpoce) + rainrg(1:jpoce,js)
+      ENDDO
+
+      ! computation of dzdep = total thickness of solid material rained [cm] in each cell
+      dzdep(1:jpoce) = raintg(1:jpoce) * rdtsed(2) 
+
+
+      DEALLOCATE( zdta ) 
+#if ! defined key_kriest
+      DEALLOCATE( zdtap    ) ;  DEALLOCATE( zdtag    ) 
+#endif      
+
+      IF( kt == nitsedend )   THEN
+         CALL iom_close ( numbio )
+#if defined key_sed_off
+         CALL iom_close ( numoce )
+#endif
+      ENDIF
+      
+   END SUBROUTINE sed_dta
+
+#else
+   !!======================================================================
+   !! MODULE seddta  :   Dummy module 
+   !!======================================================================
+CONTAINS
+   SUBROUTINE sed_dta ( kt )
+     INTEGER, INTENT(in) :: kt
+     WRITE(*,*) 'sed_stp: You should not have seen this print! error?', kt 
+  END SUBROUTINE sed_dta
+#endif
+
+END MODULE seddta
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedini.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedini.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedini.F90	(revision 3680)
@@ -0,0 +1,864 @@
+MODULE sedini
+   !!======================================================================
+   !!              ***  MODULE  sedini  ***
+   !! Sediment : define sediment variables
+   !!=====================================================================
+#if defined key_sed
+
+   !!----------------------------------------------------------------------
+   !!   sed_init    : initialization, namelist read, and parameters control
+   !!----------------------------------------------------------------------
+   !! * Modules used
+   USE sed     ! sediment global variable
+   USE seddta
+   USE sedrst
+   USE sedco3
+   USE sedchem
+   USE sedarr
+   USE iom
+
+
+   IMPLICIT NONE
+   PRIVATE
+
+   !! Module variables
+   REAL(wp)    ::  &
+      sisat   =  800.  ,  &  !: saturation for si    [ mol.l-1]
+      claysat =    0.  ,  &  !: saturation for clay  [ mol.l-1]
+      rcopal  =   40.  ,  &  !: reactivity for si    [l.mol-1.an-1]
+      rcclay  =    0.  ,  &  !: reactivity for clay  [l.mol-1.an-1]
+      dcoef   =  8.e-6       !: diffusion coefficient (*por)   [cm**2/s]
+
+   REAL(wp)    ::  &
+      redO2   =  172.  ,  &  !: Redfield coef for Oxygene
+      redNo3  =   16.  ,  &  !: Redfield coef for Nitrates
+      redPo4  =    1.  ,  &  !: Redfield coef for Phosphates
+      redC    =  122.  ,  &  !: Redfield coef for Carbone
+      redDnit =  97.6  ,  &  !: Redfield coef for denitrification    
+      rcorg   =   50.  ,  &  !: reactivity for POC/O2 [l.mol-1.an-1]    
+      o2seuil =    1.  ,  &  !: threshold O2 concentration for [mol.l-1]     
+      rcorgN  =   50.       !: reactivity for POC/No3 [l.mol-1.an-1]
+
+   REAL(wp)    ::  &
+      rccal   = 1000.        !: reactivity for calcite         [l.mol-1.an-1]
+
+   REAL(wp)    ::  &
+      dbiot   = 15.          !: coefficient for bioturbation    [cm**2.(1000an-1)]
+
+   LOGICAL     :: &
+      ln_rst_sed = .TRUE.    !: initialisation from a restart file or not
+
+   REAL(wp)    ::  &
+      ryear = 365. * 24. * 3600. !:  1 year converted in second
+
+   !! *  Routine accessibility
+   PUBLIC sed_init          ! routine called by opa.F90
+
+CONTAINS
+
+
+   SUBROUTINE sed_init
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE sed_init  ***
+      !!
+      !! ** Purpose :  Initialization of sediment module
+      !!               - Reading namelist
+      !!               - Read the deepest water layer thickness
+      !!                 ( using as mask ) in Netcdf file
+      !!               - Convert unity if necessary
+      !!               - sets initial sediment composition
+      !!                 ( only clay or reading restart file )
+      !!               - sets sediment grid, porosity and others constants
+      !!
+      !!   History :
+      !!        !  04-10  (N. Emprin, M. Gehlen )  Original code
+      !!        !  06-07  (C. Ethe)  Re-organization
+      !!----------------------------------------------------------------------
+      INTEGER :: ji, jj, ikt
+#if defined key_sed_off
+      INTEGER  :: numblt         
+      INTEGER  :: nummsh   
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zdta
+#endif
+      !!----------------------------------------------------------------------
+
+
+      ! Reading namelist.sed variables
+      !---------------------------------------
+
+      CALL ctl_opn( numsed, 'sediment.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
+
+      WRITE(numsed,*)
+      WRITE(numsed,*) '                 L S C E - C E A'
+      WRITE(numsed,*) '                 SEDIMENT model'
+      WRITE(numsed,*) '                version 2.0  (2007) '
+      WRITE(numsed,*)
+      WRITE(numsed,*)
+
+    
+      WRITE(numsed,*) ' sed_init : Initialization of sediment module  '
+      WRITE(numsed,*) ' '
+
+      !                                ! Allocate LOBSTER arrays
+      IF( sed_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sed_ini: unable to allocate sediment model arrays' )
+
+
+      ! Determination of sediments number of points and allocate global variables
+#if defined key_sed_off
+      ! Reading Netcdf Pisces file for deepest water layer thickness [m]
+      ! This data will be used as mask to merdge space in 1D vector
+      !----------------------------------------------------------------
+
+      CALL iom_open ( 'mesh_mask'  , nummsh )   
+      CALL iom_open ( 'e3tbot'     , numblt )
+
+      ! mask sediment points for outputs
+      CALL iom_get( nummsh, jpdom_data, 'tmask' , tmask )
+      CALL iom_get( nummsh, jpdom_data, 'mbathy', sbathy )
+      
+      ! longitude/latitude values
+      CALL iom_get ( nummsh, jpdom_data,'nav_lon', glamt(:,:) )
+      CALL iom_get ( nummsh, jpdom_data,'nav_lat', gphit(:,:) )
+    
+      ! bottom layer thickness
+      ALLOCATE( zdta(jpi,jpj) )
+      CALL iom_get  ( numblt, jpdom_data, 'E3TBOT', zdta(:,:) )
+      epkbot(:,:) = 0.
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            ikt = MAX( INT( sbathy(ji,jj) ), 1 )
+            IF( tmask(ji,jj,ikt) == 1 ) epkbot(ji,jj) = zdta(ji,jj)
+         ENDDO
+      ENDDO
+
+      CALL iom_close( nummsh )  
+      CALL iom_close( numblt ) 
+
+      DEALLOCATE( zdta )
+#else
+
+      epkbot(:,:) = 0.
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            ikt = mbkt(ji,jj) 
+            IF( tmask(ji,jj,ikt) == 1 ) epkbot(ji,jj) = e3t_0(ikt)
+         ENDDO
+      ENDDO
+#endif     
+
+
+      ! computation of total number of ocean points
+      !--------------------------------------------
+      jpoce  = COUNT( epkbot(:,:) > 0. )
+
+
+      ! Allocate memory size of global variables
+      ALLOCATE( pwcp (jpoce,jpksed,jpwat) )  ;  ALLOCATE( pwcp0 (jpoce,jpksed,jpwat) ) ;  ALLOCATE( pwcp_dta  (jpoce,jpwat) )
+      ALLOCATE( solcp(jpoce,jpksed,jpsol) )  ;  ALLOCATE( solcp0(jpoce,jpksed,jpsol) ) ;  ALLOCATE( rainrm_dta(jpoce,jpsol) )
+      ALLOCATE( rainrm(jpoce,jpsol) )        ;  ALLOCATE( rainrg(jpoce,jpsol) )        ;  ALLOCATE( raintg(jpoce) ) 
+      ALLOCATE( dzdep(jpoce) )               ;  ALLOCATE( iarroce(jpoce) )             ;  ALLOCATE( dzkbot(jpoce) )
+      ALLOCATE( temp(jpoce) )                ;  ALLOCATE( salt(jpoce) )                
+      ALLOCATE( press(jpoce) )               ;  ALLOCATE( densSW(jpoce) ) 
+      ALLOCATE( hipor(jpoce,jpksed) )        ;  ALLOCATE( co3por(jpoce,jpksed) ) 
+      ALLOCATE( dz3d(jpoce,jpksed) )         ;  ALLOCATE( volw3d(jpoce,jpksed) )       ;  ALLOCATE( vols3d(jpoce,jpksed) )
+
+      ! Initialization of global variables
+      pwcp  (:,:,:) = 0.  ;  pwcp0 (:,:,:) = 0.  ; pwcp_dta  (:,:) = 0.  
+      solcp (:,:,:) = 0.  ;  solcp0(:,:,:) = 0.  ; rainrm_dta(:,:) = 0.
+      rainrm(:,:  ) = 0.  ;  rainrg(:,:  ) = 0.  ; raintg    (:  ) = 0. 
+      dzdep (:    ) = 0.  ;  iarroce(:   ) = 0   ; dzkbot    (:  ) = 0.
+      temp  (:    ) = 0.  ;  salt   (:   ) = 0.  
+      press (:    ) = 0.  ;  densSW (:   ) = 0. 
+      hipor (:,:  ) = 0.  ;  co3por (:,: ) = 0.  
+      dz3d  (:,:  ) = 0.  ;  volw3d (:,: ) = 0.  ;  vols3d   (:,:) = 0. 
+
+      ! Chemical variables      
+      ALLOCATE( akbs  (jpoce) )  ;  ALLOCATE( ak1s   (jpoce) )  ;  ALLOCATE( ak2s  (jpoce) ) ;  ALLOCATE( akws  (jpoce) )     
+      ALLOCATE( ak1ps (jpoce) )  ;  ALLOCATE( ak2ps  (jpoce) )  ;  ALLOCATE( ak3ps (jpoce) ) ;  ALLOCATE( aksis (jpoce) )    
+      ALLOCATE( aksps (jpoce) )  ;  ALLOCATE( ak12s  (jpoce) )  ;  ALLOCATE( ak12ps(jpoce) ) ;  ALLOCATE( ak123ps(jpoce) )    
+      ALLOCATE( borats(jpoce) )  ;  ALLOCATE( calcon2(jpoce) )    
+
+      akbs  (:) = 0. ;   ak1s   (:) = 0. ;  ak2s  (:) = 0. ;   akws   (:) = 0.
+      ak1ps (:) = 0. ;   ak2ps  (:) = 0. ;  ak3ps (:) = 0. ;   aksis  (:) = 0.
+      aksps (:) = 0. ;   ak12s  (:) = 0. ;  ak12ps(:) = 0. ;   ak123ps(:) = 0.
+      borats(:) = 0. ;   calcon2(:) = 0.
+
+      ! Mass balance calculation  
+      ALLOCATE( fromsed(jpoce, jpsol) ) ; ALLOCATE( tosed(jpoce, jpsol) ) ;  ALLOCATE( rloss(jpoce, jpsol) )
+      ALLOCATE( tokbot (jpoce, jpwat) ) 
+
+      fromsed(:,:) = 0.    ;   tosed(:,:) = 0. ;  rloss(:,:) = 0.  ;   tokbot(:,:) = 0. 
+
+      ! Read sediment Namelist
+      !-------------------------
+      CALL sed_init_nam
+    
+      ! Initialization of sediment geometry
+      !------------------------------------
+      CALL sed_init_geom
+
+
+      ! sets initial sediment composition
+      ! ( only clay or reading restart file )
+      !---------------------------------------
+      CALL sed_init_data
+
+
+      CALL sed_init_wri
+
+
+   END SUBROUTINE sed_init
+
+
+   SUBROUTINE sed_init_geom
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE sed_init_geom  ***
+      !!
+      !! ** Purpose :  Initialization of sediment geometry
+      !!               - Read the deepest water layer thickness
+      !!                 ( using as mask ) in Netcdf file
+      !!               - sets sediment grid, porosity and molecular weight
+      !!                 and others constants
+      !!
+      !!   History :
+      !!        !  06-07  (C. Ethe)  Original
+      !!----------------------------------------------------------------------
+      !! * Modules used
+      !! * local declarations
+      INTEGER ::  &
+        ji, jj, jk
+ 
+#if defined key_sed_off
+      REAL(wp) , DIMENSION (jpi,jpj) :: zdta
+      INTEGER  ::  numpres
+#endif
+      !---------------------------------------------------------- 
+
+      WRITE(numsed,*) ' sed_init_geom : Initialization of sediment geometry '
+      WRITE(numsed,*) ' '
+
+      ! Computation of 1D array of sediments points
+      indoce = 0
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            IF (  epkbot(ji,jj) > 0. ) THEN
+               indoce          = indoce + 1
+               iarroce(indoce) = (jj - 1) * jpi + ji
+            ENDIF
+         END DO
+      END DO
+
+      IF( indoce .NE. jpoce ) THEN
+         WRITE(numsed,*) ' '
+         WRITE(numsed,*) 'Warning : number of ocean points indoce = ', indoce, &
+            &     ' doesn''t match  number of point where epkbot>0  jpoce = ', jpoce
+         WRITE(numsed,*) ' '
+         WRITE(numsed,*) ' '
+         STOP
+      ELSE
+         WRITE(numsed,*) ' '
+         WRITE(numsed,*) ' total number of ocean points jpoce =  ',jpoce
+         WRITE(numsed,*) ' '
+      ENDIF
+
+#if defined key_sed_off
+
+      ! Reading Netcdf Pisces file for deepest water layer thickness [m]
+      ! This data will be used as mask to merdge space in 1D vector
+      !----------------------------------------------------------------
+      CALL iom_open ( 'pressbot'   , numpres )
+      
+      ! pressure  in  bars      
+      CALL iom_get ( numpres, jpdom_data,'BATH', zdta(:,:) )
+      CALL pack_arr ( jpoce, press(1:jpoce), zdta(1:jpi,1:jpj), iarroce(1:jpoce) )
+      press(1:jpoce) = press(1:jpoce) * 1.025e-1 
+
+      CALL iom_close ( numpres )
+#endif
+
+
+      ! mask sediment points for outputs
+      DO jk = 1, jpksed
+         tmasksed(:,:,jk) = tmask(:,:,1)
+      ENDDO
+
+      ! initialization of dzkbot in [cm]
+      !------------------------------------------------    
+      CALL pack_arr ( jpoce, dzkbot(1:jpoce), epkbot(1:jpi,1:jpj), iarroce(1:jpoce) )
+      dzkbot(1:jpoce) = dzkbot(1:jpoce) * 1.e+2 
+
+      ! Geometry and  constants 
+      ! sediment layer thickness [cm]
+      ! (1st layer= diffusive layer = pur water) 
+      !------------------------------------------
+      dz(1)  = 0.1
+      dz(2)  = 0.3
+      dz(3)  = 0.3
+      dz(4)  = 0.5
+      dz(5)  = 0.5
+      dz(6)  = 0.5
+      dz(7)  = 1.
+      dz(8)  = 1.
+      dz(9)  = 1.
+      dz(10) = 2.45
+      dz(11) = 2.45
+
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce
+            dz3d(ji,jk) = dz(jk)
+         END DO
+      ENDDO
+
+      ! Depth(jk)= depth of middle of each layer
+      !----------------------------------------
+      profsed(1) = -dz(1)/ 2.
+      DO jk = 2, jpksed
+         profsed(jk) = profsed(jk-1) + dz(jk-1) / 2. + dz(jk) / 2.
+      ENDDO
+
+      !  Porosity profile [0]
+      !---------------------
+      por(1)  = 1.
+      por(2)  = 0.95
+      por(3)  = 0.9
+      por(4)  = 0.85
+      por(5)  = 0.81
+      por(6)  = 0.75
+      por(7)  = 0.75      
+      por(8)  = 0.75      
+      por(9)  = 0.75      
+      por(10) = 0.75
+      por(11) = 0.75
+ 
+      ! inverse of  Porosity profile
+      !-----------------------------
+      por1(:) = 1. - por(:)
+
+      ! Volumes of pore water and solid fractions (vector and array)
+      !     WARNING : volw(1) and vols(1) are sublayer volums
+      volw(:) = dz(:) * por(:)
+      vols(:) = dz(:) * por1(:)
+
+      ! temporary new value for dz3d(:,1) 
+      dz3d(1:jpoce,1) = dzkbot(1:jpoce)
+
+      ! WARNING : volw3d(:,1) and vols3d(:,1) are deepest water column volums
+      DO jk = 1, jpksed
+         volw3d(1:jpoce,jk) = dz3d(1:jpoce,jk) * por (jk)
+         vols3d(1:jpoce,jk) = dz3d(1:jpoce,jk) * por1(jk)
+      ENDDO
+
+      ! Back to the old sublayer vlaue for dz3d(:,1)
+      dz3d(1:jpoce,1) = dz(1)
+
+
+      !---------------------------------------------
+      ! Molecular weight [g/mol] for solid species
+      !---------------------------------------------
+
+
+      ! opal=sio2*0.4(h20)=28+2*16+0.4*(2+16)
+      !---------------------------------------
+      mol_wgt(jsopal) = 28. + 2. * 16. + 0.4 * ( 2. + 16. )  
+
+      !  clay
+      !  some kind of Illit (according to Pape)
+      !  K0.58(Al 1.38 Fe(III)0.37Fe(II)0.04Mg0.34)[(OH)2|(Si3.41Al0.59)O10]
+      !--------------------------------------------------------------------
+      mol_wgt(jsclay) = 0.58 * 39. + 1.38 * 27. + ( 0.37 + 0.04 ) * 56.+ &
+         &              0.34 * 24. + 2. * ( 16. + 1. ) + 3.41 * 38. +    &
+         &              0.59 * 27. + 10. * 16.
+
+      ! for chemistry Poc : C(122)H(244)O(86)N(16)P(1)
+      ! But den sity of Poc is an Hydrated material (= POC + 30H2O)
+      ! So C(122)H(355)O(120)N(16)P(1)
+      !------------------------------------------------------------
+      mol_wgt(jspoc) = ( 122. * 12. + 355. + 120. * 16.+ &
+         &                16. * 14. + 31. ) / 122.
+
+      ! CaCO3
+      !---------
+      mol_wgt(jscal) = 40. + 12. + 3. * 16.
+
+      ! Density of solid material in sediment [g/cm**3]
+      !------------------------------------------------
+      dens = 2.6
+
+      ! Initialization of diffusion coefficient as function of porosity [cm**2/s]
+      !--------------------------------------------------------------------
+      diff(:) = dcoef * por(:)
+
+
+      ! Initialization of time step as function of porosity [cm**2/s]
+      !------------------------------------------------------------------
+      rdtsed(2:jpksed) = dtsed / ( dens * por1(2:jpksed) )
+     
+   END SUBROUTINE sed_init_geom
+
+   SUBROUTINE sed_init_nam
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE sed_init_nam  ***
+      !!
+      !! ** Purpose :  Initialization of sediment geometry
+      !!               - Reading namelist and defines constants variables
+      !!
+      !!   History :
+      !!        !  06-07  (C. Ethe)  Original
+      !!----------------------------------------------------------------------
+
+      INTEGER :: &
+         numnamsed = 28
+
+      TYPE PSED
+         CHARACTER(len = 20)  :: snamesed   !: short name
+         CHARACTER(len = 80 ) :: lnamesed   !: long name
+         CHARACTER(len = 20 ) :: unitsed    !: unit
+      END TYPE PSED
+
+      TYPE(PSED) , DIMENSION(jpsol     ) :: sedsol
+      TYPE(PSED) , DIMENSION(jpwat     ) :: sedwat
+      TYPE(PSED) , DIMENSION(jpdia3dsed) :: seddiag3d
+      TYPE(PSED) , DIMENSION(jpdia2dsed) :: seddiag2d
+
+      NAMELIST/nam_time/nfreq
+      NAMELIST/nam_trased/sedsol, sedwat
+      NAMELIST/nam_diased/seddiag3d, seddiag2d
+      NAMELIST/nam_reac/sisat, claysat, rcopal, rcclay, dcoef 
+      NAMELIST/nam_poc/redO2, redNo3, redPo4, redC, redDnit, &
+         &           rcorg, o2seuil, rcorgN
+      NAMELIST/nam_cal/rccal
+      NAMELIST/nam_dc13/pdb, rc13P, rc13Ca
+      NAMELIST/nam_btb/dbiot
+      NAMELIST/nam_rst/ln_rst_sed
+
+      INTEGER :: jn, jn1
+      !-------------------------------------------------------
+
+      WRITE(numsed,*) ' sed_init_nam : Read namelists '
+      WRITE(numsed,*) ' '
+
+      ! ryear = 1 year converted in second
+      !------------------------------------
+      WRITE(numsed,*) ' '
+      WRITE(numsed,*) 'number of seconds in one year : ryear = ', ryear
+      WRITE(numsed,*) ' '     
+
+      ! Reading namelist.sed variables
+      !---------------------------------
+      CALL ctl_opn( numnamsed, 'namelist.sediment', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
+
+      dtsed = rdt
+      nitsed000 = nittrc000
+      nitsedend = nitend
+#if ! defined key_sed_off
+      nwrised   = nwritetrc
+#else
+      nwrised   = nwrite
+#endif
+     ! Diffraction/reaction parameters
+      !----------------------------------
+      READ( numnamsed, nam_time )
+      WRITE(numsed,*) ' namelist nam_time'
+
+#if ! defined key_sed_off
+      nfreq     = 1
+#endif
+
+      WRITE(numsed,*) ' sedimentation time step              dtsed      = ', dtsed
+      WRITE(numsed,*) ' 1st time step for sediment.          nitsed000  = ', nitsed000
+      WRITE(numsed,*) ' last time step for sediment.         nitsedend  = ', nitsedend
+      WRITE(numsed,*) ' frequency of sediment outputs        nwrised    = ', nwrised
+      WRITE(numsed,*) ' frequency of restoring inputs data   nfreq      = ', nfreq
+      WRITE(numsed,*) ' '
+
+      REWIND( numnamsed )               ! read nattrc
+      READ  ( numnamsed, nam_trased )
+
+      DO jn = 1, jpsol
+         sedtrcd(jn) = sedsol(jn)%snamesed
+         sedtrcl(jn) = sedsol(jn)%lnamesed
+         sedtrcu(jn) = sedsol(jn)%unitsed
+      END DO
+
+      DO jn = 1, jpwat
+         jn1 = jn + jpsol
+         sedtrcd(jn1) = sedwat(jn)%snamesed
+         sedtrcl(jn1) = sedwat(jn)%lnamesed
+         sedtrcu(jn1) = sedwat(jn)%unitsed
+      END DO
+
+      WRITE(numsed,*) ' namelist nam_trased'
+      WRITE(numsed,*) ' '
+      DO jn = 1, jptrased
+         WRITE(numsed,*) 'name of 3d output sediment field number :',jn,' : ',TRIM(sedtrcd(jn))
+         WRITE(numsed,*) 'long name ', TRIM(sedtrcl(jn))
+         WRITE(numsed,*) ' in unit = ', TRIM(sedtrcu(jn))
+         WRITE(numsed,*) ' '
+      END DO
+      WRITE(numsed,*) ' '
+
+      
+      REWIND( numnamsed )
+      READ( numnamsed, nam_diased )
+
+      DO jn = 1, jpdia3dsed
+         seddia3d(jn) = seddiag3d(jn)%snamesed
+         seddia3l(jn) = seddiag3d(jn)%lnamesed
+         seddia3u(jn) = seddiag3d(jn)%unitsed
+      END DO
+
+      DO jn = 1, jpdia2dsed
+         seddia2d(jn) = seddiag2d(jn)%snamesed
+         seddia2l(jn) = seddiag2d(jn)%lnamesed
+         seddia2u(jn) = seddiag2d(jn)%unitsed
+      END DO
+
+      WRITE(numsed,*) ' namelist nam_diased'
+      WRITE(numsed,*) ' '
+      DO jn = 1, jpdia3dsed
+         WRITE(numsed,*) 'name of 3D output diag number :',jn, ' : ', TRIM(seddia3d(jn))
+         WRITE(numsed,*) 'long name ', TRIM(seddia3l(jn))
+         WRITE(numsed,*) ' in unit = ',TRIM(seddia3u(jn))
+         WRITE(numsed,*) ' '
+      END DO
+
+      DO jn = 1, jpdia2dsed
+         WRITE(numsed,*) 'name of 2D output diag number :',jn, ' : ', TRIM(seddia2d(jn))
+         WRITE(numsed,*) 'long name ', TRIM(seddia2l(jn))
+         WRITE(numsed,*) ' in unit = ',TRIM(seddia2u(jn))
+         WRITE(numsed,*) ' '
+      END DO
+
+      WRITE(numsed,*) ' '
+
+
+      ! Diffraction/reaction parameters
+      !----------------------------------
+      REWIND( numnamsed )
+      READ( numnamsed, nam_reac )
+      WRITE(numsed,*) ' namelist nam_reac'
+      WRITE(numsed,*) ' saturation for si    sisat   = ', sisat
+      WRITE(numsed,*) ' saturation for clay  claysat = ', claysat
+      WRITE(numsed,*) ' reactivity for Si    rcopal  = ', rcopal
+      WRITE(numsed,*) ' reactivity for clay  rcclay  = ', rcclay
+      WRITE(numsed,*) ' diff. coef for por.  dcoef   = ', dcoef
+      WRITE(numsed,*) ' '
+
+
+      ! Unity conversion to get saturation conc. psat in [mol.l-1]
+      ! and reactivity rc in  [l.mol-1.s-1]
+      !----------------------------------------------------------
+      sat_sil   = sisat   * 1.e-6   
+      sat_clay  = claysat * 1.e-6
+
+      reac_sil  = rcopal / ryear     
+      reac_clay  = rcclay / ryear
+
+
+      ! Additional parameter linked to POC/O2/No3/Po4
+      !----------------------------------------------
+      REWIND( numnamsed )
+      READ( numnamsed, nam_poc )
+      WRITE(numsed,*) ' namelist nam_poc'
+      WRITE(numsed,*) ' Redfield coef for oxy     redO2   = ', redO2
+      WRITE(numsed,*) ' Redfield coef for no3     redNo3  = ', redNo3
+      WRITE(numsed,*) ' Redfield coef for po4     redPo4  = ', redPo4
+      WRITE(numsed,*) ' Redfield coef for carbone redC    = ', redC
+      WRITE(numsed,*) ' Redfield coef for denitri redDnit = ', redDnit
+      WRITE(numsed,*) ' reactivity for POC/O2     rcorg   = ', rcorg
+      WRITE(numsed,*) ' threshold O2 concen.      o2seuil = ', o2seuil
+      WRITE(numsed,*) ' reactivity for POC/NO3    rcorgN  = ', rcorgN
+      WRITE(numsed,*) ' '
+
+
+      so2ut  = redO2   / redC
+      srno3  = redNo3  / redC
+      spo4r  = redPo4  / redC
+      srDnit = redDnit / redC
+      sthro2 = o2seuil * 1.e-6 ! threshold O2 concen. in [mol.l-1]
+      ! reactivity rc in  [l.mol-1.s-1]
+      reac_poc  = rcorg / ryear
+      reac_no3 = rcorgN  / ryear
+
+
+      ! Carbonate parameters
+      !---------------------
+      READ( numnamsed, nam_cal )
+      WRITE(numsed,*) ' namelist  nam_cal'
+      WRITE(numsed,*) ' reactivity for calcite rccal = ', rccal
+      WRITE(numsed,*) ' '
+
+      ! reactivity rc in  [l.mol-1.s-1]      
+      reac_cal = rccal / ryear
+
+
+      ! C13  parameters
+      !----------------
+      READ( numnamsed, nam_dc13 )
+      WRITE(numsed,*) ' namelist nam_dc13 ' 
+      WRITE(numsed,*) ' 13C/12C in PD Belemnite        PDB    = ', pdb
+      WRITE(numsed,*) ' 13C/12C in POC = rc13P*PDB     rc13P  = ', rc13P
+      WRITE(numsed,*) ' 13C/12C in CaCO3 = rc13Ca*PDB  rc13Ca = ', rc13Ca
+      WRITE(numsed,*) ' '
+
+      
+      ! Bioturbation parameter
+      !------------------------
+      READ( numnamsed, nam_btb )
+      WRITE(numsed,*) ' namelist nam_btb ' 
+      WRITE(numsed,*) ' coefficient for bioturbation   dbiot    = ', dbiot
+      WRITE(numsed,*) ' '
+
+      ! Unity convertion to get bioturb coefficient in [cm2.s-1]
+      db = dbiot / ( ryear * 1000. )
+
+      ! Initial value (t=0) for sediment pore water and solid components
+      !----------------------------------------------------------------
+      READ( numnamsed, nam_rst )
+      WRITE(numsed,*) ' namelist  nam_rst ' 
+      WRITE(numsed,*) '  boolean term for restart (T or F) ln_rst_sed = ', ln_rst_sed 
+      WRITE(numsed,*) ' '
+
+      CLOSE( numnamsed )
+
+   END SUBROUTINE sed_init_nam
+
+   SUBROUTINE sed_init_data
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE sed_init_data  ***
+      !!
+      !! ** Purpose :  Initialization of sediment module
+      !!               - sets initial sediment composition
+      !!                 ( only clay or reading restart file )
+      !!
+      !!   History :
+      !!        !  06-07  (C. Ethe)  original
+      !!----------------------------------------------------------------------
+ 
+      ! local variables
+      INTEGER :: &
+         ji, jk, zhipor
+
+      !--------------------------------------------------------------------
+ 
+
+      IF( .NOT. ln_rst_sed ) THEN
+
+          WRITE(numsed,*) ' Initilization of default values of sediment components'
+
+         ! default values for initial pore water concentrations [mol/l]
+         pwcp(:,:,:) = 0.
+         ! default value for initial solid component (fraction of dry weight dim=[0])
+         ! clay
+         solcp(:,:,:) = 0.
+         solcp(:,2:jpksed,jsclay) = 1.
+
+         ! Initialization of [h+] and [co3--]
+
+         zhipor = 8.
+         ! Initialization of [h+] in mol/kg
+         DO jk = 1, jpksed
+            DO ji = 1, jpoce
+               hipor (ji,jk) = 10.**( -1. * zhipor )
+            ENDDO
+         ENDDO
+
+         co3por(:,:) = 0.
+
+      ELSE   
+  
+         WRITE(numsed,*) ' Initilization of Sediment components from restart'
+
+         CALL sed_rst_read
+
+      ENDIF
+
+
+      ! Load initial Pisces Data for bot. wat. Chem and fluxes
+      CALL sed_dta ( nitsed000 ) 
+
+      ! Initialization of chemical constants
+      CALL sed_chem ( nitsed000 )
+
+      ! Stores initial sediment data for mass balance calculation
+      pwcp0 (1:jpoce,1:jpksed,1:jpwat ) = pwcp (1:jpoce,1:jpksed,1:jpwat ) 
+      solcp0(1:jpoce,1:jpksed,1:jpsol ) = solcp(1:jpoce,1:jpksed,1:jpsol) 
+
+      ! Conversion of [h+] in mol/Kg to get it in mol/l ( multiplication by density)
+      DO jk = 1, jpksed
+         hipor(1:jpoce,jk) = hipor(1:jpoce,jk) * densSW(1:jpoce)
+      ENDDO
+
+
+      ! In default case - no restart - sedco3 is run to initiate [h+] and [co32-]
+      ! Otherwise initiate values of pH and co3 read in restart
+      IF( .NOT. ln_rst_sed ) THEN
+         ! sedco3 is run to initiate[h+] [co32-] in mol/l of solution
+         CALL sed_co3 ( nitsed000 )
+
+      ENDIF
+            
+   END SUBROUTINE sed_init_data
+
+   SUBROUTINE sed_init_wri
+
+      INTEGER :: jk
+
+      WRITE(numsed,*)' '
+      WRITE(numsed,*)'======== Write summary of initial state   ============'
+      WRITE(numsed,*)' '
+      WRITE(numsed,*)' '
+      WRITE(numsed,*)'-------------------------------------------------------------------'
+      WRITE(numsed,*)' Initial Conditions '
+      WRITE(numsed,*)'-------------------------------------------------------------------'
+      WRITE(numsed,*)'dzm = dzkbot minimum to calculate ', 0.
+      WRITE(numsed,*)'Local zone : jpi, jpj : ',jpi, jpj
+      WRITE(numsed,*)'jpoce = ',jpoce,' nbtot pts = ',jpij,' nb earth pts = ',jpij - jpoce
+      WRITE(numsed,*)'sublayer thickness dz(1) [cm] : ', dz(1)
+      WRITE(numsed,*)'Coeff diff for k=1 (cm2/s) : ',diff(1)
+      WRITE(numsed,*)' nb solid comp : ',jpsol
+      WRITE(numsed,*)'(1=opal,2=clay,3=POC,4=CaCO3)'
+      WRITE(numsed,*)'weight mol 1,2,3,4'
+      WRITE(numsed,'(4(F0.2,3X))')mol_wgt(jsopal),mol_wgt(jsclay),mol_wgt(jspoc),mol_wgt(jscal)
+      WRITE(numsed,*)'nb dissolved comp',jpwat
+      WRITE(numsed,*)'(1=silicic acid,2="dissolved" clay,3=O2,4=DIC,5=Nitrate,&
+         &6=Phosphates,7=Alk))'
+      WRITE(numsed,*)'Psat (umol/l) for silicic Acid and "dissolved" clay'
+      WRITE(numsed,'(2(F0.2,3X))') sat_sil * 1e+6,  sat_clay * 1e+6
+      WRITE(numsed,*)'reaction rate rc for Op/si,Clay,POC/O2,caco3, POC/No3 (an-1)'
+      WRITE(numsed,'(5(F0.2,3X))') reac_sil * ryear, reac_clay * ryear, reac_poc * ryear, &
+                                   reac_cal * ryear, reac_no3 * ryear
+      WRITE(numsed,*)'redfield coef C,O,N P Dit '
+      WRITE(numsed,'(5(F0.2,3X))')1./spo4r,so2ut/spo4r,srno3/spo4r,spo4r/spo4r,srDnit/spo4r
+      WRITE(numsed,*)'threshold for stating denitrification [mol/l]'
+      WRITE(numsed,'(1PE8.2)') sthrO2
+      WRITE(numsed,*)'-------------------------------------------------------------------'
+      WRITE(numsed,*)'Min-Max-Mean'
+      WRITE(numsed,*)'For each variable : min, max, moy value observed on selected local zone'
+      WRITE(numsed,*)'-------------------------------------------------------------------'
+      WRITE(numsed,*)'thickness of the last wet layer dzkbot [m]'
+      WRITE(numsed,'(3(F0.2,3X))') MINVAL(dzkbot(1:jpoce))/100.,MAXVAL(dzkbot(1:jpoce))/100.,&
+         &SUM(dzkbot(1:jpoce))/jpoce/100.
+      WRITE(numsed,*)'temp [°C]'
+      WRITE(numsed,'(3(F0.2,3X))') MINVAL(temp(1:jpoce)),MAXVAL(temp(1:jpoce)),&
+         &                         SUM(temp(1:jpoce))/jpoce
+      WRITE(numsed,*)'salt o/oo'
+      WRITE(numsed,'(3(F0.2,3X))')MINVAL(salt(1:jpoce)),MAXVAL(salt(1:jpoce)),&
+         &                        SUM(salt(1:jpoce))/jpoce
+#if defined key_sed_off
+      WRITE(numsed,*)'pressure [bar] (depth in m is about 10*pressure)'
+      WRITE(numsed,'(3(F0.2,3X))') MINVAL(press(1:jpoce)),MAXVAL(press(1:jpoce)),&
+         &                         SUM(press(1:jpoce))/jpoce
+#endif
+      WRITE(numsed,*)'density of Sea Water'
+      WRITE(numsed,'(3(F0.2,3X))') MINVAL(densSW(1:jpoce)), MAXVAL(densSW(1:jpoce)),&
+         &                         SUM(densSW(1:jpoce))/jpoce
+      WRITE(numsed,*)''
+      WRITE(numsed,*)'     Dissolved Components '
+      WRITE(numsed,*)'     ====================='
+      WRITE(numsed,*)'[Si(OH)4] dissolved (1)(k=1)(µmol/l)(and min value in mol/kg  of solution)'
+      WRITE(numsed,'(4(F0.3,2X))') MINVAL(pwcp(1:jpoce,1,jwsil))*1.e+6,MAXVAL(pwcp(1:jpoce,1,jwsil))*1.e+6,&
+         &                         SUM(pwcp(1:jpoce,1,jwsil))*1.e+6/jpoce,&
+         &                         MINVAL(pwcp(1:jpoce,1,jwsil)*1.e+6/densSW(1:jpoce))
+      WRITE(numsed,*)'[O2]    dissolved (3) (k=1)(µmol/l)(and min value in mol/kg  of solution)'
+      WRITE(numsed,'(4(F0.3,2X))') MINVAL(pwcp(1:jpoce,1,jwoxy))*1.e+6,MAXVAL(pwcp(1:jpoce,1,jwoxy))*1.e+6,&
+         &SUM(pwcp(1:jpoce,1,jwoxy))*1.e+6/jpoce,&
+         &MINVAL(pwcp(1:jpoce,1,jwoxy)*1.e+6/densSW(1:jpoce))
+      WRITE(numsed,*)'[DIC]    dissolved (4) (k=1)(µmol/l)(and min value in mol/kg  of solution)'
+      WRITE(numsed,'(4(F0.3,2X))') MINVAL(pwcp(1:jpoce,1,jwdic))*1.e+6,MAXVAL(pwcp(1:jpoce,1,jwdic))*1.e+6,&
+         &SUM(pwcp(1:jpoce,1,jwdic))*1.e+6/jpoce,&
+         &MINVAL(pwcp(1:jpoce,1,jwdic)*1.e+6/densSW(1:jpoce))
+      WRITE(numsed,*)'[NO3]    dissolved (5) (k=1)(µmol/l)(and min value in mol/kg  of solution)'
+      WRITE(numsed,'(4(F0.3,2X))') MINVAL(pwcp(1:jpoce,1,jwno3))*1.e+6,MAXVAL(pwcp(1:jpoce,1,jwno3))*1.e+6,&
+         &SUM(pwcp(1:jpoce,1,jwno3))*1.e+6/jpoce,&
+         &MINVAL(pwcp(1:jpoce,1,jwno3)*1.e+6/densSW(1:jpoce))
+      WRITE(numsed,*)'[PO4]    dissolved (6) (k=1)(µmol/l)(and min value in mol/kg  of solution)'
+      WRITE(numsed,'(4(F0.3,2X))') MINVAL(pwcp(1:jpoce,1,jwpo4))*1.e+6,MAXVAL(pwcp(1:jpoce,1,jwpo4))*1.e+6,&
+         &SUM(pwcp(1:jpoce,1,jwpo4))*1.e+6/jpoce,&
+         &MINVAL(pwcp(1:jpoce,1,jwpo4)*1.e+6/densSW(1:jpoce))
+      WRITE(numsed,*)'[Alk]    dissolved (7) (k=1)(µequi)(and min value in mol/kg  of solution)'
+      WRITE(numsed,'(4(F0.3,2X))') MINVAL(pwcp(1:jpoce,1,jwalk))*1.e+6,MAXVAL(pwcp(1:jpoce,1,jwalk))*1.e+6,&
+         &SUM(pwcp(1:jpoce,1,jwalk))*1.e+6/jpoce,&
+         &MINVAL(pwcp(1:jpoce,1,jwalk)*1.e+6/densSW(1:jpoce))
+      WRITE(numsed,*)'[DIC13]  dissolved (8) (k=1)(µmol/l)(and min value in mol/kg  of solution)'
+      WRITE(numsed,'(4(F0.3,2X))') MINVAL(pwcp(1:jpoce,1,jwc13))*1.e+6,MAXVAL(pwcp(1:jpoce,1,jwc13))*1.e+6,&
+         &SUM(pwcp(1:jpoce,1,jwc13))*1.e+6/jpoce,&
+         &MINVAL(pwcp(1:jpoce,1,jwc13)*1.e+6/densSW(1:jpoce))
+      WRITE(numsed,*)''
+      WRITE(numsed,*)'     Solid Components '
+      WRITE(numsed,*)'     ====================='
+      WRITE(numsed,*)'nmole of Opale rained per dt'
+      WRITE(numsed,'(3(1PE9.3,2X))') MINVAL(rainrm(1:jpoce,jsopal))*dtsed,MAXVAL(rainrm(1:jpoce,jsopal))*dtsed,&
+         &SUM(rainrm(1:jpoce,1))*dtsed/jpoce
+      WRITE(numsed,*)'nmole of Clay rained per dt'
+      WRITE(numsed,'(3(1PE9.3,2X))') MINVAL(rainrm(1:jpoce,jsclay))*dtsed,MAXVAL(rainrm(1:jpoce,jsclay))*dtsed,&
+         &SUM(rainrm(1:jpoce,jsclay))*dtsed/jpoce
+      WRITE(numsed,*)'nmole of POC rained per dt'
+      WRITE(numsed,'(3(1PE9.3,2X))') MINVAL(rainrm(1:jpoce,jspoc))*dtsed,MAXVAL(rainrm(1:jpoce,jspoc))*dtsed,&
+         &SUM(rainrm(1:jpoce,jspoc))*dtsed/jpoce
+      WRITE(numsed,*)'nmole of CaCO3 rained per dt'
+      WRITE(numsed,'(3(1PE9.3,2X))') MINVAL(rainrm(1:jpoce,jscal))*dtsed,MAXVAL(rainrm(1:jpoce,jscal))*dtsed,&
+         &SUM(rainrm(1:jpoce,jscal))*dtsed/jpoce
+      WRITE(numsed,*)' '
+      WRITE(numsed,*)'Weight frac of opal rained (%) '
+      WRITE(numsed,'(3(F0.3,7X))') MINVAL(rainrg(1:jpoce,jsopal)/raintg(1:jpoce))*100.,&
+         &MAXVAL(rainrg(1:jpoce,jsopal)/raintg(1:jpoce))*100.,&
+         & SUM(rainrg(1:jpoce,jsopal)/raintg(1:jpoce))*100./jpoce
+      WRITE(numsed,*)'Weight frac of clay  rained (%) '
+      WRITE(numsed,'(3(F0.3,7X))') MINVAL(rainrg(1:jpoce,jsclay)/raintg(1:jpoce))*100.,&
+         &MAXVAL(rainrg(1:jpoce,jsclay)/raintg(1:jpoce))*100.,&
+         &SUM(rainrg(1:jpoce,jsclay)/raintg(1:jpoce))*100./jpoce
+      WRITE(numsed,*)'Weight frac of POC rained (%)'
+      WRITE(numsed,'(3(F0.3,7X))') MINVAL(rainrg(1:jpoce,jspoc)/raintg(1:jpoce))*100.,&
+         &MAXVAL(rainrg(1:jpoce,jspoc)/raintg(1:jpoce))*100.,&
+         &SUM(rainrg(1:jpoce,jspoc)/raintg(1:jpoce))*100./jpoce
+      WRITE(numsed,*)'Weight frac of CaCO3  rained (%)'
+      WRITE(numsed,'(3(F0.3,7X))') MINVAL(rainrg(1:jpoce,jscal)/raintg(1:jpoce))*100.,&
+         &MAXVAL(rainrg(1:jpoce,jscal)/raintg(1:jpoce))*100.,&
+         &SUM(rainrg(1:jpoce,jscal)/raintg(1:jpoce))*100./jpoce
+      WRITE(numsed,*)''
+      WRITE(numsed,*)' Thickness of sediment layer added by particule rain, dzdep cm '
+      WRITE(numsed,*)' =============================================================='
+      WRITE(numsed,'(3(F0.5,2X))') MINVAL(dzdep(1:jpoce)),MAXVAL(dzdep(1:jpoce)),SUM(dzdep(1:jpoce))/jpoce
+      WRITE(numsed,*)''
+      WRITE(numsed,*)' chemical constants K1,pK1,K2,pK2,Kw,pKw and Kb pKb (min max) [mol/kgsol] or [mol/kgsol]2 '
+      WRITE(numsed,*)' ========================================================================================='
+      WRITE(numsed,'(4(1PE10.3,2X))')MINVAL(ak1s(1:jpoce)),MAXVAL(ak1s(1:jpoce)),-LOG10(MINVAL(ak1s(1:jpoce))),&
+         &-LOG10(MAXVAL(ak1s(1:jpoce)))
+      WRITE(numsed,'(4(1PE10.3,2X))')MINVAL(ak2s(1:jpoce)),MAXVAL(ak2s(1:jpoce)),-LOG10(MINVAL(ak2s(1:jpoce))),&
+         &-LOG10(MAXVAL(ak2s(1:jpoce)))
+      WRITE(numsed,'(4(1PE10.3,2X))')MINVAL(akws(1:jpoce)),MAXVAL(akws(1:jpoce)),-LOG10(MINVAL(akws(1:jpoce))),&
+         &-LOG10(MAXVAL(akws(1:jpoce)))
+      WRITE(numsed,'(4(1PE10.3,2X))')MINVAL(akbs(1:jpoce)),MAXVAL(akbs(1:jpoce)),-LOG10(MINVAL(akbs(1:jpoce))),&
+         &-LOG10(MAXVAL(akbs(1:jpoce)))
+      WRITE(numsed,*)'and boron'
+      WRITE(numsed,'(2(1PE10.3,2X))')MINVAL(borats(1:jpoce)),MAXVAL(borats(1:jpoce))
+      WRITE(numsed,*)''
+      WRITE(numsed,*)' Compo of initial sediment for point jpoce'
+      WRITE(numsed,*)' ========================================='
+      WRITE(numsed,*)'solcp(1),   solcp(2),   solcp(3),   solcp(4),   hipor,      pH,         co3por'
+      DO jk = 1,jpksed
+         WRITE(numsed,'(7(1PE10.3,2X))')solcp(jpoce,jk,jsopal),solcp(jpoce,jk,jsclay),solcp(jpoce,jk,jspoc),solcp(jpoce,jk,jscal),&
+            &       hipor(jpoce,jk),-LOG10(hipor(jpoce,jk)/densSW(jpoce)),co3por(jpoce,jk)
+      ENDDO
+      WRITE(numsed,'(A82)')'pwcp(1),    pwcp(2),    pwcp(3),    pwcp(4),    pwcp(5),    pwcp(6),    pwcp(7)'
+      DO jk = 1, jpksed
+         WRITE(numsed,'(7(1PE10.3,2X))')pwcp(jpoce,jk,jwsil),pwcp(jpoce,jk,jwoxy),pwcp(jpoce,jk,jwdic),&
+            & pwcp(jpoce,jk,jwno3),pwcp(jpoce,jk,jwpo4),pwcp(jpoce,jk,jwalk),pwcp(jpoce,jk,jwc13)
+      ENDDO
+      WRITE(numsed,*) ' '
+      WRITE(numsed,*) ' End Of Initialization '
+      WRITE(numsed,*) ' '
+!
+   END SUBROUTINE sed_init_wri
+#else
+   !!----------------------------------------------------------------------
+   !!   Dummy module :                      NO Sediment model
+   !!----------------------------------------------------------------------
+CONTAINS
+   SUBROUTINE sed_ini              ! Empty routine
+   END SUBROUTINE sed_ini
+#endif
+
+
+END MODULE sedini
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedmat.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedmat.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedmat.F90	(revision 3680)
@@ -0,0 +1,265 @@
+MODULE sedmat
+#if defined key_sed
+   !!======================================================================
+   !!              ***  MODULE  sedmat  ***
+   !!    Sediment : linear system of equations
+   !!=====================================================================
+   !! * Modules used
+   !!----------------------------------------------------------------------
+
+   USE sed     ! sediment global variable
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC sed_mat 
+
+   INTERFACE sed_mat
+      MODULE PROCEDURE sed_mat_dsr, sed_mat_btb
+   END INTERFACE
+
+   INTEGER, PARAMETER :: nmax = 30 
+
+
+ CONTAINS
+
+    SUBROUTINE sed_mat_dsr( nvar, ndim, nlev, preac, psol )
+       !!---------------------------------------------------------------------
+       !!                  ***  ROUTINE sed_mat_dsr  ***
+       !!
+       !! ** Purpose :  solves tridiagonal system of linear equations 
+       !!
+       !! ** Method  : 
+       !!        1 - computes left hand side of linear system of equations
+       !!            for dissolution reaction
+       !!         For mass balance in kbot+sediment :
+       !!              dz3d  (:,1) = dz(1) = 0.5 cm
+       !!              volw3d(:,1) = dzkbot ( see sedini.F90 ) 
+       !!              dz(2)       = 0.3 cm 
+       !!              dz3d(:,2)   = 0.3 + dzdep   ( see seddsr.F90 )     
+       !!              volw3d(:,2) and vols3d(l,2) are thickened ( see seddsr.F90 ) 
+       !!
+       !!         2 - forward/backward substitution. 
+       !!
+       !!   History :
+       !!        !  04-10 (N. Emprin, M. Gehlen ) original
+       !!        !  06-04 (C. Ethe)  Module Re-organization
+       !!----------------------------------------------------------------------
+       !! * Arguments
+       INTEGER , INTENT(in) ::  nvar  ! number of variables
+       INTEGER , INTENT(in) ::  ndim  ! number of points
+       INTEGER , INTENT(in) ::  nlev  ! number of sediment levels
+
+       REAL(wp), DIMENSION(ndim,nlev,nvar), INTENT(in   ) :: preac  ! reaction rates
+       REAL(wp), DIMENSION(ndim,nlev,nvar), INTENT(inout) :: psol   ! solution ( undersaturation values )
+ 
+       !---Local declarations
+       INTEGER  ::  ji, jk, jn
+       REAL(wp), DIMENSION(ndim,nlev) :: za, zb, zc, zr
+       REAL(wp), DIMENSION(ndim)      :: zbet
+       REAL(wp), DIMENSION(ndim,nmax) :: zgamm
+
+       REAL(wp) ::  aplus,aminus  
+       REAL(wp) ::  rplus,rminus   
+       REAL(wp) ::  dxplus,dxminus
+
+       !----------------------------------------------------------------------
+
+
+       ! Computation left hand side of linear system of 
+       ! equations for dissolution reaction
+       !---------------------------------------------
+
+
+       ! first sediment level          
+       DO ji = 1, ndim
+          aplus  = ( ( volw3d(ji,1) / dz3d(ji,1) ) + &
+                     ( volw3d(ji,2) / dz3d(ji,2) ) ) / 2.
+          dxplus = ( dz3d(ji,1) + dz3d(ji,2) ) / 2.
+          rplus  = ( dtsed / volw3d(ji,1) ) * diff(1) * aplus / dxplus 
+
+          za(ji,1) = 0.
+          zb(ji,1) = 1. + rplus
+          zc(ji,1) = -rplus
+       ENDDO
+ 
+       DO jk = 2, nlev - 1
+          DO ji = 1, ndim
+             aminus  = ( ( volw3d(ji,jk-1) / dz3d(ji,jk-1) ) + &
+                &        ( volw3d(ji,jk  ) / dz3d(ji,jk  ) ) ) / 2.
+             dxminus = ( dz3d(ji,jk-1) + dz3d(ji,jk) ) / 2.
+
+             aplus   = ( ( volw3d(ji,jk  ) / dz3d(ji,jk  ) ) + &
+                &        ( volw3d(ji,jk+1) / dz3d(ji,jk+1) ) ) / 2.
+             dxplus  = ( dz3d(ji,jk) + dz3d(ji,jk+1) ) / 2
+             !
+             rminus  = ( dtsed / volw3d(ji,jk) ) * diff(jk-1) * aminus / dxminus
+             rplus   = ( dtsed / volw3d(ji,jk) ) * diff(jk)   * aplus / dxplus
+             !     
+             za(ji,jk) = -rminus
+             zb(ji,jk) = 1. + rminus + rplus 
+             zc(ji,jk) = -rplus
+          END DO
+       END DO
+
+       DO ji = 1, ndim
+          aminus  = ( ( volw3d(ji,nlev-1) / dz3d(ji,nlev-1) ) + &
+             &        ( volw3d(ji,nlev)  / dz3d(ji,nlev) ) ) / 2.
+          dxminus = ( dz3d(ji,nlev-1) + dz3d(ji,nlev) ) / 2.
+          rminus  = ( dtsed / volw3d(ji,nlev) ) * diff(nlev-1) * aminus / dxminus
+          !
+          za(ji,nlev) = -rminus
+          zb(ji,nlev) = 1. + rminus
+          zc(ji,nlev) = 0.
+       END DO
+
+
+       ! solves tridiagonal system of linear equations 
+       ! -----------------------------------------------
+
+       DO jn = 1, nvar
+
+          zr  (:,:)    = psol(:,:,jn)
+          zbet(:  )    = zb(:,1) + preac(:,1,jn)
+          psol(:,1,jn) = zr(:,1) / zbet(:)
+          ! 
+          DO jk = 2, nlev
+             DO ji = 1, ndim
+                zgamm(ji,jk)   =  zc(ji,jk-1) / zbet(ji)
+                zbet(ji)       = ( zb(ji,jk) + preac(ji,jk,jn) ) - za(ji,jk) * zgamm(ji,jk)
+                psol(ji,jk,jn) = ( zr(ji,jk) - za(ji,jk) * psol(ji,jk-1,jn) ) / zbet(ji)
+             END DO
+          ENDDO
+          ! 
+          DO jk = nlev - 1, 1, -1
+             DO ji = 1,ndim
+                psol(ji,jk,jn) = psol(ji,jk,jn) - zgamm(ji,jk+1) * psol(ji,jk+1,jn)
+             END DO
+          ENDDO
+
+       ENDDO
+
+
+    END SUBROUTINE sed_mat_dsr
+
+    
+    SUBROUTINE sed_mat_btb( nvar, ndim, nlev, psol )
+       !!---------------------------------------------------------------------
+       !!                  ***  ROUTINE sed_mat_btb  ***
+       !!
+       !! ** Purpose :  solves tridiagonal system of linear equations 
+       !!
+       !! ** Method  : 
+       !!        1 - computes left hand side of linear system of equations
+       !!            for dissolution reaction
+       !!
+       !!         2 - forward/backward substitution. 
+       !!
+       !!   History :
+       !!        !  04-10 (N. Emprin, M. Gehlen ) original
+       !!        !  06-04 (C. Ethe)  Module Re-organization
+       !!----------------------------------------------------------------------
+       !! * Arguments
+       INTEGER , INTENT(in) :: &
+          nvar , &  ! number of variables
+          ndim , &  ! number of points
+          nlev      ! number of sediment levels
+
+      REAL(wp), DIMENSION(ndim,nlev,nvar), INTENT(inout) :: &
+          psol      ! solution
+
+       !---Local declarations
+       INTEGER  ::  &
+          ji, jk, jn
+
+       REAL(wp) ::  &
+          aplus,aminus   ,  & 
+          rplus,rminus   ,  &
+          dxplus,dxminus 
+
+       REAL(wp), DIMENSION(nlev)      :: za, zb, zc
+       REAL(wp), DIMENSION(ndim,nlev) :: zr
+       REAL(wp), DIMENSION(nmax)      :: zgamm 
+       REAL(wp) ::  zbet
+
+ 
+       !----------------------------------------------------------------------
+
+       ! Computation left hand side of linear system of 
+       ! equations for dissolution reaction
+       !---------------------------------------------
+
+
+       ! first sediment level          
+       aplus  = ( ( vols(2) / dz(2) ) + ( vols(3) / dz(3) ) ) / 2.
+       dxplus = ( dz(2) + dz(3) ) / 2.
+       rplus  = ( dtsed / vols(2) ) * db * aplus / dxplus 
+
+       za(1) = 0.
+       zb(1) = 1. + rplus
+       zc(1) = -rplus
+
+             
+       DO jk = 2, nlev - 1
+          aminus  = ( ( vols(jk) / dz(jk) ) + ( vols(jk+1) / dz(jk+1) ) ) / 2.
+          dxminus = ( dz(jk) + dz(jk+1) ) / 2.
+          rminus  = ( dtsed / vols(jk+1) ) * db * aminus / dxminus
+          !
+          aplus   = ( ( vols(jk+1) / dz(jk+1  ) ) + ( vols(jk+2) / dz(jk+2) ) ) / 2.
+          dxplus  = ( dz(jk+1) + dz(jk+2) ) / 2.
+          rplus   = ( dtsed / vols(jk+1) ) * db * aplus / dxplus
+          !     
+          za(jk) = -rminus
+          zb(jk) = 1. + rminus + rplus 
+          zc(jk) = -rplus
+       ENDDO
+ 
+       aminus  = ( ( vols(nlev) / dz(nlev) ) + ( vols(nlev+1) / dz(nlev+1) ) ) / 2.
+       dxminus = ( dz(nlev) + dz(nlev+1) ) / 2.
+       rminus  = ( dtsed / vols(nlev+1) ) * db * aminus / dxminus
+       !
+ 
+       za(nlev) = -rminus
+       zb(nlev) = 1. + rminus
+       zc(nlev) = 0.
+
+
+       ! solves tridiagonal system of linear equations 
+       ! -----------------------------------------------    
+       DO jn = 1, nvar
+          
+          zr  (:,:)    = psol(:,:,jn)
+          zbet         = zb(1)
+          psol(:,1,jn) = zr(:,1) / zbet
+          ! 
+          DO jk = 2, nlev
+             zgamm(jk) =  zc(jk-1) / zbet
+             zbet      =  zb(jk) - za(jk) * zgamm(jk)
+             DO ji = 1, ndim
+                psol(ji,jk,jn) = ( zr(ji,jk) - za(jk) * psol(ji,jk-1,jn) ) / zbet
+             END DO
+          ENDDO
+          ! 
+          DO jk = nlev - 1, 1, -1
+             DO ji = 1,ndim
+                psol(ji,jk,jn) = psol(ji,jk,jn) - zgamm(jk+1) * psol(ji,jk+1,jn)
+             END DO
+          ENDDO
+
+       ENDDO
+
+       
+    END SUBROUTINE sed_mat_btb
+
+
+#else
+   !!======================================================================
+   !! MODULE sedmat  :   Dummy module 
+   !!======================================================================
+CONTAINS
+   SUBROUTINE sed_mat         ! Empty routine
+   END SUBROUTINE sed_mat
+   !!======================================================================
+#endif
+
+ END MODULE sedmat
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedmbc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedmbc.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedmbc.F90	(revision 3680)
@@ -0,0 +1,319 @@
+MODULE sedmbc
+#if defined key_sed
+   !!======================================================================
+   !!              ***  MODULE  sedmbc  ***
+   !! Sediment : mass balance calculation
+   !!=====================================================================
+
+   !!----------------------------------------------------------------------
+   !!   sed_mbc    : 
+   !!----------------------------------------------------------------------
+   !! * Modules used
+   USE sed     ! sediment global variable
+   USE seddsr
+
+   IMPLICIT NONE
+   PRIVATE
+
+   !! *  Routine accessibility
+   PUBLIC sed_mbc
+
+   !! * Module variables
+   REAL(wp), DIMENSION(jpsol) :: rain_tot      ! total input rain
+   REAL(wp), DIMENSION(jpsol) :: fromsed_tot   ! tota input from sediment
+   REAL(wp), DIMENSION(jpsol) :: tosed_tot     ! total output from sediment
+   REAL(wp), DIMENSION(jpsol) :: rloss_tot     ! total rain loss
+
+   REAL(wp), DIMENSION(jpwat) :: diss_in_tot   ! total input in pore water
+   REAL(wp), DIMENSION(jpwat) :: diss_out_tot  ! total output from pore water
+
+   REAL(wp)  :: cons_tot_o2                   ! cumulative o2 consomation
+   REAL(wp)  :: sour_tot_no3                  ! cumulative no3 source
+   REAL(wp)  :: cons_tot_no3                  ! cumulative no3 consomation
+   REAL(wp)  :: sour_tot_c13                  ! cumulative o2 source
+
+   REAL(wp)  :: src13p  
+   REAL(wp)  :: src13ca  
+
+CONTAINS
+
+
+   SUBROUTINE sed_mbc( kt )
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE sed_mbc  ***
+      !!
+      !! ** Purpose :  computation of total tracer inventories for checking
+      !!               mass conservation.
+      !!
+      !!
+      !! ** Method   : tracer inventories of each reservoir are computed and added
+      !!               subsequently.
+      !!
+      !!   History :
+      !!        !  04-10  (N. Emprin, M. Gehlen )  Original code
+      !!        !  06-07  (C. Ethe)  Re-organization
+      !!----------------------------------------------------------------------
+
+      !! Arguments
+      INTEGER, INTENT(in) :: kt     ! time step
+
+      !! local declarations
+      INTEGER  :: ji,js, jw, jk
+      REAL(wp) :: zinit, zfinal 
+      REAL(wp) :: zinput, zoutput
+      REAL(wp) :: zdsw, zvol
+      REAL, DIMENSION(jpsol) :: zsolcp_inv_i, zsolcp_inv_f
+      REAL, DIMENSION(jpwat) :: zpwcp_inv_i, zpwcp_inv_f
+      REAL(wp) ::  zdelta_sil, zdelta_clay
+      REAL(wp) ::  zdelta_co2, zdelta_oxy
+      REAL(wp) ::  zdelta_po4, zdelta_no3
+      REAL(wp) ::  zdelta_c13, zdelta_c13b
+
+      !!----------------------------------------------------------------------
+      ! Initilization
+      !---------------
+      IF( kt == nitsed000 ) THEN
+         cons_tot_o2  = 0.
+         sour_tot_no3 = 0.
+         cons_tot_no3 = 0.
+         sour_tot_c13 = 0.
+
+         DO js = 1, jpsol
+            rain_tot   (js) = 0.
+            fromsed_tot(js) = 0.
+            tosed_tot  (js) = 0.
+            rloss_tot  (js) = 0.
+         ENDDO
+
+         DO jw = 1, jpwat
+            diss_in_tot (jw) = 0.
+            diss_out_tot(jw) = 0.
+         ENDDO
+
+         src13p  = rc13P  * pdb
+         src13ca = rc13Ca * pdb
+      ENDIF
+
+
+      ! Calculation of the cumulativ input and output
+      ! for mass balance check
+      !----------------------------------------------
+
+      ! cumulativ solid
+      DO js = 1, jpsol
+         DO ji = 1, jpoce
+            ! input [mol]
+            rain_tot   (js) = rain_tot   (js) + dtsed * rainrm_dta(ji,js)
+            fromsed_tot(js) = fromsed_tot(js) + fromsed(ji,js)
+            ! output [mol]
+            tosed_tot  (js) = tosed_tot (js) + tosed(ji,js)
+            rloss_tot  (js) = rloss_tot (js) + rloss(ji,js)
+         ENDDO
+      ENDDO
+
+      ! cumulativ dissolved
+      DO jw = 1, jpwat
+         DO ji = 1, jpoce
+            ! input [mol]
+            diss_in_tot (jw) = diss_in_tot (jw) + pwcp_dta(ji,jw) * 1.e-3 * dzkbot(ji)
+            ! output [mol]
+            diss_out_tot(jw) = diss_out_tot(jw) + tokbot(ji,jw)
+         ENDDO
+      ENDDO
+
+      ! cumulativ o2 and no3 consomation
+      DO ji = 1, jpoce
+         cons_tot_o2  = cons_tot_o2  + cons_o2 (ji)
+         sour_tot_no3 = sour_tot_no3 + sour_no3(ji)
+         cons_tot_no3 = cons_tot_no3 + cons_no3(ji)
+         sour_tot_c13 = sour_tot_c13 + sour_c13(ji)
+      ENDDO
+     
+
+      ! Mass balance check
+      !---------------------
+      IF( kt == nitsedend ) THEN
+         ! initial and final inventories for solid component (mole/dx.dy) in sediment
+         zsolcp_inv_i(:) = 0.
+         zsolcp_inv_f(:) = 0.
+         zpwcp_inv_i (:) = 0.       
+         zpwcp_inv_f (:) = 0.        
+         DO js = 1, jpsol
+            zdsw = dens / mol_wgt(js)
+            DO jk = 2, jpksed
+               DO ji = 1, jpoce
+                  zvol = vols3d(ji,jk) * zdsw
+                  zsolcp_inv_i(js) = zsolcp_inv_i(js) + solcp0(ji,jk,js) * zvol 
+                  zsolcp_inv_f(js) = zsolcp_inv_f(js) + solcp (ji,jk,js) * zvol
+               ENDDO
+            END DO
+         ENDDO
+
+         ! initial and final inventories for dissolved component (mole/dx.dy) in sediment
+         DO jw = 1, jpwat
+            DO jk = 2, jpksed
+               DO ji = 1, jpoce 
+                  zvol = volw3d(ji,jk) * 1.e-3
+                  zpwcp_inv_i(jw) = zpwcp_inv_i(jw) + pwcp0(ji,jk,jw) * zvol
+                  zpwcp_inv_f(jw) = zpwcp_inv_f(jw) + pwcp (ji,jk,jw) * zvol
+               ENDDO
+            END DO
+         ENDDO
+
+         ! mass balance for Silica/opal
+         zinit      = zsolcp_inv_i(jsopal) + zpwcp_inv_i(jwsil)
+         zfinal     = zsolcp_inv_f(jsopal) + zpwcp_inv_f(jwsil)
+         zinput     = rain_tot    (jsopal) + diss_in_tot (jwsil)
+         zoutput    = tosed_tot   (jsopal) + rloss_tot  (jsopal) + diss_out_tot(jwsil)
+         zdelta_sil = ( zfinal + zoutput ) - ( zinit + zinput )
+
+
+         ! mass balance for Clay
+         zinit      = zsolcp_inv_i(jsclay) 
+         zfinal     = zsolcp_inv_f(jsclay) 
+         zinput     = rain_tot   (jsclay) + fromsed_tot(jsclay) 
+         zoutput    = tosed_tot  (jsclay) + rloss_tot  (jsclay) 
+         zdelta_clay= ( zfinal + zoutput ) - ( zinit + zinput )
+
+         ! mass balance for carbon ( carbon in POC, CaCo3, DIC )
+         zinit      = zsolcp_inv_i(jspoc) + zsolcp_inv_i(jscal) + zpwcp_inv_i(jwdic)
+         zfinal     = zsolcp_inv_f(jspoc) + zsolcp_inv_f(jscal) + zpwcp_inv_f(jwdic)
+         zinput     = rain_tot   (jspoc) + rain_tot   (jscal) + diss_in_tot(jwdic)
+         zoutput    = tosed_tot  (jspoc) + tosed_tot  (jscal) + diss_out_tot(jwdic) &
+            &       + rloss_tot  (jspoc) + rloss_tot  (jscal) 
+         zdelta_co2 = ( zfinal + zoutput ) - ( zinit + zinput )
+
+         ! mass balance for oxygen : O2 is in POC remineralization
+         zinit      = zpwcp_inv_i(jwoxy)
+         zfinal     = zpwcp_inv_f(jwoxy)
+         zinput     = diss_in_tot(jwoxy)
+         zoutput    = diss_out_tot(jwoxy) + cons_tot_o2
+         zdelta_oxy = ( zfinal + zoutput ) - ( zinit + zinput )
+
+         ! mass balance for phosphate ( PO4 in POC and dissolved phosphates )
+         zinit      = zsolcp_inv_i(jspoc) * spo4r + zpwcp_inv_i(jwpo4)
+         zfinal     = zsolcp_inv_f(jspoc) * spo4r + zpwcp_inv_f(jwpo4)
+         zinput     = rain_tot   (jspoc) * spo4r + diss_in_tot(jwpo4)
+         zoutput    = tosed_tot  (jspoc) * spo4r + diss_out_tot(jwpo4) &
+            &       + rloss_tot  (jspoc) * spo4r
+         zdelta_po4 = ( zfinal + zoutput ) - ( zinit + zinput )
+
+
+         ! mass balance for Nitrate
+         zinit      = zpwcp_inv_i  (jwno3)
+         zfinal     = zpwcp_inv_f  (jwno3)
+         zinput     = diss_in_tot (jwno3) + sour_tot_no3
+         zoutput    = diss_out_tot(jwno3) + cons_tot_no3
+         zdelta_no3 = ( zfinal + zoutput ) - ( zinit + zinput )
+
+         ! mass balance for DIC13
+         zinit      =  zpwcp_inv_i(jwc13)   &
+            &        + src13p * zsolcp_inv_i(jspoc) + src13Ca * zsolcp_inv_i(jscal) 
+         zfinal     =  zpwcp_inv_f(jwc13)   &
+            &        + src13p * zsolcp_inv_f(jspoc) + src13Ca * zsolcp_inv_f(jscal)
+         zinput     =  diss_in_tot (jwc13)  &
+            &        + src13p * rain_tot(jspoc) + src13Ca * rain_tot(jscal)
+         zoutput    =  diss_out_tot(jwc13)  &
+            &        + src13p * tosed_tot(jspoc) + src13Ca * tosed_tot(jscal) &   
+            &        + src13p * rloss_tot(jspoc) + src13Ca * rloss_tot(jscal)
+         zdelta_c13 = ( zfinal + zoutput ) - ( zinit + zinput )
+
+         ! other mass balance for DIC13
+         zinit      = zpwcp_inv_i  (jwc13)
+         zfinal     = zpwcp_inv_f  (jwc13)
+         zinput     = diss_in_tot (jwc13) + sour_tot_c13
+         zoutput    = diss_out_tot(jwc13)
+         zdelta_c13b= ( zfinal + zoutput ) - ( zinit + zinput )    
+
+      END IF
+
+      IF( kt == nitsedend) THEN 
+
+         WRITE(numsed,*)
+         WRITE(numsed,*)'==================    General mass balance   ==================  '
+         WRITE(numsed,*)' '
+         WRITE(numsed,*)' '
+         WRITE(numsed,*)' Initial total solid Masses (mole/dx.dy) (k=2-11) '
+         WRITE(numsed,*)' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numsed,*)'    Opale,      Clay,       POC,        CaCO3,         C13'
+         WRITE(numsed,'(4x,5(1PE10.3,2X))')zsolcp_inv_i(jsopal),zsolcp_inv_i(jsclay),zsolcp_inv_i(jspoc), &
+            & zsolcp_inv_i(jscal),( src13P * zsolcp_inv_i(jspoc) + src13Ca * zsolcp_inv_i(jscal) )
+         WRITE(numsed,*)' '
+         WRITE(numsed,*)' Initial total dissolved Masses (mole/dx.dy) (k=2-11) '
+         WRITE(numsed,*)' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numsed,*)'    Si,         O2,         DIC,        Nit         Phos,       DIC13'
+         WRITE(numsed,'(4x,6(1PE10.3,2X))') zpwcp_inv_i(jwsil), zpwcp_inv_i(jwoxy), &
+            & zpwcp_inv_i(jwdic), zpwcp_inv_i(jwno3), zpwcp_inv_i(jwpo4), zpwcp_inv_i(jwc13)
+         WRITE(numsed,*)' '
+         WRITE(numsed,*)'  Solid inputs :  Opale,      Clay,       POC,        CaCO3,         C13'
+         WRITE(numsed,'(A4,10X,5(1PE10.3,2X))')'Rain : ',rain_tot(jsopal),rain_tot(jsclay),rain_tot(jspoc),&
+            & rain_tot(jscal),( src13P * rain_tot(jspoc) + src13Ca * rain_tot(jscal) )
+         WRITE(numsed,'(A12,6x,4(1PE10.3,2X))')' From Sed : ',fromsed_tot(jsopal), fromsed_tot(jsclay), &
+            & fromsed_tot(jspoc), fromsed_tot(jscal)
+         WRITE(numsed,*)'Diss. inputs : Si,    O2,         DIC,         Nit,       Phos,       DIC13'
+         WRITE(numsed,'(A9,1x,6(1PE10.3,2X))')' From Pisc : ', diss_in_tot(jwsil), &
+            & diss_in_tot(jwoxy), diss_in_tot(jwdic), diss_in_tot(jwno3), diss_in_tot(jwpo4), &
+            & diss_in_tot(jwc13)
+         WRITE(numsed,*)' '
+         WRITE(numsed,*)'Solid output : Opale,      Clay,       POC,        CaCO3,          C13'
+         WRITE(numsed,'(A6,8x,5(1PE10.3,2X))')'To sed', tosed_tot(jsopal),tosed_tot(jsclay),tosed_tot(jspoc),&
+            & tosed_tot(jscal),( src13P * tosed_tot(jspoc) + src13Ca * tosed_tot(jscal) )
+         WRITE(numsed,'(A5,9x,5(1PE10.3,2X))')'Perdu', rloss_tot(jsopal),rloss_tot(jsclay),rloss_tot(jspoc),&
+            & rloss_tot(jscal),( src13P * rloss_tot(jspoc) + src13Ca * rloss_tot(jscal) )
+         WRITE(numsed,*)'Diss. output : Si,     O2,        DIC,          Nit,       Phos,       DIC13 '  
+         WRITE(numsed,'(A7,2x,6(1PE10.3,2X))')'To kbot', diss_out_tot(jwsil), &
+            & diss_out_tot(jwoxy), diss_out_tot(jwdic), diss_out_tot(jwno3), diss_out_tot(jwpo4), &
+            & diss_out_tot(jwc13)
+         WRITE(numsed,*)' '
+         WRITE(numsed,*)' Total consomation in POC remineralization [mol]:  O2,         NO3'
+         WRITE(numsed,'(51x,2(1PE10.3,2X))') cons_tot_o2,cons_tot_no3
+         WRITE(numsed,*)' '
+         WRITE(numsed,*)'Final solid  Masses (mole/dx.dy) (k=2-11)'
+         WRITE(numsed,*)'    Opale,      Clay,       POC,        CaCO3,          C13'
+         WRITE(numsed,'(4x,5(1PE10.3,2X))')zsolcp_inv_f(jsopal),zsolcp_inv_f(jsclay),zsolcp_inv_f(jspoc), &
+            & zsolcp_inv_f(jscal),( src13P * zsolcp_inv_f(jspoc) + src13Ca * zsolcp_inv_f(jscal) )
+         WRITE(numsed,*)' '
+         WRITE(numsed,*)'Final dissolved  Masses (mole/dx.dy) (k=2-11)'
+         WRITE(numsed,*)'    Si,        O2,         DIC,        Nit,        Phos,    DIC13'
+         WRITE(numsed,'(4x,6(1PE10.3,2X))') zpwcp_inv_f(jwsil), zpwcp_inv_f(jwoxy), &
+            & zpwcp_inv_f(jwdic), zpwcp_inv_f(jwno3), zpwcp_inv_f(jwpo4), zpwcp_inv_f(jwc13)
+         WRITE(numsed,*)' '     
+         WRITE(numsed,*)'Delta : Opale,      Clay,       C,          O,          N,          P,        C13'
+         WRITE(numsed,'(7x,7(1PE11.3,1X))') zdelta_sil, zdelta_clay, zdelta_co2, zdelta_oxy, zdelta_no3,&
+            &                          zdelta_po4, zdelta_c13
+         WRITE(numsed,*)' ' 
+         WRITE(numsed,*)'deltaC13bis : ',zdelta_c13b     
+
+         WRITE(numsed,*)'=========================================================================='
+         WRITE(numsed,*)' Composition of final sediment for point jpoce'
+         WRITE(numsed,*)' ========================================='
+         WRITE(numsed,*)'Opale,      Clay,       POC,        CaCo3,      hipor,      pH,         co3por'
+         DO jk = 1,jpksed
+            WRITE(numsed,'(4(F8.4,4X),3(1PE10.3,2X))') solcp(jpoce,jk,jsopal)*100.,solcp(jpoce,jk,jsclay)*100.,&
+               &       solcp(jpoce,jk,jspoc)*100.,solcp(jpoce,jk,jscal)*100.,&
+               &       hipor(jpoce,jk),-LOG10(hipor(jpoce,jk)/densSW(jpoce)),co3por(jpoce,jk)
+         ENDDO
+         WRITE(numsed,*)'Silicic A.,  Oxygen,     DIC,        Nitrats,    Phosphats,  Alkal.,     DIC13'
+         DO jk = 1, jpksed
+            WRITE(numsed,'(8(1PE10.3,2X))')pwcp(jpoce,jk,jwsil),pwcp(jpoce,jk,jwoxy),&
+               & pwcp(jpoce,jk,jwdic),pwcp(jpoce,jk,jwno3),pwcp(jpoce,jk,jwpo4),pwcp(jpoce,jk,jwalk),pwcp(jpoce,jk,jwc13)
+         ENDDO
+         WRITE(numsed,*)'densSW at the end : ',densSW(jpoce)
+         WRITE(numsed,*)'=========================================================================='
+
+      ENDIF
+  
+   END SUBROUTINE sed_mbc
+
+
+#else
+   !!======================================================================
+   !! MODULE sedmbc :   Dummy module 
+   !!======================================================================
+CONTAINS
+   SUBROUTINE sed_mbc( kt )         ! Empty routine
+      INTEGER, INTENT(in) :: kt
+      WRITE(*,*) 'sed_mbc: You should not have seen this print! error?', kt
+   END SUBROUTINE sed_mbc
+#endif
+END MODULE sedmbc
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedmodel.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedmodel.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedmodel.F90	(revision 3680)
@@ -0,0 +1,56 @@
+MODULE sedmodel
+#if defined key_sed
+   !!======================================================================
+   !!                       ***  MODULE sedmodel   ***
+   !!   Sediment model : Main routine of sediment model 
+   !!======================================================================
+   USE sed
+   USE sedini   ! sediment variables initialization
+   USE sedstp   ! time stepping
+
+   IMPLICIT NONE
+   PRIVATE
+
+   !! * Routine accessibility
+   PUBLIC sed_model  ! called by step.F90
+
+   LOGICAL, PUBLIC, PARAMETER ::   lk_sed = .TRUE.     !: sediment flag
+
+CONTAINS
+
+   SUBROUTINE sed_model ( kt )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE sed_model  ***
+      !!
+      !! ** Purpose :   main routine of sediment model
+      !!
+      !!
+      !! ** Method  : - model general initialization
+      !!              - launch the time-stepping (stp routine)
+      !!
+      !!   History :
+      !!        !  07-02 (C. Ethe)  Original
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt       ! number of iteration
+
+
+      IF( kt == nittrc000 ) CALL sed_init       ! Initialization of sediment model
+
+                         CALL sed_stp( kt )  ! Time stepping of Sediment model
+
+
+   END SUBROUTINE sed_model
+
+#else
+   !!======================================================================
+   !! MODULE sedmodel  :   Dummy module 
+   !!======================================================================
+   LOGICAL, PUBLIC, PARAMETER ::   lk_sed = .FALSE.     !: sediment flag
+CONTAINS
+   SUBROUTINE sed_model( kt )         ! Empty routine
+      INTEGER, INTENT(in) :: kt
+      WRITE(*,*) 'sed_stp: You should not have seen this print! error?', kt
+   END SUBROUTINE sed_model
+#endif
+
+END MODULE sedmodel
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedrst.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedrst.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedrst.F90	(revision 3680)
@@ -0,0 +1,281 @@
+MODULE sedrst
+#if defined key_sed
+   !!======================================================================
+   !!                       *** MODULE sedrst ***
+   !!   Read and write the restart files for sediment
+   !!======================================================================
+
+   !!----------------------------------------------------------------------
+   !! * Modules used
+   !! ==============
+   USE sed
+   USE sedarr
+
+
+   !! * Accessibility
+   IMPLICIT NONE
+   PRIVATE
+
+   !! * Accessibility
+   PUBLIC sed_rst_read
+   PUBLIC sed_rst_wri
+
+   !! * Module variables
+   INTEGER, PUBLIC ::   numrsr, numrsw   !: logical unit for sed restart (read and write)
+   
+   
+CONTAINS
+
+
+   SUBROUTINE sed_rst_read 
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE sed_rst_read  ***
+      !!
+      !! ** Purpose :  Initialization of sediment module
+      !!               - sets initial sediment composition
+      !!                 ( only clay or reading restart file )
+      !!
+      !!   History :
+      !!        !  06-07  (C. Ethe)  original
+      !!----------------------------------------------------------------------
+      !! * Modules used
+      USE iom
+
+      !! * local declarations
+      INTEGER :: ji, jk, jn 
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) :: zdta
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:  ) :: zdta1 
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:    ) :: zhipor
+      REAL(wp) :: zkt
+      CHARACTER(len = 20) ::   cltra
+      INTEGER             ::   jlibalt = jprstlib
+      LOGICAL             ::   llok
+      !--------------------------------------------------------------------
+ 
+
+      WRITE(numsed,*) ' '      
+      WRITE(numsed,*) ' Initilization of Sediment components from restart'
+      WRITE(numsed,*) ' '
+
+      ALLOCATE( zdta(jpi,jpj,jpksed,jptrased), zdta1(jpi,jpj,jpksed,2), zhipor(jpoce,jpksed) ) 
+
+      IF ( jprstlib == jprstdimg ) THEN
+        ! eventually read netcdf file (monobloc)  for restarting on different number of processors
+        ! if restart_sed.nc exists, then set jlibalt to jpnf90
+        INQUIRE( FILE = 'restart_sed.nc', EXIST = llok )
+        IF ( llok ) THEN ; jlibalt = jpnf90  ; ELSE ; jlibalt = jprstlib ; ENDIF
+      ENDIF
+
+      CALL iom_open( 'restart_sed', numrsr, kiolib = jlibalt )     
+      CALL iom_get( numrsr, 'kt'     , zkt      )   ! time-step
+ 
+      DO jn = 1, jptrased
+         cltra = sedtrcd(jn)
+         CALL iom_get( numrsr, jpdom_unknown, cltra, zdta(:,:,:,jn), &
+            &          kstart=(/1,1,1/), kcount=(/jpi,jpj,jpksed/) )
+      ENDDO
+        
+
+      CALL pack_arr( jpoce, solcp(1:jpoce,1:jpksed,jsopal), &
+         &            zdta(1:jpi,1:jpj,1:jpksed,1), iarroce(1:jpoce) )
+
+      CALL pack_arr( jpoce, solcp(1:jpoce,1:jpksed,jsclay), &
+         &             zdta(1:jpi,1:jpj,1:jpksed,2), iarroce(1:jpoce) )
+
+      CALL pack_arr( jpoce, solcp(1:jpoce,1:jpksed,jspoc), &
+         &             zdta(1:jpi,1:jpj,1:jpksed,3), iarroce(1:jpoce) )
+
+      CALL pack_arr( jpoce, solcp(1:jpoce,1:jpksed,jscal), &
+         &             zdta(1:jpi,1:jpj,1:jpksed,4), iarroce(1:jpoce) )
+
+      CALL pack_arr( jpoce, pwcp(1:jpoce,1:jpksed,jwsil), &
+         &             zdta(1:jpi,1:jpj,1:jpksed,5), iarroce(1:jpoce) )
+
+
+      CALL pack_arr( jpoce, pwcp(1:jpoce,1:jpksed,jwoxy), &
+         &             zdta(1:jpi,1:jpj,1:jpksed,6), iarroce(1:jpoce) )
+
+
+      CALL pack_arr( jpoce, pwcp(1:jpoce,1:jpksed,jwdic), &
+         &             zdta(1:jpi,1:jpj,1:jpksed,7), iarroce(1:jpoce) )
+
+      CALL pack_arr( jpoce, pwcp(1:jpoce,1:jpksed,jwno3), &
+         &             zdta(1:jpi,1:jpj,1:jpksed,8), iarroce(1:jpoce) )
+
+      CALL pack_arr( jpoce, pwcp(1:jpoce,1:jpksed,jwpo4), &
+         &             zdta(1:jpi,1:jpj,1:jpksed,9), iarroce(1:jpoce) )
+
+      CALL pack_arr( jpoce, pwcp(1:jpoce,1:jpksed,jwalk), &
+         &             zdta(1:jpi,1:jpj,1:jpksed,10), iarroce(1:jpoce) )
+
+      CALL pack_arr( jpoce, pwcp(1:jpoce,1:jpksed,jwc13), &
+         &             zdta(1:jpi,1:jpj,1:jpksed,11), iarroce(1:jpoce) )
+
+      DO jn = 1, 2
+         cltra = seddia3d(jn)
+         CALL iom_get( numrsr, jpdom_unknown, cltra, zdta1(:,:,:,jn), &
+            &          kstart=(/1,1,1/), kcount=(/jpi,jpj,jpksed/) )
+      ENDDO
+
+      zhipor(:,:) = 0.
+      CALL pack_arr( jpoce, zhipor(1:jpoce,1:jpksed), &
+         &             zdta1(1:jpi,1:jpj,1:jpksed,1), iarroce(1:jpoce) )
+
+      ! Initialization of [h+] in mol/kg
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce
+            hipor (ji,jk) = 10.**( -1. * zhipor(ji,jk) )
+         ENDDO
+      ENDDO
+      
+      CALL pack_arr( jpoce, co3por(1:jpoce,1:jpksed), &
+         &             zdta1(1:jpi,1:jpj,1:jpksed,2), iarroce(1:jpoce) )
+
+      ! Initialization of sediment composant only ie jk=2 to jk=jpksed 
+      ! ( nothing in jk=1)
+      solcp(1:jpoce,1,:) = 0.
+      pwcp (1:jpoce,1,:) = 0.
+
+      DEALLOCATE( zdta   )
+      DEALLOCATE( zdta1  )
+      DEALLOCATE( zhipor )
+     
+   END SUBROUTINE sed_rst_read
+
+   SUBROUTINE sed_rst_wri( kt )
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE sed_rst_wri  ***
+      !!
+      !! ** Purpose :  save field which are necessary for sediment restart
+      !!
+      !!   History :
+      !!        !  06-07  (C. Ethe)  original
+      !!----------------------------------------------------------------------
+      !!* Modules used
+      USE ioipsl
+      !! *Arguments
+      INTEGER, INTENT(in) ::   kt       ! number of iteration
+      !! * local declarations
+      INTEGER  :: ji, jk
+      INTEGER  :: ic, jc, jn, itime 
+      REAL(wp) :: zdate0
+      REAL(wp), DIMENSION(1) ::  zinfo
+      CHARACTER(len=50) :: clname,cln
+      CHARACTER(len=20) :: cltra 
+      REAL(wp), DIMENSION(:,:) , ALLOCATABLE  :: zdta   
+      !! -----------------------------------------------------------------------
+
+      ALLOCATE( zdta(jpoce,jpksed) )
+
+      IF( MOD(kt,nstock) == 0 .OR. kt == nitsedend ) THEN
+         
+         !! 0. initialisations
+         !! ------------------
+         
+         IF(lwp) WRITE(numsed,*) ' '
+         IF(lwp) WRITE(numsed,*) 'sed_rst_write : write the sediment restart file in NetCDF format ',   &
+            'at it= ',kt
+         IF(lwp) WRITE(numsed,*) '~~~~~~~~~'
+         
+         !! 1. WRITE in nutwrs
+         !! ------------------
+
+         ic = 1
+         DO jc = 1,16
+            IF( cexper(jc:jc) /= ' ') ic = jc
+         END DO
+         WRITE( cln,'("_",i5.5,i2.2,i2.2,"_restart.sed")') nyear, nmonth, nday
+         clname = cexper(1:ic)//cln
+         itime = 0
+         CALL ymds2ju( nyear, nmonth, nday, rdt, zdate0 )
+         zdate0 = zdate0 - adatrj   !   set calendar origin to the beginning of the experiment
+         CALL restini( 'NONE', jpi, jpj, glamt, gphit, jpksed, dz, &
+            &         clname, itime, zdate0, dtsed*nstock, numrsw, domain_id=nidom )
+         zinfo(1) = REAL( kt)
+         CALL restput( numrsw, 'kt', 1,1, 1,0, zinfo  )
+
+
+
+         ! Back to 2D geometry
+         CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,1) , iarroce(1:jpoce), &
+            &                    solcp(1:jpoce,1:jpksed,jsopal ) )
+         
+         CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,2) , iarroce(1:jpoce), &
+            &                    solcp(1:jpoce,1:jpksed,jsclay ) )
+         
+         CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,3) , iarroce(1:jpoce), &
+            &                    solcp(1:jpoce,1:jpksed,jspoc  ) )
+         
+         CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,4) , iarroce(1:jpoce), &
+            &                    solcp(1:jpoce,1:jpksed,jscal  ) )   
+         
+         CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,5) , iarroce(1:jpoce), &
+            &                    pwcp(1:jpoce,1:jpksed,jwsil  )  )
+         
+         CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,6)  , iarroce(1:jpoce), &
+            &                    pwcp(1:jpoce,1:jpksed,jwoxy  ) )
+         
+         CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,7)  , iarroce(1:jpoce), &
+            &                    pwcp(1:jpoce,1:jpksed,jwdic  ) )
+         
+         CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,8)  , iarroce(1:jpoce), &
+            &                    pwcp(1:jpoce,1:jpksed,jwno3  ) )
+         
+         CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,9)  , iarroce(1:jpoce), &
+            &                    pwcp(1:jpoce,1:jpksed,jwpo4  ) )
+         
+         CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,10)  , iarroce(1:jpoce), &
+            &                    pwcp(1:jpoce,1:jpksed,jwalk  ) )
+         
+         CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,11)  , iarroce(1:jpoce), &
+         &                    pwcp(1:jpoce,1:jpksed,jwc13  ) )
+         
+         ! porosity
+         zdta(:,:) = 0.
+         DO jk = 1, jpksed
+            DO ji = 1, jpoce
+               zdta(ji,jk) = -LOG10( hipor(ji,jk) / densSW(ji) )
+            ENDDO
+         ENDDO
+         CALL unpack_arr( jpoce, flxsedi3d(1:jpi,1:jpj,1:jpksed,1)  , iarroce(1:jpoce), &
+            &                   zdta(1:jpoce,1:jpksed)  )
+         
+         CALL unpack_arr( jpoce, flxsedi3d(1:jpi,1:jpj,1:jpksed,2)  , iarroce(1:jpoce), &
+            &                   co3por(1:jpoce,1:jpksed)  )
+      
+         ! prognostic variables
+         ! --------------------
+
+
+         DO jn = 1, jptrased
+            cltra = sedtrcd(jn)
+            CALL restput( numrsw, cltra, jpi, jpj, jpksed, 0, trcsedi(:,:,:,jn) )
+         ENDDO
+
+         DO jn = 1, 2
+            cltra = seddia3d(jn)
+            CALL restput( numrsw, cltra, jpi, jpj, jpksed, 0, flxsedi3d(:,:,:,jn) )
+         ENDDO
+
+
+         CALL restclo( numrsw )
+
+      ENDIF
+
+      DEALLOCATE( zdta )  
+         
+   END SUBROUTINE sed_rst_wri
+#else
+   !!======================================================================
+   !! MODULE sedrst :   Dummy module 
+   !!======================================================================
+CONTAINS
+   SUBROUTINE sed_rst_read                      ! Empty routines
+   END SUBROUTINE sed_rst_read
+   SUBROUTINE sed_rst_wri( kt )
+      INTEGER, INTENT ( in ) :: kt
+      WRITE(*,*) 'sed_rst_wri: You should not have seen this print! error?', kt
+   END SUBROUTINE sed_rst_wri   
+#endif
+
+END MODULE sedrst
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedsfc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedsfc.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedsfc.F90	(revision 3680)
@@ -0,0 +1,76 @@
+MODULE sedsfc
+   !!======================================================================
+   !!              ***  MODULE  sedsfc  ***
+   !!    Sediment : Data at sediment surface
+   !!=====================================================================
+#if defined key_sed && ! defined key_sed_off
+   !! * Modules used
+   USE sed     ! sediment global variable
+   USE sedarr
+   USE seddta
+
+   PUBLIC sed_sfc
+
+CONTAINS
+
+   SUBROUTINE sed_sfc( kt )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE sed_sfc ***
+      !!
+      !! ** Purpose :  Give data from sediment model to tracer model
+      !!
+      !!
+      !!   History :
+      !!        !  06-04 (C. Ethe)  Orginal code
+      !!----------------------------------------------------------------------
+      !!* Arguments
+      INTEGER, INTENT(in) ::  kt              ! time step
+
+      ! * local variables
+      INTEGER :: ji, jj, ikt     ! dummy loop indices
+
+      !------------------------------------------------------------------------
+
+      IF( kt == nitsed000 ) THEN
+         WRITE(numsed,*) ' sed_sfc : Give data from sediment model to tracer model  '
+         WRITE(numsed,*) ' '
+      ENDIF
+
+      ! reading variables
+
+      CALL unpack_arr ( jpoce, trc_data(1:jpi,1:jpj,1), iarroce(1:jpoce), pwcp(1:jpoce,1,jwalk) )
+      CALL unpack_arr ( jpoce, trc_data(1:jpi,1:jpj,2), iarroce(1:jpoce), pwcp(1:jpoce,1,jwdic) )
+      CALL unpack_arr ( jpoce, trc_data(1:jpi,1:jpj,3), iarroce(1:jpoce), pwcp(1:jpoce,1,jwno3) )
+      CALL unpack_arr ( jpoce, trc_data(1:jpi,1:jpj,4), iarroce(1:jpoce), pwcp(1:jpoce,1,jwpo4) )
+      CALL unpack_arr ( jpoce, trc_data(1:jpi,1:jpj,5), iarroce(1:jpoce), pwcp(1:jpoce,1,jwoxy) )
+      CALL unpack_arr ( jpoce, trc_data(1:jpi,1:jpj,6), iarroce(1:jpoce), pwcp(1:jpoce,1,jwsil) )
+
+
+      DO jj = 1,jpj
+         DO ji = 1, jpi
+            ikt = mbkt(ji,jj)
+            IF ( tmask(ji,jj,ikt) == 1 ) THEN
+               trn(ji,jj,ikt,jptal) = trc_data(ji,jj,1)
+               trn(ji,jj,ikt,jpdic) = trc_data(ji,jj,2)
+               trn(ji,jj,ikt,jpno3) = trc_data(ji,jj,3) * 7.6
+               trn(ji,jj,ikt,jppo4) = trc_data(ji,jj,4) * 122.
+               trn(ji,jj,ikt,jpoxy) = trc_data(ji,jj,5)
+               trn(ji,jj,ikt,jpsil) = trc_data(ji,jj,6)
+            ENDIF
+         ENDDO
+      ENDDO
+
+   END SUBROUTINE sed_sfc
+
+#else
+   !!======================================================================
+   !! MODULE sedsfc  :   Dummy module 
+   !!======================================================================
+CONTAINS
+   SUBROUTINE sed_sfc ( kt )
+      INTEGER, INTENT(in) :: kt
+      WRITE(*,*) 'sed_sfc: You should not have seen this print! error?', kt
+   END SUBROUTINE sed_sfc
+#endif
+
+END MODULE sedsfc
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedstp.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedstp.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedstp.F90	(revision 3680)
@@ -0,0 +1,77 @@
+MODULE sedstp
+#if defined key_sed
+   !!======================================================================
+   !!                       ***  MODULE sedstp   ***
+   !!   Sediment model : Sediment model time-stepping
+   !!======================================================================
+   USE sed      ! sediment global variables
+   USE seddta   ! data read
+   USE sedchem  ! chemical constant
+   USE sedco3   ! carbonate in sediment pore water
+   USE seddsr   ! dissolution reaction
+   USE sedbtb   ! bioturbation
+   USE sedadv   ! vertical advection
+   USE sedmbc   ! mass balance calculation
+   USE sedsfc   ! sediment surface data
+   USE sedrst   ! restart
+   USE sedwri   ! outputs
+
+   IMPLICIT NONE
+   PRIVATE
+
+   !! * Routine accessibility
+   PUBLIC sed_stp  ! called by step.F90
+
+CONTAINS
+
+   SUBROUTINE sed_stp ( kt )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE sed_stp  ***
+      !!
+      !! ** Purpose :   Sediment time stepping
+      !!                Simulation of pore water chemistry
+      !!
+      !! ** Action  :
+      !!
+      !!
+      !!   History :
+      !!        !  98-08 (E. Maier-Reimer, Christoph Heinze )  Original code
+      !!        !  04-10 (N. Emprin, M. Gehlen ) coupled with PISCES
+      !!        !  06-04 (C. Ethe)  Re-organization
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt       ! number of iteration
+
+      !!----------------------------------------------------------------------
+
+      IF( kt /= nitsed000 )  THEN
+        CALL sed_dta( kt )       ! Load  Data for bot. wat. Chem and fluxes
+        CALL sed_chem( kt )      ! update of chemical constant to account for salinity, temperature changes
+      ENDIF
+      CALL sed_dsr( kt )         ! Dissolution reaction
+      CALL sed_adv( kt )         ! advection
+      CALL sed_btb( kt )         ! Bioturbation
+
+      IF ( ( MOD( kt, nwrised ) == 0 ) .OR. ( MOD( kt, nstock ) == 0 ) .OR. ( kt == nitsedend )  )   &
+      CALL sed_co3( kt )         ! pH actualization for saving
+      CALL sed_mbc( kt )         ! cumulation for mass balance calculation
+#if ! defined key_sed_off
+      CALL sed_sfc( kt )         ! Give back new bottom wat chem to tracer model
+#endif
+      CALL sed_rst_wri( kt )   ! restart file output
+      CALL sed_wri( kt )         ! outputs
+
+      IF( kt == nitsedend )  CLOSE( numsed )
+
+   END SUBROUTINE sed_stp
+
+#else
+   !!======================================================================
+   !! MODULE sedstp  :   Dummy module 
+   !!======================================================================
+CONTAINS
+   SUBROUTINE sed_stp( kt )         ! Empty routine
+      INTEGER, INTENT(in) :: kt
+      WRITE(*,*) 'sed_stp: You should not have seen this print! error?', kt
+   END SUBROUTINE sed_stp
+#endif
+END MODULE sedstp
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedwri.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedwri.F90	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedwri.F90	(revision 3680)
@@ -0,0 +1,275 @@
+MODULE sedwri
+#if defined key_sed
+   !!======================================================================
+   !!                     ***  MODULE  sedwri  ***
+   !!         Sediment diagnostics :  write sediment output files
+   !!======================================================================
+   USE sed
+   USE sedarr
+   USE ioipsl
+   USE dianam    ! build name of file (routine)
+
+   IMPLICIT NONE
+   PRIVATE
+
+   !! * Accessibility
+   PUBLIC sed_wri 
+
+   INTEGER  :: nised
+   INTEGER  :: nhorised
+   INTEGER  :: ndimt52
+   INTEGER  :: ndimt51
+   INTEGER  :: ndepsed
+   REAL(wp) :: zjulian
+   INTEGER, ALLOCATABLE, SAVE, DIMENSION(:) :: ndext52  
+   INTEGER, ALLOCATABLE, SAVE, DIMENSION(:) :: ndext51
+
+CONTAINS
+
+   !!----------------------------------------------------------------------
+   !!                                                   NetCDF output file
+   !!----------------------------------------------------------------------
+   SUBROUTINE sed_wri( kt )
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE sed_wri  ***
+      !!
+      !! ** Purpose :  output of sediment passive tracer
+      !!
+      !!   History :
+      !!        !  06-07  (C. Ethe)  original
+      !!----------------------------------------------------------------------
+
+      INTEGER, INTENT(in) :: kt
+
+      CHARACTER(len = 60)  ::  clhstnam, clop
+      INTEGER  :: ji, jk, js, jw, jn
+      REAL(wp) :: zsto,zout, zdt
+      INTEGER  :: iimi, iima, ijmi, ijma,ipk, it, itmod
+      CHARACTER(len = 20)  ::  cltra , cltrau
+      CHARACTER(len = 80)  ::  cltral
+      REAL(wp)  :: zrate
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zdta, zflx
+
+      !!-------------------------------------------------------------------
+
+
+      ! Initialisation
+      ! ----------------- 
+      IF( kt == nittrc000 )   ALLOCATE( ndext52(jpij*jpksed), ndext51(jpij) )
+
+      ! Define frequency of output and means
+      zdt = dtsed
+      IF( ln_mskland )   THEN   ;   clop = "only(x)"   ! put 1.e+20 on land (very expensive!!)
+      ELSE                      ;   clop = "x"         ! no use of the mask value (require less cpu time)
+      ENDIF
+#if defined key_diainstant
+      zsto = nwrised * zdt
+      clop = "inst("//TRIM(clop)//")"
+#else
+      zsto = zdt
+      clop = "ave("//TRIM(clop)//")"
+#endif
+      zout = nwrised * zdt
+
+      ! Define indices of the horizontal output zoom and vertical limit storage
+      iimi = 1      ;      iima = jpi
+      ijmi = 1      ;      ijma = jpj
+      ipk = jpksed
+
+      ! define time axis
+      it = kt
+      itmod = kt - nitsed000 + 1
+
+
+      ! 1.  Initilisations
+      ! -----------------------------------------------------------------
+      WRITE(numsed,*) ' '
+      WRITE(numsed,*) 'sed_wri kt = ', kt
+      WRITE(numsed,*) ' '
+      
+      ALLOCATE( zdta(jpoce,jpksed) )    ;   ALLOCATE( zflx(jpoce,jpwatp1) )
+
+
+      ! 2.  Back to 2D geometry
+      ! -----------------------------------------------------------------
+      CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,1) , iarroce(1:jpoce), &
+         &                    solcp(1:jpoce,1:jpksed,jsopal ) )
+      
+      CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,2) , iarroce(1:jpoce), &
+         &                    solcp(1:jpoce,1:jpksed,jsclay ) )
+      
+      CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,3) , iarroce(1:jpoce), &
+         &                    solcp(1:jpoce,1:jpksed,jspoc  ) )
+      
+      CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,4) , iarroce(1:jpoce), &
+         &                    solcp(1:jpoce,1:jpksed,jscal  ) )   
+            
+      CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,5) , iarroce(1:jpoce), &
+         &                    pwcp(1:jpoce,1:jpksed,jwsil  )  )
+      
+      CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,6)  , iarroce(1:jpoce), &
+         &                    pwcp(1:jpoce,1:jpksed,jwoxy  ) )
+      
+      CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,7)  , iarroce(1:jpoce), &
+         &                    pwcp(1:jpoce,1:jpksed,jwdic  ) )
+      
+      CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,8)  , iarroce(1:jpoce), &
+         &                    pwcp(1:jpoce,1:jpksed,jwno3  ) )
+      
+      CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,9)  , iarroce(1:jpoce), &
+         &                    pwcp(1:jpoce,1:jpksed,jwpo4  ) )
+      
+      CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,10)  , iarroce(1:jpoce), &
+         &                    pwcp(1:jpoce,1:jpksed,jwalk  ) )
+      
+      CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,11)  , iarroce(1:jpoce), &
+         &                    pwcp(1:jpoce,1:jpksed,jwc13  ) )
+      
+      ! porosity
+      zdta(:,:) = 0.
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce
+            zdta(ji,jk) = -LOG10( hipor(ji,jk) / densSW(ji) )
+         ENDDO
+      ENDDO
+      CALL unpack_arr( jpoce, flxsedi3d(1:jpi,1:jpj,1:jpksed,1)  , iarroce(1:jpoce), &
+         &                   zdta(1:jpoce,1:jpksed)  )
+      
+      CALL unpack_arr( jpoce, flxsedi3d(1:jpi,1:jpj,1:jpksed,2)  , iarroce(1:jpoce), &
+         &                   co3por(1:jpoce,1:jpksed)  )
+      
+      
+      ! computation of delta 13C
+      zdta(:,:) = 0.
+      DO jk = 1, jpksed
+         DO ji = 1, jpoce
+            zdta(ji,jk) = ( ( pwcp(ji,jk,jwc13) / pwcp(ji,jk,jwdic) / pdb ) - 1. ) &
+               &              * 1000.
+         ENDDO
+      ENDDO
+      CALL unpack_arr( jpoce, flxsedi3d(1:jpi,1:jpj,1:jpksed,3)  , iarroce(1:jpoce), &
+         &                   zdta(1:jpoce,1:jpksed)  )
+      
+ 
+      zflx(:,:) = 0.    
+      ! Calculation of fluxes mol/cm2/s
+      DO jw = 1, jpwat
+         DO ji = 1, jpoce
+            zflx(ji,jw) = ( pwcp(ji,1,jw) - pwcp_dta(ji,jw) ) &
+               &         * 1.e-3 * dzkbot(ji) / dtsed
+         ENDDO
+      ENDDO
+      ! Calculation of accumulation rate per dt
+      DO js = 1, jpsol
+         zrate =  mol_wgt(js) / ( dens * por1(jpksed) ) / dtsed
+         DO ji = 1, jpoce
+            zflx(ji,jpwatp1) = zflx(ji,jpwatp1) + ( tosed(ji,js) - fromsed(ji,js) ) * zrate
+         ENDDO
+      ENDDO
+
+      CALL unpack_arr( jpoce, flxsedi2d(1:jpi,1:jpj,1), iarroce(1:jpoce), zflx(1:jpoce,1)  )
+      CALL unpack_arr( jpoce, flxsedi2d(1:jpi,1:jpj,2), iarroce(1:jpoce), zflx(1:jpoce,2)  )
+      CALL unpack_arr( jpoce, flxsedi2d(1:jpi,1:jpj,3), iarroce(1:jpoce), zflx(1:jpoce,3)  )
+      CALL unpack_arr( jpoce, flxsedi2d(1:jpi,1:jpj,4), iarroce(1:jpoce), zflx(1:jpoce,4)  )
+      CALL unpack_arr( jpoce, flxsedi2d(1:jpi,1:jpj,5), iarroce(1:jpoce), zflx(1:jpoce,5)  )
+      CALL unpack_arr( jpoce, flxsedi2d(1:jpi,1:jpj,6), iarroce(1:jpoce), zflx(1:jpoce,6)  )
+      CALL unpack_arr( jpoce, flxsedi2d(1:jpi,1:jpj,7), iarroce(1:jpoce), zflx(1:jpoce,8)  )
+
+
+      ! 3. Define NETCDF files and fields at beginning of first time step
+      ! -----------------------------------------------------------------
+
+      IF( kt == nitsed000 ) THEN
+
+         ! Define the NETCDF files        
+         CALL ymds2ju ( nyear, nmonth, nday, rdt, zjulian )
+         zjulian = zjulian - adatrj   !   set calendar origin to the beginning of the experiment
+         CALL dia_nam ( clhstnam, nwrised, 'sed_T' )
+         CALL histbeg ( clhstnam, jpi, glamt, jpj, gphit,     &
+            &             iimi, iima-iimi+1, ijmi, ijma-ijmi+1,         &
+            &             nitsed000-1, zjulian, zdt,  nhorised, nised , domain_id=nidom, snc4chunks=snc4set )
+         CALL histvert( nised,'deptht','Vertic.sed.T levels','m',ipk, profsed, ndepsed, 'down' )
+         CALL wheneq  ( jpi*jpj*ipk, tmasksed, 1, 1., ndext52, ndimt52 )
+         CALL wheneq  ( jpi*jpj, tmasksed(:,:,1), 1, 1., ndext51, ndimt51 )
+
+         ! Declare all the output fields as NETCDF variables
+
+         DO jn = 1, jptrased
+            cltra  = sedtrcd(jn)   ! short title for sediment variable
+            cltral = sedtrcl(jn)   ! long title for  sediment variable
+            cltrau = sedtrcu(jn)   ! unit for  sediment variable
+
+            CALL histdef( nised, cltra,cltral,cltrau, jpi, jpj, nhorised, &
+               &          ipk, 1, ipk, ndepsed, 32, clop, zsto, zout )
+         ENDDO
+
+         ! 3D diagnostic
+         DO jn = 1, jpdia3dsed
+            cltra  = seddia3d(jn)   ! short title for 3D diagnostic
+            cltral = seddia3l(jn)   ! long title for 3D diagnostic
+            cltrau = seddia3u(jn)   ! UNIT for 3D diagnostic
+
+            CALL histdef( nised, cltra,cltral,cltrau, jpi, jpj, nhorised, &
+               &          ipk, 1, ipk, ndepsed, 32, clop, zsto, zout  )
+         ENDDO
+
+         ! Fluxes
+         DO jn = 1, jpdia2dsed
+            cltra  = seddia2d(jn)   ! short title for 2D diagnostic
+            cltral = seddia2l(jn)   ! long title for 2D diagnostic
+            cltrau = seddia2u(jn)   ! UNIT for 2D diagnostic
+            
+            CALL histdef( nised, cltra,cltral,cltrau, jpi, jpj, nhorised, &
+               &          1, 1, 1, -99, 32, clop, zsto, zout )
+         ENDDO
+
+
+         CALL histend( nised, snc4set )
+
+         WRITE(numsed,*)
+         WRITE(numsed,*) 'End of NetCDF sediment output file Initialization'
+
+       ENDIF
+
+       ! Start writing data
+       ! ---------------------
+       DO jn = 1, jptrased
+          cltra = sedtrcd(jn) ! short title for 3D diagnostic
+          CALL histwrite( nised, cltra, it, trcsedi(:,:,:,jn), ndimt52, ndext52 )
+       END DO
+
+       DO jn = 1, jpdia3dsed
+          cltra = seddia3d(jn) ! short title for 3D diagnostic
+          CALL histwrite( nised, cltra, it, flxsedi3d(:,:,:,jn), ndimt52, ndext52 )
+       END DO
+
+       DO jn = 1, jpdia2dsed
+             cltra = seddia2d(jn) ! short title for 2D diagnostic
+             CALL histwrite( nised, cltra, it, flxsedi2d(:,:,jn  ), ndimt51, ndext51 )
+       END DO
+
+
+      ! 3. Closing all files
+      ! --------------------
+      IF( kt == nitsedend  ) THEN
+          CALL histclo( nised )
+      ENDIF
+
+      DEALLOCATE( zdta )    ;   DEALLOCATE( zflx )
+
+   END SUBROUTINE sed_wri
+
+#else
+   !!======================================================================
+   !! MODULE sedwri  :   Dummy module
+   !!======================================================================
+CONTAINS
+   SUBROUTINE sed_wri( kt )         ! Empty routine
+      INTEGER, INTENT(in) :: kt
+      WRITE(*,*) 'sed_adv: You should not have seen this print! error?', kt
+   END SUBROUTINE sed_wri
+
+   !!======================================================================
+#endif
+
+END MODULE sedwri
Index: anches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zbio.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zbio.F90	(revision 3679)
+++ 	(revision )
@@ -1,147 +1,0 @@
-MODULE p4zbio
-   !!======================================================================
-   !!                         ***  MODULE p4zbio  ***
-   !! TOP :   PISCES bio-model
-   !!======================================================================
-   !! History :   1.0  !  2004     (O. Aumont) Original code
-   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
-   !!   p4z_bio        :   computes the interactions between the different
-   !!                      compartments of PISCES
-   !!----------------------------------------------------------------------
-   USE oce_trc         !  shared variables between ocean and passive tracers
-   USE trc             !  passive tracers common variables 
-   USE sms_pisces      !  PISCES Source Minus Sink variables
-   USE p4zsink         !  vertical flux of particulate matter due to sinking
-   USE p4zopt          !  optical model
-   USE p4zlim          !  Co-limitations of differents nutrients
-   USE p4zprod         !  Growth rate of the 2 phyto groups
-   USE p4zmort         !  Mortality terms for phytoplankton
-   USE p4zmicro        !  Sources and sinks of microzooplankton
-   USE p4zmeso         !  Sources and sinks of mesozooplankton
-   USE p4zrem          !  Remineralisation of organic matter
-   USE prtctl_trc      !  print control for debugging
-   USE iom             !  I/O manager
-  
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC  p4z_bio    
-
-   !!* Substitution
-#  include "top_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE p4z_bio ( kt, jnt )
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_bio  ***
-      !!
-      !! ** Purpose :   Ecosystem model in the whole ocean: computes the
-      !!              different interactions between the different compartments
-      !!              of PISCES
-      !!
-      !! ** Method  : - ???
-      !!---------------------------------------------------------------------
-      INTEGER, INTENT(in) :: kt, jnt
-      INTEGER  ::  ji, jj, jk, jn
-      REAL(wp) ::  ztra
-#if defined key_kriest
-      REAL(wp) ::  zcoef1, zcoef2
-#endif
-      CHARACTER (len=25) :: charout
-
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_bio')
-      !
-      !     ASSIGN THE SHEAR RATE THAT IS USED FOR AGGREGATION
-      !     OF PHYTOPLANKTON AND DETRITUS
-
-      xdiss(:,:,:) = 1.
-!!gm the use of nmld should be better here?
-      DO jk = 2, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               IF( fsdepw(ji,jj,jk+1) > hmld(ji,jj) )   xdiss(ji,jj,jk) = 0.01
-            END DO 
-         END DO
-      END DO
-
-          
-      CALL p4z_sink ( kt, jnt )     ! vertical flux of particulate organic matter
-      CALL p4z_opt  ( kt, jnt )     ! Optic: PAR in the water column
-      CALL p4z_lim  ( kt      )     ! co-limitations by the various nutrients
-      CALL p4z_prod ( kt, jnt )     ! phytoplankton growth rate over the global ocean. 
-      !                             ! (for each element : C, Si, Fe, Chl )
-      CALL p4z_rem  ( kt      )     ! remineralization terms of organic matter+scavenging of Fe
-      CALL p4z_mort ( kt      )     ! phytoplankton mortality
-      !                             ! zooplankton sources/sinks routines 
-      CALL p4z_micro( kt      )           ! microzooplankton
-      CALL p4z_meso ( kt, jnt )           ! mesozooplankton
-
-      !                             ! test if tracers concentrations fall below 0.
-      xnegtr(:,:,:) = 1.e0
-      DO jn = jp_pcs0, jp_pcs1
-         DO jk = 1, jpk
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  IF( ( trn(ji,jj,jk,jn) + tra(ji,jj,jk,jn) ) < 0.e0 ) THEN 
-                     ztra             = ABS(  ( trn(ji,jj,jk,jn) - rtrn ) &
-                                            / ( tra(ji,jj,jk,jn) + rtrn ) )
-                     xnegtr(ji,jj,jk) = MIN( xnegtr(ji,jj,jk),  ztra )
-                  ENDIF
-              END DO
-            END DO
-         END DO
-      END DO
-      !                                ! where at least 1 tracer concentration becomes negative
-      !                                ! 
-      DO jn = jp_pcs0, jp_pcs1
-         trn(:,:,:,jn) = trn(:,:,:,jn) + xnegtr(:,:,:) * tra(:,:,:,jn)
-      END DO
-
-
-      tra(:,:,:,:) = 0.e0
-
-#if defined key_kriest
-      ! 
-      zcoef1 = 1.e0 / xkr_massp 
-      zcoef2 = 1.e0 / xkr_massp / 1.1
-      DO jk = 1,jpkm1
-         trn(:,:,jk,jpnum) = MAX(  trn(:,:,jk,jpnum), trn(:,:,jk,jppoc) * zcoef1 / xnumm(jk)  )
-         trn(:,:,jk,jpnum) = MIN(  trn(:,:,jk,jpnum), trn(:,:,jk,jppoc) * zcoef2              )
-      END DO
-#endif
-
-      !
-      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
-         WRITE(charout, FMT="('bio ')")
-         CALL prt_ctl_trc_info(charout)
-         CALL prt_ctl_trc(tab4d=trn, mask=tmask, clinfo=ctrcnm)
-      ENDIF
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_bio')
-      !
-   END SUBROUTINE p4z_bio
-
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_bio                         ! Empty routine
-   END SUBROUTINE p4z_bio
-#endif 
-
-   !!======================================================================
-END MODULE  p4zbio
Index: anches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zche.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zche.F90	(revision 3679)
+++ 	(revision )
@@ -1,349 +1,0 @@
-MODULE p4zche
-   !!======================================================================
-   !!                         ***  MODULE p4zche  ***
-   !! TOP :   PISCES Sea water chemistry computed following OCMIP protocol
-   !!======================================================================
-   !! History :   OPA  !  1988     (E. Maier-Reimer)  Original code
-   !!              -   !  1998     (O. Aumont)  addition
-   !!              -   !  1999     (C. Le Quere)  modification
-   !!   NEMO      1.0  !  2004     (O. Aumont)  modification
-   !!              -   !  2006     (R. Gangsto)  modification
-   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
-   !!                  !  2011-02  (J. Simeon, J.Orr ) update O2 solubility constants
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
-   !!   p4z_che      :  Sea water chemistry computed following OCMIP protocol
-   !!----------------------------------------------------------------------
-   USE oce_trc       !  shared variables between ocean and passive tracers
-   USE trc           !  passive tracers common variables
-   USE sms_pisces    !  PISCES Source Minus Sink variables
-   USE lib_mpp       !  MPP library
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   p4z_che         !
-   PUBLIC   p4z_che_alloc   !
-
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sio3eq   ! chemistry of Si
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   fekeq    ! chemistry of Fe
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   chemc    ! Solubilities of O2 and CO2
-
-   REAL(wp), PUBLIC ::   atcox  = 0.20946         ! units atm
-
-   REAL(wp) ::   salchl = 1. / 1.80655    ! conversion factor for salinity --> chlorinity (Wooster et al. 1969)
-   REAL(wp) ::   o2atm  = 1. / ( 1000. * 0.20946 )  
-
-   REAL(wp) ::   akcc1  = -171.9065       ! coeff. for apparent solubility equilibrium
-   REAL(wp) ::   akcc2  =   -0.077993     ! Millero et al. 1995 from Mucci 1983
-   REAL(wp) ::   akcc3  = 2839.319        
-   REAL(wp) ::   akcc4  =   71.595        
-   REAL(wp) ::   akcc5  =   -0.77712      
-   REAL(wp) ::   akcc6  =    0.00284263   
-   REAL(wp) ::   akcc7  =  178.34        
-   REAL(wp) ::   akcc8  =   -0.07711     
-   REAL(wp) ::   akcc9  =    0.0041249   
-
-   REAL(wp) ::   rgas   = 83.143         ! universal gas constants
-   REAL(wp) ::   oxyco  = 1. / 22.4144   ! converts from liters of an ideal gas to moles
-
-   REAL(wp) ::   bor1   = 0.00023        ! borat constants
-   REAL(wp) ::   bor2   = 1. / 10.82
-
-   REAL(wp) ::   ca0    = -162.8301      ! WEISS & PRICE 1980, units mol/(kg atm)
-   REAL(wp) ::   ca1    =  218.2968
-   REAL(wp) ::   ca2    =   90.9241
-   REAL(wp) ::   ca3    =   -1.47696
-   REAL(wp) ::   ca4    =    0.025695
-   REAL(wp) ::   ca5    =   -0.025225
-   REAL(wp) ::   ca6    =    0.0049867
-
-   REAL(wp) ::   c10    = -3670.7        ! Coeff. for 1. dissoc. of carbonic acid (Edmond and Gieskes, 1970)   
-   REAL(wp) ::   c11    =    62.008     
-   REAL(wp) ::   c12    =    -9.7944    
-   REAL(wp) ::   c13    =     0.0118     
-   REAL(wp) ::   c14    =    -0.000116
-
-   REAL(wp) ::   c20    = -1394.7       ! coeff. for 2. dissoc. of carbonic acid (Millero, 1995)   
-   REAL(wp) ::   c21    =    -4.777   
-   REAL(wp) ::   c22    =     0.0184   
-   REAL(wp) ::   c23    =    -0.000118
-
-   REAL(wp) ::   st1    =      0.14     ! constants for calculate concentrations for sulfate
-   REAL(wp) ::   st2    =  1./96.062    !  (Morris & Riley 1966)
-   REAL(wp) ::   ks0    =    141.328 
-   REAL(wp) ::   ks1    =  -4276.1  
-   REAL(wp) ::   ks2    =    -23.093
-   REAL(wp) ::   ks3    = -13856.  
-   REAL(wp) ::   ks4    =   324.57 
-   REAL(wp) ::   ks5    =   -47.986
-   REAL(wp) ::   ks6    =  35474. 
-   REAL(wp) ::   ks7    =   -771.54
-   REAL(wp) ::   ks8    =    114.723
-   REAL(wp) ::   ks9    =  -2698.  
-   REAL(wp) ::   ks10   =   1776. 
-   REAL(wp) ::   ks11   =      1.
-   REAL(wp) ::   ks12   =     -0.001005 
-
-   REAL(wp) ::   ft1    =    0.000067   ! constants for calculate concentrations for fluorides
-   REAL(wp) ::   ft2    = 1./18.9984    ! (Dickson & Riley 1979 )
-   REAL(wp) ::   kf0    =  -12.641    
-   REAL(wp) ::   kf1    = 1590.2    
-   REAL(wp) ::   kf2    =    1.525    
-   REAL(wp) ::   kf3    =    1.0     
-   REAL(wp) ::   kf4    =   -0.001005
-
-   REAL(wp) ::   cb0    = -8966.90      ! Coeff. for 1. dissoc. of boric acid 
-   REAL(wp) ::   cb1    = -2890.53      ! (Dickson and Goyet, 1994)
-   REAL(wp) ::   cb2    =   -77.942
-   REAL(wp) ::   cb3    =     1.728
-   REAL(wp) ::   cb4    =    -0.0996
-   REAL(wp) ::   cb5    =   148.0248
-   REAL(wp) ::   cb6    =   137.1942
-   REAL(wp) ::   cb7    =     1.62142
-   REAL(wp) ::   cb8    =   -24.4344
-   REAL(wp) ::   cb9    =   -25.085
-   REAL(wp) ::   cb10   =    -0.2474 
-   REAL(wp) ::   cb11   =     0.053105
-
-   REAL(wp) ::   cw0    = -13847.26     ! Coeff. for dissoc. of water (Dickson and Riley, 1979 )
-   REAL(wp) ::   cw1    =    148.9652  
-   REAL(wp) ::   cw2    =    -23.6521
-   REAL(wp) ::   cw3    =    118.67 
-   REAL(wp) ::   cw4    =     -5.977 
-   REAL(wp) ::   cw5    =      1.0495  
-   REAL(wp) ::   cw6    =     -0.01615
-
-   !                                    ! volumetric solubility constants for o2 in ml/L  
-   REAL(wp) ::   ox0    =  2.00856      ! from Table 1 for Eq 8 of Garcia and Gordon, 1992.
-   REAL(wp) ::   ox1    =  3.22400      ! corrects for moisture and fugacity, but not total atmospheric pressure
-   REAL(wp) ::   ox2    =  3.99063      !      Original PISCES code noted this was a solubility, but 
-   REAL(wp) ::   ox3    =  4.80299      ! was in fact a bunsen coefficient with units L-O2/(Lsw atm-O2)
-   REAL(wp) ::   ox4    =  9.78188e-1   ! Hence, need to divide EXP( zoxy ) by 1000, ml-O2 => L-O2
-   REAL(wp) ::   ox5    =  1.71069      ! and atcox = 0.20946 to add the 1/atm dimension.
-   REAL(wp) ::   ox6    = -6.24097e-3   
-   REAL(wp) ::   ox7    = -6.93498e-3 
-   REAL(wp) ::   ox8    = -6.90358e-3
-   REAL(wp) ::   ox9    = -4.29155e-3 
-   REAL(wp) ::   ox10   = -3.11680e-7 
-
-   REAL(wp), DIMENSION(5)  :: devk1, devk2, devk3, devk4, devk5   ! coeff. for seawater pressure correction 
-   !                                                              ! (millero 95)
-   DATA devk1 / -25.5    , -15.82    , -29.48  , -25.60     , -48.76    /   
-   DATA devk2 / 0.1271   , -0.0219   , 0.1622  , 0.2324     , 0.5304    /   
-   DATA devk3 / 0.       , 0.        , 2.608E-3,  -3.6246E-3, 0.        /   
-   DATA devk4 / -3.08E-3 , 1.13E-3   , -2.84E-3, -5.13E-3   , -11.76E-3 /   
-   DATA devk5 / 0.0877E-3, -0.1475E-3,  0.     , 0.0794E-3  , 0.3692E-3 /
-
-   !!* Substitution
-#include "top_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE p4z_che
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_che  ***
-      !!
-      !! ** Purpose :   Sea water chemistry computed following OCMIP protocol
-      !!
-      !! ** Method  : - ...
-      !!---------------------------------------------------------------------
-      INTEGER  ::   ji, jj, jk
-      REAL(wp) ::   ztkel, zt   , zt2   , zsal  , zsal2 , zbuf1 , zbuf2
-      REAL(wp) ::   ztgg , ztgg2, ztgg3 , ztgg4 , ztgg5
-      REAL(wp) ::   zpres, ztc  , zcl   , zcpexp, zoxy  , zcpexp2
-      REAL(wp) ::   zsqrt, ztr  , zlogt , zcek1
-      REAL(wp) ::   zis  , zis2 , zsal15, zisqrt
-      REAL(wp) ::   zckb , zck1 , zck2  , zckw  , zak1 , zak2  , zakb , zaksp0, zakw
-      REAL(wp) ::   zst  , zft  , zcks  , zckf  , zaksp1
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_che')
-      !
-      ! CHEMICAL CONSTANTS - SURFACE LAYER
-      ! ----------------------------------
-!CDIR NOVERRCHK
-      DO jj = 1, jpj
-!CDIR NOVERRCHK
-         DO ji = 1, jpi
-            !                             ! SET ABSOLUTE TEMPERATURE
-            ztkel = tsn(ji,jj,1,jp_tem) + 273.16
-            zt    = ztkel * 0.01
-            zt2   = zt * zt
-            zsal  = tsn(ji,jj,1,jp_sal) + ( 1.- tmask(ji,jj,1) ) * 35.
-            zsal2 = zsal * zsal
-            zlogt = LOG( zt )
-            !                             ! LN(K0) OF SOLUBILITY OF CO2 (EQ. 12, WEISS, 1980)
-            !                             !     AND FOR THE ATMOSPHERE FOR NON IDEAL GAS
-            zcek1 = ca0 + ca1 / zt + ca2 * zlogt + ca3 * zt2 + zsal * ( ca4 + ca5 * zt + ca6 * zt2 )
-            !                             ! LN(K0) OF SOLUBILITY OF O2 and N2 in ml/L (EQ. 8, GARCIA AND GORDON, 1992)
-            ztgg  = LOG( ( 298.15 - tsn(ji,jj,1,jp_tem) ) / ztkel )  ! Set the GORDON & GARCIA scaled temperature
-            ztgg2 = ztgg  * ztgg
-            ztgg3 = ztgg2 * ztgg
-            ztgg4 = ztgg3 * ztgg
-            ztgg5 = ztgg4 * ztgg
-            zoxy  = ox0 + ox1 * ztgg + ox2 * ztgg2 + ox3 * ztgg3 + ox4 * ztgg4 + ox5 * ztgg5   &
-                   + zsal * ( ox6 + ox7 * ztgg + ox8 * ztgg2 + ox9 * ztgg3 ) +  ox10 * zsal2
-
-            !                             ! SET SOLUBILITIES OF O2 AND CO2 
-            chemc(ji,jj,1) = EXP( zcek1 ) * 1.e-6 * rhop(ji,jj,1) / 1000.  ! mol/(L uatm)
-            chemc(ji,jj,2) = ( EXP( zoxy  ) * o2atm ) * oxyco              ! mol/(L atm)
-            !
-         END DO
-      END DO
-
-      ! CHEMICAL CONSTANTS - DEEP OCEAN
-      ! -------------------------------
-!CDIR NOVERRCHK
-      DO jk = 1, jpk
-!CDIR NOVERRCHK
-         DO jj = 1, jpj
-!CDIR NOVERRCHK
-            DO ji = 1, jpi
-
-               ! SET PRESSION
-               zpres   = 1.025e-1 * fsdept(ji,jj,jk)
-
-               ! SET ABSOLUTE TEMPERATURE
-               ztkel   = tsn(ji,jj,jk,jp_tem) + 273.16
-               zsal    = tsn(ji,jj,jk,jp_sal) + ( 1.-tmask(ji,jj,jk) ) * 35.
-               zsqrt  = SQRT( zsal )
-               zsal15  = zsqrt * zsal
-               zlogt  = LOG( ztkel )
-               ztr    = 1. / ztkel
-               zis    = 19.924 * zsal / ( 1000.- 1.005 * zsal )
-               zis2   = zis * zis
-               zisqrt = SQRT( zis )
-               ztc     = tsn(ji,jj,jk,jp_tem) + ( 1.- tmask(ji,jj,jk) ) * 20.
-
-               ! CHLORINITY (WOOSTER ET AL., 1969)
-               zcl     = zsal * salchl
-
-               ! TOTAL SULFATE CONCENTR. [MOLES/kg soln]
-               zst     = st1 * zcl * st2
-
-               ! TOTAL FLUORIDE CONCENTR. [MOLES/kg soln]
-               zft     = ft1 * zcl * ft2
-
-               ! DISSOCIATION CONSTANT FOR SULFATES on free H scale (Dickson 1990)
-               zcks    = EXP(  ks1 * ztr + ks0 + ks2 * zlogt                           &
-                  &                     + ( ks3 * ztr + ks4 + ks5 * zlogt ) * zisqrt   &
-                  &                     + ( ks6 * ztr + ks7 + ks8 * zlogt ) * zis      &
-                  &                     + ks9 * ztr * zis * zisqrt + ks10 * ztr *zis2 + LOG( ks11 + ks12 *zsal )  )
-
-               ! DISSOCIATION CONSTANT FOR FLUORIDES on free H scale (Dickson and Riley 79)
-               zckf    = EXP(  kf1 * ztr + kf0 + kf2 * zisqrt + LOG( kf3 + kf4 * zsal )  )
-
-               ! DISSOCIATION CONSTANT FOR CARBONATE AND BORATE
-               zckb    = ( cb0 + cb1 * zsqrt + cb2  * zsal + cb3 * zsal15 + cb4 * zsal * zsal ) * ztr   &
-                  &    + ( cb5 + cb6 * zsqrt + cb7  * zsal )                                            &
-                  &    + ( cb8 + cb9 * zsqrt + cb10 * zsal ) * zlogt + cb11 * zsqrt * ztkel             &
-                  &    + LOG(  ( 1.+ zst / zcks + zft / zckf ) / ( 1.+ zst / zcks )  )
-
-               zck1    = c10 * ztr + c11 + c12 * zlogt + c13 * zsal + c14 * zsal * zsal
-               zck2    = c20 * ztr + c21 + c22 * zsal   + c23 * zsal**2
-
-               ! PKW (H2O) (DICKSON AND RILEY, 1979)
-               zckw    = cw0 * ztr + cw1 + cw2 * zlogt + ( cw3 * ztr + cw4 + cw5 * zlogt ) * zsqrt + cw6 * zsal
-
-
-               ! APPARENT SOLUBILITY PRODUCT K'SP OF CALCITE IN SEAWATER
-               !       (S=27-43, T=2-25 DEG C) at pres =0 (atmos. pressure) (MUCCI 1983)
-               zaksp0  = akcc1 + akcc2 * ztkel + akcc3 * ztr + akcc4 * LOG10( ztkel )   &
-                  &   + ( akcc5 + akcc6 * ztkel + akcc7 * ztr ) * zsqrt + akcc8 * zsal + akcc9 * zsal15
-
-               ! K1, K2 OF CARBONIC ACID, KB OF BORIC ACID, KW (H2O) (LIT.?)
-               zak1    = 10**(zck1)
-               zak2    = 10**(zck2)
-               zakb    = EXP( zckb  )
-               zakw    = EXP( zckw )
-               zaksp1  = 10**(zaksp0)
-
-               ! FORMULA FOR CPEXP AFTER EDMOND & GIESKES (1970)
-               !        (REFERENCE TO CULBERSON & PYTKOQICZ (1968) AS MADE
-               !        IN BROECKER ET AL. (1982) IS INCORRECT; HERE RGAS IS
-               !        TAKEN TENFOLD TO CORRECT FOR THE NOTATION OF pres  IN
-               !        DBAR INSTEAD OF BAR AND THE EXPRESSION FOR CPEXP IS
-               !        MULTIPLIED BY LN(10.) TO ALLOW USE OF EXP-FUNCTION
-               !        WITH BASIS E IN THE FORMULA FOR AKSPP (CF. EDMOND
-               !        & GIESKES (1970), P. 1285-1286 (THE SMALL
-               !        FORMULA ON P. 1286 IS RIGHT AND CONSISTENT WITH THE
-               !        SIGN IN PARTIAL MOLAR VOLUME CHANGE AS SHOWN ON P. 1285))
-               zcpexp  = zpres /(rgas*ztkel)
-               zcpexp2 = zpres * zpres/(rgas*ztkel)
-
-               ! KB OF BORIC ACID, K1,K2 OF CARBONIC ACID PRESSURE
-               !        CORRECTION AFTER CULBERSON AND PYTKOWICZ (1968)
-               !        (CF. BROECKER ET AL., 1982)
-
-               zbuf1  = -(devk1(1)+devk2(1)*ztc+devk3(1)*ztc*ztc)
-               zbuf2  = 0.5*(devk4(1)+devk5(1)*ztc)
-               ak13(ji,jj,jk) = zak1 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
-
-               zbuf1  =     - ( devk1(2) + devk2(2) * ztc + devk3(2) * ztc * ztc )
-               zbuf2  = 0.5 * ( devk4(2) + devk5(2) * ztc )
-               ak23(ji,jj,jk) = zak2 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
-
-               zbuf1  =     - ( devk1(3) + devk2(3) * ztc + devk3(3) * ztc * ztc )
-               zbuf2  = 0.5 * ( devk4(3) + devk5(3) * ztc )
-               akb3(ji,jj,jk) = zakb * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
-
-               zbuf1  =     - ( devk1(4) + devk2(4) * ztc + devk3(4) * ztc * ztc )
-               zbuf2  = 0.5 * ( devk4(4) + devk5(4) * ztc )
-               akw3(ji,jj,jk) = zakw * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
-
-
-               ! APPARENT SOLUBILITY PRODUCT K'SP OF CALCITE 
-               !        AS FUNCTION OF PRESSURE FOLLOWING MILLERO
-               !        (P. 1285) AND BERNER (1976)
-               zbuf1  =     - ( devk1(5) + devk2(5) * ztc + devk3(5) * ztc * ztc )
-               zbuf2  = 0.5 * ( devk4(5) + devk5(5) * ztc )
-               aksp(ji,jj,jk) = zaksp1 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
-
-
-               ! TOTAL BORATE CONCENTR. [MOLES/L]
-               borat(ji,jj,jk) = bor1 * zcl * bor2
-
-               ! Iron and SIO3 saturation concentration from ...
-               sio3eq(ji,jj,jk) = EXP(  LOG( 10.) * ( 6.44 - 968. / ztkel )  ) * 1.e-6
-               fekeq (ji,jj,jk) = 10**( 17.27 - 1565.7 / ( 273.15 + ztc ) )
-
-            END DO
-         END DO
-      END DO
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_che')
-      !
-   END SUBROUTINE p4z_che
-
-
-   INTEGER FUNCTION p4z_che_alloc()
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_che_alloc  ***
-      !!----------------------------------------------------------------------
-      ALLOCATE( sio3eq(jpi,jpj,jpk) , fekeq(jpi,jpj,jpk) , chemc (jpi,jpj,2), STAT=p4z_che_alloc )
-      !
-      IF( p4z_che_alloc /= 0 )   CALL ctl_warn('p4z_che_alloc : failed to allocate arrays.')
-      !
-   END FUNCTION p4z_che_alloc
-
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_che( kt )                   ! Empty routine
-      INTEGER, INTENT(in) ::   kt
-      WRITE(*,*) 'p4z_che: You should not have seen this print! error?', kt
-   END SUBROUTINE p4z_che
-#endif 
-
-   !!======================================================================
-END MODULE  p4zche
Index: anches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zflx.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zflx.F90	(revision 3679)
+++ 	(revision )
@@ -1,392 +1,0 @@
-MODULE p4zflx
-   !!======================================================================
-   !!                         ***  MODULE p4zflx  ***
-   !! TOP :   PISCES CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE
-   !!======================================================================
-   !! History :    -   !  1988-07  (E. MAIER-REIMER) Original code
-   !!              -   !  1998     (O. Aumont) additions
-   !!              -   !  1999     (C. Le Quere) modifications
-   !!             1.0  !  2004     (O. Aumont) modifications
-   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
-   !!                  !  2011-02  (J. Simeon, J. Orr) Include total atm P correction 
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
-   !!   p4z_flx       :   CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE
-   !!   p4z_flx_init  :   Read the namelist
-   !!   p4z_patm      :   Read sfc atm pressure [atm] for each grid cell
-   !!----------------------------------------------------------------------
-   USE oce_trc                      !  shared variables between ocean and passive tracers 
-   USE trc                          !  passive tracers common variables
-   USE sms_pisces                   !  PISCES Source Minus Sink variables
-   USE p4zche                       !  Chemical model
-   USE prtctl_trc                   !  print control for debugging
-   USE iom                          !  I/O manager
-   USE fldread                      !  read input fields
-#if defined key_cpl_carbon_cycle
-   USE sbc_oce, ONLY :  atm_co2     !  atmospheric pCO2               
-#endif
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   p4z_flx  
-   PUBLIC   p4z_flx_init  
-   PUBLIC   p4z_flx_alloc  
-
-   !                                      !!** Namelist  nampisext  **
-   REAL(wp)          ::  atcco2    = 278._wp       !: pre-industrial atmospheric [co2] (ppm) 	
-   LOGICAL           ::  ln_co2int = .FALSE.       !: flag to read in a file and interpolate atmospheric pco2 or not
-   CHARACTER(len=34) ::  clname    = 'atcco2.txt'  !: filename of pco2 values
-   INTEGER           ::  nn_offset = 0             !: Offset model-data start year (default = 0) 
-
-   !!  Variables related to reading atmospheric CO2 time history    
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) :: atcco2h, years
-   INTEGER  :: nmaxrec, numco2
-
-   !                                         !!* nampisatm namelist (Atmospheric PRessure) *
-   LOGICAL, PUBLIC ::   ln_presatm = .true.  !: ref. pressure: global mean Patm (F) or a constant (F)
-
-   REAL(wp) , ALLOCATABLE, SAVE, DIMENSION(:,:)  ::  patm      ! atmospheric pressure at kt                 [N/m2]
-   TYPE(FLD), ALLOCATABLE,       DIMENSION(:)    ::  sf_patm   ! structure of input fields (file informations, fields read)
-
-
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: oce_co2   !: ocean carbon flux 
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: satmco2   !: atmospheric pco2 
-
-   REAL(wp) ::  t_oce_co2_flx               !: Total ocean carbon flux 
-   REAL(wp) ::  t_atm_co2_flx               !: global mean of atmospheric pco2
-   REAL(wp) ::  area                        !: ocean surface
-   REAL(wp) ::  xconv  = 0.01_wp / 3600._wp !: coefficients for conversion 
-
-   !!* Substitution
-#  include "top_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE p4z_flx ( kt )
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_flx  ***
-      !!
-      !! ** Purpose :   CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE
-      !!
-      !! ** Method  : 
-      !!              - Include total atm P correction via Esbensen & Kushnir (1981) 
-      !!              - Pressure correction NOT done for key_cpl_carbon_cycle
-      !!              - Remove Wanninkhof chemical enhancement;
-      !!              - Add option for time-interpolation of atcco2.txt  
-      !!---------------------------------------------------------------------
-      !
-      INTEGER, INTENT(in) ::   kt   !
-      !
-      INTEGER  ::   ji, jj, jm, iind, iindm1
-      REAL(wp) ::   ztc, ztc2, ztc3, zws, zkgwan
-      REAL(wp) ::   zfld, zflu, zfld16, zflu16, zfact
-      REAL(wp) ::   zph, zah2, zbot, zdic, zalk, zsch_o2, zalka, zsch_co2
-      REAL(wp) ::   zyr_dec, zdco2dt
-      CHARACTER (len=25) :: charout
-      REAL(wp), POINTER, DIMENSION(:,:) :: zkgco2, zkgo2, zh2co3, zoflx 
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_flx')
-      !
-      CALL wrk_alloc( jpi, jpj, zkgco2, zkgo2, zh2co3, zoflx )
-      !
-
-      ! SURFACE CHEMISTRY (PCO2 AND [H+] IN
-      !     SURFACE LAYER); THE RESULT OF THIS CALCULATION
-      !     IS USED TO COMPUTE AIR-SEA FLUX OF CO2
-
-      IF( kt /= nit000 ) CALL p4z_patm( kt )    ! Get sea-level pressure (E&K [1981] climatology) for use in flux calcs
-
-      IF( ln_co2int ) THEN 
-         ! Linear temporal interpolation  of atmospheric pco2.  atcco2.txt has annual values.
-         ! Caveats: First column of .txt must be in years, decimal  years preferably. 
-         ! For nn_offset, if your model year is iyy, nn_offset=(years(1)-iyy) 
-         ! then the first atmospheric CO2 record read is at years(1)
-         zyr_dec = REAL( nyear + nn_offset, wp ) + REAL( nday_year, wp ) / REAL( nyear_len(1), wp )
-         jm = 2
-         DO WHILE( jm <= nmaxrec .AND. years(jm-1) < zyr_dec .AND. years(jm) >= zyr_dec ) ;  jm = jm + 1 ;  END DO
-         iind = jm  ;   iindm1 = jm - 1
-         zdco2dt = ( atcco2h(iind) - atcco2h(iindm1) ) / ( years(iind) - years(iindm1) + rtrn )
-         atcco2  = zdco2dt * ( zyr_dec - years(iindm1) ) + atcco2h(iindm1)
-         satmco2(:,:) = atcco2 
-      ENDIF
-
-#if defined key_cpl_carbon_cycle
-      satmco2(:,:) = atm_co2(:,:)
-#endif
-
-      DO jm = 1, 10
-!CDIR NOVERRCHK
-         DO jj = 1, jpj
-!CDIR NOVERRCHK
-            DO ji = 1, jpi
-
-               ! DUMMY VARIABLES FOR DIC, H+, AND BORATE
-               zbot  = borat(ji,jj,1)
-               zfact = rhop(ji,jj,1) / 1000. + rtrn
-               zdic  = trn(ji,jj,1,jpdic) / zfact
-               zph   = MAX( hi(ji,jj,1), 1.e-10 ) / zfact
-               zalka = trn(ji,jj,1,jptal) / zfact
-
-               ! CALCULATE [ALK]([CO3--], [HCO3-])
-               zalk  = zalka - (  akw3(ji,jj,1) / zph - zph + zbot / ( 1.+ zph / akb3(ji,jj,1) )  )
-
-               ! CALCULATE [H+] AND [H2CO3]
-               zah2   = SQRT(  (zdic-zalk)**2 + 4.* ( zalk * ak23(ji,jj,1)   &
-                  &                                        / ak13(ji,jj,1) ) * ( 2.* zdic - zalk )  )
-               zah2   = 0.5 * ak13(ji,jj,1) / zalk * ( ( zdic - zalk ) + zah2 )
-               zh2co3(ji,jj) = ( 2.* zdic - zalk ) / ( 2.+ ak13(ji,jj,1) / zah2 ) * zfact
-               hi(ji,jj,1)   = zah2 * zfact
-            END DO
-         END DO
-      END DO
-
-
-      ! --------------
-      ! COMPUTE FLUXES
-      ! --------------
-
-      ! FIRST COMPUTE GAS EXCHANGE COEFFICIENTS
-      ! -------------------------------------------
-
-!CDIR NOVERRCHK
-      DO jj = 1, jpj
-!CDIR NOVERRCHK
-         DO ji = 1, jpi
-            ztc  = MIN( 35., tsn(ji,jj,1,jp_tem) )
-            ztc2 = ztc * ztc
-            ztc3 = ztc * ztc2 
-            ! Compute the schmidt Number both O2 and CO2
-            zsch_co2 = 2073.1 - 125.62 * ztc + 3.6276 * ztc2 - 0.043126 * ztc3
-            zsch_o2  = 1953.4 - 128.0  * ztc + 3.9918 * ztc2 - 0.050091 * ztc3
-            !  wind speed 
-            zws  = wndm(ji,jj) * wndm(ji,jj)
-            ! Compute the piston velocity for O2 and CO2
-            zkgwan = 0.3 * zws  + 2.5 * ( 0.5246 + 0.016256 * ztc + 0.00049946  * ztc2 )
-            zkgwan = zkgwan * xconv * ( 1.- fr_i(ji,jj) ) * tmask(ji,jj,1)
-# if defined key_degrad
-            zkgwan = zkgwan * facvol(ji,jj,1)
-#endif 
-            ! compute gas exchange for CO2 and O2
-            zkgco2(ji,jj) = zkgwan * SQRT( 660./ zsch_co2 )
-            zkgo2 (ji,jj) = zkgwan * SQRT( 660./ zsch_o2 )
-         END DO
-      END DO
-
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            ! Compute CO2 flux for the sea and air
-            zfld = satmco2(ji,jj) * patm(ji,jj) * tmask(ji,jj,1) * chemc(ji,jj,1) * zkgco2(ji,jj)   ! (mol/L) * (m/s)
-            zflu = zh2co3(ji,jj) * tmask(ji,jj,1) * zkgco2(ji,jj)                                   ! (mol/L) (m/s) ?
-            oce_co2(ji,jj) = ( zfld - zflu ) * rfact * e1e2t(ji,jj) * tmask(ji,jj,1) * 1000.
-            ! compute the trend
-            tra(ji,jj,1,jpdic) = tra(ji,jj,1,jpdic) + ( zfld - zflu ) / fse3t(ji,jj,1)
-
-            ! Compute O2 flux 
-            zfld16 = atcox * patm(ji,jj) * chemc(ji,jj,2) * tmask(ji,jj,1) * zkgo2(ji,jj)          ! (mol/L) * (m/s)
-            zflu16 = trn(ji,jj,1,jpoxy) * tmask(ji,jj,1) * zkgo2(ji,jj)
-            zoflx(ji,jj) = zfld16 - zflu16
-            tra(ji,jj,1,jpoxy) = tra(ji,jj,1,jpoxy) + zoflx(ji,jj) / fse3t(ji,jj,1)
-         END DO
-      END DO
-
-      t_oce_co2_flx = t_oce_co2_flx + glob_sum( oce_co2(:,:) )            ! Cumulative Total Flux of Carbon
-      IF( kt == nitend ) THEN
-         t_atm_co2_flx = glob_sum( satmco2(:,:) * patm(:,:) * e1e2t(:,:) )            ! Total atmospheric pCO2
-         !
-         t_oce_co2_flx = (-1.) * t_oce_co2_flx  * 12. / 1.e15             ! Conversion in PgC ; negative for out of the ocean
-         t_atm_co2_flx = t_atm_co2_flx  / area                            ! global mean of atmospheric pCO2
-         !
-         IF( lwp) THEN
-            WRITE(numout,*)
-            WRITE(numout,*) ' Global mean of atmospheric pCO2 (ppm) at it= ', kt, ' date= ', ndastp
-            WRITE(numout,*) '------------------------------------------------------- :  ',t_atm_co2_flx
-            WRITE(numout,*)
-            WRITE(numout,*) ' Cumulative total Flux of Carbon out of the ocean (PgC) :'
-            WRITE(numout,*) '-------------------------------------------------------  ',t_oce_co2_flx
-         ENDIF
-         !
-      ENDIF
-
-      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
-         WRITE(charout, FMT="('flx ')")
-         CALL prt_ctl_trc_info(charout)
-         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
-      ENDIF
-
-      IF( ln_diatrc ) THEN
-         IF( lk_iomput ) THEN
-            CALL iom_put( "Cflx" , oce_co2(:,:) / e1e2t(:,:) / rfact ) 
-            CALL iom_put( "Oflx" , zoflx(:,:) * 1000 * tmask(:,:,1)  )
-            CALL iom_put( "Kg"   , zkgco2(:,:) * tmask(:,:,1) )
-            CALL iom_put( "Dpco2", ( satmco2(:,:) * patm(:,:) - zh2co3(:,:) / ( chemc(:,:,1) + rtrn ) ) * tmask(:,:,1) )
-            CALL iom_put( "Dpo2" , ( atcox * patm(:,:) - trn(:,:,1,jpoxy) / ( chemc(:,:,2) + rtrn ) ) * tmask(:,:,1) )
-         ELSE
-            trc2d(:,:,jp_pcs0_2d    ) = oce_co2(:,:) / e1e2t(:,:) / rfact 
-            trc2d(:,:,jp_pcs0_2d + 1) = zoflx(:,:) * 1000 * tmask(:,:,1) 
-            trc2d(:,:,jp_pcs0_2d + 2) = zkgco2(:,:) * tmask(:,:,1) 
-            trc2d(:,:,jp_pcs0_2d + 3) = ( satmco2(:,:) * patm(:,:) - zh2co3(:,:) / ( chemc(:,:,1) + rtrn ) ) * tmask(:,:,1) 
-         ENDIF
-      ENDIF
-      !
-      CALL wrk_dealloc( jpi, jpj, zkgco2, zkgo2, zh2co3, zoflx )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_flx')
-      !
-   END SUBROUTINE p4z_flx
-
-
-   SUBROUTINE p4z_flx_init
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE p4z_flx_init  ***
-      !!
-      !! ** Purpose :   Initialization of atmospheric conditions
-      !!
-      !! ** Method  :   Read the nampisext namelist and check the parameters
-      !!      called at the first timestep (nittrc000)
-      !! ** input   :   Namelist nampisext
-      !!----------------------------------------------------------------------
-      NAMELIST/nampisext/ln_co2int, atcco2, clname, nn_offset
-      INTEGER :: jm
-      !!----------------------------------------------------------------------
-      !
-      REWIND( numnatp )                     ! read numnatp
-      READ  ( numnatp, nampisext )
-      !
-      IF(lwp) THEN                         ! control print
-         WRITE(numout,*) ' '
-         WRITE(numout,*) ' Namelist parameters for air-sea exchange, nampisext'
-         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
-         WRITE(numout,*) '    Choice for reading in the atm pCO2 file or constant value, ln_co2int =', ln_co2int
-         WRITE(numout,*) ' '
-      ENDIF
-      IF( .NOT.ln_co2int ) THEN
-         IF(lwp) THEN                         ! control print
-            WRITE(numout,*) '    Constant Atmospheric pCO2 value  atcco2    =', atcco2
-            WRITE(numout,*) ' '
-         ENDIF
-         satmco2(:,:)  = atcco2      ! Initialisation of atmospheric pco2
-      ELSE
-         IF(lwp)  THEN
-            WRITE(numout,*) '    Atmospheric pCO2 value  from file clname      =', TRIM( clname )
-            WRITE(numout,*) '    Offset model-data start year      nn_offset   =', nn_offset
-            WRITE(numout,*) ' '
-         ENDIF
-         CALL ctl_opn( numco2, TRIM( clname) , 'OLD', 'FORMATTED', 'SEQUENTIAL', -1 , numout, lwp )
-         jm = 0                      ! Count the number of record in co2 file
-         DO
-           READ(numco2,*,END=100) 
-           jm = jm + 1
-         END DO
- 100     nmaxrec = jm - 1 
-         ALLOCATE( years  (nmaxrec) )     ;      years  (:) = 0._wp
-         ALLOCATE( atcco2h(nmaxrec) )     ;      atcco2h(:) = 0._wp
-
-         REWIND(numco2)
-         DO jm = 1, nmaxrec          ! get  xCO2 data
-            READ(numco2, *)  years(jm), atcco2h(jm)
-            IF(lwp) WRITE(numout, '(f6.0,f7.2)')  years(jm), atcco2h(jm)
-         END DO
-         CLOSE(numco2)
-      ENDIF
-      !
-      area = glob_sum( e1e2t(:,:) )        ! interior global domain surface
-      !
-      oce_co2(:,:)  = 0._wp                ! Initialization of Flux of Carbon
-      t_atm_co2_flx = 0._wp
-      t_oce_co2_flx = 0._wp
-      !
-      CALL p4z_patm( nit000 )
-      !
-   END SUBROUTINE p4z_flx_init
-
-   SUBROUTINE p4z_patm( kt )
-
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE p4z_atm  ***
-      !!
-      !! ** Purpose :   Read and interpolate the external atmospheric sea-levl pressure
-      !! ** Method  :   Read the files and interpolate the appropriate variables
-      !!
-      !!----------------------------------------------------------------------
-      !! * arguments
-      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
-      !
-      INTEGER            ::  ierr
-      CHARACTER(len=100) ::  cn_dir   ! Root directory for location of ssr files
-      TYPE(FLD_N)        ::  sn_patm  ! informations about the fields to be read
-      !!
-      NAMELIST/nampisatm/ ln_presatm, sn_patm, cn_dir
-
-      !                                         ! -------------------- !
-      IF( kt == nit000 ) THEN                   ! First call kt=nittrc000 !
-         !                                      ! -------------------- !
-         !                                            !* set file information (default values)
-         ! ... default values (NB: frequency positive => hours, negative => months)
-         !            !   file   ! frequency !  variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation !
-         !            !   name   !  (hours)  !   name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs    !
-         sn_patm = FLD_N( 'pres'  ,    24     ,  'patm'    ,  .false.   , .true.  ,   'yearly'  , ''       , ''       )
-         cn_dir  = './'          ! directory in which the Patm data are 
-
-         REWIND( numnatp )                             !* read in namlist nampisatm
-         READ  ( numnatp, nampisatm ) 
-         !
-         !
-         IF(lwp) THEN                                 !* control print
-            WRITE(numout,*)
-            WRITE(numout,*) '   Namelist nampisatm : Atmospheric Pressure as external forcing'
-            WRITE(numout,*) '      constant atmopsheric pressure (F) or from a file (T)  ln_presatm = ', ln_presatm
-            WRITE(numout,*)
-         ENDIF
-         !
-         IF( ln_presatm ) THEN
-            ALLOCATE( sf_patm(1), STAT=ierr )           !* allocate and fill sf_patm (forcing structure) with sn_patm
-            IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'p4z_flx: unable to allocate sf_patm structure' )
-            !
-            CALL fld_fill( sf_patm, (/ sn_patm /), cn_dir, 'p4z_flx', 'Atmospheric pressure ', 'nampisatm' )
-                                   ALLOCATE( sf_patm(1)%fnow(jpi,jpj,1)   )
-            IF( sn_patm%ln_tint )  ALLOCATE( sf_patm(1)%fdta(jpi,jpj,1,2) )
-         ENDIF
-         !                                         
-         IF( .NOT.ln_presatm )   patm(:,:) = 1.e0    ! Initialize patm if no reading from a file
-         !
-      ENDIF
-      !
-      IF( ln_presatm ) THEN
-         CALL fld_read( kt, 1, sf_patm )               !* input Patm provided at kt + 1/2
-         patm(:,:) = sf_patm(1)%fnow(:,:,1)                        ! atmospheric pressure
-      ENDIF
-      !
-   END SUBROUTINE p4z_patm
-
-   INTEGER FUNCTION p4z_flx_alloc()
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_flx_alloc  ***
-      !!----------------------------------------------------------------------
-      ALLOCATE( oce_co2(jpi,jpj), satmco2(jpi,jpj), patm(jpi,jpj), STAT=p4z_flx_alloc )
-      !
-      IF( p4z_flx_alloc /= 0 )   CALL ctl_warn('p4z_flx_alloc : failed to allocate arrays')
-      !
-   END FUNCTION p4z_flx_alloc
-
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_flx( kt )                   ! Empty routine
-      INTEGER, INTENT( in ) ::   kt
-      WRITE(*,*) 'p4z_flx: You should not have seen this print! error?', kt
-   END SUBROUTINE p4z_flx
-#endif 
-
-   !!======================================================================
-END MODULE  p4zflx
Index: anches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zint.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zint.F90	(revision 3679)
+++ 	(revision )
@@ -1,80 +1,0 @@
-MODULE p4zint
-   !!======================================================================
-   !!                         ***  MODULE p4zint  ***
-   !! TOP :   PISCES interpolation and computation of various accessory fields
-   !!======================================================================
-   !! History :   1.0  !  2004-03 (O. Aumont) Original code
-   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
-   !!   p4z_int        :  interpolation and computation of various accessory fields
-   !!----------------------------------------------------------------------
-   USE oce_trc         !  shared variables between ocean and passive tracers
-   USE trc             !  passive tracers common variables 
-   USE sms_pisces      !  PISCES Source Minus Sink variables
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   p4z_int  
-   REAL(wp) ::   xksilim = 16.5e-6_wp   ! Half-saturation constant for the Si half-saturation constant computation
-
-   !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE p4z_int
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_int  ***
-      !!
-      !! ** Purpose :   interpolation and computation of various accessory fields
-      !!
-      !!---------------------------------------------------------------------
-      INTEGER  ::   ji, jj                 ! dummy loop indices
-      REAL(wp) ::   zvar                   ! local variable
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_int')
-      !
-      ! Computation of phyto and zoo metabolic rate
-      ! -------------------------------------------
-      tgfunc (:,:,:) = EXP( 0.063913 * tsn(:,:,:,jp_tem) )
-      tgfunc2(:,:,:) = EXP( 0.07608  * tsn(:,:,:,jp_tem) )
-
-      ! Computation of the silicon dependant half saturation
-      ! constant for silica uptake
-      ! ---------------------------------------------------
-      DO ji = 1, jpi
-         DO jj = 1, jpj
-            zvar = trn(ji,jj,1,jpsil) * trn(ji,jj,1,jpsil)
-            xksimax(ji,jj) = MAX( xksimax(ji,jj), ( 1.+ 7.* zvar / ( xksilim * xksilim + zvar ) ) * 1e-6 )
-         END DO
-      END DO
-      !
-      IF( nday_year == nyear_len(1) ) THEN
-         xksi    = xksimax
-         xksimax = 0._wp
-      ENDIF
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_int')
-      !
-   END SUBROUTINE p4z_int
-
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_int                   ! Empty routine
-      WRITE(*,*) 'p4z_int: You should not have seen this print! error?'
-   END SUBROUTINE p4z_int
-#endif 
-
-   !!======================================================================
-END MODULE  p4zint
Index: anches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zlim.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zlim.F90	(revision 3679)
+++ 	(revision )
@@ -1,236 +1,0 @@
-MODULE p4zlim
-   !!======================================================================
-   !!                         ***  MODULE p4zlim  ***
-   !! TOP :   PISCES 
-   !!======================================================================
-   !! History :   1.0  !  2004     (O. Aumont) Original code
-   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
-   !!             3.4  !  2011-04  (O. Aumont, C. Ethe) Limitation for iron modelled in quota 
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
-   !!   p4z_lim        :   Compute the nutrients limitation terms 
-   !!   p4z_lim_init   :   Read the namelist 
-   !!----------------------------------------------------------------------
-   USE oce_trc         ! Shared ocean-passive tracers variables
-   USE trc             ! Tracers defined
-   USE sms_pisces      ! PISCES variables
-   USE p4zopt          ! Optical
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC p4z_lim    
-   PUBLIC p4z_lim_init    
-
-   !! * Shared module variables
-   REAL(wp), PUBLIC ::  conc0     = 2.e-6_wp      !:  NO3, PO4 half saturation   
-   REAL(wp), PUBLIC ::  conc1     = 8.e-6_wp      !:  Phosphate half saturation for diatoms  
-   REAL(wp), PUBLIC ::  conc2     = 1.e-9_wp      !:  Iron half saturation for nanophyto 
-   REAL(wp), PUBLIC ::  conc2m    = 3.e-9_wp      !:  Max iron half saturation for nanophyto 
-   REAL(wp), PUBLIC ::  conc3     = 2.e-9_wp      !:  Iron half saturation for diatoms  
-   REAL(wp), PUBLIC ::  conc3m    = 8.e-9_wp      !:  Max iron half saturation for diatoms 
-   REAL(wp), PUBLIC ::  xsizedia  = 5.e-7_wp      !:  Minimum size criteria for diatoms
-   REAL(wp), PUBLIC ::  xsizephy  = 1.e-6_wp      !:  Minimum size criteria for nanophyto
-   REAL(wp), PUBLIC ::  concnnh4  = 1.e-7_wp      !:  NH4 half saturation for phyto  
-   REAL(wp), PUBLIC ::  concdnh4  = 4.e-7_wp      !:  NH4 half saturation for diatoms
-   REAL(wp), PUBLIC ::  xksi1     = 2.E-6_wp      !:  half saturation constant for Si uptake 
-   REAL(wp), PUBLIC ::  xksi2     = 3.33e-6_wp    !:  half saturation constant for Si/C 
-   REAL(wp), PUBLIC ::  xkdoc     = 417.e-6_wp    !:  2nd half-sat. of DOC remineralization  
-   REAL(wp), PUBLIC ::  concfebac = 1.E-11_wp     !:  Fe half saturation for bacteria 
-   REAL(wp), PUBLIC ::  qnfelim   = 7.E-6_wp      !:  optimal Fe quota for nanophyto
-   REAL(wp), PUBLIC ::  qdfelim   = 7.E-6_wp      !:  optimal Fe quota for diatoms
-   REAL(wp), PUBLIC ::  caco3r    = 0.16_wp       !:  mean rainratio 
-
-   ! Coefficient for iron limitation
-   REAL(wp) ::  xcoef1   = 0.0016  / 55.85  
-   REAL(wp) ::  xcoef2   = 1.21E-5 * 14. / 55.85 / 7.625 * 0.5 * 1.5
-   REAL(wp) ::  xcoef3   = 1.15E-4 * 14. / 55.85 / 7.625 * 0.5 
-   !!* Substitution
-#  include "top_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE p4z_lim( kt )
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_lim  ***
-      !!
-      !! ** Purpose :   Compute the co-limitations by the various nutrients
-      !!              for the various phytoplankton species
-      !!
-      !! ** Method  : - ???
-      !!---------------------------------------------------------------------
-      !
-      INTEGER, INTENT(in)  :: kt
-      !
-      INTEGER  ::   ji, jj, jk
-      REAL(wp) ::   zlim1, zlim2, zlim3, zlim4, zno3, zferlim
-      REAL(wp) ::   zconcd, zconcd2, zconcn, zconcn2
-      REAL(wp) ::   z1_trndia, z1_trnphy, ztem1, ztem2, zetot1, zetot2
-      REAL(wp) ::   zdenom, zratio, zironmin
-      REAL(wp) ::   zconc1d, zconc1dnh4, zconc0n, zconc0nnh4   
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_lim')
-      !
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               
-               ! Tuning of the iron concentration to a minimum level that is set to the detection limit
-               !-------------------------------------
-               zno3    = trn(ji,jj,jk,jpno3) / 40.e-6
-               zferlim = MAX( 2e-11 * zno3 * zno3, 5e-12 )
-               zferlim = MIN( zferlim, 3e-11 )
-               trn(ji,jj,jk,jpfer) = MAX( trn(ji,jj,jk,jpfer), zferlim )
-
-               ! Computation of a variable Ks for iron on diatoms taking into account
-               ! that increasing biomass is made of generally bigger cells
-               !------------------------------------------------
-               zconcd   = MAX( 0.e0 , trn(ji,jj,jk,jpdia) - xsizedia )
-               zconcd2  = trn(ji,jj,jk,jpdia) - zconcd
-               zconcn   = MAX( 0.e0 , trn(ji,jj,jk,jpphy) - xsizephy )
-               zconcn2  = trn(ji,jj,jk,jpphy) - zconcn
-               z1_trnphy   = 1. / ( trn(ji,jj,jk,jpphy) + rtrn )
-               z1_trndia   = 1. / ( trn(ji,jj,jk,jpdia) + rtrn )
-
-               concdfe(ji,jj,jk) = MAX( conc3       , ( zconcd2 *      conc3    + conc3m        * zconcd ) * z1_trndia )
-               zconc1d           = MAX( 2.* conc0   , ( zconcd2 * 2. * conc0    + conc1         * zconcd ) * z1_trndia )
-               zconc1dnh4        = MAX( 2.* concnnh4, ( zconcd2 * 2. * concnnh4 + concdnh4      * zconcd ) * z1_trndia )
-
-               concnfe(ji,jj,jk) = MAX( conc2       , ( zconcn2 * conc2         + conc2m        * zconcn ) * z1_trnphy )
-               zconc0n           = MAX( conc0       , ( zconcn2 * conc0         + 2. * conc0    * zconcn ) * z1_trnphy )
-               zconc0nnh4        = MAX( concnnh4    , ( zconcn2 * concnnh4      + 2. * concnnh4 * zconcn ) * z1_trnphy )
-
-               ! Michaelis-Menten Limitation term for nutrients Small flagellates
-               ! -----------------------------------------------
-               zdenom = 1. /  ( zconc0n * zconc0nnh4 + zconc0nnh4 * trn(ji,jj,jk,jpno3) + zconc0n * trn(ji,jj,jk,jpnh4) )
-               xnanono3(ji,jj,jk) = trn(ji,jj,jk,jpno3) * zconc0nnh4 * zdenom
-               xnanonh4(ji,jj,jk) = trn(ji,jj,jk,jpnh4) * zconc0n    * zdenom
-               !
-               zlim1    = xnanono3(ji,jj,jk) + xnanonh4(ji,jj,jk)
-               zlim2    = trn(ji,jj,jk,jppo4) / ( trn(ji,jj,jk,jppo4) + zconc0nnh4 )
-               zratio   = trn(ji,jj,jk,jpnfe) * z1_trnphy 
-               zironmin = xcoef1 * trn(ji,jj,jk,jpnch) * z1_trnphy + xcoef2 * zlim1 + xcoef3 * xnanono3(ji,jj,jk)
-               zlim3    = MAX( 0.,( zratio - zironmin ) / qnfelim )
-               xlimnfe(ji,jj,jk) = MIN( 1., zlim3 )
-               xlimphy(ji,jj,jk) = MIN( zlim1, zlim2, zlim3 )
-               !
-               zlim1    = trn(ji,jj,jk,jpnh4) / ( concnnh4 + trn(ji,jj,jk,jpnh4) )
-               zlim3    = trn(ji,jj,jk,jpfer) / ( concfebac+ trn(ji,jj,jk,jpfer) )
-               zlim4    = trn(ji,jj,jk,jpdoc) / ( xkdoc   + trn(ji,jj,jk,jpdoc) )
-               xlimbac(ji,jj,jk) = MIN( zlim1, zlim2, zlim3 ) * zlim4
-
-               !   Michaelis-Menten Limitation term for nutrients Diatoms
-               !   ----------------------------------------------
-               zdenom   = 1. / ( zconc1d * zconc1dnh4 + zconc1dnh4 * trn(ji,jj,jk,jpno3) + zconc1d * trn(ji,jj,jk,jpnh4) )
-               xdiatno3(ji,jj,jk) = trn(ji,jj,jk,jpno3) * zconc1dnh4 * zdenom
-               xdiatnh4(ji,jj,jk) = trn(ji,jj,jk,jpnh4) * zconc1d    * zdenom
-               !
-               zlim1    = xdiatno3(ji,jj,jk) + xdiatnh4(ji,jj,jk)
-               zlim2    = trn(ji,jj,jk,jppo4) / ( trn(ji,jj,jk,jppo4) + zconc1dnh4  )
-               zlim3    = trn(ji,jj,jk,jpsil) / ( trn(ji,jj,jk,jpsil) + xksi(ji,jj) )
-               zratio   = trn(ji,jj,jk,jpdfe)/(trn(ji,jj,jk,jpdia)+rtrn)
-               zironmin = xcoef1 * trn(ji,jj,jk,jpdch) * z1_trndia + xcoef2 * zlim1 + xcoef3 * xdiatno3(ji,jj,jk)
-               zlim4    = MAX( 0., ( zratio - zironmin ) / qdfelim )
-               xlimdfe(ji,jj,jk) = MIN( 1., zlim4 )
-               xlimdia(ji,jj,jk) = MIN( zlim1, zlim2, zlim3, zlim4 )
-               xlimsi(ji,jj,jk)  = MIN( zlim1, zlim2, zlim4 )
-           END DO
-         END DO
-      END DO
-
-      ! Compute the fraction of nanophytoplankton that is made of calcifiers
-      ! --------------------------------------------------------------------
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               zlim1 =  ( trn(ji,jj,jk,jpno3) * concnnh4 + trn(ji,jj,jk,jpnh4) * conc0 )    &
-                  &   / ( conc0 * concnnh4 + concnnh4 * trn(ji,jj,jk,jpno3)  + conc0 * trn(ji,jj,jk,jpnh4) ) 
-               zlim2  = trn(ji,jj,jk,jppo4) / ( trn(ji,jj,jk,jppo4) + concnnh4 )
-               zlim3  = trn(ji,jj,jk,jpfer) / ( trn(ji,jj,jk,jpfer) + concfebac )
-               ztem1  = MAX( 0., tsn(ji,jj,jk,jp_tem) )
-               ztem2  = tsn(ji,jj,jk,jp_tem) - 10.
-               zetot1 = MAX( 0., etot(ji,jj,jk) - 1.) / ( 4. + etot(ji,jj,jk) ) 
-               zetot2 = 1. / ( 30. + etot(ji,jj,jk) ) 
-
-               xfracal(ji,jj,jk) = caco3r * MIN( zlim1, zlim2, zlim3 )                  &
-                  &                       * ztem1 / ( 0.1 + ztem1 )                     &
-                  &                       * MAX( 1., trn(ji,jj,jk,jpphy) * 1.e6 / 2. )  &
-                  &                       * 2.325 * zetot1 * 30. * zetot2               &
-                  &                       * ( 1. + EXP(-ztem2 * ztem2 / 25. ) )         &
-                  &                       * MIN( 1., 50. / ( hmld(ji,jj) + rtrn ) )
-               xfracal(ji,jj,jk) = MIN( 0.8 , xfracal(ji,jj,jk) )
-               xfracal(ji,jj,jk) = MAX( 0.02, xfracal(ji,jj,jk) )
-            END DO
-         END DO
-      END DO
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_lim')
-      !
-   END SUBROUTINE p4z_lim
-
-   SUBROUTINE p4z_lim_init
-
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE p4z_lim_init  ***
-      !!
-      !! ** Purpose :   Initialization of nutrient limitation parameters
-      !!
-      !! ** Method  :   Read the nampislim namelist and check the parameters
-      !!      called at the first timestep (nittrc000)
-      !!
-      !! ** input   :   Namelist nampislim
-      !!
-      !!----------------------------------------------------------------------
-
-      NAMELIST/nampislim/ conc0, conc1, conc2, conc2m, conc3, conc3m,   &
-         &                xsizedia, xsizephy, concnnh4, concdnh4,       &
-         &                xksi1, xksi2, xkdoc, concfebac, qnfelim, qdfelim, caco3r
-
-      REWIND( numnatp )                     ! read numnat
-      READ  ( numnatp, nampislim )
-
-      IF(lwp) THEN                         ! control print
-         WRITE(numout,*) ' '
-         WRITE(numout,*) ' Namelist parameters for nutrient limitations, nampislim'
-         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
-         WRITE(numout,*) '    mean rainratio                           caco3r    = ', caco3r
-         WRITE(numout,*) '    NO3, PO4 half saturation                 conc0     =  ', conc0
-         WRITE(numout,*) '    half saturation constant for Si uptake   xksi1     = ', xksi1
-         WRITE(numout,*) '    half saturation constant for Si/C        xksi2     = ', xksi2
-         WRITE(numout,*) '    2nd half-sat. of DOC remineralization    xkdoc     = ', xkdoc
-         WRITE(numout,*) '    Phosphate half saturation for diatoms    conc1     = ', conc1
-         WRITE(numout,*) '    Iron half saturation for phyto           conc2     = ', conc2
-         WRITE(numout,*) '    Max iron half saturation for phyto       conc2m    = ', conc2m
-         WRITE(numout,*) '    Iron half saturation for diatoms         conc3     = ', conc3
-         WRITE(numout,*) '    Maxi iron half saturation for diatoms    conc3m    = ', conc3m
-         WRITE(numout,*) '    Minimum size criteria for diatoms        xsizedia  = ', xsizedia
-         WRITE(numout,*) '    Minimum size criteria for nanophyto      xsizephy  = ', xsizephy
-         WRITE(numout,*) '    NH4 half saturation for phyto            concnnh4  = ', concnnh4
-         WRITE(numout,*) '    NH4 half saturation for diatoms          concdnh4  = ', concdnh4
-         WRITE(numout,*) '    Fe half saturation for bacteria          concfebac = ', concfebac
-         WRITE(numout,*) '    optimal Fe quota for nano.               qnfelim   = ', qnfelim
-         WRITE(numout,*) '    Optimal Fe quota for diatoms             qdfelim   = ', qdfelim
-      ENDIF
-
-   END SUBROUTINE p4z_lim_init
-
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_lim                   ! Empty routine
-   END SUBROUTINE p4z_lim
-#endif 
-
-   !!======================================================================
-END MODULE  p4zlim
Index: anches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zlys.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zlys.F90	(revision 3679)
+++ 	(revision )
@@ -1,219 +1,0 @@
-MODULE p4zlys
-   !!======================================================================
-   !!                         ***  MODULE p4zlys  ***
-   !! TOP :   PISCES 
-   !!======================================================================
-   !! History :    -   !  1988-07  (E. MAIER-REIMER) Original code
-   !!              -   !  1998     (O. Aumont) additions
-   !!              -   !  1999     (C. Le Quere) modifications
-   !!             1.0  !  2004     (O. Aumont) modifications
-   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
-   !!                  !  2011-02  (J. Simeon, J. Orr)  Calcon salinity dependence
-   !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Improvment of calcite dissolution
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
-   !!   p4z_lys        :   Compute the CaCO3 dissolution 
-   !!   p4z_lys_init   :   Read the namelist parameters
-   !!----------------------------------------------------------------------
-   USE oce_trc         !  shared variables between ocean and passive tracers
-   USE trc             !  passive tracers common variables 
-   USE sms_pisces      !  PISCES Source Minus Sink variables
-   USE prtctl_trc      !  print control for debugging
-   USE iom             !  I/O manager
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   p4z_lys         ! called in trcsms_pisces.F90
-   PUBLIC   p4z_lys_init    ! called in trcsms_pisces.F90
-
-   !! * Shared module variables
-   REAL(wp), PUBLIC :: kdca = 0.327e3_wp  !: diss. rate constant calcite
-   REAL(wp), PUBLIC :: nca  = 1.0_wp      !: order of reaction for calcite dissolution
-
-   !! * Module variables
-   REAL(wp) :: calcon = 1.03E-2           !: mean calcite concentration [Ca2+] in sea water [mole/kg solution]
- 
-   INTEGER  :: rmtss                      !: number of seconds per month 
-
-   !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE p4z_lys( kt )
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_lys  ***
-      !!
-      !! ** Purpose :   CALCULATES DEGREE OF CACO3 SATURATION IN THE WATER
-      !!                COLUMN, DISSOLUTION/PRECIPITATION OF CACO3 AND LOSS
-      !!                OF CACO3 TO THE CACO3 SEDIMENT POOL.
-      !!
-      !! ** Method  : - ???
-      !!---------------------------------------------------------------------
-      !
-      INTEGER, INTENT(in) ::   kt ! ocean time step
-      INTEGER  ::   ji, jj, jk, jn
-      REAL(wp) ::   zalk, zdic, zph, zah2
-      REAL(wp) ::   zdispot, zfact, zcalcon, zalka, zaldi
-      REAL(wp) ::   zomegaca, zexcess, zexcess0
-      REAL(wp) ::   zrfact2
-      CHARACTER (len=25) :: charout
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zco3, zcaldiss   
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_lys')
-      !
-      CALL wrk_alloc( jpi, jpj, jpk, zco3, zcaldiss )
-      !
-      zco3    (:,:,:) = 0.
-      zcaldiss(:,:,:) = 0.
-      !     -------------------------------------------
-      !     COMPUTE [CO3--] and [H+] CONCENTRATIONS
-      !     -------------------------------------------
-      
-      DO jn = 1, 5                               !  BEGIN OF ITERATION
-         !
-!CDIR NOVERRCHK
-         DO jk = 1, jpkm1
-!CDIR NOVERRCHK
-            DO jj = 1, jpj
-!CDIR NOVERRCHK
-               DO ji = 1, jpi
-                  zfact = rhop(ji,jj,jk) / 1000. + rtrn
-                  zph  = hi(ji,jj,jk) * tmask(ji,jj,jk) / zfact + ( 1.-tmask(ji,jj,jk) ) * 1.e-9 ! [H+]
-                  zdic  = trn(ji,jj,jk,jpdic) / zfact
-                  zalka = trn(ji,jj,jk,jptal) / zfact
-                  ! CALCULATE [ALK]([CO3--], [HCO3-])
-                  zalk  = zalka - ( akw3(ji,jj,jk) / zph - zph + borat(ji,jj,jk) / ( 1. + zph / akb3(ji,jj,jk) ) )
-                  ! CALCULATE [H+] and [CO3--]
-                  zaldi = zdic - zalk
-                  zah2  = SQRT( zaldi * zaldi + 4.* ( zalk * ak23(ji,jj,jk) / ak13(ji,jj,jk) ) * ( zdic + zaldi ) )
-                  zah2  = 0.5 * ak13(ji,jj,jk) / zalk * ( zaldi + zah2 )
-                  !
-                  zco3(ji,jj,jk) = zalk / ( 2. + zah2 / ak23(ji,jj,jk) ) * zfact
-                  hi(ji,jj,jk)   = zah2 * zfact
-               END DO
-            END DO
-         END DO
-         !
-      END DO 
-
-      !     ---------------------------------------------------------
-      !        CALCULATE DEGREE OF CACO3 SATURATION AND CORRESPONDING
-      !        DISSOLOUTION AND PRECIPITATION OF CACO3 (BE AWARE OF
-      !        MGCO3)
-      !     ---------------------------------------------------------
-
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-
-               ! DEVIATION OF [CO3--] FROM SATURATION VALUE
-               ! Salinity dependance in zomegaca and divide by rhop/1000 to have good units
-               zcalcon  = calcon * ( tsn(ji,jj,jk,jp_sal) / 35._wp )
-               zfact    = rhop(ji,jj,jk) / 1000._wp
-               zomegaca = ( zcalcon * zco3(ji,jj,jk) * zfact ) / aksp(ji,jj,jk) 
-
-               ! SET DEGREE OF UNDER-/SUPERSATURATION
-               excess(ji,jj,jk) = 1._wp - zomegaca
-               zexcess0 = MAX( 0., excess(ji,jj,jk) )
-               zexcess  = zexcess0**nca
-
-               ! AMOUNT CACO3 (12C) THAT RE-ENTERS SOLUTION
-               !       (ACCORDING TO THIS FORMULATION ALSO SOME PARTICULATE
-               !       CACO3 GETS DISSOLVED EVEN IN THE CASE OF OVERSATURATION)
-               zdispot = kdca * zexcess * trn(ji,jj,jk,jpcal)
-# if defined key_degrad
-               zdispot = zdispot * facvol(ji,jj,jk)
-# endif
-              !  CHANGE OF [CO3--] , [ALK], PARTICULATE [CACO3],
-              !       AND [SUM(CO2)] DUE TO CACO3 DISSOLUTION/PRECIPITATION
-              zcaldiss(ji,jj,jk)  = zdispot / rmtss  ! calcite dissolution
-              zco3(ji,jj,jk)      = zco3(ji,jj,jk) + zcaldiss(ji,jj,jk) * rfact
-              !
-              tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + 2. * zcaldiss(ji,jj,jk)
-              tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) -      zcaldiss(ji,jj,jk)
-              tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) +      zcaldiss(ji,jj,jk)
-            END DO
-         END DO
-      END DO
-      !
-      IF( ln_diatrc )  THEN
-         !
-         IF( lk_iomput ) THEN
-            zrfact2 = 1.e3 * rfact2r
-            CALL iom_put( "PH"    , -1. * LOG10( hi(:,:,:) )                * tmask(:,:,:) )
-            CALL iom_put( "CO3"   ,        zco3    (:,:,:) * 1e+3           * tmask(:,:,:) )
-            CALL iom_put( "CO3sat",        aksp    (:,:,:) * 1e+3 / calcon  * tmask(:,:,:) )
-            CALL iom_put( "DCAL"  ,        zcaldiss(:,:,:) * zrfact2        * tmask(:,:,:) )
-         ELSE
-            trc3d(:,:,:,jp_pcs0_3d    ) = -1. * LOG10( hi(:,:,:) ) * tmask(:,:,:)
-            trc3d(:,:,:,jp_pcs0_3d + 1) = zco3(:,:,:)              * tmask(:,:,:)
-            trc3d(:,:,:,jp_pcs0_3d + 2) = aksp(:,:,:) / calcon     * tmask(:,:,:)
-         ENDIF
-         !
-      ENDIF
-      !
-      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
-        WRITE(charout, FMT="('lys ')")
-        CALL prt_ctl_trc_info(charout)
-        CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
-      ENDIF
-      !
-      CALL wrk_dealloc( jpi, jpj, jpk, zco3, zcaldiss )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_lys')
-      !
-   END SUBROUTINE p4z_lys
-
-   SUBROUTINE p4z_lys_init
-
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE p4z_lys_init  ***
-      !!
-      !! ** Purpose :   Initialization of CaCO3 dissolution parameters
-      !!
-      !! ** Method  :   Read the nampiscal namelist and check the parameters
-      !!      called at the first timestep (nittrc000)
-      !!
-      !! ** input   :   Namelist nampiscal
-      !!
-      !!----------------------------------------------------------------------
-
-      NAMELIST/nampiscal/ kdca, nca
-
-      REWIND( numnatp )                     ! read numnatp
-      READ  ( numnatp, nampiscal )
-
-      IF(lwp) THEN                         ! control print
-         WRITE(numout,*) ' '
-         WRITE(numout,*) ' Namelist parameters for CaCO3 dissolution, nampiscal'
-         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
-         WRITE(numout,*) '    diss. rate constant calcite (per month)   kdca      =', kdca
-         WRITE(numout,*) '    order of reaction for calcite dissolution nca       =', nca
-      ENDIF
-
-      ! Number of seconds per month 
-      rmtss =  nyear_len(1) * rday / raamo
-
-   END SUBROUTINE p4z_lys_init
-
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_lys( kt )                   ! Empty routine
-      INTEGER, INTENT( in ) ::   kt
-      WRITE(*,*) 'p4z_lys: You should not have seen this print! error?', kt
-   END SUBROUTINE p4z_lys
-#endif 
-   !!======================================================================
-END MODULE  p4zlys
Index: anches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmeso.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmeso.F90	(revision 3679)
+++ 	(revision )
@@ -1,295 +1,0 @@
-MODULE p4zmeso
-   !!======================================================================
-   !!                         ***  MODULE p4zmeso  ***
-   !! TOP :   PISCES Compute the sources/sinks for mesozooplankton
-   !!======================================================================
-   !! History :   1.0  !  2002     (O. Aumont) Original code
-   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
-   !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Quota model for iron
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
-   !!   p4z_meso       :   Compute the sources/sinks for mesozooplankton
-   !!   p4z_meso_init  :   Initialization of the parameters for mesozooplankton
-   !!----------------------------------------------------------------------
-   USE oce_trc         !  shared variables between ocean and passive tracers
-   USE trc             !  passive tracers common variables 
-   USE sms_pisces      !  PISCES Source Minus Sink variables
-   USE p4zsink         !  vertical flux of particulate matter due to sinking
-   USE p4zint          !  interpolation and computation of various fields
-   USE p4zprod         !  production
-   USE prtctl_trc      !  print control for debugging
-   USE iom             !  I/O manager
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   p4z_meso              ! called in p4zbio.F90
-   PUBLIC   p4z_meso_init         ! called in trcsms_pisces.F90
-
-   !! * Shared module variables
-   REAL(wp), PUBLIC ::  part2       = 0.5_wp     !: part of calcite not dissolved in mesozoo guts
-   REAL(wp), PUBLIC ::  xprefc      = 1.0_wp     !: mesozoo preference for POC 
-   REAL(wp), PUBLIC ::  xprefp      = 0.3_wp     !: mesozoo preference for nanophyto
-   REAL(wp), PUBLIC ::  xprefz      = 1.0_wp     !: mesozoo preference for diatoms
-   REAL(wp), PUBLIC ::  xprefpoc    = 0.3_wp     !: mesozoo preference for POC 
-   REAL(wp), PUBLIC ::  xthresh2zoo = 1E-8_wp    !: zoo feeding threshold for mesozooplankton 
-   REAL(wp), PUBLIC ::  xthresh2dia = 1E-8_wp    !: diatoms feeding threshold for mesozooplankton 
-   REAL(wp), PUBLIC ::  xthresh2phy = 2E-7_wp    !: nanophyto feeding threshold for mesozooplankton 
-   REAL(wp), PUBLIC ::  xthresh2poc = 1E-8_wp    !: poc feeding threshold for mesozooplankton 
-   REAL(wp), PUBLIC ::  xthresh2    = 0._wp      !: feeding threshold for mesozooplankton 
-   REAL(wp), PUBLIC ::  resrat2     = 0.005_wp   !: exsudation rate of mesozooplankton
-   REAL(wp), PUBLIC ::  mzrat2      = 0.04_wp    !: microzooplankton mortality rate 
-   REAL(wp), PUBLIC ::  grazrat2    = 0.9_wp     !: maximal mesozoo grazing rate
-   REAL(wp), PUBLIC ::  xkgraz2     = 20E-6_wp   !: non assimilated fraction of P by mesozoo 
-   REAL(wp), PUBLIC ::  unass2      = 0.3_wp     !: Efficicency of mesozoo growth 
-   REAL(wp), PUBLIC ::  sigma2      = 0.6_wp     !: Fraction of mesozoo excretion as DOM 
-   REAL(wp), PUBLIC ::  epsher2     = 0.3_wp     !: half sturation constant for grazing 2
-   REAL(wp), PUBLIC ::  grazflux    = 3.E3_wp    !: mesozoo flux feeding rate
-
-   !!* Substitution
-#  include "top_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE p4z_meso( kt, jnt )
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_meso  ***
-      !!
-      !! ** Purpose :   Compute the sources/sinks for mesozooplankton
-      !!
-      !! ** Method  : - ???
-      !!---------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt, jnt ! ocean time step
-      INTEGER  :: ji, jj, jk
-      REAL(wp) :: zcompadi, zcompaph, zcompapoc, zcompaz, zcompam
-      REAL(wp) :: zgraze2 , zdenom, zdenom2, zncratio
-      REAL(wp) :: zfact   , zstep, zfood, zfoodlim
-      REAL(wp) :: zepshert, zepsherv, zgrarsig, zgraztot, zgraztotf
-      REAL(wp) :: zgrarem2, zgrafer2, zgrapoc2, zprcaca, zmortz2, zgrasrat
-#if defined key_kriest
-      REAL znumpoc
-#endif
-      REAL(wp) :: zrespz2, ztortz2, zgrazd, zgrazz, zgrazpof
-      REAL(wp) :: zgrazn, zgrazpoc, zgraznf, zgrazf
-      REAL(wp) :: zgrazfff, zgrazffe
-      CHARACTER (len=25) :: charout
-      REAL(wp) :: zrfact2
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_meso')
-      !
-
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               zcompam   = MAX( ( trn(ji,jj,jk,jpmes) - 1.e-8 ), 0.e0 )
-# if defined key_degrad
-               zstep     = xstep * facvol(ji,jj,jk)
-# else
-               zstep     = xstep
-# endif
-               zfact     = zstep * tgfunc(ji,jj,jk) * zcompam
-
-               !  Respiration rates of both zooplankton
-               !  -------------------------------------
-               zrespz2   = resrat2 * zfact * trn(ji,jj,jk,jpmes) / ( xkmort + trn(ji,jj,jk,jpmes) )  &
-                  &      + resrat2 * zfact * 3. * nitrfac(ji,jj,jk)
-
-               !  Zooplankton mortality. A square function has been selected with
-               !  no real reason except that it seems to be more stable and may mimic predation
-               !  ---------------------------------------------------------------
-               ztortz2   = mzrat2 * 1.e6 * zfact * trn(ji,jj,jk,jpmes)
-               !
-
-               zcompadi  = MAX( ( trn(ji,jj,jk,jpdia) - xthresh2dia ), 0.e0 )
-               zcompaz   = MAX( ( trn(ji,jj,jk,jpzoo) - xthresh2zoo ), 0.e0 )
-               zcompaph  = MAX( ( trn(ji,jj,jk,jpphy) - xthresh2phy ), 0.e0 )
-               zcompapoc = MAX( ( trn(ji,jj,jk,jppoc) - xthresh2poc ), 0.e0 )
-
-               zfood     = xprefc * zcompadi + xprefz * zcompaz + xprefp * zcompaph + xprefpoc * zcompapoc 
-               zfoodlim  = MAX( 0., zfood - xthresh2 )
-               zdenom    = zfoodlim / ( xkgraz2 + zfoodlim )
-               zdenom2   = zdenom / ( zfood + rtrn )
-               zgraze2   = grazrat2 * zstep * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jpmes) 
-
-               zgrazd    = zgraze2  * xprefc   * zcompadi  * zdenom2 
-               zgrazz    = zgraze2  * xprefz   * zcompaz   * zdenom2 
-               zgrazn    = zgraze2  * xprefp   * zcompaph  * zdenom2 
-               zgrazpoc  = zgraze2  * xprefpoc * zcompapoc * zdenom2 
-
-               zgraznf   = zgrazn   * trn(ji,jj,jk,jpnfe) / ( trn(ji,jj,jk,jpphy) + rtrn)
-               zgrazf    = zgrazd   * trn(ji,jj,jk,jpdfe) / ( trn(ji,jj,jk,jpdia) + rtrn)
-               zgrazpof  = zgrazpoc * trn(ji,jj,jk,jpsfe) / ( trn(ji,jj,jk,jppoc) + rtrn)
-
-               !  Mesozooplankton flux feeding on GOC
-               !  ----------------------------------
-# if ! defined key_kriest
-               zgrazffe  = grazflux * zstep * wsbio4(ji,jj,jk)          &
-                 &                 * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jpgoc) * trn(ji,jj,jk,jpmes)
-               zgrazfff  = zgrazffe * trn(ji,jj,jk,jpbfe) / (trn(ji,jj,jk,jpgoc) + rtrn)
-# else
-               zgrazffe = grazflux * zstep * wsbio3(ji,jj,jk)     &
-               zgrazfff   = zgrazffe * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn)
-# endif
-              !
-              zgraztot   = zgrazd + zgrazz + zgrazn + zgrazpoc + zgrazffe
-              zgraztotf  = zgrazf + zgraznf + zgrazz * ferat3 + zgrazpof + zgrazfff 
-
-              ! Total grazing ( grazing by microzoo is already computed in p4zmicro )
-              grazing(ji,jj,jk) = grazing(ji,jj,jk) + zgraztot
-              !    Mesozooplankton efficiency
-              !    --------------------------
-              zgrasrat   =  zgraztotf / ( zgraztot + rtrn )
-              zncratio   = (  xprefc   * zcompadi * quotad(ji,jj,jk)  &
-                  &         + xprefp   * zcompaph * quotan(ji,jj,jk)  &
-                  &         + xprefz   * zcompaz                      &
-                  &         + xprefpoc * zcompapoc   ) / ( zfood + rtrn )
-               zepshert  = epsher2 * MIN( 1., zncratio )
-               zepsherv  = zepshert * MIN( 1., zgrasrat / ferat3 )
-               zgrarem2  = zgraztot * ( 1. - zepsherv - unass2 )
-               zgrafer2  = zgraztot * MAX( 0. , ( 1. - unass2 ) * zgrasrat - ferat3 * zepshert ) 
-               zgrapoc2  = zgraztot * unass2
-
-               !   Update the arrays TRA which contain the biological sources and sinks
-               zgrarsig  = zgrarem2 * sigma2
-               tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) + zgrarsig
-               tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) + zgrarsig
-               tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + zgrarem2 - zgrarsig
-               tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) - o2ut * zgrarsig
-               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + zgrafer2
-               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) + zgrarsig
-               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3 * zgrarsig              
-#if defined key_kriest
-               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zgrapoc2
-               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + zgrapoc2 * xkr_dmeso
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zgraztotf * unass2
-#else
-               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zgrapoc2
-               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zgraztotf * unass2
-#endif
-               zmortz2 = ztortz2 + zrespz2
-               tra(ji,jj,jk,jpmes) = tra(ji,jj,jk,jpmes) - zmortz2 + zepsherv * zgraztot 
-               tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) - zgrazd
-               tra(ji,jj,jk,jpzoo) = tra(ji,jj,jk,jpzoo) - zgrazz
-               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) - zgrazn
-               tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) - zgrazn * trn(ji,jj,jk,jpnch) / ( trn(ji,jj,jk,jpphy) + rtrn )
-               tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) - zgrazd * trn(ji,jj,jk,jpdch) / ( trn(ji,jj,jk,jpdia) + rtrn )
-               tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) - zgrazd * trn(ji,jj,jk,jpdsi) / ( trn(ji,jj,jk,jpdia) + rtrn )
-               tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) + zgrazd * trn(ji,jj,jk,jpdsi) / ( trn(ji,jj,jk,jpdia) + rtrn )
-               tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) - zgraznf
-               tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) - zgrazf
-
-               zprcaca = xfracal(ji,jj,jk) * zgrazn
-               ! calcite production
-               prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo)
-               !
-               zprcaca = part2 * zprcaca
-               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprcaca
-               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) - 2. * zprcaca
-               tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) + zprcaca
-#if defined key_kriest
-               znumpoc = trn(ji,jj,jk,jpnum) / ( trn(ji,jj,jk,jppoc) + rtrn )
-               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortz2 - zgrazpoc - zgrazffe
-               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) - zgrazpoc * znumpoc &
-                  &    + zmortz2  * xkr_dmeso - zgrazffe * znumpoc * wsbio4(ji,jj,jk) / ( wsbio3(ji,jj,jk) + rtrn )
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + ferat3 * zmortz2 - zgrazfff - zgrazpof
-#else
-               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) - zgrazpoc
-               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zmortz2 - zgrazffe
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) - zgrazpof
-               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + ferat3 * zmortz2 - zgrazfff
-#endif
-
-            END DO
-         END DO
-      END DO
-      !
-      IF( ln_diatrc .AND. lk_iomput ) THEN
-         zrfact2 = 1.e3 * rfact2r
-         grazing(:,:,:) = grazing(:,:,:) * zrfact2 * tmask(:,:,:)   ! Total grazing of phyto by zoo
-         prodcal(:,:,:) = prodcal(:,:,:) * zrfact2 * tmask(:,:,:)   ! Calcite production
-         IF( jnt == nrdttrc ) THEN
-            CALL iom_put( "GRAZ" , grazing  )  ! Total grazing of phyto by zooplankton
-            CALL iom_put( "PCAL" , prodcal  )  ! Calcite production
-         ENDIF
-      ENDIF
-      !
-      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
-        WRITE(charout, FMT="('meso')")
-        CALL prt_ctl_trc_info(charout)
-        CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
-      ENDIF
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_meso')
-      !
-   END SUBROUTINE p4z_meso
-
-   SUBROUTINE p4z_meso_init
-
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE p4z_meso_init  ***
-      !!
-      !! ** Purpose :   Initialization of mesozooplankton parameters
-      !!
-      !! ** Method  :   Read the nampismes namelist and check the parameters
-      !!      called at the first timestep (nittrc000)
-      !!
-      !! ** input   :   Namelist nampismes
-      !!
-      !!----------------------------------------------------------------------
-
-      NAMELIST/nampismes/ part2, grazrat2, resrat2, mzrat2, xprefc, xprefp, xprefz,   &
-         &                xprefpoc, xthresh2dia, xthresh2phy, xthresh2zoo, xthresh2poc, &
-         &                xthresh2, xkgraz2, epsher2, sigma2, unass2, grazflux
-
-      REWIND( numnatp )                     ! read numnatp
-      READ  ( numnatp, nampismes )
-
-
-      IF(lwp) THEN                         ! control print
-         WRITE(numout,*) ' ' 
-         WRITE(numout,*) ' Namelist parameters for mesozooplankton, nampismes'
-         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
-         WRITE(numout,*) '    part of calcite not dissolved in mesozoo guts  part2        =', part2
-         WRITE(numout,*) '    mesozoo preference for phyto                   xprefc       =', xprefc
-         WRITE(numout,*) '    mesozoo preference for POC                     xprefp       =', xprefp
-         WRITE(numout,*) '    mesozoo preference for zoo                     xprefz       =', xprefz
-         WRITE(numout,*) '    mesozoo preference for poc                     xprefpoc     =', xprefpoc
-         WRITE(numout,*) '    microzoo feeding threshold  for mesozoo        xthresh2zoo  =', xthresh2zoo
-         WRITE(numout,*) '    diatoms feeding threshold  for mesozoo         xthresh2dia  =', xthresh2dia
-         WRITE(numout,*) '    nanophyto feeding threshold for mesozoo        xthresh2phy  =', xthresh2phy
-         WRITE(numout,*) '    poc feeding threshold for mesozoo              xthresh2poc  =', xthresh2poc
-         WRITE(numout,*) '    feeding threshold for mesozooplankton          xthresh2     =', xthresh2
-         WRITE(numout,*) '    exsudation rate of mesozooplankton             resrat2      =', resrat2
-         WRITE(numout,*) '    mesozooplankton mortality rate                 mzrat2       =', mzrat2
-         WRITE(numout,*) '    maximal mesozoo grazing rate                   grazrat2     =', grazrat2
-         WRITE(numout,*) '    mesozoo flux feeding rate                      grazflux     =', grazflux
-         WRITE(numout,*) '    non assimilated fraction of P by mesozoo       unass2       =', unass2
-         WRITE(numout,*) '    Efficicency of Mesozoo growth                  epsher2      =', epsher2
-         WRITE(numout,*) '    Fraction of mesozoo excretion as DOM           sigma2       =', sigma2
-         WRITE(numout,*) '    half sturation constant for grazing 2          xkgraz2      =', xkgraz2
-      ENDIF
-
-
-   END SUBROUTINE p4z_meso_init
-
-
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_meso                    ! Empty routine
-   END SUBROUTINE p4z_meso
-#endif 
-
-   !!======================================================================
-END MODULE  p4zmeso
Index: anches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmicro.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmicro.F90	(revision 3679)
+++ 	(revision )
@@ -1,261 +1,0 @@
-MODULE p4zmicro
-   !!======================================================================
-   !!                         ***  MODULE p4zmicro  ***
-   !! TOP :   PISCES Compute the sources/sinks for microzooplankton
-   !!======================================================================
-   !! History :   1.0  !  2004     (O. Aumont) Original code
-   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
-   !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Quota model for iron
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
-   !!   p4z_micro       :   Compute the sources/sinks for microzooplankton
-   !!   p4z_micro_init  :   Initialize and read the appropriate namelist
-   !!----------------------------------------------------------------------
-   USE oce_trc         !  shared variables between ocean and passive tracers
-   USE trc             !  passive tracers common variables 
-   USE sms_pisces      !  PISCES Source Minus Sink variables
-   USE p4zlim          !  Co-limitations
-   USE p4zsink         !  vertical flux of particulate matter due to sinking
-   USE p4zint          !  interpolation and computation of various fields
-   USE p4zprod         !  production
-   USE prtctl_trc      !  print control for debugging
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   p4z_micro         ! called in p4zbio.F90
-   PUBLIC   p4z_micro_init    ! called in trcsms_pisces.F90
-   PUBLIC   p4z_micro_alloc    ! called in trcsms_pisces.F90
-
-   !! * Shared module variables
-   REAL(wp), PUBLIC ::  part       = 0.5_wp     !: part of calcite not dissolved in microzoo guts
-   REAL(wp), PUBLIC ::  xpref2c    = 0.2_wp     !: microzoo preference for POC 
-   REAL(wp), PUBLIC ::  xpref2p    = 1.0_wp     !: microzoo preference for nanophyto
-   REAL(wp), PUBLIC ::  xpref2d    = 0.6_wp     !: microzoo preference for diatoms
-   REAL(wp), PUBLIC ::  xthreshdia = 1E-8_wp    !: diatoms feeding threshold for microzooplankton 
-   REAL(wp), PUBLIC ::  xthreshphy = 2E-7_wp    !: nanophyto threshold for microzooplankton 
-   REAL(wp), PUBLIC ::  xthreshpoc = 1E-8_wp    !: poc threshold for microzooplankton 
-   REAL(wp), PUBLIC ::  xthresh    = 0._wp      !: feeding threshold for microzooplankton 
-   REAL(wp), PUBLIC ::  resrat     = 0.03_wp    !: exsudation rate of microzooplankton
-   REAL(wp), PUBLIC ::  mzrat      = 0.0_wp     !: microzooplankton mortality rate 
-   REAL(wp), PUBLIC ::  grazrat    = 3.0_wp     !: maximal microzoo grazing rate
-   REAL(wp), PUBLIC ::  xkgraz     = 20E-6_wp   !: non assimilated fraction of P by microzoo 
-   REAL(wp), PUBLIC ::  unass      = 0.3_wp     !: Efficicency of microzoo growth 
-   REAL(wp), PUBLIC ::  sigma1     = 0.6_wp     !: Fraction of microzoo excretion as DOM 
-   REAL(wp), PUBLIC ::  epsher     = 0.3_wp     !: half sturation constant for grazing 1 
-
-
-   !!* Substitution
-#  include "top_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE p4z_micro( kt )
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_micro  ***
-      !!
-      !! ** Purpose :   Compute the sources/sinks for microzooplankton
-      !!
-      !! ** Method  : - ???
-      !!---------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt ! ocean time step
-      INTEGER  :: ji, jj, jk
-      REAL(wp) :: zcompadi, zcompaz , zcompaph, zcompapoc
-      REAL(wp) :: zgraze  , zdenom, zdenom2, zncratio
-      REAL(wp) :: zfact   , zstep, zfood, zfoodlim
-      REAL(wp) :: zepshert, zepsherv, zgrarsig, zgraztot, zgraztotf
-      REAL(wp) :: zgrarem, zgrafer, zgrapoc, zprcaca, zmortz
-      REAL(wp) :: zrespz, ztortz, zgrasrat
-      REAL(wp) :: zgrazp, zgrazm, zgrazsd
-      REAL(wp) :: zgrazmf, zgrazsf, zgrazpf
-      CHARACTER (len=25) :: charout
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_micro')
-      !
-      grazing(:,:,:) = 0.  !: grazing set to zero
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               zcompaz = MAX( ( trn(ji,jj,jk,jpzoo) - 1.e-8 ), 0.e0 )
-               zstep   = xstep
-# if defined key_degrad
-               zstep = zstep * facvol(ji,jj,jk)
-# endif
-               zfact   = zstep * tgfunc2(ji,jj,jk) * zcompaz
-
-               !  Respiration rates of both zooplankton
-               !  -------------------------------------
-               zrespz = resrat * zfact * trn(ji,jj,jk,jpzoo) / ( 2. * xkmort + trn(ji,jj,jk,jpzoo) )  &
-                  &   + resrat * zfact * 3. * nitrfac(ji,jj,jk)
-
-               !  Zooplankton mortality. A square function has been selected with
-               !  no real reason except that it seems to be more stable and may mimic predation.
-               !  ---------------------------------------------------------------
-               ztortz = mzrat * 1.e6 * zfact * trn(ji,jj,jk,jpzoo)
-
-               zcompadi  = MIN( MAX( ( trn(ji,jj,jk,jpdia) - xthreshdia ), 0.e0 ), xsizedia )
-               zcompaph  = MAX( ( trn(ji,jj,jk,jpphy) - xthreshphy ), 0.e0 )
-               zcompapoc = MAX( ( trn(ji,jj,jk,jppoc) - xthreshpoc ), 0.e0 )
-               
-               !     Microzooplankton grazing
-               !     ------------------------
-               zfood     = xpref2p * zcompaph + xpref2c * zcompapoc + xpref2d * zcompadi
-               zfoodlim  = MAX( 0. , zfood - xthresh )
-               zdenom    = zfoodlim / ( xkgraz + zfoodlim )
-               zdenom2   = zdenom / ( zfood + rtrn )
-               zgraze    = grazrat * zstep * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jpzoo) 
-
-               zgrazp    = zgraze  * xpref2p * zcompaph  * zdenom2 
-               zgrazm    = zgraze  * xpref2c * zcompapoc * zdenom2 
-               zgrazsd   = zgraze  * xpref2d * zcompadi  * zdenom2 
-
-               zgrazpf   = zgrazp  * trn(ji,jj,jk,jpnfe) / (trn(ji,jj,jk,jpphy) + rtrn)
-               zgrazmf   = zgrazm  * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn)
-               zgrazsf   = zgrazsd * trn(ji,jj,jk,jpdfe) / (trn(ji,jj,jk,jpdia) + rtrn)
-               !
-               zgraztot  = zgrazp  + zgrazm  + zgrazsd 
-               zgraztotf = zgrazpf + zgrazsf + zgrazmf 
-
-               ! Grazing by microzooplankton
-               grazing(ji,jj,jk) = grazing(ji,jj,jk) + zgraztot
-
-               !    Various remineralization and excretion terms
-               !    --------------------------------------------
-               zgrasrat  = zgraztotf / ( zgraztot + rtrn )
-               zncratio  = ( xpref2p * zcompaph * quotan(ji,jj,jk) &
-                  &        + xpref2d * zcompadi * quotad(ji,jj,jk) + xpref2c * zcompapoc ) / ( zfood + rtrn )
-               zepshert  = epsher * MIN( 1., zncratio )
-               zepsherv  = zepshert * MIN( 1., zgrasrat / ferat3 )
-               zgrafer   = zgraztot * MAX( 0. , ( 1. - unass ) * zgrasrat - ferat3 * zepshert ) 
-               zgrarem   = zgraztot * ( 1. - zepsherv - unass )
-               zgrapoc   = zgraztot * unass
-
-               !  Update of the TRA arrays
-               !  ------------------------
-               zgrarsig  = zgrarem * sigma1
-               tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) + zgrarsig
-               tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) + zgrarsig
-               tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + zgrarem - zgrarsig
-               tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) - o2ut * zgrarsig
-               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + zgrafer
-               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zgrapoc
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zgraztotf * unass
-               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) + zgrarsig
-               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3 * zgrarsig
-#if defined key_kriest
-               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + zgrapoc * xkr_ddiat
-#endif
-               !   Update the arrays TRA which contain the biological sources and sinks
-               !   --------------------------------------------------------------------
-               zmortz = ztortz + zrespz
-               tra(ji,jj,jk,jpzoo) = tra(ji,jj,jk,jpzoo) - zmortz + zepsherv * zgraztot 
-               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) - zgrazp
-               tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) - zgrazsd
-               tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) - zgrazp  * trn(ji,jj,jk,jpnch)/(trn(ji,jj,jk,jpphy)+rtrn)
-               tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) - zgrazsd * trn(ji,jj,jk,jpdch)/(trn(ji,jj,jk,jpdia)+rtrn)
-               tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) - zgrazsd * trn(ji,jj,jk,jpdsi)/(trn(ji,jj,jk,jpdia)+rtrn)
-               tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) + zgrazsd * trn(ji,jj,jk,jpdsi)/(trn(ji,jj,jk,jpdia)+rtrn)
-               tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) - zgrazpf
-               tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) - zgrazsf
-               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortz - zgrazm
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + ferat3 * zmortz - zgrazmf
-               zprcaca = xfracal(ji,jj,jk) * zgrazp
-               !
-               ! calcite production
-               prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo)
-               !
-               zprcaca = part * zprcaca
-               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprcaca
-               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) - 2. * zprcaca
-               tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) + zprcaca
-#if defined key_kriest
-               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + ( zmortz - zgrazm ) * xkr_ddiat
-#endif
-            END DO
-         END DO
-      END DO
-      !
-      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
-         WRITE(charout, FMT="('micro')")
-         CALL prt_ctl_trc_info(charout)
-         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
-      ENDIF
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_micro')
-      !
-   END SUBROUTINE p4z_micro
-
-
-   SUBROUTINE p4z_micro_init
-
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE p4z_micro_init  ***
-      !!
-      !! ** Purpose :   Initialization of microzooplankton parameters
-      !!
-      !! ** Method  :   Read the nampiszoo namelist and check the parameters
-      !!                called at the first timestep (nittrc000)
-      !!
-      !! ** input   :   Namelist nampiszoo
-      !!
-      !!----------------------------------------------------------------------
-
-      NAMELIST/nampiszoo/ part, grazrat, resrat, mzrat, xpref2c, xpref2p, &
-         &                xpref2d,  xthreshdia,  xthreshphy,  xthreshpoc, &
-         &                xthresh, xkgraz, epsher, sigma1, unass
-
-      REWIND( numnatp )                     ! read numnatp
-      READ  ( numnatp, nampiszoo )
-
-      IF(lwp) THEN                         ! control print
-         WRITE(numout,*) ' '
-         WRITE(numout,*) ' Namelist parameters for microzooplankton, nampiszoo'
-         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
-         WRITE(numout,*) '    part of calcite not dissolved in microzoo guts  part        =', part
-         WRITE(numout,*) '    microzoo preference for POC                     xpref2c     =', xpref2c
-         WRITE(numout,*) '    microzoo preference for nano                    xpref2p     =', xpref2p
-         WRITE(numout,*) '    microzoo preference for diatoms                 xpref2d     =', xpref2d
-         WRITE(numout,*) '    diatoms feeding threshold  for microzoo         xthreshdia  =', xthreshdia
-         WRITE(numout,*) '    nanophyto feeding threshold for microzoo        xthreshphy  =', xthreshphy
-         WRITE(numout,*) '    poc feeding threshold for microzoo              xthreshpoc  =', xthreshpoc
-         WRITE(numout,*) '    feeding threshold for microzooplankton          xthresh     =', xthresh
-         WRITE(numout,*) '    exsudation rate of microzooplankton             resrat      =', resrat
-         WRITE(numout,*) '    microzooplankton mortality rate                 mzrat       =', mzrat
-         WRITE(numout,*) '    maximal microzoo grazing rate                   grazrat     =', grazrat
-         WRITE(numout,*) '    non assimilated fraction of P by microzoo       unass       =', unass
-         WRITE(numout,*) '    Efficicency of microzoo growth                  epsher      =', epsher
-         WRITE(numout,*) '    Fraction of microzoo excretion as DOM           sigma1      =', sigma1
-         WRITE(numout,*) '    half sturation constant for grazing 1           xkgraz      =', xkgraz
-      ENDIF
-
-   END SUBROUTINE p4z_micro_init
-
-   INTEGER FUNCTION p4z_micro_alloc()
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_micro_alloc  ***
-      !!----------------------------------------------------------------------
-      ALLOCATE( grazing(jpi,jpj,jpk), STAT=p4z_micro_alloc )
-      IF( p4z_micro_alloc /= 0 ) CALL ctl_warn('p4z_micro_alloc : failed to allocate arrays.')
-
-   END FUNCTION p4z_micro_alloc
-
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_micro                    ! Empty routine
-   END SUBROUTINE p4z_micro
-#endif 
-
-   !!======================================================================
-END MODULE  p4zmicro
Index: anches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmort.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmort.F90	(revision 3679)
+++ 	(revision )
@@ -1,266 +1,0 @@
-MODULE p4zmort
-   !!======================================================================
-   !!                         ***  MODULE p4zmort  ***
-   !! TOP :   PISCES Compute the mortality terms for phytoplankton
-   !!======================================================================
-   !! History :   1.0  !  2002     (O. Aumont)  Original code
-   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
-   !!   p4z_mort       :   Compute the mortality terms for phytoplankton
-   !!   p4z_mort_init  :   Initialize the mortality params for phytoplankton
-   !!----------------------------------------------------------------------
-   USE oce_trc         !  shared variables between ocean and passive tracers
-   USE trc             !  passive tracers common variables 
-   USE sms_pisces      !  PISCES Source Minus Sink variables
-   USE p4zsink         !  vertical flux of particulate matter due to sinking
-   USE prtctl_trc      !  print control for debugging
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   p4z_mort    
-   PUBLIC   p4z_mort_init    
-
-   !! * Shared module variables
-   REAL(wp), PUBLIC :: wchl   = 0.001_wp  !:
-   REAL(wp), PUBLIC :: wchld  = 0.02_wp   !:
-   REAL(wp), PUBLIC :: mprat  = 0.01_wp   !:
-   REAL(wp), PUBLIC :: mprat2 = 0.01_wp   !:
-   REAL(wp), PUBLIC :: mpratm = 0.01_wp   !:
-
-
-   !!* Substitution
-#  include "top_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE p4z_mort( kt )
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_mort  ***
-      !!
-      !! ** Purpose :   Calls the different subroutine to initialize and compute
-      !!                the different phytoplankton mortality terms
-      !!
-      !! ** Method  : - ???
-      !!---------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt ! ocean time step
-      !!---------------------------------------------------------------------
-
-      CALL p4z_nano            ! nanophytoplankton
-
-      CALL p4z_diat            ! diatoms
-
-   END SUBROUTINE p4z_mort
-
-
-   SUBROUTINE p4z_nano
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_nano  ***
-      !!
-      !! ** Purpose :   Compute the mortality terms for nanophytoplankton
-      !!
-      !! ** Method  : - ???
-      !!---------------------------------------------------------------------
-      INTEGER  :: ji, jj, jk
-      REAL(wp) :: zcompaph
-      REAL(wp) :: zfactfe, zfactch, zprcaca, zfracal
-      REAL(wp) :: ztortp , zrespp , zmortp , zstep
-      CHARACTER (len=25) :: charout
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_nano')
-      !
-      prodcal(:,:,:) = 0.  !: calcite production variable set to zero
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               zcompaph = MAX( ( trn(ji,jj,jk,jpphy) - 1e-8 ), 0.e0 )
-               zstep    = xstep
-# if defined key_degrad
-               zstep    = zstep * facvol(ji,jj,jk)
-# endif
-               !     Squared mortality of Phyto similar to a sedimentation term during
-               !     blooms (Doney et al. 1996)
-               zrespp = wchl * 1.e6 * zstep * xdiss(ji,jj,jk) * zcompaph * trn(ji,jj,jk,jpphy) 
-
-               !     Phytoplankton mortality. This mortality loss is slightly
-               !     increased when nutrients are limiting phytoplankton growth
-               !     as observed for instance in case of iron limitation.
-               ztortp = mprat * xstep * trn(ji,jj,jk,jpphy) / ( xkmort + trn(ji,jj,jk,jpphy) ) * zcompaph
-
-               zmortp = zrespp + ztortp
-
-               !   Update the arrays TRA which contains the biological sources and sinks
-
-               zfactfe = trn(ji,jj,jk,jpnfe)/(trn(ji,jj,jk,jpphy)+rtrn)
-               zfactch = trn(ji,jj,jk,jpnch)/(trn(ji,jj,jk,jpphy)+rtrn)
-
-               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) - zmortp
-               tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) - zmortp * zfactch
-               tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) - zmortp * zfactfe
-               zprcaca = xfracal(ji,jj,jk) * zmortp
-               !
-               prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo)
-               !
-               zfracal = 0.5 * xfracal(ji,jj,jk)
-               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprcaca
-               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) - 2. * zprcaca
-               tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) + zprcaca
-#if defined key_kriest
-               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortp
-               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + ztortp * xkr_dnano + zrespp * xkr_ddiat
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zmortp * zfactfe
-#else
-               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zfracal * zmortp
-               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + ( 1. - zfracal ) * zmortp
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + ( 1. - zfracal ) * zmortp * zfactfe
-               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zfracal * zmortp * zfactfe
-#endif
-            END DO
-         END DO
-      END DO
-      !
-       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
-         WRITE(charout, FMT="('nano')")
-         CALL prt_ctl_trc_info(charout)
-         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
-       ENDIF
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_nano')
-      !
-   END SUBROUTINE p4z_nano
-
-   SUBROUTINE p4z_diat
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_diat  ***
-      !!
-      !! ** Purpose :   Compute the mortality terms for diatoms
-      !!
-      !! ** Method  : - ???
-      !!---------------------------------------------------------------------
-      INTEGER  ::  ji, jj, jk
-      REAL(wp) ::  zfactfe,zfactsi,zfactch, zcompadi
-      REAL(wp) ::  zrespp2, ztortp2, zmortp2, zstep
-      CHARACTER (len=25) :: charout
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_diat')
-      !
-
-      !    Aggregation term for diatoms is increased in case of nutrient
-      !    stress as observed in reality. The stressed cells become more
-      !    sticky and coagulate to sink quickly out of the euphotic zone
-      !     ------------------------------------------------------------
-
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-
-               zcompadi = MAX( ( trn(ji,jj,jk,jpdia) - 1e-8), 0. )
-
-               !    Aggregation term for diatoms is increased in case of nutrient
-               !    stress as observed in reality. The stressed cells become more
-               !    sticky and coagulate to sink quickly out of the euphotic zone
-               !     ------------------------------------------------------------
-               zstep   = xstep
-# if defined key_degrad
-               zstep = zstep * facvol(ji,jj,jk)
-# endif
-               !  Phytoplankton respiration 
-               !     ------------------------
-               zrespp2  = 1.e6 * zstep * (  wchl + wchld * ( 1.- xlimdia(ji,jj,jk) )  )    &
-                  &       * xdiss(ji,jj,jk) * zcompadi * trn(ji,jj,jk,jpdia)
-
-               !     Phytoplankton mortality. 
-               !     ------------------------
-               ztortp2  = mprat2 * zstep * trn(ji,jj,jk,jpdia)  / ( xkmort + trn(ji,jj,jk,jpdia) ) * zcompadi 
-
-               zmortp2 = zrespp2 + ztortp2
-
-               !   Update the arrays tra which contains the biological sources and sinks
-               !   ---------------------------------------------------------------------
-               zfactch = trn(ji,jj,jk,jpdch) / ( trn(ji,jj,jk,jpdia) + rtrn )
-               zfactfe = trn(ji,jj,jk,jpdfe) / ( trn(ji,jj,jk,jpdia) + rtrn )
-               zfactsi = trn(ji,jj,jk,jpdsi) / ( trn(ji,jj,jk,jpdia) + rtrn )
-
-               tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) - zmortp2 
-               tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) - zmortp2 * zfactch
-               tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) - zmortp2 * zfactfe
-               tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) - zmortp2 * zfactsi
-               tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) + zmortp2 * zfactsi
-#if defined key_kriest
-               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortp2  
-               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + ztortp2 * xkr_ddiat + zrespp2 * xkr_daggr
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zmortp2 * zfactfe
-#else
-               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zrespp2 + 0.5 * ztortp2
-               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + 0.5 * ztortp2
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + 0.5 * ztortp2 * zfactfe
-               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + ( zrespp2 + 0.5 * ztortp2 ) * zfactfe
-#endif
-            END DO
-         END DO
-      END DO
-      !
-      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
-         WRITE(charout, FMT="('diat')")
-         CALL prt_ctl_trc_info(charout)
-         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
-      ENDIF
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_diat')
-      !
-   END SUBROUTINE p4z_diat
-
-   SUBROUTINE p4z_mort_init
-
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE p4z_mort_init  ***
-      !!
-      !! ** Purpose :   Initialization of phytoplankton parameters
-      !!
-      !! ** Method  :   Read the nampismort namelist and check the parameters
-      !!      called at the first timestep
-      !!
-      !! ** input   :   Namelist nampismort
-      !!
-      !!----------------------------------------------------------------------
-
-      NAMELIST/nampismort/ wchl, wchld, mprat, mprat2, mpratm
-
-      REWIND( numnatp )                     ! read numnatp
-      READ  ( numnatp, nampismort )
-
-      IF(lwp) THEN                         ! control print
-         WRITE(numout,*) ' '
-         WRITE(numout,*) ' Namelist parameters for phytoplankton mortality, nampismort'
-         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
-         WRITE(numout,*) '    quadratic mortality of phytoplankton      wchl      =', wchl
-         WRITE(numout,*) '    maximum quadratic mortality of diatoms    wchld     =', wchld
-         WRITE(numout,*) '    phytoplankton mortality rate              mprat     =', mprat
-         WRITE(numout,*) '    Diatoms mortality rate                    mprat2    =', mprat2
-         WRITE(numout,*) '    Phytoplankton minimum mortality rate      mpratm    =', mpratm
-      ENDIF
-
-   END SUBROUTINE p4z_mort_init
-
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_mort                    ! Empty routine
-   END SUBROUTINE p4z_mort
-#endif 
-
-   !!======================================================================
-END MODULE  p4zmort
Index: anches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zopt.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zopt.F90	(revision 3679)
+++ 	(revision )
@@ -1,288 +1,0 @@
-MODULE p4zopt
-   !!======================================================================
-   !!                         ***  MODULE p4zopt  ***
-   !! TOP - PISCES : Compute the light availability in the water column
-   !!======================================================================
-   !! History :   1.0  !  2004     (O. Aumont) Original code
-   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
-   !!             3.2  !  2009-04  (C. Ethe, G. Madec)  optimisation
-   !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Improve light availability of nano & diat
-   !!----------------------------------------------------------------------
-#if defined  key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
-   !!   p4z_opt       : light availability in the water column
-   !!----------------------------------------------------------------------
-   USE trc            ! tracer variables
-   USE oce_trc        ! tracer-ocean share variables
-   USE sms_pisces     ! Source Minus Sink of PISCES
-   USE iom            ! I/O manager
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   p4z_opt        ! called in p4zbio.F90 module
-   PUBLIC   p4z_opt_init   ! called in trcsms_pisces.F90 module
-   PUBLIC   p4z_opt_alloc
-
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: etot, enano, ediat   !: PAR for phyto, nano and diat 
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: emoy                 !: averaged PAR in the mixed layer
-
-   INTEGER  ::   nksrp   ! levels below which the light cannot penetrate ( depth larger than 391 m)
-   REAL(wp) ::   parlux = 0.43_wp / 3._wp
-
-   REAL(wp), DIMENSION(3,61), PUBLIC ::   xkrgb   !: tabulated attenuation coefficients for RGB absorption
-   
-   !!* Substitution
-#  include "top_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE p4z_opt( kt, jnt )
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_opt  ***
-      !!
-      !! ** Purpose :   Compute the light availability in the water column
-      !!              depending on the depth and the chlorophyll concentration
-      !!
-      !! ** Method  : - ???
-      !!---------------------------------------------------------------------
-      !
-      INTEGER, INTENT(in) ::   kt, jnt   ! ocean time step
-      !
-      INTEGER  ::   ji, jj, jk
-      INTEGER  ::   irgb
-      REAL(wp) ::   zchl, zxsi0r
-      REAL(wp) ::   zc0 , zc1 , zc2, zc3, z1_dep
-      REAL(wp), POINTER, DIMENSION(:,:  ) :: zdepmoy, zetmp, zetmp1, zetmp2
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zekg, zekr, zekb, ze0, ze1, ze2, ze3
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_opt')
-      !
-      ! Allocate temporary workspace
-      CALL wrk_alloc( jpi, jpj,      zdepmoy, zetmp, zetmp1, zetmp2       )
-      CALL wrk_alloc( jpi, jpj, jpk, zekg, zekr, zekb, ze0, ze1, ze2, ze3 )
-
-      !     Initialisation of variables used to compute PAR
-      !     -----------------------------------------------
-      ze1 (:,:,jpk) = 0._wp
-      ze2 (:,:,jpk) = 0._wp
-      ze3 (:,:,jpk) = 0._wp
-
-      !                                        !* attenuation coef. function of Chlorophyll and wavelength (Red-Green-Blue)
-      DO jk = 1, jpkm1                         !  --------------------------------------------------------
-!CDIR NOVERRCHK
-         DO jj = 1, jpj
-!CDIR NOVERRCHK
-            DO ji = 1, jpi
-               zchl = ( trn(ji,jj,jk,jpnch) + trn(ji,jj,jk,jpdch) + rtrn ) * 1.e6
-               zchl = MIN(  10. , MAX( 0.05, zchl )  )
-               irgb = NINT( 41 + 20.* LOG10( zchl ) + rtrn )
-               !                                                         
-               zekb(ji,jj,jk) = xkrgb(1,irgb) * fse3t(ji,jj,jk)
-               zekg(ji,jj,jk) = xkrgb(2,irgb) * fse3t(ji,jj,jk)
-               zekr(ji,jj,jk) = xkrgb(3,irgb) * fse3t(ji,jj,jk)
-            END DO
-         END DO
-      END DO
-
-
-      !                                        !* Photosynthetically Available Radiation (PAR)
-      !                                        !  --------------------------------------
-!CDIR NOVERRCHK
-      DO jj = 1, jpj
-!CDIR NOVERRCHK
-         DO ji = 1, jpi
-            zc1 = parlux * qsr(ji,jj) * EXP( -0.5 * zekb(ji,jj,1) )
-            zc2 = parlux * qsr(ji,jj) * EXP( -0.5 * zekg(ji,jj,1) )
-            zc3 = parlux * qsr(ji,jj) * EXP( -0.5 * zekr(ji,jj,1) )
-            ze1  (ji,jj,1) = zc1
-            ze2  (ji,jj,1) = zc2
-            ze3  (ji,jj,1) = zc3
-            etot (ji,jj,1) = (       zc1 +        zc2 +       zc3 )
-            enano(ji,jj,1) = ( 2.1 * zc1 + 0.42 * zc2 + 0.4 * zc3 )
-            ediat(ji,jj,1) = ( 1.6 * zc1 + 0.69 * zc2 + 0.7 * zc3 )
-         END DO
-      END DO
-
-    
-      DO jk = 2, nksrp      
-!CDIR NOVERRCHK
-         DO jj = 1, jpj
-!CDIR NOVERRCHK
-            DO ji = 1, jpi
-               zc1 = ze1(ji,jj,jk-1) * EXP( -0.5 * ( zekb(ji,jj,jk-1) + zekb(ji,jj,jk) ) )
-               zc2 = ze2(ji,jj,jk-1) * EXP( -0.5 * ( zekg(ji,jj,jk-1) + zekg(ji,jj,jk) ) )
-               zc3 = ze3(ji,jj,jk-1) * EXP( -0.5 * ( zekr(ji,jj,jk-1) + zekr(ji,jj,jk) ) )
-               ze1  (ji,jj,jk) = zc1
-               ze2  (ji,jj,jk) = zc2
-               ze3  (ji,jj,jk) = zc3
-               etot (ji,jj,jk) = (       zc1 +        zc2 +       zc3 )
-               enano(ji,jj,jk) = ( 2.1 * zc1 + 0.42 * zc2 + 0.4 * zc3 )
-               ediat(ji,jj,jk) = ( 1.6 * zc1 + 0.69 * zc2 + 0.7 * zc3 )
-            END DO
-         END DO
-      END DO
-
-      IF( ln_qsr_bio ) THEN                    !* heat flux accros w-level (used in the dynamics)
-         !                                     !  ------------------------
-         zxsi0r = 1.e0 / rn_si0
-         !
-         ze0  (:,:,1) = rn_abs * qsr(:,:)
-         ze1  (:,:,1) = parlux * qsr(:,:)             ! surface value : separation in R-G-B + near surface 
-         ze2  (:,:,1) = parlux * qsr(:,:)
-         ze3  (:,:,1) = parlux * qsr(:,:)
-         etot3(:,:,1) =          qsr(:,:) * tmask(:,:,1)
-         !
-         DO jk = 2, nksrp + 1
-!CDIR NOVERRCHK
-            DO jj = 1, jpj
-!CDIR NOVERRCHK
-               DO ji = 1, jpi
-                  zc0 = ze0(ji,jj,jk-1) * EXP( -fse3t(ji,jj,jk-1) * zxsi0r )
-                  zc1 = ze1(ji,jj,jk-1) * EXP( -zekb(ji,jj,jk-1 ) )
-                  zc2 = ze2(ji,jj,jk-1) * EXP( -zekg(ji,jj,jk-1 ) )
-                  zc3 = ze3(ji,jj,jk-1) * EXP( -zekr(ji,jj,jk-1 ) )
-                  ze0(ji,jj,jk) = zc0
-                  ze1(ji,jj,jk) = zc1
-                  ze2(ji,jj,jk) = zc2
-                  ze3(ji,jj,jk) = zc3
-                  etot3(ji,jj,jk) = ( zc0 + zc1 + zc2 + zc3 ) * tmask(ji,jj,jk)
-              END DO
-              !
-            END DO
-            !
-        END DO
-        !
-      ENDIF
-
-      !                                        !* Euphotic depth and level
-      neln(:,:) = 1                            !  ------------------------
-      heup(:,:) = 300.
-
-      DO jk = 2, nksrp
-         DO jj = 1, jpj
-           DO ji = 1, jpi
-              IF( etot(ji,jj,jk) >= 0.0043 * qsr(ji,jj) )  THEN
-                 neln(ji,jj) = jk+1                    ! Euphotic level : 1rst T-level strictly below Euphotic layer
-                 !                                     ! nb: ensure the compatibility with nmld_trc definition in trd_mld_trc_zint
-                 heup(ji,jj) = fsdepw(ji,jj,jk+1)      ! Euphotic layer depth
-              ENDIF
-           END DO
-        END DO
-      END DO
- 
-      heup(:,:) = MIN( 300., heup(:,:) )
-
-      !                                        !* mean light over the mixed layer
-      zdepmoy(:,:)   = 0.e0                    !  -------------------------------
-      zetmp  (:,:)   = 0.e0
-      zetmp1 (:,:)   = 0.e0
-      zetmp2 (:,:)   = 0.e0
-
-      DO jk = 1, nksrp
-!CDIR NOVERRCHK
-         DO jj = 1, jpj
-!CDIR NOVERRCHK
-            DO ji = 1, jpi
-               IF( fsdepw(ji,jj,jk+1) <= hmld(ji,jj) ) THEN
-                  zetmp  (ji,jj) = zetmp  (ji,jj) + etot (ji,jj,jk) * fse3t(ji,jj,jk)
-                  zetmp1 (ji,jj) = zetmp1 (ji,jj) + enano(ji,jj,jk) * fse3t(ji,jj,jk)
-                  zetmp2 (ji,jj) = zetmp2 (ji,jj) + ediat(ji,jj,jk) * fse3t(ji,jj,jk)
-                  zdepmoy(ji,jj) = zdepmoy(ji,jj) + fse3t(ji,jj,jk)
-               ENDIF
-            END DO
-         END DO
-      END DO
-      !
-      emoy(:,:,:) = etot(:,:,:)
-      !
-      DO jk = 1, nksrp
-!CDIR NOVERRCHK
-         DO jj = 1, jpj
-!CDIR NOVERRCHK
-            DO ji = 1, jpi
-               IF( fsdepw(ji,jj,jk+1) <= hmld(ji,jj) ) THEN
-                  z1_dep = 1. / ( zdepmoy(ji,jj) + rtrn )
-                  emoy (ji,jj,jk) = zetmp (ji,jj) * z1_dep
-                  enano(ji,jj,jk) = zetmp1(ji,jj) * z1_dep
-                  ediat(ji,jj,jk) = zetmp2(ji,jj) * z1_dep
-               ENDIF
-            END DO
-         END DO
-      END DO
-
-      IF( ln_diatrc ) THEN        ! save output diagnostics
-        !
-        IF( lk_iomput ) THEN
-           IF( jnt == nrdttrc ) THEN
-              CALL iom_put( "Heup", heup(:,:  ) * tmask(:,:,1) )  ! euphotic layer deptht
-              CALL iom_put( "PAR" , etot(:,:,:) * tmask(:,:,:) )  ! Photosynthetically Available Radiation
-           ENDIF
-        ELSE
-           trc2d(:,:,  jp_pcs0_2d + 10) = heup(:,:  ) * tmask(:,:,1)  
-           trc3d(:,:,:,jp_pcs0_3d + 3)  = etot(:,:,:) * tmask(:,:,:)
-        ENDIF
-        !
-      ENDIF
-      !
-      CALL wrk_dealloc( jpi, jpj,      zdepmoy, zetmp, zetmp1, zetmp2 )
-      CALL wrk_dealloc( jpi, jpj, jpk, zekg, zekr, zekb, ze0, ze1, ze2, ze3 )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_opt')
-      !
-   END SUBROUTINE p4z_opt
-
-
-   SUBROUTINE p4z_opt_init
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE p4z_opt_init  ***
-      !!
-      !! ** Purpose :   Initialization of tabulated attenuation coef
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_opt_init')
-      !
-      CALL trc_oce_rgb( xkrgb )                  ! tabulated attenuation coefficients
-      nksrp = trc_oce_ext_lev( r_si2, 0.33e2 )     ! max level of light extinction (Blue Chl=0.01)
-      !
-      IF(lwp) WRITE(numout,*) '        level of light extinction = ', nksrp, ' ref depth = ', gdepw_0(nksrp+1), ' m'
-      !
-                         etot (:,:,:) = 0._wp
-                         enano(:,:,:) = 0._wp
-                         ediat(:,:,:) = 0._wp
-      IF( ln_qsr_bio )   etot3(:,:,:) = 0._wp
-      ! 
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_opt_init')
-      !
-   END SUBROUTINE p4z_opt_init
-
-
-   INTEGER FUNCTION p4z_opt_alloc()
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_opt_alloc  ***
-      !!----------------------------------------------------------------------
-      ALLOCATE( etot (jpi,jpj,jpk) , enano(jpi,jpj,jpk) ,     &
-         &      ediat(jpi,jpj,jpk) , emoy (jpi,jpj,jpk) , STAT=p4z_opt_alloc )
-         !
-      IF( p4z_opt_alloc /= 0 ) CALL ctl_warn('p4z_opt_alloc : failed to allocate arrays.')
-      !
-   END FUNCTION p4z_opt_alloc
-
-#else
-   !!----------------------------------------------------------------------
-   !!  Dummy module :                                   No PISCES bio-model
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE p4z_opt                   ! Empty routine
-   END SUBROUTINE p4z_opt
-#endif 
-
-   !!======================================================================
-END MODULE  p4zopt
Index: anches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zprod.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zprod.F90	(revision 3679)
+++ 	(revision )
@@ -1,532 +1,0 @@
-MODULE p4zprod
-   !!======================================================================
-   !!                         ***  MODULE p4zprod  ***
-   !! TOP :  Growth Rate of the two phytoplanktons groups 
-   !!======================================================================
-   !! History :   1.0  !  2004     (O. Aumont) Original code
-   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
-   !!             3.4  !  2011-05  (O. Aumont, C. Ethe) New parameterization of light limitation
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
-   !!   p4z_prod       :   Compute the growth Rate of the two phytoplanktons groups
-   !!   p4z_prod_init  :   Initialization of the parameters for growth
-   !!   p4z_prod_alloc :   Allocate variables for growth
-   !!----------------------------------------------------------------------
-   USE oce_trc         !  shared variables between ocean and passive tracers
-   USE trc             !  passive tracers common variables 
-   USE sms_pisces      !  PISCES Source Minus Sink variables
-   USE p4zopt          !  optical model
-   USE p4zlim          !  Co-limitations of differents nutrients
-   USE prtctl_trc      !  print control for debugging
-   USE iom             !  I/O manager
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   p4z_prod         ! called in p4zbio.F90
-   PUBLIC   p4z_prod_init    ! called in trcsms_pisces.F90
-   PUBLIC   p4z_prod_alloc
-
-   !! * Shared module variables
-   LOGICAL , PUBLIC ::  ln_newprod = .FALSE.
-   REAL(wp), PUBLIC ::  pislope    = 3.0_wp            !:
-   REAL(wp), PUBLIC ::  pislope2   = 3.0_wp            !:
-   REAL(wp), PUBLIC ::  excret     = 10.e-5_wp         !:
-   REAL(wp), PUBLIC ::  excret2    = 0.05_wp           !:
-   REAL(wp), PUBLIC ::  bresp      = 0.00333_wp        !:
-   REAL(wp), PUBLIC ::  chlcnm     = 0.033_wp          !:
-   REAL(wp), PUBLIC ::  chlcdm     = 0.05_wp           !:
-   REAL(wp), PUBLIC ::  chlcmin    = 0.00333_wp        !:
-   REAL(wp), PUBLIC ::  fecnm      = 10.E-6_wp         !:
-   REAL(wp), PUBLIC ::  fecdm      = 15.E-6_wp         !:
-   REAL(wp), PUBLIC ::  grosip     = 0.151_wp          !:
-
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   prmax    !: optimal production = f(temperature)
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   quotan   !: proxy of N quota in Nanophyto
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   quotad   !: proxy of N quota in diatomee
-   
-   REAL(wp) :: r1_rday                !: 1 / rday
-   REAL(wp) :: texcret                !: 1 - excret 
-   REAL(wp) :: texcret2               !: 1 - excret2        
-   REAL(wp) :: tpp                    !: Total primary production
-
-
-   !!* Substitution
-#  include "top_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE p4z_prod( kt , jnt )
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_prod  ***
-      !!
-      !! ** Purpose :   Compute the phytoplankton production depending on
-      !!              light, temperature and nutrient availability
-      !!
-      !! ** Method  : - ???
-      !!---------------------------------------------------------------------
-      !
-      INTEGER, INTENT(in) :: kt, jnt
-      !
-      INTEGER  ::   ji, jj, jk
-      REAL(wp) ::   zsilfac, zfact, znanotot, zdiattot, zconctemp, zconctemp2
-      REAL(wp) ::   zratio, zmax, zsilim, ztn, zadap
-      REAL(wp) ::   zlim, zsilfac2, zsiborn, zprod, zproreg, zproreg2
-      REAL(wp) ::   zmxltst, zmxlday, zmaxday
-      REAL(wp) ::   zpislopen  , zpislope2n
-      REAL(wp) ::   zrum, zcodel, zargu, zval
-      REAL(wp) ::   zrfact2
-      CHARACTER (len=25) :: charout
-      REAL(wp), POINTER, DIMENSION(:,:  ) :: zmixnano, zmixdiat, zstrn
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zpislopead, zpislopead2, zprdia, zprbio, zprdch, zprnch, zysopt   
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zprorca, zprorcad, zprofed, zprofen, zprochln, zprochld, zpronew, zpronewd
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_prod')
-      !
-      !  Allocate temporary workspace
-      CALL wrk_alloc( jpi, jpj,      zmixnano, zmixdiat, zstrn                                                  )
-      CALL wrk_alloc( jpi, jpj, jpk, zpislopead, zpislopead2, zprdia, zprbio, zprdch, zprnch, zysopt            ) 
-      CALL wrk_alloc( jpi, jpj, jpk, zprorca, zprorcad, zprofed, zprofen, zprochln, zprochld, zpronew, zpronewd )
-      !
-      zprorca (:,:,:) = 0._wp
-      zprorcad(:,:,:) = 0._wp
-      zprofed (:,:,:) = 0._wp
-      zprofen (:,:,:) = 0._wp
-      zprochln(:,:,:) = 0._wp
-      zprochld(:,:,:) = 0._wp
-      zpronew (:,:,:) = 0._wp
-      zpronewd(:,:,:) = 0._wp
-      zprdia  (:,:,:) = 0._wp
-      zprbio  (:,:,:) = 0._wp
-      zprdch  (:,:,:) = 0._wp
-      zprnch  (:,:,:) = 0._wp
-      zysopt  (:,:,:) = 0._wp
-
-      ! Computation of the optimal production
-      prmax(:,:,:) = 0.6_wp * r1_rday * tgfunc(:,:,:) 
-      IF( lk_degrad )  prmax(:,:,:) = prmax(:,:,:) * facvol(:,:,:) 
-
-      ! compute the day length depending on latitude and the day
-      zrum = REAL( nday_year - 80, wp ) / REAL( nyear_len(1), wp )
-      zcodel = ASIN(  SIN( zrum * rpi * 2._wp ) * SIN( rad * 23.5_wp )  )
-
-      ! day length in hours
-      zstrn(:,:) = 0.
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            zargu = TAN( zcodel ) * TAN( gphit(ji,jj) * rad )
-            zargu = MAX( -1., MIN(  1., zargu ) )
-            zstrn(ji,jj) = MAX( 0.0, 24. - 2. * ACOS( zargu ) / rad / 15. )
-         END DO
-      END DO
-
-      IF( ln_newprod ) THEN
-         ! Impact of the day duration on phytoplankton growth
-         DO jk = 1, jpkm1
-            DO jj = 1 ,jpj
-               DO ji = 1, jpi
-                  zval = MAX( 1., zstrn(ji,jj) )
-                  zval = 1.5 * zval / ( 12. + zval )
-                  zprbio(ji,jj,jk) = prmax(ji,jj,jk) * zval
-                  zprdia(ji,jj,jk) = zprbio(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-      ENDIF
-
-      ! Maximum light intensity
-      WHERE( zstrn(:,:) < 1.e0 ) zstrn(:,:) = 24.
-      zstrn(:,:) = 24. / zstrn(:,:)
-
-      IF( ln_newprod ) THEN
-!CDIR NOVERRCHK
-         DO jk = 1, jpkm1
-!CDIR NOVERRCHK
-            DO jj = 1, jpj
-!CDIR NOVERRCHK
-               DO ji = 1, jpi
-
-                  ! Computation of the P-I slope for nanos and diatoms
-                  IF( etot(ji,jj,jk) > 1.E-3 ) THEN
-                      ztn    = MAX( 0., tsn(ji,jj,jk,jp_tem) - 15. )
-                      zadap  = ztn / ( 2.+ ztn )
-
-                      zconctemp   = MAX( 0.e0 , trn(ji,jj,jk,jpdia) - 5e-7 )
-                      zconctemp2  = trn(ji,jj,jk,jpdia) - zconctemp
-
-                      znanotot = enano(ji,jj,jk) * zstrn(ji,jj)
-                      zdiattot = ediat(ji,jj,jk) * zstrn(ji,jj)
-
-                      zfact  = EXP( -0.21 * znanotot )
-                      zpislopead (ji,jj,jk) = pislope  * ( 1.+ zadap  * zfact )  &
-                         &                   * trn(ji,jj,jk,jpnch) /( trn(ji,jj,jk,jpphy) * 12. + rtrn)
-
-                      zpislopead2(ji,jj,jk) = (pislope * zconctemp2 + pislope2 * zconctemp) / ( trn(ji,jj,jk,jpdia) + rtrn )   &
-                         &                   * trn(ji,jj,jk,jpdch) /( trn(ji,jj,jk,jpdia) * 12. + rtrn)
-
-                      ! Computation of production function for Carbon
-                      !  ---------------------------------------------
-                      zpislopen  = zpislopead (ji,jj,jk) / ( ( r1_rday + bresp * r1_rday / chlcnm ) * rday + rtrn)
-                      zpislope2n = zpislopead2(ji,jj,jk) / ( ( r1_rday + bresp * r1_rday / chlcdm ) * rday + rtrn)
-                      zprbio(ji,jj,jk) = zprbio(ji,jj,jk) * ( 1.- EXP( -zpislopen  * znanotot )  )
-                      zprdia(ji,jj,jk) = zprdia(ji,jj,jk) * ( 1.- EXP( -zpislope2n * zdiattot )  )
-
-                      !  Computation of production function for Chlorophyll
-                      !--------------------------------------------------
-                      zmaxday  = 1._wp / ( prmax(ji,jj,jk) * rday + rtrn )
-                      zprnch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislopead (ji,jj,jk) * zmaxday * znanotot ) )
-                      zprdch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislopead2(ji,jj,jk) * zmaxday * zdiattot ) )
-                  ENDIF
-               END DO
-            END DO
-         END DO
-      ELSE
-!CDIR NOVERRCHK
-         DO jk = 1, jpkm1
-!CDIR NOVERRCHK
-            DO jj = 1, jpj
-!CDIR NOVERRCHK
-               DO ji = 1, jpi
-
-                  ! Computation of the P-I slope for nanos and diatoms
-                  IF( etot(ji,jj,jk) > 1.E-3 ) THEN
-                      ztn    = MAX( 0., tsn(ji,jj,jk,jp_tem) - 15. )
-                      zadap  = ztn / ( 2.+ ztn )
-
-                      zfact  = EXP( -0.21 * enano(ji,jj,jk) )
-                      zpislopead (ji,jj,jk) = pislope  * ( 1.+ zadap  * zfact )
-                      zpislopead2(ji,jj,jk) = pislope2
-
-                      zpislopen =  zpislopead(ji,jj,jk) * trn(ji,jj,jk,jpnch)                &
-                        &          / ( trn(ji,jj,jk,jpphy) * 12.                  + rtrn )   &
-                        &          / ( prmax(ji,jj,jk) * rday * xlimphy(ji,jj,jk) + rtrn )
-
-                      zpislope2n = zpislopead2(ji,jj,jk) * trn(ji,jj,jk,jpdch)                &
-                        &          / ( trn(ji,jj,jk,jpdia) * 12.                  + rtrn )   &
-                        &          / ( prmax(ji,jj,jk) * rday * xlimdia(ji,jj,jk) + rtrn )
-
-                      ! Computation of production function for Carbon
-                      !  ---------------------------------------------
-                      zprbio(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislopen  * enano(ji,jj,jk) ) )
-                      zprdia(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislope2n * ediat(ji,jj,jk) ) )
-
-                      !  Computation of production function for Chlorophyll
-                      !--------------------------------------------------
-                      zprnch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislopen  * enano(ji,jj,jk) * zstrn(ji,jj) ) )
-                      zprdch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislope2n * ediat(ji,jj,jk) * zstrn(ji,jj) ) )
-                  ENDIF
-               END DO
-            END DO
-         END DO
-      ENDIF
-
-      !  Computation of a proxy of the N/C ratio
-      !  ---------------------------------------
-!CDIR NOVERRCHK
-      DO jk = 1, jpkm1
-!CDIR NOVERRCHK
-         DO jj = 1, jpj
-!CDIR NOVERRCHK
-            DO ji = 1, jpi
-                zval = ( xnanonh4(ji,jj,jk) + xnanono3(ji,jj,jk) ) * prmax(ji,jj,jk) / ( zprbio(ji,jj,jk) + rtrn )
-                quotan(ji,jj,jk) = MIN( 1., 0.5 + 0.5 * zval )
-                zval = ( xdiatnh4(ji,jj,jk) + xdiatno3(ji,jj,jk) ) * prmax(ji,jj,jk) / ( zprdia(ji,jj,jk) + rtrn )
-                quotad(ji,jj,jk) = MIN( 1., 0.5 + 0.5 * zval )
-            END DO
-         END DO
-      END DO
-
-
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-
-                IF( etot(ji,jj,jk) > 1.E-3 ) THEN
-                   !    Si/C of diatoms
-                   !    ------------------------
-                   !    Si/C increases with iron stress and silicate availability
-                   !    Si/C is arbitrariliy increased for very high Si concentrations
-                   !    to mimic the very high ratios observed in the Southern Ocean (silpot2)
-                  zlim  = trn(ji,jj,jk,jpsil) / ( trn(ji,jj,jk,jpsil) + xksi1 )
-                  zsilim = MIN( zprdia(ji,jj,jk) / ( prmax(ji,jj,jk) + rtrn ), xlimsi(ji,jj,jk) )
-                  zsilfac = 4.4 * EXP( -4.23 * zsilim ) * MAX( 0.e0, MIN( 1., 2.2 * ( zlim - 0.5 ) )  ) + 1.e0
-                  zsiborn = MAX( 0.e0, ( trn(ji,jj,jk,jpsil) - 15.e-6 ) )
-                  zsilfac2 = 1.+ 2.* zsiborn / ( zsiborn + xksi2 )
-                  zsilfac = MIN( 5.4, zsilfac * zsilfac2)
-                  zysopt(ji,jj,jk) = grosip * zlim * zsilfac
-              ENDIF
-            END DO
-         END DO
-      END DO
-
-      !  Computation of the limitation term due to a mixed layer deeper than the euphotic depth
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            zmxltst = MAX( 0.e0, hmld(ji,jj) - heup(ji,jj) )
-            zmxlday = zmxltst * zmxltst * r1_rday
-            zmixnano(ji,jj) = 1. - zmxlday / ( 3. + zmxlday )
-            zmixdiat(ji,jj) = 1. - zmxlday / ( 4. + zmxlday )
-         END DO
-      END DO
- 
-      !  Mixed-layer effect on production                                                                               
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               IF( fsdepw(ji,jj,jk+1) <= hmld(ji,jj) ) THEN
-                  zprbio(ji,jj,jk) = zprbio(ji,jj,jk) * zmixnano(ji,jj)
-                  zprdia(ji,jj,jk) = zprdia(ji,jj,jk) * zmixdiat(ji,jj)
-               ENDIF
-            END DO
-         END DO
-      END DO
-
-      ! Computation of the various production terms 
-!CDIR NOVERRCHK
-      DO jk = 1, jpkm1
-!CDIR NOVERRCHK
-         DO jj = 1, jpj
-!CDIR NOVERRCHK
-            DO ji = 1, jpi
-               IF( etot(ji,jj,jk) > 1.E-3 ) THEN
-                  !  production terms for nanophyto.
-                  zprorca(ji,jj,jk) = zprbio(ji,jj,jk)  * xlimphy(ji,jj,jk) * trn(ji,jj,jk,jpphy) * rfact2
-                  zpronew(ji,jj,jk) = zprorca(ji,jj,jk) * xnanono3(ji,jj,jk) / ( xnanono3(ji,jj,jk) + xnanonh4(ji,jj,jk) + rtrn )
-                  !
-                  zratio = trn(ji,jj,jk,jpnfe) / ( trn(ji,jj,jk,jpphy) + rtrn )
-                  zratio = zratio / fecnm 
-                  zmax   = MAX( 0., ( 1. - zratio ) / ABS( 1.05 - zratio ) ) 
-                  zprofen(ji,jj,jk) = fecnm * prmax(ji,jj,jk)  &
-                  &             * ( 4. - 4.5 * xlimnfe(ji,jj,jk) / ( xlimnfe(ji,jj,jk) + 0.5 ) )    &
-                  &             * trn(ji,jj,jk,jpfer) / ( trn(ji,jj,jk,jpfer) + concnfe(ji,jj,jk) )  &
-                  &             * zmax * trn(ji,jj,jk,jpphy) * rfact2
-                  !  production terms for diatomees
-                  zprorcad(ji,jj,jk) = zprdia(ji,jj,jk) * xlimdia(ji,jj,jk) * trn(ji,jj,jk,jpdia) * rfact2
-                  zpronewd(ji,jj,jk) = zprorcad(ji,jj,jk) * xdiatno3(ji,jj,jk) / ( xdiatno3(ji,jj,jk) + xdiatnh4(ji,jj,jk) + rtrn )
-                  !
-                  zratio = trn(ji,jj,jk,jpdfe) / ( trn(ji,jj,jk,jpdia) + rtrn )
-                  zratio = zratio / fecdm 
-                  zmax   = MAX( 0., ( 1. - zratio ) / ABS( 1.05 - zratio ) ) 
-                  zprofed(ji,jj,jk) = fecdm * prmax(ji,jj,jk)  &
-                  &             * ( 4. - 4.5 * xlimdfe(ji,jj,jk) / ( xlimdfe(ji,jj,jk) + 0.5 ) )    &
-                  &             * trn(ji,jj,jk,jpfer) / ( trn(ji,jj,jk,jpfer) + concdfe(ji,jj,jk) )  &
-                  &             * zmax * trn(ji,jj,jk,jpdia) * rfact2
-               ENDIF
-            END DO
-         END DO
-      END DO
-
-      IF( ln_newprod ) THEN
-!CDIR NOVERRCHK
-         DO jk = 1, jpkm1
-!CDIR NOVERRCHK
-            DO jj = 1, jpj
-!CDIR NOVERRCHK
-               DO ji = 1, jpi
-                  IF( fsdepw(ji,jj,jk+1) <= hmld(ji,jj) ) THEN
-                     zprnch(ji,jj,jk) = zprnch(ji,jj,jk) * zmixnano(ji,jj)
-                     zprdch(ji,jj,jk) = zprdch(ji,jj,jk) * zmixdiat(ji,jj)
-                  ENDIF
-                  IF( etot(ji,jj,jk) > 1.E-3 ) THEN
-                     !  production terms for nanophyto. ( chlorophyll )
-                     znanotot = enano(ji,jj,jk) * zstrn(ji,jj)
-                     zprod    = rday * zprorca(ji,jj,jk) * zprnch(ji,jj,jk) * xlimphy(ji,jj,jk)
-                     zprochln(ji,jj,jk) = chlcmin * 12. * zprorca (ji,jj,jk)
-                     zprochln(ji,jj,jk) = zprochln(ji,jj,jk) + chlcnm * 12. * zprod / (  zpislopead(ji,jj,jk) * znanotot +rtrn)
-                     !  production terms for diatomees ( chlorophyll )
-                     zdiattot = ediat(ji,jj,jk) * zstrn(ji,jj)
-                     zprod = rday * zprorcad(ji,jj,jk) * zprdch(ji,jj,jk) * xlimdia(ji,jj,jk)
-                     zprochld(ji,jj,jk) = chlcmin * 12. * zprorcad(ji,jj,jk)
-                     zprochld(ji,jj,jk) = zprochld(ji,jj,jk) + chlcdm * 12. * zprod / ( zpislopead2(ji,jj,jk) * zdiattot +rtrn )
-                  ENDIF
-               END DO
-            END DO
-         END DO
-      ELSE
-!CDIR NOVERRCHK
-         DO jk = 1, jpkm1
-!CDIR NOVERRCHK
-            DO jj = 1, jpj
-!CDIR NOVERRCHK
-               DO ji = 1, jpi
-                  IF( etot(ji,jj,jk) > 1.E-3 ) THEN
-                     !  production terms for nanophyto. ( chlorophyll )
-                     znanotot = enano(ji,jj,jk) * zstrn(ji,jj)
-                     zprod = rday * zprorca(ji,jj,jk) * zprnch(ji,jj,jk) * trn(ji,jj,jk,jpphy) * xlimphy(ji,jj,jk)
-                     zprochln(ji,jj,jk) = chlcnm * 144. * zprod / (  zpislopead(ji,jj,jk) * trn(ji,jj,jk,jpnch) * znanotot +rtrn)
-                     !  production terms for diatomees ( chlorophyll )
-                     zdiattot = ediat(ji,jj,jk) * zstrn(ji,jj)
-                     zprod = rday * zprorcad(ji,jj,jk) * zprdch(ji,jj,jk) * trn(ji,jj,jk,jpdia) * xlimdia(ji,jj,jk)
-                     zprochld(ji,jj,jk) = chlcdm * 144. * zprod / ( zpislopead2(ji,jj,jk) * trn(ji,jj,jk,jpdch) * zdiattot +rtrn )
-                  ENDIF
-               END DO
-            END DO
-         END DO
-      ENDIF
-
-      !   Update the arrays TRA which contain the biological sources and sinks
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-           DO ji =1 ,jpi
-              zproreg  = zprorca(ji,jj,jk) - zpronew(ji,jj,jk)
-              zproreg2 = zprorcad(ji,jj,jk) - zpronewd(ji,jj,jk)
-              tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) - zprorca(ji,jj,jk) - zprorcad(ji,jj,jk)
-              tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) - zpronew(ji,jj,jk) - zpronewd(ji,jj,jk)
-              tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) - zproreg - zproreg2
-              tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) + zprorca(ji,jj,jk) * texcret
-              tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) + zprochln(ji,jj,jk) * texcret
-              tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) + zprofen(ji,jj,jk) * texcret
-              tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) + zprorcad(ji,jj,jk) * texcret2
-              tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) + zprochld(ji,jj,jk) * texcret2
-              tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) + zprofed(ji,jj,jk) * texcret2
-              tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) + zprorcad(ji,jj,jk) * zysopt(ji,jj,jk) * texcret2
-              tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + excret2 * zprorcad(ji,jj,jk) + excret * zprorca(ji,jj,jk)
-              tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) + o2ut * ( zproreg + zproreg2) &
-                 &                + ( o2ut + o2nit ) * ( zpronew(ji,jj,jk) + zpronewd(ji,jj,jk) )
-              tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) - texcret * zprofen(ji,jj,jk) - texcret2 * zprofed(ji,jj,jk)
-              tra(ji,jj,jk,jpsil) = tra(ji,jj,jk,jpsil) - texcret2 * zprorcad(ji,jj,jk) * zysopt(ji,jj,jk)
-              tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprorca(ji,jj,jk) - zprorcad(ji,jj,jk)
-              tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3 * ( zpronew(ji,jj,jk) + zpronewd(ji,jj,jk) ) &
-                 &                                      - rno3 * ( zproreg + zproreg2 )
-          END DO
-        END DO
-     END DO
-
-     ! Total primary production per year
-     tpp = tpp + glob_sum( ( zprorca(:,:,:) + zprorcad(:,:,:) ) * cvol(:,:,:) )
-
-     IF( kt == nitend .AND. jnt == nrdttrc ) THEN
-        WRITE(numout,*) 'Total PP (Gtc) :'
-        WRITE(numout,*) '-------------------- : ',tpp * 12. / 1.E12
-        WRITE(numout,*) 
-      ENDIF
-
-     IF( ln_diatrc ) THEN
-         !
-         zrfact2 = 1.e3 * rfact2r  ! conversion from mol/L/timestep into mol/m3/s
-         IF( lk_iomput ) THEN
-           IF( jnt == nrdttrc ) THEN
-              CALL iom_put( "PPPHY"   , zprorca (:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by nanophyto
-              CALL iom_put( "PPPHY2"  , zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by diatom
-              CALL iom_put( "PPNEWN"  , zpronew (:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by nanophyto
-              CALL iom_put( "PPNEWD"  , zpronewd(:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by diatom
-              CALL iom_put( "PBSi"    , zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:) ) ! biogenic silica production
-              CALL iom_put( "PFeD"    , zprofed (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by diatom
-              CALL iom_put( "PFeN"    , zprofen (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by nanophyto
-              CALL iom_put( "Mumax"   , prmax   (:,:,:) * tmask(:,:,:) )  ! Maximum growth rate
-              CALL iom_put( "MuN"     , zprbio  (:,:,:) * xlimphy(:,:,:) * tmask(:,:,:) )  ! Realized growth rate for nanophyto
-              CALL iom_put( "MuD"     , zprdia  (:,:,:) * xlimdia(:,:,:) * tmask(:,:,:) )  ! Realized growth rate for diatoms
-              CALL iom_put( "MuNlight", zprbio  (:,:,:) * tmask(:,:,:) )  ! Light limited growth rate phytoplankton
-              CALL iom_put( "MuDlight", zprdia  (:,:,:) * tmask(:,:,:) )  ! Light limited growth rate diatoms
-              CALL iom_put( "LNnut"   , xlimphy (:,:,:) * tmask(:,:,:) )  ! Nutrient limitation term
-              CALL iom_put( "LDnut"   , xlimdia (:,:,:) * tmask(:,:,:) )  ! Nutrient limitation term
-              CALL iom_put( "LNFe"    , xlimnfe (:,:,:) * tmask(:,:,:) )  ! Iron limitation term
-              CALL iom_put( "LDFe"    , xlimdfe (:,:,:) * tmask(:,:,:) )  ! Iron limitation term
-              CALL iom_put( "LNlight" , zprbio  (:,:,:) / (prmax(:,:,:) + rtrn) * tmask(:,:,:) )  ! light limitation term
-              CALL iom_put( "LDlight" , zprdia  (:,:,:) / (prmax(:,:,:) + rtrn) * tmask(:,:,:) )  ! light limitation term
-           ENDIF
-         ELSE
-              trc3d(:,:,:,jp_pcs0_3d + 4)  = zprorca (:,:,:) * zrfact2 * tmask(:,:,:)
-              trc3d(:,:,:,jp_pcs0_3d + 5)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:)
-              trc3d(:,:,:,jp_pcs0_3d + 6)  = zpronew (:,:,:) * zrfact2 * tmask(:,:,:)
-              trc3d(:,:,:,jp_pcs0_3d + 7)  = zpronewd(:,:,:) * zrfact2 * tmask(:,:,:)
-              trc3d(:,:,:,jp_pcs0_3d + 8)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:)
-              trc3d(:,:,:,jp_pcs0_3d + 9)  = zprofed (:,:,:) * zrfact2 * tmask(:,:,:)
-#  if ! defined key_kriest
-              trc3d(:,:,:,jp_pcs0_3d + 10) = zprofen (:,:,:) * zrfact2 * tmask(:,:,:)
-#  endif
-         ENDIF
-         !
-      ENDIF
-
-      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
-         WRITE(charout, FMT="('prod')")
-         CALL prt_ctl_trc_info(charout)
-         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
-      ENDIF
-      !
-      CALL wrk_dealloc( jpi, jpj,      zmixnano, zmixdiat, zstrn                                                  )
-      CALL wrk_dealloc( jpi, jpj, jpk, zpislopead, zpislopead2, zprdia, zprbio, zprdch, zprnch, zysopt            ) 
-      CALL wrk_dealloc( jpi, jpj, jpk, zprorca, zprorcad, zprofed, zprofen, zprochln, zprochld, zpronew, zpronewd )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_prod')
-      !
-   END SUBROUTINE p4z_prod
-
-
-   SUBROUTINE p4z_prod_init
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE p4z_prod_init  ***
-      !!
-      !! ** Purpose :   Initialization of phytoplankton production parameters
-      !!
-      !! ** Method  :   Read the nampisprod namelist and check the parameters
-      !!      called at the first timestep (nittrc000)
-      !!
-      !! ** input   :   Namelist nampisprod
-      !!----------------------------------------------------------------------
-      !
-      NAMELIST/nampisprod/ pislope, pislope2, ln_newprod, bresp, excret, excret2,  &
-         &                 chlcnm, chlcdm, chlcmin, fecnm, fecdm, grosip
-      !!----------------------------------------------------------------------
-
-      REWIND( numnatp )                     ! read numnatp
-      READ  ( numnatp, nampisprod )
-
-      IF(lwp) THEN                         ! control print
-         WRITE(numout,*) ' '
-         WRITE(numout,*) ' Namelist parameters for phytoplankton growth, nampisprod'
-         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
-         WRITE(numout,*) '    Enable new parame. of production (T/F)   ln_newprod   =', ln_newprod
-         WRITE(numout,*) '    mean Si/C ratio                           grosip       =', grosip
-         WRITE(numout,*) '    P-I slope                                 pislope      =', pislope
-         WRITE(numout,*) '    excretion ratio of nanophytoplankton      excret       =', excret
-         WRITE(numout,*) '    excretion ratio of diatoms                excret2      =', excret2
-         IF( ln_newprod )  THEN
-            WRITE(numout,*) '    basal respiration in phytoplankton        bresp        =', bresp
-            WRITE(numout,*) '    Maximum Chl/C in phytoplankton            chlcmin      =', chlcmin
-         ENDIF
-         WRITE(numout,*) '    P-I slope  for diatoms                    pislope2     =', pislope2
-         WRITE(numout,*) '    Minimum Chl/C in nanophytoplankton        chlcnm       =', chlcnm
-         WRITE(numout,*) '    Minimum Chl/C in diatoms                  chlcdm       =', chlcdm
-         WRITE(numout,*) '    Maximum Fe/C in nanophytoplankton         fecnm        =', fecnm
-         WRITE(numout,*) '    Minimum Fe/C in diatoms                   fecdm        =', fecdm
-      ENDIF
-      !
-      r1_rday   = 1._wp / rday 
-      texcret   = 1._wp - excret
-      texcret2  = 1._wp - excret2
-      tpp       = 0._wp
-      !
-   END SUBROUTINE p4z_prod_init
-
-
-   INTEGER FUNCTION p4z_prod_alloc()
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_prod_alloc  ***
-      !!----------------------------------------------------------------------
-      ALLOCATE( prmax(jpi,jpj,jpk), quotan(jpi,jpj,jpk), quotad(jpi,jpj,jpk), STAT = p4z_prod_alloc )
-      !
-      IF( p4z_prod_alloc /= 0 ) CALL ctl_warn('p4z_prod_alloc : failed to allocate arrays.')
-      !
-   END FUNCTION p4z_prod_alloc
-
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_prod                    ! Empty routine
-   END SUBROUTINE p4z_prod
-#endif 
-
-   !!======================================================================
-END MODULE  p4zprod
Index: anches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsed.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsed.F90	(revision 3679)
+++ 	(revision )
@@ -1,641 +1,0 @@
-MODULE p4zsed
-   !!======================================================================
-   !!                         ***  MODULE p4sed  ***
-   !! TOP :   PISCES Compute loss of organic matter in the sediments
-   !!======================================================================
-   !! History :   1.0  !  2004-03 (O. Aumont) Original code
-   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
-   !!             3.4  !  2011-06  (O. Aumont, C. Ethe) USE of fldread
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
-   !!   p4z_sed        :  Compute loss of organic matter in the sediments
-   !!   p4z_sbc        :  Read and interpolate time-varying nutrients fluxes
-   !!   p4z_sed_init   :  Initialization of p4z_sed
-   !!----------------------------------------------------------------------
-   USE oce_trc         !  shared variables between ocean and passive tracers
-   USE trc             !  passive tracers common variables 
-   USE sms_pisces      !  PISCES Source Minus Sink variables
-   USE p4zsink         !  vertical flux of particulate matter due to sinking
-   USE p4zopt          !  optical model
-   USE p4zlim          !  Co-limitations of differents nutrients
-   USE p4zrem          !  Remineralisation of organic matter
-   USE p4zint          !  interpolation and computation of various fields
-   USE iom             !  I/O manager
-   USE fldread         !  time interpolation
-   USE prtctl_trc      !  print control for debugging
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   p4z_sed   
-   PUBLIC   p4z_sed_init   
-   PUBLIC   p4z_sed_alloc
-
-   !! * Shared module variables
-   LOGICAL  :: ln_dust     = .FALSE.    !: boolean for dust input from the atmosphere
-   LOGICAL  :: ln_river    = .FALSE.    !: boolean for river input of nutrients
-   LOGICAL  :: ln_ndepo    = .FALSE.    !: boolean for atmospheric deposition of N
-   LOGICAL  :: ln_ironsed  = .FALSE.    !: boolean for Fe input from sediments
-
-   REAL(wp) :: sedfeinput  = 1.E-9_wp   !: Coastal release of Iron
-   REAL(wp) :: dustsolub   = 0.014_wp   !: Solubility of the dust
-   REAL(wp) :: wdust       = 2.0_wp     !: Sinking speed of the dust 
-   REAL(wp) :: nitrfix     = 1E-7_wp    !: Nitrogen fixation rate   
-   REAL(wp) :: diazolight  = 50._wp     !: Nitrogen fixation sensitivty to light 
-   REAL(wp) :: concfediaz  = 1.E-10_wp  !: Fe half-saturation Cste for diazotrophs 
-
-
-   !! * Module variables
-   REAL(wp) :: ryyss                  !: number of seconds per year 
-   REAL(wp) :: r1_ryyss                 !: inverse of ryyss
-   REAL(wp) :: rmtss                  !: number of seconds per month
-   REAL(wp) :: r1_rday                  !: inverse of rday
-   LOGICAL  :: ll_sbc
-
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_dust      ! structure of input dust
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_riverdic  ! structure of input riverdic
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_riverdoc  ! structure of input riverdoc
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_ndepo     ! structure of input nitrogen deposition
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_ironsed   ! structure of input iron from sediment
-
-   INTEGER , PARAMETER :: nbtimes = 365  !: maximum number of times record in a file
-   INTEGER  :: ntimes_dust, ntimes_riv, ntimes_ndep       ! number of time steps in a file
-
-   REAL(wp), ALLOCATABLE, SAVE,   DIMENSION(:,:) :: dust      !: dust fields
-   REAL(wp), ALLOCATABLE, SAVE,   DIMENSION(:,:) :: rivinp, cotdep    !: river input fields
-   REAL(wp), ALLOCATABLE, SAVE,   DIMENSION(:,:) :: nitdep    !: atmospheric N deposition 
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ironsed   !: Coastal supply of iron
-
-   REAL(wp) :: sumdepsi, rivalkinput, rivpo4input, nitdepinput
-
-   !!* Substitution
-#  include "top_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Header:$ 
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-
-   SUBROUTINE p4z_sed( kt, jnt )
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_sed  ***
-      !!
-      !! ** Purpose :   Compute loss of organic matter in the sediments. This
-      !!              is by no way a sediment model. The loss is simply 
-      !!              computed to balance the inout from rivers and dust
-      !!
-      !! ** Method  : - ???
-      !!---------------------------------------------------------------------
-      !
-      INTEGER, INTENT(in) ::   kt, jnt ! ocean time step
-      INTEGER  ::   ji, jj, jk, ikt
-#if ! defined key_sed
-      REAL(wp) ::   zsumsedsi, zsumsedpo4, zsumsedcal
-      REAL(wp) ::   zrivalk, zrivsil, zrivpo4
-#endif
-      REAL(wp) ::   zdenitot, znitrpottot, zlim, zfact, zfactcal
-      REAL(wp) ::   zsiloss, zcaloss, zwsbio3, zwsbio4, zwscal, zdep
-      CHARACTER (len=25) :: charout
-      REAL(wp), POINTER, DIMENSION(:,:  ) :: zsidep, zwork1, zwork2, zwork3
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: znitrpot, zirondep
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_sed')
-      !
-      ! Allocate temporary workspace
-      CALL wrk_alloc( jpi, jpj,      zsidep, zwork1, zwork2, zwork3 )
-      CALL wrk_alloc( jpi, jpj, jpk, znitrpot, zirondep             )
-
-      IF( jnt == 1 .AND. ll_sbc ) CALL p4z_sbc( kt )
-
-      zirondep(:,:,:) = 0.e0          ! Initialisation of variables USEd to compute deposition
-      zsidep  (:,:)   = 0.e0
-
-      ! Iron and Si deposition at the surface
-      ! -------------------------------------
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            zdep  = rfact2 / fse3t(ji,jj,1)
-            zirondep(ji,jj,1) = ( dustsolub * dust(ji,jj) / ( 55.85 * rmtss ) + 3.e-10 * r1_ryyss ) * zdep
-            zsidep  (ji,jj)   = 8.8 * 0.075 * dust(ji,jj) * zdep / ( 28.1 * rmtss )
-         END DO
-      END DO
-
-      ! Iron solubilization of particles in the water column
-      ! ----------------------------------------------------
-      DO jk = 2, jpkm1
-         zirondep(:,:,jk) = dust(:,:) / ( wdust * 55.85 * rmtss ) * rfact2 * 1.e-4 * EXP( -fsdept(:,:,jk) / 1000. )
-      END DO
-
-      ! Add the external input of nutrients, carbon and alkalinity
-      ! ----------------------------------------------------------
-      trn(:,:,1,jppo4) = trn(:,:,1,jppo4) + rivinp(:,:) * rfact2 
-      trn(:,:,1,jpno3) = trn(:,:,1,jpno3) + (rivinp(:,:) + nitdep(:,:)) * rfact2
-      trn(:,:,1,jpfer) = trn(:,:,1,jpfer) + rivinp(:,:) * 3.e-5 * rfact2
-      trn(:,:,1,jpsil) = trn(:,:,1,jpsil) + zsidep (:,:) + cotdep(:,:)   * rfact2 / 6.
-      trn(:,:,1,jpdic) = trn(:,:,1,jpdic) + rivinp(:,:) * 2.631 * rfact2
-      trn(:,:,1,jptal) = trn(:,:,1,jptal) + (cotdep(:,:) - rno3*(rivinp(:,:) +  nitdep(:,:) ) ) * rfact2
-
-
-      ! Add the external input of iron which is 3D distributed
-      ! (dust, river and sediment mobilization)
-      ! ------------------------------------------------------
-      DO jk = 1, jpkm1
-         trn(:,:,jk,jpfer) = trn(:,:,jk,jpfer) + zirondep(:,:,jk) + ironsed(:,:,jk) * rfact2
-      END DO
-
-#if ! defined key_sed
-      ! Loss of biogenic silicon, Caco3 organic carbon in the sediments. 
-      ! First, the total loss is computed.
-      ! The factor for calcite comes from the alkalinity effect
-      ! -------------------------------------------------------------
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            ikt = mbkt(ji,jj) 
-# if defined key_kriest
-            zwork1(ji,jj) = trn(ji,jj,ikt,jpgsi) * wscal (ji,jj,ikt)
-            zwork2(ji,jj) = trn(ji,jj,ikt,jppoc) * wsbio3(ji,jj,ikt)
-# else
-            zwork1(ji,jj) = trn(ji,jj,ikt,jpgsi) * wsbio4(ji,jj,ikt)
-            zwork2(ji,jj) = trn(ji,jj,ikt,jpgoc) * wsbio4(ji,jj,ikt) + trn(ji,jj,ikt,jppoc) * wsbio3(ji,jj,ikt) 
-# endif
-            ! For calcite, burial efficiency is made a function of saturation
-            zfactcal      = MIN( excess(ji,jj,ikt), 0.2 )
-            zfactcal      = MIN( 1., 1.3 * ( 0.2 - zfactcal ) / ( 0.4 - zfactcal ) )
-            zwork3(ji,jj) = trn(ji,jj,ikt,jpcal) * wscal (ji,jj,ikt) * 2.e0 * zfactcal
-         END DO
-      END DO
-      zsumsedsi  = glob_sum( zwork1(:,:) * e1e2t(:,:) ) * r1_rday
-      zsumsedpo4 = glob_sum( zwork2(:,:) * e1e2t(:,:) ) * r1_rday
-      zsumsedcal = glob_sum( zwork3(:,:) * e1e2t(:,:) ) * r1_rday
-#endif
-
-      ! THEN this loss is scaled at each bottom grid cell for
-      ! equilibrating the total budget of silica in the ocean.
-      ! Thus, the amount of silica lost in the sediments equal
-      ! the supply at the surface (dust+rivers)
-      ! ------------------------------------------------------
-#if ! defined key_sed
-      zrivsil =  1._wp - ( sumdepsi + rivalkinput * r1_ryyss / 6. ) / zsumsedsi 
-      zrivpo4 =  1._wp - ( rivpo4input * r1_ryyss ) / zsumsedpo4 
-#endif
-
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            ikt  = mbkt(ji,jj)
-            zdep = xstep / fse3t(ji,jj,ikt)
-            zwsbio4 = wsbio4(ji,jj,ikt) * zdep
-            zwscal  = wscal (ji,jj,ikt) * zdep
-# if defined key_kriest
-            zsiloss = trn(ji,jj,ikt,jpgsi) * zwsbio4
-# else
-            zsiloss = trn(ji,jj,ikt,jpgsi) * zwscal
-# endif
-            zcaloss = trn(ji,jj,ikt,jpcal) * zwscal
-            !
-            trn(ji,jj,ikt,jpgsi) = trn(ji,jj,ikt,jpgsi) - zsiloss
-            trn(ji,jj,ikt,jpcal) = trn(ji,jj,ikt,jpcal) - zcaloss
-#if ! defined key_sed
-            trn(ji,jj,ikt,jpsil) = trn(ji,jj,ikt,jpsil) + zsiloss * zrivsil 
-            zfactcal = MIN( excess(ji,jj,ikt), 0.2 )
-            zfactcal = MIN( 1., 1.3 * ( 0.2 - zfactcal ) / ( 0.4 - zfactcal ) )
-            zrivalk  =  1._wp - ( rivalkinput * r1_ryyss ) * zfactcal / zsumsedcal 
-            trn(ji,jj,ikt,jptal) =  trn(ji,jj,ikt,jptal) + zcaloss * zrivalk * 2.0
-            trn(ji,jj,ikt,jpdic) =  trn(ji,jj,ikt,jpdic) + zcaloss * zrivalk
-#endif
-         END DO
-      END DO
-
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            ikt  = mbkt(ji,jj)
-            zdep = xstep / fse3t(ji,jj,ikt)
-            zwsbio4 = wsbio4(ji,jj,ikt) * zdep
-            zwsbio3 = wsbio3(ji,jj,ikt) * zdep
-# if ! defined key_kriest
-            trn(ji,jj,ikt,jpgoc) = trn(ji,jj,ikt,jpgoc) - trn(ji,jj,ikt,jpgoc) * zwsbio4
-            trn(ji,jj,ikt,jppoc) = trn(ji,jj,ikt,jppoc) - trn(ji,jj,ikt,jppoc) * zwsbio3
-            trn(ji,jj,ikt,jpbfe) = trn(ji,jj,ikt,jpbfe) - trn(ji,jj,ikt,jpbfe) * zwsbio4
-            trn(ji,jj,ikt,jpsfe) = trn(ji,jj,ikt,jpsfe) - trn(ji,jj,ikt,jpsfe) * zwsbio3
-#if ! defined key_sed
-            trn(ji,jj,ikt,jpdoc) = trn(ji,jj,ikt,jpdoc) &
-               &               + ( trn(ji,jj,ikt,jpgoc) * zwsbio4 + trn(ji,jj,ikt,jppoc) * zwsbio3 ) * zrivpo4
-#endif
-
-# else
-            trn(ji,jj,ikt,jpnum) = trn(ji,jj,ikt,jpnum) - trn(ji,jj,ikt,jpnum) * zwsbio4
-            trn(ji,jj,ikt,jppoc) = trn(ji,jj,ikt,jppoc) - trn(ji,jj,ikt,jppoc) * zwsbio3
-            trn(ji,jj,ikt,jpsfe) = trn(ji,jj,ikt,jpsfe) - trn(ji,jj,ikt,jpsfe) * zwsbio3
-#if ! defined key_sed
-            trn(ji,jj,ikt,jpdoc) = trn(ji,jj,ikt,jpdoc) &
-               &               + ( trn(ji,jj,ikt,jpnum) * zwsbio4 + trn(ji,jj,ikt,jppoc) * zwsbio3 ) * zrivpo4
-#endif
-
-# endif
-         END DO
-      END DO
-
-
-      ! Nitrogen fixation (simple parameterization). The total gain
-      ! from nitrogen fixation is scaled to balance the loss by 
-      ! denitrification
-      ! -------------------------------------------------------------
-
-      zdenitot = glob_sum(  ( denitr(:,:,:) * rdenit + denitnh4(:,:,:) * rdenita ) * cvol(:,:,:) ) 
-
-      ! Potential nitrogen fixation dependant on temperature and iron
-      ! -------------------------------------------------------------
-
-!CDIR NOVERRCHK
-      DO jk = 1, jpk
-!CDIR NOVERRCHK
-         DO jj = 1, jpj
-!CDIR NOVERRCHK
-            DO ji = 1, jpi
-               zlim = ( 1.- xnanono3(ji,jj,jk) - xnanonh4(ji,jj,jk) )
-               IF( zlim <= 0.2 )   zlim = 0.01
-#if defined key_degrad
-               zfact = zlim * rfact2 * facvol(ji,jj,jk)
-#else
-               zfact = zlim * rfact2 
-#endif
-               znitrpot(ji,jj,jk) =  MAX( 0.e0, ( 0.6 * tgfunc(ji,jj,jk) - 2.15 ) * r1_rday )   &
-                 &                 *  zfact * trn(ji,jj,jk,jpfer) / ( concfediaz + trn(ji,jj,jk,jpfer) ) &
-                 &                 * ( 1.- EXP( -etot(ji,jj,jk) / diazolight ) )
-            END DO
-         END DO 
-      END DO
-
-      znitrpottot = glob_sum( znitrpot(:,:,:) * cvol(:,:,:) )
-
-      ! Nitrogen change due to nitrogen fixation
-      ! ----------------------------------------
-      DO jk = 1, jpk
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               zfact = znitrpot(ji,jj,jk) * nitrfix
-               trn(ji,jj,jk,jpnh4) = trn(ji,jj,jk,jpnh4) + zfact
-               trn(ji,jj,jk,jptal) = trn(ji,jj,jk,jptal) + rno3 * zfact
-               trn(ji,jj,jk,jpoxy) = trn(ji,jj,jk,jpoxy) + zfact   * o2nit
-               trn(ji,jj,jk,jppo4) = trn(ji,jj,jk,jppo4) + 30. / 46. * zfact
-           !    trn(ji,jj,jk,jppo4) = trn(ji,jj,jk,jppo4) + zfact
-           END DO
-         END DO 
-      END DO
-      !
-      IF( ln_diatrc ) THEN
-         zfact = 1.e+3 * rfact2r
-         IF( lk_iomput ) THEN
-            zwork1(:,:)  =  ( zirondep(:,:,1) + ironsed(:,:,1) * rfact2 ) * zfact * fse3t(:,:,1) * tmask(:,:,1) 
-            zwork2(:,:)  =    znitrpot(:,:,1) * nitrfix                   * zfact * fse3t(:,:,1) * tmask(:,:,1)
-            IF( jnt == nrdttrc ) THEN
-               CALL iom_put( "Irondep", zwork1  )  ! surface downward net flux of iron
-               CALL iom_put( "Nfix"   , zwork2 )  ! nitrogen fixation at surface
-            ENDIF
-         ELSE
-            trc2d(:,:,jp_pcs0_2d + 11) = zirondep(:,:,1)           * zfact * fse3t(:,:,1) * tmask(:,:,1)
-            trc2d(:,:,jp_pcs0_2d + 12) = znitrpot(:,:,1) * nitrfix * zfact * fse3t(:,:,1) * tmask(:,:,1)
-         ENDIF
-      ENDIF
-      !
-      IF(ln_ctl) THEN  ! print mean trends (USEd for debugging)
-         WRITE(charout, fmt="('sed ')")
-         CALL prt_ctl_trc_info(charout)
-         CALL prt_ctl_trc(tab4d=trn, mask=tmask, clinfo=ctrcnm)
-      ENDIF
-      !
-      CALL wrk_dealloc( jpi, jpj,      zsidep, zwork1, zwork2, zwork3 )
-      CALL wrk_dealloc( jpi, jpj, jpk, znitrpot, zirondep             )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_sed')
-      !
-   END SUBROUTINE p4z_sed
-
-   SUBROUTINE p4z_sbc( kt )
-      !!----------------------------------------------------------------------
-      !!                  ***  routine p4z_sbc  ***
-      !!
-      !! ** purpose :   read and interpolate the external sources of 
-      !!                nutrients
-      !!
-      !! ** method  :   read the files and interpolate the appropriate variables
-      !!
-      !! ** input   :   external netcdf files
-      !!
-      !!----------------------------------------------------------------------
-      !! * arguments
-      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
-
-      !! * local declarations
-      INTEGER  :: ji,jj 
-      REAL(wp) :: zcoef
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_sbc')
-      !
-      ! Compute dust at nit000 or only if there is more than 1 time record in dust file
-      IF( ln_dust ) THEN
-         IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_dust > 1 ) ) THEN
-            CALL fld_read( kt, 1, sf_dust )
-            dust(:,:) = sf_dust(1)%fnow(:,:,1)
-         ENDIF
-      ENDIF
-
-      ! N/P and Si releases due to coastal rivers
-      ! Compute river at nit000 or only if there is more than 1 time record in river file
-      ! -----------------------------------------
-      IF( ln_river ) THEN
-         IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_riv > 1 ) ) THEN
-            CALL fld_read( kt, 1, sf_riverdic )
-            CALL fld_read( kt, 1, sf_riverdoc )
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  zcoef = ryyss * cvol(ji,jj,1) 
-                  cotdep(ji,jj) =   sf_riverdic(1)%fnow(ji,jj,1)                                  * 1E9 / ( 12. * zcoef + rtrn )
-                  rivinp(ji,jj) = ( sf_riverdic(1)%fnow(ji,jj,1) + sf_riverdoc(1)%fnow(ji,jj,1) ) * 1E9 / ( 31.6* zcoef + rtrn )
-               END DO
-            END DO
-         ENDIF
-      ENDIF
-
-      ! Compute N deposition at nit000 or only if there is more than 1 time record in N deposition file
-      IF( ln_ndepo ) THEN
-         IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_ndep > 1 ) ) THEN
-            CALL fld_read( kt, 1, sf_ndepo )
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  nitdep(ji,jj) = 7.6 * sf_ndepo(1)%fnow(ji,jj,1) / ( 14E6 * ryyss * fse3t(ji,jj,1) + rtrn )
-               END DO
-            END DO
-         ENDIF
-      ENDIF
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_sbc')
-      !
-   END SUBROUTINE p4z_sbc
-
-   SUBROUTINE p4z_sed_init
-
-      !!----------------------------------------------------------------------
-      !!                  ***  routine p4z_sed_init  ***
-      !!
-      !! ** purpose :   initialization of the external sources of nutrients
-      !!
-      !! ** method  :   read the files and compute the budget
-      !!                called at the first timestep (nittrc000)
-      !!
-      !! ** input   :   external netcdf files
-      !!
-      !!----------------------------------------------------------------------
-      !
-      INTEGER  :: ji, jj, jk, jm
-      INTEGER  :: numdust, numriv, numiron, numdepo
-      INTEGER  :: ierr, ierr1, ierr2, ierr3
-      REAL(wp) :: zexpide, zdenitide, zmaskt
-      REAL(wp), DIMENSION(nbtimes) :: zsteps                 ! times records
-      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zdust, zndepo, zriverdic, zriverdoc, zcmask
-      !
-      CHARACTER(len=100) ::  cn_dir          ! Root directory for location of ssr files
-      TYPE(FLD_N) ::   sn_dust, sn_riverdoc, sn_riverdic, sn_ndepo, sn_ironsed        ! informations about the fields to be read
-      NAMELIST/nampissed/cn_dir, sn_dust, sn_riverdic, sn_riverdoc, sn_ndepo, sn_ironsed, &
-        &                ln_dust, ln_river, ln_ndepo, ln_ironsed,         &
-        &                sedfeinput, dustsolub, wdust, nitrfix, diazolight, concfediaz 
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_sed_init')
-      !
-      !                                    ! number of seconds per year and per month
-      ryyss    = nyear_len(1) * rday
-      rmtss    = ryyss / raamo
-      r1_rday  = 1. / rday
-      r1_ryyss = 1. / ryyss
-      !                            !* set file information
-      cn_dir  = './'            ! directory in which the model is executed
-      ! ... default values (NB: frequency positive => hours, negative => months)
-      !                  !   file       ! frequency !  variable   ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   !
-      !                  !   name       !  (hours)  !   name      !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      !
-      sn_dust     = FLD_N( 'dust'       ,    -1     ,  'dust'     ,  .true.    , .true.  ,   'yearly'  , ''       , ''         )
-      sn_riverdic = FLD_N( 'river'      ,   -12     ,  'riverdic' ,  .false.   , .true.  ,   'yearly'  , ''       , ''         )
-      sn_riverdoc = FLD_N( 'river'      ,   -12     ,  'riverdoc' ,  .false.   , .true.  ,   'yearly'  , ''       , ''         )
-      sn_ndepo    = FLD_N( 'ndeposition',   -12     ,  'ndep'     ,  .false.   , .true.  ,   'yearly'  , ''       , ''         )
-      sn_ironsed  = FLD_N( 'ironsed'    ,   -12     ,  'bathy'    ,  .false.   , .true.  ,   'yearly'  , ''       , ''         )
-
-      REWIND( numnatp )                     ! read numnatp
-      READ  ( numnatp, nampissed )
-
-      IF(lwp) THEN
-         WRITE(numout,*) ' '
-         WRITE(numout,*) ' namelist : nampissed '
-         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~ '
-         WRITE(numout,*) '    dust input from the atmosphere           ln_dust     = ', ln_dust
-         WRITE(numout,*) '    river input of nutrients                 ln_river    = ', ln_river
-         WRITE(numout,*) '    atmospheric deposition of n              ln_ndepo    = ', ln_ndepo
-         WRITE(numout,*) '    fe input from sediments                  ln_sedinput = ', ln_ironsed
-         WRITE(numout,*) '    coastal release of iron                  sedfeinput  = ', sedfeinput
-         WRITE(numout,*) '    solubility of the dust                   dustsolub   = ', dustsolub
-         WRITE(numout,*) '    sinking speed of the dust                wdust       = ', wdust
-         WRITE(numout,*) '    nitrogen fixation rate                   nitrfix     = ', nitrfix
-         WRITE(numout,*) '    nitrogen fixation sensitivty to light    diazolight  = ', diazolight
-         WRITE(numout,*) '    fe half-saturation cste for diazotrophs  concfediaz  = ', concfediaz
-       END IF
-
-      IF( ln_dust .OR. ln_river .OR. ln_ndepo ) THEN
-          ll_sbc = .TRUE.
-      ELSE
-          ll_sbc = .FALSE.
-      ENDIF
-
-      ! dust input from the atmosphere
-      ! ------------------------------
-      IF( ln_dust ) THEN 
-         IF(lwp) WRITE(numout,*) '    initialize dust input from atmosphere '
-         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '
-         !
-         ALLOCATE( sf_dust(1), STAT=ierr )           !* allocate and fill sf_sst (forcing structure) with sn_sst
-         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'p4z_sed_init: unable to allocate sf_apr structure' )
-         !
-         CALL fld_fill( sf_dust, (/ sn_dust /), cn_dir, 'p4z_sed_init', 'Iron from sediment ', 'nampissed' )
-                                   ALLOCATE( sf_dust(1)%fnow(jpi,jpj,1)   )
-         IF( sn_dust%ln_tint )     ALLOCATE( sf_dust(1)%fdta(jpi,jpj,1,2) )
-         !
-         ! Get total input dust ; need to compute total atmospheric supply of Si in a year
-         CALL iom_open (  TRIM( sn_dust%clname ) , numdust )
-         CALL iom_gettime( numdust, zsteps, kntime=ntimes_dust)  ! get number of record in file
-         ALLOCATE( zdust(jpi,jpj,ntimes_dust) )
-         DO jm = 1, ntimes_dust
-            CALL iom_get( numdust, jpdom_data, TRIM( sn_dust%clvar ), zdust(:,:,jm), jm )
-         END DO
-         CALL iom_close( numdust )
-         sumdepsi = 0.e0
-         DO jm = 1, ntimes_dust
-            sumdepsi = sumdepsi + glob_sum( zdust(:,:,jm) * e1e2t(:,:) * tmask(:,:,1) ) 
-         ENDDO
-         sumdepsi = sumdepsi * r1_ryyss * 8.8 * 0.075 / 28.1 
-         DEALLOCATE( zdust)
-      ELSE
-         dust(:,:) = 0._wp
-         sumdepsi  = 0._wp
-      END IF
-
-      ! nutrient input from rivers
-      ! --------------------------
-      IF( ln_river ) THEN
-         ALLOCATE( sf_riverdic(1), STAT=ierr1 )           !* allocate and fill sf_sst (forcing structure) with sn_sst
-         ALLOCATE( sf_riverdoc(1), STAT=ierr2 )           !* allocate and fill sf_sst (forcing structure) with sn_sst
-         IF( ierr1 + ierr2 > 0 )   CALL ctl_stop( 'STOP', 'p4z_sed_init: unable to allocate sf_apr structure' )
-         !
-         CALL fld_fill( sf_riverdic, (/ sn_riverdic /), cn_dir, 'p4z_sed_init', 'Input DOC from river ', 'nampissed' )
-         CALL fld_fill( sf_riverdoc, (/ sn_riverdoc /), cn_dir, 'p4z_sed_init', 'Input DOC from river ', 'nampissed' )
-                                   ALLOCATE( sf_riverdic(1)%fnow(jpi,jpj,1)   )
-                                   ALLOCATE( sf_riverdoc(1)%fnow(jpi,jpj,1)   )
-         IF( sn_riverdic%ln_tint ) ALLOCATE( sf_riverdic(1)%fdta(jpi,jpj,1,2) )
-         IF( sn_riverdoc%ln_tint ) ALLOCATE( sf_riverdoc(1)%fdta(jpi,jpj,1,2) )
-         ! Get total input rivers ; need to compute total river supply in a year
-         CALL iom_open ( TRIM( sn_riverdic%clname ), numriv )
-         CALL iom_gettime( numriv, zsteps, kntime=ntimes_riv)
-         ALLOCATE( zriverdic(jpi,jpj,ntimes_riv) )   ;     ALLOCATE( zriverdoc(jpi,jpj,ntimes_riv) )
-         DO jm = 1, ntimes_riv
-            CALL iom_get( numriv, jpdom_data, TRIM( sn_riverdic%clvar ), zriverdic(:,:,jm), jm )
-            CALL iom_get( numriv, jpdom_data, TRIM( sn_riverdoc%clvar ), zriverdoc(:,:,jm), jm )
-         END DO
-         CALL iom_close( numriv )
-         ! N/P and Si releases due to coastal rivers
-         ! -----------------------------------------
-         rivpo4input = 0._wp 
-         rivalkinput = 0._wp 
-         DO jm = 1, ntimes_riv
-            rivpo4input = rivpo4input + glob_sum( ( zriverdic(:,:,jm) + zriverdoc(:,:,jm) ) * tmask(:,:,1) ) 
-            rivalkinput = rivalkinput + glob_sum(   zriverdic(:,:,jm)                       * tmask(:,:,1) ) 
-         END DO
-         rivpo4input = rivpo4input * 1E9 / 31.6_wp
-         rivalkinput = rivalkinput * 1E9 / 12._wp 
-         DEALLOCATE( zriverdic)   ;    DEALLOCATE( zriverdoc) 
-      ELSE
-         rivinp(:,:) = 0._wp
-         cotdep(:,:) = 0._wp
-         rivpo4input = 0._wp
-         rivalkinput = 0._wp
-      END IF 
-
-      ! nutrient input from dust
-      ! ------------------------
-      IF( ln_ndepo ) THEN
-         IF(lwp) WRITE(numout,*) '    initialize the nutrient input by dust from ndeposition.orca.nc'
-         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
-         ALLOCATE( sf_ndepo(1), STAT=ierr3 )           !* allocate and fill sf_sst (forcing structure) with sn_sst
-         IF( ierr3 > 0 )   CALL ctl_stop( 'STOP', 'p4z_sed_init: unable to allocate sf_apr structure' )
-         !
-         CALL fld_fill( sf_ndepo, (/ sn_ndepo /), cn_dir, 'p4z_sed_init', 'Iron from sediment ', 'nampissed' )
-                                   ALLOCATE( sf_ndepo(1)%fnow(jpi,jpj,1)   )
-         IF( sn_ndepo%ln_tint )    ALLOCATE( sf_ndepo(1)%fdta(jpi,jpj,1,2) )
-         !
-         ! Get total input dust ; need to compute total atmospheric supply of N in a year
-         CALL iom_open ( TRIM( sn_ndepo%clname ), numdepo )
-         CALL iom_gettime( numdepo, zsteps, kntime=ntimes_ndep)
-         ALLOCATE( zndepo(jpi,jpj,ntimes_ndep) )
-         DO jm = 1, ntimes_ndep
-            CALL iom_get( numdepo, jpdom_data, TRIM( sn_ndepo%clvar ), zndepo(:,:,jm), jm )
-         END DO
-         CALL iom_close( numdepo )
-         nitdepinput = 0._wp
-         DO jm = 1, ntimes_ndep
-           nitdepinput = nitdepinput + glob_sum( zndepo(:,:,jm) * e1e2t(:,:) * tmask(:,:,1) ) 
-         ENDDO
-         nitdepinput = nitdepinput * 7.6 / 14E6 
-         DEALLOCATE( zndepo)
-      ELSE
-         nitdep(:,:) = 0._wp
-         nitdepinput = 0._wp
-      ENDIF
-
-      ! coastal and island masks
-      ! ------------------------
-      IF( ln_ironsed ) THEN     
-         IF(lwp) WRITE(numout,*) '    computation of an island mask to enhance coastal supply of iron'
-         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
-         CALL iom_open ( TRIM( sn_ironsed%clname ), numiron )
-         ALLOCATE( zcmask(jpi,jpj,jpk) )
-         CALL iom_get  ( numiron, jpdom_data, TRIM( sn_ironsed%clvar ), zcmask(:,:,:), 1 )
-         CALL iom_close( numiron )
-         !
-         DO jk = 1, 5
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1
-                  IF( tmask(ji,jj,jk) /= 0. ) THEN
-                     zmaskt = tmask(ji+1,jj,jk) * tmask(ji-1,jj,jk) * tmask(ji,jj+1,jk)    &
-                        &                       * tmask(ji,jj-1,jk) * tmask(ji,jj,jk+1)
-                     IF( zmaskt == 0. )   zcmask(ji,jj,jk ) = MAX( 0.1, zcmask(ji,jj,jk) ) 
-                  END IF
-               END DO
-            END DO
-         END DO
-         CALL lbc_lnk( zcmask , 'T', 1. )      ! lateral boundary conditions on cmask   (sign unchanged)
-         DO jk = 1, jpk
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  zexpide   = MIN( 8.,( fsdept(ji,jj,jk) / 500. )**(-1.5) )
-                  zdenitide = -0.9543 + 0.7662 * LOG( zexpide ) - 0.235 * LOG( zexpide )**2
-                  zcmask(ji,jj,jk) = zcmask(ji,jj,jk) * MIN( 1., EXP( zdenitide ) / 0.5 )
-               END DO
-            END DO
-         END DO
-         ! Coastal supply of iron
-         ! -------------------------
-         ironsed(:,:,jpk) = 0._wp
-         DO jk = 1, jpkm1
-            ironsed(:,:,jk) = sedfeinput * zcmask(:,:,jk) / ( fse3t(:,:,jk) * rday )
-         END DO
-         DEALLOCATE( zcmask)
-      ELSE
-         ironsed(:,:,:) = 0._wp
-      ENDIF
-      !
-      IF( ll_sbc ) CALL p4z_sbc( nit000 ) 
-      !
-      IF(lwp) THEN 
-         WRITE(numout,*)
-         WRITE(numout,*) '    Total input of elements from river supply'
-         WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
-         WRITE(numout,*) '    N Supply   : ', rivpo4input/7.6*1E3/1E12*14.,' TgN/yr'
-         WRITE(numout,*) '    Si Supply  : ', rivalkinput/6.*1E3/1E12*32.,' TgSi/yr'
-         WRITE(numout,*) '    Alk Supply : ', rivalkinput*1E3/1E12,' Teq/yr'
-         WRITE(numout,*) '    DIC Supply : ', rivpo4input*2.631*1E3*12./1E12,'TgC/yr'
-         WRITE(numout,*) 
-         WRITE(numout,*) '    Total input of elements from atmospheric supply'
-         WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
-         WRITE(numout,*) '    N Supply   : ', nitdepinput/7.6*1E3/1E12*14.,' TgN/yr'
-         WRITE(numout,*) 
-      ENDIF
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_sed_init')
-      !
-   END SUBROUTINE p4z_sed_init
-
-   INTEGER FUNCTION p4z_sed_alloc()
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_sed_alloc  ***
-      !!----------------------------------------------------------------------
-
-      ALLOCATE( dust  (jpi,jpj), rivinp(jpi,jpj)     , cotdep(jpi,jpj),      &
-        &       nitdep(jpi,jpj), ironsed(jpi,jpj,jpk), STAT=p4z_sed_alloc )  
-
-      IF( p4z_sed_alloc /= 0 ) CALL ctl_warn('p4z_sed_alloc : failed to allocate arrays.')
-
-   END FUNCTION p4z_sed_alloc
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_sed                         ! Empty routine
-   END SUBROUTINE p4z_sed
-#endif 
-
-   !!======================================================================
-END MODULE  p4zsed
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/par_pisces.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/par_pisces.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/par_pisces.F90	(revision 3680)
@@ -10,21 +10,36 @@
    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
-   USE par_lobster, ONLY : jp_lobster      !: number of tracers in LOBSTER
-   USE par_lobster, ONLY : jp_lobster_2d   !: number of 2D diag in LOBSTER
-   USE par_lobster, ONLY : jp_lobster_3d   !: number of 3D diag in LOBSTER
-   USE par_lobster, ONLY : jp_lobster_trd  !: number of biological diag in LOBSTER
 
    IMPLICIT NONE
 
-   INTEGER, PUBLIC, PARAMETER ::   jp_lp      = jp_lobster      !: cumulative number of already defined TRC
-   INTEGER, PUBLIC, PARAMETER ::   jp_lp_2d   = jp_lobster_2d   !:
-   INTEGER, PUBLIC, PARAMETER ::   jp_lp_3d   = jp_lobster_3d   !:
-   INTEGER, PUBLIC, PARAMETER ::   jp_lp_trd  = jp_lobster_trd  !:
+#if defined key_pisces_reduced
+   !!---------------------------------------------------------------------
+   !!   'key_pisces_reduced'   :                                LOBSTER bio-model
+   !!---------------------------------------------------------------------
+   LOGICAL, PUBLIC, PARAMETER ::   lk_pisces     = .TRUE.  !: PISCES flag 
+   LOGICAL, PUBLIC, PARAMETER ::   lk_p4z        = .FALSE. !: p4z flag 
+   INTEGER, PUBLIC, PARAMETER ::   jp_pisces     =  6      !: number of passive tracers
+   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_2d  =  19     !: additional 2d output 
+   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_3d  =   3     !: additional 3d output 
+   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_trd =   17    !: number of sms trends for PISCES
 
-#if defined key_pisces  &&  defined key_kriest
+   ! assign an index in trc arrays for each LOBSTER prognostic variables
+   INTEGER, PUBLIC, PARAMETER ::   jpdet     =  1        !: detritus                    [mmoleN/m3]
+   INTEGER, PUBLIC, PARAMETER ::   jpzoo     =  2        !: zooplancton concentration   [mmoleN/m3]
+   INTEGER, PUBLIC, PARAMETER ::   jpphy     =  3        !: phytoplancton concentration [mmoleN/m3]
+   INTEGER, PUBLIC, PARAMETER ::   jpno3     =  4        !: nitrate concentration       [mmoleN/m3]
+   INTEGER, PUBLIC, PARAMETER ::   jpnh4     =  5        !: ammonium concentration      [mmoleN/m3]
+   INTEGER, PUBLIC, PARAMETER ::   jpdom     =  6        !: dissolved organic matter    [mmoleN/m3]
+
+   ! productive layer depth
+   INTEGER, PUBLIC, PARAMETER ::   jpkb      = 12        !: first vertical layers where biology is active
+   INTEGER, PUBLIC, PARAMETER ::   jpkbm1    = jpkb - 1  !: first vertical layers where biology is active
+
+#elif defined key_pisces  &&  defined key_kriest
    !!---------------------------------------------------------------------
    !!   'key_pisces' & 'key_kriest'                 PISCES bio-model + ???
    !!---------------------------------------------------------------------
    LOGICAL, PUBLIC, PARAMETER ::   lk_pisces     = .TRUE.  !: PISCES flag 
+   LOGICAL, PUBLIC, PARAMETER ::   lk_p4z        = .TRUE. !: p4z flag 
    LOGICAL, PUBLIC, PARAMETER ::   lk_kriest     = .TRUE.  !: Kriest flag 
    INTEGER, PUBLIC, PARAMETER ::   jp_pisces     =  23     !: number of passive tracers
@@ -36,27 +51,27 @@
    !    WARNING: be carefull about the order when reading the restart
         !   !!gm  this warning should be obsolet with IOM
-   INTEGER, PUBLIC, PARAMETER ::   jpdic = jp_lp +  1    !: dissolved inoganic carbon concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jptal = jp_lp +  2    !: total alkalinity 
-   INTEGER, PUBLIC, PARAMETER ::   jpoxy = jp_lp +  3    !: oxygen carbon concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jpcal = jp_lp +  4    !: calcite  concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jppo4 = jp_lp +  5    !: phosphate concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jppoc = jp_lp +  6    !: small particulate organic phosphate concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpsil = jp_lp +  7    !: silicate concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpphy = jp_lp +  8    !: phytoplancton concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jpzoo = jp_lp +  9    !: zooplancton concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpdoc = jp_lp + 10    !: dissolved organic carbon concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jpdia = jp_lp + 11    !: Diatoms Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpmes = jp_lp + 12    !: Mesozooplankton Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpdsi = jp_lp + 13    !: (big) Silicate Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpfer = jp_lp + 14    !: Iron Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpnum = jp_lp + 15    !: Big iron particles Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpsfe = jp_lp + 16    !: number of particulate organic phosphate concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpdfe = jp_lp + 17    !: Diatoms iron Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpgsi = jp_lp + 18    !: Diatoms Silicate Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpnfe = jp_lp + 19    !: Nano iron Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpnch = jp_lp + 20    !: Nano Chlorophyll Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpdch = jp_lp + 21    !: Diatoms Chlorophyll Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpno3 = jp_lp + 22    !: Nitrates Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpnh4 = jp_lp + 23    !: Ammonium Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpdic =  1    !: dissolved inoganic carbon concentration 
+   INTEGER, PUBLIC, PARAMETER ::   jptal =  2    !: total alkalinity 
+   INTEGER, PUBLIC, PARAMETER ::   jpoxy =  3    !: oxygen carbon concentration 
+   INTEGER, PUBLIC, PARAMETER ::   jpcal =  4    !: calcite  concentration 
+   INTEGER, PUBLIC, PARAMETER ::   jppo4 =  5    !: phosphate concentration 
+   INTEGER, PUBLIC, PARAMETER ::   jppoc =  6    !: small particulate organic phosphate concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpsil =  7    !: silicate concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpphy =  8    !: phytoplancton concentration 
+   INTEGER, PUBLIC, PARAMETER ::   jpzoo =  9    !: zooplancton concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpdoc = 10    !: dissolved organic carbon concentration 
+   INTEGER, PUBLIC, PARAMETER ::   jpdia = 11    !: Diatoms Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpmes = 12    !: Mesozooplankton Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpdsi = 13    !: (big) Silicate Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpfer = 14    !: Iron Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpnum = 15    !: Big iron particles Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpsfe = 16    !: number of particulate organic phosphate concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpdfe = 17    !: Diatoms iron Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpgsi = 18    !: Diatoms Silicate Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpnfe = 19    !: Nano iron Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpnch = 20    !: Nano Chlorophyll Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpdch = 21    !: Diatoms Chlorophyll Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpno3 = 22    !: Nitrates Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpnh4 = 23    !: Ammonium Concentration
 
 #elif defined key_pisces
@@ -65,4 +80,5 @@
    !!---------------------------------------------------------------------
    LOGICAL, PUBLIC, PARAMETER ::   lk_pisces     = .TRUE.  !: PISCES flag 
+   LOGICAL, PUBLIC, PARAMETER ::   lk_p4z        = .TRUE.  !: p4z flag 
    LOGICAL, PUBLIC, PARAMETER ::   lk_kriest     = .FALSE. !: Kriest flag 
    INTEGER, PUBLIC, PARAMETER ::   jp_pisces     = 24      !: number of PISCES passive tracers
@@ -74,28 +90,28 @@
    !    WARNING: be carefull about the order when reading the restart
         !   !!gm  this warning should be obsolet with IOM
-   INTEGER, PUBLIC, PARAMETER ::   jpdic = jp_lp +  1    !: dissolved inoganic carbon concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jptal = jp_lp +  2    !: total alkalinity 
-   INTEGER, PUBLIC, PARAMETER ::   jpoxy = jp_lp +  3    !: oxygen carbon concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jpcal = jp_lp +  4    !: calcite  concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jppo4 = jp_lp +  5    !: phosphate concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jppoc = jp_lp +  6    !: small particulate organic phosphate concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpsil = jp_lp +  7    !: silicate concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpphy = jp_lp +  8    !: phytoplancton concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jpzoo = jp_lp +  9    !: zooplancton concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpdoc = jp_lp + 10    !: dissolved organic carbon concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jpdia = jp_lp + 11    !: Diatoms Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpmes = jp_lp + 12    !: Mesozooplankton Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpdsi = jp_lp + 13    !: (big) Silicate Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpfer = jp_lp + 14    !: Iron Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpbfe = jp_lp + 15    !: Big iron particles Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpgoc = jp_lp + 16    !: big particulate organic phosphate concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpsfe = jp_lp + 17    !: Small iron particles Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpdfe = jp_lp + 18    !: Diatoms iron Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpgsi = jp_lp + 19    !: Diatoms Silicate Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpnfe = jp_lp + 20    !: Nano iron Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpnch = jp_lp + 21    !: Nano Chlorophyll Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpdch = jp_lp + 22    !: Diatoms Chlorophyll Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpno3 = jp_lp + 23    !: Nitrates Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpnh4 = jp_lp + 24    !: Ammonium Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpdic =  1    !: dissolved inoganic carbon concentration 
+   INTEGER, PUBLIC, PARAMETER ::   jptal =  2    !: total alkalinity 
+   INTEGER, PUBLIC, PARAMETER ::   jpoxy =  3    !: oxygen carbon concentration 
+   INTEGER, PUBLIC, PARAMETER ::   jpcal =  4    !: calcite  concentration 
+   INTEGER, PUBLIC, PARAMETER ::   jppo4 =  5    !: phosphate concentration 
+   INTEGER, PUBLIC, PARAMETER ::   jppoc =  6    !: small particulate organic phosphate concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpsil =  7    !: silicate concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpphy =  8    !: phytoplancton concentration 
+   INTEGER, PUBLIC, PARAMETER ::   jpzoo =  9    !: zooplancton concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpdoc = 10    !: dissolved organic carbon concentration 
+   INTEGER, PUBLIC, PARAMETER ::   jpdia = 11    !: Diatoms Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpmes = 12    !: Mesozooplankton Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpdsi = 13    !: (big) Silicate Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpfer = 14    !: Iron Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpbfe = 15    !: Big iron particles Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpgoc = 16    !: big particulate organic phosphate concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpsfe = 17    !: Small iron particles Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpdfe = 18    !: Diatoms iron Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpgsi = 19    !: Diatoms Silicate Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpnfe = 20    !: Nano iron Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpnch = 21    !: Nano Chlorophyll Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpdch = 22    !: Diatoms Chlorophyll Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpno3 = 23    !: Nitrates Concentration
+   INTEGER, PUBLIC, PARAMETER ::   jpnh4 = 24    !: Ammonium Concentration
 
 #else
@@ -103,6 +119,6 @@
    !!   Default                                   No CFC geochemical model
    !!---------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_pisces     = .FALSE.  !: CFC flag 
-   LOGICAL, PUBLIC, PARAMETER ::   lk_kriest     = .FALSE.  !: Kriest flag 
+   LOGICAL, PUBLIC, PARAMETER ::   lk_pisces     = .FALSE.  !: PISCES flag 
+   LOGICAL, PUBLIC, PARAMETER ::   lk_p4z        = .FALSE.  !: p4z flag 
    INTEGER, PUBLIC, PARAMETER ::   jp_pisces     =  0       !: No CFC tracers
    INTEGER, PUBLIC, PARAMETER ::   jp_pisces_2d  =  0       !: No CFC additional 2d output arrays 
@@ -112,12 +128,12 @@
 
    ! Starting/ending PISCES do-loop indices (N.B. no PISCES : jpl_pcs < jpf_pcs the do-loop are never done)
-   INTEGER, PUBLIC, PARAMETER ::   jp_pcs0     = jp_lp + 1                  !: First index of PISCES tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_pcs1     = jp_lp + jp_pisces          !: Last  index of PISCES tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_pcs0_2d  = jp_lp_2d + 1               !: First index of 2D diag
-   INTEGER, PUBLIC, PARAMETER ::   jp_pcs1_2d  = jp_lp_2d + jp_pisces_2d    !: Last  index of 2D diag
-   INTEGER, PUBLIC, PARAMETER ::   jp_pcs0_3d  = jp_lp_3d + 1               !: First index of 3D diag
-   INTEGER, PUBLIC, PARAMETER ::   jp_pcs1_3d  = jp_lp_3d + jp_pisces_3d    !: Last  index of 3d diag
-   INTEGER, PUBLIC, PARAMETER ::   jp_pcs0_trd = jp_lp_trd + 1              !: First index of bio diag
-   INTEGER, PUBLIC, PARAMETER ::   jp_pcs1_trd = jp_lp_trd + jp_pisces_trd  !: Last  index of bio diag
+   INTEGER, PUBLIC, PARAMETER ::   jp_pcs0     = 1                  !: First index of PISCES tracers
+   INTEGER, PUBLIC, PARAMETER ::   jp_pcs1     = jp_pisces          !: Last  index of PISCES tracers
+   INTEGER, PUBLIC, PARAMETER ::   jp_pcs0_2d  = 1               !: First index of 2D diag
+   INTEGER, PUBLIC, PARAMETER ::   jp_pcs1_2d  = jp_pisces_2d    !: Last  index of 2D diag
+   INTEGER, PUBLIC, PARAMETER ::   jp_pcs0_3d  = 1               !: First index of 3D diag
+   INTEGER, PUBLIC, PARAMETER ::   jp_pcs1_3d  = jp_pisces_3d    !: Last  index of 3d diag
+   INTEGER, PUBLIC, PARAMETER ::   jp_pcs0_trd = 1              !: First index of bio diag
+   INTEGER, PUBLIC, PARAMETER ::   jp_pcs1_trd = jp_pisces_trd  !: Last  index of bio diag
 
 
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/sms_pisces.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/sms_pisces.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/sms_pisces.F90	(revision 3680)
@@ -7,5 +7,5 @@
    !!             3.2  !  2009-04 (C. Ethe & NEMO team) style
    !!----------------------------------------------------------------------
-#if defined key_pisces
+#if defined key_pisces || defined key_pisces_reduced 
    !!----------------------------------------------------------------------
    !!   'key_pisces'                                         PISCES model
@@ -19,4 +19,13 @@
    INTEGER ::   numnatp
 
+   !!*  Biological fluxes for light : variables shared by pisces & lobster
+   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  neln  !: number of T-levels + 1 in the euphotic layer
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  heup  !: euphotic layer depth
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  etot  !: par (photosynthetic available radiation)
+   !
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  xksi  !:  LOBSTER : zooplakton closure
+   !                                                       !:  PISCES  : silicon dependant half saturation
+
+#if defined key_pisces 
    !!*  Time variables
    INTEGER  ::   nrdttrc           !: ???
@@ -27,4 +36,5 @@
 
    !!*  Biological parameters 
+   INTEGER  ::   niter1max, niter2max   !: Maximum number of iterations for sinking
    REAL(wp) ::   rno3              !: ???
    REAL(wp) ::   o2ut              !: ???
@@ -37,16 +47,19 @@
    REAL(wp) ::   ferat3            !: ???
 
-   !!* Damping 
-   LOGICAL  ::   ln_pisdmp         !: relaxation or not of nutrients to a mean value
-   INTEGER  ::   nn_pisdmp         !: frequency of relaxation or not of nutrients to a mean value
-   LOGICAL  ::   ln_pisclo         !: Restoring or not of nutrients to initial value
-                                   !: on close seas
+   !!*  diagnostic parameters 
+   REAL(wp) ::  tpp                !: total primary production
+   REAL(wp) ::  t_oce_co2_exp      !: total carbon export
+   REAL(wp) ::  t_oce_co2_flx      !: Total ocean carbon flux
+   REAL(wp) ::  t_atm_co2_flx      !: global mean of atmospheric pco2
 
-   !!*  Biological fluxes for light
-   INTEGER , ALLOCATABLE, SAVE,   DIMENSION(:,:)  ::  neln       !: number of T-levels + 1 in the euphotic layer
-   REAL(wp), ALLOCATABLE, SAVE,   DIMENSION(:,:)  ::  heup       !: euphotic layer depth
+   !!* restoring
+   LOGICAL  ::  ln_pisdmp          !: restoring or not of nutrients to a mean value
+   INTEGER  ::  nn_pisdmp          !: frequency of relaxation or not of nutrients to a mean value
+   LOGICAL  ::  ln_pisclo          !: Restoring or not of nutrients to initial value on closed seas
+
+   !!* Mass conservation
+   LOGICAL  ::  ln_check_mass      !: Flag to check mass conservation
 
    !!*  Biological fluxes for primary production
-   REAL(wp), ALLOCATABLE, SAVE,   DIMENSION(:,:)  ::   xksi       !: ???
    REAL(wp), ALLOCATABLE, SAVE,   DIMENSION(:,:)  ::   xksimax    !: ???
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xnanono3   !: ???
@@ -61,4 +74,5 @@
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimdfe    !: ???
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimsi     !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   biron      !: bioavailable fraction of iron
 
 
@@ -67,7 +81,7 @@
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   nitrfac    !: ??
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xlimbac    !: ??
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xlimbacl   !: ??
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xdiss      !: ??
-    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   prodcal    !: Calcite production
-    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   grazing    !: Total zooplankton grazing
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   prodcal    !: Calcite production
 
    !!* Variable for chemistry of the CO2 cycle
@@ -96,4 +110,5 @@
 #endif
 
+#endif
    !!----------------------------------------------------------------------
    !! NEMO/TOP 3.3 , NEMO Consortium (2010)
@@ -111,9 +126,10 @@
       !!----------------------------------------------------------------------
       ierr(:) = 0
-      !*  Biological fluxes for light
-      ALLOCATE( neln(jpi,jpj), heup(jpi,jpj),                   STAT=ierr(1) )
+      !*  Biological fluxes for light : shared variables for pisces & lobster
+      ALLOCATE( etot(jpi,jpj,jpk), neln(jpi,jpj), heup(jpi,jpj), xksi(jpi,jpj), STAT=ierr(1) )
       !
+#if defined key_pisces
       !*  Biological fluxes for primary production
-      ALLOCATE( xksimax(jpi,jpj)     , xksi(jpi,jpj)        ,       &
+      ALLOCATE( xksimax(jpi,jpj)     , biron   (jpi,jpj,jpk),       &
          &      xnanono3(jpi,jpj,jpk), xdiatno3(jpi,jpj,jpk),       &
          &      xnanonh4(jpi,jpj,jpk), xdiatnh4(jpi,jpj,jpk),       &
@@ -121,22 +137,23 @@
          &      xlimnfe (jpi,jpj,jpk), xlimdfe (jpi,jpj,jpk),       &
          &      xlimsi  (jpi,jpj,jpk), concdfe (jpi,jpj,jpk),       &
-         &      concnfe (jpi,jpj,jpk),                          STAT=ierr(2) ) 
+         &      concnfe (jpi,jpj,jpk),                           STAT=ierr(2) ) 
          !
       !*  SMS for the organic matter
       ALLOCATE( xfracal (jpi,jpj,jpk), nitrfac(jpi,jpj,jpk),       &
-         &      prodcal(jpi,jpj,jpk) , grazing(jpi,jpj,jpk),       &
-         &      xlimbac (jpi,jpj,jpk), xdiss  (jpi,jpj,jpk),   STAT=ierr(3) )  
-         !
+         &      xlimbac (jpi,jpj,jpk), xdiss  (jpi,jpj,jpk),       & 
+         &      xlimbacl(jpi,jpj,jpk), prodcal(jpi,jpj,jpk),     STAT=ierr(3) )
+
       !* Variable for chemistry of the CO2 cycle
       ALLOCATE( akb3(jpi,jpj,jpk)    , ak13  (jpi,jpj,jpk) ,       &
          &      ak23(jpi,jpj,jpk)    , aksp  (jpi,jpj,jpk) ,       &
          &      akw3(jpi,jpj,jpk)    , borat (jpi,jpj,jpk) ,       &
-         &      hi  (jpi,jpj,jpk)    , excess(jpi,jpj,jpk) ,   STAT=ierr(4) )
+         &      hi  (jpi,jpj,jpk)    , excess(jpi,jpj,jpk) ,     STAT=ierr(4) )
          !
       !* Temperature dependancy of SMS terms
-      ALLOCATE( tgfunc(jpi,jpj,jpk)  , tgfunc2(jpi,jpj,jpk) ,   STAT=ierr(5) )
+      ALLOCATE( tgfunc(jpi,jpj,jpk)  , tgfunc2(jpi,jpj,jpk) ,    STAT=ierr(5) )
          !
       !* Array used to indicate negative tracer values  
-      ALLOCATE( xnegtr(jpi,jpj,jpk)  ,                          STAT=ierr(6) )
+      ALLOCATE( xnegtr(jpi,jpj,jpk)  ,                           STAT=ierr(6) )
+#endif
       !
       sms_pisces_alloc = MAXVAL( ierr )
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/trcini_pisces.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/trcini_pisces.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/trcini_pisces.F90	(revision 3680)
@@ -9,6 +9,7 @@
    !!             1.0  !  2005-03  (O. Aumont, A. El Moussaoui) F90
    !!             2.0  !  2007-12  (C. Ethe, G. Madec) from trcini.pisces.h90
-   !!----------------------------------------------------------------------
-#if defined key_pisces
+   !!             3.5  !  2012-05  (C. Ethe) Merge PISCES-LOBSTER
+   !!----------------------------------------------------------------------
+#if defined key_pisces || defined key_pisces_reduced
    !!----------------------------------------------------------------------
    !!   'key_pisces'                                       PISCES bio-model
@@ -20,17 +21,4 @@
    USE trc             !  passive tracers common variables 
    USE sms_pisces      !  PISCES Source Minus Sink variables
-   USE p4zche          !  Chemical model
-   USE p4zsink         !  vertical flux of particulate matter due to sinking
-   USE p4zopt          !  optical model
-   USE p4zrem          !  Remineralisation of organic matter
-   USE p4zflx          !  Gas exchange
-   USE p4zsed          !  Sedimentation
-   USE p4zlim          !  Co-limitations of differents nutrients
-   USE p4zprod         !  Growth rate of the 2 phyto groups
-   USE p4zmicro        !  Sources and sinks of microzooplankton
-   USE p4zmeso         !  Sources and sinks of mesozooplankton
-   USE p4zmort         !  Mortality terms for phytoplankton
-   USE p4zlys          !  Calcite saturation
-   USE p4zsed          !  Sedimentation
 
    IMPLICIT NONE
@@ -39,11 +27,4 @@
    PUBLIC   trc_ini_pisces   ! called by trcini.F90 module
 
-   REAL(wp) :: sco2   =  2.312e-3_wp
-   REAL(wp) :: alka0  =  2.423e-3_wp
-   REAL(wp) :: oxyg0  =  177.6e-6_wp 
-   REAL(wp) :: po4    =  2.174e-6_wp 
-   REAL(wp) :: bioma0 =  1.000e-8_wp  
-   REAL(wp) :: silic1 =  91.65e-6_wp  
-   REAL(wp) :: no3    =  31.04e-6_wp * 7.625_wp
 
 #  include "top_substitute.h90"
@@ -61,15 +42,65 @@
       !! ** Purpose :   Initialisation of the PISCES biochemical model
       !!----------------------------------------------------------------------
-      !
-      INTEGER  ::  ji, jj, jk
+
+      IF( lk_pisces ) THEN  ;   CALL p4z_ini   !  PISCES
+      ELSE                  ;   CALL p2z_ini   !  LOBSTER
+      ENDIF
+
+   END SUBROUTINE trc_ini_pisces
+
+   SUBROUTINE p4z_ini
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE p4z_ini ***
+      !!
+      !! ** Purpose :   Initialisation of the PISCES biochemical model
+      !!----------------------------------------------------------------------
+#if defined key_pisces 
+      !
+      USE p4zsms          ! Main P4Z routine
+      USE p4zche          !  Chemical model
+      USE p4zsink         !  vertical flux of particulate matter due to sinking
+      USE p4zopt          !  optical model
+      USE p4zsbc          !  Boundary conditions
+      USE p4zfechem       !  Iron chemistry
+      USE p4zrem          !  Remineralisation of organic matter
+      USE p4zflx          !  Gas exchange
+      USE p4zlim          !  Co-limitations of differents nutrients
+      USE p4zprod         !  Growth rate of the 2 phyto groups
+      USE p4zmicro        !  Sources and sinks of microzooplankton
+      USE p4zmeso         !  Sources and sinks of mesozooplankton
+      USE p4zmort         !  Mortality terms for phytoplankton
+      USE p4zlys          !  Calcite saturation
+      !
+      REAL(wp), SAVE :: sco2   =  2.312e-3_wp
+      REAL(wp), SAVE :: alka0  =  2.423e-3_wp
+      REAL(wp), SAVE :: oxyg0  =  177.6e-6_wp 
+      REAL(wp), SAVE :: po4    =  2.174e-6_wp 
+      REAL(wp), SAVE :: bioma0 =  1.000e-8_wp  
+      REAL(wp), SAVE :: silic1 =  91.65e-6_wp  
+      REAL(wp), SAVE :: no3    =  31.04e-6_wp * 7.625_wp
+      !
+      INTEGER  ::  ji, jj, jk, ierr
       REAL(wp) ::  zcaralk, zbicarb, zco3
       REAL(wp) ::  ztmas, ztmas1
       !!----------------------------------------------------------------------
+
       IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) ' trc_ini_pisces :   PISCES biochemical model initialisation'
+      IF(lwp) WRITE(numout,*) ' p4z_ini :   PISCES biochemical model initialisation'
       IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
 
-      CALL pisces_alloc()                          ! Allocate PISCES arrays
-
+                                                 ! Allocate PISCES arrays
+      ierr =         sms_pisces_alloc()          
+      ierr = ierr +  p4z_che_alloc()
+      ierr = ierr +  p4z_sink_alloc()
+      ierr = ierr +  p4z_opt_alloc()
+      ierr = ierr +  p4z_prod_alloc()
+      ierr = ierr +  p4z_rem_alloc()
+      ierr = ierr +  p4z_flx_alloc()
+      !
+      IF( lk_mpp    )   CALL mpp_sum( ierr )
+      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'pisces_alloc: unable to allocate PISCES arrays' )
+      !
+
+      CALL p4z_sms_init       !  Maint routine
       !                                            ! Time-step
       rfact   = rdttrc(1)                          ! ---------
@@ -132,7 +163,4 @@
          xksimax(:,:) = xksi(:,:)
 
-      ENDIF
-
-      IF( .NOT. ln_rsttr ) THEN
          ! Initialization of chemical variables of the carbon cycle
          ! --------------------------------------------------------
@@ -159,9 +187,10 @@
       CALL p4z_lim_init       !  co-limitations by the various nutrients
       CALL p4z_prod_init      !  phytoplankton growth rate over the global ocean.
+      CALL p4z_sbc_init       !  boundary conditions
+      CALL p4z_fechem_init    !  Iron chemistry
       CALL p4z_rem_init       !  remineralisation
       CALL p4z_mort_init      !  phytoplankton mortality 
       CALL p4z_micro_init     !  microzooplankton
       CALL p4z_meso_init      !  mesozooplankton
-      CALL p4z_sed_init       !  sedimentation 
       CALL p4z_lys_init       !  calcite saturation
       CALL p4z_flx_init       !  gas exchange 
@@ -172,32 +201,58 @@
       IF(lwp) WRITE(numout,*) 'Initialization of PISCES tracers done'
       IF(lwp) WRITE(numout,*) 
-      !
-   END SUBROUTINE trc_ini_pisces
-
-
-   SUBROUTINE pisces_alloc
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE pisces_alloc  ***
+#endif
+      !
+   END SUBROUTINE p4z_ini
+
+   SUBROUTINE p2z_ini
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE p2z_ini ***
       !!
-      !! ** Purpose :   Allocate all the dynamic arrays of PISCES 
-      !!----------------------------------------------------------------------
-      !
-      INTEGER :: ierr
-      !!----------------------------------------------------------------------
-      !
-      ierr =         sms_pisces_alloc()          ! Start of PISCES-related alloc routines...
-      ierr = ierr +  p4z_che_alloc()
-      ierr = ierr +  p4z_sink_alloc()
-      ierr = ierr +  p4z_opt_alloc()
-      ierr = ierr +  p4z_prod_alloc()
-      ierr = ierr +  p4z_rem_alloc()
-      ierr = ierr +  p4z_sed_alloc()
-      ierr = ierr +  p4z_flx_alloc()
+      !! ** Purpose :   Initialisation of the LOBSTER biochemical model
+      !!----------------------------------------------------------------------
+#if defined key_pisces_reduced 
+      !
+      USE p2zopt
+      USE p2zexp
+      USE p2zbio
+      USE p2zsed
+      !
+      INTEGER  ::  ji, jj, jk, ierr
+      !!----------------------------------------------------------------------
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) ' p2z_ini :   LOBSTER biochemical model initialisation'
+      IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
+
+      ierr =        sms_pisces_alloc()          
+      ierr = ierr + p2z_exp_alloc()
       !
       IF( lk_mpp    )   CALL mpp_sum( ierr )
-      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'pisces_alloc: unable to allocate PISCES arrays' )
-      !
-   END SUBROUTINE pisces_alloc
-
+      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'p2z_ini: unable to allocate LOBSTER arrays' )
+
+      ! LOBSTER initialisation for GYRE : init NO3=f(density) by asklod AS Kremeur 2005-07
+      ! ----------------------
+      IF( .NOT. ln_rsttr ) THEN             ! in case of  no restart 
+         trn(:,:,:,jpdet) = 0.1 * tmask(:,:,:)
+         trn(:,:,:,jpzoo) = 0.1 * tmask(:,:,:)
+         trn(:,:,:,jpnh4) = 0.1 * tmask(:,:,:)
+         trn(:,:,:,jpphy) = 0.1 * tmask(:,:,:)
+         trn(:,:,:,jpdom) = 1.0 * tmask(:,:,:)
+         WHERE( rhd(:,:,:) <= 24.5e-3 )  ;  trn(:,:,:,jpno3 ) = 2._wp * tmask(:,:,:)
+         ELSE WHERE                      ;  trn(:,:,:,jpno3) = ( 15.55 * ( rhd(:,:,:) * 1000. ) - 380.11 ) * tmask(:,:,:)
+         END WHERE                       
+      ENDIF
+      !                       !  Namelist read
+      CALL p2z_opt_init       !  Optics parameters
+      CALL p2z_sed_init       !  sedimentation
+      CALL p2z_bio_init       !  biology
+      CALL p2z_exp_init       !  export 
+      !
+      IF(lwp) WRITE(numout,*) 
+      IF(lwp) WRITE(numout,*) 'Initialization of LOBSTER tracers done'
+      IF(lwp) WRITE(numout,*) 
+#endif
+      !
+   END SUBROUTINE p2z_ini
 #else
    !!----------------------------------------------------------------------
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/trcnam_pisces.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/trcnam_pisces.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/trcnam_pisces.F90	(revision 3680)
@@ -1,5 +1,5 @@
 MODULE trcnam_pisces
    !!======================================================================
-   !!                      ***  MODULE trcnam_lobster  ***
+   !!                      ***  MODULE trcnam_pisces  ***
    !! TOP :   initialisation of some run parameters for PISCES bio-model
    !!======================================================================
@@ -9,5 +9,5 @@
    !!             2.0  !  2007-12  (C. Ethe, G. Madec) from trcnam.pisces.h90
    !!----------------------------------------------------------------------
-#if defined key_pisces
+#if defined key_pisces || defined key_pisces_reduced
    !!----------------------------------------------------------------------
    !!   'key_pisces'   :                                   PISCES bio-model
@@ -19,4 +19,5 @@
    USE trc             ! TOP variables
    USE sms_pisces      ! sms trends
+   USE trdmod_trc_oce
    USE iom             ! I/O manager
 
@@ -48,64 +49,26 @@
       !!
       INTEGER :: jl, jn
-      TYPE(DIAG), DIMENSION(jp_pisces_2d) :: pisdia2d
-      TYPE(DIAG), DIMENSION(jp_pisces_3d) :: pisdia3d
+      TYPE(DIAG), DIMENSION(jp_pisces_2d)  :: pisdia2d
+      TYPE(DIAG), DIMENSION(jp_pisces_3d)  :: pisdia3d
+      TYPE(DIAG), DIMENSION(jp_pisces_trd) :: pisdiabio
+      CHARACTER(LEN=20)   ::   clname
       !!
-      NAMELIST/nampisbio/ nrdttrc, wsbio, xkmort, ferat3, wsbio2
-#if defined key_kriest
-      NAMELIST/nampiskrp/ xkr_eta, xkr_zeta, xkr_mass_min, xkr_mass_max
+      NAMELIST/nampisdia/ pisdia3d, pisdia2d     ! additional diagnostics
+#if defined key_pisces_reduced
+      NAMELIST/nampisdbi/ pisdiabio
 #endif
-      NAMELIST/nampisdia/ pisdia3d, pisdia2d     ! additional diagnostics
-      NAMELIST/nampisdmp/ ln_pisdmp, nn_pisdmp, ln_pisclo
 
       !!----------------------------------------------------------------------
 
       IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) ' trc_nam_pisces : read PISCES namelists'
+      clname = 'namelist_pisces'
+#if defined key_pisces
+      IF(lwp) WRITE(numout,*) ' trc_nam_pisces : read PISCES namelist'
+#else
+      IF(lwp) WRITE(numout,*) ' trc_nam_pisces : read LOBSTER namelist'
+#endif
       IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
+      CALL ctl_opn( numnatp, TRIM( clname ), 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
 
-
-      !                               ! Open the namelist file
-      !                               ! ----------------------
-      CALL ctl_opn( numnatp, 'namelist_pisces', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
-
-      REWIND( numnatp )                    
-      READ  ( numnatp, nampisbio )
-
-      IF(lwp) THEN                         ! control print
-         WRITE(numout,*) ' Namelist : nampisbio'
-         WRITE(numout,*) '    frequence pour la biologie                nrdttrc   =', nrdttrc
-         WRITE(numout,*) '    POC sinking speed                         wsbio     =', wsbio
-         WRITE(numout,*) '    half saturation constant for mortality    xkmort    =', xkmort
-         WRITE(numout,*) '    Fe/C in zooplankton                       ferat3    =', ferat3
-         WRITE(numout,*) '    Big particles sinking speed               wsbio2    =', wsbio2
-      ENDIF
-
-#if defined key_kriest
-
-      !                               ! nampiskrp : kriest parameters
-      !                               ! -----------------------------
-      xkr_eta      = 0.62        
-      xkr_zeta     = 1.62        
-      xkr_mass_min = 0.0002     
-      xkr_mass_max = 1.      
-
-      REWIND( numnatp )                     ! read natkriest
-      READ  ( numnatp, nampiskrp )
-
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) ' Namelist : nampiskrp'
-         WRITE(numout,*) '    Sinking  exponent                        xkr_eta      = ', xkr_eta
-         WRITE(numout,*) '    N content exponent                       xkr_zeta     = ', xkr_zeta
-         WRITE(numout,*) '    Minimum mass for Aggregates              xkr_mass_min = ', xkr_mass_min
-         WRITE(numout,*) '    Maximum mass for Aggregates              xkr_mass_max = ', xkr_mass_max
-         WRITE(numout,*)
-     ENDIF
-
-
-     ! Computation of some variables
-     xkr_massp = 5.7E-6 * 7.6 * xkr_mass_min**xkr_zeta
-
-#endif
       !
       IF( .NOT.lk_iomput .AND. ln_diatrc ) THEN
@@ -162,15 +125,43 @@
       ENDIF
 
-      REWIND( numnatp )
-      READ  ( numnatp, nampisdmp )
+#if defined key_pisces_reduced
 
-      IF(lwp) THEN                         ! control print
-         WRITE(numout,*)
-         WRITE(numout,*) ' Namelist : nampisdmp'
-         WRITE(numout,*) '    Relaxation of tracer to glodap mean value             ln_pisdmp      =', ln_pisdmp
-         WRITE(numout,*) '    Frequency of Relaxation                               nn_pisdmp      =', nn_pisdmp
-         WRITE(numout,*) '    Restoring of tracer to initial value  on closed seas  ln_pisclo      =', ln_pisclo
-         WRITE(numout,*) ' '
-      ENDIF
+      IF( ( .NOT.lk_iomput .AND. ln_diabio ) .OR. lk_trdmld_trc ) THEN
+         !
+         ! Namelist nampisdbi
+         ! -------------------
+         DO jl = 1, jp_pisces_trd
+            IF(     jl <  10 ) THEN   ;   WRITE (pisdiabio(jl)%sname,'("BIO_",I1)') jl      ! short name
+            ELSEIF (jl < 100 ) THEN   ;   WRITE (pisdiabio(jl)%sname,'("BIO_",I2)') jl
+            ELSE                      ;   WRITE (pisdiabio(jl)%sname,'("BIO_",I3)') jl
+            ENDIF
+            WRITE(pisdiabio(jl)%lname,'("BIOLOGICAL TREND NUMBER ",I2)') jl                 ! long name
+            pisdiabio(jl)%units = 'mmoleN/m3/s '                                            ! units
+         END DO
+
+         REWIND( numnatp )
+         READ  ( numnatp, nampisdbi )
+
+         DO jl = 1, jp_pisces_trd
+            jn = jp_pcs0_trd + jl - 1
+            ctrbio(jl) = pisdiabio(jl)%sname
+            ctrbil(jl) = pisdiabio(jl)%lname
+            ctrbiu(jl) = pisdiabio(jl)%units
+         END DO
+
+         IF(lwp) THEN                   ! control print
+            WRITE(numout,*)
+            WRITE(numout,*) ' Namelist : nampisdbi'
+            DO jl = 1, jp_pisces_trd
+               jn = jp_pcs0_trd + jl - 1
+               WRITE(numout,*) '  biological trend No : ', jn, '    short name : ', ctrbio(jn), &
+                 &             '  long name  : ', ctrbio(jn), '   unit : ', ctrbio(jn)
+            END DO
+            WRITE(numout,*) ' '
+         END IF
+         !
+      END IF
+
+#endif
 
    END SUBROUTINE trc_nam_pisces
Index: anches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/trcrst_pisces.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/trcrst_pisces.F90	(revision 3679)
+++ 	(revision )
@@ -1,236 +1,0 @@
-MODULE trcrst_pisces
-   !!======================================================================
-   !!                       ***  MODULE trcrst_pisces  ***
-   !! TOP :   create, write, read the restart files of PISCES tracer
-   !!======================================================================
-   !! History :   1.0  !  2010-01 (C. Ethe) Original
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                               pisces tracers
-   !!----------------------------------------------------------------------
-   !!   trc_rst_read_pisces   : read  restart file
-   !!   trc_rst_wri_pisces    : write restart file
-   !!----------------------------------------------------------------------
-   USE oce_trc         ! Ocean variables
-   USE par_trc         ! TOP parameters
-   USE trc             ! TOP variables
-   USE trcsms_pisces          ! pisces sms trends
-   USE sms_pisces          ! pisces sms variables
-   USE iom
-   USE trcdta
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC  trc_rst_read_pisces   ! called by trcini.F90 module
-   PUBLIC  trc_rst_wri_pisces   ! called by trcini.F90 module
-
-CONTAINS
-   
-   SUBROUTINE trc_rst_read_pisces( knum ) 
-      !!----------------------------------------------------------------------
-      !!                     ***  trc_rst_read_pisces  ***  
-      !!
-      !! ** Purpose : Read in restart file specific variables from pisces model
-      !!
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in)  :: knum  ! unit of the restart file
-      INTEGER  ::  ji, jj, jk
-      REAL(wp) ::  zcaralk, zbicarb, zco3
-      REAL(wp) ::  ztmas, ztmas1
-      !!----------------------------------------------------------------------
-
-      !
-      IF( ln_trcdta .AND. ln_pisclo ) CALL pis_dmp_clo  ! restoring of nutrients on close seas
-      !
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) ' trc_rst_read_pisces : Read specific variables from pisces model '
-      IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
-      ! 
-      IF( iom_varid( knum, 'PH', ldstop = .FALSE. ) > 0 ) THEN
-         CALL iom_get( knum, jpdom_autoglo, 'PH' , hi(:,:,:)  )
-      ELSE
-!         hi(:,:,:) = 1.e-9 
-         ! Set PH from  total alkalinity, borat (???), akb3 (???) and ak23 (???)
-         ! --------------------------------------------------------
-         DO jk = 1, jpk
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  ztmas   = tmask(ji,jj,jk)
-                  ztmas1  = 1. - tmask(ji,jj,jk)
-                  zcaralk = trn(ji,jj,jk,jptal) - borat(ji,jj,jk) / (  1. + 1.E-8 / ( rtrn + akb3(ji,jj,jk) )  )
-                  zco3    = ( zcaralk - trn(ji,jj,jk,jpdic) ) * ztmas + 0.5e-3 * ztmas1
-                  zbicarb = ( 2. * trn(ji,jj,jk,jpdic) - zcaralk )
-                 hi(ji,jj,jk) = ( ak23(ji,jj,jk) * zbicarb / zco3 ) * ztmas + 1.e-9 * ztmas1
-               END DO
-            END DO
-         END DO
-      ENDIF
-      CALL iom_get( knum, jpdom_autoglo, 'Silicalim', xksi(:,:) ) 
-      IF( iom_varid( knum, 'Silicamax', ldstop = .FALSE. ) > 0 ) THEN
-         CALL iom_get( knum, jpdom_autoglo, 'Silicamax' , xksimax(:,:)  )
-      ELSE
-         xksimax(:,:) = xksi(:,:)
-      ENDIF
-
-   END SUBROUTINE trc_rst_read_pisces
-
-   SUBROUTINE trc_rst_wri_pisces( kt, kitrst, knum )
-      !!----------------------------------------------------------------------
-      !!                     ***  trc_rst_read_pisces  ***
-      !!
-      !! ** Purpose : Read in restart file specific variables from pisces model
-      !!
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in)  :: kt      ! time step
-      INTEGER, INTENT(in)  :: kitrst  ! time step of restart write
-      INTEGER, INTENT(in)  :: knum    ! unit of the restart file
-      !!----------------------------------------------------------------------
-
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) ' trc_rst_wri_pisces : Write specific variables from pisces model '
-      IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
-
-      CALL iom_rstput( kt, kitrst, knum, 'PH', hi(:,:,:) )
-      CALL iom_rstput( kt, kitrst, knum, 'Silicalim', xksi(:,:) ) 
-      CALL iom_rstput( kt, kitrst, knum, 'Silicamax', xksimax(:,:) )
-
-   END SUBROUTINE trc_rst_wri_pisces
-
-   SUBROUTINE pis_dmp_clo   
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE pis_dmp_clo  ***
-      !!
-      !! ** Purpose :   Closed sea domain initialization
-      !!
-      !! ** Method  :   if a closed sea is located only in a model grid point
-      !!                we restore to initial data
-      !!
-      !! ** Action  :   ictsi1(), ictsj1() : south-west closed sea limits (i,j)
-      !!                ictsi2(), ictsj2() : north-east Closed sea limits (i,j)
-      !!----------------------------------------------------------------------
-      INTEGER, PARAMETER           ::   npicts   = 4        ! number of closed sea
-      INTEGER, DIMENSION(npicts)   ::   ictsi1, ictsj1      ! south-west closed sea limits (i,j)
-      INTEGER, DIMENSION(npicts)   ::   ictsi2, ictsj2      ! north-east closed sea limits (i,j)
-      INTEGER :: ji, jj, jk, jn, jl, jc                     ! dummy loop indices
-      INTEGER :: ierr                                       ! local integer
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::  ztrcdta ! 4D  workspace
-      !!----------------------------------------------------------------------
-
-      IF(lwp) WRITE(numout,*) 
-      IF(lwp) WRITE(numout,*)' pis_dmp_clo : closed seas '
-      IF(lwp) WRITE(numout,*)'~~~~~~~'
-
-      ! initial values
-      ictsi1(:) = 1  ;  ictsi2(:) = 1
-      ictsj1(:) = 1  ;  ictsj2(:) = 1
-
-      ! set the closed seas (in data domain indices)
-      ! -------------------
-
-      IF( cp_cfg == "orca" ) THEN
-         !
-         SELECT CASE ( jp_cfg )
-         !                                           ! =======================
-         CASE ( 2 )                                  !  ORCA_R2 configuration
-            !                                        ! =======================
-            !                                            ! Caspian Sea
-            ictsi1(1)   =  11  ;  ictsj1(1)   = 103
-            ictsi2(1)   =  17  ;  ictsj2(1)   = 112
-            !                                            ! Great North American Lakes
-            ictsi1(2)   =  97  ;  ictsj1(2)   = 107
-            ictsi2(2)   = 103  ;  ictsj2(2)   = 111
-            !                                            ! Black Sea 1 : west part of the Black Sea
-            ictsi1(3)   = 174  ; ictsj1(3)   = 107
-            ictsi2(3)   = 181  ; ictsj2(3)   = 112
-            !                                            ! Black Sea 2 : est part of the Black Sea
-            ictsi1(4)   =   2  ;  ictsj1(4)   = 107
-            ictsi2(4)   =   6  ;  ictsj2(4)   = 112
-            !                                        ! =======================
-         CASE ( 4 )                                  !  ORCA_R4 configuration
-            !                                        ! =======================
-            !                                            ! Caspian Sea
-            ictsi1(1)   =  4  ;  ictsj1(1)   = 53
-            ictsi2(1)   =  4  ;  ictsj2(1)   = 56
-            !                                            ! Great North American Lakes
-            ictsi1(2)   = 49  ;  ictsj1(2)   = 55
-            ictsi2(2)   = 51  ;  ictsj2(2)   = 56
-            !                                            ! Black Sea
-            ictsi1(3)   = 88  ;  ictsj1(3)   = 55
-            ictsi2(3)   = 91  ;  ictsj2(3)   = 56
-            !                                            ! Baltic Sea
-            ictsi1(4)   = 75  ;  ictsj1(4)   = 59
-            ictsi2(4)   = 76  ;  ictsj2(4)   = 61
-            !                                        ! =======================
-            !                                        ! =======================
-         CASE ( 025 )                                ! ORCA_R025 configuration
-            !                                        ! =======================
-                                                     ! Caspian + Aral sea
-            ictsi1(1)   = 1330 ; ictsj1(1)   = 645
-            ictsi2(1)   = 1400 ; ictsj2(1)   = 795
-            !                                        ! Azov Sea
-            ictsi1(2)   = 1284 ; ictsj1(2)   = 722
-            ictsi2(2)   = 1304 ; ictsj2(2)   = 747
-            !
-         END SELECT
-         !
-      ENDIF
-
-      ! convert the position in local domain indices
-      ! --------------------------------------------
-      DO jc = 1, npicts
-         ictsi1(jc)   = mi0( ictsi1(jc) )
-         ictsj1(jc)   = mj0( ictsj1(jc) )
-
-         ictsi2(jc)   = mi1( ictsi2(jc) )
-         ictsj2(jc)   = mj1( ictsj2(jc) )
-      END DO
-
-      ! Restore close seas values to initial data
-      IF( nb_trcdta > 0 ) THEN  ! Initialisation of tracer from a file that may also be used for damping
-        ALLOCATE( ztrcdta(jpi,jpj,jpk,nb_trcdta), STAT=ierr )
-        IF( ierr > 0 ) THEN
-           CALL ctl_stop( 'trc_ini: unable to allocate ztrcdta array' )   ;   RETURN
-        ENDIF
-        !
-        CALL trc_dta( nittrc000, ztrcdta )   ! read tracer data at nittrc000
-        !
-        DO jn = 1, jptra
-           IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
-              jl = n_trc_index(jn)
-              DO jc = 1, npicts
-                 DO jk = 1, jpkm1
-                    DO jj = ictsj1(jc), ictsj2(jc)
-                       DO ji = ictsi1(jc), ictsi2(jc)
-                          trn(ji,jj,jk,jn) = ztrcdta(ji,jj,jk,jl) * tmask(ji,jj,jk) 
-                          trb(ji,jj,jk,jn) = trn(ji,jj,jk,jn)
-                       ENDDO
-                    ENDDO
-                 ENDDO
-              ENDDO
-           ENDIF
-        ENDDO
-        DEALLOCATE( ztrcdta )
-      ENDIF
-      !
-   END SUBROUTINE pis_dmp_clo
-
-#else
-   !!----------------------------------------------------------------------
-   !!  Dummy module :                                     No passive tracer
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_rst_read_pisces( knum )
-      INTEGER, INTENT(in)  :: knum
-      WRITE(*,*) 'trc_rst_read_pisces: You should not have seen this print! error?', knum
-   END SUBROUTINE trc_rst_read_pisces
-
-   SUBROUTINE trc_rst_wri_pisces( kt, kitrst, knum )
-     INTEGER, INTENT(in)  :: kt, kitrst, knum
-     WRITE(*,*) 'trc_rst_wri_pisces: You should not have seen this print! error?', kt, kitrst, knum
-   END SUBROUTINE trc_rst_wri_pisces
-#endif
-
-   !!======================================================================
-END MODULE trcrst_pisces
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90	(revision 3680)
@@ -7,5 +7,5 @@
    !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
    !!----------------------------------------------------------------------
-#if defined key_pisces
+#if defined key_pisces || defined key_pisces_reduced
    !!----------------------------------------------------------------------
    !!   'key_pisces'                                       PISCES bio-model
@@ -13,17 +13,7 @@
    !!   trcsms_pisces        :  Time loop of passive tracers sms
    !!----------------------------------------------------------------------
-   USE oce_trc         !  shared variables between ocean and passive tracers
-   USE trc             !  passive tracers common variables 
-   USE sms_pisces      !  PISCES Source Minus Sink variables
-   USE p4zbio          !  Biological model
-   USE p4zche          !  Chemical model
-   USE p4zlys          !  Calcite saturation
-   USE p4zflx          !  Gas exchange
-   USE p4zsed          !  Sedimentation
-   USE p4zint          !  time interpolation
-   USE trdmod_oce      !  Ocean trends variables
-   USE trdmod_trc      !  TOP trends variables
-   USE sedmodel        !  Sediment model
-   USE prtctl_trc      !  print control for debugging
+   USE par_pisces
+   USE p4zsms
+   USE p2zsms
 
    IMPLICIT NONE
@@ -31,11 +21,4 @@
 
    PUBLIC   trc_sms_pisces    ! called in trcsms.F90
-
-   LOGICAL ::  ln_check_mass = .false.       !: Flag to check mass conservation 
-
-   INTEGER ::  numno3  !: logical unit for NO3 budget
-   INTEGER ::  numalk  !: logical unit for talk budget
-   INTEGER ::  numsil  !: logical unit for Si budget
-
    !!----------------------------------------------------------------------
    !! NEMO/TOP 3.3 , NEMO Consortium (2010)
@@ -46,4 +29,11 @@
 CONTAINS
 
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE trc_ini_pisces ***
+      !!
+      !! ** Purpose :   Initialisation of the PISCES biochemical model
+      !!----------------------------------------------------------------------
+
+
    SUBROUTINE trc_sms_pisces( kt )
       !!---------------------------------------------------------------------
@@ -51,197 +41,16 @@
       !!
       !! ** Purpose :   Managment of the call to Biological sources and sinks 
-      !!              routines of PISCES bio-model
-      !!
-      !! ** Method  : - at each new day ...
-      !!              - several calls of bio and sed ???
-      !!              - ...
-      !!---------------------------------------------------------------------
-      !
-      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
-      !!
-      INTEGER ::   jnt, jn, jl
-      CHARACTER (len=25) :: charout
-      REAL(wp), POINTER, DIMENSION(:,:,:,:)  :: ztrdpis
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('trc_sms_pisces')
-      !
-      IF( ln_pisdmp .AND. MOD( kt - nn_dttrc, nn_pisdmp ) == 0 )   CALL trc_sms_pisces_dmp( kt )  ! Relaxation of some tracers
-                                                                   CALL trc_sms_pisces_mass_conserv( kt ) ! Mass conservation checking
-      IF( l_trdtrc )  THEN
-         CALL wrk_alloc( jpi, jpj, jpk, jp_pisces, ztrdpis ) 
-         DO jn = 1, jp_pisces
-            jl = jn + jp_pcs0 - 1
-            ztrdpis(:,:,:,jn) = trn(:,:,:,jl)
-         ENDDO
-      ENDIF
-
-      IF( ndayflxtr /= nday_year ) THEN      ! New days
-         !
-         ndayflxtr = nday_year
-
-         IF(lwp) write(numout,*)
-         IF(lwp) write(numout,*) ' New chemical constants and various rates for biogeochemistry at new day : ', nday_year
-         IF(lwp) write(numout,*) '~~~~~~'
-
-         CALL p4z_che              ! computation of chemical constants
-         CALL p4z_int              ! computation of various rates for biogeochemistry
-         !
-      ENDIF
-
-
-      DO jnt = 1, nrdttrc          ! Potential time splitting if requested
-         !
-         CALL p4z_bio (kt, jnt)    ! Compute soft tissue production (POC)
-         CALL p4z_sed (kt, jnt)    ! compute soft tissue remineralisation
-         !
-         DO jn = jp_pcs0, jp_pcs1
-            trb(:,:,:,jn) = trn(:,:,:,jn)
-         ENDDO
-         !
-      END DO
-
-      IF( l_trdtrc )  THEN
-         DO jn = 1, jp_pisces
-            jl = jn + jp_pcs0 - 1
-            ztrdpis(:,:,:,jn) = ( ztrdpis(:,:,:,jn) - trn(:,:,:,jl) ) * rfact2r
-         ENDDO
-      ENDIF
-
-      CALL p4z_lys( kt )             ! Compute CaCO3 saturation
-      CALL p4z_flx( kt )             ! Compute surface fluxes
-
-      DO jn = jp_pcs0, jp_pcs1
-        CALL lbc_lnk( trn(:,:,:,jn), 'T', 1. )
-        CALL lbc_lnk( trb(:,:,:,jn), 'T', 1. )
-        CALL lbc_lnk( tra(:,:,:,jn), 'T', 1. )
-      END DO
-
-      IF( l_trdtrc ) THEN
-         DO jn = 1, jp_pisces
-            jl = jn + jp_pcs0 - 1
-             ztrdpis(:,:,:,jn) = ztrdpis(:,:,:,jn) + tra(:,:,:,jl)
-             CALL trd_mod_trc( ztrdpis(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends
-          END DO
-          CALL wrk_dealloc( jpi, jpj, jpk, jp_pisces, ztrdpis ) 
-      END IF
-
-      IF( lk_sed ) THEN 
-         !
-         CALL sed_model( kt )     !  Main program of Sediment model
-         !
-         DO jn = jp_pcs0, jp_pcs1
-           CALL lbc_lnk( trn(:,:,:,jn), 'T', 1. )
-         END DO
-         !
-      ENDIF
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('trc_sms_pisces')
-      !
-   END SUBROUTINE trc_sms_pisces
-
-   SUBROUTINE trc_sms_pisces_dmp( kt )
-      !!----------------------------------------------------------------------
-      !!                    ***  trc_sms_pisces_dmp  ***
-      !!
-      !! ** purpose  : Relaxation of some tracers
-      !!----------------------------------------------------------------------
-      !
-      INTEGER, INTENT( in )  ::     kt ! time step
-      !
-      REAL(wp) ::  alkmean = 2426.     ! mean value of alkalinity ( Glodap ; for Goyet 2391. )
-      REAL(wp) ::  po4mean = 2.165     ! mean value of phosphates
-      REAL(wp) ::  no3mean = 30.90     ! mean value of nitrate
-      REAL(wp) ::  silmean = 91.51     ! mean value of silicate
-      !
-      REAL(wp) :: zarea, zalksum, zpo4sum, zno3sum, zsilsum
-      !!---------------------------------------------------------------------
-
-
-      IF(lwp)  WRITE(numout,*)
-      IF(lwp)  WRITE(numout,*) ' trc_sms_pisces_dmp : Relaxation of nutrients at time-step kt = ', kt
-      IF(lwp)  WRITE(numout,*)
-
-      IF( cp_cfg == "orca" .AND. .NOT. lk_c1d ) THEN      ! ORCA condiguration (not 1D) !
-         !                                                    ! --------------------------- !
-         ! set total alkalinity, phosphate, nitrate & silicate
-         zarea          = 1._wp / glob_sum( cvol(:,:,:) ) * 1e6              
-
-         zalksum = glob_sum( trn(:,:,:,jptal) * cvol(:,:,:)  ) * zarea
-         zpo4sum = glob_sum( trn(:,:,:,jppo4) * cvol(:,:,:)  ) * zarea / 122.
-         zno3sum = glob_sum( trn(:,:,:,jpno3) * cvol(:,:,:)  ) * zarea / 7.6
-         zsilsum = glob_sum( trn(:,:,:,jpsil) * cvol(:,:,:)  ) * zarea
- 
-         IF(lwp) WRITE(numout,*) '       TALK mean : ', zalksum
-         trn(:,:,:,jptal) = trn(:,:,:,jptal) * alkmean / zalksum
-
-         IF(lwp) WRITE(numout,*) '       PO4  mean : ', zpo4sum
-         trn(:,:,:,jppo4) = trn(:,:,:,jppo4) * po4mean / zpo4sum
-
-         IF(lwp) WRITE(numout,*) '       NO3  mean : ', zno3sum
-         trn(:,:,:,jpno3) = trn(:,:,:,jpno3) * no3mean / zno3sum
-
-         IF(lwp) WRITE(numout,*) '       SiO3 mean : ', zsilsum
-         trn(:,:,:,jpsil) = MIN( 400.e-6,trn(:,:,:,jpsil) * silmean / zsilsum )
-         !
-      ENDIF
-
-   END SUBROUTINE trc_sms_pisces_dmp
-
-   SUBROUTINE trc_sms_pisces_mass_conserv ( kt )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE trc_sms_pisces_mass_conserv  ***
-      !!
-      !! ** Purpose :  Mass conservation check 
+      !!                routines of PISCES or LOBSTER bio-model
       !!
       !!---------------------------------------------------------------------
       !
       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
-      !!
-      REAL(wp) :: zalkbudget, zno3budget, zsilbudget
+      !!---------------------------------------------------------------------
       !
-      NAMELIST/nampismass/ ln_check_mass
-      !!---------------------------------------------------------------------
-
-      IF( kt == nittrc000 ) THEN 
-         REWIND( numnatp )       
-         READ  ( numnatp, nampismass )
-         IF(lwp) THEN                         ! control print
-            WRITE(numout,*) ' '
-            WRITE(numout,*) ' Namelist parameter for mass conservation checking'
-            WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
-            WRITE(numout,*) '    Flag to check mass conservation of NO3/Si/TALK ln_check_mass = ', ln_check_mass
-         ENDIF
-
-         IF( ln_check_mass .AND. lwp) THEN      !   Open budget file of NO3, ALK, Si
-            CALL ctl_opn( numno3, 'no3.budget' , 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea )
-            CALL ctl_opn( numsil, 'sil.budget' , 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea )
-            CALL ctl_opn( numalk, 'talk.budget', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea )
-         ENDIF
+      IF( lk_p4z ) THEN  ;   CALL p4z_sms( kt )   !  PISCES
+      ELSE               ;   CALL p2z_sms( kt )   !  LOBSTER
       ENDIF
-
-      IF( ln_check_mass ) THEN      !   Compute the budget of NO3, ALK, Si
-         zno3budget = glob_sum( (   trn(:,:,:,jpno3) + trn(:,:,:,jpnh4)  &
-            &                     + trn(:,:,:,jpphy) + trn(:,:,:,jpdia)  &
-            &                     + trn(:,:,:,jpzoo) + trn(:,:,:,jpmes)  &
-            &                     + trn(:,:,:,jppoc) + trn(:,:,:,jpgoc)  &
-            &                     + trn(:,:,:,jpdoc)                     ) * cvol(:,:,:)  ) 
-         ! 
-         zsilbudget = glob_sum( (   trn(:,:,:,jpsil) + trn(:,:,:,jpgsi)  &
-            &                     + trn(:,:,:,jpdsi)                     ) * cvol(:,:,:)  )
-         ! 
-         zalkbudget = glob_sum( (   trn(:,:,:,jpno3) * rno3              &
-            &                     + trn(:,:,:,jptal)                     &
-            &                     + trn(:,:,:,jpcal) * 2.                ) * cvol(:,:,:)  )
-
-         IF( lwp ) THEN
-            WRITE(numno3,9500) kt,  zno3budget / areatot
-            WRITE(numsil,9500) kt,  zsilbudget / areatot
-            WRITE(numalk,9500) kt,  zalkbudget / areatot
-         ENDIF
-       ENDIF
- 9500  FORMAT(i10,e18.10)     
-       !
-   END SUBROUTINE trc_sms_pisces_mass_conserv
+      !
+   END SUBROUTINE trc_sms_pisces
 
 #else
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/trcwri_pisces.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/trcwri_pisces.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/PISCES/trcwri_pisces.F90	(revision 3680)
@@ -6,11 +6,12 @@
    !! History :   1.0  !  2009-05 (C. Ethe)  Original code
    !!----------------------------------------------------------------------
-#if defined key_top && key_pisces && defined key_iomput
+#if defined key_top && defined key_iomput && ( defined key_pisces || defined key_pisces_reduced )
    !!----------------------------------------------------------------------
-   !!   'key_pisces'                                           PISCES model
+   !!   'key_pisces or key_pisces_reduced'                     PISCES model
    !!----------------------------------------------------------------------
    !! trc_wri_pisces   :  outputs of concentration fields
    !!----------------------------------------------------------------------
    USE trc         ! passive tracers common variables 
+   USE sms_pisces  ! PISCES variables
    USE iom         ! I/O manager
 
@@ -35,11 +36,18 @@
       ! write the tracer concentrations in the file
       ! ---------------------------------------
-      DO jn = 1, jptra
-         zrfact = 1.0e+6 
-         IF( jn == jpno3 .OR. jn == jpnh4 ) zrfact = 1.0e+6 / 7.6
-         IF( jn == jppo4  )                 zrfact = 1.0e+6 / 122.
+#if defined key_pisces_reduced
+      DO jn = jp_pcs0, jp_pcs1
          cltra = TRIM( ctrcnm(jn) )                  ! short title for tracer
          CALL iom_put( cltra, trn(:,:,:,jn) * zrfact )
       END DO
+#else
+      DO jn = jp_pcs0, jp_pcs1
+         zrfact = 1.0e+6 
+         IF( jn == jpno3 .OR. jn == jpnh4 ) zrfact = rno3 * 1.0e+6 
+         IF( jn == jppo4  )                 zrfact = po4r * 1.0e+6
+         cltra = TRIM( ctrcnm(jn) )                  ! short title for tracer
+         CALL iom_put( cltra, trn(:,:,:,jn) * zrfact )
+      END DO
+#endif
       !
    END SUBROUTINE trc_wri_pisces
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv.F90	(revision 3680)
@@ -82,13 +82,13 @@
       IF( kt == nittrc000 )   CALL trc_adv_ctl          ! initialisation & control of options
 
-#if ! defined key_pisces
-      IF( neuler == 0 .AND. kt == nittrc000 ) THEN     ! at nittrc000
-         r2dt(:) =  rdttrc(:)           ! = rdttrc (restarting with Euler time stepping)
-      ELSEIF( kt <= nittrc000 + 1 ) THEN          ! at nittrc000 or nittrc000+1
-         r2dt(:) = 2. * rdttrc(:)       ! = 2 rdttrc (leapfrog)
+      IF( ln_top_euler) THEN
+         r2dt(:) =  rdttrc(:)              ! = rdttrc (use Euler time stepping)
+      ELSE
+         IF( neuler == 0 .AND. kt == nittrc000 ) THEN     ! at nittrc000
+            r2dt(:) =  rdttrc(:)           ! = rdttrc (restarting with Euler time stepping)
+         ELSEIF( kt <= nittrc000 + 1 ) THEN          ! at nittrc000 or nittrc000+1
+            r2dt(:) = 2. * rdttrc(:)       ! = 2 rdttrc (leapfrog)
+         ENDIF
       ENDIF
-#else
-      r2dt(:) =  rdttrc(:)              ! = rdttrc (for PISCES use Euler time stepping)
-#endif
 
       !                                                   ! effective transport
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trcnam_trp.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trcnam_trp.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trcnam_trp.F90	(revision 3680)
@@ -81,5 +81,5 @@
       NAMELIST/namtrc_rad/ ln_trcrad
 #if defined key_trcdmp
-      NAMELIST/namtrc_dmp/ nn_hdmp_tr, nn_zdmp_tr, rn_surf_tr, &
+      NAMELIST/namtrc_dmp/ ln_trcdmp, nn_hdmp_tr, nn_zdmp_tr, rn_surf_tr, &
         &                  rn_bot_tr , rn_dep_tr , nn_file_tr
 #endif
@@ -156,4 +156,5 @@
          WRITE(numout,*) '~~~~~~~'
          WRITE(numout,*) '   Namelist namtrc_dmp : set damping parameter'
+         WRITE(numout,*) '      add a damping term or not      ln_trcdmp = ', ln_trcdmp
          WRITE(numout,*) '      tracer damping option          nn_hdmp_tr = ', nn_hdmp_tr
          WRITE(numout,*) '      mixed layer damping option     nn_zdmp_tr = ', nn_zdmp_tr, '(zoom: forced to 0)'
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90	(revision 3680)
@@ -34,5 +34,4 @@
    USE tranxt
 # if defined key_agrif
-   USE agrif_top_update
    USE agrif_top_interp
 # endif
@@ -146,9 +145,4 @@
       ENDIF
 
-#if defined key_agrif
-      ! Update tracer at AGRIF zoom boundaries
-      IF( .NOT.Agrif_Root() )    CALL Agrif_Update_Trc( kt )      ! children only
-#endif      
-
       ! trends computation
       IF( l_trdtrc ) THEN                                      ! trends
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trcrad.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trcrad.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trcrad.F90	(revision 3680)
@@ -63,5 +63,4 @@
       IF( lk_cfc     )   CALL trc_rad_sms( kt, trb, trn, jp_cfc0 , jp_cfc1               )  ! CFC model
       IF( lk_c14b    )   CALL trc_rad_sms( kt, trb, trn, jp_c14b0, jp_c14b1              )  ! bomb C14
-      IF( lk_lobster )   CALL trc_rad_sms( kt, trb, trn, jp_lob0 , jp_lob1, cpreserv='Y' )  ! LOBSTER model
       IF( lk_pisces  )   CALL trc_rad_sms( kt, trb, trn, jp_pcs0 , jp_pcs1, cpreserv='Y' )  ! PISCES model
       IF( lk_my_trc  )   CALL trc_rad_sms( kt, trb, trn, jp_myt0 , jp_myt1               )  ! MY_TRC model
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90	(revision 3680)
@@ -50,5 +50,5 @@
       !!            tra = tra + emp * trn / e3t   for k=1
       !!         where emp, the surface freshwater budget (evaporation minus
-      !!         precipitation minus runoff) given in kg/m2/s is divided
+      !!         precipitation ) given in kg/m2/s is divided
       !!         by 1035 kg/m3 (density of ocean water) to obtain m/s.
       !!
@@ -79,17 +79,12 @@
       ENDIF
 
+      ! Coupling online : river runoff is added to the horizontal divergence (hdivn) in the subroutine sbc_rnf_div 
+      ! one only consider the concentration/dilution effect due to evaporation minus precipitation + freezing/melting of sea-ice
 
-      IF( lk_offline ) THEN          ! sfx in dynamical files contains sfx  - rnf
-         zsfx(:,:) = sfx(:,:)  
-      ELSE                           ! Concentration dilution effect on tracer due to evaporation, precipitation, and river runoff
-         IF( lk_vvl ) THEN                      ! volume variable
-            zsfx(:,:) = sfx(:,:) - emp(:,:)   
-!!ch         zsfx(:,:) = 0.
-         ELSE                                   ! linear free surface
-            IF( ln_rnf ) THEN  ;  zsfx(:,:) = sfx(:,:) - rnf(:,:)   !  E-P-R
-            ELSE               ;  zsfx(:,:) = sfx(:,:)
-            ENDIF 
-         ENDIF 
-      ENDIF 
+      IF( .NOT. lk_offline .AND. lk_vvl ) THEN  ! online coupling + volume variable
+         zemps(:,:) = sfx(:,:) - emp(:,:)
+      ELSE
+         zemps(:,:) = emp(:,:)
+      ENDIF
 
       ! 0. initialization
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trctrp.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trctrp.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trctrp.F90	(revision 3680)
@@ -29,5 +29,6 @@
 
 #if defined key_agrif
-   USE agrif_top_sponge ! Momemtum and tracers sponges
+   USE agrif_top_sponge ! tracers sponges
+   USE agrif_top_update ! tracers updates
 #endif
 
@@ -76,4 +77,8 @@
                                 CALL trc_nxt( kstp )            ! tracer fields at next time step     
          IF( ln_trcrad )        CALL trc_rad( kstp )            ! Correct artificial negative concentrations
+
+#if defined key_agrif
+      IF( .NOT. Agrif_Root())   CALL Agrif_Update_Trc( kstp )   ! Update tracer at AGRIF zoom boundaries : children only
+#endif
          IF( ln_zps    )        CALL zps_hde( kstp, jptra, trn, gtru, gtrv )  ! Partial steps: now horizontal gradient of passive
                                                                 ! tracers at the bottom ocean level
@@ -98,7 +103,7 @@
    !!----------------------------------------------------------------------
 CONTAINS
-   SUBROUTINE trc_trp( kt )              ! Empty routine
-      INTEGER, INTENT(in) ::   kt
-      WRITE(*,*) 'trc_trp: You should not have seen this print! error?', kt
+   SUBROUTINE trc_trp( kstp )              ! Empty routine
+      INTEGER, INTENT(in) ::   kstp
+      WRITE(*,*) 'trc_trp: You should not have seen this print! error?', kstp
    END SUBROUTINE trc_trp
 #endif
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90	(revision 3680)
@@ -73,13 +73,13 @@
       IF( kt == nittrc000 )   CALL zdf_ctl          ! initialisation & control of options
 
-#if ! defined key_pisces
-      IF( neuler == 0 .AND. kt == nittrc000 ) THEN     ! at nittrc000
-         r2dt(:) =  rdttrc(:)           ! = rdttrc (restarting with Euler time stepping)
-      ELSEIF( kt <= nittrc000 + 1 ) THEN          ! at nittrc000 or nittrc000+1
-         r2dt(:) = 2. * rdttrc(:)       ! = 2 rdttrc (leapfrog)
+      IF( ln_top_euler) THEN
+         r2dt(:) =  rdttrc(:)              ! = rdttrc (use Euler time stepping)
+      ELSE
+         IF( neuler == 0 .AND. kt == nittrc000 ) THEN     ! at nittrc000
+            r2dt(:) =  rdttrc(:)           ! = rdttrc (restarting with Euler time stepping)
+         ELSEIF( kt <= nittrc000 + 1 ) THEN          ! at nittrc000 or nittrc000+1
+            r2dt(:) = 2. * rdttrc(:)       ! = 2 rdttrc (leapfrog)
+         ENDIF
       ENDIF
-#else
-      r2dt(:) =  rdttrc(:)              ! = rdttrc (for PISCES use Euler time stepping)
-#endif
 
       IF( l_trdtrc )  THEN
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc.F90	(revision 3680)
@@ -34,5 +34,4 @@
    USE prtctl            ! print control
    USE sms_pisces        ! PISCES bio-model
-   USE sms_lobster       ! LOBSTER bio-model
    USE wrk_nemo          ! Memory allocation
 
@@ -53,5 +52,5 @@
    INTEGER ::   ndimtrd1                        
    INTEGER, SAVE ::  ionce, icount
-#if defined key_lobster
+#if defined key_pisces_reduced
    INTEGER ::   nidtrdbio, nh_tb
    INTEGER, SAVE ::  ioncebio, icountbio
@@ -62,5 +61,5 @@
 
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::  ztmltrd2   !
-#if defined key_lobster
+#if defined key_pisces_reduced
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  ztmltrdbio2  ! only needed for mean diagnostics in trd_mld_bio()
 #endif
@@ -81,5 +80,5 @@
       !!----------------------------------------------------------------------
       ALLOCATE( ztmltrd2(jpi,jpj,jpltrd_trc,jptra) ,      &
-#if defined key_lobster
+#if defined key_pisces_reduced
          &      ztmltrdbio2(jpi,jpj,jpdiabio)      ,      &
 #endif
@@ -133,5 +132,5 @@
          SELECT CASE ( nn_ctls_trc )                                ! choice of the control surface
             CASE ( -2  )   ;   STOP 'trdmld_trc : not ready '     !     -> isopycnal surface (see ???)
-#if defined key_pisces || defined key_lobster
+#if defined key_pisces || defined key_pisces_reduced
             CASE ( -1  )   ;   nmld_trc(:,:) = neln(:,:)          !     -> euphotic layer with light criterion
 #endif
@@ -232,5 +231,5 @@
       INTEGER                         , INTENT(in) ::   ktrd          ! bio trend index
       REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in) ::   ptrc_trdmld   ! passive trc trend
-#if defined key_lobster
+#if defined key_pisces_reduced
       !
       INTEGER ::   ji, jj, jk, isum
@@ -940,5 +939,5 @@
       !!----------------------------------------------------------------------
       INTEGER, INTENT( in ) ::   kt                       ! ocean time-step index
-#if defined key_lobster
+#if defined key_pisces_reduced
       INTEGER  ::  jl, it, itmod
       LOGICAL  :: llwarn  = .TRUE., lldebug = .TRUE.
@@ -1217,8 +1216,8 @@
       tmltrd_csum_ln_trc (:,:,:,:) = 0.e0   ;   rmld_sum_trc       (:,:)     = 0.e0
 
-#if defined key_lobster
+#if defined key_pisces_reduced
       nmoymltrdbio   = 0
       tmltrd_sum_bio     (:,:,:) = 0.e0     ;   tmltrd_csum_ln_bio (:,:,:) = 0.e0
-      DO jl = 1, jp_lobster_trd
+      DO jl = 1, jp_pisces_trd
           ctrd_bio(jl,1) = ctrbil(jl)   ! long name
           ctrd_bio(jl,2) = ctrbio(jl)   ! short name
@@ -1234,5 +1233,5 @@
          tml_sumb_trc       (:,:,:)   = 0.e0   ;   tmltrd_csum_ub_trc (:,:,:,:) = 0.e0     ! mean
          tmltrd_atf_sumb_trc(:,:,:)   = 0.e0   ;   tmltrd_rad_sumb_trc(:,:,:)   = 0.e0 
-#if defined key_lobster
+#if defined key_pisces_reduced
          tmltrd_csum_ub_bio (:,:,:) = 0.e0
 #endif
@@ -1242,5 +1241,5 @@
       icount = 1   ;   ionce  = 1  ! open specifier   
 
-#if defined key_lobster
+#if defined key_pisces_reduced
       icountbio = 1   ;   ioncebio  = 1  ! open specifier
 #endif
@@ -1337,5 +1336,5 @@
       END DO
 
-#if defined key_lobster
+#if defined key_pisces_reduced
           !-- Create a NetCDF file and enter the define mode
           CALL dia_nam( clhstnam, nn_trd_trc, 'trdbio' )
@@ -1383,6 +1382,6 @@
       END DO
 
-#if defined key_lobster
-      DO jl = 1, jp_lobster_trd
+#if defined key_pisces_reduced
+      DO jl = 1, jp_pisces_trd
          CALL histdef(nidtrdbio, TRIM("ML_"//ctrd_bio(jl,2)), TRIM(clmxl//" ML_"//ctrd_bio(jl,1))   ,            &
              &    cltrcu, jpi, jpj, nh_tb, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) ! IOIPSL: time mean
@@ -1395,5 +1394,5 @@
       END DO
 
-#if defined key_lobster
+#if defined key_pisces_reduced
       !-- Leave IOIPSL/NetCDF define mode
       CALL histend( nidtrdbio, snc4set )
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc_rst.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc_rst.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc_rst.F90	(revision 3680)
@@ -105,6 +105,6 @@
             END DO                                                     ! tracer loop
             !                                                          ! ===========
-#if defined key_lobster
-            DO jl = 1, jp_lobster_trd
+#if defined key_pisces_reduced
+            DO jl = 1, jp_pisces_trd
                CALL iom_rstput( kt, nitrst, nummldw_trc, 'tmltrd_csum_ub_bio'//ctrd_bio(jl,2), tmltrd_csum_ub_bio(:,:,jl) )
             ENDDO
@@ -190,6 +190,6 @@
          !                                                          ! ===========
 
-#if defined key_lobster
-         DO jl = 1, jp_lobster_trd
+#if defined key_pisces_reduced
+         DO jl = 1, jp_pisces_trd
             CALL iom_get( inum, jpdom_autoglo, 'tmltrd_csum_ub_bio'//ctrd_bio(jl,2), tmltrd_csum_ub_bio(:,:,jl) )
          ENDDO
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trdmod_trc_oce.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trdmod_trc_oce.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/TRP/trdmod_trc_oce.F90	(revision 3680)
@@ -106,5 +106,5 @@
 # endif
 
-# if defined key_lobster
+# if defined key_pisces_reduced
    CHARACTER(LEN=80) :: clname_bio, ctrd_bio(jpdiabio,2)
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  &
@@ -154,5 +154,5 @@
 #endif
       !
-# if defined key_lobster
+# if defined key_pisces_reduced
       ALLOCATE( tmltrd_bio        (jpi,jpj,jpdiabio) ,     &
          &      tmltrd_sum_bio    (jpi,jpj,jpdiabio) ,     &
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90	(revision 3680)
@@ -56,131 +56,5 @@
 
    !* model domain *
-   USE dom_oce , ONLY :   lzoom      => lzoom        !: zoom flag
-   USE dom_oce , ONLY :   lzoom_e    => lzoom_e      !: East  zoom type flag
-   USE dom_oce , ONLY :   lzoom_w    => lzoom_w      !: West  zoom type flag
-   USE dom_oce , ONLY :   lzoom_s    => lzoom_s      !: South zoom type flag
-   USE dom_oce , ONLY :   lzoom_n    => lzoom_n      !: North zoom type flag
-   USE dom_oce , ONLY :   lzoom_arct => lzoom_arct   !: ORCA    arctic zoom flag
-   USE dom_oce , ONLY :   lzoom_anta => lzoom_anta   !: ORCA antarctic zoom flag
-   USE dom_oce , ONLY :   nperio     =>   nperio     !: type of lateral boundary condition       
-   USE dom_oce , ONLY :   nimpp      =>   nimpp      !: i index for mpp-subdomain left bottom
-   USE dom_oce , ONLY :   njmpp      =>   njmpp      !: j index for mpp-subdomain left bottom
-   USE dom_oce , ONLY :   nproc      =>   nproc      !: number for local processor
-   USE dom_oce , ONLY :   narea      =>   narea      !: number for local area
-   USE dom_oce , ONLY :   mig        =>   mig        !: local  ==> global  domain i-indice
-   USE dom_oce , ONLY :   mjg        =>   mjg        !: local  ==> global  domain i-indice
-   USE dom_oce , ONLY :   mi0        =>   mi0        !: global ==> local domain i-indice 
-   USE dom_oce , ONLY :   mi1        =>   mi1        !: (mi0=1 and mi1=0 if the global indice is not in the local one)
-   USE dom_oce , ONLY :   mj0        =>   mj0        !: global ==> local domain j-indice 
-   USE dom_oce , ONLY :   mj1        =>   mj1        !: (mj0=1 and mj1=0 if the global indice is not in the local one)
-   USE dom_oce , ONLY :   nidom      =>   nidom
-   USE dom_oce , ONLY :   nimppt     => nimppt     !:i-indexes for each processor
-   USE dom_oce , ONLY :   njmppt     => njmppt       !:j-indexes for each processor
-   USE dom_oce , ONLY :   ibonit     => ibonit       !:i-processor neighbour existence
-   USE dom_oce , ONLY :   ibonjt     => ibonjt       !:j- processor neighbour existence 
-   USE dom_oce , ONLY :   nlci       => nlci         !:i- & j-dimensions of the local subdomain
-   USE dom_oce , ONLY :   nlcj       => nlcj         !:
-   USE dom_oce , ONLY :   nldi       => nldi         !:first and last indoor i- and j-indexes
-   USE dom_oce , ONLY :   nlei       => nlei         !:
-   USE dom_oce , ONLY :   nldj       => nldj         !:
-   USE dom_oce , ONLY :   nlej       => nlej         !:
-   USE dom_oce , ONLY :   nlcit      => nlcit        !:dimensions of every i-subdomain
-   USE dom_oce , ONLY :   nlcjt      => nlcjt        !:dimensions of every j-subdomain
-   USE dom_oce , ONLY :   nldit      => nldit        !:first indoor index for each i-domain 
-   USE dom_oce , ONLY :   nleit      => nleit        !:last indoor index for each i-domain 
-   USE dom_oce , ONLY :   nldjt      => nldjt        !:first indoor index for each j-domain 
-   USE dom_oce , ONLY :   nlejt      => nlejt        !:last indoor index for each j-domain 
- 
-   !* horizontal mesh *
-   USE dom_oce , ONLY :   glamt      =>   glamt      !: longitude of t-point (degre)  
-   USE dom_oce , ONLY :   glamu      =>   glamu      !: longitude of t-point (degre)  
-   USE dom_oce , ONLY :   glamv      =>   glamv      !: longitude of t-point (degre)  
-   USE dom_oce , ONLY :   glamf      =>   glamf      !: longitude of t-point (degre)  
-   USE dom_oce , ONLY :   gphit      =>   gphit      !: latitude  of t-point (degre)   
-   USE dom_oce , ONLY :   gphiu      =>   gphiu      !: latitude  of t-point (degre)   
-   USE dom_oce , ONLY :   gphiv      =>   gphiv      !: latitude  of t-point (degre)   
-   USE dom_oce , ONLY :   gphif      =>   gphif      !: latitude  of t-point (degre)   
-   USE dom_oce , ONLY :   e1t        =>   e1t        !: horizontal scale factors at t-point (m)  
-   USE dom_oce , ONLY :   e2t        =>   e2t        !: horizontal scale factors at t-point (m)   
-   USE dom_oce , ONLY :   e1e2t      =>   e1e2t      !: cell surface at t-point (m2)
-   USE dom_oce , ONLY :   e1u        =>   e1u        !: horizontal scale factors at u-point (m)
-   USE dom_oce , ONLY :   e2u        =>   e2u        !: horizontal scale factors at u-point (m)
-   USE dom_oce , ONLY :   e1v        =>   e1v        !: horizontal scale factors at v-point (m)
-   USE dom_oce , ONLY :   e2v        =>   e2v        !: horizontal scale factors at v-point (m)  
-
-   !* vertical mesh *
-   USE dom_oce , ONLY :   gdept_0    =>   gdept_0    !: reference depth of t-points (m)
-   USE dom_oce , ONLY :   e3t_0      =>   e3t_0      !: reference depth of t-points (m)  
-   USE dom_oce , ONLY :   e3w_0      =>   e3w_0      !: reference depth of w-points (m)
-   USE dom_oce , ONLY :   gdepw_0    =>   gdepw_0    !: reference depth of w-points (m)
-# if ! defined key_zco
-   USE dom_oce , ONLY :   gdep3w     =>  gdep3w      !: ???
-   USE dom_oce , ONLY :   gdept      =>  gdept       !: depth of t-points (m)
-   USE dom_oce , ONLY :   gdepw      =>  gdepw       !: depth of t-points (m)
-   USE dom_oce , ONLY :   e3t        =>  e3t         !: vertical scale factors at t-
-   USE dom_oce , ONLY :   e3u        =>  e3u         !: vertical scale factors at u-
-   USE dom_oce , ONLY :   e3v        =>  e3v         !: vertical scale factors v-
-   USE dom_oce , ONLY :   e3w        =>  e3w         !: w-points (m)
-   USE dom_oce , ONLY :   e3f        =>  e3f         !: f-points (m)
-   USE dom_oce , ONLY :   e3uw       =>  e3uw        !: uw-points (m)
-   USE dom_oce , ONLY :   e3vw       =>  e3vw        !: vw-points (m)
-# endif
-   USE dom_oce , ONLY :   ln_zps     =>  ln_zps      !: partial steps flag
-   USE dom_oce , ONLY :   ln_sco     =>  ln_sco      !: s-coordinate flag
-   USE dom_oce , ONLY :   ln_zco     =>  ln_zco      !: z-coordinate flag
-   USE dom_oce , ONLY :   hbatt      =>  hbatt       !: ocean depth at the vertical of  t-point (m)
-   USE dom_oce , ONLY :   hbatu      =>  hbatu       !: ocean depth at the vertical of  u-point (m)
-   USE dom_oce , ONLY :   hbatv      =>  hbatv       !: ocean depth at the vertical of w-point (m)
-   USE dom_oce , ONLY :   gsigt      =>  gsigt       !: model level depth coefficient at T-levels
-   USE dom_oce , ONLY :   gsigw      =>  gsigw       !: model level depth coefficient at W-levels
-   USE dom_oce , ONLY :   gsi3w      =>  gsi3w       !: model level depth coef at w-levels (defined as the sum of e3w)
-   USE dom_oce , ONLY :   esigt      =>  esigt       !: vertical scale factor coef. at t-levels
-   USE dom_oce , ONLY :   esigw      =>  esigw       !: vertical scale factor coef. at w-levels
-   USE dom_oce , ONLY :   lk_vvl     =>  lk_vvl      !: variable grid flag
-# if defined key_vvl
-   USE dom_oce , ONLY :   gdep3w_1   =>  gdep3w_1    !: ???
-   USE dom_oce , ONLY :   gdept_1    =>  gdept_1     !: depth of t-points (m)
-   USE dom_oce , ONLY :   gdepw_1    =>  gdepw_1     !: depth of t-points (m)
-   USE dom_oce , ONLY :   e3t_1      =>  e3t_1       !: vertical scale factors at t-
-   USE dom_oce , ONLY :   e3u_1      =>  e3u_1       !: vertical scale factors at u-
-   USE dom_oce , ONLY :   e3v_1      =>  e3v_1       !: vertical scale factors v-
-   USE dom_oce , ONLY :   e3w_1      =>  e3w_1       !: w-points (m)
-   USE dom_oce , ONLY :   e3f_1      =>  e3f_1       !: f-points (m)
-   USE dom_oce , ONLY :   e3uw_1     =>  e3uw_1      !: uw-points (m)
-   USE dom_oce , ONLY :   e3vw_1     =>  e3vw_1      !: vw-points (m)
-# endif
-   !* masks, bathymetry *
-   USE dom_oce , ONLY :   mbkt       =>   mbkt       !: vertical index of the bottom last T- ocean level
-   USE dom_oce , ONLY :   mbku       =>   mbku       !: vertical index of the bottom last U- ocean level
-   USE dom_oce , ONLY :   mbkv       =>   mbkv       !: vertical index of the bottom last V- ocean level
-   USE dom_oce , ONLY :   tmask_i    =>   tmask_i    !: Interior mask at t-points
-   USE dom_oce , ONLY :   tmask      =>   tmask      !: land/ocean mask at t-points
-   USE dom_oce , ONLY :   umask      =>   umask      !: land/ocean mask at u-points   
-   USE dom_oce , ONLY :   vmask      =>   vmask      !: land/ocean mask at v-points 
-   USE dom_oce , ONLY :   fmask      =>   fmask      !: land/ocean mask at f-points 
-
-   !* time domain *
-   USE dom_oce , ONLY :   neuler     =>   neuler     !: restart euler forward option (0=Euler)
-   USE dom_oce , ONLY :   rdt        =>   rdt        !: time step for the dynamics 
-   USE dom_oce , ONLY :   atfp       =>   atfp       !: asselin time filter parameter
-   USE dom_oce , ONLY :   atfp1      =>   atfp1      !: asselin time filter coeff. (atfp1= 1-2*atfp)
-   USE dom_oce , ONLY :   rdttra     =>   rdttra     !: vertical profile of tracer time step
-   !                                                 !: it is the accumulated duration of previous runs
-   !                                                 !: that may have been run with different time steps.
-   !* calendar variables *
-   USE dom_oce , ONLY :   nyear      =>   nyear      !: current year
-   USE dom_oce , ONLY :   nmonth     =>   nmonth     !: current month
-   USE dom_oce , ONLY :   nday       =>   nday       !: current day of the month
-   USE dom_oce , ONLY :   ndastp     =>   ndastp     !: time step date in yyyymmdd format
-   USE dom_oce , ONLY :   nday_year  =>   nday_year  !: current day counted from jan 1st of the current year
-   USE dom_oce , ONLY :   nsec_year  =>   nsec_year  !: current time step counted in second since 00h jan 1st of the current year
-   USE dom_oce , ONLY :   nsec_month =>   nsec_month !: current time step counted in second since 00h 1st day of the current month
-   USE dom_oce , ONLY :   nsec_day   =>   nsec_day   !: current time step counted in second since 00h of the current day
-   USE dom_oce , ONLY :   fjulday    =>   fjulday    !: julian day
-   USE dom_oce , ONLY :   adatrj     =>   adatrj     !: number of elapsed days since the begining of the whole simulation
-                                                     !: (cumulative duration of previous runs 
-                                                     !: that may have used different time-step size)
-   USE dom_oce , ONLY :   nyear_len  =>   nyear_len  !: length in days of the previous/current year
-   USE dom_oce , ONLY :   nmonth_len =>   nmonth_len !: length in days of the months of the current year
+   USE dom_oce 
 
 
@@ -217,6 +91,4 @@
    USE oce , ONLY :   grv     =>    grv     !: 
 #endif
-
-   USE dom_oce , ONLY :   nn_cla    =>  nn_cla        !: flag (0/1) for cross land advection 
 
    !* surface fluxes *
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/par_trc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/par_trc.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/par_trc.F90	(revision 3680)
@@ -5,5 +5,4 @@
    !!======================================================================
    !! History :    -   !  1996-01  (M. Levy)  original code
-   !!              -   !  1999-07  (M. Levy)  for LOBSTER1 or NPZD model
    !!              -   !  2000-04  (O. Aumont, M.A. Foujols)  HAMOCC3 and P3ZD
    !!             1.0  !  2004-03  (C. Ethe) Free form and module
@@ -12,5 +11,4 @@
    USE par_kind          ! kind parameters
    !
-   USE par_lobster   ! LOBSTER model
    USE par_pisces    ! PISCES  model
    USE par_c14b      ! C14 bomb tracer
@@ -22,9 +20,9 @@
    ! Passive tracers : Total size
    ! ---------------               ! total number of passive tracers, of 2d and 3d output and trend arrays
-   INTEGER, PUBLIC,  PARAMETER ::   jptra    =  jp_lobster    + jp_pisces     + jp_cfc     + jp_c14b    + jp_my_trc
-   INTEGER, PUBLIC,  PARAMETER ::   jpdia2d  =  jp_lobster_2d + jp_pisces_2d  + jp_cfc_2d  + jp_c14b_2d + jp_my_trc_2d
-   INTEGER, PUBLIC,  PARAMETER ::   jpdia3d  =  jp_lobster_3d + jp_pisces_3d  + jp_cfc_3d  + jp_c14b_3d + jp_my_trc_3d
+   INTEGER, PUBLIC,  PARAMETER ::   jptra    =  jp_pisces     + jp_cfc     + jp_c14b    + jp_my_trc
+   INTEGER, PUBLIC,  PARAMETER ::   jpdia2d  =  jp_pisces_2d  + jp_cfc_2d  + jp_c14b_2d + jp_my_trc_2d
+   INTEGER, PUBLIC,  PARAMETER ::   jpdia3d  =  jp_pisces_3d  + jp_cfc_3d  + jp_c14b_3d + jp_my_trc_3d
    !                     ! total number of sms diagnostic arrays
-   INTEGER, PUBLIC,  PARAMETER ::   jpdiabio = jp_lobster_trd + jp_pisces_trd + jp_cfc_trd + jp_c14b_trd + jp_my_trc_trd
+   INTEGER, PUBLIC,  PARAMETER ::   jpdiabio =  jp_pisces_trd + jp_cfc_trd + jp_c14b_trd + jp_my_trc_trd
    
    !  1D configuration ("key_c1d")
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/prtctl_trc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/prtctl_trc.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/prtctl_trc.F90	(revision 3680)
@@ -17,4 +17,5 @@
    USE par_trc          ! TOP parameters
    USE oce_trc          ! ocean space and time domain variables
+   USE prtctl           ! print control for OPA
 
    IMPLICIT NONE
@@ -296,157 +297,4 @@
    END SUBROUTINE prt_ctl_trc_init
 
-
-   SUBROUTINE sub_dom
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE sub_dom  ***
-      !!                    
-      !! ** Purpose :   Lay out the global domain over processors. 
-      !!                CAUTION: 
-      !!                This part has been extracted from the mpp_init
-      !!                subroutine and names of variables/arrays have been 
-      !!                slightly changed to avoid confusion but the computation
-      !!                is exactly the same. Any modification about indices of
-      !!                each sub-domain in the mppini.F90 module should be reported 
-      !!                here.
-      !!
-      !! ** Method  :   Global domain is distributed in smaller local domains.
-      !!                Periodic condition is a function of the local domain position
-      !!                (global boundary or neighbouring domain) and of the global
-      !!                periodic
-      !!                Type :         jperio global periodic condition
-      !!                               nperio local  periodic condition
-      !!
-      !! ** Action  : - set domain parameters
-      !!                    nimpp     : longitudinal index 
-      !!                    njmpp     : latitudinal  index
-      !!                    nperio    : lateral condition type 
-      !!                    narea     : number for local area
-      !!                    nlcil      : first dimension
-      !!                    nlcjl      : second dimension
-      !!                    nbondil    : mark for "east-west local boundary"
-      !!                    nbondjl    : mark for "north-south local boundary"
-      !!----------------------------------------------------------------------
-      INTEGER ::   ji, jj, js               ! dummy loop indices
-      INTEGER ::   ii, ij                   ! temporary integers
-      INTEGER ::   irestil, irestjl         !    "          "
-      INTEGER ::   ijpi  , ijpj, nlcil      ! temporary logical unit
-      INTEGER ::   nlcjl , nbondil, nbondjl
-      INTEGER ::   nrecil, nrecjl, nldil, nleil, nldjl, nlejl
-      REAL(wp) ::   zidom, zjdom            ! temporary scalars
-      INTEGER, POINTER, DIMENSION(:,:) ::   iimpptl, ijmpptl, ilcitl, ilcjtl   ! temporary workspace
-      !!----------------------------------------------------------------------
-      !
-      CALL wrk_alloc( isplt, jsplt, ilcitl, ilcjtl, iimpptl, ijmpptl )
-      !
-      ! Dimension arrays for subdomains
-      ! -------------------------------
-      !  Computation of local domain sizes ilcitl() ilcjtl()
-      !  These dimensions depend on global sizes isplt,jsplt and jpiglo,jpjglo
-      !  The subdomains are squares leeser than or equal to the global
-      !  dimensions divided by the number of processors minus the overlap
-      !  array (cf. par_oce.F90).
-
-      ijpi = ( jpiglo-2*jpreci + (isplt-1) ) / isplt + 2*jpreci
-      ijpj = ( jpjglo-2*jprecj + (jsplt-1) ) / jsplt + 2*jprecj
-
-      nrecil  = 2 * jpreci
-      nrecjl  = 2 * jprecj
-      irestil = MOD( jpiglo - nrecil , isplt )
-      irestjl = MOD( jpjglo - nrecjl , jsplt )
-
-      IF(  irestil == 0 )   irestil = isplt
-      DO jj = 1, jsplt
-         DO ji = 1, irestil
-            ilcitl(ji,jj) = ijpi
-         END DO
-         DO ji = irestil+1, isplt
-            ilcitl(ji,jj) = ijpi -1
-         END DO
-      END DO
-      
-      IF( irestjl == 0 )   irestjl = jsplt
-      DO ji = 1, isplt
-         DO jj = 1, irestjl
-            ilcjtl(ji,jj) = ijpj
-         END DO
-         DO jj = irestjl+1, jsplt
-            ilcjtl(ji,jj) = ijpj -1
-         END DO
-      END DO
-      
-      zidom = nrecil
-      DO ji = 1, isplt
-         zidom = zidom + ilcitl(ji,1) - nrecil
-      END DO
-      
-      zjdom = nrecjl
-      DO jj = 1, jsplt
-         zjdom = zjdom + ilcjtl(1,jj) - nrecjl
-      END DO
-
-      ! Index arrays for subdomains
-      ! ---------------------------
-
-      iimpptl(:,:) = 1
-      ijmpptl(:,:) = 1
-      
-      IF( isplt > 1 ) THEN
-         DO jj = 1, jsplt
-            DO ji = 2, isplt
-               iimpptl(ji,jj) = iimpptl(ji-1,jj) + ilcitl(ji-1,jj) - nrecil
-            END DO
-         END DO
-      ENDIF
-
-      IF( jsplt > 1 ) THEN
-         DO jj = 2, jsplt
-            DO ji = 1, isplt
-               ijmpptl(ji,jj) = ijmpptl(ji,jj-1)+ilcjtl(ji,jj-1)-nrecjl
-            END DO
-         END DO
-      ENDIF
-      
-      ! Subdomain description
-      ! ---------------------
-
-      DO js = 1, ijsplt
-         ii = 1 + MOD( js-1, isplt )
-         ij = 1 + (js-1) / isplt
-         nimpptl(js) = iimpptl(ii,ij)
-         njmpptl(js) = ijmpptl(ii,ij)
-         nlcitl (js) = ilcitl (ii,ij)     
-         nlcil       = nlcitl (js)     
-         nlcjtl (js) = ilcjtl (ii,ij)     
-         nlcjl       = nlcjtl (js)
-         nbondjl = -1                                    ! general case
-         IF( js   >  isplt          )   nbondjl = 0      ! first row of processor
-         IF( js   >  (jsplt-1)*isplt )  nbondjl = 1     ! last  row of processor
-         IF( jsplt == 1             )   nbondjl = 2      ! one processor only in j-direction
-         ibonjtl(js) = nbondjl
-         
-         nbondil = 0                                     ! 
-         IF( MOD( js, isplt ) == 1 )   nbondil = -1      !
-         IF( MOD( js, isplt ) == 0 )   nbondil =  1      !
-         IF( isplt            == 1 )   nbondil =  2      ! one processor only in i-direction
-         ibonitl(js) = nbondil
-         
-         nldil =  1   + jpreci
-         nleil = nlcil - jpreci
-         IF( nbondil == -1 .OR. nbondil == 2 )   nldil = 1
-         IF( nbondil ==  1 .OR. nbondil == 2 )   nleil = nlcil
-         nldjl =  1   + jprecj
-         nlejl = nlcjl - jprecj
-         IF( nbondjl == -1 .OR. nbondjl == 2 )   nldjl = 1
-         IF( nbondjl ==  1 .OR. nbondjl == 2 )   nlejl = nlcjl
-         nlditl(js) = nldil
-         nleitl(js) = nleil
-         nldjtl(js) = nldjl
-         nlejtl(js) = nlejl
-      END DO
-      !
-      CALL wrk_dealloc( isplt, jsplt, ilcitl, ilcjtl, iimpptl, ijmpptl )
-      !
-   END SUBROUTINE sub_dom
- 
 #else
    !!----------------------------------------------------------------------
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trc.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trc.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trc.F90	(revision 3680)
@@ -5,5 +5,4 @@
    !!======================================================================
    !! History :   OPA  !  1996-01  (M. Levy)  Original code
-   !!              -   !  1999-07  (M. Levy)  for LOBSTER1 or NPZD model
    !!              -   !  2000-04  (O. Aumont, M.A. Foujols)  HAMOCC3 and P3ZD
    !!   NEMO      1.0  !  2004-03  (C. Ethe)  Free form and module
@@ -25,4 +24,7 @@
    INTEGER, PUBLIC                                                 ::   numnat        !: logicla unit for the passive tracer NAMELIST
    INTEGER, PUBLIC                                                 ::   numstr        !: logical unit for tracer statistics
+   INTEGER, PUBLIC                                                 ::   numrtr        !: logical unit for trc restart (read )
+   INTEGER, PUBLIC                                                 ::   numrtw        !: logical unit for trc restart ( write )
+   LOGICAL, PUBLIC                                                 ::   ln_top_euler  !: boolean term for euler integration in the first timestep
 
    !! passive tracers fields (before,now,after)
@@ -68,5 +70,4 @@
    CHARACTER(len = 80), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ctrcln         !: trccer field long name
    CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ctrcun         !: tracer unit
-   LOGICAL            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_ini     !: Initialisation from data input file
    LOGICAL            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_wri     !: save the tracer or not
 
@@ -76,4 +77,11 @@
       CHARACTER(len = 20)  :: units    !: unit
    END TYPE DIAG
+
+   !! information for inputs
+   !! --------------------------------------------------
+   LOGICAL            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_ini     !: Initialisation from data input file
+   LOGICAL            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_obc     !: Use open boundary condition data
+   LOGICAL            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_sbc     !: Use surface boundary condition data
+   LOGICAL            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_cbc     !: Use coastal boundary condition data
 
    !! additional 2D/3D outputs namelist
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcini.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcini.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcini.F90	(revision 3680)
@@ -21,5 +21,4 @@
    USE trcnam          ! Namelist read
    USE trcini_cfc      ! CFC      initialisation
-   USE trcini_lobster  ! LOBSTER  initialisation
    USE trcini_pisces   ! PISCES   initialisation
    USE trcini_c14b     ! C14 bomb initialisation
@@ -70,6 +69,6 @@
       CALL top_alloc()              ! allocate TOP arrays
 
-      IF( ln_dm2dc .AND. ( lk_pisces .OR. lk_lobster ) )    &
-         &  CALL ctl_stop( ' The diurnal cycle is not compatible with PISCES or LOBSTER  ' )
+      IF( ln_dm2dc .AND. lk_pisces )    &
+         &  CALL ctl_stop( ' The diurnal cycle is not compatible with PISCES ' )
 
       IF( nn_cla == 1 )   &
@@ -101,5 +100,4 @@
       areatot = glob_sum( cvol(:,:,:) )
 
-      IF( lk_lobster )       CALL trc_ini_lobster      ! LOBSTER bio-model
       IF( lk_pisces  )       CALL trc_ini_pisces       ! PISCES  bio-model
       IF( lk_cfc     )       CALL trc_ini_cfc          ! CFC     tracers
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcnam.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcnam.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcnam.F90	(revision 3680)
@@ -21,5 +21,4 @@
    USE trc               ! passive tracers common variables
    USE trcnam_trp        ! Transport namelist
-   USE trcnam_lobster    ! LOBSTER namelist
    USE trcnam_pisces     ! PISCES namelist
    USE trcnam_cfc        ! CFC SMS namelist
@@ -53,5 +52,5 @@
       !! ** Method  : - read passive tracer namelist 
       !!              - read namelist of each defined SMS model
-      !!                ( (LOBSTER, PISCES, CFC, MY_TRC )
+      !!                ( (PISCES, CFC, MY_TRC )
       !!---------------------------------------------------------------------
       INTEGER ::  jn, ierr
@@ -60,5 +59,6 @@
       !!
       NAMELIST/namtrc/ nn_dttrc, nn_writetrc, ln_rsttr, nn_rsttr, &
-         &             cn_trcrst_in, cn_trcrst_out, sn_tracer, ln_trcdta, ln_trcdmp
+         &             cn_trcrst_in, cn_trcrst_out, sn_tracer, ln_trcdta, ln_trcdmp, &
+         &             ln_top_euler
 #if defined key_trdmld_trc  || defined key_trdtrc
       NAMELIST/namtrc_trd/ nn_trd_trc, nn_ctls_trc, rn_ucf_trc, &
@@ -79,4 +79,5 @@
       nn_dttrc      = 1                 ! default values
       nn_writetrc   = 10 
+      ln_top_euler  = .FALSE.
       ln_rsttr      = .FALSE.
       nn_rsttr      =  0
@@ -120,4 +121,5 @@
          WRITE(numout,*) '   Read inputs data from file (y/n)             ln_trcdta     = ', ln_trcdta
          WRITE(numout,*) '   Damping of passive tracer (y/n)              ln_trcdmp     = ', ln_trcdmp
+         WRITE(numout,*) '   Use euler integration for TRC (y/n)          ln_top_euler  = ', ln_top_euler
          WRITE(numout,*) ' '
          DO jn = 1, jptra
@@ -234,8 +236,4 @@
       ! namelist of SMS
       ! ---------------      
-      IF( lk_lobster ) THEN   ;   CALL trc_nam_lobster      ! LOBSTER bio-model
-      ELSE                    ;   IF(lwp) WRITE(numout,*) '          LOBSTER not used'
-      ENDIF
-
       IF( lk_pisces  ) THEN   ;   CALL trc_nam_pisces      ! PISCES  bio-model
       ELSE                    ;   IF(lwp) WRITE(numout,*) '          PISCES not used'
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcrst.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcrst.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcrst.F90	(revision 3680)
@@ -27,9 +27,4 @@
    USE trcnam_trp
    USE iom
-   USE trcrst_cfc      ! CFC      
-   USE trcrst_lobster  ! LOBSTER  restart
-   USE trcrst_pisces   ! PISCES   restart
-   USE trcrst_c14b     ! C14 bomb restart
-   USE trcrst_my_trc   ! MY_TRC   restart
    USE daymod
    IMPLICIT NONE
@@ -40,6 +35,4 @@
    PUBLIC   trc_rst_wri       ! called by ???
    PUBLIC   trc_rst_cal
-
-   INTEGER, PUBLIC ::   numrtr, numrtw   !: logical unit for trc restart (read and write)
 
    !! * Substitutions
@@ -115,12 +108,4 @@
          CALL iom_get( numrtr, jpdom_autoglo, 'TRB'//ctrcnm(jn), trb(:,:,:,jn) )
       END DO
-
-      IF( lk_lobster )   CALL trc_rst_read_lobster( numrtr )      ! LOBSTER bio-model
-      IF( lk_pisces  )   CALL trc_rst_read_pisces ( numrtr )      ! PISCES  bio-model
-      IF( lk_cfc     )   CALL trc_rst_read_cfc    ( numrtr )      ! CFC     tracers
-      IF( lk_c14b    )   CALL trc_rst_read_c14b   ( numrtr )      ! C14 bomb  tracer
-      IF( lk_my_trc  )   CALL trc_rst_read_my_trc ( numrtr )      ! MY_TRC  tracers
-
-      CALL iom_close( numrtr )
       !
    END SUBROUTINE trc_rst_read
@@ -138,5 +123,4 @@
       !!----------------------------------------------------------------------
       !
-      CALL trc_rst_cal( kt, 'WRITE' )   ! calendar
       CALL iom_rstput( kt, nitrst, numrtw, 'rdttrc1', rdttrc(1) )   ! surface passive tracer time step
       ! prognostic variables 
@@ -149,11 +133,5 @@
          CALL iom_rstput( kt, nitrst, numrtw, 'TRB'//ctrcnm(jn), trb(:,:,:,jn) )
       END DO
-
-      IF( lk_lobster )   CALL trc_rst_wri_lobster( kt, nitrst, numrtw )      ! LOBSTER bio-model
-      IF( lk_pisces  )   CALL trc_rst_wri_pisces ( kt, nitrst, numrtw )      ! PISCES  bio-model
-      IF( lk_cfc     )   CALL trc_rst_wri_cfc    ( kt, nitrst, numrtw )      ! CFC     tracers
-      IF( lk_c14b    )   CALL trc_rst_wri_c14b   ( kt, nitrst, numrtw )      ! C14 bomb  tracer
-      IF( lk_my_trc  )   CALL trc_rst_wri_my_trc ( kt, nitrst, numrtw )      ! MY_TRC  tracers
-
+      !
       IF( kt == nitrst ) THEN
           CALL trc_rst_stat            ! statistics
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcsms.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcsms.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcsms.F90	(revision 3680)
@@ -15,5 +15,4 @@
    USE oce_trc            !
    USE trc                !
-   USE trcsms_lobster     ! LOBSTER bio-model
    USE trcsms_pisces      ! PISCES biogeo-model
    USE trcsms_cfc         ! CFC 11 & 12
@@ -49,5 +48,4 @@
       IF( nn_timing == 1 )   CALL timing_start('trc_sms')
       !
-      IF( lk_lobster )   CALL trc_sms_lobster( kt )    ! main program of LOBSTER
       IF( lk_pisces  )   CALL trc_sms_pisces ( kt )    ! main program of PISCES 
       IF( lk_cfc     )   CALL trc_sms_cfc    ( kt )    ! surface fluxes of CFC
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcstp.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcstp.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcstp.F90	(revision 3680)
@@ -78,4 +78,5 @@
          !
                                    CALL trc_rst_opn  ( kt )       ! Open tracer restart file 
+         IF( lrst_trc )            CALL trc_rst_cal  ( kt, 'WRITE' )   ! calendar
          IF( lk_iomput ) THEN  ;   CALL trc_wri      ( kt )       ! output of passive tracers with iom I/O manager
          ELSE                  ;   CALL trc_dia      ( kt )       ! output of passive tracers with old I/O manager
@@ -83,4 +84,5 @@
                                    CALL trc_sms      ( kt )       ! tracers: sinks and sources
                                    CALL trc_trp      ( kt )       ! transport of passive tracers
+         IF( kt == nittrc000 )     CALL iom_close( numrtr )       ! close input tracer restart file
          IF( lrst_trc )            CALL trc_rst_wri  ( kt )       ! write tracer restart file
          IF( lk_trdmld_trc  )      CALL trd_mld_trc  ( kt )       ! trends: Mixed-layer
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcsub.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcsub.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcsub.F90	(revision 3680)
@@ -29,4 +29,7 @@
    USE sbc_oce         ! surface boundary condition: ocean
    USE bdy_oce
+#if defined key_obc
+   USE obc_oce, ONLY: obctmsk
+#endif
 #if defined key_agrif
    USE agrif_opa_update
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcwri.F90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcwri.F90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/TOP_SRC/trcwri.F90	(revision 3680)
@@ -18,4 +18,7 @@
    USE dianam      ! Output file name
    USE trcwri_pisces
+   USE trcwri_cfc
+   USE trcwri_c14b
+   USE trcwri_my_trc
 
    IMPLICIT NONE
@@ -69,12 +72,8 @@
       ! write the tracer concentrations in the file
       ! ---------------------------------------
-      IF( lk_pisces )  THEN
-         CALL trc_wri_pisces
-      ELSE
-         DO jn = 1, jptra
-            cltra = TRIM( ctrcnm(jn) )                  ! short title for tracer
-            CALL iom_put( cltra, trn(:,:,:,jn) )
-         END DO
-      ENDIF
+      IF( lk_pisces  )   CALL trc_wri_pisces     ! PISCES 
+      IF( lk_cfc     )   CALL trc_wri_cfc        ! surface fluxes of CFC
+      IF( lk_c14b    )   CALL trc_wri_c14b       ! surface fluxes of C14
+      IF( lk_my_trc  )   CALL trc_wri_my_trc     ! MY_TRC  tracers
       !
    END SUBROUTINE trc_wri_trc
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-X64_CURIE
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-X64_CURIE	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-X64_CURIE	(revision 3680)
@@ -0,0 +1,78 @@
+#!/bin/bash
+#MSUB -T 3600                # elapsed time limit in seconds   (60 minutes)
+#MSUB -r SETTE_JOB           # Job name
+#MSUB -o sette.jobid_%I.txt  # standard output
+#MSUB -e sette.jobid_%I.txt  # standard error
+
+#======   Thin nodes (1 node = 2 * 8 procs) :   
+#MSUB -n NPROCS              # Total number of mpi task to use
+####  #MSUB -N 2                   # number of nodes to use
+#MSUB -A gen0826             # project name
+#MSUB -q standard            # (queue name) only for thin nodes
+##########################################################################
+#
+# Test specific settings. Do not hand edit these lines; the fcm_job.sh script will set these
+# (via sed operating on this template job file). 
+#
+  OCEANCORES=NPROCS
+  export SETTE_DIR=DEF_SETTE_DIR
+#
+# set up mpp computing environment
+#
+# Local settings for machine BULL (TITANE at CCRT France)
+#
+export MPIRUN="ccc_mprun -np $OCEANCORES"
+
+#
+# load sette functions (only post_test_tidyup needed)
+#
+  . ${SETTE_DIR}/all_functions.sh
+#
+
+# modules to load
+module load netcdf
+
+# Don't remove neither change the following line
+# BODY
+
+#
+# These variables are needed by post_test_tidyup function in all_functions.sh
+#
+  export EXE_DIR=DEF_EXE_DIR
+  export INPUT_DIR=DEF_INPUT_DIR
+  export CONFIG_DIR=DEF_CONFIG_DIR
+  export NEMO_VALIDATION_DIR=DEF_NEMO_VALIDATION
+  export NEW_CONF=DEF_NEW_CONF
+  export CMP_NAM=DEF_CMP_NAM
+  export TEST_NAME=DEF_TEST_NAME
+#
+# end of set up
+###############################################################
+#
+# change to the working directory 
+#
+cd ${EXE_DIR}
+
+  echo Running on host `hostname`
+  echo Time is `date`
+  echo Directory is `pwd`
+# 
+#  Run the parallel MPI executable 
+#
+  echo "Running time ${MPIRUN} ./opa"
+#
+  if [ MPI_FLAG == "yes" ]; then
+     time ${MPIRUN} ./opa
+  else
+     time ./opa
+  fi
+
+#
+  post_test_tidyup
+
+# END_BODY
+# Don't remove neither change the previous line
+
+
+  exit
+
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/SETTE/input_AMM12.cfg
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/SETTE/input_AMM12.cfg	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/SETTE/input_AMM12.cfg	(revision 3680)
@@ -1,1 +1,1 @@
-amm12_inputs_v3_4.tar
+amm12_inputs_v3_4_spinup.tar 
Index: anches/2012/dev_MERGE_2012/NEMOGCM/SETTE/input_AMM12_PISCES.cfg
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/SETTE/input_AMM12_PISCES.cfg	(revision 3679)
+++ 	(revision )
@@ -1,1 +1,0 @@
-amm12_inputs_v3_4.tar
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/SETTE/prepare_job.sh
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/SETTE/prepare_job.sh	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/SETTE/prepare_job.sh	(revision 3680)
@@ -149,4 +149,24 @@
 fi
 ################################################################
+
+##########################################################################
+# COPY RESTART FILES (if needed; i.e. only for SHORT job in RESTART TESTS)
+# get the input tarfile if needed
+# SF : not ok for the moment because at this point is needed cn_exp variable,
+# SF : here it it not known.
+#\cd ${EXE_DIR}
+#if [ "$(echo ${TEST_NAME} | grep -c "SHORT" )" -ne 0 ] ; then
+#    for (( i=1; i<=${NB_PROC}; ${NB_PROC}++)) ; do
+#        L_NPROC=`printf "%04d\n" $i`
+#        ln -sf ../LONG/${NEW_CONF}_00000060_restart_${L_NPROC-1}.nc .
+#    done
+#fi
+## SF : other way
+##      for file in ../LONG/${NEW_CONF}_*restart_0*.nc ; do
+##              ncpu=`echo $file | awk -F '_' '{print $NF}' | cut -f 1 -d '.'`
+##              ln -sf ${file}  .
+##      done
+##fi
+##########################################################################
 
 ################################################################
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/SETTE/sette.sh
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/SETTE/sette.sh	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/SETTE/sette.sh	(revision 3680)
@@ -41,9 +41,9 @@
 # BATCH_COMMAND :  name of the command for batch submission
 #
-# MPI_INTERACT :  
-#
-#         for MPP tests, "no" for batch execution, "yes" for interactive execution 
-#
-#         NOTE: for run with 1 process tests are run always in MPI_INTERACT="yes"
+# INTERACT_FLAG :  flag to run in interactive mode "yes"
+#                       to run in batch mode "no"
+#
+# MPIRUN_FLAG   :  flag to run in parallel (MPI) "yes"
+#                       to run in sequential mode (NB_PROC = 1) "no"
 #
 # Principal script is sette.sh, that calls 
@@ -84,9 +84,11 @@
 #
 #
+#  prepare_job.sh
+#
+#  to generate the script run_job.sh
+#
 #  fcm_job.sh 
 #
-#   runs job in interactive or batch mode : all jobs using 1 process are run interactive, and all MPP jobs are
-#
-#   run in batch (MPI_INTERACT="no") or interactive (MPI_INTERACT="yes") see sette.sh and BATCH_TEMPLATE directory
+#   run in batch (INTERACT_FLAG="no") or interactive (INTERACT_FLAG="yes") see sette.sh and BATCH_TEMPLATE directory
 #
 #   (note this job needs to have an input_CONFIG.cfg in which can be found input tar file)
@@ -121,5 +123,5 @@
 # ==========
 #
-# $Id:$
+# $Id$
 #
 #   * creation
@@ -135,4 +137,5 @@
 export MPIRUN_FLAG="yes"
 
+
 # Directory to run the tests
 SETTE_DIR=$(cd $(dirname "$0"); pwd)
@@ -150,10 +153,10 @@
 do
 
-# TESTS FOR GYRE_LOBSTER CONFIGURATION
+# TESTS FOR GYRE CONFIGURATION
 if [ ${config} -eq 1 ] ;  then
-    ## Restartability tests for GYRE_LOBSTER
+    ## Restartability tests for GYRE
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n GYRELOB_LONG -r GYRE_LOBSTER add_key "key_mpp_mpi"
+    . ../CONFIG/makenemo -m ${CMP_NAM} -n GYRE_LONG -r GYRE -j 8 add_key "key_mpp_mpi" 
     cd ${SETTE_DIR}
     . param.cfg
@@ -164,5 +167,5 @@
     \rm ${JOB_FILE}
     cd ${EXE_DIR}
-    set_namelist namelist cn_exp \"GYRELOB_LONG\"
+    set_namelist namelist cn_exp \"GYRE_LONG\"
     set_namelist namelist nn_it000 1
     set_namelist namelist nn_itend 120
@@ -170,5 +173,4 @@
     set_namelist namelist ln_clobber .true.
     set_namelist namelist nn_solv 2
-    set_namelist namelist_top ln_diatrc .false.
     set_namelist namelist jpni 2
     set_namelist namelist jpnj 2
@@ -181,5 +183,5 @@
     . prepare_exe_dir.sh
     cd ${EXE_DIR}
-    set_namelist namelist cn_exp \"GYRELOB_SHORT\"
+    set_namelist namelist cn_exp \"GYRE_SHORT\"
     set_namelist namelist nn_it000 61
     set_namelist namelist nn_itend 120
@@ -192,14 +194,9 @@
     set_namelist namelist jpnj 2
     set_namelist namelist jpnij 4
-    set_namelist namelist cn_ocerst_in \"GYRELOB_LONG_00000060_restart\"
-    set_namelist namelist_top cn_trcrst_in \"GYRELOB_LONG_00000060_restart_trc\"
-    set_namelist namelist_top ln_diatrc .false.
-    set_namelist namelist_top ln_rsttr .true.
-    set_namelist namelist_top nn_rsttr 2
+    set_namelist namelist cn_ocerst_in \"GYRE_LONG_00000060_restart\"
     for (( i=1; i<=$NPROC; i++)) ; do
         L_NPROC=$(( $i - 1 ))
         L_NPROC=`printf "%04d\n" ${L_NPROC}`
-        ln -sf ../LONG/GYRELOB_LONG_00000060_restart_${L_NPROC}.nc .
-        ln -sf ../LONG/GYRELOB_LONG_00000060_restart_trc_${L_NPROC}.nc .
+        ln -sf ../LONG/GYRE_LONG_00000060_restart_${L_NPROC}.nc .
     done
     cd ${SETTE_DIR}
@@ -210,8 +207,8 @@
 
 if [ ${config} -eq 2 ] ;  then
-    ## Repropducibility tests for GYRE_LOBSTER
+    ## Reproducibility tests for GYRE
     export TEST_NAME="REPRO_1_4"
     cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n GYRELOB_4 -r GYRE_LOBSTER add_key "key_mpp_mpi key_mpp_rep"
+    . ../CONFIG/makenemo -m ${CMP_NAM} -n GYRE_4 -r GYRE -j 8 add_key "key_mpp_mpi key_mpp_rep"
     cd ${SETTE_DIR}
     . param.cfg
@@ -222,5 +219,5 @@
     \rm ${JOB_FILE}
     cd ${EXE_DIR}
-    set_namelist namelist cn_exp \"GYRELOB_14\"
+    set_namelist namelist cn_exp \"GYRE_14\"
     set_namelist namelist nn_it000 1
     set_namelist namelist nn_itend 60
@@ -230,6 +227,4 @@
     set_namelist namelist ln_clobber .true.
     set_namelist namelist nn_solv 2
-    set_namelist namelist_top ln_diatrc .false.
-    set_namelist namelist_top ln_trcdta .false.
     set_namelist namelist jpni 1
     set_namelist namelist jpnj 4
@@ -243,6 +238,9 @@
     export TEST_NAME="REPRO_2_2"
     . prepare_exe_dir.sh
-    cd ${EXE_DIR}
-    set_namelist namelist cn_exp \"GYRELOB_22\"
+    JOB_FILE=${EXE_DIR}/run_job.sh
+    NPROC=4
+    \rm $JOB_FILE
+    cd ${EXE_DIR}
+    set_namelist namelist cn_exp \"GYRE_22\"
     set_namelist namelist nn_it000 1
     set_namelist namelist nn_itend 60
@@ -251,6 +249,4 @@
     set_namelist namelist ln_clobber .true.
     set_namelist namelist nn_solv 2
-    set_namelist namelist_top ln_diatrc .false.
-    set_namelist namelist_top ln_trcdta .false.
     set_namelist namelist jpni 2
     set_namelist namelist jpnj 2
@@ -268,5 +264,5 @@
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2LIMPIS_LONG -r ORCA2_LIM_PISCES -j 8 add_key "key_mpp_mpi" 
+    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2LIMPIS_LONG -r ORCA2_LIM_PISCES -j 8 add_key "key_mpp_mpi"
     cd ${SETTE_DIR}
     . param.cfg
@@ -290,9 +286,12 @@
     # put ln_ironsed, ln_river, ln_ndepo, ln_dust to false
     # if not you need input files, and for tests is not necessary
-    set_namelist namelist_pisces ln_ironsed .false.
+    set_namelist namelist_pisces ln_presatm .false.
+    set_namelist namelist_pisces ln_varpar .false.
+    set_namelist namelist_pisces ln_dust .false.
+    set_namelist namelist_pisces ln_solub .false.
     set_namelist namelist_pisces ln_river .false.
     set_namelist namelist_pisces ln_ndepo .false.
-    set_namelist namelist_pisces ln_dust .false.
-    set_namelist namelist_pisces ln_presatm .false.
+    set_namelist namelist_pisces ln_ironsed .false.
+    set_namelist namelist_pisces ln_hydrofe .false.
     cd ${SETTE_DIR}
     . ./prepare_job.sh input_ORCA2_LIM_PISCES.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
@@ -313,17 +312,22 @@
     set_namelist namelist jpnij 4
     set_namelist namelist nn_solv 2
+    set_namelist namelist_top ln_diatrc .false.
+    set_namelist namelist_top ln_rsttr .true.
+    set_namelist namelist_top nn_rsttr 2
     set_namelist namelist cn_ocerst_in \"O2LP_LONG_00000075_restart\"
     set_namelist namelist_ice cn_icerst_in \"O2LP_LONG_00000075_restart_ice\"
     set_namelist namelist_top cn_trcrst_in \"O2LP_LONG_00000075_restart_trc\"
-    set_namelist namelist_top ln_diatrc .false.
-    set_namelist namelist_top ln_rsttr .true.
-    set_namelist namelist_top nn_rsttr 2
     # put ln_ironsed, ln_river, ln_ndepo, ln_dust
     # if not you need input files, and for tests is not necessary
-    set_namelist namelist_pisces ln_ironsed .false.
+    set_namelist namelist_pisces ln_presatm .false.
+    set_namelist namelist_pisces ln_varpar .false.
+    set_namelist namelist_pisces ln_dust .false.
+    set_namelist namelist_pisces ln_solub .false.
     set_namelist namelist_pisces ln_river .false.
     set_namelist namelist_pisces ln_ndepo .false.
-    set_namelist namelist_pisces ln_dust .false.
-    set_namelist namelist_pisces ln_presatm .false.
+    set_namelist namelist_pisces ln_ironsed .false.
+    set_namelist namelist_pisces ln_hydrofe .false.
+    # put ln_pisdmp to false : no restoring to global mean value
+    set_namelist namelist_pisces ln_pisdmp .false.
     for (( i=1; i<=$NPROC; i++)) ; do
         L_NPROC=$(( $i - 1 ))
@@ -340,8 +344,8 @@
 
 if [ ${config} -eq 4 ] ;  then
-    ## Repropducibility tests for ORCA2_LIM_PISCES
+    ## Reproducibility tests for ORCA2_LIM_PISCES
     export TEST_NAME="REPRO_4_4"
     cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2LIMPIS_16 -r ORCA2_LIM_PISCES -j 8 add_key "key_mpp_rep key_mpp_mpi"
+    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2LIMPIS_16 -r ORCA2_LIM_PISCES -j 8 add_key "key_mpp_mpi key_mpp_rep"
     cd ${SETTE_DIR}
     . param.cfg
@@ -365,9 +369,14 @@
     # put ln_ironsed, ln_river, ln_ndepo, ln_dust to false
     # if not you need input files, and for tests is not necessary
-    set_namelist namelist_pisces ln_ironsed .false.
+    set_namelist namelist_pisces ln_presatm .false.
+    set_namelist namelist_pisces ln_varpar .false.
+    set_namelist namelist_pisces ln_dust .false.
+    set_namelist namelist_pisces ln_solub .false.
     set_namelist namelist_pisces ln_river .false.
     set_namelist namelist_pisces ln_ndepo .false.
-    set_namelist namelist_pisces ln_dust .false.
-    set_namelist namelist_pisces ln_presatm .false.
+    set_namelist namelist_pisces ln_ironsed .false.
+    set_namelist namelist_pisces ln_hydrofe .false.
+    # put ln_pisdmp to false : no restoring to global mean value
+    set_namelist namelist_pisces ln_pisdmp .false.
     cd ${SETTE_DIR}
     . ./prepare_job.sh input_ORCA2_LIM_PISCES.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
@@ -378,9 +387,11 @@
     export TEST_NAME="REPRO_2_8"
     . prepare_exe_dir.sh
+    JOB_FILE=${EXE_DIR}/run_job.sh
+    NPROC=16
+    \rm $JOB_FILE
     cd ${EXE_DIR}
     set_namelist namelist nn_it000 1
     set_namelist namelist nn_itend 75
     set_namelist namelist nn_fwb 0
-    set_namelist namelist ln_ctl .false.
     set_namelist namelist ln_clobber .true.
     set_namelist namelist jpni 2
@@ -392,9 +403,14 @@
     # put ln_ironsed, ln_river, ln_ndepo, ln_dust to false
     # if not you need input files, and for tests is not necessary
-    set_namelist namelist_pisces ln_ironsed .false.
+    set_namelist namelist_pisces ln_presatm .false.
+    set_namelist namelist_pisces ln_varpar .false.
+    set_namelist namelist_pisces ln_dust .false.
+    set_namelist namelist_pisces ln_solub .false.
     set_namelist namelist_pisces ln_river .false.
     set_namelist namelist_pisces ln_ndepo .false.
-    set_namelist namelist_pisces ln_dust .false.
-    set_namelist namelist_pisces ln_presatm .false.
+    set_namelist namelist_pisces ln_ironsed .false.
+    set_namelist namelist_pisces ln_hydrofe .false.
+    # put ln_pisdmp to false : no restoring to global mean value
+    set_namelist namelist_pisces ln_pisdmp .false.
     cd ${SETTE_DIR}
     . ./prepare_job.sh input_ORCA2_LIM_PISCES.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
@@ -408,5 +424,5 @@
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2OFFPIS_LONG -r ORCA2_OFF_PISCES -j 8 add_key "key_mpp_mpi key_mpp_rep"
+    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2OFFPIS_LONG -r ORCA2_OFF_PISCES -j 8 add_key "key_mpp_mpi key_mpp_rep" 
     cd ${SETTE_DIR}
     . param.cfg
@@ -429,9 +445,14 @@
     # put ln_ironsed, ln_river, ln_ndepo, ln_dust to false
     # if not you need input files, and for tests is not necessary
-    set_namelist namelist_pisces ln_ironsed .false.
+    set_namelist namelist_pisces ln_presatm .false.
+    set_namelist namelist_pisces ln_varpar .false.
+    set_namelist namelist_pisces ln_dust .false.
+    set_namelist namelist_pisces ln_solub .false.
     set_namelist namelist_pisces ln_river .false.
     set_namelist namelist_pisces ln_ndepo .false.
-    set_namelist namelist_pisces ln_dust .false.
-    set_namelist namelist_pisces ln_presatm .false.
+    set_namelist namelist_pisces ln_ironsed .false.
+    set_namelist namelist_pisces ln_hydrofe .false.
+    # put ln_pisdmp to false : no restoring to global mean value
+    set_namelist namelist_pisces ln_pisdmp .false.
     cd ${SETTE_DIR}
     . ./prepare_job.sh input_ORCA2_OFF_PISCES.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
@@ -440,7 +461,4 @@
     export TEST_NAME="SHORT"
     . prepare_exe_dir.sh
-    JOB_FILE=${EXE_DIR}/run_job.sh
-    NPROC=4
-    \rm $JOB_FILE
     cd ${EXE_DIR}
     set_namelist namelist cn_exp \"OFFP_SHORT\"
@@ -452,5 +470,4 @@
     set_namelist namelist jpnj 2
     set_namelist namelist jpnij 4
-    cp ../LONG/OFFP_LONG_00000020_restart*nc .
     set_namelist namelist_top ln_diatrc .false.
     set_namelist namelist_top ln_rsttr .true.
@@ -464,9 +481,14 @@
     # put ln_ironsed, ln_river, ln_ndepo, ln_dust
     # if not you need input files, and for tests is not necessary
-    set_namelist namelist_pisces ln_ironsed .false.
+    set_namelist namelist_pisces ln_presatm .false.
+    set_namelist namelist_pisces ln_varpar .false.
+    set_namelist namelist_pisces ln_dust .false.
+    set_namelist namelist_pisces ln_solub .false.
     set_namelist namelist_pisces ln_river .false.
     set_namelist namelist_pisces ln_ndepo .false.
-    set_namelist namelist_pisces ln_dust .false.
-    set_namelist namelist_pisces ln_presatm .false.
+    set_namelist namelist_pisces ln_ironsed .false.
+    set_namelist namelist_pisces ln_hydrofe .false.
+    # put ln_pisdmp to false : no restoring to global mean value
+    set_namelist namelist_pisces ln_pisdmp .false.
     cd ${SETTE_DIR}
     . ./prepare_job.sh input_ORCA2_OFF_PISCES.cfg $NPROC ${TEST_NAME}  ${MPIRUN_FLAG} ${JOB_FILE}
@@ -476,8 +498,8 @@
 
 if [ ${config} -eq 6 ] ;  then
-    ## Repropducibility tests for ORCA2_OFF_PISCES
+    ## Reproducibility tests for ORCA2_OFF_PISCES
     export TEST_NAME="REPRO_4_4"
     cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2OFFPIS_16 -r ORCA2_OFF_PISCES -j 8 add_key "key_mpp_rep key_mpp_mpi"
+    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2OFFPIS_16 -r ORCA2_OFF_PISCES -j 8 add_key "key_mpp_mpi key_mpp_rep"
     cd ${SETTE_DIR}
     . param.cfg
@@ -499,9 +521,14 @@
     # put ln_ironsed, ln_river, ln_ndepo, ln_dust to false
     # if not you need input files, and for tests is not necessary
-    set_namelist namelist_pisces ln_ironsed .false.
+    set_namelist namelist_pisces ln_presatm .false.
+    set_namelist namelist_pisces ln_varpar .false.
+    set_namelist namelist_pisces ln_dust .false.
+    set_namelist namelist_pisces ln_solub .false.
     set_namelist namelist_pisces ln_river .false.
     set_namelist namelist_pisces ln_ndepo .false.
-    set_namelist namelist_pisces ln_dust .false.
-    set_namelist namelist_pisces ln_presatm .false.
+    set_namelist namelist_pisces ln_ironsed .false.
+    set_namelist namelist_pisces ln_hydrofe .false.
+    # put ln_pisdmp to false : no restoring to global mean value
+    set_namelist namelist_pisces ln_pisdmp .false.
     cd ${SETTE_DIR}
     . ./prepare_job.sh input_ORCA2_OFF_PISCES.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
@@ -512,4 +539,7 @@
     export TEST_NAME="REPRO_2_8"
     . prepare_exe_dir.sh
+    JOB_FILE=${EXE_DIR}/run_job.sh
+    NPROC=16
+    \rm $JOB_FILE
     cd ${EXE_DIR}
     set_namelist namelist nn_it000 1
@@ -524,9 +554,14 @@
     # put ln_ironsed, ln_river, ln_ndepo, ln_dust to false
     # if not you need input files, and for tests is not necessary
-    set_namelist namelist_pisces ln_ironsed .false.
+    set_namelist namelist_pisces ln_presatm .false.
+    set_namelist namelist_pisces ln_varpar .false.
+    set_namelist namelist_pisces ln_dust .false.
+    set_namelist namelist_pisces ln_solub .false.
     set_namelist namelist_pisces ln_river .false.
     set_namelist namelist_pisces ln_ndepo .false.
-    set_namelist namelist_pisces ln_dust .false.
-    set_namelist namelist_pisces ln_presatm .false.
+    set_namelist namelist_pisces ln_ironsed .false.
+    set_namelist namelist_pisces ln_hydrofe .false.
+    # put ln_pisdmp to false : no restoring to global mean value
+    set_namelist namelist_pisces ln_pisdmp .false. 
     cd ${SETTE_DIR}
     . ./prepare_job.sh input_ORCA2_OFF_PISCES.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
@@ -535,9 +570,10 @@
 fi
 
+# TESTS FOR AMM12 CONFIGURATION
 if [ ${config} -eq 7 ] ;  then
     ## Restartability tests for AMM12
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n AMM12_LONG -r AMM12  add_key "key_tide"
+    . ../CONFIG/makenemo -m ${CMP_NAM} -n AMM12_LONG -r AMM12 -j 8
     cd ${SETTE_DIR}
     . param.cfg
@@ -556,4 +592,5 @@
     set_namelist namelist nn_dyn2d 2
     set_namelist namelist nn_tra_dta 0
+    set_namelist namelist cn_ocerst_in amm12.restart_20070101
     set_namelist namelist jpni 8
     set_namelist namelist jpnj 4
@@ -591,8 +628,8 @@
 
 if [ ${config} -eq 8 ] ;  then
-    ## Reproducibility tests for AMM12
-    export TEST_NAME="REPO_8_4"
-    cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n AMM12_32 -r AMM12 add_key "key_mpp_rep key_tide"
+## Reproducibility tests for AMM12
+    export TEST_NAME="REPRO_8_4"
+    cd ${SETTE_DIR}
+    . ../CONFIG/makenemo -m ${CMP_NAM} -n AMM12_32 -r AMM12 -j 8 add_key "key_mpp_rep"
     cd ${SETTE_DIR}
     . param.cfg
@@ -610,4 +647,5 @@
     set_namelist namelist nn_dyn2d 2
     set_namelist namelist nn_tra_dta 0
+    set_namelist namelist cn_ocerst_in amm12.restart_20070101
     set_namelist namelist jpni 8
     set_namelist namelist jpnj 4
@@ -619,5 +657,5 @@
 
     cd ${SETTE_DIR}
-    export TEST_NAME="REPO_4_8"
+    export TEST_NAME="REPRO_4_8"
     . prepare_exe_dir.sh
     cd ${EXE_DIR}
@@ -629,4 +667,5 @@
     set_namelist namelist nn_tra_dta 0
     set_namelist namelist ln_clobber .true.
+    set_namelist namelist cn_ocerst_in amm12.restart_20070101
     set_namelist namelist jpni 4
     set_namelist namelist jpnj 8
@@ -643,5 +682,5 @@
     export TEST_NAME="SHORT"
     cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2AGUL_1_2 -r ORCA2_LIM -j 8 add_key "key_mpp_rep key_mpp_mpi key_agrif" del_key "key_zdftmx"
+    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2AGUL_1_2 -r ORCA2_LIM -j 8 add_key "key_mpp_mpi key_mpp_rep key_agrif" del_key "key_zdftmx"
     cd ${SETTE_DIR}
     . param.cfg
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/SETTE/sette_beginner.sh
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/SETTE/sette_beginner.sh	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/SETTE/sette_beginner.sh	(revision 3680)
@@ -38,5 +38,5 @@
 #
 # Compiler among those in NEMOGCM/ARCH
-COMPILER=PW6_VARGAS
+COMPILER=gfortran_osx
 export BATCH_COMMAND_PAR="llsubmit"
 export BATCH_COMMAND_SEQ=$BATCH_COMMAND_PAR
@@ -58,6 +58,6 @@
 # Run for GYRE CONFIG
 # small test to start
-# compile GYRE configuration with gfortran_osx compiler run with 1 proc, by default in cpp_GYRE.fcm file : 
-export TEST_NAME="prova_beginner"
+# compile GYRE configuration with gfortran_osx compiler run with 4 proc : 
+export TEST_NAME="SHORT_TEST"
 cd ${SETTE_DIR}
 . ../CONFIG/makenemo -m ${CMP_NAM} -n GYRE_SHORT -r GYRE -j 10 add_key "key_mpp_mpi"
@@ -83,5 +83,5 @@
 cd ${SETTE_DIR}
 . ./prepare_job.sh input_GYRE.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
-# run job, with 1 processor, test named SHORT (= 60 time steps)
+# run job, with 4 processors, test named SHORT (= 60 time steps)
 cd ${SETTE_DIR}   
-. ./fcm_job.sh 4 ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
+. ./fcm_job.sh $NRPOC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/Fmake_WORK.sh
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/Fmake_WORK.sh	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/Fmake_WORK.sh	(revision 3680)
@@ -99,5 +99,6 @@
    if [ "${ZTAB[i]}" != "OPA_SRC" ]; then
       ln -sf ${NEMO_DIR}/${ZTAB[i]}/*.[Ffh]90 ${ZCONF}/WORK
-      ln -sf ${NEMO_DIR}/${ZTAB[i]}/*/*.[Ffh]90 ${ZCONF}/WORK 2>/dev/null
+      ln -sf ${NEMO_DIR}/${ZTAB[i]}/*/*.[Ffh]90 ${ZCONF}/WORK 
+      ln -sf ${NEMO_DIR}/${ZTAB[i]}/*/*/*.[Ffh]90 ${ZCONF}/WORK 2>/dev/null
    fi
    let i=$i+1
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/agrifpp.sh
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/agrifpp.sh	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/agrifpp.sh	(revision 3680)
@@ -26,5 +26,9 @@
 #
 #
-# Look after key agrif, if yes the conv is used, otherwise standard pre-processing is performed.
+# Preprocess file using the conv in OPAFILES directory
+# Standard preprocessed files are stored in OPAFILES/ppsrc/nemo
+# Source files are stored under OPAFILES/obj
+# Include filess  in OPAFILES/inc
+# Note that agrif2model.F90 should not be preprocess (standard one) 
 #
 # EXAMPLES
@@ -33,10 +37,6 @@
 # ::
 #
-#  $ ./agrifpp.sh 1 -Dkey
+#  $ ./agrifpp.sh FILE_TO_PROCESS
 # 
-#  or
-#
-#  $ ./agrifpp.sh -Dkey
-#
 # TODO
 # ====
@@ -55,35 +55,8 @@
 #
 #-
-
-if [ "$1" == "1" ]; then
-   shift
-   MYFILE=`echo $* |awk -F" " '{print $NF}' `  
-   FPP_OPT=` echo $* |awk '{  for (i=1 ; i<NF ; i++ )  { printf " %s",  $i } }'`
-
-
-   if [ "${MYFILE}" != "par_oce.F90" -a  ! -f ${NEMO_TDIR}/${NEW_CONF}}/OPAFILES/param_done ]; then
-      cpp ${FPP_OPT} ${CONFIG_DIR}/${NEW_CONF}/WORK/par_oce.F90 > ${NEMO_TDIR}/${NEW_CONF}/OPAFILES/par_oce.F90
-      (cd ${NEMO_TDIR}/${NEW_CONF}/OPAFILES ; ${NEMO_TDIR}/${NEW_CONF}/OPAFILES/conv agrif_opa.in -rm -comdirin ./ -comdirout AGRIF_MODELFILES/ -convfile par_oce.F90 > /dev/null )
-      cpp ${FPP_OPT}  -I${NEMO_TDIR}/${NEW_CONF}/OPAFILES/AGRIF_INC  ${NEMO_TDIR}/${NEW_CONF}/OPAFILES/AGRIF_MODELFILES/par_oce.F90 > ${NEMO_TDIR}/${NEW_CONF}/OPAFILES/par_oce.F90
-      touch ${NEMO_TDIR}/${NEW_CONF}/OPAFILES/param_done
-   elif  [ "${MYFILE}" == "par_oce.F90" -a -f ${NEMO_TDIR}/${NEW_CONF}/OPAFILES/param_done ] ; then
-      cd  ${NEMO_TDIR}/${NEW_CONF}/OPAFILES
-      cpp ${FPP_OPT} -I${NEMO_TDIR}/${NEW_CONF}/OPAFILES/AGRIF_INC ${MYFILE}
-      exit
-   fi
-
-   if [ "${MYFILE}" == agrif2model.F90 ]; then
-      cpp  -I${NEMO_TDIR}/${NEW_CONF}/OPAFILES/AGRIF_INC $@
-      exit
-   fi 
-
-   cpp  -I${NEMO_TDIR}/${NEW_CONF}/OPAFILES/AGRIF_INC $@ > ${NEMO_TDIR}/${NEW_CONF}/OPAFILES/${MYFILE}
-   ( cd ${NEMO_TDIR}/${NEW_CONF}/OPAFILES ; ${NEMO_TDIR}/${NEW_CONF}/OPAFILES/conv agrif_opa.in -rm -comdirin ./ -comdirout AGRIF_MODELFILES/ -convfile ${MYFILE} > /dev/null )
-   cd  ${NEMO_TDIR}/${NEW_CONF}
-   sed 's/[ 	]*$//' OPAFILES/AGRIF_MODELFILES/${MYFILE}> OPAFILES/${MYFILE}
-   cpp ${FPP_OPT} -IOPAFILES/AGRIF_INC OPAFILES/${MYFILE} 
+MYFILE=$(basename "$1")
+if [ "$MYFILE" == "agrif2model.f90" ];then
+   \cp ${NEMO_TDIR}/${NEW_CONF}/WORK/${MYFILE/.f90/.F90} ${NEMO_TDIR}/${NEW_CONF}/OPAFILES/obj/$MYFILE
 else
-   shift
-   cpp $@
+cd ${NEMO_TDIR}/${NEW_CONF}/OPAFILES/ppsrc/nemo ; ${NEMO_TDIR}/${NEW_CONF}/OPAFILES/conv ${NEMO_TDIR}/${NEW_CONF}/OPAFILES/agrif_opa.in -rm -incdir ${NEMO_TDIR}/${NEW_CONF}/OPAFILES/inc -comdirout ${NEMO_TDIR}/${NEW_CONF}/OPAFILES/obj -convfile ${MYFILE} > /dev/null 
 fi
-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/bld.cfg
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/bld.cfg	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/bld.cfg	(revision 3680)
@@ -23,5 +23,5 @@
 src::ioipsl               $MAIN_DIR/EXTERNAL/IOIPSL/src
 src::agrif                $MAIN_DIR/EXTERNAL/AGRIF/AGRIF_FILES
-src::nemo                 $CONFIG_DIR/$NEW_CONF/WORK
+src::nemo                 $CONFIG_DIR/$NEW_CONF/OPAFILES/obj
 
 #bld::lib::xmlf90           xmlf90
@@ -54,10 +54,9 @@
 bld::pp::nemo     1
 bld::pp::agrif    1
-bld::tool::fpp       $COMPIL_DIR/agrifpp.sh
-bld::tool::fppflags::nemo ${AGRIFUSE} %FPPFLAGS
-bld::tool::fppflags::xmlio    0 %FPPFLAGS
-bld::tool::fppflags::ioserver 0 %FPPFLAGS
-bld::tool::fppflags::ioipsl   0 %FPPFLAGS
-bld::tool::fppflags::agrif    0 %FPPFLAGS
+bld::tool::fppflags::nemo      %FPPFLAGS -I$CONFIG_DIR/$NEW_CONF/OPAFILES/inc
+bld::tool::fppflags::xmlio     %FPPFLAGS
+bld::tool::fppflags::ioserver  %FPPFLAGS
+bld::tool::fppflags::ioipsl    %FPPFLAGS
+bld::tool::fppflags::agrif     %FPPFLAGS
 
 # Ignore the following dependencies
@@ -82,4 +81,5 @@
 # Allow ".h90" as an extension for CPP include files
 bld::infile_ext::h90  CPP::INCLUDE
+bld::infile_ext::f90  FPP::FPP9X::SOURCE
 
 # extension for module output
@@ -88,3 +88,2 @@
 # rename executable to nemo.exe
 bld::exe_name::model  nemo.exe
-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/bld_preproagr.cfg
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/bld_preproagr.cfg	(revision 3680)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/bld_preproagr.cfg	(revision 3680)
@@ -0,0 +1,84 @@
+# ----------------------- FCM extract configuration file -----------------------
+cfg::type                           bld
+cfg::version                        1.0
+
+
+# ------------------------------------------------------------------------------
+# Build information
+# ------------------------------------------------------------------------------
+
+inc $COMPIL_DIR/arch_nemo.fcm
+inc $COMPIL_DIR/cpp.fcm
+search_src           1
+
+src::nemo                 $CONFIG_DIR/$NEW_CONF/WORK
+
+bld::target  lib_cray.f90 nemo.f90 agrif_user.f90 agrif2model.f90 
+
+dir::root            $NEMO_TDIR/$NEW_CONF/OPAFILES
+
+bld::tool::fc_output
+bld::tool::fc_compile
+bld::tool::fc_include
+bld::tool::fc        $COMPIL_DIR/agrifpp.sh 
+bld::tool::fflags    
+bld::tool::ld       
+bld::tool::ldflags   
+bld::tool::ar        
+bld::tool::arflags   
+bld::tool::make      %MK
+
+OUTFILE_EXT::obj   .f90
+
+# Pre-process code before analysing dependencies
+bld::pp::nemo     1
+bld::pp::nemo/agrif2model     0
+bld::tool::fpp       cpp
+bld::tool::fppflags::nemo  %FPPFLAGS
+
+# Ignore the following dependencies
+bld::excl_dep        inc::netcdf.inc
+bld::excl_dep        inc::VT.inc
+bld::excl_dep        use::netcdf
+bld::excl_dep        h::netcdf.inc
+bld::excl_dep        h::mpif.h
+bld::excl_dep        inc::mpif.h
+bld::excl_dep        inc::mpe_logf.h
+bld::excl_dep        use::mpi
+bld::excl_dep        use::mod_prism_proto
+bld::excl_dep        use::mod_prism_def_partition_proto
+bld::excl_dep        use::mod_prism_get_comm
+bld::excl_dep        use::mod_prism_get_proto
+bld::excl_dep        use::mod_prism_put_proto
+bld::excl_dep        use::mod_comprism_proto
+bld::excl_dep        use::mkl_dfti
+bld::excl_dep	     use::nc4interface
+bld::excl_dep	     use::ioipsl
+bld::excl_dep	     use::agrif_types
+bld::excl_dep	     use::agrif_util
+bld::excl_dep        inc::SetNumberofcells.h
+bld::excl_dep        inc::GetNumberofcells.h
+bld::excl_dep        inc::include_use_Alloc_agrif.h
+bld::excl_dep        inc::allocations_calls_agrif.h
+bld::excl_dep        inc::modtype_agrif.h
+bld::excl_dep        inc::probdim_agrif.h
+bld::excl_dep        inc::keys_agrif.h
+bld::excl_dep        h::SetNumberofcells.h
+bld::excl_dep        h::GetNumberofcells.h
+bld::excl_dep        h::include_use_Alloc_agrif.h
+bld::excl_dep        h::allocations_calls_agrif.h
+bld::excl_dep        h::modtype_agrif.h
+bld::excl_dep        h::probdim_agrif.h
+bld::excl_dep        h::keys_agrif.h
+bld::excl_dep        use::mod_attribut
+bld::excl_dep        use::mod_event_client
+bld::excl_dep        use::mod_ioclient
+#bld::excl_dep        OBJ
+
+# Don't generate interface files
+bld::tool::geninterface none
+
+# Allow ".h90" and ".f90" as an extension for CPP include files
+bld::infile_ext::h90  CPP::INCLUDE
+bld::infile_ext::f90  FPP::FPP9X::SOURCE
+bld::src_type::nemo/agrif2model.F90 FORTRAN::FORTRAN9X::SOURCE
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/bldxag.cfg
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/bldxag.cfg	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/bldxag.cfg	(revision 3680)
@@ -44,9 +44,8 @@
 bld::pp::ioipsl   1
 bld::pp::nemo     1
-bld::tool::fpp       $COMPIL_DIR/agrifpp.sh
-bld::tool::fppflags::nemo ${AGRIFUSE} %FPPFLAGS
-bld::tool::fppflags::xmlio    0 %FPPFLAGS
-bld::tool::fppflags::ioserver 0 %FPPFLAGS
-bld::tool::fppflags::ioipsl   0 %FPPFLAGS
+bld::tool::fppflags::nemo     %FPPFLAGS
+bld::tool::fppflags::xmlio    %FPPFLAGS
+bld::tool::fppflags::ioserver %FPPFLAGS
+bld::tool::fppflags::ioipsl   %FPPFLAGS
 
 # Ignore the following dependencies
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/bldxio.cfg
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/bldxio.cfg	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/bldxio.cfg	(revision 3680)
@@ -15,12 +15,9 @@
 src::ioipsl               $MAIN_DIR/EXTERNAL/IOIPSL/src
 src::agrif                $MAIN_DIR/EXTERNAL/AGRIF/AGRIF_FILES
-src::nemo                 $CONFIG_DIR/$NEW_CONF/WORK
-
+src::nemo                 $CONFIG_DIR/$NEW_CONF/OPAFILES/obj 
 bld::target  nemo.exe
 bld::exe_dep
 
-
 dir::root            $NEMO_TDIR/$NEW_CONF/BLD
-
 
 bld::tool::fc        %FC 
@@ -37,8 +34,7 @@
 bld::pp::nemo     1
 bld::pp::agrif    1
-bld::tool::fpp       $COMPIL_DIR/agrifpp.sh
-bld::tool::fppflags::nemo ${AGRIFUSE} %FPPFLAGS
-bld::tool::fppflags::ioipsl   0 %FPPFLAGS
-bld::tool::fppflags::agrif    0 %FPPFLAGS
+bld::tool::fppflags::nemo     %FPPFLAGS -I$CONFIG_DIR/$NEW_CONF/OPAFILES/inc
+bld::tool::fppflags::ioipsl   %FPPFLAGS
+bld::tool::fppflags::agrif    %FPPFLAGS
 
 # Ignore the following dependencies
@@ -63,4 +59,5 @@
 # Allow ".h90" as an extension for CPP include files
 bld::infile_ext::h90  CPP::INCLUDE
+bld::infile_ext::f90  FPP::FPP9X::SOURCE
 
 # extension for module output
@@ -69,3 +66,2 @@
 # rename executable to nemo.exe
 bld::exe_name::model  nemo.exe
-
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/bldxioxag.cfg
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/bldxioxag.cfg	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/COMPILE/bldxioxag.cfg	(revision 3680)
@@ -34,7 +34,6 @@
 bld::pp::ioipsl   1
 bld::pp::nemo     1
-bld::tool::fpp       $COMPIL_DIR/agrifpp.sh
-bld::tool::fppflags::nemo ${AGRIFUSE} %FPPFLAGS
-bld::tool::fppflags::ioipsl   0 %FPPFLAGS
+bld::tool::fppflags::nemo     %FPPFLAGS
+bld::tool::fppflags::ioipsl   %FPPFLAGS
 
 # Ignore the following dependencies
Index: /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/SECTIONS_DIADCT/src/declarations.f90
===================================================================
--- /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/SECTIONS_DIADCT/src/declarations.f90	(revision 3679)
+++ /branches/2012/dev_MERGE_2012/NEMOGCM/TOOLS/SECTIONS_DIADCT/src/declarations.f90	(revision 3680)
@@ -15,5 +15,5 @@
   INTEGER, PUBLIC, PARAMETER   :: nb_sec_max    = 150           ! Max number of sections
   INTEGER, PUBLIC, PARAMETER   :: nb_point_max  = 2000          ! Max number of segments per section
-  INTEGER, PUBLIC, PARAMETER   :: nb_type_class = 14            ! Max number of types of classes
+  INTEGER, PUBLIC, PARAMETER   :: nb_type_class = 10            ! Max number of types of classes
   INTEGER, PUBLIC, PARAMETER   :: numnam=3                      ! Unit for namelist
   INTEGER, PUBLIC, PARAMETER   :: numdctin=1                    ! Unit for input file
