Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for the carbon simulation #1992

Merged
merged 24 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d6b9401
Remove tagged species handling from carbon_gases_mod.F90
yantosca Oct 16, 2023
3549162
Add advected-only species ID flags for carbon simulation + cleanup
yantosca Oct 16, 2023
143cefc
Remove USE_CH4_DATA.or.USE_CO2_DATA around GFED entries for carbon sim
yantosca Oct 16, 2023
5770377
Add "carbon" to the list of GCHP sims that allow bootstrapping
yantosca Oct 19, 2023
b1bc9ec
Bring PR #1992 up to date with the latest dev/no-diff-to-benchmark
yantosca Jan 9, 2024
ad4a49c
Update carbon simulation configuration files for consistency
yantosca Jan 9, 2024
e03ea24
Further config file updates for the GCHP carbon simulation
yantosca Jan 11, 2024
906f1f1
Fix incorrect entries for EDGARv7 in HEMCO_Config, ExtData templates
yantosca Jan 12, 2024
63e7a15
Now read CO2_COPROD data at 72L for CO2, carbon simulations
yantosca Jan 12, 2024
d64bfd6
Fix entry for GHGI_EE_GAS_TRANSMISSION; Reactivate CO2_CO2PROD
yantosca Jan 16, 2024
29d450a
Fix entry for GHGI_EE_COAST_GAS_TRANSMISSION
yantosca Jan 16, 2024
faaa3d7
Remove $DD token from 14.0.0 RUNDIR_GLOBAL_* entries in HEMCO_Config.rc
yantosca Jan 16, 2024
9baf788
Rename NEI2016 mask in carbon config files to avoid name collision
yantosca Jan 17, 2024
98435d7
Update singleCarbonSpecies.sh to remove non-emissions data entries
yantosca Jan 17, 2024
c3a0dd1
Further updates in the singleCarbonSpecies.sh script
yantosca Jan 18, 2024
0be488e
Update carbon simulation HEMCO_Config.rc and ExtData.rc templates
yantosca Jan 19, 2024
a27adc6
Use same files in carbon, CH4, tagCH4 configuration files
yantosca Jan 24, 2024
7fb0d64
Fix incorrect entry for CEDS_CO2_SHP in carbon config files
yantosca Jan 25, 2024
ae9e69e
Merge branch 'main' into feature/carbon-sim-fixes
msulprizio Mar 5, 2024
7e78f41
Update HISTORY.rc files for carbon and CH4 simulations
msulprizio Mar 22, 2024
96eabd7
Activate carbon and CH4 integration tests for GCHP
msulprizio Mar 26, 2024
a7de9b9
Merge branch 'dev/14.4.0' into feature/carbon-sim-fixes
msulprizio Mar 27, 2024
e927528
Fix typos in HEMCO_Config.rc for CH4 and tagCH4 simulations
msulprizio Mar 27, 2024
e837aba
Make minor comment changes following carbon simulation fixes
msulprizio Mar 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Use rate-law function `GCARR_ac` for rxns that have Arrhenius `B` parameters that are zero
- Now use correct index `WEAEROSOL(I,J,L,2+NDUST)` in routine `Settle_Strat_Aer` of `GeosCore/ucx_mod.F90`
- Now get density of BCPI species from the species database in `ucx_mod.F90`
- Fix issues that prevented single-species carbon simulations from running
- Update `HEMCO_Config.rc.carbon` and `ExtData.rc.carbon` templates for consistency
lizziel marked this conversation as resolved.
Show resolved Hide resolved
- Updated several emissions files for CO and CH4 for COARDS and MAPL compliance

### Removed
- Legacy binary punch diagnostic code contained within `#ifdef BPCH_DIAG` blocks
- `IU_BPCH` logical file unit (in `GeosUtil/file_mod.F90`)
- Removed tagged CH4 and CO species handling from `carbon_gases_mod.F90`

## [14.3.0] - 2024-02-07
### Added
Expand Down
243 changes: 17 additions & 226 deletions GeosCore/carbon_gases_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,13 @@ MODULE Carbon_Gases_Mod
!
! !PRIVATE TYPES:
!
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!@@@ TAGGED SPECIES HANDLING
!@@@ Set a switch to activate tagged species
!@@@ NOTE: By default, this is not supported and needs further work!
!#define ACTIVATE_TAGGED_SPECIES
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

! Scalars
LOGICAL :: useGlobOHbmk10yr
LOGICAL :: useGlobOHv5
INTEGER :: id_CH4, id_CO, id_COch4, id_COnmvoc
INTEGER :: id_COisop, id_COch3oh, id_COmono, id_COacet
INTEGER :: id_CO2, id_CO2ch, id_OCS, id_OH
INTEGER :: id_CH4, id_CH4_adv, id_CO, id_CO_adv
INTEGER :: id_CO2, id_CO2_adv, id_OCS, id_OCS_adv
INTEGER :: id_OH
REAL(fp) :: xnumol_CH4, xnumol_CO, xnumol_CO2, xnumol_OH

! Arrays
Expand Down Expand Up @@ -196,7 +190,7 @@ SUBROUTINE Emiss_Carbon_Gases( Input_Opt, State_Chm, State_Diag, &
! defined.
! (ckeller, 9/12/2013)
!========================================================================
IF ( id_CH4 > 0 ) THEN
IF ( id_CH4_adv > 0 ) THEN

! Initialize
CH4_EMIS_J = 0.0_fp
Expand Down Expand Up @@ -279,7 +273,7 @@ SUBROUTINE Emiss_Carbon_Gases( Input_Opt, State_Chm, State_Diag, &
!========================================================================
! CO2 production from CO oxidation
!========================================================================
IF ( Input_Opt%LCHEMCO2 .and. id_CO2 > 0 ) THEN
IF ( Input_Opt%LCHEMCO2 .and. id_CO2_adv > 0 ) THEN

! Point to chemical species array [kg/kg dry air]
Spc => State_Chm%Species
Expand Down Expand Up @@ -331,16 +325,6 @@ SUBROUTINE Emiss_Carbon_Gases( Input_Opt, State_Chm, State_Diag, &
! Total CO2 [kg/kg dry air]
Spc(id_CO2)%Conc(I,J,L) = Spc(id_CO2)%Conc(I,J,L) + E_CO2

#ifdef ACTIVATE_TAGGED_SPECIES
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!@@@ TAGGED SPECIES HANDLING
!@@@ Add chemical source of CO into the COchem species
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IF ( Input_Opt%LSPLIT .and. id_CO2ch > 0 ) THEN
Spc(id_CO2ch)%Conc(I,J,L) = Spc(id_CO2ch)%Conc(I,J,L) + E_CO2
ENDIF
#endif

ENDDO
ENDDO
ENDDO
Expand Down Expand Up @@ -376,7 +360,6 @@ SUBROUTINE Chem_Carbon_Gases( Input_Opt, State_Met, State_Chm, &
USE carbon_Funcs
USE gckpp_Global
USE gckpp_Integrator, ONLY : Integrate
!USE gckpp_Monitor, ONLY : Spc_Names
USE gckpp_Parameters
USE gckpp_Precision
USE gckpp_Rates, ONLY : Update_Rconst
Expand All @@ -387,7 +370,7 @@ SUBROUTINE Chem_Carbon_Gases( Input_Opt, State_Met, State_Chm, &
USE rateLawUtilFuncs, ONLY : SafeDiv
USE Species_Mod, ONLY : SpcConc
USE State_Grid_Mod, ONLY : GrdState
USE State_Chm_Mod, ONLY : ChmState, Ind_
USE State_Chm_Mod, ONLY : ChmState
USE State_Diag_Mod, ONLY : DgnState
USE State_Met_Mod, ONLY : MetState
USE Time_Mod, ONLY : Get_Ts_Chem
Expand Down Expand Up @@ -467,13 +450,6 @@ SUBROUTINE Chem_Carbon_Gases( Input_Opt, State_Met, State_Chm, &
REAL(fp) :: PCO_in_Strat(State_Grid%NX, State_Grid%NY, State_Grid%NZ)
REAL(fp) :: PCO_fr_CH4 (State_Grid%NX, State_Grid%NY, State_Grid%NZ)
REAL(fp) :: PCO_fr_NMVOC(State_Grid%NX, State_Grid%NY, State_Grid%NZ)
#ifdef ACTIVATE_TAGGED_SPECIES
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!@@@ TAGGED SPECIES HANDLING
!@@@ PrevCH4 stores CH4 before chemistry, for later distribution
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
REAL(fp) :: PREVCH4( State_Grid%NX, State_Grid%NY, State_Grid%NZ)
#endif

!========================================================================
! Chem_Carbon_Gases begins here!
Expand Down Expand Up @@ -585,17 +561,6 @@ SUBROUTINE Chem_Carbon_Gases( Input_Opt, State_Met, State_Chm, &
!$OMP END PARALLEL DO
ENDIF

#ifdef ACTIVATE_TAGGED_SPECIES
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!%%% TAGGED SPECIES HANDLING
!%%% If there are multiple CH4 species, store the total CH4 conc
!%%% so that we can distribute the sink after the chemistry.
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IF ( Input_Opt%LSPLIT .and. id_CH4 > 0 ) THEN
PrevCH4 = Spc(id_CH4)%Conc
ENDIF
#endif

!========================================================================
! Main chemistry loop -- call KPP to integrate the mechanism forward
!========================================================================
Expand Down Expand Up @@ -743,66 +708,13 @@ SUBROUTINE Chem_Carbon_Gases( Input_Opt, State_Met, State_Chm, &
L = L, &
id_CH4 = id_CH4, &
id_CO = id_CO, &
id_COch4 = id_COch4, &
id_COnmvoc = id_COnmvoc, &
id_CO2 = id_CO2, &
xnumol_CO = xnumol_CO, &
xnumol_CH4 = xnumol_CH4, &
xnumol_CO2 = xnumol_CO2, &
State_Chm = State_Chm, &
State_Met = State_Met )

#ifdef ACTIVATE_TAGGED_SPECIES
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!@@@ TAGGED SPECIES HANDLING
!@@@ Handle trop loss by OH for regional CO species
!@@@ This is turned off by default -- needs further work
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IF ( Input_Opt%LSPLIT .and. id_CO > 0 ) THEN

!%%% NOTE: Un-hardwire the species IDs!
! Loop over regional CO species
DO NA = 16, State_Chm%nAdvect-11

! Advected species ID
N = State_Chm%Map_Advect(NA)

!-----------------------------------------------------
! NOTE: The proper order should be:
! (1) Calculate CO loss rate
! (2) Update AD65 array
! (3) Update the SPC array using the loss rate
!
! Therefore, we have now moved the computation of the
! ND65 diagnostic before we apply the loss to the
! tagged CO concentrations stored in the SPC array.
!
! -- Jenny Fisher (27 Mar 2017)
!-----------------------------------------------------

! Update regional species
!<<Not SUBROUTINE re if this is correct - MSL>>
IF (NA .ne. 16) &
Spc(N)%Conc(I,J,L) = Spc(N)%Conc(I,J,L) * &
( 1e+0_fp - K_TROP(2) * C(FixedOH) * DTCHEM )

!-----------------------------------------------------
! HISTORY (aka netCDF diagnostics)
!
! Loss of CO by OH for "tagged" species
!-----------------------------------------------------

! Units: [kg/s]
IF ( State_Diag%Archive_Loss ) THEN
State_Diag%Loss(I,J,L,N) = Spc(N)%Conc(I,J,L) * k_Trop(2) &
* C(FixedOH) * DTCHEM
! C(ind_CO2_OH) / DTCHEM &
! * State_Met%AIRVOL(I,J,L) * 1e+6_fp / XNUMOL_CO
ENDIF
ENDDO
ENDIF
#endif

!=====================================================================
! HISTORY (aka netCDF diagnostics)
!
Expand Down Expand Up @@ -833,16 +745,6 @@ SUBROUTINE Chem_Carbon_Gases( Input_Opt, State_Met, State_Chm, &
carbon_Get_COfromNMVOC_Flux( dtChem )
ENDIF

#ifdef ACTIVATE_TAGGED_SPECIES
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!@@@ TAGGED SPECIES HANDLING
!@@@ Loss of CO by OH -- tagged species; Units: [kg/s]
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IF ( State_Diag%Archive_Loss ) THEN
State_Diag%Loss(I,J,L,16) = ( COfrom_OH / STTCO / DTCHEM )
ENDIF
#endif

ENDDO
ENDDO
ENDDO
Expand All @@ -854,20 +756,6 @@ SUBROUTINE Chem_Carbon_Gases( Input_Opt, State_Met, State_Chm, &
RETURN
ENDIF

#ifdef ACTIVATE_TAGGED_SPECIES
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!@@@ TAGGED SPECIES HANDLING
!@@@ Allocate the CH4 chemistry sink to different tagged CH4 species
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IF ( Input_Opt%LSPLIT .and. id_CH4 > 0 ) THEN
CALL CH4_Distrib_Carbon( &
PrevCh4 = PrevCh4, &
Input_Opt = Input_Opt, &
State_Chm = State_Chm, &
State_Grid = State_Grid )
ENDIF
#endif

! Free pointers for safety's sake
Spc => NULL()

Expand Down Expand Up @@ -1080,100 +968,6 @@ SUBROUTINE ReadChemInputFields( Input_Opt, State_Grid, State_Met, &

END SUBROUTINE ReadChemInputFields
!EOC
#ifdef ACTIVATE_TAGGED_SPECIES
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: ch4_distrib
!
! !DESCRIPTION: Allocates the chemistry sink to different emission species.
! (Only called if there are tagged CH4 species.)
!\\
!\\
! !INTERFACE:
!
SUBROUTINE CH4_Distrib( PrevCh4, Input_Opt, State_Chm, State_Grid )
!
! !USES:
!
USE ERROR_MOD, ONLY : SAFE_DIV
USE Input_Opt_Mod, ONLY : OptInput
USE Species_Mod, ONLY : SpcConc
USE State_Chm_Mod, ONLY : ChmState
USE State_Grid_Mod, ONLY : GrdState

IMPLICIT NONE
!
! !INPUT PARAMETERS:
!
TYPE(OptInput), INTENT(IN) :: Input_Opt ! Input Options object
TYPE(GrdState), INTENT(IN) :: State_Grid ! Grid State object
REAL(fp) :: PREVCH4( &
State_Grid%NX, &
State_Grid%NY, &
State_Grid%NZ) ! CH4 befire chemistry
!
! !INPUT/OUTPUT PARAMETERS:
!
TYPE(ChmState), INTENT(INOUT) :: State_Chm ! Chemistry State object
!
!
! !REMARKS:
! This routine is only used with tagged CH4 species.
!
! !REVISION HISTORY:
! See the Git version history
!EOP
!------------------------------------------------------------------------------
!BOC
!
! !LOCAL VARIABLES:
!
! Scalars
INTEGER :: I, J, L, N, NA

! Pointers
TYPE(SpcConc), POINTER :: Spc(:)

!========================================================================
! CH4_DISTRIB begins here
!========================================================================

! Point to chemical species array [kg]
Spc => State_Chm%Species

!%%% NOTE: Need to unhardwire the species ID's
! Loop over the number of advected species
DO NA = 2, State_Chm%nAdvect-24

! Advected species ID
N = State_Chm%Map_Advect(NA)

!$OMP PARALLEL DO &
!$OMP DEFAULT( SHARED )&
!$OMP PRIVATE( I, J, L )&
!$OMP COLLAPSE( 3 )
DO L = 1, State_Grid%NZ
DO J = 1, State_Grid%NY
DO I = 1, State_Grid%NX
Spc(N)%Conc(I,J,L) = &
SAFE_DIV( Spc(N)%Conc(I,J,L), PREVCH4(I,J,L), 0.0_fp) &
* Spc(id_CH4)%Conc(I,J,L)
ENDDO
ENDDO
ENDDO
!$OMP END PARALLEL DO

ENDDO

! Free pointer
Spc => NULL()

END SUBROUTINE CH4_DISTRIB
!EOC
#endif
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
!------------------------------------------------------------------------------
Expand Down Expand Up @@ -1241,21 +1035,18 @@ SUBROUTINE Init_Carbon_Gases( Input_Opt, State_Chm, State_Diag, &

!========================================================================
! Define GEOS-Chem species indices
! NOTE: Some of these are for tagged species, which are deactivated
! by default. Interested users can add tagged species if they wish.
!
! Also denote which species are advected to facilitate single-tracer runs
!========================================================================
id_CH4 = Ind_( 'CH4' )
id_CO = Ind_( 'CO' )
id_COacet = Ind_( 'COacet' )
id_COch3oh = Ind_( 'COch3oh' )
id_COch4 = Ind_( 'COch4' )
id_COisop = Ind_( 'COisop' )
id_COmono = Ind_( 'COmono' )
id_COnmvoc = Ind_( 'COnmvoc' )
id_CO2 = Ind_( 'CO2' )
id_CO2ch = Ind_( 'CO2ch' )
id_OCS = Ind_( 'OCS' )
id_OH = Ind_( 'FixedOH' )
id_CH4 = Ind_( 'CH4' )
id_CH4_adv = Ind_( 'CH4', 'A' )
lizziel marked this conversation as resolved.
Show resolved Hide resolved
id_CO = Ind_( 'CO' )
id_CO_adv = Ind_( 'CO', 'A' )
id_CO2 = Ind_( 'CO2' )
id_CO2_adv = Ind_( 'CO2', 'A' )
id_OCS = Ind_( 'OCS' )
id_OCS_adv = Ind_( 'OCS', 'A' )
id_OH = Ind_( 'FixedOH' )
lizziel marked this conversation as resolved.
Show resolved Hide resolved

!========================================================================
! Save physical parameters from the species_database.yml file into KPP
Expand Down
4 changes: 2 additions & 2 deletions GeosCore/emissions_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ END SUBROUTINE Emissions_Init
!\\
! !INTERFACE:
!
SUBROUTINE Emissions_Run( Input_Opt, State_Chm, State_Diag, &
State_Grid, State_Met, EmisTime, Phase, RC )
SUBROUTINE Emissions_Run( Input_Opt, State_Chm, State_Diag, State_Grid, &
State_Met, EmisTime, Phase, RC )
!
! !USES:
!
Expand Down
Loading