MODFLOW 6  version 6.9.0.dev0
USGS Modular Hydrologic Model
uzfmodule Module Reference

Data Types

type  uzftype
 

Functions/Subroutines

subroutine, public uzf_create (packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
 Create a New UZF Package and point packobj to the new package. More...
 
subroutine uzf_ar (this)
 Allocate and Read. More...
 
subroutine uzf_allocate_arrays (this)
 Allocate arrays used for uzf. More...
 
subroutine uzf_checkin_deprecated_names (this)
 Alias deprecated UZF variable names to their current storage. More...
 
subroutine uzf_source_options (this)
 Source OPTIONS block from input context. More...
 
subroutine uzf_source_dimensions (this)
 Source DIMENSIONS block from input context. More...
 
subroutine uzf_rp (this)
 Read stress data from input context. More...
 
subroutine uzf_ad (this)
 Advance UZF Package. More...
 
subroutine uzf_cf (this)
 Formulate the HCOF and RHS terms. More...
 
subroutine uzf_fc (this, rhs, ia, idxglo, matrix_sln)
 Copy rhs and hcof into solution rhs and amat. More...
 
subroutine uzf_fn (this, rhs, ia, idxglo, matrix_sln)
 Fill newton terms. More...
 
subroutine uzf_cc (this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
 Final convergence check for package. More...
 
subroutine uzf_cq (this, x, flowja, iadv)
 Calculate flows. More...
 
real(dp) function get_storage_change (top, bot, carea, hold, hnew, wcold, wcnew, thtr, delt, iss)
 
subroutine uzf_bd (this, model_budget)
 Add package ratin/ratout to model budget. More...
 
subroutine uzf_ot_model_flows (this, icbcfl, ibudfl, icbcun, imap)
 Write flows to binary file and/or print flows to budget. More...
 
subroutine uzf_ot_package_flows (this, icbcfl, ibudfl)
 Output UZF package flow terms. More...
 
subroutine uzf_ot_dv (this, idvsave, idvprint)
 Save UZF-calculated values to binary file. More...
 
subroutine uzf_ot_bdsummary (this, kstp, kper, iout, ibudfl)
 Write UZF budget to listing file. More...
 
subroutine uzf_solve (this, reset_state)
 Formulate the HCOF and RHS terms. More...
 
subroutine define_listlabel (this)
 Define the list heading that is written to iout when PRINT_INPUT option is used. More...
 
subroutine findcellabove (this, n, nml)
 Identify overlying cell ID based on user-specified mapping. More...
 
subroutine uzf_source_packagedata (this)
 Source PACKAGEDATA block from input context. More...
 
subroutine print_cell_properties (this)
 Read UZF cell properties and set them for UZFCellGroup type. More...
 
subroutine check_cell_area (this)
 Check UZF cell areas. More...
 
logical function uzf_obs_supported (this)
 Return true because uzf package supports observations. More...
 
subroutine uzf_df_obs (this)
 Implements bnd_df_obs. More...
 
subroutine uzf_bd_obs (this)
 Calculate observations this time step and call ObsTypeSaveOneSimval for each UzfType observation. More...
 
subroutine uzf_rp_obs (this)
 Process each observation. More...
 
subroutine uzf_process_obsid (obsrv, dis, inunitobs, iout)
 This procedure is pointed to by ObsDataTypeProcesssIdPtr. More...
 
subroutine uzf_allocate_scalars (this)
 Allocate scalar members. More...
 
subroutine uzf_da (this)
 Deallocate objects. More...
 
subroutine uzf_setup_budobj (this)
 Set up the budget object that stores all the uzf flows. More...
 
subroutine uzf_fill_budobj (this)
 Copy flow terms into thisbudobj. More...
 

Variables

character(len=lenftype) ftype = 'UZF'
 
character(len=lenpackagename) text = ' UZF CELLS'
 

Function/Subroutine Documentation

◆ check_cell_area()

subroutine uzfmodule::check_cell_area ( class(uzftype)  this)
private

Definition at line 1996 of file gwf-uzf.f90.

1997  ! -- modules
1998  use inputoutputmodule, only: urword
2000  ! -- dummy
2001  class(UzfType) :: this
2002  ! -- local
2003  character(len=16) :: cuzf
2004  character(len=20) :: cellid
2005  character(len=LINELENGTH) :: cuzfcells
2006  integer(I4B) :: i
2007  integer(I4B) :: i2
2008  integer(I4B) :: j
2009  integer(I4B) :: n
2010  integer(I4B) :: i0
2011  integer(I4B) :: i1
2012  real(DP) :: area
2013  real(DP) :: area2
2014  real(DP) :: sumarea
2015  real(DP) :: cellarea
2016  real(DP) :: d
2017  !
2018  ! -- check that the area of vertically connected uzf cells is the equal
2019  do i = 1, this%nodes
2020  !
2021  ! -- Initialize variables
2022  i2 = this%uzfobj%ivertcon(i)
2023  area = this%uzfobj%uzfarea(i)
2024  !
2025  ! Create pointer to object below
2026  if (i2 > 0) then
2027  area2 = this%uzfobj%uzfarea(i2)
2028  d = abs(area - area2)
2029  if (d > dem6) then
2030  write (errmsg, '(2(a,1x,g0,1x,a,1x,i0,1x),a)') &
2031  'UZF cell area (', area, ') for cell ', i, &
2032  'does not equal uzf cell area (', area2, ') for cell ', i2, '.'
2033  call store_error(errmsg)
2034  end if
2035  end if
2036  end do
2037  !
2038  ! -- check that the area of uzf cells in a GWF cell is less than or equal
2039  ! to the GWF cell area
2040  do n = 1, this%dis%nodes
2041  i0 = this%ia(n)
2042  i1 = this%ia(n + 1)
2043  ! -- skip gwf cells with no UZF cells
2044  if ((i1 - i0) < 1) cycle
2045  sumarea = dzero
2046  cellarea = dzero
2047  cuzfcells = ''
2048  do j = i0, i1 - 1
2049  i = this%ja(j)
2050  write (cuzf, '(i0)') i
2051  cuzfcells = trim(adjustl(cuzfcells))//' '//trim(adjustl(cuzf))
2052  sumarea = sumarea + this%uzfobj%uzfarea(i)
2053  cellarea = this%uzfobj%cellarea(i)
2054  end do
2055  ! -- calculate the difference between the sum of UZF areas and GWF cell area
2056  d = sumarea - cellarea
2057  if (d > dem6) then
2058  call this%dis%noder_to_string(n, cellid)
2059  write (errmsg, '(a,1x,g0,1x,a,1x,g0,1x,a,1x,a,1x,a,a,a)') &
2060  'Total uzf cell area (', sumarea, &
2061  ') exceeds the gwf cell area (', cellarea, ') of cell', cellid, &
2062  'which includes uzf cell(s): ', trim(adjustl(cuzfcells)), '.'
2063  call store_error(errmsg)
2064  end if
2065  end do
2066  !
2067  ! -- terminate if errors were encountered
2068  if (count_errors() > 0) then
2069  call store_error_filename(this%input_fname)
2070  end if
subroutine, public urword(line, icol, istart, istop, ncode, n, r, iout, in)
Extract a word from a string.
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
integer(i4b) function, public count_errors()
Return number of errors.
Definition: Sim.f90:59
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
Definition: Sim.f90:204
Here is the call graph for this function:

◆ define_listlabel()

subroutine uzfmodule::define_listlabel ( class(uzftype), intent(inout)  this)

Definition at line 1656 of file gwf-uzf.f90.

1657  ! -- dummy
1658  class(UzfType), intent(inout) :: this
1659  !
1660  ! -- create the header list label
1661  this%listlabel = trim(this%filtyp)//' NO.'
1662  if (this%dis%ndim == 3) then
1663  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
1664  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'ROW'
1665  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'COL'
1666  elseif (this%dis%ndim == 2) then
1667  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
1668  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'CELL2D'
1669  else
1670  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'NODE'
1671  end if
1672  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'STRESS RATE'
1673  if (this%inamedbound == 1) then
1674  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'BOUNDARY NAME'
1675  end if

◆ findcellabove()

subroutine uzfmodule::findcellabove ( class(uzftype)  this,
integer(i4b), intent(in)  n,
integer(i4b), intent(inout)  nml 
)
private

Definition at line 1680 of file gwf-uzf.f90.

1681  ! -- dummy
1682  class(UzfType) :: this
1683  integer(I4B), intent(in) :: n
1684  integer(I4B), intent(inout) :: nml
1685  ! -- local
1686  integer(I4B) :: m, ipos
1687  !
1688  ! -- Return nml = n if no cell is above it
1689  nml = n
1690  do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
1691  m = this%dis%con%ja(ipos)
1692  if (this%dis%con%ihc(ipos) /= 0) then
1693  if (n < m) then
1694  ! -- m is beneath n
1695  else
1696  nml = m ! -- m is above n
1697  exit
1698  end if
1699  end if
1700  end do

◆ get_storage_change()

real(dp) function uzfmodule::get_storage_change ( real(dp), intent(in)  top,
real(dp), intent(in)  bot,
real(dp), intent(in)  carea,
real(dp), intent(in)  hold,
real(dp), intent(in)  hnew,
real(dp), intent(in)  wcold,
real(dp), intent(in)  wcnew,
real(dp), intent(in)  thtr,
real(dp), intent(in)  delt,
integer(i4b)  iss 
)

Definition at line 1317 of file gwf-uzf.f90.

1319  ! -- dummy
1320  real(DP), intent(in) :: top
1321  real(DP), intent(in) :: bot
1322  real(DP), intent(in) :: hold
1323  real(DP), intent(in) :: hnew
1324  real(DP), intent(in) :: wcold
1325  real(DP), intent(in) :: wcnew
1326  real(DP), intent(in) :: thtr
1327  real(DP), intent(in) :: carea
1328  real(DP), intent(in) :: delt
1329  integer(I4B) :: iss
1330  ! -- return
1331  real(DP) :: qsto
1332  ! -- local
1333  real(DP) :: thknew
1334  real(DP) :: thkold
1335  if (iss == 0) then
1336  thknew = top - max(bot, hnew)
1337  thkold = top - max(bot, hold)
1338  qsto = dzero
1339  if (thknew > dzero) then
1340  qsto = qsto + thknew * (wcnew - thtr)
1341  end if
1342  if (thkold > dzero) then
1343  qsto = qsto - thkold * (wcold - thtr)
1344  end if
1345  qsto = qsto * carea / delt
1346  else
1347  qsto = dzero
1348  end if
Here is the caller graph for this function:

◆ print_cell_properties()

subroutine uzfmodule::print_cell_properties ( class(uzftype), intent(inout)  this)

Definition at line 1915 of file gwf-uzf.f90.

1916  ! -- dummy
1917  class(UzfType), intent(inout) :: this
1918  ! -- local
1919  character(len=20) :: cellid
1920  character(len=LINELENGTH) :: title
1921  character(len=LINELENGTH) :: tag
1922  integer(I4B) :: ntabrows
1923  integer(I4B) :: ntabcols
1924  integer(I4B) :: i
1925  integer(I4B) :: node
1926  !
1927  ! -- setup inputtab tableobj
1928  !
1929  ! -- table dimensions
1930  ntabrows = this%nodes
1931  ntabcols = 10
1932  if (this%inamedbound == 1) then
1933  ntabcols = ntabcols + 1
1934  end if
1935  !
1936  ! -- initialize table and define columns
1937  title = trim(adjustl(this%text))//' PACKAGE ('// &
1938  trim(adjustl(this%packName))//') STATIC UZF CELL DATA'
1939  call table_cr(this%inputtab, this%packName, title)
1940  call this%inputtab%table_df(ntabrows, ntabcols, this%iout)
1941  tag = 'NUMBER'
1942  call this%inputtab%initialize_column(tag, 10)
1943  tag = 'CELLID'
1944  call this%inputtab%initialize_column(tag, 20, alignment=tableft)
1945  tag = 'LANDFLAG'
1946  call this%inputtab%initialize_column(tag, 12)
1947  tag = 'IVERTCON'
1948  call this%inputtab%initialize_column(tag, 12)
1949  tag = 'SURFDEP'
1950  call this%inputtab%initialize_column(tag, 12)
1951  tag = 'VKS'
1952  call this%inputtab%initialize_column(tag, 12)
1953  tag = 'THTR'
1954  call this%inputtab%initialize_column(tag, 12)
1955  tag = 'THTS'
1956  call this%inputtab%initialize_column(tag, 12)
1957  tag = 'THTI'
1958  call this%inputtab%initialize_column(tag, 12)
1959  tag = 'EPS'
1960  call this%inputtab%initialize_column(tag, 12)
1961  if (this%inamedbound == 1) then
1962  tag = 'BOUNDNAME'
1963  call this%inputtab%initialize_column(tag, lenboundname, alignment=tableft)
1964  end if
1965  !
1966  ! -- write data for each cell
1967  do i = 1, this%nodes
1968  !
1969  ! -- get cellid
1970  node = this%igwfnode(i)
1971  if (node > 0) then
1972  call this%dis%noder_to_string(node, cellid)
1973  else
1974  cellid = 'none'
1975  end if
1976  !
1977  ! -- add data
1978  call this%inputtab%add_term(i)
1979  call this%inputtab%add_term(cellid)
1980  call this%inputtab%add_term(this%uzfobj%landflag(i))
1981  call this%inputtab%add_term(this%uzfobj%ivertcon(i))
1982  call this%inputtab%add_term(this%uzfobj%surfdep(i))
1983  call this%inputtab%add_term(this%uzfobj%vks(i))
1984  call this%inputtab%add_term(this%uzfobj%thtr(i))
1985  call this%inputtab%add_term(this%uzfobj%thts(i))
1986  call this%inputtab%add_term(this%uzfobj%thti(i))
1987  call this%inputtab%add_term(this%uzfobj%eps(i))
1988  if (this%inamedbound == 1) then
1989  call this%inputtab%add_term(this%uzfname(i))
1990  end if
1991  end do
Here is the call graph for this function:

◆ uzf_ad()

subroutine uzfmodule::uzf_ad ( class(uzftype)  this)

Definition at line 816 of file gwf-uzf.f90.

817  ! -- modules
819  ! -- dummy
820  class(UzfType) :: this
821  ! -- locals
822  integer(I4B) :: i
823  integer(I4B) :: ivertflag
824  integer(I4B) :: n, iaux
825  real(DP) :: rval1, rval2, rval3
826  !
827  ! -- advance observations
828  call this%BndExtType%bnd_ad()
829  !
830  ! -- sinf_pvar/pet_pvar/extdp/extwc_pvar/ha_pvar/hroot_pvar/
831  ! -- rootact_pvar/uauxvar alias finf/pet/extdp/extwc/ha/hroot/
832  ! -- rootact/AUX directly; nothing to re-sync
833  !
834  ! -- update auxiliary variables by copying from the derived-type time
835  ! series variable into the bndpackage auxvar variable so that this
836  ! information is properly written to the GWF budget file
837  if (this%naux > 0) then
838  do n = 1, this%maxbound
839  do iaux = 1, this%naux
840  if (this%noupdateauxvar(iaux) /= 0) cycle
841  this%auxvar(iaux, n) = this%uauxvar(iaux, n)
842  end do
843  end do
844  end if
845  !
846  ! -- Update or restore state
847  if (ifailedstepretry == 0) then
848  !
849  ! -- reset old water content to new water content
850  do i = 1, this%nodes
851  this%wcold(i) = this%wcnew(i)
852  end do
853  else
854  !
855  ! -- Copy wcold back into wcnew as this is a retry of this time step.
856  ! Note that there is no need to reset the waves as they are not
857  ! advanced to their new state until the _ot() method is called,
858  ! and that doesn't happen until a successful solution is obtained.
859  do i = 1, this%nodes
860  this%wcnew(i) = this%wcold(i)
861  end do
862  end if
863  !
864  ! -- advance each uzf obj
865  do i = 1, this%nodes
866  call this%uzfobj%advance(i)
867  end do
868  !
869  ! -- update uzf objects with timeseries aware variables
870  do i = 1, this%nodes
871  !
872  ! -- Set ivertflag
873  ivertflag = this%uzfobj%ivertcon(i)
874  !
875  ! -- recalculate uzfarea
876  if (this%iauxmultcol > 0) then
877  rval1 = this%uauxvar(this%iauxmultcol, i)
878  call this%uzfobj%setdatauzfarea(i, rval1)
879  end if
880  !
881  ! -- FINF
882  rval1 = this%sinf_pvar(i)
883  call this%uzfobj%setdatafinf(i, rval1)
884  !
885  ! -- PET, EXTDP
886  rval1 = this%pet_pvar(i)
887  rval2 = this%extdp(i)
888  call this%uzfobj%setdataet(i, ivertflag, rval1, rval2)
889  !
890  ! -- ETWC
891  rval1 = this%extwc_pvar(i)
892  call this%uzfobj%setdataetwc(i, ivertflag, rval1)
893  !
894  ! -- HA, HROOT, ROOTACT
895  rval1 = this%ha_pvar(i)
896  rval2 = this%hroot_pvar(i)
897  rval3 = this%rootact_pvar(i)
898  call this%uzfobj%setdataetha(i, ivertflag, rval1, rval2, rval3)
899  end do
900  !
901  ! -- check uzfarea
902  if (this%iauxmultcol > 0) then
903  call this%check_cell_area()
904  end if
905  !
906  ! -- pakmvrobj ad
907  if (this%imover == 1) then
908  call this%pakmvrobj%ad()
909  end if
This module contains simulation variables.
Definition: SimVariables.f90:9
integer(i4b) ifailedstepretry
current retry for this time step

◆ uzf_allocate_arrays()

subroutine uzfmodule::uzf_allocate_arrays ( class(uzftype), intent(inout)  this)

Definition at line 266 of file gwf-uzf.f90.

267  ! -- dummy
268  class(UzfType), intent(inout) :: this
269  ! -- local
270  integer(I4B) :: i
271  integer(I4B) :: j
272  !
273  ! -- call standard BndType allocate scalars (now done from AR)
274  !call this%BndType%allocate_arrays()
275  !
276  ! -- allocate uzf specific arrays
277  call mem_allocate(this%igwfnode, this%nodes, 'IGWFNODE', this%memoryPath)
278  call mem_allocate(this%appliedinf, this%nodes, 'APPLIEDINF', this%memoryPath)
279  call mem_allocate(this%rejinf, this%nodes, 'REJINF', this%memoryPath)
280  call mem_allocate(this%rejinf0, this%nodes, 'REJINF0', this%memoryPath)
281  call mem_allocate(this%rejinftomvr, this%nodes, 'REJINFTOMVR', &
282  this%memoryPath)
283  call mem_allocate(this%infiltration, this%nodes, 'INFILTRATION', &
284  this%memoryPath)
285  call mem_allocate(this%gwet_pvar, this%nodes, 'GWET_PVAR', this%memoryPath)
286  call mem_allocate(this%uzet, this%nodes, 'UZET', this%memoryPath)
287  call mem_allocate(this%gwd, this%nodes, 'GWD', this%memoryPath)
288  call mem_allocate(this%gwd0, this%nodes, 'GWD0', this%memoryPath)
289  call mem_allocate(this%gwdtomvr, this%nodes, 'GWDTOMVR', this%memoryPath)
290  call mem_allocate(this%rch, this%nodes, 'RCH', this%memoryPath)
291  call mem_allocate(this%rch0, this%nodes, 'RCH0', this%memoryPath)
292  call mem_allocate(this%qsto, this%nodes, 'QSTO', this%memoryPath)
293  call mem_allocate(this%deriv, this%nodes, 'DERIV', this%memoryPath)
294  !
295  ! -- integer vectors
296  call mem_allocate(this%ia, this%dis%nodes + 1, 'IA', this%memoryPath)
297  call mem_allocate(this%ja, this%nodes, 'JA', this%memoryPath)
298  !
299  ! -- input context pointers
300  call mem_setptr(this%sinf_pvar, 'FINF', this%input_mempath)
301  call mem_setptr(this%pet_pvar, 'PET', this%input_mempath)
302  call mem_setptr(this%extdp, 'EXTDP', this%input_mempath)
303  call mem_setptr(this%extwc_pvar, 'EXTWC', this%input_mempath)
304  call mem_setptr(this%ha_pvar, 'HA', this%input_mempath)
305  call mem_setptr(this%hroot_pvar, 'HROOT', this%input_mempath)
306  call mem_setptr(this%rootact_pvar, 'ROOTACT', this%input_mempath)
307  call mem_setptr(this%uauxvar, 'AUXVAR', this%input_mempath)
308  !
309  ! -- initialize
310  do i = 1, this%nodes
311  this%appliedinf(i) = dzero
312  this%rejinf(i) = dzero
313  this%rejinf0(i) = dzero
314  this%rejinftomvr(i) = dzero
315  this%gwet_pvar(i) = dzero
316  this%uzet(i) = dzero
317  this%gwd(i) = dzero
318  this%gwd0(i) = dzero
319  this%gwdtomvr(i) = dzero
320  this%rch(i) = dzero
321  this%rch0(i) = dzero
322  this%qsto(i) = dzero
323  this%deriv(i) = dzero
324  ! -- integer variables
325  this%ja(i) = 0
326  ! -- sinf_pvar/pet_pvar/extdp/extwc_pvar/ha_pvar/hroot_pvar/
327  ! -- rootact_pvar are input context pointers
328  do j = 1, this%naux
329  if (this%iauxmultcol > 0 .and. j == this%iauxmultcol) then
330  this%uauxvar(j, i) = done
331  else
332  this%uauxvar(j, i) = dzero
333  end if
334  end do
335  end do
336  do i = 1, this%dis%nodes + 1
337  this%ia(i) = 0
338  end do
339  !
340  ! -- allocate and initialize character array for budget text
341  allocate (this%bdtxt(this%nbdtxt))
342  this%bdtxt(1) = ' UZF-INF'
343  this%bdtxt(2) = ' UZF-GWRCH'
344  this%bdtxt(3) = ' UZF-GWD'
345  this%bdtxt(4) = ' UZF-GWET'
346  this%bdtxt(5) = ' UZF-GWD TO-MVR'
347  !
348  ! -- allocate and initialize watercontent arrays
349  call mem_allocate(this%wcnew, this%nodes, 'WCNEW', this%memoryPath)
350  call mem_allocate(this%wcold, this%nodes, 'WCOLD', this%memoryPath)
351  do i = 1, this%nodes
352  this%wcnew(i) = dzero
353  this%wcold(i) = dzero
354  end do
355  !
356  ! -- allocate character array for aux budget text
357  allocate (this%cauxcbc(this%cbcauxitems))
358  allocate (this%uzfname(this%nodes))
359  !
360  ! -- allocate and initialize qauxcbc
361  call mem_allocate(this%qauxcbc, this%cbcauxitems, 'QAUXCBC', this%memoryPath)
362  do i = 1, this%cbcauxitems
363  this%qauxcbc(i) = dzero
364  end do

◆ uzf_allocate_scalars()

subroutine uzfmodule::uzf_allocate_scalars ( class(uzftype)  this)
private

Definition at line 2429 of file gwf-uzf.f90.

2430  ! -- modules
2432  ! -- dummy
2433  class(UzfType) :: this
2434  !
2435  ! -- call standard BndExtType allocate scalars
2436  call this%BndExtType%allocate_scalars()
2437  !
2438  ! -- allocate uzf specific scalars
2439  call mem_allocate(this%iprwcont, 'IPRWCONT', this%memoryPath)
2440  call mem_allocate(this%iwcontout, 'IWCONTOUT', this%memoryPath)
2441  call mem_allocate(this%ibudgetout, 'IBUDGETOUT', this%memoryPath)
2442  call mem_allocate(this%ibudcsv, 'IBUDCSV', this%memoryPath)
2443  call mem_allocate(this%ipakcsv, 'IPAKCSV', this%memoryPath)
2444  call mem_allocate(this%ntrail_pvar, 'NTRAIL_PVAR', this%memoryPath)
2445  call mem_allocate(this%nsets, 'NSETS', this%memoryPath)
2446  call mem_allocate(this%nodes, 'NODES', this%memoryPath)
2447  call mem_allocate(this%istocb, 'ISTOCB', this%memoryPath)
2448  call mem_allocate(this%nwav_pvar, 'NWAV_PVAR', this%memoryPath)
2449  call mem_allocate(this%totfluxtot, 'TOTFLUXTOT', this%memoryPath)
2450  call mem_allocate(this%bditems, 'BDITEMS', this%memoryPath)
2451  call mem_allocate(this%nbdtxt, 'NBDTXT', this%memoryPath)
2452  call mem_allocate(this%issflag, 'ISSFLAG', this%memoryPath)
2453  call mem_allocate(this%issflagold, 'ISSFLAGOLD', this%memoryPath)
2454  call mem_allocate(this%readflag, 'READFLAG', this%memoryPath)
2455  call mem_allocate(this%iseepflag, 'ISEEPFLAG', this%memoryPath)
2456  call mem_allocate(this%imaxcellcnt, 'IMAXCELLCNT', this%memoryPath)
2457  call mem_allocate(this%ietflag, 'IETFLAG', this%memoryPath)
2458  call mem_allocate(this%igwetflag, 'IGWETFLAG', this%memoryPath)
2459  call mem_allocate(this%iuzf2uzf, 'IUZF2UZF', this%memoryPath)
2460  call mem_allocate(this%cbcauxitems, 'CBCAUXITEMS', this%memoryPath)
2461  !
2462  call mem_allocate(this%iconvchk, 'ICONVCHK', this%memoryPath)
2463  !
2464  ! -- initialize scalars
2465  this%iprwcont = 0
2466  this%iwcontout = 0
2467  this%ibudgetout = 0
2468  this%ibudcsv = 0
2469  this%ipakcsv = 0
2470  this%istocb = 0
2471  this%bditems = 7
2472  this%nbdtxt = 5
2473  this%issflag = 0
2474  this%issflagold = 0
2475  this%ietflag = 0
2476  this%igwetflag = 0
2477  this%iseepflag = 0
2478  this%imaxcellcnt = 0
2479  this%iuzf2uzf = 0
2480  this%cbcauxitems = 1
2481  this%imover = 0
2482  !
2483  ! -- convergence check
2484  this%iconvchk = 1

◆ uzf_ar()

subroutine uzfmodule::uzf_ar ( class(uzftype), intent(inout)  this)

Definition at line 220 of file gwf-uzf.f90.

221  ! -- modules
223  ! -- dummy
224  class(UzfType), intent(inout) :: this
225  ! -- local
226  integer(I4B) :: n, i
227  real(DP) :: hgwf
228  !
229  call this%obs%obs_ar()
230  !
231  ! -- call standard BndExtType allocate scalars
232  call this%BndExtType%allocate_arrays()
233  !
234  ! -- set pointers now that data is available
235  call mem_setptr(this%gwfhcond, 'CONDSAT', create_mem_path(this%name_model, &
236  'NPF'))
237  call mem_setptr(this%gwfiss, 'ISS', create_mem_path(this%name_model))
238  !
239  ! -- set boundname for each connection
240  if (this%inamedbound /= 0) then
241  do n = 1, this%nodes
242  this%boundname(n) = this%uzfname(n)
243  end do
244  end if
245  !
246  ! -- copy boundname into boundname_cst
247  call this%copy_boundname()
248  !
249  ! -- copy igwfnode into nodelist and set water table
250  do i = 1, this%nodes
251  this%nodelist(i) = this%igwfnode(i)
252  n = this%igwfnode(i)
253  hgwf = this%xnew(n)
254  call this%uzfobj%sethead(i, hgwf)
255  end do
256  !
257  ! -- setup pakmvrobj
258  if (this%imover /= 0) then
259  allocate (this%pakmvrobj)
260  call this%pakmvrobj%ar(this%maxbound, this%maxbound, this%memoryPath)
261  end if
Here is the call graph for this function:

◆ uzf_bd()

subroutine uzfmodule::uzf_bd ( class(uzftype)  this,
type(budgettype), intent(inout)  model_budget 
)
private

Definition at line 1353 of file gwf-uzf.f90.

1354  ! -- add package ratin/ratout to model budget
1355  use tdismodule, only: delt
1357  class(UzfType) :: this
1358  type(BudgetType), intent(inout) :: model_budget
1359  real(DP) :: ratin
1360  real(DP) :: ratout
1361  integer(I4B) :: isuppress_output
1362  isuppress_output = 0
1363  !
1364  ! -- Calculate flow from uzf to gwf (UZF-GWRCH)
1365  call rate_accumulator(this%rch, ratin, ratout)
1366  call model_budget%addentry(ratin, ratout, delt, this%bdtxt(2), &
1367  isuppress_output, this%packName)
1368  !
1369  ! -- GW discharge and GW discharge to mover
1370  if (this%iseepflag == 1) then
1371  call rate_accumulator(-this%gwd, ratin, ratout)
1372  call model_budget%addentry(ratin, ratout, delt, this%bdtxt(3), &
1373  isuppress_output, this%packName)
1374  if (this%imover == 1) then
1375  call rate_accumulator(-this%gwdtomvr, ratin, ratout)
1376  call model_budget%addentry(ratin, ratout, delt, this%bdtxt(5), &
1377  isuppress_output, this%packName)
1378  end if
1379  end if
1380  !
1381  ! -- groundwater et (gwet array is positive, so switch ratin/ratout)
1382  if (this%igwetflag /= 0) then
1383  call rate_accumulator(-this%gwet_pvar, ratin, ratout)
1384  call model_budget%addentry(ratin, ratout, delt, this%bdtxt(4), &
1385  isuppress_output, this%packName)
1386  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: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:

◆ uzf_bd_obs()

subroutine uzfmodule::uzf_bd_obs ( class(uzftype)  this)
private

Definition at line 2151 of file gwf-uzf.f90.

2152  ! -- dummy
2153  class(UzfType) :: this
2154  ! -- local
2155  integer(I4B) :: i
2156  integer(I4B) :: ii
2157  integer(I4B) :: n
2158  real(DP) :: v
2159  type(ObserveType), pointer :: obsrv => null()
2160  !
2161  ! -- Make final uzf solution, and do not reset waves. This will advance
2162  ! the waves to their new state at the end of the time step. This should
2163  ! be the first step of the uzf ot() routines.
2164  call this%uzf_solve(reset_state=.false.)
2165  !
2166  ! Write simulated values for all uzf observations
2167  if (this%obs%npakobs > 0) then
2168  call this%obs%obs_bd_clear()
2169  do i = 1, this%obs%npakobs
2170  obsrv => this%obs%pakobs(i)%obsrv
2171  do ii = 1, obsrv%indxbnds_count
2172  n = obsrv%indxbnds(ii)
2173  v = dnodata
2174  select case (obsrv%ObsTypeId)
2175  case ('UZF-GWRCH')
2176  v = this%rch(n)
2177  case ('UZF-GWD')
2178  v = this%gwd(n)
2179  if (v > dzero) then
2180  v = -v
2181  end if
2182  case ('UZF-GWD-TO-MVR')
2183  if (this%imover == 1) then
2184  v = this%gwdtomvr(n)
2185  if (v > dzero) then
2186  v = -v
2187  end if
2188  end if
2189  case ('UZF-GWET')
2190  if (this%igwetflag > 0) then
2191  v = this%gwet_pvar(n)
2192  if (v > dzero) then
2193  v = -v
2194  end if
2195  end if
2196  case ('INFILTRATION')
2197  v = this%appliedinf(n)
2198  case ('FROM-MVR')
2199  if (this%imover == 1) then
2200  v = this%pakmvrobj%get_qfrommvr(n)
2201  end if
2202  case ('REJ-INF')
2203  v = this%rejinf(n)
2204  if (v > dzero) then
2205  v = -v
2206  end if
2207  case ('REJ-INF-TO-MVR')
2208  if (this%imover == 1) then
2209  v = this%rejinftomvr(n)
2210  if (v > dzero) then
2211  v = -v
2212  end if
2213  end if
2214  case ('UZET')
2215  if (this%ietflag /= 0) then
2216  v = this%uzet(n)
2217  if (v > dzero) then
2218  v = -v
2219  end if
2220  end if
2221  case ('STORAGE')
2222  v = -this%qsto(n)
2223  case ('NET-INFILTRATION')
2224  v = this%infiltration(n)
2225  case ('WATER-CONTENT')
2226  v = this%uzfobj%get_water_content_at_depth(n, obsrv%obsDepth)
2227  case default
2228  errmsg = 'Unrecognized observation type: '//trim(obsrv%ObsTypeId)
2229  call store_error(errmsg)
2230  end select
2231  call this%obs%SaveOneSimval(obsrv, v)
2232  end do
2233  end do
2234  !
2235  ! -- write summary of error messages
2236  if (count_errors() > 0) then
2237  call store_error_filename(this%input_fname)
2238  end if
2239  end if
Here is the call graph for this function:

◆ uzf_cc()

subroutine uzfmodule::uzf_cc ( class(uzftype), 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

Definition at line 990 of file gwf-uzf.f90.

991  ! -- modules
992  use tdismodule, only: totim, kstp, kper, delt
993  ! -- dummy
994  class(Uzftype), intent(inout) :: this
995  integer(I4B), intent(in) :: innertot
996  integer(I4B), intent(in) :: kiter
997  integer(I4B), intent(in) :: icnvgmod
998  integer(I4B), intent(in) :: iend
999  character(len=LENPAKLOC), intent(inout) :: cpak
1000  integer(I4B), intent(inout) :: ipak
1001  real(DP), intent(inout) :: dpak
1002  ! -- local
1003  character(len=LENPAKLOC) :: cloc
1004  character(len=LINELENGTH) :: tag
1005  integer(I4B) :: icheck
1006  integer(I4B) :: ipakfail
1007  integer(I4B) :: locdrejinfmax
1008  integer(I4B) :: locdrchmax
1009  integer(I4B) :: locdseepmax
1010  integer(I4B) :: locdqfrommvrmax
1011  integer(I4B) :: ntabrows
1012  integer(I4B) :: ntabcols
1013  integer(I4B) :: n
1014  real(DP) :: q
1015  real(DP) :: q0
1016  real(DP) :: qtolfact
1017  real(DP) :: drejinf
1018  real(DP) :: drejinfmax
1019  real(DP) :: drch
1020  real(DP) :: drchmax
1021  real(DP) :: dseep
1022  real(DP) :: dseepmax
1023  real(DP) :: dqfrommvr
1024  real(DP) :: dqfrommvrmax
1025  !
1026  ! -- initialize local variables
1027  icheck = this%iconvchk
1028  ipakfail = 0
1029  locdrejinfmax = 0
1030  locdrchmax = 0
1031  locdseepmax = 0
1032  locdqfrommvrmax = 0
1033  drejinfmax = dzero
1034  drchmax = dzero
1035  dseepmax = dzero
1036  dqfrommvrmax = dzero
1037  !
1038  ! -- if not saving package convergence data on check convergence if
1039  ! the model is considered converged
1040  if (this%ipakcsv == 0) then
1041  if (icnvgmod == 0) then
1042  icheck = 0
1043  end if
1044  else
1045  !
1046  ! -- header for package csv
1047  if (.not. associated(this%pakcsvtab)) then
1048  !
1049  ! -- determine the number of columns and rows
1050  ntabrows = 1
1051  ntabcols = 9
1052  if (this%iseepflag == 1) then
1053  ntabcols = ntabcols + 2
1054  end if
1055  if (this%imover == 1) then
1056  ntabcols = ntabcols + 2
1057  end if
1058  !
1059  ! -- setup table
1060  call table_cr(this%pakcsvtab, this%packName, '')
1061  call this%pakcsvtab%table_df(ntabrows, ntabcols, this%ipakcsv, &
1062  lineseparator=.false., separator=',', &
1063  finalize=.false.)
1064  !
1065  ! -- add columns to package csv
1066  tag = 'total_inner_iterations'
1067  call this%pakcsvtab%initialize_column(tag, 10, alignment=tableft)
1068  tag = 'totim'
1069  call this%pakcsvtab%initialize_column(tag, 10, alignment=tableft)
1070  tag = 'kper'
1071  call this%pakcsvtab%initialize_column(tag, 10, alignment=tableft)
1072  tag = 'kstp'
1073  call this%pakcsvtab%initialize_column(tag, 10, alignment=tableft)
1074  tag = 'nouter'
1075  call this%pakcsvtab%initialize_column(tag, 10, alignment=tableft)
1076  tag = 'drejinfmax'
1077  call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
1078  tag = 'drejinfmax_loc'
1079  call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
1080  tag = 'drchmax'
1081  call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
1082  tag = 'drchmax_loc'
1083  call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
1084  if (this%iseepflag == 1) then
1085  tag = 'dseepmax'
1086  call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
1087  tag = 'dseepmax_loc'
1088  call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
1089  end if
1090  if (this%imover == 1) then
1091  tag = 'dqfrommvrmax'
1092  call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
1093  tag = 'dqfrommvrmax_loc'
1094  call this%pakcsvtab%initialize_column(tag, 16, alignment=tableft)
1095  end if
1096  end if
1097  end if
1098  !
1099  ! -- perform package convergence check
1100  if (icheck /= 0) then
1101  final_check: do n = 1, this%nodes
1102  !
1103  ! -- set the Q to length factor
1104  qtolfact = delt / this%uzfobj%uzfarea(n)
1105  !
1106  ! -- rejected infiltration
1107  drejinf = qtolfact * (this%rejinf0(n) - this%rejinf(n))
1108  !
1109  ! -- groundwater recharge
1110  drch = qtolfact * (this%rch0(n) - this%rch(n))
1111  !
1112  ! -- groundwater seepage to the land surface
1113  dseep = dzero
1114  if (this%iseepflag == 1) then
1115  dseep = qtolfact * (this%gwd0(n) - this%gwd(n))
1116  end if
1117  !
1118  ! -- q from mvr
1119  dqfrommvr = dzero
1120  if (this%imover == 1) then
1121  q = this%pakmvrobj%get_qfrommvr(n)
1122  q0 = this%pakmvrobj%get_qfrommvr0(n)
1123  dqfrommvr = qtolfact * (q0 - q)
1124  end if
1125  !
1126  ! -- evaluate magnitude of differences
1127  if (n == 1) then
1128  drejinfmax = drejinf
1129  locdrejinfmax = n
1130  drchmax = drch
1131  locdrchmax = n
1132  dseepmax = dseep
1133  locdseepmax = n
1134  dqfrommvrmax = dqfrommvr
1135  locdqfrommvrmax = n
1136  else
1137  if (abs(drejinf) > abs(drejinfmax)) then
1138  drejinfmax = drejinf
1139  locdrejinfmax = n
1140  end if
1141  if (abs(drch) > abs(drchmax)) then
1142  drchmax = drch
1143  locdrchmax = n
1144  end if
1145  if (abs(dseep) > abs(dseepmax)) then
1146  dseepmax = dseep
1147  locdseepmax = n
1148  end if
1149  if (abs(dqfrommvr) > abs(dqfrommvrmax)) then
1150  dqfrommvrmax = dqfrommvr
1151  locdqfrommvrmax = n
1152  end if
1153  end if
1154  end do final_check
1155  !
1156  ! -- set dpak and cpak
1157  if (abs(drejinfmax) > abs(dpak)) then
1158  ipak = locdrejinfmax
1159  dpak = drejinfmax
1160  write (cloc, "(a,'-',a)") trim(this%packName), 'rejinf'
1161  cpak = trim(cloc)
1162  end if
1163  if (abs(drchmax) > abs(dpak)) then
1164  ipak = locdrchmax
1165  dpak = drchmax
1166  write (cloc, "(a,'-',a)") trim(this%packName), 'rech'
1167  cpak = trim(cloc)
1168  end if
1169  if (this%iseepflag == 1) then
1170  if (abs(dseepmax) > abs(dpak)) then
1171  ipak = locdseepmax
1172  dpak = dseepmax
1173  write (cloc, "(a,'-',a)") trim(this%packName), 'seep'
1174  cpak = trim(cloc)
1175  end if
1176  end if
1177  if (this%imover == 1) then
1178  if (abs(dqfrommvrmax) > abs(dpak)) then
1179  ipak = locdqfrommvrmax
1180  dpak = dqfrommvrmax
1181  write (cloc, "(a,'-',a)") trim(this%packName), 'qfrommvr'
1182  cpak = trim(cloc)
1183  end if
1184  end if
1185  !
1186  ! -- write convergence data to package csv
1187  if (this%ipakcsv /= 0) then
1188  !
1189  ! -- write the data
1190  call this%pakcsvtab%add_term(innertot)
1191  call this%pakcsvtab%add_term(totim)
1192  call this%pakcsvtab%add_term(kper)
1193  call this%pakcsvtab%add_term(kstp)
1194  call this%pakcsvtab%add_term(kiter)
1195  call this%pakcsvtab%add_term(drejinfmax)
1196  call this%pakcsvtab%add_term(locdrejinfmax)
1197  call this%pakcsvtab%add_term(drchmax)
1198  call this%pakcsvtab%add_term(locdrchmax)
1199  if (this%iseepflag == 1) then
1200  call this%pakcsvtab%add_term(dseepmax)
1201  call this%pakcsvtab%add_term(locdseepmax)
1202  end if
1203  if (this%imover == 1) then
1204  call this%pakcsvtab%add_term(dqfrommvrmax)
1205  call this%pakcsvtab%add_term(locdqfrommvrmax)
1206  end if
1207  !
1208  ! -- finalize the package csv
1209  if (iend == 1) then
1210  call this%pakcsvtab%finalize_table()
1211  end if
1212  end if
1213  end if
real(dp), pointer, public totim
time relative to start of simulation
Definition: tdis.f90:35
integer(i4b), pointer, public kstp
current time step number
Definition: tdis.f90:27
integer(i4b), pointer, public kper
current stress period number
Definition: tdis.f90:26
Here is the call graph for this function:

◆ uzf_cf()

subroutine uzfmodule::uzf_cf ( class(uzftype)  this)
  • skip if no UZF cells
  • calculate hcof and rhs

Definition at line 917 of file gwf-uzf.f90.

918  ! -- modules
919  ! -- dummy
920  class(UzfType) :: this
921  ! -- locals
922  integer(I4B) :: n
923  !
924  ! -- Return if no UZF cells
925  if (this%nodes == 0) return
926  !
927  ! -- Store values at start of outer iteration to compare with calculated
928  ! values for convergence check
929  do n = 1, this%maxbound
930  this%rejinf0(n) = this%rejinf(n)
931  this%rch0(n) = this%rch(n)
932  this%gwd0(n) = this%gwd(n)
933  end do

◆ uzf_checkin_deprecated_names()

subroutine uzfmodule::uzf_checkin_deprecated_names ( class(uzftype), intent(inout)  this)
private

IDM integration moved the time-series aware cell variables and the auxiliary array into the input context, renaming them. These aliases share memory with the relocated variables so that programs addressing them through the API by their old package-path names continue to resolve; each use is reported as deprecated.

Definition at line 375 of file gwf-uzf.f90.

376  ! -- modules
378  ! -- dummy
379  class(UzfType), intent(inout) :: this
380  ! -- code
381  !
382  call mem_alias_deprecated(this%sinf_pvar, 'SINF_PVAR', this%memoryPath, &
383  'FINF', this%input_mempath, '6.8.2')
384  call mem_alias_deprecated(this%pet_pvar, 'PET_PVAR', this%memoryPath, &
385  'PET', this%input_mempath, '6.8.2')
386  call mem_alias_deprecated(this%extdp, 'EXDP_PVAR', this%memoryPath, &
387  'EXTDP', this%input_mempath, '6.8.2')
388  call mem_alias_deprecated(this%extwc_pvar, 'EXTWC_PVAR', this%memoryPath, &
389  'EXTWC', this%input_mempath, '6.8.2')
390  call mem_alias_deprecated(this%ha_pvar, 'HA_PVAR', this%memoryPath, &
391  'HA', this%input_mempath, '6.8.2')
392  call mem_alias_deprecated(this%hroot_pvar, 'HROOT_PVAR', this%memoryPath, &
393  'HROOT', this%input_mempath, '6.8.2')
394  call mem_alias_deprecated(this%rootact_pvar, 'ROOTACT_PVAR', &
395  this%memoryPath, 'ROOTACT', this%input_mempath, &
396  '6.8.2')
397  !
398  ! -- cell auxiliary values, empty without auxiliary variables
399  call mem_alias_deprecated(this%uauxvar, 'UAUXVAR', this%memoryPath, &
400  'AUXVAR', this%input_mempath, '6.8.2')
Previous variable names checked in as deprecated aliases.
Definition: MemoryAlias.f90:7

◆ uzf_cq()

subroutine uzfmodule::uzf_cq ( class(uzftype), intent(inout)  this,
real(dp), dimension(:), intent(in)  x,
real(dp), dimension(:), intent(inout), contiguous  flowja,
integer(i4b), intent(in), optional  iadv 
)

Definition at line 1218 of file gwf-uzf.f90.

1219  ! -- modules
1220  use tdismodule, only: delt
1222  use budgetmodule, only: budgettype
1223  ! -- dummy
1224  class(UzfType), intent(inout) :: this
1225  real(DP), dimension(:), intent(in) :: x
1226  real(DP), dimension(:), contiguous, intent(inout) :: flowja
1227  integer(I4B), optional, intent(in) :: iadv
1228  ! -- local
1229  integer(I4B) :: i
1230  integer(I4B) :: n
1231  real(DP) :: qout
1232  real(DP) :: qfact
1233  real(DP) :: qtomvr
1234  real(DP) :: q
1235  ! -- for observations
1236  ! -- formats
1237  character(len=*), parameter :: fmttkk = &
1238  &"(1X,/1X,A,' PERIOD ',I0,' STEP ',I0)"
1239  !
1240  ! -- Make uzf solution for budget calculations, and then reset waves.
1241  ! Final uzf solve will be done as part of ot().
1242  call this%uzf_solve(reset_state=.true.)
1243  !
1244  ! -- call base functionality in bnd_cq. This will calculate uzf-gwf flows
1245  ! and put them into this%simvals and this%simvtomvr
1246  call this%BndType%bnd_cq(x, flowja, iadv=1)
1247  !
1248  ! -- Go through and process each UZF cell
1249  do i = 1, this%nodes
1250  !
1251  ! -- Initialize variables
1252  n = this%nodelist(i)
1253  !
1254  ! -- Skip if cell is not active
1255  if (this%ibound(n) < 1) cycle
1256  !
1257  ! -- infiltration terms
1258  this%appliedinf(i) = this%uzfobj%sinf(i) * this%uzfobj%uzfarea(i)
1259  this%infiltration(i) = this%uzfobj%surflux(i) * this%uzfobj%uzfarea(i)
1260  !
1261  ! -- qtomvr
1262  qout = this%rejinf(i) + this%uzfobj%surfseep(i)
1263  qtomvr = dzero
1264  if (this%imover == 1) then
1265  qtomvr = this%pakmvrobj%get_qtomvr(i)
1266  end if
1267  !
1268  ! -- rejected infiltration
1269  qfact = dzero
1270  if (qout > dzero) then
1271  qfact = this%rejinf(i) / qout
1272  end if
1273  q = this%rejinf(i)
1274  this%rejinftomvr(i) = qfact * qtomvr
1275  !
1276  ! -- set rejected infiltration to the remainder
1277  q = q - this%rejinftomvr(i)
1278  !
1279  ! -- values less than zero represent a volumetric error resulting
1280  ! from qtomvr being greater than water available to the mover
1281  if (q < dzero) then
1282  q = dzero
1283  end if
1284  this%rejinf(i) = q
1285  !
1286  ! -- calculate groundwater discharge and what goes to mover
1287  this%gwd(i) = this%uzfobj%surfseep(i)
1288  qfact = dzero
1289  if (qout > dzero) then
1290  qfact = this%gwd(i) / qout
1291  end if
1292  q = this%gwd(i)
1293  this%gwdtomvr(i) = qfact * qtomvr
1294  !
1295  ! -- set groundwater discharge to the remainder
1296  q = q - this%gwdtomvr(i)
1297  !
1298  ! -- values less than zero represent a volumetric error resulting
1299  ! from qtomvr being greater than water available to the mover
1300  if (q < dzero) then
1301  q = dzero
1302  end if
1303  this%gwd(i) = q
1304  !
1305  ! -- calculate and store remaining budget terms
1306  this%gwet_pvar(i) = this%uzfobj%gwet(i)
1307  this%uzet(i) = this%uzfobj%etact(i) * this%uzfobj%uzfarea(i) / delt
1308  !
1309  ! -- End of UZF cell loop
1310  !
1311  end do
1312  !
1313  ! -- fill the budget object
1314  call this%uzf_fill_budobj()
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dhdry
real dry cell constant
Definition: Constants.f90:94
real(dp), parameter dhnoflo
real no flow constant
Definition: Constants.f90:93
integer(i4b), parameter lenboundname
maximum length of a bound name
Definition: Constants.f90:36
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:65

◆ uzf_create()

subroutine, public uzfmodule::uzf_create ( class(bndtype), pointer  packobj,
integer(i4b), intent(in)  id,
integer(i4b), intent(in)  ibcnum,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout,
character(len=*), intent(in)  namemodel,
character(len=*), intent(in)  pakname,
character(len=*), intent(in)  mempath 
)

Definition at line 178 of file gwf-uzf.f90.

180  ! -- modules
182  ! -- dummy
183  class(BndType), pointer :: packobj
184  integer(I4B), intent(in) :: id
185  integer(I4B), intent(in) :: ibcnum
186  integer(I4B), intent(in) :: inunit
187  integer(I4B), intent(in) :: iout
188  character(len=*), intent(in) :: namemodel
189  character(len=*), intent(in) :: pakname
190  character(len=*), intent(in) :: mempath
191  ! -- local
192  type(UzfType), pointer :: uzfobj
193  !
194  ! -- allocate the object and assign values to object variables
195  allocate (uzfobj)
196  packobj => uzfobj
197  !
198  ! -- create name and memory path
199  call packobj%set_names(ibcnum, namemodel, pakname, ftype, mempath)
200  packobj%text = text
201  !
202  ! -- allocate scalars
203  call uzfobj%uzf_allocate_scalars()
204  !
205  ! -- initialize package
206  call packobj%pack_initialize()
207  !
208  packobj%inunit = inunit
209  packobj%iout = iout
210  packobj%id = id
211  packobj%ibcnum = ibcnum
212  packobj%ncolbnd = 1
213  packobj%iscloc = 0 ! not supported
214  packobj%isadvpak = 1
215  packobj%ictMemPath = create_mem_path(namemodel, 'NPF')
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uzf_da()

subroutine uzfmodule::uzf_da ( class(uzftype)  this)

Definition at line 2489 of file gwf-uzf.f90.

2490  ! -- modules
2492  ! -- dummy
2493  class(UzfType) :: this
2494  !
2495  ! -- deallocate uzf objects
2496  call this%uzfobj%dealloc()
2497  deallocate (this%uzfobj)
2498  nullify (this%uzfobj)
2499  !
2500  call this%budobj%budgetobject_da()
2501  deallocate (this%budobj)
2502  nullify (this%budobj)
2503  !
2504  ! -- character arrays
2505  deallocate (this%bdtxt)
2506  deallocate (this%cauxcbc)
2507  deallocate (this%uzfname)
2508  !
2509  ! -- package csv table
2510  if (this%ipakcsv > 0) then
2511  if (associated(this%pakcsvtab)) then
2512  call this%pakcsvtab%table_da()
2513  deallocate (this%pakcsvtab)
2514  nullify (this%pakcsvtab)
2515  end if
2516  end if
2517  !
2518  ! -- deallocate scalars
2519  call mem_deallocate(this%iprwcont)
2520  call mem_deallocate(this%iwcontout)
2521  call mem_deallocate(this%ibudgetout)
2522  call mem_deallocate(this%ibudcsv)
2523  call mem_deallocate(this%ipakcsv)
2524  call mem_deallocate(this%ntrail_pvar)
2525  call mem_deallocate(this%nsets)
2526  call mem_deallocate(this%nodes)
2527  call mem_deallocate(this%istocb)
2528  call mem_deallocate(this%nwav_pvar)
2529  call mem_deallocate(this%totfluxtot)
2530  call mem_deallocate(this%bditems)
2531  call mem_deallocate(this%nbdtxt)
2532  call mem_deallocate(this%issflag)
2533  call mem_deallocate(this%issflagold)
2534  call mem_deallocate(this%readflag)
2535  call mem_deallocate(this%iseepflag)
2536  call mem_deallocate(this%imaxcellcnt)
2537  call mem_deallocate(this%ietflag)
2538  call mem_deallocate(this%igwetflag)
2539  call mem_deallocate(this%iuzf2uzf)
2540  call mem_deallocate(this%cbcauxitems)
2541  !
2542  ! -- convergence check
2543  call mem_deallocate(this%iconvchk)
2544  !
2545  ! -- deallocate arrays
2546  call mem_deallocate(this%igwfnode)
2547  call mem_deallocate(this%appliedinf)
2548  call mem_deallocate(this%rejinf)
2549  call mem_deallocate(this%rejinf0)
2550  call mem_deallocate(this%rejinftomvr)
2551  call mem_deallocate(this%infiltration)
2552  call mem_deallocate(this%gwet_pvar)
2553  call mem_deallocate(this%uzet)
2554  call mem_deallocate(this%gwd)
2555  call mem_deallocate(this%gwd0)
2556  call mem_deallocate(this%gwdtomvr)
2557  call mem_deallocate(this%rch)
2558  call mem_deallocate(this%rch0)
2559  call mem_deallocate(this%qsto)
2560  call mem_deallocate(this%deriv)
2561  call mem_deallocate(this%qauxcbc)
2562  call mem_deallocate(this%wcnew)
2563  call mem_deallocate(this%wcold)
2564  !
2565  ! -- deallocate integer arrays
2566  call mem_deallocate(this%ia)
2567  call mem_deallocate(this%ja)
2568  !
2569  ! -- sinf_pvar/pet_pvar/extdp/extwc_pvar/ha_pvar/hroot_pvar/
2570  ! -- rootact_pvar/uauxvar are input context pointers
2571  !
2572  ! -- Parent object
2573  call this%BndExtType%bnd_da()

◆ uzf_df_obs()

subroutine uzfmodule::uzf_df_obs ( class(uzftype)  this)
private

Store observation type supported by uzf package. Overrides BndTypebnd_df_obs

Definition at line 2091 of file gwf-uzf.f90.

2092  ! -- dummy
2093  class(UzfType) :: this
2094  ! -- local
2095  integer(I4B) :: indx
2096  !
2097  ! -- Store obs type and assign procedure pointer
2098  !
2099  ! for recharge observation type.
2100  call this%obs%StoreObsType('uzf-gwrch', .true., indx)
2101  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2102  !
2103  ! for discharge observation type.
2104  call this%obs%StoreObsType('uzf-gwd', .true., indx)
2105  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2106  !
2107  ! for discharge observation type.
2108  call this%obs%StoreObsType('uzf-gwd-to-mvr', .true., indx)
2109  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2110  !
2111  ! for gwet observation type.
2112  call this%obs%StoreObsType('uzf-gwet', .true., indx)
2113  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2114  !
2115  ! for infiltration observation type.
2116  call this%obs%StoreObsType('infiltration', .true., indx)
2117  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2118  !
2119  ! for from mover observation type.
2120  call this%obs%StoreObsType('from-mvr', .true., indx)
2121  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2122  !
2123  ! for rejected infiltration observation type.
2124  call this%obs%StoreObsType('rej-inf', .true., indx)
2125  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2126  !
2127  ! for rejected infiltration to mover observation type.
2128  call this%obs%StoreObsType('rej-inf-to-mvr', .true., indx)
2129  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2130  !
2131  ! for uzet observation type.
2132  call this%obs%StoreObsType('uzet', .true., indx)
2133  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2134  !
2135  ! for storage observation type.
2136  call this%obs%StoreObsType('storage', .true., indx)
2137  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2138  !
2139  ! for net infiltration observation type.
2140  call this%obs%StoreObsType('net-infiltration', .true., indx)
2141  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2142  !
2143  ! for water-content observation type.
2144  call this%obs%StoreObsType('water-content', .false., indx)
2145  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
Here is the call graph for this function:

◆ uzf_fc()

subroutine uzfmodule::uzf_fc ( class(uzftype)  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

Definition at line 938 of file gwf-uzf.f90.

939  ! -- dummy
940  class(UzfType) :: this
941  real(DP), dimension(:), intent(inout) :: rhs
942  integer(I4B), dimension(:), intent(in) :: ia
943  integer(I4B), dimension(:), intent(in) :: idxglo
944  class(MatrixBaseType), pointer :: matrix_sln
945  ! -- local
946  integer(I4B) :: i, n, ipos
947  !
948  ! -- pakmvrobj fc
949  if (this%imover == 1) then
950  call this%pakmvrobj%fc()
951  end if
952  !
953  ! -- Solve UZF; set reset_state to true so that waves are reset back to
954  ! initial position for each outer iteration
955  call this%uzf_solve(reset_state=.true.)
956  !
957  ! -- Copy package rhs and hcof into solution rhs and amat
958  do i = 1, this%nodes
959  n = this%nodelist(i)
960  rhs(n) = rhs(n) + this%rhs(i)
961  ipos = ia(n)
962  call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
963  end do

◆ uzf_fill_budobj()

subroutine uzfmodule::uzf_fill_budobj ( class(uzftype)  this)

Definition at line 2782 of file gwf-uzf.f90.

2783  ! -- dummy
2784  class(UzfType) :: this
2785  ! -- local
2786  integer(I4B) :: naux
2787  integer(I4B) :: nlen
2788  integer(I4B) :: ivertflag
2789  integer(I4B) :: n, n1, n2
2790  integer(I4B) :: idx
2791  real(DP) :: q
2792  real(DP) :: a
2793  real(DP) :: top
2794  real(DP) :: bot
2795  real(DP) :: thick
2796  real(DP) :: fm
2797  real(DP) :: v
2798  !
2799  ! -- initialize counter
2800  idx = 0
2801  !
2802  ! -- FLOW JA FACE
2803  nlen = 0
2804  do n = 1, this%nodes
2805  ivertflag = this%uzfobj%ivertcon(n)
2806  if (ivertflag > 0) then
2807  nlen = nlen + 1
2808  end if
2809  end do
2810  if (nlen > 0) then
2811  idx = idx + 1
2812  call this%budobj%budterm(idx)%reset(nlen * 2)
2813  do n = 1, this%nodes
2814  ivertflag = this%uzfobj%ivertcon(n)
2815  if (ivertflag > 0) then
2816  a = this%uzfobj%uzfarea(n)
2817  q = this%uzfobj%surfluxbelow(n) * a
2818  this%qauxcbc(1) = a
2819  if (q > dzero) then
2820  q = -q
2821  end if
2822  n1 = n
2823  n2 = ivertflag
2824  call this%budobj%budterm(idx)%update_term(n1, n2, q, this%qauxcbc)
2825  call this%budobj%budterm(idx)%update_term(n2, n1, -q, this%qauxcbc)
2826  end if
2827  end do
2828  end if
2829  !
2830  ! -- GWF (LEAKAGE)
2831  idx = idx + 1
2832  call this%budobj%budterm(idx)%reset(this%nodes)
2833  do n = 1, this%nodes
2834  this%qauxcbc(1) = this%uzfobj%uzfarea(n)
2835  n2 = this%igwfnode(n)
2836  q = -this%rch(n)
2837  call this%budobj%budterm(idx)%update_term(n, n2, q, this%qauxcbc)
2838  end do
2839  !
2840  ! -- INFILTRATION
2841  idx = idx + 1
2842  call this%budobj%budterm(idx)%reset(this%nodes)
2843  do n = 1, this%nodes
2844  q = this%appliedinf(n)
2845  call this%budobj%budterm(idx)%update_term(n, n, q)
2846  end do
2847  !
2848  ! -- REJECTED INFILTRATION
2849  idx = idx + 1
2850  call this%budobj%budterm(idx)%reset(this%nodes)
2851  do n = 1, this%nodes
2852  q = this%rejinf(n)
2853  if (q > dzero) then
2854  q = -q
2855  end if
2856  call this%budobj%budterm(idx)%update_term(n, n, q)
2857  end do
2858  !
2859  ! -- UNSATURATED EVT
2860  if (this%ietflag /= 0) then
2861  idx = idx + 1
2862  call this%budobj%budterm(idx)%reset(this%nodes)
2863  do n = 1, this%nodes
2864  q = this%uzet(n)
2865  if (q > dzero) then
2866  q = -q
2867  end if
2868  call this%budobj%budterm(idx)%update_term(n, n, q)
2869  end do
2870  end if
2871  !
2872  ! -- STORAGE
2873  idx = idx + 1
2874  call this%budobj%budterm(idx)%reset(this%nodes)
2875  do n = 1, this%nodes
2876  q = -this%qsto(n)
2877  top = this%uzfobj%celtop(n)
2878  bot = this%uzfobj%watab(n)
2879  thick = top - bot
2880  if (thick > dzero) then
2881  fm = thick * (this%wcnew(n) - this%uzfobj%thtr(n))
2882  v = fm * this%uzfobj%uzfarea(n)
2883  else
2884  v = dzero
2885  end if
2886  ! -- save mobile water volume into aux variable
2887  this%qauxcbc(1) = v
2888  call this%budobj%budterm(idx)%update_term(n, n, q, this%qauxcbc)
2889  end do
2890  !
2891  ! -- MOVER
2892  if (this%imover == 1) then
2893  !
2894  ! -- FROM MOVER
2895  idx = idx + 1
2896  call this%budobj%budterm(idx)%reset(this%nodes)
2897  do n = 1, this%nodes
2898  q = this%pakmvrobj%get_qfrommvr(n)
2899  call this%budobj%budterm(idx)%update_term(n, n, q)
2900  end do
2901  !
2902  ! -- REJ-INF-TO-MVR
2903  idx = idx + 1
2904  call this%budobj%budterm(idx)%reset(this%nodes)
2905  do n = 1, this%nodes
2906  q = this%rejinftomvr(n)
2907  if (q > dzero) then
2908  q = -q
2909  end if
2910  call this%budobj%budterm(idx)%update_term(n, n, q)
2911  end do
2912 
2913  end if
2914  !
2915  ! -- AUXILIARY VARIABLES
2916  naux = this%naux
2917  if (naux > 0) then
2918  idx = idx + 1
2919  call this%budobj%budterm(idx)%reset(this%nodes)
2920  do n = 1, this%nodes
2921  q = dzero
2922  call this%budobj%budterm(idx)%update_term(n, n, q, this%auxvar(:, n))
2923  end do
2924  end if
2925  !
2926  ! --Terms are filled, now accumulate them for this time step
2927  call this%budobj%accumulate_terms()

◆ uzf_fn()

subroutine uzfmodule::uzf_fn ( class(uzftype)  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

Definition at line 968 of file gwf-uzf.f90.

969  ! -- dummy
970  class(UzfType) :: this
971  real(DP), dimension(:), intent(inout) :: rhs
972  integer(I4B), dimension(:), intent(in) :: ia
973  integer(I4B), dimension(:), intent(in) :: idxglo
974  class(MatrixBaseType), pointer :: matrix_sln
975  ! -- local
976  integer(I4B) :: i, n
977  integer(I4B) :: ipos
978  !
979  ! -- Add derivative terms to rhs and amat
980  do i = 1, this%nodes
981  n = this%nodelist(i)
982  ipos = ia(n)
983  call matrix_sln%add_value_pos(idxglo(ipos), this%deriv(i))
984  rhs(n) = rhs(n) + this%deriv(i) * this%xnew(n)
985  end do

◆ uzf_obs_supported()

logical function uzfmodule::uzf_obs_supported ( class(uzftype)  this)

Overrides BndTypebnd_obs_supported

Definition at line 2079 of file gwf-uzf.f90.

2080  ! -- dummy
2081  class(UzfType) :: this
2082  !
2083  uzf_obs_supported = .true.

◆ uzf_ot_bdsummary()

subroutine uzfmodule::uzf_ot_bdsummary ( class(uzftype)  this,
integer(i4b), intent(in)  kstp,
integer(i4b), intent(in)  kper,
integer(i4b), intent(in)  iout,
integer(i4b), intent(in)  ibudfl 
)
Parameters
thisUzfType 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 1521 of file gwf-uzf.f90.

1522  ! -- module
1523  use tdismodule, only: totim, delt
1524  ! -- dummy
1525  class(UzfType) :: this !< UzfType object
1526  integer(I4B), intent(in) :: kstp !< time step number
1527  integer(I4B), intent(in) :: kper !< period number
1528  integer(I4B), intent(in) :: iout !< flag and unit number for the model listing file
1529  integer(I4B), intent(in) :: ibudfl !< flag indicating budget should be written
1530  !
1531  call this%budobj%write_budtable(kstp, kper, iout, ibudfl, totim, delt)

◆ uzf_ot_dv()

subroutine uzfmodule::uzf_ot_dv ( class(uzftype)  this,
integer(i4b), intent(in)  idvsave,
integer(i4b), intent(in)  idvprint 
)

Definition at line 1494 of file gwf-uzf.f90.

1495  ! -- modules
1496  use tdismodule, only: kstp, kper, pertim, totim
1497  ! -- dummy
1498  use inputoutputmodule, only: ulasav
1499  class(UzfType) :: this
1500  integer(I4B), intent(in) :: idvsave
1501  integer(I4B), intent(in) :: idvprint
1502  ! -- local
1503  integer(I4B) :: ibinun
1504  !
1505  ! -- set unit number for binary dependent variable output
1506  ibinun = 0
1507  if (this%iwcontout /= 0) then
1508  ibinun = this%iwcontout
1509  end if
1510  if (idvsave == 0) ibinun = 0
1511  !
1512  ! -- write uzf binary moisture-content output
1513  if (ibinun > 0) then
1514  call ulasav(this%wcnew, ' WATER-CONTENT', kstp, kper, pertim, &
1515  totim, this%nodes, 1, 1, ibinun)
1516  end if
subroutine, public ulasav(buf, text, kstp, kper, pertim, totim, ncol, nrow, ilay, ichn)
Save 1 layer array on disk.
real(dp), pointer, public pertim
time relative to start of stress period
Definition: tdis.f90:33
Here is the call graph for this function:

◆ uzf_ot_model_flows()

subroutine uzfmodule::uzf_ot_model_flows ( class(uzftype)  this,
integer(i4b), intent(in)  icbcfl,
integer(i4b), intent(in)  ibudfl,
integer(i4b), intent(in)  icbcun,
integer(i4b), dimension(:), intent(in), optional  imap 
)

Definition at line 1391 of file gwf-uzf.f90.

1392  ! -- modules
1393  use constantsmodule, only: lenboundname, dzero
1395  ! -- dummy
1396  class(UzfType) :: this
1397  integer(I4B), intent(in) :: icbcfl
1398  integer(I4B), intent(in) :: ibudfl
1399  integer(I4B), intent(in) :: icbcun
1400  integer(I4B), dimension(:), optional, intent(in) :: imap
1401  ! -- local
1402  character(len=LINELENGTH) :: title
1403  integer(I4B) :: itxt
1404  !
1405  ! -- UZF-GWRCH
1406  itxt = 2
1407  title = trim(adjustl(this%bdtxt(itxt)))//' PACKAGE ('// &
1408  trim(this%packName)//') FLOW RATES'
1409  call save_print_model_flows(icbcfl, ibudfl, icbcun, this%iprflow, &
1410  this%outputtab, this%nbound, this%nodelist, &
1411  this%rch, this%ibound, title, this%bdtxt(itxt), &
1412  this%ipakcb, this%dis, this%naux, &
1413  this%name_model, this%name_model, &
1414  this%name_model, this%packName, this%auxname, &
1415  this%auxvar, this%iout, this%inamedbound, &
1416  this%boundname)
1417  !
1418  ! -- UZF-GWD
1419  if (this%iseepflag == 1) then
1420  itxt = 3
1421  title = trim(adjustl(this%bdtxt(itxt)))//' PACKAGE ('// &
1422  trim(this%packName)//') FLOW RATES'
1423  call save_print_model_flows(icbcfl, ibudfl, icbcun, this%iprflow, &
1424  this%outputtab, this%nbound, this%nodelist, &
1425  -this%gwd, this%ibound, title, &
1426  this%bdtxt(itxt), this%ipakcb, this%dis, &
1427  this%naux, this%name_model, this%name_model, &
1428  this%name_model, this%packName, this%auxname, &
1429  this%auxvar, this%iout, this%inamedbound, &
1430  this%boundname)
1431  !
1432  ! -- UZF-GWD TO-MVR
1433  if (this%imover == 1) then
1434  itxt = 5
1435  title = trim(adjustl(this%bdtxt(itxt)))//' PACKAGE ('// &
1436  trim(this%packName)//') FLOW RATES'
1437  call save_print_model_flows(icbcfl, ibudfl, icbcun, this%iprflow, &
1438  this%outputtab, this%nbound, this%nodelist, &
1439  -this%gwdtomvr, this%ibound, title, &
1440  this%bdtxt(itxt), this%ipakcb, this%dis, &
1441  this%naux, this%name_model, this%name_model, &
1442  this%name_model, this%packName, &
1443  this%auxname, this%auxvar, this%iout, &
1444  this%inamedbound, this%boundname)
1445  end if
1446  end if
1447  !
1448  ! -- UZF-GWET
1449  if (this%igwetflag /= 0) then
1450  itxt = 4
1451  title = trim(adjustl(this%bdtxt(itxt)))//' PACKAGE ('// &
1452  trim(this%packName)//') FLOW RATES'
1453  call save_print_model_flows(icbcfl, ibudfl, icbcun, this%iprflow, &
1454  this%outputtab, this%nbound, this%nodelist, &
1455  -this%gwet_pvar, this%ibound, title, &
1456  this%bdtxt(itxt), this%ipakcb, this%dis, &
1457  this%naux, this%name_model, this%name_model, &
1458  this%name_model, this%packName, this%auxname, &
1459  this%auxvar, this%iout, this%inamedbound, &
1460  this%boundname)
1461  end if
This module contains the base boundary package.
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.
Here is the call graph for this function:

◆ uzf_ot_package_flows()

subroutine uzfmodule::uzf_ot_package_flows ( class(uzftype)  this,
integer(i4b), intent(in)  icbcfl,
integer(i4b), intent(in)  ibudfl 
)

Definition at line 1466 of file gwf-uzf.f90.

1467  ! -- modules
1468  use tdismodule, only: kstp, kper, delt, pertim, totim
1469  ! -- dummy
1470  class(UzfType) :: this
1471  integer(I4B), intent(in) :: icbcfl
1472  integer(I4B), intent(in) :: ibudfl
1473  integer(I4B) :: ibinun
1474  !
1475  ! -- write the flows from the budobj
1476  ibinun = 0
1477  if (this%ibudgetout /= 0) then
1478  ibinun = this%ibudgetout
1479  end if
1480  if (icbcfl == 0) ibinun = 0
1481  if (ibinun > 0) then
1482  call this%budobj%save_flows(this%dis, ibinun, kstp, kper, delt, &
1483  pertim, totim, this%iout)
1484  end if
1485  !
1486  ! -- Print lake flows table
1487  if (ibudfl /= 0 .and. this%iprflow /= 0) then
1488  call this%budobj%write_flowtable(this%dis, kstp, kper)
1489  end if

◆ uzf_process_obsid()

subroutine uzfmodule::uzf_process_obsid ( type(observetype), intent(inout)  obsrv,
class(disbasetype), intent(in)  dis,
integer(i4b), intent(in)  inunitobs,
integer(i4b), intent(in)  iout 
)

Process the ID string of an observation definition for UZF-package observations

Definition at line 2380 of file gwf-uzf.f90.

2381  ! -- .
2382  ! -- dummy
2383  type(ObserveType), intent(inout) :: obsrv
2384  class(DisBaseType), intent(in) :: dis
2385  integer(I4B), intent(in) :: inunitobs
2386  integer(I4B), intent(in) :: iout
2387  ! -- local
2388  integer(I4B) :: n, nn
2389  real(DP) :: obsdepth
2390  integer(I4B) :: icol, istart, istop, istat
2391  real(DP) :: r
2392  character(len=LINELENGTH) :: string
2393  ! formats
2394 30 format(i10)
2395  !
2396  string = obsrv%IDstring
2397  ! -- Extract node number from string and store it.
2398  ! If 1st item is not an integer(I4B), it should be a
2399  ! feature name--deal with it.
2400  icol = 1
2401  ! -- get node number
2402  call urword(string, icol, istart, istop, 1, n, r, iout, inunitobs)
2403  read (string(istart:istop), 30, iostat=istat) nn
2404  if (istat == 0) then
2405  ! -- store uzf node number (NodeNumber)
2406  obsrv%NodeNumber = nn
2407  else
2408  ! Integer can't be read from string; it's presumed to be a boundary
2409  ! name (already converted to uppercase)
2410  obsrv%FeatureName = string(istart:istop)
2411  !obsrv%FeatureName = trim(adjustl(string))
2412  ! -- Observation may require summing rates from multiple boundaries,
2413  ! so assign NodeNumber as a value that indicates observation
2414  ! is for a named boundary or group of boundaries.
2415  obsrv%NodeNumber = namedboundflag
2416  end if
2417  !
2418  ! -- for soil water observation, store depth
2419  if (obsrv%ObsTypeId == 'WATER-CONTENT') then
2420  call urword(string, icol, istart, istop, 3, n, r, iout, inunitobs)
2421  obsdepth = r
2422  ! -- store observations depth
2423  obsrv%Obsdepth = obsdepth
2424  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uzf_rp()

subroutine uzfmodule::uzf_rp ( class(uzftype), intent(inout)  this)

Definition at line 653 of file gwf-uzf.f90.

654  ! -- modules
655  use tdismodule, only: kper
657  ! -- dummy
658  class(UzfType), intent(inout) :: this
659  ! -- local
660  integer(I4B), pointer :: nlist => null()
661  integer(I4B), dimension(:), pointer, contiguous :: ifno => null()
662  integer(I4B) :: i, n
663  ! -- table output
664  character(len=20) :: cellid
665  character(len=LINELENGTH) :: title
666  character(len=LINELENGTH) :: tag
667  integer(I4B) :: ntabrows
668  integer(I4B) :: ntabcols
669  integer(I4B) :: node
670  !-- formats
671  character(len=*), parameter :: fmtlsp = &
672  &"(1X,/1X,'REUSING ',A,'S FROM LAST STRESS PERIOD')"
673  !
674  ! -- set nbound to maxbound
675  this%nbound = this%maxbound
676  !
677  ! -- set steady-state flag based on gwfiss
678  this%issflag = this%gwfiss
679  !
680  ! -- check if input has loaded data for this stress period
681  if (this%iper == kper) then
682  !
683  ! -- get PERIOD data arrays
684  call mem_setptr(nlist, 'NBOUND', this%input_mempath)
685  call mem_setptr(ifno, 'IFNO', this%input_mempath)
686  !
687  ! -- setup inputtab tableobj if PRINT_INPUT
688  if (this%iprpak /= 0) then
689  ntabrows = 1
690  ntabcols = 3
691  if (this%ietflag /= 0) then
692  ntabcols = ntabcols + 3
693  if (this%ietflag == 2) then
694  ntabcols = ntabcols + 3
695  end if
696  end if
697  if (this%inamedbound == 1) then
698  ntabcols = ntabcols + 1
699  end if
700  title = trim(adjustl(this%text))//' PACKAGE ('// &
701  trim(adjustl(this%packName))//') DATA FOR PERIOD'
702  write (title, '(a,1x,i6)') trim(adjustl(title)), kper
703  call table_cr(this%inputtab, this%packName, title)
704  call this%inputtab%table_df(ntabrows, ntabcols, this%iout, &
705  finalize=.false.)
706  tag = 'NUMBER'
707  call this%inputtab%initialize_column(tag, 10)
708  tag = 'CELLID'
709  call this%inputtab%initialize_column(tag, 20, alignment=tableft)
710  tag = 'FINF'
711  call this%inputtab%initialize_column(tag, 12)
712  if (this%ietflag /= 0) then
713  tag = 'PET'
714  call this%inputtab%initialize_column(tag, 12)
715  tag = 'EXTDEP'
716  call this%inputtab%initialize_column(tag, 12)
717  tag = 'EXTWC'
718  call this%inputtab%initialize_column(tag, 12)
719  if (this%ietflag == 2) then
720  tag = 'HA'
721  call this%inputtab%initialize_column(tag, 12)
722  tag = 'HROOT'
723  call this%inputtab%initialize_column(tag, 12)
724  tag = 'ROOTACT'
725  call this%inputtab%initialize_column(tag, 12)
726  end if
727  end if
728  if (this%inamedbound == 1) then
729  tag = 'BOUNDNAME'
730  call this%inputtab%initialize_column(tag, lenboundname, &
731  alignment=tableft)
732  end if
733  end if
734  !
735  ! -- loop over period data
736  do n = 1, nlist
737  i = ifno(n)
738  if (i < 1 .or. i > this%nodes) then
739  tag = trim(adjustl(this%text))//' PACKAGE ('// &
740  trim(adjustl(this%packName))//') DATA FOR PERIOD'
741  write (tag, '(a,1x,i0)') trim(adjustl(tag)), kper
742  write (errmsg, '(a,a,i0,1x,a,i0,a)') &
743  trim(adjustl(tag)), ': UZFNO ', i, &
744  'must be greater than 0 and less than or equal to ', this%nodes, '.'
745  call store_error(errmsg)
746  cycle
747  end if
748  !
749  ! -- sinf_pvar/pet_pvar/extdp/extwc_pvar/ha_pvar/hroot_pvar/
750  ! -- rootact_pvar/uauxvar alias finf/pet/extdp/extwc/ha/hroot/
751  ! -- rootact/AUX directly; nothing to merge
752  !
753  ! -- write table output
754  if (this%iprpak /= 0) then
755  node = this%igwfnode(i)
756  if (node > 0) then
757  call this%dis%noder_to_string(node, cellid)
758  else
759  cellid = 'none'
760  end if
761  call this%inputtab%add_term(i)
762  call this%inputtab%add_term(cellid)
763  call this%inputtab%add_term(this%sinf_pvar(i))
764  if (this%ietflag /= 0) then
765  call this%inputtab%add_term(this%pet_pvar(i))
766  call this%inputtab%add_term(this%extdp(i))
767  call this%inputtab%add_term(this%extwc_pvar(i))
768  if (this%ietflag == 2) then
769  call this%inputtab%add_term(this%ha_pvar(i))
770  call this%inputtab%add_term(this%hroot_pvar(i))
771  call this%inputtab%add_term(this%rootact_pvar(i))
772  end if
773  end if
774  if (this%inamedbound == 1) then
775  call this%inputtab%add_term(this%boundname(i))
776  end if
777  end if
778  end do
779  !
780  if (this%iprpak /= 0) then
781  call this%inputtab%finalize_table()
782  end if
783  !
784  if (count_errors() > 0) then
785  call store_error_filename(this%input_fname)
786  end if
787  !
788  else
789  write (this%iout, fmtlsp) trim(this%filtyp)
790  end if
791  !
792  ! -- set wave data for first stress period and second that follows SS;
793  ! must run every period (not just when iper==kper) so that the reuse
794  ! case (kper==2, no new PERIOD block, issflagold==1) still initializes
795  ! wave data for the SS->TR transition.
796  if ((this%issflag == 0 .AND. kper == 1) .or. &
797  (kper == 2 .AND. this%issflagold == 1)) then
798  do i = 1, this%nodes
799  call this%uzfobj%setwaves(i)
800  end do
801  end if
802  !
803  ! -- Initialize the water content
804  if (kper == 1) then
805  do i = 1, this%nodes
806  this%wcnew(i) = this%uzfobj%get_wcnew(i)
807  end do
808  end if
809  !
810  ! -- Save old ss flag
811  this%issflagold = this%issflag
Here is the call graph for this function:

◆ uzf_rp_obs()

subroutine uzfmodule::uzf_rp_obs ( class(uzftype), intent(inout)  this)
private

Only done the first stress period since boundaries are fixed for the simulation

Definition at line 2247 of file gwf-uzf.f90.

2248  ! -- modules
2249  use tdismodule, only: kper
2250  ! -- dummy
2251  class(UzfType), intent(inout) :: this
2252  ! -- local
2253  integer(I4B) :: i
2254  integer(I4B) :: j
2255  integer(I4B) :: n
2256  integer(I4B) :: nn
2257  integer(I4B) :: iuzid
2258  real(DP) :: obsdepth
2259  real(DP) :: dmax
2260  character(len=LENBOUNDNAME) :: bname
2261  class(ObserveType), pointer :: obsrv => null()
2262  ! -- formats
2263 10 format('Boundary "', a, '" for observation "', a, &
2264  '" is invalid in package "', a, '"')
2265 60 format('Invalid node number in OBS input: ', i0)
2266  !
2267  if (kper == 1) then
2268  do i = 1, this%obs%npakobs
2269  obsrv => this%obs%pakobs(i)%obsrv
2270  !
2271  ! -- get node number 1
2272  nn = obsrv%NodeNumber
2273  if (nn == namedboundflag) then
2274  bname = obsrv%FeatureName
2275  !
2276  ! -- Observation location(s) is(are) based on a boundary name.
2277  ! Iterate through all boundaries to identify and store
2278  ! corresponding index(indices) in bound array.
2279  if (this%inamedbound /= 0) then
2280  do j = 1, this%nodes
2281  if (this%boundname(j) == bname) then
2282  obsrv%BndFound = .true.
2283  obsrv%CurrentTimeStepEndValue = dzero
2284  call obsrv%AddObsIndex(j)
2285  if (obsrv%indxbnds_count == 1) then
2286  !
2287  ! -- Define intPak1 so that obs_theta is stored (for first uzf
2288  ! cell if multiple cells share the same boundname).
2289  obsrv%intPak1 = j
2290  end if
2291  end if
2292  end do
2293  end if
2294  if (.not. obsrv%BndFound) then
2295  write (errmsg, 10) trim(bname), trim(obsrv%Name), trim(this%packName)
2296  call store_error(errmsg)
2297  cycle
2298  end if
2299  else
2300  !
2301  ! -- get node number
2302  nn = obsrv%NodeNumber
2303  !
2304  ! -- put nn (a value meaningful only to UZF) in intPak1
2305  obsrv%intPak1 = nn
2306  ! -- check that node number is valid; call store_error if not
2307  if (nn < 1 .or. nn > this%nodes) then
2308  write (errmsg, 60) nn
2309  call store_error(errmsg)
2310  else
2311  obsrv%BndFound = .true.
2312  end if
2313  obsrv%CurrentTimeStepEndValue = dzero
2314  call obsrv%AddObsIndex(nn)
2315  end if
2316  !
2317  ! -- catch non-cumulative observation assigned to observation defined
2318  ! by a boundname that is assigned to more than one element
2319  if (obsrv%ObsTypeId == 'WATER-CONTENT') then
2320  n = obsrv%indxbnds_count
2321  if (n /= 1) then
2322  write (errmsg, '(a,3(1x,a))') &
2323  trim(adjustl(obsrv%ObsTypeId)), 'for observation', &
2324  trim(adjustl(obsrv%Name)), &
2325  'must be assigned to a UZF cell with a unique boundname.'
2326  call store_error(errmsg, terminate=.true.)
2327  end if
2328  !
2329  ! -- check WATER-CONTENT depth
2330  obsdepth = obsrv%Obsdepth
2331  !
2332  ! -- put obsdepth (a value meaningful only to UZF) in dblPak1
2333  obsrv%dblPak1 = obsdepth
2334  !
2335  ! -- determine maximum cell depth
2336  ! -- This is presently complicated for landflag = 1 cells and surfdep
2337  ! greater than zero. In this case, celtop is dis%top - surfdep.
2338  iuzid = obsrv%intPak1
2339  dmax = this%uzfobj%celtop(iuzid) - this%uzfobj%celbot(iuzid)
2340  ! -- check that obs depth is valid; call store_error if not
2341  ! -- need to think about a way to put bounds on this depth
2342  ! -- Also, an observation depth of 0.0, whether a landflag == 1 object
2343  ! -- or a subsurface object, is not legit since this would be at a
2344  ! -- a layer interface and therefore a discontinuity.
2345  if (obsdepth <= dzero .or. obsdepth > dmax) then
2346  write (errmsg, '(a,3(1x,a),1x,g0,1x,a,1x,g0,a)') &
2347  trim(adjustl(obsrv%ObsTypeId)), 'for observation', &
2348  trim(adjustl(obsrv%Name)), 'specified depth (', obsdepth, &
2349  ') must be greater than 0.0 and less than ', dmax, '.'
2350  call store_error(errmsg)
2351  end if
2352  else
2353  do j = 1, obsrv%indxbnds_count
2354  nn = obsrv%indxbnds(j)
2355  if (nn < 1 .or. nn > this%maxbound) then
2356  write (errmsg, '(a,2(1x,a),1x,i0,1x,a,1x,i0,a)') &
2357  trim(adjustl(obsrv%ObsTypeId)), 'uzfno must be greater than 0 ', &
2358  'and less than or equal to', this%maxbound, &
2359  '(specified value is ', nn, ').'
2360  call store_error(errmsg)
2361  end if
2362  end do
2363  end if
2364  end do
2365  !
2366  ! -- evaluate if there are any observation errors
2367  if (count_errors() > 0) then
2368  call store_error_filename(this%input_fname)
2369  end if
2370  end if
Here is the call graph for this function:

◆ uzf_setup_budobj()

subroutine uzfmodule::uzf_setup_budobj ( class(uzftype)  this)

The terms listed here must correspond in number and order to the ones listed in the uzf_fill_budobj routine

Definition at line 2581 of file gwf-uzf.f90.

2582  ! -- modules
2583  use constantsmodule, only: lenbudtxt
2584  ! -- dummy
2585  class(UzfType) :: this
2586  ! -- local
2587  integer(I4B) :: nbudterm
2588  integer(I4B) :: maxlist, naux
2589  integer(I4B) :: idx
2590  integer(I4B) :: nlen
2591  integer(I4B) :: n, n1, n2
2592  integer(I4B) :: ivertflag
2593  real(DP) :: q
2594  character(len=LENBUDTXT) :: text
2595  character(len=LENBUDTXT), dimension(1) :: auxtxt
2596  !
2597  ! -- Determine the number of uzf to uzf connections
2598  nlen = 0
2599  do n = 1, this%nodes
2600  ivertflag = this%uzfobj%ivertcon(n)
2601  if (ivertflag > 0) then
2602  nlen = nlen + 1
2603  end if
2604  end do
2605  !
2606  ! -- Determine the number of uzf budget terms. These are fixed for
2607  ! the simulation and cannot change. This includes FLOW-JA-FACE
2608  ! so they can be written to the binary budget files, but these internal
2609  ! flows are not included as part of the budget table.
2610  nbudterm = 4
2611  if (nlen > 0) nbudterm = nbudterm + 1
2612  if (this%ietflag /= 0) nbudterm = nbudterm + 1
2613  if (this%imover == 1) nbudterm = nbudterm + 2
2614  if (this%naux > 0) nbudterm = nbudterm + 1
2615  !
2616  ! -- set up budobj
2617  call budgetobject_cr(this%budobj, this%packName)
2618  call this%budobj%budgetobject_df(this%maxbound, nbudterm, 0, 0, &
2619  ibudcsv=this%ibudcsv)
2620  idx = 0
2621  !
2622  ! -- Go through and set up each budget term
2623  text = ' FLOW-JA-FACE'
2624  if (nlen > 0) then
2625  idx = idx + 1
2626  maxlist = nlen * 2
2627  naux = 1
2628  auxtxt(1) = ' FLOW-AREA'
2629  call this%budobj%budterm(idx)%initialize(text, &
2630  this%name_model, &
2631  this%packName, &
2632  this%name_model, &
2633  this%packName, &
2634  maxlist, .false., .false., &
2635  naux, auxtxt, ordered_id1=.false.)
2636  !
2637  ! -- store connectivity
2638  call this%budobj%budterm(idx)%reset(nlen * 2)
2639  q = dzero
2640  do n = 1, this%nodes
2641  ivertflag = this%uzfobj%ivertcon(n)
2642  if (ivertflag > 0) then
2643  n1 = n
2644  n2 = ivertflag
2645  call this%budobj%budterm(idx)%update_term(n1, n2, q)
2646  call this%budobj%budterm(idx)%update_term(n2, n1, -q)
2647  end if
2648  end do
2649  end if
2650  !
2651  ! --
2652  text = ' GWF'
2653  idx = idx + 1
2654  maxlist = this%nodes
2655  naux = 1
2656  auxtxt(1) = ' FLOW-AREA'
2657  call this%budobj%budterm(idx)%initialize(text, &
2658  this%name_model, &
2659  this%packName, &
2660  this%name_model, &
2661  this%name_model, &
2662  maxlist, .false., .true., &
2663  naux, auxtxt)
2664  call this%budobj%budterm(idx)%reset(this%nodes)
2665  q = dzero
2666  do n = 1, this%nodes
2667  n2 = this%igwfnode(n)
2668  this%qauxcbc(1) = this%uzfobj%uzfarea(n)
2669  call this%budobj%budterm(idx)%update_term(n, n2, q, this%qauxcbc)
2670  end do
2671  !
2672  ! --
2673  text = ' INFILTRATION'
2674  idx = idx + 1
2675  maxlist = this%nodes
2676  naux = 0
2677  call this%budobj%budterm(idx)%initialize(text, &
2678  this%name_model, &
2679  this%packName, &
2680  this%name_model, &
2681  this%packName, &
2682  maxlist, .false., .false., &
2683  naux)
2684  !
2685  ! --
2686  text = ' REJ-INF'
2687  idx = idx + 1
2688  maxlist = this%nodes
2689  naux = 0
2690  call this%budobj%budterm(idx)%initialize(text, &
2691  this%name_model, &
2692  this%packName, &
2693  this%name_model, &
2694  this%packName, &
2695  maxlist, .false., .false., &
2696  naux)
2697  !
2698  ! --
2699  text = ' UZET'
2700  if (this%ietflag /= 0) then
2701  idx = idx + 1
2702  maxlist = this%maxbound
2703  naux = 0
2704  call this%budobj%budterm(idx)%initialize(text, &
2705  this%name_model, &
2706  this%packName, &
2707  this%name_model, &
2708  this%packName, &
2709  maxlist, .false., .false., &
2710  naux)
2711  end if
2712  !
2713  ! --
2714  text = ' STORAGE'
2715  idx = idx + 1
2716  maxlist = this%nodes
2717  naux = 1
2718  auxtxt(1) = ' VOLUME'
2719  call this%budobj%budterm(idx)%initialize(text, &
2720  this%name_model, &
2721  this%packName, &
2722  this%name_model, &
2723  this%packName, &
2724  maxlist, .false., .false., &
2725  naux, auxtxt)
2726  !
2727  ! --
2728  if (this%imover == 1) then
2729  !
2730  ! --
2731  text = ' FROM-MVR'
2732  idx = idx + 1
2733  maxlist = this%nodes
2734  naux = 0
2735  call this%budobj%budterm(idx)%initialize(text, &
2736  this%name_model, &
2737  this%packName, &
2738  this%name_model, &
2739  this%packName, &
2740  maxlist, .false., .false., &
2741  naux)
2742  !
2743  ! --
2744  text = ' REJ-INF-TO-MVR'
2745  idx = idx + 1
2746  maxlist = this%nodes
2747  naux = 0
2748  call this%budobj%budterm(idx)%initialize(text, &
2749  this%name_model, &
2750  this%packName, &
2751  this%name_model, &
2752  this%packName, &
2753  maxlist, .false., .false., &
2754  naux)
2755  end if
2756  !
2757  ! --
2758  naux = this%naux
2759  if (naux > 0) then
2760  !
2761  ! --
2762  text = ' AUXILIARY'
2763  idx = idx + 1
2764  maxlist = this%maxbound
2765  call this%budobj%budterm(idx)%initialize(text, &
2766  this%name_model, &
2767  this%packName, &
2768  this%name_model, &
2769  this%packName, &
2770  maxlist, .false., .false., &
2771  naux, this%auxname)
2772  end if
2773  !
2774  ! -- if uzf flow for each reach are written to the listing file
2775  if (this%iprflow /= 0) then
2776  call this%budobj%flowtable_df(this%iout, cellids='GWF')
2777  end if
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
Definition: Constants.f90:37
Here is the call graph for this function:

◆ uzf_solve()

subroutine uzfmodule::uzf_solve ( class(uzftype)  this,
logical, intent(in)  reset_state 
)
Parameters
[in]reset_stateflag indicating that waves should be reset after solution

Definition at line 1536 of file gwf-uzf.f90.

1537  ! -- modules
1538  use tdismodule, only: delt
1539  logical, intent(in) :: reset_state !< flag indicating that waves should be reset after solution
1540  ! -- dummy
1541  class(UzfType) :: this
1542  ! -- locals
1543  integer(I4B) :: i, ivertflag
1544  integer(I4B) :: n, m, ierr
1545  real(DP) :: trhs1, thcof1, trhs2, thcof2
1546  real(DP) :: hgwf, uzderiv, derivgwet
1547  real(DP) :: qfrommvr
1548  real(DP) :: qformvr
1549  real(DP) :: wc
1550  real(DP) :: watabold
1551  !
1552  ! -- Initialize
1553  ierr = 0
1554  do i = 1, this%nodes
1555  this%uzfobj%pet(i) = this%uzfobj%petmax(i)
1556  end do
1557  !
1558  ! -- Calculate hcof and rhs for each UZF entry
1559  do i = 1, this%nodes
1560  !
1561  ! -- Initialize hcof/rhs terms
1562  this%hcof(i) = dzero
1563  this%rhs(i) = dzero
1564  thcof1 = dzero
1565  thcof2 = dzero
1566  trhs1 = dzero
1567  trhs2 = dzero
1568  uzderiv = dzero
1569  derivgwet = dzero
1570  !
1571  ! -- Initialize variables
1572  n = this%nodelist(i)
1573  ivertflag = this%uzfobj%ivertcon(i)
1574  watabold = this%uzfobj%watabold(i)
1575  !
1576  if (this%ibound(n) > 0) then
1577  !
1578  ! -- Water mover added to infiltration
1579  qfrommvr = dzero
1580  qformvr = dzero
1581  if (this%imover == 1) then
1582  qfrommvr = this%pakmvrobj%get_qfrommvr(i)
1583  end if
1584  !
1585  hgwf = this%xnew(n)
1586  m = n
1587  !
1588  ! -- solve for current uzf cell
1589  call this%uzfobj%solve(ivertflag, i, &
1590  this%totfluxtot, this%ietflag, &
1591  this%issflag, this%iseepflag, hgwf, &
1592  qfrommvr, ierr, &
1593  reset_state=reset_state, &
1594  trhs=trhs1, thcof=thcof1, deriv=uzderiv, &
1595  watercontent=wc)
1596  !
1597  ! -- terminate if an error condition has occurred
1598  if (ierr > 0) then
1599  if (ierr == 1) &
1600  errmsg = 'UZF variable NWAVESETS needs to be increased.'
1601  call store_error(errmsg, terminate=.true.)
1602  end if
1603  !
1604  ! -- Calculate gwet
1605  if (this%igwetflag > 0) then
1606  call this%uzfobj%setgwpet(i)
1607  call this%uzfobj%simgwet(this%igwetflag, i, hgwf, trhs2, thcof2, &
1608  derivgwet)
1609  end if
1610  !
1611  ! -- distribute PET to deeper cells
1612  if (this%ietflag > 0) then
1613  if (this%uzfobj%ivertcon(i) > 0) then
1614  call this%uzfobj%setbelowpet(i, ivertflag)
1615  end if
1616  end if
1617  !
1618  ! -- store derivative for Newton addition to equations in _fn()
1619  this%deriv(i) = uzderiv + derivgwet
1620  !
1621  ! -- save current rejected infiltration, groundwater recharge, and
1622  ! groundwater discharge
1623  this%rejinf(i) = this%uzfobj%finf_rej(i) * this%uzfobj%uzfarea(i)
1624  this%rch(i) = this%uzfobj%totflux(i) * this%uzfobj%uzfarea(i) / delt
1625  this%gwd(i) = this%uzfobj%surfseep(i)
1626  !
1627  ! -- add to hcof and rhs
1628  this%hcof(i) = thcof1 + thcof2
1629  this%rhs(i) = -trhs1 + trhs2
1630  !
1631  ! -- add spring discharge and rejected infiltration to mover
1632  if (this%imover == 1) then
1633  qformvr = this%gwd(i) + this%rejinf(i)
1634  call this%pakmvrobj%accumulate_qformvr(i, qformvr)
1635  end if
1636  !
1637  ! -- Store water content
1638  this%wcnew(i) = wc
1639  !
1640  ! -- Calculate change in mobile storage
1641  this%qsto(i) = get_storage_change(this%uzfobj%celtop(i), &
1642  this%uzfobj%celbot(i), &
1643  this%uzfobj%uzfarea(i), &
1644  watabold, &
1645  this%uzfobj%watab(i), &
1646  this%wcold(i), this%wcnew(i), &
1647  this%uzfobj%thtr(i), delt, this%issflag)
1648  !
1649  end if
1650  end do
Here is the call graph for this function:

◆ uzf_source_dimensions()

subroutine uzfmodule::uzf_source_dimensions ( class(uzftype), intent(inout)  this)

Overrides BndExtTypesource_dimensions

Definition at line 558 of file gwf-uzf.f90.

559  ! -- modules
561  ! -- dummy
562  class(UzfType), intent(inout) :: this
563  ! -- local
564  type(GwfUzfParamFoundType) :: found
565  !
566  ! -- initialize dimensions
567  this%nodes = -1
568  this%ntrail_pvar = 0
569  this%nsets = 0
570  !
571  write (this%iout, '(/1x,a)') &
572  'PROCESSING '//trim(adjustl(this%text))//' DIMENSIONS'
573  !
574  ! -- NUZFCELLS (mf6internal: maxbound)
575  call mem_set_value(this%nodes, 'MAXBOUND', this%input_mempath, &
576  found%maxbound)
577  if (found%maxbound) then
578  write (this%iout, '(4x,a,i0)') 'NUZFCELLS = ', this%nodes
579  end if
580  !
581  ! -- NTRAILWAVES
582  call mem_set_value(this%ntrail_pvar, 'NTRAILWAVES', this%input_mempath, &
583  found%ntrailwaves)
584  if (found%ntrailwaves) then
585  write (this%iout, '(4x,a,i0)') 'NTRAILWAVES = ', this%ntrail_pvar
586  end if
587  !
588  ! -- NWAVESETS
589  call mem_set_value(this%nsets, 'NWAVESETS', this%input_mempath, &
590  found%nwavesets)
591  if (found%nwavesets) then
592  write (this%iout, '(4x,a,i0)') 'NTRAILSETS = ', this%nsets
593  end if
594  !
595  write (this%iout, '(1x,a)') &
596  'END OF '//trim(adjustl(this%text))//' DIMENSIONS'
597  !
598  ! -- increment maxbound
599  this%maxbound = this%maxbound + this%nodes
600  this%nbound = this%maxbound
601  !
602  ! -- verify dimensions were set
603  if (this%nodes <= 0) then
604  write (errmsg, '(a)') &
605  'NUZFCELLS (MAXBOUND) was not specified or was specified incorrectly.'
606  call store_error(errmsg)
607  end if
608  if (this%ntrail_pvar <= 1) then
609  write (errmsg, '(a)') &
610  'NTRAILWAVES must be greater than 1. A value of 7 is recommended.'
611  call store_error(errmsg)
612  end if
613  if (this%nsets <= 0) then
614  write (errmsg, '(a)') &
615  'NWAVESETS was not specified or was specified incorrectly.'
616  call store_error(errmsg)
617  end if
618  if (count_errors() > 0) then
619  call store_error_filename(this%input_fname)
620  end if
621  !
622  ! -- set the number of waves
623  this%nwav_pvar = this%ntrail_pvar * this%nsets
624  !
625  ! -- Call define_listlabel to construct the list label that is written
626  ! when PRINT_INPUT option is used.
627  call this%define_listlabel()
628  !
629  ! -- Allocate arrays in package superclass
630  call this%uzf_allocate_arrays()
631  !
632  ! -- alias deprecated variable names
633  call this%uzf_checkin_deprecated_names()
634  !
635  ! -- initialize uzf group object
636  allocate (this%uzfobj)
637  call this%uzfobj%init(this%nodes, this%nwav_pvar, this%memoryPath)
638  !
639  !-- Read uzf cell properties
640  call this%uzf_source_packagedata()
641  !
642  ! -- print cell data
643  if (this%iprpak /= 0) then
644  call this%print_cell_properties()
645  end if
646  !
647  ! -- setup the budget object
648  call this%uzf_setup_budobj()
Here is the call graph for this function:

◆ uzf_source_options()

subroutine uzfmodule::uzf_source_options ( class(uzftype), intent(inout)  this)

Overrides BndExtTypesource_options

Definition at line 407 of file gwf-uzf.f90.

408  ! -- modules
409  use openspecmodule, only: access, form
410  use simmodule, only: deprecation_warning
411  ! -- dummy
412  class(UzfType), intent(inout) :: this
413  ! -- local
414  type(GwfUzfParamFoundType) :: found
415  integer(I4B), pointer :: ikw => null()
416  character(len=LINELENGTH) :: fname
417  ! -- formats
418  character(len=*), parameter :: fmtet = &
419  "(4x, 'ET WILL BE SIMULATED WITHIN UZ AND GW ZONES, WITH LINEAR ', &
420  &'GWET IF OPTION NOT SPECIFIED OTHERWISE.')"
421  character(len=*), parameter :: fmtgwetlin = &
422  &"(4x, 'GROUNDWATER ET FUNCTION WILL BE LINEAR.')"
423  character(len=*), parameter :: fmtgwetsquare = &
424  &"(4x, 'GROUNDWATER ET FUNCTION WILL BE SQUARE WITH SMOOTHING.')"
425  character(len=*), parameter :: fmtgwseepout = &
426  &"(4x, 'GROUNDWATER DISCHARGE TO LAND SURFACE WILL BE SIMULATED.')"
427  character(len=*), parameter :: fmtuzetwc = &
428  &"(4x, 'UNSATURATED ET FUNCTION OF WATER CONTENT.')"
429  character(len=*), parameter :: fmtuzetae = &
430  &"(4x, 'UNSATURATED ET FUNCTION OF AIR ENTRY PRESSURE.')"
431  character(len=*), parameter :: fmtuzfbin = &
432  "(4x, 'UZF ', 1x, a, 1x, ' WILL BE SAVED TO FILE: ', &
433  &a, /4x, 'OPENED ON UNIT: ', I0)"
434  !
435  ! -- call base class to handle AUXILIARY/NAUX, BOUNDNAMES, PRINT_INPUT,
436  ! PRINT_FLOWS, SAVE_FLOWS, OBS6_FILENAME, AUXMULTNAME
437  call this%BndExtType%source_options()
438  !
439  write (this%iout, '(1x,a)') &
440  'PROCESSING '//trim(adjustl(this%text))//' OPTIONS'
441  !
442  ! -- WATER_CONTENT FILEOUT
443  call mem_set_value(fname, 'WCFILE', this%input_mempath, found%wcfile)
444  if (found%wcfile) then
445  this%iwcontout = getunit()
446  call openfile(this%iwcontout, this%iout, fname, 'DATA(BINARY)', &
447  form, access, 'REPLACE', mode_opt=mnormal)
448  write (this%iout, fmtuzfbin) 'WATER-CONTENT', trim(adjustl(fname)), &
449  this%iwcontout
450  end if
451  !
452  ! -- BUDGET FILEOUT
453  call mem_set_value(fname, 'BUDGETFILE', this%input_mempath, found%budgetfile)
454  if (found%budgetfile) then
455  call assign_iounit(this%ibudgetout, this%inunit, "BUDGET fileout")
456  call openfile(this%ibudgetout, this%iout, fname, 'DATA(BINARY)', &
457  form, access, 'REPLACE', mode_opt=mnormal)
458  write (this%iout, fmtuzfbin) 'BUDGET', trim(adjustl(fname)), &
459  this%ibudgetout
460  end if
461  !
462  ! -- BUDGETCSV FILEOUT
463  call mem_set_value(fname, 'BUDGETCSVFILE', this%input_mempath, &
464  found%budgetcsvfile)
465  if (found%budgetcsvfile) then
466  call assign_iounit(this%ibudcsv, this%inunit, "BUDGETCSV fileout")
467  call openfile(this%ibudcsv, this%iout, fname, 'CSV', filstat_opt='REPLACE')
468  write (this%iout, fmtuzfbin) 'BUDGET CSV', trim(adjustl(fname)), &
469  this%ibudcsv
470  end if
471  !
472  ! -- PACKAGE_CONVERGENCE FILEOUT
473  call mem_set_value(fname, 'PKGCONVFNAME', &
474  this%input_mempath, found%pkgconvfname)
475  if (found%pkgconvfname) then
476  this%ipakcsv = getunit()
477  call openfile(this%ipakcsv, this%iout, fname, 'CSV', &
478  filstat_opt='REPLACE', mode_opt=mnormal)
479  write (this%iout, fmtuzfbin) 'PACKAGE_CONVERGENCE', &
480  trim(adjustl(fname)), this%ipakcsv
481  end if
482  allocate (ikw)
483  !
484  ! -- SIMULATE_ET
485  call mem_set_value(ikw, 'SIMULATE_ET', this%input_mempath, found%simulate_et)
486  if (found%simulate_et) then
487  this%ietflag = 1
488  this%igwetflag = 0
489  write (this%iout, fmtet)
490  end if
491  !
492  ! -- LINEAR_GWET
493  call mem_set_value(ikw, 'LINEAR_GWET', this%input_mempath, found%linear_gwet)
494  if (found%linear_gwet) then
495  this%igwetflag = 1
496  write (this%iout, fmtgwetlin)
497  end if
498  !
499  ! -- SQUARE_GWET
500  call mem_set_value(ikw, 'SQUARE_GWET', this%input_mempath, found%square_gwet)
501  if (found%square_gwet) then
502  this%igwetflag = 2
503  write (this%iout, fmtgwetsquare)
504  end if
505  !
506  ! -- SIMULATE_GWSEEP (deprecated)
507  call mem_set_value(ikw, 'SIMULATE_GWSEEP', this%input_mempath, &
508  found%simulate_gwseep)
509  if (found%simulate_gwseep) then
510  this%iseepflag = 1
511  write (this%iout, fmtgwseepout)
512  write (warnmsg, '(a)') &
513  'USE DRN PACKAGE TO SIMULATE GROUNDWATER DISCHARGE TO LAND SURFACE '// &
514  'INSTEAD'
515  call deprecation_warning('OPTIONS', 'SIMULATE_GWSEEP', '6.5.0', &
516  warnmsg, this%inunit)
517  end if
518  !
519  ! -- UNSAT_ETWC
520  call mem_set_value(ikw, 'UNSAT_ETWC', this%input_mempath, found%unsat_etwc)
521  if (found%unsat_etwc) then
522  this%ietflag = 1
523  write (this%iout, fmtuzetwc)
524  end if
525  !
526  ! -- UNSAT_ETAE
527  call mem_set_value(ikw, 'UNSAT_ETAE', this%input_mempath, found%unsat_etae)
528  if (found%unsat_etae) then
529  this%ietflag = 2
530  write (this%iout, fmtuzetae)
531  end if
532  !
533  ! -- MOVER
534  call mem_set_value(ikw, 'MOVER', this%input_mempath, found%mover)
535  if (found%mover) then
536  this%imover = 1
537  end if
538  !
539  ! -- DEV_NO_FINAL_CHECK (mf6internal: iconvchk)
540  call mem_set_value(ikw, 'ICONVCHK', this%input_mempath, found%iconvchk)
541  if (found%iconvchk) then
542  this%iconvchk = 0
543  write (this%iout, '(4x,a)') &
544  'A FINAL CONVERGENCE CHECK OF THE CHANGE IN UZF RECHARGE '// &
545  'WILL NOT BE MADE'
546  end if
547  !
548  deallocate (ikw)
549  !
550  write (this%iout, '(1x,a)') &
551  'END OF '//trim(adjustl(this%text))//' OPTIONS'
character(len=20) access
Definition: OpenSpec.f90:7
character(len=20) form
Definition: OpenSpec.f90:7
subroutine, public deprecation_warning(cblock, cvar, cver, endmsg, iunit)
Store deprecation warning message.
Definition: Sim.f90:257
Here is the call graph for this function:

◆ uzf_source_packagedata()

subroutine uzfmodule::uzf_source_packagedata ( class(uzftype), intent(inout)  this)
private

Definition at line 1705 of file gwf-uzf.f90.

1706  ! -- modules
1708  ! -- dummy
1709  class(UzfType), intent(inout) :: this
1710  ! -- local
1711  integer(I4B), dimension(:), pointer, contiguous :: ifno => null()
1712  integer(I4B), dimension(:, :), pointer, contiguous :: cellid_idm => null()
1713  integer(I4B), dimension(:), pointer, contiguous :: landflag => null()
1714  integer(I4B), dimension(:), pointer, contiguous :: ivertcon => null()
1715  real(DP), dimension(:), pointer, contiguous :: surfdep => null()
1716  real(DP), dimension(:), pointer, contiguous :: vks => null()
1717  real(DP), dimension(:), pointer, contiguous :: thtr => null()
1718  real(DP), dimension(:), pointer, contiguous :: thts => null()
1719  real(DP), dimension(:), pointer, contiguous :: thti => null()
1720  real(DP), dimension(:), pointer, contiguous :: eps => null()
1721  type(CharacterStringType), dimension(:), pointer, contiguous :: &
1722  bndname => null()
1723  character(len=LINELENGTH) :: cellid_str
1724  integer(I4B) :: ierr
1725  integer(I4B) :: i, igwf, n
1726  integer(I4B) :: j, jcol
1727  integer(I4B), dimension(:), allocatable :: rowmaxnnz
1728  type(sparsematrix) :: sparse
1729  integer(I4B), dimension(:), allocatable :: nboundchk
1730  !
1731  write (this%iout, '(/1x,3a)') 'PROCESSING ', trim(adjustl(this%text)), &
1732  ' PACKAGEDATA'
1733  !
1734  ! -- get PACKAGEDATA arrays
1735  call mem_setptr(ifno, 'PACKAGEDATA_IFNO', this%input_mempath)
1736  call mem_setptr(cellid_idm, 'CELLID', this%input_mempath)
1737  call mem_setptr(landflag, 'LANDFLAG', this%input_mempath)
1738  call mem_setptr(ivertcon, 'IVERTCON', this%input_mempath)
1739  call mem_setptr(surfdep, 'SURFDEP', this%input_mempath)
1740  call mem_setptr(vks, 'VKS', this%input_mempath)
1741  call mem_setptr(thtr, 'THTR', this%input_mempath)
1742  call mem_setptr(thts, 'THTS', this%input_mempath)
1743  call mem_setptr(thti, 'THTI', this%input_mempath)
1744  call mem_setptr(eps, 'EPS', this%input_mempath)
1745  if (this%inamedbound /= 0) then
1746  call mem_setptr(bndname, 'BOUNDNAME', this%input_mempath)
1747  end if
1748  !
1749  ! -- allocate local check arrays
1750  allocate (rowmaxnnz(this%dis%nodes))
1751  do n = 1, this%dis%nodes
1752  rowmaxnnz(n) = 0
1753  end do
1754  allocate (nboundchk(this%nodes))
1755  do n = 1, this%nodes
1756  nboundchk(n) = 0
1757  end do
1758  !
1759  ! -- loop over packagedata entries
1760  do n = 1, this%nodes
1761  i = this%validate_ifno(ifno(n), this%nodes, nboundchk, &
1762  'IUZNO', 'PACKAGEDATA')
1763  if (i == 0) cycle
1764  !
1765  ! -- convert CELLID to node number
1766  write (cellid_str, '(10(i0,1x))') cellid_idm(1:this%dis%ndim, n)
1767  igwf = this%dis%noder_from_cellid(cellid_str, this%inunit, this%iout)
1768  this%igwfnode(i) = igwf
1769  rowmaxnnz(igwf) = rowmaxnnz(igwf) + 1
1770  !
1771  ! -- validate landflag
1772  if (landflag(n) < 0 .OR. landflag(n) > 1) then
1773  write (errmsg, '(a,1x,i0,1x,a,1x,i0,a)') &
1774  'LANDFLAG for uzf cell', i, &
1775  'must be 0 or 1 (specified value is', landflag(n), ').'
1776  call store_error(errmsg)
1777  end if
1778  !
1779  ! -- validate ivertcon
1780  if (ivertcon(n) < 0 .OR. ivertcon(n) > this%nodes) then
1781  write (errmsg, '(a,1x,i0,1x,a,1x,i0,a)') &
1782  'IVERTCON for uzf cell', i, &
1783  'must be 0 or less than NUZFCELLS (specified value is', &
1784  ivertcon(n), ').'
1785  call store_error(errmsg)
1786  end if
1787  !
1788  ! -- validate surfdep
1789  if (surfdep(n) <= dzero .and. landflag(n) > 0) then
1790  write (errmsg, '(a,1x,i0,1x,a,1x,g0,a)') &
1791  'SURFDEP for uzf cell', i, &
1792  'must be greater than 0 (specified value is', surfdep(n), ').'
1793  call store_error(errmsg)
1794  end if
1795  if (surfdep(n) >= this%dis%top(igwf) - this%dis%bot(igwf)) then
1796  write (errmsg, '(a,1x,i0,1x,a)') &
1797  'SURFDEP for uzf cell', i, &
1798  'cannot be greater than the cell thickness.'
1799  call store_error(errmsg)
1800  end if
1801  !
1802  ! -- validate vks
1803  if (vks(n) <= dzero) then
1804  write (errmsg, '(a,1x,i0,1x,a,1x,g0,a)') &
1805  'VKS for uzf cell', i, &
1806  'must be greater than 0 (specified value ia', vks(n), ').'
1807  call store_error(errmsg)
1808  end if
1809  !
1810  ! -- validate thtr
1811  if (thtr(n) <= dzero) then
1812  write (errmsg, '(a,1x,i0,1x,a,1x,g0,a)') &
1813  'THTR for uzf cell', i, &
1814  'must be greater than 0 (specified value is', thtr(n), ').'
1815  call store_error(errmsg)
1816  end if
1817  !
1818  ! -- validate thts
1819  if (thts(n) <= thtr(n)) then
1820  write (errmsg, '(a,1x,i0,1x,a,1x,g0,a)') &
1821  'THTS for uzf cell', i, &
1822  'must be greater than THTR (specified value is', thts(n), ').'
1823  call store_error(errmsg)
1824  end if
1825  !
1826  ! -- validate thti
1827  if (thti(n) < thtr(n) .OR. thti(n) > thts(n)) then
1828  write (errmsg, '(a,1x,i0,1x,a,1x,a,1x,g0,a)') &
1829  'THTI for uzf cell', i, &
1830  'must be greater than or equal to THTR AND less than THTS', &
1831  '(specified value is', thti(n), ').'
1832  call store_error(errmsg)
1833  end if
1834  !
1835  ! -- validate eps
1836  if (eps(n) < 3.5 .OR. eps(n) > 14) then
1837  write (errmsg, '(a,1x,i0,1x,a,1x,g0,a)') &
1838  'EPSILON for uzf cell', i, &
1839  'must be between 3.5 and 14.0 (specified value is', eps(n), ').'
1840  call store_error(errmsg)
1841  end if
1842  !
1843  ! -- boundname
1844  if (this%inamedbound == 1) then
1845  this%uzfname(i) = bndname(n)
1846  end if
1847  !
1848  ! -- set data if no errors
1849  if (count_errors() == 0) then
1850  call this%uzfobj%setdata(i, this%dis%area(igwf), &
1851  this%dis%top(igwf), this%dis%bot(igwf), &
1852  surfdep(n), vks(n), thtr(n), thts(n), &
1853  thti(n), eps(n), this%ntrail_pvar, &
1854  landflag(n), ivertcon(n))
1855  if (ivertcon(n) > 0) then
1856  this%iuzf2uzf = 1
1857  end if
1858  end if
1859  end do
1860  write (this%iout, '(1x,3a)') &
1861  'END OF ', trim(adjustl(this%text)), ' PACKAGEDATA'
1862  !
1863  ! -- check for duplicate or missing uzf cells
1864  call this%report_ifno_coverage(nboundchk, this%nodes, 'uzf cell', &
1865  'PACKAGEDATA')
1866  if (count_errors() > 0) then
1867  call store_error_filename(this%input_fname)
1868  end if
1869  !
1870  ! -- setup sparse for connectivity used to identify multiple uzf cells
1871  ! per GWF model cell
1872  call sparse%init(this%dis%nodes, this%dis%nodes, rowmaxnnz)
1873  do i = 1, this%nodes
1874  igwf = this%igwfnode(i)
1875  call sparse%addconnection(igwf, i, 1)
1876  end do
1877  !
1878  ! -- create ia and ja from sparse
1879  call sparse%filliaja(this%ia, this%ja, ierr)
1880  !
1881  ! -- set imaxcellcnt
1882  do i = 1, this%dis%nodes
1883  jcol = 0
1884  do j = this%ia(i), this%ia(i + 1) - 1
1885  jcol = jcol + 1
1886  end do
1887  if (jcol > this%imaxcellcnt) then
1888  this%imaxcellcnt = jcol
1889  end if
1890  end do
1891  !
1892  if (this%imaxcellcnt > 1 .and. this%iauxmultcol < 1) then
1893  call this%check_cell_area()
1894  end if
1895  !
1896  deallocate (rowmaxnnz)
1897  deallocate (nboundchk)
1898  !
1899  ! -- release input context packagedata memory
1900  call memorystore_release('PACKAGEDATA_IFNO', this%input_mempath)
1901  call memorystore_release('CELLID', this%input_mempath)
1902  call memorystore_release('LANDFLAG', this%input_mempath)
1903  call memorystore_release('IVERTCON', this%input_mempath)
1904  call memorystore_release('SURFDEP', this%input_mempath)
1905  call memorystore_release('VKS', this%input_mempath)
1906  call memorystore_release('THTR', this%input_mempath)
1907  call memorystore_release('THTS', this%input_mempath)
1908  call memorystore_release('THTI', this%input_mempath)
1909  call memorystore_release('EPS', this%input_mempath)
1910  call memorystore_release('BOUNDNAME', this%input_mempath)
Here is the call graph for this function:

Variable Documentation

◆ ftype

character(len=lenftype) uzfmodule::ftype = 'UZF'

Definition at line 37 of file gwf-uzf.f90.

37  character(len=LENFTYPE) :: ftype = 'UZF'

◆ text

character(len=lenpackagename) uzfmodule::text = ' UZF CELLS'

Definition at line 38 of file gwf-uzf.f90.

38  character(len=LENPACKAGENAME) :: text = ' UZF CELLS'