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

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

Data Types

type  bndtype
 BndType. More...

Functions/Subroutines

subroutine bnd_df (this, neq, dis)
 Define boundary package options and dimensions.
subroutine bnd_ac (this, moffset, sparse)
 Add boundary package connection to matrix.
subroutine bnd_mc (this, moffset, matrix_sln)
 Map boundary package connection to matrix.
subroutine bnd_ar (this)
 Allocate and read method for boundary package.
subroutine bnd_rp (this)
 Allocate and read method for package.
subroutine bnd_ad (this)
 Advance the boundary package.
subroutine bnd_ck (this)
 Check boundary package period data.
subroutine bnd_reset (this)
 Reset bnd package before formulating.
subroutine bnd_cf (this)
 Formulate the package hcof and rhs terms.
subroutine bnd_fc (this, rhs, ia, idxglo, matrix_sln)
 Copy hcof and rhs terms into solution.
subroutine bnd_fn (this, rhs, ia, idxglo, matrix_sln)
 Add Newton-Raphson terms for package into solution.
subroutine bnd_nur (this, neqpak, x, xtemp, dx, inewtonur, dxmax, locmax)
 Apply Newton-Raphson under-relaxation for package.
subroutine bnd_cc (this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
 Convergence check for package.
subroutine bnd_cq (this, x, flowja, iadv)
 Calculate advanced package flows.
subroutine bnd_cq_simrate (this, hnew, flowja, imover)
 Calculate simrate.
subroutine bnd_cq_simtomvr (this, flowja)
 Calculate flow to the mover.
subroutine bnd_bd (this, model_budget)
 Add package flows to model budget.
subroutine bnd_ot_package_flows (this, icbcfl, ibudfl)
 Output advanced package flow terms.
subroutine bnd_ot_dv (this, idvsave, idvprint)
 Output advanced package dependent-variable terms.
subroutine bnd_ot_bdsummary (this, kstp, kper, iout, ibudfl)
 Output advanced package budget summary.
subroutine bnd_ot_model_flows (this, icbcfl, ibudfl, icbcun, imap)
 Output package flow terms.
subroutine bnd_dt (this)
 Submit an ATS time step request (no-op by default).
subroutine bnd_fp (this)
 Final processing at end of simulation (no-op by default).
subroutine bnd_da (this)
 Deallocate package memory.
subroutine allocate_scalars (this)
 Allocate package scalars.
subroutine allocate_arrays (this, nodelist, auxvar)
 Allocate package arrays.
subroutine pack_initialize (this)
 Allocate and initialize select package members.
subroutine set_pointers (this, neq, ibound, xnew, xold, flowja)
 Set pointers to model variables.
subroutine bnd_read_options (this)
 Read additional options for package.
subroutine bnd_read_dimensions (this)
 Read dimensions for package.
subroutine bnd_read_initial_attr (this)
 Read initial parameters for package.
subroutine bnd_options (this, option, found)
 Read additional options for package.
subroutine copy_boundname (this)
 Copy boundnames into boundnames_cst.
subroutine pak_setup_outputtab (this)
 Setup output table for package.
subroutine define_listlabel (this)
 Define the list label for the package.
logical(lgp) function bnd_obs_supported (this)
 Determine if observations are supported.
subroutine bnd_df_obs (this)
 Define the observation types available in the package.
subroutine bnd_rp_obs (this)
 Read and prepare observations for a package.
subroutine bnd_bd_obs (this)
 Save observations for the package.
subroutine bnd_ot_obs (this)
 Output observations for the package.
subroutine bnd_rp_ts (this)
 Assign time series links for the package.
subroutine bnd_rp_log (this)
 Log period input for a boundary package.
class(bndtype) function, pointer, private castasbndclass (obj)
 Cast as a boundary type.
subroutine, public addbndtolist (list, bnd)
 Add boundary to package list.
class(bndtype) function, pointer, public getbndfromlist (list, idx)
 Get boundary from package list.
subroutine, public save_print_model_flows (icbcfl, ibudfl, icbcun, iprflow, outputtab, nbound, nodelist, flow, ibound, title, text, ipakcb, dis, naux, textmodel, textpackage, dstmodel, dstpackage, auxname, auxvar, iout, inamedbound, boundname, imap)
 Save and/or print flows for a package.
subroutine bnd_activate_viscosity (this)
 Activate viscosity terms.

Detailed Description

This module contains the base model boundary package class that is extended by all model boundary packages. The base model boundary package extends the NumericalPackageType.

Function/Subroutine Documentation

◆ addbndtolist()

subroutine, public bndmodule::addbndtolist ( type(listtype), intent(inout) list,
class(bndtype), intent(inout), pointer bnd )

Subroutine to add a boundary package to a package list.

Parameters
[in,out]listpackage list
[in,out]bndboundary package

Definition at line 1724 of file BoundaryPackage.f90.

1725 ! -- dummy
1726 type(ListType), intent(inout) :: list !< package list
1727 class(BndType), pointer, intent(inout) :: bnd !< boundary package
1728 ! -- local
1729 class(*), pointer :: obj
1730 !
1731 obj => bnd
1732 call list%Add(obj)
Here is the caller graph for this function:

◆ allocate_arrays()

subroutine bndmodule::allocate_arrays ( class(bndtype) 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
thisBndType object
nodelistpackage nodelist
auxvarpackage aux variable array

Definition at line 1017 of file BoundaryPackage.f90.

1018 ! -- modules
1020 ! -- dummy
1021 class(BndType) :: this !< BndType object
1022 integer(I4B), dimension(:), pointer, contiguous, optional :: nodelist !< package nodelist
1023 real(DP), dimension(:, :), pointer, contiguous, optional :: auxvar !< package aux variable array
1024 ! -- local
1025 integer(I4B) :: i
1026 integer(I4B) :: j
1027 !
1028 ! -- Point nodelist if it is passed in, otherwise allocate
1029 if (present(nodelist)) then
1030 this%nodelist => nodelist
1031 else
1032 call mem_allocate(this%nodelist, this%maxbound, 'NODELIST', &
1033 this%memoryPath)
1034 do j = 1, this%maxbound
1035 this%nodelist(j) = 0
1036 end do
1037 end if
1038 !
1039 ! -- noupdateauxvar (allows an external caller to stop auxvars from being
1040 ! recalculated
1041 call mem_allocate(this%noupdateauxvar, this%naux, 'NOUPDATEAUXVAR', &
1042 this%memoryPath)
1043 this%noupdateauxvar(:) = 0
1044 !
1045 ! -- Allocate the bound array
1046 call mem_allocate(this%bound, this%ncolbnd, this%maxbound, 'BOUND', &
1047 this%memoryPath)
1048 !
1049 !-- Allocate array for storing user-specified conductances
1050 ! Will be reallocated to size maxbound if vsc active
1051 call mem_allocate(this%condinput, 0, 'CONDINPUT', this%memoryPath)
1052 !
1053 ! -- Allocate hcof and rhs
1054 call mem_allocate(this%hcof, this%maxbound, 'HCOF', this%memoryPath)
1055 call mem_allocate(this%rhs, this%maxbound, 'RHS', this%memoryPath)
1056 !
1057 ! -- Allocate the simvals array
1058 call mem_allocate(this%simvals, this%maxbound, 'SIMVALS', this%memoryPath)
1059 if (this%imover == 1) then
1060 call mem_allocate(this%simtomvr, this%maxbound, 'SIMTOMVR', &
1061 this%memoryPath)
1062 do i = 1, this%maxbound
1063 this%simtomvr(i) = dzero
1064 end do
1065 else
1066 call mem_allocate(this%simtomvr, 0, 'SIMTOMVR', this%memoryPath)
1067 end if
1068 !
1069 ! -- Point or allocate auxvar
1070 if (present(auxvar)) then
1071 this%auxvar => auxvar
1072 else
1073 call mem_allocate(this%auxvar, this%naux, this%maxbound, 'AUXVAR', &
1074 this%memoryPath)
1075 do i = 1, this%maxbound
1076 do j = 1, this%naux
1077 this%auxvar(j, i) = dzero
1078 end do
1079 end do
1080 end if
1081 !
1082 ! -- Allocate boundname
1083 if (this%inamedbound /= 0) then
1084 call mem_allocate(this%boundname, lenboundname, this%maxbound, &
1085 'BOUNDNAME', this%memoryPath)
1086 call mem_allocate(this%boundname_cst, lenboundname, this%maxbound, &
1087 'BOUNDNAME_CST', this%memoryPath)
1088 else
1089 call mem_allocate(this%boundname, lenboundname, 0, &
1090 'BOUNDNAME', this%memoryPath)
1091 call mem_allocate(this%boundname_cst, lenboundname, 0, &
1092 'BOUNDNAME_CST', this%memoryPath)
1093 end if
1094 !
1095 ! -- Set pointer to ICELLTYPE. For GWF boundary packages,
1096 ! this%ictMemPath will be 'NPF'. If boundary packages do not set
1097 ! this%ictMemPath, then icelltype will remain as null()
1098 if (this%ictMemPath /= '') then
1099 call mem_setptr(this%icelltype, 'ICELLTYPE', this%ictMemPath)
1100 end if
1101 !
1102 ! -- Initialize values
1103 do j = 1, this%maxbound
1104 do i = 1, this%ncolbnd
1105 this%bound(i, j) = dzero
1106 end do
1107 end do
1108 do i = 1, this%maxbound
1109 this%hcof(i) = dzero
1110 this%rhs(i) = dzero
1111 end do
1112 !
1113 ! -- setup the output table
1114 call this%pak_setup_outputtab()

◆ allocate_scalars()

subroutine bndmodule::allocate_scalars ( class(bndtype) 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
thisBndType object

Definition at line 942 of file BoundaryPackage.f90.

943 ! -- modules
946 ! -- dummy
947 class(BndType) :: this !< BndType object
948 ! -- local
949 integer(I4B), pointer :: imodelnewton => null()
950 !
951 ! -- allocate scalars in NumericalPackageType
952 call this%NumericalPackageType%allocate_scalars()
953 !
954 ! -- allocate character variables
955 call mem_allocate(this%listlabel, lenlistlabel, 'LISTLABEL', &
956 this%memoryPath)
957 !
958 ! -- allocate integer variables
959 call mem_allocate(this%isadvpak, 'ISADVPAK', this%memoryPath)
960 call mem_allocate(this%ibcnum, 'IBCNUM', this%memoryPath)
961 call mem_allocate(this%maxbound, 'MAXBOUND', this%memoryPath)
962 call mem_allocate(this%nbound, 'NBOUND', this%memoryPath)
963 call mem_allocate(this%ncolbnd, 'NCOLBND', this%memoryPath)
964 call mem_allocate(this%iscloc, 'ISCLOC', this%memoryPath)
965 call mem_allocate(this%naux, 'NAUX', this%memoryPath)
966 call mem_allocate(this%inamedbound, 'INAMEDBOUND', this%memoryPath)
967 call mem_allocate(this%iauxmultcol, 'IAUXMULTCOL', this%memoryPath)
968 call mem_allocate(this%inobspkg, 'INOBSPKG', this%memoryPath)
969 !
970 ! -- allocate the object and assign values to object variables
971 call mem_allocate(this%imover, 'IMOVER', this%memoryPath)
972 !
973 ! -- allocate flag for determining if vsc active
974 call mem_allocate(this%ivsc, 'IVSC', this%memoryPath)
975 !
976 ! -- allocate scalars for packages that add rows to the matrix (e.g. MAW)
977 call mem_allocate(this%npakeq, 'NPAKEQ', this%memoryPath)
978 call mem_allocate(this%ioffset, 'IOFFSET', this%memoryPath)
979 !
980 ! -- allocate TS objects
981 allocate (this%TsManager)
982 allocate (this%TasManager)
983 !
984 ! -- allocate text strings
985 call mem_allocate(this%auxname, lenauxname, 0, 'AUXNAME', this%memoryPath)
986 call mem_allocate(this%auxname_cst, lenauxname, 0, 'AUXNAME_CST', &
987 this%memoryPath)
988 !
989 ! -- Initialize variables
990 this%isadvpak = 0
991 this%ibcnum = 0
992 this%maxbound = 0
993 this%nbound = 0
994 this%ncolbnd = 0
995 this%iscloc = 0
996 this%naux = 0
997 this%inamedbound = 0
998 this%iauxmultcol = 0
999 this%inobspkg = 0
1000 this%imover = 0
1001 this%npakeq = 0
1002 this%ioffset = 0
1003 this%ivsc = 0
1004 !
1005 ! -- Set pointer to model inewton variable
1006 call mem_setptr(imodelnewton, 'INEWTON', create_mem_path(this%name_model))
1007 this%inewton = imodelnewton
1008 imodelnewton => null()
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
Here is the call graph for this function:

◆ bnd_ac()

subroutine bndmodule::bnd_ac ( class(bndtype), intent(inout) this,
integer(i4b), intent(in) moffset,
type(sparsematrix), intent(inout) sparse )
private

Add boundary package connection to the matrix for packages that add connections to the coefficient matrix. An example would be the GWF model MAW package. Base implementation that must be extended.

Parameters
[in,out]thisBndType object
[in]moffsetsolution matrix model offset
[in,out]sparsesparse object

Definition at line 237 of file BoundaryPackage.f90.

238 ! -- modules
239 use sparsemodule, only: sparsematrix
240 use simmodule, only: store_error
241 ! -- dummy
242 class(BndType), intent(inout) :: this !< BndType object
243 integer(I4B), intent(in) :: moffset !< solution matrix model offset
244 type(sparsematrix), intent(inout) :: sparse !< sparse object
This module contains simulation methods.
Definition Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition Sim.f90:94
Here is the call graph for this function:

◆ bnd_activate_viscosity()

subroutine bndmodule::bnd_activate_viscosity ( class(bndtype), intent(inout) this)
private

Method to activate addition of viscosity terms when package type is DRN, GHB, or RIV (method not needed by other packages at this point)

Parameters
[in,out]thisBndType object

Definition at line 1916 of file BoundaryPackage.f90.

1917 ! -- modules
1919 ! -- dummy
1920 class(BndType), intent(inout) :: this !< BndType object
1921 ! -- local
1922 integer(I4B) :: i
1923 !
1924 ! -- Set ivsc
1925 this%ivsc = 1
1926 !
1927 ! -- Allocate array for storing user-specified conductances
1928 ! (without the AUXMULTCOL multiplier)
1929 call mem_reallocate(this%condinput, this%maxbound, 'CONDINPUT', &
1930 this%memoryPath)
1931 do i = 1, this%maxbound
1932 this%condinput(i) = dzero
1933 end do
1934 !
1935 ! -- Allocate the viscosity ratio applied to each boundary conductance
1936 allocate (this%viscratio(this%maxbound))
1937 this%viscratio = done
1938 !
1939 ! -- Notify user via listing file viscosity accounted for by standard
1940 ! boundary package.
1941 write (this%iout, '(/1x,a,a)') 'VISCOSITY ACTIVE IN ', &
1942 trim(this%filtyp)//' PACKAGE CALCULATIONS: '//trim(adjustl(this%packName))

◆ bnd_ad()

subroutine bndmodule::bnd_ad ( class(bndtype) this)
private

Advance data in the boundary package. The method sets advances time series, time array series, and observation data. A boundary package only needs to override this method if additional data needs to be advanced.

Parameters
thisBndType object

Definition at line 386 of file BoundaryPackage.f90.

387 ! -- dummy
388 class(BndType) :: this !< BndType object
389 ! -- local
390 real(DP) :: begintime, endtime
391 !
392 ! -- Initialize time variables
393 begintime = totimc
394 endtime = begintime + delt
395 !
396 ! -- Advance the time series managers
397 call this%TsManager%ad()
398 call this%TasManager%ad()
399 !
400 ! -- For each observation, push simulated value and corresponding
401 ! simulation time from "current" to "preceding" and reset
402 ! "current" value.
403 call this%obs%obs_ad()

◆ bnd_ar()

subroutine bndmodule::bnd_ar ( class(bndtype), intent(inout) this)
private

Generic method to allocate and read static data for model boundary packages. A boundary package only needs to override this method if input data varies from the standard boundary package.

Parameters
[in,out]thisBndType object

Definition at line 266 of file BoundaryPackage.f90.

267 ! -- modules
269 ! -- dummy
270 class(BndType), intent(inout) :: this !< BndType object
271 !
272 ! -- allocate and read observations
273 call this%obs%obs_ar()
274 !
275 ! -- Allocate arrays in package superclass
276 call this%allocate_arrays()
277 !
278 ! -- read optional initial package parameters
279 call this%read_initial_attr()
280 !
281 ! -- setup pakmvrobj for standard stress packages
282 if (this%imover == 1) then
283 allocate (this%pakmvrobj)
284 call this%pakmvrobj%ar(this%maxbound, 0, this%memoryPath)
285 end if

◆ bnd_bd()

subroutine bndmodule::bnd_bd ( class(bndtype) this,
type(budgettype), intent(inout) model_budget )
private

Add the flow between package and the model (ratin and ratout) to the model budget. This method only needs to be overridden if a different calculation needs to be made.

Parameters
thisBndType object
[in,out]model_budgetmodel budget object

Definition at line 691 of file BoundaryPackage.f90.

692 ! -- modules
693 use tdismodule, only: delt
695 ! -- dummy
696 class(BndType) :: this !< BndType object
697 type(BudgetType), intent(inout) :: model_budget !< model budget object
698 ! -- local
699 character(len=LENPACKAGENAME) :: text
700 real(DP) :: ratin
701 real(DP) :: ratout
702 integer(I4B) :: isuppress_output
703 !
704 ! -- initialize local variables
705 isuppress_output = 0
706 !
707 ! -- call accumulator and add to the model budget
708 call rate_accumulator(this%simvals(1:this%nbound), ratin, ratout)
709 call model_budget%addentry(ratin, ratout, delt, this%text, &
710 isuppress_output, this%packName)
711 if (this%imover == 1 .and. this%isadvpak == 0) then
712 text = trim(adjustl(this%text))//'-TO-MVR'
713 text = adjustr(text)
714 call rate_accumulator(this%simtomvr(1:this%nbound), ratin, ratout)
715 call model_budget%addentry(ratin, ratout, delt, text, &
716 isuppress_output, this%packName)
717 end if
This module contains the BudgetModule.
Definition Budget.f90:20
subroutine, public rate_accumulator(flow, rin, rout)
Rate accumulator subroutine.
Definition Budget.f90:634
real(dp), pointer, public delt
length of the current time step
Definition tdis.f90:32
Derived type for the Budget object.
Definition Budget.f90:40
Here is the call graph for this function:

◆ bnd_bd_obs()

subroutine bndmodule::bnd_bd_obs ( class(bndtype) this)
private

Method to save simulated values for the boundary package. This method will need to be overridden for boundary packages with more observations than the calculate flow term (simvals) and to-mover.

Parameters
thisBndType object

Definition at line 1624 of file BoundaryPackage.f90.

1625 ! -- dummy
1626 class(BndType) :: this !< BndType object
1627 ! -- local
1628 integer(I4B) :: i
1629 integer(I4B) :: n
1630 real(DP) :: v
1631 type(ObserveType), pointer :: obsrv => null()
1632 !
1633 ! -- clear the observations
1634 call this%obs%obs_bd_clear()
1635 !
1636 ! -- Save simulated values for all of package's observations.
1637 do i = 1, this%obs%npakobs
1638 obsrv => this%obs%pakobs(i)%obsrv
1639 if (obsrv%BndFound) then
1640 do n = 1, obsrv%indxbnds_count
1641 if (obsrv%ObsTypeId == 'TO-MVR') then
1642 if (this%imover == 1) then
1643 v = this%pakmvrobj%get_qtomvr(obsrv%indxbnds(n))
1644 if (v > dzero) then
1645 v = -v
1646 end if
1647 else
1648 v = dnodata
1649 end if
1650 else
1651 v = this%simvals(obsrv%indxbnds(n))
1652 end if
1653 call this%obs%SaveOneSimval(obsrv, v)
1654 end do
1655 else
1656 call this%obs%SaveOneSimval(obsrv, dnodata)
1657 end if
1658 end do

◆ bnd_cc()

subroutine bndmodule::bnd_cc ( class(bndtype), intent(inout) this,
integer(i4b), intent(in) innertot,
integer(i4b), intent(in) kiter,
integer(i4b), intent(in) iend,
integer(i4b), intent(in) icnvgmod,
character(len=lenpakloc), intent(inout) cpak,
integer(i4b), intent(inout) ipak,
real(dp), intent(inout) dpak )
private

Perform additional convergence checks on the flow between the package and the model it is attached to. This additional convergence check is applied to packages that solve their own continuity equation as part of the formulate step at the beginning of a Picard iteration. A boundary package only needs to override this method if a specific boundary package solves its own continuity equation. Example packages that implement this additional convergence check is the CSUB, SFR, LAK, and UZF packages.

Parameters
[in,out]thisBndType object
[in]innertottotal number of inner iterations
[in]kiterPicard iteration number
[in]iendflag indicating if this is the last Picard iteration
[in]icnvgmodflag inficating if the model has met specific convergence criteria
[in,out]cpakstring for user node
[in,out]ipaklocation of the maximum dependent variable change
[in,out]dpakmaximum dependent variable change

Definition at line 524 of file BoundaryPackage.f90.

525 ! -- dummy
526 class(BndType), intent(inout) :: this !< BndType object
527 integer(I4B), intent(in) :: innertot !< total number of inner iterations
528 integer(I4B), intent(in) :: kiter !< Picard iteration number
529 integer(I4B), intent(in) :: iend !< flag indicating if this is the last Picard iteration
530 integer(I4B), intent(in) :: icnvgmod !< flag inficating if the model has met specific convergence criteria
531 character(len=LENPAKLOC), intent(inout) :: cpak !< string for user node
532 integer(I4B), intent(inout) :: ipak !< location of the maximum dependent variable change
533 real(DP), intent(inout) :: dpak !< maximum dependent variable change
534 !
535 ! -- No addition convergence check for boundary conditions

◆ bnd_cf()

subroutine bndmodule::bnd_cf ( class(bndtype) this)
private

Formulate the hcof and rhs terms for the package that will be added to the coefficient matrix and right-hand side vector. Base implementation that must be extended by each model boundary package.

Parameters
thisBndType object

Definition at line 437 of file BoundaryPackage.f90.

438 ! -- modules
439 class(BndType) :: this !< BndType object
440 !
441 ! -- bnd has no cf routine

◆ bnd_ck()

subroutine bndmodule::bnd_ck ( class(bndtype), intent(inout) this)
private

Check the boundary package period data. Base implementation that must be extended by each model boundary package.

Parameters
[in,out]thisBndType object

Definition at line 411 of file BoundaryPackage.f90.

412 ! -- dummy
413 class(BndType), intent(inout) :: this !< BndType object
414 !
415 ! -- check stress period data
416 ! -- each package must override generic functionality

◆ bnd_cq()

subroutine bndmodule::bnd_cq ( class(bndtype), intent(inout) this,
real(dp), dimension(:), intent(in) x,
real(dp), dimension(:), intent(inout), contiguous flowja,
integer(i4b), intent(in), optional iadv )
private

Calculate the flow between connected advanced package control volumes. Only advanced boundary packages need to override this method.

Parameters
[in,out]thisBndType object
[in]xcurrent dependent-variable value
[in,out]flowjaflow between two connected control volumes
[in]iadvflag that indicates if this is an advance package

Definition at line 543 of file BoundaryPackage.f90.

544 ! -- dummy
545 class(BndType), intent(inout) :: this !< BndType object
546 real(DP), dimension(:), intent(in) :: x !< current dependent-variable value
547 real(DP), dimension(:), contiguous, intent(inout) :: flowja !< flow between two connected control volumes
548 integer(I4B), optional, intent(in) :: iadv !< flag that indicates if this is an advance package
549 ! -- local
550 integer(I4B) :: imover
551 !
552 ! -- check for iadv optional variable to indicate this is an advanced
553 ! package and that mover calculations should not be done here
554 if (present(iadv)) then
555 if (iadv == 1) then
556 imover = 0
557 else
558 imover = 1
559 end if
560 else
561 imover = this%imover
562 end if
563 !
564 ! -- Calculate package flows. In the first call, simval is calculated
565 ! from hcof, rhs, and head. The second call may reduce the value in
566 ! simval by what is sent to the mover. The mover rate is stored in
567 ! simtomvr. imover is set to zero here for advanced packages, which
568 ! handle and store mover quantities separately.
569 call this%bnd_cq_simrate(x, flowja, imover)
570 if (imover == 1) then
571 call this%bnd_cq_simtomvr(flowja)
572 end if

◆ bnd_cq_simrate()

subroutine bndmodule::bnd_cq_simrate ( class(bndtype) this,
real(dp), dimension(:), intent(in) hnew,
real(dp), dimension(:), intent(inout) flowja,
integer(i4b), intent(in) imover )
private

Calculate the flow between package and the model (for example, GHB and groundwater cell) and store in the simvals variable. This method only needs to be overridden if a different calculation needs to be made.

Parameters
thisBndType object
[in]hnewcurrent dependent-variable value
[in,out]flowjaflow between package and model
[in]imoverflag indicating if the mover package is active

Definition at line 581 of file BoundaryPackage.f90.

582 ! -- dummy
583 class(BndType) :: this !< BndType object
584 real(DP), dimension(:), intent(in) :: hnew !< current dependent-variable value
585 real(DP), dimension(:), intent(inout) :: flowja !< flow between package and model
586 integer(I4B), intent(in) :: imover !< flag indicating if the mover package is active
587 ! -- local
588 integer(I4B) :: i
589 integer(I4B) :: node
590 integer(I4B) :: idiag
591 real(DP) :: rrate
592 !
593 ! -- If no boundaries, skip flow calculations.
594 if (this%nbound > 0) then
595 !
596 ! -- Loop through each boundary calculating flow.
597 do i = 1, this%nbound
598 node = this%nodelist(i)
599 !
600 ! -- If cell is no-flow or constant-head, then ignore it.
601 rrate = dzero
602 if (node > 0) then
603 idiag = this%dis%con%ia(node)
604 if (this%ibound(node) > 0) then
605 !
606 ! -- Calculate the flow rate into the cell.
607 rrate = this%hcof(i) * hnew(node) - this%rhs(i)
608 end if
609 flowja(idiag) = flowja(idiag) + rrate
610 end if
611 !
612 ! -- Save simulated value to simvals array.
613 this%simvals(i) = rrate
614 !
615 end do
616 end if

◆ bnd_cq_simtomvr()

subroutine bndmodule::bnd_cq_simtomvr ( class(bndtype) this,
real(dp), dimension(:), intent(inout) flowja )
private

Calculate the flow between package and the model that is sent to the mover package and store in the simtomvr variable. This method only needs to be overridden if a different calculation needs to be made.

Parameters
thisBndType object
[in,out]flowjaflow between package and model

Definition at line 625 of file BoundaryPackage.f90.

626 ! -- dummy
627 class(BndType) :: this !< BndType object
628 real(DP), dimension(:), intent(inout) :: flowja !< flow between package and model
629 ! -- local
630 integer(I4B) :: i
631 integer(I4B) :: node
632 real(DP) :: q
633 real(DP) :: fact
634 real(DP) :: rrate
635 !
636 ! -- If no boundaries, skip flow calculations.
637 if (this%nbound > 0) then
638 !
639 ! -- Loop through each boundary calculating flow.
640 do i = 1, this%nbound
641 node = this%nodelist(i)
642 !
643 ! -- If cell is no-flow or constant-head, then ignore it.
644 rrate = dzero
645 if (node > 0) then
646 if (this%ibound(node) > 0) then
647 !
648 ! -- Calculate the flow rate into the cell.
649 q = this%simvals(i)
650
651 if (q < dzero) then
652 rrate = this%pakmvrobj%get_qtomvr(i)
653 !
654 ! -- Evaluate if qtomvr exceeds the calculated rrate.
655 ! When fact is greater than 1, qtomvr is numerically
656 ! larger than rrate (which should never happen) and
657 ! represents a water budget error. When this happens,
658 ! rrate is set to 0. so that the water budget error is
659 ! correctly accounted for in the listing water budget.
660 fact = -rrate / q
661 if (fact > done) then
662 ! -- all flow goes to mover
663 q = dzero
664 else
665 ! -- magnitude of rrate (which is negative) is reduced by
666 ! qtomvr (which is positive)
667 q = q + rrate
668 end if
669 this%simvals(i) = q
670
671 if (rrate > dzero) then
672 rrate = -rrate
673 end if
674 end if
675 end if
676 end if
677 !
678 ! -- Save simulated value to simtomvr array.
679 this%simtomvr(i) = rrate
680 !
681 end do
682 end if

◆ bnd_da()

subroutine bndmodule::bnd_da ( class(bndtype) this)
private

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

Parameters
thisBndType object

Definition at line 850 of file BoundaryPackage.f90.

851 ! -- modules
853 ! -- dummy
854 class(BndType) :: this !< BndType object
855 !
856 ! -- deallocate arrays
857 call mem_deallocate(this%nodelist, 'NODELIST', this%memoryPath)
858 call mem_deallocate(this%noupdateauxvar, 'NOUPDATEAUXVAR', this%memoryPath)
859 call mem_deallocate(this%bound, 'BOUND', this%memoryPath)
860 call mem_deallocate(this%condinput, 'CONDINPUT', this%memoryPath)
861 if (allocated(this%viscratio)) deallocate (this%viscratio)
862 call mem_deallocate(this%hcof, 'HCOF', this%memoryPath)
863 call mem_deallocate(this%rhs, 'RHS', this%memoryPath)
864 call mem_deallocate(this%simvals, 'SIMVALS', this%memoryPath)
865 call mem_deallocate(this%simtomvr, 'SIMTOMVR', this%memoryPath)
866 call mem_deallocate(this%auxvar, 'AUXVAR', this%memoryPath)
867 call mem_deallocate(this%boundname, 'BOUNDNAME', this%memoryPath)
868 call mem_deallocate(this%boundname_cst, 'BOUNDNAME_CST', this%memoryPath)
869 call mem_deallocate(this%auxname, 'AUXNAME', this%memoryPath)
870 call mem_deallocate(this%auxname_cst, 'AUXNAME_CST', this%memoryPath)
871 nullify (this%icelltype)
872 !
873 ! -- pakmvrobj
874 if (this%imover /= 0) then
875 call this%pakmvrobj%da()
876 deallocate (this%pakmvrobj)
877 nullify (this%pakmvrobj)
878 end if
879 !
880 ! -- input table object
881 if (associated(this%inputtab)) then
882 call this%inputtab%table_da()
883 deallocate (this%inputtab)
884 nullify (this%inputtab)
885 end if
886 !
887 ! -- output table object
888 if (associated(this%outputtab)) then
889 call this%outputtab%table_da()
890 deallocate (this%outputtab)
891 nullify (this%outputtab)
892 end if
893 !
894 ! -- error table object
895 if (associated(this%errortab)) then
896 call this%errortab%table_da()
897 deallocate (this%errortab)
898 nullify (this%errortab)
899 end if
900 !
901 ! -- deallocate character variables
902 call mem_deallocate(this%listlabel, 'LISTLABEL', this%memoryPath)
903 !
904 ! -- Deallocate scalars
905 call mem_deallocate(this%isadvpak)
906 call mem_deallocate(this%ibcnum)
907 call mem_deallocate(this%maxbound)
908 call mem_deallocate(this%nbound)
909 call mem_deallocate(this%ncolbnd)
910 call mem_deallocate(this%iscloc)
911 call mem_deallocate(this%naux)
912 call mem_deallocate(this%inamedbound)
913 call mem_deallocate(this%iauxmultcol)
914 call mem_deallocate(this%inobspkg)
915 call mem_deallocate(this%imover)
916 call mem_deallocate(this%npakeq)
917 call mem_deallocate(this%ioffset)
918 call mem_deallocate(this%ivsc)
919 !
920 ! -- deallocate methods on objects
921 call this%obs%obs_da()
922 call this%TsManager%da()
923 call this%TasManager%da()
924 !
925 ! -- deallocate objects
926 deallocate (this%obs)
927 deallocate (this%TsManager)
928 deallocate (this%TasManager)
929 nullify (this%TsManager)
930 nullify (this%TasManager)
931 !
932 ! -- Deallocate parent object
933 call this%NumericalPackageType%da()

◆ bnd_df()

subroutine bndmodule::bnd_df ( class(bndtype), 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]thisBndType object
[in,out]neqnumber of equations
disdiscretization object

Definition at line 178 of file BoundaryPackage.f90.

179 ! -- modules
182 ! -- dummy
183 class(BndType), intent(inout) :: this !< BndType object
184 integer(I4B), intent(inout) :: neq !< number of equations
185 class(DisBaseType), pointer :: dis !< discretization object
186 !
187 ! -- set pointer to dis object for the model
188 this%dis => dis
189 !
190 ! -- Create time series managers
191 call tsmanager_cr(this%TsManager, this%iout)
192 call tasmanager_cr(this%TasManager, dis, this%name_model, this%iout)
193 !
194 ! -- create obs package
195 call obs_cr(this%obs, this%inobspkg)
196 !
197 ! -- Write information to model list file
198 write (this%iout, 1) this%filtyp, trim(adjustl(this%text)), this%inunit
1991 format(1x, /1x, a, ' -- ', a, ' PACKAGE, VERSION 8, 2/22/2014', &
200 ' INPUT READ FROM UNIT ', i0)
201 !
202 ! -- Initialize block parser
203 call this%parser%Initialize(this%inunit, this%iout)
204 !
205 ! -- set and read options
206 call this%read_options()
207 !
208 ! -- Now that time series will have been read, need to call the df
209 ! routine to define the manager
210 call this%tsmanager%tsmanager_df()
211 call this%tasmanager%tasmanager_df()
212 !
213 ! -- read the package dimensions block
214 call this%read_dimensions()
215 !
216 ! -- update package moffset for packages that add rows
217 if (this%npakeq > 0) then
218 this%ioffset = neq - this%dis%nodes
219 end if
220 !
221 ! -- update neq
222 neq = neq + this%npakeq
223 !
224 ! -- Store information needed for observations
225 if (this%bnd_obs_supported()) then
226 call this%obs%obs_df(this%iout, this%packName, this%filtyp, this%dis)
227 call this%bnd_df_obs()
228 end if
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:

◆ bnd_df_obs()

subroutine bndmodule::bnd_df_obs ( class(bndtype) this)
private

Method to define the observation types available in a boundary package. This method should be overridden if observations are supported in a boundary package.

Parameters
thisBndType object

Definition at line 1540 of file BoundaryPackage.f90.

1541 !
1542 ! -- dummy
1543 class(BndType) :: this !< BndType object
1544 !
1545 ! -- do nothing here. Override as needed.

◆ bnd_dt()

subroutine bndmodule::bnd_dt ( class(bndtype) this)
private
Parameters
thisBndType object

Definition at line 832 of file BoundaryPackage.f90.

833 ! -- dummy
834 class(BndType) :: this !< BndType object

◆ bnd_fc()

subroutine bndmodule::bnd_fc ( class(bndtype) this,
real(dp), dimension(:), intent(inout) rhs,
integer(i4b), dimension(:), intent(in) ia,
integer(i4b), dimension(:), intent(in) idxglo,
class(matrixbasetype), pointer matrix_sln )
private

Add the hcof and rhs terms for the boundary package to the coefficient matrix and right-hand side vector. A boundary package only needs to override this method if it is different for a specific boundary package.

Parameters
thisBndType object
[in,out]rhsright-hand side vector for model
[in]iasolution CRS row pointers
[in]idxglomapping vector for model (local) to solution (global)
matrix_slnsolution coefficient matrix

Definition at line 451 of file BoundaryPackage.f90.

452 ! -- dummy
453 class(BndType) :: this !< BndType object
454 real(DP), dimension(:), intent(inout) :: rhs !< right-hand side vector for model
455 integer(I4B), dimension(:), intent(in) :: ia !< solution CRS row pointers
456 integer(I4B), dimension(:), intent(in) :: idxglo !< mapping vector for model (local) to solution (global)
457 class(MatrixBaseType), pointer :: matrix_sln !< solution coefficient matrix
458 ! -- local
459 integer(I4B) :: i
460 integer(I4B) :: n
461 integer(I4B) :: ipos
462 !
463 ! -- Copy package rhs and hcof into solution rhs and amat
464 do i = 1, this%nbound
465 n = this%nodelist(i)
466 rhs(n) = rhs(n) + this%rhs(i)
467 ipos = ia(n)
468 call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
469 end do

◆ bnd_fn()

subroutine bndmodule::bnd_fn ( class(bndtype) this,
real(dp), dimension(:), intent(inout) rhs,
integer(i4b), dimension(:), intent(in) ia,
integer(i4b), dimension(:), intent(in) idxglo,
class(matrixbasetype), pointer matrix_sln )
private

Calculate and add the Newton-Raphson terms for the boundary package to the coefficient matrix and right-hand side vector. A boundary package only needs to override this method if a specific boundary package needs to add Newton-Raphson terms.

Parameters
thisBndType object
[in,out]rhsright-hand side vector for model
[in]iasolution CRS row pointers
[in]idxglomapping vector for model (local) to solution (global)
matrix_slnsolution coefficient matrix

Definition at line 479 of file BoundaryPackage.f90.

480 ! -- dummy
481 class(BndType) :: this !< BndType object
482 real(DP), dimension(:), intent(inout) :: rhs !< right-hand side vector for model
483 integer(I4B), dimension(:), intent(in) :: ia !< solution CRS row pointers
484 integer(I4B), dimension(:), intent(in) :: idxglo !< mapping vector for model (local) to solution (global)
485 class(MatrixBaseType), pointer :: matrix_sln !< solution coefficient matrix
486 !
487 ! -- No addition terms for Newton-Raphson with constant conductance
488 ! boundary conditions

◆ bnd_fp()

subroutine bndmodule::bnd_fp ( class(bndtype) this)
private
Parameters
thisBndType object

Definition at line 839 of file BoundaryPackage.f90.

840 ! -- dummy
841 class(BndType) :: this !< BndType object

◆ bnd_mc()

subroutine bndmodule::bnd_mc ( class(bndtype), intent(inout) this,
integer(i4b), intent(in) moffset,
class(matrixbasetype), pointer matrix_sln )
private

Map boundary package connection to the matrix for packages that add connections to the coefficient matrix. An example would be the GWF model MAW package. Base implementation that must be extended.

Parameters
[in,out]thisBndType object
[in]moffsetsolution matrix model offset
matrix_slnglobal system matrix

Definition at line 253 of file BoundaryPackage.f90.

254 ! -- dummy
255 class(BndType), intent(inout) :: this !< BndType object
256 integer(I4B), intent(in) :: moffset !< solution matrix model offset
257 class(MatrixBaseType), pointer :: matrix_sln !< global system matrix

◆ bnd_nur()

subroutine bndmodule::bnd_nur ( class(bndtype), intent(inout) this,
integer(i4b), intent(in) neqpak,
real(dp), dimension(neqpak), intent(inout) x,
real(dp), dimension(neqpak), intent(in) xtemp,
real(dp), dimension(neqpak), intent(inout) dx,
integer(i4b), intent(inout) inewtonur,
real(dp), intent(inout) dxmax,
integer(i4b), intent(inout) locmax )
private

Apply Newton-Raphson under-relaxation for a boundary package. A boundary package only needs to override this method if a specific boundary package needs to apply Newton-Raphson under-relaxation. An example is the MAW package which adds rows to the system of equations and may need to have the dependent-variable constrained by the bottom of the model.

Parameters
[in,out]thisBndType object
[in]neqpaknumber of equations in the package
[in,out]xdependent variable
[in]xtempprevious dependent variable
[in,out]dxchange in dependent variable
[in,out]inewtonurflag indicating if newton-raphson under-relaxation should be applied
[in,out]dxmaxmaximum change in the dependent variable
[in,out]locmaxlocation of the maximum change in the dependent variable

Definition at line 499 of file BoundaryPackage.f90.

500 ! -- dummy
501 class(BndType), intent(inout) :: this !< BndType object
502 integer(I4B), intent(in) :: neqpak !< number of equations in the package
503 real(DP), dimension(neqpak), intent(inout) :: x !< dependent variable
504 real(DP), dimension(neqpak), intent(in) :: xtemp !< previous dependent variable
505 real(DP), dimension(neqpak), intent(inout) :: dx !< change in dependent variable
506 integer(I4B), intent(inout) :: inewtonur !< flag indicating if newton-raphson under-relaxation should be applied
507 real(DP), intent(inout) :: dxmax !< maximum change in the dependent variable
508 integer(I4B), intent(inout) :: locmax !< location of the maximum change in the dependent variable
509 ! -- local
510 !
511 ! -- Newton-Raphson under-relaxation

◆ bnd_obs_supported()

logical(lgp) function bndmodule::bnd_obs_supported ( class(bndtype) this)
private

Function to determine if observations are supported by the boundary package. By default, observations are not supported. This method should be overridden if observations are supported in a boundary package.

Returns
supported boolean indicating if observations are supported
boolean indicating if observations are supported
Parameters
thisBndType object

Definition at line 1524 of file BoundaryPackage.f90.

1525 ! -- return variable
1526 logical(LGP) :: supported !< boolean indicating if observations are supported
1527 ! -- dummy
1528 class(BndType) :: this !< BndType object
1529 !
1530 ! -- initialize return variables
1531 supported = .false.

◆ bnd_options()

subroutine bndmodule::bnd_options ( class(bndtype), intent(inout) this,
character(len=*), intent(inout) option,
logical(lgp), intent(inout) found )
private

Read additional options for a boundary package. This method should be overridden options in addition to the base options are implemented in a boundary package.

Parameters
[in,out]thisBndType object
[in,out]optionoption keyword string
[in,out]foundboolean indicating if the option was found

Definition at line 1432 of file BoundaryPackage.f90.

1433 ! -- dummy
1434 class(BndType), intent(inout) :: this !< BndType object
1435 character(len=*), intent(inout) :: option !< option keyword string
1436 logical(LGP), intent(inout) :: found !< boolean indicating if the option was found
1437 !
1438 ! Return with found = .false.
1439 found = .false.

◆ bnd_ot_bdsummary()

subroutine bndmodule::bnd_ot_bdsummary ( class(bndtype) this,
integer(i4b), intent(in) kstp,
integer(i4b), intent(in) kper,
integer(i4b), intent(in) iout,
integer(i4b), intent(in) ibudfl )
private

Output advanced boundary package budget summary. This method only needs to be overridden for advanced packages that save budget summaries to the model listing file.

Parameters
thisBndType object
[in]kstptime step number
[in]kperperiod number
[in]ioutflag and unit number for the model listing file
[in]ibudflflag indicating budget should be written

Definition at line 756 of file BoundaryPackage.f90.

757 ! -- dummy
758 class(BndType) :: this !< BndType object
759 integer(I4B), intent(in) :: kstp !< time step number
760 integer(I4B), intent(in) :: kper !< period number
761 integer(I4B), intent(in) :: iout !< flag and unit number for the model listing file
762 integer(I4B), intent(in) :: ibudfl !< flag indicating budget should be written
763 !
764 ! -- override for advanced packages

◆ bnd_ot_dv()

subroutine bndmodule::bnd_ot_dv ( class(bndtype) this,
integer(i4b), intent(in) idvsave,
integer(i4b), intent(in) idvprint )
private

Output advanced boundary package dependent-variable terms. This method only needs to be overridden for advanced packages that save dependent variable terms for each control volume.

Parameters
thisBndType object
[in]idvsaveflag and unit number for dependent-variable output
[in]idvprintflag indicating if dependent-variable should be written to the model listing file

Definition at line 741 of file BoundaryPackage.f90.

742 ! -- dummy
743 class(BndType) :: this !< BndType object
744 integer(I4B), intent(in) :: idvsave !< flag and unit number for dependent-variable output
745 integer(I4B), intent(in) :: idvprint !< flag indicating if dependent-variable should be written to the model listing file
746 !
747 ! -- override for advanced packages

◆ bnd_ot_model_flows()

subroutine bndmodule::bnd_ot_model_flows ( class(bndtype) this,
integer(i4b), intent(in) icbcfl,
integer(i4b), intent(in) ibudfl,
integer(i4b), intent(in) icbcun,
integer(i4b), dimension(:), intent(in), optional imap )
private

Output flow terms between the boundary package and model to a binary file and/or print flows to the model listing file. This method should not need to be overridden.

Parameters
thisBndType object
[in]icbcflflag for cell-by-cell output
[in]ibudflflag indication if cell-by-cell data should be saved
[in]icbcununit number for cell-by-cell output
[in]imapmapping vector that converts the 1 to nbound values to lake number, maw number, etc.

Definition at line 773 of file BoundaryPackage.f90.

774 ! -- dummy
775 class(BndType) :: this !< BndType object
776 integer(I4B), intent(in) :: icbcfl !< flag for cell-by-cell output
777 integer(I4B), intent(in) :: ibudfl !< flag indication if cell-by-cell data should be saved
778 integer(I4B), intent(in) :: icbcun !< unit number for cell-by-cell output
779 integer(I4B), dimension(:), optional, intent(in) :: imap !< mapping vector that converts the 1 to nbound values to lake number, maw number, etc.
780 ! -- local
781 character(len=LINELENGTH) :: title
782 character(len=LENPACKAGENAME) :: text
783 integer(I4B) :: imover
784 !
785 ! -- Call generic subroutine to save and print simvals and simtomvr
786 title = trim(adjustl(this%text))//' PACKAGE ('//trim(this%packName)// &
787 ') FLOW RATES'
788 if (present(imap)) then
789 call save_print_model_flows(icbcfl, ibudfl, icbcun, this%iprflow, &
790 this%outputtab, this%nbound, this%nodelist, &
791 this%simvals, this%ibound, title, this%text, &
792 this%ipakcb, this%dis, this%naux, &
793 this%name_model, this%name_model, &
794 this%name_model, this%packName, &
795 this%auxname, this%auxvar, this%iout, &
796 this%inamedbound, this%boundname, imap)
797 else
798 call save_print_model_flows(icbcfl, ibudfl, icbcun, this%iprflow, &
799 this%outputtab, this%nbound, this%nodelist, &
800 this%simvals, this%ibound, title, this%text, &
801 this%ipakcb, this%dis, this%naux, &
802 this%name_model, this%name_model, &
803 this%name_model, this%packName, &
804 this%auxname, this%auxvar, this%iout, &
805 this%inamedbound, this%boundname)
806 end if
807 !
808 ! -- Set mover flag, and shut off if this is an advanced package. Advanced
809 ! packages must handle mover flows differently by including them in
810 ! their balance equations. These simtomvr flows are the general
811 ! flow to mover terms calculated by bnd_cq_simtomvr()
812 imover = this%imover
813 if (this%isadvpak /= 0) imover = 0
814 if (imover == 1) then
815 text = trim(adjustl(this%text))//'-TO-MVR'
816 text = adjustr(text)
817 title = trim(adjustl(this%text))//' PACKAGE ('// &
818 trim(this%packName)//') FLOW RATES TO-MVR'
819 call save_print_model_flows(icbcfl, ibudfl, icbcun, this%iprflow, &
820 this%outputtab, this%nbound, this%nodelist, &
821 this%simtomvr, this%ibound, title, text, &
822 this%ipakcb, this%dis, this%naux, &
823 this%name_model, this%name_model, &
824 this%name_model, this%packName, &
825 this%auxname, this%auxvar, this%iout, &
826 this%inamedbound, this%boundname)
827 end if
Here is the call graph for this function:

◆ bnd_ot_obs()

subroutine bndmodule::bnd_ot_obs ( class(bndtype) this)
private

Method to output simulated values for the boundary package. This method should not need to be overridden.

Parameters
thisBndType object

Definition at line 1666 of file BoundaryPackage.f90.

1667 ! -- dummy
1668 class(BndType) :: this !< BndType object
1669 !
1670 ! -- call the observation output method
1671 call this%obs%obs_ot()

◆ bnd_ot_package_flows()

subroutine bndmodule::bnd_ot_package_flows ( class(bndtype) this,
integer(i4b), intent(in) icbcfl,
integer(i4b), intent(in) ibudfl )
private

Output advanced boundary package flow terms. This method only needs to be overridden for advanced packages that save flow terms than contribute to the continuity equation for each control volume.

Parameters
thisBndType object
[in]icbcflflag and unit number for cell-by-cell output
[in]ibudflflag indication if cell-by-cell data should be saved

Definition at line 726 of file BoundaryPackage.f90.

727 ! -- dummy
728 class(BndType) :: this !< BndType object
729 integer(I4B), intent(in) :: icbcfl !< flag and unit number for cell-by-cell output
730 integer(I4B), intent(in) :: ibudfl !< flag indication if cell-by-cell data should be saved
731 !
732 ! -- override for advanced packages

◆ bnd_read_dimensions()

subroutine bndmodule::bnd_read_dimensions ( class(bndtype), intent(inout) this)
private

Read base dimensions for boundary packages. This method should not need to be overridden unless more than MAXBOUND is specified in the DIMENSIONS block.

Parameters
[in,out]thisBndType object

Definition at line 1360 of file BoundaryPackage.f90.

1361 ! -- dummy
1362 class(BndType), intent(inout) :: this !< BndType object
1363 ! -- local
1364 character(len=LINELENGTH) :: keyword
1365 logical(LGP) :: isfound
1366 logical(LGP) :: endOfBlock
1367 integer(I4B) :: ierr
1368 !
1369 ! -- get dimensions block
1370 call this%parser%GetBlock('DIMENSIONS', isfound, ierr, &
1371 supportopenclose=.true.)
1372 !
1373 ! -- parse dimensions block if detected
1374 if (isfound) then
1375 write (this%iout, '(/1x,a)') 'PROCESSING '//trim(adjustl(this%text))// &
1376 ' DIMENSIONS'
1377 do
1378 call this%parser%GetNextLine(endofblock)
1379 if (endofblock) exit
1380 call this%parser%GetStringCaps(keyword)
1381 select case (keyword)
1382 case ('MAXBOUND')
1383 this%maxbound = this%parser%GetInteger()
1384 write (this%iout, '(4x,a,i7)') 'MAXBOUND = ', this%maxbound
1385 case default
1386 write (errmsg, '(a,3(1x,a))') &
1387 'Unknown', trim(this%text), 'dimension:', trim(keyword)
1388 call store_error(errmsg)
1389 end select
1390 end do
1391 !
1392 write (this%iout, '(1x,a)') &
1393 'END OF '//trim(adjustl(this%text))//' DIMENSIONS'
1394 else
1395 call store_error('Required DIMENSIONS block not found.')
1396 call this%parser%StoreErrorUnit()
1397 end if
1398 !
1399 ! -- verify dimensions were set
1400 if (this%maxbound <= 0) then
1401 write (errmsg, '(a)') 'MAXBOUND must be an integer greater than zero.'
1402 call store_error(errmsg)
1403 end if
1404 !
1405 ! -- terminate if there are errors
1406 if (count_errors() > 0) then
1407 call this%parser%StoreErrorUnit()
1408 end if
1409 !
1410 ! -- Call define_listlabel to construct the list label that is written
1411 ! when PRINT_INPUT option is used.
1412 call this%define_listlabel()

◆ bnd_read_initial_attr()

subroutine bndmodule::bnd_read_initial_attr ( class(bndtype), intent(inout) this)
private

Read initial parameters for a boundary package. This method is not needed for most boundary packages. The SFR package is an example of a package that has overridden this method.

Parameters
[in,out]thisBndType object

Definition at line 1421 of file BoundaryPackage.f90.

1422 ! -- dummy
1423 class(BndType), intent(inout) :: this !< BndType object

◆ bnd_read_options()

subroutine bndmodule::bnd_read_options ( class(bndtype), intent(inout) this)
private

Read base options for boundary packages.

Parameters
[in,out]thisBndType object

Definition at line 1154 of file BoundaryPackage.f90.

1155 ! -- modules
1156 use inputoutputmodule, only: urdaux
1158 ! -- dummy
1159 class(BndType), intent(inout) :: this !< BndType object
1160 ! -- local
1161 character(len=:), allocatable :: line
1162 character(len=LINELENGTH) :: fname
1163 character(len=LINELENGTH) :: keyword
1164 character(len=LENAUXNAME) :: sfacauxname
1165 character(len=LENAUXNAME), dimension(:), allocatable :: caux
1166 integer(I4B) :: lloc
1167 integer(I4B) :: istart
1168 integer(I4B) :: istop
1169 integer(I4B) :: n
1170 integer(I4B) :: ierr
1171 integer(I4B) :: inobs
1172 logical(LGP) :: isfound
1173 logical(LGP) :: endOfBlock
1174 logical(LGP) :: foundchildclassoption
1175 ! -- format
1176 character(len=*), parameter :: fmtflow = &
1177 &"(4x, 'FLOWS WILL BE SAVED TO FILE: ', a, /4x, 'OPENED ON UNIT: ', I7)"
1178 character(len=*), parameter :: fmtflow2 = &
1179 &"(4x, 'FLOWS WILL BE SAVED TO BUDGET FILE SPECIFIED IN OUTPUT CONTROL')"
1180 character(len=*), parameter :: fmttas = &
1181 &"(4x, 'TIME-ARRAY SERIES DATA WILL BE READ FROM FILE: ', a)"
1182 character(len=*), parameter :: fmtts = &
1183 &"(4x, 'TIME-SERIES DATA WILL BE READ FROM FILE: ', a)"
1184 character(len=*), parameter :: fmtnme = &
1185 &"(a, i0, a)"
1186 !
1187 ! -- set default options
1188 !
1189 ! -- get options block
1190 call this%parser%GetBlock('OPTIONS', isfound, ierr, &
1191 supportopenclose=.true., blockrequired=.false.)
1192 !
1193 ! -- parse options block if detected
1194 if (isfound) then
1195 write (this%iout, '(/1x,a)') 'PROCESSING '//trim(adjustl(this%text)) &
1196 //' OPTIONS'
1197 do
1198 call this%parser%GetNextLine(endofblock)
1199 if (endofblock) then
1200 exit
1201 end if
1202 call this%parser%GetStringCaps(keyword)
1203 select case (keyword)
1204 case ('AUX', 'AUXILIARY')
1205 call this%parser%GetRemainingLine(line)
1206 lloc = 1
1207 call urdaux(this%naux, this%parser%iuactive, this%iout, lloc, &
1208 istart, istop, caux, line, this%text)
1209 call mem_reallocate(this%auxname, lenauxname, this%naux, &
1210 'AUXNAME', this%memoryPath)
1211 call mem_reallocate(this%auxname_cst, lenauxname, this%naux, &
1212 'AUXNAME_CST', this%memoryPath)
1213 do n = 1, this%naux
1214 this%auxname(n) = caux(n)
1215 this%auxname_cst(n) = caux(n)
1216 end do
1217 deallocate (caux)
1218 case ('SAVE_FLOWS')
1219 this%ipakcb = -1
1220 write (this%iout, fmtflow2)
1221 case ('PRINT_INPUT')
1222 this%iprpak = 1
1223 write (this%iout, '(4x,a)') &
1224 'LISTS OF '//trim(adjustl(this%text))//' CELLS WILL BE PRINTED.'
1225 case ('PRINT_FLOWS')
1226 this%iprflow = 1
1227 write (this%iout, '(4x,a)') trim(adjustl(this%text))// &
1228 ' FLOWS WILL BE PRINTED TO LISTING FILE.'
1229 case ('BOUNDNAMES')
1230 this%inamedbound = 1
1231 write (this%iout, '(4x,a)') trim(adjustl(this%text))// &
1232 ' BOUNDARIES HAVE NAMES IN LAST COLUMN.'
1233 case ('TS6')
1234 call this%parser%GetStringCaps(keyword)
1235 if (trim(adjustl(keyword)) /= 'FILEIN') then
1236 errmsg = 'TS6 keyword must be followed by "FILEIN" '// &
1237 'then by filename.'
1238 call store_error(errmsg)
1239 end if
1240 call this%parser%GetString(fname)
1241 write (this%iout, fmtts) trim(fname)
1242 call this%TsManager%add_tsfile(fname, this%inunit)
1243 case ('TAS6')
1244 if (this%AllowTimeArraySeries) then
1245 if (.not. this%dis%supports_layers()) then
1246 errmsg = 'TAS6 FILE cannot be used '// &
1247 'with selected discretization type.'
1248 call store_error(errmsg)
1249 end if
1250 else
1251 errmsg = 'The '//trim(this%filtyp)// &
1252 ' package does not support TIMEARRAYSERIESFILE'
1253 call store_error(errmsg)
1254 call this%parser%StoreErrorUnit()
1255 end if
1256 call this%parser%GetStringCaps(keyword)
1257 if (trim(adjustl(keyword)) /= 'FILEIN') then
1258 errmsg = 'TAS6 keyword must be followed by "FILEIN" '// &
1259 'then by filename.'
1260 call store_error(errmsg)
1261 call this%parser%StoreErrorUnit()
1262 end if
1263 call this%parser%GetString(fname)
1264 write (this%iout, fmttas) trim(fname)
1265 call this%TasManager%add_tasfile(fname)
1266 case ('AUXMULTNAME')
1267 call this%parser%GetStringCaps(sfacauxname)
1268 this%iauxmultcol = -1
1269 write (this%iout, '(4x,a,a)') &
1270 'AUXILIARY MULTIPLIER NAME: ', sfacauxname
1271 case ('OBS6')
1272 call this%parser%GetStringCaps(keyword)
1273 if (trim(adjustl(keyword)) /= 'FILEIN') then
1274 errmsg = 'OBS6 keyword must be followed by "FILEIN" '// &
1275 'then by filename.'
1276 call store_error(errmsg)
1277 call this%parser%StoreErrorUnit()
1278 end if
1279 if (this%obs%active) then
1280 errmsg = 'Multiple OBS6 keywords detected in OPTIONS block. '// &
1281 'Only one OBS6 entry allowed for a package.'
1282 call store_error(errmsg)
1283 end if
1284 this%obs%active = .true.
1285 call this%parser%GetString(this%obs%inputFilename)
1286 inobs = getunit()
1287 call openfile(inobs, this%iout, this%obs%inputFilename, 'OBS')
1288 this%obs%inUnitObs = inobs
1289 !
1290 ! -- right now these are options that are only available in the
1291 ! development version and are not included in the documentation.
1292 ! These options are only available when IDEVELOPMODE in
1293 ! constants module is set to 1
1294 case ('DEV_NO_NEWTON')
1295 call this%parser%DevOpt()
1296 this%inewton = 0
1297 write (this%iout, '(4x,a)') &
1298 'NEWTON-RAPHSON method disabled for unconfined cells'
1299 case default
1300 !
1301 ! -- Check for child class options
1302 call this%bnd_options(keyword, foundchildclassoption)
1303 !
1304 ! -- No child class options found, so print error message
1305 if (.not. foundchildclassoption) then
1306 write (errmsg, '(a,3(1x,a))') &
1307 'UNKNOWN', trim(adjustl(this%text)), 'OPTION:', trim(keyword)
1308 call store_error(errmsg)
1309 end if
1310 end select
1311 end do
1312 write (this%iout, '(1x,a)') &
1313 'END OF '//trim(adjustl(this%text))//' OPTIONS'
1314 else
1315 write (this%iout, '(1x,a)') 'NO '//trim(adjustl(this%text))// &
1316 ' OPTION BLOCK DETECTED.'
1317 end if
1318 !
1319 ! -- AUXMULTNAME was specified, so find column of auxvar that will be multiplier
1320 if (this%iauxmultcol < 0) then
1321 !
1322 ! -- Error if no aux variable specified
1323 if (this%naux == 0) then
1324 write (errmsg, '(a,2(1x,a))') &
1325 'AUXMULTNAME was specified as', trim(adjustl(sfacauxname)), &
1326 'but no AUX variables specified.'
1327 call store_error(errmsg)
1328 end if
1329 !
1330 ! -- Assign mult column
1331 this%iauxmultcol = 0
1332 do n = 1, this%naux
1333 if (sfacauxname == this%auxname(n)) then
1334 this%iauxmultcol = n
1335 exit
1336 end if
1337 end do
1338 !
1339 ! -- Error if aux variable cannot be found
1340 if (this%iauxmultcol == 0) then
1341 write (errmsg, '(a,2(1x,a))') &
1342 'AUXMULTNAME was specified as', trim(adjustl(sfacauxname)), &
1343 'but no AUX variable found with this name.'
1344 call store_error(errmsg)
1345 end if
1346 end if
1347 !
1348 ! -- terminate if errors were detected
1349 if (count_errors() > 0) then
1350 call this%parser%StoreErrorUnit()
1351 end if
subroutine, public urdaux(naux, inunit, iout, lloc, istart, istop, auxname, line, text)
Read auxiliary variables from an input line.
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.
Here is the call graph for this function:

◆ bnd_reset()

subroutine bndmodule::bnd_reset ( class(bndtype) this)
private
Parameters
thisBndType object

Definition at line 421 of file BoundaryPackage.f90.

422 class(BndType) :: this !< BndType object
423
424 if (this%imover == 1) then
425 call this%pakmvrobj%reset()
426 end if
427

◆ bnd_rp()

subroutine bndmodule::bnd_rp ( class(bndtype), intent(inout) this)
private

Generic method to read and prepare period data for model boundary packages. A boundary package only needs to override this method if period data varies from the standard boundary package.

Parameters
[in,out]thisBndType object

Definition at line 294 of file BoundaryPackage.f90.

295 ! -- modules
296 use tdismodule, only: kper, nper
297 ! -- dummy
298 class(BndType), intent(inout) :: this !< BndType object
299 ! -- local
300 integer(I4B) :: ierr
301 integer(I4B) :: nlist
302 logical(LGP) :: isfound
303 character(len=LINELENGTH) :: line
304 ! -- formats
305 character(len=*), parameter :: fmtblkerr = &
306 &"('Looking for BEGIN PERIOD iper. Found ', a, ' instead.')"
307 character(len=*), parameter :: fmtlsp = &
308 &"(1X,/1X,'REUSING ',A,'S FROM LAST STRESS PERIOD')"
309 character(len=*), parameter :: fmtnbd = &
310 "(1X,/1X,'THE NUMBER OF ACTIVE ',A,'S (',I6, &
311 &') IS GREATER THAN MAXIMUM(',I6,')')"
312 !
313 ! -- Set ionper to the stress period number for which a new block of data
314 ! will be read.
315 if (this%inunit == 0) return
316 !
317 ! -- get stress period data
318 if (this%ionper < kper) then
319 !
320 ! -- get period block
321 call this%parser%GetBlock('PERIOD', isfound, ierr, &
322 supportopenclose=.true., &
323 blockrequired=.false.)
324 if (isfound) then
325 !
326 ! -- read ionper and check for increasing period numbers
327 call this%read_check_ionper()
328 else
329 !
330 ! -- PERIOD block not found
331 if (ierr < 0) then
332 ! -- End of file found; data applies for remainder of simulation.
333 this%ionper = nper + 1
334 else
335 ! -- Found invalid block
336 call this%parser%GetCurrentLine(line)
337 write (errmsg, fmtblkerr) adjustl(trim(line))
338 call store_error(errmsg)
339 call this%parser%StoreErrorUnit()
340 end if
341 end if
342 end if
343 !
344 ! -- read data if ionper == kper
345 if (this%ionper == kper) then
346 nlist = -1
347 ! -- Remove all time-series and time-array-series links associated with
348 ! this package.
349 call this%TsManager%Reset(this%packName)
350 call this%TasManager%Reset(this%packName)
351 !
352 ! -- Read data as a list
353 call this%dis%read_list(this%parser%line_reader, &
354 this%parser%iuactive, this%iout, &
355 this%iprpak, nlist, this%inamedbound, &
356 this%iauxmultcol, this%nodelist, &
357 this%bound, this%auxvar, this%auxname, &
358 this%boundname, this%listlabel, &
359 this%packName, this%tsManager, this%iscloc)
360 this%nbound = nlist
361 !
362 ! Define the tsLink%Text value(s) appropriately.
363 ! E.g. for WEL package, entry 1, assign tsLink%Text = 'Q'
364 ! For RIV package, entry 1 text = 'STAGE', entry 2 text = 'COND',
365 ! entry 3 text = 'RBOT'; etc.
366 call this%bnd_rp_ts()
367 !
368 ! -- Terminate the block
369 call this%parser%terminateblock()
370 !
371 ! -- Copy boundname into boundname_cst
372 call this%copy_boundname()
373 !
374 else
375 write (this%iout, fmtlsp) trim(this%filtyp)
376 end if
integer(i4b), pointer, public kper
current stress period number
Definition tdis.f90:26
integer(i4b), pointer, public nper
number of stress period
Definition tdis.f90:24

◆ bnd_rp_log()

subroutine bndmodule::bnd_rp_log ( class(bndtype), intent(inout) this)
private

Write stress period input to the listing file if requested. This default implementation is a no-op; BndExtType overrides it.

Definition at line 1692 of file BoundaryPackage.f90.

1693 ! -- dummy
1694 class(BndType), intent(inout) :: this

◆ bnd_rp_obs()

subroutine bndmodule::bnd_rp_obs ( class(bndtype), intent(inout) this)
private

Method to read and prepare observations for a boundary package This method should not need to be overridden for most boundary packages.

Parameters
[in,out]thisBndType object

Definition at line 1554 of file BoundaryPackage.f90.

1555 ! -- dummy
1556 class(BndType), intent(inout) :: this !< BndType object
1557 ! -- local
1558 integer(I4B) :: i
1559 integer(I4B) :: j
1560 class(ObserveType), pointer :: obsrv => null()
1561 character(len=LENBOUNDNAME) :: bname
1562 logical(LGP) :: jfound
1563 !
1564 if (.not. this%bnd_obs_supported()) return
1565 !
1566 do i = 1, this%obs%npakobs
1567 obsrv => this%obs%pakobs(i)%obsrv
1568 !
1569 ! -- indxbnds needs to be reset each stress period because
1570 ! list of boundaries can change each stress period.
1571 call obsrv%ResetObsIndex()
1572 obsrv%BndFound = .false.
1573 !
1574 bname = obsrv%FeatureName
1575 if (bname /= '') then
1576 !
1577 ! -- Observation location(s) is(are) based on a boundary name.
1578 ! Iterate through all boundaries to identify and store
1579 ! corresponding index(indices) in bound array.
1580 jfound = .false.
1581 if (this%inamedbound == 0) then
1582 ! -- boundname has no elements without BOUNDNAMES
1583 write (errmsg, '(a,1x,a,1x,a,1x,a,1x,a,1x,a)') &
1584 'Observation', trim(obsrv%Name), 'uses boundary name', trim(bname), &
1585 'but BOUNDNAMES is not specified in package', trim(this%packName)
1586 call store_error(errmsg)
1587 cycle
1588 end if
1589 do j = 1, this%nbound
1590 if (this%boundname(j) == bname) then
1591 jfound = .true.
1592 obsrv%BndFound = .true.
1593 obsrv%CurrentTimeStepEndValue = dzero
1594 call obsrv%AddObsIndex(j)
1595 end if
1596 end do
1597 else
1598 !
1599 ! -- Observation location is a single node number
1600 jfound = .false.
1601 jloop: do j = 1, this%nbound
1602 if (this%nodelist(j) == obsrv%NodeNumber) then
1603 jfound = .true.
1604 obsrv%BndFound = .true.
1605 obsrv%CurrentTimeStepEndValue = dzero
1606 call obsrv%AddObsIndex(j)
1607 end if
1608 end do jloop
1609 end if
1610 end do
1611 !
1612 if (count_errors() > 0) then
1613 call store_error_filename(this%input_fname)
1614 end if

◆ bnd_rp_ts()

subroutine bndmodule::bnd_rp_ts ( class(bndtype), intent(inout) this)
private

Assign the time series links for the boundary package. This method will need to be overridden for boundary packages that support time series.

Definition at line 1682 of file BoundaryPackage.f90.

1683 ! -- dummy
1684 class(BndType), intent(inout) :: this

◆ castasbndclass()

class(bndtype) function, pointer, private bndmodule::castasbndclass ( class(*), intent(inout), pointer obj)
private

Subroutine to cast an object as a boundary package type.

Parameters
[in,out]objinput object
Returns
output class of type BndType

Definition at line 1703 of file BoundaryPackage.f90.

1704 class(*), pointer, intent(inout) :: obj !< input object
1705 class(BndType), pointer :: res !< output class of type BndType
1706 !
1707 ! -- initialize res
1708 res => null()
1709 !
1710 ! -- make sure obj is associated
1711 if (.not. associated(obj)) return
1712 !
1713 ! -- point res to obj
1714 select type (obj)
1715 class is (bndtype)
1716 res => obj
1717 end select
Here is the caller graph for this function:

◆ copy_boundname()

subroutine bndmodule::copy_boundname ( class(bndtype), intent(inout) this)
private

boundnames_cst is an array of type(CharacterStringType), which can be stored in the MemoryManager.

Parameters
[in,out]thisBndType object

Definition at line 1447 of file BoundaryPackage.f90.

1448 ! -- dummy
1449 class(BndType), intent(inout) :: this !< BndType object
1450 ! -- local
1451 integer(I4B) :: i
1452 !
1453 ! copy from boundname to boundname_cst, which can be
1454 ! stored in the memory manager
1455 if (this%inamedbound /= 0) then
1456 do i = 1, size(this%boundname)
1457 this%boundname_cst(i) = this%boundname(i)
1458 end do
1459 end if

◆ define_listlabel()

subroutine bndmodule::define_listlabel ( class(bndtype), intent(inout) this)
private

Method defined the list label for the boundary package. This method needs to be overridden by each boundary package.

Parameters
[in,out]thisBndType object

Definition at line 1509 of file BoundaryPackage.f90.

1510 ! -- dummy
1511 class(BndType), intent(inout) :: this !< BndType object

◆ getbndfromlist()

class(bndtype) function, pointer, public bndmodule::getbndfromlist ( type(listtype), intent(inout) list,
integer(i4b), intent(in) idx )

Function to get a boundary package from a package list.

Returns
res boundary package object
Parameters
[in,out]listpackage list
[in]idxpackage number
Returns
boundary package idx

Definition at line 1742 of file BoundaryPackage.f90.

1743 ! -- dummy
1744 type(ListType), intent(inout) :: list !< package list
1745 integer(I4B), intent(in) :: idx !< package number
1746 class(BndType), pointer :: res !< boundary package idx
1747 ! -- local
1748 class(*), pointer :: obj
1749 !
1750 ! -- get the package from the list
1751 obj => list%GetItem(idx)
1752 res => castasbndclass(obj)
Here is the call graph for this function:

◆ pack_initialize()

subroutine bndmodule::pack_initialize ( class(bndtype) this)
private

Allocate and initialize select base boundary package members. This method needs to be overridden by a package if it is needed for a specific package.

Parameters
thisBndType object

Definition at line 1123 of file BoundaryPackage.f90.

1124 ! -- dummy
1125 class(BndType) :: this !< BndType object

◆ pak_setup_outputtab()

subroutine bndmodule::pak_setup_outputtab ( class(bndtype), intent(inout) this)
private

Setup output table for a boundary package that is used to output package to model flow terms to the model listing file.

Parameters
[in,out]thisBndType object

Definition at line 1467 of file BoundaryPackage.f90.

1468 ! -- dummy
1469 class(BndType), intent(inout) :: this !< BndType object
1470 ! -- local
1471 character(len=LINELENGTH) :: title
1472 character(len=LINELENGTH) :: text
1473 integer(I4B) :: ntabcol
1474 !
1475 ! -- allocate and initialize the output table
1476 if (this%iprflow /= 0) then
1477 !
1478 ! -- dimension table
1479 ntabcol = 3
1480 if (this%inamedbound > 0) then
1481 ntabcol = ntabcol + 1
1482 end if
1483 !
1484 ! -- initialize the output table object
1485 title = trim(adjustl(this%text))//' PACKAGE ('//trim(this%packName)// &
1486 ') FLOW RATES'
1487 call table_cr(this%outputtab, this%packName, title)
1488 call this%outputtab%table_df(this%maxbound, ntabcol, this%iout, &
1489 transient=.true.)
1490 text = 'NUMBER'
1491 call this%outputtab%initialize_column(text, 10, alignment=tabcenter)
1492 text = 'CELLID'
1493 call this%outputtab%initialize_column(text, 20, alignment=tableft)
1494 text = 'RATE'
1495 call this%outputtab%initialize_column(text, 15, alignment=tabcenter)
1496 if (this%inamedbound > 0) then
1497 text = 'NAME'
1498 call this%outputtab%initialize_column(text, lenboundname, &
1499 alignment=tableft)
1500 end if
1501 end if
Here is the call graph for this function:

◆ save_print_model_flows()

subroutine, public bndmodule::save_print_model_flows ( integer(i4b), intent(in) icbcfl,
integer(i4b), intent(in) ibudfl,
integer(i4b), intent(in) icbcun,
integer(i4b), intent(in) iprflow,
type(tabletype), intent(inout), pointer outputtab,
integer(i4b), intent(in) nbound,
integer(i4b), dimension(:), intent(in), contiguous nodelist,
real(dp), dimension(:), intent(in), contiguous flow,
integer(i4b), dimension(:), intent(in), contiguous ibound,
character(len=*), intent(in) title,
character(len=*), intent(in) text,
integer(i4b), intent(in) ipakcb,
class(disbasetype), intent(in) dis,
integer(i4b), intent(in) naux,
character(len=*), intent(in) textmodel,
character(len=*), intent(in) textpackage,
character(len=*), intent(in) dstmodel,
character(len=*), intent(in) dstpackage,
character(len=*), dimension(:), intent(in) auxname,
real(dp), dimension(:, :), intent(in) auxvar,
integer(i4b), intent(in) iout,
integer(i4b), intent(in) inamedbound,
character(len=lenboundname), dimension(:), contiguous boundname,
integer(i4b), dimension(:), intent(in), optional imap )

Subroutine to save and/or print package flows to a model to a binary cell-by-cell flow file and the model listing file.

Parameters
[in]icbcflflag indicating if the flow should be saved to the binary cell-by-cell flow file
[in]ibudflflag indicating if the flow should be saved or printed
[in]icbcunfile unit number for the binary cell-by-cell file
[in]iprflowprint flows to list file
[in,out]outputtaboutput table object
[in]nboundnumber of boundaries this stress period
[in]nodelistboundary node list
[in]flowboundary flow terms
[in]iboundibound array for the model
[in]titletitle for the output table
[in]textflow term description
[in]ipakcbflag indicating if flows will be saved
[in]dismodel discretization object
[in]nauxnumber of aux variables
[in]textmodelmodel name
[in]textpackagepackage name
[in]dstmodelmover destination model
[in]dstpackagemover destination package
[in]auxnameaux variable name
[in]auxvaraux variable
[in]ioutmodel listing file unit
[in]inamedboundflag indicating if boundnames are defined for the boundary entries
boundnamebound names
[in]imapmapping array

Definition at line 1760 of file BoundaryPackage.f90.

1766 ! -- modules
1767 use tdismodule, only: kstp, kper
1768 ! -- dummy
1769 integer(I4B), intent(in) :: icbcfl !< flag indicating if the flow should be saved to the binary cell-by-cell flow file
1770 integer(I4B), intent(in) :: ibudfl !< flag indicating if the flow should be saved or printed
1771 integer(I4B), intent(in) :: icbcun !< file unit number for the binary cell-by-cell file
1772 integer(I4B), intent(in) :: iprflow !< print flows to list file
1773 type(TableType), pointer, intent(inout) :: outputtab !< output table object
1774 integer(I4B), intent(in) :: nbound !< number of boundaries this stress period
1775 integer(I4B), dimension(:), contiguous, intent(in) :: nodelist !< boundary node list
1776 real(DP), dimension(:), contiguous, intent(in) :: flow !< boundary flow terms
1777 integer(I4B), dimension(:), contiguous, intent(in) :: ibound !< ibound array for the model
1778 character(len=*), intent(in) :: title !< title for the output table
1779 character(len=*), intent(in) :: text !< flow term description
1780 integer(I4B), intent(in) :: ipakcb !< flag indicating if flows will be saved
1781 class(DisBaseType), intent(in) :: dis !< model discretization object
1782 integer(I4B), intent(in) :: naux !< number of aux variables
1783 character(len=*), intent(in) :: textmodel !< model name
1784 character(len=*), intent(in) :: textpackage !< package name
1785 character(len=*), intent(in) :: dstmodel !< mover destination model
1786 character(len=*), intent(in) :: dstpackage !< mover destination package
1787 character(len=*), dimension(:), intent(in) :: auxname !< aux variable name
1788 real(DP), dimension(:, :), intent(in) :: auxvar !< aux variable
1789 integer(I4B), intent(in) :: iout !< model listing file unit
1790 integer(I4B), intent(in) :: inamedbound !< flag indicating if boundnames are defined for the boundary entries
1791 character(len=LENBOUNDNAME), dimension(:), contiguous :: boundname !< bound names
1792 integer(I4B), dimension(:), optional, intent(in) :: imap !< mapping array
1793 ! -- local
1794 character(len=20) :: nodestr
1795 integer(I4B) :: nodeu
1796 integer(I4B) :: maxrows
1797 integer(I4B) :: i
1798 integer(I4B) :: node
1799 integer(I4B) :: n2
1800 integer(I4B) :: ibinun
1801 integer(I4B) :: nboundcount
1802 real(DP) :: rrate
1803 real(DP), dimension(naux) :: auxrow
1804 ! -- for observations
1805 character(len=LENBOUNDNAME) :: bname
1806 !
1807 ! -- set table kstp and kper
1808 if (iprflow /= 0) then
1809 call outputtab%set_kstpkper(kstp, kper)
1810 end if
1811 !
1812 ! -- set maxrows
1813 maxrows = 0
1814 if (ibudfl /= 0 .and. iprflow /= 0) then
1815 do i = 1, nbound
1816 node = nodelist(i)
1817 if (node > 0) then
1818 maxrows = maxrows + 1
1819 end if
1820 end do
1821 if (maxrows > 0) then
1822 call outputtab%set_maxbound(maxrows)
1823 end if
1824 call outputtab%set_title(title)
1825 end if
1826 !
1827 ! -- Set unit number for binary output
1828 if (ipakcb < 0) then
1829 ibinun = icbcun
1830 else if (ipakcb == 0) then
1831 ibinun = 0
1832 else
1833 ibinun = ipakcb
1834 end if
1835 if (icbcfl == 0) then
1836 ibinun = 0
1837 end if
1838 !
1839 ! -- If cell-by-cell flows will be saved as a list, write header.
1840 if (ibinun /= 0) then
1841 !
1842 ! -- Count nbound as the number of entries with node > 0
1843 ! SFR, for example, can have a 'none' connection, which
1844 ! means it should be excluded from budget file
1845 nboundcount = 0
1846 do i = 1, nbound
1847 node = nodelist(i)
1848 if (node > 0) nboundcount = nboundcount + 1
1849 end do
1850 call dis%record_srcdst_list_header(text, textmodel, textpackage, &
1851 dstmodel, dstpackage, naux, &
1852 auxname, ibinun, nboundcount, iout)
1853 end if
1854 !
1855 ! -- If no boundaries, skip flow calculations.
1856 if (nbound > 0) then
1857 !
1858 ! -- Loop through each boundary calculating flow.
1859 do i = 1, nbound
1860 node = nodelist(i)
1861 ! -- assign boundary name
1862 if (inamedbound > 0) then
1863 bname = boundname(i)
1864 else
1865 bname = ''
1866 end if
1867 !
1868 ! -- If cell is no-flow or constant-head, then ignore it.
1869 rrate = dzero
1870 if (node > 0) then
1871 !
1872 ! -- Use simval, which was calculated in cq()
1873 rrate = flow(i)
1874 !
1875 ! -- Print the individual rates if the budget is being printed
1876 ! and PRINT_FLOWS was specified (iprflow < 0). Rates are
1877 ! printed even if ibound < 1.
1878 if (ibudfl /= 0) then
1879 if (iprflow /= 0) then
1880 !
1881 ! -- set nodestr and write outputtab table
1882 nodeu = dis%get_nodeuser(node)
1883 call dis%nodeu_to_string(nodeu, nodestr)
1884 call outputtab%print_list_entry(i, trim(adjustl(nodestr)), &
1885 rrate, bname)
1886 end if
1887 end if
1888 !
1889 ! -- If saving cell-by-cell flows in list, write flow
1890 if (ibinun /= 0) then
1891 n2 = i
1892 if (present(imap)) n2 = imap(i)
1893 if (naux > 0) then
1894 auxrow(:) = auxvar(:, i)
1895 end if
1896 call dis%record_mf6_list_entry(ibinun, node, n2, rrate, naux, &
1897 auxrow, olconv2=.false.)
1898 end if
1899 end if
1900 !
1901 end do
1902 if (ibudfl /= 0) then
1903 if (iprflow /= 0) then
1904 write (iout, '(1x)')
1905 end if
1906 end if
1907
1908 end if
integer(i4b), pointer, public kstp
current time step number
Definition tdis.f90:27
Here is the caller graph for this function:

◆ set_pointers()

subroutine bndmodule::set_pointers ( class(bndtype) this,
integer(i4b), pointer neq,
integer(i4b), dimension(:), pointer, contiguous ibound,
real(dp), dimension(:), pointer, contiguous xnew,
real(dp), dimension(:), pointer, contiguous xold,
real(dp), dimension(:), pointer, contiguous flowja )
private

Set pointers to model variables so that a package has access to these variables. This base method should not need to be overridden.

Parameters
thisBndType object
neqnumber of equations in the model
iboundmodel idomain
xnewcurrent dependent variable
xoldprevious dependent variable
flowjaconnection flow terms

Definition at line 1133 of file BoundaryPackage.f90.

1134 ! -- dummy
1135 class(BndType) :: this !< BndType object
1136 integer(I4B), pointer :: neq !< number of equations in the model
1137 integer(I4B), dimension(:), pointer, contiguous :: ibound !< model idomain
1138 real(DP), dimension(:), pointer, contiguous :: xnew !< current dependent variable
1139 real(DP), dimension(:), pointer, contiguous :: xold !< previous dependent variable
1140 real(DP), dimension(:), pointer, contiguous :: flowja !< connection flow terms
1141 !
1142 ! -- Set the pointers
1143 this%neq => neq
1144 this%ibound => ibound
1145 this%xnew => xnew
1146 this%xold => xold
1147 this%flowja => flowja