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_log()
317 call packobj%bnd_rp_obs()
334 character(len=LINELENGTH) :: msg
338 call this%adv%adv_dt(dtmax, msg, this%est%porosity)
353 class(
bndtype),
pointer :: packobj
355 integer(I4B) :: irestore
356 integer(I4B) :: ip, n
361 if (irestore == 0)
then
364 do n = 1, this%dis%nodes
365 if (this%ibound(n) == 0)
then
368 this%xold(n) = this%x(n)
374 do n = 1, this%dis%nodes
375 this%x(n) = this%xold(n)
380 call this%fmi%fmi_ad(this%x)
383 if (this%incnd > 0)
call this%cnd%cnd_ad()
384 if (this%inssm > 0)
call this%ssm%ssm_ad()
385 do ip = 1, this%bndlist%Count()
387 call packobj%bnd_ad()
389 call packobj%bnd_ck()
394 call this%obs%obs_ad()
405 integer(I4B),
intent(in) :: kiter
407 class(
bndtype),
pointer :: packobj
411 do ip = 1, this%bndlist%Count()
413 call packobj%bnd_cf()
422 subroutine gwe_fc(this, kiter, matrix_sln, inwtflag)
425 integer(I4B),
intent(in) :: kiter
427 integer(I4B),
intent(in) :: inwtflag
429 class(
bndtype),
pointer :: packobj
433 call this%fmi%fmi_fc(this%dis%nodes, this%xold, this%nja, matrix_sln, &
434 this%idxglo, this%rhs)
435 if (this%inmvt > 0)
then
436 call this%mvt%mvt_fc(this%x, this%x)
438 if (this%inest > 0)
then
439 call this%est%est_fc(this%dis%nodes, this%xold, this%nja, matrix_sln, &
440 this%idxglo, this%x, this%rhs, kiter)
442 if (this%inadv > 0)
then
443 call this%adv%adv_fc(this%dis%nodes, matrix_sln, this%idxglo, this%x, &
446 if (this%incnd > 0)
then
447 call this%cnd%cnd_fc(kiter, this%dis%nodes, this%nja, matrix_sln, &
448 this%idxglo, this%rhs, this%x)
450 if (this%inssm > 0)
then
451 call this%ssm%ssm_fc(matrix_sln, this%idxglo, this%rhs)
455 do ip = 1, this%bndlist%Count()
457 call packobj%bnd_fc(this%rhs, this%ia, this%idxglo, matrix_sln)
466 subroutine gwe_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
469 integer(I4B),
intent(in) :: innertot
470 integer(I4B),
intent(in) :: kiter
471 integer(I4B),
intent(in) :: iend
472 integer(I4B),
intent(in) :: icnvgmod
473 character(len=LENPAKLOC),
intent(inout) :: cpak
474 integer(I4B),
intent(inout) :: ipak
475 real(DP),
intent(inout) :: dpak
478 if (this%inmvt > 0)
call this%mvt%mvt_cc(kiter, iend, icnvgmod, cpak, dpak)
485 subroutine gwe_cq(this, icnvg, isuppress_output)
490 integer(I4B),
intent(in) :: icnvg
491 integer(I4B),
intent(in) :: isuppress_output
495 class(
bndtype),
pointer :: packobj
503 this%flowja(i) =
dzero
505 if (this%inadv > 0)
call this%adv%adv_cq(this%x, this%flowja)
506 if (this%incnd > 0)
call this%cnd%cnd_cq(this%x, this%flowja)
507 if (this%inest > 0)
call this%est%est_cq(this%dis%nodes, this%x, this%xold, &
509 if (this%inssm > 0)
call this%ssm%ssm_cq(this%flowja)
510 if (this%infmi > 0)
call this%fmi%fmi_cq(this%x, this%flowja)
515 do ip = 1, this%bndlist%Count()
517 call packobj%bnd_cf()
518 call packobj%bnd_cq(this%x, this%flowja)
533 subroutine gwe_bd(this, icnvg, isuppress_output)
536 integer(I4B),
intent(in) :: icnvg
537 integer(I4B),
intent(in) :: isuppress_output
540 class(
bndtype),
pointer :: packobj
549 call this%budget%reset()
550 if (this%inest > 0)
call this%est%est_bd(isuppress_output, this%budget)
551 if (this%inssm > 0)
call this%ssm%ssm_bd(isuppress_output, this%budget)
552 if (this%infmi > 0)
call this%fmi%fmi_bd(isuppress_output, this%budget)
553 if (this%inmvt > 0)
call this%mvt%mvt_bd(this%x, this%x)
554 do ip = 1, this%bndlist%Count()
556 call packobj%bnd_bd(this%budget)
567 integer(I4B),
intent(in) :: icbcfl
568 integer(I4B),
intent(in) :: ibudfl
569 integer(I4B),
intent(in) :: icbcun
572 if (this%inest > 0)
call this%est%est_ot_flow(icbcfl, icbcun)
573 call this%TransportModelType%tsp_ot_flow(icbcfl, ibudfl, icbcun)
590 class(
bndtype),
pointer :: packobj
597 call this%dis%dis_da()
599 call this%fmi%fmi_da()
600 call this%adv%adv_da()
601 call this%cnd%cnd_da()
602 call this%ssm%ssm_da()
603 call this%est%est_da()
604 call this%mvt%mvt_da()
605 call this%budget%budget_da()
607 call this%obs%obs_da()
608 call this%gwecommon%gweshared_dat_da()
611 deallocate (this%dis)
613 deallocate (this%fmi)
614 deallocate (this%adv)
615 deallocate (this%cnd)
616 deallocate (this%ssm)
617 deallocate (this%est)
618 deallocate (this%mvt)
619 deallocate (this%budget)
621 deallocate (this%obs)
622 nullify (this%gwecommon)
625 do ip = 1, this%bndlist%Count()
627 call packobj%bnd_da()
636 call this%TransportModelType%tsp_da()
639 call this%NumericalModelType%model_da()
654 real(DP),
dimension(:, :),
intent(in) :: budterm
655 character(len=LENBUDTXT),
dimension(:),
intent(in) :: budtxt
656 character(len=*),
intent(in) :: rowlabel
658 call this%budget%addentry(budterm,
delt, budtxt, rowlabel=rowlabel)
667 integer(I4B) :: iasym
669 class(
bndtype),
pointer :: packobj
675 if (this%inadv > 0)
then
676 if (this%adv%iasym /= 0) iasym = 1
680 if (this%incnd > 0)
then
681 if (this%cnd%ixt3d /= 0) iasym = 1
685 do ip = 1, this%bndlist%Count()
687 if (packobj%iasym /= 0) iasym = 1
702 character(len=*),
intent(in) :: modelname
705 call this%allocate_tsp_scalars(modelname)
733 character(len=*),
intent(in) :: filtyp
734 character(len=LINELENGTH) :: errmsg
735 integer(I4B),
intent(in) :: ipakid
736 integer(I4B),
intent(in) :: ipaknum
737 character(len=*),
intent(in) :: pakname
738 character(len=*),
intent(in) :: mempath
739 integer(I4B),
intent(in) :: inunit
740 integer(I4B),
intent(in) :: iout
742 class(
bndtype),
pointer :: packobj
743 class(
bndtype),
pointer :: packobj2
749 call ctp_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
750 pakname, this%depvartype, mempath)
752 call esl_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
753 pakname, this%gwecommon, mempath)
755 call lke_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
756 pakname, this%fmi, this%eqnsclfac, this%gwecommon, &
757 this%depvartype, this%depvarunit, this%depvarunitabbrev)
759 call sfe_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
760 pakname, this%fmi, this%eqnsclfac, this%gwecommon, &
761 this%depvartype, this%depvarunit, this%depvarunitabbrev)
763 call mwe_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
764 pakname, this%fmi, this%eqnsclfac, this%gwecommon, &
765 this%depvartype, this%depvarunit, this%depvarunitabbrev)
767 call uze_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
768 pakname, this%fmi, this%eqnsclfac, this%gwecommon, &
769 this%depvartype, this%depvarunit, this%depvarunitabbrev)
774 write (errmsg, *)
'Invalid package type: ', filtyp
781 do ip = 1, this%bndlist%Count()
783 if (packobj2%packName == pakname)
then
784 write (errmsg,
'(a,a)')
'Cannot create package. Package name '// &
785 'already exists: ', trim(pakname)
796 class(*),
pointer :: model
801 if (.not.
associated(model))
return
817 integer(I4B),
dimension(:),
allocatable,
intent(inout) :: bndpkgs
819 pointer,
intent(inout) :: pkgtypes
821 pointer,
intent(inout) :: pkgnames
823 pointer,
intent(inout) :: mempaths
824 integer(I4B),
dimension(:),
contiguous, &
825 pointer,
intent(inout) :: inunits
827 integer(I4B) :: ipakid, ipaknum
828 character(len=LENFTYPE) :: pkgtype, bndptype
829 character(len=LENPACKAGENAME) :: pkgname
830 character(len=LENMEMPATH) :: mempath
831 integer(I4B),
pointer :: inunit
834 if (
allocated(bndpkgs))
then
839 do n = 1,
size(bndpkgs)
841 pkgtype = pkgtypes(bndpkgs(n))
842 pkgname = pkgnames(bndpkgs(n))
843 mempath = mempaths(bndpkgs(n))
844 inunit => inunits(bndpkgs(n))
846 if (bndptype /= pkgtype)
then
851 call this%package_create(pkgtype, ipakid, ipaknum, pkgname, mempath, &
854 ipaknum = ipaknum + 1
876 integer(I4B),
intent(in) :: indis
879 pointer :: pkgtypes => null()
881 pointer :: pkgnames => null()
883 pointer :: mempaths => null()
884 integer(I4B),
dimension(:),
contiguous, &
885 pointer :: inunits => null()
886 character(len=LENMEMPATH) :: model_mempath
887 character(len=LENFTYPE) :: pkgtype
888 character(len=LENPACKAGENAME) :: pkgname
889 character(len=LENMEMPATH) :: mempath
890 integer(I4B),
pointer :: inunit
891 integer(I4B),
dimension(:),
allocatable :: bndpkgs
893 character(len=LENMEMPATH) :: mempathcnd =
''
894 character(len=LENMEMPATH) :: mempathest =
''
900 call mem_setptr(pkgtypes,
'PKGTYPES', model_mempath)
901 call mem_setptr(pkgnames,
'PKGNAMES', model_mempath)
902 call mem_setptr(mempaths,
'MEMPATHS', model_mempath)
903 call mem_setptr(inunits,
'INUNITS', model_mempath)
905 do n = 1,
size(pkgtypes)
908 pkgtype = pkgtypes(n)
909 pkgname = pkgnames(n)
910 mempath = mempaths(n)
914 select case (pkgtype)
921 case (
'CTP6',
'ESL6',
'LKE6',
'SFE6', &
922 'MWE6',
'UZE6',
'API6')
924 bndpkgs(
size(bndpkgs)) = n
931 call est_cr(this%est, this%name, mempathest, this%inest, this%iout, &
932 this%fmi, this%eqnsclfac, this%gwecommon)
933 call cnd_cr(this%cnd, this%name, mempathcnd, this%incnd, this%iout, &
934 this%fmi, this%eqnsclfac, this%gwecommon)
937 call this%ftype_check(indis, this%inest)
939 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, 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
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, input_mempath)
Create an energy source loading package.
@ brief Energy Storage and Transfer (EST) Module
subroutine, public est_cr(estobj, name_model, input_mempath, 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