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

Feature/atrayano/history start stop #3278

Merged
merged 26 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1184b1b
major updates for upper_air restart regrid/remap to fix vector regrid…
wmputman Mar 5, 2024
e7db9cf
patches from WMP
wmputman Mar 11, 2024
2338c52
hand-merge develop into feature/wmputman/KM_v11_5_1_remap_upper
sdrabenh Apr 5, 2024
958b125
updates so it builds
bena-nasa Apr 5, 2024
fa8c5b3
change allreduce bill put in to barriers
bena-nasa Apr 5, 2024
52bfc94
remove commented out code
bena-nasa Apr 5, 2024
e9343aa
restore version without spaces
bena-nasa Apr 5, 2024
5e907d8
Merge branch 'develop' into feature/sdrabenh/gcm_v12-rc1
mathomp4 Apr 10, 2024
b889e07
Merge branch 'develop' into feature/sdrabenh/gcm_v12-rc1
mathomp4 Apr 11, 2024
610d1ae
Update CHANGELOG.md
mathomp4 Apr 11, 2024
e65cfe8
latest updates for HWT SFE 2024
wmputman Apr 22, 2024
8f7fc9e
hand-resolve merge conflicts from feature/wmputman/KM_v11_5_1_HWT_SFE…
sdrabenh Apr 26, 2024
f1fd67a
Removed loop-level timer barriers
wmputman Jul 30, 2024
493149f
Hand-merge v2.47.1
sdrabenh Aug 14, 2024
6786b54
Turn off default write/read of weights
mathomp4 Aug 22, 2024
957c6d8
hand merge v2.50.1 into feature/sdrabenh/gcm_v12
sdrabenh Oct 21, 2024
abf70cd
Merge tag 'v2.51.0' into feature/sdrabenh/gcm_v12
mathomp4 Dec 9, 2024
d59bdbb
Remove stray changelog entry
mathomp4 Dec 9, 2024
1ff3ceb
Merge tag 'v2.51.1' into feature/sdrabenh/gcm_v12
mathomp4 Dec 10, 2024
d777b8d
Added start_date and start_time for each collection.
atrayano Dec 27, 2024
828adae
Fixed logic for start alarm if the start date/time is before the
atrayano Jan 2, 2025
ec7e897
Modified CHANGELOG. Fixed the behavior for "backwards" running History
atrayano Jan 2, 2025
0f22f6b
Merge branch 'develop' into feature/atrayano/history_start_stop
atrayano Jan 2, 2025
42037f0
Update CHANGELOG.md
mathomp4 Jan 3, 2025
e5a6a53
Adopted suggestions from the PR review
atrayano Jan 6, 2025
35e774a
Merge branch 'develop' into feature/atrayano/history_start_stop
atrayano Jan 6, 2025
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added optional start_date and start_time to control the output window for each History collection. No output will be written before then. If not specified, these default to the beginning of the experiment.

- Added loggers when writing or reading weight files
- Added new option to AGCM.rc `overwrite_checkpoint` to allow checkpoint files to be overwritten. By default still will not overwrite checkpoints

Expand Down
4 changes: 4 additions & 0 deletions gridcomps/History/MAPL_HistoryCollection.F90
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,15 @@ module MAPL_HistoryCollectionMod
integer :: acc_offset
integer :: ref_date
integer :: ref_time
integer :: start_date
integer :: start_time
integer :: end_date
integer :: end_time
integer :: duration
type(ESMF_Alarm) :: his_alarm ! when to write file
type(ESMF_Alarm) :: seg_alarm ! segment alarm controls when to write to new file
type(ESMF_Alarm) :: mon_alarm
type(ESMF_Alarm) :: start_alarm
type(ESMF_Alarm) :: end_alarm
integer,pointer :: expSTATE (:)
integer :: unit
Expand All @@ -70,6 +73,7 @@ module MAPL_HistoryCollectionMod
integer :: verbose
integer :: xyoffset
logical :: disabled
logical :: skipWriting
logical :: subVm
logical :: backwards ! Adds support for clock running in reverse direction
logical :: useNewFormat
Expand Down
53 changes: 53 additions & 0 deletions gridcomps/History/MAPL_HistoryGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,17 @@ subroutine Initialize ( gc, import, dumexport, clock, rc )
label=trim(string) // 'ref_time:',_RC )
_ASSERT(is_valid_time(list(n)%ref_time),'Invalid ref_time')

call ESMF_ConfigGetAttribute ( cfg, list(n)%start_date, default=-999, &
label=trim(string) // 'start_date:',_RC )
if (list(n)%start_date /= -999) then
_ASSERT(is_valid_date(list(n)%start_date),'Invalid start_date')
end if
atrayano marked this conversation as resolved.
Show resolved Hide resolved
call ESMF_ConfigGetAttribute ( cfg, list(n)%start_time, default=-999, &
label=trim(string) // 'start_time:',_RC )
if (list(n)%start_time /= -999) then
_ASSERT(is_valid_time(list(n)%start_time),'Invalid start_time')
end if

call ESMF_ConfigGetAttribute ( cfg, list(n)%end_date, default=-999, &
label=trim(string) // 'end_date:',_RC )
if (list(n)%end_date /= -999) then
Expand Down Expand Up @@ -1349,6 +1360,38 @@ subroutine Initialize ( gc, import, dumexport, clock, rc )
intState%stampOffset(n) = Frequency ! we go to the beginning of the month
end if

! End Alarm based on start_date and start_time
! ----------------------------------------
if( list(n)%start_date.ne.-999 .and. list(n)%start_time.ne.-999 ) then
REF_TIME(1) = list(n)%start_date/10000
REF_TIME(2) = mod(list(n)%start_date,10000)/100
REF_TIME(3) = mod(list(n)%start_date,100)
REF_TIME(4) = list(n)%start_time/10000
REF_TIME(5) = mod(list(n)%start_time,10000)/100
REF_TIME(6) = mod(list(n)%start_time,100)

call ESMF_TimeSet( RingTime, YY = REF_TIME(1), &
MM = REF_TIME(2), &
DD = REF_TIME(3), &
H = REF_TIME(4), &
M = REF_TIME(5), &
S = REF_TIME(6), calendar=cal, rc=rc )
else
RingTime = CurrTime
end if
list(n)%start_alarm = ESMF_AlarmCreate( clock=clock, RingTime=RingTime, sticky=.false., _RC )

list(n)%skipWriting = .true.
if (RingTime == CurrTime) then
call ESMF_AlarmRingerOn(list(n)%start_alarm, _RC )
list(n)%skipWriting = .false.
else
if (RingTime < CurrTime .NEQV. list(n)%backwards) then
list(n)%skipWriting = .false.
endif
end if


! End Alarm based on end_date and end_time
! ----------------------------------------
if( list(n)%end_date.ne.-999 .and. list(n)%end_time.ne.-999 ) then
Expand Down Expand Up @@ -3427,6 +3470,14 @@ subroutine Run ( gc, import, export, clock, rc )

! decide if we are writing based on alarms

do n=1,nlist
if (list(n)%skipWriting) then
if (ESMF_AlarmIsRinging(list(n)%start_alarm)) then
list(n)%skipWriting = .false.
endif
endif
end do

do n=1,nlist
if (list(n)%disabled .or. ESMF_AlarmIsRinging(list(n)%end_alarm) ) then
list(n)%disabled = .true.
Expand Down Expand Up @@ -3454,6 +3505,8 @@ subroutine Run ( gc, import, export, clock, rc )
end if
end if

if (list(n)%skipWriting) writing(n) = .false.

if (writing(n) .and. .not.IntState%average(n)) then
! R8 to R4 copy (if needed!)
do m=1,list(n)%field_set%nfields
Expand Down
Loading