16 character(len=LENMEMPATH) :: memorypath
17 character(len=LENMEMPATH) :: input_mempath
18 character(len=LENMODELNAME),
pointer :: name_model => null()
19 character(len=LINELENGTH),
pointer :: input_fname => null()
20 integer(I4B),
pointer :: inunit => null()
21 integer(I4B),
pointer ::
iout => null()
22 integer(I4B),
pointer :: ibudcsv => null()
23 integer(I4B),
pointer :: iperoc => null()
24 integer(I4B),
pointer :: iocrep => null()
43 subroutine oc_cr(oc, name_model, input_mempath, inunit, iout)
45 character(len=*),
intent(in) :: name_model
46 character(len=*),
intent(in) :: input_mempath
47 integer(I4B),
intent(in) :: inunit
48 integer(I4B),
intent(in) ::
iout
51 call oc%allocate_scalars(name_model, input_mempath)
72 integer(I4B),
pointer :: iper
74 pointer,
contiguous :: ocactions
76 pointer,
contiguous :: rtypes
78 pointer,
contiguous :: ocsettings
79 integer(I4B),
pointer :: nlist
80 integer(I4B) :: n, ipos
81 character(len=LINELENGTH) :: ocaction, rtype, ocsetting
82 logical(LGP) :: found_rtype
84 character(len=*),
parameter :: fmtboc = &
85 &
"(1X,/1X,'BEGIN READING OUTPUT CONTROL FOR STRESS PERIOD ',I0)"
86 character(len=*),
parameter :: fmteoc = &
87 &
"(/,1X,'END READING OUTPUT CONTROL FOR STRESS PERIOD ',I0)"
88 character(len=*),
parameter :: fmtroc = &
89 "(1X,/1X,'OUTPUT CONTROL FOR STRESS PERIOD ',I0, &
90 &' IS REPEATED USING SETTINGS FROM A PREVIOUS STRESS PERIOD.')"
92 if (this%input_mempath ==
'')
return
93 call mem_setptr(iper,
'IPER', this%input_mempath)
94 if (iper /=
kper)
then
96 write (this%iout, fmtroc)
kper
100 write (this%iout, fmtboc) this%iperoc
104 do ipos = 1,
size(this%ocds)
105 ocdobjptr => this%ocds(ipos)
106 call ocdobjptr%psm%init()
109 call mem_setptr(nlist,
'NBOUND', this%input_mempath)
110 call mem_setptr(ocactions,
'OCACTION', this%input_mempath)
111 call mem_setptr(rtypes,
'RTYPE', this%input_mempath)
112 call mem_setptr(ocsettings,
'SETTING', this%input_mempath)
115 ocaction = ocactions(n)
117 ocsetting = ocsettings(n)
119 found_rtype = .false.
120 do ipos = 1,
size(this%ocds)
121 ocdobjptr => this%ocds(ipos)
122 if (rtype == trim(ocdobjptr%cname))
then
124 call ocdobjptr%psm%set(ocaction, ocsetting, this%iout)
125 call ocdobjptr%ocd_rp_check(this%input_fname)
128 if (.not. found_rtype)
then
129 call store_error(
'Input OC period block rtype not found: "'// &
135 write (this%iout, fmteoc) this%iperoc
148 integer(I4B),
intent(inout) :: ipflg
157 do ipos = 1,
size(this%ocds)
158 ocdobjptr => this%ocds(ipos)
176 do i = 1,
size(this%ocds)
177 call this%ocds(i)%ocd_da()
179 deallocate (this%ocds)
181 deallocate (this%name_model)
182 deallocate (this%input_fname)
191 subroutine allocate (this, name_model, input_mempath)
198 character(len=*),
intent(in) :: name_model
199 character(len=*),
intent(in) :: input_mempath
200 logical(LGP) :: found
204 allocate (this%name_model)
205 allocate (this%input_fname)
206 call mem_allocate(this%inunit,
'INUNIT', this%memoryPath)
208 call mem_allocate(this%ibudcsv,
'IBUDCSV', this%memoryPath)
209 call mem_allocate(this%iperoc,
'IPEROC', this%memoryPath)
210 call mem_allocate(this%iocrep,
'IOCREP', this%memoryPath)
212 this%name_model = name_model
213 this%input_mempath = input_mempath
214 this%input_fname =
''
221 if (this%input_mempath /=
'')
then
223 this%input_mempath, found)
235 character(len=LINELENGTH) :: budgetfn, budgetcsv
236 character(len=LINELENGTH) :: prnfmt, print_format
237 logical(LGP) :: found_budcsv, found_budget
238 logical(LGP),
dimension(4) :: found_format
239 integer(I4B),
pointer :: columns, width, ndigits
242 found_format = .false.
255 call mem_set_value(budgetcsv,
'BUDGETCSVFILE', this%input_mempath, &
257 call mem_set_value(budgetfn,
'BUDGETFILE', this%input_mempath, &
260 if (found_budcsv)
then
262 call openfile(this%ibudcsv, this%iout, budgetcsv,
'CSV', &
263 filstat_opt=
'REPLACE')
266 if (found_budget)
then
267 call this%set_ocfile(
'BUDGET', budgetfn, this%iout)
270 if (any(found_format(1:3)) .and. .not. all(found_format(1:3)))
then
271 call store_error(
'PRINT_FORMAT must include COLUMNS, WIDTH and DIGITS. &
272 &Syntax is: COLUMNS <columns> WIDTH <width> &
273 &DIGITS <digits> [<format>].')
277 if (all(found_format))
then
278 write (print_format,
'(a,i0,a,i0,a,i0,a)')
'COLUMNS ', columns, &
279 ' WIDTH ', width,
' DIGITS ', ndigits,
' '//trim(prnfmt)//
' '
280 do ipos = 1,
size(this%ocds)
281 ocdobjptr => this%ocds(ipos)
282 if (ocdobjptr%cname /=
'BUDGET')
then
283 call ocdobjptr%set_prnfmt(print_format, 0)
298 character(len=*),
intent(in) :: cname
299 character(len=*),
intent(in) :: ocfile
300 integer(I4B),
intent(in) :: iout
303 logical(LGP) :: found
305 do ipos = 1,
size(this%ocds)
306 ocdobjptr => this%ocds(ipos)
307 if (cname == trim(ocdobjptr%cname))
then
309 call ocdobjptr%set_ocfile(ocfile, iout)
312 if (.not. found)
then
313 call store_error(
'OC internal error: oc data type not found for name "'// &
325 character(len=*),
intent(in) :: cname
328 logical(LGP) :: found
333 do ipos = 1,
size(this%ocds)
334 ocdobjptr => this%ocds(ipos)
335 if (cname == trim(ocdobjptr%cname))
then
351 character(len=*),
intent(in) :: cname
354 logical(LGP) :: found
359 do ipos = 1,
size(this%ocds)
360 ocdobjptr => this%ocds(ipos)
361 if (cname == trim(ocdobjptr%cname))
then
378 character(len=*),
intent(in) :: cname
381 logical(LGP) :: found
386 do ipos = 1,
size(this%ocds)
387 ocdobjptr => this%ocds(ipos)
388 if (cname == trim(ocdobjptr%cname))
then
403 integer(I4B) :: iprint_flag
406 character(len=*),
intent(in) :: cname
407 integer(I4B),
intent(in) :: icnvg
408 logical,
intent(in) :: endofperiod
415 if (this%oc_print(cname)) iprint_flag = 1
419 if (icnvg == 0) iprint_flag = 1
423 if (endofperiod) iprint_flag = 1
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
Output control data module.
subroutine, public ocd_cr(ocdobj)
Create a new output control data type.
subroutine allocate(this, name_model, input_mempath)
Allocate variables for the output control object.
subroutine source_options(this)
Read the output control options block.
subroutine set_ocfile(this, cname, ocfile, iout)
subroutine oc_rp(this)
Read period block options and prepare the output control type.
logical function oc_save(this, cname)
Determine if it is time to save.
logical function oc_print(this, cname)
Determine if it is time to print.
subroutine oc_df(this)
Define the output control type. Placeholder routine.
integer(i4b) function set_print_flag(this, cname, icnvg, endofperiod)
Set the print flag based on convergence and other parameters.
subroutine, public oc_cr(oc, name_model, input_mempath, inunit, iout)
Create a new output control object.
integer(i4b) function oc_save_unit(this, cname)
Determine unit number for saving.
subroutine oc_ot(this, ipflg)
Write output.
subroutine oc_da(this)
Deallocate method for OutputControlType.
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
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
integer(i4b) iout
file unit number for simulation output
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
This class is used to store a single deferred-length character string. It was designed to work in an ...
Output control data type.
Controls model output. Overridden for each model type.
subroutine allocate_scalars(this)
Allocate scalars.