Index: NEMO/trunk/src/OCE/BDY/bdy_oce.F90
===================================================================
--- NEMO/trunk/src/OCE/BDY/bdy_oce.F90	(revision 15345)
+++ NEMO/trunk/src/OCE/BDY/bdy_oce.F90	(revision 15354)
@@ -137,6 +137,6 @@
    TYPE(OBC_DATA) , DIMENSION(jp_bdy), TARGET      ::   dta_bdy           !: bdy external data (local process)
 !$AGRIF_END_DO_NOT_TREAT
-   LOGICAL, ALLOCATABLE, DIMENSION(:,:,:,:) ::   lsend_bdy      !: mark needed communication for given boundary, grid and neighbour
-   LOGICAL, ALLOCATABLE, DIMENSION(:,:,:,:) ::   lrecv_bdy      !:  when searching in any direction
+   LOGICAL, ALLOCATABLE, DIMENSION(:,:,:,:) ::   lsend_bdyolr   !: mark needed communication for given boundary, grid and neighbour
+   LOGICAL, ALLOCATABLE, DIMENSION(:,:,:,:) ::   lrecv_bdyolr   !:  when searching in any direction (only for orlansky)
    LOGICAL, ALLOCATABLE, DIMENSION(:,:,:,:) ::   lsend_bdyint   !: mark needed communication for given boundary, grid and neighbour
    LOGICAL, ALLOCATABLE, DIMENSION(:,:,:,:) ::   lrecv_bdyint   !:  when searching towards the interior of the computational domain
Index: NEMO/trunk/src/OCE/BDY/bdydyn2d.F90
===================================================================
--- NEMO/trunk/src/OCE/BDY/bdydyn2d.F90	(revision 15345)
+++ NEMO/trunk/src/OCE/BDY/bdydyn2d.F90	(revision 15354)
@@ -22,5 +22,5 @@
    USE wet_dry         ! Use wet dry to get reference ssh level
    USE in_out_manager  !
-   USE lib_mpp, ONLY: ctl_stop
+   USE lib_mpp
 
    IMPLICIT NONE
@@ -50,7 +50,10 @@
       REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) :: pssh
       !!
-      INTEGER  ::   ib_bdy, ir     ! BDY set index, rim index
-      LOGICAL  ::   llrim0         ! indicate if rim 0 is treated
-      LOGICAL, DIMENSION(4) :: llsend2, llrecv2, llsend3, llrecv3  ! indicate how communications are to be carried out
+      INTEGER               ::   ib_bdy, ir     ! BDY set index, rim index
+      INTEGER, DIMENSION(3) ::   idir3
+      INTEGER, DIMENSION(6) ::   idir6
+      LOGICAL               ::   llrim0         ! indicate if rim 0 is treated
+      LOGICAL, DIMENSION(8) ::   llsend2, llrecv2, llsend3, llrecv3  ! indicate how communications are to be carried out
+      !!----------------------------------------------------------------------
       
       llsend2(:) = .false.   ;   llrecv2(:) = .false.
@@ -87,17 +90,23 @@
             SELECT CASE( cn_dyn2d(ib_bdy) )
             CASE('flather')
-               llsend2(1:2) = llsend2(1:2) .OR. lsend_bdyint(ib_bdy,2,1:2,ir)   ! west/east, U points
-               llsend2(1)   = llsend2(1)   .OR. lsend_bdyext(ib_bdy,2,1,ir)     ! neighbour might search point towards its east bdy
-               llrecv2(1:2) = llrecv2(1:2) .OR. lrecv_bdyint(ib_bdy,2,1:2,ir)   ! west/east, U points
-               llrecv2(2)   = llrecv2(2)   .OR. lrecv_bdyext(ib_bdy,2,2,ir)     ! might search point towards bdy on the east
-               llsend3(3:4) = llsend3(3:4) .OR. lsend_bdyint(ib_bdy,3,3:4,ir)   ! north/south, V points
-               llsend3(3)   = llsend3(3)   .OR. lsend_bdyext(ib_bdy,3,3,ir)     ! neighbour might search point towards its north bdy
-               llrecv3(3:4) = llrecv3(3:4) .OR. lrecv_bdyint(ib_bdy,3,3:4,ir)   ! north/south, V points
-               llrecv3(4)   = llrecv3(4)   .OR. lrecv_bdyext(ib_bdy,3,4,ir)     ! might search point towards bdy on the north
+               idir6 = (/ jpwe, jpea, jpsw, jpse, jpnw, jpne /)
+               llsend2(idir6) = llsend2(idir6) .OR. lsend_bdyint(ib_bdy,2,idir6,ir)   ! west/east, U points
+               idir3 = (/ jpwe, jpsw, jpnw /)
+               llsend2(idir3) = llsend2(idir3) .OR. lsend_bdyext(ib_bdy,2,idir3,ir)   ! nei might search point towards its east bdy
+               llrecv2(idir6) = llrecv2(idir6) .OR. lrecv_bdyint(ib_bdy,2,idir6,ir)   ! west/east, U points
+               idir3 = (/ jpea, jpse, jpne /)
+               llrecv2(idir3) = llrecv2(idir3) .OR. lrecv_bdyext(ib_bdy,2,idir3,ir)   ! might search point towards bdy on the east
+               idir6 = (/ jpso, jpno, jpsw, jpse, jpnw, jpne /)
+               llsend3(idir6) = llsend3(idir6) .OR. lsend_bdyint(ib_bdy,3,idir6,ir)   ! north/south, V points
+               idir3 = (/ jpso, jpsw, jpse /)
+               llsend3(idir3) = llsend3(idir3) .OR. lsend_bdyext(ib_bdy,3,idir3,ir)   ! nei might search point towards its north bdy
+               llrecv3(idir6) = llrecv3(idir6) .OR. lrecv_bdyint(ib_bdy,3,idir6,ir)   ! north/south, V points
+               idir3 = (/ jpno, jpnw, jpne /)
+               llrecv3(idir3) = llrecv3(idir3) .OR. lrecv_bdyext(ib_bdy,3,idir3,ir)   ! might search point towards bdy on the north
             CASE('orlanski', 'orlanski_npo')
-               llsend2(:) = llsend2(:) .OR. lsend_bdy(ib_bdy,2,:,ir)   ! possibly every direction, U points
-               llrecv2(:) = llrecv2(:) .OR. lrecv_bdy(ib_bdy,2,:,ir)   ! possibly every direction, U points
-               llsend3(:) = llsend3(:) .OR. lsend_bdy(ib_bdy,3,:,ir)   ! possibly every direction, V points
-               llrecv3(:) = llrecv3(:) .OR. lrecv_bdy(ib_bdy,3,:,ir)   ! possibly every direction, V points
+               llsend2(:) = llsend2(:) .OR. lsend_bdyolr(ib_bdy,2,:,ir)   ! possibly every direction, U points
+               llrecv2(:) = llrecv2(:) .OR. lrecv_bdyolr(ib_bdy,2,:,ir)   ! possibly every direction, U points
+               llsend3(:) = llsend3(:) .OR. lsend_bdyolr(ib_bdy,3,:,ir)   ! possibly every direction, V points
+               llrecv3(:) = llrecv3(:) .OR. lrecv_bdyolr(ib_bdy,3,:,ir)   ! possibly every direction, V points
             END SELECT
          END DO
@@ -310,5 +319,5 @@
       INTEGER ::   ibeg, iend      ! length of rim to be treated (rim 0 or rim 1)
       LOGICAL ::   llrim0          ! indicate if rim 0 is treated
-      LOGICAL, DIMENSION(4) :: llsend1, llrecv1  ! indicate how communications are to be carried out
+      LOGICAL, DIMENSION(8) :: llsend1, llrecv1  ! indicate how communications are to be carried out
       !!----------------------------------------------------------------------
       llsend1(:) = .false.   ;   llrecv1(:) = .false.
Index: NEMO/trunk/src/OCE/BDY/bdydyn3d.F90
===================================================================
--- NEMO/trunk/src/OCE/BDY/bdydyn3d.F90	(revision 15345)
+++ NEMO/trunk/src/OCE/BDY/bdydyn3d.F90	(revision 15354)
@@ -18,5 +18,5 @@
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
    USE in_out_manager  !
-   USE lib_mpp, ONLY: ctl_stop
+   USE lib_mpp
    Use phycst
 
@@ -45,9 +45,10 @@
       REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities (to be updated at open boundaries)
       !
-      INTEGER  ::   ib_bdy, ir     ! BDY set index, rim index
-      LOGICAL  ::   llrim0         ! indicate if rim 0 is treated
-      LOGICAL, DIMENSION(4) :: llsend2, llrecv2, llsend3, llrecv3  ! indicate how communications are to be carried out
-
-      !!----------------------------------------------------------------------
+      INTEGER               ::   ib_bdy, ir     ! BDY set index, rim index
+      INTEGER, DIMENSION(6) ::   idir6
+      LOGICAL               ::   llrim0         ! indicate if rim 0 is treated
+      LOGICAL, DIMENSION(8) ::   llsend2, llrecv2, llsend3, llrecv3  ! indicate how communications are to be carried out
+      !!----------------------------------------------------------------------
+      
       llsend2(:) = .false.   ;   llrecv2(:) = .false.
       llsend3(:) = .false.   ;   llrecv3(:) = .false.
@@ -82,13 +83,15 @@
             SELECT CASE( cn_dyn3d(ib_bdy) )
             CASE('orlanski', 'orlanski_npo')
-               llsend2(:) = llsend2(:) .OR. lsend_bdy(ib_bdy,2,:,ir)   ! possibly every direction, U points
-               llrecv2(:) = llrecv2(:) .OR. lrecv_bdy(ib_bdy,2,:,ir)   ! possibly every direction, U points
-               llsend3(:) = llsend3(:) .OR. lsend_bdy(ib_bdy,3,:,ir)   ! possibly every direction, V points
-               llrecv3(:) = llrecv3(:) .OR. lrecv_bdy(ib_bdy,3,:,ir)   ! possibly every direction, V points
+               llsend2(:) = llsend2(:) .OR. lsend_bdyolr(ib_bdy,2,:,ir)   ! possibly every direction, U points
+               llrecv2(:) = llrecv2(:) .OR. lrecv_bdyolr(ib_bdy,2,:,ir)   ! possibly every direction, U points
+               llsend3(:) = llsend3(:) .OR. lsend_bdyolr(ib_bdy,3,:,ir)   ! possibly every direction, V points
+               llrecv3(:) = llrecv3(:) .OR. lrecv_bdyolr(ib_bdy,3,:,ir)   ! possibly every direction, V points
             CASE('zerograd')
-               llsend2(3:4) = llsend2(3:4) .OR. lsend_bdyint(ib_bdy,2,3:4,ir)   ! north/south, U points
-               llrecv2(3:4) = llrecv2(3:4) .OR. lrecv_bdyint(ib_bdy,2,3:4,ir)   ! north/south, U points
-               llsend3(1:2) = llsend3(1:2) .OR. lsend_bdyint(ib_bdy,3,1:2,ir)   ! west/east, V points
-               llrecv3(1:2) = llrecv3(1:2) .OR. lrecv_bdyint(ib_bdy,3,1:2,ir)   ! west/east, V points
+               idir6 = (/ jpso, jpno, jpsw, jpse, jpnw, jpne /)
+               llsend2(idir6) = llsend2(idir6) .OR. lsend_bdyint(ib_bdy,2,idir6,ir)   ! north/south, U points
+               llrecv2(idir6) = llrecv2(idir6) .OR. lrecv_bdyint(ib_bdy,2,idir6,ir)   ! north/south, U points
+               idir6 = (/ jpwe, jpea, jpsw, jpse, jpnw, jpne /)
+               llsend3(idir6) = llsend3(idir6) .OR. lsend_bdyint(ib_bdy,3,idir6,ir)   ! west/east, V points
+               llrecv3(idir6) = llrecv3(idir6) .OR. lrecv_bdyint(ib_bdy,3,idir6,ir)   ! west/east, V points
             CASE('neumann')
                llsend2(:) = llsend2(:) .OR. lsend_bdyint(ib_bdy,2,:,ir)   ! possibly every direction, U points
Index: NEMO/trunk/src/OCE/BDY/bdyice.F90
===================================================================
--- NEMO/trunk/src/OCE/BDY/bdyice.F90	(revision 15345)
+++ NEMO/trunk/src/OCE/BDY/bdyice.F90	(revision 15354)
@@ -58,5 +58,5 @@
       INTEGER ::   ibeg, iend                           ! length of rim to be treated (rim 0 or rim 1)
       LOGICAL ::   llrim0                               ! indicate if rim 0 is treated
-      LOGICAL, DIMENSION(4)  :: llsend1, llrecv1        ! indicate how communications are to be carried out
+      LOGICAL, DIMENSION(8)  :: llsend1, llrecv1        ! indicate how communications are to be carried out
       !!----------------------------------------------------------------------
       ! controls
@@ -327,10 +327,11 @@
       CHARACTER(len=1), INTENT(in)  ::   cd_type   ! nature of velocity grid-points
       !
-      INTEGER  ::   i_bdy, jgrd       ! dummy loop indices
-      INTEGER  ::   ji, jj            ! local scalar
-      INTEGER  ::   jbdy, ir     ! BDY set index, rim index
-      INTEGER  ::   ibeg, iend   ! length of rim to be treated (rim 0 or rim 1)
-      REAL(wp) ::   zmsk1, zmsk2, zflag
-      LOGICAL, DIMENSION(4) :: llsend2, llrecv2, llsend3, llrecv3  ! indicate how communications are to be carried out
+      INTEGER               ::   i_bdy, jgrd       ! dummy loop indices
+      INTEGER               ::   ji, jj            ! local scalar
+      INTEGER               ::   jbdy, ir          ! BDY set index, rim index
+      INTEGER               ::   ibeg, iend        ! length of rim to be treated (rim 0 or rim 1)
+      INTEGER, DIMENSION(3) ::   idir3
+      REAL(wp)              ::   zmsk1, zmsk2, zflag
+      LOGICAL, DIMENSION(8) :: llsend2, llrecv2, llsend3, llrecv3  ! indicate how communications are to be carried out
       !!------------------------------------------------------------------------------
       IF( ln_timing )   CALL timing_start('bdy_ice_dyn')
@@ -430,8 +431,10 @@
             DO jbdy = 1, nb_bdy
                IF( cn_ice(jbdy) == 'frs' .AND. nn_ice_dta(jbdy) /= 0 ) THEN
-                  llsend2(:) = llsend2(:) .OR. lsend_bdyint(jbdy,2,:,ir)   ! possibly every direction, U points
-                  llsend2(1) = llsend2(1) .OR. lsend_bdyext(jbdy,2,1,ir)   ! neighbour might search point towards its west bdy
-                  llrecv2(:) = llrecv2(:) .OR. lrecv_bdyint(jbdy,2,:,ir)   ! possibly every direction, U points
-                  llrecv2(2) = llrecv2(2) .OR. lrecv_bdyext(jbdy,2,2,ir)   ! might search point towards east bdy
+                  llsend2(  :  ) = llsend2(  :  ) .OR. lsend_bdyint(jbdy,2,  :  ,ir)   ! possibly every direction, U points
+                  idir3 = (/ jpwe, jpsw, jpnw /)
+                  llsend2(idir3) = llsend2(idir3) .OR. lsend_bdyext(jbdy,2,idir3,ir)   ! nei might search point towards its ea bdy
+                  llrecv2(  :  ) = llrecv2(  :  ) .OR. lrecv_bdyint(jbdy,2,  :  ,ir)   ! possibly every direction, U points
+                  idir3 = (/ jpea, jpse, jpne /)
+                  llrecv2(idir3) = llrecv2(idir3) .OR. lrecv_bdyext(jbdy,2,idir3,ir)   ! might search point towards east bdy
                END IF
             END DO
@@ -444,8 +447,10 @@
             DO jbdy = 1, nb_bdy
                IF( cn_ice(jbdy) == 'frs' .AND. nn_ice_dta(jbdy) /= 0 ) THEN
-                  llsend3(:) = llsend3(:) .OR. lsend_bdyint(jbdy,3,:,ir)   ! possibly every direction, V points
-                  llsend3(3) = llsend3(3) .OR. lsend_bdyext(jbdy,3,3,ir)   ! neighbour might search point towards its south bdy
-                  llrecv3(:) = llrecv3(:) .OR. lrecv_bdyint(jbdy,3,:,ir)   ! possibly every direction, V points
-                  llrecv3(4) = llrecv3(4) .OR. lrecv_bdyext(jbdy,3,4,ir)   ! might search point towards north bdy
+                  llsend3(  :  ) = llsend3(  :  ) .OR. lsend_bdyint(jbdy,3,  :  ,ir)   ! possibly every direction, V points
+                  idir3 = (/ jpso, jpsw, jpse /)
+                  llsend3(idir3) = llsend3(idir3) .OR. lsend_bdyext(jbdy,3,idir3,ir)   ! nei might search point towards its no bdy
+                  llrecv3(  :  ) = llrecv3(  :  ) .OR. lrecv_bdyint(jbdy,3,  :  ,ir)   ! possibly every direction, V points
+                  idir3 = (/ jpno, jpnw, jpne /)
+                  llrecv3(idir3) = llrecv3(idir3) .OR. lrecv_bdyext(jbdy,3,idir3,ir)   ! might search point towards north bdy
                END IF
             END DO
Index: NEMO/trunk/src/OCE/BDY/bdyini.F90
===================================================================
--- NEMO/trunk/src/OCE/BDY/bdyini.F90	(revision 15345)
+++ NEMO/trunk/src/OCE/BDY/bdyini.F90	(revision 15354)
@@ -146,5 +146,10 @@
       INTEGER  ::   ib_bdy, ii, ij, igrd, ib, ir, iseg     ! dummy loop indices
       INTEGER  ::   icount, icountr, icountr0, ibr_max     ! local integers
-      INTEGER  ::   ilen1                                  !   -       -
+      INTEGER  ::   ilen1                           !   -       -
+      INTEGER  ::   iiRst, iiRnd, iiSst, iiSnd, iiRcorn, iiSdiag, iiSsono
+      INTEGER  ::   ijRst, ijRnd, ijSst, ijSnd, ijRcorn, ijSdiag, ijSsono
+      INTEGER  ::   iiout, ijout, iioutdir, ijoutdir, icnt
+      INTEGER  ::   iRnei, iRdiag, iRsono
+      INTEGER  ::   iSnei, iSdiag, iSsono                  !   -       -
       INTEGER  ::   iwe, ies, iso, ino, inum, id_dummy     !   -       -
       INTEGER  ::   jpbdta                                 !   -       -
@@ -159,8 +164,10 @@
       INTEGER,  ALLOCATABLE, DIMENSION(:,:,:)         ::   nbrdta            ! Discrete distance from rim points
       CHARACTER(LEN=1)     , DIMENSION(jpbgrd)        ::   cgrid
+      CHARACTER(LEN=2)                                ::   cRdir, cSdir
       REAL(wp), ALLOCATABLE, DIMENSION(:,:)     ::   zz_read                 ! work space for 2D global boundary data
       REAL(wp), POINTER    , DIMENSION(:,:)     ::   zmask                   ! pointer to 2D mask fields
       REAL(wp)             , DIMENSION(jpi,jpj) ::   zfmask   ! temporary fmask array excluding coastal boundary condition (shlat)
       REAL(wp)             , DIMENSION(jpi,jpj) ::   ztmask, zumask, zvmask  ! temporary u/v mask array
+      REAL(wp)             , DIMENSION(jpi,jpj) ::   zzbdy
       !!----------------------------------------------------------------------
       !
@@ -562,7 +569,7 @@
       ! Initialize array indicating communications in bdy
       ! -------------------------------------------------
-      ALLOCATE( lsend_bdy(nb_bdy,jpbgrd,4,0:1), lrecv_bdy(nb_bdy,jpbgrd,4,0:1) )
-      lsend_bdy(:,:,:,:) = .false.
-      lrecv_bdy(:,:,:,:) = .false. 
+      ALLOCATE( lsend_bdyolr(nb_bdy,jpbgrd,8,0:1), lrecv_bdyolr(nb_bdy,jpbgrd,8,0:1) )
+      lsend_bdyolr(:,:,:,:) = .false.
+      lrecv_bdyolr(:,:,:,:) = .false. 
 
       DO ib_bdy = 1, nb_bdy
@@ -576,26 +583,106 @@
                !
                ! check if point has to be sent     to   a neighbour
-               ! W neighbour and on the inner left  side
-               IF( ii >= Nis0 .AND. ii < Nis0 + nn_hls .AND. mpiSnei(nn_hls,jpwe) > -1 )   lsend_bdy(ib_bdy,igrd,jpwe,ir) = .TRUE.
-               ! E neighbour and on the inner right side
-               IF( ii <= Nie0 .AND. ii > Nie0 - nn_hls .AND. mpiSnei(nn_hls,jpea) > -1 )   lsend_bdy(ib_bdy,igrd,jpea,ir) = .TRUE.
-               ! S neighbour and on the inner down side
-               IF( ij >= Njs0 .AND. ij < Njs0 + nn_hls .AND. mpiSnei(nn_hls,jpso) > -1 )   lsend_bdy(ib_bdy,igrd,jpso,ir) = .TRUE.
-               ! N neighbour and on the inner up   side
-               IF( ij <= Nje0 .AND. ij > Nje0 - nn_hls .AND. mpiSnei(nn_hls,jpno) > -1 )   lsend_bdy(ib_bdy,igrd,jpno,ir) = .TRUE.
+               IF( ii >= Nis0 .AND. ii < Nis0 + nn_hls .AND. ij >= Njs0 .AND. ij <= Nje0         ) THEN   ! we inner side
+                  IF( mpiSnei(nn_hls,jpwe) > -1 ) THEN   ;   lsend_bdyolr(ib_bdy,igrd,jpwe,ir) = .TRUE.   ! send to we neighbourg
+                  ELSE                                   ;   CALL ctl_stop( 'bdyini send olr we-side' )
+                  ENDIF
+               ENDIF
+               IF( ii <= Nie0 .AND. ii > Nie0 - nn_hls .AND. ij >= Njs0 .AND. ij <= Nje0         ) THEN   ! ea inner side
+                  IF( mpiSnei(nn_hls,jpea) > -1 ) THEN   ;   lsend_bdyolr(ib_bdy,igrd,jpea,ir) = .TRUE.   ! send to ea neighbourg
+                  ELSE                                   ;   CALL ctl_stop( 'bdyini send olr ea-side' )
+                  ENDIF
+               ENDIF
+               IF( ( ( ii >= Nis0 .AND. ii <= Nie0 ) .OR. nn_comm == 1 )  &
+                  &                                    .AND. ij >= Njs0 .AND. ij < Njs0 + nn_hls ) THEN   ! so inner side
+                  IF( mpiSnei(nn_hls,jpso) > -1 ) THEN   ;   lsend_bdyolr(ib_bdy,igrd,jpso,ir) = .TRUE.   ! send to so neighbourg
+                  ELSE                                   ;   CALL ctl_stop( 'bdyini send olr so-side' )
+                  ENDIF
+               ENDIF
+               IF( ( ( ii >= Nis0 .AND. ii <= Nie0 ) .OR. nn_comm == 1 ) &
+                  &                                    .AND. ij <= Nje0 .AND. ij > Nje0 - nn_hls ) THEN   ! no inner side
+                  IF( mpiSnei(nn_hls,jpno) > -1 ) THEN   ;   lsend_bdyolr(ib_bdy,igrd,jpno,ir) = .TRUE.   ! send to no neighbourg
+                  ELSE                                   ;   CALL ctl_stop( 'bdyini send olr no-side' )
+                  ENDIF
+               ENDIF
+               IF( ii >= Nis0 .AND. ii < Nis0 + nn_hls .AND. ij >= Njs0 .AND. ij < Njs0 + nn_hls ) THEN   ! sw inner corner
+                  IF( mpiSnei(nn_hls,jpsw) > -1 ) THEN   ;   lsend_bdyolr(ib_bdy,igrd,jpsw,ir) = .TRUE.   ! send to sw neighbourg
+                  ELSEIF( nn_comm /= 1          ) THEN   ;   CALL ctl_stop( 'bdyini send olr sw-corner' )
+                  ENDIF
+               ENDIF
+               IF( ii <= Nie0 .AND. ii > Nie0 - nn_hls .AND. ij >= Njs0 .AND. ij < Njs0 + nn_hls ) THEN   ! se inner corner
+                  IF( mpiSnei(nn_hls,jpse) > -1 ) THEN   ;   lsend_bdyolr(ib_bdy,igrd,jpse,ir) = .TRUE.   ! send to se neighbourg
+                  ELSEIF( nn_comm /= 1          ) THEN   ;   CALL ctl_stop( 'bdyini send olr se-corner' )
+                  ENDIF
+               ENDIF
+               IF( ii >= Nis0 .AND. ii < Nis0 + nn_hls .AND. ij <= Nje0 .AND. ij > Nje0 - nn_hls ) THEN   ! nw inner corner
+                  IF( mpiSnei(nn_hls,jpnw) > -1 ) THEN   ;   lsend_bdyolr(ib_bdy,igrd,jpnw,ir) = .TRUE.   ! send to nw neighbourg
+                  ELSEIF( nn_comm /= 1          ) THEN   ;   CALL ctl_stop( 'bdyini send olr nw-corner' )
+                  ENDIF
+               ENDIF
+               IF( ii <= Nie0 .AND. ii > Nie0 - nn_hls .AND. ij <= Nje0 .AND. ij > Nje0 - nn_hls ) THEN   ! ne inner corner
+                  IF( mpiSnei(nn_hls,jpne) > -1 ) THEN   ;   lsend_bdyolr(ib_bdy,igrd,jpne,ir) = .TRUE.   ! send to ne neighbourg
+                  ELSEIF( nn_comm /= 1          ) THEN   ;   CALL ctl_stop( 'bdyini send olr ne-corner' )
+                  ENDIF
+               ENDIF
                !
                ! check if point has to be received from a neighbour
-               ! W neighbour and on the outter left  side
-               IF( ii  < Nis0                          .AND. mpiRnei(nn_hls,jpwe) > -1 )   lrecv_bdy(ib_bdy,igrd,jpwe,ir) = .TRUE.
-               ! E neighbour and on the outter right side
-               IF( ii  > Nie0                          .AND. mpiRnei(nn_hls,jpea) > -1 )   lrecv_bdy(ib_bdy,igrd,jpea,ir) = .TRUE.
-               ! S neighbour and on the outter down side
-               IF( ij  < Njs0                          .AND. mpiRnei(nn_hls,jpso) > -1 )   lrecv_bdy(ib_bdy,igrd,jpso,ir) = .TRUE.
-               ! N neighbour and on the outter up   side
-               IF( ij  > Nje0                          .AND. mpiRnei(nn_hls,jpno) > -1 )   lrecv_bdy(ib_bdy,igrd,jpno,ir) = .TRUE.
+               IF( ii  < Nis0                  .AND. ij >= Njs0 .AND. ij <= Nje0 ) THEN   ! we side
+                  IF( mpiRnei(nn_hls,jpwe) > -1 ) THEN   ;   lrecv_bdyolr(ib_bdy,igrd,jpwe,ir) = .TRUE.   ! rcv from we nei
+                  ELSE                                   ;   CALL ctl_stop( 'bdyini recv olr we-side ' )
+                  ENDIF
+               ENDIF
+               IF( ii  > Nie0                  .AND. ij >= Njs0 .AND. ij <= Nje0 ) THEN   ! ea side
+                  IF( mpiRnei(nn_hls,jpea) > -1 ) THEN   ;   lrecv_bdyolr(ib_bdy,igrd,jpea,ir) = .TRUE.   ! rcv from ea nei
+                  ELSE                                   ;   CALL ctl_stop( 'bdyini recv olr ea-side ' )
+                  ENDIF
+               ENDIF
+               IF( ii >= Nis0 .AND. ii <= Nie0 .AND. ij  < Njs0                  ) THEN   ! so side
+                  IF( mpiRnei(nn_hls,jpso) > -1 ) THEN   ;   lrecv_bdyolr(ib_bdy,igrd,jpso,ir) = .TRUE.   ! rcv from so nei
+                  ELSE                                   ;   CALL ctl_stop( 'bdyini recv olr so-side ' )
+                  ENDIF
+               ENDIF
+               IF( ii >= Nis0 .AND. ii <= Nie0 .AND. ij  > Nje0                  ) THEN   ! no side
+                  IF( mpiRnei(nn_hls,jpno) > -1 ) THEN   ;   lrecv_bdyolr(ib_bdy,igrd,jpno,ir) = .TRUE.   ! rcv from no nei
+                  ELSE                                   ;   CALL ctl_stop( 'bdyini recv olr no-side ' )
+                  ENDIF
+               ENDIF
+               IF( ii  < Nis0                  .AND. ij  < Njs0                  ) THEN   ! sw corner
+                  IF(     mpiRnei(nn_hls,jpsw) > -1                    ) THEN   ;   lrecv_bdyolr(ib_bdy,igrd,jpsw,ir) = .TRUE.
+                  ELSEIF( mpiRnei(nn_hls,jpso) > -1 .AND. nn_comm == 1 ) THEN   ;   lrecv_bdyolr(ib_bdy,igrd,jpso,ir) = .TRUE.
+                  ELSE                                                          ;   CALL ctl_stop( 'bdyini recv olr sw-corner' )
+                  ENDIF
+               ENDIF
+               IF( ii  > Nie0                  .AND. ij  < Njs0                  ) THEN   ! se corner
+                  IF(     mpiRnei(nn_hls,jpse) > -1                    ) THEN   ;   lrecv_bdyolr(ib_bdy,igrd,jpse,ir) = .TRUE.
+                  ELSEIF( mpiRnei(nn_hls,jpso) > -1 .AND. nn_comm == 1 ) THEN   ;   lrecv_bdyolr(ib_bdy,igrd,jpso,ir) = .TRUE.
+                  ELSE                                                          ;   CALL ctl_stop( 'bdyini recv olr se-corner' )
+                  ENDIF
+               ENDIF
+               IF( ii  < Nis0                  .AND. ij  > Nje0                  ) THEN   ! nw corner
+                  IF(     mpiRnei(nn_hls,jpnw) > -1                    ) THEN   ;   lrecv_bdyolr(ib_bdy,igrd,jpnw,ir) = .TRUE.
+                  ELSEIF( mpiRnei(nn_hls,jpno) > -1 .AND. nn_comm == 1 ) THEN   ;   lrecv_bdyolr(ib_bdy,igrd,jpno,ir) = .TRUE.
+                  ELSE                                                          ;   CALL ctl_stop( 'bdyini recv olr nw-corner' )
+                  ENDIF
+               ENDIF
+               IF( ii  > Nie0                  .AND. ij  > Nje0                  ) THEN   ! ne corner
+                  IF(     mpiRnei(nn_hls,jpne) > -1                    ) THEN   ;   lrecv_bdyolr(ib_bdy,igrd,jpne,ir) = .TRUE.
+                  ELSEIF( mpiRnei(nn_hls,jpno) > -1 .AND. nn_comm == 1 ) THEN   ;   lrecv_bdyolr(ib_bdy,igrd,jpno,ir) = .TRUE.
+                  ELSE                                                          ;   CALL ctl_stop( 'bdyini recv olr ne-corner' )
+                  ENDIF
+               ENDIF
                !
             END DO
-         END DO  ! igrd
-
+         END DO   !   igrd
+         
+!!$         ! Comment out for debug
+!!$         DO ir = 0,1
+!!$            zzbdy(:,:) = narea ; CALL lbc_lnk('bdy debug', zzbdy, 'T', 1._wp, kfillmode = jpfillnothing,   &
+!!$               &                              lsend = lsend_bdyolr(ib_bdy,1,:,ir), lrecv = lrecv_bdyolr(ib_bdy,1,:,ir) )
+!!$            zzbdy(:,:) = narea ; CALL lbc_lnk('bdy debug', zzbdy, 'U', 1._wp, kfillmode = jpfillnothing,   &
+!!$               &                              lsend = lsend_bdyolr(ib_bdy,2,:,ir), lrecv = lrecv_bdyolr(ib_bdy,2,:,ir) )
+!!$            zzbdy(:,:) = narea ; CALL lbc_lnk('bdy debug', zzbdy, 'V', 1._wp, kfillmode = jpfillnothing,   &
+!!$               &                              lsend = lsend_bdyolr(ib_bdy,3,:,ir), lrecv = lrecv_bdyolr(ib_bdy,3,:,ir) )    
+!!$         END DO
+         
          ! Compute rim weights for FRS scheme
          ! ----------------------------------
@@ -709,13 +796,13 @@
       !
       ! Check which boundaries might need communication
-      ALLOCATE( lsend_bdyint(nb_bdy,jpbgrd,4,0:1), lrecv_bdyint(nb_bdy,jpbgrd,4,0:1) )
+      ALLOCATE( lsend_bdyint(nb_bdy,jpbgrd,8,0:1), lrecv_bdyint(nb_bdy,jpbgrd,8,0:1) )
       lsend_bdyint(:,:,:,:) = .false.
       lrecv_bdyint(:,:,:,:) = .false. 
-      ALLOCATE( lsend_bdyext(nb_bdy,jpbgrd,4,0:1), lrecv_bdyext(nb_bdy,jpbgrd,4,0:1) )
+      ALLOCATE( lsend_bdyext(nb_bdy,jpbgrd,8,0:1), lrecv_bdyext(nb_bdy,jpbgrd,8,0:1) )
       lsend_bdyext(:,:,:,:) = .false.
       lrecv_bdyext(:,:,:,:) = .false.
       !
-      DO igrd = 1, jpbgrd
-         DO ib_bdy = 1, nb_bdy
+      DO ib_bdy = 1, nb_bdy
+         DO igrd = 1, jpbgrd
             DO ib = 1, idx_bdy(ib_bdy)%nblenrim(igrd)
                IF( idx_bdy(ib_bdy)%ntreat(ib,igrd) == -1 ) CYCLE
@@ -731,56 +818,218 @@
                CALL find_neib( ii, ij, idx_bdy(ib_bdy)%ntreat(ib,igrd), ii1, ij1, ii2, ij2, ii3, ij3 )   ! free ocean neighbours
                !
-               ! search neighbour in the  west/east  direction
+               !  take care of the 4 sides
                !
-               ! Rim is on the halo and computed ocean is towards exterior of mpi domain :
-               !      <--    (o exterior)     -->  
-               ! (1)  o|x         OR    (2)   x|o
-               !       |___                 ___|
-               ! ==> cannot compute the point x -> need to receive it
-               IF( iibi==0     .OR. ii1==0     .OR. ii2==0     .OR. ii3==0     )   lrecv_bdyint(ib_bdy,igrd,jpwe,ir) = .TRUE.
-               IF( iibe==0                                                     )   lrecv_bdyext(ib_bdy,igrd,jpwe,ir) = .TRUE.
-               IF( iibi==jpi+1 .OR. ii1==jpi+1 .OR. ii2==jpi+1 .OR. ii3==jpi+1 )   lrecv_bdyint(ib_bdy,igrd,jpea,ir) = .TRUE.  
-               IF( iibe==jpi+1                                                 )   lrecv_bdyext(ib_bdy,igrd,jpea,ir) = .TRUE.  
-               ! Check if neighbour has its rim parallel to its mpi subdomain border and located next to its halo.
-               ! :¨¨¨¨¨|¨¨-->    |                                             |    <--¨¨|¨¨¨¨¨: 
-               ! :     |  x:o    |    neighbour limited by ... would need o    |    o:x  |     :
-               ! :.....|_._:_____|   (1) W neighbour         E neighbour (2)   |_____:_._|.....:
-               ! ==> the neighbour cannot compute the point x -> need to send it
-               IF( ii ==     2*nn_hls   .AND. mpiSnei(nn_hls,jpwe) > -1 ) THEN   ! 2*nn_hls      -> ji=jpi of western neighbour
-                  IF( iibi==ii+1 .OR. ii1==ii+1 .OR. ii2==ii+1 .OR. ii3==ii+1 )   lsend_bdyint(ib_bdy,igrd,jpwe,ir) = .TRUE.
-                  IF( iibe==ii+1                                              )   lsend_bdyext(ib_bdy,igrd,jpwe,ir) = .TRUE.
-               ENDIF
-               IF( ii == jpi-2*nn_hls+1 .AND. mpiSnei(nn_hls,jpea) > -1 ) THEN   ! jpi-2*nn_hls+1-> ji=1   of eastern neighbour
-                  IF( iibi==ii-1 .OR. ii1==ii-1 .OR. ii2==ii-1 .OR. ii3==ii-1 )   lsend_bdyint(ib_bdy,igrd,jpea,ir) = .TRUE.
-                  IF( iibe==ii-1                                              )   lsend_bdyext(ib_bdy,igrd,jpea,ir) = .TRUE.
-               ENDIF
+               DO icnt = 1, 4
+                  SELECT CASE( icnt )
+                     !                                           ... _____
+                  CASE( 1 )   ! x: rim on rcvwe/sndea-side         o|  :
+                     !          o: potential neighbour(s)          o|x :
+                     !             outside of the MPI domain     ..o|__:__
+                     cRdir    = 'we'             ;   cSdir    = 'ea'
+                     iRnei    = jpwe             ;   iSnei    = jpea
+                     iiRst    = 1                ;   ijRst    = 2               ! Rcv we-side starting point, excluding sw-corner
+                     iiRnd    = 1                ;   ijRnd    = jpj-1           ! Rcv we-side   ending point, excluding nw-corner
+                     iiSst    = jpi-2*nn_hls+1   ;   ijSst    = 2               ! Snd ea-side starting point, excluding se-corner
+                     iiSnd    = jpi-2*nn_hls+1   ;   ijSnd    = jpj-1           ! Snd ea-side   ending point, excluding ne-corner
+                     iioutdir = -1               ;   ijoutdir = -999            ! outside MPI domain: westward
+                     !                                           ______....
+                  CASE( 2 )   ! x: rim on rcvea/sndwe-side          :  |o
+                     !          o: potential neighbour(s)           : x|o
+                     !             outside of the MPI domain     ___:__|o..
+                     cRdir    = 'ea'             ;   cSdir    = 'we'
+                     iRnei    = jpea             ;   iSnei    = jpwe
+                     iiRst    = jpi              ;   ijRst    = 2                ! Rcv ea-side starting point, excluding se-corner
+                     iiRnd    = jpi              ;   ijRnd    = jpj-1            ! Rcv ea-side   ending point, excluding ne-corner
+                     iiSst    = 2*nn_hls         ;   ijSst    = 2                ! Snd we-side starting point, excluding sw-corner
+                     iiSnd    = 2*nn_hls         ;   ijSnd    = jpj-1            ! Snd we-side   ending point, excluding nw-corner
+                     iioutdir = 1                ;   ijoutdir = -999             ! outside MPI domain: eastward
+                     !
+                  CASE( 3 )   ! x: rim on rcvso/sndno-side       |       |
+                     !          o: potential neighbour(s)        |¨¨¨¨¨¨¨|
+                     !             outside of the MPI domain     |___x___|
+                     !                                           : o o o :
+                     !                                           :       :
+                     cRdir    = 'so'             ;   cSdir    = 'no'
+                     iRnei    = jpso             ;   iSnei    = jpno
+                     iiRst    = 2                ;   ijRst    = 1                ! Rcv so-side starting point, excluding sw-corner
+                     iiRnd    = jpi-1            ;   ijRnd    = 1                ! Rcv so-side   ending point, excluding se-corner
+                     iiSst    = 2                ;   ijSst    = jpj-2*nn_hls+1   ! Snd no-side starting point, excluding nw-corner
+                     iiSnd    = jpi-1            ;   ijSnd    = jpj-2*nn_hls+1   ! Snd no-side   ending point, excluding ne-corner
+                     iioutdir = -999             ;   ijoutdir = -1               ! outside MPI domain: southward
+                     !                                           :       :
+                  CASE( 4 )   ! x: rim on rcvno/sndso-side       :_o_o_o_:
+                     !          o: potential neighbour(s)        |   x   |
+                     !             outside of the MPI domain     |       |
+                     !                                           |¨¨¨¨¨¨¨|
+                     cRdir    = 'no'             ;   cSdir    = 'so'
+                     iRnei    = jpno             ;   iSnei    = jpso
+                     iiRst    = 2                ;   ijRst    = jpj              ! Rcv no-side starting point, excluding nw-corner
+                     iiRnd    = jpi-1            ;   ijRnd    = jpj              ! Rcv no-side   ending point, excluding ne-corner
+                     iiSst    = 2                ;   ijSst    =     2*nn_hls     ! Snd so-side starting point, excluding sw-corner
+                     iiSnd    = jpi-1            ;   ijSnd    =     2*nn_hls     ! Snd so-side   ending point, excluding se-corner
+                     iioutdir = -999             ;   ijoutdir = 1                ! outside MPI domain: northward
+                  END SELECT
+                  !
+                  IF( ii >= iiRst .AND. ii <= iiRnd .AND. ij >= ijRst .AND. ij <= ijRnd ) THEN   ! rim point in recv side
+                     iiout = ii+iioutdir ; ijout = ij+ijoutdir        ! in which direction do we go outside of the MPI domain?
+                     ! take care of neighbourg(s) in the interior of the computational domain
+                     IF(  iibi==iiout .OR. ii1==iiout .OR. ii2==iiout .OR. ii3==iiout .OR.   &   ! Neib outside of the MPI domain
+                        & ijbi==ijout .OR. ij1==ijout .OR. ij2==ijout .OR. ij3==ijout ) THEN     ! -> I cannot compute it -> recv it
+                        IF( mpiRnei(nn_hls,iRnei) > -1 ) THEN   ;   lrecv_bdyint(ib_bdy,igrd,iRnei,ir) = .TRUE.
+                        ELSE                                    ;   CALL ctl_stop( 'bdyini recv int '//cRdir//'-side ' )
+                        ENDIF
+                     ENDIF
+                     ! take care of neighbourg in the exterior of the computational domain
+                     IF(  iibe==iiout .OR. ijbe==ijout ) THEN   ! Neib outside of the MPI domain -> I cannot compute it -> recv it
+                        IF( mpiRnei(nn_hls,iRnei) > -1 ) THEN   ;   lrecv_bdyext(ib_bdy,igrd,iRnei,ir) = .TRUE.
+                        ELSE                                    ;   CALL ctl_stop( 'bdyini recv ext '//cRdir//'-side ' )
+                        ENDIF
+                     ENDIF
+                  ENDIF
+                  
+                  IF( ii >= iiSst .AND. ii <= iiSnd .AND. ij >= ijSst .AND. ij <= ijSnd ) THEN   ! rim point in send side
+                     iiout = ii+iioutdir ; ijout = ij+ijoutdir        ! in which direction do we go outside of the nei MPI domain?
+                     ! take care of neighbourg(s) in the interior of the computational domain
+                     IF(  iibi==iiout .OR. ii1==iiout .OR. ii2==iiout .OR. ii3==iiout .OR.   &   ! Neib outside of nei MPI domain
+                        & ijbi==ijout .OR. ij1==ijout .OR. ij2==ijout .OR. ij3==ijout ) THEN     ! -> nei cannot compute it
+                        IF( mpiSnei(nn_hls,iSnei) > -1 ) THEN   ;   lsend_bdyint(ib_bdy,igrd,iSnei,ir) = .TRUE.   ! -> send to nei
+                        ELSE                                    ;   CALL ctl_stop( 'bdyini send int '//cSdir//'-side ' )
+                        ENDIF
+                     ENDIF
+                     ! take care of neighbourg in the exterior of the computational domain
+                     IF( iibe == iiout .OR. ijbe == ijout ) THEN   ! Neib outside of the nei MPI domain -> nei cannot compute it
+                        IF( mpiSnei(nn_hls,iSnei) > -1 ) THEN   ;   lsend_bdyext(ib_bdy,igrd,iSnei,ir) = .TRUE.   ! -> send to nei
+                        ELSE                                    ;   CALL ctl_stop( 'bdyini send ext '//cSdir//'-side ' )
+                        ENDIF
+                     ENDIF
+                  END IF
+
+               END DO   ! 4 sides
                !
-               ! search neighbour in the north/south direction   
+               ! specific treatment for the corners
                !
-               ! Rim is on the halo and computed ocean is towards exterior of mpi domain
-               ! ==> cannot compute the point x -> need to receive it
-               !(3)   |       |         ^   ___o___     
-               !  |   |___x___|   OR    |  |   x   |
-               !  v       o           (4)  |       |
-               IF( ijbi==0     .OR. ij1==0     .OR. ij2==0     .OR. ij3==0     )   lrecv_bdyint(ib_bdy,igrd,jpso,ir) = .TRUE.
-               IF( ijbe==0                                                     )   lrecv_bdyext(ib_bdy,igrd,jpso,ir) = .TRUE.
-               IF( ijbi==jpj+1 .OR. ij1==jpj+1 .OR. ij2==jpj+1 .OR. ij3==jpj+1 )   lrecv_bdyint(ib_bdy,igrd,jpno,ir) = .TRUE.
-               IF( ijbe==jpj+1                                                 )   lrecv_bdyext(ib_bdy,igrd,jpno,ir) = .TRUE.
-               ! Check if neighbour has its rim parallel to its mpi subdomain     _________  border and next to its halo
-               !   ^  |    o    |                                                :         : 
-               !   |  |¨¨¨¨x¨¨¨¨|   neighbour limited by ... would need o     |  |....x....|
-               !      :_________:  (3) S neighbour          N neighbour (4)   v  |    o    |   
-               ! ==> the neighbour cannot compute the point x -> need to send it
-               IF( ij ==     2*nn_hls   .AND. mpiSnei(nn_hls,jpso) > -1 ) THEN   ! 2*nn_hls      -> jj=jpj of southern neighbour 
-                  IF( ijbi==ij+1 .OR. ij1==ij+1 .OR. ij2==ij+1 .OR. ij3==ij+1 )   lsend_bdyint(ib_bdy,igrd,jpso,ir) = .TRUE.
-                  IF( ijbe==ij+1                                              )   lsend_bdyext(ib_bdy,igrd,jpso,ir) = .TRUE.
-               ENDIF
-               IF( ij == jpj-2*nn_hls+1 .AND. mpiSnei(nn_hls,jpno) > -1 ) THEN   ! jpj-2*nn_hls+1-> jj=1   of northern neighbour
-                  IF( ijbi==ij-1 .OR. ij1==ij-1 .OR. ij2==ij-1 .OR. ij3==ij-1 )   lsend_bdyint(ib_bdy,igrd,jpno,ir) = .TRUE.
-                  IF( ijbe==ij-1                                              )   lsend_bdyext(ib_bdy,igrd,jpno,ir) = .TRUE.
-               ENDIF
-            END DO
-         END DO
-      END DO
+               DO icnt = 1, 4
+                  SELECT CASE( icnt )
+                     !                                       ...|....
+                  CASE( 1 )   ! x: rim on sw-corner            o|   :
+                     !          o: potential neighbour(s)      o|x__:__
+                     !             outside of the MPI domain   o o o:
+                     !                                              :
+                     cRdir    = 'sw'
+                     iRdiag   = jpsw             ;   iRsono   = jpso             ! Recv: for sw or so
+                     iSdiag   = jpne             ;   iSsono   = jpno             ! Send: to ne or no
+                     iiRcorn  = 1                ;   ijRcorn  = 1                ! receiving sw-corner
+                     iiSdiag  = jpi-2*nn_hls+1   ;   ijSdiag  = jpj-2*nn_hls+1   ! send to sw-corner of ne neighbourg
+                     iiSsono  = 1                ;   ijSsono  = jpj-2*nn_hls+1   ! send to sw-corner of no neighbourg
+                     iioutdir = -1               ;   ijoutdir = -1               ! outside MPI domain: westward or southward
+                     !                                          ....|...
+                  CASE( 2 )   ! x: rim on se-corner             :   |o
+                     !          o: potential neighbour(s)     __:__x|o
+                     !             outside of the MPI domain    :o o o
+                     !                                          :    
+                     cRdir    = 'se'
+                     iRdiag   = jpse             ;   iRsono   = jpso             ! Recv: for se or so
+                     iSdiag   = jpnw             ;   iSsono   = jpno             ! Send: to nw or no
+                     iiRcorn  = jpi              ;   ijRcorn  = 1                ! receiving se-corner
+                     iiSdiag  =     2*nn_hls     ;   ijSdiag  = jpj-2*nn_hls+1   ! send to se-corner of nw neighbourg
+                     iiSsono  = jpi              ;   ijSsono  = jpj-2*nn_hls+1   ! send to se-corner of no neighbourg
+                     iioutdir = 1                ;   ijoutdir = -1               ! outside MPI domain: eastward or southward
+                     !                                              :       
+                     !                                         o o_o:___
+                  CASE( 3 )   ! x: rim on nw-corner            o|x  :
+                     !          o: potential neighbour(s)    ..o|...:
+                     !             outside of the MPI domain    |
+                     cRdir    = 'nw'
+                     iRdiag   = jpnw             ;   iRsono   = jpno             ! Recv: for nw or no
+                     iSdiag   = jpse             ;   iSsono   = jpso             ! Send: to se or so
+                     iiRcorn  = 1                ;   ijRcorn  = jpj              ! receiving nw-corner
+                     iiSdiag  = jpi-2*nn_hls+1   ;   ijSdiag  =     2*nn_hls     ! send to nw-corner of se neighbourg
+                     iiSsono  = 1                ;   ijSsono  =     2*nn_hls     ! send to nw-corner of so neighbourg
+                     iioutdir = -1               ;   ijoutdir =  1               ! outside MPI domain: westward or northward
+                     !                                          :       
+                     !                                       ___:o_o o
+                  CASE( 4 )   ! x: rim on ne-corner             :  x|o
+                     !          o: potential neighbour(s)       :...|o...
+                     !             outside of the MPI domain        |
+                     cRdir    = 'ne'
+                     iRdiag   = jpne             ;   iRsono   = jpno             ! Recv: for ne or no
+                     iSdiag   = jpsw             ;   iSsono   = jpso             ! Send: to sw or so
+                     iiRcorn  = jpi              ;   ijRcorn  = jpj              ! receiving ne-corner
+                     iiSdiag  =     2*nn_hls     ;   ijSdiag  =     2*nn_hls     ! send to ne-corner of sw neighbourg
+                     iiSsono  = jpi              ;   ijSsono  =     2*nn_hls     ! send to ne-corner of so neighbourg
+                     iioutdir = 1                ;   ijoutdir = 1                ! outside MPI domain: eastward or southward
+                  END SELECT
+                  !
+                  ! Check if we need to receive data for this rim point
+                  IF( ii == iiRcorn .AND. ij == ijRcorn ) THEN   ! the rim point is located on the corner for the MPI domain
+                     iiout = ii+iioutdir ; ijout = ij+ijoutdir        ! in which direction do we go outside of the MPI domain?
+                     ! take care of neighbourg(s) in the interior of the computational domain
+                     IF(  iibi==iiout .OR. ii1==iiout .OR. ii2==iiout .OR. ii3==iiout .OR.   &   ! Neib outside of the MPI domain
+                        & ijbi==ijout .OR. ij1==ijout .OR. ij2==ijout .OR. ij3==ijout ) THEN     ! -> I cannot compute it -> recv it
+                        IF(     mpiRnei(nn_hls,iRdiag) > -1 ) THEN
+                           lrecv_bdyint(ib_bdy,igrd,iRdiag,ir) = .TRUE.   ! Receive directly from diagonal neighbourg
+                        ELSEIF( mpiRnei(nn_hls,iRsono) > -1 .AND. nn_comm == 1 ) THEN
+                           lrecv_bdyint(ib_bdy,igrd,iRsono,ir) = .TRUE.   ! Receive through the South/North neighbourg
+                        ELSE
+                           CALL ctl_stop( 'bdyini recv int '//cRdir//'-corner ' )
+                        ENDIF
+                     ENDIF
+                     ! take care of neighbourg in the exterior of the computational domain
+                     IF(  iibe==iiout .OR. ijbe==ijout ) THEN   ! Neib outside of the MPI domain -> I cannot compute it -> recv it
+                        IF(     mpiRnei(nn_hls,iRdiag) > -1 ) THEN
+                           lrecv_bdyext(ib_bdy,igrd,iRdiag,ir) = .TRUE.   ! Receive directly from diagonal neighbourg
+                        ELSEIF( mpiRnei(nn_hls,iRsono) > -1 .AND. nn_comm == 1 ) THEN
+                           lrecv_bdyext(ib_bdy,igrd,iRsono,ir) = .TRUE.   ! Receive through the South/North neighbourg
+                        ELSE
+                           CALL ctl_stop( 'bdyini recv ext '//cRdir//'-corner ' )
+                        ENDIF
+                     ENDIF
+                  ENDIF
+                  !
+                  ! Check if this rim point corresponds to the corner of one neighbourg. if yes, do we need to send data?
+                  ! Direct send to diag: Is this rim point the corner point of a diag neighbour with which we communicate?
+                  IF( ii == iiSdiag .AND. ij == ijSdiag .AND. mpiSnei(nn_hls,iSdiag) > -1 ) THEN
+                     iiout = ii+iioutdir ; ijout = ij+ijoutdir        ! in which direction do we go outside of the nei MPI domain?
+                     ! take care of neighbourg(s) in the interior of the computational domain
+                     IF(  iibi==iiout .OR. ii1==iiout .OR. ii2==iiout .OR. ii3==iiout .OR.   &   ! Neib outside of diag nei MPI 
+                        & ijbi==ijout .OR. ij1==ijout .OR. ij2==ijout .OR. ij3==ijout )      &   ! domain -> nei cannot compute it
+                        &    lsend_bdyint(ib_bdy,igrd,iSdiag,ir) = .TRUE.                        ! send rim point data to diag nei
+                     ! take care of neighbourg in the exterior of the computational domain
+                     IF(  iibe==iiout .OR. ijbe==ijout )   &                                 
+                        &    lsend_bdyext(ib_bdy,igrd,iSdiag,ir) = .TRUE.
+                  ENDIF
+                  ! Indirect send to diag (through so/no): rim point is the corner point of a so/no nei with which we communicate
+                  IF( ii == iiSsono .AND. ij == ijSsono .AND. mpiSnei(nn_hls,iSsono) > -1 .AND. nn_comm == 1 ) THEN
+                     iiout = ii+iioutdir ; ijout = ij+ijoutdir        ! in which direction do we go outside of the nei MPI domain?
+                     ! take care of neighbourg(s) in the interior of the computational domain
+                     IF(  iibi==iiout .OR. ii1==iiout .OR. ii2==iiout .OR. ii3==iiout .OR.   &   ! Neib outside of so/no nei MPI
+                        & ijbi==ijout .OR. ij1==ijout .OR. ij2==ijout .OR. ij3==ijout )      &   ! domain -> nei cannot compute it
+                        &    lsend_bdyint(ib_bdy,igrd,iSsono,ir) = .TRUE.                        ! send rim point data to so/no nei
+                     ! take care of neighbourg in the exterior of the computational domain
+                     IF(  iibe==iiout .OR. ijbe==ijout)   &
+                        &    lsend_bdyext(ib_bdy,igrd,iSsono,ir) = .TRUE.
+                  ENDIF
+                  !
+               END DO   ! 4 corners
+            END DO   ! ib
+         END DO   ! igrd
+
+!!$         ! Comment out for debug
+!!$         DO ir = 0,1
+!!$            zzbdy(:,:) = narea ; CALL lbc_lnk('bdy debug', zzbdy, 'T', 1._wp, kfillmode = jpfillnothing,   &
+!!$               &                              lsend = lsend_bdyint(ib_bdy,1,:,ir), lrecv = lrecv_bdyint(ib_bdy,1,:,ir) )
+!!$            zzbdy(:,:) = narea ; CALL lbc_lnk('bdy debug', zzbdy, 'U', 1._wp, kfillmode = jpfillnothing,   &
+!!$               &                              lsend = lsend_bdyint(ib_bdy,2,:,ir), lrecv = lrecv_bdyint(ib_bdy,2,:,ir) )
+!!$            zzbdy(:,:) = narea ; CALL lbc_lnk('bdy debug', zzbdy, 'V', 1._wp, kfillmode = jpfillnothing,   &
+!!$               &                              lsend = lsend_bdyint(ib_bdy,3,:,ir), lrecv = lrecv_bdyint(ib_bdy,3,:,ir) )    
+!!$            zzbdy(:,:) = narea ; CALL lbc_lnk('bdy debug', zzbdy, 'T', 1._wp, kfillmode = jpfillnothing,   &
+!!$               &                              lsend = lsend_bdyext(ib_bdy,1,:,ir), lrecv = lrecv_bdyext(ib_bdy,1,:,ir) )
+!!$            zzbdy(:,:) = narea ; CALL lbc_lnk('bdy debug', zzbdy, 'U', 1._wp, kfillmode = jpfillnothing,   &
+!!$               &                              lsend = lsend_bdyext(ib_bdy,2,:,ir), lrecv = lrecv_bdyext(ib_bdy,2,:,ir) )
+!!$            zzbdy(:,:) = narea ; CALL lbc_lnk('bdy debug', zzbdy, 'V', 1._wp, kfillmode = jpfillnothing,   &
+!!$               &                              lsend = lsend_bdyext(ib_bdy,3,:,ir), lrecv = lrecv_bdyext(ib_bdy,3,:,ir) )    
+!!$         END DO
+         
+      END DO   ! ib_bdy
 
       DO ib_bdy = 1,nb_bdy
Index: NEMO/trunk/src/OCE/BDY/bdytra.F90
===================================================================
--- NEMO/trunk/src/OCE/BDY/bdytra.F90	(revision 15345)
+++ NEMO/trunk/src/OCE/BDY/bdytra.F90	(revision 15354)
@@ -55,5 +55,5 @@
       TYPE(ztrabdy), DIMENSION(jpts) :: zdta                   ! Temporary data structure
       LOGICAL                        :: llrim0                 ! indicate if rim 0 is treated
-      LOGICAL, DIMENSION(4)          :: llsend1, llrecv1       ! indicate how communications are to be carried out
+      LOGICAL, DIMENSION(8)          :: llsend1, llrecv1       ! indicate how communications are to be carried out
       !!----------------------------------------------------------------------
       igrd = 1
@@ -96,6 +96,6 @@
                llrecv1(:) = llrecv1(:) .OR. lrecv_bdyint(ib_bdy,1,:,ir)   ! possibly every direction, T points
             CASE('orlanski', 'orlanski_npo')
-               llsend1(:) = llsend1(:) .OR. lsend_bdy(ib_bdy,1,:,ir)   ! possibly every direction, T points
-               llrecv1(:) = llrecv1(:) .OR. lrecv_bdy(ib_bdy,1,:,ir)   ! possibly every direction, T points
+               llsend1(:) = llsend1(:) .OR. lsend_bdyolr(ib_bdy,1,:,ir)   ! possibly every direction, T points
+               llrecv1(:) = llrecv1(:) .OR. lrecv_bdyolr(ib_bdy,1,:,ir)   ! possibly every direction, T points
             END SELECT
          END DO
