21 character(len=LENFTYPE) ::
ftype =
'DRN'
22 character(len=LENPACKAGENAME) ::
text =
' DRN'
26 real(dp),
dimension(:),
pointer,
contiguous :: elev => null()
27 real(dp),
dimension(:),
pointer,
contiguous :: cond => null()
28 integer(I4B),
pointer :: iauxddrncol => null()
29 integer(I4B),
pointer :: icubic_scaling => null()
58 subroutine drn_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, &
61 class(
bndtype),
pointer :: packobj
62 integer(I4B),
intent(in) :: id
63 integer(I4B),
intent(in) :: ibcnum
64 integer(I4B),
intent(in) :: inunit
65 integer(I4B),
intent(in) :: iout
66 character(len=*),
intent(in) :: namemodel
67 character(len=*),
intent(in) :: pakname
68 character(len=*),
intent(in) :: mempath
70 type(
drntype),
pointer :: drnobj
77 call packobj%set_names(ibcnum, namemodel, pakname,
ftype, mempath)
81 call drnobj%allocate_scalars()
84 call packobj%pack_initialize()
87 packobj%inunit = inunit
90 packobj%ibcnum = ibcnum
103 call this%BndExtType%bnd_da()
123 call this%BndExtType%allocate_scalars()
126 call mem_allocate(this%iauxddrncol,
'IAUXDDRNCOL', this%memoryPath)
127 call mem_allocate(this%icubic_scaling,
'ICUBIC_SCALING', this%memoryPath)
131 if (this%inewton /= 0)
then
132 this%icubic_scaling = 1
134 this%icubic_scaling = 0
145 integer(I4B),
dimension(:),
pointer,
contiguous,
optional :: nodelist
146 real(DP),
dimension(:, :),
pointer,
contiguous,
optional :: auxvar
149 call this%BndExtType%allocate_arrays(nodelist, auxvar)
152 call mem_setptr(this%elev,
'ELEV', this%input_mempath)
153 call mem_setptr(this%cond,
'COND', this%input_mempath)
156 call mem_checkin(this%elev,
'ELEV', this%memoryPath, &
157 'ELEV', this%input_mempath)
158 call mem_checkin(this%cond,
'COND', this%memoryPath, &
159 'COND', this%input_mempath)
167 class(
drntype),
intent(inout) :: this
169 if (this%iper /=
kper)
return
172 call this%BndExtType%bnd_rp()
175 if (this%ivsc == 1)
then
176 call this%drn_store_user_cond()
180 if (this%iprpak /= 0)
then
181 call this%write_list()
194 class(
drntype),
intent(inout) :: this
197 character(len=LENAUXNAME) :: ddrnauxname
201 call this%BndExtType%source_options()
204 call mem_set_value(this%imover,
'MOVER', this%input_mempath, found%mover)
205 call mem_set_value(ddrnauxname,
'AUXDEPTHNAME', this%input_mempath, &
207 call mem_set_value(this%icubic_scaling,
'ICUBICSFAC', this%input_mempath, &
210 if (found%auxdepthname)
then
211 this%iauxddrncol = -1
214 if (this%naux == 0)
then
215 write (
errmsg,
'(a,2(1x,a))') &
216 'AUXDEPTHNAME was specified as', trim(adjustl(ddrnauxname)), &
217 'but no AUX variables specified.'
224 if (ddrnauxname == this%auxname(n))
then
231 if (this%iauxddrncol == 0)
then
232 write (
errmsg,
'(a,2(1x,a))') &
233 'AUXDEPTHNAME was specified as', trim(adjustl(ddrnauxname)), &
234 'but no AUX variable found with this name.'
240 call this%log_drn_options(found)
249 class(
drntype),
intent(inout) :: this
255 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text)) &
258 if (found%mover)
then
259 write (this%iout,
'(4x,A)')
'MOVER OPTION ENABLED'
262 if (found%icubicsfac)
then
263 write (this%iout,
'(4x,a,1x,a)') &
264 'CUBIC SCALING will be used for drains with non-zero DDRN values', &
265 'even if the NEWTON-RAPHSON method is not being used.'
269 write (this%iout,
'(1x,a)') &
270 'END OF '//trim(adjustl(this%text))//
' OPTIONS'
277 class(
drntype),
intent(inout) :: this
286 character(len=*),
parameter :: fmtddrnerr = &
287 "('SCALED-CONDUCTANCE DRN BOUNDARY (',i0,') BOTTOM ELEVATION &
288 &(',f10.3,') IS LESS THAN CELL BOTTOM (',f10.3,')')"
289 character(len=*),
parameter :: fmtdrnerr = &
290 "('DRN BOUNDARY (',i0,') ELEVATION (',f10.3,') IS LESS THAN CELL &
291 &BOTTOM (',f10.3,')')"
292 character(len=*),
parameter :: fmtcondmulterr = &
293 "('DRN BOUNDARY (',i0,') CONDUCTANCE MULTIPLIER (',g10.3,') IS &
295 character(len=*),
parameter :: fmtconderr = &
296 "('DRN BOUNDARY (',i0,') CONDUCTANCE (',g10.3,') IS LESS THAN &
300 do i = 1, this%nbound
301 node = this%nodelist(i)
302 bt = this%dis%bot(node)
306 call this%get_drain_elevations(i, drndepth, drntop, drnbot)
309 if (drnbot < bt .and. this%icelltype(node) /= 0)
then
310 if (drndepth /=
dzero)
then
311 write (
errmsg, fmt=fmtddrnerr) i, drnbot, bt
313 write (
errmsg, fmt=fmtdrnerr) i, drnbot, bt
317 if (this%iauxmultcol > 0)
then
318 if (this%auxvar(this%iauxmultcol, i) <
dzero)
then
319 write (
errmsg, fmt=fmtcondmulterr) &
320 i, this%auxvar(this%iauxmultcol, i)
324 if (this%cond(i) <
dzero)
then
325 write (
errmsg, fmt=fmtconderr) i, this%cond(i)
351 if (this%nbound == 0)
return
354 do i = 1, this%nbound
355 node = this%nodelist(i)
356 if (this%ibound(node) <= 0)
then
363 cdrn = this%cond_mult(i)
367 call this%get_drain_factor(i, fact, drnbot)
370 this%rhs(i) = -fact * cdrn * drnbot
371 this%hcof(i) = -fact * cdrn
377 subroutine drn_fc(this, rhs, ia, idxglo, matrix_sln)
380 real(DP),
dimension(:),
intent(inout) :: rhs
381 integer(I4B),
dimension(:),
intent(in) :: ia
382 integer(I4B),
dimension(:),
intent(in) :: idxglo
394 if (this%imover == 1)
then
395 call this%pakmvrobj%fc()
399 do i = 1, this%nbound
401 rhs(n) = rhs(n) + this%rhs(i)
403 call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
406 call this%get_drain_factor(i, fact, drnbot)
410 if (this%imover == 1 .and. fact >
dzero)
then
411 drncond = this%cond_mult(i)
412 qdrn = fact * drncond * (this%xnew(n) - drnbot)
413 call this%pakmvrobj%accumulate_qformvr(i, qdrn)
420 subroutine drn_fn(this, rhs, ia, idxglo, matrix_sln)
424 real(DP),
dimension(:),
intent(inout) :: rhs
425 integer(I4B),
dimension(:),
intent(in) :: ia
426 integer(I4B),
dimension(:),
intent(in) :: idxglo
440 if (this%iauxddrncol /= 0)
then
441 do i = 1, this%nbound
442 node = this%nodelist(i)
445 if (this%ibound(node) <= 0)
then
450 cdrn = this%cond_mult(i)
451 xnew = this%xnew(node)
455 call this%get_drain_elevations(i, drndepth, drntop, drnbot)
458 if (drndepth /=
dzero)
then
461 drterm = drterm * cdrn * (drnbot - xnew)
465 call matrix_sln%add_value_pos(idxglo(ipos), drterm)
466 rhs(node) = rhs(node) + drterm * xnew
477 class(
drntype),
intent(inout) :: this
480 this%listlabel = trim(this%filtyp)//
' NO.'
481 if (this%dis%ndim == 3)
then
482 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
483 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'ROW'
484 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'COL'
485 elseif (this%dis%ndim == 2)
then
486 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
487 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'CELL2D'
489 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'NODE'
491 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'DRAIN EL.'
492 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'CONDUCTANCE'
493 if (this%inamedbound == 1)
then
494 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'BOUNDARY NAME'
503 class(
drntype),
intent(inout) :: this
504 integer(I4B),
intent(in) :: i
505 real(DP),
intent(inout) :: drndepth
506 real(DP),
intent(inout) :: drntop
507 real(DP),
intent(inout) :: drnbot
514 drnelev = this%elev(i)
517 if (this%iauxddrncol > 0)
then
518 drndepth = this%auxvar(this%iauxddrncol, i)
522 if (drndepth /=
dzero)
then
523 elev = drnelev + drndepth
524 drntop = max(elev, drnelev)
525 drnbot = min(elev, drnelev)
536 class(
drntype),
intent(inout) :: this
537 integer(I4B),
intent(in) :: i
538 real(DP),
intent(inout) :: factor
539 real(DP),
intent(inout),
optional :: opt_drnbot
548 node = this%nodelist(i)
549 xnew = this%xnew(node)
553 call this%get_drain_elevations(i, drndepth, drntop, drnbot)
556 if (
present(opt_drnbot))
then
561 if (drndepth /=
dzero)
then
562 if (this%icubic_scaling /= 0)
then
568 if (xnew <= drnbot)
then
601 call this%obs%StoreObsType(
'drn', .true., indx)
606 call this%obs%StoreObsType(
'to-mvr', .true., indx)
614 class(
drntype),
intent(inout) :: this
619 do n = 1, this%nbound
620 this%condinput(n) = this%cond_mult(n)
630 class(
drntype),
intent(inout) :: this
631 integer(I4B),
intent(in) :: row
635 if (this%iauxmultcol > 0)
then
636 cond = this%cond(row) * this%auxvar(this%iauxmultcol, row)
638 cond = this%cond(row)
648 class(
drntype),
intent(inout) :: this
649 integer(I4B),
intent(in) :: col
650 integer(I4B),
intent(in) :: row
656 bndval = this%elev(row)
658 bndval = this%cond_mult(row)
660 errmsg =
'Programming error. DRN bound value requested column '&
661 &
'outside range of ncolbnd (2).'
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
integer(i4b), parameter lenpackagename
maximum length of the package name
integer(i4b), parameter lenftype
maximum length of a package type (DIS, WEL, OC, etc.)
integer(i4b), parameter lenauxname
maximum length of a aux variable
real(dp), parameter dzero
real constant zero
real(dp), parameter dtwo
real constant 2
real(dp), parameter done
real constant 1
character(len=lenftype) ftype
subroutine drn_da(this)
Deallocate memory.
subroutine, public drn_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a New Drn Package and point packobj to the new package.
real(dp) function cond_mult(this, row)
Apply multiplier to conductance value depending on user-selected option.
subroutine drn_fn(this, rhs, ia, idxglo, matrix_sln)
Fill newton terms.
subroutine drn_allocate_arrays(this, nodelist, auxvar)
Allocate package arrays.
real(dp) function drn_bound_value(this, col, row)
Return requested boundary value.
subroutine define_listlabel(this)
Define the list heading that is written to iout when PRINT_INPUT option is used.
logical function drn_obs_supported(this)
Return true because DRN package supports observations.
subroutine get_drain_factor(this, i, factor, opt_drnbot)
Get the drain conductance scale factor.
subroutine drn_allocate_scalars(this)
Allocate package scalar members.
subroutine drn_cf(this)
Formulate the HCOF and RHS terms.
subroutine drn_ck(this)
Check drain boundary condition data.
subroutine drn_options(this)
Source options specific to DrnType.
subroutine drn_rp(this)
Read and prepare.
character(len=lenpackagename) text
subroutine get_drain_elevations(this, i, drndepth, drntop, drnbot)
Define drain depth and the top and bottom elevations used to scale the drain conductance.
subroutine log_drn_options(this, found)
@ brief Log DRN specific package options
subroutine drn_store_user_cond(this)
Store user-specified drain conductance.
subroutine drn_fc(this, rhs, ia, idxglo, matrix_sln)
Copy rhs and hcof into solution rhs and amat.
subroutine drn_df_obs(this)
Store observation type supported by DRN package.
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 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
real(dp) function squadraticsaturation(top, bot, x, eps)
@ brief sQuadraticSaturation
real(dp) function sqsaturationderivative(top, bot, x, c1, c2)
@ brief sQSaturationDerivative
real(dp) function sqsaturation(top, bot, x, c1, c2)
@ brief sQSaturation
integer(i4b), pointer, public kper
current stress period number
This class is used to store a single deferred-length character string. It was designed to work in an ...