MODFLOW 6  version 6.8.0.dev0
USGS Modular Hydrologic Model
bndmodule Module Reference

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

Data Types

type  bndtype
 @ brief BndType More...
 

Functions/Subroutines

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

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 1745 of file BoundaryPackage.f90.

1746  ! -- dummy
1747  type(ListType), intent(inout) :: list !< package list
1748  class(BndType), pointer, intent(inout) :: bnd !< boundary package
1749  ! -- local
1750  class(*), pointer :: obj
1751  !
1752  obj => bnd
1753  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 
)

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 1021 of file BoundaryPackage.f90.

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

◆ allocate_scalars()

subroutine bndmodule::allocate_scalars ( class(bndtype this)

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 946 of file BoundaryPackage.f90.

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

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:92
Here is the call graph for this function:

◆ bnd_activate_viscosity()

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

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 1936 of file BoundaryPackage.f90.

1937  ! -- modules
1939  ! -- dummy
1940  class(BndType), intent(inout) :: this !< BndType object
1941  ! -- local
1942  integer(I4B) :: i
1943  !
1944  ! -- Set ivsc and reallocate viscratios to be of size MAXBOUND
1945  this%ivsc = 1
1946  !
1947  ! -- Allocate array for storing user-specified conductances
1948  ! modified by updated viscosity values
1949  call mem_reallocate(this%condinput, this%maxbound, 'CONDINPUT', &
1950  this%memoryPath)
1951  do i = 1, this%maxbound
1952  this%condinput(i) = dzero
1953  end do
1954  !
1955  ! -- Notify user via listing file viscosity accounted for by standard
1956  ! boundary package.
1957  write (this%iout, '(/1x,a,a)') 'VISCOSITY ACTIVE IN ', &
1958  trim(this%filtyp)//' PACKAGE CALCULATIONS: '//trim(adjustl(this%packName))

◆ bnd_ad()

subroutine bndmodule::bnd_ad ( class(bndtype this)

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 391 of file BoundaryPackage.f90.

392  ! -- dummy
393  class(BndType) :: this !< BndType object
394  ! -- local
395  real(DP) :: begintime, endtime
396  !
397  ! -- Initialize time variables
398  begintime = totimc
399  endtime = begintime + delt
400  !
401  ! -- Advance the time series managers
402  call this%TsManager%ad()
403  call this%TasManager%ad()
404  !
405  ! -- For each observation, push simulated value and corresponding
406  ! simulation time from "current" to "preceding" and reset
407  ! "current" value.
408  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 696 of file BoundaryPackage.f90.

697  ! -- modules
698  use tdismodule, only: delt
700  ! -- dummy
701  class(BndType) :: this !< BndType object
702  type(BudgetType), intent(inout) :: model_budget !< model budget object
703  ! -- local
704  character(len=LENPACKAGENAME) :: text
705  real(DP) :: ratin
706  real(DP) :: ratout
707  integer(I4B) :: isuppress_output
708  !
709  ! -- initialize local variables
710  isuppress_output = 0
711  !
712  ! -- call accumulator and add to the model budget
713  call rate_accumulator(this%simvals(1:this%nbound), ratin, ratout)
714  call model_budget%addentry(ratin, ratout, delt, this%text, &
715  isuppress_output, this%packName)
716  if (this%imover == 1 .and. this%isadvpak == 0) then
717  text = trim(adjustl(this%text))//'-TO-MVR'
718  text = adjustr(text)
719  call rate_accumulator(this%simtomvr(1:this%nbound), ratin, ratout)
720  call model_budget%addentry(ratin, ratout, delt, text, &
721  isuppress_output, this%packName)
722  end if
This module contains the BudgetModule.
Definition: Budget.f90:20
subroutine, public rate_accumulator(flow, rin, rout)
@ brief Rate accumulator subroutine
Definition: Budget.f90:632
real(dp), pointer, public delt
length of the current time step
Definition: tdis.f90:32
Derived type for the Budget object.
Definition: Budget.f90:39
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 1645 of file BoundaryPackage.f90.

1646  ! -- dummy
1647  class(BndType) :: this !< BndType object
1648  ! -- local
1649  integer(I4B) :: i
1650  integer(I4B) :: n
1651  real(DP) :: v
1652  type(ObserveType), pointer :: obsrv => null()
1653  !
1654  ! -- clear the observations
1655  call this%obs%obs_bd_clear()
1656  !
1657  ! -- Save simulated values for all of package's observations.
1658  do i = 1, this%obs%npakobs
1659  obsrv => this%obs%pakobs(i)%obsrv
1660  if (obsrv%BndFound) then
1661  do n = 1, obsrv%indxbnds_count
1662  if (obsrv%ObsTypeId == 'TO-MVR') then
1663  if (this%imover == 1) then
1664  v = this%pakmvrobj%get_qtomvr(obsrv%indxbnds(n))
1665  if (v > dzero) then
1666  v = -v
1667  end if
1668  else
1669  v = dnodata
1670  end if
1671  else
1672  v = this%simvals(obsrv%indxbnds(n))
1673  end if
1674  call this%obs%SaveOneSimval(obsrv, v)
1675  end do
1676  else
1677  call this%obs%SaveOneSimval(obsrv, dnodata)
1678  end if
1679  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 529 of file BoundaryPackage.f90.

530  ! -- dummy
531  class(BndType), intent(inout) :: this !< BndType object
532  integer(I4B), intent(in) :: innertot !< total number of inner iterations
533  integer(I4B), intent(in) :: kiter !< Picard iteration number
534  integer(I4B), intent(in) :: iend !< flag indicating if this is the last Picard iteration
535  integer(I4B), intent(in) :: icnvgmod !< flag inficating if the model has met specific convergence criteria
536  character(len=LENPAKLOC), intent(inout) :: cpak !< string for user node
537  integer(I4B), intent(inout) :: ipak !< location of the maximum dependent variable change
538  real(DP), intent(inout) :: dpak !< maximum dependent variable change
539  !
540  ! -- 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 442 of file BoundaryPackage.f90.

443  ! -- modules
444  class(BndType) :: this !< BndType object
445  !
446  ! -- 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 416 of file BoundaryPackage.f90.

417  ! -- dummy
418  class(BndType), intent(inout) :: this !< BndType object
419  !
420  ! -- check stress period data
421  ! -- 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 548 of file BoundaryPackage.f90.

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

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

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

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

◆ bnd_df()

subroutine bndmodule::bnd_df ( class(bndtype), intent(inout)  this,
integer(i4b), intent(inout)  neq,
class(disbasetype), pointer  dis 
)
private

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
199 1 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 1569 of file BoundaryPackage.f90.

1570  !
1571  ! -- dummy
1572  class(BndType) :: this !< BndType object
1573  !
1574  ! -- do nothing here. Override as needed.

◆ bnd_dt()

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

Definition at line 837 of file BoundaryPackage.f90.

838  ! -- dummy
839  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 456 of file BoundaryPackage.f90.

457  ! -- dummy
458  class(BndType) :: this !< BndType object
459  real(DP), dimension(:), intent(inout) :: rhs !< right-hand side vector for model
460  integer(I4B), dimension(:), intent(in) :: ia !< solution CRS row pointers
461  integer(I4B), dimension(:), intent(in) :: idxglo !< mapping vector for model (local) to solution (global)
462  class(MatrixBaseType), pointer :: matrix_sln !< solution coefficient matrix
463  ! -- local
464  integer(I4B) :: i
465  integer(I4B) :: n
466  integer(I4B) :: ipos
467  !
468  ! -- Copy package rhs and hcof into solution rhs and amat
469  do i = 1, this%nbound
470  n = this%nodelist(i)
471  rhs(n) = rhs(n) + this%rhs(i)
472  ipos = ia(n)
473  call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
474  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 484 of file BoundaryPackage.f90.

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

◆ bnd_fp()

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

Definition at line 844 of file BoundaryPackage.f90.

845  ! -- dummy
846  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 
)

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 504 of file BoundaryPackage.f90.

505  ! -- dummy
506  class(BndType), intent(inout) :: this !< BndType object
507  integer(I4B), intent(in) :: neqpak !< number of equations in the package
508  real(DP), dimension(neqpak), intent(inout) :: x !< dependent variable
509  real(DP), dimension(neqpak), intent(in) :: xtemp !< previous dependent variable
510  real(DP), dimension(neqpak), intent(inout) :: dx !< change in dependent variable
511  integer(I4B), intent(inout) :: inewtonur !< flag indicating if newton-raphson under-relaxation should be applied
512  real(DP), intent(inout) :: dxmax !< maximum change in the dependent variable
513  integer(I4B), intent(inout) :: locmax !< location of the maximum change in the dependent variable
514  ! -- local
515  !
516  ! -- 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 1553 of file BoundaryPackage.f90.

1554  ! -- return variable
1555  logical(LGP) :: supported !< boolean indicating if observations are supported
1556  ! -- dummy
1557  class(BndType) :: this !< BndType object
1558  !
1559  ! -- initialize return variables
1560  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 1461 of file BoundaryPackage.f90.

1462  ! -- dummy
1463  class(BndType), intent(inout) :: this !< BndType object
1464  character(len=*), intent(inout) :: option !< option keyword string
1465  logical(LGP), intent(inout) :: found !< boolean indicating if the option was found
1466  !
1467  ! Return with found = .false.
1468  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 761 of file BoundaryPackage.f90.

762  ! -- dummy
763  class(BndType) :: this !< BndType object
764  integer(I4B), intent(in) :: kstp !< time step number
765  integer(I4B), intent(in) :: kper !< period number
766  integer(I4B), intent(in) :: iout !< flag and unit number for the model listing file
767  integer(I4B), intent(in) :: ibudfl !< flag indicating budget should be written
768  !
769  ! -- 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 746 of file BoundaryPackage.f90.

747  ! -- dummy
748  class(BndType) :: this !< BndType object
749  integer(I4B), intent(in) :: idvsave !< flag and unit number for dependent-variable output
750  integer(I4B), intent(in) :: idvprint !< flag indicating if dependent-variable should be written to the model listing file
751  !
752  ! -- 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 778 of file BoundaryPackage.f90.

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

1688  ! -- dummy
1689  class(BndType) :: this !< BndType object
1690  !
1691  ! -- call the observation output method
1692  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 
)

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 731 of file BoundaryPackage.f90.

732  ! -- dummy
733  class(BndType) :: this !< BndType object
734  integer(I4B), intent(in) :: icbcfl !< flag and unit number for cell-by-cell output
735  integer(I4B), intent(in) :: ibudfl !< flag indication if cell-by-cell data should be saved
736  !
737  ! -- override for advanced packages

◆ bnd_read_dimensions()

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

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 1364 of file BoundaryPackage.f90.

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

◆ bnd_read_initial_attr()

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

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 1450 of file BoundaryPackage.f90.

1451  ! -- dummy
1452  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 1158 of file BoundaryPackage.f90.

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

◆ bnd_reset()

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

Definition at line 426 of file BoundaryPackage.f90.

427  class(BndType) :: this !< BndType object
428 
429  if (this%imover == 1) then
430  call this%pakmvrobj%reset()
431  end if
432 

◆ bnd_rp()

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

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  ! -- save user-specified conductance if vsc package is active
363  if (this%ivsc == 1) then
364  call this%bnd_store_user_cond(nlist, this%bound, this%condinput)
365  end if
366  !
367  ! Define the tsLink%Text value(s) appropriately.
368  ! E.g. for WEL package, entry 1, assign tsLink%Text = 'Q'
369  ! For RIV package, entry 1 text = 'STAGE', entry 2 text = 'COND',
370  ! entry 3 text = 'RBOT'; etc.
371  call this%bnd_rp_ts()
372  !
373  ! -- Terminate the block
374  call this%parser%terminateblock()
375  !
376  ! -- Copy boundname into boundname_cst
377  call this%copy_boundname()
378  !
379  else
380  write (this%iout, fmtlsp) trim(this%filtyp)
381  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
Here is the call graph for this function:

◆ 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 1713 of file BoundaryPackage.f90.

1714  ! -- dummy
1715  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 1583 of file BoundaryPackage.f90.

1584  ! -- dummy
1585  class(BndType), intent(inout) :: this !< BndType object
1586  ! -- local
1587  integer(I4B) :: i
1588  integer(I4B) :: j
1589  class(ObserveType), pointer :: obsrv => null()
1590  character(len=LENBOUNDNAME) :: bname
1591  logical(LGP) :: jfound
1592  !
1593  if (.not. this%bnd_obs_supported()) return
1594  !
1595  do i = 1, this%obs%npakobs
1596  obsrv => this%obs%pakobs(i)%obsrv
1597  !
1598  ! -- indxbnds needs to be reset each stress period because
1599  ! list of boundaries can change each stress period.
1600  call obsrv%ResetObsIndex()
1601  obsrv%BndFound = .false.
1602  !
1603  bname = obsrv%FeatureName
1604  if (bname /= '') then
1605  !
1606  ! -- Observation location(s) is(are) based on a boundary name.
1607  ! Iterate through all boundaries to identify and store
1608  ! corresponding index(indices) in bound array.
1609  jfound = .false.
1610  do j = 1, this%nbound
1611  if (this%boundname(j) == bname) then
1612  jfound = .true.
1613  obsrv%BndFound = .true.
1614  obsrv%CurrentTimeStepEndValue = dzero
1615  call obsrv%AddObsIndex(j)
1616  end if
1617  end do
1618  else
1619  !
1620  ! -- Observation location is a single node number
1621  jfound = .false.
1622  jloop: do j = 1, this%nbound
1623  if (this%nodelist(j) == obsrv%NodeNumber) then
1624  jfound = .true.
1625  obsrv%BndFound = .true.
1626  obsrv%CurrentTimeStepEndValue = dzero
1627  call obsrv%AddObsIndex(j)
1628  end if
1629  end do jloop
1630  end if
1631  end do
1632  !
1633  if (count_errors() > 0) then
1634  call store_error_unit(this%inunit)
1635  end if
Here is the call graph for this function:

◆ 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 1703 of file BoundaryPackage.f90.

1704  ! -- dummy
1705  class(BndType), intent(inout) :: this

◆ bnd_store_user_cond()

subroutine bndmodule::bnd_store_user_cond ( class(bndtype), intent(inout)  this,
integer(i4b), intent(in)  nlist,
real(dp), dimension(:, :), intent(in), pointer, contiguous  rlist,
real(dp), dimension(:), intent(inout), pointer, contiguous  condinput 
)
private

VSC will update boundary package conductance values. Because viscosity can change every stress period, but user-specified conductances may not, the base user-input should be stored in backup array so that viscosity-updated conductances may be recalculated every stress period/time step

Parameters
[in,out]thisBndType object

Definition at line 1427 of file BoundaryPackage.f90.

1428  ! -- modules
1429  use simmodule, only: store_error
1430  ! -- dummy
1431  class(BndType), intent(inout) :: this !< BndType object
1432  integer(I4B), intent(in) :: nlist
1433  real(DP), dimension(:, :), pointer, contiguous, intent(in) :: rlist
1434  real(DP), dimension(:), pointer, contiguous, intent(inout) :: condinput
1435  ! -- local
1436  integer(I4B) :: l
1437  !
1438  ! -- store backup copy of conductance values
1439  do l = 1, nlist
1440  condinput(l) = rlist(2, l)
1441  end do
Here is the call graph for this function:

◆ 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 1724 of file BoundaryPackage.f90.

1725  class(*), pointer, intent(inout) :: obj !< input object
1726  class(BndType), pointer :: res !< output class of type BndType
1727  !
1728  ! -- initialize res
1729  res => null()
1730  !
1731  ! -- make sure obj is associated
1732  if (.not. associated(obj)) return
1733  !
1734  ! -- point res to obj
1735  select type (obj)
1736  class is (bndtype)
1737  res => obj
1738  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 1476 of file BoundaryPackage.f90.

1477  ! -- dummy
1478  class(BndType), intent(inout) :: this !< BndType object
1479  ! -- local
1480  integer(I4B) :: i
1481  !
1482  ! copy from boundname to boundname_cst, which can be
1483  ! stored in the memory manager
1484  if (this%inamedbound /= 0) then
1485  do i = 1, size(this%boundname)
1486  this%boundname_cst(i) = this%boundname(i)
1487  end do
1488  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 1538 of file BoundaryPackage.f90.

1539  ! -- dummy
1540  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 1762 of file BoundaryPackage.f90.

1763  ! -- dummy
1764  type(ListType), intent(inout) :: list !< package list
1765  integer(I4B), intent(in) :: idx !< package number
1766  class(BndType), pointer :: res !< boundary package idx
1767  ! -- local
1768  class(*), pointer :: obj
1769  !
1770  ! -- get the package from the list
1771  obj => list%GetItem(idx)
1772  res => castasbndclass(obj)
Here is the call graph for this function:

◆ pack_initialize()

subroutine bndmodule::pack_initialize ( class(bndtype this)

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 1127 of file BoundaryPackage.f90.

1128  ! -- dummy
1129  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 1496 of file BoundaryPackage.f90.

1497  ! -- dummy
1498  class(BndType), intent(inout) :: this !< BndType object
1499  ! -- local
1500  character(len=LINELENGTH) :: title
1501  character(len=LINELENGTH) :: text
1502  integer(I4B) :: ntabcol
1503  !
1504  ! -- allocate and initialize the output table
1505  if (this%iprflow /= 0) then
1506  !
1507  ! -- dimension table
1508  ntabcol = 3
1509  if (this%inamedbound > 0) then
1510  ntabcol = ntabcol + 1
1511  end if
1512  !
1513  ! -- initialize the output table object
1514  title = trim(adjustl(this%text))//' PACKAGE ('//trim(this%packName)// &
1515  ') FLOW RATES'
1516  call table_cr(this%outputtab, this%packName, title)
1517  call this%outputtab%table_df(this%maxbound, ntabcol, this%iout, &
1518  transient=.true.)
1519  text = 'NUMBER'
1520  call this%outputtab%initialize_column(text, 10, alignment=tabcenter)
1521  text = 'CELLID'
1522  call this%outputtab%initialize_column(text, 20, alignment=tableft)
1523  text = 'RATE'
1524  call this%outputtab%initialize_column(text, 15, alignment=tabcenter)
1525  if (this%inamedbound > 0) then
1526  text = 'NAME'
1527  call this%outputtab%initialize_column(text, lenboundname, &
1528  alignment=tableft)
1529  end if
1530  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 1780 of file BoundaryPackage.f90.

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

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