Index: NEMO/trunk/src/OCE/DOM/domvvl.F90
===================================================================
--- NEMO/trunk/src/OCE/DOM/domvvl.F90	(revision 14086)
+++ NEMO/trunk/src/OCE/DOM/domvvl.F90	(revision 14125)
@@ -2,5 +2,5 @@
    !!======================================================================
    !!                       ***  MODULE domvvl   ***
-   !! Ocean : 
+   !! Ocean :
    !!======================================================================
    !! History :  2.0  !  2006-06  (B. Levier, L. Marie)  original code
@@ -26,9 +26,4 @@
    USE timing          ! Timing
 
-#if defined key_agrif
-   USE agrif_oce       ! initial state interpolation
-   USE agrif_oce_interp 
-#endif
-
    IMPLICIT NONE
    PRIVATE
@@ -63,5 +58,5 @@
    !!   Default key      Old management of time varying vertical coordinate
    !!----------------------------------------------------------------------
-   
+
    !!----------------------------------------------------------------------
    !!   dom_vvl_init     : define initial vertical scale factors, depths and column thickness
@@ -78,5 +73,5 @@
    PUBLIC  dom_vvl_sf_update  ! called by step.F90
    PUBLIC  dom_vvl_interpol   ! called by dynnxt.F90
-   
+
    !! * Substitutions
 #  include "do_loop_substitute.h90"
@@ -114,5 +109,5 @@
       !!----------------------------------------------------------------------
       !!                ***  ROUTINE dom_vvl_init  ***
-      !!                   
+      !!
       !! ** Purpose :  Initialization of all scale factors, depths
       !!               and water column heights
@@ -123,8 +118,8 @@
       !! ** Action  : - e3t_(n/b) and tilde_e3t_(n/b)
       !!              - Regrid: e3[u/v](:,:,:,Kmm)
-      !!                        e3[u/v](:,:,:,Kmm)       
-      !!                        e3w(:,:,:,Kmm)           
+      !!                        e3[u/v](:,:,:,Kmm)
+      !!                        e3w(:,:,:,Kmm)
       !!                        e3[u/v]w_b
-      !!                        e3[u/v]w_n      
+      !!                        e3[u/v]w_n
       !!                        gdept(:,:,:,Kmm), gdepw(:,:,:,Kmm) and gde3w
       !!              - h(t/u/v)_0
@@ -156,6 +151,6 @@
       !!----------------------------------------------------------------------
       !!                ***  ROUTINE dom_vvl_init  ***
-      !!                   
-      !! ** Purpose :  Interpolation of all scale factors, 
+      !!
+      !! ** Purpose :  Interpolation of all scale factors,
       !!               depths and water column heights
       !!
@@ -164,8 +159,8 @@
       !! ** Action  : - e3t_(n/b) and tilde_e3t_(n/b)
       !!              - Regrid: e3(u/v)_n
-      !!                        e3(u/v)_b       
-      !!                        e3w_n           
-      !!                        e3(u/v)w_b      
-      !!                        e3(u/v)w_n      
+      !!                        e3(u/v)_b
+      !!                        e3w_n
+      !!                        e3(u/v)w_b
+      !!                        e3(u/v)w_n
       !!                        gdept_n, gdepw_n and gde3w_n
       !!              - h(t/u/v)_0
@@ -185,8 +180,8 @@
       CALL dom_vvl_interpol( e3t(:,:,:,Kbb), e3u(:,:,:,Kbb), 'U' )    ! from T to U
       CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3u(:,:,:,Kmm), 'U' )
-      CALL dom_vvl_interpol( e3t(:,:,:,Kbb), e3v(:,:,:,Kbb), 'V' )    ! from T to V 
+      CALL dom_vvl_interpol( e3t(:,:,:,Kbb), e3v(:,:,:,Kbb), 'V' )    ! from T to V
       CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3v(:,:,:,Kmm), 'V' )
       CALL dom_vvl_interpol( e3u(:,:,:,Kmm), e3f(:,:,:), 'F' )    ! from U to F
-      !                                ! Vertical interpolation of e3t,u,v 
+      !                                ! Vertical interpolation of e3t,u,v
       CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3w (:,:,:,Kmm), 'W'  )  ! from T to W
       CALL dom_vvl_interpol( e3t(:,:,:,Kbb), e3w (:,:,:,Kbb), 'W'  )
@@ -210,14 +205,14 @@
          !    zcoef = tmask - wmask    ! 0 everywhere tmask = wmask, ie everywhere expect at jk = mikt
          !                             ! 1 everywhere from mbkt to mikt + 1 or 1 (if no isf)
-         !                             ! 0.5 where jk = mikt     
+         !                             ! 0.5 where jk = mikt
 !!gm ???????   BUG ?  gdept(:,:,:,Kmm) as well as gde3w  does not include the thickness of ISF ??
          zcoef = ( tmask(ji,jj,jk) - wmask(ji,jj,jk) )
          gdepw(ji,jj,jk,Kmm) = gdepw(ji,jj,jk-1,Kmm) + e3t(ji,jj,jk-1,Kmm)
          gdept(ji,jj,jk,Kmm) =      zcoef  * ( gdepw(ji,jj,jk  ,Kmm) + 0.5 * e3w(ji,jj,jk,Kmm))  &
-            &                + (1-zcoef) * ( gdept(ji,jj,jk-1,Kmm) +       e3w(ji,jj,jk,Kmm)) 
+            &                + (1-zcoef) * ( gdept(ji,jj,jk-1,Kmm) +       e3w(ji,jj,jk,Kmm))
          gde3w(ji,jj,jk) = gdept(ji,jj,jk,Kmm) - ssh(ji,jj,Kmm)
          gdepw(ji,jj,jk,Kbb) = gdepw(ji,jj,jk-1,Kbb) + e3t(ji,jj,jk-1,Kbb)
          gdept(ji,jj,jk,Kbb) =      zcoef  * ( gdepw(ji,jj,jk  ,Kbb) + 0.5 * e3w(ji,jj,jk,Kbb))  &
-            &                + (1-zcoef) * ( gdept(ji,jj,jk-1,Kbb) +       e3w(ji,jj,jk,Kbb)) 
+            &                + (1-zcoef) * ( gdept(ji,jj,jk-1,Kbb) +       e3w(ji,jj,jk,Kbb))
       END_3D
       !
@@ -278,5 +273,5 @@
             IF( cn_cfg == "orca" .OR. cn_cfg == "ORCA" ) THEN
                IF( nn_cfg == 3 ) THEN   ! ORCA2: Suppress ztilde in the Foxe Basin for ORCA2
-                  ii0 = 103 + nn_hls - 1   ;   ii1 = 111 + nn_hls - 1      
+                  ii0 = 103 + nn_hls - 1   ;   ii1 = 111 + nn_hls - 1
                   ij0 = 128 + nn_hls       ;   ij1 = 135 + nn_hls
                   frq_rst_e3t( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) =  0.0_wp
@@ -290,13 +285,13 @@
 
 
-   SUBROUTINE dom_vvl_sf_nxt( kt, Kbb, Kmm, Kaa, kcall ) 
+   SUBROUTINE dom_vvl_sf_nxt( kt, Kbb, Kmm, Kaa, kcall )
       !!----------------------------------------------------------------------
       !!                ***  ROUTINE dom_vvl_sf_nxt  ***
-      !!                   
+      !!
       !! ** Purpose :  - compute the after scale factors used in tra_zdf, dynnxt,
       !!                 tranxt and dynspg routines
       !!
       !! ** Method  :  - z_star case:  Repartition of ssh INCREMENT proportionnaly to the level thickness.
-      !!               - z_tilde_case: after scale factor increment = 
+      !!               - z_tilde_case: after scale factor increment =
       !!                                    high frequency part of horizontal divergence
       !!                                  + retsoring towards the background grid
@@ -306,5 +301,5 @@
       !!
       !! ** Action  :  - hdiv_lf    : restoring towards full baroclinic divergence in z_tilde case
-      !!               - tilde_e3t_a: after increment of vertical scale factor 
+      !!               - tilde_e3t_a: after increment of vertical scale factor
       !!                              in z_tilde case
       !!               - e3(t/u/v)_a
@@ -410,5 +405,5 @@
             un_td(ji,jj,jk) = rn_ahe3 * umask(ji,jj,jk) * e2_e1u(ji,jj)           &
                &            * ( tilde_e3t_b(ji,jj,jk) - tilde_e3t_b(ji+1,jj  ,jk) )
-            vn_td(ji,jj,jk) = rn_ahe3 * vmask(ji,jj,jk) * e1_e2v(ji,jj)           & 
+            vn_td(ji,jj,jk) = rn_ahe3 * vmask(ji,jj,jk) * e1_e2v(ji,jj)           &
                &            * ( tilde_e3t_b(ji,jj,jk) - tilde_e3t_b(ji  ,jj+1,jk) )
             zwu(ji,jj) = zwu(ji,jj) + un_td(ji,jj,jk)
@@ -455,5 +450,5 @@
                WRITE(numout, *) 'at i, j, k=', ijk_max
                WRITE(numout, *) 'MIN( tilde_e3t_a(:,:,:) / e3t_0(:,:,:) ) =', z_tmin
-               WRITE(numout, *) 'at i, j, k=', ijk_min            
+               WRITE(numout, *) 'at i, j, k=', ijk_min
                CALL ctl_stop( 'STOP', 'MAX( ABS( tilde_e3t_a(:,:,: ) ) / e3t_0(:,:,:) ) too high')
             ENDIF
@@ -571,6 +566,6 @@
       !!----------------------------------------------------------------------
       !!                ***  ROUTINE dom_vvl_sf_update  ***
-      !!                   
-      !! ** Purpose :  for z tilde case: compute time filter and swap of scale factors 
+      !!
+      !! ** Purpose :  for z tilde case: compute time filter and swap of scale factors
       !!               compute all depths and related variables for next time step
       !!               write outputs and restart file
@@ -582,8 +577,8 @@
       !! ** Action  :  - tilde_e3t_(b/n) ready for next time step
       !!               - Recompute:
-      !!                    e3(u/v)_b       
-      !!                    e3w(:,:,:,Kmm)           
-      !!                    e3(u/v)w_b      
-      !!                    e3(u/v)w_n      
+      !!                    e3(u/v)_b
+      !!                    e3w(:,:,:,Kmm)
+      !!                    e3(u/v)w_b
+      !!                    e3(u/v)w_n
       !!                    gdept(:,:,:,Kmm), gdepw(:,:,:,Kmm)  and gde3w
       !!                    h(u/v) and h(u/v)r
@@ -616,5 +611,5 @@
             tilde_e3t_b(:,:,:) = tilde_e3t_n(:,:,:)
          ELSE
-            tilde_e3t_b(:,:,:) = tilde_e3t_n(:,:,:) & 
+            tilde_e3t_b(:,:,:) = tilde_e3t_n(:,:,:) &
             &         + rn_atfp * ( tilde_e3t_b(:,:,:) - 2.0_wp * tilde_e3t_n(:,:,:) + tilde_e3t_a(:,:,:) )
          ENDIF
@@ -628,7 +623,7 @@
       ! - ML - e3u(:,:,:,Kbb) and e3v(:,:,:,Kbb) are already computed in dynnxt
       ! - JC - hu(:,:,:,Kbb), hv(:,:,:,:,Kbb), hur_b, hvr_b also
-      
+
       CALL dom_vvl_interpol( e3u(:,:,:,Kmm), e3f(:,:,:), 'F'  )
-      
+
       ! Vertical scale factor interpolations
       CALL dom_vvl_interpol( e3t(:,:,:,Kmm),  e3w(:,:,:,Kmm), 'W'  )
@@ -649,5 +644,5 @@
          gdepw(ji,jj,jk,Kmm) = gdepw(ji,jj,jk-1,Kmm) + e3t(ji,jj,jk-1,Kmm)
          gdept(ji,jj,jk,Kmm) =    zcoef  * ( gdepw(ji,jj,jk  ,Kmm) + 0.5 * e3w(ji,jj,jk,Kmm) )  &
-             &             + (1-zcoef) * ( gdept(ji,jj,jk-1,Kmm) +       e3w(ji,jj,jk,Kmm) ) 
+             &             + (1-zcoef) * ( gdept(ji,jj,jk-1,Kmm) +       e3w(ji,jj,jk,Kmm) )
          gde3w(ji,jj,jk) = gdept(ji,jj,jk,Kmm) - ssh(ji,jj,Kmm)
       END_3D
@@ -768,5 +763,5 @@
       !!---------------------------------------------------------------------
       !!                   ***  ROUTINE dom_vvl_rst  ***
-      !!                     
+      !!
       !! ** Purpose :   Read or write VVL file in restart file
       !!
@@ -800,10 +795,4 @@
          IF( ln_rstart ) THEN                   !==  Read the restart file  ==!
             !
-#if defined key_agrif
-            IF ( (.NOT.Agrif_root()).AND.(ln_init_chfrpar) ) THEN
-               ! skip reading restart if initialized from parent:
-               id3 = -1 ; id4 = -1 ; id5 = -1
-            ELSE
-#endif
             CALL rst_read_open                                          !*  open the restart file if necessary
             !                                         ! --------- !
@@ -815,11 +804,8 @@
             id5 = iom_varid( numror, 'hdiv_lf'    , ldstop = .FALSE. )
             !
-#if defined key_agrif
-            ENDIF
-#endif
             !                                                           !*  scale factors
             IF(lwp) WRITE(numout,*)    '          Kmm scale factor read in the restart file'
             CALL iom_get( numror, jpdom_auto, 'e3t_n', e3t(:,:,:,Kmm) )
-            WHERE ( tmask(:,:,:) == 0.0_wp ) 
+            WHERE ( tmask(:,:,:) == 0.0_wp )
                e3t(:,:,:,Kmm) = e3t_0(:,:,:)
             END WHERE
@@ -830,5 +816,5 @@
                IF(lwp) WRITE(numout,*) '          Kbb scale factor read in the restart file'
                CALL iom_get( numror, jpdom_auto, 'e3t_b', e3t(:,:,:,Kbb) )
-               WHERE ( tmask(:,:,:) == 0.0_wp ) 
+               WHERE ( tmask(:,:,:) == 0.0_wp )
                   e3t(:,:,:,Kbb) = e3t_0(:,:,:)
                END WHERE
@@ -854,7 +840,7 @@
                      CALL iom_get( numror, jpdom_auto, 'tilde_e3t_b', tilde_e3t_b(:,:,:) )
                   ENDIF
-               ELSE 
-                 tilde_e3t_b(:,:,:) = 0.0_wp
-                 tilde_e3t_n(:,:,:) = 0.0_wp
+               ELSE
+                  tilde_e3t_b(:,:,:) = 0.0_wp
+                  tilde_e3t_n(:,:,:) = 0.0_wp
                ENDIF
                !                                      ! ------------ !
@@ -864,5 +850,5 @@
                      CALL iom_get( numror, jpdom_auto, 'hdiv_lf', hdiv_lf(:,:,:) )
                   ELSE                ! array is missing
-                     hdiv_lf(:,:,:) = 0.0_wp 
+                     hdiv_lf(:,:,:) = 0.0_wp
                   ENDIF
                ENDIF
@@ -885,17 +871,4 @@
       ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN       !  Create restart file  !
          !                                       !=======================!
-#if defined key_agrif
-         IF ( .NOT.Agrif_root().AND.(ln_init_chfrpar) ) THEN
-            ! Interpolate initial ssh from parent:
-            CALL Agrif_istate_ssh( Kbb, Kmm )
-            !
-            DO jk = 1, jpk
-               e3t(:,:,jk,Kmm) =  e3t_0(:,:,jk) * ( ht_0(:,:) + ssh(:,:,Kmm)  ) &
-                 &                              / ( ht_0(:,:) + 1._wp - ssmask(:,:) ) * tmask(:,:,jk)   &
-                 &              + e3t_0(:,:,jk) * ( 1._wp - tmask(:,:,jk) )
-            END DO
-            e3t(:,:,:,Kbb) = e3t(:,:,:,Kmm)
-         ENDIF
-#endif
          !
          IF(lwp) WRITE(numout,*) '---- dom_vvl_rst ----'
@@ -911,5 +884,5 @@
             CALL iom_rstput( kt, nitrst, numrow, 'tilde_e3t_n', tilde_e3t_n(:,:,:))
          END IF
-         !                                           ! -------------!    
+         !                                           ! -------------!
          IF( ln_vvl_ztilde ) THEN                    ! z_tilde case !
             !                                        ! ------------ !
@@ -925,5 +898,5 @@
       !!---------------------------------------------------------------------
       !!                  ***  ROUTINE dom_vvl_ctl  ***
-      !!                
+      !!
       !! ** Purpose :   Control the consistency between namelist options
       !!                for vertical coordinate
@@ -934,5 +907,5 @@
          &              ln_vvl_zstar_at_eqtor      , rn_ahe3     , rn_rst_e3t            , &
          &              rn_lf_cutoff               , rn_zdef_max , ln_vvl_dbg                ! not yet implemented: ln_vvl_kepe
-      !!---------------------------------------------------------------------- 
+      !!----------------------------------------------------------------------
       !
       READ  ( numnam_ref, nam_vvl, IOSTAT = ios, ERR = 901)
