Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdy_oce.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdy_oce.F90	(revision 11023)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdy_oce.F90	(revision 11024)
@@ -26,4 +26,5 @@
       INTEGER , POINTER, DIMENSION(:,:)    ::  nbr
       INTEGER , POINTER, DIMENSION(:,:)    ::  nbmap
+      INTEGER , POINTER, DIMENSION(:,:)    ::  ntreat
       REAL(wp), POINTER, DIMENSION(:,:)    ::  nbw
       REAL(wp), POINTER, DIMENSION(:,:)    ::  nbd
Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdydyn2d.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdydyn2d.F90	(revision 11023)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdydyn2d.F90	(revision 11024)
@@ -256,4 +256,15 @@
       !! ** Purpose : Duplicate sea level across open boundaries
       !!
+      !! ** Method  : - take the average of free ocean neighbours
+      !!
+      !!      ___   !      _|    !   |_____|   !   ___|    !   __|x o   !  ___|  
+      !!   __|x     !   __|x o   !      x      !     x o   !      o     !      x o
+      !!      o     !      o     !      o      !     o     !            !      o 
+      !!                                
+      !!            (special treatments)
+      !!         !   |_   _|     ! |               
+      !!         !     |_|       ! |x o    
+      !!         !    o x o      ! |x_x_ 
+      !!         !      o      
       !!----------------------------------------------------------------------
       REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) ::   zssh ! Sea level
@@ -261,26 +272,39 @@
       INTEGER  ::   ib_bdy, ib, igrd                        ! local integers
       INTEGER  ::   ii, ij, zcoef, zcoef1, zcoef2, ip, jp   !   "       "
-
+      INTEGER  ::   flagu, flagv                            ! short cuts
+      REAL(wp) ::   zr_3
+      !!----------------------------------------------------------------------
       igrd = 1                       ! Everything is at T-points here
-
+      zr_3 = 1. / 3.
+      !
       DO ib_bdy = 1, nb_bdy
          DO ib = 1, idx_bdy(ib_bdy)%nblenrim(igrd)
             ii = idx_bdy(ib_bdy)%nbi(ib,igrd)
             ij = idx_bdy(ib_bdy)%nbj(ib,igrd)
-            ! Set gradient direction:
-            zcoef1 = bdytmask(ii-1,ij  ) +  bdytmask(ii+1,ij  )
-            zcoef2 = bdytmask(ii  ,ij-1) +  bdytmask(ii  ,ij+1)
-            IF ( zcoef1+zcoef2 == 0 ) THEN   ! corner
-               zcoef = bdytmask(ii-1,ij-1) + bdytmask(ii+1,ij+1) + bdytmask(ii+1,ij-1) + bdytmask(ii-1,ij+1)
-               zssh(ii,ij) = zssh( ii-1, ij-1 ) * bdytmask( ii-1, ij-1) + &
-                 &           zssh( ii+1, ij+1 ) * bdytmask( ii+1, ij+1) + &
-                 &           zssh( ii+1, ij-1 ) * bdytmask( ii+1, ij-1) + &
-                 &           zssh( ii-1, ij+1 ) * bdytmask( ii-1, ij+1)
-               zssh(ii,ij) = ( zssh(ii,ij) / MAX( 1, zcoef) ) * tmask(ii,ij,1)
-            ELSE
-               ip = bdytmask(ii+1,ij  ) - bdytmask(ii-1,ij  )
-               jp = bdytmask(ii  ,ij+1) - bdytmask(ii  ,ij-1)
-               zssh(ii,ij) = zssh(ii+ip,ij+jp) * tmask(ii+ip,ij+jp,1)
-            ENDIF
+            SELECT CASE( idx_bdy(ib_bdy)%ntreat(ib,igrd) )
+               CASE( 0 )
+                  flagu = NINT( idx_bdy(ib_bdy)%flagu(ib,igrd) )
+                  flagv = NINT( idx_bdy(ib_bdy)%flagv(ib,igrd) )
+                  IF( flagu == 0 .OR. flagv == 0 )   THEN    ! linear bdy   o
+                     zssh(ii,ij) = zssh(ii+flagu,ij+flagv)   !           ___x___ 
+                  ELSE   !   ___  o
+                         !      | x o
+                     zssh(ii,ij) = ( zssh(ii+flagu,ij) + zssh(ii,ij+flagv) ) * 0.5
+                  END IF
+               !               !              !     _____     !     _____     
+               !  1 |   o      !  2  o   |    !  3 | x        !  4     x |    
+               !    |_x_ _     !    _ _x_|    !    |   o      !      o   | 
+               CASE( 1 )   ;   zssh(ii,ij) = zssh(ii+1,ij+1)
+               CASE( 2 )   ;   zssh(ii,ij) = zssh(ii-1,ij+1)
+               CASE( 3 )   ;   zssh(ii,ij) = zssh(ii+1,ij-1)
+               CASE( 4 )   ;   zssh(ii,ij) = zssh(ii-1,ij-1)
+               !    |_  o      !        o  _|  !     ¨¨|_|¨¨   !       o         
+               !  5  _| x o    !  6   o x |_   !  7   o x o    ! 8   o x o       
+               !    |   o      !        o   |  !        o      !    __|¨|__      
+               CASE( 5 )   ;   zssh(ii,ij) = ( zssh(ii  ,ij+1) + zssh(ii+1,ij  ) + zssh(ii  ,ij-1) ) * zr_3
+               CASE( 6 )   ;   zssh(ii,ij) = ( zssh(ii  ,ij+1) + zssh(ii-1,ij  ) + zssh(ii  ,ij-1) ) * zr_3
+               CASE( 7 )   ;   zssh(ii,ij) = ( zssh(ii-1,ij  ) + zssh(ii  ,ij-1) + zssh(ii+1,ij  ) ) * zr_3
+               CASE( 8 )   ;   zssh(ii,ij) = ( zssh(ii-1,ij  ) + zssh(ii  ,ij+1) + zssh(ii+1,ij  ) ) * zr_3
+            END SELECT
          END DO
 
Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdydyn3d.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdydyn3d.F90	(revision 11023)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdydyn3d.F90	(revision 11024)
@@ -346,9 +346,9 @@
       igrd = 2      ! Neumann bc on u-velocity; 
       !            
-      CALL bdy_nmn( idx, igrd, ua )
+      CALL bdy_nmn( idx, igrd, ua )   ! ua is masked
 
       igrd = 3      ! Neumann bc on v-velocity
       !  
-      CALL bdy_nmn( idx, igrd, va )
+      CALL bdy_nmn( idx, igrd, va )   ! va is masked
       !
       CALL lbc_bdy_lnk( 'bdydyn3d', ua, 'U', -1., ib_bdy )    ! Boundary points should be updated
Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdyini.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdyini.F90	(revision 11023)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdyini.F90	(revision 11024)
@@ -131,5 +131,5 @@
       INTEGER  ::   jpbdtau, jpbdtas                       !   -       -
       INTEGER  ::   ib_bdy1, ib_bdy2, ib1, ib2             !   -       -
-      INTEGER  ::   i_offset, j_offset                     !   -       -
+      INTEGER  ::   i_offset, j_offset, inbdy            !   -       -
       INTEGER , POINTER  ::  nbi, nbj, nbr                 ! short cuts
       REAL(wp), POINTER, DIMENSION(:,:)       ::   pmask    ! pointer to 2D mask fields
@@ -144,4 +144,5 @@
       INTEGER :: iw_b(4), ie_b(4), is_b(4), in_b(4)                ! Arrays for neighbours coordinates
       REAL(wp), TARGET, DIMENSION(jpi,jpj) ::   zfmask  ! temporary fmask array excluding coastal boundary condition (shlat)
+      LOGICAL  ::   llnobdy, llsobdy, lleabdy, llwebdy     ! local logicals
       !!
       CHARACTER(LEN=1)                     ::   ctypebdy   !     -        - 
@@ -893,4 +894,5 @@
             &      idx_bdy(ib_bdy)%nbd   (ilen1,jpbgrd) ,   &
             &      idx_bdy(ib_bdy)%nbdout(ilen1,jpbgrd) ,   &
+            &      idx_bdy(ib_bdy)%ntreat(ilen1,jpbgrd) ,   &
             &      idx_bdy(ib_bdy)%nbmap (ilen1,jpbgrd) ,   &
             &      idx_bdy(ib_bdy)%nbw   (ilen1,jpbgrd) ,   &
@@ -1243,4 +1245,58 @@
          !
       END DO
+      
+      ! detect corners and their orientation index 1 to 4 depending on the orientation
+      ! detect geometries with 3 neighbours  index 5 to 8 depending on the orientation
+      ! else                                 index 0
+      DO ib_bdy = 1, nb_bdy
+         DO igrd = 1, jpbgrd
+            SELECT CASE( igrd )
+               CASE( 1 )   ;   pmask => bdytmask 
+               CASE( 2 )   ;   pmask => bdyumask 
+               CASE( 3 )   ;   pmask => bdyvmask 
+            END SELECT
+            DO ib = 1, idx_bdy(ib_bdy)%nblenrim(igrd)
+               ii        =  idx_bdy(ib_bdy)%nbi(ib,igrd)
+               ij        =  idx_bdy(ib_bdy)%nbj(ib,igrd)
+               !IF( ii == 1 .OR. ii == jpi .OR. ij == 1 .OR. ij == jpj )   CYCLE
+               llnobdy = pmask(ii  ,ij+1) == 1.  
+               llsobdy = pmask(ii  ,ij-1) == 1. 
+               lleabdy = pmask(ii+1,ij  ) == 1. 
+               llwebdy = pmask(ii-1,ij  ) == 1. 
+               inbdy  = COUNT( (/ llnobdy, llsobdy, lleabdy, llwebdy /) )
+               IF( inbdy == 0 )   THEN   ! no neighbours -> interior of a corner
+                  !               !              !     _____     !     _____     
+                  !  1 |   o      !  2  o   |    !  3 | x        !  4     x |    
+                  !    |_x_ _     !    _ _x_|    !    |   o      !      o   |    
+                  IF( pmask(ii+1,ij+1) == 1. )   idx_bdy(ib_bdy)%ntreat(ib,igrd) = 1
+                  IF( pmask(ii-1,ij+1) == 1. )   idx_bdy(ib_bdy)%ntreat(ib,igrd) = 2
+                  IF( pmask(ii+1,ij-1) == 1. )   idx_bdy(ib_bdy)%ntreat(ib,igrd) = 3
+                  IF( pmask(ii-1,ij-1) == 1. )   idx_bdy(ib_bdy)%ntreat(ib,igrd) = 4
+               END IF
+               IF( inbdy == 1 )   THEN   ! middle of linear bdy
+                  idx_bdy(ib_bdy)%ntreat(ib,igrd) = 0   ! regular treatment with flags
+               END IF
+               IF( inbdy == 2 )   THEN   ! exterior of a corner
+                  idx_bdy(ib_bdy)%ntreat(ib,igrd) = 0   ! regular treatment with flags
+               END IF
+               IF( inbdy == 3 )   THEN   ! 3 neighbours __   __
+                  !    |_  o      !        o  _|  !       |_|     !       o         
+                  !  5  _| x o    !  6   o x |_   !  7   o x o    ! 8   o x o       
+                  !    |   o      !        o   |  !        o      !    __|¨|__      
+                  IF( llnobdy .AND. lleabdy .AND. llsobdy )   idx_bdy(ib_bdy)%ntreat(ib,igrd) = 5
+                  IF( llnobdy .AND. llwebdy .AND. llsobdy )   idx_bdy(ib_bdy)%ntreat(ib,igrd) = 6
+                  IF( llwebdy .AND. llsobdy .AND. lleabdy )   idx_bdy(ib_bdy)%ntreat(ib,igrd) = 7
+                  IF( llwebdy .AND. llnobdy .AND. lleabdy )   idx_bdy(ib_bdy)%ntreat(ib,igrd) = 8
+               END IF
+               IF( inbdy == 4 )   THEN
+                  WRITE(ctmp1,*) ' E R R O R : Problem with  ',cgrid(igrd) ,' grid points,',   &
+                       '  some points on boundary set ', ib_bdy, ' have 4 neighbours'
+                  WRITE(ctmp2,*) ' ========== '
+                  CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
+               END IF
+            END DO
+         END DO
+         !CALL lbc_lnk( 'bdyini', ) 
+      END DO
       !
       ! Tidy up
Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdylib.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdylib.F90	(revision 11023)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdylib.F90	(revision 11024)
@@ -436,61 +436,68 @@
       !!----------------------------------------------------------------------
       INTEGER,                    INTENT(in)     ::   igrd     ! grid index
-      REAL(wp), DIMENSION(:,:,:), INTENT(inout)  ::   phia     ! model after 3D field (to be updated)
+      REAL(wp), DIMENSION(:,:,:), INTENT(inout)  ::   phia     ! model after 3D field (to be updated), must be masked
       TYPE(OBC_INDEX), INTENT(in) ::   idx  ! OBC indices
       !! 
-      REAL(wp) ::   zcoef, zcoef1, zcoef2
-      REAL(wp), POINTER, DIMENSION(:,:,:)        :: pmask      ! land/sea mask for field
+      REAL(wp) ::   zweight
+      REAL(wp), POINTER, DIMENSION(:,:,:)      :: pmask         ! land/sea mask for field
       REAL(wp), POINTER, DIMENSION(:,:)        :: bdypmask      ! land/sea mask for field
       INTEGER  ::   ib, ik   ! dummy loop indices
-      INTEGER  ::   ii, ij, ip, jp   ! 2D addresses
+      INTEGER  ::   ii, ij   ! 2D addresses
+      INTEGER  ::   flagu, flagv                        ! short cuts
+      INTEGER  ::   ii1, ii2, ii3, ij1, ij2, ij3
       !!----------------------------------------------------------------------
       !
       SELECT CASE(igrd)
-         CASE(1)
-            pmask => tmask(:,:,:)
-            bdypmask => bdytmask(:,:)
-         CASE(2)
-            pmask => umask(:,:,:)
-            bdypmask => bdyumask(:,:)
-         CASE(3)
-            pmask => vmask(:,:,:)
-            bdypmask => bdyvmask(:,:)
+         CASE(1)   ;   pmask => tmask(:,:,:)
+         CASE(2)   ;   pmask => umask(:,:,:)
+         CASE(3)   ;   pmask => vmask(:,:,:)
          CASE DEFAULT ;   CALL ctl_stop( 'unrecognised value for igrd in bdy_nmn' )
       END SELECT
+      !
       DO ib = 1, idx%nblenrim(igrd)
          ii = idx%nbi(ib,igrd)
          ij = idx%nbj(ib,igrd)
-         DO ik = 1, jpkm1
-            ! search the sense of the gradient
-            zcoef1 = bdypmask(ii-1,ij  )*pmask(ii-1,ij,ik) +  bdypmask(ii+1,ij  )*pmask(ii+1,ij,ik)
-            zcoef2 = bdypmask(ii  ,ij-1)*pmask(ii,ij-1,ik) +  bdypmask(ii  ,ij+1)*pmask(ii,ij+1,ik)
-            IF ( nint(zcoef1+zcoef2) == 0) THEN
-               ! corner **** we probably only want to set the tangentail component for the dynamics here
-               zcoef = pmask(ii-1,ij,ik) + pmask(ii+1,ij,ik) +  pmask(ii,ij-1,ik) +  pmask(ii,ij+1,ik)
-               IF (zcoef > .5_wp) THEN ! Only set none isolated points.
-                 phia(ii,ij,ik) = phia(ii-1,ij  ,ik) * pmask(ii-1,ij  ,ik) + &
-                   &              phia(ii+1,ij  ,ik) * pmask(ii+1,ij  ,ik) + &
-                   &              phia(ii  ,ij-1,ik) * pmask(ii  ,ij-1,ik) + &
-                   &              phia(ii  ,ij+1,ik) * pmask(ii  ,ij+1,ik)
-                 phia(ii,ij,ik) = ( phia(ii,ij,ik) / zcoef ) * pmask(ii,ij,ik)
-               ELSE
-                 phia(ii,ij,ik) = phia(ii,ij  ,ik) * pmask(ii,ij  ,ik)
-               ENDIF
-            ELSEIF ( nint(zcoef1+zcoef2) == 2) THEN
-               ! oblique corner **** we probably only want to set the normal component for the dynamics here
-               zcoef = pmask(ii-1,ij,ik)*bdypmask(ii-1,ij  ) + pmask(ii+1,ij,ik)*bdypmask(ii+1,ij  ) + &
-                   &   pmask(ii,ij-1,ik)*bdypmask(ii,ij -1 ) +  pmask(ii,ij+1,ik)*bdypmask(ii,ij+1  )
-               phia(ii,ij,ik) = phia(ii-1,ij  ,ik) * pmask(ii-1,ij  ,ik)*bdypmask(ii-1,ij  ) + &
-                   &            phia(ii+1,ij  ,ik) * pmask(ii+1,ij  ,ik)*bdypmask(ii+1,ij  )  + &
-                   &            phia(ii  ,ij-1,ik) * pmask(ii  ,ij-1,ik)*bdypmask(ii,ij -1 ) + &
-                   &            phia(ii  ,ij+1,ik) * pmask(ii  ,ij+1,ik)*bdypmask(ii,ij+1  )
- 
-               phia(ii,ij,ik) = ( phia(ii,ij,ik) / MAX(1._wp, zcoef) ) * pmask(ii,ij,ik)
-            ELSE
-               ip = nint(bdypmask(ii+1,ij  )*pmask(ii+1,ij,ik) - bdypmask(ii-1,ij  )*pmask(ii-1,ij,ik))
-               jp = nint(bdypmask(ii  ,ij+1)*pmask(ii,ij+1,ik) - bdypmask(ii  ,ij-1)*pmask(ii,ij-1,ik))
-               phia(ii,ij,ik) = phia(ii+ip,ij+jp,ik) * pmask(ii+ip,ij+jp,ik)
-            ENDIF
-         END DO
+         SELECT CASE( idx%ntreat(ib,igrd) )   ! select free ocean neighbours
+            !               !              !     _____     !     _____     
+            !  1 |   o      !  2  o   |    !  3 | x        !  4     x |    
+            !    |_x_ _     !    _ _x_|    !    |   o      !      o   |
+            CASE( 1 )   ;   ii1 = ii+1   ;   ij1 = ij+1
+            CASE( 2 )   ;   ii1 = ii-1   ;   ij1 = ij+1
+            CASE( 3 )   ;   ii1 = ii+1   ;   ij1 = ij-1
+            CASE( 4 )   ;   ii1 = ii-1   ;   ij1 = ij-1
+            !    |_  o      !        o  _|  !     ¨¨|_|¨¨   !       o         
+            !  5  _| x o    !  6   o x |_   !  7   o x o    ! 8   o x o       
+            !    |   o      !        o   |  !        o      !    __|¨|__ 
+            CASE( 5 )   ;   ii1 = ii     ;   ij1 = ij+1   ;   ii2 = ii+1   ;   ij2 = ij     ;   ii3 = ii     ;   ij3 = ij-1   
+            CASE( 6 )   ;   ii1 = ii     ;   ij1 = ij+1   ;   ii2 = ii-1   ;   ij2 = ij     ;   ii3 = ii     ;   ij3 = ij-1 
+            CASE( 7 )   ;   ii1 = ii-1   ;   ij1 = ij     ;   ii2 = ii     ;   ij2 = ij-1   ;   ii3 = ii+1   ;   ij3 = ij   
+            CASE( 8 )   ;   ii1 = ii-1   ;   ij1 = ij     ;   ii2 = ii     ;   ij2 = ij+1   ;   ii3 = ii+1   ;   ij3 = ij  
+            CASE DEFAULT
+         END SELECT
+         !
+         SELECT CASE( idx%ntreat(ib,igrd) )         
+            CASE( 0 )
+               flagu = NINT( idx%flagu(ib,igrd) )
+               flagv = NINT( idx%flagv(ib,igrd) )
+               IF( flagu == 0 .OR. flagv == 0 )   THEN     ! linear bdy   o
+                   DO ik = 1, jpkm1                        !           ___x___ 
+                      IF( pmask(ii+flagu,ij+flagv,ik) /= 0. )   phia(ii,ij,ik) = phia(ii+flagu,ij+flagv,ik)  
+                   END DO
+               ELSE                          
+                  DO ik = 1, jpkm1                                              !   ___  o
+                     zweight = pmask(ii+flagu,ij,ik) + pmask(ii,ij+flagv,ik)    !      | x o
+                     IF( zweight /= 0. )   phia(ii,ij,ik) = ( phia(ii+flagu,ij,ik) + phia(ii,ij+flagv,ik) ) / zweight
+                  END DO
+               END IF
+            CASE( 1:4 )
+                   DO ik = 1, jpkm1
+                      IF( pmask(ii1,ij1,ik) /= 0. )   phia(ii,ij,ik) = phia(ii1,ij1,ik)  
+                   END DO    
+            CASE( 5:8 )
+               DO ik = 1, jpkm1
+                  zweight        =  pmask(ii1,ij1,ik) + pmask(ii2,ij2,ik) + pmask(ii3,ij3,ik)
+                  IF( zweight /= 0. )   phia(ii,ij,ik) = ( phia(ii1,ij1,ik) + phia (ii2,ij2,ik) + phia (ii3,ij3,ik) ) / zweight
+               END DO
+         END SELECT
       END DO
       !
Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdytra.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdytra.F90	(revision 11023)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdytra.F90	(revision 11024)
@@ -65,5 +65,5 @@
             CASE('frs'         )   ;   CALL bdy_frs ( idx_bdy(ib_bdy),                tsa(:,:,:,jn), zdta(jn)%tra )
             CASE('specified'   )   ;   CALL bdy_spe ( idx_bdy(ib_bdy),                tsa(:,:,:,jn), zdta(jn)%tra )
-            CASE('neumann'     )   ;   CALL bdy_nmn ( idx_bdy(ib_bdy), igrd         , tsa(:,:,:,jn)               )
+            CASE('neumann'     )   ;   CALL bdy_nmn ( idx_bdy(ib_bdy), igrd         , tsa(:,:,:,jn)               )   ! tsa masked
             CASE('orlanski'    )   ;   CALL bdy_orl ( idx_bdy(ib_bdy), tsb(:,:,:,jn), tsa(:,:,:,jn), zdta(jn)%tra, ll_npo=.false. )
             CASE('orlanski_npo')   ;   CALL bdy_orl ( idx_bdy(ib_bdy), tsb(:,:,:,jn), tsa(:,:,:,jn), zdta(jn)%tra, ll_npo=.true. )
Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/DYN/dynkeg.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/DYN/dynkeg.F90	(revision 11023)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/DYN/dynkeg.F90	(revision 11024)
@@ -75,5 +75,5 @@
       !
       INTEGER  ::   ji, jj, jk, jb           ! dummy loop indices
-      INTEGER  ::   ifu, ifv, igrd, ib_bdy   ! local integers
+      INTEGER  ::   igrd, ib_bdy             ! local integers
       REAL(wp) ::   zu, zv                   ! local scalars
       REAL(wp), DIMENSION(jpi,jpj,jpk)        ::   zhke
