Index: branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90
===================================================================
--- branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90	(revision 6174)
+++ branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90	(revision 6201)
@@ -200,4 +200,7 @@
              WRITE(NUMOUT,*) ' '
          END DO  
+# if defined key_debug_medusa
+         CALL flush(numout)
+# endif
       ENDIF
         !
Index: branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/IDTRA/trcsms_idtra.F90
===================================================================
--- branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/IDTRA/trcsms_idtra.F90	(revision 6174)
+++ branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/IDTRA/trcsms_idtra.F90	(revision 6201)
@@ -82,7 +82,10 @@
       !!----------------------------------------------------------------------
       IF (kt == nittrc000) THEN
-         IF(lwp) WRITE(numout,*) '   - JPALM - verif :'
+         IF(lwp) WRITE(numout,*) '   trcsms_idtra :'
          IF(lwp) WRITE(numout,*) '   ~~~~~~~~~~~~~~~~~'
          IF(lwp) WRITE(numout,*) '   - idtra decay factor : ', FDEC
+# if defined key_debug_medusa
+      CALL flush(numout)
+# endif
       ENDIF
 
@@ -160,4 +163,9 @@
       IF( nn_timing == 1 )  CALL timing_stop('trc_sms_idtra')
       !
+# if defined key_debug_medusa
+         IF(lwp) WRITE(numout,*) '   IDTRA DONE trc_sms_idtra -- '
+      CALL flush(numout)
+# endif
+      !
    END SUBROUTINE trc_sms_idtra
 
Index: branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/trcnam.F90
===================================================================
--- branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/trcnam.F90	(revision 6174)
+++ branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/trcnam.F90	(revision 6201)
@@ -270,5 +270,14 @@
       ELSE                    ;   IF(lwp) WRITE(numout,*) '          CFC not used'
       ENDIF
-
+      !
+# if defined key_debug_medusa
+      CALL flush(numout)
+      IF (lwp) write (numout,*) '------------------------------'
+      IF (lwp) write (numout,*) 'Jpalm - debug'
+      IF (lwp) write (numout,*) 'CALL trc_nam_cfc -- OK'
+      IF (lwp) write (numout,*) 'in trc_nam - CALL trc_nam OK'
+      IF (lwp) write (numout,*) ' '
+# endif
+      !
       IF( lk_c14b     ) THEN   ;   CALL trc_nam_c14b         ! C14 bomb     tracers
       ELSE                    ;   IF(lwp) WRITE(numout,*) '          C14 not used'
Index: branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/trcrst.F90
===================================================================
--- branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/trcrst.F90	(revision 6174)
+++ branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/trcrst.F90	(revision 6201)
@@ -86,22 +86,15 @@
       IF( kt == nitrst - 2*nn_dttrc .OR. nstock == nn_dttrc .OR. ( kt == nitend - nn_dttrc .AND. .NOT. lrst_trc ) ) THEN
          IF ( ln_rstdate ) THEN
-            !! JPALM -- 22-12-2015 -- modif to get the good date on restart trc
-            !file name
-            !!                     -- the condition to open the rst file is not
-            !the same than for the dynamic rst.
-            !!                     -- here it - for an obscure reason - is open
-            !2 time-step before the restart writing process
+            !! JPALM -- 22-12-2015 -- modif to get the good date on restart trc file name
+            !!                     -- the condition to open the rst file is not the same than for the dynamic rst.
+            !!                     -- here it - for an obscure reason - is open 2 time-step before the restart writing process
             !!                     instead of 1.
-            !!                     -- i am not sure if someone forgot +1 in the
-            !if loop condition as
-            !!                     it is writen in all comments nitrst -
-            !2*nn_dttrc + 1 and the condition is nitrst - 2*nn_dttrc
-            !!                     -- nevertheless we didn't wanted to broke
-            !something already working 
+            !!                     -- i am not sure if someone forgot +1 in the if loop condition as
+            !!                     it is writen in all comments nitrst -2*nn_dttrc + 1 and the condition is 
+            !!                     nitrst - 2*nn_dttrc
+            !!                     -- nevertheless we didn't wanted to broke something already working 
             !!                     and just adapted the part we added.
-            !!                     -- So instead of calling ju2ymds( fjulday +
-            !(rdttra(1)) ....
-            !!                     we call ju2ymds( fjulday + (2*rdttra(1))
-            !.....
+            !!                     -- So instead of calling ju2ymds( fjulday + (rdttra(1)) 
+            !!                     we call ju2ymds( fjulday + (2*rdttra(1)) 
             !!--------------------------------------------------------------------      
             CALL ju2ymds( fjulday + (2*rdttra(1)) / rday, iyear, imonth, iday, zsec )
@@ -219,4 +212,61 @@
       if (lwp) write (numout,'(a,3f15.5)') 'Sediment Ca ', &
          &        fq0, fq1, fq2
+      !!
+      !! AXY (07/07/15): read in temporally averaged fields for DMS
+      !!                 calculations
+      !!
+      IF( iom_varid( numrtr, 'B_DMS_CHN', ldstop = .FALSE. ) > 0 ) THEN
+         !! YES; in which case read them
+         !!
+         IF(lwp) WRITE(numout,*) ' MEDUSA averaged properties for DMS present - reading in ...'
+         CALL iom_get( numrtr, jpdom_autoglo, 'B_DMS_CHN',  zb_dms_chn(:,:)  )
+         CALL iom_get( numrtr, jpdom_autoglo, 'N_DMS_CHN',  zn_dms_chn(:,:)  )
+         CALL iom_get( numrtr, jpdom_autoglo, 'B_DMS_CHD',  zb_dms_chd(:,:)  )
+         CALL iom_get( numrtr, jpdom_autoglo, 'N_DMS_CHD',  zn_dms_chd(:,:)  )
+         CALL iom_get( numrtr, jpdom_autoglo, 'B_DMS_MLD',  zb_dms_mld(:,:)  )
+         CALL iom_get( numrtr, jpdom_autoglo, 'N_DMS_MLD',  zn_dms_mld(:,:)  )
+         CALL iom_get( numrtr, jpdom_autoglo, 'B_DMS_QSR',  zb_dms_qsr(:,:)  )
+         CALL iom_get( numrtr, jpdom_autoglo, 'N_DMS_QSR',  zn_dms_qsr(:,:)  )
+         CALL iom_get( numrtr, jpdom_autoglo, 'B_DMS_DIN',  zb_dms_din(:,:)  )
+         CALL iom_get( numrtr, jpdom_autoglo, 'N_DMS_DIN',  zn_dms_din(:,:)  )
+      ELSE
+         !! NO; in which case set them to zero
+         !!
+         IF(lwp) WRITE(numout,*) ' MEDUSA averaged properties for DMS absent - setting to zero ...'
+         zb_dms_chn(:,:)  = 0.0   !! CHN
+         zn_dms_chn(:,:)  = 0.0
+         zb_dms_chd(:,:)  = 0.0   !! CHD
+         zn_dms_chd(:,:)  = 0.0
+         zb_dms_mld(:,:)  = 0.0   !! MLD
+         zn_dms_mld(:,:)  = 0.0
+         zb_dms_qsr(:,:)  = 0.0   !! QSR
+         zn_dms_qsr(:,:)  = 0.0
+         zb_dms_din(:,:)  = 0.0   !! DIN
+         zn_dms_din(:,:)  = 0.0
+      ENDIF
+      !!
+      !! calculate stats on these fields
+      IF(lwp) WRITE(numout,*) ' MEDUSA averaged properties for DMS stats (min, max, sum) ...'
+      fq0 = MINVAL(zn_dms_chn(:,:))
+      fq1 = MAXVAL(zn_dms_chn(:,:))
+      fq2 = SUM(zn_dms_chn(:,:))
+      if (lwp) write (numout,'(a,3f15.5)') 'DMS, CHN ', fq0, fq1, fq2
+      fq0 = MINVAL(zn_dms_chd(:,:))
+      fq1 = MAXVAL(zn_dms_chd(:,:))
+      fq2 = SUM(zn_dms_chd(:,:))
+      if (lwp) write (numout,'(a,3f15.5)') 'DMS, CHD ', fq0, fq1, fq2
+      fq0 = MINVAL(zn_dms_mld(:,:))
+      fq1 = MAXVAL(zn_dms_mld(:,:))
+      fq2 = SUM(zn_dms_mld(:,:))
+      if (lwp) write (numout,'(a,3f15.5)') 'DMS, MLD ', fq0, fq1, fq2
+      fq0 = MINVAL(zn_dms_qsr(:,:))
+      fq1 = MAXVAL(zn_dms_qsr(:,:))
+      fq2 = SUM(zn_dms_qsr(:,:))
+      if (lwp) write (numout,'(a,3f15.5)') 'DMS, QSR ', fq0, fq1, fq2
+      fq0 = MINVAL(zn_dms_din(:,:))
+      fq1 = MAXVAL(zn_dms_din(:,:))
+      fq2 = SUM(zn_dms_din(:,:))
+      if (lwp) write (numout,'(a,3f15.5)') 'DMS, DIN ', fq0, fq1, fq2
+
 #endif
  
@@ -300,4 +350,43 @@
       if (lwp) write (numout,'(a,3f15.5)') 'Sediment Ca ', &
          &        fq0, fq1, fq2
+      !!
+      !! AXY (07/07/15): write out temporally averaged fields for DMS
+      !!                 calculations
+      !!
+      IF(lwp) WRITE(numout,*) ' MEDUSA averaged properties for DMS - writing out ...'
+      CALL iom_rstput( kt, nitrst, numrtw, 'B_DMS_CHN',  zb_dms_chn(:,:)  )
+      CALL iom_rstput( kt, nitrst, numrtw, 'N_DMS_CHN',  zn_dms_chn(:,:)  )
+      CALL iom_rstput( kt, nitrst, numrtw, 'B_DMS_CHD',  zb_dms_chd(:,:)  )
+      CALL iom_rstput( kt, nitrst, numrtw, 'N_DMS_CHD',  zn_dms_chd(:,:)  )
+      CALL iom_rstput( kt, nitrst, numrtw, 'B_DMS_MLD',  zb_dms_mld(:,:)  )
+      CALL iom_rstput( kt, nitrst, numrtw, 'N_DMS_MLD',  zn_dms_mld(:,:)  )
+      CALL iom_rstput( kt, nitrst, numrtw, 'B_DMS_QSR',  zb_dms_qsr(:,:)  )
+      CALL iom_rstput( kt, nitrst, numrtw, 'N_DMS_QSR',  zn_dms_qsr(:,:)  )
+      CALL iom_rstput( kt, nitrst, numrtw, 'B_DMS_DIN',  zb_dms_din(:,:)  )
+      CALL iom_rstput( kt, nitrst, numrtw, 'N_DMS_DIN',  zn_dms_din(:,:)  )
+      !!
+      !! calculate stats on these fields
+      IF(lwp) WRITE(numout,*) ' MEDUSA averaged properties for DMS stats (min, max, sum) ...'
+      fq0 = MINVAL(zn_dms_chn(:,:))
+      fq1 = MAXVAL(zn_dms_chn(:,:))
+      fq2 = SUM(zn_dms_chn(:,:))
+      if (lwp) write (numout,'(a,3f15.5)') 'DMS, CHN ', fq0, fq1, fq2
+      fq0 = MINVAL(zn_dms_chd(:,:))
+      fq1 = MAXVAL(zn_dms_chd(:,:))
+      fq2 = SUM(zn_dms_chd(:,:))
+      if (lwp) write (numout,'(a,3f15.5)') 'DMS, CHD ', fq0, fq1, fq2
+      fq0 = MINVAL(zn_dms_mld(:,:))
+      fq1 = MAXVAL(zn_dms_mld(:,:))
+      fq2 = SUM(zn_dms_mld(:,:))
+      if (lwp) write (numout,'(a,3f15.5)') 'DMS, MLD ', fq0, fq1, fq2
+      fq0 = MINVAL(zn_dms_qsr(:,:))
+      fq1 = MAXVAL(zn_dms_qsr(:,:))
+      fq2 = SUM(zn_dms_qsr(:,:))
+      if (lwp) write (numout,'(a,3f15.5)') 'DMS, QSR ', fq0, fq1, fq2
+      fq0 = MINVAL(zn_dms_din(:,:))
+      fq1 = MAXVAL(zn_dms_din(:,:))
+      fq2 = SUM(zn_dms_din(:,:))
+      if (lwp) write (numout,'(a,3f15.5)') 'DMS, DIN ', fq0, fq1, fq2
+      !! 
 #endif
 
Index: branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/trcsms.F90
===================================================================
--- branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/trcsms.F90	(revision 6174)
+++ branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/trcsms.F90	(revision 6201)
@@ -52,6 +52,18 @@
       IF( lk_pisces  )   CALL trc_sms_pisces ( kt )    ! main program of PISCES 
       IF( lk_medusa  )   CALL trc_sms_medusa ( kt )    ! MEDUSA  tracers
+# if defined key_debug_medusa
+         IF(lwp) WRITE(numout,*) '--trcsms : MEDUSA OK --  next IDTRA -- '
+      CALL flush(numout)
+# endif
       IF( lk_idtra   )   CALL trc_sms_idtra  ( kt )    ! radioactive decay of Id. tracer
+# if defined key_debug_medusa
+         IF(lwp) WRITE(numout,*) '--trcsms : IDTRA OK --  next CFC -- '
+      CALL flush(numout)
+# endif
       IF( lk_cfc     )   CALL trc_sms_cfc    ( kt )    ! surface fluxes of CFC
+# if defined key_debug_medusa
+         IF(lwp) WRITE(numout,*) '--trcsms : CFC OK --  continue -- '
+      CALL flush(numout)
+# endif
       IF( lk_c14b    )   CALL trc_sms_c14b   ( kt )    ! surface fluxes of C14
       IF( lk_my_trc  )   CALL trc_sms_my_trc ( kt )    ! MY_TRC  tracers
