MODFLOW 6  version 6.7.0.dev3
USGS Modular Hydrologic Model
prtocmodule Module Reference

Data Types

type  prtoctype
 @ brief Output control for particle tracking models More...
 

Functions/Subroutines

subroutine, public oc_cr (ocobj, name_model, input_mempath, inunit, iout)
 @ brief Create an output control object More...
 
subroutine prt_oc_allocate_scalars (this, name_model, input_mempath)
 
subroutine oc_ar (this, dis, dnodata)
 @ brief Setup output control variables. More...
 
subroutine prt_oc_da (this)
 
subroutine prt_oc_source_options (this)
 
subroutine prt_oc_source_dimensions (this)
 source the dimensions block. More...
 
subroutine prt_oc_source_tracktimes (this)
 source the tracking times block. More...
 

Function/Subroutine Documentation

◆ oc_ar()

subroutine prtocmodule::oc_ar ( class(prtoctype this,
class(disbasetype), intent(in), pointer  dis,
real(dp), intent(in)  dnodata 
)
Parameters
thisPrtOcType object
[in]dismodel discretization package
[in]dnodatano data value

Definition at line 130 of file prt-oc.f90.

131  ! dummy
132  class(PrtOcType) :: this !< PrtOcType object
133  class(DisBaseType), pointer, intent(in) :: dis !< model discretization package
134  real(DP), intent(in) :: dnodata !< no data value
135  ! local
136  integer(I4B) :: i, nocdobj, inodata
137  type(OutputControlDataType), pointer :: ocdobjptr
138  real(DP), dimension(:), pointer, contiguous :: nullvec => null()
139 
140  ! Allocate and initialize variables
141  allocate (this%tracktimes)
142  call this%tracktimes%init()
143  inodata = 0
144  nocdobj = 1
145  allocate (this%ocds(nocdobj))
146  do i = 1, nocdobj
147  call ocd_cr(ocdobjptr)
148  select case (i)
149  case (1)
150  call ocdobjptr%init_dbl('BUDGET', nullvec, dis, 'PRINT LAST ', &
151  'COLUMNS 10 WIDTH 11 DIGITS 4 GENERAL ', &
152  this%iout, dnodata)
153  end select
154  this%ocds(i) = ocdobjptr
155  deallocate (ocdobjptr)
156  end do
157 
158  ! Read options, dimensions, and tracktimes
159  ! blocks if this package is enabled
160  if (this%input_mempath == '') return
161  call this%source_options()
162  call this%prt_oc_source_dimensions()
163  call this%prt_oc_source_tracktimes()
Here is the call graph for this function:

◆ oc_cr()

subroutine, public prtocmodule::oc_cr ( type(prtoctype), pointer  ocobj,
character(len=*), intent(in)  name_model,
character(len=*), intent(in)  input_mempath,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout 
)
Parameters
ocobjPrtOcType object
[in]name_modelname of the model
[in]input_mempathinput mempath of the package
[in]inunitunit number for input
[in]ioutunit number for output

Definition at line 51 of file prt-oc.f90.

52  type(PrtOcType), pointer :: ocobj !< PrtOcType object
53  character(len=*), intent(in) :: name_model !< name of the model
54  character(len=*), intent(in) :: input_mempath !< input mempath of the package
55  integer(I4B), intent(in) :: inunit !< unit number for input
56  integer(I4B), intent(in) :: iout !< unit number for output
57 
58  ! Create the object
59  allocate (ocobj)
60 
61  ! Allocate scalars
62  call ocobj%allocate_scalars(name_model, input_mempath)
63 
64  ! Save unit numbers
65  ocobj%inunit = inunit
66  ocobj%iout = iout
Here is the caller graph for this function:

◆ prt_oc_allocate_scalars()

subroutine prtocmodule::prt_oc_allocate_scalars ( class(prtoctype this,
character(len=*), intent(in)  name_model,
character(len=*), intent(in)  input_mempath 
)
private
Parameters
[in]name_modelname of model
[in]input_mempathinput mempath of the package

Definition at line 69 of file prt-oc.f90.

71  class(PrtOcType) :: this
72  character(len=*), intent(in) :: name_model !< name of model
73  character(len=*), intent(in) :: input_mempath !< input mempath of the package
74  logical(LGP) :: found
75 
76  this%memoryPath = create_mem_path(name_model, 'OC')
77 
78  allocate (this%name_model)
79  allocate (this%input_fname)
80  call mem_allocate(this%dump_event_trace, 'DUMP_EVENT_TRACE', this%memoryPath)
81  call mem_allocate(this%inunit, 'INUNIT', this%memoryPath)
82  call mem_allocate(this%iout, 'IOUT', this%memoryPath)
83  call mem_allocate(this%ibudcsv, 'IBUDCSV', this%memoryPath)
84  call mem_allocate(this%iperoc, 'IPEROC', this%memoryPath)
85  call mem_allocate(this%iocrep, 'IOCREP', this%memoryPath)
86  call mem_allocate(this%itrkout, 'ITRKOUT', this%memoryPath)
87  call mem_allocate(this%itrkhdr, 'ITRKHDR', this%memoryPath)
88  call mem_allocate(this%itrkcsv, 'ITRKCSV', this%memoryPath)
89  call mem_allocate(this%itrktls, 'ITRKTLS', this%memoryPath)
90  call mem_allocate(this%trackrelease, 'ITRACKRELEASE', this%memoryPath)
91  call mem_allocate(this%trackfeatexit, 'ITRACKFEATEXIT', this%memoryPath)
92  call mem_allocate(this%tracktimestep, 'ITRACKTIMESTEP', this%memoryPath)
93  call mem_allocate(this%trackterminate, 'ITRACKTERMINATE', this%memoryPath)
94  call mem_allocate(this%trackweaksink, 'ITRACKWEAKSINK', this%memoryPath)
95  call mem_allocate(this%trackusertime, 'ITRACKUSERTIME', this%memoryPath)
96  call mem_allocate(this%tracksubfexit, 'ITRACKSUBFEXIT', this%memoryPath)
97  call mem_allocate(this%trackdropped, 'ITRACKDROPPED', this%memoryPath)
98  call mem_allocate(this%ntracktimes, 'NTRACKTIMES', this%memoryPath)
99 
100  this%name_model = name_model
101  this%input_mempath = input_mempath
102  this%input_fname = ''
103  this%dump_event_trace = .false.
104  this%inunit = 0
105  this%iout = 0
106  this%ibudcsv = 0
107  this%iperoc = 0
108  this%iocrep = 0
109  this%itrkout = 0
110  this%itrkhdr = 0
111  this%itrkcsv = 0
112  this%itrktls = 0
113  this%trackrelease = .false.
114  this%trackfeatexit = .false.
115  this%tracktimestep = .false.
116  this%trackterminate = .false.
117  this%trackweaksink = .false.
118  this%trackusertime = .false.
119  this%tracksubfexit = .false.
120  this%trackdropped = .false.
121  this%ntracktimes = 0
122 
123  if (this%input_mempath /= '') then
124  call mem_set_value(this%input_fname, 'INPUT_FNAME', &
125  this%input_mempath, found)
126  end if
Here is the call graph for this function:

◆ prt_oc_da()

subroutine prtocmodule::prt_oc_da ( class(prtoctype this)
private

Definition at line 166 of file prt-oc.f90.

167  ! dummy
168  class(PrtOcType) :: this
169  ! local
170  integer(I4B) :: i
171 
172  call this%tracktimes%deallocate()
173 
174  do i = 1, size(this%ocds)
175  call this%ocds(i)%ocd_da()
176  end do
177  deallocate (this%ocds)
178 
179  deallocate (this%name_model)
180  call mem_deallocate(this%dump_event_trace)
181  call mem_deallocate(this%inunit)
182  call mem_deallocate(this%iout)
183  call mem_deallocate(this%ibudcsv)
184  call mem_deallocate(this%iperoc)
185  call mem_deallocate(this%iocrep)
186  call mem_deallocate(this%itrkout)
187  call mem_deallocate(this%itrkhdr)
188  call mem_deallocate(this%itrkcsv)
189  call mem_deallocate(this%itrktls)
190  call mem_deallocate(this%trackrelease)
191  call mem_deallocate(this%trackfeatexit)
192  call mem_deallocate(this%tracktimestep)
193  call mem_deallocate(this%trackterminate)
194  call mem_deallocate(this%trackweaksink)
195  call mem_deallocate(this%trackusertime)
196  call mem_deallocate(this%tracksubfexit)
197  call mem_deallocate(this%trackdropped)
198  call mem_deallocate(this%ntracktimes)
199 

◆ prt_oc_source_dimensions()

subroutine prtocmodule::prt_oc_source_dimensions ( class(prtoctype), intent(inout)  this)

Definition at line 310 of file prt-oc.f90.

311  use constantsmodule, only: linelength
315  ! dummy
316  class(PrtOcType), intent(inout) :: this
317  ! local
318  type(PrtOcParamFoundType) :: found
319  write (this%iout, '(/1x,a)') &
320  'PROCESSING OUTPUT CONTROL DIMENSIONS'
321  call mem_set_value(this%ntracktimes, 'NTRACKTIMES', this%input_mempath, &
322  found%ntracktimes)
323  if (found%ntracktimes) then
324  write (this%iout, '(4x,a,i7)') 'NTRACKTIMES = ', this%ntracktimes
325  end if
326  write (this%iout, '(1x,a)') &
327  'END OF OUTPUT CONTROL DIMENSIONS'
328 
329  if (this%ntracktimes < 0) then
330  write (errmsg, '(a)') &
331  'NTRACKTIMES WAS NOT SPECIFIED OR WAS SPECIFIED INCORRECTLY.'
332  call store_error(errmsg)
333  end if
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
integer(i4b) function, public count_errors()
Return number of errors.
Definition: Sim.f90:59
Here is the call graph for this function:

◆ prt_oc_source_options()

subroutine prtocmodule::prt_oc_source_options ( class(prtoctype this)
private

Definition at line 202 of file prt-oc.f90.

203  ! -- modules
204  use openspecmodule, only: access, form
206  use constantsmodule, only: linelength
210  ! -- dummy
211  class(PrtOcType) :: this
212  ! -- local
213  character(len=LINELENGTH) :: trackfile, trackcsv
214  type(PrtOcParamFoundType) :: found
215  integer(I4B), pointer :: evinput
216  ! formats
217  character(len=*), parameter :: fmttrkbin = &
218  "(4x, 'PARTICLE TRACKS WILL BE SAVED TO BINARY FILE: ', a, /4x, &
219  &'OPENED ON UNIT: ', I0)"
220  character(len=*), parameter :: fmttrkcsv = &
221  "(4x, 'PARTICLE TRACKS WILL BE SAVED TO CSV FILE: ', a, /4x, &
222  &'OPENED ON UNIT: ', I0)"
223 
224  allocate (evinput)
225 
226  write (this%iout, '(/,1x,a,/)') 'PROCESSING OC OPTIONS'
227  !
228  ! -- source base class options
229  call this%OutPutControlType%source_options()
230  !
231  ! -- source options
232  call mem_set_value(trackfile, 'TRACKFILE', this%input_mempath, &
233  found%trackfile)
234  call mem_set_value(trackcsv, 'TRACKCSVFILE', this%input_mempath, &
235  found%trackcsvfile)
236  call mem_set_value(evinput, 'TRACK_RELEASE', this%input_mempath, &
237  found%track_release)
238  call mem_set_value(evinput, 'TRACK_EXIT', this%input_mempath, &
239  found%track_exit)
240  call mem_set_value(evinput, 'TRACK_SUBF_EXIT', this%input_mempath, &
241  found%track_subf_exit)
242  call mem_set_value(evinput, 'TRACK_DROPPED', this%input_mempath, &
243  found%track_dropped)
244  call mem_set_value(evinput, 'TRACK_TIMESTEP', this%input_mempath, &
245  found%track_timestep)
246  call mem_set_value(evinput, 'TRACK_TERMINATE', this%input_mempath, &
247  found%track_terminate)
248  call mem_set_value(evinput, 'TRACK_WEAKSINK', this%input_mempath, &
249  found%track_weaksink)
250  call mem_set_value(evinput, 'TRACK_USERTIME', this%input_mempath, &
251  found%track_usertime)
252  call mem_set_value(evinput, 'DEV_DUMP_EVTRACE', this%input_mempath, &
253  found%dev_dump_evtrace)
254 
255  if (found%track_release) this%trackrelease = .true.
256  if (found%track_exit) this%trackfeatexit = .true.
257  if (found%track_subf_exit) this%tracksubfexit = .true.
258  if (found%track_dropped) this%trackdropped = .true.
259  if (found%track_timestep) this%tracktimestep = .true.
260  if (found%track_terminate) this%trackterminate = .true.
261  if (found%track_weaksink) this%trackweaksink = .true.
262  if (found%track_usertime) this%trackusertime = .true.
263  if (found%dev_dump_evtrace) this%dump_event_trace = .true.
264 
265  ! default to all events
266  if (.not. (found%track_release .or. &
267  found%track_exit .or. &
268  found%track_timestep .or. &
269  found%track_terminate .or. &
270  found%track_weaksink .or. &
271  found%track_usertime .or. &
272  found%track_dropped)) then
273  this%trackrelease = .true.
274  this%trackfeatexit = .true.
275  this%tracktimestep = .true.
276  this%trackterminate = .true.
277  this%trackweaksink = .true.
278  this%trackusertime = .true.
279  this%trackdropped = .true.
280  end if
281 
282  if (found%trackfile) then
283  ! open binary track output file
284  this%itrkout = getunit()
285  call openfile(this%itrkout, this%iout, trackfile, 'DATA(BINARY)', &
286  form, access, filstat_opt='REPLACE', &
287  mode_opt=mnormal)
288  write (this%iout, fmttrkbin) trim(adjustl(trackfile)), this%itrkout
289  ! open and write ascii track header file
290  this%itrkhdr = getunit()
291  trackfile = trim(trackfile)//'.hdr'
292  call openfile(this%itrkhdr, this%iout, trackfile, 'CSV', &
293  filstat_opt='REPLACE', mode_opt=mnormal)
294  write (this%itrkhdr, '(a,/,a)') trackheader, trackdtypes
295  end if
296 
297  if (found%trackcsvfile) then
298  this%itrkcsv = getunit()
299  call openfile(this%itrkcsv, this%iout, trackcsv, 'CSV', &
300  filstat_opt='REPLACE')
301  write (this%iout, fmttrkcsv) trim(adjustl(trackcsv)), this%itrkcsv
302  write (this%itrkcsv, '(a)') trackheader
303  end if
304 
305  write (this%iout, '(1x,a)') 'END OF OC OPTIONS'
306  deallocate (evinput)
integer(i4b) function, public getunit()
Get a free unit number.
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
Definition: InputOutput.f90:30
character(len=20) access
Definition: OpenSpec.f90:7
character(len=20) form
Definition: OpenSpec.f90:7
Particle track output module.
character(len= *), parameter, public trackheader
character(len= *), parameter, public trackdtypes
Here is the call graph for this function:

◆ prt_oc_source_tracktimes()

subroutine prtocmodule::prt_oc_source_tracktimes ( class(prtoctype), intent(inout)  this)

Definition at line 337 of file prt-oc.f90.

341  ! dummy
342  class(PrtOcType), intent(inout) :: this
343  ! local
344  real(DP), dimension(:), pointer, contiguous :: tracktimes
345  integer(I4B) :: n, asize
346 
347  if (this%ntracktimes <= 0) return
348 
349  call get_isize('TIME', this%input_mempath, asize)
350 
351  if (asize /= this%ntracktimes) then
352  write (errmsg, '(a, i0)') &
353  "Expected TRACKTIMES with length ", this%ntracktimes
354  call store_error(errmsg)
355  call store_error_filename(this%input_fname)
356  else
357  call mem_setptr(tracktimes, 'TIME', this%input_mempath)
358 
359  ! allocate time selection
360  call this%tracktimes%expand(this%ntracktimes)
361 
362  do n = 1, this%ntracktimes
363  this%tracktimes%times(n) = tracktimes(n)
364  end do
365  end if
366 
367  ! make sure times strictly increase
368  if (.not. this%tracktimes%increasing()) then
369  errmsg = "TRACKTIMES must strictly increase"
370  call store_error(errmsg)
371  call store_error_filename(this%input_fname)
372  end if
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
Here is the call graph for this function: