29 character(len=LENVARNAME),
parameter ::
dvt =
'TEMPERATURE '
30 character(len=LENVARNAME),
parameter ::
dvu =
'ENERGY '
31 character(len=LENVARNAME),
parameter ::
dvua =
'E '
38 integer(I4B),
pointer :: inest => null()
39 integer(I4B),
pointer :: incnd => null()
72 character(len=LENPACKAGETYPE),
dimension(GWE_NBASEPKG) ::
gwe_basepkg
73 data gwe_basepkg/
'DIS6 ',
'DISV6',
'DISU6',
' ',
' ', &
74 &
'IC6 ',
'FMI6 ',
'EST6 ',
'ADV6 ',
' ', &
75 &
'CND6 ',
'SSM6 ',
'MVE6 ',
'OC6 ',
' ', &
76 &
'OBS6 ',
' ',
' ',
' ',
' ', &
85 character(len=LENPACKAGETYPE),
dimension(GWE_NMULTIPKG) ::
gwe_multipkg
86 data gwe_multipkg/
'CTP6 ',
'ESL6 ',
'LKE6 ',
'SFE6 ',
' ', &
87 &
'MWE6 ',
'UZE6 ',
'API6 ',
' ',
' ', &
97 subroutine gwe_cr(filename, id, modelname)
108 character(len=*),
intent(in) :: filename
109 integer(I4B),
intent(in) :: id
110 character(len=*),
intent(in) :: modelname
112 integer(I4B) :: indis
123 call this%allocate_scalars(modelname)
126 call this%set_tsp_labels(this%macronym,
dvt,
dvu,
dvua)
135 call this%tsp_cr(filename, id, modelname,
'GWE', indis)
138 call this%create_packages(indis)
154 class(
bndtype),
pointer :: packobj
157 call this%dis%dis_df()
158 call this%fmi%fmi_df(this%dis, 0)
159 if (this%inmvt > 0)
call this%mvt%mvt_df(this%dis)
160 if (this%inadv > 0)
call this%adv%adv_df()
161 if (this%incnd > 0)
call this%cnd%cnd_df(this%dis)
162 if (this%inssm > 0)
call this%ssm%ssm_df()
164 call this%budget%budget_df(
niunit_gwe, this%depvarunit, &
165 this%depvarunitabbrev)
168 if (this%inssm == 0)
then
169 if (this%fmi%nflowpack > 0)
then
170 call store_error(
'Flow model has boundary packages, but there &
171 &is no SSM package. The SSM package must be activated.', &
177 this%neq = this%dis%nodes
178 this%nja = this%dis%nja
179 this%ia => this%dis%con%ia
180 this%ja => this%dis%con%ja
183 call this%allocate_arrays()
186 do ip = 1, this%bndlist%Count()
188 call packobj%bnd_df(this%neq, this%dis)
189 packobj%TsManager%iout = this%iout
190 packobj%TasManager%iout = this%iout
194 call this%obs%obs_df(this%iout, this%name,
'GWE', this%dis)
206 class(
bndtype),
pointer :: packobj
210 call this%dis%dis_ac(this%moffset, sparse)
211 if (this%incnd > 0) &
212 call this%cnd%cnd_ac(this%moffset, sparse)
215 do ip = 1, this%bndlist%Count()
217 call packobj%bnd_ac(this%moffset, sparse)
229 class(
bndtype),
pointer :: packobj
234 call this%dis%dis_mc(this%moffset, this%idxglo, matrix_sln)
236 if (this%incnd > 0)
call this%cnd%cnd_mc(this%moffset, matrix_sln)
239 do ip = 1, this%bndlist%Count()
241 call packobj%bnd_mc(this%moffset, matrix_sln)
258 class(
bndtype),
pointer :: packobj
261 call this%fmi%fmi_ar(this%ibound)
262 if (this%inmvt > 0)
call this%mvt%mvt_ar()
263 if (this%inic > 0)
call this%ic%ic_ar(this%x)
264 if (this%inest > 0)
call this%est%est_ar(this%dis, this%ibound)
265 if (this%inadv > 0)
call this%adv%adv_ar(this%dis, this%ibound)
266 if (this%incnd > 0)
call this%cnd%cnd_ar(this%ibound, this%est%porosity)
267 if (this%inssm > 0)
call this%ssm%ssm_ar(this%dis, this%ibound, this%x)
268 if (this%inobs > 0)
call this%obs%tsp_obs_ar(this%ic, this%x, this%flowja)
271 this%eqnsclfac = this%gwecommon%gwerhow * this%gwecommon%gwecpw
277 call this%oc%oc_ar(this%x, this%dis,
dhnoflo, this%depvartype)
278 call this%budget%set_ibudcsv(this%oc%ibudcsv)
281 do ip = 1, this%bndlist%Count()
283 call packobj%set_pointers(this%dis%nodes, this%ibound, this%x, &
284 this%xold, this%flowja)
286 call packobj%bnd_ar()
300 class(
bndtype),
pointer :: packobj
304 call this%fmi%fmi_rp(this%inmvt)
305 if (this%inmvt > 0)
call this%mvt%mvt_rp()
311 if (this%inoc > 0)
call this%oc%oc_rp()
312 if (this%inssm > 0)
call this%ssm%ssm_rp()
313 do ip = 1, this%bndlist%Count()
315 call packobj%bnd_rp()
316 call packobj%bnd_rp_obs()
333 character(len=LINELENGTH) :: msg
337 call this%adv%adv_dt(dtmax, msg, this%est%porosity)
352 class(
bndtype),
pointer :: packobj
354 integer(I4B) :: irestore
355 integer(I4B) :: ip, n
360 if (irestore == 0)
then
363 do n = 1, this%dis%nodes
364 if (this%ibound(n) == 0)
then
367 this%xold(n) = this%x(n)
373 do n = 1, this%dis%nodes
374 this%x(n) = this%xold(n)
379 call this%fmi%fmi_ad(this%x)
382 if (this%incnd > 0)
call this%cnd%cnd_ad()
383 if (this%inssm > 0)
call this%ssm%ssm_ad()
384 do ip = 1, this%bndlist%Count()
386 call packobj%bnd_ad()
388 call packobj%bnd_ck()
393 call this%obs%obs_ad()
404 integer(I4B),
intent(in) :: kiter
406 class(
bndtype),
pointer :: packobj
410 do ip = 1, this%bndlist%Count()
412 call packobj%bnd_cf()
421 subroutine gwe_fc(this, kiter, matrix_sln, inwtflag)
424 integer(I4B),
intent(in) :: kiter
426 integer(I4B),
intent(in) :: inwtflag
428 class(
bndtype),
pointer :: packobj
432 call this%fmi%fmi_fc(this%dis%nodes, this%xold, this%nja, matrix_sln, &
433 this%idxglo, this%rhs)
434 if (this%inmvt > 0)
then
435 call this%mvt%mvt_fc(this%x, this%x)
437 if (this%inest > 0)
then
438 call this%est%est_fc(this%dis%nodes, this%xold, this%nja, matrix_sln, &
439 this%idxglo, this%x, this%rhs, kiter)
441 if (this%inadv > 0)
then
442 call this%adv%adv_fc(this%dis%nodes, matrix_sln, this%idxglo, this%x, &
445 if (this%incnd > 0)
then
446 call this%cnd%cnd_fc(kiter, this%dis%nodes, this%nja, matrix_sln, &
447 this%idxglo, this%rhs, this%x)
449 if (this%inssm > 0)
then
450 call this%ssm%ssm_fc(matrix_sln, this%idxglo, this%rhs)
454 do ip = 1, this%bndlist%Count()
456 call packobj%bnd_fc(this%rhs, this%ia, this%idxglo, matrix_sln)
465 subroutine gwe_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
468 integer(I4B),
intent(in) :: innertot
469 integer(I4B),
intent(in) :: kiter
470 integer(I4B),
intent(in) :: iend
471 integer(I4B),
intent(in) :: icnvgmod
472 character(len=LENPAKLOC),
intent(inout) :: cpak
473 integer(I4B),
intent(inout) :: ipak
474 real(DP),
intent(inout) :: dpak
477 if (this%inmvt > 0)
call this%mvt%mvt_cc(kiter, iend, icnvgmod, cpak, dpak)
484 subroutine gwe_cq(this, icnvg, isuppress_output)
489 integer(I4B),
intent(in) :: icnvg
490 integer(I4B),
intent(in) :: isuppress_output
494 class(
bndtype),
pointer :: packobj
502 this%flowja(i) =
dzero
504 if (this%inadv > 0)
call this%adv%adv_cq(this%x, this%flowja)
505 if (this%incnd > 0)
call this%cnd%cnd_cq(this%x, this%flowja)
506 if (this%inest > 0)
call this%est%est_cq(this%dis%nodes, this%x, this%xold, &
508 if (this%inssm > 0)
call this%ssm%ssm_cq(this%flowja)
509 if (this%infmi > 0)
call this%fmi%fmi_cq(this%x, this%flowja)
514 do ip = 1, this%bndlist%Count()
516 call packobj%bnd_cf()
517 call packobj%bnd_cq(this%x, this%flowja)
532 subroutine gwe_bd(this, icnvg, isuppress_output)
535 integer(I4B),
intent(in) :: icnvg
536 integer(I4B),
intent(in) :: isuppress_output
539 class(
bndtype),
pointer :: packobj
548 call this%budget%reset()
549 if (this%inest > 0)
call this%est%est_bd(isuppress_output, this%budget)
550 if (this%inssm > 0)
call this%ssm%ssm_bd(isuppress_output, this%budget)
551 if (this%infmi > 0)
call this%fmi%fmi_bd(isuppress_output, this%budget)
552 if (this%inmvt > 0)
call this%mvt%mvt_bd(this%x, this%x)
553 do ip = 1, this%bndlist%Count()
555 call packobj%bnd_bd(this%budget)
566 integer(I4B),
intent(in) :: icbcfl
567 integer(I4B),
intent(in) :: ibudfl
568 integer(I4B),
intent(in) :: icbcun
571 if (this%inest > 0)
call this%est%est_ot_flow(icbcfl, icbcun)
572 call this%TransportModelType%tsp_ot_flow(icbcfl, ibudfl, icbcun)
589 class(
bndtype),
pointer :: packobj
596 call this%dis%dis_da()
598 call this%fmi%fmi_da()
599 call this%adv%adv_da()
600 call this%cnd%cnd_da()
601 call this%ssm%ssm_da()
602 call this%est%est_da()
603 call this%mvt%mvt_da()
604 call this%budget%budget_da()
606 call this%obs%obs_da()
607 call this%gwecommon%gweshared_dat_da()
610 deallocate (this%dis)
612 deallocate (this%fmi)
613 deallocate (this%adv)
614 deallocate (this%cnd)
615 deallocate (this%ssm)
616 deallocate (this%est)
617 deallocate (this%mvt)
618 deallocate (this%budget)
620 deallocate (this%obs)
621 nullify (this%gwecommon)
624 do ip = 1, this%bndlist%Count()
626 call packobj%bnd_da()
635 call this%TransportModelType%tsp_da()
638 call this%NumericalModelType%model_da()
653 real(DP),
dimension(:, :),
intent(in) :: budterm
654 character(len=LENBUDTXT),
dimension(:),
intent(in) :: budtxt
655 character(len=*),
intent(in) :: rowlabel
657 call this%budget%addentry(budterm,
delt, budtxt, rowlabel=rowlabel)
666 integer(I4B) :: iasym
668 class(
bndtype),
pointer :: packobj
674 if (this%inadv > 0)
then
675 if (this%adv%iasym /= 0) iasym = 1
679 if (this%incnd > 0)
then
680 if (this%cnd%ixt3d /= 0) iasym = 1
684 do ip = 1, this%bndlist%Count()
686 if (packobj%iasym /= 0) iasym = 1
701 character(len=*),
intent(in) :: modelname
704 call this%allocate_tsp_scalars(modelname)
732 character(len=*),
intent(in) :: filtyp
733 character(len=LINELENGTH) :: errmsg
734 integer(I4B),
intent(in) :: ipakid
735 integer(I4B),
intent(in) :: ipaknum
736 character(len=*),
intent(in) :: pakname
737 character(len=*),
intent(in) :: mempath
738 integer(I4B),
intent(in) :: inunit
739 integer(I4B),
intent(in) :: iout
741 class(
bndtype),
pointer :: packobj
742 class(
bndtype),
pointer :: packobj2
748 call ctp_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
749 pakname, this%depvartype, mempath)
751 call esl_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
752 pakname, this%gwecommon)
754 call lke_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
755 pakname, this%fmi, this%eqnsclfac, this%gwecommon, &
756 this%depvartype, this%depvarunit, this%depvarunitabbrev)
758 call sfe_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
759 pakname, this%fmi, this%eqnsclfac, this%gwecommon, &
760 this%depvartype, this%depvarunit, this%depvarunitabbrev)
762 call mwe_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
763 pakname, this%fmi, this%eqnsclfac, this%gwecommon, &
764 this%depvartype, this%depvarunit, this%depvarunitabbrev)
766 call uze_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
767 pakname, this%fmi, this%eqnsclfac, this%gwecommon, &
768 this%depvartype, this%depvarunit, this%depvarunitabbrev)
773 write (errmsg, *)
'Invalid package type: ', filtyp
780 do ip = 1, this%bndlist%Count()
782 if (packobj2%packName == pakname)
then
783 write (errmsg,
'(a,a)')
'Cannot create package. Package name '// &
784 'already exists: ', trim(pakname)
795 class(*),
pointer :: model
800 if (.not.
associated(model))
return
816 integer(I4B),
dimension(:),
allocatable,
intent(inout) :: bndpkgs
818 pointer,
intent(inout) :: pkgtypes
820 pointer,
intent(inout) :: pkgnames
822 pointer,
intent(inout) :: mempaths
823 integer(I4B),
dimension(:),
contiguous, &
824 pointer,
intent(inout) :: inunits
826 integer(I4B) :: ipakid, ipaknum
827 character(len=LENFTYPE) :: pkgtype, bndptype
828 character(len=LENPACKAGENAME) :: pkgname
829 character(len=LENMEMPATH) :: mempath
830 integer(I4B),
pointer :: inunit
833 if (
allocated(bndpkgs))
then
838 do n = 1,
size(bndpkgs)
840 pkgtype = pkgtypes(bndpkgs(n))
841 pkgname = pkgnames(bndpkgs(n))
842 mempath = mempaths(bndpkgs(n))
843 inunit => inunits(bndpkgs(n))
845 if (bndptype /= pkgtype)
then
850 call this%package_create(pkgtype, ipakid, ipaknum, pkgname, mempath, &
853 ipaknum = ipaknum + 1
875 integer(I4B),
intent(in) :: indis
878 pointer :: pkgtypes => null()
880 pointer :: pkgnames => null()
882 pointer :: mempaths => null()
883 integer(I4B),
dimension(:),
contiguous, &
884 pointer :: inunits => null()
885 character(len=LENMEMPATH) :: model_mempath
886 character(len=LENFTYPE) :: pkgtype
887 character(len=LENPACKAGENAME) :: pkgname
888 character(len=LENMEMPATH) :: mempath
889 integer(I4B),
pointer :: inunit
890 integer(I4B),
dimension(:),
allocatable :: bndpkgs
892 character(len=LENMEMPATH) :: mempathcnd =
''
898 call mem_setptr(pkgtypes,
'PKGTYPES', model_mempath)
899 call mem_setptr(pkgnames,
'PKGNAMES', model_mempath)
900 call mem_setptr(mempaths,
'MEMPATHS', model_mempath)
901 call mem_setptr(inunits,
'INUNITS', model_mempath)
903 do n = 1,
size(pkgtypes)
906 pkgtype = pkgtypes(n)
907 pkgname = pkgnames(n)
908 mempath = mempaths(n)
912 select case (pkgtype)
918 case (
'CTP6',
'ESL6',
'LKE6',
'SFE6', &
919 'MWE6',
'UZE6',
'API6')
921 bndpkgs(
size(bndpkgs)) = n
928 call est_cr(this%est, this%name, this%inest, this%iout, this%fmi, &
929 this%eqnsclfac, this%gwecommon)
930 call cnd_cr(this%cnd, this%name, mempathcnd, this%incnd, this%iout, &
931 this%fmi, this%eqnsclfac, this%gwecommon)
934 call this%ftype_check(indis, this%inest)
936 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
subroutine, public cnd_cr(cndobj, name_model, input_mempath, inunit, iout, fmi, eqnsclfac, gwecommon)
Create a new CND object.
subroutine, public ctp_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, depvartype, mempath)
Create a new constant temperature package.
subroutine, public esl_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, gwecommon)
Create an energy source loading package.
– @ brief Energy Storage and Transfer (EST) Module
subroutine, public est_cr(estobj, name_model, inunit, iout, fmi, eqnsclfac, gwecommon)
@ brief Create a new EST package object
subroutine, public lke_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, fmi, eqnsclfac, gwecommon, dvt, dvu, dvua)
Create a new lke package.
subroutine create_bndpkgs(this, bndpkgs, pkgtypes, pkgnames, mempaths, inunits)
Source package info and begin to process.
character(len=lenpackagetype), dimension(gwe_nmultipkg), public gwe_multipkg
subroutine gwe_cf(this, kiter)
GWE Model calculate coefficients.
subroutine gwe_ot_flow(this, icbcfl, ibudfl, icbcun)
GWE model output routine.
subroutine gwe_bd(this, icnvg, isuppress_output)
GWE Model Budget.
subroutine gwe_bdentry(this, budterm, budtxt, rowlabel)
GroundWater Energy Transport Model Budget Entry.
integer(i4b), parameter, public gwe_nbasepkg
GWE base package array descriptors.
subroutine gwe_ad(this)
GWE Model Time Step Advance.
subroutine gwe_cq(this, icnvg, isuppress_output)
GWE Model calculate flow.
subroutine gwe_mc(this, matrix_sln)
Map the positions of the GWE model connections in the numerical solution coefficient matrix.
subroutine gwe_da(this)
Deallocate.
character(len=lenvarname), parameter dvt
dependent variable type, varies based on model type
subroutine gwe_df(this)
Define packages of the GWE model.
subroutine gwe_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
GWE Model Final Convergence Check.
subroutine allocate_scalars(this, modelname)
Allocate memory for non-allocatable members.
subroutine package_create(this, filtyp, ipakid, ipaknum, pakname, mempath, inunit, iout)
Create boundary condition packages for this model.
subroutine gwe_ac(this, sparse)
Add the internal connections of this model to the sparse matrix.
subroutine gwe_rp(this)
GWE Model Read and Prepare.
integer(i4b), parameter niunit_gwe
subroutine, public gwe_cr(filename, id, modelname)
Create a new groundwater energy transport model object.
subroutine gwe_fc(this, kiter, matrix_sln, inwtflag)
GWE Model fill coefficients.
integer(i4b) function gwe_get_iasym(this)
return 1 if any package causes the matrix to be asymmetric. Otherwise return 0.
character(len=lenvarname), parameter dvu
dependent variable unit of measure, either "mass" or "energy"
subroutine gwe_ar(this)
GWE Model Allocate and Read.
character(len=lenpackagetype), dimension(gwe_nbasepkg), public gwe_basepkg
integer(i4b), parameter, public gwe_nmultipkg
GWE multi package array descriptors.
subroutine create_gwe_packages(this, indis)
Source package info and begin to process.
subroutine gwe_dt(this)
GWT Model time step size.
class(gwemodeltype) function, pointer, public castasgwemodel(model)
Cast to GweModelType.
character(len=lenvarname), parameter dvua
abbreviation of the dependent variable unit of measure, either "M" or "E"
subroutine, public mwe_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, fmi, eqnsclfac, gwecommon, dvt, dvu, dvua)
Create new MWE package.
subroutine, public sfe_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, fmi, eqnsclfac, gwecommon, dvt, dvu, dvua)
Create a new sfe package.
subroutine, public uze_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, fmi, eqnsclfac, gwecommon, dvt, dvu, dvua)
Create a new UZE 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_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 Energy storage and transfer