Skip to content

Commit

Permalink
allow post-end releases if extend_tracking is on, update prp dfn, bet…
Browse files Browse the repository at this point in the history
…ter warning messages
  • Loading branch information
wpbonelli committed Jan 6, 2025
1 parent b7c0045 commit 71df84a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion doc/ReleaseNotes/develop.tex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
\textbf{\underline{BUG FIXES AND OTHER CHANGES TO EXISTING FUNCTIONALITY}} \\
\underline{BASIC FUNCTIONALITY}
\begin{itemize}
\item The PRT model previously allowed particles to be released at any time. Release times falling outside the bounds of the simulation's time discretization could produce undefined behavior. Any release times falling outside the bounds of TDIS will now be skipped with a warning message.
\item The PRT model previously allowed particles to be released at any time. Release times falling outside the bounds of the simulation's time discretization could produce undefined behavior. Any release times occurring before the simulation begins (i.e. negative times) will now be skipped with a warning message. If EXTEND\_TRACKING is not enabled, the same goes for release times occurring after the end of the simulation. If EXTEND\_TRACKING is enabled, release times after the end of the simulation are allowed.
\end{itemize}

%\underline{INTERNAL FLOW PACKAGES}
Expand Down
2 changes: 1 addition & 1 deletion doc/mf6io/mf6ivar/dfn/prt-prp.dfn
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ type double precision
reader urword
optional true
longname stop time
description real value defining the maximum simulation time to which particles in the package can be tracked. Particles that have not terminated earlier due to another termination condition will terminate when simulation time STOPTIME is reached. If the last stress period in the simulation consists of more than one time step, particles will not be tracked past the ending time of the last stress period, regardless of STOPTIME. If the last stress period in the simulation consists of a single time step, it is assumed to be a steady-state stress period, and its ending time will not limit the simulation time to which particles can be tracked. If STOPTIME and STOPTRAVELTIME are both provided, particles will be stopped if either is reached.
description real value defining the maximum simulation time to which particles in the package can be tracked. Particles that have not terminated earlier due to another termination condition will terminate when simulation time STOPTIME is reached. If the last stress period in the simulation consists of more than one time step, particles will not be tracked past the ending time of the last stress period, regardless of STOPTIME. If the EXTEND\_TRACKING option is enabled and the last stress period in the simulation is steady-state, the simulation ending time will not limit the time to which particles can be tracked, but STOPTIME and STOPTRAVELTIME will continue to apply. If STOPTIME and STOPTRAVELTIME are both provided, particles will be stopped if either is reached.

block options
name stoptraveltime
Expand Down
20 changes: 2 additions & 18 deletions src/Model/ModelUtilities/ReleaseSchedule.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ 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
Expand Down Expand Up @@ -110,7 +108,7 @@ end subroutine schedule
!! This routine is idempotent.
!<
subroutine advance(this, lines)
use TdisModule, only: totimc, kstp, endofperiod, totalsimtime
use TdisModule, only: totimc, kstp, endofperiod
class(ReleaseScheduleType), intent(inout) :: this
character(len=LINELENGTH), intent(in), optional :: lines(:)
integer(I4B) :: it, i
Expand Down Expand Up @@ -145,24 +143,10 @@ subroutine advance(this, lines)
end if

! 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.
! to the configured tolerance of coincidence
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 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, &
Expand Down
20 changes: 19 additions & 1 deletion src/Model/ParticleTracking/prt-prp.f90
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,10 @@ end subroutine prp_ar

!> @brief Advance a time step and release particles if scheduled.
subroutine prp_ad(this)
use TdisModule, only: totalsimtime
class(PrtPrpType) :: this
integer(I4B) :: ip, it
real(DP) :: t

! Notes
! -----
Expand Down Expand Up @@ -344,7 +346,23 @@ subroutine prp_ad(this)
! each release time in the current step.
do ip = 1, this%nreleasepoints
do it = 1, this%schedule%count()
call this%release(ip, this%schedule%times(it))
t = this%schedule%times(it)
! Skip the release time if it's before the simulation
! starts, or if no `extend_tracking`, after it ends.
if (t < DZERO) then
write (warnmsg, '(a,g0,a)') &
'Warning: Skipping negative release time (t=', t, ').'
call store_warning(warnmsg)
cycle
else if (t > totalsimtime .and. this%iextend == 0) then
write (warnmsg, '(a,g0,a)') &
'Warning: Skipping release time falling after the end &
&of the simulation (t=', t, '). Enable EXTEND_TRACKING &
&to release particles after the simulation end time.'
call store_warning(warnmsg)
cycle
end if
call this%release(ip, t)
end do
end do
end subroutine prp_ad
Expand Down

0 comments on commit 71df84a

Please sign in to comment.