33 integer(I4B),
pointer :: iper
35 integer(I4B),
dimension(:, :),
pointer,
contiguous :: cellid => null()
57 logical :: naux = .false.
58 logical :: ipakcb = .false.
59 logical :: iprpak = .false.
60 logical :: iprflow = .false.
61 logical :: boundnames = .false.
62 logical :: auxmultname = .false.
63 logical :: inewton = .false.
64 logical :: auxiliary = .false.
65 logical :: maxbound = .false.
84 integer(I4B),
intent(inout) :: neq
93 call tasmanager_cr(this%TasManager, dis, this%name_model, this%iout)
96 call obs_cr(this%obs, this%inobspkg)
99 write (this%iout, 1) this%filtyp, trim(adjustl(this%text)), this%input_mempath
100 1
format(1x, /1x, a,
' -- ', a,
' PACKAGE, VERSION 8, 2/22/2014', &
101 ' INPUT READ FROM MEMPATH: ', a)
104 call this%source_options()
107 call this%tsmanager%tsmanager_df()
108 call this%tasmanager%tasmanager_df()
111 call this%source_dimensions()
114 if (this%npakeq > 0)
then
115 this%ioffset = neq - this%dis%nodes
119 neq = neq + this%npakeq
122 if (this%bnd_obs_supported())
then
123 call this%obs%obs_df(this%iout, this%packName, this%filtyp, this%dis)
124 call this%bnd_df_obs()
136 logical(LGP) :: found
139 if (this%iper /=
kper)
return
142 call mem_set_value(this%nbound,
'NBOUND', this%input_mempath, &
146 call this%nodelist_update()
149 if (this%inamedbound /= 0)
then
150 do n = 1,
size(this%boundname_cst)
151 this%boundname(n) = this%boundname_cst(n)
166 call mem_deallocate(this%boundname_cst,
'BOUNDNAME_IDM', this%memoryPath)
170 call mem_setptr(this%boundname_cst,
'BOUNDNAME_CST', this%memoryPath)
171 call mem_setptr(this%auxvar,
'AUXVAR', this%memoryPath)
177 call this%BndType%bnd_da()
196 character(len=LENMEMPATH) :: input_mempath
202 call this%BndType%allocate_scalars()
205 call mem_setptr(this%iper,
'IPER', input_mempath)
221 integer(I4B),
dimension(:),
pointer,
contiguous,
optional :: nodelist
222 real(DP),
dimension(:, :),
pointer,
contiguous,
optional :: auxvar
225 call this%BndType%allocate_arrays(nodelist, auxvar)
228 call mem_setptr(this%cellid,
'CELLID', this%input_mempath)
229 call mem_setptr(this%boundname_cst,
'BOUNDNAME', this%input_mempath)
232 call mem_checkin(this%cellid,
'CELLID', this%memoryPath, &
233 'CELLID', this%input_mempath)
235 this%memoryPath,
'BOUNDNAME', this%input_mempath)
237 if (
present(auxvar))
then
241 call mem_setptr(this%auxvar,
'AUXVAR', this%input_mempath)
244 call mem_checkin(this%auxvar,
'AUXVAR_IDM', this%memoryPath, &
245 'AUXVAR', this%input_mempath)
262 character(len=LENAUXNAME) :: sfacauxname
266 call mem_set_value(this%naux,
'NAUX', this%input_mempath, found%naux)
267 call mem_set_value(this%ipakcb,
'IPAKCB', this%input_mempath, found%ipakcb)
268 call mem_set_value(this%iprpak,
'IPRPAK', this%input_mempath, found%iprpak)
269 call mem_set_value(this%iprflow,
'IPRFLOW', this%input_mempath, found%iprflow)
270 call mem_set_value(this%inamedbound,
'BOUNDNAMES', this%input_mempath, &
272 call mem_set_value(sfacauxname,
'AUXMULTNAME', this%input_mempath, &
274 call mem_set_value(this%inewton,
'INEWTON', this%input_mempath, found%inewton)
277 call this%log_options(found, sfacauxname)
280 if (found%naux .and. this%naux > 0)
then
282 'AUXNAME', this%memoryPath)
284 'AUXNAME_CST', this%memoryPath)
285 call mem_set_value(this%auxname_cst,
'AUXILIARY', this%input_mempath, &
289 this%auxname(n) = this%auxname_cst(n)
294 if (found%ipakcb) this%ipakcb = -1
297 if (found%auxmultname) this%iauxmultcol = -1
301 if (
filein_fname(this%obs%inputFilename,
'OBS6_FILENAME', &
302 this%input_mempath, this%input_fname))
then
303 this%obs%active = .true.
305 call openfile(this%obs%inUnitObs, this%iout, this%obs%inputFilename,
'OBS')
309 if (found%inewton) this%inewton = 0
312 if (this%iauxmultcol < 0)
then
315 if (this%naux == 0)
then
316 write (
errmsg,
'(a,2(1x,a))') &
317 'AUXMULTNAME was specified as', trim(adjustl(sfacauxname)), &
318 'but no AUX variables specified.'
325 if (sfacauxname == this%auxname(n))
then
332 if (this%iauxmultcol == 0)
then
333 write (
errmsg,
'(a,2(1x,a))') &
334 'AUXMULTNAME was specified as', trim(adjustl(sfacauxname)), &
335 'but no AUX variable found with this name.'
353 character(len=*),
intent(in) :: sfacauxname
356 character(len=*),
parameter :: fmtflow = &
357 &
"(4x, 'FLOWS WILL BE SAVED TO BUDGET FILE SPECIFIED IN OUTPUT CONTROL')"
358 character(len=*),
parameter :: fmttas = &
359 &
"(4x, 'TIME-ARRAY SERIES DATA WILL BE READ FROM FILE: ', a)"
360 character(len=*),
parameter :: fmtts = &
361 &
"(4x, 'TIME-SERIES DATA WILL BE READ FROM FILE: ', a)"
362 character(len=*),
parameter :: fmtnme = &
366 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text)) &
369 if (found%ipakcb)
then
370 write (this%iout, fmtflow)
373 if (found%iprpak)
then
374 write (this%iout,
'(4x,a)') &
375 'LISTS OF '//trim(adjustl(this%text))//
' CELLS WILL BE PRINTED.'
378 if (found%iprflow)
then
379 write (this%iout,
'(4x,a)') trim(adjustl(this%text))// &
380 ' FLOWS WILL BE PRINTED TO LISTING FILE.'
383 if (found%boundnames)
then
384 write (this%iout,
'(4x,a)') trim(adjustl(this%text))// &
385 ' BOUNDARIES HAVE NAMES IN LAST COLUMN.'
388 if (found%auxmultname)
then
389 write (this%iout,
'(4x,a,a)') &
390 'AUXILIARY MULTIPLIER NAME: ', sfacauxname
393 if (found%inewton)
then
394 write (this%iout,
'(4x,a)') &
395 'NEWTON-RAPHSON method disabled for unconfined cells'
399 write (this%iout,
'(1x,a)') &
400 'END OF '//trim(adjustl(this%text))//
' BASE OPTIONS'
413 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text))// &
417 call mem_set_value(this%maxbound,
'MAXBOUND', this%input_mempath, &
420 write (this%iout,
'(4x,a,i7)')
'MAXBOUND = ', this%maxbound
423 write (this%iout,
'(1x,a)') &
424 'END OF '//trim(adjustl(this%text))//
' BASE DIMENSIONS'
427 if (this%maxbound <= 0)
then
428 write (
errmsg,
'(a)')
'MAXBOUND must be an integer greater than zero.'
435 call this%define_listlabel()
449 integer(I4B),
dimension(:),
pointer :: cellid
450 integer(I4B) :: n, nodeu, noder
451 character(len=LINELENGTH) :: nodestr
454 do n = 1, this%nbound
457 cellid => this%cellid(:, n)
460 call this%check_cellid(n, cellid, this%dis%mshape, this%dis%ndim)
463 if (this%dis%ndim == 1)
then
465 elseif (this%dis%ndim == 2)
then
466 nodeu =
get_node(cellid(1), 1, cellid(2), &
467 this%dis%mshape(1), 1, &
470 nodeu =
get_node(cellid(1), cellid(2), cellid(3), &
471 this%dis%mshape(1), &
472 this%dis%mshape(2), &
477 if (this%dis%nodes < this%dis%nodesuser)
then
479 noder = this%dis%get_nodenumber(nodeu, 0)
481 call this%dis%nodeu_to_string(nodeu, nodestr)
483 ' Cell is outside active grid domain: '// &
484 trim(adjustl(nodestr))
487 this%nodelist(n) = noder
489 this%nodelist(n) = nodeu
509 integer(I4B),
intent(in) :: ii
510 integer(I4B),
dimension(:),
intent(in) :: cellid
511 integer(I4B),
dimension(:),
intent(in) :: mshape
512 integer(I4B),
intent(in) :: ndim
513 character(len=20) :: cellstr, mshstr
514 character(len=*),
parameter :: fmterr = &
515 "('List entry ',i0,' contains cellid ',a,' but this cellid is invalid &
516 &for model with shape ', a)"
517 character(len=*),
parameter :: fmtndim1 = &
519 character(len=*),
parameter :: fmtndim2 = &
520 "('(',i0,',',i0,')')"
521 character(len=*),
parameter :: fmtndim3 = &
522 "('(',i0,',',i0,',',i0,')')"
526 if (cellid(1) < 1 .or. cellid(1) > mshape(1))
then
527 write (cellstr, fmtndim1) cellid(1)
528 write (mshstr, fmtndim1) mshape(1)
529 write (
errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
535 if (cellid(1) < 1 .or. cellid(1) > mshape(1) .or. &
536 cellid(2) < 1 .or. cellid(2) > mshape(2))
then
537 write (cellstr, fmtndim2) cellid(1), cellid(2)
538 write (mshstr, fmtndim2) mshape(1), mshape(2)
539 write (
errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
545 if (cellid(1) < 1 .or. cellid(1) > mshape(1) .or. &
546 cellid(2) < 1 .or. cellid(2) > mshape(2) .or. &
547 cellid(3) < 1 .or. cellid(3) > mshape(3))
then
548 write (cellstr, fmtndim3) cellid(1), cellid(2), cellid(3)
549 write (mshstr, fmtndim3) mshape(1), mshape(2), mshape(3)
550 write (
errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
573 character(len=10) :: cpos
574 character(len=LINELENGTH) :: tag
575 character(len=LINELENGTH),
allocatable,
dimension(:) :: words
576 integer(I4B) :: ntabrows
577 integer(I4B) :: ntabcols
579 integer(I4B) :: ii, jj, i, j, k, nod
582 type(
tabletype),
pointer :: inputtab => null()
584 character(len=LINELENGTH) :: fmtlstbn
588 naux =
size(this%auxvar, 1)
591 ntabrows = this%nbound
595 ipos = index(this%listlabel,
'NO.')
597 write (cpos,
'(i10)') ipos + 3
598 fmtlstbn =
'(a'//trim(adjustl(cpos))
603 if (
size(this%dis%mshape) == 3)
then
605 fmtlstbn = trim(fmtlstbn)//
',a7,a7,a7'
608 else if (
size(this%dis%mshape) == 2)
then
610 fmtlstbn = trim(fmtlstbn)//
',a7,a7'
615 fmtlstbn = trim(fmtlstbn)//
',a7'
619 ntabcols = ntabcols + ldim
621 fmtlstbn = trim(fmtlstbn)//
',a16'
625 if (this%inamedbound == 1)
then
626 ntabcols = ntabcols + 1
627 fmtlstbn = trim(fmtlstbn)//
',a16'
631 ntabcols = ntabcols + naux
633 fmtlstbn = trim(fmtlstbn)//
',a16'
635 fmtlstbn = trim(fmtlstbn)//
')'
638 allocate (words(ntabcols))
641 read (this%listlabel, fmtlstbn) (words(i), i=1, ntabcols)
645 call inputtab%table_df(ntabrows, ntabcols, this%iout)
649 call inputtab%initialize_column(words(ipos), 10, alignment=
tabcenter)
652 do i = 1,
size(this%dis%mshape)
654 call inputtab%initialize_column(words(ipos), 7, alignment=
tabcenter)
660 call inputtab%initialize_column(words(ipos), 16, alignment=
tabcenter)
664 if (this%inamedbound == 1)
then
672 call inputtab%initialize_column(this%auxname(i), 16, alignment=
tabcenter)
676 do ii = 1, this%nbound
677 call inputtab%add_term(ii)
680 if (
size(this%dis%mshape) == 3)
then
681 nod = this%nodelist(ii)
682 call get_ijk(nod, this%dis%mshape(2), this%dis%mshape(3), &
683 this%dis%mshape(1), i, j, k)
684 call inputtab%add_term(k)
685 call inputtab%add_term(i)
686 call inputtab%add_term(j)
687 else if (
size(this%dis%mshape) == 2)
then
688 nod = this%nodelist(ii)
689 call get_ijk(nod, 1, this%dis%mshape(2), this%dis%mshape(1), i, j, k)
690 call inputtab%add_term(k)
691 call inputtab%add_term(j)
693 nod = this%nodelist(ii)
694 call inputtab%add_term(nod)
699 call inputtab%add_term(this%bound_value(jj, ii))
703 if (this%inamedbound == 1)
then
704 call inputtab%add_term(this%boundname(ii))
709 call inputtab%add_term(this%auxvar(jj, ii))
714 call inputtab%table_da()
715 deallocate (inputtab)
732 integer(I4B),
intent(in) :: col
733 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 nodelist_update(this)
@ brief Update package nodelist
subroutine bndext_df(this, neq, dis)
@ brief Define boundary package options and dimensions
subroutine bndext_da(this)
@ brief Deallocate package memory
subroutine log_options(this, found, sfacauxname)
@ brief Log package options
subroutine source_dimensions(this)
@ brief Source package dimensions from input context
subroutine check_cellid(this, ii, cellid, mshape, ndim)
@ brief Check for valid cellid
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 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.
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
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
character(len=linelength) idm_context
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 ...