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
104 call this%BndExtType%bnd_da()
124 call this%BndExtType%allocate_scalars()
127 call mem_allocate(this%iauxddrncol,
'IAUXDDRNCOL', this%memoryPath)
128 call mem_allocate(this%icubic_scaling,
'ICUBIC_SCALING', this%memoryPath)
132 if (this%inewton /= 0)
then
133 this%icubic_scaling = 1
135 this%icubic_scaling = 0
146 integer(I4B),
dimension(:),
pointer,
contiguous,
optional :: nodelist
147 real(DP),
dimension(:, :),
pointer,
contiguous,
optional :: auxvar
150 call this%BndExtType%allocate_arrays(nodelist, auxvar)
153 call mem_setptr(this%elev,
'ELEV', this%input_mempath)
154 call mem_setptr(this%cond,
'COND', this%input_mempath)
157 call mem_checkin(this%elev,
'ELEV', this%memoryPath, &
158 'ELEV', this%input_mempath)
159 call mem_checkin(this%cond,
'COND', this%memoryPath, &
160 'COND', this%input_mempath)
168 class(
drntype),
intent(inout) :: this
170 if (this%iper /=
kper)
return
173 call this%BndExtType%bnd_rp()
176 if (this%ivsc == 1)
then
177 call this%drn_store_user_cond()
190 class(
drntype),
intent(inout) :: this
193 character(len=LENAUXNAME) :: ddrnauxname
197 call this%BndExtType%source_options()
200 call mem_set_value(this%imover,
'MOVER', this%input_mempath, found%mover)
201 call mem_set_value(ddrnauxname,
'AUXDEPTHNAME', this%input_mempath, &
203 call mem_set_value(this%icubic_scaling,
'ICUBICSFAC', this%input_mempath, &
206 if (found%auxdepthname)
then
207 this%iauxddrncol = -1
210 if (this%naux == 0)
then
211 write (
errmsg,
'(a,2(1x,a))') &
212 'AUXDEPTHNAME was specified as', trim(adjustl(ddrnauxname)), &
213 'but no AUX variables specified.'
220 if (ddrnauxname == this%auxname(n))
then
227 if (this%iauxddrncol == 0)
then
228 write (
errmsg,
'(a,2(1x,a))') &
229 'AUXDEPTHNAME was specified as', trim(adjustl(ddrnauxname)), &
230 'but no AUX variable found with this name.'
236 call this%log_drn_options(found)
245 class(
drntype),
intent(inout) :: this
251 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text)) &
254 if (found%mover)
then
255 write (this%iout,
'(4x,A)')
'MOVER OPTION ENABLED'
258 if (found%icubicsfac)
then
259 write (this%iout,
'(4x,a,1x,a)') &
260 'CUBIC SCALING will be used for drains with non-zero DDRN values', &
261 'even if the NEWTON-RAPHSON method is not being used.'
265 write (this%iout,
'(1x,a)') &
266 'END OF '//trim(adjustl(this%text))//
' OPTIONS'
273 class(
drntype),
intent(inout) :: this
282 character(len=*),
parameter :: fmtddrnerr = &
283 "('SCALED-CONDUCTANCE DRN BOUNDARY (',i0,') BOTTOM ELEVATION &
284 &(',f10.3,') IS LESS THAN CELL BOTTOM (',f10.3,')')"
285 character(len=*),
parameter :: fmtdrnerr = &
286 "('DRN BOUNDARY (',i0,') ELEVATION (',f10.3,') IS LESS THAN CELL &
287 &BOTTOM (',f10.3,')')"
288 character(len=*),
parameter :: fmtcondmulterr = &
289 "('DRN BOUNDARY (',i0,') CONDUCTANCE MULTIPLIER (',g10.3,') IS &
291 character(len=*),
parameter :: fmtconderr = &
292 "('DRN BOUNDARY (',i0,') CONDUCTANCE (',g10.3,') IS LESS THAN &
296 do i = 1, this%nbound
297 node = this%nodelist(i)
298 bt = this%dis%bot(node)
302 call this%get_drain_elevations(i, drndepth, drntop, drnbot)
305 if (drnbot < bt .and. this%icelltype(node) /= 0)
then
306 if (drndepth /=
dzero)
then
307 write (
errmsg, fmt=fmtddrnerr) i, drnbot, bt
309 write (
errmsg, fmt=fmtdrnerr) i, drnbot, bt
313 if (this%iauxmultcol > 0)
then
314 if (this%auxvar(this%iauxmultcol, i) <
dzero)
then
315 write (
errmsg, fmt=fmtcondmulterr) &
316 i, this%auxvar(this%iauxmultcol, i)
320 if (this%cond(i) <
dzero)
then
321 write (
errmsg, fmt=fmtconderr) i, this%cond(i)
347 if (this%nbound == 0)
return
350 do i = 1, this%nbound
351 node = this%nodelist(i)
352 if (this%ibound(node) <= 0)
then
359 cdrn = this%cond_mult(i)
363 call this%get_drain_factor(i, fact, drnbot)
366 this%rhs(i) = -fact * cdrn * drnbot
367 this%hcof(i) = -fact * cdrn
373 subroutine drn_fc(this, rhs, ia, idxglo, matrix_sln)
376 real(DP),
dimension(:),
intent(inout) :: rhs
377 integer(I4B),
dimension(:),
intent(in) :: ia
378 integer(I4B),
dimension(:),
intent(in) :: idxglo
390 if (this%imover == 1)
then
391 call this%pakmvrobj%fc()
395 do i = 1, this%nbound
397 rhs(n) = rhs(n) + this%rhs(i)
399 call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
402 call this%get_drain_factor(i, fact, drnbot)
406 if (this%imover == 1 .and. fact >
dzero)
then
407 drncond = this%cond_mult(i)
408 qdrn = fact * drncond * (this%xnew(n) - drnbot)
409 call this%pakmvrobj%accumulate_qformvr(i, qdrn)
416 subroutine drn_fn(this, rhs, ia, idxglo, matrix_sln)
420 real(DP),
dimension(:),
intent(inout) :: rhs
421 integer(I4B),
dimension(:),
intent(in) :: ia
422 integer(I4B),
dimension(:),
intent(in) :: idxglo
436 if (this%iauxddrncol /= 0)
then
437 do i = 1, this%nbound
438 node = this%nodelist(i)
441 if (this%ibound(node) <= 0)
then
446 cdrn = this%cond_mult(i)
447 xnew = this%xnew(node)
451 call this%get_drain_elevations(i, drndepth, drntop, drnbot)
454 if (drndepth /=
dzero)
then
457 drterm = drterm * cdrn * (drnbot - xnew)
461 call matrix_sln%add_value_pos(idxglo(ipos), drterm)
462 rhs(node) = rhs(node) + drterm * xnew
473 class(
drntype),
intent(inout) :: this
476 this%listlabel = trim(this%filtyp)//
' NO.'
477 if (this%dis%ndim == 3)
then
478 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
479 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'ROW'
480 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'COL'
481 elseif (this%dis%ndim == 2)
then
482 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
483 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'CELL2D'
485 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'NODE'
487 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'DRAIN EL.'
488 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'CONDUCTANCE'
489 if (this%inamedbound == 1)
then
490 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'BOUNDARY NAME'
499 class(
drntype),
intent(inout) :: this
500 integer(I4B),
intent(in) :: i
501 real(DP),
intent(inout) :: drndepth
502 real(DP),
intent(inout) :: drntop
503 real(DP),
intent(inout) :: drnbot
510 drnelev = this%elev(i)
513 if (this%iauxddrncol > 0)
then
514 drndepth = this%auxvar(this%iauxddrncol, i)
518 if (drndepth /=
dzero)
then
519 elev = drnelev + drndepth
520 drntop = max(elev, drnelev)
521 drnbot = min(elev, drnelev)
532 class(
drntype),
intent(inout) :: this
533 integer(I4B),
intent(in) :: i
534 real(DP),
intent(inout) :: factor
535 real(DP),
intent(inout),
optional :: opt_drnbot
544 node = this%nodelist(i)
545 xnew = this%xnew(node)
549 call this%get_drain_elevations(i, drndepth, drntop, drnbot)
552 if (
present(opt_drnbot))
then
557 if (drndepth /=
dzero)
then
558 if (this%icubic_scaling /= 0)
then
564 if (xnew <= drnbot)
then
597 call this%obs%StoreObsType(
'drn', .true., indx)
602 call this%obs%StoreObsType(
'to-mvr', .true., indx)
610 class(
drntype),
intent(inout) :: this
615 do n = 1, this%nbound
616 this%condinput(n) = this%cond_mult(n)
626 class(
drntype),
intent(inout) :: this
627 integer(I4B),
intent(in) :: row
631 if (this%iauxmultcol > 0)
then
632 cond = this%cond(row) * this%auxvar(this%iauxmultcol, row)
634 cond = this%cond(row)
644 class(
drntype),
intent(inout) :: this
645 integer(I4B),
intent(in) :: col
646 integer(I4B),
intent(in) :: row
652 bndval = this%elev(row)
654 bndval = this%cond_mult(row)
656 errmsg =
'Programming error. DRN bound value requested column '&
657 &
'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 ...