Index: trunk/NEMO/OPA_SRC/SBC/sbccpl.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 1523)
+++ trunk/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 1534)
@@ -6,5 +6,5 @@
    !! History :  2.0  !  06-2007  (R. Redler, N. Keenlyside, W. Park) Original code split into flxmod & taumod
    !!            3.0  !  02-2008  (G. Madec, C Talandier)  surface module
-   !!            3.1  !  02-2009  (G. Madec, S. Masson, E. Maisonave, A. Caubel) generic coupled interface
+   !!            3.1  !  02-2009  (S. Masson, E. Maisonave, A. Caubel) generic coupled interface
    !!----------------------------------------------------------------------
 #if defined key_oasis3 || defined key_oasis4
@@ -27,5 +27,6 @@
 #endif
 #if defined key_lim2
-   USE ice_2, ONLY : hicif, hsnif          ! Ice and Snow thickness
+   USE par_ice_2       ! ice parameters
+   USE ice_2           ! ice variables
 #endif
    USE cpl_oasis3      ! OASIS3 coupling
@@ -41,4 +42,7 @@
    USE mod_prism_proto ! OASIS3 prism module: PRISM_* variables...
    USE phycst, ONLY : xlsn, rhosn
+#if defined key_cpl_carbon_cycle
+   USE p4zflx, ONLY : oce_co2
+#endif
    IMPLICIT NONE
    PRIVATE
@@ -78,6 +82,10 @@
    INTEGER, PARAMETER ::   jpr_rnf    = 28            ! 
    INTEGER, PARAMETER ::   jpr_cal    = 29            ! 
+#if ! defined key_cpl_carbon_cycle
    INTEGER, PARAMETER ::   jprcv      = 29            ! total number of fields recieved
-   
+#else
+   INTEGER, PARAMETER ::   jpr_co2    = 30
+   INTEGER, PARAMETER ::   jprcv      = 30            ! total number of fields recieved
+#endif   
    INTEGER, PARAMETER ::   jps_fice   =  1            ! ice fraction 
    INTEGER, PARAMETER ::   jps_toce   =  2            ! ocean temperature
@@ -94,6 +102,10 @@
    INTEGER, PARAMETER ::   jps_ivy1   = 13            !
    INTEGER, PARAMETER ::   jps_ivz1   = 14            !
+#if ! defined key_cpl_carbon_cycle
    INTEGER, PARAMETER ::   jpsnd      = 14            ! total number of fields sended
-   
+#else
+   INTEGER, PARAMETER ::   jps_co2    = 15
+   INTEGER, PARAMETER ::   jpsnd      = 15            ! total number of fields sended
+#endif   
    !                                                         !!** namelist namsbc_cpl **
    ! Send to the atmosphere                                   !
@@ -105,5 +117,7 @@
    CHARACTER(len=100) ::   cn_snd_crt_orient  = 'local grid'  ! 'eastward-northward' or 'local grid'
    CHARACTER(len=100) ::   cn_snd_crt_grid    = 'T'           ! always at 'T' point
-   
+#if defined key_cpl_carbon_cycle 
+   CHARACTER(len=100) ::   cn_snd_co2         = 'none'        ! 'none' or 'coupled'
+#endif
    ! Recieved from the atmosphere                             !
    CHARACTER(len=100) ::   cn_rcv_tau_nature  = 'oce only'    ! 'oce only' 'oce and ice' or 'mixed oce-ice'
@@ -118,4 +132,7 @@
    CHARACTER(len=100) ::   cn_rcv_rnf         = 'coupled'     ! 'coupled' 'climato' or 'mixed'
    CHARACTER(len=100) ::   cn_rcv_cal         = 'none'        ! 'none' or 'coupled'
+#if defined key_cpl_carbon_cycle 
+   CHARACTER(len=100) ::   cn_rcv_co2         = 'none'        ! 'none' or 'coupled'
+#endif
 
 !!   CHARACTER(len=100), PUBLIC ::   cn_rcv_rnf   !: ???             ==>>  !!gm   treat this case in a different maner
@@ -160,4 +177,7 @@
          cn_rcv_tau_nature, cn_rcv_tau_refere , cn_rcv_tau_orient, cn_rcv_tau_grid ,                 &
          cn_rcv_dqnsdt    , cn_rcv_qsr        , cn_rcv_qns       , cn_rcv_emp      , cn_rcv_rnf , cn_rcv_cal
+#if defined key_cpl_carbon_cycle 
+      NAMELIST/namsbc_cpl_co2/  cn_snd_co2, cn_rcv_co2
+#endif
       !!---------------------------------------------------------------------
 
@@ -195,4 +215,18 @@
       ENDIF
 
+#if defined key_cpl_carbon_cycle 
+      REWIND( numnam )                    ! ... read namlist namsbc_cpl_co2
+      READ  ( numnam, namsbc_cpl_co2 )
+      IF(lwp) THEN                        ! control print
+         WRITE(numout,*)
+         WRITE(numout,*)'sbc_cpl_init : namsbc_cpl_co2 namelist '
+         WRITE(numout,*)'~~~~~~~~~~~~'
+         WRITE(numout,*)'   received fields'
+         WRITE(numout,*)'       atm co2                            cn_rcv_co2         = ', cn_rcv_co2
+         WRITE(numout,*)'   sent fields'
+         WRITE(numout,*)'      oce co2 flux                        cn_snd_co2         = ', cn_snd_co2
+          WRITE(numout,*)
+      ENDIF
+#endif
       ! save current & stress in an array and suppress possible blank in the name
       cn_snd_crt(1) = TRIM( cn_snd_crt_nature )   ;   cn_snd_crt(2) = TRIM( cn_snd_crt_refere )
@@ -372,5 +406,12 @@
       !                                                      !      10m wind module      !   
       !                                                      ! ------------------------- !
-      srcv(jpr_w10m  )%clname = 'O_Wind10'   ;   IF( TRIM(cn_rcv_w10m) == 'coupled' )   srcv(jpr_w10m)%laction = .TRUE.     
+      srcv(jpr_w10m)%clname = 'O_Wind10'   ;   IF( TRIM(cn_rcv_w10m) == 'coupled' )   srcv(jpr_w10m)%laction = .TRUE.     
+
+#if defined key_cpl_carbon_cycle
+      !                                                      ! ------------------------- !
+      !                                                      !      Atmospheric CO2      !
+      !                                                      ! ------------------------- !
+      srcv(jpr_co2 )%clname = 'O_AtmCO2'   ;   IF( TRIM(cn_rcv_co2) == 'coupled' )    srcv(jpr_co2 )%laction = .TRUE.
+#endif
      
       ! ================================ !
@@ -450,4 +491,11 @@
       END SELECT
 
+#if defined key_cpl_carbon_cycle
+      !                                                      ! ------------------------- !
+      !                                                      !          CO2 flux         !
+      !                                                      ! ------------------------- !
+      ssnd(jps_co2)%clname = 'O_CO2FLX' ;  IF( TRIM(cn_snd_co2) == 'coupled' )    ssnd(jps_co2 )%laction = .TRUE.
+#endif
+      !
       ! ================================ !
       !   initialisation of the coupler  !
@@ -632,4 +680,9 @@
          ! it not, we call sbc_tau2wnd in sbc_cpl_rcv (or later, after the ice???)
          !
+#if defined  key_cpl_carbon_cycle
+         !                                                              ! atmosph. CO2 (ppm)
+         IF( srcv(jpr_co2)%laction )   atm_co2(:,:) = frcv(:,:,jpr_co2)
+#endif
+
       ENDIF
       !
@@ -1070,5 +1123,11 @@
       IF( ssnd(jps_hsnw)%laction )   CALL cpl_prism_snd( jps_hsnw, isec, hsnif(:,:) * fr_i(:,:), info )
       !
-      !                                                      ! ------------------------- !
+#if defined key_cpl_carbon_cycle
+      !                                                      ! ------------------------- !
+      !                                                      !  CO2 flux from PISCES     ! 
+      !                                                      ! ------------------------- !
+      IF( ssnd(jps_co2)%laction )   CALL cpl_prism_snd( jps_co2, isec, oce_co2 , info )
+      !
+#endif
       IF( ssnd(jps_ocx1)%laction ) THEN                      !      Surface current      !
          !                                                   ! ------------------------- !
@@ -1197,5 +1256,5 @@
          IF( ssnd(jps_ivy1)%laction )   CALL cpl_prism_snd( jps_ivy1, isec, zity1, info )   ! ice   y current 1st grid
          IF( ssnd(jps_ivz1)%laction )   CALL cpl_prism_snd( jps_ivz1, isec, zitz1, info )   ! ice   z current 1st grid
-         !
+         ! 
       ENDIF
    !
@@ -1239,5 +1298,5 @@
       REAL(wp), INTENT(in   ), DIMENSION(:,:  ), OPTIONAL ::   psst    ! sea surface temperature      [Celcius]
       REAL(wp), INTENT(in   ), DIMENSION(:,:,:), OPTIONAL ::   pist    ! ice surface temperature      [Kelvin]
-      WRITE(*,*) 'sbc_cpl_snd: You should not have seen this print! error?', p_frld(1,1,1), palbi(1,1,1), psst (1,1), pist (1,1,1)
+      WRITE(*,*) 'sbc_cpl_snd: You should not have seen this print! error?', p_frld(1,1,1)
       ! stupid definition to avoid warning message when compiling...
       pqns_tot(:,:) = 0. ; pqns_ice(:,:,:) = 0. ; pdqns_ice(:,:,:) = 0.
