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, &
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)
310 call mem_set_value(this%ipakcb,
'IPAKCB', this%input_mempath, found%ipakcb)
311 call mem_set_value(this%iprpak,
'IPRPAK', this%input_mempath, found%iprpak)
312 call mem_set_value(this%iprflow,
'IPRFLOW', this%input_mempath, found%iprflow)
313 call mem_set_value(this%inamedbound,
'BOUNDNAMES', this%input_mempath, &
315 call mem_set_value(sfacauxname,
'AUXMULTNAME', this%input_mempath, &
317 call mem_set_value(this%inewton,
'INEWTON', this%input_mempath, found%inewton)
318 call mem_set_value(this%readarraygrid,
'READARRAYGRID', this%input_mempath, &
320 call mem_set_value(this%readasarrays,
'READASARRAYS', this%input_mempath, &
324 call this%log_options(found, sfacauxname)
327 if (found%naux .and. this%naux > 0)
then
329 'AUXNAME', this%memoryPath)
331 'AUXNAME_CST', this%memoryPath)
332 call mem_set_value(this%auxname_cst,
'AUXILIARY', this%input_mempath, &
336 this%auxname(n) = this%auxname_cst(n)
341 if (found%ipakcb) this%ipakcb = -1
344 if (found%auxmultname) this%iauxmultcol = -1
348 if (
filein_fname(this%obs%inputFilename,
'OBS6_FILENAME', &
349 this%input_mempath, this%input_fname))
then
350 this%obs%active = .true.
352 call openfile(this%obs%inUnitObs, this%iout, this%obs%inputFilename,
'OBS')
356 if (found%inewton) this%inewton = 0
359 if (this%iauxmultcol < 0)
then
362 if (this%naux == 0)
then
363 write (
errmsg,
'(a,2(1x,a))') &
364 'AUXMULTNAME was specified as', trim(adjustl(sfacauxname)), &
365 'but no AUX variables specified.'
372 if (sfacauxname == this%auxname(n))
then
379 if (this%iauxmultcol == 0)
then
380 write (
errmsg,
'(a,2(1x,a))') &
381 'AUXMULTNAME was specified as', trim(adjustl(sfacauxname)), &
382 'but no AUX variable found with this name.'
387 if (this%readasarrays)
then
388 if (.not. this%dis%supports_layers())
then
389 errmsg =
'READASARRAYS option is not compatible with selected'// &
390 ' discretization type.'
409 character(len=*),
intent(in) :: sfacauxname
412 character(len=*),
parameter :: fmtreadasarrays = &
413 &
"(4x, 'PACKAGE INPUT WILL BE READ AS LAYER ARRAYS.')"
414 character(len=*),
parameter :: fmtreadarraygrid = &
415 &
"(4x, 'PACKAGE INPUT WILL BE READ AS GRID ARRAYS.')"
416 character(len=*),
parameter :: fmtflow = &
417 &
"(4x, 'FLOWS WILL BE SAVED TO BUDGET FILE SPECIFIED IN OUTPUT CONTROL')"
420 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text)) &
423 if (this%readasarrays)
then
424 write (this%iout, fmtreadasarrays)
427 if (this%readarraygrid)
then
428 write (this%iout, fmtreadarraygrid)
431 if (found%ipakcb)
then
432 write (this%iout, fmtflow)
435 if (found%iprpak)
then
436 write (this%iout,
'(4x,a)') &
437 'LISTS OF '//trim(adjustl(this%text))//
' CELLS WILL BE PRINTED.'
440 if (found%iprflow)
then
441 write (this%iout,
'(4x,a)') trim(adjustl(this%text))// &
442 ' FLOWS WILL BE PRINTED TO LISTING FILE.'
445 if (found%boundnames)
then
446 write (this%iout,
'(4x,a)') trim(adjustl(this%text))// &
447 ' BOUNDARIES HAVE NAMES IN LAST COLUMN.'
450 if (found%auxmultname)
then
451 write (this%iout,
'(4x,a,a)') &
452 'AUXILIARY MULTIPLIER NAME: ', sfacauxname
455 if (found%inewton)
then
456 write (this%iout,
'(4x,a)') &
457 'NEWTON-RAPHSON method disabled for unconfined cells'
461 write (this%iout,
'(1x,a)') &
462 'END OF '//trim(adjustl(this%text))//
' BASE OPTIONS'
474 if (this%readasarrays)
then
475 this%maxbound = this%dis%get_ncpl()
478 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text))// &
482 call mem_set_value(this%maxbound,
'MAXBOUND', this%input_mempath, &
485 write (this%iout,
'(4x,a,i7)')
'MAXBOUND = ', this%maxbound
488 write (this%iout,
'(1x,a)') &
489 'END OF '//trim(adjustl(this%text))//
' BASE DIMENSIONS'
493 if (this%maxbound <= 0)
then
494 write (
errmsg,
'(a)')
'MAXBOUND must be an integer greater than zero.'
511 integer(I4B),
dimension(:),
pointer :: cellid
512 integer(I4B) :: n, nodeu, noder
513 character(len=LINELENGTH) :: nodestr
516 do n = 1, this%nbound
519 cellid => this%cellid(:, n)
522 call this%check_cellid(n, cellid, this%dis%mshape, this%dis%ndim)
525 if (this%dis%ndim == 1)
then
527 elseif (this%dis%ndim == 2)
then
528 nodeu =
get_node(cellid(1), 1, cellid(2), &
529 this%dis%mshape(1), 1, &
532 nodeu =
get_node(cellid(1), cellid(2), cellid(3), &
533 this%dis%mshape(1), &
534 this%dis%mshape(2), &
539 if (this%dis%nodes < this%dis%nodesuser)
then
541 noder = this%dis%get_nodenumber(nodeu, 0)
543 call this%dis%nodeu_to_string(nodeu, nodestr)
545 ' Cell is outside active grid domain: '// &
546 trim(adjustl(nodestr))
549 this%nodelist(n) = noder
551 this%nodelist(n) = nodeu
573 integer(I4B) :: n, noder, nodeuser, ninactive
578 do n = 1, this%nbound
579 nodeuser = this%nodeulist(n)
580 noder = this%dis%get_nodenumber(nodeuser, 0)
582 this%nodelist(n) = noder
584 ninactive = ninactive + 1
589 this%nbound = this%nbound - ninactive
608 character(len=LENVARNAME) :: ilayname, inilayname
609 character(len=24) :: aname =
' LAYER OR NODE INDEX'
611 integer(I4B),
dimension(:),
contiguous, &
612 pointer :: ilay => null()
613 integer(I4B),
pointer :: inilay => null()
616 ilayname =
'I'//trim(this%filtyp)
617 inilayname =
'INI'//trim(this%filtyp)
620 call mem_setptr(inilay, inilayname, this%input_mempath)
623 if (inilay == 1)
then
627 call mem_setptr(ilay, ilayname, this%input_mempath)
630 call this%dis%nlarray_to_nodelist(ilay, this%nodelist, this%maxbound, &
643 integer(I4B) :: il, ir, ic, ncol, nrow, nlay, nodeu, noder, ipos
645 if (this%readasarrays)
then
648 if (this%dis%ndim == 3)
then
649 nlay = this%dis%mshape(1)
650 nrow = this%dis%mshape(2)
651 ncol = this%dis%mshape(3)
652 elseif (this%dis%ndim == 2)
then
653 nlay = this%dis%mshape(1)
655 ncol = this%dis%mshape(2)
663 nodeu =
get_node(il, ir, ic, nlay, nrow, ncol)
664 noder = this%dis%get_nodenumber(nodeu, 0)
665 this%nodelist(ipos) = noder
671 this%nbound = ipos - 1
683 integer(I4B),
intent(in) :: ii
684 integer(I4B),
dimension(:),
intent(in) :: cellid
685 integer(I4B),
dimension(:),
intent(in) :: mshape
686 integer(I4B),
intent(in) :: ndim
687 character(len=20) :: cellstr, mshstr
688 character(len=*),
parameter :: fmterr = &
689 "('List entry ',i0,' contains cellid ',a,' but this cellid is invalid &
690 &for model with shape ', a)"
691 character(len=*),
parameter :: fmtndim1 = &
693 character(len=*),
parameter :: fmtndim2 = &
694 "('(',i0,',',i0,')')"
695 character(len=*),
parameter :: fmtndim3 = &
696 "('(',i0,',',i0,',',i0,')')"
700 if (cellid(1) < 1 .or. cellid(1) > mshape(1))
then
701 write (cellstr, fmtndim1) cellid(1)
702 write (mshstr, fmtndim1) mshape(1)
703 write (
errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
709 if (cellid(1) < 1 .or. cellid(1) > mshape(1) .or. &
710 cellid(2) < 1 .or. cellid(2) > mshape(2))
then
711 write (cellstr, fmtndim2) cellid(1), cellid(2)
712 write (mshstr, fmtndim2) mshape(1), mshape(2)
713 write (
errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
719 if (cellid(1) < 1 .or. cellid(1) > mshape(1) .or. &
720 cellid(2) < 1 .or. cellid(2) > mshape(2) .or. &
721 cellid(3) < 1 .or. cellid(3) > mshape(3))
then
722 write (cellstr, fmtndim3) cellid(1), cellid(2), cellid(3)
723 write (mshstr, fmtndim3) mshape(1), mshape(2), mshape(3)
724 write (
errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
747 character(len=10) :: cpos
748 character(len=LINELENGTH) :: tag
749 character(len=LINELENGTH),
allocatable,
dimension(:) :: words
750 integer(I4B) :: ntabrows
751 integer(I4B) :: ntabcols
753 integer(I4B) :: ii, jj, i, j, k, nod
756 type(
tabletype),
pointer :: inputtab => null()
758 character(len=LINELENGTH) :: fmtlstbn
762 naux =
size(this%auxvar, 1)
765 ntabrows = this%nbound
769 ipos = index(this%listlabel,
'NO.')
771 write (cpos,
'(i10)') ipos + 3
772 fmtlstbn =
'(a'//trim(adjustl(cpos))
777 if (
size(this%dis%mshape) == 3)
then
779 fmtlstbn = trim(fmtlstbn)//
',a7,a7,a7'
782 else if (
size(this%dis%mshape) == 2)
then
784 fmtlstbn = trim(fmtlstbn)//
',a7,a7'
789 fmtlstbn = trim(fmtlstbn)//
',a7'
793 ntabcols = ntabcols + ldim
795 fmtlstbn = trim(fmtlstbn)//
',a16'
799 if (this%inamedbound == 1)
then
800 ntabcols = ntabcols + 1
801 fmtlstbn = trim(fmtlstbn)//
',a16'
805 ntabcols = ntabcols + naux
807 fmtlstbn = trim(fmtlstbn)//
',a16'
809 fmtlstbn = trim(fmtlstbn)//
')'
812 allocate (words(ntabcols))
815 read (this%listlabel, fmtlstbn) (words(i), i=1, ntabcols)
819 call inputtab%table_df(ntabrows, ntabcols, this%iout)
823 call inputtab%initialize_column(words(ipos), 10, alignment=
tabcenter)
826 do i = 1,
size(this%dis%mshape)
828 call inputtab%initialize_column(words(ipos), 7, alignment=
tabcenter)
834 call inputtab%initialize_column(words(ipos), 16, alignment=
tabcenter)
838 if (this%inamedbound == 1)
then
846 call inputtab%initialize_column(this%auxname(i), 16, alignment=
tabcenter)
850 do ii = 1, this%nbound
851 call inputtab%add_term(ii)
854 if (
size(this%dis%mshape) == 3)
then
855 nod = this%nodelist(ii)
856 call get_ijk(nod, this%dis%mshape(2), this%dis%mshape(3), &
857 this%dis%mshape(1), i, j, k)
858 call inputtab%add_term(k)
859 call inputtab%add_term(i)
860 call inputtab%add_term(j)
861 else if (
size(this%dis%mshape) == 2)
then
862 nod = this%nodelist(ii)
863 call get_ijk(nod, 1, this%dis%mshape(2), this%dis%mshape(1), i, j, k)
864 call inputtab%add_term(k)
865 call inputtab%add_term(j)
867 nod = this%nodelist(ii)
868 call inputtab%add_term(nod)
873 call inputtab%add_term(this%bound_value(jj, ii))
877 if (this%inamedbound == 1)
then
878 call inputtab%add_term(this%boundname(ii))
883 call inputtab%add_term(this%auxvar(jj, ii))
888 call inputtab%table_da()
889 deallocate (inputtab)
906 integer(I4B),
intent(in) :: col
907 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 ...