Index: NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/DOM/dom_oce.F90
===================================================================
--- NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/DOM/dom_oce.F90	(revision 11720)
+++ NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/DOM/dom_oce.F90	(revision 12325)
@@ -116,8 +116,10 @@
    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, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e1e2f , r1_e1e2f                !: associated metrics at f-point
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e1e2t			 				!: associated metrics at t-point
+
+   REAL(wp), PUBLIC, POINTER		     	  , DIMENSION(:,:) ::   r1_e1e2t, r1_e1e2u, r1_e1e2v                        !: 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
    !
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   ff_f  , ff_t                    !: Coriolis factor at f- & t-points  [1/s]
@@ -130,11 +132,13 @@
    LOGICAL, PUBLIC ::   ln_isfcav    !: presence of ISF 
    !                                                        !  ref.   ! before  !   now   ! after  !
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::     e3t_0 ,   e3t_b ,   e3t_n ,  e3t_a   !: t- vert. scale factor [m]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::     e3u_0 ,   e3u_b ,   e3u_n ,  e3u_a   !: u- vert. scale factor [m]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::     e3v_0 ,   e3v_b ,   e3v_n ,  e3v_a   !: v- vert. scale factor [m]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::     e3f_0           ,   e3f_n            !: f- vert. scale factor [m]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::     e3w_0 ,   e3w_b ,   e3w_n            !: w- vert. scale factor [m]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::    e3uw_0 ,  e3uw_b ,  e3uw_n            !: uw-vert. scale factor [m]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::    e3vw_0 ,  e3vw_b ,  e3vw_n            !: vw-vert. scale factor [m]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::     e3t_0 ,   e3t_b ,  e3t_a   !: t- vert. scale factor [m]
+   REAL(wp), PUBLIC, POINTER	, SAVE, DIMENSION(:,:,:) ::   	e3t_n ,   e3u_n ,  e3v_n,  e3w_n
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::     e3u_0 ,   e3u_b ,   e3u_a   !: u- vert. scale factor [m]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::     e3v_0 ,   e3v_b ,   e3v_a   !: v- vert. scale factor [m]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::     e3f_0           ,   e3f_n   !: f- vert. scale factor [m]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::     e3w_0 ,   e3w_b			    !: w- vert. scale factor [m]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::    e3uw_0 ,  e3uw_b ,  e3uw_n   !: uw-vert. scale factor [m]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::    e3vw_0 ,  e3vw_b ,  e3vw_n   !: vw-vert. scale factor [m]
 
    !                                                        !  ref.   ! before  !   now   !
@@ -171,10 +175,13 @@
 
    INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   misfdep                 !: top first ocean level             (ISF)
-   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 T-, U-, V-, F-level (ISF)
+   REAL(wp), PUBLIC, POINTER, SAVE, DIMENSION(:,:) ::   mikt			  !: top first wet T-, U-, V-, F-level (ISF)
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   risfdep                 !: Iceshelf draft                    (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 T-, U-, V- and F-pts
+   REAL(wp), PUBLIC, POINTER, SAVE, DIMENSION(:,:,:) :: tmask, umask, vmask, wmask   !: land/ocean mask at T-, U-, V- and F-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/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/LBC/halo_mng.F90
===================================================================
--- NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/LBC/halo_mng.F90	(revision 11720)
+++ NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/LBC/halo_mng.F90	(revision 12325)
@@ -11,13 +11,14 @@
 
    USE dom_oce       ! ocean space and time domain
+   USE lbclnk        ! ocean lateral boundary condition (or mpp link) 
 
    IMPLICIT NONE
    PRIVATE
 
-   INTERFACE halo_mng_copy
-      MODULE PROCEDURE halo_mng_copy_2D, halo_mng_copy_3d, halo_mng_copy_4d
+   INTERFACE halo_mng_resize
+      MODULE PROCEDURE halo_mng_resize_2D, halo_mng_resize_3d, halo_mng_resize_4d
    END INTERFACE
 
-   PUBLIC halo_mng_copy
+   PUBLIC halo_mng_resize
    PUBLIC halo_mng_init
    PUBLIC halo_mng_set
@@ -67,91 +68,100 @@
    END SUBROUTINE halo_mng_set
    
-   SUBROUTINE halo_mng_copy_2D(pta_1, pta_2)
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE halo_mng_copy  ***
-      !!
-      !! ** Purpose : copy pta_1 into pta_2
-      !! ** Method  :
-      !! History :
-      !!   1.0  !  07-19  ( CMCC - ASC )  halo_mng_copy
-      !!----------------------------------------------------------------------
-       REAL(wp), DIMENSION(:,:), INTENT(in)  :: pta_1
-       REAL(wp), DIMENSION(:,:), INTENT(out)  :: pta_2
-       INTEGER :: halo, off1, off2
-       INTEGER, DIMENSION(2) :: dim
+	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
 
-       halo = (SIZE(pta_1,1) - SIZE(pta_2,1))/2
-       IF (halo < 0) THEN
-          off1 = 0
-          off2 = -halo
-          dim = SHAPE(pta_1)
-       ELSE
-          off1 = halo
-          off2 = 0
-          dim = SHAPE(pta_2)
-       END IF
-        
-       pta_2(1+off2:SIZE(pta_2,1)-off2, 1+off2:SIZE(pta_2,2)-off2) = pta_1(1+off1:SIZE(pta_1,1)-off1, 1+off1:SIZE(pta_1,2)-off1)
-       
-    
-   END SUBROUTINE halo_mng_copy_2D
+		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 
 
-   SUBROUTINE halo_mng_copy_3D(pta_1, pta_2)
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE halo_mng_copy  ***
-      !!
-      !! ** Purpose : copy pta_1 into pta_2
-      !! ** Method  :
-      !! History :
-      !!   1.0  !  07-19  ( CMCC - ASC )  halo_mng_copy
-      !!----------------------------------------------------------------------
-       REAL(wp), DIMENSION(:,:,:), INTENT(in) :: pta_1
-       REAL(wp), DIMENSION(:,:,:), INTENT(out) :: pta_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
 
-       INTEGER :: halo, off1, off2
-       INTEGER, DIMENSION(3) :: dim
+	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
 
-       halo = (SIZE(pta_1,1) - SIZE(pta_2,1))/2
-       IF (halo < 0) THEN
-          off1 = 0
-          off2 = -halo
-          dim = SHAPE(pta_1)
-       ELSE
-          off1 = halo
-          off2 = 0
-          dim = SHAPE(pta_2)
-       END IF
-        
-       pta_2(1+off2:SIZE(pta_2,1)-off2, 1+off2:SIZE(pta_2,2)-off2,:) = pta_1(1+off1:SIZE(pta_1,1)-off1, 1+off1:SIZE(pta_1,2)-off1,:) 
+		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 
 
-   END SUBROUTINE halo_mng_copy_3D
+			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_copy_4D(pta_1, pta_2)
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE halo_mng_copy  ***
-      !!
-      !! ** Purpose : copy pta_1 into pta_2
-      !! ** Method  :
-      !! History :
-      !!   1.0  !  07-19  ( CMCC - ASC )  halo_mng_copy
-      !!----------------------------------------------------------------------
-       REAL(wp), DIMENSION(:,:,:,:), INTENT(in) :: pta_1
-       REAL(wp), DIMENSION(:,:,:,:), INTENT(out) :: pta_2
-       INTEGER :: halo, off1, off2
-       INTEGER, DIMENSION(4) :: dim
+	SUBROUTINE halo_mng_resize_4D(pta, cdna, psgn, fillval, kjpt)
+	
+		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
+		REAL(wp), POINTER, DIMENSION(:,:,:,:) :: zpta
+		INTEGER :: offset
+		INTEGER :: pta_size_i, pta_size_j, exp_size_i, exp_size_j
 
-       halo = (SIZE(pta_1,1) - SIZE(pta_2,1))/2
-       IF (halo < 0) THEN
-          off1 = 0
-          off2 = -halo
-          dim = SHAPE(pta_1)
-       ELSE
-          off1 = halo
-          off2 = 0
-          dim = SHAPE(pta_2)
-       END IF
-        
-       pta_2(1+off2:SIZE(pta_2,1)-off2, 1+off2:SIZE(pta_2,2)-off2,:,:) = pta_1(1+off1:SIZE(pta_1,1)-off1, 1+off1:SIZE(pta_1,2)-off1,:,:)
+		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))
+			offset = (exp_size_i - pta_size_i) / 2 
 
-   END SUBROUTINE halo_mng_copy_4D
+			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, cdna, psgn, pfillval=fillval)
+			DEALLOCATE(pta)
+			pta => zpta
+		END IF
+		
+	END SUBROUTINE halo_mng_resize_4D
+	
 END MODULE
Index: NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/SBC/sbcrnf.F90
===================================================================
--- NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/SBC/sbcrnf.F90	(revision 11720)
+++ NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/SBC/sbcrnf.F90	(revision 12325)
@@ -58,5 +58,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/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/TRA/traadv.F90
===================================================================
--- NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/TRA/traadv.F90	(revision 11720)
+++ NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/TRA/traadv.F90	(revision 12325)
@@ -86,9 +86,10 @@
       !
       INTEGER ::   jk   ! dummy loop index
-      REAL(wp), DIMENSION(jpi,jpj,jpk)        :: zun, zvn, zwn   ! 3D workspace
+      REAL(wp), POINTER, DIMENSION(:,:,:)        :: zun, zvn, zwn   ! 3D workspace
       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrdt, ztrds
       !!----------------------------------------------------------------------
       !
       IF( ln_timing )   CALL timing_start('tra_adv')
+      ALLOCATE( zun(jpi,jpj,jpk), zvn(jpi,jpj,jpk), zwn(jpi,jpj,jpk) )
       !
       !                                          ! set time step
@@ -171,4 +172,5 @@
          &                       tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
       !
+      DEALLOCATE( zun, zvn, zwn )
       IF( ln_timing )   CALL timing_stop( 'tra_adv' )
       !
Index: NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/TRA/traadv_mus.F90
===================================================================
--- NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/TRA/traadv_mus.F90	(revision 11720)
+++ NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/TRA/traadv_mus.F90	(revision 12325)
@@ -28,6 +28,4 @@
    USE iom            ! XIOS library
    USE in_out_manager ! I/O manager
-   USE lib_mpp        ! distribued memory computing
-   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
@@ -38,13 +36,5 @@
    PUBLIC   tra_adv_mus   ! routine called by traadv.F90
    
-   REAL(wp), ALLOCATABLE, DIMENSION(:,:    ) ::   r1_e1e2t_exh2, r1_e1e2u_exh2, r1_e1e2v_exh2
-   REAL(wp), ALLOCATABLE, DIMENSION(:,:    ) ::   rnfmsk_exh2, upsmsk_exh2, mikt_exh2
-   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:  ) ::   tmask_exh2, wmask_exh2, umask_exh2, vmask_exh2
-   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:  ) ::   e3u_n_exh2, e3v_n_exh2, e3t_n_exh2, e3w_n_exh2
-   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:  ) ::   pun_exh2, pvn_exh2, pwn_exh2   ! 3 ocean velocity components
-   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::   ptb_exh2, pta_exh2        ! before and now tracer fields
-
-   
-   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
@@ -83,5 +73,5 @@
       !! References : Estubier, A., and M. Levy, Notes Techn. Pole de Modelisation
       !!              IPSL, Sept. 2000 (http://www.lodyc.jussieu.fr/opa)
-      !!----------------------------------------------------------------------
+      !!---------------------------------------------------------------------- 
       INTEGER                              , INTENT(in   ) ::   kt              ! ocean time-step index
       INTEGER                              , INTENT(in   ) ::   kit000          ! first time step index
@@ -90,10 +80,9 @@
       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   ) ::   pun, pvn, pwn   ! 3 ocean velocity components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb             ! before tracer field
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta             ! tracer trend 
+      REAL(wp), POINTER, DIMENSION(:,:,:)  , INTENT(in   ) ::   pun, pvn, pwn   ! 3 ocean velocity components
+      REAL(wp), POINTER, DIMENSION(:,:,:,:), INTENT(inout) ::   pta             ! tracer trend
+      REAL(wp), POINTER, DIMENSION(:,:,:,:), INTENT(in   ) ::   ptb             ! before tracer trend 
       !
-      INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
-      INTEGER  ::   last_khls, ierr             ! local integer
+      INTEGER  ::   ji, jj, jk, jn, ierr   ! dummy loop indices
       REAL(wp) ::   zu, z0u, zzwx, zw , zalpha   ! local scalars
       REAL(wp) ::   zv, z0v, zzwy, z0w           !   -      -
@@ -102,93 +91,31 @@
       !!----------------------------------------------------------------------
       !
- 		
-	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))
-
-	IF (kt==kit000) THEN
-		if (.not. allocated(pun_exh2))	ALLOCATE(pun_exh2(jplbi:jpi,jplbj:jpj,jpk))
-		if (.not. allocated(pvn_exh2))	ALLOCATE(pvn_exh2(jplbi:jpi,jplbj:jpj,jpk))
-		if (.not. allocated(pwn_exh2))	ALLOCATE(pwn_exh2(jplbi:jpi,jplbj:jpj,jpk))
-		if (.not. allocated(ptb_exh2))	ALLOCATE(ptb_exh2(jplbi:jpi,jplbj:jpj,jpk,kjpt))
-		if (.not. allocated(pta_exh2))	ALLOCATE(pta_exh2(jplbi:jpi,jplbj:jpj,jpk,kjpt))
-		if (.not. allocated(r1_e1e2t_exh2))	ALLOCATE(r1_e1e2t_exh2(jplbi:jpi,jplbj:jpj))
-		if (.not. allocated(r1_e1e2u_exh2))	ALLOCATE(r1_e1e2u_exh2(jplbi:jpi,jplbj:jpj))
-		if (.not. allocated(r1_e1e2v_exh2))	ALLOCATE(r1_e1e2v_exh2(jplbi:jpi,jplbj:jpj))
-		if (.not. allocated(tmask_exh2))	ALLOCATE(tmask_exh2(jplbi:jpi,jplbj:jpj,jpk))
-		if (.not. allocated(wmask_exh2))	ALLOCATE(wmask_exh2(jplbi:jpi,jplbj:jpj,jpk))
-		if (.not. allocated(umask_exh2))	ALLOCATE(umask_exh2(jplbi:jpi,jplbj:jpj,jpk))
-		if (.not. allocated(vmask_exh2))	ALLOCATE(vmask_exh2(jplbi:jpi,jplbj:jpj,jpk))
-		if (.not. allocated(e3u_n_exh2))	ALLOCATE(e3u_n_exh2(jplbi:jpi,jplbj:jpj,jpk))
-		if (.not. allocated(e3v_n_exh2))	ALLOCATE(e3v_n_exh2(jplbi:jpi,jplbj:jpj,jpk))
-		if (.not. allocated(e3t_n_exh2))	ALLOCATE(e3t_n_exh2(jplbi:jpi,jplbj:jpj,jpk))
-		if (.not. allocated(e3w_n_exh2))	ALLOCATE(e3w_n_exh2(jplbi:jpi,jplbj:jpj,jpk))
-		IF( ln_isfcav.and..not.allocated(mikt_exh2)) ALLOCATE(mikt_exh2(jplbi:jpi,jplbj:jpj))
-		IF( ld_msc_ups.and..not.allocated(rnfmsk_exh2)) ALLOCATE(rnfmsk_exh2(jplbi:jpi,jplbj:jpj))
-		IF( ld_msc_ups.and..not.allocated(upsmsk_exh2)) ALLOCATE(upsmsk_exh2(jplbi:jpi,jplbj:jpj))
-
-		CALL halo_mng_copy(r1_e1e2t, r1_e1e2t_exh2)
-		CALL halo_mng_copy(r1_e1e2u, r1_e1e2u_exh2)
-		CALL halo_mng_copy(r1_e1e2v, r1_e1e2v_exh2)
-		CALL halo_mng_copy(tmask, tmask_exh2)
-		CALL halo_mng_copy(wmask, wmask_exh2)
-		CALL halo_mng_copy(umask, umask_exh2)
-		CALL halo_mng_copy(vmask, vmask_exh2)
-
-		CALL lbc_lnk( 'traadv_mus', r1_e1e2u_exh2, 'U', -1.)
-		CALL lbc_lnk( 'traadv_mus', r1_e1e2v_exh2, 'V', -1.)
-		CALL lbc_lnk( 'traadv_mus', r1_e1e2t_exh2, 'T', 1.)
-		CALL lbc_lnk( 'traadv_mus', tmask_exh2, 'T', 1. )
-		CALL lbc_lnk( 'traadv_mus', wmask_exh2, 'W', 1.)
-		CALL lbc_lnk( 'traadv_mus', umask_exh2, 'U', 1. )
-		CALL lbc_lnk( 'traadv_mus', vmask_exh2, 'V', 1.)
-	ENDIF
-	
-	IF( ln_isfcav ) THEN ; CALL halo_mng_copy(REAL(mikt), mikt_exh2) ; CALL lbc_lnk( 'traadv_mus', mikt_exh2, 'T', 1.) ; ENDIF
-	IF( ld_msc_ups) THEN ; CALL halo_mng_copy(rnfmsk, rnfmsk_exh2) ; CALL lbc_lnk( 'traadv_mus', rnfmsk_exh2, 'T', 1.) ; ENDIF
-	IF( ld_msc_ups) THEN ; CALL halo_mng_copy(upsmsk, upsmsk_exh2) ; CALL lbc_lnk( 'traadv_mus', upsmsk_exh2, 'T', 1.) ; ENDIF
-
-	CALL halo_mng_copy(e3u_n, e3u_n_exh2)
-	CALL halo_mng_copy(e3v_n, e3v_n_exh2)
-	CALL halo_mng_copy(e3t_n, e3t_n_exh2)
-	CALL halo_mng_copy(e3w_n, e3w_n_exh2)
-	CALL halo_mng_copy(pun, pun_exh2)
-	CALL halo_mng_copy(pvn, pvn_exh2)
-	CALL halo_mng_copy(pwn, pwn_exh2)
-	CALL halo_mng_copy(ptb, ptb_exh2)
-	CALL halo_mng_copy(pta, pta_exh2)
-
-	CALL lbc_lnk( 'traadv_mus', e3u_n_exh2, 'U', -1., pfillval = 1.0_wp )
-	CALL lbc_lnk( 'traadv_mus', e3v_n_exh2, 'V', -1., pfillval = 1.0_wp )
-	CALL lbc_lnk( 'traadv_mus', e3t_n_exh2, 'T', 1., pfillval = 1.0_wp )
-	CALL lbc_lnk( 'traadv_mus', e3w_n_exh2, 'W', 1., pfillval = 1.0_wp )
-	CALL lbc_lnk( 'traadv_mus', pun_exh2, 'U', -1.)
-	CALL lbc_lnk( 'traadv_mus', pvn_exh2, 'V', -1.)
-	CALL lbc_lnk( 'traadv_mus', pwn_exh2, 'W', 1.)
-	CALL lbc_lnk( 'traadv_mus', pta_exh2, 'T', 1.)
-	CALL lbc_lnk( 'traadv_mus', ptb_exh2, 'T', 1.)
-
-#     define pun pun_exh2
-#     define pvn pvn_exh2
-#     define pwn pwn_exh2
-#     define ptb ptb_exh2
-#     define pta pta_exh2
-#     define r1_e1e2t r1_e1e2t_exh2
-#     define r1_e1e2u r1_e1e2u_exh2
-#     define r1_e1e2v r1_e1e2v_exh2
-#     define tmask tmask_exh2
-#     define wmask wmask_exh2
-#     define umask umask_exh2
-#     define vmask vmask_exh2
-#     define e3u_n e3u_n_exh2
-#     define e3v_n e3v_n_exh2
-#     define e3t_n e3t_n_exh2
-#     define e3w_n e3w_n_exh2
-#     define mikt mikt_exh2
-#     define rnfmsk rnfmsk_exh2
-#     define upsmsk upsmsk_exh2
+      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(ptb, 'T', 1._wp, kjpt=kjpt )
+      CALL halo_mng_resize(pta, 'T', 1._wp, kjpt=kjpt)
+      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_n,'T', 1._wp, fillval=1._wp)
+      CALL halo_mng_resize(e3u_n, 'U', -1._wp, fillval=1._wp)
+      CALL halo_mng_resize(e3v_n, 'V', -1._wp, fillval=1._wp)
+      CALL halo_mng_resize(e3w_n, 'W', 1._wp, fillval=1._wp)
+      CALL halo_mng_resize(pun, 'U', -1._wp)
+      CALL halo_mng_resize(pvn, 'V', -1._wp)
+      CALL halo_mng_resize(pwn, '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
@@ -373,58 +300,30 @@
       END DO                     ! end of tracer loop
       !
-#     undef pun
-#     undef pvn
-#     undef pwn
-#     undef ptb
-#     undef pta
-#     undef r1_e1e2t
-#     undef r1_e1e2u
-#     undef r1_e1e2v
-#     undef tmask
-#     undef wmask
-#     undef umask
-#     undef vmask
-#     undef e3u_n
-#     undef e3v_n
-#     undef e3t_n
-#     undef e3w_n
-#     undef mikt
-#     undef rnfmsk
-#     undef upsmsk
-
-	CALL halo_mng_copy(pta_exh2, pta)
-
-    last_khls = jphls - ((SIZE(pta_exh2, 1) - SIZE(pta, 1))/2)
-
-    CALL halo_mng_set(last_khls)
-
-	CALL lbc_lnk( 'traadv_mus', pta, 'T', 1. )
-
-	IF( kt==nitend ) THEN
-		if (allocated(pun_exh2)) DEALLOCATE(pun_exh2)
-    	if (allocated(pvn_exh2)) DEALLOCATE(pvn_exh2)
-		if (allocated(pwn_exh2)) DEALLOCATE(pwn_exh2)
-	   	if (allocated(ptb_exh2)) DEALLOCATE(ptb_exh2)
-		if (allocated(pta_exh2)) DEALLOCATE(pta_exh2)
-		if (allocated(r1_e1e2t_exh2)) DEALLOCATE(r1_e1e2t_exh2)
-		if (allocated(r1_e1e2u_exh2)) DEALLOCATE(r1_e1e2u_exh2)
-		if (allocated(r1_e1e2v_exh2)) DEALLOCATE(r1_e1e2v_exh2)
-		if (allocated(tmask_exh2)) DEALLOCATE(tmask_exh2)
-		if (allocated(wmask_exh2)) DEALLOCATE(wmask_exh2)
-		if (allocated(umask_exh2)) DEALLOCATE(umask_exh2)
-		if (allocated(vmask_exh2)) DEALLOCATE(vmask_exh2)
-		if (allocated(e3u_n_exh2)) DEALLOCATE(e3u_n_exh2)
-		if (allocated(e3v_n_exh2)) DEALLOCATE(e3v_n_exh2)
-		if (allocated(e3t_n_exh2)) DEALLOCATE(e3t_n_exh2)
-		if (allocated(e3w_n_exh2)) DEALLOCATE(e3w_n_exh2)
-       	IF (ln_isfcav.and.allocated(mikt_exh2)) DEALLOCATE(mikt_exh2)
-       	IF( ld_msc_ups.and.allocated(rnfmsk_exh2)) DEALLOCATE(rnfmsk_exh2)
-		IF( ld_msc_ups.and.allocated(upsmsk_exh2)) DEALLOCATE(upsmsk_exh2)
-
-    ENDIF
-
-	DEALLOCATE(zwx,zwy)
-    DEALLOCATE(zslpx,zslpy)
-   END SUBROUTINE tra_adv_mus
+      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(ptb, 'T', 1._wp, kjpt=kjpt)
+      CALL halo_mng_resize(pta, 'T', 1._wp, kjpt=kjpt)
+      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_n,'T', 1._wp, fillval=1._wp)
+      CALL halo_mng_resize(e3u_n, 'U', 1._wp, fillval=1._wp)
+      CALL halo_mng_resize(e3v_n, 'V', 1._wp, fillval=1._wp)
+      CALL halo_mng_resize(e3w_n, 'W', 1._wp, fillval=1._wp)
+      CALL halo_mng_resize(pun, 'U', 1._wp)
+      CALL halo_mng_resize(pvn, 'V', 1._wp)
+      CALL halo_mng_resize(pwn, '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)
+      
+      DEALLOCATE(zwx,zwy)
+      DEALLOCATE(zslpx,zslpy)
+      
+    END SUBROUTINE tra_adv_mus
 
    !!======================================================================
Index: NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/ZDF/zdfdrg.F90
===================================================================
--- NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/ZDF/zdfdrg.F90	(revision 11720)
+++ NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/ZDF/zdfdrg.F90	(revision 12325)
@@ -276,5 +276,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/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/ZDF/zdfphy.F90
===================================================================
--- NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/ZDF/zdfphy.F90	(revision 11720)
+++ NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/ZDF/zdfphy.F90	(revision 12325)
@@ -246,5 +246,5 @@
             &                                        rCdU_bot  )     ! ==>> out : bottom drag [m/s]
          IF( ln_isfcav ) THEN    !* top drag   (ocean cavities)
-            CALL zdf_drg( kt, mikt    , r_Cdmin_top, r_Cdmax_top,   &   ! <<== in 
+            CALL zdf_drg( kt, 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/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/oce.F90
===================================================================
--- NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/oce.F90	(revision 11720)
+++ NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/OCE/oce.F90	(revision 12325)
@@ -24,5 +24,7 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::           wi             !: vertical vel. (adaptive-implicit) [m/s]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::           hdivn          !: horizontal divergence        [s-1]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   tsb  ,  tsn   , tsa    !: 4D T-S fields                  [Celsius,psu] 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   tsn					   !: 4D T-S fields                  [Celsius,psu] 
+   REAL(wp), PUBLIC, POINTER	, SAVE, DIMENSION(:,:,:,:) ::   tsb  , tsa    !: 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/2019/dev_r11514_HPC-02_single-core-extrahalo/src/TOP/TRP/trcadv.F90
===================================================================
--- NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/TOP/TRP/trcadv.F90	(revision 11720)
+++ NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/TOP/TRP/trcadv.F90	(revision 12325)
@@ -80,8 +80,9 @@
       INTEGER ::   jk   ! dummy loop index
       CHARACTER (len=22) ::   charout
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zun, zvn, zwn  ! effective velocity
+      REAL(wp), POINTER, DIMENSION(:,:,:)        :: zun, zvn, zwn   ! effective velocity
       !!----------------------------------------------------------------------
       !
       IF( ln_timing )   CALL timing_start('trc_adv')
+	  ALLOCATE( zun(jpi,jpj,jpk), zvn(jpi,jpj,jpk), zwn(jpi,jpj,jpk) )
       !
       !                                         !==  effective transport  ==!
@@ -141,4 +142,5 @@
       END IF
       !
+      DEALLOCATE( zun, zvn, zwn )
       IF( ln_timing )   CALL timing_stop('trc_adv')
       !
Index: NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/TOP/trc.F90
===================================================================
--- NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/TOP/trc.F90	(revision 11720)
+++ NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/TOP/trc.F90	(revision 12325)
@@ -34,6 +34,6 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  ) ::  cvol           !: volume correction -degrad option- 
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::  trn            !: tracer concentration for now time step
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::  tra            !: tracer concentration for next time step
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::  trb            !: tracer concentration for before time step
+   REAL(wp), PUBLIC, POINTER, SAVE, DIMENSION(:,:,:,:) ::  tra            !: tracer concentration for next time step
+   REAL(wp), PUBLIC, POINTER, SAVE, DIMENSION(:,:,:,:) ::  trb            !: tracer concentration for before time step
    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
