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

Fix GEOS-Chem 14.5.0 build in CESM by excluding hard dependencies on HEMCO #2542

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f45c9be
Bug fix: allow uppercase log filename in download_data.py
ihough Oct 10, 2024
08e1512
fixup! Bug fix: allow uppercase log filename in download_data.py
ihough Oct 14, 2024
e2188d2
Add allocate guards for arrays in pressure_mod
jwallwork23 Oct 22, 2024
9870afb
Add CHANGELOG note
jwallwork23 Oct 22, 2024
a02905c
Avoid zeroing twice in INIT_PRESSURE
jwallwork23 Oct 29, 2024
00c6a20
Fix GEOS-Chem 14.5.0 build in CESM by excluding hard dependencies on …
jimmielin Oct 31, 2024
5907f86
Updates to prevent inadvertent resetting of SatDiagn counters
yantosca Oct 31, 2024
b9b11b1
Update CHANGELOG
jimmielin Nov 1, 2024
482d047
Update CHANGELOG
jimmielin Nov 1, 2024
d096b7d
Updated changelog for PR #2544
yantosca Nov 4, 2024
50fa39f
Fix metals simulation name in config file comments
ihough Nov 7, 2024
d42dc14
Fix seg fault in qfyaml when running with certain compilers
lizziel Sep 27, 2024
d2790ab
Updated changelog
lizziel Nov 14, 2024
6dec571
Merge branch 'dev/no-diff-to-benchmark' into hplin/fix_cesm_build_14.5
lizziel Nov 19, 2024
f149b46
Merge PR #2560 (Fix trace metals sim name in config files)
yantosca Nov 19, 2024
af83cf8
Merge PR # (Allow upcase logfile name in download_data.py)
yantosca Nov 19, 2024
67ce84a
Merge PR #2532 (Add allocate guards in pressure_mod )
yantosca Nov 20, 2024
cad65f0
Merge PR #2544 (Fixes for SatDiagn diagnostic counters)
yantosca Nov 20, 2024
61d1042
Remove duplicate WD_RetFactor metadata for species HgClHO2
yantosca Nov 20, 2024
135bdaa
Merge PR #2580 (Remove duplicate WD_RetFactor for HgClHO2)
yantosca Nov 21, 2024
7507eb5
Merge PR #2486 (Prevent seg fault in qfyaml)
yantosca Nov 21, 2024
e2157dc
Merge PR #2542 (CESM fix: exclude hard dependencies on HEMCO)
yantosca Nov 21, 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
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,30 @@ This file documents all notable changes to the GEOS-Chem repository starting in
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased] - TBD
### Added
- Added allocate guards for arrays in `pressure_mod`
- Added `State_Diag%SatDiagnEdgeCount` counter for the `SatDiagnEdge` collection
- Added `State_Diag%Archive_SatDiagnEdgeCount` field
- Added `State_Diag%Archive_SatDiagnEdge` field
- Added routine `SatDiagn_or_SatDiagnEdge` in `History/history_utils_mod.F90`

### Changed
- Renamed `Emiss_Carbon_Gases` to `CO2_Production` in `carbon_gases_mod.F90`
- Updated start date and restart file for CO2 and tagCO simulations for consistency with carbon simulations
- Allocated `State_Diag%SatDiagnPEDGE` ffield with vertical dimension `State_Grid%NZ+1`

### Fixed
- Added a fix to skip the call to KPP when only CO2 is defined in the carbon simulation
- Added fix to turn on ship emissions for CO2 in the carbon simulation
- Updated `HEMCO_Config.rc` for carbon simulation to read data based on carbon species used
- Fixed entries for CO2 emissions in `ExtData.rc.carbon`
- Fixed metals simulation name in config file template comments
- Fixed bug in `download_data.py` which caused script to fail if log filename contained uppercase characters.
- Fixed the satellite diagnostics counters from being inadvertently being reset
- Fixed segmentation fault in qfyaml when running with certain compilers without debug flags on

### Removed
- Removed duplicate `WD_RetFactor` tag for HgClHO2 in `species_database.yml`

## [14.5.0] - 2024-11-07
### Added
Expand Down Expand Up @@ -42,6 +57,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Moved calls to `RD_AOD` and `CALC_AOD` from `Init_Aerosol` rather than `Init_Photolysis`
- Updated ResME CH4 reservoir emissions to apply seasonality via mask file
- Changed fullchem restart file folder from `GC_14.3.0` to `GC_14.5.0`
- Excluded HEMCO interface and ExtState fields from `MODEL_CESM` in `hco_interface_gc_mod.F90` for compatibility with CESM, which runs HEMCO separately

### Fixed
- Simplified SOA representations and fixed related AOD and TotalOA/OC calculations in benchmark
Expand Down
10 changes: 7 additions & 3 deletions GeosCore/diagnostics_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1466,13 +1466,18 @@ SUBROUTINE Do_Archive_SatDiagn( Input_Opt, State_Chm, State_Diag, &
locTime <= State_Diag%SatDiagn_EndHr ) good = 1.0_fp

!---------------------------------------------------------------------
! SatDiagnCount: Count number of local times
! SatDiagnCount and SatDiagnEdgeCount: Count number of local times
!---------------------------------------------------------------------
IF ( State_Diag%Archive_SatDiagnCount ) THEN
State_Diag%SatDiagnCount(I,:,:) = &
State_Diag%SatDiagnCount(I,:,:) + good
ENDIF

IF ( State_Diag%Archive_SatDiagnEdgeCount ) THEN
State_Diag%SatDiagnEdgeCount(I,:,:) = &
State_Diag%SatDiagnEdgeCount(I,:,:) + good
ENDIF

!---------------------------------------------------------------------
! SatDiagnOH: OH concentration [molec/cm3]:
!---------------------------------------------------------------------
Expand Down Expand Up @@ -1510,8 +1515,7 @@ SUBROUTINE Do_Archive_SatDiagn( Input_Opt, State_Chm, State_Diag, &
! Pressure edges [hPa]:
!---------------------------------------------------------------------
IF ( State_Diag%Archive_SatDiagnPEdge ) THEN
State_Diag%SatDiagnPEdge(I,:,:) = &
State_Met%PEDGE(I,:,1:State_Grid%NZ) * good
State_Diag%SatDiagnPEdge(I,:,:) = State_Met%PEDGE(I,:,:) * good
ENDIF

!---------------------------------------------------------------------
Expand Down
225 changes: 116 additions & 109 deletions GeosCore/hco_interface_gc_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,23 @@ MODULE HCO_Interface_GC_Mod
!
! !PUBLIC MEMBER FUNCTIONS:
!
#if !defined( MODEL_CESM )
PUBLIC :: HCOI_GC_Init
PUBLIC :: HCOI_GC_Run
PUBLIC :: HCOI_GC_Final
#endif

PUBLIC :: HCOI_GC_WriteDiagn

PUBLIC :: Compute_Sflx_For_Vdiff
!
! !PRIVATE MEMBER FUNCTIONS:
!
#if !defined( MODEL_CESM )
PRIVATE :: ExtState_InitTargets
PRIVATE :: ExtState_SetFields
PRIVATE :: ExtState_UpdateFields
#endif
PRIVATE :: Get_SzaFact
PRIVATE :: GridEdge_Set
PRIVATE :: CheckSettings
Expand Down Expand Up @@ -162,6 +167,7 @@ MODULE HCO_Interface_GC_Mod
LOGICAL, PARAMETER :: DoDiagn = .TRUE.

CONTAINS
#if !defined( MODEL_CESM )
!EOC
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
Expand Down Expand Up @@ -1299,115 +1305,6 @@ END SUBROUTINE HCOI_GC_Final
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: HCOI_GC_WriteDiagn
!
! !DESCRIPTION: Subroutine HCOI\_GC\_WriteDiagn is the wrapper routine to
! write the HEMCO diagnostics. This will only write the diagnostics of
! diagnostics collection 1.
!\\
!\\
! !INTERFACE:
!
SUBROUTINE HCOI_GC_WriteDiagn( Input_Opt, Restart, RC )
!
! !USES:
!
USE ErrCode_Mod
USE HCOIO_Diagn_Mod, ONLY : HcoDiagn_Write
USE Input_Opt_Mod, ONLY : OptInput

USE Time_Mod, ONLY : Get_Year, Get_Month, Get_Day, GET_DAY_OF_YEAR
USE Time_Mod, ONLY : GET_HOUR, GET_MINUTE, GET_SECOND
#if defined( ADJOINT )
USE MAPL_CommsMod, ONLY : MAPL_AM_I_ROOT
#endif
!
! !INPUT/OUTPUT PARAMETERS:
!
TYPE(OptInput), INTENT(IN ) :: Input_Opt ! Input options
LOGICAL, INTENT(IN ) :: Restart ! write restart (enforced)?
!
! !INPUT/OUTPUT PARAMETERS:
!
INTEGER, INTENT(INOUT) :: RC ! Success or failure?
!
! !REVISION HISTORY:
! 01 Apr 2015 - C. Keller - Initial version
! See https://github.com/geoschem/geos-chem for complete history
!EOP
!------------------------------------------------------------------------------
!BOC
!
! !LOCAL VARIABLES:
!
! Scalars
INTEGER :: HMRC
INTEGER :: year, month, day, dayOfYr, hour, minute, second

! Strings
CHARACTER(LEN=255) :: ThisLoc, Instr
CHARACTER(LEN=512) :: ErrMsg

!=======================================================================
! HCOI_GC_WriteDiagn begins here!
!=======================================================================

! Initialize
RC = GC_SUCCESS
HMRC = HCO_SUCCESS
ErrMsg = ''
ThisLoc = &
' -> at HCOI_GC_WriteDiagn (in module GeosCore/hco_interface_gc_mod.F90)'
Instr = 'THIS ERROR ORIGINATED IN HEMCO! Please check the ' // &
'HEMCO log file for additional error messages!'

!-----------------------------------------------------------------------
! Make sure HEMCO time is in sync
!-----------------------------------------------------------------------

! Now done through a universal function in HCO_Interface_Common
! (hplin, 3/12/20)
year = GET_YEAR()
month = GET_MONTH()
day = GET_DAY()
dayOfYr = GET_DAY_OF_YEAR()
hour = GET_HOUR()
minute = GET_MINUTE()
second = GET_SECOND()

CALL SetHcoTime( HcoState, ExtState, year, month, day, dayOfYr, &
hour, minute, second, .FALSE., HMRC )

! Trap potential errors
IF ( HMRC /= HCO_SUCCESS ) THEN
RC = HMRC
ErrMsg = 'Error encountered in "SetHcoTime"!'
CALL GC_Error( ErrMsg, RC, ThisLoc, Instr )
CALL Flush( HcoState%Config%Err%Lun )
RETURN
ENDIF

!-----------------------------------------------------------------------
! Write diagnostics
!-----------------------------------------------------------------------
CALL HcoDiagn_Write( HcoState, RESTART, HMRC )

! Trap potential errors
IF ( HMRC /= HCO_SUCCESS ) THEN
RC = HMRC
ErrMsg = 'Error encountered in "HcoDiagn_Write"!'
CALL GC_Error( ErrMsg, RC, ThisLoc, Instr )
CALL Flush( HcoState%Config%Err%Lun )
RETURN
ENDIF

END SUBROUTINE HCOI_GC_WriteDiagn
!EOC
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: ExtState_InitTargets
!
! !DESCRIPTION: SUBROUTINE ExtState\_InitTargets allocates some local arrays
Expand Down Expand Up @@ -3245,6 +3142,116 @@ SUBROUTINE ExtState_UpdateFields( Input_Opt, State_Chm, &
#endif

END SUBROUTINE ExtState_UpdateFields
#endif ! MODEL_CESM exclude
!EOC
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: HCOI_GC_WriteDiagn
!
! !DESCRIPTION: Subroutine HCOI\_GC\_WriteDiagn is the wrapper routine to
! write the HEMCO diagnostics. This will only write the diagnostics of
! diagnostics collection 1.
!\\
!\\
! !INTERFACE:
!
SUBROUTINE HCOI_GC_WriteDiagn( Input_Opt, Restart, RC )
!
! !USES:
!
USE ErrCode_Mod
USE HCOIO_Diagn_Mod, ONLY : HcoDiagn_Write
USE Input_Opt_Mod, ONLY : OptInput

USE Time_Mod, ONLY : Get_Year, Get_Month, Get_Day, GET_DAY_OF_YEAR
USE Time_Mod, ONLY : GET_HOUR, GET_MINUTE, GET_SECOND
#if defined( ADJOINT )
USE MAPL_CommsMod, ONLY : MAPL_AM_I_ROOT
#endif
!
! !INPUT/OUTPUT PARAMETERS:
!
TYPE(OptInput), INTENT(IN ) :: Input_Opt ! Input options
LOGICAL, INTENT(IN ) :: Restart ! write restart (enforced)?
!
! !INPUT/OUTPUT PARAMETERS:
!
INTEGER, INTENT(INOUT) :: RC ! Success or failure?
!
! !REVISION HISTORY:
! 01 Apr 2015 - C. Keller - Initial version
! See https://github.com/geoschem/geos-chem for complete history
!EOP
!------------------------------------------------------------------------------
!BOC
!
! !LOCAL VARIABLES:
!
! Scalars
INTEGER :: HMRC
INTEGER :: year, month, day, dayOfYr, hour, minute, second

! Strings
CHARACTER(LEN=255) :: ThisLoc, Instr
CHARACTER(LEN=512) :: ErrMsg

!=======================================================================
! HCOI_GC_WriteDiagn begins here!
!=======================================================================

! Initialize
RC = GC_SUCCESS
HMRC = HCO_SUCCESS
ErrMsg = ''
ThisLoc = &
' -> at HCOI_GC_WriteDiagn (in module GeosCore/hco_interface_gc_mod.F90)'
Instr = 'THIS ERROR ORIGINATED IN HEMCO! Please check the ' // &
'HEMCO log file for additional error messages!'

!-----------------------------------------------------------------------
! Make sure HEMCO time is in sync
!-----------------------------------------------------------------------

! Now done through a universal function in HCO_Interface_Common
! (hplin, 3/12/20)
year = GET_YEAR()
month = GET_MONTH()
day = GET_DAY()
dayOfYr = GET_DAY_OF_YEAR()
hour = GET_HOUR()
minute = GET_MINUTE()
second = GET_SECOND()

CALL SetHcoTime( HcoState, ExtState, year, month, day, dayOfYr, &
hour, minute, second, .FALSE., HMRC )

! Trap potential errors
IF ( HMRC /= HCO_SUCCESS ) THEN
RC = HMRC
ErrMsg = 'Error encountered in "SetHcoTime"!'
CALL GC_Error( ErrMsg, RC, ThisLoc, Instr )
CALL Flush( HcoState%Config%Err%Lun )
RETURN
ENDIF

!-----------------------------------------------------------------------
! Write diagnostics
!-----------------------------------------------------------------------
CALL HcoDiagn_Write( HcoState, RESTART, HMRC )

! Trap potential errors
IF ( HMRC /= HCO_SUCCESS ) THEN
RC = HMRC
ErrMsg = 'Error encountered in "HcoDiagn_Write"!'
CALL GC_Error( ErrMsg, RC, ThisLoc, Instr )
CALL Flush( HcoState%Config%Err%Lun )
RETURN
ENDIF

END SUBROUTINE HCOI_GC_WriteDiagn
!EOC
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
Expand Down
Loading