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 7227)
+++ 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          
           !!
