MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
trackcontrolmodule Module Reference

Data Types

type  trackcontroltype
 Manages particle track (i.e. pathline) files. More...
 

Functions/Subroutines

subroutine init_track_file (this, iun, csv, iprp)
 Initialize a new track file. More...
 
subroutine expand (this, increment)
 Expand the trackfile array, internal use only. More...
 
subroutine save (this, particle, kper, kstp, reason, level)
 Save the particle's state to track output file(s). More...
 
subroutine set_track_events (this, release, cellexit, timestep, terminate, weaksink, usertime)
 Configure particle events to track. More...
 

Function/Subroutine Documentation

◆ expand()

subroutine trackcontrolmodule::expand ( class(trackcontroltype this,
integer(i4b), intent(in), optional  increment 
)

Definition at line 76 of file TrackControl.f90.

77  ! dummy
78  class(TrackControlType) :: this
79  integer(I4B), optional, intent(in) :: increment
80  ! local
81  integer(I4B) :: inclocal
82  integer(I4B) :: isize
83  integer(I4B) :: newsize
84  type(TrackFileType), allocatable, dimension(:) :: temp
85 
86  ! Initialize optional args
87  if (present(increment)) then
88  inclocal = increment
89  else
90  inclocal = 1
91  end if
92 
93  ! Increase size of array
94  if (allocated(this%trackfiles)) then
95  isize = size(this%trackfiles)
96  newsize = isize + inclocal
97  allocate (temp(newsize))
98  temp(1:isize) = this%trackfiles
99  deallocate (this%trackfiles)
100  call move_alloc(temp, this%trackfiles)
101  else
102  allocate (this%trackfiles(inclocal))
103  end if
104 

◆ init_track_file()

subroutine trackcontrolmodule::init_track_file ( class(trackcontroltype this,
integer(i4b), intent(in)  iun,
logical(lgp), intent(in), optional  csv,
integer(i4b), intent(in), optional  iprp 
)

Definition at line 47 of file TrackControl.f90.

48  ! dummy
49  class(TrackControlType) :: this
50  integer(I4B), intent(in) :: iun
51  logical(LGP), intent(in), optional :: csv
52  integer(I4B), intent(in), optional :: iprp
53  ! local
54  type(TrackFileType), pointer :: file
55 
56  ! Allocate or expand array
57  if (.not. allocated(this%trackfiles)) then
58  allocate (this%trackfiles(1))
59  else
60  call this%expand(increment=1)
61  end if
62 
63  ! Setup new file
64  allocate (file)
65  file%iun = iun
66  if (present(csv)) file%csv = csv
67  if (present(iprp)) file%iprp = iprp
68 
69  ! Update array and counter
70  this%ntrackfiles = size(this%trackfiles)
71  this%trackfiles(this%ntrackfiles) = file
72 

◆ save()

subroutine trackcontrolmodule::save ( class(trackcontroltype), intent(inout)  this,
type(particletype), intent(in), pointer  particle,
integer(i4b), intent(in)  kper,
integer(i4b), intent(in)  kstp,
integer(i4b), intent(in)  reason,
integer(i4b), intent(in), optional  level 
)

A record is saved to all enabled model-level files and to any PRP-level files with PRP index matching the particle's PRP index.

Definition at line 113 of file TrackControl.f90.

114  ! dummy
115  class(TrackControlType), intent(inout) :: this
116  type(ParticleType), pointer, intent(in) :: particle
117  integer(I4B), intent(in) :: kper
118  integer(I4B), intent(in) :: kstp
119  integer(I4B), intent(in) :: reason
120  integer(I4B), intent(in), optional :: level
121  ! local
122  integer(I4B) :: i
123  type(TrackFileType) :: file
124 
125  ! Only save if reporting is enabled for specified event.
126  if (.not. ((this%trackrelease .and. reason == 0) .or. &
127  (this%trackexit .and. reason == 1) .or. &
128  (this%tracktimestep .and. reason == 2) .or. &
129  (this%trackterminate .and. reason == 3) .or. &
130  (this%trackweaksink .and. reason == 4) .or. &
131  (this%trackusertime .and. reason == 5))) &
132  return
133 
134  ! For now, only allow reporting from outside the tracking
135  ! algorithm (e.g. release time), in which case level will
136  ! not be provided, or if within the tracking solution, in
137  ! subcells (level 3) only. This may change if the subcell
138  ! ever delegates tracking to even smaller subcomponents.
139  if (present(level)) then
140  if (level .ne. 3) return
141  end if
142 
143  ! Save to any enabled model-scoped or PRP-scoped files
144  do i = 1, this%ntrackfiles
145  file = this%trackfiles(i)
146  if (file%iun > 0 .and. &
147  (file%iprp == -1 .or. &
148  file%iprp == particle%iprp)) &
149  call save_record(file%iun, particle, &
150  kper, kstp, reason, csv=file%csv)
151  end do
Here is the call graph for this function:

◆ set_track_events()

subroutine trackcontrolmodule::set_track_events ( class(trackcontroltype this,
logical(lgp), intent(in)  release,
logical(lgp), intent(in)  cellexit,
logical(lgp), intent(in)  timestep,
logical(lgp), intent(in)  terminate,
logical(lgp), intent(in)  weaksink,
logical(lgp), intent(in)  usertime 
)

Each tracking event corresponds to an "ireason" code as appears in each row of track output.

Definition at line 159 of file TrackControl.f90.

166  class(TrackControlType) :: this
167  logical(LGP), intent(in) :: release
168  logical(LGP), intent(in) :: cellexit
169  logical(LGP), intent(in) :: timestep
170  logical(LGP), intent(in) :: terminate
171  logical(LGP), intent(in) :: weaksink
172  logical(LGP), intent(in) :: usertime
173  this%trackrelease = release
174  this%trackexit = cellexit
175  this%tracktimestep = timestep
176  this%trackterminate = terminate
177  this%trackweaksink = weaksink
178  this%trackusertime = usertime