41 integer(I4B),
pointer :: iper => null()
42 integer(I4B),
pointer :: ionper => null()
58 subroutine input_load(filename, mf6_input, component_filename, iout, nc_vars)
60 character(len=*),
intent(in) :: filename
62 character(len=*),
intent(in) :: component_filename
63 integer(I4B),
intent(in) :: iout
68 integer(I4B) :: inunit
70 if (
present(nc_vars))
then
71 netcdf_vars => nc_vars
77 inunit =
open_mf6file(mf6_input%pkgtype, filename, component_filename, iout)
81 call parser%Initialize(inunit, iout)
84 call loader%load(parser, mf6_input, netcdf_vars, filename, iout)
95 subroutine static_init(this, mf6_input, component_name, component_input_name, &
99 character(len=*),
intent(in) :: component_name
100 character(len=*),
intent(in) :: component_input_name
101 character(len=*),
intent(in) :: input_name
103 call this%StaticPkgLoadType%init(mf6_input, component_name, &
104 component_input_name, input_name)
111 integer(I4B),
intent(in) :: iout
119 if (this%iperblock > 0)
then
121 allocate (mf6_loader)
123 mf6_loader%nc_vars => this%nc_vars
125 nullify (this%nc_vars)
127 call mf6_loader%init(this%mf6_input, this%component_name, &
128 this%component_input_name, this%input_name, &
129 this%iperblock, iout)
131 rp_loader => mf6_loader
134 call input_load(this%input_name, this%mf6_input, &
135 this%component_input_name, iout, this%nc_vars)
144 call this%StaticPkgLoadType%destroy()
149 subroutine dynamic_init(this, mf6_input, component_name, component_input_name, &
150 input_name, iperblock, iout)
155 character(len=*),
intent(in) :: component_name
156 character(len=*),
intent(in) :: component_input_name
157 character(len=*),
intent(in) :: input_name
158 integer(I4B),
intent(in) :: iperblock
159 integer(I4B),
intent(in) :: iout
160 integer(I4B) :: inunit
163 call this%DynamicPkgLoadType%init(mf6_input, component_name, &
164 component_input_name, input_name, &
168 call mem_allocate(this%ionper,
'IONPER', mf6_input%mempath)
176 component_input_name, iout)
179 allocate (this%parser)
180 call this%parser%Initialize(inunit, iout)
183 call this%create_loader()
191 call this%rp_loader%df()
193 call this%read_ionper()
201 call this%rp_loader%ad()
211 if (this%ionper /=
kper)
return
214 call this%rp_loader%rp(this%parser)
221 call this%read_ionper()
223 this%ionper =
nper + 1
232 character(len=LINELENGTH) :: line
233 logical(LGP) :: isblockfound
235 character(len=*),
parameter :: fmtblkerr = &
236 &
"('Looking for BEGIN PERIOD iper. Found ', a, ' instead.')"
238 call this%parser%GetBlock(
'PERIOD', isblockfound, ierr, &
239 supportopenclose=.true., &
240 blockrequired=.false.)
242 if (isblockfound)
then
243 this%ionper = this%parser%GetInteger()
244 if (this%ionper <= this%iper)
then
245 write (
errmsg,
'(a, i0, a, i0, a, i0, a)') &
246 'Error in stress period ',
kper, &
247 '. Period numbers not increasing. Found ', this%ionper, &
248 ' but last period block was assigned ', this%iper,
'.'
250 call this%parser%StoreErrorUnit()
256 this%ionper =
nper + 1
259 call this%parser%GetCurrentLine(line)
260 write (
errmsg, fmtblkerr) adjustl(trim(line))
262 call this%parser%StoreErrorUnit()
284 if (this%mf6_input%subcomponent_type ==
'STO')
then
285 allocate (sto_loader)
286 this%rp_loader => sto_loader
287 else if (this%mf6_input%subcomponent_type ==
'PRP')
then
288 allocate (setting_loader)
289 this%rp_loader => setting_loader
290 else if (this%readasarrays)
then
291 allocate (arrlayer_loader)
292 this%rp_loader => arrlayer_loader
293 else if (this%readarraygrid)
then
294 call dev_feature(
'Input file "'//trim(this%input_name)// &
295 '" READARRAYGRID option is still under development, install the &
296 &nightly build or compile from source with IDEVELOPMODE = 1.', &
298 allocate (arrgrid_loader)
299 this%rp_loader => arrgrid_loader
301 allocate (list_loader)
302 this%rp_loader => list_loader
306 this%rp_loader%nc_vars => this%nc_vars
309 call this%rp_loader%ainit(this%mf6_input, &
310 this%component_name, &
311 this%component_input_name, &
329 nullify (this%rp_loader%nc_vars)
330 call this%rp_loader%destroy()
331 deallocate (this%rp_loader)
334 call this%parser%clear()
335 deallocate (this%parser)
338 call this%DynamicPkgLoadType%destroy()
343 function open_mf6file(filetype, filename, component_fname, iout)
result(inunit)
345 character(len=*),
intent(in) :: filetype
346 character(len=*),
intent(in) :: filename
347 character(len=*),
intent(in) :: component_fname
348 integer(I4B),
intent(in) :: iout
349 integer(I4B) :: inunit
354 if (filename /=
'')
then
357 call openfile(inunit, iout, trim(adjustl(filename)), filetype, &
358 'FORMATTED',
'SEQUENTIAL',
'OLD')
360 write (
errmsg,
'(a,a,a)') &
361 'File unspecified, cannot load model or package &
362 &type "', trim(filetype),
'".'
This module contains block parser methods.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
Disable development features in release mode.
subroutine, public dev_feature(errmsg, iunit)
Terminate if in release mode (guard development features)
This module contains the GridArrayLoadModule.
This module contains the IdmMf6FileModule.
subroutine dynamic_df(this)
define routine for dynamic loader
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 dynamic_destroy(this)
dynamic loader destroy
subroutine dynamic_init(this, mf6_input, component_name, component_input_name, input_name, iperblock, iout)
dynamic loader init
subroutine, public input_load(filename, mf6_input, component_filename, iout, nc_vars)
input load for traditional mf6 simulation static input file
subroutine dynamic_ad(this)
advance routine for dynamic loader
subroutine static_destroy(this)
static loader destroy
subroutine dynamic_rp(this)
read and prepare routine for dynamic loader
subroutine static_init(this, mf6_input, component_name, component_input_name, input_name)
static loader init
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.
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), 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.
Type describing input variables for a package in NetCDF file.