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()
63 logical :: naux = .false.
64 logical :: ipakcb = .false.
65 logical :: iprpak = .false.
66 logical :: iprflow = .false.
67 logical :: boundnames = .false.
68 logical :: auxmultname = .false.
69 logical :: inewton = .false.
70 logical :: auxiliary = .false.
71 logical :: maxbound = .false.
90 integer(I4B),
intent(inout) :: neq
99 call tasmanager_cr(this%TasManager, dis, this%name_model, this%iout)
102 call obs_cr(this%obs, this%inobspkg)
105 write (this%iout, 1) trim(this%filtyp), trim(adjustl(this%text)), &
107 1
format(1x, /1x, a,
' -- ', a,
' PACKAGE, VERSION 8, 2/22/2014', &
108 ' INPUT READ FROM MEMPATH: ', a)
111 call this%source_options()
114 call this%tsmanager%tsmanager_df()
115 call this%tasmanager%tasmanager_df()
118 call this%source_dimensions()
121 if (this%npakeq > 0)
then
122 this%ioffset = neq - this%dis%nodes
126 neq = neq + this%npakeq
129 if (this%bnd_obs_supported())
then
130 call this%obs%obs_df(this%iout, this%packName, this%filtyp, this%dis)
131 call this%bnd_df_obs()
136 call this%define_listlabel()
147 logical(LGP) :: found
150 if (this%iper /=
kper)
return
152 if (.not. this%readasarrays)
then
154 call mem_set_value(this%nbound,
'NBOUND', this%input_mempath, &
158 if (this%readarraygrid)
then
159 call this%nodeu_to_nlist()
160 else if (this%readasarrays)
then
161 call this%layarr_to_nlist()
163 call this%cellid_to_nlist()
166 if (this%inamedbound /= 0)
then
167 do n = 1,
size(this%boundname_cst)
168 this%boundname(n) = this%boundname_cst(n)
185 call mem_deallocate(this%boundname_cst,
'BOUNDNAME_IDM', this%memoryPath)
189 call mem_setptr(this%boundname_cst,
'BOUNDNAME_CST', this%memoryPath)
190 call mem_setptr(this%auxvar,
'AUXVAR', this%memoryPath)
193 deallocate (this%readarraygrid)
194 deallocate (this%readasarrays)
195 nullify (this%readarraygrid)
196 nullify (this%readasarrays)
200 call this%BndType%bnd_da()
218 call this%BndType%allocate_scalars()
221 call mem_setptr(this%iper,
'IPER', this%input_mempath)
224 allocate (this%readarraygrid)
225 allocate (this%readasarrays)
228 this%readarraygrid = .false.
229 this%readasarrays = .false.
245 integer(I4B),
dimension(:),
pointer,
contiguous,
optional :: nodelist
246 real(DP),
dimension(:, :),
pointer,
contiguous,
optional :: auxvar
249 call this%BndType%allocate_arrays(nodelist, auxvar)
252 call mem_setptr(this%cellid,
'CELLID', this%input_mempath)
253 call mem_setptr(this%nodeulist,
'NODEULIST', this%input_mempath)
254 call mem_setptr(this%boundname_cst,
'BOUNDNAME', this%input_mempath)
257 call mem_checkin(this%cellid,
'CELLID', this%memoryPath, &
258 'CELLID', this%input_mempath)
259 call mem_checkin(this%nodeulist,
'NODEULIST', this%memoryPath, &
260 'NODEULIST', this%input_mempath)
262 this%memoryPath,
'BOUNDNAME', this%input_mempath)
264 if (
present(auxvar))
then
268 call mem_setptr(this%auxvar,
'AUXVAR', this%input_mempath)
271 call mem_checkin(this%auxvar,
'AUXVAR_IDM', this%memoryPath, &
272 'AUXVAR', this%input_mempath)
289 logical(LGP) :: found_readarr
290 character(len=LENAUXNAME) :: sfacauxname
294 call mem_set_value(this%naux,
'NAUX', this%input_mempath, found%naux)
295 call mem_set_value(this%ipakcb,
'IPAKCB', this%input_mempath, found%ipakcb)
296 call mem_set_value(this%iprpak,
'IPRPAK', this%input_mempath, found%iprpak)
297 call mem_set_value(this%iprflow,
'IPRFLOW', this%input_mempath, found%iprflow)
298 call mem_set_value(this%inamedbound,
'BOUNDNAMES', this%input_mempath, &
300 call mem_set_value(sfacauxname,
'AUXMULTNAME', this%input_mempath, &
302 call mem_set_value(this%inewton,
'INEWTON', this%input_mempath, found%inewton)
303 call mem_set_value(this%readarraygrid,
'READARRAYGRID', this%input_mempath, &
305 call mem_set_value(this%readasarrays,
'READASARRAYS', this%input_mempath, &
309 call this%log_options(found, sfacauxname)
312 if (found%naux .and. this%naux > 0)
then
314 'AUXNAME', this%memoryPath)
316 'AUXNAME_CST', this%memoryPath)
317 call mem_set_value(this%auxname_cst,
'AUXILIARY', this%input_mempath, &
321 this%auxname(n) = this%auxname_cst(n)
326 if (found%ipakcb) this%ipakcb = -1
329 if (found%auxmultname) this%iauxmultcol = -1
333 if (
filein_fname(this%obs%inputFilename,
'OBS6_FILENAME', &
334 this%input_mempath, this%input_fname))
then
335 this%obs%active = .true.
337 call openfile(this%obs%inUnitObs, this%iout, this%obs%inputFilename,
'OBS')
341 if (found%inewton) this%inewton = 0
344 if (this%iauxmultcol < 0)
then
347 if (this%naux == 0)
then
348 write (
errmsg,
'(a,2(1x,a))') &
349 'AUXMULTNAME was specified as', trim(adjustl(sfacauxname)), &
350 'but no AUX variables specified.'
357 if (sfacauxname == this%auxname(n))
then
364 if (this%iauxmultcol == 0)
then
365 write (
errmsg,
'(a,2(1x,a))') &
366 'AUXMULTNAME was specified as', trim(adjustl(sfacauxname)), &
367 'but no AUX variable found with this name.'
372 if (this%readasarrays)
then
373 if (.not. this%dis%supports_layers())
then
374 errmsg =
'READASARRAYS option is not compatible with selected'// &
375 ' discretization type.'
394 character(len=*),
intent(in) :: sfacauxname
397 character(len=*),
parameter :: fmtreadasarrays = &
398 &
"(4x, 'PACKAGE INPUT WILL BE READ AS LAYER ARRAYS.')"
399 character(len=*),
parameter :: fmtreadarraygrid = &
400 &
"(4x, 'PACKAGE INPUT WILL BE READ AS GRID ARRAYS.')"
401 character(len=*),
parameter :: fmtflow = &
402 &
"(4x, 'FLOWS WILL BE SAVED TO BUDGET FILE SPECIFIED IN OUTPUT CONTROL')"
405 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text)) &
408 if (this%readasarrays)
then
409 write (this%iout, fmtreadasarrays)
412 if (this%readarraygrid)
then
413 write (this%iout, fmtreadarraygrid)
416 if (found%ipakcb)
then
417 write (this%iout, fmtflow)
420 if (found%iprpak)
then
421 write (this%iout,
'(4x,a)') &
422 'LISTS OF '//trim(adjustl(this%text))//
' CELLS WILL BE PRINTED.'
425 if (found%iprflow)
then
426 write (this%iout,
'(4x,a)') trim(adjustl(this%text))// &
427 ' FLOWS WILL BE PRINTED TO LISTING FILE.'
430 if (found%boundnames)
then
431 write (this%iout,
'(4x,a)') trim(adjustl(this%text))// &
432 ' BOUNDARIES HAVE NAMES IN LAST COLUMN.'
435 if (found%auxmultname)
then
436 write (this%iout,
'(4x,a,a)') &
437 'AUXILIARY MULTIPLIER NAME: ', sfacauxname
440 if (found%inewton)
then
441 write (this%iout,
'(4x,a)') &
442 'NEWTON-RAPHSON method disabled for unconfined cells'
446 write (this%iout,
'(1x,a)') &
447 'END OF '//trim(adjustl(this%text))//
' BASE OPTIONS'
459 if (this%readasarrays)
then
460 this%maxbound = this%dis%get_ncpl()
463 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text))// &
467 call mem_set_value(this%maxbound,
'MAXBOUND', this%input_mempath, &
470 write (this%iout,
'(4x,a,i7)')
'MAXBOUND = ', this%maxbound
473 write (this%iout,
'(1x,a)') &
474 'END OF '//trim(adjustl(this%text))//
' BASE DIMENSIONS'
478 if (this%maxbound <= 0)
then
479 write (
errmsg,
'(a)')
'MAXBOUND must be an integer greater than zero.'
496 integer(I4B),
dimension(:),
pointer :: cellid
497 integer(I4B) :: n, nodeu, noder
498 character(len=LINELENGTH) :: nodestr
501 do n = 1, this%nbound
504 cellid => this%cellid(:, n)
507 call this%check_cellid(n, cellid, this%dis%mshape, this%dis%ndim)
510 if (this%dis%ndim == 1)
then
512 elseif (this%dis%ndim == 2)
then
513 nodeu =
get_node(cellid(1), 1, cellid(2), &
514 this%dis%mshape(1), 1, &
517 nodeu =
get_node(cellid(1), cellid(2), cellid(3), &
518 this%dis%mshape(1), &
519 this%dis%mshape(2), &
524 if (this%dis%nodes < this%dis%nodesuser)
then
526 noder = this%dis%get_nodenumber(nodeu, 0)
528 call this%dis%nodeu_to_string(nodeu, nodestr)
530 ' Cell is outside active grid domain: '// &
531 trim(adjustl(nodestr))
534 this%nodelist(n) = noder
536 this%nodelist(n) = nodeu
558 integer(I4B) :: n, noder, nodeuser, ninactive
563 do n = 1, this%nbound
564 nodeuser = this%nodeulist(n)
565 noder = this%dis%get_nodenumber(nodeuser, 0)
567 this%nodelist(n) = noder
569 ninactive = ninactive + 1
574 this%nbound = this%nbound - ninactive
593 character(len=LENVARNAME) :: ilayname, inilayname
594 character(len=24) :: aname =
' LAYER OR NODE INDEX'
596 integer(I4B),
dimension(:),
contiguous, &
597 pointer :: ilay => null()
598 integer(I4B),
pointer :: inilay => null()
601 ilayname =
'I'//trim(this%filtyp)
602 inilayname =
'INI'//trim(this%filtyp)
605 call mem_setptr(inilay, inilayname, this%input_mempath)
608 if (inilay == 1)
then
612 call mem_setptr(ilay, ilayname, this%input_mempath)
615 call this%dis%nlarray_to_nodelist(ilay, this%nodelist, this%maxbound, &
628 integer(I4B) :: il, ir, ic, ncol, nrow, nlay, nodeu, noder, ipos
630 if (this%readasarrays)
then
633 if (this%dis%ndim == 3)
then
634 nlay = this%dis%mshape(1)
635 nrow = this%dis%mshape(2)
636 ncol = this%dis%mshape(3)
637 elseif (this%dis%ndim == 2)
then
638 nlay = this%dis%mshape(1)
640 ncol = this%dis%mshape(2)
648 nodeu =
get_node(il, ir, ic, nlay, nrow, ncol)
649 noder = this%dis%get_nodenumber(nodeu, 0)
650 this%nodelist(ipos) = noder
656 this%nbound = ipos - 1
668 integer(I4B),
intent(in) :: ii
669 integer(I4B),
dimension(:),
intent(in) :: cellid
670 integer(I4B),
dimension(:),
intent(in) :: mshape
671 integer(I4B),
intent(in) :: ndim
672 character(len=20) :: cellstr, mshstr
673 character(len=*),
parameter :: fmterr = &
674 "('List entry ',i0,' contains cellid ',a,' but this cellid is invalid &
675 &for model with shape ', a)"
676 character(len=*),
parameter :: fmtndim1 = &
678 character(len=*),
parameter :: fmtndim2 = &
679 "('(',i0,',',i0,')')"
680 character(len=*),
parameter :: fmtndim3 = &
681 "('(',i0,',',i0,',',i0,')')"
685 if (cellid(1) < 1 .or. cellid(1) > mshape(1))
then
686 write (cellstr, fmtndim1) cellid(1)
687 write (mshstr, fmtndim1) mshape(1)
688 write (
errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
694 if (cellid(1) < 1 .or. cellid(1) > mshape(1) .or. &
695 cellid(2) < 1 .or. cellid(2) > mshape(2))
then
696 write (cellstr, fmtndim2) cellid(1), cellid(2)
697 write (mshstr, fmtndim2) mshape(1), mshape(2)
698 write (
errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
704 if (cellid(1) < 1 .or. cellid(1) > mshape(1) .or. &
705 cellid(2) < 1 .or. cellid(2) > mshape(2) .or. &
706 cellid(3) < 1 .or. cellid(3) > mshape(3))
then
707 write (cellstr, fmtndim3) cellid(1), cellid(2), cellid(3)
708 write (mshstr, fmtndim3) mshape(1), mshape(2), mshape(3)
709 write (
errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
732 character(len=10) :: cpos
733 character(len=LINELENGTH) :: tag
734 character(len=LINELENGTH),
allocatable,
dimension(:) :: words
735 integer(I4B) :: ntabrows
736 integer(I4B) :: ntabcols
738 integer(I4B) :: ii, jj, i, j, k, nod
741 type(
tabletype),
pointer :: inputtab => null()
743 character(len=LINELENGTH) :: fmtlstbn
747 naux =
size(this%auxvar, 1)
750 ntabrows = this%nbound
754 ipos = index(this%listlabel,
'NO.')
756 write (cpos,
'(i10)') ipos + 3
757 fmtlstbn =
'(a'//trim(adjustl(cpos))
762 if (
size(this%dis%mshape) == 3)
then
764 fmtlstbn = trim(fmtlstbn)//
',a7,a7,a7'
767 else if (
size(this%dis%mshape) == 2)
then
769 fmtlstbn = trim(fmtlstbn)//
',a7,a7'
774 fmtlstbn = trim(fmtlstbn)//
',a7'
778 ntabcols = ntabcols + ldim
780 fmtlstbn = trim(fmtlstbn)//
',a16'
784 if (this%inamedbound == 1)
then
785 ntabcols = ntabcols + 1
786 fmtlstbn = trim(fmtlstbn)//
',a16'
790 ntabcols = ntabcols + naux
792 fmtlstbn = trim(fmtlstbn)//
',a16'
794 fmtlstbn = trim(fmtlstbn)//
')'
797 allocate (words(ntabcols))
800 read (this%listlabel, fmtlstbn) (words(i), i=1, ntabcols)
804 call inputtab%table_df(ntabrows, ntabcols, this%iout)
808 call inputtab%initialize_column(words(ipos), 10, alignment=
tabcenter)
811 do i = 1,
size(this%dis%mshape)
813 call inputtab%initialize_column(words(ipos), 7, alignment=
tabcenter)
819 call inputtab%initialize_column(words(ipos), 16, alignment=
tabcenter)
823 if (this%inamedbound == 1)
then
831 call inputtab%initialize_column(this%auxname(i), 16, alignment=
tabcenter)
835 do ii = 1, this%nbound
836 call inputtab%add_term(ii)
839 if (
size(this%dis%mshape) == 3)
then
840 nod = this%nodelist(ii)
841 call get_ijk(nod, this%dis%mshape(2), this%dis%mshape(3), &
842 this%dis%mshape(1), i, j, k)
843 call inputtab%add_term(k)
844 call inputtab%add_term(i)
845 call inputtab%add_term(j)
846 else if (
size(this%dis%mshape) == 2)
then
847 nod = this%nodelist(ii)
848 call get_ijk(nod, 1, this%dis%mshape(2), this%dis%mshape(1), i, j, k)
849 call inputtab%add_term(k)
850 call inputtab%add_term(j)
852 nod = this%nodelist(ii)
853 call inputtab%add_term(nod)
858 call inputtab%add_term(this%bound_value(jj, ii))
862 if (this%inamedbound == 1)
then
863 call inputtab%add_term(this%boundname(ii))
868 call inputtab%add_term(this%auxvar(jj, ii))
873 call inputtab%table_da()
874 deallocate (inputtab)
891 integer(I4B),
intent(in) :: col
892 integer(I4B),
intent(in) :: row
This module contains the extended boundary package.
subroutine bndext_rp(this)
subroutine write_list(this)
@ brief Log package list input
subroutine bndext_allocate_arrays(this, nodelist, auxvar)
@ brief Allocate package arrays
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 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 ...