diff --git a/doc/ReleaseNotes/develop.tex b/doc/ReleaseNotes/develop.tex index e7504706100..91ed05a9de9 100644 --- a/doc/ReleaseNotes/develop.tex +++ b/doc/ReleaseNotes/develop.tex @@ -17,13 +17,11 @@ % \item xxx %\end{itemize} -%\textbf{\underline{BUG FIXES AND OTHER CHANGES TO EXISTING FUNCTIONALITY}} \\ -%\underline{BASIC FUNCTIONALITY} -%\begin{itemize} -% \item xxx -% \item xxx -% \item xxx -%\end{itemize} +\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 occurring before the simulation begins (i.e. negative times) will now be skipped with a warning message. If EXTEND\_TRACKING is not enabled, release times occurring after the end of the simulation will now be skipped with a warning message as well. If EXTEND\_TRACKING is enabled, release times after the end of the simulation are allowed. +\end{itemize} %\underline{INTERNAL FLOW PACKAGES} %\begin{itemize} diff --git a/doc/mf6io/mf6ivar/dfn/prt-prp.dfn b/doc/mf6io/mf6ivar/dfn/prt-prp.dfn index c274bce3aec..e9a6863f64c 100644 --- a/doc/mf6io/mf6ivar/dfn/prt-prp.dfn +++ b/doc/mf6io/mf6ivar/dfn/prt-prp.dfn @@ -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 @@ -142,7 +142,7 @@ type double precision reader urword optional true longname stop travel time -description real value defining the maximum travel time over which particles in the model can be tracked. Particles that have not terminated earlier due to another termination condition will terminate when their travel time reaches STOPTRAVELTIME. 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 STOPTRAVELTIME. 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 travel time over 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 travel time over which particles in the model can be tracked. Particles that have not terminated earlier due to another termination condition will terminate when their travel time reaches STOPTRAVELTIME. 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 STOPTRAVELTIME. 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 stop_at_weak_sink diff --git a/src/Model/ModelUtilities/ReleaseSchedule.f90 b/src/Model/ModelUtilities/ReleaseSchedule.f90 index 2b9d514fe39..935a7bbf660 100644 --- a/src/Model/ModelUtilities/ReleaseSchedule.f90 +++ b/src/Model/ModelUtilities/ReleaseSchedule.f90 @@ -142,17 +142,16 @@ 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 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. if (tprevious >= DZERO .and. is_close( & tprevious, & trelease, & atol=this%tolerance)) cycle + call this%schedule(trelease) tprevious = trelease end do diff --git a/src/Model/ParticleTracking/prt-prp.f90 b/src/Model/ParticleTracking/prt-prp.f90 index 7c747915763..3627ec6d031 100644 --- a/src/Model/ParticleTracking/prt-prp.f90 +++ b/src/Model/ParticleTracking/prt-prp.f90 @@ -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 ! ----- @@ -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)') & + '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)') & + '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