Index: utils/tools/NESTING/nordic1
===================================================================
--- utils/tools/NESTING/nordic1	(revision 9688)
+++ utils/tools/NESTING/nordic1	(revision 9694)
@@ -11,11 +11,12 @@
     new_topo = true
     elevation_database = 'GEBCO_2014_2D.nc'
-    elevation_name = 'elevation'
-    smoothing = true
-    smoothing_factor = 0.6
-    nb_connection_pts = 2    
-    removeclosedseas = true
-    type_bathy_interp = 2 
-    rn_hmin = -3 
+    elevation_name     = 'elevation'
+    smoothing          = true
+    smoothing_factor   = 0.6
+    npt_connect        = 1      ! default = 3
+    npt_copy           = 1      ! default = 2
+    removeclosedseas   = true
+    type_bathy_interp  = 2 
+    rn_hmin            = -3 
 /   
 
@@ -27,5 +28,5 @@
     rho  = 4
     rhot = 4
-    bathy_update = true
+    bathy_update        = true
     updated_parent_file = 'bathy_updated.nc'				
 /
@@ -33,24 +34,24 @@
 &vertical_grid    
     ln_e3_dep = .true.
-    ppkth = 21.4333619793800
-    ppacr = 3
-    ppdzmin = 0
-    pphmax  = 0
-    psur = -4762.96143546300
-    pa0  = 255.58049070440
-    pa1  = 245.58132232490
-    N  = 31
-    ldbletanh   = .FALSE.
-    pa2         = 0
-    ppkth2      = 0
-    ppacr2      = 0
+    ppkth     = 21.4333619793800
+    ppacr     = 3
+    ppdzmin   = 0
+    pphmax    = 0
+    psur      = -4762.96143546300
+    pa0       = 255.58049070440
+    pa1       = 245.58132232490
+    N         = 31
+    ldbletanh = .FALSE.
+    pa2       = 0
+    ppkth2    = 0
+    ppacr2    = 0
 /    
     
 &partial_cells    	
-    partial_steps = true
+    partial_steps      = true
     parent_bathy_meter = 'bathy_meter.nc'
     parent_batmet_name = 'Bathymetry'
-    e3zps_min = 20.
-    e3zps_rat = 0.1
+    e3zps_min          = 20.
+    e3zps_rat          = 0.1
 /
 
Index: utils/tools/NESTING/nordic1_update
===================================================================
--- utils/tools/NESTING/nordic1_update	(revision 9688)
+++ utils/tools/NESTING/nordic1_update	(revision 9694)
@@ -11,11 +11,12 @@
     new_topo = true
     elevation_database = '1_bathy_updated.nc'
-    elevation_name = 'Bathymetry'
-    smoothing = true
-    smoothing_factor = 0.6
-    nb_connection_pts = 2    
-    removeclosedseas = true
-    type_bathy_interp = 2 
-    rn_hmin = -3 
+    elevation_name     = 'Bathymetry'
+    smoothing          = true
+    smoothing_factor   = 0.6
+    npt_connect        = 1    
+    npt_copy           = 1
+    removeclosedseas   = true
+    type_bathy_interp  = 2 
+    rn_hmin            = -3 
 /   
 
@@ -33,24 +34,24 @@
 &vertical_grid    
     ln_e3_dep = .true.
-    ppkth = 21.4333619793800
-    ppacr = 3
-    ppdzmin = 0
-    pphmax  = 0
-    psur = -4762.96143546300
-    pa0  = 255.58049070440
-    pa1  = 245.58132232490
-    N  = 31
-    ldbletanh   = .FALSE.
-    pa2         = 0
-    ppkth2      = 0
-    ppacr2      = 0
+    ppkth     = 21.4333619793800
+    ppacr     = 3
+    ppdzmin   = 0
+    pphmax    = 0
+    psur      = -4762.96143546300
+    pa0       = 255.58049070440
+    pa1       = 245.58132232490
+    N         = 31
+    ldbletanh = .FALSE.
+    pa2       = 0
+    ppkth2    = 0
+    ppacr2    = 0
 /    
     
 &partial_cells    	
-    partial_steps = true
+    partial_steps      = true
     parent_bathy_meter = 'bathy_updated.nc'
     parent_batmet_name = 'Bathymetry'
-    e3zps_min = 20.
-    e3zps_rat = 0.1
+    e3zps_min          = 20.
+    e3zps_rat          = 0.1
 /
 
Index: utils/tools/NESTING/nordic2
===================================================================
--- utils/tools/NESTING/nordic2	(revision 9688)
+++ utils/tools/NESTING/nordic2	(revision 9694)
@@ -9,13 +9,14 @@
     
 &bathymetry    
-    new_topo = true
+    new_topo           = true
     elevation_database = 'GEBCO_2014_2D.nc'
-    elevation_name = 'elevation'
-    smoothing = true
-    smoothing_factor = 0.6
-    nb_connection_pts = 2 
-    removeclosedseas = true
-    type_bathy_interp = 2
-    rn_hmin = -3
+    elevation_name     = 'elevation'
+    smoothing          = true
+    smoothing_factor   = 0.6
+    npt_connect        = 1 
+    npt_copy           = 1
+    removeclosedseas   = true
+    type_bathy_interp  = 2
+    rn_hmin            = -3
 /   
 
@@ -33,24 +34,24 @@
 &vertical_grid    
     ln_e3_dep = .true.
-    ppkth = 21.4333619793800
-    ppacr = 3
-    ppdzmin = 0
-    pphmax  = 0
-    psur = -4762.96143546300
-    pa0  = 255.58049070440
-    pa1  = 245.58132232490
-    N  = 31
-    ldbletanh   = .FALSE.
-    pa2         = 0
-    ppkth2      = 0
-    ppacr2      = 0
+    ppkth     = 21.4333619793800
+    ppacr     = 3
+    ppdzmin   = 0
+    pphmax    = 0
+    psur      = -4762.96143546300
+    pa0       = 255.58049070440
+    pa1       = 245.58132232490
+    N         = 31
+    ldbletanh = .FALSE.
+    pa2       = 0
+    ppkth2    = 0
+    ppacr2    = 0
 /    
     
 &partial_cells    	
-    partial_steps = true
+    partial_steps      = true
     parent_bathy_meter = '1_bathy_meter.nc'
     parent_batmet_name = 'Bathymetry'
-    e3zps_min = 20.
-    e3zps_rat = 0.1
+    e3zps_min          = 20.
+    e3zps_rat          = 0.1
 /
 
Index: utils/tools/NESTING/src/agrif_connect_topo.f90
===================================================================
--- utils/tools/NESTING/src/agrif_connect_topo.f90	(revision 9688)
+++ utils/tools/NESTING/src/agrif_connect_topo.f90	(revision 9694)
@@ -902,19 +902,8 @@
           ipt = imin + 3 - 1 + (ji - ideb) / irafx
           !
-!          IF( G0%Bathy_meter(ipt,jpt) .LE. 0. .AND.                      &
-!               MAXVAL(G1%Bathy_meter(ji-irafx/2+diff:ji+irafx/2, &
-!               jj-irafy/2+diff:jj+irafy/2)).GT. 0.  ) THEN
-!             G0%Bathy_meter(ipt,jpt) = zmin
-             G0%Bathy_meter(ipt,jpt) =& 
-             SUM(G1%Bathy_meter(ji-irafx/2+diff:ji+irafx/2, &
-                                 jj-irafy/2+diff:jj+irafy/2))&
-                /irafx/irafy            
-             IF(G0%Bathy_meter(ipt,jpt).GT.0.) THEN
-                 G0%Bathy_meter(ipt,jpt) = MAX( G0%Bathy_meter(ipt,jpt),zmin)   
-             ENDIF
-             !
-             compt = compt + 1
-             !
-!          ENDIF
+          G0%Bathy_meter(ipt,jpt) = SUM(G1%Bathy_meter(ji-irafx/2+diff:ji+irafx/2,jj-irafy/2+diff:jj+irafy/2))/(irafx*irafy)
+          IF(G0%Bathy_meter(ipt,jpt).GT.0.)   G0%Bathy_meter(ipt,jpt) = MAX(G0%Bathy_meter(ipt,jpt),zmin)
+          !
+          compt = compt + 1
           !
        ENDDO
Index: utils/tools/NESTING/src/agrif_create_bathy.f90
===================================================================
--- utils/tools/NESTING/src/agrif_create_bathy.f90	(revision 9688)
+++ utils/tools/NESTING/src/agrif_create_bathy.f90	(revision 9694)
@@ -172,5 +172,5 @@
      CALL init_constant_bathy(G0%bathy_meter,bathy_fin_constant)
      !
-     boundary = connectionsize*irafx + nbghostcellsfine + 1 
+     boundary = npt_copy*irafx + nbghostcellsfine + 1 
      !
      ! connection carried out by copying parent grid values for the fine points
@@ -285,5 +285,5 @@
               Cell_lonmax = MAX(G1%glamf(ji-1,jj-1),G1%glamf(ji,jj-1),G1%glamf(ji,jj),G1%glamf(ji-1,jj))
               Cell_latmin = MIN(G1%gphif(ji-1,jj-1),G1%gphif(ji,jj-1),G1%gphif(ji,jj),G1%gphif(ji-1,jj))
-              Cell_latmax = MAX(G1%gphif(ji-1,jj-1),G1%gphif(ji,jj-1),G1%gphif(ji,jj),G1%gphif(ji-1,jj))	                   
+              Cell_latmax = MAX(G1%gphif(ji-1,jj-1),G1%gphif(ji,jj-1),G1%gphif(ji,jj),G1%gphif(ji-1,jj)) 
               !               
               ! SEARCH FOR ALL POINTS CONTAINED IN THIS CELL
@@ -329,5 +329,5 @@
                  ALLOCATE( vardep(nxhr,nyhr) )
                  ALLOCATE( mask_oce(nxhr,nyhr) )
-                 mask_oce = 0	       
+                 mask_oce = 0       
 
                  vardep(:,:) = G0%bathy_meter(iimin:iimax,jjmin:jjmax)
@@ -356,5 +356,5 @@
                           G1%bathy_meter(ji,jj) = ( vardep1d(SUM(mask_oce)/2) + vardep1d(SUM(mask_oce)/2+1) )/2.0
                        END IF
-                       DEALLOCATE(vardep1d)		   
+                       DEALLOCATE(vardep1d)   
                     ENDIF
                  ENDIF
@@ -458,5 +458,5 @@
         CALL Check_interp(G0,gdepw_ps_interp)      ! interpolation in connection zone (3 coarse grid cells)
         !
-        boundary = connectionsize*irafx + nbghostcellsfine + 1                     
+        boundary = npt_copy*irafx + nbghostcellsfine + 1                     
 ! J chanut: exclude matching if no open boundaries
         IF (.NOT.ASSOCIATED(G1%wgt)) &
@@ -504,7 +504,6 @@
 
         IF(.NOT. smoothing) WRITE(*,*) 'No smoothing process only connection is carried out'
-        WRITE(*,*) ' linear connection on ',nb_connection_pts,'coarse grid points'
-
-        connectionsize = 2 + nb_connection_pts 
+        WRITE(*,*) ' linear connection on ',npt_connect,'coarse grid points'
+
         !            
         gdepw_ps_interp = 0.
@@ -521,6 +520,6 @@
         !
         wghts = 1.
-        DO ji = boundary + 1 , boundary + nb_connection_pts * irafx
-            wghts = wghts - (1. / (nb_connection_pts*irafx - 1. ) )
+        DO ji = boundary + 1 , boundary + npt_connect * irafx
+            wghts = wghts - (1. / (npt_connect*irafx - 1. ) )
             DO jj=1,nyfin
                IF (G1%gdepw_ps(nbghostcellsfine+1,jj) > 0.) THEN
@@ -531,6 +530,6 @@
       
         wghts = 1.
-        DO ji = nxfin - boundary , nxfin - boundary - nb_connection_pts * irafx +1 , -1
-            wghts = wghts - (1. / (nb_connection_pts*irafx - 1. ) )
+        DO ji = nxfin - boundary , nxfin - boundary - npt_connect * irafx +1 , -1
+            wghts = wghts - (1. / (npt_connect*irafx - 1. ) )
             DO jj=1,nyfin
                IF (G1%gdepw_ps(nxfin-nbghostcellsfine,jj) > 0.) THEN
@@ -541,6 +540,6 @@
 
         wghts = 1.
-        DO jj = boundary + 1 , boundary + nb_connection_pts * irafy
-            wghts = wghts - (1. / (nb_connection_pts*irafy - 1. ) )
+        DO jj = boundary + 1 , boundary + npt_connect * irafy
+            wghts = wghts - (1. / (npt_connect*irafy - 1. ) )
             DO ji=1,nxfin
                IF (G1%gdepw_ps(ji,nbghostcellsfine+1) > 0.) THEN
@@ -551,6 +550,6 @@
 
         wghts = 1.
-        DO jj = nyfin - boundary , nyfin - boundary - nb_connection_pts * irafy +1, -1
-            wghts = wghts - (1. / (nb_connection_pts*irafy - 1. ) )
+        DO jj = nyfin - boundary , nyfin - boundary - npt_connect * irafy +1, -1
+            wghts = wghts - (1. / (npt_connect*irafy - 1. ) )
             DO ji=1,nxfin
                IF (G1%gdepw_ps(ji,nyfin-nbghostcellsfine) > 0.) THEN
@@ -564,5 +563,4 @@
         G1%bathy_meter = G1%gdepw_ps
         !                     
-        connectionsize = 2 
         ! 
 ! Chanut: remove smoothing if child grid bathymetry is found to already exist
@@ -570,10 +568,10 @@
 
            !
-           ! Smoothing to connect the connection zone (3 + nb_connection_pts coarse grid cells) and the interior domain
+           ! Smoothing to connect the connection zone (3 + npt_connect coarse grid cells) and the interior domain
            !
 ! Chanut: smoothing everywhere then discard result in connection zone
            CALL smooth_topo(G1%gdepw_ps(1:nxfin,1:nyfin),nbiter)
            WHERE (G1%wgt(:,:)==0.) G1%bathy_meter(:,:) = G1%gdepw_ps(:,:)
-!           boundary = (connectionsize+nb_connection_pts)*irafx + nbghostcellsfine + 1 
+!           boundary = (npt_copy+npt_connect)*irafx + nbghostcellsfine + 1 
 !           CALL smooth_topo(G1%gdepw_ps(boundary:nxfin-boundary+1,boundary:nyfin-boundary+1),nbiter)
 !           G1%bathy_meter = G1%gdepw_ps                         
@@ -658,5 +656,5 @@
      CALL init_constant_bathy(G0%bathy_meter,bathy_fin_constant)
      !
-     boundary = connectionsize*irafx + nbghostcellsfine + 1   
+     boundary = npt_copy*irafx + nbghostcellsfine + 1   
      !             
      G1%bathy_meter(1:boundary,:) = bathy_fin_constant(1:boundary,:)
Index: utils/tools/NESTING/src/agrif_partial_steps.f90
===================================================================
--- utils/tools/NESTING/src/agrif_partial_steps.f90	(revision 9688)
+++ utils/tools/NESTING/src/agrif_partial_steps.f90	(revision 9694)
@@ -361,5 +361,5 @@
     !
 
-    CALL correct_level( gdepwchild,ParentGrid,gdepw,e3t,1,2+nbghostcellsfine+connectionsize*irafx-1, &
+    CALL correct_level( gdepwchild,ParentGrid,gdepw,e3t,1,2+nbghostcellsfine+(npt_copy+npt_connect)*irafx-1, &
          1,nyfin)
 
@@ -368,5 +368,5 @@
     !
 
-    CALL correct_level( gdepwchild,ParentGrid,gdepw,e3t,nxfin-1-nbghostcellsfine-(connectionsize*irafx-1),nxfin, &
+    CALL correct_level( gdepwchild,ParentGrid,gdepw,e3t,nxfin-1-nbghostcellsfine-((npt_copy+npt_connect)*irafx-1),nxfin, &
          1,nyfin)
 
@@ -376,5 +376,5 @@
 
     CALL correct_level( gdepwchild,ParentGrid,gdepw,e3t,1,nxfin, &
-         nyfin-1 - nbghostcellsfine -(connectionsize*irafy-1),nyfin )
+         nyfin-1 - nbghostcellsfine -((npt_copy+npt_connect)*irafy-1),nyfin )
 
     !
@@ -382,5 +382,5 @@
     !
     CALL correct_level( gdepwchild,ParentGrid,gdepw,e3t,1,nxfin, &
-         1,2+nbghostcellsfine+connectionsize*irafy-1 )
+         1,2+nbghostcellsfine+(npt_copy+npt_connect)*irafy-1 )
 
     !       
Index: utils/tools/NESTING/src/agrif_types.f90
===================================================================
--- utils/tools/NESTING/src/agrif_types.f90	(revision 9688)
+++ utils/tools/NESTING/src/agrif_types.f90	(revision 9694)
@@ -50,5 +50,5 @@
   INTEGER N,type_bathy_interp
   ! 
-  INTEGER jpizoom,jpjzoom,nb_connection_pts
+  INTEGER jpizoom,jpjzoom,npt_connect,npt_copy
   !      
   REAL*8 rn_hmin
@@ -73,5 +73,5 @@
   !      
   NAMELIST /bathymetry/new_topo,elevation_database,elevation_name,smoothing,smoothing_factor, &
-       nb_connection_pts,removeclosedseas,type_bathy_interp,rn_hmin      
+       npt_connect,npt_copy,removeclosedseas,type_bathy_interp,rn_hmin      
   !      
   NAMELIST /nesting/imin,imax,jmin,jmax,rho,rhot,bathy_update,updated_parent_file      
@@ -90,6 +90,4 @@
 
   NAMELIST /restart_trc/ restart_trc_file,interp_type 
-
-  INTEGER :: connectionsize = 2 
   !
 CONTAINS
@@ -154,10 +152,10 @@
             FORM   = 'FORMATTED'      , &
             ACTION = 'READ'           , &
-            ACCESS = 'SEQUENTIAL'     )	  
+            ACCESS = 'SEQUENTIAL'     )
        !
        REWIND(unit_nml)
        READ (unit_nml , NML = input_output)
        READ (unit_nml , NML = coarse_grid_files)
-       READ (unit_nml , NML = bathymetry)	  
+       READ (unit_nml , NML = bathymetry)
        READ (unit_nml , NML = nesting) 
        READ (unit_nml , NML = vertical_grid)
