47 integer(I4B),
pointer :: invar
62 character(len=LENVARNAME) :: blockname
63 character(len=LENVARNAME) :: named_bound
64 integer(I4B),
pointer :: naux => null()
65 integer(I4B),
pointer :: maxbound => null()
66 integer(I4B),
pointer :: boundnames => null()
67 integer(I4B),
pointer :: iprpak => null()
68 integer(I4B),
pointer :: nbound => null()
69 integer(I4B),
pointer :: ncpl => null()
70 integer(I4B),
pointer :: nodes => null()
71 integer(I4B) :: loadtype
72 integer(I4B) :: ctxtype
73 logical(LGP) :: readarray
75 contiguous :: auxname_cst => null()
77 contiguous :: boundname_cst => null()
78 real(dp),
dimension(:, :),
pointer, &
79 contiguous :: auxvar => null()
80 integer(I4B),
dimension(:),
pointer,
contiguous :: mshape => null()
81 character(len=LINELENGTH),
dimension(:),
allocatable :: params
99 subroutine init(this, mf6_input, blockname, named_bound)
104 character(len=*),
optional,
intent(in) :: blockname
105 character(len=*),
optional,
intent(in) :: named_bound
109 this%mf6_input = mf6_input
110 this%readarray = .false.
114 select case (mf6_input%load_scope)
118 if (mf6_input%subcomponent_type ==
'NAM')
then
120 else if (mf6_input%subcomponent_type ==
'TDIS' .or. &
121 mf6_input%subcomponent_type ==
'HPC')
then
123 else if (mf6_input%component_type ==
'EXG')
then
127 if (mf6_input%subcomponent_type ==
'OC' .or. &
128 mf6_input%subcomponent_type ==
'STO')
then
137 errmsg =
'LoadContext unidentified context for mempath: '// &
138 trim(mf6_input%mempath)
142 if (
present(blockname))
then
143 this%blockname = blockname
144 call upcase(this%blockname)
146 this%blockname =
'PERIOD'
149 if (
present(named_bound))
then
150 this%named_bound = named_bound
151 call upcase(this%named_bound)
153 this%named_bound =
'MAXBOUND'
157 do n = 1,
size(mf6_input%block_dfns)
158 if (mf6_input%block_dfns(n)%blockname == this%blockname)
then
159 if (mf6_input%block_dfns(n)%aggregate)
then
167 do n = 1,
size(mf6_input%param_dfns)
168 idt => mf6_input%param_dfns(n)
169 if (idt%blockname ==
'OPTIONS')
then
170 select case (idt%tagname)
171 case (
'READASARRAYS')
173 this%readarray = .true.
174 case (
'READARRAYGRID')
176 this%readarray = .true.
185 call this%set_params()
188 call this%allocate_scalars()
201 call setptr(this%nbound,
'NBOUND', this%mf6_input%mempath)
202 call setval(this%naux,
'NAUX', this%mf6_input%mempath)
203 call setval(this%ncpl,
'NCPL', this%mf6_input%mempath)
204 call setval(this%nodes,
'NODES', this%mf6_input%mempath)
205 call setval(this%maxbound, this%named_bound, this%mf6_input%mempath)
206 call setval(this%boundnames,
'BOUNDNAMES', this%mf6_input%mempath)
207 call setval(this%iprpak,
'IPRPAK', this%mf6_input%mempath)
214 this%blockname ==
'PERIOD')
then
216 this%mf6_input%component_mempath)
218 if (this%ncpl == 0)
then
219 if (
size(this%mshape) == 2)
then
220 this%ncpl = this%mshape(2)
221 else if (
size(this%mshape) == 3)
then
222 this%ncpl = this%mshape(2) * this%mshape(3)
226 if (this%nodes == 0) this%nodes = product(this%mshape)
241 integer(I4B),
dimension(:, :),
pointer,
contiguous :: cellid
242 integer(I4B),
dimension(:),
pointer,
contiguous :: nodeulist
245 this%blockname ==
'PERIOD')
then
247 if (this%readarray)
then
248 call mem_allocate(cellid, 0, 0,
'CELLID', this%mf6_input%mempath)
253 call mem_allocate(nodeulist, 0,
'NODEULIST', this%mf6_input%mempath)
257 call setptr(this%auxname_cst,
'AUXILIARY', &
259 call setptr(this%boundname_cst,
'BOUNDNAME', &
261 call setptr(this%auxvar, this%mf6_input%mempath)
263 else if (this%ctxtype ==
exchange)
then
265 call setptr(this%auxname_cst,
'AUXILIARY', &
267 call setptr(this%boundname_cst,
'BOUNDNAME', &
269 call setptr(this%auxvar, this%mf6_input%mempath)
279 integer(I4B) :: dimsize
284 if (this%readarray)
then
285 select case (idt%shape)
286 case (
'NCPL',
'NAUX NCPL')
288 case (
'NODES',
'NAUX NODES')
289 dimsize = this%maxbound
294 select case (idt%datatype)
296 if (this%loadtype ==
list)
then
298 this%mf6_input%mempath)
301 if (this%loadtype ==
list)
then
303 this%mf6_input%mempath)
306 if (this%loadtype ==
list)
then
308 this%mf6_input%mempath)
311 if (this%loadtype ==
list)
then
312 if (idt%shape ==
'NCELLDIM')
then
314 idt%mf6varname, this%mf6_input%mempath)
316 else if (this%readarray)
then
318 this%mf6_input%mempath)
321 if (idt%shape ==
'NAUX')
then
323 idt%mf6varname, this%mf6_input%mempath)
324 else if (this%readarray)
then
326 this%mf6_input%mempath)
329 if (this%readarray)
then
331 this%mf6_input%mempath)
343 subroutine tags(this, params, nparam, input_name, create)
346 character(len=LINELENGTH),
dimension(:),
allocatable, &
347 intent(inout) :: params
348 integer(I4B),
intent(inout) :: nparam
349 character(len=*),
intent(in) :: input_name
350 logical(LGP),
optional,
intent(in) :: create
352 logical(LGP) :: allocate_params
356 allocate_params = .false.
359 if (
present(create))
then
360 allocate_params = create
363 if (
allocated(params))
deallocate (params)
364 nparam =
size(this%params)
365 allocate (params(nparam))
367 params(n) = this%params(n)
370 if (allocate_params)
then
375 this%mf6_input%component_type, &
376 this%mf6_input%subcomponent_type, &
377 this%blockname, params(n),
'')
378 call this%allocate_param(idt)
385 function in_scope(this, mf6_input, blockname, tagname)
390 character(len=*),
intent(in) :: blockname
391 character(len=*),
intent(in) :: tagname
394 character(len=LENVARNAME) :: checkname
395 character(len=LINELENGTH) :: datatype
396 integer(I4B) :: isize, checksize
397 integer(I4B),
pointer :: intptr
401 mf6_input%component_type, &
402 mf6_input%subcomponent_type, &
403 blockname, tagname,
'')
404 if (idt%required)
then
410 if (datatype ==
'KEYSTRING' .or. &
411 datatype ==
'RECARRAY' .or. &
412 datatype ==
'RECORD')
return
419 if (tagname ==
'AUXVAR' .or. &
420 tagname ==
'AUX')
then
422 else if (tagname ==
'BOUNDNAME')
then
423 checkname =
'BOUNDNAMES'
424 else if (tagname ==
'I'//trim(mf6_input%subcomponent_type(1:3)))
then
427 select case (mf6_input%subcomponent_type)
429 if (tagname ==
'PXDP' .or. tagname ==
'PETM')
then
432 else if (tagname ==
'PETM0')
then
433 checkname =
'SURFRATESPEC'
435 case (
'MVR',
'MVT',
'MVE')
436 if (tagname ==
'MNAME' .or. &
437 tagname ==
'MNAME1' .or. &
438 tagname ==
'MNAME2')
then
439 checkname =
'MODELNAMES'
444 if (tagname ==
'MIXED')
in_scope = .true.
446 errmsg =
'LoadContext in_scope needs new check for: '// &
454 call get_isize(checkname, mf6_input%mempath, isize)
456 call mem_setptr(intptr, checkname, mf6_input%mempath)
457 if (intptr > checksize)
in_scope = .true.
471 character(len=LINELENGTH),
dimension(:),
allocatable :: tags
472 character(len=LINELENGTH),
dimension(:),
allocatable :: cols
473 integer(I4B) :: keepcnt, iparam, nparam
479 if (this%loadtype ==
list)
then
483 this%mf6_input%component_type, &
484 this%mf6_input%subcomponent_type, &
489 nparam =
size(this%mf6_input%param_dfns)
493 do iparam = 1, nparam
494 if (this%loadtype ==
list)
then
496 this%mf6_input%component_type, &
497 this%mf6_input%subcomponent_type, &
498 this%blockname, cols(iparam),
'')
500 idt => this%mf6_input%param_dfns(iparam)
503 if (idt%blockname /= this%blockname)
then
506 keep = this%in_scope(this%mf6_input, this%blockname, idt%tagname)
510 keepcnt = keepcnt + 1
512 tags(keepcnt) = trim(idt%tagname)
520 allocate (this%params(nparam))
523 do iparam = 1, nparam
524 this%params(iparam) = trim(tags(iparam))
528 if (
allocated(tags))
deallocate (tags)
545 character(len=*),
intent(in) :: mf6varname
546 character(len=LENVARNAME) :: varname
547 integer(I4B),
pointer :: intvar
549 call mem_allocate(intvar, varname, this%mf6_input%mempath)
561 deallocate (this%naux)
562 deallocate (this%ncpl)
563 deallocate (this%nodes)
564 deallocate (this%maxbound)
565 deallocate (this%boundnames)
566 deallocate (this%iprpak)
571 nullify (this%nbound)
574 nullify (this%maxbound)
575 nullify (this%boundnames)
576 nullify (this%iprpak)
577 nullify (this%auxname_cst)
578 nullify (this%boundname_cst)
579 nullify (this%auxvar)
580 nullify (this%mshape)
587 character(len=*),
intent(in) :: mf6varname
588 character(len=LENVARNAME) :: varname
590 character(len=2) :: prefix =
'IN'
591 ilen = len_trim(mf6varname)
593 varname = prefix//mf6varname(1:(
lenvarname - len(prefix)))
595 varname = prefix//trim(mf6varname)
603 integer(I4B),
intent(in) :: strlen
604 integer(I4B),
intent(in) :: nrow
605 character(len=*),
intent(in) :: varname
606 character(len=*),
intent(in) :: mempath
608 contiguous :: charstr1d
610 call mem_allocate(charstr1d, strlen, nrow, varname, mempath)
620 integer(I4B),
intent(in) :: nrow
621 character(len=*),
intent(in) :: varname
622 character(len=*),
intent(in) :: mempath
623 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
635 integer(I4B),
intent(in) :: ncol
636 integer(I4B),
intent(in) :: nrow
637 character(len=*),
intent(in) :: varname
638 character(len=*),
intent(in) :: mempath
639 integer(I4B),
dimension(:, :),
pointer,
contiguous :: int2d
653 integer(I4B),
intent(in) :: nrow
654 character(len=*),
intent(in) :: varname
655 character(len=*),
intent(in) :: mempath
656 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
668 integer(I4B),
intent(in) :: ncol
669 integer(I4B),
intent(in) :: nrow
670 character(len=*),
intent(in) :: varname
671 character(len=*),
intent(in) :: mempath
672 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
685 subroutine setval(intptr, varname, mempath)
687 integer(I4B),
pointer,
intent(inout) :: intptr
688 character(len=*),
intent(in) :: varname
689 character(len=*),
intent(in) :: mempath
690 logical(LGP) :: found
701 integer(I4B),
pointer,
intent(inout) :: intptr
702 character(len=*),
intent(in) :: varname
703 character(len=*),
intent(in) :: mempath
704 integer(I4B) :: isize
719 contiguous,
intent(inout) :: charstr1d
720 character(len=*),
intent(in) :: varname
721 character(len=*),
intent(in) :: mempath
722 integer(I4B),
intent(in) :: strlen
723 integer(I4B) :: isize
728 call mem_allocate(charstr1d, strlen, 0, varname, mempath)
737 real(DP),
dimension(:, :),
pointer, &
738 contiguous,
intent(inout) :: auxvar
739 character(len=*),
intent(in) :: mempath
740 integer(I4B) :: isize
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lenvarname
maximum length of a variable name
integer(i4b), parameter lenauxname
maximum length of a aux variable
integer(i4b), parameter lenboundname
maximum length of a bound name
integer(i4b), parameter izero
integer constant zero
real(dp), parameter dzero
real constant zero
This module contains the DefinitionSelectModule.
type(inputparamdefinitiontype) function, pointer, public get_param_definition_type(input_definition_types, component_type, subcomponent_type, blockname, tagname, filename)
Return parameter definition.
type(inputparamdefinitiontype) function, pointer, public get_aggregate_definition_type(input_definition_types, component_type, subcomponent_type, blockname)
Return aggregate definition.
subroutine, public idt_parse_rectype(idt, cols, ncol)
allocate and set RECARRAY, KEYSTRING or RECORD param list
character(len=linelength) function, public idt_datatype(idt)
return input definition type datatype
This module defines variable data types.
This module contains the LoadContextModule.
subroutine set_params(this)
set set of in scope parameters for package
subroutine allocate_dbl2d(ncol, nrow, varname, mempath)
allocate dbl2d
subroutine tags(this, params, nparam, input_name, create)
get in scope package params
subroutine setptr_auxvar(auxvar, mempath)
set auxvar pointer
subroutine allocate_charstr1d(strlen, nrow, varname, mempath)
allocate character string type array
subroutine allocate_int1d(nrow, varname, mempath)
allocate int1d
@ load_undef
undefined load type
@ gridarray
readarraygrid load
@ layerarray
readasarrays load
@ list
list (structarray) based load
subroutine allocate_dbl1d(nrow, varname, mempath)
allocate dbl1d
@ stresspkg
model stress package context type
@ exchange
exchange context type
@ model
model context type
@ modelpkg
model package context type
@ context_undef
undefined context type
subroutine setval(intptr, varname, mempath)
allocate intptr and update from input contextset intptr to varname
subroutine allocate_scalars(this)
allocate scalars
subroutine allocate_param(this, idt)
allocate a package dynamic input parameter
subroutine allocate_arrays(this)
allocate arrays
subroutine setptr_int(intptr, varname, mempath)
set intptr to varname
subroutine allocate_int2d(ncol, nrow, varname, mempath)
allocate int2d
subroutine destroy(this)
destroy input context object
character(len=lenvarname) function, public rsv_name(mf6varname)
create read state variable name
logical(lgp) function in_scope(this, mf6_input, blockname, tagname)
establish if input parameter is in scope for package load
character(len=lenvarname) function rsv_alloc(this, mf6varname)
allocate a read state variable
subroutine setptr_charstr1d(charstr1d, varname, mempath, strlen)
set charstr1d pointer to varname
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
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
This class is used to store a single deferred-length character string. It was designed to work in an ...
derived type for boundary package input context
Pointer type for read state variable.