Ignore:
Timestamp:
Nov 21, 2019, 4:43:45 PM (5 years ago)
Author:
lguez
Message:

Merge revisions 3427:3600 of trunk into branch Ocean_skin

Location:
LMDZ6/branches/Ocean_skin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/Ocean_skin

  • LMDZ6/branches/Ocean_skin/libf/phylmd/carbon_cycle_mod.F90

    r3421 r3605  
    77!  -----------------------
    88! Control module for the carbon CO2 tracers :
    9 !   - Identification
    10 !   - Get concentrations comming from coupled model or read from file to tracers
    11 !   - Calculate new RCO2 for radiation scheme
    12 !   - Calculate new carbon flux for sending to coupled models (PISCES and ORCHIDEE)
    13 !
    14 ! Module permettant de mettre a jour les champs (puits et sources) pour le
    15 ! transport de CO2 en online (IPSL-CM et LMDZOR) et offline (lecture de carte)
     9!   - Initialisation of carbon cycle fields
     10!   - Definition of fluxes to be exchanged
     11!
     12! Rest of code is in tracco2i.F90
    1613!
    1714! Le cas online/offline est defini par le flag carbon_cycle_cpl (y/n)
     
    3532  SAVE
    3633  PRIVATE
    37   PUBLIC :: carbon_cycle_init, carbon_cycle, infocfields_init
     34  PUBLIC :: carbon_cycle_init, infocfields_init
    3835
    3936! Variables read from parmeter file physiq.def
     37  LOGICAL, PUBLIC :: carbon_cycle_cpl       ! Coupling of CO2 fluxes between LMDZ/ORCHIDEE and LMDZ/OCEAN(PISCES)
     38!$OMP THREADPRIVATE(carbon_cycle_cpl)
    4039  LOGICAL, PUBLIC :: carbon_cycle_tr        ! 3D transport of CO2 in the atmosphere, parameter read in conf_phys
    4140!$OMP THREADPRIVATE(carbon_cycle_tr)
    42   LOGICAL, PUBLIC :: carbon_cycle_cpl       ! Coupling of CO2 fluxes between LMDZ/ORCHIDEE and LMDZ/OCEAN(PISCES)
    43 !$OMP THREADPRIVATE(carbon_cycle_cpl)
     41  LOGICAL, PUBLIC :: carbon_cycle_rad       ! CO2 interactive radiatively
     42!$OMP THREADPRIVATE(carbon_cycle_rad)
    4443  INTEGER, PUBLIC :: level_coupling_esm ! Level of coupling for the ESM - 0, 1, 2, 3
    4544!$OMP THREADPRIVATE(level_coupling_esm)
     45  REAL, PUBLIC :: RCO2_glo
     46!$OMP THREADPRIVATE(RCO2_glo)
     47  REAL, PUBLIC :: RCO2_tot
     48!$OMP THREADPRIVATE(RCO2_tot)
    4649
    4750  LOGICAL :: carbon_cycle_emis_comp_omp=.FALSE.
     
    7881  REAL, DIMENSION(:), ALLOCATABLE, PUBLIC :: fco2_bb ! Emission from biomass burning [kgCO2/m2/s]
    7982!$OMP THREADPRIVATE(fco2_bb)
     83  REAL, DIMENSION(:), ALLOCATABLE, PUBLIC :: fco2_land  ! Net flux from terrestrial ecocsystems [kgCO2/m2/s]
     84!$OMP THREADPRIVATE(fco2_land)
     85  REAL, DIMENSION(:), ALLOCATABLE, PUBLIC :: fco2_land_nbp  ! Net flux from terrestrial ecocsystems [kgCO2/m2/s]
     86!$OMP THREADPRIVATE(fco2_land_nbp)
     87  REAL, DIMENSION(:), ALLOCATABLE, PUBLIC :: fco2_land_nep  ! Net flux from terrestrial ecocsystems [kgCO2/m2/s]
     88!$OMP THREADPRIVATE(fco2_land_nep)
     89  REAL, DIMENSION(:), ALLOCATABLE, PUBLIC :: fco2_land_fLuc  ! Net flux from terrestrial ecocsystems [kgCO2/m2/s]
     90!$OMP THREADPRIVATE(fco2_land_fLuc)
     91  REAL, DIMENSION(:), ALLOCATABLE, PUBLIC :: fco2_land_fwoodharvest  ! Net flux from terrestrial ecocsystems [kgCO2/m2/s]
     92!$OMP THREADPRIVATE(fco2_land_fwoodharvest)
     93  REAL, DIMENSION(:), ALLOCATABLE, PUBLIC :: fco2_land_fHarvest  ! Net flux from terrestrial ecocsystems [kgCO2/m2/s]
     94!$OMP THREADPRIVATE(fco2_land_fHarvest)
     95  REAL, DIMENSION(:), ALLOCATABLE, PUBLIC :: fco2_ocean ! Net flux from ocean [kgCO2/m2/s]
     96!$OMP THREADPRIVATE(fco2_ocean)
    8097
    8198  REAL, DIMENSION(:,:), ALLOCATABLE :: dtr_add       ! Tracer concentration to be injected
     
    91108  REAL, DIMENSION(:), ALLOCATABLE, PUBLIC :: co2_send ! Field allocated in phyetat0
    92109!$OMP THREADPRIVATE(co2_send)
     110
     111  INTEGER, PARAMETER, PUBLIC :: id_CO2=1              !--temporaire OB -- to be changed
    93112
    94113! nbfields : total number of fields
     
    181200CONTAINS
    182201 
    183   SUBROUTINE carbon_cycle_init(tr_seri, pdtphys, aerosol, radio)
     202  SUBROUTINE carbon_cycle_init()
    184203! This subroutine is called from traclmdz_init, only at first timestep.
    185204! - Read controle parameters from .def input file
     
    189208
    190209    USE dimphy
    191     USE geometry_mod, ONLY : cell_area
    192     USE mod_phys_lmdz_transfert_para
    193     USE infotrac_phy, ONLY: nbtr, nqo, niadv, tname
    194210    USE IOIPSL
    195     USE surface_data, ONLY : ok_veget, type_ocean
    196     USE phys_cal_mod, ONLY : mth_len
    197211    USE print_control_mod, ONLY: lunout
    198212
     
    200214    INCLUDE "clesphys.h"
    201215 
    202 ! Input argument
    203     REAL,DIMENSION(klon,klev,nbtr),INTENT(IN) :: tr_seri ! Concentration Traceur [U/KgA] 
    204     REAL,INTENT(IN)                           :: pdtphys ! length of time step in physiq (sec)
    205 
    206 ! InOutput arguments
    207     LOGICAL,DIMENSION(nbtr), INTENT(INOUT) :: aerosol
    208     LOGICAL,DIMENSION(nbtr), INTENT(INOUT) :: radio
    209 
    210216! Local variables
    211     INTEGER               :: ierr, it, iiq, itc
    212     INTEGER               :: teststop
    213 
    214 ! 1) Read controle parameters from .def input file
    215 ! ------------------------------------------------
    216     ! Read fosil fuel value if no transport
    217     IF (.NOT. carbon_cycle_tr) THEN
    218 !$OMP MASTER
    219        fos_fuel_s_omp = 0.
    220        CALL getin ('carbon_cycle_fos_fuel',fos_fuel_s_omp)
    221 !$OMP END MASTER
    222 !$OMP BARRIER
    223        fos_fuel_s=fos_fuel_s_omp
    224        WRITE(lunout,*) 'carbon_cycle_fos_fuel = ', fos_fuel_s
    225     END IF
    226 
    227     ! Read parmeter for calculation compatible emission
    228     IF (.NOT. carbon_cycle_tr) THEN
    229 !$OMP MASTER
    230        carbon_cycle_emis_comp_omp=.FALSE.
    231        CALL getin('carbon_cycle_emis_comp',carbon_cycle_emis_comp_omp)
    232 !$OMP END MASTER
    233 !$OMP BARRIER
    234        carbon_cycle_emis_comp=carbon_cycle_emis_comp_omp
    235        WRITE(lunout,*) 'carbon_cycle_emis_comp = ',carbon_cycle_emis_comp
    236        IF (carbon_cycle_emis_comp) THEN
    237           CALL abort_physic('carbon_cycle_init', 'carbon_cycle_emis_comp option not yet implemented!!',1)
    238        END IF
    239     END IF
    240 
    241     ! Read parameter for interactive calculation of the CO2 value for the radiation scheme
    242 !$OMP MASTER
    243     RCO2_inter_omp=.FALSE.
    244     CALL getin('RCO2_inter',RCO2_inter_omp)
    245 !$OMP END MASTER
    246 !$OMP BARRIER
    247     RCO2_inter=RCO2_inter_omp
    248     WRITE(lunout,*) 'RCO2_inter = ', RCO2_inter
    249     IF (RCO2_inter) THEN
    250        WRITE(lunout,*) 'RCO2 will be recalculated once a day'
    251        WRITE(lunout,*) 'RCO2 initial = ', RCO2
    252     END IF
    253 
    254 
    255 ! 2) Search for carbon tracers and set default values
    256 ! ---------------------------------------------------
    257     itc=0
    258     DO it=1,nbtr
    259 !!       iiq=niadv(it+2)                                                            ! jyg
    260        iiq=niadv(it+nqo)                                                            ! jyg
    261        
    262        SELECT CASE(tname(iiq))
    263        CASE("fCO2_ocn")
    264           itc = itc + 1
    265           co2trac(itc)%name='fCO2_ocn'
    266           co2trac(itc)%id=it
    267           co2trac(itc)%file='fl_co2_ocean.nc'
    268           IF (carbon_cycle_cpl .AND. type_ocean=='couple') THEN
    269              co2trac(itc)%cpl=.TRUE.
    270              co2trac(itc)%updatefreq = 86400 ! Once a day as the coupling with OASIS/PISCES
    271           ELSE
    272              co2trac(itc)%cpl=.FALSE.
    273              co2trac(itc)%updatefreq = 86400*mth_len ! Once a month
    274           END IF
    275        CASE("fCO2_land")
    276           itc = itc + 1
    277           co2trac(itc)%name='fCO2_land'
    278           co2trac(itc)%id=it
    279           co2trac(itc)%file='fl_co2_land.nc'
    280           IF (carbon_cycle_cpl .AND. ok_veget) THEN
    281              co2trac(itc)%cpl=.TRUE.
    282              co2trac(itc)%updatefreq = INT(pdtphys) ! Each timestep as the coupling with ORCHIDEE
    283           ELSE
    284              co2trac(itc)%cpl=.FALSE.
    285 !             co2trac(itc)%updatefreq = 10800   ! 10800sec = 3H
    286              co2trac(itc)%updatefreq = 86400*mth_len ! Once a month
    287           END IF
    288        CASE("fCO2_land_use")
    289           itc = itc + 1
    290           co2trac(itc)%name='fCO2_land_use'
    291           co2trac(itc)%id=it
    292           co2trac(itc)%file='fl_co2_land_use.nc'
    293           IF (carbon_cycle_cpl .AND. ok_veget) THEN
    294              co2trac(it)%cpl=.TRUE.
    295              co2trac(itc)%updatefreq = INT(pdtphys) ! Each timestep as the coupling with ORCHIDEE
    296           ELSE
    297              co2trac(itc)%cpl=.FALSE.
    298              co2trac(itc)%updatefreq = 10800   ! 10800sec = 3H
    299           END IF
    300        CASE("fCO2_fos_fuel")
    301           itc = itc + 1
    302           co2trac(itc)%name='fCO2_fos_fuel'
    303           co2trac(itc)%id=it
    304           co2trac(itc)%file='fossil_fuel.nc'
    305           co2trac(itc)%cpl=.FALSE.       ! This tracer always read from file
    306 !         co2trac(itc)%updatefreq = 86400  ! 86400sec = 24H Cadule case
    307           co2trac(itc)%updatefreq = 86400*mth_len ! Once a month
    308        CASE("fCO2_bbg")
    309           itc = itc + 1
    310           co2trac(itc)%name='fCO2_bbg'
    311           co2trac(itc)%id=it
    312           co2trac(itc)%file='fl_co2_bbg.nc'
    313           co2trac(itc)%cpl=.FALSE.       ! This tracer always read from file
    314           co2trac(itc)%updatefreq = 86400*mth_len ! Once a month
    315        CASE("fCO2")
    316           ! fCO2 : One tracer transporting the total CO2 flux
    317           itc = itc + 1
    318           co2trac(itc)%name='fCO2'
    319           co2trac(itc)%id=it
    320           co2trac(itc)%file='fl_co2.nc'
    321           IF (carbon_cycle_cpl) THEN
    322              co2trac(itc)%cpl=.TRUE.
    323           ELSE
    324              co2trac(itc)%cpl=.FALSE.
    325           END IF
    326           co2trac(itc)%updatefreq = 86400
    327           ! DOES THIS WORK ???? Problematic due to implementation of the coupled fluxes...
    328           CALL abort_physic('carbon_cycle_init','transport of total CO2 has to be implemented and tested',1)
    329        END SELECT
    330     END DO
    331 
    332     ! Total number of carbon CO2 tracers
    333     ntr_co2 = itc
    334    
    335     ! Definition of control varaiables for the tracers
    336     DO it=1,ntr_co2
    337        aerosol(co2trac(it)%id) = .FALSE.
    338        radio(co2trac(it)%id)   = .FALSE.
    339     END DO
    340    
    341     ! Vector indicating which timestep to read for each tracer
    342     ! Always start read in the beginning of the file
    343     co2trac(:)%readstep = 0
    344    
    345 
    346 ! 3) Allocate variables
    347 ! ---------------------
    348     ! Allocate vector for storing fluxes to inject
    349     ALLOCATE(dtr_add(klon,maxco2trac), stat=ierr)
    350     IF (ierr /= 0) CALL abort_physic('carbon_cycle_init', 'pb in allocation 11',1)       
    351    
    352     ! Allocate variables for cumulating fluxes from ORCHIDEE
    353     IF (RCO2_inter) THEN
    354        IF (.NOT. carbon_cycle_tr .AND. carbon_cycle_cpl) THEN
    355           ALLOCATE(fco2_land_day(klon), stat=ierr)
    356           IF (ierr /= 0) CALL abort_physic('carbon_cycle_init', 'pb in allocation 2',1)
    357           fco2_land_day(1:klon) = 0.
    358          
    359           ALLOCATE(fco2_lu_day(klon), stat=ierr)
    360           IF (ierr /= 0) CALL abort_physic('carbon_cycle_init', 'pb in allocation 3',1)
    361           fco2_lu_day(1:klon)   = 0.
    362        END IF
    363     END IF
    364 
    365 
    366 ! 4) Test for compatibility
    367 ! -------------------------
    368 !    IF (carbon_cycle_cpl .AND. type_ocean/='couple') THEN
    369 !       WRITE(lunout,*) 'Coupling with ocean model is needed for carbon_cycle_cpl'
    370 !       CALL abort_physic('carbon_cycle_init', 'coupled ocean is needed for carbon_cycle_cpl',1)
    371 !    END IF
    372 !
    373 !    IF (carbon_cycle_cpl .AND..NOT. ok_veget) THEN
    374 !       WRITE(lunout,*) 'Coupling with surface land model ORCHDIEE is needed for carbon_cycle_cpl'
    375 !       CALL abort_physic('carbon_cycle_init', 'ok_veget is needed for carbon_cycle_cpl',1)
    376 !    END IF
    377 
    378     ! Compiler test : following should never happen
    379     teststop=0
    380     DO it=1,teststop
    381        CALL abort_physic('carbon_cycle_init', 'Entering loop from 1 to 0',1)
    382     END DO
    383 
    384     IF (ntr_co2==0) THEN
    385        ! No carbon tracers found in tracer.def. It is not possible to do carbon cycle
    386        WRITE(lunout,*) 'No carbon tracers found in tracer.def. Not ok with carbon_cycle_tr and/or carbon_cycle_cp'
    387        CALL abort_physic('carbon_cycle_init', 'No carbon tracers found in tracer.def',1)
    388     END IF
    389    
    390 ! 5) Calculate total area of the earth surface
    391 ! --------------------------------------------
    392     CALL reduce_sum(SUM(cell_area),airetot)
    393     CALL bcast(airetot)
     217    INTEGER               :: ierr
     218
     219    IF (carbon_cycle_cpl) THEN
     220
     221       ierr=0
     222
     223       IF (.NOT.ALLOCATED(fco2_land)) ALLOCATE(fco2_land(klon), stat=ierr)
     224       IF (ierr /= 0) CALL abort_physic('carbon_cycle_init', 'pb in allocation fco2_land',1)
     225       fco2_land(1:klon) = 0.
     226
     227       IF (.NOT.ALLOCATED(fco2_land_nbp)) ALLOCATE(fco2_land_nbp(klon), stat=ierr)
     228       IF (ierr /= 0) CALL abort_physic('carbon_cycle_init', 'pb in allocation fco2_land_nbp',1)
     229       fco2_land_nbp(1:klon) = 0.
     230
     231       IF (.NOT.ALLOCATED(fco2_land_nep)) ALLOCATE(fco2_land_nep(klon), stat=ierr)
     232       IF (ierr /= 0) CALL abort_physic('carbon_cycle_init', 'pb in allocation fco2_land_nep',1)
     233       fco2_land_nep(1:klon) = 0.
     234
     235       IF (.NOT.ALLOCATED(fco2_land_fLuc)) ALLOCATE(fco2_land_fLuc(klon), stat=ierr)
     236       IF (ierr /= 0) CALL abort_physic('carbon_cycle_init', 'pb in allocation fco2_land_fLuc',1)
     237       fco2_land_fLuc(1:klon) = 0.
     238
     239       IF (.NOT.ALLOCATED(fco2_land_fwoodharvest)) ALLOCATE(fco2_land_fwoodharvest(klon), stat=ierr)
     240       IF (ierr /= 0) CALL abort_physic('carbon_cycle_init', 'pb in allocation fco2_land_fwoodharvest',1)
     241       fco2_land_fwoodharvest(1:klon) = 0.
     242
     243       IF (.NOT.ALLOCATED(fco2_land_fHarvest)) ALLOCATE(fco2_land_fHarvest(klon), stat=ierr)
     244       IF (ierr /= 0) CALL abort_physic('carbon_cycle_init', 'pb in allocation fco2_land_fHarvest',1)
     245       fco2_land_fHarvest(1:klon) = 0.
     246
     247       IF (.NOT.ALLOCATED(fco2_ff)) ALLOCATE(fco2_ff(klon), stat=ierr)
     248       IF (ierr /= 0) CALL abort_physic('carbon_cycle_init', 'pb in allocation fco2_ff',1)
     249       fco2_ff(1:klon) = 0.
     250
     251       IF (.NOT.ALLOCATED(fco2_bb)) ALLOCATE(fco2_bb(klon), stat=ierr)
     252       IF (ierr /= 0) CALL abort_physic('carbon_cycle_init', 'pb in allocation fco2_bb',1)
     253       fco2_bb(1:klon) = 0.
     254
     255       IF (.NOT.ALLOCATED(fco2_ocean)) ALLOCATE(fco2_ocean(klon), stat=ierr)
     256       IF (ierr /= 0) CALL abort_physic('carbon_cycle_init', 'pb in allocation fco2_ocean',1)
     257       fco2_bb(1:klon) = 0.
     258    ENDIF
    394259
    395260  END SUBROUTINE carbon_cycle_init
    396261
    397   SUBROUTINE carbon_cycle(nstep, pdtphys, pctsrf, tr_seri, source)
    398 ! Subroutine for injection of co2 in the tracers
    399 !
    400 ! - Find out if it is time to update
    401 ! - Get tracer from coupled model or from file
    402 ! - Calculate new RCO2 value for the radiation scheme
    403 ! - Calculate CO2 flux to send to ocean and land models (PISCES and ORCHIDEE)
    404 
    405     USE infotrac_phy, ONLY: nbtr
    406     USE dimphy
    407     USE mod_phys_lmdz_transfert_para
    408     USE phys_cal_mod, ONLY : mth_cur, mth_len
    409     USE phys_cal_mod, ONLY : day_cur
    410     USE indice_sol_mod
    411     USE print_control_mod, ONLY: lunout
    412     USE geometry_mod, ONLY : cell_area
    413 
    414     IMPLICIT NONE
    415 
    416     INCLUDE "clesphys.h"
    417     INCLUDE "YOMCST.h"
    418 
    419 ! In/Output arguments
    420     INTEGER,INTENT(IN) :: nstep      ! time step in physiq
    421     REAL,INTENT(IN)    :: pdtphys    ! length of time step in physiq (sec)
    422     REAL,DIMENSION(klon,nbsrf),INTENT(IN) :: pctsrf            ! Surface fraction
    423     REAL, DIMENSION(klon,klev,nbtr), INTENT(INOUT)  :: tr_seri ! All tracers
    424     REAL, DIMENSION(klon,nbtr), INTENT(INOUT)       :: source  ! Source for all tracers
    425 
    426 ! Local variables
    427     INTEGER :: it
    428     LOGICAL :: newmonth ! indicates if a new month just started
    429     LOGICAL :: newday   ! indicates if a new day just started
    430     LOGICAL :: endday   ! indicated if last time step in a day
    431 
    432     REAL, PARAMETER :: fact=1.E-15/2.12  ! transformation factor from gC/m2/day => ppm/m2/day
    433     REAL, DIMENSION(klon) :: fco2_tmp
    434     REAL :: sumtmp
    435     REAL :: delta_co2_ppm
    436    
    437 
    438 ! 1) Calculate logicals indicating if it is a new month, new day or the last time step in a day (end day)
    439 ! -------------------------------------------------------------------------------------------------------
    440 
    441     newday = .FALSE.; endday = .FALSE.; newmonth = .FALSE.
    442 
    443     IF (MOD(nstep,INT(86400./pdtphys))==1) newday=.TRUE.
    444     IF (MOD(nstep,INT(86400./pdtphys))==0) endday=.TRUE.
    445     IF (newday .AND. day_cur==1) newmonth=.TRUE.
    446 
    447 ! 2)  For each carbon tracer find out if it is time to inject (update)
    448 ! --------------------------------------------------------------------
    449     DO it = 1, ntr_co2
    450        IF ( MOD(nstep,INT(co2trac(it)%updatefreq/pdtphys)) == 1 ) THEN
    451           co2trac(it)%updatenow = .TRUE.
    452        ELSE
    453           co2trac(it)%updatenow = .FALSE.
    454        END IF
    455     END DO
    456 
    457 ! 3) Get tracer update
    458 ! --------------------------------------
    459     DO it = 1, ntr_co2
    460        IF ( co2trac(it)%updatenow ) THEN
    461           IF ( co2trac(it)%cpl ) THEN
    462              ! Get tracer from coupled model
    463              SELECT CASE(co2trac(it)%name)
    464              CASE('fCO2_land')     ! from ORCHIDEE
    465                 dtr_add(:,it) = fco2_land_inst(:)*pctsrf(:,is_ter)*fact ! [ppm/m2/day]
    466              CASE('fCO2_land_use') ! from ORCHIDEE
    467                 dtr_add(:,it) = fco2_lu_inst(:)  *pctsrf(:,is_ter)*fact ! [ppm/m2/day]
    468              CASE('fCO2_ocn')      ! from PISCES
    469                 dtr_add(:,it) = fco2_ocn_day(:)  *pctsrf(:,is_oce)*fact ! [ppm/m2/day]
    470              CASE DEFAULT
    471                 WRITE(lunout,*) 'Error with tracer ',co2trac(it)%name
    472                 CALL abort_physic('carbon_cycle', 'No coupling implemented for this tracer',1)
    473              END SELECT
    474           ELSE
    475              ! Read tracer from file
    476              co2trac(it)%readstep = co2trac(it)%readstep + 1 ! increment time step in file
    477 ! Patricia   CALL read_map2D(co2trac(it)%file,'fco2',co2trac(it)%readstep,.FALSE.,dtr_add(:,it))
    478              CALL read_map2D(co2trac(it)%file,'fco2',co2trac(it)%readstep,.TRUE.,dtr_add(:,it))
    479 
    480              ! Converte from kgC/m2/h to kgC/m2/s
    481              dtr_add(:,it) = dtr_add(:,it)/3600
    482              ! Add individual treatment of values read from file
    483              SELECT CASE(co2trac(it)%name)
    484              CASE('fCO2_land')
    485                 dtr_add(:,it) = dtr_add(:,it) *pctsrf(:,is_ter)
    486              CASE('fCO2_land_use')
    487                 dtr_add(:,it) = dtr_add(:,it) *pctsrf(:,is_ter)
    488              CASE('fCO2_ocn')
    489                 dtr_add(:,it) = dtr_add(:,it) *pctsrf(:,is_oce)
    490 ! Patricia :
    491 !             CASE('fCO2_fos_fuel')
    492 !                dtr_add(:,it) = dtr_add(:,it)/mth_len
    493 !                co2trac(it)%readstep = 0 ! Always read same value for fossil fuel(Cadule case)
    494              END SELECT
    495           END IF
    496        END IF
    497     END DO
    498 
    499 ! 4) Update co2 tracers :
    500 !    Loop over all carbon tracers and add source
    501 ! ------------------------------------------------------------------
    502     IF (carbon_cycle_tr) THEN
    503        DO it = 1, ntr_co2
    504           IF (.FALSE.) THEN
    505              tr_seri(1:klon,1,co2trac(it)%id) = tr_seri(1:klon,1,co2trac(it)%id) + dtr_add(1:klon,it)
    506              source(1:klon,co2trac(it)%id) = 0.
    507           ELSE
    508              source(1:klon,co2trac(it)%id) = dtr_add(1:klon,it)
    509           END IF
    510        END DO
    511     END IF
    512 
    513 
    514 ! 5) Calculations for new CO2 value for the radiation scheme(instead of reading value from .def)
    515 ! ----------------------------------------------------------------------------------------------
    516     IF (RCO2_inter) THEN
    517        ! Cumulate fluxes from ORCHIDEE at each timestep
    518        IF (.NOT. carbon_cycle_tr .AND. carbon_cycle_cpl) THEN
    519           IF (newday) THEN ! Reset cumulative variables once a day
    520              fco2_land_day(1:klon) = 0.
    521              fco2_lu_day(1:klon)   = 0.
    522           END IF
    523           fco2_land_day(1:klon) = fco2_land_day(1:klon) + fco2_land_inst(1:klon) ![gC/m2/day]
    524           fco2_lu_day(1:klon)   = fco2_lu_day(1:klon)   + fco2_lu_inst(1:klon)   ![gC/m2/day]
    525        END IF
    526 
    527        ! At the end of a new day, calculate a mean scalare value of CO2
    528        ! JG : Ici on utilise uniquement le traceur du premier couche du modele. Est-ce que c'est correcte ?
    529        IF (endday) THEN
    530 
    531           IF (carbon_cycle_tr) THEN
    532              ! Sum all co2 tracers to get the total delta CO2 flux
    533              fco2_tmp(:) = 0.
    534              DO it = 1, ntr_co2
    535                 fco2_tmp(1:klon) = fco2_tmp(1:klon) + tr_seri(1:klon,1,co2trac(it)%id)
    536              END DO
    537              
    538           ELSE IF (carbon_cycle_cpl) THEN ! no carbon_cycle_tr
    539              ! Sum co2 fluxes comming from coupled models and parameter for fossil fuel
    540              fco2_tmp(1:klon) = fos_fuel_s + ((fco2_lu_day(1:klon) + fco2_land_day(1:klon))*pctsrf(1:klon,is_ter) &
    541                   + fco2_ocn_day(:)*pctsrf(:,is_oce)) * fact
    542           END IF
    543 
    544           ! Calculate a global mean value of delta CO2 flux
    545           fco2_tmp(1:klon) = fco2_tmp(1:klon) * cell_area(1:klon)
    546           CALL reduce_sum(SUM(fco2_tmp),sumtmp)
    547           CALL bcast(sumtmp)
    548           delta_co2_ppm = sumtmp/airetot
    549          
    550           ! Add initial value for co2_ppm and delta value
    551           co2_ppm = co2_ppm0 + delta_co2_ppm
    552          
    553           ! Transformation of atmospheric CO2 concentration for the radiation code
    554           RCO2 = co2_ppm * 1.0e-06  * 44.011/28.97
    555          
    556           WRITE(lunout,*) 'RCO2 is now updated! RCO2 = ', RCO2
    557        END IF ! endday
    558 
    559     END IF ! RCO2_inter
    560 
    561 
    562 ! 6) Calculate CO2 flux to send to ocean and land models : PISCES and ORCHIDEE         
    563 ! ----------------------------------------------------------------------------
    564     IF (carbon_cycle_cpl) THEN
    565 
    566        IF (carbon_cycle_tr) THEN
    567           ! Sum all co2 tracers to get the total delta CO2 flux at first model layer
    568           fco2_tmp(:) = 0.
    569           DO it = 1, ntr_co2
    570              fco2_tmp(1:klon) = fco2_tmp(1:klon) + tr_seri(1:klon,1,co2trac(it)%id)
    571           END DO
    572           co2_send(1:klon) = fco2_tmp(1:klon) + co2_ppm0
    573        ELSE
    574           ! Send a scalare value in 2D variable to ocean and land model (PISCES and ORCHIDEE)
    575           co2_send(1:klon) = co2_ppm
    576        END IF
    577 
    578     END IF
    579 
    580   END SUBROUTINE carbon_cycle
    581  
    582262  SUBROUTINE infocfields_init
    583263
    584     USE control_mod, ONLY: planet_type
     264!    USE control_mod, ONLY: planet_type
    585265    USE phys_cal_mod, ONLY : mth_cur
    586266    USE mod_synchro_omp
     
    656336
    657337  CHARACTER(len=*),parameter :: modname="infocfields"
     338
     339  CHARACTER(len=10),SAVE :: planet_type="earth"
    658340
    659341!-----------------------------------------------------------------------
     
    718400                  WRITE(lunout,*) 'abort_gcm --- nbcf_in : ',nbcf_in
    719401                  WRITE(lunout,*) 'abort_gcm --- nbcf_out: ',nbcf_out
    720                   CALL abort_gcm('infocfields_init','Problem in the definition of the coupling fields',1)
     402                  CALL abort_physic('infocfields_init','Problem in the definition of the coupling fields',1)
    721403               ENDIF
    722404             ENDDO !DO iq=1,nbcf
     
    836518
    837519 ALLOCATE(fields_in(klon,nbcf_in),stat=error)
    838  IF (error /= 0)  CALL abort_gcm(modname,'Pb in allocation fields_in',1)
     520 IF (error /= 0)  CALL abort_physic(modname,'Pb in allocation fields_in',1)
    839521 ALLOCATE(yfields_in(klon,nbcf_in),stat=error)
    840  IF (error /= 0)  CALL abort_gcm(modname,'Pb in allocation yfields_in',1)
     522 IF (error /= 0)  CALL abort_physic(modname,'Pb in allocation yfields_in',1)
    841523 ALLOCATE(fields_out(klon,nbcf_out),stat=error)
    842  IF (error /= 0)  CALL abort_gcm(modname,'Pb in allocation fields_out',1)
     524 IF (error /= 0)  CALL abort_physic(modname,'Pb in allocation fields_out',1)
    843525 ALLOCATE(yfields_out(klon,nbcf_out),stat=error)
    844  IF (error /= 0)  CALL abort_gcm(modname,'Pb in allocation yfields_out',1)
     526 IF (error /= 0)  CALL abort_physic(modname,'Pb in allocation yfields_out',1)
    845527
    846528END SUBROUTINE infocfields_init
Note: See TracChangeset for help on using the changeset viewer.