23 integer(I4B),
pointer :: itrkout => null()
24 integer(I4B),
pointer :: itrkhdr => null()
25 integer(I4B),
pointer :: itrkcsv => null()
26 integer(I4B),
pointer :: itrktls => null()
27 logical(LGP),
pointer :: trackrelease => null()
28 logical(LGP),
pointer :: trackfeatexit => null()
29 logical(LGP),
pointer :: tracktimestep => null()
30 logical(LGP),
pointer :: trackterminate => null()
31 logical(LGP),
pointer :: trackweaksink => null()
32 logical(LGP),
pointer :: trackusertime => null()
33 logical(LGP),
pointer :: tracksubfexit => null()
34 logical(LGP),
pointer :: trackdropped => null()
35 integer(I4B),
pointer :: ntracktimes => null()
36 logical(LGP),
pointer :: dump_event_trace => null()
52 subroutine oc_cr(ocobj, name_model, inunit, iout)
54 character(len=*),
intent(in) :: name_model
55 integer(I4B),
intent(in) :: inunit
56 integer(I4B),
intent(in) :: iout
62 call ocobj%allocate_scalars(name_model)
69 call ocobj%parser%Initialize(inunit, iout)
74 character(len=*),
intent(in) :: name_model
78 allocate (this%name_model)
79 call mem_allocate(this%dump_event_trace,
'DUMP_EVENT_TRACE', this%memoryPath)
80 call mem_allocate(this%inunit,
'INUNIT', this%memoryPath)
82 call mem_allocate(this%ibudcsv,
'IBUDCSV', this%memoryPath)
83 call mem_allocate(this%iperoc,
'IPEROC', this%memoryPath)
84 call mem_allocate(this%iocrep,
'IOCREP', this%memoryPath)
85 call mem_allocate(this%itrkout,
'ITRKOUT', this%memoryPath)
86 call mem_allocate(this%itrkhdr,
'ITRKHDR', this%memoryPath)
87 call mem_allocate(this%itrkcsv,
'ITRKCSV', this%memoryPath)
88 call mem_allocate(this%itrktls,
'ITRKTLS', this%memoryPath)
89 call mem_allocate(this%trackrelease,
'ITRACKRELEASE', this%memoryPath)
90 call mem_allocate(this%trackfeatexit,
'ITRACKFEATEXIT', this%memoryPath)
91 call mem_allocate(this%tracktimestep,
'ITRACKTIMESTEP', this%memoryPath)
92 call mem_allocate(this%trackterminate,
'ITRACKTERMINATE', this%memoryPath)
93 call mem_allocate(this%trackweaksink,
'ITRACKWEAKSINK', this%memoryPath)
94 call mem_allocate(this%trackusertime,
'ITRACKUSERTIME', this%memoryPath)
95 call mem_allocate(this%tracksubfexit,
'ITRACKSUBFEXIT', this%memoryPath)
96 call mem_allocate(this%trackdropped,
'ITRACKDROPPED', this%memoryPath)
97 call mem_allocate(this%ntracktimes,
'NTRACKTIMES', this%memoryPath)
99 this%name_model = name_model
100 this%dump_event_trace = .false.
110 this%trackrelease = .false.
111 this%trackfeatexit = .false.
112 this%tracktimestep = .false.
113 this%trackterminate = .false.
114 this%trackweaksink = .false.
115 this%trackusertime = .false.
116 this%tracksubfexit = .false.
117 this%trackdropped = .false.
123 subroutine oc_ar(this, dis, dnodata)
127 real(DP),
intent(in) :: dnodata
129 integer(I4B) :: i, nocdobj, inodata
131 real(DP),
dimension(:),
pointer,
contiguous :: nullvec => null()
134 allocate (this%tracktimes)
135 call this%tracktimes%init()
138 allocate (this%ocds(nocdobj))
143 call ocdobjptr%init_dbl(
'BUDGET', nullvec, dis,
'PRINT LAST ', &
144 'COLUMNS 10 WIDTH 11 DIGITS 4 GENERAL ', &
147 this%ocds(i) = ocdobjptr
148 deallocate (ocdobjptr)
153 if (this%inunit <= 0)
return
154 call this%read_options()
155 call this%prt_oc_read_dimensions()
156 call this%prt_oc_read_tracktimes()
166 call this%tracktimes%deallocate()
168 do i = 1,
size(this%ocds)
169 call this%ocds(i)%ocd_da()
171 deallocate (this%ocds)
173 deallocate (this%name_model)
207 character(len=LINELENGTH) :: keyword
208 character(len=LINELENGTH) :: keyword2
209 character(len=LINELENGTH) :: fname
210 character(len=:),
allocatable :: line
211 integer(I4B) :: ierr, ipos
212 logical(LGP) :: block_found, param_found, event_found, eob
215 character(len=*),
parameter :: fmttrkbin = &
216 "(4x, 'PARTICLE TRACKS WILL BE SAVED TO BINARY FILE: ', a, /4x, &
217 &'OPENED ON UNIT: ', I0)"
218 character(len=*),
parameter :: fmttrkcsv = &
219 "(4x, 'PARTICLE TRACKS WILL BE SAVED TO CSV FILE: ', a, /4x, &
220 &'OPENED ON UNIT: ', I0)"
223 call this%parser%GetBlock(
'OPTIONS', block_found, ierr, &
224 supportopenclose=.true., blockrequired=.false.)
227 if (block_found)
then
228 write (this%iout,
'(/,1x,a,/)')
'PROCESSING OC OPTIONS'
229 event_found = .false.
231 call this%parser%GetNextLine(eob)
233 call this%parser%GetStringCaps(keyword)
234 param_found = .false.
235 select case (keyword)
237 call this%parser%GetStringCaps(keyword2)
238 if (keyword2 /=
'FILEOUT')
then
239 errmsg =
"BUDGETCSV must be followed by FILEOUT and then budget &
240 &csv file name. Found '"//trim(keyword2)//
"'."
242 call this%parser%StoreErrorUnit()
244 call this%parser%GetString(fname)
246 call openfile(this%ibudcsv, this%iout, fname,
'CSV', &
247 filstat_opt=
'REPLACE')
250 call this%parser%GetStringCaps(keyword)
251 if (keyword ==
'FILEOUT')
then
253 call this%parser%GetString(fname)
256 call openfile(this%itrkout, this%iout, fname,
'DATA(BINARY)', &
259 write (this%iout, fmttrkbin) trim(adjustl(fname)), this%itrkout
262 fname = trim(fname)//
'.hdr'
263 call openfile(this%itrkhdr, this%iout, fname,
'CSV', &
264 filstat_opt=
'REPLACE', mode_opt=mnormal)
267 call store_error(
'OPTIONAL TRACK KEYWORD MUST BE '// &
268 'FOLLOWED BY FILEOUT')
272 call this%parser%GetStringCaps(keyword)
273 if (keyword ==
'FILEOUT')
then
275 call this%parser%GetString(fname)
278 call openfile(this%itrkcsv, this%iout, fname,
'CSV', &
279 filstat_opt=
'REPLACE')
280 write (this%iout, fmttrkcsv) trim(adjustl(fname)), this%itrkcsv
283 call store_error(
'OPTIONAL TRACKCSV KEYWORD MUST BE &
284 &FOLLOWED BY FILEOUT')
287 case (
'TRACK_RELEASE')
288 this%trackrelease = .true.
292 this%trackfeatexit = .true.
295 case (
'TRACK_TIMESTEP')
296 this%tracktimestep = .true.
299 case (
'TRACK_TERMINATE')
300 this%trackterminate = .true.
303 case (
'TRACK_WEAKSINK')
304 this%trackweaksink = .true.
307 case (
'TRACK_USERTIME')
308 this%trackusertime = .true.
311 case (
'TRACK_SUBFEATURE_EXIT')
312 this%tracksubfexit = .true.
315 case (
'TRACK_DROPPED')
316 this%trackdropped = .true.
319 case (
'DEV_DUMP_EVENT_TRACE')
320 this%dump_event_trace = .true.
323 param_found = .false.
327 if (.not. param_found)
then
328 do ipos = 1,
size(this%ocds)
329 ocdobjptr => this%ocds(ipos)
330 if (keyword == trim(ocdobjptr%cname))
then
335 if (.not. param_found)
then
336 errmsg =
"UNKNOWN OC OPTION '"//trim(keyword)//
"'."
338 call this%parser%StoreErrorUnit()
340 call this%parser%GetRemainingLine(line)
341 call ocdobjptr%set_option(line, this%parser%iuactive, this%iout)
346 if (.not. event_found)
then
347 this%trackrelease = .true.
348 this%trackfeatexit = .true.
349 this%tracktimestep = .true.
350 this%trackterminate = .true.
351 this%trackweaksink = .true.
352 this%trackusertime = .true.
353 this%trackdropped = .true.
357 write (this%iout,
'(1x,a)')
'END OF OC OPTIONS'
368 character(len=LINELENGTH) :: keyword
370 logical(LGP) :: isfound, endOfBlock
373 this%ntracktimes = -1
376 call this%parser%GetBlock(
'DIMENSIONS', isfound, ierr, &
377 supportopenclose=.true., &
378 blockrequired=.false.)
381 if (.not. isfound)
return
382 write (this%iout,
'(/1x,a)') &
383 'PROCESSING OUTPUT CONTROL DIMENSIONS'
385 call this%parser%GetNextLine(endofblock)
387 call this%parser%GetStringCaps(keyword)
388 select case (keyword)
390 this%ntracktimes = this%parser%GetInteger()
391 write (this%iout,
'(4x,a,i7)')
'NTRACKTIMES = ', this%ntracktimes
394 'UNKNOWN OUTPUT CONTROL DIMENSION: ', trim(keyword)
398 write (this%iout,
'(1x,a)') &
399 'END OF OUTPUT CONTROL DIMENSIONS'
401 if (this%ntracktimes < 0)
then
403 'NTRACKTIMES WAS NOT SPECIFIED OR WAS SPECIFIED INCORRECTLY.'
409 call this%parser%StoreErrorUnit()
418 integer(I4B) :: i, ierr
419 logical(LGP) :: eob, found, success
423 call this%parser%GetBlock(
'TRACKTIMES', found, ierr, &
424 supportopenclose=.true., &
425 blockrequired=.false.)
429 if (.not. found)
then
430 if (this%ntracktimes <= 0)
return
431 write (
errmsg,
'(a, i0)') &
432 "Expected TRACKTIMES with length ", this%ntracktimes
434 call this%parser%StoreErrorUnit(terminate=.true.)
438 call this%tracktimes%expand(this%ntracktimes)
441 write (this%iout,
'(/1x,a)') &
442 'PROCESSING OUTPUT CONTROL TRACKTIMES'
443 do i = 1, this%ntracktimes
444 call this%parser%GetNextLine(eob)
446 call this%parser%TryGetDouble(t, success)
447 if (.not. success)
then
448 errmsg =
"Failed to read double precision value"
450 call this%parser%StoreErrorUnit(terminate=.true.)
452 this%tracktimes%times(i) = t
456 if (.not. this%tracktimes%increasing())
then
457 errmsg =
"TRACKTIMES must strictly increase"
459 call this%parser%StoreErrorUnit(terminate=.true.)
This module contains block parser methods.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
@ mnormal
normal output mode
integer(i4b), parameter lenmodelname
maximum length of the model name
This module defines variable data types.
This module contains the LongLineReaderType.
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
Output control data module.
subroutine, public ocd_cr(ocdobj)
@ brief Create a new output control data type.
Particle track output module.
character(len= *), parameter, public trackheader
character(len= *), parameter, public trackdtypes
subroutine prt_oc_read_dimensions(this)
Read the dimensions block.
subroutine oc_ar(this, dis, dnodata)
@ brief Setup output control variables.
subroutine prt_oc_read_tracktimes(this)
Read the tracking times block.
subroutine prt_oc_allocate_scalars(this, name_model)
subroutine prt_oc_da(this)
subroutine prt_oc_read_options(this)
subroutine, public oc_cr(ocobj, name_model, inunit, iout)
@ brief Create an output control object
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
integer(i4b) function, public count_errors()
Return number of errors.
subroutine, public store_error_unit(iunit, terminate)
Store the file unit number.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
character(len=maxcharlen) warnmsg
warning message string
Specify times for some event to occur.
Output control data type.
@ brief Controls model output. Overridden for each model type.
@ brief Output control for particle tracking models
Represents a series of instants at which some event should occur.