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

Prevent History diagnostic collection duration from being shorter than frequency #2593

Merged
merged 1 commit into from
Nov 26, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Added `State_Diag%Archive_SatDiagnEdgeCount` field
- Added `State_Diag%Archive_SatDiagnEdge` field
- Added routine `SatDiagn_or_SatDiagnEdge` in `History/history_utils_mod.F90`
- Added error trap in `History/history_mod.F90` to ensure that collection duration is always shorter than frequency

### Changed
- Renamed `Emiss_Carbon_Gases` to `CO2_Production` in `carbon_gases_mod.F90`
Expand Down
37 changes: 32 additions & 5 deletions History/history_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1223,10 +1223,37 @@ SUBROUTINE History_ReadCollectionData( Input_Opt, State_Chm, State_Diag, &
ENDIF

!=================================================================
! At this point we are sure that the collection has been
! defined, so we can continue to populate it with fields.
! At this point We can assume that the collection is defined,
! and that everything following are diagnostic fields.
!=================================================================

!-----------------------------------------------------------------
! ERROR CHECK: Make sure that the length of the simulation is
! not shorter than the requested "File Write" interval. This
! will prevent simulations without diagnostic output.
!-----------------------------------------------------------------
IF ( CollectionDuration(C) < CollectionFrequency(C) ) THEN

! Construct error message
ErrMsg = &
'No diagnostic output will be created for collection: "' // &
TRIM( CollectionName(C) ) // '"! Make sure that the ' // &
'collection duration setting is not shorter than the ' // &
'collection frequency setting in HISTORY.rc! For ' // &
'example, if the frequency is "00000001 000000" (1 day) ' // &
'but the duration is "00000000 010000" (1 hour), then ' // &
'this error will occur.'

! Return error
WRITE( ErrorLine, 250 ) LineNum
CALL GC_Error( ErrMsg, RC, ThisLoc, ErrorLine )
RETURN
ENDIF

!-----------------------------------------------------------------
! Continue populating the collection with fields
!-----------------------------------------------------------------

! Zero the counter of items
ItemCount = 0

Expand Down Expand Up @@ -1535,9 +1562,9 @@ SUBROUTINE History_ReadCollectionData( Input_Opt, State_Chm, State_Diag, &
'length of the simulation as specified in ' // &
'geoschem_config.yml (check the start and end dates) is ' // &
'not shorter than the frequency setting in HISTORY.rc! ' // &
'For example, if the frequency is 010000 (1 hour) but ' // &
'the simulation is set up to run for only 20 minutes, ' // &
'then this error will occur.'
'For example, if the frequency is "00000000 010000" ' // &
'(1 hour) but the simulation is set up to run for only ' // &
'20 minutes, then this error will occur.'

! Return error
WRITE( ErrorLine, 250 ) LineNum
Expand Down