Index: utils/tools/DOMAINcfg/1_namelist_ref
===================================================================
--- utils/tools/DOMAINcfg/1_namelist_ref	(revision 15162)
+++ utils/tools/DOMAINcfg/1_namelist_ref	(revision 15279)
@@ -171,8 +171,5 @@
 &namagrif      !  AGRIF zoom                                            ("key_agrif")
 !-----------------------------------------------------------------------
-   ln_spc_dyn    = .true.  !  use 0 as special value for dynamics
-   rn_sponge_tra = 2880.   !  coefficient for tracer   sponge layer [m2/s]
-   rn_sponge_dyn = 2880.   !  coefficient for dynamics sponge layer [m2/s]
-   ln_chk_bathy  = .FALSE. !
+   ln_vert_remap = .false. ! volume conserving update 
    npt_connect   = 2
    npt_copy      = 2
Index: utils/tools/DOMAINcfg/2_namelist_ref
===================================================================
--- utils/tools/DOMAINcfg/2_namelist_ref	(revision 15162)
+++ utils/tools/DOMAINcfg/2_namelist_ref	(revision 15279)
@@ -171,8 +171,5 @@
 &namagrif      !  AGRIF zoom                                            ("key_agrif")
 !-----------------------------------------------------------------------
-   ln_spc_dyn    = .true.  !  use 0 as special value for dynamics
-   rn_sponge_tra = 2880.   !  coefficient for tracer   sponge layer [m2/s]
-   rn_sponge_dyn = 2880.   !  coefficient for dynamics sponge layer [m2/s]
-   ln_chk_bathy  = .FALSE. !
+   ln_vert_remap = .false. ! volume conserving update 
    npt_connect   = 2
    npt_copy      = 2
Index: utils/tools/DOMAINcfg/3_namelist_ref
===================================================================
--- utils/tools/DOMAINcfg/3_namelist_ref	(revision 15162)
+++ utils/tools/DOMAINcfg/3_namelist_ref	(revision 15279)
@@ -171,8 +171,5 @@
 &namagrif      !  AGRIF zoom                                            ("key_agrif")
 !-----------------------------------------------------------------------
-   ln_spc_dyn    = .true.  !  use 0 as special value for dynamics
-   rn_sponge_tra = 2880.   !  coefficient for tracer   sponge layer [m2/s]
-   rn_sponge_dyn = 2880.   !  coefficient for dynamics sponge layer [m2/s]
-   ln_chk_bathy  = .FALSE. !
+   ln_vert_remap = .false. ! volume conserving update 
    npt_connect   = 2
    npt_copy      = 2
Index: utils/tools/DOMAINcfg/make_namelist.py
===================================================================
--- utils/tools/DOMAINcfg/make_namelist.py	(revision 15162)
+++ utils/tools/DOMAINcfg/make_namelist.py	(revision 15279)
@@ -62,20 +62,27 @@
     print(int(Ni0glo_parent), int(Nj0glo_parent))
 
-    nbghostcells_x = nbghostcells
-    nbghostcells_y = nbghostcells
-    nbghostcells_y_n = nbghostcells_y
-    nbghostcells_y_s = nbghostcells_y
+    nbghostcells_x_e = nbghostcells
+    nbghostcells_x_w = nbghostcells
+    nbghostcells_y_n = nbghostcells
+    nbghostcells_y_s = nbghostcells
     if (int(grid[cnt-1][2]) == 1 ):
         nbghostcells_y_s = 1 
     if int(grid[cnt-1][3]) == int(Nj0glo_parent)-1 :
         nbghostcells_y_n = 1 
+    if (int(grid[cnt-1][0]) == 1 ):
+        nbghostcells_x_w = 1 
+    if int(grid[cnt-1][1]) == int(Ni0glo_parent)-1 :
+        nbghostcells_x_e = 1 
+    if int(grid[cnt-1][3]) == int(Nj0glo_parent) :
+        nbghostcells_y_n = 0 
     if int(grid[cnt-1][1]) - int(grid[cnt-1][0]) == int(Ni0glo_parent) :
-        nbghostcells_x = 0
+        nbghostcells_x_w = 0
+        nbghostcells_x_e = 0
 
-    Ni0glo = (int(grid[cnt-1][1])-int(grid[cnt-1][0]))*int(grid[cnt-1][4]) + 2*nbghostcells_x
+    Ni0glo = (int(grid[cnt-1][1])-int(grid[cnt-1][0]))*int(grid[cnt-1][4]) + nbghostcells_x_w  + nbghostcells_x_e
     Nj0glo = (int(grid[cnt-1][3])-int(grid[cnt-1][2]))*int(grid[cnt-1][5]) + nbghostcells_y_n  + nbghostcells_y_s
     #print( "Grid "+str(cnt)+" : jpiglo = "+cnt(jpiglo)+ "  jpjglo = "+str(jpjglo) ) 
     print(int(grid[cnt-1][0]), int(grid[cnt-1][1]), int(grid[cnt-1][2]),int(grid[cnt-1][3]))
-    print(nbghostcells_x, nbghostcells_y_s, nbghostcells_y_n)
+    print(nbghostcells_x_w, nbghostcells_x_e,  nbghostcells_y_s, nbghostcells_y_n)
     print('Grid {:1d} : Ni0glo = {:3d} , Nj0glo = {:3d}'.format(cnt, Ni0glo, Nj0glo))
 
@@ -91,4 +98,6 @@
                else:
                    line = "   jperio = 0\n"
+               if nbghostcells_y_n == 0:
+                   line = "   jperio = 4\n"
            if line.strip().startswith('nn_bathy'):
             	   line = "   nn_bathy = 2\n"
Index: utils/tools/DOMAINcfg/namelist_cfg
===================================================================
--- utils/tools/DOMAINcfg/namelist_cfg	(revision 15162)
+++ utils/tools/DOMAINcfg/namelist_cfg	(revision 15279)
@@ -19,5 +19,5 @@
                            !  or compute (2) from external bathymetry
    nn_interp   =    1                          ! type of interpolation (nn_bathy =2)
-   cn_domcfg   = 'ORCA_R2_zps_domcfg_agrif.nc'                
+   cn_domcfg   =  'ORCA_R2_zps_domcfg.nc'                
    cn_topo     =  'bathymetry_ORCA12_V3.3.nc'  ! external topo file (nn_bathy =2)
    cn_bath     =  'Bathymetry'                 ! topo name in file  (nn_bathy =2)
Index: utils/tools/DOMAINcfg/namelist_ref
===================================================================
--- utils/tools/DOMAINcfg/namelist_ref	(revision 15162)
+++ utils/tools/DOMAINcfg/namelist_ref	(revision 15279)
@@ -171,8 +171,5 @@
 &namagrif      !  AGRIF zoom                                            ("key_agrif")
 !-----------------------------------------------------------------------
-   ln_spc_dyn    = .true.  !  use 0 as special value for dynamics
-   rn_sponge_tra = 2880.   !  coefficient for tracer   sponge layer [m2/s]
-   rn_sponge_dyn = 2880.   !  coefficient for dynamics sponge layer [m2/s]
-   ln_chk_bathy  = .FALSE. !
+   ln_vert_remap = .false. ! volume conserving update 
    npt_connect   = 2
    npt_copy      = 2
Index: utils/tools/DOMAINcfg/src/agrif_connect.F90
===================================================================
--- utils/tools/DOMAINcfg/src/agrif_connect.F90	(revision 15162)
+++ utils/tools/DOMAINcfg/src/agrif_connect.F90	(revision 15279)
@@ -2,5 +2,4 @@
 
    USE dom_oce
-   USE domzgr
    USE agrif_parameters
    USE agrif_profiles
@@ -9,5 +8,5 @@
    PRIVATE
 
-   PUBLIC agrif_boundary_connections 
+   PUBLIC agrif_boundary_connections, agrif_bathymetry_connect 
 
 CONTAINS
@@ -27,12 +26,41 @@
 !      CALL Agrif_Bc_variable(e3t_copy_id, procname = connect_e3t_copy)
 
-      ALLOCATE(e3t_interp(jpi,jpj,jpk))
-      e3t_interp = -10.
+      ALLOCATE(e3t_interp_done(jpi,jpj))
+      e3t_interp_done(:,:) = .FALSE. 
+      ! set extrapolation on for interpolation near the coastline:
+      Agrif_UseSpecialValue = .TRUE.
+      Agrif_SpecialValue = 0._wp
+      CALL Agrif_Bc_variable(e3t_connect_id, procname = connect_e3t_connect)
+      ! Override in ghost zone by nearest value:
       Agrif_UseSpecialValue = .FALSE.
-      Agrif_SpecialValue = 0.
-      CALL Agrif_Bc_variable(e3t_connect_id, procname = connect_e3t_connect)
+      e3t_interp_done(:,:) = .FALSE.
+      CALL Agrif_Bc_variable(e3t_copy_id,    procname = connect_e3t_connect)
       Agrif_UseSpecialValue = .FALSE.
+      DEALLOCATE(e3t_interp_done)
       !
    END SUBROUTINE agrif_boundary_connections
+
+   SUBROUTINE agrif_bathymetry_connect
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE agrif_bathymetry_connect  ***
+      !!----------------------------------------------------------------------  
+      IF( Agrif_Root() ) return
+
+      CALL agrif_connection()
+      !
+      ALLOCATE(e3t_interp_done(jpi,jpj))
+      e3t_interp_done(:,:) = .FALSE. 
+      ! set extrapolation on for interpolation near the coastline:
+      Agrif_UseSpecialValue = .TRUE.
+      Agrif_SpecialValue = 0._wp
+      CALL Agrif_Bc_variable(e3t_connect_id, procname = connect_bathy_connect)
+      ! Override in ghost zone by nearest value:
+      Agrif_UseSpecialValue = .FALSE.
+      e3t_interp_done(:,:) = .FALSE.
+      CALL Agrif_Bc_variable(e3t_copy_id,    procname = connect_bathy_connect)
+      Agrif_UseSpecialValue = .FALSE.
+      DEALLOCATE(e3t_interp_done)
+      !
+   END SUBROUTINE agrif_bathymetry_connect
 
    SUBROUTINE connect_e3t_copy( ptab, i1, i2, j1, j2, k1, k2, before, nb,ndir)
@@ -50,5 +78,5 @@
          ptab(i1:i2,j1:j2,k1:k2) = e3t_0(i1:i2,j1:j2,k1:k2)
       ELSE
-         e3t_0(i1:i2,j1:j2,k1:k2) = ptab(i1:i2,j1:j2,k1:k2)
+         e3t_0(i1:i2,j1:j2,1:jpk) = ptab(i1:i2,j1:j2,1:jpk)
       ENDIF
       !
@@ -89,10 +117,10 @@
       !
       !!---------------------------------------------------------------------- 
-      INTEGER :: ji, jj, jk 
+      INTEGER :: ji, jj, jk, ik 
       REAL(wp), DIMENSION(i1:i2,j1:j2) :: bathy_local, bathy_interp
-      REAL(wp) :: zdepth, zmax 
+      REAL(wp) :: zdepth, zdepwp, zmax, ze3tp, ze3wp, zhmin 
       !
       IF( before) THEN
-         DO jk=1,jpk
+         DO jk=k1, k2
             DO jj=j1,j2
                DO ji=i1,i2
@@ -108,5 +136,5 @@
          DO jj=j1,j2
             DO ji=i1,i2
-               ptab(ji,jj,jpk+1) = SUM ( e3t_0(ji,jj, 1:mbkt(ji,jj) ) ) * ssmask(ji,jj)
+               ptab(ji,jj,k2) = SUM ( e3t_0(ji,jj, 1:mbkt(ji,jj) ) ) * ssmask(ji,jj)
             END DO
          END DO
@@ -115,8 +143,9 @@
             DO ji=i1,i2
                bathy_local (ji,jj) = SUM ( e3t_0(ji,jj, 1:mbkt(ji,jj) ) ) * ssmask(ji,jj)
-               bathy_interp (ji,jj) = ptab(ji,jj,jpk+1)
-
+               bathy_interp (ji,jj) = ptab(ji,jj,k2)
+               ! keep child masking in transition zone:
+               IF ((ztabramp(ji,jj)/=1._wp).AND.(bathy_local(ji,jj)==0._wp)) bathy_interp(ji,jj)=0._wp
         ! Connected bathymetry
-               IF( e3t_interp(ji,jj,1) == -10 ) THEN
+               IF( .NOT.e3t_interp_done(ji,jj) ) THEN
                   bathy_local(ji,jj)=(1.-ztabramp(ji,jj))*bathy_local(ji,jj)+ztabramp(ji,jj)*bathy_interp(ji,jj)
                ENDIF
@@ -125,12 +154,22 @@
 
         ! Update mbkt and ssmask
+         IF( rn_hmin < 0._wp ) THEN
+            ik = - INT( rn_hmin )
+         ELSE
+            ik = MINLOC( gdepw_1d, mask = gdepw_1d > rn_hmin, dim = 1 )
+         ENDIF
+         zhmin = gdepw_1d(ik+1)
+
          zmax = gdepw_1d(jpk) + e3t_1d(jpk)
          bathy_local(:,:) = MAX(MIN(zmax,bathy_local(:,:)),0._wp)
-         WHERE( bathy_local(i1:i2,j1:j2) == 0._wp); mbathy(i1:i2,j1:j2) = 0
-         ELSE WHERE                       ; mbathy(i1:i2,j1:j2) = jpkm1
+         WHERE( bathy_local(i1:i2,j1:j2) == 0._wp)
+            mbathy(i1:i2,j1:j2) = 0
+         ELSE WHERE 
+            mbathy(i1:i2,j1:j2) = jpkm1 
+            bathy_local(i1:i2,j1:j2) = MAX(  zhmin , bathy_local(i1:i2,j1:j2)  ) 
          END WHERE
 
          DO jk=jpkm1,1,-1
-           zdepth = gdepw_1d(jk)+MIN(e3zps_min,e3t_1d(jk)*e3zps_rat)
+           zdepth = gdepw_1d(jk) + MIN(e3zps_min,e3t_1d(jk)*e3zps_rat)
            WHERE( 0._wp < bathy_local(:,:) .AND. bathy_local(:,:) <= zdepth ) mbathy(i1:i2,j1:j2) = jk-1
          ENDDO
@@ -141,23 +180,103 @@
          
          mbkt(i1:i2,j1:j2) = MAX( mbathy(i1:i2,j1:j2), 1 )
-
          !
-         DO jk=1,jpk
+         DO jj = j1, j2
+            DO ji = i1, i2
+               IF( .NOT.e3t_interp_done(ji,jj) ) THEN ! the connection has not yet been done
+                  DO jk = 1, jpk    
+                     gdept_0(ji,jj,jk) = gdept_1d(jk)
+                     gdepw_0(ji,jj,jk) = gdepw_1d(jk)
+                     e3t_0  (ji,jj,jk) = e3t_1d  (jk)
+                     e3w_0  (ji,jj,jk) = e3w_1d  (jk)
+                  END DO 
+                  !
+                  ik = mbathy(ji,jj)
+                  IF( ik > 0 ) THEN               ! ocean point only
+                     ! max ocean level case
+                     IF( ik == jpkm1 ) THEN
+                        zdepwp = bathy_local(ji,jj)
+                        ze3tp  = bathy_local(ji,jj) - gdepw_1d(ik)
+                        ze3wp = 0.5_wp * e3w_1d(ik) * ( 1._wp + ( ze3tp/e3t_1d(ik) ) )
+                        e3t_0(ji,jj,ik  ) = ze3tp
+                        e3t_0(ji,jj,ik+1) = ze3tp
+                        e3w_0(ji,jj,ik  ) = ze3wp
+                        e3w_0(ji,jj,ik+1) = ze3tp
+                        gdepw_0(ji,jj,ik+1) = zdepwp
+                        gdept_0(ji,jj,ik  ) = gdept_1d(ik-1) + ze3wp
+                        gdept_0(ji,jj,ik+1) = gdept_0(ji,jj,ik) + ze3tp
+                        !
+                     ELSE                         ! standard case
+                        IF( bathy_local(ji,jj) <= gdepw_1d(ik+1) ) THEN
+                           gdepw_0(ji,jj,ik+1) = bathy_local(ji,jj)
+                        ELSE
+                           gdepw_0(ji,jj,ik+1) = gdepw_1d(ik+1)
+                        ENDIF
+                        gdept_0(ji,jj,ik) = gdepw_1d(ik) + ( gdepw_0(ji,jj,ik+1) - gdepw_1d(ik) ) &
+                              &                * ((gdept_1d(     ik  ) - gdepw_1d(ik) )           &
+                              &                / ( gdepw_1d(     ik+1) - gdepw_1d(ik) ))
+                        e3t_0  (ji,jj,ik) = e3t_1d  (ik) * ( gdepw_0 (ji,jj,ik+1) - gdepw_1d(ik)) &
+                              &                / ( gdepw_1d(      ik+1) - gdepw_1d(ik))
+                        e3w_0(ji,jj,ik) = &
+                              & 0.5_wp * (gdepw_0(ji,jj,ik+1) + gdepw_1d(ik+1) - 2._wp * gdepw_1d(ik) )   &
+                              &        * ( e3w_1d(ik) / ( gdepw_1d(ik+1) - gdepw_1d(ik) ) )
+                        !       ... on ik+1
+                        e3w_0  (ji,jj,ik+1) = e3t_0  (ji,jj,ik)
+                        e3t_0  (ji,jj,ik+1) = e3t_0  (ji,jj,ik)
+                        gdept_0(ji,jj,ik+1) = gdept_0(ji,jj,ik) + e3t_0(ji,jj,ik)
+                     ENDIF
+                  ENDIF
+               ENDIF
+               e3t_interp_done(ji,jj) = .TRUE.
+            END DO
+         END DO
+      ENDIF
+      !
+   END SUBROUTINE connect_e3t_connect
+
+   SUBROUTINE connect_bathy_connect( ptab, i1, i2, j1, j2, k1, k2, before, nb,ndir)
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE connect_e3t_connect  ***
+      !!----------------------------------------------------------------------  
+      INTEGER                               , INTENT(in   ) ::   i1, i2, j1, j2, k1, k2
+      REAL(wp), DIMENSION(i1:i2,j1:j2,k1:k2), INTENT(inout) ::   ptab
+      LOGICAL                               , INTENT(in   ) ::   before
+      INTEGER                               , INTENT(in   ) ::   nb , ndir
+      !
+      !!---------------------------------------------------------------------- 
+      INTEGER :: ji, jj, jk
+      !
+      IF( before) THEN
+         DO jk=k1,k2
             DO jj=j1,j2
                DO ji=i1,i2
-                  IF( e3t_interp(ji,jj,jk) == -10 ) THEN ! the connection has not yet been done
-                     e3t_interp(ji,jj,jk) = MAX( ptab(ji,jj,jk),MIN(e3zps_min, e3t_1d(jk)*e3zps_rat) )
-                  !   e3t_interp(ji,jj,jk) = MIN( e3t_interp(ji,jj,jk),e3t_1d(jk) )
-                     e3t_0(ji,jj,jk) = ( 1. - ztabramp(ji,jj) )*e3t_0(ji,jj,jk) + ztabramp(ji,jj)*e3t_interp(ji,jj,jk)
+                  IF( mbkt(ji,jj) .GE. jk ) THEN
+                     ptab(ji,jj,jk) = e3t_0(ji,jj,jk)
+                  ELSE
+                     ptab(ji,jj,jk) = 0._wp
                   ENDIF
-                  IF( jk > mbkt(ji,jj)) THEN
-                    e3t_0(ji,jj,jk) = e3t_1d(jk)
-                  ENDIF
-             END DO
-           END DO
-         END DO
-      ENDIF
-      !
-   END SUBROUTINE connect_e3t_connect
+               END DO
+            END DO
+         END DO
+         !
+         DO jj=j1,j2
+            DO ji=i1,i2
+               ptab(ji,jj,k2) = SUM ( e3t_0(ji,jj, 1:mbkt(ji,jj) ) ) * ssmask(ji,jj)
+            END DO
+         END DO
+      ELSE
+         DO jj=j1,j2
+            DO ji=i1,i2
+               ! keep child masking in transition zone:
+               IF ((ztabramp(ji,jj)/=1._wp).AND.(bathy(ji,jj)==0._wp)) ptab(ji,jj,k2) = 0._wp
+               ! Connected bathymetry
+               IF( .NOT.e3t_interp_done(ji,jj) ) THEN
+                  bathy(ji,jj)=(1._wp-ztabramp(ji,jj))*bathy(ji,jj)+ztabramp(ji,jj)*ptab(ji,jj,k2)
+                  e3t_interp_done(ji,jj) = .TRUE.
+               ENDIF
+            END DO
+         END DO
+      ENDIF
+      !
+   END SUBROUTINE connect_bathy_connect
    
    SUBROUTINE agrif_connection
@@ -181,5 +300,5 @@
 
       ! --- West --- !
-      IF( ((nbondi == -1) .OR. (nbondi == 2) ).AND. .NOT. (jperio == 1 .OR. jperio == 4 .OR. jperio == 6)) THEN
+      IF( lk_west ) THEN
          ind1 = nn_hls + nbghostcells + istart
          ind2 = ind1 + ispongearea 
@@ -200,5 +319,5 @@
 
       ! --- East --- !
-      IF( ((nbondi == 1) .OR. (nbondi == 2) ).AND. .NOT. (jperio == 1 .OR. jperio == 4 .OR. jperio == 6)) THEN
+      IF( lk_east ) THEN
          ind2 = jpiglo -  (nn_hls + nbghostcells -1 ) - istart
          ind1 = ind2 -ispongearea       
@@ -223,5 +342,5 @@
 
       ! --- South --- !
-      IF(( (nbondj == -1) .OR. (nbondj == 2) ).AND.(lk_south)) THEN
+      IF( lk_south ) THEN
          ind1 = nn_hls + nbghostcells + istart
          ind2 = ind1 + ispongearea 
@@ -242,5 +361,5 @@
 
       ! --- North --- !
-      IF(( (nbondj == 1) .OR. (nbondj == 2) ).AND.(lk_north)) THEN
+      IF( lk_north ) THEN
          ind2 = jpjglo - (nn_hls + nbghostcells - 1) - istart
          ind1 = ind2 -ispongearea
@@ -265,4 +384,6 @@
    SUBROUTINE agrif_boundary_connections
    END SUBROUTINE agrif_boundary_connections
+   SUBROUTINE agrif_bathymetry_connect 
+   END SUBROUTINE agrif_bathymetry_connect 
 #endif
 
Index: utils/tools/DOMAINcfg/src/agrif_dom_update.F90
===================================================================
--- utils/tools/DOMAINcfg/src/agrif_dom_update.F90	(revision 15162)
+++ utils/tools/DOMAINcfg/src/agrif_dom_update.F90	(revision 15279)
@@ -2,9 +2,8 @@
 
    USE dom_oce
-   USE domzgr
    USE agrif_parameters
    USE agrif_profiles
-   USE lbclnk
-   
+   USE agrif_recompute_scales
+ 
    IMPLICIT none
    PRIVATE
@@ -21,26 +20,44 @@
       !!----------------------------------------------------------------------  
       !
+      INTEGER :: ind1, ind2
+
       IF( Agrif_Root() ) return
-
-      CALL agrif_update_variable(bottom_level_id,procname = update_bottom_level)
-      !
-      Agrif_UseSpecialValueInUpdate = .TRUE.
-      Agrif_SpecialValueFineGrid    = 0._wp         
-      CALL agrif_update_variable(e3t_id,procname = update_e3t)
+      
+      IF ( .NOT.ln_vert_remap ) THEN
+         CALL agrif_update_variable(bottom_level_id,procname = update_bottom_level)
+         Agrif_UseSpecialValueInUpdate = .FALSE.
+         Agrif_SpecialValueFineGrid    = 0._wp         
+         CALL agrif_update_variable(e3t_id, procname = update_e3t_z) 
+         !
+      ELSE
+         Agrif_UseSpecialValueInUpdate = .FALSE.
+         Agrif_SpecialValueFineGrid    = 0._wp         
+         CALL agrif_update_variable(e3t_id, procname = update_e3t_z_cons) 
+
+         ! jc: extend update zone outside dynamical interface within sponge zone:
+         ! Use max operator this time to account for cases for which Agrif_Rho > nbghostcells
+         ind1 = CEILING(REAL(max(nbghostcells_x_w-1, nbghostcells_x_e-1), wp) / Agrif_Rhox() )
+         ind2 = CEILING(REAL(max(nbghostcells_y_s-1, nbghostcells_y_n-1), wp) / Agrif_Rhoy() )
+         CALL agrif_update_variable(e3t_copy_id, locupdate1=(/-ind1,0/), &
+                             &                   locupdate2=(/-ind2,0/),procname = update_e3t_z_cons)
+      ENDIF
       Agrif_UseSpecialValueInUpdate = .FALSE.
+      !
+      ! Update vertical scale factors at U, V and F-points:
+      CALL Agrif_ChildGrid_To_ParentGrid()
+      CALL agrif_recompute_scalefactors
+      CALL Agrif_ParentGrid_To_ChildGrid()
       !    
    END SUBROUTINE agrif_update_all
 
-   SUBROUTINE update_bottom_level( ptab, i1, i2, j1, j2, before, nb,ndir)
+   SUBROUTINE update_bottom_level( ptab, i1, i2, j1, j2, before)
       !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE interpsshn  ***
+      !!       ***  ROUTINE update_bottom_level  ***
       !!----------------------------------------------------------------------  
       INTEGER                         , INTENT(in   ) ::   i1, i2, j1, j2
       REAL, DIMENSION(i1:i2,j1:j2)    , INTENT(inout) ::   ptab
       LOGICAL                         , INTENT(in   ) ::   before
-      INTEGER                         , INTENT(in   ) ::   nb , ndir
       !
       !!---------------------------------------------------------------------- 
-      REAL(WP),DIMENSION(jpi,jpj) :: zk
       !
       IF( before) THEN
@@ -50,18 +67,16 @@
          
          WHERE ( mbkt(i1:i2,j1:j2) .EQ. 0 )
-            ssmask(i1:i2,j1:j2) = 0.
-            mbkt(i1:i2,j1:j2)   = 1
+            ssmask(i1:i2,j1:j2) = 0._wp
+            mbkt(i1:i2,j1:j2)   = 1 
          ELSEWHERE
-            ssmask(i1:i2,j1:j2) = 1.
+            ssmask(i1:i2,j1:j2) = 1._wp
          END WHERE 
-!         zk(:,:) = REAL(mbkt(:,:),wp); CALL lbc_lnk('update_bottom',zk,'T',1.); mbkt(:,:) = MAX(NINT(zk(:,:)),1)
-!         CALL lbc_lnk('update_bottom',ssmask,'T',1.)          
       ENDIF
       !
    END SUBROUTINE update_bottom_level
-   
-   SUBROUTINE update_e3t( tabres, i1, i2, j1, j2, k1, k2,  before )
-      !!---------------------------------------------
-      !!           *** update_e3t ***
+
+   SUBROUTINE update_e3t_z( tabres, i1, i2, j1, j2, k1, k2, before )
+      !!---------------------------------------------
+      !!           *** update_e3t_z ***
       !!---------------------------------------------
       INTEGER, INTENT(in) :: i1,i2,j1,j2,k1,k2
@@ -69,5 +84,5 @@
       LOGICAL, INTENT(in) :: before
       !!
-      INTEGER :: ji,jj,jk
+      INTEGER :: ji, jj, jk
       !!---------------------------------------------
       !
@@ -76,31 +91,143 @@
             DO jj=j1,j2
                DO ji=i1,i2
-                   IF ((ssmask(ji,jj) /=0.).AND.( mbkt(ji,jj) .GE. jk )) THEN
+                  IF ( (ssmask(ji,jj) /=0._wp).AND.(mbkt(ji,jj).GE.jk) ) THEN
+                     tabres(ji,jj,jk) = e3t_0(ji,jj,jk)
+                  ELSE
+                     tabres(ji,jj,jk) = 0._wp
+                  ENDIF 
+               END DO
+            END DO
+         END DO
+      ELSE
+         DO jk=1,jpk
+            DO jj=j1,j2
+               DO ji=i1,i2
+                  IF ( ( mbkt(ji,jj).GE.jk ).AND.(ssmask(ji,jj)==1._wp) ) THEN
+                     e3t_0(ji,jj,jk) = MAX(tabres(ji,jj,jk),MIN(e3zps_min,e3t_1d(jk)*e3zps_rat))
+                 !    e3t_0(ji,jj,jk) = tabres(ji,jj,jk)
+                  ELSE
+                     e3t_0(ji,jj,jk) = e3t_1d(jk)
+                  ENDIF
+               END DO
+            END DO
+         END DO
+         !
+      ENDIF
+      ! 
+   END SUBROUTINE update_e3t_z
+
+   SUBROUTINE update_e3t_z_cons( tabres, i1, i2, j1, j2, k1, k2, before )
+      !!---------------------------------------------
+      !!           *** update_e3t_z_cons ***
+      !!---------------------------------------------
+      INTEGER, INTENT(in) :: i1,i2,j1,j2,k1,k2
+      REAL(wp),DIMENSION(i1:i2,j1:j2,k1:k2), INTENT(inout) :: tabres
+      LOGICAL, INTENT(in) :: before
+      !!
+      INTEGER :: ji, jj, jk, ik
+      REAL(wp) :: zhmin, zdepth, zdepwp, ze3tp, ze3wp
+      !!---------------------------------------------
+      !
+      IF (before) THEN
+         DO jk = k1, k2-1
+            DO jj = j1, j2
+               DO ji = i1, i2
+                   IF ( (ssmask(ji,jj) /=0._wp).AND.( mbkt(ji,jj) .GE. jk ) ) THEN
                       tabres(ji,jj,jk) = e3t_0(ji,jj,jk)
                    ELSE
-                      tabres(ji,jj,jk) = 0.
+                      tabres(ji,jj,jk) = 0._wp
                    endif
                END DO
             END DO
          END DO
-      ELSE
-         DO jk=k1,k2
-            DO jj=j1,j2
-               DO ji=i1,i2
-                   IF( mbkt(ji,jj) .GE. jk ) THEN
-                      e3t_0(ji,jj,jk) = MAX(tabres(ji,jj,jk),MIN(e3zps_min,e3t_1d(jk)*e3zps_rat))
-                  !    e3t_0(ji,jj,jk) = tabres(ji,jj,jk)
-                   ELSE
-                      e3t_0(ji,jj,jk) = e3t_1d(jk)
-                   ENDIF
-               END DO
-            END DO
-         END DO
-
-!         CALL lbc_lnk('update_e3t',e3t_0,'T',1.,kfillmode = jpfillcopy)
-         !
+         tabres(i1:i2,j1:j2,k2) = ssmask(i1:i2,j1:j2) ! To get fractional area
+      ELSE
+         IF( rn_hmin < 0._wp ) THEN   
+            ik = - INT( rn_hmin )
+         ELSE                          
+            ik = MINLOC( gdepw_1d, mask = gdepw_1d > rn_hmin, dim = 1 )
+         ENDIF
+         zhmin = gdepw_1d(ik+1)
+
+         ! Compute child bathymetry:
+         bathy(i1:i2,j1:j2) = 0._wp
+         DO jk=k1,k2-1   
+            bathy(i1:i2,j1:j2) = bathy(i1:i2,j1:j2) + tabres(i1:i2,j1:j2,jk)
+         END DO
+         WHERE( bathy(i1:i2,j1:j2) == 0._wp )   ;   mbathy(i1:i2,j1:j2) = 0       
+         ELSE WHERE                             ;   mbathy(i1:i2,j1:j2) = jpkm1  
+         END WHERE
+
+         DO jk = jpkm1, 1, -1
+            zdepth = gdepw_1d(jk) ! + MIN( e3zps_min, e3t_1d(jk)*e3zps_rat )
+            WHERE( 0._wp < bathy(i1:i2,j1:j2) .AND. bathy(i1:i2,j1:j2) <= zdepth )   mbathy(i1:i2,j1:j2) = jk-1
+         END DO
+
+         ! Scale factors and depth at T- and W-points
+         DO jk = 1, jpk  
+            gdept_0(i1:i2,j1:j2,jk) = gdept_1d(jk)
+            gdepw_0(i1:i2,j1:j2,jk) = gdepw_1d(jk)
+            e3t_0  (i1:i2,j1:j2,jk) = e3t_1d  (jk)
+            e3w_0  (i1:i2,j1:j2,jk) = e3w_1d  (jk)
+         END DO
+         ! Scale factors and depth at T- and W-points
+         DO jj = j1, j2
+            DO ji = i1, i2 
+               ik = mbathy(ji,jj)
+               IF( ik > 0 ) THEN               ! ocean point only
+                  ! max ocean level case
+                  IF( ik == jpkm1 ) THEN
+                     zdepwp = bathy(ji,jj)
+                     ze3tp  = bathy(ji,jj) - gdepw_1d(ik)
+                     ze3wp = 0.5_wp * e3w_1d(ik) * ( 1._wp + ( ze3tp/e3t_1d(ik) ) )
+                     e3t_0(ji,jj,ik  ) = ze3tp
+                     e3t_0(ji,jj,ik+1) = ze3tp
+                     e3w_0(ji,jj,ik  ) = ze3wp
+                     e3w_0(ji,jj,ik+1) = ze3tp
+                     gdepw_0(ji,jj,ik+1) = zdepwp
+                     gdept_0(ji,jj,ik  ) = gdept_1d(ik-1) + ze3wp
+                     gdept_0(ji,jj,ik+1) = gdept_0(ji,jj,ik) + ze3tp
+                     !
+                  ELSE                         ! standard case
+                     IF( bathy(ji,jj) <= gdepw_1d(ik+1) ) THEN 
+                        gdepw_0(ji,jj,ik+1) = bathy(ji,jj)
+                     ELSE                                       
+                        gdepw_0(ji,jj,ik+1) = gdepw_1d(ik+1)
+                     ENDIF
+                     gdept_0(ji,jj,ik) = gdepw_1d(ik) + ( gdepw_0(ji,jj,ik+1) - gdepw_1d(ik) )           &
+                        &                             * ((gdept_1d(     ik  ) - gdepw_1d(ik) )           &
+                        &                             / ( gdepw_1d(     ik+1) - gdepw_1d(ik) ))
+                     e3t_0  (ji,jj,ik) = e3t_1d  (ik) * ( gdepw_0 (ji,jj,ik+1) - gdepw_1d(ik))           &
+                        &                             / ( gdepw_1d(      ik+1) - gdepw_1d(ik)) 
+                     e3w_0(ji,jj,ik) =                                                                   & 
+                        &      0.5_wp * (gdepw_0(ji,jj,ik+1) + gdepw_1d(ik+1) - 2._wp * gdepw_1d(ik) )   &
+                        &             * ( e3w_1d(ik) / ( gdepw_1d(ik+1) - gdepw_1d(ik) ) )
+                     !       ... on ik+1
+                     e3w_0  (ji,jj,ik+1) = e3t_0  (ji,jj,ik)
+                     e3t_0  (ji,jj,ik+1) = e3t_0  (ji,jj,ik)
+                     gdept_0(ji,jj,ik+1) = gdept_0(ji,jj,ik) + e3t_0(ji,jj,ik)
+                  ENDIF
+               ENDIF
+            END DO
+         END DO
+         !
+         DO jj=j1,j2
+            DO ji=i1,i2
+               bathy(ji,jj) = SUM(e3t_0(ji,jj,1:mbkt(ji,jj) ) ) 
+            END DO
+         END DO
+         !
+         WHERE ( ( mbathy(i1:i2,j1:j2) .EQ. 0 )  & 
+           & .OR.(tabres(i1:i2,j1:j2,k2)<0.5_wp) &
+           & .OR.(bathy(i1:i2,j1:j2)<zhmin) )
+            ssmask(i1:i2,j1:j2) = 0._wp
+            mbathy(i1:i2,j1:j2) = 0 
+         ELSEWHERE
+            ssmask(i1:i2,j1:j2) = 1._wp
+         END WHERE
+         mbkt(i1:i2,j1:j2) = MAX( mbathy(i1:i2,j1:j2), 1 )
       ENDIF
       ! 
-   END SUBROUTINE update_e3t
+   END SUBROUTINE update_e3t_z_cons
       
 #else
Index: utils/tools/DOMAINcfg/src/agrif_parameters.F90
===================================================================
--- utils/tools/DOMAINcfg/src/agrif_parameters.F90	(revision 15162)
+++ utils/tools/DOMAINcfg/src/agrif_parameters.F90	(revision 15279)
@@ -7,13 +7,11 @@
 #if defined key_agrif
 
-	INTEGER :: nn_cln_update
-	LOGICAL :: ln_spc_dyn
-	REAL(wp) :: rn_sponge_tra
-	REAL(wp) :: rn_sponge_dyn
-	LOGICAL :: ln_chk_bathy
-	INTEGER :: npt_copy
-	INTEGER :: npt_connect
+        LOGICAL :: ln_vert_remap ! =T is using volume conserving update
+	INTEGER :: npt_copy      ! area (in coarse grid points) with piecewise
+                                 ! constant bathymetry inside child zoom: should equal the sponge length
+	INTEGER :: npt_connect   ! area (in coarse grid points) of coarse/child
+                                 ! bathymetry blending
 	REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   ztabramp
-	REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:,:) ::   e3t_interp
+	LOGICAL,  PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e3t_interp_done
 
 #endif
Index: utils/tools/DOMAINcfg/src/agrif_user.F90
===================================================================
--- utils/tools/DOMAINcfg/src/agrif_user.F90	(revision 15162)
+++ utils/tools/DOMAINcfg/src/agrif_user.F90	(revision 15279)
@@ -46,5 +46,5 @@
       !
       INTEGER :: irafx, irafy
-      LOGICAL :: ln_perio, l_deg
+      LOGICAL :: ln_perio, ldIperio, ldNFold, l_deg
       !
       irafx = agrif_irhox()
@@ -73,6 +73,8 @@
       ln_perio = .FALSE.
       l_deg = .TRUE.
- 
-      IF( jperio == 1 .OR. jperio == 2 .OR. jperio == 4 ) ln_perio=.TRUE.
+
+      ldIperio = (jperio == 1 .OR. jperio == 4 .OR. jperio == 6 .OR. jperio == 7)
+      ldNFold  = jperio >= 3 .AND. jperio <= 6 
+      IF( ldIperio.OR.ldNFold ) ln_perio=.TRUE.
       IF ( Agrif_Parent(jphgr_msh)==2 &
       &.OR.Agrif_Parent(jphgr_msh)==3 & 
@@ -113,50 +115,58 @@
       !South:
       IF ((nbondj == -1).OR.(nbondj == 2)) THEN
-         glamf(:,nn_hls) = glamf(:,1+nn_hls)
-         gphif(:,nn_hls) = gphif(:,1+nn_hls)
-      ENDIF
-
+         gphif(:,nn_hls) = gphif(:,1+nn_hls) 
+         glamf(:,nn_hls) = glamf(:,1+nn_hls) 
+      ENDIF 
+
+      IF ( .NOT.ldNFold ) THEN
+         IF ((.not.lk_north).AND.((nbondj == 1).OR.(nbondj == 2))) THEN
+            glamt(:,jpj-nn_hls) = glamt(:,jpj-nn_hls-1)
+            gphit(:,jpj-nn_hls) = gphit(:,jpj-nn_hls-1)
+            glamu(:,jpj-nn_hls) = glamu(:,jpj-nn_hls-1)
+            gphiu(:,jpj-nn_hls) = gphiu(:,jpj-nn_hls-1)
+            glamv(:,jpj-nn_hls) = glamv(:,jpj-nn_hls-1)
+            gphiv(:,jpj-nn_hls) = gphiv(:,jpj-nn_hls-1)
+            glamf(:,jpj-nn_hls) = glamf(:,jpj-nn_hls-1)
+            gphif(:,jpj-nn_hls) = gphif(:,jpj-nn_hls-1)
+         ENDIF
+      ENDIF
       IF ((nbondj == 1).OR.(nbondj == 2)) THEN
-         glamt(:,jpj) = glamt(:,jpj-1)
-         gphit(:,jpj) = gphit(:,jpj-1)
-         glamu(:,jpj) = glamu(:,jpj-1)
-         gphiu(:,jpj) = gphiu(:,jpj-1)
-         glamv(:,jpj) = glamv(:,jpj-1)
-         gphiv(:,jpj) = gphiv(:,jpj-1)
-         glamf(:,jpj) = glamf(:,jpj-1)
-         gphif(:,jpj) = gphif(:,jpj-1)
+         glamf(:,jpj-nn_hls+1) = glamf(:,jpj-nn_hls)
+         gphif(:,jpj-nn_hls+1) = gphif(:,jpj-nn_hls)
       ENDIF
 
       ! Correct West and East
-      IF( jperio /= 1 ) THEN
+      IF( .NOT.ldIperio ) THEN
          IF((nbondi == -1) .OR. (nbondi == 2) ) THEN
-            glamt(1,:) = glamt(2,:)
-            gphit(1,:) = gphit(2,:)
-            glamu(1,:) = glamu(2,:)
-            gphiu(1,:) = gphiu(2,:)
-            glamv(1,:) = glamv(2,:)
-            gphiv(1,:) = gphiv(2,:)
-            glamf(1,:) = glamf(2,:)
-            gphif(1,:) = gphif(2,:)
+            glamt(1+nn_hls,:) = glamt(2+nn_hls,:)
+            gphit(1+nn_hls,:) = gphit(2+nn_hls,:)
+            glamv(1+nn_hls,:) = glamv(2+nn_hls,:)
+            gphiv(1+nn_hls,:) = gphiv(2+nn_hls,:)
          ENDIF
          IF( (nbondi == 1) .OR. (nbondi == 2) ) THEN
-            glamt(jpi,:) = glamt(jpi-1,:)
-            gphit(jpi,:) = gphit(jpi-1,:)
-            glamu(jpi,:) = glamu(jpi-1,:)
-            gphiu(jpi,:) = gphiu(jpi-1,:)
-            glamv(jpi,:) = glamv(jpi-1,:)
-            gphiv(jpi,:) = gphiv(jpi-1,:)
-            glamf(jpi,:) = glamf(jpi-1,:)
-            gphif(jpi,:) = gphif(jpi-1,:)
-         ENDIF
-      ENDIF
-      !South:
-      IF ((nbondj == -1).OR.(nbondj == 2)) THEN
-         glamf(:,1) = glamf(:,2) 
-      ENDIF 
+            glamt(jpi-nn_hls,:) = glamt(jpi-nn_hls-1,:)
+            gphit(jpi-nn_hls,:) = gphit(jpi-nn_hls-1,:)
+            glamu(jpi-nn_hls,:) = glamu(jpi-nn_hls-1,:)
+            gphiu(jpi-nn_hls,:) = gphiu(jpi-nn_hls-1,:)
+            glamv(jpi-nn_hls,:) = glamv(jpi-nn_hls-1,:)
+            gphiv(jpi-nn_hls,:) = gphiv(jpi-nn_hls-1,:)
+            glamf(jpi-nn_hls,:) = glamf(jpi-nn_hls-1,:)
+            gphif(jpi-nn_hls,:) = gphif(jpi-nn_hls-1,:)
+         ENDIF
+      ENDIF
+      IF((nbondi == -1) .OR. (nbondi == 2) ) THEN
+         gphif(nn_hls,:) = gphif(nn_hls+1,:)
+         glamf(nn_hls,:) = glamf(nn_hls+1,:)
+      ENDIF
+      IF( (nbondi == 1) .OR. (nbondi == 2) ) THEN
+         glamf(jpi-nn_hls+1,:) = glamf(jpi-nn_hls,:)
+         gphif(jpi-nn_hls+1,:) = gphif(jpi-nn_hls,:)
+      ENDIF
+
       CALL agrif_init_scales()
 
+      ! Fill ghost points in case of closed boundaries:
       ! Correct South and North
-      IF ((.not.lk_south).AND.((nbondj == -1).OR.(nbondj == 2))) THEN
+      IF ((.NOT.lk_south).AND.((nbondj == -1).OR.(nbondj == 2))) THEN
          e1t(:,1+nn_hls) = e1t(:,2+nn_hls)
          e2t(:,1+nn_hls) = e2t(:,2+nn_hls)
@@ -164,34 +174,34 @@
          e2u(:,1+nn_hls) = e2u(:,2+nn_hls)
       ENDIF
-      IF( (nbondj == 1) .OR. (nbondj == 2) ) THEN
-         e1t(:,jpj) = e1t(:,jpj-1)
-         e2t(:,jpj) = e2t(:,jpj-1)
-         e1u(:,jpj) = e1u(:,jpj-1)
-         e2u(:,jpj) = e2u(:,jpj-1)
-         e1v(:,jpj) = e1v(:,jpj-1)
-         e2v(:,jpj) = e2v(:,jpj-1)
-         e1f(:,jpj) = e1f(:,jpj-1)
-         e2f(:,jpj) = e2f(:,jpj-1)
+      IF ( .NOT.ldNFold ) THEN
+         IF((.NOT.lk_north).AND.((nbondj == 1) .OR. (nbondj == 2) )) THEN
+            e1t(:,jpj-nn_hls) = e1t(:,jpj-nn_hls-1)
+            e2t(:,jpj-nn_hls) = e2t(:,jpj-nn_hls-1)
+            e1u(:,jpj-nn_hls) = e1u(:,jpj-nn_hls-1)
+            e2u(:,jpj-nn_hls) = e2u(:,jpj-nn_hls-1)
+            e1v(:,jpj-nn_hls) = e1v(:,jpj-nn_hls-1)
+            e2v(:,jpj-nn_hls) = e2v(:,jpj-nn_hls-1)
+            e1f(:,jpj-nn_hls) = e1f(:,jpj-nn_hls-1)
+            e2f(:,jpj-nn_hls) = e2f(:,jpj-nn_hls-1)
+         ENDIF
       ENDIF
 
       ! Correct West and East
-      IF( jperio /= 1 ) THEN
-         IF( (nbondj == -1) .OR. (nbondj == 2) ) THEN
-            e1t(1,:) = e1t(2,:)
-            e2t(1,:) = e2t(2,:)
-            e1u(1,:) = e1u(2,:)
-            e2u(1,:) = e2u(2,:)
-            e1v(1,:) = e1v(2,:)
-            e2v(1,:) = e2v(2,:)
-         ENDIF
-         IF( (nbondj == 1) .OR. (nbondj == 2) ) THEN
-            e1t(jpi,:) = e1t(jpi-1,:)
-            e2t(jpi,:) = e2t(jpi-1,:)
-            e1u(jpi,:) = e1u(jpi-1,:)
-            e2u(jpi,:) = e2u(jpi-1,:)
-            e1v(jpi,:) = e1v(jpi-1,:)
-            e2v(jpi,:) = e2v(jpi-1,:)
-            e1f(jpi,:) = e1f(jpi-1,:)
-            e2f(jpi,:) = e2f(jpi-1,:)
+      IF( .NOT.ldIperio ) THEN
+         IF((.NOT.lk_west).AND.(nbondj == -1).OR.(nbondj == 2) ) THEN
+            e1t(1+nn_hls,:) = e1t(2+nn_hls,:)
+            e2t(1+nn_hls,:) = e2t(2+nn_hls,:)
+            e1v(1+nn_hls,:) = e1v(2+nn_hls,:)
+            e2v(1+nn_hls,:) = e2v(2+nn_hls,:)
+         ENDIF
+         IF((.NOT.lk_east).AND.(nbondj == 1) .OR. (nbondj == 2) ) THEN
+            e1t(jpi-nn_hls,:) = e1t(jpi-nn_hls-1,:)
+            e2t(jpi-nn_hls,:) = e2t(jpi-nn_hls-1,:)
+            e1u(jpi-nn_hls,:) = e1u(jpi-nn_hls-1,:)
+            e2u(jpi-nn_hls,:) = e2u(jpi-nn_hls-1,:)
+            e1v(jpi-nn_hls,:) = e1v(jpi-nn_hls-1,:)
+            e2v(jpi-nn_hls,:) = e2v(jpi-nn_hls-1,:)
+            e1f(jpi-nn_hls,:) = e1f(jpi-nn_hls-1,:)
+            e2f(jpi-nn_hls,:) = e2f(jpi-nn_hls-1,:)
          ENDIF
       ENDIF
@@ -222,8 +232,8 @@
       !---------------------------------------------------------------------
 
-      ind2 = nn_hls + 1 + nbghostcells_x
+      ind2 = nn_hls + 1 + nbghostcells_x_w
       ind3 = nn_hls + 1 + nbghostcells_y_s
 
-      nbghostcellsfine_tot_x=nbghostcells_x+1
+      nbghostcellsfine_tot_x=max(nbghostcells_x_w,nbghostcells_x_e)+1
       nbghostcellsfine_tot_y=max(nbghostcells_y_s,nbghostcells_y_n)+1
 
@@ -232,6 +242,8 @@
       ! In case of East-West periodicity, prevent AGRIF interpolation at east and west boundaries
       ! The procnames will not be CALLed at these boundaries
-      if (jperio == 1) THEN
+      if (.not.lk_west) THEN
         CALL Agrif_Set_NearCommonBorderX(.TRUE.)
+      endif
+      if (.not.lk_east) THEN
         CALL Agrif_Set_DistantCommonBorderX(.TRUE.)
       endif
@@ -360,4 +372,5 @@
       CALL Agrif_Set_interp(e3t_copy_id,interp=AGRIF_constant)
       CALL Agrif_Set_bc( e3t_copy_id, (/-npt_copy*iraf-1,max(nbghostcellsfine_tot_x,nbghostcellsfine_tot_y)-1/))
+      CALL Agrif_Set_Updatetype( e3t_copy_id, update = AGRIF_Update_Max)
 
 !      CALL Agrif_Set_bcinterp(e3t_connect_id,interp=AGRIF_linear)
@@ -417,7 +430,5 @@
                bounds_chunks(i,:,:,:) = bounds
             END DO
-
          ! FIRST CHUNCK (for j<=jpjglo)
-
             ! Original indices
             bounds_chunks(1,1,1,1) = bounds(1,1,2)
@@ -439,9 +450,10 @@
             bounds_chunks(2,1,1,1) = bounds(1,1,2)
             bounds_chunks(2,1,2,1) = bounds(1,2,2)
-            bounds_chunks(2,2,1,1) = jpjglo-2
+            bounds_chunks(2,2,1,1) = jpjglo-2*nn_hls
             bounds_chunks(2,2,2,1) = bounds(2,2,2)
 
            ! Where to find them
            ! We use the relation TAB(ji,jj)=TAB(jpiglo-ji+2,jpjglo-2-(jj-jpjglo))
+           ! We use the relation TAB(ji,jj)=TAB(jpiglo-ji+2,jpjglo-2*nn_hls-(jj-jpjglo))
 
             IF (ptx == 2) THEN ! T, V points
@@ -454,9 +466,9 @@
 
             IF (pty == 2) THEN ! T, U points
-               bounds_chunks(2,2,1,2) = jpjglo-2-(bounds(2,2,2) -jpjglo)
-               bounds_chunks(2,2,2,2) = jpjglo-2-(jpjglo-2      -jpjglo)
+               bounds_chunks(2,2,1,2) = jpjglo-2*nn_hls-(bounds(2,2,2) -jpjglo)
+               bounds_chunks(2,2,2,2) = jpjglo-2*nn_hls-(jpjglo-nn_hls -jpjglo)
             ELSE ! V, F points
-               bounds_chunks(2,2,1,2) = jpjglo-3-(bounds(2,2,2) -jpjglo)
-               bounds_chunks(2,2,2,2) = jpjglo-3-(jpjglo-2      -jpjglo)
+               bounds_chunks(2,2,1,2) = jpjglo-2*nn_hls-1-(bounds(2,2,2) -jpjglo)
+               bounds_chunks(2,2,2,2) = jpjglo-2*nn_hls-1-(jpjglo-nn_hls -jpjglo)
             ENDIF
       
@@ -465,5 +477,4 @@
 
          ELSE
-           
             nb_chunks = 1
             ALLOCATE(bounds_chunks(nb_chunks,ndim,2,2))
@@ -481,6 +492,6 @@
             bounds_chunks(1,1,2,2) = jpiglo-bounds(1,1,2)+2
 
-            bounds_chunks(1,2,1,2) = jpjglo-2-(bounds(2,2,2)-jpjglo)
-            bounds_chunks(1,2,2,2) = jpjglo-2-(bounds(2,1,2)-jpjglo)
+            bounds_chunks(1,2,1,2) = jpjglo-nn_hls-1-(bounds(2,2,2)-jpjglo)
+            bounds_chunks(1,2,2,2) = jpjglo-nn_hls-1-(bounds(2,1,2)-jpjglo)
 
             IF (ptx == 2) THEN ! T, V points
@@ -493,9 +504,9 @@
 
             IF (pty == 2) THEN ! T, U points
-               bounds_chunks(1,2,1,2) = jpjglo-2-(bounds(2,2,2) -jpjglo)
-               bounds_chunks(1,2,2,2) = jpjglo-2-(bounds(2,1,2) -jpjglo)
+               bounds_chunks(1,2,1,2) = jpjglo-2*nn_hls-(bounds(2,2,2) -jpjglo)
+               bounds_chunks(1,2,2,2) = jpjglo-2*nn_hls-(bounds(2,1,2) -jpjglo)
             ELSE ! V, F points
-               bounds_chunks(1,2,1,2) = jpjglo-3-(bounds(2,2,2) -jpjglo)
-               bounds_chunks(1,2,2,2) = jpjglo-3-(bounds(2,1,2) -jpjglo)
+               bounds_chunks(1,2,1,2) = jpjglo-2*nn_hls-1-(bounds(2,2,2) -jpjglo)
+               bounds_chunks(1,2,2,2) = jpjglo-2*nn_hls-1-(bounds(2,1,2) -jpjglo)
             ENDIF
 
@@ -505,5 +516,5 @@
 
       ELSE IF ( (bounds(1,1,2) < 1).AND.ldIperio ) THEN
-         
+
          IF (bounds(1,2,2) > 0) THEN
             nb_chunks = 2
@@ -515,14 +526,14 @@
             END DO
 
-            bounds_chunks(1,1,1,2) = bounds(1,1,2)+jpiglo-2
-            bounds_chunks(1,1,2,2) = 1+jpiglo-2
+            bounds_chunks(1,1,1,2) = bounds(1,1,2)+jpiglo-2*nn_hls
+            bounds_chunks(1,1,2,2) = jpiglo-nn_hls
 
             bounds_chunks(1,1,1,1) = bounds(1,1,2)
-            bounds_chunks(1,1,2,1) = 1
-
-            bounds_chunks(2,1,1,2) = 2
+            bounds_chunks(1,1,2,1) = 1+nn_hls
+
+            bounds_chunks(2,1,1,2) = 1+nn_hls 
             bounds_chunks(2,1,2,2) = bounds(1,2,2)
 
-            bounds_chunks(2,1,1,1) = 2
+            bounds_chunks(2,1,1,1) = 1+nn_hls 
             bounds_chunks(2,1,2,1) = bounds(1,2,2)
          ELSE
@@ -534,6 +545,6 @@
                bounds_chunks(i,:,:,:) = bounds
             END DO
-            bounds_chunks(1,1,1,2) = bounds(1,1,2)+jpiglo-2
-            bounds_chunks(1,1,2,2) = bounds(1,2,2)+jpiglo-2
+            bounds_chunks(1,1,1,2) = bounds(1,1,2)+jpiglo-2*nn_hls
+            bounds_chunks(1,1,2,2) = bounds(1,2,2)+jpiglo-2*nn_hls
 
             bounds_chunks(1,1,1,1) = bounds(1,1,2)
@@ -577,7 +588,7 @@
       ELSE IF (isens ==2) THEN
          IF (pty == 2) THEN ! T, U points
-            agrif_external_switch_index = jpjglo-2-(i1 -jpjglo)
+            agrif_external_switch_index = jpjglo-2*nn_hls-(i1 -jpjglo)
          ELSE ! V, F points
-            agrif_external_switch_index = jpjglo-3-(i1 -jpjglo)
+            agrif_external_switch_index = jpjglo-2*nn_hls-1-(i1 -jpjglo)
          ENDIF
       ENDIF
@@ -1094,7 +1105,7 @@
 
       INTEGER ::   ios
-
-      NAMELIST/namagrif/ nn_cln_update,ln_spc_dyn,rn_sponge_tra,rn_sponge_dyn,ln_chk_bathy,npt_connect,   &
-      &  npt_copy
+      INTEGER :: imin, imax, jmin, jmax
+
+      NAMELIST/namagrif/ ln_vert_remap, npt_connect, npt_copy 
 
   !    REWIND( numnam_ref )              ! Namelist namagrif in reference namelist : nesting parameters
@@ -1107,57 +1118,134 @@
       IF(lwm) WRITE ( numond, namagrif )
 
+      IF (.NOT.Agrif_Root()) THEN
+
+         IF(lwp) THEN                     ! Control print
+            WRITE(numout,*)
+            WRITE(numout,*) 'agrif_nemo_init : nesting'
+            WRITE(numout,*) '~~~~~~~'
+            WRITE(numout,*) '   Namelist namagrif : set nesting parameters'
+            WRITE(numout,*) '      ln_vert_remap        = ', ln_vert_remap 
+            WRITE(numout,*) '      npt_copy             = ', npt_copy
+            WRITE(numout,*) '      npt_connect          = ', npt_connect
+         ENDIF
+
+         imin = Agrif_Ix()
+         imax = Agrif_Ix() + nbcellsx/AGRIF_Irhox()
+         jmin = Agrif_Iy()
+         jmax = Agrif_Iy() + nbcellsy/AGRIF_Irhoy()
+         lk_west  = .TRUE. ; lk_east  = .TRUE.
+         lk_north = .TRUE. ; lk_south = .TRUE.
+
+         ! Check zoom position along i:
+         ! ----------------------------
+         IF ( imin >= imax ) THEN 
+            CALL ctl_stop( 'STOP', 'AGRIF zoom imin must be < imax' ) 
+         ENDIF
+
+         IF ( (Agrif_Parent(jperio)==4).OR.(Agrif_Parent(jperio)==1) ) THEN 
+            IF ( (jperio==4).OR.(jperio==1) ) THEN ! Cyclic east-west zoom
+               lk_west = .FALSE. ; lk_east = .FALSE. 
+               ! Checks:
+               IF ( imin/=1-Agrif_Parent(nbghostcells_x_w) ) THEN
+                  WRITE(ctmp1, 9000) ' AGRIF zoom is East-West cyclic, imin must = ', &
+                  1 - Agrif_Parent(nbghostcells_x_w) 
+                  CALL ctl_stop( 'STOP', ctmp1 ) 
+               ENDIF
+               IF ( imax/=Agrif_Parent(Ni0glo)+1-Agrif_Parent(nbghostcells_x_w)) THEN
+                  WRITE(ctmp1, 9000) ' AGRIF zoom is East-West cyclic, imax must = ', & 
+                  Agrif_Parent(Ni0glo) + 1 - Agrif_Parent(nbghostcells_x_w) 
+                  CALL ctl_stop( 'STOP', ctmp1 ) 
+               ENDIF
+            ELSE
+               IF ( imax>Agrif_Parent(Ni0glo)-Agrif_Parent(nbghostcells_x_w)) THEN
+                  WRITE(ctmp1, 9000) ' AGRIF zoom imax must be <= ', &
+                  Agrif_Parent(Ni0glo) - Agrif_Parent(nbghostcells_x_w)
+                  CALL ctl_stop( 'STOP', ctmp1 )
+               ENDIF
+            ENDIF 
+         ELSE
+            IF ( imin<2-Agrif_Parent(nbghostcells_x_w) ) THEN
+               WRITE(ctmp1, 9000) ' AGRIF zoom imin must be >= ', &
+               2 - Agrif_Parent(nbghostcells_x_w)
+               CALL ctl_stop( 'STOP', ctmp1 )
+            ENDIF
+            IF ( imax>Agrif_Parent(Ni0glo)-Agrif_Parent(nbghostcells_x_w)) THEN
+               WRITE(ctmp1, 9000) ' AGRIF zoom imax must be <= ', &
+               Agrif_Parent(Ni0glo) - Agrif_Parent(nbghostcells_x_w)
+               CALL ctl_stop( 'STOP', ctmp1 )
+            ENDIF
+            IF ( imin==2-Agrif_Parent(nbghostcells_x_w) )                    lk_west = .FALSE. ! Set along wall
+            IF ( imax==Agrif_Parent(Ni0glo)-Agrif_Parent(nbghostcells_x_w) ) lk_east = .FALSE. ! Set along wall
+         ENDIF
+
+         ! Check zoom position along j:
+         ! ----------------------------
+         IF ( jmin >= jmax ) THEN 
+            CALL ctl_stop( 'STOP', 'AGRIF zoom jmin must be < jmax' ) 
+         ENDIF
+
+         IF ( Agrif_Parent(jperio)==4 ) THEN 
+            IF (jperio==4) THEN ! North-Fold 
+               lk_north = .FALSE. 
+               ! Checks:
+               IF ( jmax/=Agrif_Parent(Nj0glo)+1-Agrif_Parent(nbghostcells_y_s)) THEN
+                  WRITE(ctmp1, 9000) ' AGRIF zoom has a North-Fold, jmax must = ', & 
+                  Agrif_Parent(Nj0glo) + 1 - Agrif_Parent(nbghostcells_y_s) 
+                  CALL ctl_stop( 'STOP', ctmp1 ) 
+               ENDIF
+            ENDIF 
+         ELSE
+            IF ( jmax>Agrif_Parent(Nj0glo)-Agrif_Parent(nbghostcells_y_s)) THEN
+               WRITE(ctmp1, 9000) ' AGRIF zoom jmax must be <= ', &
+               Agrif_Parent(Nj0glo) - Agrif_Parent(nbghostcells_y_s)
+               CALL ctl_stop( 'STOP', ctmp1 )
+            ENDIF
+            IF ( jmax==Agrif_Parent(Nj0glo)-Agrif_Parent(nbghostcells_y_s) ) lk_north = .FALSE. ! Set along wall
+         ENDIF
+
+         IF ( jmin<2-Agrif_Parent(nbghostcells_y_s)) THEN
+            WRITE(ctmp1, 9000) ' AGRIF zoom jmin must be >= ', &
+            2 - Agrif_Parent(nbghostcells_y_s)
+            CALL ctl_stop( 'STOP', ctmp1 )
+         ENDIF
+         IF ( jmin==2-Agrif_Parent(nbghostcells_y_s) )                       lk_south = .FALSE. ! Set along wall
+
+      ELSE ! Root grid
+         lk_west  = .FALSE. ; lk_east  = .FALSE.
+         lk_north = .FALSE. ; lk_south = .FALSE.
+      ENDIF
+
+      ! Set ghost cells:
+      nbghostcells_x_w = nbghostcells
+      nbghostcells_x_e = nbghostcells
+      nbghostcells_y_s = nbghostcells
+      nbghostcells_y_n = nbghostcells
+
+      IF (.NOT.lk_west ) nbghostcells_x_w = 1 
+      IF (.NOT.lk_east ) nbghostcells_x_e = 1 
+      IF (.NOT.lk_south) nbghostcells_y_s = 1 
+      IF (.NOT.lk_north) nbghostcells_y_n = 1 
+
+      IF ((jperio == 1).OR.(jperio == 4)) THEN
+         nbghostcells_x_w = 0 ; nbghostcells_x_e = 0
+      ENDIF
+      IF (jperio == 4) THEN
+         nbghostcells_y_n = 0
+      ENDIF
+
       IF(lwp) THEN                     ! Control print
          WRITE(numout,*)
-         WRITE(numout,*) 'agrif_nemo_init : nesting'
-         WRITE(numout,*) '~~~~~~~'
-         WRITE(numout,*) '   Namelist namagrif : set nesting parameters'
-         WRITE(numout,*) '      npt_copy             = ', npt_copy
-         WRITE(numout,*) '      npt_connect          = ', npt_connect
-      ENDIF
-
-   ! Set the number of ghost cells according to periodicity
-
-      IF (.not.agrif_root()) THEN
-         lk_west  = .NOT. ( Agrif_Ix() == 1 )
-         lk_east  = .NOT. ( Agrif_Ix() + nbcellsx/AGRIF_Irhox() == Agrif_Parent(Ni0glo) + 1 )
-         lk_south = .NOT. ( Agrif_Iy() == 1 )
-         lk_north = .NOT. ( Agrif_Iy() + nbcellsy/AGRIF_Irhoy() == Agrif_Parent(Nj0glo) - 1 )
-
-         nbghostcells_x   = nbghostcells
-         nbghostcells_y_s = nbghostcells
-         nbghostcells_y_n = nbghostcells
-
-         IF (.NOT.lk_south) THEN
-            nbghostcells_y_s = 1 
-         ENDIF
-         IF (.NOT.lk_north) THEN
-            nbghostcells_y_n = 1 
-         ENDIF
-
-         IF ((jperio == 1).OR.(jperio == 4)) THEN
-            nbghostcells_x = 0
-         ENDIF
-         IF(lwp) THEN                     ! Control print
-            WRITE(numout,*)
-            WRITE(numout,*) 'nbghostcells_y_s', nbghostcells_y_s
-            WRITE(numout,*) 'nbghostcells_y_n', nbghostcells_y_n
-            WRITE(numout,*) 'nbghostcells_x', nbghostcells_x
-            WRITE(numout,*) 'lk_west', lk_west
-            WRITE(numout,*) 'lk_east', lk_east
-            WRITE(numout,*) 'lk_south', lk_south
-            WRITE(numout,*) 'lk_north', lk_north
-         ENDIF
-      ELSE ! root grid
-         nbghostcells_x   = 1 
-         nbghostcells_y_s = 1 
-         nbghostcells_y_n = 1 
-
-         IF ((jperio == 1).OR.(jperio == 4)) THEN
-           nbghostcells_x = 0
-         ENDIF
-         IF (jperio == 4) THEN
-           nbghostcells_y_n = 0 ! for completeness
-         ENDIF
-      ENDIF
+         WRITE(numout,*) 'AGRIF boundaries and ghost cells:'
+         WRITE(numout,*) 'lk_west' , lk_west
+         WRITE(numout,*) 'lk_east' , lk_east
+         WRITE(numout,*) 'lk_south', lk_south
+         WRITE(numout,*) 'lk_north', lk_north
+         WRITE(numout,*) 'nbghostcells_y_s', nbghostcells_y_s
+         WRITE(numout,*) 'nbghostcells_y_n', nbghostcells_y_n
+         WRITE(numout,*) 'nbghostcells_x_w', nbghostcells_x_w
+         WRITE(numout,*) 'nbghostcells_x_e', nbghostcells_x_e
+      ENDIF
+
+9000  FORMAT (a, i4)
 
    END SUBROUTINE agrif_nemo_init
Index: utils/tools/DOMAINcfg/src/domzgr.F90
===================================================================
--- utils/tools/DOMAINcfg/src/domzgr.F90	(revision 15162)
+++ utils/tools/DOMAINcfg/src/domzgr.F90	(revision 15279)
@@ -45,4 +45,5 @@
    USE dombat
    USE domisf
+   USE agrif_connect
    USE agrif_domzgr
 
@@ -176,4 +177,10 @@
       IF ( ln_sco .AND. ln_isfcav ) ioptio = ioptio + 1
       IF( ioptio > 0 )   CALL ctl_stop( ' Cavity not tested/compatible with full step (zco) and sigma (ln_sco) ' )
+
+#if defined key_agrif
+!      IF ( (.NOT.Agrif_Root()).AND.((.NOT.ln_zps).OR.(.NOT.Agrif_parent(ln_zps)))) THEN
+!         CALL ctl_stop( 'STOP', 'AGRIF zooms require ln_zps=T for both Child and Parent')
+!      ENDIF
+#endif
 
       IF(.NOT.ln_read_cfg) THEN
@@ -560,5 +567,5 @@
       REAL(wp) ::   r_bump , h_bump , h_oce   ! bump characteristics 
       REAL(wp) ::   zi, zj, zh, zhmin         ! local scalars
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   zrand 
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   zrand, zbatv 
       !!----------------------------------------------------------------------
       !
@@ -609,8 +616,15 @@
             ENDIF
             IF ( cp_cfg=='DOME' ) THEN
-               bathy(:,:) = MIN(3600._wp, MAX( 600._wp,  600._wp -gphit(:,:)*1.e3*0.01 ))
+               ALLOCATE(zbatv(jpi,jpj))
+               zbatv(:,:) = MIN(3600._wp, MAX( 600._wp,  600._wp -gphiv(:,:)*1.e3*0.01 ))
+               bathy(:,1) = 0._wp
+               DO jj =2,jpj
+                  bathy(:,jj) = 0.5_wp*(zbatv(:,jj) + zbatv(:,jj-1))
+               END DO 
+               CALL lbc_lnk( 'zgr_bat', bathy, 'T', 1._wp )
                WHERE (gphit(:,:) >0._wp) bathy(:,:) = 0._wp
                ! Dig inlet:
                WHERE ((gphit(:,:)>0._wp).AND.(glamt(:,:)>-50._wp).AND.(glamt(:,:)<50._wp)) bathy(:,:) = 600._wp
+               DEALLOCATE(zbatv)
             ENDIF
 !            CALL lbc_lnk( 'zgr_bat', bathy, 'T', 1._wp )
@@ -731,4 +745,8 @@
       ENDIF
       !
+#if defined key_agrif
+      IF ( .NOT.Agrif_Root() ) CALL agrif_bathymetry_connect
+#endif
+      !
       IF ( .not. ln_sco ) THEN                                !==  set a minimum depth  ==!
          IF( rn_hmin < 0._wp ) THEN    ;   ik = - INT( rn_hmin )                                      ! from a nb of level
@@ -827,8 +845,8 @@
            mbathy(  mi0(jpiglo-nn_hls):mi1(jpiglo-nn_hls),:) = jpkm1
          ENDIF
-      ELSEIF( l_Iperio ) THEN
+      ELSEIF( jperio == 1 .OR. jperio == 4 .OR. jperio ==  6 ) THEN
          IF(lwp) WRITE(numout,*)' east-west cyclic boundary conditions on mbathy: jperio = ', jperio
-         mbathy( 1 ,:) = mbathy(jpim1,:)
-         mbathy(jpi,:) = mbathy(  2  ,:)
+!         mbathy( 1 ,:) = mbathy(jpim1,:)
+!         mbathy(jpi,:) = mbathy(  2  ,:)
       ELSEIF( jperio == 2 ) THEN
          IF(lwp) WRITE(numout,*) '   equatorial boundary conditions on mbathy: jperio = ', jperio
@@ -1409,5 +1427,5 @@
       ! Envelope bathymetry saved in hbatt
       hbatt(:,:) = zenv(:,:) 
-      IF( MINVAL( gphit(:,:) ) * MAXVAL( gphit(:,:) ) <= 0._wp ) THEN
+      IF ((ntopo>0).AND.MINVAL( gphit(:,:) ) * MAXVAL( gphit(:,:) ) <= 0._wp ) THEN
          CALL ctl_warn( ' s-coordinates are tapered in vicinity of the Equator' )
          DO jj = 1, jpj
@@ -1532,4 +1550,7 @@
          END DO
       END DO
+
+      WHERE (bathy(:,:)<=0) mbathy(:,:) = 0
+
       IF(lwp ) WRITE(numout,*) ' MIN val mbathy h90 ', MINVAL( mbathy(:,:) ),   &
          &                                                       ' MAX ', MAXVAL( mbathy(:,:) )
Index: utils/tools/DOMAINcfg/src/mppini.F90
===================================================================
--- utils/tools/DOMAINcfg/src/mppini.F90	(revision 15162)
+++ utils/tools/DOMAINcfg/src/mppini.F90	(revision 15279)
@@ -107,12 +107,13 @@
 
       IF( .NOT. Agrif_Root() ) THEN       ! AGRIF children: specific setting (cf. agrif_user.F90)
-         print *,'nbcellsx = ',nbcellsx,nbghostcells_x
+         print *,'nbcellsx = ',nbcellsx,nbghostcells_x_w,nbghostcells_x_e
          print *,'nbcellsy = ',nbcellsy,nbghostcells_y_s,nbghostcells_y_n
-         IF( Ni0glo /= nbcellsx + 2*nbghostcells_x ) THEN
+         IF( Ni0glo /= nbcellsx + nbghostcells_x_w + nbghostcells_x_e ) THEN
             IF(lwp) THEN
                WRITE(numout,*)
-               WRITE(numout,*) 'Ni0glo should be: ', nbcellsx + 2*nbghostcells_x
+               WRITE(numout,*) 'Ni0glo should be: ', nbcellsx + nbghostcells_x_w  + nbghostcells_x_e
             ENDIF        
-            CALL ctl_stop( 'STOP', 'mpp_init: Agrif children requires Ni0glo == nbcellsx + 2*nbghostcells_x' )
+            CALL ctl_stop( 'STOP', &
+                'mpp_init: Agrif children requires Ni0glo == nbcellsx + nbghostcells_x_w + nbghostcells_x_e' )
          ENDIF   
          IF( Nj0glo /= nbcellsy + nbghostcells_y_s + nbghostcells_y_n ) THEN
@@ -361,10 +362,11 @@
       CALL agrif_nemo_init()
       IF( .NOT. Agrif_Root() ) THEN       ! AGRIF children: specific setting (cf. agrif_user.F90)
-         IF( Ni0glo /= nbcellsx + 2*nbghostcells_x ) THEN
+         IF( Ni0glo /= nbcellsx + nbghostcells_x_w + nbghostcells_x_e ) THEN
             IF(lwp) THEN
                WRITE(numout,*)
-               WRITE(numout,*) 'Ni0glo should be: ', nbcellsx + 2*nbghostcells_x
+               WRITE(numout,*) 'Ni0glo should be: ', nbcellsx + nbghostcells_x_w  + nbghostcells_x_e
             ENDIF        
-            CALL ctl_stop( 'STOP', 'mpp_init: Agrif children requires Ni0glo == nbcellsx + 2*nbghostcells_x' )
+            CALL ctl_stop( 'STOP', & 
+                 'mpp_init: Agrif children requires Ni0glo == nbcellsx + nbghostcells_x_w + nbghostcells_x_e' )
          ENDIF   
          IF( Nj0glo /= nbcellsy  + nbghostcells_y_s + nbghostcells_y_n ) THEN
Index: utils/tools/DOMAINcfg/src/nemogcm.F90
===================================================================
--- utils/tools/DOMAINcfg/src/nemogcm.F90	(revision 15162)
+++ utils/tools/DOMAINcfg/src/nemogcm.F90	(revision 15279)
@@ -104,9 +104,9 @@
       CALL Agrif_Regrid()
       
-      CALL Agrif_Step_Child(agrif_boundary_connections)
+!      CALL Agrif_Step_Child(agrif_boundary_connections)
       
       CALL Agrif_Step_Child_adj(agrif_update_all)
 
-      CALL Agrif_Step_Child(agrif_recompute_scalefactors)
+!      CALL Agrif_Step_Child(agrif_recompute_scalefactors)
       
       CALL Agrif_Step_Child(cfg_write)
Index: utils/tools/DOMAINcfg/src/par_oce.f90
===================================================================
--- utils/tools/DOMAINcfg/src/par_oce.f90	(revision 15162)
+++ utils/tools/DOMAINcfg/src/par_oce.f90	(revision 15279)
@@ -56,9 +56,10 @@
    INTEGER, PUBLIC            ::   nbug_in_agrif_conv_do_not_remove_or_modify = 1 - 1
    INTEGER, PUBLIC, PARAMETER ::   nbghostcells = 4 !: number of ghost cells: default value
-   INTEGER, PUBLIC            ::   nbghostcells_x   !: number of ghost cells in i-direction
-   INTEGER, PUBLIC            ::   nbghostcells_y_s   !: number of ghost cells in j-direction at south
-   INTEGER, PUBLIC            ::   nbghostcells_y_n   !: number of ghost cells in j-direction at north
-   INTEGER, PUBLIC            ::   nbcellsx   ! = jpiglo - 2 - 2*nbghostcells_x   !: number of cells in i-direction
-   INTEGER, PUBLIC            ::   nbcellsy   ! = jpjglo - 2 - 2*nbghostcells_y   !: number of cells in j-direction
+   INTEGER, PUBLIC            ::   nbghostcells_x_w   !: number of ghost cells in i-direction (west)
+   INTEGER, PUBLIC            ::   nbghostcells_x_e   !: number of ghost cells in i-direction (east)
+   INTEGER, PUBLIC            ::   nbghostcells_y_s   !: number of ghost cells in j-direction (south)
+   INTEGER, PUBLIC            ::   nbghostcells_y_n   !: number of ghost cells in j-direction (north)
+   INTEGER, PUBLIC            ::   nbcellsx   ! = Ni0glo - nbghostcells_x_w - nbghostcells_x_e  !: number of cells in i-direction
+   INTEGER, PUBLIC            ::   nbcellsy   ! = Nj0glo - nbghostcells_y_s - nbghostcells_y_n  !: number of cells in j-direction
 
    ! local domain size                !!! * local computational domain *
