50 character(len=*),
parameter ::
ftype =
'SFT'
51 character(len=*),
parameter ::
flowtype =
'SFR'
52 character(len=16) ::
text =
' SFT'
56 integer(I4B),
pointer :: idxbudrain => null()
57 integer(I4B),
pointer :: idxbudevap => null()
58 integer(I4B),
pointer :: idxbudroff => null()
59 integer(I4B),
pointer :: idxbudiflw => null()
60 integer(I4B),
pointer :: idxbudoutf => null()
62 real(dp),
dimension(:),
pointer,
contiguous :: concrain => null()
63 real(dp),
dimension(:),
pointer,
contiguous :: concevap => null()
64 real(dp),
dimension(:),
pointer,
contiguous :: concroff => null()
65 real(dp),
dimension(:),
pointer,
contiguous :: conciflw => null()
67 real(dp),
dimension(:),
pointer,
contiguous :: vnew => null()
68 real(dp),
dimension(:),
pointer,
contiguous :: vold => null()
99 subroutine sft_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, &
100 fmi, eqnsclfac, dvt, dvu, dvua)
102 class(
bndtype),
pointer :: packobj
103 integer(I4B),
intent(in) :: id
104 integer(I4B),
intent(in) :: ibcnum
105 integer(I4B),
intent(in) :: inunit
106 integer(I4B),
intent(in) :: iout
107 character(len=*),
intent(in) :: namemodel
108 character(len=*),
intent(in) :: pakname
110 real(dp),
intent(in),
pointer :: eqnsclfac
111 character(len=*),
intent(in) :: dvt
112 character(len=*),
intent(in) :: dvu
113 character(len=*),
intent(in) :: dvua
122 call packobj%set_names(ibcnum, namemodel, pakname,
ftype)
126 call sftobj%allocate_scalars()
129 call packobj%pack_initialize()
131 packobj%inunit = inunit
134 packobj%ibcnum = ibcnum
144 sftobj%eqnsclfac => eqnsclfac
147 sftobj%depvartype = dvt
148 sftobj%depvarunit = dvu
149 sftobj%depvarunitabbrev = dvua
160 character(len=LINELENGTH) :: errmsg
161 class(
bndtype),
pointer :: packobj
162 integer(I4B) :: ip, icount
163 integer(I4B) :: nbudterm
173 if (this%fmi%flows_from_file)
then
174 call this%fmi%set_aptbudobj_pointer(this%flowpackagename, this%flowbudptr)
175 if (
associated(this%flowbudptr)) found = .true.
178 if (
associated(this%fmi%gwfbndlist))
then
181 do ip = 1, this%fmi%gwfbndlist%Count()
183 if (packobj%packName == this%flowpackagename)
then
188 this%flowpackagebnd => packobj
189 select type (packobj)
191 this%flowbudptr => packobj%budobj
200 if (.not. found)
then
201 write (errmsg,
'(a)')
'Could not find flow package with name '&
202 &//trim(adjustl(this%flowpackagename))//
'.'
204 call this%parser%StoreErrorUnit()
209 nbudterm = this%flowbudptr%nbudterm
210 call mem_allocate(this%idxbudssm, nbudterm,
'IDXBUDSSM', this%memoryPath)
213 write (this%iout,
'(/, a, a)') &
214 'PROCESSING '//
ftype//
' INFORMATION FOR ', this%packName
215 write (this%iout,
'(a)')
' IDENTIFYING FLOW TERMS IN '//
flowtype//
' PACKAGE'
216 write (this%iout,
'(a, i0)') &
217 ' NUMBER OF '//
flowtype//
' = ', this%flowbudptr%ncv
219 do ip = 1, this%flowbudptr%nbudterm
220 select case (trim(adjustl(this%flowbudptr%budterm(ip)%flowtype)))
221 case (
'FLOW-JA-FACE')
223 this%idxbudssm(ip) = 0
226 this%idxbudssm(ip) = 0
229 this%idxbudssm(ip) = 0
232 this%idxbudssm(ip) = 0
235 this%idxbudssm(ip) = 0
238 this%idxbudssm(ip) = 0
241 this%idxbudssm(ip) = 0
244 this%idxbudssm(ip) = 0
247 this%idxbudssm(ip) = 0
250 this%idxbudssm(ip) = 0
253 this%idxbudssm(ip) = 0
258 this%idxbudssm(ip) = icount
261 write (this%iout,
'(a, i0, " = ", a,/, a, i0)') &
262 ' TERM ', ip, trim(adjustl(this%flowbudptr%budterm(ip)%flowtype)), &
263 ' MAX NO. OF ENTRIES = ', this%flowbudptr%budterm(ip)%maxlist
265 write (this%iout,
'(a, //)')
'DONE PROCESSING '//
ftype//
' INFORMATION'
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, n1, n2
284 integer(I4B) :: iposd
290 if (this%idxbudrain /= 0)
then
291 do j = 1, this%flowbudptr%budterm(this%idxbudrain)%nlist
292 call this%sft_rain_term(j, n1, n2, rrate, rhsval, hcofval)
293 iloc = this%idxlocnode(n1)
294 iposd = this%idxpakdiag(n1)
295 call matrix_sln%add_value_pos(iposd, hcofval)
296 rhs(iloc) = rhs(iloc) + rhsval
301 if (this%idxbudevap /= 0)
then
302 do j = 1, this%flowbudptr%budterm(this%idxbudevap)%nlist
303 call this%sft_evap_term(j, n1, n2, rrate, rhsval, hcofval)
304 iloc = this%idxlocnode(n1)
305 iposd = this%idxpakdiag(n1)
306 call matrix_sln%add_value_pos(iposd, hcofval)
307 rhs(iloc) = rhs(iloc) + rhsval
312 if (this%idxbudroff /= 0)
then
313 do j = 1, this%flowbudptr%budterm(this%idxbudroff)%nlist
314 call this%sft_roff_term(j, n1, n2, rrate, rhsval, hcofval)
315 iloc = this%idxlocnode(n1)
316 iposd = this%idxpakdiag(n1)
317 call matrix_sln%add_value_pos(iposd, hcofval)
318 rhs(iloc) = rhs(iloc) + rhsval
323 if (this%idxbudiflw /= 0)
then
324 do j = 1, this%flowbudptr%budterm(this%idxbudiflw)%nlist
325 call this%sft_iflw_term(j, n1, n2, rrate, rhsval, hcofval)
326 iloc = this%idxlocnode(n1)
327 iposd = this%idxpakdiag(n1)
328 call matrix_sln%add_value_pos(iposd, hcofval)
329 rhs(iloc) = rhs(iloc) + rhsval
334 if (this%idxbudoutf /= 0)
then
335 do j = 1, this%flowbudptr%budterm(this%idxbudoutf)%nlist
336 call this%sft_outf_term(j, n1, n2, rrate, rhsval, hcofval)
337 iloc = this%idxlocnode(n1)
338 iposd = this%idxpakdiag(n1)
339 call matrix_sln%add_value_pos(iposd, hcofval)
340 rhs(iloc) = rhs(iloc) + rhsval
352 integer(I4B) :: n1, n2
356 if (this%idxbudrain /= 0)
then
357 do j = 1, this%flowbudptr%budterm(this%idxbudrain)%nlist
358 call this%sft_rain_term(j, n1, n2, rrate)
359 this%dbuff(n1) = this%dbuff(n1) + rrate
364 if (this%idxbudevap /= 0)
then
365 do j = 1, this%flowbudptr%budterm(this%idxbudevap)%nlist
366 call this%sft_evap_term(j, n1, n2, rrate)
367 this%dbuff(n1) = this%dbuff(n1) + rrate
372 if (this%idxbudroff /= 0)
then
373 do j = 1, this%flowbudptr%budterm(this%idxbudroff)%nlist
374 call this%sft_roff_term(j, n1, n2, rrate)
375 this%dbuff(n1) = this%dbuff(n1) + rrate
380 if (this%idxbudiflw /= 0)
then
381 do j = 1, this%flowbudptr%budterm(this%idxbudiflw)%nlist
382 call this%sft_iflw_term(j, n1, n2, rrate)
383 this%dbuff(n1) = this%dbuff(n1) + rrate
388 if (this%idxbudoutf /= 0)
then
389 do j = 1, this%flowbudptr%budterm(this%idxbudoutf)%nlist
390 call this%sft_outf_term(j, n1, n2, rrate)
391 this%dbuff(n1) = this%dbuff(n1) + rrate
405 integer(I4B) :: nbudterms
419 integer(I4B),
intent(inout) :: idx
421 integer(I4B) :: maxlist, naux
422 character(len=LENBUDTXT) :: text
427 maxlist = this%flowbudptr%budterm(this%idxbudrain)%maxlist
429 call this%budobj%budterm(idx)%initialize(text, &
434 maxlist, .false., .false., &
438 text =
' EVAPORATION'
440 maxlist = this%flowbudptr%budterm(this%idxbudevap)%maxlist
442 call this%budobj%budterm(idx)%initialize(text, &
447 maxlist, .false., .false., &
453 maxlist = this%flowbudptr%budterm(this%idxbudroff)%maxlist
455 call this%budobj%budterm(idx)%initialize(text, &
460 maxlist, .false., .false., &
466 maxlist = this%flowbudptr%budterm(this%idxbudiflw)%maxlist
468 call this%budobj%budterm(idx)%initialize(text, &
473 maxlist, .false., .false., &
477 text =
' EXT-OUTFLOW'
479 maxlist = this%flowbudptr%budterm(this%idxbudoutf)%maxlist
481 call this%budobj%budterm(idx)%initialize(text, &
486 maxlist, .false., .false., &
496 integer(I4B),
intent(inout) :: idx
497 real(DP),
dimension(:),
intent(in) :: x
498 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
499 real(DP),
intent(inout) :: ccratin
500 real(DP),
intent(inout) :: ccratout
502 integer(I4B) :: j, n1, n2
503 integer(I4B) :: nlist
509 nlist = this%flowbudptr%budterm(this%idxbudrain)%nlist
510 call this%budobj%budterm(idx)%reset(nlist)
512 call this%sft_rain_term(j, n1, n2, q)
513 call this%budobj%budterm(idx)%update_term(n1, n2, q)
514 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
519 nlist = this%flowbudptr%budterm(this%idxbudevap)%nlist
520 call this%budobj%budterm(idx)%reset(nlist)
522 call this%sft_evap_term(j, n1, n2, q)
523 call this%budobj%budterm(idx)%update_term(n1, n2, q)
524 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
529 nlist = this%flowbudptr%budterm(this%idxbudroff)%nlist
530 call this%budobj%budterm(idx)%reset(nlist)
532 call this%sft_roff_term(j, n1, n2, q)
533 call this%budobj%budterm(idx)%update_term(n1, n2, q)
534 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
539 nlist = this%flowbudptr%budterm(this%idxbudiflw)%nlist
540 call this%budobj%budterm(idx)%reset(nlist)
542 call this%sft_iflw_term(j, n1, n2, q)
543 call this%budobj%budterm(idx)%update_term(n1, n2, q)
544 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
549 nlist = this%flowbudptr%budterm(this%idxbudoutf)%nlist
550 call this%budobj%budterm(idx)%reset(nlist)
552 call this%sft_outf_term(j, n1, n2, q)
553 call this%budobj%budterm(idx)%update_term(n1, n2, q)
554 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
569 call this%TspAptType%allocate_scalars()
572 call mem_allocate(this%idxbudrain,
'IDXBUDRAIN', this%memoryPath)
573 call mem_allocate(this%idxbudevap,
'IDXBUDEVAP', this%memoryPath)
574 call mem_allocate(this%idxbudroff,
'IDXBUDROFF', this%memoryPath)
575 call mem_allocate(this%idxbudiflw,
'IDXBUDIFLW', this%memoryPath)
576 call mem_allocate(this%idxbudoutf,
'IDXBUDOUTF', this%memoryPath)
598 call mem_allocate(this%concrain, this%ncv,
'CONCRAIN', this%memoryPath)
599 call mem_allocate(this%concevap, this%ncv,
'CONCEVAP', this%memoryPath)
600 call mem_allocate(this%concroff, this%ncv,
'CONCROFF', this%memoryPath)
601 call mem_allocate(this%conciflw, this%ncv,
'CONCIFLW', this%memoryPath)
603 call mem_allocate(this%vnew, this%ncv,
'VNEW', this%memoryPath)
604 call mem_allocate(this%vold, this%ncv,
'VOLD', this%memoryPath)
608 call this%TspAptType%apt_allocate_arrays()
612 this%concrain(n) =
dzero
613 this%concevap(n) =
dzero
614 this%concroff(n) =
dzero
615 this%conciflw(n) =
dzero
631 call this%TspAptType%bnd_ad()
635 this%vold(n) = this%vnew(n)
666 call this%TspAptType%bnd_da()
675 integer(I4B),
intent(in) :: ientry
676 integer(I4B),
intent(inout) :: n1
677 integer(I4B),
intent(inout) :: n2
678 real(DP),
intent(inout),
optional :: rrate
679 real(DP),
intent(inout),
optional :: rhsval
680 real(DP),
intent(inout),
optional :: hcofval
685 n1 = this%flowbudptr%budterm(this%idxbudrain)%id1(ientry)
686 n2 = this%flowbudptr%budterm(this%idxbudrain)%id2(ientry)
687 qbnd = this%flowbudptr%budterm(this%idxbudrain)%flow(ientry)
688 ctmp = this%concrain(n1)
689 if (
present(rrate)) rrate = ctmp * qbnd
690 if (
present(rhsval)) rhsval = -rrate
691 if (
present(hcofval)) hcofval =
dzero
700 integer(I4B),
intent(in) :: ientry
701 integer(I4B),
intent(inout) :: n1
702 integer(I4B),
intent(inout) :: n2
703 real(DP),
intent(inout),
optional :: rrate
704 real(DP),
intent(inout),
optional :: rhsval
705 real(DP),
intent(inout),
optional :: hcofval
711 n1 = this%flowbudptr%budterm(this%idxbudevap)%id1(ientry)
712 n2 = this%flowbudptr%budterm(this%idxbudevap)%id2(ientry)
714 qbnd = this%flowbudptr%budterm(this%idxbudevap)%flow(ientry)
715 ctmp = this%concevap(n1)
716 if (this%xnewpak(n1) < ctmp)
then
721 if (
present(rrate)) &
722 rrate = omega * qbnd * this%xnewpak(n1) + &
723 (
done - omega) * qbnd * ctmp
724 if (
present(rhsval)) rhsval = -(
done - omega) * qbnd * ctmp
725 if (
present(hcofval)) hcofval = omega * qbnd
734 integer(I4B),
intent(in) :: ientry
735 integer(I4B),
intent(inout) :: n1
736 integer(I4B),
intent(inout) :: n2
737 real(DP),
intent(inout),
optional :: rrate
738 real(DP),
intent(inout),
optional :: rhsval
739 real(DP),
intent(inout),
optional :: hcofval
744 n1 = this%flowbudptr%budterm(this%idxbudroff)%id1(ientry)
745 n2 = this%flowbudptr%budterm(this%idxbudroff)%id2(ientry)
746 qbnd = this%flowbudptr%budterm(this%idxbudroff)%flow(ientry)
747 ctmp = this%concroff(n1)
748 if (
present(rrate)) rrate = ctmp * qbnd
749 if (
present(rhsval)) rhsval = -rrate
750 if (
present(hcofval)) hcofval =
dzero
763 integer(I4B),
intent(in) :: ientry
764 integer(I4B),
intent(inout) :: n1
765 integer(I4B),
intent(inout) :: n2
766 real(DP),
intent(inout),
optional :: rrate
767 real(DP),
intent(inout),
optional :: rhsval
768 real(DP),
intent(inout),
optional :: hcofval
773 n1 = this%flowbudptr%budterm(this%idxbudiflw)%id1(ientry)
774 n2 = this%flowbudptr%budterm(this%idxbudiflw)%id2(ientry)
775 qbnd = this%flowbudptr%budterm(this%idxbudiflw)%flow(ientry)
776 ctmp = this%conciflw(n1)
777 if (
present(rrate)) rrate = ctmp * qbnd
778 if (
present(rhsval)) rhsval = -rrate
779 if (
present(hcofval)) hcofval =
dzero
791 integer(I4B),
intent(in) :: ientry
792 integer(I4B),
intent(inout) :: n1
793 integer(I4B),
intent(inout) :: n2
794 real(DP),
intent(inout),
optional :: rrate
795 real(DP),
intent(inout),
optional :: rhsval
796 real(DP),
intent(inout),
optional :: hcofval
801 n1 = this%flowbudptr%budterm(this%idxbudoutf)%id1(ientry)
802 n2 = this%flowbudptr%budterm(this%idxbudoutf)%id2(ientry)
803 qbnd = this%flowbudptr%budterm(this%idxbudoutf)%flow(ientry)
804 ctmp = this%xnewpak(n1)
805 if (
present(rrate)) rrate = ctmp * qbnd
806 if (
present(rhsval)) rhsval =
dzero
807 if (
present(hcofval)) hcofval = qbnd
824 call this%obs%StoreObsType(
'concentration', .false., indx)
829 call this%obs%StoreObsType(
'flow-ja-face', .true., indx)
834 call this%obs%StoreObsType(
'from-mvr', .true., indx)
839 call this%obs%StoreObsType(
'to-mvr', .true., indx)
844 call this%obs%StoreObsType(
'storage', .true., indx)
849 call this%obs%StoreObsType(
'constant', .true., indx)
854 call this%obs%StoreObsType(
'sft', .true., indx)
859 call this%obs%StoreObsType(
'rainfall', .true., indx)
864 call this%obs%StoreObsType(
'evaporation', .true., indx)
869 call this%obs%StoreObsType(
'runoff', .true., indx)
874 call this%obs%StoreObsType(
'ext-inflow', .true., indx)
879 call this%obs%StoreObsType(
'ext-outflow', .true., indx)
891 logical,
intent(inout) :: found
895 select case (obsrv%ObsTypeId)
897 call this%rp_obs_byfeature(obsrv)
899 call this%rp_obs_byfeature(obsrv)
901 call this%rp_obs_byfeature(obsrv)
903 call this%rp_obs_byfeature(obsrv)
905 call this%rp_obs_byfeature(obsrv)
907 call this%rp_obs_byfeature(obsrv)
918 character(len=*),
intent(in) :: obstypeid
919 real(DP),
intent(inout) :: v
920 integer(I4B),
intent(in) :: jj
921 logical,
intent(inout) :: found
923 integer(I4B) :: n1, n2
926 select case (obstypeid)
928 if (this%iboundpak(jj) /= 0)
then
929 call this%sft_rain_term(jj, n1, n2, v)
932 if (this%iboundpak(jj) /= 0)
then
933 call this%sft_evap_term(jj, n1, n2, v)
936 if (this%iboundpak(jj) /= 0)
then
937 call this%sft_roff_term(jj, n1, n2, v)
940 if (this%iboundpak(jj) /= 0)
then
941 call this%sft_iflw_term(jj, n1, n2, v)
944 if (this%iboundpak(jj) /= 0)
then
945 call this%sft_outf_term(jj, n1, n2, v)
958 integer(I4B),
intent(in) :: itemno
959 character(len=*),
intent(in) :: keyword
960 logical,
intent(inout) :: found
962 character(len=LINELENGTH) :: text
965 real(DP),
pointer :: bndElem => null()
975 select case (keyword)
977 ierr = this%apt_check_valid(itemno)
981 call this%parser%GetString(text)
983 bndelem => this%concrain(itemno)
985 this%packName,
'BND', this%tsManager, &
986 this%iprpak,
'RAINFALL')
988 ierr = this%apt_check_valid(itemno)
992 call this%parser%GetString(text)
994 bndelem => this%concevap(itemno)
996 this%packName,
'BND', this%tsManager, &
997 this%iprpak,
'EVAPORATION')
999 ierr = this%apt_check_valid(itemno)
1003 call this%parser%GetString(text)
1005 bndelem => this%concroff(itemno)
1007 this%packName,
'BND', this%tsManager, &
1008 this%iprpak,
'RUNOFF')
1010 ierr = this%apt_check_valid(itemno)
1014 call this%parser%GetString(text)
1016 bndelem => this%conciflw(itemno)
1018 this%packName,
'BND', this%tsManager, &
1019 this%iprpak,
'INFLOW')
1035 integer(I4B),
intent(in) :: icv
1036 real(DP),
intent(inout) :: vnew, vold
1037 real(DP),
intent(in) :: delt
1044 if (this%idxbudsto /= 0)
then
1045 qss = this%flowbudptr%budterm(this%idxbudsto)%flow(icv)
1046 vnew = this%flowbudptr%budterm(this%idxbudsto)%auxvar(1, icv)
1047 this%vnew(icv) = vnew
1048 if (qss /=
dzero)
then
1049 vold = vnew + qss * delt
1051 if (vnew ==
dzero)
then
1054 vold = this%vold(icv)
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
real(dp), parameter done
real constant 1
subroutine sft_solve(this)
Add terms specific to sft to the explicit sft solve.
subroutine sft_iflw_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Inflow Term.
subroutine allocate_scalars(this)
Allocate scalars specific to the streamflow energy transport (SFE) package.
character(len= *), parameter flowtype
subroutine sft_outf_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Outflow term.
subroutine sft_roff_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Runoff term.
subroutine find_sft_package(this)
Find corresponding sft package.
subroutine sft_bd_obs(this, obstypeid, jj, v, found)
Calculate observation value and pass it back to APT.
subroutine sft_rp_obs(this, obsrv, found)
Process package specific obs.
subroutine sft_ad(this)
Advance sft package routine.
subroutine sft_da(this)
Deallocate memory.
subroutine sft_fill_budobj(this, idx, x, flowja, ccratin, ccratout)
Copy flow terms into thisbudobj.
subroutine sft_set_stressperiod(this, itemno, keyword, found)
Sets the stress period attributes for keyword use.
subroutine sft_fc_expanded(this, rhs, ia, idxglo, matrix_sln)
Add matrix terms related to SFT.
subroutine sft_get_volumes(this, icv, vnew, vold, delt)
Return the sfr new volume and old volume.
subroutine, public sft_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, fmi, eqnsclfac, dvt, dvu, dvua)
Create a new sft package.
character(len= *), parameter ftype
subroutine sft_setup_budobj(this, idx)
Set up the budget object that stores all the sft flows.
integer(i4b) function sft_get_nbudterms(this)
Function to return the number of budget terms just for this package.
subroutine sft_evap_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Evaporative term.
subroutine sft_allocate_arrays(this)
Allocate arrays specific to the streamflow energy transport (SFE) package.
subroutine sft_df_obs(this)
Observations.
subroutine sft_rain_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Rain term.
This module defines variable data types.
This module contains the derived types ObserveType and ObsDataType.
This module contains the SFR package methods.
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.