From 0169ca207a9f8d88b73c0b4ada2df051955e444d Mon Sep 17 00:00:00 2001 From: Weiyuan Jiang Date: Wed, 16 Feb 2022 12:02:00 -0500 Subject: [PATCH] flexible DT for different grid comps --- generic/MAPL_Generic.F90 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/generic/MAPL_Generic.F90 b/generic/MAPL_Generic.F90 index b9fb5f3d5b01..618179636cd1 100644 --- a/generic/MAPL_Generic.F90 +++ b/generic/MAPL_Generic.F90 @@ -1302,6 +1302,7 @@ subroutine handle_clock_and_main_alarm(clock, unusable, rc) type(ESMF_Clock), intent(in) :: clock class(KeywordEnforcer), optional, intent(in) :: unusable integer, optional, intent(out) :: rc + character(len=3) :: alarm_ring_at_0 STATE%CLOCK = CLOCK call ESMF_ClockGet(CLOCK, TIMESTEP = DELT, __RC__) @@ -1360,8 +1361,15 @@ subroutine handle_clock_and_main_alarm(clock, unusable, rc) ringTime = ringTime - (INT((ringTime - currTime)/TIMEINT)+1)*TIMEINT end if - ringTime = ringTime-TSTEP ! we back off current time with clock's dt since - ! we advance the clock AFTER run method + call MAPL_GetResource (STATE, alarm_ring_at_0, label='ALARM_RING_AT_0:', & + default="NO", __RC__ ) + + ! we back off current time with clock's dt since + ! we advance the clock AFTER run metho + ! if the alarm ring at 0, we don't back off the time. + if (alarm_ring_at_0 == "NO") then + ringTime = ringTime-TSTEP + endif ! make sure that ringTime is not in the past do while (ringTime < currTime)