39 integer(I4B),
pointer :: iname => null()
40 character(len=24),
dimension(:),
pointer :: aname => null()
41 integer(I4B),
dimension(:),
pointer,
contiguous :: ibound => null()
42 real(dp),
dimension(:),
pointer,
contiguous :: hnew => null()
43 integer(I4B),
pointer :: ixt3d => null()
44 integer(I4B),
pointer :: ixt3drhs => null()
45 integer(I4B),
pointer :: iperched => null()
46 integer(I4B),
pointer :: ivarcv => null()
47 integer(I4B),
pointer :: idewatcv => null()
48 integer(I4B),
pointer :: ithickstrt => null()
49 integer(I4B),
pointer :: igwfnewtonur => null()
50 integer(I4B),
pointer :: icalcspdis => null()
51 integer(I4B),
pointer :: isavspdis => null()
52 integer(I4B),
pointer :: isavsat => null()
53 real(dp),
pointer :: hnoflo => null()
54 real(dp),
pointer :: satomega => null()
55 integer(I4B),
pointer :: irewet => null()
56 integer(I4B),
pointer :: iwetit => null()
57 integer(I4B),
pointer :: ihdwet => null()
58 integer(I4B),
pointer :: icellavg => null()
59 real(dp),
pointer :: wetfct => null()
60 real(dp),
pointer :: hdry => null()
61 integer(I4B),
dimension(:),
pointer,
contiguous :: icelltype => null()
62 integer(I4B),
dimension(:),
pointer,
contiguous :: ithickstartflag => null()
65 real(dp),
dimension(:),
pointer,
contiguous :: k11 => null()
66 real(dp),
dimension(:),
pointer,
contiguous :: k22 => null()
67 real(dp),
dimension(:),
pointer,
contiguous :: k33 => null()
68 real(dp),
dimension(:),
pointer,
contiguous :: k11input => null()
69 real(dp),
dimension(:),
pointer,
contiguous :: k22input => null()
70 real(dp),
dimension(:),
pointer,
contiguous :: k33input => null()
71 integer(I4B),
pointer :: iavgkeff => null()
72 integer(I4B),
pointer :: ik22 => null()
73 integer(I4B),
pointer :: ik33 => null()
74 integer(I4B),
pointer :: ik22overk => null()
75 integer(I4B),
pointer :: ik33overk => null()
76 integer(I4B),
pointer :: iangle1 => null()
77 integer(I4B),
pointer :: iangle2 => null()
78 integer(I4B),
pointer :: iangle3 => null()
79 real(dp),
dimension(:),
pointer,
contiguous :: angle1 => null()
80 real(dp),
dimension(:),
pointer,
contiguous :: angle2 => null()
81 real(dp),
dimension(:),
pointer,
contiguous :: angle3 => null()
83 integer(I4B),
pointer :: iwetdry => null()
84 real(dp),
dimension(:),
pointer,
contiguous :: wetdry => null()
85 real(dp),
dimension(:),
pointer,
contiguous :: sat => null()
86 real(dp),
dimension(:),
pointer,
contiguous :: condsat => null()
87 integer(I4B),
dimension(:),
pointer,
contiguous :: ibotnode => null()
89 real(dp),
dimension(:, :),
pointer,
contiguous :: spdis => null()
90 integer(I4B),
pointer :: nedges => null()
91 integer(I4B),
pointer :: lastedge => null()
92 integer(I4B),
dimension(:),
pointer,
contiguous :: nodedge => null()
93 integer(I4B),
dimension(:),
pointer,
contiguous :: ihcedge => null()
94 real(dp),
dimension(:, :),
pointer,
contiguous :: propsedge => null()
96 integer(I4B),
pointer :: intvk => null()
97 integer(I4B),
pointer :: invsc => null()
99 integer(I4B),
pointer :: kchangeper => null()
100 integer(I4B),
pointer :: kchangestp => null()
101 integer(I4B),
dimension(:),
pointer,
contiguous :: nodekchange => null()
152 subroutine npf_cr(npfobj, name_model, input_mempath, inunit, iout)
158 character(len=*),
intent(in) :: name_model
159 character(len=*),
intent(in) :: input_mempath
160 integer(I4B),
intent(in) :: inunit
161 integer(I4B),
intent(in) :: iout
163 character(len=*),
parameter :: fmtheader = &
164 "(1x, /1x, 'NPF -- NODE PROPERTY FLOW PACKAGE, VERSION 1, 3/30/2015', &
165 &' INPUT READ FROM MEMPATH: ', A, /)"
171 call npfobj%set_names(1, name_model,
'NPF',
'NPF', input_mempath)
174 call npfobj%allocate_scalars()
177 npfobj%inunit = inunit
184 write (iout, fmtheader) input_mempath
195 subroutine npf_df(this, dis, xt3d, ingnc, invsc, npf_options)
203 integer(I4B),
intent(in) :: ingnc
204 integer(I4B),
intent(in) :: invsc
211 if (invsc > 0) this%invsc = invsc
213 if (.not.
present(npf_options))
then
216 call this%source_options()
219 call this%allocate_arrays(this%dis%nodes, this%dis%njas)
222 call this%source_griddata()
223 call this%prepcheck()
225 call this%set_options(npf_options)
228 call this%allocate_arrays(this%dis%nodes, this%dis%njas)
231 call this%check_options()
235 if (this%ixt3d /= 0) xt3d%ixt3d = this%ixt3d
236 call this%xt3d%xt3d_df(dis)
239 if (this%ixt3d /= 0 .and. ingnc > 0)
then
240 call store_error(
'Error in model '//trim(this%name_model)// &
241 '. The XT3D option cannot be used with the GNC &
242 &Package.', terminate=.true.)
253 integer(I4B),
intent(in) :: moffset
257 if (this%ixt3d /= 0)
call this%xt3d%xt3d_ac(moffset, sparse)
262 subroutine npf_mc(this, moffset, matrix_sln)
265 integer(I4B),
intent(in) :: moffset
268 if (this%ixt3d /= 0)
call this%xt3d%xt3d_mc(moffset, matrix_sln)
276 subroutine npf_ar(this, ic, vsc, ibound, hnew)
281 type(
gwfictype),
pointer,
intent(in) :: ic
283 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(inout) :: ibound
284 real(DP),
dimension(:),
pointer,
contiguous,
intent(inout) :: hnew
290 this%ibound => ibound
293 if (this%icalcspdis == 1)
then
294 call mem_reallocate(this%spdis, 3, this%dis%nodes,
'SPDIS', this%memoryPath)
295 call mem_reallocate(this%nodedge, this%nedges,
'NODEDGE', this%memoryPath)
296 call mem_reallocate(this%ihcedge, this%nedges,
'IHCEDGE', this%memoryPath)
297 call mem_reallocate(this%propsedge, 5, this%nedges,
'PROPSEDGE', &
299 do n = 1, this%dis%nodes
300 this%spdis(:, n) =
dzero
305 if (this%invsc /= 0)
then
310 if (this%invsc > 0)
then
322 call this%store_original_k_arrays(this%dis%nodes, this%dis%njas)
326 call this%preprocess_input()
329 if (this%ixt3d /= 0)
then
330 call this%xt3d%xt3d_ar(ibound, this%k11, this%ik33, this%k33, &
331 this%sat, this%ik22, this%k22, &
332 this%iangle1, this%iangle2, this%iangle3, &
333 this%angle1, this%angle2, this%angle3, &
334 this%inewton, this%icelltype)
338 if (this%intvk /= 0)
then
339 call this%tvk%ar(this%dis)
353 if (this%intvk /= 0)
then
362 subroutine npf_ad(this, nodes, hold, hnew, irestore)
369 integer(I4B),
intent(in) :: nodes
370 real(DP),
dimension(nodes),
intent(inout) :: hold
371 real(DP),
dimension(nodes),
intent(inout) :: hnew
372 integer(I4B),
intent(in) :: irestore
377 if (this%irewet > 0)
then
378 do n = 1, this%dis%nodes
379 if (this%wetdry(n) ==
dzero) cycle
380 if (this%ibound(n) /= 0) cycle
381 hold(n) = this%dis%bot(n)
385 do n = 1, this%dis%nodes
386 if (this%wetdry(n) ==
dzero) cycle
387 if (this%ibound(n) /= 0) cycle
393 if (this%intvk /= 0)
then
399 if (this%invsc /= 0)
then
400 call this%vsc%update_k_with_vsc()
404 if (this%kchangeper ==
kper .and. this%kchangestp ==
kstp)
then
405 if (this%ixt3d == 0)
then
409 do n = 1, this%dis%nodes
410 if (this%nodekchange(n) == 1)
then
411 call this%calc_condsat(n, .false.)
417 if (this%xt3d%lamatsaved .and. .not. this%xt3d%ldispersion)
then
418 call this%xt3d%xt3d_fcpc(this%dis%nodes, .true.)
426 subroutine npf_cf(this, kiter, nodes, hnew)
429 integer(I4B) :: kiter
430 integer(I4B),
intent(in) :: nodes
431 real(DP),
intent(inout),
dimension(nodes) :: hnew
437 if (this%inewton /= 1)
then
438 call this%wd(kiter, hnew)
442 do n = 1, this%dis%nodes
443 if (this%icelltype(n) /= 0)
then
444 if (this%ibound(n) == 0)
then
447 call this%thksat(n, hnew(n), satn)
456 subroutine npf_fc(this, kiter, matrix_sln, idxglo, rhs, hnew)
461 integer(I4B) :: kiter
463 integer(I4B),
intent(in),
dimension(:) :: idxglo
464 real(DP),
intent(inout),
dimension(:) :: rhs
465 real(DP),
intent(inout),
dimension(:) :: hnew
467 integer(I4B) :: n, m, ii, idiag, ihc
468 integer(I4B) :: isymcon, idiagm
474 if (this%ixt3d /= 0)
then
475 call this%xt3d%xt3d_fc(kiter, matrix_sln, idxglo, rhs, hnew)
477 do n = 1, this%dis%nodes
478 do ii = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
479 if (this%dis%con%mask(ii) == 0) cycle
481 m = this%dis%con%ja(ii)
486 ihc = this%dis%con%ihc(this%dis%con%jas(ii))
487 hyn = this%hy_eff(n, m, ihc, ipos=ii)
488 hym = this%hy_eff(m, n, ihc, ipos=ii)
491 if (ihc == c3d_vertical)
then
494 cond =
vcond(this%ibound(n), this%ibound(m), &
495 this%icelltype(n), this%icelltype(m), this%inewton, &
496 this%ivarcv, this%idewatcv, &
497 this%condsat(this%dis%con%jas(ii)), hnew(n), hnew(m), &
499 this%sat(n), this%sat(m), &
500 this%dis%top(n), this%dis%top(m), &
501 this%dis%bot(n), this%dis%bot(m), &
502 this%dis%con%hwva(this%dis%con%jas(ii)))
505 if (this%iperched /= 0)
then
506 if (this%icelltype(m) /= 0)
then
507 if (hnew(m) < this%dis%top(m))
then
510 idiag = this%dis%con%ia(n)
511 rhs(n) = rhs(n) - cond * this%dis%bot(n)
512 call matrix_sln%add_value_pos(idxglo(idiag), -cond)
515 isymcon = this%dis%con%isym(ii)
516 call matrix_sln%add_value_pos(idxglo(isymcon), cond)
517 rhs(m) = rhs(m) + cond * this%dis%bot(n)
528 cond =
hcond(this%ibound(n), this%ibound(m), &
529 this%icelltype(n), this%icelltype(m), &
531 this%dis%con%ihc(this%dis%con%jas(ii)), &
533 this%condsat(this%dis%con%jas(ii)), &
534 hnew(n), hnew(m), this%sat(n), this%sat(m), hyn, hym, &
535 this%dis%top(n), this%dis%top(m), &
536 this%dis%bot(n), this%dis%bot(m), &
537 this%dis%con%cl1(this%dis%con%jas(ii)), &
538 this%dis%con%cl2(this%dis%con%jas(ii)), &
539 this%dis%con%hwva(this%dis%con%jas(ii)))
543 idiag = this%dis%con%ia(n)
544 call matrix_sln%add_value_pos(idxglo(ii), cond)
545 call matrix_sln%add_value_pos(idxglo(idiag), -cond)
548 isymcon = this%dis%con%isym(ii)
549 idiagm = this%dis%con%ia(m)
550 call matrix_sln%add_value_pos(idxglo(isymcon), cond)
551 call matrix_sln%add_value_pos(idxglo(idiagm), -cond)
560 subroutine npf_fn(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) :: nodes, nja
570 integer(I4B) :: n, m, ii, idiag
571 integer(I4B) :: isymcon, idiagm
576 real(DP) :: filledterm
584 nodes = this%dis%nodes
585 nja = this%dis%con%nja
586 if (this%ixt3d /= 0)
then
587 call this%xt3d%xt3d_fn(kiter, nodes, nja, matrix_sln, idxglo, rhs, hnew)
591 idiag = this%dis%con%ia(n)
592 do ii = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
593 if (this%dis%con%mask(ii) == 0) cycle
595 m = this%dis%con%ja(ii)
596 isymcon = this%dis%con%isym(ii)
599 if (this%dis%con%ihc(this%dis%con%jas(ii)) == 0 .and. &
600 this%ivarcv == 0)
then
606 if (hnew(m) < hnew(n)) iups = n
608 if (iups == n) idn = m
611 if (this%icelltype(iups) == 0) cycle
615 topup = this%dis%top(iups)
616 botup = this%dis%bot(iups)
617 if (this%dis%con%ihc(this%dis%con%jas(ii)) == 2)
then
618 topup = min(this%dis%top(n), this%dis%top(m))
619 botup = max(this%dis%bot(n), this%dis%bot(m))
623 cond = this%condsat(this%dis%con%jas(ii))
626 consterm = -cond * (hnew(iups) - hnew(idn))
628 filledterm = matrix_sln%get_value_pos(idxglo(ii))
631 idiagm = this%dis%con%ia(m)
636 term = consterm * derv
637 rhs(n) = rhs(n) + term * hnew(n)
638 rhs(m) = rhs(m) - term * hnew(n)
640 call matrix_sln%add_value_pos(idxglo(idiag), term)
642 if (this%ibound(n) > 0)
then
643 filledterm = matrix_sln%get_value_pos(idxglo(ii))
644 call matrix_sln%set_value_pos(idxglo(ii), filledterm)
647 filledterm = matrix_sln%get_value_pos(idxglo(idiagm))
648 call matrix_sln%set_value_pos(idxglo(idiagm), filledterm)
650 if (this%ibound(m) > 0)
then
651 call matrix_sln%add_value_pos(idxglo(isymcon), -term)
656 term = -consterm * derv
657 rhs(n) = rhs(n) + term * hnew(m)
658 rhs(m) = rhs(m) - term * hnew(m)
660 filledterm = matrix_sln%get_value_pos(idxglo(idiag))
661 call matrix_sln%set_value_pos(idxglo(idiag), filledterm)
663 if (this%ibound(n) > 0)
then
664 call matrix_sln%add_value_pos(idxglo(ii), term)
667 call matrix_sln%add_value_pos(idxglo(idiagm), -term)
669 if (this%ibound(m) > 0)
then
670 filledterm = matrix_sln%get_value_pos(idxglo(isymcon))
671 call matrix_sln%set_value_pos(idxglo(isymcon), filledterm)
687 subroutine npf_nur(this, neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
690 integer(I4B),
intent(in) :: neqmod
691 real(DP),
dimension(neqmod),
intent(inout) :: x
692 real(DP),
dimension(neqmod),
intent(in) :: xtemp
693 real(DP),
dimension(neqmod),
intent(inout) :: dx
694 integer(I4B),
intent(inout) :: inewtonur
695 real(DP),
intent(inout) :: dxmax
696 integer(I4B),
intent(inout) :: locmax
704 do n = 1, this%dis%nodes
705 if (this%ibound(n) < 1) cycle
706 if (this%icelltype(n) > 0)
then
707 botm = this%dis%bot(this%ibotnode(n))
710 if (x(n) < botm)
then
714 if (abs(dxx) > abs(dxmax))
then
730 real(DP),
intent(inout),
dimension(:) :: hnew
731 real(DP),
intent(inout),
dimension(:) :: flowja
733 integer(I4B) :: n, ipos, m
738 if (this%ixt3d /= 0)
then
739 call this%xt3d%xt3d_flowja(hnew, flowja)
742 do n = 1, this%dis%nodes
743 do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
744 m = this%dis%con%ja(ipos)
746 call this%qcalc(n, m, hnew(n), hnew(m), ipos, qnm)
748 flowja(this%dis%con%isym(ipos)) = -qnm
760 integer(I4B),
intent(in) :: n
761 real(DP),
intent(in) :: hn
762 real(DP),
intent(inout) :: thksat
765 if (hn >= this%dis%top(n))
then
768 thksat = (hn - this%dis%bot(n)) / (this%dis%top(n) - this%dis%bot(n))
772 if (this%inewton /= 0)
then
783 integer(I4B),
intent(in) :: n
784 integer(I4B),
intent(in) :: m
785 real(DP),
intent(in) :: hn
786 real(DP),
intent(in) :: hm
787 integer(I4B),
intent(in) :: icon
788 real(DP),
intent(inout) :: qnm
792 real(DP) :: hntemp, hmtemp
796 ihc = this%dis%con%ihc(this%dis%con%jas(icon))
797 hyn = this%hy_eff(n, m, ihc, ipos=icon)
798 hym = this%hy_eff(m, n, ihc, ipos=icon)
802 condnm =
vcond(this%ibound(n), this%ibound(m), &
803 this%icelltype(n), this%icelltype(m), this%inewton, &
804 this%ivarcv, this%idewatcv, &
805 this%condsat(this%dis%con%jas(icon)), hn, hm, &
807 this%sat(n), this%sat(m), &
808 this%dis%top(n), this%dis%top(m), &
809 this%dis%bot(n), this%dis%bot(m), &
810 this%dis%con%hwva(this%dis%con%jas(icon)))
812 condnm =
hcond(this%ibound(n), this%ibound(m), &
813 this%icelltype(n), this%icelltype(m), &
815 this%dis%con%ihc(this%dis%con%jas(icon)), &
817 this%condsat(this%dis%con%jas(icon)), &
818 hn, hm, this%sat(n), this%sat(m), hyn, hym, &
819 this%dis%top(n), this%dis%top(m), &
820 this%dis%bot(n), this%dis%bot(m), &
821 this%dis%con%cl1(this%dis%con%jas(icon)), &
822 this%dis%con%cl2(this%dis%con%jas(icon)), &
823 this%dis%con%hwva(this%dis%con%jas(icon)))
831 if (this%iperched /= 0)
then
832 if (this%dis%con%ihc(this%dis%con%jas(icon)) == 0)
then
834 if (this%icelltype(n) /= 0)
then
835 if (hn < this%dis%top(n)) hntemp = this%dis%bot(m)
838 if (this%icelltype(m) /= 0)
then
839 if (hm < this%dis%top(m)) hmtemp = this%dis%bot(n)
846 qnm = condnm * (hmtemp - hntemp)
854 real(DP),
dimension(:),
intent(in) :: flowja
855 integer(I4B),
intent(in) :: icbcfl
856 integer(I4B),
intent(in) :: icbcun
858 integer(I4B) :: ibinun
861 if (this%ipakcb < 0)
then
863 elseif (this%ipakcb == 0)
then
868 if (icbcfl == 0) ibinun = 0
871 if (ibinun /= 0)
then
872 call this%dis%record_connection_array(flowja, ibinun, this%iout)
876 if (this%isavspdis /= 0)
then
877 if (ibinun /= 0)
call this%sav_spdis(ibinun)
881 if (this%isavsat /= 0)
then
882 if (ibinun /= 0)
call this%sav_sat(ibinun)
894 integer(I4B),
intent(in) :: ibudfl
895 real(DP),
intent(inout),
dimension(:) :: flowja
897 character(len=LENBIGLINE) :: line
898 character(len=30) :: tempstr
899 integer(I4B) :: n, ipos, m
902 character(len=*),
parameter :: fmtiprflow = &
903 &
"(/,4x,'CALCULATED INTERCELL FLOW FOR PERIOD ', i0, ' STEP ', i0)"
906 if (ibudfl /= 0 .and. this%iprflow > 0)
then
907 write (this%iout, fmtiprflow)
kper,
kstp
908 do n = 1, this%dis%nodes
910 call this%dis%noder_to_string(n, tempstr)
911 line = trim(tempstr)//
':'
912 do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
913 m = this%dis%con%ja(ipos)
914 call this%dis%noder_to_string(m, tempstr)
915 line = trim(line)//
' '//trim(tempstr)
917 write (tempstr,
'(1pg15.6)') qnm
918 line = trim(line)//
' '//trim(adjustl(tempstr))
920 write (this%iout,
'(a)') trim(line)
938 if (this%intvk /= 0)
then
940 deallocate (this%tvk)
944 if (this%invsc /= 0)
then
987 deallocate (this%aname)
1009 call this%NumericalPackageType%da()
1028 call this%NumericalPackageType%allocate_scalars()
1031 call mem_allocate(this%iname,
'INAME', this%memoryPath)
1032 call mem_allocate(this%ixt3d,
'IXT3D', this%memoryPath)
1033 call mem_allocate(this%ixt3drhs,
'IXT3DRHS', this%memoryPath)
1034 call mem_allocate(this%satomega,
'SATOMEGA', this%memoryPath)
1035 call mem_allocate(this%hnoflo,
'HNOFLO', this%memoryPath)
1037 call mem_allocate(this%icellavg,
'ICELLAVG', this%memoryPath)
1038 call mem_allocate(this%iavgkeff,
'IAVGKEFF', this%memoryPath)
1041 call mem_allocate(this%ik22overk,
'IK22OVERK', this%memoryPath)
1042 call mem_allocate(this%ik33overk,
'IK33OVERK', this%memoryPath)
1043 call mem_allocate(this%iperched,
'IPERCHED', this%memoryPath)
1044 call mem_allocate(this%ivarcv,
'IVARCV', this%memoryPath)
1045 call mem_allocate(this%idewatcv,
'IDEWATCV', this%memoryPath)
1046 call mem_allocate(this%ithickstrt,
'ITHICKSTRT', this%memoryPath)
1047 call mem_allocate(this%icalcspdis,
'ICALCSPDIS', this%memoryPath)
1048 call mem_allocate(this%isavspdis,
'ISAVSPDIS', this%memoryPath)
1049 call mem_allocate(this%isavsat,
'ISAVSAT', this%memoryPath)
1050 call mem_allocate(this%irewet,
'IREWET', this%memoryPath)
1051 call mem_allocate(this%wetfct,
'WETFCT', this%memoryPath)
1052 call mem_allocate(this%iwetit,
'IWETIT', this%memoryPath)
1053 call mem_allocate(this%ihdwet,
'IHDWET', this%memoryPath)
1054 call mem_allocate(this%iangle1,
'IANGLE1', this%memoryPath)
1055 call mem_allocate(this%iangle2,
'IANGLE2', this%memoryPath)
1056 call mem_allocate(this%iangle3,
'IANGLE3', this%memoryPath)
1057 call mem_allocate(this%iwetdry,
'IWETDRY', this%memoryPath)
1058 call mem_allocate(this%nedges,
'NEDGES', this%memoryPath)
1059 call mem_allocate(this%lastedge,
'LASTEDGE', this%memoryPath)
1060 call mem_allocate(this%intvk,
'INTVK', this%memoryPath)
1061 call mem_allocate(this%invsc,
'INVSC', this%memoryPath)
1062 call mem_allocate(this%kchangeper,
'KCHANGEPER', this%memoryPath)
1063 call mem_allocate(this%kchangestp,
'KCHANGESTP', this%memoryPath)
1066 call mem_setptr(this%igwfnewtonur,
'INEWTONUR', &
1073 this%satomega =
dzero
1105 this%iasym = this%inewton
1123 integer(I4B),
intent(in) :: ncells
1124 integer(I4B),
intent(in) :: njas
1130 this%k11input(n) = this%k11(n)
1131 this%k22input(n) = this%k22(n)
1132 this%k33input(n) = this%k33(n)
1141 integer(I4B),
intent(in) :: ncells
1142 integer(I4B),
intent(in) :: njas
1146 call mem_allocate(this%ithickstartflag, ncells,
'ITHICKSTARTFLAG', &
1148 call mem_allocate(this%icelltype, ncells,
'ICELLTYPE', this%memoryPath)
1149 call mem_allocate(this%k11, ncells,
'K11', this%memoryPath)
1150 call mem_allocate(this%sat, ncells,
'SAT', this%memoryPath)
1151 call mem_allocate(this%condsat, njas,
'CONDSAT', this%memoryPath)
1154 call mem_allocate(this%k22, ncells,
'K22', this%memoryPath)
1155 call mem_allocate(this%k33, ncells,
'K33', this%memoryPath)
1156 call mem_allocate(this%wetdry, ncells,
'WETDRY', this%memoryPath)
1157 call mem_allocate(this%angle1, ncells,
'ANGLE1', this%memoryPath)
1158 call mem_allocate(this%angle2, ncells,
'ANGLE2', this%memoryPath)
1159 call mem_allocate(this%angle3, ncells,
'ANGLE3', this%memoryPath)
1162 call mem_allocate(this%ibotnode, 0,
'IBOTNODE', this%memoryPath)
1163 call mem_allocate(this%nodedge, 0,
'NODEDGE', this%memoryPath)
1164 call mem_allocate(this%ihcedge, 0,
'IHCEDGE', this%memoryPath)
1165 call mem_allocate(this%propsedge, 0, 0,
'PROPSEDGE', this%memoryPath)
1168 call mem_allocate(this%k11input, 0,
'K11INPUT', this%memoryPath)
1169 call mem_allocate(this%k22input, 0,
'K22INPUT', this%memoryPath)
1170 call mem_allocate(this%k33input, 0,
'K33INPUT', this%memoryPath)
1173 call mem_allocate(this%spdis, 3, 0,
'SPDIS', this%memoryPath)
1176 call mem_allocate(this%nodekchange, ncells,
'NODEKCHANGE', this%memoryPath)
1180 this%angle1(n) =
dzero
1181 this%angle2(n) =
dzero
1182 this%angle3(n) =
dzero
1183 this%wetdry(n) =
dzero
1184 this%nodekchange(n) =
dzero
1188 allocate (this%aname(this%iname))
1189 this%aname = [
' ICELLTYPE',
' K', &
1191 ' WETDRY',
' ANGLE1', &
1192 ' ANGLE2',
' ANGLE3']
1206 write (this%iout,
'(1x,a)')
'Setting NPF Options'
1207 if (found%iprflow) &
1208 write (this%iout,
'(4x,a)')
'Cell-by-cell flow information will be printed &
1209 &to listing file whenever ICBCFL is not zero.'
1211 write (this%iout,
'(4x,a)')
'Cell-by-cell flow information will be saved &
1212 &to binary file whenever ICBCFL is not zero.'
1213 if (found%cellavg) &
1214 write (this%iout,
'(4x,a,i0)')
'Alternative cell averaging [1=logarithmic, &
1215 &2=AMT-LMK, 3=AMT-HMK] set to: ', &
1217 if (found%ithickstrt) &
1218 write (this%iout,
'(4x,a)')
'THICKSTRT option has been activated.'
1219 if (found%iperched) &
1220 write (this%iout,
'(4x,a)')
'Vertical flow will be adjusted for perched &
1223 write (this%iout,
'(4x,a)')
'Vertical conductance varies with water table.'
1224 if (found%idewatcv) &
1225 write (this%iout,
'(4x,a)')
'Vertical conductance accounts for dewatered &
1226 &portion of an underlying cell.'
1227 if (found%ixt3d)
write (this%iout,
'(4x,a)')
'XT3D formulation is selected.'
1228 if (found%ixt3drhs) &
1229 write (this%iout,
'(4x,a)')
'XT3D RHS formulation is selected.'
1230 if (found%isavspdis) &
1231 write (this%iout,
'(4x,a)')
'Specific discharge will be calculated at cell &
1232 ¢ers and written to DATA-SPDIS in budget &
1233 &file when requested.'
1234 if (found%isavsat) &
1235 write (this%iout,
'(4x,a)')
'Saturation will be written to DATA-SAT in &
1236 &budget file when requested.'
1237 if (found%ik22overk) &
1238 write (this%iout,
'(4x,a)')
'Values specified for K22 are anisotropy &
1239 &ratios and will be multiplied by K before &
1240 &being used in calculations.'
1241 if (found%ik33overk) &
1242 write (this%iout,
'(4x,a)')
'Values specified for K33 are anisotropy &
1243 &ratios and will be multiplied by K before &
1244 &being used in calculations.'
1245 if (found%inewton) &
1246 write (this%iout,
'(4x,a)')
'NEWTON-RAPHSON method disabled for unconfined &
1248 if (found%satomega) &
1249 write (this%iout,
'(4x,a,1pg15.6)')
'Saturation omega: ', this%satomega
1251 write (this%iout,
'(4x,a)')
'Rewetting is active.'
1253 write (this%iout,
'(4x,a,1pg15.6)') &
1254 'Wetting factor (WETFCT) has been set to: ', this%wetfct
1256 write (this%iout,
'(4x,a,i5)') &
1257 'Wetting iteration interval (IWETIT) has been set to: ', this%iwetit
1259 write (this%iout,
'(4x,a,i5)') &
1260 'Head rewet equation (IHDWET) has been set to: ', this%ihdwet
1261 write (this%iout,
'(1x,a,/)')
'End Setting NPF Options'
1277 character(len=LENVARNAME),
dimension(3) :: cellavg_method = &
1278 &[character(len=LENVARNAME) ::
'LOGARITHMIC',
'AMT-LMK',
'AMT-HMK']
1280 character(len=LINELENGTH) :: tvk6_filename
1283 call mem_set_value(this%iprflow,
'IPRFLOW', this%input_mempath, found%iprflow)
1284 call mem_set_value(this%ipakcb,
'IPAKCB', this%input_mempath, found%ipakcb)
1285 call mem_set_value(this%icellavg,
'CELLAVG', this%input_mempath, &
1286 cellavg_method, found%cellavg)
1287 call mem_set_value(this%ithickstrt,
'ITHICKSTRT', this%input_mempath, &
1289 call mem_set_value(this%iperched,
'IPERCHED', this%input_mempath, &
1291 call mem_set_value(this%ivarcv,
'IVARCV', this%input_mempath, found%ivarcv)
1292 call mem_set_value(this%idewatcv,
'IDEWATCV', this%input_mempath, &
1294 call mem_set_value(this%ixt3d,
'IXT3D', this%input_mempath, found%ixt3d)
1295 call mem_set_value(this%ixt3drhs,
'IXT3DRHS', this%input_mempath, &
1297 call mem_set_value(this%isavspdis,
'ISAVSPDIS', this%input_mempath, &
1299 call mem_set_value(this%isavsat,
'ISAVSAT', this%input_mempath, found%isavsat)
1300 call mem_set_value(this%ik22overk,
'IK22OVERK', this%input_mempath, &
1302 call mem_set_value(this%ik33overk,
'IK33OVERK', this%input_mempath, &
1304 call mem_set_value(this%inewton,
'INEWTON', this%input_mempath, found%inewton)
1305 call mem_set_value(this%satomega,
'SATOMEGA', this%input_mempath, &
1307 call mem_set_value(this%irewet,
'IREWET', this%input_mempath, found%irewet)
1308 call mem_set_value(this%wetfct,
'WETFCT', this%input_mempath, found%wetfct)
1309 call mem_set_value(this%iwetit,
'IWETIT', this%input_mempath, found%iwetit)
1310 call mem_set_value(this%ihdwet,
'IHDWET', this%input_mempath, found%ihdwet)
1313 if (found%ipakcb) this%ipakcb = -1
1316 if (found%ixt3d .and. found%ixt3drhs) this%ixt3d = 2
1319 if (found%isavspdis) this%icalcspdis = this%isavspdis
1322 if (found%inewton)
then
1328 if (
filein_fname(tvk6_filename,
'TVK6_FILENAME', this%input_mempath, &
1329 this%input_fname))
then
1330 call openfile(this%intvk, this%iout, tvk6_filename,
'TVK')
1331 call tvk_cr(this%tvk, this%name_model, this%intvk, this%iout)
1335 if (this%iout > 0)
then
1336 call this%log_options(found)
1347 this%icellavg = options%icellavg
1348 this%ithickstrt = options%ithickstrt
1349 this%iperched = options%iperched
1350 this%ivarcv = options%ivarcv
1351 this%idewatcv = options%idewatcv
1352 this%irewet = options%irewet
1353 this%wetfct = options%wetfct
1354 this%iwetit = options%iwetit
1355 this%ihdwet = options%ihdwet
1368 if (this%inewton > 0)
then
1369 this%satomega = dem6
1372 if (this%inewton > 0)
then
1373 if (this%iperched > 0)
then
1374 write (
errmsg,
'(a)')
'ERROR IN NPF OPTIONS. NEWTON OPTION CANNOT '// &
1375 'BE USED WITH PERCHED OPTION.'
1378 if (this%ivarcv > 0)
then
1379 write (
errmsg,
'(a)')
'ERROR IN NPF OPTIONS. NEWTON OPTION CANNOT '// &
1380 'BE USED WITH VARIABLECV OPTION.'
1383 if (this%irewet > 0)
then
1384 write (
errmsg,
'(a)')
'ERROR IN NPF OPTIONS. NEWTON OPTION CANNOT '// &
1385 'BE USED WITH REWET OPTION.'
1390 if (this%ixt3d /= 0)
then
1391 if (this%icellavg > 0)
then
1392 write (
errmsg,
'(a)')
'ERROR IN NPF OPTIONS. '// &
1393 'ALTERNATIVE_CELL_AVERAGING OPTION '// &
1394 'CANNOT BE USED WITH XT3D OPTION.'
1397 if (this%ithickstrt > 0)
then
1398 write (
errmsg,
'(a)')
'ERROR IN NPF OPTIONS. THICKSTRT OPTION '// &
1399 'CANNOT BE USED WITH XT3D OPTION.'
1402 if (this%iperched > 0)
then
1403 write (
errmsg,
'(a)')
'ERROR IN NPF OPTIONS. PERCHED OPTION '// &
1404 'CANNOT BE USED WITH XT3D OPTION.'
1407 if (this%ivarcv > 0)
then
1408 write (
errmsg,
'(a)')
'ERROR IN NPF OPTIONS. VARIABLECV OPTION '// &
1409 'CANNOT BE USED WITH XT3D OPTION.'
1429 write (this%iout,
'(1x,a)')
'Setting NPF Griddata'
1431 if (found%icelltype)
then
1432 write (this%iout,
'(4x,a)')
'ICELLTYPE set from input file'
1436 write (this%iout,
'(4x,a)')
'K set from input file'
1440 write (this%iout,
'(4x,a)')
'K33 set from input file'
1442 write (this%iout,
'(4x,a)')
'K33 not provided. Setting K33 = K.'
1446 write (this%iout,
'(4x,a)')
'K22 set from input file'
1448 write (this%iout,
'(4x,a)')
'K22 not provided. Setting K22 = K.'
1451 if (found%wetdry)
then
1452 write (this%iout,
'(4x,a)')
'WETDRY set from input file'
1455 if (found%angle1)
then
1456 write (this%iout,
'(4x,a)')
'ANGLE1 set from input file'
1459 if (found%angle2)
then
1460 write (this%iout,
'(4x,a)')
'ANGLE2 set from input file'
1463 if (found%angle3)
then
1464 write (this%iout,
'(4x,a)')
'ANGLE3 set from input file'
1467 write (this%iout,
'(1x,a,/)')
'End Setting NPF Griddata'
1481 character(len=LINELENGTH) :: errmsg
1483 logical,
dimension(2) :: afound
1484 integer(I4B),
dimension(:),
pointer,
contiguous :: map
1488 if (this%dis%nodes < this%dis%nodesuser) map => this%dis%nodeuser
1491 call mem_set_value(this%icelltype,
'ICELLTYPE', this%input_mempath, map, &
1493 call mem_set_value(this%k11,
'K', this%input_mempath, map, found%k)
1494 call mem_set_value(this%k33,
'K33', this%input_mempath, map, found%k33)
1495 call mem_set_value(this%k22,
'K22', this%input_mempath, map, found%k22)
1496 call mem_set_value(this%wetdry,
'WETDRY', this%input_mempath, map, &
1498 call mem_set_value(this%angle1,
'ANGLE1', this%input_mempath, map, &
1500 call mem_set_value(this%angle2,
'ANGLE2', this%input_mempath, map, &
1502 call mem_set_value(this%angle3,
'ANGLE3', this%input_mempath, map, &
1506 if (.not. found%icelltype)
then
1507 write (errmsg,
'(a)')
'Error in GRIDDATA block: ICELLTYPE not found.'
1512 if (.not. found%k)
then
1513 write (errmsg,
'(a)')
'Error in GRIDDATA block: K not found.'
1518 if (.not. found%k33 .and. this%ik33overk /= 0)
then
1519 write (errmsg,
'(a)')
'K33OVERK option specified but K33 not specified.'
1524 if (.not. found%k22 .and. this%ik22overk /= 0)
then
1525 write (errmsg,
'(a)')
'K22OVERK option specified but K22 not specified.'
1530 if (found%k33) this%ik33 = 1
1531 if (found%k22) this%ik22 = 1
1532 if (found%wetdry) this%iwetdry = 1
1533 if (found%angle1) this%iangle1 = 1
1534 if (found%angle2) this%iangle2 = 1
1535 if (found%angle3) this%iangle3 = 1
1538 if (.not. found%k33)
then
1539 call mem_set_value(this%k33,
'K', this%input_mempath, map, afound(1))
1541 if (.not. found%k22)
then
1542 call mem_set_value(this%k22,
'K', this%input_mempath, map, afound(2))
1544 if (.not. found%wetdry)
call mem_reallocate(this%wetdry, 1,
'WETDRY', &
1545 trim(this%memoryPath))
1546 if (.not. found%angle1 .and. this%ixt3d == 0) &
1547 call mem_reallocate(this%angle1, 0,
'ANGLE1', trim(this%memoryPath))
1548 if (.not. found%angle2 .and. this%ixt3d == 0) &
1549 call mem_reallocate(this%angle2, 0,
'ANGLE2', trim(this%memoryPath))
1550 if (.not. found%angle3 .and. this%ixt3d == 0) &
1551 call mem_reallocate(this%angle3, 0,
'ANGLE3', trim(this%memoryPath))
1554 if (this%iout > 0)
then
1555 call this%log_griddata(found)
1568 character(len=24),
dimension(:),
pointer :: aname
1569 character(len=LINELENGTH) :: cellstr, errmsg
1570 integer(I4B) :: nerr, n
1572 character(len=*),
parameter :: fmtkerr = &
1573 &
"(1x, 'Hydraulic property ',a,' is <= 0 for cell ',a, ' ', 1pg15.6)"
1574 character(len=*),
parameter :: fmtkerr2 = &
1575 &
"(1x, '... ', i0,' additional errors not shown for ',a)"
1582 do n = 1,
size(this%k11)
1583 if (this%k11(n) <= dzero)
then
1585 if (nerr <= 20)
then
1586 call this%dis%noder_to_string(n, cellstr)
1587 write (errmsg, fmtkerr) trim(adjustl(aname(2))), trim(cellstr), &
1594 write (errmsg, fmtkerr2) nerr, trim(adjustl(aname(2)))
1599 if (this%ik33 /= 0)
then
1603 do n = 1,
size(this%k33)
1604 if (this%ik33overk /= 0) this%k33(n) = this%k33(n) * this%k11(n)
1605 if (this%k33(n) <= dzero)
then
1607 if (nerr <= 20)
then
1608 call this%dis%noder_to_string(n, cellstr)
1609 write (errmsg, fmtkerr) trim(adjustl(aname(3))), trim(cellstr), &
1616 write (errmsg, fmtkerr2) nerr, trim(adjustl(aname(3)))
1622 if (this%ik22 /= 0)
then
1625 if (this%dis%con%ianglex == 0)
then
1626 write (errmsg,
'(a)')
'Error. ANGLDEGX not provided in '// &
1627 'discretization file, but K22 was specified. '
1633 do n = 1,
size(this%k22)
1634 if (this%ik22overk /= 0) this%k22(n) = this%k22(n) * this%k11(n)
1635 if (this%k22(n) <= dzero)
then
1637 if (nerr <= 20)
then
1638 call this%dis%noder_to_string(n, cellstr)
1639 write (errmsg, fmtkerr) trim(adjustl(aname(4))), trim(cellstr), &
1646 write (errmsg, fmtkerr2) nerr, trim(adjustl(aname(4)))
1652 if (this%irewet == 1)
then
1653 if (this%iwetdry == 0)
then
1654 write (errmsg,
'(a, a, a)')
'Error in GRIDDATA block: ', &
1655 trim(adjustl(aname(5))),
' not found.'
1661 if (this%iangle1 /= 0)
then
1662 do n = 1,
size(this%angle1)
1663 this%angle1(n) = this%angle1(n) *
dpio180
1666 if (this%ixt3d /= 0)
then
1668 write (this%iout,
'(a)')
'XT3D IN USE, BUT ANGLE1 NOT SPECIFIED. '// &
1669 'SETTING ANGLE1 TO ZERO.'
1670 do n = 1,
size(this%angle1)
1671 this%angle1(n) = dzero
1675 if (this%iangle2 /= 0)
then
1676 if (this%iangle1 == 0)
then
1677 write (errmsg,
'(a)')
'ANGLE2 SPECIFIED BUT NOT ANGLE1. '// &
1678 'ANGLE2 REQUIRES ANGLE1. '
1681 if (this%iangle3 == 0)
then
1682 write (errmsg,
'(a)')
'ANGLE2 SPECIFIED BUT NOT ANGLE3. '// &
1683 'SPECIFY BOTH OR NEITHER ONE. '
1686 do n = 1,
size(this%angle2)
1687 this%angle2(n) = this%angle2(n) *
dpio180
1690 if (this%iangle3 /= 0)
then
1691 if (this%iangle1 == 0)
then
1692 write (errmsg,
'(a)')
'ANGLE3 SPECIFIED BUT NOT ANGLE1. '// &
1693 'ANGLE3 REQUIRES ANGLE1. '
1696 if (this%iangle2 == 0)
then
1697 write (errmsg,
'(a)')
'ANGLE3 SPECIFIED BUT NOT ANGLE2. '// &
1698 'SPECIFY BOTH OR NEITHER ONE. '
1701 do n = 1,
size(this%angle3)
1702 this%angle3(n) = this%angle3(n) *
dpio180
1729 integer(I4B) :: n, m, ii, nn
1730 real(DP) :: hyn, hym
1731 real(DP) :: satn, topn, botn
1732 integer(I4B) :: nextn
1733 real(DP) :: minbot, botm
1735 character(len=LINELENGTH) :: cellstr, errmsg
1737 character(len=*),
parameter :: fmtcnv = &
1739 &' ELIMINATED BECAUSE ALL HYDRAULIC CONDUCTIVITIES TO NODE ARE 0.')"
1740 character(len=*),
parameter :: fmtnct = &
1741 &
"(1X,'Negative cell thickness at cell ', A)"
1742 character(len=*),
parameter :: fmtihbe = &
1743 &
"(1X,'Initial head, bottom elevation:',1P,2G13.5)"
1744 character(len=*),
parameter :: fmttebe = &
1745 &
"(1X,'Top elevation, bottom elevation:',1P,2G13.5)"
1747 do n = 1, this%dis%nodes
1748 this%ithickstartflag(n) = 0
1754 nodeloop:
do n = 1, this%dis%nodes
1757 if (this%ibound(n) == 0)
then
1758 if (this%irewet /= 0)
then
1759 if (this%wetdry(n) == dzero) cycle nodeloop
1766 if (this%k11(n) /= dzero) cycle nodeloop
1770 do ii = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
1771 m = this%dis%con%ja(ii)
1772 if (this%dis%con%ihc(this%dis%con%jas(ii)) == 0)
then
1774 if (this%ik33 /= 0) hyn = this%k33(n)
1775 if (hyn /= dzero)
then
1777 if (this%ik33 /= 0) hym = this%k33(m)
1778 if (hym /= dzero) cycle
1786 this%hnew(n) = this%hnoflo
1787 if (this%irewet /= 0) this%wetdry(n) = dzero
1788 call this%dis%noder_to_string(n, cellstr)
1789 write (this%iout, fmtcnv) trim(adjustl(cellstr))
1794 if (this%inewton == 0)
then
1797 call this%wd(0, this%hnew)
1803 if (this%ivarcv == 1)
then
1804 do n = 1, this%dis%nodes
1805 if (this%hnew(n) < this%dis%bot(n))
then
1806 this%hnew(n) = this%dis%bot(n) + dem6
1814 if (this%ithickstrt == 0)
then
1815 do n = 1, this%dis%nodes
1816 if (this%icelltype(n) < 0)
then
1817 this%icelltype(n) = 1
1827 do n = 1, this%dis%nodes
1828 if (this%ibound(n) == 0)
then
1830 if (this%icelltype(n) < 0 .and. this%ithickstrt /= 0)
then
1831 this%ithickstartflag(n) = 1
1832 this%icelltype(n) = 0
1835 topn = this%dis%top(n)
1836 botn = this%dis%bot(n)
1837 if (this%icelltype(n) < 0 .and. this%ithickstrt /= 0)
then
1838 call this%thksat(n, this%ic%strt(n), satn)
1839 if (botn > this%ic%strt(n))
then
1840 call this%dis%noder_to_string(n, cellstr)
1841 write (errmsg, fmtnct) trim(adjustl(cellstr))
1843 write (errmsg, fmtihbe) this%ic%strt(n), botn
1846 this%ithickstartflag(n) = 1
1847 this%icelltype(n) = 0
1850 if (botn > topn)
then
1851 call this%dis%noder_to_string(n, cellstr)
1852 write (errmsg, fmtnct) trim(adjustl(cellstr))
1854 write (errmsg, fmttebe) topn, botn
1867 if (this%ixt3d == 0)
then
1872 do n = 1, this%dis%nodes
1873 call this%calc_condsat(n, .true.)
1879 if (this%igwfnewtonur /= 0)
then
1881 trim(this%memoryPath))
1882 do n = 1, this%dis%nodes
1884 minbot = this%dis%bot(n)
1887 do while (.not. finished)
1891 do ii = this%dis%con%ia(nn) + 1, this%dis%con%ia(nn + 1) - 1
1894 m = this%dis%con%ja(ii)
1895 botm = this%dis%bot(m)
1898 if (this%dis%con%ihc(this%dis%con%jas(ii)) == 0)
then
1899 if (m > nn .and. botm < minbot)
then
1911 this%ibotnode(n) = nn
1916 this%igwfnewtonur => null()
1927 integer(I4B),
intent(in) :: node
1928 logical,
intent(in) :: upperOnly
1930 integer(I4B) :: ii, m, n, ihc, jj
1931 real(DP) :: topm, topn, topnode, botm, botn, botnode, satm, satn, satnode
1932 real(DP) :: hyn, hym, hn, hm, fawidth, csat
1934 satnode = this%calc_initial_sat(node)
1936 topnode = this%dis%top(node)
1937 botnode = this%dis%bot(node)
1940 do ii = this%dis%con%ia(node) + 1, this%dis%con%ia(node + 1) - 1
1944 m = this%dis%con%ja(ii)
1945 jj = this%dis%con%jas(ii)
1947 if (upperonly) cycle
1954 topn = this%dis%top(n)
1955 botn = this%dis%bot(n)
1956 satn = this%calc_initial_sat(n)
1963 topm = this%dis%top(m)
1964 botm = this%dis%bot(m)
1965 satm = this%calc_initial_sat(m)
1968 ihc = this%dis%con%ihc(jj)
1969 hyn = this%hy_eff(n, m, ihc, ipos=ii)
1970 hym = this%hy_eff(m, n, ihc, ipos=ii)
1971 if (this%ithickstartflag(n) == 0)
then
1974 hn = this%ic%strt(n)
1976 if (this%ithickstartflag(m) == 0)
then
1979 hm = this%ic%strt(m)
1987 csat =
vcond(1, 1, 1, 1, 0, 1, 1,
done, &
1993 this%dis%con%hwva(jj))
1997 fawidth = this%dis%con%hwva(jj)
1998 csat =
hcond(1, 1, 1, 1, 0, &
2002 hn, hm, satn, satm, hyn, hym, &
2005 this%dis%con%cl1(jj), &
2006 this%dis%con%cl2(jj), &
2009 this%condsat(jj) = csat
2023 integer(I4B),
intent(in) :: n
2028 if (this%ibound(n) /= 0 .and. this%ithickstartflag(n) /= 0)
then
2029 call this%thksat(n, this%ic%strt(n), satn)
2042 integer(I4B),
intent(in) :: kiter
2043 real(DP),
intent(inout),
dimension(:) :: hnew
2045 integer(I4B) :: n, m, ii, ihc
2046 real(DP) :: ttop, bbot, thick
2047 integer(I4B) :: ncnvrt, ihdcnv
2048 character(len=30),
dimension(5) :: nodcnvrt
2049 character(len=30) :: nodestr
2050 character(len=3),
dimension(5) :: acnvrt
2051 character(len=LINELENGTH) :: errmsg
2052 integer(I4B) :: irewet
2054 character(len=*),
parameter :: fmtnct = &
2055 "(1X,/1X,'Negative cell thickness at (layer,row,col)', &
2057 character(len=*),
parameter :: fmttopbot = &
2058 &
"(1X,'Top elevation, bottom elevation:',1P,2G13.5)"
2059 character(len=*),
parameter :: fmttopbotthk = &
2060 &
"(1X,'Top elevation, bottom elevation, thickness:',1P,3G13.5)"
2061 character(len=*),
parameter :: fmtdrychd = &
2062 &
"(1X,/1X,'CONSTANT-HEAD CELL WENT DRY -- SIMULATION ABORTED')"
2063 character(len=*),
parameter :: fmtni = &
2064 &
"(1X,'CELLID=',a,' ITERATION=',I0,' TIME STEP=',I0,' STRESS PERIOD=',I0)"
2071 do n = 1, this%dis%nodes
2072 do ii = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
2073 m = this%dis%con%ja(ii)
2074 ihc = this%dis%con%ihc(this%dis%con%jas(ii))
2075 call this%rewet_check(kiter, n, hnew(m), this%ibound(m), ihc, hnew, &
2077 if (irewet == 1)
then
2078 call this%wdmsg(2, ncnvrt, nodcnvrt, acnvrt, ihdcnv, kiter, n)
2084 do n = 1, this%dis%nodes
2087 if (this%ibound(n) == 0) cycle
2088 if (this%icelltype(n) == 0) cycle
2091 bbot = this%dis%bot(n)
2092 ttop = this%dis%top(n)
2093 if (bbot > ttop)
then
2094 write (errmsg, fmtnct) n
2096 write (errmsg, fmttopbot) ttop, bbot
2102 if (this%icelltype(n) /= 0)
then
2103 if (hnew(n) < ttop) ttop = hnew(n)
2108 if (thick <= dzero)
then
2109 call this%wdmsg(1, ncnvrt, nodcnvrt, acnvrt, ihdcnv, kiter, n)
2111 if (this%ibound(n) < 0)
then
2112 errmsg =
'CONSTANT-HEAD CELL WENT DRY -- SIMULATION ABORTED'
2114 write (errmsg, fmttopbotthk) ttop, bbot, thick
2116 call this%dis%noder_to_string(n, nodestr)
2117 write (errmsg, fmtni) trim(adjustl(nodestr)), kiter,
kstp,
kper
2126 call this%wdmsg(0, ncnvrt, nodcnvrt, acnvrt, ihdcnv, kiter, n)
2129 do n = 1, this%dis%nodes
2130 if (this%ibound(n) == 30000) this%ibound(n) = 1
2141 subroutine rewet_check(this, kiter, node, hm, ibdm, ihc, hnew, irewet)
2144 integer(I4B),
intent(in) :: kiter
2145 integer(I4B),
intent(in) :: node
2146 real(DP),
intent(in) :: hm
2147 integer(I4B),
intent(in) :: ibdm
2148 integer(I4B),
intent(in) :: ihc
2149 real(DP),
intent(inout),
dimension(:) :: hnew
2150 integer(I4B),
intent(out) :: irewet
2152 integer(I4B) :: itflg
2153 real(DP) :: wd, awd, turnon, bbot
2158 if (this%irewet > 0)
then
2159 itflg = mod(kiter, this%iwetit)
2160 if (itflg == 0)
then
2161 if (this%ibound(node) == 0 .and. this%wetdry(node) /=
dzero)
then
2164 bbot = this%dis%bot(node)
2165 wd = this%wetdry(node)
2167 if (wd < 0) awd = -wd
2175 if (ibdm > 0 .and. hm >= turnon) irewet = 1
2177 if (wd >
dzero)
then
2180 if (ibdm > 0 .and. hm >= turnon) irewet = 1
2184 if (irewet == 1)
then
2187 if (this%ihdwet == 0)
then
2188 hnew(node) = bbot + this%wetfct * (hm - bbot)
2190 hnew(node) = bbot + this%wetfct * awd
2192 this%ibound(node) = 30000
2207 integer(I4B),
intent(in) :: icode
2208 integer(I4B),
intent(inout) :: ncnvrt
2209 character(len=30),
dimension(5),
intent(inout) :: nodcnvrt
2210 character(len=3),
dimension(5),
intent(inout) :: acnvrt
2211 integer(I4B),
intent(inout) :: ihdcnv
2212 integer(I4B),
intent(in) :: kiter
2213 integer(I4B),
intent(in) :: n
2217 character(len=*),
parameter :: fmtcnvtn = &
2218 "(1X,/1X,'CELL CONVERSIONS FOR ITER.=',I0, &
2219 &' STEP=',I0,' PERIOD=',I0,' (NODE or LRC)')"
2220 character(len=*),
parameter :: fmtnode =
"(1X,3X,5(A4, A20))"
2225 call this%dis%noder_to_string(n, nodcnvrt(ncnvrt))
2226 if (icode == 1)
then
2227 acnvrt(ncnvrt) =
'DRY'
2229 acnvrt(ncnvrt) =
'WET'
2235 if (ncnvrt == 5 .or. (icode == 0 .and. ncnvrt > 0))
then
2236 if (ihdcnv == 0)
write (this%iout, fmtcnvtn) kiter,
kstp,
kper
2238 write (this%iout, fmtnode) &
2239 (acnvrt(l), trim(adjustl(nodcnvrt(l))), l=1, ncnvrt)
2254 function hy_eff(this, n, m, ihc, ipos, vg)
result(hy)
2259 integer(I4B),
intent(in) :: n
2260 integer(I4B),
intent(in) :: m
2261 integer(I4B),
intent(in) :: ihc
2262 integer(I4B),
intent(in),
optional :: ipos
2263 real(dp),
dimension(3),
intent(in),
optional :: vg
2265 integer(I4B) :: iipos
2266 real(dp) :: hy11, hy22, hy33
2267 real(dp) :: ang1, ang2, ang3
2268 real(dp) :: vg1, vg2, vg3
2272 if (
present(ipos)) iipos = ipos
2286 if (this%iangle2 > 0)
then
2287 if (
present(vg))
then
2292 call this%dis%connection_normal(n, m, ihc, vg1, vg2, vg3, iipos)
2294 ang1 = this%angle1(n)
2295 ang2 = this%angle2(n)
2297 if (this%iangle3 > 0) ang3 = this%angle3(n)
2298 hy =
hyeff(hy11, hy22, hy33, ang1, ang2, ang3, vg1, vg2, vg3, &
2306 if (this%ik22 > 0)
then
2307 if (
present(vg))
then
2312 call this%dis%connection_normal(n, m, ihc, vg1, vg2, vg3, iipos)
2317 if (this%iangle1 > 0)
then
2318 ang1 = this%angle1(n)
2319 if (this%iangle2 > 0)
then
2320 ang2 = this%angle2(n)
2321 if (this%iangle3 > 0) ang3 = this%angle3(n)
2324 hy =
hyeff(hy11, hy22, hy33, ang1, ang2, ang3, vg1, vg2, vg3, &
2338 real(DP),
intent(in),
dimension(:) :: flowja
2342 integer(I4B) :: ipos
2343 integer(I4B) :: isympos
2371 real(DP),
allocatable,
dimension(:) :: vi
2372 real(DP),
allocatable,
dimension(:) :: di
2373 real(DP),
allocatable,
dimension(:) :: viz
2374 real(DP),
allocatable,
dimension(:) :: diz
2375 real(DP),
allocatable,
dimension(:) :: nix
2376 real(DP),
allocatable,
dimension(:) :: niy
2377 real(DP),
allocatable,
dimension(:) :: wix
2378 real(DP),
allocatable,
dimension(:) :: wiy
2379 real(DP),
allocatable,
dimension(:) :: wiz
2380 real(DP),
allocatable,
dimension(:) :: bix
2381 real(DP),
allocatable,
dimension(:) :: biy
2382 logical :: nozee = .true.
2385 if (this%icalcspdis /= 0 .and. this%dis%con%ianglex == 0)
then
2386 call store_error(
'Error. ANGLDEGX not provided in '// &
2387 'discretization file. ANGLDEGX required for '// &
2388 'calculation of specific discharge.', terminate=.true.)
2393 do n = 1, this%dis%nodes
2396 ic = this%dis%con%ia(n + 1) - this%dis%con%ia(n) - 1
2399 do m = 1, this%nedges
2400 if (this%nodedge(m) == n)
then
2406 if (ic > nc) nc = ic
2423 do n = 1, this%dis%nodes
2435 do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
2436 m = this%dis%con%ja(ipos)
2437 isympos = this%dis%con%jas(ipos)
2438 ihc = this%dis%con%ihc(isympos)
2439 area = this%dis%con%hwva(isympos)
2445 call this%dis%connection_vector(n, m, nozee, this%sat(n), this%sat(m), &
2446 ihc, xc, yc, zc, dltot)
2447 cl1 = this%dis%con%cl1(isympos)
2448 cl2 = this%dis%con%cl2(isympos)
2450 cl1 = this%dis%con%cl2(isympos)
2451 cl2 = this%dis%con%cl1(isympos)
2453 ooclsum =
done / (cl1 + cl2)
2454 diz(iz) = dltot * cl1 * ooclsum
2462 dz =
thksatnm(this%ibound(n), this%ibound(m), &
2463 this%icelltype(n), this%icelltype(m), &
2464 this%inewton, ihc, &
2465 this%hnew(n), this%hnew(m), this%sat(n), this%sat(m), &
2466 this%dis%top(n), this%dis%top(m), this%dis%bot(n), &
2469 call this%dis%connection_normal(n, m, ihc, xn, yn, zn, ipos)
2470 call this%dis%connection_vector(n, m, nozee, this%sat(n), this%sat(m), &
2471 ihc, xc, yc, zc, dltot)
2472 cl1 = this%dis%con%cl1(isympos)
2473 cl2 = this%dis%con%cl2(isympos)
2475 cl1 = this%dis%con%cl2(isympos)
2476 cl2 = this%dis%con%cl1(isympos)
2478 ooclsum =
done / (cl1 + cl2)
2481 di(ic) = dltot * cl1 * ooclsum
2482 if (area >
dzero)
then
2483 vi(ic) = flowja(ipos) / area
2492 do m = 1, this%nedges
2493 if (this%nodedge(m) == n)
then
2496 ihc = this%ihcedge(m)
2497 area = this%propsedge(2, m)
2500 viz(iz) = this%propsedge(1, m) / area
2501 diz(iz) = this%propsedge(5, m)
2504 nix(ic) = -this%propsedge(3, m)
2505 niy(ic) = -this%propsedge(4, m)
2506 di(ic) = this%propsedge(5, m)
2507 if (area >
dzero)
then
2508 vi(ic) = this%propsedge(1, m) / area
2526 dsumz = dsumz + diz(iz)
2528 denom = (ncz -
done)
2530 dsumz = dsumz +
dem10 * dsumz
2532 if (dsumz >
dzero) wiz(iz) =
done - diz(iz) / dsumz
2534 wiz(iz) = wiz(iz) / denom
2542 vz = vz + wiz(iz) * viz(iz)
2551 wix(ic) = di(ic) * abs(nix(ic))
2552 wiy(ic) = di(ic) * abs(niy(ic))
2553 dsumx = dsumx + wix(ic)
2554 dsumy = dsumy + wiy(ic)
2561 dsumx = dsumx +
dem10 * dsumx
2562 dsumy = dsumy +
dem10 * dsumy
2564 wix(ic) = (dsumx - wix(ic)) * abs(nix(ic))
2565 wiy(ic) = (dsumy - wiy(ic)) * abs(niy(ic))
2572 bix(ic) = wix(ic) * sign(
done, nix(ic))
2573 biy(ic) = wiy(ic) * sign(
done, niy(ic))
2574 dsumx = dsumx + wix(ic) * abs(nix(ic))
2575 dsumy = dsumy + wiy(ic) * abs(niy(ic))
2582 bix(ic) = bix(ic) * dsumx
2583 biy(ic) = biy(ic) * dsumy
2584 axy = axy + bix(ic) * niy(ic)
2585 ayx = ayx + biy(ic) * nix(ic)
2598 vx = vx + (bix(ic) - axy * biy(ic)) * vi(ic)
2599 vy = vy + (biy(ic) - ayx * bix(ic)) * vi(ic)
2601 denom =
done - axy * ayx
2602 if (denom /=
dzero)
then
2607 this%spdis(1, n) = vx
2608 this%spdis(2, n) = vy
2609 this%spdis(3, n) = vz
2630 integer(I4B),
intent(in) :: ibinun
2632 character(len=16) :: text
2633 character(len=16),
dimension(3) :: auxtxt
2635 integer(I4B) :: naux
2638 text =
' DATA-SPDIS'
2640 auxtxt(:) = [
' qx',
' qy',
' qz']
2641 call this%dis%record_srcdst_list_header(text, this%name_model, &
2642 this%packName, this%name_model, &
2643 this%packName, naux, auxtxt, ibinun, &
2644 this%dis%nodes, this%iout)
2647 do n = 1, this%dis%nodes
2648 call this%dis%record_mf6_list_entry(ibinun, n, n,
dzero, naux, &
2658 integer(I4B),
intent(in) :: ibinun
2660 character(len=16) :: text
2661 character(len=16),
dimension(1) :: auxtxt
2662 real(DP),
dimension(1) :: a
2664 integer(I4B) :: naux
2669 auxtxt(:) = [
' sat']
2670 call this%dis%record_srcdst_list_header(text, this%name_model, &
2671 this%packName, this%name_model, &
2672 this%packName, naux, auxtxt, ibinun, &
2673 this%dis%nodes, this%iout)
2676 do n = 1, this%dis%nodes
2678 call this%dis%record_mf6_list_entry(ibinun, n, n,
dzero, naux, a)
2690 integer(I4B),
intent(in) :: nedges
2692 this%nedges = this%nedges + nedges
2701 integer(I4B),
intent(in) :: nodedge
2702 integer(I4B),
intent(in) :: ihcedge
2703 real(DP),
intent(in) :: q
2704 real(DP),
intent(in) :: area
2705 real(DP),
intent(in) :: nx
2706 real(DP),
intent(in) :: ny
2707 real(DP),
intent(in) :: distance
2709 integer(I4B) :: lastedge
2711 this%lastedge = this%lastedge + 1
2712 lastedge = this%lastedge
2713 this%nodedge(lastedge) = nodedge
2714 this%ihcedge(lastedge) = ihcedge
2715 this%propsedge(1, lastedge) = q
2716 this%propsedge(2, lastedge) = area
2717 this%propsedge(3, lastedge) = nx
2718 this%propsedge(4, lastedge) = ny
2719 this%propsedge(5, lastedge) = distance
2723 if (this%lastedge == this%nedges) this%lastedge = 0
2735 real(dp) :: satthickness
2737 satthickness =
thksatnm(this%ibound(n), &
2739 this%icelltype(n), &
2740 this%icelltype(m), &
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.
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 npf_nur(this, neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
Under-relaxation.
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 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 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 allocate_scalars(this)
@ brief Allocate scalars
subroutine npf_cq(this, hnew, flowja)
Calculate flowja.
subroutine npf_ar(this, ic, vsc, ibound, hnew)
Allocate and read this NPF instance.
subroutine check_options(this)
Check for conflicting NPF options.
subroutine npf_cf(this, kiter, nodes, hnew)
Routines associated fill coefficients.
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 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_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
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, 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 ...
Data structure and helper methods for passing NPF options into npf_df, as an alternative to reading t...