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)
348 character(len=LINELENGTH),
dimension(:),
allocatable, &
349 intent(inout) :: params
350 integer(I4B),
intent(inout) :: nparam
351 character(len=*),
intent(in) :: input_name
352 logical(LGP),
optional,
intent(in) :: create
354 character(len=LINELENGTH) :: dev_msg
355 logical(LGP) :: allocate_params
359 allocate_params = .false.
362 if (
present(create))
then
363 allocate_params = create
366 if (
allocated(params))
deallocate (params)
367 nparam =
size(this%params)
368 allocate (params(nparam))
372 this%mf6_input%component_type, &
373 this%mf6_input%subcomponent_type, &
374 this%blockname, this%params(n),
'')
377 if (idt%prerelease)
then
378 dev_msg =
'Input tag "'//trim(idt%tagname)// &
379 &
'" read from file "'//trim(input_name)// &
380 &
'" is still under development. Install the &
381 &nightly build or compile from source with IDEVELOPMODE = 1.'
385 params(n) = this%params(n)
386 if (allocate_params)
call this%allocate_param(idt)
392 function in_scope(this, mf6_input, blockname, tagname)
397 character(len=*),
intent(in) :: blockname
398 character(len=*),
intent(in) :: tagname
401 character(len=LENVARNAME) :: checkname
402 character(len=LINELENGTH) :: datatype
403 integer(I4B) :: isize, checksize
404 integer(I4B),
pointer :: intptr
408 mf6_input%component_type, &
409 mf6_input%subcomponent_type, &
410 blockname, tagname,
'')
411 if (idt%required)
then
417 if (datatype ==
'KEYSTRING' .or. &
418 datatype ==
'RECARRAY' .or. &
419 datatype ==
'RECORD')
return
426 if (tagname ==
'AUXVAR' .or. &
427 tagname ==
'AUX')
then
429 else if (tagname ==
'BOUNDNAME')
then
430 checkname =
'BOUNDNAMES'
431 else if (tagname ==
'I'//trim(mf6_input%subcomponent_type(1:3)))
then
434 select case (mf6_input%subcomponent_type)
436 if (tagname ==
'PXDP' .or. tagname ==
'PETM')
then
439 else if (tagname ==
'PETM0')
then
440 checkname =
'SURFRATESPEC'
442 case (
'MVR',
'MVT',
'MVE')
443 if (tagname ==
'MNAME' .or. &
444 tagname ==
'MNAME1' .or. &
445 tagname ==
'MNAME2')
then
446 checkname =
'MODELNAMES'
451 if (tagname ==
'MIXED')
in_scope = .true.
453 errmsg =
'LoadContext in_scope needs new check for: '// &
461 call get_isize(checkname, mf6_input%mempath, isize)
463 call mem_setptr(intptr, checkname, mf6_input%mempath)
464 if (intptr > checksize)
in_scope = .true.
478 character(len=LINELENGTH),
dimension(:),
allocatable :: tags
479 character(len=LINELENGTH),
dimension(:),
allocatable :: cols
480 integer(I4B) :: keepcnt, iparam, nparam
486 if (this%loadtype ==
list)
then
490 this%mf6_input%component_type, &
491 this%mf6_input%subcomponent_type, &
496 nparam =
size(this%mf6_input%param_dfns)
500 do iparam = 1, nparam
501 if (this%loadtype ==
list)
then
503 this%mf6_input%component_type, &
504 this%mf6_input%subcomponent_type, &
505 this%blockname, cols(iparam),
'')
507 idt => this%mf6_input%param_dfns(iparam)
510 if (idt%blockname /= this%blockname)
then
513 keep = this%in_scope(this%mf6_input, this%blockname, idt%tagname)
517 keepcnt = keepcnt + 1
519 tags(keepcnt) = trim(idt%tagname)
527 allocate (this%params(nparam))
530 do iparam = 1, nparam
531 this%params(iparam) = trim(tags(iparam))
535 if (
allocated(tags))
deallocate (tags)
552 character(len=*),
intent(in) :: mf6varname
553 character(len=LENVARNAME) :: varname
554 integer(I4B),
pointer :: intvar
556 call mem_allocate(intvar, varname, this%mf6_input%mempath)
568 deallocate (this%naux)
569 deallocate (this%ncpl)
570 deallocate (this%nodes)
571 deallocate (this%maxbound)
572 deallocate (this%boundnames)
573 deallocate (this%iprpak)
578 nullify (this%nbound)
581 nullify (this%maxbound)
582 nullify (this%boundnames)
583 nullify (this%iprpak)
584 nullify (this%auxname_cst)
585 nullify (this%boundname_cst)
586 nullify (this%auxvar)
587 nullify (this%mshape)
594 character(len=*),
intent(in) :: mf6varname
595 character(len=LENVARNAME) :: varname
597 character(len=2) :: prefix =
'IN'
598 ilen = len_trim(mf6varname)
600 varname = prefix//mf6varname(1:(
lenvarname - len(prefix)))
602 varname = prefix//trim(mf6varname)
610 integer(I4B),
intent(in) :: strlen
611 integer(I4B),
intent(in) :: nrow
612 character(len=*),
intent(in) :: varname
613 character(len=*),
intent(in) :: mempath
615 contiguous :: charstr1d
617 call mem_allocate(charstr1d, strlen, nrow, varname, mempath)
627 integer(I4B),
intent(in) :: nrow
628 character(len=*),
intent(in) :: varname
629 character(len=*),
intent(in) :: mempath
630 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
642 integer(I4B),
intent(in) :: ncol
643 integer(I4B),
intent(in) :: nrow
644 character(len=*),
intent(in) :: varname
645 character(len=*),
intent(in) :: mempath
646 integer(I4B),
dimension(:, :),
pointer,
contiguous :: int2d
660 integer(I4B),
intent(in) :: nrow
661 character(len=*),
intent(in) :: varname
662 character(len=*),
intent(in) :: mempath
663 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
675 integer(I4B),
intent(in) :: ncol
676 integer(I4B),
intent(in) :: nrow
677 character(len=*),
intent(in) :: varname
678 character(len=*),
intent(in) :: mempath
679 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
692 subroutine setval(intptr, varname, mempath)
694 integer(I4B),
pointer,
intent(inout) :: intptr
695 character(len=*),
intent(in) :: varname
696 character(len=*),
intent(in) :: mempath
697 logical(LGP) :: found
708 integer(I4B),
pointer,
intent(inout) :: intptr
709 character(len=*),
intent(in) :: varname
710 character(len=*),
intent(in) :: mempath
711 integer(I4B) :: isize
726 contiguous,
intent(inout) :: charstr1d
727 character(len=*),
intent(in) :: varname
728 character(len=*),
intent(in) :: mempath
729 integer(I4B),
intent(in) :: strlen
730 integer(I4B) :: isize
735 call mem_allocate(charstr1d, strlen, 0, varname, mempath)
744 real(DP),
dimension(:, :),
pointer, &
745 contiguous,
intent(inout) :: auxvar
746 character(len=*),
intent(in) :: mempath
747 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
Disable development features in release mode.
subroutine, public dev_feature(errmsg, iunit)
Terminate if in release mode (guard development features)
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
integer(i4b) iout
file unit number for simulation output
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.