34 character(len=LENFTYPE) ::
ftype =
'ZDG'
35 character(len=16) ::
text =
' ZDG'
39 integer(I4B),
dimension(:),
pointer,
contiguous :: idcxs => null()
40 real(dp),
dimension(:),
pointer,
contiguous :: width => null()
41 real(dp),
dimension(:),
pointer,
contiguous :: slope => null()
42 real(dp),
dimension(:),
pointer,
contiguous :: rough => null()
43 real(dp),
pointer :: unitconv => null()
77 subroutine zdg_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, &
78 mempath, dis, cxs, unitconv)
80 class(
bndtype),
pointer :: packobj
81 integer(I4B),
intent(in) :: id
82 integer(I4B),
intent(in) :: ibcnum
83 integer(I4B),
intent(in) :: inunit
84 integer(I4B),
intent(in) :: iout
85 character(len=*),
intent(in) :: namemodel
86 character(len=*),
intent(in) :: pakname
87 character(len=*),
intent(in) :: mempath
90 real(dp),
intent(in) :: unitconv
99 call packobj%set_names(ibcnum, namemodel, pakname,
ftype, mempath)
103 call zdgobj%allocate_scalars()
106 call packobj%pack_initialize()
108 packobj%inunit = inunit
111 packobj%ibcnum = ibcnum
126 zdgobj%unitconv = unitconv
142 call this%BndExtType%allocate_scalars()
145 call mem_allocate(this%unitconv,
'UNITCONV', this%memoryPath)
148 this%unitconv =
dzero
161 integer(I4B),
dimension(:),
pointer,
contiguous,
optional :: nodelist
162 real(DP),
dimension(:, :),
pointer,
contiguous,
optional :: auxvar
166 call this%BndExtType%allocate_arrays(nodelist, auxvar)
169 call mem_setptr(this%idcxs,
'IDCXS', this%input_mempath)
170 call mem_setptr(this%width,
'WIDTH', this%input_mempath)
171 call mem_setptr(this%slope,
'SLOPE', this%input_mempath)
172 call mem_setptr(this%rough,
'ROUGH', this%input_mempath)
175 call mem_checkin(this%idcxs,
'IDCXS', this%memoryPath, &
176 'IDCXS', this%input_mempath)
177 call mem_checkin(this%width,
'WIDTH', this%memoryPath, &
178 'WIDTH', this%input_mempath)
179 call mem_checkin(this%slope,
'SLOPE', this%memoryPath, &
180 'SLOPE', this%input_mempath)
181 call mem_checkin(this%rough,
'ROUGH', this%memoryPath, &
182 'ROUGH', this%input_mempath)
197 call this%BndExtType%bnd_da()
226 call this%BndExtType%source_options()
232 call this%log_zdg_options(found)
247 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text)) &
255 write (this%iout,
'(1x,a)') &
256 'END OF '//trim(adjustl(this%text))//
' OPTIONS'
268 if (this%iper /=
kper)
return
271 call this%BndExtType%bnd_rp()
274 if (this%iprpak /= 0)
then
275 call this%write_list()
292 integer(I4B) :: i, node
295 real(DP) :: absdhdxsq
299 real(DP) :: range = 1.d-6
301 real(DP) :: smooth_factor
304 if (this%nbound == 0)
return
307 do i = 1, this%nbound
309 node = this%nodelist(i)
310 if (this%ibound(node) <= 0)
then
317 absdhdxsq = this%slope(i)**
dhalf
318 depth = this%xnew(node) - this%dis%bot(node)
321 call squadratic(depth, range, dydx, smooth_factor)
322 depth = depth * smooth_factor
325 q = -this%qcalc(i, depth, this%unitconv)
329 qeps = -this%qcalc(i, depth + eps, this%unitconv)
332 derv = (qeps - q) / eps
336 this%rhs(i) = -q + derv * this%xnew(node)
346 function qcalc(this, i, depth, unitconv)
result(q)
349 integer(I4B),
intent(in) :: i
350 real(dp),
intent(in) :: depth
351 real(dp),
intent(in) :: unitconv
355 integer(I4B) :: idcxs
359 real(dp) :: conveyance
361 idcxs = this%idcxs(i)
362 width = this%width(i)
363 rough = this%rough(i)
364 slope = this%slope(i)
365 conveyance = this%cxs%get_conveyance(idcxs, width, depth, rough)
366 q = conveyance * slope**
dhalf * unitconv
376 subroutine zdg_fc(this, rhs, ia, idxglo, matrix_sln)
379 real(DP),
dimension(:),
intent(inout) :: rhs
380 integer(I4B),
dimension(:),
intent(in) :: ia
381 integer(I4B),
dimension(:),
intent(in) :: idxglo
389 if (this%imover == 1)
then
390 call this%pakmvrobj%fc()
394 do i = 1, this%nbound
396 rhs(n) = rhs(n) + this%rhs(i)
398 call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
402 if (this%imover == 1 .and. this%rhs(i) >
dzero)
then
403 call this%pakmvrobj%accumulate_qformvr(i, this%rhs(i))
419 this%listlabel = trim(this%filtyp)//
' NO.'
420 if (this%dis%ndim == 3)
then
421 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
422 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'ROW'
423 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'COL'
424 elseif (this%dis%ndim == 2)
then
425 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
426 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'CELL2D'
428 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'NODE'
430 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'FLOW RATE'
431 if (this%inamedbound == 1)
then
432 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'BOUNDARY NAME'
466 call this%obs%StoreObsType(
'zdg', .true., indx)
471 call this%obs%StoreObsType(
'to-mvr', .true., indx)
491 call this%obs%obs_bd_clear()
494 do i = 1, this%obs%npakobs
495 obsrv => this%obs%pakobs(i)%obsrv
496 if (obsrv%BndFound)
then
497 do n = 1, obsrv%indxbnds_count
499 jj = obsrv%indxbnds(n)
500 select case (obsrv%ObsTypeId)
502 if (this%imover == 1)
then
503 v = this%pakmvrobj%get_qtomvr(jj)
511 errmsg =
'Unrecognized observation type: '//trim(obsrv%ObsTypeId)
514 call this%obs%SaveOneSimval(obsrv, v)
517 call this%obs%SaveOneSimval(obsrv,
dnodata)
534 integer(I4B) :: i, nlinks
538 nlinks = this%TsManager%boundtslinks%Count()
541 if (
associated(tslink))
then
542 if (tslink%JCol == 1)
then
560 integer(I4B),
intent(in) :: col
561 integer(I4B),
intent(in) :: row
567 bndval = this%idcxs(row)
569 bndval = this%width(row)
571 bndval = this%slope(row)
573 bndval = this%rough(row)
575 errmsg =
'Programming error. ZDG bound value requested column '&
576 &
'outside range of ncolbnd (1).'
This module contains block parser methods.
This module contains the extended boundary package.
This module contains the base boundary package.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
real(dp), parameter dtwothirds
real constant 2/3
real(dp), parameter dnodata
real no data constant
real(dp), parameter dem1
real constant 1e-1
real(dp), parameter dhalf
real constant 1/2
integer(i4b), parameter lenftype
maximum length of a package type (DIS, WEL, OC, etc.)
real(dp), parameter dzero
real constant zero
real(dp), parameter done
real constant 1
This module defines variable data types.
real(dp) function, public get_perturbation(x)
Calculate a numerical perturbation given the value of x.
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
This module contains the derived types ObserveType and ObsDataType.
This module contains the derived type ObsType.
subroutine, public defaultobsidprocessor(obsrv, dis, inunitobs, iout)
@ brief Process IDstring provided for each observation
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
subroutine squadratic(x, range, dydx, y)
@ brief sQuadratic
real(dp) function sqsaturationderivative(top, bot, x, c1, c2)
@ brief sQSaturationDerivative
real(dp) function sqsaturation(top, bot, x, c1, c2)
@ brief sQSaturation
This module contains the ZDG package methods.
subroutine zdg_allocate_scalars(this)
@ brief Allocate scalars
subroutine define_listlabel(this)
@ brief Define the list label for the package
logical function zdg_obs_supported(this)
Determine if observations are supported.
subroutine zdg_cf(this)
@ brief Formulate the package hcof and rhs terms.
subroutine zdg_fc(this, rhs, ia, idxglo, matrix_sln)
@ brief Copy hcof and rhs terms into solution.
real(dp) function zdg_bound_value(this, col, row)
@ brief Return a bound value
subroutine log_zdg_options(this, found)
@ brief Log SWF specific package options
subroutine, public zdg_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath, dis, cxs, unitconv)
@ brief Create a new package object
subroutine zdg_rp_ts(this)
Assign time series links for the package.
character(len=16) text
package flow text string
subroutine zdg_da(this)
@ brief Deallocate package memory
subroutine zdg_options(this)
@ brief Source additional options for package
subroutine zdg_rp(this)
@ brief SWF read and prepare
character(len=lenftype) ftype
package ftype
subroutine zdg_allocate_arrays(this, nodelist, auxvar)
@ brief Allocate arrays
subroutine zdg_bd_obs(this)
Save observations for the package.
real(dp) function qcalc(this, i, depth, unitconv)
subroutine zdg_df_obs(this)
Define the observation types available in the package.
integer(i4b), pointer, public kper
current stress period number
type(timeserieslinktype) function, pointer, public gettimeserieslinkfromlist(list, indx)
Get time series link from a list.