Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/GYRE/cpp_GYRE.fcm
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/GYRE/cpp_GYRE.fcm	(revision 2677)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/GYRE/cpp_GYRE.fcm	(revision 2678)
@@ -1,1 +1,1 @@
- bld::tool::fppkeys key_gyre key_dynspg_flt key_ldfslp key_zdftke key_vectopt_loop key_iomput key_nproci=1 key_nprocj=1
+ bld::tool::fppkeys key_gyre key_dynspg_flt key_ldfslp key_zdftke key_vectopt_loop key_iomput
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/GYRE_LOBSTER/cpp_GYRE_LOBSTER.fcm
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/GYRE_LOBSTER/cpp_GYRE_LOBSTER.fcm	(revision 2677)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/GYRE_LOBSTER/cpp_GYRE_LOBSTER.fcm	(revision 2678)
@@ -1,1 +1,1 @@
-bld::tool::fppkeys  key_gyre key_dynspg_flt key_ldfslp key_zdftke key_vectopt_loop key_top key_lobster key_diatrc key_iomput key_nproci=1 key_nprocj=1
+bld::tool::fppkeys  key_gyre key_dynspg_flt key_ldfslp key_zdftke key_vectopt_loop key_top key_lobster key_diatrc key_iomput 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/ORCA2_LIM/cpp_ORCA2_LIM.fcm
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/ORCA2_LIM/cpp_ORCA2_LIM.fcm	(revision 2677)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/ORCA2_LIM/cpp_ORCA2_LIM.fcm	(revision 2678)
@@ -1,1 +1,1 @@
- bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_dtatem key_dtasal key_tradmp key_zdftke key_zdfddm key_zdftmx key_iomput key_nproci=1 key_nprocj=1 
+ bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_dtatem key_dtasal key_tradmp key_zdftke key_zdfddm key_zdftmx key_iomput 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/cpp_ORCA2_LIM_PISCES.fcm
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/cpp_ORCA2_LIM_PISCES.fcm	(revision 2677)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/cpp_ORCA2_LIM_PISCES.fcm	(revision 2678)
@@ -1,1 +1,1 @@
-bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_dtatem key_dtasal key_tradmp key_zdftke key_zdfddm key_top key_pisces key_dtatrc key_diatrc key_iomput key_nproci=1 key_nprocj=1
+bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_dtatem key_dtasal key_tradmp key_zdftke key_zdfddm key_top key_pisces key_dtatrc key_diatrc key_iomput 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/cpp_ORCA2_OFF_PISCES.fcm
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/cpp_ORCA2_OFF_PISCES.fcm	(revision 2677)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/cpp_ORCA2_OFF_PISCES.fcm	(revision 2678)
@@ -1,1 +1,1 @@
-bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_dynspg_flt key_ldfslp key_traldf_c2d key_traldf_eiv key_zdftke key_top key_offline key_pisces key_dtatrc key_diatrc key_iomput key_nproci=1 key_nprocj=1
+bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_dynspg_flt key_ldfslp key_traldf_c2d key_traldf_eiv key_zdftke key_top key_offline key_pisces key_dtatrc key_diatrc key_iomput 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/POMME/EXP00/namelist
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/POMME/EXP00/namelist	(revision 2677)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/POMME/EXP00/namelist	(revision 2678)
@@ -192,16 +192,16 @@
 &namsbc_core   !   namsbc_core  CORE bulk formulea
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_wndi = 'u_10.15JUNE2009_orca2'       ,  6  , 'U_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Uwnd'
-   sn_wndj = 'v_10.15JUNE2009_orca2'       ,  6  , 'V_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Vwnd'
-   sn_qsr  = 'ncar_rad.15JUNE2009_orca2'   , 24  , 'SWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_qlw  = 'ncar_rad.15JUNE2009_orca2'   , 24  , 'LWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_tair = 't_10.15JUNE2009_orca2'       ,  6  , 'T_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_humi = 'q_10.15JUNE2009_orca2'       ,  6  , 'Q_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_prec = 'ncar_precip.15JUNE2009_orca2', -1  , 'PRC_MOD1',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_snow = 'ncar_precip.15JUNE2009_orca2', -1  , 'SNOW'    ,   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_tdif = 'taudif_core'                 , 24  , 'taudif'  ,   .false.    , .true. , 'yearly'  , ''       , ''
-
+!              !   file name      ! frequency (hours) ! variable   ! time interp.   !  clim   ! 'yearly'/ ! weights  ! rotation !
+!              !                  !  (if <0  months)  !   name     !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
+   sn_wndi     = 'u10_1988'       ,       24          , 'u10'      ,    .true.      , .true. ,   'yearly' , ''
+   sn_wndj     = 'v10_1988'       ,       24          , 'v10'      ,    .true.      , .true. ,   'yearly' , ''
+   sn_qsr      = 'radsw_1988'     ,       24          , 'radsw'    ,    .true.      , .true. ,   'yearly' , ''
+   sn_qlw      = 'radlw_1988'     ,       24          , 'radlw'    ,    .true.      , .true. ,   'yearly' , ''
+   sn_tair     = 't2_1988.nc'     ,       24          , 't2'       ,    .true.      , .true. ,   'yearly' , ''
+   sn_humi     = 'q2_1988'        ,       24          , 'q2'       ,    .true.      , .true. ,   'yearly' , ''
+   sn_prec     = 'precip_1988.nc' ,       -1          , 'precip'   ,    .true.      , .true. ,   'yearly' , ''
+   sn_snow     = 'precip_1988.nc' ,       -1          , 'precip'   ,    .true.      , .true. ,   'yearly' , ''
+   sn_tdif     = 'taudif_core'    ,       24          , 'taudif'   ,    .true.      , .true. ,   'yearly'  ,''
+!
    cn_dir      = './'      !  root directory for the location of the bulk files
    ln_2m       = .false.   !  air temperature and humidity referenced at 2m (T) instead 10m (F)
@@ -260,11 +260,11 @@
 &namsbc_rnf    !   runoffs namelist surface boundary condition
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_rnf      = 'runoff_core_monthly',    -1    , 'sorunoff',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_cnf      = 'runoff_core_monthly',     0    , 'socoefr0',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_s_rnf    = 'runoffs'            ,    24    , 'rosaline',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_t_rnf    = 'runoffs'            ,    24    , 'rotemper',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_dep_rnf  = 'runoffs'            ,     0    , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''
+!              !  file name           ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!              !                      !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_rnf      = 'runoff_core_monthly',          -1       , 'sorunoff',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_cnf      = 'runoff_core_monthly',           0       , 'socoefr0',   .false.    , .true. , 'yearly'  , ''       , ''
+   sn_s_rnf    = 'runoffs'            ,          24       , 'rosaline',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_t_rnf    = 'runoffs'            ,          24       , 'rotemper',   .true.     , .true. , 'yearly'  , ''       , ''
+   sn_dep_rnf  = 'runoffs'            ,           0       , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''
 
    cn_dir       = './'      !  root directory for the location of the runoff files
@@ -298,5 +298,5 @@
    cn_dir      = './'      !  root directory for the location of the runoff files
    nn_sstr     =     0     !  add a retroaction term in the surface heat       flux (=1) or not (=0)
-   nn_sssr     =     2     !  add a damping     term in the surface freshwater flux (=2) 
+   nn_sssr     =     1     !  add a damping     term in the surface freshwater flux (=2) 
                            !  or to SSS only (=1) or no damping term (=0)
    rn_dqdt     =   -40.    !  magnitude of the retroaction on temperature   [W/m2/K]
@@ -601,5 +601,5 @@
    rn_emin     =   1.e-6   !  minimum value of tke [m2/s2]
    rn_emin0    =   1.e-4   !  surface minimum value of tke [m2/s2]
-   nn_mxl      =   2       !  mixing length: = 0 bounded by the distance to surface and bottom
+   nn_mxl      =   3       !  mixing length: = 0 bounded by the distance to surface and bottom
                            !                 = 1 bounded by the local vertical scale factor
                            !                 = 2 first vertical derivative of mixing length bounded by 1
@@ -610,5 +610,5 @@
    ln_lc       = .true.    !  Langmuir cell parameterisation (Axell 2002)
    rn_lc       =   0.15    !  coef. associated to Langmuir cells
-   nn_etau     =   1       !  penetration of tke below the mixed layer (ML) due to internal & intertial waves
+   nn_etau     =   0       !  penetration of tke below the mixed layer (ML) due to internal & intertial waves
                            !        = 0 no penetration
                            !        = 1 add a tke source below the ML
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/POMME/cpp_POMME.fcm
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/POMME/cpp_POMME.fcm	(revision 2677)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/POMME/cpp_POMME.fcm	(revision 2678)
@@ -1,2 +1,1 @@
-bld::tool::fppkeys key_pomme_r025 key_dynspg_flt key_zdftke key_dtatem key_dtasal key_traldf_c2d key_dynldf_c2d key_ldfslp key_obc key_iomput key_nproci=1 key_nprocj=1
-
+bld::tool::fppkeys key_pomme_r025 key_dynspg_flt key_zdftke key_dtatem key_dtasal key_traldf_c2d key_dynldf_c2d key_ldfslp key_obc key_iomput
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/LIM_SRC_3/limthd_dif.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/LIM_SRC_3/limthd_dif.F90	(revision 2677)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/LIM_SRC_3/limthd_dif.F90	(revision 2678)
@@ -79,4 +79,14 @@
       !!           profile of the ice/snow layers : z_i, z_s
       !!           total ice/snow thickness : ht_i_b, ht_s_b
+      !!
+      !! ** External : 
+      !!
+      !! ** References :
+      !!
+      !! ** History :
+      !!           (02-2003) Martin Vancoppenolle, Louvain-la-Neuve, Belgium
+      !!           (06-2005) Martin Vancoppenolle, 3d version
+      !!           (11-2006) Vectorized by Xavier Fettweis (UCL-ASTR)
+      !!           (04-2007) Energy conservation tested by M. Vancoppenolle
       !!------------------------------------------------------------------
       INTEGER , INTENT (in) ::  &
@@ -333,4 +343,19 @@
                END DO
             END DO
+         ENDIF
+
+         IF ( thcon_i_swi .EQ. 1 ) THEN ! Pringle (0.011/2=0.0055)
+            DO layer = 1, nlay_i-1
+               DO ji = kideb , kiut
+                  ztcond_i(ji,layer) = rcdic + 0.09*( s_i_b(ji,layer)   &
+                     + s_i_b(ji,layer+1) ) / MIN(-2.0*zeps,      &
+                     t_i_b(ji,layer)+t_i_b(ji,layer+1)-2.0*rtt) - &
+                     0.0055* ( t_i_b(ji,layer) + t_i_b(ji,layer+1) - 2.0*rtt )  
+                  ztcond_i(ji,layer) = MAX(ztcond_i(ji,layer),zkimin)
+               END DO
+            END DO
+         ENDIF
+
+         IF ( thcon_i_swi .EQ. 0 ) THEN ! Untersteiner
             DO ji = kideb , kiut
                ztcond_i(ji,nlay_i)   = rcdic + zbeta*s_i_b(ji,nlay_i) / &
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/LDF/ldfslp.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/LDF/ldfslp.F90	(revision 2677)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/LDF/ldfslp.F90	(revision 2678)
@@ -815,4 +815,8 @@
       WRITE(*,*) 'ldf_slp: You should not have seen this print! error?', kt, prd(1,1,1), pn2(1,1,1)
    END SUBROUTINE ldf_slp
+   SUBROUTINE ldf_slp_grif( kt )        ! Dummy routine
+      INTEGER, INTENT(in) :: kt
+      WRITE(*,*) 'ldf_slp_grif: You should not have seen this print! error?', kt
+   END SUBROUTINE ldf_slp_grif
    SUBROUTINE ldf_slp_init       ! Dummy routine
    END SUBROUTINE ldf_slp_init
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf_imp.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf_imp.F90	(revision 2677)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf_imp.F90	(revision 2678)
@@ -15,4 +15,5 @@
    !!            3.2  !  2009-03  (G. Madec)  heat and salt content trends
    !!            3.3  !  2010-06  (C. Ethe, G. Madec) Merge TRA-TRC
+   !!             -   !  2011-02  (A. Coward, C. Ethe, G. Madec) improvment of surface boundary condition
    !!----------------------------------------------------------------------
   
@@ -40,4 +41,6 @@
    PUBLIC   tra_zdf_imp   !  routine called by step.F90
 
+   REAL(wp) ::  r_vvl     ! variable volume indicator, =1 if lk_vvl=T, =0 otherwise 
+
    !! * Substitutions
 #  include "domzgr_substitute.h90"
@@ -56,37 +59,18 @@
       !!                  ***  ROUTINE tra_zdf_imp  ***
       !!
-      !! ** Purpose :   Compute the trend due to the vertical tracer diffusion
-      !!     including the vertical component of lateral mixing (only for 2nd
-      !!     order operator, for fourth order it is already computed and add
-      !!     to the general trend in traldf.F) and add it to the general trend
-      !!     of the tracer equations.
-      !!
-      !! ** Method  :   The vertical component of the lateral diffusive trends
-      !!      is provided by a 2nd order operator rotated along neutral or geo-
-      !!      potential surfaces to which an eddy induced advection can be 
-      !!      added. It is computed using before fields (forward in time) and 
-      !!      isopycnal or geopotential slopes computed in routine ldfslp.
-      !!
-      !!      Second part: vertical trend associated with the vertical physics
-      !!      ===========  (including the vertical flux proportional to dk[t]
-      !!                  associated with the lateral mixing, through the
-      !!                  update of avt)
-      !!      The vertical diffusion of the tracer t  is given by:
-      !!             difft = dz( avt dz(t) ) = 1/e3t dk+1( avt/e3w dk(t) )
+      !! ** Purpose :   Compute the after tracer through a implicit computation
+      !!     of the vertical tracer diffusion (including the vertical component 
+      !!     of lateral mixing (only for 2nd order operator, for fourth order 
+      !!     it is already computed and add to the general trend in traldf) 
+      !!
+      !! ** Method  :  The vertical diffusion of the tracer t  is given by:
+      !!                  difft = dz( avt dz(t) ) = 1/e3t dk+1( avt/e3w dk(t) )
       !!      It is computed using a backward time scheme (t=ta).
+      !!      If lk_zdfddm=T, use avs for salinity or for passive tracers
       !!      Surface and bottom boundary conditions: no diffusive flux on
       !!      both tracers (bottom, applied through the masked field avt).
-      !!      Add this trend to the general trend ta,sa :
-      !!         ta = ta + dz( avt dz(t) )
-      !!         if lk_zdfddm=T, use avs for salinity or for passive tracers
-      !!         (sa = sa + dz( avs dz(t) ) 
-      !!
-      !!      Third part: recover avt resulting from the vertical physics
-      !!      ==========  alone, for further diagnostics (for example to
-      !!                  compute the turbocline depth in zdfmxl.F90).
-      !!         if lk_zdfddm=T, use avt = zavt
-      !!         (avs = zavs if lk_zdfddm=T )
-      !!
-      !! ** Action  : - Update (ta) with before vertical diffusion trend
+      !!      If iso-neutral mixing, add to avt the contribution due to lateral mixing.
+      !!
+      !! ** Action  : - pta  becomes the after tracer
       !!---------------------------------------------------------------------
       USE oce    , ONLY :   zwd   => ua   ! ua used as workspace
@@ -103,5 +87,5 @@
       !!
       INTEGER  ::  ji, jj, jk, jn        ! dummy loop indices
-      REAL(wp) ::  zavi, zrhs, znvvl     ! local scalars
+      REAL(wp) ::  zrhs                  ! local scalars
       REAL(wp) ::  ze3tb, ze3tn, ze3ta   ! variable vertical scale factors
       !!---------------------------------------------------------------------
@@ -116,71 +100,55 @@
          IF(lwp)WRITE(numout,*) 'tra_zdf_imp : implicit vertical mixing on ', cdtype
          IF(lwp)WRITE(numout,*) '~~~~~~~~~~~ '
-         zavi = 0._wp      ! avoid warning at compilation phase when lk_ldfslp=F
+         !
+         IF( lk_vvl ) THEN   ;    r_vvl = 1._wp       ! Variable volume indicator
+         ELSE                ;    r_vvl = 0._wp       
+         ENDIF
       ENDIF
       !
-      ! I. Local initialization
-      ! -----------------------
-      zwd(1,:, : ) = 0._wp     ;     zwd(jpi,:,:) = 0._wp
-      zws(1,:, : ) = 0._wp     ;     zws(jpi,:,:) = 0._wp
-      zwi(1,:, : ) = 0._wp     ;     zwi(jpi,:,:) = 0._wp
-      zwt(1,:, : ) = 0._wp     ;     zwt(jpi,:,:) = 0._wp
-      zwt(:,:,jpk) = 0._wp     ;     zwt( : ,:,1) = 0._wp
-
-      ! I.1 Variable volume : to take into account vertical variable vertical scale factors
-      ! -------------------
-      IF( lk_vvl ) THEN   ;    znvvl = 1._wp
-      ELSE                ;    znvvl = 0._wp
-      ENDIF
-
-      ! II. Vertical trend associated with the vertical physics
-      ! =======================================================
-      !     (including the vertical flux proportional to dk[t] associated
-      !      with the lateral mixing, through the avt update)
-      !     dk[ avt dk[ (t,s) ] ] diffusive trends
-
-      !
-      ! II.0 Matrix construction
-      ! ------------------------
-      DO jn = 1, kjpt
+      !                                               ! ============= !
+      DO jn = 1, kjpt                                 !  tracer loop  !
+         !                                            ! ============= !
          !
          !  Matrix construction
-         ! ------------------------
-         IF( cdtype == 'TRA' .AND. jn == jp_tem )  THEN 
+         ! --------------------
+         ! Build matrix if temperature or salinity (only in double diffusion case) or first passive tracer
+         !
+         IF(  ( cdtype == 'TRA' .AND. ( ( jn == jp_tem ) .OR. ( jn == jp_sal .AND. lk_zdfddm ) ) ) .OR. &
+            & ( cdtype == 'TRC' .AND. jn == 1 )  )  THEN
+            !
+            ! vertical mixing coef.: avt for temperature, avs for salinity and passive tracers
+            IF( cdtype == 'TRA' .AND. jn == jp_tem ) THEN   ;   zwt(:,:,2:jpk) = avt  (:,:,2:jpk)
+            ELSE                                            ;   zwt(:,:,2:jpk) = fsavs(:,:,2:jpk)
+            ENDIF
+            zwt(:,:,1) = 0._wp
+            !
 #if defined key_ldfslp
-            IF( ln_traldf_grif ) THEN
+            ! isoneutral diffusion: add the contribution 
+            IF( ln_traldf_grif    ) THEN     ! Griffies isoneutral diff
                DO jk = 2, jpkm1
                   DO jj = 2, jpjm1
                      DO ji = fs_2, fs_jpim1   ! vector opt.
-                        ! zavi = fsahtw(ji,jj,jk) * wslp2(ji,jj,jk)         ! vertical mixing coef. due to lateral mixing
-                        zavi = ah_wslp2(ji,jj,jk)                ! vertical mixing coef. due to lateral mixing
-                        zwt(ji,jj,jk) = avt(ji,jj,jk) + zavi              ! zwt=avt+zavi (total vertical mixing coef. on temperature)
+                        zwt(ji,jj,jk) = zwt(ji,jj,jk) + ah_wslp2(ji,jj,jk)       
                      END DO
                   END DO
                END DO
-            ! update and save of avt (and avs if double diffusive mixing)
-            ELSE IF( l_traldf_rot ) THEN
+            ELSE IF( l_traldf_rot ) THEN     ! standard isoneutral diff
                DO jk = 2, jpkm1
                   DO jj = 2, jpjm1
                      DO ji = fs_2, fs_jpim1   ! vector opt.
-                        zavi = fsahtw(ji,jj,jk)                       &   ! vertical mixing coef. due to lateral mixing
-                           & * (  wslpi(ji,jj,jk) * wslpi(ji,jj,jk)   &
-                           &    + wslpj(ji,jj,jk) * wslpj(ji,jj,jk)  )
-                        zwt(ji,jj,jk) = avt(ji,jj,jk) + zavi              ! zwt=avt+zavi (total vertical mixing coef. on temperature)
+                        zwt(ji,jj,jk) = zwt(ji,jj,jk) + fsahtw(ji,jj,jk)                       &
+                           &                          * (  wslpi(ji,jj,jk) * wslpi(ji,jj,jk)   &
+                           &                             + wslpj(ji,jj,jk) * wslpj(ji,jj,jk)  )
                      END DO
                   END DO
                END DO
-            ELSE                         ! no rotation but key_ldfslp defined
-               zwt(:,:,:) = avt(:,:,:)
             ENDIF
-#else
-            ! No isopycnal diffusion
-            zwt(:,:,:) = avt(:,:,:)           
 #endif
-            ! Diagonal, inferior, superior  (including the bottom boundary condition via avt masked)
+            ! Diagonal, lower (i), upper (s)  (including the bottom boundary condition since avt is masked)
             DO jk = 1, jpkm1
                DO jj = 2, jpjm1
                   DO ji = fs_2, fs_jpim1   ! vector opt.
-                     ze3ta =  ( 1. - znvvl ) +        znvvl   * fse3t_a(ji,jj,jk)   ! after scale factor at T-point
-                     ze3tn =         znvvl   + ( 1. - znvvl ) * fse3t_n(ji,jj,jk)   ! now   scale factor at T-point
+                     ze3ta =  ( 1. - r_vvl ) +        r_vvl   * fse3t_a(ji,jj,jk)   ! after scale factor at T-point
+                     ze3tn =         r_vvl   + ( 1. - r_vvl ) * fse3t_n(ji,jj,jk)   ! now   scale factor at T-point
                      zwi(ji,jj,jk) = - p2dt(jk) * zwt(ji,jj,jk  ) / ( ze3tn * fse3w(ji,jj,jk  ) )
                      zws(ji,jj,jk) = - p2dt(jk) * zwt(ji,jj,jk+1) / ( ze3tn * fse3w(ji,jj,jk+1) )
@@ -189,5 +157,26 @@
                END DO
             END DO
+            !
+            !! Matrix inversion from the first level
+            !!----------------------------------------------------------------------
+            !   solve m.x = y  where m is a tri diagonal matrix ( jpk*jpk )
+            !
+            !        ( zwd1 zws1   0    0    0  )( zwx1 ) ( zwy1 )
+            !        ( zwi2 zwd2 zws2   0    0  )( zwx2 ) ( zwy2 )
+            !        (  0   zwi3 zwd3 zws3   0  )( zwx3 )=( zwy3 )
+            !        (        ...               )( ...  ) ( ...  )
+            !        (  0    0    0   zwik zwdk )( zwxk ) ( zwyk )
+            !
+            !   m is decomposed in the product of an upper and lower triangular matrix.
+            !   The 3 diagonal terms are in 3d arrays: zwd, zws, zwi.
+            !   Suffices i,s and d indicate "inferior" (below diagonal), diagonal
+            !   and "superior" (above diagonal) components of the tridiagonal system.
+            !   The solution will be in the 4d array pta.
+            !   The 3d array zwt is used as a work space array.
+            !   En route to the solution pta is used a to evaluate the rhs and then 
+            !   used as a work space array: its value is modified.
+            !
             ! first recurrence:   Tk = Dk - Ik Sk-1 / Tk-1   (increasing k)
+            ! done once for all passive tracers (so included in the IF instruction)
             DO jj = 2, jpjm1
                DO ji = fs_2, fs_jpim1
@@ -203,79 +192,11 @@
             END DO
             !
-         ELSE IF( ( cdtype == 'TRA' .AND. jn == jp_sal ) .OR. ( cdtype == 'TRC' .AND. jn == 1 ) ) THEN
-#if defined key_ldfslp
-            IF( ln_traldf_grif ) THEN
-               DO jk = 2, jpkm1
-                  DO jj = 2, jpjm1
-                     DO ji = fs_2, fs_jpim1   ! vector opt.
-                        zavi = ah_wslp2(ji,jj,jk)                ! vertical mixing coef. due to lateral mixing
-                        ! zavi = fsahtw(ji,jj,jk) * wslp2(ji,jj,jk)         ! vertical mixing coef. due to lateral mixing
-                        zwt(ji,jj,jk) = fsavs(ji,jj,jk) + zavi              ! zwt=avt+zavi (total vertical mixing coef. on temperature)
-                     END DO
-                  END DO
-               END DO
-            ELSE IF( l_traldf_rot ) THEN
-               DO jk = 2, jpkm1
-                  DO jj = 2, jpjm1
-                     DO ji = fs_2, fs_jpim1   ! vector opt.
-                        zavi = fsahtw(ji,jj,jk)                       &   ! vertical mixing coef. due to lateral mixing
-                           & * (  wslpi(ji,jj,jk) * wslpi(ji,jj,jk)   &
-                           &    + wslpj(ji,jj,jk) * wslpj(ji,jj,jk)  )
-                        zwt(ji,jj,jk) = fsavs(ji,jj,jk) + zavi              ! zwt=avt+zavi (total vertical mixing coef. on salinity)
-                     END DO
-                  END DO
-               END DO
-            ELSE                         ! no rotation but key_ldfslp defined
-               zwt(:,:,:) = fsavs(:,:,:)
-            ENDIF
-#else
-            ! No isopycnal diffusion
-            zwt(:,:,:) = fsavs(:,:,:)           
-#endif
-            ! Diagonal, inferior, superior  (including the bottom boundary condition via avt masked)
-            DO jk = 1, jpkm1
-               DO jj = 2, jpjm1
-                  DO ji = fs_2, fs_jpim1   ! vector opt.
-                     ze3ta =  ( 1. - znvvl ) +        znvvl   * fse3t_a(ji,jj,jk)   ! after scale factor at T-point
-                     ze3tn =         znvvl   + ( 1. - znvvl ) * fse3t_n(ji,jj,jk)   ! now   scale factor at T-point
-                     zwi(ji,jj,jk) = - p2dt(jk) * zwt(ji,jj,jk  ) / ( ze3tn * fse3w(ji,jj,jk  ) )
-                     zws(ji,jj,jk) = - p2dt(jk) * zwt(ji,jj,jk+1) / ( ze3tn * fse3w(ji,jj,jk+1) )
-                     zwd(ji,jj,jk) = ze3ta - zwi(ji,jj,jk) - zws(ji,jj,jk)
-                 END DO
-               END DO
-            END DO
-            ! Surface boudary conditions
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                 ze3ta = ( 1. - znvvl ) +  znvvl * fse3t_a(ji,jj,1)    ! after scale factor at T-point
-                 zwi(ji,jj,1) = 0._wp
-                 zwd(ji,jj,1) = ze3ta - zws(ji,jj,1)
-               END DO
-            END DO
-            !
-            ! first recurrence:   Tk = Dk - Ik Sk-1 / Tk-1   (increasing k)
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1
-                  zwt(ji,jj,1) = zwd(ji,jj,1)
-               END DO
-            END DO
-            DO jk = 2, jpkm1
-               DO jj = 2, jpjm1
-                  DO ji = fs_2, fs_jpim1
-                    zwt(ji,jj,jk) = zwd(ji,jj,jk) - zwi(ji,jj,jk) * zws(ji,jj,jk-1) / zwt(ji,jj,jk-1)
-                  END DO
-               END DO
-            END DO
-            !
          END IF 
-
-         ! II.1. Vertical diffusion on tracer
-         ! ---------------------------
-         
+         !         
          ! second recurrence:    Zk = Yk - Ik / Tk-1  Zk-1
          DO jj = 2, jpjm1
             DO ji = fs_2, fs_jpim1
-               ze3tb = ( 1. - znvvl ) + znvvl * fse3t_b(ji,jj,1)
-               ze3tn = ( 1. - znvvl ) + znvvl * fse3t(ji,jj,1)
+               ze3tb = ( 1. - r_vvl ) + r_vvl * fse3t_b(ji,jj,1)
+               ze3tn = ( 1. - r_vvl ) + r_vvl * fse3t(ji,jj,1)
                pta(ji,jj,1,jn) = ze3tb * ptb(ji,jj,1,jn) + p2dt(1) * ze3tn * pta(ji,jj,1,jn)
             END DO
@@ -284,6 +205,6 @@
             DO jj = 2, jpjm1
                DO ji = fs_2, fs_jpim1
-                  ze3tb = ( 1. - znvvl ) + znvvl * fse3t_b(ji,jj,jk)
-                  ze3tn = ( 1. - znvvl ) + znvvl * fse3t  (ji,jj,jk)
+                  ze3tb = ( 1. - r_vvl ) + r_vvl * fse3t_b(ji,jj,jk)
+                  ze3tn = ( 1. - r_vvl ) + r_vvl * fse3t  (ji,jj,jk)
                   zrhs = ze3tb * ptb(ji,jj,jk,jn) + p2dt(jk) * ze3tn * pta(ji,jj,jk,jn)   ! zrhs=right hand side 
                   pta(ji,jj,jk,jn) = zrhs - zwi(ji,jj,jk) / zwt(ji,jj,jk-1) * pta(ji,jj,jk-1,jn)
@@ -292,5 +213,5 @@
          END DO
 
-         ! third recurrence:    Xk = (Zk - Sk Xk+1 ) / Tk
+         ! third recurrence:    Xk = (Zk - Sk Xk+1 ) / Tk   (result is the after tracer)
          DO jj = 2, jpjm1
             DO ji = fs_2, fs_jpim1
@@ -306,6 +227,7 @@
             END DO
          END DO
-         !
-      END DO
+         !                                            ! ================= !
+      END DO                                          !  end tracer loop  !
+      !                                               ! ================= !
       !
       IF(wrk_not_released(3, 1,2))THEN
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/README
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/README	(revision 2677)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/README	(revision 2678)
@@ -1,5 +1,5 @@
 usage of SETTE package:
 
-principal script is sette.sh (usage: ./sette.sh)
+principal script is sette.sh (usage: ./sette.sh) 
 
 VERY IMPORTANT : for a verbose debug do:
@@ -18,19 +18,24 @@
 	       set_namelist : to set namelist values 
 			(example : to set 75 time steps for one test : namelist nn_itend 75)
-			(  	 : to change cn_icerst_in name : namelist_ice cn_icerst_in  \"test_00101231_restart_icemod.nc\")
-			(  	 : to activate control print : namelist ln_ctl \".false.\" )
-               fcm_job.sh needs input: input_CONFIG_NAME and TOTAL NUMBER OF PROCS used
-			(for example if you compile ORCA2_LIM with nproci=2 and nprocj=2 ===> ./fcm_job input_ORCA2_LIM.cfg 4)
+			(        : to change cn_icerst_in name : namelist_ice cn_icerst_in  \"test_00101231_restart_icemod\")
+			(  	 : to activate control print : namelist ln_ctl false )
+               fcm_job.sh needs input: input_CONFIG_NAME TOTAL_NUMBER_OF_PROCS_used TEST_NAME
+			(for example if you compile ORCA2_LIM with nproci=2 and nprocj=2 
+			and only run short test ===> ./fcm_job input_ORCA2_LIM.cfg 4 SHORT)
  in param.cfg :
-               EXE_DIR     : directory in which execute jobs (by default CONFIG_DIR)
-               FORCING_DIR : directory where to get input tar file
-               INPUT_DIR   : directory in which store input files
-               TMPDIR      : temporary directory NEEDED ONLY FOR IBM machines (put EXP00 directory)
-               OUTPUT_DIR  : directory in which store output files
+               EXE_DIR     	   : directory in which job s executed (by default CONFIG_DIR)
+               FORCING_DIR 	   : directory in which will be found input.tar file (same name in input_CONFIG_NAME.cfg)
+               INPUT_DIR   	   : directory in which store input files
+               TMPDIR      	   : temporary directory NEEDED ONLY FOR IBM machines (put EXP00 directory)
+               OUTPUT_DIR  	   : directory in which store output files
+	       NEMO_VALIDATION_DIR : directory in which create NEMO_VALIDATION tree, and store restart, solver.stat and ocean.output files in
+      			             tree NEMO_VALIDATION_DIR/WCONFIG_NAME/WCOMPILER_NAME/TEST_NAME/REVISION_NUMBER(or DATE)
  in fcm_job.sh :
                IMPORTANT : control that name of tar file in FORCING directory
                is the same of that in input_REF_CONFIG.cfg, if not change one.
                change in "RUN OPA" part the command line (some examples are already written)
-
+	       TEST_NAME by convention is LONG: 10 days run or SHORT: 5 days run
+	       so NEMO_VALIDATION tree is coherent,
+	       but user can choise a TEST_NAME that represent his own test.
 
 NOTE:
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/all_functions.sh
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/all_functions.sh	(revision 2677)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/all_functions.sh	(revision 2678)
@@ -49,5 +49,5 @@
 #
 #  $ ./set_namelist.sh namelist          nn_itend        75
-#  $ ./set_namelist.sh namelist_ice_lim2 cn_icerst_in  \"00101231_restart_icemod\"
+#  $ ./set_namelist.sh namelist_ice_lim2 cn_icerst_in  \"00101231_restart_ice\"
 #
 #
@@ -86,11 +86,6 @@
 	fi
 	unset minargcount
-	if [  -f ${SETTE_DIR}/output.sette ] ; then
-        	echo "file output already present. Append comments"
-                echo "`ls ${SETTE_DIR}/output.sette`"
-        else
-                echo "file output not present"
+	if [  ! -f ${SETTE_DIR}/output.sette ] ; then
                 touch ${SETTE_DIR}/output.sette
-                echo "`ls ${SETTE_DIR}/output.sette`"
         fi
 
@@ -99,4 +94,14 @@
       
 	VAR_NAME=$( supergrep $2 ${INPUT_DIR}/$1 )
+	if [ ${#VAR_NAME} -eq 0 ] 
+	then
+		echo "doing \"set_namelist $@\". "
+		echo "variable: \"$2\" is empty"
+		echo "control that variable $2 is in \"${INPUT_DIR}/$1\" "
+		echo "exit"
+		echo "error in executing script : set_namelist $@" >> ${SETTE_DIR}/output.sette
+		echo "....." >> ${SETTE_DIR}/output.sette
+		exit 1
+	fi
         sed -e "s/${VAR_NAME}.*/${VAR_NAME}/" ${INPUT_DIR}/$1 > ${INPUT_DIR}/$1.tmp
         mv ${INPUT_DIR}/$1.tmp ${INPUT_DIR}/$1
@@ -104,10 +109,4 @@
         mv ${INPUT_DIR}/$1.tmp ${INPUT_DIR}/$1
 
-	if [  -f ${INPUT_DIR}/$1 ] ; then
-        	echo "namelist not empty: ok"
-        else
-		echo "some problems in sed namelist: exit"
-		exit 1
-        fi
         echo "finished script : set_namelist $@" >> ${SETTE_DIR}/output.sette
         echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/fcm_job.sh
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/fcm_job.sh	(revision 2677)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/fcm_job.sh	(revision 2678)
@@ -25,5 +25,5 @@
 # ::
 #
-#  $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC
+#  $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME
 #
 #
@@ -34,4 +34,17 @@
 # Simple job for SET TESTS for NEMO (SETTE)
 #
+# this job creates tree of validation in NEMO_VALIDATION_DIR as follows : 
+#
+# NEMO_VALIDATION_DIR/WCONFIG_NAME/WCOMPILER_NAME/TEST_NAME/REVISION_NUMBER(or DATE)
+# 
+# NEMO_VALIDATION_DIR		: is choosen in param.cfg
+#
+# WCONFIG_NAME			: set by makenemo at the moment of compilation
+#
+# WCOMPILER_NAME		: set by makenemo at the moment of compilation
+#
+# TEST_NAME			: convention is LONG=10 days run, SHORT=5 days run
+#
+# REVISION_NUMBER(or DATE)	: revision number by svn info, if problems with svn date is taken
 #
 # EXAMPLES
@@ -40,11 +53,11 @@
 # ::
 #
-#  $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME       NUMBER_PROC
-#
-#  run a job of config GYRE with 1 processor
-#  $ ./fcm_job.sh input_GYRE.cfg                     1
-#
-#  run a job of config ORCA2_LIM_PISCES with 8 processors
-#  $ ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg         8
+#  $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME
+#
+#  run a job of config GYRE with 1 processor test REPRODUCTINILITY
+#  $ ./fcm_job.sh input_GYRE.cfg 1 SHORT
+#
+#  run a job of config ORCA2_LIM_PISCES	with 8 processors test RESTARTABILITY
+#  $ ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8 LONG
 #
 #
@@ -67,9 +80,9 @@
 #
 
-usage=" Usage : ./fcm_job.sh input_CONFIG_NAME.cfg  NUMBER_OF_PROCS"
-usage=" example : ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8"
-
-
-minargcount=2
+usage=" Usage : ./fcm_job.sh input_CONFIG_NAME.cfg  NUMBER_OF_PROCS TEST_NAME"
+usage=" example : ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8 RUN"
+
+
+minargcount=3
         if [ ${#} -lt ${minargcount} ]
         then
@@ -80,11 +93,6 @@
         fi
         unset minargcount
-	if [  -f ${SETTE_DIR}/output.sette ] ; then
-	        echo "file output already present. Append comments"
- 	        echo "`ls ${SETTE_DIR}/output.sette`"
-	else
-	        echo "file output not present"
+	if [ ! -f ${SETTE_DIR}/output.sette ] ; then
 	        touch ${SETTE_DIR}/output.sette
-	        echo "`ls ${SETTE_DIR}/output.sette`"
 	fi
        
@@ -96,5 +104,5 @@
 echo "`more ../CONFIG/${NEW_CONF}/cpp_${NEW_CONF}.fcm`" >> ${SETTE_DIR}/output.sette
 echo "" >> ${SETTE_DIR}/output.sette
-echo "executing script : fcm_job $@" >> ${SETTE_DIR}/output.sette
+echo "executing script : \"fcm_job $@\" " >> ${SETTE_DIR}/output.sette
 echo "            " >> ${SETTE_DIR}/output.sette
 
@@ -107,5 +115,13 @@
 	echo "            " >> ${SETTE_DIR}/output.sette
 	cp ${FORCING_DIR}/${tar_file} ${INPUT_DIR}/.
-	cd ${INPUT_DIR} ; tar xvof ${INPUT_DIR}/*.tar ; gunzip -f *gz
+	if [ ! -f ${INPUT_DIR}/${tar_file} ] ; then 
+		echo "PROBLEM during copy of tar file" >> ${SETTE_DIR}/output.sette
+		echo "tar file IS NOT present in ${INPUT_DIR} directory " >> ${SETTE_DIR}/output.sette
+		echo "            " >> ${SETTE_DIR}/output.sette
+		echo "PROBLEM during copy of tar file" 
+		exit 1
+	else  
+		cd ${INPUT_DIR} ; tar xvof ${INPUT_DIR}/*.tar ; gunzip -f *gz
+	fi
 fi 
 
@@ -134,4 +150,5 @@
     then
     echo "executable opa does not exist"
+    echo "executable opa does not exist, exit"  >> ${SETTE_DIR}/output.sette
     exit 1
 fi
@@ -165,6 +182,4 @@
 
 ################################################################
-
-################################################################
 # SAVE OUTPUT, DEBUG & RESTART FILES
 echo "saving ocean & ice output, debug & restart files" >> ${SETTE_DIR}/output.sette
@@ -174,9 +189,63 @@
 [ -f *solver.stat ] && mv *solver.stat ${OUTPUT_DIR}/.
 [ -n "$(ls *_grid_*)" ] && mv *_grid_*.nc ${OUTPUT_DIR}/.
-[ -n "$(ls *restart*)" ] && cp *restart*.nc ${OUTPUT_DIR}/.
+[ -n "$(ls *_ptrc_*)" ] && mv *_ptrc_*.nc ${OUTPUT_DIR}/.
+[ -n "$(ls *_diad_*)" ] && mv *_diad_*.nc ${OUTPUT_DIR}/.
+[ -n "`ls *restart*`" ] && cp *restart*.nc ${OUTPUT_DIR}/.
 [ -f ice_evolu ] && mv ice_evolu ${OUTPUT_DIR}/.
-[ -n "$(ls *icemod*)" ] && mv *icemod* ${OUTPUT_DIR}/.
+[ -n "`ls *icemod*`" ] && mv *icemod* ${OUTPUT_DIR}/.
 #- Save ftrace file
 [ -f ftrace.out* ] && cp ftrace.out* ${OUTPUT_DIR}/.
 ################################################################
 
+################################################################
+# SAVE IN NEMO_VALIDATION tree
+export LANG=en_US 
+cd ${CONFIG_DIR}
+cd ../
+REVISION_NB=`svn info | grep -i "Revision:" | sed -e "s/ //" | cut -d ":" -f 2`
+if [ ${#REVISION_NB} -eq 0 ]
+then
+	echo "some problems with svn info command"
+	echo "some problems with svn info command" >> ${SETTE_DIR}/output.sette
+	${REVISION_NB}=`date +%Y%m%d`
+	echo "put in ${REVISION_NB} date"
+	echo "put in ${REVISION_NB} date" >> ${SETTE_DIR}/output.sette
+else
+echo "value of revision number of NEMOGCM: ${REVISION_NB}"
+fi
+cd ${NEMO_VALIDATION_DIR}
+export TEST_NAME=$3
+`mkdir -p ${NEMO_VALIDATION_DIR}/W${NEW_CONF}/${CMP_NAM}/${REVISION_NB}/${TEST_NAME}`
+NEMO_VALID=${NEMO_VALIDATION_DIR}/W${NEW_CONF}/${CMP_NAM}/${REVISION_NB}/${TEST_NAME}
+if [ -d ${NEMO_VALID} ] ; then
+	echo "created ${NEMO_VALID} directory"   >> ${SETTE_DIR}/output.sette
+else 
+	echo "problems in creating ${NEMO_VALID} directory"   >> ${SETTE_DIR}/output.sette
+	echo "EXIT,"
+	exit 1
+fi
+[ -f ${OUTPUT_DIR}/*ocean.output ] && mv ${OUTPUT_DIR}/*ocean.output ${NEMO_VALID}/.
+[ -f ${OUTPUT_DIR}/*solver.stat ] && mv ${OUTPUT_DIR}/*solver.stat ${NEMO_VALID}/.
+[ -n "`ls ${OUTPUT_DIR}/*restart*`" ] && mv ${OUTPUT_DIR}/*restart* ${NEMO_VALID}/.
+if [ -n "$(ls ${NEMO_VALID}/*solver*)" ] ; then
+	echo "moved solver.stat in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
+	echo "moved solver.stat in ${NEMO_VALID} directory"  
+else
+	echo "problem in looking for solver.stat file in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
+	echo "solver.stat IS NOT in ${NEMO_VALID} directory" 
+fi
+if [ -n "$(ls ${NEMO_VALID}/*ocean.output*)" ] ; then
+	echo "moved ocean.output in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
+	echo "moved ocean.output in ${NEMO_VALID} directory" 
+else
+	echo "problem in looking for ocean.output file in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
+	echo "ocean.output IS NOT in ${NEMO_VALID} directory" 
+fi
+if [ -n "`ls ${NEMO_VALID}/*restart*`" ] ; then
+	echo "moved restart files in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
+	echo "moved restart files in ${NEMO_VALID} directory" 
+else
+	echo "problem in looking for restart files in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
+	echo "restart files ARE NOT in ${NEMO_VALID} directory" 
+fi
+################################################################
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/param.cfg
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/param.cfg	(revision 2677)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/param.cfg	(revision 2678)
@@ -1,2 +1,3 @@
+#- execution directory 
 EXE_DIR=${CONFIG_DIR}     
 #- forcing files storing 
@@ -5,5 +6,7 @@
 INPUT_DIR=${CONFIG_DIR}/${NEW_CONF}/EXP00
 #- only for IBM
-#- TMPDIR=${CONFIG_DIR}/${NEW_CONF}/EXP00
+# TMPDIR=${CONFIG_DIR}/${NEW_CONF}/EXP00
 #- output files storing 
-OUTPUT_DIR=${CONFIG_DIR}/${NEW_CONF}/EXP00/VALIDATION
+OUTPUT_DIR=${CONFIG_DIR}/${NEW_CONF}/EXP00/OUTPUT
+#- VALIDATION files storing 
+NEMO_VALIDATION_DIR=~/NEMO_VALIDATION
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/sette.sh
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/sette.sh	(revision 2677)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/sette.sh	(revision 2678)
@@ -47,15 +47,15 @@
 #   Executing directory (EXE_DIR)
 #
-#   Forcing files storing (FORCING_DIR)
+
 #
 #   Input files storing (INPUT_DIR)
 #
 #   Temporary directory (if needed) (TMPDIR)
-#
-#   Output files storing (OUTPUT_DIR)
+# 
+#   Validation directory (NEMO_VALIDATION_DIR)
 #
 #   (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 added here)
+#  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
@@ -63,7 +63,13 @@
 #  fcm_job.sh 
 #
-#   runs job and saves output files (ocean.output, solver.stat, grid_files, restart, ice_evolu, ftrace.out)
+#   runs job and saves output files (grid_files, restarts, ice_evolu, ftrace.out)
+#
+#   and it creates tree of VALIDATION, in which there are restart files, solver.stat and ocean.output
+#
+#   Tree of VALIDATION is:
+#
+#   NEMO_VALIDATION_DIR/WCONFIG_NAME/WCOMPILER_NAME/TEST_NAME/REVISION_NUMBER(or DATE)
 # 
-#   (note this job needs to have an input_CONFIG.cfg in which found tar input file)
+#   (note this job needs to have an input_CONFIG.cfg in which can be found input tar file)
 #
 #   (note other files can be saved adding at the end of fcm_job list of saved files)
@@ -71,9 +77,5 @@
 #  NOTE: if job is not launched for some problems you have executable ready in ${CONFIG_NAME}/EXP00 directory
 #
-#  at the end the directory ${CONFIG_NAME}/EXP00/VALIDATION is created
-#
-#  and output files, solver.stat, ocean.output are put in ${CONFIG_NAME}/EXP00/VALIDATION directory
-#
-#  and restart files and changed namelists are leaved in ${CONFIG_NAME}/EXP00 directory
+#  NOTE: the changed namelists are leaved in ${CONFIG_NAME}/EXP00 directory
 # 
 #  in ${SETTE_DIR} is created output.sette with the echo of commands run
@@ -108,24 +110,223 @@
 #-
 #
+
 SETTE_DIR=/PATH/OF/SETTE
 
-cd ${SETTE_DIR}
-. ../CONFIG/makenemo -m ifort_linux -n GYRE_1_1 -r GYRE
-cd ${SETTE_DIR}
-. param.cfg
-. all_functions.sh
-set_namelist namelist nn_it000 1
-set_namelist namelist nn_itend 75
-cd ${SETTE_DIR}
-. ./fcm_job.sh input_GYRE.cfg 1
-
-cd ${SETTE_DIR}
-. ../CONFIG/makenemo -n ORCA2_LIM_1_2 -r ORCA2_LIM add_key "key_mpp_mpi key_nproci=1 key_nprocj=2"
-cd ${SETTE_DIR}
-. param.cfg
-. all_functions.sh
-set_namelist namelist nn_it000 1
-set_namelist namelist nn_itend 75
-cd ${SETTE_DIR}
-. ./fcm_job.sh input_ORCA2_LIM.cfg 2
-
+## NBTEST=6
+## echo "TOTAL NUMBER OF TEST" ${NBTEST}
+## for (( config=2; config<=${NBTEST}; config++ ))
+
+for config in 1 2 3 4 5 6 
+do
+
+if [ ${config} -eq 1 ] ;  then
+    # Restartability tests for GYRE_LOBSTER
+    cd ${SETTE_DIR}
+    . ../CONFIG/makenemo -m PW6MONO_VARGAS -n GYRELOB_LONG -r GYRE_LOBSTER del_key "key_diatrc"
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    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_top ln_trcrad .false.
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh input_GYRE.cfg 1 LONG
+    
+    cd ${SETTE_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 cn_ocerst_in \"GYRELOB_LONG_00000060_restart\"
+    set_namelist namelist_top ln_trcrad .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 1 SHORT
+fi
+
+if [ ${config} -eq 2 ] ;  then
+    # Restartability tests for ORCA2_LIM_PISCES
+    cd ${SETTE_DIR}
+    . ../CONFIG/makenemo -m PW6MONO_VARGAS -n ORCA2LIMPIS_LONG -r ORCA2_LIM_PISCES del_key "key_dtatrc key_diatrc"
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    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_top ln_trcrad .false.
+    # put ln_pisdmp, ln_dustfer, ln_river, ln_ndepo, ln_sedinput to false
+    # if not you need input files, and for tests is not necessary
+    set_namelist namelist_pisces ln_pisdmp .false.
+    set_namelist namelist_pisces ln_dustfer .false.
+    set_namelist namelist_pisces ln_river .false.
+    set_namelist namelist_pisces ln_ndepo .false.
+    set_namelist namelist_pisces ln_sedinput .false.
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 1 LONG
+    
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    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 cn_ocerst_in \"O2LP_LONG_00000075_restart\"
+    set_namelist namelist_ice_lim2 cn_icerst_in \"O2LP_LONG_00000075_restart_ice\"
+    set_namelist namelist_top ln_trcrad .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_pisdmp, ln_dustfer, ln_river, ln_ndepo, ln_sedinput
+    # if not you need input files, and for tests is not necessary
+    set_namelist namelist_pisces ln_pisdmp .false.
+    set_namelist namelist_pisces ln_dustfer .false.
+    set_namelist namelist_pisces ln_river .false.
+    set_namelist namelist_pisces ln_ndepo .false.
+    set_namelist namelist_pisces ln_sedinput .false.
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 1 SHORT
+fi
+
+if [ ${config} -eq 3 ] ;  then
+    ## Restartability tests for POMME 
+    cd ${SETTE_DIR}
+    . ../CONFIG/makenemo -m PW6MONO_VARGAS -n POMME_LONG -r POMME
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    set_namelist namelist cn_exp \"POMME_LONG\"
+    set_namelist namelist nn_it000 1
+    set_namelist namelist nn_itend 600
+    set_namelist namelist nn_stock 300
+    set_namelist namelist nn_write 300
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh input_POMME.cfg 1 LONG
+    cd ${CONFIG_DIR}
+    `mv ${NEW_CONF}/EXP00/restart.obc.output ${NEW_CONF}/EXP00/restart.obc`
+    
+    cd ${SETTE_DIR}
+    set_namelist namelist cn_exp \"POMME_SHORT\"
+    set_namelist namelist nn_it000 301
+    set_namelist namelist nn_itend 600
+    set_namelist namelist nn_stock 300
+    set_namelist namelist ln_rstart .true.
+    set_namelist namelist nn_rstctl 2
+    set_namelist namelist nn_write 300
+    set_namelist namelist cn_ocerst_in \"POMME_LONG_00000300_restart\"
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh input_POMME.cfg 1 SHORT
+fi
+
+if [ ${config} -eq 4 ] ;  then
+    ## Repropducilibity tests for GYRE_LOBSTER
+    cd ${SETTE_DIR}
+    . ../CONFIG/makenemo -m PW6_VARGAS -n GYRELOB_1_4 -r GYRE_LOBSTER add_key "key_mpp_mpi key_mpp_rep key_nproci=1 key_nprocj=4" del_key "key_vectopt_loop key_diatrc"
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    set_namelist namelist nn_it000 1
+    set_namelist namelist nn_itend 75
+    set_namelist namelist nn_fwb 0
+    set_namelist namelist nn_bench 0
+    set_namelist namelist ln_ctl .false.
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh input_GYRE.cfg 4 SHORT
+    
+    cd ${SETTE_DIR}
+    . ../CONFIG/makenemo -m PW6_VARGAS -n GYRELOB_2_2 -r GYRE_LOBSTER add_key "key_mpp_rep key_mpp_mpi key_nproci=2 key_nprocj=2" del_key "key_vectopt_loop key_diatrc"
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    set_namelist namelist nn_it000 1
+    set_namelist namelist nn_itend 75
+    set_namelist namelist nn_fwb 0
+    set_namelist namelist nn_bench 0
+    set_namelist namelist ln_ctl .false.
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh input_GYRE.cfg 4 SHORT
+fi
+
+if [ ${config} -eq 5 ] ;  then
+    ## Repropducilibity tests for ORCA2_LIM_PISCES
+    cd ${SETTE_DIR}
+    . ../CONFIG/makenemo -m PW6_VARGAS -n ORCA2LIMPIS_4_4 -r ORCA2_LIM_PISCES add_key "key_mpp_mpi key_mpp_rep key_nproci=4 key_nprocj=4" del_key "key_vectopt_loop key_dtatrc key_diatrc" 
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    set_namelist namelist nn_it000 1
+    set_namelist namelist nn_itend 75
+    set_namelist namelist nn_fwb 0
+    set_namelist namelist nn_bench 0
+    set_namelist namelist ln_ctl .false.
+    # put ln_pisdmp, ln_dustfer, ln_river, ln_ndepo, ln_sedinput to false
+    # if not you need input files, and for tests is not necessary
+    set_namelist namelist_pisces ln_pisdmp .false.
+    set_namelist namelist_pisces ln_dustfer .false.
+    set_namelist namelist_pisces ln_river .false.
+    set_namelist namelist_pisces ln_ndepo .false.
+    set_namelist namelist_pisces ln_sedinput .false.
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 16 SHORT
+
+    cd ${SETTE_DIR}
+    . ../CONFIG/makenemo -m PW6_VARGAS -n ORCA2LIMPIS_2_8 -r ORCA2_LIM_PISCES add_key "key_mpp_rep key_mpp_mpi key_nproci=2 key_nprocj=8" del_key "key_vectopt_loop key_dtatrc key_diatrc"
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    set_namelist namelist nn_it000 1
+    set_namelist namelist nn_itend 75
+    set_namelist namelist nn_fwb 0
+    set_namelist namelist nn_bench 0
+    set_namelist namelist ln_ctl .false.
+    # put ln_pisdmp, ln_dustfer, ln_river, ln_ndepo, ln_sedinput to false
+    # if not you need input files, and for tests is not necessary
+    set_namelist namelist_pisces ln_pisdmp .false.
+    set_namelist namelist_pisces ln_dustfer .false.
+    set_namelist namelist_pisces ln_river .false.
+    set_namelist namelist_pisces ln_ndepo .false.
+    set_namelist namelist_pisces ln_sedinput .false.
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 16 SHORT
+fi
+
+if [ ${config} -eq 6 ] ;  then
+    ## Reproductibility tests for POMME 
+    cd ${SETTE_DIR}
+    . ../CONFIG/makenemo -m PW6_VARGAS -n POMME_1_4 -r POMME add_key "key_mpp_mpi key_mpp_rep key_nproci=1 key_nprocj=4"
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    set_namelist namelist nn_it000 1
+    set_namelist namelist nn_itend 300
+    set_namelist namelist nn_fwb 0
+    set_namelist namelist nn_bench 0
+    set_namelist namelist ln_ctl .false.
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh input_POMME.cfg 4 SHORT
+    
+    cd ${SETTE_DIR}
+    . ../CONFIG/makenemo -m PW6_VARGAS -n POMME_2_2 -r POMME add_key "key_mpp_mpi key_mpp_rep key_nproci=2 key_nprocj=2" 
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    set_namelist namelist nn_it000 1
+    set_namelist namelist nn_itend 300
+    set_namelist namelist nn_fwb 0
+    set_namelist namelist nn_bench 0
+    set_namelist namelist ln_ctl .false.
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh input_POMME.cfg 4 SHORT
+fi
+
+done
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/sette_beginner.sh
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/sette_beginner.sh	(revision 2678)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/sette_beginner.sh	(revision 2678)
@@ -0,0 +1,59 @@
+#!/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_beginner.sh
+# ===================
+#
+# ----------------------------------------------
+# Set of tests for NEMO for beginners
+# ----------------------------------------------
+#
+# SYNOPSIS
+# ========
+#
+# ::
+#
+#  $ ./sette_beginner.sh
+#
+# DESCRIPTION
+# ===========
+# First simple example of how to use SETTE: create GYRE_SHORT configuration, compile it with 1 proc, and test it for a SHORT test: 5days
+#-
+#
+SETTE_DIR=/PATH/OF/SETTE
+# Run for GYRE CONFIG
+# small test to start
+# compile GYRE configuration with gfortran_osx compiler run with 1 proc, by default in cpp_GYRE.fcm file : key_nproci=1 key_nprocj=1
+cd ${SETTE_DIR}
+. ../CONFIG/makenemo -m gfortran_osx -n GYRE_SHORT -r GYRE
+cd ${SETTE_DIR}
+. param.cfg 
+. all_functions.sh
+# setting namelist parameters
+# experience name
+set_namelist namelist cn_exp \"GYRE_SHORT\"
+# first time step
+set_namelist namelist nn_it000 1
+# last time step
+set_namelist namelist nn_itend 120
+# frequency of creation of a restart file
+set_namelist namelist nn_stock 60
+cd ${SETTE_DIR}
+# run job, with 1 processor, test named SHORT (= 60 time steps)
+. ./fcm_job.sh input_GYRE.cfg 1 SHORT
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/TOOLS/COMPILE/Fadd_keys.sh
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/TOOLS/COMPILE/Fadd_keys.sh	(revision 2677)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/TOOLS/COMPILE/Fadd_keys.sh	(revision 2678)
@@ -66,5 +66,5 @@
  for i in ${list_add_key} ; do
 	if [ "$(echo ${i} | grep -c key_nproc )" -ne 0 ] ; then
-		sed -e "s/key_nproc[ij]=.* //"  ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm >  ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp
+		sed -e "s/key_nproc[ij]=.[0-9]* //"  ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm >  ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp
        	 	mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp   ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm
 		echo " "
