Index: /NEMO/branches/2019/fix_ticket2238_solution1/src/OCE/ICB/icbutl.F90
===================================================================
--- /NEMO/branches/2019/fix_ticket2238_solution1/src/OCE/ICB/icbutl.F90	(revision 10676)
+++ /NEMO/branches/2019/fix_ticket2238_solution1/src/OCE/ICB/icbutl.F90	(revision 10677)
@@ -100,15 +100,4 @@
       ssh_e(:,:) = 0._wp ;  ssh_e(1:jpi, 1:jpj) = ssh_m(:,:) * tmask(:,:,1)
 #endif
-
-      !! special for ssh which is used to calculate slope
-      !! so fudge some numbers all the way around the boundary
-      ssh_e(0    ,    :) = ssh_e(1  ,  :)
-      ssh_e(jpi+1,    :) = ssh_e(jpi,  :)
-      ssh_e(:    ,    0) = ssh_e(:  ,  1)
-      ssh_e(:    ,jpj+1) = ssh_e(:  ,jpj)
-      ssh_e(0,0)         = ssh_e(1,1)
-      ssh_e(jpi+1,0)     = ssh_e(jpi,1)
-      ssh_e(0,jpj+1)     = ssh_e(1,jpj)
-      ssh_e(jpi+1,jpj+1) = ssh_e(jpi,jpj)
       CALL lbc_lnk_icb( 'icbutl', ssh_e, 'T', +1._wp, 1, 1 )
       !
@@ -201,23 +190,23 @@
          ! since we're looking for four T points containing quadrant we're in of 
          ! current T cell
-         ii = MAX(1, INT( pi     ))
-         ij = MAX(1, INT( pj     ))    ! T-point
+         ii = MAX(0, INT( pi     ))
+         ij = MAX(0, INT( pj     ))    ! T-point
          zi = pi - REAL(ii,wp)
          zj = pj - REAL(ij,wp)
       CASE ( 'U' )
-         ii = MAX(1, INT( pi-0.5 ))
-         ij = MAX(1, INT( pj     ))    ! U-point
-         zi = pi - 0.5 - REAL(ii,wp)
+         ii = MAX(0, INT( pi-0.5_wp ))
+         ij = MAX(0, INT( pj     ))    ! U-point
+         zi = pi - 0.5_wp - REAL(ii,wp)
          zj = pj - REAL(ij,wp)
       CASE ( 'V' )
-         ii = MAX(1, INT( pi     ))
-         ij = MAX(1, INT( pj-0.5 ))    ! V-point
+         ii = MAX(0, INT( pi     ))
+         ij = MAX(0, INT( pj-0.5_wp ))    ! V-point
          zi = pi - REAL(ii,wp)
-         zj = pj - 0.5 - REAL(ij,wp)
+         zj = pj - 0.5_wp - REAL(ij,wp)
       CASE ( 'F' )
-         ii = MAX(1, INT( pi-0.5 ))
-         ij = MAX(1, INT( pj-0.5 ))    ! F-point
-         zi = pi - 0.5 - REAL(ii,wp)
-         zj = pj - 0.5 - REAL(ij,wp)
+         ii = MAX(0, INT( pi-0.5_wp ))
+         ij = MAX(0, INT( pj-0.5_wp ))    ! F-point
+         zi = pi - 0.5_wp - REAL(ii,wp)
+         zj = pj - 0.5_wp - REAL(ij,wp)
       END SELECT
       !
@@ -235,6 +224,6 @@
       !
       !
-      icb_utl_bilin_h = ( pfld(ii,ij  ) * (1.-zi) + pfld(ii+1,ij  ) * zi ) * (1.-zj)   &
-         &            + ( pfld(ii,ij+1) * (1.-zi) + pfld(ii+1,ij+1) * zi ) *     zj
+      icb_utl_bilin_h = ( pfld(ii,ij  ) * (1._wp-zi) + pfld(ii+1,ij  ) * zi ) * (1._wp-zj)   &
+         &            + ( pfld(ii,ij+1) * (1._wp-zi) + pfld(ii+1,ij+1) * zi ) *     zj
       !
    END FUNCTION icb_utl_bilin_h
@@ -393,15 +382,15 @@
 
       ! find position in this processor. Prevent near edge problems (see #1389)
-      IF    ( ii < mig( 1 ) ) THEN   ;   ii = 1
-      ELSEIF( ii > mig(jpi) ) THEN   ;   ii = jpi
+      IF    ( ii < mig( 1 ) ) THEN   ;   ii = 1       ; PRINT *, 'SHOULD NOT SEE THIS 1'
+      ELSEIF( ii > mig(jpi) ) THEN   ;   ii = jpi     ; PRINT *, 'SHOULD NOT SEE THIS jpi'
       ELSE                           ;   ii = mi1(ii)
       ENDIF
-      IF    ( ij < mjg( 1 ) ) THEN   ;   ij = 1
-      ELSEIF( ij > mjg(jpj) ) THEN   ;   ij = jpj
+      IF    ( ij < mjg( 1 ) ) THEN   ;   ij = 1       ; PRINT *, 'SHOULD NOT SEE THIS i 1'
+      ELSEIF( ij > mjg(jpj) ) THEN   ;   ij = jpj     ; PRINT *, 'SHOULD NOT SEE THIS jpj'
       ELSE                           ;   ij  = mj1(ij)
       ENDIF
       !
-      IF( ii == jpi )   ii = ii-1      
-      IF( ij == jpj )   ij = ij-1
+      IF( ii == jpi ) THEN ; ii = ii-1 ; PRINT *, 'SHOULD NOT SEE THIS ii-1' ; END IF     
+      IF( ij == jpj ) THEN ; ij = ij-1 ; PRINT *, 'SHOULD NOT SEE THIS ij-1' ; END IF
       !
       IF(    0.0_wp <= zi .AND. zi < 0.5_wp   ) THEN
@@ -435,6 +424,6 @@
       ENDIF
       !
-      icb_utl_bilin_e = ( ze01 * (1.-zi) + ze11 * zi ) *     zj    &
-         &            + ( ze00 * (1.-zi) + ze10 * zi ) * (1.-zj)
+      icb_utl_bilin_e = ( ze01 * (1._wp-zi) + ze11 * zi ) *        zj    &
+         &            + ( ze00 * (1._wp-zi) + ze10 * zi ) * (1._wp-zj)
       !
    END FUNCTION icb_utl_bilin_e
