Index: NEMO/branches/2018/dev_r10057_ENHANCE03_ZTILDE/cfgs/SHARED/field_def_nemo-oce.xml
===================================================================
--- NEMO/branches/2018/dev_r10057_ENHANCE03_ZTILDE/cfgs/SHARED/field_def_nemo-oce.xml	(revision 10164)
+++ NEMO/branches/2018/dev_r10057_ENHANCE03_ZTILDE/cfgs/SHARED/field_def_nemo-oce.xml	(revision 10167)
@@ -24,4 +24,7 @@
         <field id="e3t_star"     long_name="Barotropic T-cell thickness anomaly" standard_name="barotropic_cell_thickness_anomaly" unit="m"   grid_ref="grid_T_3D" />
         <field id="e3t_tilde"    long_name="Baroclinic T-cell thickness anomaly" standard_name="baroclinic_cell_thickness_anomaly" unit="m"   grid_ref="grid_T_3D" />
+        <field id="stiff_tilde"  long_name="Vertical grid stiffness"             operation="maximum" unit=" "   />
+        <field id="dh_tilde"     long_name="Vertical grid horiz. Laplacian"      operation="maximum" unit=" "   />
+        <field id="dz_tilde"     long_name="Vertical grid vert. Laplacian"       operation="maximum" unit=" "   />
         <field id="e3t_0"        long_name="Initial T-cell thickness"            standard_name="ref_cell_thickness" unit="m"   grid_ref="grid_T_3D" />
 
@@ -354,4 +357,5 @@
         <field id="uocet"        long_name="ocean transport along i-axis times temperature (CRS)"                                               unit="degC*m/s"   grid_ref="grid_U_3D" />
         <field id="uoces"        long_name="ocean transport along i-axis times salinity (CRS)"                                                  unit="1e-3*m/s"   grid_ref="grid_U_3D" />
+        <field id="un_lf_tilde"  long_name="Low frequency current along i-axis"                                                                 unit="m/s"   grid_ref="grid_U_3D" />
 
         <!-- u-eddy diffusivity coefficients (available if ln_traldf_OFF=F) -->
@@ -408,4 +412,5 @@
         <field id="vocet"        long_name="ocean transport along j-axis times temperature (CRS)"                                               unit="degC*m/s"   grid_ref="grid_V_3D" />
         <field id="voces"        long_name="ocean transport along j-axis times salinity (CRS)"                                                  unit="1e-3*m/s"   grid_ref="grid_V_3D" />
+        <field id="vn_lf_tilde"  long_name="Low frequency current along j-axis"                                                                 unit="m/s"        grid_ref="grid_V_3D" />
 
         <!-- v-eddy diffusivity coefficients (available if ln_traldf_OFF=F) -->
@@ -454,4 +459,5 @@
         <field id="woce"         long_name="ocean vertical velocity"                       standard_name="upward_sea_water_velocity"              unit="m/s"  />
         <field id="wocetr_eff"   long_name="effective ocean vertical transport"                                                                   unit="m3/s" />
+        <field id="depw_tilde"   long_name="Baroclinic interface anomaly"                  standard_name="interface_anomaly"                      unit="m"    />
 
         <!-- woce_eiv: available with EIV  (ln_ldfeiv=T and ln_ldfeiv_dia=T)  -->
Index: NEMO/branches/2018/dev_r10057_ENHANCE03_ZTILDE/src/OCE/DIA/diawri.F90
===================================================================
--- NEMO/branches/2018/dev_r10057_ENHANCE03_ZTILDE/src/OCE/DIA/diawri.F90	(revision 10164)
+++ NEMO/branches/2018/dev_r10057_ENHANCE03_ZTILDE/src/OCE/DIA/diawri.F90	(revision 10167)
@@ -58,5 +58,4 @@
    USE diurnal_bulk    ! diurnal warm layer
    USE cool_skin       ! Cool skin
-   USE domvvl
 
    IMPLICIT NONE
@@ -134,14 +133,4 @@
       CALL iom_put( "e3w" , e3w_n(:,:,:) )
       !
-      IF ( (ln_vvl_ztilde).OR.(ln_vvl_layer) ) THEN
-         IF( iom_use("e3t_star") ) THEN    ! Barotropic cell thickness anomaly
-            z3d(:,:,:) = (e3t_n(:,:,:)-tilde_e3t_n(:,:,:)-e3t_0(:,:,:))*tmask(:,:,:) 
-            CALL iom_put( "e3t_star" , z3d(:,:,:) )
-         ENDIF
-         IF( iom_use("e3t_tilde") )  THEN  ! Baroclinic cell thickness anomaly
-            CALL iom_put( "e3t_tilde" , tilde_e3t_n(:,:,:) )
-         ENDIF
-      ENDIF
-
       IF( iom_use("e3tdef") )   &
          CALL iom_put( "e3tdef"  , ( ( e3t_n(:,:,:) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 )
Index: NEMO/branches/2018/dev_r10057_ENHANCE03_ZTILDE/src/OCE/DOM/domvvl.F90
===================================================================
--- NEMO/branches/2018/dev_r10057_ENHANCE03_ZTILDE/src/OCE/DOM/domvvl.F90	(revision 10164)
+++ NEMO/branches/2018/dev_r10057_ENHANCE03_ZTILDE/src/OCE/DOM/domvvl.F90	(revision 10167)
@@ -230,4 +230,5 @@
             frq_rst_e3t(:,:) = 0.0_wp 
             frq_rst_hdv(:,:) = 1.0_wp / rdt
+            rn_lf_cutoff     = 2.0_wp * rpi * rdt / 86400._wp
             tildemask(:,:) = 0._wp
          ENDIF
@@ -289,6 +290,6 @@
       IF( ln_vvl_layer ) THEN
          IF ( ln_vvl_zstar_on_shelf ) THEN
-            zhmin = 100._wp
-            zhmax = 150._wp
+            zhmin = 50._wp
+            zhmax = 100._wp
             DO jj = 1, jpj
                DO ji = 1, jpi
@@ -1000,4 +1001,8 @@
          ht_n(:,:) = ht_n(:,:) + e3t_n(:,:,jk) * tmask(:,:,jk)
       END DO
+
+      ! Output some diagnostics:
+      ! ------------------------
+      IF (ln_vvl_ztilde .OR. ln_vvl_layer)  CALL dom_vvl_dia( kt )
 
       ! write restart file
@@ -2513,4 +2518,180 @@
    END SUBROUTINE nonosc_2d
 
+   SUBROUTINE dom_vvl_dia( kt )
+      !!----------------------------------------------------------------------
+      !!                ***  ROUTINE dom_vvl_dia  ***
+      !!                   
+      !! ** Purpose :  Output some diagnostics in ztilde/zlayer cases
+      !!
+      !!----------------------------------------------------------------------
+      !! * Arguments
+      INTEGER, INTENT( in )               :: kt       ! time step
+      !! * Local declarations
+      INTEGER                             :: ji,jj,jk,jkbot ! dummy loop indices
+      REAL(wp)                            :: ztmp1
+      REAL(wp), DIMENSION(4)              :: zr1
+      REAL(wp), DIMENSION(jpi,jpj       ) :: zout2d
+      REAL(wp), DIMENSION(jpi,jpj,jpk)    :: zwdw, zout
+      !!----------------------------------------------------------------------
+      IF( ln_timing )  CALL timing_start('dom_vvl_dia')
+      !
+      ! Compute internal interfaces depths:
+      !------------------------------------
+      IF ( iom_use("dh_tilde").OR.iom_use("depw_tilde").OR.iom_use("stiff_tilde")) THEN
+         zwdw(:,:,1) = 0.e0
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               DO jk = 2, jpkm1
+                  zwdw(ji,jj,jk) =  zwdw(ji,jj,jk-1) + & 
+                                 & (tilde_e3t_n(ji,jj,jk-1)+e3t_0(ji,jj,jk-1)) * tmask(ji,jj,jk-1)
+               END DO
+            END DO
+         END DO
+      ENDIF
+      !
+      ! Output interface depth anomaly:
+      ! -------------------------------
+      IF ( iom_use("depw_tilde") ) CALL iom_put( "depw_tilde", (zwdw(:,:,:)-gdepw_0(:,:,:))*tmask(:,:,:) )
+      !
+      ! Output grid stiffness (T-points):
+      ! ---------------------------------
+      IF ( iom_use("stiff_tilde"  ) ) THEN
+         zr1(:)   = 0.e0
+         zout(:,:,:) = 0.e0   
+         zout2d(:,:) = 0.e0   
+         DO ji = 2, jpim1
+            DO jj = 2, jpjm1
+               ! Exclude last level because of partial bottom cells
+               jkbot = MIN(mbkt(ji,jj)-1,mbkt(ji-1,jj)-1,mbkt(ji+1,jj)-1,mbkt(ji,jj-1)-1,mbkt(ji,jj+1)-1)
+               DO jk = 1, jkbot
+                  zr1(1) = umask(ji-1,jj  ,jk) *abs( (zwdw(ji  ,jj  ,jk  )-zwdw(ji-1,jj  ,jk  )  & 
+                       &                             +zwdw(ji  ,jj  ,jk+1)-zwdw(ji-1,jj  ,jk+1)) &
+                       &                            /(zwdw(ji  ,jj  ,jk  )+zwdw(ji-1,jj  ,jk  )  &
+                       &                             -zwdw(ji  ,jj  ,jk+1)-zwdw(ji-1,jj  ,jk+1) + rsmall) )
+                  zr1(2) = umask(ji  ,jj  ,jk) *abs( (zwdw(ji+1,jj  ,jk  )-zwdw(ji  ,jj  ,jk  )  &
+                       &                             +zwdw(ji+1,jj  ,jk+1)-zwdw(ji  ,jj  ,jk+1)) &
+                       &                            /(zwdw(ji+1,jj  ,jk  )+zwdw(ji  ,jj  ,jk  )  &
+                       &                             -zwdw(ji+1,jj  ,jk+1)-zwdw(ji  ,jj  ,jk+1) + rsmall) )
+                  zr1(3) = vmask(ji  ,jj  ,jk) *abs( (zwdw(ji  ,jj+1,jk  )-zwdw(ji  ,jj  ,jk  )  &
+                       &                             +zwdw(ji  ,jj+1,jk+1)-zwdw(ji  ,jj  ,jk+1)) &
+                       &                            /(zwdw(ji  ,jj+1,jk  )+zwdw(ji  ,jj  ,jk  )  &
+                       &                             -zwdw(ji  ,jj+1,jk+1)-zwdw(ji  ,jj  ,jk+1) + rsmall) )
+                  zr1(4) = vmask(ji  ,jj-1,jk) *abs( (zwdw(ji  ,jj  ,jk  )-zwdw(ji  ,jj-1,jk  )  &
+                       &                             +zwdw(ji  ,jj  ,jk+1)-zwdw(ji  ,jj-1,jk+1)) &
+                       &                            /(zwdw(ji  ,jj  ,jk  )+zwdw(ji  ,jj-1,jk  )  &
+                       &                             -zwdw(ji,  jj  ,jk+1)-zwdw(ji  ,jj-1,jk+1) + rsmall) )
+                  ztmp1 = MAXVAL( zr1(1:4) )
+                  zout(ji,jj,jk) = ztmp1
+                  zout2d(ji,jj)  = MAX( zout2d(ji,jj), ztmp1 )
+               END DO
+            END DO
+         END DO
+         CALL lbc_lnk( zout2d(:,:), 'T', 1. )
+         CALL iom_put( "stiff_tilde", zout2d(:,:) ) 
+      END IF
+      ! Output Horizontal Laplacian of interfaces depths (W-points):
+      ! ------------------------------------------------------------
+      IF ( iom_use("dh_tilde")   ) THEN
+         !
+         zout(:,:,1  )=0._wp
+         zout(:,:,:)=0._wp
+         DO jk = 2, jpkm1
+            DO jj = 1, jpjm1
+               DO ji = 1, fs_jpim1   ! vector opt.                  
+                  ua(ji,jj,jk) =  umask(ji,jj,jk) * e2_e1u(ji,jj) &
+                                  &  * ( zwdw(ji,jj,jk) - zwdw(ji+1,jj  ,jk) )
+                  va(ji,jj,jk) =  vmask(ji,jj,jk) * e1_e2v(ji,jj) & 
+                                  &  * ( zwdw(ji,jj,jk) - zwdw(ji  ,jj+1,jk) )
+               END DO
+            END DO
+         END DO
+            
+         DO jk = 2, jpkm1
+            DO jj = 2, jpjm1
+               DO ji = fs_2, fs_jpim1   ! vector opt.
+                  ztmp1 = ( (ua(ji-1,jj  ,jk) - ua(ji,jj,jk))    &
+                     &  +   (va(ji  ,jj-1,jk) - va(ji,jj,jk)) ) * SQRT(r1_e1e2t(ji,jj))
+                  zout(ji,jj,jk) = ABS(ztmp1)*tmask(ji,jj,jk)           
+               END DO
+            END DO
+         END DO 
+         ! Mask open boundaries:
+#if defined key_bdy
+         IF (lk_bdy) THEN
+            DO jk = 1, jpkm1
+               zout(:,:,jk) = zout(:,:,jk) * bdytmask(:,:)
+            END DO
+         ENDIF
+#endif
+         zout2d(:,:) = 0.e0 
+         DO jk=1,jpkm1
+            zout2d(:,:) = max( zout2d(:,:), zout(:,:,jk))
+         END DO
+         CALL lbc_lnk( zout2d(:,:), 'T', 1. )
+         !
+         CALL iom_put( "dh_tilde", zout2d(:,:) )
+      ENDIF
+      !
+      ! Output vertical Laplacian of interfaces depths (W-points):
+      ! ----------------------------------------------------------
+      IF ( iom_use("dz_tilde"  ) ) THEN
+         zout(:,:,1  ) = 0._wp
+         zout(:,:,:) = 0._wp
+         DO ji = 2, jpim1
+            DO jj = 2, jpjm1
+               DO jk=2,mbkt(ji,jj)-1
+                  zout(ji,jj,jk) = 2._wp*ABS(tilde_e3t_n(ji,jj,jk)+e3t_0(ji,jj,jk)-tilde_e3t_n(ji,jj,jk-1)-e3t_0(ji,jj,jk-1)) & 
+                                  &   /(tilde_e3t_n(ji,jj,jk)+e3t_0(ji,jj,jk)+tilde_e3t_n(ji,jj,jk-1)+e3t_0(ji,jj,jk-1)) &
+                                  &   * tmask(ji,jj,jk)
+               END DO 
+            END DO
+         END DO
+         zout2d(:,:) = 0.e0 
+         DO jk=1,jpkm1
+            zout2d(:,:) = max( zout2d(:,:), zout(:,:,jk))
+         END DO
+         CALL lbc_lnk( zout2d(:,:), 'T', 1. )
+         CALL iom_put( "dz_tilde", zout2d(:,:) ) 
+
+      END IF
+      !
+      !
+      ! Output low pass U-velocity:
+      ! ---------------------------
+      IF ( iom_use("un_lf_tilde"  ).AND.ln_vvl_ztilde ) THEN
+         zout(:,:,jpk) = 0.e0  
+         DO jk=1,jpkm1
+            zout(:,:,jk) = un_lf(:,:,jk,1)/e3u_n(:,:,jk)*r1_e2u(:,:)
+         END DO
+         CALL iom_put( "un_lf_tilde", zout(:,:,:) )
+      END IF
+      !
+      ! Output low pass V-velocity:
+      ! ---------------------------
+      IF ( iom_use("vn_lf_tilde"  ).AND.ln_vvl_ztilde ) THEN
+         zout(:,:,jpk) = 0.e0  
+         DO jk=1,jpkm1
+            zout(:,:,jk) = vn_lf(:,:,jk,1)/e3v_n(:,:,jk)*r1_e1v(:,:)
+         END DO
+         CALL iom_put( "vn_lf_tilde", zout(:,:,:) )
+      END IF   
+      !
+      ! Barotropic cell thickness anomaly:
+      ! ---------------------------------- 
+      IF( iom_use("e3t_star") ) THEN
+         zout(:,:,:) = (e3t_n(:,:,:)-tilde_e3t_n(:,:,:)-e3t_0(:,:,:))*tmask(:,:,:) 
+         CALL iom_put( "e3t_star" , zout(:,:,:) )
+      ENDIF
+      !
+      ! Baroclinic cell thickness anomaly:
+      ! ---------------------------------- 
+      IF( iom_use("e3t_tilde") )  THEN
+         CALL iom_put( "e3t_tilde" , tilde_e3t_n(:,:,:) )
+      ENDIF
+      !
+      IF( ln_timing )  CALL timing_stop('dom_vvl_dia')
+      !
+   END SUBROUTINE dom_vvl_dia
+
    !!======================================================================
 END MODULE domvvl
