31 character(len=LENPACKAGETYPE) :: pkgtype
33 character(len=LENCOMPONENTNAME) :: subcomponent_type
35 character(len=LINELENGTH),
dimension(:),
allocatable :: filenames
36 character(len=LENPACKAGENAME),
dimension(:),
allocatable :: pkgnames
37 character(len=LENMEMPATH),
dimension(:),
allocatable :: mempaths
38 integer(I4B),
dimension(:),
allocatable :: inunits
55 character(len=LENPACKAGETYPE) :: modeltype
56 character(len=LINELENGTH) :: modelfname
57 character(len=LENMODELNAME) :: modelname
59 character(len=LENCOMPONENTNAME) :: component_type
61 character(len=LENMEMPATH) :: input_mempath
62 character(len=LENMEMPATH) :: model_mempath
65 pointer :: pkgtypes => null()
67 pointer :: pkgnames => null()
69 pointer :: mempaths => null()
70 integer(I4B),
dimension(:),
contiguous, &
71 pointer :: inunits => null()
75 integer(I4B) :: niunit
76 character(len=LENPACKAGETYPE),
dimension(:),
allocatable :: cunit
97 character(len=LENCOMPONENTNAME),
intent(in) :: mtype_component
98 character(len=LENCOMPONENTNAME),
intent(in) :: ptype_component
99 character(len=LENFTYPE),
intent(in) :: pkgtype
100 logical(LGP) :: multi_pkg
113 character(len=*),
intent(in) :: ctype
130 character(len=*),
intent(in) :: modeltype
131 character(len=*),
intent(in) :: modelname
132 character(len=*),
intent(in) :: pkgtype
135 this%pkgtype = pkgtype
140 allocate (this%filenames(0))
141 allocate (this%pkgnames(0))
142 allocate (this%mempaths(0))
143 allocate (this%inunits(0))
148 subroutine pkgtype_add(this, modelname, mtype_component, filetype, &
149 filename, pkgname, iout)
156 character(len=*),
intent(in) :: modelname
157 character(len=*),
intent(in) :: mtype_component
158 character(len=*),
intent(in) :: filetype
159 character(len=*),
intent(in) :: filename
160 character(len=*),
intent(in) :: pkgname
161 integer(I4B),
intent(in) :: iout
162 character(len=LENPACKAGENAME) :: sc_name, pname
163 character(len=LENMEMPATH) :: mempath
164 character(len=LINELENGTH),
pointer :: cstr
173 this%pnum = this%pnum + 1
174 this%filenames(this%pnum) = filename
175 this%pkgnames(this%pnum) = pkgname
176 this%inunits(this%pnum) = 0
179 if (this%pkgnames(this%pnum) ==
'')
then
181 this%subcomponent_type, &
186 write (pname,
'(a)') trim(this%subcomponent_type)
188 this%pkgnames(this%pnum) = pname
195 this%pkgnames(this%pnum))
197 this%mempaths(this%pnum) = &
205 this%mempaths(this%pnum) =
''
214 deallocate (this%filenames)
215 deallocate (this%pkgnames)
216 deallocate (this%inunits)
217 deallocate (this%mempaths)
229 character(len=*),
intent(in) :: modeltype
230 character(len=*),
intent(in) :: modelfname
231 character(len=*),
intent(in) :: modelname
232 integer(I4B),
intent(in) :: iout
235 this%modeltype = modeltype
236 this%modelfname = modelfname
237 this%modelname = modelname
244 write (errmsg,
'(3a)')
'Models block model type "', trim(modeltype), &
264 call mem_allocate(this%inunits, 0,
'INUNITS', this%model_mempath)
277 integer(I4B),
dimension(:),
allocatable :: cunit_idxs, indx
278 character(len=LENPACKAGETYPE) :: ftype
280 logical(LGP) :: found, has_dis
283 allocate (cunit_idxs(0))
287 do n = 1,
size(ftypes)
293 if (ftype(1:3) ==
'DIS') has_dis = .true.
296 do m = 1, this%niunit
297 if (this%cunit(m) == ftype)
then
302 if (any(cunit_idxs == m))
then
306 cunit_idxs(
size(cunit_idxs)) = m
315 if (.not. found)
then
316 write (errmsg,
'(a,a,a,a,a)')
'Model package type not supported &
317 &[model=', trim(this%modelname),
', type=', &
325 if (.not. has_dis)
then
326 write (errmsg,
'(3a)') &
327 'Discretization package not specified for model "', &
328 trim(this%modelname),
'".'
334 allocate (this%pkglist(
size(cunit_idxs)))
337 allocate (indx(
size(cunit_idxs)))
338 call qsort(indx, cunit_idxs)
341 do n = 1,
size(cunit_idxs)
342 call this%pkglist(n)%create(this%modeltype, this%modelname, &
343 this%cunit(cunit_idxs(n)))
347 deallocate (cunit_idxs)
355 character(len=*),
intent(in) :: pkgtype
356 character(len=*),
intent(in) :: filename
357 character(len=*),
intent(in) :: pkgname
361 do n = 1,
size(this%pkglist)
362 pkg = this%pkglist(n)
363 if (pkg%pkgtype == pkgtype)
then
364 call this%pkglist(n)%add(this%modelname, this%component_type, &
365 pkgtype, filename, pkgname, this%iout)
383 character(len=LINELENGTH) :: ftype, fname, pname
387 call mem_setptr(ftypes,
'FTYPE', this%input_mempath)
388 call mem_setptr(fnames,
'FNAME', this%input_mempath)
389 call mem_setptr(pnames,
'PNAME', this%input_mempath)
392 call this%create(ftypes)
395 do n = 1,
size(ftypes)
402 call this%add(ftype, fname, pname)
422 do n = 1,
size(this%pkglist)
424 this%pkglist(n)%subcomponent_type, &
425 this%pkglist(n)%pkgtype))
then
429 if (this%pkglist(n)%pnum > 1)
then
430 write (errmsg,
'(a,a,a,a,a)') &
431 'Multiple instances specified for model base package type &
432 &[model=', trim(this%modelname),
', type=', &
433 trim(this%pkglist(n)%pkgtype),
'].'
440 pnum = pnum + this%pkglist(n)%pnum
449 integer(I4B) :: n, m, idx
456 pnum = this%pkgcount()
465 call mem_reallocate(this%inunits, pnum,
'INUNITS', this%model_mempath)
468 do n = 1,
size(this%pkglist)
469 do m = 1, this%pkglist(n)%pnum
473 this%pkgtypes(idx) = trim(this%pkglist(n)%pkgtype)
475 this%pkgnames(idx) = trim(this%pkglist(n)%pkgnames(m))
477 this%mempaths(idx) = trim(this%pkglist(n)%mempaths(m))
479 this%inunits(idx) = this%pkglist(n)%inunits(m)
489 do n = 1,
size(this%pkglist)
490 call this%pkglist(n)%destroy()
492 deallocate (this%pkglist)
493 deallocate (this%cunit)
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 lenpackagename
maximum length of the package name
integer(i4b), parameter lenpackagetype
maximum length of a package type (DIS6, SFR6, CSUB6, etc.)
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)
This module defines variable data types.
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
integer(i4b) function, public count_errors()
Return number of errors.
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
integer(i4b) iout
file unit number for simulation output
character(len=linelength) simfile
simulation name file
This module contains the SourceCommonModule.
character(len=lencomponentname) function, public idm_subcomponent_type(component, subcomponent)
component from package or model type
character(len=lenpackagename) function, public idm_pkg_instance_name(pkg_type, inst)
default name for a multi-package instance
subroutine, public inlen_check(input_name, mf6_name, maxlen, name_type)
store an error for input exceeding internal name length
character(len=lencomponentname) function, public idm_component_type(component)
component from package or model type
character(len=lenpackagename) function, public idm_subcomponent_name(component_type, subcomponent_type, sc_name)
model package subcomponent name
This class is used to store a single deferred-length character string. It was designed to work in an ...