53 character(len=*),
parameter ::
ftype =
'MWE'
54 character(len=*),
parameter ::
flowtype =
'MAW'
55 character(len=16) ::
text =
' MWE'
61 integer(I4B),
pointer :: idxbudrate => null()
62 integer(I4B),
pointer :: idxbudfwrt => null()
63 integer(I4B),
pointer :: idxbudrtmv => null()
64 integer(I4B),
pointer :: idxbudfrtm => null()
65 integer(I4B),
pointer :: idxbudmwcd => null()
66 real(dp),
dimension(:),
pointer,
contiguous :: temprate => null()
94 subroutine mwe_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, &
95 fmi, eqnsclfac, gwecommon, dvt, dvu, dvua)
97 class(
bndtype),
pointer :: packobj
98 integer(I4B),
intent(in) :: id
99 integer(I4B),
intent(in) :: ibcnum
100 integer(I4B),
intent(in) :: inunit
101 integer(I4B),
intent(in) :: iout
102 character(len=*),
intent(in) :: namemodel
103 character(len=*),
intent(in) :: pakname
105 real(dp),
intent(in),
pointer :: eqnsclfac
107 character(len=*),
intent(in) :: dvt
108 character(len=*),
intent(in) :: dvu
109 character(len=*),
intent(in) :: dvua
118 call packobj%set_names(ibcnum, namemodel, pakname,
ftype)
122 call mweobj%allocate_scalars()
125 call packobj%pack_initialize()
127 packobj%inunit = inunit
130 packobj%ibcnum = ibcnum
140 mweobj%eqnsclfac => eqnsclfac
145 mweobj%gwecommon => gwecommon
148 mweobj%depvartype = dvt
149 mweobj%depvarunit = dvu
150 mweobj%depvarunitabbrev = dvua
161 character(len=LINELENGTH) :: errmsg
162 class(
bndtype),
pointer :: packobj
163 integer(I4B) :: ip, icount
164 integer(I4B) :: nbudterm
174 if (this%fmi%flows_from_file)
then
175 call this%fmi%set_aptbudobj_pointer(this%flowpackagename, this%flowbudptr)
176 if (
associated(this%flowbudptr)) found = .true.
179 if (
associated(this%fmi%gwfbndlist))
then
182 do ip = 1, this%fmi%gwfbndlist%Count()
184 if (packobj%packName == this%flowpackagename)
then
189 this%flowpackagebnd => packobj
190 select type (packobj)
192 this%flowbudptr => packobj%budobj
201 if (.not. found)
then
202 write (errmsg,
'(a)')
'Could not find flow package with name '&
203 &//trim(adjustl(this%flowpackagename))//
'.'
205 call this%parser%StoreErrorUnit()
210 nbudterm = this%flowbudptr%nbudterm
211 call mem_allocate(this%idxbudssm, nbudterm,
'IDXBUDSSM', this%memoryPath)
214 write (this%iout,
'(/, a, a)') &
215 'PROCESSING '//
ftype//
' INFORMATION FOR ', this%packName
216 write (this%iout,
'(a)')
' IDENTIFYING FLOW TERMS IN '//
flowtype//
' PACKAGE'
217 write (this%iout,
'(a, i0)') &
218 ' NUMBER OF '//
flowtype//
' = ', this%flowbudptr%ncv
220 do ip = 1, this%flowbudptr%nbudterm
221 select case (trim(adjustl(this%flowbudptr%budterm(ip)%flowtype)))
222 case (
'FLOW-JA-FACE')
224 this%idxbudssm(ip) = 0
227 this%idxbudssm(ip) = 0
230 this%idxbudssm(ip) = 0
233 this%idxbudssm(ip) = 0
236 this%idxbudssm(ip) = 0
239 this%idxbudssm(ip) = 0
240 case (
'FW-RATE-TO-MVR')
242 this%idxbudssm(ip) = 0
245 this%idxbudssm(ip) = 0
248 this%idxbudssm(ip) = 0
251 this%idxbudssm(ip) = 0
256 this%idxbudssm(ip) = icount
259 write (this%iout,
'(a, i0, " = ", a,/, a, i0)') &
260 ' TERM ', ip, trim(adjustl(this%flowbudptr%budterm(ip)%flowtype)), &
261 ' MAX NO. OF ENTRIES = ', this%flowbudptr%budterm(ip)%maxlist
263 write (this%iout,
'(a, //)')
'DONE PROCESSING '//
ftype//
' INFORMATION'
266 this%idxbudmwcd = this%idxbudgwf
277 real(DP),
dimension(:),
intent(inout) :: rhs
278 integer(I4B),
dimension(:),
intent(in) :: ia
279 integer(I4B),
dimension(:),
intent(in) :: idxglo
282 integer(I4B) :: j, n, n1, n2
284 integer(I4B) :: iposd, iposoffd
285 integer(I4B) :: ipossymd, ipossymoffd
286 integer(I4B) :: auxpos
296 if (this%idxbudrate /= 0)
then
297 do j = 1, this%flowbudptr%budterm(this%idxbudrate)%nlist
298 call this%mwe_rate_term(j, n1, n2, rrate, rhsval, hcofval)
299 iloc = this%idxlocnode(n1)
300 iposd = this%idxpakdiag(n1)
301 call matrix_sln%add_value_pos(iposd, hcofval)
302 rhs(iloc) = rhs(iloc) + rhsval
307 if (this%idxbudfwrt /= 0)
then
308 do j = 1, this%flowbudptr%budterm(this%idxbudfwrt)%nlist
309 call this%mwe_fwrt_term(j, n1, n2, rrate, rhsval, hcofval)
310 iloc = this%idxlocnode(n1)
311 iposd = this%idxpakdiag(n1)
312 call matrix_sln%add_value_pos(iposd, hcofval)
313 rhs(iloc) = rhs(iloc) + rhsval
318 if (this%idxbudrtmv /= 0)
then
319 do j = 1, this%flowbudptr%budterm(this%idxbudrtmv)%nlist
320 call this%mwe_rtmv_term(j, n1, n2, rrate, rhsval, hcofval)
321 iloc = this%idxlocnode(n1)
322 iposd = this%idxpakdiag(n1)
323 call matrix_sln%add_value_pos(iposd, hcofval)
324 rhs(iloc) = rhs(iloc) + rhsval
329 if (this%idxbudfrtm /= 0)
then
330 do j = 1, this%flowbudptr%budterm(this%idxbudfrtm)%nlist
331 call this%mwe_frtm_term(j, n1, n2, rrate, rhsval, hcofval)
332 iloc = this%idxlocnode(n1)
333 iposd = this%idxpakdiag(n1)
334 call matrix_sln%add_value_pos(iposd, hcofval)
335 rhs(iloc) = rhs(iloc) + rhsval
340 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
343 n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
344 if (this%iboundpak(n) /= 0)
then
347 auxpos = this%flowbudptr%budterm(this%idxbudgwf)%naux
348 wa = this%flowbudptr%budterm(this%idxbudgwf)%auxvar(auxpos, j)
351 ctherm = ktf * wa / s
354 iposd = this%idxdglo(j)
355 iposoffd = this%idxoffdglo(j)
356 call matrix_sln%add_value_pos(iposd, -ctherm)
357 call matrix_sln%add_value_pos(iposoffd, ctherm)
360 ipossymd = this%idxsymdglo(j)
361 ipossymoffd = this%idxsymoffdglo(j)
362 call matrix_sln%add_value_pos(ipossymd, -ctherm)
363 call matrix_sln%add_value_pos(ipossymoffd, ctherm)
376 integer(I4B) :: n1, n2
380 if (this%idxbudrate /= 0)
then
381 do j = 1, this%flowbudptr%budterm(this%idxbudrate)%nlist
382 call this%mwe_rate_term(j, n1, n2, rrate)
383 this%dbuff(n1) = this%dbuff(n1) + rrate
388 if (this%idxbudfwrt /= 0)
then
389 do j = 1, this%flowbudptr%budterm(this%idxbudfwrt)%nlist
390 call this%mwe_fwrt_term(j, n1, n2, rrate)
391 this%dbuff(n1) = this%dbuff(n1) + rrate
396 if (this%idxbudrtmv /= 0)
then
397 do j = 1, this%flowbudptr%budterm(this%idxbudrtmv)%nlist
398 call this%mwe_rtmv_term(j, n1, n2, rrate)
399 this%dbuff(n1) = this%dbuff(n1) + rrate
404 if (this%idxbudfrtm /= 0)
then
405 do j = 1, this%flowbudptr%budterm(this%idxbudfrtm)%nlist
406 call this%mwe_frtm_term(j, n1, n2, rrate)
407 this%dbuff(n1) = this%dbuff(n1) + rrate
420 integer(I4B) :: nbudterms
424 if (this%idxbudfwrt /= 0) nbudterms = nbudterms + 1
425 if (this%idxbudrtmv /= 0) nbudterms = nbudterms + 1
426 if (this%idxbudfrtm /= 0) nbudterms = nbudterms + 1
427 if (this%idxbudmwcd /= 0) nbudterms = nbudterms + 1
437 integer(I4B),
intent(inout) :: idx
439 integer(I4B) :: n, n1, n2
440 integer(I4B) :: maxlist, naux
442 character(len=LENBUDTXT) :: text
447 maxlist = this%flowbudptr%budterm(this%idxbudrate)%maxlist
449 call this%budobj%budterm(idx)%initialize(text, &
454 maxlist, .false., .false., &
458 if (this%idxbudfwrt /= 0)
then
461 maxlist = this%flowbudptr%budterm(this%idxbudfwrt)%maxlist
463 call this%budobj%budterm(idx)%initialize(text, &
468 maxlist, .false., .false., &
473 if (this%idxbudrtmv /= 0)
then
474 text =
' RATE-TO-MVR'
476 maxlist = this%flowbudptr%budterm(this%idxbudrtmv)%maxlist
478 call this%budobj%budterm(idx)%initialize(text, &
483 maxlist, .false., .false., &
488 if (this%idxbudfrtm /= 0)
then
489 text =
' FW-RATE-TO-MVR'
491 maxlist = this%flowbudptr%budterm(this%idxbudfrtm)%maxlist
493 call this%budobj%budterm(idx)%initialize(text, &
498 maxlist, .false., .false., &
503 text =
' WELLBORE-COND'
505 maxlist = this%flowbudptr%budterm(this%idxbudmwcd)%maxlist
507 call this%budobj%budterm(idx)%initialize(text, &
512 maxlist, .false., .false., &
514 call this%budobj%budterm(idx)%reset(maxlist)
517 n1 = this%flowbudptr%budterm(this%idxbudgwf)%id1(n)
518 n2 = this%flowbudptr%budterm(this%idxbudgwf)%id2(n)
519 call this%budobj%budterm(idx)%update_term(n1, n2, q)
528 integer(I4B),
intent(inout) :: idx
529 real(DP),
dimension(:),
intent(in) :: x
530 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
531 real(DP),
intent(inout) :: ccratin
532 real(DP),
intent(inout) :: ccratout
534 integer(I4B) :: j, n1, n2
535 integer(I4B) :: nlist
536 integer(I4B) :: igwfnode
537 integer(I4B) :: idiag
538 integer(I4B) :: auxpos
547 nlist = this%flowbudptr%budterm(this%idxbudrate)%nlist
548 call this%budobj%budterm(idx)%reset(nlist)
550 call this%mwe_rate_term(j, n1, n2, q)
551 call this%budobj%budterm(idx)%update_term(n1, n2, q)
552 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
556 if (this%idxbudfwrt /= 0)
then
558 nlist = this%flowbudptr%budterm(this%idxbudfwrt)%nlist
559 call this%budobj%budterm(idx)%reset(nlist)
561 call this%mwe_fwrt_term(j, n1, n2, q)
562 call this%budobj%budterm(idx)%update_term(n1, n2, q)
563 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
568 if (this%idxbudrtmv /= 0)
then
570 nlist = this%flowbudptr%budterm(this%idxbudrtmv)%nlist
571 call this%budobj%budterm(idx)%reset(nlist)
573 call this%mwe_rtmv_term(j, n1, n2, q)
574 call this%budobj%budterm(idx)%update_term(n1, n2, q)
575 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
580 if (this%idxbudfrtm /= 0)
then
582 nlist = this%flowbudptr%budterm(this%idxbudfrtm)%nlist
583 call this%budobj%budterm(idx)%reset(nlist)
585 call this%mwe_frtm_term(j, n1, n2, q)
586 call this%budobj%budterm(idx)%update_term(n1, n2, q)
587 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
593 call this%budobj%budterm(idx)%reset(this%maxbound)
594 do j = 1, this%flowbudptr%budterm(this%idxbudmwcd)%nlist
596 n1 = this%flowbudptr%budterm(this%idxbudmwcd)%id1(j)
597 if (this%iboundpak(n1) /= 0)
then
598 igwfnode = this%flowbudptr%budterm(this%idxbudmwcd)%id2(j)
599 auxpos = this%flowbudptr%budterm(this%idxbudgwf)%naux
600 wa = this%flowbudptr%budterm(this%idxbudgwf)%auxvar(auxpos, j)
602 s = this%rfeatthk(n1)
603 ctherm = ktf * wa / s
604 q = ctherm * (x(igwfnode) - this%xnewpak(n1))
606 call this%budobj%budterm(idx)%update_term(n1, igwfnode, q)
607 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
608 if (this%iboundpak(n1) /= 0)
then
610 this%simvals(j) = this%simvals(j) - q
611 idiag = this%dis%con%ia(igwfnode)
612 flowja(idiag) = flowja(idiag) - q
627 call this%TspAptType%allocate_scalars()
630 call mem_allocate(this%idxbudrate,
'IDXBUDRATE', this%memoryPath)
631 call mem_allocate(this%idxbudfwrt,
'IDXBUDFWRT', this%memoryPath)
632 call mem_allocate(this%idxbudrtmv,
'IDXBUDRTMV', this%memoryPath)
633 call mem_allocate(this%idxbudfrtm,
'IDXBUDFRTM', this%memoryPath)
634 call mem_allocate(this%idxbudmwcd,
'IDXBUDMWCD', this%memoryPath)
656 call mem_allocate(this%temprate, this%ncv,
'TEMPRATE', this%memoryPath)
659 call this%TspAptType%apt_allocate_arrays()
663 this%temprate(n) =
dzero
686 call this%TspAptType%bnd_da()
695 integer(I4B),
intent(in) :: ientry
696 integer(I4B),
intent(inout) :: n1
697 integer(I4B),
intent(inout) :: n2
698 real(DP),
intent(inout),
optional :: rrate
699 real(DP),
intent(inout),
optional :: rhsval
700 real(DP),
intent(inout),
optional :: hcofval
706 n1 = this%flowbudptr%budterm(this%idxbudrate)%id1(ientry)
707 n2 = this%flowbudptr%budterm(this%idxbudrate)%id2(ientry)
709 qbnd = this%flowbudptr%budterm(this%idxbudrate)%flow(ientry)
710 if (qbnd <
dzero)
then
711 ctmp = this%xnewpak(n1)
715 ctmp = this%temprate(n1)
719 if (
present(rrate)) rrate = qbnd * ctmp * this%eqnsclfac
720 if (
present(rhsval)) rhsval = r * this%eqnsclfac
721 if (
present(hcofval)) hcofval = h * this%eqnsclfac
730 integer(I4B),
intent(in) :: ientry
731 integer(I4B),
intent(inout) :: n1
732 integer(I4B),
intent(inout) :: n2
733 real(DP),
intent(inout),
optional :: rrate
734 real(DP),
intent(inout),
optional :: rhsval
735 real(DP),
intent(inout),
optional :: hcofval
740 n1 = this%flowbudptr%budterm(this%idxbudfwrt)%id1(ientry)
741 n2 = this%flowbudptr%budterm(this%idxbudfwrt)%id2(ientry)
742 qbnd = this%flowbudptr%budterm(this%idxbudfwrt)%flow(ientry)
743 ctmp = this%xnewpak(n1)
744 if (
present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
745 if (
present(rhsval)) rhsval =
dzero
746 if (
present(hcofval)) hcofval = qbnd * this%eqnsclfac
755 integer(I4B),
intent(in) :: ientry
756 integer(I4B),
intent(inout) :: n1
757 integer(I4B),
intent(inout) :: n2
758 real(DP),
intent(inout),
optional :: rrate
759 real(DP),
intent(inout),
optional :: rhsval
760 real(DP),
intent(inout),
optional :: hcofval
765 n1 = this%flowbudptr%budterm(this%idxbudrtmv)%id1(ientry)
766 n2 = this%flowbudptr%budterm(this%idxbudrtmv)%id2(ientry)
767 qbnd = this%flowbudptr%budterm(this%idxbudrtmv)%flow(ientry)
768 ctmp = this%xnewpak(n1)
769 if (
present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
770 if (
present(rhsval)) rhsval =
dzero
771 if (
present(hcofval)) hcofval = qbnd * this%eqnsclfac
780 integer(I4B),
intent(in) :: ientry
781 integer(I4B),
intent(inout) :: n1
782 integer(I4B),
intent(inout) :: n2
783 real(DP),
intent(inout),
optional :: rrate
784 real(DP),
intent(inout),
optional :: rhsval
785 real(DP),
intent(inout),
optional :: hcofval
790 n1 = this%flowbudptr%budterm(this%idxbudfrtm)%id1(ientry)
791 n2 = this%flowbudptr%budterm(this%idxbudfrtm)%id2(ientry)
792 qbnd = this%flowbudptr%budterm(this%idxbudfrtm)%flow(ientry)
793 ctmp = this%xnewpak(n1)
794 if (
present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
795 if (
present(rhsval)) rhsval =
dzero
796 if (
present(hcofval)) hcofval = qbnd * this%eqnsclfac
812 call this%obs%StoreObsType(
'temperature', .false., indx)
821 call this%obs%StoreObsType(
'from-mvr', .true., indx)
830 call this%obs%StoreObsType(
'storage', .true., indx)
835 call this%obs%StoreObsType(
'constant', .true., indx)
840 call this%obs%StoreObsType(
'mwe', .true., indx)
845 call this%obs%StoreObsType(
'rate', .true., indx)
850 call this%obs%StoreObsType(
'fw-rate', .true., indx)
855 call this%obs%StoreObsType(
'rate-to-mvr', .true., indx)
860 call this%obs%StoreObsType(
'fw-rate-to-mvr', .true., indx)
872 logical,
intent(inout) :: found
875 select case (obsrv%ObsTypeId)
877 call this%rp_obs_byfeature(obsrv)
879 call this%rp_obs_byfeature(obsrv)
881 call this%rp_obs_byfeature(obsrv)
882 case (
'FW-RATE-TO-MVR')
883 call this%rp_obs_byfeature(obsrv)
894 character(len=*),
intent(in) :: obstypeid
895 real(DP),
intent(inout) :: v
896 integer(I4B),
intent(in) :: jj
897 logical,
intent(inout) :: found
899 integer(I4B) :: n1, n2
902 select case (obstypeid)
904 if (this%iboundpak(jj) /= 0)
then
905 call this%mwe_rate_term(jj, n1, n2, v)
908 if (this%iboundpak(jj) /= 0 .and. this%idxbudfwrt > 0)
then
909 call this%mwe_fwrt_term(jj, n1, n2, v)
912 if (this%iboundpak(jj) /= 0 .and. this%idxbudrtmv > 0)
then
913 call this%mwe_rtmv_term(jj, n1, n2, v)
915 case (
'FW-RATE-TO-MVR')
916 if (this%iboundpak(jj) /= 0 .and. this%idxbudfrtm > 0)
then
917 call this%mwe_frtm_term(jj, n1, n2, v)
931 integer(I4B),
intent(in) :: itemno
932 character(len=*),
intent(in) :: keyword
933 logical,
intent(inout) :: found
935 character(len=LINELENGTH) :: text
938 real(DP),
pointer :: bndElem => null()
943 select case (keyword)
945 ierr = this%apt_check_valid(itemno)
949 call this%parser%GetString(text)
951 bndelem => this%temprate(itemno)
953 this%packName,
'BND', this%tsManager, &
This module contains the base boundary package.
class(bndtype) function, pointer, public getbndfromlist(list, idx)
Get boundary from package list.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
real(dp), parameter dzero
real constant zero
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
subroutine allocate_scalars(this)
Allocate scalars specific to the multi-aquifer well energy transport (MWE) package.
character(len= *), parameter flowtype
subroutine mwe_rp_obs(this, obsrv, found)
Process package specific obs.
subroutine mwe_rtmv_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Thermal transport matrix term(s) associated with pumped-water- to-mover term (mwe_rtmv_term)
subroutine mwe_allocate_arrays(this)
Allocate arrays specific to the streamflow mass transport (SFT) package.
subroutine, public mwe_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, fmi, eqnsclfac, gwecommon, dvt, dvu, dvua)
Create new MWE package.
subroutine mwe_bd_obs(this, obstypeid, jj, v, found)
Calculate observation value and pass it back to APT.
subroutine find_mwe_package(this)
Find corresponding mwe package.
subroutine mwe_fill_budobj(this, idx, x, flowja, ccratin, ccratout)
Copy flow terms into thisbudobj.
character(len= *), parameter ftype
subroutine mwe_da(this)
Deallocate memory associated with MWE package.
subroutine mwe_setup_budobj(this, idx)
Set up the budget object that stores all the mwe flows.
integer(i4b) function mwe_get_nbudterms(this)
Function to return the number of budget terms just for this package.
subroutine mwe_frtm_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Thermal transport matrix term(s) associated with the flowing- well-rate-to-mover term (mwe_frtm_term)
subroutine mwe_solve(this)
Add terms specific to multi-aquifer wells to the explicit multi- aquifer well energy transport solve.
subroutine mwe_fc_expanded(this, rhs, ia, idxglo, matrix_sln)
Add matrix terms related to MWE.
subroutine mwe_set_stressperiod(this, itemno, keyword, found)
Sets the stress period attributes for keyword use.
subroutine mwe_fwrt_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Thermal transport matrix term(s) associated with a flowing- well rate term associated with pumping (o...
subroutine mwe_rate_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Thermal transport matrix term(s) associated with a user-specified flow rate (mwe_rate_term)
subroutine mwe_df_obs(this)
Observations.
This module defines variable data types.
This module contains the derived types ObserveType and ObsDataType.
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
subroutine, public read_value_or_time_series_adv(textInput, ii, jj, bndElem, pkgName, auxOrBnd, tsManager, iprpak, varName)
Call this subroutine from advanced packages to define timeseries link for a variable (varName).
subroutine, public apt_process_obsid(obsrv, dis, inunitobs, iout)
Process observation IDs for an advanced package.
subroutine, public apt_process_obsid12(obsrv, dis, inunitobs, iout)
Process observation IDs for a package.