MODFLOW 6  version 6.9.0.dev0
USGS Modular Hydrologic Model
gwf-uzf.f90
Go to the documentation of this file.
1 ! -- Uzf module
2 module uzfmodule
3 
4  use kindmodule, only: dp, i4b
5  use constantsmodule, only: dzero, dem6, dem4, dem2, dem1, dhalf, &
10  dhnoflo, dhdry, &
17  use sparsemodule, only: sparsematrix
18  use bndmodule, only: bndtype
19  use bndextmodule, only: bndexttype
23  use basedismodule, only: disbasetype
24  use observemodule, only: observetype
25  use obsmodule, only: obstype
30  use tablemodule, only: tabletype, table_cr
31  use uzfetutilmodule
34 
35  implicit none
36 
37  character(len=LENFTYPE) :: ftype = 'UZF'
38  character(len=LENPACKAGENAME) :: text = ' UZF CELLS'
39 
40  private
41  public :: uzf_create
42  public :: uzftype
43 
44  type, extends(bndexttype) :: uzftype
45  ! output integers
46  integer(I4B), pointer :: iprwcont => null()
47  integer(I4B), pointer :: iwcontout => null()
48  integer(I4B), pointer :: ibudgetout => null()
49  integer(I4B), pointer :: ibudcsv => null() !< unit number for csv budget output file
50  integer(I4B), pointer :: ipakcsv => null()
51  !
52  type(budgetobjecttype), pointer :: budobj => null()
53  integer(I4B), pointer :: bditems => null() !< number of budget items
54  integer(I4B), pointer :: nbdtxt => null() !< number of budget text items
55  character(len=LENBUDTXT), dimension(:), pointer, &
56  contiguous :: bdtxt => null() !< budget items written to cbc file
57  character(len=LENBOUNDNAME), dimension(:), pointer, &
58  contiguous :: uzfname => null()
59  !
60  ! -- uzf table objects
61  type(tabletype), pointer :: pakcsvtab => null()
62  !
63  ! -- uzf kinematic object
64  type(uzfcellgrouptype), pointer :: uzfobj => null()
65  !
66  ! -- pointer to gwf variables
67  integer(I4B), pointer :: gwfiss => null()
68  real(dp), dimension(:), pointer, contiguous :: gwfhcond => null()
69  !
70  ! -- uzf data
71  integer(I4B), pointer :: nwav_pvar => null()
72  integer(I4B), pointer :: ntrail_pvar => null()
73  integer(I4B), pointer :: nsets => null()
74  integer(I4B), pointer :: nodes => null()
75  integer(I4B), pointer :: readflag => null()
76  integer(I4B), pointer :: ietflag => null() !< et flag, 0 is off, 1 or 2 are different types
77  integer(I4B), pointer :: igwetflag => null()
78  integer(I4B), pointer :: iseepflag => null()
79  integer(I4B), pointer :: imaxcellcnt => null()
80  integer(I4B), pointer :: iuzf2uzf => null()
81  ! -- integer vectors
82  integer(I4B), dimension(:), pointer, contiguous :: igwfnode => null()
83  integer(I4B), dimension(:), pointer, contiguous :: ia => null()
84  integer(I4B), dimension(:), pointer, contiguous :: ja => null()
85  ! -- double precision output vectors
86  real(dp), dimension(:), pointer, contiguous :: appliedinf => null()
87  real(dp), dimension(:), pointer, contiguous :: rejinf => null()
88  real(dp), dimension(:), pointer, contiguous :: rejinf0 => null()
89  real(dp), dimension(:), pointer, contiguous :: rejinftomvr => null()
90  real(dp), dimension(:), pointer, contiguous :: infiltration => null()
91  real(dp), dimension(:), pointer, contiguous :: gwet_pvar => null()
92  real(dp), dimension(:), pointer, contiguous :: uzet => null()
93  real(dp), dimension(:), pointer, contiguous :: gwd => null()
94  real(dp), dimension(:), pointer, contiguous :: gwd0 => null()
95  real(dp), dimension(:), pointer, contiguous :: gwdtomvr => null()
96  real(dp), dimension(:), pointer, contiguous :: rch => null()
97  real(dp), dimension(:), pointer, contiguous :: rch0 => null()
98  real(dp), dimension(:), pointer, contiguous :: qsto => null() !< change in stored mobile water per time for this time step
99  real(dp), dimension(:), pointer, contiguous :: wcnew => null() !< water content for this time step
100  real(dp), dimension(:), pointer, contiguous :: wcold => null() !< water content for previous time step
101  !
102  ! -- timeseries aware package variables; these variables with
103  ! _pvar have uzfobj counterparts
104  real(dp), dimension(:), pointer, contiguous :: sinf_pvar => null()
105  real(dp), dimension(:), pointer, contiguous :: pet_pvar => null()
106  real(dp), dimension(:), pointer, contiguous :: extdp => null()
107  real(dp), dimension(:), pointer, contiguous :: extwc_pvar => null()
108  real(dp), dimension(:), pointer, contiguous :: ha_pvar => null()
109  real(dp), dimension(:), pointer, contiguous :: hroot_pvar => null()
110  real(dp), dimension(:), pointer, contiguous :: rootact_pvar => null()
111  !
112  ! -- aux variable
113  real(dp), dimension(:, :), pointer, contiguous :: uauxvar => null()
114  !
115  ! -- convergence check
116  integer(I4B), pointer :: iconvchk => null()
117  !
118  ! formulate variables
119  real(dp), dimension(:), pointer, contiguous :: deriv => null()
120  !
121  ! budget variables
122  real(dp), pointer :: totfluxtot => null()
123  integer(I4B), pointer :: issflag => null()
124  integer(I4B), pointer :: issflagold => null()
125  integer(I4B), pointer :: istocb => null()
126  !
127  ! -- uzf cbc budget items
128  integer(I4B), pointer :: cbcauxitems => null()
129  character(len=16), dimension(:), pointer, contiguous :: cauxcbc => null()
130  real(dp), dimension(:), pointer, contiguous :: qauxcbc => null()
131 
132  contains
133 
134  procedure :: uzf_allocate_arrays
135  procedure :: uzf_allocate_scalars
136  procedure :: source_options => uzf_source_options
137  procedure :: source_dimensions => uzf_source_dimensions
138  procedure :: bnd_ar => uzf_ar
139  procedure :: bnd_rp => uzf_rp
140  procedure :: bnd_ad => uzf_ad
141  procedure :: bnd_cf => uzf_cf
142  procedure :: bnd_cc => uzf_cc
143  procedure :: bnd_cq => uzf_cq
144  procedure :: bnd_bd => uzf_bd
145  procedure :: bnd_ot_model_flows => uzf_ot_model_flows
146  procedure :: bnd_ot_package_flows => uzf_ot_package_flows
147  procedure :: bnd_ot_dv => uzf_ot_dv
148  procedure :: bnd_ot_bdsummary => uzf_ot_bdsummary
149  procedure :: bnd_fc => uzf_fc
150  procedure :: bnd_fn => uzf_fn
151  procedure :: bnd_da => uzf_da
152  procedure :: define_listlabel
153  !
154  ! -- methods for observations
155  procedure, public :: bnd_obs_supported => uzf_obs_supported
156  procedure, public :: bnd_df_obs => uzf_df_obs
157  procedure, public :: bnd_rp_obs => uzf_rp_obs
158  procedure, public :: bnd_bd_obs => uzf_bd_obs
159  !
160  ! -- methods specific for uzf
161  procedure, private :: uzf_solve
162  procedure, private :: uzf_source_packagedata
163  procedure, private :: print_cell_properties
164  procedure, private :: findcellabove
165  procedure, private :: check_cell_area
166  !
167  ! -- budget
168  procedure, private :: uzf_setup_budobj
169  procedure, private :: uzf_fill_budobj
170 
171  end type uzftype
172 
173 contains
174 
175  !> @brief Create a New UZF Package and point packobj to the new package
176  !<
177  subroutine uzf_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, &
178  mempath)
179  ! -- modules
181  ! -- dummy
182  class(bndtype), pointer :: packobj
183  integer(I4B), intent(in) :: id
184  integer(I4B), intent(in) :: ibcnum
185  integer(I4B), intent(in) :: inunit
186  integer(I4B), intent(in) :: iout
187  character(len=*), intent(in) :: namemodel
188  character(len=*), intent(in) :: pakname
189  character(len=*), intent(in) :: mempath
190  ! -- local
191  type(uzftype), pointer :: uzfobj
192  !
193  ! -- allocate the object and assign values to object variables
194  allocate (uzfobj)
195  packobj => uzfobj
196  !
197  ! -- create name and memory path
198  call packobj%set_names(ibcnum, namemodel, pakname, ftype, mempath)
199  packobj%text = text
200  !
201  ! -- allocate scalars
202  call uzfobj%uzf_allocate_scalars()
203  !
204  ! -- initialize package
205  call packobj%pack_initialize()
206  !
207  packobj%inunit = inunit
208  packobj%iout = iout
209  packobj%id = id
210  packobj%ibcnum = ibcnum
211  packobj%ncolbnd = 1
212  packobj%iscloc = 0 ! not supported
213  packobj%isadvpak = 1
214  packobj%ictMemPath = create_mem_path(namemodel, 'NPF')
215  end subroutine uzf_create
216 
217  !> @brief Allocate and Read
218  !<
219  subroutine uzf_ar(this)
220  ! -- modules
222  ! -- dummy
223  class(uzftype), intent(inout) :: this
224  ! -- local
225  integer(I4B) :: n, i
226  real(DP) :: hgwf
227  !
228  call this%obs%obs_ar()
229  !
230  ! -- call standard BndExtType allocate scalars
231  call this%BndExtType%allocate_arrays()
232  !
233  ! -- set pointers now that data is available
234  call mem_setptr(this%gwfhcond, 'CONDSAT', create_mem_path(this%name_model, &
235  'NPF'))
236  call mem_setptr(this%gwfiss, 'ISS', create_mem_path(this%name_model))
237  !
238  ! -- set boundname for each connection
239  if (this%inamedbound /= 0) then
240  do n = 1, this%nodes
241  this%boundname(n) = this%uzfname(n)
242  end do
243  end if
244  !
245  ! -- copy boundname into boundname_cst
246  call this%copy_boundname()
247  !
248  ! -- copy igwfnode into nodelist and set water table
249  do i = 1, this%nodes
250  this%nodelist(i) = this%igwfnode(i)
251  n = this%igwfnode(i)
252  hgwf = this%xnew(n)
253  call this%uzfobj%sethead(i, hgwf)
254  end do
255  !
256  ! -- setup pakmvrobj
257  if (this%imover /= 0) then
258  allocate (this%pakmvrobj)
259  call this%pakmvrobj%ar(this%maxbound, this%maxbound, this%memoryPath)
260  end if
261  end subroutine uzf_ar
262 
263  !> @brief Allocate arrays used for uzf
264  !<
265  subroutine uzf_allocate_arrays(this)
266  ! -- dummy
267  class(uzftype), intent(inout) :: this
268  ! -- local
269  integer(I4B) :: i
270  integer(I4B) :: j
271  !
272  ! -- call standard BndType allocate scalars (now done from AR)
273  !call this%BndType%allocate_arrays()
274  !
275  ! -- allocate uzf specific arrays
276  call mem_allocate(this%igwfnode, this%nodes, 'IGWFNODE', this%memoryPath)
277  call mem_allocate(this%appliedinf, this%nodes, 'APPLIEDINF', this%memoryPath)
278  call mem_allocate(this%rejinf, this%nodes, 'REJINF', this%memoryPath)
279  call mem_allocate(this%rejinf0, this%nodes, 'REJINF0', this%memoryPath)
280  call mem_allocate(this%rejinftomvr, this%nodes, 'REJINFTOMVR', &
281  this%memoryPath)
282  call mem_allocate(this%infiltration, this%nodes, 'INFILTRATION', &
283  this%memoryPath)
284  call mem_allocate(this%gwet_pvar, this%nodes, 'GWET_PVAR', this%memoryPath)
285  call mem_allocate(this%uzet, this%nodes, 'UZET', this%memoryPath)
286  call mem_allocate(this%gwd, this%nodes, 'GWD', this%memoryPath)
287  call mem_allocate(this%gwd0, this%nodes, 'GWD0', this%memoryPath)
288  call mem_allocate(this%gwdtomvr, this%nodes, 'GWDTOMVR', this%memoryPath)
289  call mem_allocate(this%rch, this%nodes, 'RCH', this%memoryPath)
290  call mem_allocate(this%rch0, this%nodes, 'RCH0', this%memoryPath)
291  call mem_allocate(this%qsto, this%nodes, 'QSTO', this%memoryPath)
292  call mem_allocate(this%deriv, this%nodes, 'DERIV', this%memoryPath)
293  !
294  ! -- integer vectors
295  call mem_allocate(this%ia, this%dis%nodes + 1, 'IA', this%memoryPath)
296  call mem_allocate(this%ja, this%nodes, 'JA', this%memoryPath)
297  !
298  ! -- input context pointers
299  call mem_setptr(this%sinf_pvar, 'FINF', this%input_mempath)
300  call mem_setptr(this%pet_pvar, 'PET', this%input_mempath)
301  call mem_setptr(this%extdp, 'EXTDP', this%input_mempath)
302  call mem_setptr(this%extwc_pvar, 'EXTWC', this%input_mempath)
303  call mem_setptr(this%ha_pvar, 'HA', this%input_mempath)
304  call mem_setptr(this%hroot_pvar, 'HROOT', this%input_mempath)
305  call mem_setptr(this%rootact_pvar, 'ROOTACT', this%input_mempath)
306  call mem_setptr(this%uauxvar, 'AUXVAR', this%input_mempath)
307  !
308  ! -- initialize
309  do i = 1, this%nodes
310  this%appliedinf(i) = dzero
311  this%rejinf(i) = dzero
312  this%rejinf0(i) = dzero
313  this%rejinftomvr(i) = dzero
314  this%gwet_pvar(i) = dzero
315  this%uzet(i) = dzero
316  this%gwd(i) = dzero
317  this%gwd0(i) = dzero
318  this%gwdtomvr(i) = dzero
319  this%rch(i) = dzero
320  this%rch0(i) = dzero
321  this%qsto(i) = dzero
322  this%deriv(i) = dzero
323  ! -- integer variables
324  this%ja(i) = 0
325  ! -- sinf_pvar/pet_pvar/extdp/extwc_pvar/ha_pvar/hroot_pvar/
326  ! -- rootact_pvar are input context pointers
327  do j = 1, this%naux
328  if (this%iauxmultcol > 0 .and. j == this%iauxmultcol) then
329  this%uauxvar(j, i) = done
330  else
331  this%uauxvar(j, i) = dzero
332  end if
333  end do
334  end do
335  do i = 1, this%dis%nodes + 1
336  this%ia(i) = 0
337  end do
338  !
339  ! -- allocate and initialize character array for budget text
340  allocate (this%bdtxt(this%nbdtxt))
341  this%bdtxt(1) = ' UZF-INF'
342  this%bdtxt(2) = ' UZF-GWRCH'
343  this%bdtxt(3) = ' UZF-GWD'
344  this%bdtxt(4) = ' UZF-GWET'
345  this%bdtxt(5) = ' UZF-GWD TO-MVR'
346  !
347  ! -- allocate and initialize watercontent arrays
348  call mem_allocate(this%wcnew, this%nodes, 'WCNEW', this%memoryPath)
349  call mem_allocate(this%wcold, this%nodes, 'WCOLD', this%memoryPath)
350  do i = 1, this%nodes
351  this%wcnew(i) = dzero
352  this%wcold(i) = dzero
353  end do
354  !
355  ! -- allocate character array for aux budget text
356  allocate (this%cauxcbc(this%cbcauxitems))
357  allocate (this%uzfname(this%nodes))
358  !
359  ! -- allocate and initialize qauxcbc
360  call mem_allocate(this%qauxcbc, this%cbcauxitems, 'QAUXCBC', this%memoryPath)
361  do i = 1, this%cbcauxitems
362  this%qauxcbc(i) = dzero
363  end do
364  end subroutine uzf_allocate_arrays
365 
366  !> @brief Source OPTIONS block from input context
367  !!
368  !! Overrides BndExtType%source_options
369  !<
370  subroutine uzf_source_options(this)
371  ! -- modules
372  use openspecmodule, only: access, form
373  use simmodule, only: deprecation_warning
374  ! -- dummy
375  class(uzftype), intent(inout) :: this
376  ! -- local
377  type(gwfuzfparamfoundtype) :: found
378  integer(I4B), pointer :: ikw => null()
379  character(len=LINELENGTH) :: fname
380  ! -- formats
381  character(len=*), parameter :: fmtet = &
382  "(4x, 'ET WILL BE SIMULATED WITHIN UZ AND GW ZONES, WITH LINEAR ', &
383  &'GWET IF OPTION NOT SPECIFIED OTHERWISE.')"
384  character(len=*), parameter :: fmtgwetlin = &
385  &"(4x, 'GROUNDWATER ET FUNCTION WILL BE LINEAR.')"
386  character(len=*), parameter :: fmtgwetsquare = &
387  &"(4x, 'GROUNDWATER ET FUNCTION WILL BE SQUARE WITH SMOOTHING.')"
388  character(len=*), parameter :: fmtgwseepout = &
389  &"(4x, 'GROUNDWATER DISCHARGE TO LAND SURFACE WILL BE SIMULATED.')"
390  character(len=*), parameter :: fmtuzetwc = &
391  &"(4x, 'UNSATURATED ET FUNCTION OF WATER CONTENT.')"
392  character(len=*), parameter :: fmtuzetae = &
393  &"(4x, 'UNSATURATED ET FUNCTION OF AIR ENTRY PRESSURE.')"
394  character(len=*), parameter :: fmtuzfbin = &
395  "(4x, 'UZF ', 1x, a, 1x, ' WILL BE SAVED TO FILE: ', &
396  &a, /4x, 'OPENED ON UNIT: ', I0)"
397  !
398  ! -- call base class to handle AUXILIARY/NAUX, BOUNDNAMES, PRINT_INPUT,
399  ! PRINT_FLOWS, SAVE_FLOWS, OBS6_FILENAME, AUXMULTNAME
400  call this%BndExtType%source_options()
401  !
402  write (this%iout, '(1x,a)') &
403  'PROCESSING '//trim(adjustl(this%text))//' OPTIONS'
404  !
405  ! -- WATER_CONTENT FILEOUT
406  call mem_set_value(fname, 'WCFILE', this%input_mempath, found%wcfile)
407  if (found%wcfile) then
408  this%iwcontout = getunit()
409  call openfile(this%iwcontout, this%iout, fname, 'DATA(BINARY)', &
410  form, access, 'REPLACE', mode_opt=mnormal)
411  write (this%iout, fmtuzfbin) 'WATER-CONTENT', trim(adjustl(fname)), &
412  this%iwcontout
413  end if
414  !
415  ! -- BUDGET FILEOUT
416  call mem_set_value(fname, 'BUDGETFILE', this%input_mempath, found%budgetfile)
417  if (found%budgetfile) then
418  call assign_iounit(this%ibudgetout, this%inunit, "BUDGET fileout")
419  call openfile(this%ibudgetout, this%iout, fname, 'DATA(BINARY)', &
420  form, access, 'REPLACE', mode_opt=mnormal)
421  write (this%iout, fmtuzfbin) 'BUDGET', trim(adjustl(fname)), &
422  this%ibudgetout
423  end if
424  !
425  ! -- BUDGETCSV FILEOUT
426  call mem_set_value(fname, 'BUDGETCSVFILE', this%input_mempath, &
427  found%budgetcsvfile)
428  if (found%budgetcsvfile) then
429  call assign_iounit(this%ibudcsv, this%inunit, "BUDGETCSV fileout")
430  call openfile(this%ibudcsv, this%iout, fname, 'CSV', filstat_opt='REPLACE')
431  write (this%iout, fmtuzfbin) 'BUDGET CSV', trim(adjustl(fname)), &
432  this%ibudcsv
433  end if
434  !
435  ! -- PACKAGE_CONVERGENCE FILEOUT
436  call mem_set_value(fname, 'PKGCONVFNAME', &
437  this%input_mempath, found%pkgconvfname)
438  if (found%pkgconvfname) then
439  this%ipakcsv = getunit()
440  call openfile(this%ipakcsv, this%iout, fname, 'CSV', &
441  filstat_opt='REPLACE', mode_opt=mnormal)
442  write (this%iout, fmtuzfbin) 'PACKAGE_CONVERGENCE', &
443  trim(adjustl(fname)), this%ipakcsv
444  end if
445  allocate (ikw)
446  !
447  ! -- SIMULATE_ET
448  call mem_set_value(ikw, 'SIMULATE_ET', this%input_mempath, found%simulate_et)
449  if (found%simulate_et) then
450  this%ietflag = 1
451  this%igwetflag = 0
452  write (this%iout, fmtet)
453  end if
454  !
455  ! -- LINEAR_GWET
456  call mem_set_value(ikw, 'LINEAR_GWET', this%input_mempath, found%linear_gwet)
457  if (found%linear_gwet) then
458  this%igwetflag = 1
459  write (this%iout, fmtgwetlin)
460  end if
461  !
462  ! -- SQUARE_GWET
463  call mem_set_value(ikw, 'SQUARE_GWET', this%input_mempath, found%square_gwet)
464  if (found%square_gwet) then
465  this%igwetflag = 2
466  write (this%iout, fmtgwetsquare)
467  end if
468  !
469  ! -- SIMULATE_GWSEEP (deprecated)
470  call mem_set_value(ikw, 'SIMULATE_GWSEEP', this%input_mempath, &
471  found%simulate_gwseep)
472  if (found%simulate_gwseep) then
473  this%iseepflag = 1
474  write (this%iout, fmtgwseepout)
475  write (warnmsg, '(a)') &
476  'USE DRN PACKAGE TO SIMULATE GROUNDWATER DISCHARGE TO LAND SURFACE '// &
477  'INSTEAD'
478  call deprecation_warning('OPTIONS', 'SIMULATE_GWSEEP', '6.5.0', &
479  warnmsg, this%inunit)
480  end if
481  !
482  ! -- UNSAT_ETWC
483  call mem_set_value(ikw, 'UNSAT_ETWC', this%input_mempath, found%unsat_etwc)
484  if (found%unsat_etwc) then
485  this%ietflag = 1
486  write (this%iout, fmtuzetwc)
487  end if
488  !
489  ! -- UNSAT_ETAE
490  call mem_set_value(ikw, 'UNSAT_ETAE', this%input_mempath, found%unsat_etae)
491  if (found%unsat_etae) then
492  this%ietflag = 2
493  write (this%iout, fmtuzetae)
494  end if
495  !
496  ! -- MOVER
497  call mem_set_value(ikw, 'MOVER', this%input_mempath, found%mover)
498  if (found%mover) then
499  this%imover = 1
500  end if
501  !
502  ! -- DEV_NO_FINAL_CHECK (mf6internal: iconvchk)
503  call mem_set_value(ikw, 'ICONVCHK', this%input_mempath, found%iconvchk)
504  if (found%iconvchk) then
505  this%iconvchk = 0
506  write (this%iout, '(4x,a)') &
507  'A FINAL CONVERGENCE CHECK OF THE CHANGE IN UZF RECHARGE '// &
508  'WILL NOT BE MADE'
509  end if
510  !
511  deallocate (ikw)
512  !
513  write (this%iout, '(1x,a)') &
514  'END OF '//trim(adjustl(this%text))//' OPTIONS'
515  end subroutine uzf_source_options
516 
517  !> @brief Source DIMENSIONS block from input context
518  !!
519  !! Overrides BndExtType%source_dimensions
520  !<
521  subroutine uzf_source_dimensions(this)
522  ! -- modules
524  ! -- dummy
525  class(uzftype), intent(inout) :: this
526  ! -- local
527  type(gwfuzfparamfoundtype) :: found
528  !
529  ! -- initialize dimensions
530  this%nodes = -1
531  this%ntrail_pvar = 0
532  this%nsets = 0
533  !
534  write (this%iout, '(/1x,a)') &
535  'PROCESSING '//trim(adjustl(this%text))//' DIMENSIONS'
536  !
537  ! -- NUZFCELLS (mf6internal: maxbound)
538  call mem_set_value(this%nodes, 'MAXBOUND', this%input_mempath, &
539  found%maxbound)
540  if (found%maxbound) then
541  write (this%iout, '(4x,a,i0)') 'NUZFCELLS = ', this%nodes
542  end if
543  !
544  ! -- NTRAILWAVES
545  call mem_set_value(this%ntrail_pvar, 'NTRAILWAVES', this%input_mempath, &
546  found%ntrailwaves)
547  if (found%ntrailwaves) then
548  write (this%iout, '(4x,a,i0)') 'NTRAILWAVES = ', this%ntrail_pvar
549  end if
550  !
551  ! -- NWAVESETS
552  call mem_set_value(this%nsets, 'NWAVESETS', this%input_mempath, &
553  found%nwavesets)
554  if (found%nwavesets) then
555  write (this%iout, '(4x,a,i0)') 'NTRAILSETS = ', this%nsets
556  end if
557  !
558  write (this%iout, '(1x,a)') &
559  'END OF '//trim(adjustl(this%text))//' DIMENSIONS'
560  !
561  ! -- increment maxbound
562  this%maxbound = this%maxbound + this%nodes
563  this%nbound = this%maxbound
564  !
565  ! -- verify dimensions were set
566  if (this%nodes <= 0) then
567  write (errmsg, '(a)') &
568  'NUZFCELLS (MAXBOUND) was not specified or was specified incorrectly.'
569  call store_error(errmsg)
570  end if
571  if (this%ntrail_pvar <= 1) then
572  write (errmsg, '(a)') &
573  'NTRAILWAVES must be greater than 1. A value of 7 is recommended.'
574  call store_error(errmsg)
575  end if
576  if (this%nsets <= 0) then
577  write (errmsg, '(a)') &
578  'NWAVESETS was not specified or was specified incorrectly.'
579  call store_error(errmsg)
580  end if
581  if (count_errors() > 0) then
582  call store_error_filename(this%input_fname)
583  end if
584  !
585  ! -- set the number of waves
586  this%nwav_pvar = this%ntrail_pvar * this%nsets
587  !
588  ! -- Call define_listlabel to construct the list label that is written
589  ! when PRINT_INPUT option is used.
590  call this%define_listlabel()
591  !
592  ! -- Allocate arrays in package superclass
593  call this%uzf_allocate_arrays()
594  !
595  ! -- initialize uzf group object
596  allocate (this%uzfobj)
597  call this%uzfobj%init(this%nodes, this%nwav_pvar, this%memoryPath)
598  !
599  !-- Read uzf cell properties
600  call this%uzf_source_packagedata()
601  !
602  ! -- print cell data
603  if (this%iprpak /= 0) then
604  call this%print_cell_properties()
605  end if
606  !
607  ! -- setup the budget object
608  call this%uzf_setup_budobj()
609  end subroutine uzf_source_dimensions
610 
611  !> @brief Read stress data from input context
612  !<
613  subroutine uzf_rp(this)
614  ! -- modules
615  use tdismodule, only: kper
617  ! -- dummy
618  class(uzftype), intent(inout) :: this
619  ! -- local
620  integer(I4B), pointer :: nlist => null()
621  integer(I4B), dimension(:), pointer, contiguous :: ifno => null()
622  integer(I4B) :: i, n
623  ! -- table output
624  character(len=20) :: cellid
625  character(len=LINELENGTH) :: title
626  character(len=LINELENGTH) :: tag
627  integer(I4B) :: ntabrows
628  integer(I4B) :: ntabcols
629  integer(I4B) :: node
630  !-- formats
631  character(len=*), parameter :: fmtlsp = &
632  &"(1X,/1X,'REUSING ',A,'S FROM LAST STRESS PERIOD')"
633  !
634  ! -- set nbound to maxbound
635  this%nbound = this%maxbound
636  !
637  ! -- set steady-state flag based on gwfiss
638  this%issflag = this%gwfiss
639  !
640  ! -- check if input has loaded data for this stress period
641  if (this%iper == kper) then
642  !
643  ! -- get PERIOD data arrays
644  call mem_setptr(nlist, 'NBOUND', this%input_mempath)
645  call mem_setptr(ifno, 'IFNO', this%input_mempath)
646  !
647  ! -- setup inputtab tableobj if PRINT_INPUT
648  if (this%iprpak /= 0) then
649  ntabrows = 1
650  ntabcols = 3
651  if (this%ietflag /= 0) then
652  ntabcols = ntabcols + 3
653  if (this%ietflag == 2) then
654  ntabcols = ntabcols + 3
655  end if
656  end if
657  if (this%inamedbound == 1) then
658  ntabcols = ntabcols + 1
659  end if
660  title = trim(adjustl(this%text))//' PACKAGE ('// &
661  trim(adjustl(this%packName))//') DATA FOR PERIOD'
662  write (title, '(a,1x,i6)') trim(adjustl(title)), kper
663  call table_cr(this%inputtab, this%packName, title)
664  call this%inputtab%table_df(ntabrows, ntabcols, this%iout, &
665  finalize=.false.)
666  tag = 'NUMBER'
667  call this%inputtab%initialize_column(tag, 10)
668  tag = 'CELLID'
669  call this%inputtab%initialize_column(tag, 20, alignment=tableft)
670  tag = 'FINF'
671  call this%inputtab%initialize_column(tag, 12)
672  if (this%ietflag /= 0) then
673  tag = 'PET'
674  call this%inputtab%initialize_column(tag, 12)
675  tag = 'EXTDEP'
676  call this%inputtab%initialize_column(tag, 12)
677  tag = 'EXTWC'
678  call this%inputtab%initialize_column(tag, 12)
679  if (this%ietflag == 2) then
680  tag = 'HA'
681  call this%inputtab%initialize_column(tag, 12)
682  tag = 'HROOT'
683  call this%inputtab%initialize_column(tag, 12)
684  tag = 'ROOTACT'
685  call this%inputtab%initialize_column(tag, 12)
686  end if
687  end if
688  if (this%inamedbound == 1) then
689  tag = 'BOUNDNAME'
690  call this%inputtab%initialize_column(tag, lenboundname, &
691  alignment=tableft)
692  end if
693  end if
694  !
695  ! -- loop over period data
696  do n = 1, nlist
697  i = ifno(n)
698  if (i < 1 .or. i > this%nodes) then
699  tag = trim(adjustl(this%text))//' PACKAGE ('// &
700  trim(adjustl(this%packName))//') DATA FOR PERIOD'
701  write (tag, '(a,1x,i0)') trim(adjustl(tag)), kper
702  write (errmsg, '(a,a,i0,1x,a,i0,a)') &
703  trim(adjustl(tag)), ': UZFNO ', i, &
704  'must be greater than 0 and less than or equal to ', this%nodes, '.'
705  call store_error(errmsg)
706  cycle
707  end if
708  !
709  ! -- sinf_pvar/pet_pvar/extdp/extwc_pvar/ha_pvar/hroot_pvar/
710  ! -- rootact_pvar/uauxvar alias finf/pet/extdp/extwc/ha/hroot/
711  ! -- rootact/AUX directly; nothing to merge
712  !
713  ! -- write table output
714  if (this%iprpak /= 0) then
715  node = this%igwfnode(i)
716  if (node > 0) then
717  call this%dis%noder_to_string(node, cellid)
718  else
719  cellid = 'none'
720  end if
721  call this%inputtab%add_term(i)
722  call this%inputtab%add_term(cellid)
723  call this%inputtab%add_term(this%sinf_pvar(i))
724  if (this%ietflag /= 0) then
725  call this%inputtab%add_term(this%pet_pvar(i))
726  call this%inputtab%add_term(this%extdp(i))
727  call this%inputtab%add_term(this%extwc_pvar(i))
728  if (this%ietflag == 2) then
729  call this%inputtab%add_term(this%ha_pvar(i))
730  call this%inputtab%add_term(this%hroot_pvar(i))
731  call this%inputtab%add_term(this%rootact_pvar(i))
732  end if
733  end if
734  if (this%inamedbound == 1) then
735  call this%inputtab%add_term(this%boundname(i))
736  end if
737  end if
738  end do
739  !
740  if (this%iprpak /= 0) then
741  call this%inputtab%finalize_table()
742  end if
743  !
744  if (count_errors() > 0) then
745  call store_error_filename(this%input_fname)
746  end if
747  !
748  else
749  write (this%iout, fmtlsp) trim(this%filtyp)
750  end if
751  !
752  ! -- set wave data for first stress period and second that follows SS;
753  ! must run every period (not just when iper==kper) so that the reuse
754  ! case (kper==2, no new PERIOD block, issflagold==1) still initializes
755  ! wave data for the SS->TR transition.
756  if ((this%issflag == 0 .AND. kper == 1) .or. &
757  (kper == 2 .AND. this%issflagold == 1)) then
758  do i = 1, this%nodes
759  call this%uzfobj%setwaves(i)
760  end do
761  end if
762  !
763  ! -- Initialize the water content
764  if (kper == 1) then
765  do i = 1, this%nodes
766  this%wcnew(i) = this%uzfobj%get_wcnew(i)
767  end do
768  end if
769  !
770  ! -- Save old ss flag
771  this%issflagold = this%issflag
772  end subroutine uzf_rp
773 
774  !> @brief Advance UZF Package
775  !<
776  subroutine uzf_ad(this)
777  ! -- modules
779  ! -- dummy
780  class(uzftype) :: this
781  ! -- locals
782  integer(I4B) :: i
783  integer(I4B) :: ivertflag
784  integer(I4B) :: n, iaux
785  real(DP) :: rval1, rval2, rval3
786  !
787  ! -- advance observations
788  call this%BndExtType%bnd_ad()
789  !
790  ! -- sinf_pvar/pet_pvar/extdp/extwc_pvar/ha_pvar/hroot_pvar/
791  ! -- rootact_pvar/uauxvar alias finf/pet/extdp/extwc/ha/hroot/
792  ! -- rootact/AUX directly; nothing to re-sync
793  !
794  ! -- update auxiliary variables by copying from the derived-type time
795  ! series variable into the bndpackage auxvar variable so that this
796  ! information is properly written to the GWF budget file
797  if (this%naux > 0) then
798  do n = 1, this%maxbound
799  do iaux = 1, this%naux
800  if (this%noupdateauxvar(iaux) /= 0) cycle
801  this%auxvar(iaux, n) = this%uauxvar(iaux, n)
802  end do
803  end do
804  end if
805  !
806  ! -- Update or restore state
807  if (ifailedstepretry == 0) then
808  !
809  ! -- reset old water content to new water content
810  do i = 1, this%nodes
811  this%wcold(i) = this%wcnew(i)
812  end do
813  else
814  !
815  ! -- Copy wcold back into wcnew as this is a retry of this time step.
816  ! Note that there is no need to reset the waves as they are not
817  ! advanced to their new state until the _ot() method is called,
818  ! and that doesn't happen until a successful solution is obtained.
819  do i = 1, this%nodes
820  this%wcnew(i) = this%wcold(i)
821  end do
822  end if
823  !
824  ! -- advance each uzf obj
825  do i = 1, this%nodes
826  call this%uzfobj%advance(i)
827  end do
828  !
829  ! -- update uzf objects with timeseries aware variables
830  do i = 1, this%nodes
831  !
832  ! -- Set ivertflag
833  ivertflag = this%uzfobj%ivertcon(i)
834  !
835  ! -- recalculate uzfarea
836  if (this%iauxmultcol > 0) then
837  rval1 = this%uauxvar(this%iauxmultcol, i)
838  call this%uzfobj%setdatauzfarea(i, rval1)
839  end if
840  !
841  ! -- FINF
842  rval1 = this%sinf_pvar(i)
843  call this%uzfobj%setdatafinf(i, rval1)
844  !
845  ! -- PET, EXTDP
846  rval1 = this%pet_pvar(i)
847  rval2 = this%extdp(i)
848  call this%uzfobj%setdataet(i, ivertflag, rval1, rval2)
849  !
850  ! -- ETWC
851  rval1 = this%extwc_pvar(i)
852  call this%uzfobj%setdataetwc(i, ivertflag, rval1)
853  !
854  ! -- HA, HROOT, ROOTACT
855  rval1 = this%ha_pvar(i)
856  rval2 = this%hroot_pvar(i)
857  rval3 = this%rootact_pvar(i)
858  call this%uzfobj%setdataetha(i, ivertflag, rval1, rval2, rval3)
859  end do
860  !
861  ! -- check uzfarea
862  if (this%iauxmultcol > 0) then
863  call this%check_cell_area()
864  end if
865  !
866  ! -- pakmvrobj ad
867  if (this%imover == 1) then
868  call this%pakmvrobj%ad()
869  end if
870  end subroutine uzf_ad
871 
872  !> @brief Formulate the HCOF and RHS terms
873  !!
874  !! - skip if no UZF cells
875  !! - calculate hcof and rhs
876  !<
877  subroutine uzf_cf(this)
878  ! -- modules
879  ! -- dummy
880  class(uzftype) :: this
881  ! -- locals
882  integer(I4B) :: n
883  !
884  ! -- Return if no UZF cells
885  if (this%nodes == 0) return
886  !
887  ! -- Store values at start of outer iteration to compare with calculated
888  ! values for convergence check
889  do n = 1, this%maxbound
890  this%rejinf0(n) = this%rejinf(n)
891  this%rch0(n) = this%rch(n)
892  this%gwd0(n) = this%gwd(n)
893  end do
894  end subroutine uzf_cf
895 
896  !> @brief Copy rhs and hcof into solution rhs and amat
897  !<
898  subroutine uzf_fc(this, rhs, ia, idxglo, matrix_sln)
899  ! -- dummy
900  class(uzftype) :: this
901  real(DP), dimension(:), intent(inout) :: rhs
902  integer(I4B), dimension(:), intent(in) :: ia
903  integer(I4B), dimension(:), intent(in) :: idxglo
904  class(matrixbasetype), pointer :: matrix_sln
905  ! -- local
906  integer(I4B) :: i, n, ipos
907  !
908  ! -- pakmvrobj fc
909  if (this%imover == 1) then
910  call this%pakmvrobj%fc()
911  end if
912  !
913  ! -- Solve UZF; set reset_state to true so that waves are reset back to
914  ! initial position for each outer iteration
915  call this%uzf_solve(reset_state=.true.)
916  !
917  ! -- Copy package rhs and hcof into solution rhs and amat
918  do i = 1, this%nodes
919  n = this%nodelist(i)
920  rhs(n) = rhs(n) + this%rhs(i)
921  ipos = ia(n)
922  call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
923  end do
924  end subroutine uzf_fc
925 
926  !> @brief Fill newton terms
927  !<
928  subroutine uzf_fn(this, rhs, ia, idxglo, matrix_sln)
929  ! -- dummy
930  class(uzftype) :: this
931  real(DP), dimension(:), intent(inout) :: rhs
932  integer(I4B), dimension(:), intent(in) :: ia
933  integer(I4B), dimension(:), intent(in) :: idxglo
934  class(matrixbasetype), pointer :: matrix_sln
935  ! -- local
936  integer(I4B) :: i, n
937  integer(I4B) :: ipos
938  !
939  ! -- Add derivative terms to rhs and amat
940  do i = 1, this%nodes
941  n = this%nodelist(i)
942  ipos = ia(n)
943  call matrix_sln%add_value_pos(idxglo(ipos), this%deriv(i))
944  rhs(n) = rhs(n) + this%deriv(i) * this%xnew(n)
945  end do
946  end subroutine uzf_fn
947 
948  !> @brief Final convergence check for package
949  !<
950  subroutine uzf_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
951  ! -- modules
952  use tdismodule, only: totim, kstp, kper, delt
953  ! -- dummy
954  class(uzftype), intent(inout) :: this
955  integer(I4B), intent(in) :: innertot
956  integer(I4B), intent(in) :: kiter
957  integer(I4B), intent(in) :: icnvgmod
958  integer(I4B), intent(in) :: iend
959  character(len=LENPAKLOC), intent(inout) :: cpak
960  integer(I4B), intent(inout) :: ipak
961  real(DP), intent(inout) :: dpak
962  ! -- local
963  character(len=LENPAKLOC) :: cloc
964  character(len=LINELENGTH) :: tag
965  integer(I4B) :: icheck
966  integer(I4B) :: ipakfail
967  integer(I4B) :: locdrejinfmax
968  integer(I4B) :: locdrchmax
969  integer(I4B) :: locdseepmax
970  integer(I4B) :: locdqfrommvrmax
971  integer(I4B) :: ntabrows
972  integer(I4B) :: ntabcols
973  integer(I4B) :: n
974  real(DP) :: q
975  real(DP) :: q0
976  real(DP) :: qtolfact
977  real(DP) :: drejinf
978  real(DP) :: drejinfmax
979  real(DP) :: drch
980  real(DP) :: drchmax
981  real(DP) :: dseep
982  real(DP) :: dseepmax
983  real(DP) :: dqfrommvr
984  real(DP) :: dqfrommvrmax
985  !
986  ! -- initialize local variables
987  icheck = this%iconvchk
988  ipakfail = 0
989  locdrejinfmax = 0
990  locdrchmax = 0
991  locdseepmax = 0
992  locdqfrommvrmax = 0
993  drejinfmax = dzero
994  drchmax = dzero
995  dseepmax = dzero
996  dqfrommvrmax = dzero
997  !
998  ! -- if not saving package convergence data on check convergence if
999  ! the model is considered converged
1000  if (this%ipakcsv == 0) then
1001  if (icnvgmod == 0) then
1002  icheck = 0
1003  end if
1004  else
1005  !
1006  ! -- header for package csv
1007  if (.not. associated(this%pakcsvtab)) then
1008  !
1009  ! -- determine the number of columns and rows
1010  ntabrows = 1
1011  ntabcols = 9
1012  if (this%iseepflag == 1) then
1013  ntabcols = ntabcols + 2
1014  end if
1015  if (this%imover == 1) then
1016  ntabcols = ntabcols + 2
1017  end if
1018  !
1019  ! -- setup table
1020  call table_cr(this%pakcsvtab, this%packName, '')
1021  call this%pakcsvtab%table_df(ntabrows, ntabcols, this%ipakcsv, &
1022  lineseparator=.false., separator=',', &
1023  finalize=.false.)
1024  !
1025  ! -- add columns to package csv
1026  tag = 'total_inner_iterations'
1027  call this%pakcsvtab%initialize_column(tag, 10, alignment=tableft)
1028  tag = 'totim'
1029  call this%pakcsvtab%initialize_column(tag, 10, alignment=tableft)
1030  tag = 'kper'
1031  call this%pakcsvtab%initialize_column(tag, 10, alignment=tableft)
1032  tag = 'kstp'
1033  call this%pakcsvtab%initialize_column(tag, 10, alignment=tableft)
1034  tag = 'nouter'
1035  call this%pakcsvtab%initialize_column(tag, 10, alignment=tableft)
1036  tag = 'drejinfmax'
1037  call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
1038  tag = 'drejinfmax_loc'
1039  call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
1040  tag = 'drchmax'
1041  call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
1042  tag = 'drchmax_loc'
1043  call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
1044  if (this%iseepflag == 1) then
1045  tag = 'dseepmax'
1046  call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
1047  tag = 'dseepmax_loc'
1048  call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
1049  end if
1050  if (this%imover == 1) then
1051  tag = 'dqfrommvrmax'
1052  call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
1053  tag = 'dqfrommvrmax_loc'
1054  call this%pakcsvtab%initialize_column(tag, 16, alignment=tableft)
1055  end if
1056  end if
1057  end if
1058  !
1059  ! -- perform package convergence check
1060  if (icheck /= 0) then
1061  final_check: do n = 1, this%nodes
1062  !
1063  ! -- set the Q to length factor
1064  qtolfact = delt / this%uzfobj%uzfarea(n)
1065  !
1066  ! -- rejected infiltration
1067  drejinf = qtolfact * (this%rejinf0(n) - this%rejinf(n))
1068  !
1069  ! -- groundwater recharge
1070  drch = qtolfact * (this%rch0(n) - this%rch(n))
1071  !
1072  ! -- groundwater seepage to the land surface
1073  dseep = dzero
1074  if (this%iseepflag == 1) then
1075  dseep = qtolfact * (this%gwd0(n) - this%gwd(n))
1076  end if
1077  !
1078  ! -- q from mvr
1079  dqfrommvr = dzero
1080  if (this%imover == 1) then
1081  q = this%pakmvrobj%get_qfrommvr(n)
1082  q0 = this%pakmvrobj%get_qfrommvr0(n)
1083  dqfrommvr = qtolfact * (q0 - q)
1084  end if
1085  !
1086  ! -- evaluate magnitude of differences
1087  if (n == 1) then
1088  drejinfmax = drejinf
1089  locdrejinfmax = n
1090  drchmax = drch
1091  locdrchmax = n
1092  dseepmax = dseep
1093  locdseepmax = n
1094  dqfrommvrmax = dqfrommvr
1095  locdqfrommvrmax = n
1096  else
1097  if (abs(drejinf) > abs(drejinfmax)) then
1098  drejinfmax = drejinf
1099  locdrejinfmax = n
1100  end if
1101  if (abs(drch) > abs(drchmax)) then
1102  drchmax = drch
1103  locdrchmax = n
1104  end if
1105  if (abs(dseep) > abs(dseepmax)) then
1106  dseepmax = dseep
1107  locdseepmax = n
1108  end if
1109  if (abs(dqfrommvr) > abs(dqfrommvrmax)) then
1110  dqfrommvrmax = dqfrommvr
1111  locdqfrommvrmax = n
1112  end if
1113  end if
1114  end do final_check
1115  !
1116  ! -- set dpak and cpak
1117  if (abs(drejinfmax) > abs(dpak)) then
1118  ipak = locdrejinfmax
1119  dpak = drejinfmax
1120  write (cloc, "(a,'-',a)") trim(this%packName), 'rejinf'
1121  cpak = trim(cloc)
1122  end if
1123  if (abs(drchmax) > abs(dpak)) then
1124  ipak = locdrchmax
1125  dpak = drchmax
1126  write (cloc, "(a,'-',a)") trim(this%packName), 'rech'
1127  cpak = trim(cloc)
1128  end if
1129  if (this%iseepflag == 1) then
1130  if (abs(dseepmax) > abs(dpak)) then
1131  ipak = locdseepmax
1132  dpak = dseepmax
1133  write (cloc, "(a,'-',a)") trim(this%packName), 'seep'
1134  cpak = trim(cloc)
1135  end if
1136  end if
1137  if (this%imover == 1) then
1138  if (abs(dqfrommvrmax) > abs(dpak)) then
1139  ipak = locdqfrommvrmax
1140  dpak = dqfrommvrmax
1141  write (cloc, "(a,'-',a)") trim(this%packName), 'qfrommvr'
1142  cpak = trim(cloc)
1143  end if
1144  end if
1145  !
1146  ! -- write convergence data to package csv
1147  if (this%ipakcsv /= 0) then
1148  !
1149  ! -- write the data
1150  call this%pakcsvtab%add_term(innertot)
1151  call this%pakcsvtab%add_term(totim)
1152  call this%pakcsvtab%add_term(kper)
1153  call this%pakcsvtab%add_term(kstp)
1154  call this%pakcsvtab%add_term(kiter)
1155  call this%pakcsvtab%add_term(drejinfmax)
1156  call this%pakcsvtab%add_term(locdrejinfmax)
1157  call this%pakcsvtab%add_term(drchmax)
1158  call this%pakcsvtab%add_term(locdrchmax)
1159  if (this%iseepflag == 1) then
1160  call this%pakcsvtab%add_term(dseepmax)
1161  call this%pakcsvtab%add_term(locdseepmax)
1162  end if
1163  if (this%imover == 1) then
1164  call this%pakcsvtab%add_term(dqfrommvrmax)
1165  call this%pakcsvtab%add_term(locdqfrommvrmax)
1166  end if
1167  !
1168  ! -- finalize the package csv
1169  if (iend == 1) then
1170  call this%pakcsvtab%finalize_table()
1171  end if
1172  end if
1173  end if
1174  end subroutine uzf_cc
1175 
1176  !> @brief Calculate flows
1177  !<
1178  subroutine uzf_cq(this, x, flowja, iadv)
1179  ! -- modules
1180  use tdismodule, only: delt
1182  use budgetmodule, only: budgettype
1183  ! -- dummy
1184  class(uzftype), intent(inout) :: this
1185  real(DP), dimension(:), intent(in) :: x
1186  real(DP), dimension(:), contiguous, intent(inout) :: flowja
1187  integer(I4B), optional, intent(in) :: iadv
1188  ! -- local
1189  integer(I4B) :: i
1190  integer(I4B) :: n
1191  real(DP) :: qout
1192  real(DP) :: qfact
1193  real(DP) :: qtomvr
1194  real(DP) :: q
1195  ! -- for observations
1196  ! -- formats
1197  character(len=*), parameter :: fmttkk = &
1198  &"(1X,/1X,A,' PERIOD ',I0,' STEP ',I0)"
1199  !
1200  ! -- Make uzf solution for budget calculations, and then reset waves.
1201  ! Final uzf solve will be done as part of ot().
1202  call this%uzf_solve(reset_state=.true.)
1203  !
1204  ! -- call base functionality in bnd_cq. This will calculate uzf-gwf flows
1205  ! and put them into this%simvals and this%simvtomvr
1206  call this%BndType%bnd_cq(x, flowja, iadv=1)
1207  !
1208  ! -- Go through and process each UZF cell
1209  do i = 1, this%nodes
1210  !
1211  ! -- Initialize variables
1212  n = this%nodelist(i)
1213  !
1214  ! -- Skip if cell is not active
1215  if (this%ibound(n) < 1) cycle
1216  !
1217  ! -- infiltration terms
1218  this%appliedinf(i) = this%uzfobj%sinf(i) * this%uzfobj%uzfarea(i)
1219  this%infiltration(i) = this%uzfobj%surflux(i) * this%uzfobj%uzfarea(i)
1220  !
1221  ! -- qtomvr
1222  qout = this%rejinf(i) + this%uzfobj%surfseep(i)
1223  qtomvr = dzero
1224  if (this%imover == 1) then
1225  qtomvr = this%pakmvrobj%get_qtomvr(i)
1226  end if
1227  !
1228  ! -- rejected infiltration
1229  qfact = dzero
1230  if (qout > dzero) then
1231  qfact = this%rejinf(i) / qout
1232  end if
1233  q = this%rejinf(i)
1234  this%rejinftomvr(i) = qfact * qtomvr
1235  !
1236  ! -- set rejected infiltration to the remainder
1237  q = q - this%rejinftomvr(i)
1238  !
1239  ! -- values less than zero represent a volumetric error resulting
1240  ! from qtomvr being greater than water available to the mover
1241  if (q < dzero) then
1242  q = dzero
1243  end if
1244  this%rejinf(i) = q
1245  !
1246  ! -- calculate groundwater discharge and what goes to mover
1247  this%gwd(i) = this%uzfobj%surfseep(i)
1248  qfact = dzero
1249  if (qout > dzero) then
1250  qfact = this%gwd(i) / qout
1251  end if
1252  q = this%gwd(i)
1253  this%gwdtomvr(i) = qfact * qtomvr
1254  !
1255  ! -- set groundwater discharge to the remainder
1256  q = q - this%gwdtomvr(i)
1257  !
1258  ! -- values less than zero represent a volumetric error resulting
1259  ! from qtomvr being greater than water available to the mover
1260  if (q < dzero) then
1261  q = dzero
1262  end if
1263  this%gwd(i) = q
1264  !
1265  ! -- calculate and store remaining budget terms
1266  this%gwet_pvar(i) = this%uzfobj%gwet(i)
1267  this%uzet(i) = this%uzfobj%etact(i) * this%uzfobj%uzfarea(i) / delt
1268  !
1269  ! -- End of UZF cell loop
1270  !
1271  end do
1272  !
1273  ! -- fill the budget object
1274  call this%uzf_fill_budobj()
1275  end subroutine uzf_cq
1276 
1277  function get_storage_change(top, bot, carea, hold, hnew, wcold, wcnew, &
1278  thtr, delt, iss) result(qsto)
1279  ! -- dummy
1280  real(dp), intent(in) :: top
1281  real(dp), intent(in) :: bot
1282  real(dp), intent(in) :: hold
1283  real(dp), intent(in) :: hnew
1284  real(dp), intent(in) :: wcold
1285  real(dp), intent(in) :: wcnew
1286  real(dp), intent(in) :: thtr
1287  real(dp), intent(in) :: carea
1288  real(dp), intent(in) :: delt
1289  integer(I4B) :: iss
1290  ! -- return
1291  real(dp) :: qsto
1292  ! -- local
1293  real(dp) :: thknew
1294  real(dp) :: thkold
1295  if (iss == 0) then
1296  thknew = top - max(bot, hnew)
1297  thkold = top - max(bot, hold)
1298  qsto = dzero
1299  if (thknew > dzero) then
1300  qsto = qsto + thknew * (wcnew - thtr)
1301  end if
1302  if (thkold > dzero) then
1303  qsto = qsto - thkold * (wcold - thtr)
1304  end if
1305  qsto = qsto * carea / delt
1306  else
1307  qsto = dzero
1308  end if
1309  end function get_storage_change
1310 
1311  !> @brief Add package ratin/ratout to model budget
1312  !<
1313  subroutine uzf_bd(this, model_budget)
1314  ! -- add package ratin/ratout to model budget
1315  use tdismodule, only: delt
1317  class(uzftype) :: this
1318  type(budgettype), intent(inout) :: model_budget
1319  real(DP) :: ratin
1320  real(DP) :: ratout
1321  integer(I4B) :: isuppress_output
1322  isuppress_output = 0
1323  !
1324  ! -- Calculate flow from uzf to gwf (UZF-GWRCH)
1325  call rate_accumulator(this%rch, ratin, ratout)
1326  call model_budget%addentry(ratin, ratout, delt, this%bdtxt(2), &
1327  isuppress_output, this%packName)
1328  !
1329  ! -- GW discharge and GW discharge to mover
1330  if (this%iseepflag == 1) then
1331  call rate_accumulator(-this%gwd, ratin, ratout)
1332  call model_budget%addentry(ratin, ratout, delt, this%bdtxt(3), &
1333  isuppress_output, this%packName)
1334  if (this%imover == 1) then
1335  call rate_accumulator(-this%gwdtomvr, ratin, ratout)
1336  call model_budget%addentry(ratin, ratout, delt, this%bdtxt(5), &
1337  isuppress_output, this%packName)
1338  end if
1339  end if
1340  !
1341  ! -- groundwater et (gwet array is positive, so switch ratin/ratout)
1342  if (this%igwetflag /= 0) then
1343  call rate_accumulator(-this%gwet_pvar, ratin, ratout)
1344  call model_budget%addentry(ratin, ratout, delt, this%bdtxt(4), &
1345  isuppress_output, this%packName)
1346  end if
1347  end subroutine uzf_bd
1348 
1349  !> @brief Write flows to binary file and/or print flows to budget
1350  !<
1351  subroutine uzf_ot_model_flows(this, icbcfl, ibudfl, icbcun, imap)
1352  ! -- modules
1353  use constantsmodule, only: lenboundname, dzero
1355  ! -- dummy
1356  class(uzftype) :: this
1357  integer(I4B), intent(in) :: icbcfl
1358  integer(I4B), intent(in) :: ibudfl
1359  integer(I4B), intent(in) :: icbcun
1360  integer(I4B), dimension(:), optional, intent(in) :: imap
1361  ! -- local
1362  character(len=LINELENGTH) :: title
1363  integer(I4B) :: itxt
1364  !
1365  ! -- UZF-GWRCH
1366  itxt = 2
1367  title = trim(adjustl(this%bdtxt(itxt)))//' PACKAGE ('// &
1368  trim(this%packName)//') FLOW RATES'
1369  call save_print_model_flows(icbcfl, ibudfl, icbcun, this%iprflow, &
1370  this%outputtab, this%nbound, this%nodelist, &
1371  this%rch, this%ibound, title, this%bdtxt(itxt), &
1372  this%ipakcb, this%dis, this%naux, &
1373  this%name_model, this%name_model, &
1374  this%name_model, this%packName, this%auxname, &
1375  this%auxvar, this%iout, this%inamedbound, &
1376  this%boundname)
1377  !
1378  ! -- UZF-GWD
1379  if (this%iseepflag == 1) then
1380  itxt = 3
1381  title = trim(adjustl(this%bdtxt(itxt)))//' PACKAGE ('// &
1382  trim(this%packName)//') FLOW RATES'
1383  call save_print_model_flows(icbcfl, ibudfl, icbcun, this%iprflow, &
1384  this%outputtab, this%nbound, this%nodelist, &
1385  -this%gwd, this%ibound, title, &
1386  this%bdtxt(itxt), this%ipakcb, this%dis, &
1387  this%naux, this%name_model, this%name_model, &
1388  this%name_model, this%packName, this%auxname, &
1389  this%auxvar, this%iout, this%inamedbound, &
1390  this%boundname)
1391  !
1392  ! -- UZF-GWD TO-MVR
1393  if (this%imover == 1) then
1394  itxt = 5
1395  title = trim(adjustl(this%bdtxt(itxt)))//' PACKAGE ('// &
1396  trim(this%packName)//') FLOW RATES'
1397  call save_print_model_flows(icbcfl, ibudfl, icbcun, this%iprflow, &
1398  this%outputtab, this%nbound, this%nodelist, &
1399  -this%gwdtomvr, this%ibound, title, &
1400  this%bdtxt(itxt), this%ipakcb, this%dis, &
1401  this%naux, this%name_model, this%name_model, &
1402  this%name_model, this%packName, &
1403  this%auxname, this%auxvar, this%iout, &
1404  this%inamedbound, this%boundname)
1405  end if
1406  end if
1407  !
1408  ! -- UZF-GWET
1409  if (this%igwetflag /= 0) then
1410  itxt = 4
1411  title = trim(adjustl(this%bdtxt(itxt)))//' PACKAGE ('// &
1412  trim(this%packName)//') FLOW RATES'
1413  call save_print_model_flows(icbcfl, ibudfl, icbcun, this%iprflow, &
1414  this%outputtab, this%nbound, this%nodelist, &
1415  -this%gwet_pvar, this%ibound, title, &
1416  this%bdtxt(itxt), this%ipakcb, this%dis, &
1417  this%naux, this%name_model, this%name_model, &
1418  this%name_model, this%packName, this%auxname, &
1419  this%auxvar, this%iout, this%inamedbound, &
1420  this%boundname)
1421  end if
1422  end subroutine uzf_ot_model_flows
1423 
1424  !> @brief Output UZF package flow terms
1425  !<
1426  subroutine uzf_ot_package_flows(this, icbcfl, ibudfl)
1427  ! -- modules
1428  use tdismodule, only: kstp, kper, delt, pertim, totim
1429  ! -- dummy
1430  class(uzftype) :: this
1431  integer(I4B), intent(in) :: icbcfl
1432  integer(I4B), intent(in) :: ibudfl
1433  integer(I4B) :: ibinun
1434  !
1435  ! -- write the flows from the budobj
1436  ibinun = 0
1437  if (this%ibudgetout /= 0) then
1438  ibinun = this%ibudgetout
1439  end if
1440  if (icbcfl == 0) ibinun = 0
1441  if (ibinun > 0) then
1442  call this%budobj%save_flows(this%dis, ibinun, kstp, kper, delt, &
1443  pertim, totim, this%iout)
1444  end if
1445  !
1446  ! -- Print lake flows table
1447  if (ibudfl /= 0 .and. this%iprflow /= 0) then
1448  call this%budobj%write_flowtable(this%dis, kstp, kper)
1449  end if
1450  end subroutine uzf_ot_package_flows
1451 
1452  !> @brief Save UZF-calculated values to binary file
1453  !<
1454  subroutine uzf_ot_dv(this, idvsave, idvprint)
1455  ! -- modules
1456  use tdismodule, only: kstp, kper, pertim, totim
1457  ! -- dummy
1458  use inputoutputmodule, only: ulasav
1459  class(uzftype) :: this
1460  integer(I4B), intent(in) :: idvsave
1461  integer(I4B), intent(in) :: idvprint
1462  ! -- local
1463  integer(I4B) :: ibinun
1464  !
1465  ! -- set unit number for binary dependent variable output
1466  ibinun = 0
1467  if (this%iwcontout /= 0) then
1468  ibinun = this%iwcontout
1469  end if
1470  if (idvsave == 0) ibinun = 0
1471  !
1472  ! -- write uzf binary moisture-content output
1473  if (ibinun > 0) then
1474  call ulasav(this%wcnew, ' WATER-CONTENT', kstp, kper, pertim, &
1475  totim, this%nodes, 1, 1, ibinun)
1476  end if
1477  end subroutine uzf_ot_dv
1478 
1479  !> @brief Write UZF budget to listing file
1480  !<
1481  subroutine uzf_ot_bdsummary(this, kstp, kper, iout, ibudfl)
1482  ! -- module
1483  use tdismodule, only: totim, delt
1484  ! -- dummy
1485  class(uzftype) :: this !< UzfType object
1486  integer(I4B), intent(in) :: kstp !< time step number
1487  integer(I4B), intent(in) :: kper !< period number
1488  integer(I4B), intent(in) :: iout !< flag and unit number for the model listing file
1489  integer(I4B), intent(in) :: ibudfl !< flag indicating budget should be written
1490  !
1491  call this%budobj%write_budtable(kstp, kper, iout, ibudfl, totim, delt)
1492  end subroutine uzf_ot_bdsummary
1493 
1494  !> @brief Formulate the HCOF and RHS terms
1495  !<
1496  subroutine uzf_solve(this, reset_state)
1497  ! -- modules
1498  use tdismodule, only: delt
1499  logical, intent(in) :: reset_state !< flag indicating that waves should be reset after solution
1500  ! -- dummy
1501  class(uzftype) :: this
1502  ! -- locals
1503  integer(I4B) :: i, ivertflag
1504  integer(I4B) :: n, m, ierr
1505  real(DP) :: trhs1, thcof1, trhs2, thcof2
1506  real(DP) :: hgwf, uzderiv, derivgwet
1507  real(DP) :: qfrommvr
1508  real(DP) :: qformvr
1509  real(DP) :: wc
1510  real(DP) :: watabold
1511  !
1512  ! -- Initialize
1513  ierr = 0
1514  do i = 1, this%nodes
1515  this%uzfobj%pet(i) = this%uzfobj%petmax(i)
1516  end do
1517  !
1518  ! -- Calculate hcof and rhs for each UZF entry
1519  do i = 1, this%nodes
1520  !
1521  ! -- Initialize hcof/rhs terms
1522  this%hcof(i) = dzero
1523  this%rhs(i) = dzero
1524  thcof1 = dzero
1525  thcof2 = dzero
1526  trhs1 = dzero
1527  trhs2 = dzero
1528  uzderiv = dzero
1529  derivgwet = dzero
1530  !
1531  ! -- Initialize variables
1532  n = this%nodelist(i)
1533  ivertflag = this%uzfobj%ivertcon(i)
1534  watabold = this%uzfobj%watabold(i)
1535  !
1536  if (this%ibound(n) > 0) then
1537  !
1538  ! -- Water mover added to infiltration
1539  qfrommvr = dzero
1540  qformvr = dzero
1541  if (this%imover == 1) then
1542  qfrommvr = this%pakmvrobj%get_qfrommvr(i)
1543  end if
1544  !
1545  hgwf = this%xnew(n)
1546  m = n
1547  !
1548  ! -- solve for current uzf cell
1549  call this%uzfobj%solve(ivertflag, i, &
1550  this%totfluxtot, this%ietflag, &
1551  this%issflag, this%iseepflag, hgwf, &
1552  qfrommvr, ierr, &
1553  reset_state=reset_state, &
1554  trhs=trhs1, thcof=thcof1, deriv=uzderiv, &
1555  watercontent=wc)
1556  !
1557  ! -- terminate if an error condition has occurred
1558  if (ierr > 0) then
1559  if (ierr == 1) &
1560  errmsg = 'UZF variable NWAVESETS needs to be increased.'
1561  call store_error(errmsg, terminate=.true.)
1562  end if
1563  !
1564  ! -- Calculate gwet
1565  if (this%igwetflag > 0) then
1566  call this%uzfobj%setgwpet(i)
1567  call this%uzfobj%simgwet(this%igwetflag, i, hgwf, trhs2, thcof2, &
1568  derivgwet)
1569  end if
1570  !
1571  ! -- distribute PET to deeper cells
1572  if (this%ietflag > 0) then
1573  if (this%uzfobj%ivertcon(i) > 0) then
1574  call this%uzfobj%setbelowpet(i, ivertflag)
1575  end if
1576  end if
1577  !
1578  ! -- store derivative for Newton addition to equations in _fn()
1579  this%deriv(i) = uzderiv + derivgwet
1580  !
1581  ! -- save current rejected infiltration, groundwater recharge, and
1582  ! groundwater discharge
1583  this%rejinf(i) = this%uzfobj%finf_rej(i) * this%uzfobj%uzfarea(i)
1584  this%rch(i) = this%uzfobj%totflux(i) * this%uzfobj%uzfarea(i) / delt
1585  this%gwd(i) = this%uzfobj%surfseep(i)
1586  !
1587  ! -- add to hcof and rhs
1588  this%hcof(i) = thcof1 + thcof2
1589  this%rhs(i) = -trhs1 + trhs2
1590  !
1591  ! -- add spring discharge and rejected infiltration to mover
1592  if (this%imover == 1) then
1593  qformvr = this%gwd(i) + this%rejinf(i)
1594  call this%pakmvrobj%accumulate_qformvr(i, qformvr)
1595  end if
1596  !
1597  ! -- Store water content
1598  this%wcnew(i) = wc
1599  !
1600  ! -- Calculate change in mobile storage
1601  this%qsto(i) = get_storage_change(this%uzfobj%celtop(i), &
1602  this%uzfobj%celbot(i), &
1603  this%uzfobj%uzfarea(i), &
1604  watabold, &
1605  this%uzfobj%watab(i), &
1606  this%wcold(i), this%wcnew(i), &
1607  this%uzfobj%thtr(i), delt, this%issflag)
1608  !
1609  end if
1610  end do
1611  end subroutine uzf_solve
1612 
1613  !> @brief Define the list heading that is written to iout when PRINT_INPUT
1614  !! option is used
1615  !<
1616  subroutine define_listlabel(this)
1617  ! -- dummy
1618  class(uzftype), intent(inout) :: this
1619  !
1620  ! -- create the header list label
1621  this%listlabel = trim(this%filtyp)//' NO.'
1622  if (this%dis%ndim == 3) then
1623  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
1624  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'ROW'
1625  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'COL'
1626  elseif (this%dis%ndim == 2) then
1627  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
1628  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'CELL2D'
1629  else
1630  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'NODE'
1631  end if
1632  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'STRESS RATE'
1633  if (this%inamedbound == 1) then
1634  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'BOUNDARY NAME'
1635  end if
1636  end subroutine define_listlabel
1637 
1638  !> @brief Identify overlying cell ID based on user-specified mapping
1639  !<
1640  subroutine findcellabove(this, n, nml)
1641  ! -- dummy
1642  class(uzftype) :: this
1643  integer(I4B), intent(in) :: n
1644  integer(I4B), intent(inout) :: nml
1645  ! -- local
1646  integer(I4B) :: m, ipos
1647  !
1648  ! -- Return nml = n if no cell is above it
1649  nml = n
1650  do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
1651  m = this%dis%con%ja(ipos)
1652  if (this%dis%con%ihc(ipos) /= 0) then
1653  if (n < m) then
1654  ! -- m is beneath n
1655  else
1656  nml = m ! -- m is above n
1657  exit
1658  end if
1659  end if
1660  end do
1661  end subroutine findcellabove
1662 
1663  !> @brief Source PACKAGEDATA block from input context
1664  !<
1665  subroutine uzf_source_packagedata(this)
1666  ! -- modules
1668  ! -- dummy
1669  class(uzftype), intent(inout) :: this
1670  ! -- local
1671  integer(I4B), dimension(:), pointer, contiguous :: ifno => null()
1672  integer(I4B), dimension(:, :), pointer, contiguous :: cellid_idm => null()
1673  integer(I4B), dimension(:), pointer, contiguous :: landflag => null()
1674  integer(I4B), dimension(:), pointer, contiguous :: ivertcon => null()
1675  real(DP), dimension(:), pointer, contiguous :: surfdep => null()
1676  real(DP), dimension(:), pointer, contiguous :: vks => null()
1677  real(DP), dimension(:), pointer, contiguous :: thtr => null()
1678  real(DP), dimension(:), pointer, contiguous :: thts => null()
1679  real(DP), dimension(:), pointer, contiguous :: thti => null()
1680  real(DP), dimension(:), pointer, contiguous :: eps => null()
1681  type(characterstringtype), dimension(:), pointer, contiguous :: &
1682  bndname => null()
1683  character(len=LINELENGTH) :: cellid_str
1684  integer(I4B) :: ierr
1685  integer(I4B) :: i, igwf, n
1686  integer(I4B) :: j, jcol
1687  integer(I4B), dimension(:), allocatable :: rowmaxnnz
1688  type(sparsematrix) :: sparse
1689  integer(I4B), dimension(:), allocatable :: nboundchk
1690  !
1691  write (this%iout, '(/1x,3a)') 'PROCESSING ', trim(adjustl(this%text)), &
1692  ' PACKAGEDATA'
1693  !
1694  ! -- get PACKAGEDATA arrays
1695  call mem_setptr(ifno, 'PACKAGEDATA_IFNO', this%input_mempath)
1696  call mem_setptr(cellid_idm, 'CELLID', this%input_mempath)
1697  call mem_setptr(landflag, 'LANDFLAG', this%input_mempath)
1698  call mem_setptr(ivertcon, 'IVERTCON', this%input_mempath)
1699  call mem_setptr(surfdep, 'SURFDEP', this%input_mempath)
1700  call mem_setptr(vks, 'VKS', this%input_mempath)
1701  call mem_setptr(thtr, 'THTR', this%input_mempath)
1702  call mem_setptr(thts, 'THTS', this%input_mempath)
1703  call mem_setptr(thti, 'THTI', this%input_mempath)
1704  call mem_setptr(eps, 'EPS', this%input_mempath)
1705  if (this%inamedbound /= 0) then
1706  call mem_setptr(bndname, 'BOUNDNAME', this%input_mempath)
1707  end if
1708  !
1709  ! -- allocate local check arrays
1710  allocate (rowmaxnnz(this%dis%nodes))
1711  do n = 1, this%dis%nodes
1712  rowmaxnnz(n) = 0
1713  end do
1714  allocate (nboundchk(this%nodes))
1715  do n = 1, this%nodes
1716  nboundchk(n) = 0
1717  end do
1718  !
1719  ! -- loop over packagedata entries
1720  do n = 1, this%nodes
1721  i = this%validate_ifno(ifno(n), this%nodes, nboundchk, &
1722  'IUZNO', 'PACKAGEDATA')
1723  if (i == 0) cycle
1724  !
1725  ! -- convert CELLID to node number
1726  write (cellid_str, '(10(i0,1x))') cellid_idm(1:this%dis%ndim, n)
1727  igwf = this%dis%noder_from_cellid(cellid_str, this%inunit, this%iout)
1728  this%igwfnode(i) = igwf
1729  rowmaxnnz(igwf) = rowmaxnnz(igwf) + 1
1730  !
1731  ! -- validate landflag
1732  if (landflag(n) < 0 .OR. landflag(n) > 1) then
1733  write (errmsg, '(a,1x,i0,1x,a,1x,i0,a)') &
1734  'LANDFLAG for uzf cell', i, &
1735  'must be 0 or 1 (specified value is', landflag(n), ').'
1736  call store_error(errmsg)
1737  end if
1738  !
1739  ! -- validate ivertcon
1740  if (ivertcon(n) < 0 .OR. ivertcon(n) > this%nodes) then
1741  write (errmsg, '(a,1x,i0,1x,a,1x,i0,a)') &
1742  'IVERTCON for uzf cell', i, &
1743  'must be 0 or less than NUZFCELLS (specified value is', &
1744  ivertcon(n), ').'
1745  call store_error(errmsg)
1746  end if
1747  !
1748  ! -- validate surfdep
1749  if (surfdep(n) <= dzero .and. landflag(n) > 0) then
1750  write (errmsg, '(a,1x,i0,1x,a,1x,g0,a)') &
1751  'SURFDEP for uzf cell', i, &
1752  'must be greater than 0 (specified value is', surfdep(n), ').'
1753  call store_error(errmsg)
1754  end if
1755  if (surfdep(n) >= this%dis%top(igwf) - this%dis%bot(igwf)) then
1756  write (errmsg, '(a,1x,i0,1x,a)') &
1757  'SURFDEP for uzf cell', i, &
1758  'cannot be greater than the cell thickness.'
1759  call store_error(errmsg)
1760  end if
1761  !
1762  ! -- validate vks
1763  if (vks(n) <= dzero) then
1764  write (errmsg, '(a,1x,i0,1x,a,1x,g0,a)') &
1765  'VKS for uzf cell', i, &
1766  'must be greater than 0 (specified value ia', vks(n), ').'
1767  call store_error(errmsg)
1768  end if
1769  !
1770  ! -- validate thtr
1771  if (thtr(n) <= dzero) then
1772  write (errmsg, '(a,1x,i0,1x,a,1x,g0,a)') &
1773  'THTR for uzf cell', i, &
1774  'must be greater than 0 (specified value is', thtr(n), ').'
1775  call store_error(errmsg)
1776  end if
1777  !
1778  ! -- validate thts
1779  if (thts(n) <= thtr(n)) then
1780  write (errmsg, '(a,1x,i0,1x,a,1x,g0,a)') &
1781  'THTS for uzf cell', i, &
1782  'must be greater than THTR (specified value is', thts(n), ').'
1783  call store_error(errmsg)
1784  end if
1785  !
1786  ! -- validate thti
1787  if (thti(n) < thtr(n) .OR. thti(n) > thts(n)) then
1788  write (errmsg, '(a,1x,i0,1x,a,1x,a,1x,g0,a)') &
1789  'THTI for uzf cell', i, &
1790  'must be greater than or equal to THTR AND less than THTS', &
1791  '(specified value is', thti(n), ').'
1792  call store_error(errmsg)
1793  end if
1794  !
1795  ! -- validate eps
1796  if (eps(n) < 3.5 .OR. eps(n) > 14) then
1797  write (errmsg, '(a,1x,i0,1x,a,1x,g0,a)') &
1798  'EPSILON for uzf cell', i, &
1799  'must be between 3.5 and 14.0 (specified value is', eps(n), ').'
1800  call store_error(errmsg)
1801  end if
1802  !
1803  ! -- boundname
1804  if (this%inamedbound == 1) then
1805  this%uzfname(i) = bndname(n)
1806  end if
1807  !
1808  ! -- set data if no errors
1809  if (count_errors() == 0) then
1810  call this%uzfobj%setdata(i, this%dis%area(igwf), &
1811  this%dis%top(igwf), this%dis%bot(igwf), &
1812  surfdep(n), vks(n), thtr(n), thts(n), &
1813  thti(n), eps(n), this%ntrail_pvar, &
1814  landflag(n), ivertcon(n))
1815  if (ivertcon(n) > 0) then
1816  this%iuzf2uzf = 1
1817  end if
1818  end if
1819  end do
1820  write (this%iout, '(1x,3a)') &
1821  'END OF ', trim(adjustl(this%text)), ' PACKAGEDATA'
1822  !
1823  ! -- check for duplicate or missing uzf cells
1824  call this%report_ifno_coverage(nboundchk, this%nodes, 'uzf cell', &
1825  'PACKAGEDATA')
1826  if (count_errors() > 0) then
1827  call store_error_filename(this%input_fname)
1828  end if
1829  !
1830  ! -- setup sparse for connectivity used to identify multiple uzf cells
1831  ! per GWF model cell
1832  call sparse%init(this%dis%nodes, this%dis%nodes, rowmaxnnz)
1833  do i = 1, this%nodes
1834  igwf = this%igwfnode(i)
1835  call sparse%addconnection(igwf, i, 1)
1836  end do
1837  !
1838  ! -- create ia and ja from sparse
1839  call sparse%filliaja(this%ia, this%ja, ierr)
1840  !
1841  ! -- set imaxcellcnt
1842  do i = 1, this%dis%nodes
1843  jcol = 0
1844  do j = this%ia(i), this%ia(i + 1) - 1
1845  jcol = jcol + 1
1846  end do
1847  if (jcol > this%imaxcellcnt) then
1848  this%imaxcellcnt = jcol
1849  end if
1850  end do
1851  !
1852  if (this%imaxcellcnt > 1 .and. this%iauxmultcol < 1) then
1853  call this%check_cell_area()
1854  end if
1855  !
1856  deallocate (rowmaxnnz)
1857  deallocate (nboundchk)
1858  !
1859  ! -- release input context packagedata memory
1860  call memorystore_release('PACKAGEDATA_IFNO', this%input_mempath)
1861  call memorystore_release('CELLID', this%input_mempath)
1862  call memorystore_release('LANDFLAG', this%input_mempath)
1863  call memorystore_release('IVERTCON', this%input_mempath)
1864  call memorystore_release('SURFDEP', this%input_mempath)
1865  call memorystore_release('VKS', this%input_mempath)
1866  call memorystore_release('THTR', this%input_mempath)
1867  call memorystore_release('THTS', this%input_mempath)
1868  call memorystore_release('THTI', this%input_mempath)
1869  call memorystore_release('EPS', this%input_mempath)
1870  call memorystore_release('BOUNDNAME', this%input_mempath)
1871  end subroutine uzf_source_packagedata
1872 
1873  !> @brief Read UZF cell properties and set them for UZFCellGroup type
1874  !<
1875  subroutine print_cell_properties(this)
1876  ! -- dummy
1877  class(uzftype), intent(inout) :: this
1878  ! -- local
1879  character(len=20) :: cellid
1880  character(len=LINELENGTH) :: title
1881  character(len=LINELENGTH) :: tag
1882  integer(I4B) :: ntabrows
1883  integer(I4B) :: ntabcols
1884  integer(I4B) :: i
1885  integer(I4B) :: node
1886  !
1887  ! -- setup inputtab tableobj
1888  !
1889  ! -- table dimensions
1890  ntabrows = this%nodes
1891  ntabcols = 10
1892  if (this%inamedbound == 1) then
1893  ntabcols = ntabcols + 1
1894  end if
1895  !
1896  ! -- initialize table and define columns
1897  title = trim(adjustl(this%text))//' PACKAGE ('// &
1898  trim(adjustl(this%packName))//') STATIC UZF CELL DATA'
1899  call table_cr(this%inputtab, this%packName, title)
1900  call this%inputtab%table_df(ntabrows, ntabcols, this%iout)
1901  tag = 'NUMBER'
1902  call this%inputtab%initialize_column(tag, 10)
1903  tag = 'CELLID'
1904  call this%inputtab%initialize_column(tag, 20, alignment=tableft)
1905  tag = 'LANDFLAG'
1906  call this%inputtab%initialize_column(tag, 12)
1907  tag = 'IVERTCON'
1908  call this%inputtab%initialize_column(tag, 12)
1909  tag = 'SURFDEP'
1910  call this%inputtab%initialize_column(tag, 12)
1911  tag = 'VKS'
1912  call this%inputtab%initialize_column(tag, 12)
1913  tag = 'THTR'
1914  call this%inputtab%initialize_column(tag, 12)
1915  tag = 'THTS'
1916  call this%inputtab%initialize_column(tag, 12)
1917  tag = 'THTI'
1918  call this%inputtab%initialize_column(tag, 12)
1919  tag = 'EPS'
1920  call this%inputtab%initialize_column(tag, 12)
1921  if (this%inamedbound == 1) then
1922  tag = 'BOUNDNAME'
1923  call this%inputtab%initialize_column(tag, lenboundname, alignment=tableft)
1924  end if
1925  !
1926  ! -- write data for each cell
1927  do i = 1, this%nodes
1928  !
1929  ! -- get cellid
1930  node = this%igwfnode(i)
1931  if (node > 0) then
1932  call this%dis%noder_to_string(node, cellid)
1933  else
1934  cellid = 'none'
1935  end if
1936  !
1937  ! -- add data
1938  call this%inputtab%add_term(i)
1939  call this%inputtab%add_term(cellid)
1940  call this%inputtab%add_term(this%uzfobj%landflag(i))
1941  call this%inputtab%add_term(this%uzfobj%ivertcon(i))
1942  call this%inputtab%add_term(this%uzfobj%surfdep(i))
1943  call this%inputtab%add_term(this%uzfobj%vks(i))
1944  call this%inputtab%add_term(this%uzfobj%thtr(i))
1945  call this%inputtab%add_term(this%uzfobj%thts(i))
1946  call this%inputtab%add_term(this%uzfobj%thti(i))
1947  call this%inputtab%add_term(this%uzfobj%eps(i))
1948  if (this%inamedbound == 1) then
1949  call this%inputtab%add_term(this%uzfname(i))
1950  end if
1951  end do
1952  end subroutine print_cell_properties
1953 
1954  !> @brief Check UZF cell areas
1955  !<
1956  subroutine check_cell_area(this)
1957  ! -- modules
1958  use inputoutputmodule, only: urword
1960  ! -- dummy
1961  class(uzftype) :: this
1962  ! -- local
1963  character(len=16) :: cuzf
1964  character(len=20) :: cellid
1965  character(len=LINELENGTH) :: cuzfcells
1966  integer(I4B) :: i
1967  integer(I4B) :: i2
1968  integer(I4B) :: j
1969  integer(I4B) :: n
1970  integer(I4B) :: i0
1971  integer(I4B) :: i1
1972  real(DP) :: area
1973  real(DP) :: area2
1974  real(DP) :: sumarea
1975  real(DP) :: cellarea
1976  real(DP) :: d
1977  !
1978  ! -- check that the area of vertically connected uzf cells is the equal
1979  do i = 1, this%nodes
1980  !
1981  ! -- Initialize variables
1982  i2 = this%uzfobj%ivertcon(i)
1983  area = this%uzfobj%uzfarea(i)
1984  !
1985  ! Create pointer to object below
1986  if (i2 > 0) then
1987  area2 = this%uzfobj%uzfarea(i2)
1988  d = abs(area - area2)
1989  if (d > dem6) then
1990  write (errmsg, '(2(a,1x,g0,1x,a,1x,i0,1x),a)') &
1991  'UZF cell area (', area, ') for cell ', i, &
1992  'does not equal uzf cell area (', area2, ') for cell ', i2, '.'
1993  call store_error(errmsg)
1994  end if
1995  end if
1996  end do
1997  !
1998  ! -- check that the area of uzf cells in a GWF cell is less than or equal
1999  ! to the GWF cell area
2000  do n = 1, this%dis%nodes
2001  i0 = this%ia(n)
2002  i1 = this%ia(n + 1)
2003  ! -- skip gwf cells with no UZF cells
2004  if ((i1 - i0) < 1) cycle
2005  sumarea = dzero
2006  cellarea = dzero
2007  cuzfcells = ''
2008  do j = i0, i1 - 1
2009  i = this%ja(j)
2010  write (cuzf, '(i0)') i
2011  cuzfcells = trim(adjustl(cuzfcells))//' '//trim(adjustl(cuzf))
2012  sumarea = sumarea + this%uzfobj%uzfarea(i)
2013  cellarea = this%uzfobj%cellarea(i)
2014  end do
2015  ! -- calculate the difference between the sum of UZF areas and GWF cell area
2016  d = sumarea - cellarea
2017  if (d > dem6) then
2018  call this%dis%noder_to_string(n, cellid)
2019  write (errmsg, '(a,1x,g0,1x,a,1x,g0,1x,a,1x,a,1x,a,a,a)') &
2020  'Total uzf cell area (', sumarea, &
2021  ') exceeds the gwf cell area (', cellarea, ') of cell', cellid, &
2022  'which includes uzf cell(s): ', trim(adjustl(cuzfcells)), '.'
2023  call store_error(errmsg)
2024  end if
2025  end do
2026  !
2027  ! -- terminate if errors were encountered
2028  if (count_errors() > 0) then
2029  call store_error_filename(this%input_fname)
2030  end if
2031  end subroutine check_cell_area
2032 
2033  ! -- Procedures related to observations (type-bound)
2034 
2035  !> @brief Return true because uzf package supports observations
2036  !!
2037  !! Overrides BndType%bnd_obs_supported
2038  !<
2039  logical function uzf_obs_supported(this)
2040  ! -- dummy
2041  class(uzftype) :: this
2042  !
2043  uzf_obs_supported = .true.
2044  end function uzf_obs_supported
2045 
2046  !> @brief Implements bnd_df_obs
2047  !!
2048  !! Store observation type supported by uzf package.
2049  !! Overrides BndType%bnd_df_obs
2050  !<
2051  subroutine uzf_df_obs(this)
2052  ! -- dummy
2053  class(uzftype) :: this
2054  ! -- local
2055  integer(I4B) :: indx
2056  !
2057  ! -- Store obs type and assign procedure pointer
2058  !
2059  ! for recharge observation type.
2060  call this%obs%StoreObsType('uzf-gwrch', .true., indx)
2061  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2062  !
2063  ! for discharge observation type.
2064  call this%obs%StoreObsType('uzf-gwd', .true., indx)
2065  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2066  !
2067  ! for discharge observation type.
2068  call this%obs%StoreObsType('uzf-gwd-to-mvr', .true., indx)
2069  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2070  !
2071  ! for gwet observation type.
2072  call this%obs%StoreObsType('uzf-gwet', .true., indx)
2073  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2074  !
2075  ! for infiltration observation type.
2076  call this%obs%StoreObsType('infiltration', .true., indx)
2077  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2078  !
2079  ! for from mover observation type.
2080  call this%obs%StoreObsType('from-mvr', .true., indx)
2081  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2082  !
2083  ! for rejected infiltration observation type.
2084  call this%obs%StoreObsType('rej-inf', .true., indx)
2085  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2086  !
2087  ! for rejected infiltration to mover observation type.
2088  call this%obs%StoreObsType('rej-inf-to-mvr', .true., indx)
2089  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2090  !
2091  ! for uzet observation type.
2092  call this%obs%StoreObsType('uzet', .true., indx)
2093  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2094  !
2095  ! for storage observation type.
2096  call this%obs%StoreObsType('storage', .true., indx)
2097  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2098  !
2099  ! for net infiltration observation type.
2100  call this%obs%StoreObsType('net-infiltration', .true., indx)
2101  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2102  !
2103  ! for water-content observation type.
2104  call this%obs%StoreObsType('water-content', .false., indx)
2105  this%obs%obsData(indx)%ProcessIdPtr => uzf_process_obsid
2106  end subroutine uzf_df_obs
2107 
2108  !> @brief Calculate observations this time step and call ObsType%SaveOneSimval
2109  !! for each UzfType observation
2110  !<
2111  subroutine uzf_bd_obs(this)
2112  ! -- dummy
2113  class(uzftype) :: this
2114  ! -- local
2115  integer(I4B) :: i
2116  integer(I4B) :: ii
2117  integer(I4B) :: n
2118  real(DP) :: v
2119  type(observetype), pointer :: obsrv => null()
2120  !
2121  ! -- Make final uzf solution, and do not reset waves. This will advance
2122  ! the waves to their new state at the end of the time step. This should
2123  ! be the first step of the uzf ot() routines.
2124  call this%uzf_solve(reset_state=.false.)
2125  !
2126  ! Write simulated values for all uzf observations
2127  if (this%obs%npakobs > 0) then
2128  call this%obs%obs_bd_clear()
2129  do i = 1, this%obs%npakobs
2130  obsrv => this%obs%pakobs(i)%obsrv
2131  do ii = 1, obsrv%indxbnds_count
2132  n = obsrv%indxbnds(ii)
2133  v = dnodata
2134  select case (obsrv%ObsTypeId)
2135  case ('UZF-GWRCH')
2136  v = this%rch(n)
2137  case ('UZF-GWD')
2138  v = this%gwd(n)
2139  if (v > dzero) then
2140  v = -v
2141  end if
2142  case ('UZF-GWD-TO-MVR')
2143  if (this%imover == 1) then
2144  v = this%gwdtomvr(n)
2145  if (v > dzero) then
2146  v = -v
2147  end if
2148  end if
2149  case ('UZF-GWET')
2150  if (this%igwetflag > 0) then
2151  v = this%gwet_pvar(n)
2152  if (v > dzero) then
2153  v = -v
2154  end if
2155  end if
2156  case ('INFILTRATION')
2157  v = this%appliedinf(n)
2158  case ('FROM-MVR')
2159  if (this%imover == 1) then
2160  v = this%pakmvrobj%get_qfrommvr(n)
2161  end if
2162  case ('REJ-INF')
2163  v = this%rejinf(n)
2164  if (v > dzero) then
2165  v = -v
2166  end if
2167  case ('REJ-INF-TO-MVR')
2168  if (this%imover == 1) then
2169  v = this%rejinftomvr(n)
2170  if (v > dzero) then
2171  v = -v
2172  end if
2173  end if
2174  case ('UZET')
2175  if (this%ietflag /= 0) then
2176  v = this%uzet(n)
2177  if (v > dzero) then
2178  v = -v
2179  end if
2180  end if
2181  case ('STORAGE')
2182  v = -this%qsto(n)
2183  case ('NET-INFILTRATION')
2184  v = this%infiltration(n)
2185  case ('WATER-CONTENT')
2186  v = this%uzfobj%get_water_content_at_depth(n, obsrv%obsDepth)
2187  case default
2188  errmsg = 'Unrecognized observation type: '//trim(obsrv%ObsTypeId)
2189  call store_error(errmsg)
2190  end select
2191  call this%obs%SaveOneSimval(obsrv, v)
2192  end do
2193  end do
2194  !
2195  ! -- write summary of error messages
2196  if (count_errors() > 0) then
2197  call store_error_filename(this%input_fname)
2198  end if
2199  end if
2200  end subroutine uzf_bd_obs
2201 
2202  !> @brief Process each observation
2203  !!
2204  !! Only done the first stress period since boundaries are fixed for the
2205  !! simulation
2206  !<
2207  subroutine uzf_rp_obs(this)
2208  ! -- modules
2209  use tdismodule, only: kper
2210  ! -- dummy
2211  class(uzftype), intent(inout) :: this
2212  ! -- local
2213  integer(I4B) :: i
2214  integer(I4B) :: j
2215  integer(I4B) :: n
2216  integer(I4B) :: nn
2217  integer(I4B) :: iuzid
2218  real(DP) :: obsdepth
2219  real(DP) :: dmax
2220  character(len=LENBOUNDNAME) :: bname
2221  class(observetype), pointer :: obsrv => null()
2222  ! -- formats
2223 60 format('Invalid node number in OBS input: ', i0)
2224  !
2225  if (kper == 1) then
2226  do i = 1, this%obs%npakobs
2227  obsrv => this%obs%pakobs(i)%obsrv
2228  !
2229  ! -- get node number 1
2230  nn = obsrv%NodeNumber
2231  if (nn == namedboundflag) then
2232  bname = obsrv%FeatureName
2233  !
2234  ! -- Observation location(s) is(are) based on a boundary name.
2235  ! Iterate through all boundaries to identify and store
2236  ! corresponding index(indices) in bound array.
2237  do j = 1, this%nodes
2238  if (this%boundname(j) == bname) then
2239  obsrv%BndFound = .true.
2240  obsrv%CurrentTimeStepEndValue = dzero
2241  call obsrv%AddObsIndex(j)
2242  if (obsrv%indxbnds_count == 1) then
2243  !
2244  ! -- Define intPak1 so that obs_theta is stored (for first uzf
2245  ! cell if multiple cells share the same boundname).
2246  obsrv%intPak1 = j
2247  end if
2248  end if
2249  end do
2250  else
2251  !
2252  ! -- get node number
2253  nn = obsrv%NodeNumber
2254  !
2255  ! -- put nn (a value meaningful only to UZF) in intPak1
2256  obsrv%intPak1 = nn
2257  ! -- check that node number is valid; call store_error if not
2258  if (nn < 1 .or. nn > this%nodes) then
2259  write (errmsg, 60) nn
2260  call store_error(errmsg)
2261  else
2262  obsrv%BndFound = .true.
2263  end if
2264  obsrv%CurrentTimeStepEndValue = dzero
2265  call obsrv%AddObsIndex(nn)
2266  end if
2267  !
2268  ! -- catch non-cumulative observation assigned to observation defined
2269  ! by a boundname that is assigned to more than one element
2270  if (obsrv%ObsTypeId == 'WATER-CONTENT') then
2271  n = obsrv%indxbnds_count
2272  if (n /= 1) then
2273  write (errmsg, '(a,3(1x,a))') &
2274  trim(adjustl(obsrv%ObsTypeId)), 'for observation', &
2275  trim(adjustl(obsrv%Name)), &
2276  'must be assigned to a UZF cell with a unique boundname.'
2277  call store_error(errmsg, terminate=.true.)
2278  end if
2279  !
2280  ! -- check WATER-CONTENT depth
2281  obsdepth = obsrv%Obsdepth
2282  !
2283  ! -- put obsdepth (a value meaningful only to UZF) in dblPak1
2284  obsrv%dblPak1 = obsdepth
2285  !
2286  ! -- determine maximum cell depth
2287  ! -- This is presently complicated for landflag = 1 cells and surfdep
2288  ! greater than zero. In this case, celtop is dis%top - surfdep.
2289  iuzid = obsrv%intPak1
2290  dmax = this%uzfobj%celtop(iuzid) - this%uzfobj%celbot(iuzid)
2291  ! -- check that obs depth is valid; call store_error if not
2292  ! -- need to think about a way to put bounds on this depth
2293  ! -- Also, an observation depth of 0.0, whether a landflag == 1 object
2294  ! -- or a subsurface object, is not legit since this would be at a
2295  ! -- a layer interface and therefore a discontinuity.
2296  if (obsdepth <= dzero .or. obsdepth > dmax) then
2297  write (errmsg, '(a,3(1x,a),1x,g0,1x,a,1x,g0,a)') &
2298  trim(adjustl(obsrv%ObsTypeId)), 'for observation', &
2299  trim(adjustl(obsrv%Name)), 'specified depth (', obsdepth, &
2300  ') must be greater than 0.0 and less than ', dmax, '.'
2301  call store_error(errmsg)
2302  end if
2303  else
2304  do j = 1, obsrv%indxbnds_count
2305  nn = obsrv%indxbnds(j)
2306  if (nn < 1 .or. nn > this%maxbound) then
2307  write (errmsg, '(a,2(1x,a),1x,i0,1x,a,1x,i0,a)') &
2308  trim(adjustl(obsrv%ObsTypeId)), 'uzfno must be greater than 0 ', &
2309  'and less than or equal to', this%maxbound, &
2310  '(specified value is ', nn, ').'
2311  call store_error(errmsg)
2312  end if
2313  end do
2314  end if
2315  end do
2316  !
2317  ! -- evaluate if there are any observation errors
2318  if (count_errors() > 0) then
2319  call store_error_unit(this%inunit)
2320  end if
2321  end if
2322  end subroutine uzf_rp_obs
2323 
2324  ! -- Procedures related to observations (NOT type-bound)
2325 
2326  !> @brief This procedure is pointed to by ObsDataType%ProcesssIdPtr
2327  !!
2328  !! Process the ID string of an observation definition for UZF-package
2329  !! observations
2330  !<
2331  subroutine uzf_process_obsid(obsrv, dis, inunitobs, iout)
2332  ! -- .
2333  ! -- dummy
2334  type(observetype), intent(inout) :: obsrv
2335  class(disbasetype), intent(in) :: dis
2336  integer(I4B), intent(in) :: inunitobs
2337  integer(I4B), intent(in) :: iout
2338  ! -- local
2339  integer(I4B) :: n, nn
2340  real(DP) :: obsdepth
2341  integer(I4B) :: icol, istart, istop, istat
2342  real(DP) :: r
2343  character(len=LINELENGTH) :: string
2344  ! formats
2345 30 format(i10)
2346  !
2347  string = obsrv%IDstring
2348  ! -- Extract node number from string and store it.
2349  ! If 1st item is not an integer(I4B), it should be a
2350  ! feature name--deal with it.
2351  icol = 1
2352  ! -- get node number
2353  call urword(string, icol, istart, istop, 1, n, r, iout, inunitobs)
2354  read (string(istart:istop), 30, iostat=istat) nn
2355  if (istat == 0) then
2356  ! -- store uzf node number (NodeNumber)
2357  obsrv%NodeNumber = nn
2358  else
2359  ! Integer can't be read from string; it's presumed to be a boundary
2360  ! name (already converted to uppercase)
2361  obsrv%FeatureName = string(istart:istop)
2362  !obsrv%FeatureName = trim(adjustl(string))
2363  ! -- Observation may require summing rates from multiple boundaries,
2364  ! so assign NodeNumber as a value that indicates observation
2365  ! is for a named boundary or group of boundaries.
2366  obsrv%NodeNumber = namedboundflag
2367  end if
2368  !
2369  ! -- for soil water observation, store depth
2370  if (obsrv%ObsTypeId == 'WATER-CONTENT') then
2371  call urword(string, icol, istart, istop, 3, n, r, iout, inunitobs)
2372  obsdepth = r
2373  ! -- store observations depth
2374  obsrv%Obsdepth = obsdepth
2375  end if
2376  end subroutine uzf_process_obsid
2377 
2378  !> @brief Allocate scalar members
2379  !<
2380  subroutine uzf_allocate_scalars(this)
2381  ! -- modules
2383  ! -- dummy
2384  class(uzftype) :: this
2385  !
2386  ! -- call standard BndExtType allocate scalars
2387  call this%BndExtType%allocate_scalars()
2388  !
2389  ! -- allocate uzf specific scalars
2390  call mem_allocate(this%iprwcont, 'IPRWCONT', this%memoryPath)
2391  call mem_allocate(this%iwcontout, 'IWCONTOUT', this%memoryPath)
2392  call mem_allocate(this%ibudgetout, 'IBUDGETOUT', this%memoryPath)
2393  call mem_allocate(this%ibudcsv, 'IBUDCSV', this%memoryPath)
2394  call mem_allocate(this%ipakcsv, 'IPAKCSV', this%memoryPath)
2395  call mem_allocate(this%ntrail_pvar, 'NTRAIL_PVAR', this%memoryPath)
2396  call mem_allocate(this%nsets, 'NSETS', this%memoryPath)
2397  call mem_allocate(this%nodes, 'NODES', this%memoryPath)
2398  call mem_allocate(this%istocb, 'ISTOCB', this%memoryPath)
2399  call mem_allocate(this%nwav_pvar, 'NWAV_PVAR', this%memoryPath)
2400  call mem_allocate(this%totfluxtot, 'TOTFLUXTOT', this%memoryPath)
2401  call mem_allocate(this%bditems, 'BDITEMS', this%memoryPath)
2402  call mem_allocate(this%nbdtxt, 'NBDTXT', this%memoryPath)
2403  call mem_allocate(this%issflag, 'ISSFLAG', this%memoryPath)
2404  call mem_allocate(this%issflagold, 'ISSFLAGOLD', this%memoryPath)
2405  call mem_allocate(this%readflag, 'READFLAG', this%memoryPath)
2406  call mem_allocate(this%iseepflag, 'ISEEPFLAG', this%memoryPath)
2407  call mem_allocate(this%imaxcellcnt, 'IMAXCELLCNT', this%memoryPath)
2408  call mem_allocate(this%ietflag, 'IETFLAG', this%memoryPath)
2409  call mem_allocate(this%igwetflag, 'IGWETFLAG', this%memoryPath)
2410  call mem_allocate(this%iuzf2uzf, 'IUZF2UZF', this%memoryPath)
2411  call mem_allocate(this%cbcauxitems, 'CBCAUXITEMS', this%memoryPath)
2412  !
2413  call mem_allocate(this%iconvchk, 'ICONVCHK', this%memoryPath)
2414  !
2415  ! -- initialize scalars
2416  this%iprwcont = 0
2417  this%iwcontout = 0
2418  this%ibudgetout = 0
2419  this%ibudcsv = 0
2420  this%ipakcsv = 0
2421  this%istocb = 0
2422  this%bditems = 7
2423  this%nbdtxt = 5
2424  this%issflag = 0
2425  this%issflagold = 0
2426  this%ietflag = 0
2427  this%igwetflag = 0
2428  this%iseepflag = 0
2429  this%imaxcellcnt = 0
2430  this%iuzf2uzf = 0
2431  this%cbcauxitems = 1
2432  this%imover = 0
2433  !
2434  ! -- convergence check
2435  this%iconvchk = 1
2436  end subroutine uzf_allocate_scalars
2437 
2438  !> @brief Deallocate objects
2439  !<
2440  subroutine uzf_da(this)
2441  ! -- modules
2443  ! -- dummy
2444  class(uzftype) :: this
2445  !
2446  ! -- deallocate uzf objects
2447  call this%uzfobj%dealloc()
2448  deallocate (this%uzfobj)
2449  nullify (this%uzfobj)
2450  !
2451  call this%budobj%budgetobject_da()
2452  deallocate (this%budobj)
2453  nullify (this%budobj)
2454  !
2455  ! -- character arrays
2456  deallocate (this%bdtxt)
2457  deallocate (this%cauxcbc)
2458  deallocate (this%uzfname)
2459  !
2460  ! -- package csv table
2461  if (this%ipakcsv > 0) then
2462  if (associated(this%pakcsvtab)) then
2463  call this%pakcsvtab%table_da()
2464  deallocate (this%pakcsvtab)
2465  nullify (this%pakcsvtab)
2466  end if
2467  end if
2468  !
2469  ! -- deallocate scalars
2470  call mem_deallocate(this%iprwcont)
2471  call mem_deallocate(this%iwcontout)
2472  call mem_deallocate(this%ibudgetout)
2473  call mem_deallocate(this%ibudcsv)
2474  call mem_deallocate(this%ipakcsv)
2475  call mem_deallocate(this%ntrail_pvar)
2476  call mem_deallocate(this%nsets)
2477  call mem_deallocate(this%nodes)
2478  call mem_deallocate(this%istocb)
2479  call mem_deallocate(this%nwav_pvar)
2480  call mem_deallocate(this%totfluxtot)
2481  call mem_deallocate(this%bditems)
2482  call mem_deallocate(this%nbdtxt)
2483  call mem_deallocate(this%issflag)
2484  call mem_deallocate(this%issflagold)
2485  call mem_deallocate(this%readflag)
2486  call mem_deallocate(this%iseepflag)
2487  call mem_deallocate(this%imaxcellcnt)
2488  call mem_deallocate(this%ietflag)
2489  call mem_deallocate(this%igwetflag)
2490  call mem_deallocate(this%iuzf2uzf)
2491  call mem_deallocate(this%cbcauxitems)
2492  !
2493  ! -- convergence check
2494  call mem_deallocate(this%iconvchk)
2495  !
2496  ! -- deallocate arrays
2497  call mem_deallocate(this%igwfnode)
2498  call mem_deallocate(this%appliedinf)
2499  call mem_deallocate(this%rejinf)
2500  call mem_deallocate(this%rejinf0)
2501  call mem_deallocate(this%rejinftomvr)
2502  call mem_deallocate(this%infiltration)
2503  call mem_deallocate(this%gwet_pvar)
2504  call mem_deallocate(this%uzet)
2505  call mem_deallocate(this%gwd)
2506  call mem_deallocate(this%gwd0)
2507  call mem_deallocate(this%gwdtomvr)
2508  call mem_deallocate(this%rch)
2509  call mem_deallocate(this%rch0)
2510  call mem_deallocate(this%qsto)
2511  call mem_deallocate(this%deriv)
2512  call mem_deallocate(this%qauxcbc)
2513  call mem_deallocate(this%wcnew)
2514  call mem_deallocate(this%wcold)
2515  !
2516  ! -- deallocate integer arrays
2517  call mem_deallocate(this%ia)
2518  call mem_deallocate(this%ja)
2519  !
2520  ! -- sinf_pvar/pet_pvar/extdp/extwc_pvar/ha_pvar/hroot_pvar/
2521  ! -- rootact_pvar/uauxvar are input context pointers
2522  !
2523  ! -- Parent object
2524  call this%BndExtType%bnd_da()
2525  end subroutine uzf_da
2526 
2527  !> @brief Set up the budget object that stores all the uzf flows
2528  !!
2529  !! The terms listed here must correspond in number and order to the ones
2530  !! listed in the uzf_fill_budobj routine
2531  !<
2532  subroutine uzf_setup_budobj(this)
2533  ! -- modules
2534  use constantsmodule, only: lenbudtxt
2535  ! -- dummy
2536  class(uzftype) :: this
2537  ! -- local
2538  integer(I4B) :: nbudterm
2539  integer(I4B) :: maxlist, naux
2540  integer(I4B) :: idx
2541  integer(I4B) :: nlen
2542  integer(I4B) :: n, n1, n2
2543  integer(I4B) :: ivertflag
2544  real(DP) :: q
2545  character(len=LENBUDTXT) :: text
2546  character(len=LENBUDTXT), dimension(1) :: auxtxt
2547  !
2548  ! -- Determine the number of uzf to uzf connections
2549  nlen = 0
2550  do n = 1, this%nodes
2551  ivertflag = this%uzfobj%ivertcon(n)
2552  if (ivertflag > 0) then
2553  nlen = nlen + 1
2554  end if
2555  end do
2556  !
2557  ! -- Determine the number of uzf budget terms. These are fixed for
2558  ! the simulation and cannot change. This includes FLOW-JA-FACE
2559  ! so they can be written to the binary budget files, but these internal
2560  ! flows are not included as part of the budget table.
2561  nbudterm = 4
2562  if (nlen > 0) nbudterm = nbudterm + 1
2563  if (this%ietflag /= 0) nbudterm = nbudterm + 1
2564  if (this%imover == 1) nbudterm = nbudterm + 2
2565  if (this%naux > 0) nbudterm = nbudterm + 1
2566  !
2567  ! -- set up budobj
2568  call budgetobject_cr(this%budobj, this%packName)
2569  call this%budobj%budgetobject_df(this%maxbound, nbudterm, 0, 0, &
2570  ibudcsv=this%ibudcsv)
2571  idx = 0
2572  !
2573  ! -- Go through and set up each budget term
2574  text = ' FLOW-JA-FACE'
2575  if (nlen > 0) then
2576  idx = idx + 1
2577  maxlist = nlen * 2
2578  naux = 1
2579  auxtxt(1) = ' FLOW-AREA'
2580  call this%budobj%budterm(idx)%initialize(text, &
2581  this%name_model, &
2582  this%packName, &
2583  this%name_model, &
2584  this%packName, &
2585  maxlist, .false., .false., &
2586  naux, auxtxt, ordered_id1=.false.)
2587  !
2588  ! -- store connectivity
2589  call this%budobj%budterm(idx)%reset(nlen * 2)
2590  q = dzero
2591  do n = 1, this%nodes
2592  ivertflag = this%uzfobj%ivertcon(n)
2593  if (ivertflag > 0) then
2594  n1 = n
2595  n2 = ivertflag
2596  call this%budobj%budterm(idx)%update_term(n1, n2, q)
2597  call this%budobj%budterm(idx)%update_term(n2, n1, -q)
2598  end if
2599  end do
2600  end if
2601  !
2602  ! --
2603  text = ' GWF'
2604  idx = idx + 1
2605  maxlist = this%nodes
2606  naux = 1
2607  auxtxt(1) = ' FLOW-AREA'
2608  call this%budobj%budterm(idx)%initialize(text, &
2609  this%name_model, &
2610  this%packName, &
2611  this%name_model, &
2612  this%name_model, &
2613  maxlist, .false., .true., &
2614  naux, auxtxt)
2615  call this%budobj%budterm(idx)%reset(this%nodes)
2616  q = dzero
2617  do n = 1, this%nodes
2618  n2 = this%igwfnode(n)
2619  this%qauxcbc(1) = this%uzfobj%uzfarea(n)
2620  call this%budobj%budterm(idx)%update_term(n, n2, q, this%qauxcbc)
2621  end do
2622  !
2623  ! --
2624  text = ' INFILTRATION'
2625  idx = idx + 1
2626  maxlist = this%nodes
2627  naux = 0
2628  call this%budobj%budterm(idx)%initialize(text, &
2629  this%name_model, &
2630  this%packName, &
2631  this%name_model, &
2632  this%packName, &
2633  maxlist, .false., .false., &
2634  naux)
2635  !
2636  ! --
2637  text = ' REJ-INF'
2638  idx = idx + 1
2639  maxlist = this%nodes
2640  naux = 0
2641  call this%budobj%budterm(idx)%initialize(text, &
2642  this%name_model, &
2643  this%packName, &
2644  this%name_model, &
2645  this%packName, &
2646  maxlist, .false., .false., &
2647  naux)
2648  !
2649  ! --
2650  text = ' UZET'
2651  if (this%ietflag /= 0) then
2652  idx = idx + 1
2653  maxlist = this%maxbound
2654  naux = 0
2655  call this%budobj%budterm(idx)%initialize(text, &
2656  this%name_model, &
2657  this%packName, &
2658  this%name_model, &
2659  this%packName, &
2660  maxlist, .false., .false., &
2661  naux)
2662  end if
2663  !
2664  ! --
2665  text = ' STORAGE'
2666  idx = idx + 1
2667  maxlist = this%nodes
2668  naux = 1
2669  auxtxt(1) = ' VOLUME'
2670  call this%budobj%budterm(idx)%initialize(text, &
2671  this%name_model, &
2672  this%packName, &
2673  this%name_model, &
2674  this%packName, &
2675  maxlist, .false., .false., &
2676  naux, auxtxt)
2677  !
2678  ! --
2679  if (this%imover == 1) then
2680  !
2681  ! --
2682  text = ' FROM-MVR'
2683  idx = idx + 1
2684  maxlist = this%nodes
2685  naux = 0
2686  call this%budobj%budterm(idx)%initialize(text, &
2687  this%name_model, &
2688  this%packName, &
2689  this%name_model, &
2690  this%packName, &
2691  maxlist, .false., .false., &
2692  naux)
2693  !
2694  ! --
2695  text = ' REJ-INF-TO-MVR'
2696  idx = idx + 1
2697  maxlist = this%nodes
2698  naux = 0
2699  call this%budobj%budterm(idx)%initialize(text, &
2700  this%name_model, &
2701  this%packName, &
2702  this%name_model, &
2703  this%packName, &
2704  maxlist, .false., .false., &
2705  naux)
2706  end if
2707  !
2708  ! --
2709  naux = this%naux
2710  if (naux > 0) then
2711  !
2712  ! --
2713  text = ' AUXILIARY'
2714  idx = idx + 1
2715  maxlist = this%maxbound
2716  call this%budobj%budterm(idx)%initialize(text, &
2717  this%name_model, &
2718  this%packName, &
2719  this%name_model, &
2720  this%packName, &
2721  maxlist, .false., .false., &
2722  naux, this%auxname)
2723  end if
2724  !
2725  ! -- if uzf flow for each reach are written to the listing file
2726  if (this%iprflow /= 0) then
2727  call this%budobj%flowtable_df(this%iout, cellids='GWF')
2728  end if
2729  end subroutine uzf_setup_budobj
2730 
2731  !> @brief Copy flow terms into this%budobj
2732  !<
2733  subroutine uzf_fill_budobj(this)
2734  ! -- dummy
2735  class(uzftype) :: this
2736  ! -- local
2737  integer(I4B) :: naux
2738  integer(I4B) :: nlen
2739  integer(I4B) :: ivertflag
2740  integer(I4B) :: n, n1, n2
2741  integer(I4B) :: idx
2742  real(DP) :: q
2743  real(DP) :: a
2744  real(DP) :: top
2745  real(DP) :: bot
2746  real(DP) :: thick
2747  real(DP) :: fm
2748  real(DP) :: v
2749  !
2750  ! -- initialize counter
2751  idx = 0
2752  !
2753  ! -- FLOW JA FACE
2754  nlen = 0
2755  do n = 1, this%nodes
2756  ivertflag = this%uzfobj%ivertcon(n)
2757  if (ivertflag > 0) then
2758  nlen = nlen + 1
2759  end if
2760  end do
2761  if (nlen > 0) then
2762  idx = idx + 1
2763  call this%budobj%budterm(idx)%reset(nlen * 2)
2764  do n = 1, this%nodes
2765  ivertflag = this%uzfobj%ivertcon(n)
2766  if (ivertflag > 0) then
2767  a = this%uzfobj%uzfarea(n)
2768  q = this%uzfobj%surfluxbelow(n) * a
2769  this%qauxcbc(1) = a
2770  if (q > dzero) then
2771  q = -q
2772  end if
2773  n1 = n
2774  n2 = ivertflag
2775  call this%budobj%budterm(idx)%update_term(n1, n2, q, this%qauxcbc)
2776  call this%budobj%budterm(idx)%update_term(n2, n1, -q, this%qauxcbc)
2777  end if
2778  end do
2779  end if
2780  !
2781  ! -- GWF (LEAKAGE)
2782  idx = idx + 1
2783  call this%budobj%budterm(idx)%reset(this%nodes)
2784  do n = 1, this%nodes
2785  this%qauxcbc(1) = this%uzfobj%uzfarea(n)
2786  n2 = this%igwfnode(n)
2787  q = -this%rch(n)
2788  call this%budobj%budterm(idx)%update_term(n, n2, q, this%qauxcbc)
2789  end do
2790  !
2791  ! -- INFILTRATION
2792  idx = idx + 1
2793  call this%budobj%budterm(idx)%reset(this%nodes)
2794  do n = 1, this%nodes
2795  q = this%appliedinf(n)
2796  call this%budobj%budterm(idx)%update_term(n, n, q)
2797  end do
2798  !
2799  ! -- REJECTED INFILTRATION
2800  idx = idx + 1
2801  call this%budobj%budterm(idx)%reset(this%nodes)
2802  do n = 1, this%nodes
2803  q = this%rejinf(n)
2804  if (q > dzero) then
2805  q = -q
2806  end if
2807  call this%budobj%budterm(idx)%update_term(n, n, q)
2808  end do
2809  !
2810  ! -- UNSATURATED EVT
2811  if (this%ietflag /= 0) then
2812  idx = idx + 1
2813  call this%budobj%budterm(idx)%reset(this%nodes)
2814  do n = 1, this%nodes
2815  q = this%uzet(n)
2816  if (q > dzero) then
2817  q = -q
2818  end if
2819  call this%budobj%budterm(idx)%update_term(n, n, q)
2820  end do
2821  end if
2822  !
2823  ! -- STORAGE
2824  idx = idx + 1
2825  call this%budobj%budterm(idx)%reset(this%nodes)
2826  do n = 1, this%nodes
2827  q = -this%qsto(n)
2828  top = this%uzfobj%celtop(n)
2829  bot = this%uzfobj%watab(n)
2830  thick = top - bot
2831  if (thick > dzero) then
2832  fm = thick * (this%wcnew(n) - this%uzfobj%thtr(n))
2833  v = fm * this%uzfobj%uzfarea(n)
2834  else
2835  v = dzero
2836  end if
2837  ! -- save mobile water volume into aux variable
2838  this%qauxcbc(1) = v
2839  call this%budobj%budterm(idx)%update_term(n, n, q, this%qauxcbc)
2840  end do
2841  !
2842  ! -- MOVER
2843  if (this%imover == 1) then
2844  !
2845  ! -- FROM MOVER
2846  idx = idx + 1
2847  call this%budobj%budterm(idx)%reset(this%nodes)
2848  do n = 1, this%nodes
2849  q = this%pakmvrobj%get_qfrommvr(n)
2850  call this%budobj%budterm(idx)%update_term(n, n, q)
2851  end do
2852  !
2853  ! -- REJ-INF-TO-MVR
2854  idx = idx + 1
2855  call this%budobj%budterm(idx)%reset(this%nodes)
2856  do n = 1, this%nodes
2857  q = this%rejinftomvr(n)
2858  if (q > dzero) then
2859  q = -q
2860  end if
2861  call this%budobj%budterm(idx)%update_term(n, n, q)
2862  end do
2863 
2864  end if
2865  !
2866  ! -- AUXILIARY VARIABLES
2867  naux = this%naux
2868  if (naux > 0) then
2869  idx = idx + 1
2870  call this%budobj%budterm(idx)%reset(this%nodes)
2871  do n = 1, this%nodes
2872  q = dzero
2873  call this%budobj%budterm(idx)%update_term(n, n, q, this%auxvar(:, n))
2874  end do
2875  end if
2876  !
2877  ! --Terms are filled, now accumulate them for this time step
2878  call this%budobj%accumulate_terms()
2879  end subroutine uzf_fill_budobj
2880 
2881 end module uzfmodule
This module contains the extended boundary package.
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.
This module contains the BudgetModule.
Definition: Budget.f90:20
subroutine, public rate_accumulator(flow, rin, rout)
@ brief Rate accumulator subroutine
Definition: Budget.f90:634
subroutine, public budgetobject_cr(this, name)
Create a new budget object.
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
real(dp), parameter dhdry
real dry cell constant
Definition: Constants.f90:94
@ tabcenter
centered table column
Definition: Constants.f90:173
@ tabright
right justified table column
Definition: Constants.f90:174
@ tableft
left justified table column
Definition: Constants.f90:172
@ mnormal
normal output mode
Definition: Constants.f90:207
@ tabucstring
upper case string table data
Definition: Constants.f90:181
@ tabstring
string table data
Definition: Constants.f90:180
@ tabreal
real table data
Definition: Constants.f90:183
@ tabinteger
integer table data
Definition: Constants.f90:182
integer(i4b), parameter lenpackagename
maximum length of the package name
Definition: Constants.f90:23
integer(i4b), parameter namedboundflag
named bound flag
Definition: Constants.f90:49
real(dp), parameter dnodata
real no data constant
Definition: Constants.f90:95
real(dp), parameter dhnoflo
real no flow constant
Definition: Constants.f90:93
real(dp), parameter dhundred
real constant 100
Definition: Constants.f90:86
integer(i4b), parameter lenpakloc
maximum length of a package location
Definition: Constants.f90:50
real(dp), parameter dem1
real constant 1e-1
Definition: Constants.f90:103
real(dp), parameter dhalf
real constant 1/2
Definition: Constants.f90:68
integer(i4b), parameter lenftype
maximum length of a package type (DIS, WEL, OC, etc.)
Definition: Constants.f90:39
integer(i4b), parameter lenboundname
maximum length of a bound name
Definition: Constants.f90:36
real(dp), parameter dem4
real constant 1e-4
Definition: Constants.f90:107
real(dp), parameter dem6
real constant 1e-6
Definition: Constants.f90:109
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:65
integer(i4b), parameter maxcharlen
maximum length of char string
Definition: Constants.f90:47
real(dp), parameter dem2
real constant 1e-2
Definition: Constants.f90:105
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
Definition: Constants.f90:37
real(dp), parameter done
real constant 1
Definition: Constants.f90:76
subroutine, public assign_iounit(iounit, errunit, description)
@ brief assign io unit number
integer(i4b) function, public getunit()
Get a free unit number.
subroutine, public ulasav(buf, text, kstp, kper, pertim, totim, ncol, nrow, ilay, ichn)
Save 1 layer array on disk.
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
Definition: InputOutput.f90:30
subroutine, public urword(line, icol, istart, istop, ncode, n, r, iout, in)
Extract a word from a string.
This module defines variable data types.
Definition: kind.f90:8
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
subroutine, public memorystore_release(varname, memory_path)
Release a single variable from the memory store.
This module contains the derived types ObserveType and ObsDataType.
Definition: Observe.f90:15
This module contains the derived type ObsType.
Definition: Obs.f90:127
character(len=20) access
Definition: OpenSpec.f90:7
character(len=20) form
Definition: OpenSpec.f90:7
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 deprecation_warning(cblock, cvar, cver, endmsg, iunit)
Store deprecation warning message.
Definition: Sim.f90:257
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
Definition: Sim.f90:204
subroutine, public store_error_unit(iunit, terminate)
Store the file unit number.
Definition: Sim.f90:169
This module contains simulation variables.
Definition: SimVariables.f90:9
character(len=maxcharlen) errmsg
error message string
integer(i4b) ifailedstepretry
current retry for this time step
character(len=maxcharlen) warnmsg
warning message string
subroutine, public table_cr(this, name, title)
Definition: Table.f90:87
real(dp), pointer, public pertim
time relative to start of stress period
Definition: tdis.f90:33
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
real(dp), pointer, public delt
length of the current time step
Definition: tdis.f90:32
subroutine uzf_source_packagedata(this)
Source PACKAGEDATA block from input context.
Definition: gwf-uzf.f90:1666
subroutine uzf_ar(this)
Allocate and Read.
Definition: gwf-uzf.f90:220
subroutine uzf_fc(this, rhs, ia, idxglo, matrix_sln)
Copy rhs and hcof into solution rhs and amat.
Definition: gwf-uzf.f90:899
subroutine uzf_ot_dv(this, idvsave, idvprint)
Save UZF-calculated values to binary file.
Definition: gwf-uzf.f90:1455
subroutine define_listlabel(this)
Define the list heading that is written to iout when PRINT_INPUT option is used.
Definition: gwf-uzf.f90:1617
subroutine uzf_da(this)
Deallocate objects.
Definition: gwf-uzf.f90:2441
logical function uzf_obs_supported(this)
Return true because uzf package supports observations.
Definition: gwf-uzf.f90:2040
subroutine uzf_setup_budobj(this)
Set up the budget object that stores all the uzf flows.
Definition: gwf-uzf.f90:2533
subroutine uzf_cq(this, x, flowja, iadv)
Calculate flows.
Definition: gwf-uzf.f90:1179
subroutine uzf_allocate_arrays(this)
Allocate arrays used for uzf.
Definition: gwf-uzf.f90:266
character(len=lenftype) ftype
Definition: gwf-uzf.f90:37
subroutine uzf_ot_bdsummary(this, kstp, kper, iout, ibudfl)
Write UZF budget to listing file.
Definition: gwf-uzf.f90:1482
subroutine uzf_process_obsid(obsrv, dis, inunitobs, iout)
This procedure is pointed to by ObsDataTypeProcesssIdPtr.
Definition: gwf-uzf.f90:2332
subroutine uzf_rp_obs(this)
Process each observation.
Definition: gwf-uzf.f90:2208
real(dp) function get_storage_change(top, bot, carea, hold, hnew, wcold, wcnew, thtr, delt, iss)
Definition: gwf-uzf.f90:1279
subroutine uzf_source_dimensions(this)
Source DIMENSIONS block from input context.
Definition: gwf-uzf.f90:522
subroutine uzf_cf(this)
Formulate the HCOF and RHS terms.
Definition: gwf-uzf.f90:878
subroutine uzf_fn(this, rhs, ia, idxglo, matrix_sln)
Fill newton terms.
Definition: gwf-uzf.f90:929
subroutine uzf_fill_budobj(this)
Copy flow terms into thisbudobj.
Definition: gwf-uzf.f90:2734
subroutine uzf_df_obs(this)
Implements bnd_df_obs.
Definition: gwf-uzf.f90:2052
subroutine uzf_ot_model_flows(this, icbcfl, ibudfl, icbcun, imap)
Write flows to binary file and/or print flows to budget.
Definition: gwf-uzf.f90:1352
subroutine findcellabove(this, n, nml)
Identify overlying cell ID based on user-specified mapping.
Definition: gwf-uzf.f90:1641
subroutine print_cell_properties(this)
Read UZF cell properties and set them for UZFCellGroup type.
Definition: gwf-uzf.f90:1876
subroutine uzf_bd(this, model_budget)
Add package ratin/ratout to model budget.
Definition: gwf-uzf.f90:1314
subroutine uzf_allocate_scalars(this)
Allocate scalar members.
Definition: gwf-uzf.f90:2381
subroutine uzf_rp(this)
Read stress data from input context.
Definition: gwf-uzf.f90:614
subroutine uzf_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
Final convergence check for package.
Definition: gwf-uzf.f90:951
subroutine, public uzf_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a New UZF Package and point packobj to the new package.
Definition: gwf-uzf.f90:179
subroutine check_cell_area(this)
Check UZF cell areas.
Definition: gwf-uzf.f90:1957
subroutine uzf_bd_obs(this)
Calculate observations this time step and call ObsTypeSaveOneSimval for each UzfType observation.
Definition: gwf-uzf.f90:2112
character(len=lenpackagename) text
Definition: gwf-uzf.f90:38
subroutine uzf_ot_package_flows(this, icbcfl, ibudfl)
Output UZF package flow terms.
Definition: gwf-uzf.f90:1427
subroutine uzf_solve(this, reset_state)
Formulate the HCOF and RHS terms.
Definition: gwf-uzf.f90:1497
subroutine uzf_ad(this)
Advance UZF Package.
Definition: gwf-uzf.f90:777
subroutine uzf_source_options(this)
Source OPTIONS block from input context.
Definition: gwf-uzf.f90:371
@ brief BndType
Derived type for the Budget object.
Definition: Budget.f90:40
This class is used to store a single deferred-length character string. It was designed to work in an ...
Definition: CharString.f90:23