Index: branches/UKMO/dev_r5021_nn_etau_revision/NEMOGCM/NEMO/OFF_SRC/domain.F90
===================================================================
--- branches/UKMO/dev_r5021_nn_etau_revision/NEMOGCM/NEMO/OFF_SRC/domain.F90	(revision 5240)
+++ branches/UKMO/dev_r5021_nn_etau_revision/NEMOGCM/NEMO/OFF_SRC/domain.F90	(revision 5446)
@@ -116,7 +116,8 @@
       USE ioipsl
       INTEGER  ::   ios                 ! Local integer output status for namelist read
-      NAMELIST/namrun/ nn_no   , cn_exp    , cn_ocerst_in, cn_ocerst_out, ln_rstart , nn_rstctl,   &
+      NAMELIST/namrun/ cn_ocerst_indir, cn_ocerst_outdir, nn_stocklist, ln_rst_list,               &
+         &             nn_no   , cn_exp    , cn_ocerst_in, cn_ocerst_out, ln_rstart , nn_rstctl,   &
          &             nn_it000, nn_itend  , nn_date0    , nn_leapy     , nn_istate , nn_stock ,   &
-         &             nn_write, ln_dimgnnn, ln_mskland  , ln_clobber   , nn_chunksz, nn_euler
+         &             nn_write, ln_dimgnnn, ln_mskland  , ln_cfmeta    , ln_clobber, nn_chunksz, nn_euler
       NAMELIST/namdom/ nn_bathy , rn_bathy, rn_e3zps_min, rn_e3zps_rat, nn_msh    , rn_hmin,   &
          &             nn_acc   , rn_atfp     , rn_rdt      , rn_rdtmin ,            &
@@ -159,4 +160,5 @@
          WRITE(numout,*) '      multi file dimgout              ln_dimgnnn = ', ln_dimgnnn
          WRITE(numout,*) '      mask land points                ln_mskland = ', ln_mskland
+         WRITE(numout,*) '      additional CF standard metadata ln_cfmeta  = ', ln_cfmeta
          WRITE(numout,*) '      overwrite an existing file      ln_clobber = ', ln_clobber
          WRITE(numout,*) '      NetCDF chunksize (bytes)        nn_chunksz = ', nn_chunksz
@@ -171,4 +173,5 @@
       ninist = nn_istate
       nstock = nn_stock
+      nstocklist = nn_stocklist
       nwrite = nn_write
 
Index: branches/UKMO/dev_r5021_nn_etau_revision/NEMOGCM/NEMO/OFF_SRC/dommsk.F90
===================================================================
--- branches/UKMO/dev_r5021_nn_etau_revision/NEMOGCM/NEMO/OFF_SRC/dommsk.F90	(revision 5240)
+++ branches/UKMO/dev_r5021_nn_etau_revision/NEMOGCM/NEMO/OFF_SRC/dommsk.F90	(revision 5446)
@@ -15,4 +15,5 @@
    USE in_out_manager  ! I/O manager
    USE wrk_nemo  
+   USE lbclnk  
 
    IMPLICIT NONE
@@ -48,5 +49,5 @@
       !!----------------------------------------------------------------------
       !
-      INTEGER  ::   ji, jk                   ! dummy loop indices
+      INTEGER  ::   ji, jj, jk                   ! dummy loop indices
       INTEGER  ::   iif, iil, ijf, ijl       ! local integers
       INTEGER, POINTER, DIMENSION(:,:) ::  imsk 
@@ -83,4 +84,31 @@
       ENDIF 
       !
+      ! (ISF) MIN(1,SUM(umask)) is here to check if you have effectively at
+      ! least 1 wet u point
+      DO jj = 1, jpjm1
+         DO ji = 1, fs_jpim1   ! vector loop
+            umask_i(ji,jj)  = ssmask(ji,jj) * ssmask(ji+1,jj  )  * MIN(1._wp,SUM(umask(ji,jj,:)))
+            vmask_i(ji,jj)  = ssmask(ji,jj) * ssmask(ji  ,jj+1)  * MIN(1._wp,SUM(vmask(ji,jj,:)))
+         END DO
+         DO ji = 1, jpim1      ! NO vector opt.
+            fmask_i(ji,jj) =  ssmask(ji,jj  ) * ssmask(ji+1,jj  )   &
+               &            * ssmask(ji,jj+1) * ssmask(ji+1,jj+1) * MIN(1._wp,SUM(fmask(ji,jj,:)))
+         END DO
+      END DO
+      CALL lbc_lnk( umask_i, 'U', 1._wp )      ! Lateral boundary conditions
+      CALL lbc_lnk( vmask_i, 'V', 1._wp )
+      CALL lbc_lnk( fmask_i, 'F', 1._wp )
+
+      ! 3. Ocean/land mask at wu-, wv- and w points 
+      !----------------------------------------------
+      wmask (:,:,1) = tmask(:,:,1) ! ????????
+      wumask(:,:,1) = umask(:,:,1) ! ????????
+      wvmask(:,:,1) = vmask(:,:,1) ! ????????
+      DO jk=2,jpk
+         wmask (:,:,jk)=tmask(:,:,jk) * tmask(:,:,jk-1)
+         wumask(:,:,jk)=umask(:,:,jk) * umask(:,:,jk-1)   
+         wvmask(:,:,jk)=vmask(:,:,jk) * vmask(:,:,jk-1)
+      END DO
+      !
       IF( nprint == 1 .AND. lwp ) THEN    ! Control print
          imsk(:,:) = INT( tmask_i(:,:) )
Index: branches/UKMO/dev_r5021_nn_etau_revision/NEMOGCM/NEMO/OFF_SRC/dtadyn.F90
===================================================================
--- branches/UKMO/dev_r5021_nn_etau_revision/NEMOGCM/NEMO/OFF_SRC/dtadyn.F90	(revision 5240)
+++ branches/UKMO/dev_r5021_nn_etau_revision/NEMOGCM/NEMO/OFF_SRC/dtadyn.F90	(revision 5446)
@@ -245,5 +245,10 @@
       tsn(:,:,:,jp_sal) = sf_dyn(jf_sal)%fnow(:,:,:)  * tmask(:,:,:)    ! salinity
       !
-      CALL eos    ( tsn, rhd, rhop, gdept_0(:,:,:) )                                       ! In any case, we need rhop
+      !
+      CALL eos    ( tsn, rhd, rhop, gdept_0(:,:,:) ) ! In any case, we need rhop
+      CALL eos_rab( tsn, rab_n )       ! now    local thermal/haline expension ratio at T-points
+      CALL bn2    ( tsn, rab_n, rn2 ) ! before Brunt-Vaisala frequency need for zdfmxl
+
+      rn2b(:,:,:) = rn2(:,:,:)         ! need for zdfmxl
       CALL zdf_mxl( kt )                                                   ! In any case, we need mxl 
       !
@@ -259,5 +264,5 @@
       fr_i(:,:)        = sf_dyn(jf_ice)%fnow(:,:,1) * tmask(:,:,1)    ! Sea-ice fraction
       qsr (:,:)        = sf_dyn(jf_qsr)%fnow(:,:,1) * tmask(:,:,1)    ! solar radiation
-      IF ( ln_dynrnf ) &
+      IF( ln_dynrnf ) &
       rnf (:,:)        = sf_dyn(jf_rnf)%fnow(:,:,1) * tmask(:,:,1)    ! river runoffs 
 
@@ -383,5 +388,5 @@
 
       !
-      IF ( ln_dynrnf ) THEN
+      IF( ln_dynrnf ) THEN
                 jf_rnf = jfld + 1  ;  jfld  = jf_rnf
          slf_d(jf_rnf) = sn_rnf
@@ -535,14 +540,18 @@
       !!---------------------------------------------------------------------
 #if defined key_ldfslp && ! defined key_c1d
+      CALL eos    ( pts, rhd, rhop, gdept_0(:,:,:) )
       CALL eos_rab( pts, rab_n )       ! now local thermal/haline expension ratio at T-points
       CALL bn2    ( pts, rab_n, rn2  ) ! now    Brunt-Vaisala
-      IF( ln_zps )   & ! Partial steps: before Horizontal DErivative
-        &    CALL zps_hde( kt, jpts, pts, gtsu, gtsv,  &        ! Partial steps: before horizontal gradient
-        &                                        rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv ,   &             !
-        &                                 gtui, gtvi, grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi    )  ! of t, s, rd at the last ocean level
-        ! only gtsu, gtsv, rhd, gru , grv are used 
-
-
-         !                                                            ! of t, s, rd at the bottom ocean level
+
+      ! Partial steps: before Horizontal DErivative
+      IF( ln_zps  .AND. .NOT. ln_isfcav)                            &
+         &            CALL zps_hde    ( kt, jpts, pts, gtsu, gtsv,  &  ! Partial steps: before horizontal gradient
+         &                                        rhd, gru , grv    )  ! of t, s, rd at the last ocean level
+      IF( ln_zps .AND.        ln_isfcav)                            &
+         &            CALL zps_hde_isf( kt, jpts, pts, gtsu, gtsv,  &    ! Partial steps for top cell (ISF)
+         &                                        rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv ,   &
+         &                                 gtui, gtvi, grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi    ) ! of t, s, rd at the first ocean level
+
+      rn2b(:,:,:) = rn2(:,:,:)         ! need for zdfmxl
       CALL zdf_mxl( kt )            ! mixed layer depth
       CALL ldf_slp( kt, rhd, rn2 )  ! slopes
Index: branches/UKMO/dev_r5021_nn_etau_revision/NEMOGCM/NEMO/OFF_SRC/nemogcm.F90
===================================================================
--- branches/UKMO/dev_r5021_nn_etau_revision/NEMOGCM/NEMO/OFF_SRC/nemogcm.F90	(revision 5240)
+++ branches/UKMO/dev_r5021_nn_etau_revision/NEMOGCM/NEMO/OFF_SRC/nemogcm.F90	(revision 5446)
@@ -149,7 +149,8 @@
          &             nn_bench, nn_timing
       NAMELIST/namcfg/ cp_cfg, cp_cfz, jp_cfg, jpidta, jpjdta, jpkdta, jpiglo, jpjglo, &
-         &             jpizoom, jpjzoom, jperio
+         &             jpizoom, jpjzoom, jperio, ln_use_jattr
       !!----------------------------------------------------------------------
       cltxt = ''
+      cxios_context = 'nemo'
       !
       !                             ! Open reference namelist and configuration namelist files
@@ -182,8 +183,8 @@
 #if defined key_iomput
       CALL  xios_initialize( "nemo",return_comm=ilocal_comm )
-      narea = mynode( cltxt, numnam_ref, numnam_cfg, numond , nstop, ilocal_comm )   ! Nodes selection
+      narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop, ilocal_comm )   ! Nodes selection
 #else
       ilocal_comm = 0
-      narea = mynode( cltxt, numnam_ref, numnam_cfg, numond , nstop )                ! Nodes selection (control print return in cltxt)
+      narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop )                ! Nodes selection (control print return in cltxt)
 #endif
 
@@ -233,5 +234,5 @@
          WRITE(numout,*) '                       NEMO team'
          WRITE(numout,*) '            Ocean General Circulation Model'
-         WRITE(numout,*) '                  version 3.5  (2012) '
+         WRITE(numout,*) '                  version 3.6  (2015) '
          WRITE(numout,*)
          WRITE(numout,*)
@@ -359,4 +360,5 @@
          WRITE(numout,*) '      left bottom j index of the zoom (in data domain) jpizoom = ', jpjzoom
          WRITE(numout,*) '      lateral cond. type (between 0 and 6) jperio = ', jperio   
+         WRITE(numout,*) '      use file attribute if exists as i/p j-start ln_use_jattr = ', ln_use_jattr
       ENDIF
       !                             ! Parameter control
