Index: branches/2016/dev_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcdta.F90
===================================================================
--- branches/2016/dev_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcdta.F90	(revision 7402)
+++ branches/2016/dev_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcdta.F90	(revision 7403)
@@ -9,5 +9,5 @@
    !!            3.4   !  2010-11  (C. Ethe, G. Madec)  use of fldread + dynamical allocation 
    !!            3.5   !  2013-08  (M. Vichi)  generalization for other BGC models
-   !!            3.6   !  2015-03  (T. Lovato) revision of code log info
+   !!            3.6   !  2015-03  (T. Lovato) revisit code I/O
    !!----------------------------------------------------------------------
 #if defined key_top 
@@ -28,5 +28,5 @@
 
    PUBLIC   trc_dta         ! called in trcini.F90 and trcdmp.F90
-   PUBLIC   trc_dta_init    ! called in trcini.F90 
+   PUBLIC   trc_dta_ini     ! called in trcini.F90 
 
    INTEGER  , SAVE, PUBLIC                             :: nb_trcdta   ! number of tracers to be initialised with data
@@ -45,7 +45,7 @@
 CONTAINS
 
-   SUBROUTINE trc_dta_init(ntrc)
-      !!----------------------------------------------------------------------
-      !!                   ***  ROUTINE trc_dta_init  ***
+   SUBROUTINE trc_dta_ini(ntrc)
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE trc_dta_ini  ***
       !!                    
       !! ** Purpose :   initialisation of passive tracer input data 
@@ -70,9 +70,9 @@
       !!----------------------------------------------------------------------
       !
-      IF( nn_timing == 1 )  CALL timing_start('trc_dta_init')
+      IF( nn_timing == 1 )  CALL timing_start('trc_dta_ini')
       !
       IF( lwp ) THEN
          WRITE(numout,*) ' '
-         WRITE(numout,*) '  trc_dta_init : Tracers Initial Conditions (IC)'
+         WRITE(numout,*) '  trc_dta_ini : Tracers Initial Conditions (IC)'
          WRITE(numout,*) '  ~~~~~~~~~~~ '
       ENDIF
@@ -83,5 +83,5 @@
       ALLOCATE( n_trc_index(ntrc), slf_i(ntrc), STAT=ierr0 )
       IF( ierr0 > 0 ) THEN
-         CALL ctl_stop( 'trc_dta_init: unable to allocate n_trc_index' )   ;   RETURN
+         CALL ctl_stop( 'trc_dta_ini: unable to allocate n_trc_index' )   ;   RETURN
       ENDIF
       nb_trcdta      = 0
@@ -103,9 +103,9 @@
       REWIND( numnat_ref )              ! Namelist namtrc_dta in reference namelist : Passive tracer input data
       READ  ( numnat_ref, namtrc_dta, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dta_init in reference namelist', lwp )
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dta_ini in reference namelist', lwp )
 
       REWIND( numnat_cfg )              ! Namelist namtrc_dta in configuration namelist : Passive tracer input data
       READ  ( numnat_cfg, namtrc_dta, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dta_init in configuration namelist', lwp )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dta_ini in configuration namelist', lwp )
       IF(lwm) WRITE ( numont, namtrc_dta )
 
@@ -118,5 +118,5 @@
                zfact  = rn_trfac(jn)
                IF( clndta /=  clntrc ) THEN 
-                  CALL ctl_warn( 'trc_dta_init: passive tracer data initialisation    ',   &
+                  CALL ctl_warn( 'trc_dta_ini: passive tracer data initialisation    ',   &
                   &              'Input name of data file : '//TRIM(clndta)//   &
                   &              ' differs from that of tracer : '//TRIM(clntrc)//' ')
@@ -132,5 +132,5 @@
          ALLOCATE( sf_trcdta(nb_trcdta), rf_trfac(nb_trcdta), STAT=ierr1 )
          IF( ierr1 > 0 ) THEN
-            CALL ctl_stop( 'trc_dta_init: unable to allocate  sf_trcdta structure' )   ;   RETURN
+            CALL ctl_stop( 'trc_dta_ini: unable to allocate  sf_trcdta structure' )   ;   RETURN
          ENDIF
          !
@@ -143,5 +143,5 @@
                IF( sn_trcdta(jn)%ln_tint )  ALLOCATE( sf_trcdta(jl)%fdta(jpi,jpj,jpk,2) , STAT=ierr3 )
                IF( ierr2 + ierr3 > 0 ) THEN
-                 CALL ctl_stop( 'trc_dta_init : unable to allocate passive tracer data arrays' )   ;   RETURN
+                 CALL ctl_stop( 'trc_dta_ini : unable to allocate passive tracer data arrays' )   ;   RETURN
                ENDIF
             ENDIF
@@ -149,15 +149,15 @@
          ENDDO
          !                         ! fill sf_trcdta with slf_i and control print
-         CALL fld_fill( sf_trcdta, slf_i, cn_dir, 'trc_dta_init', 'Passive tracer data', 'namtrc' )
+         CALL fld_fill( sf_trcdta, slf_i, cn_dir, 'trc_dta_ini', 'Passive tracer data', 'namtrc' )
          !
       ENDIF
       !
       DEALLOCATE( slf_i )          ! deallocate local field structure
-      IF( nn_timing == 1 )  CALL timing_stop('trc_dta_init')
-      !
-   END SUBROUTINE trc_dta_init
-
-
-   SUBROUTINE trc_dta( kt, sf_trcdta, ptrfac, ptrc)
+      IF( nn_timing == 1 )  CALL timing_stop('trc_dta_ini')
+      !
+   END SUBROUTINE trc_dta_ini
+
+
+   SUBROUTINE trc_dta( kt, sf_trcdta, ztrcfac, ztrcdta)
       !!----------------------------------------------------------------------
       !!                   ***  ROUTINE trc_dta  ***
@@ -169,15 +169,14 @@
       !!              - ln_trcdmp=F: deallocates the data structure as they are not used
       !!
-      !! ** Action  :   sf_trcdta   passive tracer data on medl mesh and interpolated at time-step kt
-      !!----------------------------------------------------------------------
-      INTEGER                     , INTENT(in   ) ::   kt     ! ocean time-step
-      TYPE(FLD), DIMENSION(1)     , INTENT(inout) ::   sf_trcdta     ! array of information on the field to read
-      REAL(wp)                    , INTENT(in   ) ::   ptrfac  ! multiplication factor
-      REAL(wp), DIMENSION(jpi,jpj,jpk), OPTIONAL  , INTENT(out  ) ::   ptrc
+      !! ** Action  :   sf_trcdta   passive tracer data on meld mesh and interpolated at time-step kt
+      !!----------------------------------------------------------------------
+      INTEGER                          , INTENT(in   )   ::   kt         ! ocean time-step
+      TYPE(FLD), DIMENSION(1)          , INTENT(inout)   ::   sf_trcdta  ! array of information on the field to read
+      REAL(wp)                         , INTENT(in   )   ::   ztrcfac    ! multiplication factor
+      REAL(wp),  DIMENSION(jpi,jpj,jpk), INTENT(inout  ) ::   ztrcdta    ! 3D data array
       !
       INTEGER ::   ji, jj, jk, jl, jkk, ik    ! dummy loop indices
       REAL(wp)::   zl, zi
       REAL(wp), DIMENSION(jpk) ::  ztp                ! 1D workspace
-      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta   ! 3D  workspace
       CHARACTER(len=100) :: clndta
       !!----------------------------------------------------------------------
@@ -187,10 +186,9 @@
       IF( nb_trcdta > 0 ) THEN
          !
-         CALL wrk_alloc( jpi, jpj, jpk, ztrcdta )    ! Memory allocation
-         !
-         CALL fld_read( kt, 1, sf_trcdta )      !==   read data at kt time step   ==!
-         ztrcdta(:,:,:) = sf_trcdta(1)%fnow(:,:,:) * tmask(:,:,:)    ! Mask
-         !
-         IF( ln_sco ) THEN                   !==   s- or mixed s-zps-coordinate   ==!
+         ! read data at kt time step
+         CALL fld_read( kt, 1, sf_trcdta )
+         ztrcdta(:,:,:) = sf_trcdta(1)%fnow(:,:,:) * tmask(:,:,:)
+         ! 
+         IF( ln_sco ) THEN                !== s- or mixed s-zps-coordinate  ==!
             !
             IF( kt == nit000 .AND. lwp )THEN
@@ -205,11 +203,10 @@
                         ztp(jk) = ztrcdta(ji,jj,1)
                      ELSEIF( zl > gdept_1d(jpk) ) THEN         ! below the last level of data
-                        ztp(jk) =  ztrcdta(ji,jj,jpkm1)
+                        ztp(jk) = ztrcdta(ji,jj,jpkm1)
                      ELSE                                      ! inbetween : vertical interpolation between jkk & jkk+1
                         DO jkk = 1, jpkm1                                  ! when  gdept(jkk) < zl < gdept(jkk+1)
                            IF( (zl-gdept_1d(jkk)) * (zl-gdept_1d(jkk+1)) <= 0._wp ) THEN
                               zi = ( zl - gdept_1d(jkk) ) / (gdept_1d(jkk+1)-gdept_1d(jkk))
-                              ztp(jk) = ztrcdta(ji,jj,jkk) + ( ztrcdta(ji,jj,jkk+1) - &
-                                        ztrcdta(ji,jj,jkk) ) * zi 
+                              ztp(jk) = ztrcdta(ji,jj,jkk) + ( ztrcdta(ji,jj,jkk+1) - ztrcdta(ji,jj,jkk) ) * zi
                            ENDIF
                         END DO
@@ -217,5 +214,5 @@
                   END DO
                   DO jk = 1, jpkm1
-                    ztrcdta(ji,jj,jk) = ztp(jk) * tmask(ji,jj,jk)     ! mask required for mixed zps-s-coord
+                     ztrcdta(ji,jj,jk) = ztp(jk) * tmask(ji,jj,jk)     ! mask required for mixed zps-s-coord
                   END DO
                   ztrcdta(ji,jj,jpk) = 0._wp
@@ -224,6 +221,6 @@
             ! 
          ELSE                                !==   z- or zps- coordinate   ==!
-            !
-            IF( ln_zps ) THEN                      ! zps-coordinate (partial steps) interpolation at the last ocean level
+            ! zps-coordinate (partial steps) interpolation at the last ocean level
+            IF( ln_zps ) THEN
                DO jj = 1, jpj
                   DO ji = 1, jpi
@@ -244,14 +241,6 @@
          ENDIF
          !
-         ! Add multiplicative factor
-         ztrcdta(:,:,:) = ztrcdta(:,:,:) * ptrfac
-         !
-         ! Data structure for trc_ini (and BFMv5.1 coupling)
-         IF( .NOT. PRESENT(ptrc) ) sf_trcdta(1)%fnow(:,:,:) = ztrcdta(:,:,:)
-         !
-         ! Data structure for trc_dmp
-         IF( PRESENT(ptrc) )  ptrc(:,:,:) = ztrcdta(:,:,:)
-         !
-         CALL wrk_dealloc( jpi, jpj, jpk, ztrcdta )
+         ! Scale by multiplicative factor
+         ztrcdta(:,:,:) = ztrcdta(:,:,:) * ztrcfac
          !
       ENDIF
@@ -266,5 +255,5 @@
    !!----------------------------------------------------------------------
 CONTAINS
-   SUBROUTINE trc_dta( kt, sf_trcdta, ptrfac, ptrc)        ! Empty routine
+   SUBROUTINE trc_dta( kt, sf_trcdta, ztrcfac, ztrcdta)        ! Empty routine
       WRITE(*,*) 'trc_dta: You should not have seen this print! error?', kt
    END SUBROUTINE trc_dta
