Index: /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/1_namelist_cfg
===================================================================
--- /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/1_namelist_cfg	(revision 13162)
+++ /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/1_namelist_cfg	(revision 13163)
@@ -90,5 +90,4 @@
 !-----------------------------------------------------------------------
 &namagrif      !  AGRIF zoom                                            ("key_agrif")
-ln_bry_south = .TRUE.
 !-----------------------------------------------------------------------
 /
Index: /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/1_namelist_ref
===================================================================
--- /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/1_namelist_ref	(revision 13162)
+++ /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/1_namelist_ref	(revision 13163)
@@ -23,7 +23,9 @@
 &namdom        !   space and time domain (bathymetry, mesh, timestep)
 !-----------------------------------------------------------------------
+   ln_read_cfg = .false.   !  Read from a domain_cfg file
    nn_bathy    =    1      !  compute analyticaly (=0) or read (=1) the bathymetry file
                            !  or compute (2) from external bathymetry
    nn_interp   =    1                          ! type of interpolation (nn_bathy =2)
+   cn_domcfg   = ' '       ! Name of the domain_cfg input file
    cn_topo     =  'bathymetry_ORCA12_V3.3.nc'  ! external topo file (nn_bathy =2)
    cn_bath     =  'Bathymetry'                 ! topo name in file  (nn_bathy =2)
@@ -169,5 +171,4 @@
    npt_connect   = 2
    npt_copy      = 2
-   ln_bry_south = .TRUE.
 /
 !-----------------------------------------------------------------------
Index: /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/2_namelist_cfg
===================================================================
--- /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/2_namelist_cfg	(revision 13162)
+++ /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/2_namelist_cfg	(revision 13163)
@@ -90,5 +90,4 @@
 !-----------------------------------------------------------------------
 &namagrif      !  AGRIF zoom                                            ("key_agrif")
-ln_bry_south = .TRUE.
 !-----------------------------------------------------------------------
 /
Index: /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/2_namelist_ref
===================================================================
--- /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/2_namelist_ref	(revision 13162)
+++ /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/2_namelist_ref	(revision 13163)
@@ -23,7 +23,9 @@
 &namdom        !   space and time domain (bathymetry, mesh, timestep)
 !-----------------------------------------------------------------------
+   ln_read_cfg = .false.   !  Read from a domain_cfg file
    nn_bathy    =    1      !  compute analyticaly (=0) or read (=1) the bathymetry file
                            !  or compute (2) from external bathymetry
    nn_interp   =    1                          ! type of interpolation (nn_bathy =2)
+   cn_domcfg   = ' '       ! Name of the domain_cfg input file
    cn_topo     =  'bathymetry_ORCA12_V3.3.nc'  ! external topo file (nn_bathy =2)
    cn_bath     =  'Bathymetry'                 ! topo name in file  (nn_bathy =2)
@@ -169,5 +171,4 @@
    npt_connect   = 2
    npt_copy      = 2
-   ln_bry_south = .TRUE.
 /
 !-----------------------------------------------------------------------
Index: /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/3_namelist_cfg
===================================================================
--- /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/3_namelist_cfg	(revision 13162)
+++ /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/3_namelist_cfg	(revision 13163)
@@ -90,5 +90,4 @@
 !-----------------------------------------------------------------------
 &namagrif      !  AGRIF zoom                                            ("key_agrif")
-   ln_bry_south = .FALSE.
 !-----------------------------------------------------------------------
 /
Index: /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/3_namelist_ref
===================================================================
--- /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/3_namelist_ref	(revision 13162)
+++ /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/3_namelist_ref	(revision 13163)
@@ -23,7 +23,9 @@
 &namdom        !   space and time domain (bathymetry, mesh, timestep)
 !-----------------------------------------------------------------------
+   ln_read_cfg = .false.   !  Read from a domain_cfg file
    nn_bathy    =    1      !  compute analyticaly (=0) or read (=1) the bathymetry file
                            !  or compute (2) from external bathymetry
    nn_interp   =    1                          ! type of interpolation (nn_bathy =2)
+   cn_domcfg   = ' '       ! Name of the domain_cfg input file
    cn_topo     =  'bathymetry_ORCA12_V3.3.nc'  ! external topo file (nn_bathy =2)
    cn_bath     =  'Bathymetry'                 ! topo name in file  (nn_bathy =2)
@@ -169,5 +171,4 @@
    npt_connect   = 2
    npt_copy      = 2
-   ln_bry_south = .TRUE.
 /
 !-----------------------------------------------------------------------
Index: /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/make_namelist.py
===================================================================
--- /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/make_namelist.py	(revision 13162)
+++ /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/make_namelist.py	(revision 13163)
@@ -107,7 +107,4 @@
            if line.strip().startswith('cp_cfg'):
            	   line = "   cp_cfg = 'dumb'\n"                 
-           if nbghostcells_y_s == 0 :
-               if line.strip().startswith('ln_bry_south'):
-                   line = "   ln_bry_south = .FALSE.\n"                       
            f2.write(line)
            cnt1 += 1
Index: /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/namelist_cfg
===================================================================
--- /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/namelist_cfg	(revision 13162)
+++ /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/namelist_cfg	(revision 13163)
@@ -91,5 +91,4 @@
 !-----------------------------------------------------------------------
 &namagrif      !  AGRIF zoom                                            ("key_agrif")
-ln_bry_south = .TRUE.
 !-----------------------------------------------------------------------
 /
Index: /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/namelist_ref
===================================================================
--- /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/namelist_ref	(revision 13162)
+++ /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/namelist_ref	(revision 13163)
@@ -172,5 +172,4 @@
    npt_connect   = 2
    npt_copy      = 2
-   ln_bry_south = .TRUE.
 /
 !-----------------------------------------------------------------------
Index: /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/src/agrif_connect.F90
===================================================================
--- /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/src/agrif_connect.F90	(revision 13162)
+++ /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/src/agrif_connect.F90	(revision 13163)
@@ -201,5 +201,5 @@
 
       ! --- South --- !
-      IF(( (nbondj == -1) .OR. (nbondj == 2) ).AND.(ln_bry_south)) THEN
+      IF(( (nbondj == -1) .OR. (nbondj == 2) ).AND.(lk_south)) THEN
          ind1 = 1+nbghostcells + istart
          ind2 = ind1 + ispongearea 
Index: /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/src/agrif_parameters.F90
===================================================================
--- /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/src/agrif_parameters.F90	(revision 13162)
+++ /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/src/agrif_parameters.F90	(revision 13163)
@@ -14,5 +14,4 @@
 	INTEGER :: npt_copy
 	INTEGER :: npt_connect
-	LOGICAL :: ln_bry_south = .TRUE.
 	REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   ztabramp
 	REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:,:) ::   e3t_interp
Index: /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/src/agrif_user.F90
===================================================================
--- /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/src/agrif_user.F90	(revision 13162)
+++ /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/src/agrif_user.F90	(revision 13163)
@@ -226,5 +226,5 @@
         CALL Agrif_Set_DistantCommonBorderX(.TRUE.)
       endif
-      if (.not.ln_bry_south) THEN
+      if (.not.lk_south) THEN
         CALL Agrif_Set_NearCommonBorderY(.TRUE.)
       endif
@@ -850,5 +850,5 @@
         ! May need to extend at south boundary
           IF (j1<1) THEN
-            IF (.NOT.agrif_child(ln_bry_south)) THEN
+            IF (.NOT.agrif_child(lk_south)) THEN
               IF ((nbondj == -1).OR.(nbondj == 2)) THEN
                 DO jj=1,j2
@@ -888,5 +888,5 @@
       IF( before) THEN
           IF (j1<1) THEN
-            IF (.NOT.agrif_child(ln_bry_south)) THEN
+            IF (.NOT.agrif_child(lk_south)) THEN
               IF ((nbondj == -1).OR.(nbondj == 2)) THEN
                 DO jj=1,j2
@@ -966,5 +966,5 @@
       IF( before) THEN
           IF (j1<1) THEN
-            IF (.NOT.agrif_child(ln_bry_south)) THEN
+            IF (.NOT.agrif_child(lk_south)) THEN
               IF ((nbondj == -1).OR.(nbondj == 2)) THEN
                 DO jj=1,j2
@@ -1004,5 +1004,5 @@
       IF( before) THEN
           IF (j1<1) THEN
-            IF (.NOT.agrif_child(ln_bry_south)) THEN
+            IF (.NOT.agrif_child(lk_south)) THEN
               IF ((nbondj == -1).OR.(nbondj == 2)) THEN
                 DO jj=1,j2
@@ -1076,5 +1076,5 @@
 
       NAMELIST/namagrif/ nn_cln_update,ln_spc_dyn,rn_sponge_tra,rn_sponge_dyn,ln_chk_bathy,npt_connect,   &
-      &  npt_copy, ln_bry_south
+      &  npt_copy
 
       REWIND( numnam_ref )              ! Namelist namagrif in reference namelist : nesting parameters
@@ -1094,5 +1094,4 @@
          WRITE(numout,*) '      npt_copy             = ', npt_copy
          WRITE(numout,*) '      npt_connect          = ', npt_connect
-         WRITE(numout,*) '      ln_bry_south  = ', ln_bry_south
       ENDIF
 
@@ -1102,4 +1101,9 @@
       nbghostcells_y_s = nbghostcells
       nbghostcells_y_n = nbghostcells
+
+      lk_west  = .NOT. ( Agrif_Ix() == 1 )
+      lk_east  = .NOT. ( Agrif_Ix() + nbcellsx/AGRIF_Irhox() == Agrif_Parent(jpiglo) -1 )
+      lk_south = .NOT. ( Agrif_Iy() == 1 )
+      lk_north = .NOT. ( Agrif_Iy() + nbcellsy/AGRIF_Irhoy() == Agrif_Parent(jpjglo) -1 )
 
       IF (.not.agrif_root()) THEN
@@ -1107,5 +1111,5 @@
           nbghostcells_x = 0
         ENDIF
-        IF (.NOT.ln_bry_south) THEN
+        IF (.NOT.lk_south) THEN
           nbghostcells_y_s = 0
         ENDIF
Index: /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/src/dombat.F90
===================================================================
--- /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/src/dombat.F90	(revision 13162)
+++ /utils/tools_dev_r12970_AGRIF_CMEMS/DOMAINcfg/src/dombat.F90	(revision 13163)
@@ -408,5 +408,5 @@
        ! Correct South and North
 #if defined key_agrif
-      IF( ln_bry_south ) THEN  
+      IF( lk_south ) THEN  
          IF( (nbondj == -1).OR.(nbondj == 2) ) THEN
            bathy(:,1)=bathy(:,2)
