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 integer(I4B),
pointer :: ntracktimes => null()
35 logical(LGP),
pointer :: dump_event_trace => null()
51 subroutine oc_cr(ocobj, name_model, inunit, iout)
53 character(len=*),
intent(in) :: name_model
54 integer(I4B),
intent(in) :: inunit
55 integer(I4B),
intent(in) :: iout
61 call ocobj%allocate_scalars(name_model)
68 call ocobj%parser%Initialize(inunit, iout)
73 character(len=*),
intent(in) :: name_model
77 allocate (this%name_model)
78 call mem_allocate(this%dump_event_trace,
'DUMP_EVENT_TRACE', this%memoryPath)
79 call mem_allocate(this%inunit,
'INUNIT', this%memoryPath)
81 call mem_allocate(this%ibudcsv,
'IBUDCSV', this%memoryPath)
82 call mem_allocate(this%iperoc,
'IPEROC', this%memoryPath)
83 call mem_allocate(this%iocrep,
'IOCREP', this%memoryPath)
84 call mem_allocate(this%itrkout,
'ITRKOUT', this%memoryPath)
85 call mem_allocate(this%itrkhdr,
'ITRKHDR', this%memoryPath)
86 call mem_allocate(this%itrkcsv,
'ITRKCSV', this%memoryPath)
87 call mem_allocate(this%itrktls,
'ITRKTLS', this%memoryPath)
88 call mem_allocate(this%trackrelease,
'ITRACKRELEASE', this%memoryPath)
89 call mem_allocate(this%trackfeatexit,
'ITRACKFEATEXIT', this%memoryPath)
90 call mem_allocate(this%tracktimestep,
'ITRACKTIMESTEP', this%memoryPath)
91 call mem_allocate(this%trackterminate,
'ITRACKTERMINATE', this%memoryPath)
92 call mem_allocate(this%trackweaksink,
'ITRACKWEAKSINK', this%memoryPath)
93 call mem_allocate(this%trackusertime,
'ITRACKUSERTIME', this%memoryPath)
94 call mem_allocate(this%tracksubfexit,
'ITRACKSUBFEXIT', this%memoryPath)
95 call mem_allocate(this%ntracktimes,
'NTRACKTIMES', this%memoryPath)
97 this%name_model = name_model
98 this%dump_event_trace = .false.
108 this%trackrelease = .false.
109 this%trackfeatexit = .false.
110 this%tracktimestep = .false.
111 this%trackterminate = .false.
112 this%trackweaksink = .false.
113 this%trackusertime = .false.
114 this%tracksubfexit = .false.
120 subroutine oc_ar(this, dis, dnodata)
124 real(DP),
intent(in) :: dnodata
126 integer(I4B) :: i, nocdobj, inodata
128 real(DP),
dimension(:),
pointer,
contiguous :: nullvec => null()
131 allocate (this%tracktimes)
132 call this%tracktimes%init()
135 allocate (this%ocds(nocdobj))
140 call ocdobjptr%init_dbl(
'BUDGET', nullvec, dis,
'PRINT LAST ', &
141 'COLUMNS 10 WIDTH 11 DIGITS 4 GENERAL ', &
144 this%ocds(i) = ocdobjptr
145 deallocate (ocdobjptr)
150 if (this%inunit <= 0)
return
151 call this%read_options()
152 call this%prt_oc_read_dimensions()
153 call this%prt_oc_read_tracktimes()
163 call this%tracktimes%deallocate()
165 do i = 1,
size(this%ocds)
166 call this%ocds(i)%ocd_da()
168 deallocate (this%ocds)
170 deallocate (this%name_model)
203 character(len=LINELENGTH) :: keyword
204 character(len=LINELENGTH) :: keyword2
205 character(len=LINELENGTH) :: fname
206 character(len=:),
allocatable :: line
207 integer(I4B) :: ierr, ipos
208 logical(LGP) :: block_found, param_found, event_found, eob
211 character(len=*),
parameter :: fmttrkbin = &
212 "(4x, 'PARTICLE TRACKS WILL BE SAVED TO BINARY FILE: ', a, /4x, &
213 &'OPENED ON UNIT: ', I0)"
214 character(len=*),
parameter :: fmttrkcsv = &
215 "(4x, 'PARTICLE TRACKS WILL BE SAVED TO CSV FILE: ', a, /4x, &
216 &'OPENED ON UNIT: ', I0)"
219 call this%parser%GetBlock(
'OPTIONS', block_found, ierr, &
220 supportopenclose=.true., blockrequired=.false.)
223 if (block_found)
then
224 write (this%iout,
'(/,1x,a,/)')
'PROCESSING OC OPTIONS'
225 event_found = .false.
227 call this%parser%GetNextLine(eob)
229 call this%parser%GetStringCaps(keyword)
230 param_found = .false.
231 select case (keyword)
233 call this%parser%GetStringCaps(keyword2)
234 if (keyword2 /=
'FILEOUT')
then
235 errmsg =
"BUDGETCSV must be followed by FILEOUT and then budget &
236 &csv file name. Found '"//trim(keyword2)//
"'."
238 call this%parser%StoreErrorUnit()
240 call this%parser%GetString(fname)
242 call openfile(this%ibudcsv, this%iout, fname,
'CSV', &
243 filstat_opt=
'REPLACE')
246 call this%parser%GetStringCaps(keyword)
247 if (keyword ==
'FILEOUT')
then
249 call this%parser%GetString(fname)
252 call openfile(this%itrkout, this%iout, fname,
'DATA(BINARY)', &
255 write (this%iout, fmttrkbin) trim(adjustl(fname)), this%itrkout
258 fname = trim(fname)//
'.hdr'
259 call openfile(this%itrkhdr, this%iout, fname,
'CSV', &
260 filstat_opt=
'REPLACE', mode_opt=mnormal)
263 call store_error(
'OPTIONAL TRACK KEYWORD MUST BE '// &
264 'FOLLOWED BY FILEOUT')
268 call this%parser%GetStringCaps(keyword)
269 if (keyword ==
'FILEOUT')
then
271 call this%parser%GetString(fname)
274 call openfile(this%itrkcsv, this%iout, fname,
'CSV', &
275 filstat_opt=
'REPLACE')
276 write (this%iout, fmttrkcsv) trim(adjustl(fname)), this%itrkcsv
279 call store_error(
'OPTIONAL TRACKCSV KEYWORD MUST BE &
280 &FOLLOWED BY FILEOUT')
283 case (
'TRACK_RELEASE')
284 this%trackrelease = .true.
288 this%trackfeatexit = .true.
291 case (
'TRACK_TIMESTEP')
292 this%tracktimestep = .true.
295 case (
'TRACK_TERMINATE')
296 this%trackterminate = .true.
299 case (
'TRACK_WEAKSINK')
300 this%trackweaksink = .true.
303 case (
'TRACK_USERTIME')
304 this%trackusertime = .true.
307 case (
'TRACK_SUBFEATURE_EXIT')
308 this%tracksubfexit = .true.
311 case (
'DEV_DUMP_EVENT_TRACE')
312 this%dump_event_trace = .true.
315 param_found = .false.
319 if (.not. param_found)
then
320 do ipos = 1,
size(this%ocds)
321 ocdobjptr => this%ocds(ipos)
322 if (keyword == trim(ocdobjptr%cname))
then
327 if (.not. param_found)
then
328 errmsg =
"UNKNOWN OC OPTION '"//trim(keyword)//
"'."
330 call this%parser%StoreErrorUnit()
332 call this%parser%GetRemainingLine(line)
333 call ocdobjptr%set_option(line, this%parser%iuactive, this%iout)
338 if (.not. event_found)
then
339 this%trackrelease = .true.
340 this%trackfeatexit = .true.
341 this%tracktimestep = .true.
342 this%trackterminate = .true.
343 this%trackweaksink = .true.
344 this%trackusertime = .true.
348 write (this%iout,
'(1x,a)')
'END OF OC OPTIONS'
359 character(len=LINELENGTH) :: keyword
361 logical(LGP) :: isfound, endOfBlock
364 this%ntracktimes = -1
367 call this%parser%GetBlock(
'DIMENSIONS', isfound, ierr, &
368 supportopenclose=.true., &
369 blockrequired=.false.)
372 if (.not. isfound)
return
373 write (this%iout,
'(/1x,a)') &
374 'PROCESSING OUTPUT CONTROL DIMENSIONS'
376 call this%parser%GetNextLine(endofblock)
378 call this%parser%GetStringCaps(keyword)
379 select case (keyword)
381 this%ntracktimes = this%parser%GetInteger()
382 write (this%iout,
'(4x,a,i7)')
'NTRACKTIMES = ', this%ntracktimes
385 'UNKNOWN OUTPUT CONTROL DIMENSION: ', trim(keyword)
389 write (this%iout,
'(1x,a)') &
390 'END OF OUTPUT CONTROL DIMENSIONS'
392 if (this%ntracktimes < 0)
then
394 'NTRACKTIMES WAS NOT SPECIFIED OR WAS SPECIFIED INCORRECTLY.'
400 call this%parser%StoreErrorUnit()
409 integer(I4B) :: i, ierr
410 logical(LGP) :: eob, found, success
414 call this%parser%GetBlock(
'TRACKTIMES', found, ierr, &
415 supportopenclose=.true., &
416 blockrequired=.false.)
420 if (.not. found)
then
421 if (this%ntracktimes <= 0)
return
422 write (
errmsg,
'(a, i0)') &
423 "Expected TRACKTIMES with length ", this%ntracktimes
425 call this%parser%StoreErrorUnit(terminate=.true.)
429 call this%tracktimes%expand(this%ntracktimes)
432 write (this%iout,
'(/1x,a)') &
433 'PROCESSING OUTPUT CONTROL TRACKTIMES'
434 do i = 1, this%ntracktimes
435 call this%parser%GetNextLine(eob)
437 call this%parser%TryGetDouble(t, success)
438 if (.not. success)
then
439 errmsg =
"Failed to read double precision value"
441 call this%parser%StoreErrorUnit(terminate=.true.)
443 this%tracktimes%times(i) = t
447 if (.not. this%tracktimes%increasing())
then
448 errmsg =
"TRACKTIMES must strictly increase"
450 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.