41 integer(I4B),
pointer :: iper => null()
42 integer(I4B),
pointer :: ionper => null()
43 logical(LGP),
pointer :: hasperiodblocks => null()
59 subroutine input_load(filename, mf6_input, component_filename, iout, nc_vars)
61 character(len=*),
intent(in) :: filename
63 character(len=*),
intent(in) :: component_filename
64 integer(I4B),
intent(in) ::
iout
69 integer(I4B) :: inunit
71 if (
present(nc_vars))
then
72 netcdf_vars => nc_vars
82 call parser%Initialize(inunit,
iout)
85 call loader%load(parser, mf6_input, netcdf_vars, filename,
iout)
96 subroutine static_init(this, mf6_input, component_name, component_input_name, &
100 character(len=*),
intent(in) :: component_name
101 character(len=*),
intent(in) :: component_input_name
102 character(len=*),
intent(in) :: input_name
104 call this%StaticPkgLoadType%init(mf6_input, component_name, &
105 component_input_name, input_name)
112 integer(I4B),
intent(in) ::
iout
120 if (this%iperblock > 0)
then
122 allocate (mf6_loader)
124 mf6_loader%nc_vars => this%nc_vars
126 nullify (this%nc_vars)
128 call mf6_loader%init(this%mf6_input, this%component_name, &
129 this%component_input_name, this%input_name, &
130 this%iperblock,
iout)
132 rp_loader => mf6_loader
135 call input_load(this%input_name, this%mf6_input, &
136 this%component_input_name,
iout, this%nc_vars)
145 call this%StaticPkgLoadType%destroy()
150 subroutine dynamic_init(this, mf6_input, component_name, component_input_name, &
151 input_name, iperblock, iout)
156 character(len=*),
intent(in) :: component_name
157 character(len=*),
intent(in) :: component_input_name
158 character(len=*),
intent(in) :: input_name
159 integer(I4B),
intent(in) :: iperblock
160 integer(I4B),
intent(in) :: iout
161 integer(I4B) :: inunit
164 call this%DynamicPkgLoadType%init(mf6_input, component_name, &
165 component_input_name, input_name, &
169 call mem_allocate(this%ionper,
'IONPER', mf6_input%mempath)
170 call mem_allocate(this%hasperiodblocks,
'HASPERIODBLOCKS', &
176 this%hasperiodblocks = .false.
180 component_input_name, iout)
183 allocate (this%parser)
184 call this%parser%Initialize(inunit, iout)
187 call this%create_loader()
195 call this%rp_loader%df()
197 call this%read_ionper()
205 call this%rp_loader%ts_advance()
215 if (this%ionper /=
kper)
return
218 call this%rp_loader%rp(this%parser)
225 call this%read_ionper()
227 this%ionper =
nper + 1
236 character(len=LINELENGTH) :: line
237 logical(LGP) :: isblockfound
239 character(len=*),
parameter :: fmtblkerr = &
240 &
"('Looking for BEGIN PERIOD iper. Found ', a, ' instead.')"
242 call this%parser%GetBlock(
'PERIOD', isblockfound, ierr, &
243 supportopenclose=.true., &
244 blockrequired=.false.)
246 if (isblockfound)
then
252 this%hasperiodblocks = .true.
253 this%ionper = this%parser%GetInteger()
254 if (this%ionper <= this%iper)
then
255 write (
errmsg,
'(a, i0, a, i0, a, i0, a)') &
256 'Error in stress period ',
kper, &
257 '. Period numbers not increasing. Found ', this%ionper, &
258 ' but last period block was assigned ', this%iper,
'.'
260 call this%parser%StoreErrorUnit()
266 this%ionper =
nper + 1
269 call this%parser%GetCurrentLine(line)
270 write (
errmsg, fmtblkerr) adjustl(trim(line))
272 call this%parser%StoreErrorUnit()
295 if (this%mf6_input%subcomponent_type ==
'STO')
then
296 allocate (sto_loader)
297 this%rp_loader => sto_loader
298 else if (this%mf6_input%subcomponent_type ==
'OC' .or. &
299 this%mf6_input%subcomponent_type ==
'PRP')
then
300 allocate (setting_loader)
301 this%rp_loader => setting_loader
302 else if (this%has_keystring)
then
303 allocate (keystring_loader)
304 this%rp_loader => keystring_loader
305 else if (this%readasarrays)
then
306 allocate (arrlayer_loader)
307 this%rp_loader => arrlayer_loader
308 else if (this%readarraygrid)
then
309 allocate (arrgrid_loader)
310 this%rp_loader => arrgrid_loader
312 allocate (list_loader)
313 this%rp_loader => list_loader
317 this%rp_loader%nc_vars => this%nc_vars
320 call this%rp_loader%ainit(this%mf6_input, &
321 this%component_name, &
322 this%component_input_name, &
341 nullify (this%rp_loader%nc_vars)
342 call this%rp_loader%destroy()
343 deallocate (this%rp_loader)
346 call this%parser%clear()
347 deallocate (this%parser)
350 call this%DynamicPkgLoadType%destroy()
355 function open_mf6file(filetype, filename, component_fname, iout)
result(inunit)
357 character(len=*),
intent(in) :: filetype
358 character(len=*),
intent(in) :: filename
359 character(len=*),
intent(in) :: component_fname
360 integer(I4B),
intent(in) ::
iout
361 integer(I4B) :: inunit
366 if (filename /=
'')
then
369 call openfile(inunit,
iout, trim(adjustl(filename)), filetype, &
370 'FORMATTED',
'SEQUENTIAL',
'OLD')
372 write (
errmsg,
'(a,a,a)') &
373 'File unspecified, cannot load model or package &
374 &type "', trim(filetype),
'".'
This module contains block parser methods.
integer(i4b) function getunit(this)
Get the unit number.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
This module contains the GridArrayLoadModule.
This module contains the IdmMf6FileModule.
integer(i4b) function, public open_mf6file(filetype, filename, component_fname, iout)
open a model package files
subroutine dynamic_create_loader(this)
allocate a dynamic loader based on load context
subroutine, public input_load(filename, mf6_input, component_filename, iout, nc_vars)
input load for traditional mf6 simulation static input file
subroutine dynamic_rp(this)
read and prepare routine for dynamic loader
subroutine dynamic_read_ionper(this)
dynamic loader read ionper of next period block
class(dynamicpkgloadbasetype) function, pointer static_load(this, iout)
load routine for static loader
This module defines variable data types.
This module contains the LayerArrayLoadModule.
This module contains the ListLoadModule.
This module contains the LoadMf6FileModule.
Period block keystring-based input loader.
This module contains the Mf6FileSettingLoadModule.
This module contains the NCFileVarsModule.
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) iout
file unit number for simulation output
integer(i4b), pointer, public kper
current stress period number
integer(i4b), pointer, public nper
number of stress period
Ascii grid based dynamic loader type.
MF6File dynamic loader type.
MF6File static loader type.
Ascii array layer dynamic loader type.
list input loader for dynamic packages.
Static parser based input loader.
Keystring period block loader.
Type describing input variables for a package in NetCDF file.