Index: branches/2011/dev_r2802_MERCATOR9_floats/NEMOGCM/NEMO/OPA_SRC/FLO/flodom.F90
===================================================================
--- branches/2011/dev_r2802_MERCATOR9_floats/NEMOGCM/NEMO/OPA_SRC/FLO/flodom.F90	(revision 2835)
+++ branches/2011/dev_r2802_MERCATOR9_floats/NEMOGCM/NEMO/OPA_SRC/FLO/flodom.F90	(revision 2839)
@@ -43,8 +43,11 @@
       !!               the longitude (degree) and the depth (m).
       !!----------------------------------------------------------------------      
-      LOGICAL  ::   llinmesh
-      INTEGER  ::   ji, jj, jk   ! DO loop index on 3 directions
-      INTEGER  ::   jfl, jfl1    ! number of floats   
-      INTEGER  ::   inum         ! logical unit for file read
+      CHARACTER (len=21) ::  clname        ! floats initialisation filename
+      LOGICAL            ::   llinmesh
+      INTEGER            ::   ji, jj, jk   ! DO loop index on 3 directions
+      INTEGER            ::   jfl, jfl1    ! number of floats   
+      INTEGER            ::   inum         ! logical unit for file read
+      INTEGER            ::   jtrash       ! trash var for reading  
+      INTEGER            ::   ierr
       INTEGER, DIMENSION(jpnfl) ::   iimfl, ijmfl, ikmfl       ! index mesh of floats
       INTEGER, DIMENSION(jpnfl) ::   idomfl,  ivtest, ihtest   !   -             -
@@ -66,5 +69,5 @@
 
          ! read of the restart file
-         READ(inum) ( tpifl  (jfl), jfl=1, jpnrstflo),   & 
+         READ(inum,*)   ( tpifl  (jfl), jfl=1, jpnrstflo),   & 
                         ( tpjfl  (jfl), jfl=1, jpnrstflo),   &
                         ( tpkfl  (jfl), jfl=1, jpnrstflo),   &
@@ -208,120 +211,182 @@
          ENDIF
       ELSE
-         IF(lwp) WRITE(numout,*) '                     init_float read '
+
+         IF( ln_ariane )THEN
+
+            IF(lwp) WRITE(numout,*) '                     init_float read with ariane convention (mesh indexes)'
+
+            ! First initialisation of floats with ariane convention
+            ! 
+            ! The indexes are read directly from file (warning ariane
+            ! convention, are refered to 
+            ! U,V,W grids - and not T-) 
+            ! The isobar advection is managed with the sign of tpkfl ( >0 -> 3D
+            ! advection, <0 -> 2D) 
+            ! Some variables are not read, as - gl         : time index; 4th
+            ! column        
+            !                                 - transport  : transport ; 5th
+            !                                 column
+            ! and paste in the jtrash var
+            ! At the end, ones need to replace the indexes on T grid
+            ! RMQ : there is no float groups identification !
+ 
+            clname='init_float_ariane'
+
+            nisobfl = 1 ! we assume that by default we want 3D advection
+            
+            ! we check that the number of floats in the init_file are consistant
+            ! with the namelist
+            IF( lwp ) THEN 
+               jfl1=0
+               OPEN( unit=inum, file=clname,status='old',access='sequential',form='formatted')
+               DO WHILE (ierr .GE. 0)
+                 jfl1=jfl1+1
+                 READ (inum,*, iostat=ierr)
+               END DO
+               CLOSE(inum)
+               IF( (jfl1-1) .NE. jpnfl )THEN
+                  WRITE (numout,*) ' STOP the number of floats in' ,clname,'  = ',jfl1
+                  WRITE (numout,*) '  is not equal to jfl= ',jpnfl 
+                  STOP
+               ENDIF 
+            ENDIF 
+
+            ! we get the init values 
+            CALL ctl_opn( inum, clname, 'OLD', 'FORMATTED', 'SEQUENTIAL',   &
+               &         1, numout, .TRUE., 1 )
+            DO jfl = 1, jpnfl
+              READ(inum,*) tpifl(jfl),tpjfl(jfl),tpkfl(jfl),jtrash, jtrash
+              if(lwp)write(numout,*)"read : ",tpifl(jfl),tpjfl(jfl),tpkfl(jfl),jtrash, jtrash ; call flush(numout)
+ 
+              IF ( tpkfl(jfl) .LT. 0. ) nisobfl(jfl) = 0 !set the 2D advection according to init_float
+              ngrpfl(jfl)=jfl
+            END DO
+
+            ! conversion from ariane index to T grid index
+            tpkfl = abs(tpkfl)-0.5 ! reversed vertical axis
+            tpifl = tpifl+0.5 
+            tpjfl = tpjfl+0.5
+
+            ! verif of non land point initialisation : no need if correct init
+            
+         ELSE 
+            IF(lwp) WRITE(numout,*) '                     init_float read '
          
-         ! First initialisation of floats
-         ! the initials positions of floats are written in a file
-         ! with a variable to know if it is a isobar float a number 
-         ! to identified who want the trajectories of this float and 
-         ! an index for the number of the float         
-         ! open the init file 
-         CALL ctl_opn( inum, 'init_float', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp )
-         READ(inum) (flxx(jfl)   , jfl=1, jpnfl),   &
-                    (flyy(jfl)   , jfl=1, jpnfl),   &
-                    (flzz(jfl)   , jfl=1, jpnfl),   &
-                    (nisobfl(jfl), jfl=1, jpnfl),   &
-                    (ngrpfl(jfl) , jfl=1, jpnfl)
-         CLOSE(inum)
-            
-         ! Test to find the grid point coordonate with the geographical position         
-         DO jfl = 1, jpnfl
-            ihtest(jfl) = 0
-            ivtest(jfl) = 0
-            ikmfl(jfl) = 0
+            ! First initialisation of floats
+            ! the initials positions of floats are written in a file
+            ! with a variable to know if it is a isobar float a number 
+            ! to identified who want the trajectories of this float and 
+            ! an index for the number of the float         
+            ! open the init file 
+            CALL ctl_opn( inum, 'init_float', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp )
+            READ(inum,*) (flxx(jfl)   , jfl=1, jpnfl),   &
+                         (flyy(jfl)   , jfl=1, jpnfl),   &
+                         (flzz(jfl)   , jfl=1, jpnfl),   &
+                         (nisobfl(jfl), jfl=1, jpnfl),   &
+                         (ngrpfl(jfl) , jfl=1, jpnfl)
+            CLOSE(inum)
+            
+            ! Test to find the grid point coordonate with the geographical position         
+            DO jfl = 1, jpnfl
+              ihtest(jfl) = 0
+              ivtest(jfl) = 0
+              ikmfl(jfl) = 0
 # if   defined key_mpp_mpi
-            DO ji = MAX(nldi,2), nlei
-               DO jj = MAX(nldj,2), nlej   ! NO vector opt.
-# else
-            DO ji = 2, jpi
-               DO jj = 2, jpj   ! NO vector opt.
+               DO ji = MAX(nldi,2), nlei
+                  DO jj = MAX(nldj,2), nlej   ! NO vector opt.
+# else 
+               DO ji = 2, jpi
+                  DO jj = 2, jpj   ! NO vector opt.
 # endif                  
-                  ! for each float we find the indexes of the mesh 
+                     ! for each float we find the indexes of the mesh 
                   
-                  CALL findmesh(glamf(ji-1,jj-1),gphif(ji-1,jj-1),   &
-                                glamf(ji-1,jj  ),gphif(ji-1,jj  ),   &
-                                glamf(ji  ,jj  ),gphif(ji  ,jj  ),   &
-                                glamf(ji  ,jj-1),gphif(ji  ,jj-1),   &
-                                flxx(jfl)       ,flyy(jfl)       ,   &
-                                glamt(ji  ,jj  ),gphit(ji  ,jj  ), llinmesh)
-                  IF(llinmesh) THEN
-                     iimfl(jfl)  = ji
-                     ijmfl(jfl)  = jj
-                     ihtest(jfl) = ihtest(jfl)+1
-                     DO jk = 1, jpk-1
-                        IF( (fsdepw(ji,jj,jk) <= flzz(jfl)) .AND. (fsdepw(ji,jj,jk+1) >  flzz(jfl)) ) THEN
-                           ikmfl(jfl)  = jk
-                           ivtest(jfl) = ivtest(jfl) + 1
-                        ENDIF
-                     END DO
-                  ENDIF
+                     CALL findmesh(glamf(ji-1,jj-1),gphif(ji-1,jj-1),   &
+                                   glamf(ji-1,jj  ),gphif(ji-1,jj  ),   &
+                                   glamf(ji  ,jj  ),gphif(ji  ,jj  ),   &
+                                   glamf(ji  ,jj-1),gphif(ji  ,jj-1),   &
+                                   flxx(jfl)       ,flyy(jfl)       ,   &
+                                   glamt(ji  ,jj  ),gphit(ji  ,jj  ), llinmesh)
+                     IF(llinmesh) THEN
+                        iimfl(jfl)  = ji
+                        ijmfl(jfl)  = jj
+                        ihtest(jfl) = ihtest(jfl)+1
+                        DO jk = 1, jpk-1
+                           IF( (fsdepw(ji,jj,jk) <= flzz(jfl)) .AND. (fsdepw(ji,jj,jk+1) >  flzz(jfl)) ) THEN
+                              ikmfl(jfl)  = jk
+                              ivtest(jfl) = ivtest(jfl) + 1
+                           ENDIF
+                        END DO
+                     ENDIF
+                  END DO
                END DO
-            END DO
-            
-            ! If the float is in a mesh computed by an other processor we put iimfl=ijmfl=-1            
-            IF( ihtest(jfl) == 0 ) THEN
-               iimfl(jfl) = -1
-               ijmfl(jfl) = -1
-            ENDIF
-         END DO
+            
+               ! If the float is in a mesh computed by an other processor we put iimfl=ijmfl=-1            
+               IF( ihtest(jfl) == 0 ) THEN
+                  iimfl(jfl) = -1
+                  ijmfl(jfl) = -1
+               ENDIF
+            END DO
          
-         ! A zero in the sum of the arrays "ihtest" and "ivtest"          
-         IF( lk_mpp )   CALL mpp_sum(ihtest,jpnfl)   ! sums over the global domain
-         IF( lk_mpp )   CALL mpp_sum(ivtest,jpnfl)
-
-         DO jfl = 1, jpnfl
-            IF( (ihtest(jfl) > 1 ) .OR. ( ivtest(jfl) > 1 )) THEN
-               IF(lwp) WRITE(numout,*) 'THE FLOAT',jfl,' IS NOT IN ONLY ONE MESH'
-            ENDIF
-            IF( ihtest(jfl) == 0 ) THEN 
-               IF(lwp) WRITE(numout,*)'THE FLOAT',jfl,' IS IN NO MESH'
-            ENDIF
-         END DO
+            ! A zero in the sum of the arrays "ihtest" and "ivtest"          
+            IF( lk_mpp )   CALL mpp_sum(ihtest,jpnfl)   ! sums over the global domain
+            IF( lk_mpp )   CALL mpp_sum(ivtest,jpnfl)
+
+            DO jfl = 1, jpnfl
+               IF( (ihtest(jfl) > 1 ) .OR. ( ivtest(jfl) > 1 )) THEN
+                  IF(lwp) WRITE(numout,*) 'THE FLOAT',jfl,' IS NOT IN ONLY ONE MESH'
+               ENDIF
+               IF( ihtest(jfl) == 0 ) THEN 
+                  IF(lwp) WRITE(numout,*)'THE FLOAT',jfl,' IS IN NO MESH'
+               ENDIF
+            END DO
         
-         ! We compute the distance between the float and the face of  the mesh         
-         DO jfl = 1, jpnfl
-            ! Made only if the float is in the domain of the processor
-            IF( (iimfl(jfl) >= 0 ) .AND. ( ijmfl(jfl) >= 0 ) ) THEN
-               
-               ! TEST TO KNOW IF THE FLOAT IS NOT INITIALISED IN THE COAST
-               
-               idomfl(jfl) = 0
-               IF( tmask(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)) == 0. ) idomfl(jfl)=1
-               
-               ! Computation of the distance between the float
-               ! and the faces of the mesh
-               !            zdxab
-               !             .
-               !        B----.---------C
-               !        |    .         |
-               !        |<------>flo   |
-               !        |        ^     |
-               !        |        |.....|....zdyad
-               !        |        |     |
-               !        A--------|-----D
-               
-               zdxab = dstnce(flxx(jfl),flyy(jfl),glamf(iimfl(jfl)-1,ijmfl(jfl)-1),flyy(jfl))                
-               zdyad = dstnce(flxx(jfl),flyy(jfl),flxx(jfl),gphif(iimfl(jfl)-1,ijmfl(jfl)-1))
-               
-               ! Translation of this distances (in meter) in indexes
-               
-               tpifl(jfl) = (iimfl(jfl)-0.5)+zdxab/ e1u(iimfl(jfl)-1,ijmfl(jfl))+(mig(1)-jpizoom)
-               tpjfl(jfl) = (ijmfl(jfl)-0.5)+zdyad/ e2v(iimfl(jfl),ijmfl(jfl)-1)+(mjg(1)-jpjzoom)
-               tpkfl(jfl) = (fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)+1) - flzz(jfl))*(ikmfl(jfl))                     &
-                          / (fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)+1) - fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)))   &
-                          + (flzz(jfl) - fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)))*(ikmfl(jfl)+1)                     &
-                          / (fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)+1) - fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)))
-            ELSE
-               tpifl (jfl) = 0.e0
-               tpjfl (jfl) = 0.e0
-               tpkfl (jfl) = 0.e0
-               idomfl(jfl) = 0
-            ENDIF
-         END DO
+            ! We compute the distance between the float and the face of  the mesh         
+            DO jfl = 1, jpnfl
+               ! Made only if the float is in the domain of the processor
+               IF( (iimfl(jfl) >= 0 ) .AND. ( ijmfl(jfl) >= 0 ) ) THEN
+               
+                  ! TEST TO KNOW IF THE FLOAT IS NOT INITIALISED IN THE COAST
+               
+                  idomfl(jfl) = 0
+                  IF( tmask(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)) == 0. ) idomfl(jfl)=1
+               
+                  ! Computation of the distance between the float
+                  ! and the faces of the mesh
+                  !            zdxab
+                  !             .
+                  !        B----.---------C
+                  !        |    .         |
+                  !        |<------>flo   |
+                  !        |        ^     |
+                  !        |        |.....|....zdyad
+                  !        |        |     |
+                  !        A--------|-----D
+               
+                  zdxab = dstnce(flxx(jfl),flyy(jfl),glamf(iimfl(jfl)-1,ijmfl(jfl)-1),flyy(jfl))                
+                  zdyad = dstnce(flxx(jfl),flyy(jfl),flxx(jfl),gphif(iimfl(jfl)-1,ijmfl(jfl)-1))
+               
+                  ! Translation of this distances (in meter) in indexes
+               
+                  tpifl(jfl) = (iimfl(jfl)-0.5)+zdxab/ e1u(iimfl(jfl)-1,ijmfl(jfl))+(mig(1)-jpizoom)
+                  tpjfl(jfl) = (ijmfl(jfl)-0.5)+zdyad/ e2v(iimfl(jfl),ijmfl(jfl)-1)+(mjg(1)-jpjzoom)
+                  tpkfl(jfl) = (fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)+1) - flzz(jfl))*(ikmfl(jfl))                     &
+                             / (fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)+1) - fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)))   &
+                             + (flzz(jfl) - fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)))*(ikmfl(jfl)+1)                     &
+                             / (fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)+1) - fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)))
+               ELSE
+                  tpifl (jfl) = 0.e0
+                  tpjfl (jfl) = 0.e0
+                  tpkfl (jfl) = 0.e0
+                  idomfl(jfl) = 0
+               ENDIF
+            END DO
          
-         ! The sum of all the arrays tpifl, tpjfl, tpkfl give 3 arrays with the positions of all the floats. 
-         IF( lk_mpp )   CALL mpp_sum( tpifl , jpnfl )   ! sums over the global domain
-         IF( lk_mpp )   CALL mpp_sum( tpjfl , jpnfl )
-         IF( lk_mpp )   CALL mpp_sum( tpkfl , jpnfl )
-         IF( lk_mpp )   CALL mpp_sum( idomfl, jpnfl )
+            ! The sum of all the arrays tpifl, tpjfl, tpkfl give 3 arrays with the positions of all the floats. 
+            IF( lk_mpp )   CALL mpp_sum( tpifl , jpnfl )   ! sums over the global domain
+            IF( lk_mpp )   CALL mpp_sum( tpjfl , jpnfl )
+            IF( lk_mpp )   CALL mpp_sum( tpkfl , jpnfl )
+            IF( lk_mpp )   CALL mpp_sum( idomfl, jpnfl )
+         ENDIF
+
       ENDIF
             
