From b0de8ca4e60db7b5d5087d75fa197bfd2393ef51 Mon Sep 17 00:00:00 2001 From: Atanas Trayanov Date: Thu, 17 Feb 2022 16:58:06 -0500 Subject: [PATCH] Fixes 1379. Limited the duration of the clock --- CHANGELOG.md | 1 + gridcomps/Cap/MAPL_CapGridComp.F90 | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index db9721a892c2..2487798a4cce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed duration of the clock to be the smaller of the user specified duration and (END_DATE - currTime) - Fixed failures to fully trap errors in - History GC - MemUtils diff --git a/gridcomps/Cap/MAPL_CapGridComp.F90 b/gridcomps/Cap/MAPL_CapGridComp.F90 index 47c7fce2e040..58ed86032537 100644 --- a/gridcomps/Cap/MAPL_CapGridComp.F90 +++ b/gridcomps/Cap/MAPL_CapGridComp.F90 @@ -1666,6 +1666,7 @@ subroutine MAPL_ClockInit ( MAPLOBJ, Clock, nsteps, rc) type(ESMF_Time) :: CurrTime ! Current Current Time of Experiment type(ESMF_TimeInterval) :: timeStep ! HEARTBEAT type(ESMF_TimeInterval) :: duration + type(ESMF_TimeInterval) :: maxDuration type(ESMF_Calendar) :: cal character(ESMF_MAXSTR) :: calendar @@ -1917,6 +1918,9 @@ subroutine MAPL_ClockInit ( MAPLOBJ, Clock, nsteps, rc) rc = STATUS ) _VERIFY(STATUS) + maxDuration = EndTime - currTime + if (duration > maxDuration) duration = maxDuration + stopTime = currTime + duration ! initialize model time step