Index: trunk/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90	(revision 3319)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90	(revision 3320)
@@ -60,6 +60,7 @@
       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
       !!
-      INTEGER ::   jnt, jn
+      INTEGER ::   jnt, jn, jl
       CHARACTER (len=25) :: charout
+      REAL(wp), POINTER, DIMENSION(:,:,:,:)  :: ztrdpis
       !!---------------------------------------------------------------------
       !
@@ -68,4 +69,11 @@
       IF( ln_pisdmp .AND. MOD( kt - nn_dttrc, nn_pisdmp ) == 0 )   CALL trc_sms_pisces_dmp( kt )  ! Relaxation of some tracers
                                                                    CALL trc_sms_pisces_mass_conserv( kt ) ! Mass conservation checking
+      IF( l_trdtrc )  THEN
+         CALL wrk_alloc( jpi, jpj, jpk, jp_pisces, ztrdpis ) 
+         DO jn = 1, jp_pisces
+            jl = jn + jp_pcs0 - 1
+            ztrdpis(:,:,:,jn) = trn(:,:,:,jl)
+         ENDDO
+      ENDIF
 
       IF( ndayflxtr /= nday_year ) THEN      ! New days
@@ -82,4 +90,5 @@
       ENDIF
 
+
       DO jnt = 1, nrdttrc          ! Potential time splitting if requested
          !
@@ -87,7 +96,16 @@
          CALL p4z_sed (kt, jnt)    ! compute soft tissue remineralisation
          !
-         trb(:,:,:,:) = trn(:,:,:,:)
+         DO jn = jp_pcs0, jp_pcs1
+            trb(:,:,:,jn) = trn(:,:,:,jn)
+         ENDDO
          !
       END DO
+
+      IF( l_trdtrc )  THEN
+         DO jn = 1, jp_pisces
+            jl = jn + jp_pcs0 - 1
+            ztrdpis(:,:,:,jn) = ( ztrdpis(:,:,:,jn) - trn(:,:,:,jl) ) * rfact2r
+         ENDDO
+      ENDIF
 
       CALL p4z_lys( kt )             ! Compute CaCO3 saturation
@@ -101,7 +119,10 @@
 
       IF( l_trdtrc ) THEN
-          DO jn = jp_pcs0, jp_pcs1
-            CALL trd_mod_trc( tra(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends
+         DO jn = 1, jp_pisces
+            jl = jn + jp_pcs0 - 1
+             ztrdpis(:,:,:,jn) = ztrdpis(:,:,:,jn) + tra(:,:,:,jl)
+             CALL trd_mod_trc( ztrdpis(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends
           END DO
+          CALL wrk_dealloc( jpi, jpj, jpk, jp_pisces, ztrdpis ) 
       END IF
 
Index: trunk/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc.F90	(revision 3319)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc.F90	(revision 3320)
@@ -35,4 +35,5 @@
    USE sms_pisces        ! PISCES bio-model
    USE sms_lobster       ! LOBSTER bio-model
+   USE wrk_nemo          ! Memory allocation
 
    IMPLICIT NONE
@@ -67,4 +68,5 @@
    !! * Substitutions
 #  include "top_substitute.h90"
+#  include "zdfddm_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 3.3 , NEMO Consortium (2010)
@@ -388,5 +390,5 @@
       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmlrad2            !  | (-> for trb<0 corr in trcrad)
       !
-      CHARACTER (LEN= 5) ::   clvar
+      CHARACTER (LEN=10) ::   clvar
 #if defined key_dimgout
       INTEGER ::   iyear,imon,iday
@@ -801,17 +803,17 @@
                !-- Output the fields
                clvar = trim(ctrcnm(jn))//"ml"                        ! e.g. detml, zooml, nh4ml, etc.
-               CALL histwrite( nidtrd(jn), clvar         , it, tml_trc(:,:,jn), ndimtrd1, ndextrd1 ) 
-               CALL histwrite( nidtrd(jn), clvar//"_tot" , it, ztmltot(:,:,jn), ndimtrd1, ndextrd1 ) 
-               CALL histwrite( nidtrd(jn), clvar//"_res" , it, ztmlres(:,:,jn), ndimtrd1, ndextrd1 ) 
+               CALL histwrite( nidtrd(jn), trim(clvar)         , it, tml_trc(:,:,jn), ndimtrd1, ndextrd1 ) 
+               CALL histwrite( nidtrd(jn), trim(clvar)//"_tot" , it, ztmltot(:,:,jn), ndimtrd1, ndextrd1 ) 
+               CALL histwrite( nidtrd(jn), trim(clvar)//"_res" , it, ztmlres(:,:,jn), ndimtrd1, ndextrd1 ) 
            
                DO jl = 1, jpltrd_trc - 2
-                  CALL histwrite( nidtrd(jn), trim(clvar//ctrd_trc(jl,2)),             &
+                  CALL histwrite( nidtrd(jn), trim(clvar)//trim(ctrd_trc(jl,2)),             &
                     &          it, tmltrd_trc(:,:,jl,jn), ndimtrd1, ndextrd1 )
                END DO
 
-               CALL histwrite( nidtrd(jn), trim(clvar//ctrd_trc(jpmld_trc_radb,2)),    &  ! now trcrad    : jpltrd_trc - 1
+               CALL histwrite( nidtrd(jn), trim(clvar)//trim(ctrd_trc(jpmld_trc_radb,2)),    &  ! now trcrad    : jpltrd_trc - 1
                     &          it, ztmlrad(:,:,jn), ndimtrd1, ndextrd1 )
 
-               CALL histwrite( nidtrd(jn), trim(clvar//ctrd_trc(jpmld_trc_atf,2)),     &  ! now Asselin   : jpltrd_trc
+               CALL histwrite( nidtrd(jn), trim(clvar)//trim(ctrd_trc(jpmld_trc_atf,2)),     &  ! now Asselin   : jpltrd_trc
                     &          it, ztmlatf(:,:,jn), ndimtrd1, ndextrd1 )
                      
@@ -827,5 +829,4 @@
       ELSE                                                        ! <<< write the trends for passive tracer mean diagnostics
          
-                 
          DO jn = 1, jptra
             !
@@ -835,17 +836,17 @@
                clvar = trim(ctrcnm(jn))//"ml"                        ! e.g. detml, zooml, nh4ml, etc.
 
-               CALL histwrite( nidtrd(jn), clvar         , it, tml_sum_trc(:,:,jn), ndimtrd1, ndextrd1 )
-               CALL histwrite( nidtrd(jn), clvar//"_tot" , it,    ztmltot2(:,:,jn), ndimtrd1, ndextrd1 ) 
-               CALL histwrite( nidtrd(jn), clvar//"_res" , it,    ztmlres2(:,:,jn), ndimtrd1, ndextrd1 ) 
+               CALL histwrite( nidtrd(jn), trim(clvar)         , it, tml_sum_trc(:,:,jn), ndimtrd1, ndextrd1 )
+               CALL histwrite( nidtrd(jn), trim(clvar)//"_tot" , it,    ztmltot2(:,:,jn), ndimtrd1, ndextrd1 ) 
+               CALL histwrite( nidtrd(jn), trim(clvar)//"_res" , it,    ztmlres2(:,:,jn), ndimtrd1, ndextrd1 ) 
 
                DO jl = 1, jpltrd_trc - 2
-                  CALL histwrite( nidtrd(jn), trim(clvar//ctrd_trc(jl,2)),           &
+                  CALL histwrite( nidtrd(jn), trim(clvar)//trim(ctrd_trc(jl,2)),           &
                     &          it, ztmltrd2(:,:,jl,jn), ndimtrd1, ndextrd1 )
                END DO
             
-               CALL histwrite( nidtrd(jn), trim(clvar//ctrd_trc(jpmld_trc_radb,2)),   &  ! now trcrad    : jpltrd_trc - 1
+               CALL histwrite( nidtrd(jn), trim(clvar)//trim(ctrd_trc(jpmld_trc_radb,2)),   &  ! now trcrad    : jpltrd_trc - 1
                  &          it, ztmlrad2(:,:,jn), ndimtrd1, ndextrd1 )
 
-               CALL histwrite( nidtrd(jn), trim(clvar//ctrd_trc(jpmld_trc_atf,2)),    &  ! now Asselin   : jpltrd_trc
+               CALL histwrite( nidtrd(jn), trim(clvar)//trim(ctrd_trc(jpmld_trc_atf,2)),    &  ! now Asselin   : jpltrd_trc
                  &          it, ztmlatf2(:,:,jn), ndimtrd1, ndextrd1 )
 
@@ -1148,5 +1149,5 @@
       !!----------------------------------------------------------------------
       INTEGER :: inum   ! logical unit
-      INTEGER :: ilseq, jl, jn
+      INTEGER :: ilseq, jl, jn, iiter
       REAL(wp) ::   zjulian, zsto, zout
       CHARACTER (LEN=40) ::   clop
@@ -1154,5 +1155,5 @@
       CHARACTER (LEN=12) ::   clmxl
       CHARACTER (LEN=16) ::   cltrcu
-      CHARACTER (LEN= 5) ::   clvar
+      CHARACTER (LEN=10) ::   clvar
 
       !!----------------------------------------------------------------------
@@ -1192,5 +1193,5 @@
       ENDIF
 
-      IF( ln_trcadv_muscl .AND. .NOT. ln_trdmld_trc_instant ) THEN
+      IF( ( ln_trcadv_muscl .OR. ln_trcadv_muscl2 ) .AND. .NOT. ln_trdmld_trc_instant ) THEN
          WRITE(numout,cform_err)
          WRITE(numout,*) '                Currently, you can NOT use simultaneously tracer MUSCL    '
@@ -1205,17 +1206,4 @@
       ENDIF
 
-      IF( ln_trcadv_muscl2 .AND. .NOT. ln_trdmld_trc_instant ) THEN
-         WRITE(numout,cform_err)
-         WRITE(numout,*) '                Currently, you can NOT use simultaneously tracer MUSCL2    '
-         WRITE(numout,*) '                advection and window averaged diagnostics of ML trends.   '
-         WRITE(numout,*) '                WHY? Everything in trdmld_trc is coded for leap-frog, and '
-         WRITE(numout,*) '                MUSCL scheme is Euler forward for passive tracers (note   '
-         WRITE(numout,*) '                that MUSCL is leap-frog for active tracers T/S).          '
-         WRITE(numout,*) '                In particuliar, entrainment trend would be FALSE. However '
-         WRITE(numout,*) '                this residual is correct for instantaneous ML diagnostics.'
-         WRITE(numout,*) 
-         nstop = nstop + 1
-      ENDIF
-
       ! I.2 Initialize arrays to zero or read a restart file
       ! ----------------------------------------------------
@@ -1302,4 +1290,5 @@
 #  endif
       zout = nn_trd_trc * rdt
+      iiter = ( nittrc000 - 1 ) / nn_dttrc
 
       IF(lwp) WRITE (numout,*) '                netCDF initialization'
@@ -1339,5 +1328,5 @@
             CALL dia_nam( clhstnam, nn_trd_trc, csuff )
             CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,                                            &
-               &        1, jpi, 1, jpj, nittrc000, zjulian, rdt, nh_t(jn), nidtrd(jn), domain_id=nidom, snc4chunks=snc4set )
+               &        1, jpi, 1, jpj, iiter, zjulian, rdt, nh_t(jn), nidtrd(jn), domain_id=nidom, snc4chunks=snc4set )
       
             !-- Define the ML depth variable
@@ -1352,5 +1341,5 @@
           CALL dia_nam( clhstnam, nn_trd_trc, 'trdbio' )
           CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,                                            &
-             &             1, jpi, 1, jpj, nittrc000, zjulian, rdt, nh_tb, nidtrdbio, domain_id=nidom, snc4chunks=snc4set )
+             &             1, jpi, 1, jpj, iiter, zjulian, rdt, nh_tb, nidtrdbio, domain_id=nidom, snc4chunks=snc4set )
 #endif
 
@@ -1373,20 +1362,20 @@
          IF( ln_trdtrc(jn) ) THEN
             clvar = trim(ctrcnm(jn))//"ml"                           ! e.g. detml, zooml, no3ml, etc.
-            CALL histdef(nidtrd(jn), clvar,           clmxl//" "//trim(ctrcnm(jn))//" Mixed Layer ",                         &
+            CALL histdef(nidtrd(jn), trim(clvar),           clmxl//" "//trim(ctrcnm(jn))//" Mixed Layer ",                         &
               & "mmole-N/m3", jpi, jpj, nh_t(jn), 1  , 1, 1  , -99 , 32, clop, zsto, zout )           
-            CALL histdef(nidtrd(jn), clvar//"_tot"  , clmxl//" "//trim(ctrcnm(jn))//" Total trend ",                         & 
+            CALL histdef(nidtrd(jn), trim(clvar)//"_tot"  , clmxl//" "//trim(ctrcnm(jn))//" Total trend ",                         & 
               &       cltrcu, jpi, jpj, nh_t(jn), 1  , 1, 1  , -99 , 32, clop, zout, zout ) 
-            CALL histdef(nidtrd(jn), clvar//"_res"  , clmxl//" "//trim(ctrcnm(jn))//" dh/dt Entrainment (Resid.)",           & 
+            CALL histdef(nidtrd(jn), trim(clvar)//"_res"  , clmxl//" "//trim(ctrcnm(jn))//" dh/dt Entrainment (Resid.)",           & 
               &       cltrcu, jpi, jpj, nh_t(jn), 1  , 1, 1  , -99 , 32, clop, zout, zout )                   
          
             DO jl = 1, jpltrd_trc - 2                                ! <== only true if jpltrd_trc == jpmld_trc_atf
-               CALL histdef(nidtrd(jn), trim(clvar//ctrd_trc(jl,2)), clmxl//" "//clvar//ctrd_trc(jl,1),                      & 
+               CALL histdef(nidtrd(jn), trim(clvar)//trim(ctrd_trc(jl,2)), clmxl//" "//clvar//ctrd_trc(jl,1),                      & 
                  &    cltrcu, jpi, jpj, nh_t(jn), 1  , 1, 1  , -99 , 32, clop, zsto, zout ) ! IOIPSL: time mean
             END DO                                                                         ! if zsto=rdt above
          
-            CALL histdef(nidtrd(jn), trim(clvar//ctrd_trc(jpmld_trc_radb,2)), clmxl//" "//clvar//ctrd_trc(jpmld_trc_radb,1), & 
+            CALL histdef(nidtrd(jn), trim(clvar)//trim(ctrd_trc(jpmld_trc_radb,2)), clmxl//" "//clvar//ctrd_trc(jpmld_trc_radb,1), & 
               &       cltrcu, jpi, jpj, nh_t(jn), 1  , 1, 1  , -99 , 32, clop, zout, zout ) ! IOIPSL: NO time mean
          
-            CALL histdef(nidtrd(jn), trim(clvar//ctrd_trc(jpmld_trc_atf,2)), clmxl//" "//clvar//ctrd_trc(jpmld_trc_atf,1),   & 
+            CALL histdef(nidtrd(jn), trim(clvar)//trim(ctrd_trc(jpmld_trc_atf,2)), clmxl//" "//clvar//ctrd_trc(jpmld_trc_atf,1),   & 
               &       cltrcu, jpi, jpj, nh_t(jn), 1  , 1, 1  , -99 , 32, clop, zout, zout ) ! IOIPSL: NO time mean
          !
Index: trunk/NEMOGCM/NEMO/TOP_SRC/TRP/trdmod_trc_oce.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/TRP/trdmod_trc_oce.F90	(revision 3319)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/TRP/trdmod_trc_oce.F90	(revision 3320)
@@ -38,7 +38,7 @@
 
    INTEGER, PARAMETER ::            & !: mixed layer trends indices
-        jpmld_trc_xad     =  1,     & !:     zonal      \
-        jpmld_trc_yad     =  2,     & !:     meridonal   > advection
-        jpmld_trc_zad     =  3,     & !:     vertical   /
+        jpmld_trc_xad     =  1,     & !:     zonal       advection     
+        jpmld_trc_yad     =  2,     & !:     meridonal   =========
+        jpmld_trc_zad     =  3,     & !:     vertical    =========
         jpmld_trc_ldf     =  4,     & !:     lateral diffusion (geopot. or iso-neutral)
         jpmld_trc_zdf     =  5,     & !:     vertical diffusion (TKE)
