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()
69 subroutine cdb_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, &
70 mempath, dis, cxs, lengthconv, timeconv)
72 class(
bndtype),
pointer :: packobj
73 integer(I4B),
intent(in) :: id
74 integer(I4B),
intent(in) :: ibcnum
75 integer(I4B),
intent(in) :: inunit
76 integer(I4B),
intent(in) ::
iout
77 character(len=*),
intent(in) :: namemodel
78 character(len=*),
intent(in) :: pakname
79 character(len=*),
intent(in) :: mempath
82 real(dp),
intent(in) :: lengthconv
83 real(dp),
intent(in) :: timeconv
92 call packobj%set_names(ibcnum, namemodel, pakname,
ftype, mempath)
96 call cdbobj%allocate_scalars()
99 call packobj%pack_initialize()
101 packobj%inunit = inunit
104 packobj%ibcnum = ibcnum
116 cdbobj%gravconv =
dgravity * lengthconv * timeconv**2
132 call this%BndExtType%allocate_scalars()
135 call mem_allocate(this%gravconv,
'GRAVCONV', this%memoryPath)
138 this%gravconv =
dzero
151 integer(I4B),
dimension(:),
pointer,
contiguous,
optional :: nodelist
152 real(DP),
dimension(:, :),
pointer,
contiguous,
optional :: auxvar
156 call this%BndExtType%allocate_arrays(nodelist, auxvar)
159 call mem_setptr(this%idcxs,
'IDCXS', this%input_mempath)
160 call mem_setptr(this%width,
'WIDTH', this%input_mempath)
163 call mem_checkin(this%idcxs,
'IDCXS', this%memoryPath, &
164 'IDCXS', this%input_mempath)
165 call mem_checkin(this%width,
'WIDTH', this%memoryPath, &
166 'WIDTH', this%input_mempath)
181 call this%BndExtType%bnd_da()
205 call this%BndExtType%source_options()
211 call this%log_cdb_options()
223 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text)) &
227 write (this%iout,
'(1x,a)') &
228 'END OF '//trim(adjustl(this%text))//
' OPTIONS'
243 integer(I4B) :: i, node
251 if (this%nbound == 0)
return
254 do i = 1, this%nbound
256 node = this%nodelist(i)
257 if (this%ibound(node) <= 0)
then
264 depth = this%xnew(node) - this%dis%bot(node)
267 q = this%qcalc(i, depth)
271 qeps = this%qcalc(i, depth + eps)
274 derv = (qeps - q) / eps
278 this%rhs(i) = -q + derv * this%xnew(node)
285 function qcalc(this, i, depth)
result(q)
289 integer(I4B),
intent(in) :: i
290 real(dp),
intent(in) :: depth
294 integer(I4B) :: idcxs
299 idcxs = this%idcxs(i)
300 width = this%width(i)
301 a = this%cxs%get_area(idcxs, width, depth)
302 r = this%cxs%get_hydraulic_radius(idcxs, width, depth, area=a)
304 q = this%gravconv * a**
dtwo * r
320 subroutine cdb_fc(this, rhs, ia, idxglo, matrix_sln)
323 real(DP),
dimension(:),
intent(inout) :: rhs
324 integer(I4B),
dimension(:),
intent(in) :: ia
325 integer(I4B),
dimension(:),
intent(in) :: idxglo
333 if (this%imover == 1)
then
334 call this%pakmvrobj%fc()
338 do i = 1, this%nbound
340 rhs(n) = rhs(n) + this%rhs(i)
342 call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
346 if (this%imover == 1 .and. this%rhs(i) >
dzero)
then
347 call this%pakmvrobj%accumulate_qformvr(i, this%rhs(i))
363 this%listlabel = trim(this%filtyp)//
' NO.'
364 if (this%dis%ndim == 3)
then
365 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
366 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'ROW'
367 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'COL'
368 elseif (this%dis%ndim == 2)
then
369 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
370 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'CELL2D'
372 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'NODE'
374 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'FLOW RATE'
375 if (this%inamedbound == 1)
then
376 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'BOUNDARY NAME'
410 call this%obs%StoreObsType(
'cdb', .true., indx)
415 call this%obs%StoreObsType(
'to-mvr', .true., indx)
435 call this%obs%obs_bd_clear()
438 do i = 1, this%obs%npakobs
439 obsrv => this%obs%pakobs(i)%obsrv
440 if (obsrv%BndFound)
then
441 do n = 1, obsrv%indxbnds_count
443 jj = obsrv%indxbnds(n)
444 select case (obsrv%ObsTypeId)
446 if (this%imover == 1)
then
447 v = this%pakmvrobj%get_qtomvr(jj)
455 errmsg =
'Unrecognized observation type: '//trim(obsrv%ObsTypeId)
458 call this%obs%SaveOneSimval(obsrv, v)
461 call this%obs%SaveOneSimval(obsrv,
dnodata)
478 integer(I4B) :: i, nlinks
482 nlinks = this%TsManager%boundtslinks%Count()
485 if (
associated(tslink))
then
486 if (tslink%JCol == 1)
then
504 integer(I4B),
intent(in) :: col
505 integer(I4B),
intent(in) :: row
511 bndval = this%idcxs(row)
513 bndval = this%width(row)
515 errmsg =
'Programming error. CDB bound value requested column '&
516 &
'outside range of ncolbnd (1).'
This module contains the extended boundary package.
real(dp) function bound_value(this, col, row)
Return a bound value.
subroutine source_options(this)
Source package options from input context.
This module contains the base boundary package.
logical(lgp) function bnd_obs_supported(this)
Determine if observations are supported.
subroutine allocate_scalars(this)
Allocate package scalars.
subroutine bnd_rp_ts(this)
Assign time series links for the package.
subroutine bnd_bd_obs(this)
Save observations for the package.
subroutine bnd_da(this)
Deallocate package memory.
subroutine bnd_fc(this, rhs, ia, idxglo, matrix_sln)
Copy hcof and rhs terms into solution.
subroutine allocate_arrays(this, nodelist, auxvar)
Allocate package arrays.
subroutine bnd_df_obs(this)
Define the observation types available in the package.
subroutine bnd_cf(this)
Formulate the package hcof and rhs terms.
subroutine define_listlabel(this)
Define the list label for the package.
This module contains simulation constants.
real(dp), parameter dnodata
real no data constant
@ dis
DIS6 discretization.
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)
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
integer(i4b) iout
file unit number for simulation output
This module contains the CDB package methods.
subroutine cdb_allocate_arrays(this, nodelist, auxvar)
Allocate arrays.
subroutine, public cdb_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath, dis, cxs, lengthconv, timeconv)
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 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 log_cdb_options(this)
Log SWF specific package options.
subroutine cdb_da(this)
Deallocate package memory.
subroutine cdb_allocate_scalars(this)
Allocate scalars.
subroutine cdb_options(this)
Source additional options for package.
subroutine cdb_cf(this)
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)
Copy hcof and rhs terms into solution.
real(dp) function cdb_bound_value(this, col, row)
Return a bound value.
type(timeserieslinktype) function, pointer, public gettimeserieslinkfromlist(list, indx)
Get time series link from a list.