Index: branches/2011/dev_r2739_LOCEAN8_ZTC/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90
===================================================================
--- branches/2011/dev_r2739_LOCEAN8_ZTC/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 2905)
+++ branches/2011/dev_r2739_LOCEAN8_ZTC/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 2917)
@@ -90,5 +90,5 @@
       END IF
       !
-      ! - ML - only used in domvvl but could be usefull in many routines
+      ! - ML - Used in domvvl and traldf_(lab/bilap/iso) but could be usefull in many other modules
       e12t  (:,:) = e1t(:,:) * e2t(:,:)
       e12u  (:,:) = e1u(:,:) * e2u(:,:)
@@ -96,5 +96,4 @@
       e12v_1(:,:) = 0.5 / ( e1v(:,:) * e2v(:,:) )
       e12f_1(:,:) = 0.5 / ( e1f(:,:) * e2f(:,:) )
-      ! - ML - used in domvvl and traldf_(lab/bilap/iso)
       e1ur  (:,:) = e2u(:,:) / e1u(:,:)
       e2vr  (:,:) = e1v(:,:) / e2v(:,:)
Index: branches/2011/dev_r2739_LOCEAN8_ZTC/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90
===================================================================
--- branches/2011/dev_r2739_LOCEAN8_ZTC/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90	(revision 2905)
+++ branches/2011/dev_r2739_LOCEAN8_ZTC/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90	(revision 2917)
@@ -72,8 +72,11 @@
       !!----------------------------------------------------------------------
       IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN
-         ALLOCATE(                                                                                             &
-            &      un_td  (jpi,jpj,jpk) , vn_td  (jpi,jpj,jpk) , hdiv_lf(jpi,jpj,jpk) ,                        &
-            &      e3t_t_b(jpi,jpj,jpk) , e3t_t_n(jpi,jpj,jpk) , e3t_t_a(jpi,jpj,jpk) ,                        &
-            &      frq_restore_e3t(jpi,jpj) , frq_restore_hdv(jpi,jpj)                , STAT= dom_vvl_alloc )
+         ALLOCATE( e3t_t_n(jpi,jpj,jpk) , e3t_t_a(jpi,jpj,jpk) , e3t_t_b(jpi,jpj,jpk) ,   &
+            &      un_td  (jpi,jpj,jpk) , vn_td  (jpi,jpj,jpk) , STAT = dom_vvl_alloc        )
+         IF( lk_mpp             )   CALL mpp_sum ( dom_vvl_alloc )
+         IF( dom_vvl_alloc /= 0 )   CALL ctl_warn('dom_vvl_alloc: failed to allocate arrays')
+      ENDIF
+      IF( ln_vvl_ztilde ) THEN
+         ALLOCATE( frq_restore_e3t(jpi,jpj) , frq_restore_hdv(jpi,jpj) , hdiv_lf(jpi,jpj,jpk) , STAT= dom_vvl_alloc )
          IF( lk_mpp             )   CALL mpp_sum ( dom_vvl_alloc )
          IF( dom_vvl_alloc /= 0 )   CALL ctl_warn('dom_vvl_alloc: failed to allocate arrays')
@@ -166,4 +169,20 @@
       END DO
 
+      ! Restoring frequencies for z_tilde coordinate
+      ! ============================================
+      IF( ln_vvl_ztilde ) THEN
+         ! - ML - In the future, this should be tunable by the user
+         ! DO jj = 1, jpj
+         !    DO ji = 1, jpi
+         !       frq_restore_hdv(ji,jj) = 2.e0 * rpi / 86400.e0 / 5.e0   &
+         !          &                     * MAX( SIN( ABS( gphit(ji,jj) ) / .5e0, 1.e0 / 6.e0) )
+         !    END DO
+         ! END DO
+         ! frq_restore_e3t(:,:) = ( 1.e0 / 6.e0 ) * frq_restore_hdv(:,:)
+         frq_restore_e3t(:,:) = 2.e0 * rpi / ( 30.e0 * 86400.e0 )
+         frq_restore_hdv(:,:) = 2.e0 * rpi / (  5.e0 * 86400.e0 )
+         ! frq_restore_hdv(:,:) = 2.e0 * rpi / (  2.e0 * 86400.e0 )
+      ENDIF
+
    END SUBROUTINE dom_vvl_init
 
@@ -220,32 +239,19 @@
       ! After acale factors at t-points !
       ! ******************************* !
-      !                                             !----------------------------!
-      IF( ln_vvl_ztilde .OR. ln_vvl_layer )  THEN   ! ZTILDE or LAYER coordinate !
-         !                                          !----------------------------!
-
-         ! I - Initialisations
-         ! ===================
-         IF( kt == nit000 ) THEN
-            ! - ML - In the future, this should be tunable by the user
-            IF( ln_vvl_ztilde ) THEN       ! ZTILDE CASE
-               ! DO jj = 1, jpj
-               !    DO ji = 1, jpi
-               !       frq_restore_hdv(ji,jj) = 2.e0 * rpi / 86400.e0 / 5.e0   &
-               !          &                     * MAX( SIN( ABS( gphit(ji,jj) ) / .5e0, 1.e0 / 6.e0) )
-               !    END DO
-               ! END DO
-               ! frq_restore_e3t(:,:) = ( 1.e0 / 6.e0 ) * frq_restore_hdv(:,:)
-               frq_restore_e3t(:,:) = 2.e0 * rpi / ( 30.e0 * 86400.e0 )
-               frq_restore_hdv(:,:) = 2.e0 * rpi / (  5.e0 * 86400.e0 )
-               ! frq_restore_hdv(:,:) = 2.e0 * rpi / (  2.e0 * 86400.e0 )
-            ELSE                           ! LAYER CASE
-               frq_restore_e3t(:,:) = 0.e0
-               frq_restore_hdv(:,:) = 0.e0
-            ENDIF
-
-         ENDIF
-
-         ! II - Low frequency horizontal divergence
-         ! ========================================
+
+      !                               ! ----------------- !
+      IF( ln_vvl_zstar ) THEN         ! z_star coordinate !
+         !                            ! ----------------- !
+         z_scale(:,:) = ( ssha(:,:) - sshb(:,:) ) * tmask(:,:,1) / ( ht_0(:,:) + sshn(:,:) + 1. - tmask(:,:,1) )
+         DO jk = 1, jpkm1
+            fse3t_a(:,:,jk) = fse3t_b(:,:,jk) + fse3t_n(:,:,jk) * z_scale(:,:)
+         END DO
+
+      !                               ! --------------------------- !
+      ELSE                            ! z_tilde or layer coordinate !
+         !                            ! --------------------------- !
+
+         ! I - Low frequency horizontal divergence
+         ! =======================================
 
          ! 1 - barotropic divergence
@@ -259,28 +265,38 @@
          zhdiv(:,:) = zhdiv(:,:) / ( zht(:,:) + 1. - tmask(:,:,1) )
 
-         ! 2 - restoring equation
+         ! 2 - restoring equation  (z-tilde case only)
          ! ----------------------
-         IF( kt .GT. nit000 ) THEN
-            DO jk = 1, jpkm1
-               hdiv_lf(:,:,jk) = hdiv_lf(:,:,jk) - rdt * frq_restore_hdv(:,:)   &
-                  &          * ( hdiv_lf(:,:,jk) - fse3t_n(:,:,jk) * ( hdivn(:,:,jk) - zhdiv(:,:) ) )
-            END DO
-         ENDIF
-
-         ! III - after z_tilde increments of vertical scale factors
-         ! =========================================================
+         IF( ln_vvl_ztilde ) THEN
+            IF( kt .GT. nit000 ) THEN
+               DO jk = 1, jpkm1
+                  hdiv_lf(:,:,jk) = hdiv_lf(:,:,jk) - rdt * frq_restore_hdv(:,:)   &
+                     &          * ( hdiv_lf(:,:,jk) - fse3t_n(:,:,jk) * ( hdivn(:,:,jk) - zhdiv(:,:) ) )
+               END DO
+            ENDIF
+         END IF
+
+         ! II - after z_tilde increments of vertical scale factors
+         ! =======================================================
          e3t_t_a(:,:,:) = 0.e0   ! e3t_t_a used to store tendency terms
 
          ! 1 - High frequency divergence term
          ! ----------------------------------
-         DO jk = 1, jpkm1
-            e3t_t_a(:,:,jk) = e3t_t_a(:,:,jk) - ( fse3t_n(:,:,jk) * ( hdivn(:,:,jk) - zhdiv(:,:) ) - hdiv_lf(:,:,jk) )
-         END DO
-
-         ! 2 - Restoring term
+         IF( ln_vvl_ztilde ) THEN   ! z_tilde case
+            DO jk = 1, jpkm1
+               e3t_t_a(:,:,jk) = e3t_t_a(:,:,jk) - ( fse3t_n(:,:,jk) * ( hdivn(:,:,jk) - zhdiv(:,:) ) - hdiv_lf(:,:,jk) )
+            END DO                  ! layer case
+         ELSE
+            DO jk = 1, jpkm1
+               e3t_t_a(:,:,jk) = e3t_t_a(:,:,jk) - fse3t_n(:,:,jk) * ( hdivn(:,:,jk) - zhdiv(:,:) )
+            END DO
+         END IF
+
+         ! 2 - Restoring term (z-tilde case only)
          ! ------------------
-         DO jk = 1, jpk
-            e3t_t_a(:,:,jk) = e3t_t_a(:,:,jk) - frq_restore_e3t(:,:) * e3t_t_b(:,:,jk)
-         END DO
+         IF( ln_vvl_ztilde ) THEN
+            DO jk = 1, jpk
+               e3t_t_a(:,:,jk) = e3t_t_a(:,:,jk) - frq_restore_e3t(:,:) * e3t_t_b(:,:,jk)
+            END DO
+         END IF
 
          ! 3 - Thickness diffusion term
@@ -288,5 +304,4 @@
          zwu(:,:) = 0.e0
          zwv(:,:) = 0.e0
-
          ! a - first derivative: diffusive fluxes
          DO jk = 1, jpkm1
@@ -318,5 +333,5 @@
          END DO
          ! d - thickness diffusion equivalent transport: boundary conditions
-         !     (stored for tracer advaction and continuity equation)
+         !     (stored for tracer advction and continuity equation)
          CALL lbc_lnk( un_td , 'U' , -1.)
          CALL lbc_lnk( vn_td , 'V' , -1.)
@@ -331,5 +346,5 @@
             z2dt = 2.e0 * rdt
          ENDIF
-         CALL lbc_lnk( e3t_t_a(:,:,:), 'T', 1. )    ! - ML - Do not use lbc_lnk_e3: e3t_t_a is a tendency term at this stage
+         CALL lbc_lnk( e3t_t_a(:,:,:), 'T', 1. )
          e3t_t_a(:,:,:) = e3t_t_b(:,:,:) + z2dt * tmask(:,:,:) * e3t_t_a(:,:,:)
          fse3t_a(:,:,:) = fse3t_0(:,:,:) + e3t_t_a(:,:,:)
@@ -360,15 +375,9 @@
          e3t_t_a(:,:,:) = MAX( e3t_t_a(:,:,:), ( 1.e0 - z_def_max ) * fse3t_0(:,:,:) )
 
-         ! Boundary conditions
-         ! ~~~~~~~~~~~~~~~~~~~
-         ! - ML - think it's not necessary
-         ! CALL lbc_lnk( e3t_t_a(:,:,:), 'T', 1. )    ! - ML - Do not use lbc_lnk_e3: e3t_t_a is a level thickness ANOMALY
-
-         ! IV - Barotropic repartition of the sea surface height over the baroclinic profile
-         ! =================================================================================
+         ! III - Barotropic repartition of the sea surface height over the baroclinic profile
+         ! ==================================================================================
          ! add e3t(n-1) "star" Asselin-filtered
          DO jk = 1, jpkm1
-            ! - ML - : multiplication by tmask not necessary a priori. Just to be sure for the moment.
-            fse3t_a(:,:,jk) = fse3t_a(:,:,jk) + ( fse3t_b(:,:,jk) - fse3t_0(:,:,jk) - e3t_t_b(:,:,jk) ) * tmask(:,:,jk)
+            fse3t_a(:,:,jk) = fse3t_a(:,:,jk) + fse3t_b(:,:,jk) - fse3t_0(:,:,jk) - e3t_t_b(:,:,jk)
          END DO
          ! add ( ssh increment + "baroclinicity error" ) proportionnaly to e3t(n)
@@ -382,12 +391,4 @@
          DO jk = 1, jpkm1
             fse3t_a(:,:,jk) = fse3t_a(:,:,jk) + fse3t_n(:,:,jk) * z_scale(:,:) * tmask(:,:,jk)
-         END DO
-
-         !                                !------------------!
-      ELSEIF( ln_vvl_zstar ) THEN         ! Zstar coordinate !
-         !                                !------------------!
-         z_scale(:,:) = ( ssha(:,:) - sshb(:,:) ) * tmask(:,:,1) / ( ht_0(:,:) + sshn(:,:) + 1. - tmask(:,:,1) )
-         DO jk = 1, jpkm1
-            fse3t_a(:,:,jk) = fse3t_b(:,:,jk) + fse3t_n(:,:,jk) * z_scale(:,:)
          END DO
 
@@ -659,42 +660,43 @@
             id4 = iom_varid( numror, 'e3t_t_n', ldstop = .FALSE. )
             id5 = iom_varid( numror, 'hdif_lf', ldstop = .FALSE. )
-
-            !                         ! ----------- !
-            IF( ln_vvl_zstar ) THEN   ! z_star case !
-               !                      ! ----------- !
-               IF( MIN( id1, id2 ) > 0 ) THEN       ! all required arrays exist
-                  CALL iom_get( numror, jpdom_autoglo, 'fse3t_b', fse3t_b(:,:,:) )
-                  CALL iom_get( numror, jpdom_autoglo, 'fse3t_n', fse3t_n(:,:,:) )
-                  IF( neuler == 0 ) THEN
-                     fse3t_b(:,:,:) = fse3t_n(:,:,:)
-                  ENDIF
-               ELSE                                 ! one at least array is missing
-                  CALL ctl_stop( 'vvl cannot restart from a non vvl run' )
+            !                             ! --------- !
+            !                             ! all cases !
+            !                             ! --------- !
+            IF( MIN( id1, id2 ) > 0 ) THEN       ! all required arrays exist
+               CALL iom_get( numror, jpdom_autoglo, 'fse3t_b', fse3t_b(:,:,:) )
+               CALL iom_get( numror, jpdom_autoglo, 'fse3t_n', fse3t_n(:,:,:) )
+               IF( neuler == 0 ) THEN
+                  fse3t_b(:,:,:) = fse3t_n(:,:,:)
                ENDIF
-               IF( MIN( id3, id4, id5 ) > 0 ) CALL ctl_stop( 'z_star coordinate cannot restart from a z_tilde run' )
-               !                      ! ------------ !
-            ELSE                      ! z_tilde case !
-               !                      ! ------------ !
-               IF( MIN( id1, id2 ) > 0 ) THEN       ! all required arrays exist
-                  CALL iom_get( numror, jpdom_autoglo, 'fse3t_b', fse3t_b(:,:,:) )
-                  CALL iom_get( numror, jpdom_autoglo, 'fse3t_n', fse3t_n(:,:,:) )
-                  IF( neuler == 0 ) THEN
-                     fse3t_b(:,:,:) = fse3t_n(:,:,:)
-                  ENDIF
-               ELSE                                 ! one at least array is missing
-                  CALL ctl_stop( 'vvl cannot restart from a non vvl run' )
+            ELSE                                 ! one at least array is missing
+               CALL ctl_stop( 'dom_vvl_rst: vvl cannot restart from a non vvl run' )
+            ENDIF
+            !                             ! ----------- !
+            IF( ln_vvl_zstar ) THEN       ! z_star case !
+               !                          ! ----------- !
+               IF( MIN( id3, id4 ) > 0 ) THEN
+                  CALL ctl_stop( 'dom_vvl_rst: z_star cannot restart from a z_tilde or layer run' )
                ENDIF
-               IF( MIN( id3, id4, id5 ) > 0 ) THEN  ! all required arrays exist
+               !                          ! ----------------------- !
+            ELSE                          ! z_tilde and layer cases !
+               !                          ! ----------------------- !
+               IF( MIN( id3, id4 ) > 0 ) THEN  ! all required arrays exist
                   CALL iom_get( numror, jpdom_autoglo, 'e3t_t_b', e3t_t_b(:,:,:) )
                   CALL iom_get( numror, jpdom_autoglo, 'e3t_t_n', e3t_t_n(:,:,:) )
-                  CALL iom_get( numror, jpdom_autoglo, 'hdiv_lf', hdiv_lf(:,:,:) )
-               ELSE                                 ! one at least array is missing
+               ELSE                            ! one at least array is missing
                   e3t_t_b(:,:,:) = 0.e0
                   e3t_t_n(:,:,:) = 0.e0
-                  hdiv_lf(:,:,:) = 0.e0
                ENDIF
-
+               !                          ! ------------ !
+               IF( ln_vvl_ztilde ) THEN   ! z_tilde case !
+                  !                       ! ------------ !
+                  IF( id5 > 0 ) THEN  ! required array exists
+                     CALL iom_get( numror, jpdom_autoglo, 'hdiv_lf', hdiv_lf(:,:,:) )
+                  ELSE                ! array is missing
+                     hdiv_lf(:,:,:) = 0.e0
+                  ENDIF
+               ENDIF
             ENDIF
-
+            !
          ELSE                                   !* Initialize at "rest"
             fse3t_b(:,:,:) = fse3t_0(:,:,:)
@@ -708,14 +710,18 @@
          !                                   ! ===================
          IF(lwp) WRITE(numout,*) '---- dom_vvl_rst ----'
-         !                                         ! ---------------------- !
-         !                                         ! z_star & z_tilde cases !
-         !                                         ! ---------------------- !
+         !                                           ! --------- !
+         !                                           ! all cases !
+         !                                           ! --------- !
          CALL iom_rstput( kt, nitrst, numrow, 'fse3t_b', fse3t_b(:,:,:) )
          CALL iom_rstput( kt, nitrst, numrow, 'fse3t_n', fse3t_n(:,:,:) )
-         !                                           ! ----------------- !
-         IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN  ! z_tilde case only !
-            !                                        ! ----------------- !
+         !                                           ! ----------------------- !
+         IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN  ! z_tilde and layer cases !
+            !                                        ! ----------------------- !
             CALL iom_rstput( kt, nitrst, numrow, 'e3t_t_b', e3t_t_b(:,:,:) )
             CALL iom_rstput( kt, nitrst, numrow, 'e3t_t_n', e3t_t_n(:,:,:) )
+         END IF
+         !                                           ! -------------!    
+         IF( ln_vvl_ztilde ) THEN                    ! z_tilde case !
+            !                                        ! ------------ !
             CALL iom_rstput( kt, nitrst, numrow, 'hdiv_lf', hdiv_lf(:,:,:) )
          ENDIF
Index: branches/2011/dev_r2739_LOCEAN8_ZTC/NEMOGCM/NEMO/OPA_SRC/step.F90
===================================================================
--- branches/2011/dev_r2739_LOCEAN8_ZTC/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 2905)
+++ branches/2011/dev_r2739_LOCEAN8_ZTC/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 2917)
@@ -107,4 +107,5 @@
       IF( lk_vvl     )   CALL dom_vvl_sf_nxt( kstp )  ! after vertical scale factors
                          CALL wzv           ( kstp )  ! now cross-level velocity
+
       !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
       ! Ocean physics update                (ua, va, ta, sa used as workspace)
