Index: branches/2011/dev_r2855_NOCS_mppsca/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90
===================================================================
--- branches/2011/dev_r2855_NOCS_mppsca/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 2883)
+++ branches/2011/dev_r2855_NOCS_mppsca/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 2899)
@@ -2233,5 +2233,5 @@
       INTEGER ::   ierr, itaille, ildi, ilei, iilb
       INTEGER ::   ijpj, ijpjm1, ij, iproc
-      INTEGER, DIMENSION (jpmaxngh)          ::   ml_req5            ! for mpi_isend when avoiding mpi_allgather
+      INTEGER, DIMENSION (jpmaxngh)          ::   ml_req_nf          ! for mpi_isend when avoiding mpi_allgather
       INTEGER                                ::   ml_err             ! for mpi_isend when avoiding mpi_allgather
       INTEGER, DIMENSION(MPI_STATUS_SIZE)    ::   ml_stat            ! for mpi_isend when avoiding mpi_allgather
@@ -2251,61 +2251,57 @@
       itaille = jpi * jpk * ijpj
       IF ( l_north_nogather ) THEN
-!
-! Avoid the use of mpi_allgather by exchanging only with the processes already identified (in nemo_northcomms)
-! as being  involved in this process' northern boundary exchange
-!
-! First put local values into the global arraay
-         DO jj = nlcj-ijpj+1, nlcj
-           ij = jj - nlcj + ijpj
-           DO ji = 1, nlci
-             ztab(ji+nimpp-1,ij,:) = pt3d(ji,jj,:)
-           END DO
-         END DO
-
-!
-! Set the exchange type in order to access the correct list of active neighbours
-!
+         !
+         ! Avoid the use of mpi_allgather by exchanging only with the processes already identified 
+         ! (in nemo_northcomms) as being  involved in this process' northern boundary exchange
+         !
+         DO jj = nlcj-ijpj+1, nlcj          ! First put local values into the global array
+            ij = jj - nlcj + ijpj
+            DO ji = 1, nlci
+               ztab(ji+nimpp-1,ij,:) = pt3d(ji,jj,:)
+            END DO
+         END DO
+
+         !
+         ! Set the exchange type in order to access the correct list of active neighbours
+         !
          SELECT CASE ( cd_type )
             CASE ( 'T' , 'W' )
-             ityp = 1
+               ityp = 1
             CASE ( 'U' )
-             ityp = 2
+               ityp = 2
             CASE ( 'V' )
-             ityp = 3
+               ityp = 3
             CASE ( 'F' )
-             ityp = 4
+               ityp = 4
             CASE ( 'I' )
-             ityp = 5
+               ityp = 5
             CASE DEFAULT
-!
-! Set a default value for unsupported types which will cause a fallback to
-! the mpi_allgather method
-!
-             ityp = -1
-          END SELECT
-          IF ( ityp .gt. 0 ) THEN
-
-           DO jr = 1,nsndto(ityp)
-            CALL mppsend(5, znorthloc, itaille, isendto(jr,ityp), ml_req5(jr) )
-           END DO
-           DO jr = 1,nsndto(ityp)
-            CALL mpprecv(5, zfoldwk, itaille, isendto(jr,ityp))
-            iproc = isendto(jr,ityp) + 1
-            ildi=nldit (iproc)
-            ilei=nleit (iproc)
-            iilb=nimppt(iproc)
-            DO jj = 1, 4
-               DO ji = ildi, ilei
-                  ztab(ji+iilb-1,jj,:) = zfoldwk(ji,jj,:)
+               ityp = -1                    ! Set a default value for unsupported types which 
+                                            ! will cause a fallback to the mpi_allgather method
+         END SELECT
+         IF ( ityp .gt. 0 ) THEN
+
+            DO jr = 1,nsndto(ityp)
+               CALL mppsend(5, znorthloc, itaille, isendto(jr,ityp), ml_req_nf(jr) )
+            END DO
+            DO jr = 1,nsndto(ityp)
+               CALL mpprecv(5, zfoldwk, itaille, isendto(jr,ityp))
+               iproc = isendto(jr,ityp) + 1
+               ildi = nldit (iproc)
+               ilei = nleit (iproc)
+               iilb = nimppt(iproc)
+               DO jj = 1, ijpj
+                  DO ji = ildi, ilei
+                     ztab(ji+iilb-1,jj,:) = zfoldwk(ji,jj,:)
+                  END DO
                END DO
             END DO
-           END DO
-           IF(l_isend) THEN
-              DO jr = 1,nsndto(ityp)
-                CALL mpi_wait(ml_req5(jr), ml_stat, ml_err)
-              END DO
-           ENDIF
-
-          ENDIF
+            IF (l_isend) THEN
+               DO jr = 1,nsndto(ityp)
+                  CALL mpi_wait(ml_req_nf(jr), ml_stat, ml_err)
+               END DO
+            ENDIF
+
+         ENDIF
 
       ENDIF
@@ -2314,12 +2310,11 @@
          CALL MPI_ALLGATHER( znorthloc  , itaille, MPI_DOUBLE_PRECISION,                &
             &                znorthgloio, itaille, MPI_DOUBLE_PRECISION, ncomm_north, ierr )
-      !
-      !                                     ! recover the global north array
-         DO jr = 1, ndim_rank_north
+         !
+         DO jr = 1, ndim_rank_north         ! recover the global north array
             iproc = nrank_north(jr) + 1
             ildi  = nldit (iproc)
             ilei  = nleit (iproc)
             iilb  = nimppt(iproc)
-            DO jj = 1, 4
+            DO jj = 1, ijpj
                DO ji = ildi, ilei
                   ztab(ji+iilb-1,jj,:) = znorthgloio(ji,jj,:,jr)
@@ -2370,5 +2365,5 @@
       INTEGER ::   ierr, itaille, ildi, ilei, iilb
       INTEGER ::   ijpj, ijpjm1, ij, iproc
-      INTEGER, DIMENSION (jpmaxngh)      ::   ml_req5            ! for mpi_isend when avoiding mpi_allgather
+      INTEGER, DIMENSION (jpmaxngh)      ::   ml_req_nf          ! for mpi_isend when avoiding mpi_allgather
       INTEGER                            ::   ml_err             ! for mpi_isend when avoiding mpi_allgather
       INTEGER, DIMENSION(MPI_STATUS_SIZE)::   ml_stat            ! for mpi_isend when avoiding mpi_allgather
@@ -2388,81 +2383,76 @@
       itaille = jpi * ijpj
       IF ( l_north_nogather ) THEN
-!
-! Avoid the use of mpi_allgather by exchanging only with the processes already identified (in nemo_northcomms) 
-! as being  involved in this process' northern boundary exchange
-!
-! First put local values into the global array
-!
-         DO jj = nlcj-ijpj+1, nlcj
-           ij = jj - nlcj + ijpj
-           DO ji = 1, nlci
-             ztab_2d(ji+nimpp-1,ij) = pt2d(ji,jj)
-           END DO
-         END DO
-
-!
-! Set the exchange type in order to access the correct list of active neighbours
-!
+         !
+         ! Avoid the use of mpi_allgather by exchanging only with the processes already identified 
+         ! (in nemo_northcomms) as being  involved in this process' northern boundary exchange
+         !
+         DO jj = nlcj-ijpj+1, nlcj          ! First put local values into the global array
+            ij = jj - nlcj + ijpj
+            DO ji = 1, nlci
+               ztab_2d(ji+nimpp-1,ij) = pt2d(ji,jj)
+            END DO
+         END DO
+
+         !
+         ! Set the exchange type in order to access the correct list of active neighbours
+         !
          SELECT CASE ( cd_type )
             CASE ( 'T' , 'W' )
-             ityp = 1
+               ityp = 1
             CASE ( 'U' )
-             ityp = 2
+               ityp = 2
             CASE ( 'V' )
-             ityp = 3
+               ityp = 3
             CASE ( 'F' )
-             ityp = 4
+               ityp = 4
             CASE ( 'I' )
-             ityp = 5
+               ityp = 5
             CASE DEFAULT
-!
-! Set a default value for unsupported types which will cause a fallback to
-! the mpi_allgather method
-!
-             ityp = -1
-          END SELECT
-
-          IF ( ityp .gt. 0 ) THEN
-
-           DO jr = 1,nsndto(ityp)
-            CALL mppsend(5, znorthloc_2d, itaille, isendto(jr,ityp), ml_req5(jr) )
-           END DO
-           DO jr = 1,nsndto(ityp)
-            CALL mpprecv(5, zfoldwk_2d, itaille, isendto(jr,ityp))
-            iproc = isendto(jr,ityp) + 1
-            ildi=nldit (iproc)
-            ilei=nleit (iproc)
-            iilb=nimppt(iproc)
-            DO jj = 1, 4
-               DO ji = ildi, ilei
-                  ztab_2d(ji+iilb-1,jj) = zfoldwk_2d(ji,jj)
+               ityp = -1                    ! Set a default value for unsupported types which 
+                                            ! will cause a fallback to the mpi_allgather method
+         END SELECT
+
+         IF ( ityp .gt. 0 ) THEN
+
+            DO jr = 1,nsndto(ityp)
+               CALL mppsend(5, znorthloc_2d, itaille, isendto(jr,ityp), ml_req_nf(jr) )
+            END DO
+            DO jr = 1,nsndto(ityp)
+               CALL mpprecv(5, zfoldwk_2d, itaille, isendto(jr,ityp))
+               iproc = isendto(jr,ityp) + 1
+               ildi = nldit (iproc)
+               ilei = nleit (iproc)
+               iilb = nimppt(iproc)
+               DO jj = 1, ijpj
+                  DO ji = ildi, ilei
+                     ztab_2d(ji+iilb-1,jj) = zfoldwk_2d(ji,jj)
+                  END DO
                END DO
             END DO
-           END DO
-           IF(l_isend) THEN
-              DO jr = 1,nsndto(ityp)
-                CALL mpi_wait(ml_req5(jr), ml_stat, ml_err)
-              END DO
-           ENDIF
-
-          ENDIF
+            IF (l_isend) THEN
+               DO jr = 1,nsndto(ityp)
+                  CALL mpi_wait(ml_req_nf(jr), ml_stat, ml_err)
+               END DO
+            ENDIF
+
+         ENDIF
 
       ENDIF
 
       IF ( ityp .lt. 0 ) THEN
-       CALL MPI_ALLGATHER( znorthloc_2d  , itaille, MPI_DOUBLE_PRECISION,        &
-          &                znorthgloio_2d, itaille, MPI_DOUBLE_PRECISION, ncomm_north, ierr )
-      !
-       DO jr = 1, ndim_rank_north            ! recover the global north array
-          iproc = nrank_north(jr) + 1
-          ildi=nldit (iproc)
-          ilei=nleit (iproc)
-          iilb=nimppt(iproc)
-          DO jj = 1, 4
-             DO ji = ildi, ilei
-                ztab_2d(ji+iilb-1,jj) = znorthgloio_2d(ji,jj,jr)
-             END DO
-          END DO
-       END DO
+         CALL MPI_ALLGATHER( znorthloc_2d  , itaille, MPI_DOUBLE_PRECISION,        &
+            &                znorthgloio_2d, itaille, MPI_DOUBLE_PRECISION, ncomm_north, ierr )
+         !
+         DO jr = 1, ndim_rank_north            ! recover the global north array
+            iproc = nrank_north(jr) + 1
+            ildi = nldit (iproc)
+            ilei = nleit (iproc)
+            iilb = nimppt(iproc)
+            DO jj = 1, ijpj
+               DO ji = ildi, ilei
+                  ztab_2d(ji+iilb-1,jj) = znorthgloio_2d(ji,jj,jr)
+               END DO
+            END DO
+         END DO
       ENDIF
       !
