Index: branches/dev_001_GM/NEMO/TOP_SRC/trcrst.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/trcrst.F90	(revision 740)
+++ branches/dev_001_GM/NEMO/TOP_SRC/trcrst.F90	(revision 763)
@@ -1,18 +1,17 @@
 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_passivetrc
+   !!----------------------------------------------------------------------
+   !!   'key_passivetrc'                                    Passive tracers
+   !!----------------------------------------------------------------------
+   !!   trc_rst_opn    : open  restart file
+   !!   trc_rst_read   : read  restart file
+   !!   trc_rst_wri    : write restart file
+   !!----------------------------------------------------------------------
    USE oce_trc
    USE trc
@@ -25,16 +24,18 @@
    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)
 
-
    !! * Substitutions
 #  include "passivetrc_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005) 
+   !! $Id:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
    
 CONTAINS
@@ -52,10 +53,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 +63,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,69 +78,32 @@
 
    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_cfg_1d && ( 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,*) ' '
+      !! ** purpose  :   read passive tracer fields in restart files
+      !!----------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk, jn  
+      INTEGER  ::   iarak0    
+      REAL(wp) ::   zkt, zarak0
+      REAL(wp) ::   caralk, bicarb, co3
+      REAL(wp) ::   ztrasum
+      !!----------------------------------------------------------------------
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) 'trc_rst_read : read restart file of the passive tracers'
+      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~'
+
+      ztrasum = 0.e0
+      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 ??? '
       ENDIF
 
       ! Time domain : restart
       ! -------------------------
-
-      IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*) ' *** passive tracer restart option'
@@ -168,147 +129,116 @@
       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( 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_trc_lobster1
       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_trc_pisces
       CALL iom_get( numrtr, jpdom_local, 'Silicalim', xksi(:,:) ) 
       xksimax = xksi
-
-#elif defined key_cfc
+# 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_cfg_1d && ( 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
+# endif
+
+# if defined key_trc_pisces 
+      !                                                         ! --------------------------- !
+      IF( cp_cfg == "orca" .AND. .NOT. lk_trccfg_1d ) 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  
+
+         IF(lwp) WRITE(numout,*) 'TALK moyen ', ztrasum / areatot * 1.e6
+         ztrasum = ztrasum / areatot * 1.e6
+         trn(:,:,:,jptal) = trn(:,:,:,jptal) * 2391. / 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  
+
+         IF(lwp) WRITE(numout,*) 'PO4 moyen ', ztrasum/areatot*1E6/122.
+         ztrasum = ztrasum / areatot * 1.e6 / 122.
+         trn(:,:,:,jppo4) = trn(:,:,:,jppo4) * 2.165 / 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  
+
+         IF(lwp) WRITE(numout,*) 'NO3 moyen ', ztrasum / areatot*1.e6 / 7.6
+         ztrasum = ztrasum / areatot * 1.e6 / 7.6
+         trn(:,:,:,jpno3) = trn(:,:,:,jpno3) * 30.9 / 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) * 91.51 / ztrasum ) 
+         !
+      ENDIF
 
 !#if defined key_trc_kriest
@@ -319,98 +249,46 @@
 !      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
+               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
       trb(:,:,:,:) = trn(:,:,:,:)
 
       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
       !!
-      !!  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
       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( 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 (NetCDF) ',   &
+            &                              'at it= ',kt,' date= ',ndastp
          IF(lwp) WRITE(numout,*) '~~~~~~~~~'
 
@@ -427,10 +305,6 @@
          ! 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
@@ -443,48 +317,43 @@
 
 #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) )
          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
-
+            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
 
@@ -495,27 +364,22 @@
 
          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
