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

Add updates for CH4 analytical inversion #2218

Merged
merged 6 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Copy utility scripts that allow you to resubmit failed to integration and parallel test root directories
- Update GCHP operational example environment files for Harvard Cannon
- Do not run GCClassic integration test compile jobs in the background
- Removed emissions handling from `global_ch4_mod.F90` and `carbon_gases_mod.F90` and instead apply scale factors to emissions directly in `HEMCO_Config.rc`
- Loop over advected species CH4 chemistry routines to allow for multiple CH4 tracers within analytical inversion framework

### Fixed
- Fixed unit conversions in GEOS-only code
Expand All @@ -43,6 +45,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

### Removed
- Removed MPI broadcasts in CESM-only photolysis code; will read on all cores
- Removed State_Chm%CH4_EMIS

## [14.3.0] - 2024-02-07
### Added
Expand Down
135 changes: 0 additions & 135 deletions GeosCore/carbon_gases_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ MODULE Carbon_Gases_Mod
PUBLIC :: Init_Carbon_Gases
PUBLIC :: Cleanup_Carbon_Gases
!
! !PUBLIC DATA MEMBERS:
!
REAL(fp), ALLOCATABLE, PUBLIC :: CH4_EMIS_J(:,:,:) ! [kg/m2/s]
!
! !REVISION HISTORY:
! 04 Apr 2022 - M.S. Long - Initial version, based on work by B. Bukosa
! See https://github.com/geoschem/geos-chem for complete history
Expand Down Expand Up @@ -116,13 +112,6 @@ SUBROUTINE Emiss_Carbon_Gases( Input_Opt, State_Chm, State_Diag, &
! !OUTPUT PARAMETERS:
!
INTEGER, INTENT(OUT) :: RC ! Success or failure?
!
! !REMARKS:
! WARNING: Soil absorption has to be the 15th field in CH4_EMIS
! Also: the ND58 diagnostics have now been removed. We still need to
! read the HEMCO manual diagnostics into CH4_EMIS for the analytical
! inversion. Therefore, we will keep EmissCh4 for the time-being
! but only remove the bpch diagnostic.
!EOP
!------------------------------------------------------------------------------
!BOC
Expand Down Expand Up @@ -180,102 +169,6 @@ SUBROUTINE Emiss_Carbon_Gases( Input_Opt, State_Chm, State_Diag, &
! Emission timestep
dtSrce = HcoState%TS_EMIS

!========================================================================
! CH4 emissions
!
! --> All emission calculations are now done through HEMCO
! HEMCO stores emissions of all species internally in the HEMCO
! state object. Here, we pass these emissions into module array
! CH4_EMIS in units kg/m2/s. These values are then either added to
! the species array (full mixing scheme) or used later on in
! vdiff_mod.F90 if the non-local PBL mixing scheme is used.
!
! The CH4_EMIS array is mostly used for backwards compatibility
! (especially the diagnostics). It is also used to ensure that
! in a multi-species simulation, species 1 (total CH4) is properly
! defined.
! (ckeller, 9/12/2013)
!========================================================================
IF ( id_CH4 > 0 ) THEN

! Initialize
CH4_EMIS_J = 0.0_fp
CH4scale = 1.0_hp
CH4diag(1) = 'CH4'
CH4diag(2) = 'CH4_OIL'
CH4diag(3) = 'CH4_GAS'
CH4diag(4) = 'CH4_COAL'
CH4diag(5) = 'CH4_LIVESTOCK'
CH4diag(6) = 'CH4_LANDFILLS'
CH4diag(7) = 'CH4_WASTEWATER'
CH4diag(8) = 'CH4_RICE'
CH4diag(9) = 'CH4_ANTHROTHER'
CH4diag(10) = 'CH4_BIOMASS'
CH4diag(11) = 'CH4_WETLAND'
CH4diag(12) = 'CH4_SEEPS'
CH4diag(13) = 'CH4_LAKES'
CH4diag(14) = 'CH4_TERMITES'
CH4diag(15) = 'CH4_SOILABSORB' ! CH4 soilabsorb values are negative!
CH4diag(16) = 'CH4_RESERVOIRS'
CH4scale(15) = -1.0_hp ! Need to convert to positive

! Loop over manual CH4 diagnostics
DO N = 2, N_CH4_DIAGS

! Get a pointer to the emissions
CALL HCO_GC_GetDiagn( Input_Opt, State_Grid, CH4diag(N), &
.FALSE., RC, Ptr2D=Ptr2D )

! Trap potential errors
IF ( RC /= HCO_SUCCESS ) THEN
errMsg = 'Cannot get pointer to HEMCO field ' // TRIM(CH4diag(N))
CALL GC_Error( errMsg, RC, thisLoc )
RETURN
ENDIF
IF ( .not. ASSOCIATED( Ptr2D ) ) THEN
errMsg = 'Cannot get pointer to HEMCO field ' // TRIM(CH4diag(N))
CALL GC_Error( errMsg, RC, thisLoc )
RETURN
ENDIF

! Store emissions in CH4_EMIS_J [kg/m2/s]
! CH4scale is either -1 (for soil absorption) or 1 (everything else)
CH4_EMIS_J(:,:,N) = Ptr2D * CH4scale(N)

! Free pointer for next iteration
Ptr2D => NULL()
ENDDO

!---------------------------------------------------------------------
! Total emission: sum of all emissions - (2*soil absorption)
! We have to substract soil absorption twice because it is added
! to other emissions in the SUM function. (ccc, 7/23/09)
!---------------------------------------------------------------------
CH4_EMIS_J(:,:,1) = SUM( CH4_EMIS_J, 3 ) &
- ( 2.0_fp * CH4_EMIS_J(:,:,15) )

IF ( Input_Opt%Verbose ) THEN
WRITE(*,*) 'CH4_EMIS (kg/m2/s):'
WRITE(*,*) 'Total : ', SUM( CH4_EMIS_J(:,:,1 ) )
WRITE(*,*) 'Oil : ', SUM( CH4_EMIS_J(:,:,2 ) )
WRITE(*,*) 'Gas : ', SUM( CH4_EMIS_J(:,:,3 ) )
WRITE(*,*) 'Coal : ', SUM( CH4_EMIS_J(:,:,4 ) )
WRITE(*,*) 'Livestock : ', SUM( CH4_EMIS_J(:,:,5 ) )
WRITE(*,*) 'Landfills : ', SUM( CH4_EMIS_J(:,:,6 ) )
WRITE(*,*) 'Wastewater : ', SUM( CH4_EMIS_J(:,:,7 ) )
WRITE(*,*) 'Rice : ', SUM( CH4_EMIS_J(:,:,8 ) )
WRITE(*,*) 'Other anth : ', SUM( CH4_EMIS_J(:,:,9 ) )
WRITE(*,*) 'Biomass burn : ', SUM( CH4_EMIS_J(:,:,10) )
WRITE(*,*) 'Wetlands : ', SUM( CH4_EMIS_J(:,:,11) )
WRITE(*,*) 'Seeps : ', SUM( CH4_EMIS_J(:,:,12) )
WRITE(*,*) 'Lakes : ', SUM( CH4_EMIS_J(:,:,13) )
WRITE(*,*) 'Termites : ', SUM( CH4_EMIS_J(:,:,14) )
WRITE(*,*) 'Soil absorb : ', SUM( CH4_EMIS_J(:,:,15) )
WRITE(*,*) 'Reservoirs : ', SUM( CH4_EMIS_J(:,:,16) )
ENDIF

ENDIF

!========================================================================
! CO2 production from CO oxidation
!========================================================================
Expand Down Expand Up @@ -1287,27 +1180,6 @@ SUBROUTINE Init_Carbon_Gases( Input_Opt, State_Chm, State_Diag, &
IF ( RC /= GC_SUCCESS ) RETURN
sumOfCosSza = 0.0_fp

!========================================================================
! Initialize variables for CH4 chemistry
!========================================================================
IF ( id_CH4 > 0 ) THEN
ALLOCATE( CH4_EMIS_J( State_Grid%NX, State_Grid%NY, N_CH4_DIAGS ), &
STAT=RC )
CALL GC_CheckVar( 'carbon_gases_mod.F90:CH4_EMIS', 0, RC )
IF ( RC /= GC_SUCCESS ) RETURN
CH4_EMIS_J = 0.0_fp
ENDIF

!========================================================================
! Initialize variables for CO2 chemistry
!========================================================================
! none yet

!========================================================================
! Initialize variables for OCS chemistry
!========================================================================
! none yet

END SUBROUTINE Init_Carbon_Gases
!EOC
!------------------------------------------------------------------------------
Expand Down Expand Up @@ -1343,13 +1215,6 @@ SUBROUTINE Cleanup_Carbon_Gases( RC )
! Initialize
RC = GC_SUCCESS

! Deallocate
IF ( ALLOCATED( CH4_EMIS_J ) ) THEN
DEALLOCATE( CH4_EMIS_J, STAT=RC )
CALL GC_CheckVar( 'carbon_gases_mod.F90:CH4_EMIS', 2, RC )
RETURN
ENDIF

IF ( ALLOCATED( sumOfCosSza ) ) THEN
DEALLOCATE( sumOfCosSza, STAT=RC )
CALL GC_CheckVar( 'carbon_gases_mod.F90:sumOfCosSza', 2, RC )
Expand Down
26 changes: 1 addition & 25 deletions GeosCore/emissions_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ SUBROUTINE Emissions_Run( Input_Opt, State_Chm, State_Diag, &
USE Carbon_Gases_Mod, ONLY : Emiss_Carbon_Gases
USE CO2_MOD, ONLY : EmissCO2
USE ErrCode_Mod
USE GLOBAL_CH4_MOD, ONLY : EmissCH4
USE HCO_Interface_GC_Mod, ONLY : HCOI_GC_Run
USE Input_Opt_Mod, ONLY : OptInput
USE Mercury_Mod, ONLY : EmissMercury
Expand Down Expand Up @@ -248,28 +247,6 @@ SUBROUTINE Emissions_Run( Input_Opt, State_Chm, State_Diag, &
ENDIF
ENDIF

! For CH4 simulation
!
! This will get the individual CH4 emission terms (gas, coal, wetlands,
! ...) and write them into the individual emissions arrays defined in
! global_ch4_mod (CH4_EMIS). Emissions are all done in mixing_mod, the
! call to EMISSCH4 is for backwards consistency. This is especially
! needed to do the analytical inversions.
!
! To enable CH4 emissions in a full-chemistry simulation, add entries
! in HEMCO_Config.rc as is done for other species.
! (mps, 2/12/21)
IF ( Input_Opt%ITS_A_CH4_SIM .or. Input_Opt%ITS_A_TAGCH4_SIM ) THEN
CALL EmissCh4( Input_Opt, State_Chm, State_Grid, State_Met, RC )

! Trap potential errors
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error encountered in "EmissCH4"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ENDIF

! For transport tracer simulation
IF ( Input_Opt%ITS_A_TRACER_SIM ) THEN
CALL Tracer_Source_Phase( Input_Opt, State_Chm, State_Grid, &
Expand All @@ -285,8 +262,7 @@ SUBROUTINE Emissions_Run( Input_Opt, State_Chm, State_Diag, &

! Carbon simulation (e.g. CO2-CO-CH4-OCS via KPP)
!
! This will get the individual CH4 emission terms in the same way
! as done for the CH4 simulation above.
! Computes CO2 production from CO oxidation
IF ( Input_Opt%ITS_A_CARBON_SIM ) THEN
CALL Emiss_Carbon_Gases( Input_Opt, State_Chm, State_Diag, &
State_Grid, State_Met, RC )
Expand Down
Loading