44 integer(I4B),
pointer :: iname => null()
45 character(len=24),
dimension(:),
pointer :: aname => null()
46 integer(I4B),
dimension(:),
pointer,
contiguous :: ibound => null()
47 real(dp),
dimension(:),
pointer,
contiguous :: hnew => null()
48 integer(I4B),
pointer :: ixt3d => null()
49 integer(I4B),
pointer :: ixt3drhs => null()
50 integer(I4B),
pointer :: iperched => null()
51 integer(I4B),
pointer :: ivarcv => null()
52 integer(I4B),
pointer :: idewatcv => null()
53 integer(I4B),
pointer :: ithickstrt => null()
54 integer(I4B),
pointer :: ihighcellsat => null()
55 integer(I4B),
pointer :: igwfnewtonur => null()
56 integer(I4B),
pointer :: icalcspdis => null()
57 integer(I4B),
pointer :: isavspdis => null()
58 integer(I4B),
pointer :: isavsat => null()
59 real(dp),
pointer :: hnoflo => null()
60 real(dp),
pointer :: satomega => null()
61 integer(I4B),
pointer :: irewet => null()
62 integer(I4B),
pointer :: iwetit => null()
63 integer(I4B),
pointer :: ihdwet => null()
64 integer(I4B),
pointer :: icellavg => null()
65 real(dp),
pointer :: wetfct => null()
66 real(dp),
pointer :: hdry => null()
67 integer(I4B),
dimension(:),
pointer,
contiguous :: icelltype => null()
68 integer(I4B),
dimension(:),
pointer,
contiguous :: ithickstartflag => null()
71 real(dp),
dimension(:),
pointer,
contiguous :: k11 => null()
72 real(dp),
dimension(:),
pointer,
contiguous :: k22 => null()
73 real(dp),
dimension(:),
pointer,
contiguous :: k33 => null()
74 real(dp),
dimension(:),
pointer,
contiguous :: krel => null()
75 real(dp),
dimension(:),
pointer,
contiguous :: k11input => null()
76 real(dp),
dimension(:),
pointer,
contiguous :: k22input => null()
77 real(dp),
dimension(:),
pointer,
contiguous :: k33input => null()
78 integer(I4B),
pointer :: iavgkeff => null()
79 integer(I4B),
pointer :: ik22 => null()
80 integer(I4B),
pointer :: ik33 => null()
81 integer(I4B),
pointer :: ik22overk => null()
82 integer(I4B),
pointer :: ik33overk => null()
83 integer(I4B),
pointer :: iangle1 => null()
84 integer(I4B),
pointer :: iangle2 => null()
85 integer(I4B),
pointer :: iangle3 => null()
86 real(dp),
dimension(:),
pointer,
contiguous :: angle1 => null()
87 real(dp),
dimension(:),
pointer,
contiguous :: angle2 => null()
88 real(dp),
dimension(:),
pointer,
contiguous :: angle3 => null()
90 integer(I4B),
pointer :: iwetdry => null()
91 real(dp),
dimension(:),
pointer,
contiguous :: wetdry => null()
92 real(dp),
dimension(:),
pointer,
contiguous :: sat => null()
93 real(dp),
dimension(:),
pointer,
contiguous :: condsat => null()
94 integer(I4B),
dimension(:),
pointer,
contiguous :: ibotnode => null()
96 real(dp),
dimension(:, :),
pointer,
contiguous :: spdis => null()
97 integer(I4B),
pointer :: nedges => null()
98 integer(I4B),
pointer :: lastedge => null()
99 integer(I4B),
dimension(:),
pointer,
contiguous :: nodedge => null()
100 integer(I4B),
dimension(:),
pointer,
contiguous :: ihcedge => null()
101 real(dp),
dimension(:, :),
pointer,
contiguous :: propsedge => null()
102 integer(I4B),
dimension(:),
pointer,
contiguous :: iedge_ptr => null()
103 integer(I4B),
dimension(:),
pointer,
contiguous :: edge_idxs => null()
106 integer(I4B),
pointer :: intvk => null()
107 integer(I4B),
pointer :: invsc => null()
109 integer(I4B),
pointer :: kchangeper => null()
110 integer(I4B),
pointer :: kchangestp => null()
111 integer(I4B),
dimension(:),
pointer,
contiguous :: nodekchange => null()
113 integer(I4B),
dimension(:),
pointer,
contiguous :: iformulation => null()
188 subroutine npf_cr(npfobj, name_model, input_mempath, inunit, iout)
194 character(len=*),
intent(in) :: name_model
195 character(len=*),
intent(in) :: input_mempath
196 integer(I4B),
intent(in) :: inunit
197 integer(I4B),
intent(in) :: iout
199 character(len=*),
parameter :: fmtheader = &
200 "(1x, /1x, 'NPF -- NODE PROPERTY FLOW PACKAGE, VERSION 1, 3/30/2015', &
201 &' INPUT READ FROM MEMPATH: ', A, /)"
207 call npfobj%set_names(1, name_model,
'NPF',
'NPF', input_mempath)
210 call npfobj%allocate_scalars()
213 npfobj%inunit = inunit
220 write (iout, fmtheader) input_mempath
224 allocate (npfobj%spdis_wa)
235 subroutine npf_df(this, dis, xt3d, ingnc, invsc, npf_options)
243 integer(I4B),
intent(in) :: ingnc
244 integer(I4B),
intent(in) :: invsc
251 if (invsc > 0) this%invsc = invsc
253 if (.not.
present(npf_options))
then
256 call this%source_options()
259 call this%allocate_arrays(this%dis%nodes, this%dis%njas)
262 call this%source_griddata()
263 call this%prepcheck()
265 call this%set_options(npf_options)
268 call this%allocate_arrays(this%dis%nodes, this%dis%njas)
271 call this%check_options()
275 if (this%ixt3d /= 0) xt3d%ixt3d = this%ixt3d
276 call this%xt3d%xt3d_df(dis)
279 if (this%ixt3d /= 0 .and. ingnc > 0)
then
280 call store_error(
'Error in model '//trim(this%name_model)// &
281 '. The XT3D option cannot be used with the GNC &
282 &Package.', terminate=.true.)
293 integer(I4B),
intent(in) :: moffset
297 if (this%ixt3d /= 0)
call this%xt3d%xt3d_ac(moffset, sparse)
302 subroutine npf_mc(this, moffset, matrix_sln)
305 integer(I4B),
intent(in) :: moffset
308 if (this%ixt3d /= 0)
call this%xt3d%xt3d_mc(moffset, matrix_sln)
316 subroutine npf_ar(this, ic, vsc, ibound, hnew)
322 type(
gwfictype),
pointer,
intent(in) :: ic
324 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(inout) :: ibound
325 real(DP),
dimension(:),
pointer,
contiguous,
intent(inout) :: hnew
331 this%ibound => ibound
334 if (this%icalcspdis == 1)
then
335 call mem_reallocate(this%spdis, 3, this%dis%nodes,
'SPDIS', this%memoryPath)
336 call mem_reallocate(this%nodedge, this%nedges,
'NODEDGE', this%memoryPath)
337 call mem_reallocate(this%ihcedge, this%nedges,
'IHCEDGE', this%memoryPath)
338 call mem_reallocate(this%propsedge, 5, this%nedges,
'PROPSEDGE', &
341 'NREDGESNODE', this%memoryPath)
343 'EDGEIDXS', this%memoryPath)
345 do n = 1, this%nedges
346 this%edge_idxs(n) = 0
348 do n = 1, this%dis%nodes
349 this%iedge_ptr(n) = 0
350 this%spdis(:, n) =
dzero
355 if (this%invsc /= 0)
then
360 if (this%invsc > 0)
then
372 call this%store_original_k_arrays(this%dis%nodes, this%dis%njas)
376 call this%preprocess_input()
381 if (this%ixt3d /= 0 .or. this%ik22 /= 0 .or. this%icalcspdis /= 0)
then
382 select type (dis => this%dis)
384 if (dis%nangldegxerr > 0)
then
385 write (
errmsg,
'(a,1x,i0,1x,a)') &
386 'ANGLDEGX values in the DISU Package are inconsistent for', &
387 dis%nangldegxerr,
'cell faces (see the warnings written after &
388 &the DISU Package input in the model listing file). ANGLDEGX &
389 &must be correct because it is required input for the NPF &
390 &Package when XT3D, K22, or SAVE_SPECIFIC_DISCHARGE is specified.'
397 if (this%ixt3d /= 0)
then
398 call this%xt3d%xt3d_ar(ibound, this%k11, this%ik33, this%k33, &
399 this%sat, this%ik22, this%k22, &
400 this%iangle1, this%iangle2, this%iangle3, &
401 this%angle1, this%angle2, this%angle3, &
402 this%inewton, this%icelltype)
406 if (this%intvk /= 0)
then
407 call this%tvk%ar(this%dis)
421 if (this%intvk /= 0)
then
430 subroutine npf_ad(this, nodes, hold, hnew, irestore)
437 integer(I4B),
intent(in) :: nodes
438 real(DP),
dimension(nodes),
intent(inout) :: hold
439 real(DP),
dimension(nodes),
intent(inout) :: hnew
440 integer(I4B),
intent(in) :: irestore
445 if (this%irewet > 0)
then
446 do n = 1, this%dis%nodes
447 if (this%wetdry(n) ==
dzero) cycle
448 if (this%ibound(n) /= 0) cycle
449 hold(n) = this%dis%bot(n)
453 do n = 1, this%dis%nodes
454 if (this%wetdry(n) ==
dzero) cycle
455 if (this%ibound(n) /= 0) cycle
461 if (this%intvk /= 0)
then
467 if (this%invsc /= 0)
then
468 call this%vsc%update_k_with_vsc()
472 if (this%kchangeper ==
kper .and. this%kchangestp ==
kstp)
then
473 if (this%ixt3d == 0)
then
477 do n = 1, this%dis%nodes
478 if (this%nodekchange(n) == 1)
then
479 call this%calc_condsat(n, .false.)
485 if (this%xt3d%lamatsaved .and. .not. this%xt3d%ldispersion)
then
486 call this%xt3d%xt3d_fcpc(this%dis%nodes, .true.)
494 subroutine npf_cf(this, kiter, nodes, hnew)
496 integer(I4B) :: kiter
497 integer(I4B),
intent(in) :: nodes
498 real(DP),
intent(inout),
dimension(nodes) :: hnew
500 integer(I4B) :: iform
503 if (this%inewton /= 1)
then
504 call this%wd(kiter, hnew)
509 call this%default_form%cf(kiter)
511 if (
associated(this%flow_formulations(iform)%form))
then
512 call this%flow_formulations(iform)%form%cf(kiter)
525 integer(I4B),
intent(in) :: kiter
527 integer(I4B) :: n, idiag
529 do n = 1, this%npf%dis%nodes
531 idiag = this%npf%dis%con%ia(n)
533 call this%npf%cf_default_flow(kiter, n)
542 integer(I4B) :: kiter
548 if (this%icelltype(n) /= 0)
then
549 if (this%ibound(n) == 0)
then
552 call this%thksat(n, this%hnew(n), satn)
561 subroutine npf_fc(this, kiter, matrix_sln, idxglo, rhs, hnew)
563 integer(I4B) :: kiter
565 integer(I4B),
intent(in),
dimension(:) :: idxglo
566 real(DP),
intent(inout),
dimension(:) :: rhs
567 real(DP),
intent(inout),
dimension(:) :: hnew
569 integer(I4B) :: iform
571 if (this%ixt3d /= 0)
then
572 call this%xt3d%xt3d_fc(kiter, matrix_sln, idxglo, rhs, hnew)
576 call this%default_form%fc(kiter, matrix_sln, idxglo, rhs, hnew)
578 if (
associated(this%flow_formulations(iform)%form))
then
579 call this%flow_formulations(iform)%form%fc(kiter, matrix_sln, &
595 real(DP),
intent(inout),
dimension(:) :: rhs
596 integer(I4B),
intent(in),
dimension(:) :: idxglo
597 real(DP),
intent(inout),
dimension(:) :: hnew
599 integer(I4B) :: idiag, ihc
600 integer(I4B) :: isymcon, idiagm
606 ihc = this%dis%con%ihc(this%dis%con%jas(ipos))
607 hyn = this%hy_eff(n, m, ihc, ipos=ipos)
608 hym = this%hy_eff(m, n, ihc, ipos=ipos)
612 cond =
vcond(this%ibound(n), this%ibound(m), &
613 this%icelltype(n), this%icelltype(m), this%inewton, &
614 this%ivarcv, this%idewatcv, &
615 this%condsat(this%dis%con%jas(ipos)), hnew(n), hnew(m), &
617 this%sat(n), this%sat(m), &
618 this%dis%top(n), this%dis%top(m), &
619 this%dis%bot(n), this%dis%bot(m), &
620 this%dis%con%hwva(this%dis%con%jas(ipos)))
623 if (this%iperched /= 0)
then
624 if (this%icelltype(m) /= 0)
then
625 if (hnew(m) < this%dis%top(m))
then
628 idiag = this%dis%con%ia(n)
629 rhs(n) = rhs(n) - cond * this%dis%bot(n)
630 call matrix_sln%add_value_pos(idxglo(idiag), -cond)
633 isymcon = this%dis%con%isym(ipos)
634 call matrix_sln%add_value_pos(idxglo(isymcon), cond)
635 rhs(m) = rhs(m) + cond * this%dis%bot(n)
645 if (this%ihighcellsat /= 0)
then
646 call this%highest_cell_saturation(n, m, &
651 cond =
hcond(this%ibound(n), this%ibound(m), &
652 this%icelltype(n), this%icelltype(m), &
654 this%dis%con%ihc(this%dis%con%jas(ipos)), &
656 this%condsat(this%dis%con%jas(ipos)), &
657 hnew(n), hnew(m), satn, satm, hyn, hym, &
658 this%dis%top(n), this%dis%top(m), &
659 this%dis%bot(n), this%dis%bot(m), &
660 this%dis%con%cl1(this%dis%con%jas(ipos)), &
661 this%dis%con%cl2(this%dis%con%jas(ipos)), &
662 this%dis%con%hwva(this%dis%con%jas(ipos)))
666 idiag = this%dis%con%ia(n)
667 call matrix_sln%add_value_pos(idxglo(ipos), cond)
668 call matrix_sln%add_value_pos(idxglo(idiag), -cond)
671 isymcon = this%dis%con%isym(ipos)
672 idiagm = this%dis%con%ia(m)
673 call matrix_sln%add_value_pos(idxglo(isymcon), cond)
674 call matrix_sln%add_value_pos(idxglo(idiagm), -cond)
685 integer(I4B),
intent(in) :: kiter
687 integer(I4B),
dimension(:),
intent(in) :: idxglo
688 real(DP),
dimension(:),
intent(inout) :: rhs
689 real(DP),
dimension(:),
intent(inout) :: hnew
691 integer(I4B) :: n, m, ipos
693 do n = 1, this%npf%dis%nodes
694 do ipos = this%npf%dis%con%ia(n) + 1, this%npf%dis%con%ia(n + 1) - 1
695 if (this%npf%dis%con%mask(ipos) == 0) cycle
697 m = this%npf%dis%con%ja(ipos)
706 call this%npf%fc_default_flow(n, m, ipos, matrix_sln, &
721 integer(I4B),
intent(in) :: n, m
722 real(DP),
intent(in) :: hn, hm
723 real(DP),
intent(inout) :: satn, satm
725 integer(I4B) :: ihdbot
726 real(DP) :: botn, botm
729 botn = this%dis%bot(n)
730 botm = this%dis%bot(m)
733 if (botm > botn) ihdbot = m
737 if (abs(botm - botn) >=
dem2)
then
738 top = this%dis%top(ihdbot)
739 bot = this%dis%bot(ihdbot)
747 subroutine npf_fn(this, kiter, matrix_sln, idxglo, rhs, hnew)
750 integer(I4B) :: kiter
752 integer(I4B),
intent(in),
dimension(:) :: idxglo
753 real(DP),
intent(inout),
dimension(:) :: rhs
754 real(DP),
intent(inout),
dimension(:) :: hnew
756 integer(I4B) :: nodes, nja
757 integer(I4B) :: iform
760 nodes = this%dis%nodes
761 nja = this%dis%con%nja
762 if (this%ixt3d /= 0)
then
763 call this%xt3d%xt3d_fn(kiter, nodes, nja, matrix_sln, idxglo, rhs, hnew)
767 call this%default_form%fn(kiter, matrix_sln, idxglo, rhs, hnew)
769 if (
associated(this%flow_formulations(iform)%form))
then
770 call this%flow_formulations(iform)%form%fn(kiter, matrix_sln, &
784 integer(I4B),
intent(in) :: kiter
786 integer(I4B),
dimension(:),
intent(in) :: idxglo
787 real(DP),
dimension(:),
intent(inout) :: rhs
788 real(DP),
dimension(:),
intent(inout) :: hnew
790 integer(I4B) :: n, m, ipos
792 do n = 1, this%npf%dis%nodes
793 do ipos = this%npf%dis%con%ia(n) + 1, this%npf%dis%con%ia(n + 1) - 1
794 if (this%npf%dis%con%mask(ipos) == 0) cycle
796 m = this%npf%dis%con%ja(ipos)
804 call this%npf%fn_default_flow(n, m, ipos, matrix_sln, &
817 real(DP),
intent(inout),
dimension(:) :: rhs
818 integer(I4B),
intent(in),
dimension(:) :: idxglo
819 real(DP),
intent(inout),
dimension(:) :: hnew
821 integer(I4B) :: isymcon
822 integer(I4B) :: idiag, idiagm
827 real(DP) :: filledterm
834 idiag = this%dis%con%ia(n)
835 isymcon = this%dis%con%isym(ipos)
837 if (this%dis%con%ihc(this%dis%con%jas(ipos)) == 0 .and. &
838 this%ivarcv == 0)
then
844 if (hnew(m) < hnew(n)) iups = n
846 if (iups == n) idn = m
849 if (this%icelltype(iups) == 0)
return
853 topup = this%dis%top(iups)
854 botup = this%dis%bot(iups)
855 if (this%dis%con%ihc(this%dis%con%jas(ipos)) == 2)
then
856 topup = min(this%dis%top(n), this%dis%top(m))
857 botup = max(this%dis%bot(n), this%dis%bot(m))
861 cond = this%condsat(this%dis%con%jas(ipos))
864 consterm = -cond * (hnew(iups) - hnew(idn))
866 filledterm = matrix_sln%get_value_pos(idxglo(ipos))
869 idiagm = this%dis%con%ia(m)
874 term = consterm * derv
875 rhs(n) = rhs(n) + term * hnew(n)
876 rhs(m) = rhs(m) - term * hnew(n)
878 call matrix_sln%add_value_pos(idxglo(idiag), term)
880 if (this%ibound(n) > 0)
then
881 filledterm = matrix_sln%get_value_pos(idxglo(ipos))
882 call matrix_sln%set_value_pos(idxglo(ipos), filledterm)
885 filledterm = matrix_sln%get_value_pos(idxglo(idiagm))
886 call matrix_sln%set_value_pos(idxglo(idiagm), filledterm)
888 if (this%ibound(m) > 0)
then
889 call matrix_sln%add_value_pos(idxglo(isymcon), -term)
894 term = -consterm * derv
895 rhs(n) = rhs(n) + term * hnew(m)
896 rhs(m) = rhs(m) - term * hnew(m)
898 filledterm = matrix_sln%get_value_pos(idxglo(idiag))
899 call matrix_sln%set_value_pos(idxglo(idiag), filledterm)
901 if (this%ibound(n) > 0)
then
902 call matrix_sln%add_value_pos(idxglo(ipos), term)
905 call matrix_sln%add_value_pos(idxglo(idiagm), -term)
907 if (this%ibound(m) > 0)
then
908 filledterm = matrix_sln%get_value_pos(idxglo(isymcon))
909 call matrix_sln%set_value_pos(idxglo(isymcon), filledterm)
920 subroutine npf_nur(this, neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
923 integer(I4B),
intent(in) :: neqmod
924 real(DP),
dimension(neqmod),
intent(inout) :: x
925 real(DP),
dimension(neqmod),
intent(in) :: xtemp
926 real(DP),
dimension(neqmod),
intent(inout) :: dx
927 integer(I4B),
intent(inout) :: inewtonur
928 real(DP),
intent(inout) :: dxmax
929 integer(I4B),
intent(inout) :: locmax
938 do n = 1, this%dis%nodes
939 if (this%ibound(n) < 1) cycle
940 ibot = this%ibotnode(n)
943 if (this%icelltype(n) > 0 .and. this%icelltype(ibot) > 0)
then
944 botm = this%dis%bot(ibot)
947 if (x(n) < botm)
then
951 if (abs(dxx) > abs(dxmax))
then
956 dx(n) = xtemp(n) - x(n)
967 real(DP),
intent(inout),
dimension(:) :: hnew
968 real(DP),
intent(inout),
dimension(:) :: flowja
970 integer(I4B) :: iform
974 if (this%ixt3d /= 0)
then
975 call this%xt3d%xt3d_flowja(hnew, flowja)
979 call this%default_form%cq(hnew, flowja)
981 if (
associated(this%flow_formulations(iform)%form))
then
982 call this%flow_formulations(iform)%form%cq(hnew, flowja)
995 real(DP),
dimension(:),
intent(inout) :: hnew
996 real(DP),
dimension(:),
intent(inout) :: flowja
998 integer(I4B) :: n, m, ipos
1000 do n = 1, this%npf%dis%nodes
1001 do ipos = this%npf%dis%con%ia(n) + 1, this%npf%dis%con%ia(n + 1) - 1
1002 m = this%npf%dis%con%ja(ipos)
1009 call this%npf%cq_default_flow(n, m, ipos, flowja, hnew)
1017 integer(I4B),
intent(in) :: n
1018 integer(I4B),
intent(in) :: m
1019 integer(I4B),
intent(in) :: ipos
1020 real(DP),
dimension(:),
intent(inout) :: flowja
1021 real(DP),
dimension(:),
intent(in) :: hnew
1025 call this%qcalc(n, m, hnew(n), hnew(m), ipos, qnm)
1027 flowja(this%dis%con%isym(ipos)) = -qnm
1036 integer(I4B),
intent(in) :: n
1037 real(DP),
intent(in) :: hn
1038 real(DP),
intent(inout) :: thksat
1041 if (hn >= this%dis%top(n))
then
1044 thksat = (hn - this%dis%bot(n)) / (this%dis%top(n) - this%dis%bot(n))
1048 if (this%inewton /= 0)
then
1059 integer(I4B),
intent(in) :: n
1060 integer(I4B),
intent(in) :: m
1061 real(DP),
intent(in) :: hn
1062 real(DP),
intent(in) :: hm
1063 integer(I4B),
intent(in) :: icon
1064 real(DP),
intent(inout) :: qnm
1066 real(DP) :: hyn, hym
1068 real(DP) :: hntemp, hmtemp
1069 real(DP) :: satn, satm
1073 ihc = this%dis%con%ihc(this%dis%con%jas(icon))
1074 hyn = this%hy_eff(n, m, ihc, ipos=icon)
1075 hym = this%hy_eff(m, n, ihc, ipos=icon)
1079 condnm =
vcond(this%ibound(n), this%ibound(m), &
1080 this%icelltype(n), this%icelltype(m), this%inewton, &
1081 this%ivarcv, this%idewatcv, &
1082 this%condsat(this%dis%con%jas(icon)), hn, hm, &
1084 this%sat(n), this%sat(m), &
1085 this%dis%top(n), this%dis%top(m), &
1086 this%dis%bot(n), this%dis%bot(m), &
1087 this%dis%con%hwva(this%dis%con%jas(icon)))
1091 if (this%ihighcellsat /= 0)
then
1092 call this%highest_cell_saturation(n, m, hn, hm, satn, satm)
1095 condnm =
hcond(this%ibound(n), this%ibound(m), &
1096 this%icelltype(n), this%icelltype(m), &
1098 this%dis%con%ihc(this%dis%con%jas(icon)), &
1100 this%condsat(this%dis%con%jas(icon)), &
1101 hn, hm, satn, satm, hyn, hym, &
1102 this%dis%top(n), this%dis%top(m), &
1103 this%dis%bot(n), this%dis%bot(m), &
1104 this%dis%con%cl1(this%dis%con%jas(icon)), &
1105 this%dis%con%cl2(this%dis%con%jas(icon)), &
1106 this%dis%con%hwva(this%dis%con%jas(icon)))
1114 if (this%iperched /= 0)
then
1115 if (this%dis%con%ihc(this%dis%con%jas(icon)) == 0)
then
1117 if (this%icelltype(n) /= 0)
then
1118 if (hn < this%dis%top(n)) hntemp = this%dis%bot(m)
1121 if (this%icelltype(m) /= 0)
then
1122 if (hm < this%dis%top(m)) hmtemp = this%dis%bot(n)
1129 qnm = condnm * (hmtemp - hntemp)
1137 real(DP),
dimension(:),
intent(in) :: flowja
1138 integer(I4B),
intent(in) :: icbcfl
1139 integer(I4B),
intent(in) :: icbcun
1141 integer(I4B) :: ibinun
1144 if (this%ipakcb < 0)
then
1146 elseif (this%ipakcb == 0)
then
1149 ibinun = this%ipakcb
1151 if (icbcfl == 0) ibinun = 0
1154 if (ibinun /= 0)
then
1155 call this%dis%record_connection_array(flowja, ibinun, this%iout)
1159 if (this%isavspdis /= 0)
then
1160 if (ibinun /= 0)
call this%sav_spdis(ibinun)
1164 if (this%isavsat /= 0)
then
1165 if (ibinun /= 0)
call this%sav_sat(ibinun)
1177 integer(I4B),
intent(in) :: ibudfl
1178 real(DP),
intent(inout),
dimension(:) :: flowja
1180 character(len=LENBIGLINE) :: line
1181 character(len=30) :: tempstr
1182 integer(I4B) :: n, ipos, m
1185 character(len=*),
parameter :: fmtiprflow = &
1186 &
"(/,4x,'CALCULATED INTERCELL FLOW FOR PERIOD ', i0, ' STEP ', i0)"
1189 if (ibudfl /= 0 .and. this%iprflow > 0)
then
1190 write (this%iout, fmtiprflow)
kper,
kstp
1191 do n = 1, this%dis%nodes
1193 call this%dis%noder_to_string(n, tempstr)
1194 line = trim(tempstr)//
':'
1195 do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
1196 m = this%dis%con%ja(ipos)
1197 call this%dis%noder_to_string(m, tempstr)
1198 line = trim(line)//
' '//trim(tempstr)
1200 write (tempstr,
'(1pg15.6)') qnm
1201 line = trim(line)//
' '//trim(adjustl(tempstr))
1203 write (this%iout,
'(a)') trim(line)
1218 if (this%icalcspdis == 1 .and. this%spdis_wa%is_created()) &
1219 call this%spdis_wa%destroy()
1220 deallocate (this%spdis_wa)
1226 if (this%intvk /= 0)
then
1228 deallocate (this%tvk)
1232 if (this%invsc /= 0)
then
1274 deallocate (this%aname)
1300 if (
associated(this%default_form))
then
1301 deallocate (this%default_form)
1302 this%default_form => null()
1306 call this%NumericalPackageType%da()
1325 call this%NumericalPackageType%allocate_scalars()
1328 call mem_allocate(this%iname,
'INAME', this%memoryPath)
1329 call mem_allocate(this%ixt3d,
'IXT3D', this%memoryPath)
1330 call mem_allocate(this%ixt3drhs,
'IXT3DRHS', this%memoryPath)
1331 call mem_allocate(this%satomega,
'SATOMEGA', this%memoryPath)
1332 call mem_allocate(this%hnoflo,
'HNOFLO', this%memoryPath)
1334 call mem_allocate(this%icellavg,
'ICELLAVG', this%memoryPath)
1335 call mem_allocate(this%iavgkeff,
'IAVGKEFF', this%memoryPath)
1338 call mem_allocate(this%ik22overk,
'IK22OVERK', this%memoryPath)
1339 call mem_allocate(this%ik33overk,
'IK33OVERK', this%memoryPath)
1340 call mem_allocate(this%iperched,
'IPERCHED', this%memoryPath)
1341 call mem_allocate(this%ivarcv,
'IVARCV', this%memoryPath)
1342 call mem_allocate(this%idewatcv,
'IDEWATCV', this%memoryPath)
1343 call mem_allocate(this%ithickstrt,
'ITHICKSTRT', this%memoryPath)
1344 call mem_allocate(this%ihighcellsat,
'IHIGHCELLSAT', this%memoryPath)
1345 call mem_allocate(this%icalcspdis,
'ICALCSPDIS', this%memoryPath)
1346 call mem_allocate(this%isavspdis,
'ISAVSPDIS', this%memoryPath)
1347 call mem_allocate(this%isavsat,
'ISAVSAT', this%memoryPath)
1348 call mem_allocate(this%irewet,
'IREWET', this%memoryPath)
1349 call mem_allocate(this%wetfct,
'WETFCT', this%memoryPath)
1350 call mem_allocate(this%iwetit,
'IWETIT', this%memoryPath)
1351 call mem_allocate(this%ihdwet,
'IHDWET', this%memoryPath)
1352 call mem_allocate(this%iangle1,
'IANGLE1', this%memoryPath)
1353 call mem_allocate(this%iangle2,
'IANGLE2', this%memoryPath)
1354 call mem_allocate(this%iangle3,
'IANGLE3', this%memoryPath)
1355 call mem_allocate(this%iwetdry,
'IWETDRY', this%memoryPath)
1356 call mem_allocate(this%nedges,
'NEDGES', this%memoryPath)
1357 call mem_allocate(this%lastedge,
'LASTEDGE', this%memoryPath)
1358 call mem_allocate(this%intvk,
'INTVK', this%memoryPath)
1359 call mem_allocate(this%invsc,
'INVSC', this%memoryPath)
1360 call mem_allocate(this%kchangeper,
'KCHANGEPER', this%memoryPath)
1361 call mem_allocate(this%kchangestp,
'KCHANGESTP', this%memoryPath)
1364 call mem_setptr(this%igwfnewtonur,
'INEWTONUR', &
1371 this%satomega =
dzero
1384 this%ihighcellsat = 0
1404 this%iasym = this%inewton
1422 integer(I4B),
intent(in) :: ncells
1423 integer(I4B),
intent(in) :: njas
1429 this%k11input(n) = this%k11(n)
1430 this%k22input(n) = this%k22(n)
1431 this%k33input(n) = this%k33(n)
1440 integer(I4B),
intent(in) :: ncells
1441 integer(I4B),
intent(in) :: njas
1445 call mem_allocate(this%ithickstartflag, ncells,
'ITHICKSTARTFLAG', &
1447 call mem_allocate(this%icelltype, ncells,
'ICELLTYPE', this%memoryPath)
1448 call mem_allocate(this%k11, ncells,
'K11', this%memoryPath)
1449 call mem_allocate(this%krel, ncells,
'KREL', this%memoryPath)
1450 call mem_allocate(this%sat, ncells,
'SAT', this%memoryPath)
1451 call mem_allocate(this%condsat, njas,
'CONDSAT', this%memoryPath)
1454 call mem_allocate(this%k22, ncells,
'K22', this%memoryPath)
1455 call mem_allocate(this%k33, ncells,
'K33', this%memoryPath)
1456 call mem_allocate(this%wetdry, ncells,
'WETDRY', this%memoryPath)
1457 call mem_allocate(this%angle1, ncells,
'ANGLE1', this%memoryPath)
1458 call mem_allocate(this%angle2, ncells,
'ANGLE2', this%memoryPath)
1459 call mem_allocate(this%angle3, ncells,
'ANGLE3', this%memoryPath)
1462 call mem_allocate(this%ibotnode, 0,
'IBOTNODE', this%memoryPath)
1463 call mem_allocate(this%nodedge, 0,
'NODEDGE', this%memoryPath)
1464 call mem_allocate(this%ihcedge, 0,
'IHCEDGE', this%memoryPath)
1465 call mem_allocate(this%propsedge, 0, 0,
'PROPSEDGE', this%memoryPath)
1466 call mem_allocate(this%iedge_ptr, 0,
'NREDGESNODE', this%memoryPath)
1467 call mem_allocate(this%edge_idxs, 0,
'EDGEIDXS', this%memoryPath)
1470 call mem_allocate(this%k11input, 0,
'K11INPUT', this%memoryPath)
1471 call mem_allocate(this%k22input, 0,
'K22INPUT', this%memoryPath)
1472 call mem_allocate(this%k33input, 0,
'K33INPUT', this%memoryPath)
1475 call mem_allocate(this%spdis, 3, 0,
'SPDIS', this%memoryPath)
1478 call mem_allocate(this%nodekchange, ncells,
'NODEKCHANGE', this%memoryPath)
1480 call mem_allocate(this%iformulation, this%dis%con%nja,
'IFORM', &
1484 do n = 1,
size(this%iformulation)
1490 select type (form => this%default_form)
1497 this%angle1(n) =
dzero
1498 this%angle2(n) =
dzero
1499 this%angle3(n) =
dzero
1500 this%wetdry(n) =
dzero
1501 this%nodekchange(n) =
dzero
1506 allocate (this%aname(this%iname))
1507 this%aname = [
' ICELLTYPE',
' K', &
1509 ' WETDRY',
' ANGLE1', &
1510 ' ANGLE2',
' ANGLE3']
1524 write (this%iout,
'(1x,a)')
'Setting NPF Options'
1525 if (found%iprflow) &
1526 write (this%iout,
'(4x,a)')
'Cell-by-cell flow information will be printed &
1527 &to listing file whenever ICBCFL is not zero.'
1529 write (this%iout,
'(4x,a)')
'Cell-by-cell flow information will be saved &
1530 &to binary file whenever ICBCFL is not zero.'
1531 if (found%cellavg) &
1532 write (this%iout,
'(4x,a,i0)')
'Alternative cell averaging [1=logarithmic, &
1533 &2=AMT-LMK, 3=AMT-HMK] set to: ', &
1535 if (found%ithickstrt) &
1536 write (this%iout,
'(4x,a)')
'THICKSTRT option has been activated.'
1537 if (found%ihighcellsat) &
1538 write (this%iout,
'(4x,a)')
'HIGHEST_CELL_SATURATION option &
1539 &has been activated.'
1540 if (found%iperched) &
1541 write (this%iout,
'(4x,a)')
'Vertical flow will be adjusted for perched &
1544 write (this%iout,
'(4x,a)')
'Vertical conductance varies with water table.'
1545 if (found%idewatcv) &
1546 write (this%iout,
'(4x,a)')
'Vertical conductance is calculated using &
1547 &only the saturated thickness and properties &
1548 &of the overlying cell if the head in the &
1549 &underlying cell is below its top.'
1550 if (found%ixt3d)
write (this%iout,
'(4x,a)')
'XT3D formulation is selected.'
1551 if (found%ixt3drhs) &
1552 write (this%iout,
'(4x,a)')
'XT3D RHS formulation is selected.'
1553 if (found%isavspdis) &
1554 write (this%iout,
'(4x,a)')
'Specific discharge will be calculated at cell &
1555 ¢ers and written to DATA-SPDIS in budget &
1556 &file when requested.'
1557 if (found%isavsat) &
1558 write (this%iout,
'(4x,a)')
'Saturation will be written to DATA-SAT in &
1559 &budget file when requested.'
1560 if (found%ik22overk) &
1561 write (this%iout,
'(4x,a)')
'Values specified for K22 are anisotropy &
1562 &ratios and will be multiplied by K before &
1563 &being used in calculations.'
1564 if (found%ik33overk) &
1565 write (this%iout,
'(4x,a)')
'Values specified for K33 are anisotropy &
1566 &ratios and will be multiplied by K before &
1567 &being used in calculations.'
1568 if (found%inewton) &
1569 write (this%iout,
'(4x,a)')
'NEWTON-RAPHSON method disabled for unconfined &
1571 if (found%satomega) &
1572 write (this%iout,
'(4x,a,1pg15.6)')
'Saturation omega: ', this%satomega
1574 write (this%iout,
'(4x,a)')
'Rewetting is active.'
1576 write (this%iout,
'(4x,a,1pg15.6)') &
1577 'Wetting factor (WETFCT) has been set to: ', this%wetfct
1579 write (this%iout,
'(4x,a,i5)') &
1580 'Wetting iteration interval (IWETIT) has been set to: ', this%iwetit
1582 write (this%iout,
'(4x,a,i5)') &
1583 'Head rewet equation (IHDWET) has been set to: ', this%ihdwet
1584 write (this%iout,
'(1x,a,/)')
'End Setting NPF Options'
1600 character(len=LENVARNAME),
dimension(3) :: cellavg_method = &
1601 &[character(len=LENVARNAME) ::
'LOGARITHMIC',
'AMT-LMK',
'AMT-HMK']
1604 character(len=LINELENGTH) :: tvk6_filename
1605 character(len=LENMEMPATH) :: tvk6_mempath
1608 call mem_set_value(this%iprflow,
'IPRFLOW', this%input_mempath, found%iprflow)
1609 call mem_set_value(this%ipakcb,
'IPAKCB', this%input_mempath, found%ipakcb)
1610 call mem_set_value(this%icellavg,
'CELLAVG', this%input_mempath, &
1611 cellavg_method, found%cellavg)
1612 call mem_set_value(this%ithickstrt,
'ITHICKSTRT', this%input_mempath, &
1614 call mem_set_value(this%ihighcellsat,
'IHIGHCELLSAT', this%input_mempath, &
1616 call mem_set_value(this%iperched,
'IPERCHED', this%input_mempath, &
1618 call mem_set_value(this%ivarcv,
'IVARCV', this%input_mempath, found%ivarcv)
1619 call mem_set_value(this%idewatcv,
'IDEWATCV', this%input_mempath, &
1621 call mem_set_value(this%ixt3d,
'IXT3D', this%input_mempath, found%ixt3d)
1622 call mem_set_value(this%ixt3drhs,
'IXT3DRHS', this%input_mempath, &
1624 call mem_set_value(this%isavspdis,
'ISAVSPDIS', this%input_mempath, &
1626 call mem_set_value(this%isavsat,
'ISAVSAT', this%input_mempath, found%isavsat)
1627 call mem_set_value(this%ik22overk,
'IK22OVERK', this%input_mempath, &
1629 call mem_set_value(this%ik33overk,
'IK33OVERK', this%input_mempath, &
1631 call mem_set_value(this%inewton,
'INEWTON', this%input_mempath, found%inewton)
1632 call mem_set_value(this%satomega,
'SATOMEGA', this%input_mempath, &
1634 call mem_set_value(this%irewet,
'IREWET', this%input_mempath, found%irewet)
1635 call mem_set_value(this%wetfct,
'WETFCT', this%input_mempath, found%wetfct)
1636 call mem_set_value(this%iwetit,
'IWETIT', this%input_mempath, found%iwetit)
1637 call mem_set_value(this%ihdwet,
'IHDWET', this%input_mempath, found%ihdwet)
1640 if (found%ipakcb) this%ipakcb = -1
1643 if (found%ixt3d .and. found%ixt3drhs) this%ixt3d = 2
1646 if (found%isavspdis) this%icalcspdis = this%isavspdis
1649 if (found%inewton)
then
1656 this%input_mempath, this%input_fname))
then
1657 call mem_setptr(tvk6_mempaths,
'TVK6_MEMPATH', this%input_mempath)
1658 tvk6_mempath = tvk6_mempaths(1)
1660 call tvk_cr(this%tvk, this%name_model, tvk6_mempath, this%intvk, this%iout)
1664 if (found%cellavg)
then
1665 if (this%icellavg == 0)
then
1666 errmsg =
'Unrecognized input value for ALTERNATIVE_CELL_AVERAGING option.'
1673 if (this%iout > 0)
then
1674 call this%log_options(found)
1685 this%ithickstrt = options%ithickstrt
1686 this%ihighcellsat = options%ihighcellsat
1687 this%iperched = options%iperched
1688 this%ivarcv = options%ivarcv
1689 this%idewatcv = options%idewatcv
1690 this%irewet = options%irewet
1691 this%wetfct = options%wetfct
1692 this%iwetit = options%iwetit
1693 this%ihdwet = options%ihdwet
1707 if (this%inewton > 0)
then
1708 this%satomega = dem6
1711 if (this%inewton > 0)
then
1712 if (this%iperched > 0)
then
1713 write (
errmsg,
'(a)')
'ERROR IN NPF OPTIONS. NEWTON OPTION CANNOT '// &
1714 'BE USED WITH PERCHED OPTION.'
1717 if (this%ivarcv > 0)
then
1718 write (
errmsg,
'(a)')
'ERROR IN NPF OPTIONS. NEWTON OPTION CANNOT '// &
1719 'BE USED WITH VARIABLECV OPTION.'
1722 if (this%irewet > 0)
then
1723 write (
errmsg,
'(a)')
'ERROR IN NPF OPTIONS. NEWTON OPTION CANNOT '// &
1724 'BE USED WITH REWET OPTION.'
1728 if (this%ihighcellsat /= 0)
then
1729 write (
warnmsg,
'(a)')
'HIGHEST_CELL_SATURATION '// &
1730 'option cannot be used when NEWTON option in not specified. '// &
1731 'Resetting HIGHEST_CELL_SATURATION option to off.'
1732 this%ihighcellsat = 0
1737 if (this%ixt3d /= 0)
then
1738 if (this%icellavg > 0)
then
1739 write (
errmsg,
'(a)')
'ERROR IN NPF OPTIONS. '// &
1740 'ALTERNATIVE_CELL_AVERAGING OPTION '// &
1741 'CANNOT BE USED WITH XT3D OPTION.'
1744 if (this%ithickstrt > 0)
then
1745 write (
errmsg,
'(a)')
'ERROR IN NPF OPTIONS. THICKSTRT OPTION '// &
1746 'CANNOT BE USED WITH XT3D OPTION.'
1749 if (this%iperched > 0)
then
1750 write (
errmsg,
'(a)')
'ERROR IN NPF OPTIONS. PERCHED OPTION '// &
1751 'CANNOT BE USED WITH XT3D OPTION.'
1754 if (this%ivarcv > 0)
then
1755 write (
errmsg,
'(a)')
'ERROR IN NPF OPTIONS. VARIABLECV OPTION '// &
1756 'CANNOT BE USED WITH XT3D OPTION.'
1776 write (this%iout,
'(1x,a)')
'Setting NPF Griddata'
1778 if (found%icelltype)
then
1779 write (this%iout,
'(4x,a)')
'ICELLTYPE set from input file'
1783 write (this%iout,
'(4x,a)')
'K set from input file'
1787 write (this%iout,
'(4x,a)')
'K33 set from input file'
1789 write (this%iout,
'(4x,a)')
'K33 not provided. Setting K33 = K.'
1793 write (this%iout,
'(4x,a)')
'K22 set from input file'
1795 write (this%iout,
'(4x,a)')
'K22 not provided. Setting K22 = K.'
1798 if (found%wetdry)
then
1799 write (this%iout,
'(4x,a)')
'WETDRY set from input file'
1802 if (found%angle1)
then
1803 write (this%iout,
'(4x,a)')
'ANGLE1 set from input file'
1806 if (found%angle2)
then
1807 write (this%iout,
'(4x,a)')
'ANGLE2 set from input file'
1810 if (found%angle3)
then
1811 write (this%iout,
'(4x,a)')
'ANGLE3 set from input file'
1814 write (this%iout,
'(1x,a,/)')
'End Setting NPF Griddata'
1828 character(len=LINELENGTH) :: errmsg
1830 logical,
dimension(2) :: afound
1831 integer(I4B),
dimension(:),
pointer,
contiguous :: map
1835 if (this%dis%nodes < this%dis%nodesuser) map => this%dis%nodeuser
1838 call mem_set_value(this%icelltype,
'ICELLTYPE', this%input_mempath, map, &
1840 call mem_set_value(this%k11,
'K', this%input_mempath, map, found%k, &
1842 call mem_set_value(this%k33,
'K33', this%input_mempath, map, found%k33)
1843 call mem_set_value(this%k22,
'K22', this%input_mempath, map, found%k22)
1844 call mem_set_value(this%wetdry,
'WETDRY', this%input_mempath, map, &
1846 call mem_set_value(this%angle1,
'ANGLE1', this%input_mempath, map, &
1848 call mem_set_value(this%angle2,
'ANGLE2', this%input_mempath, map, &
1850 call mem_set_value(this%angle3,
'ANGLE3', this%input_mempath, map, &
1854 if (.not. found%icelltype)
then
1855 write (errmsg,
'(a)')
'Error in GRIDDATA block: ICELLTYPE not found.'
1860 if (.not. found%k)
then
1861 write (errmsg,
'(a)')
'Error in GRIDDATA block: K not found.'
1866 if (.not. found%k33 .and. this%ik33overk /= 0)
then
1867 write (errmsg,
'(a)')
'K33OVERK option specified but K33 not specified.'
1872 if (.not. found%k22 .and. this%ik22overk /= 0)
then
1873 write (errmsg,
'(a)')
'K22OVERK option specified but K22 not specified.'
1878 if (found%k33) this%ik33 = 1
1879 if (found%k22) this%ik22 = 1
1880 if (found%wetdry) this%iwetdry = 1
1881 if (found%angle1) this%iangle1 = 1
1882 if (found%angle2) this%iangle2 = 1
1883 if (found%angle3) this%iangle3 = 1
1886 if (.not. found%k33)
then
1887 call mem_set_value(this%k33,
'K', this%input_mempath, map, afound(1), &
1890 if (.not. found%k22)
then
1891 call mem_set_value(this%k22,
'K', this%input_mempath, map, afound(2), &
1894 if (.not. found%wetdry)
call mem_reallocate(this%wetdry, 1,
'WETDRY', &
1895 trim(this%memoryPath))
1896 if (.not. found%angle1 .and. this%ixt3d == 0) &
1897 call mem_reallocate(this%angle1, 0,
'ANGLE1', trim(this%memoryPath))
1898 if (.not. found%angle2 .and. this%ixt3d == 0) &
1899 call mem_reallocate(this%angle2, 0,
'ANGLE2', trim(this%memoryPath))
1900 if (.not. found%angle3 .and. this%ixt3d == 0) &
1901 call mem_reallocate(this%angle3, 0,
'ANGLE3', trim(this%memoryPath))
1907 if (this%iout > 0)
then
1908 call this%log_griddata(found)
1921 character(len=24),
dimension(:),
pointer :: aname
1922 character(len=LINELENGTH) :: cellstr, errmsg
1923 integer(I4B) :: nerr, n
1925 character(len=*),
parameter :: fmtkerr = &
1926 &
"(1x, 'Hydraulic property ',a,' is <= 0 for cell ',a, ' ', 1pg15.6)"
1927 character(len=*),
parameter :: fmtkerr2 = &
1928 &
"(1x, '... ', i0,' additional errors not shown for ',a)"
1935 do n = 1,
size(this%k11)
1936 if (this%k11(n) <= dzero)
then
1938 if (nerr <= 20)
then
1939 call this%dis%noder_to_string(n, cellstr)
1940 write (errmsg, fmtkerr) trim(adjustl(aname(2))), trim(cellstr), &
1947 write (errmsg, fmtkerr2) nerr, trim(adjustl(aname(2)))
1952 if (this%ik33 /= 0)
then
1956 do n = 1,
size(this%k33)
1957 if (this%ik33overk /= 0) this%k33(n) = this%k33(n) * this%k11(n)
1958 if (this%k33(n) <= dzero)
then
1960 if (nerr <= 20)
then
1961 call this%dis%noder_to_string(n, cellstr)
1962 write (errmsg, fmtkerr) trim(adjustl(aname(3))), trim(cellstr), &
1969 write (errmsg, fmtkerr2) nerr, trim(adjustl(aname(3)))
1975 if (this%ik22 /= 0)
then
1978 if (this%dis%con%ianglex == 0)
then
1979 write (errmsg,
'(a)')
'Error. ANGLDEGX not provided in '// &
1980 'discretization file, but K22 was specified. '
1986 do n = 1,
size(this%k22)
1987 if (this%ik22overk /= 0) this%k22(n) = this%k22(n) * this%k11(n)
1988 if (this%k22(n) <= dzero)
then
1990 if (nerr <= 20)
then
1991 call this%dis%noder_to_string(n, cellstr)
1992 write (errmsg, fmtkerr) trim(adjustl(aname(4))), trim(cellstr), &
1999 write (errmsg, fmtkerr2) nerr, trim(adjustl(aname(4)))
2005 if (this%irewet == 1)
then
2006 if (this%iwetdry == 0)
then
2007 write (errmsg,
'(a, a, a)')
'Error in GRIDDATA block: ', &
2008 trim(adjustl(aname(5))),
' not found.'
2014 if (this%iangle1 /= 0)
then
2015 do n = 1,
size(this%angle1)
2016 this%angle1(n) = this%angle1(n) *
dpio180
2019 if (this%ixt3d /= 0)
then
2021 write (this%iout,
'(a)')
'XT3D IN USE, BUT ANGLE1 NOT SPECIFIED. '// &
2022 'SETTING ANGLE1 TO ZERO.'
2023 do n = 1,
size(this%angle1)
2024 this%angle1(n) = dzero
2028 if (this%iangle2 /= 0)
then
2029 if (this%iangle1 == 0)
then
2030 write (errmsg,
'(a)')
'ANGLE2 SPECIFIED BUT NOT ANGLE1. '// &
2031 'ANGLE2 REQUIRES ANGLE1. '
2034 if (this%iangle3 == 0)
then
2035 write (errmsg,
'(a)')
'ANGLE2 SPECIFIED BUT NOT ANGLE3. '// &
2036 'SPECIFY BOTH OR NEITHER ONE. '
2039 do n = 1,
size(this%angle2)
2040 this%angle2(n) = this%angle2(n) *
dpio180
2043 if (this%iangle3 /= 0)
then
2044 if (this%iangle1 == 0)
then
2045 write (errmsg,
'(a)')
'ANGLE3 SPECIFIED BUT NOT ANGLE1. '// &
2046 'ANGLE3 REQUIRES ANGLE1. '
2049 if (this%iangle2 == 0)
then
2050 write (errmsg,
'(a)')
'ANGLE3 SPECIFIED BUT NOT ANGLE2. '// &
2051 'SPECIFY BOTH OR NEITHER ONE. '
2054 do n = 1,
size(this%angle3)
2055 this%angle3(n) = this%angle3(n) *
dpio180
2082 integer(I4B) :: n, m, ii, nn
2083 real(DP) :: hyn, hym
2084 real(DP) :: satn, topn, botn
2085 integer(I4B) :: nextn
2086 real(DP) :: minbot, botm
2088 character(len=LINELENGTH) :: cellstr, errmsg
2090 character(len=*),
parameter :: fmtcnv = &
2092 &' ELIMINATED BECAUSE ALL HYDRAULIC CONDUCTIVITIES TO NODE ARE 0.')"
2093 character(len=*),
parameter :: fmtnct = &
2094 &
"(1X,'Negative cell thickness at cell ', A)"
2095 character(len=*),
parameter :: fmtihbe = &
2096 &
"(1X,'Initial head, bottom elevation:',1P,2G13.5)"
2097 character(len=*),
parameter :: fmttebe = &
2098 &
"(1X,'Top elevation, bottom elevation:',1P,2G13.5)"
2100 do n = 1, this%dis%nodes
2101 this%ithickstartflag(n) = 0
2107 nodeloop:
do n = 1, this%dis%nodes
2110 if (this%ibound(n) == 0)
then
2111 if (this%irewet /= 0)
then
2112 if (this%wetdry(n) == dzero) cycle nodeloop
2119 if (this%k11(n) /= dzero) cycle nodeloop
2123 do ii = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
2124 m = this%dis%con%ja(ii)
2125 if (this%dis%con%ihc(this%dis%con%jas(ii)) == 0)
then
2127 if (this%ik33 /= 0) hyn = this%k33(n)
2128 if (hyn /= dzero)
then
2130 if (this%ik33 /= 0) hym = this%k33(m)
2131 if (hym /= dzero) cycle
2139 this%hnew(n) = this%hnoflo
2140 if (this%irewet /= 0) this%wetdry(n) = dzero
2141 call this%dis%noder_to_string(n, cellstr)
2142 write (this%iout, fmtcnv) trim(adjustl(cellstr))
2147 if (this%inewton == 0)
then
2150 call this%wd(0, this%hnew)
2156 if (this%ivarcv == 1)
then
2157 do n = 1, this%dis%nodes
2158 if (this%hnew(n) < this%dis%bot(n))
then
2159 this%hnew(n) = this%dis%bot(n) + dem6
2167 if (this%ithickstrt == 0)
then
2168 do n = 1, this%dis%nodes
2169 if (this%icelltype(n) < 0)
then
2170 this%icelltype(n) = 1
2180 do n = 1, this%dis%nodes
2181 if (this%ibound(n) == 0)
then
2183 if (this%icelltype(n) < 0 .and. this%ithickstrt /= 0)
then
2184 this%ithickstartflag(n) = 1
2185 this%icelltype(n) = 0
2188 topn = this%dis%top(n)
2189 botn = this%dis%bot(n)
2190 if (this%icelltype(n) < 0 .and. this%ithickstrt /= 0)
then
2191 call this%thksat(n, this%ic%strt(n), satn)
2192 if (botn > this%ic%strt(n))
then
2193 call this%dis%noder_to_string(n, cellstr)
2194 write (errmsg, fmtnct) trim(adjustl(cellstr))
2196 write (errmsg, fmtihbe) this%ic%strt(n), botn
2199 this%ithickstartflag(n) = 1
2200 this%icelltype(n) = 0
2203 if (botn > topn)
then
2204 call this%dis%noder_to_string(n, cellstr)
2205 write (errmsg, fmtnct) trim(adjustl(cellstr))
2207 write (errmsg, fmttebe) topn, botn
2220 if (this%ixt3d == 0)
then
2225 do n = 1, this%dis%nodes
2226 call this%calc_condsat(n, .true.)
2232 if (this%igwfnewtonur /= 0)
then
2234 trim(this%memoryPath))
2235 do n = 1, this%dis%nodes
2237 minbot = this%dis%bot(n)
2240 do while (.not. finished)
2244 do ii = this%dis%con%ia(nn) + 1, this%dis%con%ia(nn + 1) - 1
2247 m = this%dis%con%ja(ii)
2248 botm = this%dis%bot(m)
2251 if (this%dis%con%ihc(this%dis%con%jas(ii)) == 0)
then
2252 if (m > nn .and. botm < minbot)
then
2264 this%ibotnode(n) = nn
2269 this%igwfnewtonur => null()
2280 integer(I4B),
intent(in) :: node
2281 logical,
intent(in) :: upperOnly
2283 integer(I4B) :: ii, m, n, ihc, jj
2284 real(DP) :: topm, topn, topnode, botm, botn, botnode, satm, satn, satnode
2285 real(DP) :: hyn, hym, hn, hm, fawidth, csat
2287 satnode = this%calc_initial_sat(node)
2289 topnode = this%dis%top(node)
2290 botnode = this%dis%bot(node)
2293 do ii = this%dis%con%ia(node) + 1, this%dis%con%ia(node + 1) - 1
2297 m = this%dis%con%ja(ii)
2298 jj = this%dis%con%jas(ii)
2300 if (upperonly) cycle
2307 topn = this%dis%top(n)
2308 botn = this%dis%bot(n)
2309 satn = this%calc_initial_sat(n)
2316 topm = this%dis%top(m)
2317 botm = this%dis%bot(m)
2318 satm = this%calc_initial_sat(m)
2321 ihc = this%dis%con%ihc(jj)
2322 hyn = this%hy_eff(n, m, ihc, ipos=ii)
2323 hym = this%hy_eff(m, n, ihc, ipos=ii)
2324 if (this%ithickstartflag(n) == 0)
then
2327 hn = this%ic%strt(n)
2329 if (this%ithickstartflag(m) == 0)
then
2332 hm = this%ic%strt(m)
2340 csat =
vcond(1, 1, 1, 1, 0, 1, 1,
done, &
2346 this%dis%con%hwva(jj))
2350 fawidth = this%dis%con%hwva(jj)
2351 csat =
hcond(1, 1, 1, 1, 0, &
2355 hn, hm, satn, satm, hyn, hym, &
2358 this%dis%con%cl1(jj), &
2359 this%dis%con%cl2(jj), &
2362 this%condsat(jj) = csat
2376 integer(I4B),
intent(in) :: n
2381 if (this%ibound(n) /= 0 .and. this%ithickstartflag(n) /= 0)
then
2382 call this%thksat(n, this%ic%strt(n), satn)
2395 integer(I4B),
intent(in) :: kiter
2396 real(DP),
intent(inout),
dimension(:) :: hnew
2398 integer(I4B) :: n, m, ii, ihc
2399 real(DP) :: ttop, bbot, thick
2400 integer(I4B) :: ncnvrt, ihdcnv
2401 character(len=30),
dimension(5) :: nodcnvrt
2402 character(len=30) :: nodestr
2403 character(len=3),
dimension(5) :: acnvrt
2404 character(len=LINELENGTH) :: errmsg
2405 integer(I4B) :: irewet
2407 character(len=*),
parameter :: fmtnct = &
2408 "(1X,/1X,'Negative cell thickness at (layer,row,col)', &
2410 character(len=*),
parameter :: fmttopbot = &
2411 &
"(1X,'Top elevation, bottom elevation:',1P,2G13.5)"
2412 character(len=*),
parameter :: fmttopbotthk = &
2413 &
"(1X,'Top elevation, bottom elevation, thickness:',1P,3G13.5)"
2414 character(len=*),
parameter :: fmtdrychd = &
2415 &
"(1X,/1X,'CONSTANT-HEAD CELL WENT DRY -- SIMULATION ABORTED')"
2416 character(len=*),
parameter :: fmtni = &
2417 &
"(1X,'CELLID=',a,' ITERATION=',I0,' TIME STEP=',I0,' STRESS PERIOD=',I0)"
2424 do n = 1, this%dis%nodes
2425 do ii = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
2426 m = this%dis%con%ja(ii)
2427 ihc = this%dis%con%ihc(this%dis%con%jas(ii))
2428 call this%rewet_check(kiter, n, hnew(m), this%ibound(m), ihc, hnew, &
2430 if (irewet == 1)
then
2431 call this%wdmsg(2, ncnvrt, nodcnvrt, acnvrt, ihdcnv, kiter, n)
2437 do n = 1, this%dis%nodes
2440 if (this%ibound(n) == 0) cycle
2441 if (this%icelltype(n) == 0) cycle
2444 bbot = this%dis%bot(n)
2445 ttop = this%dis%top(n)
2446 if (bbot > ttop)
then
2447 write (errmsg, fmtnct) n
2449 write (errmsg, fmttopbot) ttop, bbot
2455 if (this%icelltype(n) /= 0)
then
2456 if (hnew(n) < ttop) ttop = hnew(n)
2461 if (thick <= dzero)
then
2462 call this%wdmsg(1, ncnvrt, nodcnvrt, acnvrt, ihdcnv, kiter, n)
2464 if (this%ibound(n) < 0)
then
2465 errmsg =
'CONSTANT-HEAD CELL WENT DRY -- SIMULATION ABORTED'
2467 write (errmsg, fmttopbotthk) ttop, bbot, thick
2469 call this%dis%noder_to_string(n, nodestr)
2470 write (errmsg, fmtni) trim(adjustl(nodestr)), kiter,
kstp,
kper
2479 call this%wdmsg(0, ncnvrt, nodcnvrt, acnvrt, ihdcnv, kiter, n)
2482 do n = 1, this%dis%nodes
2483 if (this%ibound(n) == 30000) this%ibound(n) = 1
2494 subroutine rewet_check(this, kiter, node, hm, ibdm, ihc, hnew, irewet)
2497 integer(I4B),
intent(in) :: kiter
2498 integer(I4B),
intent(in) :: node
2499 real(DP),
intent(in) :: hm
2500 integer(I4B),
intent(in) :: ibdm
2501 integer(I4B),
intent(in) :: ihc
2502 real(DP),
intent(inout),
dimension(:) :: hnew
2503 integer(I4B),
intent(out) :: irewet
2505 integer(I4B) :: itflg
2506 real(DP) :: wd, awd, turnon, bbot
2511 if (this%irewet > 0)
then
2512 itflg = mod(kiter, this%iwetit)
2513 if (itflg == 0)
then
2514 if (this%ibound(node) == 0 .and. this%wetdry(node) /=
dzero)
then
2517 bbot = this%dis%bot(node)
2518 wd = this%wetdry(node)
2520 if (wd < 0) awd = -wd
2528 if (ibdm > 0 .and. hm >= turnon) irewet = 1
2530 if (wd >
dzero)
then
2533 if (ibdm > 0 .and. hm >= turnon) irewet = 1
2537 if (irewet == 1)
then
2540 if (this%ihdwet == 0)
then
2541 hnew(node) = bbot + this%wetfct * (hm - bbot)
2543 hnew(node) = bbot + this%wetfct * awd
2545 this%ibound(node) = 30000
2560 integer(I4B),
intent(in) :: icode
2561 integer(I4B),
intent(inout) :: ncnvrt
2562 character(len=30),
dimension(5),
intent(inout) :: nodcnvrt
2563 character(len=3),
dimension(5),
intent(inout) :: acnvrt
2564 integer(I4B),
intent(inout) :: ihdcnv
2565 integer(I4B),
intent(in) :: kiter
2566 integer(I4B),
intent(in) :: n
2570 character(len=*),
parameter :: fmtcnvtn = &
2571 "(1X,/1X,'CELL CONVERSIONS FOR ITER.=',I0, &
2572 &' STEP=',I0,' PERIOD=',I0,' (NODE or LRC)')"
2573 character(len=*),
parameter :: fmtnode =
"(1X,3X,5(A4, A20))"
2578 call this%dis%noder_to_string(n, nodcnvrt(ncnvrt))
2579 if (icode == 1)
then
2580 acnvrt(ncnvrt) =
'DRY'
2582 acnvrt(ncnvrt) =
'WET'
2588 if (ncnvrt == 5 .or. (icode == 0 .and. ncnvrt > 0))
then
2589 if (ihdcnv == 0)
write (this%iout, fmtcnvtn) kiter,
kstp,
kper
2591 write (this%iout, fmtnode) &
2592 (acnvrt(l), trim(adjustl(nodcnvrt(l))), l=1, ncnvrt)
2607 function hy_eff(this, n, m, ihc, ipos, vg)
result(hy)
2612 integer(I4B),
intent(in) :: n
2613 integer(I4B),
intent(in) :: m
2614 integer(I4B),
intent(in) :: ihc
2615 integer(I4B),
intent(in),
optional :: ipos
2616 real(dp),
dimension(3),
intent(in),
optional :: vg
2618 integer(I4B) :: iipos
2619 real(dp) :: hy11, hy22, hy33
2620 real(dp) :: ang1, ang2, ang3
2621 real(dp) :: vg1, vg2, vg3
2625 if (
present(ipos)) iipos = ipos
2639 if (this%iangle2 > 0)
then
2640 if (
present(vg))
then
2645 call this%dis%connection_normal(n, m, ihc, vg1, vg2, vg3, iipos)
2647 ang1 = this%angle1(n)
2648 ang2 = this%angle2(n)
2650 if (this%iangle3 > 0) ang3 = this%angle3(n)
2651 hy =
hyeff(hy11, hy22, hy33, ang1, ang2, ang3, vg1, vg2, vg3, &
2659 if (this%ik22 > 0)
then
2660 if (
present(vg))
then
2665 call this%dis%connection_normal(n, m, ihc, vg1, vg2, vg3, iipos)
2670 if (this%iangle1 > 0)
then
2671 ang1 = this%angle1(n)
2672 if (this%iangle2 > 0)
then
2673 ang2 = this%angle2(n)
2674 if (this%iangle3 > 0) ang3 = this%angle3(n)
2677 hy =
hyeff(hy11, hy22, hy33, ang1, ang2, ang3, vg1, vg2, vg3, &
2691 real(DP),
intent(in),
dimension(:) :: flowja
2695 integer(I4B) :: ipos
2696 integer(I4B) :: iedge
2697 integer(I4B) :: isympos
2725 logical :: nozee = .true.
2729 if (this%icalcspdis /= 0 .and. this%dis%con%ianglex == 0)
then
2730 call store_error(
'Error. ANGLDEGX not provided in '// &
2731 'discretization file. ANGLDEGX required for '// &
2732 'calculation of specific discharge.', terminate=.true.)
2735 swa => this%spdis_wa
2736 if (.not. swa%is_created())
then
2738 call this%spdis_wa%create(this%calc_max_conns())
2741 if (this%nedges > 0)
call this%prepare_edge_lookup()
2745 do n = 1, this%dis%nodes
2755 do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
2756 m = this%dis%con%ja(ipos)
2757 isympos = this%dis%con%jas(ipos)
2758 ihc = this%dis%con%ihc(isympos)
2759 area = this%dis%con%hwva(isympos)
2765 call this%dis%connection_vector(n, m, nozee, this%sat(n), this%sat(m), &
2766 ihc, xc, yc, zc, dltot)
2767 cl1 = this%dis%con%cl1(isympos)
2768 cl2 = this%dis%con%cl2(isympos)
2770 cl1 = this%dis%con%cl2(isympos)
2771 cl2 = this%dis%con%cl1(isympos)
2773 ooclsum =
done / (cl1 + cl2)
2774 swa%diz(iz) = dltot * cl1 * ooclsum
2777 swa%viz(iz) = qz / area
2782 dz =
thksatnm(this%ibound(n), this%ibound(m), &
2783 this%icelltype(n), this%icelltype(m), &
2784 this%inewton, ihc, &
2785 this%hnew(n), this%hnew(m), this%sat(n), this%sat(m), &
2786 this%dis%top(n), this%dis%top(m), this%dis%bot(n), &
2789 call this%dis%connection_normal(n, m, ihc, xn, yn, zn, ipos)
2790 call this%dis%connection_vector(n, m, nozee, this%sat(n), this%sat(m), &
2791 ihc, xc, yc, zc, dltot)
2792 cl1 = this%dis%con%cl1(isympos)
2793 cl2 = this%dis%con%cl2(isympos)
2795 cl1 = this%dis%con%cl2(isympos)
2796 cl2 = this%dis%con%cl1(isympos)
2798 ooclsum =
done / (cl1 + cl2)
2801 swa%di(ic) = dltot * cl1 * ooclsum
2802 if (area >
dzero)
then
2803 swa%vi(ic) = flowja(ipos) / area
2811 if (this%nedges > 0)
then
2812 do ipos = this%iedge_ptr(n), this%iedge_ptr(n + 1) - 1
2813 iedge = this%edge_idxs(ipos)
2816 ihc = this%ihcedge(iedge)
2817 area = this%propsedge(2, iedge)
2820 swa%viz(iz) = this%propsedge(1, iedge) / area
2821 swa%diz(iz) = this%propsedge(5, iedge)
2824 swa%nix(ic) = -this%propsedge(3, iedge)
2825 swa%niy(ic) = -this%propsedge(4, iedge)
2826 swa%di(ic) = this%propsedge(5, iedge)
2827 if (area >
dzero)
then
2828 swa%vi(ic) = this%propsedge(1, iedge) / area
2846 dsumz = dsumz + swa%diz(iz)
2848 denom = (ncz -
done)
2850 dsumz = dsumz +
dem10 * dsumz
2852 if (dsumz >
dzero) swa%wiz(iz) =
done - swa%diz(iz) / dsumz
2854 swa%wiz(iz) = swa%wiz(iz) / denom
2862 vz = vz + swa%wiz(iz) * swa%viz(iz)
2871 swa%wix(ic) = swa%di(ic) * abs(swa%nix(ic))
2872 swa%wiy(ic) = swa%di(ic) * abs(swa%niy(ic))
2873 dsumx = dsumx + swa%wix(ic)
2874 dsumy = dsumy + swa%wiy(ic)
2881 dsumx = dsumx +
dem10 * dsumx
2882 dsumy = dsumy +
dem10 * dsumy
2884 swa%wix(ic) = (dsumx - swa%wix(ic)) * abs(swa%nix(ic))
2885 swa%wiy(ic) = (dsumy - swa%wiy(ic)) * abs(swa%niy(ic))
2892 swa%bix(ic) = swa%wix(ic) * sign(
done, swa%nix(ic))
2893 swa%biy(ic) = swa%wiy(ic) * sign(
done, swa%niy(ic))
2894 dsumx = dsumx + swa%wix(ic) * abs(swa%nix(ic))
2895 dsumy = dsumy + swa%wiy(ic) * abs(swa%niy(ic))
2902 swa%bix(ic) = swa%bix(ic) * dsumx
2903 swa%biy(ic) = swa%biy(ic) * dsumy
2904 axy = axy + swa%bix(ic) * swa%niy(ic)
2905 ayx = ayx + swa%biy(ic) * swa%nix(ic)
2918 vx = vx + (swa%bix(ic) - axy * swa%biy(ic)) * swa%vi(ic)
2919 vy = vy + (swa%biy(ic) - ayx * swa%bix(ic)) * swa%vi(ic)
2921 denom =
done - axy * ayx
2922 if (denom /=
dzero)
then
2927 this%spdis(1, n) = vx
2928 this%spdis(2, n) = vy
2929 this%spdis(3, n) = vz
2940 integer(I4B),
intent(in) :: ibinun
2942 character(len=16) :: text
2943 character(len=16),
dimension(3) :: auxtxt
2945 integer(I4B) :: naux
2948 text =
' DATA-SPDIS'
2950 auxtxt(:) = [
' qx',
' qy',
' qz']
2951 call this%dis%record_srcdst_list_header(text, this%name_model, &
2952 this%packName, this%name_model, &
2953 this%packName, naux, auxtxt, ibinun, &
2954 this%dis%nodes, this%iout)
2957 do n = 1, this%dis%nodes
2958 call this%dis%record_mf6_list_entry(ibinun, n, n,
dzero, naux, &
2968 integer(I4B),
intent(in) :: ibinun
2970 character(len=16) :: text
2971 character(len=16),
dimension(1) :: auxtxt
2972 real(DP),
dimension(1) :: a
2974 integer(I4B) :: naux
2979 auxtxt(:) = [
' sat']
2980 call this%dis%record_srcdst_list_header(text, this%name_model, &
2981 this%packName, this%name_model, &
2982 this%packName, naux, auxtxt, ibinun, &
2983 this%dis%nodes, this%iout)
2986 do n = 1, this%dis%nodes
2988 call this%dis%record_mf6_list_entry(ibinun, n, n,
dzero, naux, a)
3000 integer(I4B),
intent(in) :: nedges
3002 this%nedges = this%nedges + nedges
3009 integer(I4B) :: max_conns
3011 integer(I4B) :: n, m, ic
3014 do n = 1, this%dis%nodes
3017 ic = this%dis%con%ia(n + 1) - this%dis%con%ia(n) - 1
3020 do m = 1, this%nedges
3021 if (this%nodedge(m) == n)
then
3027 if (ic > max_conns) max_conns = ic
3038 integer(I4B),
intent(in) :: nodedge
3039 integer(I4B),
intent(in) :: ihcedge
3040 real(DP),
intent(in) :: q
3041 real(DP),
intent(in) :: area
3042 real(DP),
intent(in) :: nx
3043 real(DP),
intent(in) :: ny
3044 real(DP),
intent(in) :: distance
3046 integer(I4B) :: lastedge
3048 this%lastedge = this%lastedge + 1
3049 lastedge = this%lastedge
3050 this%nodedge(lastedge) = nodedge
3051 this%ihcedge(lastedge) = ihcedge
3052 this%propsedge(1, lastedge) = q
3053 this%propsedge(2, lastedge) = area
3054 this%propsedge(3, lastedge) = nx
3055 this%propsedge(4, lastedge) = ny
3056 this%propsedge(5, lastedge) = distance
3060 if (this%lastedge == this%nedges) this%lastedge = 0
3066 integer(I4B) :: i, inode, iedge
3067 integer(I4B) :: n, start, end
3068 integer(I4B) :: prev_cnt, strt_idx, ipos
3070 do i = 1,
size(this%iedge_ptr)
3071 this%iedge_ptr(i) = 0
3073 do i = 1,
size(this%edge_idxs)
3074 this%edge_idxs(i) = 0
3078 do iedge = 1, this%nedges
3079 n = this%nodedge(iedge)
3080 this%iedge_ptr(n) = this%iedge_ptr(n) + 1
3084 prev_cnt = this%iedge_ptr(1)
3085 this%iedge_ptr(1) = 1
3086 do inode = 2, this%dis%nodes + 1
3087 strt_idx = this%iedge_ptr(inode - 1) + prev_cnt
3088 prev_cnt = this%iedge_ptr(inode)
3089 this%iedge_ptr(inode) = strt_idx
3093 do iedge = 1, this%nedges
3094 n = this%nodedge(iedge)
3095 start = this%iedge_ptr(n)
3096 end = this%iedge_ptr(n + 1) - 1
3097 do ipos = start,
end
3098 if (this%edge_idxs(ipos) > 0) cycle
3099 this%edge_idxs(ipos) = iedge
3115 real(dp) :: satthickness
3117 satthickness = thksatnm(this%ibound(n), &
3119 this%icelltype(n), &
3120 this%icelltype(m), &
3135 class(gwfnpfformulationtype),
pointer :: npf_form
3136 integer(I4B) :: form_id
3138 this%flow_formulations(form_id)%form => npf_form
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
@ c3d_vertical
vertical connection
real(dp), parameter dhdry
real dry cell constant
real(dp), parameter dp9
real constant 9/10
real(dp), parameter dem10
real constant 1e-10
real(dp), parameter dem7
real constant 1e-7
real(dp), parameter dem8
real constant 1e-8
integer(i4b), parameter lenbigline
maximum length of a big line
real(dp), parameter dhnoflo
real no flow constant
integer(i4b), parameter lenvarname
maximum length of a variable name
real(dp), parameter dhalf
real constant 1/2
real(dp), parameter dpio180
real constant
real(dp), parameter dem6
real constant 1e-6
real(dp), parameter dzero
real constant zero
real(dp), parameter dem9
real constant 1e-9
real(dp), parameter dem2
real constant 1e-2
real(dp), parameter dtwo
real constant 2
integer(i4b), parameter lenmempath
maximum length of the memory path
real(dp), parameter done
real constant 1
This module contains stateless conductance functions.
real(dp) function, public thksatnm(ibdn, ibdm, ictn, ictm, iupstream, ihc, hn, hm, satn, satm, topn, topm, botn, botm)
Calculate wetted cell thickness at interface between two cells.
real(dp) function, public condmean(k1, k2, thick1, thick2, cl1, cl2, width, iavgmeth)
Calculate the conductance between two cells.
real(dp) function, public hcond(ibdn, ibdm, ictn, ictm, iupstream, ihc, icellavg, condsat, hn, hm, satn, satm, hkn, hkm, topn, topm, botn, botm, cln, clm, fawidth)
Horizontal conductance between two cells.
@, public ccond_hmean
Harmonic mean.
real(dp) function, public vcond(ibdn, ibdm, ictn, ictm, inewton, ivarcv, idewatcv, condsat, hn, hm, vkn, vkm, satn, satm, topn, topm, botn, botm, flowarea)
Vertical conductance between two cells.
subroutine set_options(this, options)
Set options in the NPF object.
subroutine npf_save_model_flows(this, flowja, icbcfl, icbcun)
Record flowja and calculate specific discharge if requested.
subroutine source_options(this)
Update simulation options from input mempath.
real(dp) function calc_initial_sat(this, n)
Calculate initial saturation for the given node.
subroutine calc_condsat(this, node, upperOnly)
Calculate CONDSAT array entries for the given node.
subroutine rewet_check(this, kiter, node, hm, ibdm, ihc, hnew, irewet)
Determine if a cell should rewet.
integer(i4b) function calc_max_conns(this)
Calculate the maximum number of connections for any cell.
subroutine npf_mc(this, moffset, matrix_sln)
Map connections and construct iax, jax, and idxglox.
subroutine npf_fc(this, kiter, matrix_sln, idxglo, rhs, hnew)
Formulate coefficients.
subroutine npf_ac(this, moffset, sparse)
Add connections for extended neighbors to the sparse matrix.
subroutine sgwf_npf_wetdry(this, kiter, hnew)
Perform wetting and drying.
subroutine source_griddata(this)
Update simulation griddata from input mempath.
subroutine default_flow_fc(this, kiter, matrix_sln, idxglo, rhs, hnew)
Fill coefficients for the default conductance formulation.
subroutine npf_nur(this, neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
Under-relaxation.
subroutine add_flow_formulation(this, npf_form, form_id)
subroutine sav_spdis(this, ibinun)
Save specific discharge in binary format to ibinun.
subroutine sgwf_npf_thksat(this, n, hn, thksat)
Fractional cell saturation.
subroutine preprocess_input(this)
preprocess the NPF input data
subroutine set_edge_properties(this, nodedge, ihcedge, q, area, nx, ny, distance)
Provide the npf package with edge properties.
subroutine prepare_edge_lookup(this)
subroutine npf_da(this)
Deallocate variables.
subroutine log_griddata(this, found)
Write dimensions to list file.
real(dp) function hy_eff(this, n, m, ihc, ipos, vg)
Calculate the effective hydraulic conductivity for the n-m connection.
subroutine calc_spdis(this, flowja)
Calculate the 3 components of specific discharge at the cell center.
subroutine, public npf_cr(npfobj, name_model, input_mempath, inunit, iout)
Create a new NPF object. Pass a inunit value of 0 if npf data will initialized from memory.
subroutine increase_edge_count(this, nedges)
Reserve space for nedges cells that have an edge on them.
subroutine npf_fn(this, kiter, matrix_sln, idxglo, rhs, hnew)
Fill newton terms.
subroutine log_options(this, found)
Log npf options sourced from the input mempath.
subroutine npf_print_model_flows(this, ibudfl, flowja)
Print budget.
subroutine allocate_arrays(this, ncells, njas)
Allocate npf arrays.
subroutine sav_sat(this, ibinun)
Save saturation in binary format to ibinun.
subroutine prepcheck(this)
Initialize and check NPF data.
subroutine npf_df(this, dis, xt3d, ingnc, invsc, npf_options)
Define the NPF package instance.
subroutine highest_cell_saturation(this, n, m, hn, hm, satn, satm)
Calculate dry cell saturation.
subroutine cq_default_flow(this, n, m, ipos, flowja, hnew)
subroutine npf_ad(this, nodes, hold, hnew, irestore)
Advance.
subroutine sgwf_npf_wdmsg(this, icode, ncnvrt, nodcnvrt, acnvrt, ihdcnv, kiter, n)
Print wet/dry message.
subroutine sgwf_npf_qcalc(this, n, m, hn, hm, icon, qnm)
Flow between two cells.
subroutine npf_rp(this)
Read and prepare method for package.
real(dp) function calcsatthickness(this, n, m, ihc)
Calculate saturated thickness between cell n and m.
subroutine store_original_k_arrays(this, ncells, njas)
@ brief Store backup copy of hydraulic conductivity when the VSC package is activate
subroutine fc_default_flow(this, n, m, ipos, matrix_sln, rhs, idxglo, hnew)
Calculate and add coefficients using the.
subroutine allocate_scalars(this)
@ brief Allocate scalars
subroutine npf_cq(this, hnew, flowja)
Calculate flowja.
subroutine fn_default_flow(this, n, m, ipos, matrix_sln, rhs, idxglo, hnew)
subroutine npf_ar(this, ic, vsc, ibound, hnew)
Allocate and read this NPF instance.
subroutine default_flow_cf(this, kiter)
Calculate coefficients for the default conductance formulation.
subroutine check_options(this)
Check for conflicting NPF options.
subroutine cf_default_flow(this, kiter, n)
Calculate coefficients using the.
subroutine npf_cf(this, kiter, nodes, hnew)
Calculate coefficients.
subroutine default_flow_fn(this, kiter, matrix_sln, idxglo, rhs, hnew)
Fill newton terms for the default conductance formulation.
subroutine default_flow_cq(this, hnew, flowja)
Calculate flows for the default conductance formulation.
General-purpose hydrogeologic functions.
real(dp) function, public hyeff(k11, k22, k33, ang1, ang2, ang3, vg1, vg2, vg3, iavgmeth)
Calculate the effective horizontal hydraulic conductivity from an ellipse using a specified direction...
This module defines variable data types.
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
subroutine, public memorystore_remove(component, subcomponent, context)
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 base numerical package type.
This module contains simulation methods.
subroutine, public store_warning(msg, substring)
Store warning message.
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.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
character(len=linelength) idm_context
character(len=maxcharlen) warnmsg
warning message string
real(dp) function squadraticsaturation(top, bot, x, eps)
@ brief sQuadraticSaturation
real(dp) function squadraticsaturationderivative(top, bot, x, eps)
@ brief Derivative of the quadratic saturation function
This module contains the SourceCommonModule.
logical(lgp) function, public filein_fname(filename, tagname, input_mempath, input_fname)
enforce and set a single input filename provided via FILEIN keyword
integer(i4b), pointer, public kstp
current time step number
integer(i4b), pointer, public kper
current stress period number
This module contains time-varying conductivity package methods.
subroutine, public tvk_cr(tvk, name_model, mempath, inunit, iout)
Create a new TvkType object.
subroutine, public xt3d_cr(xt3dobj, name_model, inunit, iout, ldispopt)
Create a new xt3d object.
This class is used to store a single deferred-length character string. It was designed to work in an ...
Unstructured grid discretization.
Data structure and helper methods for passing NPF options into npf_df, as an alternative to reading t...
Helper class with work arrays for the SPDIS calculation in NPF.