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

Closes #1495. Correct ESMF errors with monthly collections #1496

Merged
merged 1 commit into from
May 3, 2022
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 @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Fixed incorrect legend when using PRINTSPEC option in MAPL Cap
- Fix ESMF errors exposed by monthly collections

### Added

Expand Down
16 changes: 9 additions & 7 deletions gridcomps/History/MAPL_HistoryGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ subroutine Initialize ( gc, import, dumexport, clock, rc )
! set up few variables to deal with monthly
startOfThisMonth = currTime
call ESMF_TimeSet(startOfThisMonth,dd=1,h=0,m=0,s=0,__RC__)
call ESMF_TimeIntervalSet( oneMonth, MM=1, __RC__)
call ESMF_TimeIntervalSet( oneMonth, MM=1, StartTime=StartTime, __RC__)


! Read User-Supplied History Lists from Config File
Expand Down Expand Up @@ -1257,7 +1257,7 @@ subroutine Initialize ( gc, import, dumexport, clock, rc )
RingTime = startOfThisMonth
else
sec = MAPL_nsecf( list(n)%frequency )
call ESMF_TimeIntervalSet( Frequency, S=sec, calendar=cal, rc=status ) ; _VERIFY(STATUS)
call ESMF_TimeIntervalSet( Frequency, S=sec, StartTime=StartTime, rc=status ) ; _VERIFY(STATUS)
RingTime = RefTime
end if

Expand All @@ -1280,7 +1280,7 @@ subroutine Initialize ( gc, import, dumexport, clock, rc )
if( list(n)%duration.ne.0 ) then
if (.not.list(n)%monthly) then
sec = MAPL_nsecf( list(n)%duration )
call ESMF_TimeIntervalSet( Frequency, S=sec, calendar=cal, rc=status ) ; _VERIFY(STATUS)
call ESMF_TimeIntervalSet( Frequency, S=sec, StartTime=StartTime, rc=status ) ; _VERIFY(STATUS)
else
Frequency = oneMonth
!ALT keep the values from above
Expand Down Expand Up @@ -3863,6 +3863,7 @@ subroutine MAPL_GradsCtlWrite ( clock, state,list,fname,expid,expdsc,output_grid
type(ESMF_Grid) :: grid
type(ESMF_Time) :: CurrTime
type(ESMF_Time) :: StopTime
type(ESMF_Time) :: StartTime
type(ESMF_Calendar) :: cal
type(ESMF_TimeInterval) :: ti, Frequency
integer :: nsteps
Expand Down Expand Up @@ -3898,9 +3899,10 @@ subroutine MAPL_GradsCtlWrite ( clock, state,list,fname,expid,expdsc,output_grid
'DTDT' , 'PHYSICS' , &
'DTDT' , 'GWD' /

call ESMF_ClockGet ( clock, currTime=CurrTime ,rc=STATUS ) ; _VERIFY(STATUS)
call ESMF_ClockGet ( clock, StopTime=StopTime ,rc=STATUS ) ; _VERIFY(STATUS)
call ESMF_ClockGet ( clock, Calendar=cal ,rc=STATUS ) ; _VERIFY(STATUS)
call ESMF_ClockGet ( clock, currTime=CurrTime, rc=STATUS ) ; _VERIFY(STATUS)
call ESMF_ClockGet ( clock, StopTime=StopTime, rc=STATUS ) ; _VERIFY(STATUS)
call ESMF_ClockGet ( clock, StartTime=StartTime, rc=STATUS ) ; _VERIFY(STATUS)
call ESMF_ClockGet ( clock, Calendar=cal, rc=STATUS ) ; _VERIFY(STATUS)

call ESMF_TimeGet ( CurrTime, timeString=TimeString, rc=status ) ; _VERIFY(STATUS)

Expand All @@ -3912,7 +3914,7 @@ subroutine MAPL_GradsCtlWrite ( clock, state,list,fname,expid,expdsc,output_grid

ti = StopTime-CurrTime
freq = MAPL_nsecf( list%frequency )
call ESMF_TimeIntervalSet( Frequency, S=freq, calendar=cal, rc=status ) ; _VERIFY(STATUS)
call ESMF_TimeIntervalSet( Frequency, S=freq, StartTime=StartTime, rc=status ) ; _VERIFY(STATUS)

nsteps = ti/Frequency + 1

Expand Down