33 integer(I4B),
pointer :: iper
34 logical(LGP),
pointer :: readarraygrid
35 logical(LGP),
pointer :: readasarrays
37 integer(I4B),
dimension(:, :),
pointer,
contiguous :: cellid => null()
38 integer(I4B),
dimension(:),
pointer,
contiguous :: nodeulist => null()
64 logical :: naux = .false.
65 logical :: ipakcb = .false.
66 logical :: iprpak = .false.
67 logical :: iprflow = .false.
68 logical :: boundnames = .false.
69 logical :: auxmultname = .false.
70 logical :: inewton = .false.
71 logical :: auxiliary = .false.
72 logical :: maxbound = .false.
91 integer(I4B),
intent(inout) :: neq
100 call tasmanager_cr(this%TasManager, dis, this%name_model, this%iout)
103 call obs_cr(this%obs, this%inobspkg)
106 write (this%iout, 1) trim(this%filtyp), trim(adjustl(this%text)), &
108 1
format(1x, /1x, a,
' -- ', a,
' PACKAGE, VERSION 8, 2/22/2014', &
109 ' INPUT READ FROM MEMPATH: ', a)
112 call this%source_options()
115 call this%tsmanager%tsmanager_df()
116 call this%tasmanager%tasmanager_df()
119 call this%source_dimensions()
122 if (this%npakeq > 0)
then
123 this%ioffset = neq - this%dis%nodes
127 neq = neq + this%npakeq
130 if (this%bnd_obs_supported())
then
131 call this%obs%obs_df(this%iout, this%packName, this%filtyp, this%dis)
132 call this%bnd_df_obs()
137 call this%define_listlabel()
148 logical(LGP) :: found
151 if (this%iper /=
kper)
return
153 if (.not. this%readasarrays)
then
155 call mem_set_value(this%nbound,
'NBOUND', this%input_mempath, &
156 found, release=.false.)
159 if (this%readarraygrid)
then
160 call this%nodeu_to_nlist()
161 else if (this%readasarrays)
then
162 call this%layarr_to_nlist()
164 call this%cellid_to_nlist()
167 if (this%inamedbound /= 0)
then
168 do n = 1,
size(this%boundname_cst)
169 this%boundname(n) = this%boundname_cst(n)
184 if (this%iprpak /= 0)
then
185 call this%write_lstfile()
200 call mem_deallocate(this%boundname_cst,
'BOUNDNAME_IDM', this%memoryPath)
204 call mem_setptr(this%boundname_cst,
'BOUNDNAME_CST', this%memoryPath)
205 call mem_setptr(this%auxvar,
'AUXVAR', this%memoryPath)
208 deallocate (this%readarraygrid)
209 deallocate (this%readasarrays)
210 nullify (this%readarraygrid)
211 nullify (this%readasarrays)
215 call this%BndType%bnd_da()
233 call this%BndType%allocate_scalars()
236 call mem_setptr(this%iper,
'IPER', this%input_mempath)
239 allocate (this%readarraygrid)
240 allocate (this%readasarrays)
243 this%readarraygrid = .false.
244 this%readasarrays = .false.
260 integer(I4B),
dimension(:),
pointer,
contiguous,
optional :: nodelist
261 real(DP),
dimension(:, :),
pointer,
contiguous,
optional :: auxvar
264 call this%BndType%allocate_arrays(nodelist, auxvar)
267 call mem_setptr(this%cellid,
'CELLID', this%input_mempath)
268 call mem_setptr(this%nodeulist,
'NODEULIST', this%input_mempath)
269 call mem_setptr(this%boundname_cst,
'BOUNDNAME', this%input_mempath)
272 call mem_checkin(this%cellid,
'CELLID', this%memoryPath, &
273 'CELLID', this%input_mempath)
274 call mem_checkin(this%nodeulist,
'NODEULIST', this%memoryPath, &
275 'NODEULIST', this%input_mempath)
277 this%memoryPath,
'BOUNDNAME', this%input_mempath)
279 if (
present(auxvar))
then
283 call mem_setptr(this%auxvar,
'AUXVAR', this%input_mempath)
286 call mem_checkin(this%auxvar,
'AUXVAR_IDM', this%memoryPath, &
287 'AUXVAR', this%input_mempath)
304 logical(LGP) :: found_readarr
305 character(len=LENAUXNAME) :: sfacauxname
309 call mem_set_value(this%naux,
'NAUX', this%input_mempath, found%naux, &
311 call mem_set_value(this%ipakcb,
'IPAKCB', this%input_mempath, found%ipakcb)
312 call mem_set_value(this%iprpak,
'IPRPAK', this%input_mempath, found%iprpak)
313 call mem_set_value(this%iprflow,
'IPRFLOW', this%input_mempath, found%iprflow)
314 call mem_set_value(this%inamedbound,
'BOUNDNAMES', this%input_mempath, &
315 found%boundnames, release=.false.)
316 call mem_set_value(sfacauxname,
'AUXMULTNAME', this%input_mempath, &
318 call mem_set_value(this%inewton,
'INEWTON', this%input_mempath, found%inewton)
319 call mem_set_value(this%readarraygrid,
'READARRAYGRID', this%input_mempath, &
321 call mem_set_value(this%readasarrays,
'READASARRAYS', this%input_mempath, &
325 call this%log_options(found, sfacauxname)
328 if (found%naux .and. this%naux > 0)
then
330 'AUXNAME', this%memoryPath)
332 'AUXNAME_CST', this%memoryPath)
333 call mem_set_value(this%auxname_cst,
'AUXILIARY', this%input_mempath, &
334 found%auxiliary, release=.false.)
337 this%auxname(n) = this%auxname_cst(n)
342 if (found%ipakcb) this%ipakcb = -1
345 if (found%auxmultname) this%iauxmultcol = -1
349 if (
filein_fname(this%obs%inputFilename,
'OBS6_FILENAME', &
350 this%input_mempath, this%input_fname))
then
351 this%obs%active = .true.
353 call openfile(this%obs%inUnitObs, this%iout, this%obs%inputFilename,
'OBS')
357 if (found%inewton) this%inewton = 0
360 if (this%iauxmultcol < 0)
then
363 if (this%naux == 0)
then
364 write (
errmsg,
'(a,2(1x,a))') &
365 'AUXMULTNAME was specified as', trim(adjustl(sfacauxname)), &
366 'but no AUX variables specified.'
373 if (sfacauxname == this%auxname(n))
then
380 if (this%iauxmultcol == 0)
then
381 write (
errmsg,
'(a,2(1x,a))') &
382 'AUXMULTNAME was specified as', trim(adjustl(sfacauxname)), &
383 'but no AUX variable found with this name.'
388 if (this%readasarrays)
then
389 if (.not. this%dis%supports_layers())
then
390 errmsg =
'READASARRAYS option is not compatible with selected'// &
391 ' discretization type.'
410 character(len=*),
intent(in) :: sfacauxname
413 character(len=*),
parameter :: fmtreadasarrays = &
414 &
"(4x, 'PACKAGE INPUT WILL BE READ AS LAYER ARRAYS.')"
415 character(len=*),
parameter :: fmtreadarraygrid = &
416 &
"(4x, 'PACKAGE INPUT WILL BE READ AS GRID ARRAYS.')"
417 character(len=*),
parameter :: fmtflow = &
418 &
"(4x, 'FLOWS WILL BE SAVED TO BUDGET FILE SPECIFIED IN OUTPUT CONTROL')"
421 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text)) &
424 if (this%readasarrays)
then
425 write (this%iout, fmtreadasarrays)
428 if (this%readarraygrid)
then
429 write (this%iout, fmtreadarraygrid)
432 if (found%ipakcb)
then
433 write (this%iout, fmtflow)
436 if (found%iprpak)
then
437 write (this%iout,
'(4x,a)') &
438 'LISTS OF '//trim(adjustl(this%text))//
' CELLS WILL BE PRINTED.'
441 if (found%iprflow)
then
442 write (this%iout,
'(4x,a)') trim(adjustl(this%text))// &
443 ' FLOWS WILL BE PRINTED TO LISTING FILE.'
446 if (found%boundnames)
then
447 write (this%iout,
'(4x,a)') trim(adjustl(this%text))// &
448 ' BOUNDARIES HAVE NAMES IN LAST COLUMN.'
451 if (found%auxmultname)
then
452 write (this%iout,
'(4x,a,a)') &
453 'AUXILIARY MULTIPLIER NAME: ', sfacauxname
456 if (found%inewton)
then
457 write (this%iout,
'(4x,a)') &
458 'NEWTON-RAPHSON method disabled for unconfined cells'
462 write (this%iout,
'(1x,a)') &
463 'END OF '//trim(adjustl(this%text))//
' BASE OPTIONS'
475 if (this%readasarrays)
then
476 this%maxbound = this%dis%get_ncpl()
479 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text))// &
483 call mem_set_value(this%maxbound,
'MAXBOUND', this%input_mempath, &
484 found%maxbound, release=.false.)
486 write (this%iout,
'(4x,a,i7)')
'MAXBOUND = ', this%maxbound
489 write (this%iout,
'(1x,a)') &
490 'END OF '//trim(adjustl(this%text))//
' BASE DIMENSIONS'
494 if (this%maxbound <= 0)
then
495 write (
errmsg,
'(a)')
'MAXBOUND must be an integer greater than zero.'
512 integer(I4B),
dimension(:),
pointer :: cellid
513 integer(I4B) :: n, nodeu, noder
514 character(len=LINELENGTH) :: nodestr
517 do n = 1, this%nbound
520 cellid => this%cellid(:, n)
523 call this%check_cellid(n, cellid, this%dis%mshape, this%dis%ndim)
526 if (this%dis%ndim == 1)
then
528 elseif (this%dis%ndim == 2)
then
529 nodeu =
get_node(cellid(1), 1, cellid(2), &
530 this%dis%mshape(1), 1, &
533 nodeu =
get_node(cellid(1), cellid(2), cellid(3), &
534 this%dis%mshape(1), &
535 this%dis%mshape(2), &
540 if (this%dis%nodes < this%dis%nodesuser)
then
542 noder = this%dis%get_nodenumber(nodeu, 0)
544 call this%dis%nodeu_to_string(nodeu, nodestr)
546 ' Cell is outside active grid domain: '// &
547 trim(adjustl(nodestr))
550 this%nodelist(n) = noder
552 this%nodelist(n) = nodeu
574 integer(I4B) :: n, noder, nodeuser, ninactive
579 do n = 1, this%nbound
580 nodeuser = this%nodeulist(n)
581 noder = this%dis%get_nodenumber(nodeuser, 0)
583 this%nodelist(n) = noder
585 ninactive = ninactive + 1
590 this%nbound = this%nbound - ninactive
609 character(len=LENVARNAME) :: ilayname, inilayname
610 character(len=24) :: aname =
' LAYER OR NODE INDEX'
612 integer(I4B),
dimension(:),
contiguous, &
613 pointer :: ilay => null()
614 integer(I4B),
pointer :: inilay => null()
617 ilayname =
'I'//trim(this%filtyp)
618 inilayname =
'INI'//trim(this%filtyp)
621 call mem_setptr(inilay, inilayname, this%input_mempath)
624 if (inilay == 1)
then
628 call mem_setptr(ilay, ilayname, this%input_mempath)
631 call this%dis%nlarray_to_nodelist(ilay, this%nodelist, this%maxbound, &
644 integer(I4B) :: il, ir, ic, ncol, nrow, nlay, nodeu, noder, ipos
646 if (this%readasarrays)
then
649 if (this%dis%ndim == 3)
then
650 nlay = this%dis%mshape(1)
651 nrow = this%dis%mshape(2)
652 ncol = this%dis%mshape(3)
653 elseif (this%dis%ndim == 2)
then
654 nlay = this%dis%mshape(1)
656 ncol = this%dis%mshape(2)
664 nodeu =
get_node(il, ir, ic, nlay, nrow, ncol)
665 noder = this%dis%get_nodenumber(nodeu, 0)
666 this%nodelist(ipos) = noder
672 this%nbound = ipos - 1
684 integer(I4B),
intent(in) :: ii
685 integer(I4B),
dimension(:),
intent(in) :: cellid
686 integer(I4B),
dimension(:),
intent(in) :: mshape
687 integer(I4B),
intent(in) :: ndim
688 character(len=20) :: cellstr, mshstr
689 character(len=*),
parameter :: fmterr = &
690 "('List entry ',i0,' contains cellid ',a,' but this cellid is invalid &
691 &for model with shape ', a)"
692 character(len=*),
parameter :: fmtndim1 = &
694 character(len=*),
parameter :: fmtndim2 = &
695 "('(',i0,',',i0,')')"
696 character(len=*),
parameter :: fmtndim3 = &
697 "('(',i0,',',i0,',',i0,')')"
701 if (cellid(1) < 1 .or. cellid(1) > mshape(1))
then
702 write (cellstr, fmtndim1) cellid(1)
703 write (mshstr, fmtndim1) mshape(1)
704 write (
errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
710 if (cellid(1) < 1 .or. cellid(1) > mshape(1) .or. &
711 cellid(2) < 1 .or. cellid(2) > mshape(2))
then
712 write (cellstr, fmtndim2) cellid(1), cellid(2)
713 write (mshstr, fmtndim2) mshape(1), mshape(2)
714 write (
errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
720 if (cellid(1) < 1 .or. cellid(1) > mshape(1) .or. &
721 cellid(2) < 1 .or. cellid(2) > mshape(2) .or. &
722 cellid(3) < 1 .or. cellid(3) > mshape(3))
then
723 write (cellstr, fmtndim3) cellid(1), cellid(2), cellid(3)
724 write (mshstr, fmtndim3) mshape(1), mshape(2), mshape(3)
725 write (
errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
748 character(len=10) :: cpos
749 character(len=LINELENGTH) :: tag
750 character(len=LINELENGTH),
allocatable,
dimension(:) :: words
751 integer(I4B) :: ntabrows
752 integer(I4B) :: ntabcols
754 integer(I4B) :: ii, jj, i, j, k, nod
757 type(
tabletype),
pointer :: inputtab => null()
759 character(len=LINELENGTH) :: fmtlstbn
763 naux =
size(this%auxvar, 1)
766 ntabrows = this%nbound
770 ipos = index(this%listlabel,
'NO.')
772 write (cpos,
'(i10)') ipos + 3
773 fmtlstbn =
'(a'//trim(adjustl(cpos))
778 if (
size(this%dis%mshape) == 3)
then
780 fmtlstbn = trim(fmtlstbn)//
',a7,a7,a7'
783 else if (
size(this%dis%mshape) == 2)
then
785 fmtlstbn = trim(fmtlstbn)//
',a7,a7'
790 fmtlstbn = trim(fmtlstbn)//
',a7'
794 ntabcols = ntabcols + ldim
796 fmtlstbn = trim(fmtlstbn)//
',a16'
800 if (this%inamedbound == 1)
then
801 ntabcols = ntabcols + 1
802 fmtlstbn = trim(fmtlstbn)//
',a16'
806 ntabcols = ntabcols + naux
808 fmtlstbn = trim(fmtlstbn)//
',a16'
810 fmtlstbn = trim(fmtlstbn)//
')'
813 allocate (words(ntabcols))
816 read (this%listlabel, fmtlstbn) (words(i), i=1, ntabcols)
820 call inputtab%table_df(ntabrows, ntabcols, this%iout)
824 call inputtab%initialize_column(words(ipos), 10, alignment=
tabcenter)
827 do i = 1,
size(this%dis%mshape)
829 call inputtab%initialize_column(words(ipos), 7, alignment=
tabcenter)
835 call inputtab%initialize_column(words(ipos), 16, alignment=
tabcenter)
839 if (this%inamedbound == 1)
then
847 call inputtab%initialize_column(this%auxname(i), 16, alignment=
tabcenter)
851 do ii = 1, this%nbound
852 call inputtab%add_term(ii)
855 if (
size(this%dis%mshape) == 3)
then
856 nod = this%nodelist(ii)
857 call get_ijk(nod, this%dis%mshape(2), this%dis%mshape(3), &
858 this%dis%mshape(1), i, j, k)
859 call inputtab%add_term(k)
860 call inputtab%add_term(i)
861 call inputtab%add_term(j)
862 else if (
size(this%dis%mshape) == 2)
then
863 nod = this%nodelist(ii)
864 call get_ijk(nod, 1, this%dis%mshape(2), this%dis%mshape(1), i, j, k)
865 call inputtab%add_term(k)
866 call inputtab%add_term(j)
868 nod = this%nodelist(ii)
869 call inputtab%add_term(nod)
874 call inputtab%add_term(this%bound_value(jj, ii))
878 if (this%inamedbound == 1)
then
879 call inputtab%add_term(this%boundname(ii))
884 call inputtab%add_term(this%auxvar(jj, ii))
889 call inputtab%table_da()
890 deallocate (inputtab)
907 integer(I4B),
intent(in) :: col
908 integer(I4B),
intent(in) :: row
This module contains the extended boundary package.
subroutine bndext_rp(this)
subroutine bndext_allocate_arrays(this, nodelist, auxvar)
@ brief Allocate package arrays
subroutine bndext_rp_log(this)
Write the input list to the listing file if requested.
subroutine bndext_df(this, neq, dis)
@ brief Define boundary package options and dimensions
subroutine bndext_da(this)
@ brief Deallocate package memory
subroutine default_nodelist(this)
Assign default nodelist when READASARRAYS is specified.
subroutine write_lstfile(this)
@ brief Log package stress period input
subroutine log_options(this, found, sfacauxname)
@ brief Log package options
subroutine cellid_to_nlist(this)
@ brief Update package nodelist
subroutine source_dimensions(this)
@ brief Source package dimensions from input context
subroutine check_cellid(this, ii, cellid, mshape, ndim)
@ brief Check for valid cellid
subroutine nodeu_to_nlist(this)
@ brief Update package nodelist
subroutine layarr_to_nlist(this)
Update the nodelist based on layer number variable input.
real(dp) function bound_value(this, col, row)
@ brief Return a bound value
subroutine source_options(this)
@ brief Source package options from input context
subroutine bndext_allocate_scalars(this)
@ brief Allocate package scalars
This module contains the base boundary package.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
@ tabcenter
centered table column
@ tableft
left justified table column
real(dp), parameter dnodata
real no data constant
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
real(dp), parameter dzero
real constant zero
integer(i4b), parameter lenmempath
maximum length of the memory path
integer(i4b) function, public get_node(ilay, irow, icol, nlay, nrow, ncol)
Get node number, given layer, row, and column indices for a structured grid. If any argument is inval...
subroutine, public get_ijk(nodenumber, nrow, ncol, nlay, irow, icol, ilay)
Get row, column and layer indices from node number and grid dimensions. If nodenumber is invalid,...
This module defines variable data types.
This module contains the derived type ObsType.
subroutine, public obs_cr(obs, inobs)
@ brief Create a new ObsType 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
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
subroutine, public table_cr(this, name, title)
integer(i4b), pointer, public kper
current stress period number
subroutine, public tasmanager_cr(this, dis, modelname, iout)
Create the time-array series manager.
subroutine, public tsmanager_cr(this, iout, removeTsLinksOnCompletion, extendTsToEndOfSimulation)
Create the tsmanager.
This class is used to store a single deferred-length character string. It was designed to work in an ...