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 integer(I4B) :: iperblock
88 integer(I4B) :: nparam
109 function load_if(this, iout)
result(dynamic_loader)
112 integer(I4B),
intent(in) :: iout
128 character(len=LENCOMPONENTNAME) :: modeltype
129 character(len=LENMODELNAME) :: modelname
130 character(len=LINELENGTH) :: modelfname
132 character(len=LINELENGTH) :: nc_fname
154 character(len=*),
intent(in) :: mempath
155 character(len=*),
intent(in) :: component_name
159 this%mempath = mempath
160 this%component_name = component_name
163 allocate (this%pkgtypes(0))
164 allocate (this%component_types(0))
165 allocate (this%subcomponent_types(0))
166 allocate (this%filenames(0))
171 subroutine subpkg_add(this, pkgtype, component_type, subcomponent_type, &
178 character(len=*),
intent(in) :: pkgtype
179 character(len=*),
intent(in) :: component_type
180 character(len=*),
intent(in) :: subcomponent_type
181 character(len=*),
intent(in) :: tagname
182 character(len=*),
intent(in) :: filename
183 character(len=LENVARNAME) :: mempath_tag
184 character(len=LENMEMPATH),
pointer :: subpkg_mempath
185 character(len=LINELENGTH),
pointer :: input_fname
186 integer(I4B) :: idx, trimlen
195 this%pnum = this%pnum + 1
196 this%pkgtypes(this%pnum) = pkgtype
197 this%component_types(this%pnum) = component_type
198 this%subcomponent_types(this%pnum) = subcomponent_type
199 this%filenames(this%pnum) = filename
202 mempath_tag = tagname
203 trimlen = len_trim(tagname)
207 idx = index(tagname,
'_')
209 if (tagname(idx + 1:trimlen) ==
'FILENAME')
then
210 write (mempath_tag,
'(a)') tagname(1:idx)//
'MEMPATH'
225 input_fname = filename
233 deallocate (this%pkgtypes)
234 deallocate (this%component_types)
235 deallocate (this%subcomponent_types)
236 deallocate (this%filenames)
242 subroutine static_init(this, mf6_input, component_name, component_input_name, &
246 character(len=*),
intent(in) :: component_name
247 character(len=*),
intent(in) :: component_input_name
248 character(len=*),
intent(in) :: input_name
249 integer(I4B) :: iblock
251 this%mf6_input = mf6_input
252 this%component_name = component_name
253 this%component_input_name = component_input_name
254 this%input_name = input_name
258 call this%subpkg_list%create(this%mf6_input%mempath, &
259 this%mf6_input%component_name)
262 do iblock = 1,
size(mf6_input%block_dfns)
263 if (mf6_input%block_dfns(iblock)%blockname ==
'PERIOD')
then
264 this%iperblock = iblock
278 character(len=16),
dimension(:),
pointer :: subpkgs
279 character(len=LINELENGTH) :: tag, fname, pkgtype
280 character(len=LENFTYPE) :: c_type, sc_type
281 character(len=16) :: subpkg
282 integer(I4B) :: idx, n
286 this%mf6_input%subcomponent_type)
289 do n = 1,
size(subpkgs)
291 idx = index(subpkg,
'-')
295 c_type = subpkg(1:idx - 1)
296 sc_type = subpkg(idx + 1:len_trim(subpkg))
299 pkgtype = trim(sc_type)//
'6'
300 tag = trim(pkgtype)//
'_FILENAME'
303 errmsg =
'Multi-instance subpackages not supported. Remove dfn &
304 &subpackage tagline for package "'//trim(subpkg)//
'".'
309 this%input_name))
then
310 call this%subpkg_list%add(pkgtype, c_type, sc_type, &
311 trim(tag), trim(fname))
315 errmsg =
'Identified subpackage is not IDM integrated. Remove dfn &
316 &subpackage tagline for package "'//trim(subpkg)//
'".'
326 call this%subpkg_list%destroy()
327 if (
associated(this%nc_vars))
then
328 call this%nc_vars%destroy()
329 deallocate (this%nc_vars)
330 nullify (this%nc_vars)
340 subroutine dynamic_init(this, mf6_input, component_name, component_input_name, &
341 input_name, iperblock, iout)
346 character(len=*),
intent(in) :: component_name
347 character(len=*),
intent(in) :: component_input_name
348 character(len=*),
intent(in) :: input_name
349 integer(I4B),
intent(in) :: iperblock
350 integer(I4B),
intent(in) :: iout
353 this%mf6_input = mf6_input
354 this%component_name = component_name
355 this%component_input_name = component_input_name
356 this%input_name = input_name
357 this%iperblock = iperblock
363 if (this%iperblock == 0)
then
365 'Programming error. (IDM) PERIOD block not found in '&
366 &
'dynamic package input block dfns: ', &
367 trim(mf6_input%subcomponent_name)
373 this%readasarrays = (.not. mf6_input%block_dfns(iperblock)%aggregate)
402 if (
associated(this%nc_vars))
then
403 call this%nc_vars%destroy()
404 deallocate (this%nc_vars)
405 nullify (this%nc_vars)
410 this%mf6_input%subcomponent_name, &
420 character(len=*),
intent(in) :: modeltype
421 character(len=*),
intent(in) :: modelname
422 character(len=*),
intent(in) :: modelfname
423 character(len=*),
intent(in) :: nc_fname
424 integer(I4B),
intent(in) :: ncid
425 integer(I4B),
intent(in) :: iout
426 this%modeltype = modeltype
427 this%modelname = modelname
428 this%modelfname = modelfname
429 this%nc_fname = nc_fname
440 class(*),
pointer :: obj
442 call this%pkglist%add(obj)
450 integer(I4B),
intent(in) :: idx
452 class(*),
pointer :: obj
454 obj => this%pkglist%GetItem(idx)
455 if (
associated(obj))
then
472 do n = 1, this%pkglist%Count()
473 dynamic_pkg => this%get(n)
474 call dynamic_pkg%rp()
486 do n = 1, this%pkglist%Count()
487 dynamic_pkg => this%get(n)
488 call dynamic_pkg%df()
499 do n = 1, this%pkglist%Count()
500 dynamic_pkg => this%get(n)
501 call dynamic_pkg%ad()
511 size = this%pkglist%Count()
522 do n = 1, this%pkglist%Count()
523 dynamic_pkg => this%get(n)
524 call dynamic_pkg%destroy()
525 deallocate (dynamic_pkg)
526 nullify (dynamic_pkg)
528 call this%pkglist%Clear()
535 type(
listtype),
intent(inout) :: list
537 class(*),
pointer :: obj
546 type(
listtype),
intent(inout) :: list
547 integer(I4B),
intent(in) :: idx
549 class(*),
pointer :: obj
553 obj => list%GetItem(idx)
554 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
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.