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 integer(I4B) :: iperblock
89 integer(I4B) :: nparam
110 function load_if(this, iout)
result(dynamic_loader)
113 integer(I4B),
intent(in) :: iout
129 character(len=LENCOMPONENTNAME) :: modeltype
130 character(len=LENMODELNAME) :: modelname
131 character(len=LINELENGTH) :: modelfname
133 character(len=LINELENGTH) :: nc_fname
155 character(len=*),
intent(in) :: mempath
156 character(len=*),
intent(in) :: component_name
160 this%mempath = mempath
161 this%component_name = component_name
164 allocate (this%pkgtypes(0))
165 allocate (this%component_types(0))
166 allocate (this%subcomponent_types(0))
167 allocate (this%filenames(0))
172 subroutine subpkg_add(this, pkgtype, component_type, subcomponent_type, &
179 character(len=*),
intent(in) :: pkgtype
180 character(len=*),
intent(in) :: component_type
181 character(len=*),
intent(in) :: subcomponent_type
182 character(len=*),
intent(in) :: tagname
183 character(len=*),
intent(in) :: filename
184 character(len=LENVARNAME) :: mempath_tag
185 character(len=LENMEMPATH),
pointer :: subpkg_mempath
186 character(len=LINELENGTH),
pointer :: input_fname
187 integer(I4B) :: idx, trimlen
196 this%pnum = this%pnum + 1
197 this%pkgtypes(this%pnum) = pkgtype
198 this%component_types(this%pnum) = component_type
199 this%subcomponent_types(this%pnum) = subcomponent_type
200 this%filenames(this%pnum) = filename
203 mempath_tag = tagname
204 trimlen = len_trim(tagname)
208 idx = index(tagname,
'_')
210 if (tagname(idx + 1:trimlen) ==
'FILENAME')
then
211 write (mempath_tag,
'(a)') tagname(1:idx)//
'MEMPATH'
226 input_fname = filename
234 deallocate (this%pkgtypes)
235 deallocate (this%component_types)
236 deallocate (this%subcomponent_types)
237 deallocate (this%filenames)
243 subroutine static_init(this, mf6_input, component_name, component_input_name, &
247 character(len=*),
intent(in) :: component_name
248 character(len=*),
intent(in) :: component_input_name
249 character(len=*),
intent(in) :: input_name
250 integer(I4B) :: iblock
252 this%mf6_input = mf6_input
253 this%component_name = component_name
254 this%component_input_name = component_input_name
255 this%input_name = input_name
259 call this%subpkg_list%create(this%mf6_input%mempath, &
260 this%mf6_input%component_name)
263 do iblock = 1,
size(mf6_input%block_dfns)
264 if (mf6_input%block_dfns(iblock)%blockname ==
'PERIOD')
then
265 this%iperblock = iblock
279 character(len=16),
dimension(:),
pointer :: subpkgs
280 character(len=LINELENGTH) :: tag, fname, pkgtype
281 character(len=LENFTYPE) :: c_type, sc_type
282 character(len=16) :: subpkg
283 integer(I4B) :: idx, n
287 this%mf6_input%subcomponent_type)
290 do n = 1,
size(subpkgs)
292 idx = index(subpkg,
'-')
296 c_type = subpkg(1:idx - 1)
297 sc_type = subpkg(idx + 1:len_trim(subpkg))
300 pkgtype = trim(sc_type)//
'6'
301 tag = trim(pkgtype)//
'_FILENAME'
304 errmsg =
'Multi-instance subpackages not supported. Remove dfn &
305 &subpackage tagline for package "'//trim(subpkg)//
'".'
310 this%input_name))
then
311 call this%subpkg_list%add(pkgtype, c_type, sc_type, &
312 trim(tag), trim(fname))
316 errmsg =
'Identified subpackage is not IDM integrated. Remove dfn &
317 &subpackage tagline for package "'//trim(subpkg)//
'".'
327 call this%subpkg_list%destroy()
328 if (
associated(this%nc_vars))
then
329 call this%nc_vars%destroy()
330 deallocate (this%nc_vars)
331 nullify (this%nc_vars)
341 subroutine dynamic_init(this, mf6_input, component_name, component_input_name, &
342 input_name, iperblock, iout)
347 character(len=*),
intent(in) :: component_name
348 character(len=*),
intent(in) :: component_input_name
349 character(len=*),
intent(in) :: input_name
350 integer(I4B),
intent(in) :: iperblock
351 integer(I4B),
intent(in) :: iout
353 integer(I4B) :: iparam
355 this%mf6_input = mf6_input
356 this%component_name = component_name
357 this%component_input_name = component_input_name
358 this%input_name = input_name
359 this%readasarrays = .false.
360 this%readarraygrid = .false.
361 this%iperblock = iperblock
367 if (this%iperblock == 0)
then
369 'Programming error. (IDM) PERIOD block not found in '&
370 &
'dynamic package input block dfns: ', &
371 trim(mf6_input%subcomponent_name)
377 if (mf6_input%block_dfns(iperblock)%aggregate)
then
380 do iparam = 1,
size(mf6_input%param_dfns)
381 idt => mf6_input%param_dfns(iparam)
382 if (idt%blockname ==
'OPTIONS')
then
383 select case (idt%tagname)
384 case (
'READASARRAYS')
385 this%readasarrays = .true.
386 case (
'READARRAYGRID')
387 this%readarraygrid = .true.
422 if (
associated(this%nc_vars))
then
423 call this%nc_vars%destroy()
424 deallocate (this%nc_vars)
425 nullify (this%nc_vars)
430 this%mf6_input%subcomponent_name, &
440 character(len=*),
intent(in) :: modeltype
441 character(len=*),
intent(in) :: modelname
442 character(len=*),
intent(in) :: modelfname
443 character(len=*),
intent(in) :: nc_fname
444 integer(I4B),
intent(in) :: ncid
445 integer(I4B),
intent(in) :: iout
446 this%modeltype = modeltype
447 this%modelname = modelname
448 this%modelfname = modelfname
449 this%nc_fname = nc_fname
460 class(*),
pointer :: obj
462 call this%pkglist%add(obj)
470 integer(I4B),
intent(in) :: idx
472 class(*),
pointer :: obj
474 obj => this%pkglist%GetItem(idx)
475 if (
associated(obj))
then
492 do n = 1, this%pkglist%Count()
493 dynamic_pkg => this%get(n)
494 call dynamic_pkg%rp()
506 do n = 1, this%pkglist%Count()
507 dynamic_pkg => this%get(n)
508 call dynamic_pkg%df()
519 do n = 1, this%pkglist%Count()
520 dynamic_pkg => this%get(n)
521 call dynamic_pkg%ad()
531 size = this%pkglist%Count()
542 do n = 1, this%pkglist%Count()
543 dynamic_pkg => this%get(n)
544 call dynamic_pkg%destroy()
545 deallocate (dynamic_pkg)
546 nullify (dynamic_pkg)
548 call this%pkglist%Clear()
555 type(
listtype),
intent(inout) :: list
557 class(*),
pointer :: obj
566 type(
listtype),
intent(inout) :: list
567 integer(I4B),
intent(in) :: idx
569 class(*),
pointer :: obj
573 obj => list%GetItem(idx)
574 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.