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 12560)
+++ 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
