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)
787 if (qbnd < dzero) omega = done
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)
868 if (qbnd < dzero) omega = done
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
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)
1359 call assign_iounit(this%iconcout, this%inunit, &
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
1428 write (errmsg,
'(a)') &
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) :: n, n1, n2
1806 integer(I4B) :: maxlist, naux
1808 logical :: ordered_id1
1810 character(len=LENBUDTXT) :: bddim_opt
1811 character(len=LENBUDTXT) :: text, textt
1812 character(len=LENBUDTXT),
dimension(1) :: auxtxt
1821 if (this%idxbudfjf /= 0) nbudterm = nbudterm + 1
1824 nbudterm = nbudterm + 3
1827 nbudterm = nbudterm + this%pak_get_nbudterms()
1830 if (this%idxbudtmvr /= 0) nbudterm = nbudterm + 1
1831 if (this%idxbudfmvr /= 0) nbudterm = nbudterm + 1
1832 if (this%naux > 0) nbudterm = nbudterm + 1
1837 bddim_opt = this%depvarunitabbrev
1838 call this%budobj%budgetobject_df(this%ncv, nbudterm, 0, 0, &
1839 bddim_opt=bddim_opt, ibudcsv=this%ibudcsv)
1845 if (this%idxbudfjf /= 0)
then
1846 text =
' FLOW-JA-FACE'
1848 maxlist = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
1850 ordered_id1 = this%flowbudptr%budterm(this%idxbudfjf)%ordered_id1
1851 call this%budobj%budterm(idx)%initialize(text, &
1856 maxlist, .false., .false., &
1857 naux, ordered_id1=ordered_id1)
1860 call this%budobj%budterm(idx)%reset(maxlist)
1863 n1 = this%flowbudptr%budterm(this%idxbudfjf)%id1(n)
1864 n2 = this%flowbudptr%budterm(this%idxbudfjf)%id2(n)
1865 call this%budobj%budterm(idx)%update_term(n1, n2, q)
1872 maxlist = this%flowbudptr%budterm(this%idxbudgwf)%maxlist
1874 call this%budobj%budterm(idx)%initialize(text, &
1879 maxlist, .false., .true., &
1881 call this%budobj%budterm(idx)%reset(maxlist)
1884 n1 = this%flowbudptr%budterm(this%idxbudgwf)%id1(n)
1885 n2 = this%flowbudptr%budterm(this%idxbudgwf)%id2(n)
1886 call this%budobj%budterm(idx)%update_term(n1, n2, q)
1890 this%idxprepak = idx
1891 call this%pak_setup_budobj(idx)
1892 this%idxlastpak = idx
1897 maxlist = this%flowbudptr%budterm(this%idxbudsto)%maxlist
1899 write (textt,
'(a)') str_pad_left(this%depvarunit, 16)
1901 call this%budobj%budterm(idx)%initialize(text, &
1906 maxlist, .false., .false., &
1908 if (this%idxbudtmvr /= 0)
then
1913 maxlist = this%flowbudptr%budterm(this%idxbudtmvr)%maxlist
1915 ordered_id1 = this%flowbudptr%budterm(this%idxbudtmvr)%ordered_id1
1916 call this%budobj%budterm(idx)%initialize(text, &
1921 maxlist, .false., .false., &
1922 naux, ordered_id1=ordered_id1)
1924 if (this%idxbudfmvr /= 0)
then
1931 call this%budobj%budterm(idx)%initialize(text, &
1936 maxlist, .false., .false., &
1945 call this%budobj%budterm(idx)%initialize(text, &
1950 maxlist, .false., .false., &
1962 call this%budobj%budterm(idx)%initialize(text, &
1967 maxlist, .false., .false., &
1972 if (this%iprflow /= 0)
then
1973 call this%budobj%flowtable_df(this%iout)
1985 integer(I4B),
intent(inout) :: idx
1989 call store_error(
'Program error: pak_setup_budobj not implemented.', &
2000 real(DP),
dimension(:),
intent(in) :: x
2001 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
2003 integer(I4B) :: naux
2004 real(DP),
dimension(:),
allocatable :: auxvartmp
2005 integer(I4B) :: i, j, n1, n2
2007 integer(I4B) :: nlist
2008 integer(I4B) :: igwfnode
2011 real(DP) :: ccratin, ccratout
2022 this%ccterm(n1) = dzero
2026 if (this%idxbudfjf /= 0)
then
2028 nlist = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
2029 call this%budobj%budterm(idx)%reset(nlist)
2032 call this%apt_fjf_term(j, n1, n2, q)
2033 call this%budobj%budterm(idx)%update_term(n1, n2, q)
2034 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2040 call this%budobj%budterm(idx)%reset(this%maxbound)
2041 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
2043 n1 = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
2044 igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(j)
2045 if (this%iboundpak(n1) /= 0)
then
2046 q = this%hcof(j) * x(igwfnode) - this%rhs(j)
2049 call this%budobj%budterm(idx)%update_term(n1, igwfnode, q)
2050 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2055 idx = this%idxlastpak
2059 call this%budobj%budterm(idx)%reset(this%ncv)
2060 allocate (auxvartmp(1))
2062 call this%apt_get_volumes(n1, v1, v0,
delt)
2063 auxvartmp(1) = v1 * this%xnewpak(n1)
2065 call this%budobj%budterm(idx)%update_term(n1, n1, q, auxvartmp)
2066 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2068 deallocate (auxvartmp)
2071 if (this%idxbudtmvr /= 0)
then
2073 nlist = this%flowbudptr%budterm(this%idxbudtmvr)%nlist
2074 call this%budobj%budterm(idx)%reset(nlist)
2076 call this%apt_tmvr_term(j, n1, n2, q)
2077 call this%budobj%budterm(idx)%update_term(n1, n2, q)
2078 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2083 if (this%idxbudfmvr /= 0)
then
2086 call this%budobj%budterm(idx)%reset(nlist)
2088 call this%apt_fmvr_term(j, n1, n2, q)
2089 call this%budobj%budterm(idx)%update_term(n1, n1, q)
2090 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2096 call this%budobj%budterm(idx)%reset(this%ncv)
2099 call this%budobj%budterm(idx)%update_term(n1, n1, q)
2106 allocate (auxvartmp(naux))
2107 call this%budobj%budterm(idx)%reset(this%ncv)
2111 auxvartmp(i) = this%featureauxvar(i, n1)
2113 call this%budobj%budterm(idx)%update_term(n1, n1, q, auxvartmp)
2115 deallocate (auxvartmp)
2119 idx = this%idxprepak
2120 call this%pak_fill_budobj(idx, x, flowja, ccratin, ccratout)
2123 call this%budobj%accumulate_terms()
2132 integer(I4B),
intent(inout) :: idx
2133 real(DP),
dimension(:),
intent(in) :: x
2134 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
2135 real(DP),
intent(inout) :: ccratin
2136 real(DP),
intent(inout) :: ccratout
2141 call store_error(
'Program error: pak_fill_budobj not implemented.', &
2151 integer(I4B),
intent(in) :: ientry
2152 integer(I4B),
intent(inout) :: n1
2153 integer(I4B),
intent(inout) :: n2
2154 real(DP),
intent(inout),
optional :: rrate
2155 real(DP),
intent(inout),
optional :: rhsval
2156 real(DP),
intent(inout),
optional :: hcofval
2162 call this%apt_get_volumes(n1, v1, v0,
delt)
2163 c0 = this%xoldpak(n1)
2164 c1 = this%xnewpak(n1)
2165 if (
present(rrate))
then
2166 rrate = (-c1 * v1 /
delt + c0 * v0 /
delt) * this%eqnsclfac
2169 if (
present(rhsval)) rhsval = -c0 * v0 * this%eqnsclfac /
delt
2170 if (
present(hcofval)) hcofval = -v1 * this%eqnsclfac /
delt
2180 integer(I4B),
intent(in) :: ientry
2181 integer(I4B),
intent(inout) :: n1
2182 integer(I4B),
intent(inout) :: n2
2183 real(DP),
intent(inout),
optional :: rrate
2184 real(DP),
intent(inout),
optional :: rhsval
2185 real(DP),
intent(inout),
optional :: hcofval
2191 n1 = this%flowbudptr%budterm(this%idxbudtmvr)%id1(ientry)
2192 n2 = this%flowbudptr%budterm(this%idxbudtmvr)%id2(ientry)
2193 qbnd = this%flowbudptr%budterm(this%idxbudtmvr)%flow(ientry)
2194 ctmp = this%xnewpak(n1)
2195 if (
present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
2196 if (
present(rhsval)) rhsval = dzero
2197 if (
present(hcofval)) hcofval = qbnd * this%eqnsclfac
2208 integer(I4B),
intent(in) :: ientry
2209 integer(I4B),
intent(inout) :: n1
2210 integer(I4B),
intent(inout) :: n2
2211 real(DP),
intent(inout),
optional :: rrate
2212 real(DP),
intent(inout),
optional :: rhsval
2213 real(DP),
intent(inout),
optional :: hcofval
2218 if (
present(rrate)) rrate = this%qmfrommvr(n1)
2219 if (
present(rhsval)) rhsval = this%qmfrommvr(n1)
2220 if (
present(hcofval)) hcofval = dzero
2231 integer(I4B),
intent(in) :: ientry
2232 integer(I4B),
intent(inout) :: n1
2233 integer(I4B),
intent(inout) :: n2
2234 real(DP),
intent(inout),
optional :: rrate
2235 real(DP),
intent(inout),
optional :: rhsval
2236 real(DP),
intent(inout),
optional :: hcofval
2241 n1 = this%flowbudptr%budterm(this%idxbudfjf)%id1(ientry)
2242 n2 = this%flowbudptr%budterm(this%idxbudfjf)%id2(ientry)
2243 qbnd = this%flowbudptr%budterm(this%idxbudfjf)%flow(ientry)
2245 ctmp = this%xnewpak(n1)
2247 ctmp = this%xnewpak(n2)
2249 if (
present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
2250 if (
present(rhsval)) rhsval = -rrate * this%eqnsclfac
2251 if (
present(hcofval)) hcofval = dzero
2262 integer(I4B) :: n, j
2265 if (this%iauxfpconc /= 0)
then
2268 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
2271 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
2272 this%flowpackagebnd%auxvar(this%iauxfpconc, j) = this%xnewpak(n)
2305 call this%pak_df_obs()
2320 call store_error(
'Program error: pak_df_obs not implemented.', &
2332 logical,
intent(inout) :: found
2336 call store_error(
'Program error: pak_rp_obs not implemented.', &
2351 character(len=*),
parameter :: fmterr = &
2352 "('Boundary ', a, ' for observation ', a, &
2353 &' is invalid in package ', a)"
2354 nn1 = obsrv%NodeNumber
2355 if (nn1 == namedboundflag)
then
2358 if (this%featname(j) == obsrv%FeatureName)
then
2360 call obsrv%AddObsIndex(j)
2363 if (.not. jfound)
then
2364 write (errmsg, fmterr) trim(obsrv%FeatureName), trim(obsrv%Name), &
2371 if (nn1 < 1 .or. nn1 > this%ncv)
then
2372 write (errmsg,
'(7a, i0, a, i0, a)') &
2373 'Observation ', trim(obsrv%Name),
' of type ', &
2374 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2375 trim(this%packName),
' was assigned ID = ', nn1, &
2376 '. ID must be >= 1 and <= ', this%ncv,
'.'
2379 call obsrv%AddObsIndex(nn1)
2393 integer(I4B) :: iconn
2398 character(len=*),
parameter :: fmterr = &
2399 "('Boundary ', a, ' for observation ', a, &
2400 &' is invalid in package ', a)"
2401 nn1 = obsrv%NodeNumber
2402 if (nn1 == namedboundflag)
then
2404 do j = 1, budterm%nlist
2405 icv = budterm%id1(j)
2406 if (this%featname(icv) == obsrv%FeatureName)
then
2408 call obsrv%AddObsIndex(j)
2411 if (.not. jfound)
then
2412 write (errmsg, fmterr) trim(obsrv%FeatureName), trim(obsrv%Name), &
2419 if (nn1 < 1 .or. nn1 > this%ncv)
then
2420 write (errmsg,
'(7a, i0, a, i0, a)') &
2421 'Observation ', trim(obsrv%Name),
' of type ', &
2422 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2423 trim(this%packName),
' was assigned ID = ', nn1, &
2424 '. ID must be >= 1 and <= ', this%ncv,
'.'
2427 iconn = obsrv%NodeNumber2
2430 do j = 1, budterm%nlist
2431 if (budterm%id1(j) == nn1)
then
2435 call obsrv%AddObsIndex(idx)
2439 if (idx < 1 .or. idx > budterm%nlist)
then
2440 write (errmsg,
'(7a, i0, a, i0, a)') &
2441 'Observation ', trim(obsrv%Name),
' of type ', &
2442 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2443 trim(this%packName),
' specifies iconn = ', iconn, &
2444 ', but this is not a valid connection for ID ', nn1,
'.'
2446 else if (budterm%id1(idx) /= nn1)
then
2447 write (errmsg,
'(7a, i0, a, i0, a)') &
2448 'Observation ', trim(obsrv%Name),
' of type ', &
2449 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2450 trim(this%packName),
' specifies iconn = ', iconn, &
2451 ', but this is not a valid connection for ID ', nn1,
'.'
2471 character(len=*),
parameter :: fmterr = &
2472 "('Boundary ', a, ' for observation ', a, &
2473 &' is invalid in package ', a)"
2474 nn1 = obsrv%NodeNumber
2475 if (nn1 == namedboundflag)
then
2477 do j = 1, budterm%nlist
2478 icv = budterm%id1(j)
2479 if (this%featname(icv) == obsrv%FeatureName)
then
2481 call obsrv%AddObsIndex(j)
2484 if (.not. jfound)
then
2485 write (errmsg, fmterr) trim(obsrv%FeatureName), trim(obsrv%Name), &
2492 if (nn1 < 1 .or. nn1 > this%ncv)
then
2493 write (errmsg,
'(7a, i0, a, i0, a)') &
2494 'Observation ', trim(obsrv%Name),
' of type ', &
2495 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2496 trim(this%packName),
' was assigned ID = ', nn1, &
2497 '. ID must be >= 1 and <= ', this%ncv,
'.'
2500 nn2 = obsrv%NodeNumber2
2503 if (nn2 < 1 .or. nn2 > this%ncv)
then
2504 write (errmsg,
'(7a, i0, a, i0, a)') &
2505 'Observation ', trim(obsrv%Name),
' of type ', &
2506 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2507 trim(this%packName),
' was assigned ID2 = ', nn2, &
2508 '. ID must be >= 1 and <= ', this%ncv,
'.'
2513 do j = 1, budterm%nlist
2514 if (budterm%id1(j) == nn1 .and. budterm%id2(j) == nn2)
then
2515 call obsrv%AddObsIndex(j)
2519 if (.not. jfound)
then
2520 write (errmsg,
'(7a, i0, a, i0, a)') &
2521 'Observation ', trim(obsrv%Name),
' of type ', &
2522 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2523 trim(this%packName), &
2524 ' specifies a connection between feature ', nn1, &
2525 ' feature ', nn2,
', but these features are not connected.'
2546 do i = 1, this%obs%npakobs
2547 obsrv => this%obs%pakobs(i)%obsrv
2548 select case (obsrv%ObsTypeId)
2549 case (
'CONCENTRATION',
'TEMPERATURE')
2550 call this%rp_obs_byfeature(obsrv)
2554 if (obsrv%indxbnds_count > 1)
then
2555 write (errmsg,
'(a, a, a, a)') &
2556 trim(adjustl(this%depvartype))// &
2557 ' for observation', trim(adjustl(obsrv%Name)), &
2558 ' must be assigned to a feature with a unique boundname.'
2561 case (
'LKT',
'SFT',
'MWT',
'UZT',
'LKE',
'SFE',
'MWE',
'UZE')
2562 call this%rp_obs_budterm(obsrv, &
2563 this%flowbudptr%budterm(this%idxbudgwf))
2564 case (
'FLOW-JA-FACE')
2565 if (this%idxbudfjf > 0)
then
2566 call this%rp_obs_flowjaface(obsrv, &
2567 this%flowbudptr%budterm(this%idxbudfjf))
2569 write (errmsg,
'(7a)') &
2570 'Observation ', trim(obsrv%Name),
' of type ', &
2571 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2572 trim(this%packName), &
2573 ' cannot be processed because there are no flow connections.'
2577 call this%rp_obs_byfeature(obsrv)
2579 call this%rp_obs_byfeature(obsrv)
2581 call this%rp_obs_byfeature(obsrv)
2586 call this%pak_rp_obs(obsrv, found)
2589 if (.not. found)
then
2590 errmsg =
'Unrecognized observation type "'// &
2591 trim(obsrv%ObsTypeId)//
'" for '// &
2592 trim(adjustl(this%text))//
' package '// &
2619 integer(I4B) :: igwfnode
2630 if (this%obs%npakobs > 0)
then
2631 call this%obs%obs_bd_clear()
2632 do i = 1, this%obs%npakobs
2633 obsrv => this%obs%pakobs(i)%obsrv
2634 do j = 1, obsrv%indxbnds_count
2636 jj = obsrv%indxbnds(j)
2637 select case (obsrv%ObsTypeId)
2638 case (
'CONCENTRATION',
'TEMPERATURE')
2639 if (this%iboundpak(jj) /= 0)
then
2640 v = this%xnewpak(jj)
2642 case (
'LKT',
'SFT',
'MWT',
'UZT',
'LKE',
'SFE',
'MWE',
'UZE')
2643 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(jj)
2644 if (this%iboundpak(n) /= 0)
then
2645 igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(jj)
2646 v = this%hcof(jj) * this%xnew(igwfnode) - this%rhs(jj)
2649 case (
'FLOW-JA-FACE')
2650 n = this%flowbudptr%budterm(this%idxbudfjf)%id1(jj)
2651 if (this%iboundpak(n) /= 0)
then
2652 call this%apt_fjf_term(jj, n1, n2, v)
2655 if (this%iboundpak(jj) /= 0)
then
2659 if (this%iboundpak(jj) /= 0)
then
2663 if (this%iboundpak(jj) /= 0 .and. this%idxbudfmvr > 0)
then
2664 call this%apt_fmvr_term(jj, n1, n2, v)
2667 if (this%idxbudtmvr > 0)
then
2668 n = this%flowbudptr%budterm(this%idxbudtmvr)%id1(jj)
2669 if (this%iboundpak(n) /= 0)
then
2670 call this%apt_tmvr_term(jj, n1, n2, v)
2677 call this%pak_bd_obs(obsrv%ObsTypeId, jj, v, found)
2680 if (.not. found)
then
2681 errmsg =
'Unrecognized observation type "'// &
2682 trim(obsrv%ObsTypeId)//
'" for '// &
2683 trim(adjustl(this%text))//
' package '// &
2688 call this%obs%SaveOneSimval(obsrv, v)
2704 character(len=*),
intent(in) :: obstypeid
2705 integer(I4B),
intent(in) :: jj
2706 real(DP),
intent(inout) :: v
2707 logical,
intent(inout) :: found
2724 integer(I4B),
intent(in) :: inunitobs
2725 integer(I4B),
intent(in) :: iout
2728 integer(I4B) :: icol
2729 integer(I4B) :: istart
2730 integer(I4B) :: istop
2731 character(len=LINELENGTH) :: string
2732 character(len=LENBOUNDNAME) :: bndname
2735 string = obsrv%IDstring
2743 call extract_idnum_or_bndname(string, icol, istart, istop, nn1, bndname)
2744 if (nn1 == namedboundflag)
then
2745 obsrv%FeatureName = bndname
2749 obsrv%NodeNumber = nn1
2754 obsrv%NodeNumber2 = 1
2767 integer(I4B),
intent(in) :: inunitobs
2768 integer(I4B),
intent(in) :: iout
2771 integer(I4B) :: iconn
2772 integer(I4B) :: icol
2773 integer(I4B) :: istart
2774 integer(I4B) :: istop
2775 character(len=LINELENGTH) :: string
2776 character(len=LENBOUNDNAME) :: bndname
2779 string = obsrv%IDstring
2787 call extract_idnum_or_bndname(string, icol, istart, istop, nn1, bndname)
2788 if (nn1 == namedboundflag)
then
2789 obsrv%FeatureName = bndname
2791 call extract_idnum_or_bndname(string, icol, istart, istop, iconn, bndname)
2792 if (len_trim(bndname) < 1 .and. iconn < 0)
then
2793 write (errmsg,
'(a,1x,a,a,1x,a,1x,a)') &
2794 'For observation type', trim(adjustl(obsrv%ObsTypeId)), &
2795 ', ID given as an integer and not as boundname,', &
2796 'but ID2 is missing. Either change ID to valid', &
2797 'boundname or supply valid entry for ID2.'
2800 obsrv%NodeNumber2 = iconn
2804 obsrv%NodeNumber = nn1
2819 integer(I4B) :: nterms
2820 character(len=LINELENGTH) :: title
2821 character(len=LINELENGTH) :: text_temp
2824 if (this%iprconc > 0)
then
2828 if (this%inamedbound == 1) nterms = nterms + 1
2831 title = trim(adjustl(this%text))//
' PACKAGE ('// &
2832 trim(adjustl(this%packName))// &
2833 ') '//trim(adjustl(this%depvartype))// &
2834 &
' FOR EACH CONTROL VOLUME'
2837 call table_cr(this%dvtab, this%packName, title)
2838 call this%dvtab%table_df(this%ncv, nterms, this%iout, &
2842 if (this%inamedbound == 1)
then
2844 call this%dvtab%initialize_column(text_temp, 20, alignment=
tableft)
2848 text_temp =
'NUMBER'
2849 call this%dvtab%initialize_column(text_temp, 10, alignment=
tabcenter)
2852 text_temp = this%depvartype(1:4)
2853 call this%dvtab%initialize_column(text_temp, 12, alignment=
tabcenter)
This module contains the extended boundary package.
subroutine source_dimensions(this)
Source package dimensions from input context.
subroutine source_options(this)
Source package options from input context.
This module contains the base boundary package.
logical(lgp) function bnd_obs_supported(this)
Determine if observations are supported.
subroutine bnd_ar(this)
Allocate and read method for boundary package.
subroutine bnd_rp(this)
Allocate and read method for package.
subroutine allocate_scalars(this)
Allocate package scalars.
subroutine bnd_ot_dv(this, idvsave, idvprint)
Output advanced package dependent-variable terms.
subroutine bnd_ot_package_flows(this, icbcfl, ibudfl)
Output advanced package flow terms.
subroutine bnd_bd_obs(this)
Save observations for the package.
subroutine bnd_da(this)
Deallocate package memory.
subroutine bnd_mc(this, moffset, matrix_sln)
Map boundary package connection to matrix.
subroutine bnd_fc(this, rhs, ia, idxglo, matrix_sln)
Copy hcof and rhs terms into solution.
subroutine bnd_ac(this, moffset, sparse)
Add boundary package connection to matrix.
subroutine bnd_ot_bdsummary(this, kstp, kper, iout, ibudfl)
Output advanced package budget summary.
subroutine bnd_df_obs(this)
Define the observation types available in the package.
subroutine bnd_reset(this)
Reset bnd package before formulating.
subroutine set_pointers(this, neq, ibound, xnew, xold, flowja)
Set pointers to model variables.
subroutine bnd_rp_obs(this)
Read and prepare observations for a package.
subroutine bnd_ad(this)
Advance the boundary package.
subroutine bnd_cq(this, x, flowja, iadv)
Calculate advanced package flows.
subroutine define_listlabel(this)
Define the list label for the package.
This module contains the BudgetModule.
subroutine, public budget_cr(this, name_model)
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)
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 finalize(this)
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 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)
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)
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)
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 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 ...