From 3d35f1861bbac7294e9cedaeb9963043fcb9048b Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Thu, 19 Dec 2024 14:41:14 -0500 Subject: [PATCH] fix(prt): fix output record duplication (#2113) The PRT model could write duplicative output, in volumes increasing with the current time step, due to a bug in the output file management logic. This bug has been fixed. --- doc/ReleaseNotes/develop.tex | 1 + src/Model/ParticleTracking/prt.f90 | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/doc/ReleaseNotes/develop.tex b/doc/ReleaseNotes/develop.tex index e83f22ab611..b0d6316f9e5 100644 --- a/doc/ReleaseNotes/develop.tex +++ b/doc/ReleaseNotes/develop.tex @@ -55,6 +55,7 @@ \item With a flow model using the Newton formulation, the PRT model could enter an endless loop upon a particle's entry to a dry cell if that cell contains a boundary package (e.g. a pumping well). Where the particle should be captured and terminate, it would instead be passed back and forth between the cell bottom and the top of the cell below. To avoid this, particles are forbidden from backtracking (reentering the previous cell) within the same time step. \item The PRT model now allows more control over vertical particle motion in dry conditions. In addition to the existing DRAPE option, which controls release-time behavior, the PRP package now provides a DRY\_TRACKING\_METHOD option which configures how dry particles (particles in dry cells, or above the water table in partially saturated cells) behave at tracking time. This option is relevant only when the Newton formulation is used, in which case dry cells remain active; otherwise, dry cells are inactive and particles will terminate. See the MF6IO document for a detailed explanation of DRY\_TRACKING\_METHOD. \item The PRT model's Particle Release Point (PRP) package now provides an option EXIT\_SOLVE\_TOLERANCE which configures the tolerance to use when solving for a particle's exit location from a triangular subcell of an unstructured grid cell. This value is only used for the generalized (ternary) tracking method on vertex grids. A value of 0.00001 is set by default. This value works well for many problems, but the value that strikes the best balance between accuracy and runtime is problem-dependent. + \item The PRT model could write duplicative output, in volumes increasing with the current time step, due to a bug in the output file management logic. This bug has been fixed. \end{itemize} %\underline{INTERNAL FLOW PACKAGES} diff --git a/src/Model/ParticleTracking/prt.f90 b/src/Model/ParticleTracking/prt.f90 index 0730d8f6b02..a2c1fc3e927 100644 --- a/src/Model/ParticleTracking/prt.f90 +++ b/src/Model/ParticleTracking/prt.f90 @@ -911,17 +911,19 @@ subroutine prt_solve(this) ! -- Update PRP index iprp = iprp + 1 - ! -- Initialize PRP-specific track files, if enabled - if (packobj%itrkout > 0) then - call this%trackctl%init_track_file( & - packobj%itrkout, & - iprp=iprp) - end if - if (packobj%itrkcsv > 0) then - call this%trackctl%init_track_file( & - packobj%itrkcsv, & - csv=.true., & - iprp=iprp) + ! -- Initialize PRP-specific track files + if (kper == 1 .and. kstp == 1) then + if (packobj%itrkout > 0) then + call this%trackctl%init_track_file( & + packobj%itrkout, & + iprp=iprp) + end if + if (packobj%itrkcsv > 0) then + call this%trackctl%init_track_file( & + packobj%itrkcsv, & + csv=.true., & + iprp=iprp) + end if end if ! -- Loop over particles in package @@ -957,7 +959,7 @@ subroutine prt_solve(this) ! Get and apply the tracking method call this%method%apply(particle, tmax) - ! Reset previous cell, exit face, and zone numbers + ! Reset previous cell and zone numbers particle%icp = 0 particle%izp = 0