28 character(len=LENMODELNAME) :: gwfmodelname1 =
''
29 character(len=LENMODELNAME) :: gwfmodelname2 =
''
30 integer(I4B),
pointer :: maxpackages
31 integer(I4B),
pointer :: ibudgetout => null()
32 integer(I4B),
pointer :: ibudcsv => null()
33 real(dp),
pointer :: eqnsclfac => null()
39 character(len=LENPACKAGENAME), &
40 dimension(:),
pointer,
contiguous :: paknames => null()
41 character(len=LENVARNAME) :: depvartype =
''
73 subroutine mvt_cr(mvt, name_model, inunit, iout, fmi1, eqnsclfac, &
74 depvartype, gwfmodelname1, gwfmodelname2, fmi2)
77 character(len=*),
intent(in) :: name_model
78 integer(I4B),
intent(in) :: inunit
79 integer(I4B),
intent(in) :: iout
81 real(dp),
intent(in),
pointer :: eqnsclfac
82 character(len=LENVARNAME),
intent(in) :: depvartype
83 character(len=*),
intent(in),
optional :: gwfmodelname1
84 character(len=*),
intent(in),
optional :: gwfmodelname2
85 type(
tspfmitype),
intent(in),
target,
optional :: fmi2
91 call mvt%set_names(1, name_model,
'MVT',
'MVT')
94 call mvt%allocate_scalars()
104 if (
present(fmi2))
then
109 if (
present(gwfmodelname1))
then
110 mvt%gwfmodelname1 = gwfmodelname1
112 if (
present(gwfmodelname2))
then
113 mvt%gwfmodelname2 = gwfmodelname2
120 mvt%eqnsclfac => eqnsclfac
124 mvt%depvartype = depvartype
134 character(len=*),
parameter :: fmtmvt = &
135 "(1x,/1x,'MVT -- MOVER TRANSPORT PACKAGE, VERSION 1, 4/15/2020', &
136 &' INPUT READ FROM UNIT ', i0, //)"
142 write (this%iout, fmtmvt) this%inunit
145 call this%parser%Initialize(this%inunit, this%iout)
148 call budget_cr(this%budget, this%memoryPath)
151 call this%read_options()
163 this%mvrbudobj => mvrbudobj
173 call this%mvt_setup_outputtab()
189 if (
associated(this%fmi1, this%fmi2))
then
190 call this%set_pointer_mvrbudobj(this%fmi1%mvrbudobj)
194 call this%mvt_scan_mvrbudobj()
195 call this%mvt_setup_budobj()
198 call this%budget%budget_df(this%maxpackages,
'TRANSPORT MOVER', bddim=
'M')
199 call this%budget%set_ibudcsv(this%ibudcsv)
214 real(DP),
intent(in),
dimension(:),
contiguous,
target :: cnew1
215 real(DP),
intent(in),
dimension(:),
contiguous,
target :: cnew2
218 integer(I4B) :: id1, id2, nlist
219 integer(I4B) :: ipr, irc
220 integer(I4B) :: igwtnode
221 integer(I4B) :: nbudterm
223 real(DP),
dimension(:),
pointer :: concpak
224 real(DP),
dimension(:),
contiguous,
pointer :: cnew
229 nbudterm = this%mvrbudobj%nbudterm
231 nlist = this%mvrbudobj%budterm(i)%nlist
235 call this%set_fmi_pr_rc(i, fmi_pr, fmi_rc)
240 if (
associated(fmi_pr, this%fmi2))
then
245 call fmi_pr%get_package_index(this%mvrbudobj%budterm(i)%text2id1, ipr)
248 call fmi_rc%get_package_index(this%mvrbudobj%budterm(i)%text2id2, irc)
251 if (fmi_pr%iatp(ipr) /= 0)
then
252 concpak => fmi_pr%datp(ipr)%concpack
259 id1 = this%mvrbudobj%budterm(i)%id1(n)
260 id2 = this%mvrbudobj%budterm(i)%id2(n)
263 q = this%mvrbudobj%budterm(i)%flow(n)
267 if (fmi_pr%iatp(ipr) /= 0)
then
278 igwtnode = fmi_pr%gwfpackages(ipr)%nodelist(id1)
286 if (fmi_rc%iatp(irc) /= 0)
then
287 fmi_rc%datp(irc)%qmfrommvr(id2) = fmi_rc%datp(irc)%qmfrommvr(id2) - &
288 q * cp * this%eqnsclfac
307 integer(I4B),
intent(in) :: ibudterm
313 if (this%gwfmodelname1 ==
'' .and. this%gwfmodelname2 ==
'')
then
318 if (this%mvrbudobj%budterm(ibudterm)%text1id1 == this%gwfmodelname1)
then
321 else if (this%mvrbudobj%budterm(ibudterm)%text1id1 == &
322 this%gwfmodelname2)
then
328 print *, this%mvrbudobj%budterm(ibudterm)%text1id1
329 print *, this%gwfmodelname1
330 print *, this%gwfmodelname2
331 stop
"error in set_fmi_pr_rc"
335 if (this%mvrbudobj%budterm(ibudterm)%text1id2 == this%gwfmodelname1)
then
338 else if (this%mvrbudobj%budterm(ibudterm)%text1id2 == &
339 this%gwfmodelname2)
then
345 print *, this%mvrbudobj%budterm(ibudterm)%text1id2
346 print *, this%gwfmodelname1
347 print *, this%gwfmodelname2
348 stop
"error in set_fmi_pr_rc"
352 if (.not.
associated(fmi_pr))
then
353 print *,
'Could not find FMI Package...'
354 stop
"error in set_fmi_pr_rc"
356 if (.not.
associated(fmi_rc))
then
357 print *,
'Could not find FMI Package...'
358 stop
"error in set_fmi_pr_rc"
364 subroutine mvt_cc(this, kiter, iend, icnvgmod, cpak, dpak)
367 integer(I4B),
intent(in) :: kiter
368 integer(I4B),
intent(in) :: iend
369 integer(I4B),
intent(in) :: icnvgmod
370 character(len=LENPAKLOC),
intent(inout) :: cpak
371 real(DP),
intent(inout) :: dpak
373 character(len=*),
parameter :: fmtmvrcnvg = &
374 "(/,1x,'MOVER PACKAGE REQUIRES AT LEAST TWO OUTER ITERATIONS. CONVERGE &
375 &FLAG HAS BEEN RESET TO FALSE.')"
378 if (
associated(this%mvrbudobj))
then
379 if (icnvgmod == 1 .and. kiter == 1)
then
381 cpak = trim(this%packName)
382 write (this%iout, fmtmvrcnvg)
392 real(DP),
dimension(:),
contiguous,
intent(in) :: cnew1
393 real(DP),
dimension(:),
contiguous,
intent(in) :: cnew2
396 call this%mvt_fill_budobj(cnew1, cnew2)
406 integer(I4B),
intent(in) :: icbcfl
407 integer(I4B),
intent(in) :: ibudfl
409 integer(I4B) :: ibinun
413 if (this%ibudgetout /= 0)
then
414 ibinun = this%ibudgetout
416 if (icbcfl == 0) ibinun = 0
418 call this%budobj%save_flows(this%dis, ibinun,
kstp,
kper,
delt, &
428 integer(I4B),
intent(in) :: icbcfl
429 integer(I4B),
intent(in) :: ibudfl
432 if (ibudfl /= 0 .and. this%iprflow /= 0)
then
433 call this%mvt_print_outputtab()
444 integer(I4B),
intent(in) :: ibudfl
446 integer(I4B) :: i, j, n
447 real(DP),
allocatable,
dimension(:) :: ratin, ratout
450 allocate (ratin(this%maxpackages), ratout(this%maxpackages))
451 do j = 1, this%maxpackages
457 do i = 1, this%maxpackages
458 do j = 1, this%budobj%nbudterm
459 do n = 1, this%budobj%budterm(j)%nlist
462 if (this%paknames(i) == this%budobj%budterm(j)%text2id1)
then
463 ratin(i) = ratin(i) + this%budobj%budterm(j)%flow(n)
467 if (this%paknames(i) == this%budobj%budterm(j)%text2id2)
then
468 ratout(i) = ratout(i) + this%budobj%budterm(j)%flow(n)
475 call this%budget%reset()
476 do j = 1, this%maxpackages
477 call this%budget%addentry(ratin(j), ratout(j),
delt, this%paknames(j))
481 call this%budget%finalize_step(
delt)
482 if (ibudfl /= 0)
then
483 call this%budget%budget_ot(
kstp,
kper, this%iout)
487 call this%budget%writecsv(
totim)
490 deallocate (ratin, ratout)
510 if (this%inunit > 0)
then
513 deallocate (this%paknames)
516 call this%budget%budget_da()
517 deallocate (this%budget)
520 call this%budobj%budgetobject_da()
521 deallocate (this%budobj)
522 nullify (this%budobj)
525 if (
associated(this%outputtab))
then
526 call this%outputtab%table_da()
527 deallocate (this%outputtab)
528 nullify (this%outputtab)
535 this%mvrbudobj => null()
541 call this%NumericalPackageType%da()
555 call this%NumericalPackageType%allocate_scalars()
558 call mem_allocate(this%maxpackages,
'MAXPACKAGES', this%memoryPath)
559 call mem_allocate(this%ibudgetout,
'IBUDGETOUT', this%memoryPath)
560 call mem_allocate(this%ibudcsv,
'IBUDCSV', this%memoryPath)
577 character(len=LINELENGTH) :: errmsg, keyword
578 character(len=MAXCHARLEN) :: fname
580 logical :: isfound, endOfBlock
582 character(len=*),
parameter :: fmtflow = &
583 "(4x, a, 1x, a, 1x, ' WILL BE SAVED TO FILE: ', a, &
584 &/4x, 'OPENED ON UNIT: ', I0)"
585 character(len=*),
parameter :: fmtflow2 = &
586 &
"(4x, 'FLOWS WILL BE SAVED TO BUDGET FILE')"
589 call this%parser%GetBlock(
'OPTIONS', isfound, ierr, blockrequired=.false., &
590 supportopenclose=.true.)
594 write (this%iout,
'(1x,a)')
'PROCESSING MVT OPTIONS'
596 call this%parser%GetNextLine(endofblock)
598 call this%parser%GetStringCaps(keyword)
599 select case (keyword)
602 write (this%iout, fmtflow2)
605 write (this%iout,
'(4x,a)')
'MVT INPUT WILL BE PRINTED.'
608 write (this%iout,
'(4x,a)') &
609 'MVT FLOWS WILL BE PRINTED TO LISTING FILE.'
611 call this%parser%GetStringCaps(keyword)
612 if (keyword ==
'FILEOUT')
then
613 call this%parser%GetString(fname)
614 call assign_iounit(this%ibudgetout, this%inunit,
"BUDGET fileout")
615 call openfile(this%ibudgetout, this%iout, fname,
'DATA(BINARY)', &
617 write (this%iout, fmtflow)
'MVT',
'BUDGET', trim(adjustl(fname)), &
621 &be followed by FILEOUT')
624 call this%parser%GetStringCaps(keyword)
625 if (keyword ==
'FILEOUT')
then
626 call this%parser%GetString(fname)
627 call assign_iounit(this%ibudcsv, this%inunit,
"BUDGETCSV fileout")
628 call openfile(this%ibudcsv, this%iout, fname,
'CSV', &
629 filstat_opt=
'REPLACE')
630 write (this%iout, fmtflow)
'MVT',
'BUDGET CSV', &
631 trim(adjustl(fname)), this%ibudcsv
633 call store_error(
'Optional BUDGETCSV keyword must be followed by &
637 write (errmsg,
'(a,a)')
'Unknown MVT option: ', &
640 call this%parser%StoreErrorUnit()
643 write (this%iout,
'(1x,a)')
'END OF MVT OPTIONS'
655 integer(I4B) :: nbudterm
657 integer(I4B) :: maxlist
660 character(len=LENMODELNAME) :: modelname1, modelname2
661 character(len=LENPACKAGENAME) :: packagename1, packagename2
662 character(len=LENBUDTXT) :: text
665 nbudterm = this%mvrbudobj%nbudterm
668 if (this%depvartype ==
'CONCENTRATION')
then
675 call this%budobj%budgetobject_df(ncv, nbudterm, 0, 0, bddim_opt=
'M')
680 modelname1 = this%mvrbudobj%budterm(i)%text1id1
681 packagename1 = this%mvrbudobj%budterm(i)%text2id1
682 modelname2 = this%mvrbudobj%budterm(i)%text1id2
683 packagename2 = this%mvrbudobj%budterm(i)%text2id2
684 maxlist = this%mvrbudobj%budterm(i)%maxlist
685 call this%budobj%budterm(i)%initialize(text, &
690 maxlist, .false., .false., &
700 real(DP),
intent(in),
dimension(:),
contiguous,
target :: cnew1
701 real(DP),
intent(in),
dimension(:),
contiguous,
target :: cnew2
705 real(DP),
dimension(:),
contiguous,
pointer :: cnew
706 integer(I4B) :: nbudterm
707 integer(I4B) :: nlist
712 integer(I4B) :: n1, n2
713 integer(I4B) :: igwtnode
720 nbudterm = this%mvrbudobj%nbudterm
722 nlist = this%mvrbudobj%budterm(i)%nlist
723 call this%set_fmi_pr_rc(i, fmi_pr, fmi_rc)
725 if (
associated(fmi_pr, this%fmi2))
then
728 call fmi_pr%get_package_index(this%mvrbudobj%budterm(i)%text2id1, ipr)
729 call fmi_rc%get_package_index(this%mvrbudobj%budterm(i)%text2id2, irc)
730 call this%budobj%budterm(i)%reset(nlist)
732 n1 = this%mvrbudobj%budterm(i)%id1(j)
733 n2 = this%mvrbudobj%budterm(i)%id2(j)
734 q = this%mvrbudobj%budterm(i)%flow(j)
736 if (fmi_pr%iatp(ipr) /= 0)
then
737 cp = fmi_pr%datp(ipr)%concpack(n1)
740 igwtnode = fmi_pr%gwfpackages(ipr)%nodelist(n1)
747 if (fmi_rc%iatp(irc) /= 0)
then
748 rate = -q * cp * this%eqnsclfac
752 call this%budobj%budterm(i)%update_term(n1, n2, rate)
757 call this%budobj%accumulate_terms()
767 integer(I4B) :: nbudterm
768 integer(I4B) :: maxpackages
774 nbudterm = this%mvrbudobj%nbudterm
776 if (i * i == nbudterm)
then
781 this%maxpackages = maxpackages
784 allocate (this%paknames(this%maxpackages))
785 do i = 1, this%maxpackages
786 this%paknames(i) =
''
794 if (this%mvrbudobj%budterm(i)%text2id1 == this%paknames(j))
then
799 if (.not. found)
then
800 this%paknames(ipos) = this%mvrbudobj%budterm(i)%text2id1
812 character(len=LINELENGTH) :: title
813 character(len=LINELENGTH) :: text
814 integer(I4B) :: ntabcol
815 integer(I4B) :: maxrow
819 if (this%iprflow /= 0)
then
826 title =
'TRANSPORT MOVER PACKAGE ('//trim(this%packName)// &
828 call table_cr(this%outputtab, this%packName, title)
829 call this%outputtab%table_df(maxrow, ntabcol, this%iout, &
832 call this%outputtab%initialize_column(text, 10, alignment=
tabcenter)
833 text =
'PROVIDER LOCATION'
835 call this%outputtab%initialize_column(text, ilen)
837 call this%outputtab%initialize_column(text, 10)
838 text =
'PROVIDER FLOW RATE'
839 call this%outputtab%initialize_column(text, 10)
840 text =
'PROVIDER TRANSPORT RATE'
841 call this%outputtab%initialize_column(text, 10)
842 text =
'RECEIVER LOCATION'
844 call this%outputtab%initialize_column(text, ilen)
846 call this%outputtab%initialize_column(text, 10)
859 character(len=LINELENGTH) :: title
860 character(len=LENMODELNAME + LENPACKAGENAME + 1) :: cloc1, cloc2
864 integer(I4B) :: ntabrows
865 integer(I4B) :: nlist
869 do i = 1, this%budobj%nbudterm
870 nlist = this%budobj%budterm(i)%nlist
871 ntabrows = ntabrows + nlist
875 call this%outputtab%set_kstpkper(
kstp,
kper)
878 title =
'TRANSPORT MOVER PACKAGE ('//trim(this%packName)// &
880 call this%outputtab%set_title(title)
881 call this%outputtab%set_maxbound(ntabrows)
885 do i = 1, this%budobj%nbudterm
886 nlist = this%budobj%budterm(i)%nlist
888 cloc1 = trim(adjustl(this%budobj%budterm(i)%text1id1))//
' '// &
889 trim(adjustl(this%budobj%budterm(i)%text2id1))
890 cloc2 = trim(adjustl(this%budobj%budterm(i)%text1id2))//
' '// &
891 trim(adjustl(this%budobj%budterm(i)%text2id2))
892 call this%outputtab%add_term(inum)
893 call this%outputtab%add_term(cloc1)
894 call this%outputtab%add_term(this%budobj%budterm(i)%id1(n))
895 call this%outputtab%add_term(-this%mvrbudobj%budterm(i)%flow(n))
896 call this%outputtab%add_term(this%budobj%budterm(i)%flow(n))
897 call this%outputtab%add_term(cloc2)
898 call this%outputtab%add_term(this%budobj%budterm(i)%id2(n))
This module contains the BudgetModule.
subroutine, public budget_cr(this, name_model)
@ brief Create a new budget object
subroutine, public budgetobject_cr(this, name)
Create a new budget object.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
@ tabcenter
centered table column
integer(i4b), parameter lenmodelname
maximum length of the model name
integer(i4b), parameter lenpackagename
maximum length of the package name
real(dp), parameter dnodata
real no data constant
integer(i4b), parameter lenpakloc
maximum length of a package location
integer(i4b), parameter lenvarname
maximum length of a variable name
real(dp), parameter dzero
real constant zero
integer(i4b), parameter maxcharlen
maximum length of char string
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
This module defines variable data types.
This module contains the base numerical package type.
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
subroutine, public table_cr(this, name, title)
real(dp), pointer, public pertim
time relative to start of stress period
real(dp), pointer, public totim
time relative to start of simulation
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
subroutine mvt_setup_outputtab(this)
Set up the mover-for-transport output table.
subroutine mvt_scan_mvrbudobj(this)
Determine max number of packages in use.
subroutine set_fmi_pr_rc(this, ibudterm, fmi_pr, fmi_rc)
@ brief Set the fmi_pr and fmi_rc pointers
subroutine set_pointer_mvrbudobj(this, mvrbudobj)
@ brief Set pointer to mvrbudobj
subroutine, public mvt_cr(mvt, name_model, inunit, iout, fmi1, eqnsclfac, depvartype, gwfmodelname1, gwfmodelname2, fmi2)
Create a new mover transport object.
subroutine mvt_ot_saveflow(this, icbcfl, ibudfl)
Write mover budget terms.
subroutine mvt_ot_bdsummary(this, ibudfl)
Write mover budget to listing file.
subroutine mvt_rp(this)
Read and prepare mover transport object.
subroutine mvt_cc(this, kiter, iend, icnvgmod, cpak, dpak)
Extra convergence check for mover.
subroutine read_options(this)
Read mover-for-transport options block.
subroutine mvt_setup_budobj(this)
Set up the budget object that stores all the mvr flows.
subroutine mvt_print_outputtab(this)
Set up mover-for-transport output table.
subroutine mvt_fill_budobj(this, cnew1, cnew2)
Copy mover-for-transport flow terms into thisbudobj.
subroutine mvt_df(this, dis)
Define mover transport object.
subroutine mvt_ar(this)
Allocate and read mover-for-transport information.
subroutine mvt_fc(this, cnew1, cnew2)
Calculate coefficients and fill amat and rhs.
subroutine mvt_da(this)
@ brief Deallocate memory
subroutine mvt_ot_printflow(this, icbcfl, ibudfl)
Print mover flow table.
subroutine mvt_bd(this, cnew1, cnew2)
Write mover terms to listing file.
subroutine allocate_scalars(this)
@ brief Allocate scalar variables for package
Derived type for the Budget object.