Index: /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/air_sea.F90
===================================================================
--- /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/air_sea.F90	(revision 8022)
+++ /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/air_sea.F90	(revision 8023)
@@ -32,8 +32,12 @@
       !!  - river inputs
       !!----------------------------------------------------------------------
-      USE bio_medusa_mod,    ONLY: dms_andr, dms_andr2d, dms_aran,        &
+      USE bio_medusa_mod,    ONLY: f_riv_alk, f_riv_c, f_riv_n,           &
+                                   f_riv_si, f_runoff,                    & 
+                                   fgco2,                                 &
+# if defined key_roam
+                                   dms_andr, dms_andr2d, dms_aran,        &
                                    dms_aran2d, dms_hall, dms_hall2d,      &
                                    dms_simo, dms_simo2d, dms_surf,        &
-                                   dms_surf2d, iters, f_BetaD,            &
+                                   dms_surf2d, f_BetaD,                   &
                                    f_co2flux, f_co2flux2d, f_co2starair,  &
                                    f_co2starair_2d, f_co3,                &
@@ -50,16 +54,18 @@
                                    f_pco2w, f_pco2w2d, f_ph, f_pp0,       &
                                    f_pp02d, f_rhosw,                      &
-                                   f_riv_alk, f_riv_c, f_riv_n,           &
-                                   f_riv_si, f_runoff,                    & 
                                    f_schmidtco2, f_TALK, f_TALK2d,        &
                                    f_TDIC, f_TDIC2d, f_xco2a, f_xco2a_2d, &
-                                   fgco2,                                 &
-                                   zalk, zchd, zchn, zdic, zdin, zoxy,    &
-                                   zpho, zsal, zsil, ztmp
+                                   iters,                                 &
+                                   zalk, zdic, zoxy, zsal, ztmp,          &
+# endif
+# if defined key_mocsy
+                                   zpho,                                  &
+# endif
+                                   zchd, zchn, zdin, zsil
       USE dom_oce,           ONLY: e3t_0, e3t_n, gphit, tmask
-      USE gastransfer,       ONLY: gas_transfer
+# if defined key_iomput
       USE iom,               ONLY: lk_iomput
+# endif
       USE in_out_manager,    ONLY: lwp, numout
-      USE mocsy_wrapper,     ONLY: mocsy_interface
       USE oce,               ONLY: PCO2a_in_cpl
       USE par_oce,           ONLY: jpim1, jpjm1
@@ -72,8 +78,16 @@
                                    zn_dms_mld, zn_dms_qsr 
       USE trc,               ONLY: med_diag
+      USE zdfmxl,            ONLY: hmld
+
+# if defined key_roam
+      USE gastransfer,       ONLY: gas_transfer
+#  if defined key_mocsy
+      USE mocsy_wrapper,     ONLY: mocsy_interface
+#  else
       USE trcco2_medusa,     ONLY: trc_co2_medusa
+#  endif
       USE trcdms_medusa,     ONLY: trc_dms_medusa
       USE trcoxy_medusa,     ONLY: trc_oxy_medusa
-      USE zdfmxl,            ONLY: hmld
+# endif
 
    !!* Substitution
@@ -83,8 +97,10 @@
       INTEGER, INTENT( in ) :: kt
 
+# if defined key_roam
       !! jpalm 14-07-2016: convert CO2flux diag from mmol/m2/d to kg/m2/s
       REAL, PARAMETER :: weight_CO2_mol = 44.0095  !! g / mol
       REAL, PARAMETER :: secs_in_day    = 86400.0  !! s / d
       REAL, PARAMETER :: CO2flux_conv   = (1.e-6 * weight_CO2_mol) / secs_in_day
+# endif
 
       INTEGER :: ji, jj
Index: /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_diag.F90
===================================================================
--- /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_diag.F90	(revision 8022)
+++ /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_diag.F90	(revision 8023)
@@ -30,100 +30,11 @@
       !! This called from TRC_BIO_MEDUSA and calculates diagnostics
       !!-------------------------------------------------------------------
-      USE bio_medusa_mod,    ONLY: dcalc3, dms_andr, dms_aran,           &
-                                   dms_hall, dms_simo, dms_surf,         &
-                                   f_benout_c, f_benout_ca, f_benout_fe, &
-                                   f_benout_lyso_ca, f_benout_n,         &
-                                   f_benout_si,                          &
-                                   f_co2flux, f_co3,                     &
-                                   f_fbenin_c, f_fbenin_ca, f_fbenin_fe, &
-                                   f_fbenin_n, f_fbenin_si,              &
-                                   f_h2co3, f_hco3,                      &
-                                   f_kw660,                              &
-                                   f_o2flux, f_o2sat, f_omarg, f_omcal,  &
-                                   f_pco2atm, f_pco2w, f_ph, f_pp0,      &
-                                   f_riv_loc_alk, f_riv_loc_c,           &
-                                   f_riv_loc_n, f_riv_loc_si,            &
-                                   f_runoff,                             &
-                                   f_sbenin_c, f_sbenin_fe,              &
-                                   f_sbenin_n,                           &
-                                   f_TALK, f_TDIC,                       &
-                                   fccd, fcomm_resp,                     &
-                                   fd_cal3, fd_car3, fd_nit3, fd_sil3,   &
-                                   fdep1,                                &
-                                   fdd, fdd2d, fddc,                     &
-                                   fdpd, fdpd2, fdpd22d, fdpd2d,         &
-                                   fdpn, fdpn2, fdpn22d, fdpn2d,         &
-                                   fdzme, fdzme2, fdzme22d, fdzme2d,     &
-                                   fdzmi, fdzmi2, fdzmi22d, fdzmi2d,     &
-                                   fediss3, fescav3,                     &
-                                   ffastc, ffastca, ffastca2d,           &
-                                   ffastn, ffastsi,                      &
-                                   ffebot, ffebot2d, ffescav, ffescav2d, &
-                                   ffetop, ffetop2d,                     &
-                                   ffld, ffld2d, ffln2, ffln2d,          &
-                                   fgmed, fgmed2d, fgmedc,               &
-                                   fgmepd, fgmepd2d, fgmepn, fgmepn2d,   &
-                                   fgmezmi, fgmezmi2d,                   &
-                                   fgmid, fgmid2d, fgmidc,               &
-                                   fgmipn, fgmipn2d,                     &
-                                   ficme, ficmi, finme, finmi,           &
-                                   fjlim_pd, fjlim_pn, fjld2d, fjln2d,   &
-                                   fmeexcr, fmegrow, fmeresp,            &
-                                   fmiexcr, fmigrow, fmiresp,            &
-                                   fnld, fnld2d, fnln, fnln2d,           &
-                                   fprd, fprd_ml, fprd2d,                &
-                                   fprds, fprds2d,                       & 
-                                   fprn, fprn_ml, fprn2d,                &
-                                   fregen, fregen2d,                     &
-                                   fregenfast, fregenfastsi,             &
-                                   fregensi, fregensi2d,                 &
-                                   freminc, freminc2d,                   &
-                                   freminca, freminca2d,                 & 
-                                   freminfe, freminfe2d,                 &
-                                   freminn, freminn2d,                   &
-                                   freminsi, freminsi2d,                 &
-                                   fsdiss, fsdiss2d,                     &
-                                   fsedc, fsedca, fsedfe, fsedn, fsedsi, &
-                                   fsld, fsld2, fsld2d, fsld2d2,         &
-                                   fslown, fslowc, fslown2d,             &
-                                   fslowc2d, fslowcflux, fslownflux,     &
-                                   ftempc, ftempc2d, ftempca, ftempca2d, &
-                                   ftempfe, ftempfe2d,                   &
-                                   ftempn, ftempn2d, ftempsi, ftempsi2d, &
-                                   ftot_a, ftot_c, ftot_fe, ftot_n,      &
-                                   ftot_o2, ftot_si,                     &
-                                   gmedc2d, gmidc2d,                     &
-                                   iben_c2d, iben_ca2d, iben_fe2d,       &
-                                   iben_n2d, iben_si2d,                  &
-                                   intdissic, intdissin,                 &
-                                   intdissisi, inttalk,                  &
-                                   iters, lyso_ca2d,                     &
-                                   mdetc2d, megrazd3, megrazp3,          &
-                                   megrazz3,                             & 
-                                   migrazd3, migrazp3,                   &
-                                   o2min, o2sat3,                        &
-                                   oben_c2d, oben_ca2d, oben_fe2d,       &
-                                   oben_n2d, oben_si2d,                  &
-                                   pbsi3, pcal3,                         &
-                                   pdlimfe3, pdlimj3, pdlimn3,           &
-                                   pnlimfe3, pnlimj3, pnlimn3, pdlimsi3, &
-                                   remin3dn, remoc3,                     &
-                                   rivalk2d, rivc2d, rivn2d, rivsi2d,    &
-                                   sfr_oarg2d, sfr_ocal2d,               &
-                                   tpp3d, tppd3, xFree,                  &
-                                   zeexcr2d, zegrow2d, zemesc2d,         &
-                                   zemesd2d, zemesdc2d, zemesn2d,        &
-                                   zeresp2d,                             &
-                                   ziexcr2d, zigrow2d, zimesc2d,         &
-                                   zimesd2d, zimesdc2d, zimesn2d,        &
-                                   ziresp2d,                             &
-                                   zo2min,                               &
-                                   zalk, zdet, zdic, zdin, zdtc,         &
-                                   zfer, zoxy, zpds, zphd, zphn,         &
-                                   zsal, zsil, ztmp, zzme, zzmi
+      USE bio_medusa_mod
       USE dom_oce,           ONLY: e3t_0, e3t_n, gdepw_0, gdepw_n,       &
                                    mbathy, tmask
       USE in_out_manager,    ONLY: lwp, numout
+# if defined key_iomput
       USE iom,               ONLY: lk_iomput
+# endif
       USE par_kind,          ONLY: wp
       USE par_oce,           ONLY: jpim1, jpjm1
@@ -137,5 +48,7 @@
                                    xthetapd, xthetapn, xthetazme, xthetazmi, xze
       USE trc,               ONLY: ln_diatrc, med_diag, trc2d, trc3d 
+# if defined key_roam
       USE trcoxy_medusa,     ONLY: oxy_sato
+# endif
 
    !!* Substitution
Index: /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_diag_slice.F90
===================================================================
--- /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_diag_slice.F90	(revision 8022)
+++ /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_diag_slice.F90	(revision 8023)
@@ -34,5 +34,7 @@
       USE dom_oce,           ONLY: tmask
       USE in_out_manager,    ONLY: lwp, numout
+# if defined key_iomput
       USE iom,               ONLY: iom_put
+# endif
       USE lbclnk,            ONLY: lbc_lnk
       USE oce,               ONLY: CO2Flux_out_cpl, DMS_out_cpl
Index: /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_fin.F90
===================================================================
--- /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_fin.F90	(revision 8022)
+++ /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_fin.F90	(revision 8023)
@@ -34,5 +34,7 @@
       USE dom_oce,           ONLY: atfp, atfp1, neuler, rdt
       USE in_out_manager,    ONLY: lwp, numout
+# if defined key_iomput
       USE iom,               ONLY: iom_put, lk_iomput
+# endif
       USE lbclnk,            ONLY: lbc_lnk
       USE par_medusa,        ONLY: jp_medusa_2d, jp_medusa_3d,          &
Index: /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_init.F90
===================================================================
--- /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_init.F90	(revision 8022)
+++ /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_init.F90	(revision 8023)
@@ -33,10 +33,14 @@
       !!---------------------------------------------------------------------- 
       USE bio_medusa_mod
-      USE iom,               ONLY: lk_iomput, numout
       USE par_oce,           ONLY: jpi, jpj, jpk
       USE sms_medusa,        ONLY: jdms
-      USE trc,               ONLY: ln_diatrc, med_diag, nittrc000
+      USE trc,               ONLY: ln_diatrc, med_diag, nittrc000,     &
+                                   trc2d, trc3d
+      USE wrk_nemo,          ONLY: wrk_alloc
+
+# if defined key_iomput
+      USE iom,               ONLY: lk_iomput, numout
       USE trcnam_medusa,     ONLY: trc_nam_iom_medusa
-      USE wrk_nemo,          ONLY: wrk_alloc
+# endif
 
       !! time (integer timestep)
@@ -47,4 +51,13 @@
       flush(numout)
 !
+
+      IF( ln_diatrc ) THEN
+         !! blank 2D diagnostic array
+         trc2d(:,:,:) = 0.e0
+         !!
+         !! blank 3D diagnostic array
+         trc3d(:,:,:,:) = 0.e0
+      ENDIF
+
       !!----------------------------------------------------------------------
       !! Zero fast-sinking detritus 2D fields
@@ -92,9 +105,11 @@
       ftot_o2(:,:) = 0.0        !! oxygen     inventory
       fifd_c(:,:)  = 0.0        !! carbon     fast detritus production
-      fifd_a(:,:)  = 0.0        !! alkalinity fast detritus production
-      fifd_o2(:,:) = 0.0        !! oxygen     fast detritus production
+! I don't think fifd_a or fifd_o2 are used - marc 11/5/17
+!      fifd_a(:,:)  = 0.0        !! alkalinity fast detritus production
+!      fifd_o2(:,:) = 0.0        !! oxygen     fast detritus production
       fofd_c(:,:)  = 0.0        !! carbon     fast detritus remineralisation
-      fofd_a(:,:)  = 0.0        !! alkalinity fast detritus remineralisation
-      fofd_o2(:,:) = 0.0        !! oxygen     fast detritus remineralisation
+! I don't think fofd_a or fofd_o2 are used - marc 11/5/17
+!      fofd_a(:,:)  = 0.0        !! alkalinity fast detritus remineralisation
+!      fofd_o2(:,:) = 0.0        !! oxygen     fast detritus remineralisation
       !!
       fnit_prod(:,:) = 0.0      !! (organic)   nitrogen production
Index: /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_mod.F90
===================================================================
--- /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_mod.F90	(revision 8022)
+++ /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_mod.F90	(revision 8023)
@@ -11,4 +11,12 @@
    !!----------------------------------------------------------------------
    !!   'key_medusa'                                           MEDUSA
+   !!----------------------------------------------------------------------
+   !! Variable conventions
+   !!----------------------------------------------------------------------
+   !!
+   !! names: z*** - state variable 
+   !!        f*** - function (or temporary variable used in part of a function)
+   !!        b*** - right-hand part (sources and sinks)
+   !!        i*** - integer variable (usually used in yes/no flags)
    !!----------------------------------------------------------------------
    USE par_kind,          ONLY: wp
@@ -115,6 +123,9 @@
    REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: ftot_c,ftot_a,ftot_o2
    REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: fflx_c,fflx_a,fflx_o2
-   REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: fifd_c,fifd_a,fifd_o2
-   REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: fofd_c,fofd_a,fofd_o2
+! I don't think fifd_a, fifd_o2, fofd_a or fofd_o2 are used - marc 11/5/17
+!   REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: fifd_c,fifd_a,fifd_o2
+!   REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: fofd_c,fofd_a,fofd_o2
+   REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: fifd_c
+   REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: fofd_c
 # endif
 
@@ -136,4 +147,5 @@
    REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: fsil_prod,fsil_cons
 
+# if defined key_roam
    REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: f_xco2a
    REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: f_ph,f_pco2w,f_h2co3
@@ -163,4 +175,5 @@
    !! AXY (13/03/15): add in other DMS calculations
    REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: dms_andr,dms_simo,dms_aran,dms_hall
+# endif
 
    !! Benthic fluxes
@@ -266,5 +279,4 @@
       USE lib_mpp,           ONLY: ctl_warn
       USE par_oce,           ONLY: jpi, jpj
-!    USE par_trc
       !!-------------------------------------------------------------------
       !
@@ -273,7 +285,11 @@
                zzme(jpi,jpj),zdet(jpi,jpj),zdtc(jpi,jpj),             &
                zdin(jpi,jpj),zsil(jpi,jpj),zfer(jpi,jpj),             &
+# if defined key_roam
                zdic(jpi,jpj),zalk(jpi,jpj),zoxy(jpi,jpj),             &
                ztmp(jpi,jpj),zsal(jpi,jpj),                           &
+# endif
+# if defined key_mocsy
                zpho(jpi,jpj),                                         &
+# endif
                fthetan(jpi,jpj),faln(jpi,jpj),fchn1(jpi,jpj),         &
                fchn(jpi,jpj),fjln(jpi,jpj),fprn(jpi,jpj),             &
@@ -307,5 +323,7 @@
                fdpn(jpi,jpj),fdpd(jpi,jpj),fdpds(jpi,jpj),            &
                fdzmi(jpi,jpj),fdzme(jpi,jpj),fdd(jpi,jpj),            &
+# if defined key_roam
                fddc(jpi,jpj),                                         &
+# endif
                fdpn2(jpi,jpj),fdpd2(jpi,jpj),fdpds2(jpi,jpj),         &
                fdzmi2(jpi,jpj),fdzme2(jpi,jpj),                       &
@@ -337,6 +355,9 @@
                ftot_c(jpi,jpj),ftot_a(jpi,jpj),ftot_o2(jpi,jpj),      &
                fflx_c(jpi,jpj),fflx_a(jpi,jpj),fflx_o2(jpi,jpj),      &
-               fifd_c(jpi,jpj),fifd_a(jpi,jpj),fifd_o2(jpi,jpj),      &
-               fofd_c(jpi,jpj),fofd_a(jpi,jpj),fofd_o2(jpi,jpj),      &
+! I don't think fifd_a, fifd_o2, fofd_a or fofd_o2 are used - marc 11/5/17
+!               fifd_c(jpi,jpj),fifd_a(jpi,jpj),fifd_o2(jpi,jpj),      &
+!               fofd_c(jpi,jpj),fofd_a(jpi,jpj),fofd_o2(jpi,jpj),      &
+               fifd_c(jpi,jpj),                                       &
+               fofd_c(jpi,jpj),                                       &
 # endif
                fzmi_i(jpi,jpj),fzmi_o(jpi,jpj),fzme_i(jpi,jpj),       &
@@ -347,4 +368,5 @@
                fnit_prod(jpi,jpj),fnit_cons(jpi,jpj),                 &
                fsil_prod(jpi,jpj),fsil_cons(jpi,jpj),                 &
+# if defined key_roam
                f_xco2a(jpi,jpj),                                      &
                f_ph(jpi,jpj),f_pco2w(jpi,jpj),f_h2co3(jpi,jpj),       &
@@ -369,4 +391,5 @@
                dms_andr(jpi,jpj),dms_simo(jpi,jpj),                   &
                dms_aran(jpi,jpj),dms_hall(jpi,jpj),                   &
+# endif
                f_sbenin_n(jpi,jpj),f_sbenin_fe(jpi,jpj),              &
                f_sbenin_c(jpi,jpj),                                   &
Index: /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_update.F90
===================================================================
--- /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_update.F90	(revision 8022)
+++ /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_update.F90	(revision 8023)
@@ -41,12 +41,10 @@
                                    fbddtalk, fbddtdic, fbddtdife,            &
                                    fbddtdin, fbddtdisi,                      & 
-                                   fcar_cons, fcar_prod, fcomm_resp,         &
-                                   fdd, fddc, fdpd, fdpd2, fdpds, fdpds2,    &
+                                   fdd, fdpd, fdpd2, fdpds, fdpds2,          &
                                    fdpn, fdpn2,                              &
                                    fdzme, fdzme2, fdzmi, fdzmi2,             &
                                    ffast2slowc, ffast2slown,                 &
                                    ffebot, ffetop, ffescav,                  &
-                                   fflx_a, fflx_c, fflx_fe, fflx_n,          &
-                                   fflx_o2, fflx_si,                         &
+                                   fflx_fe, fflx_n, fflx_si,                 &
                                    fgmed, fgmepd, fgmedc, fgmepd, fgmepds,   &
                                    fgmepn, fgmezmi,                          &
@@ -56,5 +54,4 @@
                                    fmiexcr, fmigrow, fmiresp,                &
                                    fnit_cons, fnit_prod,                     &
-                                   foxy_anox, foxy_cons, foxy_prod,          &
                                    fprd, fprds, fprn,                        &
                                    frd,                                      &
@@ -63,5 +60,10 @@
                                    fsil_cons, fsil_prod, fsdiss,             &
                                    ftempca, fthetad, fthetan,                &
-                                   zoxy, zpds, zphd, zphn
+# if defined key_roam
+                                   fcar_cons, fcar_prod, fcomm_resp,         &
+                                   fddc, fflx_a, fflx_c, fflx_o2, zoxy,      &
+                                   foxy_anox, foxy_cons, foxy_prod,          &
+# endif
+                                   zpds, zphd, zphn
       USE dom_oce,           ONLY: e3t_0, e3t_n, gphit, mbathy, tmask
       USE in_out_manager,    ONLY: lwp, numout
Index: /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/carb_chem.F90
===================================================================
--- /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/carb_chem.F90	(revision 8022)
+++ /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/carb_chem.F90	(revision 8023)
@@ -39,9 +39,11 @@
                                    f_pco2w, f_ph, f_pp0, f_rhosw,         &
                                    f_schmidtco2, f_TALK, f_TDIC, f_xco2a, &
-                                   zalk, zdic, zpho, zsal, zsil, ztmp 
+# if defined key_mocsy
+                                   zpho,                                  &
+# endif
+                                   zalk, zdic, zsal, zsil, ztmp 
       USE dom_oce,           ONLY: gdept_0, gdept_n, gdepw_0, gdepw_n,    &
                                    gphit, mbathy, tmask
       USE in_out_manager,    ONLY: lwp, numout
-      USE mocsy_wrapper,     ONLY: mocsy_interface
       USE oce,               ONLY: PCO2a_in_cpl, tsb, tsn
       USE par_kind,          ONLY: wp
@@ -54,5 +56,10 @@
                                    f3_omcal, f3_pH
       USE trc,               ONLY: trn
+
+# if defined key_mocsy
+      USE mocsy_wrapper,     ONLY: mocsy_interface
+# else
       USE trcco2_medusa,     ONLY: trc_co2_medusa
+# endif
 
    !!* Substitution
Index: /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/detritus.F90
===================================================================
--- /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/detritus.F90	(revision 8022)
+++ /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/detritus.F90	(revision 8023)
@@ -32,7 +32,9 @@
       !!  - Fast-sinking detritus 
       !!-------------------------------------------------------------------
-      USE bio_medusa_mod,         ONLY: fdd, fddc,                         &
-                                        f_sbenin_c, f_sbenin_fe,           &
-                                        f_sbenin_n,                        &
+      USE bio_medusa_mod,         ONLY: f_sbenin_c, f_sbenin_fe,           &
+                                        f_sbenin_n, fdd,                   &
+# if defined key_roam
+                                        fddc,                              &
+# endif
                                         fun_T, fun_Q10, zdet, zdtc
       USE detritus_fast_sink_mod, ONLY: detritus_fast_sink
Index: /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/detritus_fast_sink.F90
===================================================================
--- /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/detritus_fast_sink.F90	(revision 8022)
+++ /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/detritus_fast_sink.F90	(revision 8023)
@@ -48,5 +48,5 @@
                                    fgmid, fgmipn,                          &
                                    ficme, ficmi,                           &
-                                   fifd_c, fifd_fe, fifd_n, fifd_si,       &
+                                   fifd_fe, fifd_n, fifd_si,               &
                                    finme, finmi,                           &
                                    fmeexcr, fmiexcr,                       &
@@ -64,5 +64,5 @@
                                    ftempsi,                                &
 # if defined key_roam
-                                   fofd_c, fregenfastc,                    &
+                                   fifd_c, fofd_c, fregenfastc,            &
 # endif
                                    idf, idfval,                            &
Index: /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcbio_medusa.F90
===================================================================
--- /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcbio_medusa.F90	(revision 8022)
+++ /branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcbio_medusa.F90	(revision 8023)
@@ -6,5 +6,6 @@
    !! History :
    !!  -   !  1999-07  (M. Levy)              original code
-   !!  -   !  2000-12  (E. Kestenare)         assign parameters to name individual tracers
+   !!  -   !  2000-12  (E. Kestenare)         assign parameters to name 
+   !!                                         individual tracers
    !!  -   !  2001-03  (M. Levy)              LNO3 + dia2d 
    !! 2.0  !  2007-12  (C. Deltel, G. Madec)  F90
@@ -18,5 +19,6 @@
    !!  -   !  2015-06  (A. Yool)              Update to include MOCSY
    !!  -   !  2015-07  (A. Yool)              Update for rolling averages
-   !!  -   !  2015-10  (J. Palm)              Update for diag outputs through iom_use  
+   !!  -   !  2015-10  (J. Palm)              Update for diag outputs through 
+   !!                                         iom_use  
    !!  -   !  2016-11  (A. Yool)              Updated diags for CMIP6
    !!----------------------------------------------------------------------
@@ -59,42 +61,44 @@
    !!   trc_bio_medusa        :  
    !!----------------------------------------------------------------------
-      USE oce_trc
-      USE trc
-      USE sms_medusa
-      USE lbclnk
-      USE prtctl_trc      ! Print control for debugging
-      USE trcsed_medusa
-      USE sbc_oce         ! surface forcing
-      USE sbcrnf          ! surface boundary condition: runoff variables
-      USE in_out_manager  ! I/O manager
-# if defined key_iomput
-      USE iom
-      USE trcnam_medusa         ! JPALM 13-11-2015 -- if iom_use for diag
-      !!USE trc_nam_iom_medusa  ! JPALM 13-11-2015 -- if iom_use for diag
-# endif
-# if defined key_roam
-      USE gastransfer
-#  if defined key_mocsy
-      USE mocsy_wrapper
-#  else
-      USE trcco2_medusa
-#  endif
-      USE trcoxy_medusa
-      !! Jpalm (08/08/2014)
-      USE trcdms_medusa
-# endif
-      !! AXY (18/01/12): brought in for benthic timestepping
-      USE trcnam_trp      ! AXY (24/05/2013)
-      USE trdmxl_trc
-      USE trdtrc_oce  ! AXY (24/05/2013)
-
       !! AXY (30/01/14): necessary to find NaNs on HECTOR
       USE, INTRINSIC :: ieee_arithmetic 
 
+      USE bio_medusa_mod,             ONLY: b0, fdep1,                      & 
+                                            ibenthic, idf, idfval,          &
+# if defined key_roam
+                                            f_xco2a,                        &
+                                            zalk, zdic, zoxy, zsal, ztmp,   &
+# endif
+# if defined key_mocsy
+                                            zpho,                           &
+# endif
+                                            zchd, zchn, zdet, zdin, zdtc,   &
+                                            zfer, zpds, zphd, zphn, zsil,   &
+                                            zzme, zzmi
+      USE dom_oce,                    ONLY: e3t_0, e3t_n,                   &
+                                            gdept_0, gdept_n,               &
+                                            gdepw_0, gdepw_n,               &
+                                            nday_year, nsec_day, nyear,     &
+                                            rdt, tmask
+      USE in_out_manager,             ONLY: lwp, numout
+# if defined key_iomput
+      USE iom,                        ONLY: lk_iomput
+# endif
+      USE lbclnk,                     ONLY: lbc_lnk
+      USE lib_mpp,                    ONLY: ctl_stop
+      USE oce,                        ONLY: tsb, tsn
+      USE par_kind,                   ONLY: wp
+      USE par_medusa,                 ONLY: jpalk, jpchd, jpchn, jpdet,     &
+                                            jpdic, jpdin, jpdtc, jpfer,     &
+                                            jpoxy, jppds, jpphd, jpphn,     &
+                                            jpsil, jpzme, jpzmi
+      USE par_oce,                    ONLY: jp_sal, jp_tem, jpi, jpim1,     &
+                                            jpj, jpjm1, jpk
       !! JPALM (27-06-2016): add lk_oasis for CO2 and DMS coupling with atm
       USE sbc_oce,                    ONLY: lk_oasis
-      USE oce,                        ONLY: CO2Flux_out_cpl, DMS_out_cpl,   &
-                                            PCO2a_in_cpl
-      USE bio_medusa_mod
+      USE sms_medusa,                 ONLY: hist_pco2
+      USE trc,                        ONLY: ln_diatrc, ln_rsttr,            &
+                                            nittrc000, trn
+ 
       USE bio_medusa_init_mod,        ONLY: bio_medusa_init
       USE carb_chem_mod,              ONLY: carb_chem
@@ -124,14 +128,16 @@
 
    SUBROUTINE trc_bio_medusa( kt )
-      !!---------------------------------------------------------------------
+      !!------------------------------------------------------------------
       !!                     ***  ROUTINE trc_bio  ***
       !!
-      !! ** Purpose :   compute the now trend due to biogeochemical processes
-      !!              and add it to the general trend of passive tracers equations
-      !!
-      !! ** Method  :   each now biological flux is calculated in function of now
-      !!              concentrations of tracers.
-      !!              depending on the tracer, these fluxes are sources or sinks.
-      !!              the total of the sources and sinks for each tracer
+      !! ** Purpose : compute the now trend due to biogeochemical processes
+      !!              and add it to the general trend of passive tracers 
+      !!              equations
+      !!
+      !! ** Method  : each now biological flux is calculated in function of
+      !!              now concentrations of tracers.
+      !!              depending on the tracer, these fluxes are sources or 
+      !!              sinks.
+      !!              The total of the sources and sinks for each tracer
       !!              is added to the general trend.
       !!        
@@ -143,13 +149,14 @@
       !!              IF 'key_trc_diabio' defined , the biogeochemical trends
       !!              for passive tracers are saved for futher diagnostics.
-      !!---------------------------------------------------------------------
-      !!
-      !!
-      !!----------------------------------------------------------------------            
+      !!------------------------------------------------------------------
+      !!
+      !!
+      !!------------------------------------------------------------------
       !! Variable conventions
-      !!----------------------------------------------------------------------
+      !!------------------------------------------------------------------
       !!
       !! names: z*** - state variable 
-      !!        f*** - function (or temporary variable used in part of a function)
+      !!        f*** - function (or temporary variable used in part of 
+      !!               a function)
       !!        x*** - parameter
       !!        b*** - right-hand part (sources and sinks)
@@ -162,209 +169,15 @@
       INTEGER  ::    ji,jj,jk,jn
       !!
-      !! AXY (27/07/10): add in indices for depth horizons (for sinking flux
-      !!                 and seafloor iron inputs)
-      !! INTEGER  ::    i0100, i0200, i0500, i1000, i1100
-      !!
-      !! model state variables
-!      REAL(wp), DIMENSION(jpi,jpj) ::    zchn,zchd,zphn,zphd,zpds,zzmi
-!      REAL(wp), DIMENSION(jpi,jpj) ::    zzme,zdet,zdtc,zdin,zsil,zfer
-! zage doesn't seem to be used - marc 19/4/17
-!      REAL(wp) ::    zage
-!# if defined key_roam
-!      REAL(wp), DIMENSION(jpi,jpj) ::    zdic, zalk, zoxy
-!      REAL(wp), DIMENSION(jpi,jpj) ::    ztmp, zsal
-!# endif
-!# if defined key_mocsy
-!      REAL(wp), DIMENSION(jpi,jpj) ::    zpho
-!# endif
-      !!
-      !! integrated source and sink terms
-!      REAL(wp) ::    b0
-      !! AXY (23/08/13): changed from individual variables for each flux to
-      !!                 an array that holds all fluxes
-      REAL(wp), DIMENSION(jpi,jpj,jp_medusa) ::    btra
-      !!
-      !! primary production and chl related quantities      
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fthetan,faln,fchn1,fchn,fjln,fprn,frn
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fthetad,fald,fchd1,fchd,fjld,fprd,frd
-      !! AXY (23/11/16): add in light-only limitation term (normalised 0-1 range)
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fjlim_pn, fjlim_pd
-      !! AXY (03/02/11): add in Liebig terms
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fpnlim, fpdlim
-      !! AXY (16/07/09): add in Eppley curve functionality
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fun_T,xvpnT,xvpdT
-      INTEGER  ::    ieppley
-      !! AXY (16/05/11): per Katya's prompting, add in new T-dependence
-      !!                 for phytoplankton growth only (i.e. no change
-      !!                 for remineralisation)
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fun_Q10
-      !! AXY (01/03/10): add in mixed layer PP diagnostics
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fprn_ml,fprd_ml
-      !!
-      !! nutrient limiting factors
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fnln,ffln2            !! N and Fe
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fnld,ffld,fsld,fsld2 !! N, Fe and Si
-      !!
-      !! silicon cycle
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fsin,fnsi,fprds,fsdiss
-      REAL(wp)                     ::    fsin1,fnsi1,fnsi2
-      !!
-      !! iron cycle; includes parameters for Parekh et al. (2005) iron scheme
-!      REAL(wp), DIMENSION(jpi,jpj) ::    ffetop,ffebot,ffescav
-      REAL(wp) ::    xLgF, xFeT, xFeF, xFeL         !! state variables for iron-ligand system
-!      REAL(wp), DIMENSION(jpi,jpj) ::  xFree        !! state variables for iron-ligand system
-      REAL(wp) ::    xb_coef_tmp, xb2M4ac           !! iron-ligand parameters
-      REAL(wp) ::    xmaxFeF,fdeltaFe               !! max Fe' parameters
-      !!
-      !! local parameters for Moore et al. (2004) alternative scavenging scheme
-      REAL(wp) ::    fbase_scav,fscal_sink,fscal_part,fscal_scav
-      !!
-      !! local parameters for Moore et al. (2008) alternative scavenging scheme
-      REAL(wp) ::    fscal_csink,fscal_sisink,fscal_casink
-      !!
-      !! local parameters for Galbraith et al. (2010) alternative scavenging scheme
-      REAL(wp) ::    xCscav1, xCscav2, xk_org, xORGscav  !! organic portion of scavenging
-      REAL(wp) ::    xk_inorg, xINORGscav                !! inorganic portion of scavenging
-      !!
-      !! microzooplankton grazing
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fmi1,fmi,fgmipn,fgmid,fgmidc
-!      REAL(wp), DIMENSION(jpi,jpj) ::    finmi,ficmi,fstarmi,fmith,fmigrow,fmiexcr,fmiresp
-      !!
-      !! mesozooplankton grazing
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fme1,fme,fgmepn,fgmepd,fgmepds,fgmezmi,fgmed,fgmedc
-!      REAL(wp), DIMENSION(jpi,jpj) ::    finme,ficme,fstarme,fmeth,fmegrow,fmeexcr,fmeresp
-      !!
-      !! mortality/Remineralisation (defunct parameter "fz" removed)
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fdpn,fdpd,fdpds,fdzmi,fdzme,fdd
+      INTEGER  ::    iball
 # if defined key_roam
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fddc
-# endif
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fdpn2,fdpd2,fdpds2,fdzmi2,fdzme2
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fslown, fslowc
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fslownflux, fslowcflux
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fregen,fregensi
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fregenfast,fregenfastsi
-# if defined key_roam
-!! Doesn't look like this is used - marc 10/4/17
-!!      REAL(wp), DIMENSION(jpi,jpj) ::    fregenc
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fregenfastc
-# endif
-      !!
-      !! particle flux
-!      REAL(WP), DIMENSION(jpi,jpj) ::    fdep1,fcaco3
-!      REAL(WP), DIMENSION(jpi,jpj) ::    ftempn,ftempsi,ftempfe,ftempc,ftempca
-!      REAL(wp), DIMENSION(jpi,jpj) ::    freminn,freminsi,freminfe,freminc,freminca
-!      REAL(wp), DIMENSION(jpi,jpj) ::    ffastn,ffastsi,ffastfe,ffastc,ffastca
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fprotf
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fsedn,fsedsi,fsedfe,fsedc,fsedca
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fccd
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fccd_dep
-      !!
-      !! AXY (06/07/11): alternative fast detritus schemes
-      REAL(wp) ::    fb_val, fl_sst
-      !!
-      !! AXY (08/07/11): fate of fast detritus reaching the seafloor
-! I don't think ffast2slowfe is used - marc 10/4/17
-!      REAL(wp), DIMENSION(jpi,jpj) ::    ffast2slown,ffast2slowfe,ffast2slowc
-!      REAL(wp), DIMENSION(jpi,jpj) ::    ffast2slown,ffast2slowc
-      !!
-      !! conservation law
-      REAL(wp) ::    fnit0,fsil0,ffer0 
-# if defined key_roam
-      REAL(wp) ::    fcar0,falk0,foxy0 
-# endif      
+      !!
+      INTEGER  ::    iyr1, iyr2
+      !!
+# endif
       !! 
       !! temporary variables
-      REAL(wp) ::    fq0,fq1,fq2,fq3,fq4,fq5,fq6,fq7,fq8,fq9
-      !!
-      !! water column nutrient and flux integrals
-!      REAL(wp), DIMENSION(jpi,jpj) ::    ftot_n,ftot_si,ftot_fe
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fflx_n,fflx_si,fflx_fe
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fifd_n,fifd_si,fifd_fe
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fofd_n,fofd_si,fofd_fe
-# if defined key_roam
-!      REAL(wp), DIMENSION(jpi,jpj) ::    ftot_c,ftot_a,ftot_o2
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fflx_c,fflx_a,fflx_o2
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fifd_c,fifd_a,fifd_o2
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fofd_c,fofd_a,fofd_o2
-# endif
-      !!
-      !! zooplankton grazing integrals
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fzmi_i,fzmi_o,fzme_i,fzme_o
-      !!
-      !! limitation term temporary variables
-!      REAL(wp), DIMENSION(jpi,jpj) ::    ftot_pn,ftot_pd
-!      REAL(wp), DIMENSION(jpi,jpj) ::    ftot_zmi,ftot_zme,ftot_det,ftot_dtc
-      !! use ballast scheme (1) or simple exponential scheme (0; a conservation test)
-      INTEGER  ::    iball
-      !! use biological fluxes (1) or not (0)
-!      INTEGER  ::    ibio_switch
-      !!
-      !! diagnose fluxes (should only be used in 1D runs)
-!      INTEGER  ::    idf, idfval
-      !!
-      !! nitrogen and silicon production and consumption
-      REAL(wp) ::    fn_prod, fn_cons, fs_prod, fs_cons
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fnit_prod, fnit_cons, fsil_prod, fsil_cons
-# if defined key_roam
-      !!
-      !! flags to help with calculating the position of the CCD
-! Moved into carb_chem.F90 - marc 20/4/17
-!      INTEGER, DIMENSION(jpi,jpj) ::     i2_omcal,i2_omarg
-      !!
-      !! AXY (24/11/16): add xCO2 variable for atmosphere (what we actually have)
-!      REAL(wp)                     ::    f_xco2a
-!      REAL(wp), DIMENSION(jpi,jpj) ::    f_ph, f_pco2w, f_h2co3, f_hco3, f_co3, f_co2flux
-!      REAL(wp), DIMENSION(jpi,jpj) ::    f_TDIC, f_TALK, f_dcf, f_henry
-!      REAL(wp), DIMENSION(jpi,jpj) ::    f_pp0
-!      REAL(wp), DIMENSION(jpi,jpj) ::    f_kw660, f_o2flux, f_o2sat
-      REAL(wp)                     ::    f_o2sat3
-!      REAL(wp), DIMENSION(jpi,jpj) ::    f_omcal, f_omarg
-      !!
-      !! AXY (23/06/15): additional diagnostics for MOCSY and oxygen
-!      REAL(wp), DIMENSION(jpi,jpj) ::    f_fco2w, f_BetaD, f_rhosw, f_opres, f_insitut, f_pco2atm, f_fco2atm
-!      REAL(wp), DIMENSION(jpi,jpj) ::    f_schmidtco2, f_kwco2, f_K0, f_co2starair, f_dpco2, f_kwo2
-      !! jpalm 14-07-2016: convert CO2flux diag from mmol/m2/d to kg/m2/s
-      REAL, PARAMETER :: weight_CO2_mol = 44.0095  !! g / mol
-      REAL, PARAMETER :: secs_in_day    = 86400.0  !! s / d
-      REAL, PARAMETER :: CO2flux_conv   = (1.e-6 * weight_CO2_mol) / secs_in_day
-
-      !!
-!      INTEGER, DIMENSION(jpi,jpj)  ::    iters
-      REAL(wp) ::    f_year
-      INTEGER  ::    i_year
-      INTEGER  ::    iyr1, iyr2
-      !!
-      !! carbon, alkalinity production and consumption
-      REAL(wp) ::    fc_prod, fc_cons, fa_prod, fa_cons
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fcomm_resp
-!      REAL(wp), DIMENSION(jpi,jpj) ::    fcar_prod, fcar_cons
-      !!
-      !! oxygen production and consumption (and non-consumption)
-      REAL(wp), DIMENSION(jpi,jpj) ::    fo2_prod, fo2_cons, fo2_ncons, fo2_ccons
-!      REAL(wp), DIMENSION(jpi,jpj) ::    foxy_prod, foxy_cons, foxy_anox
-      !! Jpalm (11-08-2014)
-      !! add DMS in MEDUSA for UKESM1 model
-!      REAL(wp), DIMENSION(jpi,jpj) ::    dms_surf
-      !! AXY (13/03/15): add in other DMS calculations
-!      REAL(wp), DIMENSION(jpi,jpj) ::    dms_andr, dms_simo, dms_aran, dms_hall
-
-# endif
-      !! 
-      !! benthic fluxes
-!      INTEGER  ::    ibenthic
-!      REAL(wp), DIMENSION(jpi,jpj) :: f_sbenin_n, f_sbenin_fe,              f_sbenin_c
-!      REAL(wp), DIMENSION(jpi,jpj) :: f_fbenin_n, f_fbenin_fe, f_fbenin_si, f_fbenin_c, f_fbenin_ca
-!      REAL(wp), DIMENSION(jpi,jpj) :: f_benout_n, f_benout_fe, f_benout_si, f_benout_c, f_benout_ca
-      REAL(wp) ::    zfact
-      !! 
-      !! benthic fluxes of CaCO3 that shouldn't happen because of lysocline
-!      REAL(wp), DIMENSION(jpi,jpj) :: f_benout_lyso_ca
-      !!
-      !! riverine fluxes
-!      REAL(wp), DIMENSION(jpi,jpj) :: f_runoff, f_riv_n, f_riv_si, f_riv_c, f_riv_alk
-      !! AXY (19/07/12): variables for local riverine fluxes to handle inputs below surface
-!      REAL(wp), DIMENSION(jpi,jpj) :: f_riv_loc_n, f_riv_loc_si, f_riv_loc_c, f_riv_loc_alk
-      !!---------------------------------------------------------------------
+      REAL(wp) ::    fq0,fq1,fq2,fq3,fq4
+      !!
+      !!------------------------------------------------------------------
 
 # if defined key_debug_medusa
@@ -384,16 +197,4 @@
       !! AXY (13/01/12): is benthic model properly interactive? 0 = no, 1 = yes
       ibenthic = 1
-
-      !! not sure what this is for; it's not used anywhere; commenting out
-      !! fbodn(:,:) = 0.e0   
-
-      !!
-      IF( ln_diatrc ) THEN
-         !! blank 2D diagnostic array
-         trc2d(:,:,:) = 0.e0
-         !!
-         !! blank 3D diagnostic array
-         trc3d(:,:,:,:) = 0.e0
-      ENDIF
 
       !!------------------------------------------------------------------
@@ -587,9 +388,9 @@
                !! OPEN wet point IF..THEN loop
                if (tmask(ji,jj,jk) == 1) then               
-                  !!=========================================================
+                  !!======================================================
                   !! SETUP LOCAL GRID CELL
-                  !!=========================================================
+                  !!======================================================
                   !!
-                  !!---------------------------------------------------------
+                  !!------------------------------------------------------
                   !! Some notes on grid vertical structure
                   !! - fsdepw(ji,jj,jk) is the depth of the upper surface of 
@@ -598,5 +399,5 @@
                   !!   level jk
                   !! - fse3t(ji,jj,jk)  is the thickness of level jk
-                  !!---------------------------------------------------------
+                  !!------------------------------------------------------
                   !!
                   !! AXY (01/03/10): set up level depth (bottom of level)
@@ -864,7 +665,7 @@
 
 #else
-   !!======================================================================
+   !!=====================================================================
    !!  Dummy module :                                   No MEDUSA bio-model
-   !!======================================================================
+   !!=====================================================================
 CONTAINS
    SUBROUTINE trc_bio_medusa( kt )                   ! Empty routine
@@ -874,4 +675,4 @@
 #endif 
 
-   !!======================================================================
+   !!=====================================================================
 END MODULE  trcbio_medusa
