Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/ARCH/CNRS/arch-ifort_CICLAD.fcm
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/ARCH/CNRS/arch-ifort_CICLAD.fcm	(revision 3570)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/ARCH/CNRS/arch-ifort_CICLAD.fcm	(revision 3570)
@@ -0,0 +1,29 @@
+# generic ifort compiler options for linux
+# 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/opt/netcdf3/ifort/include 
+%NCDF_LIB            -L /opt/netcdf3/ifort/lib -lnetcdf   
+%FC                  /usr/lib64/openmpi/1.4.3-ifort/bin/mpif90 -c -cpp -DCPP_PARA -pg
+%FCFLAGS 	     -i4 -r8 -O3  -traceback 
+%FFLAGS 	     -i4 -r8 -O3  -traceback 
+%LD                  /usr/lib64/openmpi/1.4.3-ifort/bin/mpif90 
+%FPPFLAGS            -P -C -traditional
+%LDFLAGS
+%AR                  ar 
+%ARFLAGS             -r
+%MK                  gmake
+%USER_INC            %NCDF_INC
+%USER_LIB            %NCDF_LIB 
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/ORCA2_LIM/IDL_scripts/std_ts_S.pro
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/ORCA2_LIM/IDL_scripts/std_ts_S.pro	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/ORCA2_LIM/IDL_scripts/std_ts_S.pro	(revision 3570)
@@ -31,5 +31,5 @@
 
 ; read exp1 data
-  std_ts_read, vsal, date1, date2, prefix, suffix, ts_Sal, ts_z $
+  std_ts_read, vsal, date1, date2, prefix, suffix, ts_Sal, ts_z, masknp $
                , WITHSSH = vssh, SSHPREFIX = sshprefix, SSHSUFFIX = sshsuffix, LEVZ = levz
 
@@ -62,5 +62,5 @@
 ; read exp2 data
     tsave = time
-    std_ts_read, vsal2, date1_2, date2_2, prefix2, suffix2, ts_Sal2, ts_z2 $
+    std_ts_read, vsal2, date1_2, date2_2, prefix2, suffix2, ts_Sal2, ts_z2, masknp $
                  , WITHSSH = vssh2, SSHPREFIX = sshprefix2, SSHSUFFIX = sshsuffix2, LEVZ = levz
     time = tsave   &   IF n_elements(time) NE jpt THEN stop
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/ORCA2_LIM/IDL_scripts/std_ts_T.pro
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/ORCA2_LIM/IDL_scripts/std_ts_T.pro	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/ORCA2_LIM/IDL_scripts/std_ts_T.pro	(revision 3570)
@@ -31,5 +31,5 @@
 
 ; read exp1 data
-  std_ts_read, vtemp, date1, date2, prefix, suffix, ts_Temp, ts_z $
+  std_ts_read, vtemp, date1, date2, prefix, suffix, ts_Temp, ts_z, masknp $
                , WITHSSH = vssh, SSHPREFIX = sshprefix, SSHSUFFIX = sshsuffix, LEVZ = levz
 
@@ -62,5 +62,5 @@
 ; read exp2 data
     tsave = time
-    std_ts_read, vtemp2, date1_2, date2_2, prefix2, suffix2, ts_Temp2, ts_z2 $
+    std_ts_read, vtemp2, date1_2, date2_2, prefix2, suffix2, ts_Temp2, ts_z2, masknp $
                  , WITHSSH = vssh2, SSHPREFIX = sshprefix2, SSHSUFFIX = sshsuffix2, LEVZ = levz
     time = tsave   &   IF n_elements(time) NE jpt THEN stop
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/ORCA2_LIM/IDL_scripts/std_ts_read.pro
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/ORCA2_LIM/IDL_scripts/std_ts_read.pro	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/ORCA2_LIM/IDL_scripts/std_ts_read.pro	(revision 3570)
@@ -1,3 +1,3 @@
-PRO std_ts_read, var_name, dt1, dt2, prefix, suffix, ts, ts_z $
+PRO std_ts_read, var_name, dt1, dt2, prefix, suffix, ts, ts_z, masknp $
                  , WITHSSH = withssh, SSHPREFIX = sshprefix, SSHSUFFIX = sshsuffix, LEVZ = levz
 
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_pisces
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_pisces	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_pisces	(revision 3570)
@@ -16,5 +16,5 @@
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    ln_co2int  =  .false. ! read atm pco2 from a file (T) or constant (F)
-   atcco2     =  287.    ! Constant value atmospheric pCO2 - ln_co2int = F
+   atcco2     =  280.    ! Constant value atmospheric pCO2 - ln_co2int = F
    clname     =  'atcco2.txt'  ! Name of atm pCO2 file - ln_co2int = T
    nn_offset  =  0       ! Offset model-data start year - ln_co2int = T
@@ -35,7 +35,7 @@
 &nampisbio     !   biological parameters
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   nrdttrc    =  1        ! time step frequency for biology
+   nrdttrc    =  4        ! time step frequency for biology
    wsbio      =  2.       ! POC sinking speed
-   xkmort     =  1.E-7    ! half saturation constant for mortality
+   xkmort     =  2.E-7    ! half saturation constant for mortality
    ferat3     =  10.E-6   ! Fe/C in zooplankton 
    wsbio2     =  30.      ! Big particles sinking speed
@@ -44,18 +44,18 @@
 &nampislim     !   parameters for nutrient limitations
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   conc0      =  2.e-6    ! Phosphate half saturation
+   conc0      =  1.e-6    ! Phosphate half saturation
    conc1      =  8E-6     ! Phosphate half saturation for diatoms
-   conc2      =  2E-9     ! Iron half saturation for phyto
-   conc2m     =  4E-9     ! Max iron half saturation for phyto
+   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     =  9E-9     ! Maxi iron half saturation for diatoms
-   xsizedia   =  5.E-7    ! Minimum size criteria for diatoms
+   conc3m     =  8E-9     ! Maxi iron 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   =  4.E-7    ! NH4 half saturation for diatoms
+   concdnh4   =  8.E-7    ! NH4 half saturation for diatoms
    xksi1      =  2.E-6    ! half saturation constant for Si uptake
    xksi2      =  3.33E-6  ! half saturation constant for Si/C
    xkdoc      =  417.E-6  ! half-saturation constant of DOC remineralization
-   concfebac  =  3.E-11   ! Half-saturation for Fe limitation of Bacteria
+   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
@@ -65,12 +65,12 @@
 &nampisprod     !   parameters for phytoplankton growth
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   pislope    =  3.       ! P-I slope
+   pislope    =  2.       ! P-I slope
    pislope2   =  2.       ! P-I slope  for diatoms
    excret     =  0.05     ! excretion ratio of phytoplankton
    excret2    =  0.05     ! excretion ratio of diatoms
-   ln_newprod =  .false.  ! 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.04     ! Minimum Chl/C in diatoms
+   chlcdm     =  0.05     ! Minimum Chl/C in diatoms
    chlcmin    =  0.0033   ! Maximum Chl/c in phytoplankton
    fecnm      =  40E-6    ! Maximum Fe/C in nanophytoplankton
@@ -100,12 +100,12 @@
    xthresh2zoo = 1E-8     ! zoo feeding threshold for mesozooplankton 
    xthresh2dia = 1E-8     ! diatoms feeding threshold for mesozooplankton 
-   xthresh2phy = 2E-7     ! nanophyto feeding threshold for mesozooplankton 
+   xthresh2phy = 1E-8     ! nanophyto feeding threshold for mesozooplankton 
    xthresh2poc = 1E-8     ! poc feeding threshold for mesozooplankton 
-   xthresh2   =  0.       ! Food threshold for grazing
+   xthresh2   =  2E-7    ! Food threshold for grazing
    xkgraz2    =  20.E-6   ! half sturation constant for meso grazing
-   epsher2    =  0.33     ! Efficicency of Mesozoo growth
+   epsher2    =  0.3      ! Efficicency of Mesozoo growth
    sigma2     =  0.6      ! Fraction of mesozoo excretion as DOM
    unass2     =  0.3      ! non assimilated fraction of P by mesozoo
-   grazflux   =  3.e3     ! flux-feeding rate
+   grazflux   =  2.e3     ! flux-feeding rate
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
@@ -115,14 +115,14 @@
    grazrat    =  3.0      ! maximal zoo grazing rate
    resrat     =  0.03     ! exsudation rate of zooplankton
-   mzrat      =  0.0      ! zooplankton mortality rate
+   mzrat      =  0.001    ! zooplankton mortality rate
    xpref2c    =  0.1      ! Microzoo preference for POM
    xpref2p    =  1.       ! Microzoo preference for Nanophyto
-   xpref2d    =  0.6      ! Microzoo preference for Diatoms
+   xpref2d    =  0.5      ! Microzoo preference for Diatoms
    xthreshdia =  1.E-8    ! Diatoms feeding threshold for microzooplankton 
-   xthreshphy =  2.E-7    ! Nanophyto feeding threshold for microzooplankton 
+   xthreshphy =  1.E-8    ! Nanophyto feeding threshold for microzooplankton 
    xthreshpoc =  1.E-8    ! POC feeding threshold for microzooplankton 
-   xthresh    =  0.       ! Food threshold for feeding
+   xthresh    =  2.E-7    ! Food threshold for feeding
    xkgraz     =  20.E-6   ! half sturation constant for grazing
-   epsher     =  0.33     ! Efficiency of microzoo growth
+   epsher     =  0.3      ! Efficiency of microzoo growth
    sigma1     =  0.6      ! Fraction of microzoo excretion as DOM
    unass      =  0.3      ! non assimilated fraction of phyto by zoo
@@ -160,5 +160,5 @@
    cn_dir      = './'      !  root directory for the location of the dynamical files
    ln_dust     =  .true.   ! boolean for dust input from the atmosphere
-   ln_river    =  .true.   ! boolean for river input of nutrients
+   ln_river    =  .false.   ! boolean for river input of nutrients
    ln_ndepo    =  .true.   ! boolean for atmospheric deposition of N
    ln_ironsed  =  .true.   ! boolean for Fe input from sediments
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_pisces
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_pisces	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_pisces	(revision 3570)
@@ -16,5 +16,5 @@
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    ln_co2int  =  .false. ! read atm pco2 from a file (T) or constant (F)
-   atcco2     =  287.    ! Constant value atmospheric pCO2 - ln_co2int = F
+   atcco2     =  280.    ! Constant value atmospheric pCO2 - ln_co2int = F
    clname     =  'atcco2.txt'  ! Name of atm pCO2 file - ln_co2int = T
    nn_offset  =  0       ! Offset model-data start year - ln_co2int = T
@@ -37,5 +37,5 @@
    nrdttrc    =  4        ! time step frequency for biology
    wsbio      =  2.       ! POC sinking speed
-   xkmort     =  1.E-7    ! half saturation constant for mortality
+   xkmort     =  2.E-7    ! half saturation constant for mortality
    ferat3     =  10.E-6   ! Fe/C in zooplankton 
    wsbio2     =  30.      ! Big particles sinking speed
@@ -44,18 +44,18 @@
 &nampislim     !   parameters for nutrient limitations
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   conc0      =  2.e-6    ! Phosphate half saturation
+   conc0      =  1.e-6    ! Phosphate half saturation
    conc1      =  8E-6     ! Phosphate half saturation for diatoms
-   conc2      =  2E-9     ! Iron half saturation for phyto
-   conc2m     =  4E-9     ! Max iron half saturation for phyto
+   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     =  9E-9     ! Maxi iron half saturation for diatoms
-   xsizedia   =  5.E-7    ! Minimum size criteria for diatoms
+   conc3m     =  8E-9     ! Maxi iron 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   =  4.E-7    ! NH4 half saturation for diatoms
+   concdnh4   =  8.E-7    ! NH4 half saturation for diatoms
    xksi1      =  2.E-6    ! half saturation constant for Si uptake
    xksi2      =  3.33E-6  ! half saturation constant for Si/C
    xkdoc      =  417.E-6  ! half-saturation constant of DOC remineralization
-   concfebac  =  3.E-11   ! Half-saturation for Fe limitation of Bacteria
+   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
@@ -65,12 +65,12 @@
 &nampisprod     !   parameters for phytoplankton growth
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   pislope    =  3.       ! P-I slope
+   pislope    =  2.       ! P-I slope
    pislope2   =  2.       ! P-I slope  for diatoms
    excret     =  0.05     ! excretion ratio of phytoplankton
    excret2    =  0.05     ! excretion ratio of diatoms
-   ln_newprod =  .false.  ! 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.04     ! Minimum Chl/C in diatoms
+   chlcdm     =  0.05     ! Minimum Chl/C in diatoms
    chlcmin    =  0.0033   ! Maximum Chl/c in phytoplankton
    fecnm      =  40E-6    ! Maximum Fe/C in nanophytoplankton
@@ -100,12 +100,12 @@
    xthresh2zoo = 1E-8     ! zoo feeding threshold for mesozooplankton 
    xthresh2dia = 1E-8     ! diatoms feeding threshold for mesozooplankton 
-   xthresh2phy = 2E-7     ! nanophyto feeding threshold for mesozooplankton 
+   xthresh2phy = 1E-8     ! nanophyto feeding threshold for mesozooplankton 
    xthresh2poc = 1E-8     ! poc feeding threshold for mesozooplankton 
-   xthresh2   =  0.       ! Food threshold for grazing
+   xthresh2   =  2E-7    ! Food threshold for grazing
    xkgraz2    =  20.E-6   ! half sturation constant for meso grazing
-   epsher2    =  0.33     ! Efficicency of Mesozoo growth
+   epsher2    =  0.3      ! Efficicency of Mesozoo growth
    sigma2     =  0.6      ! Fraction of mesozoo excretion as DOM
    unass2     =  0.3      ! non assimilated fraction of P by mesozoo
-   grazflux   =  3.e3     ! flux-feeding rate
+   grazflux   =  2.e3     ! flux-feeding rate
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
@@ -115,14 +115,14 @@
    grazrat    =  3.0      ! maximal zoo grazing rate
    resrat     =  0.03     ! exsudation rate of zooplankton
-   mzrat      =  0.0      ! zooplankton mortality rate
+   mzrat      =  0.001    ! zooplankton mortality rate
    xpref2c    =  0.1      ! Microzoo preference for POM
    xpref2p    =  1.       ! Microzoo preference for Nanophyto
-   xpref2d    =  0.6      ! Microzoo preference for Diatoms
+   xpref2d    =  0.5      ! Microzoo preference for Diatoms
    xthreshdia =  1.E-8    ! Diatoms feeding threshold for microzooplankton 
-   xthreshphy =  2.E-7    ! Nanophyto feeding threshold for microzooplankton 
+   xthreshphy =  1.E-8    ! Nanophyto feeding threshold for microzooplankton 
    xthreshpoc =  1.E-8    ! POC feeding threshold for microzooplankton 
-   xthresh    =  0.       ! Food threshold for feeding
+   xthresh    =  2.E-7    ! Food threshold for feeding
    xkgraz     =  20.E-6   ! half sturation constant for grazing
-   epsher     =  0.33     ! Efficiency of microzoo growth
+   epsher     =  0.3      ! Efficiency of microzoo growth
    sigma1     =  0.6      ! Fraction of microzoo excretion as DOM
    unass      =  0.3      ! non assimilated fraction of phyto by zoo
@@ -160,5 +160,5 @@
    cn_dir      = './'      !  root directory for the location of the dynamical files
    ln_dust     =  .true.   ! boolean for dust input from the atmosphere
-   ln_river    =  .true.   ! boolean for river input of nutrients
+   ln_river    =  .false.   ! boolean for river input of nutrients
    ln_ndepo    =  .true.   ! boolean for atmospheric deposition of N
    ln_ironsed  =  .true.   ! boolean for Fe input from sediments
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/cfg.txt
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/cfg.txt	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/CONFIG/cfg.txt	(revision 3570)
@@ -5,4 +5,4 @@
 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_OFF_PISCES OPA_SRC OFF_SRC TOP_SRC
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/EXTERNAL/XMLIO_SERVER/src/IOSERVER/mod_interface_ioipsl.f90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/EXTERNAL/XMLIO_SERVER/src/IOSERVER/mod_interface_ioipsl.f90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/EXTERNAL/XMLIO_SERVER/src/IOSERVER/mod_interface_ioipsl.f90	(revision 3570)
@@ -38,4 +38,5 @@
   USE ioipsl
   USE xmlio
+  USE mod_ioserver_namelist
   IMPLICIT NONE
     INTEGER,INTENT(IN)  :: nb_server
@@ -88,5 +89,5 @@
                        pt_zoom%ibegin_loc, pt_zoom%ni_loc,pt_zoom%jbegin_loc,pt_zoom%nj_loc,         &
                        initial_timestep, initial_date, timestep_value,                               &
-                       ioipsl_hori_id, ioipsl_file_id)
+                       ioipsl_hori_id, ioipsl_file_id, snc4chunks=snc4ioset)
            ELSE                                              
 
@@ -95,5 +96,5 @@
                        pt_zoom%ibegin_loc, pt_zoom%ni_loc,pt_zoom%jbegin_loc,pt_zoom%nj_loc,          &
                        initial_timestep, initial_date, timestep_value,                                &
-                       ioipsl_hori_id, ioipsl_file_id,domain_id=ioipsl_domain_id)                                              
+                       ioipsl_hori_id, ioipsl_file_id,domain_id=ioipsl_domain_id, snc4chunks=snc4ioset)                                              
           
            ENDIF
@@ -142,5 +143,5 @@
             ENDIF
           ENDDO
-          CALL histend(ioipsl_file_id)
+          CALL histend(ioipsl_file_id, snc4chunks=snc4ioset)
         ENDIF
         CALL sorted_list__delete(axis_id)
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/LIM_SRC_2/limdmp_2.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/LIM_SRC_2/limdmp_2.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/LIM_SRC_2/limdmp_2.F90	(revision 3570)
@@ -11,12 +11,12 @@
    !!   'key_lim2'                                    LIM 2.0 sea-ice model
    !!----------------------------------------------------------------------
-   !!   lim_dmp_2      : ice model damping
+   !!   lim_dmp_2     : ice model damping
    !!----------------------------------------------------------------------
-   USE ice_2           ! ice variables 
+   USE ice_2          ! ice variables 
    USE sbc_oce, ONLY : nn_fsbc ! for fldread
-   USE dom_oce         ! for mi0; mi1 etc ...
-   USE fldread         ! read input fields
-   USE in_out_manager  ! I/O manager
-   USE lib_mpp         ! MPP library
+   USE dom_oce        ! for mi0; mi1 etc ...
+   USE fldread        ! read input fields
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
 
    IMPLICIT NONE
@@ -25,8 +25,7 @@
    PUBLIC   lim_dmp_2     ! called by sbc_ice_lim2
 
-   REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   resto_ice   ! restoring coeff. on ICE   [s-1]
-
-   INTEGER, PARAMETER :: jp_hicif = 1 , jp_frld = 2
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_icedmp    ! structure of ice damping input
+   INTEGER  , PARAMETER :: jp_hicif = 1 , jp_frld = 2
+   REAL(wp) , ALLOCATABLE, DIMENSION(:,:,:) ::   resto_ice   ! restoring coeff. on ICE   [s-1]
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:)     ::   sf_icedmp   ! structure of ice damping input
    
    !! * Substitution
@@ -43,7 +42,11 @@
       !!                   ***  ROUTINE lim_dmp_2  ***
       !!
-      !! ** purpose : ice model damping : restoring ice thickness and fraction leads
+      !! ** purpose :   restore ice thickness and lead fraction
       !!
-      !! ** method  : the key_tradmp must be used to compute resto(:,:,1) coef.
+      !! ** method  :   restore ice thickness and lead fraction using a restoring
+      !!              coefficient defined by the user in lim_dmp_init
+      !!
+      !! ** Action  : - update hicif and frld  
+      !!
       !!---------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt   ! ocean time-step
@@ -53,5 +56,5 @@
       !!---------------------------------------------------------------------
       !
-      IF (kt == nit000)  THEN 
+      IF( kt == nit000 ) THEN 
          IF(lwp) WRITE(numout,*)
          IF(lwp) WRITE(numout,*) 'lim_dmp_2 : Ice thickness and ice concentration restoring'
@@ -71,5 +74,5 @@
             &         hicif(:,:) - rdt_ice * resto_ice(:,:,1) * ( hicif(:,:) - sf_icedmp(jp_hicif)%fnow(:,:,1) )  ) 
 !CDIR COLLAPSE
-         hicif(:,:) = MAX( 0._wp, MIN( 1._wp,         &        ! 0<= frld<=1    values which blow the run up
+         frld (:,:) = MAX( 0._wp, MIN( 1._wp,         &        ! 0<= frld<=1    values which blow the run up
             &         frld (:,:) - rdt_ice * resto_ice(:,:,1) * ( frld (:,:) - sf_icedmp(jp_frld )%fnow(:,:,1) )  )  )
          !
@@ -83,10 +86,9 @@
       !!                   ***  ROUTINE lim_dmp_init  ***
       !!
-      !! ** Purpose :   Initialization for the ice thickness and concentration 
-      !!                restoring
-      !!              restoring will be used. It is used to mimic ice open
-      !!              boundaries.
+      !! ** Purpose :   set the coefficient for the ice thickness and lead fraction restoring
       !!
-      !! ** Method  :  ?????
+      !! ** Method  :   restoring is used to mimic ice open boundaries.
+      !!              the restoring coef. (a 2D array) has to be defined by the user.
+      !!              here is given as an example a restoring along north and south boundaries
       !!      
       !! ** Action  :   define resto_ice(:,:,1)
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/LIM_SRC_3/limistate.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/LIM_SRC_3/limistate.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/LIM_SRC_3/limistate.F90	(revision 3570)
@@ -460,4 +460,10 @@
       ! 4) Moments for advection
       !--------------------------------------------------------------------
+
+      sxopw (:,:) = 0.e0 
+      syopw (:,:) = 0.e0 
+      sxxopw(:,:) = 0.e0 
+      syyopw(:,:) = 0.e0 
+      sxyopw(:,:) = 0.e0
 
       sxice (:,:,:)  = 0.e0   ;   sxsn (:,:,:)  = 0.e0   ;   sxa  (:,:,:)  = 0.e0
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/LIM_SRC_3/limthd_dif.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/LIM_SRC_3/limthd_dif.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/LIM_SRC_3/limthd_dif.F90	(revision 3570)
@@ -102,44 +102,7 @@
       INTEGER ::   nconv       ! number of iterations in iterative procedure
       INTEGER ::   minnumeqmin, maxnumeqmax
-
-      INTEGER , POINTER, DIMENSION(:) ::   numeqmin   ! reference number of top equation
-      INTEGER , POINTER, DIMENSION(:) ::   numeqmax   ! reference number of bottom equation
-      INTEGER , POINTER, DIMENSION(:) ::   isnow      ! switch for presence (1) or absence (0) of snow
-
-      !! * New local variables       
-      REAL(wp), POINTER, DIMENSION(:,:) ::   ztcond_i   !Ice thermal conductivity
-      REAL(wp), POINTER, DIMENSION(:,:) ::   zradtr_i   !Radiation transmitted through the ice
-      REAL(wp), POINTER, DIMENSION(:,:) ::   zradab_i   !Radiation absorbed in the ice
-      REAL(wp), POINTER, DIMENSION(:,:) ::   zkappa_i   !Kappa factor in the ice
-
-      REAL(wp), POINTER, DIMENSION(:,:) ::   zradtr_s   !Radiation transmited through the snow
-      REAL(wp), POINTER, DIMENSION(:,:) ::   zradab_s   !Radiation absorbed in the snow
-      REAL(wp), POINTER, DIMENSION(:,:) ::   zkappa_s   !Kappa factor in the snow
-
-      REAL(wp), POINTER, DIMENSION(:,:) ::   ztiold      !Old temperature in the ice
-      REAL(wp), POINTER, DIMENSION(:,:) ::   zeta_i      !Eta factor in the ice 
-      REAL(wp), POINTER, DIMENSION(:,:) ::   ztitemp     !Temporary temperature in the ice to check the convergence
-      REAL(wp), POINTER, DIMENSION(:,:) ::   zspeche_i   !Ice specific heat
-      REAL(wp), POINTER, DIMENSION(:,:) ::   z_i         !Vertical cotes of the layers in the ice
-
-      REAL(wp), POINTER, DIMENSION(:,:) ::   zeta_s      !Eta factor in the snow
-      REAL(wp), POINTER, DIMENSION(:,:) ::   ztstemp     !Temporary temperature in the snow to check the convergence
-      REAL(wp), POINTER, DIMENSION(:,:) ::   ztsold      !Temporary temperature in the snow
-      REAL(wp), POINTER, DIMENSION(:,:) ::   z_s         !Vertical cotes of the layers in the snow
-
-      REAL(wp), POINTER, DIMENSION(:,:)   ::   zindterm    ! Independent term
-      REAL(wp), POINTER, DIMENSION(:,:)   ::   zindtbis    ! temporary independent term
-      REAL(wp), POINTER, DIMENSION(:,:)   ::   zdiagbis
-      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrid       ! tridiagonal system terms
-
-      REAL(wp), POINTER, DIMENSION(:) ::   ztfs        ! ice melting point
-      REAL(wp), POINTER, DIMENSION(:) ::   ztsuold     ! old surface temperature (before the iterative procedure )
-      REAL(wp), POINTER, DIMENSION(:) ::   ztsuoldit   ! surface temperature at previous iteration
-      REAL(wp), POINTER, DIMENSION(:) ::   zh_i        ! ice layer thickness
-      REAL(wp), POINTER, DIMENSION(:) ::   zh_s        ! snow layer thickness
-      REAL(wp), POINTER, DIMENSION(:) ::   zfsw        ! solar radiation absorbed at the surface
-      REAL(wp), POINTER, DIMENSION(:) ::   zf          ! surface flux function
-      REAL(wp), POINTER, DIMENSION(:) ::   dzf         ! derivative of the surface flux function
-
+      INTEGER, DIMENSION(kiut) ::   numeqmin   ! reference number of top equation
+      INTEGER, DIMENSION(kiut) ::   numeqmax   ! reference number of bottom equation
+      INTEGER, DIMENSION(kiut) ::   isnow      ! switch for presence (1) or absence (0) of snow
       REAL(wp) ::   zeps      =  1.e-10_wp    !
       REAL(wp) ::   zg1s      =  2._wp        ! for the tridiagonal system
@@ -150,21 +113,41 @@
       REAL(wp) ::   zkimin    =  0.10_wp      ! minimum ice thermal conductivity
       REAL(wp) ::   zht_smin  =  1.e-4_wp     ! minimum snow depth
-
       REAL(wp) ::   ztmelt_i    ! ice melting temperature
       REAL(wp) ::   zerritmax   ! current maximal error on temperature 
-      REAL(wp), POINTER, DIMENSION(:) ::   zerrit       ! current error on temperature 
-      REAL(wp), POINTER, DIMENSION(:) ::   zdifcase     ! case of the equation resolution (1->4)
-      REAL(wp), POINTER, DIMENSION(:) ::   zftrice      ! solar radiation transmitted through the ice
-      REAL(wp), POINTER, DIMENSION(:) ::   zihic, zhsu
+      REAL(wp), DIMENSION(kiut) ::   ztfs        ! ice melting point
+      REAL(wp), DIMENSION(kiut) ::   ztsuold     ! old surface temperature (before the iterative procedure )
+      REAL(wp), DIMENSION(kiut) ::   ztsuoldit   ! surface temperature at previous iteration
+      REAL(wp), DIMENSION(kiut) ::   zh_i        ! ice layer thickness
+      REAL(wp), DIMENSION(kiut) ::   zh_s        ! snow layer thickness
+      REAL(wp), DIMENSION(kiut) ::   zfsw        ! solar radiation absorbed at the surface
+      REAL(wp), DIMENSION(kiut) ::   zf          ! surface flux function
+      REAL(wp), DIMENSION(kiut) ::   dzf         ! derivative of the surface flux function
+      REAL(wp), DIMENSION(kiut) ::   zerrit      ! current error on temperature
+      REAL(wp), DIMENSION(kiut) ::   zdifcase    ! case of the equation resolution (1->4)
+      REAL(wp), DIMENSION(kiut) ::   zftrice     ! solar radiation transmitted through the ice
+      REAL(wp), DIMENSION(kiut) ::   zihic, zhsu
+      REAL(wp), DIMENSION(kiut,0:nlay_i) ::   ztcond_i    ! Ice thermal conductivity
+      REAL(wp), DIMENSION(kiut,0:nlay_i) ::   zradtr_i    ! Radiation transmitted through the ice
+      REAL(wp), DIMENSION(kiut,0:nlay_i) ::   zradab_i    ! Radiation absorbed in the ice
+      REAL(wp), DIMENSION(kiut,0:nlay_i) ::   zkappa_i    ! Kappa factor in the ice
+      REAL(wp), DIMENSION(kiut,0:nlay_i) ::   ztiold      ! Old temperature in the ice
+      REAL(wp), DIMENSION(kiut,0:nlay_i) ::   zeta_i      ! Eta factor in the ice
+      REAL(wp), DIMENSION(kiut,0:nlay_i) ::   ztitemp     ! Temporary temperature in the ice to check the convergence
+      REAL(wp), DIMENSION(kiut,0:nlay_i) ::   zspeche_i   ! Ice specific heat
+      REAL(wp), DIMENSION(kiut,0:nlay_i) ::   z_i         ! Vertical cotes of the layers in the ice
+      REAL(wp), DIMENSION(kiut,0:nlay_s) ::   zradtr_s    ! Radiation transmited through the snow
+      REAL(wp), DIMENSION(kiut,0:nlay_s) ::   zradab_s    ! Radiation absorbed in the snow
+      REAL(wp), DIMENSION(kiut,0:nlay_s) ::   zkappa_s    ! Kappa factor in the snow
+      REAL(wp), DIMENSION(kiut,0:nlay_s) ::   zeta_s       ! Eta factor in the snow
+      REAL(wp), DIMENSION(kiut,0:nlay_s) ::   ztstemp      ! Temporary temperature in the snow to check the convergence
+      REAL(wp), DIMENSION(kiut,0:nlay_s) ::   ztsold       ! Temporary temperature in the snow
+      REAL(wp), DIMENSION(kiut,0:nlay_s) ::   z_s          ! Vertical cotes of the layers in the snow
+      REAL(wp), DIMENSION(kiut,jkmax+2) ::   zindterm   ! Independent term
+      REAL(wp), DIMENSION(kiut,jkmax+2) ::   zindtbis   ! temporary independent term
+      REAL(wp), DIMENSION(kiut,jkmax+2) ::   zdiagbis
+      REAL(wp), DIMENSION(kiut,jkmax+2,3) ::   ztrid   ! tridiagonal system terms
       !!------------------------------------------------------------------
-      !
-      CALL wrk_alloc( kiut, numeqmin, numeqmax, isnow )   ! integer
-      CALL wrk_alloc( kiut,nlay_i+1, ztcond_i, zradtr_i, zradab_i, zkappa_i, ztiold, zeta_i, ztitemp, zspeche_i, z_i, kjstart=0 )
-      CALL wrk_alloc( kiut,nlay_s+1, zradtr_s, zradab_s, zkappa_s, zeta_s, ztstemp, ztsold, z_s, kjstart=0 )
-      CALL wrk_alloc( kiut,jkmax+2, zindterm, zindtbis, zdiagbis )
-      CALL wrk_alloc( kiut,jkmax+2,3, ztrid )
-      CALL wrk_alloc( kiut, ztfs, ztsuold, ztsuoldit, zh_i, zh_s, zfsw, zf, dzf )
-      CALL wrk_alloc( kiut, zerrit, zdifcase, zftrice, zihic, zhsu )
-
+      
+      ! 
       !------------------------------------------------------------------------------!
       ! 1) Initialization                                                            !
@@ -772,12 +755,4 @@
       ENDIF
       !
-      CALL wrk_dealloc( kiut, numeqmin, numeqmax, isnow )   ! integer
-      CALL wrk_dealloc( kiut,nlay_i+1, ztcond_i, zradtr_i, zradab_i, zkappa_i, ztiold, zeta_i, ztitemp, zspeche_i, z_i, kjstart=0 )
-      CALL wrk_dealloc( kiut,nlay_s+1, zradtr_s, zradab_s, zkappa_s, zeta_s, ztstemp, ztsold, z_s, kjstart=0 )
-      CALL wrk_dealloc( kiut,jkmax+2, zindterm, zindtbis, zdiagbis )
-      CALL wrk_dealloc( kiut,jkmax+2,3, ztrid )
-      CALL wrk_dealloc( kiut, ztfs, ztsuold, ztsuoldit, zh_i, zh_s, zfsw, zf, dzf )
-      CALL wrk_dealloc( kiut, zerrit, zdifcase, zftrice, zihic, zhsu )
-
    END SUBROUTINE lim_thd_dif
 
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/LIM_SRC_3/limtrp.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/LIM_SRC_3/limtrp.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/LIM_SRC_3/limtrp.F90	(revision 3570)
@@ -174,39 +174,39 @@
          ELSE
             DO jk = 1, initad
-               CALL lim_adv_y( zusnit, v_ice, rzero, zsm, zs0ow (:,:), sxopw(:,:),   &             !--- ice open water area
+               CALL lim_adv_y( zusnit, v_ice, rone , zsm, zs0ow (:,:), sxopw(:,:),   &             !--- ice open water area
                   &                                       sxxopw(:,:), syopw(:,:), syyopw(:,:), sxyopw(:,:)  )
-               CALL lim_adv_x( zusnit, u_ice, rone , zsm, zs0ow (:,:), sxopw(:,:),   &
+               CALL lim_adv_x( zusnit, u_ice, rzero, zsm, zs0ow (:,:), sxopw(:,:),   &
                   &                                       sxxopw(:,:), syopw(:,:), syyopw(:,:), sxyopw(:,:)  )
                DO jl = 1, jpl
-                  CALL lim_adv_y( zusnit, v_ice, rzero, zsm, zs0ice(:,:,jl), sxice(:,:,jl),   &    !--- ice volume  ---
+                  CALL lim_adv_y( zusnit, v_ice, rone , zsm, zs0ice(:,:,jl), sxice(:,:,jl),   &    !--- ice volume  ---
                      &                                       sxxice(:,:,jl), syice(:,:,jl), syyice(:,:,jl), sxyice(:,:,jl)  )
-                  CALL lim_adv_x( zusnit, u_ice, rone , zsm, zs0ice(:,:,jl), sxice(:,:,jl),   &
+                  CALL lim_adv_x( zusnit, u_ice, rzero, zsm, zs0ice(:,:,jl), sxice(:,:,jl),   &
                      &                                       sxxice(:,:,jl), syice(:,:,jl), syyice(:,:,jl), sxyice(:,:,jl)  )
-                  CALL lim_adv_y( zusnit, v_ice, rzero, zsm, zs0sn (:,:,jl), sxsn (:,:,jl),   &    !--- snow volume  ---
+                  CALL lim_adv_y( zusnit, v_ice, rone , zsm, zs0sn (:,:,jl), sxsn (:,:,jl),   &    !--- snow volume  ---
                      &                                       sxxsn (:,:,jl), sysn (:,:,jl), syysn (:,:,jl), sxysn (:,:,jl)  )
-                  CALL lim_adv_x( zusnit, u_ice, rone , zsm, zs0sn (:,:,jl), sxsn (:,:,jl),   &
+                  CALL lim_adv_x( zusnit, u_ice, rzero, zsm, zs0sn (:,:,jl), sxsn (:,:,jl),   &
                      &                                       sxxsn (:,:,jl), sysn (:,:,jl), syysn (:,:,jl), sxysn (:,:,jl)  )
-                  CALL lim_adv_y( zusnit, v_ice, rzero, zsm, zs0sm (:,:,jl), sxsal(:,:,jl),   &    !--- ice salinity ---
+                  CALL lim_adv_y( zusnit, v_ice, rone , zsm, zs0sm (:,:,jl), sxsal(:,:,jl),   &    !--- ice salinity ---
                      &                                       sxxsal(:,:,jl), sysal(:,:,jl), syysal(:,:,jl), sxysal(:,:,jl)  )
-                  CALL lim_adv_x( zusnit, u_ice, rone , zsm, zs0sm (:,:,jl), sxsal(:,:,jl),   &
+                  CALL lim_adv_x( zusnit, u_ice, rzero, zsm, zs0sm (:,:,jl), sxsal(:,:,jl),   &
                      &                                       sxxsal(:,:,jl), sysal(:,:,jl), syysal(:,:,jl), sxysal(:,:,jl)  )
 
-                  CALL lim_adv_y( zusnit, v_ice, rzero, zsm, zs0oi (:,:,jl), sxage(:,:,jl),   &   !--- ice age      ---
+                  CALL lim_adv_y( zusnit, v_ice, rone , zsm, zs0oi (:,:,jl), sxage(:,:,jl),   &   !--- ice age      ---
                      &                                       sxxage(:,:,jl), syage(:,:,jl), syyage(:,:,jl), sxyage(:,:,jl)  )
-                  CALL lim_adv_x( zusnit, u_ice, rone , zsm, zs0oi (:,:,jl), sxage(:,:,jl),   &
+                  CALL lim_adv_x( zusnit, u_ice, rzero, zsm, zs0oi (:,:,jl), sxage(:,:,jl),   &
                      &                                       sxxage(:,:,jl), syage(:,:,jl), syyage(:,:,jl), sxyage(:,:,jl)  )
-                  CALL lim_adv_y( zusnit, v_ice, rzero, zsm, zs0a  (:,:,jl), sxa  (:,:,jl),   &   !--- ice concentrations ---
+                  CALL lim_adv_y( zusnit, v_ice, rone , zsm, zs0a  (:,:,jl), sxa  (:,:,jl),   &   !--- ice concentrations ---
                      &                                       sxxa  (:,:,jl), sya  (:,:,jl), syya  (:,:,jl), sxya  (:,:,jl)  )
-                  CALL lim_adv_x( zusnit, u_ice, rone , zsm, zs0a  (:,:,jl), sxa  (:,:,jl),   &
+                  CALL lim_adv_x( zusnit, u_ice, rzero, zsm, zs0a  (:,:,jl), sxa  (:,:,jl),   &
                      &                                       sxxa  (:,:,jl), sya  (:,:,jl), syya  (:,:,jl), sxya  (:,:,jl)  )
-                  CALL lim_adv_y( zusnit, v_ice, rzero, zsm, zs0c0 (:,:,jl), sxc0 (:,:,jl),   &  !--- snow heat contents ---
+                  CALL lim_adv_y( zusnit, v_ice, rone , zsm, zs0c0 (:,:,jl), sxc0 (:,:,jl),   &  !--- snow heat contents ---
                      &                                       sxxc0 (:,:,jl), syc0 (:,:,jl), syyc0 (:,:,jl), sxyc0 (:,:,jl)  )
-                  CALL lim_adv_x( zusnit, u_ice, rone , zsm, zs0c0 (:,:,jl), sxc0 (:,:,jl),   &
+                  CALL lim_adv_x( zusnit, u_ice, rzero, zsm, zs0c0 (:,:,jl), sxc0 (:,:,jl),   &
                      &                                       sxxc0 (:,:,jl), syc0 (:,:,jl), syyc0 (:,:,jl), sxyc0 (:,:,jl)  )
                   DO layer = 1, nlay_i                                                           !--- ice heat contents ---
-                     CALL lim_adv_y( zusnit, v_ice, rzero, zsm, zs0e(:,:,layer,jl), sxe (:,:,layer,jl),   & 
+                     CALL lim_adv_y( zusnit, v_ice, rone , zsm, zs0e(:,:,layer,jl), sxe (:,:,layer,jl),   & 
                         &                                       sxxe(:,:,layer,jl), sye (:,:,layer,jl),   &
                         &                                       syye(:,:,layer,jl), sxye(:,:,layer,jl) )
-                     CALL lim_adv_x( zusnit, u_ice, rone , zsm, zs0e(:,:,layer,jl), sxe (:,:,layer,jl),   & 
+                     CALL lim_adv_x( zusnit, u_ice, rzero, zsm, zs0e(:,:,layer,jl), sxe (:,:,layer,jl),   & 
                         &                                       sxxe(:,:,layer,jl), sye (:,:,layer,jl),   &
                         &                                       syye(:,:,layer,jl), sxye(:,:,layer,jl) )
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OFF_SRC/domain.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OFF_SRC/domain.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OFF_SRC/domain.F90	(revision 3570)
@@ -205,5 +205,4 @@
       rdtmax    = rn_rdtmin
       rdth      = rn_rdth
-      nclosea   = nn_closea
 
       REWIND( numnam )             ! Namelist cross land advection
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/BDY/bdyice_lim2.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/BDY/bdyice_lim2.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/BDY/bdyice_lim2.F90	(revision 3570)
@@ -53,5 +53,5 @@
             CYCLE
          CASE(jp_frs)
-            CALL bdy_ice_frs( idx_bdy(ib_bdy), dta_idx(ib_bdy) )
+            CALL bdy_ice_frs( idx_bdy(ib_bdy), dta_bdy(ib_bdy) )
          CASE DEFAULT
             CALL ctl_stop( 'bdy_ice_lim_2 : unrecognised option for open boundaries for ice fields' )
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90	(revision 3570)
@@ -38,6 +38,9 @@
   USE dianam          ! build name of file
   USE lib_mpp         ! distributed memory computing library
-#if defined key_lim2 || defined key_lim3
-  USE ice
+#if defined key_lim2
+  USE ice_2
+#endif
+#if defined key_lim3
+  USE ice_3
 #endif
   USE domvvl
@@ -362,5 +365,5 @@
               WRITE(numout,*)"      List of points in global domain:"
               DO jpt=1,iptglo
-                 WRITE(numout,*)'        # I J ',jpt,coordtemp(jpt)
+                 WRITE(numout,*)'        # I J ',jpt,coordtemp(jpt),directemp(jpt)
               ENDDO                  
            ENDIF
@@ -403,9 +406,7 @@
 
               IF(jsec==nn_secdebug .AND. secs(jsec)%nb_point .NE. 0)THEN
-              WRITE(narea+200,*)'avant secs(jsec)%nb_point iptloc ',secs(jsec)%nb_point,iptloc
               DO jpt = 1,iptloc
                  iiglo = secs(jsec)%listPoint(jpt)%I + jpizoom - 1 + nimpp - 1
                  ijglo = secs(jsec)%listPoint(jpt)%J + jpjzoom - 1 + njmpp - 1
-                 WRITE(narea+200,*)'avant # I J : ',iiglo,ijglo
               ENDDO
               ENDIF
@@ -421,9 +422,7 @@
            ENDIF
            IF(jsec==nn_secdebug .AND. secs(jsec)%nb_point .NE. 0)THEN
-              WRITE(narea+200,*)'apres secs(jsec)%nb_point iptloc ',secs(jsec)%nb_point,iptloc
               DO jpt = 1,secs(jsec)%nb_point
                  iiglo = secs(jsec)%listPoint(jpt)%I + jpizoom - 1 + nimpp - 1
                  ijglo = secs(jsec)%listPoint(jpt)%J + jpjzoom - 1 + njmpp - 1
-                 WRITE(narea+200,*)'apres # I J : ',iiglo,ijglo
               ENDDO
            ENDIF
@@ -626,6 +625,7 @@
         ELSE                                ; isgnv =  1
         ENDIF
-
-        IF( ld_debug )write(numout,*)"isgnu isgnv ",isgnu,isgnv
+        IF( sec%slopeSection .GE. 9999. )     isgnv =  1
+
+        IF( ld_debug )write(numout,*)"sec%slopeSection isgnu isgnv ",sec%slopeSection,isgnu,isgnv
 
         !--------------------------------------!
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DIA/diaptr.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DIA/diaptr.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DIA/diaptr.F90	(revision 3570)
@@ -332,5 +332,5 @@
       !!----------------------------------------------------------------------
       USE oce,     vt  =>   ua   ! use ua as workspace
-      USE oce,     vs  =>   ua   ! use ua as workspace
+      USE oce,     vs  =>   va   ! use va as workspace
       IMPLICIT none
       !!
@@ -378,6 +378,6 @@
                      zv = ( vn(ji,jj,jk) + vn(ji,jj-1,jk) ) * 0.5_wp
 #endif 
-                     vt(:,jj,jk) = zv * tsn(:,jj,jk,jp_tem)
-                     vs(:,jj,jk) = zv * tsn(:,jj,jk,jp_sal)
+                     vt(ji,jj,jk) = zv * tsn(ji,jj,jk,jp_tem)
+                     vs(ji,jj,jk) = zv * tsn(ji,jj,jk,jp_sal)
                   END DO
                END DO
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90	(revision 3570)
@@ -171,5 +171,5 @@
          z3d(:,:,jpk) = 0.e0
          DO jk = 1, jpkm1
-            z3d(:,:,jk) = rau0 * un(:,:,jk) * e1u(:,:) * fse3u(:,:,jk)
+            z3d(:,:,jk) = rau0 * un(:,:,jk) * e2u(:,:) * fse3u(:,:,jk)
          END DO
          CALL iom_put( "u_masstr", z3d )                  ! mass transport in i-direction
@@ -186,5 +186,5 @@
          CALL iom_put( "u_heattr", z2d )                  ! heat transport in i-direction
          DO jk = 1, jpkm1
-            z3d(:,:,jk) = rau0 * vn(:,:,jk) * e2v(:,:) * fse3v(:,:,jk)
+            z3d(:,:,jk) = rau0 * vn(:,:,jk) * e1v(:,:) * fse3v(:,:,jk)
          END DO
          CALL iom_put( "v_masstr", z3d )                  ! mass transport in j-direction
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DOM/closea.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DOM/closea.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DOM/closea.F90	(revision 3570)
@@ -7,4 +7,5 @@
    !!             8.5  !  02-06  (E. Durand, G. Madec)  F90
    !!             9.0  !  06-07  (G. Madec)  add clo_rnf, clo_ups, clo_bat
+   !!        NEMO 3.4  !  03-12  (P.G. Fogli) sbc_clo bug fix & mpp reproducibility
    !!----------------------------------------------------------------------
 
@@ -20,6 +21,8 @@
    USE in_out_manager  ! I/O manager
    USE sbc_oce         ! ocean surface boundary conditions
-   USE lib_mpp         ! distributed memory computing library
-   USE lbclnk          ! ???
+   USE lib_fortran,    ONLY: glob_sum, DDPDD
+   USE lbclnk          ! lateral boundary condition - MPP exchanges
+   USE lib_mpp         ! MPP library
+   USE timing
 
    IMPLICIT NONE
@@ -85,4 +88,12 @@
          SELECT CASE ( jp_cfg )
          !                                           ! =======================
+         CASE ( 1 )                                  ! ORCA_R1 configuration
+            !                                        ! =======================
+            ncsnr(1)   = 1    ; ncstt(1)   = 0           ! Caspian Sea
+            ncsi1(1)   = 332  ; ncsj1(1)   = 203
+            ncsi2(1)   = 344  ; ncsj2(1)   = 235
+            ncsir(1,1) = 1    ; ncsjr(1,1) = 1
+            !                                        
+            !                                        ! =======================
          CASE ( 2 )                                  !  ORCA_R2 configuration
             !                                        ! =======================
@@ -177,9 +188,12 @@
       INTEGER, INTENT(in) ::   kt   ! ocean model time step
       !
-      INTEGER                     ::   ji, jj, jc, jn   ! dummy loop indices
-      REAL(wp)                    ::   zze2
-      REAL(wp), DIMENSION (jpncs) ::   zfwf 
-      !!----------------------------------------------------------------------
-      !
+      INTEGER             ::   ji, jj, jc, jn   ! dummy loop indices
+      REAL(wp), PARAMETER ::   rsmall = 1.e-20_wp    ! Closed sea correction epsilon
+      REAL(wp)            ::   zze2, ztmp, zcorr     ! 
+      COMPLEX(wp)         ::   ctmp 
+      REAL(wp), DIMENSION(jpncs) ::   zfwf   ! 1D workspace
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('sbc_clo')
       !                                                   !------------------!
       IF( kt == nit000 ) THEN                             !  Initialisation  !
@@ -189,16 +203,31 @@
          IF(lwp) WRITE(numout,*)'~~~~~~~'
 
-         ! Total surface of ocean
-         surf(jpncs+1) = SUM( e1t(:,:) * e2t(:,:) * tmask_i(:,:) )
-
-         DO jc = 1, jpncs
-            surf(jc) =0.e0
-            DO jj = ncsj1(jc), ncsj2(jc)
-               DO ji = ncsi1(jc), ncsi2(jc)
-                  surf(jc) = surf(jc) + e1t(ji,jj) * e2t(ji,jj) * tmask_i(ji,jj)      ! surface of closed seas
+         surf(:) = 0.e0_wp
+         !
+         surf(jpncs+1) = glob_sum( e1e2t(:,:) )   ! surface of the global ocean
+         !
+         !                                        ! surface of closed seas 
+         IF( lk_mpp_rep ) THEN                         ! MPP reproductible calculation
+            DO jc = 1, jpncs
+               ctmp = CMPLX( 0.e0, 0.e0, wp )
+               DO jj = ncsj1(jc), ncsj2(jc)
+                  DO ji = ncsi1(jc), ncsi2(jc)
+                     ztmp = e1e2t(ji,jj) * tmask_i(ji,jj)
+                     CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
+                  END DO 
                END DO 
-            END DO 
-         END DO 
-         IF( lk_mpp )   CALL mpp_sum ( surf, jpncs+1 )       ! mpp: sum over all the global domain
+               IF( lk_mpp )   CALL mpp_sum( ctmp )
+               surf(jc) = REAL(ctmp,wp)
+            END DO
+         ELSE                                          ! Standard calculation           
+            DO jc = 1, jpncs
+               DO jj = ncsj1(jc), ncsj2(jc)
+                  DO ji = ncsi1(jc), ncsi2(jc)
+                     surf(jc) = surf(jc) + e1e2t(ji,jj) * tmask_i(ji,jj)      ! surface of closed seas
+                  END DO 
+               END DO 
+            END DO 
+            IF( lk_mpp )   CALL mpp_sum ( surf, jpncs )       ! mpp: sum over all the global domain
+         ENDIF
 
          IF(lwp) WRITE(numout,*)'     Closed sea surfaces'
@@ -215,74 +244,108 @@
       !                                                   !--------------------!
       !                                                   !  update emp, emps  !
-      zfwf = 0.e0                                         !--------------------!
-      DO jc = 1, jpncs
-         DO jj = ncsj1(jc), ncsj2(jc)
-            DO ji = ncsi1(jc), ncsi2(jc)
-               zfwf(jc) = zfwf(jc) + e1t(ji,jj) * e2t(ji,jj) * ( emp(ji,jj)-rnf(ji,jj) ) * tmask_i(ji,jj) 
-            END DO  
-         END DO 
-      END DO
-      IF( lk_mpp )   CALL mpp_sum ( zfwf(:) , jpncs )       ! mpp: sum over all the global domain
+      zfwf = 0.e0_wp                                      !--------------------!
+      IF( lk_mpp_rep ) THEN                         ! MPP reproductible calculation
+         DO jc = 1, jpncs
+            ctmp = CMPLX( 0.e0, 0.e0, wp )
+            DO jj = ncsj1(jc), ncsj2(jc)
+               DO ji = ncsi1(jc), ncsi2(jc)
+                  ztmp = e1e2t(ji,jj) * ( emp(ji,jj)-rnf(ji,jj) ) * tmask_i(ji,jj)
+                  CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
+               END DO  
+            END DO 
+            IF( lk_mpp )   CALL mpp_sum( ctmp )
+            zfwf(jc) = REAL(ctmp,wp)
+         END DO
+      ELSE                                          ! Standard calculation           
+         DO jc = 1, jpncs
+            DO jj = ncsj1(jc), ncsj2(jc)
+               DO ji = ncsi1(jc), ncsi2(jc)
+                  zfwf(jc) = zfwf(jc) + e1e2t(ji,jj) * ( emp(ji,jj)-rnf(ji,jj) ) * tmask_i(ji,jj) 
+               END DO  
+            END DO 
+         END DO
+         IF( lk_mpp )   CALL mpp_sum ( zfwf(:) , jpncs )       ! mpp: sum over all the global domain
+      ENDIF
 
       IF( cp_cfg == "orca" .AND. jp_cfg == 2 ) THEN      ! Black Sea case for ORCA_R2 configuration
-         zze2    = ( zfwf(3) + zfwf(4) ) / 2.
+         zze2    = ( zfwf(3) + zfwf(4) ) * 0.5_wp
          zfwf(3) = zze2
          zfwf(4) = zze2
       ENDIF
 
+      zcorr = 0._wp
+
       DO jc = 1, jpncs
          !
-         IF( ncstt(jc) == 0 ) THEN 
-            ! water/evap excess is shared by all open ocean
-            emp (:,:) = emp (:,:) + zfwf(jc) / surf(jpncs+1)
-            emps(:,:) = emps(:,:) + zfwf(jc) / surf(jpncs+1)
-         ELSEIF( ncstt(jc) == 1 ) THEN 
-            ! Excess water in open sea, at outflow location, excess evap shared
-            IF ( zfwf(jc) <= 0.e0 ) THEN 
-                DO jn = 1, ncsnr(jc)
+         ! The following if avoids the redistribution of the round off
+         IF ( ABS(zfwf(jc) / surf(jpncs+1) ) > rsmall) THEN
+            !
+            IF( ncstt(jc) == 0 ) THEN           ! water/evap excess is shared by all open ocean
+               emp (:,:) = emp (:,:) + zfwf(jc) / surf(jpncs+1)
+               emps(:,:) = emps(:,:) + zfwf(jc) / surf(jpncs+1)
+               ! accumulate closed seas correction
+               zcorr     = zcorr     + zfwf(jc) / surf(jpncs+1)
+               !
+            ELSEIF( ncstt(jc) == 1 ) THEN       ! Excess water in open sea, at outflow location, excess evap shared
+               IF ( zfwf(jc) <= 0.e0_wp ) THEN 
+                   DO jn = 1, ncsnr(jc)
+                     ji = mi0(ncsir(jc,jn))
+                     jj = mj0(ncsjr(jc,jn)) ! Location of outflow in open ocean
+                     IF (      ji > 1 .AND. ji < jpi   &
+                         .AND. jj > 1 .AND. jj < jpj ) THEN 
+                         emp (ji,jj) = emp (ji,jj) + zfwf(jc) / ( REAL(ncsnr(jc)) * e1e2t(ji,jj) )
+                         emps(ji,jj) = emps(ji,jj) + zfwf(jc) / ( REAL(ncsnr(jc)) * e1e2t(ji,jj) )
+                     ENDIF 
+                   END DO 
+               ELSE 
+                   emp (:,:) = emp (:,:) + zfwf(jc) / surf(jpncs+1)
+                   emps(:,:) = emps(:,:) + zfwf(jc) / surf(jpncs+1)
+                   ! accumulate closed seas correction
+                   zcorr     = zcorr     + zfwf(jc) / surf(jpncs+1)
+               ENDIF
+            ELSEIF( ncstt(jc) == 2 ) THEN       ! Excess e-p-r (either sign) goes to open ocean, at outflow location
+               DO jn = 1, ncsnr(jc)
                   ji = mi0(ncsir(jc,jn))
                   jj = mj0(ncsjr(jc,jn)) ! Location of outflow in open ocean
-                  IF (      ji > 1 .AND. ji < jpi   &
-                      .AND. jj > 1 .AND. jj < jpj ) THEN 
-                      emp (ji,jj) = emp (ji,jj) + zfwf(jc) /   &
-                         (FLOAT(ncsnr(jc)) * e1t(ji,jj) * e2t(ji,jj))
-                      emps(ji,jj) = emps(ji,jj) + zfwf(jc) /   &
-                          (FLOAT(ncsnr(jc)) * e1t(ji,jj) * e2t(ji,jj))
-                  END IF 
-                END DO 
-            ELSE 
-                emp (:,:) = emp (:,:) + zfwf(jc) / surf(jpncs+1)
-                emps(:,:) = emps(:,:) + zfwf(jc) / surf(jpncs+1)
-            ENDIF
-         ELSEIF( ncstt(jc) == 2 ) THEN 
-            ! Excess e-p+r (either sign) goes to open ocean, at outflow location
-            IF(      ji > 1 .AND. ji < jpi    &
-               .AND. jj > 1 .AND. jj < jpj ) THEN 
-                DO jn = 1, ncsnr(jc)
-                  ji = mi0(ncsir(jc,jn))
-                  jj = mj0(ncsjr(jc,jn)) ! Location of outflow in open ocean
-                  emp (ji,jj) = emp (ji,jj) + zfwf(jc)   &
-                      / (FLOAT(ncsnr(jc)) *  e1t(ji,jj) * e2t(ji,jj) )
-                  emps(ji,jj) = emps(ji,jj) + zfwf(jc)   &
-                      / (FLOAT(ncsnr(jc)) *  e1t(ji,jj) * e2t(ji,jj) )
-                END DO 
+                  IF(      ji > 1 .AND. ji < jpi    &
+                     .AND. jj > 1 .AND. jj < jpj ) THEN 
+                     emp (ji,jj) = emp (ji,jj) + zfwf(jc) / ( REAL(ncsnr(jc)) *  e1e2t(ji,jj) )
+                     emps(ji,jj) = emps(ji,jj) + zfwf(jc) / ( REAL(ncsnr(jc)) *  e1e2t(ji,jj) )
+                  ENDIF 
+               END DO 
             ENDIF 
-         ENDIF 
-         !
-         DO jj = ncsj1(jc), ncsj2(jc)
-            DO ji = ncsi1(jc), ncsi2(jc)
-               emp (ji,jj) = emp (ji,jj) - zfwf(jc) / surf(jc)
-               emps(ji,jj) = emps(ji,jj) - zfwf(jc) / surf(jc)
-            END DO  
-         END DO 
-         !
+            !
+            DO jj = ncsj1(jc), ncsj2(jc)
+               DO ji = ncsi1(jc), ncsi2(jc)
+                  emp (ji,jj) = emp (ji,jj) - zfwf(jc) / surf(jc)
+                  emps(ji,jj) = emps(ji,jj) - zfwf(jc) / surf(jc)
+               END DO  
+            END DO 
+            !
+         END IF
       END DO 
-      !
-      CALL lbc_lnk( emp , 'T', 1. )
-      CALL lbc_lnk( emps, 'T', 1. )
+
+      IF ( ABS(zcorr) > rsmall ) THEN      ! remove the global correction from the closed seas
+         DO jc = 1, jpncs                  ! only if it is large enough
+            DO jj = ncsj1(jc), ncsj2(jc)
+               DO ji = ncsi1(jc), ncsi2(jc)
+                  emp (ji,jj) = emp (ji,jj) - zcorr
+                  emps(ji,jj) = emps(ji,jj) - zcorr
+               END DO  
+             END DO 
+          END DO
+      ENDIF
+      !
+      emp (:,:) = emp (:,:) * tmask(:,:,1)
+      emps(:,:) = emps(:,:) * tmask(:,:,1)
+      !
+      CALL lbc_lnk( emp , 'T', 1._wp )
+      CALL lbc_lnk( emps, 'T', 1._wp )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('sbc_clo')
       !
    END SUBROUTINE sbc_clo
-   
-   
+
+
    SUBROUTINE clo_rnf( p_rnfmsk )
       !!---------------------------------------------------------------------
@@ -308,5 +371,5 @@
                ii = mi0( ncsir(jc,jn) )
                ij = mj0( ncsjr(jc,jn) )
-               p_rnfmsk(ii,ij) = MAX( p_rnfmsk(ii,ij), 1.0 )
+               p_rnfmsk(ii,ij) = MAX( p_rnfmsk(ii,ij), 1.0_wp )
             END DO 
          ENDIF 
@@ -336,5 +399,5 @@
          DO jj = ncsj1(jc), ncsj2(jc)
             DO ji = ncsi1(jc), ncsi2(jc)
-               p_upsmsk(ji,jj) = 0.5            ! mixed upstream/centered scheme over closed seas
+               p_upsmsk(ji,jj) = 0.5_wp         ! mixed upstream/centered scheme over closed seas
             END DO 
          END DO 
@@ -374,2 +437,3 @@
    !!======================================================================
 END MODULE closea
+
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90	(revision 3570)
@@ -52,5 +52,4 @@
    REAL(wp), PUBLIC ::   rdtmax          !: maximum time step on tracers
    REAL(wp), PUBLIC ::   rdth            !: depth variation of tracer step
-   INTEGER , PUBLIC ::   nclosea         !: =0 suppress closed sea/lake from the ORCA domain or not (=1)
 
    !                                                  !!! associated variables
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 3570)
@@ -238,5 +238,4 @@
       rdtmax    = rn_rdtmin
       rdth      = rn_rdth
-      nclosea   = nn_closea
 
       REWIND( numnam )              ! Namelist cross land advection
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90	(revision 3570)
@@ -422,7 +422,7 @@
             CALL iom_close( inum )
             mbathy(:,:) = INT( bathy(:,:) )
-            !                                                ! =====================
+            !
             IF( cp_cfg == "orca" .AND. jp_cfg == 2 ) THEN    ! ORCA R2 configuration
-               !                                             ! =====================
+               !
                IF( nn_cla == 0 ) THEN
                   ii0 = 140   ;   ii1 = 140                  ! Gibraltar Strait open 
@@ -454,7 +454,7 @@
             CALL iom_get  ( inum, jpdom_data, 'Bathymetry', bathy )
             CALL iom_close( inum )
-            !                                                ! =====================
+            !                                                
             IF( cp_cfg == "orca" .AND. jp_cfg == 2 ) THEN    ! ORCA R2 configuration
-               !                                             ! =====================
+               !
               IF( nn_cla == 0 ) THEN
                  ii0 = 140   ;   ii1 = 140                   ! Gibraltar Strait open 
@@ -489,20 +489,7 @@
       ENDIF
       !
-      !                                               ! =========================== !
-      IF( nclosea == 0 ) THEN                         !   NO closed seas or lakes   !
-         DO jl = 1, jpncs                             ! =========================== !
-            DO jj = ncsj1(jl), ncsj2(jl)
-               DO ji = ncsi1(jl), ncsi2(jl)
-                  mbathy(ji,jj) = 0                   ! suppress closed seas and lakes from bathymetry
-                  bathy (ji,jj) = 0._wp               
-               END DO
-            END DO
-         END DO
-      ENDIF
-      !
-      !                                               ! =========================== !
-      !                                               !     set a minimum depth     !
-      !                                               ! =========================== !
-      IF ( .not. ln_sco ) THEN
+      IF( nn_closea == 0 )   CALL clo_bat( bathy, mbathy )    !==  NO closed seas or lakes  ==!
+      !                       
+      IF ( .not. ln_sco ) THEN                                !==  set a minimum depth  ==!
          IF( rn_hmin < 0._wp ) THEN    ;   ik = - INT( rn_hmin )                                      ! from a nb of level
          ELSE                          ;   ik = MINLOC( gdepw_0, mask = gdepw_0 > rn_hmin, dim = 1 )  ! from a depth
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90	(revision 3570)
@@ -678,11 +678,10 @@
       REAL(wp) :: zrhdt1 
       REAL(wp) :: zdpdx1, zdpdx2, zdpdy1, zdpdy2
-      INTEGER  :: zbhitwe, zbhitns
-      REAL(wp), POINTER, DIMENSION(:,:,:) ::   zdeptht, zrhh 
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::   zdept, zrhh 
       REAL(wp), POINTER, DIMENSION(:,:,:) ::   zhpi, zu, zv, fsp, xsp, asp, bsp, csp, dsp
       !!----------------------------------------------------------------------
       !
       CALL wrk_alloc( jpi,jpj,jpk, zhpi, zu, zv, fsp, xsp, asp, bsp, csp, dsp ) 
-      CALL wrk_alloc( jpi,jpj,jpk, zdeptht, zrhh ) 
+      CALL wrk_alloc( jpi,jpj,jpk, zdept, zrhh ) 
       !
       IF( kt == nit000 ) THEN
@@ -717,23 +716,15 @@
       END DO
 
-      ! Transfer the depth of "T(:,:,:)" to vertical coordinate "zdeptht(:,:,:)"
-      DO jj = 1, jpj
-        DO ji = 1, jpi
-          zdeptht(ji,jj,1) = 0.5_wp * fse3w(ji,jj,1)
-          zdeptht(ji,jj,1) = zdeptht(ji,jj,1) - sshn(ji,jj) * znad
-          DO jk = 2, jpk
-             zdeptht(ji,jj,jk) = zdeptht(ji,jj,jk-1) + fse3w(ji,jj,jk)
-          END DO
-        END DO
-      END DO
-
-      DO jk = 1, jpkm1
-        DO jj = 1, jpj
-          DO ji = 1, jpi
-            fsp(ji,jj,jk) = zrhh(ji,jj,jk)
-            xsp(ji,jj,jk) = zdeptht(ji,jj,jk)
-          END DO
-        END DO
-      END DO
+      ! Transfer the depth of "T(:,:,:)" to vertical coordinate "zdept(:,:,:)"
+      DO jj = 1, jpj;   DO ji = 1, jpi
+          zdept(ji,jj,1) = 0.5_wp * fse3w(ji,jj,1) - sshn(ji,jj) * znad
+      END DO        ;   END DO
+
+      DO jk = 2, jpk;   DO jj = 1, jpj;   DO ji = 1, jpi
+          zdept(ji,jj,jk) = zdept(ji,jj,jk-1) + fse3w(ji,jj,jk)
+      END DO        ;   END DO        ;   END DO
+
+      fsp(:,:,:) = zrhh(:,:,:)
+      xsp(:,:,:) = zdept(:,:,:)
 
       ! Construct the vertical density profile with the 
@@ -745,8 +736,7 @@
       DO jj = 2, jpj
         DO ji = 2, jpi 
-          zrhdt1 = zrhh(ji,jj,1) - interp3(zdeptht(ji,jj,1),asp(ji,jj,1), &
+          zrhdt1 = zrhh(ji,jj,1) - interp3(zdept(ji,jj,1),asp(ji,jj,1), &
                                          bsp(ji,jj,1),   csp(ji,jj,1), &
-                                         dsp(ji,jj,1) ) * 0.5_wp * zdeptht(ji,jj,1)
-          zrhdt1 = MAX(zrhdt1, 1000._wp - rau0)        ! no lighter than fresh water
+                                         dsp(ji,jj,1) ) * 0.25_wp * fse3w(ji,jj,1)
 
           ! assuming linear profile across the top half surface layer
@@ -760,5 +750,5 @@
           DO ji = 2, jpi
             zhpi(ji,jj,jk) = zhpi(ji,jj,jk-1) +                          &
-                             integ2(zdeptht(ji,jj,jk-1), zdeptht(ji,jj,jk),&
+                             integ_spline(zdept(ji,jj,jk-1), zdept(ji,jj,jk),&
                                     asp(ji,jj,jk-1),    bsp(ji,jj,jk-1), &
                                     csp(ji,jj,jk-1),    dsp(ji,jj,jk-1))
@@ -793,4 +783,16 @@
       END DO
 
+      DO jk = 1, jpkm1
+        DO jj = 2, jpjm1
+          DO ji = 2, jpim1
+            zu(ji,jj,jk) = min(zu(ji,jj,jk), max(-zdept(ji,jj,jk), -zdept(ji+1,jj,jk)))
+            zu(ji,jj,jk) = max(zu(ji,jj,jk), min(-zdept(ji,jj,jk), -zdept(ji+1,jj,jk)))
+            zv(ji,jj,jk) = min(zv(ji,jj,jk), max(-zdept(ji,jj,jk), -zdept(ji,jj+1,jk)))
+            zv(ji,jj,jk) = max(zv(ji,jj,jk), min(-zdept(ji,jj,jk), -zdept(ji,jj+1,jk)))
+          END DO
+        END DO
+      END DO
+
+
       DO jk = 1, jpkm1                                  
         DO jj = 2, jpjm1     
@@ -803,5 +805,5 @@
             !!!!!     for u equation
             IF( jk <= mbku(ji,jj) ) THEN
-               IF( -zdeptht(ji+1,jj,mbku(ji,jj)) >= -zdeptht(ji,jj,mbku(ji,jj)) ) THEN
+               IF( -zdept(ji+1,jj,jk) >= -zdept(ji,jj,jk) ) THEN
                  jis = ji + 1; jid = ji
                ELSE
@@ -811,13 +813,12 @@
                ! integrate the pressure on the shallow side
                jk1 = jk 
-               zbhitwe = 0
-               DO WHILE ( -zdeptht(jis,jj,jk1) > zuijk )
+               DO WHILE ( -zdept(jis,jj,jk1) > zuijk )
                  IF( jk1 == mbku(ji,jj) ) THEN
-                   zbhitwe = 1
+                   zuijk = -zdept(jis,jj,jk1)
                    EXIT
                  ENDIF
-                 zdeps = MIN(zdeptht(jis,jj,jk1+1), -zuijk)
+                 zdeps = MIN(zdept(jis,jj,jk1+1), -zuijk)
                  zpwes = zpwes +                                    & 
-                      integ2(zdeptht(jis,jj,jk1), zdeps,            &
+                      integ_spline(zdept(jis,jj,jk1), zdeps,            &
                              asp(jis,jj,jk1),    bsp(jis,jj,jk1), &
                              csp(jis,jj,jk1),    dsp(jis,jj,jk1))
@@ -825,19 +826,18 @@
                END DO
             
-               IF(zbhitwe == 1) THEN
-                 zuijk = -zdeptht(jis,jj,jk1)
-               ENDIF
-
                ! integrate the pressure on the deep side
                jk1 = jk 
-               zbhitwe = 0
-               DO WHILE ( -zdeptht(jid,jj,jk1) < zuijk )
+               DO WHILE ( -zdept(jid,jj,jk1) < zuijk )
                  IF( jk1 == 1 ) THEN
-                   zbhitwe = 1
+                   zdeps = zdept(jid,jj,1) + MIN(zuijk, sshn(jid,jj)*znad)
+                   zrhdt1 = zrhh(jid,jj,1) - interp3(zdept(jid,jj,1), asp(jid,jj,1), &
+                                                     bsp(jid,jj,1),   csp(jid,jj,1), &
+                                                     dsp(jid,jj,1)) * zdeps
+                   zpwed  = zpwed + 0.5_wp * (zrhh(jid,jj,1) + zrhdt1) * zdeps
                    EXIT
                  ENDIF
-                 zdeps = MAX(zdeptht(jid,jj,jk1-1), -zuijk)
+                 zdeps = MAX(zdept(jid,jj,jk1-1), -zuijk)
                  zpwed = zpwed +                                        & 
-                        integ2(zdeps,              zdeptht(jid,jj,jk1), &
+                        integ_spline(zdeps,              zdept(jid,jj,jk1), &
                                asp(jid,jj,jk1-1), bsp(jid,jj,jk1-1),  &
                                csp(jid,jj,jk1-1), dsp(jid,jj,jk1-1) )
@@ -845,13 +845,4 @@
                END DO
             
-               IF( zbhitwe == 1 ) THEN
-                 zdeps = zdeptht(jid,jj,1) + MIN(zuijk, sshn(jid,jj)*znad)
-                 zrhdt1 = zrhh(jid,jj,1) - interp3(zdeptht(jid,jj,1), asp(jid,jj,1), &
-                                                 bsp(jid,jj,1),    csp(jid,jj,1), &
-                                                 dsp(jid,jj,1)) * zdeps
-                 zrhdt1 = MAX(zrhdt1, 1000._wp - rau0)        ! no lighter than fresh water
-                 zpwed  = zpwed + 0.5_wp * (zrhh(jid,jj,1) + zrhdt1) * zdeps
-               ENDIF
-
                ! update the momentum trends in u direction
 
@@ -870,5 +861,5 @@
             !!!!!     for v equation
             IF( jk <= mbkv(ji,jj) ) THEN
-               IF( -zdeptht(ji,jj+1,mbkv(ji,jj)) >= -zdeptht(ji,jj,mbkv(ji,jj)) ) THEN
+               IF( -zdept(ji,jj+1,jk) >= -zdept(ji,jj,jk) ) THEN
                  jjs = jj + 1; jjd = jj
                ELSE
@@ -878,13 +869,12 @@
                ! integrate the pressure on the shallow side
                jk1 = jk 
-               zbhitns = 0
-               DO WHILE ( -zdeptht(ji,jjs,jk1) > zvijk )
+               DO WHILE ( -zdept(ji,jjs,jk1) > zvijk )
                  IF( jk1 == mbkv(ji,jj) ) THEN
-                   zbhitns = 1
+                   zvijk = -zdept(ji,jjs,jk1)
                    EXIT
                  ENDIF
-                 zdeps = MIN(zdeptht(ji,jjs,jk1+1), -zvijk)
+                 zdeps = MIN(zdept(ji,jjs,jk1+1), -zvijk)
                  zpnss = zpnss +                                      & 
-                        integ2(zdeptht(ji,jjs,jk1), zdeps,            &
+                        integ_spline(zdept(ji,jjs,jk1), zdeps,            &
                                asp(ji,jjs,jk1),    bsp(ji,jjs,jk1), &
                                csp(ji,jjs,jk1),    dsp(ji,jjs,jk1) )
@@ -892,19 +882,18 @@
                END DO
             
-               IF(zbhitns == 1) THEN
-                 zvijk = -zdeptht(ji,jjs,jk1)
-               ENDIF
-
                ! integrate the pressure on the deep side
                jk1 = jk 
-               zbhitns = 0
-               DO WHILE ( -zdeptht(ji,jjd,jk1) < zvijk )
+               DO WHILE ( -zdept(ji,jjd,jk1) < zvijk )
                  IF( jk1 == 1 ) THEN
-                   zbhitns = 1
+                   zdeps = zdept(ji,jjd,1) + MIN(zvijk, sshn(ji,jjd)*znad)
+                   zrhdt1 = zrhh(ji,jjd,1) - interp3(zdept(ji,jjd,1), asp(ji,jjd,1), &
+                                                     bsp(ji,jjd,1),   csp(ji,jjd,1), &
+                                                     dsp(ji,jjd,1) ) * zdeps
+                   zpnsd  = zpnsd + 0.5_wp * (zrhh(ji,jjd,1) + zrhdt1) * zdeps
                    EXIT
                  ENDIF
-                 zdeps = MAX(zdeptht(ji,jjd,jk1-1), -zvijk)
+                 zdeps = MAX(zdept(ji,jjd,jk1-1), -zvijk)
                  zpnsd = zpnsd +                                        & 
-                        integ2(zdeps,              zdeptht(ji,jjd,jk1), &
+                        integ_spline(zdeps,              zdept(ji,jjd,jk1), &
                                asp(ji,jjd,jk1-1), bsp(ji,jjd,jk1-1), &
                                csp(ji,jjd,jk1-1), dsp(ji,jjd,jk1-1) )
@@ -912,12 +901,4 @@
                END DO
             
-               IF( zbhitns == 1 ) THEN
-                 zdeps = zdeptht(ji,jjd,1) + MIN(zvijk, sshn(ji,jjd)*znad)
-                 zrhdt1 = zrhh(ji,jjd,1) - interp3(zdeptht(ji,jjd,1), asp(ji,jjd,1), &
-                                                 bsp(ji,jjd,1),    csp(ji,jjd,1), &
-                                                 dsp(ji,jjd,1) ) * zdeps
-                 zrhdt1 = MAX(zrhdt1, 1000._wp - rau0)        ! no lighter than fresh water
-                 zpnsd  = zpnsd + 0.5_wp * (zrhh(ji,jjd,1) + zrhdt1) * zdeps
-               ENDIF
 
                ! update the momentum trends in v direction
@@ -941,5 +922,5 @@
       !
       CALL wrk_dealloc( jpi,jpj,jpk, zhpi, zu, zv, fsp, xsp, asp, bsp, csp, dsp ) 
-      CALL wrk_dealloc( jpi,jpj,jpk, zdeptht, zrhh ) 
+      CALL wrk_dealloc( jpi,jpj,jpk, zdept, zrhh ) 
       !
    END SUBROUTINE hpg_prj
@@ -1121,5 +1102,5 @@
 
    
-   FUNCTION integ2(xl, xr, a, b, c, d)  RESULT(f) 
+   FUNCTION integ_spline(xl, xr, a, b, c, d)  RESULT(f) 
       !!----------------------------------------------------------------------
       !!                 ***  ROUTINE interp1  ***
@@ -1143,7 +1124,8 @@
          & xl * ( a + xl * ( za1 + xl * ( za2 + za3 * xl ) ) )
 
-   END FUNCTION integ2
+   END FUNCTION integ_spline
 
 
    !!======================================================================
 END MODULE dynhpg
+
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/IOM/prtctl.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/IOM/prtctl.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/IOM/prtctl.F90	(revision 3570)
@@ -118,6 +118,6 @@
       IF( PRESENT(tab2d_1) )   ztab2d_1(:,:)        = tab2d_1(:,:)
       IF( PRESENT(tab2d_2) )   ztab2d_2(:,:)        = tab2d_2(:,:)
-      IF( PRESENT(tab3d_1) )   ztab3d_1(:,:,1:kdir) = tab3d_1(:,:,:)
-      IF( PRESENT(tab3d_2) )   ztab3d_2(:,:,1:kdir) = tab3d_2(:,:,:)
+      IF( PRESENT(tab3d_1) )   ztab3d_1(:,:,1:kdir) = tab3d_1(:,:,1:kdir)
+      IF( PRESENT(tab3d_2) )   ztab3d_2(:,:,1:kdir) = tab3d_2(:,:,1:kdir)
       IF( PRESENT(mask1)   )   zmask1  (:,:,:)      = mask1  (:,:,:)
       IF( PRESENT(mask2)   )   zmask2  (:,:,:)      = mask2  (:,:,:)
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 3570)
@@ -80,10 +80,6 @@
    END INTERFACE
    INTERFACE mpp_sum
-# if defined key_mpp_rep
       MODULE PROCEDURE mppsum_a_int, mppsum_int, mppsum_a_real, mppsum_real, &
                        mppsum_realdd, mppsum_a_realdd
-# else
-      MODULE PROCEDURE mppsum_a_int, mppsum_int, mppsum_a_real, mppsum_real
-# endif
    END INTERFACE
    INTERFACE mpp_lbc_north
@@ -114,10 +110,9 @@
 !$AGRIF_END_DO_NOT_TREAT
 
-# if defined key_mpp_rep
    INTEGER :: MPI_SUMDD
-# endif
 
    ! variables used in case of sea-ice
-   INTEGER, PUBLIC ::   ncomm_ice       !: communicator made by the processors with sea-ice
+   INTEGER, PUBLIC ::   ncomm_ice       !: communicator made by the processors with sea-ice (public so that it can be freed in limthd)
+   INTEGER ::   ngrp_iworld     !  group ID for the world processors (for rheology)
    INTEGER ::   ngrp_ice        !  group ID for the ice processors (for rheology)
    INTEGER ::   ndim_rank_ice   !  number of 'ice' processors
@@ -355,7 +350,5 @@
       mynode = mpprank
       ! 
-#if defined key_mpp_rep
       CALL MPI_OP_CREATE(DDPDD_MPI, .TRUE., MPI_SUMDD, ierr)
-#endif
       !
    END FUNCTION mynode
@@ -1506,5 +1499,4 @@
    END SUBROUTINE mppsum_real
 
-# if defined key_mpp_rep
    SUBROUTINE mppsum_realdd( ytab, kcom )
       !!----------------------------------------------------------------------
@@ -1559,5 +1551,4 @@
 
    END SUBROUTINE mppsum_a_realdd
-# endif   
    
    SUBROUTINE mpp_minloc2d( ptab, pmask, pmin, ki,kj )
@@ -1977,5 +1968,5 @@
       !!      ndim_rank_ice = number of processors with ice
       !!      nrank_ice (ndim_rank_ice) = ice processors
-      !!      ngrp_world = group ID for the world processors
+      !!      ngrp_iworld = group ID for the world processors
       !!      ngrp_ice = group ID for the ice processors
       !!      ncomm_ice = communicator for the ice procs.
@@ -2026,8 +2017,8 @@
 
       ! Create the world group
-      CALL MPI_COMM_GROUP( mpi_comm_opa, ngrp_world, ierr )
+      CALL MPI_COMM_GROUP( mpi_comm_opa, ngrp_iworld, ierr )
 
       ! Create the ice group from the world group
-      CALL MPI_GROUP_INCL( ngrp_world, ndim_rank_ice, nrank_ice, ngrp_ice, ierr )
+      CALL MPI_GROUP_INCL( ngrp_iworld, ndim_rank_ice, nrank_ice, ngrp_ice, ierr )
 
       ! Create the ice communicator , ie the pool of procs with sea-ice
@@ -2036,6 +2027,9 @@
       ! Find proc number in the world of proc 0 in the north
       ! The following line seems to be useless, we just comment & keep it as reminder
-      ! CALL MPI_GROUP_TRANSLATE_RANKS(ngrp_ice,1,0,ngrp_world,n_ice_root,ierr)
-      !
+      ! CALL MPI_GROUP_TRANSLATE_RANKS(ngrp_ice,1,0,ngrp_iworld,n_ice_root,ierr)
+      !
+      CALL MPI_GROUP_FREE(ngrp_ice, ierr)
+      CALL MPI_GROUP_FREE(ngrp_iworld, ierr)
+
       DEALLOCATE(kice, zwork)
       !
@@ -2599,5 +2593,4 @@
    END SUBROUTINE mpi_init_opa
 
-#if defined key_mpp_rep
    SUBROUTINE DDPDD_MPI (ydda, yddb, ilen, itype)
       !!---------------------------------------------------------------------
@@ -2628,5 +2621,4 @@
 
    END SUBROUTINE DDPDD_MPI
-#endif
 
 #else
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 3570)
@@ -721,5 +721,4 @@
                !                                                       ! (geographical to local grid -> rotate the components)
                CALL rot_rep( frcv(jpr_otx1)%z3(:,:,1), frcv(jpr_oty1)%z3(:,:,1), srcv(jpr_otx1)%clgrid, 'en->i', ztx )   
-               frcv(jpr_otx1)%z3(:,:,1) = ztx(:,:)      ! overwrite 1st component on the 1st grid
                IF( srcv(jpr_otx2)%laction ) THEN
                   CALL rot_rep( frcv(jpr_otx2)%z3(:,:,1), frcv(jpr_oty2)%z3(:,:,1), srcv(jpr_otx2)%clgrid, 'en->j', zty )   
@@ -727,4 +726,5 @@
                   CALL rot_rep( frcv(jpr_otx1)%z3(:,:,1), frcv(jpr_oty1)%z3(:,:,1), srcv(jpr_otx1)%clgrid, 'en->j', zty )  
                ENDIF
+               frcv(jpr_otx1)%z3(:,:,1) = ztx(:,:)      ! overwrite 1st component on the 1st grid
                frcv(jpr_oty1)%z3(:,:,1) = zty(:,:)      ! overwrite 2nd component on the 2nd grid
             ENDIF
@@ -949,5 +949,4 @@
                !                                                       ! (geographical to local grid -> rotate the components)
                CALL rot_rep( frcv(jpr_itx1)%z3(:,:,1), frcv(jpr_ity1)%z3(:,:,1), srcv(jpr_itx1)%clgrid, 'en->i', ztx )   
-               frcv(jpr_itx1)%z3(:,:,1) = ztx(:,:)      ! overwrite 1st component on the 1st grid
                IF( srcv(jpr_itx2)%laction ) THEN
                   CALL rot_rep( frcv(jpr_itx2)%z3(:,:,1), frcv(jpr_ity2)%z3(:,:,1), srcv(jpr_itx2)%clgrid, 'en->j', zty )   
@@ -955,4 +954,5 @@
                   CALL rot_rep( frcv(jpr_itx1)%z3(:,:,1), frcv(jpr_ity1)%z3(:,:,1), srcv(jpr_itx1)%clgrid, 'en->j', zty )  
                ENDIF
+               frcv(jpr_itx1)%z3(:,:,1) = ztx(:,:)      ! overwrite 1st component on the 1st grid
                frcv(jpr_ity1)%z3(:,:,1) = zty(:,:)      ! overwrite 2nd component on the 1st grid
             ENDIF
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 3570)
@@ -272,23 +272,20 @@
       !                                            !==  Misc. Options  ==!
       
-      SELECT CASE( nn_ice )                                     ! Update heat and freshwater fluxes over sea-ice areas
-      CASE(  1 )   ;       CALL sbc_ice_if   ( kt )                  ! Ice-cover climatology ("Ice-if" model)
-         !                                                      
-      CASE(  2 )   ;       CALL sbc_ice_lim_2( kt, nsbc )            ! LIM-2 ice model
-         IF( lk_bdy )      CALL bdy_ice_lim_2( kt )                  ! BDY boundary condition
-         !                                                     
-      CASE(  3 )   ;       CALL sbc_ice_lim  ( kt, nsbc )            ! LIM-3 ice model
-         !
-      CASE(  4 )   ;       CALL sbc_ice_cice ( kt, nsbc )            ! CICE ice model
+      SELECT CASE( nn_ice )                                       ! Update heat and freshwater fluxes over sea-ice areas
+      CASE(  1 )   ;         CALL sbc_ice_if   ( kt )                ! Ice-cover climatology ("Ice-if" model)
+      CASE(  2 )   ;         CALL sbc_ice_lim_2( kt, nsbc )          ! LIM-2 ice model
+              IF( lk_bdy )   CALL bdy_ice_lim_2( kt )                ! BDY boundary condition
+      CASE(  3 )   ;         CALL sbc_ice_lim  ( kt, nsbc )          ! LIM-3 ice model
+      CASE(  4 )   ;         CALL sbc_ice_cice ( kt, nsbc )          ! CICE ice model
       END SELECT                                              
 
-      IF( ln_rnf       )   CALL sbc_rnf( kt )                   ! add runoffs to fresh water fluxes
+      IF( ln_rnf         )   CALL sbc_rnf( kt )                   ! add runoffs to fresh water fluxes
  
-      IF( ln_ssr       )   CALL sbc_ssr( kt )                   ! add SST/SSS damping term
-
-      IF( nn_fwb  /= 0 )   CALL sbc_fwb( kt, nn_fwb, nn_fsbc )  ! control the freshwater budget
-
-      IF( nclosea == 1 )   CALL sbc_clo( kt )                   ! treatment of closed sea in the model domain 
-      !                                                         ! (update freshwater fluxes)
+      IF( ln_ssr         )   CALL sbc_ssr( kt )                   ! add SST/SSS damping term
+
+      IF( nn_fwb    /= 0 )   CALL sbc_fwb( kt, nn_fwb, nn_fsbc )  ! control the freshwater budget
+
+      IF( nn_closea == 1 )   CALL sbc_clo( kt )                   ! treatment of closed sea in the model domain 
+      !                                                           ! (update freshwater fluxes)
 !RBbug do not understand why see ticket 667
       CALL lbc_lnk( emp, 'T', 1. )
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 3570)
@@ -457,7 +457,7 @@
       CALL iom_close( inum )                                      ! close file
       
-      IF( nclosea == 1 )    CALL clo_rnf( rnfmsk )                ! closed sea inflow set as ruver mouth
-
-      rnfmsk_z(:)   = 0._wp                                        ! vertical structure 
+      IF( nn_closea == 1 )   CALL clo_rnf( rnfmsk )               ! closed sea inflow set as ruver mouth
+
+      rnfmsk_z(:)   = 0._wp                                       ! vertical structure 
       rnfmsk_z(1)   = 1.0
       rnfmsk_z(2)   = 1.0                                         ! **********
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_iso_grif.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_iso_grif.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_iso_grif.F90	(revision 3570)
@@ -225,6 +225,6 @@
             DO jj = 2, jpjm1
                DO ji = fs_2, fs_jpim1  ! vector opt.
-                  zw3d(ji,jj,jk) = (psiy_eiv(ji,jj,jk) - psiy_eiv(ji,jj-1,jk))/e2v(ji,jj) + &
-                       &    (psix_eiv(ji,jj,jk) - psix_eiv(ji-1,jj,jk))/e1u(ji,jj) ! w_eiv = dpsiy/dy + dpsiy/dx
+                  zw3d(ji,jj,jk) = (psiy_eiv(ji,jj,jk) - psiy_eiv(ji,jj-1,jk))/e2t(ji,jj) + &
+                       &    (psix_eiv(ji,jj,jk) - psix_eiv(ji-1,jj,jk))/e1t(ji,jj) ! w_eiv = dpsiy/dy + dpsiy/dx
                END DO
             END DO
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/TRD/trdtra.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/TRD/trdtra.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/TRD/trdtra.F90	(revision 3570)
@@ -8,5 +8,5 @@
    !!            3.3  !  2010-06  (C. Ethe) merge TRA-TRC 
    !!----------------------------------------------------------------------
-#if  defined key_trdtra || defined key_trdmld || defined key_trdmld_trc 
+#if  defined key_trdtra || defined key_trdtrc || defined key_trdmld || defined key_trdmld_trc 
    !!----------------------------------------------------------------------
    !!   trd_tra      : Call the trend to be computed
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfddm.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfddm.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfddm.F90	(revision 3570)
@@ -227,6 +227,8 @@
       ENDIF
       !
-      !                              ! allocate zdfddm arrays
+      !                               ! allocate zdfddm arrays
       IF( zdf_ddm_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'zdf_ddm_init : unable to allocate arrays' )
+      !                               ! initialization to masked Kz
+      avs(:,:,:) = rn_avt0 * tmask(:,:,:) 
       !
    END SUBROUTINE zdf_ddm_init
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90	(revision 3570)
@@ -87,4 +87,6 @@
    REAL(wp)        , ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   htau           ! depth of tke penetration (nn_htau)
    REAL(wp)        , ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   dissl          ! now mixing lenght of dissipation
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   avt_k , avm_k  ! not enhanced Kz
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   avmu_k, avmv_k ! not enhanced Kz
 #if defined key_c1d
    !                                                                        !!** 1D cfg only  **   ('key_c1d')
@@ -112,5 +114,7 @@
          &      e_pdl(jpi,jpj,jpk) , e_ric(jpi,jpj,jpk) ,                          &
 #endif
-         &      en   (jpi,jpj,jpk) , htau (jpi,jpj)     , dissl(jpi,jpj,jpk) , STAT= zdf_tke_alloc )
+         &      en    (jpi,jpj,jpk) , htau  (jpi,jpj)    , dissl(jpi,jpj,jpk) ,     & 
+         &      avt_k (jpi,jpj,jpk) , avm_k (jpi,jpj,jpk),                          &
+         &      avmu_k(jpi,jpj,jpk) , avmv_k(jpi,jpj,jpk), STAT= zdf_tke_alloc      )
          !
       IF( lk_mpp             )   CALL mpp_sum ( zdf_tke_alloc )
@@ -168,7 +172,19 @@
       !!----------------------------------------------------------------------
       !
+      IF( kt /= nit000 ) THEN   ! restore before value to compute tke
+         avt (:,:,:) = avt_k (:,:,:) 
+         avm (:,:,:) = avm_k (:,:,:) 
+         avmu(:,:,:) = avmu_k(:,:,:) 
+         avmv(:,:,:) = avmv_k(:,:,:) 
+      ENDIF 
+      !
       CALL tke_tke      ! now tke (en)
       !
       CALL tke_avn      ! now avt, avm, avmu, avmv
+      !
+      avt_k (:,:,:) = avt (:,:,:) 
+      avm_k (:,:,:) = avm (:,:,:) 
+      avmu_k(:,:,:) = avmu(:,:,:) 
+      avmv_k(:,:,:) = avmv(:,:,:) 
       !
    END SUBROUTINE zdf_tke
@@ -811,10 +827,10 @@
         !                                   ! -------------------
         IF(lwp) WRITE(numout,*) '---- tke-rst ----'
-        CALL iom_rstput( kt, nitrst, numrow, 'en'   , en    )
-        CALL iom_rstput( kt, nitrst, numrow, 'avt'  , avt   )
-        CALL iom_rstput( kt, nitrst, numrow, 'avm'  , avm   )
-        CALL iom_rstput( kt, nitrst, numrow, 'avmu' , avmu  )
-        CALL iom_rstput( kt, nitrst, numrow, 'avmv' , avmv  )
-        CALL iom_rstput( kt, nitrst, numrow, 'dissl', dissl )
+        CALL iom_rstput( kt, nitrst, numrow, 'en'   , en     )
+        CALL iom_rstput( kt, nitrst, numrow, 'avt'  , avt_k  )
+        CALL iom_rstput( kt, nitrst, numrow, 'avm'  , avm_k  )
+        CALL iom_rstput( kt, nitrst, numrow, 'avmu' , avmu_k )
+        CALL iom_rstput( kt, nitrst, numrow, 'avmv' , avmv_k )
+        CALL iom_rstput( kt, nitrst, numrow, 'dissl', dissl  )
         !
      ENDIF
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/lib_fortran.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/lib_fortran.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/lib_fortran.F90	(revision 3570)
@@ -14,13 +14,14 @@
    !!                 of intrinsinc sign function
    !!----------------------------------------------------------------------
-   USE par_oce          ! Ocean parameter
-   USE lib_mpp          ! distributed memory computing
-   USE dom_oce          ! ocean domain
-   USE in_out_manager   ! I/O manager
+   USE par_oce         ! Ocean parameter
+   USE dom_oce         ! ocean domain
+   USE in_out_manager  ! I/O manager
+   USE lib_mpp         ! distributed memory computing
 
    IMPLICIT NONE
    PRIVATE
 
-   PUBLIC glob_sum
+   PUBLIC   glob_sum   ! used in many places
+   PUBLIC   DDPDD      ! also used in closea module
 #if defined key_nosignedzero
    PUBLIC SIGN
@@ -47,4 +48,5 @@
 
 #if ! defined key_mpp_rep
+
    FUNCTION glob_sum_2d( ptab ) 
       !!-----------------------------------------------------------------------
@@ -246,4 +248,5 @@
    END FUNCTION glob_sum_3d_a   
 
+#endif
 
    SUBROUTINE DDPDD( ydda, yddb )
@@ -280,5 +283,4 @@
       !
    END SUBROUTINE DDPDD
-#endif
 
 #if defined key_nosignedzero
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 3570)
@@ -413,4 +413,5 @@
          WRITE(numout,*) '      number of proc. following j     nn_jsplt   = ', nn_jsplt
          WRITE(numout,*) '      benchmark parameter (0/1)       nn_bench   = ', nn_bench
+         WRITE(numout,*) '      timing activated    (0/1)       nn_timing  = ', nn_timing
       ENDIF
       !
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/timing.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/timing.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/OPA_SRC/timing.F90	(revision 3570)
@@ -76,5 +76,4 @@
    LOGICAL :: ln_onefile = .TRUE. 
    LOGICAL :: lwriter
-
    !!----------------------------------------------------------------------
    !! NEMO/OPA 4.0 , NEMO Consortium (2011)
@@ -322,6 +321,6 @@
       IF( lwriter ) WRITE(numtime,*) 'Total timing (sum) :'
       IF( lwriter ) WRITE(numtime,*) '--------------------'
-      IF( lwriter ) WRITE(numtime,*) 'Elapsed Time (s)  ','CPU Time (s)'
-      IF( lwriter ) WRITE(numtime,'(5x,f12.3,2x,f12.3)')  tot_etime, tot_ctime
+      IF( lwriter ) WRITE(numtime,"('Elapsed Time (s)  CPU Time (s)')")
+      IF( lwriter ) WRITE(numtime,'(5x,f12.3,1x,f12.3)')  tot_etime, tot_ctime
       IF( lwriter ) WRITE(numtime,*) 
 #if defined key_mpp_mpi
@@ -406,13 +405,23 @@
       TYPE(timer), POINTER :: sl_timer_ave      => NULL()
       INTEGER :: icode
+      INTEGER :: ierr
       LOGICAL :: ll_ord           
       CHARACTER(len=200) :: clfmt              
                  
       ! Initialised the global strucutre   
-      ALLOCATE(sl_timer_glob_root)
-      ALLOCATE(sl_timer_glob_root%cname     (jpnij))
-      ALLOCATE(sl_timer_glob_root%tsum_cpu  (jpnij))
-      ALLOCATE(sl_timer_glob_root%tsum_clock(jpnij))
-      ALLOCATE(sl_timer_glob_root%niter     (jpnij))
+      ALLOCATE(sl_timer_glob_root, Stat=ierr)
+      IF(ierr /= 0)THEN
+         WRITE(numtime,*) 'Failed to allocate global timing structure in waver_info'
+         RETURN
+      END IF
+
+      ALLOCATE(sl_timer_glob_root%cname     (jpnij), &
+               sl_timer_glob_root%tsum_cpu  (jpnij), &
+               sl_timer_glob_root%tsum_clock(jpnij), &
+               sl_timer_glob_root%niter     (jpnij), Stat=ierr)
+      IF(ierr /= 0)THEN
+         WRITE(numtime,*) 'Failed to allocate global timing structure in waver_info'
+         RETURN
+      END IF
       sl_timer_glob_root%cname(:)       = ''
       sl_timer_glob_root%tsum_cpu(:)   = 0._wp
@@ -421,9 +430,11 @@
       sl_timer_glob_root%next => NULL()
       sl_timer_glob_root%prev => NULL()
-      ALLOCATE(sl_timer_glob)
-      ALLOCATE(sl_timer_glob%cname     (jpnij))
-      ALLOCATE(sl_timer_glob%tsum_cpu  (jpnij))
-      ALLOCATE(sl_timer_glob%tsum_clock(jpnij))
-      ALLOCATE(sl_timer_glob%niter     (jpnij))
+      !ARPDBG - don't need to allocate a pointer that's immediately then
+      !         set to point to some other object.
+      !ALLOCATE(sl_timer_glob)
+      !ALLOCATE(sl_timer_glob%cname     (jpnij))
+      !ALLOCATE(sl_timer_glob%tsum_cpu  (jpnij))
+      !ALLOCATE(sl_timer_glob%tsum_clock(jpnij))
+      !ALLOCATE(sl_timer_glob%niter     (jpnij))
       sl_timer_glob => sl_timer_glob_root
       !
@@ -451,5 +462,5 @@
          sl_timer_ave => sl_timer_ave_root            
       ENDIF 
-      
+
       ! Gather info from all processors
       s_timer => s_timer_root
@@ -467,4 +478,5 @@
                          sl_timer_glob%niter, 1, MPI_INTEGER,   &
                          0, MPI_COMM_OPA, icode)
+
          IF( narea == 1 .AND. ASSOCIATED(s_timer%next) ) THEN
             ALLOCATE(sl_timer_glob%next)
@@ -479,4 +491,6 @@
          s_timer => s_timer%next
       END DO      
+
+         WRITE(*,*) 'ARPDBG: timing: done gathers'
       
       IF( narea == 1 ) THEN    
@@ -500,7 +514,9 @@
             ENDIF
             sl_timer_glob => sl_timer_glob%next                                
-         END DO         
+         END DO
+
+         WRITE(*,*) 'ARPDBG: timing: done computing stats'
       
-         ! reorder the avearged list by CPU time      
+         ! reorder the averaged list by CPU time      
          s_wrk => NULL()
          sl_timer_ave => sl_timer_ave_root
@@ -509,30 +525,34 @@
             sl_timer_ave => sl_timer_ave_root
             DO WHILE( ASSOCIATED( sl_timer_ave%next ) )
-            IF( .NOT. ASSOCIATED(sl_timer_ave%next) ) EXIT
+
+               IF( .NOT. ASSOCIATED(sl_timer_ave%next) ) EXIT
+
                IF ( sl_timer_ave%tsum_clock < sl_timer_ave%next%tsum_clock ) THEN 
                   ALLOCATE(s_wrk)
+                  ! Copy data into the new object pointed to by s_wrk
                   s_wrk = sl_timer_ave%next
+                  ! Insert this new timer object before our current position
                   CALL insert  (sl_timer_ave, sl_timer_ave_root, s_wrk)
+                  ! Remove the old object from the list
                   CALL suppress(sl_timer_ave%next)            
                   ll_ord = .FALSE.
                   CYCLE            
                ENDIF           
-            IF( ASSOCIATED(sl_timer_ave%next) ) sl_timer_ave => sl_timer_ave%next
+               IF( ASSOCIATED(sl_timer_ave%next) ) sl_timer_ave => sl_timer_ave%next
             END DO         
-           IF( ll_ord ) EXIT
+            IF( ll_ord ) EXIT
          END DO
 
          ! write averaged info
-         WRITE(numtime,*) 'Averaged timing on all processors :'
-         WRITE(numtime,*) '-----------------------------------'
-         WRITE(numtime,*) 'Section             ',                &
-         &   'Elapsed Time (s)  ','Elapsed Time (%)  ',          &
-         &   'CPU Time(s)  ','CPU Time (%)  ','CPU/Elapsed  ',   &
-         &   'Max Elapsed (%)  ','Min elapsed (%)  ',            &           
-         &   'Frequency' 
+         WRITE(numtime,"('Averaged timing on all processors :')")
+         WRITE(numtime,"('-----------------------------------')")
+         WRITE(numtime,"('Section',13x,'Elap. Time(s)',2x,'Elap. Time(%)',2x, &
+         &   'CPU Time(s)',2x,'CPU Time(%)',2x,'CPU/Elap',1x,   &
+         &   'Max elap(%)',2x,'Min elap(%)',2x,            &           
+         &   'Freq')")
          sl_timer_ave => sl_timer_ave_root  
-         clfmt = '(1x,a,4x,f12.3,6x,f12.3,x,f12.3,2x,f12.3,6x,f7.3,5x,f12.3,5x,f12.3,2x,f9.2)'
+         clfmt = '((A),E15.7,2x,f6.2,5x,f12.2,5x,f6.2,5x,f7.2,2x,f12.2,4x,f6.2,2x,f9.2)'
          DO WHILE ( ASSOCIATED(sl_timer_ave) )
-            WRITE(numtime,TRIM(clfmt))   sl_timer_ave%cname,                            &
+            WRITE(numtime,TRIM(clfmt))   sl_timer_ave%cname(1:18),                            &
             &   sl_timer_ave%tsum_clock,sl_timer_ave%tsum_clock*100.*jpnij/tot_etime,   &
             &   sl_timer_ave%tsum_cpu  ,sl_timer_ave%tsum_cpu*100.*jpnij/tot_ctime  ,   &
@@ -712,9 +732,9 @@
       !!----------------------------------------------------------------------
       l_initdone = .TRUE. 
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'timing_reset : instrumented routines for timing'
-      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~'
-      CALL timing_list(s_timer_root)
-      WRITE(numout,*)
+!      IF(lwp) WRITE(numout,*)
+!      IF(lwp) WRITE(numout,*) 'timing_reset : instrumented routines for timing'
+!      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~'
+!      CALL timing_list(s_timer_root)
+!      WRITE(numout,*)
       !
    END SUBROUTINE timing_reset
@@ -734,5 +754,5 @@
       !!----------------------------------------------------------------------
       !!               ***  ROUTINE insert  ***
-      !! ** Purpose :   insert an element in  imer structure
+      !! ** Purpose :   insert an element in timer structure
       !!----------------------------------------------------------------------
       TYPE(timer), POINTER, INTENT(inout) :: sd_current, sd_root, sd_ptr
@@ -740,4 +760,6 @@
      
       IF( ASSOCIATED( sd_current, sd_root ) ) THEN
+         ! If our current element is the root element then
+         ! replace it with the one being inserted
          sd_root => sd_ptr
       ELSE
@@ -747,4 +769,8 @@
       sd_ptr%prev     => sd_current%prev
       sd_current%prev => sd_ptr
+      ! Nullify the pointer to the new element now that it is held
+      ! within the list. If we don't do this then a subsequent call
+      ! to ALLOCATE memory to this pointer will fail.
+      sd_ptr => NULL()
       !    
    END SUBROUTINE insert
@@ -764,4 +790,5 @@
       IF ( ASSOCIATED(sl_temp%next) ) sl_temp%next%prev => sl_temp%prev
       DEALLOCATE(sl_temp)
+      sl_temp => NULL()
       !
     END SUBROUTINE suppress
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsink.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsink.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsink.F90	(revision 3570)
@@ -295,5 +295,5 @@
       ENDIF
       !
-      CALL wrk_alloc( jpi, jpj, jpk, znum3d )
+      CALL wrk_dealloc( jpi, jpj, jpk, znum3d )
       !
       IF( nn_timing == 1 )  CALL timing_stop('p4z_sink')
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90	(revision 3570)
@@ -101,5 +101,5 @@
       END SELECT
 
-      IF( l_trdtra )   THEN                      ! save the vertical diffusive trends for further diagnostics
+      IF( l_trdtrc )   THEN                      ! save the vertical diffusive trends for further diagnostics
          DO jn = 1, jptra
             DO jk = 1, jpkm1
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/TOP_SRC/TRP/trdmod_trc.F90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/TOP_SRC/TRP/trdmod_trc.F90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/NEMO/TOP_SRC/TRP/trdmod_trc.F90	(revision 3570)
@@ -59,4 +59,5 @@
       ! Mixed layer trends for passive tracers
       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+#if defined key_trdmld_trc  
       IF( lk_trdmld_trc .AND. ln_trdtrc( kjn ) ) THEN
          !
@@ -82,17 +83,23 @@
          !
       END IF
+#endif
 
       IF( lk_trdtrc .AND. ln_trdtrc( kjn ) ) THEN
          !
          SELECT CASE( ktrd )
-         CASE( jptra_trd_xad )       ;    WRITE (cltra,'("XAD_",16a)')   ctrcnm(kjn)
-         CASE( jptra_trd_yad )       ;    WRITE (cltra,'("YAD_",16a)')   ctrcnm(kjn)
-         CASE( jptra_trd_zad )       ;    WRITE (cltra,'("ZAD_",16a)')   ctrcnm(kjn)
-         CASE( jptra_trd_ldf )       ;    WRITE (cltra,'("LDF_",16a)')   ctrcnm(kjn)
-         CASE( jptra_trd_bbl )       ;    WRITE (cltra,'("BBL_",16a)')   ctrcnm(kjn)
-         CASE( jptra_trd_zdf )       ;    WRITE (cltra,'("ZDF_",16a)')   ctrcnm(kjn)
-         CASE( jptra_trd_dmp )       ;    WRITE (cltra,'("DMP_",16a)')   ctrcnm(kjn)
-         CASE( jptra_trd_nsr )       ;    WRITE (cltra,'("FOR_",16a)')   ctrcnm(kjn)
+         CASE( jptra_trd_xad  )       ;    WRITE (cltra,'("XAD_",4a)')
+         CASE( jptra_trd_yad  )       ;    WRITE (cltra,'("YAD_",4a)')
+         CASE( jptra_trd_zad  )       ;    WRITE (cltra,'("ZAD_",4a)')
+         CASE( jptra_trd_ldf  )       ;    WRITE (cltra,'("LDF_",4a)')
+         CASE( jptra_trd_bbl  )       ;    WRITE (cltra,'("BBL_",4a)')
+         CASE( jptra_trd_nsr  )       ;    WRITE (cltra,'("FOR_",4a)')
+         CASE( jptra_trd_zdf  )       ;    WRITE (cltra,'("ZDF_",4a)')
+         CASE( jptra_trd_dmp  )       ;    WRITE (cltra,'("DMP_",4a)')
+         CASE( jptra_trd_sms  )       ;    WRITE (cltra,'("SMS_",4a)')
+         CASE( jptra_trd_atf  )       ;    WRITE (cltra,'("ATF_",4a)')
+         CASE( jptra_trd_radb )       ;    WRITE (cltra,'("RDB_",4a)')
+         CASE( jptra_trd_radn )       ;    WRITE (cltra,'("RDN_",4a)')
          END SELECT
+                                          cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
                                           CALL iom_put( cltra,  ptrtrd(:,:,:) )
          !
@@ -111,5 +118,7 @@
       !!----------------------------------------------------------------------
 
+#if defined key_trdmld_trc  
       CALL trd_mld_bio_zint( ptrbio, ktrd ) ! Verticaly integrated biological trends
+#endif
 
    END SUBROUTINE trd_mod_trc_bio
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-PW6_VARGAS
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-PW6_VARGAS	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-PW6_VARGAS	(revision 3570)
@@ -11,5 +11,5 @@
 # @ total_tasks = NPROCS
 # time
-# @ wall_clock_limit = 0:30:00
+# @ wall_clock_limit = 1:30:00
 # @ queue
 
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-X64_TITANE
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-X64_TITANE	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-X64_TITANE	(revision 3570)
@@ -54,9 +54,9 @@
 #  Run the parallel MPI executable 
 #
+  if [ MPI_FLAG == "yes" ]; then
   echo "Running time ${MPIRUN} ./opa"
-#
-  if [ MPI_FLAG == "yes" ]; then
      time ${MPIRUN} ./opa
   else
+  echo "Running time ./opa"
      time ./opa
   fi
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-ifort_MERCATOR_CLUSTER
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-ifort_MERCATOR_CLUSTER	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-ifort_MERCATOR_CLUSTER	(revision 3570)
@@ -57,10 +57,10 @@
 #  Run the parallel MPI executable 
 #
+  if [ MPI_FLAG == "yes" ]; then
   echo "Running time ${MPIRUN} ./opa"
-#
-  if [ MPI_FLAG == "yes" ]; then
      time ${MPIRUN} ./opa
 #cbr     mpirun -np $OCEANCORES ./opa
   else
+  echo "Running time ./opa"
      time ./opa
   fi
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/BATCH_TEMPLATE/sette_batch_template
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/BATCH_TEMPLATE/sette_batch_template	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/BATCH_TEMPLATE/sette_batch_template	(revision 3570)
@@ -64,10 +64,9 @@
 #  Run the parallel MPI executable 
 #
+  if [ MPI_FLAG == "yes" ]; then
   echo "Running time ${MPIRUN} ./opa"
-#
-
-  if [ MPI_FLAG == "yes" ]; then
      time ${MPIRUN} ./opa
   else
+  echo "Running time./opa"
      time ./opa
   fi
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/README
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/README	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/README	(revision 3570)
@@ -11,8 +11,10 @@
                COMPILER    : compiler among those available in NEMOGCM/ARCH, needed for makenemo (see below)
                              can also be pass as an argument, e.g. ./sette.sh ifort_osx
-	       BATCH_COMMAND : command for job submission in batch mode
-	       MPI_INTERACT : "yes" if you want to run in interactive mode for MPI run
-	       		      "no" if you want to run in batch mode for MPI run
-			      NOTE : every job using only 1 proc is run in interactive mode
+	       BATCH_COMMAND_PAR : command for job submission in batch mode parallel (MMIÂ)
+	       BATCH_COMMAND_SEQ : command for job submission in batch mode sequential (NB_PROC = 1)
+	       INTERACT_FLAG : "yes" if you want to run in interactive mode 
+	       		       "no" if you want to run in batch mode
+	       MPIRUN_FLAG   : "yes" if you want to run in parallel (MPI)
+			       "no" if you want to run in sequential mode (NB_PROC = 1)
 
                makenemo -m : machine (compilator); see ./makenemo -m help (in NEMOGCM/CONFIG directory)
@@ -32,7 +34,10 @@
 				    IT is mandatory to have different TEST_NAME for each job run if not existing files are re-written (for example namelist)
 
-               fcm_job.sh needs input: input_CONFIG_NAME TOTAL_NUMBER_OF_PROCS_used TEST_NAME
-			(for example if you compile ORCA2_LIM with key_mpp_mpi 
-			and only run short test ===> ./fcm_job input_ORCA2_LIM.cfg 4 SHORT)
+               prepare_job.sh generates the script to be executed 
+			input: INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME MPIRUN_FLAG JOB_FILE
+
+               fcm_job.sh needs input: TOTAL_NUMBER_OF_PROCS_used JOB_FILE_NAME INTERACT_FLAG MPIRUN_FLAG 
+			(for example if you run with 4 procs JOB_FILE batch parallel 
+			and only run short test ===> ./fcm_job 4 SHORT no    yes   )
 
  in param.cfg :
@@ -46,6 +51,6 @@
                is the same of that in input_REF_CONFIG.cfg, if not change one.
 
-               change in "RUN OPA" if [ ${MPI_INTERACT} == "yes" ] mpirun command line (some examples are already written)
-	       NOTE: if MPI_INTERACT="no" it is neede a batch_file (see below to create a new one)
+               change in "RUN OPA" if [ ${INTERACT_FLAG} == "yes" ] mpirun command line (some examples are already written)
+	       NOTE: if INTERACT_FLAG="no" it is needed a batch_file (see below to create a new one)
 
 NOTE:
@@ -74,3 +79,3 @@
 1. see in SETTE/BATCH_TEMPLATE directory existing examples
 2. create you own batch file like: batch-${COMPILER}
-(note: sette.sh will copy it in job_batch_template if you run tests in MPI_INTERACT="no")
+(note: sette.sh will copy it in job_batch_template if you run tests in INTERACT_FLAG="no")
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/fcm_job.sh
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/fcm_job.sh	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/fcm_job.sh	(revision 3570)
@@ -6,5 +6,5 @@
 # fcm_job.sh   : simple job to run NEMO with fcm 
 ######################################################
-#set -x
+#set -vx
 set -o posix
 #set -u
@@ -23,7 +23,7 @@
 # ========
 #
-# ::
+# :: lauches the script $JOB_FILE interactive or batch, one task or MPI
 #
-#  $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME MPI_INTERACT MPI_FLAG
+#  $ ./fcm_job.sh NUMBER_OF_PROCS JOB_FILE INTERACT_FLAG MPIRUN_FLAG
 #
 #
@@ -33,12 +33,5 @@
 # Simple job for SET TESTS for NEMO (SETTE)
 # 
-#   get input files (if needed) : tar file  
-#  (note this job needs to have an input_CONFIG.cfg in which can be found input tar file name)
-#
-#   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
-#
-#   and call post_test_tidyup function (that moves in NEMO_VALIDATION_DIR solver.stat, tracer.stat (for LOBSTER & PISCES) & ocean.output)
+#  
 #
 # EXAMPLES
@@ -47,11 +40,10 @@
 # ::
 #
-#  $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME MPI_INTERACT MPI_FLAG
+#  $ ./fcm_job.sh NUMBER_OF_PROCS JOB_FILE INTERACT_FLAG MPIRUN_FLAG
 #
-#  run a job of config GYRE with 1 processor SHORT test ( 5 days ) using an interactive run without mpirun
-#  $ ./fcm_job.sh input_GYRE.cfg 1 SHORT yes no
+#  run a job with 1 processor SHORT test ( 5 days ) 
+#  using an interactive run without mpirun 
 #
-#  run a job of config ORCA2_LIM_PISCES	with 8 processors test RESTARTABILITY submitting the job to the batch queue system and using mpirun
-#  $ ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8 LONG no yes
+#  ./fcm_job.sh        1           SHORT        yes          no 
 #
 #
@@ -65,5 +57,5 @@
 # ==========
 #
-# $Id$
+# $Id: $
 #
 #
@@ -74,12 +66,12 @@
 #
 
-usage=" Usage : ./fcm_job.sh input_CONFIG_NAME.cfg  NUMBER_OF_PROCS TEST_NAME INTERACT MPI_FLAG"
-usage=" example : ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8 SHORT no/yes no/yes"
+usage=" Usage : ./fcm_job.sh  NUMBER_OF_PROCS JOB_FILE INTERACT_FLAG MPIRUN_FLAG"
+usage=" example : ./fcm_job.sh       8          SHORT      no/yes       no/yes"
 
 
-minargcount=2
+minargcount=4
         if [ ${#} -lt ${minargcount} ]
         then
-                echo "not enought arguments for fcm_job.sh script"
+                echo "not enough arguments for fcm_job.sh script"
                 echo "control number of argument of fcm_job.sh in sette.sh"
                 echo "${usage}"
@@ -94,13 +86,18 @@
 export NB_PROCS=$1
 export JOB_FILE=$2
+export INTERACT_FLAG=$3
+export MPIRUN_FLAG=$4
 ################################################################
 # RUN OPA
 cd ${EXE_DIR}
-
-# submit job to batch system 
-        if [ ${NB_PROC} -eq 1 ]; then
-	   eval ${BATCH_COMMAND_SEQ} $JOB_FILE 
+if [ "${INTERACT_FLAG}" == "yes" ]; then
+	eval ${JOB_FILE}
+else if [ "${INTERACT_FLAG}" == "no" ]; then
+	# submit job to batch system 
+        if [ "${NB_PROC}" == "1" ]; then
+		eval ${BATCH_COMMAND_SEQ} ${JOB_FILE} ; echo  ${BATCH_COMMAND_SEQ} ${JOB_FILE}
         else
-	   eval ${BATCH_COMMAND_PAR} $JOB_FILE
+		eval ${BATCH_COMMAND_PAR} ${JOB_FILE} ; echo ${BATCH_COMMAND_PAR} ${JOB_FILE}
         fi
-
+fi
+fi
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/input_ORCA2_LIM.cfg
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/input_ORCA2_LIM.cfg	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/input_ORCA2_LIM.cfg	(revision 3570)
@@ -1,1 +1,1 @@
-ORCA2_LIM_nemo_v3.3.tar
+ORCA2_LIM_nemo_v3.4.tar
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/input_ORCA2_LIM_AGRIF.cfg
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/input_ORCA2_LIM_AGRIF.cfg	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/input_ORCA2_LIM_AGRIF.cfg	(revision 3570)
@@ -1,1 +1,1 @@
-ORCA2_LIM_AGRIF_nemo_v3.3.tar
+ORCA2_LIM_nemo_v3.4.tar
Index: anches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/input_POMME.cfg
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/input_POMME.cfg	(revision 3569)
+++ 	(revision )
@@ -1,1 +1,0 @@
-POMME_nemo_v3_3.tar
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/iodef_sette.xml
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/iodef_sette.xml	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/iodef_sette.xml	(revision 3570)
@@ -209,35 +209,28 @@
 
      <group id="ptrc_T" axis_ref="deptht" grid_ref="grid_T">  
-       <field id="DIC"      description="Dissolved inorganic Concentration"        unit="molC/L"     />
-       <field id="Alkalini" description="Total Alkalinity Concentration"           unit="eq/L"       />
-       <field id="O2"       description="Oxygen Concentration"                     unit="molO2/L"    />
-       <field id="CaCO3"    description="Calcite Concentration"                    unit="molC/L"     />
-       <field id="PO4"      description="Phosphate Concentration"                  unit="molC/L"     />
-       <field id="POC"      description="Small organic carbon Concentration"       unit="molC/L"     />
-       <field id="Si"       description="Silicate Concentration"                   unit="molSi/L"    />
-       <field id="PHY"      description="Nanophytoplankton Concentration"          unit="molC/L"     />
-       <field id="ZOO"      description="Microzooplankton Concentration"           unit="molC/L"     />
-       <field id="DOC"      description="Dissolved organic Concentration"          unit="molC/L"     />
-       <field id="PHY2"     description="Diatoms Concentration"                    unit="molC/L"     />
-       <field id="ZOO2"     description="Mesozooplankton Concentration"            unit="molC/L"     />
-       <field id="BSi"      description="Diatoms Silicate Concentration"           unit="molC/L"     />
-       <field id="Fer"      description="Dissolved Iron Concentration"             unit="molFe/L"    />
-       <field id="BFe"      description="Big iron particles Concentration"         unit="molFe/L"    />
-       <field id="GOC"      description="Big organic carbon Concentration"         unit="molC/L"     />
-       <field id="SFe"      description="Small iron particles Concentration"       unit="molFe/L"    />
-       <field id="DFe"      description="Diatoms iron  Concentration"              unit="molFe/L"    />
-       <field id="DSi"      description="Sinking biogenic Silicate Concentration"  unit="molC/L"     />
-       <field id="NFe"      description="Nano iron Concentration"                  unit="molC/L"     />
-       <field id="NCHL"     description="Nano chlorophyl Concentration"            unit="gChl/L"     />
-       <field id="DCHL"     description="Diatoms chlorophyl Concentration"         unit="gChl/L"     />
-       <field id="NO3"      description="Nitrates Concentration"                   unit="molC/L"     />
-       <field id="NH4"      description="Ammonium Concentration"                   unit="molC/L"     />
-       <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" />
-
+       <field id="DIC"      description="Dissolved inorganic 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" />
+       <field id="PO4"      description="Phosphate Concentration"                  unit="mmol/m3" />
+       <field id="POC"      description="Small organic carbon Concentration"       unit="mmol/m3" />
+       <field id="Si"       description="Silicate Concentration"                   unit="mmol/m3" />
+       <field id="PHY"      description="Nanophytoplankton Concentration"          unit="mmol/m3" />
+       <field id="ZOO"      description="Microzooplankton Concentration"           unit="mmol/m3" />
+       <field id="DOC"      description="Dissolved organic Concentration"          unit="mmol/m3" />
+       <field id="PHY2"     description="Diatoms Concentration"                    unit="mmol/m3" />
+       <field id="ZOO2"     description="Mesozooplankton Concentration"            unit="mmol/m3" />
+       <field id="DSi"      description="Diatoms Silicate Concentration"           unit="mmol/m3" />
+       <field id="Fer"      description="Dissolved Iron Concentration"             unit="mmol/m3" />
+       <field id="BFe"      description="Big iron particles Concentration"         unit="mmol/m3" />
+       <field id="GOC"      description="Big organic carbon Concentration"         unit="mmol/m3" />
+       <field id="SFe"      description="Small iron particles Concentration"       unit="mmol/m3" />
+       <field id="DFe"      description="Diatoms iron  Concentration"              unit="mmol/m3" />
+       <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="NO3"      description="Nitrates Concentration"                   unit="mmol/m3" />
+       <field id="NH4"      description="Ammonium Concentration"                   unit="mmol/m3" />
      </group>
 
@@ -245,52 +238,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/L"       axis_ref="deptht" />
-       <field id="CO3sat"      description="CO3 saturation"                           unit="mol/L"       axis_ref="deptht" />
-       <field id="PAR"         description="Photosynthetically Available Radiation"   unit="W/m2"        axis_ref="deptht" />
+       <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="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="GRAZ"        description="Grazing by zooplankton"                   unit="molC/m3/s"   axis_ref="deptht" />
-       <field id="Nfix"        description="Nitrogen fixation at surface"             unit="molN/m2/s"       />
-       <field id="EPC100"      description="Export of carbon particles at 100 m"      unit="molC/m2/s"       />
-       <field id="EPFE100"     description="Export of biogenic iron at 100 m"         unit="molFe/m2/s"      />
-       <field id="EPSI100"     description="Export of Silicate at 100 m"              unit="molSi/m2/s"      />
-       <field id="EPCAL100"    description="Export of Calcite at 100 m"               unit="molC/m2/s"       />
-       <field id="Cflx"        description="DIC flux"                                 unit="molC/m2/s"       />
-       <field id="Oflx"        description="Oxygen flux"                              unit="molC/m2/s"       />
-       <field id="Kg"          description="Gas transfer"                             unit="molC/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="molFe/m2/s"      />
-       <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="-"  /> 
+       <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>
        
@@ -549,3 +547,549 @@
   </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>
+         
+      <!-- ptrc on T grid -->
+
+     <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="O2"       description="Oxygen Concentration"                     unit="mmol/m3" />
+       <field id="CaCO3"    description="Calcite Concentration"                    unit="mmol/m3" />
+       <field id="PO4"      description="Phosphate Concentration"                  unit="mmol/m3" />
+       <field id="POC"      description="Small organic carbon Concentration"       unit="mmol/m3" />
+       <field id="Si"       description="Silicate Concentration"                   unit="mmol/m3" />
+       <field id="PHY"      description="Nanophytoplankton Concentration"          unit="mmol/m3" />
+       <field id="ZOO"      description="Microzooplankton Concentration"           unit="mmol/m3" />
+       <field id="DOC"      description="Dissolved organic Concentration"          unit="mmol/m3" />
+       <field id="PHY2"     description="Diatoms Concentration"                    unit="mmol/m3" />
+       <field id="ZOO2"     description="Mesozooplankton Concentration"            unit="mmol/m3" />
+       <field id="DSi"      description="Diatoms Silicate Concentration"           unit="mmol/m3" />
+       <field id="Fer"      description="Dissolved Iron Concentration"             unit="mmol/m3" />
+       <field id="BFe"      description="Big iron particles Concentration"         unit="mmol/m3" />
+       <field id="GOC"      description="Big organic carbon Concentration"         unit="mmol/m3" />
+       <field id="SFe"      description="Small iron particles Concentration"       unit="mmol/m3" />
+       <field id="DFe"      description="Diatoms iron  Concentration"              unit="mmol/m3" />
+       <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="NO3"      description="Nitrates Concentration"                   unit="mmol/m3" />
+       <field id="NH4"      description="Ammonium Concentration"                   unit="mmol/m3" />
+     </group>
+
+      <!-- diad on T grid : variables available with key_diatrc -->
+
+     <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="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>
+       
+    </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 -->
+      </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 -->
+      </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" >
+    <!--   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_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/prepare_job.sh
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/prepare_job.sh	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/prepare_job.sh	(revision 3570)
@@ -1,14 +1,19 @@
 #####################################################
-# Author : Italo Epicoco for NEMO
-# Contact : italo.epicoco@unisalento.it
-#
-# Some scripts called by sette.sh 
-# prepare_job.sh   : create the job script for running job 
+# Author : Simona Flavoni for NEMO
+# Contact : sflod@locean-ipsl.upmc.fr
+#
+# ----------------------------------------------------------------------
+# NEMO/SETTE , NEMO Consortium (2010)
+# Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+# ----------------------------------------------------------------------
+#
+# Some scripts called by sette.sh
+# prepare_job.sh   : creates the job script for running job 
 ######################################################
-#set -x
+#set -vx
 set -o posix
 #set -u
 #set -e
-#
+#+
 #
 # ================
@@ -16,7 +21,7 @@
 # ================
 #
-# --------------------------
-# create the job script for NEMO tests 
-# --------------------------
+# -------------------------------------------------
+# script that creates the job script for NEMO tests 
+# -------------------------------------------------
 #
 # SYNOPSIS
@@ -25,5 +30,5 @@
 # ::
 #
-#  $ ./prepare_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME MPI_INTERACT MPI_FLAG
+#  $ ./prepare_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME MPI_FLAG JOB_FILE
 #
 #
@@ -31,14 +36,7 @@
 # ===========
 #
-# Simple job for SET TESTS for NEMO (SETTE)
+# Part of the SETTE package to run tests for NEMO
 # 
-#   get input files (if needed) : tar file  
-#  (note this job needs to have an input_CONFIG.cfg in which can be found input tar file name)
-#
-#   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
-#
-#   and call post_test_tidyup function (that moves in NEMO_VALIDATION_DIR solver.stat, tracer.stat (for LOBSTER & PISCES) & ocean.output)
+# prepare the script $JOB_FILE to run the tests 
 #
 # EXAMPLES
@@ -47,11 +45,7 @@
 # ::
 #
-#  $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME MPI_INTERACT MPI_FLAG
-#
-#  run a job of config GYRE with 1 processor SHORT test ( 5 days ) using an interactive run without mpirun
-#  $ ./fcm_job.sh input_GYRE.cfg 1 SHORT yes no
-#
-#  run a job of config ORCA2_LIM_PISCES	with 8 processors test RESTARTABILITY submitting the job to the batch queue system and using mpirun
-#  $ ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8 LONG no yes
+#  $ ./prepare_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME MPI_FLAG $JOB_FILE
+#
+# prepare the $JOB_FILE for execution 
 #
 #
@@ -65,5 +59,5 @@
 # ==========
 #
-# $Id: fcm_job.sh 3050 2011-11-07 14:11:34Z acc $
+# $Id: prepare_job.sh 3050 2011-11-07 14:11:34Z acc $
 #
 #
@@ -74,6 +68,6 @@
 #
 
-usage=" Usage : ./fcm_job.sh input_CONFIG_NAME.cfg  NUMBER_OF_PROCS TEST_NAME INTERACT MPI_FLAG"
-usage=" example : ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8 SHORT no/yes no/yes"
+usage=" Usage : ./prepare_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME MPI_FLAG JOB_FILE"
+usage=" example : ./prepare_job.sh input_ORCA2_LIM_PISCES.cfg 8 SHORT no/yes $JOB_FILE"
 
 
@@ -81,6 +75,6 @@
         if [ ${#} -lt ${minargcount} ]
         then
-                echo "not enought arguments for fcm_job.sh script"
-                echo "control number of argument of fcm_job.sh in sette.sh"
+                echo "not enough arguments for prepare_job.sh script"
+                echo "control number of argument of prepare_job.sh in sette.sh"
                 echo "${usage}"
         exit 1
@@ -165,31 +159,8 @@
     exit 1
 fi
-#if [ ${NB_PROC} == 1 ] ; then
-#    echo "running opa" >> ${SETTE_DIR}/output.sette
-#    echo "            " >> ${SETTE_DIR}/output.sette
-#    ./opa
-#
-# Tidy out output from this test and populate the NEMO_VALIDATION_DIR tree
-#
-#    post_test_tidyup
-#else
-#    echo "running opa in MPI" >> ${SETTE_DIR}/output.sette
-#    echo "            " >> ${SETTE_DIR}/output.sette
-
-#    if [ ${MPI_INTERACT} == "yes" ] ; then
-#	#
-#	# example for brodie (NEC SX8) machine
-#	#	mpirun -np ${NB_PROC} opa
-#	# example for dedale machine
-#	#	mpirun --mca btl self,tcp -np ${NB_PROC} opa
-#	# example for vargas (IBM Power6) machine
-#	mpiexec -n ${NB_PROC} opa
-#	#
-#	post_test_tidyup
-#    fi
-#
+
 # example for NOCS Altix system using PBS batch submission (requires ${SETTE_DIR}/sette_batch_template file)
 #
-  #  if [ ${MPI_INTERACT} == "no" ] ; then
+  #  if [ ${MPI_FLAG} == "no" ] ; then
 		case ${COMPILER} in 
 			ALTIX_NAUTILUS_MPT)
@@ -198,5 +169,5 @@
 					# number of processes required is an integer multiple of 4
 					#
-					NB_NODES=$( echo $NB_PROC | awk '{print $1  $1 / 4}')
+					NB_NODES=$( echo $NB_PROC | awk '{print $1 / 4}')
 				else
 					#
@@ -238,9 +209,5 @@
 # Pass settings into job file by using sed to edit predefined strings
 #
-         ((mem=5*NB_PROC))
-         echo NB_NODES NB_PROC QUEUE ${NB_NODES} ${NB_PROC} ${QUEUE}
-        cat ${SETTE_DIR}/job_batch_template | sed -e"s/NODES/${NB_NODES}/" -e"s/NPROCSNODE/${NB_PROC_NODE}/" \
-             -e"s/NPROCS/${NB_PROC}/" \
-             -e"s/QUEUE/${QUEUE}/" -e"s/MEM/${mem}/" \
+        cat ${SETTE_DIR}/job_batch_template | sed -e"s/NODES/${NB_NODES}/" -e"s/NPROCS/${NB_PROC}/" \
              -e"s:DEF_SETTE_DIR:${SETTE_DIR}:" -e"s:DEF_INPUT_DIR:${INPUT_DIR}:" \
              -e"s:DEF_EXE_DIR:${EXE_DIR}:" \
@@ -266,5 +233,5 @@
 	fi
 	
-	chmod a+x $JOB_FILE
+	chmod a+x $JOB_FILE ; echo "$JOB_FILE is ready"
 
 #fi
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/sette.sh
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/sette.sh	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/sette.sh	(revision 3570)
@@ -129,8 +129,9 @@
 #-
 # Compiler among those in NEMOGCM/ARCH
-COMPILER=ifort_MERCATOR_CLUSTER
-export BATCH_COMMAND_PAR="qsub "
+COMPILER=PW6_VARGAS
+export BATCH_COMMAND_PAR="llsubmit"
 export BATCH_COMMAND_SEQ=$BATCH_COMMAND_PAR
-
+export INTERACT_FLAG="no"
+export MPIRUN_FLAG="yes"
 
 # Directory to run the tests
@@ -154,13 +155,12 @@
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n GYRELOB_LONG -r GYRE_LOBSTER -j 8  
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    . prepare_exe_dir.sh
-    JOB_FILE=${EXE_DIR}/run_job.sh
-    MPIRUN_FLAG="yes"
-    NPROC=1
-    rm $JOB_FILE
+    . ../CONFIG/makenemo -m ${CMP_NAM} -n GYRELOB_LONG -r GYRE_LOBSTER add_key "key_mpp_mpi"
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    . prepare_exe_dir.sh
+    JOB_FILE=${EXE_DIR}/run_job.sh
+    NPROC=4
+    \rm ${JOB_FILE}
     cd ${EXE_DIR}
     set_namelist namelist cn_exp \"GYRELOB_LONG\"
@@ -171,6 +171,9 @@
     set_namelist namelist nn_solv 2
     set_namelist namelist_top ln_diatrc .false.
-    cd ${SETTE_DIR}
-    . ./prepare_job.sh input_GYRE.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
+    set_namelist namelist jpni 2
+    set_namelist namelist jpnj 2
+    set_namelist namelist jpnij 4
+    cd ${SETTE_DIR}
+    . ./prepare_job.sh input_GYRE.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
 
     cd ${SETTE_DIR}
@@ -186,30 +189,36 @@
     set_namelist namelist ln_clobber .true.
     set_namelist namelist nn_solv 2
-    ln -s -f ..\/LONG\/GYRELOB_LONG_00000060_restart.nc
-    ln -s -f ..\/LONG\/GYRELOB_LONG_00000060_restart_trc.nc
+    set_namelist namelist jpni 2
+    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_top cn_trcrst_in \"GYRELOB_LONG_00000060_restart_trc\"
-    cd ${SETTE_DIR}
-    . ./prepare_job.sh input_GYRE.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh $NPROC $JOB_FILE
+    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 .
+    done
+    cd ${SETTE_DIR}
+    . ./prepare_job.sh input_GYRE.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 fi
 
 if [ ${config} -eq 2 ] ;  then
-    ## Reproducibility tests for GYRE_LOBSTER
+    ## Repropducibility tests for GYRE_LOBSTER
     export TEST_NAME="REPRO_1_4"
     cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n GYRELOB_4 -r GYRE_LOBSTER -j 8 add_key "key_mpp_rep key_mpp_mpi"
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    . prepare_exe_dir.sh
-    JOB_FILE=${EXE_DIR}/run_job.sh
-    MPIRUN_FLAG="yes"
+    . ../CONFIG/makenemo -m ${CMP_NAM} -n GYRELOB_4 -r GYRE_LOBSTER add_key "key_mpp_mpi key_mpp_rep"
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    . prepare_exe_dir.sh
+    JOB_FILE=${EXE_DIR}/run_job.sh
     NPROC=4
-    rm $JOB_FILE
+    \rm ${JOB_FILE}
     cd ${EXE_DIR}
     set_namelist namelist cn_exp \"GYRELOB_14\"
@@ -227,15 +236,11 @@
     set_namelist namelist jpnij 4
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_GYRE.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh $NPROC $JOB_FILE
+    . ./prepare_job.sh input_GYRE.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 
     cd ${SETTE_DIR}
     export TEST_NAME="REPRO_2_2"
     . prepare_exe_dir.sh
-    JOB_FILE=${EXE_DIR}/run_job.sh
-    MPIRUN_FLAG="yes"
-    NPROC=4
-    rm $JOB_FILE
     cd ${EXE_DIR}
     set_namelist namelist cn_exp \"GYRELOB_22\"
@@ -252,7 +257,8 @@
     set_namelist namelist jpnij 4
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_GYRE.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh $NPROC $JOB_FILE
+    . ./prepare_job.sh input_GYRE.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
+
 fi
 
@@ -262,13 +268,12 @@
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2LIMPIS_LONG -r ORCA2_LIM_PISCES -j 8
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    . prepare_exe_dir.sh
-    JOB_FILE=${EXE_DIR}/run_job.sh
-    MPIRUN_FLAG="yes"
-    NPROC=1
-    rm $JOB_FILE
+    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2LIMPIS_LONG -r ORCA2_LIM_PISCES -j 8 add_key "key_mpp_mpi" 
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    . prepare_exe_dir.sh
+    JOB_FILE=${EXE_DIR}/run_job.sh
+    NPROC=4
+    \rm ${JOB_FILE}
     cd ${EXE_DIR}
     set_namelist namelist cn_exp \"O2LP_LONG\"
@@ -277,4 +282,7 @@
     set_namelist namelist nn_stock 75
     set_namelist namelist ln_clobber .true.
+    set_namelist namelist jpni 2
+    set_namelist namelist jpnj 2
+    set_namelist namelist jpnij 4
     set_namelist namelist nn_solv 2
     set_namelist namelist_top ln_trcdta .false.
@@ -288,5 +296,5 @@
     set_namelist namelist_pisces ln_presatm .false.
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_ORCA2_LIM_PISCES.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
+    . ./prepare_job.sh input_ORCA2_LIM_PISCES.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
     
     cd ${SETTE_DIR}
@@ -301,14 +309,14 @@
     set_namelist namelist nn_rstctl 2
     set_namelist namelist ln_clobber .true.
-    set_namelist namelist nn_solv 2
-    ln -s -f ../LONG/O2LP_LONG_00000075_restart.nc
-    ln -s -f ../LONG/O2LP_LONG_00000075_restart_ice.nc
-    ln -s -f ../LONG/O2LP_LONG_00000075_restart_trc.nc
+    set_namelist namelist jpni 2
+    set_namelist namelist jpnj 2
+    set_namelist namelist jpnij 4
+    set_namelist namelist nn_solv 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
-    set_namelist namelist_top cn_trcrst_in \"O2LP_LONG_00000075_restart_trc\"
     # put ln_ironsed, ln_river, ln_ndepo, ln_dust
     # if not you need input files, and for tests is not necessary
@@ -318,12 +326,19 @@
     set_namelist namelist_pisces ln_dust .false.
     set_namelist namelist_pisces ln_presatm .false.
-    cd ${SETTE_DIR}
-    . ./prepare_job.sh input_ORCA2_LIM_PISCES.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh $NPROC $JOB_FILE
+    for (( i=1; i<=$NPROC; i++)) ; do
+        L_NPROC=$(( $i - 1 ))
+        L_NPROC=`printf "%04d\n" ${L_NPROC}`
+        ln -sf ../LONG/O2LP_LONG_00000075_restart_${L_NPROC}.nc .
+        ln -sf ../LONG/O2LP_LONG_00000075_restart_trc_${L_NPROC}.nc .
+        ln -sf ../LONG/O2LP_LONG_00000075_restart_ice_${L_NPROC}.nc .
+    done
+    cd ${SETTE_DIR}
+    . ./prepare_job.sh input_ORCA2_LIM_PISCES.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 fi
 
 if [ ${config} -eq 4 ] ;  then
-    ## Reproducibility tests for ORCA2_LIM_PISCES
+    ## Repropducibility tests for ORCA2_LIM_PISCES
     export TEST_NAME="REPRO_4_4"
     cd ${SETTE_DIR}
@@ -334,11 +349,11 @@
     . prepare_exe_dir.sh
     JOB_FILE=${EXE_DIR}/run_job.sh
-    MPIRUN_FLAG="yes"
     NPROC=16
-    rm $JOB_FILE
+    \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 4
@@ -356,19 +371,16 @@
     set_namelist namelist_pisces ln_presatm .false.
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_ORCA2_LIM_PISCES.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh $NPROC $JOB_FILE
+    . ./prepare_job.sh input_ORCA2_LIM_PISCES.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 
     cd ${SETTE_DIR}
     export TEST_NAME="REPRO_2_8"
     . prepare_exe_dir.sh
-    JOB_FILE=${EXE_DIR}/run_job.sh
-    MPIRUN_FLAG="yes"
-    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
@@ -386,7 +398,7 @@
     set_namelist namelist_pisces ln_presatm .false.
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_ORCA2_LIM_PISCES.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh $NPROC $JOB_FILE
+    . ./prepare_job.sh input_ORCA2_LIM_PISCES.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 fi
 
@@ -396,13 +408,12 @@
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2OFFPIS_LONG -r ORCA2_OFF_PISCES -j 8 
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    . prepare_exe_dir.sh
-    JOB_FILE=${EXE_DIR}/run_job.sh
-    MPIRUN_FLAG="yes"
-    NPROC=1
-    rm $JOB_FILE
+    . ../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
+    . all_functions.sh
+    . 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_LONG\"
@@ -411,4 +422,7 @@
     set_namelist namelist nn_stock 20
     set_namelist namelist ln_clobber .true.
+    set_namelist namelist jpni 2
+    set_namelist namelist jpnj 2
+    set_namelist namelist jpnij 4
     set_namelist namelist_top ln_trcdta .false.
     set_namelist namelist_top ln_diatrc .false.
@@ -421,9 +435,12 @@
     set_namelist namelist_pisces ln_presatm .false.
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_ORCA2_OFF_PISCES.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
+    . ./prepare_job.sh input_ORCA2_OFF_PISCES.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
     
     cd ${SETTE_DIR}
     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\"
@@ -432,9 +449,17 @@
     set_namelist namelist nn_stock 20
     set_namelist namelist ln_clobber .true.
-    ln -s ../LONG/OFFP_LONG_00000020_restart_trc.nc .
+    set_namelist namelist jpni 2
+    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.
     set_namelist namelist_top nn_rsttr 2
     set_namelist namelist_top cn_trcrst_in \"OFFP_LONG_00000020_restart_trc\"
+    for (( i=1; i<=$NPROC; i++)) ; do
+        L_NPROC=$(( $i - 1 ))
+        L_NPROC=`printf "%04d\n" ${L_NPROC}`
+        ln -sf ../LONG/OFFP_LONG_00000020_restart_trc_${L_NPROC}.nc .
+    done
     # put ln_ironsed, ln_river, ln_ndepo, ln_dust
     # if not you need input files, and for tests is not necessary
@@ -445,11 +470,11 @@
     set_namelist namelist_pisces ln_presatm .false.
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_ORCA2_OFF_PISCES.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh $NPROC $JOB_FILE
+    . ./prepare_job.sh input_ORCA2_OFF_PISCES.cfg $NPROC ${TEST_NAME}  ${MPIRUN_FLAG} ${JOB_FILE}
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh $NPROC  ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 fi
 
 if [ ${config} -eq 6 ] ;  then
-    ## Reproducibility tests for ORCA2_OFF_PISCES
+    ## Repropducibility tests for ORCA2_OFF_PISCES
     export TEST_NAME="REPRO_4_4"
     cd ${SETTE_DIR}
@@ -460,10 +485,10 @@
     . prepare_exe_dir.sh
     JOB_FILE=${EXE_DIR}/run_job.sh
-    MPIRUN_FLAG="yes"
     NPROC=16
-    rm $JOB_FILE
+    \rm $JOB_FILE
     cd ${EXE_DIR}
     set_namelist namelist nn_it000 1
     set_namelist namelist nn_itend 40
+    set_namelist namelist ln_ctl .false.
     set_namelist namelist ln_clobber .true.
     set_namelist namelist jpni 4
@@ -480,18 +505,15 @@
     set_namelist namelist_pisces ln_presatm .false.
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_ORCA2_OFF_PISCES.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh $NPROC $JOB_FILE
+    . ./prepare_job.sh input_ORCA2_OFF_PISCES.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 
     cd ${SETTE_DIR}
     export TEST_NAME="REPRO_2_8"
     . prepare_exe_dir.sh
-    JOB_FILE=${EXE_DIR}/run_job.sh
-    MPIRUN_FLAG="yes"
-    NPROC=16
-    rm $JOB_FILE
     cd ${EXE_DIR}
     set_namelist namelist nn_it000 1
     set_namelist namelist nn_itend 40
+    set_namelist namelist ln_ctl .false.
     set_namelist namelist ln_clobber .true.
     set_namelist namelist jpni 2
@@ -508,26 +530,25 @@
     set_namelist namelist_pisces ln_presatm .false.
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_ORCA2_OFF_PISCES.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh $NPROC $JOB_FILE
-fi
-
-# TESTS FOR AMM12 CONFIGURATION
+    . ./prepare_job.sh input_ORCA2_OFF_PISCES.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh $NPROC  ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
+fi
+
 if [ ${config} -eq 7 ] ;  then
-    ## 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
-    . all_functions.sh
-    . prepare_exe_dir.sh
-    JOB_FILE=${EXE_DIR}/run_job.sh
-    MPIRUN_FLAG="yes"
+    ## Restartability tests for AMM12
+    export TEST_NAME="LONG"
+    cd ${SETTE_DIR}
+    . ../CONFIG/makenemo -m ${CMP_NAM} -n AMM12_LONG -r AMM12 
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    . prepare_exe_dir.sh
+    JOB_FILE=${EXE_DIR}/run_job.sh
     NPROC=32
-    rm $JOB_FILE
-    cd ${EXE_DIR}
-    set_namelist namelist nn_it000 1
-    set_namelist namelist nn_itend 576
+    \rm $JOB_FILE
+    cd ${EXE_DIR}
+    set_namelist namelist nn_it000 1
+    set_namelist namelist nn_itend 12
+    set_namelist namelist nn_stock 6
     set_namelist namelist nn_fwb 0
     set_namelist namelist ln_ctl .false.
@@ -539,59 +560,5 @@
     set_namelist namelist jpnij 32
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_AMM12.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh $NPROC $JOB_FILE
-
-    cd ${SETTE_DIR}
-    export TEST_NAME="REPRO_4_8"
-    . prepare_exe_dir.sh
-    JOB_FILE=${EXE_DIR}/run_job.sh
-    MPIRUN_FLAG="yes"
-    NPROC=32
-    rm $JOB_FILE
-    cd ${EXE_DIR}
-    set_namelist namelist nn_it000 1
-    set_namelist namelist nn_itend 576
-    set_namelist namelist nn_fwb 0
-    set_namelist namelist ln_ctl .false.
-    set_namelist namelist nn_dyn2d 2
-    set_namelist namelist nn_tra_dta 0
-    set_namelist namelist ln_clobber .true.
-    set_namelist namelist jpni 4
-    set_namelist namelist jpnj 8
-    set_namelist namelist jpnij 32
-    cd ${SETTE_DIR}
-    . ./prepare_job.sh input_AMM12.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh $NPROC $JOB_FILE
-fi
-
-if [ ${config} -eq 8 ] ;  then
-    ## Restartability tests for AMM12
-    export TEST_NAME="LONG"
-    cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n AMM12_LONG -r AMM12 -j 8 add_key "key_mpp_rep"
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    . prepare_exe_dir.sh
-    JOB_FILE=${EXE_DIR}/run_job.sh
-    MPIRUN_FLAG="yes"
-    NPROC=32
-    rm $JOB_FILE
-    cd ${EXE_DIR}
-    set_namelist namelist nn_it000 1
-    set_namelist namelist nn_itend 12
-    set_namelist namelist nn_stock 6
-    set_namelist namelist nn_fwb 0
-    set_namelist namelist ln_ctl .false.
-    set_namelist namelist ln_clobber .true.
-    set_namelist namelist nn_dyn2d 2
-    set_namelist namelist nn_tra_dta 0
-    set_namelist namelist jpni 8
-    set_namelist namelist jpnj 4
-    set_namelist namelist jpnij 32
-    cd ${SETTE_DIR}
-    . ./prepare_job.sh input_AMM12.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
+    . ./prepare_job.sh input_AMM12.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
 
     cd ${SETTE_DIR}
@@ -611,9 +578,62 @@
     set_namelist namelist ln_rstart .true.
     set_namelist namelist nn_rstctl 2
-    set_namelist namelist cn_ocerst_in \"../LONG/AMM12_00000006_restart\"
-    cd ${SETTE_DIR}
-    . ./prepare_job.sh input_AMM12.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh $NPROC $JOB_FILE
+    set_namelist namelist cn_ocerst_in \"AMM12_00000006_restart\"
+    for (( i=1; i<=$NPROC; i++)) ; do
+        L_NPROC=$(( $i - 1 ))
+        L_NPROC=`printf "%04d\n" ${L_NPROC}`
+        ln -sf ../LONG/AMM12_00000006_restart_${L_NPROC}.nc .
+    done
+    cd ${SETTE_DIR}
+    . ./prepare_job.sh input_AMM12.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
+fi
+
+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"
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    . prepare_exe_dir.sh
+    JOB_FILE=${EXE_DIR}/run_job.sh
+    NPROC=32
+    \rm ${JOB_FILE}
+    cd ${EXE_DIR}
+    set_namelist namelist nn_it000 1
+    set_namelist namelist nn_itend 576
+    set_namelist namelist nn_fwb 0
+    set_namelist namelist ln_ctl .false.
+    set_namelist namelist ln_clobber .true.
+    set_namelist namelist nn_dyn2d 2
+    set_namelist namelist nn_tra_dta 0
+    set_namelist namelist jpni 8
+    set_namelist namelist jpnj 4
+    set_namelist namelist jpnij 32
+    cd ${SETTE_DIR}
+    . ./prepare_job.sh input_AMM12.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
+
+    cd ${SETTE_DIR}
+    export TEST_NAME="REPO_4_8"
+    . prepare_exe_dir.sh
+    cd ${EXE_DIR}
+    set_namelist namelist nn_it000 1
+    set_namelist namelist nn_itend 576
+    set_namelist namelist nn_fwb 0
+    set_namelist namelist ln_ctl .false.
+    set_namelist namelist nn_dyn2d 2
+    set_namelist namelist nn_tra_dta 0
+    set_namelist namelist ln_clobber .true.
+    set_namelist namelist jpni 4
+    set_namelist namelist jpnj 8
+    set_namelist namelist jpnij 32
+    cd ${SETTE_DIR}
+    . ./prepare_job.sh input_AMM12.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 fi
 
@@ -629,7 +649,6 @@
     . prepare_exe_dir.sh
     JOB_FILE=${EXE_DIR}/run_job.sh
-    MPIRUN_FLAG="yes"
     NPROC=2
-    rm $JOB_FILE
+    \rm ${JOB_FILE}
     cd ${EXE_DIR}
     set_namelist namelist nn_it000 1
@@ -645,7 +664,7 @@
     set_namelist 1_namelist ln_clobber .true.
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_ORCA2_LIM_AGRIF.cfg $NPROC ${TEST_NAME} $MPIRUN_FLAG $JOB_FILE
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh $NPROC $JOB_FILE
+    . ./prepare_job.sh input_ORCA2_LIM_AGRIF.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE}
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 fi
 
Index: anches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/sette.sh.vargas
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/sette.sh.vargas	(revision 3569)
+++ 	(revision )
@@ -1,593 +1,0 @@
-#!/bin/bash
-#############################################################
-# Author : Simona Flavoni for NEMO
-# Contact : sflod@locean-ipsl.upmc.fr
-#
-# sette.sh   : principal script of SET TEsts for NEMO (SETTE)
-# ----------------------------------------------------------------------
-# NEMO/SETTE , NEMO Consortium (2010)
-# Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-# ----------------------------------------------------------------------
-#
-#############################################################
-#set -x
-set -o posix
-#set -u
-#set -e
-#+
-#
-# ================
-# sette.sh
-# ================
-#
-# ----------------------------------------------
-# Set of tests for NEMO
-# ----------------------------------------------
-#
-# SYNOPSIS
-# ========
-#
-# ::
-#
-#  $ ./sette.sh
-#
-# DESCRIPTION
-# ===========
-#
-# Variables to be checked by user:
-#
-# COMPILER : name of compiler as defined in NEMOGCM/ARCH directory 
-#
-# 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"
-#
-# Principal script is sette.sh, that calls 
-#
-#  makenemo 
-#
-#   creates the exectuable in ${CONFIG_NAME}/BLD/bin/nemo.exe  (and its link opa in ${CONFIG_NAME}/EXP00)
-#
-#  param.cfg : sets and loads following directories:
-#
-#   FORCING_DIR : is the directory for forcing files (tarfile)
-#
-#   INPUT_DIR : is the directory for input files storing 
-#
-#   TMPDIR : is the temporary directory (if needed)
-# 
-#   NEMO_VALIDATION_DIR : is the validation directory
-#
-#   (NOTE: this file is the same for all configrations to be tested with sette)
-#
-#
-#  all_functions.sh : loads functions used by sette (note: new functions can be added here)
-#
-#   set_namelist : function declared in all_functions that set namelist parameters for tests
-#
-#   post_test_tidyup : creates validation storage directory and copy needed output files (solver.stat and ocean.output) in it after execution of test.
-#
-#   Tree of VALIDATION is:
-#
-#   NEMO_VALIDATION_DIR/WCONFIG_NAME/WCOMPILER_NAME/TEST_NAME/REVISION_NUMBER(or DATE)
-#
-#
-#  prepare_exe_dir.sh : defines and creates directory where the test is executed
-#
-#       execution directory takes name of TEST_NAME defined in every test in sette.sh
-#
-#       ( each test in executed in its own directory )
-#
-#
-#  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
-#
-#   (note this job needs to have an input_CONFIG.cfg in which can be found input tar file)
-# 
-#  NOTE: if job is not launched for some problems you have executable ready in ${EXE_DIR} directory
-#
-#  NOTE: the changed namelists are leaved in ${EXE_DIR} directory whereas original namelist remains in ${NEW_CONF}/EXP00
-# 
-#  in ${SETTE_DIR} is created output.sette with the echo of executed commands
-#
-#  if sette.sh is stopped in output.sette there is written the last command executed by sette.sh
-#
-#  if you run: ./sette.sh 2>&1 | tee out.sette
-#
-#  in ${SETTE_DIR} out.sette is redirected standard error & standard output
-#
-#
-# EXAMPLES
-# ========
-#
-# ::
-#
-#  $ ./sette.sh 
-#
-#
-# TODO
-# ====
-#
-# option debug
-#
-# EVOLUTIONS
-# ==========
-#
-# $Id: sette.sh 2890 2011-10-06 11:03:48Z flavoni $
-#
-#   * creation
-#
-#-
-#
-#-
-# Compiler among those in NEMOGCM/ARCH
-COMPILER=PW6_VARGAS
-export BATCH_COMMAND=llsubmit
-export MPI_INTERACT="yes"
-
-# Directory to run the tests
-SETTE_DIR=$(cd $(dirname "$0"); pwd)
-MAIN_DIR=${SETTE_DIR%/SETTE}
-CONFIG_DIR=${MAIN_DIR}/CONFIG
-TOOLS_DIR=${MAIN_DIR}/TOOLS
-COMPIL_DIR=${TOOLS_DIR}/COMPILE
-
-CMP_NAM=${1:-$COMPILER}
-# Copy job_batch_COMPILER file for specific compiler into job_batch_template
-cd ${SETTE_DIR}
-cp BATCH_TEMPLATE/batch-${COMPILER} job_batch_template || exit
-
-for config in 1 2 3 4 5 6 7 8
-do
-
-# TESTS FOR GYRE_LOBSTER CONFIGURATION
-if [ ${config} -eq 1 ] ;  then
-    ## Restartability tests for GYRE_LOBSTER
-    export TEST_NAME="LONG"
-    cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n GYRELOB_LONG -r GYRE_LOBSTER add_key "key_mpp_mpi key_mpp_rep"
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    . prepare_exe_dir.sh
-    cd ${EXE_DIR}
-    set_namelist namelist cn_exp \"GYRELOB_LONG\"
-    set_namelist namelist nn_it000 1
-    set_namelist namelist nn_itend 120
-    set_namelist namelist nn_stock 60
-    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
-    set_namelist namelist jpnij 4
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_GYRE.cfg 4 ${TEST_NAME}
-
-    cd ${SETTE_DIR}
-    export TEST_NAME="SHORT"
-    . prepare_exe_dir.sh
-    cd ${EXE_DIR}
-    set_namelist namelist cn_exp \"GYRELOB_SHORT\"
-    set_namelist namelist nn_it000 61
-    set_namelist namelist nn_itend 120
-    set_namelist namelist nn_stock 60
-    set_namelist namelist ln_rstart .true.
-    set_namelist namelist nn_rstctl 2
-    set_namelist namelist ln_clobber .true.
-    set_namelist namelist nn_solv 2
-    set_namelist namelist jpni 2
-    set_namelist namelist jpnj 2
-    set_namelist namelist jpnij 4
-    cp ..\/LONG\/GYRELOB_LONG_00000060_restart*.nc .
-    set_namelist namelist cn_ocerst_in \"GYRELOB_LONG_00000060_restart\"
-    set_namelist namelist_top ln_diatrc .false.
-    set_namelist namelist_top ln_rsttr .true.
-    set_namelist namelist_top nn_rsttr 2
-    set_namelist namelist_top cn_trcrst_in \"GYRELOB_LONG_00000060_restart_trc\"
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_GYRE.cfg 4 ${TEST_NAME}
-fi
-
-if [ ${config} -eq 2 ] ;  then
-    ## Repropducibility tests for GYRE_LOBSTER
-    export TEST_NAME="REPRO_1_4"
-    cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n GYRELOB_4 -r GYRE_LOBSTER add_key "key_mpp_rep key_mpp_mpi"
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    . prepare_exe_dir.sh
-    cd ${EXE_DIR}
-    set_namelist namelist cn_exp \"GYRELOB_14\"
-    set_namelist namelist nn_it000 1
-    set_namelist namelist nn_itend 60
-    set_namelist namelist nn_fwb 0
-    set_namelist namelist nn_bench 0
-    set_namelist namelist ln_ctl .false.
-    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
-    set_namelist namelist jpnij 4
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_GYRE.cfg 4 ${TEST_NAME}
-
-    cd ${SETTE_DIR}
-    export TEST_NAME="REPRO_2_2"
-    . prepare_exe_dir.sh
-    cd ${EXE_DIR}
-    set_namelist namelist cn_exp \"GYRELOB_22\"
-    set_namelist namelist nn_it000 1
-    set_namelist namelist nn_itend 60
-    set_namelist namelist nn_fwb 0
-    set_namelist namelist ln_ctl .false.
-    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
-    set_namelist namelist jpnij 4
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_GYRE.cfg 4 ${TEST_NAME}
-fi
-
-# TESTS FOR ORCA2_LIM_PISCES CONFIGURATION
-if [ ${config} -eq 3 ] ;  then
-    ## Restartability tests for ORCA2_LIM_PISCES
-    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 key_mpp_rep" 
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    . prepare_exe_dir.sh
-    cd ${EXE_DIR}
-    set_namelist namelist cn_exp \"O2LP_LONG\"
-    set_namelist namelist nn_it000 1
-    set_namelist namelist nn_itend 150
-    set_namelist namelist nn_stock 75
-    set_namelist namelist ln_clobber .true.
-    set_namelist namelist jpni 2
-    set_namelist namelist jpnj 2
-    set_namelist namelist jpnij 4
-    set_namelist namelist nn_solv 2
-    set_namelist namelist_top ln_trcdta .false.
-    set_namelist namelist_top ln_diatrc .false.
-    # 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_river .false.
-    set_namelist namelist_pisces ln_ndepo .false.
-    set_namelist namelist_pisces ln_dust .false.
-    set_namelist namelist_pisces ln_presatm .false.
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 4 ${TEST_NAME}
-    
-    cd ${SETTE_DIR}
-    export TEST_NAME="SHORT"
-    . prepare_exe_dir.sh
-    cd ${EXE_DIR}
-    set_namelist namelist cn_exp \"O2LP_SHORT\"
-    set_namelist namelist nn_it000 76
-    set_namelist namelist nn_itend 150
-    set_namelist namelist nn_stock 75
-    set_namelist namelist ln_rstart .true.
-    set_namelist namelist nn_rstctl 2
-    set_namelist namelist ln_clobber .true.
-    set_namelist namelist jpni 2
-    set_namelist namelist jpnj 2
-    set_namelist namelist jpnij 4
-    set_namelist namelist nn_solv 2
-    cp ../LONG/O2LP_LONG_00000075_restart*nc .
-    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 ln_diatrc .false.
-    set_namelist namelist_top ln_rsttr .true.
-    set_namelist namelist_top nn_rsttr 2
-    set_namelist namelist_top cn_trcrst_in \"O2LP_LONG_00000075_restart_trc\"
-    # 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_river .false.
-    set_namelist namelist_pisces ln_ndepo .false.
-    set_namelist namelist_pisces ln_dust .false.
-    set_namelist namelist_pisces ln_presatm .false.
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 4 ${TEST_NAME}
-fi
-
-if [ ${config} -eq 4 ] ;  then
-    ## Repropducibility 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"
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    . prepare_exe_dir.sh
-    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 4
-    set_namelist namelist jpnj 4
-    set_namelist namelist jpnij 16
-    set_namelist namelist nn_solv 2
-    set_namelist namelist_top ln_trcdta .false.
-    set_namelist namelist_top ln_diatrc .false.
-    # 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_river .false.
-    set_namelist namelist_pisces ln_ndepo .false.
-    set_namelist namelist_pisces ln_dust .false.
-    set_namelist namelist_pisces ln_presatm .false.
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 16 ${TEST_NAME}
-
-    cd ${SETTE_DIR}
-    export TEST_NAME="REPRO_2_8"
-    . prepare_exe_dir.sh
-    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
-    set_namelist namelist jpnj 8
-    set_namelist namelist jpnij 16
-    set_namelist namelist nn_solv 2
-    set_namelist namelist_top ln_trcdta .false.
-    set_namelist namelist_top ln_diatrc .false.
-    # 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_river .false.
-    set_namelist namelist_pisces ln_ndepo .false.
-    set_namelist namelist_pisces ln_dust .false.
-    set_namelist namelist_pisces ln_presatm .false.
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 16 ${TEST_NAME}
-fi
-
-# TESTS FOR ORCA2_OFF_PISCES CONFIGURATION
-if [ ${config} -eq 5 ] ;  then
-    ## Restartability tests for ORCA2_OFF_PISCES
-    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"
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    . prepare_exe_dir.sh
-    cd ${EXE_DIR}
-    set_namelist namelist cn_exp \"OFFP_LONG\"
-    set_namelist namelist nn_it000 1
-    set_namelist namelist nn_itend 40
-    set_namelist namelist nn_stock 20
-    set_namelist namelist ln_clobber .true.
-    set_namelist namelist jpni 2
-    set_namelist namelist jpnj 2
-    set_namelist namelist jpnij 4
-    set_namelist namelist_top ln_trcdta .false.
-    set_namelist namelist_top ln_diatrc .false.
-    # 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_river .false.
-    set_namelist namelist_pisces ln_ndepo .false.
-    set_namelist namelist_pisces ln_dust .false.
-    set_namelist namelist_pisces ln_presatm .false.
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_ORCA2_OFF_PISCES.cfg 4 ${TEST_NAME}
-    
-    cd ${SETTE_DIR}
-    export TEST_NAME="SHORT"
-    . prepare_exe_dir.sh
-    cd ${EXE_DIR}
-    set_namelist namelist cn_exp \"OFFP_SHORT\"
-    set_namelist namelist nn_it000 21
-    set_namelist namelist nn_itend 40
-    set_namelist namelist nn_stock 20
-    set_namelist namelist ln_clobber .true.
-    set_namelist namelist jpni 2
-    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.
-    set_namelist namelist_top nn_rsttr 2
-    set_namelist namelist_top cn_trcrst_in \"OFFP_LONG_00000020_restart_trc\"
-    # 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_river .false.
-    set_namelist namelist_pisces ln_ndepo .false.
-    set_namelist namelist_pisces ln_dust .false.
-    set_namelist namelist_pisces ln_presatm .false.
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_ORCA2_OFF_PISCES.cfg 4 ${TEST_NAME}
-fi
-
-if [ ${config} -eq 6 ] ;  then
-    ## Repropducibility 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"
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    . prepare_exe_dir.sh
-    cd ${EXE_DIR}
-    set_namelist namelist nn_it000 1
-    set_namelist namelist nn_itend 40
-    set_namelist namelist ln_ctl .false.
-    set_namelist namelist ln_clobber .true.
-    set_namelist namelist jpni 4
-    set_namelist namelist jpnj 4
-    set_namelist namelist jpnij 16
-    set_namelist namelist_top ln_trcdta .false.
-    set_namelist namelist_top ln_diatrc .false.
-    # 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_river .false.
-    set_namelist namelist_pisces ln_ndepo .false.
-    set_namelist namelist_pisces ln_dust .false.
-    set_namelist namelist_pisces ln_presatm .false.
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_ORCA2_OFF_PISCES.cfg 16 ${TEST_NAME}
-
-    cd ${SETTE_DIR}
-    export TEST_NAME="REPRO_2_8"
-    . prepare_exe_dir.sh
-    cd ${EXE_DIR}
-    set_namelist namelist nn_it000 1
-    set_namelist namelist nn_itend 40
-    set_namelist namelist ln_ctl .false.
-    set_namelist namelist ln_clobber .true.
-    set_namelist namelist jpni 2
-    set_namelist namelist jpnj 8
-    set_namelist namelist jpnij 16
-    set_namelist namelist_top ln_trcdta .false.
-    set_namelist namelist_top ln_diatrc .false.
-    # 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_river .false.
-    set_namelist namelist_pisces ln_ndepo .false.
-    set_namelist namelist_pisces ln_dust .false.
-    set_namelist namelist_pisces ln_presatm .false.
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_ORCA2_OFF_PISCES.cfg 16 ${TEST_NAME}
-fi
-
-# TESTS FOR AMM12 CONFIGURATION
-if [ ${config} -eq 7 ] ;  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"
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    . prepare_exe_dir.sh
-    cd ${EXE_DIR}
-    set_namelist namelist nn_it000 1
-    set_namelist namelist nn_itend 576
-    set_namelist namelist nn_fwb 0
-    set_namelist namelist ln_ctl .false.
-    set_namelist namelist ln_clobber .true.
-    set_namelist namelist nn_dyn2d 2
-    set_namelist namelist nn_tra_dta 0
-    set_namelist namelist jpni 8
-    set_namelist namelist jpnj 4
-    set_namelist namelist jpnij 32
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_AMM12.cfg 32 ${TEST_NAME}
-
-    cd ${SETTE_DIR}
-    export TEST_NAME="REPO_4_8"
-    . prepare_exe_dir.sh
-    cd ${EXE_DIR}
-    set_namelist namelist nn_it000 1
-    set_namelist namelist nn_itend 576
-    set_namelist namelist nn_fwb 0
-    set_namelist namelist ln_ctl .false.
-    set_namelist namelist nn_dyn2d 2
-    set_namelist namelist nn_tra_dta 0
-    set_namelist namelist ln_clobber .true.
-    set_namelist namelist jpni 4
-    set_namelist namelist jpnj 8
-    set_namelist namelist jpnij 32
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_AMM12.cfg 32 ${TEST_NAME}
-fi
-
-if [ ${config} -eq 8 ] ;  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_mpp_rep"
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    . prepare_exe_dir.sh
-    cd ${EXE_DIR}
-    set_namelist namelist nn_it000 1
-    set_namelist namelist nn_itend 12
-    set_namelist namelist nn_stock 6
-    set_namelist namelist nn_fwb 0
-    set_namelist namelist ln_ctl .false.
-    set_namelist namelist ln_clobber .true.
-    set_namelist namelist nn_dyn2d 2
-    set_namelist namelist nn_tra_dta 0
-    set_namelist namelist jpni 8
-    set_namelist namelist jpnj 4
-    set_namelist namelist jpnij 32
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_AMM12.cfg 32 ${TEST_NAME}
-
-    cd ${SETTE_DIR}
-    export TEST_NAME="SHORT"
-    . prepare_exe_dir.sh
-    cd ${EXE_DIR}
-    set_namelist namelist nn_it000 7
-    set_namelist namelist nn_itend 12
-    set_namelist namelist nn_fwb 0
-    set_namelist namelist ln_ctl .false.
-    set_namelist namelist ln_clobber .true.
-    set_namelist namelist nn_dyn2d 2
-    set_namelist namelist nn_tra_dta 0
-    set_namelist namelist jpni 8
-    set_namelist namelist jpnj 4
-    set_namelist namelist jpnij 32
-    set_namelist namelist ln_rstart .true.
-    set_namelist namelist nn_rstctl 2
-    cp ../LONG/AMM12_00000006_restart*.nc .
-    set_namelist namelist cn_ocerst_in \"AMM12_00000006_restart\"
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_AMM12.cfg 32 ${TEST_NAME}
-fi
-
-# TEST FOR ORCA2_LIM_AGRIF : simple test of running AGRIF (no restartability neither reproducibility tests)
-if [ ${config} -eq 9 ] ;  then
-    ## ORCA2_LIM with Agulhas AGRIF zoom in MPI
-    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"
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    . prepare_exe_dir.sh
-    cd ${EXE_DIR}
-    set_namelist namelist nn_it000 1
-    set_namelist namelist nn_itend 75
-    set_namelist namelist ln_ctl .false.
-    set_namelist namelist ln_clobber .true.
-    set_namelist namelist jpni 1
-    set_namelist namelist jpnj 2
-    set_namelist namelist jpnij 2
-    set_namelist 1_namelist nn_it000 1
-    set_namelist 1_namelist nn_itend 150
-    set_namelist 1_namelist ln_ctl .false.
-    set_namelist 1_namelist ln_clobber .true.
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_ORCA2_LIM_AGRIF.cfg 2 ${TEST_NAME}
-fi
-
-done
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/sette_beginner.sh
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/sette_beginner.sh	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/SETTE/sette_beginner.sh	(revision 3570)
@@ -11,5 +11,5 @@
 #
 #############################################################
-#set -x
+#set -vx
 set -o posix
 #set -u
@@ -39,6 +39,8 @@
 # Compiler among those in NEMOGCM/ARCH
 COMPILER=PW6_VARGAS
-export BATCH_COMMAND=llsubmit
-export MPI_INTERACT="no"
+export BATCH_COMMAND_PAR="llsubmit"
+export BATCH_COMMAND_SEQ=$BATCH_COMMAND_PAR
+export INTERACT_FLAG="no"
+export MPIRUN_FLAG="yes"
 
 # Directory to run the tests
@@ -57,7 +59,7 @@
 # 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="TEST01"
+export TEST_NAME="prova_beginner"
 cd ${SETTE_DIR}
-. ../CONFIG/makenemo -m ${CMP_NAM} -n GYRE_SHORT -r GYRE
+. ../CONFIG/makenemo -m ${CMP_NAM} -n GYRE_SHORT -r GYRE -j 10 add_key "key_mpp_mpi"
 cd ${SETTE_DIR}
 . param.cfg 
@@ -65,4 +67,7 @@
 # creation of execution directory
 . prepare_exe_dir.sh
+JOB_FILE=${EXE_DIR}/run_job.sh
+NPROC=4
+\rm $JOB_FILE
 cd ${EXE_DIR}
 # setting namelist parameters
@@ -75,5 +80,8 @@
 # frequency of creation of a restart file
 set_namelist namelist nn_stock 60
+
 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)
-. ./fcm_job.sh input_GYRE.cfg 1 ${TEST_NAME}
+cd ${SETTE_DIR}   
+. ./fcm_job.sh 4 ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
Index: /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/TOOLS/SECTIONS_DIADCT/src/compute_sections.f90
===================================================================
--- /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/TOOLS/SECTIONS_DIADCT/src/compute_sections.f90	(revision 3569)
+++ /branches/2012/dev_r3327_MERCATOR1_BDY/NEMOGCM/TOOLS/SECTIONS_DIADCT/src/compute_sections.f90	(revision 3570)
@@ -370,5 +370,5 @@
         DO WHILE ( (  sec%listPoint(jseg)%I .NE.  endingPoint%I    &
                  .OR. sec%listPoint(jseg)%J .NE. endingPoint%J   ) &
-                 .AND. jseg .LT. nb_inmesh + 1 .AND. sec%listPoint(jseg)%I .GT. 0  )         
+                 .AND. jseg .LT. nb_inmesh + 10 .AND. sec%listPoint(jseg)%I .GT. 0  )         
    
            ! a. find the 4 adjacent points (North, South, East, West)
@@ -429,11 +429,11 @@
            !--------------------
            IF(      SouthPoint%I==endingPoint%I .AND. SouthPoint%J==endingPoint%J )THEN 
-               jseg = jseg+1 ; sec%listPoint(jseg) = SouthPoint
+               sec%direction(jseg)=2 ; jseg = jseg+1 ; sec%listPoint(jseg) = SouthPoint
            ELSE IF( NorthPoint%I==endingPoint%I .AND. NorthPoint%J==endingPoint%J )THEN
-               jseg = jseg+1 ; sec%listPoint(jseg) = NorthPoint
+               sec%direction(jseg)=3 ; jseg = jseg+1 ; sec%listPoint(jseg) = NorthPoint
            ELSE IF(  WestPoint%I==endingPoint%I .AND.  WestPoint%J==endingPoint%J )THEN
-               jseg = jseg+1 ; sec%listPoint(jseg) = WestPoint
+               sec%direction(jseg)=0 ; jseg = jseg+1 ; sec%listPoint(jseg) = WestPoint
            ELSE IF(   EstPoint%I==endingPoint%I .AND.   EstPoint%J==endingPoint%J )THEN
-               jseg = jseg+1 ; sec%listPoint(jseg) = EstPoint
+               sec%direction(jseg)=1 ; jseg = jseg+1 ; sec%listPoint(jseg) = EstPoint
 
            ELSE
