24 integer(I4B),
pointer :: itrkout => null()
25 integer(I4B),
pointer :: itrkhdr => null()
26 integer(I4B),
pointer :: itrkcsv => null()
27 integer(I4B),
pointer :: itrktls => null()
28 logical(LGP),
pointer :: trackrelease => null()
29 logical(LGP),
pointer :: trackexit => null()
30 logical(LGP),
pointer :: tracktimestep => null()
31 logical(LGP),
pointer :: trackterminate => null()
32 logical(LGP),
pointer :: trackweaksink => null()
33 logical(LGP),
pointer :: trackusertime => null()
34 integer(I4B),
pointer :: ntracktimes => null()
50 subroutine oc_cr(ocobj, name_model, inunit, iout)
52 character(len=*),
intent(in) :: name_model
53 integer(I4B),
intent(in) :: inunit
54 integer(I4B),
intent(in) :: iout
60 call ocobj%allocate_scalars(name_model)
67 call ocobj%parser%Initialize(inunit, iout)
72 character(len=*),
intent(in) :: name_model
76 allocate (this%name_model)
77 call mem_allocate(this%inunit,
'INUNIT', this%memoryPath)
79 call mem_allocate(this%ibudcsv,
'IBUDCSV', this%memoryPath)
80 call mem_allocate(this%iperoc,
'IPEROC', this%memoryPath)
81 call mem_allocate(this%iocrep,
'IOCREP', this%memoryPath)
82 call mem_allocate(this%itrkout,
'ITRKOUT', this%memoryPath)
83 call mem_allocate(this%itrkhdr,
'ITRKHDR', this%memoryPath)
84 call mem_allocate(this%itrkcsv,
'ITRKCSV', this%memoryPath)
85 call mem_allocate(this%itrktls,
'ITRKTLS', this%memoryPath)
86 call mem_allocate(this%trackrelease,
'ITRACKRLS', this%memoryPath)
87 call mem_allocate(this%trackexit,
'ITRACKTRS', this%memoryPath)
88 call mem_allocate(this%tracktimestep,
'ITRACKTST', this%memoryPath)
89 call mem_allocate(this%trackterminate,
'ITRACKTER', this%memoryPath)
90 call mem_allocate(this%trackweaksink,
'ITRACKWSK', this%memoryPath)
91 call mem_allocate(this%trackusertime,
'ITRACKTLS', this%memoryPath)
92 call mem_allocate(this%ntracktimes,
'NTRACKTIMES', this%memoryPath)
94 this%name_model = name_model
104 this%trackrelease = .false.
105 this%trackexit = .false.
106 this%tracktimestep = .false.
107 this%trackterminate = .false.
108 this%trackweaksink = .false.
109 this%trackusertime = .false.
115 subroutine oc_ar(this, dis, dnodata)
119 real(DP),
intent(in) :: dnodata
121 integer(I4B) :: i, nocdobj, inodata
123 real(DP),
dimension(:),
pointer,
contiguous :: nullvec => null()
126 allocate (this%tracktimes)
127 call this%tracktimes%init()
130 allocate (this%ocds(nocdobj))
135 call ocdobjptr%init_dbl(
'BUDGET', nullvec, dis,
'PRINT LAST ', &
136 'COLUMNS 10 WIDTH 11 DIGITS 4 GENERAL ', &
139 this%ocds(i) = ocdobjptr
140 deallocate (ocdobjptr)
145 if (this%inunit <= 0)
return
146 call this%read_options()
147 call this%prt_oc_read_dimensions()
148 call this%prt_oc_read_tracktimes()
158 call this%tracktimes%deallocate()
160 do i = 1,
size(this%ocds)
161 call this%ocds(i)%ocd_da()
163 deallocate (this%ocds)
165 deallocate (this%name_model)
196 character(len=LINELENGTH) :: keyword
197 character(len=LINELENGTH) :: keyword2
198 character(len=LINELENGTH) :: fname
199 character(len=:),
allocatable :: line
200 integer(I4B) :: ierr, ipos
201 logical(LGP) :: block_found, param_found, event_found, eob
204 character(len=*),
parameter :: fmttrkbin = &
205 "(4x, 'PARTICLE TRACKS WILL BE SAVED TO BINARY FILE: ', a, /4x, &
206 &'OPENED ON UNIT: ', I0)"
207 character(len=*),
parameter :: fmttrkcsv = &
208 "(4x, 'PARTICLE TRACKS WILL BE SAVED TO CSV FILE: ', a, /4x, &
209 &'OPENED ON UNIT: ', I0)"
212 call this%parser%GetBlock(
'OPTIONS', block_found, ierr, &
213 supportopenclose=.true., blockrequired=.false.)
216 if (block_found)
then
217 write (this%iout,
'(/,1x,a,/)')
'PROCESSING OC OPTIONS'
218 event_found = .false.
220 call this%parser%GetNextLine(eob)
222 call this%parser%GetStringCaps(keyword)
223 param_found = .false.
224 select case (keyword)
226 call this%parser%GetStringCaps(keyword2)
227 if (keyword2 /=
'FILEOUT')
then
228 errmsg =
"BUDGETCSV must be followed by FILEOUT and then budget &
229 &csv file name. Found '"//trim(keyword2)//
"'."
231 call this%parser%StoreErrorUnit()
233 call this%parser%GetString(fname)
235 call openfile(this%ibudcsv, this%iout, fname,
'CSV', &
236 filstat_opt=
'REPLACE')
239 call this%parser%GetStringCaps(keyword)
240 if (keyword ==
'FILEOUT')
then
242 call this%parser%GetString(fname)
245 call openfile(this%itrkout, this%iout, fname,
'DATA(BINARY)', &
248 write (this%iout, fmttrkbin) trim(adjustl(fname)), this%itrkout
251 fname = trim(fname)//
'.hdr'
252 call openfile(this%itrkhdr, this%iout, fname,
'CSV', &
253 filstat_opt=
'REPLACE', mode_opt=mnormal)
256 call store_error(
'OPTIONAL TRACK KEYWORD MUST BE '// &
257 'FOLLOWED BY FILEOUT')
261 call this%parser%GetStringCaps(keyword)
262 if (keyword ==
'FILEOUT')
then
264 call this%parser%GetString(fname)
267 call openfile(this%itrkcsv, this%iout, fname,
'CSV', &
268 filstat_opt=
'REPLACE')
269 write (this%iout, fmttrkcsv) trim(adjustl(fname)), this%itrkcsv
272 call store_error(
'OPTIONAL TRACKCSV KEYWORD MUST BE &
273 &FOLLOWED BY FILEOUT')
276 case (
'TRACK_RELEASE')
277 this%trackrelease = .true.
281 this%trackexit = .true.
284 case (
'TRACK_TIMESTEP')
285 this%tracktimestep = .true.
288 case (
'TRACK_TERMINATE')
289 this%trackterminate = .true.
292 case (
'TRACK_WEAKSINK')
293 this%trackweaksink = .true.
296 case (
'TRACK_USERTIME')
297 this%trackusertime = .true.
301 param_found = .false.
305 if (.not. param_found)
then
306 do ipos = 1,
size(this%ocds)
307 ocdobjptr => this%ocds(ipos)
308 if (keyword == trim(ocdobjptr%cname))
then
313 if (.not. param_found)
then
314 errmsg =
"UNKNOWN OC OPTION '"//trim(keyword)//
"'."
316 call this%parser%StoreErrorUnit()
318 call this%parser%GetRemainingLine(line)
319 call ocdobjptr%set_option(line, this%parser%iuactive, this%iout)
324 if (.not. event_found)
then
325 this%trackrelease = .true.
326 this%trackexit = .true.
327 this%tracktimestep = .true.
328 this%trackterminate = .true.
329 this%trackweaksink = .true.
330 this%trackusertime = .true.
334 write (this%iout,
'(1x,a)')
'END OF OC OPTIONS'
345 character(len=LINELENGTH) :: keyword
347 logical(LGP) :: isfound, endOfBlock
350 this%ntracktimes = -1
353 call this%parser%GetBlock(
'DIMENSIONS', isfound, ierr, &
354 supportopenclose=.true., &
355 blockrequired=.false.)
358 if (.not. isfound)
return
359 write (this%iout,
'(/1x,a)') &
360 'PROCESSING OUTPUT CONTROL DIMENSIONS'
362 call this%parser%GetNextLine(endofblock)
364 call this%parser%GetStringCaps(keyword)
365 select case (keyword)
367 this%ntracktimes = this%parser%GetInteger()
368 write (this%iout,
'(4x,a,i7)')
'NTRACKTIMES = ', this%ntracktimes
371 'UNKNOWN OUTPUT CONTROL DIMENSION: ', trim(keyword)
375 write (this%iout,
'(1x,a)') &
376 'END OF OUTPUT CONTROL DIMENSIONS'
378 if (this%ntracktimes < 0)
then
380 'NTRACKTIMES WAS NOT SPECIFIED OR WAS SPECIFIED INCORRECTLY.'
386 call this%parser%StoreErrorUnit()
395 integer(I4B) :: i, ierr
396 logical(LGP) :: eob, found, success
400 call this%parser%GetBlock(
'TRACKTIMES', found, ierr, &
401 supportopenclose=.true., &
402 blockrequired=.false.)
406 if (.not. found)
then
407 if (this%ntracktimes <= 0)
return
408 write (
errmsg,
'(a, i0)') &
409 "Expected TRACKTIMES with length ", this%ntracktimes
411 call this%parser%StoreErrorUnit(terminate=.true.)
415 call this%tracktimes%expand(this%ntracktimes)
418 write (this%iout,
'(/1x,a)') &
419 'PROCESSING OUTPUT CONTROL TRACKTIMES'
420 do i = 1, this%ntracktimes
421 call this%parser%GetNextLine(eob)
423 call this%parser%TryGetDouble(t, success)
424 if (.not. success)
then
425 errmsg =
"Failed to read double precision value"
427 call this%parser%StoreErrorUnit(terminate=.true.)
429 this%tracktimes%times(i) = t
433 if (.not. this%tracktimes%increasing())
then
434 errmsg =
"TRACKTIMES must strictly increase"
436 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.
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.
character(len= *), parameter, public trackheader
character(len= *), parameter, public trackdtypes
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.