Index: /LMDZ6/trunk/libf/phylmd/physiq_mod.F90
===================================================================
--- /LMDZ6/trunk/libf/phylmd/physiq_mod.F90	(revision 3449)
+++ /LMDZ6/trunk/libf/phylmd/physiq_mod.F90	(revision 3450)
@@ -244,5 +244,5 @@
     USE indice_sol_mod
     USE phytrac_mod, ONLY : phytrac
-    USE carbon_cycle_mod, ONLY : infocfields_init
+    USE carbon_cycle_mod, ONLY : infocfields_init, RCO2_glo, carbon_cycle_rad
 
 #ifdef CPP_RRTM
@@ -3967,9 +3967,13 @@
           RCFC11 = RCFC11_act
           RCFC12 = RCFC12_act
+          ! 
+          !--interactive CO2 in ppm from carbon cycle
+          IF (carbon_cycle_rad.AND..NOT.debut) THEN
+            RCO2=RCO2_glo
+          ENDIF
           !
           IF (prt_level .GE.10) THEN
              print *,' ->radlwsw, number 1 '
           ENDIF
-
           !
           CALL radlwsw &
Index: /LMDZ6/trunk/libf/phylmd/phytrac_mod.F90
===================================================================
--- /LMDZ6/trunk/libf/phylmd/phytrac_mod.F90	(revision 3449)
+++ /LMDZ6/trunk/libf/phylmd/phytrac_mod.F90	(revision 3450)
@@ -405,9 +405,9 @@
        !Config Key  = convscav
        !Config Desc = Convective scavenging switch: 0=off, 1=on.
-       !Config Def  = .false.
+       !Config Def  = .FALSE.
        !Config Help = 
        !
 !$OMP MASTER
-       convscav_omp=.false.
+       convscav_omp=.FALSE.
        call getin('convscav', convscav_omp)
        iflag_vdf_trac_omp=1
@@ -479,4 +479,10 @@
        CASE('co2i')
           source(:,:)=0.
+          lessivage  = .FALSE.
+          aerosol(:) = .FALSE.
+          pbl_flg(:) = 1
+          iflag_the_trac= 1
+          iflag_vdf_trac= 1
+          iflag_con_trac= 1
 #ifdef CPP_StratAer
        CASE('coag')
@@ -506,23 +512,23 @@
              CASE('lmdz')
                 IF (convscav.and.aerosol(it)) THEN
-                   flag_cvltr(it)=.true.
+                   flag_cvltr(it)=.TRUE.
                    ccntrAA(it) =ccntrAA_in    !--a modifier par JYG a lire depuis fichier 
                    ccntrENV(it)=ccntrENV_in
                    coefcoli(it)=coefcoli_in
                 ELSE 
-                   flag_cvltr(it)=.false.
+                   flag_cvltr(it)=.FALSE.
                 ENDIF
 
              CASE('repr')
-                 flag_cvltr(it)=.false.
+                 flag_cvltr(it)=.FALSE.
 
              CASE('inca')
 !                IF ((it.EQ.id_Rn222) .OR. ((it.GE.id_SO2) .AND. (it.LE.id_NH3)) ) THEN 
 !                   !--gas-phase species
-!                   flag_cvltr(it)=.false.
+!                   flag_cvltr(it)=.FALSE.
 !
 !                ELSEIF ( (it.GE.id_CIDUSTM) .AND. (it.LE.id_AIN) ) THEN
 !                   !--insoluble aerosol species
-!                   flag_cvltr(it)=.true.
+!                   flag_cvltr(it)=.TRUE.
 !                   ccntrAA(it)=0.7
 !                   ccntrENV(it)=0.7
@@ -530,5 +536,5 @@
 !                ELSEIF ( (it.EQ.id_Pb210) .OR. ((it.GE.id_CSSSM) .AND. (it.LE.id_SSN))) THEN
 !                   !--soluble aerosol species
-!                   flag_cvltr(it)=.true.
+!                   flag_cvltr(it)=.TRUE.
 !                   ccntrAA(it)=0.9
 !                   ccntrENV(it)=0.9 
@@ -540,19 +546,19 @@
                 !--test OB 
                 !--for now we do not scavenge in cvltr
-                flag_cvltr(it)=.false.
+                flag_cvltr(it)=.FALSE.
 
              CASE('co2i')
                 !--co2 tracers are not scavenged
-                flag_cvltr(it)=.false.
+                flag_cvltr(it)=.FALSE.
 
 #ifdef CPP_StratAer
              CASE('coag')
                 IF (convscav.and.aerosol(it)) THEN
-                   flag_cvltr(it)=.true.
+                   flag_cvltr(it)=.TRUE.
                    ccntrAA(it) =ccntrAA_in    
                    ccntrENV(it)=ccntrENV_in
                    coefcoli(it)=coefcoli_in
                 ELSE
-                   flag_cvltr(it)=.false.
+                   flag_cvltr(it)=.FALSE.
                 ENDIF
 #endif
@@ -562,5 +568,5 @@
           !
        ELSE ! iflag_con .ne. 3 
-          flag_cvltr(:) = .false. 
+          flag_cvltr(:) = .FALSE. 
        ENDIF
        !
@@ -593,5 +599,5 @@
        ENDIF
        !
-    END IF ! of IF (debutphy)
+    ENDIF ! of IF (debutphy)
     !############################################ END INITIALIZATION #######
 
@@ -637,6 +643,7 @@
        !   -- CO2 interactif --
        !   -- source is updated with FF and BB emissions 
-       !   -- OB => PC need to add net flux from ocean and orchidee 
+       !   -- and net fluxes from ocean and orchidee 
        !   -- sign convention : positive into the atmosphere
+
        CALL tracco2i(pdtphys, debutphy, &
             xlat, xlon, pphis, pphi, &
@@ -754,5 +761,5 @@
 #endif
 
-    END IF ! convection
+    ENDIF ! convection
 
     !======================================================================
@@ -792,5 +799,5 @@
        END DO ! it
 
-    END IF ! Thermiques
+    ENDIF ! Thermiques
 
     !======================================================================
@@ -878,5 +885,5 @@
        CALL abort_physic('iflag_vdf_trac', 'cas non prevu',1)
        !
-    END IF ! couche limite
+    ENDIF ! couche limite
 
     !======================================================================
@@ -968,6 +975,6 @@
                       zdz(i,k)=(paprs(i,k)-paprs(i,k+1))/zrho(i,k)/RG
                       !
-                   END DO
-                END DO
+                   ENDDO
+                ENDDO
 
                 DO k=klev-1, 1, -1
@@ -1014,8 +1021,8 @@
                       !                                (1.-1./(frac_impa(i,k)*frac_nucl(i,k)))
                       !--------------
-                   END DO
-                END DO
-             END IF
-          END DO
+                   ENDDO
+                ENDDO
+             ENDIF
+          ENDDO
           ! *********   end modified old version
 
@@ -1053,13 +1060,13 @@
                       ! ----------------------------------------------------------------------
                       tr_seri(i,k,it)=tr_seri(i,k,it)*frac_impa(i,k)*frac_nucl(i,k)
-                   END DO
-                END DO
-             END IF
-          END DO
+                   ENDDO
+                ENDDO
+             ENDIF
+          ENDDO
 
           ! *********   end old version
        ENDIF  !  iflag_lscav . EQ. 1, 2, 3 or 4
        !
-    END IF !  lessivage
+    ENDIF !  lessivage
 
 
Index: /LMDZ6/trunk/libf/phylmd/tracco2i_mod.F90
===================================================================
--- /LMDZ6/trunk/libf/phylmd/tracco2i_mod.F90	(revision 3449)
+++ /LMDZ6/trunk/libf/phylmd/tracco2i_mod.F90	(revision 3450)
@@ -11,10 +11,13 @@
     USE dimphy
     USE infotrac_phy
-    USE geometry_mod, ONLY : cell_area
-    USE carbon_cycle_mod, ONLY : nbcf_in, fields_in, cfname_in, fco2_ocn_day, fco2_ff, fco2_bb
+    USE geometry_mod, ONLY: cell_area
+    USE carbon_cycle_mod, ONLY: id_CO2, nbcf_in, fields_in, cfname_in, fco2_ocn_day, fco2_ff, fco2_bb
+    USE carbon_cycle_mod, ONLY: carbon_cycle_tr, carbon_cycle_rad, RCO2_glo, RCO2_tot
     USE mod_grid_phy_lmdz
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    USE mod_phys_lmdz_mpi_data, ONLY: is_mpi_root
     USE mod_phys_lmdz_para, ONLY: gather, bcast, scatter
     USE phys_cal_mod
+    USE phys_state_var_mod, ONLY: pctsrf
+    USE indice_sol_mod, ONLY: nbsrf, is_ter, is_lic, is_oce, is_sic
 
     IMPLICIT NONE
@@ -45,5 +48,4 @@
 !----------------
 
-    INTEGER, PARAMETER :: id_CO2=1              !--temporaire OB -- to be changed 
     INTEGER                        :: it, k, i, nb
     REAL, DIMENSION(klon,klev)     :: m_air     ! mass of air in every grid box [kg]
@@ -53,9 +55,6 @@
     REAL, DIMENSION(klon_glo,klev) :: m_air_glo ! variable temporaire sur la grille global
 
-
-    INTEGER, SAVE :: mth_pre=0
-!$OMP THREADPRIVATE(mth_pre)
-    REAL, SAVE :: RCO2_glo
-!$OMP THREADPRIVATE(RCO2_glo)
+    INTEGER, SAVE :: mth_pre=0, day_pre=0
+!$OMP THREADPRIVATE(mth_pre, day_pre)
 
     IF (is_mpi_root) THEN
@@ -68,5 +67,6 @@
     IF (debutphy) THEN
       IF (MAXVAL(tr_seri(:,:,id_CO2)).LT.1.e-15) THEN 
-        tr_seri(:,:,id_CO2)=280.e-6/RMD*RMCO2
+        !!tr_seri(:,:,id_CO2)=280.e-6/RMD*RMCO2
+        tr_seri(:,:,id_CO2)=400.e-6/RMD*RMCO2 !--initialised to 400 ppm for a test
       ENDIF 
     ENDIF
@@ -85,11 +85,13 @@
 
 !--retrieving land and ocean CO2 flux
-!--fCO2_nep comes in unit of g CO2 m-2 dt_stomate-1 
-!--this needs to be changed in ORCHIDEE
     co2land(:)=0.0
     co2ocean(:)=0.0
     DO nb=1, nbcf_in
-      IF (cfname_in(nb) == "fCO2_nep" )   co2land(:)=fields_in(:,nb)*RMCO2/RMC/86400./1000.
-      !!IF (cfname_in(nb) == "fCO2_fgco2" ) co2ocean(:)=fco2_ocn_day(:) !--for now
+!--fCO2_nep comes in unit of kg C m-2 s-1
+!--converting to kg CO2 m-2 s-1
+      IF (cfname_in(nb) == "fCO2_nep" )   co2land(:)=fields_in(:,nb)*RMCO2/RMC*pctsrf(:,is_ter)
+!--fCO2_fgco2 comes in unit of mol C02 m-2 s-1
+!--converting to kg CO2 m-2 s-1 + change sign
+      IF (cfname_in(nb) == "fCO2_fgco2" ) co2ocean(:)=-1.*fco2_ocn_day(:)*RMCO2/1.e3*(pctsrf(:,is_oce)+pctsrf(:,is_sic))
     ENDDO
 
@@ -99,17 +101,25 @@
 
 !--computing global mean CO2 for radiation
-!--every timestep for now but enough every month
+!--every timestep for now but enough every day
 !    IF (debutphy.OR.mth_cur.NE.mth_pre) THEN
+!    IF (debutphy.OR.day_cur.NE.day_pre) THEN
       CALL gather(tr_seri(:,:,id_CO2),co2_glo)
       CALL gather(m_air,m_air_glo)
 !$OMP MASTER
-!--conversion from kg CO2/kg air into ppm
+!--compute a global mean CO2 value and print its value in ppm
        IF (is_mpi_root) THEN
-         RCO2_glo=SUM(co2_glo*m_air_glo)/SUM(m_air_glo)*1.e6*RMD/RMCO2
+         RCO2_tot=SUM(co2_glo*m_air_glo)  !--unit kg CO2
+         RCO2_glo=RCO2_tot/SUM(m_air_glo) !--unit kg CO2 / kg air
+         PRINT *,'tracco2i: global CO2 in ppm =', RCO2_glo*1.e6*RMD/RMCO2
+         PRINT *,'tracco2i: total CO2 in kg =', RCO2_tot
        ENDIF
-       PRINT *,'toto in tracco2i: global CO2 in ppm =', RCO2_glo
 !$OMP END MASTER
        CALL bcast(RCO2_glo)
        mth_pre=mth_cur
+       day_pre=day_cur
+!--if not carbon_cycle_tr, then we reinitialize the CO2 each day to its global mean value
+       IF (.NOT.carbon_cycle_tr) THEN 
+         tr_seri(:,:,id_CO2)=RCO2_glo
+       ENDIF
 !    ENDIF
 
