Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/trcdmp.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/trcdmp.F90	(revision 2863)
+++ CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/trcdmp.F90	(revision 2865)
@@ -85,5 +85,5 @@
       CHARACTER (len=22) :: charout
       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrtrd
-      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta   ! 3D  workspace
+      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::  ztrcdta   ! 3D  workspace
       !!----------------------------------------------------------------------
       !
@@ -98,5 +98,6 @@
       IF( nb_trcdta > 0 ) THEN  ! Initialisation of tracer from a file that may also be used for damping
          !
-         CALL wrk_alloc( jpi, jpj, jpk, ztrcdta )    ! Memory allocation
+         CALL wrk_alloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )    ! Memory allocation
+         CALL trc_dta( kt, ztrcdta )   ! read tracer data at nit000
          !                                                          ! ===========
          DO jn = 1, jptra                                           ! tracer loop
@@ -105,9 +106,5 @@
             !
             IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
-               
                jl = n_trc_index(jn) 
-               CALL trc_dta( kt, sf_trcdta(jl) )   ! read tracer data at nit000
-               ztrcdta(:,:,:) = sf_trcdta(jl)%fnow(:,:,:) * tmask(:,:,:) * rf_trfac(jl)
-
                SELECT CASE ( nn_zdmp_tr )
                !
@@ -116,5 +113,5 @@
                      DO jj = 2, jpjm1
                         DO ji = fs_2, fs_jpim1   ! vector opt.
-                           ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) )
+                           ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk,jl) * rf_trfac(jl) - trb(ji,jj,jk,jn) )
                            tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra
                         END DO
@@ -127,5 +124,5 @@
                         DO ji = fs_2, fs_jpim1   ! vector opt.
                            IF( avt(ji,jj,jk) <= 5.e-4_wp )  THEN 
-                              ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) )
+                              ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk,jl) * rf_trfac(jl) - trb(ji,jj,jk,jn) )
                               tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra
                            ENDIF
@@ -139,5 +136,5 @@
                         DO ji = fs_2, fs_jpim1   ! vector opt.
                            IF( fsdept(ji,jj,jk) >= hmlp (ji,jj) ) THEN
-                              ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) )
+                              ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk,jl) * rf_trfac(jl) - trb(ji,jj,jk,jn) )
                               tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra
                            END IF
@@ -157,5 +154,5 @@
          END DO                                                     ! tracer loop
          !                                                          ! ===========
-         CALL wrk_dealloc( jpi, jpj, jpk, ztrcdta )
+         CALL wrk_dealloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )
       ENDIF
       !
@@ -187,4 +184,5 @@
       INTEGER :: ji , jj, jk, jn, jl, jc                     ! dummy loop indicesa
       INTEGER :: isrow                                      ! local index
+      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::  ztrcdta   ! 3D  workspace
 
       !!----------------------------------------------------------------------
@@ -298,13 +296,16 @@
          IF(lwp)  WRITE(numout,*)
          !
+         CALL wrk_alloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )    ! Memory allocation
+         CALL trc_dta( kt, ztrcdta )   ! read tracer data at nit000
+         !
          DO jn = 1, jptra
             IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
                 jl = n_trc_index(jn)
-                CALL trc_dta( kt, sf_trcdta(jl) )   ! read tracer data at nit000
+                IF(lwp)  WRITE(numout,*)
                 DO jc = 1, npncts
                    DO jk = 1, jpkm1
                       DO jj = nctsj1(jc), nctsj2(jc)
                          DO ji = nctsi1(jc), nctsi2(jc)
-                            trn(ji,jj,jk,jn) = sf_trcdta(jl)%fnow(ji,jj,jk) * tmask(ji,jj,jk) * rf_trfac(jl)
+                            trn(ji,jj,jk,jn) = ztrcdta(ji,jj,jk,jl) * rf_trfac(jl)
                             trb(ji,jj,jk,jn) = trn(ji,jj,jk,jn)
                          ENDDO
@@ -314,4 +315,5 @@
              ENDIF
           ENDDO
+          CALL wrk_dealloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )    ! Memory allocation
           !
       ENDIF
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/trcdta.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/trcdta.F90	(revision 2865)
+++ CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/trcdta.F90	(revision 2865)
@@ -0,0 +1,264 @@
+MODULE trcdta
+   !!======================================================================
+   !!                     ***  MODULE  trcdta  ***
+   !! TOP :  reads passive tracer data 
+   !!=====================================================================
+   !! History :   1.0  !  2002-04  (O. Aumont)  original code
+   !!              -   !  2004-03  (C. Ethe)  module
+   !!              -   !  2005-03  (O. Aumont, A. El Moussaoui) F90
+   !!            3.4   !  2010-11  (C. Ethe, G. Madec)  use of fldread + dynamical allocation 
+   !!            3.5   !  2013-08  (M. Vichi)  generalization for other BGC models
+   !!----------------------------------------------------------------------
+#if  defined key_top 
+   !!----------------------------------------------------------------------
+   !!   'key_top'                                                TOP model 
+   !!----------------------------------------------------------------------
+   !!   trc_dta    : read and time interpolated passive tracer data
+   !!----------------------------------------------------------------------
+   USE par_trc       !  passive tracers parameters
+   USE oce_trc       !  shared variables between ocean and passive tracers
+   USE trc           !  passive tracers common variables
+   USE iom           !  I/O manager
+   USE lib_mpp       !  MPP library
+   USE fldread       !  read input fields
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_dta         ! called in trcini.F90 and trcdmp.F90
+   PUBLIC   trc_dta_init    ! called in trcini.F90 
+
+   INTEGER  , SAVE, PUBLIC                             :: nb_trcdta   ! number of tracers to be initialised with data
+   INTEGER  , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: n_trc_index ! indice of tracer which is initialised with data
+   INTEGER  , SAVE, PUBLIC                             :: ntra        ! MAX( 1, nb_trcdta ) to avoid compilation error with bounds checking
+   REAL(wp) , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: rf_trfac    ! multiplicative factor for tracer values
+!$AGRIF_DO_NOT_TREAT
+   TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: sf_trcdta   ! structure of input SST (file informations, fields read)
+!$AGRIF_END_DO_NOT_TREAT
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
+   !! $Id: trcdta.F90 6308 2016-02-12 11:32:54Z cetlod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE trc_dta_init(ntrc)
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE trc_dta_init  ***
+      !!                    
+      !! ** Purpose :   initialisation of passive tracer input data 
+      !! 
+      !! ** Method  : - Read namtsd namelist
+      !!              - allocates passive tracer data structure 
+      !!----------------------------------------------------------------------
+      !
+      INTEGER,INTENT(IN) :: ntrc                             ! number of tracers
+      INTEGER            :: jl, jn                           ! dummy loop indices
+      INTEGER            :: ierr0, ierr1, ierr2, ierr3       ! temporary integers
+      INTEGER            :: ios                              ! Local integer output status for namelist read
+      CHARACTER(len=100) :: clndta, clntrc
+      REAL(wp)           :: zfact
+      !
+      CHARACTER(len=100)            :: cn_dir
+      TYPE(FLD_N), ALLOCATABLE, DIMENSION(:) :: slf_i ! array of namelist informations on the fields to read
+      TYPE(FLD_N), DIMENSION(jpmaxtrc) :: sn_trcdta
+      REAL(wp)   , DIMENSION(jpmaxtrc) :: rn_trfac    ! multiplicative factor for tracer values
+      !!
+      NAMELIST/namtrc_dta/ sn_trcdta, cn_dir, rn_trfac 
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('trc_dta_init')
+      !
+      !  Initialisation
+      ierr0 = 0  ;  ierr1 = 0  ;  ierr2 = 0  ;  ierr3 = 0  
+      ! Compute the number of tracers to be initialised with data
+      ALLOCATE( n_trc_index(ntrc), slf_i(ntrc), STAT=ierr0 )
+      IF( ierr0 > 0 ) THEN
+         CALL ctl_stop( 'trc_nam: unable to allocate n_trc_index' )   ;   RETURN
+      ENDIF
+      nb_trcdta      = 0
+      n_trc_index(:) = 0
+      DO jn = 1, ntrc
+         IF( ln_trc_ini(jn) ) THEN
+             nb_trcdta       = nb_trcdta + 1 
+             n_trc_index(jn) = nb_trcdta 
+         ENDIF
+      ENDDO
+      !
+      ntra = MAX( 1, nb_trcdta )   ! To avoid compilation error with bounds checking
+      IF(lwp) THEN
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' number of passive tracers to be initialize by data :', ntra
+         WRITE(numout,*) ' '
+      ENDIF
+      !
+      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 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 in configuration namelist', lwp )
+      IF(lwm) WRITE ( numont, namtrc_dta )
+
+      IF( lwp ) THEN
+         DO jn = 1, ntrc
+            IF( ln_trc_ini(jn) )  THEN    ! open input file only if ln_trc_ini(jn) is true
+               clndta = TRIM( sn_trcdta(jn)%clvar ) 
+               clntrc = TRIM( ctrcnm   (jn)       ) 
+               zfact  = rn_trfac(jn)
+               IF( clndta /=  clntrc ) THEN 
+                  CALL ctl_warn( 'trc_dta_init: passive tracer data initialisation :  ',   &
+                  &              'the variable name in the data file : '//clndta//   & 
+                  &              '  must be the same than the name of the passive tracer : '//clntrc//' ')
+               ENDIF
+               WRITE(numout,*) ' read an initial file for passive tracer number :', jn, ' name : ', clndta, & 
+               &               ' multiplicative factor : ', zfact
+            ENDIF
+         END DO
+      ENDIF
+      !
+      IF( nb_trcdta > 0 ) THEN       !  allocate only if the number of tracer to initialise is greater than zero
+         ALLOCATE( sf_trcdta(nb_trcdta), rf_trfac(nb_trcdta), STAT=ierr1 )
+         IF( ierr1 > 0 ) THEN
+            CALL ctl_stop( 'trc_dta_ini: unable to allocate  sf_trcdta structure' )   ;   RETURN
+         ENDIF
+         !
+         DO jn = 1, ntrc
+            IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
+               jl = n_trc_index(jn)
+               slf_i(jl)    = sn_trcdta(jn)
+               rf_trfac(jl) = rn_trfac(jn)
+                                            ALLOCATE( sf_trcdta(jl)%fnow(jpi,jpj,jpk)   , STAT=ierr2 )
+               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 : unable to allocate passive tracer data arrays' )   ;   RETURN
+               ENDIF
+            ENDIF
+            !   
+         ENDDO
+         !                         ! fill sf_trcdta with slf_i and control print
+         CALL fld_fill( sf_trcdta, slf_i, cn_dir, 'trc_dta', '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, ptrc )
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE trc_dta  ***
+      !!                    
+      !! ** Purpose :   provides passive tracer data at kt
+      !! 
+      !! ** Method  : - call fldread routine
+      !!              - s- or mixed z-s coordinate: vertical interpolation on model mesh
+      !!              - 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
+      REAL(wp), DIMENSION(jpi,jpj,jpk,nb_trcdta), INTENT(inout) ::   ptrc     ! array of information on the field to read
+      !
+      INTEGER ::   ji, jj, jk, jl, jkk, ik    ! dummy loop indices
+      REAL(wp)::   zl, zi
+      REAL(wp), DIMENSION(jpk) ::  ztp                ! 1D workspace
+      CHARACTER(len=100) :: clndta
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('trc_dta')
+      !
+      IF( nb_trcdta > 0 ) THEN
+         !
+         CALL fld_read( kt, 1, sf_trcdta )      !==   read data at kt time step   ==!
+         !
+         DO jl = 1, nb_trcdta
+            ptrc(:,:,:,jl) = sf_trcdta(jl)%fnow(:,:,:) * tmask(:,:,:)    ! Mask
+         ENDDO
+         !
+         IF( ln_sco ) THEN                   !==   s- or mixed s-zps-coordinate   ==!
+            !
+            IF( kt == nit000 .AND. lwp )THEN
+               WRITE(numout,*)
+               WRITE(numout,*) 'trc_dta: interpolates passive tracer data onto the s- or mixed s-z-coordinate mesh'
+            ENDIF
+            DO jl = 1, nb_trcdta
+               DO jj = 1, jpj                         ! vertical interpolation of T & S
+                  DO ji = 1, jpi
+                     DO jk = 1, jpk                        ! determines the intepolated T-S profiles at each (i,j) points
+                        zl = fsdept_n(ji,jj,jk)
+                        IF(     zl < gdept_1d(1  ) ) THEN         ! above the first level of data
+                           ztp(jk) =  ptrc(ji,jj,1,jl)
+                        ELSEIF( zl > gdept_1d(jpk) ) THEN         ! below the last level of data
+                           ztp(jk) =  ptrc(ji,jj,jpkm1,jl)
+                        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) = ptrc(ji,jj,jkk,jl) + ( ptrc(ji,jj,jkk+1,jl) - ptrc(ji,jj,jkk,jl) ) * zi 
+                              ENDIF
+                           END DO
+                        ENDIF
+                     END DO
+                     DO jk = 1, jpkm1
+                        ptrc(ji,jj,jk,jl) = ztp(jk) * tmask(ji,jj,jk)     ! mask required for mixed zps-s-coord
+                     END DO
+                     ptrc(ji,jj,jpk,jl) = 0._wp
+                  END DO
+               END DO
+            END DO
+            ! 
+         ELSE                                !==   z- or zps- coordinate   ==!
+            !                             
+            IF( ln_zps ) THEN                      ! zps-coordinate (partial steps) interpolation at the last ocean level
+               DO jl = 1, nb_trcdta
+                  !
+                  DO jj = 1, jpj
+                     DO ji = 1, jpi
+                        ik = mbkt(ji,jj) 
+                        IF( ik > 1 ) THEN
+                           zl = ( gdept_1d(ik) - fsdept_n(ji,jj,ik) ) / ( gdept_1d(ik) - gdept_1d(ik-1) )
+                           ptrc(ji,jj,ik,jl) = (1.-zl) * ptrc(ji,jj,ik,jl) + zl * ptrc(ji,jj,ik-1,jl)
+                        ENDIF
+                        ik = mikt(ji,jj)
+                        IF( ik > 1 ) THEN
+                           zl = ( gdept_0(ji,jj,ik) - gdept_1d(ik) ) / ( gdept_1d(ik+1) - gdept_1d(ik) )
+                           ptrc(ji,jj,ik,jl) = (1.-zl) * ptrc(ji,jj,ik,jl) + zl * ptrc(ji,jj,ik+1,jl)
+                        ENDIF
+                     END DO
+                  END DO
+              END DO
+            ENDIF
+            !
+         ENDIF
+         !
+      ENDIF
+      ! 
+      IF( .NOT.ln_trcdmp .AND. .NOT.ln_trcdmp_clo ) THEN      !== deallocate data structure   ==!
+        !                                                    (data used only for initialisation)
+        IF(lwp) WRITE(numout,*) 'trc_dta: deallocate data arrays as they are only used to initialize the run'
+        DO jl = 1, nb_trcdta
+                                        DEALLOCATE( sf_trcdta(jl)%fnow)     !  arrays in the structure
+           IF( sf_trcdta(jl)%ln_tint )  DEALLOCATE( sf_trcdta(jl)%fdta)
+        ENDDO
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('trc_dta')
+      !
+   END SUBROUTINE trc_dta
+#else
+   !!----------------------------------------------------------------------
+   !!   Dummy module                              NO 3D passive tracer data
+   !!----------------------------------------------------------------------
+CONTAINS
+   SUBROUTINE trc_dta( kt, sf_trcdta, zrf_trfac )        ! Empty routine
+      WRITE(*,*) 'trc_dta: You should not have seen this print! error?', kt
+   END SUBROUTINE trc_dta
+#endif
+   !!======================================================================
+END MODULE trcdta
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/trcini.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/trcini.F90	(revision 2865)
+++ CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/trcini.F90	(revision 2865)
@@ -0,0 +1,227 @@
+MODULE trcini
+   !!======================================================================
+   !!                         ***  MODULE trcini  ***
+   !! TOP :   Manage the passive tracer initialization
+   !!======================================================================
+   !! History :   -   ! 1991-03 (O. Marti)  original code
+   !!            1.0  ! 2005-03 (O. Aumont, A. El Moussaoui) F90
+   !!            2.0  ! 2005-10 (C. Ethe, G. Madec) revised architecture
+   !!            4.0  ! 2011-01 (A. R. Porter, STFC Daresbury) dynamical allocation
+   !!----------------------------------------------------------------------
+#if defined key_top
+   !!----------------------------------------------------------------------
+   !!   'key_top'                                                TOP models
+   !!----------------------------------------------------------------------
+   !!   trc_init  :   Initialization for passive tracer
+   !!   top_alloc :   allocate the TOP arrays
+   !!----------------------------------------------------------------------
+   USE oce_trc         ! shared variables between ocean and passive tracers
+   USE trc             ! passive tracers common variables
+   USE trcrst          ! passive tracers restart
+   USE trcnam          ! Namelist read
+   USE trcini_cfc      ! CFC      initialisation
+   USE trcini_pisces   ! PISCES   initialisation
+   USE trcini_c14b     ! C14 bomb initialisation
+   USE trcini_my_trc   ! MY_TRC   initialisation
+   USE trcdta          ! initialisation from files
+   USE daymod          ! calendar manager
+   USE zpshde          ! partial step: hor. derivative   (zps_hde routine)
+   USE prtctl_trc      ! Print control passive tracers (prt_ctl_trc_init routine)
+   USE trcsub          ! variables to substep passive tracers
+   USE lib_mpp         ! distribued memory computing library
+   USE wrk_nemo
+   USE sbc_oce
+   USE trcice          ! tracers in sea ice
+ 
+   IMPLICIT NONE
+   PRIVATE
+   
+   PUBLIC   trc_init   ! called by opa
+
+    !! * Substitutions
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 4.0 , NEMO Consortium (2011)
+   !! $Id: trcini.F90 6308 2016-02-12 11:32:54Z cetlod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+   
+   SUBROUTINE trc_init
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_init  ***
+      !!
+      !! ** Purpose :   Initialization of the passive tracer fields 
+      !!
+      !! ** Method  : - read namelist
+      !!              - control the consistancy 
+      !!              - compute specific initialisations
+      !!              - set initial tracer fields (either read restart 
+      !!                or read data or analytical formulation
+      !!---------------------------------------------------------------------
+      INTEGER ::   jk, jn, jl    ! dummy loop indices
+      CHARACTER (len=25) :: charout
+      REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztrcdta
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )   CALL timing_start('trc_init')
+      !
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) 'trc_init : initial set up of the passive tracers'
+      IF(lwp) WRITE(numout,*) '~~~~~~~'
+
+      CALL top_alloc()              ! allocate TOP arrays
+
+      l_trcdm2dc = ln_dm2dc .OR. ( ln_cpl .AND. ncpl_qsr_freq /= 1 )
+      l_trcdm2dc = l_trcdm2dc  .AND. .NOT. lk_offline
+      IF( l_trcdm2dc .AND. lwp ) &
+         &   CALL ctl_warn(' Coupling with passive tracers and used of diurnal cycle. &
+         & Computation of a daily mean shortwave for some biogeochemical models) ')
+
+      IF( nn_cla == 1 )   &
+         &  CALL ctl_stop( ' Cross Land Advection not yet implemented with passive tracer ; nn_cla must be 0' )
+
+      CALL trc_nam      ! read passive tracers namelists
+      !
+      IF(lwp) WRITE(numout,*)
+      !
+      IF( ln_rsttr .AND. .NOT. lk_offline ) CALL trc_rst_cal( nit000, 'READ' )   ! calendar
+      !
+      IF(lwp) WRITE(numout,*)
+                                                              ! masked grid volume
+      !                                                              ! masked grid volume
+      DO jk = 1, jpk
+         cvol(:,:,jk) = e1e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk)
+      END DO
+      IF( lk_degrad ) cvol(:,:,:) = cvol(:,:,:) * facvol(:,:,:)      ! degrad option: reduction by facvol
+      !                                                              ! total volume of the ocean 
+      areatot = glob_sum( cvol(:,:,:) )
+
+      IF( lk_pisces  )       CALL trc_ini_pisces       ! PISCES  bio-model
+      IF( lk_cfc     )       CALL trc_ini_cfc          ! CFC     tracers
+      IF( lk_c14b    )       CALL trc_ini_c14b         ! C14 bomb  tracer
+      IF( lk_my_trc  )       CALL trc_ini_my_trc       ! MY_TRC  tracers
+
+      CALL trc_ice_ini                                 ! Tracers in sea ice
+
+      IF( lwp ) THEN
+         !
+         CALL ctl_opn( numstr, 'tracer.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp , narea )
+         !
+      ENDIF
+
+      IF( ln_trcdta )      CALL trc_dta_init(jptra)
+
+
+      IF( ln_rsttr ) THEN
+        !
+        CALL trc_rst_read              ! restart from a file
+        !
+      ELSE
+        !
+        IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN  ! Initialisation of tracer from a file that may also be used for damping
+            !
+            CALL wrk_alloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )
+            !
+            CALL trc_dta( nit000, ztrcdta )   ! read tracer data at nit000
+            !
+            DO jn = 1, jptra
+               IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
+                  jl = n_trc_index(jn) 
+                  trn(:,:,:,jn) = ztrcdta(:,:,:,jl) * rf_trfac(jl)
+               ENDIF
+            ENDDO
+            !
+            CALL wrk_dealloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )
+            ! 
+        ENDIF
+        !
+        trb(:,:,:,:) = trn(:,:,:,:)
+        ! 
+      ENDIF
+ 
+      tra(:,:,:,:) = 0._wp
+      IF( ln_zps .AND. .NOT. lk_c1d .AND. .NOT. ln_isfcav )   &              ! Partial steps: before horizontal gradient of passive
+        &    CALL zps_hde    ( nit000, jptra, trn, gtru, gtrv  )  ! Partial steps: before horizontal gradient
+      IF( ln_zps .AND. .NOT. lk_c1d .AND.       ln_isfcav )   &
+        &    CALL zps_hde_isf( nit000, jptra, trn, pgtu=gtru, pgtv=gtrv, pgtui=gtrui, pgtvi=gtrvi )       ! tracers at the bottom ocean level
+
+
+      !
+      IF( nn_dttrc /= 1 )        CALL trc_sub_ini      ! Initialize variables for substepping passive tracers
+      !
+
+      trai(:) = 0._wp                                                   ! initial content of all tracers
+      DO jn = 1, jptra
+         trai(jn) = trai(jn) + glob_sum( trn(:,:,:,jn) * cvol(:,:,:)   )
+      END DO
+
+      IF(lwp) THEN               ! control print
+         WRITE(numout,*)
+         WRITE(numout,*)
+         WRITE(numout,*) '          *** Total number of passive tracer jptra = ', jptra
+         WRITE(numout,*) '          *** Total volume of ocean                = ', areatot
+         WRITE(numout,*) '          *** Total inital content of all tracers '
+         WRITE(numout,*)
+         DO jn = 1, jptra
+            WRITE(numout,9000) jn, TRIM( ctrcnm(jn) ), trai(jn)
+         ENDDO
+         WRITE(numout,*)
+      ENDIF
+      IF(lwp) WRITE(numout,*)
+      IF(ln_ctl) THEN            ! print mean trends (used for debugging)
+         CALL prt_ctl_trc_init
+         WRITE(charout, FMT="('ini ')")
+         CALL prt_ctl_trc_info( charout )
+         CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm )
+      ENDIF
+9000  FORMAT(' tracer nb : ',i2,'      name :',a10,'      initial content :',e18.10)
+      !
+      IF( nn_timing == 1 )   CALL timing_stop('trc_init')
+      !
+   END SUBROUTINE trc_init
+
+
+   SUBROUTINE top_alloc
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE top_alloc  ***
+      !!
+      !! ** Purpose :   Allocate all the dynamic arrays of the OPA modules
+      !!----------------------------------------------------------------------
+      USE trcadv        , ONLY:   trc_adv_alloc          ! TOP-related alloc routines...
+      USE trc           , ONLY:   trc_alloc
+      USE trcnxt        , ONLY:   trc_nxt_alloc
+      USE trczdf        , ONLY:   trc_zdf_alloc
+      USE trdtrc_oce    , ONLY:   trd_trc_oce_alloc
+#if defined key_trdmxl_trc 
+      USE trdmxl_trc    , ONLY:   trd_mxl_trc_alloc
+#endif
+      !
+      INTEGER :: ierr
+      !!----------------------------------------------------------------------
+      !
+      ierr =        trc_adv_alloc()          ! Start of TOP-related alloc routines...
+      ierr = ierr + trc_alloc    ()
+      ierr = ierr + trc_nxt_alloc()
+      ierr = ierr + trc_zdf_alloc()
+      ierr = ierr + trd_trc_oce_alloc()
+#if defined key_trdmxl_trc 
+      ierr = ierr + trd_mxl_trc_alloc()
+#endif
+      !
+      IF( lk_mpp    )   CALL mpp_sum( ierr )
+      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'top_alloc : unable to allocate standard ocean arrays' )
+      !
+   END SUBROUTINE top_alloc
+
+#else
+   !!----------------------------------------------------------------------
+   !!  Empty module :                                     No passive tracer
+   !!----------------------------------------------------------------------
+CONTAINS
+   SUBROUTINE trc_init                      ! Dummy routine   
+   END SUBROUTINE trc_init
+#endif
+
+   !!======================================================================
+END MODULE trcini
