From e486a421436c78fa03ce9fae76c9bc2f2e29e7c3 Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Mon, 6 Jan 2025 08:46:05 -0500 Subject: [PATCH] fix(prt): skip release times falling outside tdis --- src/Model/ModelUtilities/ReleaseSchedule.f90 | 25 ++++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/Model/ModelUtilities/ReleaseSchedule.f90 b/src/Model/ModelUtilities/ReleaseSchedule.f90 index 2b9d514fe39..e35d6599b4f 100644 --- a/src/Model/ModelUtilities/ReleaseSchedule.f90 +++ b/src/Model/ModelUtilities/ReleaseSchedule.f90 @@ -7,6 +7,8 @@ module ReleaseScheduleModule use MathUtilModule, only: is_close use TimeSelectModule, only: TimeSelectType use TimeStepSelectModule, only: TimeStepSelectType + use SimModule, only: store_error, store_warning + use SimVariablesModule, only: errmsg, warnmsg implicit none private @@ -108,7 +110,7 @@ end subroutine schedule !! This routine is idempotent. !< subroutine advance(this, lines) - use TdisModule, only: totimc, kstp, endofperiod + use TdisModule, only: totimc, kstp, endofperiod, totalsimtime class(ReleaseScheduleType), intent(inout) :: this character(len=LINELENGTH), intent(in), optional :: lines(:) integer(I4B) :: it, i @@ -142,17 +144,30 @@ subroutine advance(this, lines) tprevious = trelease end if - ! Add explicitly configured release times, up - ! to the configured tolerance of coincidence. + ! Schedule explicitly specified release times, up + ! to the configured tolerance of coincidence. Any + ! release times falling outside tdis' bounds will + ! be omitted; particle releases may only occur in + ! the simulation's time window. if (this%time_select%any()) then do it = this%time_select%selection(1), this%time_select%selection(2) trelease = this%time_select%times(it) - ! Skip the release time if it's too close - ! to the previously scheduled release time. + + ! Skip the release time if.. + ! ..it falls before the simulation start time + if (trelease < DZERO .or. trelease > totalsimtime) then + write (warnmsg, '(a,g0,a)') & + 'Warning: release time (t=', trelease, ') is outside tdis' + call store_warning(warnmsg) + cycle + end if + + ! ..or it's too close to the previous time if (tprevious >= DZERO .and. is_close( & tprevious, & trelease, & atol=this%tolerance)) cycle + call this%schedule(trelease) tprevious = trelease end do