Index: trunk/NEMO/TOP_SRC/initrc.F90
===================================================================
--- trunk/NEMO/TOP_SRC/initrc.F90	(revision 944)
+++ trunk/NEMO/TOP_SRC/initrc.F90	(revision 945)
@@ -1,20 +1,18 @@
 MODULE initrc
-   !!================================================
-   !!
-   !!                       *** MODULE initrc ***
-   !! Initialisation the tracer model
-   !!================================================
-                                                                                                                            
-#if defined key_passivetrc
-
-   !!-------------------------------------------------------
-   !!  TOP 1.0,  LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!-------------------------------------------------------
-
-   !!--------------------------------------------------------------
-   !! * Modules used
-   !! ==============
+   !!======================================================================
+   !!                         ***  MODULE initrc  ***
+   !! TOP :   Initialisation of passive tracers
+   !!======================================================================
+   !! History :    -   !  1991-03  ()  original code
+   !!             1.0  !  2005-03 (O. Aumont, A. El Moussaoui) F90
+   !!              -   !  2005-10 (C. Ethe) print control
+   !!             2.0  !  2005-10 (C. Ethe, G. Madec) revised architecture
+   !!----------------------------------------------------------------------
+#if defined key_top
+   !!----------------------------------------------------------------------
+   !!   'key_top'                                                TOP models
+   !!----------------------------------------------------------------------
+   !!   ini_trc    :  initialisation of passive tracers
+   !!----------------------------------------------------------------------
    USE oce_trc
    USE trc
@@ -25,15 +23,17 @@
    USE trcini
    USE prtctl_trc      ! Print control passive tracers (prt_ctl_trc_init routine)
-   USE lib_mpp         ! distributed memory computing
    
    IMPLICIT NONE
    PRIVATE
    
-   
-   !! * Accessibility
-   PUBLIC ini_trc
+   PUBLIC   ini_trc   ! called by ???
 
     !! * Substitutions
 #  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005) 
+   !! $Id$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
   
 CONTAINS
@@ -41,136 +41,83 @@
    SUBROUTINE ini_trc
       !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE ini_trc  ***
       !!
-      !!                       ROUTINE ini_trc
-      !!                     ******************
+      !! ** Purpose :   Initialization of the passive tracer fields 
       !!
-      !!  PURPOSE :
-      !!  ---------
-      !!     initialize the tracer model
-      !!
-      !!   METHOD :
-      !!   -------
-      !!
-      !!
-      !!   History:
-      !!   -------
-      !!      original  : 91-03 ()
-      !!      additions : 92-01 (C. Levy)
-      !!                  05-03 (O. Aumont and A. El Moussaoui) F90
-      !!                  05-10 (C. Ethe ) print control initialization 
-      !!----------------------------------------------------------------------
+      !! ** 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    ! dummy loop indices
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zbt   ! workspace: masked grid volume
+      CHARACTER (len=25) :: charout
 
       !!---------------------------------------------------------------------
-      !!  OPA.9, 03-2005
-      !!---------------------------------------------------------------------
-      INTEGER :: ji, jj, jk, jn    !: dummy loop indices
 
-      !! 0.b PRINT the number of tracer
-      !! ------------------------------
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) 'ini_trc : initial set up of the passive tracers'
+      IF(lwp) WRITE(numout,*) '~~~~~~~'
 
-      IF(lwp) WRITE(numout,*) ' '
-      IF(lwp) WRITE(numout,*) ' *** number of passive tracer jptra = ',jptra
-      IF(lwp) WRITE(numout,*) ' '
+      !                 ! masked grid volume
+      DO jk = 1, jpk
+         zbt(:,:,jk) = e1t(:,:) * e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk) * tmask_i(:,:)
+      END DO
+#if defined key_off_degrad
+      DO jk = 1, jpk
+         zbt(:,:,:) = zbt(:,:,:) * facvol(:,:,jk)      ! degrad option: reduction by facvol
+      ENDDO
+#endif
 
-      ! 1. READ passive tracers namelists
-      ! ---------------------------------
+      !                 ! total volume of the ocean
+      areatot = SUM( zbt(:,:,:) )
+      IF( lk_mpp )   CALL mpp_sum( areatot )     ! sum over the global domain  
 
-      CALL trc_lec
+      CALL trc_lec      ! READ passive tracers namelists
 
-      ! 2. control consistency between parameters, cpp key and namelists
-      ! ----------------------------------------------------------------
+      CALL trc_ctl      ! control consistency between parameters, cpp key and namelists
 
-      CALL trc_ctl
+      CALL trc_ini      ! computes some initializations
 
-      ! 3. computes some initializations
-      ! --------------------------------
-
-      CALL trc_ini
-
- 
-      ! 4. total volume of the ocean
-      !-----------------------------
-
-      areatot = 0.
-      DO jk = 1, jpk
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               areatot = areatot + tmask(ji,jj,jk) * tmask_i(ji,jj)  &
-#if defined key_off_degrad
-                  &                * facvol(ji,jj,jk)    &
-#endif
-                  &                * e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) 
-            END DO
-         END DO
-      END DO
-      IF( lk_mpp ) THEN 
-         CALL mpp_sum(areatot)     ! sum over the global domain  
-      END IF
-
-      IF(lwp) WRITE(numout,*) ' '
-      IF (lwp) WRITE(numout,*) 'Total volume of ocean =',areatot
-      IF(lwp) WRITE(numout,*) ' '
-
-      ! 5. Initialization of tracers
-      ! -----------------------------
-
-      IF( lrsttr ) THEN
-
-         ! 5.1 restart from a file
-         !------------------------
-         CALL trc_rst_read
-
-      ELSE
-
-         !  5.2 analytical formulation or global data
-         !-------------------------------------
-         CALL trc_dtr
-
+      !                 ! set initial tracer values 
+      IF( lrsttr ) THEN   ;   CALL trc_rst_read      ! restart from a file
+      ELSE                ;   CALL trc_dtr           ! analytical formulation or from data
       ENDIF
 
+      !                 ! Computation content of all tracers
+      trai = 0.e0
+      DO jn = 1, jptra
+         trai = trai + SUM( trn(:,:,:,jn) * zbt(:,:,:) )
+      END DO      
+      IF( lk_mpp )   CALL mpp_sum( trai )     ! sum over the global domain  
 
-      ! 6. Computation integral of all tracers
-      !------------------
 
-      trai = 0.
-      DO jn = 1, jptra
-         DO jk = 1, jpk
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  trai = trai + trn(ji,jj,jk,jn) * tmask(ji,jj,jk) * tmask_i(ji,jj)    &
-#if defined key_off_degrad
-                     &              * facvol(ji,jj,jk)   &
-#endif
+      !                 ! control print
+      IF(lwp) WRITE(numout,*) '          *** Total number of passive tracer jptra = ', jptra
+      IF(lwp) WRITE(numout,*) '          *** Total volume of ocean                = ', areatot
+      IF(lwp) WRITE(numout,*) '          *** Total inital content of all tracers  = ', trai
+      IF(lwp) WRITE(numout,*)
 
-                     &              * e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-      ENDDO
-      
-      IF( lk_mpp ) THEN 
-         CALL mpp_sum(trai)         ! sum over the global domain  
-      END IF
+      IF( ln_ctl )   CALL prt_ctl_trc_init      ! control print
+      !
 
-      IF(lwp) WRITE(numout,*) ' '     
-      IF(lwp) WRITE(numout,*) 'Integral of all tracers over the full domain at initial time =',trai
-      IF(lwp) WRITE(numout,*) ' '
-
-      ! 6. Print control
-      !------------------
-
-      IF( ln_ctl )    CALL prt_ctl_trc_init
+      IF(ln_ctl) THEN      ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('ini ')")
+         CALL prt_ctl_trc_info( charout )
+         CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm )
+      ENDIF
 
    END SUBROUTINE ini_trc
 
-
 #else
-   !!======================================================================
-   !!  Empty module : No passive tracer
-   !!======================================================================
+   !!----------------------------------------------------------------------
+   !!  Empty module :                                     No passive tracer
+   !!----------------------------------------------------------------------
 CONTAINS
-   SUBROUTINE ini_trc      
+   SUBROUTINE ini_trc                      ! Dummy routine   
    END SUBROUTINE ini_trc
 #endif
 
+   !!======================================================================
 END MODULE initrc 
Index: trunk/NEMO/TOP_SRC/oce_trc.F90
===================================================================
--- trunk/NEMO/TOP_SRC/oce_trc.F90	(revision 944)
+++ trunk/NEMO/TOP_SRC/oce_trc.F90	(revision 945)
@@ -2,285 +2,234 @@
    !!======================================================================
    !!                      ***  MODULE  oce_trc  ***
-   !! Ocean passive tracer  :  share ocean-passive tracers variables
+   !! TOP :   variables shared between ocean and passive tracers
    !!======================================================================
-   !! History :
-   !!   9.0  !  04-03  (C. Ethe)  F90: Free form and module
-   !!----------------------------------------------------------------------
-   !!  TOP 1.0,  LOCEAN-IPSL (2005)
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/TOP_SRC/oce_trc.F90,v 1.17 2007/05/28 02:55:05 opalod Exp $
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
-   !!----------------------------------------------------------------------
-   !! * Modules used
-   !! Domain characteristics
-   USE par_oce , ONLY :       &
-      cp_cfg   =>   cp_cfg,  & !: name of the configuration
-      jp_cfg   =>   jp_cfg,  & !: resolution of the configuration
-      jpiglo   =>   jpiglo,  & !: first  dimension of global domain --> i
-      jpjglo   =>   jpjglo,  & !: second dimension of global domain --> j
-      jpi      =>   jpi   ,  & !: first  dimension of grid --> i 
-      jpj      =>   jpj   ,  & !: second dimension of grid --> j  
-      jpk      =>   jpk   ,  & !: number of levels  
-      jpim1    =>   jpim1 ,  & !: jpi - 1
-      jpjm1    =>   jpjm1 ,  & !: jpj - 1 
-      jpkm1    =>   jpkm1 ,  & !: jpk - 1  
-      jpij     =>   jpij  ,  & !: jpi x jpj
-      jpidta   =>   jpidta,  & !: first horizontal dimension  > or = jpi
-      jpjdta   =>   jpjdta,  & !: second horizontal dimension > or = jpj
-      jpkdta   =>   jpkdta,  & !: number of levels            > or = jpk
-      lk_esopa =>   lk_esopa   !: flag to activate the all option
-
-
-   !! run controm   
-
-   USE in_out_manager
-      
-   USE dom_oce , ONLY :           &            
-      lzoom      => lzoom     ,  & !: zoom flag
-      lzoom_e    => lzoom_e   ,  & !: East  zoom type flag
-      lzoom_w    => lzoom_w   ,  & !: West  zoom type flag
-      lzoom_s    => lzoom_s   ,  & !: South zoom type flag
-      lzoom_n    => lzoom_n   ,  & !: North zoom type flag
-      lzoom_arct => lzoom_arct,  & !: ORCA    arctic zoom flag
-      lzoom_anta => lzoom_anta     !: ORCA antarctic zoom flag
-
-
-
-   USE dom_oce , ONLY :       & 
-      nperio   =>   nperio,  & !: type of lateral boundary condition       
-      nimpp    =>   nimpp ,  & !: i index for mpp-subdomain left bottom
-      njmpp    =>   njmpp ,  & !: j index for mpp-subdomain left bottom
-      nproc    =>   nproc ,  & !: number for local processor
-      narea    =>   narea ,  & !: number for local area
-      mig      =>   mig   ,  & !: local  ==> global  domain i-indice
-      mjg      =>   mjg   ,  & !: local  ==> global  domain i-indice
-      mi0      =>   mi0   ,  & !: global ==> local domain i-indice 
-      mi1      =>   mi1   ,  & !: (mi0=1 and mi1=0 if the global indice is not in the local domain)
-      mj0      =>   mj0   ,  & !: global ==> local domain j-indice 
-      mj1      =>   mj1   ,  & !: (mj0=1 and mj1=0 if the global indice is not in the local domain)
-      nidom    =>   nidom
+   !! History :   1.0  !  2004-03  (C. Ethe)  original code
+   !!             2.0  !  2007-12 (C. Ethe, G. Madec)  rewritting
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0,  LOCEAN-IPSL (2007)
+   !! $Header: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+#if defined key_top
+   !!----------------------------------------------------------------------
+   !!   'key_top'                                                TOP models
+   !!----------------------------------------------------------------------
+
+   !* Domain size *
+   USE par_oce , ONLY :   cp_cfg   =>   cp_cfg     !: name of the configuration
+   USE par_oce , ONLY :   jp_cfg   =>   jp_cfg     !: resolution of the configuration
+   USE par_oce , ONLY :   jpiglo   =>   jpiglo     !: first  dimension of global domain --> i
+   USE par_oce , ONLY :   jpjglo   =>   jpjglo     !: second dimension of global domain --> j
+   USE par_oce , ONLY :   jpi      =>   jpi        !: first  dimension of grid --> i 
+   USE par_oce , ONLY :   jpj      =>   jpj        !: second dimension of grid --> j  
+   USE par_oce , ONLY :   jpk      =>   jpk        !: number of levels  
+   USE par_oce , ONLY :   jpim1    =>   jpim1      !: jpi - 1
+   USE par_oce , ONLY :   jpjm1    =>   jpjm1      !: jpj - 1 
+   USE par_oce , ONLY :   jpkm1    =>   jpkm1      !: jpk - 1  
+   USE par_oce , ONLY :   jpij     =>   jpij       !: jpi x jpj
+   USE par_oce , ONLY :   jpidta   =>   jpidta     !: first horizontal dimension  > or = jpi
+   USE par_oce , ONLY :   jpjdta   =>   jpjdta     !: second horizontal dimension > or = jpj
+   USE par_oce , ONLY :   jpkdta   =>   jpkdta     !: number of levels            > or = jpk
+   USE par_oce , ONLY :   lk_esopa =>   lk_esopa   !: flag to activate the all option
+
+   !* IO manager *
+   USE in_out_manager      ! use all the variables
+   !* physical constants *
+   USE phycst              ! use all the variables
+
+   !* model domain *
+   USE dom_oce , ONLY :   lzoom      => lzoom        !: zoom flag
+   USE dom_oce , ONLY :   lzoom_e    => lzoom_e      !: East  zoom type flag
+   USE dom_oce , ONLY :   lzoom_w    => lzoom_w      !: West  zoom type flag
+   USE dom_oce , ONLY :   lzoom_s    => lzoom_s      !: South zoom type flag
+   USE dom_oce , ONLY :   lzoom_n    => lzoom_n      !: North zoom type flag
+   USE dom_oce , ONLY :   lzoom_arct => lzoom_arct   !: ORCA    arctic zoom flag
+   USE dom_oce , ONLY :   lzoom_anta => lzoom_anta   !: ORCA antarctic zoom flag
+   USE dom_oce , ONLY :   nperio     =>   nperio     !: type of lateral boundary condition       
+   USE dom_oce , ONLY :   nimpp      =>   nimpp      !: i index for mpp-subdomain left bottom
+   USE dom_oce , ONLY :   njmpp      =>   njmpp      !: j index for mpp-subdomain left bottom
+   USE dom_oce , ONLY :   nproc      =>   nproc      !: number for local processor
+   USE dom_oce , ONLY :   narea      =>   narea      !: number for local area
+   USE dom_oce , ONLY :   mig        =>   mig        !: local  ==> global  domain i-indice
+   USE dom_oce , ONLY :   mjg        =>   mjg        !: local  ==> global  domain i-indice
+   USE dom_oce , ONLY :   mi0        =>   mi0        !: global ==> local domain i-indice 
+   USE dom_oce , ONLY :   mi1        =>   mi1        !: (mi0=1 and mi1=0 if the global indice is not in the local one)
+   USE dom_oce , ONLY :   mj0        =>   mj0        !: global ==> local domain j-indice 
+   USE dom_oce , ONLY :   mj1        =>   mj1        !: (mj0=1 and mj1=0 if the global indice is not in the local one)
+   USE dom_oce , ONLY :   nidom      =>   nidom
+   USE dom_oce , ONLY :   nimppt     => nimppt     !:i-indexes for each processor
+   USE dom_oce , ONLY :   njmppt     => njmppt       !:j-indexes for each processor
+   USE dom_oce , ONLY :   ibonit     => ibonit       !:i-processor neighbour existence
+   USE dom_oce , ONLY :   ibonjt     => ibonjt       !:j- processor neighbour existence 
+   USE dom_oce , ONLY :   nlci       => nlci         !:i- & j-dimensions of the local subdomain
+   USE dom_oce , ONLY :   nlcj       => nlcj         !:
+   USE dom_oce , ONLY :   nldi       => nldi         !:first and last indoor i- and j-indexes
+   USE dom_oce , ONLY :   nlei       => nlei         !:
+   USE dom_oce , ONLY :   nldj       => nldj         !:
+   USE dom_oce , ONLY :   nlej       => nlej         !:
+   USE dom_oce , ONLY :   nlcit      => nlcit        !:dimensions of every i-subdomain
+   USE dom_oce , ONLY :   nlcjt      => nlcjt        !:dimensions of every j-subdomain
+   USE dom_oce , ONLY :   nldit      => nldit        !:first indoor index for each i-domain 
+   USE dom_oce , ONLY :   nleit      => nleit        !:last indoor index for each i-domain 
+   USE dom_oce , ONLY :   nldjt      => nldjt        !:first indoor index for each j-domain 
+   USE dom_oce , ONLY :   nlejt      => nlejt        !:last indoor index for each j-domain 
  
-   USE dom_oce , ONLY :       & 
-      nimppt   => nimppt  ,  & !:i-indexes for each processor
-      njmppt   => njmppt  ,  & !:j-indexes for each processor
-      ibonit   => ibonit  ,  & !:i-processor neighbour existence
-      ibonjt   => ibonjt  ,  & !:j- processor neighbour existence 
-      nlci     => nlci    ,  & !:i- & j-dimensions of the local subdomain
-      nlcj     => nlcj    ,  & !:
-      nldi     => nldi    ,  & !:first and last indoor i- and j-indexes
-      nlei     => nlei    ,  & !:
-      nldj     => nldj    ,  & !:
-      nlej     => nlej    ,  & !:
-      nlcit    => nlcit   ,  & !:dimensions of every i-subdomain
-      nlcjt    => nlcjt   ,  & !:dimensions of every j-subdomain
-      nldit    => nldit   ,  & !:first indoor index for each i-domain 
-      nleit    => nleit   ,  & !:last indoor index for each i-domain 
-      nldjt    => nldjt   ,  & !:first indoor index for each j-domain 
-      nlejt    => nlejt        !:last indoor index for each j-domain 
-
-    
-      !! horizontal curvilinear coordinate and scale factors
-   USE dom_oce , ONLY :            &    
-      glamt    =>   glamt ,  & !: longitude of t-point (degre)  
-      glamu    =>   glamu ,  & !: longitude of t-point (degre)  
-      glamv    =>   glamv ,  & !: longitude of t-point (degre)  
-      glamf    =>   glamf ,  & !: longitude of t-point (degre)  
-      gphit    =>   gphit ,  & !: latitude  of t-point (degre)   
-      gphiu    =>   gphiu ,  & !: latitude  of t-point (degre)   
-      gphiv    =>   gphiv ,  & !: latitude  of t-point (degre)   
-      gphif    =>   gphif ,  & !: latitude  of t-point (degre)   
-      e1t      =>   e1t   ,  & !: horizontal scale factors at t-point (m)  
-      e2t      =>   e2t   ,  & !: horizontal scale factors at t-point (m)   
-      e1u      =>   e1u   ,  & !: horizontal scale factors at u-point (m)
-      e2u      =>   e2u   ,  & !: horizontal scale factors at u-point (m)
-      e1v      =>   e1v   ,  & !: horizontal scale factors at v-point (m)
-      e2v      =>   e2v        !: horizontal scale factors at v-point (m)  
-
-   !! vertical coordinate and scale factors
-   USE dom_oce , ONLY :              &   
-      gdept_0    =>   gdept_0 ,  & !: reference depth of t-points (m)
-      e3t_0      =>   e3t_0   ,  & !: reference depth of t-points (m)  
-      e3w_0      =>   e3w_0   ,  & !: reference depth of w-points (m)
-      gdepw_0    =>   gdepw_0      !: reference depth of w-points (m)
-
-#if ! defined key_zco
-   USE dom_oce , ONLY :                &
-      gdep3w   =>  gdep3w  ,  & !: ???
-      gdept =>  gdept,  & !: depth of t-points (m)
-      gdepw =>  gdepw,  & !: depth of t-points (m)
-      e3t   =>  e3t  ,  & !: vertical scale factors at t-
-      e3u   =>  e3u  ,  & !: vertical scale factors at u-
-      e3v   =>  e3v  ,  & !: vertical scale factors v-
-      e3w   =>  e3w  ,  & !: w-points (m)
-      e3f   =>  e3f  ,  & !: f-points (m)
-      e3uw  =>  e3uw ,  & !: uw-points (m)
-      e3vw  =>  e3vw      !: vw-points (m)
+   !* horizontal mesh *
+   USE dom_oce , ONLY :   glamt      =>   glamt      !: longitude of t-point (degre)  
+   USE dom_oce , ONLY :   glamu      =>   glamu      !: longitude of t-point (degre)  
+   USE dom_oce , ONLY :   glamv      =>   glamv      !: longitude of t-point (degre)  
+   USE dom_oce , ONLY :   glamf      =>   glamf      !: longitude of t-point (degre)  
+   USE dom_oce , ONLY :   gphit      =>   gphit      !: latitude  of t-point (degre)   
+   USE dom_oce , ONLY :   gphiu      =>   gphiu      !: latitude  of t-point (degre)   
+   USE dom_oce , ONLY :   gphiv      =>   gphiv      !: latitude  of t-point (degre)   
+   USE dom_oce , ONLY :   gphif      =>   gphif      !: latitude  of t-point (degre)   
+   USE dom_oce , ONLY :   e1t        =>   e1t        !: horizontal scale factors at t-point (m)  
+   USE dom_oce , ONLY :   e2t        =>   e2t        !: horizontal scale factors at t-point (m)   
+   USE dom_oce , ONLY :   e1u        =>   e1u        !: horizontal scale factors at u-point (m)
+   USE dom_oce , ONLY :   e2u        =>   e2u        !: horizontal scale factors at u-point (m)
+   USE dom_oce , ONLY :   e1v        =>   e1v        !: horizontal scale factors at v-point (m)
+   USE dom_oce , ONLY :   e2v        =>   e2v        !: horizontal scale factors at v-point (m)  
+
+   !* vertical mesh *
+   USE dom_oce , ONLY :   gdept_0    =>   gdept_0    !: reference depth of t-points (m)
+   USE dom_oce , ONLY :   e3t_0      =>   e3t_0      !: reference depth of t-points (m)  
+   USE dom_oce , ONLY :   e3w_0      =>   e3w_0      !: reference depth of w-points (m)
+   USE dom_oce , ONLY :   gdepw_0    =>   gdepw_0    !: reference depth of w-points (m)
+# if ! defined key_zco
+   USE dom_oce , ONLY :   gdep3w     =>  gdep3w      !: ???
+   USE dom_oce , ONLY :   gdept      =>  gdept       !: depth of t-points (m)
+   USE dom_oce , ONLY :   gdepw      =>  gdepw       !: depth of t-points (m)
+   USE dom_oce , ONLY :   e3t        =>  e3t         !: vertical scale factors at t-
+   USE dom_oce , ONLY :   e3u        =>  e3u         !: vertical scale factors at u-
+   USE dom_oce , ONLY :   e3v        =>  e3v         !: vertical scale factors v-
+   USE dom_oce , ONLY :   e3w        =>  e3w         !: w-points (m)
+   USE dom_oce , ONLY :   e3f        =>  e3f         !: f-points (m)
+   USE dom_oce , ONLY :   e3uw       =>  e3uw        !: uw-points (m)
+   USE dom_oce , ONLY :   e3vw       =>  e3vw        !: vw-points (m)
+# endif
+   USE dom_oce , ONLY :   ln_zps     =>  ln_zps      !: partial steps flag
+   USE dom_oce , ONLY :   ln_sco     =>  ln_sco      !: s-coordinate flag
+   USE dom_oce , ONLY :   ln_zco     =>  ln_zco      !: z-coordinate flag
+   USE dom_oce , ONLY :   lk_zco     =>  lk_zco      !: z-coordinate flag (1D or 3D arrays)
+   USE dom_oce , ONLY :   hbatt     =>   hbatt       !: ocean depth at the vertical of  t-point (m)
+   USE dom_oce , ONLY :   hbatu     =>   hbatu       !: ocean depth at the vertical of  u-point (m)
+   USE dom_oce , ONLY :   hbatv     =>   hbatv       !: ocean depth at the vertical of w-point (m)
+   USE dom_oce , ONLY :   gsigt     =>   gsigt       !: model level depth coefficient at T-levels
+   USE dom_oce , ONLY :   gsigw     =>   gsigw       !: model level depth coefficient at W-levels
+   USE dom_oce , ONLY :   gsi3w     =>   gsi3w       !: model level depth coef at w-levels (defined as the sum of e3w)
+   USE dom_oce , ONLY :   esigt     =>   esigt       !: vertical scale factor coef. at t-levels
+   USE dom_oce , ONLY :   esigw     =>   esigw       !: vertical scale factor coef. at w-levels
+
+   !* masks, bathymetry *
+   USE dom_oce , ONLY :   mbathy    =>   mbathy      !: number of ocean level (=0,  & 1, ... , jpk-1) 
+   USE dom_oce , ONLY :   tmask_i   =>   tmask_i     !: Interior mask at t-points
+   USE dom_oce , ONLY :   tmask     =>   tmask       !: land/ocean mask at t-points
+   USE dom_oce , ONLY :   umask     =>   umask       !: land/ocean mask at u-points   
+   USE dom_oce , ONLY :   vmask     =>   vmask       !: land/ocean mask at v-points 
+   USE dom_oce , ONLY :   fmask     =>   fmask       !: land/ocean mask at f-points 
+# if defined key_off_degrad
+   USE dom_oce , ONLY :   facvol    =>   facvol      !: volume factor for degradation
+# endif
+
+   !* time domain *
+   USE dom_oce , ONLY :   neuler    =>   neuler      !: restart euler forward option (0=Euler)
+   USE dom_oce , ONLY :   rdt       =>   rdt         !: time step for the dynamics 
+   USE dom_oce , ONLY :   atfp      =>   atfp        !: asselin time filter parameter
+   USE dom_oce , ONLY :   atfp1     =>   atfp1       !: asselin time filter coeff. (atfp1= 1-2*atfp)
+   USE dom_oce , ONLY :   rdttra    =>   rdttra      !: vertical profile of tracer time step
+   USE daymod  , ONLY :   ndastp    =>   ndastp      !: time step date in year/month/day aammjj
+   USE daymod  , ONLY :   nday_year =>   nday_year   !: curent day counted from jan 1st of the current year
+   USE daymod  , ONLY :   nyear     =>   nyear       !: Current year
+   USE daymod  , ONLY :   nmonth    =>   nmonth      !: Current month
+   USE daymod  , ONLY :   nday      =>   nday        !: Current day
+   USE daymod  , ONLY :   nobis     =>   nobis       !: number of days per month
+
+   !* ocean fields: here now and after fields *
+   USE oce , ONLY :   ua      =>    ua      !: i-horizontal velocity (m s-1) 
+   USE oce , ONLY :   va      =>    va      !: j-horizontal velocity (m s-1)
+   USE oce , ONLY :   un      =>    un      !: i-horizontal velocity (m s-1) 
+   USE oce , ONLY :   vn      =>    vn      !: j-horizontal velocity (m s-1)
+   USE oce , ONLY :   wn      =>    wn      !: vertical velocity (m s-1)  
+   USE oce , ONLY :   tn      =>    tn      !: pot. temperature (celsius)
+   USE oce , ONLY :   sn      =>    sn      !: salinity (psu)
+   USE oce , ONLY :   rhop    =>    rhop    !: potential volumic mass (kg m-3) 
+   USE oce , ONLY :   rhd     =>    rhd     !: in situ density anomalie rhd=(rho-rau0)/rau0 (no units)
+# if defined key_trc_diatrd
+   USE oce , ONLY :   hdivn   =>    hdivn   !: horizontal divergence (1/s)
+# endif
+
+
+   USE lib_mpp , ONLY :   lk_mpp    =>  lk_mpp       !: Mpp flag
+
+   USE dynspg_oce , ONLY :   lk_dynspg_rl   =>  lk_dynspg_rl      !: rigid lid flag
+
+   USE dom_oce , ONLY :   n_cla     =>   n_cla         !: flag (0/1) for cross land advection 
+
+
+
+   !* surface fluxes *
+   USE sbc_oce , ONLY :   utau       =>    utau       !: i-surface stress component
+   USE sbc_oce , ONLY :   vtau       =>    vtau       !: j-surface stress component
+   USE sbc_oce , ONLY :   qsr        =>    qsr        !: penetrative solar radiation (w m-2)  
+   USE sbc_oce , ONLY :   emp        =>    emp        !: evaporation minus precipitation (kg m-2 s-2) 
+   USE sbc_oce , ONLY :   emps       =>    emps       !: evaporation minus precipitation (kg m-2 s-2)
+   USE traqsr  , ONLY :   xsi1       =>    xsi1       !: first depth of extinction
+   USE traqsr  , ONLY :   ln_qsr_sms =>    ln_qsr_sms !: flag to use or not the biological fluxes for light
+   USE sbcrnf  , ONLY :   rnfmsk     =>    rnfmsk     !: mixed adv scheme in runoffs vicinity (hori.) 
+   USE sbcrnf  , ONLY :   rnfmsk_z   =>    rnfmsk_z   !: mixed adv scheme in runoffs vicinity (vert.)
+
+   !* freezing area *
+   USE ocfzpt , ONLY :   freeze      =>    freeze     !: ice mask (0 or 1)  
+   USE ocfzpt , ONLY :   fzptn       =>    fzptn      !: now freezing temperature at ocean surface  
+
+   !* bottom boundary layer *
+# if   defined key_trabbl_dif   ||   defined key_trabbl_adv
+   USE trabbl , ONLY :   atrbbl   =>   atrbbl     !: lateral coeff. for bottom boundary layer scheme (m2/s)
+#  if defined key_off_tra
+   USE trabbl, ONLY :   bblx   => bblx         !: ???
+   USE trabbl, ONLY :   bbly   => bbly         !: ???
+#  endif
+# endif
+
+   !* lateral diffusivity (tracers) *
+   USE ldftra_oce , ONLY :   aht0    =>   aht0     !: horizontal eddy diffusivity for tracers (m2/s)
+   USE ldftra_oce , ONLY :   ahtb0   =>   ahtb0    !: background eddy diffusivity for isopycnal diff. (m2/s)
+   USE ldftra_oce , ONLY :   ahtu    =>   ahtu     !: lateral diffusivity coef. at u-points 
+   USE ldftra_oce , ONLY :   ahtv    =>   ahtv     !: lateral diffusivity coef. at v-points 
+   USE ldftra_oce , ONLY :   ahtw    =>   ahtw     !: lateral diffusivity coef. at w-points 
+   USE ldftra_oce , ONLY :   ahtt    =>   ahtt     !: lateral diffusivity coef. at t-points
+   USE ldftra_oce , ONLY :   aeiv0   =>   aeiv0    !: eddy induced velocity coefficient (m2/s) 
+   USE ldftra_oce , ONLY :   aeiu    =>   aeiu     !: eddy induced velocity coef. at u-points (m2/s)   
+   USE ldftra_oce , ONLY :   aeiv    =>   aeiv     !: eddy induced velocity coef. at v-points (m2/s) 
+   USE ldftra_oce , ONLY :   aeiw    =>   aeiw     !: eddy induced velocity coef. at w-points (m2/s) 
+
+   !* vertical diffusion *
+   USE zdf_oce , ONLY :   avt        =>   avt         !: vert. diffusivity coef. at w-point for temp  
+   USE zdf_oce , ONLY :   avt0       =>   avt0        !: vertical eddy diffusivity for tracers (m2/s)
+   USE zdf_oce , ONLY :   ln_zdfnpc  =>   ln_zdfnpc   !: convection: non-penetrative convection flag
+# if defined key_zdfddm
+   USE zdfddm  , ONLY :   avs        =>    avs        !: salinity vertical diffusivity coeff. at w-point
+# endif
+
+   !* mixing & mixed layer depth *
+   USE zdfmxl , ONLY :   hmld        =>   hmld        !: mixing layer depth (turbocline)
+   USE zdfmxl , ONLY :   hmlp        =>   hmlp        !: mixed layer depth  (rho=rho0+zdcrit) (m)
+   USE zdfmxl , ONLY :   hmlpt       =>   hmlpt       !: mixed layer depth at t-points (m)
+
+   !* direction of lateral diffusion *
+   USE ldfslp , ONLY :   lk_ldfslp  =>  lk_ldfslp     !: slopes flag
+# if   defined key_ldfslp
+   USE ldfslp , ONLY :   uslp       =>   uslp         !: i-direction slope at u-, w-points
+   USE ldfslp , ONLY :   vslp       =>   vslp         !: j-direction slope at v-, w-points
+   USE ldfslp , ONLY :   wslpi      =>   wslpi        !: i-direction slope at u-, w-points
+   USE ldfslp , ONLY :   wslpj      =>   wslpj        !: j-direction slope at v-, w-points
+# endif
+
+#else
+   !!----------------------------------------------------------------------
+   !!  Empty module :                                     No passive tracer
+   !!----------------------------------------------------------------------
 #endif
 
-   USE dom_oce ,   ONLY :            &      
-      ln_zps   =>  ln_zps ,  & !: partial steps flag
-      ln_sco   =>  ln_sco ,  & !: s-coordinate flag
-      ln_zco   =>  ln_zco ,  & !: z-coordinate flag
-      lk_zco   =>  lk_zco      !: z-coordinate flag (1D or 3D arrays)
-
-   USE lib_mpp ,   ONLY :            &     
-      lk_mpp   =>  lk_mpp      !: Mpp flag
-
-   USE dynspg_oce ,   ONLY :            &     
-      lk_dynspg_rl   =>  lk_dynspg_rl      !: rigid lid flag
-
-
-   USE dom_oce , ONLY :              &   
-      hbatt   =>   hbatt  ,  & !: ocean depth at the vertical of  t-point (m)
-      hbatu   =>   hbatu  ,  & !: ocean depth at the vertical of  u-point (m)
-      hbatv   =>   hbatv  ,  & !: ocean depth at the vertical of w-point (m)
-      gsigt   =>   gsigt  ,  & !: model level depth coefficient at t-,  & w-levelsvertical scale factors at u-
-      gsigw   =>   gsigw  ,  & !: model level depth coefficient at t-,  & w-levelsvertical scale factors v-
-      gsi3w   =>   gsi3w  ,  & !: model level depth coef at w-levels (defined as the sum of e3w)
-      esigt   =>   esigt  ,  & !: vertical scale factor coef. at t-levels
-      esigw   =>   esigw       !: vertical scale factor coef. at w-levels
-
-   !! masks, bathymetry
-   USE dom_oce , ONLY :             &    
-      mbathy   =>   mbathy,  & !: number of ocean level (=0,  & 1, ... , jpk-1) 
-      tmask_i  =>   tmask_i, & !: Interior mask at t-points
-      tmask    =>   tmask ,  & !: land/ocean mask at t-points
-      umask    =>   umask ,  & !: land/ocean mask at u-points   
-      vmask    =>   vmask ,  & !: land/ocean mask at v-points 
-      fmask    =>   fmask      !: land/ocean mask at f-points 
-
-#if defined key_off_degrad
-   USE dom_oce , ONLY :                 &
-      facvol   =>   facvol     !: volume factor for degradation
-#endif
-
-   USE dom_oce , ONLY :         &
-      n_cla   =>   n_cla       !: flag (0/1) for cross land advection 
-
-   !! time domain
-   USE dom_oce , ONLY :                 &
-      neuler   =>   neuler,  & !: restart euler forward option (0=Euler)
-      rdt      =>   rdt   ,  & !: time step for the dynamics 
-      atfp     =>   atfp  ,  & !: asselin time filter parameter
-      atfp1    =>   atfp1 ,  & !: asselin time filter coeff. (atfp1= 1-2*atfp)
-      rdttra   =>   rdttra     !: vertical profile of tracer time step
-
-   USE daymod , ONLY :                 &
-      ndastp    =>   ndastp,  &    !: time step date in year/month/day aammjj
-      nday_year =>   nday_year, &  !: curent day counted from jan 1st of the current year
-      nyear     =>   nyear,   &  !: Current year
-      nmonth    =>   nmonth,  &  !: Current month
-      nday      =>   nday        !: Current day
-
-   !! physical constants
-   USE phycst ,   ONLY :                &  
-      ra       =>   ra    ,  & !: earth radius
-      rpi      =>   rpi   ,  & !: pi
-      rday     =>   rday  ,  & !: day
-      rauw     =>   rauw  ,  & !: density of pure water kg/m3
-      ro0cpr   =>   ro0cpr,  & !: = 1. / ( rau0 * rcp )
-      rad      =>   rad   ,  & !: conversion coeff. from degre into radian
-      raass    =>   raass ,  & !: number of seconds in one year
-      rmoss    =>   rmoss ,  & !: number of seconds in one month
-      rjjss    =>   rjjss      !: number of seconds in one day
-
-   !! present fields (now)
-   USE oce , ONLY :            &     
-      ua      =>    ua    ,  & !: i-horizontal velocity (m s-1) 
-      va      =>    va    ,  & !: j-horizontal velocity (m s-1)
-      un      =>    un    ,  & !: i-horizontal velocity (m s-1) 
-      vn      =>    vn    ,  & !: j-horizontal velocity (m s-1)
-      wn      =>    wn    ,  & !: vertical velocity (m s-1)  
-      tn      =>    tn    ,  & !: pot. temperature (celsius)
-      sn      =>    sn    ,  & !: salinity (psu)
-      rhop    =>    rhop  ,  & !: potential volumic mass (kg m-3) 
-      rhd     =>    rhd        !: in situ density anomalie rhd=(rho-rau0)/rau0 (no units)
-
-#if defined key_trc_diatrd
-   USE oce , ONLY :          &
-      hdivn   =>    hdivn      !: horizontal divergence (1/s)
-#endif
-
-#if defined key_flx_bulk_monthly || defined key_flx_bulk_daily || defined key_flx_core
-   !! wind speed
-   USE blk_oce , ONLY :        &     
-      vatm    =>    vatm       !: wind speed at sea surface (m s-1)
-#endif
-
-   !! wind speed
-   USE sbc_oce , ONLY :     &     
-      taux    =>    utau ,  &  !: i-surface stress component
-      tauy    =>    vtau ,  &  !: j-surface stress component
-      qsr     =>    qsr  ,  &  !: penetrative solar radiation (w m-2)  
-      emp     =>    emp  ,  &  !: evaporation minus precipitation (kg m-2 s-2) 
-      emps    =>    emps       !: evaporation minus precipitation (kg m-2 s-2)
-
-
-#if   defined key_trabbl_dif   ||   defined key_trabbl_adv
-   USE trabbl , ONLY :           &      
-      atrbbl   =>   atrbbl     !: lateral coeff. for bottom boundary layer scheme (m2/s)
-#  if defined key_off_tra
-   USE trabbl, ONLY :            &
-      bblx   => bblx,       &
-      bbly   => bbly
-#  endif
-#endif
-
-   !! lateral diffusivity (tracers)
-   USE ldftra_oce ,   ONLY :             &    
-      aht0    =>   aht0  ,  &  !: horizontal eddy diffusivity for tracers (m2/s)
-      ahtb0   =>   ahtb0 ,  &  !: background eddy diffusivity for isopycnal diff. (m2/s)
-      ahtu    =>   ahtu  ,  &  !: lateral diffusivity coef. at u-points 
-      ahtv    =>   ahtv  ,  &  !: lateral diffusivity coef. at v-points 
-      ahtw    =>   ahtw  ,  &  !: lateral diffusivity coef. at w-points 
-      ahtt    =>   ahtt  ,  &  !: lateral diffusivity coef. at t-points
-      aeiv0   =>   aeiv0 ,  &  !: eddy induced velocity coefficient (m2/s) 
-      aeiu    =>   aeiu  ,  &  !: eddy induced velocity coef. at u-points (m2/s)   
-      aeiv    =>   aeiv  ,  &  !: eddy induced velocity coef. at v-points (m2/s) 
-      aeiw    =>   aeiw        !: eddy induced velocity coef. at w-points (m2/s) 
-
-   !! vertical diffusion
-   USE zdf_oce , ONLY :      &    
-      avt            =>   avt          ,  & !: vert. diffusivity coef. at w-point for temp  
-      avt0           =>   avt0         ,  & !: vertical eddy diffusivity for tracers (m2/s)
-      ln_zdfnpc      =>   ln_zdfnpc         !: convection: non-penetrative convection flag
-
-
-#if defined key_zdfddm
-   USE zdfddm , ONLY :             &     
-      avs     =>    avs        !: salinity vertical diffusivity coeff. at w-point
-#endif
-
-   !! penetrative solar radiation
-   USE traqsr , ONLY :            &
-      xsi1        =>   xsi1    ,  & !: first depth of extinction
-      ln_qsr_sms  =>  ln_qsr_sms    !: flag to use or not the biological fluxes for light
-
-   !! freezing area
-   USE ocfzpt , ONLY :            &      
-      freeze  =>    freeze,  & !: ice mask (0 or 1)  
-      fzptn   =>    fzptn      !: now freezing temperature at ocean surface  
-
-
-   !! mixing layer depth (turbocline)
-   USE zdfmxl , ONLY :             &    
-      hmld    =>   hmld   ,  & !: mixing layer depth (turbocline)
-      hmlp    =>   hmlp   ,  & !: mixed layer depth  (rho=rho0+zdcrit) (m)
-      hmlpt   =>   hmlpt       !: mixed layer depth at t-points (m)
-
-   USE ldfslp , ONLY :              & 
-      lk_ldfslp  =>  lk_ldfslp     !: slopes flag
-#if   defined key_ldfslp
-   !! direction of lateral diffusion (momentum  tracers) 
-   USE ldfslp , ONLY :              & 
-      uslp       =>   uslp    ,  & !: i-direction slope at u-, w-points
-      vslp       =>   vslp    ,  & !: j-direction slope at v-, w-points
-      wslpi      =>   wslpi   ,  & !: i-direction slope at u-, w-points
-      wslpj      =>   wslpj        !: j-direction slope at v-, w-points
-#endif
-
-   !! ocean forcings runoff
-   USE sbcrnf , ONLY :         &   
-      upsrnfh => rnfmsk     ,  & !: mixed adv scheme in runoffs vicinity (hori.) 
-      upsrnfz => rnfmsk_z        !: mixed adv scheme in runoffs vicinity (vert.)
-
+   !!======================================================================
 END MODULE oce_trc
Index: trunk/NEMO/TOP_SRC/par_trc.F90
===================================================================
--- trunk/NEMO/TOP_SRC/par_trc.F90	(revision 944)
+++ trunk/NEMO/TOP_SRC/par_trc.F90	(revision 945)
@@ -2,49 +2,57 @@
    !!======================================================================
    !!                        ***  par_trc  ***
-   !! passive tracers :   set the passive tracers parameters
+   !! TOP :   set the passive tracers parameters
    !!======================================================================
-   !! History :
-   !!   8.2  !  96-01  (M. Levy)  Original code
-   !!        !  99-07  (M. Levy)  for LOBSTER1 or NPZD model
-   !!        !  00-04  (O. Aumont, M.A. Foujols)  HAMOCC3 and P3ZD
-   !!   9.0  !  04-03  (C. Ethe)  Free form and module
+   !! History :    -   !  1996-01  (M. Levy)  original code
+   !!              -   !  1999-07  (M. Levy)  for LOBSTER1 or NPZD model
+   !!              -   !  2000-04  (O. Aumont, M.A. Foujols)  HAMOCC3 and P3ZD
+   !!             1.0  !  2004-03  (C. Ethe) Free form and module
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  revised architecture
    !!----------------------------------------------------------------------
-   !!  TOP 1.0,  LOCEAN-IPSL (2005)
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/TOP_SRC/par_trc.F90,v 1.6 2007/10/12 09:22:19 opalod Exp $
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Id$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
-   !! * Modules used
-#if defined key_passivetrc
-
-   USE par_trc_trp
+   USE par_kind          ! kind parameters
+   !
+   USE par_lobster   ! LOBSTER model
+   USE par_pisces    ! PISCES  model
+   USE par_cfc       ! CFC 11 and 12 tracers
+   USE par_my_trc    ! user defined passive tracers
 
    IMPLICIT NONE
    PUBLIC
 
-
-#if defined key_trc_diatrd
-
-!! number of dynamical trends
-#  if defined key_trcldf_eiv
-!! we keep 3 more trends for eddy induced flux (gent velocity)
-#    if defined key_trcdmp
-   INTEGER , PARAMETER :: jpdiatrc = 11
-#    else
-   INTEGER , PARAMETER :: jpdiatrc = 10
-#    endif
-#  else
-#    if defined key_trcdmp
-   INTEGER , PARAMETER :: jpdiatrc = 8
-#    else
-   INTEGER , PARAMETER :: jpdiatrc = 7
-#    endif
-#  endif
+   ! Passive tracers : Total size
+   ! ---------------               ! total number of passive tracers, of 2d and 3d output and trend arrays
+   INTEGER, PUBLIC, PARAMETER ::   jptra    =  jp_lobster    + jp_pisces     + jp_cfc     + jp_my_trc
+   INTEGER, PUBLIC, PARAMETER ::   jpdia2d  =  jp_lobster_2d + jp_pisces_2d  + jp_cfc_2d  + jp_my_trc_2d
+   INTEGER, PUBLIC, PARAMETER ::   jpdia3d  =  jp_lobster_3d + jp_pisces_3d  + jp_cfc_3d  + jp_my_trc_3d
+   !                     ! total number of sms diagnostic arrays
+   INTEGER, PUBLIC, PARAMETER ::   jpdiabio = jp_lobster_trd + jp_pisces_trd + jp_cfc_trd + jp_my_trc_trd
+   
+   !  1D configuration ("key_c1d")
+   ! -----------------
+# if defined key_c1d
+   LOGICAL, PUBLIC, PARAMETER ::   lk_trc_c1d   = .TRUE.   !: 1D pass. tracer configuration flag
+# else   
+   LOGICAL, PUBLIC, PARAMETER ::   lk_trc_c1d   = .FALSE.  !: 1D pass. tracer configuration flag
 # endif
 
+   ! Passive tracers : size for TRP trends diagnotics (used if 'key_trc_diatrd' defined)
+#if defined key_trcldf_eiv
+# if defined key_trcdmp
+   INTEGER, PARAMETER :: jpdiatrc = 11      !: trends: 3*(advection + diffusion + eiv ) + damping + sms
+# else
+   INTEGER, PARAMETER :: jpdiatrc = 10      !: trends: 3*(advection + diffusion + eiv )           + sms
+# endif
 #else
-   !!======================================================================
-   !!  Empty module : No passive tracer 
-   !!======================================================================
+# if defined key_trcdmp
+   INTEGER, PARAMETER :: jpdiatrc =  8      !: trends: 3*(advection + diffusion       ) + damping + sms
+# else
+   INTEGER, PARAMETER :: jpdiatrc =  7      !: trends: 3*(advection + diffusion       ) + damping + sms
+# endif
 #endif
 
+   !!======================================================================
 END MODULE par_trc
Index: trunk/NEMO/TOP_SRC/prtctl_trc.F90
===================================================================
--- trunk/NEMO/TOP_SRC/prtctl_trc.F90	(revision 944)
+++ trunk/NEMO/TOP_SRC/prtctl_trc.F90	(revision 945)
@@ -1,10 +1,19 @@
 MODULE prtctl_trc
-   !!==============================================================================
-   !!                       ***  MODULE prtctl   ***
-   !! Ocean system   : print all SUM trends for each processor domain
-   !!==============================================================================
-#if defined key_passivetrc
-
-   USE par_trc_trp
+   !!======================================================================
+   !!                         ***  MODULE prtctl_trc  ***
+   !! TOP :   print all SUM trends for each processor domain
+   !!======================================================================
+   !! History :    -   !  2005-07  (C. Talandier) original code for OPA
+   !!             1.0  !  2005-10  (C. Ethe     ) adapted to passive tracer
+   !!----------------------------------------------------------------------
+#if defined key_top
+   !!----------------------------------------------------------------------
+   !!   'key_top'                                                TOP models
+   !!----------------------------------------------------------------------
+   !!   prt_ctl_trc      :   control print in mpp for passive tracers
+   !!   prt_ctl_trc_info :   ???
+   !!   prt_ctl_trc_init :   ???
+   !!----------------------------------------------------------------------
+   USE par_trc          ! TOP parameters
    USE oce_trc          ! ocean space and time domain variables
    USE in_out_manager   ! I/O manager
@@ -14,30 +23,26 @@
    PRIVATE
 
-   !! * Module declaration
-   INTEGER, DIMENSION(:), ALLOCATABLE :: numid_trc  ! logical unit 
-   INTEGER, DIMENSION(:), ALLOCATABLE, SAVE ::   &  !:
-      nlditl , nldjtl ,   &  !: first, last indoor index for each i-domain
-      nleitl , nlejtl ,   &  !: first, last indoor index for each j-domain
-      nimpptl, njmpptl,   &  !: i-, j-indexes for each processor
-      nlcitl , nlcjtl ,   &  !: dimensions of every subdomain
-      ibonitl, ibonjtl
-
-   REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   &  !:
-      tra_ctl                   !: previous trend values
-
-   !! * Routine accessibility
+   INTEGER , DIMENSION(:), ALLOCATABLE ::   numid_trc          !: logical unit 
+   INTEGER , DIMENSION(:), ALLOCATABLE ::   nlditl , nldjtl    !: first, last indoor index for each i-domain
+   INTEGER , DIMENSION(:), ALLOCATABLE ::   nleitl , nlejtl    !: first, last indoor index for each j-domain
+   INTEGER , DIMENSION(:), ALLOCATABLE ::   nimpptl, njmpptl   !: i-, j-indexes for each processor
+   INTEGER , DIMENSION(:), ALLOCATABLE ::   nlcitl , nlcjtl    !: dimensions of every subdomain
+   INTEGER , DIMENSION(:), ALLOCATABLE ::   ibonitl, ibonjtl
+
+   REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   tra_ctl         !: previous trend values
+
    PUBLIC prt_ctl_trc         ! called by all subroutines
    PUBLIC prt_ctl_trc_info    !
    PUBLIC prt_ctl_trc_init    ! called by opa.F90
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
 
 CONTAINS
 
-   SUBROUTINE prt_ctl_trc (tab4d, mask, clinfo, ovlap, kdim, clinfo2)
+   SUBROUTINE prt_ctl_trc( tab4d, mask, clinfo, ovlap, kdim, clinfo2 )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE prt_ctl  ***
@@ -61,33 +66,21 @@
       !!                name must be explicitly typed if used. For instance if the mask
       !!                array tmask(:,:,:) must be passed through the prt_ctl subroutine, 
-      !!                it must looks like: CALL prt_ctl(mask=tmask).
-      !!
-      !!                    tab4d   : 4D array
-      !!                    mask    : mask (3D) to apply to the tab4d array
-      !!                    clinfo  : information about the tab3d array
-      !!                    ovlap   : overlap value
-      !!                    kdim    : k- direction for 4D arrays 
-      !!
-      !! History :
-      !!   9.0  !  05-07  (C. Talandier) original code
-      !!        !  05-10  (C. Ethe     ) adapted to passive tracer
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      REAL(wp), DIMENSION(:,:,:,:), INTENT(in), OPTIONAL :: tab4d
-      REAL(wp), DIMENSION(:,:,:), INTENT(in), OPTIONAL :: mask
-      CHARACTER (len=*), DIMENSION(:), INTENT(in), OPTIONAL :: clinfo
-      CHARACTER (len=*), INTENT(in), OPTIONAL :: clinfo2
-      INTEGER, INTENT(in), OPTIONAL :: ovlap
-      INTEGER, INTENT(in), OPTIONAL :: kdim
-
-      !! * Local declarations
-      INTEGER  :: overlap, jn, js, sind, eind, kdir, j_id
-      REAL(wp) :: zsum, zvctl
-      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zmask, ztab3d
-      CHARACTER (len=20), DIMENSION(jptra) :: cl
-      CHARACTER (len=10) :: cl2
-      !!----------------------------------------------------------------------
-
-      ! Arrays, scalars initialization 
+      !!                it must looks like: CALL prt_ctl( mask=tmask ).
+      !!----------------------------------------------------------------------
+      REAL(wp)         , DIMENSION(:,:,:,:), INTENT(in), OPTIONAL ::   tab4d     ! 4D array
+      REAL(wp)         , DIMENSION(:,:,:)  , INTENT(in), OPTIONAL ::   mask      ! 3D mask to apply to the tab4d array
+      CHARACTER (len=*), DIMENSION(:)      , INTENT(in), OPTIONAL ::   clinfo    ! information about the tab3d array
+      CHARACTER (len=*)                    , INTENT(in), OPTIONAL ::   clinfo2   ! ???
+      INTEGER                              , INTENT(in), OPTIONAL ::   ovlap     ! overlap value
+      INTEGER                              , INTENT(in), OPTIONAL ::   kdim      ! k- direction for 4D arrays
+      !!
+      INTEGER  ::   overlap, jn, js, sind, eind, kdir, j_id
+      REAL(wp) ::   zsum, zvctl
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zmask, ztab3d
+      CHARACTER (len=20), DIMENSION(jptra) ::   cl
+      CHARACTER (len=10) ::   cl2
+      !!----------------------------------------------------------------------
+
+      !                                      ! Arrays, scalars initialization 
       overlap       = 0
       kdir          = jpkm1
@@ -99,18 +92,15 @@
       zmask (:,:,:) = 1.e0
 
-      ! Control of optional arguments
-
-      IF( PRESENT(ovlap)   )  overlap       = ovlap
-      IF( PRESENT(kdim)    )  kdir          = kdim
-      IF( PRESENT(clinfo ) )  cl(:)         = clinfo(:)
-      IF( PRESENT(clinfo2) )  cl2           = clinfo2
-      IF( PRESENT(mask)    )  zmask (:,:,:) = mask(:,:,:)
-
-      IF( lk_mpp )   THEN
-         ! processor number
+      !                                      ! Control of optional arguments
+      IF( PRESENT(ovlap)   )   overlap       = ovlap
+      IF( PRESENT(kdim)    )   kdir          = kdim
+      IF( PRESENT(clinfo ) )   cl(:)         = clinfo(:)
+      IF( PRESENT(clinfo2) )   cl2           = clinfo2
+      IF( PRESENT(mask)    )   zmask (:,:,:) = mask(:,:,:)
+
+      IF( lk_mpp )   THEN      ! processor number
          sind = narea
          eind = narea
-      ELSE
-         ! processors total number
+      ELSE                     ! processors total number
          sind = 1
          eind = ijsplt
@@ -119,7 +109,7 @@
       ! Loop over each sub-domain, i.e. the total number of processors ijsplt
       DO js = sind, eind
-
+         !
          ! Set logical unit
-         j_id = numid_trc(js - narea + 1)
+         j_id = numid_trc( js - narea + 1 )
          ! Set indices for the SUM control
          IF( .NOT. lsp_area ) THEN
@@ -130,8 +120,8 @@
                njctle = nlejtl(js) + overlap * MIN( 1, nlcjtl(js) - nlejtl(js))
                ! Do not take into account the bound of the domain
-               IF( ibonitl(js) == -1 .OR. ibonitl(js) == 2 ) nictls = MAX(2, nictls)
-               IF( ibonitl(js) ==  1 .OR. ibonitl(js) == 2 ) nictle = MIN(nictle, nleitl(js) - 1)
-               IF( ibonjtl(js) == -1 .OR. ibonjtl(js) == 2 ) njctls = MAX(2, njctls)
-               IF( ibonjtl(js) ==  1 .OR. ibonjtl(js) == 2 ) njctle = MIN(njctle, nlejtl(js) - 1)
+               IF( ibonitl(js) == -1 .OR. ibonitl(js) == 2 )   nictls = MAX( 2, nictls )
+               IF( ibonitl(js) ==  1 .OR. ibonitl(js) == 2 )   nictle = MIN( nictle, nleitl(js) - 1 )
+               IF( ibonjtl(js) == -1 .OR. ibonjtl(js) == 2 )   njctls = MAX( 2, njctls )
+               IF( ibonjtl(js) ==  1 .OR. ibonjtl(js) == 2 )   njctle = MIN( njctle, nlejtl(js) - 1 )
             ELSE
                nictls = MAX( 1, nimpptl(js) + nlditl(js) - 1 - overlap )
@@ -140,59 +130,49 @@
                njctle = njmpptl(js) + nlejtl(js) - 1 + overlap * MIN( 1, nlcjtl(js) - nlejtl(js) ) 
                ! Do not take into account the bound of the domain
-               IF( ibonitl(js) == -1 .OR. ibonitl(js) == 2 ) nictls = MAX(2, nictls)
-               IF( ibonjtl(js) == -1 .OR. ibonjtl(js) == 2 ) njctls = MAX(2, njctls)
-               IF( ibonitl(js) ==  1 .OR. ibonitl(js) == 2 ) nictle = MIN(nictle, nimpptl(js) + nleitl(js) - 2)
-               IF( ibonjtl(js) ==  1 .OR. ibonjtl(js) == 2 ) njctle = MIN(njctle, njmpptl(js) + nlejtl(js) - 2)
+               IF( ibonitl(js) == -1 .OR. ibonitl(js) == 2 )   nictls = MAX( 2, nictls )
+               IF( ibonjtl(js) == -1 .OR. ibonjtl(js) == 2 )   njctls = MAX( 2, njctls )
+               IF( ibonitl(js) ==  1 .OR. ibonitl(js) == 2 )   nictle = MIN( nictle, nimpptl(js) + nleitl(js) - 2 )
+               IF( ibonjtl(js) ==  1 .OR. ibonjtl(js) == 2 )   njctle = MIN( njctle, njmpptl(js) + nlejtl(js) - 2 )
             ENDIF
          ENDIF
-         
+         !
          IF( PRESENT(clinfo2) ) THEN
             DO jn = 1, jptra
                zvctl  = tra_ctl(jn,js)
                ztab3d(:,:,:) = tab4d(:,:,:,jn)
-               zsum          = SUM( ztab3d(nictls:nictle,njctls:njctle,1:kdir) &
-                  &                 *zmask(nictls:nictle,njctls:njctle,1:kdir) )
+               zsum          = SUM( ztab3d(nictls:nictle,njctls:njctle,1:kdir)   &
+                  &                * zmask(nictls:nictle,njctls:njctle,1:kdir) )
                WRITE(j_id,FMT="(3x,a,' : ',D23.16)") cl(jn), zsum-zvctl
                tra_ctl(jn,js) = zsum
-            ENDDO
+            END DO
          ELSE
             DO jn = 1, jptra
                ztab3d(:,:,:) = tab4d(:,:,:,jn)
-               zsum          = SUM( ztab3d(nictls:nictle,njctls:njctle,1:kdir) &
-                  &               * zmask(nictls:nictle,njctls:njctle,1:kdir) )
+               zsum          = SUM( ztab3d(nictls:nictle,njctls:njctle,1:kdir)   &
+                  &               *  zmask(nictls:nictle,njctls:njctle,1:kdir) )
                WRITE(j_id,FMT="(3x,a,' : ',D23.16)") cl(jn), zsum
             END DO
          ENDIF
-         
-
-      ENDDO
-
+         !
+      END DO
+      !
    END SUBROUTINE prt_ctl_trc
 
-   SUBROUTINE prt_ctl_trc_info (clinfo)
+
+   SUBROUTINE prt_ctl_trc_info( clinfo )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE prt_ctl_trc_info  ***
       !!
       !! ** Purpose : - print information without any computation
-      !!
-      !! ** Action  : - input arguments
-      !!                    clinfo : information to print
-      !!
-      !! History :
-      !!   9.0  !  05-07  (C. Talandier) original code
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      CHARACTER (len=*), INTENT(in) ::   clinfo
-
-      !! * Local declarations
-      INTEGER ::  js, sind, eind, j_id
-      !!----------------------------------------------------------------------
-
-      IF( lk_mpp )   THEN
-         ! processor number
+      !!----------------------------------------------------------------------
+      CHARACTER (len=*), INTENT(in) ::   clinfo      ! information to print
+      !! 
+      INTEGER ::   js, sind, eind, j_id
+      !!----------------------------------------------------------------------
+
+      IF( lk_mpp ) THEN      ! processor number
          sind = narea
          eind = narea
-      ELSE
-         ! total number of processors
+      ELSE                   ! total number of processors
          sind = 1
          eind = ijsplt
@@ -202,10 +182,10 @@
       DO js = sind, eind
          j_id = numid_trc(js - narea + 1)
-         WRITE(j_id,*)clinfo
-      ENDDO
-
-
+         WRITE(j_id,*) clinfo
+      END DO
+      !
    END SUBROUTINE prt_ctl_trc_info
 
+
    SUBROUTINE prt_ctl_trc_init
       !!----------------------------------------------------------------------
@@ -213,11 +193,6 @@
       !!
       !! ** Purpose :   open ASCII files & compute indices
-      !!
-      !! History :
-      !!   9.0  !  05-07  (C. Talandier) original code
-      !!        !  05-10  (C. Ethe     ) adapted to passive tracer
-      !!----------------------------------------------------------------------
-      !! * Local declarations
-      INTEGER ::   js, sind, eind, j_id
+      !!----------------------------------------------------------------------
+      INTEGER            ::   js, sind, eind, j_id
       CHARACTER (len=31) :: clfile_out
       CHARACTER (len=27) :: clb_name
@@ -225,19 +200,18 @@
       !!----------------------------------------------------------------------
 
-      ! Allocate arrays
-      ALLOCATE(nlditl (ijsplt))
-      ALLOCATE(nldjtl (ijsplt))
-      ALLOCATE(nleitl (ijsplt))
-      ALLOCATE(nlejtl (ijsplt))
-      ALLOCATE(nimpptl(ijsplt))
-      ALLOCATE(njmpptl(ijsplt))
-      ALLOCATE(nlcitl (ijsplt))
-      ALLOCATE(nlcjtl (ijsplt))
-      ALLOCATE(tra_ctl(jptra,ijsplt))
-      ALLOCATE(ibonitl(ijsplt))
-      ALLOCATE(ibonjtl(ijsplt))
-
-      ! Initialization 
-      tra_ctl (:,:)=0.e0
+      !                             ! Allocate arrays
+      ALLOCATE( nlditl (ijsplt) )
+      ALLOCATE( nldjtl (ijsplt) )
+      ALLOCATE( nleitl (ijsplt) )
+      ALLOCATE( nlejtl (ijsplt) )
+      ALLOCATE( nimpptl(ijsplt) )
+      ALLOCATE( njmpptl(ijsplt) )
+      ALLOCATE( nlcitl (ijsplt) )
+      ALLOCATE( nlcjtl (ijsplt) )
+      ALLOCATE( tra_ctl(jptra,ijsplt) )
+      ALLOCATE( ibonitl(ijsplt) )
+      ALLOCATE( ibonjtl(ijsplt) )
+
+      tra_ctl(:,:) = 0.e0           ! Initialization to zero
 
       IF( lk_mpp ) THEN
@@ -264,10 +238,10 @@
          eind = ijsplt
          clb_name = "('mono.top.output_',I3.3)"
-         cl_run = 'MONO processor run '
+         cl_run   = 'MONO processor run '
          ! compute indices for each area as done in mpp_init subroutine
          CALL sub_dom
       ENDIF
 
-      ALLOCATE(numid_trc(eind-sind+1))
+      ALLOCATE( numid_trc(eind-sind+1) )
 
       DO js = sind, eind
@@ -278,11 +252,11 @@
          WRITE(j_id,*)
          WRITE(j_id,*) '                 L O D Y C - I P S L'
-         WRITE(j_id,*) '                     O P A model'
+         WRITE(j_id,*) '                       N E M 0 '
          WRITE(j_id,*) '            Ocean General Circulation Model'
-         WRITE(j_id,*) '               version OPA 9.0  (2005) '
+         WRITE(j_id,*) '               version TOP 1.0  (2005) '
          WRITE(j_id,*)
          WRITE(j_id,*) '                   PROC number: ', js
          WRITE(j_id,*)
-         WRITE(j_id,FMT="(19x,a20)")cl_run
+         WRITE(j_id,FMT="(19x,a20)") cl_run
 
          ! Print the SUM control indices
@@ -324,6 +298,6 @@
 9003     FORMAT(a20,i4.4,a17,i4.4)
 9004     FORMAT(a11,i4.4,a26,i4.4,a14)
-      ENDDO
-
+      END DO
+      !
    END SUBROUTINE prt_ctl_trc_init
 
@@ -358,28 +332,17 @@
       !!                    nbondil    : mark for "east-west local boundary"
       !!                    nbondjl    : mark for "north-south local boundary"
-      !!
-      !! History :
-      !!        !  94-11  (M. Guyon)  Original code
-      !!        !  95-04  (J. Escobar, M. Imbard)
-      !!        !  98-02  (M. Guyon)  FETI method
-      !!        !  98-05  (M. Imbard, J. Escobar, L. Colombet )  SHMEM and MPI versions
-      !!   8.5  !  02-08  (G. Madec)  F90 : free form
-      !!----------------------------------------------------------------------
-      !! * Local variables
+      !!----------------------------------------------------------------------
       INTEGER ::   ji, jj, js               ! dummy loop indices
-      INTEGER ::   &
-         ii, ij,                         &  ! temporary integers
-         irestil, irestjl,               &  !    "          "
-         ijpi  , ijpj, nlcil,            &  ! temporary logical unit
-         nlcjl , nbondil, nbondjl,       &
-         nrecil, nrecjl, nldil, nleil, nldjl, nlejl
-
-      INTEGER, DIMENSION(:,:), ALLOCATABLE ::   &
-         iimpptl, ijmpptl, ilcitl, ilcjtl       ! temporary workspace
+      INTEGER ::   ii, ij                   ! temporary integers
+      INTEGER ::   irestil, irestjl         !    "          "
+      INTEGER ::   ijpi  , ijpj, nlcil      ! temporary logical unit
+      INTEGER ::   nlcjl , nbondil, nbondjl
+      INTEGER ::   nrecil, nrecjl, nldil, nleil, nldjl, nlejl
       REAL(wp) ::   zidom, zjdom            ! temporary scalars
-      !!----------------------------------------------------------------------
-
-      !  1. Dimension arrays for subdomains
-      ! -----------------------------------
+      INTEGER, DIMENSION(:,:), ALLOCATABLE ::   iimpptl, ijmpptl, ilcitl, ilcjtl   ! temporary workspace
+      !!----------------------------------------------------------------------
+
+      ! Dimension arrays for subdomains
+      ! -------------------------------
       !  Computation of local domain sizes ilcitl() ilcjtl()
       !  These dimensions depend on global sizes isplt,jsplt and jpiglo,jpjglo
@@ -391,6 +354,6 @@
       ijpj = ( jpjglo-2*jprecj + (jsplt-1) ) / jsplt + 2*jprecj
 
-      ALLOCATE(ilcitl (isplt,jsplt))
-      ALLOCATE(ilcjtl (isplt,jsplt))
+      ALLOCATE( ilcitl (isplt,jsplt) )
+      ALLOCATE( ilcjtl (isplt,jsplt) )
 
       nrecil  = 2 * jpreci
@@ -429,9 +392,9 @@
       END DO
 
-      !  2. Index arrays for subdomains
-      ! -------------------------------
-
-      ALLOCATE(iimpptl(isplt,jsplt))
-      ALLOCATE(ijmpptl(isplt,jsplt))
+      ! Index arrays for subdomains
+      ! ---------------------------
+
+      ALLOCATE( iimpptl(isplt,jsplt) )
+      ALLOCATE( ijmpptl(isplt,jsplt) )
       
       iimpptl(:,:) = 1
@@ -454,6 +417,6 @@
       ENDIF
       
-      ! 3. Subdomain description
-      ! ------------------------
+      ! Subdomain description
+      ! ---------------------
 
       DO js = 1, ijsplt
@@ -492,18 +455,17 @@
       END DO
 
-      DEALLOCATE(iimpptl)
-      DEALLOCATE(ijmpptl)
-      DEALLOCATE(ilcitl)
-      DEALLOCATE(ilcjtl)
-
+      DEALLOCATE( iimpptl )
+      DEALLOCATE( ijmpptl )
+      DEALLOCATE( ilcitl )
+      DEALLOCATE( ilcjtl )
+      !
    END SUBROUTINE sub_dom
  
 #else
    !!----------------------------------------------------------------------
-   !!   Dummy module :                      NO passive tracer
+   !!   Dummy module :                                    NO passive tracer
    !!----------------------------------------------------------------------
 #endif
     
    !!======================================================================
-
 END MODULE prtctl_trc
Index: trunk/NEMO/TOP_SRC/trc.F90
===================================================================
--- trunk/NEMO/TOP_SRC/trc.F90	(revision 944)
+++ trunk/NEMO/TOP_SRC/trc.F90	(revision 945)
@@ -4,206 +4,147 @@
    !! Passive tracers   :  module for tracers defined
    !!======================================================================
-   !! History :
-   !!   8.2  !  96-01  (M. Levy)  Original code
-   !!        !  99-07  (M. Levy)  for LOBSTER1 or NPZD model
-   !!        !  00-04  (O. Aumont, M.A. Foujols)  HAMOCC3 and P3ZD
-   !!   9.0  !  04-03  (C. Ethe)  Free form and module
+   !! History :    -   !  1996-01  (M. Levy)  Original code
+   !!              -   !  1999-07  (M. Levy)  for LOBSTER1 or NPZD model
+   !!              -   !  2000-04  (O. Aumont, M.A. Foujols)  HAMOCC3 and P3ZD
+   !!             1.0  !  2004-03  (C. Ethe)  Free form and module
    !!----------------------------------------------------------------------
-   !!  TOP 1.0,  LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+   !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005) 
+   !! $Id$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
-#if defined key_passivetrc
+#if defined key_top
    !!----------------------------------------------------------------------
-   !!   'key_passivetrc'   :                               Passive tracer
-   !!---------------------------------------------------------------------
-   !! * Modules used
+   !!   'key_top'                                                TOP models
+   !!----------------------------------------------------------------------
    USE par_oce
    USE par_trc
+   
    IMPLICIT NONE
-
    PUBLIC
-
 
    !! passive tracers names and units (read in namelist)
    !! --------------------------------------------------
-   CHARACTER(len=12), PUBLIC, DIMENSION(jptra) :: &
-      ctrcnm  ,   &   !!: tracer name 
-      ctrcun          !!: tracer unit
-
-   CHARACTER(len=80), PUBLIC, DIMENSION(jptra) :: &
-      ctrcnl          !!: tracer long name 
+   CHARACTER(len=12), PUBLIC, DIMENSION(jptra) ::   ctrcnm     !: tracer name 
+   CHARACTER(len=12), PUBLIC, DIMENSION(jptra) ::   ctrcun     !: tracer unit
+   CHARACTER(len=80), PUBLIC, DIMENSION(jptra) ::   ctrcnl     !: tracer long name 
    
    
    !! parameters for the control of passive tracers
    !! --------------------------------------------------
-   INTEGER, PUBLIC ::  &
-      numnat          !!: the number of the passive tracer NAMELIST
-   
-   LOGICAL, PUBLIC, DIMENSION(jptra) ::   &
-      lutini          !!:  initialisation from FILE or not (NAMELIST)
-
-   INTEGER , PUBLIC, DIMENSION(jptra) :: &
-      nutini          !!: FORTRAN LOGICAL UNIT for initialisation file
+   INTEGER, PUBLIC                   ::   numnat   !: the number of the passive tracer NAMELIST
+   LOGICAL, PUBLIC, DIMENSION(jptra) ::   lutini   !:  initialisation from FILE or not (NAMELIST)
+   LOGICAL, PUBLIC, DIMENSION(jptra) ::   lutsav   !:  logical for saving tracer or not
+   INTEGER, PUBLIC, DIMENSION(jptra) ::   nutini   !: FORTRAN LOGICAL UNIT for initialisation file
 
    !! passive tracers fields (before,now,after)
    !! --------------------------------------------------
-   REAL(wp), PUBLIC, SAVE  ::  &
-      trai    ,   &   !!: initial total tracer
-      areatot         !!: total volume 
+   REAL(wp), PUBLIC ::   trai       !: initial total tracer
+   REAL(wp), PUBLIC ::   areatot    !: total volume 
 
-   REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jpk,jptra) :: &
-      trn     ,   &   !!: traceur concentration for actual time step
-      tra     ,   &   !!: traceur concentration for next time step
-      trb             !!: traceur concentration for before time step
+   REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jpk,jptra) ::   trn   !: traceur concentration for actual time step
+   REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jpk,jptra) ::   tra   !: traceur concentration for next time step
+   REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jpk,jptra) ::   trb   !: traceur concentration for before time step
 
 
    !! numerical parameter (NAMELIST)
    !! --------------------------------------------------
-   REAL(wp), PUBLIC  ::  &
-      rsc     ,   &   !!: tuning coefficient for anti-diffusion
-      rtrn            !!: value for truncation
+   REAL(wp), PUBLIC ::   rsc    !: tuning coefficient for anti-diffusion
+   REAL(wp), PUBLIC ::   rtrn   !: value for truncation
 
    !! namelist parameters
    !! --------------------------------------------------
-   INTEGER , PUBLIC  ::  & 
-      ncortrc ,   &   !!: number of corrective phases
-      ndttrc  ,   &   !!: frequency of step on passive tracers
-      nittrc000       !!: first time step of passive tracers model  
-
-   LOGICAL, PUBLIC  ::  & 
-      crosster        !!: logical if true computes crossterms
+   INTEGER , PUBLIC ::   ncortrc     !: number of corrective phases
+   INTEGER , PUBLIC ::   ndttrc      !: frequency of step on passive tracers
+   INTEGER , PUBLIC ::   nittrc000   !: first time step of passive tracers model  
+   LOGICAL , PUBLIC ::   crosster    !: logical if true computes crossterms
 
 
    !! isopycnal scheme for passive tracers
-   !! --------------------------------------------------  
-   REAL(wp), PUBLIC  ::  &
-      ahtrb0  ,   &   !!: background diffusivity coefficient for passive tracer (m2/s)
-      trcrat  ,   &   !!: ratio between passive and active tracer coeff for diffusion
-      ahtrc0  ,   &   !!: horizontal eddy diffusivity for passive tracers (m2/s)
-      aeivtr0         !!: eddy induced velocity coefficient (m2/s)
+   !! ------------------------------------  
+   REAL(wp), PUBLIC ::   ahtrb0     !: background diffusivity coefficient for passive tracer (m2/s)
+   REAL(wp), PUBLIC ::   trcrat     !: ratio between passive and active tracer coeff for diffusion
+   REAL(wp), PUBLIC ::   ahtrc0     !: horizontal eddy diffusivity for passive tracers (m2/s)
+   REAL(wp), PUBLIC ::   aeivtr0    !: eddy induced velocity coefficient (m2/s)
    
    
    !! passive tracers restart (input and output)
-   !! --------------------------------------------------  
-   LOGICAL, PUBLIC  ::  &
-      lrsttr          !!: boolean term for restart i/o for passive tracers (namelist)
-   
-   INTEGER , PUBLIC  ::  &
-      nutwrs  ,   &   !!: output FILE for passive tracers restart
-      nutrst  ,   &   !!: logical unit for restart FILE for passive tracers
-      nrsttr          !!: control of the time step ( 0 or 1 ) for pass. tr.
+   !! ------------------------------------------  
+   LOGICAL , PUBLIC ::   lrsttr     !: boolean term for restart i/o for passive tracers (namelist)
+   INTEGER , PUBLIC ::   nutwrs     !: output FILE for passive tracers restart
+   INTEGER , PUBLIC ::   nutrst     !: logical unit for restart FILE for passive tracers
+   INTEGER , PUBLIC ::   nrsttr     !: control of the time step ( 0 or 1 ) for pass. tr.
    
    
    !! interpolated gradient
    !!--------------------------------------------------  
-   REAL (wp), PUBLIC, DIMENSION (jpi,jpj,jptra) :: &
-      gtru    ,   &   !!: horizontal gradient at u-points at bottom ocean level
-      gtrv            !!: horizontal gradient at v-points at bottom ocean level
+   REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jptra) ::   gtru   !: horizontal gradient at u-points at bottom ocean level
+   REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jptra) ::   gtrv   !: horizontal gradient at v-points at bottom ocean level
 
    
-#if defined key_trcldf_eiv && defined key_diaeiv
+# if defined key_trcldf_eiv && defined key_diaeiv
    !! The three component of the eddy induced velocity
    !! --------------------------------------------------
-   REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jpk) :: &
-      u_trc_eiv,  &   !!: u-eiv (m/s)
-      v_trc_eiv,  &   !!: v-eiv (m/s)
-      w_trc_eiv       !!: w-eiv (m/s)
-#endif
+   REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jpk) ::   u_trc_eiv   !: u-eiv (m/s)
+   REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jpk) ::   v_trc_eiv   !: v-eiv (m/s)
+   REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jpk) ::   w_trc_eiv   !: w-eiv (m/s)
+# endif
    
    
    !! information for outputs
    !! --------------------------------------------------
-   INTEGER , PUBLIC   ::  & 
-      nwritetrc       !!: time step frequency for concentration outputs (namelist)
+   INTEGER , PUBLIC ::   nwritetrc   !: time step frequency for concentration outputs (namelist)
    
-#if defined key_trc_diaadd
+# if defined key_trc_diaadd
    !! additional 2D/3D outputs namelist
    !! --------------------------------------------------
-   CHARACTER(len=8), PUBLIC, DIMENSION (jpdia2d) ::  & 
-      ctrc2d  ,   &   !!: 2d output field name
-      ctrc2u          !!: 2d output field unit
+   CHARACTER(len= 8), PUBLIC, DIMENSION (jpdia2d) ::   ctrc2d   !: 2d output field name
+   CHARACTER(len= 8), PUBLIC, DIMENSION (jpdia2d) ::   ctrc2u   !: 2d output field unit   
+   CHARACTER(len= 8), PUBLIC, DIMENSION (jpdia3d) ::   ctrc3d   !: 3d output field name
+   CHARACTER(len= 8), PUBLIC, DIMENSION (jpdia3d) ::   ctrc3u   !: 3d output field unit
+   CHARACTER(len=80), PUBLIC, DIMENSION (jpdia2d) ::   ctrc2l   !: 2d output field long name
+   CHARACTER(len=80), PUBLIC, DIMENSION (jpdia3d) ::   ctrc3l   !: 3d output field long name
+
    
-   CHARACTER(len=8), PUBLIC, DIMENSION (jpdia3d) ::  & 
-      ctrc3d ,    &   !!: 3d output field name
-      ctrc3u          !!: 3d output field unit
-   
-   CHARACTER(len=80), PUBLIC, DIMENSION (jpdia2d) ::  & 
-      ctrc2l          !!: 2d output field long name
-   
-   CHARACTER(len=80), PUBLIC, DIMENSION (jpdia3d) ::  & 
-      ctrc3l          !!: 3d output field long name
-   
-   REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jpdia2d) ::  &  
-      trc2d           !!:  additional 2d outputs  
-   
-   REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jpk,jpdia3d) ::  &  
-      trc3d           !!:  additional 3d outputs  
+   REAL(wp), PUBLIC, DIMENSION (jpi,jpj,    jpdia2d) ::   trc2d   !:  additional 2d outputs  
+   REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jpk,jpdia3d) ::   trc3d   !:  additional 3d outputs  
    
    
    !! netcdf files and index common
    !! --------------------------------------------------
-   INTEGER , PUBLIC :: &
-      nwriteadd     !!: frequency of additional arrays outputs(namelist)
-#endif
+   INTEGER , PUBLIC ::   nwritedia     !: frequency of additional arrays outputs(namelist)
+# endif
    
-#if defined key_trc_diatrd
+# if defined key_trc_diatrd
    
    !!  non conservative trends (biological, ...)
    !! --------------------------------------------------
-   LOGICAL, PUBLIC, DIMENSION (jptra)  ::  &  
-      luttrd          !!: large trends diagnostic to write or not (namelist)
+   LOGICAL, PUBLIC, DIMENSION (jptra) ::   luttrd   !: large trends diagnostic to write or not (namelist)
    
-   !!  dynamical trends
-   !!	trtrd()   : trends of the tracer equations
-   !!           1 : X advection
-   !!           2 : Y advection
-   !!           3 : Z advection
-   !!           4 : X diffusion
-   !!           5 : Y diffusion
-   !!           6 : Z diffusion
-   !!           7 : X gent velocity
-   !!           8 : Y gent velocity
-   !!           9 : Z gent velocity
+   !!  Advection-diffusion trends
    !! --------------------------------------------------
+   REAL(wp), PUBLIC, DIMENSION(:,:,:,:,:), ALLOCATABLE ::   trtrd   !: trends of the tracer equations
    
-   
-   REAL(wp), PUBLIC, DIMENSION(:,:,:,:,:), ALLOCATABLE, SAVE :: &
-      trtrd           !!: trends of the tracer equations
-   
-   INTEGER, PUBLIC, DIMENSION(jptra), SAVE :: ikeep ! indice of tracer for which dyn trends are stored
-   INTEGER, PUBLIC, SAVE                   :: nkeep ! number of tracers for which dyn trends are stored 
-                                                    ! (used to allocate trtrd buffer)
+   INTEGER, PUBLIC, DIMENSION(jptra) :: ikeep ! indice of tracer for which dyn trends are stored
+   INTEGER, PUBLIC                   :: nkeep ! number of tracers for which dyn trends are stored 
+   !                                          ! (used to allocate trtrd buffer)
 
    !! netcdf files and index common
    !! --------------------------------------------------
-   INTEGER , PUBLIC :: &
-      nwritetrd       !!: frequency of additional arrays outputs(namelist)
+   INTEGER , PUBLIC ::   nwritetrd   !: frequency of additional arrays outputs(namelist)
    
-#endif 
+# endif 
    
    !! passive tracers data read and at given time_step
    !! --------------------------------------------------
-#if defined key_dtatrc
-   
-   INTEGER , PUBLIC, DIMENSION(jptra) :: &
-      numtr          !!: logical unit for passive tracers data
-   
+# if defined key_dtatrc
+   INTEGER , PUBLIC, DIMENSION(jptra) ::   numtr   !: logical unit for passive tracers data
+# endif
+
+#else
+   !!----------------------------------------------------------------------
+   !!  Empty module :                                     No passive tracer
+   !!----------------------------------------------------------------------
 #endif
 
-  !!  1D configuration
-  !! --------------------------------------------------
-#if defined key_cf1d
-      LOGICAL, PARAMETER ::   lk_trccfg_1d   = .TRUE.   !: 1D pass. tracer configuration flag
-#else   
-      LOGICAL, PARAMETER ::   lk_trccfg_1d   = .FALSE.  !: 1D pass. tracer configuration flag
-#endif
-
-
-#else
    !!======================================================================
-   !!  Empty module : No passive tracer 
-   !!======================================================================
-#endif
-
 END MODULE trc
Index: trunk/NEMO/TOP_SRC/trcctl.F90
===================================================================
--- trunk/NEMO/TOP_SRC/trcctl.F90	(revision 944)
+++ trunk/NEMO/TOP_SRC/trcctl.F90	(revision 945)
@@ -1,20 +1,15 @@
 MODULE trcctl
-   !!==========================================================================
-   !!
-   !!                       *** MODULE trcctl ***
-   !!
-   !! Only for passive tracer
-   !! control the cpp options for the run and IF files are availables
-   !! control also consistancy between options and namelist values
-   !!  O.Aumont and A.El Moussaoui 03/05 F90 
-   !!=========================================================================
-   !!  TOP 1.0,  LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+   !!======================================================================
+   !!                         ***  MODULE trcctl  ***
+   !! TOP :   control the cpp options, files and namelist values of a run
+   !!======================================================================
+   !! History :   1.0  !  2005-03 (O. Aumont, A. El Moussaoui) original code
    !!----------------------------------------------------------------------
-#if defined key_passivetrc
+#if defined key_top
    !!----------------------------------------------------------------------
-   !! * Modules used
-   !! ==============
+   !!   'key_top'                                                TOP models
+   !!----------------------------------------------------------------------
+   !!   trc_ctl    : control the cpp options, files and namelist values
+   !!----------------------------------------------------------------------
    USE oce_trc
    USE trc
@@ -25,76 +20,49 @@
    PRIVATE
 
-   !! * Accessibility
-   PUBLIC trc_ctl
+   PUBLIC trc_ctl      ! called by ???
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
 
 CONTAINS
 
    SUBROUTINE trc_ctl
-      !!===========================================================================================
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_ctl  ***
       !!
-      !!
-      !!                       ROUTINE trcctl
-      !!                     ******************
-      !!
-      !!      we use IF/ENDIF inside #IF defined option-cpp
-      !!      FILE name must not exceed 21 characters
-      !!      
-      !!===========================================================================================
-      
+      !! ** Purpose :   control the cpp options, namelist and files 
+      !!              we use IF/ENDIF inside #IF defined option-cpp
+      !!              FILE name must not exceed 21 characters
       !!----------------------------------------------------------------------
-      !! local declarations
-      !! ==================
-      INTEGER  :: istop, jn
-      
-      !!---------------------------------------------------------------------
-      !!  OPA.9    03/2005  
-      !!---------------------------------------------------------------------
+      INTEGER ::   istop, jn
+      !!----------------------------------------------------------------------
 
-      ! 0. Parameter
-      ! ------------
-      istop = 0
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) ' trc_ctl :   passive tracer option'
+      IF(lwp) WRITE(numout,*) ' ~~~~~~~'
 
-      ! 1. restart for passive tracer (input)
-      ! -----------------------------
+      istop = 0      ! initialise to zero
 
-      IF(lwp) WRITE(numout,*) ' '
-      IF(lwp) WRITE(numout,*) ' *** PASSIVE TRACER MODEL OPTIONS'
-      IF(lwp) WRITE(numout,*) ' *** CONTROL'
-      IF(lwp) WRITE(numout,*) ' '
-
-      IF(lwp) WRITE(numout,*) ' '
-      IF(lwp) WRITE(numout,*) ' *** restart option for passive tracer'
-      IF(lwp) WRITE(numout,*) ' '
-
-      IF(lrsttr) THEN
-         IF(lwp) WRITE(numout,*) ' READ a restart FILE for passive tracer'
+      ! restart for passive tracer (input)
+      IF( lrsttr ) THEN
+         IF(lwp) WRITE(numout,*) '       READ a restart FILE for passive tracer'
          IF(lwp) WRITE(numout,*) ' '
       ELSE
-         IF(lwp) WRITE(numout,*) ' no restart FILE'
-         IF(lwp) WRITE(numout,*) ' '
-
-         ! 2. OPEN FILES for initial tracer value
-         ! --------------------------------------
-         DO jn=1,jptra
-
-            ! OPEN input FILE only IF lutini(jn) is true
-            ! ------------------------------------------
-            IF (lutini(jn)) THEN  
-
-               ! prepare input FILE name a
-               ! -------------------------                        
+         IF(lwp) WRITE(numout,*) '       no restart FILE'
+         IF(lwp) WRITE(numout,*)
+         DO jn = 1, jptra
+            IF( lutini(jn) ) THEN      ! OPEN input FILE only IF lutini(jn) is true
                IF(lwp) WRITE(numout,*)  &
-                  ' READ an initial FILE  for passive tracer number :',jn        &
-                  ,' traceur : ',ctrcnm(jn) 
-               IF(lwp) WRITE(numout,*) ' '
+                  '       READ an initial FILE  for passive tracer number :', jn, ' traceur : ', ctrcnm(jn) 
             END IF
          END DO
       ENDIF
 
-      ! 3. Don't USE non penetrative convective mixing option
-      !     it's not implemented for passive tracer
-      ! -----------------------------------------------------
-
-      IF( ln_zdfnpc) THEN
+      ! Don't USE non penetrative convective mixing option
+      ! it's not implemented for passive tracer
+      IF( ln_zdfnpc ) THEN
          IF(lwp) WRITE (numout,*) ' ===>>>> : w a r n i n g '
          IF(lwp) WRITE (numout,*) ' =======   ============= '
@@ -105,54 +73,47 @@
       ENDIF
 
-      ! 4. transport scheme option
-      ! --------------------------
-
-      IF(lwp) WRITE(numout,*) '  '
+      ! transport scheme option
       CALL trc_trp_ctl
 
-
-      ! 5. SMS model
-      ! ---------------------------------------------
-
+      ! SMS model
       IF(lwp) WRITE(numout,*) '  '
-      IF(lwp) WRITE(numout,*) ' *** Source/Sink model option'
+      IF(lwp) WRITE(numout,*) '       Source/Sink model option'
       IF(lwp) WRITE(numout,*) '  '
 
+# if defined key_lobster
+#   include "trcctl.lobster.h90"
 
-#if defined key_trc_lobster1
-#   include "trcctl.lobster1.h90"
-#elif defined key_trc_pisces
+# elif defined key_pisces
 #   include "trcctl.pisces.h90"
-#elif defined key_cfc
+
+# elif defined key_cfc
 #   include "trcctl.cfc.h90"
-#else
 
-      IF(lwp) WRITE (numout,*) ' No Source/Sink model '
-      IF(lwp) WRITE (numout,*) ' '
+# else
+      IF(lwp) WRITE (numout,*) '       No Source/Sink '
+      IF(lwp) WRITE (numout,*)
 #endif
 
       ! E r r o r  control
       ! ------------------
-
-      IF ( istop > 0  ) THEN
+      IF( istop > 0  ) THEN
          IF(lwp)WRITE(numout,*)
          IF(lwp)WRITE(numout,*) istop,' E R R O R found : we stop'
-         IF(lwp)WRITE(numout,*) '**************************'
+         IF(lwp)WRITE(numout,*) '  **************************'
          IF(lwp)WRITE(numout,*)
          STOP 'trcctl'
       ENDIF
-
+      !
    END SUBROUTINE trc_ctl
 
 #else
-   !!======================================================================
-   !!  Empty module : No passive tracer
-   !!======================================================================
+   !!----------------------------------------------------------------------
+   !!  Empty module :                                     No passive tracer
+   !!----------------------------------------------------------------------
 CONTAINS
-   SUBROUTINE trc_ctl
-
+   SUBROUTINE trc_ctl                      ! Dummy routine
    END SUBROUTINE trc_ctl
-   
 #endif
 
+   !!======================================================================
 END MODULE trcctl
Index: trunk/NEMO/TOP_SRC/trcdia.F90
===================================================================
--- trunk/NEMO/TOP_SRC/trcdia.F90	(revision 944)
+++ trunk/NEMO/TOP_SRC/trcdia.F90	(revision 945)
@@ -1,17 +1,15 @@
 MODULE trcdia
-   !!==========================================================================
-   !!
+   !!======================================================================
    !!                       *** MODULE trcdia ***
-   !! Output  for tracer concentration  
-   !! O.Aumont and A.El Moussaoui 03/05 F90 
-   !!==========================================================================
-   !!  TOP 1.0,  LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+   !! TOP :   Output of passive tracers
+   !!======================================================================
+   !! History :   1.0  !  2005-03 (O. Aumont, A. El Moussaoui) original code
    !!----------------------------------------------------------------------
-#if defined key_passivetrc
+#if defined key_top
    !!----------------------------------------------------------------------
-   !! * Modules used
- 
+   !!   'key_top'                                                TOP models
+   !!----------------------------------------------------------------------
+   !!   trc_dia    :  output passive tracer fields
+   !!----------------------------------------------------------------------
    USE trcdit
 
@@ -19,60 +17,48 @@
    PRIVATE
 
-   !! * Accessibility
-   PUBLIC trc_dia
+   PUBLIC trc_dia      ! called by ???
 
-   !! * Module variables
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
 
 CONTAINS
 
-   SUBROUTINE trc_dia(kt,kindic)  
-      !!===========================================================================================
+   SUBROUTINE trc_dia( kt, kindic )  
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_dia  ***
       !!
-      !!                       ROUTINE trcdii_wr
-      !!===========================================================================================
+      !! ** Purpose :   output passive tracers fields 
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT( in ) :: kt, kindic
+      !!---------------------------------------------------------------------
+      
+      CALL trcdit_wr( kt, kindic )      ! outputs for tracer concentration
 
-      INTEGER, INTENT( in ) :: kt, kindic
+# if defined key_trc_diatrd
+      CALL trcdid_wr( kt, kindic )      ! outputs for dynamical trends
+# endif
 
-      ! outputs for tracer concentration
-      ! -------------------------------- 
+# if defined key_trc_diaadd
+      CALL trcdii_wr( kt, kindic )      ! outputs for additional arrays
+# endif
 
-      CALL trcdit_wr(kt,kindic)
-
-#if defined key_trc_diatrd
-
-      ! outputs for dynamical trends
-      ! ----------------------------
-
-      CALL trcdid_wr(kt,kindic)
-
-#endif
-#if defined key_trc_diaadd
-
-      ! outputs for additional arrays
-      ! -----------------------------
-
-      CALL trcdii_wr(kt,kindic)
-
-#endif
-#if defined key_trc_diabio
-
-      ! outputs for biological trends
-      ! -----------------------------
-
-      CALL trcdib_wr(kt,kindic)
-
-#endif
-
+# if defined key_trc_diabio
+      CALL trcdib_wr( kt, kindic )      ! outputs for biological trends
+# endif
+      !
    END SUBROUTINE trc_dia
 
 #else
-   !!======================================================================
-   !!  Empty module : No passive tracer
-   !!======================================================================
+   !!----------------------------------------------------------------------
+   !!  Dummy module :                                     No passive tracer
+   !!----------------------------------------------------------------------
 CONTAINS
-   SUBROUTINE trc_dia
-      
+   SUBROUTINE trc_dia                      ! Empty routine   
    END SUBROUTINE trc_dia   
 #endif
 
+   !!======================================================================
 END MODULE trcdia
Index: trunk/NEMO/TOP_SRC/trcdit.F90
===================================================================
--- trunk/NEMO/TOP_SRC/trcdit.F90	(revision 944)
+++ trunk/NEMO/TOP_SRC/trcdit.F90	(revision 945)
@@ -1,10 +1,23 @@
 MODULE trcdit
+   !!======================================================================
+   !!                       *** MODULE trcdit ***
+   !! TOP :   Output of passive tracers
+   !! O.Aumont and A.El Moussaoui 03/05 F90 
+   !!======================================================================
+   !! History :    -   !  1995-01 (M. Levy)  Original code
+   !!              -   !  1998-01 (C. Levy) NETCDF format using ioipsl interface
+   !!              -   !  1999-01 (M.A. Foujols) adapted for passive tracer
+   !!              -   !  1999-09 (M.A. Foujols) split into three parts
+   !!             1.0  !  2005-03 (O. Aumont, A. El Moussaoui) F90
    !!----------------------------------------------------------------------
-   !!  TOP 1.0,  LOCEAN-IPSL (2005) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/TOP_SRC/trcdit.F90,v 1.9 2007/10/12 09:22:19 opalod Exp $ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+#if defined key_top
    !!----------------------------------------------------------------------
-   !! * Modules used
-   !! ==============
+   !!   'key_top'                                                TOP models
+   !!----------------------------------------------------------------------
+   !! trcdit_wr   :
+   !! trcdid_wr   :
+   !! trcdii_wr   :
+   !! trcdib_wr   : 
+   !!----------------------------------------------------------------------
    USE oce_trc
    USE trc
@@ -12,131 +25,92 @@
    USE in_out_manager  ! I/O manager
    USE lib_mpp
+   USE ioipsl
 
    IMPLICIT NONE
    PRIVATE
 
-   !! * Accessibility
-   PUBLIC trcdit_wr
-   PUBLIC trcdid_wr
-   PUBLIC trcdii_wr
-   PUBLIC trcdib_wr
-
-   !! * Module variables
-   INTEGER            ::  &
-      nit5     ,  &   !!: id for tracer output file
-      ndepit5  ,  &   !!: id for depth mesh
-      nhorit5  ,  &   !!: id for horizontal mesh
-      ndimt50  ,  &   !!: number of ocean points in index array
-      ndimt51         !!: number of ocean points in index array
-   REAL(wp) :: zjulian
-   INTEGER , DIMENSION (jpij*jpk) ::  ndext50 !!: integer arrays for ocean 3D index
-   INTEGER , DIMENSION (jpij)     ::  ndext51 !!: integer arrays for ocean surface index
-#    if defined key_passivetrc && defined key_trc_diaadd
-   INTEGER            :: &
-      nitd     ,  &   !!: id for additional array output file
-      ndepitd  ,  &   !!: id for depth mesh
-      nhoritd         !!: id for horizontal mesh
-#    endif
-#    if defined key_passivetrc && defined key_trc_diatrd
-   INTEGER , DIMENSION (jptra)  :: &
-      nit6    ,   &   !!: id for additional array output file
-      ndepit6 ,   &   !!: id for depth mesh
-      nhorit6         !!: id for horizontal mesh
-#    endif
-#    if defined key_passivetrc && defined key_trc_diabio
-   INTEGER            :: &
-      nitb     ,   &  !!:  id for additional array output FILE
-      ndepitb  ,   &  !!:  id for depth mesh
-      nhoritb         !!:  id for horizontal mesh
-
-#    endif
-
+   PUBLIC trcdit_wr      ! caller in trcdia.F90
+   PUBLIC trcdid_wr      ! caller in trcdia.F90
+   PUBLIC trcdii_wr      ! caller in trcdia.F90
+   PUBLIC trcdib_wr      ! caller in trcdia.F90
+
+   INTEGER  ::   nit5      !: id for tracer output file
+   INTEGER  ::   ndepit5   !: id for depth mesh
+   INTEGER  ::   nhorit5   !: id for horizontal mesh
+   INTEGER  ::   ndimt50   !: number of ocean points in index array
+   INTEGER  ::   ndimt51   !: number of ocean points in index array
+   REAL(wp) ::   zjulian   !: ????   not DOCTOR !
+   INTEGER , DIMENSION (jpij*jpk) ::   ndext50   !: integer arrays for ocean 3D index
+   INTEGER , DIMENSION (jpij)     ::   ndext51   !: integer arrays for ocean surface index
+# if defined key_trc_diaadd
+   INTEGER  ::   nitd      !: id for additional array output file
+   INTEGER  ::   ndepitd   !: id for depth mesh
+   INTEGER  ::   nhoritd   !: id for horizontal mesh
+# endif
+# if defined key_trc_diatrd
+   INTEGER , DIMENSION (jptra) ::   nit6      !: id for additional array output file
+   INTEGER , DIMENSION (jptra) ::   ndepit6   !: id for depth mesh
+   INTEGER , DIMENSION (jptra) ::   nhorit6   !: id for horizontal mesh
+# endif
+# if defined key_trc_diabio
+   INTEGER  ::   ndepitb   !:  id for depth mesh
+   INTEGER  ::   nhoritb   !:  id for horizontal mesh
+# endif
 
    !! * Substitutions
-#  include "passivetrc_substitute.h90"
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
 
 CONTAINS
 
-#    if defined key_passivetrc
-
-      SUBROUTINE trcdit_wr(kt,kindic)
-   !!===========================================================================================
-   !!
-   !!                       ROUTINE trcdit_wr
-   !!===========================================================================================
-   !!
-   !! Purpose :
-   !!---------
-   !!          Standard output of passive tracer : concentration fields
-   !!
-   !!
-   !! Method :
-   !! -------
-   !!
-   !!        At the beginning of the first time step (nit000), define all
-   !!        the NETCDF files and fields for concentration of passive tracer
-   !!
-   !!        At each time step call histdef to compute the mean if necessary
-   !!        Each nwritetrc time step, output the instantaneous or mean fields
-   !!
-   !!        IF kindic <0, output of fields before the model interruption.
-   !!        IF kindic =0, time step loop
-   !!        IF kindic >0, output of fields before the time step loop
-   !!
-   !! Input :
-   !! -----
-   !!   argument
-   !!           kt              : time step
-   !!           kindic          : indicator of abnormal termination
-   !!
-   !! EXTERNAL :
-   !! --------
-   !! prihre, hist..., dianam
-   !!
-   !! History:
-   !! --------
-   !!   original  : 95-01  passive tracers  (M. Levy)
-   !!   additions : 98-01 (C. Levy) NETCDF format using ioipsl interface
-   !!   additions : 99-01 (M.A. Foujols) adapted for passive tracer
-   !!   additions : 99-09 (M.A. Foujols) split into three parts
-   !!   05-03 (O. Aumont and A. El Moussaoui) F90
-   !!==================================================================================================!
-
-      !! Modules used
-      USE ioipsl
-
-
-      !! * Arguments
-      INTEGER, INTENT( in ) ::   kt,kindic         ! ocean time-step
-
-      !! * Local declarations
-      INTEGER :: jn
-      LOGICAL :: ll_print = .FALSE.
-
+      SUBROUTINE trcdit_wr( kt, kindic )
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE trcdit_wr  ***
+      !!
+      !! ** Purpose :   Standard output of passive tracer : concentration fields
+      !!
+      !! ** Method  :   At the beginning of the first time step (nit000), define all
+      !!             the NETCDF files and fields for concentration of passive tracer
+      !!
+      !!        At each time step call histdef to compute the mean if necessary
+      !!        Each nwritetrc time step, output the instantaneous or mean fields
+      !!
+      !!        IF kindic <0, output of fields before the model interruption.
+      !!        IF kindic =0, time step loop
+      !!        IF kindic >0, output of fields before the time step loop
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt          ! ocean time-step
+      INTEGER, INTENT( in ) ::   kindic      ! indicator of abnormal termination
+      !!
+      INTEGER ::   jn
+      LOGICAL ::   ll_print = .FALSE.
       CHARACTER (len=40) :: clhstnam, clop
       CHARACTER (len=20) :: cltra, cltrau
       CHARACTER (len=80) :: cltral
-
       REAL(wp) :: zsto, zout, zdt
       INTEGER  :: iimi, iima, ijmi, ijma, ipk, it
-!
-! 0. Initialisation
-! -----------------
-
-! local variable for debugging
-      ll_print = .FALSE.
+      !!----------------------------------------------------------------------
+
+      ! Initialisation
+      ! --------------
+
+      ! local variable for debugging
+      ll_print = .FALSE.                  ! change it to true for more control print
       ll_print = ll_print .AND. lwp
 
-! Define frequency of output and means
-
+      ! Define frequency of output and means
       zdt = rdt
-#        if defined key_diainstant
-      zsto=nwritetrc*rdt
-      clop='inst(only(x))'
-#        else
-      zsto=zdt
-      clop='ave(only(x))'
-#        endif
-      zout=nwritetrc*zdt
+# if defined key_diainstant
+      zsto = nwritetrc * rdt
+      clop = 'inst(only(x))'
+# else
+      zsto = zdt
+      clop = 'ave(only(x))'
+# endif
+      zout = nwritetrc * zdt
 
       ! Define indices of the horizontal output zoom and vertical limit storage
@@ -148,187 +122,131 @@
       it = kt - nittrc000 + 1
 
-! 1. Define NETCDF files and fields at beginning of first time step
-! -----------------------------------------------------------------
+      ! Define NETCDF files and fields at beginning of first time step
+      ! --------------------------------------------------------------
 
       IF(ll_print)WRITE(numout,*)'trcdit_wr kt=',kt,' kindic ',kindic
-      IF(kt == nittrc000) THEN
-
-! Compute julian date from starting date of the run
-
-         CALL ymds2ju(nyear,nmonth,nday,0.0,zjulian)
+      
+      IF( kt == nittrc000 ) THEN
+
+         ! Compute julian date from starting date of the run
+         CALL ymds2ju( nyear, nmonth, nday, 0.0, zjulian )
          IF(lwp)WRITE(numout,*)' '  
-         IF(lwp)WRITE(numout,*)' Date 0 used :',nittrc000     &
-       &     ,' YEAR ',nyear,' MONTH ',nmonth,' DAY ',nday   &
-       &     ,'Julian day : ',zjulian    
-         IF(lwp)WRITE(numout,*) ' indexes of zoom = ', iimi, iima, ijmi, ijma,  &
-                                 ' limit storage in depth = ', ipk
+         IF(lwp)WRITE(numout,*)' Date 0 used :', nittrc000                         &
+            &                 ,' YEAR ', nyear, ' MONTH ', nmonth, ' DAY ', nday   &
+            &                 ,'Julian day : ', zjulian    
+         IF(lwp) WRITE(numout,*) ' indexes of zoom = ', iimi, iima, ijmi, ijma,  &
+            &                    ' limit storage in depth = ', ipk
 
 
 ! Define the NETCDF files for passive tracer concentration
 
-         CALL dia_nam(clhstnam,nwritetrc,'ptrc_T')
-
+         CALL dia_nam( clhstnam, nwritetrc, 'ptrc_T' )
          IF(lwp)WRITE(numout,*)" Name of NETCDF file ", clhstnam
 ! Horizontal grid : glamt and gphit
- 
-         CALL histbeg(clhstnam, jpi, glamt, jpj, gphit,     &
-         &    iimi, iima-iimi+1, ijmi, ijma-ijmi+1,         & 
-         &    0, zjulian, zdt, nhorit5, nit5 , domain_id=nidom)
+         CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,     &
+            &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,         & 
+            &          0, zjulian, zdt, nhorit5, nit5 , domain_id=nidom)
 ! Vertical grid for tracer : gdept
-         CALL histvert(nit5, 'deptht', 'Vertical T levels', &
-         &    'm', ipk, gdept_0, ndepit5)
+         CALL histvert( nit5, 'deptht', 'Vertical T levels', &
+            &            'm', ipk, gdept_0, ndepit5)
 
 ! Index of ocean points in 3D and 2D (surface)
-         CALL wheneq(jpi*jpj*ipk,tmask,1,1.,ndext50,ndimt50)
-         CALL wheneq(jpi*jpj,tmask,1,1.,ndext51,ndimt51)
+         CALL wheneq( jpi*jpj*ipk,tmask,1,1.,ndext50,ndimt50 )
+         CALL wheneq( jpi*jpj,tmask,1,1.,ndext51,ndimt51 )
 
 ! Declare all the output fields as NETCDF variables
 
 ! tracer concentrations
-
-         DO jn=1,jptra
-           cltra=ctrcnm(jn)    ! short title for tracer
-           cltral=ctrcnl(jn)   ! long title for tracer
-           cltrau=ctrcun(jn)   ! UNIT for tracer
-           CALL histdef(nit5, cltra, cltral, cltrau, jpi, jpj, nhorit5,  &
-         &          ipk, 1, ipk,  ndepit5, 32, clop, zsto, zout) 
-         END DO           
-
-! CLOSE netcdf Files
-          
-         CALL histend(nit5)
-
+         DO jn = 1, jptra
+            IF( lutsav(jn) ) THEN
+               cltra  = ctrcnm(jn)   ! short title for tracer
+               cltral = ctrcnl(jn)   ! long title for tracer
+               cltrau = ctrcun(jn)   ! UNIT for tracer
+               CALL histdef( nit5, cltra, cltral, cltrau, jpi, jpj, nhorit5,  &
+                  &               ipk, 1, ipk,  ndepit5, 32, clop, zsto, zout) 
+            ENDIF
+         END DO
+
+         ! end netcdf files header
+         CALL histend( nit5 )
          IF(lwp) WRITE(numout,*)
          IF(lwp) WRITE(numout,*) 'End of NetCDF Initialization in trcdit_wr'
-         IF(ll_print) CALL FLUSH(numout )
-
-      ENDIF
-
-! 2. Start writing data
-! ---------------------
-
-! tracer concentrations
+         IF( ll_print )   CALL FLUSH(numout )
+
+      ENDIF
+
+      ! Start writing the tracer concentrations
+      ! ---------------------------------------
 
       IF( lwp .AND. MOD( kt, nwritetrc ) == 0 ) THEN
          WRITE(numout,*) 'trcdit_wr : write NetCDF passive tracer concentrations at ', kt, 'time-step'
-         WRITE(numout,*) '~~~~~~ '
-      ENDIF
-
-      DO jn=1,jptra
-         cltra=ctrcnm(jn) ! short title for tracer
-         CALL histwrite(nit5, cltra, it, trn(:,:,:,jn), ndimt50,   &
-      &          ndext50)
-      END DO 
-
-! synchronise FILE
-
-      IF( MOD( kt, nwritetrc ) == 0 .OR. kindic < 0 ) THEN
-              CALL histsync(nit5)
-      ENDIF
-
-! 3. Closing all files
-! --------------------
-      IF( kt == nitend .OR. kindic < 0 ) THEN
-          CALL histclo(nit5)
-      ENDIF
-
-END SUBROUTINE trcdit_wr
-
-#    else
-
-! no passive tracers
-
-SUBROUTINE trcdit_wr(kt,kindic)
-     !!! no passive tracers
-     INTEGER, INTENT ( in ) :: kt, kindic
-     WRITE(*,*) 'trcdit_wr: You should not have seen this print! error?', kt, kindic
-END SUBROUTINE trcdit_wr
-
-#    endif
-
-#    if defined key_passivetrc && defined key_trc_diatrd
-
-      SUBROUTINE trcdid_wr(kt,kindic)
- !!===========================================================================================
-   !!
-   !!                       ROUTINE trcdid_wr
-   !!===========================================================================================
-   !!
-   !! Purpose :
-   !!---------
-   !!          output of opa: passive tracer dynamical trends
-   !!
-   !!
-   !! Method :
-   !! -------
-   !!
-   !!        At the beginning of the first time step (nit000), define all
-   !!        the NETCDF files and fields for dynamical trends of tracers
-   !!
-   !!        At each time step call histdef to compute the mean if necessary
-   !!        Each nwritetrd time step, output the instantaneous or mean fields
-   !!
-   !!        IF kindic <0, output of fields before the model interruption.
-   !!        IF kindic =0, time step loop
-   !!        IF kindic >0, output of fields before the time step loop
-   !!
-   !! Input :
-   !! -----
-   !!   argument
-   !!           kt              : time step
-   !!           kindic          : indicator of abnormal termination
-   !!
-   !! Output :
-   !! ------
-   !!   file
-   !!           "clhstnam" files : one for concentration
-   !!
-   !! History:
-   !! --------
-   !!   original  : 95-01  passive tracers  (M. Levy)
-   !!   additions : 98-01 (C. Levy) NETCDF format using ioipsl interface
-   !!   additions : 99-01 (M.A. Foujols) adapted for passive tracer
-   !!   additions : 99-09 (M.A. Foujols) split into three parts
-   !!   additions : 01-06 (Mehdi B, Elodie K): suppress initialization
-   !!                                          of nit6,nhorit6,ndepit6
-   !!   05-03 (O. Aumont and A. El Moussaoui) F90
-   !!==================================================================================================!
-
-      !! Modules used
-      USE ioipsl
-
-      !! * Arguments
-      INTEGER, INTENT( in ) ::   kt,kindic         ! ocean time-step
-
-      INTEGER :: jn, jl
-      LOGICAL :: ll_print = .FALSE.
-
-      CHARACTER (len=40) :: clhstnam, clop
-      CHARACTER (len=20) :: cltra, cltrau
-      CHARACTER (len=80) :: cltral
-      CHARACTER (len=10) :: csuff
-
-      REAL(wp) :: zsto, zout, zdt
-      INTEGER :: iimi, iima, ijmi, ijma, ipk, it
-
-!
-! 0. Initialisation
-! -----------------
-
-! local variable for debugging
+         WRITE(numout,*) '~~~~~~~~~ '
+      ENDIF
+
+      DO jn = 1, jptra
+         IF( lutsav(jn) ) THEN
+            cltra = ctrcnm(jn)      ! short title for tracer
+            CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 )
+         ENDIF
+      END DO
+
+      ! synchronise file
+      IF( MOD( kt, nwritetrc ) == 0 .OR. kindic < 0 )   CALL histsync( nit5 )
+
+
+      ! close the file 
+      ! --------------
+      IF( kt == nitend .OR. kindic < 0 )   CALL histclo( nit5 )
+      !
+   END SUBROUTINE trcdit_wr
+
+# if defined key_trc_diatrd
+
+   SUBROUTINE trcdid_wr( kt, kindic )
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE trcdid_wr  ***
+      !!
+      !! ** Purpose :   output of passive tracer : advection-diffusion trends
+      !!
+      !! ** Method  :   At the beginning of the first time step (nit000), define all
+      !!             the NETCDF files and fields for concentration of passive tracer
+      !!
+      !!        At each time step call histdef to compute the mean if necessary
+      !!        Each nwritetrc time step, output the instantaneous or mean fields
+      !!
+      !!        IF kindic <0, output of fields before the model interruption.
+      !!        IF kindic =0, time step loop
+      !!        IF kindic >0, output of fields before the time step loop
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt          ! ocean time-step
+      INTEGER, INTENT( in ) ::   kindic      ! indicator of abnormal termination
+      !!
+      LOGICAL ::   ll_print = .FALSE.
+      CHARACTER (len=40) ::   clhstnam, clop
+      CHARACTER (len=20) ::   cltra, cltrau
+      CHARACTER (len=80) ::   cltral
+      CHARACTER (len=10) ::   csuff
+      INTEGER  ::   jn, jl
+      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it
+      REAL(wp) ::   zsto, zout, zdt
+      !!----------------------------------------------------------------------
+
+      ! 0. Initialisation
+      ! -----------------
+
+      ! local variable for debugging
       ll_print = .FALSE.
       ll_print = ll_print .AND. lwp
-!
-! Define frequency of output and means
-!
+      !
+      ! Define frequency of output and means
       zdt = rdt
-#        if defined key_diainstant
-      zsto=nwritetrd*rdt
-      clop='inst(only(x))'
-#        else
-      zsto=zdt
-      clop='ave(only(x))'
-#        endif
-      zout=nwritetrd*zdt
+#  if defined key_diainstant
+      zsto = nwritetrd * rdt
+      clop = 'inst(only(x))'
+#  else
+      zsto = zdt
+      clop = 'ave(only(x))'
+#  endif
+      zout = nwritetrd * zdt
 
       ! Define indices of the horizontal output zoom and vertical limit storage
@@ -340,109 +258,104 @@
       it = kt - nittrc000 + 1
 
-! Define the NETCDF files (one per tracer)
-!
-      IF(ll_print)WRITE(numout,*)'trcdid kt=',kt,' kindic ',kindic
-      IF(kt == nittrc000) THEN
-
-          DO jn=1,jptra
-
-            IF (luttrd(jn)) THEN
-
-! Define the file for dynamical trends - one per each tracer IF required
-
-         IF(lwp)WRITE(numout,*) ' indexes of zoom = ', iimi, iima, ijmi, ijma,  &
-                                 ' limit storage in depth = ', ipk
-                csuff='DY_'//ctrcnm(jn)
-                CALL dia_nam(clhstnam,nwritetrd,csuff)
-                IF(lwp)WRITE(numout,*)     &
-                &      " Name of NETCDF file for dynamical trends",   &
-                &      " of tracer number : ",clhstnam
-
-                CALL histbeg(clhstnam, jpi, glamt, jpj, gphit,   &
-                &    iimi, iima-iimi+1, ijmi, ijma-ijmi+1,       &
-                &    0, zjulian, rdt, nhorit6(jn),               &
-                &    nit6(jn) , domain_id=nidom)
-
-! Vertical grid for tracer trend - one per each tracer IF needed
-                CALL histvert(nit6(jn), 'deptht', 'Vertical T levels',  &
-                &    'm', ipk, gdept_0, ndepit6(jn)) 
-
-
-            END IF
+      ! Define the NETCDF files (one per tracer)
+      IF( ll_print ) WRITE(numout,*) 'trcdid kt=', kt, ' kindic ', kindic
+      
+      
+      IF( kt == nittrc000 ) THEN
+
+         DO jn = 1, jptra
+            !
+            IF( luttrd(jn) ) THEN      ! Define the file for dynamical trends - one per each tracer IF required
+
+               IF(lwp)WRITE(numout,*) ' indexes of zoom = ', iimi, iima, ijmi, ijma,  &
+                   &                   ' limit storage in depth = ', ipk
+               csuff='DY_'//ctrcnm(jn)
+               CALL dia_nam( clhstnam, nwritetrd, csuff )
+               IF(lwp)WRITE(numout,*)   " Name of NETCDF file for dynamical trends",   &
+                  &                     " of tracer number : ",clhstnam
+
+               CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,       &
+                  &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,   &
+                  &          0, zjulian, rdt, nhorit6(jn),           &
+                  &          nit6(jn) , domain_id=nidom )
+
+               ! Vertical grid for tracer trend - one per each tracer IF needed
+               CALL histvert( nit6(jn), 'deptht', 'Vertical T levels',   &
+                  &           'm', ipk, gdept_0, ndepit6(jn) ) 
+             END IF
           END DO
 
-! Declare all the output fields as NETCDF variables
-
-
-! trends for tracer concentrations
-          DO jn=1,jptra
-            IF (luttrd(jn)) THEN
-                DO jl=1,jpdiatrc
-                  IF (jl.eq.1) THEN
-! short and long title for x advection for tracer
+          ! Declare all the output fields as NETCDF variables
+
+          ! trends for tracer concentrations
+          DO jn = 1, jptra
+            IF( luttrd(jn) ) THEN
+                DO jl = 1, jpdiatrc
+                  IF( jl == 1 ) THEN
+                      ! short and long title for x advection for tracer
                       WRITE (cltra,'("XAD_",16a)') ctrcnm(jn)
                       WRITE (cltral,'("X advective trend for ",58a)')  &
-                      &      ctrcnl(jn)(1:58)
-                  END IF
-                  IF (jl.eq.2)  THEN
-! short and long title for y advection for tracer
+                         &      ctrcnl(jn)(1:58)
+                  END IF
+                  IF( jl == 2 ) THEN
+                      ! short and long title for y advection for tracer
                       WRITE (cltra,'("YAD_",16a)') ctrcnm(jn)
                       WRITE (cltral,'("Y advective trend for ",58a)')  &
-                      &      ctrcnl(jn)(1:58)
-                  END IF
-                  IF (jl.eq.3)  THEN
-! short and long title for Z advection for tracer
+                         &      ctrcnl(jn)(1:58)
+                  END IF
+                  IF( jl == 3 ) THEN
+                      ! short and long title for Z advection for tracer
                       WRITE (cltra,'("ZAD_",16a)') ctrcnm(jn)
                       WRITE (cltral,'("Z advective trend for ",58a)')  &
-                      &      ctrcnl(jn)(1:58)
-                  END IF
-                  IF (jl.eq.4)  THEN
-! short and long title for X diffusion for tracer
+                         &      ctrcnl(jn)(1:58)
+                  END IF
+                  IF( jl == 4 ) THEN
+                      ! short and long title for X diffusion for tracer
                       WRITE (cltra,'("XDF_",16a)') ctrcnm(jn)
                       WRITE (cltral,'("X diffusion trend for ",58a)')  &
-                      &      ctrcnl(jn)(1:58)
-                  END IF
-                  IF (jl.eq.5)  THEN
-! short and long title for Y diffusion for tracer
+                         &      ctrcnl(jn)(1:58)
+                  END IF
+                  IF( jl == 5 ) THEN
+                      ! short and long title for Y diffusion for tracer
                       WRITE (cltra,'("YDF_",16a)') ctrcnm(jn)
                       WRITE (cltral,'("Y diffusion trend for ",58a)')  &
-                      &      ctrcnl(jn)(1:58)
-                  END IF
-                  IF (jl.eq.6)  THEN
-! short and long title for Z diffusion for tracer
+                         &      ctrcnl(jn)(1:58)
+                  END IF
+                  IF( jl == 6 ) THEN
+                      ! short and long title for Z diffusion for tracer
                       WRITE (cltra,'("ZDF_",16a)') ctrcnm(jn)
                       WRITE (cltral,'("Z diffusion trend for ",58a)')  &
-                      &      ctrcnl(jn)(1:58)
+                         &      ctrcnl(jn)(1:58)
                   END IF
 # if defined key_trc_ldfeiv
-                  IF (jl.eq.7) THEN
-! short and long title for x gent velocity for tracer
+                  IF( jl == 7 ) THEN
+                      ! short and long title for x gent velocity for tracer
                       WRITE (cltra,'("XGV_",16a)') ctrcnm(jn)
                       WRITE (cltral,'("X gent velocity trend for ",53a)')  &
-                      &      ctrcnl(jn)(1:53)
-                  END IF
-                  IF (jl.eq.8)  THEN
-! short and long title for y gent velocity for tracer
+                         &      ctrcnl(jn)(1:53)
+                  END IF
+                  IF( jl == 8 ) THEN
+                      ! short and long title for y gent velocity for tracer
                       WRITE (cltra,'("YGV_",16a)') ctrcnm(jn)
                       WRITE (cltral,'("Y gent velocity trend for ",53a)')  &
-                      &      ctrcnl(jn)(1:53)
-                  END IF
-                  IF (jl.eq.9)  THEN
-! short and long title for Z gent velocity for tracer
+                         &      ctrcnl(jn)(1:53)
+                  END IF
+                  IF( jl == 9 ) THEN
+                      ! short and long title for Z gent velocity for tracer
                       WRITE (cltra,'("ZGV_",16a)') ctrcnm(jn)
                       WRITE (cltral,'("Z gent velocity trend for ",53a)')  &
-                      &      ctrcnl(jn)(1:53)
+                         &      ctrcnl(jn)(1:53)
                   END IF
 # endif
 # if defined key_trcdmp
-                  IF (jl.eq.jpdiatrc-1)  THEN
-! last trends for tracer damping : short and long title
+                  IF( jl == jpdiatrc - 1 ) THEN
+                      ! last trends for tracer damping : short and long title
                       WRITE (cltra,'("TDM_",16a)') ctrcnm(jn)
                       WRITE (cltral,'("Tracer damping trend for ",55a)')  &
-                      &      ctrcnl(jn)(1:55)
-                  END IF
-# endif
-                  IF (jl.eq.jpdiatrc)  THEN
-! last trends for tracer damping : short and long title
+                         &      ctrcnl(jn)(1:55)
+                  END IF
+# endif
+                  IF( jl == jpdiatrc ) THEN
+                      ! last trends for tracer damping : short and long title
                       WRITE (cltra,'("SBC_",16a)') ctrcnm(jn)
                       WRITE (cltral,'("Surface boundary flux ",58a)')  &
@@ -450,17 +363,16 @@
                   END IF
 
-                  call flush(numout)
-                  cltrau=ctrcun(jn) ! UNIT for tracer /trends
-                  CALL histdef(nit6(jn), cltra, cltral, cltrau, jpi,jpj,  &
-                  &   nhorit6(jn), ipk, 1, ipk,  ndepit6(jn), 32, clop ,  &
-                  &   zsto,zout)
-                END DO
+                  CALL FLUSH( numout )
+                  cltrau = ctrcun(jn)      ! UNIT for tracer /trends
+                  CALL histdef( nit6(jn), cltra, cltral, cltrau, jpi,jpj,  &
+                     &          nhorit6(jn), ipk, 1, ipk,  ndepit6(jn), 32, clop ,  &
+                     &          zsto,zout )
+               END DO
             END IF
-          END DO
-
-! CLOSE netcdf Files
-
-          DO jn=1,jptra
-             IF (luttrd(jn)) CALL histend(nit6(jn))
+         END DO
+
+         ! CLOSE netcdf Files
+          DO jn = 1, jptra
+             IF( luttrd(jn) )   CALL histend( nit6(jn) )
           END DO
 
@@ -468,13 +380,13 @@
          IF(lwp) WRITE(numout,*) 'End of NetCDF Initialization in trcdid'
          IF(ll_print) CALL FLUSH(numout )
-
-      ENDIF
-
-! SOME diagnostics to DO first time
-
-! 2. Start writing data
-! ---------------------
-
-! trends for tracer concentrations
+         !
+      ENDIF
+
+      ! SOME diagnostics to DO first time
+
+      ! Start writing data
+      ! ---------------------
+
+      ! trends for tracer concentrations
 
       IF( lwp .AND. MOD( kt, nwritetrd ) == 0 ) THEN
@@ -483,172 +395,101 @@
       ENDIF
 
-          DO jn=1,jptra
-            IF (luttrd(jn)) THEN
-                DO jl=1,jpdiatrc
-                  IF (jl.eq.1) THEN
-! short title for x advection for tracer
-                      WRITE (cltra,'("XAD_",16a)') ctrcnm(jn)
-                  END IF
-                  IF (jl.eq.2)  THEN
-! short title for y advection for tracer
-                      WRITE (cltra,'("YAD_",16a)') ctrcnm(jn)
-                  END IF
-                  IF (jl.eq.3)  THEN
-! short title for z advection for tracer
-                      WRITE (cltra,'("ZAD_",16a)') ctrcnm(jn)
-                  END IF
-                  IF (jl.eq.4)  THEN
-! short title for x diffusion for tracer
-                      WRITE (cltra,'("XDF_",16a)') ctrcnm(jn)
-                  END IF
-                  IF (jl.eq.5)  THEN
-! short title for y diffusion for tracer
-                      WRITE (cltra,'("YDF_",16a)') ctrcnm(jn)
-                  END IF
-                  IF (jl.eq.6)  THEN
-! short title for z diffusion for tracer
-                      WRITE (cltra,'("ZDF_",16a)') ctrcnm(jn)
-                  END IF
+      DO jn = 1, jptra
+         IF( luttrd(jn) ) THEN
+            DO jl = 1, jpdiatrc
+               ! short titles 
+               IF( jl == 1)   WRITE (cltra,'("XAD_",16a)') ctrcnm(jn)      ! x advection for tracer
+               IF( jl == 2)   WRITE (cltra,'("YAD_",16a)') ctrcnm(jn)      ! z advection for tracer
+               IF( jl == 3)   WRITE (cltra,'("ZAD_",16a)') ctrcnm(jn)      ! z advection for tracer
+               IF( jl == 4)   WRITE (cltra,'("XDF_",16a)') ctrcnm(jn)      ! x diffusion for tracer
+               IF( jl == 5)   WRITE (cltra,'("YDF_",16a)') ctrcnm(jn)      ! y diffusion for tracer
+               IF( jl == 6)   WRITE (cltra,'("ZDF_",16a)') ctrcnm(jn)      ! z diffusion for tracer
 # if defined key_trcldf_eiv
-                  IF (jl.eq.7) THEN
-! short for x gent velocity for tracer
-                      WRITE (cltra,'("XGV_",16a)') ctrcnm(jn)
-                  END IF
-                  IF (jl.eq.8)  THEN
-! short for y gent velocity for tracer
-                      WRITE (cltra,'("YGV_",16a)') ctrcnm(jn)
-                  END IF
-                  IF (jl.eq.9)  THEN
-! short title for Z gent velocity for tracer
-                      WRITE (cltra,'("ZGV_",16a)') ctrcnm(jn)
-                  END IF
+               IF( jl == 7)   WRITE (cltra,'("XGV_",16a)') ctrcnm(jn)      ! x gent velocity for tracer
+               IF( jl == 8)   WRITE (cltra,'("YGV_",16a)') ctrcnm(jn)      ! y gent velocity for tracer
+               IF( jl == 9)   WRITE (cltra,'("ZGV_",16a)') ctrcnm(jn)      ! z gent velocity for tracer
 # endif
 # if defined key_trcdmp
-                  IF (jl.eq.jpdiatrc-1) THEN
-! short for x gent velocity for tracer
-                      WRITE (cltra,'("TDM_",16a)') ctrcnm(jn)
-                  END IF
-# endif
-                  IF (jl.eq.jpdiatrc) THEN
-! short for surface boundary conditions for tracer
-                      WRITE (cltra,'("SBC_",a)') ctrcnm(jn)
-                  END IF
-
-                  CALL histwrite(nit6(jn), cltra, it, trtrd(:,:,:,ikeep(jn),jl)  &
-                  &    ,ndimt50, ndext50)
-                END DO
-            END IF
-          END DO
-
-! synchronise FILE
-
+               IF( jl == jpdiatrc - 1 )   WRITE (cltra,'("TDM_",16a)') ctrcnm(jn)      ! damping
+# endif
+               IF( jl == jpdiatrc )   WRITE (cltra,'("SBC_",a)') ctrcnm(jn)      ! surface boundary conditions
+               !
+               CALL histwrite(nit6(jn), cltra, it, trtrd(:,:,:,ikeep(jn),jl)   &
+                  &          ,ndimt50, ndext50)
+            END DO
+         END IF
+      END DO
+
+      ! synchronise FILE
       IF( MOD( kt, nwritetrd ) == 0 .OR. kindic < 0 ) THEN
-          DO jn=1,jptra
-             IF (luttrd(jn)) CALL histsync(nit6(jn))
-          END DO
-      ENDIF
-
-! 3. Closing all files
-! --------------------
-
+         DO jn = 1, jptra
+            IF (luttrd(jn))   CALL histsync( nit6(jn) )
+         END DO
+      ENDIF
+
+      ! Closing all files
+      ! -----------------
       IF( kt == nitend .OR. kindic < 0 ) THEN
-          DO jn=1,jptra
-             IF (luttrd(jn)) CALL histclo(nit6(jn))
-          END DO
-      ENDIF
-
-END SUBROUTINE trcdid_wr
-
-#    else
-
-SUBROUTINE trcdid_wr(kt,kindic)
-     !!! no passive tracers
-     INTEGER, INTENT ( in ) :: kt, kindic
-     WRITE(*,*) 'trcdid_wr: You should not have seen this print! error?', kt, kindic
-END SUBROUTINE trcdid_wr
-
-#    endif
-
-#    if defined key_passivetrc && defined key_trc_diaadd
-
-      SUBROUTINE trcdii_wr(kt,kindic)
-   !!===========================================================================================
-   !!
-   !!                       ROUTINE trcdii_wr
-   !!===========================================================================================
-   !!
-   !! Purpose :
-   !!---------
-   !!          output of passive tracer : additional 2D and 3D arrays
-   !!
-   !!
-   !! Method :
-   !! -------
-   !!
-   !!        At the beginning of the first time step (nit000), define all
-   !!        the NETCDF files and fields for additional arrays
-   !!
-   !!        At each time step call histdef to compute the mean if necessary
-   !!        Each nwritetrc time step, output the instantaneous or mean fields
-   !!
-   !!
-   !!        IF kindic <0, output of fields before the model interruption.
-   !!        IF kindic =0, time step loop
-   !!        IF kindic >0, output of fields before the time step loop
-   !!
-   !! Input :
-   !! -----
-   !!   argument
-   !!           kt              : time step
-   !!           kindic          : indicator of abnormal termination
-   !!
-   !! EXTERNAL :
-   !! --------
-   !! prihre, hist..., dianam
-   !!
-   !! History:
-   !! --------
-   !!   original  : 95-01  passive tracers  (M. Levy)
-   !!   additions : 98-01 (C. Levy) NETCDF format using ioipsl interface
-   !!   additions : 99-01 (M.A. Foujols) adapted for passive tracer
-   !!   additions : 99-09 (M.A. Foujols) split into three parts
-   !!   05-03 (O. Aumont and A. El Moussaoui) F90
-   !!==================================================================================================!
-
-      !! Modules used
-      USE ioipsl
-
-      !! * Arguments
-      INTEGER, INTENT( in ) ::   kt,kindic         ! ocean time-step
-
-      INTEGER :: jn
-      LOGICAL :: ll_print = .FALSE.
-
-      CHARACTER (len=40) :: clhstnam, clop
-      CHARACTER (len=20) :: cltra, cltrau
-      CHARACTER (len=80) :: cltral
-
-      REAL(wp) :: zsto, zout, zdt
-      INTEGER :: iimi, iima, ijmi, ijma, ipk, it
-
-!
-! 0. Initialisation
-! -----------------
-
-! local variable for debugging
+         DO jn = 1, jptra
+            IF( luttrd(jn) )   CALL histclo( nit6(jn) )
+         END DO
+      ENDIF
+      !
+   END SUBROUTINE trcdid_wr
+
+# else
+   SUBROUTINE trcdid_wr( kt, kindic )                      ! Dummy routine
+      INTEGER, INTENT ( in ) ::   kt, kindic
+      WRITE(*,*) 'trcdid_wr: You should not have seen this print! error?', kt, kindic
+   END SUBROUTINE trcdid_wr
+# endif
+
+#    if defined key_top && defined key_trc_diaadd
+
+   SUBROUTINE trcdii_wr( kt, kindic )
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE trcdii_wr  ***
+      !!
+      !! ** Purpose :   output of passive tracer : additional 2D and 3D arrays
+      !!
+      !! ** Method  :   At the beginning of the first time step (nit000), define all
+      !!             the NETCDF files and fields for concentration of passive tracer
+      !!
+      !!        At each time step call histdef to compute the mean if necessary
+      !!        Each nwritetrc time step, output the instantaneous or mean fields
+      !!
+      !!        IF kindic <0, output of fields before the model interruption.
+      !!        IF kindic =0, time step loop
+      !!        IF kindic >0, output of fields before the time step loop
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt          ! ocean time-step
+      INTEGER, INTENT( in ) ::   kindic      ! indicator of abnormal termination
+      !!
+      LOGICAL ::   ll_print = .FALSE.
+      CHARACTER (len=40) ::   clhstnam, clop
+      CHARACTER (len=20) ::   cltra, cltrau
+      CHARACTER (len=80) ::   cltral
+      INTEGER  ::   jn
+      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it
+      REAL(wp) ::   zsto, zout, zdt
+      !!----------------------------------------------------------------------
+
+      ! Initialisation
+      ! --------------
+
+      ! local variable for debugging
       ll_print = .FALSE.
       ll_print = ll_print .AND. lwp
-!
-! Define frequency of output and means
-!
+      !
+      ! Define frequency of output and means
       zdt = rdt
-#        if defined key_diainstant
-      zsto=nwriteadd*zdt
+#  if defined key_diainstant
+      zsto=nwritedia*zdt
       clop='inst(only(x))'
-#        else
+#  else
       zsto=zdt
       clop='ave(only(x))'
-#        endif
-      zout=nwriteadd*zdt
+#  endif
+      zout=nwritedia*zdt
 
       ! Define indices of the horizontal output zoom and vertical limit storage
@@ -660,188 +501,138 @@
       it = kt - nittrc000 + 1
 
-! 1. Define NETCDF files and fields at beginning of first time step
-! -----------------------------------------------------------------
-
-      IF(ll_print)WRITE(numout,*)'trcdii_wr kt=',kt,' kindic ',kindic
-      IF(kt == nittrc000) THEN
-
-! Define the NETCDF files for additional arrays : 2D or 3D
-
-! Define the T grid file for tracer auxiliary files
-
-          CALL dia_nam(clhstnam,nwrite,'diad_T')
-          IF(lwp)WRITE(numout,*)" Name of NETCDF file ", clhstnam
-
-! Define a netcdf FILE for 2d and 3d arrays
-
-          CALL histbeg(clhstnam, jpi, glamt, jpj, gphit,     &
-          &    iimi, iima-iimi+1, ijmi, ijma-ijmi+1,         &
-          &    0, zjulian, zdt, nhoritd, nitd , domain_id=nidom)
-
-! Vertical grid for 2d and 3d arrays
-
-          CALL histvert(nitd, 'deptht', 'Vertical T levels', &
-          &    'm', ipk, gdept_0, ndepitd)
-
-
-! Declare all the output fields as NETCDF variables
-
-! more 3D horizontal arrays
-
-          DO jn=1,jpdia3d
-            cltra=ctrc3d(jn)    ! short title for 3D diagnostic
-            cltral=ctrc3l(jn)   ! long title for 3D diagnostic
-            cltrau=ctrc3u(jn)   ! UNIT for 3D diagnostic
-            CALL histdef(nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd,  &
-            &    ipk, 1, ipk,  ndepitd, 32, clop, zsto, zout)
-          END DO
-
-
-! more 2D horizontal arrays
-
-          DO jn=1,jpdia2d
+      ! 1. Define NETCDF files and fields at beginning of first time step
+      ! -----------------------------------------------------------------
+
+      IF( ll_print ) WRITE(numout,*) 'trcdii_wr kt=', kt, ' kindic ', kindic
+
+      IF( kt == nittrc000 ) THEN
+
+         ! Define the NETCDF files for additional arrays : 2D or 3D
+
+         ! Define the T grid file for tracer auxiliary files
+
+         CALL dia_nam( clhstnam, nwrite, 'diad_T' )
+         IF(lwp) WRITE(numout,*) " Name of NETCDF file ", clhstnam
+
+         ! Define a netcdf FILE for 2d and 3d arrays
+
+         CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,             &
+            &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,         &
+            &          0, zjulian, zdt, nhoritd, nitd , domain_id=nidom )
+
+         ! Vertical grid for 2d and 3d arrays
+
+         CALL histvert( nitd, 'deptht', 'Vertical T levels',   &
+            &           'm', ipk, gdept_0, ndepitd)
+
+         ! Declare all the output fields as NETCDF variables
+
+         ! more 3D horizontal arrays
+         DO jn = 1, jpdia3d
+            cltra  = ctrc3d(jn)   ! short title for 3D diagnostic
+            cltral = ctrc3l(jn)   ! long title for 3D diagnostic
+            cltrau = ctrc3u(jn)   ! UNIT for 3D diagnostic
+            CALL histdef( nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd,   &
+               &          ipk, 1, ipk,  ndepitd, 32, clop, zsto, zout )
+         END DO
+
+         ! more 2D horizontal arrays
+         DO jn = 1, jpdia2d
             cltra=ctrc2d(jn)    ! short title for 2D diagnostic
             cltral=ctrc2l(jn)   ! long title for 2D diagnostic
             cltrau=ctrc2u(jn)   ! UNIT for 2D diagnostic
-            CALL histdef(nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd,  &
-            &    1, 1, 1,  -99, 32, clop, zsto, zout)
-          END DO
-
-! TODO: more 2D vertical sections arrays : I or J indice fixed
-
-! CLOSE netcdf Files
-
-          CALL histend(nitd)
+            CALL histdef( nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd,  &
+               &          1, 1, 1,  -99, 32, clop, zsto, zout )
+         END DO
+
+         ! TODO: more 2D vertical sections arrays : I or J indice fixed
+
+         ! CLOSE netcdf Files
+         CALL histend( nitd )
 
          IF(lwp) WRITE(numout,*)
          IF(lwp) WRITE(numout,*) 'End of NetCDF Initialization in trcdii_wr'
-         IF(ll_print) CALL FLUSH(numout )
-
-      ENDIF
-
-! 2. Start writing data
-! ---------------------
-
-      IF( lwp .AND. MOD( kt, nwriteadd ) == 0 ) THEN
+         IF( ll_print )   CALL FLUSH(numout )
+         !
+      ENDIF
+
+      ! 2. Start writing data
+      ! ---------------------
+
+      IF( lwp .AND. MOD( kt, nwritedia ) == 0 ) THEN
          WRITE(numout,*) 'trcdii_wr : write NetCDF additional arrays at ', kt, 'time-step'
          WRITE(numout,*) '~~~~~~ '
       ENDIF
 
-! more 3D horizontal arrays
-
-          DO jn=1,jpdia3d
-            cltra=ctrc3d(jn) ! short title for 3D diagnostic
-            CALL histwrite(nitd, cltra, it, trc3d(:,:,:,jn), ndimt50  &
-            &   ,ndext50)
-          END DO
-
-! more 2D horizontal arrays
-
-          DO jn=1,jpdia2d
-            cltra=ctrc2d(jn) ! short title for 2D diagnostic
-            CALL histwrite(nitd, cltra, it, trc2d(:,:,jn), ndimt51    &
+      ! more 3D horizontal arrays
+      DO jn = 1, jpdia3d
+         cltra = ctrc3d(jn)   ! short title for 3D diagnostic
+         CALL histwrite( nitd, cltra, it, trc3d(:,:,:,jn), ndimt50  &
+            &           ,ndext50)
+      END DO
+
+      ! more 2D horizontal arrays
+      DO jn = 1, jpdia2d
+         cltra = ctrc2d(jn)   ! short title for 2D diagnostic
+         CALL histwrite(nitd, cltra, it, trc2d(:,:,jn), ndimt51    &
             &   ,ndext51)
-          END DO
-
-! synchronise FILE
-
-      IF( MOD( kt, nwriteadd ) == 0 .OR. kindic < 0 ) THEN
-              CALL histsync(nitd)
-      ENDIF
-
-! 3. Closing all files
-! --------------------
-
-      IF( kt == nitend .OR. kindic < 0 ) THEN
-          CALL histclo(nitd)
-      ENDIF
-
+      END DO
+
+      ! synchronise FILE
+      IF( MOD( kt, nwritedia ) == 0 .OR. kindic < 0 )   CALL histsync( nitd )
+
+      ! Closing all files
+      ! -----------------
+      IF( kt == nitend .OR. kindic < 0 )   CALL histclo(nitd)
+      !
 END SUBROUTINE trcdii_wr
 
-#    else
-
-SUBROUTINE trcdii_wr(kt,kindic)
-     !!! no passive tracers
-     INTEGER, INTENT ( in ) :: kt, kindic
-     WRITE(*,*) 'trcdii_wr: You should not have seen this print! error?', kt, kindic
-END SUBROUTINE trcdii_wr
-
-#    endif
-
-#    if defined key_passivetrc && defined key_trc_diabio
-
-      SUBROUTINE trcdib_wr(kt,kindic)
- !!===========================================================================================
-   !!
-   !!                       ROUTINE trcdib_wr
-   !!===========================================================================================
-   !!
-   !! Purpose :
-   !!---------
-   !!          Specific output of opa: biological fields
-   !!
-   !!
-   !! Method :
-   !! -------
-   !!
-   !!        At the beginning of the first time step (nit000), define all
-   !!        the NETCDF files and fields for biological fields
-   !!
-   !!        At each time step call histdef to compute the mean if necessary
-   !!        Each nwritetrd time step, output the instantaneous or mean fields
-   !!
-   !!        IF kindic <0, output of fields before the model interruption.
-   !!        IF kindic =0, time step loop
-   !!        IF kindic >0, output of fields before the time step loop
-   !!
-   !! Input :
-   !! -----
-   !!   argument
-   !!           kt              : time step
-   !!           kindic          : indicator of abnormal termination
-   !!
-   !! Output :
-   !! ------
-   !!   file
-   !!           "histname" files : at least one file for each grid
-   !!
-   !! History:
-   !! --------
-   !!   original  : 95-01  passive tracers  (M. Levy)
-   !!   additions : 98-01 (C. Levy) NETCDF format using ioipsl interface
-   !!   additions : 99-01 (M.A. Foujols) adapted for passive tracer
-   !!   additions : 99-09 (M.A. Foujols) split into three parts
-   !!   additions : 01-06 (E Kestenare) assign a parameter to name
-   !!                                          individual tracers
-   !!   additions : 05-03 (O. Aumont and A El Moussaoui) F90
-   !!==================================================================================================!
-
-      !! Modules used
-      USE ioipsl
+# else
+   SUBROUTINE trcdii_wr( kt, kindic )                      ! Dummy routine
+      INTEGER, INTENT ( in ) :: kt, kindic
+      WRITE(*,*) 'trcdii_wr: You should not have seen this print! error?', kt, kindic
+   END SUBROUTINE trcdii_wr
+# endif
+
+# if defined key_trc_diabio
+
+   SUBROUTINE trcdib_wr( kt, kindic )
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE trcdib_wr  ***
+      !!
+      !! ** Purpose :   output of passive tracer : biological fields
+      !!
+      !! ** Method  :   At the beginning of the first time step (nit000), define all
+      !!             the NETCDF files and fields for concentration of passive tracer
+      !!
+      !!        At each time step call histdef to compute the mean if necessary
+      !!        Each nwritetrc time step, output the instantaneous or mean fields
+      !!
+      !!        IF kindic <0, output of fields before the model interruption.
+      !!        IF kindic =0, time step loop
+      !!        IF kindic >0, output of fields before the time step loop
+      !!----------------------------------------------------------------------
       USE sms
-
-      !! * Arguments
-      INTEGER, INTENT( in ) ::   kt,kindic         ! ocean time-step
-
-      INTEGER :: ji, jj, jk, jn
-      LOGICAL :: ll_print = .FALSE.
-
-      CHARACTER (len=40) :: clhstnam, clop
-      CHARACTER (len=20) :: cltra, cltrau
-      CHARACTER (len=80) :: cltral
-
-      REAL(wp) :: zsto, zout, zdt
-      INTEGER  :: iimi, iima, ijmi, ijma, ipk, it
-
-!
-! 0. Initialisation
-! -----------------
-
-! local variable for debugging
+      !!
+      INTEGER, INTENT( in ) ::   kt          ! ocean time-step
+      INTEGER, INTENT( in ) ::   kindic      ! indicator of abnormal termination
+      !!
+      LOGICAL ::   ll_print = .FALSE.
+      CHARACTER (len=40) ::   clhstnam, clop
+      CHARACTER (len=20) ::   cltra, cltrau
+      CHARACTER (len=80) ::   cltral
+      INTEGER  ::   ji, jj, jk, jn
+      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it
+      REAL(wp) ::   zsto, zout, zdt
+      !!----------------------------------------------------------------------
+
+      ! Initialisation
+      ! --------------
+
+      ! local variable for debugging
       ll_print = .FALSE.
       ll_print = ll_print .AND. lwp
-!
-! Define frequency of output and means
-!
+
+      ! Define frequency of output and means
       zdt = rdt
 #        if defined key_diainstant
@@ -862,37 +653,34 @@
       it = kt - nittrc000 + 1
 
-! 1. Define NETCDF files and fields at beginning of first time step
-! -----------------------------------------------------------------
-
-      IF(ll_print)WRITE(numout,*)'trcdib_wr kt=',kt,' kindic ',kindic
-      IF(kt == nittrc000) THEN
-
-! Define the NETCDF files for biological trends
-
-          CALL dia_nam(clhstnam,nwrite,'biolog')
-          IF(lwp)WRITE(numout,*)        &
-          &      " Name of NETCDF file for biological trends ",clhstnam
-! Horizontal grid : glamt and gphit
-          CALL histbeg(clhstnam, jpi, glamt, jpj, gphit,      &
-          &    iimi, iima-iimi+1, ijmi, ijma-ijmi+1,          &
-          &    0, zjulian, rdt, nhoritb, nitb , domain_id=nidom)
-! Vertical grid for biological trends
-          CALL histvert(nitb, 'deptht', 'Vertical T levels',  &
-          &    'm', ipk, gdept_0, ndepitb)
-
-! Declare all the output fields as NETCDF variables
-
-! biological trends
-
-          DO jn=1,jpdiabio
-            cltra=ctrbio(jn)    ! short title for biological diagnostic
-            cltral=ctrbil(jn)   ! long title for biological diagnostic
-            cltrau=ctrbiu(jn)   ! UNIT for biological diagnostic
+      ! Define NETCDF files and fields at beginning of first time step
+      ! --------------------------------------------------------------
+
+      IF(ll_print) WRITE(numout,*)'trcdib_wr kt=',kt,' kindic ',kindic
+
+      IF( kt == nittrc000 ) THEN
+
+         ! Define the NETCDF files for biological trends
+
+         CALL dia_nam(clhstnam,nwrite,'biolog')
+         IF(lwp)WRITE(numout,*) " Name of NETCDF file for biological trends ", clhstnam
+         ! Horizontal grid : glamt and gphit
+         CALL histbeg(clhstnam, jpi, glamt, jpj, gphit,      &
+            &    iimi, iima-iimi+1, ijmi, ijma-ijmi+1,          &
+            &    0, zjulian, rdt, nhoritb, nitb , domain_id=nidom)
+         ! Vertical grid for biological trends
+         CALL histvert(nitb, 'deptht', 'Vertical T levels',  &
+            &    'm', ipk, gdept_0, ndepitb)
+
+         ! Declare all the output fields as NETCDF variables
+         ! biological trends
+         DO jn = 1, jpdiabio
+            cltra  = ctrbio(jn)   ! short title for biological diagnostic
+            cltral = ctrbil(jn)   ! long title for biological diagnostic
+            cltrau = ctrbiu(jn)   ! UNIT for biological diagnostic
             CALL histdef(nitb, cltra, cltral, cltrau, jpi, jpj, nhoritb,  &
-            &    ipk, 1, ipk,  ndepitb, 32, clop, zsto, zout)
-          END DO
-
-! CLOSE netcdf Files
-
+               &         ipk, 1, ipk,  ndepitb, 32, clop, zsto, zout)
+         END DO
+
+         ! CLOSE netcdf Files
           CALL histend(nitb)
 
@@ -900,12 +688,11 @@
          IF(lwp) WRITE(numout,*) 'End of NetCDF Initialization in trcdib_wr'
          IF(ll_print) CALL FLUSH(numout )
-
-     ENDIF
-
-! 2. Start writing data
-! ---------------------
-
-! biological trends
-
+         !
+      ENDIF
+
+      ! Start writing data
+      ! ------------------
+
+      ! biological trends
       IF( lwp .AND. MOD( kt, nwritebio ) == 0 ) THEN
          WRITE(numout,*) 'trcdit_wr : write NetCDF biological trends at ', kt, 'time-step'
@@ -913,33 +700,48 @@
       ENDIF
 
-
-      DO jn=1,jpdiabio
+      DO jn = 1, jpdiabio
          cltra=ctrbio(jn)  ! short title for biological diagnostic
          CALL histwrite(nitb, cltra, it, trbio(:,:,:,jn), ndimt50,ndext50)
       END DO
 
-! synchronise FILE
-
-      IF( MOD( kt, nwritebio ) == 0 .OR. kindic < 0 ) THEN
-              CALL histsync(nitb)
-      ENDIF
-
-! 3. Closing all files
-! --------------------
-      IF( kt == nitend .OR. kindic < 0 ) THEN
-          CALL histclo(nitb)
-      ENDIF
-
-END SUBROUTINE trcdib_wr
-
-#    else
-
-SUBROUTINE trcdib_wr(kt,kindic)
-     !!! no passive tracers
-     INTEGER, INTENT ( in ) :: kt, kindic
-     WRITE(*,*) 'trcdib_wr: You should not have seen this print! error?', kt, kindic
-END SUBROUTINE trcdib_wr
-
-#    endif
-
+      ! synchronise FILE
+      IF( MOD( kt, nwritebio ) == 0 .OR. kindic < 0 )   CALL histsync( nitb )
+
+      ! Closing all files
+      ! -----------------
+      IF( kt == nitend .OR. kindic < 0 )   CALL histclo( nitb )
+      !
+   END SUBROUTINE trcdib_wr
+
+# else
+   SUBROUTINE trcdib_wr( kt, kindic )                      ! Dummy routine
+      INTEGER, INTENT ( in ) ::   kt, kindic
+      WRITE(*,*) 'trcdib_wr: You should not have seen this print! error?', kt, kindic
+   END SUBROUTINE trcdib_wr
+# endif 
+
+#else
+   !!----------------------------------------------------------------------
+   !!  Dummy module :                                     No passive tracer
+   !!----------------------------------------------------------------------
+CONTAINS
+   SUBROUTINE trcdit_wr( kt, kindic )                      ! Dummy routine
+      INTEGER, INTENT ( in ) ::   kt, kindic
+      WRITE(*,*) 'trcdit_wr: You should not have seen this print! error?', kt, kindic
+   END SUBROUTINE trcdit_wr
+   SUBROUTINE trcdid_wr( kt, kindic )                      ! Dummy routine
+      INTEGER, INTENT ( in ) ::   kt, kindic
+      WRITE(*,*) 'trcdid_wr: You should not have seen this print! error?', kt, kindic
+   END SUBROUTINE trcdid_wr
+   SUBROUTINE trcdii_wr( kt, kindic )                      ! Dummy routine
+      INTEGER, INTENT ( in ) :: kt, kindic
+      WRITE(*,*) 'trcdii_wr: You should not have seen this print! error?', kt, kindic
+   END SUBROUTINE trcdii_wr
+   SUBROUTINE trcdib_wr( kt, kindic )                      ! Dummy routine
+      INTEGER, INTENT ( in ) ::   kt, kindic
+      WRITE(*,*) 'trcdib_wr: You should not have seen this print! error?', kt, kindic
+   END SUBROUTINE trcdib_wr
+#endif
+
+   !!======================================================================
 END MODULE trcdit
Index: trunk/NEMO/TOP_SRC/trcdta.F90
===================================================================
--- trunk/NEMO/TOP_SRC/trcdta.F90	(revision 944)
+++ trunk/NEMO/TOP_SRC/trcdta.F90	(revision 945)
@@ -2,46 +2,40 @@
    !!======================================================================
    !!                     ***  MODULE  trcdta  ***
-   !! Ocean data  :  reads passive tracer data 
+   !! TOP :  reads passive tracer data 
    !!=====================================================================
-   !!  TOP 1.0,  LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-
-#if  defined key_passivetrc && defined key_dtatrc
-   !!----------------------------------------------------------------------
-   !!   'key_dtatrc'                           3D tracer data field
+   !! History :   1.0  !  2002-04  (O. Aumont)  original code
+   !!              -   !  2004-03  (C. Ethe)  module
+   !!              -   !  2005-03  (O. Aumont, A. El Moussaoui) F90
+   !!----------------------------------------------------------------------
+#if  defined key_top  &&  defined key_dtatrc
+   !!----------------------------------------------------------------------
+   !!   'key_top'  and  'key_dtatrc'        TOP model + passive tracer data
    !!----------------------------------------------------------------------
    !!   dta_trc      : read ocean passive tracer data
    !!----------------------------------------------------------------------
-   !! * Modules used
    USE oce_trc
+   USE par_trc
    USE trc
-   USE par_sms
    USE lib_print
+   USE iom
 
    IMPLICIT NONE
    PRIVATE
 
-   !! * Routine accessibility
-   PUBLIC dta_trc   ! called by trcdtr.F90 and trcdmp.F90
-
-   !! * Shared module variables
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk,jptra) ::   &  !:
-      trdta             !: tracer data at given time-step
-
-   !! * Module variables
-   REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,2) ::   &
-      tracdta            ! tracer data at two consecutive times
-   INTEGER , DIMENSION(jptra) :: &
-      nlectr  ,   &    !!: switch for reading once
-      ntrc1   ,   &    !!: number of first month when reading 12 monthly value
-      ntrc2            !!: number of second month when reading 12 monthly value
+   PUBLIC dta_trc   ! called in trcdtr.F90 and trcdmp.F90
+
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk,jptra) ::   trdta   !: tracer data at given time-step
+
+   REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,2) ::   tracdta            ! tracer data at two consecutive times
+   INTEGER , DIMENSION(jptra) ::   nlectr      !: switch for reading once
+   INTEGER , DIMENSION(jptra) ::   ntrc1       !: number of first month when reading 12 monthly value
+   INTEGER , DIMENSION(jptra) ::   ntrc2       !: number of second month when reading 12 monthly value
 
    !! * Substitutions
-#  include "passivetrc_substitute.h90"
-
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LODYC-IPSL  (2003)
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
@@ -64,25 +58,12 @@
       !!      At each time step, a linear interpolation is applied between 
       !!      two monthly values.
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt     ! ocean time-step
       !!
-      !! History :
-      !!   8.2  !  02-04  (O. Aumont)  Original code
-      !!   9.0  !  04-03  (C. Ethe)    
-      !!   9.0  !  05-03  (O. Aumont and A. El Moussaoui) F90
-      !!----------------------------------------------------------------------
-      !! * Modules used
-      USE iom
-
-      !! * Arguments
-      INTEGER, INTENT( in ) ::   kt     ! ocean time-step
-
-      !! * Local declarations
-      INTEGER :: ji, jj, jn, jl 
-      INTEGER, PARAMETER ::  &
-         jpmois  = 12        ! number of months
-
-      INTEGER ::   &
-         imois, iman, i15, ik  ! temporary integers 
-      CHARACTER (len=39) :: clname(jptra)
-      REAL(wp) :: zxy, zl
+      CHARACTER (len=39) ::   clname(jptra)
+      INTEGER, PARAMETER ::   jpmois  = 12        ! number of months
+      INTEGER ::   ji, jj, jn, jl 
+      INTEGER ::   imois, iman, i15, ik  ! temporary integers 
+      REAL(wp) ::   zxy, zl
       !!----------------------------------------------------------------------
 
@@ -113,14 +94,14 @@
                IF(lwp) WRITE(numout,*) ' trc_dta : Levitus tracer data monthly fields'
                ! open file 
-#if defined key_trc_pisces
+# if defined key_pisces
                clname(jn) = 'LEVITUS_'//ctrcnm(jn)
-#else
+# else
                clname(jn) = ctrcnm(jn)
-#endif
+# endif
                CALL iom_open ( clname(jn), numtr(jn) )              
 
             ENDIF
 
-#if defined key_trc_pisces
+# if defined key_pisces
             ! Read montly file
             IF( ( kt == nittrc000 .AND. nlectr(jn) == 0)  .OR. imois /= ntrc1(jn) ) THEN
@@ -161,6 +142,7 @@
                            ik = mbathy(ji,jj) - 1
                            IF( ik > 2 ) THEN
-                              zl = ( gdept(ik) - fsdept(ji,jj,ik) ) / ( gdept(ik) - gdept(ik-1) )
-                              tracdta(ji,jj,ik,jn,jl) = (1.-zl) * tracdta(ji,jj,ik,jn,jl) + zl * tracdta(ji,jj,ik-1,jn,jl)
+                              zl = ( gdept_0(ik) - fsdept(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) )
+                              tracdta(ji,jj,ik,jn,jl) = (1.-zl) * tracdta(ji,jj,ik  ,jn,jl)   &
+                                 &                    +     zl  * tracdta(ji,jj,ik-1,jn,jl)
                            ENDIF
                         END DO
@@ -173,40 +155,35 @@
 
             IF(lwp) THEN
-               WRITE(numout,*) ctrcnm(jn), 'Levitus month ', ntrc1(jn),   &
-                  ntrc2(jn)
+               WRITE(numout,*) ctrcnm(jn), 'Levitus month ', ntrc1(jn), ntrc2(jn)
                WRITE(numout,*)
-               WRITE(numout,*) ' Levitus month = ', ntrc1(jn),   &
-                  '  level = 1'
+               WRITE(numout,*) ' Levitus month = ', ntrc1(jn), '  level = 1'
                CALL prihre( tracdta(1,1,1,jn,1), jpi, jpj, 1, jpi, 20, 1   &
-                  ,jpj, 20, 1., numout )
-               WRITE(numout,*) ' Levitus month = ', ntrc1(jn),    &
-                  '  level = ',jpk/2
+                  &        ,jpj, 20, 1., numout )
+               WRITE(numout,*) ' Levitus month = ', ntrc1(jn), '  level = ',jpk/2
                CALL prihre( tracdta(1,1,jpk/2,jn,1), jpi, jpj, 1, jpi,    &
-                  20, 1, jpj, 20, 1., numout )
-               WRITE(numout,*) ' Levitus month = ',ntrc1(jn)     &
-                  ,'  level = ',jpkm1
+                  &         20, 1, jpj, 20, 1., numout )
+               WRITE(numout,*) ' Levitus month = ',ntrc1(jn),'  level = ',jpkm1
                CALL prihre( tracdta(1,1,jpkm1,jn,1), jpi, jpj, 1, jpi,     &
-                  20, 1, jpj, 20, 1., numout )
+                  &         20, 1, jpj, 20, 1., numout )
             ENDIF
 
             ! At every time step compute temperature data
-
             zxy = FLOAT( nday + 15 - 30 * i15 ) / 30.
-            trdta(:,:,:,jn)=  ( 1. - zxy ) * tracdta(:,:,:,jn,1)    &
-               +       zxy   * tracdta(:,:,:,jn,2) 
-
-            IF( jn == jpno3) trdta(:,:,:,jn) = trdta(:,:,:,jn) * 7.6E-6
-            IF( jn == jpdic) trdta(:,:,:,jn) = trdta(:,:,:,jn) * 1.E-6
-            IF( jn == jptal) trdta(:,:,:,jn) = trdta(:,:,:,jn) * 1.E-6
-            IF( jn == jpoxy) trdta(:,:,:,jn) = trdta(:,:,:,jn) * 44.6E-6
-            IF( jn == jpsil) trdta(:,:,:,jn) = trdta(:,:,:,jn) * 1.E-6
-            IF( jn == jppo4) trdta(:,:,:,jn) = trdta(:,:,:,jn) * 122.E-6
+            trdta(:,:,:,jn) =  ( 1. - zxy ) * tracdta(:,:,:,jn,1)    &
+               &              +       zxy   * tracdta(:,:,:,jn,2) 
+
+            IF( jn == jpno3 )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   7.6e-6
+            IF( jn == jpdic )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   1.0e-6
+            IF( jn == jptal )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   1.0e-6
+            IF( jn == jpoxy )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *  44.6e-6
+            IF( jn == jpsil )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   1.0e-6
+            IF( jn == jppo4 )   trdta(:,:,:,jn) = trdta(:,:,:,jn) * 122.0e-6
 
             ! Close the file
             ! --------------
             
-            IF( kt == nitend )   CALL iom_close ( numtr(jn) )
-
-#else
+            IF( kt == nitend )   CALL iom_close( numtr(jn) )
+
+# else
             ! Read init file only
             IF( kt == nittrc000  ) THEN
@@ -215,16 +192,15 @@
                CALL iom_close ( numtr(jn) )
             ENDIF 
-#endif
-
-        ENDIF
-
-       END DO
-
+# endif
+
+         ENDIF
+
+      END DO
+      !
    END SUBROUTINE dta_trc
 
 #else
-
-   !!----------------------------------------------------------------------
-   !!   Default case                        NO 3D passive tracer data field
+   !!----------------------------------------------------------------------
+   !!   Dummy module                              NO 3D passive tracer data
    !!----------------------------------------------------------------------
 CONTAINS
@@ -232,6 +208,6 @@
       WRITE(*,*) 'dta_trc: You should not have seen this print! error?', kt
    END SUBROUTINE dta_trc
-
 #endif
 
+   !!======================================================================
 END MODULE trcdta
Index: trunk/NEMO/TOP_SRC/trcdtr.F90
===================================================================
--- trunk/NEMO/TOP_SRC/trcdtr.F90	(revision 944)
+++ trunk/NEMO/TOP_SRC/trcdtr.F90	(revision 945)
@@ -1,92 +1,68 @@
 MODULE trcdtr
-   !!=======================================================================================
-   !!
-   !!                       *** MODULE trcdtr ***
-   !!
-   !!  Computes or READ initial DATA for passive tracer
-   !!
-   !!=======================================================================================
-   !!  TOP 1.0,  LOCEAN-IPSL (2005)
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/TOP_SRC/trcdtr.F90,v 1.8 2007/10/17 14:48:56 opalod Exp $
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
-   !!----------------------------------------------------------------------
-      !!----------------------------------------------------------------------
-      !! * Modules used
-      !! ==============
-      USE oce_trc
-      USE trc
-      USE sms
-      USE trcdta
-      USE lib_mpp
-
-      IMPLICIT NONE
-      PRIVATE
-  !! * Accessibility
-      PUBLIC trc_dtr
+   !!======================================================================
+   !!                         ***  MODULE trcdtr  ***
+   !! TOP :   computes or READ initial DATA for passive tracer
+   !!======================================================================
+   !! History :    -   !  1996-11  ()  original code
+   !!                  !  2000-12  (O. Aumont, E. Kestenare) add for POC in sediments
+   !!             1.0  !  2005-12  (O. Aumont, A. El Moussaoui) F90
+   !!----------------------------------------------------------------------
+#if defined key_top
+   !!----------------------------------------------------------------------
+   !!   'key_top'                                                TOP models
+   !!----------------------------------------------------------------------
+   !!   trc_dtr    :  computes or READ initial DATA for passive tracer
+   !!----------------------------------------------------------------------
+   USE oce_trc
+   USE trc
+   USE sms
+   USE trcdta
+   USE lib_mpp
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC trc_dtr      ! called in ???
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
 
 CONTAINS
 
-#if defined key_passivetrc
-
-SUBROUTINE trc_dtr
-!!---------------------------------------------------------------------
-!!
-!!                       ROUTINE trci_dtr
-!!                     ******************
-!!  PURPOSE :
-!!  ---------
-!!     computes or READ initial DATA for passive tracer
-!!   -----
-!!      COMMON
-!!            /comdom/          : domain PARAMETER
-!!            /comcoo/          : orthogonal curvilinear coordinates
-!!                                and scale factors
-!!            /comask/          : masks, bathymetry
-!!   OUTPUT :
-!!   ------
-!!      COMMON
-!!            /cottrc/          : passive tracer field now and before
-!!
-!!
-!!   History:
-!!   --------
-!!      original  : 96-11
-!!      additions : 99-9
-!!                : 00-12 (O. Aumont, E. Kestenare) add for POC in sediments 
-!!                         add for POC in sediments  
-!!    03/05  O. Aumont and A. El Moussaoui  F90 
-!!----------------------------------------------------------------------
-!!----------------------------------------------------------------------
-!! local declarations
-!! ================== 
-      INTEGER :: ji,jj,jk,jn 
-#if defined key_trc_pisces
-      REAL(wp) :: alka0,oxyg0,calc0,bioma0,    &
-                  silic1,po4,no3,caralk,bicarb,co3
-#endif
-!!---------------------------------------------------------------------
-!!  OPA.9 
-!!---------------------------------------------------------------------
-!! 0. initialisations
-!! ------------------
-
-      IF(lwp) WRITE(numout,*) ' '
-      IF(lwp) WRITE(numout,*) ' *** trcdtr initialisation for '
-      IF(lwp) WRITE(numout,*) '     passive tracers'
-      IF(lwp) WRITE(numout,*) ' '
-
+   SUBROUTINE trc_dtr
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_dtr  ***
+      !!
+      !! ** Purpose :   computes or READ initial DATA for passive tracer
+      !!
+      !! ** Method  : 
+      !!---------------------------------------------------------------------
+      INTEGER ::   ji, jj, jk, jn 
+# if defined key_pisces
+      REAL(wp) ::   alka0, sco2, oxyg0, calc0, bioma0
+      REAL(wp) ::   silic1, po4, no3, caralk, bicarb, co3
+# endif
+      !!---------------------------------------------------------------------
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) 'trc_dtr : initialisation of the passive tracers'
+      IF(lwp) WRITE(numout,*) '~~~~~~~'
 
 #if defined key_cfc
-      trn(:,:,:,:)=0.0
-#elif defined key_trc_pisces
-
-      sco2   = 2.3e-3
-      alka0  = 2.39e-3
-      oxyg0  = 1.8e-4
-      po4    = 2.165e-6/po4r
-      bioma0 = 1.e-8
-      silic1 = 91.51e-6
-      calc0  = 1.e-6
-      no3    = 30.88E-6*7.6
+      trn(:,:,:,:) = 0.0  ! CFC initialisation to zero
+ 
+#elif defined key_pisces
+      ! PISCES initialisation
+      ! ---------------------
+      sco2   =  2.312e-3
+      alka0  =  2.423e-3
+      oxyg0  =  177.6e-6
+      po4    =  2.174e-6 / po4r
+      bioma0 =  1.000e-8
+      silic1 = 91.65e-6
+      no3    = 31.04e-6 * 7.6
 
       trn(:,:,:,jpdic) = sco2
@@ -94,16 +70,16 @@
       trn(:,:,:,jptal) = alka0
       trn(:,:,:,jpoxy) = oxyg0
-      trn(:,:,:,jpcal) = calc0
+      trn(:,:,:,jpcal) = bioma0
       trn(:,:,:,jppo4) = po4
       trn(:,:,:,jppoc) = bioma0
-#if ! defined key_trc_kriest
+#  if ! defined key_kriest
       trn(:,:,:,jpgoc) = bioma0
-      trn(:,:,:,jpbfe) = bioma0*5E-6
-#else
-      trn(:,:,:,jpnum) = bioma0/(6.*xkr_massp)
-#endif
+      trn(:,:,:,jpbfe) = bioma0 * 5.e-6
+#  else
+      trn(:,:,:,jpnum) = bioma0 / ( 6. * xkr_massp )
+#  endif
       trn(:,:,:,jpsil) = silic1
-      trn(:,:,:,jpbsi) = bioma0*0.15
-      trn(:,:,:,jpdsi) = bioma0*5.E-6
+      trn(:,:,:,jpbsi) = bioma0 * 0.15
+      trn(:,:,:,jpdsi) = bioma0 * 5.e-6
       trn(:,:,:,jpphy) = bioma0
       trn(:,:,:,jpdia) = bioma0
@@ -111,127 +87,126 @@
       trn(:,:,:,jpmes) = bioma0
       trn(:,:,:,jpfer) = 0.6E-9
-      trn(:,:,:,jpsfe) = bioma0*5.E-6
-      trn(:,:,:,jpdfe) = bioma0*5.E-6
-      trn(:,:,:,jpnfe) = bioma0*5.E-6
-      trn(:,:,:,jpnch) = bioma0*12./55.
-      trn(:,:,:,jpdch) = bioma0*12./55.
+      trn(:,:,:,jpsfe) = bioma0 * 5.e-6
+      trn(:,:,:,jpdfe) = bioma0 * 5.e-6
+      trn(:,:,:,jpnfe) = bioma0 * 5.e-6
+      trn(:,:,:,jpnch) = bioma0 * 12. / 55.
+      trn(:,:,:,jpdch) = bioma0 * 12. / 55.
       trn(:,:,:,jpno3) = no3
       trn(:,:,:,jpnh4) = bioma0
 
-
-!!  Initialization of chemical variables of the carbon cycle
-!!  --------------------------------------------------------
-
-      DO jk = 1,jpk
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-              caralk = trn(ji,jj,jk,jptal)-         & 
-                      borat(ji,jj,jk)/(1.+1.E-8/(rtrn+akb3(ji,jj,jk)))
-               co3 = (caralk-trn(ji,jj,jk,jpdic))*tmask(ji,jj,jk)   &
-                  &        +(1.-tmask(ji,jj,jk))*.5e-3
-              bicarb = (2.*trn(ji,jj,jk,jpdic)-caralk)
-              hi(ji,jj,jk) = (ak23(ji,jj,jk)*bicarb/co3)             &  
-                *tmask(ji,jj,jk)+(1.-tmask(ji,jj,jk))*1.e-9
-          ENDDO
-        ENDDO
-      ENDDO
-
-
-!!  initialize the half saturation constant for silicate
-!!  ----------------------------------------------------
-
-      xksi(:,:)=2.E-6
+      ! Initialization of chemical variables of the carbon cycle
+      ! --------------------------------------------------------
+      DO jk = 1, jpk
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               caralk = trn(ji,jj,jk,jptal) - borat(ji,jj,jk) / (  1. + 1.E-8 / ( rtrn + akb3(ji,jj,jk) )  )
+               co3    = ( caralk - trn(ji,jj,jk,jpdic) ) *        tmask(ji,jj,jk)   &
+                  &   +                  0.5e-3          * ( 1. - tmask(ji,jj,jk) )
+               bicarb = (2.*trn(ji,jj,jk,jpdic)-caralk)
+               hi(ji,jj,jk) = ( ak23(ji,jj,jk) * bicarb / co3 ) *        tmask(ji,jj,jk)   &  
+                  &         +            1.e-9                  * ( 1. - tmask(ji,jj,jk) )
+          END DO
+        END DO
+      END DO
+
+      ! initialize the half saturation constant for silicate
+      ! ----------------------------------------------------
+      xksi(:,:) = 2.e-6
 
       IF(lwp) WRITE(numout,*) 'Initialization of PISCES tracers done'
       IF(lwp) WRITE(numout,*) ' '
 
-#elif defined key_trc_lobster1 && ( defined key_eel_r6 || defined key_eel_r2 )
-! analytical initialisation used in Levy et al. (2001)
+# elif defined key_lobster && ( defined key_eel_r6 || defined key_eel_r2 )
+      ! LOBSTER initialisation for EEL
+      ! ----------------------
+      ! here: analytical initialisation used in Levy et al. (2001)
       
-      DO jk=1,7
-        trn(:,:,jk,jpdet)=0.016*tmask(:,:,jk)
-        trn(:,:,jk,jpzoo)=0.018*tmask(:,:,jk)
-        trn(:,:,jk,jpphy)=0.036*tmask(:,:,jk)
-        trn(:,:,jk,jpno3)=1.e-5*tmask(:,:,jk)
-        trn(:,:,jk,jpnh4)=0.0005*tmask(:,:,jk)
-        trn(:,:,jk,jpdom)=0.017*tmask(:,:,jk)
-      END DO
-
-      trn(:,:,8,jpdet)=0.020*tmask(:,:,1)
-      trn(:,:,8,jpzoo)=0.027*tmask(:,:,1)
-      trn(:,:,8,jpphy)=0.041*tmask(:,:,1)
-      trn(:,:,8,jpno3)=0.00022*tmask(:,:,1)
-      trn(:,:,8,jpnh4)=0.0033*tmask(:,:,1)
-      trn(:,:,8,jpdom)=0.021*tmask(:,:,1)
-
-      trn(:,:,9,jpdet)=0.0556*tmask(:,:,1)
-      trn(:,:,9,jpzoo)=0.123*tmask(:,:,1)
-      trn(:,:,9,jpphy)=0.122*tmask(:,:,1)
-      trn(:,:,9,jpno3)=0.028*tmask(:,:,1)
-      trn(:,:,9,jpnh4)=0.024*tmask(:,:,1)
-      trn(:,:,9,jpdom)=0.06*tmask(:,:,1)
-
-      trn(:,:,10,jpdet)=0.025*tmask(:,:,1)
-      trn(:,:,10,jpzoo)=0.016*tmask(:,:,1)
-      trn(:,:,10,jpphy)=0.029*tmask(:,:,1)
-      trn(:,:,10,jpno3)=2.462*tmask(:,:,1)
-      trn(:,:,10,jpnh4)=0.04*tmask(:,:,1)
-      trn(:,:,10,jpdom)=0.022*tmask(:,:,1)
-
-      trn(:,:,11,jpdet)=0.0057*tmask(:,:,1)
-      trn(:,:,11,jpzoo)=0.0005*tmask(:,:,1)
-      trn(:,:,11,jpphy)=0.0006*tmask(:,:,1)
-      trn(:,:,11,jpno3)=3.336*tmask(:,:,1)
-      trn(:,:,11,jpnh4)=0.005*tmask(:,:,1)
-      trn(:,:,11,jpdom)=0.004*tmask(:,:,1)
-
-      trn(:,:,12,jpdet)=0.002*tmask(:,:,1)
-      trn(:,:,12,jpzoo)=1.e-6*tmask(:,:,1)
-      trn(:,:,12,jpphy)=5.e-6*tmask(:,:,1)
-      trn(:,:,12,jpno3)=4.24*tmask(:,:,1)
-      trn(:,:,12,jpnh4)=0.001*tmask(:,:,1)
-      trn(:,:,12,jpdom)=3.e-5*tmask(:,:,1)
+      DO jk = 1, 7
+         trn(:,:,jk,jpdet) = 0.016 * tmask(:,:,jk)
+         trn(:,:,jk,jpzoo) = 0.018 * tmask(:,:,jk)
+         trn(:,:,jk,jpphy) = 0.036 * tmask(:,:,jk)
+         trn(:,:,jk,jpno3) = 1.e-5 * tmask(:,:,jk)
+         trn(:,:,jk,jpnh4) = 5.e-4 * tmask(:,:,jk)
+         trn(:,:,jk,jpdom) = 0.017 * tmask(:,:,jk)
+      END DO
+
+      trn(:,:, 8,jpdet) = 0.020   * tmask(:,:, 8)
+      trn(:,:, 8,jpzoo) = 0.027   * tmask(:,:, 8)
+      trn(:,:, 8,jpphy) = 0.041   * tmask(:,:, 8)
+      trn(:,:, 8,jpno3) = 0.00022 * tmask(:,:, 8)
+      trn(:,:, 8,jpnh4) = 0.0033  * tmask(:,:, 8)
+      trn(:,:, 8,jpdom) = 0.021   * tmask(:,:, 8)
+
+      trn(:,:, 9,jpdet) = 0.0556  * tmask(:,:, 9)
+      trn(:,:, 9,jpzoo) = 0.123   * tmask(:,:, 9)
+      trn(:,:, 9,jpphy) = 0.122   * tmask(:,:, 9)
+      trn(:,:, 9,jpno3) = 0.028   * tmask(:,:, 9)
+      trn(:,:, 9,jpnh4) = 0.024   * tmask(:,:, 9)
+      trn(:,:, 9,jpdom) = 0.06    * tmask(:,:, 9)
+
+      trn(:,:,10,jpdet) = 0.025   * tmask(:,:,10)
+      trn(:,:,10,jpzoo) = 0.016   * tmask(:,:,10)
+      trn(:,:,10,jpphy) = 0.029   * tmask(:,:,10)
+      trn(:,:,10,jpno3) = 2.462   * tmask(:,:,10)
+      trn(:,:,10,jpnh4) = 0.04    * tmask(:,:,10)
+      trn(:,:,10,jpdom) = 0.022   * tmask(:,:,10)
+
+      trn(:,:,11,jpdet) = 0.0057  * tmask(:,:,11)
+      trn(:,:,11,jpzoo) = 0.0005  * tmask(:,:,11)
+      trn(:,:,11,jpphy) = 0.0006  * tmask(:,:,11)
+      trn(:,:,11,jpno3) = 3.336   * tmask(:,:,11)
+      trn(:,:,11,jpnh4) = 0.005   * tmask(:,:,11)
+      trn(:,:,11,jpdom) = 0.004   * tmask(:,:,11)
+
+      trn(:,:,12,jpdet) = 0.002   * tmask(:,:,12)
+      trn(:,:,12,jpzoo) = 1.e-6   * tmask(:,:,12)
+      trn(:,:,12,jpphy) = 5.e-6   * tmask(:,:,12)
+      trn(:,:,12,jpno3) = 4.24    * tmask(:,:,12)
+      trn(:,:,12,jpnh4) = 0.001   * tmask(:,:,12)
+      trn(:,:,12,jpdom) = 3.e-5   * tmask(:,:,12)
 
       DO jk=13,jpk
-        trn(:,:,jk,jpdet)=0.0
-        trn(:,:,jk,jpzoo)=0.0
-        trn(:,:,jk,jpphy)=0.0
-        trn(:,:,jk,jpnh4)=0.0
-        trn(:,:,jk,jpdom)=0.0
-      END DO
-
-      trn(:,:,13,jpno3)=5.31*tmask(:,:,13)
-      trn(:,:,14,jpno3)=6.73*tmask(:,:,14)
-      trn(:,:,15,jpno3)=8.32*tmask(:,:,15)
-      trn(:,:,16,jpno3)=10.13*tmask(:,:,16)
-      trn(:,:,17,jpno3)=11.95*tmask(:,:,17)
-      trn(:,:,18,jpno3)=13.57*tmask(:,:,18)
-      trn(:,:,19,jpno3)=15.08*tmask(:,:,19)
-      trn(:,:,20,jpno3)=16.41*tmask(:,:,20)
-      trn(:,:,21,jpno3)=17.47*tmask(:,:,21)
-      trn(:,:,22,jpno3)=18.29*tmask(:,:,22)
-      trn(:,:,23,jpno3)=18.88*tmask(:,:,23)
-      trn(:,:,24,jpno3)=19.30*tmask(:,:,24)
-      trn(:,:,25,jpno3)=19.68*tmask(:,:,25)
-      trn(:,:,26,jpno3)=19.91*tmask(:,:,26)
-      trn(:,:,27,jpno3)=19.99*tmask(:,:,27)
-      trn(:,:,28,jpno3)=20.01*tmask(:,:,28)
-      trn(:,:,29,jpno3)=20.01*tmask(:,:,29)
-      trn(:,:,30,jpno3)=20.01*tmask(:,:,30)
-
-#elif defined key_trc_lobster1 && defined key_gyre
-! init NO3=f(density) by asklod AS Kremeur 2005-07
-      trn(:,:,:,jpdet)=0.1*tmask(:,:,:)
-      trn(:,:,:,jpzoo)=0.1*tmask(:,:,:)
-      trn(:,:,:,jpnh4)=0.1*tmask(:,:,:)
-      trn(:,:,:,jpphy)=0.1*tmask(:,:,:)
-      trn(:,:,:,jpdom)=1.*tmask(:,:,:)
-      DO  jk=1,jpk
-         DO  jj=1,jpj
-            DO  ji=1,jpi
-               IF (rhd(ji,jj,jk).LE.24.5e-3) THEN
-                  trn(ji,jj,jk,jpno3)=2.*tmask(ji,jj,jk)
+        trn(:,:,jk,jpdet) = 0.e0
+        trn(:,:,jk,jpzoo) = 0.e0
+        trn(:,:,jk,jpphy) = 0.e0
+        trn(:,:,jk,jpnh4) = 0.e0
+        trn(:,:,jk,jpdom) = 0.e0
+      END DO
+
+      trn(:,:,13,jpno3) = 5.31  * tmask(:,:,13)
+      trn(:,:,14,jpno3) = 6.73  * tmask(:,:,14)
+      trn(:,:,15,jpno3) = 8.32  * tmask(:,:,15)
+      trn(:,:,16,jpno3) = 10.13 * tmask(:,:,16)
+      trn(:,:,17,jpno3) = 11.95 * tmask(:,:,17)
+      trn(:,:,18,jpno3) = 13.57 * tmask(:,:,18)
+      trn(:,:,19,jpno3) = 15.08 * tmask(:,:,19)
+      trn(:,:,20,jpno3) = 16.41 * tmask(:,:,20)
+      trn(:,:,21,jpno3) = 17.47 * tmask(:,:,21)
+      trn(:,:,22,jpno3) = 18.29 * tmask(:,:,22)
+      trn(:,:,23,jpno3) = 18.88 * tmask(:,:,23)
+      trn(:,:,24,jpno3) = 19.30 * tmask(:,:,24)
+      trn(:,:,25,jpno3) = 19.68 * tmask(:,:,25)
+      trn(:,:,26,jpno3) = 19.91 * tmask(:,:,26)
+      trn(:,:,27,jpno3) = 19.99 * tmask(:,:,27)
+      trn(:,:,28,jpno3) = 20.01 * tmask(:,:,28)
+      trn(:,:,29,jpno3) = 20.01 * tmask(:,:,29)
+      trn(:,:,30,jpno3) = 20.01 * tmask(:,:,30)
+
+# elif defined key_lobster && defined key_gyre
+      ! LOBSTER initialisation for GYRE
+      ! ----------------------
+      ! here:  init NO3=f(density) by asklod AS Kremeur 2005-07
+      trn(:,:,:,jpdet) = 0.1 * tmask(:,:,:)
+      trn(:,:,:,jpzoo) = 0.1 * tmask(:,:,:)
+      trn(:,:,:,jpnh4) = 0.1 * tmask(:,:,:)
+      trn(:,:,:,jpphy) = 0.1 * tmask(:,:,:)
+      trn(:,:,:,jpdom) = 1.0 * tmask(:,:,:)
+      DO jk = 1, jpk
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( rhd(ji,jj,jk) <= 24.5e-3 ) THEN
+                  trn(ji,jj,jk,jpno3) = 2. * tmask(ji,jj,jk)
                ELSE
-                  trn(ji,jj,jk,jpno3)=(15.55*(rhd(ji,jj,jk)*1000)-380.11)*tmask(ji,jj,jk)
+                  trn(ji,jj,jk,jpno3) = ( 15.55 * ( rhd(ji,jj,jk) * 1000. ) - 380.11 ) * tmask(ji,jj,jk)
                ENDIF
             END DO
@@ -239,47 +214,43 @@
       END DO
 
+# else
+      ! Default case 
+      ! ------------
+      DO jn = 1, jptra
+         trn(:,:,:,jn) = 0.1 * tmask(:,:,:)
+      END DO
+
+# endif
+
+# if defined key_dtatrc
+     ! Initialization of tracer from a file that may also be used for damping
+      CALL dta_trc( nittrc000 )
+      DO jn = 1, jptra
+        IF( lutini(jn) )   trn(:,:,:,jn) = trdta(:,:,:,jn) * tmask(:,:,:)   ! initialisation from file if required
+      END DO
+# endif
+
+      ! before field :
+      ! -------------
+      trb(:,:,:,:) = trn(:,:,:,:)
+
+# if defined key_lobster
+      !  initialize the POC in sediments
+      sedpocb(:,:) = 0.e0
+      sedpocn(:,:) = 0.e0
+      sedpoca(:,:) = 0.e0
+# endif
+      !
+   END SUBROUTINE trc_dtr 
+
 #else
- 
-!! general case
-      do jn = 1, jptra
-         trn(:,:,:,jn)=0.1*tmask(:,:,:)
-      enddo
-
+   !!----------------------------------------------------------------------
+   !!  Dummy module :                                     No passive tracer
+   !!----------------------------------------------------------------------
+CONTAINS
+   SUBROUTINE trc_dtr                      ! Empty routine   
+   END SUBROUTINE trc_dtr
 #endif
 
-#if defined key_dtatrc
-!!   Initialization of tracer from a file
-!!   that may also be used for damping
-      CALL dta_trc( nittrc000 )
-      DO  jk = 1, jptra
-        IF( lutini(jk) ) THEN 
-!! initialisation from file
-           trn(:,:,:,jk) = trdta(:,:,:,jk)*tmask(:,:,:)
-        ENDIF
-      END DO
-#endif
-
-!! before field :
-!! -------------
-      trb(:,:,:,:) = trn(:,:,:,:)
-
-#if defined key_trc_lobster1
-!!  initialize the POC in sediments
-
-      sedpocb(:,:) = 0.
-      sedpocn(:,:) = 0.
-      sedpoca(:,:) = 0.
-#endif
-      
- END SUBROUTINE trc_dtr 
-
-#else
-
-SUBROUTINE  trc_dtr 
-!!======================
-   !! no passive tracers
-!!======================
-END SUBROUTINE  trc_dtr
-#endif
-
+   !!======================================================================
 END MODULE trcdtr
Index: trunk/NEMO/TOP_SRC/trcini.F90
===================================================================
--- trunk/NEMO/TOP_SRC/trcini.F90	(revision 944)
+++ trunk/NEMO/TOP_SRC/trcini.F90	(revision 945)
@@ -1,50 +1,30 @@
 MODULE trcini
-   !!==========================================================================
-   !!                       *** MODULE trcini ***  
-   !! Ocean passive tracers:  Manage the passive tracer initialization 
-   !!=========================================================================   
-#if defined key_passivetrc
+   !!======================================================================
+   !!                         ***  MODULE trcini  ***
+   !! TOP :   Manage the passive tracer initialization
+   !!======================================================================
+   !! History :    -   !  2000-04  (O. Aumont, M.A. Foujols)  original code
+   !!             1.0  !  2005-03  (O. Aumont, A. El Moussaoui) F90
+   !!              -   !  2005-10  (C. Ethe) Module
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec) re-writing
    !!----------------------------------------------------------------------
-   !!   trc_ini : Initialization for passive tracer
+   !!   trc_ini :   Initialization for passive tracer
    !!----------------------------------------------------------------------
-   !!----------------------------------------------------------------------
-   !!  TOP 1.0,  LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-   !! * Modules used
-   USE oce_trc
-   USE trc
-   USE sms
-   USE lib_mpp
-   USE lbclnk
+   USE par_trc         ! TOP parameters
+   USE trcini_cfc      ! CFC     initialisation
+   USE trcini_lobster  ! LOBSTER initialisation
+   USE trcini_pisces   ! PISCES  initialisation
+   USE trcini_my_trc   ! MY_TRC  initialisation
+   USE in_out_manager  ! I/O manager
 
    IMPLICIT NONE
    PRIVATE
 
-   !! * Accessibility
-   PUBLIC trc_ini
+   PUBLIC   trc_ini   ! called by ???
 
-#if defined key_trc_lobster1
    !!----------------------------------------------------------------------
-   !!   'key_trc_lobster1'                        LOBSTER1 biological model  
-   !!----------------------------------------------------------------------
-#  include "trcini.lobster1.h90"
-
-#elif defined key_trc_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_trc_pisces'                            PISCES biological model                  
-   !!----------------------------------------------------------------------
-#  include "trcini.pisces.h90"
-
-#elif defined key_cfc
-   !!----------------------------------------------------------------------
-   !!   'key_cfc  '                                          CFC model                  
-   !!----------------------------------------------------------------------
-#  include "trcini.cfc.h90"
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option                               
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
@@ -52,75 +32,34 @@
 
    SUBROUTINE trc_ini
-      !!---------------------------------------------------------------------
+      !!-------------------------------------------------------------------
       !!                    ***  ROUTINE trc_ini  ***
       !!              
-      !! ** Purpose : Initialization for passive tracer
-      !!              for restart or not
+      !! ** Purpose :   Initialization of passive tracer to zero
       !!
-      !! History :
-      !!        !  00-04  O. Aumont, M.A. Foujols HAMOCC3 and P3ZD
-      !!   8.5  !  05-03  O.Aumont and A.El Moussaoui  F90
-      !!   9.0  !  05-10  C. Ethe  Modularity
-      !!----------------------------------------------------------------------
-      !! * local declarations
-      INTEGER ::                   & 
-         ji ,jj ,jk ,jn, jl        ! dummy loop indices  
-      !!---------------------------------------------------------------------
-
-
-      !! 1. initialization of passives tracers field
-      !! -------------------------------------------
-      DO jn = 1, jptra
-         trn(:,:,:,jn)=0.e0
-         tra(:,:,:,jn)=0.e0
-      END DO
-
-#if defined key_trc_diaadd
-      !! initialization of output 2d and 3d arrays
-
-      DO jn = 1, jpdia2d
-         trc2d(:,:,jn)=0.e0
-      END DO
-
-      DO jn = 1, jpdia3d
-         trc3d(:,:,:,jn)=0.e0
-      END DO
-#endif
-
-#if defined key_trc_diabio
-      !! initialization of biological trends
-      DO jn=1,jpdiabio
-         trbio(:,:,:,jn) = 0.e0
-      END DO
-#endif
-
-#if defined key_trc_diatrd
-      !! initialization of tracer trends
-      DO jl = 1, jpdiatrc
-         DO jn = 1, jptra
-            IF (luttrd(jn)) trtrd(:,:,:,ikeep(jn),jl) = 0.e0
-         END DO
-      END DO
-#endif      
-
-      IF( lwp ) THEN
-         WRITE(numout,*) ' '
-         WRITE(numout,*) ' trcini: generic initialisation done '
-         WRITE(numout,*) ' '
+      !! ** Method  :   call the initialisation of each defined tracer
+      !!             model (LOBSTER, PISCES, CFC, MY_TRC)
+      !!-------------------------------------------------------------------
+      !
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) 'trc_ini : initial set up of the tracer models'
+      IF(lwp) WRITE(numout,*) '~~~~~~~'
+      !
+      IF( lk_lobster ) THEN   ;   CALL trc_ini_lobster      ! LOBSTER bio-model
+      ELSE                    ;   IF(lwp) WRITE(numout,*) '          LOBSTER not used'
       ENDIF
 
+      IF( lk_pisces  ) THEN   ;   CALL trc_ini_pisces       ! PISCES  bio-model
+      ELSE                    ;   IF(lwp) WRITE(numout,*) '          PISCES not used'
+      ENDIF
+
+      IF( lk_cfc     ) THEN   ;   CALL trc_ini_cfc          ! CFC     tracers
+      ELSE                    ;   IF(lwp) WRITE(numout,*) '          CFC not used'
+      ENDIF
+
+      IF( lk_my_trc  ) THEN   ;   CALL trc_ini_my_trc       ! MY_TRC  tracers
+      ELSE                    ;   IF(lwp) WRITE(numout,*) '          MY_TRC not used'
+      ENDIF
+      !
    END SUBROUTINE trc_ini
-
-#endif
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module :                      NO passive tracer
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_ini              ! Empty routine
-
-   END SUBROUTINE trc_ini
-#endif
 
    !!======================================================================
Index: trunk/NEMO/TOP_SRC/trclec.F90
===================================================================
--- trunk/NEMO/TOP_SRC/trclec.F90	(revision 944)
+++ trunk/NEMO/TOP_SRC/trclec.F90	(revision 945)
@@ -1,16 +1,21 @@
 MODULE trclec
-   !!==========================================================================
-   !!
-   !!                       *** MODULE trclec ***
-   !! Read and print options for the passive tracer run (namelist)
-   !! O.Aumont and A.El Moussaoui 03/05 F90
-   !!=========================================================================
-   !!  TOP 1.0,  LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-#if defined key_passivetrc
-   !! * Modules used
-   !! ==============
+   !!======================================================================
+   !!                       ***  MODULE trclec  ***
+   !! TOP :   Read and print options for the passive tracer run (namelist)
+   !!======================================================================
+   !! History :    -   !  1996-11  (M.A. Foujols, M. Levy)  original code
+   !!              -   !  1998-04  (M.A Foujols, L. Bopp) ahtrb0 for isopycnal mixing
+   !!              -   !  1999-10  (M.A. Foujols, M. Levy) separation of sms
+   !!              -   !  2000-07  (A. Estublier) add TVD and MUSCL : Tests on ndttrc
+   !!              -   !  2000-11  (M.A Foujols, E Kestenare) trcrat, ahtrc0 and aeivtr0
+   !!              -   !  2001-01 (E Kestenare) suppress ndttrc=1 for CEN2 and TVD schemes
+   !!             1.0  !  2005-03 (O. Aumont, A. El Moussaoui) F90
+   !!----------------------------------------------------------------------
+#if defined key_top
+   !!----------------------------------------------------------------------
+   !!   'key_top'                                                TOP models
+   !!----------------------------------------------------------------------
+   !!   trc_lec    :  Read and print options for the passive tracer run (namelist)
+   !!----------------------------------------------------------------------
    USE oce_trc
    USE trc
@@ -21,8 +26,13 @@
    PRIVATE 
 
-   !! * Accessibility
-   PUBLIC trc_lec
-
-#include "passivetrc_substitute.h90"
+   PUBLIC trc_lec      ! called in ???
+
+   !! * Substitutions
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
 
 CONTAINS
@@ -30,255 +40,238 @@
    SUBROUTINE trc_lec
       !!---------------------------------------------------------------------
-      !!                       ROUTINE trclec
-      !!                     ******************
-      !!  PURPOSE :
-      !!  ---------
-      !!     READ and PRINT options for the passive tracer run (namelist)
+      !!                     ***  ROUTINE trc_lec  ***
       !!
-      !!   History:
-      !!   --------
-      !!      original  : 96-11 (M.A. Foujols, M. Levy) passive tracer
-      !!      modification : 98-04 (M.A Foujols, L. Bopp) ahtrb0 for isopycnal
-      !!                                                  diffusion
-      !!      modification : 99-10(M.A. Foujols, M. Levy) separation of sms
-      !!      additions : 00-05(A. Estublier) TVD Limiter Scheme : Tests 
-      !!                                      on ndttrc
-      !!      additions : 00-06(A. Estublier) MUSCL Scheme : Tests 
-      !!                                      on ndttrc
-      !!      additions : 00-07(A. Estublier) PPM Scheme : Tests on ndttrc
-      !!      modification : 00-11 (M.A Foujols, E Kestenare) trcrat, ahtrc0 and aeivtr0
-      !!      modification : 01-01 (E Kestenare) suppress ndttrc=1 
-      !!                                         for Arakawa and TVD schemes
-      !!     O.Aumont and A.El Moussaoui 03/05 F90
-      !!----------------------------------------------------------------------
-
-      !! local declarations
-      !! ==================
-
-      INTEGER ::  ji
-      CHARACTER (len=32) :: clname
-
+      !! ** Purpose :   READ and PRINT options for the passive tracer run (namelist) 
+      !!
+      !! ** Method  : - read namelist
       !!---------------------------------------------------------------------
-      !!  OPA.90   03/2005 
+      INTEGER ::  jn
+      CHARACTER (len=32) ::   clname
+
+      TYPE PTRACER
+         CHARACTER(len = 20)  :: sname
+         CHARACTER(len = 80 ) :: lname
+         CHARACTER(len = 20 ) :: unit
+         LOGICAL              :: lini
+         LOGICAL              :: lsav
+      END TYPE PTRACER
+
+#if defined key_trc_diaadd
+
+      TYPE DIAG
+         CHARACTER(len = 20)  :: snamedia
+         CHARACTER(len = 80 ) :: lnamedia
+         CHARACTER(len = 20 ) :: unitdia
+      END TYPE DIAG
+
+#endif
+
+      TYPE(PTRACER) , DIMENSION(jptra) :: tracer
+
+#if defined key_trc_diaadd
+      TYPE(DIAG) , DIMENSION(jpdia2d) :: diag2d
+      TYPE(DIAG) , DIMENSION(jpdia3d) :: diag3d
+#endif
+
+      !!
+      NAMELIST/nattrc/ nwritetrc, lrsttr, nrsttr, tracer
+      NAMELIST/natnum/ rsc, rtrn, ncortrc, ndttrc, crosster
+#if defined key_trc_diatrd
+      NAMELIST/natrtd/ luttrd, nwritetrd                                             ! dynamical trends
+#endif
+#if defined key_trc_diaadd
+      NAMELIST/natdia/nwritedia, diag3d, diag2d     ! additional diagnostics
+#endif
       !!---------------------------------------------------------------------
 
-      !! 0. initializations
-      !! ------------------
-
-      namelist/nattrc/nwritetrc,lrsttr,nrsttr, ctrcnm,ctrcnl,ctrcun,lutini     !general   
-
-      namelist/natnum/rsc,rtrn,ncortrc,ndttrc,crosster
-
-#if defined key_trc_diatrd
-      namelist/natrtd/luttrd,nwritetrd                      ! dynamical trends
-#endif
-
-#if defined key_trc_diaadd
-      namelist/natadd/ctrc3d,ctrc3l,ctrc2d,ctrc2l, ctrc3u, ctrc2u,     &
-         nwriteadd                             !additional diagnostics
-#endif
-
-      IF(lwp) THEN
-         WRITE(numout,*) ' '
-         WRITE(numout,*) ' ROUTINE trclec'
-         WRITE(numout,*) ' **************'
-         WRITE(numout,*) ' '
-         WRITE(numout,*) ' namelist for passive tracer'
-         WRITE(numout,*) ' ***************************'
-         WRITE(numout,*) ' '
-      ENDIF
-
-      clname='namelist.passivetrc'
+      IF(lwp) WRITE(numout,*) 'trc_lec : read the passive tracer namelists'
+      IF(lwp) WRITE(numout,*) '~~~~~~~'
+
+      clname = 'namelist.passivetrc'
       CALL ctlopn( numnat, clname, 'OLD', 'FORMATTED', 'SEQUENTIAL',   &
          &         1, numout, .FALSE., 1 )
 
 
-      !! 1., 2. & 3. initialization with namelist files
-      !! ----------------------------------------------
-      !! 1.0 namelist nattrc :
-
-      nwritetrc = 10
-      lrsttr=.FALSE.
-      nrsttr = 0
-
-      DO ji=1,jptra
-         WRITE (ctrcnm(ji),'("TR_",I1)') ji
-         WRITE (ctrcnl(ji),'("TRACER NUMBER ",I1)') ji
-         ctrcun(ji)='mmole/m3'
-         lutini(ji)=.FALSE. 
-      END DO
-
-
-      REWIND(numnat)
-      READ(numnat,nattrc)
-
-      IF(lwp) THEN
-         WRITE(numout,*) ' '
-         WRITE(numout,*) 'nattrc'
-         WRITE(numout,*) ' '
-         WRITE(numout,*)          &
-            ' frequency of outputs for passive tracers nwritetrc = '    &
-            ,nwritetrc  
-         WRITE(numout,*) ' restart LOGICAL for passive tr. lrsttr = ',   &
-            &         lrsttr
-         WRITE(numout,*) ' control of time step for p. tr. nrsttr = ',   & 
-            &         nrsttr
-         DO ji=1,jptra
-            WRITE(numout,*) ' tracer nb: ',ji,' name = ',ctrcnm(ji)       & 
-               &           ,ctrcnl(ji) 
-            WRITE(numout,*) ' in unit = ',ctrcun(ji)
-            WRITE(numout,*) ' initial value in FILE : ',lutini(ji) 
+      ! Namelist nattrc (files)
+      ! ----------------------------------------------
+      nwritetrc = 10                 ! default values
+      lrsttr    = .FALSE.
+      nrsttr    =  0
+      DO jn = 1, jptra
+         WRITE(ctrcnm(jn),'("TR_",I1)'           ) jn
+         WRITE(ctrcnl(jn),'("TRACER NUMBER ",I1)') jn
+         ctrcun(jn) = 'mmole/m3'
+         lutini(jn) = .FALSE. 
+         lutsav(jn) = .TRUE.
+      END DO
+
+      REWIND( numnat )               ! read nattrc
+      READ  ( numnat, nattrc )
+
+      DO jn = 1, jptra
+         ctrcnm(jn) = tracer(jn)%sname
+         ctrcnl(jn) = tracer(jn)%lname
+         ctrcun(jn) = tracer(jn)%unit
+         lutini(jn) = tracer(jn)%lini
+         lutsav(jn) = tracer(jn)%lsav
+      END DO
+
+
+
+      IF(lwp) THEN                   ! control print
+         WRITE(numout,*)
+         WRITE(numout,*) ' Namelist : nattrc'
+         WRITE(numout,*) '    frequency of outputs for passive tracers nwritetrc = ', nwritetrc  
+         WRITE(numout,*) '    restart LOGICAL for passive tr. lrsttr = ', lrsttr
+         WRITE(numout,*) '    control of time step for p. tr. nrsttr = ', nrsttr
+         DO jn = 1, jptra
+            WRITE(numout,*) '   tracer nb             : ', jn 
+            WRITE(numout,*) '   short name            : ', TRIM(ctrcnm(jn))
+            WRITE(numout,*) '   long name             : ', TRIM(ctrcnl(jn))
+            WRITE(numout,*) '   unit                  : ', TRIM(ctrcun(jn))
+            WRITE(numout,*) '   initial value in FILE : ', lutini(jn) 
+            WRITE(numout,*) '   output of tracer      : ', lutsav(jn)
             WRITE(numout,*) ' '
          END DO
-         WRITE(numout,*) ' '
       ENDIF
 
 #if defined key_trc_diatrd
 
-      !! 1.2 namelist nattrd : passive tracers dynamical trends
-
-      nwritetrd=10
-
-      !! default : no dynamical trend recording
-      !! --------------------------------------
-      DO ji=1,jptra
-         luttrd(ji) = .FALSE.
-      END DO
-
-      REWIND(numnat)
-      READ(numnat,natrtd)
+      ! Namelist natrtd (transport trends)
+      ! ----------------------------------------------
+      nwritetrd = 10                 ! default values (no dynamical trend recording)
+      DO jn = 1, jptra
+         luttrd(jn) = .FALSE.
+      END DO
+
+      REWIND( numnat )               ! read natrtd
+      READ  ( numnat, natrtd )
 
       nkeep=0
       ikeep(:)=0
-      DO ji=1,jptra
-         IF (luttrd(ji)) THEN 
-             nkeep=nkeep+1
-             ikeep(ji)=nkeep
+      DO jn = 1, jptra
+         IF( luttrd(jn) ) THEN 
+             nkeep    = nkeep + 1
+             ikeep(jn)=nkeep
          END IF 
       END DO
-      IF (nkeep.GT.0) THEN  
-        IF (.NOT. ALLOCATED(trtrd)) ALLOCATE(trtrd(jpi,jpj,jpk,nkeep,jpdiatrc)) 
-        trtrd(:,:,:,:,:)=0.0
+      IF( nkeep > 0 ) THEN  
+        IF(.NOT. ALLOCATED( trtrd ) )   ALLOCATE( trtrd(jpi,jpj,jpk,nkeep,jpdiatrc) ) 
+        trtrd(:,:,:,:,:) = 0.e0
       ENDIF 
-      IF(lwp) THEN
-         WRITE(numout,*) 'natrtd'
-         WRITE(numout,*) ' '
-         WRITE(numout,*)                        &
-            ' frequency of outputs for dynamical trends nwritetrd = '   &
-            ,nwritetrd
-         DO ji=1,jptra
-            WRITE(numout,*)                      &
-               ' keep dynamical trends for tracer number :',ji          &
-               ,luttrd(ji), ikeep(ji)
-         END DO
-         WRITE(numout,*) 'total = ',nkeep,' tracers dyn trends saved'
-         WRITE(numout,*) 'size of trtrd = ',jpi*jpj*jpk*nkeep*jpdiatrc
-      ENDIF
-#endif
-
-      !!1.3 namelist natadd : passive tracers diagnostics
-      !!-------------------------------------------------
-
-#if defined key_trc_diaadd
-
-      nwriteadd = 10
-
-      !! default value for 3D output arrays : short and long name, units
-
-      DO ji=1,jpdia3d
-         WRITE (ctrc3d(ji),'("3D_",I1)') ji
-         WRITE (ctrc3l(ji),'("3D DIAGNOSTIC NUMBER ",I2)') ji
-         ctrc3u(ji)=' '
-      END DO
-
-
-      !! default value for 2D output arrays : short and long name, units
-      !! ---------------------------------------------------------------
-      DO ji=1,jpdia2d
-         WRITE (ctrc2d(ji),'("2D_",I1)') ji
-         WRITE (ctrc2l(ji),'("2D DIAGNOSTIC NUMBER ",I2)') ji
-         ctrc2u(ji)=' '
-      END DO
-
-      REWIND(numnat)
-      READ(numnat,natadd)
-
-      IF(lwp) THEN
-         WRITE(numout,*) ' natadd'
-         WRITE(numout,*) ' '
-         WRITE(numout,*)                          &
-            ' frequency of outputs for additional arrays nwriteadd = '   &
-            ,nwriteadd
-         DO ji=1,jpdia3d
-            WRITE(numout,*)                     &
-               'name of 3d output field number :',ji,' : ',ctrc3d(ji)  
-            WRITE(numout,*) ctrc3l(ji)  
-            WRITE(numout,*) ' in unit = ',ctrc3u(ji)
-         END DO
-         WRITE(numout,*) ' '
-         DO ji=1,jpdia2d
-            WRITE(numout,*)                    &
-               'name of 2d output field number :',ji,' : ',ctrc2d(ji)  
-            WRITE(numout,*) ctrc2l(ji)  
-            WRITE(numout,*) ' in unit = ',ctrc2u(ji)
-         END DO
-         WRITE(numout,*) ' '
-      ENDIF
-#endif
-
-      !! 1.1 namelist natnum :
-      !! ---------------------
-      rsc=1.
-      rtrn=1.e-15
-      ncortrc=1
-      ndttrc=4
-      crosster=.FALSE.
-
-      REWIND(numnat)
-      READ(numnat,natnum)
-
-!!Chris  computes the first time step of tracer model
+
+      IF(lwp) THEN                   ! control print
+         WRITE(numout,*)
+         WRITE(numout,*) ' Namelist : natrtd'
+         WRITE(numout,*) '    frequency of outputs for dynamical trends nwritetrd = ', nwritetrd
+         DO jn = 1, jptra
+            WRITE(numout,*) '    keep dynamical trends for tracer number :', jn, luttrd(jn), ikeep(jn)
+         END DO
+         WRITE(numout,*) '    total = ', nkeep, ' tracers dyn trends saved'
+         WRITE(numout,*) '    size of trtrd = ', jpi*jpj*jpk*nkeep*jpdiatrc
+      ENDIF
+#endif
+
+#if defined key_trc_diaadd
+
+      ! Namelist natrtd (transport trends)
+      ! ----------------------------------------------
+      nwritedia = 10                 ! default values 
+      !                                 ! 2D output arrays
+      DO jn = 1, jpdia2d
+         WRITE(ctrc2d(jn),'("2D_",I1)') jn                      ! short name
+         WRITE(ctrc2l(jn),'("2D DIAGNOSTIC NUMBER ",I2)') jn    ! long name
+         ctrc2u(jn) = ' '                                       ! units 
+      END DO
+
+      !                                 ! 3D output arrays
+      DO jn = 1, jpdia3d
+         WRITE(ctrc3d(jn),'("3D_",I1)') jn                     ! short name
+         WRITE(ctrc3l(jn),'("3D DIAGNOSTIC NUMBER ",I2)') jn    ! long name
+         ctrc3u(jn) = ' '                                       ! units
+      END DO
+
+      REWIND( numnat )               ! read natrtd
+      READ  ( numnat, natdia )
+
+      DO jn = 1, jpdia2d
+         ctrc2d(jn) = diag2d(jn)%snamedia
+         ctrc2l(jn) = diag2d(jn)%lnamedia
+         ctrc2u(jn) = diag2d(jn)%unitdia
+      END DO
+
+      DO jn = 1, jpdia3d
+         ctrc3d(jn) = diag3d(jn)%snamedia
+         ctrc3l(jn) = diag3d(jn)%lnamedia
+         ctrc3u(jn) = diag3d(jn)%unitdia
+      END DO
+
+      IF(lwp) THEN                   ! control print
+         WRITE(numout,*)
+         WRITE(numout,*) ' Namelist : natadd'
+         WRITE(numout,*) '    frequency of outputs for additional arrays nwritedia = ', nwritedia
+         DO jn = 1, jpdia3d
+            WRITE(numout,*) '   3d output field No : ',jn
+            WRITE(numout,*) '   short name         : ', TRIM(ctrc3d(jn))
+            WRITE(numout,*) '   long name          : ', TRIM(ctrc3l(jn))
+            WRITE(numout,*) '   unit               : ', TRIM(ctrc3u(jn))
+            WRITE(numout,*) ' '
+         END DO
+
+         DO jn = 1, jpdia2d
+            WRITE(numout,*) '   2d output field No : ',jn
+            WRITE(numout,*) '   short name         : ', TRIM(ctrc2d(jn))
+            WRITE(numout,*) '   long name          : ', TRIM(ctrc2l(jn))
+            WRITE(numout,*) '   unit               : ', TRIM(ctrc2u(jn))
+            WRITE(numout,*) ' '
+         END DO
+      ENDIF
+#endif
+
+      !! Namelist natnum :
+      !! -----------------
+      rsc      = 1.                 ! default values
+      rtrn     = 1.e-15
+      ncortrc  = 1
+      ndttrc   = 4
+      crosster = .FALSE.
+
+      REWIND( numnat )              ! read natnum
+      READ  ( numnat, natnum )
+
+      !!Chris  computes the first time step of tracer model
       nittrc000 = nit000 + ndttrc - 1
 
-      IF(lwp) THEN
-         WRITE(numout,*) ' '
-         WRITE(numout,*) 'natnum'
-         WRITE(numout,*) ' '
-         WRITE(numout,*) ' tuning coefficient              rsc     = ',    &
-            rsc
-         WRITE(numout,*) ' truncation value                rtrn    = ',    &
-            rtrn
-         WRITE(numout,*) ' number of corrective phase      ncortrc = ',    &
-            ncortrc
-         WRITE(numout,*) ' time step freq. for pass. trac. ndttrc  = ',    &
-            ndttrc
-         WRITE(numout,*) ' 1st time step for pass. trac. nittrc000 = ',    &
-            nittrc000
-         WRITE(numout,*) ' computes or not crossterms    crosster  = ',    &
-            crosster
-      ENDIF
-
-
-      !! namelist of transport
-      !! ---------------------
+      IF(lwp) THEN                  ! control print
+         WRITE(numout,*)
+         WRITE(numout,*) ' Namelist : natnum'
+         WRITE(numout,*)
+         WRITE(numout,*) ' tuning coefficient              rsc     = ', rsc
+         WRITE(numout,*) ' truncation value                rtrn    = ', rtrn
+         WRITE(numout,*) ' number of corrective phase      ncortrc = ', ncortrc
+         WRITE(numout,*) ' time step freq. for pass. trac. ndttrc  = ', ndttrc
+         WRITE(numout,*) ' 1st time step for pass. trac. nittrc000 = ', nittrc000
+         WRITE(numout,*) ' computes or not crossterms    crosster  = ', crosster
+      ENDIF
+
+      ! namelist of transport
+      ! ---------------------
       CALL trc_trp_lec
 
-      !! namelist of SMS
-      !! ---------------      
+      ! namelist of SMS
+      ! ---------------      
       CALL trc_lsm
-
+      !
    END SUBROUTINE trc_lec
 
 #else
+   !!----------------------------------------------------------------------
+   !!  Dummy module :                                     No passive tracer
+   !!----------------------------------------------------------------------
+CONTAINS
+   SUBROUTINE trc_lec                      ! Empty routine   
+   END SUBROUTINE trc_lec
+#endif
+
    !!======================================================================
-   !!  Empty module : No passive tracer
-   !!======================================================================
-CONTAINS
-
-   SUBROUTINE trc_lec
-
-   END SUBROUTINE trc_lec
-
-#endif
-
 END MODULE  trclec
Index: trunk/NEMO/TOP_SRC/trclsm.F90
===================================================================
--- trunk/NEMO/TOP_SRC/trclsm.F90	(revision 944)
+++ trunk/NEMO/TOP_SRC/trclsm.F90	(revision 945)
@@ -1,63 +1,77 @@
 MODULE trclsm
-   !!===============================================================
-   !!
-   !!                       *** MODULE trclsm ****
-   !!
-   !!  READS specific NAMELIST for sms terms
-   !!
-   !!=================================================================
-   !!  TOP 1.0,  LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!-----------------------------------------------------------------
-#if defined key_passivetrc
-   !!-------------------------------------------------------------
-   !! * Modules used
-   !! ==============
-   USE oce_trc
-   USE trc
-   USE sms
-
+   !!======================================================================
+   !!                         ***  MODULE trclsm  ***
+   !! TOP :   reads specific namelist for passive tracer sms terms
+   !!======================================================================
+   !! History :   1.0  !  2004-03 (C. Ethe) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec) re-writing
+   !!----------------------------------------------------------------------
+#if defined key_top
+   !!----------------------------------------------------------------------
+   !!   'key_top'                                                TOP models
+   !!----------------------------------------------------------------------
+   !!   trc_lsm   : reads specific namelist for sms terms
+   !!----------------------------------------------------------------------
+   USE par_trc         ! TOP parameters
+   USE trclsm_cfc      ! CFC     initialisation
+   USE trclsm_lobster  ! LOBSTER initialisation
+   USE trclsm_pisces   ! PISCES  initialisation
+   USE trclsm_my_trc   ! MY_TRC  initialisation
+   USE in_out_manager  ! I/O manager
 
    IMPLICIT NONE                             
    PRIVATE
 
-   !! * Accessibility
-   PUBLIC trc_lsm
-
-
-#if defined key_trc_lobster1
-   !!----------------------------------------------------------------------
-   !!   'key_trc_lobster1'                        LOBSTER1 biological model  
-   !!----------------------------------------------------------------------
-#  include "trclsm.lobster1.h90"
-
-#elif defined key_trc_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_trc_pisces'                            PISCES biological model                  
-   !!----------------------------------------------------------------------
-#  include "trclsm.pisces.h90"
-
-#elif defined key_cfc
-   !!----------------------------------------------------------------------
-   !!   'key_cfc  '                                          CFC model                  
-   !!----------------------------------------------------------------------
-#  include "trclsm.cfc.h90"
+   PUBLIC   trc_lsm      ! called in initrc.F90
 
    !!----------------------------------------------------------------------
-   !!   Default option                               
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Id$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
-# endif
-
-#else
 
 CONTAINS
 
    SUBROUTINE trc_lsm
-      !!================
-      !! no passive tracers
-   END  SUBROUTINE  trc_lsm
+      !!----------------------------------------------------------------------
+      !!                     ***  trc_lsm  ***  
+      !!
+      !! ** Purpose :   read TOP namelists for the different tracers models
+      !!
+      !! ** Method  :   call the namelist read of each defined tracer
+      !!             model (LOBSTER, PISCES, CFC, MY_TRC)
+      !!----------------------------------------------------------------------
+      !
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) 'trc_lsm : read namelist of the TOP models'
+      IF(lwp) WRITE(numout,*) '~~~~~~~'
+      !
+      IF( lk_lobster ) THEN   ;   CALL trc_lsm_lobster      ! LOBSTER bio-model
+      ELSE                    ;   IF(lwp) WRITE(numout,*) '          LOBSTER not used'
+      ENDIF
 
+      IF( lk_pisces  ) THEN   ;   CALL trc_lsm_pisces      ! PISCES  bio-model
+      ELSE                    ;   IF(lwp) WRITE(numout,*) '          PISCES not used'
+      ENDIF
+
+      IF( lk_cfc     ) THEN   ;   CALL trc_lsm_cfc         ! CFC     tracers
+      ELSE                    ;   IF(lwp) WRITE(numout,*) '          CFC not used'
+      ENDIF
+
+      IF( lk_my_trc  ) THEN   ;   CALL trc_lsm_my_trc      ! MY_TRC  tracers
+      ELSE                    ;   IF(lwp) WRITE(numout,*) '          MY_TRC not used'
+      ENDIF
+      !
+   END SUBROUTINE trc_lsm
+
+#else
+   !!----------------------------------------------------------------------
+   !!  Dummy module :                                     No passive tracer
+   !!----------------------------------------------------------------------
+CONTAINS
+   SUBROUTINE trc_lsm                      ! Empty routine
+   END  SUBROUTINE trc_lsm
 #endif  
 
+   !!======================================================================
 END MODULE trclsm  
Index: trunk/NEMO/TOP_SRC/trcrst.F90
===================================================================
--- trunk/NEMO/TOP_SRC/trcrst.F90	(revision 944)
+++ trunk/NEMO/TOP_SRC/trcrst.F90	(revision 945)
@@ -1,21 +1,21 @@
 MODULE trcrst
    !!======================================================================
-   !!
-   !!                       *** MODULE trcrst ***
-   !!
-   !!   Read the restart files for passive tracers
-   !!
+   !!                       ***  MODULE trcrst  ***
+   !! TOP :   create, write, read the restart files for passive tracers
    !!======================================================================
-   !!  TOP 1.0,  LOCEAN-IPSL (2005) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/TOP_SRC/trcrst.F90,v 1.11 2007/10/17 14:48:56 opalod Exp $ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-#if defined key_passivetrc   
-   !!----------------------------------------------------------------------
-   !! * Modules used
-   !! ==============
+   !! History :   1.0  !  2007-02 (C. Ethe) adaptation from the ocean
+   !!----------------------------------------------------------------------
+#if defined key_top
+   !!----------------------------------------------------------------------
+   !!   'key_top'                                                TOP models
+   !!----------------------------------------------------------------------
+   !!   trc_rst_opn    : open  restart file
+   !!   trc_rst_read   : read  restart file
+   !!   trc_rst_wri    : write restart file
+   !!----------------------------------------------------------------------
    USE oce_trc
    USE trc
    USE sms
+   USE trcsms_cfc          ! CFC variables
    USE trctrp_lec   
    USE lib_mpp
@@ -25,16 +25,24 @@
    PRIVATE
    
-   !! * Accessibility
-   PUBLIC trc_rst_opn
-   PUBLIC trc_rst_read
-   PUBLIC trc_rst_wri
-   
-   !! * Module variables
+   PUBLIC   trc_rst_opn       ! called by ???
+   PUBLIC   trc_rst_read      ! called by ???
+   PUBLIC   trc_rst_wri       ! called by ???
+   
    LOGICAL, PUBLIC ::   lrst_trc         !: logical to control the trc restart write 
    INTEGER, PUBLIC ::   numrtr, numrtw   !: logical unit for trc restart (read and write)
 
+   REAL(wp) ::  &
+     alkmean = 2426. ,  & ! mean value of alkalinity ( Glodap ; for Goyet 2391. )
+     po4mean = 2.165 ,  & ! mean value of phosphates
+     no3mean = 30.90 ,  & ! mean value of nitrate
+     siomean = 91.51      ! mean value of silicate
 
    !! * Substitutions
-#  include "passivetrc_substitute.h90"
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005) 
+   !! $Id$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
    
 CONTAINS
@@ -52,10 +60,9 @@
       !!----------------------------------------------------------------------
       !
-
       IF( kt == nit000 )  THEN
          lrst_trc = .FALSE.
-#if defined key_off_tra
+# if defined key_off_tra
          nitrst = nitend  ! in online version, already done in rst_opn routine defined in restart.F90 module
-#endif
+# endif
       ENDIF
       
@@ -63,8 +70,6 @@
          ! beware if model runs less than 2*ndttrc time step
          ! beware of the format used to write kt (default is i8.8, that should be large enough)
-         IF( nitrst > 1.0e9 ) THEN   
-            WRITE(clkt,*) nitrst
-         ELSE
-            WRITE(clkt,'(i8.8)') nitrst
+         IF( nitrst > 1.0e9 ) THEN   ;   WRITE(clkt,*       ) nitrst
+         ELSE                        ;   WRITE(clkt,'(i8.8)') nitrst
          ENDIF
          ! create the file
@@ -80,84 +85,49 @@
 
    SUBROUTINE trc_rst_read 
-      !!===========================================================================================
+      !!----------------------------------------------------------------------
+      !!                    ***  trc_rst_opn  ***
       !!
-      !!                       ROUTINE trc_rst_read
-      !!                       *******************
-      !!
-      !!  PURPOSE :
-      !!  ---------
-      !!     READ files for restart for passive tracer
-      !!
-      !!   METHOD :
-      !!   -------
-      !!      READ the previous fields on the FILE nutrst
-      !!      the first record indicates previous characterics
-      !!      after control with the present run, we READ :
-      !!      - prognostic variables on the second and more record
-      !!
-      !!   History:
-      !!   --------
-      !!  original  : 96-11
-      !!  00-05 (A. Estublier) TVD Limiter Scheme key_trc_tvd 
-      !!  00-12 (O. Aumont, E. Kestenare) read restart file for sediments 
-      !!  01-05 (O. Aumont, E. Kestenare) read restart file for calcite and silicate sediments 
-      !!  05-03 (O. Aumont and A. El Moussaoui) F90           
-      !!------------------------------------------------------------------------
-      INTEGER ::  ji, jj, jk, jn  
-      INTEGER ::  iarak0    
-      REAL(wp) :: zkt, zarak0
-      REAL(wp) :: caralk, bicarb, co3
-
-#if defined key_trc_pisces 
-#   if ! defined key_c1d && ( defined key_orca_r4 || defined key_orca_r2 || defined key_orca_r05 || defined key_orca_r025 )
-      REAL(wp) ::  ztrasum
-#   endif
-#endif
-
-      !!---------------------------------------------------------------------
-      !!  OPA.9 03-2005  
-      !!---------------------------------------------------------------------
-      !! 0. initialisations
-      !!------------------
-
-
-      IF( ln_trcadv_cen2 .OR. ln_trcadv_tvd ) THEN
-         iarak0 = 1
-      ELSE
-         iarak0 = 0
-      ENDIF
-
-
-      IF(lwp) WRITE(numout,*) ' '
-      IF(lwp) WRITE(numout,*) ' *** trc_rst beginning of restart for'
-      IF(lwp) WRITE(numout,*) ' passive tracer'
-      IF(lwp) WRITE(numout,*) ' the present run :'
-      IF(lwp) WRITE(numout,*) '   with the time nit000 : ',nit000
-      IF(lwp) THEN
-         IF( iarak0 == 1 ) THEN
-            WRITE(numout,*) '   and before fields for Arakawa sheme '
-         ENDIF
-         WRITE(numout,*) ' '
-      ENDIF
+      !! ** purpose  :   read passive tracer fields in restart files
+      !!----------------------------------------------------------------------
+      INTEGER  ::   jn  
+      INTEGER  ::   iarak0
+      REAL(wp) ::   zkt, zarak0
+# if defined key_pisces 
+      REAL(wp) ::   ztrasum
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   caralk, bicarb, co3
+# endif
+      !!----------------------------------------------------------------------
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) 'trc_rst_read : read the TOP restart file'
+      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~'
+
+      IF( ln_trcadv_cen2 .OR. ln_trcadv_tvd ) THEN   ;   iarak0 = 1
+      ELSE                                           ;   iarak0 = 0
+      ENDIF
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) '   the present run starts at the time step nit000 = ', nit000
+      IF(lwp .AND. iarak0 == 1 )   WRITE(numout,*) '   and needs previous fields for Arakawa sheme ??? '
+
 
       ! Time domain : restart
       ! -------------------------
-
-      IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*) ' *** passive tracer restart option'
       SELECT CASE ( nrsttr )
       CASE ( 0 )
-         IF(lwp) WRITE(numout,*) ' nrsttr = 0 no control of nit000'
+         IF(lwp) WRITE(numout,*) '    nrsttr = 0 no control of nit000'
       CASE ( 1 )
-         IF(lwp) WRITE(numout,*) ' nrsttr = 1 we control the date of nit000'
+         IF(lwp) WRITE(numout,*) '    nrsttr = 1 we control the date of nit000'
       CASE ( 2 )
-         IF(lwp) WRITE(numout,*) ' nrsttr = 2 the date adatrj is read in restart file'
+         IF(lwp) WRITE(numout,*) '    nrsttr = 2 the date adatrj is read in restart file'
       CASE DEFAULT
          IF(lwp) WRITE(numout,*) '  ===>>>> nrsttr not equal 0, 1 or 2 : no control of the date'
-         IF(lwp) WRITE(numout,*) ' =======                   ========='
+         IF(lwp) WRITE(numout,*) '  =======                  ========='
       END SELECT
 
-      CALL iom_open ( 'restart.trc', numrtr, kiolib = jprstlib )
+      CALL iom_open( 'restart.trc', numrtr, kiolib = jprstlib )
 
       CALL iom_get( numrtr, 'kt'   , zkt    )
@@ -166,151 +136,125 @@
       IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*) ' Info on the restart file read : '
-      IF(lwp) WRITE(numout,*) '   time-step           : ', NINT( zkt    )
-      IF(lwp) WRITE(numout,*) '   arakawa option      : ', NINT( zarak0 )
-      IF(lwp) WRITE(numout,*)
-
-
-      !! control of date
-      !! -------------------
-
-      IF( nittrc000 - NINT( zkt ) /= 1 .AND. nrsttr /= 0 )  &
-           & CALL ctl_stop( ' ===>>>> : problem with nit000 for the restart', &
-           & ' verify the restart file or rerun with nrstdt = 0 (namelist)' )
-
-      !! Control of the scheme
-      !! ------------------------
-
-      IF( iarak0 /= NINT( zarak0 ) ) &
-           & CALL ctl_stop( ' ===>>>> : problem with advection scheme', &
-           & ' it must be the same type for both restart and previous run', &
-           & ' centered or euler '  )
-
-
-      !! ... READ prognostic variables and computes diagnostic variable
-      !! ---------------------------------------------------------------
-
+      IF(lwp) WRITE(numout,*) '    time-step           : ', NINT( zkt    )
+      IF(lwp) WRITE(numout,*) '    arakawa option      : ', NINT( zarak0 )
+
+
+      IF( nittrc000 - NINT( zkt ) /= 1 .AND. nrsttr /= 0 )  &      ! control of date
+         &   CALL ctl_stop( ' ===>>>> : problem with nit000 for the restart', &
+         &                  ' verify the restart file or rerun with nrstdt = 0 (namelist)' )
+
+      IF( iarak0 /= NINT( zarak0 ) )   &                           ! Control of the scheme
+         & CALL ctl_stop( ' ===>>>> : problem with advection scheme', &
+         & ' it must be the same type for both restart and previous run', &
+         & ' centered or euler '  )
+
+
+      ! READ prognostic variables and computes diagnostic variable
       DO jn = 1, jptra
-         CALL iom_get( numrtr, jpdom_local, 'TRN'//ctrcnm(jn), trn(:,:,:,jn)   ) 
+         CALL iom_get( numrtr, jpdom_local, 'TRN'//ctrcnm(jn), trn(:,:,:,jn) ) 
+         CALL iom_get( numrtr, jpdom_local, 'TRB'//ctrcnm(jn), trb(:,:,:,jn) ) 
       END DO
-
-      DO jn = 1, jptra
-         CALL iom_get( numrtr, jpdom_local, 'TRB'//ctrcnm(jn), trb(:,:,:,jn)   ) 
-      END DO
-
-#if defined key_trc_lobster1
+# if defined key_lobster
       CALL iom_get( numrtr, jpdom_local, 'SEDB'//ctrcnm(jpdet), sedpocb(:,:) ) 
       CALL iom_get( numrtr, jpdom_local, 'SEDN'//ctrcnm(jpdet), sedpocn(:,:) ) 
-
-#elif defined key_trc_pisces
+# elif defined key_pisces
       CALL iom_get( numrtr, jpdom_local, 'Silicalim', xksi(:,:) ) 
-      xksimax = xksi
-
-#elif defined key_cfc
+      CALL iom_get( numrtr, jpdom_local, 'Silicamax', xksimax(:,:) )
+# elif defined key_cfc
       DO jn = 1, jptra
-         CALL iom_get( numrtr, jpdom_local, 'qint'//ctrcnm(jn),qint(:,:,jn)) 
+         CALL iom_get( numrtr, jpdom_local, 'qint'//ctrcnm(jn), qint(:,:,jn) ) 
+         CALL iom_get( numrtr, jpdom_local, 'qtr'//ctrcnm(jn) , qtr( :,:,jn) ) 
       END DO
-      DO jn = 1, jptra
-         CALL iom_get( numrtr, jpdom_local, 'qtr'//ctrcnm(jn) ,qtr( :,:,jn)) 
-      END DO
-#endif
-
-
-#if defined key_trc_pisces 
-
-#if ! defined key_c1d && ( defined key_orca_r4 || defined key_orca_r2 || defined key_orca_r05 || defined key_orca_r025 ) 
-
-      ztrasum = 0.
-      DO jk = 1, jpk
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               ztrasum = ztrasum + trn(ji,jj,jk,jptal) * tmask(ji,jj,jk) * tmask_i(ji,jj)  &
-#if defined key_off_degrad
-                  &              * facvol(ji,jj,jk)   &
-#endif
-
-                  &              * e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk)
-            END DO
-         END DO
-      END DO
-
-      IF( lk_mpp ) THEN 
-         CALL mpp_sum( ztrasum )     ! sum over the global domain  
-      END IF
-
-      WRITE(0,*) 'TALK moyen ', ztrasum/areatot*1E6
-      ztrasum = ztrasum/areatot*1E6
-      trn(:,:,:,jptal) = trn(:,:,:,jptal)*2391./ztrasum
-
-      ztrasum = 0.
-      DO jk = 1, jpk
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               ztrasum = ztrasum + trn(ji,jj,jk,jppo4) * tmask(ji,jj,jk) * tmask_i(ji,jj)  &
-#if defined key_off_degrad
-                  &              * facvol(ji,jj,jk)   &
-#endif
-
-                  &              * e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk)
-            END DO
-         END DO
-      END DO
-
-      IF( lk_mpp ) THEN 
-         CALL mpp_sum( ztrasum )     ! sum over the global domain  
-      END IF
-
-
-      WRITE(0,*) 'PO4 moyen ', ztrasum/areatot*1E6/122.
-      ztrasum = ztrasum/areatot*1E6/122.
-      trn(:,:,:,jppo4) = trn(:,:,:,jppo4)*2.165/ztrasum
-
-      ztrasum = 0.
-      DO jk = 1, jpk
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               ztrasum = ztrasum + trn(ji,jj,jk,jpno3) * tmask(ji,jj,jk) * tmask_i(ji,jj)  &
-#if defined key_off_degrad
-                  &              * facvol(ji,jj,jk)   &
-#endif
-
-                  &              * e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk)
-            END DO
-         END DO
-      END DO
-
-      IF( lk_mpp ) THEN 
-         CALL mpp_sum( ztrasum )     ! sum over the global domain  
-      END IF
-
-
-      WRITE(0,*) 'NO3 moyen ', ztrasum/areatot*1E6/7.6
-      ztrasum = ztrasum/areatot*1E6/7.6
-      trn(:,:,:,jpno3) = trn(:,:,:,jpno3)*30.9/ztrasum
-
-      ztrasum = 0.
-      DO jk = 1, jpk
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               ztrasum = ztrasum + trn(ji,jj,jk,jpsil) * tmask(ji,jj,jk) * tmask_i(ji,jj)   &
-#if defined key_off_degrad
-                  &              * facvol(ji,jj,jk)   &
-#endif
-
-                  &              * e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk)
-            END DO
-         END DO
-      END DO
-
-      IF( lk_mpp ) THEN 
-         CALL mpp_sum( ztrasum )     ! sum over the global domain  
-      END IF
-
-      WRITE(0,*) 'SiO3 moyen ', ztrasum/areatot*1E6
-      ztrasum = ztrasum/areatot*1E6
-      trn(:,:,:,jpsil) = MIN( 400E-6,trn(:,:,:,jpsil)*91.51/ztrasum) 
-
-#endif
-
-!#if defined key_trc_kriest
+# endif
+
+# if defined key_pisces 
+      !                                                         ! --------------------------- !
+      IF( cp_cfg == "orca" .AND. .NOT. lk_trc_c1d ) THEN      ! ORCA condiguration (not 1D) !
+         !                                                      ! --------------------------- !
+         ! set total alkalinity, phosphate, NO3 & silicate
+         ! total alkalinity
+         ! -----------------------------------------------
+         ztrasum = 0.e0             
+         DO jk = 1, jpk
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  ztrasum = ztrasum + trn(ji,jj,jk,jptal) * tmask(ji,jj,jk) * tmask_i(ji,jj)  &
+#  if defined key_off_degrad
+                     &              * facvol(ji,jj,jk)   &
+#  endif
+                     &              * e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk)
+               END DO
+            END DO
+         END DO
+         IF( lk_mpp )   CALL mpp_sum( ztrasum )     ! sum over the global domain  
+
+
+         ztrasum = ztrasum / areatot * 1.e6
+         IF(lwp) WRITE(numout,*) 'TALK moyen ', ztrasum
+         trn(:,:,:,jptal) = trn(:,:,:,jptal) * alkmean / ztrasum
+
+         ! phosphate
+         ! ---------
+         ztrasum = 0.e0
+         DO jk = 1, jpk
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  ztrasum = ztrasum + trn(ji,jj,jk,jppo4) * tmask(ji,jj,jk) * tmask_i(ji,jj)  &
+#  if defined key_off_degrad
+                     &              * facvol(ji,jj,jk)   &
+#  endif
+                     &              * e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk)
+               END DO
+            END DO
+         END DO
+         IF( lk_mpp )   CALL mpp_sum( ztrasum )     ! sum over the global domain  
+
+         ztrasum = ztrasum / areatot * 1.e6 / 122.
+         IF(lwp) WRITE(numout,*) 'PO4 moyen ', ztrasum 
+         trn(:,:,:,jppo4) = trn(:,:,:,jppo4) * po4mean / ztrasum
+
+         ! NO3
+         ! ---
+         ztrasum = 0.e0
+         DO jk = 1, jpk
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  ztrasum = ztrasum + trn(ji,jj,jk,jpno3) * tmask(ji,jj,jk) * tmask_i(ji,jj)  &
+#  if defined key_off_degrad
+                     &              * facvol(ji,jj,jk)   &
+#  endif
+                     &              * e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk)
+               END DO
+            END DO
+         END DO
+         IF( lk_mpp )   CALL mpp_sum( ztrasum )     ! sum over the global domain  
+
+         ztrasum = ztrasum / areatot * 1.e6 / 7.6
+         IF(lwp) WRITE(numout,*) 'NO3 moyen ', ztrasum 
+         trn(:,:,:,jpno3) = trn(:,:,:,jpno3) * no3mean / ztrasum
+
+         ! Silicate
+         ! --------
+         ztrasum = 0.e0
+         DO jk = 1, jpk
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  ztrasum = ztrasum + trn(ji,jj,jk,jpsil) * tmask(ji,jj,jk) * tmask_i(ji,jj)   &
+#  if defined key_off_degrad
+                     &              * facvol(ji,jj,jk)   &
+#  endif
+                     &              * e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk)
+               END DO
+            END DO
+         END DO
+         IF( lk_mpp )   CALL mpp_sum( ztrasum )     ! sum over the global domain  
+
+         IF(lwp) WRITE(numout,*) 'SiO3 moyen ', ztrasum / areatot * 1.e6
+         ztrasum = ztrasum / areatot * 1.e6
+         trn(:,:,:,jpsil) = MIN( 400.e-6,trn(:,:,:,jpsil) * siomean / ztrasum ) 
+         !
+      ENDIF
+
+!#if defined key_kriest
 !      !! Initialize number of particles from a standart restart file
 !      !! The name of big organic particles jpgoc has been only change
@@ -319,101 +263,45 @@
 !      trn(:,:,:,jpnum) = trn(:,:,:,jppoc) / ( 6. * xkr_massp )
 !#endif
-      !!  Initialization of chemical variables of the carbon cycle
-      !!  --------------------------------------------------------
-      DO jk = 1,jpk
-         DO jj = 1,jpj
+      !!  Set hi (???) from  total alcalinity, borat (???), akb3 (???) and ak23 (???)
+      !!  ---------------------------------------------------------------------
+      DO jk = 1, jpk
+         DO jj = 1, jpj
             DO ji = 1,jpi
-               caralk = trn(ji,jj,jk,jptal)-       &
-                  &        borat(ji,jj,jk)/(1.+1.E-8/(rtrn+akb3(ji,jj,jk)))
-               co3 = (caralk-trn(ji,jj,jk,jpdic))*tmask(ji,jj,jk)   &
-                  &        +(1.-tmask(ji,jj,jk))*.5e-3
-               bicarb = (2.*trn(ji,jj,jk,jpdic)-caralk)
-               hi(ji,jj,jk) = (ak23(ji,jj,jk)*bicarb/co3)     &
-                  &  *tmask(ji,jj,jk)+(1.-tmask(ji,jj,jk))*1.e-9
-            ENDDO
-         ENDDO
-      ENDDO
-#endif
-!CT comment the line below which doesn't ensure 
-!CT restartability of the GYRE_LOBSTER configuration
-!CT      trb(:,:,:,:) = trn(:,:,:,:)
+               caralk = trn(ji,jj,jk,jptal) - borat(ji,jj,jk) / ( 1. + 1.e-8 / ( rtrn + akb3(ji,jj,jk) ) )
+               co3    = ( caralk - trn(ji,jj,jk,jpdic) ) *       tmask(ji,jj,jk)   &
+                  &   +             0.5e-3               * ( 1.- tmask(ji,jj,jk) )
+               bicarb = 2.* trn(ji,jj,jk,jpdic) - caralk
+               hi(ji,jj,jk) = ( ak23(ji,jj,jk) * bicarb / co3 )   *       tmask(ji,jj,jk)   &
+                  &         +             1.0e-9                  * ( 1.- tmask(ji,jj,jk) )
+            END DO
+         END DO
+      END DO
+# endif
 
       CALL iom_close( numrtr )
-
-
+      !
    END SUBROUTINE trc_rst_read
 
-   SUBROUTINE trc_rst_wri(kt)
-      !! ==================================================================================
+
+   SUBROUTINE trc_rst_wri( kt )
+      !!----------------------------------------------------------------------
+      !!                    ***  trc_rst_wri  ***
       !!
-      !!                       ROUTINE trc_rst_wri
-      !!                       ******************
+      !! ** purpose  :   write passive tracer fields in restart files
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt    ! ocean time-step index
       !!
-      !!  PURPOSE :
-      !!  ---------
-      !!     WRITE restart fields in nutwrs
-      !!   METHOD :
-      !!   -------
-      !!
-      !!   nutwrs FILE:
-      !!   each nstock time step , SAVE fields which are necessary for
-      !!   passive tracer restart
-      !!
-      !!
-      !!   INPUT :
-      !!   -----
-      !!      argument
-      !!              kt              : time step
-      !!      COMMON
-      !!            /cottrc/          : passive tracers fields (before,now
-      !!                                  ,after)
-      !!
-      !!   OUTPUT :
-      !!   ------
-      !!      FILE
-      !!           nutwrs          : standard restart fields OUTPUT
-      !!
-      !!   WORKSPACE :
-      !!   ---------
-      !!      ji,jj,jk,jn
-      !!
-      !!   History:
-      !!   --------
-      !!      original : 96-12
-      !!      addition : 99-12 (M.-A. Foujols) NetCDF FORMAT with ioipsl
-      !!      additions : 00-05 (A. Estublier)
-      !!                  TVD Limiter Scheme : key_trc_tvd
-      !!      additions : 01-01 (M.A Foujols, E. Kestenare) bug fix: restclo
-      !!      additions : 01-01 (O. Aumont, E. Kestenare)
-      !!                  write restart file for sediments
-      !!      additions : 01-05 (O. Aumont, E. Kestenare)
-      !!                  write restart file for calcite and silicate sediments
-      !!   05-03 (O. Aumont and A. El Moussaoui) F90
-      !!========================================================================================!
-
-      !! * Arguments
-      !! -----------
-      INTEGER, INTENT( in ) :: kt
-
-      !! * local declarations
-      !! ====================
-
-      INTEGER  :: ji,jj,jk,jn
+      INTEGER  :: ji, jj, jk, jn
       REAL(wp) :: zdiag_var, zdiag_varmin, zdiag_varmax, zdiag_tot
       REAL(wp) :: zder
-
-
-      !! 1. OUTPUT of restart fields (nutwrs)
-      !! ---------------------------
-
-      IF( MOD(kt,nstock) == 0 .OR. kt == nitend ) THEN
-
-         !! 0. initialisations
-         !! ------------------
-
-         IF(lwp) WRITE(numout,*) ' '
-         IF(lwp) WRITE(numout,*) 'trc_wri : write the passive tracer restart file in NetCDF format ',   &
-            'at it= ',kt,' date= ',ndastp
-         IF(lwp) WRITE(numout,*) '~~~~~~~~~'
+      !!----------------------------------------------------------------------
+
+      IF( MOD( kt, nstock ) == 0 .OR. kt == nitend ) THEN
+
+         ! 0. initialisations
+         ! ------------------
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'trc_wri : write the TOP restart file (NetCDF) at it= ', kt, ' date= ', ndastp
+         IF(lwp) WRITE(numout,*) '~~~~~~~'
 
 
@@ -429,95 +317,81 @@
          ! prognostic variables
          ! --------------------
-
-         DO jn=1,jptra
+         DO jn = 1, jptra
             CALL iom_rstput( kt, nitrst, numrtw, 'TRN'//ctrcnm(jn), trn(:,:,:,jn) )
-         ENDDO
-
-         DO jn=1,jptra
             CALL iom_rstput( kt, nitrst, numrtw, 'TRB'//ctrcnm(jn), trb(:,:,:,jn) )
          END DO
 
-#if defined key_trc_lobster1
+#if defined key_lobster
          CALL iom_rstput( kt, nitrst, numrtw, 'SEDB'//ctrcnm(jpdet), sedpocb(:,:) )
          CALL iom_rstput( kt, nitrst, numrtw, 'SEDN'//ctrcnm(jpdet), sedpocn(:,:) )
-#elif defined key_trc_pisces
+#elif defined key_pisces
          CALL iom_rstput( kt, nitrst, numrtw, 'Silicalim', xksi(:,:) )
+         CALL iom_rstput( kt, nitrst, numrtw, 'Silicamax', xksimax(:,:) )
 
 #elif defined key_cfc
-         DO jn=1,jptra
+         DO jn = 1, jptra
             CALL iom_rstput( kt, nitrst, numrtw, 'qint'//ctrcnm(jn), qint(:,:,jn) )
-         END DO
-         DO jn=1,jptra
-            CALL iom_rstput( kt, nitrst, numrtw, 'qtr'//ctrcnm(jn) , qtr( :,:,jn) )
+            CALL iom_rstput( kt, nitrst, numrtw, 'qtr'//ctrcnm(jn) , qtr (:,:,jn) )
          END DO
 #endif
 
-         IF (lwp) WRITE(numout,*) '----TRACER STAT----'
-
-         zdiag_tot=0.
-         DO jn=1,jptra
-            zdiag_var=0.
-            zdiag_varmin=0.
-            zdiag_varmax=0.
-
-            DO ji=1, jpi
-               DO jj=1, jpj
-                  DO jk=1,jpk
-                     zdiag_var=zdiag_var+trn(ji,jj,jk,jn)*tmask(ji,jj,jk)*tmask_i(ji,jj)  &
+         IF(lwp) WRITE(numout,*) '----TRACER STAT----'
+
+         zdiag_tot = 0.e0
+         DO jn = 1, jptra
+            zdiag_var    = 0.e0
+            zdiag_varmin = 0.e0
+            zdiag_varmax = 0.e0
+            DO ji = 1, jpi
+               DO jj = 1, jpj
+                  DO jk = 1,jpk
+                     zdiag_var = zdiag_var + trn(ji,jj,jk,jn) * tmask(ji,jj,jk) * tmask_i(ji,jj)   &
 #if defined key_off_degrad
                         &   * facvol(ji,jj,jk)   &
 #endif
                         &   * e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk)
-
                   END DO
                END DO
             END DO
 
-            zdiag_varmin=MINVAL(trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)))
-            zdiag_varmax=MAXVAL(trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)))
+            zdiag_varmin = MINVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) )
+            zdiag_varmax = MAXVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) )
 
             IF( lk_mpp ) THEN
-               CALL mpp_min(zdiag_varmin)      ! min over the global domain
-               CALL mpp_max(zdiag_varmax)      ! max over the global domain
-               CALL mpp_sum(zdiag_var)         ! sum over the global domain
+               CALL mpp_min( zdiag_varmin )      ! min over the global domain
+               CALL mpp_max( zdiag_varmax )      ! max over the global domain
+               CALL mpp_sum( zdiag_var    )      ! sum over the global domain
             END IF
 
-            zdiag_tot=zdiag_tot+zdiag_var
-            zdiag_var=zdiag_var/areatot
-
-            IF (lwp) WRITE(numout,*) 'MEAN NO ',jn,ctrcnm(jn),' =',zdiag_var,'MIN= '  &
-               ,zdiag_varmin,'MAX= ',zdiag_varmax
-
-         END DO
-
-         zdiag_tot=zdiag_tot
-         zder=((zdiag_tot-trai)/trai)*100._wp
-         IF (lwp) WRITE(numout,*) 'Integral of all tracers over the full domain  =',zdiag_tot
-         IF (lwp) WRITE(numout,*) 'Drift of the sum of all tracers =',zder, '%'
+            zdiag_tot = zdiag_tot + zdiag_var
+            zdiag_var = zdiag_var / areatot
+
+            IF(lwp) WRITE(numout,*) '   MEAN NO ', jn, ctrcnm(jn), ' = ', zdiag_var,   &
+               &                    ' MIN = ', zdiag_varmin, ' MAX = ', zdiag_varmax
+         END DO
+
+         zder = ( ( zdiag_tot - trai ) / ( trai + 1.e-12 )  ) * 100._wp
+         IF(lwp) WRITE(numout,*) '   Integral of all tracers over the full domain  = ', zdiag_tot
+         IF(lwp) WRITE(numout,*) '   Drift of the sum of all tracers =', zder, ' %'
 
          CALL iom_close(numrtw)
-
-      ENDIF
-
+         !
+      ENDIF
+      !
    END SUBROUTINE trc_rst_wri
 
-
 #else
-   !!======================================================================
-   !!  Empty module : No passive tracer
-   !!======================================================================
+   !!----------------------------------------------------------------------
+   !!  Dummy module :                                     No passive tracer
+   !!----------------------------------------------------------------------
 CONTAINS
-
-   SUBROUTINE trc_rst_read
-      !! no passive tracers
+   SUBROUTINE trc_rst_read                      ! Empty routines
    END SUBROUTINE trc_rst_read
-
-   SUBROUTINE trc_rst_wri(kt)
-      !! no passive tracers
+   SUBROUTINE trc_rst_wri( kt )
       INTEGER, INTENT ( in ) :: kt
       WRITE(*,*) 'trc_rst_wri: You should not have seen this print! error?', kt
-   END SUBROUTINE trc_rst_wri
-   
+   END SUBROUTINE trc_rst_wri   
 #endif
-   
+
+   !!======================================================================
 END MODULE trcrst
Index: trunk/NEMO/TOP_SRC/trcsms.F90
===================================================================
--- trunk/NEMO/TOP_SRC/trcsms.F90	(revision 944)
+++ trunk/NEMO/TOP_SRC/trcsms.F90	(revision 945)
@@ -1,172 +1,76 @@
 MODULE trcsms
-   !!===========================================================================================
-   !!
-   !!                       *** MODULE trcsms ***
-   !!
-   !!  Time  loop of opa for passive tracer
-   !!
-   !!===========================================================================================
-   !!  TOP 1.0,  LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+   !!======================================================================
+   !!                         ***  MODULE trcsms  ***
+   !! TOP :   Time loop of passive tracers sms
+   !!======================================================================
+   !! History :   1.0  !  2005-03 (O. Aumont, A. El Moussaoui) F90
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  revised architecture
    !!----------------------------------------------------------------------
-#if defined key_passivetrc   
-   !! * Modules used
-   !! ==============
-   USE oce_trc
-   USE trc
-   USE trcfreons
-   USE prtctl_trc          ! Print control for debbuging
+#if defined key_top
+   !!----------------------------------------------------------------------
+   !!   'key_top'                                                TOP models
+   !!----------------------------------------------------------------------
+   !!   trc_sms        :  Time loop of passive tracers sms
+   !!----------------------------------------------------------------------
+   USE oce_trc            !
+   USE trc                !
+   USE trcsms_lobster     ! LOBSTER bio-model
+   USE trcsms_pisces      ! PISCES biogeo-model
+   USE trcsms_cfc         ! CFC 11 & 12 
+   USE trcsms_my_trc      ! MY_TRC  tracers
+   USE prtctl_trc         ! Print control for debbuging
 
    IMPLICIT NONE
    PRIVATE
 
-   !! * Accessibility
-   PUBLIC trc_sms
+   PUBLIC   trc_sms    ! called in trcstp.F90
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
 
 CONTAINS
 
    SUBROUTINE trc_sms( kt )
-      !!===========================================================================================
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE ini_trc  ***
       !!
-      !!                       ROUTINE trcsms
-      !!                     *****************
+      !! ** Purpose :   Managment of the time loop of passive tracers sms 
       !!
-      !!  PURPOSE :
-      !!  ---------
-      !!          time loop of opa for passive tracer
+      !! ** Method  : -  call the main routine of of each defined tracer model
+      !! -------------------------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
       !!
-      !!   METHOD :
-      !!   -------
-      !!      compute the well/spring evolution
-      !!
-      !!   INPUT :
-      !!   -----
-      !!      argument
-      !!              ktask           : task identificator
-      !!              kt              : time step
-      !!      COMMON
-      !!            all the COMMON defined in opa
-      !!
-      !!
-      !!   OUTPUT :			: no
-      !!   ------
-      !!
-      !!   WORKSPACE :
-      !!   ---------
-      !!
-      !!   EXTERNAL :
-      !!   --------
-      !!      trcbio, trcsed, trcopt for NPZD or LOBSTER1 models
-      !!
-      !!      h3cprg for HAMOC3 and P3ZD models
-      !!
-      !!
-      !!   History:
-      !!   --------
-      !!      original  : 96-11
-      !!      additions : 99-07 (M. Levy)
-      !!                  04-00 (O. Aumont, M.A. Foujols) HAMOCC3 and P3ZD
-      !!                  12-00 (O. Aumont, E. Kestenare) add trcexp for instantaneous export 
-      !!   05-03 (O. Aumont and A. El Moussaoui) F90
-      !! -------------------------------------------------------------------------------------
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
 
-      !! * Arguments
-      !! -----------
-      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
+      IF ( MOD(kt,ndttrc) /= 0) RETURN      ! this ROUTINE is called only every ndttrc time step
 
-      !! * Local variables
-      !! -----------------
+      IF( lk_lobster )   CALL trc_sms_lobster( kt )    ! main program of LOBSTER
+      IF( lk_pisces  )   CALL trc_sms_pisces ( kt )    ! main program of PISCES 
+      IF( lk_cfc     )   CALL trc_sms_cfc    ( kt )    ! surface fluxes of CFC
+      IF( lk_my_trc  )   CALL trc_sms_my_trc ( kt )    ! MY_TRC  tracers
 
-      CHARACTER (len=25) :: charout
-
-      !! this ROUTINE is called only every ndttrc time step
-      !! --------------------------------------------------
-
-      IF ( MOD(kt,ndttrc) /= 0) RETURN
-
-      !! this first routines are parallelized on vertical slab
-      !! ------------------------------------------------------
-
-#if defined key_trc_lobster1
-
-      !! tracers: optical model
-      !! ----------------------
-
-      CALL trcopt( kt)
-
-      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
-         WRITE(charout, FMT="('OPT')")
-         CALL prt_ctl_trc_info(charout)
-         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      IF(ln_ctl) THEN      ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('sms ')")
+         CALL prt_ctl_trc_info( charout )
+         CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm )
       ENDIF
-
-      !! tracers: biological model
-      !! -------------------------
-
-      CALL trcbio( kt)
-
-      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
-         WRITE(charout, FMT="('BIO')")
-         CALL prt_ctl_trc_info(charout)
-         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
-      ENDIF
-
-      !! tracers: sedimentation model
-      !! ----------------------------
-
-      CALL trcsed(kt)
-      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
-         WRITE(charout, FMT="('SED')")
-         CALL prt_ctl_trc_info(charout)
-         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
-      ENDIF
- 
-      CALL trcexp(kt)
-
-      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
-         WRITE(charout, FMT="('EXP')")
-         CALL prt_ctl_trc_info(charout)
-         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
-      ENDIF
-
-#elif defined key_trc_pisces
-
-      !! p4zprg: main PROGRAM for PISCES 
-      !! -------------------------------
-      CALL p4zprg(kt)
-
-      !! SMS to DO
-
-#elif defined key_cfc
-
-      !! CFC's code taken from K. Rodgers
-
-      !! This part is still experimental
-      !! -------------------------------
-
-      CALL trc_freons(kt)
-
-#endif
-
-
-
+      !
    END SUBROUTINE trc_sms
 
 #else
    !!======================================================================
-   !!  Empty module : No passive tracer
+   !!  Dummy module :                                     No passive tracer
    !!======================================================================
 CONTAINS
-
-   SUBROUTINE trc_sms( kt )
-
-      ! no passive tracers
+   SUBROUTINE trc_sms( kt )                   ! Empty routine
       INTEGER, INTENT( in ) ::   kt
       WRITE(*,*) 'trc_sms: You should not have seen this print! error?', kt
    END SUBROUTINE trc_sms
-
 #endif 
 
-
+   !!======================================================================
 END MODULE  trcsms
