Skip to content

Commit 3d35f18

Browse files
authored
fix(prt): fix output record duplication (MODFLOW-ORG#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.
1 parent a23357b commit 3d35f18

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

doc/ReleaseNotes/develop.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
\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.
5656
\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.
5757
\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.
58+
\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.
5859
\end{itemize}
5960

6061
%\underline{INTERNAL FLOW PACKAGES}

src/Model/ParticleTracking/prt.f90

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -911,17 +911,19 @@ subroutine prt_solve(this)
911911
! -- Update PRP index
912912
iprp = iprp + 1
913913

914-
! -- Initialize PRP-specific track files, if enabled
915-
if (packobj%itrkout > 0) then
916-
call this%trackctl%init_track_file( &
917-
packobj%itrkout, &
918-
iprp=iprp)
919-
end if
920-
if (packobj%itrkcsv > 0) then
921-
call this%trackctl%init_track_file( &
922-
packobj%itrkcsv, &
923-
csv=.true., &
924-
iprp=iprp)
914+
! -- Initialize PRP-specific track files
915+
if (kper == 1 .and. kstp == 1) then
916+
if (packobj%itrkout > 0) then
917+
call this%trackctl%init_track_file( &
918+
packobj%itrkout, &
919+
iprp=iprp)
920+
end if
921+
if (packobj%itrkcsv > 0) then
922+
call this%trackctl%init_track_file( &
923+
packobj%itrkcsv, &
924+
csv=.true., &
925+
iprp=iprp)
926+
end if
925927
end if
926928

927929
! -- Loop over particles in package
@@ -957,7 +959,7 @@ subroutine prt_solve(this)
957959
! Get and apply the tracking method
958960
call this%method%apply(particle, tmax)
959961

960-
! Reset previous cell, exit face, and zone numbers
962+
! Reset previous cell and zone numbers
961963
particle%icp = 0
962964
particle%izp = 0
963965

0 commit comments

Comments
 (0)