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()
205 integer(I4B),
intent(in) :: moffset
209 integer(I4B) :: jj, jglo
214 if (this%imatrows /= 0)
then
218 nglo = moffset + this%dis%nodes + this%ioffset + n
219 call sparse%addconnection(nglo, nglo, 1)
223 do i = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
224 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(i)
225 jj = this%flowbudptr%budterm(this%idxbudgwf)%id2(i)
226 nglo = moffset + this%dis%nodes + this%ioffset + n
228 call sparse%addconnection(nglo, jglo, 1)
229 call sparse%addconnection(jglo, nglo, 1)
233 if (this%idxbudfjf /= 0)
then
234 do i = 1, this%flowbudptr%budterm(this%idxbudfjf)%maxlist
235 n = this%flowbudptr%budterm(this%idxbudfjf)%id1(i)
236 jj = this%flowbudptr%budterm(this%idxbudfjf)%id2(i)
237 nglo = moffset + this%dis%nodes + this%ioffset + n
238 jglo = moffset + this%dis%nodes + this%ioffset + jj
239 call sparse%addconnection(nglo, jglo, 1)
247 subroutine apt_mc(this, moffset, matrix_sln)
251 integer(I4B),
intent(in) :: moffset
254 integer(I4B) :: n, j, iglo, jglo
259 call this%apt_allocate_index_arrays()
262 if (this%imatrows /= 0)
then
269 this%idxlocnode(n) = this%dis%nodes + this%ioffset + n
270 iglo = moffset + this%dis%nodes + this%ioffset + n
271 this%idxpakdiag(n) = matrix_sln%get_position_diag(iglo)
273 do ipos = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
274 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(ipos)
275 j = this%flowbudptr%budterm(this%idxbudgwf)%id2(ipos)
276 iglo = moffset + this%dis%nodes + this%ioffset + n
278 this%idxdglo(ipos) = matrix_sln%get_position_diag(iglo)
279 this%idxoffdglo(ipos) = matrix_sln%get_position(iglo, jglo)
283 do ipos = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
284 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(ipos)
285 j = this%flowbudptr%budterm(this%idxbudgwf)%id2(ipos)
287 jglo = moffset + this%dis%nodes + this%ioffset + n
288 this%idxsymdglo(ipos) = matrix_sln%get_position_diag(iglo)
289 this%idxsymoffdglo(ipos) = matrix_sln%get_position(iglo, jglo)
293 if (this%idxbudfjf /= 0)
then
294 do ipos = 1, this%flowbudptr%budterm(this%idxbudfjf)%nlist
295 n = this%flowbudptr%budterm(this%idxbudfjf)%id1(ipos)
296 j = this%flowbudptr%budterm(this%idxbudfjf)%id2(ipos)
297 iglo = moffset + this%dis%nodes + this%ioffset + n
298 jglo = moffset + this%dis%nodes + this%ioffset + j
299 this%idxfjfdglo(ipos) = matrix_sln%get_position_diag(iglo)
300 this%idxfjfoffdglo(ipos) = matrix_sln%get_position(iglo, jglo)
316 character(len=*),
parameter :: fmtapt = &
317 "(1x,/1x,'APT -- ADVANCED PACKAGE TRANSPORT, VERSION 1, 3/5/2020', &
318 &' INPUT READ FROM UNIT ', i0, //)"
321 call this%obs%obs_ar()
324 write (this%iout, fmtapt) this%inunit
327 call this%apt_allocate_arrays()
330 call this%read_initial_attr()
334 call this%fmi%get_package_index(this%flowpackagename, this%igwfaptpak)
339 this%fmi%iatp(this%igwfaptpak) = 1
340 this%fmi%datp(this%igwfaptpak)%concpack => this%get_mvr_depvar()
341 this%fmi%datp(this%igwfaptpak)%qmfrommvr => this%qmfrommvr
346 if (
associated(this%flowpackagebnd))
then
347 if (this%cauxfpconc /=
'')
then
349 do j = 1, this%flowpackagebnd%naux
350 if (this%flowpackagebnd%auxname(j) == this%cauxfpconc)
then
356 if (this%iauxfpconc == 0)
then
357 errmsg =
'Could not find auxiliary variable '// &
358 trim(adjustl(this%cauxfpconc))//
' in flow package '// &
359 trim(adjustl(this%flowpackagename))
364 this%flowpackagebnd%noupdateauxvar(this%iauxfpconc) = 1
365 call this%apt_copy2flowp()
381 integer(I4B) :: n, itemno, igwfnode, isize
382 integer(I4B),
pointer :: nbound => null()
383 integer(I4B),
dimension(:),
pointer,
contiguous :: ifno => null()
390 real(DP),
dimension(:),
pointer,
contiguous :: auxval => null()
391 character(len=LINELENGTH) :: str
392 character(len=LENVARNAME) :: key
393 character(len=LINELENGTH) :: title
394 character(len=LINELENGTH) :: text
395 character(len=LENVARNAME) :: auxnamestr
396 character(len=*),
parameter :: fmtlsp = &
397 "(1X,/1X,'REUSING ',A,'S FROM LAST &
401 this%nbound = this%maxbound
404 if (this%iper ==
kper)
then
407 call mem_setptr(nbound,
'NBOUND', this%input_mempath)
410 if (this%iprpak /= 0)
then
411 title = trim(adjustl(this%text))//
' PACKAGE ('// &
412 trim(adjustl(this%packName))//
') DATA FOR PERIOD'
413 write (title,
'(a,1x,i6)') trim(adjustl(title)),
kper
414 call table_cr(this%inputtab, this%packName, title)
415 call this%inputtab%table_df(1, 4, this%iout, finalize=.false.)
417 call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
419 call this%inputtab%initialize_column(text, 20, alignment=tableft)
421 write (text,
'(a,1x,i6)')
'VALUE', n
422 call this%inputtab%initialize_column(text, 15, alignment=tabcenter)
427 call mem_setptr(ifno,
'IFNO', this%input_mempath)
428 call mem_setptr(setting,
'SETTING', this%input_mempath)
429 call mem_setptr(status,
'STATUS', this%input_mempath)
430 if (this%naux > 0)
then
431 call get_isize(
'AUXVAL', this%input_mempath, isize)
433 call mem_setptr(auxname,
'AUXNAME', this%input_mempath)
434 call mem_setptr(auxval,
'AUXVAL', this%input_mempath)
440 if (this%apt_check_valid(itemno) /= 0) cycle
444 if (trim(key) ==
'STATUS')
then
446 select case (trim(str))
448 this%iboundpak(itemno) = -1
450 this%iboundpak(itemno) = 0
452 this%iboundpak(itemno) = 1
455 'Unknown '//trim(this%text)//
' status keyword: ', &
459 this%status(itemno) = trim(str)
460 if (this%iprpak /= 0)
then
461 call this%inputtab%add_term(itemno)
462 call this%inputtab%add_term(trim(key))
463 call this%inputtab%add_term(trim(str))
464 call this%inputtab%add_term(
' ')
469 else if (trim(key) == trim(this%depvartype))
then
470 if (this%iprpak /= 0)
then
471 call this%inputtab%add_term(itemno)
472 call this%inputtab%add_term(trim(key))
473 call this%inputtab%add_term(this%concfeat(itemno))
474 call this%inputtab%add_term(
' ')
479 else if (trim(key) ==
'PERIOD_AUXILIARY')
then
480 if (this%iprpak /= 0)
then
481 auxnamestr = auxname(n)
482 call this%inputtab%add_term(itemno)
483 call this%inputtab%add_term(
'AUXILIARY')
484 call this%inputtab%add_term(trim(auxnamestr))
485 call this%inputtab%add_term(auxval(n))
491 if (this%iprpak /= 0)
then
492 call this%inputtab%add_term(itemno)
493 call this%inputtab%add_term(trim(key))
494 call this%inputtab%add_term(this%apt_setting_value(itemno, key))
495 call this%inputtab%add_term(
' ')
501 if (this%iprpak /= 0)
then
502 call this%inputtab%finalize_table()
506 write (this%iout, fmtlsp) trim(this%filtyp)
516 do n = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
517 igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(n)
518 this%nodelist(n) = igwfnode
537 integer(I4B),
intent(in) :: itemno
540 if (itemno < 1 .or. itemno > this%ncv)
then
541 write (
errmsg,
'(a,1x,i6,1x,a,1x,i6)') &
542 'Featureno ', itemno,
'must be > 0 and <= ', this%ncv
570 call this%BndExtType%bnd_ad()
572 call this%apt_ad_resync()
588 integer(I4B) :: j, iaux
591 if (this%ts_active)
then
592 call this%apt_ad_ts()
599 if (this%naux > 0 .and. (
kstp == 1 .or. this%ts_active))
then
600 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
601 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
602 do iaux = 1, this%naux
603 this%auxvar(iaux, j) = this%featureauxvar(iaux, n)
612 this%xoldpak(n) = this%xnewpak(n)
613 if (this%iboundpak(n) < 0)
then
614 this%xnewpak(n) = this%concfeat(n)
619 this%xnewpak(n) = this%xoldpak(n)
620 if (this%iboundpak(n) < 0)
then
621 this%xnewpak(n) = this%concfeat(n)
627 call this%apt_ad_chk()
647 integer(I4B),
intent(in) :: itemno
648 character(len=*),
intent(in) :: key
659 do i = 1,
size(this%qmfrommvr)
660 this%qmfrommvr(i) =
dzero
664 subroutine apt_fc(this, rhs, ia, idxglo, matrix_sln)
668 real(DP),
dimension(:),
intent(inout) :: rhs
669 integer(I4B),
dimension(:),
intent(in) :: ia
670 integer(I4B),
dimension(:),
intent(in) :: idxglo
675 if (this%imatrows == 0)
then
676 call this%apt_fc_nonexpanded(rhs, ia, idxglo, matrix_sln)
678 call this%apt_fc_expanded(rhs, ia, idxglo, matrix_sln)
691 real(DP),
dimension(:),
intent(inout) :: rhs
692 integer(I4B),
dimension(:),
intent(in) :: ia
693 integer(I4B),
dimension(:),
intent(in) :: idxglo
696 integer(I4B) :: j, igwfnode, idiag
699 call this%apt_solve()
702 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
703 igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(j)
704 if (this%ibound(igwfnode) < 1) cycle
705 idiag = idxglo(ia(igwfnode))
706 call matrix_sln%add_value_pos(idiag, this%hcof(j))
707 rhs(igwfnode) = rhs(igwfnode) + this%rhs(j)
720 real(DP),
dimension(:),
intent(inout) :: rhs
721 integer(I4B),
dimension(:),
intent(in) :: ia
722 integer(I4B),
dimension(:),
intent(in) :: idxglo
725 integer(I4B) :: j, n, n1, n2
727 integer(I4B) :: iposd, iposoffd
728 integer(I4B) :: ipossymd, ipossymoffd
730 real(DP) :: qbnd, qbnd_scaled
741 call this%pak_fc_expanded(rhs, ia, idxglo, matrix_sln)
745 cold = this%xoldpak(n)
746 iloc = this%idxlocnode(n)
747 iposd = this%idxpakdiag(n)
748 call this%apt_stor_term(n, n1, n2, rrate, rhsval, hcofval)
749 call matrix_sln%add_value_pos(iposd, hcofval)
750 rhs(iloc) = rhs(iloc) + rhsval
754 if (this%idxbudtmvr /= 0)
then
755 do j = 1, this%flowbudptr%budterm(this%idxbudtmvr)%nlist
756 call this%apt_tmvr_term(j, n1, n2, rrate, rhsval, hcofval)
757 iloc = this%idxlocnode(n1)
758 iposd = this%idxpakdiag(n1)
759 call matrix_sln%add_value_pos(iposd, hcofval)
760 rhs(iloc) = rhs(iloc) + rhsval
765 if (this%idxbudfmvr /= 0)
then
767 rhsval = this%qmfrommvr(n)
768 iloc = this%idxlocnode(n)
769 rhs(iloc) = rhs(iloc) - rhsval
774 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
777 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
778 if (this%iboundpak(n) /= 0)
then
781 qbnd = this%flowbudptr%budterm(this%idxbudgwf)%flow(j)
784 qbnd_scaled = qbnd * this%eqnsclfac
787 iposd = this%idxdglo(j)
788 iposoffd = this%idxoffdglo(j)
789 call matrix_sln%add_value_pos(iposd, omega * qbnd_scaled)
790 call matrix_sln%add_value_pos(iposoffd, (
done - omega) * qbnd_scaled)
793 ipossymd = this%idxsymdglo(j)
794 ipossymoffd = this%idxsymoffdglo(j)
795 call matrix_sln%add_value_pos(ipossymd, -(
done - omega) * qbnd_scaled)
796 call matrix_sln%add_value_pos(ipossymoffd, -omega * qbnd_scaled)
801 if (this%idxbudfjf /= 0)
then
802 do j = 1, this%flowbudptr%budterm(this%idxbudfjf)%nlist
803 n1 = this%flowbudptr%budterm(this%idxbudfjf)%id1(j)
804 n2 = this%flowbudptr%budterm(this%idxbudfjf)%id2(j)
805 qbnd = this%flowbudptr%budterm(this%idxbudfjf)%flow(j)
806 if (qbnd <=
dzero)
then
811 qbnd_scaled = qbnd * this%eqnsclfac
812 iposd = this%idxfjfdglo(j)
813 iposoffd = this%idxfjfoffdglo(j)
814 call matrix_sln%add_value_pos(iposd, omega * qbnd_scaled)
815 call matrix_sln%add_value_pos(iposoffd, (
done - omega) * qbnd_scaled)
829 real(DP),
dimension(:),
intent(inout) :: rhs
830 integer(I4B),
dimension(:),
intent(in) :: ia
831 integer(I4B),
dimension(:),
intent(in) :: idxglo
836 call store_error(
'Program error: pak_fc_expanded not implemented.', &
857 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
858 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
861 if (this%iboundpak(n) /= 0)
then
862 qbnd = this%flowbudptr%budterm(this%idxbudgwf)%flow(j)
865 this%hcof(j) = -(
done - omega) * qbnd * this%eqnsclfac
866 this%rhs(j) = omega * qbnd * this%xnewpak(n) * this%eqnsclfac
879 real(DP),
dimension(:),
intent(in) :: x
880 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
881 integer(I4B),
optional,
intent(in) :: iadv
883 integer(I4B) :: n, n1, n2
888 if (this%imatrows == 0)
then
889 call this%apt_solve()
891 call this%apt_cfupdate()
895 call this%BndType%bnd_cq(x, flowja)
900 if (this%iboundpak(n) > 0)
then
901 call this%apt_stor_term(n, n1, n2, rrate)
907 call this%apt_copy2flowp()
910 call this%apt_fill_budobj(x, flowja)
918 integer(I4B),
intent(in) :: icbcfl
919 integer(I4B),
intent(in) :: ibudfl
920 integer(I4B) :: ibinun
924 if (this%ibudgetout /= 0)
then
925 ibinun = this%ibudgetout
927 if (icbcfl == 0) ibinun = 0
929 call this%budobj%save_flows(this%dis, ibinun,
kstp,
kper,
delt, &
934 if (ibudfl /= 0 .and. this%iprflow /= 0)
then
935 call this%budobj%write_flowtable(this%dis,
kstp,
kper)
947 integer(I4B),
intent(in) :: idvsave
948 integer(I4B),
intent(in) :: idvprint
950 integer(I4B) :: ibinun
953 character(len=LENBUDTXT) :: text
957 if (this%iconcout /= 0)
then
958 ibinun = this%iconcout
960 if (idvsave == 0) ibinun = 0
966 if (this%iboundpak(n) == 0)
then
971 write (text,
'(a)') str_pad_left(this%depvartype, lenvarname)
973 this%ncv, 1, 1, ibinun)
977 if (idvprint /= 0 .and. this%iprconc /= 0)
then
980 call this%dvtab%set_kstpkper(
kstp,
kper)
984 if (this%inamedbound == 1)
then
985 call this%dvtab%add_term(this%featname(n))
987 call this%dvtab%add_term(n)
988 call this%dvtab%add_term(this%xnewpak(n))
1000 integer(I4B),
intent(in) :: kstp
1001 integer(I4B),
intent(in) :: kper
1002 integer(I4B),
intent(in) :: iout
1003 integer(I4B),
intent(in) :: ibudfl
1005 call this%budobj%write_budtable(kstp, kper, iout, ibudfl,
totim,
delt)
1020 call this%BndExtType%allocate_scalars()
1023 call mem_allocate(this%iauxfpconc,
'IAUXFPCONC', this%memoryPath)
1024 call mem_allocate(this%imatrows,
'IMATROWS', this%memoryPath)
1025 call mem_allocate(this%iprconc,
'IPRCONC', this%memoryPath)
1026 call mem_allocate(this%iconcout,
'ICONCOUT', this%memoryPath)
1027 call mem_allocate(this%ibudgetout,
'IBUDGETOUT', this%memoryPath)
1028 call mem_allocate(this%ibudcsv,
'IBUDCSV', this%memoryPath)
1029 call mem_allocate(this%igwfaptpak,
'IGWFAPTPAK', this%memoryPath)
1031 call mem_allocate(this%idxbudfjf,
'IDXBUDFJF', this%memoryPath)
1032 call mem_allocate(this%idxbudgwf,
'IDXBUDGWF', this%memoryPath)
1033 call mem_allocate(this%idxbudsto,
'IDXBUDSTO', this%memoryPath)
1034 call mem_allocate(this%idxbudtmvr,
'IDXBUDTMVR', this%memoryPath)
1035 call mem_allocate(this%idxbudfmvr,
'IDXBUDFMVR', this%memoryPath)
1036 call mem_allocate(this%idxbudaux,
'IDXBUDAUX', this%memoryPath)
1037 call mem_allocate(this%nconcbudssm,
'NCONCBUDSSM', this%memoryPath)
1038 call mem_allocate(this%idxprepak,
'IDXPREPAK', this%memoryPath)
1039 call mem_allocate(this%idxlastpak,
'IDXLASTPAK', this%memoryPath)
1056 this%nconcbudssm = 0
1076 if (this%imatrows /= 0)
then
1080 if (this%idxbudfjf /= 0)
then
1081 n = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
1085 call mem_allocate(this%idxlocnode, this%ncv,
'IDXLOCNODE', &
1087 call mem_allocate(this%idxpakdiag, this%ncv,
'IDXPAKDIAG', &
1089 call mem_allocate(this%idxdglo, this%maxbound,
'IDXGLO', &
1091 call mem_allocate(this%idxoffdglo, this%maxbound,
'IDXOFFDGLO', &
1093 call mem_allocate(this%idxsymdglo, this%maxbound,
'IDXSYMDGLO', &
1095 call mem_allocate(this%idxsymoffdglo, this%maxbound,
'IDXSYMOFFDGLO', &
1099 call mem_allocate(this%idxfjfoffdglo, n,
'IDXFJFOFFDGLO', &
1112 call mem_allocate(this%idxsymoffdglo, 0,
'IDXSYMOFFDGLO', &
1116 call mem_allocate(this%idxfjfoffdglo, 0,
'IDXFJFOFFDGLO', &
1134 call this%BndExtType%allocate_arrays()
1139 if (this%iconcout > 0)
then
1140 call mem_allocate(this%dbuff, this%ncv,
'DBUFF', this%memoryPath)
1142 this%dbuff(n) =
dzero
1145 call mem_allocate(this%dbuff, 0,
'DBUFF', this%memoryPath)
1149 allocate (this%status(this%ncv))
1154 call mem_setptr(this%concfeat, trim(this%depvartype), this%input_mempath)
1157 call mem_allocate(this%qsto, this%ncv,
'QSTO', this%memoryPath)
1158 call mem_allocate(this%ccterm, this%ncv,
'CCTERM', this%memoryPath)
1161 call mem_allocate(this%concbudssm, this%nconcbudssm, this%ncv, &
1162 'CONCBUDSSM', this%memoryPath)
1165 call mem_allocate(this%qmfrommvr, this%ncv,
'QMFROMMVR', this%memoryPath)
1169 this%status(n) =
'ACTIVE'
1170 this%qsto(n) =
dzero
1171 this%ccterm(n) =
dzero
1172 this%qmfrommvr(n) =
dzero
1173 this%concbudssm(:, n) =
dzero
1194 if (this%imatrows == 0)
then
1199 nullify (this%concfeat)
1201 deallocate (this%status)
1202 deallocate (this%featname)
1205 call this%budobj%budgetobject_da()
1206 deallocate (this%budobj)
1207 nullify (this%budobj)
1210 if (this%iprconc > 0)
then
1211 call this%dvtab%table_da()
1212 deallocate (this%dvtab)
1213 nullify (this%dvtab)
1247 call this%BndExtType%bnd_da()
1260 call store_error(
'Program error: pak_solve not implemented.', &
1270 character(len=LINELENGTH) :: fname
1273 character(len=*),
parameter :: fmtaptbin = &
1274 "(4x, a, 1x, a, 1x, ' WILL BE SAVED TO FILE: ', a, &
1275 &/4x, 'OPENED ON UNIT: ', I0)"
1279 call this%BndExtType%source_options()
1281 write (this%iout,
'(1x,a)') &
1282 'PROCESSING '//trim(adjustl(this%text))//
' OPTIONS'
1286 this%input_mempath, found)
1288 write (this%iout,
'(4x,a)') &
1289 'THIS '//trim(adjustl(this%text))//
' PACKAGE CORRESPONDS TO A GWF &
1290 &PACKAGE WITH THE NAME '//trim(adjustl(this%flowpackagename))
1295 this%input_mempath, found)
1297 write (this%iout,
'(4x,a)') &
1298 'SIMULATED CONCENTRATIONS WILL BE COPIED INTO THE FLOW PACKAGE &
1299 &AUXILIARY VARIABLE WITH THE NAME '//trim(adjustl(this%cauxfpconc))
1307 call mem_set_value(this%iprconc,
'IPRCONC', this%input_mempath, found)
1309 write (this%iout,
'(4x,a)') trim(adjustl(this%text))// &
1310 ' '//trim(adjustl(this%depvartype))//
'S WILL BE PRINTED TO LISTING FILE.'
1314 if (this%depvartype ==
'CONCENTRATION')
then
1315 call mem_set_value(fname,
'CONCFILE', this%input_mempath, found)
1317 call mem_set_value(fname,
'TEMPFILE', this%input_mempath, found)
1321 trim(this%depvartype)//
" fileout")
1322 call openfile(this%iconcout, this%iout, fname,
'DATA(BINARY)', &
1324 write (this%iout, fmtaptbin) trim(adjustl(this%text)), &
1325 trim(adjustl(this%depvartype)), trim(fname), this%iconcout
1329 call mem_set_value(fname,
'BUDGETFILE', this%input_mempath, found)
1331 call assign_iounit(this%ibudgetout, this%inunit,
"BUDGET fileout")
1332 call openfile(this%ibudgetout, this%iout, fname,
'DATA(BINARY)', &
1334 write (this%iout, fmtaptbin) trim(adjustl(this%text)),
'BUDGET', &
1335 trim(fname), this%ibudgetout
1339 call mem_set_value(fname,
'BUDGETCSVFILE', this%input_mempath, found)
1341 call assign_iounit(this%ibudcsv, this%inunit,
"BUDGETCSV fileout")
1342 call openfile(this%ibudcsv, this%iout, fname,
'CSV', filstat_opt=
'REPLACE')
1343 write (this%iout, fmtaptbin) trim(adjustl(this%text)),
'BUDGET CSV', &
1344 trim(fname), this%ibudcsv
1347 write (this%iout,
'(1x,a)') &
1348 'END OF '//trim(adjustl(this%text))//
' OPTIONS'
1357 integer(I4B) :: ierr
1360 if (this%flowpackagename ==
'')
then
1361 this%flowpackagename = this%packName
1362 write (this%iout,
'(4x,a)') &
1363 'THE FLOW PACKAGE NAME FOR '//trim(adjustl(this%text))//
' WAS NOT &
1364 &SPECIFIED. SETTING FLOW PACKAGE NAME TO '// &
1365 trim(adjustl(this%flowpackagename))
1367 call this%find_apt_package()
1370 this%ncv = this%flowbudptr%ncv
1371 this%maxbound = this%flowbudptr%budterm(this%idxbudgwf)%maxlist
1372 this%nbound = this%maxbound
1373 write (this%iout,
'(a, a)')
'SETTING DIMENSIONS FOR PACKAGE ', this%packName
1374 write (this%iout,
'(2x,a,i0)')
'NUMBER OF CONTROL VOLUMES = ', this%ncv
1375 write (this%iout,
'(2x,a,i0)')
'MAXBOUND = ', this%maxbound
1376 write (this%iout,
'(2x,a,i0)')
'NBOUND = ', this%nbound
1377 if (this%imatrows /= 0)
then
1378 this%npakeq = this%ncv
1379 write (this%iout,
'(2x,a)') trim(adjustl(this%text))// &
1380 ' SOLVED AS PART OF GWT MATRIX EQUATIONS'
1382 write (this%iout,
'(2x,a)') trim(adjustl(this%text))// &
1383 ' SOLVED SEPARATELY FROM GWT MATRIX EQUATIONS '
1385 write (this%iout,
'(a, //)')
'DONE SETTING DIMENSIONS FOR '// &
1386 trim(adjustl(this%text))
1388 if (this%ncv < 0)
then
1390 'Number of control volumes could not be determined correctly.'
1397 call this%apt_source_cvs()
1399 call this%define_listlabel()
1400 call this%apt_setup_budobj()
1401 call this%apt_setup_tableobj()
1410 character(len=LENBOUNDNAME) :: bndName
1411 character(len=9) :: cno
1412 integer(I4B) :: n, itemno, isize, nfeat
1413 integer(I4B),
allocatable,
dimension(:) :: nboundchk
1414 real(DP),
dimension(:),
pointer,
contiguous :: strt_ptr => null()
1416 boundname_ptr => null()
1419 call mem_allocate(this%strt, this%ncv,
'STRT', this%memoryPath)
1420 if (this%imatrows == 0)
then
1421 call mem_allocate(this%iboundpak, this%ncv,
'IBOUND', this%memoryPath)
1422 call mem_allocate(this%xnewpak, this%ncv,
'XNEWPAK', this%memoryPath)
1424 call mem_allocate(this%xoldpak, this%ncv,
'XOLDPAK', this%memoryPath)
1425 allocate (this%featname(this%ncv))
1429 this%strt(n) =
dep20
1430 this%xoldpak(n) =
dep20
1431 if (this%imatrows == 0)
then
1432 this%iboundpak(n) = 1
1433 this%xnewpak(n) =
dep20
1439 call this%allocate_featureauxvar()
1442 nfeat =
size(this%pkg_ifno)
1443 allocate (nboundchk(this%ncv))
1446 itemno = this%validate_ifno(this%pkg_ifno(n), this%ncv, nboundchk,
'IFNO', &
1447 trim(adjustl(this%text))//
' PACKAGEDATA')
1449 call this%report_ifno_coverage(nboundchk, this%ncv,
'feature', &
1450 trim(adjustl(this%text))//
' PACKAGEDATA')
1451 deallocate (nboundchk)
1457 call mem_setptr(strt_ptr,
'STRT', this%input_mempath)
1459 itemno = this%pkg_ifno(n)
1460 this%strt(itemno) = strt_ptr(n)
1466 write (cno,
'(i9.9)') n
1467 this%featname(n) =
'Feature'//cno
1469 if (this%inamedbound /= 0)
then
1470 call get_isize(
'BOUNDNAME', this%input_mempath, isize)
1472 call mem_setptr(boundname_ptr,
'BOUNDNAME', this%input_mempath)
1474 itemno = this%pkg_ifno(n)
1475 if (itemno < 1 .or. itemno > this%ncv) cycle
1476 bndname = boundname_ptr(n)
1477 if (trim(bndname) /=
'') this%featname(itemno) = trim(bndname)
1483 write (this%iout,
'(/1x,a)')
'END OF '//trim(adjustl(this%text))// &
1496 integer(I4B) :: j, n
1502 this%xnewpak(n) = this%strt(n)
1511 if (this%status(n) ==
'CONSTANT')
then
1512 this%iboundpak(n) = -1
1513 else if (this%status(n) ==
'INACTIVE')
then
1514 this%iboundpak(n) = 0
1515 else if (this%status(n) ==
'ACTIVE ')
then
1516 this%iboundpak(n) = 1
1521 if (this%inamedbound /= 0)
then
1522 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
1523 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
1524 this%boundname(j) = this%featname(n)
1529 call this%copy_boundname()
1543 integer(I4B) :: n, j, igwfnode
1544 integer(I4B) :: n1, n2
1547 real(DP) :: c1, qbnd
1548 real(DP) :: hcofval, rhsval
1552 this%dbuff(n) = dzero
1557 call this%pak_solve()
1560 if (this%idxbudtmvr /= 0)
then
1561 do j = 1, this%flowbudptr%budterm(this%idxbudtmvr)%nlist
1562 call this%apt_tmvr_term(j, n1, n2, rrate)
1563 this%dbuff(n1) = this%dbuff(n1) + rrate
1568 if (this%idxbudfmvr /= 0)
then
1569 do n1 = 1,
size(this%qmfrommvr)
1570 rrate = this%qmfrommvr(n1)
1571 this%dbuff(n1) = this%dbuff(n1) + rrate
1577 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
1578 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
1579 this%hcof(j) = dzero
1581 igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(j)
1582 qbnd = this%flowbudptr%budterm(this%idxbudgwf)%flow(j)
1583 if (qbnd <= dzero)
then
1584 ctmp = this%xnewpak(n)
1585 this%rhs(j) = qbnd * ctmp * this%eqnsclfac
1587 ctmp = this%xnew(igwfnode)
1588 this%hcof(j) = -qbnd * this%eqnsclfac
1590 c1 = qbnd * ctmp * this%eqnsclfac
1591 this%dbuff(n) = this%dbuff(n) + c1
1596 if (this%idxbudfjf /= 0)
then
1597 do j = 1, this%flowbudptr%budterm(this%idxbudfjf)%nlist
1598 call this%apt_fjf_term(j, n1, n2, rrate)
1600 this%dbuff(n1) = this%dbuff(n1) + c1
1606 call this%apt_stor_term(n, n1, n2, rrate, rhsval, hcofval)
1610 this%dbuff(n) = this%dbuff(n) - rhsval
1613 c1 = -this%dbuff(n) / hcofval
1614 if (this%iboundpak(n) > 0)
then
1615 this%xnewpak(n) = c1
1631 call store_error(
'Program error: pak_solve not implemented.', &
1640 integer(I4B),
intent(in) :: ilak
1641 real(DP),
intent(in) :: rrate
1642 real(DP),
intent(inout) :: ccratin
1643 real(DP),
intent(inout) :: ccratout
1649 if (this%iboundpak(ilak) < 0)
then
1651 this%ccterm(ilak) = this%ccterm(ilak) + q
1657 ccratout = ccratout - q
1661 ccratin = ccratin + q
1673 this%listlabel = trim(this%filtyp)//
' NO.'
1674 if (this%dis%ndim == 3)
then
1675 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
1676 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'ROW'
1677 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'COL'
1678 elseif (this%dis%ndim == 2)
then
1679 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
1680 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'CELL2D'
1682 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'NODE'
1684 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'STRESS RATE'
1685 if (this%inamedbound == 1)
then
1686 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'BOUNDARY NAME'
1695 integer(I4B),
pointer :: neq
1696 integer(I4B),
dimension(:),
pointer,
contiguous :: ibound
1697 real(DP),
dimension(:),
pointer,
contiguous :: xnew
1698 real(DP),
dimension(:),
pointer,
contiguous :: xold
1699 real(DP),
dimension(:),
pointer,
contiguous :: flowja
1701 integer(I4B) :: istart, iend
1704 call this%BndType%set_pointers(neq, ibound, xnew, xold, flowja)
1709 if (this%imatrows /= 0)
then
1710 istart = this%dis%nodes + this%ioffset + 1
1711 iend = istart + this%ncv - 1
1712 this%iboundpak => this%ibound(istart:iend)
1713 this%xnewpak => this%xnew(istart:iend)
1723 integer(I4B),
intent(in) :: icv
1724 real(DP),
intent(inout) :: vnew, vold
1725 real(DP),
intent(in) :: delt
1732 if (this%idxbudsto /= 0)
then
1733 qss = this%flowbudptr%budterm(this%idxbudsto)%flow(icv)
1734 vnew = this%flowbudptr%budterm(this%idxbudsto)%auxvar(1, icv)
1735 vold = vnew + qss * delt
1748 integer(I4B) :: nbudterms
1752 call store_error(
'Program error: pak_get_nbudterms not implemented.', &
1765 integer(I4B) :: nbudterm
1766 integer(I4B) :: nlen
1767 integer(I4B) :: n, n1, n2
1768 integer(I4B) :: maxlist, naux
1770 logical :: ordered_id1
1772 character(len=LENBUDTXT) :: bddim_opt
1773 character(len=LENBUDTXT) :: text, textt
1774 character(len=LENBUDTXT),
dimension(1) :: auxtxt
1781 if (this%idxbudfjf /= 0)
then
1782 nlen = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
1789 if (this%idxbudfjf /= 0) nbudterm = nbudterm + 1
1792 nbudterm = nbudterm + 3
1795 nbudterm = nbudterm + this%pak_get_nbudterms()
1798 if (this%idxbudtmvr /= 0) nbudterm = nbudterm + 1
1799 if (this%idxbudfmvr /= 0) nbudterm = nbudterm + 1
1800 if (this%naux > 0) nbudterm = nbudterm + 1
1805 bddim_opt = this%depvarunitabbrev
1806 call this%budobj%budgetobject_df(this%ncv, nbudterm, 0, 0, &
1807 bddim_opt=bddim_opt, ibudcsv=this%ibudcsv)
1812 text =
' FLOW-JA-FACE'
1814 maxlist = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
1816 ordered_id1 = this%flowbudptr%budterm(this%idxbudfjf)%ordered_id1
1817 call this%budobj%budterm(idx)%initialize(text, &
1822 maxlist, .false., .false., &
1823 naux, ordered_id1=ordered_id1)
1826 call this%budobj%budterm(idx)%reset(maxlist)
1829 n1 = this%flowbudptr%budterm(this%idxbudfjf)%id1(n)
1830 n2 = this%flowbudptr%budterm(this%idxbudfjf)%id2(n)
1831 call this%budobj%budterm(idx)%update_term(n1, n2, q)
1838 maxlist = this%flowbudptr%budterm(this%idxbudgwf)%maxlist
1840 call this%budobj%budterm(idx)%initialize(text, &
1845 maxlist, .false., .true., &
1847 call this%budobj%budterm(idx)%reset(maxlist)
1850 n1 = this%flowbudptr%budterm(this%idxbudgwf)%id1(n)
1851 n2 = this%flowbudptr%budterm(this%idxbudgwf)%id2(n)
1852 call this%budobj%budterm(idx)%update_term(n1, n2, q)
1856 this%idxprepak = idx
1857 call this%pak_setup_budobj(idx)
1858 this%idxlastpak = idx
1863 maxlist = this%flowbudptr%budterm(this%idxbudsto)%maxlist
1867 call this%budobj%budterm(idx)%initialize(text, &
1872 maxlist, .false., .false., &
1874 if (this%idxbudtmvr /= 0)
then
1879 maxlist = this%flowbudptr%budterm(this%idxbudtmvr)%maxlist
1881 ordered_id1 = this%flowbudptr%budterm(this%idxbudtmvr)%ordered_id1
1882 call this%budobj%budterm(idx)%initialize(text, &
1887 maxlist, .false., .false., &
1888 naux, ordered_id1=ordered_id1)
1890 if (this%idxbudfmvr /= 0)
then
1897 call this%budobj%budterm(idx)%initialize(text, &
1902 maxlist, .false., .false., &
1911 call this%budobj%budterm(idx)%initialize(text, &
1916 maxlist, .false., .false., &
1928 call this%budobj%budterm(idx)%initialize(text, &
1933 maxlist, .false., .false., &
1938 if (this%iprflow /= 0)
then
1939 call this%budobj%flowtable_df(this%iout)
1951 integer(I4B),
intent(inout) :: idx
1955 call store_error(
'Program error: pak_setup_budobj not implemented.', &
1966 real(DP),
dimension(:),
intent(in) :: x
1967 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
1969 integer(I4B) :: naux
1970 real(DP),
dimension(:),
allocatable :: auxvartmp
1971 integer(I4B) :: i, j, n1, n2
1973 integer(I4B) :: nlen
1974 integer(I4B) :: nlist
1975 integer(I4B) :: igwfnode
1978 real(DP) :: ccratin, ccratout
1989 this%ccterm(n1) =
dzero
1994 if (this%idxbudfjf /= 0)
then
1995 nlen = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
1999 nlist = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
2000 call this%budobj%budterm(idx)%reset(nlist)
2003 call this%apt_fjf_term(j, n1, n2, q)
2004 call this%budobj%budterm(idx)%update_term(n1, n2, q)
2005 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2011 call this%budobj%budterm(idx)%reset(this%maxbound)
2012 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
2014 n1 = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
2015 igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(j)
2016 if (this%iboundpak(n1) /= 0)
then
2017 q = this%hcof(j) * x(igwfnode) - this%rhs(j)
2020 call this%budobj%budterm(idx)%update_term(n1, igwfnode, q)
2021 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2026 idx = this%idxlastpak
2030 call this%budobj%budterm(idx)%reset(this%ncv)
2031 allocate (auxvartmp(1))
2033 call this%apt_get_volumes(n1, v1, v0,
delt)
2034 auxvartmp(1) = v1 * this%xnewpak(n1)
2036 call this%budobj%budterm(idx)%update_term(n1, n1, q, auxvartmp)
2037 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2039 deallocate (auxvartmp)
2042 if (this%idxbudtmvr /= 0)
then
2044 nlist = this%flowbudptr%budterm(this%idxbudtmvr)%nlist
2045 call this%budobj%budterm(idx)%reset(nlist)
2047 call this%apt_tmvr_term(j, n1, n2, q)
2048 call this%budobj%budterm(idx)%update_term(n1, n2, q)
2049 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2054 if (this%idxbudfmvr /= 0)
then
2057 call this%budobj%budterm(idx)%reset(nlist)
2059 call this%apt_fmvr_term(j, n1, n2, q)
2060 call this%budobj%budterm(idx)%update_term(n1, n1, q)
2061 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2067 call this%budobj%budterm(idx)%reset(this%ncv)
2070 call this%budobj%budterm(idx)%update_term(n1, n1, q)
2077 allocate (auxvartmp(naux))
2078 call this%budobj%budterm(idx)%reset(this%ncv)
2082 auxvartmp(i) = this%featureauxvar(i, n1)
2084 call this%budobj%budterm(idx)%update_term(n1, n1, q, auxvartmp)
2086 deallocate (auxvartmp)
2090 idx = this%idxprepak
2091 call this%pak_fill_budobj(idx, x, flowja, ccratin, ccratout)
2094 call this%budobj%accumulate_terms()
2103 integer(I4B),
intent(inout) :: idx
2104 real(DP),
dimension(:),
intent(in) :: x
2105 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
2106 real(DP),
intent(inout) :: ccratin
2107 real(DP),
intent(inout) :: ccratout
2112 call store_error(
'Program error: pak_fill_budobj not implemented.', &
2122 integer(I4B),
intent(in) :: ientry
2123 integer(I4B),
intent(inout) :: n1
2124 integer(I4B),
intent(inout) :: n2
2125 real(DP),
intent(inout),
optional :: rrate
2126 real(DP),
intent(inout),
optional :: rhsval
2127 real(DP),
intent(inout),
optional :: hcofval
2133 call this%apt_get_volumes(n1, v1, v0,
delt)
2134 c0 = this%xoldpak(n1)
2135 c1 = this%xnewpak(n1)
2136 if (
present(rrate))
then
2137 rrate = (-c1 * v1 /
delt + c0 * v0 /
delt) * this%eqnsclfac
2140 if (
present(rhsval)) rhsval = -c0 * v0 * this%eqnsclfac /
delt
2141 if (
present(hcofval)) hcofval = -v1 * this%eqnsclfac /
delt
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 n1 = this%flowbudptr%budterm(this%idxbudtmvr)%id1(ientry)
2163 n2 = this%flowbudptr%budterm(this%idxbudtmvr)%id2(ientry)
2164 qbnd = this%flowbudptr%budterm(this%idxbudtmvr)%flow(ientry)
2165 ctmp = this%xnewpak(n1)
2166 if (
present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
2167 if (
present(rhsval)) rhsval =
dzero
2168 if (
present(hcofval)) hcofval = qbnd * this%eqnsclfac
2179 integer(I4B),
intent(in) :: ientry
2180 integer(I4B),
intent(inout) :: n1
2181 integer(I4B),
intent(inout) :: n2
2182 real(DP),
intent(inout),
optional :: rrate
2183 real(DP),
intent(inout),
optional :: rhsval
2184 real(DP),
intent(inout),
optional :: hcofval
2189 if (
present(rrate)) rrate = this%qmfrommvr(n1)
2190 if (
present(rhsval)) rhsval = this%qmfrommvr(n1)
2191 if (
present(hcofval)) hcofval =
dzero
2202 integer(I4B),
intent(in) :: ientry
2203 integer(I4B),
intent(inout) :: n1
2204 integer(I4B),
intent(inout) :: n2
2205 real(DP),
intent(inout),
optional :: rrate
2206 real(DP),
intent(inout),
optional :: rhsval
2207 real(DP),
intent(inout),
optional :: hcofval
2212 n1 = this%flowbudptr%budterm(this%idxbudfjf)%id1(ientry)
2213 n2 = this%flowbudptr%budterm(this%idxbudfjf)%id2(ientry)
2214 qbnd = this%flowbudptr%budterm(this%idxbudfjf)%flow(ientry)
2216 ctmp = this%xnewpak(n1)
2218 ctmp = this%xnewpak(n2)
2220 if (
present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
2221 if (
present(rhsval)) rhsval = -rrate * this%eqnsclfac
2222 if (
present(hcofval)) hcofval =
dzero
2233 integer(I4B) :: n, j
2236 if (this%iauxfpconc /= 0)
then
2239 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
2242 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
2243 this%flowpackagebnd%auxvar(this%iauxfpconc, j) = this%xnewpak(n)
2276 call this%pak_df_obs()
2291 call store_error(
'Program error: pak_df_obs not implemented.', &
2303 logical,
intent(inout) :: found
2307 call store_error(
'Program error: pak_rp_obs not implemented.', &
2322 character(len=*),
parameter :: fmterr = &
2323 "('Boundary ', a, ' for observation ', a, &
2324 &' is invalid in package ', a)"
2325 nn1 = obsrv%NodeNumber
2329 if (this%featname(j) == obsrv%FeatureName)
then
2331 call obsrv%AddObsIndex(j)
2334 if (.not. jfound)
then
2335 write (
errmsg, fmterr) trim(obsrv%FeatureName), trim(obsrv%Name), &
2342 if (nn1 < 0 .or. nn1 > this%ncv)
then
2343 write (
errmsg,
'(7a, i0, a, i0, a)') &
2344 'Observation ', trim(obsrv%Name),
' of type ', &
2345 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2346 trim(this%packName),
' was assigned ID = ', nn1, &
2347 '. ID must be >= 1 and <= ', this%ncv,
'.'
2350 call obsrv%AddObsIndex(nn1)
2364 integer(I4B) :: iconn
2369 character(len=*),
parameter :: fmterr = &
2370 "('Boundary ', a, ' for observation ', a, &
2371 &' is invalid in package ', a)"
2372 nn1 = obsrv%NodeNumber
2375 do j = 1, budterm%nlist
2376 icv = budterm%id1(j)
2377 if (this%featname(icv) == obsrv%FeatureName)
then
2379 call obsrv%AddObsIndex(j)
2382 if (.not. jfound)
then
2383 write (
errmsg, fmterr) trim(obsrv%FeatureName), trim(obsrv%Name), &
2390 if (nn1 < 0 .or. nn1 > this%ncv)
then
2391 write (
errmsg,
'(7a, i0, a, i0, a)') &
2392 'Observation ', trim(obsrv%Name),
' of type ', &
2393 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2394 trim(this%packName),
' was assigned ID = ', nn1, &
2395 '. ID must be >= 1 and <= ', this%ncv,
'.'
2398 iconn = obsrv%NodeNumber2
2399 do j = 1, budterm%nlist
2400 if (budterm%id1(j) == nn1)
then
2404 call obsrv%AddObsIndex(idx)
2408 if (idx < 1 .or. idx > budterm%nlist)
then
2409 write (
errmsg,
'(7a, i0, a, i0, a)') &
2410 'Observation ', trim(obsrv%Name),
' of type ', &
2411 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2412 trim(this%packName),
' specifies iconn = ', iconn, &
2413 ', but this is not a valid connection for ID ', nn1,
'.'
2415 else if (budterm%id1(idx) /= nn1)
then
2416 write (
errmsg,
'(7a, i0, a, i0, a)') &
2417 'Observation ', trim(obsrv%Name),
' of type ', &
2418 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2419 trim(this%packName),
' specifies iconn = ', iconn, &
2420 ', but this is not a valid connection for ID ', nn1,
'.'
2440 character(len=*),
parameter :: fmterr = &
2441 "('Boundary ', a, ' for observation ', a, &
2442 &' is invalid in package ', a)"
2443 nn1 = obsrv%NodeNumber
2446 do j = 1, budterm%nlist
2447 icv = budterm%id1(j)
2448 if (this%featname(icv) == obsrv%FeatureName)
then
2450 call obsrv%AddObsIndex(j)
2453 if (.not. jfound)
then
2454 write (
errmsg, fmterr) trim(obsrv%FeatureName), trim(obsrv%Name), &
2461 if (nn1 < 0 .or. nn1 > this%ncv)
then
2462 write (
errmsg,
'(7a, i0, a, i0, a)') &
2463 'Observation ', trim(obsrv%Name),
' of type ', &
2464 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2465 trim(this%packName),
' was assigned ID = ', nn1, &
2466 '. ID must be >= 1 and <= ', this%ncv,
'.'
2469 nn2 = obsrv%NodeNumber2
2472 if (nn2 < 0 .or. nn2 > this%ncv)
then
2473 write (
errmsg,
'(7a, i0, a, i0, a)') &
2474 'Observation ', trim(obsrv%Name),
' of type ', &
2475 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2476 trim(this%packName),
' was assigned ID2 = ', nn2, &
2477 '. ID must be >= 1 and <= ', this%ncv,
'.'
2482 do j = 1, budterm%nlist
2483 if (budterm%id1(j) == nn1 .and. budterm%id2(j) == nn2)
then
2484 call obsrv%AddObsIndex(j)
2488 if (.not. jfound)
then
2489 write (
errmsg,
'(7a, i0, a, i0, a)') &
2490 'Observation ', trim(obsrv%Name),
' of type ', &
2491 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2492 trim(this%packName), &
2493 ' specifies a connection between feature ', nn1, &
2494 ' feature ', nn2,
', but these features are not connected.'
2515 do i = 1, this%obs%npakobs
2516 obsrv => this%obs%pakobs(i)%obsrv
2517 select case (obsrv%ObsTypeId)
2518 case (
'CONCENTRATION',
'TEMPERATURE')
2519 call this%rp_obs_byfeature(obsrv)
2523 if (obsrv%indxbnds_count > 1)
then
2524 write (
errmsg,
'(a, a, a, a)') &
2525 trim(adjustl(this%depvartype))// &
2526 ' for observation', trim(adjustl(obsrv%Name)), &
2527 ' must be assigned to a feature with a unique boundname.'
2530 case (
'LKT',
'SFT',
'MWT',
'UZT',
'LKE',
'SFE',
'MWE',
'UZE')
2531 call this%rp_obs_budterm(obsrv, &
2532 this%flowbudptr%budterm(this%idxbudgwf))
2533 case (
'FLOW-JA-FACE')
2534 if (this%idxbudfjf > 0)
then
2535 call this%rp_obs_flowjaface(obsrv, &
2536 this%flowbudptr%budterm(this%idxbudfjf))
2539 'Observation ', trim(obsrv%Name),
' of type ', &
2540 trim(adjustl(obsrv%ObsTypeId)),
' in package ', &
2541 trim(this%packName), &
2542 ' cannot be processed because there are no flow connections.'
2546 call this%rp_obs_byfeature(obsrv)
2548 call this%rp_obs_byfeature(obsrv)
2550 call this%rp_obs_byfeature(obsrv)
2555 call this%pak_rp_obs(obsrv, found)
2558 if (.not. found)
then
2559 errmsg =
'Unrecognized observation type "'// &
2560 trim(obsrv%ObsTypeId)//
'" for '// &
2561 trim(adjustl(this%text))//
' package '// &
2588 integer(I4B) :: igwfnode
2599 if (this%obs%npakobs > 0)
then
2600 call this%obs%obs_bd_clear()
2601 do i = 1, this%obs%npakobs
2602 obsrv => this%obs%pakobs(i)%obsrv
2603 do j = 1, obsrv%indxbnds_count
2605 jj = obsrv%indxbnds(j)
2606 select case (obsrv%ObsTypeId)
2607 case (
'CONCENTRATION',
'TEMPERATURE')
2608 if (this%iboundpak(jj) /= 0)
then
2609 v = this%xnewpak(jj)
2611 case (
'LKT',
'SFT',
'MWT',
'UZT',
'LKE',
'SFE',
'MWE',
'UZE')
2612 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(jj)
2613 if (this%iboundpak(n) /= 0)
then
2614 igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(jj)
2615 v = this%hcof(jj) * this%xnew(igwfnode) - this%rhs(jj)
2618 case (
'FLOW-JA-FACE')
2619 n = this%flowbudptr%budterm(this%idxbudfjf)%id1(jj)
2620 if (this%iboundpak(n) /= 0)
then
2621 call this%apt_fjf_term(jj, n1, n2, v)
2624 if (this%iboundpak(jj) /= 0)
then
2628 if (this%iboundpak(jj) /= 0)
then
2632 if (this%iboundpak(jj) /= 0 .and. this%idxbudfmvr > 0)
then
2633 call this%apt_fmvr_term(jj, n1, n2, v)
2636 if (this%idxbudtmvr > 0)
then
2637 n = this%flowbudptr%budterm(this%idxbudtmvr)%id1(jj)
2638 if (this%iboundpak(n) /= 0)
then
2639 call this%apt_tmvr_term(jj, n1, n2, v)
2646 call this%pak_bd_obs(obsrv%ObsTypeId, jj, v, found)
2649 if (.not. found)
then
2650 errmsg =
'Unrecognized observation type "'// &
2651 trim(obsrv%ObsTypeId)//
'" for '// &
2652 trim(adjustl(this%text))//
' package '// &
2657 call this%obs%SaveOneSimval(obsrv, v)
2673 character(len=*),
intent(in) :: obstypeid
2674 integer(I4B),
intent(in) :: jj
2675 real(DP),
intent(inout) :: v
2676 logical,
intent(inout) :: found
2693 integer(I4B),
intent(in) :: inunitobs
2694 integer(I4B),
intent(in) :: iout
2697 integer(I4B) :: icol
2698 integer(I4B) :: istart
2699 integer(I4B) :: istop
2700 character(len=LINELENGTH) :: string
2701 character(len=LENBOUNDNAME) :: bndname
2704 string = obsrv%IDstring
2714 obsrv%FeatureName = bndname
2718 obsrv%NodeNumber = nn1
2723 obsrv%NodeNumber2 = 1
2736 integer(I4B),
intent(in) :: inunitobs
2737 integer(I4B),
intent(in) :: iout
2740 integer(I4B) :: iconn
2741 integer(I4B) :: icol
2742 integer(I4B) :: istart
2743 integer(I4B) :: istop
2744 character(len=LINELENGTH) :: string
2745 character(len=LENBOUNDNAME) :: bndname
2748 string = obsrv%IDstring
2758 obsrv%FeatureName = bndname
2761 if (len_trim(bndname) < 1 .and. iconn < 0)
then
2762 write (
errmsg,
'(a,1x,a,a,1x,a,1x,a)') &
2763 'For observation type', trim(adjustl(obsrv%ObsTypeId)), &
2764 ', ID given as an integer and not as boundname,', &
2765 'but ID2 is missing. Either change ID to valid', &
2766 'boundname or supply valid entry for ID2.'
2769 obsrv%NodeNumber2 = iconn
2773 obsrv%NodeNumber = nn1
2788 integer(I4B) :: nterms
2789 character(len=LINELENGTH) :: title
2790 character(len=LINELENGTH) :: text_temp
2793 if (this%iprconc > 0)
then
2797 if (this%inamedbound == 1) nterms = nterms + 1
2800 title = trim(adjustl(this%text))//
' PACKAGE ('// &
2801 trim(adjustl(this%packName))// &
2802 ') '//trim(adjustl(this%depvartype))// &
2803 &
' FOR EACH CONTROL VOLUME'
2806 call table_cr(this%dvtab, this%packName, title)
2807 call this%dvtab%table_df(this%ncv, nterms, this%iout, &
2811 if (this%inamedbound == 1)
then
2813 call this%dvtab%initialize_column(text_temp, 20, alignment=tableft)
2817 text_temp =
'NUMBER'
2818 call this%dvtab%initialize_column(text_temp, 10, alignment=tabcenter)
2821 text_temp = this%depvartype(1:4)
2822 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.
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 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 ...