Index: /branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/CONFIG/SHARED/field_def_bgc.xml
===================================================================
--- /branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/CONFIG/SHARED/field_def_bgc.xml	(revision 7253)
+++ /branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/CONFIG/SHARED/field_def_bgc.xml	(revision 7254)
@@ -334,4 +334,5 @@
        <field id= "OCN_CO3"    long_name="Surface ocean CO3 conc"                    unit="mmolC/m3"    />
        <field id= "CO2FLUX"    long_name="Air-sea CO2 flux"                          unit="mmolC/m2/d"  />
+       <field id= "FGCO2"      long_name="Surface Downward CO2 Flux"                 unit="kg-CO2/m2/s" />
        <field id= "OM_CAL"     long_name="Omega calcite"                             unit="-"           />
        <field id= "OM_ARG"     long_name="Omega aragonite"                           unit="-"           />
@@ -422,12 +423,12 @@
        <field id= "epN100"     long_name="Downward Flux of Particulate Nitrogen"     unit="mmolN/m2/d"  />
        <field id= "epSI100"    long_name="Downward Flux of Particulate Silica"       unit="mmolSi/m2/d" />
-       <field id= "FGCO2"      long_name="Surface Downward CO2 Flux"                 unit="kg/m2/s"     />
        <field id= "INTDISSIC"  long_name="Dissolved Inorganic Carbon Content"        unit="mmolC/m2"    />
        <field id= "INTDISSIN"  long_name="Dissolved Inorganic Nitrogen Content"      unit="mmolN/m2"    />
        <field id= "INTDISSISI" long_name="Dissolved Inorganic Silicon Content"       unit="mmolSi/m2"   />
-       <field id= "INTALK"     long_name="Dissolved Alkalinity Content"              unit="meq/m2"      />
+       <field id= "INTTALK"     long_name="Dissolved Alkalinity Content"              unit="meq/m2"      />
        <field id= "O2min"      long_name="Oxygen Minimum Concentration"              unit="mmolO2/m3"   />
        <field id= "ZO2min"     long_name="Depth of Oxygen Minimum Concentration"     unit="m"           />
 
+       <!-- MEDUSA 3D diagnostics -->
        <field id= "TPP3"       long_name="Total primary production 3D"               unit="mmolN/m3/d"    grid_ref="grid_T_3D"  />
        <field id= "DETFLUX3"   long_name="Total detrital flux 3D"                    unit="mmolN/m3/d"    grid_ref="grid_T_3D"  />
@@ -440,5 +441,5 @@
        <field id= "BDDTALK3"   long_name="Change of Alkalinity due to Biology"       unit="meq/m3/d"      grid_ref="grid_T_3D"  />
        <field id= "BDDTDIC3"   long_name="Change of DI Carbon due to Biology"        unit="mmolC/m3/d"    grid_ref="grid_T_3D"  />
-       <field id= "BDDTIFE3"   long_name="Change of DI Iron due to Biology"          unit="mmolFe/m3/d"   grid_ref="grid_T_3D"  />
+       <field id= "BDDTDIFE3"   long_name="Change of DI Iron due to Biology"          unit="mmolFe/m3/d"   grid_ref="grid_T_3D"  />
        <field id= "BDDTDIN3"   long_name="Change of DI Nitrogen due to Biology"      unit="mmolN/m3/d"    grid_ref="grid_T_3D"  />
        <field id= "BDDTDISI3"  long_name="Change of DI Silicon due to Biology"       unit="mmolSi/m3/d"   grid_ref="grid_T_3D"  />
@@ -448,6 +449,6 @@
        <field id= "FD_CAL3"    long_name="Fast sinking detrital calcium carbonate"   unit="mmolC/m2/d"    grid_ref="grid_T_3D"  />
        <field id= "CO33"       long_name="Carbonate ion concentration"               unit="mmolC/m3"      grid_ref="grid_T_3D"  />
-       <field id= "CO3SATARG3" long_name="Carbonate aragonite saturation conc"       unit="mmolC/m3"      grid_ref="grid_T_3D"  />
-       <field id= "CO3SATCAL3" long_name="Carbonate calcite saturation conc"         unit="mmolC/m3"      grid_ref="grid_T_3D"  />
+       <field id= "CO3SATARAG3" long_name="Carbonate aragonite saturation conc"      unit="mmolC/m3"      grid_ref="grid_T_3D"  />
+       <field id= "CO3SATCALC3" long_name="Carbonate calcite saturation conc"        unit="mmolC/m3"      grid_ref="grid_T_3D"  />
        <field id= "DCALC3"     long_name="Calcite dissolution"                       unit="mmolC/m3/d"    grid_ref="grid_T_3D"  />
        <field id= "EXPC3"      long_name="Downward Flux of Particulate Org Carbon"   unit="mmolC/m3/d"    grid_ref="grid_T_3D"  />
@@ -630,4 +631,5 @@
       <field field_ref= "OCN_CO3"    name="OCN_CO3"    />
       <field field_ref= "CO2FLUX"    name="CO2FLUX"    />
+      <field field_ref= "FGCO2"      name="FGCO2"      />
       <field field_ref= "OM_CAL"     name="OM_CAL"     />
       <field field_ref= "OM_ARG"     name="OM_ARG"     />
@@ -733,9 +735,8 @@
       <field field_ref= "epN100"     name="epN100"     />
       <field field_ref= "epSI100"    name="epSI100"    />
-      <field field_ref= "FGCO2"      name="FGCO2"      />
       <field field_ref= "INTDISSIC"  name="INTDISSIC"  />
       <field field_ref= "INTDISSIN"  name="INTDISSIN"  />
       <field field_ref= "INTDISSISI" name="INTDISSISI" />
-      <field field_ref= "INTALK"     name="INTALK"     />
+      <field field_ref= "INTTALK"    name="INTTALK"    />
       <field field_ref= "O2min"      name="O2min"      />
       <field field_ref= "ZO2min"     name="ZO2min"     />
@@ -743,5 +744,5 @@
       <field field_ref= "BDDTALK3"   name="BDDTALK3"   />
       <field field_ref= "BDDTDIC3"   name="BDDTDIC3"   />
-      <field field_ref= "BDDTIFE3"   name="BDDTIFE3"   />
+      <field field_ref= "BDDTDIFE3"  name="BDDTDIFE3"  />
       <field field_ref= "BDDTDIN3"   name="BDDTDIN3"   />
       <field field_ref= "BDDTDISI3"  name="BDDTDISI3"  />
@@ -751,6 +752,6 @@
       <field field_ref= "FD_CAL3"    name="FD_CAL3"    />
       <field field_ref= "CO33"       name="CO33"       />
-      <field field_ref= "CO3SATARG3" name="CO3SATARG3" />
-      <field field_ref= "CO3SATCAL3" name="CO3SATCAL3" />
+      <field field_ref= "CO3SATARAG3" name="CO3SATARAG3" />
+      <field field_ref= "CO3SATCALC3" name="CO3SATCALC3" />
       <field field_ref= "DCALC3"     name="DCALC3"     />
       <field field_ref= "EXPC3"      name="EXPC3"      />
Index: /branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcbio_medusa.F90
===================================================================
--- /branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcbio_medusa.F90	(revision 7253)
+++ /branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcbio_medusa.F90	(revision 7254)
@@ -389,5 +389,5 @@
       REAL(wp), POINTER, DIMENSION(:,:,:) :: expc3, expn3
       REAL(wp), POINTER, DIMENSION(:,:,:) :: fediss3, fescav3
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: migrazp3, migrazd3, megrazp3, migrazd3, migrazz3
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: migrazp3, migrazd3, megrazp3, megrazd3, megrazz3
       REAL(wp), POINTER, DIMENSION(:,:,:) :: o2sat3, pbsi3, pcal3, remoc3
       REAL(wp), POINTER, DIMENSION(:,:,:) :: pnlimj3, pnlimn3, pnlimfe3, pdlimj3, pdlimn3, pdlimfe3, pdlimsi3
@@ -739,4 +739,9 @@
 !! skip SEAFLRXX, MED_XXXX, INTFLX_XX, INT_XX, ML_XXX, OCAL_XXX, FE_XXXX, MED_XZE, WIND diagnostics here
 !!
+         IF( med_diag%RR_0100%dgsave ) THEN
+            CALL wrk_alloc( jpi, jpj,    ffastca2d   )
+            ffastca2d(:,:)      = 0.0 !!
+         ENDIF
+
          IF( med_diag%ATM_PCO2%dgsave ) THEN
             CALL wrk_alloc( jpi, jpj,    f_pco2a2d   )
@@ -995,8 +1000,10 @@
           !! 
           !! AXY (10/11/16): CMIP6 diagnostics, 2D
-          IF( med_diag%FGCO2%dgsave ) THEN
+          !! JPALM -- 17-11-16 -- put fgco2 alloc out of diag request
+          !!                   needed for coupling/passed through restart
+          !! IF( med_diag%FGCO2%dgsave ) THEN
              CALL wrk_alloc( jpi, jpj,   fgco2    )
              fgco2(:,:)      = 0.0 !!
-          ENDIF
+          !! ENDIF
           IF( med_diag%INTDISSIC%dgsave ) THEN
              CALL wrk_alloc( jpi, jpj,   intdissic    )
@@ -1805,4 +1812,11 @@
                   !!
                   !! store 2D outputs
+                  !!
+                  !! JPALM -- 17-11-16 -- put fgco2 out of diag request
+                  !!                    is needed for coupling; pass through restart
+                  !! IF( med_diag%FGCO2%dgsave ) THEN
+                     !! convert from  mol/m2/day to kg/m2/s
+                     fgco2(ji,jj) = f_co2flux * fthk * CO2flux_conv  !! mmol-C/m3/d -> kg-CO2/m2/s
+                  !! ENDIF
                   IF ( lk_iomput ) THEN
                       IF( med_diag%ATM_PCO2%dgsave ) THEN
@@ -1814,9 +1828,4 @@
                       IF( med_diag%CO2FLUX%dgsave ) THEN
                          f_co2flux2d(ji,jj) = f_co2flux * fthk           !! mmol/m3/d -> mmol/m2/d
-                      ENDIF
-                      !! AXY (10/11/16): CMIP6 equivalent
-                      IF( med_diag%FGCO2%dgsave ) THEN
-                         !! convert from  mol/m2/day to kg/m2/s
-                         fgco2(ji,jj) = f_co2flux * fthk * CO2flux_conv  !! mmol-C/m3/d -> kg-CO2/m2/s
                       ENDIF
                       IF( med_diag%TCO2%dgsave ) THEN
@@ -1845,5 +1854,5 @@
                !! AXY (11/11/16): CMIP6 oxygen saturation 3D diagnostic
                IF ( med_diag%O2SAT3%dgsave ) THEN
-                  oxy_sato( ztmp, zsal, f_o2sat3 )
+                  call oxy_sato( ztmp, zsal, f_o2sat3 )
                   o2sat3(ji, jj, jk) = f_o2sat3
                ENDIF
@@ -4696,14 +4705,19 @@
                      !!                 both outputs the CO2 flux in specified units and
                      !!                 sends the resulting field to the coupler
+                     !! JPALM (17/11/16): put CO2 flux (fgco2) alloc/unalloc/pass to zn 
+                     !!                 out of diag list request 
+                     CALL lbc_lnk( fgco2(:,:),'T',1. )
                      IF( med_diag%FGCO2%dgsave ) THEN
-                         CALL lbc_lnk( fgco2(:,:),'T',1. )
                          CALL iom_put( "FGCO2"  , fgco2 )
-                         zb_co2_flx = zn_co2_flx
-                         zn_co2_flx = fgco2
-                         IF (lk_oasis) THEN
-                            CO2Flux_out_cpl = zn_co2_flx
-                         ENDIF
-                         CALL wrk_dealloc( jpi, jpj,   fgco2   )
-                     ENDIF
+                     ENDIF
+                     !! JPALM (17/11/16): should mv this fgco2 part 
+                     !!                   out of lk_iomput loop
+                     zb_co2_flx = zn_co2_flx
+                     zn_co2_flx = fgco2
+                     IF (lk_oasis) THEN
+                        CO2Flux_out_cpl = zn_co2_flx
+                     ENDIF
+                     CALL wrk_dealloc( jpi, jpj,   fgco2   )
+                     !! ---
                      IF( med_diag%OM_CAL%dgsave ) THEN
                          CALL iom_put( "OM_CAL"  , f_omcal )
@@ -4714,25 +4728,25 @@
                      IF( med_diag%TCO2%dgsave ) THEN
                          CALL iom_put( "TCO2"  , f_TDIC2d )
-                          CALL wrk_dealloc( jpi, jpj,   f_TDIC2d   )
+                         CALL wrk_dealloc( jpi, jpj,   f_TDIC2d   )
                      ENDIF
                      IF( med_diag%TALK%dgsave ) THEN
                          CALL iom_put( "TALK"  , f_TALK2d )
-                          CALL wrk_dealloc( jpi, jpj,    f_TALK2d  )
+                         CALL wrk_dealloc( jpi, jpj,    f_TALK2d  )
                      ENDIF
                      IF( med_diag%KW660%dgsave ) THEN
                          CALL iom_put( "KW660"  , f_kw6602d )
-                          CALL wrk_dealloc( jpi, jpj,   f_kw6602d   )
+                         CALL wrk_dealloc( jpi, jpj,   f_kw6602d   )
                      ENDIF
                      IF( med_diag%ATM_PP0%dgsave ) THEN
                          CALL iom_put( "ATM_PP0"  , f_pp02d )
-                          CALL wrk_dealloc( jpi, jpj,    f_pp02d  )
+                         CALL wrk_dealloc( jpi, jpj,    f_pp02d  )
                      ENDIF
                      IF( med_diag%O2FLUX%dgsave ) THEN
                          CALL iom_put( "O2FLUX"  , f_o2flux2d )
-                          CALL wrk_dealloc( jpi, jpj,   f_o2flux2d   )
+                         CALL wrk_dealloc( jpi, jpj,   f_o2flux2d   )
                      ENDIF
                      IF( med_diag%O2SAT%dgsave ) THEN
                          CALL iom_put( "O2SAT"  , f_o2sat2d )
-                          CALL wrk_dealloc( jpi, jpj,  f_o2sat2d    )
+                         CALL wrk_dealloc( jpi, jpj,  f_o2sat2d    )
                      ENDIF
                      IF( med_diag%CAL_CCD%dgsave ) THEN
@@ -4755,17 +4769,17 @@
                        IF( med_diag%DMS_ANDR%dgsave ) THEN
                          CALL iom_put( "DMS_ANDR"  , dms_andr2d )
-                          CALL wrk_dealloc( jpi, jpj,   dms_andr2d   )
+                         CALL wrk_dealloc( jpi, jpj,   dms_andr2d   )
                        ENDIF
                        IF( med_diag%DMS_SIMO%dgsave ) THEN
                          CALL iom_put( "DMS_SIMO"  , dms_simo2d )
-                          CALL wrk_dealloc( jpi, jpj,    dms_simo2d  )
+                         CALL wrk_dealloc( jpi, jpj,    dms_simo2d  )
                        ENDIF
                        IF( med_diag%DMS_ARAN%dgsave ) THEN
                          CALL iom_put( "DMS_ARAN"  , dms_aran2d )
-                          CALL wrk_dealloc( jpi, jpj,   dms_aran2d   )
+                         CALL wrk_dealloc( jpi, jpj,   dms_aran2d   )
                        ENDIF
                        IF( med_diag%DMS_HALL%dgsave ) THEN
                          CALL iom_put( "DMS_HALL"  , dms_hall2d )
-                          CALL wrk_dealloc( jpi, jpj,   dms_hall2d   )
+                         CALL wrk_dealloc( jpi, jpj,   dms_hall2d   )
                        ENDIF
                      ENDIF
@@ -4861,5 +4875,5 @@
 #   endif
                      IF( med_diag%SDT__500%dgsave ) THEN
-                         CALL iom_put( "SDT__500"  , fregen2d )
+                         CALL iom_put( "SDT__500"  , fslownflux )
                      ENDIF
                      IF( med_diag%REG__500%dgsave ) THEN
@@ -5756,25 +5770,25 @@
           IF( med_diag%INTDISSIC%dgsave ) THEN
              CALL iom_put( "INTDISSIC"  , intdissic )
-             CALL wrk_dealloc( jpi, jpj, jpk, intdissic   )
+             CALL wrk_dealloc( jpi, jpj, intdissic   )
           ENDIF          
           IF( med_diag%INTDISSIN%dgsave ) THEN
              CALL iom_put( "INTDISSIN"  , intdissin )
-             CALL wrk_dealloc( jpi, jpj, jpk, intdissin   )
+             CALL wrk_dealloc( jpi, jpj, intdissin   )
           ENDIF          
           IF( med_diag%INTDISSISI%dgsave ) THEN
              CALL iom_put( "INTDISSISI"  , intdissisi )
-             CALL wrk_dealloc( jpi, jpj, jpk, intdissisi  )
+             CALL wrk_dealloc( jpi, jpj, intdissisi  )
           ENDIF          
           IF( med_diag%INTTALK%dgsave ) THEN
              CALL iom_put( "INTTALK"  , inttalk )
-             CALL wrk_dealloc( jpi, jpj, jpk, inttalk     )
+             CALL wrk_dealloc( jpi, jpj, inttalk     )
           ENDIF          
           IF( med_diag%O2min%dgsave ) THEN
              CALL iom_put( "O2min"  , o2min )
-             CALL wrk_dealloc( jpi, jpj, jpk, o2min       )
+             CALL wrk_dealloc( jpi, jpj, o2min       )
           ENDIF          
           IF( med_diag%ZO2min%dgsave ) THEN
              CALL iom_put( "ZO2min"  , zo2min )
-             CALL wrk_dealloc( jpi, jpj, jpk, zo2min      )
+             CALL wrk_dealloc( jpi, jpj, zo2min      )
           ENDIF          
           !!
Index: /branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcnam_medusa.F90
===================================================================
--- /branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcnam_medusa.F90	(revision 7253)
+++ /branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcnam_medusa.F90	(revision 7254)
@@ -2261,14 +2261,4 @@
           med_diag%EXPN3%dgsave = .FALSE.
       ENDIF
-      IF  (iom_use("EXPCALC3")) THEN 
-          med_diag%EXPCALC3%dgsave = .TRUE.
-      ELSE 
-          med_diag%EXPCALC3%dgsave = .FALSE.
-      ENDIF
-      IF  (iom_use("EXPSI3")) THEN 
-          med_diag%EXPSI3%dgsave = .TRUE.
-      ELSE 
-          med_diag%EXPSI3%dgsave = .FALSE.
-      ENDIF
       IF  (iom_use("FEDISS3")) THEN 
           med_diag%FEDISS3%dgsave = .TRUE.
@@ -2336,5 +2326,5 @@
           med_diag%PNLIMN3%dgsave = .FALSE.
       ENDIF
-      IF  (iom_use("PNLIFEJ3")) THEN 
+      IF  (iom_use("PNLIMFE3")) THEN 
           med_diag%PNLIMFE3%dgsave = .TRUE.
       ELSE 
Index: /branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcoxy_medusa.F90
===================================================================
--- /branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcoxy_medusa.F90	(revision 7253)
+++ /branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcoxy_medusa.F90	(revision 7254)
@@ -23,4 +23,5 @@
       
       PUBLIC   trc_oxy_medusa    ! called in trc_bio_medusa
+      PUBLIC   oxy_sato          ! called in trc_bio_medusa
 
    !!* Substitution
