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 6905)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/EXP00/namelist_cfg	(revision 6906)
@@ -6,6 +6,4 @@
 !-----------------------------------------------------------------------
    ln_zco      =  .true.   ! z-coordinate flag
-   ln_zps      = .false.   ! z-partial-step coordinate flag
-   ln_sco      = .false.   ! s-coordinate flag
    rn_dx       =    500.   ! horizontal resolution in meters
    rn_dz       =      1.   ! vertical   resolution in meters
@@ -25,7 +23,7 @@
 &namcfg        !   parameters of the configuration
 !-----------------------------------------------------------------------
-   ln_read_cfg = .true.   !  (=T) read the domain configuration in 'domain_cfg.nc" file
+   ln_read_cfg = .false.   !  (=T) read the domain configuration in 'domain_cfg.nc" file
    !                       !  (=F) user defined configuration  ==>>>  see usrdef(_...) modules
-   ln_write_cfg= .false.    !  (=T) create the domain configuration file
+   ln_write_cfg= .false.   !  (=T) create the domain configuration file
    !
    cp_cfg      = "lock" !  name of the configuration
@@ -49,18 +47,7 @@
 /
 !-----------------------------------------------------------------------
-&namcrs        !   Grid coarsening for dynamics output and/or
-               !   passive tracer coarsened online simulations
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
 &namtsd    !   data : Temperature  & Salinity
 !-----------------------------------------------------------------------
-!          !  file name            ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
-!          !                       !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      !
-   sn_tem  = 'output.init_0000'    ,          1        ,'votemper' ,    .true.    , .true. , 'yearly'   , ''       ,   ''    ,    ''
-   sn_sal  = 'output.init_0000'    ,          1        ,'vosaline' ,    .true.    , .true. , 'yearly'   , ''       ,   ''    ,    ''
-   !
-   cn_dir        = './'     !  root directory for the location of the runoff files
-   ln_tsd_init   = .true.   !  Initialisation of ocean T & S with T &S input data (T) or not (F)
+   ln_tsd_init   = .false.   !  Initialisation of ocean T & S with T &S input data (T) or not (F)
    ln_tsd_tradmp = .false.   !  damping of ocean T & S toward T &S input data (T) or not (F)
 /
@@ -78,28 +65,8 @@
 /
 !-----------------------------------------------------------------------
-&namtra_qsr    !   penetrative solar radiation
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
-&namsbc_rnf    !   runoffs namelist surface boundary condition
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
-&namsbc_ssr    !   surface boundary condition : sea surface restoring
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
-&namsbc_alb    !   albedo parameters
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
-&namberg       !   iceberg parameters
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
 &namlbc        !   lateral momentum boundary condition
 !-----------------------------------------------------------------------
-!   rn_shlat    =    0.     !  shlat = 0  !  0 < shlat < 2  !  shlat = 2  !  2 < shlat
-  rn_shlat    =    2.     !  shlat = 0  !  0 < shlat < 2  !  shlat = 2  !  2 < shlat
+!                         !  free slip  !   partial slip  !   no slip   ! strong slip
+  rn_shlat    =    0.     !  shlat = 0  !  0 < shlat < 2  !  shlat = 2  !  2 < shlat
 /
 !-----------------------------------------------------------------------
@@ -112,5 +79,4 @@
 &nambbc        !   bottom temperature boundary condition                (default: NO)
 !-----------------------------------------------------------------------
-   ln_trabbc   = .false.    !  Apply a geothermal heating at the ocean bottom
 /
 !-----------------------------------------------------------------------
@@ -122,16 +88,16 @@
 !-----------------------------------------------------------------------
     nn_eos      =  1     !  type of equation of state and Brunt-Vaisala frequency
-                                 !  =-1, TEOS-10
-                                 !  = 0, EOS-80
-                                 !  = 1, S-EOS   (simplified eos)
-   !                            ! S-EOS coefficients (ln_seos=T):
-   !                            !  rd(T,S,Z)*rau0 = -a0*(1+.5*lambda*dT+mu*Z+nu*dS)*dT+b0*dS
-   rn_a0       =  2.e-1      !  thermal expension coefficient (nn_eos= 1)
-   rn_b0       =  8.e-1      !  saline  expension coefficient (nn_eos= 1)
-   rn_lambda1  =  0.      !  cabbeling coeff in T^2  (=0 for linear eos)
-   rn_lambda2  =  0.      !  cabbeling coeff in S^2  (=0 for linear eos)
-   rn_mu1      =  0.      !  thermobaric coeff. in T (=0 for linear eos)
-   rn_mu2      =  0.      !  thermobaric coeff. in S (=0 for linear eos)
-   rn_nu       =  0.      !  cabbeling coeff in T*S  (=0 for linear eos)
+                              !  =-1, TEOS-10
+                              !  = 0, EOS-80
+                              !  = 1, S-EOS   (simplified eos)
+   !                     ! S-EOS coefficients (nn_eos=1):
+   !                          !  rd(T,S,Z)*rau0 = -a0*(1+.5*lambda*dT+mu*Z+nu*dS)*dT+b0*dS
+   rn_a0       =  0.2         !  thermal expension coefficient (nn_eos= 1)
+   rn_b0       =  0.          !  saline  expension coefficient (nn_eos= 1)
+   rn_lambda1  =  0.          !  cabbeling coeff in T^2  (=0 for linear eos)
+   rn_lambda2  =  0.          !  cabbeling coeff in S^2  (=0 for linear eos)
+   rn_mu1      =  0.          !  thermobaric coeff. in T (=0 for linear eos)
+   rn_mu2      =  0.          !  thermobaric coeff. in S (=0 for linear eos)
+   rn_nu       =  0.          !  cabbeling coeff in T*S  (=0 for linear eos)
 /
 !-----------------------------------------------------------------------
@@ -153,9 +119,8 @@
 /
 !-----------------------------------------------------------------------
-&namtra_adv_mle !  mixed layer eddy parametrisation (Fox-Kemper param)
-!-----------------------------------------------------------------------
-  ln_mle      = .false.   ! (T) use the Mixed Layer Eddy (MLE) parameterisation
-/
-!----------------------------------------------------------------------------------
+&namtra_adv_mle !   mixed layer eddy parametrisation (Fox-Kemper param) (default: NO)
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
 &namtra_ldf    !   lateral diffusion scheme for tracers
 !----------------------------------------------------------------------------------
@@ -203,5 +168,9 @@
 /
 !-----------------------------------------------------------------------
-&namtra_dmp    !   tracer: T & S newtonian damping
+&namtra_ldfeiv !   eddy induced velocity param.                         (default: NO)
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtra_dmp    !   tracer: T & S newtonian damping                       (default: YES)
 !-----------------------------------------------------------------------
    ln_tradmp   =  .false.   !  add a damping termn (T) or not (F)
@@ -220,6 +189,7 @@
 !-----------------------------------------------------------------------
    ln_vvl_zstar  = .true.           !  zstar vertical coordinate
-!-----------------------------------------------------------------------
-&namdyn_vor    !   option of physics/algorithm (not control by CPP keys)
+/
+!-----------------------------------------------------------------------
+&namdyn_vor    !   option of physics/algorithm
 !-----------------------------------------------------------------------
    ln_dynvor_ene = .false. !  enstrophy conserving scheme
@@ -252,5 +222,5 @@
    !                       !  Type of the operator :
    !                           !  no diffusion: set ln_dynldf_lap=..._blp=F 
-   ln_dynldf_lap =  .true.     !    laplacian operator
+   ln_dynldf_lap =  .false.    !    laplacian operator
    ln_dynldf_blp =  .false.    !  bilaplacian operator
    !                       !  Direction of action  :
@@ -276,18 +246,6 @@
    rn_avm0     =   1.e-4  !  vertical eddy viscosity   [m2/s]          (background Kz if not "key_zdfcst")
    rn_avt0     =   0.     !  vertical eddy diffusivity [m2/s]          (background Kz if not "key_zdfcst")
-   ln_zdfevd   = .false.  !  enhanced vertical diffusion (evd) (T) or not (F)
-   ln_zdfnpc   = .false.  !  Non-Penetrative Convective algorithm (T) or not (F)
-/
-!-----------------------------------------------------------------------
-&namzdf_tke    !   turbulent eddy kinetic dependent vertical diffusion  ("key_zdftke")
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
-&namzdf_ddm    !   double diffusive mixing parameterization             ("key_zdfddm")
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
-&namzdf_tmx    !   tidal mixing parameterization                        ("key_zdftmx")
-!-----------------------------------------------------------------------
+   ln_zdfevd   = .false.  !  enhanced vertical diffusion (evd)
+   ln_zdfnpc   = .false.  !  Non-Penetrative Convective algorithm
 /
 !-----------------------------------------------------------------------
@@ -299,18 +257,2 @@
 !-----------------------------------------------------------------------
 /
-!-----------------------------------------------------------------------
-&namptr       !   Poleward Transport Diagnostic
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
-&namhsb       !  Heat and salt budgets
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
-&namobs       !  observation usage
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
-&nam_asminc   !   assimilation increments                               ('key_asminc')
-!-----------------------------------------------------------------------
-/
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 6905)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_hgr.F90	(revision 6906)
@@ -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 (1km)
+      !!                LOCK_EXCHANGE configuration : uniform grid spacing (500m)
       !!                without Coriolis force (f=0)
       !!
@@ -71,5 +71,5 @@
       IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*) 'usr_def_hgr : LOCK_EXCHANGE configuration bassin'
-      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~   uniform 1km grid spacing WITHOUT Coriolis force (f=0)'
+      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~   uniform grid spacing WITHOUT Coriolis force (f=0)'
       !
       !                       !==  grid point position  ==!   (in kilometers)
@@ -77,13 +77,13 @@
       DO jj = 1, jpj
          DO ji = 1, jpi             ! longitude
-            pglamt(ji,jj) = zfact * (  - 0.5 + ( REAL( ji-1 + nimpp-1 )       , wp )  )
-            pglamu(ji,jj) = zfact * (  - 0.5 + ( REAL( ji-1 + nimpp-1 ) + 0.5 , wp )  )
-            pglamv(ji,jj) = pglamt(ji,jj)
-            pglamf(ji,jj) = pglamu(ji,jj)
+            plamt(ji,jj) = zfact * (  - 0.5 + REAL( ji-1 + nimpp-1 , wp )  )  
+            plamu(ji,jj) = zfact * (          REAL( ji-1 + nimpp-1 , wp )  )
+            plamv(ji,jj) = plamt(ji,jj)
+            plamf(ji,jj) = plamu(ji,jj)
             !                       ! latitude
-            pgphit(ji,jj) = zfact * (  - 0.5 + ( REAL( jj-1 + njmpp-1 )       , wp )  )
-            pgphiu(ji,jj) = pgphit(ji,jj)
-            pgphiv(ji,jj) = zfact * (  - 0.5 + ( REAL( jj-1 + njmpp-1 ) + 0.5 , wp )  )
-            pgphif(ji,jj) = pgphiv(ji,jj)
+            pphit(ji,jj) = zfact * (  - 0.5 + REAL( jj-1 + njmpp-1 , wp )  )
+            pphiu(ji,jj) = pphit(ji,jj)
+            pphiv(ji,jj) = zfact * (          REAL( jj-1 + njmpp-1 , wp )  )
+            pphif(ji,jj) = pphiv(ji,jj)
          END DO
       END DO
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 6905)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_istate.F90	(revision 6906)
@@ -14,4 +14,5 @@
    !!----------------------------------------------------------------------
    USE par_oce        ! ocean space and time domain
+   USE dom_oce , ONLY : glamt 
    USE phycst         ! physical constants
    !
@@ -49,9 +50,16 @@
       !
       INTEGER  ::   jk     ! dummy loop indices
+      REAL(wp) ::   zdam   ! location of dam [Km]
       !!----------------------------------------------------------------------
       !
       IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'usr_def_istate : LOCK_EXCHANGE configuration, analytical definition of initial state '
-      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~   Ocean at rest, with a dam on T profile, and uniform S profile'
+      IF(lwp) WRITE(numout,*) 'usr_def_istate : LOCK_EXCHANGE configuration, analytical definition of initial state'
+      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~   Ocean at rest, with a constant salinity (not used as rho=F(T) '
+      IF(lwp) WRITE(numout,*) '                 and a vertical density front with a 5 kg/m3 difference located at glam=32km'
+      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)
+      !  rho = rau0 - rn_a0 * (T-10) 
+      !  delta_T = 25 degrees  ==>>  delta_rho = 25 * rn_a0 = 5 kg/m3
       !
       pu  (:,:,:) = 0._wp        ! ocean at rest
@@ -60,11 +68,11 @@
       !
       !                          ! T & S profiles
-      pts(:,:,:,jp_tem) = 30._wp * tmask(:,:,:)
+      zdam = 32.                      ! in kilometers
+      pts(:,:,:,jp_tem) = 30._wp * ptmask(:,:,:)
       DO jk = 1, jpkm1
-!SF   ADD rn_dx2
-         WHERE( gphit(:,:) <= zdam )   pts(:,:,jk,jp_tem) = 5._wp * tmask(:,:,jk)
+         WHERE( glamt(:,:) <= zdam )   pts(:,:,jk,jp_tem) = 5._wp * ptmask(:,:,jk)
       END DO
       !
-      pts(:,:,:,jp_sal) = 35. * tmask(:,:,:)
+      pts(:,:,:,jp_sal) = 35._wp * ptmask(:,:,:)
       !   
    END SUBROUTINE usr_def_istate
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 6905)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_nam.F90	(revision 6906)
@@ -55,8 +55,10 @@
       INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
       !
-      INTEGER ::   ios   ! Local integer
+      INTEGER ::   ios, ii   ! Local integer
       !!
       NAMELIST/namusr_def/ ln_zco, ln_zps, ln_sco, rn_dx, rn_dz
       !!----------------------------------------------------------------------
+      !
+      ii = 1
       !
       REWIND( numnam_cfg )          ! Namelist namusr_def (exist in namelist_cfg only)
@@ -64,12 +66,10 @@
 902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist', .TRUE. )
       !
-!!gm  This does not work...  I don't know how to write namusr_def in "output.namelist.dyn"
-      WRITE( ldnam(ii), namusr_def )
-!!gm
+      WRITE( ldnam(:), namusr_def )
       !
       ! Global Domain size:  LOCK_EXCHANGE domain is 64 km x 3 grid-points x 20 m
       kpi = INT(  64.e3 / rn_dx ) + 2
       kpj = 3
-      kpk = INT(   (2.e-1 ) * 1.e3  / rn_dz ) + 1
+      kpk = INT(  20.  / rn_dz ) + 1
       !
       !                             ! control print
@@ -77,5 +77,5 @@
       WRITE(ldtxt(ii),*) 'usr_def_nam  : read the user defined namelist (namusr_def) in namelist_cfg'   ;   ii = ii + 1
       WRITE(ldtxt(ii),*) '~~~~~~~~~~~ '                                                                 ;   ii = ii + 1
-      WRITE(ldtxt(ii),*) '   Namelist namusr_def : LOCK_EXCHANGE test case'                                  ;   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
@@ -84,5 +84,5 @@
       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
-      WRITE(ldtxt(ii),*) '      LOCK_EXCHANGE domain = 64 km  x  3 grid-points  x  20 m'                  ;   ii = ii + 1
+      WRITE(ldtxt(ii),*) '      LOCK_EXCHANGE domain = 64 km  x  3 grid-points  x  20 m'                ;   ii = ii + 1
       WRITE(ldtxt(ii),*) '         resulting global domain size :        jpiglo = ', kpi                ;   ii = ii + 1
       WRITE(ldtxt(ii),*) '                                               jpjglo = ', kpj                ;   ii = ii + 1
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 6906)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/MY_SRC/usrdef_zgr.F90	(revision 6906)
@@ -0,0 +1,179 @@
+MODULE usrdef_zgr
+   !!==============================================================================
+   !!                       ***  MODULE usrdef_zgr  ***
+   !! Ocean domain : user defined vertical coordinate system 
+   !!
+   !!                       ===      LOCK_EXCHANGE 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
+   !!---------------------------------------------------------------------
+   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 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
+   PRIVATE
+
+   PUBLIC   usr_def_zgr        ! called by domzgr.F90
+
+  !! * Substitutions
+#  include "vectopt_loop_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/OPA 4.0 , NEMO Consortium (2016)
+   !! $Id: domzgr.F90 6624 2016-05-26 08:59:48Z gm $
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS             
+
+   SUBROUTINE usr_def_zgr( ld_zco  , ld_zps  , ld_sco  , ld_isfcav,    &   ! type of vertical coordinate
+      &                    pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d  ,    &   ! 1D reference vertical coordinate
+      &                    pdept , pdepw ,                             &   ! 3D t & w-points depth
+      &                    pe3t  , pe3u  , pe3v , pe3f ,               &   ! vertical scale factors
+      &                    pe3w  , pe3uw , pe3vw,                      &   !     -      -      -
+      &                    k_top  , k_bot    )                             ! top & bottom ocean level
+      !!---------------------------------------------------------------------
+      !!              ***  ROUTINE usr_def_zgr  ***
+      !!
+      !! ** Purpose :   User defined the vertical coordinates
+      !!
+      !!----------------------------------------------------------------------
+      LOGICAL                   , INTENT(out) ::   ld_zco, ld_zps, ld_sco      ! vertical coordinate flags
+      LOGICAL                   , INTENT(out) ::   ld_isfcav                   ! under iceshelf cavity flag
+      REAL(wp), DIMENSION(:)    , INTENT(out) ::   pdept_1d, pdepw_1d          ! 1D grid-point depth     [m]
+      REAL(wp), DIMENSION(:)    , INTENT(out) ::   pe3t_1d , pe3w_1d           ! 1D grid-point depth     [m]
+      REAL(wp), DIMENSION(:,:,:), INTENT(out) ::   pdept, pdepw                ! grid-point depth        [m]
+      REAL(wp), DIMENSION(:,:,:), INTENT(out) ::   pe3t , pe3u , pe3v , pe3f   ! vertical scale factors  [m]
+      REAL(wp), DIMENSION(:,:,:), INTENT(out) ::   pe3w , pe3uw, pe3vw         ! i-scale factors 
+      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
+      !!----------------------------------------------------------------------
+      !
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) 'usr_def_zgr : LOCK_EXCHANGE configuration (z-coordinate closed box ocean without cavities)'
+      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
+      !
+      !
+      ! type of vertical coordinate
+      ! ---------------------------
+      ! set in usrdef_nam.F90 by reading the namusr_def namelist only ln_zco
+      ln_zps    = .FALSE.      ! z-partial-step coordinate
+      ln_sco    = .FALSE.      ! s-coordinate
+      ld_isfcav = .FALSE.      ! ISF Ice Shelves Flag
+      !
+      !
+      ! Build the vertical coordinate system
+      ! ------------------------------------
+      !
+      !                       !==  UNmasked meter bathymetry  ==!
+      !
+      ! flat bassin (20m deep and 64000m wide)
+      CALL zgr_z1d( pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d )   ! Reference z-coordinate system
+      !
+      !
+      !                       !==  top masked level bathymetry  ==!  (all coordinates)
+      !
+      ! no ocean cavities : top ocean level is ONE, except over land
+      ! 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(:,:)
+      !
+      !                              
+      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
+      !
+      !
+   END SUBROUTINE usr_def_zgr
+
+
+   SUBROUTINE zgr_z1d( pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d )   ! 1D reference vertical coordinate
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE zgr_z1d  ***
+      !!
+      !! ** Purpose :   set the depth of model levels and the resulting 
+      !!      vertical scale factors.
+      !!
+      !! ** Method  :   z-coordinate system (use in all type of coordinate)
+      !!      The depth of model levels is defined from an analytical
+      !!      function the derivative of which gives the scale factors.
+      !!      both depth and scale factors only depend on k (1d arrays).
+      !!              w-level: pdepw_1d  = pdep(k)
+      !!                       pe3w_1d(k) = dk(pdep)(k)     = e3(k)
+      !!              t-level: pdept_1d  = pdep(k+0.5)
+      !!                       pe3t_1d(k) = dk(pdep)(k+0.5) = e3(k+0.5)
+      !!
+      !!            ===    Here constant vertical resolution   ===
+      !!
+      !! ** Action  : - pdept_1d, pdepw_1d : depth of T- and W-point (m)
+      !!              - pe3t_1d , pe3w_1d  : scale factors at T- and W-levels (m)
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(:), INTENT(out) ::   pdept_1d, pdepw_1d   ! 1D grid-point depth        [m]
+      REAL(wp), DIMENSION(:), INTENT(out) ::   pe3t_1d , pe3w_1d    ! 1D vertical scale factors  [m]
+      !
+      INTEGER  ::   jk       ! dummy loop indices
+      REAL(wp) ::   zt, zw   ! local scalar
+      !!----------------------------------------------------------------------
+      !
+      IF(lwp) THEN                         ! Parameter print
+         WRITE(numout,*)
+         WRITE(numout,*) '    zgr_z1d : Reference vertical z-coordinates: uniform dz = ', rn_dz
+         WRITE(numout,*) '    ~~~~~~~'
+      ENDIF
+      !
+      ! Reference z-coordinate (depth - scale factor at T- and W-points)   ! Madec & Imbard 1996 function
+      ! ----------------------
+      DO jk = 1, jpk
+         zw = REAL( jk , wp )
+         zt = REAL( jk , wp ) + 0.5_wp
+         pdepw_1d(jk) =    rn_dz *   REAL( jk-1 , wp )
+         pdept_1d(jk) =    rn_dz * ( REAL( jk-1 , wp ) + 0.5_wp )
+         pe3w_1d (jk) =    rn_dz
+         pe3t_1d (jk) =    rn_dz
+      END DO
+      !
+      IF(lwp) THEN                        ! control print
+         WRITE(numout,*)
+         WRITE(numout,*) '              Reference 1D z-coordinate depth and scale factors:'
+         WRITE(numout, "(9x,' level  gdept_1d  gdepw_1d  e3t_1d   e3w_1d  ')" )
+         WRITE(numout, "(10x, i4, 4f9.2)" ) ( jk, pdept_1d(jk), pdepw_1d(jk), pe3t_1d(jk), pe3w_1d(jk), jk = 1, jpk )
+      ENDIF
+      !
+   END SUBROUTINE zgr_z1d
+   
+   !!======================================================================
+END MODULE usrdef_zgr
Index: /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/cpp_LOCK_EXCHANGE.fcm
===================================================================
--- /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/cpp_LOCK_EXCHANGE.fcm	(revision 6905)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/LOCK_EXCHANGE/cpp_LOCK_EXCHANGE.fcm	(revision 6906)
@@ -1,1 +1,1 @@
- bld::tool::fppkeys key_zdfcst key_iomput key_mpp_mpi key_mpp_rep
+ bld::tool::fppkeys key_zdfcst key_iomput key_mpp_mpi key_mpp_rep key_nosignedzero
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 6905)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/EXP00/namelist_cfg	(revision 6906)
@@ -6,7 +6,7 @@
 !-----------------------------------------------------------------------
    !                       !  type of vertical coordinate
-   ln_zco      = .false.       ! z-coordinate
+   ln_zco      = .false.      ! z-coordinate
    ln_zps      = .false.      ! z-partial-step coordinate
-   ln_sco      = .true.      ! s-coordinate   
+   ln_sco      = .true.       ! s-coordinate   
    rn_dx       = 1000.     !  horizontal resolution   [meters]
    rn_dz       =   20.     !  vertical   resolution   [meters]
@@ -19,5 +19,5 @@
    cn_exp      =   "overfl-FCT2-flux-ubs-ens"  !  experience name
    nn_it000    =       1   !  first time step
-   nn_itend    =   180   ! for 34h of simulation  (=12240) 
+   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)
@@ -29,5 +29,5 @@
    ln_read_cfg = .false.   !  (=T) read the domain configuration in 'domain_cfg.nc" file
    !                       !  (=F) user defined configuration  ==>>>  see usrdef(_...) modules
-   ln_write_cfg= .true. !.false.   !  (=T) create the domain configuration file
+   ln_write_cfg= .false.   !  (=T) create the domain configuration file
    !
    cp_cfg      = "overflow" !  name of the configuration
@@ -51,17 +51,6 @@
 /
 !-----------------------------------------------------------------------
-&namcrs        !   Grid coarsening for dynamics output and/or
-               !   passive tracer coarsened online simulations
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
 &namtsd    !   data : Temperature  & Salinity
 !-----------------------------------------------------------------------
-!          !  file name            ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
-!          !                       !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      !
-   sn_tem  = 'output.init_0000'    ,          1        ,'votemper' ,    .true.    , .true. , 'yearly'   , ''       ,   ''    ,    ''
-   sn_sal  = 'output.init_0000'    ,          1        ,'vosaline' ,    .true.    , .true. , 'yearly'   , ''       ,   ''    ,    ''
-   !
-   cn_dir        = './'      !  root directory for the location of the runoff files
    ln_tsd_init   = .false.   !  Initialisation of ocean T & S with T &S input data (T) or not (F)
    ln_tsd_tradmp = .false.   !  damping of ocean T & S toward T &S input data (T) or not (F)
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 6905)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_istate.F90	(revision 6906)
@@ -50,5 +50,5 @@
       !
       INTEGER  ::   jk     ! dummy loop indices
-      REAL(wp) ::   zdam   ! location of dam [m]
+      REAL(wp) ::   zdam   ! location of dam [Km]
       !!----------------------------------------------------------------------
       !
@@ -56,5 +56,4 @@
       IF(lwp) WRITE(numout,*) 'usr_def_istate : OVERFLOW configuration, analytical definition of initial state'
       IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~   Ocean at rest, with a constant salinity (not used as rho=F(T) '
-      IF(lwp) WRITE(numout,*) '                 and a vertical density front with a 2 kg/m3 difference located'
       IF(lwp) WRITE(numout,*) '                 and a vertical density front with a 2 kg/m3 difference located at glam=20km'
       IF(lwp) WRITE(numout,*) '                 (i.e. a temperature difference of 10 degrees with rn_a0 = 0.2'
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 6905)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_nam.F90	(revision 6906)
@@ -47,5 +47,5 @@
       !! ** Method  :   read in namusr_def containing all the user specific namelist parameter
       !!
-      !!                Here GYRE configuration
+      !!                Here OVERFLOW configuration
       !!
       !! ** input   : - namusr_def namelist found in namelist_cfg
@@ -68,5 +68,5 @@
       WRITE( ldnam(:), namusr_def )
       !
-      ! Global Domain size:  OVERFLOW domain is   200 km x 3 grid-points x 2000 m
+      ! Global Domain size:  OVERFLOW domain is  200 km x 3 grid-points x 2000 m
       kpi = INT( 200.e3 / rn_dx ) + 2
       kpj = 3
@@ -78,5 +78,5 @@
       WRITE(ldtxt(ii),*) '~~~~~~~~~~~ '                                                                 ;   ii = ii + 1
       WRITE(ldtxt(ii),*) '   Namelist namusr_def : OVERFLOW test case'                                  ;   ii = ii + 1
-      WRITE(ldtxt(ii),*) '      type of vertical coordinate : '                                           ;   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_zps             ;   ii = ii + 1
@@ -84,5 +84,5 @@
       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
-      WRITE(ldtxt(ii),*) '      OVERFLOW domain = 3 grid-points x 200 km  x 2000 m'                     ;   ii = ii + 1
+      WRITE(ldtxt(ii),*) '      OVERFLOW domain = 200 km x 3 grid-points x 2000 m'                      ;   ii = ii + 1
       WRITE(ldtxt(ii),*) '         resulting global domain size :        jpiglo = ', kpi                ;   ii = ii + 1
       WRITE(ldtxt(ii),*) '                                               jpjglo = ', kpj                ;   ii = ii + 1
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 6905)
+++ /branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/CONFIG/OVERFLOW/MY_SRC/usrdef_zgr.F90	(revision 6906)
@@ -7,5 +7,5 @@
    !!
    !!==============================================================================
-   !! History :  4.0  ! 2016-08  (S. Flavoni)  Original code
+   !! History :  4.0  ! 2016-08  (G. Madec)  Original code
    !!----------------------------------------------------------------------
 
@@ -154,6 +154,4 @@
       !
       IF ( ln_zps ) THEN      !==  zps-coordinate  ==!   (partial bottom-steps)
-         !
-!         CALL ctl_stop( 'STOP', ' zps coordinate not yet coded' )
          !
          ze3min = 0.1_wp * rn_dz
