Index: /branches/CMIP5_IPSL/NEMO/OFF_SRC/IOM/iom.F90
===================================================================
--- /branches/CMIP5_IPSL/NEMO/OFF_SRC/IOM/iom.F90	(revision 1829)
+++ /branches/CMIP5_IPSL/NEMO/OFF_SRC/IOM/iom.F90	(revision 1830)
@@ -986,5 +986,5 @@
       !!
       !!----------------------------------------------------------------------
-      CHARACTER(len=6),DIMENSION( 8) ::   clsuff                   ! suffix name
+      CHARACTER(len=6),DIMENSION( 9) ::   clsuff                   ! suffix name
       CHARACTER(len=1),DIMENSION( 3) ::   clgrd                    ! suffix name
       CHARACTER(len=50)              ::   clname                   ! file name
@@ -1013,5 +1013,5 @@
       
       ! output file names (attribut: name)
-      clsuff(:) = (/ 'grid_T', 'grid_U', 'grid_V', 'grid_W', 'icemod', 'ptrc_T', 'diad_T', 'scalar' /)      
+      clsuff(:) = (/ 'grid_T', 'grid_U', 'grid_V', 'grid_W', 'icemod', 'ptrc_T', 'diad_T', 'dbio_T', 'scalar' /)      
       DO jg = 1, SIZE(clsuff)                                                                  ! grid type
          DO jh = 1, 12                                                                         ! 1, 2, 3, 4, 6, 12 hours
Index: /branches/CMIP5_IPSL/NEMO/OPA_SRC/IOM/iom.F90
===================================================================
--- /branches/CMIP5_IPSL/NEMO/OPA_SRC/IOM/iom.F90	(revision 1829)
+++ /branches/CMIP5_IPSL/NEMO/OPA_SRC/IOM/iom.F90	(revision 1830)
@@ -987,5 +987,5 @@
       !!
       !!----------------------------------------------------------------------
-      CHARACTER(len=6),DIMENSION( 8) ::   clsuff                   ! suffix name
+      CHARACTER(len=6),DIMENSION( 9) ::   clsuff                   ! suffix name
       CHARACTER(len=1),DIMENSION( 3) ::   clgrd                    ! suffix name
       CHARACTER(len=50)              ::   clname                   ! file name
@@ -1015,5 +1015,5 @@
       
       ! output file names (attribut: name)
-      clsuff(:) = (/ 'grid_T', 'grid_U', 'grid_V', 'grid_W', 'icemod', 'ptrc_T', 'diad_T', 'scalar' /)      
+      clsuff(:) = (/ 'grid_T', 'grid_U', 'grid_V', 'grid_W', 'icemod', 'ptrc_T', 'diad_T', 'dbio_T', 'scalar' /)      
       DO jg = 1, SIZE(clsuff)                                                                  ! grid type
          DO jh = 1, 12                                                                         ! 1, 2, 3, 4, 6, 12 hours
Index: /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zflx.F90
===================================================================
--- /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zflx.F90	(revision 1829)
+++ /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zflx.F90	(revision 1830)
@@ -204,12 +204,19 @@
           CALL mpp_sum( t_oce_co2_flx )   ! sum over the global domain
         ENDIF
+        ! Conversion in GtC/yr ; negative for outgoing from ocean
+        t_oce_co2_flx = (-1.) * t_oce_co2_flx  * 12. / 1.e15
+        !
         WRITE(numout,*) ' Atmospheric pCO2    :'
         WRITE(numout,*) '-------------------- : ',kt,'  ',t_atm_co2_flx
         WRITE(numout,*) '(ppm)'
-        WRITE(numout,*) 'Total Flux of Carbon :'
-        WRITE(numout,*) '-------------------- : ',t_oce_co2_flx * 12. / 1e15
-        WRITE(numout,*) '(GtC/an)'
+        WRITE(numout,*) 'Total Flux of Carbon out of the ocean :'
+        WRITE(numout,*) '-------------------- : ',t_oce_co2_flx
+        WRITE(numout,*) '(GtC/yr)'
         t_atm_co2_flx = 0.
         t_oce_co2_flx = 0.
+# if defined key_iomput
+        CALL iom_put( "tatpco2" , t_atm_co2_flx  )
+        CALL iom_put( "tco2flx" , t_oce_co2_flx  )
+#endif
       ENDIF
 #endif
Index: /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zlys.F90
===================================================================
--- /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zlys.F90	(revision 1829)
+++ /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zlys.F90	(revision 1830)
@@ -67,5 +67,5 @@
 #if defined key_trc_dia3d && defined key_iomput
       REAL(wp) ::   zrfact2
-      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zcaldiss, zw3d
+      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zcaldiss
 #endif
       CHARACTER (len=25) :: charout
@@ -94,4 +94,7 @@
                   ! SET DUMMY VARIABLE FOR TOTAL BORATE
                   zbot  = borat(ji,jj,jk)
+
+                  ! SET DUMMY VARIABLE FOR TOTAL BORATE
+                  zbot  = borat(ji,jj,jk)
                   zfact = rhop (ji,jj,jk) / 1000. + rtrn
 
@@ -171,12 +174,11 @@
 #  else
       zrfact2 = 1.e3 * rfact2r
-      zw3d(:,:,:) = hi  (:,:,:)                    * tmask(:,:,:)
-      CALL iom_put( "PH", zw3d )
-      zw3d(:,:,:) = zco3(:,:,:)                    * tmask(:,:,:)
-      CALL iom_put( "CO3", zw3d )
-      zw3d(:,:,:) = aksp(:,:,:) / calcon           * tmask(:,:,:)
-      CALL iom_put( "CO3sat", zw3d )
-      zw3d(:,:,:) = zcaldiss(:,:,:) * zrfact2 * tmask(:,:,:)
-      CALL iom_put( "Dcal", zw3d )
+      CALL iom_put( "PH"    , hi      (:,:,:)           * tmask(:,:,:) )
+      CALL iom_put( "CO3"   , zco3    (:,:,:)           * tmask(:,:,:) )
+      CALL iom_put( "CO3sat", aksp    (:,:,:) / calcon  * tmask(:,:,:) )
+      CALL iom_put( "DCAL"  , zcaldiss(:,:,:) * zrfact2 * tmask(:,:,:) )
+#if defined key_diaar5
+      CALL iom_put( "PHSFC" , hi     (:,:,1)           * tmask(:,:,1) )
+#endif
 #  endif
 # endif
@@ -232,5 +234,4 @@
    END SUBROUTINE p4z_lys
 #endif 
-
    !!======================================================================
 END MODULE  p4zlys
Index: /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zmeso.F90
===================================================================
--- /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zmeso.F90	(revision 1829)
+++ /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zmeso.F90	(revision 1830)
@@ -76,5 +76,7 @@
 #if defined key_trc_diaadd && defined key_trc_dia3d && defined key_iomput
       REAL(wp) :: zrfact2
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zw3d
+#if defined key_diaar5
+      REAL(wp), DIMENSION(jpi,jpj) ::   zpcalint
+#endif
 #endif
 
@@ -203,4 +205,10 @@
       END DO
       
+#if defined key_trc_dia3d
+      ! Total grazing ( grazing by microzoo is already computed in p4zmicro ) 
+      grazing(:,:,:) = grazing(:,:,:) + (  zgrazd  (:,:,:) + zgrazz  (:,:,:) + zgrazn(:,:,:) &
+                     &                   + zgrazpoc(:,:,:) + zgrazffe(:,:,:)  )
+#endif
+
 
       DO jk = 1,jpkm1
@@ -311,10 +319,20 @@
 #if defined key_trc_diaadd && defined key_trc_dia3d && defined key_iomput
       zrfact2 = 1.e3 * rfact2r
-      zw3d(:,:,:) = (     zgrazd(:,:,:) +   zgrazz(:,:,:) + zgrazn(:,:,:) &
-                    & + zgrazpoc(:,:,:) + zgrazffe(:,:,:)                 ) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "Graz2" , zw3d )
-
-      zw3d(:,:,:) = prodcal(:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "Pcal"  , zw3d )
+      ! Total grazing of phyto by zoo
+      grazing(:,:,:) = grazing(:,:,:) * zrfact2 * tmask(:,:,:)
+      ! Calcite production
+      prodcal(:,:,:) = prodcal(:,:,:) * zrfact2 * tmask(:,:,:)
+      IF( jnt == nrdttrc ) then 
+         CALL iom_put( "GRAZ" , grazing  )  ! Total grazing of phyto by zooplankton
+         CALL iom_put( "PCAL" , prodcal  )  ! Calcite production
+      ENDIF
+#if defined key_diaar5
+      ! Vertically integrated calcite production
+      zpcalint(:,:) = 0.
+      DO jk = 1, jpkm1
+         zpcalint(:,:) = zpcalint(:,:) + prodcal(:,:,jk) * fse3t(:,:,jk)
+      ENDDO
+      IF( jnt == nrdttrc ) CALL iom_put( "INTPCAL", zpcalint )  ! Vertically integrated calcite production
+#endif
 #endif
 
Index: /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zmicro.F90
===================================================================
--- /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zmicro.F90	(revision 1829)
+++ /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zmicro.F90	(revision 1830)
@@ -70,8 +70,4 @@
       REAL(wp), DIMENSION(jpi,jpj,jpk) :: zgrazmf, zgrazsf, zgrazpf
       CHARACTER (len=25) :: charout
-#if defined key_trc_diaadd && defined key_trc_dia3d && defined key_iomput
-      REAL(wp) :: zrfact2
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zw3d
-#endif
 
       !!---------------------------------------------------------------------
@@ -88,4 +84,7 @@
       zgrazpf(:,:,:) = 0.
 
+#if defined key_trc_dia3d
+      grazing(:,:,:) = 0.  !: Initialisation of  grazing
+#endif
 
       zstep = rfact2 / rday      ! Time step duration for biology
@@ -156,4 +155,8 @@
       END DO
       
+#if defined key_trc_dia3d
+      ! Grazing by microzooplankton
+      grazing(:,:,:) = grazing(:,:,:) + zgrazp(:,:,:) + zgrazm(:,:,:) + zgrazsd(:,:,:) 
+#endif
 
       DO jk = 1,jpkm1
@@ -231,15 +234,9 @@
       END DO
       !
-#if defined key_trc_diaadd && defined key_trc_dia3d && defined key_iomput
-      zrfact2 = 1.e3 * rfact2r
-      zw3d(:,:,:) = ( zgrazp(:,:,:) + zgrazm(:,:,:) + zgrazsd(:,:,:) ) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "Graz" , zw3d )
-#endif
-
-       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
          WRITE(charout, FMT="('micro')")
          CALL prt_ctl_trc_info(charout)
          CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
-       ENDIF
+      ENDIF
 
    END SUBROUTINE p4z_micro
Index: /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zopt.F90
===================================================================
--- /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zopt.F90	(revision 1829)
+++ /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zopt.F90	(revision 1830)
@@ -61,8 +61,4 @@
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zekg, zekr, zekb
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ze1 , ze2 , ze3, ze0
-#if defined key_trc_diaadd && defined key_iomput
-     REAL(wp), DIMENSION(jpi,jpj)      ::   zw2d
-     REAL(wp), DIMENSION(jpi,jpj,jpk)  ::   zw3d
-#endif
       !!---------------------------------------------------------------------
 
@@ -238,8 +234,8 @@
 # else
       ! write diagnostics 
-      zw2d(:,:  ) =  heup(:,:  ) * tmask(:,:,1)
-      zw3d(:,:,:) =  etot(:,:,:) * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "Heup", zw2d )               
-      IF( jnt == nrdttrc ) CALL iom_put( "PAR" , zw3d )
+      IF( jnt == nrdttrc ) then 
+         CALL iom_put( "Heup", heup(:,:  ) * tmask(:,:,1) )  ! euphotic layer deptht
+         CALL iom_put( "PAR" , etot(:,:,:) * tmask(:,:,:) )  ! Photosynthetically Available Radiation
+      ENDIF
 # endif
 #endif
Index: /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zprod.F90
===================================================================
--- /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zprod.F90	(revision 1829)
+++ /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zprod.F90	(revision 1830)
@@ -81,6 +81,6 @@
 #if defined key_trc_diaadd && defined key_trc_dia3d
       REAL(wp) ::   zrfact2
-#if  defined key_iomput
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zw3d
+#if defined key_iomput && defined key_diaar5
+      REAL(wp), DIMENSION(jpi,jpj) ::   zw2d
 #endif
 #endif
@@ -352,12 +352,11 @@
         WRITE(numout,*) 'Total PP :'
         WRITE(numout,*) '-------------------- : ',tpp * 12. / 1.E12
-        WRITE(numout,*) '(GtC/an)'
+        WRITE(numout,*) '(GtC/yr)'
         tpp = 0.
       ENDIF
 
-#if defined key_trc_diaadd && defined key_trc_dia3d
+#if defined key_trc_diaadd && defined key_trc_dia3d && ! defined key_iomput
+      !   Supplementary diagnostics
       zrfact2 = 1.e3 * rfact2r
-      !   Supplementary diagnostics
-#  if ! defined key_iomput
       trc3d(:,:,:,jp_pcs0_3d + 4)  = zprorca (:,:,:) * zrfact2 * tmask(:,:,:)
       trc3d(:,:,:,jp_pcs0_3d + 5)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:)
@@ -366,24 +365,63 @@
       trc3d(:,:,:,jp_pcs0_3d + 8)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:)
       trc3d(:,:,:,jp_pcs0_3d + 9)  = zprofed (:,:,:) * zrfact2 * tmask(:,:,:)
-#if ! defined key_kriest
+#  if ! defined key_kriest
       trc3d(:,:,:,jp_pcs0_3d + 10) = zprofen (:,:,:) * zrfact2 * tmask(:,:,:)
-#endif
-
-# else
-      zw3d(:,:,:) = zprorca (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PPPHY" , zw3d )
-      zw3d(:,:,:) = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PPPHY2", zw3d )
-      zw3d(:,:,:) = zpronew (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PPNEWN" , zw3d )
-      zw3d(:,:,:) = zpronewd(:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PPNEWD", zw3d )
-      zw3d(:,:,:) = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PBSi"  , zw3d )
-      zw3d(:,:,:) = zprofed (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PFeD"  , zw3d )
-      zw3d(:,:,:) = zprofen (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PFeN"  , zw3d )
-# endif
+#  endif
+#endif
+
+#if defined key_trc_diaadd && defined key_trc_dia3d && defined key_iomput
+      zrfact2 = 1.e3 * rfact2r
+      IF ( jnt == nrdttrc ) then
+         CALL iom_put( "PPPHY" , zprorca (:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by nanophyto
+         CALL iom_put( "PPPHY2", zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by diatom
+         CALL iom_put( "PPNEWN", zpronew (:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by nanophyto
+         CALL iom_put( "PPNEWD", zpronewd(:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by diatom
+         CALL iom_put( "PBSi"  , zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:) ) ! biogenic silica production
+         CALL iom_put( "PFeD"  , zprofed (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by diatom
+         CALL iom_put( "PFeN"  , zprofen (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by nanophyto
+      ENDIF
+#if  defined key_diaar5
+      IF ( jnt == nrdttrc ) then
+         CALL iom_put( "TPP"  , ( zprorca(:,:,:) + zprorcad(:,:,:) ) * zrfact2 * tmask(:,:,:) )  ! total primary production 
+         CALL iom_put( "TPNEW", ( zpronew(:,:,:) + zpronewd(:,:,:) ) * zrfact2 * tmask(:,:,:) )  ! total new primary production  
+         CALL iom_put( "TPBFE", ( zprofen(:,:,:) + zprofed (:,:,:) ) * zrfact2 * tmask(:,:,:) )  ! total biogenic iron production 
+      ENDIF
+      ! primary production by nanophyto ( vertically integrated )
+      zw2d(:,:) = 0.
+      DO jk = 1, jpkm1
+         zw2d(:,:) = zw2d(:,:) + zprorca (:,:,jk) * fse3t(:,:,jk) * zrfact2 * tmask(:,:,jk)
+      ENDDO
+      IF ( jnt == nrdttrc ) CALL iom_put( "INTPPPHY" , zw2d ) 
+      ! primary production by diatom ( vertically integrated )
+      zw2d(:,:) = 0.
+      DO jk = 1, jpkm1
+         zw2d(:,:) = zw2d(:,:) + zprorcad(:,:,jk) * fse3t(:,:,jk) * zrfact2 * tmask(:,:,jk)
+      ENDDO
+      IF ( jnt == nrdttrc ) CALL iom_put( "INTPPPHY2" , zw2d ) 
+      ! total primary production  ( vertically integrated )
+      zw2d(:,:) = 0.
+      DO jk = 1, jpkm1
+         zw2d(:,:) = zw2d(:,:) + ( zprorca (:,:,jk) + zprorcad(:,:,jk) ) * fse3t(:,:,jk) * zrfact2 * tmask(:,:,jk)
+      ENDDO
+      IF ( jnt == nrdttrc ) CALL iom_put( "INTPP" , zw2d ) 
+      ! total new primary production  ( vertically integrated )
+      zw2d(:,:) = 0.
+      DO jk = 1, jpkm1
+         zw2d(:,:) = zw2d(:,:) + ( zpronew (:,:,jk) + zpronewd(:,:,jk) ) * fse3t(:,:,jk) * zrfact2 * tmask(:,:,jk)
+      ENDDO
+      IF ( jnt == nrdttrc ) CALL iom_put( "INTPNEW" , zw2d ) 
+      ! total biogenic iron production  ( vertically integrated )
+      zw2d(:,:) = 0.
+      DO jk = 1, jpkm1
+         zw2d(:,:) = zw2d(:,:) + ( zprofen (:,:,jk) + zprofed(:,:,jk) ) * fse3t(:,:,jk) * zrfact2 * tmask(:,:,jk)
+      ENDDO
+      IF ( jnt == nrdttrc ) CALL iom_put( "INTPBFE" , zw2d ) 
+      ! biogenic silica production  ( vertically integrated )
+      zw2d(:,:) = 0.
+      DO jk = 1, jpkm1
+         zw2d(:,:) = zw2d(:,:) + zprorcad(:,:,jk) * zysopt(:,:,jk) * fse3t(:,:,jk) * zrfact2 * tmask(:,:,jk)
+      ENDDO
+      IF ( jnt == nrdttrc ) CALL iom_put( "INTPBSI" , zw2d ) 
+#endif
 #endif
 
Index: /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zsed.F90
===================================================================
--- /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zsed.F90	(revision 1829)
+++ /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zsed.F90	(revision 1830)
@@ -96,5 +96,4 @@
       REAL(wp) :: zrfact2
 # if defined key_iomput
-     REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zw3d 
      REAL(wp), DIMENSION(jpi,jpj)    ::    zw2d 
 # endif
@@ -332,12 +331,19 @@
       trc2d(:,:,jp_pcs0_2d + 12) = znitrpot(:,:,1) * 1.e-7 * zrfact2 * fse3t(:,:,1) * tmask(:,:,1)
 # else
-      ! write diagnostics
-      zw2d(:,:)   =  ( zirondep(:,:,1) + ironsed(:,:,1) * rfact2 ) &
-      &            * zrfact2 * fse3t(:,:,1) * tmask(:,:,1)     
+      ! surface downward net flux of iron
+      zw2d(:,:)   =  ( zirondep(:,:,1) + ironsed(:,:,1) * rfact2 ) * zrfact2 * fse3t(:,:,1) * tmask(:,:,1) 
       IF( jnt == nrdttrc ) CALL iom_put( "Irondep", zw2d )
-      zw3d(:,:,:) = znitrpot(:,:,:) * 1.e-7 * zrfact2  * fse3t(:,:,:) * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "Nfix", zw3d  ) 
-# endif
-
+      ! nitrogen fixation at surface
+      zw2d(:,:)   =  znitrpot(:,:,1) * 1.e-7 * zrfact2  * fse3t(:,:,1) * tmask(:,:,1)
+      IF( jnt == nrdttrc ) CALL iom_put( "Nfix" , zw2d )
+#if defined key_diaar5
+      ! nitrogen fixation rate in ocean ( vertically integrated )
+      zw2d(:,:) = 0.
+      DO jk = 1, jpkm1
+         zw2d(:,:) = zw2d(:,:) + znitrpot(:,:,jk) * 1.e-7 * zrfact2  * fse3t(:,:,jk) * tmask(:,:,jk)
+      ENDDO
+      IF( jnt == nrdttrc ) CALL iom_put( "INTNFIX" , zw2d )
+# endif
+# endif
 # endif
       !
Index: /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zsink.F90
===================================================================
--- /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zsink.F90	(revision 1829)
+++ /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zsink.F90	(revision 1830)
@@ -99,8 +99,5 @@
 #if defined key_trc_diaadd
       REAL(wp) :: zrfact2
-      INTEGER  :: iksed1
-#if defined key_iomput
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zw3d
-#endif
+      INTEGER  :: ik1
 #endif
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   znum3d
@@ -286,11 +283,11 @@
 #if defined key_trc_diaadd
       zrfact2 = 1.e3 * rfact2r
-      iksed1 = iksed + 1
+      ik1 = iksed + 1
 #  if ! defined key_iomput
-      trc2d(:,:  ,jp_pcs0_2d + 4)  = sinking (:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:  ,jp_pcs0_2d + 5)  = sinking2(:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:  ,jp_pcs0_2d + 6)  = sinkfer (:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:  ,jp_pcs0_2d + 7)  = sinksil (:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:  ,jp_pcs0_2d + 8)  = sinkcal (:,:,iksed1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:  ,jp_pcs0_2d + 4)  = sinking (:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:  ,jp_pcs0_2d + 5)  = sinking2(:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:  ,jp_pcs0_2d + 6)  = sinkfer (:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:  ,jp_pcs0_2d + 7)  = sinksil (:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:  ,jp_pcs0_2d + 8)  = sinkcal (:,:,ik1) * zrfact2 * tmask(:,:,1)
       trc3d(:,:,:,jp_pcs0_3d + 11) = sinking (:,:,:)      * zrfact2 * tmask(:,:,:)
       trc3d(:,:,:,jp_pcs0_3d + 12) = sinking2(:,:,:)      * zrfact2 * tmask(:,:,:)
@@ -301,28 +298,18 @@
       trc3d(:,:,:,jp_pcs0_3d + 17) = wsbio4  (:,:,:)                * tmask(:,:,:)
 #else
-      zw3d(:,:,:)  = sinking (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PMO" , zw3d )
-      zw3d(:,:,:)  = sinking2(:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PMO2", zw3d )
-      zw3d(:,:,:)  = sinkfer (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "ExpFe1", zw3d )
-      zw3d(:,:,:)  = sinksil (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "ExpSi", zw3d )
-      zw3d(:,:,:)  = sinkcal (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "ExpCaCO3", zw3d )
-      zw3d(:,:,:)  = sinking (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "POCFlx", zw3d )
-      zw3d(:,:,:)  = sinking2(:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "GOCFlx", zw3d )
-      zw3d(:,:,:)  = sinksil (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "SiFlx", zw3d )
-      zw3d(:,:,:)  = sinkcal (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "CaCO3Flx", zw3d )
-      zw3d(:,:,:)  = znum3d  (:,:,:)           * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "xnum", zw3d )
-      zw3d(:,:,:)  = wsbio3  (:,:,:)           * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "W1", zw3d )
-      zw3d(:,:,:)  = wsbio4  (:,:,:)           * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "W2", zw3d )
+      IF( jnt == nrdttrc ) then
+        CALL iom_put( "POCFlx"  , sinking (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! POC export
+        CALL iom_put( "NumFlx"  , sinking2 (:,:,:)     * zrfact2 * tmask(:,:,:) )  ! Num export
+        CALL iom_put( "SiFlx"   , sinksil (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! Silica export
+        CALL iom_put( "CaCO3Flx", sinkcal (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! Calcite export
+        CALL iom_put( "xnum"    , znum3d  (:,:,:)                * tmask(:,:,:) )  ! Number of particles in aggregats
+        CALL iom_put( "W1"      , wsbio3  (:,:,:)                * tmask(:,:,:) )  ! sinking speed of POC
+        CALL iom_put( "W2"      , wsbio4  (:,:,:)                * tmask(:,:,:) )  ! sinking speed of aggregats
+        CALL iom_put( "PMO"     , sinking (:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! POC export at 100m
+        CALL iom_put( "PMO2"    , sinking2(:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! Num export at 100m
+        CALL iom_put( "ExpFe1"  , sinkfer (:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! Export of iron at 100m
+        CALL iom_put( "ExpSi"   , sinksil (:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! export of silica at 100m
+        CALL iom_put( "ExpCaCO3", sinkcal (:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! export of calcite at 100m
+     ENDIF
 #  endif
 
@@ -489,8 +476,5 @@
 #if defined key_trc_dia3d
       REAL(wp) ::   zrfact2
-      INTEGER  ::   iksed1
-#endif
-#if defined key_iomput
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zw3d
+      INTEGER  ::   ik1
 #endif
       CHARACTER (len=25) :: charout
@@ -613,26 +597,26 @@
 #if defined key_trc_diaadd
       zrfact2 = 1.e3 * rfact2r
-      iksed1 = iksed + 1
+      ik1  = iksed + 1
 #  if ! defined key_iomput
-      trc2d(:,:,jp_pcs0_2d + 4) = sinking (:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:,jp_pcs0_2d + 5) = sinking2(:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:,jp_pcs0_2d + 6) = sinkfer (:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:,jp_pcs0_2d + 7) = sinkfer2(:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:,jp_pcs0_2d + 8) = sinksil (:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:,jp_pcs0_2d + 9) = sinkcal (:,:,iksed1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:,jp_pcs0_2d + 4) = sinking (:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:,jp_pcs0_2d + 5) = sinking2(:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:,jp_pcs0_2d + 6) = sinkfer (:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:,jp_pcs0_2d + 7) = sinkfer2(:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:,jp_pcs0_2d + 8) = sinksil (:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:,jp_pcs0_2d + 9) = sinkcal (:,:,ik1) * zrfact2 * tmask(:,:,1)
 #  else
-      zw3d(:,:,:)  = sinking (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "ExpPOC" , zw3d )
-      zw3d(:,:,:)  = sinking2(:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "ExpGOC", zw3d )
-      zw3d(:,:,:)  = sinkfer (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "ExpFe1", zw3d )
-      zw3d(:,:,:)  = sinkfer2(:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "ExpFe2", zw3d )
-      zw3d(:,:,:)  = sinksil (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "ExpSi", zw3d )
-      zw3d(:,:,:)  = sinkcal (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "Expcal", zw3d )
-#  endif
+      IF( jnt == nrdttrc )  then
+         CALL iom_put( "EPC100"  , ( sinking(:,:,ik1) + sinking2(:,:,ik1) ) * zrfact2 * tmask(:,:,1) ) ! Export of carbon at 100m
+         CALL iom_put( "EPFE100" , ( sinkfer(:,:,ik1) + sinkfer2(:,:,ik1) ) * zrfact2 * tmask(:,:,1) ) ! Export of iron at 100m
+         CALL iom_put( "EPCAL100",   sinkcal(:,:,ik1)                       * zrfact2 * tmask(:,:,1) ) ! Export of calcite  at 100m
+         CALL iom_put( "EPSI100" ,   sinksil(:,:,ik1)                       * zrfact2 * tmask(:,:,1) ) ! Export of biogenic silica at 100m
+#if defined key_diaar5
+         CALL iom_put( "EXPC"    , ( sinking(:,:,:  ) + sinking2(:,:,:  ) ) * zrfact2 * tmask(:,:,:) ) ! Export of carbon
+         CALL iom_put( "EXPFE"   , ( sinkfer(:,:,:  ) + sinkfer2(:,:,:  ) ) * zrfact2 * tmask(:,:,:) ) ! Export of iron 
+         CALL iom_put( "EXPCAL"  ,   sinkcal(:,:,:  )                       * zrfact2 * tmask(:,:,:) ) ! Export of calcite 
+         CALL iom_put( "EXPSI"   ,   sinksil(:,:,:  )                       * zrfact2 * tmask(:,:,:) ) ! Export of biogenic
+#endif
+      ENDIF
+#endif
 #endif
       !
Index: /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/sms_pisces.F90
===================================================================
--- /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/sms_pisces.F90	(revision 1829)
+++ /branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/sms_pisces.F90	(revision 1830)
@@ -64,4 +64,5 @@
 #if defined key_trc_dia3d
    REAL(wp), DIMENSION(jpi,jpj,jpk) ::   prodcal    !: Calcite production
+   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   grazing    !: Total zooplankton grazing
 #endif
 
Index: /branches/CMIP5_IPSL/NEMO/TOP_SRC/par_trc.F90
===================================================================
--- /branches/CMIP5_IPSL/NEMO/TOP_SRC/par_trc.F90	(revision 1829)
+++ /branches/CMIP5_IPSL/NEMO/TOP_SRC/par_trc.F90	(revision 1830)
@@ -18,6 +18,6 @@
    USE par_lobster   ! LOBSTER model
    USE par_pisces    ! PISCES  model
+   USE par_c14b      ! C14 bomb tracer
    USE par_cfc       ! CFC 11 and 12 tracers
-   USE par_c14b      ! C14 bomb tracer 
    USE par_my_trc    ! user defined passive tracers
 
@@ -27,9 +27,9 @@
    ! 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_c14b     + jp_my_trc
-   INTEGER, PUBLIC, PARAMETER ::   jpdia2d  =  jp_lobster_2d + jp_pisces_2d  + jp_cfc_2d  + jp_c14b_2d  + jp_my_trc_2d
-   INTEGER, PUBLIC, PARAMETER ::   jpdia3d  =  jp_lobster_3d + jp_pisces_3d  + jp_cfc_3d  + jp_c14b_3d  + jp_my_trc_3d
+   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_c14b_trd + jp_my_trc_trd
+   INTEGER, PUBLIC, PARAMETER ::   jpdiabio = jp_lobster_trd + jp_pisces_trd + jp_cfc_trd + jp_my_trc_trd
    
    !  1D configuration ("key_c1d")
@@ -40,18 +40,34 @@
    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
-# 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
+# if defined key_trc_diatrd
+   ! Passive tracers : size for TRP trends diagnotics (used if 'key_trc_diatrd' defined)
+   INTEGER, PARAMETER ::   jptrc_xad     =  1   !: x- horizontal advection
+   INTEGER, PARAMETER ::   jptrc_yad     =  2   !: y- horizontal advection
+   INTEGER, PARAMETER ::   jptrc_zad     =  3   !: z- vertical   advection
+   INTEGER, PARAMETER ::   jptrc_xdf     =  4   !: lateral       diffusion
+   INTEGER, PARAMETER ::   jptrc_ydf     =  5   !: lateral       diffusion
+   INTEGER, PARAMETER ::   jptrc_zdf     =  6   !: vertical diffusion (Kz)
+   INTEGER, PARAMETER ::   jptrc_sbc     =  7   !: surface boundary condition
+#if ! defined key_trcldf_eiv && ! defined key_trcdmp
+   INTEGER, PARAMETER ::   jpdiatrc      =  7  !: trends: 3*(advection + diffusion       ) + sbc
+#endif
+#if defined key_trcldf_eiv && defined key_trcdmp
+   INTEGER, PARAMETER ::   jptrc_xei     =  8   !: x- horiz. EIV advection
+   INTEGER, PARAMETER ::   jptrc_yei     =  9   !: y- horiz. EIV advection
+   INTEGER, PARAMETER ::   jptrc_zei     = 10   !: z- vert.  EIV advection
+   INTEGER, PARAMETER ::   jptrc_dmp     = 11   !: damping
+   INTEGER, PARAMETER ::   jpdiatrc      = 11   !: trends: 3*(advection + diffusion + eiv ) + sbc + damping
+#endif
+#if defined key_trcldf_eiv && ! defined key_trcdmp
+   INTEGER, PARAMETER ::   jptrc_xei     =  8   !: x- horiz. EIV advection
+   INTEGER, PARAMETER ::   jptrc_yei     =  9   !: y- horiz. EIV advection
+   INTEGER, PARAMETER ::   jptrc_zei     = 10   !: z- vert.  EIV advection
+   INTEGER, PARAMETER ::   jpdiatrc      = 10   !: trends: 3*(advection + diffusion + eiv ) + sbc 
+#endif
+#if ! defined key_trcldf_eiv && defined key_trcdmp
+   INTEGER, PARAMETER ::   jptrc_dmp     =  8   !: damping
+   INTEGER, PARAMETER ::   jpdiatrc      =  8   !: trends: 3*(advection + diffusion       ) + sbc + damping
+#endif
 #endif
 
Index: /branches/CMIP5_IPSL/NEMO/TOP_SRC/trcdia.F90
===================================================================
--- /branches/CMIP5_IPSL/NEMO/TOP_SRC/trcdia.F90	(revision 1829)
+++ /branches/CMIP5_IPSL/NEMO/TOP_SRC/trcdia.F90	(revision 1830)
@@ -21,9 +21,12 @@
    !! trcdib_wr   : outputs of biological fields
    !!----------------------------------------------------------------------
-   USE dom_oce         ! ocean space and time domain variables 
+   USE dom_oce         ! ocean space and time domain variables
    USE oce_trc
+   USE trp_trc
    USE trc
-   USE trp_trc
+   USE par_trc
+   USE trctrp
    USE trdmld_trc_oce, ONLY : luttrd
+   USE iom
    USE dianam    ! build name of file (routine)
    USE in_out_manager  ! I/O manager
@@ -41,5 +44,5 @@
    INTEGER  ::   ndimt50   !: number of ocean points in index array
    INTEGER  ::   ndimt51   !: number of ocean points in index array
-   REAL(wp) ::   xjulian   !: ????   not DOCTOR !
+   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
@@ -64,5 +67,5 @@
    !!----------------------------------------------------------------------
    !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005) 
-   !! $Id$ 
+   !! $Header:$ 
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -70,5 +73,5 @@
 CONTAINS
 
-   SUBROUTINE trc_dia( kt )  
+   SUBROUTINE trc_dia( kt, kindic )  
       !!---------------------------------------------------------------------
       !!                     ***  ROUTINE trc_dia  ***
@@ -77,5 +80,5 @@
       !!---------------------------------------------------------------------
       INTEGER, INTENT( in ) :: kt
-      INTEGER               :: kindic
+      INTEGER		    :: kindic
       !!---------------------------------------------------------------------
       
@@ -110,11 +113,8 @@
       LOGICAL ::   ll_print = .FALSE.
       CHARACTER (len=40) :: clhstnam, clop
-#if defined key_off_tra
-      INTEGER ::   inum = 11             ! temporary logical unit
-#endif
       CHARACTER (len=20) :: cltra, cltrau
       CHARACTER (len=80) :: cltral
       REAL(wp) :: zsto, zout, zdt
-      INTEGER  :: iimi, iima, ijmi, ijma, ipk, it, itmod
+      INTEGER  :: iimi, iima, ijmi, ijma, ipk, it
       !!----------------------------------------------------------------------
 
@@ -128,13 +128,10 @@
       ! Define frequency of output and means
       zdt = rdt
-      IF( ln_mskland )   THEN   ;   clop = "only(x)"   ! put 1.e+20 on land (very expensive!!)
-      ELSE                      ;   clop = "x"         ! no use of the mask value (require less cpu time)
-      ENDIF
 # if defined key_diainstant
       zsto = nwritetrc * rdt
-      clop = "inst("//TRIM(clop)//")"
+      clop = 'inst(only(x))'
 # else
       zsto = zdt
-      clop = "ave("//TRIM(clop)//")"
+      clop = 'ave(only(x))'
 # endif
       zout = nwritetrc * zdt
@@ -146,6 +143,5 @@
 
       ! define time axis
-      itmod = kt - nittrc000 + 1
-      it    = kt
+      it = kt - nittrc000 + 1
 
       ! Define NETCDF files and fields at beginning of first time step
@@ -157,41 +153,32 @@
 
          ! Compute julian date from starting date of the run
-         CALL ymds2ju( nyear, nmonth, nday, rdt, xjulian )
-         xjulian = xjulian - adatrj   !   set calendar origin to the beginning of the experiment
+         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 : ', xjulian  
-  
+            &                 ,'Julian day : ', zjulian    
          IF(lwp) WRITE(numout,*) ' indexes of zoom = ', iimi, iima, ijmi, ijma,  &
             &                    ' limit storage in depth = ', ipk
 
-#if defined key_off_tra
-        ! WRITE root name in date.file for use by postpro
-         IF(lwp) THEN
-            CALL dia_nam( clhstnam, nwritetrc,' ' )
-            CALL ctl_opn( inum, 'date.file', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea )
-            WRITE(inum,*) clhstnam
-            CLOSE(inum)
-         ENDIF
-#endif
-
-         ! Define the NETCDF files for passive tracer concentration
+
+! Define the NETCDF files for passive tracer concentration
+
          CALL dia_nam( clhstnam, nwritetrc, 'ptrc_T' )
          IF(lwp)WRITE(numout,*)" Name of NETCDF file ", clhstnam
-
-         ! Horizontal grid : glamt and gphit
+! Horizontal grid : glamt and gphit
          CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,     &
             &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,         & 
-            &          nittrc000-ndttrc, xjulian, zdt, nhorit5, nit5 , domain_id=nidom)
-
-         ! Vertical grid for tracer : gdept
-         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 )
-
-         ! Declare all the output fields as NETCDF variables
+            &          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)
+
+! 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 )
+
+! Declare all the output fields as NETCDF variables
+
+! tracer concentrations
          DO jn = 1, jptra
             IF( lutsav(jn) ) THEN
@@ -200,5 +187,5 @@
                cltrau = ctrcun(jn)   ! UNIT for tracer
                CALL histdef( nit5, cltra, cltral, cltrau, jpi, jpj, nhorit5,  &
-                  &          ipk, 1, ipk,  ndepit5, 32, clop, zsto, zout ) 
+                  &               ipk, 1, ipk,  ndepit5, 32, clop, zsto, zout) 
             ENDIF
          END DO
@@ -215,5 +202,5 @@
       ! ---------------------------------------
 
-      IF( lwp .AND. MOD( itmod, nwritetrc ) == 0 ) THEN
+      IF( lwp .AND. MOD( kt, nwritetrc ) == 0 ) THEN
          WRITE(numout,*) 'trcdit_wr : write NetCDF passive tracer concentrations at ', kt, 'time-step'
          WRITE(numout,*) '~~~~~~~~~ '
@@ -221,7 +208,13 @@
 
       DO jn = 1, jptra
-         cltra = ctrcnm(jn)      ! short title for tracer
-         IF( lutsav(jn) ) CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 )
+         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 
@@ -229,5 +222,4 @@
       IF( kt == nitend .OR. kindic < 0 )   CALL histclo( nit5 )
       !
-
    END SUBROUTINE trcdit_wr
 
@@ -244,5 +236,5 @@
       !!
       !!        At each time step call histdef to compute the mean if necessary
-      !!        Each nwritetrd time step, output the instantaneous or mean fields
+      !!        Each nwritetrc time step, output the instantaneous or mean fields
       !!
       !!        IF kindic <0, output of fields before the model interruption.
@@ -258,6 +250,6 @@
       CHARACTER (len=80) ::   cltral
       CHARACTER (len=10) ::   csuff
-      INTEGER  ::   jn, jl
-      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it, itmod
+      INTEGER  ::   jn, jl, ikn
+      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it
       REAL(wp) ::   zsto, zout, zdt
       !!----------------------------------------------------------------------
@@ -265,5 +257,4 @@
       ! 0. Initialisation
       ! -----------------
-      
 
       ! local variable for debugging
@@ -273,13 +264,10 @@
       ! Define frequency of output and means
       zdt = rdt
-      IF( ln_mskland )   THEN   ;   clop = "only(x)"   ! put 1.e+20 on land (very expensive!!)
-      ELSE                      ;   clop = "x"         ! no use of the mask value (require less cpu time)
-      ENDIF
 #  if defined key_diainstant
       zsto = nwritetrd * rdt
-      clop = "inst("//TRIM(clop)//")"
+      clop = 'inst(only(x))'
 #  else
       zsto = zdt
-      clop = "ave("//TRIM(clop)//")"
+      clop = 'ave(only(x))'
 #  endif
       zout = nwritetrd * zdt
@@ -291,6 +279,5 @@
 
       ! define time axis
-      itmod = kt - nittrc000 + 1
-      it    = kt
+      it = kt - nittrc000 + 1
 
       ! Define the NETCDF files (one per tracer)
@@ -313,89 +300,78 @@
                CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,       &
                   &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,   &
-                  &          nittrc000-ndttrc, xjulian, zdt, nhorit6(jn),  &
+                  &          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) ) 
+               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 == 1 ) THEN
+                  IF( jl == jptrc_xad ) 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 == 2 ) THEN
+                      WRITE (cltral,'("X advective trend for ",58a)') ctrcnl(jn)(1:58)
+                  END IF
+                  IF( jl == jptrc_yad ) 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 == 3 ) THEN
+                      WRITE (cltral,'("Y advective trend for ",58a)') ctrcnl(jn)(1:58)
+                  END IF
+                  IF( jl == jptrc_zad ) 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 == 4 ) THEN
+                      WRITE (cltral,'("Z advective trend for ",58a)') ctrcnl(jn)(1:58)
+                  END IF
+                  IF( jl == jptrc_xdf ) 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 == 5 ) THEN
+                      WRITE (cltral,'("X diffusion trend for ",58a)') ctrcnl(jn)(1:58)
+                  END IF
+                  IF( jl == jptrc_ydf ) 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 == 6 ) THEN
+                      WRITE (cltral,'("Y diffusion trend for ",58a)') ctrcnl(jn)(1:58)
+                  END IF
+                  IF( jl == jptrc_zdf ) 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)
+                      WRITE (cltral,'("Z diffusion trend for ",58a)') ctrcnl(jn)(1:58)
                   END IF
 # if defined key_trcldf_eiv
-                  IF( jl == 7 ) THEN
+                  IF( jl == jptrc_xei ) 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 == 8 ) THEN
+                      WRITE (cltral,'("X gent velocity trend for ",53a)') ctrcnl(jn)(1:53)
+                  END IF
+                  IF( jl == jptrc_yei ) 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 == 9 ) THEN
+                      WRITE (cltral,'("Y gent velocity trend for ",53a)') ctrcnl(jn)(1:53)
+                  END IF
+                  IF( jl == jptrc_zei ) 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)
+                      WRITE (cltral,'("Z gent velocity trend for ",53a)') ctrcnl(jn)(1:53)
                   END IF
 # endif
 # if defined key_trcdmp
-                  IF( jl == jpdiatrc - 1 ) THEN
+                  IF( jl == jptrc_dmp ) 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 == jpdiatrc ) THEN
+                      WRITE (cltral,'("Tracer damping trend for ",55a)') ctrcnl(jn)(1:55)
+                  END IF
+# endif
+                  IF( jl == jptrc_sbc ) THEN
                       ! last trends for tracer damping : short and long title
                       WRITE (cltra,'("SBC_",16a)') ctrcnm(jn)
-                      WRITE (cltral,'("Surface boundary flux ",58a)')  &
-                      &      ctrcnl(jn)(1:58)
-                  END IF
-
+                      WRITE (cltral,'("Surface boundary flux ",58a)') ctrcnl(jn)(1:55)
+                  END IF
+                      WRITE (cltral,'("Surface boundary flux ",58a)') ctrcnl(jn)(1:55)
+                  END IF
                   CALL FLUSH( numout )
                   cltrau = ctrcun(jn)      ! UNIT for tracer /trends
@@ -425,5 +401,5 @@
       ! trends for tracer concentrations
 
-      IF( lwp .AND. MOD( itmod, nwritetrd ) == 0 ) THEN
+      IF( lwp .AND. MOD( kt, nwritetrd ) == 0 ) THEN
          WRITE(numout,*) 'trcdid_wr : write NetCDF dynamical trends at ', kt, 'time-step'
          WRITE(numout,*) '~~~~~~ '
@@ -432,26 +408,34 @@
       DO jn = 1, jptra
          IF( luttrd(jn) ) THEN
+            ikn = ikeep(jn)
             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
+               ! short titles
+               IF( jl == jptrc_xad)   WRITE (cltra,'("XAD_",16a)') ctrcnm(jn)
+               IF( jl == jptrc_yad)   WRITE (cltra,'("YAD_",16a)') ctrcnm(jn)
+               IF( jl == jptrc_zad)   WRITE (cltra,'("ZAD_",16a)') ctrcnm(jn)
+               IF( jl == jptrc_xdf)   WRITE (cltra,'("XDF_",16a)') ctrcnm(jn)
+               IF( jl == jptrc_ydf)   WRITE (cltra,'("YDF_",16a)') ctrcnm(jn)
+               IF( jl == jptrc_zdf)   WRITE (cltra,'("ZDF_",16a)') ctrcnm(jn)
 # if defined key_trcldf_eiv
-               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
+               IF( jl == jptrc_xei)   WRITE (cltra,'("XGV_",16a)') ctrcnm(jn)
+               IF( jl == jptrc_yei)   WRITE (cltra,'("YGV_",16a)') ctrcnm(jn)
+               IF( jl == jptrc_zei)   WRITE (cltra,'("ZGV_",16a)') ctrcnm(jn)
 # endif
 # if defined key_trcdmp
-               IF( jl == jpdiatrc - 1 )   WRITE (cltra,'("TDM_",16a)') ctrcnm(jn)      ! damping
-# endif
-               IF( jl == jpdiatrc )   WRITE (cltra,'("SBC_",a)') ctrcnm(jn)      ! surface boundary conditions
+               IF( jl == jptrc_dmp )  WRITE (cltra,'("TDM_",16a)') ctrcnm(jn)
+# endif
+               IF( jl == jptrc_sbc )  WRITE (cltra,'("SBC_",16a)') ctrcnm(jn)
                !
-               CALL histwrite(nit6(jn), cltra, it, trtrd(:,:,:,ikeep(jn),jl),ndimt50, ndext50)
+               CALL histwrite(nit6(jn), cltra, it, trtrd(:,:,:,ikn,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
 
       ! Closing all files
@@ -463,5 +447,4 @@
       ENDIF
       !
-
    END SUBROUTINE trcdid_wr
 
@@ -486,5 +469,5 @@
       !!
       !!        At each time step call histdef to compute the mean if necessary
-      !!        Each nwritedia time step, output the instantaneous or mean fields
+      !!        Each nwritetrc time step, output the instantaneous or mean fields
       !!
       !!        IF kindic <0, output of fields before the model interruption.
@@ -499,6 +482,6 @@
       CHARACTER (len=20) ::   cltra, cltrau
       CHARACTER (len=80) ::   cltral
-      INTEGER  ::   jl
-      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it, itmod
+      INTEGER  ::   jn
+      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it
       REAL(wp) ::   zsto, zout, zdt
       !!----------------------------------------------------------------------
@@ -506,5 +489,5 @@
       ! Initialisation
       ! --------------
-      
+
       ! local variable for debugging
       ll_print = .FALSE.
@@ -513,15 +496,12 @@
       ! Define frequency of output and means
       zdt = rdt
-      IF( ln_mskland )   THEN   ;   clop = "only(x)"   ! put 1.e+20 on land (very expensive!!)
-      ELSE                      ;   clop = "x"         ! no use of the mask value (require less cpu time)
-      ENDIF
 #  if defined key_diainstant
-      zsto = nwritedia * zdt
-      clop = "inst("//TRIM(clop)//")"
+      zsto=nwritedia*zdt
+      clop='inst(only(x))'
 #  else
-      zsto = zdt
-      clop = "ave("//TRIM(clop)//")"
+      zsto=zdt
+      clop='ave(only(x))'
 #  endif
-      zout = nwritedia * zdt
+      zout=nwritedia*zdt
 
       ! Define indices of the horizontal output zoom and vertical limit storage
@@ -531,6 +511,5 @@
 
       ! define time axis
-      itmod = kt - nittrc000 + 1
-      it    = kt
+      it = kt - nittrc000 + 1
 
       ! 1. Define NETCDF files and fields at beginning of first time step
@@ -545,5 +524,5 @@
          ! Define the T grid file for tracer auxiliary files
 
-         CALL dia_nam( clhstnam, nwritedia, 'diad_T' )
+         CALL dia_nam( clhstnam, nwrite, 'diad_T' )
          IF(lwp) WRITE(numout,*) " Name of NETCDF file ", clhstnam
 
@@ -552,17 +531,18 @@
          CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,             &
             &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,         &
-            &          nittrc000-ndttrc, xjulian, zdt, nhoritd, nitd , domain_id=nidom )
+            &          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)
+         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 jl = 1, jpdia3d
-            cltra  = ctrc3d(jl)   ! short title for 3D diagnostic
-            cltral = ctrc3l(jl)   ! long title for 3D diagnostic
-            cltrau = ctrc3u(jl)   ! UNIT for 3D diagnostic
+         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 )
@@ -570,8 +550,8 @@
 
          ! more 2D horizontal arrays
-         DO jl = 1, jpdia2d
-            cltra  = ctrc2d(jl)    ! short title for 2D diagnostic
-            cltral = ctrc2l(jl)   ! long title for 2D diagnostic
-            cltrau = ctrc2u(jl)   ! UNIT for 2D diagnostic
+         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 )
@@ -592,5 +572,5 @@
       ! ---------------------
 
-      IF( lwp .AND. MOD( itmod, nwritedia ) == 0 ) THEN
+      IF( lwp .AND. MOD( kt, nwritedia ) == 0 ) THEN
          WRITE(numout,*) 'trcdii_wr : write NetCDF additional arrays at ', kt, 'time-step'
          WRITE(numout,*) '~~~~~~ '
@@ -598,14 +578,17 @@
 
       ! more 3D horizontal arrays
-      DO jl = 1, jpdia3d
-         cltra = ctrc3d(jl)   ! short title for 3D diagnostic
-         CALL histwrite( nitd, cltra, it, trc3d(:,:,:,jl), ndimt50 ,ndext50)
+      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 jl = 1, jpdia2d
-         cltra = ctrc2d(jl)   ! short title for 2D diagnostic
-         CALL histwrite(nitd, cltra, it, trc2d(:,:,jl), ndimt51  ,ndext51)
+      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, nwritedia ) == 0 .OR. kindic < 0 )   CALL histsync( nitd )
 
       ! Closing all files
@@ -613,5 +596,4 @@
       IF( kt == nitend .OR. kindic < 0 )   CALL histclo(nitd)
       !
-
    END SUBROUTINE trcdii_wr
 
@@ -636,5 +618,5 @@
       !!
       !!        At each time step call histdef to compute the mean if necessary
-      !!        Each nwritebio time step, output the instantaneous or mean fields
+      !!        Each nwritetrc time step, output the instantaneous or mean fields
       !!
       !!        IF kindic <0, output of fields before the model interruption.
@@ -650,6 +632,6 @@
       CHARACTER (len=20) ::   cltra, cltrau
       CHARACTER (len=80) ::   cltral
-      INTEGER  ::   ji, jj, jk, jl
-      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it, itmod
+      INTEGER  ::   ji, jj, jk, jn
+      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it
       REAL(wp) ::   zsto, zout, zdt
       !!----------------------------------------------------------------------
@@ -658,5 +640,4 @@
       ! --------------
 
-      
       ! local variable for debugging
       ll_print = .FALSE.
@@ -665,17 +646,14 @@
       ! Define frequency of output and means
       zdt = rdt
-      IF( ln_mskland )   THEN   ;   clop = "only(x)"   ! put 1.e+20 on land (very expensive!!)
-      ELSE                      ;   clop = "x"         ! no use of the mask value (require less cpu time)
-      ENDIF
 #        if defined key_diainstant
-      zsto = nwritebio * zdt
-      clop = "inst("//TRIM(clop)//")"
+      zsto=nwritebio*zdt
+      clop='inst(only(x))'
 #        else
-      zsto = zdt
-      clop = "ave("//TRIM(clop)//")"
+      zsto=zdt
+      clop='ave(only(x))'
 #        endif
-      zout = nwritebio * zdt
-
-      ! Define indices of the horizontal output zoom and vertical limit storage
+      zout=nwritebio*zdt
+
+      ! Define indices of the horizontal output zoom and vertical limit storage      iimi = 1      ;      iima = jpi
       iimi = 1      ;      iima = jpi
       ijmi = 1      ;      ijma = jpj
@@ -683,6 +661,5 @@
 
       ! define time axis
-      itmod = kt - nittrc000 + 1
-      it    = kt
+      it = kt - nittrc000 + 1
 
       ! Define NETCDF files and fields at beginning of first time step
@@ -695,25 +672,26 @@
          ! Define the NETCDF files for biological trends
 
-         CALL dia_nam(clhstnam,nwritebio,'biolog')
+         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,      &
+         CALL histbeg(clhstnam, jpi, glamt, jpj, gphit,      &
             &    iimi, iima-iimi+1, ijmi, ijma-ijmi+1,          &
-            &    nittrc000-ndttrc, xjulian, zdt, nhoritb, nitb , domain_id=nidom )
+            &    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)
+         CALL histvert(nitb, 'deptht', 'Vertical T levels',  &
+            &    'm', ipk, gdept_0, ndepitb)
 
          ! Declare all the output fields as NETCDF variables
          ! biological trends
-         DO jl = 1, jpdiabio
-            cltra  = ctrbio(jl)   ! short title for biological diagnostic
-            cltral = ctrbil(jl)   ! long title for biological diagnostic
-            cltrau = ctrbiu(jl)   ! UNIT for biological diagnostic
-            CALL histdef( nitb, cltra, cltral, cltrau, jpi, jpj, nhoritb,  &
+         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
-          CALL histend( nitb )
+          CALL histend(nitb)
 
          IF(lwp) WRITE(numout,*)
@@ -727,13 +705,16 @@
 
       ! biological trends
-      IF( lwp .AND. MOD( itmod, nwritebio ) == 0 ) THEN
+      IF( lwp .AND. MOD( kt, nwritebio ) == 0 ) THEN
          WRITE(numout,*) 'trcdit_wr : write NetCDF biological trends at ', kt, 'time-step'
          WRITE(numout,*) '~~~~~~ '
       ENDIF
 
-      DO jl = 1, jpdiabio
-         cltra = ctrbio(jl)  ! short title for biological diagnostic
-         CALL histwrite(nitb, cltra, it, trbio(:,:,:,jl), ndimt50,ndext50)
+      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 )   CALL histsync( nitb )
 
       ! Closing all files
@@ -741,5 +722,4 @@
       IF( kt == nitend .OR. kindic < 0 )   CALL histclo( nitb )
       !
-
    END SUBROUTINE trcdib_wr
 
@@ -757,7 +737,7 @@
    !!----------------------------------------------------------------------
 CONTAINS
-   SUBROUTINE trc_dia( kt )                      ! Empty routine   
+   SUBROUTINE trc_dia( kt )                      ! Empty routine
       INTEGER, INTENT(in) :: kt
-   END SUBROUTINE trc_dia   
+   END SUBROUTINE trc_dia
 
 #endif
Index: /branches/CMIP5_IPSL/NEMO/TOP_SRC/trcwri.F90
===================================================================
--- /branches/CMIP5_IPSL/NEMO/TOP_SRC/trcwri.F90	(revision 1829)
+++ /branches/CMIP5_IPSL/NEMO/TOP_SRC/trcwri.F90	(revision 1830)
@@ -1,9 +1,9 @@
 MODULE trcwri
-   !!======================================================================
+   !!===================================================================================
    !!                       *** MODULE trcwri ***
-   !!    TOP :   Output of passive tracers 
-   !!======================================================================
-   !!             1.0  !  
-   !!                  !  2009-05 (C. Ethe )
+   !!    TOP :   Output of passive tracers
+   !!====================================================================================
+   !! History :   1.0  !  2009-05 (C. Ethe)  Original code
+   !!                  !  2010-03 (C. Ethe, R. Seferian ) Add the tracer transport trends
    !!----------------------------------------------------------------------
 #if defined key_top &&  defined key_iomput
@@ -11,7 +11,12 @@
    !!   'key_top' && 'key_iomput'                              TOP models
    !!----------------------------------------------------------------------
-   !! trc_wri     :  outputs of concentration fields
-   !!----------------------------------------------------------------------
+   !! trc_wri_trc   :  outputs of concentration fields
+   !! trc_wri_trd   :  outputs of transport trends
+   !!----------------------------------------------------------------------
+   USE dom_oce         ! ocean space and time domain variables
+   USE oce_trc
+   USE trp_trc
    USE trc
+   USE trdmld_trc_oce, ONLY : luttrd
    USE iom
 #if defined key_off_tra
@@ -35,7 +40,24 @@
 CONTAINS
 
-   SUBROUTINE trc_wri( kt )  
+   SUBROUTINE trc_wri( kt )
       !!---------------------------------------------------------------------
       !!                     ***  ROUTINE trc_wri  ***
+      !! 
+      !! ** Purpose :   output passive tracers fields and dynamical trends
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT( in ) :: kt
+      !!---------------------------------------------------------------------
+
+      !
+      CALL iom_setkt  ( kt + ndttrc - 1 )       ! set the passive tracer time step
+      CALL trc_wri_trc( kt              )       ! outputs for tracer concentration
+      CALL trc_wri_trd( kt              )       ! outputs for dynamical trends
+      CALL iom_setkt  ( kt              )       ! set the model time step
+      !
+   END SUBROUTINE trc_wri
+
+   SUBROUTINE trc_wri_trc( kt )  
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_wri_trc  ***
       !!
       !! ** Purpose :   output passive tracers fields 
@@ -43,17 +65,18 @@
       INTEGER, INTENT( in ) :: kt       ! ocean time-step
       INTEGER               :: jn
-      CHARACTER (len=20)    :: cltra
+      CHARACTER (len=20)    :: cltra, cltras
 #if defined key_off_tra
       CHARACTER (len=40) :: clhstnam
       INTEGER ::   inum = 11            ! temporary logical unit
 #endif
-
+#if defined key_diaar5  && defined key_pisces
+      INTEGER                      :: ji, jj, jk  ! dummy loop indices
+      REAL(wp)                     :: zoxy        ! oxygen concentration 
+      REAL(wp), DIMENSION(jpi,jpj) :: zdic        ! DIC content 
+      REAL(wp), DIMENSION(jpi,jpj) :: zo2min      ! O2 minimum concentration 
+      REAL(wp), DIMENSION(jpi,jpj) :: zdepo2min   ! Depth of O2 minimum concentration 
+#endif
       !!---------------------------------------------------------------------
  
-      ! Initialisation
-      ! --------------
-
-      CALL iom_setkt( kt + ndttrc - 1 ) ! set the passive tracer time step
-
 #if defined key_off_tra
       IF( kt == nittrc000 ) THEN
@@ -67,6 +90,4 @@
       ENDIF
 #endif
-
-
       ! write the tracer concentrations in the file
       ! ---------------------------------------
@@ -75,10 +96,95 @@
          CALL iom_put( cltra, trn(:,:,:,jn) )
       END DO
-      !
-      CALL iom_setkt( kt )       ! set the model time step
-
-      !
-   END SUBROUTINE trc_wri
-
+#if defined key_diaar5  && defined key_pisces
+      ! DIC content in kg/m2
+      zdic(:,:) = 0.
+      DO jk = 1, jpkm1
+         zdic(:,:) = zdic(:,:) + trn(:,:,jk,jpdic) * fse3t(:,:,jk) * tmask(:,:,jk) * 12. 
+      ENDDO
+      ! Oxygen minimum concentration and depth
+      zo2min   (:,:) = trn(:,:,1,jpoxy) * tmask(:,:,1)
+      zdepo2min(:,:) = fsdepw(:,:,1)    * tmask(:,:,1)
+      DO jk = 2, jpkm1
+         DO jj = 1, jpj               
+            DO ji = 1, jpi 
+               IF( tmask(ji,jj,jk) == 1 ) then
+                  IF( trn(ji,jj,jk,jpoxy) < zo2min(ji,jj) ) then
+                     zo2min   (ji,jj) = trn(ji,jj,jk,jpoxy) 
+                     zdepo2min(ji,jj) = fsdepw(ji,jj,jk)
+                  ENDIF
+               ENDIF
+            END DO
+         END DO
+      END DO
+      !
+      CALL iom_put('INTDIC', zdic       )                              ! DIC content
+      CALL iom_put('O2MIN' , zo2min     )                              ! oxygen minimum concentration
+      CALL iom_put('ZO2MIN', zdepo2min  )                              ! depth of oxygen minimum concentration
+      CALL iom_put('PHYT'  , trn(:,:,:,jpphy) + trn(:,:,:,jpdia) )     ! total phytoplankton
+      CALL iom_put('ZOOT'  , trn(:,:,:,jpzoo) + trn(:,:,:,jpmes) )     ! total zooplankton
+      CALL iom_put('CHLT'  , trn(:,:,:,jpnch) + trn(:,:,:,jpdch) )     ! total chlorophyll
+      CALL iom_put('POCT'  , trn(:,:,:,jppoc) + trn(:,:,:,jpgoc) )     ! total carbon particles
+      CALL iom_put('PFET'  , trn(:,:,:,jpnfe) + trn(:,:,:,jpdfe) )     ! total biogenic iron
+      ! passive tracers at surface
+      DO jn = 1, jptra
+         cltras = TRIM(ctrcnm(jn))//'SFC'                   ! short title for tracer
+         CALL iom_put( cltras, trn(:,:,1,jn) )
+      END DO
+      CALL iom_put('PHYTSFC',trn(:,:,1,jpphy) + trn(:,:,1,jpdia) )
+      CALL iom_put('ZOOTSFC',trn(:,:,1,jpzoo) + trn(:,:,1,jpmes) )
+      CALL iom_put('CHLTSFC',trn(:,:,1,jpnch) + trn(:,:,1,jpdch) )
+      CALL iom_put('POCTSFC',trn(:,:,1,jppoc) + trn(:,:,1,jpgoc) )
+      CALL iom_put('PFETSFC',trn(:,:,1,jpnfe) + trn(:,:,1,jpdfe) )
+#endif
+      !
+   END SUBROUTINE trc_wri_trc
+
+# if defined key_trc_diatrd
+
+   SUBROUTINE trc_wri_trd( kt )
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_wri_trd  ***
+      !!
+      !! ** Purpose :   output of passive tracer : advection-diffusion trends
+      !!
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt          ! ocean time-step
+      !!
+      CHARACTER (len=3) ::   cltra
+      INTEGER  ::   jn, jl, ikn
+      !!----------------------------------------------------------------------
+
+      DO jn = 1, jptra
+         IF( luttrd(jn) ) THEN
+            ikn = ikeep(jn)
+            DO jl = 1, jpdiatrc
+               IF( jl == jptrc_xad ) WRITE (cltra,"(3a)") 'XAD' ! x advection for tracer
+               IF( jl == jptrc_yad ) WRITE (cltra,"(3a)") 'YAD'  ! y advection for tracer
+               IF( jl == jptrc_zad ) WRITE (cltra,"(3a)") 'ZAD'  ! z advection for tracer
+               IF( jl == jptrc_xdf ) WRITE (cltra,"(3a)") 'XDF'  ! x diffusion for tracer
+               IF( jl == jptrc_ydf ) WRITE (cltra,"(3a)") 'YDF'  ! y diffusion for tracer
+               IF( jl == jptrc_zdf ) WRITE (cltra,"(3a)") 'ZDF'  ! z diffusion for tracer
+# if defined key_trcldf_eiv
+               IF( jl == jptrc_xei ) WRITE (cltra,"(3a)") 'XGV'  ! x gent velocity for tracer
+               IF( jl == jptrc_yei ) WRITE (cltra,"(3a)") 'YGV'  ! y gent velocity for tracer
+               IF( jl == jptrc_zei ) WRITE (cltra,"(3a)") 'ZGV'  ! z gent velocity for tracer
+# endif
+# if defined key_trcdmp
+               IF( jl == jptrc_dmp ) WRITE (cltra,"(3a)") 'DMP'  ! damping
+# endif
+               IF( jl == jptrc_sbc ) WRITE (cltra,"(3a)") 'SBC'  ! surface boundary conditions
+               ! write the trends
+               CALL iom_put( cltra, trtrd(:,:,:,ikn,jl) )
+            END DO
+         END IF
+      END DO
+      !
+   END SUBROUTINE trc_wri_trd
+
+# else
+   SUBROUTINE trc_wri_trd( kt )                      ! Dummy routine
+      INTEGER, INTENT ( in ) ::   kt
+   END SUBROUTINE trc_wri_trd
+#endif
 #else
    !!----------------------------------------------------------------------
@@ -90,5 +196,4 @@
    INTEGER, INTENT(in) :: kt
    END SUBROUTINE trc_wri
-
 #endif
 
