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()
108 character(len=LENPACKAGETYPE),
dimension(GWF_NBASEPKG) ::
gwf_basepkg
109 data gwf_basepkg/
'DIS6 ',
'DISV6',
'DISU6',
' ',
' ', &
110 &
'NPF6 ',
'BUY6 ',
'VSC6 ',
'GNC6 ',
' ', &
111 &
'HFB6 ',
'STO6 ',
'IC6 ',
'CSUB6',
' ', &
112 &
'MVR6 ',
'OC6 ',
'OBS6 ',
' ',
' ', &
121 character(len=LENPACKAGETYPE),
dimension(GWF_NMULTIPKG) ::
gwf_multipkg
122 data gwf_multipkg/
'WEL6 ',
'DRN6 ',
'RIV6 ',
'GHB6 ',
' ', &
123 &
'RCH6 ',
'EVT6 ',
'CHD6 ',
' ',
' ', &
124 &
'MAW6 ',
'SFR6 ',
'LAK6 ',
'UZF6 ',
'API6 ', &
138 subroutine gwf_cr(filename, id, modelname)
149 character(len=*),
intent(in) :: filename
150 integer(I4B),
intent(in) :: id
151 character(len=*),
intent(in) :: modelname
155 character(len=LENMEMPATH) :: input_mempath
156 character(len=LINELENGTH) :: lst_fname
166 call this%allocate_scalars(modelname)
171 this%filename = filename
172 this%name = modelname
173 this%macronym =
'GWF'
180 call mem_set_value(lst_fname,
'LIST', input_mempath, found%list)
181 call mem_set_value(this%inewton,
'NEWTON', input_mempath, found%newton)
182 call mem_set_value(this%inewtonur,
'UNDER_RELAXATION', input_mempath, &
183 found%under_relaxation)
184 call mem_set_value(this%iprpak,
'PRINT_INPUT', input_mempath, &
186 call mem_set_value(this%iprflow,
'PRINT_FLOWS', input_mempath, &
188 call mem_set_value(this%ipakcb,
'SAVE_FLOWS', input_mempath, found%save_flows)
191 call this%create_lstfile(lst_fname, filename, found%list, &
192 'GROUNDWATER FLOW MODEL (GWF)')
195 if (found%save_flows)
then
200 if (this%iout > 0)
then
201 call this%log_namfile_options(found)
208 call this%create_packages()
223 class(
bndtype),
pointer :: packobj
226 call this%dis%dis_df()
227 call this%npf%npf_df(this%dis, this%xt3d, this%ingnc, this%invsc)
229 call this%budget%budget_df(
niunit_gwf,
'VOLUME',
'L**3')
230 if (this%inbuy > 0)
call this%buy%buy_df(this%dis)
231 if (this%invsc > 0)
call this%vsc%vsc_df(this%dis)
232 if (this%ingnc > 0)
call this%gnc%gnc_df(this)
236 this%neq = this%dis%nodes
237 this%nja = this%dis%nja
238 this%ia => this%dis%con%ia
239 this%ja => this%dis%con%ja
242 call this%allocate_arrays()
245 do ip = 1, this%bndlist%Count()
247 call packobj%bnd_df(this%neq, this%dis)
251 call this%obs%obs_df(this%iout, this%name,
'GWF', this%dis)
263 class(
bndtype),
pointer :: packobj
267 call this%dis%dis_ac(this%moffset, sparse)
270 if (this%innpf > 0)
call this%npf%npf_ac(this%moffset, sparse)
273 do ip = 1, this%bndlist%Count()
275 call packobj%bnd_ac(this%moffset, sparse)
279 if (this%ingnc > 0)
call this%gnc%gnc_ac(sparse)
290 class(
bndtype),
pointer :: packobj
295 call this%dis%dis_mc(this%moffset, this%idxglo, matrix_sln)
298 if (this%innpf > 0)
call this%npf%npf_mc(this%moffset, matrix_sln)
301 do ip = 1, this%bndlist%Count()
303 call packobj%bnd_mc(this%moffset, matrix_sln)
308 if (this%ingnc > 0)
call this%gnc%gnc_mc(matrix_sln)
322 class(
bndtype),
pointer :: packobj
325 if (this%inic > 0)
call this%ic%ic_ar(this%x)
326 if (this%innpf > 0)
call this%npf%npf_ar(this%ic, this%vsc, this%ibound, &
328 if (this%invsc > 0)
call this%vsc%vsc_ar(this%ibound)
329 if (this%inbuy > 0)
call this%buy%buy_ar(this%npf, this%ibound)
330 if (this%inhfb > 0)
call this%hfb%hfb_ar(this%ibound, this%xt3d, this%dis, &
331 this%invsc, this%vsc)
332 if (this%insto > 0)
call this%sto%sto_ar(this%dis, this%ibound)
333 if (this%incsub > 0)
call this%csub%csub_ar(this%dis, this%ibound)
334 if (this%inmvr > 0)
call this%mvr%mvr_ar()
335 if (this%inobs > 0)
call this%obs%gwf_obs_ar(this%ic, this%x, this%flowja)
338 call this%dis%dis_ar(this%npf%icelltype)
341 call this%oc%oc_ar(this%x, this%dis, this%npf%hnoflo)
342 call this%budget%set_ibudcsv(this%oc%ibudcsv)
345 do ip = 1, this%bndlist%Count()
347 call packobj%set_pointers(this%dis%nodes, this%ibound, this%x, &
348 this%xold, this%flowja)
350 call packobj%bnd_ar()
351 if (this%inbuy > 0)
call this%buy%buy_ar_bnd(packobj, this%x)
352 if (this%invsc > 0)
call this%vsc%vsc_ar_bnd(packobj)
367 class(
bndtype),
pointer :: packobj
374 if (this%innpf > 0)
call this%npf%npf_rp()
375 if (this%inbuy > 0)
call this%buy%buy_rp()
376 if (this%invsc > 0)
call this%vsc%vsc_rp()
377 if (this%inhfb > 0)
call this%hfb%hfb_rp()
378 if (this%inoc > 0)
call this%oc%oc_rp()
379 if (this%insto > 0)
call this%sto%sto_rp()
380 if (this%incsub > 0)
call this%csub%csub_rp()
381 if (this%inmvr > 0)
call this%mvr%mvr_rp()
382 do ip = 1, this%bndlist%Count()
384 call packobj%bnd_rp()
385 call packobj%bnd_rp_log()
386 call packobj%bnd_rp_obs()
390 call this%steady_period_check()
403 class(
bndtype),
pointer :: packobj
405 integer(I4B) :: irestore
406 integer(I4B) :: ip, n
411 if (irestore == 0)
then
414 do n = 1, this%dis%nodes
415 this%xold(n) = this%x(n)
420 do n = 1, this%dis%nodes
421 this%x(n) = this%xold(n)
426 if (this%invsc > 0)
call this%vsc%vsc_ad()
427 if (this%innpf > 0)
call this%npf%npf_ad(this%dis%nodes, this%xold, &
429 if (this%insto > 0)
call this%sto%sto_ad()
430 if (this%incsub > 0)
call this%csub%csub_ad(this%dis%nodes, this%x)
431 if (this%inbuy > 0)
call this%buy%buy_ad()
432 if (this%inmvr > 0)
call this%mvr%mvr_ad()
433 do ip = 1, this%bndlist%Count()
435 call packobj%bnd_ad()
436 if (this%invsc > 0)
call this%vsc%vsc_ad_bnd(packobj, this%x)
438 call packobj%bnd_ck()
443 call this%obs%obs_ad()
451 integer(I4B),
intent(in) :: kiter
453 class(
bndtype),
pointer :: packobj
457 if (this%innpf > 0)
call this%npf%npf_cf(kiter, this%dis%nodes, this%x)
458 if (this%inbuy > 0)
call this%buy%buy_cf(kiter)
459 do ip = 1, this%bndlist%Count()
461 call packobj%bnd_cf()
462 if (this%inbuy > 0)
call this%buy%buy_cf_bnd(packobj, this%x)
468 subroutine gwf_fc(this, kiter, matrix_sln, inwtflag)
471 integer(I4B),
intent(in) :: kiter
473 integer(I4B),
intent(in) :: inwtflag
475 class(
bndtype),
pointer :: packobj
477 integer(I4B) :: inwt, inwtsto, inwtcsub, inwtpak
481 if (inwtflag == 1) inwt = this%npf%inewton
483 if (this%insto > 0)
then
484 if (inwtflag == 1) inwtsto = this%sto%inewton
487 if (this%incsub > 0)
then
488 if (inwtflag == 1) inwtcsub = this%csub%inewton
492 if (this%innpf > 0)
call this%npf%npf_fc(kiter, matrix_sln, this%idxglo, &
494 if (this%inbuy > 0)
call this%buy%buy_fc(kiter, matrix_sln, this%idxglo, &
496 if (this%inhfb > 0)
call this%hfb%hfb_fc(kiter, matrix_sln, this%idxglo, &
498 if (this%ingnc > 0)
call this%gnc%gnc_fc(kiter, matrix_sln)
500 if (this%insto > 0)
then
501 call this%sto%sto_fc(kiter, this%xold, this%x, matrix_sln, &
502 this%idxglo, this%rhs)
505 if (this%incsub > 0)
then
506 call this%csub%csub_fc(kiter, this%xold, this%x, matrix_sln, &
507 this%idxglo, this%rhs)
509 if (this%inmvr > 0)
call this%mvr%mvr_fc()
510 do ip = 1, this%bndlist%Count()
512 call packobj%bnd_fc(this%rhs, this%ia, this%idxglo, matrix_sln)
516 if (this%innpf > 0)
then
518 call this%npf%npf_fn(kiter, matrix_sln, this%idxglo, this%rhs, this%x)
519 if (this%inbuy > 0)
then
520 call this%buy%buy_fn(kiter, matrix_sln, this%idxglo, this%rhs, &
527 if (this%ingnc > 0)
then
529 call this%gnc%gnc_fn(kiter, matrix_sln, this%npf%condsat, &
530 ivarcv_opt=this%npf%ivarcv, &
531 ictm1_opt=this%npf%icelltype, &
532 ictm2_opt=this%npf%icelltype)
537 if (this%insto > 0)
then
538 if (inwtsto /= 0)
then
539 call this%sto%sto_fn(kiter, this%xold, this%x, matrix_sln, &
540 this%idxglo, this%rhs)
545 if (this%incsub > 0)
then
546 if (inwtcsub /= 0)
then
547 call this%csub%csub_fn(kiter, this%xold, this%x, matrix_sln, &
548 this%idxglo, this%rhs)
553 do ip = 1, this%bndlist%Count()
556 if (inwtflag == 1) inwtpak = packobj%inewton
557 if (inwtpak /= 0)
then
558 call packobj%bnd_fn(this%rhs, this%ia, this%idxglo, matrix_sln)
568 subroutine gwf_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
571 integer(I4B),
intent(in) :: innertot
572 integer(I4B),
intent(in) :: kiter
573 integer(I4B),
intent(in) :: iend
574 integer(I4B),
intent(in) :: icnvgmod
575 character(len=LENPAKLOC),
intent(inout) :: cpak
576 integer(I4B),
intent(inout) :: ipak
577 real(DP),
intent(inout) :: dpak
579 class(
bndtype),
pointer :: packobj
584 if (this%inmvr > 0)
then
585 call this%mvr%mvr_cc(innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
589 if (this%incsub > 0)
then
590 call this%csub%csub_cc(innertot, kiter, iend, icnvgmod, &
591 this%dis%nodes, this%x, this%xold, &
596 do ip = 1, this%bndlist%Count()
598 call packobj%bnd_cc(innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
610 integer(I4B),
intent(inout) :: iptc
616 if (this%iss > 0)
then
617 if (this%inewton > 0)
then
620 iptc = this%npf%inewton
631 subroutine gwf_ptc(this, vec_residual, iptc, ptcf)
638 integer(I4B),
intent(inout) :: iptc
639 real(DP),
intent(inout) :: ptcf
642 integer(I4B) :: iptct
643 integer(I4B) :: irow_start
644 integer(I4B) :: irow_end
645 integer(I4B) :: ioffset
648 real(DP) :: ptcdelem1
655 if (this%iss > 0)
then
656 if (this%inewton > 0)
then
659 iptct = this%npf%inewton
667 call vec_residual%get_ownership_range(irow_start, irow_end)
668 ioffset = this%moffset - (irow_start - 1)
671 do n = 1, this%dis%nodes
672 if (this%npf%ibound(n) < 1) cycle
675 v = this%dis%get_cell_volume(n, this%dis%top(n))
678 resid = vec_residual%get_value_local(n + ioffset)
682 ptcdelem1 = abs(resid) / v
687 if (ptcdelem1 > ptcf) ptcf = ptcdelem1
691 if (ptcf ==
dzero)
then
698 if (iptct > 0) iptc = 1
709 subroutine gwf_nur(this, neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
714 integer(I4B),
intent(in) :: neqmod
715 real(DP),
dimension(neqmod),
intent(inout) :: x
716 real(DP),
dimension(neqmod),
intent(in) :: xtemp
717 real(DP),
dimension(neqmod),
intent(inout) :: dx
718 integer(I4B),
intent(inout) :: inewtonur
719 real(DP),
intent(inout) :: dxmax
720 integer(I4B),
intent(inout) :: locmax
724 class(
bndtype),
pointer :: packobj
730 if (this%inewton /= 0 .and. this%inewtonur /= 0)
then
731 if (this%innpf > 0)
then
732 call this%npf%npf_nur(neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
736 i0 = this%dis%nodes + 1
737 do ip = 1, this%bndlist%Count()
739 if (packobj%npakeq > 0)
then
740 i1 = i0 + packobj%npakeq - 1
741 call packobj%bnd_nur(packobj%npakeq, x(i0:i1), xtemp(i0:i1), &
742 dx(i0:i1), inewtonur, dxmax, locmax)
754 subroutine gwf_cq(this, icnvg, isuppress_output)
758 integer(I4B),
intent(in) :: icnvg
759 integer(I4B),
intent(in) :: isuppress_output
763 class(
bndtype),
pointer :: packobj
771 this%flowja(i) = dzero
773 if (this%innpf > 0)
call this%npf%npf_cq(this%x, this%flowja)
774 if (this%inbuy > 0)
call this%buy%buy_cq(this%x, this%flowja)
775 if (this%inhfb > 0)
call this%hfb%hfb_cq(this%x, this%flowja)
776 if (this%ingnc > 0)
call this%gnc%gnc_cq(this%flowja)
777 if (this%insto > 0)
call this%sto%sto_cq(this%flowja, this%x, this%xold)
778 if (this%incsub > 0)
call this%csub%csub_cq(this%dis%nodes, this%x, &
779 this%xold, isuppress_output, &
785 do ip = 1, this%bndlist%Count()
787 call packobj%bnd_cf()
788 if (this%inbuy > 0)
call this%buy%buy_cf_bnd(packobj, this%x)
789 call packobj%bnd_cq(this%x, this%flowja)
798 subroutine gwf_bd(this, icnvg, isuppress_output)
803 integer(I4B),
intent(in) :: icnvg
804 integer(I4B),
intent(in) :: isuppress_output
807 class(
bndtype),
pointer :: packobj
821 call this%budget%reset()
822 if (this%insto > 0)
call this%sto%sto_bd(isuppress_output, this%budget)
823 if (this%incsub > 0)
call this%csub%csub_bd(isuppress_output, this%budget)
824 if (this%inmvr > 0)
call this%mvr%mvr_bd()
825 do ip = 1, this%bndlist%Count()
827 call packobj%bnd_bd(this%budget)
832 if (this%innpf > 0)
then
833 if (this%npf%icalcspdis /= 0)
then
834 call this%npf%calc_spdis(this%flowja)
847 integer(I4B) :: idvsave
848 integer(I4B) :: idvprint
849 integer(I4B) :: icbcfl
850 integer(I4B) :: icbcun
851 integer(I4B) :: ibudfl
852 integer(I4B) :: ipflag
854 character(len=*),
parameter :: fmtnocnvg = &
855 "(1X,/9X,'****FAILED TO MEET SOLVER CONVERGENCE CRITERIA IN TIME STEP ', &
856 &I0,' OF STRESS PERIOD ',I0,'****')"
863 if (this%oc%oc_save(
'HEAD')) idvsave = 1
864 if (this%oc%oc_print(
'HEAD')) idvprint = 1
865 if (this%oc%oc_save(
'BUDGET')) icbcfl = 1
866 if (this%oc%oc_print(
'BUDGET')) ibudfl = 1
867 icbcun = this%oc%oc_save_unit(
'BUDGET')
871 ibudfl = this%oc%set_print_flag(
'BUDGET', this%icnvg,
endofperiod)
872 idvprint = this%oc%set_print_flag(
'HEAD', this%icnvg,
endofperiod)
875 call this%gwf_ot_obs()
878 call this%gwf_ot_flow(icbcfl, ibudfl, icbcun)
881 call this%gwf_ot_dv(idvsave, idvprint, ipflag)
884 call this%gwf_ot_bdsummary(ibudfl, ipflag)
888 if (ipflag == 1)
call tdis_ot(this%iout)
891 if (this%icnvg == 0)
then
892 write (this%iout, fmtnocnvg)
kstp,
kper
900 class(
bndtype),
pointer :: packobj
904 call this%obs%obs_bd()
905 call this%obs%obs_ot()
908 if (this%incsub > 0)
then
909 call this%csub%csub_bd_obs()
910 call this%csub%obs%obs_ot()
914 do ip = 1, this%bndlist%Count()
916 call packobj%bnd_bd_obs()
917 call packobj%bnd_ot_obs()
926 integer(I4B),
intent(in) :: icbcfl
927 integer(I4B),
intent(in) :: ibudfl
928 integer(I4B),
intent(in) :: icbcun
929 class(
bndtype),
pointer :: packobj
933 if (this%insto > 0)
then
934 call this%sto%sto_save_model_flows(icbcfl, icbcun)
936 if (this%innpf > 0)
then
937 call this%npf%npf_save_model_flows(this%flowja, icbcfl, icbcun)
939 if (this%incsub > 0)
call this%csub%csub_save_model_flows(icbcfl, icbcun)
940 do ip = 1, this%bndlist%Count()
942 call packobj%bnd_ot_model_flows(icbcfl=icbcfl, ibudfl=0, icbcun=icbcun)
946 do ip = 1, this%bndlist%Count()
948 call packobj%bnd_ot_package_flows(icbcfl=icbcfl, ibudfl=0)
950 if (this%inmvr > 0)
then
951 call this%mvr%mvr_ot_saveflow(icbcfl, ibudfl)
955 if (this%innpf > 0)
call this%npf%npf_print_model_flows(ibudfl, this%flowja)
956 if (this%ingnc > 0)
call this%gnc%gnc_ot(ibudfl)
957 do ip = 1, this%bndlist%Count()
959 call packobj%bnd_ot_model_flows(icbcfl=icbcfl, ibudfl=ibudfl, icbcun=0)
963 do ip = 1, this%bndlist%Count()
965 call packobj%bnd_ot_package_flows(icbcfl=0, ibudfl=ibudfl)
967 if (this%inmvr > 0)
then
968 call this%mvr%mvr_ot_printflow(icbcfl, ibudfl)
977 integer(I4B),
intent(in) :: idvsave
978 integer(I4B),
intent(in) :: idvprint
979 integer(I4B),
intent(inout) :: ipflag
980 class(
bndtype),
pointer :: packobj
984 if (this%incsub > 0)
call this%csub%csub_ot_dv(idvsave, idvprint)
987 if (this%inbuy > 0)
then
988 call this%buy%buy_ot_dv(idvsave)
992 if (this%invsc > 0)
then
993 call this%vsc%vsc_ot_dv(idvsave)
997 do ip = 1, this%bndlist%Count()
999 call packobj%bnd_ot_dv(idvsave, idvprint)
1003 call this%oc%oc_ot(ipflag)
1011 integer(I4B),
intent(in) :: ibudfl
1012 integer(I4B),
intent(inout) :: ipflag
1013 class(
bndtype),
pointer :: packobj
1017 do ip = 1, this%bndlist%Count()
1019 call packobj%bnd_ot_bdsummary(
kstp,
kper, this%iout, ibudfl)
1023 if (this%inmvr > 0)
then
1024 call this%mvr%mvr_ot_bdsummary(ibudfl)
1028 call this%budget%finalize_step(
delt)
1029 if (ibudfl /= 0)
then
1031 call this%budget%budget_ot(
kstp,
kper, this%iout)
1035 call this%budget%writecsv(
totim)
1046 class(
bndtype),
pointer :: packobj => null()
1049 do ip = 1, this%bndlist%Count()
1051 call packobj%bnd_dt()
1061 class(
bndtype),
pointer :: packobj => null()
1064 if (this%incsub > 0)
then
1065 call this%csub%csub_fp()
1069 do ip = 1, this%bndlist%Count()
1071 call packobj%bnd_fp()
1086 class(
bndtype),
pointer :: packobj
1093 call this%dis%dis_da()
1094 call this%ic%ic_da()
1095 call this%npf%npf_da()
1096 call this%xt3d%xt3d_da()
1097 call this%buy%buy_da()
1098 call this%vsc%vsc_da()
1099 call this%gnc%gnc_da()
1100 call this%sto%sto_da()
1101 call this%csub%csub_da()
1102 call this%budget%budget_da()
1103 call this%hfb%hfb_da()
1104 call this%mvr%mvr_da()
1105 call this%oc%oc_da()
1106 call this%obs%obs_da()
1109 deallocate (this%dis)
1110 deallocate (this%ic)
1111 deallocate (this%npf)
1112 deallocate (this%xt3d)
1113 deallocate (this%buy)
1114 deallocate (this%vsc)
1115 deallocate (this%gnc)
1116 deallocate (this%sto)
1117 deallocate (this%csub)
1118 deallocate (this%budget)
1119 deallocate (this%hfb)
1120 deallocate (this%mvr)
1121 deallocate (this%obs)
1122 deallocate (this%oc)
1125 do ip = 1, this%bndlist%Count()
1127 call packobj%bnd_da()
1128 deallocate (packobj)
1147 call this%NumericalModelType%model_da()
1161 real(DP),
dimension(:, :),
intent(in) :: budterm
1162 character(len=LENBUDTXT),
dimension(:),
intent(in) :: budtxt
1163 character(len=*),
intent(in) :: rowlabel
1165 call this%budget%addentry(budterm,
delt, budtxt, rowlabel=rowlabel)
1174 integer(I4B) :: iasym
1176 class(
bndtype),
pointer :: packobj
1182 if (this%innpf > 0)
then
1183 if (this%npf%iasym /= 0) iasym = 1
1184 if (this%npf%ixt3d /= 0) iasym = 1
1188 if (this%ingnc > 0)
then
1189 if (this%gnc%iasym /= 0) iasym = 1
1193 do ip = 1, this%bndlist%Count()
1195 if (packobj%iasym /= 0) iasym = 1
1206 character(len=*),
intent(in) :: modelname
1209 call this%NumericalModelType%allocate_scalars(modelname)
1214 call mem_allocate(this%innpf,
'INNPF', this%memoryPath)
1215 call mem_allocate(this%inbuy,
'INBUY', this%memoryPath)
1216 call mem_allocate(this%invsc,
'INVSC', this%memoryPath)
1217 call mem_allocate(this%insto,
'INSTO', this%memoryPath)
1218 call mem_allocate(this%incsub,
'INCSUB', this%memoryPath)
1219 call mem_allocate(this%inmvr,
'INMVR', this%memoryPath)
1220 call mem_allocate(this%inhfb,
'INHFB', this%memoryPath)
1221 call mem_allocate(this%ingnc,
'INGNC', this%memoryPath)
1222 call mem_allocate(this%inobs,
'INOBS', this%memoryPath)
1224 call mem_allocate(this%inewtonur,
'INEWTONUR', this%memoryPath)
1266 character(len=*),
intent(in) :: filtyp
1267 integer(I4B),
intent(in) :: ipakid
1268 integer(I4B),
intent(in) :: ipaknum
1269 character(len=*),
intent(in) :: pakname
1270 character(len=*),
intent(in) :: mempath
1271 integer(I4B),
intent(in) :: inunit
1272 integer(I4B),
intent(in) :: iout
1274 class(
bndtype),
pointer :: packobj
1275 class(
bndtype),
pointer :: packobj2
1279 select case (filtyp)
1281 call chd_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1284 call wel_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1287 call drn_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1290 call riv_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1293 call ghb_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1296 call rch_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1299 call evt_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1302 call maw_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1305 call sfr_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1308 call lak_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1311 call uzf_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1314 call api_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1317 write (errmsg, *)
'Invalid package type: ', filtyp
1323 do ip = 1, this%bndlist%Count()
1325 if (packobj2%packName == pakname)
then
1326 write (errmsg,
'(a,a)')
'Cannot create package. Package name '// &
1327 'already exists: ', trim(pakname)
1342 integer(I4B),
intent(in) :: indis
1346 if (this%inic == 0)
then
1347 write (errmsg,
'(a)') &
1348 'Initial Conditions (IC6) package not specified.'
1351 if (indis == 0)
then
1352 write (errmsg,
'(a)') &
1353 'Discretization (DIS6, DISV6, or DISU6) Package not specified.'
1356 if (this%innpf == 0)
then
1357 write (errmsg,
'(a)') &
1358 'Node Property Flow (NPF6) Package not specified.'
1363 write (errmsg,
'(a)')
'One or more required package(s) not specified.'
1373 class(*),
pointer,
intent(inout) :: model
1377 if (.not.
associated(model))
return
1393 integer(I4B),
dimension(:),
allocatable,
intent(inout) :: bndpkgs
1395 pointer,
intent(inout) :: pkgtypes
1397 pointer,
intent(inout) :: pkgnames
1399 pointer,
intent(inout) :: mempaths
1400 integer(I4B),
dimension(:),
contiguous, &
1401 pointer,
intent(inout) :: inunits
1403 integer(I4B) :: ipakid, ipaknum
1404 character(len=LENFTYPE) :: pkgtype, bndptype
1405 character(len=LENPACKAGENAME) :: pkgname
1406 character(len=LENMEMPATH) :: mempath
1407 integer(I4B),
pointer :: inunit
1410 if (
allocated(bndpkgs))
then
1415 do n = 1,
size(bndpkgs)
1417 pkgtype = pkgtypes(bndpkgs(n))
1418 pkgname = pkgnames(bndpkgs(n))
1419 mempath = mempaths(bndpkgs(n))
1420 inunit => inunits(bndpkgs(n))
1422 if (bndptype /= pkgtype)
then
1427 call this%package_create(pkgtype, ipakid, ipaknum, pkgname, mempath, &
1430 ipaknum = ipaknum + 1
1434 deallocate (bndpkgs)
1465 pointer :: pkgtypes => null()
1467 pointer :: pkgnames => null()
1469 pointer :: mempaths => null()
1470 integer(I4B),
dimension(:),
contiguous, &
1471 pointer :: inunits => null()
1472 character(len=LENMEMPATH) :: model_mempath
1473 character(len=LENFTYPE) :: pkgtype
1474 character(len=LENPACKAGENAME) :: pkgname
1475 character(len=LENMEMPATH) :: mempath
1476 integer(I4B),
pointer :: inunit
1477 integer(I4B),
dimension(:),
allocatable :: bndpkgs
1479 integer(I4B) :: indis = 0
1480 character(len=LENMEMPATH) :: mempathbuy =
''
1481 character(len=LENMEMPATH) :: mempathcsub =
''
1482 character(len=LENMEMPATH) :: mempathhfb =
''
1483 character(len=LENMEMPATH) :: mempathic =
''
1484 character(len=LENMEMPATH) :: mempathnpf =
''
1485 character(len=LENMEMPATH) :: mempathoc =
''
1486 character(len=LENMEMPATH) :: mempathsto =
''
1487 character(len=LENMEMPATH) :: mempathvsc =
''
1493 call mem_setptr(pkgtypes,
'PKGTYPES', model_mempath)
1494 call mem_setptr(pkgnames,
'PKGNAMES', model_mempath)
1495 call mem_setptr(mempaths,
'MEMPATHS', model_mempath)
1496 call mem_setptr(inunits,
'INUNITS', model_mempath)
1498 do n = 1,
size(pkgtypes)
1501 pkgtype = pkgtypes(n)
1502 pkgname = pkgnames(n)
1503 mempath = mempaths(n)
1504 inunit => inunits(n)
1507 select case (pkgtype)
1510 call dis_cr(this%dis, this%name, mempath, indis, this%iout)
1513 call disv_cr(this%dis, this%name, mempath, indis, this%iout)
1516 call disu_cr(this%dis, this%name, mempath, indis, this%iout)
1519 mempathnpf = mempath
1522 mempathbuy = mempath
1525 mempathvsc = mempath
1530 mempathhfb = mempath
1533 mempathsto = mempath
1536 mempathcsub = mempath
1547 case (
'WEL6',
'DRN6',
'RIV6',
'GHB6',
'RCH6', &
1548 'EVT6',
'API6',
'CHD6',
'MAW6',
'SFR6', &
1551 bndpkgs(
size(bndpkgs)) = n
1558 call npf_cr(this%npf, this%name, mempathnpf, this%innpf, this%iout)
1559 call xt3d_cr(this%xt3d, this%name, this%innpf, this%iout)
1560 call buy_cr(this%buy, this%name, mempathbuy, this%inbuy, this%iout)
1561 call vsc_cr(this%vsc, this%name, mempathvsc, this%invsc, this%iout)
1562 call gnc_cr(this%gnc, this%name, this%ingnc, this%iout)
1563 call hfb_cr(this%hfb, this%name, mempathhfb, this%inhfb, this%iout)
1564 call sto_cr(this%sto, this%name, mempathsto, this%insto, this%iout)
1565 call csub_cr(this%csub, this%name, mempathcsub, this%insto, &
1566 this%sto%packName, this%incsub, this%iout)
1567 call ic_cr(this%ic, this%name, mempathic, this%inic, this%iout, this%dis)
1568 call mvr_cr(this%mvr, this%name, this%inmvr, this%iout, this%dis)
1569 call oc_cr(this%oc, this%name, mempathoc, this%inoc, this%iout)
1573 call this%ftype_check(indis)
1575 call this%create_bndpkgs(bndpkgs, pkgtypes, pkgnames, mempaths, inunits)
1585 write (this%iout,
'(1x,a)')
'NAMEFILE OPTIONS:'
1587 if (found%newton)
then
1588 write (this%iout,
'(4x,a)') &
1589 'NEWTON-RAPHSON method enabled for the model.'
1590 if (found%under_relaxation)
then
1591 write (this%iout,
'(4x,a,a)') &
1592 'NEWTON-RAPHSON UNDER-RELAXATION based on the bottom ', &
1593 'elevation of the model will be applied to the model.'
1597 if (found%print_input)
then
1598 write (this%iout,
'(4x,a)')
'STRESS PACKAGE INPUT WILL BE PRINTED '// &
1599 'FOR ALL MODEL STRESS PACKAGES'
1602 if (found%print_flows)
then
1603 write (this%iout,
'(4x,a)')
'PACKAGE FLOWS WILL BE PRINTED '// &
1604 'FOR ALL MODEL PACKAGES'
1607 if (found%save_flows)
then
1608 write (this%iout,
'(4x,a)') &
1609 'FLOWS WILL BE SAVED TO BUDGET FILE SPECIFIED IN OUTPUT CONTROL'
1612 write (this%iout,
'(1x,a)')
'END NAMEFILE OPTIONS:'
1629 if (this%iss == 1)
then
1630 if (
ats%isAdaptivePeriod(
kper))
then
1631 write (
warnmsg,
'(a,a,a,i0,a)') &
1632 'GWF Model (', trim(this%name),
') is steady state for period ', &
1633 kper,
' and adaptive time stepping is active. Adaptive time &
1634 &stepping may not work properly for steady-state conditions.'
This module contains the API package methods.
subroutine, public api_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a new package object.
subroutine, public addbasemodeltolist(list, model)
subroutine model_ar(this)
Allocate and read.
subroutine model_ot(this)
Output results.
subroutine model_dt(this)
Calculate time step length.
subroutine model_rp(this)
Read and prepare.
subroutine model_df(this)
Define the model.
subroutine model_fp(this)
Final processing.
subroutine model_da(this)
Deallocate.
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)
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 allocate_scalars(this)
Allocate gnc scalar variables.
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)
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 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_dt(this)
Submit boundary-package ATS time step requests.
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)
Create GwfOcType.
This module contains the storage package methods.
subroutine, public sto_cr(stoobj, name_model, mempath, inunit, iout)
Create a new package object.
subroutine, public vsc_cr(vscobj, name_model, input_mempath, inunit, iout)
Create a new package object.
This module defines variable data types.
subroutine, public lak_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
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, mempath)
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 model_ac(this, sparse)
subroutine model_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
subroutine model_ad(this)
subroutine model_mc(this, matrix_sln)
subroutine model_nur(this, neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
subroutine model_cq(this, icnvg, isuppress_output)
subroutine model_bd(this, icnvg, isuppress_output)
subroutine model_ptc(this, vec_residual, iptc, ptcf)
subroutine model_ptcchk(this, iptc)
integer(i4b) function get_iasym(this)
subroutine model_fc(this, kiter, matrix_sln, inwtflag)
subroutine model_cf(this, kiter)
subroutine model_bdentry(this, budterm, budtxt, rowlabel)
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, mempath)
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
class(atstype), pointer, public ats
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, mempath)
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)
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 ...