Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/dom_oce.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/dom_oce.F90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/dom_oce.F90	(revision 12586)
@@ -114,7 +114,8 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, TARGET, DIMENSION(:,:) ::   e1f   , e2f  , r1_e1f, r1_e2f   !: horizontal scale factors at f-point [m]
    !
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e1e2t , r1_e1e2t                !: associated metrics at t-point
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e1e2u , r1_e1e2u , e2_e1u       !: associated metrics at u-point
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e1e2v , r1_e1e2v , e1_e2v       !: associated metrics at v-point
+   REAL(wp), PUBLIC, POINTER, SAVE            , DIMENSION(:,:) ::   r1_e1e2t, r1_e1e2u, r1_e1e2v    !: associated metrics at t-point
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e1e2t                 !: associated metrics at t-point
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e1e2u , e2_e1u       !: associated metrics at u-point
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e1e2v , e1_e2v       !: associated metrics at v-point
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e1e2f , r1_e1e2f                !: associated metrics at f-point
    !
@@ -136,5 +137,6 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::    e3vw_0   !: vw-vert. scale factor [m]
    !                                                        !  time-dependent scale factors
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   e3t, e3u, e3v, e3w, e3uw, e3vw  !: vert. scale factor [m]
+   REAL(wp), PUBLIC, POINTER, SAVE, DIMENSION(:,:,:,:) ::   e3t, e3u, e3v, e3w  !: vert. scale factor [m]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   e3uw, e3vw  !: vert. scale factor [m]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::   e3f                             !: F-point vert. scale factor [m]
 
@@ -176,9 +178,11 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   tmask_h            !: internal domain T-point mask (Figure 8.5 NEMO book)
 
-   INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   mikt, miku, mikv, mikf  !: top first wet T-, U-, V-, F-level           (ISF)
+   INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   miku, mikv, mikf   !: top first wet U-, V-, F-level           (ISF)
+   REAL(wp), PUBLIC, POINTER, SAVE, DIMENSION(:,:) ::   mikt                   !: top first wet T-level (ISF)
 
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ssmask, ssumask, ssvmask             !: surface mask at T-,U-, V- and F-pts
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:), TARGET :: tmask, umask, vmask, fmask   !: land/ocean mask at T-, U-, V- and F-pts
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:), TARGET :: wmask, wumask, wvmask        !: land/ocean mask at WT-, WU- and WV-pts
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:), TARGET :: fmask   !: land/ocean mask at F-pts
+   REAL(wp), PUBLIC, POINTER, SAVE, DIMENSION(:,:,:) :: tmask, umask, vmask, wmask  !: land/ocean mask at T-, U-, V-pts
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:), TARGET :: wumask, wvmask        !: land/ocean mask at WT-, WU- and WV-pts
 
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   tpol, fpol          !: north fold mask (jperio= 3 or 4)
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/halo_mng.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/halo_mng.F90	(revision 12586)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/halo_mng.F90	(revision 12586)
@@ -0,0 +1,201 @@
+MODULE halo_mng
+   !!======================================================================
+   !!                       ***  MODULE  halo_mng  ***
+   !! Ocean numerics:  massively parallel processing library
+   !!=====================================================================
+   !! History :  OPA  !  1994  (M. Guyon, J. Escobar, M. Imbard)
+   !Original code
+   !!            4.0  !  2019  (CMCC - ASC)  initial version of halo management module
+   !in_out_manager
+   !!----------------------------------------------------------------------
+
+   USE dom_oce       ! ocean space and time domain
+   USE lbclnk        ! ocean lateral boundary condition (or mpp link) 
+
+   IMPLICIT NONE
+   PRIVATE
+
+   INTERFACE halo_mng_resize
+      MODULE PROCEDURE halo_mng_resize_2D, halo_mng_resize_3D, halo_mng_resize_4D, halo_mng_resize_5D
+   END INTERFACE
+
+   PUBLIC halo_mng_resize
+   PUBLIC halo_mng_init
+   PUBLIC halo_mng_set
+
+   INTEGER :: jpi_1, jpj_1
+   INTEGER :: jpimax_1, jpjmax_1
+   INTEGER :: nlci_1, nlcj_1
+   INTEGER :: jplbi_1, jplbj_1
+CONTAINS
+
+   SUBROUTINE halo_mng_init( )
+
+        jpi_1 = jpi
+        jpj_1 = jpj
+
+        nlci_1 = nlci
+        nlcj_1 = nlcj
+
+        jplbi_1 = 1 
+        jplbj_1 = 1 
+        
+        jplbi = 1 
+        jplbj = 1 
+
+   		jpimax_1 = jpimax
+   		jpjmax_1 = jpjmax
+
+   END SUBROUTINE halo_mng_init
+
+   SUBROUTINE halo_mng_set( khls )
+   
+        INTEGER, INTENT(in   )    ::   khls
+
+        nn_hls = khls
+        jpi = jpi_1 + khls -1
+        jpj = jpj_1 + khls -1
+
+        nlci = nlci_1 + khls -1
+        nlcj = nlcj_1 + khls -1
+        
+        jplbi = jplbi_1 - khls +1 
+        jplbj = jplbj_1 - khls +1 
+        
+        jpimax = jpimax_1 + khls -1
+        jpjmax = jpjmax_1 + khls -1
+
+   END SUBROUTINE halo_mng_set
+   
+	SUBROUTINE halo_mng_resize_2D(pta, cdna, psgn, fillval)
+	
+		REAL(wp), POINTER, DIMENSION(:,:) :: pta
+		CHARACTER(len=1), INTENT(in)  :: cdna
+		REAL(wp), INTENT(in)  :: psgn
+		REAL(wp), OPTIONAL, INTENT(in ) :: fillval
+		REAL(wp), POINTER, DIMENSION(:,:) :: zpta
+		INTEGER :: offset
+		INTEGER :: pta_size_i, pta_size_j, exp_size_i, exp_size_j
+
+		pta_size_i = SIZE(pta,1)
+		pta_size_j = SIZE(pta,2)
+		exp_size_i = jpi - jplbi + 1
+		exp_size_j = jpj - jplbj + 1
+		
+		! check if the current size of pta is equal to the current expected dimension
+		IF (pta_size_i .ne. exp_size_i) THEN
+			ALLOCATE (zpta(jplbi:jpi, jplbj:jpj))
+			offset = (exp_size_i - pta_size_i) / 2 
+
+			IF (pta_size_i .lt. exp_size_i) THEN
+				zpta (offset+jplbi : offset+pta_size_i+jplbi-1, offset+jplbj : offset+pta_size_j+jplbj-1) = pta
+			ELSE
+				zpta = pta(jplbi : jpi, jplbj : jpj)
+			END IF
+			CALL lbc_lnk( 'halo_mng_resize_2D', zpta, cdna, psgn, pfillval=fillval)
+			DEALLOCATE(pta)
+			pta => zpta
+		END IF
+		
+	END SUBROUTINE halo_mng_resize_2D
+
+	SUBROUTINE halo_mng_resize_3D(pta, cdna, psgn, fillval)
+	
+		REAL(wp), POINTER, DIMENSION(:,:,:) :: pta
+		CHARACTER(len=1), INTENT(in)  :: cdna
+		REAL(wp), INTENT(in)  :: psgn
+		REAL(wp), OPTIONAL, INTENT(in ) :: fillval
+		REAL(wp), POINTER, DIMENSION(:,:,:) :: zpta
+		INTEGER :: offset
+		INTEGER :: pta_size_i, pta_size_j, exp_size_i, exp_size_j
+
+		pta_size_i = SIZE(pta,1)
+		pta_size_j = SIZE(pta,2)
+		exp_size_i = jpi - jplbi + 1
+		exp_size_j = jpj - jplbj + 1
+		
+		! check if the current size of pta is equal to the current expected dimension
+		IF (pta_size_i .ne. exp_size_i) THEN
+			ALLOCATE (zpta(jplbi:jpi, jplbj:jpj, jpk))
+			offset = (exp_size_i - pta_size_i) / 2 
+
+			IF (pta_size_i .lt. exp_size_i) THEN
+				zpta (offset+jplbi : offset+pta_size_i+jplbi-1, offset+jplbj : offset+pta_size_j+jplbj-1, :) = pta
+			ELSE
+				zpta = pta(jplbi : jpi, jplbj : jpj, :)
+			END IF
+			CALL lbc_lnk( 'halo_mng_resize_3D', zpta, cdna, psgn, pfillval=fillval)
+			DEALLOCATE(pta)
+			pta => zpta
+		END IF
+		
+	END SUBROUTINE halo_mng_resize_3D
+
+	SUBROUTINE halo_mng_resize_4D(pta, cdna, psgn, fillval, fjpt)
+	
+		REAL(wp), POINTER, DIMENSION(:,:,:,:) :: pta
+		CHARACTER(len=1), INTENT(in)  :: cdna
+		REAL(wp), INTENT(in)  :: psgn
+		REAL(wp), OPTIONAL, INTENT(in) :: fillval
+		INTEGER , INTENT(in) ::   fjpt 
+		REAL(wp), POINTER, DIMENSION(:,:,:,:) :: zpta
+		INTEGER :: offset
+		INTEGER :: pta_size_i, pta_size_j, exp_size_i, exp_size_j
+
+		pta_size_i = SIZE(pta,1)
+		pta_size_j = SIZE(pta,2)
+		exp_size_i = jpi - jplbi + 1
+		exp_size_j = jpj - jplbj + 1
+		
+		! check if the current size of pta is equal to the current expected dimension
+		IF (pta_size_i .ne. exp_size_i) THEN
+			ALLOCATE (zpta(jplbi:jpi, jplbj:jpj, jpk, jpt))
+			offset = (exp_size_i - pta_size_i) / 2 
+
+			IF (pta_size_i .lt. exp_size_i) THEN
+				zpta (offset+jplbi : offset+pta_size_i+jplbi-1, offset+jplbj : offset+pta_size_j+jplbj-1, :, :) = pta
+			ELSE
+				zpta = pta(jplbi : jpi, jplbj : jpj, :, :)
+			END IF
+			CALL lbc_lnk( 'halo_mng_resize_4D', zpta(:,:,:,fjpt), cdna, psgn, pfillval=fillval)
+			DEALLOCATE(pta)
+			pta => zpta
+		END IF
+		
+	END SUBROUTINE halo_mng_resize_4D
+	
+	SUBROUTINE halo_mng_resize_5D(pta, cdna, psgn, fillval, kjpt, fjpt)
+	
+		REAL(wp), POINTER, DIMENSION(:,:,:,:,:) :: pta
+		CHARACTER(len=1), INTENT(in)  :: cdna
+		REAL(wp), INTENT(in)  :: psgn
+		REAL(wp), OPTIONAL, INTENT(in) :: fillval
+		INTEGER , OPTIONAL, INTENT(in) :: kjpt            ! number of tracers
+		INTEGER , INTENT(in) :: fjpt            
+		REAL(wp), POINTER, DIMENSION(:,:,:,:,:) :: zpta
+		INTEGER :: offset
+		INTEGER :: pta_size_i, pta_size_j, exp_size_i, exp_size_j
+
+		pta_size_i = SIZE(pta,1)
+		pta_size_j = SIZE(pta,2)
+		exp_size_i = jpi - jplbi + 1
+		exp_size_j = jpj - jplbj + 1
+		
+		! check if the current size of pta is equal to the current expected dimension
+		IF (pta_size_i .ne. exp_size_i) THEN
+			ALLOCATE (zpta(jplbi:jpi, jplbj:jpj, jpk, kjpt, jpt))
+			offset = (exp_size_i - pta_size_i) / 2 
+
+			IF (pta_size_i .lt. exp_size_i) THEN
+				zpta (offset+jplbi : offset+pta_size_i+jplbi-1, offset+jplbj : offset+pta_size_j+jplbj-1, :, :, :) = pta
+			ELSE
+				zpta = pta(jplbi : jpi, jplbj : jpj, :, :, :)
+			END IF
+			CALL lbc_lnk( 'halo_mng_resize_5D', zpta(:,:,:,:,fjpt), cdna, psgn, pfillval=fillval)
+			DEALLOCATE(pta)
+			pta => zpta
+		END IF
+		
+	END SUBROUTINE halo_mng_resize_5D
+	
+END MODULE
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbc_lnk_multi_generic.h90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbc_lnk_multi_generic.h90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbc_lnk_multi_generic.h90	(revision 12586)
@@ -19,5 +19,5 @@
       &                    , pt5, cdna5, psgn5, pt6 , cdna6 , psgn6 , pt7 , cdna7 , psgn7 , pt8, cdna8, psgn8   &
       &                    , pt9, cdna9, psgn9, pt10, cdna10, psgn10, pt11, cdna11, psgn11                      &
-      &                    , kfillmode, pfillval, lsend, lrecv, ihlcom )
+      &                    , kfillmode, pfillval, lsend, lrecv )
       !!---------------------------------------------------------------------
       CHARACTER(len=*)   ,                   INTENT(in   ) :: cdname  ! name of the calling subroutine
@@ -31,5 +31,4 @@
       REAL(wp)           , OPTIONAL        , INTENT(in   ) :: pfillval    ! background value (used at closed boundaries)
       LOGICAL, DIMENSION(4), OPTIONAL      , INTENT(in   ) :: lsend, lrecv   ! indicate how communications are to be carried out
-      INTEGER            , OPTIONAL        , INTENT(in   ) :: ihlcom         ! number of ranks and rows to be communicated
       !!
       INTEGER                          ::   kfld        ! number of elements that will be attributed
@@ -56,5 +55,5 @@
       IF( PRESENT(psgn11) )   CALL ROUTINE_LOAD( pt11, cdna11, psgn11, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
       !
-      CALL lbc_lnk_ptr    ( cdname,               ptab_ptr, cdna_ptr, psgn_ptr, kfld, kfillmode, pfillval, lsend, lrecv, ihlcom )
+      CALL lbc_lnk_ptr    ( cdname,               ptab_ptr, cdna_ptr, psgn_ptr, kfld, kfillmode, pfillval, lsend, lrecv )
       !
    END SUBROUTINE ROUTINE_MULTI
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbc_nfd_nogather_generic.h90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbc_nfd_nogather_generic.h90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbc_nfd_nogather_generic.h90	(revision 12586)
@@ -44,6 +44,6 @@
 #      define L_SIZE(ptab)          SIZE(ptab,4)
 #   endif
-#   define ARRAY2_IN(i,j,k,l,f)  ptab2(i,j,k,l)
 #   define J_SIZE(ptab2)             SIZE(ptab2,2)
+#   define ARRAY2_IN(i,j,k,l,f)   ptab2(i,j,k,l)
 #   define ARRAY_TYPE(i,j,k,l,f)     REAL(wp),INTENT(inout)::ARRAY_IN(i,j,k,l,f)
 #   define ARRAY2_TYPE(i,j,k,l,f)    REAL(wp),INTENT(inout)::ARRAY2_IN(i,j,k,l,f)
@@ -57,13 +57,13 @@
       !!
       !!----------------------------------------------------------------------
-      ARRAY_TYPE(:,:,:,:,:)                             ! array or pointer of arrays on which the boundary condition is applied
-      ARRAY2_TYPE(:,:,:,:,:)                            ! array or pointer of arrays on which the boundary condition is applied
+      ARRAY_TYPE(1-nn_hls+1:,1-nn_hls+1:,:,:,:)
+      ARRAY2_TYPE(1-nn_hls+1:,:,:,:,:) 
       CHARACTER(len=1) , INTENT(in   ) ::   NAT_IN(:)   ! nature of array grid-points
       REAL(wp)         , INTENT(in   ) ::   SGN_IN(:)   ! sign used across the north fold boundary
       INTEGER, OPTIONAL, INTENT(in   ) ::   kfld        ! number of pt3d arrays
       !
-      INTEGER  ::    ji,  jj,   jk,     jl,   jh,  jf   ! dummy loop indices
-      INTEGER  ::   ipi, ipj,  ipk,    ipl,  ipf        ! dimension of the input array
-      INTEGER  ::   ijt, iju, ijpj, ijpjp1, ijta, ijua, jia, startloop, endloop
+      INTEGER  ::    ji,  jj,   jk, jn, ii,   jl,   jh,  jf   ! dummy loop indices
+      INTEGER  ::   ipi, ipj,  ipk,    ipl,  ipf, ijj   ! dimension of the input array
+      INTEGER  ::   ijt, iju, ijta, ijua, jia, startloop, endloop
       LOGICAL  ::   l_fast_exchanges
       !!----------------------------------------------------------------------
@@ -75,8 +75,4 @@
       ! Security check for further developments
       IF ( ipf > 1 ) CALL ctl_stop( 'STOP', 'lbc_nfd_nogather: multiple fields not allowed. Revise implementation...' )
-      !
-      ijpj   = 1    ! index of first modified line 
-      ijpjp1 = 2    ! index + 1
-      
       ! 2nd dimension determines exchange speed
       IF (ipj == 1 ) THEN
@@ -95,25 +91,33 @@
             !
             CASE ( 'T' , 'W' )                         ! T-, W-point
-               IF ( nimpp /= 1 ) THEN   ;   startloop = 1
+               IF ( nimpp - nn_hls+1 /= 1 ) THEN  ;  startloop = 1 - nn_hls + 1
                ELSE                     ;   startloop = 2
                ENDIF
                !
                DO jl = 1, ipl; DO jk = 1, ipk
-                  DO ji = startloop, nlci
-                     ijt = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 4
-                     ARRAY_IN(ji,nlcj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,ijpj,jk,jl,jf)
-                  END DO
-               END DO; END DO
-               IF( nimpp == 1 ) THEN
-                  DO jl = 1, ipl; DO jk = 1, ipk
-                     ARRAY_IN(1,nlcj,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(3,nlcj-2,jk,jl,jf)
-                  END DO; END DO
-               ENDIF
-               !
-               IF ( .NOT. l_fast_exchanges ) THEN
-                  IF( nimpp >= jpiglo/2+1 ) THEN
-                     startloop = 1
-                  ELSEIF( nimpp+nlci-1 >= jpiglo/2+1 .AND. nimpp < jpiglo/2+1 ) THEN
-                     startloop = jpiglo/2+1 - nimpp + 1
+               	  DO jj = 1, nn_hls
+               	  	ijj = nlcj -jj +1
+                  	DO ji = startloop, nlci
+                    	ijt = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 4
+                     	ARRAY_IN(ji,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,jj,jk,jl,jf)
+                    END DO
+                  END DO
+               END DO; END DO
+               IF( nimpp - nn_hls+1 == 1 ) THEN
+                  DO jl = 1, ipl; DO jk = 1, ipk
+                  	DO jj = 1, nn_hls
+               	  		ijj = nlcj -jj +1
+               	  		DO ii = 1, nn_hls
+                     		ARRAY_IN(1-ii+1,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii+2,nlcj-2*nn_hls+jj-1,jk,jl,jf)
+                   		END DO
+                   	END DO
+                  END DO; END DO
+               ENDIF              
+               !
+               IF ( .NOT. l_fast_exchanges ) THEN
+                  IF( nimpp - nn_hls +1 >= jpiglo/2+1 ) THEN
+                     startloop = 1 - nn_hls +1
+                ELSEIF( nimpp+nlci-1 >= jpiglo/2+1 .AND. nimpp - nn_hls +1 < jpiglo/2+1 ) THEN
+                     startloop = jpiglo/2+1 - nimpp + nn_hls
                   ELSE
                      startloop = nlci + 1
@@ -126,7 +130,7 @@
                            ijta = jpiglo - jia + 2
                            IF( ijta >= startloop+nimpp-1 .AND. ijta < jia ) THEN
-                              ARRAY_IN(ji,nlcj-1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ijta-nimpp+1,nlcj-1,jk,jl,jf)
+                              ARRAY_IN(ji,nlcj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ijta-nimpp+1,nlcj-nn_hls,jk,jl,jf)
                            ELSE
-                              ARRAY_IN(ji,nlcj-1,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,ijpjp1,jk,jl,jf)
+                              ARRAY_IN(ji,nlcj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,nn_hls+1,jk,jl,jf)
                            ENDIF
                         END DO
@@ -134,5 +138,163 @@
                   ENDIF
                ENDIF
-
+            CASE ( 'U' )                                     ! U-point
+               IF( nimpp + nlci - nn_hls /= jpiglo ) THEN
+                  endloop = nlci
+               ELSE
+                  endloop = nlci - nn_hls
+               ENDIF
+               DO jl = 1, ipl; DO jk = 1, ipk
+				  DO jj = 1, nn_hls
+               	  	ijj = nlcj -jj +1
+                  	DO ji = 1-nn_hls+1, endloop
+                    	iju = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 3
+                     	ARRAY_IN(ji,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,jj,jk,jl,jf)
+                  	END DO
+                  END DO
+               END DO; END DO
+               IF (nimpp - nn_hls+1 .eq. 1) THEN
+					DO jj = 1, nn_hls
+						ijj = nlcj -jj +1
+						DO ii = 1, nn_hls
+							ARRAY_IN(2-ii,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(ii+1,nlcj-2*nn_hls+jj-1,:,:,jf)
+						END DO
+                  	END DO
+               ENDIF
+               IF((nimpp + nlci - nn_hls) .eq. jpiglo) THEN
+                  	DO jj = 1, nn_hls
+               	  		ijj = nlcj -jj +1
+						DO ii = 1, nn_hls
+							ARRAY_IN(nlci-ii+1,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(nlci-2*nn_hls+ii,nlcj-2*nn_hls+jj-1,:,:,jf)
+						END DO
+					END DO
+               ENDIF
+               !
+               IF ( .NOT. l_fast_exchanges ) THEN
+                  IF( nimpp + nlci - nn_hls /= jpiglo ) THEN
+                     endloop = nlci
+                  ELSE
+                     endloop = nlci - nn_hls
+                  ENDIF
+                  IF( nimpp - nn_hls+1 >= jpiglo/2 ) THEN
+                     startloop = 1- nn_hls + 1
+                     ELSEIF( ( nimpp+nlci-1 >= jpiglo/2 ) .AND. ( nimpp - nn_hls+1 < jpiglo/2 ) ) THEN
+                     startloop = jpiglo/2 - nimpp + nn_hls
+                  ELSE
+                     startloop = endloop + 1
+                  ENDIF
+                  IF( startloop <= endloop ) THEN
+                  DO jl = 1, ipl; DO jk = 1, ipk
+                     DO ji = startloop, endloop
+                        iju = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 3
+                        jia = ji + nimpp - 1
+                        ijua = jpiglo - jia + 1
+                        IF( ijua >= startloop+nimpp-1 .AND. ijua < jia ) THEN
+                           ARRAY_IN(ji,nlcj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ijua-nimpp+1,nlcj-nn_hls,jk,jl,jf)
+                        ELSE
+                           ARRAY_IN(ji,nlcj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,nn_hls+1,jk,jl,jf)
+                        ENDIF
+                     END DO
+                  END DO; END DO
+                  ENDIF
+               ENDIF
+               !
+            CASE ( 'V' )                                     ! V-point
+               IF( nimpp - nn_hls+1 /= 1 ) THEN
+                 startloop = 1 - nn_hls + 1
+               ELSE
+                 startloop = 2
+               ENDIF
+               IF ( .NOT. l_fast_exchanges ) THEN
+                  DO jl = 1, ipl; DO jk = 1, ipk
+               	  	DO jj = 2, nn_hls+1
+               	  		ijj = nlcj -jj +1
+                     	DO ji = startloop, nlci
+                        	ijt=jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 4
+                        	ARRAY_IN(ji,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,jj,jk,jl,jf)
+                     	END DO
+                    END DO
+                  END DO; END DO
+               ENDIF
+               DO jl = 1, ipl; DO jk = 1, ipk
+                  DO ji = startloop, nlci
+                     ijt=jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 4
+                     ARRAY_IN(ji,nlcj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,1,jk,jl,jf)
+                  END DO
+               END DO; END DO
+               IF (nimpp - nn_hls+1.eq. 1) THEN
+					DO jj = 1, nn_hls
+               			ijj = nlcj-jj+1
+               			DO ii = 1, nn_hls
+    	           			ARRAY_IN(1-ii+1,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(ii+2,nlcj-2*nn_hls+jj-1,:,:,jf)
+						END DO
+					END DO
+               ENDIF
+            CASE ( 'F' )                                     ! F-point
+               IF( nimpp + nlci - nn_hls /= jpiglo ) THEN
+                  endloop = nlci
+               ELSE
+                  endloop = nlci - nn_hls
+               ENDIF
+               IF ( .NOT. l_fast_exchanges ) THEN
+                  DO jl = 1, ipl; DO jk = 1, ipk
+               	  	DO jj = 2, nn_hls+1
+               	  		ijj = nlcj -jj +1
+                     	DO ji = 1 - nn_hls +1, endloop
+                        	iju = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 3
+                        	ARRAY_IN(ji,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,jj,jk,jl,jf)
+                     	END DO
+                    END DO
+                  END DO; END DO
+               ENDIF
+               DO jl = 1, ipl; DO jk = 1, ipk
+                  DO ji = 1- nn_hls +1, endloop
+                     iju = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 3
+                     ARRAY_IN(ji,nlcj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,1,jk,jl,jf)
+                  END DO
+               END DO; END DO
+		IF (nimpp - nn_hls+1.eq. 1) THEN               
+			DO ii = 1, nn_hls
+	                	ARRAY_IN(2-ii,nlcj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(ii+1,nlcj-2*nn_hls-1,:,:,jf)
+			END DO
+			IF ( .NOT. l_fast_exchanges ) THEN
+				DO jj = 1, nn_hls
+               				ijj = nlcj -jj
+               				DO ii = 1, nn_hls
+                    			ARRAY_IN(2-ii,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(ii+1,nlcj-2*nn_hls+jj-1,:,:,jf)
+                 	   	   	END DO
+                  		END DO
+               		ENDIF
+		ENDIF
+		IF((nimpp + nlci - nn_hls ) .eq. jpiglo) THEN
+               		DO ii = 1, nn_hls
+	                	ARRAY_IN(nlci-ii+1,nlcj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(nlci-2*nn_hls+ii,nlcj-2*nn_hls-1,:,:,jf)
+			END DO
+			IF ( .NOT. l_fast_exchanges ) THEN
+				DO jj = 1, nn_hls
+               				ijj = nlcj -jj
+	               			DO ii = 1, nn_hls
+                    			ARRAY_IN(nlci-ii+1,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(nlci-2*nn_hls+ii,nlcj-2*nn_hls+jj-1,:,:,jf)
+                    			END DO
+                   		END DO
+               		ENDIF
+               	ENDIF
+               	!
+	    END SELECT
+            !
+         CASE ( 5, 6 )                        ! *  North fold  F-point pivot
+            !
+         	WRITE(*,*) 'extrahalo not handled in this case', __FILE__, __LINE__
+            SELECT CASE ( NAT_IN(jf) )
+            CASE ( 'T' , 'W' )                               ! T-, W-point
+               DO jl = 1, ipl; DO jk = 1, ipk
+				  DO jj = 1, nn_hls
+               		 ijj = nlcj -jj+1
+                  DO ji = 1, nlci
+                     ijt = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 3
+                     ARRAY_IN(ji,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,jj,jk,jl,jf)
+                  END DO
+				  END DO
+               END DO; END DO
+               !
             CASE ( 'U' )                                     ! U-point
                IF( nimpp + nlci - 1 /= jpiglo ) THEN
@@ -143,134 +305,19 @@
                DO jl = 1, ipl; DO jk = 1, ipk
                   DO ji = 1, endloop
-                     iju = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 3
-                     ARRAY_IN(ji,nlcj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,ijpj,jk,jl,jf)
-                  END DO
-               END DO; END DO
-               IF (nimpp .eq. 1) THEN
-                  ARRAY_IN(1,nlcj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(2,nlcj-2,:,:,jf)
-               ENDIF
+                     iju = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 2
+                     ARRAY_IN(ji,nlcj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,ijpj-1,jk,jl,jf)
+                  END DO
+               END DO; END DO
                IF((nimpp + nlci - 1) .eq. jpiglo) THEN
-                  ARRAY_IN(nlci,nlcj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(nlci-1,nlcj-2,:,:,jf)
-               ENDIF
-               !
-               IF ( .NOT. l_fast_exchanges ) THEN
-                  IF( nimpp + nlci - 1 /= jpiglo ) THEN
-                     endloop = nlci
-                  ELSE
-                     endloop = nlci - 1
-                  ENDIF
-                  IF( nimpp >= jpiglo/2 ) THEN
-                     startloop = 1
-                     ELSEIF( ( nimpp+nlci-1 >= jpiglo/2 ) .AND. ( nimpp < jpiglo/2 ) ) THEN
-                     startloop = jpiglo/2 - nimpp + 1
-                  ELSE
-                     startloop = endloop + 1
-                  ENDIF
-                  IF( startloop <= endloop ) THEN
-                  DO jl = 1, ipl; DO jk = 1, ipk
-                     DO ji = startloop, endloop
-                        iju = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 3
-                        jia = ji + nimpp - 1
-                        ijua = jpiglo - jia + 1
-                        IF( ijua >= startloop+nimpp-1 .AND. ijua < jia ) THEN
-                           ARRAY_IN(ji,nlcj-1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ijua-nimpp+1,nlcj-1,jk,jl,jf)
-                        ELSE
-                           ARRAY_IN(ji,nlcj-1,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,ijpjp1,jk,jl,jf)
-                        ENDIF
-                     END DO
-                  END DO; END DO
-                  ENDIF
+                  DO jl = 1, ipl; DO jk = 1, ipk
+                     ARRAY_IN(nlci,nlcj,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(nlci-2,nlcj-1,jk,jl,jf)
+                  END DO; END DO
                ENDIF
                !
             CASE ( 'V' )                                     ! V-point
-               IF( nimpp /= 1 ) THEN
-                 startloop = 1
-               ELSE
-                 startloop = 2
-               ENDIF
-               IF ( .NOT. l_fast_exchanges ) THEN
-                  DO jl = 1, ipl; DO jk = 1, ipk
-                     DO ji = startloop, nlci
-                        ijt=jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 4
-                        ARRAY_IN(ji,nlcj-1,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,ijpjp1,jk,jl,jf)
-                     END DO
-                  END DO; END DO
-               ENDIF
-               DO jl = 1, ipl; DO jk = 1, ipk
-                  DO ji = startloop, nlci
-                     ijt=jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 4
-                     ARRAY_IN(ji,nlcj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,ijpj,jk,jl,jf)
-                  END DO
-               END DO; END DO
-               IF (nimpp .eq. 1) THEN
-                  ARRAY_IN(1,nlcj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(3,nlcj-3,:,:,jf)
-               ENDIF
-            CASE ( 'F' )                                     ! F-point
-               IF( nimpp + nlci - 1 /= jpiglo ) THEN
-                  endloop = nlci
-               ELSE
-                  endloop = nlci - 1
-               ENDIF
-               IF ( .NOT. l_fast_exchanges ) THEN
-                  DO jl = 1, ipl; DO jk = 1, ipk
-                     DO ji = 1, endloop
-                        iju = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 3
-                        ARRAY_IN(ji,nlcj-1,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,ijpjp1,jk,jl,jf)
-                     END DO
-                  END DO; END DO
-               ENDIF
-               DO jl = 1, ipl; DO jk = 1, ipk
-                  DO ji = 1, endloop
-                     iju = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 3
-                     ARRAY_IN(ji,nlcj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,ijpj,jk,jl,jf)
-                  END DO
-               END DO; END DO
-               IF (nimpp .eq. 1) THEN
-                  ARRAY_IN(1,nlcj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(2,nlcj-3,:,:,jf)
-                  IF ( .NOT. l_fast_exchanges ) &
-                     ARRAY_IN(1,nlcj-1,:,:,jf) = SGN_IN(jf) * ARRAY_IN(2,nlcj-2,:,:,jf)
-               ENDIF
-               IF((nimpp + nlci - 1) .eq. jpiglo) THEN
-                  ARRAY_IN(nlci,nlcj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(nlci-1,nlcj-3,:,:,jf)
-                  IF ( .NOT. l_fast_exchanges ) &
-                     ARRAY_IN(nlci,nlcj-1,:,:,jf) = SGN_IN(jf) * ARRAY_IN(nlci-1,nlcj-2,:,:,jf)
-               ENDIF
-               !
-            END SELECT
-            !
-         CASE ( 5, 6 )                        ! *  North fold  F-point pivot
-            !
-            SELECT CASE ( NAT_IN(jf) )
-            CASE ( 'T' , 'W' )                               ! T-, W-point
                DO jl = 1, ipl; DO jk = 1, ipk
                   DO ji = 1, nlci
                      ijt = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 3
-                     ARRAY_IN(ji,nlcj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,ijpj,jk,jl,jf)
-                  END DO
-               END DO; END DO
-               !
-            CASE ( 'U' )                                     ! U-point
-               IF( nimpp + nlci - 1 /= jpiglo ) THEN
-                  endloop = nlci
-               ELSE
-                  endloop = nlci - 1
-               ENDIF
-               DO jl = 1, ipl; DO jk = 1, ipk
-                  DO ji = 1, endloop
-                     iju = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 2
-                     ARRAY_IN(ji,nlcj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,ijpj,jk,jl,jf)
-                  END DO
-               END DO; END DO
-               IF((nimpp + nlci - 1) .eq. jpiglo) THEN
-                  DO jl = 1, ipl; DO jk = 1, ipk
-                     ARRAY_IN(nlci,nlcj,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(nlci-2,nlcj-1,jk,jl,jf)
-                  END DO; END DO
-               ENDIF
-               !
-            CASE ( 'V' )                                     ! V-point
-               DO jl = 1, ipl; DO jk = 1, ipk
-                  DO ji = 1, nlci
-                     ijt = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 3
-                     ARRAY_IN(ji,nlcj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,ijpj,jk,jl,jf)
+                     ARRAY_IN(ji,nlcj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,ijpj-1,jk,jl,jf)
                   END DO
                END DO; END DO
@@ -288,5 +335,5 @@
                      DO ji = startloop, nlci
                         ijt = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 3
-                        ARRAY_IN(ji,nlcj-1,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,ijpjp1,jk,jl,jf)
+                        ARRAY_IN(ji,nlcj-1,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,ijpj,jk,jl,jf)
                      END DO
                   END DO; END DO
@@ -303,5 +350,5 @@
                   DO ji = 1, endloop
                      iju = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 2
-                     ARRAY_IN(ji,nlcj ,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,ijpj,jk,jl,jf)
+                     ARRAY_IN(ji,nlcj ,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,ijpj-1,jk,jl,jf)
                   END DO
                END DO; END DO
@@ -329,5 +376,5 @@
                         DO ji = startloop, endloop
                            iju = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 2
-                           ARRAY_IN(ji,nlcj-1,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,ijpjp1,jk,jl,jf)
+                           ARRAY_IN(ji,nlcj-1,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,ijpj,jk,jl,jf)
                         END DO
                      END DO; END DO
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbcnfd.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbcnfd.F90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbcnfd.F90	(revision 12586)
@@ -53,6 +53,7 @@
 
    INTEGER, PUBLIC, PARAMETER            ::   jpmaxngh = 3               !:
-   INTEGER, PUBLIC                       ::   nsndto, nfsloop, nfeloop   !:
+   INTEGER, PUBLIC                       ::   nsndto                     !:
    INTEGER, PUBLIC, DIMENSION (jpmaxngh) ::   isendto                    !: processes to which communicate
+   INTEGER, PUBLIC                       ::   ijpj
 
    !!----------------------------------------------------------------------
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mpp_lnk_generic.h90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mpp_lnk_generic.h90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mpp_lnk_generic.h90	(revision 12586)
@@ -46,10 +46,10 @@
 
 #if defined MULTI
-   SUBROUTINE ROUTINE_LNK( cdname, ptab, cd_nat, psgn, kfld, kfillmode, pfillval, lsend, lrecv, ihlcom )
+   SUBROUTINE ROUTINE_LNK( cdname, ptab, cd_nat, psgn, kfld, kfillmode, pfillval, lsend, lrecv )
       INTEGER             , INTENT(in   ) ::   kfld        ! number of pt3d arrays
 #else
-   SUBROUTINE ROUTINE_LNK( cdname, ptab, cd_nat, psgn      , kfillmode, pfillval, lsend, lrecv, ihlcom )
+   SUBROUTINE ROUTINE_LNK( cdname, ptab, cd_nat, psgn      , kfillmode, pfillval, lsend, lrecv )
 #endif
-      ARRAY_TYPE(:,:,:,:,:)                                        ! array or pointer of arrays on which the boundary condition is applied
+      ARRAY_TYPE(1-nn_hls+1:,1-nn_hls+1:,:,:,:)                                        ! array or pointer of arrays on which the boundary condition is applied
       CHARACTER(len=*)              , INTENT(in   ) ::   cdname      ! name of the calling subroutine
       CHARACTER(len=1)              , INTENT(in   ) ::   NAT_IN(:)   ! nature of array grid-points
@@ -58,5 +58,4 @@
       REAL(wp),             OPTIONAL, INTENT(in   ) ::   pfillval    ! background value (used at closed boundaries)
       LOGICAL, DIMENSION(4),OPTIONAL, INTENT(in   ) ::   lsend, lrecv  ! communication with other 4 proc
-      INTEGER              ,OPTIONAL, INTENT(in   ) ::   ihlcom        ! number of ranks and rows to be communicated
       !
       INTEGER  ::    ji,  jj,  jk,  jl,  jf      ! dummy loop indices
@@ -66,5 +65,4 @@
       INTEGER  ::   ierr
       INTEGER  ::   ifill_we, ifill_ea, ifill_so, ifill_no
-      INTEGER  ::   ihl                          ! number of ranks and rows to be communicated 
       REAL(wp) ::   zland
       INTEGER , DIMENSION(MPI_STATUS_SIZE)        ::   istat          ! for mpi_isend
@@ -83,8 +81,4 @@
       ipl = L_SIZE(ptab)   ! 4th    -
       ipf = F_SIZE(ptab)   ! 5th    -      use in "multi" case (array of pointers)
-      !
-      IF( PRESENT(ihlcom) ) THEN   ;   ihl = ihlcom
-      ELSE                         ;   ihl = 1
-      END IF
       !
       IF( narea == 1 .AND. numcom == -1 ) CALL mpp_report( cdname, ipk, ipl, ipf, ld_lbc = .TRUE. )
@@ -148,24 +142,25 @@
       ! -------------------------------------------------- !
       !
+
       ! Must exchange the whole column (from 1 to jpj) to get the corners if we have no south/north neighbourg
-      isize = ihl * jpj * ipk * ipl * ipf      
+      isize = nn_hls * ( jpj + nn_hls - 1 ) * ipk * ipl * ipf      
       !
       ! Allocate local temporary arrays to be sent/received. Fill arrays to be sent
-      IF( llsend_we )   ALLOCATE( zsnd_we(ihl,jpj,ipk,ipl,ipf) )
-      IF( llsend_ea )   ALLOCATE( zsnd_ea(ihl,jpj,ipk,ipl,ipf) )
-      IF( llrecv_we )   ALLOCATE( zrcv_we(ihl,jpj,ipk,ipl,ipf) )
-      IF( llrecv_ea )   ALLOCATE( zrcv_ea(ihl,jpj,ipk,ipl,ipf) )
+      IF( llsend_we )   ALLOCATE( zsnd_we(nn_hls,1-nn_hls+1:jpj,ipk,ipl,ipf) )
+      IF( llsend_ea )   ALLOCATE( zsnd_ea(nn_hls,1-nn_hls+1:jpj,ipk,ipl,ipf) )
+      IF( llrecv_we )   ALLOCATE( zrcv_we(nn_hls,1-nn_hls+1:jpj,ipk,ipl,ipf) )
+      IF( llrecv_ea )   ALLOCATE( zrcv_ea(nn_hls,1-nn_hls+1:jpj,ipk,ipl,ipf) )
       !
       IF( llsend_we ) THEN   ! copy western side of the inner mpi domain in local temporary array to be sent by MPI
-         ishift = ihl
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, ihl
-            zsnd_we(ji,jj,jk,jl,jf) = ARRAY_IN(ishift+ji,jj,jk,jl,jf)   ! ihl + 1 -> 2*ihl
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      ENDIF
-      !
-      IF(llsend_ea  ) THEN   ! copy eastern side of the inner mpi domain in local temporary array to be sent by MPI
-         ishift = jpi - 2 * ihl
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, ihl
-            zsnd_ea(ji,jj,jk,jl,jf) = ARRAY_IN(ishift+ji,jj,jk,jl,jf)   ! jpi - 2*ihl + 1 -> jpi - ihl
+         ishift = 1
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1-nn_hls+1, jpj   ;   DO ji = 1, nn_hls
+            zsnd_we(ji,jj,jk,jl,jf) = ARRAY_IN(ishift+ji,jj,jk,jl,jf)   ! nn_hls + 1 -> 2*nn_hls
+         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+      ENDIF
+      !
+      IF( llsend_ea ) THEN   ! copy eastern side of the inner mpi domain in local temporary array to be sent by MPI
+         ishift = jpi -  2 * nn_hls
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1-nn_hls+1, jpj   ;   DO ji = 1, nn_hls
+            zsnd_ea(ji,jj,jk,jl,jf) = ARRAY_IN(ishift+ji,jj,jk,jl,jf)   ! jpi - 2*nn_hls + 1 -> jpi - nn_hls
          END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       ENDIF
@@ -174,9 +169,9 @@
       !
       ! non-blocking send of the western/eastern side using local temporary arrays
-      IF( llsend_we )   CALL mppsend( 1, zsnd_we(1,1,1,1,1), isize, nowe, ireq_we )
-      IF( llsend_ea )   CALL mppsend( 2, zsnd_ea(1,1,1,1,1), isize, noea, ireq_ea )
+      IF( llsend_we )   CALL mppsend( 1, zsnd_we(1,1-nn_hls+1,1,1,1), isize, nowe, ireq_we )
+      IF( llsend_ea )   CALL mppsend( 2, zsnd_ea(1,1-nn_hls+1,1,1,1), isize, noea, ireq_ea )
       ! blocking receive of the western/eastern halo in local temporary arrays
-      IF( llrecv_we )   CALL mpprecv( 2, zrcv_we(1,1,1,1,1), isize, nowe )
-      IF( llrecv_ea )   CALL mpprecv( 1, zrcv_ea(1,1,1,1,1), isize, noea )
+      IF( llrecv_we )   CALL mpprecv( 2, zrcv_we(1,1-nn_hls+1,1,1,1), isize, nowe )
+      IF( llrecv_ea )   CALL mpprecv( 1, zrcv_ea(1,1-nn_hls+1,1,1,1), isize, noea )
       !
       IF( ln_timing ) CALL tic_tac(.FALSE.)
@@ -189,21 +184,21 @@
       ! 2.1 fill weastern halo
       ! ----------------------
-      ! ishift = 0                         ! fill halo from ji = 1 to ihl
+      ! ishift = 0                         ! fill halo from ji = 1 to nn_hls
       SELECT CASE ( ifill_we )
       CASE ( jpfillnothing )               ! no filling 
       CASE ( jpfillmpi   )                 ! use data received by MPI 
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, ihl
-            ARRAY_IN(ji,jj,jk,jl,jf) = zrcv_we(ji,jj,jk,jl,jf)   ! 1 -> ihl
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1-nn_hls+1, jpj   ;   DO ji = 1, nn_hls
+            ARRAY_IN(ji-nn_hls+1,jj,jk,jl,jf) = zrcv_we(ji,jj,jk,jl,jf)   ! 1 -> nn_hls
          END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillperio )                 ! use east-weast periodicity
-         ishift2 = jpi - 2 * ihl
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, ihl
-            ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
+         ishift2 = jpi - 2 * nn_hls
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1-nn_hls+1, jpj   ;   DO ji = 1, nn_hls
+            ARRAY_IN(ji-nn_hls+1,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
          END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillcopy  )                 ! filling with inner domain values
          DO jf = 1, ipf                               ! number of arrays to be treated
             IF( .NOT. NAT_IN(jf) == 'F' ) THEN        ! do nothing for F point
-               DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, ihl
-                  ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ihl+1,jj,jk,jl,jf)
+               DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1-nn_hls+1, jpj   ;   DO ji = 1, nn_hls
+                  ARRAY_IN(ji-nn_hls+1,jj,jk,jl,jf) = ARRAY_IN(1+ji,jj,jk,jl,jf)
                END DO   ;   END DO   ;   END DO   ;   END DO
             ENDIF
@@ -212,6 +207,6 @@
          DO jf = 1, ipf                               ! number of arrays to be treated
             IF( .NOT. NAT_IN(jf) == 'F' ) THEN        ! do nothing for F point
-               DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, ihl
-                  ARRAY_IN(ji,jj,jk,jl,jf) = zland
+               DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1-nn_hls+1, jpj   ;   DO ji = 1, nn_hls
+                  ARRAY_IN(ji-nn_hls+1,jj,jk,jl,jf) = zland
                END DO;   END DO   ;   END DO   ;   END DO
             ENDIF
@@ -221,22 +216,23 @@
       ! 2.2 fill eastern halo
       ! ---------------------
-      ishift = jpi - ihl                ! fill halo from ji = jpi-ihl+1 to jpi 
+      ishift = jpi - nn_hls                ! fill halo from ji = jpi-nn_hls+1 to jpi 
       SELECT CASE ( ifill_ea )
       CASE ( jpfillnothing )               ! no filling 
       CASE ( jpfillmpi   )                 ! use data received by MPI 
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, ihl
-            ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zrcv_ea(ji,jj,jk,jl,jf)   ! jpi - ihl + 1 -> jpi
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1-nn_hls+1, jpj   ;   DO ji = 1, nn_hls
+            ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zrcv_ea(ji,jj,jk,jl,jf)   ! jpi - nn_hls + 1 -> jpi
          END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillperio )                 ! use east-weast periodicity
-         ishift2 = ihl
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, ihl
+         ishift2 = 1
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1-nn_hls+1, jpj   ;   DO ji = 1, nn_hls
             ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
          END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillcopy  )                 ! filling with inner domain values
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, ihl
-            ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift,jj,jk,jl,jf)
+		 ishift2 = jpi - 2*nn_hls
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1-nn_hls+1, jpj   ;   DO ji = 1, nn_hls
+            ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
          END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillcst   )                 ! filling with constant value
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, ihl
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1-nn_hls+1, jpj   ;   DO ji = 1, nn_hls
             ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zland
          END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
@@ -264,23 +260,23 @@
       ! ---------------------------------------------------- !
       !
-      IF( llsend_so )   ALLOCATE( zsnd_so(jpi,ihl,ipk,ipl,ipf) )
-      IF( llsend_no )   ALLOCATE( zsnd_no(jpi,ihl,ipk,ipl,ipf) )
-      IF( llrecv_so )   ALLOCATE( zrcv_so(jpi,ihl,ipk,ipl,ipf) )
-      IF( llrecv_no )   ALLOCATE( zrcv_no(jpi,ihl,ipk,ipl,ipf) )
-      !
-      isize = jpi * ihl * ipk * ipl * ipf      
+      IF( llsend_so )   ALLOCATE( zsnd_so(1-nn_hls+1:jpi,nn_hls,ipk,ipl,ipf) )
+      IF( llsend_no )   ALLOCATE( zsnd_no(1-nn_hls+1:jpi,nn_hls,ipk,ipl,ipf) )
+      IF( llrecv_so )   ALLOCATE( zrcv_so(1-nn_hls+1:jpi,nn_hls,ipk,ipl,ipf) )
+      IF( llrecv_no )   ALLOCATE( zrcv_no(1-nn_hls+1:jpi,nn_hls,ipk,ipl,ipf) )
+      !
+      isize = ( jpi + nn_hls - 1 ) * nn_hls * ipk * ipl * ipf      
 
       ! allocate local temporary arrays to be sent/received. Fill arrays to be sent
       IF( llsend_so ) THEN   ! copy sourhern side of the inner mpi domain in local temporary array to be sent by MPI
-         ishift = ihl
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, ihl   ;   DO ji = 1, jpi
-            zsnd_so(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift+jj,jk,jl,jf)   ! ihl+1 -> 2*ihl
+         ishift = 1
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1-nn_hls+1, jpi
+            zsnd_so(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift+jj,jk,jl,jf)   ! nn_hls+1 -> 2*nn_hls
          END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       ENDIF
       !
       IF( llsend_no ) THEN   ! copy eastern side of the inner mpi domain in local temporary array to be sent by MPI
-         ishift = jpj - 2 * ihl
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, ihl   ;   DO ji = 1, jpi
-            zsnd_no(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift+jj,jk,jl,jf)   ! jpj-2*ihl+1 -> jpj-ihl
+         ishift = jpj - 2 * nn_hls
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1-nn_hls+1, jpi
+            zsnd_no(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift+jj,jk,jl,jf)   ! jpj-2*nn_hls+1 -> jpj-nn_hls
          END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       ENDIF
@@ -289,9 +285,9 @@
       !
       ! non-blocking send of the southern/northern side
-      IF( llsend_so )   CALL mppsend( 3, zsnd_so(1,1,1,1,1), isize, noso, ireq_so )
-      IF( llsend_no )   CALL mppsend( 4, zsnd_no(1,1,1,1,1), isize, nono, ireq_no )
+      IF( llsend_so )   CALL mppsend( 3, zsnd_so(1-nn_hls+1,1,1,1,1), isize, noso, ireq_so )
+      IF( llsend_no )   CALL mppsend( 4, zsnd_no(1-nn_hls+1,1,1,1,1), isize, nono, ireq_no )
       ! blocking receive of the southern/northern halo
-      IF( llrecv_so )   CALL mpprecv( 4, zrcv_so(1,1,1,1,1), isize, noso )
-      IF( llrecv_no )   CALL mpprecv( 3, zrcv_no(1,1,1,1,1), isize, nono )
+      IF( llrecv_so )   CALL mpprecv( 4, zrcv_so(1-nn_hls+1,1,1,1,1), isize, noso )
+      IF( llrecv_no )   CALL mpprecv( 3, zrcv_no(1-nn_hls+1,1,1,1,1), isize, nono )
       !
       IF( ln_timing ) CALL tic_tac(.FALSE.)
@@ -303,21 +299,21 @@
       ! 5.1 fill southern halo
       ! ----------------------
-      ! ishift = 0                         ! fill halo from jj = 1 to ihl
+      ! ishift = 0                         ! fill halo from jj = 1 to nn_hls
       SELECT CASE ( ifill_so )
       CASE ( jpfillnothing )               ! no filling 
       CASE ( jpfillmpi   )                 ! use data received by MPI 
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, ihl   ;   DO ji = 1, jpi
-            ARRAY_IN(ji,jj,jk,jl,jf) = zrcv_so(ji,jj,jk,jl,jf)   ! 1 -> ihl
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1-nn_hls+1, jpi
+            ARRAY_IN(ji,jj-nn_hls+1,jk,jl,jf) = zrcv_so(ji,jj,jk,jl,jf)   ! 1 -> nn_hls
          END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillperio )                 ! use north-south periodicity
-         ishift2 = jpj - 2 * ihl
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, ihl   ;   DO ji = 1, jpi
-            ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf)
+         ishift2 = jpj - 2 * nn_hls
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1-nn_hls+1, jpi
+            ARRAY_IN(ji,jj-nn_hls+1,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf)
          END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillcopy  )                 ! filling with inner domain values
          DO jf = 1, ipf                               ! number of arrays to be treated
             IF( .NOT. NAT_IN(jf) == 'F' ) THEN        ! do nothing for F point
-               DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, ihl   ;   DO ji = 1, jpi
-                  ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ihl+1,jk,jl,jf)
+               DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1-nn_hls+1, jpi
+                  ARRAY_IN(ji,jj-nn_hls+1,jk,jl,jf) = ARRAY_IN(ji,1+jj,jk,jl,jf)
                END DO   ;   END DO   ;   END DO   ;   END DO
             ENDIF
@@ -326,6 +322,6 @@
          DO jf = 1, ipf                               ! number of arrays to be treated
             IF( .NOT. NAT_IN(jf) == 'F' ) THEN        ! do nothing for F point
-               DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, ihl   ;   DO ji = 1, jpi 
-                  ARRAY_IN(ji,jj,jk,jl,jf) = zland
+               DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1-nn_hls+1, jpi 
+                  ARRAY_IN(ji,jj-nn_hls+1,jk,jl,jf) = zland
                END DO;   END DO   ;   END DO   ;   END DO
             ENDIF
@@ -335,22 +331,23 @@
       ! 5.2 fill northern halo
       ! ----------------------
-      ishift = jpj - ihl                ! fill halo from jj = jpj-ihl+1 to jpj 
+      ishift = jpj - nn_hls                ! fill halo from jj = jpj-nn_hls+1 to jpj 
       SELECT CASE ( ifill_no )
       CASE ( jpfillnothing )               ! no filling 
       CASE ( jpfillmpi   )                 ! use data received by MPI 
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, ihl   ;   DO ji = 1, jpi
-            ARRAY_IN(ji,ishift+jj,jk,jl,jf) = zrcv_no(ji,jj,jk,jl,jf)   ! jpj-ihl+1 -> jpj
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1-nn_hls+1, jpi
+            ARRAY_IN(ji,ishift+jj,jk,jl,jf) = zrcv_no(ji,jj,jk,jl,jf)   ! jpj-nn_hls+1 -> jpj
          END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillperio )                 ! use north-south periodicity
-         ishift2 = ihl
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, ihl   ;   DO ji = 1, jpi
+         ishift2 = 1
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1-nn_hls+1, jpi
             ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf)
          END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillcopy  )                 ! filling with inner domain values
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, ihl   ;   DO ji = 1, jpi
-            ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift,jk,jl,jf)
+      	 ishift2 = jpj - 2*nn_hls
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1-nn_hls+1, jpi
+            ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf)
          END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillcst   )                 ! filling with constant value
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, ihl   ;   DO ji = 1, jpi
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1-nn_hls+1, jpi
             ARRAY_IN(ji,ishift+jj,jk,jl,jf) = zland
          END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mpp_nfd_generic.h90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mpp_nfd_generic.h90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mpp_nfd_generic.h90	(revision 12586)
@@ -48,5 +48,5 @@
    SUBROUTINE ROUTINE_NFD( ptab, cd_nat, psgn, kfld )
       !!----------------------------------------------------------------------
-      ARRAY_TYPE(:,:,:,:,:)   ! array or pointer of arrays on which the boundary condition is applied
+      ARRAY_TYPE(1-nn_hls+1:,1-nn_hls+1:,:,:,:)   ! array or pointer of arrays on which the boundary condition is applied
       CHARACTER(len=1) , INTENT(in   ) ::   NAT_IN(:)   ! nature of array grid-points
       REAL(wp)         , INTENT(in   ) ::   SGN_IN(:)   ! sign used across the north fold boundary
@@ -54,5 +54,5 @@
       !
       INTEGER  ::   ji,  jj,  jk,  jl, jh, jf, jr   ! dummy loop indices
-      INTEGER  ::   ipi, ipj, ipk, ipl, ipf         ! dimension of the input array
+      INTEGER  ::   ipi, ipk, ipl, ipf         ! dimension of the input array
       INTEGER  ::   imigr, iihom, ijhom             ! local integers
       INTEGER  ::   ierr, ibuffsize, ilci, ildi, ilei, iilb
@@ -80,9 +80,9 @@
          ALLOCATE(ipj_s(ipf))
 
-         ipj      = 2            ! Max 2nd dimension of message transfers (last two j-line only)
-         ipj_s(:) = 1            ! Real 2nd dimension of message transfers (depending on perf requirement)
+         ijpj      = 2 + nn_hls - 1           ! Max 2nd dimension of message transfers (last two j-line only)
+         ipj_s(:) = 1 + nn_hls - 1           ! Real 2nd dimension of message transfers (depending on perf requirement)
                                  ! by default, only one line is exchanged
 
-         ALLOCATE( jj_s(ipf,2) )
+         ALLOCATE( jj_s(ipf,ijpj) )
 
          ! re-define number of exchanged lines :
@@ -98,5 +98,5 @@
          IF ( l_full_nf_update .OR.                          &    ! if coupling fields
               ( ncom_stp == nit000 .AND. .NOT. ln_rstart ) ) &    ! at first time step, if not restart
-            ipj_s(:) = 2
+            ipj_s(:) = 2 + nn_hls - 1 
 
          ! Index of modifying lines in input
@@ -110,7 +110,11 @@
                !
                CASE ( 'T' , 'W' ,'U' )                            ! T-, U-, W-point
-                  jj_s(jf,1) = nlcj - 2 ;  jj_s(jf,2) = nlcj - 1
+   	            	DO ji = 1, nn_hls+1
+						jj_s(jf,ji) = nlcj - 2*nn_hls +ji -1
+					ENDDO
                CASE ( 'V' , 'F' )                                 ! V-, F-point
-                  jj_s(jf,1) = nlcj - 3 ;  jj_s(jf,2) = nlcj - 2
+					DO ji = 1, nn_hls+1
+						jj_s(jf,ji) = nlcj - 2*nn_hls +ji - 2
+					ENDDO
                END SELECT
             !
@@ -119,8 +123,12 @@
                !
                CASE ( 'T' , 'W' ,'U' )                            ! T-, U-, W-point
-                  jj_s(jf,1) = nlcj - 1      
-                  ipj_s(jf) = 1                  ! need only one line anyway
+					DO ji = 1, nn_hls
+						jj_s(jf,ji) = nlcj - 2*nn_hls + ji     
+					ENDDO
+					ipj_s(jf) = nn_hls                  ! need only one line anyway
                CASE ( 'V' , 'F' )                                 ! V-, F-point
-                  jj_s(jf,1) = nlcj - 2 ;  jj_s(jf,2) = nlcj - 1
+					DO ji = 1, nn_hls+1
+						jj_s(jf,ji) = nlcj - 2*nn_hls +ji -1
+					ENDDO
                END SELECT
             !
@@ -131,5 +139,5 @@
          ipf_j = sum (ipj_s(:))      ! Total number of lines to be exchanged
          !
-         ALLOCATE( znorthloc(jpimax,ipf_j,ipk,ipl,1) )
+         ALLOCATE( znorthloc(1-nn_hls+1:jpimax,ipf_j,ipk,ipl,1) )
          !
          js = 0
@@ -139,5 +147,5 @@
                DO jl = 1, ipl
                   DO jk = 1, ipk
-                     znorthloc(1:jpi,js,jk,jl,1) = ARRAY_IN(1:jpi,jj_s(jf,jj),jk,jl,jf)
+                     znorthloc(1-nn_hls+1:jpi,js,jk,jl,1) = ARRAY_IN(1-nn_hls+1:jpi,jj_s(jf,jj),jk,jl,jf)
                   END DO
                END DO
@@ -145,8 +153,8 @@
          END DO
          !
-         ibuffsize = jpimax * ipf_j * ipk * ipl
-         !
-         ALLOCATE( zfoldwk(jpimax,ipf_j,ipk,ipl,1) )
-         ALLOCATE( ztabr(jpimax*jpmaxngh,ipj,ipk,ipl,ipf) ) 
+         ibuffsize = (jpimax + nn_hls -1) * ipf_j * ipk * ipl
+         !
+         ALLOCATE( zfoldwk(1-nn_hls+1:jpimax,ipf_j,ipk,ipl,1) )
+         ALLOCATE( ztabr(1-nn_hls+1:(jpi+nn_hls-1)*jpmaxngh-nn_hls+1,ijpj,ipk,ipl,ipf) ) 
          ! when some processors of the north fold are suppressed, 
          ! values of ztab* arrays corresponding to these suppressed domain won't be defined 
@@ -218,13 +226,13 @@
       ELSE                             !==  allgather exchanges  ==!
          !
-         ipj   = 4            ! 2nd dimension of message transfers (last j-lines)
-         !
-         ALLOCATE( znorthloc(jpimax,ipj,ipk,ipl,ipf) )
-         !
-         DO jf = 1, ipf                ! put in znorthloc the last ipj j-lines of ptab
+         ijpj   = 4            ! 2nd dimension of message transfers (last j-lines)
+         !
+         ALLOCATE( znorthloc(jpimax,ijpj,ipk,ipl,ipf) )
+         !
+         DO jf = 1, ipf                ! put in znorthloc the last ijpj j-lines of ptab
             DO jl = 1, ipl
                DO jk = 1, ipk
-                  DO jj = nlcj - ipj +1, nlcj
-                     ij = jj - nlcj + ipj
+                  DO jj = nlcj - ijpj +1, nlcj
+                     ij = jj - nlcj + ijpj
                      znorthloc(1:jpi,ij,jk,jl,jf) = ARRAY_IN(1:jpi,jj,jk,jl,jf)
                   END DO
@@ -233,8 +241,8 @@
          END DO
          !
-         ibuffsize = jpimax * ipj * ipk * ipl * ipf
-         !
-         ALLOCATE( ztab       (jpiglo,ipj,ipk,ipl,ipf     ) )
-         ALLOCATE( znorthgloio(jpimax,ipj,ipk,ipl,ipf,jpni) )
+         ibuffsize = jpimax * ijpj * ipk * ipl * ipf
+         !
+         ALLOCATE( ztab       (jpiglo,ijpj,ipk,ipl,ipf     ) )
+         ALLOCATE( znorthgloio(jpimax,ijpj,ipk,ipl,ipf,jpni) )
          !
          ! when some processors of the north fold are suppressed,
@@ -263,5 +271,5 @@
                DO jl = 1, ipl
                   DO jk = 1, ipk
-                     DO jj = 1, ipj
+                     DO jj = 1, ijpj
                         DO ji = ildi, ilei
                            ztab(ji+iilb-1,jj,jk,jl,jf) = znorthgloio(ji,jj,jk,jl,jf,jr)
@@ -279,6 +287,6 @@
             DO jl = 1, ipl
                DO jk = 1, ipk
-                  DO jj = nlcj-ipj+1, nlcj             ! Scatter back to ARRAY_IN
-                     ij = jj - nlcj + ipj
+                  DO jj = nlcj-ijpj+1, nlcj             ! Scatter back to ARRAY_IN
+                     ij = jj - nlcj + ijpj
                      DO ji= 1, nlci
                         ARRAY_IN(ji,jj,jk,jl,jf) = ztab(ji+nimpp-1,ij,jk,jl,jf)
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mppini.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mppini.F90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mppini.F90	(revision 12586)
@@ -25,5 +25,5 @@
    USE bdy_oce        ! open BounDarY  
    !
-   USE lbcnfd  , ONLY : isendto, nsndto, nfsloop, nfeloop   ! Setup of north fold exchanges 
+   USE lbcnfd  , ONLY : isendto, nsndto ! Setup of north fold exchanges 
    USE lib_mpp        ! distribued memory computing library
    USE iom            ! nemo I/O library 
@@ -699,6 +699,4 @@
             WRITE(inum,*)
             WRITE(inum,*) 'north fold exchanges with explicit point-to-point messaging :'
-            WRITE(inum,*) 'nfsloop : ', nfsloop
-            WRITE(inum,*) 'nfeloop : ', nfeloop
             WRITE(inum,*) 'nsndto : ', nsndto
             WRITE(inum,*) 'isendto : ', isendto
@@ -1261,12 +1259,4 @@
             !
          END DO
-         nfsloop = 1
-         nfeloop = nlci
-         DO jn = 2,jpni-1
-            IF( nfipproc(jn,jpnj) == (narea - 1) ) THEN
-               IF( nfipproc(jn-1,jpnj) == -1 )   nfsloop = nldi
-               IF( nfipproc(jn+1,jpnj) == -1 )   nfeloop = nlei
-            ENDIF
-         END DO
          !
       ENDIF
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/SBC/sbcrnf.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/SBC/sbcrnf.F90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/SBC/sbcrnf.F90	(revision 12586)
@@ -59,5 +59,5 @@
    INTEGER , PUBLIC ::   nkrnf = 0            !: nb of levels over which Kz is increased at river mouths
    
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   rnfmsk              !: river mouth mask (hori.)
+   REAL(wp), PUBLIC, POINTER, SAVE, DIMENSION(:,:)   ::   rnfmsk              !: river mouth mask (hori.)
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)     ::   rnfmsk_z            !: river mouth mask (vert.)
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   h_rnf               !: depth of runoff in m
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/TRA/traadv.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/TRA/traadv.F90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/TRA/traadv.F90	(revision 12586)
@@ -83,12 +83,13 @@
       INTEGER                                  , INTENT(in)    :: kt             ! ocean time-step index
       INTEGER                                  , INTENT(in)    :: Kbb, Kmm, Krhs ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts            ! active tracers and RHS of tracer equation
+      REAL(wp), POINTER, DIMENSION(:,:,:,:,:)  , INTENT(inout) :: pts            ! active tracers and RHS of tracer equation
       !
       INTEGER ::   jk   ! dummy loop index
-      REAL(wp), DIMENSION(jpi,jpj,jpk)        :: zuu, zvv, zww   ! 3D workspace
+      REAL(wp), POINTER, DIMENSION(:,:,:)        :: zuu, zvv, zww   ! 3D workspace
       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrdt, ztrds
       !!----------------------------------------------------------------------
       !
       IF( ln_timing )   CALL timing_start('tra_adv')
+      ALLOCATE( zuu(jpi,jpj,jpk), zvv(jpi,jpj,jpk), zww(jpi,jpj,jpk) )
       !
       !                                         !==  effective transport  ==!
@@ -167,4 +168,5 @@
          &                                  tab3d_2=pts(:,:,:,jp_sal,Krhs), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
       !
+      DEALLOCATE( zuu, zvv, zww )
       IF( ln_timing )   CALL timing_stop( 'tra_adv' )
       !
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/TRA/traadv_mus.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/TRA/traadv_mus.F90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/TRA/traadv_mus.F90	(revision 12586)
@@ -31,4 +31,5 @@
    USE lbclnk         ! ocean lateral boundary condition (or mpp link) 
    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
+   USE halo_mng
 
    IMPLICIT NONE
@@ -37,5 +38,5 @@
    PUBLIC   tra_adv_mus   ! routine called by traadv.F90
    
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   upsmsk   !: mixed upstream/centered scheme near some straits
+   REAL(wp), POINTER, SAVE, DIMENSION(:,:)   ::   upsmsk   !: mixed upstream/centered scheme near some straits
    !                                                           !  and in closed seas (orca 2 and 1 configurations)
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xind     !: mixed upstream/centered index
@@ -44,4 +45,6 @@
    LOGICAL  ::   l_ptr   ! flag to compute poleward transport
    LOGICAL  ::   l_hst   ! flag to compute heat/salt transport
+
+   INTEGER :: jphls = 2
 
    !! * Substitutions
@@ -80,6 +83,6 @@
       LOGICAL                                  , INTENT(in   ) ::   ld_msc_ups      ! use upstream scheme within muscl
       REAL(wp)                                 , INTENT(in   ) ::   p2dt            ! tracer time-step
-      REAL(wp), DIMENSION(jpi,jpj,jpk         ), INTENT(in   ) ::   pU, pV, pW      ! 3 ocean volume flux components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! tracers and RHS of tracer equation
+      REAL(wp), POINTER, DIMENSION(:,:,:    )           , INTENT(in   ) ::   pU, pV, pW      ! 3 ocean volume flux components
+      REAL(wp), POINTER, DIMENSION(:,:,:,:,:)           , INTENT(inout) ::   pt              ! tracers and RHS of tracer equation
       !
       INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
@@ -87,8 +90,36 @@
       REAL(wp) ::   zu, z0u, zzwx, zw , zalpha   ! local scalars
       REAL(wp) ::   zv, z0v, zzwy, z0w           !   -      -
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zwx, zslpx   ! 3D workspace
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zwy, zslpy   ! -      - 
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   zwx, zslpx   ! 3D workspace
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   zwy, zslpy   ! -      - 
       !!----------------------------------------------------------------------
       !
+      CALL halo_mng_set(jphls)
+
+      ALLOCATE(zwx(jplbi:jpi,jplbj:jpj,jpk))
+      ALLOCATE(zwy(jplbi:jpi,jplbj:jpj,jpk))
+      ALLOCATE(zslpx(jplbi:jpi,jplbj:jpj,jpk))
+      ALLOCATE(zslpy(jplbi:jpi,jplbj:jpj,jpk))
+
+      CALL halo_mng_resize(r1_e1e2t,'T', 1._wp)
+      CALL halo_mng_resize(r1_e1e2u,'U', 1._wp)
+      CALL halo_mng_resize(r1_e1e2v,'V', 1._wp)
+      CALL halo_mng_resize(tmask,'T', 1._wp)
+      CALL halo_mng_resize(wmask, 'W', 1._wp)
+      CALL halo_mng_resize(umask, 'U', 1._wp)
+      CALL halo_mng_resize(vmask, 'V', 1._wp)
+      CALL halo_mng_resize(pt, 'T', 1._wp, kjpt=kjpt, fjpt=Kbb )
+      CALL halo_mng_resize(pt, 'T', 1._wp, kjpt=kjpt, fjpt=Krhs )
+      CALL halo_mng_resize(e3t,'T', 1._wp, fillval=1._wp, fjpt=Kmm)
+      CALL halo_mng_resize(e3u, 'U', 1._wp, fillval=1._wp, fjpt=Kmm )
+      CALL halo_mng_resize(e3v, 'V', 1._wp, fillval=1._wp, fjpt=Kmm)
+      CALL halo_mng_resize(e3w, 'W', 1._wp, fillval=1._wp, fjpt=Kmm)
+      CALL halo_mng_resize(pU, 'U', 1._wp)
+      CALL halo_mng_resize(pV, 'V', 1._wp)
+      CALL halo_mng_resize(pW, 'W', 1._wp)
+      !      
+      IF( ln_isfcav ) CALL halo_mng_resize(mikt, 'T', 1._wp)
+      IF( ld_msc_ups) CALL halo_mng_resize(rnfmsk, 'T', 1._wp)
+      IF( ld_msc_ups) CALL halo_mng_resize(upsmsk, 'T', 1._wp)
+
       IF( kt == kit000 )  THEN
          IF(lwp) WRITE(numout,*)
@@ -100,9 +131,9 @@
          ! Upstream / MUSCL scheme indicator
          !
-         ALLOCATE( xind(jpi,jpj,jpk), STAT=ierr )
+         ALLOCATE( xind(jplbi:jpi,jplbj:jpj,jpk), STAT=ierr )
          xind(:,:,:) = 1._wp              ! set equal to 1 where up-stream is not needed
          !
          IF( ld_msc_ups ) THEN            ! define the upstream indicator (if asked)
-            ALLOCATE( upsmsk(jpi,jpj), STAT=ierr )
+            ALLOCATE( upsmsk(jplbi:jpi,jplbj:jpj), STAT=ierr )
             upsmsk(:,:) = 0._wp                             ! not upstream by default
             !
@@ -115,5 +146,5 @@
          !
       ENDIF 
-      !      
+
       l_trd = .FALSE.
       l_hst = .FALSE.
@@ -131,14 +162,15 @@
          zwx(:,:,jpk) = 0._wp                   ! bottom values
          zwy(:,:,jpk) = 0._wp  
-         DO_3D_10_10( 1, jpkm1 )
+         DO_3D_20_20( 1, jpkm1 )
             zwx(ji,jj,jk) = umask(ji,jj,jk) * ( pt(ji+1,jj,jk,jn,Kbb) - pt(ji,jj,jk,jn,Kbb) )
             zwy(ji,jj,jk) = vmask(ji,jj,jk) * ( pt(ji,jj+1,jk,jn,Kbb) - pt(ji,jj,jk,jn,Kbb) )
          END_3D
          ! lateral boundary conditions   (changed sign)
-         CALL lbc_lnk_multi( 'traadv_mus', zwx, 'U', -1. , zwy, 'V', -1. )
+         CALL lbc_lnk( 'traadv_mus', zwx, 'U', -1. )   ! lateral boundary conditions   (changed sign)
+         CALL lbc_lnk( 'traadv_mus', zwy, 'V', -1. )   ! lateral boundary conditions   (changed sign)
          !                                !-- Slopes of tracer
          zslpx(:,:,jpk) = 0._wp                 ! bottom values
          zslpy(:,:,jpk) = 0._wp
-         DO_3D_01_01( 1, jpkm1 )
+         DO_3D_31_31( 1, jpkm1 )
             zslpx(ji,jj,jk) =                    ( zwx(ji,jj,jk) + zwx(ji-1,jj  ,jk) )   &
                &            * ( 0.25 + SIGN( 0.25, zwx(ji,jj,jk) * zwx(ji-1,jj  ,jk) ) )
@@ -147,5 +179,5 @@
          END_3D
          !
-         DO_3D_01_01( 1, jpkm1 )
+         DO_3D_31_31( 1, jpkm1 )
             zslpx(ji,jj,jk) = SIGN( 1., zslpx(ji,jj,jk) ) * MIN(    ABS( zslpx(ji  ,jj,jk) ),   &
                &                                                 2.*ABS( zwx  (ji-1,jj,jk) ),   &
@@ -156,5 +188,5 @@
          END_3D
          !
-         DO_3D_00_00( 1, jpkm1 )
+         DO_3D_30_30( 1, jpkm1 )
             ! MUSCL fluxes
             z0u = SIGN( 0.5, pU(ji,jj,jk) )
@@ -172,7 +204,8 @@
             zwy(ji,jj,jk) = pV(ji,jj,jk) * ( zalpha * zzwx + (1.-zalpha) * zzwy )
          END_3D
-         CALL lbc_lnk_multi( 'traadv_mus', zwx, 'U', -1. , zwy, 'V', -1. )   ! lateral boundary conditions   (changed sign)
-         !
-         DO_3D_00_00( 1, jpkm1 )
+         CALL lbc_lnk( 'traadv_mus', zwx, 'U', -1. )   ! lateral boundary conditions   (changed sign)
+         CALL lbc_lnk( 'traadv_mus', zwy, 'V', -1. )   ! lateral boundary conditions   (changed sign)
+         !
+         DO_3D_30_30( 1, jpkm1 )
             pt(ji,jj,jk,jn,Krhs) = pt(ji,jj,jk,jn,Krhs) - ( zwx(ji,jj,jk) - zwx(ji-1,jj  ,jk  )       &
             &                                     + zwy(ji,jj,jk) - zwy(ji  ,jj-1,jk  ) )     &
@@ -199,14 +232,14 @@
          !                                !-- Slopes of tracer
          zslpx(:,:,1) = 0._wp                   ! surface values
-         DO_3D_11_11( 2, jpkm1 )
+         DO_3D_21_21( 2, jpkm1 )
             zslpx(ji,jj,jk) =                     ( zwx(ji,jj,jk) + zwx(ji,jj,jk+1) )  &
                &            * (  0.25 + SIGN( 0.25, zwx(ji,jj,jk) * zwx(ji,jj,jk+1) )  )
          END_3D
-         DO_3D_11_11( 2, jpkm1 )
+         DO_3D_21_21( 2, jpkm1 )
             zslpx(ji,jj,jk) = SIGN( 1., zslpx(ji,jj,jk) ) * MIN(    ABS( zslpx(ji,jj,jk  ) ),   &
                &                                                 2.*ABS( zwx  (ji,jj,jk+1) ),   &
                &                                                 2.*ABS( zwx  (ji,jj,jk  ) )  )
          END_3D
-         DO_3D_00_00( 1, jpk-2 )
+         DO_3D_30_30( 1, jpk-2 )
             z0w = SIGN( 0.5, pW(ji,jj,jk+1) )
             zalpha = 0.5 + z0w
@@ -218,5 +251,5 @@
          IF( ln_linssh ) THEN                   ! top values, linear free surface only
             IF( ln_isfcav ) THEN                      ! ice-shelf cavities (top of the ocean)
-               DO_2D_11_11
+               DO_2D_21_21
                   zwx(ji,jj, mikt(ji,jj) ) = pW(ji,jj,mikt(ji,jj)) * pt(ji,jj,mikt(ji,jj),jn,Kbb)
                END_2D
@@ -226,5 +259,5 @@
          ENDIF
          !
-         DO_3D_00_00( 1, jpkm1 )
+         DO_3D_30_30( 1, jpkm1 )
             pt(ji,jj,jk,jn,Krhs) =  pt(ji,jj,jk,jn,Krhs) - ( zwx(ji,jj,jk) - zwx(ji,jj,jk+1) ) * r1_e1e2t(ji,jj) / e3t(ji,jj,jk,Kmm)
          END_3D
@@ -234,4 +267,30 @@
       END DO                     ! end of tracer loop
       !
+      DEALLOCATE(zwx,zwy)
+      DEALLOCATE(zslpx,zslpy)
+
+      CALL halo_mng_set(1)
+
+      CALL halo_mng_resize(r1_e1e2t,'T', 1._wp)
+      CALL halo_mng_resize(r1_e1e2u,'U', 1._wp)
+      CALL halo_mng_resize(r1_e1e2v,'V', 1._wp)
+      CALL halo_mng_resize(pt, 'T', 1._wp, kjpt=kjpt, fjpt=Kbb )
+      CALL halo_mng_resize(pt, 'T', 1._wp, kjpt=kjpt, fjpt=Krhs )
+      CALL halo_mng_resize(tmask,'T', 1._wp)
+      CALL halo_mng_resize(wmask, 'W', 1._wp)
+      CALL halo_mng_resize(umask, 'U', 1._wp)
+      CALL halo_mng_resize(vmask, 'V', 1._wp)
+      CALL halo_mng_resize(e3t,'T', 1._wp, fillval=1._wp, fjpt=Kmm)
+      CALL halo_mng_resize(e3u, 'U', 1._wp, fillval=1._wp, fjpt=Kmm)
+      CALL halo_mng_resize(e3v, 'V', 1._wp, fillval=1._wp, fjpt=Kmm)
+      CALL halo_mng_resize(e3w, 'W', 1._wp, fillval=1._wp, fjpt=Kmm)
+      CALL halo_mng_resize(pU, 'U', 1._wp)
+      CALL halo_mng_resize(pV, 'V', 1._wp)
+      CALL halo_mng_resize(pW, 'W', 1._wp)
+
+      IF( ln_isfcav ) CALL halo_mng_resize(mikt, 'T', 1._wp)
+      IF( ld_msc_ups) CALL halo_mng_resize(rnfmsk, 'T', 1._wp)
+      IF( ld_msc_ups) CALL halo_mng_resize(upsmsk, 'T', 1._wp)
+
    END SUBROUTINE tra_adv_mus
 
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ZDF/zdfdrg.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ZDF/zdfdrg.F90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ZDF/zdfdrg.F90	(revision 12586)
@@ -268,5 +268,5 @@
       IF( ln_isfcav ) THEN              ! Ocean cavities: top friction setting
          ALLOCATE( rCd0_top(jpi,jpj), rCdU_top(jpi,jpj) )
-         CALL drg_init( 'TOP   '   , mikt       ,                                         &   ! <== in
+         CALL drg_init( 'TOP   '   , INT(mikt)       ,                                         &   ! <== in
             &           r_Cdmin_top, r_Cdmax_top, r_z0_top, r_ke0_top, rCd0_top, rCdU_top )   ! ==> out
       ENDIF
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ZDF/zdfphy.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ZDF/zdfphy.F90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ZDF/zdfphy.F90	(revision 12586)
@@ -247,5 +247,5 @@
             &                                        rCdU_bot  )     ! ==>> out : bottom drag [m/s]
          IF( ln_isfcav ) THEN    !* top drag   (ocean cavities)
-            CALL zdf_drg( kt, Kmm, mikt , r_Cdmin_top, r_Cdmax_top,   &   ! <<== in 
+            CALL zdf_drg( kt, Kmm, INT(mikt) , r_Cdmin_top, r_Cdmax_top,   &   ! <<== in 
                &              r_z0_top,   r_ke0_top,    rCd0_top,   &
                &                                        rCdU_top  )     ! ==>> out : bottom drag [m/s]
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/do_loop_substitute.h90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/do_loop_substitute.h90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/do_loop_substitute.h90	(revision 12586)
@@ -59,7 +59,12 @@
 #define __kIsm1_   1
 #define __kJsm1_   1
+#
+#define __kIsmh_   jplbi
+#define __kJsmh_   jplbj
+#define __kIsmhp1_   jplbi+1
+#define __kJsmhp1_   jplbj+1
 
-#define __kIe_     jpim1
-#define __kJe_     jpjm1
+#define __kIe_     jpi-1
+#define __kJe_     jpj-1
 #define __kIep1_   jpi
 #define __kJep1_   jpj
@@ -78,4 +83,9 @@
 #define DO_2D_10_10   DO jj = __kJsm1_, __kJe_   ;   DO ji = __kIsm1_, __kIe_
 #define DO_2D_10_11   DO jj = __kJsm1_, __kJe_   ;   DO ji = __kIsm1_, __kIep1_
+#
+#define DO_2D_20_20   DO jj = __kJsmh_, __kJe_   ;   DO ji = __kIsmh_, __kIe_
+#define DO_2D_21_21   DO jj = __kJsmh_, __kJep1_   ;   DO ji = __kIsmh_, __kIep1_
+#define DO_2D_31_31   DO jj = __kJsmhp1_, __kJep1_ ;   DO ji = __kIsmhp1_, __kIep1_
+#define DO_2D_30_30   DO jj = __kJsmhp1_, __kJe_   ;   DO ji = __kIsmhp1_, __kIe_
  
 #define DO_2D_11_00   DO jj = __kJsm1_, __kJep1_   ;   DO ji = __kIs_, __kIe_
@@ -92,6 +102,12 @@
 #define DO_3D_10_10(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_10
 #define DO_3D_10_11(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_11
+#
+#define DO_3D_20_20(ks,ke)   DO jk = ks, ke   ;   DO_2D_20_20
+#define DO_3D_21_21(ks,ke)   DO jk = ks, ke   ;   DO_2D_21_21
+#define DO_3D_31_31(ks,ke)   DO jk = ks, ke   ;   DO_2D_31_31
+#define DO_3D_30_30(ks,ke)   DO jk = ks, ke   ;   DO_2D_30_30
  
 #define DO_3D_11_11(ks,ke)   DO jk = ks, ke   ;   DO_2D_11_11
+#define DO_3D_21_21(ks,ke)   DO jk = ks, ke   ;   DO_2D_21_21
 
 #define DO_3DS_00_00(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_00_00
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/nemogcm.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/nemogcm.F90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/nemogcm.F90	(revision 12586)
@@ -86,5 +86,5 @@
    USE lib_mpp        ! distributed memory computing
    USE mppini         ! shared/distributed memory setting (mpp_init routine)
-   USE lbcnfd  , ONLY : isendto, nsndto, nfsloop, nfeloop   ! Setup of north fold exchanges 
+   USE lbcnfd  , ONLY : isendto, nsndto  ! Setup of north fold exchanges 
    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
 #if defined key_iomput
@@ -94,4 +94,5 @@
    USE agrif_all_update   ! Master Agrif update
 #endif
+   USE halo_mng
 
    IMPLICIT NONE
@@ -276,4 +277,5 @@
       !
       cxios_context = 'nemo'
+      nn_hls = 1
       !
       !                             !-------------------------------------------------!
@@ -402,4 +404,5 @@
       CALL mpp_init
 
+      CALL halo_mng_init()
       ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays
       CALL nemo_alloc()
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/oce.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/oce.F90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/oce.F90	(revision 12586)
@@ -24,5 +24,5 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)     ::   wi             !: vertical vel. (adaptive-implicit) [m/s]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)     ::   hdiv           !: horizontal divergence        [s-1]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:,:) ::   ts             !: 4D T-S fields                  [Celsius,psu] 
+   REAL(wp), PUBLIC, POINTER, SAVE, DIMENSION(:,:,:,:,:) ::   ts             !: 4D T-S fields                  [Celsius,psu] 
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)   ::   rab_b,  rab_n  !: thermal/haline expansion coef. [Celsius-1,psu-1]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)     ::   rn2b ,  rn2    !: brunt-vaisala frequency**2     [s-2]
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/par_oce.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/par_oce.F90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/par_oce.F90	(revision 12586)
@@ -61,4 +61,6 @@
    INTEGER, PUBLIC ::   jpimax! = ( jpiglo-2*nn_hls + (jpni-1) ) / jpni + 2*nn_hls !: maximum jpi
    INTEGER, PUBLIC ::   jpjmax! = ( jpjglo-2*nn_hls + (jpnj-1) ) / jpnj + 2*nn_hls !: maximum jpj
+   INTEGER, PUBLIC ::   jplbi
+   INTEGER, PUBLIC ::   jplbj
 
    !!---------------------------------------------------------------------
@@ -78,5 +80,5 @@
    INTEGER, PUBLIC, PARAMETER ::   jpr2di = 0   !: number of columns for extra outer halo 
    INTEGER, PUBLIC, PARAMETER ::   jpr2dj = 0   !: number of rows    for extra outer halo 
-   INTEGER, PUBLIC, PARAMETER ::   nn_hls = 1   !: halo width (applies to both rows and columns)
+   INTEGER, PUBLIC            ::   nn_hls       !: halo width (applies to both rows and columns)
 
    !!----------------------------------------------------------------------
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OFF/nemogcm.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OFF/nemogcm.F90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OFF/nemogcm.F90	(revision 12586)
@@ -59,6 +59,7 @@
    USE timing         ! Timing
    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
-   USE lbcnfd  , ONLY : isendto, nsndto, nfsloop, nfeloop   ! Setup of north fold exchanges
+   USE lbcnfd  , ONLY : isendto, nsndto   ! Setup of north fold exchanges
    USE step, ONLY : Nbb, Nnn, Naa, Nrhs   ! time level indices
+   USE halo_mng
 
    IMPLICIT NONE
@@ -182,4 +183,5 @@
       !
       cxios_context = 'nemo'
+      nn_hls = 1
       !
       !                             !-------------------------------------------------!
@@ -296,4 +298,5 @@
       CALL mpp_init
 
+      CALL halo_mng_init()
       ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays
       CALL nemo_alloc()
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/SAO/nemogcm.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/SAO/nemogcm.F90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/SAO/nemogcm.F90	(revision 12586)
@@ -31,9 +31,10 @@
    USE lib_mpp        ! distributed memory computing
    USE mppini         ! shared/distributed memory setting (mpp_init routine)
-   USE lbcnfd  , ONLY : isendto, nsndto, nfsloop, nfeloop ! Setup of north fold exchanges 
+   USE lbcnfd  , ONLY : isendto, nsndto ! Setup of north fold exchanges 
    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
 #if defined key_iomput
    USE xios           ! xIOserver
 #endif
+   USE halo_mng
 
    IMPLICIT NONE
@@ -98,4 +99,5 @@
       !
       cxios_context = 'nemo'
+      nn_hls = 1
       !
       !                             !-------------------------------------------------!
@@ -224,4 +226,5 @@
       CALL mpp_init
 
+      CALL halo_mng_init()
       ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays
       CALL nemo_alloc()
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/SAS/nemogcm.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/SAS/nemogcm.F90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/SAS/nemogcm.F90	(revision 12586)
@@ -37,5 +37,5 @@
    USE lib_mpp        ! distributed memory computing
    USE mppini         ! shared/distributed memory setting (mpp_init routine)
-   USE lbcnfd  , ONLY : isendto, nsndto, nfsloop, nfeloop   ! Setup of north fold exchanges
+   USE lbcnfd  , ONLY : isendto, nsndto ! Setup of north fold exchanges
    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
 #if defined key_iomput
@@ -45,4 +45,5 @@
    USE agrif_ice_update ! ice update
 #endif
+   USE halo_mng
 
    IMPLICIT NONE
@@ -207,4 +208,5 @@
       ELSE                  ;   cxios_context = 'nemo'
       ENDIF
+      nn_hls = 1
       !
       !                             !-------------------------------------------------!
@@ -345,4 +347,5 @@
       CALL mpp_init
 
+      CALL halo_mng_init()
       ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays
       CALL nemo_alloc()
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/TOP/TRP/trcadv.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/TOP/TRP/trcadv.F90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/TOP/TRP/trcadv.F90	(revision 12586)
@@ -76,12 +76,13 @@
       INTEGER                                   , INTENT(in)    :: kt   ! ocean time-step index
       INTEGER                                   , INTENT(in)    :: Kbb, Kmm, Krhs ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr            ! passive tracers and RHS of tracer equation
+      REAL(wp), POINTER, DIMENSION(:,:,:,:,:)   , INTENT(inout) :: ptr            ! passive tracers and RHS of tracer equation
       !
       INTEGER ::   jk   ! dummy loop index
       CHARACTER (len=22) ::   charout
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zuu, zvv, zww  ! effective velocity
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::   zuu, zvv, zww  ! effective velocity
       !!----------------------------------------------------------------------
       !
       IF( ln_timing )   CALL timing_start('trc_adv')
+      ALLOCATE( zuu(jpi,jpj,jpk), zvv(jpi,jpj,jpk), zww(jpi,jpj,jpk) )
       !
       !                                         !==  effective transport  ==!
@@ -143,4 +144,5 @@
       IF( ln_timing )   CALL timing_stop('trc_adv')
       !
+      DEALLOCATE( zuu, zvv, zww )
    END SUBROUTINE trc_adv
 
Index: /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/TOP/trc.F90
===================================================================
--- /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/TOP/trc.F90	(revision 12585)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/TOP/trc.F90	(revision 12586)
@@ -33,5 +33,5 @@
    REAL(wp), PUBLIC                                        ::  areatot        !: total volume 
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  ) ::  cvol           !: volume correction -degrad option- 
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:,:) ::  tr           !: tracer concentration 
+   REAL(wp), PUBLIC, POINTER, SAVE, DIMENSION(:,:,:,:,:) ::  tr           !: tracer concentration 
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  ) ::  sbc_trc_b      !: Before sbc fluxes for tracers
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  ) ::  sbc_trc        !: Now sbc fluxes for tracers
