32 character(len=LENVARNAME),
parameter ::
dvt =
'CONCENTRATION '
33 character(len=LENVARNAME),
parameter ::
dvu =
'MASS '
34 character(len=LENVARNAME),
parameter ::
dvua =
'M '
40 integer(I4B),
pointer :: inmst => null()
41 integer(I4B),
pointer :: indsp => null()
75 character(len=LENPACKAGETYPE),
dimension(GWT_NBASEPKG) ::
gwt_basepkg
76 data gwt_basepkg/
'DIS6 ',
'DISV6',
'DISU6',
' ',
' ', &
77 &
'IC6 ',
'FMI6 ',
'MST6 ',
'ADV6 ',
' ', &
78 &
'DSP6 ',
'SSM6 ',
'MVT6 ',
'OC6 ',
' ', &
79 &
'OBS6 ',
' ',
' ',
' ',
' ', &
88 character(len=LENPACKAGETYPE),
dimension(GWT_NMULTIPKG) ::
gwt_multipkg
89 data gwt_multipkg/
'CNC6 ',
'SRC6 ',
'LKT6 ',
'IST6 ',
' ', &
90 &
'SFT6 ',
'MWT6 ',
'UZT6 ',
'API6 ',
' ', &
100 subroutine gwt_cr(filename, id, modelname)
110 character(len=*),
intent(in) :: filename
111 integer(I4B),
intent(in) :: id
112 character(len=*),
intent(in) :: modelname
114 integer(I4B) :: indis
125 call this%allocate_scalars(modelname)
128 call this%set_tsp_labels(this%macronym,
dvt,
dvu,
dvua)
134 call this%tsp_cr(filename, id, modelname,
'GWT', indis)
137 call this%create_packages(indis)
153 class(
bndtype),
pointer :: packobj
156 call this%dis%dis_df()
157 call this%fmi%fmi_df(this%dis, 1)
158 if (this%inmvt > 0)
call this%mvt%mvt_df(this%dis)
159 if (this%inadv > 0)
call this%adv%adv_df()
160 if (this%indsp > 0)
call this%dsp%dsp_df(this%dis)
161 if (this%inssm > 0)
call this%ssm%ssm_df()
163 call this%budget%budget_df(
niunit_gwt, this%depvarunit, &
164 this%depvarunitabbrev)
167 if (this%inssm == 0)
then
168 if (this%fmi%nflowpack > 0)
then
169 call store_error(
'Flow model has boundary packages, but there &
170 &is no SSM package. The SSM package must be activated.', &
176 this%neq = this%dis%nodes
177 this%nja = this%dis%nja
178 this%ia => this%dis%con%ia
179 this%ja => this%dis%con%ja
182 call this%allocate_arrays()
185 do ip = 1, this%bndlist%Count()
187 call packobj%bnd_df(this%neq, this%dis)
188 packobj%TsManager%iout = this%iout
189 packobj%TasManager%iout = this%iout
193 call this%obs%obs_df(this%iout, this%name,
'GWT', this%dis)
205 class(
bndtype),
pointer :: packobj
209 call this%dis%dis_ac(this%moffset, sparse)
210 if (this%indsp > 0) &
211 call this%dsp%dsp_ac(this%moffset, sparse)
214 do ip = 1, this%bndlist%Count()
216 call packobj%bnd_ac(this%moffset, sparse)
228 class(
bndtype),
pointer :: packobj
233 call this%dis%dis_mc(this%moffset, this%idxglo, matrix_sln)
235 if (this%indsp > 0)
call this%dsp%dsp_mc(this%moffset, matrix_sln)
238 do ip = 1, this%bndlist%Count()
240 call packobj%bnd_mc(this%moffset, matrix_sln)
257 class(
bndtype),
pointer :: packobj
260 call this%fmi%fmi_ar(this%ibound)
261 if (this%inmvt > 0)
call this%mvt%mvt_ar()
262 if (this%inic > 0)
call this%ic%ic_ar(this%x)
263 if (this%inmst > 0)
call this%mst%mst_ar(this%dis, this%ibound)
264 if (this%inadv > 0)
call this%adv%adv_ar(this%dis, this%ibound)
265 if (this%indsp > 0)
call this%dsp%dsp_ar(this%ibound, this%mst%thetam)
266 if (this%inssm > 0)
call this%ssm%ssm_ar(this%dis, this%ibound, this%x)
267 if (this%inobs > 0)
call this%obs%tsp_obs_ar(this%ic, this%x, this%flowja)
276 this%eqnsclfac = done
282 call this%oc%oc_ar(this%x, this%dis,
dhnoflo, this%depvartype)
283 call this%budget%set_ibudcsv(this%oc%ibudcsv)
286 do ip = 1, this%bndlist%Count()
288 call packobj%set_pointers(this%dis%nodes, this%ibound, this%x, &
289 this%xold, this%flowja)
291 call packobj%bnd_ar()
305 class(
bndtype),
pointer :: packobj
309 call this%fmi%fmi_rp(this%inmvt)
310 if (this%inmvt > 0)
call this%mvt%mvt_rp()
316 if (this%inoc > 0)
call this%oc%oc_rp()
317 if (this%inssm > 0)
call this%ssm%ssm_rp()
318 do ip = 1, this%bndlist%Count()
320 call packobj%bnd_rp()
321 call packobj%bnd_rp_obs()
338 character(len=LINELENGTH) :: msg
342 call this%adv%adv_dt(dtmax, msg, this%mst%thetam)
357 class(
bndtype),
pointer :: packobj
359 integer(I4B) :: irestore
360 integer(I4B) :: ip, n
365 if (irestore == 0)
then
368 do n = 1, this%dis%nodes
369 if (this%ibound(n) == 0)
then
372 this%xold(n) = this%x(n)
378 do n = 1, this%dis%nodes
379 this%x(n) = this%xold(n)
384 call this%fmi%fmi_ad(this%x)
387 if (this%indsp > 0)
call this%dsp%dsp_ad()
388 if (this%inssm > 0)
call this%ssm%ssm_ad()
389 do ip = 1, this%bndlist%Count()
391 call packobj%bnd_ad()
393 call packobj%bnd_ck()
398 call this%obs%obs_ad()
409 integer(I4B),
intent(in) :: kiter
411 class(
bndtype),
pointer :: packobj
415 do ip = 1, this%bndlist%Count()
417 call packobj%bnd_cf()
425 subroutine gwt_fc(this, kiter, matrix_sln, inwtflag)
429 integer(I4B),
intent(in) :: kiter
431 integer(I4B),
intent(in) :: inwtflag
433 class(
bndtype),
pointer :: packobj
437 call this%fmi%fmi_fc(this%dis%nodes, this%xold, this%nja, matrix_sln, &
438 this%idxglo, this%rhs)
439 if (this%inmvt > 0)
then
440 call this%mvt%mvt_fc(this%x, this%x)
442 if (this%inmst > 0)
then
443 call this%mst%mst_fc(this%dis%nodes, this%xold, this%nja, matrix_sln, &
444 this%idxglo, this%x, this%rhs, kiter)
446 if (this%inadv > 0)
then
447 call this%adv%adv_fc(this%dis%nodes, matrix_sln, this%idxglo, this%x, &
450 if (this%indsp > 0)
then
451 call this%dsp%dsp_fc(kiter, this%dis%nodes, this%nja, matrix_sln, &
452 this%idxglo, this%rhs, this%x)
454 if (this%inssm > 0)
then
455 call this%ssm%ssm_fc(matrix_sln, this%idxglo, this%rhs)
459 do ip = 1, this%bndlist%Count()
461 call packobj%bnd_fc(this%rhs, this%ia, this%idxglo, matrix_sln)
474 subroutine gwt_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
477 integer(I4B),
intent(in) :: innertot
478 integer(I4B),
intent(in) :: kiter
479 integer(I4B),
intent(in) :: iend
480 integer(I4B),
intent(in) :: icnvgmod
481 character(len=LENPAKLOC),
intent(inout) :: cpak
482 integer(I4B),
intent(inout) :: ipak
483 real(DP),
intent(inout) :: dpak
488 if (this%inmvt > 0)
call this%mvt%mvt_cc(kiter, iend, icnvgmod, cpak, dpak)
495 subroutine gwt_cq(this, icnvg, isuppress_output)
500 integer(I4B),
intent(in) :: icnvg
501 integer(I4B),
intent(in) :: isuppress_output
505 class(
bndtype),
pointer :: packobj
513 this%flowja(i) =
dzero
515 if (this%inadv > 0)
call this%adv%adv_cq(this%x, this%flowja)
516 if (this%indsp > 0)
call this%dsp%dsp_cq(this%x, this%flowja)
517 if (this%inmst > 0)
call this%mst%mst_cq(this%dis%nodes, this%x, this%xold, &
519 if (this%inssm > 0)
call this%ssm%ssm_cq(this%flowja)
520 if (this%infmi > 0)
call this%fmi%fmi_cq(this%x, this%flowja)
525 do ip = 1, this%bndlist%Count()
527 call packobj%bnd_cf()
528 call packobj%bnd_cq(this%x, this%flowja)
543 subroutine gwt_bd(this, icnvg, isuppress_output)
547 integer(I4B),
intent(in) :: icnvg
548 integer(I4B),
intent(in) :: isuppress_output
551 class(
bndtype),
pointer :: packobj
560 call this%budget%reset()
561 if (this%inmst > 0)
call this%mst%mst_bd(isuppress_output, this%budget)
562 if (this%inssm > 0)
call this%ssm%ssm_bd(isuppress_output, this%budget)
563 if (this%infmi > 0)
call this%fmi%fmi_bd(isuppress_output, this%budget)
564 if (this%inmvt > 0)
call this%mvt%mvt_bd(this%x, this%x)
565 do ip = 1, this%bndlist%Count()
567 call packobj%bnd_bd(this%budget)
578 integer(I4B),
intent(in) :: icbcfl
579 integer(I4B),
intent(in) :: ibudfl
580 integer(I4B),
intent(in) :: icbcun
584 if (this%inmst > 0)
call this%mst%mst_ot_flow(icbcfl, icbcun)
587 call this%TransportModelType%tsp_ot_flow(icbcfl, ibudfl, icbcun)
595 integer(I4B),
intent(in) :: idvsave
596 integer(I4B),
intent(in) :: idvprint
597 integer(I4B),
intent(inout) :: ipflag
600 if (this%inmst > 0)
call this%mst%mst_ot_dv(idvsave)
603 call this%TransportModelType%tsp_ot_dv(idvsave, idvprint, ipflag)
620 class(
bndtype),
pointer :: packobj
627 call this%dis%dis_da()
629 call this%fmi%fmi_da()
630 call this%adv%adv_da()
631 call this%dsp%dsp_da()
632 call this%ssm%ssm_da()
633 call this%mst%mst_da()
634 call this%mvt%mvt_da()
635 call this%budget%budget_da()
637 call this%obs%obs_da()
640 deallocate (this%dis)
642 deallocate (this%dsp)
643 deallocate (this%ssm)
644 deallocate (this%mst)
645 deallocate (this%adv)
646 deallocate (this%mvt)
647 deallocate (this%budget)
649 deallocate (this%obs)
652 do ip = 1, this%bndlist%Count()
654 call packobj%bnd_da()
663 call this%TransportModelType%tsp_da()
666 call this%NumericalModelType%model_da()
681 real(DP),
dimension(:, :),
intent(in) :: budterm
682 character(len=LENBUDTXT),
dimension(:),
intent(in) :: budtxt
683 character(len=*),
intent(in) :: rowlabel
685 call this%budget%addentry(budterm,
delt, budtxt, rowlabel=rowlabel)
694 integer(I4B) :: iasym
696 class(
bndtype),
pointer :: packobj
702 if (this%inadv > 0)
then
703 if (this%adv%iasym /= 0) iasym = 1
707 if (this%indsp > 0)
then
708 if (this%dsp%ixt3d /= 0) iasym = 1
712 do ip = 1, this%bndlist%Count()
714 if (packobj%iasym /= 0) iasym = 1
729 character(len=*),
intent(in) :: modelname
732 call this%allocate_tsp_scalars(modelname)
760 character(len=*),
intent(in) :: filtyp
761 character(len=LINELENGTH) :: errmsg
762 integer(I4B),
intent(in) :: ipakid
763 integer(I4B),
intent(in) :: ipaknum
764 character(len=*),
intent(in) :: pakname
765 character(len=*),
intent(in) :: mempath
766 integer(I4B),
intent(in) :: inunit
767 integer(I4B),
intent(in) :: iout
769 class(
bndtype),
pointer :: packobj
770 class(
bndtype),
pointer :: packobj2
776 call cnc_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
777 pakname,
dvt, mempath)
779 call src_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
780 this%depvartype, pakname)
782 call lkt_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
783 pakname, this%fmi, this%eqnsclfac, this%depvartype, &
784 this%depvarunit, this%depvarunitabbrev)
786 call sft_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
787 pakname, this%fmi, this%eqnsclfac, this%depvartype, &
788 this%depvarunit, this%depvarunitabbrev)
790 call mwt_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
791 pakname, this%fmi, this%eqnsclfac, this%depvartype, &
792 this%depvarunit, this%depvarunitabbrev)
794 call uzt_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
795 pakname, this%fmi, this%eqnsclfac, this%depvartype, &
796 this%depvarunit, this%depvarunitabbrev)
798 call ist_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
799 pakname, this%fmi, this%mst)
801 call api_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
803 write (errmsg, *)
'Invalid package type: ', filtyp
810 do ip = 1, this%bndlist%Count()
812 if (packobj2%packName == pakname)
then
813 write (errmsg,
'(a,a)')
'Cannot create package. Package name '// &
814 'already exists: ', trim(pakname)
824 class(*),
pointer :: model
828 if (.not.
associated(model))
return
844 integer(I4B),
dimension(:),
allocatable,
intent(inout) :: bndpkgs
846 pointer,
intent(inout) :: pkgtypes
848 pointer,
intent(inout) :: pkgnames
850 pointer,
intent(inout) :: mempaths
851 integer(I4B),
dimension(:),
contiguous, &
852 pointer,
intent(inout) :: inunits
854 integer(I4B) :: ipakid, ipaknum
855 character(len=LENFTYPE) :: pkgtype, bndptype
856 character(len=LENPACKAGENAME) :: pkgname
857 character(len=LENMEMPATH) :: mempath
858 integer(I4B),
pointer :: inunit
861 if (
allocated(bndpkgs))
then
866 do n = 1,
size(bndpkgs)
868 pkgtype = pkgtypes(bndpkgs(n))
869 pkgname = pkgnames(bndpkgs(n))
870 mempath = mempaths(bndpkgs(n))
871 inunit => inunits(bndpkgs(n))
873 if (bndptype /= pkgtype)
then
878 call this%package_create(pkgtype, ipakid, ipaknum, pkgname, mempath, &
881 ipaknum = ipaknum + 1
903 integer(I4B),
intent(in) :: indis
906 pointer :: pkgtypes => null()
908 pointer :: pkgnames => null()
910 pointer :: mempaths => null()
911 integer(I4B),
dimension(:),
contiguous, &
912 pointer :: inunits => null()
913 character(len=LENMEMPATH) :: model_mempath
914 character(len=LENFTYPE) :: pkgtype
915 character(len=LENPACKAGENAME) :: pkgname
916 character(len=LENMEMPATH) :: mempath
917 integer(I4B),
pointer :: inunit
918 integer(I4B),
dimension(:),
allocatable :: bndpkgs
920 character(len=LENMEMPATH) :: mempathdsp =
''
926 call mem_setptr(pkgtypes,
'PKGTYPES', model_mempath)
927 call mem_setptr(pkgnames,
'PKGNAMES', model_mempath)
928 call mem_setptr(mempaths,
'MEMPATHS', model_mempath)
929 call mem_setptr(inunits,
'INUNITS', model_mempath)
931 do n = 1,
size(pkgtypes)
934 pkgtype = pkgtypes(n)
935 pkgname = pkgnames(n)
936 mempath = mempaths(n)
940 select case (pkgtype)
946 case (
'CNC6',
'SRC6',
'LKT6',
'SFT6', &
947 'MWT6',
'UZT6',
'IST6',
'API6')
949 bndpkgs(
size(bndpkgs)) = n
956 call mst_cr(this%mst, this%name, this%inmst, this%iout, this%fmi)
957 call dsp_cr(this%dsp, this%name, mempathdsp, this%indsp, this%iout, &
961 call this%ftype_check(indis, this%inmst)
963 call this%create_bndpkgs(bndpkgs, pkgtypes, pkgnames, mempaths, inunits)
subroutine, public ats_submit_delt(kstp, kper, dt, sloc, idir)
@ brief Allow and external caller to submit preferred time step
This module contains the API package methods.
subroutine, public api_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname)
@ 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
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 dnodata
real no data constant
integer(i4b), parameter lenpackagetype
maximum length of a package type (DIS6, SFR6, CSUB6, etc.)
real(dp), parameter dhnoflo
real no flow constant
integer(i4b), parameter lenpakloc
maximum length of a package location
integer(i4b), parameter lenvarname
maximum length of a variable name
integer(i4b), parameter lenftype
maximum length of a package type (DIS, WEL, OC, etc.)
real(dp), parameter dzero
real constant zero
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 cnc_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, depvartype, mempath)
Create a new constant concentration or temperature package.
subroutine, public dsp_cr(dspobj, name_model, input_mempath, inunit, iout, fmi)
Create a DSP object.
– @ brief Immobile Storage and Transfer (IST) Module
subroutine, public ist_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, fmi, mst)
@ brief Create a new package object
subroutine, public lkt_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, fmi, eqnsclfac, dvt, dvu, dvua)
Create a new lkt package.
subroutine gwt_ar(this)
GWT Model Allocate and Read.
subroutine gwt_fc(this, kiter, matrix_sln, inwtflag)
GWT Model fill coefficients.
subroutine gwt_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
GWT Model Final Convergence Check.
character(len=lenvarname), parameter dvu
dependent variable unit of measure, either "mass" or "energy"
integer(i4b), parameter niunit_gwt
subroutine create_gwt_packages(this, indis)
Source package info and begin to process.
subroutine gwt_ot_dv(this, idvsave, idvprint, ipflag)
GWT model dependent variable output.
subroutine gwt_mc(this, matrix_sln)
Map the positions of the GWT model connections in the numerical solution coefficient matrix.
character(len=lenvarname), parameter dvua
abbreviation of the dependent variable unit of measure, either "M" or "E"
subroutine gwt_cq(this, icnvg, isuppress_output)
GWT Model calculate flow.
subroutine gwt_bd(this, icnvg, isuppress_output)
GWT Model Budget.
subroutine allocate_scalars(this, modelname)
Allocate memory for non-allocatable members.
subroutine gwt_da(this)
Deallocate.
class(gwtmodeltype) function, pointer, public castasgwtmodel(model)
Cast to GwtModelType.
integer(i4b), parameter, public gwt_nbasepkg
GWT base package array descriptors.
subroutine create_bndpkgs(this, bndpkgs, pkgtypes, pkgnames, mempaths, inunits)
Source package info and begin to process.
character(len=lenpackagetype), dimension(gwt_nmultipkg), public gwt_multipkg
subroutine package_create(this, filtyp, ipakid, ipaknum, pakname, mempath, inunit, iout)
Create boundary condition packages for this model.
subroutine gwt_ac(this, sparse)
Add the internal connections of this model to the sparse matrix.
integer(i4b) function gwt_get_iasym(this)
return 1 if any package causes the matrix to be asymmetric. Otherwise return 0.
subroutine gwt_df(this)
Define packages of the GWT model.
subroutine gwt_dt(this)
GWT Model time step size.
subroutine gwt_ad(this)
GWT Model Time Step Advance.
subroutine gwt_cf(this, kiter)
GWT Model calculate coefficients.
subroutine gwt_ot_flow(this, icbcfl, ibudfl, icbcun)
GWT model output routine.
subroutine gwt_rp(this)
GWT Model Read and Prepare.
subroutine, public gwt_cr(filename, id, modelname)
Create a new groundwater transport model object.
character(len=lenpackagetype), dimension(gwt_nbasepkg), public gwt_basepkg
character(len=lenvarname), parameter dvt
dependent variable type, varies based on model type
subroutine gwt_bdentry(this, budterm, budtxt, rowlabel)
GroundWater Transport Model Budget Entry.
integer(i4b), parameter, public gwt_nmultipkg
GWT multi package array descriptors.
– @ brief Mobile Storage and Transfer (MST) Module
subroutine, public mst_cr(mstobj, name_model, inunit, iout, fmi)
@ brief Create a new package object
subroutine, public mwt_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, fmi, eqnsclfac, dvt, dvu, dvua)
Create new MWT package.
subroutine, public sft_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, fmi, eqnsclfac, dvt, dvu, dvua)
Create a new sft package.
subroutine, public src_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, depvartype)
Create a source loading package.
subroutine, public uzt_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, fmi, eqnsclfac, dvt, dvu, dvua)
Create a new UZT package.
This module defines variable data types.
type(listtype), public basemodellist
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
subroutine, public memorystore_remove(component, subcomponent, context)
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
This module contains simulation variables.
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
subroutine csr_diagsum(ia, flowja)
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
This module contains the base transport model type.
subroutine tsp_ot_dv(this, idvsave, idvprint, ipflag)
Generalized transport model output routine.
subroutine tsp_ot_flow(this, icbcfl, ibudfl, icbcun)
Generalized transport model output routine.
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 Mobile storage and transfer