MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
bndextmodule Module Reference

This module contains the extended boundary package. More...

Data Types

type  bndexttype
 BndExtType. More...
type  bndextfoundtype
 BndExtFoundType. More...

Functions/Subroutines

subroutine bndext_df (this, neq, dis)
 Define boundary package options and dimensions.
subroutine bndext_ad (this)
 Advance the package one time step.
subroutine bndext_rp (this)
subroutine bndext_rp_log (this)
 Write the input list to the listing file if requested.
integer(i4b) function validate_ifno (this, ifno_val, nfeatures, nboundchk, feature_label, blockname)
 Validate a list-input row's IFNO and update the per-feature coverage counter.
subroutine report_ifno_coverage (this, nboundchk, nfeatures, feature_label, blockname, check_missing)
 Report missing or duplicate list-input rows for each feature.
subroutine bndext_da (this)
 Deallocate package memory.
subroutine bndext_allocate_scalars (this)
 Allocate package scalars.
subroutine bndext_allocate_arrays (this, nodelist, auxvar)
 Allocate package arrays.
subroutine allocate_featureauxvar (this)
 Point the per-feature auxiliary variable array at the input context's permanent, feature-indexed AUX array. For packages with PACKAGEDATA AUX variables only. A live alias, permuted from row order to IFNO order, skipping out-of-range IFNO.
subroutine source_options (this)
 Source package options from input context.
subroutine log_options (this, found, sfacauxname)
 Log package options.
subroutine source_dimensions (this)
 Source package dimensions from input context.
subroutine cellid_to_nlist (this)
 Update package nodelist.
subroutine nodeu_to_nlist (this)
 Update package nodelist.
subroutine layarr_to_nlist (this)
 Update the nodelist based on layer number variable input.
subroutine default_nodelist (this)
 Assign default nodelist when READASARRAYS is specified.
subroutine check_cellid (this, ii, cellid, mshape, ndim)
 Check for valid cellid.
subroutine write_lstfile (this)
 Log package stress period input.
real(dp) function bound_value (this, col, row)
 Return a bound value.

Detailed Description

This module contains the extended boundary type that itself should be extended by model boundary packages that have been updated to source static and dynamic input data from the input context.

Function/Subroutine Documentation

◆ allocate_featureauxvar()

subroutine bndextmodule::allocate_featureauxvar ( class(bndexttype) this)
private
Parameters
thisBndExtType object

Definition at line 415 of file BoundaryPackageExt.f90.

416 ! -- modules
418 ! -- dummy
419 class(BndExtType) :: this !< BndExtType object
420 ! -- local
421 real(DP), dimension(:, :), allocatable :: aux_row_order
422 integer(I4B) :: n, ifeat, jj, nrow
423 !
424 ! -- set input context PACKAGEDATA pointers
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)
431 do n = 1, nrow
432 ifeat = this%pkg_ifno(n)
433 if (ifeat < 1 .or. ifeat > size(this%featureauxvar, 2)) cycle
434 do jj = 1, this%naux
435 this%featureauxvar(jj, ifeat) = aux_row_order(jj, n)
436 end do
437 end do
438 deallocate (aux_row_order)
439 end if

◆ bndext_ad()

subroutine bndextmodule::bndext_ad ( class(bndexttype) this)
private

Does not call thisTsManagerad()/thisTasManagerad() – those managers are unused by this type (see bndext_df).

Definition at line 164 of file BoundaryPackageExt.f90.

165 ! -- dummy
166 class(BndExtType) :: this
167 !
168 ! -- advance observations
169 call this%obs%obs_ad()

◆ bndext_allocate_arrays()

subroutine bndextmodule::bndext_allocate_arrays ( class(bndexttype) this,
integer(i4b), dimension(:), optional, pointer, contiguous nodelist,
real(dp), dimension(:, :), optional, pointer, contiguous auxvar )
private

Allocate and initialize base boundary package arrays. This method only needs to be overridden if additional arrays are defined for a specific package.

Parameters
thisBndExtType object
nodelistpackage nodelist
auxvarpackage aux variable array

Definition at line 364 of file BoundaryPackageExt.f90.

365 ! -- modules
367 ! -- dummy variables
368 class(BndExtType) :: this !< BndExtType object
369 ! -- local variables
370 integer(I4B), dimension(:), pointer, contiguous, optional :: nodelist !< package nodelist
371 real(DP), dimension(:, :), pointer, contiguous, optional :: auxvar !< package aux variable array
372 !
373 if (this%isadvpak /= 0) then
374 !
375 ! -- advanced package (MAW, SFR, LAK, UZF): allocate connections-level BndType arrays
376 call this%BndType%allocate_arrays(nodelist, auxvar)
377 call mem_checkin(this%auxvar, 'AUXVAR_IDM', this%memoryPath, 'AUXVAR', &
378 this%memoryPath)
379 return
380 end if
381 !
382 ! -- list/layerarray/gridarray package: allocate base BndType arrays
383 call this%BndType%allocate_arrays(nodelist, auxvar)
384 !
385 ! -- set input context pointers
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)
389 !
390 ! -- checkin input context pointers
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)
395 call mem_checkin(this%boundname_cst, lenboundname, 'BOUNDNAME_IDM', &
396 this%memoryPath, 'BOUNDNAME', this%input_mempath)
397 !
398 if (present(auxvar)) then
399 ! no-op
400 else
401 ! -- set auxvar input context pointer
402 call mem_setptr(this%auxvar, 'AUXVAR', this%input_mempath)
403 !
404 ! -- checkin auxvar input context pointer
405 call mem_checkin(this%auxvar, 'AUXVAR_IDM', this%memoryPath, &
406 'AUXVAR', this%input_mempath)
407 end if

◆ bndext_allocate_scalars()

subroutine bndextmodule::bndext_allocate_scalars ( class(bndexttype) this)
private

Allocate and initialize base boundary package scalars. This method only needs to be overridden if additional scalars are defined for a specific package.

Parameters
thisBndExtType object

Definition at line 333 of file BoundaryPackageExt.f90.

334 ! -- modules
336 ! -- dummy variables
337 class(BndExtType) :: this !< BndExtType object
338 ! -- local variables
339 !
340 ! -- allocate base BndType scalars
341 call this%BndType%allocate_scalars()
342 !
343 ! -- set IPER pointer
344 call mem_setptr(this%iper, 'IPER', this%input_mempath)
345
346 ! -- allocate internal scalars
347 allocate (this%readarraygrid)
348 allocate (this%readasarrays)
349 allocate (this%ts_active)
350
351 ! -- initialize internal scalars
352 this%readarraygrid = .false.
353 this%readasarrays = .false.
354 this%ts_active = .false.

◆ bndext_da()

subroutine bndextmodule::bndext_da ( class(bndexttype) this)
private
Parameters
thisBndExtType object

Definition at line 288 of file BoundaryPackageExt.f90.

289 ! -- modules
291 ! -- dummy variables
292 class(BndExtType) :: this !< BndExtType object
293 !
294 if (this%isadvpak /= 0) then
295 !
296 ! -- advanced package cleanup (MAW, SFR, LAK, UZF)
297 nullify (this%featureauxvar)
298 call mem_deallocate(this%auxvar, 'AUXVAR_IDM', this%memoryPath)
299 nullify (this%pkg_ifno)
300 else
301 !
302 ! -- list/array package cleanup
303 call mem_deallocate(this%cellid, 'CELLID', this%memoryPath)
304 call mem_deallocate(this%nodeulist, 'NODEULIST', this%memoryPath)
305 call mem_deallocate(this%boundname_cst, 'BOUNDNAME_IDM', this%memoryPath)
306 call mem_deallocate(this%auxvar, 'AUXVAR_IDM', this%memoryPath)
307 !
308 ! -- reassign pointers for base class _da
309 call mem_setptr(this%boundname_cst, 'BOUNDNAME_CST', this%memoryPath)
310 call mem_setptr(this%auxvar, 'AUXVAR', this%memoryPath)
311 end if
312 !
313 ! -- scalars
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)
320 nullify (this%iper)
321 !
322 ! -- deallocate
323 call this%BndType%bnd_da()

◆ bndext_df()

subroutine bndextmodule::bndext_df ( class(bndexttype), intent(inout) this,
integer(i4b), intent(inout) neq,
class(disbasetype), pointer dis )

Define base boundary package options and dimensions for a model boundary package.

Parameters
[in,out]thisBndExtType object
[in,out]neqnumber of equations
disdiscretization object

Definition at line 93 of file BoundaryPackageExt.f90.

94 ! -- modules
95 use basedismodule, only: disbasetype
100 ! -- dummy variables
101 class(BndExtType), intent(inout) :: this !< BndExtType object
102 integer(I4B), intent(inout) :: neq !< number of equations
103 class(DisBaseType), pointer :: dis !< discretization object
104 ! -- local
105 integer(I4B) :: isize
106 ! -- formats
107 character(len=*), parameter :: fmtpkghdr = &
108 &"(1X,/1X,a,' -- ',a,' PACKAGE, VERSION 8, 2/22/2014',&
109 &' INPUT READ FROM MEMPATH: ',a)"
110 !
111 ! -- set pointer to dis object for the model
112 this%dis => dis
113 !
114 ! -- Create time series managers
115 ! -- Not in use by this type but BndType uses and deallocates
116 call tsmanager_cr(this%TsManager, this%iout)
117 call tasmanager_cr(this%TasManager, dis, this%name_model, this%iout)
118 !
119 ! -- create obs package
120 call obs_cr(this%obs, this%inobspkg)
121 !
122 ! -- Write information to model list file
123 write (this%iout, fmtpkghdr) trim(this%filtyp), trim(adjustl(this%text)), &
124 this%input_mempath
125 !
126 ! -- source options
127 call this%source_options()
128 !
129 ! -- detect TS6 files; used by subclass _ad to bypass per-timestep re-dispatch
130 call get_isize('TS6_FILENAME', this%input_mempath, isize)
131 if (isize > 0) this%ts_active = .true.
132 !
133 ! -- Define time series managers
134 call this%tsmanager%tsmanager_df()
135 call this%tasmanager%tasmanager_df()
136 !
137 ! -- source dimensions
138 call this%source_dimensions()
139 !
140 ! -- update package moffset for packages that add rows
141 if (this%npakeq > 0) then
142 this%ioffset = neq - this%dis%nodes
143 end if
144 !
145 ! -- update neq
146 neq = neq + this%npakeq
147 !
148 ! -- Store information needed for observations
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()
152 end if
153 !
154 ! -- Call define_listlabel to construct the list label that is written
155 ! when PRINT_INPUT option is used.
156 call this%define_listlabel()
subroutine, public get_isize(name, mem_path, isize)
Get the number of elements for this variable.
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.
Here is the call graph for this function:

◆ bndext_rp()

subroutine bndextmodule::bndext_rp ( class(bndexttype), intent(inout) this)
private
Parameters
[in,out]thisBndExtType object

Definition at line 172 of file BoundaryPackageExt.f90.

173 ! -- modules
174 use tdismodule, only: kper
177 ! -- dummy variables
178 class(BndExtType), intent(inout) :: this !< BndExtType object
179 ! -- local variables
180 logical(LGP) :: found
181 integer(I4B) :: n
182 !
183 if (this%iper /= kper) return
184
185 if (.not. this%readasarrays) then
186 ! -- copy nbound from input context
187 call mem_set_value(this%nbound, 'NBOUND', this%input_mempath, &
188 found, release=.false.)
189 end if
190
191 if (this%readarraygrid) then
192 call this%nodeu_to_nlist()
193 else if (this%readasarrays) then
194 call this%layarr_to_nlist()
195 else
196 call this%cellid_to_nlist()
197 !
198 ! -- update boundname string list
199 if (this%inamedbound /= 0) then
200 do n = 1, size(this%boundname_cst)
201 this%boundname(n) = this%boundname_cst(n)
202 end do
203 end if
204 end if
integer(i4b), pointer, public kper
current stress period number
Definition tdis.f90:26

◆ bndext_rp_log()

subroutine bndextmodule::bndext_rp_log ( class(bndexttype), intent(inout) this)
private

Called from model control files after bnd_rp(), which ensures bound_value() dispatches to the correct derived type.

Definition at line 212 of file BoundaryPackageExt.f90.

213 ! -- dummy
214 class(BndExtType), intent(inout) :: this
215 !
216 if (this%iprpak /= 0 .and. this%isadvpak == 0) then
217 call this%write_lstfile()
218 end if

◆ bound_value()

real(dp) function bndextmodule::bound_value ( class(bndexttype), intent(inout) this,
integer(i4b), intent(in) col,
integer(i4b), intent(in) row )
private

Return a bound value associated with an ncolbnd index and row. This function should be overridden in the derived package class.

Parameters
[in,out]thisBndExtType object

Definition at line 1059 of file BoundaryPackageExt.f90.

1060 ! -- modules
1061 use constantsmodule, only: dnodata
1062 ! -- dummy variables
1063 class(BndExtType), intent(inout) :: this !< BndExtType object
1064 integer(I4B), intent(in) :: col
1065 integer(I4B), intent(in) :: row
1066 ! -- result
1067 real(DP) :: bndval
1068 !
1069 ! -- override this return value by redefining this
1070 ! routine in the derived package.
1071 bndval = dnodata
This module contains simulation constants.
Definition Constants.f90:9
real(dp), parameter dnodata
real no data constant
Definition Constants.f90:95

◆ cellid_to_nlist()

subroutine bndextmodule::cellid_to_nlist ( class(bndexttype) this)
private

Convert period updated cellids to node numbers.

Parameters
thisBndExtType object

Definition at line 657 of file BoundaryPackageExt.f90.

658 ! -- modules
659 use simvariablesmodule, only: errmsg
660 ! -- dummy
661 class(BndExtType) :: this !< BndExtType object
662 ! -- local
663 integer(I4B), dimension(:), pointer :: cellid
664 integer(I4B) :: n, nodeu, noder
665 character(len=LINELENGTH) :: nodestr
666 !
667 ! -- update nodelist
668 do n = 1, this%nbound
669 !
670 ! -- set cellid
671 cellid => this%cellid(:, n)
672 !
673 ! -- ensure cellid is valid, store an error otherwise
674 call this%check_cellid(n, cellid, this%dis%mshape, this%dis%ndim)
675 !
676 ! -- Determine user node number
677 if (this%dis%ndim == 1) then
678 nodeu = cellid(1)
679 elseif (this%dis%ndim == 2) then
680 nodeu = get_node(cellid(1), 1, cellid(2), &
681 this%dis%mshape(1), 1, &
682 this%dis%mshape(2))
683 else
684 nodeu = get_node(cellid(1), cellid(2), cellid(3), &
685 this%dis%mshape(1), &
686 this%dis%mshape(2), &
687 this%dis%mshape(3))
688 end if
689 !
690 ! -- update the nodelist
691 if (this%dis%nodes < this%dis%nodesuser) then
692 ! -- convert user to reduced node numbers
693 noder = this%dis%get_nodenumber(nodeu, 0)
694 if (noder <= 0) then
695 call this%dis%nodeu_to_string(nodeu, nodestr)
696 write (errmsg, *) &
697 ' Cell is outside active grid domain: '// &
698 trim(adjustl(nodestr))
699 call store_error(errmsg)
700 end if
701 this%nodelist(n) = noder
702 else
703 this%nodelist(n) = nodeu
704 end if
705 end do
706 !
707 ! -- exit if errors were found
708 if (count_errors() > 0) then
709 write (errmsg, *) count_errors(), ' errors encountered.'
710 call store_error(errmsg)
711 call store_error_filename(this%input_fname)
712 end if
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
Here is the call graph for this function:

◆ check_cellid()

subroutine bndextmodule::check_cellid ( class(bndexttype) this,
integer(i4b), intent(in) ii,
integer(i4b), dimension(:), intent(in) cellid,
integer(i4b), dimension(:), intent(in) mshape,
integer(i4b), intent(in) ndim )
private
Parameters
thisBndExtType object
[in]mshapemodel shape
[in]ndimsize of mshape

Definition at line 835 of file BoundaryPackageExt.f90.

836 ! -- modules
837 use simvariablesmodule, only: errmsg
838 ! -- dummy
839 class(BndExtType) :: this !< BndExtType object
840 ! -- local
841 integer(I4B), intent(in) :: ii
842 integer(I4B), dimension(:), intent(in) :: cellid !< cellid
843 integer(I4B), dimension(:), intent(in) :: mshape !< model shape
844 integer(I4B), intent(in) :: ndim !< size of mshape
845 character(len=20) :: cellstr, mshstr
846 character(len=*), parameter :: fmterr = &
847 "('List entry ',i0,' contains cellid ',a,' but this cellid is invalid &
848 &for model with shape ', a)"
849 character(len=*), parameter :: fmtndim1 = &
850 "('(',i0,')')"
851 character(len=*), parameter :: fmtndim2 = &
852 "('(',i0,',',i0,')')"
853 character(len=*), parameter :: fmtndim3 = &
854 "('(',i0,',',i0,',',i0,')')"
855 select case (ndim)
856 case (1)
857 !
858 if (cellid(1) < 1 .or. cellid(1) > mshape(1)) then
859 write (cellstr, fmtndim1) cellid(1)
860 write (mshstr, fmtndim1) mshape(1)
861 write (errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
862 call store_error(errmsg)
863 end if
864 !
865 case (2)
866 !
867 if (cellid(1) < 1 .or. cellid(1) > mshape(1) .or. &
868 cellid(2) < 1 .or. cellid(2) > mshape(2)) then
869 write (cellstr, fmtndim2) cellid(1), cellid(2)
870 write (mshstr, fmtndim2) mshape(1), mshape(2)
871 write (errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
872 call store_error(errmsg)
873 end if
874 !
875 case (3)
876 !
877 if (cellid(1) < 1 .or. cellid(1) > mshape(1) .or. &
878 cellid(2) < 1 .or. cellid(2) > mshape(2) .or. &
879 cellid(3) < 1 .or. cellid(3) > mshape(3)) then
880 write (cellstr, fmtndim3) cellid(1), cellid(2), cellid(3)
881 write (mshstr, fmtndim3) mshape(1), mshape(2), mshape(3)
882 write (errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
883 call store_error(errmsg)
884 end if
885 !
886 case default
887 end select
Here is the call graph for this function:

◆ default_nodelist()

subroutine bndextmodule::default_nodelist ( class(bndexttype) this)
private

Equivalent to reading layer number array as CONSTANT 1

Definition at line 797 of file BoundaryPackageExt.f90.

798 ! -- dummy
799 class(BndExtType) :: this
800 ! -- local
801 integer(I4B) :: il, ir, ic, ncol, nrow, nlay, nodeu, noder, ipos
802 !
803 if (this%readasarrays) then
804 !
805 ! -- set variables
806 if (this%dis%ndim == 3) then
807 nlay = this%dis%mshape(1)
808 nrow = this%dis%mshape(2)
809 ncol = this%dis%mshape(3)
810 elseif (this%dis%ndim == 2) then
811 nlay = this%dis%mshape(1)
812 nrow = 1
813 ncol = this%dis%mshape(2)
814 end if
815 !
816 ! -- Populate nodelist
817 ipos = 1
818 il = 1
819 do ir = 1, nrow
820 do ic = 1, ncol
821 nodeu = get_node(il, ir, ic, nlay, nrow, ncol)
822 noder = this%dis%get_nodenumber(nodeu, 0)
823 this%nodelist(ipos) = noder
824 ipos = ipos + 1
825 end do
826 end do
827 !
828 ! -- Assign nbound
829 this%nbound = ipos - 1
830 end if
Here is the call graph for this function:

◆ layarr_to_nlist()

subroutine bndextmodule::layarr_to_nlist ( class(bndexttype) this)
private

This is a module scoped routine to check for I<filtyp> input. If array input was provided, INI<filtyp> and I<filtyp> will be allocated in the input context. If the read state variable INI<filtyp> shows values were given in this period block, I<filtyp> input was read and is used here to update the nodelist.

Parameters
thisBndExtType object

Definition at line 759 of file BoundaryPackageExt.f90.

760 ! -- modules
763 use constantsmodule, only: lenvarname
764 ! -- dummy
765 class(BndExtType) :: this !< BndExtType object
766 character(len=LENVARNAME) :: ilayname, inilayname
767 character(len=24) :: aname = ' LAYER OR NODE INDEX'
768 ! -- local
769 integer(I4B), dimension(:), contiguous, &
770 pointer :: ilay => null()
771 integer(I4B), pointer :: inilay => null()
772 !
773 ! set ilay and read state variable names
774 ilayname = 'I'//trim(this%filtyp)
775 inilayname = 'INI'//trim(this%filtyp)
776 !
777 ! -- set pointer to input context read state variable
778 call mem_setptr(inilay, inilayname, this%input_mempath)
779 !
780 ! -- check read state
781 if (inilay == rs_values .or. inilay == rs_netcdf) then
782 ! -- ilay variable was read this period
783 !
784 ! -- set pointer to input context layer index variable
785 call mem_setptr(ilay, ilayname, this%input_mempath)
786 !
787 ! -- update nodelist
788 call this%dis%nlarray_to_nodelist(ilay, this%nodelist, this%maxbound, &
789 this%nbound, aname)
790 end if
integer(i4b), parameter lenvarname
maximum length of a variable name
Definition Constants.f90:17
Load context for IDM generic dynamic loaders.
@ rs_netcdf
values read from NetCDF in the most recent period block
@ rs_values
values given in the most recent period block

◆ log_options()

subroutine bndextmodule::log_options ( class(bndexttype), intent(inout) this,
type(bndextfoundtype), intent(in) found,
character(len=*), intent(in) sfacauxname )
private
Parameters
[in,out]thisBndExtType object

Definition at line 556 of file BoundaryPackageExt.f90.

557 ! -- modules
558 ! -- dummy variables
559 class(BndExtType), intent(inout) :: this !< BndExtType object
560 type(BndExtFoundType), intent(in) :: found
561 character(len=*), intent(in) :: sfacauxname
562 ! -- local variables
563 ! -- format
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')"
570 !
571 ! -- log found options
572 write (this%iout, '(/1x,a)') 'PROCESSING '//trim(adjustl(this%text)) &
573 //' BASE OPTIONS'
574 !
575 if (this%readasarrays) then
576 write (this%iout, fmtreadasarrays)
577 end if
578 !
579 if (this%readarraygrid) then
580 write (this%iout, fmtreadarraygrid)
581 end if
582 !
583 if (found%ipakcb) then
584 write (this%iout, fmtflow)
585 end if
586 !
587 if (found%iprpak) then
588 write (this%iout, '(4x,a)') &
589 'LISTS OF '//trim(adjustl(this%text))//' CELLS WILL BE PRINTED.'
590 end if
591 !
592 if (found%iprflow) then
593 write (this%iout, '(4x,a)') trim(adjustl(this%text))// &
594 ' FLOWS WILL BE PRINTED TO LISTING FILE.'
595 end if
596 !
597 if (found%boundnames) then
598 write (this%iout, '(4x,a)') trim(adjustl(this%text))// &
599 ' BOUNDARIES HAVE NAMES IN LAST COLUMN.'
600 end if
601 !
602 if (found%auxmultname) then
603 write (this%iout, '(4x,a,a)') &
604 'AUXILIARY MULTIPLIER NAME: ', sfacauxname
605 end if
606 !
607 if (found%inewton) then
608 write (this%iout, '(4x,a)') &
609 'NEWTON-RAPHSON method disabled for unconfined cells'
610 end if
611 !
612 ! -- close logging block
613 write (this%iout, '(1x,a)') &
614 'END OF '//trim(adjustl(this%text))//' BASE OPTIONS'

◆ nodeu_to_nlist()

subroutine bndextmodule::nodeu_to_nlist ( class(bndexttype) this)
private

Convert period user nodes to reduced nodes. Inactive cells are excluded by the input loader.

Parameters
thisBndExtType object

Definition at line 721 of file BoundaryPackageExt.f90.

722 ! -- dummy
723 class(BndExtType) :: this !< BndExtType object
724 integer(I4B) :: n, noder, nodeuser
725 character(len=LINELENGTH) :: nodestr
726
727 ! -- Set the nodelist
728 do n = 1, this%nbound
729 nodeuser = this%nodeulist(n)
730 noder = this%dis%get_nodenumber(nodeuser, 0)
731 if (noder <= 0) then
732 call this%dis%nodeu_to_string(nodeuser, nodestr)
733 write (errmsg, *) &
734 ' Cell is outside active grid domain: '// &
735 trim(adjustl(nodestr))
736 call store_error(errmsg)
737 end if
738 this%nodelist(n) = noder
739 end do
740
741 ! -- exit if errors were found
742 if (count_errors() > 0) then
743 write (errmsg, *) count_errors(), ' errors encountered.'
744 call store_error(errmsg)
745 call store_error_filename(this%input_fname)
746 end if
Here is the call graph for this function:

◆ report_ifno_coverage()

subroutine bndextmodule::report_ifno_coverage ( class(bndexttype), intent(inout) this,
integer(i4b), dimension(:), intent(in) nboundchk,
integer(i4b), intent(in) nfeatures,
character(len=*), intent(in) feature_label,
character(len=*), intent(in) blockname,
logical(lgp), intent(in), optional check_missing )
private

Set check_missing=.false. for an optional block where not every feature is expected to have a row (duplicates are still reported).

Definition at line 256 of file BoundaryPackageExt.f90.

258 ! -- dummy
259 class(BndExtType), intent(inout) :: this
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
265 ! -- local
266 integer(I4B) :: n
267 logical(LGP) :: do_check_missing
268 !
269 do_check_missing = .true.
270 if (present(check_missing)) do_check_missing = check_missing
271 !
272 do n = 1, nfeatures
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, '.'
276 call store_error(errmsg)
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.'
281 call store_error(errmsg)
282 end if
283 end do
Here is the call graph for this function:

◆ source_dimensions()

subroutine bndextmodule::source_dimensions ( class(bndexttype), intent(inout) this)
private
Parameters
[in,out]thisBndExtType object

Definition at line 619 of file BoundaryPackageExt.f90.

621 ! -- dummy variables
622 class(BndExtType), intent(inout) :: this !< BndExtType object
623 ! -- local variables
624 type(BndExtFoundType) :: found
625 !
626 if (this%readasarrays) then
627 this%maxbound = this%dis%get_ncpl()
628 else
629 ! -- open dimensions logging block
630 write (this%iout, '(/1x,a)') 'PROCESSING '//trim(adjustl(this%text))// &
631 ' BASE DIMENSIONS'
632
633 ! -- update defaults with idm sourced values
634 call mem_set_value(this%maxbound, 'MAXBOUND', this%input_mempath, &
635 found%maxbound, release=.false.)
636
637 write (this%iout, '(4x,a,i7)') 'MAXBOUND = ', this%maxbound
638
639 ! -- close logging block
640 write (this%iout, '(1x,a)') &
641 'END OF '//trim(adjustl(this%text))//' BASE DIMENSIONS'
642 end if
643 !
644 ! -- verify dimensions were set
645 if (this%maxbound <= 0) then
646 write (errmsg, '(a)') 'MAXBOUND must be an integer greater than zero.'
647 call store_error(errmsg)
648 call store_error_filename(this%input_fname)
649 end if
Here is the call graph for this function:

◆ source_options()

subroutine bndextmodule::source_options ( class(bndexttype), intent(inout) this)
private
Parameters
[in,out]thisBndExtType object

Definition at line 444 of file BoundaryPackageExt.f90.

445 ! -- modules
446 use memorymanagermodule, only: mem_reallocate, mem_setptr !, get_isize
451 ! -- dummy variables
452 class(BndExtType), intent(inout) :: this !< BndExtType object
453 ! -- local variables
454 type(BndExtFoundType) :: found
455 logical(LGP) :: found_readarr
456 character(len=LENAUXNAME) :: sfacauxname
457 integer(I4B) :: n
458 !
459 ! -- update defaults with idm sourced values
460 call mem_set_value(this%naux, 'NAUX', this%input_mempath, found%naux, &
461 release=.false.)
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, &
468 found%auxmultname)
469 call mem_set_value(this%inewton, 'INEWTON', this%input_mempath, found%inewton)
470 call mem_set_value(this%readarraygrid, 'READARRAYGRID', this%input_mempath, &
471 found_readarr)
472 call mem_set_value(this%readasarrays, 'READASARRAYS', this%input_mempath, &
473 found_readarr)
474 !
475 ! -- log found options
476 call this%log_options(found, sfacauxname)
477 !
478 ! -- reallocate aux arrays if aux variables provided
479 if (found%naux .and. this%naux > 0) then
480 call mem_reallocate(this%auxname, lenauxname, this%naux, &
481 'AUXNAME', this%memoryPath)
482 call mem_reallocate(this%auxname_cst, lenauxname, this%naux, &
483 'AUXNAME_CST', this%memoryPath)
484 call mem_set_value(this%auxname_cst, 'AUXILIARY', this%input_mempath, &
485 found%auxiliary, release=.false.)
486 !
487 do n = 1, this%naux
488 this%auxname(n) = this%auxname_cst(n)
489 end do
490 end if
491 !
492 ! -- save flows option active
493 if (found%ipakcb) this%ipakcb = -1
494 !
495 ! -- auxmultname provided
496 if (found%auxmultname) this%iauxmultcol = -1
497 !
498 !
499 ! -- enforce 0 or 1 OBS6_FILENAME entries in option block
500 if (filein_fname(this%obs%inputFilename, 'OBS6_FILENAME', &
501 this%input_mempath, this%input_fname)) then
502 this%obs%active = .true.
503 this%obs%inUnitObs = getunit()
504 call openfile(this%obs%inUnitObs, this%iout, this%obs%inputFilename, 'OBS')
505 end if
506 !
507 ! -- no newton specified
508 if (found%inewton) this%inewton = 0
509 !
510 ! -- AUXMULTNAME was specified, so find column of auxvar that will be multiplier
511 if (this%iauxmultcol < 0) then
512 !
513 ! -- Error if no aux variable specified
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.'
518 call store_error(errmsg)
519 end if
520 !
521 ! -- Assign mult column
522 this%iauxmultcol = 0
523 do n = 1, this%naux
524 if (sfacauxname == this%auxname(n)) then
525 this%iauxmultcol = n
526 exit
527 end if
528 end do
529 !
530 ! -- Error if aux variable cannot be found
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.'
535 call store_error(errmsg)
536 end if
537 end if
538 !
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.'
543 call store_error(errmsg)
544 call store_error_filename(this%input_fname)
545 end if
546 end if
547 !
548 ! -- terminate if errors were detected
549 if (count_errors() > 0) then
550 call store_error_filename(this%input_fname)
551 end if
integer(i4b) function, public getunit()
Get a free unit number.
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
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
This class is used to store a single deferred-length character string. It was designed to work in an ...
Here is the call graph for this function:

◆ validate_ifno()

integer(i4b) function bndextmodule::validate_ifno ( class(bndexttype), intent(inout) this,
integer(i4b), intent(in) ifno_val,
integer(i4b), intent(in) nfeatures,
integer(i4b), dimension(:), intent(inout) nboundchk,
character(len=*), intent(in) feature_label,
character(len=*), intent(in) blockname )
private

Returns the validated feature index, or 0 if out of range (an error is logged; the caller should skip further processing for the row).

Definition at line 227 of file BoundaryPackageExt.f90.

229 ! -- dummy
230 class(BndExtType), intent(inout) :: this
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
236 ! -- return
237 integer(I4B) :: idx
238 !
239 idx = ifno_val
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, '.'
244 call store_error(errmsg)
245 idx = 0
246 return
247 end if
248 nboundchk(idx) = nboundchk(idx) + 1
Here is the call graph for this function:

◆ write_lstfile()

subroutine bndextmodule::write_lstfile ( class(bndexttype) this)
private

Log period based input. This routine requires a package specific bound_value() routine to report accurate bound values.

Parameters
thisBndExtType object

Definition at line 896 of file BoundaryPackageExt.f90.

897 ! -- modules
900 use inputoutputmodule, only: ulstlb
901 use tablemodule, only: tabletype, table_cr
902 ! -- dummy
903 class(BndExtType) :: this !< BndExtType object
904 ! -- local
905 character(len=10) :: cpos
906 character(len=LINELENGTH) :: tag
907 character(len=LINELENGTH), allocatable, dimension(:) :: words
908 integer(I4B) :: ntabrows
909 integer(I4B) :: ntabcols
910 integer(I4B) :: ipos
911 integer(I4B) :: ii, jj, i, j, k, nod
912 integer(I4B) :: ldim
913 integer(I4B) :: naux
914 type(TableType), pointer :: inputtab => null()
915 ! -- formats
916 character(len=LINELENGTH) :: fmtlstbn
917 !
918 ! -- Determine sizes
919 ldim = this%ncolbnd
920 naux = size(this%auxvar, 1)
921 !
922 ! -- dimension table
923 ntabrows = this%nbound
924 !
925 ! -- start building format statement to parse this%label, which
926 ! contains the column headers (except for boundname and auxnames)
927 ipos = index(this%listlabel, 'NO.')
928 if (ipos /= 0) then
929 write (cpos, '(i10)') ipos + 3
930 fmtlstbn = '(a'//trim(adjustl(cpos))
931 else
932 fmtlstbn = '(a7'
933 end if
934 ! -- sequence number, layer, row, and column.
935 if (size(this%dis%mshape) == 3) then
936 ntabcols = 4
937 fmtlstbn = trim(fmtlstbn)//',a7,a7,a7'
938 !
939 ! -- sequence number, layer, and cell2d.
940 else if (size(this%dis%mshape) == 2) then
941 ntabcols = 3
942 fmtlstbn = trim(fmtlstbn)//',a7,a7'
943 !
944 ! -- sequence number and node.
945 else
946 ntabcols = 2
947 fmtlstbn = trim(fmtlstbn)//',a7'
948 end if
949 !
950 ! -- Add fields for non-optional real values
951 ntabcols = ntabcols + ldim
952 do i = 1, ldim
953 fmtlstbn = trim(fmtlstbn)//',a16'
954 end do
955 !
956 ! -- Add field for boundary name
957 if (this%inamedbound == 1) then
958 ntabcols = ntabcols + 1
959 fmtlstbn = trim(fmtlstbn)//',a16'
960 end if
961 !
962 ! -- Add fields for auxiliary variables
963 ntabcols = ntabcols + naux
964 do i = 1, naux
965 fmtlstbn = trim(fmtlstbn)//',a16'
966 end do
967 fmtlstbn = trim(fmtlstbn)//')'
968 !
969 ! -- allocate words
970 allocate (words(ntabcols))
971 !
972 ! -- parse this%listlabel into words
973 read (this%listlabel, fmtlstbn) (words(i), i=1, ntabcols)
974 !
975 ! -- initialize the input table object
976 call table_cr(inputtab, ' ', ' ')
977 call inputtab%table_df(ntabrows, ntabcols, this%iout)
978 !
979 ! -- add the columns
980 ipos = 1
981 call inputtab%initialize_column(words(ipos), 10, alignment=tabcenter)
982 !
983 ! -- discretization
984 do i = 1, size(this%dis%mshape)
985 ipos = ipos + 1
986 call inputtab%initialize_column(words(ipos), 7, alignment=tabcenter)
987 end do
988 !
989 ! -- non-optional variables
990 do i = 1, ldim
991 ipos = ipos + 1
992 call inputtab%initialize_column(words(ipos), 16, alignment=tabcenter)
993 end do
994 !
995 ! -- boundname
996 if (this%inamedbound == 1) then
997 ipos = ipos + 1
998 tag = 'BOUNDNAME'
999 call inputtab%initialize_column(tag, lenboundname, alignment=tableft)
1000 end if
1001 !
1002 ! -- aux variables
1003 do i = 1, naux
1004 call inputtab%initialize_column(this%auxname(i), 16, alignment=tabcenter)
1005 end do
1006 !
1007 ! -- Write the table
1008 do ii = 1, this%nbound
1009 call inputtab%add_term(ii)
1010 !
1011 ! -- discretization
1012 if (size(this%dis%mshape) == 3) then
1013 nod = this%nodelist(ii)
1014 call get_ijk(nod, this%dis%mshape(2), this%dis%mshape(3), &
1015 this%dis%mshape(1), i, j, k)
1016 call inputtab%add_term(k)
1017 call inputtab%add_term(i)
1018 call inputtab%add_term(j)
1019 else if (size(this%dis%mshape) == 2) then
1020 nod = this%nodelist(ii)
1021 call get_ijk(nod, 1, this%dis%mshape(2), this%dis%mshape(1), i, j, k)
1022 call inputtab%add_term(k)
1023 call inputtab%add_term(j)
1024 else
1025 nod = this%nodelist(ii)
1026 call inputtab%add_term(nod)
1027 end if
1028 !
1029 ! -- non-optional variables
1030 do jj = 1, ldim
1031 call inputtab%add_term(this%bound_value(jj, ii))
1032 end do
1033 !
1034 ! -- boundname
1035 if (this%inamedbound == 1) then
1036 call inputtab%add_term(this%boundname(ii))
1037 end if
1038 !
1039 ! -- aux variables
1040 do jj = 1, naux
1041 call inputtab%add_term(this%auxvar(jj, ii))
1042 end do
1043 end do
1044 !
1045 ! -- deallocate the local variables
1046 call inputtab%table_da()
1047 deallocate (inputtab)
1048 nullify (inputtab)
1049 deallocate (words)
integer(i4b), parameter linelength
maximum length of a standard line
Definition Constants.f90:45
@ tabcenter
centered table column
@ tableft
left justified table column
integer(i4b), parameter lenboundname
maximum length of a bound name
Definition Constants.f90:36
real(dp), parameter dzero
real constant zero
Definition Constants.f90:65
subroutine, public ulstlb(iout, label, caux, ncaux, naux)
Print a label for a list.
subroutine, public table_cr(this, name, title)
Definition Table.f90:87
Here is the call graph for this function: