Changeset 3421 for LMDZ6/trunk/libf


Ignore:
Timestamp:
Dec 7, 2018, 10:08:07 PM (6 years ago)
Author:
oboucher
Message:

Further changes for the interactive CO2 cycle
Pulling out the definition of emission terms from tracco2i into carbon cycle module
Declaration in phyetat0

Location:
LMDZ6/trunk/libf/phylmd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/phylmd/carbon_cycle_mod.F90

    r3391 r3421  
    7474  REAL, DIMENSION(:), ALLOCATABLE :: fco2_lu_day     ! Emission from land use change for 1 day (cumulated) [gC/m2/d]
    7575!$OMP THREADPRIVATE(fco2_lu_day)
     76  REAL, DIMENSION(:), ALLOCATABLE, PUBLIC :: fco2_ff ! Emission from fossil fuel [kgCO2/m2/s]
     77!$OMP THREADPRIVATE(fco2_ff)
     78  REAL, DIMENSION(:), ALLOCATABLE, PUBLIC :: fco2_bb ! Emission from biomass burning [kgCO2/m2/s]
     79!$OMP THREADPRIVATE(fco2_bb)
    7680
    7781  REAL, DIMENSION(:,:), ALLOCATABLE :: dtr_add       ! Tracer concentration to be injected
  • LMDZ6/trunk/libf/phylmd/phyetat0.F90

    r3317 r3421  
    435435     END DO
    436436     CALL traclmdz_from_restart(trs)
    437 
     437  ENDIF
     438
     439!--OB now this is for co2i
     440  IF (type_trac == 'co2i') THEN
    438441     IF (carbon_cycle_cpl) THEN
    439442        ALLOCATE(co2_send(klon), stat=ierr)
  • LMDZ6/trunk/libf/phylmd/tracco2i_mod.F90

    r3383 r3421  
    1212    USE infotrac
    1313    USE geometry_mod, ONLY : cell_area
     14    USE carbon_cycle_mod, ONLY : nbcf_in, fields_in, cfname_in, fco2_ocn_day, fco2_ff, fco2_bb
    1415    USE mod_grid_phy_lmdz
    1516    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
     
    4445!----------------
    4546
    46     INTEGER, PARAMETER :: id_CO2=1                           !--temporaire OB=> PC to be changed
    47     REAL, PARAMETER    :: MCO2=44.011   !--g/mol
    48     INTEGER                                 :: it, k, i
    49     REAL, DIMENSION(klon,klev)              :: m_air          ! mass of air in every grid box [kg]
    50     REAL, DIMENSION(klon)                   :: co2ff          ! surface fossil-fuel CO2 emissions [kg CO2/m2/s]
    51     REAL, DIMENSION(klon)                   :: co2bb          ! surface biomass burning CO2 emissions [kg CO2/m2/s]
     47    INTEGER, PARAMETER :: id_CO2=1              !--temporaire OB -- to be changed
     48    INTEGER                        :: it, k, i, nb
     49    REAL, DIMENSION(klon,klev)     :: m_air     ! mass of air in every grid box [kg]
     50    REAL, DIMENSION(klon)          :: co2land   ! surface land CO2 emissions [kg CO2/m2/s]
     51    REAL, DIMENSION(klon)          :: co2ocean  ! surface ocean CO2 emissions [kg CO2/m2/s]
    5252    REAL, DIMENSION(klon_glo,klev) :: co2_glo   ! variable temporaire sur la grille global
    5353    REAL, DIMENSION(klon_glo,klev) :: m_air_glo ! variable temporaire sur la grille global
     
    6868    IF (debutphy) THEN
    6969      IF (MAXVAL(tr_seri(:,:,id_CO2)).LT.1.e-15) THEN
    70         tr_seri(:,:,id_CO2)=280.e-6/RMD*MCO2
     70        tr_seri(:,:,id_CO2)=280.e-6/RMD*RMCO2
    7171      ENDIF
    7272    ENDIF
    7373
    74 !--calculate mass of air in every grid box in kg
     74!--calculate mass of air in every grid box in kg air
    7575    DO i=1, klon
    7676    DO k=1, klev
     
    8181!--call CO2 emission routine
    8282!--co2bb is zero for now
    83     CALL co2_emissions(debutphy,co2ff,co2bb)
     83!--unit kg CO2 m-2 s-1
     84    CALL co2_emissions(debutphy)
     85
     86!--retrieving land and ocean CO2 flux
     87!--fCO2_nep comes in unit of g CO2 m-2 dt_stomate-1
     88!--this needs to be changed in ORCHIDEE
     89    co2land(:)=0.0
     90    co2ocean(:)=0.0
     91    DO nb=1, nbcf_in
     92      IF (cfname_in(nb) == "fCO2_nep" )   co2land(:)=fields_in(:,nb)*RMCO2/RMC/86400./1000.
     93      !!IF (cfname_in(nb) == "fCO2_fgco2" ) co2ocean(:)=fco2_ocn_day(:) !--for now
     94    ENDDO
    8495
    8596!--preparing the net anthropogenic flux at the surface for mixing layer
    8697!--unit kg CO2 / m2 / s
    87     source(:,id_CO2)=co2ff(:)+co2bb(:)
     98    source(:,id_CO2)=fco2_ff(:)+fco2_bb(:)+co2land(:)+co2ocean(:)
    8899
    89100!--computing global mean CO2 for radiation
     101!--every timestep for now but enough every month
    90102!    IF (debutphy.OR.mth_cur.NE.mth_pre) THEN
    91103      CALL gather(tr_seri(:,:,id_CO2),co2_glo)
    92104      CALL gather(m_air,m_air_glo)
    93105!$OMP MASTER
     106!--conversion from kg CO2/kg air into ppm
    94107       IF (is_mpi_root) THEN
    95          RCO2_glo=SUM(co2_glo*m_air_glo)/SUM(m_air_glo)*1.e6*RMD/MCO2
     108         RCO2_glo=SUM(co2_glo*m_air_glo)/SUM(m_air_glo)*1.e6*RMD/RMCO2
    96109       ENDIF
    97        PRINT *,'in tracco2i: global CO2 in ppm =', RCO2_glo
     110       PRINT *,'toto in tracco2i: global CO2 in ppm =', RCO2_glo
    98111!$OMP END MASTER
    99112       CALL bcast(RCO2_glo)
     
    103116  END SUBROUTINE tracco2i
    104117
    105   SUBROUTINE co2_emissions(debutphy,co2ff,co2bb)
     118  SUBROUTINE co2_emissions(debutphy)
    106119
    107120    USE dimphy
     
    116129    USE netcdf, ONLY: nf90_get_var, nf90_noerr, nf90_nowrite
    117130
     131    USE carbon_cycle_mod, ONLY : fco2_ff, fco2_bb
     132
    118133    IMPLICIT NONE
    119134
    120135    INCLUDE "YOMCST.h"
    121136    LOGICAL,INTENT(IN) :: debutphy
    122     REAL,DIMENSION(klon),INTENT(out) :: co2ff            !  fossil-fuel CO2 emissions
    123     REAL,DIMENSION(klon),INTENT(out) :: co2bb            !  biomass burning CO2 emissions
    124137
    125138! For NetCDF:
     
    130143    REAL, POINTER:: vector(:), time(:)
    131144    REAL,ALLOCATABLE       :: flx_co2ff_glo(:,:) !  fossil-fuel CO2
     145    REAL,ALLOCATABLE       :: flx_co2bb_glo(:,:) !  biomass-burning CO2
    132146    REAL,ALLOCATABLE, SAVE :: flx_co2ff(:,:)     !  fossil-fuel CO2
    133     REAL,ALLOCATABLE       :: flx_co2bb_glo(:,:) !  biomass-burning CO2
    134147    REAL,ALLOCATABLE, SAVE :: flx_co2bb(:,:)     !  biomass-burning CO2
    135 !$OMP THREADPRIVATE(flx_co2ff, flx_co2bb)
     148!$OMP THREADPRIVATE(flx_co2ff,flx_co2bb)
    136149
    137150!! may be controlled via the .def later on
     
    234247    PRINT *,'probleme avec le mois dans co2_ini =', mth_cur
    235248  ENDIF
    236   co2ff(:) = flx_co2ff(:,mth_cur)
    237   co2bb(:) = flx_co2bb(:,mth_cur)
     249  IF (.NOT.ALLOCATED(fco2_ff)) ALLOCATE(fco2_ff(klon))
     250  IF (.NOT.ALLOCATED(fco2_bb)) ALLOCATE(fco2_bb(klon))
     251  fco2_ff(:) = flx_co2ff(:,mth_cur)
     252  fco2_bb(:) = flx_co2bb(:,mth_cur)
    238253
    239254  END SUBROUTINE co2_emissions
Note: See TracChangeset for help on using the changeset viewer.