Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/ICE/icedyn_adv_pra.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/ICE/icedyn_adv_pra.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/ICE/icedyn_adv_pra.F90	(revision 13807)
@@ -129,5 +129,9 @@
          END_2D
       END DO
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'icedyn_adv_pra', zhi_max, 'T', 1._wp, zhs_max, 'T', 1._wp, zhip_max, 'T', 1._wp, zsi_max, 'T', 1._wp )
+#else
       CALL lbc_lnk_multi( 'icedyn_adv_pra', zhi_max, 'T', 1._wp, zhs_max, 'T', 1._wp, zhip_max, 'T', 1._wp, zsi_max, 'T', 1._wp )
+#endif
       !
       ! enthalpies
@@ -492,7 +496,13 @@
 
       !-- Lateral boundary conditions
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'icedyn_adv_pra', psm(:,:,1:jcat) , 'T',  1.0_wp, ps0 , 'T',  1.0_wp   &
+         &                                , psx             , 'T', -1.0_wp, psy , 'T', -1.0_wp   &   ! caution gradient ==> the sign changes
+         &                                , psxx            , 'T',  1.0_wp, psyy, 'T',  1.0_wp , psxy, 'T',  1.0_wp )
+#else
       CALL lbc_lnk_multi( 'icedyn_adv_pra', psm(:,:,1:jcat) , 'T',  1.0_wp, ps0 , 'T',  1.0_wp   &
          &                                , psx             , 'T', -1.0_wp, psy , 'T', -1.0_wp   &   ! caution gradient ==> the sign changes
          &                                , psxx            , 'T',  1.0_wp, psyy, 'T',  1.0_wp , psxy, 'T',  1.0_wp )
+#endif
       !
    END SUBROUTINE adv_x
@@ -651,7 +661,13 @@
 
       !-- Lateral boundary conditions
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'icedyn_adv_pra', psm(:,:,1:jcat) , 'T',  1.0_wp, ps0 , 'T',  1.0_wp   &
+         &                                , psx             , 'T', -1.0_wp, psy , 'T', -1.0_wp   &   ! caution gradient ==> the sign changes
+         &                                , psxx            , 'T',  1.0_wp, psyy, 'T',  1.0_wp , psxy, 'T',  1.0_wp )
+#else
       CALL lbc_lnk_multi( 'icedyn_adv_pra', psm(:,:,1:jcat) , 'T',  1.0_wp, ps0 , 'T',  1.0_wp   &
          &                                , psx             , 'T', -1.0_wp, psy , 'T', -1.0_wp   &   ! caution gradient ==> the sign changes
          &                                , psxx            , 'T',  1.0_wp, psyy, 'T',  1.0_wp , psxy, 'T',  1.0_wp )
+#endif
       !
    END SUBROUTINE adv_y
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/ICE/icedyn_adv_umx.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/ICE/icedyn_adv_umx.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/ICE/icedyn_adv_umx.F90	(revision 13807)
@@ -133,5 +133,9 @@
          END_2D
       END DO
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'icedyn_adv_umx', zhi_max, 'T', 1._wp, zhs_max, 'T', 1._wp, zhip_max, 'T', 1._wp, zsi_max, 'T', 1._wp )
+#else
       CALL lbc_lnk_multi( 'icedyn_adv_umx', zhi_max, 'T', 1._wp, zhs_max, 'T', 1._wp, zhip_max, 'T', 1._wp, zsi_max, 'T', 1._wp )
+#endif
       !
       ! enthalpies
@@ -562,5 +566,9 @@
          END_2D
       END DO
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'icedyn_adv_umx', ptc, 'T',  1.0_wp )
+#else
       CALL lbc_lnk( 'icedyn_adv_umx', ptc, 'T',  1.0_wp )
+#endif
       !
    END SUBROUTINE adv_umx
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/ICE/icedyn_rhg_evp.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/ICE/icedyn_rhg_evp.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/ICE/icedyn_rhg_evp.F90	(revision 13807)
@@ -322,5 +322,9 @@
 
       END_2D
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'icedyn_rhg_evp', zmf, 'T', 1.0_wp, zdt_m, 'T', 1.0_wp )
+#else
       CALL lbc_lnk_multi( 'icedyn_rhg_evp', zmf, 'T', 1.0_wp, zdt_m, 'T', 1.0_wp )
+#endif
       !
       !                                  !== Landfast ice parameterization ==!
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DOM/domutl.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DOM/domutl.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DOM/domutl.F90	(revision 13807)
@@ -103,5 +103,9 @@
       !
       puniq(:,:) = ztstref(:,:)                    ! default definition
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'domwri', puniq, cdgrd, 1. )   ! apply boundary conditions
+#else
       CALL lbc_lnk( 'domwri', puniq, cdgrd, 1. )   ! apply boundary conditions
+#endif
       lluniq(:,:,1) = puniq(:,:) == ztstref(:,:)   ! check which values have not been changed 
       !
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DOM/domvvl.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DOM/domvvl.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DOM/domvvl.F90	(revision 13807)
@@ -724,5 +724,9 @@
                &                           + e1e2t(ji+1,jj) * ( pe3_in(ji+1,jj,jk) - e3t_0(ji+1,jj,jk) ) )
          END_3D
+#if defined key_mpi3
+         CALL lbc_lnk_nc_multi( 'domvvl', pe3_out(:,:,:), 'U', 1._wp )
+#else
          CALL lbc_lnk( 'domvvl', pe3_out(:,:,:), 'U', 1._wp )
+#endif
          pe3_out(:,:,:) = pe3_out(:,:,:) + e3u_0(:,:,:)
          !
@@ -733,5 +737,9 @@
                &                           + e1e2t(ji,jj+1) * ( pe3_in(ji,jj+1,jk) - e3t_0(ji,jj+1,jk) ) )
          END_3D
+#if defined key_mpi3
+         CALL lbc_lnk_nc_multi( 'domvvl', pe3_out(:,:,:), 'V', 1._wp )
+#else
          CALL lbc_lnk( 'domvvl', pe3_out(:,:,:), 'V', 1._wp )
+#endif
          pe3_out(:,:,:) = pe3_out(:,:,:) + e3v_0(:,:,:)
          !
@@ -743,5 +751,9 @@
                &                           + e1e2u(ji,jj+1) * ( pe3_in(ji,jj+1,jk) - e3u_0(ji,jj+1,jk) ) )
          END_3D
+#if defined key_mpi3
+         CALL lbc_lnk_nc_multi( 'domvvl', pe3_out(:,:,:), 'F', 1._wp )
+#else
          CALL lbc_lnk( 'domvvl', pe3_out(:,:,:), 'F', 1._wp )
+#endif
          pe3_out(:,:,:) = pe3_out(:,:,:) + e3f_0(:,:,:)
          !
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DYN/dynadv_ubs.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DYN/dynadv_ubs.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DYN/dynadv_ubs.F90	(revision 13807)
@@ -124,8 +124,15 @@
          END_2D
       END DO
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'dynadv_ubs', zlu_uu(:,:,:,1), 'U', 1.0_wp , zlu_uv(:,:,:,1), 'U', 1.0_wp,  &
+                      &   zlu_uu(:,:,:,2), 'U', 1.0_wp , zlu_uv(:,:,:,2), 'U', 1.0_wp,  & 
+                      &   zlv_vv(:,:,:,1), 'V', 1.0_wp , zlv_vu(:,:,:,1), 'V', 1.0_wp,  &
+                      &   zlv_vv(:,:,:,2), 'V', 1.0_wp , zlv_vu(:,:,:,2), 'V', 1.0_wp   )
+#else
       CALL lbc_lnk_multi( 'dynadv_ubs', zlu_uu(:,:,:,1), 'U', 1.0_wp , zlu_uv(:,:,:,1), 'U', 1.0_wp,  &
                       &   zlu_uu(:,:,:,2), 'U', 1.0_wp , zlu_uv(:,:,:,2), 'U', 1.0_wp,  & 
                       &   zlv_vv(:,:,:,1), 'V', 1.0_wp , zlv_vu(:,:,:,1), 'V', 1.0_wp,  &
                       &   zlv_vv(:,:,:,2), 'V', 1.0_wp , zlv_vu(:,:,:,2), 'V', 1.0_wp   )
+#endif
       !
       !                                      ! ====================== !
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DYN/dynatf.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DYN/dynatf.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DYN/dynatf.F90	(revision 13807)
@@ -167,5 +167,9 @@
 # endif
       !
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'dynatf', puu(:,:,:,Kaa), 'U', -1.0_wp, pvv(:,:,:,Kaa), 'V', -1.0_wp )     !* local domain boundaries
+#else
       CALL lbc_lnk_multi( 'dynatf', puu(:,:,:,Kaa), 'U', -1.0_wp, pvv(:,:,:,Kaa), 'V', -1.0_wp )     !* local domain boundaries
+#endif
       !
       !                                !* BDY open boundaries
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DYN/dynldf_lap_blp.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DYN/dynldf_lap_blp.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DYN/dynldf_lap_blp.F90	(revision 13807)
@@ -132,5 +132,9 @@
       CALL dyn_ldf_lap( kt, Kbb, Kmm, pu, pv, zulap, zvlap, 1 )   ! rotated laplacian applied to pt (output in zlap,Kbb)
       !
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'dynldf_lap_blp', zulap, 'U', -1.0_wp, zvlap, 'V', -1.0_wp )             ! Lateral boundary conditions
+#else
       CALL lbc_lnk_multi( 'dynldf_lap_blp', zulap, 'U', -1.0_wp, zvlap, 'V', -1.0_wp )             ! Lateral boundary conditions
+#endif
       !
       CALL dyn_ldf_lap( kt, Kbb, Kmm, zulap, zvlap, pu_rhs, pv_rhs, 2 )   ! rotated laplacian applied to zlap (output in pt(:,:,:,:,Krhs))
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DYN/dynvor.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DYN/dynvor.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/DYN/dynvor.F90	(revision 13807)
@@ -618,5 +618,9 @@
       END DO                                           !   End of slab
          !
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'dynvor', zwz, 'F', 1.0_wp )
+#else
       CALL lbc_lnk( 'dynvor', zwz, 'F', 1.0_wp )
+#endif
 
       DO jk = 1, jpkm1                                 ! Horizontal slab
@@ -739,5 +743,9 @@
       END DO
       !
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'dynvor', zwz, 'F', 1.0_wp )
+#else
       CALL lbc_lnk( 'dynvor', zwz, 'F', 1.0_wp )
+#endif
       !
       DO jk = 1, jpkm1                                 ! Horizontal slab
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/IOM/iom.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/IOM/iom.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/IOM/iom.F90	(revision 13807)
@@ -1342,7 +1342,15 @@
                !--- overlap areas and extra hallows (mpp)
                IF(     PRESENT(pv_r2d) .AND. idom /= jpdom_unknown .AND. cl_type /= 'Z' ) THEN
+#if defined key_mpi3
+                  CALL lbc_lnk_nc_multi( 'iom', pv_r2d, cl_type, zsgn, kfillmode = kfill )
+#else
                   CALL lbc_lnk( 'iom', pv_r2d, cl_type, zsgn, kfillmode = kfill )
+#endif
                ELSEIF( PRESENT(pv_r3d) .AND. idom /= jpdom_unknown .AND. cl_type /= 'Z' ) THEN
+#if defined key_mpi3
+                  CALL lbc_lnk_nc_multi( 'iom', pv_r3d, cl_type, zsgn, kfillmode = kfill )
+#else
                   CALL lbc_lnk( 'iom', pv_r3d, cl_type, zsgn, kfillmode = kfill )
+#endif
                ENDIF
                !
@@ -1363,9 +1371,17 @@
             IF(lwp) WRITE(numout,*) 'XIOS RST READ (3D): ',TRIM(cdvar)
             CALL xios_recv_field( trim(cdvar), pv_r3d)
+#if defined key_mpi3
+            IF(idom /= jpdom_unknown )   CALL lbc_lnk_nc_multi( 'iom', pv_r3d,'Z', -999., kfillmode = jpfillnothing)
+#else
             IF(idom /= jpdom_unknown )   CALL lbc_lnk( 'iom', pv_r3d,'Z', -999., kfillmode = jpfillnothing)
+#endif
          ELSEIF( PRESENT(pv_r2d) ) THEN
             IF(lwp) WRITE(numout,*) 'XIOS RST READ (2D): ', TRIM(cdvar)
             CALL xios_recv_field( trim(cdvar), pv_r2d)
+#if defined key_mpi3
+            IF(idom /= jpdom_unknown )   CALL lbc_lnk_nc_multi('iom', pv_r2d,'Z',-999., kfillmode = jpfillnothing)
+#else
             IF(idom /= jpdom_unknown )   CALL lbc_lnk('iom', pv_r2d,'Z',-999., kfillmode = jpfillnothing)
+#endif
          ELSEIF( PRESENT(pv_r1d) ) THEN
             IF(lwp) WRITE(numout,*) 'XIOS RST READ (1D): ', TRIM(cdvar)
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/LBC/mpp_nc_generic.h90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/LBC/mpp_nc_generic.h90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/LBC/mpp_nc_generic.h90	(revision 13807)
@@ -67,6 +67,6 @@
       LOGICAL  ::   llsend_we, llsend_ea, llsend_no, llsend_so       ! communication send
       LOGICAL  ::   llrecv_we, llrecv_ea, llrecv_no, llrecv_so       ! communication receive 
-      LOGICAL  ::   lldo_nfd                                     ! do north pole folding
-      LOGICAL  ::   llncall = .TRUE.                                 ! default: 9-point stencil
+      LOGICAL  ::   lldo_nfd                                         ! do north pole folding
+      LOGICAL  ::   llncall                                          ! default: 9-point stencil
 
       !!----------------------------------------------------------------------
@@ -76,4 +76,5 @@
       ! ----------------------------------------- !
       !
+      llncall = .TRUE. 
       ipk = K_SIZE(ptab)   ! 3rd dimension
       ipl = L_SIZE(ptab)   ! 4th    -
@@ -102,4 +103,5 @@
       zland = 0._wp                                     ! land filling value: zero by default
       IF( PRESENT( pfillval ) )   zland = pfillval      ! set land value
+
 
       ! define the method we will use to fill the halos in each direction
@@ -374,15 +376,15 @@
          CASE ( jpfillperio )                 ! use east-weast periodicity
             ishift2 = nn_hls
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = nn_hls + 1, jpj - nn_hls   ;   DO ji = 1, nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 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 = nn_hls + 1, jpj - nn_hls   ;   DO ji = 1, nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
                ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift,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 = nn_hls + 1, jpj - nn_hls   ;   DO ji = 1, nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 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
+            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
          END SELECT
          ! ----------------------
@@ -398,15 +400,15 @@
          CASE ( jpfillperio )                 ! use east-weast periodicity
             ishift2 = jpi - 2 * nn_hls
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = nn_hls + 1, jpj - nn_hls   ;   DO ji = 1, nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
                ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            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 = nn_hls + 1, jpj - nn_hls   ;   DO ji = 1, nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
                ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf)
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            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 = nn_hls + 1, jpj - nn_hls   ;   DO ji = 1, nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
                ARRAY_IN(ji,jj,jk,jl,jf) = zland
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
          END SELECT
 
@@ -426,15 +428,15 @@
          CASE ( jpfillperio )                 ! use east-weast periodicity
             ishift2 = jpi - 2 * nn_hls
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = nn_hls + 1, jpj - nn_hls   ;   DO ji = 1, nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
                ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            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 = nn_hls + 1, jpj - nn_hls   ;   DO ji = 1, nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
                ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf)
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            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 = nn_hls + 1, jpj - nn_hls   ;   DO ji = 1, nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
                ARRAY_IN(ji,jj,jk,jl,jf) = zland
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
          END SELECT
          ! ---------------------
@@ -451,16 +453,17 @@
          CASE ( jpfillperio )                 ! use east-weast periodicity
             ishift2 = nn_hls
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = nn_hls + 1, jpj - nn_hls   ;   DO ji = 1, nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 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 = nn_hls + 1, jpj - nn_hls   ;   DO ji = 1, nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
                ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift,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 = nn_hls + 1, jpj - nn_hls   ;   DO ji = 1, nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 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
+            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
          END SELECT
+
       ENDIF
 
@@ -478,18 +481,57 @@
                idx = idx + 1
             END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+            IF(nonwr .eq. -1) THEN
+               ishift = jpj - nn_hls
+               SELECT CASE ( ifill_we )
+                  CASE ( jpfillperio )
+                     ishift2 = jpi - 2 * nn_hls
+                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift, jpj   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(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  )
+                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift, jpj   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf)
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+
+                  CASE ( jpfillcst   )
+                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift, jpj   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ji,jj,jk,jl,jf) = zland
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+               END SELECT
+            END IF
+            IF(noner .eq. -1) THEN
+               ishift = jpi - nn_hls
+               ishift2 = jpj - nn_hls
+               SELECT CASE ( ifill_ea )
+                  CASE ( jpfillperio )
+                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift2, jpj   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ji,jj,jk,jl,jf)
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+
+                  CASE ( jpfillcopy  )
+                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift2, jpj   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift,jj,jk,jl,jf)
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+                  CASE ( jpfillcst   )
+                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift2, 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
+               END SELECT
+            END IF
          CASE ( jpfillperio )                 ! use north-south periodicity
             ishift2 = nn_hls
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = nn_hls + 1, jpi - nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 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
+            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, nn_hls   ;   DO ji = nn_hls + 1, jpi - nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
                ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift,jk,jl,jf)
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            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, nn_hls   ;   DO ji = nn_hls + 1, jpi - nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
                ARRAY_IN(ji,ishift+jj,jk,jl,jf) = zland
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
          END SELECT
+
          ! ----------------------
          ! 2.4 fill southern halo
@@ -502,17 +544,53 @@
                idx = idx + 1
             END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            IF(noswr .eq. -1) THEN
+               SELECT CASE ( ifill_we )
+                  CASE ( jpfillperio )
+                     ishift2 = jpi - 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
+                        ARRAY_IN(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  )
+                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf)
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+
+                  CASE ( jpfillcst   )
+                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ji,jj,jk,jl,jf) = zland
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+               END SELECT
+            END IF
+            IF(noser .eq. -1) THEN
+               ishift = jpi - nn_hls
+               SELECT CASE ( ifill_ea )
+                  CASE ( jpfillperio )
+                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ji+nn_hls,jj,jk,jl,jf)
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+
+                  CASE ( jpfillcopy  )
+                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift,jj,jk,jl,jf)
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+                  CASE ( jpfillcst   )
+                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zland
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+               END SELECT
+            END IF
          CASE ( jpfillperio )                 ! use north-south periodicity
             ishift2 = jpj - 2 * nn_hls
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = nn_hls + 1, jpi - nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
                ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf)
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            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, nn_hls   ;   DO ji = nn_hls + 1, jpi - nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
                ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,nn_hls+1,jk,jl,jf)
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            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, nn_hls   ;   DO ji = nn_hls + 1, jpi - nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
                ARRAY_IN(ji,jj,jk,jl,jf) = zland
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
          END SELECT
       ELSE
@@ -527,18 +605,55 @@
                idx = idx + 1
             END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            IF(noswr .eq. -1) THEN
+               SELECT CASE ( ifill_we )
+                  CASE ( jpfillperio )
+                     ishift2 = jpi - 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
+                        ARRAY_IN(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  )
+                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf)
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+
+                  CASE ( jpfillcst   )
+                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ji,jj,jk,jl,jf) = zland
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+               END SELECT
+            END IF
+            IF(noser .eq. -1) THEN
+               ishift = jpi - nn_hls
+               SELECT CASE ( ifill_ea )
+                  CASE ( jpfillperio )
+                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ji+nn_hls,jj,jk,jl,jf)
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+
+                  CASE ( jpfillcopy  )
+                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift,jj,jk,jl,jf)
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+                  CASE ( jpfillcst   )
+                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zland
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+               END SELECT
+            END IF
          CASE ( jpfillperio )                 ! use north-south periodicity
             ishift2 = jpj - 2 * nn_hls
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = nn_hls + 1, jpi - nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
                ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf)
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            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, nn_hls   ;   DO ji = nn_hls + 1, jpi - nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
                ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,nn_hls+1,jk,jl,jf)
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            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, nn_hls   ;   DO ji = nn_hls + 1, jpi - nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
                ARRAY_IN(ji,jj,jk,jl,jf) = zland
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
          END SELECT
+
          ! ----------------------
          ! 2.4 fill northern halo
@@ -552,17 +667,55 @@
                idx = idx + 1
             END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+            IF(nonwr .eq. -1) THEN
+               ishift = jpj - nn_hls
+               SELECT CASE ( ifill_we )
+                  CASE ( jpfillperio )
+                     ishift2 = jpi - 2 * nn_hls
+                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift, jpj   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(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  )
+                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift, jpj   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf)
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+
+                  CASE ( jpfillcst   )
+                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift, jpj   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ji,jj,jk,jl,jf) = zland
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+               END SELECT
+            END IF
+            IF(noner .eq. -1) THEN
+               ishift = jpi - nn_hls
+               ishift2 = jpj - nn_hls
+               SELECT CASE ( ifill_ea )
+                  CASE ( jpfillperio )
+                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift2, jpj   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ji,jj,jk,jl,jf)
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+
+                  CASE ( jpfillcopy  )
+                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift2, jpj   ;  DO ji = 1, nn_hls
+                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift,jj,jk,jl,jf)
+                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+                  CASE ( jpfillcst   )
+                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift2, 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
+               END SELECT
+            END IF
          CASE ( jpfillperio )                 ! use north-south periodicity
             ishift2 = nn_hls
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = nn_hls + 1, jpi - nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 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
+            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, nn_hls   ;   DO ji = nn_hls + 1, jpi - nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
                ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift,jk,jl,jf)
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            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, nn_hls   ;   DO ji = nn_hls + 1, jpi - nn_hls
+            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
                ARRAY_IN(ji,ishift+jj,jk,jl,jf) = zland
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
          END SELECT
       ENDIF
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/LDF/ldfslp.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/LDF/ldfslp.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/LDF/ldfslp.F90	(revision 13807)
@@ -229,5 +229,9 @@
 !!gm end modif
       END_3D
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'ldfslp', zwz, 'U', -1.0_wp,  zww, 'V', -1.0_wp )      ! lateral boundary conditions
+#else 
       CALL lbc_lnk_multi( 'ldfslp', zwz, 'U', -1.0_wp,  zww, 'V', -1.0_wp )      ! lateral boundary conditions
+#endif
       !
       !                                    !* horizontal Shapiro filter
@@ -303,5 +307,9 @@
 !!gm end modif
       END_3D
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'ldfslp', zwz, 'T', -1.0_wp,  zww, 'T', -1.0_wp )      ! lateral boundary conditions
+#else
       CALL lbc_lnk_multi( 'ldfslp', zwz, 'T', -1.0_wp,  zww, 'T', -1.0_wp )      ! lateral boundary conditions
+#endif
       !
       !                                           !* horizontal Shapiro filter
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/SBC/fldread.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/SBC/fldread.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/SBC/fldread.F90	(revision 13807)
@@ -372,5 +372,9 @@
          CALL wgt_list( sdjf, iw )
          CALL fld_interp( sdjf%num, sdjf%clvar, iw, ipk, dta_alias(:,:,:), sdjf%nrec(1,iaa), sdjf%lsmname )
+#if defined key_mpi3
+         CALL lbc_lnk_nc_multi( 'fldread', dta_alias(:,:,:), sdjf%cltype, sdjf%zsgn, kfillmode = jpfillcopy )
+#else
          CALL lbc_lnk( 'fldread', dta_alias(:,:,:), sdjf%cltype, sdjf%zsgn, kfillmode = jpfillcopy )
+#endif
       ELSE                                          ! default case
          ! C1D case: If product of spatial dimensions == ipk, then x,y are of
@@ -383,5 +387,9 @@
          IF( lk_c1d .AND. lmoor ) THEN
             CALL iom_get( sdjf%num, jpdom_unknown, sdjf%clvar, dta_alias(2,2,:), sdjf%nrec(1,iaa) )   ! jpdom_unknown -> no lbc_lnk
+#if defined key_mpi3
+            CALL lbc_lnk_nc_multi( 'fldread', dta_alias(:,:,:), 'T', 1., kfillmode = jpfillcopy )
+#else
             CALL lbc_lnk( 'fldread', dta_alias(:,:,:), 'T', 1., kfillmode = jpfillcopy )
+#endif
          ELSE
             CALL iom_get( sdjf%num,  jpdom_global, sdjf%clvar, dta_alias(:,:,:), sdjf%nrec(1,iaa),   &
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/SBC/geo2ocean.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/SBC/geo2ocean.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/SBC/geo2ocean.F90	(revision 13807)
@@ -272,6 +272,11 @@
       ! =========================== !
       !           ! lateral boundary cond.: T-, U-, V-, F-pts, sgn
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'geo2ocean', gcost, 'T', -1.0_wp, gsint, 'T', -1.0_wp, gcosu, 'U', -1.0_wp, gsinu, 'U', -1.0_wp, & 
+                      &   gcosv, 'V', -1.0_wp, gsinv, 'V', -1.0_wp, gcosf, 'F', -1.0_wp, gsinf, 'F', -1.0_wp  )
+#else
       CALL lbc_lnk_multi( 'geo2ocean', gcost, 'T', -1.0_wp, gsint, 'T', -1.0_wp, gcosu, 'U', -1.0_wp, gsinu, 'U', -1.0_wp, & 
                       &   gcosv, 'V', -1.0_wp, gsinv, 'V', -1.0_wp, gcosf, 'F', -1.0_wp, gsinf, 'F', -1.0_wp  )
+#endif
       !
    END SUBROUTINE angle
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/SBC/sbcwave.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/SBC/sbcwave.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/SBC/sbcwave.F90	(revision 13807)
@@ -199,5 +199,9 @@
       ENDIF
 
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'sbcwave', usd, 'U', -1.0_wp, vsd, 'V', -1.0_wp )
+#else
       CALL lbc_lnk_multi( 'sbcwave', usd, 'U', -1.0_wp, vsd, 'V', -1.0_wp )
+#endif
 
       !
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/TRA/traatf.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/TRA/traatf.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/TRA/traatf.F90	(revision 13807)
@@ -110,5 +110,9 @@
 #endif
       !                                              ! local domain boundaries  (T-point, unchanged sign)
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'traatf', pts(:,:,:,jp_tem,Kaa), 'T', 1.0_wp, pts(:,:,:,jp_sal,Kaa), 'T', 1.0_wp )
+#else
       CALL lbc_lnk_multi( 'traatf', pts(:,:,:,jp_tem,Kaa), 'T', 1.0_wp, pts(:,:,:,jp_sal,Kaa), 'T', 1.0_wp )
+#endif
       !
       IF( ln_bdy )   CALL bdy_tra( kt, Kbb, pts, Kaa )  ! BDY open boundaries
@@ -156,7 +160,13 @@
          ENDIF
          !
+#if defined key_mpi3
+         CALL lbc_lnk_nc_multi( 'traatf', pts(:,:,:,jp_tem,Kbb) , 'T', 1.0_wp, pts(:,:,:,jp_sal,Kbb) , 'T', 1.0_wp, &
+                  &                    pts(:,:,:,jp_tem,Kmm) , 'T', 1.0_wp, pts(:,:,:,jp_sal,Kmm) , 'T', 1.0_wp, &
+                  &                    pts(:,:,:,jp_tem,Kaa), 'T', 1.0_wp, pts(:,:,:,jp_sal,Kaa), 'T', 1.0_wp  )
+#else
          CALL lbc_lnk_multi( 'traatf', pts(:,:,:,jp_tem,Kbb) , 'T', 1.0_wp, pts(:,:,:,jp_sal,Kbb) , 'T', 1.0_wp, &
                   &                    pts(:,:,:,jp_tem,Kmm) , 'T', 1.0_wp, pts(:,:,:,jp_sal,Kmm) , 'T', 1.0_wp, &
                   &                    pts(:,:,:,jp_tem,Kaa), 'T', 1.0_wp, pts(:,:,:,jp_sal,Kaa), 'T', 1.0_wp  )
+#endif
          !
       ENDIF     
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/lib_fortran.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/lib_fortran.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/lib_fortran.F90	(revision 13807)
@@ -229,5 +229,9 @@
          ENDIF
       END_2D
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'lib_fortran', p2d, 'T', 1.0_wp )
+#else
       CALL lbc_lnk( 'lib_fortran', p2d, 'T', 1.0_wp )
+#endif
       ! no need for 2nd exchange when nn_hls = 2
       IF( nn_hls /= 2 ) THEN
@@ -248,5 +252,9 @@
             IF( MOD(mjg(jpj-2), 3) == 0 )   p2d(:,jpj-1) = p2d(:,  jpj)
          ENDIF
+#if defined key_mpi3
+         CALL lbc_lnk_nc_multi( 'lib_fortran', p2d, 'T', 1.0_wp )
+#else
          CALL lbc_lnk( 'lib_fortran', p2d, 'T', 1.0_wp )
+#endif
       ENDIF
 
@@ -284,5 +292,9 @@
          END_2D
       END DO
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'lib_fortran', p3d, 'T', 1.0_wp )
+#else
       CALL lbc_lnk( 'lib_fortran', p3d, 'T', 1.0_wp )
+#endif
       ! no need for 2nd exchange when nn_hls = 2
       IF( nn_hls /= 2 ) THEN
@@ -303,5 +315,9 @@
             IF( MOD(mjg(jpj-2), 3) == 0 )   p3d(:,jpj-1,:) = p3d(:,  jpj,:)
          ENDIF
+#if defined key_mpi3
+         CALL lbc_lnk_nc_multi( 'lib_fortran', p3d, 'T', 1.0_wp )
+#else
          CALL lbc_lnk( 'lib_fortran', p3d, 'T', 1.0_wp )
+#endif
       ENDIF
 
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/tests/CANAL/MY_SRC/domvvl.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/tests/CANAL/MY_SRC/domvvl.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/tests/CANAL/MY_SRC/domvvl.F90	(revision 13807)
@@ -725,5 +725,9 @@
                &                           + e1e2t(ji+1,jj) * ( pe3_in(ji+1,jj,jk) - e3t_0(ji+1,jj,jk) ) )
          END_3D
+#if defined key_mpi3
+         CALL lbc_lnk_nc_multi( 'domvvl', pe3_out(:,:,:), 'U', 1._wp )
+#else
          CALL lbc_lnk( 'domvvl', pe3_out(:,:,:), 'U', 1._wp )
+#endif
          pe3_out(:,:,:) = pe3_out(:,:,:) + e3u_0(:,:,:)
          !
@@ -734,5 +738,9 @@
                &                           + e1e2t(ji,jj+1) * ( pe3_in(ji,jj+1,jk) - e3t_0(ji,jj+1,jk) ) )
          END_3D
+#if defined key_mpi3
+         CALL lbc_lnk_nc_multi( 'domvvl', pe3_out(:,:,:), 'V', 1._wp )
+#else
          CALL lbc_lnk( 'domvvl', pe3_out(:,:,:), 'V', 1._wp )
+#endif
          pe3_out(:,:,:) = pe3_out(:,:,:) + e3v_0(:,:,:)
          !
@@ -744,5 +752,9 @@
                &                           + e1e2u(ji,jj+1) * ( pe3_in(ji,jj+1,jk) - e3u_0(ji,jj+1,jk) ) )
          END_3D
+#if defined key_mpi3
+         CALL lbc_lnk_nc_multi( 'domvvl', pe3_out(:,:,:), 'F', 1._wp )
+#else
          CALL lbc_lnk( 'domvvl', pe3_out(:,:,:), 'F', 1._wp )
+#endif
          pe3_out(:,:,:) = pe3_out(:,:,:) + e3f_0(:,:,:)
          !
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/tests/VORTEX/MY_SRC/domvvl.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/tests/VORTEX/MY_SRC/domvvl.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/tests/VORTEX/MY_SRC/domvvl.F90	(revision 13807)
@@ -725,5 +725,9 @@
                &                           + e1e2t(ji+1,jj) * ( pe3_in(ji+1,jj,jk) - e3t_0(ji+1,jj,jk) ) )
          END_3D
+#if defined key_mpi3
+         CALL lbc_lnk_nc_multi( 'domvvl', pe3_out(:,:,:), 'U', 1._wp )
+#else
          CALL lbc_lnk( 'domvvl', pe3_out(:,:,:), 'U', 1._wp )
+#endif
          pe3_out(:,:,:) = pe3_out(:,:,:) + e3u_0(:,:,:)
          !
@@ -734,5 +738,9 @@
                &                           + e1e2t(ji,jj+1) * ( pe3_in(ji,jj+1,jk) - e3t_0(ji,jj+1,jk) ) )
          END_3D
+#if defined key_mpi3
+         CALL lbc_lnk_nc_multi( 'domvvl', pe3_out(:,:,:), 'V', 1._wp )
+#else
          CALL lbc_lnk( 'domvvl', pe3_out(:,:,:), 'V', 1._wp )
+#endif
          pe3_out(:,:,:) = pe3_out(:,:,:) + e3v_0(:,:,:)
          !
@@ -744,5 +752,9 @@
                &                           + e1e2u(ji,jj+1) * ( pe3_in(ji,jj+1,jk) - e3u_0(ji,jj+1,jk) ) )
          END_3D
+#if defined key_mpi3
+         CALL lbc_lnk_nc_multi( 'domvvl', pe3_out(:,:,:), 'F', 1._wp )
+#else
          CALL lbc_lnk( 'domvvl', pe3_out(:,:,:), 'F', 1._wp )
+#endif
          pe3_out(:,:,:) = pe3_out(:,:,:) + e3f_0(:,:,:)
          !
Index: /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/tests/VORTEX/MY_SRC/usrdef_zgr.F90
===================================================================
--- /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/tests/VORTEX/MY_SRC/usrdef_zgr.F90	(revision 13806)
+++ /NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/tests/VORTEX/MY_SRC/usrdef_zgr.F90	(revision 13807)
@@ -190,5 +190,9 @@
       z2d(:,:) = REAL( jpkm1 , wp )          ! flat bottom
       !
+#if defined key_mpi3
+      CALL lbc_lnk_nc_multi( 'usrdef_zgr', z2d, 'T', 1. )           ! set surrounding land to zero (here jperio=0 ==>> closed)
+#else
       CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )           ! set surrounding land to zero (here jperio=0 ==>> closed)
+#endif
       !
       k_bot(:,:) = NINT( z2d(:,:) )          ! =jpkm1 over the ocean point, =0 elsewhere
