51 integer(I4B),
pointer :: inic => null()
52 integer(I4B),
pointer :: inoc => null()
53 integer(I4B),
pointer :: innpf => null()
54 integer(I4B),
pointer :: inbuy => null()
55 integer(I4B),
pointer :: invsc => null()
56 integer(I4B),
pointer :: insto => null()
57 integer(I4B),
pointer :: incsub => null()
58 integer(I4B),
pointer :: inmvr => null()
59 integer(I4B),
pointer :: inhfb => null()
60 integer(I4B),
pointer :: ingnc => null()
61 integer(I4B),
pointer :: inobs => null()
62 integer(I4B),
pointer :: iss => null()
63 integer(I4B),
pointer :: inewtonur => null()
107 character(len=LENPACKAGETYPE),
dimension(GWF_NBASEPKG) ::
gwf_basepkg
108 data gwf_basepkg/
'DIS6 ',
'DISV6',
'DISU6',
' ',
' ', &
109 &
'NPF6 ',
'BUY6 ',
'VSC6 ',
'GNC6 ',
' ', &
110 &
'HFB6 ',
'STO6 ',
'IC6 ',
'CSUB6',
' ', &
111 &
'MVR6 ',
'OC6 ',
'OBS6 ',
' ',
' ', &
120 character(len=LENPACKAGETYPE),
dimension(GWF_NMULTIPKG) ::
gwf_multipkg
121 data gwf_multipkg/
'WEL6 ',
'DRN6 ',
'RIV6 ',
'GHB6 ',
' ', &
122 &
'RCH6 ',
'EVT6 ',
'CHD6 ',
' ',
' ', &
123 &
'MAW6 ',
'SFR6 ',
'LAK6 ',
'UZF6 ',
'API6 ', &
137 subroutine gwf_cr(filename, id, modelname)
148 character(len=*),
intent(in) :: filename
149 integer(I4B),
intent(in) :: id
150 character(len=*),
intent(in) :: modelname
154 character(len=LENMEMPATH) :: input_mempath
155 character(len=LINELENGTH) :: lst_fname
165 call this%allocate_scalars(modelname)
170 this%filename = filename
171 this%name = modelname
172 this%macronym =
'GWF'
179 call mem_set_value(lst_fname,
'LIST', input_mempath, found%list)
180 call mem_set_value(this%inewton,
'NEWTON', input_mempath, found%newton)
181 call mem_set_value(this%inewtonur,
'UNDER_RELAXATION', input_mempath, &
182 found%under_relaxation)
183 call mem_set_value(this%iprpak,
'PRINT_INPUT', input_mempath, &
185 call mem_set_value(this%iprflow,
'PRINT_FLOWS', input_mempath, &
187 call mem_set_value(this%ipakcb,
'SAVE_FLOWS', input_mempath, found%save_flows)
190 call this%create_lstfile(lst_fname, filename, found%list, &
191 'GROUNDWATER FLOW MODEL (GWF)')
194 if (found%save_flows)
then
199 if (this%iout > 0)
then
200 call this%log_namfile_options(found)
207 call this%create_packages()
222 class(
bndtype),
pointer :: packobj
225 call this%dis%dis_df()
226 call this%npf%npf_df(this%dis, this%xt3d, this%ingnc, this%invsc)
228 call this%budget%budget_df(
niunit_gwf,
'VOLUME',
'L**3')
229 if (this%inbuy > 0)
call this%buy%buy_df(this%dis)
230 if (this%invsc > 0)
call this%vsc%vsc_df(this%dis)
231 if (this%ingnc > 0)
call this%gnc%gnc_df(this)
235 this%neq = this%dis%nodes
236 this%nja = this%dis%nja
237 this%ia => this%dis%con%ia
238 this%ja => this%dis%con%ja
241 call this%allocate_arrays()
244 do ip = 1, this%bndlist%Count()
246 call packobj%bnd_df(this%neq, this%dis)
250 call this%obs%obs_df(this%iout, this%name,
'GWF', this%dis)
262 class(
bndtype),
pointer :: packobj
266 call this%dis%dis_ac(this%moffset, sparse)
269 if (this%innpf > 0)
call this%npf%npf_ac(this%moffset, sparse)
272 do ip = 1, this%bndlist%Count()
274 call packobj%bnd_ac(this%moffset, sparse)
278 if (this%ingnc > 0)
call this%gnc%gnc_ac(sparse)
289 class(
bndtype),
pointer :: packobj
294 call this%dis%dis_mc(this%moffset, this%idxglo, matrix_sln)
297 if (this%innpf > 0)
call this%npf%npf_mc(this%moffset, matrix_sln)
300 do ip = 1, this%bndlist%Count()
302 call packobj%bnd_mc(this%moffset, matrix_sln)
307 if (this%ingnc > 0)
call this%gnc%gnc_mc(matrix_sln)
321 class(
bndtype),
pointer :: packobj
324 if (this%inic > 0)
call this%ic%ic_ar(this%x)
325 if (this%innpf > 0)
call this%npf%npf_ar(this%ic, this%vsc, this%ibound, &
327 if (this%invsc > 0)
call this%vsc%vsc_ar(this%ibound)
328 if (this%inbuy > 0)
call this%buy%buy_ar(this%npf, this%ibound)
329 if (this%inhfb > 0)
call this%hfb%hfb_ar(this%ibound, this%xt3d, this%dis, &
330 this%invsc, this%vsc)
331 if (this%insto > 0)
call this%sto%sto_ar(this%dis, this%ibound)
332 if (this%incsub > 0)
call this%csub%csub_ar(this%dis, this%ibound)
333 if (this%inmvr > 0)
call this%mvr%mvr_ar()
334 if (this%inobs > 0)
call this%obs%gwf_obs_ar(this%ic, this%x, this%flowja)
337 call this%dis%dis_ar(this%npf%icelltype)
340 call this%oc%oc_ar(this%x, this%dis, this%npf%hnoflo)
341 call this%budget%set_ibudcsv(this%oc%ibudcsv)
344 do ip = 1, this%bndlist%Count()
346 call packobj%set_pointers(this%dis%nodes, this%ibound, this%x, &
347 this%xold, this%flowja)
349 call packobj%bnd_ar()
350 if (this%inbuy > 0)
call this%buy%buy_ar_bnd(packobj, this%x)
351 if (this%invsc > 0)
call this%vsc%vsc_ar_bnd(packobj)
366 class(
bndtype),
pointer :: packobj
373 if (this%innpf > 0)
call this%npf%npf_rp()
374 if (this%inbuy > 0)
call this%buy%buy_rp()
375 if (this%invsc > 0)
call this%vsc%vsc_rp()
376 if (this%inhfb > 0)
call this%hfb%hfb_rp()
377 if (this%inoc > 0)
call this%oc%oc_rp()
378 if (this%insto > 0)
call this%sto%sto_rp()
379 if (this%incsub > 0)
call this%csub%csub_rp()
380 if (this%inmvr > 0)
call this%mvr%mvr_rp()
381 do ip = 1, this%bndlist%Count()
383 call packobj%bnd_rp()
384 call packobj%bnd_rp_obs()
388 call this%steady_period_check()
401 class(
bndtype),
pointer :: packobj
403 integer(I4B) :: irestore
404 integer(I4B) :: ip, n
409 if (irestore == 0)
then
412 do n = 1, this%dis%nodes
413 this%xold(n) = this%x(n)
418 do n = 1, this%dis%nodes
419 this%x(n) = this%xold(n)
424 if (this%invsc > 0)
call this%vsc%vsc_ad()
425 if (this%innpf > 0)
call this%npf%npf_ad(this%dis%nodes, this%xold, &
427 if (this%insto > 0)
call this%sto%sto_ad()
428 if (this%incsub > 0)
call this%csub%csub_ad(this%dis%nodes, this%x)
429 if (this%inbuy > 0)
call this%buy%buy_ad()
430 if (this%inmvr > 0)
call this%mvr%mvr_ad()
431 do ip = 1, this%bndlist%Count()
433 call packobj%bnd_ad()
434 if (this%invsc > 0)
call this%vsc%vsc_ad_bnd(packobj, this%x)
436 call packobj%bnd_ck()
441 call this%obs%obs_ad()
449 integer(I4B),
intent(in) :: kiter
451 class(
bndtype),
pointer :: packobj
455 if (this%innpf > 0)
call this%npf%npf_cf(kiter, this%dis%nodes, this%x)
456 if (this%inbuy > 0)
call this%buy%buy_cf(kiter)
457 do ip = 1, this%bndlist%Count()
459 call packobj%bnd_cf()
460 if (this%inbuy > 0)
call this%buy%buy_cf_bnd(packobj, this%x)
466 subroutine gwf_fc(this, kiter, matrix_sln, inwtflag)
469 integer(I4B),
intent(in) :: kiter
471 integer(I4B),
intent(in) :: inwtflag
473 class(
bndtype),
pointer :: packobj
475 integer(I4B) :: inwt, inwtsto, inwtcsub, inwtpak
479 if (inwtflag == 1) inwt = this%npf%inewton
481 if (this%insto > 0)
then
482 if (inwtflag == 1) inwtsto = this%sto%inewton
485 if (this%incsub > 0)
then
486 if (inwtflag == 1) inwtcsub = this%csub%inewton
490 if (this%innpf > 0)
call this%npf%npf_fc(kiter, matrix_sln, this%idxglo, &
492 if (this%inbuy > 0)
call this%buy%buy_fc(kiter, matrix_sln, this%idxglo, &
494 if (this%inhfb > 0)
call this%hfb%hfb_fc(kiter, matrix_sln, this%idxglo, &
496 if (this%ingnc > 0)
call this%gnc%gnc_fc(kiter, matrix_sln)
498 if (this%insto > 0)
then
499 call this%sto%sto_fc(kiter, this%xold, this%x, matrix_sln, &
500 this%idxglo, this%rhs)
503 if (this%incsub > 0)
then
504 call this%csub%csub_fc(kiter, this%xold, this%x, matrix_sln, &
505 this%idxglo, this%rhs)
507 if (this%inmvr > 0)
call this%mvr%mvr_fc()
508 do ip = 1, this%bndlist%Count()
510 call packobj%bnd_fc(this%rhs, this%ia, this%idxglo, matrix_sln)
514 if (this%innpf > 0)
then
516 call this%npf%npf_fn(kiter, matrix_sln, this%idxglo, this%rhs, this%x)
521 if (this%ingnc > 0)
then
523 call this%gnc%gnc_fn(kiter, matrix_sln, this%npf%condsat, &
524 ivarcv_opt=this%npf%ivarcv, &
525 ictm1_opt=this%npf%icelltype, &
526 ictm2_opt=this%npf%icelltype)
531 if (this%insto > 0)
then
532 if (inwtsto /= 0)
then
533 call this%sto%sto_fn(kiter, this%xold, this%x, matrix_sln, &
534 this%idxglo, this%rhs)
539 if (this%incsub > 0)
then
540 if (inwtcsub /= 0)
then
541 call this%csub%csub_fn(kiter, this%xold, this%x, matrix_sln, &
542 this%idxglo, this%rhs)
547 do ip = 1, this%bndlist%Count()
550 if (inwtflag == 1) inwtpak = packobj%inewton
551 if (inwtpak /= 0)
then
552 call packobj%bnd_fn(this%rhs, this%ia, this%idxglo, matrix_sln)
562 subroutine gwf_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
565 integer(I4B),
intent(in) :: innertot
566 integer(I4B),
intent(in) :: kiter
567 integer(I4B),
intent(in) :: iend
568 integer(I4B),
intent(in) :: icnvgmod
569 character(len=LENPAKLOC),
intent(inout) :: cpak
570 integer(I4B),
intent(inout) :: ipak
571 real(DP),
intent(inout) :: dpak
573 class(
bndtype),
pointer :: packobj
578 if (this%inmvr > 0)
then
579 call this%mvr%mvr_cc(innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
583 if (this%incsub > 0)
then
584 call this%csub%csub_cc(innertot, kiter, iend, icnvgmod, &
585 this%dis%nodes, this%x, this%xold, &
590 do ip = 1, this%bndlist%Count()
592 call packobj%bnd_cc(innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
604 integer(I4B),
intent(inout) :: iptc
610 if (this%iss > 0)
then
611 if (this%inewton > 0)
then
614 iptc = this%npf%inewton
625 subroutine gwf_ptc(this, vec_residual, iptc, ptcf)
632 integer(I4B),
intent(inout) :: iptc
633 real(DP),
intent(inout) :: ptcf
636 integer(I4B) :: iptct
639 real(DP) :: ptcdelem1
646 if (this%iss > 0)
then
647 if (this%inewton > 0)
then
650 iptct = this%npf%inewton
658 do n = 1, this%dis%nodes
659 if (this%npf%ibound(n) < 1) cycle
662 v = this%dis%get_cell_volume(n, this%dis%top(n))
665 resid = vec_residual%get_value_local(n)
669 ptcdelem1 = abs(resid) / v
674 if (ptcdelem1 > ptcf) ptcf = ptcdelem1
678 if (ptcf == dzero)
then
685 if (iptct > 0) iptc = 1
696 subroutine gwf_nur(this, neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
701 integer(I4B),
intent(in) :: neqmod
702 real(DP),
dimension(neqmod),
intent(inout) :: x
703 real(DP),
dimension(neqmod),
intent(in) :: xtemp
704 real(DP),
dimension(neqmod),
intent(inout) :: dx
705 integer(I4B),
intent(inout) :: inewtonur
706 real(DP),
intent(inout) :: dxmax
707 integer(I4B),
intent(inout) :: locmax
711 class(
bndtype),
pointer :: packobj
717 if (this%inewton /= 0 .and. this%inewtonur /= 0)
then
718 if (this%innpf > 0)
then
719 call this%npf%npf_nur(neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
723 i0 = this%dis%nodes + 1
724 do ip = 1, this%bndlist%Count()
726 if (packobj%npakeq > 0)
then
727 i1 = i0 + packobj%npakeq - 1
728 call packobj%bnd_nur(packobj%npakeq, x(i0:i1), xtemp(i0:i1), &
729 dx(i0:i1), inewtonur, dxmax, locmax)
741 subroutine gwf_cq(this, icnvg, isuppress_output)
745 integer(I4B),
intent(in) :: icnvg
746 integer(I4B),
intent(in) :: isuppress_output
750 class(
bndtype),
pointer :: packobj
758 this%flowja(i) =
dzero
760 if (this%innpf > 0)
call this%npf%npf_cq(this%x, this%flowja)
761 if (this%inbuy > 0)
call this%buy%buy_cq(this%x, this%flowja)
762 if (this%inhfb > 0)
call this%hfb%hfb_cq(this%x, this%flowja)
763 if (this%ingnc > 0)
call this%gnc%gnc_cq(this%flowja)
764 if (this%insto > 0)
call this%sto%sto_cq(this%flowja, this%x, this%xold)
765 if (this%incsub > 0)
call this%csub%csub_cq(this%dis%nodes, this%x, &
766 this%xold, isuppress_output, &
772 do ip = 1, this%bndlist%Count()
774 call packobj%bnd_cf()
775 if (this%inbuy > 0)
call this%buy%buy_cf_bnd(packobj, this%x)
776 call packobj%bnd_cq(this%x, this%flowja)
785 subroutine gwf_bd(this, icnvg, isuppress_output)
790 integer(I4B),
intent(in) :: icnvg
791 integer(I4B),
intent(in) :: isuppress_output
794 class(
bndtype),
pointer :: packobj
808 call this%budget%reset()
809 if (this%insto > 0)
call this%sto%sto_bd(isuppress_output, this%budget)
810 if (this%incsub > 0)
call this%csub%csub_bd(isuppress_output, this%budget)
811 if (this%inmvr > 0)
call this%mvr%mvr_bd()
812 do ip = 1, this%bndlist%Count()
814 call packobj%bnd_bd(this%budget)
819 if (this%innpf > 0)
then
820 if (this%npf%icalcspdis /= 0)
then
821 call this%npf%calc_spdis(this%flowja)
834 integer(I4B) :: idvsave
835 integer(I4B) :: idvprint
836 integer(I4B) :: icbcfl
837 integer(I4B) :: icbcun
838 integer(I4B) :: ibudfl
839 integer(I4B) :: ipflag
841 character(len=*),
parameter :: fmtnocnvg = &
842 "(1X,/9X,'****FAILED TO MEET SOLVER CONVERGENCE CRITERIA IN TIME STEP ', &
843 &I0,' OF STRESS PERIOD ',I0,'****')"
850 if (this%oc%oc_save(
'HEAD')) idvsave = 1
851 if (this%oc%oc_print(
'HEAD')) idvprint = 1
852 if (this%oc%oc_save(
'BUDGET')) icbcfl = 1
853 if (this%oc%oc_print(
'BUDGET')) ibudfl = 1
854 icbcun = this%oc%oc_save_unit(
'BUDGET')
858 ibudfl = this%oc%set_print_flag(
'BUDGET', this%icnvg,
endofperiod)
859 idvprint = this%oc%set_print_flag(
'HEAD', this%icnvg,
endofperiod)
862 call this%gwf_ot_obs()
865 call this%gwf_ot_flow(icbcfl, ibudfl, icbcun)
868 call this%gwf_ot_dv(idvsave, idvprint, ipflag)
871 call this%gwf_ot_bdsummary(ibudfl, ipflag)
875 if (ipflag == 1)
call tdis_ot(this%iout)
878 if (this%icnvg == 0)
then
879 write (this%iout, fmtnocnvg)
kstp,
kper
887 class(
bndtype),
pointer :: packobj
891 call this%obs%obs_bd()
892 call this%obs%obs_ot()
895 if (this%incsub > 0)
then
896 call this%csub%csub_bd_obs()
897 call this%csub%obs%obs_ot()
901 do ip = 1, this%bndlist%Count()
903 call packobj%bnd_bd_obs()
904 call packobj%bnd_ot_obs()
913 integer(I4B),
intent(in) :: icbcfl
914 integer(I4B),
intent(in) :: ibudfl
915 integer(I4B),
intent(in) :: icbcun
916 class(
bndtype),
pointer :: packobj
920 if (this%insto > 0)
then
921 call this%sto%sto_save_model_flows(icbcfl, icbcun)
923 if (this%innpf > 0)
then
924 call this%npf%npf_save_model_flows(this%flowja, icbcfl, icbcun)
926 if (this%incsub > 0)
call this%csub%csub_save_model_flows(icbcfl, icbcun)
927 do ip = 1, this%bndlist%Count()
929 call packobj%bnd_ot_model_flows(icbcfl=icbcfl, ibudfl=0, icbcun=icbcun)
933 do ip = 1, this%bndlist%Count()
935 call packobj%bnd_ot_package_flows(icbcfl=icbcfl, ibudfl=0)
937 if (this%inmvr > 0)
then
938 call this%mvr%mvr_ot_saveflow(icbcfl, ibudfl)
942 if (this%innpf > 0)
call this%npf%npf_print_model_flows(ibudfl, this%flowja)
943 if (this%ingnc > 0)
call this%gnc%gnc_ot(ibudfl)
944 do ip = 1, this%bndlist%Count()
946 call packobj%bnd_ot_model_flows(icbcfl=icbcfl, ibudfl=ibudfl, icbcun=0)
950 do ip = 1, this%bndlist%Count()
952 call packobj%bnd_ot_package_flows(icbcfl=0, ibudfl=ibudfl)
954 if (this%inmvr > 0)
then
955 call this%mvr%mvr_ot_printflow(icbcfl, ibudfl)
964 integer(I4B),
intent(in) :: idvsave
965 integer(I4B),
intent(in) :: idvprint
966 integer(I4B),
intent(inout) :: ipflag
967 class(
bndtype),
pointer :: packobj
971 if (this%incsub > 0)
call this%csub%csub_ot_dv(idvsave, idvprint)
974 if (this%inbuy > 0)
then
975 call this%buy%buy_ot_dv(idvsave)
979 if (this%invsc > 0)
then
980 call this%vsc%vsc_ot_dv(idvsave)
984 do ip = 1, this%bndlist%Count()
986 call packobj%bnd_ot_dv(idvsave, idvprint)
990 call this%oc%oc_ot(ipflag)
998 integer(I4B),
intent(in) :: ibudfl
999 integer(I4B),
intent(inout) :: ipflag
1000 class(
bndtype),
pointer :: packobj
1004 do ip = 1, this%bndlist%Count()
1006 call packobj%bnd_ot_bdsummary(
kstp,
kper, this%iout, ibudfl)
1010 if (this%inmvr > 0)
then
1011 call this%mvr%mvr_ot_bdsummary(ibudfl)
1015 call this%budget%finalize_step(
delt)
1016 if (ibudfl /= 0)
then
1018 call this%budget%budget_ot(
kstp,
kper, this%iout)
1022 call this%budget%writecsv(
totim)
1035 if (this%incsub > 0)
then
1036 call this%csub%csub_fp()
1051 class(
bndtype),
pointer :: packobj
1058 call this%dis%dis_da()
1059 call this%ic%ic_da()
1060 call this%npf%npf_da()
1061 call this%xt3d%xt3d_da()
1062 call this%buy%buy_da()
1063 call this%vsc%vsc_da()
1064 call this%gnc%gnc_da()
1065 call this%sto%sto_da()
1066 call this%csub%csub_da()
1067 call this%budget%budget_da()
1068 call this%hfb%hfb_da()
1069 call this%mvr%mvr_da()
1070 call this%oc%oc_da()
1071 call this%obs%obs_da()
1074 deallocate (this%dis)
1075 deallocate (this%ic)
1076 deallocate (this%npf)
1077 deallocate (this%xt3d)
1078 deallocate (this%buy)
1079 deallocate (this%vsc)
1080 deallocate (this%gnc)
1081 deallocate (this%sto)
1082 deallocate (this%csub)
1083 deallocate (this%budget)
1084 deallocate (this%hfb)
1085 deallocate (this%mvr)
1086 deallocate (this%obs)
1087 deallocate (this%oc)
1090 do ip = 1, this%bndlist%Count()
1092 call packobj%bnd_da()
1093 deallocate (packobj)
1112 call this%NumericalModelType%model_da()
1126 real(DP),
dimension(:, :),
intent(in) :: budterm
1127 character(len=LENBUDTXT),
dimension(:),
intent(in) :: budtxt
1128 character(len=*),
intent(in) :: rowlabel
1130 call this%budget%addentry(budterm,
delt, budtxt, rowlabel=rowlabel)
1139 integer(I4B) :: iasym
1141 class(
bndtype),
pointer :: packobj
1147 if (this%innpf > 0)
then
1148 if (this%npf%iasym /= 0) iasym = 1
1149 if (this%npf%ixt3d /= 0) iasym = 1
1153 if (this%ingnc > 0)
then
1154 if (this%gnc%iasym /= 0) iasym = 1
1158 do ip = 1, this%bndlist%Count()
1160 if (packobj%iasym /= 0) iasym = 1
1171 character(len=*),
intent(in) :: modelname
1174 call this%NumericalModelType%allocate_scalars(modelname)
1179 call mem_allocate(this%innpf,
'INNPF', this%memoryPath)
1180 call mem_allocate(this%inbuy,
'INBUY', this%memoryPath)
1181 call mem_allocate(this%invsc,
'INVSC', this%memoryPath)
1182 call mem_allocate(this%insto,
'INSTO', this%memoryPath)
1183 call mem_allocate(this%incsub,
'INCSUB', this%memoryPath)
1184 call mem_allocate(this%inmvr,
'INMVR', this%memoryPath)
1185 call mem_allocate(this%inhfb,
'INHFB', this%memoryPath)
1186 call mem_allocate(this%ingnc,
'INGNC', this%memoryPath)
1187 call mem_allocate(this%inobs,
'INOBS', this%memoryPath)
1189 call mem_allocate(this%inewtonur,
'INEWTONUR', this%memoryPath)
1231 character(len=*),
intent(in) :: filtyp
1232 integer(I4B),
intent(in) :: ipakid
1233 integer(I4B),
intent(in) :: ipaknum
1234 character(len=*),
intent(in) :: pakname
1235 character(len=*),
intent(in) :: mempath
1236 integer(I4B),
intent(in) :: inunit
1237 integer(I4B),
intent(in) :: iout
1239 class(
bndtype),
pointer :: packobj
1240 class(
bndtype),
pointer :: packobj2
1244 select case (filtyp)
1246 call chd_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1249 call wel_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1252 call drn_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1255 call riv_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1258 call ghb_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1261 call rch_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1264 call evt_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1267 call maw_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
1269 call sfr_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
1271 call lak_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
1273 call uzf_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
1275 call api_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1278 write (
errmsg, *)
'Invalid package type: ', filtyp
1284 do ip = 1, this%bndlist%Count()
1286 if (packobj2%packName == pakname)
then
1287 write (
errmsg,
'(a,a)')
'Cannot create package. Package name '// &
1288 'already exists: ', trim(pakname)
1303 integer(I4B),
intent(in) :: indis
1307 if (this%inic == 0)
then
1309 'Initial Conditions (IC6) package not specified.'
1312 if (indis == 0)
then
1314 'Discretization (DIS6, DISV6, or DISU6) Package not specified.'
1317 if (this%innpf == 0)
then
1319 'Node Property Flow (NPF6) Package not specified.'
1324 write (
errmsg,
'(a)')
'One or more required package(s) not specified.'
1326 call store_error_filename(this%filename)
1334 class(*),
pointer,
intent(inout) :: model
1338 if (.not.
associated(model))
return
1354 integer(I4B),
dimension(:),
allocatable,
intent(inout) :: bndpkgs
1356 pointer,
intent(inout) :: pkgtypes
1358 pointer,
intent(inout) :: pkgnames
1360 pointer,
intent(inout) :: mempaths
1361 integer(I4B),
dimension(:),
contiguous, &
1362 pointer,
intent(inout) :: inunits
1364 integer(I4B) :: ipakid, ipaknum
1365 character(len=LENFTYPE) :: pkgtype, bndptype
1366 character(len=LENPACKAGENAME) :: pkgname
1367 character(len=LENMEMPATH) :: mempath
1368 integer(I4B),
pointer :: inunit
1371 if (
allocated(bndpkgs))
then
1376 do n = 1,
size(bndpkgs)
1378 pkgtype = pkgtypes(bndpkgs(n))
1379 pkgname = pkgnames(bndpkgs(n))
1380 mempath = mempaths(bndpkgs(n))
1381 inunit => inunits(bndpkgs(n))
1383 if (bndptype /= pkgtype)
then
1388 call this%package_create(pkgtype, ipakid, ipaknum, pkgname, mempath, &
1391 ipaknum = ipaknum + 1
1395 deallocate (bndpkgs)
1426 pointer :: pkgtypes => null()
1428 pointer :: pkgnames => null()
1430 pointer :: mempaths => null()
1431 integer(I4B),
dimension(:),
contiguous, &
1432 pointer :: inunits => null()
1433 character(len=LENMEMPATH) :: model_mempath
1434 character(len=LENFTYPE) :: pkgtype
1435 character(len=LENPACKAGENAME) :: pkgname
1436 character(len=LENMEMPATH) :: mempath
1437 integer(I4B),
pointer :: inunit
1438 integer(I4B),
dimension(:),
allocatable :: bndpkgs
1440 integer(I4B) :: indis = 0
1441 character(len=LENMEMPATH) :: mempathbuy =
''
1442 character(len=LENMEMPATH) :: mempathcsub =
''
1443 character(len=LENMEMPATH) :: mempathhfb =
''
1444 character(len=LENMEMPATH) :: mempathic =
''
1445 character(len=LENMEMPATH) :: mempathnpf =
''
1446 character(len=LENMEMPATH) :: mempathsto =
''
1447 character(len=LENMEMPATH) :: mempathvsc =
''
1453 call mem_setptr(pkgtypes,
'PKGTYPES', model_mempath)
1454 call mem_setptr(pkgnames,
'PKGNAMES', model_mempath)
1455 call mem_setptr(mempaths,
'MEMPATHS', model_mempath)
1456 call mem_setptr(inunits,
'INUNITS', model_mempath)
1458 do n = 1,
size(pkgtypes)
1461 pkgtype = pkgtypes(n)
1462 pkgname = pkgnames(n)
1463 mempath = mempaths(n)
1464 inunit => inunits(n)
1467 select case (pkgtype)
1470 call dis_cr(this%dis, this%name, mempath, indis, this%iout)
1473 call disv_cr(this%dis, this%name, mempath, indis, this%iout)
1476 call disu_cr(this%dis, this%name, mempath, indis, this%iout)
1479 mempathnpf = mempath
1482 mempathbuy = mempath
1485 mempathvsc = mempath
1490 mempathhfb = mempath
1493 mempathsto = mempath
1496 mempathcsub = mempath
1506 case (
'WEL6',
'DRN6',
'RIV6',
'GHB6',
'RCH6', &
1507 'EVT6',
'API6',
'CHD6',
'MAW6',
'SFR6', &
1510 bndpkgs(
size(bndpkgs)) = n
1517 call npf_cr(this%npf, this%name, mempathnpf, this%innpf, this%iout)
1518 call xt3d_cr(this%xt3d, this%name, this%innpf, this%iout)
1519 call buy_cr(this%buy, this%name, mempathbuy, this%inbuy, this%iout)
1520 call vsc_cr(this%vsc, this%name, mempathvsc, this%invsc, this%iout)
1521 call gnc_cr(this%gnc, this%name, this%ingnc, this%iout)
1522 call hfb_cr(this%hfb, this%name, mempathhfb, this%inhfb, this%iout)
1523 call sto_cr(this%sto, this%name, mempathsto, this%insto, this%iout)
1524 call csub_cr(this%csub, this%name, mempathcsub, this%insto, &
1525 this%sto%packName, this%incsub, this%iout)
1526 call ic_cr(this%ic, this%name, mempathic, this%inic, this%iout, this%dis)
1527 call mvr_cr(this%mvr, this%name, this%inmvr, this%iout, this%dis)
1528 call oc_cr(this%oc, this%name, this%inoc, this%iout)
1532 call this%ftype_check(indis)
1534 call this%create_bndpkgs(bndpkgs, pkgtypes, pkgnames, mempaths, inunits)
1544 write (this%iout,
'(1x,a)')
'NAMEFILE OPTIONS:'
1546 if (found%newton)
then
1547 write (this%iout,
'(4x,a)') &
1548 'NEWTON-RAPHSON method enabled for the model.'
1549 if (found%under_relaxation)
then
1550 write (this%iout,
'(4x,a,a)') &
1551 'NEWTON-RAPHSON UNDER-RELAXATION based on the bottom ', &
1552 'elevation of the model will be applied to the model.'
1556 if (found%print_input)
then
1557 write (this%iout,
'(4x,a)')
'STRESS PACKAGE INPUT WILL BE PRINTED '// &
1558 'FOR ALL MODEL STRESS PACKAGES'
1561 if (found%print_flows)
then
1562 write (this%iout,
'(4x,a)')
'PACKAGE FLOWS WILL BE PRINTED '// &
1563 'FOR ALL MODEL PACKAGES'
1566 if (found%save_flows)
then
1567 write (this%iout,
'(4x,a)') &
1568 'FLOWS WILL BE SAVED TO BUDGET FILE SPECIFIED IN OUTPUT CONTROL'
1571 write (this%iout,
'(1x,a)')
'END NAMEFILE OPTIONS:'
1589 if (this%iss == 1)
then
1591 write (
warnmsg,
'(a,a,a,i0,a)') &
1592 'GWF Model (', trim(this%name),
') is steady state for period ', &
1593 kper,
' and adaptive time stepping is active. Adaptive time &
1594 &stepping may not work properly for steady-state conditions.'
logical(lgp) function, public isadaptiveperiod(kper)
@ brief Determine if period is adaptive
This module contains the API package methods.
subroutine, public api_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
@ brief Create a new package object
subroutine, public addbasemodeltolist(list, model)
This module contains the base boundary package.
subroutine, public addbndtolist(list, bnd)
Add boundary to package list.
class(bndtype) function, pointer, public getbndfromlist(list, idx)
Get boundary from package list.
This module contains the BudgetModule.
subroutine, public budget_cr(this, name_model)
@ brief Create a new budget object
subroutine, public chd_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a new constant head package.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lenpackagename
maximum length of the package name
real(dp), parameter dp9
real constant 9/10
integer(i4b), parameter lenpackagetype
maximum length of a package type (DIS6, SFR6, CSUB6, etc.)
integer(i4b), parameter lenpakloc
maximum length of a package location
integer(i4b), parameter lenftype
maximum length of a package type (DIS, WEL, OC, etc.)
real(dp), parameter dzero
real constant zero
real(dp), parameter dten
real constant 10
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
integer(i4b), parameter lenmempath
maximum length of the memory path
real(dp), parameter done
real constant 1
subroutine, public dis_cr(dis, name_model, input_mempath, inunit, iout)
Create a new structured discretization object.
subroutine, public disu_cr(dis, name_model, input_mempath, inunit, iout)
Create a new unstructured discretization object.
subroutine, public disv_cr(dis, name_model, input_mempath, inunit, iout)
Create a new discretization by vertices object.
subroutine, public drn_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a New Drn Package and point packobj to the new package.
subroutine, public evt_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a new Evapotranspiration Segments Package and point pakobj to the new package.
subroutine, public ghb_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a New Ghb Package and point bndobj to the new package.
subroutine, public gnc_cr(gncobj, name_parent, inunit, iout)
Create new GNC exchange object.
subroutine, public buy_cr(buyobj, name_model, input_mempath, inunit, iout)
Create a new BUY object.
This module contains the CSUB package methods.
subroutine, public csub_cr(csubobj, name_model, mempath, istounit, stoPckName, inunit, iout)
@ brief Create a new package object
subroutine, public hfb_cr(hfbobj, name_model, input_mempath, inunit, iout)
Create a new hfb object.
subroutine, public ic_cr(ic, name_model, input_mempath, inunit, iout, dis)
Create a new initial conditions object.
subroutine gwf_df(this)
Define packages of the model.
subroutine, public gwf_cr(filename, id, modelname)
Create a new groundwater flow model object.
subroutine gwf_ptcchk(this, iptc)
check if pseudo-transient continuation factor should be used
subroutine log_namfile_options(this, found)
Write model namfile options to list file.
subroutine gwf_ptc(this, vec_residual, iptc, ptcf)
calculate maximum pseudo-transient continuation factor
subroutine allocate_scalars(this, modelname)
Allocate memory for non-allocatable members.
subroutine gwf_ot_flow(this, icbcfl, ibudfl, icbcun)
Groundwater Flow Model output flows.
integer(i4b) function gwf_get_iasym(this)
return 1 if any package causes the matrix to be asymmetric. Otherwise return 0.
subroutine gwf_da(this)
Deallocate.
subroutine create_packages(this)
Source package info and begin to process.
subroutine gwf_mc(this, matrix_sln)
Map the positions of this models connections in the numerical solution coefficient matrix.
subroutine gwf_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
GroundWater Flow Model Final Convergence Check for Boundary Packages.
subroutine gwf_rp(this)
GroundWater Flow Model Read and Prepare.
subroutine steady_period_check(this)
Check for steady state period.
class(gwfmodeltype) function, pointer, public castasgwfmodel(model)
Cast to GWF model.
subroutine package_create(this, filtyp, ipakid, ipaknum, pakname, mempath, inunit, iout)
Create boundary condition packages for this model.
subroutine gwf_ot_dv(this, idvsave, idvprint, ipflag)
Groundwater Flow Model output dependent variable.
integer(i4b), parameter, public gwf_nmultipkg
GWF multi package array descriptors.
subroutine create_bndpkgs(this, bndpkgs, pkgtypes, pkgnames, mempaths, inunits)
Source package info and begin to process.
subroutine gwf_ot(this)
GroundWater Flow Model Output.
character(len=lenpackagetype), dimension(gwf_nmultipkg), public gwf_multipkg
subroutine gwf_cf(this, kiter)
GroundWater Flow Model calculate coefficients.
integer(i4b), parameter niunit_gwf
subroutine gwf_ot_obs(this)
GroundWater Flow Model output observations.
subroutine gwf_fp(this)
Final processing.
subroutine gwf_ot_bdsummary(this, ibudfl, ipflag)
Groundwater Flow Model output budget summary.
subroutine gwf_ac(this, sparse)
Add the internal connections of this model to the sparse matrix.
subroutine gwf_fc(this, kiter, matrix_sln, inwtflag)
GroundWater Flow Model fill coefficients.
subroutine gwf_ar(this)
GroundWater Flow Model Allocate and Read.
subroutine gwf_bdentry(this, budterm, budtxt, rowlabel)
GroundWater Flow Model Budget Entry.
subroutine gwf_nur(this, neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
under-relaxation
subroutine gwf_ad(this)
GroundWater Flow Model Time Step Advance.
subroutine gwf_cq(this, icnvg, isuppress_output)
Groundwater flow model calculate flow.
subroutine gwf_bd(this, icnvg, isuppress_output)
GroundWater Flow Model Budget.
integer(i4b), parameter, public gwf_nbasepkg
GWF base package array descriptors.
character(len=lenpackagetype), dimension(gwf_nbasepkg), public gwf_basepkg
subroutine ftype_check(this, indis)
Check to make sure required input files have been specified.
subroutine, public mvr_cr(mvrobj, name_parent, inunit, iout, dis, iexgmvr)
Create a new mvr object.
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, public gwf_obs_cr(obs, inobs)
Create a new GwfObsType object.
subroutine, public oc_cr(ocobj, name_model, inunit, iout)
@ brief Create GwfOcType
This module contains the storage package methods.
subroutine, public sto_cr(stoobj, name_model, mempath, inunit, iout)
@ brief Create a new package object
subroutine, public vsc_cr(vscobj, name_model, input_mempath, inunit, iout)
@ brief Create a new package object
This module defines variable data types.
subroutine, public lak_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname)
Create a new LAK Package and point bndobj to the new package.
type(listtype), public basemodellist
subroutine, public maw_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname)
Create a New Multi-Aquifer Well (MAW) Package.
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 rch_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a New Recharge Package.
subroutine, public riv_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a New Riv Package and point packobj to the new package.
This module contains the SFR package methods.
subroutine, public sfr_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname)
@ brief Create a new package object
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
integer(i4b) isimcheck
simulation input check flag (1) to check input, (0) to ignore checks
integer(i4b) ifailedstepretry
current retry for this time step
character(len=maxcharlen) warnmsg
warning message string
subroutine csr_diagsum(ia, flowja)
logical(lgp), pointer, public endofperiod
flag indicating end of stress period
subroutine, public tdis_ot(iout)
Print simulation time.
real(dp), pointer, public totim
time relative to start of simulation
logical(lgp), pointer, public readnewdata
flag indicating time to read new data
integer(i4b), pointer, public kstp
current time step number
integer(i4b), pointer, public kper
current stress period number
real(dp), pointer, public delt
length of the current time step
subroutine, public uzf_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname)
Create a New UZF Package and point packobj to the new package.
This module contains the WEL package methods.
subroutine, public wel_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
@ brief Create a new package object
subroutine, public xt3d_cr(xt3dobj, name_model, inunit, iout, ldispopt)
Create a new xt3d object.
Highest level model type. All models extend this parent type.
Derived type for the Budget object.
This class is used to store a single deferred-length character string. It was designed to work in an ...
@ brief Output control for GWF