Index: branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/NESTING/src/agrif_connect_topo.f90
===================================================================
--- branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/NESTING/src/agrif_connect_topo.f90	(revision 10248)
+++ branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/NESTING/src/agrif_connect_topo.f90	(revision 10251)
@@ -105,5 +105,5 @@
     IMPLICIT NONE
     !
-    REAL*8 :: za2,za1,za0,zsur,zacr,zkth,zacr2,zkth2,zmin,zmax
+    REAL*8 :: za1,za0,zsur,zacr,zkth,zmin,zmax
     TYPE(Coordinates) :: Grid
     INTEGER :: i,j
@@ -134,5 +134,4 @@
        za0  = pa0
        za1  = pa1
-       za2  = pa2
        !
     ELSE
@@ -148,49 +147,19 @@
 
     zacr = ppacr
-    zkth = ppkth
-    zacr2 = ppacr2
-    zkth2 = ppkth2   
+    zkth = ppkth 
+
     !
     ALLOCATE(gdepw(N),gdept(N),e3w(N),e3t(N))
     !
-    IF( ppkth == 0. ) THEN            !  uniform vertical grid 
-       za1 = pphmax / FLOAT(N-1) 
-       DO i = 1, N
-          gdepw(i) = ( i - 1   ) * za1
-          gdept(i) = ( i - 0.5 ) * za1
-          e3w  (i) =  za1
-          e3t  (i) =  za1
-       END DO
-    ELSE                            ! Madec & Imbard 1996 function
-       IF( .NOT. ldbletanh ) THEN
-          DO i = 1,N
-             ! 
-             gdepw(i) = (zsur+za0*i+za1*zacr*LOG(COSH((i-zkth)/zacr))) 
-             gdept(i) = (zsur+za0*(i+0.5)+za1*zacr*LOG(COSH(((i+0.5)-zkth)/zacr)))
-             e3w(i)   = (za0 + za1 * TANH((i-zkth)/zacr))
-             e3t(i)   = (za0 + za1 * TANH(((i+0.5)-zkth)/zacr))
-             !
-          END DO
-       ELSE
-          DO i = 1,N
-             ! Double tanh function
-             gdepw(i) = ( zsur + za0*i  + za1 * zacr * LOG ( COSH( (i-zkth ) / zacr  ) )               &
-                &                       + za2 * zacr2* LOG ( COSH( (i-zkth2) / zacr2 ) )  )
-             gdept(i) = ( zsur + za0*(i+0.5) + za1 * zacr * LOG ( COSH( ((i+0.5)-zkth ) / zacr  ) )    &
-                &                            + za2 * zacr2* LOG ( COSH( ((i+0.5)-zkth2) / zacr2 ) )  )
-             e3w  (i) =          za0         + za1        * TANH(       (i-zkth ) / zacr  )            &
-                &                            + za2        * TANH(       (i-zkth2) / zacr2 )
-             e3t  (i) =          za0         + za1        * TANH(       ((i+0.5)-zkth ) / zacr  )      &
-                &                            + za2        * TANH(       ((i+0.5)-zkth2) / zacr2 )
-            END DO
-       ENDIF
-    ENDIF
+    DO i = 1,N
+       gdepw(i) = (zsur+za0*i+za1*zacr*LOG(COSH((i-zkth)/zacr))) 
+       gdept(i) = (zsur+za0*(i+0.5)+za1*zacr*LOG(COSH(((i+0.5)-zkth)/zacr)))
+       e3w(i)   = (za0 + za1 * TANH((i-zkth)/zacr))
+       e3t(i)   = (za0 + za1 * TANH(((i+0.5)-zkth)/zacr))
+    END DO
     !
     gdepw(1) = 0.0
     zmax = gdepw(N) + e3t(N)
-    IF( rn_hmin < 0. ) THEN  ;   i = - INT( rn_hmin )                                  ! from a nb of level
-    ELSE                     ;   i = MINLOC( gdepw, mask = gdepw > rn_hmin, dim = 1 )  ! from a depth
-    ENDIF
-    zmin = gdepw(i+1)
+    zmin = gdepw(4)
     !
     IF ( .NOT. ASSOCIATED(Grid%bathy_level)) &
@@ -258,5 +227,5 @@
     IMPLICIT NONE
     !
-    REAL*8 :: za2,za1,za0,zsur,zacr,zkth,zacr2,zkth2,zmin,zmax
+    REAL*8 :: za1,za0,zsur,zacr,zkth,zmin,zmax
     TYPE(Coordinates) :: Grid
     INTEGER :: i,j
@@ -288,5 +257,4 @@
        za0  = pa0
        za1  = pa1
-       za2  = pa2
        !
     ELSE
@@ -296,48 +264,22 @@
        WRITE(*,*) 'please check values of variables'
        WRITE(*,*) 'in namelist vertical_grid section'
-       WRITE(*,*) ' ' 
-       STOP     
+       WRITE(*,*) ' '
+       STOP      
        !       
     ENDIF
-
+    !
     zacr = ppacr
-    zkth = ppkth
-    zacr2 = ppacr2
-    zkth2 = ppkth2   
+    zkth = ppkth 
+
     !
     ALLOCATE(gdepw(N),gdept(N),e3w(N),e3t(N))
     !
-    IF( ppkth == 0. ) THEN            !  uniform vertical grid 
-       za1 = pphmax / FLOAT(N-1) 
-       DO i = 1, N
-          gdepw(i) = ( i - 1   ) * za1
-          gdept(i) = ( i - 0.5 ) * za1
-          e3w  (i) =  za1
-          e3t  (i) =  za1
-       END DO
-    ELSE                            ! Madec & Imbard 1996 function
-       IF( .NOT. ldbletanh ) THEN
-          DO i = 1,N
-             ! 
-             gdepw(i) = (zsur+za0*i+za1*zacr*LOG(COSH((i-zkth)/zacr))) 
-             gdept(i) = (zsur+za0*(i+0.5)+za1*zacr*LOG(COSH(((i+0.5)-zkth)/zacr)))
-             e3w(i)   = (za0 + za1 * TANH((i-zkth)/zacr))
-             e3t(i)   = (za0 + za1 * TANH(((i+0.5)-zkth)/zacr))
-             !
-          END DO
-       ELSE
-          DO i = 1,N
-             ! Double tanh function
-             gdepw(i) = ( zsur + za0*i  + za1 * zacr * LOG ( COSH( (i-zkth ) / zacr  ) )               &
-                &                       + za2 * zacr2* LOG ( COSH( (i-zkth2) / zacr2 ) )  )
-             gdept(i) = ( zsur + za0*(i+0.5) + za1 * zacr * LOG ( COSH( ((i+0.5)-zkth ) / zacr  ) )    &
-                &                            + za2 * zacr2* LOG ( COSH( ((i+0.5)-zkth2) / zacr2 ) )  )
-             e3w  (i) =          za0         + za1        * TANH(       (i-zkth ) / zacr  )            &
-                &                            + za2        * TANH(       (i-zkth2) / zacr2 )
-             e3t  (i) =          za0         + za1        * TANH(       ((i+0.5)-zkth ) / zacr  )      &
-                &                            + za2        * TANH(       ((i+0.5)-zkth2) / zacr2 )
-         END DO
-       ENDIF
-    ENDIF
+    DO i = 1,N
+       ! 
+       gdepw(i) = (zsur+za0*i+za1*zacr*LOG(COSH((i-zkth)/zacr))) 
+       gdept(i) = (zsur+za0*(i+0.5)+za1*zacr*LOG(COSH(((i+0.5)-zkth)/zacr)))
+       e3w(i)   = (za0 + za1 * TANH((i-zkth)/zacr))
+       e3t(i)   = (za0 + za1 * TANH(((i+0.5)-zkth)/zacr))
+    END DO
     !
     gdepw(1) = 0.0  
@@ -742,8 +684,8 @@
   ! for consistency with fine grid bathymetry			*
   !								*
-  ! if a given coarse grid point is masked and one of the	  *
-  ! child grid points contained in this coarse cell is not masked *
-  ! the corresponding coarse grid point is unmasked with rn_hmin  *
-  ! value						          *
+  ! if a given coarse grid point is masked and one of the		*
+  ! child grid points contained in this coarse cell is not masked	*
+  ! the corresponding coarse grid point is unmasked with gdepw(4) *
+  ! value								*
   !								*
   ! - input :							*
@@ -762,5 +704,5 @@
     !
     INTEGER :: ideb,jdeb,ifin,jfin
-    REAL*8 :: za2,za1,za0,zsur,zacr,zkth,zacr2,zkth2,zmin
+    REAL*8 :: za1,za0,zsur,zacr,zkth,zmin
     INTEGER :: i,j
     INTEGER :: k1
@@ -785,5 +727,4 @@
        za0  = pa0
        za1  = pa1
-       za2  = pa2
        !
     ELSE
@@ -799,47 +740,18 @@
 
     zacr = ppacr
-    zkth = ppkth
-    zacr2 = ppacr2
-    zkth2 = ppkth2   
+    zkth = ppkth 
+
     !
     ALLOCATE(gdepw(N),gdept(N),e3w(N),e3t(N))
     !
-    IF( ppkth == 0. ) THEN            !  uniform vertical grid 
-       za1 = pphmax / FLOAT(N-1) 
-       DO i = 1, N
-          gdepw(i) = ( i - 1   ) * za1
-          gdept(i) = ( i - 0.5 ) * za1
-          e3w  (i) =  za1
-          e3t  (i) =  za1
-       END DO
-    ELSE                            ! Madec & Imbard 1996 function
-       IF( .NOT. ldbletanh ) THEN
-          DO i = 1,N
-             ! 
-             gdepw(i) = (zsur+za0*i+za1*zacr*LOG(COSH((i-zkth)/zacr))) 
-             gdept(i) = (zsur+za0*(i+0.5)+za1*zacr*LOG(COSH(((i+0.5)-zkth)/zacr)))
-             e3w(i)   = (za0 + za1 * TANH((i-zkth)/zacr))
-             e3t(i)   = (za0 + za1 * TANH(((i+0.5)-zkth)/zacr))
-             !
-          END DO
-       ELSE
-          DO i = 1,N
-             ! Double tanh function
-             gdepw(i) = ( zsur + za0*i  + za1 * zacr * LOG ( COSH( (i-zkth ) / zacr  ) )               &
-                &                       + za2 * zacr2* LOG ( COSH( (i-zkth2) / zacr2 ) )  )
-             gdept(i) = ( zsur + za0*(i+0.5) + za1 * zacr * LOG ( COSH( ((i+0.5)-zkth ) / zacr  ) )    &
-                &                            + za2 * zacr2* LOG ( COSH( ((i+0.5)-zkth2) / zacr2 ) )  )
-             e3w  (i) =          za0         + za1        * TANH(       (i-zkth ) / zacr  )            &
-                &                            + za2        * TANH(       (i-zkth2) / zacr2 )
-             e3t  (i) =          za0         + za1        * TANH(       ((i+0.5)-zkth ) / zacr  )      &
-                &                            + za2        * TANH(       ((i+0.5)-zkth2) / zacr2 )
-          END DO
-       ENDIF
-    ENDIF
-    !
-    IF( rn_hmin < 0. ) THEN  ;   i = - INT( rn_hmin )                                  ! from a nb of level
-    ELSE                     ;   i = MINLOC( gdepw, mask = gdepw > rn_hmin, dim = 1 )  ! from a depth
-    ENDIF
-    zmin = gdepw(i+1)
+    DO i = 1,N
+       ! 
+       gdepw(i) = (zsur+za0*i+za1*zacr*LOG(COSH((i-zkth)/zacr))) 
+       gdept(i) = (zsur+za0*(i+0.5)+za1*zacr*LOG(COSH(((i+0.5)-zkth)/zacr)))
+       e3w(i)   = (za0 + za1 * TANH((i-zkth)/zacr))
+       e3t(i)   = (za0 + za1 * TANH(((i+0.5)-zkth)/zacr))
+    END DO
+    !
+    zmin = gdepw(4)
     !      
     diff = 0
