Skip to content

Commit

Permalink
Merge pull request #1496 from GEOS-ESM/bugfix/mathomp4/1495-monthly-e…
Browse files Browse the repository at this point in the history
…smf-errors

Closes #1495. Correct ESMF errors with monthly collections
  • Loading branch information
atrayano authored May 3, 2022
2 parents e09e158 + 1b78112 commit 3935e46
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
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

0 comments on commit 3935e46

Please sign in to comment.