35 integer(I4B),
pointer :: iper
36 logical(LGP),
pointer :: readarraygrid
37 logical(LGP),
pointer :: readasarrays
38 logical(LGP),
pointer :: ts_active
40 integer(I4B),
dimension(:, :),
pointer,
contiguous :: cellid => null()
41 integer(I4B),
dimension(:),
pointer,
contiguous :: nodeulist => null()
43 integer(I4B),
dimension(:),
pointer,
contiguous :: pkg_ifno => null()
44 real(dp),
dimension(:, :),
pointer,
contiguous :: featureauxvar => null()
74 logical :: naux = .false.
75 logical :: ipakcb = .false.
76 logical :: iprpak = .false.
77 logical :: iprflow = .false.
78 logical :: boundnames = .false.
79 logical :: auxmultname = .false.
80 logical :: inewton = .false.
81 logical :: auxiliary = .false.
82 logical :: maxbound = .false.
102 integer(I4B),
intent(inout) :: neq
105 integer(I4B) :: isize
107 character(len=*),
parameter :: fmtpkghdr = &
108 &
"(1X,/1X,a,' -- ',a,' PACKAGE, VERSION 8, 2/22/2014',&
109 &' INPUT READ FROM MEMPATH: ',a)"
117 call tasmanager_cr(this%TasManager, dis, this%name_model, this%iout)
120 call obs_cr(this%obs, this%inobspkg)
123 write (this%iout, fmtpkghdr) trim(this%filtyp), trim(adjustl(this%text)), &
127 call this%source_options()
130 call get_isize(
'TS6_FILENAME', this%input_mempath, isize)
131 if (isize > 0) this%ts_active = .true.
134 call this%tsmanager%tsmanager_df()
135 call this%tasmanager%tasmanager_df()
138 call this%source_dimensions()
141 if (this%npakeq > 0)
then
142 this%ioffset = neq - this%dis%nodes
146 neq = neq + this%npakeq
149 if (this%bnd_obs_supported())
then
150 call this%obs%obs_df(this%iout, this%packName, this%filtyp, this%dis)
151 call this%bnd_df_obs()
156 call this%define_listlabel()
169 call this%obs%obs_ad()
180 logical(LGP) :: found
183 if (this%iper /=
kper)
return
185 if (.not. this%readasarrays)
then
187 call mem_set_value(this%nbound,
'NBOUND', this%input_mempath, &
188 found, release=.false.)
191 if (this%readarraygrid)
then
192 call this%nodeu_to_nlist()
193 else if (this%readasarrays)
then
194 call this%layarr_to_nlist()
196 call this%cellid_to_nlist()
199 if (this%inamedbound /= 0)
then
200 do n = 1,
size(this%boundname_cst)
201 this%boundname(n) = this%boundname_cst(n)
216 if (this%iprpak /= 0 .and. this%isadvpak == 0)
then
217 call this%write_lstfile()
228 feature_label, blockname)
result(idx)
231 integer(I4B),
intent(in) :: ifno_val
232 integer(I4B),
intent(in) :: nfeatures
233 integer(I4B),
dimension(:),
intent(inout) :: nboundchk
234 character(len=*),
intent(in) :: feature_label
235 character(len=*),
intent(in) :: blockname
240 if (idx < 1 .or. idx > nfeatures)
then
241 write (
errmsg,
'(a,1x,a,1x,a,i0,a,1x,i0,a)') &
242 trim(blockname), trim(feature_label),
'(', idx, &
243 ') must be greater than 0 and less than or equal to', nfeatures,
'.'
248 nboundchk(idx) = nboundchk(idx) + 1
257 blockname, check_missing)
260 integer(I4B),
dimension(:),
intent(in) :: nboundchk
261 integer(I4B),
intent(in) :: nfeatures
262 character(len=*),
intent(in) :: feature_label
263 character(len=*),
intent(in) :: blockname
264 logical(LGP),
intent(in),
optional :: check_missing
267 logical(LGP) :: do_check_missing
269 do_check_missing = .true.
270 if (
present(check_missing)) do_check_missing = check_missing
273 if (do_check_missing .and. nboundchk(n) == 0)
then
274 write (
errmsg,
'(a,1x,a,1x,a,1x,i0,a)') &
275 trim(blockname),
'no data specified for', trim(feature_label), n,
'.'
277 else if (nboundchk(n) > 1)
then
278 write (
errmsg,
'(a,1x,a,1x,a,1x,i0,1x,a,1x,i0,1x,a)') &
279 trim(blockname),
'data for', trim(feature_label), n, &
280 'specified', nboundchk(n),
'times.'
294 if (this%isadvpak /= 0)
then
297 nullify (this%featureauxvar)
299 nullify (this%pkg_ifno)
305 call mem_deallocate(this%boundname_cst,
'BOUNDNAME_IDM', this%memoryPath)
309 call mem_setptr(this%boundname_cst,
'BOUNDNAME_CST', this%memoryPath)
310 call mem_setptr(this%auxvar,
'AUXVAR', this%memoryPath)
314 deallocate (this%readarraygrid)
315 deallocate (this%readasarrays)
316 deallocate (this%ts_active)
317 nullify (this%readarraygrid)
318 nullify (this%readasarrays)
319 nullify (this%ts_active)
323 call this%BndType%bnd_da()
341 call this%BndType%allocate_scalars()
344 call mem_setptr(this%iper,
'IPER', this%input_mempath)
347 allocate (this%readarraygrid)
348 allocate (this%readasarrays)
349 allocate (this%ts_active)
352 this%readarraygrid = .false.
353 this%readasarrays = .false.
354 this%ts_active = .false.
370 integer(I4B),
dimension(:),
pointer,
contiguous,
optional :: nodelist
371 real(DP),
dimension(:, :),
pointer,
contiguous,
optional :: auxvar
373 if (this%isadvpak /= 0)
then
376 call this%BndType%allocate_arrays(nodelist, auxvar)
377 call mem_checkin(this%auxvar,
'AUXVAR_IDM', this%memoryPath,
'AUXVAR', &
383 call this%BndType%allocate_arrays(nodelist, auxvar)
386 call mem_setptr(this%cellid,
'CELLID', this%input_mempath)
387 call mem_setptr(this%nodeulist,
'NODEULIST', this%input_mempath)
388 call mem_setptr(this%boundname_cst,
'BOUNDNAME', this%input_mempath)
391 call mem_checkin(this%cellid,
'CELLID', this%memoryPath, &
392 'CELLID', this%input_mempath)
393 call mem_checkin(this%nodeulist,
'NODEULIST', this%memoryPath, &
394 'NODEULIST', this%input_mempath)
396 this%memoryPath,
'BOUNDNAME', this%input_mempath)
398 if (
present(auxvar))
then
402 call mem_setptr(this%auxvar,
'AUXVAR', this%input_mempath)
405 call mem_checkin(this%auxvar,
'AUXVAR_IDM', this%memoryPath, &
406 'AUXVAR', this%input_mempath)
421 real(DP),
dimension(:, :),
allocatable :: aux_row_order
422 integer(I4B) :: n, ifeat, jj, nrow
425 call mem_setptr(this%pkg_ifno,
'PACKAGEDATA_IFNO', this%input_mempath)
426 if (this%naux > 0)
then
427 call mem_setptr(this%featureauxvar,
'AUX', this%input_mempath)
428 nrow =
size(this%pkg_ifno)
429 allocate (aux_row_order(this%naux, nrow))
430 aux_row_order = this%featureauxvar(:, 1:nrow)
432 ifeat = this%pkg_ifno(n)
433 if (ifeat < 1 .or. ifeat >
size(this%featureauxvar, 2)) cycle
435 this%featureauxvar(jj, ifeat) = aux_row_order(jj, n)
438 deallocate (aux_row_order)
455 logical(LGP) :: found_readarr
456 character(len=LENAUXNAME) :: sfacauxname
460 call mem_set_value(this%naux,
'NAUX', this%input_mempath, found%naux, &
462 call mem_set_value(this%ipakcb,
'IPAKCB', this%input_mempath, found%ipakcb)
463 call mem_set_value(this%iprpak,
'IPRPAK', this%input_mempath, found%iprpak)
464 call mem_set_value(this%iprflow,
'IPRFLOW', this%input_mempath, found%iprflow)
465 call mem_set_value(this%inamedbound,
'BOUNDNAMES', this%input_mempath, &
466 found%boundnames, release=.false.)
467 call mem_set_value(sfacauxname,
'AUXMULTNAME', this%input_mempath, &
469 call mem_set_value(this%inewton,
'INEWTON', this%input_mempath, found%inewton)
470 call mem_set_value(this%readarraygrid,
'READARRAYGRID', this%input_mempath, &
472 call mem_set_value(this%readasarrays,
'READASARRAYS', this%input_mempath, &
476 call this%log_options(found, sfacauxname)
479 if (found%naux .and. this%naux > 0)
then
481 'AUXNAME', this%memoryPath)
483 'AUXNAME_CST', this%memoryPath)
484 call mem_set_value(this%auxname_cst,
'AUXILIARY', this%input_mempath, &
485 found%auxiliary, release=.false.)
488 this%auxname(n) = this%auxname_cst(n)
493 if (found%ipakcb) this%ipakcb = -1
496 if (found%auxmultname) this%iauxmultcol = -1
500 if (
filein_fname(this%obs%inputFilename,
'OBS6_FILENAME', &
501 this%input_mempath, this%input_fname))
then
502 this%obs%active = .true.
504 call openfile(this%obs%inUnitObs, this%iout, this%obs%inputFilename,
'OBS')
508 if (found%inewton) this%inewton = 0
511 if (this%iauxmultcol < 0)
then
514 if (this%naux == 0)
then
515 write (
errmsg,
'(a,2(1x,a))') &
516 'AUXMULTNAME was specified as', trim(adjustl(sfacauxname)), &
517 'but no AUX variables specified.'
524 if (sfacauxname == this%auxname(n))
then
531 if (this%iauxmultcol == 0)
then
532 write (
errmsg,
'(a,2(1x,a))') &
533 'AUXMULTNAME was specified as', trim(adjustl(sfacauxname)), &
534 'but no AUX variable found with this name.'
539 if (this%readasarrays)
then
540 if (.not. this%dis%supports_layers())
then
541 errmsg =
'READASARRAYS option is not compatible with selected'// &
542 ' discretization type.'
561 character(len=*),
intent(in) :: sfacauxname
564 character(len=*),
parameter :: fmtreadasarrays = &
565 &
"(4x, 'PACKAGE INPUT WILL BE READ AS LAYER ARRAYS.')"
566 character(len=*),
parameter :: fmtreadarraygrid = &
567 &
"(4x, 'PACKAGE INPUT WILL BE READ AS GRID ARRAYS.')"
568 character(len=*),
parameter :: fmtflow = &
569 &
"(4x, 'FLOWS WILL BE SAVED TO BUDGET FILE SPECIFIED IN OUTPUT CONTROL')"
572 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text)) &
575 if (this%readasarrays)
then
576 write (this%iout, fmtreadasarrays)
579 if (this%readarraygrid)
then
580 write (this%iout, fmtreadarraygrid)
583 if (found%ipakcb)
then
584 write (this%iout, fmtflow)
587 if (found%iprpak)
then
588 write (this%iout,
'(4x,a)') &
589 'LISTS OF '//trim(adjustl(this%text))//
' CELLS WILL BE PRINTED.'
592 if (found%iprflow)
then
593 write (this%iout,
'(4x,a)') trim(adjustl(this%text))// &
594 ' FLOWS WILL BE PRINTED TO LISTING FILE.'
597 if (found%boundnames)
then
598 write (this%iout,
'(4x,a)') trim(adjustl(this%text))// &
599 ' BOUNDARIES HAVE NAMES IN LAST COLUMN.'
602 if (found%auxmultname)
then
603 write (this%iout,
'(4x,a,a)') &
604 'AUXILIARY MULTIPLIER NAME: ', sfacauxname
607 if (found%inewton)
then
608 write (this%iout,
'(4x,a)') &
609 'NEWTON-RAPHSON method disabled for unconfined cells'
613 write (this%iout,
'(1x,a)') &
614 'END OF '//trim(adjustl(this%text))//
' BASE OPTIONS'
626 if (this%readasarrays)
then
627 this%maxbound = this%dis%get_ncpl()
630 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text))// &
634 call mem_set_value(this%maxbound,
'MAXBOUND', this%input_mempath, &
635 found%maxbound, release=.false.)
637 write (this%iout,
'(4x,a,i7)')
'MAXBOUND = ', this%maxbound
640 write (this%iout,
'(1x,a)') &
641 'END OF '//trim(adjustl(this%text))//
' BASE DIMENSIONS'
645 if (this%maxbound <= 0)
then
646 write (
errmsg,
'(a)')
'MAXBOUND must be an integer greater than zero.'
663 integer(I4B),
dimension(:),
pointer :: cellid
664 integer(I4B) :: n, nodeu, noder
665 character(len=LINELENGTH) :: nodestr
668 do n = 1, this%nbound
671 cellid => this%cellid(:, n)
674 call this%check_cellid(n, cellid, this%dis%mshape, this%dis%ndim)
677 if (this%dis%ndim == 1)
then
679 elseif (this%dis%ndim == 2)
then
680 nodeu =
get_node(cellid(1), 1, cellid(2), &
681 this%dis%mshape(1), 1, &
684 nodeu =
get_node(cellid(1), cellid(2), cellid(3), &
685 this%dis%mshape(1), &
686 this%dis%mshape(2), &
691 if (this%dis%nodes < this%dis%nodesuser)
then
693 noder = this%dis%get_nodenumber(nodeu, 0)
695 call this%dis%nodeu_to_string(nodeu, nodestr)
697 ' Cell is outside active grid domain: '// &
698 trim(adjustl(nodestr))
701 this%nodelist(n) = noder
703 this%nodelist(n) = nodeu
725 integer(I4B) :: n, noder, nodeuser, ninactive
730 do n = 1, this%nbound
731 nodeuser = this%nodeulist(n)
732 noder = this%dis%get_nodenumber(nodeuser, 0)
734 this%nodelist(n) = noder
736 ninactive = ninactive + 1
741 this%nbound = this%nbound - ninactive
760 character(len=LENVARNAME) :: ilayname, inilayname
761 character(len=24) :: aname =
' LAYER OR NODE INDEX'
763 integer(I4B),
dimension(:),
contiguous, &
764 pointer :: ilay => null()
765 integer(I4B),
pointer :: inilay => null()
768 ilayname =
'I'//trim(this%filtyp)
769 inilayname =
'INI'//trim(this%filtyp)
772 call mem_setptr(inilay, inilayname, this%input_mempath)
775 if (inilay == 1)
then
779 call mem_setptr(ilay, ilayname, this%input_mempath)
782 call this%dis%nlarray_to_nodelist(ilay, this%nodelist, this%maxbound, &
795 integer(I4B) :: il, ir, ic, ncol, nrow, nlay, nodeu, noder, ipos
797 if (this%readasarrays)
then
800 if (this%dis%ndim == 3)
then
801 nlay = this%dis%mshape(1)
802 nrow = this%dis%mshape(2)
803 ncol = this%dis%mshape(3)
804 elseif (this%dis%ndim == 2)
then
805 nlay = this%dis%mshape(1)
807 ncol = this%dis%mshape(2)
815 nodeu =
get_node(il, ir, ic, nlay, nrow, ncol)
816 noder = this%dis%get_nodenumber(nodeu, 0)
817 this%nodelist(ipos) = noder
823 this%nbound = ipos - 1
835 integer(I4B),
intent(in) :: ii
836 integer(I4B),
dimension(:),
intent(in) :: cellid
837 integer(I4B),
dimension(:),
intent(in) :: mshape
838 integer(I4B),
intent(in) :: ndim
839 character(len=20) :: cellstr, mshstr
840 character(len=*),
parameter :: fmterr = &
841 "('List entry ',i0,' contains cellid ',a,' but this cellid is invalid &
842 &for model with shape ', a)"
843 character(len=*),
parameter :: fmtndim1 = &
845 character(len=*),
parameter :: fmtndim2 = &
846 "('(',i0,',',i0,')')"
847 character(len=*),
parameter :: fmtndim3 = &
848 "('(',i0,',',i0,',',i0,')')"
852 if (cellid(1) < 1 .or. cellid(1) > mshape(1))
then
853 write (cellstr, fmtndim1) cellid(1)
854 write (mshstr, fmtndim1) mshape(1)
855 write (
errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
861 if (cellid(1) < 1 .or. cellid(1) > mshape(1) .or. &
862 cellid(2) < 1 .or. cellid(2) > mshape(2))
then
863 write (cellstr, fmtndim2) cellid(1), cellid(2)
864 write (mshstr, fmtndim2) mshape(1), mshape(2)
865 write (
errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
871 if (cellid(1) < 1 .or. cellid(1) > mshape(1) .or. &
872 cellid(2) < 1 .or. cellid(2) > mshape(2) .or. &
873 cellid(3) < 1 .or. cellid(3) > mshape(3))
then
874 write (cellstr, fmtndim3) cellid(1), cellid(2), cellid(3)
875 write (mshstr, fmtndim3) mshape(1), mshape(2), mshape(3)
876 write (
errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
899 character(len=10) :: cpos
900 character(len=LINELENGTH) :: tag
901 character(len=LINELENGTH),
allocatable,
dimension(:) :: words
902 integer(I4B) :: ntabrows
903 integer(I4B) :: ntabcols
905 integer(I4B) :: ii, jj, i, j, k, nod
908 type(
tabletype),
pointer :: inputtab => null()
910 character(len=LINELENGTH) :: fmtlstbn
914 naux =
size(this%auxvar, 1)
917 ntabrows = this%nbound
921 ipos = index(this%listlabel,
'NO.')
923 write (cpos,
'(i10)') ipos + 3
924 fmtlstbn =
'(a'//trim(adjustl(cpos))
929 if (
size(this%dis%mshape) == 3)
then
931 fmtlstbn = trim(fmtlstbn)//
',a7,a7,a7'
934 else if (
size(this%dis%mshape) == 2)
then
936 fmtlstbn = trim(fmtlstbn)//
',a7,a7'
941 fmtlstbn = trim(fmtlstbn)//
',a7'
945 ntabcols = ntabcols + ldim
947 fmtlstbn = trim(fmtlstbn)//
',a16'
951 if (this%inamedbound == 1)
then
952 ntabcols = ntabcols + 1
953 fmtlstbn = trim(fmtlstbn)//
',a16'
957 ntabcols = ntabcols + naux
959 fmtlstbn = trim(fmtlstbn)//
',a16'
961 fmtlstbn = trim(fmtlstbn)//
')'
964 allocate (words(ntabcols))
967 read (this%listlabel, fmtlstbn) (words(i), i=1, ntabcols)
971 call inputtab%table_df(ntabrows, ntabcols, this%iout)
975 call inputtab%initialize_column(words(ipos), 10, alignment=
tabcenter)
978 do i = 1,
size(this%dis%mshape)
980 call inputtab%initialize_column(words(ipos), 7, alignment=
tabcenter)
986 call inputtab%initialize_column(words(ipos), 16, alignment=
tabcenter)
990 if (this%inamedbound == 1)
then
998 call inputtab%initialize_column(this%auxname(i), 16, alignment=
tabcenter)
1002 do ii = 1, this%nbound
1003 call inputtab%add_term(ii)
1006 if (
size(this%dis%mshape) == 3)
then
1007 nod = this%nodelist(ii)
1008 call get_ijk(nod, this%dis%mshape(2), this%dis%mshape(3), &
1009 this%dis%mshape(1), i, j, k)
1010 call inputtab%add_term(k)
1011 call inputtab%add_term(i)
1012 call inputtab%add_term(j)
1013 else if (
size(this%dis%mshape) == 2)
then
1014 nod = this%nodelist(ii)
1015 call get_ijk(nod, 1, this%dis%mshape(2), this%dis%mshape(1), i, j, k)
1016 call inputtab%add_term(k)
1017 call inputtab%add_term(j)
1019 nod = this%nodelist(ii)
1020 call inputtab%add_term(nod)
1025 call inputtab%add_term(this%bound_value(jj, ii))
1029 if (this%inamedbound == 1)
then
1030 call inputtab%add_term(this%boundname(ii))
1035 call inputtab%add_term(this%auxvar(jj, ii))
1040 call inputtab%table_da()
1041 deallocate (inputtab)
1058 integer(I4B),
intent(in) :: col
1059 integer(I4B),
intent(in) :: row
This module contains the extended boundary package.
subroutine bndext_ad(this)
Advance the package one time step.
integer(i4b) function validate_ifno(this, ifno_val, nfeatures, nboundchk, feature_label, blockname)
@ brief Validate a list-input row's IFNO and update the per-feature coverage counter
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 allocate_featureauxvar(this)
Point the per-feature auxiliary variable array at the input context's permanent, feature-indexed AUX ...
subroutine default_nodelist(this)
Assign default nodelist when READASARRAYS is specified.
subroutine write_lstfile(this)
@ brief Log package stress period input
subroutine report_ifno_coverage(this, nboundchk, nfeatures, feature_label, blockname, check_missing)
@ brief Report missing or duplicate list-input rows for each feature
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.
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
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 ...