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 8023)
+++ branches/UKMO/dev_r5518_medusa_chg_trc_bio_medusa/NEMOGCM/NEMO/TOP_SRC/MEDUSA/air_sea.F90	(revision 8039)
@@ -39,22 +39,19 @@
                                    dms_aran2d, dms_hall, dms_hall2d,      &
                                    dms_simo, dms_simo2d, dms_surf,        &
-                                   dms_surf2d, f_BetaD,                   &
-                                   f_co2flux, f_co2flux2d, f_co2starair,  &
+                                   dms_surf2d,                            &
+                                   f_co2flux, f_co2flux2d,                &
                                    f_co2starair_2d, f_co3,                &
-                                   f_dcf, f_dpco2, f_fco2a_2d, f_fco2atm, &
-                                   f_fco2w, f_fco2w_2d, f_h2co3,          &
-                                   f_hco3, f_henry, f_insitut, f_K0,      &
-                                   f_kw660, f_kw6602d, f_kwco2, f_kwo2,   &
-                                   f_o2flux, f_o2flux2d,                  &
-                                   f_o2sat, f_o2sat2d, f_ocndpco2_2d,     &
+                                   f_dcf, f_fco2a_2d, f_fco2w_2d,         &
+                                   f_h2co3, f_hco3, f_henry,              &
+                                   f_kw660, f_kw6602d,                    &
+                                   f_o2flux, f_o2flux2d, f_o2sat,         &
+                                   f_o2sat2d, f_ocndpco2_2d,              &
                                    f_ocnk0_2d, f_ocnkwco2_2d,             &
                                    f_ocnrhosw_2d, f_ocnschco2_2d,         &
-                                   f_omarg, f_omcal, f_opres,             &
-                                   f_pco2a2d, f_pco2atm,                  &
-                                   f_pco2w, f_pco2w2d, f_ph, f_pp0,       &
-                                   f_pp02d, f_rhosw,                      &
-                                   f_schmidtco2, f_TALK, f_TALK2d,        &
-                                   f_TDIC, f_TDIC2d, f_xco2a, f_xco2a_2d, &
-                                   iters,                                 &
+                                   f_omarg, f_omcal,                      &
+                                   f_pco2a2d, f_pco2atm, f_pco2w,         &
+                                   f_pco2w2d, f_ph, f_pp0, f_pp02d,       &
+                                   f_TALK, f_TALK2d, f_TDIC, f_TDIC2d,    &
+                                   f_xco2a, f_xco2a_2d,                   &
                                    zalk, zdic, zoxy, zsal, ztmp,          &
 # endif
@@ -69,5 +66,6 @@
       USE in_out_manager,    ONLY: lwp, numout
       USE oce,               ONLY: PCO2a_in_cpl
-      USE par_oce,           ONLY: jpim1, jpjm1
+      USE par_kind,          ONLY: wp
+      USE par_oce,           ONLY: jpi, jpim1, jpj, jpjm1
       USE sbc_oce,           ONLY: fr_i, lk_oasis, qsr, wndm
       USE sms_medusa,        ONLY: jdms, jdms_input, jdms_model,          &
@@ -97,4 +95,7 @@
       INTEGER, INTENT( in ) :: kt
 
+      !! Loop variables
+      INTEGER :: ji, jj
+
 # if defined key_roam
       !! jpalm 14-07-2016: convert CO2flux diag from mmol/m2/d to kg/m2/s
@@ -102,7 +103,18 @@
       REAL, PARAMETER :: secs_in_day    = 86400.0  !! s / d
       REAL, PARAMETER :: CO2flux_conv   = (1.e-6 * weight_CO2_mol) / secs_in_day
+
+      INTEGER :: iters
+
+      !! AXY (23/06/15): additional diagnostics for MOCSY and oxygen
+      REAL(wp), DIMENSION(jpi,jpj) :: f_fco2w, f_rhosw
+      REAL(wp), DIMENSION(jpi,jpj) :: f_fco2atm
+      REAL(wp), DIMENSION(jpi,jpj) :: f_schmidtco2, f_kwco2, f_K0
+      REAL(wp), DIMENSION(jpi,jpj) :: f_co2starair, f_dpco2
+      !! Output arguments from mocsy_interface, which aren't used
+      REAL(wp) :: f_BetaD_dum, f_opres_dum
+      REAL(wp) :: f_insitut_dum
+      REAL(wp) :: f_kwo2_dum
 # endif
 
-      INTEGER :: ji, jj
 
 # if defined key_roam
@@ -171,7 +183,7 @@
                                     f_h2co3(ji,jj),f_hco3(ji,jj),            &
                                     f_co3(ji,jj),f_omarg(ji,jj),             &
-                                    f_omcal(ji,jj),f_BetaD(ji,jj),           &
-                                    f_rhosw(ji,jj),f_opres(ji,jj),           &
-                                    f_insitut(ji,jj),f_pco2atm(ji,jj),       &
+                                    f_omcal(ji,jj),f_BetaD_dum,              &
+                                    f_rhosw(ji,jj),f_opres_dum,              &
+                                    f_insitut_dum,f_pco2atm(ji,jj),          &
                                     f_fco2atm(ji,jj),f_schmidtco2(ji,jj),    &
                                     f_kwco2(ji,jj),f_K0(ji,jj),              &
@@ -192,5 +204,5 @@
          DO ji = 2,jpim1
             if (tmask(ji,jj,1) == 1) then     
-               iters(ji,jj) = 0
+               iters = 0
                !!
                !! carbon dioxide (CO2); Jerry Blackford code (ostensibly 
@@ -205,5 +217,5 @@
                                    f_co2flux(ji,jj),f_TDIC(ji,jj),           &
                                    f_TALK(ji,jj),f_dcf(ji,jj),               &
-                                   f_henry(ji,jj),iters(ji,jj))
+                                   f_henry(ji,jj),iters)
                !!
                !! AXY (09/01/14): removed iteration and NaN checks; these have
@@ -213,7 +225,7 @@
                !!                 output warnings are retained here so that
                !!                 failure position can be determined
-               if (iters(ji,jj) .eq. 25) then
+               if (iters .eq. 25) then
                   IF(lwp) WRITE(numout,*) ' trc_bio_medusa: ITERS WARNING, ', &
-                     iters(ji,jj), ' AT (', ji, ', ', jj, ', 1) AT ', kt
+                     iters, ' AT (', ji, ', ', jj, ', 1) AT ', kt
                endif
             ENDIF
@@ -244,8 +256,10 @@
                !! AXY (23/06/15): add in some extra MOCSY diagnostics
                f_fco2w(ji,jj)        = f_xco2a(ji,jj)
-               f_BetaD(ji,jj)        = 1.
+! This doesn't seem to be used - marc 16/5/17
+!               f_BetaD(ji,jj)        = 1.
                f_rhosw(ji,jj)        = 1.026
-               f_opres(ji,jj)        = 0.
-               f_insitut(ji,jj)      = ztmp(ji,jj)
+! This doesn't seem to be used - marc 16/5/17
+!               f_opres(ji,jj)        = 0.
+!               f_insitut(ji,jj)      = ztmp(ji,jj)
                f_pco2atm(ji,jj)      = f_xco2a(ji,jj)
                f_fco2atm(ji,jj)      = f_xco2a(ji,jj)
@@ -271,9 +285,7 @@
                !! AXY (23/06/15): amend input list for oxygen to account 
                !!                 for common gas transfer velocity
-               !! Note that f_kwo2 is an about from the subroutine below,
-               !! which doesn't seem to be used - marc 10/4/17 
                CALL trc_oxy_medusa(ztmp(ji,jj),zsal(ji,jj),f_kw660(ji,jj),   &
                                    f_pp0(ji,jj),zoxy(ji,jj),                 &
-                                   f_kwo2(ji,jj),f_o2flux(ji,jj),            &
+                                   f_kwo2_dum,f_o2flux(ji,jj),               &
                                    f_o2sat(ji,jj))
                !!
