Index: trunk/NEMO/OPA_SRC/FLO/flowri.F90
===================================================================
--- trunk/NEMO/OPA_SRC/FLO/flowri.F90	(revision 3)
+++ trunk/NEMO/OPA_SRC/FLO/flowri.F90	(revision 16)
@@ -15,4 +15,5 @@
    USE dom_oce         ! ocean space and time domain
    USE lib_mpp         ! distribued memory computing library
+   USE daymod
    USE in_out_manager  ! I/O manager
 
@@ -52,4 +53,5 @@
 
       !! * Local declarations
+      CHARACTER (len=21) ::  clname
       INTEGER ::   inum = 11       ! temporary logical unit for restart file
       INTEGER  ::   &
@@ -62,7 +64,5 @@
       REAL(wp) :: zafl,zbfl,zcfl,zdtj
       REAL(wp) :: zxxu, zxxu_01,zxxu_10, zxxu_11
-      REAL(wp) , DIMENSION ( jpk  , jpnfl) :: ztemp, zsal
-
-      CHARACTER (len=21) ::  clname
+      REAL(wp), DIMENSION (jpk,jpnfl) :: ztemp, zsal
       !!---------------------------------------------------------------------
       
@@ -86,28 +86,75 @@
             IF(lwp) WRITE(numflo)cexper,no,irecflo,jpnfl,nwritefl
          ENDIF
-         zdtj = rdt/86400.      
+         zdtj = rdt / 86400.      !!bug   use of 86400 instead of the phycst parameter
 
          ! translation of index position in geographical position
 
-         DO jfl = 1, jpnfl
-            iafl  = INT (tpifl(jfl))
-            ibfl  = INT (tpjfl(jfl))
-            icfl  = INT (tpkfl(jfl))
-            iafln = NINT(tpifl(jfl))
-            ibfln = NINT(tpjfl(jfl))
-            ia1fl = iafl+1
-            ib1fl = ibfl+1
-            ic1fl = icfl+1
-            zafl  = tpifl(jfl) - FLOAT(iafl)
-            zbfl  = tpjfl(jfl) - FLOAT(ibfl)
-            zcfl  = tpkfl(jfl) - FLOAT(icfl)
-# if defined key_mpp
-            IF( (iafl >= (mig(nldi)-jpizoom+1)) .AND. (iafl <= (mig(nlei)-jpizoom+1)) .AND.   &
-              (  ibfl >= (mjg(nldj)-jpjzoom+1)) .AND. (ibfl <= (mjg(nlej)-jpjzoom+1)) ) THEN
-
-               ! local index
-
-               iafloc  = iafl -(mig(1)-jpizoom+1) + 1
-               ibfloc  = ibfl -(mjg(1)-jpjzoom+1) + 1
+         IF( lk_mpp ) THEN
+            DO jfl = 1, jpnfl
+               iafl  = INT ( tpifl(jfl) )
+               ibfl  = INT ( tpjfl(jfl) )
+               icfl  = INT ( tpkfl(jfl) )
+               iafln = NINT( tpifl(jfl) )
+               ibfln = NINT( tpjfl(jfl) )
+               ia1fl = iafl + 1
+               ib1fl = ibfl + 1
+               ic1fl = icfl + 1
+               zafl  = tpifl(jfl) - FLOAT( iafl )
+               zbfl  = tpjfl(jfl) - FLOAT( ibfl )
+               zcfl  = tpkfl(jfl) - FLOAT( icfl )
+               IF(   iafl >= mig(nldi)-jpizoom+1 .AND. iafl <= mig(nlei)-jpizoom+1 .AND.   &
+                  &  ibfl >= mjg(nldj)-jpjzoom+1 .AND. ibfl <= mjg(nlej)-jpjzoom+1       ) THEN
+
+                  ! local index
+
+                  iafloc  = iafl -(mig(1)-jpizoom+1) + 1
+                  ibfloc  = ibfl -(mjg(1)-jpjzoom+1) + 1
+                  ia1floc = iafloc + 1
+                  ib1floc = ibfloc + 1
+
+                  flyy(jfl) = (1.-zafl)*(1.-zbfl)*gphit(iafloc ,ibfloc ) + (1.-zafl) * zbfl * gphit(iafloc ,ib1floc)   &
+                     &      +     zafl *(1.-zbfl)*gphit(ia1floc,ibfloc ) +     zafl  * zbfl * gphit(ia1floc,ib1floc)
+                  flxx(jfl) = (1.-zafl)*(1.-zbfl)*glamt(iafloc ,ibfloc ) + (1.-zafl) * zbfl * glamt(iafloc ,ib1floc)   &
+                     &      +     zafl *(1.-zbfl)*glamt(ia1floc,ibfloc ) +     zafl  * zbfl * glamt(ia1floc,ib1floc)
+                  flzz(jfl) = (1.-zcfl)*fsdepw(iafloc,ibfloc,icfl ) + zcfl * fsdepw(iafloc,ibfloc,ic1fl)
+
+                  ! Change  by Alexandra Bozec et Jean-Philippe Boulanger
+                  ! We save  the instantaneous profile of T and S of the column     
+                  ! ztemp(jfl)=tn(iafloc,ibfloc,icfl)
+                  ! zsal(jfl)=sn(iafloc,ibfloc,icfl)
+                  ztemp(1:jpk,jfl) = tn(iafloc,ibfloc,1:jpk)
+                  zsal (1:jpk,jfl) = sn(iafloc,ibfloc,1:jpk)            
+               ELSE
+                  flxx(jfl) = 0.
+                  flyy(jfl) = 0.
+                  flzz(jfl) = 0.
+                  ztemp(1:jpk,jfl) = 0.
+                  zsal (1:jpk,jfl) = 0.
+               ENDIF
+            END DO
+
+            CALL mpp_sum( flxx, jpnfl )   ! sums over the global domain
+            CALL mpp_sum( flyy, jpnfl )
+            CALL mpp_sum( flzz, jpnfl )
+            ! these 2 lines have accendentaly been removed from ATL6-V8 run hence
+            ! giving 0 salinity and temperature on the float trajectory
+            CALL mpp_sum( ztemp, jpk*jpnfl )
+            CALL mpp_sum( zsal , jpk*jpnfl )
+
+         ELSE
+            DO jfl = 1, jpnfl
+               iafl  = INT (tpifl(jfl))
+               ibfl  = INT (tpjfl(jfl))
+               icfl  = INT (tpkfl(jfl))
+               iafln = NINT(tpifl(jfl))
+               ibfln = NINT(tpjfl(jfl))
+               ia1fl = iafl+1
+               ib1fl = ibfl+1
+               ic1fl = icfl+1
+               zafl  = tpifl(jfl) - FLOAT(iafl)
+               zbfl  = tpjfl(jfl) - FLOAT(ibfl)
+               zcfl  = tpkfl(jfl) - FLOAT(icfl)
+               iafloc  = iafl
+               ibfloc  = ibfl
                ia1floc = iafloc + 1
                ib1floc = ibfloc + 1
@@ -118,60 +165,25 @@
                          +     zafl *(1.-zbfl)*glamt(ia1floc,ibfloc ) +     zafl  * zbfl * glamt(ia1floc,ib1floc)
                flzz(jfl) = (1.-zcfl)*fsdepw(iafloc,ibfloc,icfl ) + zcfl * fsdepw(iafloc,ibfloc,ic1fl)
-
+               !ALEX
+               ! Astuce pour ne pas avoir des flotteurs qui se baladent sur IDL
+               zxxu_11 = glamt(iafloc ,ibfloc )
+               zxxu_10 = glamt(iafloc ,ib1floc)
+               zxxu_01 = glamt(ia1floc,ibfloc )
+               zxxu    = glamt(ia1floc,ib1floc)
+
+               IF( iafloc == 52 )  zxxu_10 = -181
+               IF( iafloc == 52 )  zxxu_11 = -181
+               flxx(jfl)=(1.-zafl)*(1.-zbfl)* zxxu_11 + (1.-zafl)*    zbfl * zxxu_10   &
+                        +    zafl *(1.-zbfl)* zxxu_01 +     zafl *    zbfl * zxxu
+               !ALEX         
                ! Change  by Alexandra Bozec et Jean-Philippe Boulanger
                ! We save  the instantaneous profile of T and S of the column     
-               ! ztemp(jfl)=tn(iafloc,ibfloc,icfl)
-               ! zsal(jfl)=sn(iafloc,ibfloc,icfl)
+               !     ztemp(jfl)=tn(iafloc,ibfloc,icfl)
+               !     zsal(jfl)=sn(iafloc,ibfloc,icfl)
                ztemp(1:jpk,jfl) = tn(iafloc,ibfloc,1:jpk)
-               zsal (1:jpk,jfl) = sn(iafloc,ibfloc,1:jpk)            
-            ELSE
-               flxx(jfl) = 0.
-               flyy(jfl) = 0.
-               flzz(jfl) = 0.
-               ztemp(1:jpk,jfl) = 0.
-               zsal (1:jpk,jfl) = 0.
-            ENDIF
-# else
-            iafloc  = iafl
-            ibfloc  = ibfl
-            ia1floc = iafloc + 1
-            ib1floc = ibfloc + 1
-            !
-            flyy(jfl) = (1.-zafl)*(1.-zbfl)*gphit(iafloc ,ibfloc ) + (1.-zafl) * zbfl * gphit(iafloc ,ib1floc)   &
-                      +     zafl *(1.-zbfl)*gphit(ia1floc,ibfloc ) +     zafl  * zbfl * gphit(ia1floc,ib1floc)
-            flxx(jfl) = (1.-zafl)*(1.-zbfl)*glamt(iafloc ,ibfloc ) + (1.-zafl) * zbfl * glamt(iafloc ,ib1floc)   &
-                      +     zafl *(1.-zbfl)*glamt(ia1floc,ibfloc ) +     zafl  * zbfl * glamt(ia1floc,ib1floc)
-            flzz(jfl) = (1.-zcfl)*fsdepw(iafloc,ibfloc,icfl ) + zcfl * fsdepw(iafloc,ibfloc,ic1fl)
-            !ALEX
-            ! Astuce pour ne pas avoir des flotteurs qui se baladent sur IDL
-            zxxu_11 = glamt(iafloc ,ibfloc )
-            zxxu_10 = glamt(iafloc ,ib1floc)
-            zxxu_01 = glamt(ia1floc,ibfloc )
-            zxxu    = glamt(ia1floc,ib1floc)
-
-            IF( iafloc == 52 )  zxxu_10 = -181
-            IF( iafloc == 52 )  zxxu_11 = -181
-            flxx(jfl)=(1.-zafl)*(1.-zbfl)* zxxu_11 + (1.-zafl)*    zbfl * zxxu_10   &
-                     +    zafl *(1.-zbfl)* zxxu_01 +     zafl *    zbfl * zxxu
-            !ALEX         
-            ! Change  by Alexandra Bozec et Jean-Philippe Boulanger
-            ! We save  the instantaneous profile of T and S of the column     
-            !     ztemp(jfl)=tn(iafloc,ibfloc,icfl)
-            !     zsal(jfl)=sn(iafloc,ibfloc,icfl)
-            ztemp(1:jpk,jfl) = tn(iafloc,ibfloc,1:jpk)
-            zsal (1:jpk,jfl) = sn(iafloc,ibfloc,1:jpk)
-# endif
-         END DO
-
-# if defined key_mpp
-         CALL mpp_sum( flxx, jpnfl )
-         CALL mpp_sum( flyy, jpnfl )
-         CALL mpp_sum( flzz, jpnfl )
-         ! these 2 lines have accendentaly been removed from ATL6-V8 run hence
-         ! giving 0 salinity and temperature on the float trajectory
-         CALL mpp_sum( ztemp, jpk*jpnfl )
-         CALL mpp_sum( zsal , jpk*jpnfl )
-
-# endif
+               zsal (1:jpk,jfl) = sn(iafloc,ibfloc,1:jpk)
+            END DO
+         ENDIF
+
          !
          WRITE(numflo) flxx,flyy,flzz,nisobfl,ngrpfl,ztemp,zsal, FLOAT(ndastp)
@@ -187,5 +199,5 @@
       !         iafln=NINT(tpifl(jfl))
       !         ibfln=NINT(tpjfl(jfl))
-      !# if defined key_mpp
+      !# if defined key_mpp_mpi   ||   defined key_mpp_shmem
       !        IF ( (iafl >= (mig(nldi)-jpizoom+1)) .AND.
       !     $       (iafl <= (mig(nlei)-jpizoom+1)) .AND.
@@ -206,5 +218,5 @@
       !         ztemp(jfl)=tn(iafloc,ibfloc,jk)
       !         zsal(jfl)=sn(iaflo!,ibfloc,jk)
-      !# if defined key_mpp
+      !# if defined key_mpp_mpi   ||   defined key_mpp_shmem
       !        ELSE
       !         ztemp(jfl) = 0.
@@ -214,8 +226,7 @@
       !! ... next float
       !        END DO
-      !#if defined key_mpp
-      !      CALL mpp_sum( ztemp, jpnfl )
-      !      CALL mpp_sum( zsal , jpnfl )
-      !# endif
+      !      IF( lk_mpp )   CALL mpp_sum( ztemp, jpnfl )
+      !      IF( lk_mpp )   CALL mpp_sum( zsal , jpnfl )
+      !
       !      IF (lwp) THEN 
       !         WRITE(numflo) ztemp, zsal
@@ -268,24 +279,24 @@
          ! Compute the number of trajectories for each processor
          !
-# if defined key_mpp
-         DO jfl = 1, jpnfl
-            IF( (INT(tpifl(jfl)) >= (mig(nldi)-jpizoom+1)) .AND.   &
-              (  INT(tpifl(jfl)) <= (mig(nlei)-jpizoom+1)) .AND.   &
-              (  INT(tpjfl(jfl)) >= (mjg(nldj)-jpjzoom+1)) .AND.   &
-              (  INT(tpjfl(jfl)) <= (mjg(nlej)-jpjzoom+1)) ) THEN
-               iproc(narea) = iproc(narea)+1
-            ENDIF
-         END DO
-         CALL mpp_sum( iproc, jpnij )
-         !
-         IF(lwp) THEN 
-            WRITE(numout,*) 'DATE',adatrj
-            DO jpn = 1, jpnij
-               IF( iproc(jpn) /= 0 ) THEN
-                  WRITE(numout,*)'PROCESSOR',jpn-1,'compute',iproc(jpn), 'trajectories.'
+         IF( lk_mpp ) THEN
+            DO jfl = 1, jpnfl
+               IF( (INT(tpifl(jfl)) >= (mig(nldi)-jpizoom+1)) .AND.   &
+                  &(INT(tpifl(jfl)) <= (mig(nlei)-jpizoom+1)) .AND.   &
+                  &(INT(tpjfl(jfl)) >= (mjg(nldj)-jpjzoom+1)) .AND.   &
+                  &(INT(tpjfl(jfl)) <= (mjg(nlej)-jpjzoom+1)) ) THEN
+                  iproc(narea) = iproc(narea)+1
                ENDIF
             END DO
-         ENDIF
-# endif
+            CALL mpp_sum( iproc, jpnij )
+            !
+            IF(lwp) THEN 
+               WRITE(numout,*) 'DATE',adatrj
+               DO jpn = 1, jpnij
+                  IF( iproc(jpn) /= 0 ) THEN
+                     WRITE(numout,*)'PROCESSOR',jpn-1,'compute',iproc(jpn), 'trajectories.'
+                  ENDIF
+               END DO
+            ENDIF
+         ENDIF
       ENDIF 
 
