70 character(len=LENFTYPE) ::
ftype =
'APT'
71 character(len=LENVARNAME) ::
text =
' APT'
75 character(len=LENPACKAGENAME) :: flowpackagename =
''
77 dimension(:),
pointer,
contiguous :: status => null()
78 character(len=LENAUXNAME) :: cauxfpconc =
''
79 integer(I4B),
pointer :: iauxfpconc => null()
80 integer(I4B),
pointer :: imatrows => null()
81 integer(I4B),
pointer :: iprconc => null()
82 integer(I4B),
pointer :: iconcout => null()
83 integer(I4B),
pointer :: ibudgetout => null()
84 integer(I4B),
pointer :: ibudcsv => null()
85 integer(I4B),
pointer :: ncv => null()
86 integer(I4B),
pointer :: igwfaptpak => null()
87 integer(I4B),
pointer :: idxprepak => null()
88 integer(I4B),
pointer :: idxlastpak => null()
89 real(dp),
dimension(:),
pointer,
contiguous :: strt => null()
90 integer(I4B),
dimension(:),
pointer,
contiguous :: idxlocnode => null()
91 integer(I4B),
dimension(:),
pointer,
contiguous :: idxpakdiag => null()
92 integer(I4B),
dimension(:),
pointer,
contiguous :: idxdglo => null()
93 integer(I4B),
dimension(:),
pointer,
contiguous :: idxoffdglo => null()
94 integer(I4B),
dimension(:),
pointer,
contiguous :: idxsymdglo => null()
95 integer(I4B),
dimension(:),
pointer,
contiguous :: idxsymoffdglo => null()
96 integer(I4B),
dimension(:),
pointer,
contiguous :: idxfjfdglo => null()
97 integer(I4B),
dimension(:),
pointer,
contiguous :: idxfjfoffdglo => null()
98 integer(I4B),
dimension(:),
pointer,
contiguous :: iboundpak => null()
99 real(dp),
dimension(:),
pointer,
contiguous :: xnewpak => null()
100 real(dp),
dimension(:),
pointer,
contiguous :: xoldpak => null()
101 real(dp),
dimension(:),
pointer,
contiguous :: dbuff => null()
102 character(len=LENBOUNDNAME), &
103 dimension(:),
pointer,
contiguous :: featname => null()
104 real(dp),
dimension(:),
pointer,
contiguous :: concfeat => null()
106 real(dp),
dimension(:),
pointer,
contiguous :: qsto => null()
107 real(dp),
dimension(:),
pointer,
contiguous :: ccterm => null()
108 integer(I4B),
pointer :: idxbudfjf => null()
109 integer(I4B),
pointer :: idxbudgwf => null()
110 integer(I4B),
pointer :: idxbudsto => null()
111 integer(I4B),
pointer :: idxbudtmvr => null()
112 integer(I4B),
pointer :: idxbudfmvr => null()
113 integer(I4B),
pointer :: idxbudaux => null()
114 integer(I4B),
dimension(:),
pointer,
contiguous :: idxbudssm => null()
115 integer(I4B),
pointer :: nconcbudssm => null()
116 real(dp),
dimension(:, :),
pointer,
contiguous :: concbudssm => null()
117 real(dp),
dimension(:),
pointer,
contiguous :: qmfrommvr => null()
118 real(dp),
pointer :: eqnsclfac => null()
119 character(len=LENVARNAME) :: depvartype =
''
120 character(len=LENVARNAME) :: depvarunit =
''
121 character(len=LENVARNAME) :: depvarunitabbrev =
''
124 type(
bndtype),
pointer :: flowpackagebnd => null()
206 integer(I4B),
intent(in) :: moffset
210 integer(I4B) :: jj, jglo
215 if (this%imatrows /= 0)
then
219 nglo = moffset + this%dis%nodes + this%ioffset + n
220 call sparse%addconnection(nglo, nglo, 1)
224 do i = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
225 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(i)
226 jj = this%flowbudptr%budterm(this%idxbudgwf)%id2(i)
227 nglo = moffset + this%dis%nodes + this%ioffset + n
229 call sparse%addconnection(nglo, jglo, 1)
230 call sparse%addconnection(jglo, nglo, 1)
234 if (this%idxbudfjf /= 0)
then
235 do i = 1, this%flowbudptr%budterm(this%idxbudfjf)%maxlist
236 n = this%flowbudptr%budterm(this%idxbudfjf)%id1(i)
237 jj = this%flowbudptr%budterm(this%idxbudfjf)%id2(i)
238 nglo = moffset + this%dis%nodes + this%ioffset + n
239 jglo = moffset + this%dis%nodes + this%ioffset + jj
240 call sparse%addconnection(nglo, jglo, 1)
248 subroutine apt_mc(this, moffset, matrix_sln)
252 integer(I4B),
intent(in) :: moffset
255 integer(I4B) :: n, j, iglo, jglo
260 call this%apt_allocate_index_arrays()
263 if (this%imatrows /= 0)
then
270 this%idxlocnode(n) = this%dis%nodes + this%ioffset + n
271 iglo = moffset + this%dis%nodes + this%ioffset + n
272 this%idxpakdiag(n) = matrix_sln%get_position_diag(iglo)
274 do ipos = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
275 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(ipos)
276 j = this%flowbudptr%budterm(this%idxbudgwf)%id2(ipos)
277 iglo = moffset + this%dis%nodes + this%ioffset + n
279 this%idxdglo(ipos) = matrix_sln%get_position_diag(iglo)
280 this%idxoffdglo(ipos) = matrix_sln%get_position(iglo, jglo)
284 do ipos = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
285 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(ipos)
286 j = this%flowbudptr%budterm(this%idxbudgwf)%id2(ipos)
288 jglo = moffset + this%dis%nodes + this%ioffset + n
289 this%idxsymdglo(ipos) = matrix_sln%get_position_diag(iglo)
290 this%idxsymoffdglo(ipos) = matrix_sln%get_position(iglo, jglo)
294 if (this%idxbudfjf /= 0)
then
295 do ipos = 1, this%flowbudptr%budterm(this%idxbudfjf)%nlist
296 n = this%flowbudptr%budterm(this%idxbudfjf)%id1(ipos)
297 j = this%flowbudptr%budterm(this%idxbudfjf)%id2(ipos)
298 iglo = moffset + this%dis%nodes + this%ioffset + n
299 jglo = moffset + this%dis%nodes + this%ioffset + j
300 this%idxfjfdglo(ipos) = matrix_sln%get_position_diag(iglo)
301 this%idxfjfoffdglo(ipos) = matrix_sln%get_position(iglo, jglo)
317 character(len=*),
parameter :: fmtapt = &
318 "(1x,/1x,'APT -- ADVANCED PACKAGE TRANSPORT, VERSION 1, 3/5/2020', &
319 &' INPUT READ FROM UNIT ', i0, //)"
322 call this%obs%obs_ar()
325 write (this%iout, fmtapt) this%inunit
328 call this%apt_allocate_arrays()
331 call this%apt_checkin_deprecated_names()
334 call this%read_initial_attr()
338 call this%fmi%get_package_index(this%flowpackagename, this%igwfaptpak)
343 this%fmi%iatp(this%igwfaptpak) = 1
344 this%fmi%datp(this%igwfaptpak)%concpack => this%get_mvr_depvar()
345 this%fmi%datp(this%igwfaptpak)%qmfrommvr => this%qmfrommvr
350 if (
associated(this%flowpackagebnd))
then
351 if (this%cauxfpconc /=
'')
then
353 do j = 1, this%flowpackagebnd%naux
354 if (this%flowpackagebnd%auxname(j) == this%cauxfpconc)
then
360 if (this%iauxfpconc == 0)
then
361 errmsg =
'Could not find auxiliary variable '// &
362 trim(adjustl(this%cauxfpconc))//
' in flow package '// &
363 trim(adjustl(this%flowpackagename))
368 this%flowpackagebnd%noupdateauxvar(this%iauxfpconc) = 1
369 call this%apt_copy2flowp()
385 integer(I4B) :: n, itemno, igwfnode, isize
386 integer(I4B),
pointer :: nbound => null()
387 integer(I4B),
dimension(:),
pointer,
contiguous :: ifno => null()
394 real(DP),
dimension(:),
pointer,
contiguous :: auxval => null()
395 character(len=LINELENGTH) :: str
396 character(len=LENVARNAME) :: key
397 character(len=LINELENGTH) :: title
398 character(len=LINELENGTH) :: text
399 character(len=LENVARNAME) :: auxnamestr
400 character(len=*),
parameter :: fmtlsp = &
401 "(1X,/1X,'REUSING ',A,'S FROM LAST &
405 this%nbound = this%maxbound
408 if (this%iper ==
kper)
then
411 call mem_setptr(nbound,
'NBOUND', this%input_mempath)
414 if (this%iprpak /= 0)
then
415 title = trim(adjustl(this%text))//
' PACKAGE ('// &
416 trim(adjustl(this%packName))//
') DATA FOR PERIOD'
417 write (title,
'(a,1x,i6)') trim(adjustl(title)),
kper
418 call table_cr(this%inputtab, this%packName, title)
419 call this%inputtab%table_df(1, 4, this%iout, finalize=.false.)
421 call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
423 call this%inputtab%initialize_column(text, 20, alignment=tableft)
425 write (text,
'(a,1x,i6)')
'VALUE', n
426 call this%inputtab%initialize_column(text, 15, alignment=tabcenter)
431 call mem_setptr(ifno,
'IFNO', this%input_mempath)
432 call mem_setptr(setting,
'SETTING', this%input_mempath)
433 call mem_setptr(status,
'STATUS', this%input_mempath)
434 if (this%naux > 0)
then
435 call get_isize(
'AUXVAL', this%input_mempath, isize)
437 call mem_setptr(auxname,
'AUXNAME', this%input_mempath)
438 call mem_setptr(auxval,
'AUXVAL', this%input_mempath)
444 if (this%apt_check_valid(itemno) /= 0) cycle
448 if (trim(key) ==
'STATUS')
then
450 select case (trim(str))
452 this%iboundpak(itemno) = -1
454 this%iboundpak(itemno) = 0
456 this%iboundpak(itemno) = 1
459 'Unknown '//trim(this%text)//
' status keyword: ', &
463 this%status(itemno) = trim(str)
464 if (this%iprpak /= 0)
then
465 call this%inputtab%add_term(itemno)
466 call this%inputtab%add_term(trim(key))
467 call this%inputtab%add_term(trim(str))
468 call this%inputtab%add_term(
' ')
473 else if (trim(key) == trim(this%depvartype))
then
474 if (this%iprpak /= 0)
then
475 call this%inputtab%add_term(itemno)
476 call this%inputtab%add_term(trim(key))
477 call this%inputtab%add_term(this%concfeat(itemno))
478 call this%inputtab%add_term(
' ')
483 else if (trim(key) ==
'PERIOD_AUXILIARY')
then
484 if (this%iprpak /= 0)
then
485 auxnamestr = auxname(n)
486 call this%inputtab%add_term(itemno)
487 call this%inputtab%add_term(
'AUXILIARY')
488 call this%inputtab%add_term(trim(auxnamestr))
489 call this%inputtab%add_term(auxval(n))
495 if (this%iprpak /= 0)
then
496 call this%inputtab%add_term(itemno)
497 call this%inputtab%add_term(trim(key))
498 call this%inputtab%add_term(this%apt_setting_value(itemno, key))
499 call this%inputtab%add_term(
' ')
505 if (this%iprpak /= 0)
then
506 call this%inputtab%finalize_table()
510 write (this%iout, fmtlsp) trim(this%filtyp)
520 do n = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
521 igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(n)
522 this%nodelist(n) = igwfnode
541 integer(I4B),
intent(in) :: itemno
544 if (itemno < 1 .or. itemno > this%ncv)
then
545 write (
errmsg,
'(a,1x,i6,1x,a,1x,i6)') &
546 'Featureno ', itemno,
'must be > 0 and <= ', this%ncv
574 call this%BndExtType%bnd_ad()
576 call this%apt_ad_resync()
592 integer(I4B) :: j, iaux
595 if (this%ts_active)
then
596 call this%apt_ad_ts()
603 if (this%naux > 0 .and. (
kstp == 1 .or. this%ts_active))
then
604 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
605 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
606 do iaux = 1, this%naux
607 this%auxvar(iaux, j) = this%featureauxvar(iaux, n)
616 this%xoldpak(n) = this%xnewpak(n)
617 if (this%iboundpak(n) < 0)
then
618 this%xnewpak(n) = this%concfeat(n)
623 this%xnewpak(n) = this%xoldpak(n)
624 if (this%iboundpak(n) < 0)
then
625 this%xnewpak(n) = this%concfeat(n)
631 call this%apt_ad_chk()
651 integer(I4B),
intent(in) :: itemno
652 character(len=*),
intent(in) :: key
663 do i = 1,
size(this%qmfrommvr)
664 this%qmfrommvr(i) =
dzero
668 subroutine apt_fc(this, rhs, ia, idxglo, matrix_sln)
672 real(DP),
dimension(:),
intent(inout) :: rhs
673 integer(I4B),
dimension(:),
intent(in) :: ia
674 integer(I4B),
dimension(:),
intent(in) :: idxglo
679 if (this%imatrows == 0)
then
680 call this%apt_fc_nonexpanded(rhs, ia, idxglo, matrix_sln)
682 call this%apt_fc_expanded(rhs, ia, idxglo, matrix_sln)
695 real(DP),
dimension(:),
intent(inout) :: rhs
696 integer(I4B),
dimension(:),
intent(in) :: ia
697 integer(I4B),
dimension(:),
intent(in) :: idxglo
700 integer(I4B) :: j, igwfnode, idiag
703 call this%apt_solve()
706 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
707 igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(j)
708 if (this%ibound(igwfnode) < 1) cycle
709 idiag = idxglo(ia(igwfnode))
710 call matrix_sln%add_value_pos(idiag, this%hcof(j))
711 rhs(igwfnode) = rhs(igwfnode) + this%rhs(j)
724 real(DP),
dimension(:),
intent(inout) :: rhs
725 integer(I4B),
dimension(:),
intent(in) :: ia
726 integer(I4B),
dimension(:),
intent(in) :: idxglo
729 integer(I4B) :: j, n, n1, n2
731 integer(I4B) :: iposd, iposoffd
732 integer(I4B) :: ipossymd, ipossymoffd
734 real(DP) :: qbnd, qbnd_scaled
745 call this%pak_fc_expanded(rhs, ia, idxglo, matrix_sln)
749 cold = this%xoldpak(n)
750 iloc = this%idxlocnode(n)
751 iposd = this%idxpakdiag(n)
752 call this%apt_stor_term(n, n1, n2, rrate, rhsval, hcofval)
753 call matrix_sln%add_value_pos(iposd, hcofval)
754 rhs(iloc) = rhs(iloc) + rhsval
758 if (this%idxbudtmvr /= 0)
then
759 do j = 1, this%flowbudptr%budterm(this%idxbudtmvr)%nlist
760 call this%apt_tmvr_term(j, n1, n2, rrate, rhsval, hcofval)
761 iloc = this%idxlocnode(n1)
762 iposd = this%idxpakdiag(n1)
763 call matrix_sln%add_value_pos(iposd, hcofval)
764 rhs(iloc) = rhs(iloc) + rhsval
769 if (this%idxbudfmvr /= 0)
then
771 rhsval = this%qmfrommvr(n)
772 iloc = this%idxlocnode(n)
773 rhs(iloc) = rhs(iloc) - rhsval
778 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
781 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
782 if (this%iboundpak(n) /= 0)
then
785 qbnd = this%flowbudptr%budterm(this%idxbudgwf)%flow(j)
788 qbnd_scaled = qbnd * this%eqnsclfac
791 iposd = this%idxdglo(j)
792 iposoffd = this%idxoffdglo(j)
793 call matrix_sln%add_value_pos(iposd, omega * qbnd_scaled)
794 call matrix_sln%add_value_pos(iposoffd, (
done - omega) * qbnd_scaled)
797 ipossymd = this%idxsymdglo(j)
798 ipossymoffd = this%idxsymoffdglo(j)
799 call matrix_sln%add_value_pos(ipossymd, -(
done - omega) * qbnd_scaled)
800 call matrix_sln%add_value_pos(ipossymoffd, -omega * qbnd_scaled)
805 if (this%idxbudfjf /= 0)
then
806 do j = 1, this%flowbudptr%budterm(this%idxbudfjf)%nlist
807 n1 = this%flowbudptr%budterm(this%idxbudfjf)%id1(j)
808 n2 = this%flowbudptr%budterm(this%idxbudfjf)%id2(j)
809 qbnd = this%flowbudptr%budterm(this%idxbudfjf)%flow(j)
810 if (qbnd <=
dzero)
then
815 qbnd_scaled = qbnd * this%eqnsclfac
816 iposd = this%idxfjfdglo(j)
817 iposoffd = this%idxfjfoffdglo(j)
818 call matrix_sln%add_value_pos(iposd, omega * qbnd_scaled)
819 call matrix_sln%add_value_pos(iposoffd, (
done - omega) * qbnd_scaled)
833 real(DP),
dimension(:),
intent(inout) :: rhs
834 integer(I4B),
dimension(:),
intent(in) :: ia
835 integer(I4B),
dimension(:),
intent(in) :: idxglo
840 call store_error(
'Program error: pak_fc_expanded not implemented.', &
861 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
862 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
865 if (this%iboundpak(n) /= 0)
then
866 qbnd = this%flowbudptr%budterm(this%idxbudgwf)%flow(j)
869 this%hcof(j) = -(
done - omega) * qbnd * this%eqnsclfac
870 this%rhs(j) = omega * qbnd * this%xnewpak(n) * this%eqnsclfac
883 real(DP),
dimension(:),
intent(in) :: x
884 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
885 integer(I4B),
optional,
intent(in) :: iadv
887 integer(I4B) :: n, n1, n2
892 if (this%imatrows == 0)
then
893 call this%apt_solve()
895 call this%apt_cfupdate()
899 call this%BndType%bnd_cq(x, flowja)
904 if (this%iboundpak(n) > 0)
then
905 call this%apt_stor_term(n, n1, n2, rrate)
911 call this%apt_copy2flowp()
914 call this%apt_fill_budobj(x, flowja)
922 integer(I4B),
intent(in) :: icbcfl
923 integer(I4B),
intent(in) :: ibudfl
924 integer(I4B) :: ibinun
928 if (this%ibudgetout /= 0)
then
929 ibinun = this%ibudgetout
931 if (icbcfl == 0) ibinun = 0
933 call this%budobj%save_flows(this%dis, ibinun,
kstp,
kper,
delt, &
938 if (ibudfl /= 0 .and. this%iprflow /= 0)
then
939 call this%budobj%write_flowtable(this%dis,
kstp,
kper)
951 integer(I4B),
intent(in) :: idvsave
952 integer(I4B),
intent(in) :: idvprint
954 integer(I4B) :: ibinun
957 character(len=LENBUDTXT) :: text
961 if (this%iconcout /= 0)
then
962 ibinun = this%iconcout
964 if (idvsave == 0) ibinun = 0
970 if (this%iboundpak(n) == 0)
then
975 write (text,
'(a)') str_pad_left(this%depvartype, lenvarname)
977 this%ncv, 1, 1, ibinun)
981 if (idvprint /= 0 .and. this%iprconc /= 0)
then
984 call this%dvtab%set_kstpkper(
kstp,
kper)
988 if (this%inamedbound == 1)
then
989 call this%dvtab%add_term(this%featname(n))
991 call this%dvtab%add_term(n)
992 call this%dvtab%add_term(this%xnewpak(n))
1004 integer(I4B),
intent(in) :: kstp
1005 integer(I4B),
intent(in) :: kper
1006 integer(I4B),
intent(in) :: iout
1007 integer(I4B),
intent(in) :: ibudfl
1009 call this%budobj%write_budtable(kstp, kper, iout, ibudfl,
totim,
delt)
1024 call this%BndExtType%allocate_scalars()
1027 call mem_allocate(this%iauxfpconc,
'IAUXFPCONC', this%memoryPath)
1028 call mem_allocate(this%imatrows,
'IMATROWS', this%memoryPath)
1029 call mem_allocate(this%iprconc,
'IPRCONC', this%memoryPath)
1030 call mem_allocate(this%iconcout,
'ICONCOUT', this%memoryPath)
1031 call mem_allocate(this%ibudgetout,
'IBUDGETOUT', this%memoryPath)
1032 call mem_allocate(this%ibudcsv,
'IBUDCSV', this%memoryPath)
1033 call mem_allocate(this%igwfaptpak,
'IGWFAPTPAK', this%memoryPath)
1035 call mem_allocate(this%idxbudfjf,
'IDXBUDFJF', this%memoryPath)
1036 call mem_allocate(this%idxbudgwf,
'IDXBUDGWF', this%memoryPath)
1037 call mem_allocate(this%idxbudsto,
'IDXBUDSTO', this%memoryPath)
1038 call mem_allocate(this%idxbudtmvr,
'IDXBUDTMVR', this%memoryPath)
1039 call mem_allocate(this%idxbudfmvr,
'IDXBUDFMVR', this%memoryPath)
1040 call mem_allocate(this%idxbudaux,
'IDXBUDAUX', this%memoryPath)
1041 call mem_allocate(this%nconcbudssm,
'NCONCBUDSSM', this%memoryPath)
1042 call mem_allocate(this%idxprepak,
'IDXPREPAK', this%memoryPath)
1043 call mem_allocate(this%idxlastpak,
'IDXLASTPAK', this%memoryPath)
1060 this%nconcbudssm = 0
1080 if (this%imatrows /= 0)
then
1084 if (this%idxbudfjf /= 0)
then
1085 n = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
1089 call mem_allocate(this%idxlocnode, this%ncv,
'IDXLOCNODE', &
1091 call mem_allocate(this%idxpakdiag, this%ncv,
'IDXPAKDIAG', &
1093 call mem_allocate(this%idxdglo, this%maxbound,
'IDXGLO', &
1095 call mem_allocate(this%idxoffdglo, this%maxbound,
'IDXOFFDGLO', &
1097 call mem_allocate(this%idxsymdglo, this%maxbound,
'IDXSYMDGLO', &
1099 call mem_allocate(this%idxsymoffdglo, this%maxbound,
'IDXSYMOFFDGLO', &
1103 call mem_allocate(this%idxfjfoffdglo, n,
'IDXFJFOFFDGLO', &
1116 call mem_allocate(this%idxsymoffdglo, 0,
'IDXSYMOFFDGLO', &
1120 call mem_allocate(this%idxfjfoffdglo, 0,
'IDXFJFOFFDGLO', &
1138 call this%BndExtType%allocate_arrays()
1143 if (this%iconcout > 0)
then
1144 call mem_allocate(this%dbuff, this%ncv,
'DBUFF', this%memoryPath)
1146 this%dbuff(n) =
dzero
1149 call mem_allocate(this%dbuff, 0,
'DBUFF', this%memoryPath)
1153 allocate (this%status(this%ncv))
1158 call mem_setptr(this%concfeat, trim(this%depvartype), this%input_mempath)
1161 call mem_allocate(this%qsto, this%ncv,
'QSTO', this%memoryPath)
1162 call mem_allocate(this%ccterm, this%ncv,
'CCTERM', this%memoryPath)
1165 call mem_allocate(this%concbudssm, this%nconcbudssm, this%ncv, &
1166 'CONCBUDSSM', this%memoryPath)
1169 call mem_allocate(this%qmfrommvr, this%ncv,
'QMFROMMVR', this%memoryPath)
1173 this%status(n) =
'ACTIVE'
1174 this%qsto(n) =
dzero
1175 this%ccterm(n) =
dzero
1176 this%qmfrommvr(n) =
dzero
1177 this%concbudssm(:, n) =
dzero
1198 real(DP),
dimension(:, :),
pointer,
contiguous :: aux => null()
1199 integer(I4B) :: isize
1204 trim(this%depvartype), this%input_mempath, &
1208 call get_isize(
'AUX', this%input_mempath, isize)
1209 if (isize >= 0)
then
1210 call mem_setptr(aux,
'AUX', this%input_mempath)
1212 'AUX', this%input_mempath,
'6.8.2')
1233 if (this%imatrows == 0)
then
1238 nullify (this%concfeat)
1240 deallocate (this%status)
1241 deallocate (this%featname)
1244 call this%budobj%budgetobject_da()
1245 deallocate (this%budobj)
1246 nullify (this%budobj)
1249 if (this%iprconc > 0)
then
1250 call this%dvtab%table_da()
1251 deallocate (this%dvtab)
1252 nullify (this%dvtab)
1286 call this%BndExtType%bnd_da()
1299 call store_error(
'Program error: pak_solve not implemented.', &
1309 character(len=LINELENGTH) :: fname
1312 character(len=*),
parameter :: fmtaptbin = &
1313 "(4x, a, 1x, a, 1x, ' WILL BE SAVED TO FILE: ', a, &
1314 &/4x, 'OPENED ON UNIT: ', I0)"
1318 call this%BndExtType%source_options()
1320 write (this%iout,
'(1x,a)') &
1321 'PROCESSING '//trim(adjustl(this%text))//
' OPTIONS'
1325 this%input_mempath, found)
1327 write (this%iout,
'(4x,a)') &
1328 'THIS '//trim(adjustl(this%text))//
' PACKAGE CORRESPONDS TO A GWF &
1329 &PACKAGE WITH THE NAME '//trim(adjustl(this%flowpackagename))
1334 this%input_mempath, found)
1336 write (this%iout,
'(4x,a)') &
1337 'SIMULATED CONCENTRATIONS WILL BE COPIED INTO THE FLOW PACKAGE &
1338 &AUXILIARY VARIABLE WITH THE NAME '//trim(adjustl(this%cauxfpconc))
1346 call mem_set_value(this%iprconc,
'IPRCONC', this%input_mempath, found)
1348 write (this%iout,
'(4x,a)') trim(adjustl(this%text))// &
1349 ' '//trim(adjustl(this%depvartype))//
'S WILL BE PRINTED TO LISTING FILE.'
1353 if (this%depvartype ==
'CONCENTRATION')
then
1354 call mem_set_value(fname,
'CONCFILE', this%input_mempath, found)
1356 call mem_set_value(fname,
'TEMPFILE', this%input_mempath, found)
1360 trim(this%depvartype)//
" fileout")
1361 call openfile(this%iconcout, this%iout, fname,
'DATA(BINARY)', &
1363 write (this%iout, fmtaptbin) trim(adjustl(this%text)), &
1364 trim(adjustl(this%depvartype)), trim(fname), this%iconcout
1368 call mem_set_value(fname,
'BUDGETFILE', this%input_mempath, found)
1370 call assign_iounit(this%ibudgetout, this%inunit,
"BUDGET fileout")
1371 call openfile(this%ibudgetout, this%iout, fname,
'DATA(BINARY)', &
1373 write (this%iout, fmtaptbin) trim(adjustl(this%text)),
'BUDGET', &
1374 trim(fname), this%ibudgetout
1378 call mem_set_value(fname,
'BUDGETCSVFILE', this%input_mempath, found)
1380 call assign_iounit(this%ibudcsv, this%inunit,
"BUDGETCSV fileout")
1381 call openfile(this%ibudcsv, this%iout, fname,
'CSV', filstat_opt=
'REPLACE')
1382 write (this%iout, fmtaptbin) trim(adjustl(this%text)),
'BUDGET CSV', &
1383 trim(fname), this%ibudcsv
1386 write (this%iout,
'(1x,a)') &
1387 'END OF '//trim(adjustl(this%text))//
' OPTIONS'
1396 integer(I4B) :: ierr
1399 if (this%flowpackagename ==
'')
then
1400 this%flowpackagename = this%packName
1401 write (this%iout,
'(4x,a)') &
1402 'THE FLOW PACKAGE NAME FOR '//trim(adjustl(this%text))//
' WAS NOT &
1403 &SPECIFIED. SETTING FLOW PACKAGE NAME TO '// &
1404 trim(adjustl(this%flowpackagename))
1406 call this%find_apt_package()
1409 this%ncv = this%flowbudptr%ncv
1410 this%maxbound = this%flowbudptr%budterm(this%idxbudgwf)%maxlist
1411 this%nbound = this%maxbound
1412 write (this%iout,
'(a, a)')
'SETTING DIMENSIONS FOR PACKAGE ', this%packName
1413 write (this%iout,
'(2x,a,i0)')
'NUMBER OF CONTROL VOLUMES = ', this%ncv
1414 write (this%iout,
'(2x,a,i0)')
'MAXBOUND = ', this%maxbound
1415 write (this%iout,
'(2x,a,i0)')
'NBOUND = ', this%nbound
1416 if (this%imatrows /= 0)
then
1417 this%npakeq = this%ncv
1418 write (this%iout,
'(2x,a)') trim(adjustl(this%text))// &
1419 ' SOLVED AS PART OF GWT MATRIX EQUATIONS'
1421 write (this%iout,
'(2x,a)') trim(adjustl(this%text))// &
1422 ' SOLVED SEPARATELY FROM GWT MATRIX EQUATIONS '
1424 write (this%iout,
'(a, //)')
'DONE SETTING DIMENSIONS FOR '// &
1425 trim(adjustl(this%text))
1427 if (this%ncv < 0)
then
1429 'Number of control volumes could not be determined correctly.'
1436 call this%apt_source_cvs()
1438 call this%define_listlabel()
1439 call this%apt_setup_budobj()
1440 call this%apt_setup_tableobj()
1449 character(len=LENBOUNDNAME) :: bndName
1450 character(len=9) :: cno
1451 integer(I4B) :: n, itemno, isize, nfeat
1452 integer(I4B),
allocatable,
dimension(:) :: nboundchk
1453 real(DP),
dimension(:),
pointer,
contiguous :: strt_ptr => null()
1455 boundname_ptr => null()
1458 call mem_allocate(this%strt, this%ncv,
'STRT', this%memoryPath)
1459 if (this%imatrows == 0)
then
1460 call mem_allocate(this%iboundpak, this%ncv,
'IBOUND', this%memoryPath)
1461 call mem_allocate(this%xnewpak, this%ncv,
'XNEWPAK', this%memoryPath)
1463 call mem_allocate(this%xoldpak, this%ncv,
'XOLDPAK', this%memoryPath)
1464 allocate (this%featname(this%ncv))
1468 this%strt(n) =
dep20
1469 this%xoldpak(n) =
dep20
1470 if (this%imatrows == 0)
then
1471 this%iboundpak(n) = 1
1472 this%xnewpak(n) =
dep20
1478 call this%allocate_featureauxvar()
1481 nfeat =
size(this%pkg_ifno)
1482 allocate (nboundchk(this%ncv))
1485 itemno = this%validate_ifno(this%pkg_ifno(n), this%ncv, nboundchk,
'IFNO', &
1486 trim(adjustl(this%text))//
' PACKAGEDATA')
1488 call this%report_ifno_coverage(nboundchk, this%ncv,
'feature', &
1489 trim(adjustl(this%text))//
' PACKAGEDATA')
1490 deallocate (nboundchk)
1496 call mem_setptr(strt_ptr,
'STRT', this%input_mempath)
1498 itemno = this%pkg_ifno(n)
1499 this%strt(itemno) = strt_ptr(n)
1505 write (cno,
'(i9.9)') n
1506 this%featname(n) =
'Feature'//cno
1508 if (this%inamedbound /= 0)
then
1509 call get_isize(
'BOUNDNAME', this%input_mempath, isize)
1511 call mem_setptr(boundname_ptr,
'BOUNDNAME', this%input_mempath)
1513 itemno = this%pkg_ifno(n)
1514 if (itemno < 1 .or. itemno > this%ncv) cycle
1515 bndname = boundname_ptr(n)
1516 if (trim(bndname) /=
'') this%featname(itemno) = trim(bndname)
1522 write (this%iout,
'(/1x,a)')
'END OF '//trim(adjustl(this%text))// &
1535 integer(I4B) :: j, n
1541 this%xnewpak(n) = this%strt(n)
1550 if (this%status(n) ==
'CONSTANT')
then
1551 this%iboundpak(n) = -1
1552 else if (this%status(n) ==
'INACTIVE')
then
1553 this%iboundpak(n) = 0
1554 else if (this%status(n) ==
'ACTIVE ')
then
1555 this%iboundpak(n) = 1
1560 if (this%inamedbound /= 0)
then
1561 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
1562 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
1563 this%boundname(j) = this%featname(n)
1568 call this%copy_boundname()
1582 integer(I4B) :: n, j, igwfnode
1583 integer(I4B) :: n1, n2
1586 real(DP) :: c1, qbnd
1587 real(DP) :: hcofval, rhsval
1591 this%dbuff(n) = dzero
1596 call this%pak_solve()
1599 if (this%idxbudtmvr /= 0)
then
1600 do j = 1, this%flowbudptr%budterm(this%idxbudtmvr)%nlist
1601 call this%apt_tmvr_term(j, n1, n2, rrate)
1602 this%dbuff(n1) = this%dbuff(n1) + rrate
1607 if (this%idxbudfmvr /= 0)
then
1608 do n1 = 1,
size(this%qmfrommvr)
1609 rrate = this%qmfrommvr(n1)
1610 this%dbuff(n1) = this%dbuff(n1) + rrate
1616 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
1617 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
1618 this%hcof(j) = dzero
1620 igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(j)
1621 qbnd = this%flowbudptr%budterm(this%idxbudgwf)%flow(j)
1622 if (qbnd <= dzero)
then
1623 ctmp = this%xnewpak(n)
1624 this%rhs(j) = qbnd * ctmp * this%eqnsclfac
1626 ctmp = this%xnew(igwfnode)
1627 this%hcof(j) = -qbnd * this%eqnsclfac
1629 c1 = qbnd * ctmp * this%eqnsclfac
1630 this%dbuff(n) = this%dbuff(n) + c1
1635 if (this%idxbudfjf /= 0)
then
1636 do j = 1, this%flowbudptr%budterm(this%idxbudfjf)%nlist
1637 call this%apt_fjf_term(j, n1, n2, rrate)
1639 this%dbuff(n1) = this%dbuff(n1) + c1
1645 call this%apt_stor_term(n, n1, n2, rrate, rhsval, hcofval)
1649 this%dbuff(n) = this%dbuff(n) - rhsval
1652 c1 = -this%dbuff(n) / hcofval
1653 if (this%iboundpak(n) > 0)
then
1654 this%xnewpak(n) = c1
1670 call store_error(
'Program error: pak_solve not implemented.', &
1679 integer(I4B),
intent(in) :: ilak
1680 real(DP),
intent(in) :: rrate
1681 real(DP),
intent(inout) :: ccratin
1682 real(DP),
intent(inout) :: ccratout
1688 if (this%iboundpak(ilak) < 0)
then
1690 this%ccterm(ilak) = this%ccterm(ilak) + q
1696 ccratout = ccratout - q
1700 ccratin = ccratin + q
1712 this%listlabel = trim(this%filtyp)//
' NO.'
1713 if (this%dis%ndim == 3)
then
1714 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
1715 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'ROW'
1716 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'COL'
1717 elseif (this%dis%ndim == 2)
then
1718 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
1719 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'CELL2D'
1721 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'NODE'
1723 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'STRESS RATE'
1724 if (this%inamedbound == 1)
then
1725 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'BOUNDARY NAME'
1734 integer(I4B),
pointer :: neq
1735 integer(I4B),
dimension(:),
pointer,
contiguous :: ibound
1736 real(DP),
dimension(:),
pointer,
contiguous :: xnew
1737 real(DP),
dimension(:),
pointer,
contiguous :: xold
1738 real(DP),
dimension(:),
pointer,
contiguous :: flowja
1740 integer(I4B) :: istart, iend
1743 call this%BndType%set_pointers(neq, ibound, xnew, xold, flowja)
1748 if (this%imatrows /= 0)
then
1749 istart = this%dis%nodes + this%ioffset + 1
1750 iend = istart + this%ncv - 1
1751 this%iboundpak => this%ibound(istart:iend)
1752 this%xnewpak => this%xnew(istart:iend)
1762 integer(I4B),
intent(in) :: icv
1763 real(DP),
intent(inout) :: vnew, vold
1764 real(DP),
intent(in) :: delt
1771 if (this%idxbudsto /= 0)
then
1772 qss = this%flowbudptr%budterm(this%idxbudsto)%flow(icv)
1773 vnew = this%flowbudptr%budterm(this%idxbudsto)%auxvar(1, icv)
1774 vold = vnew + qss * delt
1787 integer(I4B) :: nbudterms
1791 call store_error(
'Program error: pak_get_nbudterms not implemented.', &
1804 integer(I4B) :: nbudterm
1805 integer(I4B) :: nlen
1806 integer(I4B) :: n, n1, n2
1807 integer(I4B) :: maxlist, naux
1809 logical :: ordered_id1
1811 character(len=LENBUDTXT) :: bddim_opt
1812 character(len=LENBUDTXT) :: text, textt
1813 character(len=LENBUDTXT),
dimension(1) :: auxtxt
1820 if (this%idxbudfjf /= 0)
then
1821 nlen = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
1828 if (this%idxbudfjf /= 0) nbudterm = nbudterm + 1
1831 nbudterm = nbudterm + 3
1834 nbudterm = nbudterm + this%pak_get_nbudterms()
1837 if (this%idxbudtmvr /= 0) nbudterm = nbudterm + 1
1838 if (this%idxbudfmvr /= 0) nbudterm = nbudterm + 1
1839 if (this%naux > 0) nbudterm = nbudterm + 1
1844 bddim_opt = this%depvarunitabbrev
1845 call this%budobj%budgetobject_df(this%ncv, nbudterm, 0, 0, &
1846 bddim_opt=bddim_opt, ibudcsv=this%ibudcsv)
1851 text =
' FLOW-JA-FACE'
1853 maxlist = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
1855 ordered_id1 = this%flowbudptr%budterm(this%idxbudfjf)%ordered_id1
1856 call this%budobj%budterm(idx)%initialize(text, &
1861 maxlist, .false., .false., &
1862 naux, ordered_id1=ordered_id1)
1865 call this%budobj%budterm(idx)%reset(maxlist)
1868 n1 = this%flowbudptr%budterm(this%idxbudfjf)%id1(n)
1869 n2 = this%flowbudptr%budterm(this%idxbudfjf)%id2(n)
1870 call this%budobj%budterm(idx)%update_term(n1, n2, q)
1877 maxlist = this%flowbudptr%budterm(this%idxbudgwf)%maxlist
1879 call this%budobj%budterm(idx)%initialize(text, &
1884 maxlist, .false., .true., &
1886 call this%budobj%budterm(idx)%reset(maxlist)
1889 n1 = this%flowbudptr%budterm(this%idxbudgwf)%id1(n)
1890 n2 = this%flowbudptr%budterm(this%idxbudgwf)%id2(n)
1891 call this%budobj%budterm(idx)%update_term(n1, n2, q)
1895 this%idxprepak = idx
1896 call this%pak_setup_budobj(idx)
1897 this%idxlastpak = idx
1902 maxlist = this%flowbudptr%budterm(this%idxbudsto)%maxlist
1906 call this%budobj%budterm(idx)%initialize(text, &
1911 maxlist, .false., .false., &
1913 if (this%idxbudtmvr /= 0)
then
1918 maxlist = this%flowbudptr%budterm(this%idxbudtmvr)%maxlist
1920 ordered_id1 = this%flowbudptr%budterm(this%idxbudtmvr)%ordered_id1
1921 call this%budobj%budterm(idx)%initialize(text, &
1926 maxlist, .false., .false., &
1927 naux, ordered_id1=ordered_id1)
1929 if (this%idxbudfmvr /= 0)
then
1936 call this%budobj%budterm(idx)%initialize(text, &
1941 maxlist, .false., .false., &
1950 call this%budobj%budterm(idx)%initialize(text, &
1955 maxlist, .false., .false., &
1967 call this%budobj%budterm(idx)%initialize(text, &
1972 maxlist, .false., .false., &
1977 if (this%iprflow /= 0)
then
1978 call this%budobj%flowtable_df(this%iout)
1990 integer(I4B),
intent(inout) :: idx
1994 call store_error(
'Program error: pak_setup_budobj not implemented.', &
2005 real(DP),
dimension(:),
intent(in) :: x
2006 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
2008 integer(I4B) :: naux
2009 real(DP),
dimension(:),
allocatable :: auxvartmp
2010 integer(I4B) :: i, j, n1, n2
2012 integer(I4B) :: nlen
2013 integer(I4B) :: nlist
2014 integer(I4B) :: igwfnode
2017 real(DP) :: ccratin, ccratout
2028 this%ccterm(n1) =
dzero
2033 if (this%idxbudfjf /= 0)
then
2034 nlen = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
2038 nlist = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
2039 call this%budobj%budterm(idx)%reset(nlist)
2042 call this%apt_fjf_term(j, n1, n2, q)
2043 call this%budobj%budterm(idx)%update_term(n1, n2, q)
2044 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2050 call this%budobj%budterm(idx)%reset(this%maxbound)
2051 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
2053 n1 = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
2054 igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(j)
2055 if (this%iboundpak(n1) /= 0)
then
2056 q = this%hcof(j) * x(igwfnode) - this%rhs(j)
2059 call this%budobj%budterm(idx)%update_term(n1, igwfnode, q)
2060 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2065 idx = this%idxlastpak
2069 call this%budobj%budterm(idx)%reset(this%ncv)
2070 allocate (auxvartmp(1))
2072 call this%apt_get_volumes(n1, v1, v0,
delt)
2073 auxvartmp(1) = v1 * this%xnewpak(n1)
2075 call this%budobj%budterm(idx)%update_term(n1, n1, q, auxvartmp)
2076 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2078 deallocate (auxvartmp)
2081 if (this%idxbudtmvr /= 0)
then
2083 nlist = this%flowbudptr%budterm(this%idxbudtmvr)%nlist
2084 call this%budobj%budterm(idx)%reset(nlist)
2086 call this%apt_tmvr_term(j, n1, n2, q)
2087 call this%budobj%budterm(idx)%update_term(n1, n2, q)
2088 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2093 if (this%idxbudfmvr /= 0)
then
2096 call this%budobj%budterm(idx)%reset(nlist)
2098 call this%apt_fmvr_term(j, n1, n2, q)
2099 call this%budobj%budterm(idx)%update_term(n1, n1, q)
2100 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2106 call this%budobj%budterm(idx)%reset(this%ncv)
2109 call this%budobj%budterm(idx)%update_term(n1, n1, q)
2116 allocate (auxvartmp(naux))
2117 call this%budobj%budterm(idx)%reset(this%ncv)
2121 auxvartmp(i) = this%featureauxvar(i, n1)
2123 call this%budobj%budterm(idx)%update_term(n1, n1, q, auxvartmp)
2125 deallocate (auxvartmp)
2129 idx = this%idxprepak
2130 call this%pak_fill_budobj(idx, x, flowja, ccratin, ccratout)
2133 call this%budobj%accumulate_terms()
2142 integer(I4B),
intent(inout) :: idx
2143 real(DP),
dimension(:),
intent(in) :: x
2144 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
2145 real(DP),
intent(inout) :: ccratin
2146 real(DP),
intent(inout) :: ccratout
2151 call store_error(
'Program error: pak_fill_budobj not implemented.', &
2161 integer(I4B),
intent(in) :: ientry
2162 integer(I4B),
intent(inout) :: n1
2163 integer(I4B),
intent(inout) :: n2
2164 real(DP),
intent(inout),
optional :: rrate
2165 real(DP),
intent(inout),
optional :: rhsval
2166 real(DP),
intent(inout),
optional :: hcofval
2172 call this%apt_get_volumes(n1, v1, v0,
delt)
2173 c0 = this%xoldpak(n1)
2174 c1 = this%xnewpak(n1)
2175 if (
present(rrate))
then
2176 rrate = (-c1 * v1 /
delt + c0 * v0 /
delt) * this%eqnsclfac
2179 if (
present(rhsval)) rhsval = -c0 * v0 * this%eqnsclfac /
delt
2180 if (
present(hcofval)) hcofval = -v1 * this%eqnsclfac /
delt
2190 integer(I4B),
intent(in) :: ientry
2191 integer(I4B),
intent(inout) :: n1
2192 integer(I4B),
intent(inout) :: n2
2193 real(DP),
intent(inout),
optional :: rrate
2194 real(DP),
intent(inout),
optional :: rhsval
2195 real(DP),
intent(inout),
optional :: hcofval
2201 n1 = this%flowbudptr%budterm(this%idxbudtmvr)%id1(ientry)
2202 n2 = this%flowbudptr%budterm(this%idxbudtmvr)%id2(ientry)
2203 qbnd = this%flowbudptr%budterm(this%idxbudtmvr)%flow(ientry)
2204 ctmp = this%xnewpak(n1)
2205 if (
present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
2206 if (
present(rhsval)) rhsval =
dzero
2207 if (
present(hcofval)) hcofval = qbnd * this%eqnsclfac
2218 integer(I4B),
intent(in) :: ientry
2219 integer(I4B),
intent(inout) :: n1
2220 integer(I4B),
intent(inout) :: n2
2221 real(DP),
intent(inout),
optional :: rrate
2222 real(DP),
intent(inout),
optional :: rhsval
2223 real(DP),
intent(inout),
optional :: hcofval
2228 if (
present(rrate)) rrate = this%qmfrommvr(n1)
2229 if (
present(rhsval)) rhsval = this%qmfrommvr(n1)
2230 if (
present(hcofval)) hcofval =
dzero
2241 integer(I4B),
intent(in) :: ientry
2242 integer(I4B),
intent(inout) :: n1
2243 integer(I4B),
intent(inout) :: n2
2244 real(DP),
intent(inout),
optional :: rrate
2245 real(DP),
intent(inout),
optional :: rhsval
2246 real(DP),
intent(inout),
optional :: hcofval
2251 n1 = this%flowbudptr%budterm(this%idxbudfjf)%id1(ientry)
2252 n2 = this%flowbudptr%budterm(this%idxbudfjf)%id2(ientry)
2253 qbnd = this%flowbudptr%budterm(this%idxbudfjf)%flow(ientry)
2255 ctmp = this%xnewpak(n1)
2257 ctmp = this%xnewpak(n2)
2259 if (
present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
2260 if (
present(rhsval)) rhsval = -rrate * this%eqnsclfac
2261 if (
present(hcofval)) hcofval =
dzero
2272 integer(I4B) :: n, j
2275 if (this%iauxfpconc /= 0)
then
2278 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
2281 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
2282 this%flowpackagebnd%auxvar(this%iauxfpconc, j) = this%xnewpak(n)
2315 call this%pak_df_obs()
2330 call store_error(
'Program error: pak_df_obs not implemented.', &
2342 logical,
intent(inout) :: found
2346 call store_error(
'Program error: pak_rp_obs not implemented.', &
2361 character(len=*),
parameter :: fmterr = &
2362 "('Boundary ', a, ' for observation ', a, &
2363 &' is invalid in package ', a)"
2364 nn1 = obsrv%NodeNumber
2368 if (this%featname(j) == obsrv%FeatureName)
then
2370 call obsrv%AddObsIndex(j)
2373 if (.not. jfound)
then
2374 write (
errmsg, fmterr) trim(obsrv%FeatureName), trim(obsrv%Name), &
2381 if (nn1 < 0 .or. nn1 > this%ncv)
then
2382 write (
errmsg,
'(7a, i0, a, i0, a)') &
2383 'Observation ', trim(obsrv%Name),
' of type ', &
2384 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2385 trim(this%packName),
' was assigned ID = ', nn1, &
2386 '. ID must be >= 1 and <= ', this%ncv,
'.'
2389 call obsrv%AddObsIndex(nn1)
2403 integer(I4B) :: iconn
2408 character(len=*),
parameter :: fmterr = &
2409 "('Boundary ', a, ' for observation ', a, &
2410 &' is invalid in package ', a)"
2411 nn1 = obsrv%NodeNumber
2414 do j = 1, budterm%nlist
2415 icv = budterm%id1(j)
2416 if (this%featname(icv) == obsrv%FeatureName)
then
2418 call obsrv%AddObsIndex(j)
2421 if (.not. jfound)
then
2422 write (
errmsg, fmterr) trim(obsrv%FeatureName), trim(obsrv%Name), &
2429 if (nn1 < 0 .or. nn1 > this%ncv)
then
2430 write (
errmsg,
'(7a, i0, a, i0, a)') &
2431 'Observation ', trim(obsrv%Name),
' of type ', &
2432 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2433 trim(this%packName),
' was assigned ID = ', nn1, &
2434 '. ID must be >= 1 and <= ', this%ncv,
'.'
2437 iconn = obsrv%NodeNumber2
2438 do j = 1, budterm%nlist
2439 if (budterm%id1(j) == nn1)
then
2443 call obsrv%AddObsIndex(idx)
2447 if (idx < 1 .or. idx > budterm%nlist)
then
2448 write (
errmsg,
'(7a, i0, a, i0, a)') &
2449 'Observation ', trim(obsrv%Name),
' of type ', &
2450 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2451 trim(this%packName),
' specifies iconn = ', iconn, &
2452 ', but this is not a valid connection for ID ', nn1,
'.'
2454 else if (budterm%id1(idx) /= nn1)
then
2455 write (
errmsg,
'(7a, i0, a, i0, a)') &
2456 'Observation ', trim(obsrv%Name),
' of type ', &
2457 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2458 trim(this%packName),
' specifies iconn = ', iconn, &
2459 ', but this is not a valid connection for ID ', nn1,
'.'
2479 character(len=*),
parameter :: fmterr = &
2480 "('Boundary ', a, ' for observation ', a, &
2481 &' is invalid in package ', a)"
2482 nn1 = obsrv%NodeNumber
2485 do j = 1, budterm%nlist
2486 icv = budterm%id1(j)
2487 if (this%featname(icv) == obsrv%FeatureName)
then
2489 call obsrv%AddObsIndex(j)
2492 if (.not. jfound)
then
2493 write (
errmsg, fmterr) trim(obsrv%FeatureName), trim(obsrv%Name), &
2500 if (nn1 < 0 .or. nn1 > this%ncv)
then
2501 write (
errmsg,
'(7a, i0, a, i0, a)') &
2502 'Observation ', trim(obsrv%Name),
' of type ', &
2503 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2504 trim(this%packName),
' was assigned ID = ', nn1, &
2505 '. ID must be >= 1 and <= ', this%ncv,
'.'
2508 nn2 = obsrv%NodeNumber2
2511 if (nn2 < 0 .or. nn2 > this%ncv)
then
2512 write (
errmsg,
'(7a, i0, a, i0, a)') &
2513 'Observation ', trim(obsrv%Name),
' of type ', &
2514 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2515 trim(this%packName),
' was assigned ID2 = ', nn2, &
2516 '. ID must be >= 1 and <= ', this%ncv,
'.'
2521 do j = 1, budterm%nlist
2522 if (budterm%id1(j) == nn1 .and. budterm%id2(j) == nn2)
then
2523 call obsrv%AddObsIndex(j)
2527 if (.not. jfound)
then
2528 write (
errmsg,
'(7a, i0, a, i0, a)') &
2529 'Observation ', trim(obsrv%Name),
' of type ', &
2530 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2531 trim(this%packName), &
2532 ' specifies a connection between feature ', nn1, &
2533 ' feature ', nn2,
', but these features are not connected.'
2554 do i = 1, this%obs%npakobs
2555 obsrv => this%obs%pakobs(i)%obsrv
2556 select case (obsrv%ObsTypeId)
2557 case (
'CONCENTRATION',
'TEMPERATURE')
2558 call this%rp_obs_byfeature(obsrv)
2562 if (obsrv%indxbnds_count > 1)
then
2563 write (
errmsg,
'(a, a, a, a)') &
2564 trim(adjustl(this%depvartype))// &
2565 ' for observation', trim(adjustl(obsrv%Name)), &
2566 ' must be assigned to a feature with a unique boundname.'
2569 case (
'LKT',
'SFT',
'MWT',
'UZT',
'LKE',
'SFE',
'MWE',
'UZE')
2570 call this%rp_obs_budterm(obsrv, &
2571 this%flowbudptr%budterm(this%idxbudgwf))
2572 case (
'FLOW-JA-FACE')
2573 if (this%idxbudfjf > 0)
then
2574 call this%rp_obs_flowjaface(obsrv, &
2575 this%flowbudptr%budterm(this%idxbudfjf))
2578 'Observation ', trim(obsrv%Name),
' of type ', &
2579 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2580 trim(this%packName), &
2581 ' cannot be processed because there are no flow connections.'
2585 call this%rp_obs_byfeature(obsrv)
2587 call this%rp_obs_byfeature(obsrv)
2589 call this%rp_obs_byfeature(obsrv)
2594 call this%pak_rp_obs(obsrv, found)
2597 if (.not. found)
then
2598 errmsg =
'Unrecognized observation type "'// &
2599 trim(obsrv%ObsTypeId)//
'" for '// &
2600 trim(adjustl(this%text))//
' package '// &
2627 integer(I4B) :: igwfnode
2638 if (this%obs%npakobs > 0)
then
2639 call this%obs%obs_bd_clear()
2640 do i = 1, this%obs%npakobs
2641 obsrv => this%obs%pakobs(i)%obsrv
2642 do j = 1, obsrv%indxbnds_count
2644 jj = obsrv%indxbnds(j)
2645 select case (obsrv%ObsTypeId)
2646 case (
'CONCENTRATION',
'TEMPERATURE')
2647 if (this%iboundpak(jj) /= 0)
then
2648 v = this%xnewpak(jj)
2650 case (
'LKT',
'SFT',
'MWT',
'UZT',
'LKE',
'SFE',
'MWE',
'UZE')
2651 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(jj)
2652 if (this%iboundpak(n) /= 0)
then
2653 igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(jj)
2654 v = this%hcof(jj) * this%xnew(igwfnode) - this%rhs(jj)
2657 case (
'FLOW-JA-FACE')
2658 n = this%flowbudptr%budterm(this%idxbudfjf)%id1(jj)
2659 if (this%iboundpak(n) /= 0)
then
2660 call this%apt_fjf_term(jj, n1, n2, v)
2663 if (this%iboundpak(jj) /= 0)
then
2667 if (this%iboundpak(jj) /= 0)
then
2671 if (this%iboundpak(jj) /= 0 .and. this%idxbudfmvr > 0)
then
2672 call this%apt_fmvr_term(jj, n1, n2, v)
2675 if (this%idxbudtmvr > 0)
then
2676 n = this%flowbudptr%budterm(this%idxbudtmvr)%id1(jj)
2677 if (this%iboundpak(n) /= 0)
then
2678 call this%apt_tmvr_term(jj, n1, n2, v)
2685 call this%pak_bd_obs(obsrv%ObsTypeId, jj, v, found)
2688 if (.not. found)
then
2689 errmsg =
'Unrecognized observation type "'// &
2690 trim(obsrv%ObsTypeId)//
'" for '// &
2691 trim(adjustl(this%text))//
' package '// &
2696 call this%obs%SaveOneSimval(obsrv, v)
2712 character(len=*),
intent(in) :: obstypeid
2713 integer(I4B),
intent(in) :: jj
2714 real(DP),
intent(inout) :: v
2715 logical,
intent(inout) :: found
2732 integer(I4B),
intent(in) :: inunitobs
2733 integer(I4B),
intent(in) :: iout
2736 integer(I4B) :: icol
2737 integer(I4B) :: istart
2738 integer(I4B) :: istop
2739 character(len=LINELENGTH) :: string
2740 character(len=LENBOUNDNAME) :: bndname
2743 string = obsrv%IDstring
2753 obsrv%FeatureName = bndname
2757 obsrv%NodeNumber = nn1
2762 obsrv%NodeNumber2 = 1
2775 integer(I4B),
intent(in) :: inunitobs
2776 integer(I4B),
intent(in) :: iout
2779 integer(I4B) :: iconn
2780 integer(I4B) :: icol
2781 integer(I4B) :: istart
2782 integer(I4B) :: istop
2783 character(len=LINELENGTH) :: string
2784 character(len=LENBOUNDNAME) :: bndname
2787 string = obsrv%IDstring
2797 obsrv%FeatureName = bndname
2800 if (len_trim(bndname) < 1 .and. iconn < 0)
then
2801 write (
errmsg,
'(a,1x,a,a,1x,a,1x,a)') &
2802 'For observation type', trim(adjustl(obsrv%ObsTypeId)), &
2803 ', ID given as an integer and not as boundname,', &
2804 'but ID2 is missing. Either change ID to valid', &
2805 'boundname or supply valid entry for ID2.'
2808 obsrv%NodeNumber2 = iconn
2812 obsrv%NodeNumber = nn1
2827 integer(I4B) :: nterms
2828 character(len=LINELENGTH) :: title
2829 character(len=LINELENGTH) :: text_temp
2832 if (this%iprconc > 0)
then
2836 if (this%inamedbound == 1) nterms = nterms + 1
2839 title = trim(adjustl(this%text))//
' PACKAGE ('// &
2840 trim(adjustl(this%packName))// &
2841 ') '//trim(adjustl(this%depvartype))// &
2842 &
' FOR EACH CONTROL VOLUME'
2845 call table_cr(this%dvtab, this%packName, title)
2846 call this%dvtab%table_df(this%ncv, nterms, this%iout, &
2850 if (this%inamedbound == 1)
then
2852 call this%dvtab%initialize_column(text_temp, 20, alignment=tableft)
2856 text_temp =
'NUMBER'
2857 call this%dvtab%initialize_column(text_temp, 10, alignment=tabcenter)
2860 text_temp = this%depvartype(1:4)
2861 call this%dvtab%initialize_column(text_temp, 12, alignment=tabcenter)
This module contains the extended boundary package.
This module contains the base boundary package.
This module contains the BudgetModule.
subroutine, public budget_cr(this, name_model)
@ brief Create a new budget object
subroutine, public budgetobject_cr(this, name)
Create a new budget object.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
real(dp), parameter dhdry
real dry cell constant
@ tabcenter
centered table column
@ tabright
right justified table column
@ tableft
left justified table column
@ mnormal
normal output mode
@ tabucstring
upper case string table data
@ tabstring
string table data
@ tabinteger
integer table data
integer(i4b), parameter lenpackagename
maximum length of the package name
integer(i4b), parameter namedboundflag
named bound flag
real(dp), parameter dnodata
real no data constant
real(dp), parameter dhnoflo
real no flow constant
real(dp), parameter dep20
real constant 1e20
integer(i4b), parameter lenvarname
maximum length of a variable 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
integer(i4b), parameter lenboundname
maximum length of a bound name
real(dp), parameter dzero
real constant zero
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
real(dp), parameter done
real constant 1
This module defines variable data types.
Previous variable names checked in as deprecated aliases.
subroutine, public memorystore_release(varname, memory_path)
Release a single variable from the memory store.
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
This module contains the derived types ObserveType and ObsDataType.
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.
subroutine, public store_error_unit(iunit, terminate)
Store the file unit number.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
integer(i4b) ifailedstepretry
current retry for this time step
subroutine, public table_cr(this, name, title)
real(dp), pointer, public pertim
time relative to start of stress period
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
real(dp), pointer, public delt
length of the current time step
subroutine apt_ot_bdsummary(this, kstp, kper, iout, ibudfl)
Print advanced package transport dependent variables.
subroutine apt_cfupdate(this)
Advanced package transport routine.
subroutine apt_checkin_deprecated_names(this)
Alias deprecated advanced transport variable names.
subroutine pak_setup_budobj(this, idx)
Set up a budget object that stores an advanced package flows.
subroutine apt_ar(this)
Advanced package transport allocate and read (ar) routine.
subroutine pak_fill_budobj(this, idx, x, flowja, ccratin, ccratout)
Copy flow terms into thisbudobj, must be overridden.
subroutine apt_ad_resync(this)
Per-timestep TS re-sync and state update.
subroutine rp_obs_flowjaface(this, obsrv, budterm)
Prepare observation.
subroutine pak_bd_obs(this, obstypeid, jj, v, found)
Check if observation exists in an advanced package.
subroutine apt_source_options(this)
Source OPTIONS block from the input context.
subroutine apt_fc_expanded(this, rhs, ia, idxglo, matrix_sln)
Advanced package transport fill coefficient (fc) method.
subroutine pak_fc_expanded(this, rhs, ia, idxglo, matrix_sln)
Advanced package transport fill coefficient (fc) method.
subroutine apt_fjf_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Go through each "within apt-apt" connection (e.g., lkt-lkt, or sft-sft) and accumulate total mass (or...
subroutine rp_obs_budterm(this, obsrv, budterm)
Prepare observation.
subroutine allocate_scalars(this)
@ brief Allocate scalars
subroutine apt_read_initial_attr(this)
Read the initial parameters for an advanced package.
subroutine apt_setup_budobj(this)
Set up the budget object that stores advanced package flow terms.
subroutine apt_allocate_index_arrays(this)
@ brief Allocate index arrays
subroutine apt_rp_obs(this)
Read and prepare apt-related observations.
character(len=lenvarname) text
subroutine apt_ot_package_flows(this, icbcfl, ibudfl)
Save advanced package flows routine.
real(dp) function, dimension(:), pointer, contiguous get_mvr_depvar(this)
Advanced package transport utility function.
subroutine apt_allocate_arrays(this)
@ brief Allocate arrays
integer(i4b) function pak_get_nbudterms(this)
Function to return the number of budget terms just for this package.
subroutine apt_df_obs(this)
Define observation type.
character(len=lenftype) ftype
subroutine apt_fmvr_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Account for mass or energy transferred to this package from the MVR package.
subroutine apt_da(this)
@ brief Deallocate memory
subroutine apt_ad_ts(this)
Virtual hook: called every timestep, after the time series manager advances, before apt_ad_chk....
subroutine apt_mc(this, moffset, matrix_sln)
Advanced package transport map package connections to matrix.
real(dp) function apt_setting_value(this, itemno, key)
Virtual hook: value for a package-specific PERIOD setting. Override in individual packages to supply ...
subroutine apt_fill_budobj(this, x, flowja)
Copy flow terms into thisbudobj.
subroutine pak_rp_obs(this, obsrv, found)
Process package specific obs.
logical function apt_obs_supported(this)
Determine whether an obs type is supported.
subroutine apt_bd_obs(this)
Calculate observation values.
subroutine apt_solve(this)
Add terms specific to advanced package transport to the explicit solve.
subroutine apt_tmvr_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Account for mass or energy transferred to the MVR package.
subroutine apt_get_volumes(this, icv, vnew, vold, delt)
Return the feature new volume and old volume.
subroutine apt_source_cvs(this)
Source PACKAGEDATA feature information from the input context.
subroutine apt_set_pointers(this, neq, ibound, xnew, xold, flowja)
Set pointers to model arrays and variables so that a package has access to these items.
subroutine apt_accumulate_ccterm(this, ilak, rrate, ccratin, ccratout)
Accumulate constant concentration (or temperature) terms for budget.
subroutine apt_setup_tableobj(this)
Setup a table object an advanced package.
subroutine find_apt_package(this)
Find corresponding advanced package transport package.
subroutine apt_rp(this)
Advanced package transport read and prepare (rp) routine.
subroutine apt_stor_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Account for mass or energy storage in advanced package features.
subroutine apt_source_dimensions(this)
Source DIMENSIONS from the flow package; allocate package arrays.
subroutine rp_obs_byfeature(this, obsrv)
Prepare observation.
subroutine apt_copy2flowp(this)
Copy concentrations (or temperatures) into flow package aux variable.
subroutine apt_cq(this, x, flowja, iadv)
Advanced package transport calculate flows (cq) routine.
subroutine apt_ac(this, moffset, sparse)
Add package connection to matrix.
subroutine, public apt_process_obsid(obsrv, dis, inunitobs, iout)
Process observation IDs for an advanced package.
subroutine apt_ad(this)
Advanced package transport routine.
integer(i4b) function apt_check_valid(this, itemno)
Advanced package transport routine.
subroutine apt_ad_chk(this)
subroutine define_listlabel(this)
Define the list heading that is written to iout when PRINT_INPUT option is used.
subroutine pak_solve(this)
Add terms specific to advanced package transport features to the explicit solve routine.
subroutine apt_fc_nonexpanded(this, rhs, ia, idxglo, matrix_sln)
Advanced package transport fill coefficient (fc) method.
subroutine apt_reset(this)
Override bnd reset for custom mover logic.
subroutine apt_fc(this, rhs, ia, idxglo, matrix_sln)
subroutine apt_ot_dv(this, idvsave, idvprint)
subroutine pak_df_obs(this)
Define apt observation type.
subroutine, public apt_process_obsid12(obsrv, dis, inunitobs, iout)
Process observation IDs for a package.
This class is used to store a single deferred-length character string. It was designed to work in an ...