18 character(len=LENBUDTXT) :: flowtype
19 character(len=LENBUDTXT) :: text1id1
20 character(len=LENBUDTXT) :: text2id1
21 character(len=LENBUDTXT) :: text1id2
22 character(len=LENBUDTXT) :: text2id2
23 character(len=LENBUDTXT),
dimension(:),
pointer :: auxtxt => null()
24 integer(I4B) :: maxlist
27 logical :: olconv1 = .false.
28 logical :: olconv2 = .false.
29 logical :: ordered_id1
30 integer(I4B),
dimension(:),
pointer :: id1 => null()
31 integer(I4B),
dimension(:),
pointer :: id2 => null()
32 real(dp),
dimension(:),
pointer :: flow => null()
33 real(dp),
dimension(:, :),
pointer :: auxvar => null()
34 integer(I4B) :: icounter
59 subroutine initialize(this, flowtype, text1id1, text2id1, &
60 text1id2, text2id2, maxlist, olconv1, olconv2, &
61 naux, auxtxt, ordered_id1)
64 character(len=LENBUDTXT),
intent(in) :: flowtype
65 character(len=LENBUDTXT),
intent(in) :: text1id1
66 character(len=LENBUDTXT),
intent(in) :: text2id1
67 character(len=LENBUDTXT),
intent(in) :: text1id2
68 character(len=LENBUDTXT),
intent(in) :: text2id2
69 integer(I4B),
intent(in) :: maxlist
70 logical,
intent(in) :: olconv1
71 logical,
intent(in) :: olconv2
72 integer(I4B),
intent(in) :: naux
73 character(len=LENBUDTXT),
dimension(:),
intent(in),
optional :: auxtxt
74 logical,
intent(in),
optional :: ordered_id1
76 this%flowtype = flowtype
77 this%text1id1 = text1id1
78 this%text2id1 = text2id1
79 this%text1id2 = text1id2
80 this%text2id2 = text2id2
81 this%maxlist = maxlist
82 this%olconv1 = olconv1
83 this%olconv2 = olconv2
86 call this%allocate_arrays()
87 if (
present(auxtxt)) this%auxtxt(:) = auxtxt(1:naux)
88 this%ordered_id1 = .true.
89 if (
present(ordered_id1)) this%ordered_id1 = ordered_id1
99 allocate (this%id1(this%maxlist))
100 allocate (this%id2(this%maxlist))
101 allocate (this%flow(this%maxlist))
102 allocate (this%auxvar(this%naux, this%maxlist))
103 allocate (this%auxtxt(this%naux))
113 deallocate (this%id1)
114 deallocate (this%id2)
115 deallocate (this%flow)
116 deallocate (this%auxvar)
117 deallocate (this%auxtxt)
125 integer(I4B),
intent(in) :: nlist
138 integer(I4B),
intent(in) :: id1
139 integer(I4B),
intent(in) :: id2
140 real(DP),
intent(in) :: flow
141 real(DP),
dimension(:),
intent(in),
optional :: auxvar
143 this%id1(this%icounter) = id1
144 this%id2(this%icounter) = id2
145 this%flow(this%icounter) = flow
146 if (
present(auxvar)) this%auxvar(:, this%icounter) = auxvar(1:this%naux)
147 this%icounter = this%icounter + 1
156 real(DP),
intent(inout) :: ratin
157 real(DP),
intent(inout) :: ratout
177 subroutine save_flows(this, dis, ibinun, kstp, kper, delt, pertim, totim, &
182 integer(I4B),
intent(in) :: ibinun
183 integer(I4B),
intent(in) :: kstp
184 integer(I4B),
intent(in) :: kper
185 real(DP),
intent(in) :: delt
186 real(DP),
intent(in) :: pertim
187 real(DP),
intent(in) :: totim
188 integer(I4B),
intent(in) :: iout
190 integer(I4B) :: nlist
201 if (n1 <= 0 .or. n2 <= 0) cycle
206 call ubdsv06(kstp, kper, this%flowtype, &
207 this%text1id1, this%text2id1, &
208 this%text1id2, this%text2id2, &
209 ibinun, this%naux, this%auxtxt, &
210 nlist, 1, 1, nlist, &
211 iout, delt, pertim, totim)
218 if (n1 <= 0 .or. n2 <= 0) cycle
219 call dis%record_mf6_list_entry(ibinun, n1, n2, q, &
220 this%naux, this%auxvar(:, i), &
221 olconv=this%olconv1, &
222 olconv2=this%olconv2)
233 integer(I4B) :: nlist
245 character(len=LENBUDTXT) :: flowtype
247 flowtype = this%flowtype
256 integer(I4B),
intent(in) :: icount
260 id1 = this%id1(icount)
271 integer(I4B),
intent(in) :: icount
273 id2 = this%id2(icount)
284 integer(I4B),
intent(in) :: icount
286 flow = this%flow(icount)
292 subroutine read_flows(this, dis, ibinun, kstp, kper, delt, pertim, totim)
296 integer(I4B),
intent(in) :: ibinun
297 integer(I4B),
intent(inout) :: kstp
298 integer(I4B),
intent(inout) :: kper
299 real(DP),
intent(inout) :: delt
300 real(DP),
intent(inout) :: pertim
301 real(DP),
intent(inout) :: totim
303 integer(I4B) :: idum1, idum2, imeth
309 read (ibinun) kstp, kper, this%flowtype, this%nlist, idum1, idum2
310 read (ibinun) imeth, delt, pertim, totim
311 read (ibinun) this%text1id1
312 read (ibinun) this%text2id1
313 read (ibinun) this%text1id2
314 read (ibinun) this%text2id2
315 read (ibinun) this%naux
316 this%naux = this%naux - 1
317 if (.not.
associated(this%auxtxt))
then
318 allocate (this%auxtxt(this%naux))
320 if (
size(this%auxtxt) /= this%naux)
then
321 deallocate (this%auxtxt)
322 allocate (this%auxtxt(this%naux))
326 if (this%naux > 0)
read (ibinun) (this%auxtxt(j), j=1, this%naux)
327 read (ibinun) this%nlist
328 if (.not.
associated(this%id1))
then
329 this%maxlist = this%nlist
330 allocate (this%id1(this%maxlist))
331 allocate (this%id2(this%maxlist))
332 allocate (this%flow(this%maxlist))
333 allocate (this%auxvar(this%naux, this%maxlist))
335 if (this%nlist > this%maxlist)
then
336 this%maxlist = this%nlist
337 deallocate (this%id1)
338 deallocate (this%id2)
339 deallocate (this%flow)
340 deallocate (this%auxvar)
341 allocate (this%id1(this%maxlist))
342 allocate (this%id2(this%maxlist))
343 allocate (this%flow(this%maxlist))
344 allocate (this%auxvar(this%naux, this%maxlist))
352 read (ibinun) (this%auxvar(j, i), j=1, this%naux)
353 if (this%olconv1) n1 = dis%get_nodenumber(n1, 0)
354 if (this%olconv2) n2 = dis%get_nodenumber(n2, 0)
377 this%flowtype = bfr%budtxt
378 this%text1id1 = bfr%srcmodelname
379 this%text2id1 = bfr%srcpackagename
380 this%text1id2 = bfr%dstmodelname
381 this%text2id2 = bfr%dstpackagename
384 if (.not.
associated(this%auxtxt))
then
385 allocate (this%auxtxt(this%naux))
387 if (
size(this%auxtxt) /= this%naux)
then
388 deallocate (this%auxtxt)
389 allocate (this%auxtxt(this%naux))
393 if (this%naux > 0) this%auxtxt(:) = bfr%auxtxt(:)
394 this%nlist = bfr%nlist
395 if (.not.
associated(this%id1))
then
396 this%maxlist = this%nlist
397 allocate (this%id1(this%maxlist))
398 allocate (this%id2(this%maxlist))
399 allocate (this%flow(this%maxlist))
400 allocate (this%auxvar(this%naux, this%maxlist))
402 if (this%nlist > this%maxlist)
then
403 this%maxlist = this%nlist
404 deallocate (this%id1)
405 deallocate (this%id2)
406 deallocate (this%flow)
407 deallocate (this%auxvar)
408 allocate (this%id1(this%maxlist))
409 allocate (this%id2(this%maxlist))
410 allocate (this%flow(this%maxlist))
411 allocate (this%auxvar(this%naux, this%maxlist))
419 this%auxvar(:, i) = bfr%auxvar(:, i)
420 if (this%olconv1) n1 = dis%get_nodenumber(n1, 0)
421 if (this%olconv2) n2 = dis%get_nodenumber(n2, 0)
integer(i4b) function get_id1(this, icount)
Get id1(icount) for the budget term.
subroutine accumulate_flow(this, ratin, ratout)
Calculate ratin and ratout for all the flow terms.
subroutine read_flows(this, dis, ibinun, kstp, kper, delt, pertim, totim)
Read flows from a binary file.
subroutine update_term(this, id1, id2, flow, auxvar)
replace the terms in position thisicounter for id1, id2, flow, and aux
real(dp) function get_flow(this, icount)
Get flow(icount) for the budget term.
character(len=lenbudtxt) function get_flowtype(this)
Get the flowtype for the budget term.
subroutine reset(this, nlist)
reset the budget term and counter so terms can be updated
subroutine deallocate_arrays(this)
Deallocate budget term arrays.
subroutine fill_from_bfr(this, bfr, dis)
Copy the flow from the binary file reader into this budterm.
integer(i4b) function get_id2(this, icount)
Get id2(icount) for the budget term.
subroutine initialize(this, flowtype, text1id1, text2id1, text1id2, text2id2, maxlist, olconv1, olconv2, naux, auxtxt, ordered_id1)
Initialize the budget term.
subroutine allocate_arrays(this)
Allocate budget term arrays.
subroutine save_flows(this, dis, ibinun, kstp, kper, delt, pertim, totim, iout)
Write flows to a binary file.
integer(i4b) function get_nlist(this)
Get the number of entries for the stress period.
This module contains simulation constants.
real(dp), parameter dzero
real constant zero
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
This module defines variable data types.