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_log()
385 call packobj%bnd_rp_obs()
389 call this%steady_period_check()
402 class(
bndtype),
pointer :: packobj
404 integer(I4B) :: irestore
405 integer(I4B) :: ip, n
410 if (irestore == 0)
then
413 do n = 1, this%dis%nodes
414 this%xold(n) = this%x(n)
419 do n = 1, this%dis%nodes
420 this%x(n) = this%xold(n)
425 if (this%invsc > 0)
call this%vsc%vsc_ad()
426 if (this%innpf > 0)
call this%npf%npf_ad(this%dis%nodes, this%xold, &
428 if (this%insto > 0)
call this%sto%sto_ad()
429 if (this%incsub > 0)
call this%csub%csub_ad(this%dis%nodes, this%x)
430 if (this%inbuy > 0)
call this%buy%buy_ad()
431 if (this%inmvr > 0)
call this%mvr%mvr_ad()
432 do ip = 1, this%bndlist%Count()
434 call packobj%bnd_ad()
435 if (this%invsc > 0)
call this%vsc%vsc_ad_bnd(packobj, this%x)
437 call packobj%bnd_ck()
442 call this%obs%obs_ad()
450 integer(I4B),
intent(in) :: kiter
452 class(
bndtype),
pointer :: packobj
456 if (this%innpf > 0)
call this%npf%npf_cf(kiter, this%dis%nodes, this%x)
457 if (this%inbuy > 0)
call this%buy%buy_cf(kiter)
458 do ip = 1, this%bndlist%Count()
460 call packobj%bnd_cf()
461 if (this%inbuy > 0)
call this%buy%buy_cf_bnd(packobj, this%x)
467 subroutine gwf_fc(this, kiter, matrix_sln, inwtflag)
470 integer(I4B),
intent(in) :: kiter
472 integer(I4B),
intent(in) :: inwtflag
474 class(
bndtype),
pointer :: packobj
476 integer(I4B) :: inwt, inwtsto, inwtcsub, inwtpak
480 if (inwtflag == 1) inwt = this%npf%inewton
482 if (this%insto > 0)
then
483 if (inwtflag == 1) inwtsto = this%sto%inewton
486 if (this%incsub > 0)
then
487 if (inwtflag == 1) inwtcsub = this%csub%inewton
491 if (this%innpf > 0)
call this%npf%npf_fc(kiter, matrix_sln, this%idxglo, &
493 if (this%inbuy > 0)
call this%buy%buy_fc(kiter, matrix_sln, this%idxglo, &
495 if (this%inhfb > 0)
call this%hfb%hfb_fc(kiter, matrix_sln, this%idxglo, &
497 if (this%ingnc > 0)
call this%gnc%gnc_fc(kiter, matrix_sln)
499 if (this%insto > 0)
then
500 call this%sto%sto_fc(kiter, this%xold, this%x, matrix_sln, &
501 this%idxglo, this%rhs)
504 if (this%incsub > 0)
then
505 call this%csub%csub_fc(kiter, this%xold, this%x, matrix_sln, &
506 this%idxglo, this%rhs)
508 if (this%inmvr > 0)
call this%mvr%mvr_fc()
509 do ip = 1, this%bndlist%Count()
511 call packobj%bnd_fc(this%rhs, this%ia, this%idxglo, matrix_sln)
515 if (this%innpf > 0)
then
517 call this%npf%npf_fn(kiter, matrix_sln, this%idxglo, this%rhs, this%x)
522 if (this%ingnc > 0)
then
524 call this%gnc%gnc_fn(kiter, matrix_sln, this%npf%condsat, &
525 ivarcv_opt=this%npf%ivarcv, &
526 ictm1_opt=this%npf%icelltype, &
527 ictm2_opt=this%npf%icelltype)
532 if (this%insto > 0)
then
533 if (inwtsto /= 0)
then
534 call this%sto%sto_fn(kiter, this%xold, this%x, matrix_sln, &
535 this%idxglo, this%rhs)
540 if (this%incsub > 0)
then
541 if (inwtcsub /= 0)
then
542 call this%csub%csub_fn(kiter, this%xold, this%x, matrix_sln, &
543 this%idxglo, this%rhs)
548 do ip = 1, this%bndlist%Count()
551 if (inwtflag == 1) inwtpak = packobj%inewton
552 if (inwtpak /= 0)
then
553 call packobj%bnd_fn(this%rhs, this%ia, this%idxglo, matrix_sln)
563 subroutine gwf_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
566 integer(I4B),
intent(in) :: innertot
567 integer(I4B),
intent(in) :: kiter
568 integer(I4B),
intent(in) :: iend
569 integer(I4B),
intent(in) :: icnvgmod
570 character(len=LENPAKLOC),
intent(inout) :: cpak
571 integer(I4B),
intent(inout) :: ipak
572 real(DP),
intent(inout) :: dpak
574 class(
bndtype),
pointer :: packobj
579 if (this%inmvr > 0)
then
580 call this%mvr%mvr_cc(innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
584 if (this%incsub > 0)
then
585 call this%csub%csub_cc(innertot, kiter, iend, icnvgmod, &
586 this%dis%nodes, this%x, this%xold, &
591 do ip = 1, this%bndlist%Count()
593 call packobj%bnd_cc(innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
605 integer(I4B),
intent(inout) :: iptc
611 if (this%iss > 0)
then
612 if (this%inewton > 0)
then
615 iptc = this%npf%inewton
626 subroutine gwf_ptc(this, vec_residual, iptc, ptcf)
633 integer(I4B),
intent(inout) :: iptc
634 real(DP),
intent(inout) :: ptcf
637 integer(I4B) :: iptct
640 real(DP) :: ptcdelem1
647 if (this%iss > 0)
then
648 if (this%inewton > 0)
then
651 iptct = this%npf%inewton
659 do n = 1, this%dis%nodes
660 if (this%npf%ibound(n) < 1) cycle
663 v = this%dis%get_cell_volume(n, this%dis%top(n))
666 resid = vec_residual%get_value_local(n)
670 ptcdelem1 = abs(resid) / v
675 if (ptcdelem1 > ptcf) ptcf = ptcdelem1
679 if (ptcf == dzero)
then
686 if (iptct > 0) iptc = 1
697 subroutine gwf_nur(this, neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
702 integer(I4B),
intent(in) :: neqmod
703 real(DP),
dimension(neqmod),
intent(inout) :: x
704 real(DP),
dimension(neqmod),
intent(in) :: xtemp
705 real(DP),
dimension(neqmod),
intent(inout) :: dx
706 integer(I4B),
intent(inout) :: inewtonur
707 real(DP),
intent(inout) :: dxmax
708 integer(I4B),
intent(inout) :: locmax
712 class(
bndtype),
pointer :: packobj
718 if (this%inewton /= 0 .and. this%inewtonur /= 0)
then
719 if (this%innpf > 0)
then
720 call this%npf%npf_nur(neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
724 i0 = this%dis%nodes + 1
725 do ip = 1, this%bndlist%Count()
727 if (packobj%npakeq > 0)
then
728 i1 = i0 + packobj%npakeq - 1
729 call packobj%bnd_nur(packobj%npakeq, x(i0:i1), xtemp(i0:i1), &
730 dx(i0:i1), inewtonur, dxmax, locmax)
742 subroutine gwf_cq(this, icnvg, isuppress_output)
746 integer(I4B),
intent(in) :: icnvg
747 integer(I4B),
intent(in) :: isuppress_output
751 class(
bndtype),
pointer :: packobj
759 this%flowja(i) =
dzero
761 if (this%innpf > 0)
call this%npf%npf_cq(this%x, this%flowja)
762 if (this%inbuy > 0)
call this%buy%buy_cq(this%x, this%flowja)
763 if (this%inhfb > 0)
call this%hfb%hfb_cq(this%x, this%flowja)
764 if (this%ingnc > 0)
call this%gnc%gnc_cq(this%flowja)
765 if (this%insto > 0)
call this%sto%sto_cq(this%flowja, this%x, this%xold)
766 if (this%incsub > 0)
call this%csub%csub_cq(this%dis%nodes, this%x, &
767 this%xold, isuppress_output, &
773 do ip = 1, this%bndlist%Count()
775 call packobj%bnd_cf()
776 if (this%inbuy > 0)
call this%buy%buy_cf_bnd(packobj, this%x)
777 call packobj%bnd_cq(this%x, this%flowja)
786 subroutine gwf_bd(this, icnvg, isuppress_output)
791 integer(I4B),
intent(in) :: icnvg
792 integer(I4B),
intent(in) :: isuppress_output
795 class(
bndtype),
pointer :: packobj
809 call this%budget%reset()
810 if (this%insto > 0)
call this%sto%sto_bd(isuppress_output, this%budget)
811 if (this%incsub > 0)
call this%csub%csub_bd(isuppress_output, this%budget)
812 if (this%inmvr > 0)
call this%mvr%mvr_bd()
813 do ip = 1, this%bndlist%Count()
815 call packobj%bnd_bd(this%budget)
820 if (this%innpf > 0)
then
821 if (this%npf%icalcspdis /= 0)
then
822 call this%npf%calc_spdis(this%flowja)
835 integer(I4B) :: idvsave
836 integer(I4B) :: idvprint
837 integer(I4B) :: icbcfl
838 integer(I4B) :: icbcun
839 integer(I4B) :: ibudfl
840 integer(I4B) :: ipflag
842 character(len=*),
parameter :: fmtnocnvg = &
843 "(1X,/9X,'****FAILED TO MEET SOLVER CONVERGENCE CRITERIA IN TIME STEP ', &
844 &I0,' OF STRESS PERIOD ',I0,'****')"
851 if (this%oc%oc_save(
'HEAD')) idvsave = 1
852 if (this%oc%oc_print(
'HEAD')) idvprint = 1
853 if (this%oc%oc_save(
'BUDGET')) icbcfl = 1
854 if (this%oc%oc_print(
'BUDGET')) ibudfl = 1
855 icbcun = this%oc%oc_save_unit(
'BUDGET')
859 ibudfl = this%oc%set_print_flag(
'BUDGET', this%icnvg,
endofperiod)
860 idvprint = this%oc%set_print_flag(
'HEAD', this%icnvg,
endofperiod)
863 call this%gwf_ot_obs()
866 call this%gwf_ot_flow(icbcfl, ibudfl, icbcun)
869 call this%gwf_ot_dv(idvsave, idvprint, ipflag)
872 call this%gwf_ot_bdsummary(ibudfl, ipflag)
876 if (ipflag == 1)
call tdis_ot(this%iout)
879 if (this%icnvg == 0)
then
880 write (this%iout, fmtnocnvg)
kstp,
kper
888 class(
bndtype),
pointer :: packobj
892 call this%obs%obs_bd()
893 call this%obs%obs_ot()
896 if (this%incsub > 0)
then
897 call this%csub%csub_bd_obs()
898 call this%csub%obs%obs_ot()
902 do ip = 1, this%bndlist%Count()
904 call packobj%bnd_bd_obs()
905 call packobj%bnd_ot_obs()
914 integer(I4B),
intent(in) :: icbcfl
915 integer(I4B),
intent(in) :: ibudfl
916 integer(I4B),
intent(in) :: icbcun
917 class(
bndtype),
pointer :: packobj
921 if (this%insto > 0)
then
922 call this%sto%sto_save_model_flows(icbcfl, icbcun)
924 if (this%innpf > 0)
then
925 call this%npf%npf_save_model_flows(this%flowja, icbcfl, icbcun)
927 if (this%incsub > 0)
call this%csub%csub_save_model_flows(icbcfl, icbcun)
928 do ip = 1, this%bndlist%Count()
930 call packobj%bnd_ot_model_flows(icbcfl=icbcfl, ibudfl=0, icbcun=icbcun)
934 do ip = 1, this%bndlist%Count()
936 call packobj%bnd_ot_package_flows(icbcfl=icbcfl, ibudfl=0)
938 if (this%inmvr > 0)
then
939 call this%mvr%mvr_ot_saveflow(icbcfl, ibudfl)
943 if (this%innpf > 0)
call this%npf%npf_print_model_flows(ibudfl, this%flowja)
944 if (this%ingnc > 0)
call this%gnc%gnc_ot(ibudfl)
945 do ip = 1, this%bndlist%Count()
947 call packobj%bnd_ot_model_flows(icbcfl=icbcfl, ibudfl=ibudfl, icbcun=0)
951 do ip = 1, this%bndlist%Count()
953 call packobj%bnd_ot_package_flows(icbcfl=0, ibudfl=ibudfl)
955 if (this%inmvr > 0)
then
956 call this%mvr%mvr_ot_printflow(icbcfl, ibudfl)
965 integer(I4B),
intent(in) :: idvsave
966 integer(I4B),
intent(in) :: idvprint
967 integer(I4B),
intent(inout) :: ipflag
968 class(
bndtype),
pointer :: packobj
972 if (this%incsub > 0)
call this%csub%csub_ot_dv(idvsave, idvprint)
975 if (this%inbuy > 0)
then
976 call this%buy%buy_ot_dv(idvsave)
980 if (this%invsc > 0)
then
981 call this%vsc%vsc_ot_dv(idvsave)
985 do ip = 1, this%bndlist%Count()
987 call packobj%bnd_ot_dv(idvsave, idvprint)
991 call this%oc%oc_ot(ipflag)
999 integer(I4B),
intent(in) :: ibudfl
1000 integer(I4B),
intent(inout) :: ipflag
1001 class(
bndtype),
pointer :: packobj
1005 do ip = 1, this%bndlist%Count()
1007 call packobj%bnd_ot_bdsummary(
kstp,
kper, this%iout, ibudfl)
1011 if (this%inmvr > 0)
then
1012 call this%mvr%mvr_ot_bdsummary(ibudfl)
1016 call this%budget%finalize_step(
delt)
1017 if (ibudfl /= 0)
then
1019 call this%budget%budget_ot(
kstp,
kper, this%iout)
1023 call this%budget%writecsv(
totim)
1036 if (this%incsub > 0)
then
1037 call this%csub%csub_fp()
1052 class(
bndtype),
pointer :: packobj
1059 call this%dis%dis_da()
1060 call this%ic%ic_da()
1061 call this%npf%npf_da()
1062 call this%xt3d%xt3d_da()
1063 call this%buy%buy_da()
1064 call this%vsc%vsc_da()
1065 call this%gnc%gnc_da()
1066 call this%sto%sto_da()
1067 call this%csub%csub_da()
1068 call this%budget%budget_da()
1069 call this%hfb%hfb_da()
1070 call this%mvr%mvr_da()
1071 call this%oc%oc_da()
1072 call this%obs%obs_da()
1075 deallocate (this%dis)
1076 deallocate (this%ic)
1077 deallocate (this%npf)
1078 deallocate (this%xt3d)
1079 deallocate (this%buy)
1080 deallocate (this%vsc)
1081 deallocate (this%gnc)
1082 deallocate (this%sto)
1083 deallocate (this%csub)
1084 deallocate (this%budget)
1085 deallocate (this%hfb)
1086 deallocate (this%mvr)
1087 deallocate (this%obs)
1088 deallocate (this%oc)
1091 do ip = 1, this%bndlist%Count()
1093 call packobj%bnd_da()
1094 deallocate (packobj)
1113 call this%NumericalModelType%model_da()
1127 real(DP),
dimension(:, :),
intent(in) :: budterm
1128 character(len=LENBUDTXT),
dimension(:),
intent(in) :: budtxt
1129 character(len=*),
intent(in) :: rowlabel
1131 call this%budget%addentry(budterm,
delt, budtxt, rowlabel=rowlabel)
1140 integer(I4B) :: iasym
1142 class(
bndtype),
pointer :: packobj
1148 if (this%innpf > 0)
then
1149 if (this%npf%iasym /= 0) iasym = 1
1150 if (this%npf%ixt3d /= 0) iasym = 1
1154 if (this%ingnc > 0)
then
1155 if (this%gnc%iasym /= 0) iasym = 1
1159 do ip = 1, this%bndlist%Count()
1161 if (packobj%iasym /= 0) iasym = 1
1172 character(len=*),
intent(in) :: modelname
1175 call this%NumericalModelType%allocate_scalars(modelname)
1180 call mem_allocate(this%innpf,
'INNPF', this%memoryPath)
1181 call mem_allocate(this%inbuy,
'INBUY', this%memoryPath)
1182 call mem_allocate(this%invsc,
'INVSC', this%memoryPath)
1183 call mem_allocate(this%insto,
'INSTO', this%memoryPath)
1184 call mem_allocate(this%incsub,
'INCSUB', this%memoryPath)
1185 call mem_allocate(this%inmvr,
'INMVR', this%memoryPath)
1186 call mem_allocate(this%inhfb,
'INHFB', this%memoryPath)
1187 call mem_allocate(this%ingnc,
'INGNC', this%memoryPath)
1188 call mem_allocate(this%inobs,
'INOBS', this%memoryPath)
1190 call mem_allocate(this%inewtonur,
'INEWTONUR', this%memoryPath)
1232 character(len=*),
intent(in) :: filtyp
1233 integer(I4B),
intent(in) :: ipakid
1234 integer(I4B),
intent(in) :: ipaknum
1235 character(len=*),
intent(in) :: pakname
1236 character(len=*),
intent(in) :: mempath
1237 integer(I4B),
intent(in) :: inunit
1238 integer(I4B),
intent(in) :: iout
1240 class(
bndtype),
pointer :: packobj
1241 class(
bndtype),
pointer :: packobj2
1245 select case (filtyp)
1247 call chd_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1250 call wel_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1253 call drn_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1256 call riv_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1259 call ghb_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1262 call rch_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1265 call evt_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1268 call maw_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
1270 call sfr_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
1272 call lak_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
1274 call uzf_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
1276 call api_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1279 write (
errmsg, *)
'Invalid package type: ', filtyp
1285 do ip = 1, this%bndlist%Count()
1287 if (packobj2%packName == pakname)
then
1288 write (
errmsg,
'(a,a)')
'Cannot create package. Package name '// &
1289 'already exists: ', trim(pakname)
1304 integer(I4B),
intent(in) :: indis
1308 if (this%inic == 0)
then
1310 'Initial Conditions (IC6) package not specified.'
1313 if (indis == 0)
then
1315 'Discretization (DIS6, DISV6, or DISU6) Package not specified.'
1318 if (this%innpf == 0)
then
1320 'Node Property Flow (NPF6) Package not specified.'
1325 write (
errmsg,
'(a)')
'One or more required package(s) not specified.'
1327 call store_error_filename(this%filename)
1335 class(*),
pointer,
intent(inout) :: model
1339 if (.not.
associated(model))
return
1355 integer(I4B),
dimension(:),
allocatable,
intent(inout) :: bndpkgs
1357 pointer,
intent(inout) :: pkgtypes
1359 pointer,
intent(inout) :: pkgnames
1361 pointer,
intent(inout) :: mempaths
1362 integer(I4B),
dimension(:),
contiguous, &
1363 pointer,
intent(inout) :: inunits
1365 integer(I4B) :: ipakid, ipaknum
1366 character(len=LENFTYPE) :: pkgtype, bndptype
1367 character(len=LENPACKAGENAME) :: pkgname
1368 character(len=LENMEMPATH) :: mempath
1369 integer(I4B),
pointer :: inunit
1372 if (
allocated(bndpkgs))
then
1377 do n = 1,
size(bndpkgs)
1379 pkgtype = pkgtypes(bndpkgs(n))
1380 pkgname = pkgnames(bndpkgs(n))
1381 mempath = mempaths(bndpkgs(n))
1382 inunit => inunits(bndpkgs(n))
1384 if (bndptype /= pkgtype)
then
1389 call this%package_create(pkgtype, ipakid, ipaknum, pkgname, mempath, &
1392 ipaknum = ipaknum + 1
1396 deallocate (bndpkgs)
1427 pointer :: pkgtypes => null()
1429 pointer :: pkgnames => null()
1431 pointer :: mempaths => null()
1432 integer(I4B),
dimension(:),
contiguous, &
1433 pointer :: inunits => null()
1434 character(len=LENMEMPATH) :: model_mempath
1435 character(len=LENFTYPE) :: pkgtype
1436 character(len=LENPACKAGENAME) :: pkgname
1437 character(len=LENMEMPATH) :: mempath
1438 integer(I4B),
pointer :: inunit
1439 integer(I4B),
dimension(:),
allocatable :: bndpkgs
1441 integer(I4B) :: indis = 0
1442 character(len=LENMEMPATH) :: mempathbuy =
''
1443 character(len=LENMEMPATH) :: mempathcsub =
''
1444 character(len=LENMEMPATH) :: mempathhfb =
''
1445 character(len=LENMEMPATH) :: mempathic =
''
1446 character(len=LENMEMPATH) :: mempathnpf =
''
1447 character(len=LENMEMPATH) :: mempathoc =
''
1448 character(len=LENMEMPATH) :: mempathsto =
''
1449 character(len=LENMEMPATH) :: mempathvsc =
''
1455 call mem_setptr(pkgtypes,
'PKGTYPES', model_mempath)
1456 call mem_setptr(pkgnames,
'PKGNAMES', model_mempath)
1457 call mem_setptr(mempaths,
'MEMPATHS', model_mempath)
1458 call mem_setptr(inunits,
'INUNITS', model_mempath)
1460 do n = 1,
size(pkgtypes)
1463 pkgtype = pkgtypes(n)
1464 pkgname = pkgnames(n)
1465 mempath = mempaths(n)
1466 inunit => inunits(n)
1469 select case (pkgtype)
1472 call dis_cr(this%dis, this%name, mempath, indis, this%iout)
1475 call disv_cr(this%dis, this%name, mempath, indis, this%iout)
1478 call disu_cr(this%dis, this%name, mempath, indis, this%iout)
1481 mempathnpf = mempath
1484 mempathbuy = mempath
1487 mempathvsc = mempath
1492 mempathhfb = mempath
1495 mempathsto = mempath
1498 mempathcsub = mempath
1509 case (
'WEL6',
'DRN6',
'RIV6',
'GHB6',
'RCH6', &
1510 'EVT6',
'API6',
'CHD6',
'MAW6',
'SFR6', &
1513 bndpkgs(
size(bndpkgs)) = n
1520 call npf_cr(this%npf, this%name, mempathnpf, this%innpf, this%iout)
1521 call xt3d_cr(this%xt3d, this%name, this%innpf, this%iout)
1522 call buy_cr(this%buy, this%name, mempathbuy, this%inbuy, this%iout)
1523 call vsc_cr(this%vsc, this%name, mempathvsc, this%invsc, this%iout)
1524 call gnc_cr(this%gnc, this%name, this%ingnc, this%iout)
1525 call hfb_cr(this%hfb, this%name, mempathhfb, this%inhfb, this%iout)
1526 call sto_cr(this%sto, this%name, mempathsto, this%insto, this%iout)
1527 call csub_cr(this%csub, this%name, mempathcsub, this%insto, &
1528 this%sto%packName, this%incsub, this%iout)
1529 call ic_cr(this%ic, this%name, mempathic, this%inic, this%iout, this%dis)
1530 call mvr_cr(this%mvr, this%name, this%inmvr, this%iout, this%dis)
1531 call oc_cr(this%oc, this%name, mempathoc, this%inoc, this%iout)
1535 call this%ftype_check(indis)
1537 call this%create_bndpkgs(bndpkgs, pkgtypes, pkgnames, mempaths, inunits)
1547 write (this%iout,
'(1x,a)')
'NAMEFILE OPTIONS:'
1549 if (found%newton)
then
1550 write (this%iout,
'(4x,a)') &
1551 'NEWTON-RAPHSON method enabled for the model.'
1552 if (found%under_relaxation)
then
1553 write (this%iout,
'(4x,a,a)') &
1554 'NEWTON-RAPHSON UNDER-RELAXATION based on the bottom ', &
1555 'elevation of the model will be applied to the model.'
1559 if (found%print_input)
then
1560 write (this%iout,
'(4x,a)')
'STRESS PACKAGE INPUT WILL BE PRINTED '// &
1561 'FOR ALL MODEL STRESS PACKAGES'
1564 if (found%print_flows)
then
1565 write (this%iout,
'(4x,a)')
'PACKAGE FLOWS WILL BE PRINTED '// &
1566 'FOR ALL MODEL PACKAGES'
1569 if (found%save_flows)
then
1570 write (this%iout,
'(4x,a)') &
1571 'FLOWS WILL BE SAVED TO BUDGET FILE SPECIFIED IN OUTPUT CONTROL'
1574 write (this%iout,
'(1x,a)')
'END NAMEFILE OPTIONS:'
1592 if (this%iss == 1)
then
1594 write (
warnmsg,
'(a,a,a,i0,a)') &
1595 'GWF Model (', trim(this%name),
') is steady state for period ', &
1596 kper,
' and adaptive time stepping is active. Adaptive time &
1597 &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, input_mempath, 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