30 character(len=LENCOMPONENTNAME),
dimension(:),
allocatable :: pkgtypes
31 character(len=LENCOMPONENTNAME),
dimension(:),
allocatable :: component_types
32 character(len=LENCOMPONENTNAME),
dimension(:), &
33 allocatable :: subcomponent_types
34 character(len=LINELENGTH),
dimension(:),
allocatable :: filenames
35 character(len=LENMEMPATH) :: mempath
36 character(len=LENCOMPONENTNAME) :: component_name
52 character(len=LENCOMPONENTNAME) :: component_name
53 character(len=LINELENGTH) :: component_input_name
54 character(len=LINELENGTH) :: input_name
55 integer(I4B) :: iperblock
81 character(len=LENCOMPONENTNAME) :: component_name
82 character(len=LINELENGTH) :: component_input_name
83 character(len=LINELENGTH) :: input_name
84 character(len=LINELENGTH),
dimension(:),
allocatable :: param_names
85 logical(LGP) :: readasarrays
86 logical(LGP) :: readarraygrid
87 logical(LGP) :: has_setting
88 integer(I4B) :: iperblock
90 integer(I4B) :: nparam
111 function load_if(this, iout)
result(dynamic_loader)
114 integer(I4B),
intent(in) :: iout
130 character(len=LENCOMPONENTNAME) :: modeltype
131 character(len=LENMODELNAME) :: modelname
132 character(len=LINELENGTH) :: modelfname
134 character(len=LINELENGTH) :: nc_fname
156 character(len=*),
intent(in) :: mempath
157 character(len=*),
intent(in) :: component_name
161 this%mempath = mempath
162 this%component_name = component_name
165 allocate (this%pkgtypes(0))
166 allocate (this%component_types(0))
167 allocate (this%subcomponent_types(0))
168 allocate (this%filenames(0))
173 subroutine subpkg_add(this, pkgtype, component_type, subcomponent_type, &
180 character(len=*),
intent(in) :: pkgtype
181 character(len=*),
intent(in) :: component_type
182 character(len=*),
intent(in) :: subcomponent_type
183 character(len=*),
intent(in) :: tagname
184 character(len=*),
intent(in) :: filename
185 character(len=LENVARNAME) :: mempath_tag
186 character(len=LENMEMPATH),
pointer :: subpkg_mempath
187 character(len=LINELENGTH),
pointer :: input_fname
188 integer(I4B) :: idx, trimlen
197 this%pnum = this%pnum + 1
198 this%pkgtypes(this%pnum) = pkgtype
199 this%component_types(this%pnum) = component_type
200 this%subcomponent_types(this%pnum) = subcomponent_type
201 this%filenames(this%pnum) = filename
204 mempath_tag = tagname
205 trimlen = len_trim(tagname)
209 idx = index(tagname,
'_')
211 if (tagname(idx + 1:trimlen) ==
'FILENAME')
then
212 write (mempath_tag,
'(a)') tagname(1:idx)//
'MEMPATH'
227 input_fname = filename
235 deallocate (this%pkgtypes)
236 deallocate (this%component_types)
237 deallocate (this%subcomponent_types)
238 deallocate (this%filenames)
244 subroutine static_init(this, mf6_input, component_name, component_input_name, &
248 character(len=*),
intent(in) :: component_name
249 character(len=*),
intent(in) :: component_input_name
250 character(len=*),
intent(in) :: input_name
251 integer(I4B) :: iblock
253 this%mf6_input = mf6_input
254 this%component_name = component_name
255 this%component_input_name = component_input_name
256 this%input_name = input_name
260 call this%subpkg_list%create(this%mf6_input%mempath, &
261 this%mf6_input%component_name)
264 do iblock = 1,
size(mf6_input%block_dfns)
265 if (mf6_input%block_dfns(iblock)%blockname ==
'PERIOD')
then
266 this%iperblock = iblock
280 character(len=16),
dimension(:),
pointer :: subpkgs
281 character(len=LINELENGTH) :: tag, fname, pkgtype
282 character(len=LENFTYPE) :: c_type, sc_type
283 character(len=16) :: subpkg
284 integer(I4B) :: idx, n
288 this%mf6_input%subcomponent_type)
291 do n = 1,
size(subpkgs)
293 idx = index(subpkg,
'-')
297 c_type = subpkg(1:idx - 1)
298 sc_type = subpkg(idx + 1:len_trim(subpkg))
301 pkgtype = trim(sc_type)//
'6'
302 tag = trim(pkgtype)//
'_FILENAME'
305 errmsg =
'Multi-instance subpackages not supported. Remove dfn &
306 &subpackage tagline for package "'//trim(subpkg)//
'".'
311 this%input_name))
then
312 call this%subpkg_list%add(pkgtype, c_type, sc_type, &
313 trim(tag), trim(fname))
317 errmsg =
'Identified subpackage is not IDM integrated. Remove dfn &
318 &subpackage tagline for package "'//trim(subpkg)//
'".'
328 call this%subpkg_list%destroy()
329 if (
associated(this%nc_vars))
then
330 call this%nc_vars%destroy()
331 deallocate (this%nc_vars)
332 nullify (this%nc_vars)
342 subroutine dynamic_init(this, mf6_input, component_name, component_input_name, &
343 input_name, iperblock, iout)
349 character(len=*),
intent(in) :: component_name
350 character(len=*),
intent(in) :: component_input_name
351 character(len=*),
intent(in) :: input_name
352 integer(I4B),
intent(in) :: iperblock
353 integer(I4B),
intent(in) :: iout
355 integer(I4B) :: iparam, ilen
357 this%mf6_input = mf6_input
358 this%component_name = component_name
359 this%component_input_name = component_input_name
360 this%input_name = input_name
361 this%readasarrays = .false.
362 this%readarraygrid = .false.
363 this%has_setting = .false.
364 this%iperblock = iperblock
370 if (this%iperblock == 0)
then
372 'Programming error. (IDM) PERIOD block not found in '&
373 &
'dynamic package input block dfns: ', &
374 trim(mf6_input%subcomponent_name)
380 if (mf6_input%block_dfns(iperblock)%aggregate)
then
383 do iparam = 1,
size(mf6_input%param_dfns)
384 idt => mf6_input%param_dfns(iparam)
385 if (idt%blockname ==
'OPTIONS')
then
386 select case (idt%tagname)
387 case (
'READASARRAYS')
388 this%readasarrays = .true.
389 case (
'READARRAYGRID')
390 this%readarraygrid = .true.
399 do iparam = 1,
size(mf6_input%param_dfns)
400 idt => mf6_input%param_dfns(iparam)
401 if (idt%blockname ==
'PERIOD')
then
403 ilen = len_trim(idt%tagname)
404 if (idt%tagname(ilen - 6:ilen) ==
'SETTING')
then
405 this%has_setting = .true.
438 if (
associated(this%nc_vars))
then
439 call this%nc_vars%destroy()
440 deallocate (this%nc_vars)
441 nullify (this%nc_vars)
446 this%mf6_input%subcomponent_name, &
456 character(len=*),
intent(in) :: modeltype
457 character(len=*),
intent(in) :: modelname
458 character(len=*),
intent(in) :: modelfname
459 character(len=*),
intent(in) :: nc_fname
460 integer(I4B),
intent(in) :: ncid
461 integer(I4B),
intent(in) :: iout
462 this%modeltype = modeltype
463 this%modelname = modelname
464 this%modelfname = modelfname
465 this%nc_fname = nc_fname
476 class(*),
pointer :: obj
478 call this%pkglist%add(obj)
486 integer(I4B),
intent(in) :: idx
488 class(*),
pointer :: obj
490 obj => this%pkglist%GetItem(idx)
491 if (
associated(obj))
then
508 do n = 1, this%pkglist%Count()
509 dynamic_pkg => this%get(n)
510 call dynamic_pkg%rp()
522 do n = 1, this%pkglist%Count()
523 dynamic_pkg => this%get(n)
524 call dynamic_pkg%df()
535 do n = 1, this%pkglist%Count()
536 dynamic_pkg => this%get(n)
537 call dynamic_pkg%ad()
547 size = this%pkglist%Count()
558 do n = 1, this%pkglist%Count()
559 dynamic_pkg => this%get(n)
560 call dynamic_pkg%destroy()
561 deallocate (dynamic_pkg)
562 nullify (dynamic_pkg)
564 call this%pkglist%Clear()
571 type(
listtype),
intent(inout) :: list
573 class(*),
pointer :: obj
582 type(
listtype),
intent(inout) :: list
583 integer(I4B),
intent(in) :: idx
585 class(*),
pointer :: obj
589 obj => list%GetItem(idx)
590 if (
associated(obj))
then
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lencomponentname
maximum length of a component name
integer(i4b), parameter lenmodelname
maximum length of the model name
integer(i4b), parameter lenvarname
maximum length of a variable name
integer(i4b), parameter lenftype
maximum length of a package type (DIS, WEL, OC, etc.)
integer(i4b), parameter lenmempath
maximum length of the memory path
This module contains the DefinitionSelectModule.
character(len=linelength) function, public idt_datatype(idt)
return input definition type datatype
logical function, public idm_integrated(component, subcomponent)
logical function, public idm_multi_package(component, subcomponent)
character(len=16) function, dimension(:), pointer, public idm_subpackages(component, subcomponent)
This module contains the Input Data Model Logger Module.
subroutine, public idm_log_period_header(component, iout)
@ brief log a dynamic header message
subroutine, public idm_log_period_close(iout)
@ brief log the period closing message
This module defines variable data types.
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
subroutine, public memorystore_remove(component, subcomponent, context)
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
character(len=linelength) idm_context
This module contains the SourceCommonModule.
logical(lgp) function, public filein_fname(filename, tagname, input_mempath, input_fname)
enforce and set a single input filename provided via FILEIN keyword
A generic heterogeneous doubly-linked list.
Type describing input variables for a package in NetCDF file.