22 character(len=LENFTYPE) ::
ftype =
'CHD'
23 character(len=LENPACKAGENAME) ::
text =
' CHD'
26 real(dp),
dimension(:),
pointer,
contiguous :: head => null()
27 real(dp),
dimension(:),
pointer,
contiguous :: ratechdin => null()
28 real(dp),
dimension(:),
pointer,
contiguous :: ratechdout => null()
54 subroutine chd_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, &
57 class(
bndtype),
pointer :: packobj
58 integer(I4B),
intent(in) :: id
59 integer(I4B),
intent(in) :: ibcnum
60 integer(I4B),
intent(in) :: inunit
61 integer(I4B),
intent(in) :: iout
62 character(len=*),
intent(in) :: namemodel
63 character(len=*),
intent(in) :: pakname
64 character(len=*),
intent(in) :: mempath
66 type(
chdtype),
pointer :: chdobj
73 call packobj%set_names(ibcnum, namemodel, pakname,
ftype, mempath)
77 call chdobj%allocate_scalars()
80 call packobj%pack_initialize()
83 packobj%inunit = inunit
86 packobj%ibcnum = ibcnum
98 integer(I4B),
dimension(:),
pointer,
contiguous,
optional :: nodelist
99 real(DP),
dimension(:, :),
pointer,
contiguous,
optional :: auxvar
104 call this%BndExtType%allocate_arrays(nodelist, auxvar)
107 call mem_allocate(this%ratechdin, this%maxbound,
'RATECHDIN', this%memoryPath)
108 call mem_allocate(this%ratechdout, this%maxbound,
'RATECHDOUT', &
110 do i = 1, this%maxbound
111 this%ratechdin(i) =
dzero
112 this%ratechdout(i) =
dzero
116 call mem_setptr(this%head,
'HEAD', this%input_mempath)
119 call mem_checkin(this%head,
'HEAD', this%memoryPath, &
120 'HEAD', this%input_mempath)
129 class(
chdtype),
intent(inout) :: this
131 character(len=30) :: nodestr
132 integer(I4B) :: i, node, ibd, ierr
134 if (this%iper /=
kper)
return
137 do i = 1, this%nbound
138 node = this%nodelist(i)
139 this%ibound(node) = this%ibcnum
143 call this%BndExtType%bnd_rp()
147 do i = 1, this%nbound
148 node = this%nodelist(i)
149 ibd = this%ibound(node)
151 call this%dis%noder_to_string(node, nodestr)
153 'Cell is already a constant head (', trim(adjustl(nodestr)),
').'
157 this%ibound(node) = -this%ibcnum
176 integer(I4B) :: i, node
181 do i = 1, this%nbound
182 node = this%nodelist(i)
183 hb = this%head_mult(i)
186 this%xold(node) = this%xnew(node)
192 call this%obs%obs_ad()
200 class(
chdtype),
intent(inout) :: this
202 character(len=30) :: nodestr
207 character(len=*),
parameter :: fmtchderr = &
208 "('CHD BOUNDARY ',i0,' HEAD (',g0,') IS LESS THAN CELL &
209 &BOTTOM (',g0,')',' FOR CELL ',a)"
212 do i = 1, this%nbound
213 node = this%nodelist(i)
214 bt = this%dis%bot(node)
216 if (this%head_mult(i) < bt .and. this%icelltype(node) /= 0)
then
217 call this%dis%noder_to_string(node, nodestr)
218 write (
errmsg, fmt=fmtchderr) i, this%head_mult(i), bt, trim(nodestr)
234 subroutine chd_fc(this, rhs, ia, idxglo, matrix_sln)
237 real(DP),
dimension(:),
intent(inout) :: rhs
238 integer(I4B),
dimension(:),
intent(in) :: ia
239 integer(I4B),
dimension(:),
intent(in) :: idxglo
249 class(
chdtype),
intent(inout) :: this
250 real(DP),
dimension(:),
intent(in) :: x
251 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
252 integer(I4B),
optional,
intent(in) :: iadv
263 class(
chdtype),
intent(inout) :: this
269 integer(I4B) :: idiag
271 real(DP) :: ratein, rateout
275 if (this%nbound > 0)
then
278 do i = 1, this%nbound
279 node = this%nodelist(i)
280 idiag = this%dis%con%ia(node)
286 do ipos = this%dis%con%ia(node) + 1, &
287 this%dis%con%ia(node + 1) - 1
288 q = this%flowja(ipos)
292 n2 = this%dis%con%ja(ipos)
293 if (this%ibound(n2) > 0)
then
297 rateout = rateout + q
308 this%simvals(i) = rate
309 this%ratechdin(i) = ratein
310 this%ratechdout(i) = rateout
311 this%flowja(idiag) = this%flowja(idiag) + rate
325 type(
budgettype),
intent(inout) :: model_budget
329 integer(I4B) :: isuppress_output
335 call this%calc_chd_rate()
340 call model_budget%addentry(ratin, ratout,
delt, this%text, &
341 isuppress_output, this%packName)
353 call this%BndExtType%bnd_da()
365 class(
chdtype),
intent(inout) :: this
368 this%listlabel = trim(this%filtyp)//
' NO.'
369 if (this%dis%ndim == 3)
then
370 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
371 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'ROW'
372 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'COL'
373 elseif (this%dis%ndim == 2)
then
374 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
375 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'CELL2D'
377 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'NODE'
379 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'HEAD'
380 if (this%inamedbound == 1)
then
381 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'BOUNDARY NAME'
411 call this%obs%StoreObsType(
'chd', .true., indx)
421 class(
chdtype),
intent(inout) :: this
422 integer(I4B),
intent(in) :: row
426 if (this%iauxmultcol > 0)
then
427 head = this%head(row) * this%auxvar(this%iauxmultcol, row)
429 head = this%head(row)
442 class(
chdtype),
intent(inout) :: this
443 integer(I4B),
intent(in) :: col
444 integer(I4B),
intent(in) :: row
450 bndval = this%head_mult(row)
452 errmsg =
'Programming error. CHD bound value requested column '&
453 &
'outside range of ncolbnd (1).'
This module contains the extended boundary package.
This module contains the base boundary package.
This module contains the BudgetModule.
subroutine, public rate_accumulator(flow, rin, rout)
@ brief Rate accumulator subroutine
subroutine chd_ck(this)
Check constant concentration/temperature boundary condition data.
character(len=lenpackagename) text
subroutine calc_chd_rate(this)
Calculate the CHD cell rates, to be called.
subroutine chd_da(this)
Deallocate memory.
subroutine define_listlabel(this)
Define the list heading that is written to iout when PRINT_INPUT option is used.
subroutine chd_cq(this, x, flowja, iadv)
Calculate flow associated with constant head boundary.
character(len=lenftype) ftype
real(dp) function chd_bound_value(this, col, row)
@ brief Return a bound value
subroutine chd_df_obs(this)
Overrides bnd_df_obs from bndType class.
subroutine chd_rp(this)
Constant concentration/temperature read and prepare (rp) routine.
subroutine chd_ad(this)
Constant head package advance routine.
subroutine, public chd_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a new constant head package.
real(dp) function head_mult(this, row)
Apply auxiliary multiplier to specified head if appropriate.
subroutine chd_allocate_arrays(this, nodelist, auxvar)
Allocate arrays specific to the constant head package.
logical function chd_obs_supported(this)
Overrides bnd_obs_supported from bndType class.
subroutine chd_bd(this, model_budget)
Add package ratin/ratout to model budget.
subroutine chd_fc(this, rhs, ia, idxglo, matrix_sln)
Override bnd_fc and do nothing.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lenpackagename
maximum length of the package name
integer(i4b), parameter namedboundflag
named bound flag
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.
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.
integer(i4b) function, public count_errors()
Return number of errors.
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), pointer, public kper
current stress period number
real(dp), pointer, public delt
length of the current time step
type(timeserieslinktype) function, pointer, public gettimeserieslinkfromlist(list, indx)
Get time series link from a list.
Derived type for the Budget object.