26 character(len=LENMEMPATH) :: memorypath
27 character(len=LENMODELNAME),
pointer :: name_model => null()
28 integer(I4B),
pointer :: inunit => null()
29 integer(I4B),
pointer :: iout => null()
30 integer(I4B),
pointer :: ibudcsv => null()
31 integer(I4B),
pointer :: iperoc => null()
32 integer(I4B),
pointer :: iocrep => null()
34 pointer,
contiguous :: ocdobj => null()
57 subroutine oc_cr(ocobj, name_model, inunit, iout)
60 character(len=*),
intent(in) :: name_model
61 integer(I4B),
intent(in) :: inunit
62 integer(I4B),
intent(in) :: iout
68 call ocobj%allocate_scalars(name_model)
75 call ocobj%parser%Initialize(inunit, iout)
107 integer(I4B) :: ierr, ival, ipos
108 logical :: isfound, found, endOfBlock
109 character(len=:),
allocatable :: line
110 character(len=LINELENGTH) :: ermsg, keyword1, keyword2
111 character(len=LINELENGTH) :: printsave
114 character(len=*),
parameter :: fmtboc = &
115 &
"(1X,/1X,'BEGIN READING OUTPUT CONTROL FOR STRESS PERIOD ',I0)"
116 character(len=*),
parameter :: fmteoc = &
117 &
"(/,1X,'END READING OUTPUT CONTROL FOR STRESS PERIOD ',I0)"
118 character(len=*),
parameter :: fmterr = &
119 &
"(' ERROR READING OUTPUT CONTROL PERIOD BLOCK: ')"
120 character(len=*),
parameter :: fmtroc = &
121 "(1X,/1X,'OUTPUT CONTROL FOR STRESS PERIOD ',I0, &
122 &' IS REPEATED USING SETTINGS FROM A PREVIOUS STRESS PERIOD.')"
123 character(len=*),
parameter :: fmtpererr = &
124 &
"(1x,'CURRENT STRESS PERIOD GREATER THAN PERIOD IN OUTPUT CONTROL.')"
125 character(len=*),
parameter :: fmtpererr2 = &
126 &
"(1x,'CURRENT STRESS PERIOD: ',I0,' SPECIFIED STRESS PERIOD: ',I0)"
129 if (this%iperoc <
kper)
then
132 call this%parser%GetBlock(
'PERIOD', isfound, ierr, &
133 supportopenclose=.true., &
134 blockrequired=.false.)
138 this%iperoc =
nper + 1
139 write (this%iout,
'(/,1x,a)')
'END OF FILE DETECTED IN OUTPUT CONTROL.'
140 write (this%iout,
'(1x,a)')
'CURRENT OUTPUT CONTROL SETTINGS WILL BE '
141 write (this%iout,
'(1x,a)')
'REPEATED UNTIL THE END OF THE SIMULATION.'
145 ival = this%parser%GetInteger()
148 if (ival <= 0 .or. ival >
nper)
then
149 write (ermsg,
'(a,i0)')
'PERIOD NOT VALID IN OUTPUT CONTROL: ', ival
151 write (ermsg,
'(a, a)')
'LINE: ', trim(adjustl(line))
156 if (ival <
kper)
then
157 write (ermsg, fmtpererr)
159 write (ermsg, fmtpererr2)
kper, ival
161 write (ermsg,
'(a, a)')
'LINE: ', trim(adjustl(line))
167 call this%parser%StoreErrorUnit()
174 if (this%iperoc ==
kper)
then
177 do ipos = 1,
size(this%ocdobj)
178 ocdobjptr => this%ocdobj(ipos)
179 call ocdobjptr%psmobj%init()
183 write (this%iout, fmtboc) this%iperoc
189 call this%parser%GetNextLine(endofblock)
191 call this%parser%GetStringCaps(keyword1)
196 call this%parser%GetStringCaps(keyword2)
202 do ipos = 1,
size(this%ocdobj)
203 ocdobjptr => this%ocdobj(ipos)
204 if (keyword2 == trim(ocdobjptr%cname))
then
209 if (.not. found)
then
210 call this%parser%GetCurrentLine(line)
211 write (ermsg, fmterr)
213 call store_error(
'UNRECOGNIZED KEYWORD: '//keyword2)
215 call this%parser%StoreErrorUnit()
217 call this%parser%GetRemainingLine(line)
218 call ocdobjptr%psmobj%rp(trim(printsave)//
' '//line, &
220 call ocdobjptr%ocd_rp_check(this%parser%iuactive)
224 write (this%iout, fmteoc) this%iperoc
229 write (this%iout, fmtroc)
kper
247 integer(I4B),
intent(inout) :: ipflg
256 do ipos = 1,
size(this%ocdobj)
257 ocdobjptr => this%ocdobj(ipos)
278 do i = 1,
size(this%ocdobj)
279 call this%ocdobj(i)%ocd_da()
281 deallocate (this%ocdobj)
283 deallocate (this%name_model)
305 character(len=*),
intent(in) :: name_model
309 allocate (this%name_model)
310 call mem_allocate(this%inunit,
'INUNIT', this%memoryPath)
312 call mem_allocate(this%ibudcsv,
'IBUDCSV', this%memoryPath)
313 call mem_allocate(this%iperoc,
'IPEROC', this%memoryPath)
314 call mem_allocate(this%iocrep,
'IOCREP', this%memoryPath)
316 this%name_model = name_model
339 character(len=LINELENGTH) :: keyword
340 character(len=LINELENGTH) :: keyword2
341 character(len=LINELENGTH) :: fname
342 character(len=:),
allocatable :: line
345 logical :: isfound, found, endOfBlock
349 call this%parser%GetBlock(
'OPTIONS', isfound, ierr, &
350 supportopenclose=.true., blockrequired=.false.)
354 write (this%iout,
'(/,1x,a,/)')
'PROCESSING OC OPTIONS'
356 call this%parser%GetNextLine(endofblock)
358 call this%parser%GetStringCaps(keyword)
360 if (keyword ==
'BUDGETCSV')
then
361 call this%parser%GetStringCaps(keyword2)
362 if (keyword2 /=
'FILEOUT')
then
363 errmsg =
"BUDGETCSV must be followed by FILEOUT and then budget &
364 &csv file name. Found '"//trim(keyword2)//
"'."
366 call this%parser%StoreErrorUnit()
368 call this%parser%GetString(fname)
370 call openfile(this%ibudcsv, this%iout, fname,
'CSV', &
371 filstat_opt=
'REPLACE')
375 if (.not. found)
then
376 do ipos = 1,
size(this%ocdobj)
377 ocdobjptr => this%ocdobj(ipos)
378 if (keyword == trim(ocdobjptr%cname))
then
383 if (.not. found)
then
384 errmsg =
"UNKNOWN OC OPTION '"//trim(keyword)//
"'."
386 call this%parser%StoreErrorUnit()
388 call this%parser%GetRemainingLine(line)
389 call ocdobjptr%set_option(line, this%parser%iuactive, this%iout)
392 write (this%iout,
'(1x,a)')
'END OF OC OPTIONS'
409 character(len=*),
intent(in) :: cname
417 do ipos = 1,
size(this%ocdobj)
418 ocdobjptr => this%ocdobj(ipos)
419 if (cname == trim(ocdobjptr%cname))
then
442 character(len=*),
intent(in) :: cname
450 do ipos = 1,
size(this%ocdobj)
451 ocdobjptr => this%ocdobj(ipos)
452 if (cname == trim(ocdobjptr%cname))
then
476 character(len=*),
intent(in) :: cname
484 do ipos = 1,
size(this%ocdobj)
485 ocdobjptr => this%ocdobj(ipos)
486 if (cname == trim(ocdobjptr%cname))
then
508 integer(I4B) :: iprint_flag
511 character(len=*),
intent(in) :: cname
512 integer(I4B),
intent(in) :: icnvg
513 logical,
intent(in) :: endofperiod
520 if (this%oc_print(cname)) iprint_flag = 1
524 if (icnvg == 0) iprint_flag = 1
528 if (endofperiod) iprint_flag = 1
This module contains block parser methods.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lenmodelname
maximum length of the model name
integer(i4b), parameter lenmempath
maximum length of the memory path
This module defines variable data types.
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
This module contains the OutputControlDataModule.
subroutine, public ocd_cr(ocdobj)
@ brief Create OutputControlDataType
This module contains the OutputControlModule.
subroutine oc_rp(this)
@ brief Read and prepare OutputControlType
logical function oc_save(this, cname)
@ brief Save data to file
logical function oc_print(this, cname)
@ brief Determine if time to print
subroutine oc_df(this)
@ brief Define OutputControlType
integer(i4b) function set_print_flag(this, cname, icnvg, endofperiod)
@ brief Set the print flag
integer(i4b) function oc_save_unit(this, cname)
@ brief Determine unit number for saving
subroutine oc_ot(this, ipflg)
@ brief Output method for OutputControlType
subroutine allocate_scalars(this, name_model)
@ brief Allocate scalars method for OutputControlType
subroutine read_options(this)
@ brief Read options for OutputControlType
subroutine, public oc_cr(ocobj, name_model, inunit, iout)
@ brief Create OutputControlType
subroutine oc_da(this)
@ brief Deallocate method for OutputControlType
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
integer(i4b) isimcontinue
simulation continue flag (1) to continue if isimcnvg = 0, (0) to terminate
logical(lgp), pointer, public endofperiod
flag indicating end of stress period
integer(i4b), pointer, public kstp
current time step number
integer(i4b), pointer, public kper
current stress period number
integer(i4b), pointer, public nper
number of stress period
@ brief OutputControlDataType
@ brief OutputControlType