36 character(len=LENFTYPE) ::
ftype =
'WEL'
37 character(len=16) ::
text =
' WEL'
40 real(dp),
dimension(:),
pointer,
contiguous :: q => null()
41 integer(I4B),
pointer :: iflowred => null()
42 real(dp),
pointer :: flowred => null()
43 integer(I4B),
pointer :: ioutafrcsv => null()
73 subroutine wel_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, &
76 class(
bndtype),
pointer :: packobj
77 integer(I4B),
intent(in) :: id
78 integer(I4B),
intent(in) :: ibcnum
79 integer(I4B),
intent(in) :: inunit
80 integer(I4B),
intent(in) :: iout
81 character(len=*),
intent(in) :: namemodel
82 character(len=*),
intent(in) :: pakname
83 character(len=*),
intent(in) :: mempath
85 type(
weltype),
pointer :: welobj
92 call packobj%set_names(ibcnum, namemodel, pakname,
ftype, mempath)
96 call welobj%allocate_scalars()
99 call packobj%pack_initialize()
101 packobj%inunit = inunit
104 packobj%ibcnum = ibcnum
120 call this%BndExtType%bnd_da()
142 call this%BndExtType%allocate_scalars()
145 call mem_allocate(this%iflowred,
'IFLOWRED', this%memoryPath)
146 call mem_allocate(this%flowred,
'FLOWRED', this%memoryPath)
147 call mem_allocate(this%ioutafrcsv,
'IOUTAFRCSV', this%memoryPath)
165 integer(I4B),
dimension(:),
pointer,
contiguous,
optional :: nodelist
166 real(DP),
dimension(:, :),
pointer,
contiguous,
optional :: auxvar
170 call this%BndExtType%allocate_arrays(nodelist, auxvar)
173 call mem_setptr(this%q,
'Q', this%input_mempath)
177 'Q', this%input_mempath)
191 class(
weltype),
intent(inout) :: this
193 character(len=LINELENGTH) :: fname
196 character(len=*),
parameter :: fmtflowred = &
197 &
"(4x, 'AUTOMATIC FLOW REDUCTION OF WELLS IMPLEMENTED.')"
198 character(len=*),
parameter :: fmtflowredv = &
199 &
"(4x, 'AUTOMATIC FLOW REDUCTION FRACTION (',g15.7,').')"
202 call this%BndExtType%source_options()
205 call mem_set_value(this%flowred,
'FLOWRED', this%input_mempath, found%flowred)
206 call mem_set_value(fname,
'AFRCSVFILE', this%input_mempath, found%afrcsvfile)
207 call mem_set_value(this%imover,
'MOVER', this%input_mempath, found%mover)
209 if (found%flowred)
then
213 if (this%flowred <=
dzero)
then
215 else if (this%flowred >
done)
then
220 if (found%afrcsvfile)
then
221 call this%wel_afr_csv_init(fname)
224 if (found%mover)
then
229 call this%log_wel_options(found)
238 class(
weltype),
intent(inout) :: this
242 character(len=*),
parameter :: fmtflowred = &
243 &
"(4x, 'AUTOMATIC FLOW REDUCTION OF WELLS IMPLEMENTED.')"
244 character(len=*),
parameter :: fmtflowredv = &
245 &
"(4x, 'AUTOMATIC FLOW REDUCTION FRACTION (',g15.7,').')"
248 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text)) &
251 if (found%flowred)
then
252 if (this%iflowred > 0) &
253 write (this%iout, fmtflowred)
254 write (this%iout, fmtflowredv) this%flowred
257 if (found%afrcsvfile)
then
261 if (found%mover)
then
262 write (this%iout,
'(4x,A)')
'MOVER OPTION ENABLED'
266 write (this%iout,
'(1x,a)') &
267 'END OF '//trim(adjustl(this%text))//
' OPTIONS'
276 class(
weltype),
intent(inout) :: this
279 if (this%iper /=
kper)
return
282 call this%BndExtType%bnd_rp()
285 if (this%iprpak /= 0)
then
286 call this%write_list()
300 integer(I4B) :: i, node, ict
308 if (this%nbound == 0)
return
311 do i = 1, this%nbound
312 node = this%nodelist(i)
314 if (this%ibound(node) <= 0)
then
319 if (this%iflowred /= 0 .and. q <
dzero)
then
320 ict = this%icelltype(node)
322 tp = this%dis%top(node)
323 bt = this%dis%bot(node)
325 tp = bt + this%flowred * thick
340 subroutine wel_fc(this, rhs, ia, idxglo, matrix_sln)
343 real(DP),
dimension(:),
intent(inout) :: rhs
344 integer(I4B),
dimension(:),
intent(in) :: ia
345 integer(I4B),
dimension(:),
intent(in) :: idxglo
353 if (this%imover == 1)
then
354 call this%pakmvrobj%fc()
358 do i = 1, this%nbound
360 rhs(n) = rhs(n) + this%rhs(i)
362 call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
366 if (this%imover == 1 .and. this%rhs(i) >
dzero)
then
367 call this%pakmvrobj%accumulate_qformvr(i, this%rhs(i))
378 subroutine wel_fn(this, rhs, ia, idxglo, matrix_sln)
381 real(DP),
dimension(:),
intent(inout) :: rhs
382 integer(I4B),
dimension(:),
intent(in) :: ia
383 integer(I4B),
dimension(:),
intent(in) :: idxglo
397 do i = 1, this%nbound
398 node = this%nodelist(i)
401 if (this%ibound(node) <= 0)
then
406 ict = this%icelltype(node)
407 if (this%iflowred /= 0 .and. ict /= 0)
then
412 tp = this%dis%top(node)
413 bt = this%dis%bot(node)
415 tp = bt + this%flowred * thick
417 drterm = drterm * this%q_mult(i)
419 call matrix_sln%add_value_pos(idxglo(ipos), drterm)
420 rhs(node) = rhs(node) + drterm * this%xnew(node)
429 class(
weltype),
intent(inout) :: this
430 character(len=*),
intent(in) :: fname
432 character(len=*),
parameter :: fmtafrcsv = &
433 "(4x, 'AUTO FLOW REDUCE INFORMATION WILL BE SAVED TO FILE: ', a, /4x, &
434 &'OPENED ON UNIT: ', I0)"
437 call openfile(this%ioutafrcsv, this%iout, fname,
'CSV', &
438 filstat_opt=
'REPLACE')
439 write (this%iout, fmtafrcsv) trim(adjustl(fname)), &
441 write (this%ioutafrcsv,
'(a)') &
442 'time,period,step,boundnumber,cellnumber,rate-requested,&
443 &rate-actual,wel-reduction'
451 class(
weltype),
intent(inout) :: this
454 integer(I4B) :: nodereduced
455 integer(I4B) :: nodeuser
458 do i = 1, this%nbound
459 nodereduced = this%nodelist(i)
462 if (this%ibound(nodereduced) <= 0)
then
465 v = this%q_mult(i) + this%rhs(i)
467 nodeuser = this%dis%get_nodeuser(nodereduced)
468 write (this%ioutafrcsv,
'(*(G0,:,","))') &
469 totim,
kper,
kstp, i, nodeuser, this%q_mult(i), this%simvals(i), v
482 class(
weltype),
intent(inout) :: this
485 this%listlabel = trim(this%filtyp)//
' NO.'
486 if (this%dis%ndim == 3)
then
487 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
488 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'ROW'
489 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'COL'
490 elseif (this%dis%ndim == 2)
then
491 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
492 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'CELL2D'
494 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'NODE'
496 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'STRESS RATE'
497 if (this%inamedbound == 1)
then
498 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'BOUNDARY NAME'
532 call this%obs%StoreObsType(
'wel', .true., indx)
537 call this%obs%StoreObsType(
'to-mvr', .true., indx)
542 call this%obs%StoreObsType(
'wel-reduction', .true., indx)
562 call this%obs%obs_bd_clear()
565 do i = 1, this%obs%npakobs
566 obsrv => this%obs%pakobs(i)%obsrv
567 if (obsrv%BndFound)
then
568 do n = 1, obsrv%indxbnds_count
570 jj = obsrv%indxbnds(n)
571 select case (obsrv%ObsTypeId)
573 if (this%imover == 1)
then
574 v = this%pakmvrobj%get_qtomvr(jj)
581 case (
'WEL-REDUCTION')
582 if (this%iflowred > 0)
then
583 v = this%q_mult(jj) + this%rhs(jj)
586 errmsg =
'Unrecognized observation type: '//trim(obsrv%ObsTypeId)
589 call this%obs%SaveOneSimval(obsrv, v)
592 call this%obs%SaveOneSimval(obsrv,
dnodata)
597 if (this%ioutafrcsv > 0)
then
598 call this%wel_afr_csv_write()
606 class(
weltype),
intent(inout) :: this
607 integer(I4B),
intent(in) :: row
611 if (this%iauxmultcol > 0)
then
612 q = this%q(row) * this%auxvar(this%iauxmultcol, row)
628 class(
weltype),
intent(inout) :: this
629 integer(I4B),
intent(in) :: col
630 integer(I4B),
intent(in) :: row
636 bndval = this%q_mult(row)
638 errmsg =
'Programming error. WEL bound value requested column '&
639 &
'outside range of ncolbnd (1).'
This module contains block parser methods.
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
real(dp), parameter dnodata
real no data constant
real(dp), parameter dem1
real constant 1e-1
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.
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 sqsaturationderivative(top, bot, x, c1, c2)
@ brief sQSaturationDerivative
real(dp) function sqsaturation(top, bot, x, c1, c2)
@ brief sQSaturation
real(dp), pointer, public totim
time relative to start of simulation
integer(i4b), pointer, public kstp
current time step number
integer(i4b), pointer, public kper
current stress period number
This module contains the WEL package methods.
subroutine, public wel_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
@ brief Create a new package object
subroutine wel_allocate_scalars(this)
@ brief Allocate scalars
subroutine wel_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
subroutine wel_rp(this)
@ brief WEL read and prepare
subroutine wel_allocate_arrays(this, nodelist, auxvar)
@ brief Allocate arrays
subroutine wel_options(this)
@ brief Source additional options for package
subroutine wel_afr_csv_write(this)
Write out auto flow reductions only when & where they occur.
real(dp) function q_mult(this, row)
real(dp) function wel_bound_value(this, col, row)
@ brief Return a bound value
subroutine wel_da(this)
@ brief Deallocate package memory
subroutine wel_fn(this, rhs, ia, idxglo, matrix_sln)
@ brief Add Newton-Raphson terms for package into solution.
subroutine wel_afr_csv_init(this, fname)
Initialize the auto flow reduce csv output file.
character(len=lenftype) ftype
package ftype
subroutine wel_cf(this)
@ brief Formulate the package hcof and rhs terms.
subroutine wel_bd_obs(this)
Save observations for the package.
logical function wel_obs_supported(this)
Determine if observations are supported.
subroutine log_wel_options(this, found)
@ brief Log WEL specific package options
character(len=16) text
package flow text string
subroutine wel_df_obs(this)
Define the observation types available in the package.