Index: /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/EXP00/namelist_cfg
===================================================================
--- /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/EXP00/namelist_cfg	(revision 6913)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/EXP00/namelist_cfg	(revision 6914)
@@ -2,21 +2,22 @@
 !! NEMO/OPA  Configuration namelist : used to overwrite defaults values defined in SHARED/namelist_ref
 !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!
 !-----------------------------------------------------------------------
 &namusr_def    !   LOCK_EXCHANGE user defined namelist
 !-----------------------------------------------------------------------
-   ln_zco      =  .true.   ! z-coordinate flag
    rn_dx       =    500.   ! horizontal resolution in meters
    rn_dz       =      1.   ! vertical   resolution in meters
 /
+!
 !-----------------------------------------------------------------------
 &namrun        !   parameters of the run
 !-----------------------------------------------------------------------
    nn_no       =       0   !  job number (no more used...)
-   cn_exp      =   "LOCK-FCT2-flux-ubs-ens"  !  experience name
+   cn_exp      =   "LOCK_FCT2_flux_ubs"  !  experience name
    nn_it000    =       1   !  first time step
-   nn_itend    =   12240   ! for 34h of simulation   
+   nn_itend    =   61200   ! for 17h of simulation  (=61200 time-step)
    nn_istate   =       0   !  output the initial state (1) or not (0)
-   nn_stock    =   12240   !  frequency of creation of a restart file (modulo referenced to 1)
-   nn_write    =   12240   !  frequency of write in the output file   (modulo referenced to nn_it000)
+   nn_stock    =   61200   !  frequency of creation of a restart file (modulo referenced to 1)
+   nn_write    =   61200   !  frequency of write in the output file   (modulo referenced to nn_it000)
 /
 !-----------------------------------------------------------------------
@@ -27,5 +28,5 @@
    ln_write_cfg= .false.   !  (=T) create the domain configuration file
    !
-   cp_cfg      = "lock" !  name of the configuration
+   cp_cfg      = "lock"    !  name of the configuration
    jp_cfg      =      0    !  resolution of the configuration
    ln_use_jattr = .false.  !  use (T) the file attribute: open_ocean_jstart, if present
@@ -81,5 +82,5 @@
 /
 !-----------------------------------------------------------------------
-&nambbl        !   bottom boundary layer scheme
+&nambbl        !   bottom boundary layer scheme                         ("key_trabbl")
 !-----------------------------------------------------------------------
 /
@@ -124,46 +125,8 @@
 !-----------------------------------------------------------------------
 &namtra_ldf    !   lateral diffusion scheme for tracers
-!----------------------------------------------------------------------------------
-   !                       !  Operator type:
-   ln_traldf_lap   =  .true.   !    laplacian operator
+!-----------------------------------------------------------------------
+   !                       !  Operator type:    both false = No lateral diffusion
+   ln_traldf_lap   =  .false.  !    laplacian operator
    ln_traldf_blp   =  .false.  !  bilaplacian operator
-   !                       !  Direction of action:
-   ln_traldf_lev   =  .false.  !  iso-level
-   ln_traldf_hor   =  .true.  !  horizontal (geopotential)
-   ln_traldf_iso   =  .false.   !  iso-neutral (standard operator)
-   ln_traldf_triad =  .false.  !  iso-neutral (triad    operator)
-   !
-   !		       	         !  iso-neutral options:        
-   ln_traldf_msc   =  .true.   !  Method of Stabilizing Correction (both operators)
-   rn_slpmax       =   0.01    !  slope limit                      (both operators)
-   ln_triad_iso    =  .false.  !  pure horizontal mixing in ML              (triad only)
-   rn_sw_triad     =  1        !  =1 switching triad ; =0 all 4 triads used (triad only)
-   ln_botmix_triad =  .false.  !  lateral mixing on bottom                  (triad only)
-   !
-   !                       !  Coefficients:
-   nn_aht_ijk_t    = 0        !  space/time variation of eddy coef
-   !                                !   =-20 (=-30)    read in eddy_diffusivity_2D.nc (..._3D.nc) file
-   !                                !   =  0           constant
-   !                                !   = 10 F(k)      =ldf_c1d
-   !                                !   = 20 F(i,j)    =ldf_c2d
-   !                                !   = 21 F(i,j,t)  =Treguier et al. JPO 1997 formulation
-   !                                !   = 30 F(i,j,k)  =ldf_c2d + ldf_c1d
-   !                                !   = 31 F(i,j,k,t)=F(local velocity)
-   rn_aht_0        = 0.    !  lateral eddy diffusivity   (lap. operator) [m2/s]
-   rn_bht_0        = 0.    !  lateral eddy diffusivity (bilap. operator) [m4/s]
-/
-!----------------------------------------------------------------------------------
-&namtra_ldfeiv !   eddy induced velocity param.
-!----------------------------------------------------------------------------------
-   ln_ldfeiv     =.false.   ! use eddy induced velocity parameterization
-   ln_ldfeiv_dia =.false.   ! diagnose eiv stream function and velocities
-   rn_aeiv_0     = 0.   ! eddy induced velocity coefficient   [m2/s]
-   nn_aei_ijk_t  = 0      ! space/time variation of the eiv coeficient
-   !                                !   =-20 (=-30)    read in eddy_induced_velocity_2D.nc (..._3D.nc) file
-   !                                !   =  0           constant
-   !                                !   = 10 F(k)      =ldf_c1d
-   !                                !   = 20 F(i,j)    =ldf_c2d
-   !                                !   = 21 F(i,j,t)  =Treguier et al. JPO 1997 formulation
-   !                                !   = 30 F(i,j,k)  =ldf_c2d + ldf_c1d
 /
 !-----------------------------------------------------------------------
Index: /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_hgr.F90
===================================================================
--- /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_hgr.F90	(revision 6913)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_hgr.F90	(revision 6914)
@@ -10,7 +10,7 @@
    !!----------------------------------------------------------------------
 
-   !!----------------------------------------------------------------------------------
+   !!----------------------------------------------------------------------
    !!   usr_def_hgr    : initialize the horizontal mesh for LOCK_EXCHANGE configuration
-   !!----------------------------------------------------------------------------------
+   !!----------------------------------------------------------------------
    USE dom_oce  ,  ONLY: nimpp, njmpp       ! ocean space and time domain
    USE par_oce         ! ocean space and time domain
@@ -46,5 +46,5 @@
       !!
       !! ** Method  :   set all intent(out) argument to a proper value
-      !!                LOCK_EXCHANGE configuration : uniform grid spacing (500m)
+      !!                LOCK_EXCHANGE configuration : uniform grid spacing (rn_dx)
       !!                without Coriolis force (f=0)
       !!
Index: /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_istate.F90
===================================================================
--- /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_istate.F90	(revision 6913)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_istate.F90	(revision 6914)
@@ -37,5 +37,5 @@
       !! 
       !! ** Purpose :   Initialization of the dynamics and tracers
-      !!                Here LOCK_EXCHANGE configuration example 
+      !!                Here LOCK_EXCHANGE configuration 
       !!
       !! ** Method  : - set temprature field
@@ -59,5 +59,5 @@
       IF(lwp) WRITE(numout,*) '                 (i.e. a temperature difference of 25 degrees with rn_a0 = 0.2'
       !
-      !  rn_a0 =  2.e-1   !  thermal expension coefficient (nn_eos= 1)
+      !  rn_a0 =  0.2   !  thermal expension coefficient (nn_eos= 1)
       !  rho = rau0 - rn_a0 * (T-10) 
       !  delta_T = 25 degrees  ==>>  delta_rho = 25 * rn_a0 = 5 kg/m3
@@ -68,5 +68,5 @@
       !
       !                          ! T & S profiles
-      zdam = 32.                      ! in kilometers
+      zdam = 32.                      ! density front position in kilometers
       pts(:,:,:,jp_tem) = 30._wp * ptmask(:,:,:)
       DO jk = 1, jpkm1
Index: /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_nam.F90
===================================================================
--- /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_nam.F90	(revision 6913)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_nam.F90	(revision 6914)
@@ -15,5 +15,4 @@
    !!----------------------------------------------------------------------
    USE dom_oce  , ONLY: nimpp , njmpp            ! i- & j-indices of the local domain
-   USE dom_oce  , ONLY: ln_zco, ln_zps, ln_sco   ! flag of type of coordinate       !!gm NOT SURE !
    USE par_oce        ! ocean space and time domain
    USE phycst         ! physical constants
@@ -57,5 +56,5 @@
       INTEGER ::   ios, ii   ! Local integer
       !!
-      NAMELIST/namusr_def/ ln_zco, ln_zps, ln_sco, rn_dx, rn_dz
+      NAMELIST/namusr_def/ rn_dx, rn_dz
       !!----------------------------------------------------------------------
       !
@@ -78,8 +77,4 @@
       WRITE(ldtxt(ii),*) '~~~~~~~~~~~ '                                                                 ;   ii = ii + 1
       WRITE(ldtxt(ii),*) '   Namelist namusr_def : LOCK_EXCHANGE test case'                             ;   ii = ii + 1
-      WRITE(ldtxt(ii),*) '      type of vertical coordinate : '                                         ;   ii = ii + 1
-      WRITE(ldtxt(ii),*) '         z-coordinate flag                     ln_zco = ', ln_zco             ;   ii = ii + 1
-      WRITE(ldtxt(ii),*) '         z-partial-step coordinate flag        ln_zps = ', ln_sco             ;   ii = ii + 1
-      WRITE(ldtxt(ii),*) '         s-coordinate flag                     ln_sco = ', ln_sco             ;   ii = ii + 1
       WRITE(ldtxt(ii),*) '      horizontal resolution                    rn_dx  = ', rn_dx, ' meters'   ;   ii = ii + 1
       WRITE(ldtxt(ii),*) '      vertical   resolution                    rn_dz  = ', rn_dz, ' meters'   ;   ii = ii + 1
Index: /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_sbc.F90
===================================================================
--- /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_sbc.F90	(revision 6913)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_sbc.F90	(revision 6914)
@@ -6,5 +6,5 @@
    !!
    !! User defined :    user defined momentum, heat and freshwater forcings  
-   !!=====================================================================
+   !!======================================================================
    !! History :  4.0   ! 2016-03  (S. Flavoni, G. Madec)  user defined interface
    !!----------------------------------------------------------------------
Index: /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_zgr.F90
===================================================================
--- /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_zgr.F90	(revision 6913)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_zgr.F90	(revision 6914)
@@ -2,28 +2,25 @@
    !!==============================================================================
    !!                       ***  MODULE usrdef_zgr  ***
+   !!
+   !!                   ===      LOCK_EXCHANGE case      ===
+   !!
    !! Ocean domain : user defined vertical coordinate system 
-   !!
-   !!                       ===      LOCK_EXCHANGE case      ===
-   !!
    !!==============================================================================
-   !! History :  4.0  ! 2016-08  (G. Madec)  Original code
+   !! History :  4.0  ! 2016-08  (G. Madec, S. Flavoni)  Original code
    !!----------------------------------------------------------------------
 
    !!----------------------------------------------------------------------
-   !!   usr_def_zgr      : user defined vertical coordinate system (required)
-   !!       zgr_z1d      : reference 1D z-coordinate 
-   !!       zgr_zps      : 3D vertical coordinate in z-partial cell coordinate
+   !!   usr_def_zgr   : user defined vertical coordinate system (required)
+   !!       zgr_z1d   : reference 1D z-coordinate 
    !!---------------------------------------------------------------------
-   USE oce               ! ocean variables
-   USE dom_oce  ,  ONLY: ln_zco, ln_zps, ln_sco   ! ocean space and time domain
-   USE dom_oce  ,  ONLY: nimpp, njmpp             ! ocean space and time domain
-   USE dom_oce  ,  ONLY: glamt                    ! ocean space and time domain
-   USE usrdef_nam        ! User defined : namelist variables
+   USE oce            ! ocean variables
+   USE dom_oce ,  ONLY: ln_zco, ln_zps, ln_sco   ! ocean space and time domain
+   USE usrdef_nam     ! User defined : namelist variables
    !
-   USE in_out_manager    ! I/O manager
-   USE lbclnk            ! ocean lateral boundary conditions (or mpp link)
-   USE lib_mpp           ! distributed memory computing library
-   USE wrk_nemo          ! Memory allocation
-   USE timing            ! Timing
+   USE in_out_manager ! I/O manager
+   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
+   USE lib_mpp        ! distributed memory computing library
+   USE wrk_nemo       ! Memory allocation
+   USE timing         ! Timing
 
    IMPLICIT NONE
@@ -62,9 +59,6 @@
       INTEGER , DIMENSION(:,:)  , INTENT(out) ::   k_top, k_bot                ! first & last ocean level
       !
-      INTEGER  ::   ji, jj, jk        ! dummy indices
-      INTEGER  ::   ik                ! local integers
-      REAL(wp) ::   zfact, z1_jpkm1   ! local scalar
-      REAL(wp) ::   ze3min            ! local scalar
-      REAL(wp), DIMENSION(jpi,jpj) ::   zht, zhu, z2d   ! 2D workspace
+      INTEGER  ::   jk   ! dummy indices
+      REAL(wp), DIMENSION(jpi,jpj) ::   z2d   ! 2D workspace
       !!----------------------------------------------------------------------
       !
@@ -77,4 +71,5 @@
       ! ---------------------------
       ! set in usrdef_nam.F90 by reading the namusr_def namelist only ln_zco
+      ln_zco    = .TRUE.       ! z-partial-step coordinate
       ln_zps    = .FALSE.      ! z-partial-step coordinate
       ln_sco    = .FALSE.      ! s-coordinate
@@ -87,5 +82,5 @@
       !                       !==  UNmasked meter bathymetry  ==!
       !
-      ! flat bassin (20m deep and 64000m wide)
+      ! flat bassin (20m deep and 64000m wide, set through the jpk and jpi (see userdef_nam.F90))
       CALL zgr_z1d( pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d )   ! Reference z-coordinate system
       !
@@ -96,26 +91,24 @@
       ! the ocean basin surrounded by land (1 grid-point) set through lbc_lnk call as jperio=0 
       z2d(:,:) = 1._wp                    ! surface ocean is the 1st level
-      CALL lbc_lnk( z2d, 'T', 1. )        ! closed basin 
-      k_top(:,:) = z2d(:,:)
+      CALL lbc_lnk( z2d, 'T', 1. )        ! closed basin since jperio = 0 (see userdef_nam.F90)
+      k_top(:,:) = NINT( z2d(:,:) )
       !
       !                              
-      IF ( ln_zco ) THEN      !==  z-coordinate  ==!   (step-like topography)
-         !
-         !                                !* bottom ocean compute from the depth of grid-points
-         k_bot(:,:) = jpkm1 * k_top(:,:)     ! here use k_top as a land mask
-         !                                !* horizontally uniform coordinate (reference z-co everywhere)
-         DO jk = 1, jpk
-            pdept(:,:,jk) = pdept_1d(jk)
-            pdepw(:,:,jk) = pdepw_1d(jk)
-            pe3t (:,:,jk) = pe3t_1d (jk)
-            pe3u (:,:,jk) = pe3t_1d (jk)
-            pe3v (:,:,jk) = pe3t_1d (jk)
-            pe3f (:,:,jk) = pe3t_1d (jk)
-            pe3w (:,:,jk) = pe3w_1d (jk)
-            pe3uw(:,:,jk) = pe3w_1d (jk)
-            pe3vw(:,:,jk) = pe3w_1d (jk)
-         END DO
-      ENDIF
+      !                       !==  z-coordinate  ==!   (step-like topography)
       !
+      !                                !* bottom ocean compute from the depth of grid-points
+      k_bot(:,:) = jpkm1 * k_top(:,:)     ! here use k_top as a land mask
+      !                                !* horizontally uniform coordinate (reference z-co everywhere)
+      DO jk = 1, jpk
+         pdept(:,:,jk) = pdept_1d(jk)
+         pdepw(:,:,jk) = pdepw_1d(jk)
+         pe3t (:,:,jk) = pe3t_1d (jk)
+         pe3u (:,:,jk) = pe3t_1d (jk)
+         pe3v (:,:,jk) = pe3t_1d (jk)
+         pe3f (:,:,jk) = pe3t_1d (jk)
+         pe3w (:,:,jk) = pe3w_1d (jk)
+         pe3uw(:,:,jk) = pe3w_1d (jk)
+         pe3vw(:,:,jk) = pe3w_1d (jk)
+      END DO
       !
    END SUBROUTINE usr_def_zgr
Index: /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/EXP00/namelist_cfg
===================================================================
--- /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/EXP00/namelist_cfg	(revision 6913)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/EXP00/namelist_cfg	(revision 6914)
@@ -2,4 +2,5 @@
 !! NEMO/OPA  Configuration namelist : used to overwrite defaults values defined in SHARED/namelist_ref
 !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!
 !-----------------------------------------------------------------------
 &namusr_def    !   User defined :   OVERFLOW configuration 
@@ -7,8 +8,8 @@
    !                       !  type of vertical coordinate
    ln_zco      = .false.      ! z-coordinate
-   ln_zps      = .false.      ! z-partial-step coordinate
-   ln_sco      = .true.       ! s-coordinate   
-   rn_dx       = 1000.     !  horizontal resolution   [meters]
-   rn_dz       =   20.     !  vertical   resolution   [meters]
+   ln_zps      = .true.       ! z-partial-step coordinate
+   ln_sco      = .false.      ! s-coordinate   
+   rn_dx       =   1000.   !  horizontal resolution   [meters]
+   rn_dz       =     20.   !  vertical   resolution   [meters]
 /
 !
@@ -17,10 +18,10 @@
 !-----------------------------------------------------------------------
    nn_no       =       0   !  job number (no more used...)
-   cn_exp      =   "overfl-FCT2-flux-ubs-ens"  !  experience name
+   cn_exp      =   "OVF_FCT2_flux_ubs"  !  experience name
    nn_it000    =       1   !  first time step
-   nn_itend    =   12240   ! for 34h of simulation  (=12240) 
-   nn_istate   =       1   !  output the initial state (1) or not (0)
-   nn_stock    =   12240   !  frequency of creation of a restart file (modulo referenced to 1)
-   nn_write    =   12240   !  frequency of write in the output file   (modulo referenced to nn_it000)
+   nn_itend    =    6120   ! here 17h of simulation  (=6120 time-step) 
+   nn_istate   =       0   !  output the initial state (1) or not (0)
+   nn_stock    =    6120   !  frequency of creation of a restart file (modulo referenced to 1)
+   nn_write    =    6120   !  frequency of write in the output file   (modulo referenced to nn_it000)
 /
 !-----------------------------------------------------------------------
@@ -85,5 +86,5 @@
 /
 !-----------------------------------------------------------------------
-&nambbl        !   bottom boundary layer scheme
+&nambbl        !   bottom boundary layer scheme                         ("key_trabbl")
 !-----------------------------------------------------------------------
 /
Index: /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_hgr.F90
===================================================================
--- /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_hgr.F90	(revision 6913)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_hgr.F90	(revision 6914)
@@ -46,5 +46,5 @@
       !!
       !! ** Method  :   set all intent(out) argument to a proper value
-      !!                OVERFLOW configuration : uniform grid spcing (1km)
+      !!                OVERFLOW configuration : uniform grid spacing (rn_dx)
       !!                without Coriolis force (f=0)
       !!
Index: /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_istate.F90
===================================================================
--- /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_istate.F90	(revision 6913)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_istate.F90	(revision 6914)
@@ -37,5 +37,5 @@
       !! 
       !! ** Purpose :   Initialization of the dynamics and tracers
-      !!                Here OVERFLOW configuration example 
+      !!                Here OVERFLOW configuration 
       !!
       !! ** Method  : - set temprature field
@@ -59,5 +59,5 @@
       IF(lwp) WRITE(numout,*) '                 (i.e. a temperature difference of 10 degrees with rn_a0 = 0.2'
       !
-      !  rn_a0 =  2.e-1   !  thermal expension coefficient (nn_eos= 1)
+      !  rn_a0 =  0.2   !  thermal expension coefficient (nn_eos= 1)
       !  rho = rau0 - rn_a0 * (T-10) 
       !  delta_T = 10 degrees  ==>>  delta_rho = 10 * rn_a0 = 2 kg/m3
@@ -68,5 +68,5 @@
       !
       !                          ! T & S profiles
-      zdam = 20.                      ! in kilometers
+      zdam = 20.                      ! density front position in kilometers
       pts(:,:,:,jp_tem) = 20._wp * ptmask(:,:,:)
       DO jk = 1, jpkm1
Index: /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_nam.F90
===================================================================
--- /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_nam.F90	(revision 6913)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_nam.F90	(revision 6914)
@@ -15,5 +15,5 @@
    !!----------------------------------------------------------------------
    USE dom_oce  , ONLY: nimpp , njmpp            ! i- & j-indices of the local domain
-   USE dom_oce  , ONLY: ln_zco, ln_zps, ln_sco   ! flag of type of coordinate       !!gm NOT SURE !
+   USE dom_oce  , ONLY: ln_zco, ln_zps, ln_sco   ! flag of type of coordinate
    USE par_oce        ! ocean space and time domain
    USE phycst         ! physical constants
@@ -71,5 +71,5 @@
       kpi = INT( 200.e3 / rn_dx ) + 2
       kpj = 3
-      kpk = INT(   2.e3 / rn_dz ) + 1
+      kpk = INT(  2000. / rn_dz ) + 1
       !
       !                             ! control print
Index: /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_sbc.F90
===================================================================
--- /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_sbc.F90	(revision 6913)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_sbc.F90	(revision 6914)
@@ -6,5 +6,5 @@
    !!
    !! User defined :    user defined momentum, heat and freshwater forcings  
-   !!=====================================================================
+   !!======================================================================
    !! History :  4.0   ! 2016-03  (S. Flavoni, G. Madec)  user defined interface
    !!----------------------------------------------------------------------
Index: /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_zgr.F90
===================================================================
--- /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_zgr.F90	(revision 6913)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_zgr.F90	(revision 6914)
@@ -2,28 +2,27 @@
    !!==============================================================================
    !!                       ***  MODULE usrdef_zgr  ***
+   !!
+   !!                     ===      OVERFLOW case      ===
+   !!
    !! Ocean domain : user defined vertical coordinate system 
-   !!
-   !!                       ===      OVERFLOW case      ===
-   !!
    !!==============================================================================
-   !! History :  4.0  ! 2016-08  (G. Madec)  Original code
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   usr_def_zgr      : user defined vertical coordinate system (required)
-   !!       zgr_z1d      : reference 1D z-coordinate 
-   !!       zgr_zps      : 3D vertical coordinate in z-partial cell coordinate
+   !! History :  4.0  ! 2016-08  (G. Madec, S. Flavoni)  Original code
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   usr_def_zgr   : user defined vertical coordinate system (required)
+   !!       zgr_z1d   : reference 1D z-coordinate 
    !!---------------------------------------------------------------------
-   USE oce               ! ocean variables
-   USE dom_oce  ,  ONLY: ln_zco, ln_zps, ln_sco   ! ocean space and time domain
-   USE dom_oce  ,  ONLY: nimpp, njmpp             ! ocean space and time domain
-   USE dom_oce  ,  ONLY: glamt                    ! ocean space and time domain
-   USE usrdef_nam        ! User defined : namelist variables
+   USE oce            ! ocean variables
+   USE dom_oce ,  ONLY: ln_zco, ln_zps, ln_sco   ! ocean space and time domain
+   USE dom_oce ,  ONLY: mi0, mi1, nimpp, njmpp   ! ocean space and time domain
+   USE dom_oce ,  ONLY: glamt                    ! ocean space and time domain
+   USE usrdef_nam     ! User defined : namelist variables
    !
-   USE in_out_manager    ! I/O manager
-   USE lbclnk            ! ocean lateral boundary conditions (or mpp link)
-   USE lib_mpp           ! distributed memory computing library
-   USE wrk_nemo          ! Memory allocation
-   USE timing            ! Timing
+   USE in_out_manager ! I/O manager
+   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
+   USE lib_mpp        ! distributed memory computing library
+   USE wrk_nemo       ! Memory allocation
+   USE timing         ! Timing
 
    IMPLICIT NONE
@@ -70,5 +69,5 @@
       !
       IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'usr_def_zgr : OVERFLOW configuration (z-coordinate closed box ocean without cavities)'
+      IF(lwp) WRITE(numout,*) 'usr_def_zgr : OVERFLOW configuration (z(ps)- or s-coordinate closed box ocean without cavities)'
       IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
       !
@@ -86,4 +85,5 @@
       !
       ! western continental shelf (500m deep) and eastern deep ocean (2000m deep)
+      ! (set through the jpk and jpi (see userdef_nam.F90))
       ! with a hyperbolic tangent transition centered at 40km
       ! NB: here glamt is in kilometers
@@ -91,10 +91,19 @@
       zht(:,:) = + (  500. + 0.5 * 1500. * ( 1.0 + tanh( (glamt(:,:) - 40.) / 7. ) )  )
       !
-      ! at u-point: recompute from glamu (see usrdef_hgr.F90) to avoid the masking when using lbc_lnk
-      zfact = rn_dx * 1.e-3         ! conversion in km
-      DO ji = 1, jpi
-         zhu(ji,:) = + (  500. + 0.5 * 1500. * ( 1.0 + tanh( ( zfact * REAL( ji-1 + nimpp-1 , wp ) - 40.) / 7. ) )  )
-      END DO
-      !
+      ! at u-point: averaging zht
+      DO ji = 1, jpim1
+         zhu(ji,:) = 0.5_wp * ( zht(ji,:) + zht(ji+1,:) )
+      END DO
+      CALL lbc_lnk( zhu, 'U', 1. )     ! boundary condition: this mask the surrouding grid-points
+      !                                ! ==>>>  set by hand non-zero value on first/last columns & rows 
+      DO ji = mi0(1), mi1(1)              ! first row of global domain only
+         zhu(ji,2) = zht(1,2)
+      END DO
+       DO ji = mi0(jpi), mi1(jpi)         ! last  row of global domain only
+         zhu(ji,2) = zht(jpi,2)
+      END DO
+      zhu(:,1) = zhu(:,2)
+      zhu(:,3) = zhu(:,2)
+      !     
       CALL zgr_z1d( pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d )   ! Reference z-coordinate system
       !
@@ -105,6 +114,6 @@
       ! the ocean basin surrounded by land (1 grid-point) set through lbc_lnk call as jperio=0 
       z2d(:,:) = 1._wp                    ! surface ocean is the 1st level
-      CALL lbc_lnk( z2d, 'T', 1. )        ! closed basin 
-      k_top(:,:) = z2d(:,:)
+      CALL lbc_lnk( z2d, 'T', 1. )        ! closed basin since jperio = 0 (see userdef_nam.F90)
+      k_top(:,:) = NINT( z2d(:,:) )
       !
       !                              
@@ -162,5 +171,5 @@
          k_bot(:,:) = jpkm1
          DO jk = jpkm1, 1, -1
-            WHERE( zht(:,:) <= pdepw_1d(jk) + ze3min )   k_bot(:,:) = jk-1
+            WHERE( zht(:,:) < pdepw_1d(jk) + ze3min )   k_bot(:,:) = jk-1
          END DO
          !
@@ -180,12 +189,11 @@
             DO ji = 1, jpi
                ik = k_bot(ji,jj)
-               IF( ik /= jpkm1 ) THEN                 ! last level ==> ref 1d z-coordinate
                   pdepw(ji,jj,ik+1) = MIN( zht(ji,jj) , pdepw_1d(ik+1) )
                   pe3t (ji,jj,ik  ) = pdepw(ji,jj,ik+1) - pdepw(ji,jj,ik)
-                  pe3t (ji,jj,ik+1) = pe3t (ji,jj,ik) 
+                  pe3t (ji,jj,ik+1) = pe3t (ji,jj,ik  ) 
                   !
-                  pdept(ji,jj,ik  ) = pdept(ji,jj,ik-1) + pe3t(ji,jj,ik) * 0.5_wp
-                  pe3w (ji,jj,ik+1) = pdepw(ji,jj,ik+1) - pdepw(ji,jj,ik)
-               ENDIF
+                  pdept(ji,jj,ik  ) = pdepw(ji,jj,ik  ) + pe3t (ji,jj,ik  ) * 0.5_wp
+                  pdept(ji,jj,ik+1) = pdepw(ji,jj,ik+1) + pe3t (ji,jj,ik+1) * 0.5_wp
+                  pe3w (ji,jj,ik+1) = pdept(ji,jj,ik+1) - pdept(ji,jj,ik)              ! = pe3t (ji,jj,ik  )
             END DO
          END DO         
@@ -194,6 +202,6 @@
          pe3u (:,:,:) = pe3t(:,:,:)          ! HERE OVERFLOW configuration : 
          pe3v (:,:,:) = pe3t(:,:,:)          !    e3 increases with i-index and identical with j-index
-         pe3f (:,:,:) = pe3t(:,:,:)          !    so e3 minimum of (i,i+1) points is (i) point (idem in j-direction)
-         pe3uw(:,:,:) = pe3w(:,:,:)          !    
+         pe3f (:,:,:) = pe3t(:,:,:)          !    so e3 minimum of (i,i+1) points is (i) point
+         pe3uw(:,:,:) = pe3w(:,:,:)          !    in j-direction e3v=e3t and e3f=e3v
          pe3vw(:,:,:) = pe3w(:,:,:)          !    ==>>  no need of lbc_lnk calls
          !      
