30 character(len=LENFTYPE) ::
ftype =
'CDB'
31 character(len=16) ::
text =
' CDB'
35 integer(I4B),
dimension(:),
pointer,
contiguous :: idcxs => null()
36 real(dp),
dimension(:),
pointer,
contiguous :: width => null()
37 real(dp),
pointer :: gravconv => null()
70 subroutine cdb_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, &
71 mempath, dis, cxs, lengthconv, timeconv)
73 class(
bndtype),
pointer :: packobj
74 integer(I4B),
intent(in) :: id
75 integer(I4B),
intent(in) :: ibcnum
76 integer(I4B),
intent(in) :: inunit
77 integer(I4B),
intent(in) :: iout
78 character(len=*),
intent(in) :: namemodel
79 character(len=*),
intent(in) :: pakname
80 character(len=*),
intent(in) :: mempath
83 real(dp),
intent(in) :: lengthconv
84 real(dp),
intent(in) :: timeconv
93 call packobj%set_names(ibcnum, namemodel, pakname,
ftype, mempath)
97 call cdbobj%allocate_scalars()
100 call packobj%pack_initialize()
102 packobj%inunit = inunit
105 packobj%ibcnum = ibcnum
117 cdbobj%gravconv =
dgravity * lengthconv * timeconv**2
133 call this%BndExtType%allocate_scalars()
136 call mem_allocate(this%gravconv,
'GRAVCONV', this%memoryPath)
139 this%gravconv =
dzero
152 integer(I4B),
dimension(:),
pointer,
contiguous,
optional :: nodelist
153 real(DP),
dimension(:, :),
pointer,
contiguous,
optional :: auxvar
157 call this%BndExtType%allocate_arrays(nodelist, auxvar)
160 call mem_setptr(this%idcxs,
'IDCXS', this%input_mempath)
161 call mem_setptr(this%width,
'WIDTH', this%input_mempath)
164 call mem_checkin(this%idcxs,
'IDCXS', this%memoryPath, &
165 'IDCXS', this%input_mempath)
166 call mem_checkin(this%width,
'WIDTH', this%memoryPath, &
167 'WIDTH', this%input_mempath)
182 call this%BndExtType%bnd_da()
209 call this%BndExtType%source_options()
215 call this%log_cdb_options(found)
230 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text)) &
238 write (this%iout,
'(1x,a)') &
239 'END OF '//trim(adjustl(this%text))//
' OPTIONS'
251 if (this%iper /=
kper)
return
254 call this%BndExtType%bnd_rp()
257 if (this%iprpak /= 0)
then
258 call this%write_list()
274 integer(I4B) :: i, node
282 if (this%nbound == 0)
return
285 do i = 1, this%nbound
287 node = this%nodelist(i)
288 if (this%ibound(node) <= 0)
then
295 depth = this%xnew(node) - this%dis%bot(node)
298 q = this%qcalc(i, depth)
302 qeps = this%qcalc(i, depth + eps)
305 derv = (qeps - q) / eps
309 this%rhs(i) = -q + derv * this%xnew(node)
316 function qcalc(this, i, depth)
result(q)
320 integer(I4B),
intent(in) :: i
321 real(dp),
intent(in) :: depth
325 integer(I4B) :: idcxs
330 idcxs = this%idcxs(i)
331 width = this%width(i)
332 a = this%cxs%get_area(idcxs, width, depth)
333 r = this%cxs%get_hydraulic_radius(idcxs, width, depth, area=a)
335 q = this%gravconv * a**
dtwo * r
351 subroutine cdb_fc(this, rhs, ia, idxglo, matrix_sln)
354 real(DP),
dimension(:),
intent(inout) :: rhs
355 integer(I4B),
dimension(:),
intent(in) :: ia
356 integer(I4B),
dimension(:),
intent(in) :: idxglo
364 if (this%imover == 1)
then
365 call this%pakmvrobj%fc()
369 do i = 1, this%nbound
371 rhs(n) = rhs(n) + this%rhs(i)
373 call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
377 if (this%imover == 1 .and. this%rhs(i) >
dzero)
then
378 call this%pakmvrobj%accumulate_qformvr(i, this%rhs(i))
394 this%listlabel = trim(this%filtyp)//
' NO.'
395 if (this%dis%ndim == 3)
then
396 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
397 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'ROW'
398 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'COL'
399 elseif (this%dis%ndim == 2)
then
400 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
401 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'CELL2D'
403 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'NODE'
405 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'FLOW RATE'
406 if (this%inamedbound == 1)
then
407 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'BOUNDARY NAME'
441 call this%obs%StoreObsType(
'cdb', .true., indx)
446 call this%obs%StoreObsType(
'to-mvr', .true., indx)
466 call this%obs%obs_bd_clear()
469 do i = 1, this%obs%npakobs
470 obsrv => this%obs%pakobs(i)%obsrv
471 if (obsrv%BndFound)
then
472 do n = 1, obsrv%indxbnds_count
474 jj = obsrv%indxbnds(n)
475 select case (obsrv%ObsTypeId)
477 if (this%imover == 1)
then
478 v = this%pakmvrobj%get_qtomvr(jj)
486 errmsg =
'Unrecognized observation type: '//trim(obsrv%ObsTypeId)
489 call this%obs%SaveOneSimval(obsrv, v)
492 call this%obs%SaveOneSimval(obsrv,
dnodata)
509 integer(I4B) :: i, nlinks
513 nlinks = this%TsManager%boundtslinks%Count()
516 if (
associated(tslink))
then
517 if (tslink%JCol == 1)
then
535 integer(I4B),
intent(in) :: col
536 integer(I4B),
intent(in) :: row
542 bndval = this%idcxs(row)
544 bndval = this%width(row)
546 errmsg =
'Programming error. CDB bound value requested column '&
547 &
'outside range of ncolbnd (1).'
This module contains the extended boundary package.
This module contains the base boundary package.
This module contains simulation constants.
real(dp), parameter dnodata
real no data constant
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 dgravity
real constant gravitational acceleration (m/(s s))
real(dp), parameter dzero
real constant zero
real(dp), parameter dprec
real constant machine precision
real(dp), parameter dtwo
real constant 2
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
This module contains the CDB package methods.
subroutine cdb_allocate_arrays(this, nodelist, auxvar)
@ brief Allocate arrays
subroutine cdb_rp(this)
@ brief SWF read and prepare
subroutine, public cdb_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath, dis, cxs, lengthconv, timeconv)
@ brief Create a new package object
real(dp) function qcalc(this, i, depth)
Calculate critical depth boundary flow.
logical function cdb_obs_supported(this)
Determine if observations are supported.
subroutine log_cdb_options(this, found)
@ brief Log SWF specific package options
subroutine cdb_bd_obs(this)
Save observations for the package.
character(len=16) text
package flow text string
character(len=lenftype) ftype
package ftype
subroutine cdb_rp_ts(this)
Assign time series links for the package.
subroutine cdb_da(this)
@ brief Deallocate package memory
subroutine cdb_allocate_scalars(this)
@ brief Allocate scalars
subroutine cdb_options(this)
@ brief Source additional options for package
subroutine cdb_cf(this)
@ brief Formulate the package hcof and rhs terms.
subroutine cdb_df_obs(this)
Define the observation types available in the package.
subroutine cdb_fc(this, rhs, ia, idxglo, matrix_sln)
@ brief Copy hcof and rhs terms into solution.
subroutine define_listlabel(this)
@ brief Define the list label for the package
real(dp) function cdb_bound_value(this, col, row)
@ brief Return a bound value
integer(i4b), pointer, public kper
current stress period number
type(timeserieslinktype) function, pointer, public gettimeserieslinkfromlist(list, indx)
Get time series link from a list.