21 integer(I4B),
pointer :: maxhfb => null()
22 integer(I4B),
pointer :: nhfb => null()
23 integer(I4B),
dimension(:),
pointer,
contiguous :: noden => null()
24 integer(I4B),
dimension(:),
pointer,
contiguous :: nodem => null()
25 integer(I4B),
dimension(:),
pointer,
contiguous :: idxloc => null()
26 real(dp),
dimension(:),
pointer,
contiguous :: hydchr => null()
27 real(dp),
dimension(:),
pointer,
contiguous :: csatsav => null()
28 real(dp),
dimension(:),
pointer,
contiguous :: condsav => null()
31 integer(I4B),
dimension(:),
pointer,
contiguous :: ibound => null()
32 integer(I4B),
dimension(:),
pointer,
contiguous :: icelltype => null()
33 integer(I4B),
dimension(:),
pointer,
contiguous :: ihc => null()
34 integer(I4B),
dimension(:),
pointer,
contiguous :: ia => null()
35 integer(I4B),
dimension(:),
pointer,
contiguous :: ja => null()
36 integer(I4B),
dimension(:),
pointer,
contiguous :: jas => null()
37 integer(I4B),
dimension(:),
pointer,
contiguous :: isym => null()
38 real(dp),
dimension(:),
pointer,
contiguous :: condsat => null()
39 real(dp),
dimension(:),
pointer,
contiguous :: top => null()
40 real(dp),
dimension(:),
pointer,
contiguous :: bot => null()
41 real(dp),
dimension(:),
pointer,
contiguous :: hwva => null()
42 real(dp),
dimension(:),
pointer,
contiguous :: hnew => null()
45 integer(I4B),
pointer :: ivsc => null()
69 subroutine hfb_cr(hfbobj, name_model, inunit, iout)
72 character(len=*),
intent(in) :: name_model
73 integer(I4B),
intent(in) :: inunit
74 integer(I4B),
intent(in) :: iout
80 call hfbobj%set_names(1, name_model,
'HFB',
'HFB')
83 call hfbobj%allocate_scalars()
86 hfbobj%inunit = inunit
90 call hfbobj%parser%Initialize(hfbobj%inunit, hfbobj%iout)
95 subroutine hfb_ar(this, ibound, xt3d, dis, invsc, vsc)
101 integer(I4B),
dimension(:),
pointer,
contiguous :: ibound
104 integer(I4B),
pointer :: invsc
107 character(len=*),
parameter :: fmtheader = &
108 "(1x, /1x, 'HFB -- HORIZONTAL FLOW BARRIER PACKAGE, VERSION 8, ', &
109 &'4/24/2015 INPUT READ FROM UNIT ', i4, //)"
112 write (this%iout, fmtheader) this%inunit
116 this%ibound => ibound
119 call mem_setptr(this%icelltype,
'ICELLTYPE', &
132 call this%read_options()
133 call this%read_dimensions()
134 call this%allocate_arrays()
142 write (this%iout,
'(/1x,a,a)')
'Viscosity active in ', &
143 trim(this%filtyp)//
' Package calculations: '//trim(adjustl(this%packName))
157 character(len=LINELENGTH) :: line, errmsg
161 character(len=*),
parameter :: fmtblkerr = &
162 &
"('Error. Looking for BEGIN PERIOD iper. Found ', a, ' instead.')"
163 character(len=*),
parameter :: fmtlsp = &
164 &
"(1X,/1X,'REUSING ',A,'S FROM LAST STRESS PERIOD')"
168 if (this%ionper <
kper)
then
171 call this%parser%GetBlock(
'PERIOD', isfound, ierr, &
172 supportopenclose=.true., &
173 blockrequired=.false.)
177 call this%read_check_ionper()
183 this%ionper =
nper + 1
186 call this%parser%GetCurrentLine(line)
187 write (errmsg, fmtblkerr) adjustl(trim(line))
189 call this%parser%StoreErrorUnit()
194 if (this%ionper ==
kper)
then
195 call this%condsat_reset()
196 call this%read_data()
197 call this%condsat_modify()
199 write (this%iout, fmtlsp)
'HFB'
211 subroutine hfb_fc(this, kiter, matrix_sln, idxglo, rhs, hnew)
216 integer(I4B) :: kiter
218 integer(I4B),
intent(in),
dimension(:) :: idxglo
219 real(DP),
intent(inout),
dimension(:) :: rhs
220 real(DP),
intent(inout),
dimension(:) :: hnew
222 integer(I4B) :: nodes, nja
223 integer(I4B) :: ihfb, n, m
225 integer(I4B) :: idiag, isymcon
226 integer(I4B) :: ixt3d
227 real(DP) :: cond, condhfb, aterm
228 real(DP) :: fawidth, faheight
229 real(DP) :: topn, topm, botn, botm
230 real(DP) :: viscratio
234 nodes = this%dis%nodes
235 nja = this%dis%con%nja
236 if (
associated(this%xt3d%ixt3d))
then
237 ixt3d = this%xt3d%ixt3d
244 do ihfb = 1, this%nhfb
245 n = min(this%noden(ihfb), this%nodem(ihfb))
246 m = max(this%noden(ihfb), this%nodem(ihfb))
248 if (this%ibound(n) == 0 .or. this%ibound(m) == 0) cycle
250 if (this%ivsc /= 0)
then
251 call this%vsc%get_visc_ratio(n, m, hnew(n), hnew(m), viscratio)
254 if (this%hydchr(ihfb) >
dzero)
then
255 if (this%inewton == 0)
then
256 ipos = this%idxloc(ihfb)
261 if (this%icelltype(n) == 1)
then
262 if (hnew(n) < topn) topn = hnew(n)
264 if (this%icelltype(m) == 1)
then
265 if (hnew(m) < topm) topm = hnew(m)
267 if (this%ihc(this%jas(ipos)) == 2)
then
268 faheight = min(topn, topm) - max(botn, botm)
270 faheight =
dhalf * ((topn - botn) + (topm - botm))
272 fawidth = this%hwva(this%jas(ipos))
273 condhfb = this%hydchr(ihfb) * viscratio * &
276 condhfb = this%hydchr(ihfb) * viscratio
279 condhfb = this%hydchr(ihfb)
282 call this%xt3d%xt3d_fhfb(kiter, nodes, nja, matrix_sln, idxglo, &
283 rhs, hnew, n, m, condhfb)
289 if (this%inewton == 0)
then
290 do ihfb = 1, this%nhfb
291 ipos = this%idxloc(ihfb)
292 aterm = matrix_sln%get_value_pos(idxglo(ipos))
295 if (this%ibound(n) == 0 .or. this%ibound(m) == 0) cycle
297 if (this%ivsc /= 0)
then
298 call this%vsc%get_visc_ratio(n, m, hnew(n), hnew(m), viscratio)
301 if (this%icelltype(n) == 1 .or. this%icelltype(m) == 1 .or. &
309 if (this%icelltype(n) == 1)
then
310 if (hnew(n) < topn) topn = hnew(n)
312 if (this%icelltype(m) == 1)
then
313 if (hnew(m) < topm) topm = hnew(m)
315 if (this%ihc(this%jas(ipos)) == 2)
then
316 faheight = min(topn, topm) - max(botn, botm)
318 faheight =
dhalf * ((topn - botn) + (topm - botm))
320 if (this%hydchr(ihfb) >
dzero)
then
321 fawidth = this%hwva(this%jas(ipos))
322 condhfb = this%hydchr(ihfb) * viscratio * &
324 cond = aterm * condhfb / (aterm + condhfb)
326 cond = -aterm * this%hydchr(ihfb)
330 this%condsav(ihfb) = cond
334 call matrix_sln%add_value_pos(idxglo(idiag), aterm - cond)
335 call matrix_sln%set_value_pos(idxglo(ipos), cond)
338 isymcon = this%isym(ipos)
340 call matrix_sln%add_value_pos(idxglo(idiag), aterm - cond)
341 call matrix_sln%set_value_pos(idxglo(isymcon), cond)
360 real(DP),
intent(inout),
dimension(:) :: hnew
361 real(DP),
intent(inout),
dimension(:) :: flowja
363 integer(I4B) :: ihfb, n, m
367 integer(I4B) :: ixt3d
369 real(DP) :: fawidth, faheight
370 real(DP) :: topn, topm, botn, botm
371 real(DP) :: viscratio
376 if (
associated(this%xt3d%ixt3d))
then
377 ixt3d = this%xt3d%ixt3d
384 do ihfb = 1, this%nhfb
385 n = min(this%noden(ihfb), this%nodem(ihfb))
386 m = max(this%noden(ihfb), this%nodem(ihfb))
388 if (this%ibound(n) == 0 .or. this%ibound(m) == 0) cycle
390 if (this%ivsc /= 0)
then
391 call this%vsc%get_visc_ratio(n, m, hnew(n), hnew(m), viscratio)
395 if (this%hydchr(ihfb) >
dzero)
then
396 if (this%inewton == 0)
then
397 ipos = this%idxloc(ihfb)
402 if (this%icelltype(n) == 1)
then
403 if (hnew(n) < topn) topn = hnew(n)
405 if (this%icelltype(m) == 1)
then
406 if (hnew(m) < topm) topm = hnew(m)
408 if (this%ihc(this%jas(ipos)) == 2)
then
409 faheight = min(topn, topm) - max(botn, botm)
411 faheight =
dhalf * ((topn - botn) + (topm - botm))
413 fawidth = this%hwva(this%jas(ipos))
414 condhfb = this%hydchr(ihfb) * viscratio * &
417 condhfb = this%hydchr(ihfb)
420 condhfb = this%hydchr(ihfb)
423 call this%xt3d%xt3d_flowjahfb(n, m, hnew, flowja, condhfb)
429 if (this%inewton == 0)
then
430 do ihfb = 1, this%nhfb
433 if (this%ibound(n) == 0 .or. this%ibound(m) == 0) cycle
434 if (this%icelltype(n) == 1 .or. this%icelltype(m) == 1 .or. &
436 ipos = this%dis%con%getjaindex(n, m)
439 cond = this%condsav(ihfb)
440 qnm = cond * (hnew(m) - hnew(n))
442 ipos = this%dis%con%getjaindex(m, n)
466 if (this%inunit > 0)
then
476 call this%NumericalPackageType%da()
480 this%inewton => null()
481 this%ibound => null()
482 this%icelltype => null()
488 this%condsat => null()
504 call this%NumericalPackageType%allocate_scalars()
507 call mem_allocate(this%maxhfb,
'MAXHFB', this%memoryPath)
529 call mem_allocate(this%noden, this%maxhfb,
'NODEN', this%memoryPath)
530 call mem_allocate(this%nodem, this%maxhfb,
'NODEM', this%memoryPath)
531 call mem_allocate(this%hydchr, this%maxhfb,
'HYDCHR', this%memoryPath)
532 call mem_allocate(this%idxloc, this%maxhfb,
'IDXLOC', this%memoryPath)
533 call mem_allocate(this%csatsav, this%maxhfb,
'CSATSAV', this%memoryPath)
534 call mem_allocate(this%condsav, this%maxhfb,
'CONDSAV', this%memoryPath)
537 do ihfb = 1, this%maxhfb
538 this%idxloc(ihfb) = 0
551 character(len=LINELENGTH) :: errmsg, keyword
553 logical :: isfound, endOfBlock
556 call this%parser%GetBlock(
'OPTIONS', isfound, ierr, &
557 supportopenclose=.true., blockrequired=.false.)
561 write (this%iout,
'(1x,a)')
'PROCESSING HFB OPTIONS'
563 call this%parser%GetNextLine(endofblock)
565 call this%parser%GetStringCaps(keyword)
566 select case (keyword)
569 write (this%iout,
'(4x,a)') &
570 'THE LIST OF HFBS WILL BE PRINTED.'
572 write (errmsg,
'(a,a)')
'Unknown HFB option: ', &
575 call this%parser%StoreErrorUnit()
578 write (this%iout,
'(1x,a)')
'END OF HFB OPTIONS'
590 character(len=LINELENGTH) :: errmsg, keyword
592 logical :: isfound, endOfBlock
595 call this%parser%GetBlock(
'DIMENSIONS', isfound, ierr, &
596 supportopenclose=.true.)
600 write (this%iout,
'(/1x,a)')
'PROCESSING HFB DIMENSIONS'
602 call this%parser%GetNextLine(endofblock)
604 call this%parser%GetStringCaps(keyword)
605 select case (keyword)
607 this%maxhfb = this%parser%GetInteger()
608 write (this%iout,
'(4x,a,i7)')
'MAXHFB = ', this%maxhfb
610 write (errmsg,
'(a,a)') &
611 'Unknown HFB dimension: ', trim(keyword)
613 call this%parser%StoreErrorUnit()
617 write (this%iout,
'(1x,a)')
'END OF HFB DIMENSIONS'
619 call store_error(
'Required DIMENSIONS block not found.')
620 call this%parser%StoreErrorUnit()
624 if (this%maxhfb <= 0)
then
625 write (errmsg,
'(a)') &
626 'MAXHFB must be specified with value greater than zero.'
628 call this%parser%StoreErrorUnit()
647 character(len=LINELENGTH) :: nodenstr, nodemstr, cellidm, cellidn
648 integer(I4B) :: ihfb, nerr
649 logical :: endOfBlock
651 character(len=*),
parameter :: fmthfb =
"(i10, 2a10, 1(1pg15.6))"
653 write (this%iout,
'(//,1x,a)')
'READING HFB DATA'
654 if (this%iprpak > 0)
then
655 write (this%iout,
'(3a10, 1a15)')
'HFB NUM',
'CELL1',
'CELL2', &
664 call this%parser%GetNextLine(endofblock)
669 if (ihfb > this%maxhfb)
then
671 call this%parser%StoreErrorUnit()
673 call this%parser%GetCellid(this%dis%ndim, cellidn)
674 this%noden(ihfb) = this%dis%noder_from_cellid(cellidn, &
675 this%parser%iuactive, &
677 call this%parser%GetCellid(this%dis%ndim, cellidm)
678 this%nodem(ihfb) = this%dis%noder_from_cellid(cellidm, &
679 this%parser%iuactive, &
681 this%hydchr(ihfb) = this%parser%GetDouble()
684 if (this%iprpak /= 0)
then
685 call this%dis%noder_to_string(this%noden(ihfb), nodenstr)
686 call this%dis%noder_to_string(this%nodem(ihfb), nodemstr)
687 write (this%iout, fmthfb) ihfb, trim(adjustl(nodenstr)), &
688 trim(adjustl(nodemstr)), this%hydchr(ihfb)
697 call store_error(
'Errors encountered in HFB input file.')
698 call this%parser%StoreErrorUnit()
701 write (this%iout,
'(3x,i0,a,i0)') this%nhfb, &
702 ' HFBs READ FOR STRESS PERIOD ',
kper
703 call this%check_data()
704 write (this%iout,
'(1x,a)')
'END READING HFB DATA'
718 integer(I4B) :: ihfb, n, m
720 character(len=LINELENGTH) :: nodenstr, nodemstr
721 character(len=LINELENGTH) :: errmsg
724 character(len=*),
parameter :: fmterr =
"(1x, 'HFB no. ',i0, &
725 &' is between two unconnected cells: ', a, ' and ', a)"
726 character(len=*),
parameter :: fmtverr =
"(1x, 'HFB no. ',i0, &
727 &' is between two cells not horizontally connected: ', a, ' and ', a)"
729 do ihfb = 1, this%nhfb
733 do ipos = this%ia(n) + 1, this%ia(n + 1) - 1
734 if (m == this%ja(ipos))
then
736 this%idxloc(ihfb) = ipos
742 if (.not. found)
then
743 call this%dis%noder_to_string(n, nodenstr)
744 call this%dis%noder_to_string(m, nodemstr)
745 write (errmsg, fmterr) ihfb, trim(adjustl(nodenstr)), &
746 trim(adjustl(nodemstr))
751 ipos = this%idxloc(ihfb)
752 if (this%ihc(this%jas(ipos)) == 0)
then
753 call this%dis%noder_to_string(n, nodenstr)
754 call this%dis%noder_to_string(m, nodemstr)
755 write (errmsg, fmtverr) ihfb, trim(adjustl(nodenstr)), &
756 trim(adjustl(nodemstr))
777 do ihfb = 1, this%nhfb
778 ipos = this%idxloc(ihfb)
779 this%condsat(this%jas(ipos)) = this%csatsav(ihfb)
795 integer(I4B) :: ihfb, n, m
797 real(DP) :: cond, condhfb
798 real(DP) :: fawidth, faheight
799 real(DP) :: topn, topm, botn, botm
801 do ihfb = 1, this%nhfb
802 ipos = this%idxloc(ihfb)
803 cond = this%condsat(this%jas(ipos))
804 this%csatsav(ihfb) = cond
808 if (this%inewton == 1 .or. &
809 (this%icelltype(n) == 0 .and. this%icelltype(m) == 0))
then
816 if (this%ihc(this%jas(ipos)) == 2)
then
817 faheight = min(topn, topm) - max(botn, botm)
819 faheight =
dhalf * ((topn - botn) + (topm - botm))
821 if (this%hydchr(ihfb) >
dzero)
then
822 fawidth = this%hwva(this%jas(ipos))
823 condhfb = this%hydchr(ihfb) * &
825 cond = cond * condhfb / (cond + condhfb)
827 cond = -cond * this%hydchr(ihfb)
829 this%condsat(this%jas(ipos)) = cond
This module contains block parser methods.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
real(dp), parameter dhalf
real constant 1/2
real(dp), parameter dzero
real constant zero
real(dp), parameter done
real constant 1
subroutine hfb_fc(this, kiter, matrix_sln, idxglo, rhs, hnew)
Fill matrix terms.
subroutine check_data(this)
Check for hfb's between two unconnected cells and write a warning.
subroutine hfb_da(this)
Deallocate memory.
subroutine hfb_cq(this, hnew, flowja)
flowja will automatically include the effects of the hfb for confined and newton cases when xt3d is n...
subroutine read_dimensions(this)
Read the dimensions for this package.
subroutine read_options(this)
Read a hfb options block.
subroutine allocate_scalars(this)
Allocate package scalars.
subroutine condsat_modify(this)
Modify condsat.
subroutine condsat_reset(this)
Reset condsat to its value prior to being modified by hfb's.
subroutine, public hfb_cr(hfbobj, name_model, inunit, iout)
Create a new hfb object.
subroutine hfb_rp(this)
Check for new HFB stress period data.
subroutine allocate_arrays(this)
Allocate package arrays.
subroutine read_data(this)
Read HFB period block.
subroutine hfb_ar(this, ibound, xt3d, dis, invsc, vsc)
Allocate and read.
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 base numerical package type.
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_unit(iunit, terminate)
Store the file unit number.
integer(i4b), pointer, public kper
current stress period number
integer(i4b), pointer, public nper
number of stress period