MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
gwe-sfe.f90
Go to the documentation of this file.
1! -- Stream Energy Transport Module
2! -- todo: Temperature decay?
3! -- todo: save the sfe temperature into the sfr aux variable? (perhaps needed for GWT-GWE exchanges)
4! -- todo: calculate the sfr VISC aux variable using temperature?
5!
6! SFR flows (sfrbudptr) index var SFE term Transport Type
7!---------------------------------------------------------------------------------
8
9! -- terms from SFR that will be handled by parent APT Package
10! FLOW-JA-FACE idxbudfjf FLOW-JA-FACE cv2cv
11! GWF (aux FLOW-AREA) idxbudgwf GWF cv2gwf
12! STORAGE (aux VOLUME) idxbudsto none used for cv volumes
13! FROM-MVR idxbudfmvr FROM-MVR rhow * cpw * q * tmpext = this%qfrommvr(:)
14! TO-MVR idxbudtmvr TO-MVR rhow * cpw * q * tfeat
15
16! -- terms from SFR that will be handled by SFE
17! RAINFALL idxbudrain RAINFALL rhow * cpw * q * train
18! EVAPORATION idxbudevap EVAPORATION rhow * latheatvap * q
19! RUNOFF idxbudroff RUNOFF rhow * cpw * q * troff
20! EXT-INFLOW idxbudiflw EXT-INFLOW rhow * cpw * q * tiflw
21! EXT-OUTFLOW idxbudoutf EXT-OUTFLOW rhow * cpw * q * tfeat
22
23! -- terms not associated with SFR
24! STRMBD-COND none STRMBD-COND ctherm * (tcell - tfeat) (ctherm is a thermal conductance for the streambed)
25
26! -- terms from a flow file that should be skipped
27! CONSTANT none none none
28! AUXILIARY none none none
29
30! -- terms that are written to the transport budget file
31! none none STORAGE (aux MASS) dE/dt
32! none none AUXILIARY none
33! none none CONSTANT accumulate
34!
35!
37
38 use kindmodule, only: dp, i4b
44 use simvariablesmodule, only: errmsg
47 use tspfmimodule, only: tspfmitype
48 use sfrmodule, only: sfrtype
49 use observemodule, only: observetype
54 !
55 implicit none
56 !
57 private
58 public :: sfe_create
59 !
60 character(len=*), parameter :: ftype = 'SFE'
61 character(len=*), parameter :: flowtype = 'SFR'
62 character(len=16) :: text = ' SFE'
63
64 type, extends(tspapttype) :: gwesfetype
65
66 type(gweinputdatatype), pointer :: gwecommon => null() !< pointer to shared gwe data used by multiple packages but set in mst
67
68 integer(I4B), pointer :: idxbudrain => null() !< index of rainfall terms in flowbudptr
69 integer(I4B), pointer :: idxbudevap => null() !< index of evaporation terms in flowbudptr
70 integer(I4B), pointer :: idxbudroff => null() !< index of runoff terms in flowbudptr
71 integer(I4B), pointer :: idxbudiflw => null() !< index of inflow terms in flowbudptr
72 integer(I4B), pointer :: idxbudoutf => null() !< index of outflow terms in flowbudptr
73
74 real(dp), dimension(:), pointer, contiguous :: temprain => null() !< rainfall temperature
75 real(dp), dimension(:), pointer, contiguous :: tempevap => null() !< evaporation temperature
76 real(dp), dimension(:), pointer, contiguous :: temproff => null() !< runoff temperature
77 real(dp), dimension(:), pointer, contiguous :: tempiflw => null() !< inflow temperature
78 real(dp), dimension(:), pointer, contiguous :: vnew => null() !< current volume of reach
79 real(dp), dimension(:), pointer, contiguous :: vold => null() !< previous volume of reach
80 real(dp), dimension(:), pointer, contiguous :: ktf => null() !< thermal conductivity between the sfe and groundwater cell
81 real(dp), dimension(:), pointer, contiguous :: rfeatthk => null() !< thickness of streambed material through which thermal conduction occurs
82
83 contains
84
85 procedure :: bnd_ad => sfe_ad
86 procedure :: bnd_da => sfe_da
87 procedure :: allocate_scalars
94 procedure :: pak_solve => sfe_solve
98 procedure :: sfe_rain_term
99 procedure :: sfe_evap_term
100 procedure :: sfe_roff_term
101 procedure :: sfe_iflw_term
102 procedure :: sfe_outf_term
103 procedure, private :: sfe_sbcd_term
104 procedure :: pak_df_obs => sfe_df_obs
105 procedure :: pak_rp_obs => sfe_rp_obs
106 procedure :: pak_bd_obs => sfe_bd_obs
108
109 end type gwesfetype
110
111contains
112
113 !> @brief Create a new sfe package
114 !<
115 subroutine sfe_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, &
116 mempath, fmi, eqnsclfac, gwecommon, dvt, dvu, dvua)
117 ! -- dummy
118 class(bndtype), pointer :: packobj
119 integer(I4B), intent(in) :: id
120 integer(I4B), intent(in) :: ibcnum
121 integer(I4B), intent(in) :: inunit
122 integer(I4B), intent(in) :: iout
123 character(len=*), intent(in) :: namemodel
124 character(len=*), intent(in) :: pakname
125 character(len=*), intent(in) :: mempath !< input memory path
126 type(tspfmitype), pointer :: fmi
127 real(dp), intent(in), pointer :: eqnsclfac !< Governing equation scale factor
128 type(gweinputdatatype), intent(in), target :: gwecommon !< Shared data container for use by multiple GWE packages
129 character(len=*), intent(in) :: dvt !< For GWE, set to "TEMPERATURE" in TspAptType
130 character(len=*), intent(in) :: dvu !< For GWE, set to "energy" in TspAptType
131 character(len=*), intent(in) :: dvua !< For GWE, set to "E" in TspAptType
132 ! -- local
133 type(gwesfetype), pointer :: sfeobj
134 !
135 ! -- Allocate the object and assign values to object variables
136 allocate (sfeobj)
137 packobj => sfeobj
138 !
139 ! -- Create name and memory path
140 call packobj%set_names(ibcnum, namemodel, pakname, ftype, mempath)
141 packobj%text = text
142 !
143 ! -- Allocate scalars
144 call sfeobj%allocate_scalars()
145 !
146 ! -- Initialize package
147 call packobj%pack_initialize()
148 !
149 packobj%inunit = inunit
150 packobj%iout = iout
151 packobj%id = id
152 packobj%ibcnum = ibcnum
153 packobj%ncolbnd = 1
154 packobj%iscloc = 1
155 packobj%isadvpak = 1
156 !
157 ! -- Store pointer to flow model interface. When the GwfGwt exchange is
158 ! created, it sets fmi%bndlist so that the GWT model has access to all
159 ! the flow packages
160 sfeobj%fmi => fmi
161 !
162 ! -- Store pointer to governing equation scale factor
163 sfeobj%eqnsclfac => eqnsclfac
164 !
165 ! -- Store pointer to shared data module for accessing cpw, rhow
166 ! for the budget calculations, and for accessing the latent heat of
167 ! vaporization for evaporative cooling.
168 sfeobj%gwecommon => gwecommon
169 !
170 ! -- Set labels that will be used in generalized APT class
171 sfeobj%depvartype = dvt
172 sfeobj%depvarunit = dvu
173 sfeobj%depvarunitabbrev = dvua
174 end subroutine sfe_create
175
176 !> @brief Find corresponding sfe package
177 !<
178 subroutine find_sfe_package(this)
179 ! -- modules
181 ! -- dummy
182 class(gwesfetype) :: this
183 ! -- local
184 character(len=LINELENGTH) :: errmsg
185 class(bndtype), pointer :: packobj
186 integer(I4B) :: ip, icount
187 integer(I4B) :: nbudterm
188 logical :: found
189 !
190 ! -- Initialize found to false, and error later if flow package cannot
191 ! be found
192 found = .false.
193 !
194 ! -- If user is specifying flows in a binary budget file, then set up
195 ! the budget file reader, otherwise set a pointer to the flow package
196 ! budobj
197 if (this%fmi%flows_from_file) then
198 call this%fmi%set_aptbudobj_pointer(this%flowpackagename, this%flowbudptr)
199 if (associated(this%flowbudptr)) found = .true.
200 !
201 else
202 if (associated(this%fmi%gwfbndlist)) then
203 ! -- Look through gwfbndlist for a flow package with the same name as
204 ! this transport package name
205 do ip = 1, this%fmi%gwfbndlist%Count()
206 packobj => getbndfromlist(this%fmi%gwfbndlist, ip)
207 if (packobj%packName == this%flowpackagename) then
208 found = .true.
209 !
210 ! -- Store BndType pointer to packobj, and then
211 ! use the select type to point to the budobj in flow package
212 this%flowpackagebnd => packobj
213 select type (packobj)
214 type is (sfrtype)
215 this%flowbudptr => packobj%budobj
216 end select
217 end if
218 if (found) exit
219 end do
220 end if
221 end if
222 !
223 ! -- Error if flow package not found
224 if (.not. found) then
225 write (errmsg, '(a)') 'Could not find flow package with name '&
226 &//trim(adjustl(this%flowpackagename))//'.'
227 call store_error(errmsg)
228 call store_error_filename(this%input_fname)
229 end if
230 !
231 ! -- Allocate space for idxbudssm, which indicates whether this is a
232 ! special budget term or one that is a general source and sink
233 nbudterm = this%flowbudptr%nbudterm
234 call mem_allocate(this%idxbudssm, nbudterm, 'IDXBUDSSM', this%memoryPath)
235 !
236 ! -- Process budget terms and identify special budget terms
237 write (this%iout, '(/, a, a)') &
238 'PROCESSING '//ftype//' INFORMATION FOR ', this%packName
239 write (this%iout, '(a)') ' IDENTIFYING FLOW TERMS IN '//flowtype//' PACKAGE'
240 write (this%iout, '(a, i0)') &
241 ' NUMBER OF '//flowtype//' = ', this%flowbudptr%ncv
242 icount = 1
243 do ip = 1, this%flowbudptr%nbudterm
244 select case (trim(adjustl(this%flowbudptr%budterm(ip)%flowtype)))
245 case ('FLOW-JA-FACE')
246 this%idxbudfjf = ip
247 this%idxbudssm(ip) = 0
248 case ('GWF')
249 this%idxbudgwf = ip
250 this%idxbudssm(ip) = 0
251 case ('STORAGE')
252 this%idxbudsto = ip
253 this%idxbudssm(ip) = 0
254 case ('RAINFALL')
255 this%idxbudrain = ip
256 this%idxbudssm(ip) = 0
257 case ('EVAPORATION')
258 this%idxbudevap = ip
259 this%idxbudssm(ip) = 0
260 case ('RUNOFF')
261 this%idxbudroff = ip
262 this%idxbudssm(ip) = 0
263 case ('EXT-INFLOW')
264 this%idxbudiflw = ip
265 this%idxbudssm(ip) = 0
266 case ('EXT-OUTFLOW')
267 this%idxbudoutf = ip
268 this%idxbudssm(ip) = 0
269 case ('TO-MVR')
270 this%idxbudtmvr = ip
271 this%idxbudssm(ip) = 0
272 case ('FROM-MVR')
273 this%idxbudfmvr = ip
274 this%idxbudssm(ip) = 0
275 case ('AUXILIARY')
276 this%idxbudaux = ip
277 this%idxbudssm(ip) = 0
278 case default
279 !
280 ! -- Set idxbudssm equal to a column index for where the temperatures
281 ! are stored in the concbud(nbudssm, ncv) array
282 this%idxbudssm(ip) = icount
283 icount = icount + 1
284 end select
285 write (this%iout, '(a, i0, " = ", a,/, a, i0)') &
286 ' TERM ', ip, trim(adjustl(this%flowbudptr%budterm(ip)%flowtype)), &
287 ' MAX NO. OF ENTRIES = ', this%flowbudptr%budterm(ip)%maxlist
288 end do
289 write (this%iout, '(a, //)') 'DONE PROCESSING '//ftype//' INFORMATION'
290 end subroutine find_sfe_package
291
292 !> @brief Value for a package-specific PERIOD setting
293 !!
294 !! Already resolved by the input context; this only supplies it for
295 !! the shared apt_rp table echo.
296 !<
297 function sfe_setting_value(this, itemno, key) result(val)
298 ! -- dummy
299 class(gwesfetype), intent(inout) :: this
300 integer(I4B), intent(in) :: itemno
301 character(len=*), intent(in) :: key
302 real(dp) :: val
303 !
304 val = dzero
305 select case (trim(key))
306 case ('RAINFALL')
307 val = this%temprain(itemno)
308 case ('EVAPORATION')
309 val = this%tempevap(itemno)
310 case ('RUNOFF')
311 val = this%temproff(itemno)
312 case ('INFLOW')
313 val = this%tempiflw(itemno)
314 end select
315 end function sfe_setting_value
316
317 !> @brief Add matrix terms related to SFE
318 !!
319 !! This will be called from TspAptType%apt_fc_expanded()
320 !! in order to add matrix terms specifically for SFE
321 !<
322 subroutine sfe_fc_expanded(this, rhs, ia, idxglo, matrix_sln)
323 ! -- dummy
324 class(gwesfetype) :: this
325 real(DP), dimension(:), intent(inout) :: rhs
326 integer(I4B), dimension(:), intent(in) :: ia
327 integer(I4B), dimension(:), intent(in) :: idxglo
328 class(matrixbasetype), pointer :: matrix_sln
329 ! -- local
330 integer(I4B) :: j, n1, n2
331 integer(I4B) :: iloc
332 integer(I4B) :: iposd, iposoffd
333 integer(I4B) :: ipossymd, ipossymoffd
334 real(DP) :: rrate
335 real(DP) :: rhsval
336 real(DP) :: hcofval
337 !
338 ! -- Add rainfall contribution
339 if (this%idxbudrain /= 0) then
340 do j = 1, this%flowbudptr%budterm(this%idxbudrain)%nlist
341 call this%sfe_rain_term(j, n1, n2, rrate, rhsval, hcofval)
342 iloc = this%idxlocnode(n1)
343 iposd = this%idxpakdiag(n1)
344 call matrix_sln%add_value_pos(iposd, hcofval)
345 rhs(iloc) = rhs(iloc) + rhsval
346 end do
347 end if
348 !
349 ! -- Add evaporation contribution
350 if (this%idxbudevap /= 0) then
351 do j = 1, this%flowbudptr%budterm(this%idxbudevap)%nlist
352 call this%sfe_evap_term(j, n1, n2, rrate, rhsval, hcofval)
353 iloc = this%idxlocnode(n1)
354 iposd = this%idxpakdiag(n1)
355 call matrix_sln%add_value_pos(iposd, hcofval)
356 rhs(iloc) = rhs(iloc) + rhsval
357 end do
358 end if
359 !
360 ! -- Add runoff contribution
361 if (this%idxbudroff /= 0) then
362 do j = 1, this%flowbudptr%budterm(this%idxbudroff)%nlist
363 call this%sfe_roff_term(j, n1, n2, rrate, rhsval, hcofval)
364 iloc = this%idxlocnode(n1)
365 iposd = this%idxpakdiag(n1)
366 call matrix_sln%add_value_pos(iposd, hcofval)
367 rhs(iloc) = rhs(iloc) + rhsval
368 end do
369 end if
370 !
371 ! -- Add inflow contribution
372 if (this%idxbudiflw /= 0) then
373 do j = 1, this%flowbudptr%budterm(this%idxbudiflw)%nlist
374 call this%sfe_iflw_term(j, n1, n2, rrate, rhsval, hcofval)
375 iloc = this%idxlocnode(n1)
376 iposd = this%idxpakdiag(n1)
377 call matrix_sln%add_value_pos(iposd, hcofval)
378 rhs(iloc) = rhs(iloc) + rhsval
379 end do
380 end if
381 !
382 ! -- Add outflow contribution
383 if (this%idxbudoutf /= 0) then
384 do j = 1, this%flowbudptr%budterm(this%idxbudoutf)%nlist
385 call this%sfe_outf_term(j, n1, n2, rrate, rhsval, hcofval)
386 iloc = this%idxlocnode(n1)
387 iposd = this%idxpakdiag(n1)
388 call matrix_sln%add_value_pos(iposd, hcofval)
389 rhs(iloc) = rhs(iloc) + rhsval
390 end do
391 end if
392 !
393 ! -- Add streambed conduction contribution
394 do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
395 !
396 ! -- Set n to feature number and process if active feature
397 n1 = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
398 if (this%iboundpak(n1) /= 0) then
399 !
400 call this%sfe_sbcd_term(j, n1, n2, rrate, rhsval, hcofval)
401 !
402 ! -- Add to sfe row
403 iposd = this%idxdglo(j)
404 iposoffd = this%idxoffdglo(j)
405 call matrix_sln%add_value_pos(iposd, -hcofval)
406 call matrix_sln%add_value_pos(iposoffd, hcofval)
407 !
408 ! -- Add to gwe row for sfe connection
409 ipossymd = this%idxsymdglo(j)
410 ipossymoffd = this%idxsymoffdglo(j)
411 call matrix_sln%add_value_pos(ipossymd, -hcofval)
412 call matrix_sln%add_value_pos(ipossymoffd, hcofval)
413 end if
414 end do
415 end subroutine sfe_fc_expanded
416
417 !> @brief Add terms specific to sfr to the explicit sfe solve
418 !<
419 subroutine sfe_solve(this)
420 ! -- dummy
421 class(gwesfetype) :: this
422 ! -- local
423 integer(I4B) :: j
424 integer(I4B) :: n1, n2
425 real(DP) :: rrate
426 !
427 ! -- Add rainfall contribution
428 if (this%idxbudrain /= 0) then
429 do j = 1, this%flowbudptr%budterm(this%idxbudrain)%nlist
430 call this%sfe_rain_term(j, n1, n2, rrate)
431 this%dbuff(n1) = this%dbuff(n1) + rrate
432 end do
433 end if
434 !
435 ! -- Add evaporation contribution
436 if (this%idxbudevap /= 0) then
437 do j = 1, this%flowbudptr%budterm(this%idxbudevap)%nlist
438 call this%sfe_evap_term(j, n1, n2, rrate)
439 this%dbuff(n1) = this%dbuff(n1) + rrate
440 end do
441 end if
442 !
443 ! -- Add runoff contribution
444 if (this%idxbudroff /= 0) then
445 do j = 1, this%flowbudptr%budterm(this%idxbudroff)%nlist
446 call this%sfe_roff_term(j, n1, n2, rrate)
447 this%dbuff(n1) = this%dbuff(n1) + rrate
448 end do
449 end if
450 !
451 ! -- Add inflow contribution
452 if (this%idxbudiflw /= 0) then
453 do j = 1, this%flowbudptr%budterm(this%idxbudiflw)%nlist
454 call this%sfe_iflw_term(j, n1, n2, rrate)
455 this%dbuff(n1) = this%dbuff(n1) + rrate
456 end do
457 end if
458 !
459 ! -- Add outflow contribution
460 if (this%idxbudoutf /= 0) then
461 do j = 1, this%flowbudptr%budterm(this%idxbudoutf)%nlist
462 call this%sfe_outf_term(j, n1, n2, rrate)
463 this%dbuff(n1) = this%dbuff(n1) + rrate
464 end do
465 end if
466 !
467 ! Note: explicit streambed conduction terms???
468 end subroutine sfe_solve
469
470 !> @brief Function to return the number of budget terms just for this package.
471 !!
472 !! This overrides a function in the parent class.
473 !<
474 function sfe_get_nbudterms(this) result(nbudterms)
475 ! -- dummy
476 class(gwesfetype) :: this
477 ! -- return
478 integer(I4B) :: nbudterms
479 !
480 ! -- Number of budget terms is 6:
481 ! 1. rainfall
482 ! 2. evaporation
483 ! 3. runoff
484 ! 4. ext-inflow
485 ! 5. ext-outflow
486 ! 6. strmbd-cond
487 nbudterms = 6
488 end function sfe_get_nbudterms
489
490 !> @brief Set up the budget object that stores all the sfe flows
491 !<
492 subroutine sfe_setup_budobj(this, idx)
493 ! -- modules
494 use constantsmodule, only: lenbudtxt
495 ! -- dummy
496 class(gwesfetype) :: this
497 integer(I4B), intent(inout) :: idx
498 ! -- local
499 integer(I4B) :: n, n1, n2
500 integer(I4B) :: maxlist, naux
501 real(DP) :: q
502 character(len=LENBUDTXT) :: text
503 !
504 ! --
505 text = ' RAINFALL'
506 idx = idx + 1
507 maxlist = this%flowbudptr%budterm(this%idxbudrain)%maxlist
508 naux = 0
509 call this%budobj%budterm(idx)%initialize(text, &
510 this%name_model, &
511 this%packName, &
512 this%name_model, &
513 this%packName, &
514 maxlist, .false., .false., &
515 naux)
516 !
517 ! --
518 text = ' EVAPORATION'
519 idx = idx + 1
520 maxlist = this%flowbudptr%budterm(this%idxbudevap)%maxlist
521 naux = 0
522 call this%budobj%budterm(idx)%initialize(text, &
523 this%name_model, &
524 this%packName, &
525 this%name_model, &
526 this%packName, &
527 maxlist, .false., .false., &
528 naux)
529 !
530 ! --
531 text = ' RUNOFF'
532 idx = idx + 1
533 maxlist = this%flowbudptr%budterm(this%idxbudroff)%maxlist
534 naux = 0
535 call this%budobj%budterm(idx)%initialize(text, &
536 this%name_model, &
537 this%packName, &
538 this%name_model, &
539 this%packName, &
540 maxlist, .false., .false., &
541 naux)
542 !
543 ! --
544 text = ' EXT-INFLOW'
545 idx = idx + 1
546 maxlist = this%flowbudptr%budterm(this%idxbudiflw)%maxlist
547 naux = 0
548 call this%budobj%budterm(idx)%initialize(text, &
549 this%name_model, &
550 this%packName, &
551 this%name_model, &
552 this%packName, &
553 maxlist, .false., .false., &
554 naux)
555 !
556 ! --
557 text = ' EXT-OUTFLOW'
558 idx = idx + 1
559 maxlist = this%flowbudptr%budterm(this%idxbudoutf)%maxlist
560 naux = 0
561 call this%budobj%budterm(idx)%initialize(text, &
562 this%name_model, &
563 this%packName, &
564 this%name_model, &
565 this%packName, &
566 maxlist, .false., .false., &
567 naux)
568 !
569 ! -- Conduction through the wetted streambed
570 text = ' STRMBD-COND'
571 idx = idx + 1
572 maxlist = this%flowbudptr%budterm(this%idxbudgwf)%maxlist
573 naux = 0
574 call this%budobj%budterm(idx)%initialize(text, &
575 this%name_model, &
576 this%packName, &
577 this%name_model, &
578 this%packName, &
579 maxlist, .false., .false., &
580 naux)
581 call this%budobj%budterm(idx)%reset(maxlist)
582 q = dzero
583 do n = 1, maxlist
584 n1 = this%flowbudptr%budterm(this%idxbudgwf)%id1(n)
585 n2 = this%flowbudptr%budterm(this%idxbudgwf)%id2(n)
586 call this%budobj%budterm(idx)%update_term(n1, n2, q)
587 end do
588 end subroutine sfe_setup_budobj
589
590 !> @brief Copy flow terms into this%budobj
591 !<
592 subroutine sfe_fill_budobj(this, idx, x, flowja, ccratin, ccratout)
593 ! -- dummy
594 class(gwesfetype) :: this
595 integer(I4B), intent(inout) :: idx
596 real(DP), dimension(:), intent(in) :: x
597 real(DP), dimension(:), contiguous, intent(inout) :: flowja
598 real(DP), intent(inout) :: ccratin
599 real(DP), intent(inout) :: ccratout
600 ! -- local
601 integer(I4B) :: j, n1, n2
602 integer(I4B) :: igwfnode
603 integer(I4B) :: nlist
604 integer(I4B) :: idiag
605 real(DP) :: q
606 !
607 ! -- Rain
608 idx = idx + 1
609 nlist = this%flowbudptr%budterm(this%idxbudrain)%nlist
610 call this%budobj%budterm(idx)%reset(nlist)
611 do j = 1, nlist
612 call this%sfe_rain_term(j, n1, n2, q)
613 call this%budobj%budterm(idx)%update_term(n1, n2, q)
614 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
615 end do
616 !
617 ! -- Evaporation
618 idx = idx + 1
619 nlist = this%flowbudptr%budterm(this%idxbudevap)%nlist
620 call this%budobj%budterm(idx)%reset(nlist)
621 do j = 1, nlist
622 call this%sfe_evap_term(j, n1, n2, q)
623 call this%budobj%budterm(idx)%update_term(n1, n2, q)
624 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
625 end do
626 !
627 ! -- Runoff
628 idx = idx + 1
629 nlist = this%flowbudptr%budterm(this%idxbudroff)%nlist
630 call this%budobj%budterm(idx)%reset(nlist)
631 do j = 1, nlist
632 call this%sfe_roff_term(j, n1, n2, q)
633 call this%budobj%budterm(idx)%update_term(n1, n2, q)
634 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
635 end do
636 !
637 ! -- Ext-inflow
638 idx = idx + 1
639 nlist = this%flowbudptr%budterm(this%idxbudiflw)%nlist
640 call this%budobj%budterm(idx)%reset(nlist)
641 do j = 1, nlist
642 call this%sfe_iflw_term(j, n1, n2, q)
643 call this%budobj%budterm(idx)%update_term(n1, n2, q)
644 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
645 end do
646 !
647 ! -- Ext-outflow
648 idx = idx + 1
649 nlist = this%flowbudptr%budterm(this%idxbudoutf)%nlist
650 call this%budobj%budterm(idx)%reset(nlist)
651 do j = 1, nlist
652 call this%sfe_outf_term(j, n1, n2, q)
653 call this%budobj%budterm(idx)%update_term(n1, n2, q)
654 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
655 end do
656 !
657 ! -- Strmbd-cond. The idxbudgwf index is used since it contains the
658 ! sfe/cell mapping information
659 idx = idx + 1
660 nlist = this%flowbudptr%budterm(this%idxbudgwf)%nlist
661 call this%budobj%budterm(idx)%reset(nlist)
662 do j = 1, nlist
663 n1 = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
664 if (this%iboundpak(n1) /= 0) then
665 ! -- use igwfnode instead of n2 for consistency with usage in apt;
666 ! helps highlight that cell number is sought and used
667 call this%sfe_sbcd_term(j, n1, igwfnode, q)
668 call this%budobj%budterm(idx)%update_term(n1, igwfnode, q)
669 call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
670 ! -- Contribution to gwe cell budget, which is different than the
671 ! other terms (i.e., ext-inflow, evap, etc.)
672 this%simvals(n1) = this%simvals(n1) - q
673 idiag = this%dis%con%ia(igwfnode)
674 flowja(idiag) = flowja(idiag) - q
675 end if
676 end do
677 end subroutine sfe_fill_budobj
678
679 !> @brief Allocate scalars specific to the streamflow energy transport (SFE)
680 !! package.
681 !<
682 subroutine allocate_scalars(this)
683 ! -- modules
685 ! -- dummy
686 class(gwesfetype) :: this
687 !
688 ! -- Allocate scalars in TspAptType
689 call this%TspAptType%allocate_scalars()
690 !
691 ! -- Allocate
692 call mem_allocate(this%idxbudrain, 'IDXBUDRAIN', this%memoryPath)
693 call mem_allocate(this%idxbudevap, 'IDXBUDEVAP', this%memoryPath)
694 call mem_allocate(this%idxbudroff, 'IDXBUDROFF', this%memoryPath)
695 call mem_allocate(this%idxbudiflw, 'IDXBUDIFLW', this%memoryPath)
696 call mem_allocate(this%idxbudoutf, 'IDXBUDOUTF', this%memoryPath)
697 !
698 ! -- Initialize
699 this%idxbudrain = 0
700 this%idxbudevap = 0
701 this%idxbudroff = 0
702 this%idxbudiflw = 0
703 this%idxbudoutf = 0
704 end subroutine allocate_scalars
705
706 !> @brief Allocate arrays specific to the streamflow energy transport (SFE)
707 !! package.
708 !<
709 subroutine sfe_allocate_arrays(this)
710 ! -- modules
712 ! -- dummy
713 class(gwesfetype), intent(inout) :: this
714 ! -- local
715 integer(I4B) :: n
716 !
717 ! -- alias into the input context's permanent, feature-indexed arrays
718 ! (allocated and DZERO-initialized by the input context)
719 call mem_setptr(this%temprain, 'RAINFALL', this%input_mempath)
720 call mem_setptr(this%tempevap, 'EVAPORATION', this%input_mempath)
721 call mem_setptr(this%temproff, 'RUNOFF', this%input_mempath)
722 call mem_setptr(this%tempiflw, 'INFLOW', this%input_mempath)
723 !
724 call mem_allocate(this%vnew, this%ncv, 'VNEW', this%memoryPath)
725 call mem_allocate(this%vold, this%ncv, 'VOLD', this%memoryPath)
726 !
727 ! -- Call standard TspAptType allocate arrays
728 call this%TspAptType%apt_allocate_arrays()
729 !
730 ! -- Initialize
731 do n = 1, this%ncv
732 this%vnew(n) = dzero
733 this%vold(n) = dzero
734 end do
735 end subroutine sfe_allocate_arrays
736
737 !> @brief Alias deprecated SFE variable names to their current storage
738 !<
740 ! -- modules
742 ! -- dummy
743 class(gwesfetype), intent(inout) :: this
744 ! -- code
745 !
746 ! -- names common to all advanced transport packages
747 call this%TspAptType%apt_checkin_deprecated_names()
748 !
749 call mem_alias_deprecated(this%temprain, 'TEMPRAIN', this%memoryPath, &
750 'RAINFALL', this%input_mempath, '6.8.2')
751 call mem_alias_deprecated(this%tempevap, 'TEMPEVAP', this%memoryPath, &
752 'EVAPORATION', this%input_mempath, '6.8.2')
753 call mem_alias_deprecated(this%temproff, 'TEMPROFF', this%memoryPath, &
754 'RUNOFF', this%input_mempath, '6.8.2')
755 call mem_alias_deprecated(this%tempiflw, 'TEMPIFLW', this%memoryPath, &
756 'INFLOW', this%input_mempath, '6.8.2')
757 end subroutine sfe_checkin_deprecated_names
758
759 !> @brief Advance sfe package routine
760 !<
761 subroutine sfe_ad(this)
762 ! -- dummy
763 class(gwesfetype) :: this
764 ! -- local
765 integer(I4B) :: n
766 !
767 ! -- call base bnd_ad and run the per-timestep resync directly
768 ! (see apt_ad_resync)
769 call this%BndExtType%bnd_ad()
770 call this%apt_ad_resync()
771 !
772 ! -- update vold
773 do n = 1, this%ncv
774 this%vold(n) = this%vnew(n)
775 end do
776
777 end subroutine sfe_ad
778
779 !> @brief Deallocate memory
780 !<
781 subroutine sfe_da(this)
782 ! -- modules
784 ! -- dummy
785 class(gwesfetype) :: this
786 !
787 ! -- Deallocate scalars
788 call mem_deallocate(this%idxbudrain)
789 call mem_deallocate(this%idxbudevap)
790 call mem_deallocate(this%idxbudroff)
791 call mem_deallocate(this%idxbudiflw)
792 call mem_deallocate(this%idxbudoutf)
793 !
794 ! -- input-context-owned aliases, not package-allocated
795 nullify (this%temprain)
796 nullify (this%tempevap)
797 nullify (this%temproff)
798 nullify (this%tempiflw)
799 !
800 call mem_deallocate(this%vnew)
801 call mem_deallocate(this%vold)
802 !
803 ! -- Deallocate arrays
804 call mem_deallocate(this%ktf)
805 call mem_deallocate(this%rfeatthk)
806 !
807 ! -- Deallocate scalars in TspAptType
808 call this%TspAptType%bnd_da()
809 end subroutine sfe_da
810
811 !> @brief Rain term
812 !<
813 subroutine sfe_rain_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
814 ! -- dummy
815 class(gwesfetype) :: this
816 integer(I4B), intent(in) :: ientry
817 integer(I4B), intent(inout) :: n1
818 integer(I4B), intent(inout) :: n2
819 real(DP), intent(inout), optional :: rrate
820 real(DP), intent(inout), optional :: rhsval
821 real(DP), intent(inout), optional :: hcofval
822 ! -- local
823 real(DP) :: qbnd
824 real(DP) :: ctmp
825 !
826 n1 = this%flowbudptr%budterm(this%idxbudrain)%id1(ientry)
827 n2 = this%flowbudptr%budterm(this%idxbudrain)%id2(ientry)
828 qbnd = this%flowbudptr%budterm(this%idxbudrain)%flow(ientry)
829 ctmp = this%temprain(n1)
830 if (present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
831 if (present(rhsval)) rhsval = -rrate
832 if (present(hcofval)) hcofval = dzero
833 end subroutine sfe_rain_term
834
835 !> @brief Evaporative term
836 !<
837 subroutine sfe_evap_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
838 ! -- dummy
839 class(gwesfetype) :: this
840 integer(I4B), intent(in) :: ientry
841 integer(I4B), intent(inout) :: n1
842 integer(I4B), intent(inout) :: n2
843 real(DP), intent(inout), optional :: rrate
844 real(DP), intent(inout), optional :: rhsval
845 real(DP), intent(inout), optional :: hcofval
846 ! -- local
847 real(DP) :: qbnd
848 real(DP) :: heatlat
849 !
850 n1 = this%flowbudptr%budterm(this%idxbudevap)%id1(ientry)
851 n2 = this%flowbudptr%budterm(this%idxbudevap)%id2(ientry)
852 ! -- note that qbnd is negative for evap
853 qbnd = this%flowbudptr%budterm(this%idxbudevap)%flow(ientry)
854 heatlat = this%gwecommon%gwerhow * this%gwecommon%gwelatheatvap
855 if (present(rrate)) rrate = qbnd * heatlat
856 if (present(rhsval)) rhsval = -rrate
857 if (present(hcofval)) hcofval = dzero
858 end subroutine sfe_evap_term
859
860 !> @brief Runoff term
861 !<
862 subroutine sfe_roff_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
863 ! -- dummy
864 class(gwesfetype) :: this
865 integer(I4B), intent(in) :: ientry
866 integer(I4B), intent(inout) :: n1
867 integer(I4B), intent(inout) :: n2
868 real(DP), intent(inout), optional :: rrate
869 real(DP), intent(inout), optional :: rhsval
870 real(DP), intent(inout), optional :: hcofval
871 ! -- local
872 real(DP) :: qbnd
873 real(DP) :: ctmp
874 !
875 n1 = this%flowbudptr%budterm(this%idxbudroff)%id1(ientry)
876 n2 = this%flowbudptr%budterm(this%idxbudroff)%id2(ientry)
877 qbnd = this%flowbudptr%budterm(this%idxbudroff)%flow(ientry)
878 ctmp = this%temproff(n1)
879 if (present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
880 if (present(rhsval)) rhsval = -rrate
881 if (present(hcofval)) hcofval = dzero
882 end subroutine sfe_roff_term
883
884 !> @brief Inflow Term
885 !!
886 !! Accounts for energy added via streamflow entering into a stream channel;
887 !! for example, energy entering the model domain via a specified flow in a
888 !! stream channel.
889 !<
890 subroutine sfe_iflw_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
891 ! -- dummy
892 class(gwesfetype) :: this
893 integer(I4B), intent(in) :: ientry
894 integer(I4B), intent(inout) :: n1
895 integer(I4B), intent(inout) :: n2
896 real(DP), intent(inout), optional :: rrate
897 real(DP), intent(inout), optional :: rhsval
898 real(DP), intent(inout), optional :: hcofval
899 ! -- local
900 real(DP) :: qbnd
901 real(DP) :: ctmp
902 !
903 n1 = this%flowbudptr%budterm(this%idxbudiflw)%id1(ientry)
904 n2 = this%flowbudptr%budterm(this%idxbudiflw)%id2(ientry)
905 qbnd = this%flowbudptr%budterm(this%idxbudiflw)%flow(ientry)
906 ctmp = this%tempiflw(n1)
907 if (present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
908 if (present(rhsval)) rhsval = -rrate
909 if (present(hcofval)) hcofval = dzero
910 end subroutine sfe_iflw_term
911
912 !> @brief Outflow term
913 !!
914 !! Accounts for the energy leaving a stream channel, for example, energy exiting the
915 !! model domain via a flow in a stream channel flowing out of the active domain.
916 !<
917 subroutine sfe_outf_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
918 ! -- dummy
919 class(gwesfetype) :: this
920 integer(I4B), intent(in) :: ientry
921 integer(I4B), intent(inout) :: n1
922 integer(I4B), intent(inout) :: n2
923 real(DP), intent(inout), optional :: rrate
924 real(DP), intent(inout), optional :: rhsval
925 real(DP), intent(inout), optional :: hcofval
926 ! -- local
927 real(DP) :: qbnd
928 real(DP) :: ctmp
929 !
930 n1 = this%flowbudptr%budterm(this%idxbudoutf)%id1(ientry)
931 n2 = this%flowbudptr%budterm(this%idxbudoutf)%id2(ientry)
932 qbnd = this%flowbudptr%budterm(this%idxbudoutf)%flow(ientry)
933 ctmp = this%xnewpak(n1)
934 if (present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
935 if (present(rhsval)) rhsval = dzero
936 if (present(hcofval)) hcofval = qbnd * this%eqnsclfac
937 end subroutine sfe_outf_term
938
939 !> @brief Streambed conduction term
940 !!
941 !! Accounts for the energy entering or leaving a stream channel by
942 !! thermal conduction through the streambed.
943 !<
944 subroutine sfe_sbcd_term(this, ientry, n1, igwfnode, rrate, rhsval, hcofval)
945 ! -- dummy
946 class(gwesfetype) :: this
947 integer(I4B), intent(in) :: ientry
948 integer(I4B), intent(inout) :: n1
949 integer(I4B), intent(inout) :: igwfnode
950 real(DP), intent(inout), optional :: rrate
951 real(DP), intent(inout), optional :: rhsval
952 real(DP), intent(inout), optional :: hcofval
953 ! -- local
954 integer(I4B) :: auxpos
955 real(DP) :: wa !< wetted area
956 real(DP) :: ktf !< thermal conductivity of streambed material
957 real(DP) :: s !< thickness of conductive streambed material
958 real(DP) :: ctherm
959 !
960 rrate = dzero
961 n1 = this%flowbudptr%budterm(this%idxbudgwf)%id1(ientry)
962 ! -- use igwfnode instead of n2 for consistency with usage in apt;
963 ! helps highlight that cell number is sought and used
964 igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(ientry)
965 ! -- For now, there is only 1 aux variable under 'GWF'
966 auxpos = this%flowbudptr%budterm(this%idxbudgwf)%naux
967 wa = this%flowbudptr%budterm(this%idxbudgwf)%auxvar(auxpos, ientry)
968 ktf = this%ktf(n1)
969 s = this%rfeatthk(n1)
970 ctherm = ktf * wa / s
971 ! -- this%xnew available b/c set in parent class (TspAptType) using
972 ! routine set_pointers from the "grandparent" class BndType
973 if (present(rrate)) rrate = ctherm * (this%xnew(igwfnode) - this%xnewpak(n1))
974 if (present(rhsval)) rhsval = dzero
975 if (present(hcofval)) hcofval = ctherm
976 end subroutine sfe_sbcd_term
977
978 !> @brief Observations
979 !!
980 !! Store the observation type supported by the APT package and override
981 !! BndType%bnd_df_obs
982 !<
983 subroutine sfe_df_obs(this)
984 ! -- modules
985 ! -- dummy
986 class(gwesfetype) :: this
987 ! -- local
988 integer(I4B) :: indx
989 !
990 ! -- Store obs type and assign procedure pointer
991 ! for temperature observation type.
992 call this%obs%StoreObsType('temperature', .false., indx)
993 this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
994 !
995 ! -- Store obs type and assign procedure pointer
996 ! for flow between reaches.
997 call this%obs%StoreObsType('flow-ja-face', .true., indx)
998 this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid12
999 !
1000 ! -- Store obs type and assign procedure pointer
1001 ! for from-mvr observation type.
1002 call this%obs%StoreObsType('from-mvr', .true., indx)
1003 this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
1004 !
1005 ! -- Store obs type and assign procedure pointer
1006 ! for to-mvr observation type.
1007 call this%obs%StoreObsType('to-mvr', .true., indx)
1008 this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
1009 !
1010 ! -- Store obs type and assign procedure pointer
1011 ! for storage observation type.
1012 call this%obs%StoreObsType('storage', .true., indx)
1013 this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
1014 !
1015 ! -- Store obs type and assign procedure pointer
1016 ! for constant observation type.
1017 call this%obs%StoreObsType('constant', .true., indx)
1018 this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
1019 !
1020 ! -- Store obs type and assign procedure pointer
1021 ! for observation type: sfe
1022 call this%obs%StoreObsType('sfe', .true., indx)
1023 this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
1024 !
1025 ! -- Store obs type and assign procedure pointer
1026 ! for rainfall observation type.
1027 call this%obs%StoreObsType('rainfall', .true., indx)
1028 this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
1029 !
1030 ! -- Store obs type and assign procedure pointer
1031 ! for evaporation observation type.
1032 call this%obs%StoreObsType('evaporation', .true., indx)
1033 this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
1034 !
1035 ! -- Store obs type and assign procedure pointer
1036 ! for runoff observation type.
1037 call this%obs%StoreObsType('runoff', .true., indx)
1038 this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
1039 !
1040 ! -- Store obs type and assign procedure pointer
1041 ! for inflow observation type.
1042 call this%obs%StoreObsType('ext-inflow', .true., indx)
1043 this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
1044 !
1045 ! -- Store obs type and assign procedure pointer
1046 ! for ext-outflow observation type.
1047 call this%obs%StoreObsType('ext-outflow', .true., indx)
1048 this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
1049 !
1050 ! -- Store obs type and assign procedure pointer
1051 ! for strmbd-cond observation type.
1052 call this%obs%StoreObsType('strmbd-cond', .true., indx)
1053 this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
1054 end subroutine sfe_df_obs
1055
1056 !> @brief Process package specific obs
1057 !!
1058 !! Method to process specific observations for this package.
1059 !<
1060 subroutine sfe_rp_obs(this, obsrv, found)
1061 ! -- dummy
1062 class(gwesfetype), intent(inout) :: this !< package class
1063 type(observetype), intent(inout) :: obsrv !< observation object
1064 logical, intent(inout) :: found !< indicate whether observation was found
1065 ! -- local
1066 !
1067 found = .true.
1068 select case (obsrv%ObsTypeId)
1069 case ('RAINFALL')
1070 call this%rp_obs_byfeature(obsrv)
1071 case ('EVAPORATION')
1072 call this%rp_obs_byfeature(obsrv)
1073 case ('RUNOFF')
1074 call this%rp_obs_byfeature(obsrv)
1075 case ('EXT-INFLOW')
1076 call this%rp_obs_byfeature(obsrv)
1077 case ('EXT-OUTFLOW')
1078 call this%rp_obs_byfeature(obsrv)
1079 case ('TO-MVR')
1080 call this%rp_obs_byfeature(obsrv)
1081 case ('STRMBD-COND')
1082 call this%rp_obs_byfeature(obsrv)
1083 case default
1084 found = .false.
1085 end select
1086 end subroutine sfe_rp_obs
1087
1088 !> @brief Calculate observation value and pass it back to APT
1089 !<
1090 subroutine sfe_bd_obs(this, obstypeid, jj, v, found)
1091 ! -- dummy
1092 class(gwesfetype), intent(inout) :: this
1093 character(len=*), intent(in) :: obstypeid
1094 real(DP), intent(inout) :: v
1095 integer(I4B), intent(in) :: jj
1096 logical, intent(inout) :: found
1097 ! -- local
1098 integer(I4B) :: n1, n2
1099 !
1100 found = .true.
1101 select case (obstypeid)
1102 case ('RAINFALL')
1103 if (this%iboundpak(jj) /= 0) then
1104 call this%sfe_rain_term(jj, n1, n2, v)
1105 end if
1106 case ('EVAPORATION')
1107 if (this%iboundpak(jj) /= 0) then
1108 call this%sfe_evap_term(jj, n1, n2, v)
1109 end if
1110 case ('RUNOFF')
1111 if (this%iboundpak(jj) /= 0) then
1112 call this%sfe_roff_term(jj, n1, n2, v)
1113 end if
1114 case ('EXT-INFLOW')
1115 if (this%iboundpak(jj) /= 0) then
1116 call this%sfe_iflw_term(jj, n1, n2, v)
1117 end if
1118 case ('EXT-OUTFLOW')
1119 if (this%iboundpak(jj) /= 0) then
1120 call this%sfe_outf_term(jj, n1, n2, v)
1121 end if
1122 case ('STRMBD-COND')
1123 if (this%iboundpak(jj) /= 0) then
1124 call this%sfe_sbcd_term(jj, n1, n2, v)
1125 end if
1126 case default
1127 found = .false.
1128 end select
1129 end subroutine sfe_bd_obs
1130
1131 !> @brief Source SFE PACKAGEDATA, including thermal conduction fields.
1132 !<
1133 subroutine sfe_read_cvs(this)
1136 class(gwesfetype), intent(inout) :: this
1137 integer(I4B) :: n, ifeat
1138 real(DP), dimension(:), pointer, contiguous :: ktf_ptr => null()
1139 real(DP), dimension(:), pointer, contiguous :: rbthcnd_ptr => null()
1140 call this%TspAptType%apt_source_cvs()
1141 call mem_allocate(this%ktf, this%ncv, 'KTF', this%memoryPath)
1142 call mem_allocate(this%rfeatthk, this%ncv, 'RFEATTHK', this%memoryPath)
1143 call mem_setptr(ktf_ptr, 'KTF', this%input_mempath)
1144 call mem_setptr(rbthcnd_ptr, 'RBTHCND', this%input_mempath)
1145 do n = 1, size(this%pkg_ifno)
1146 ifeat = this%pkg_ifno(n)
1147 if (ifeat < 1 .or. ifeat > this%ncv) cycle
1148 this%ktf(ifeat) = ktf_ptr(n)
1149 this%rfeatthk(ifeat) = rbthcnd_ptr(n)
1150 if (this%rfeatthk(ifeat) <= dzero) then
1151 write (errmsg, '(4x,a)') &
1152 '****ERROR. Specified thickness used for thermal '// &
1153 'conduction MUST BE > 0 else divide by zero error occurs'
1154 call store_error(errmsg)
1155 end if
1156 end do
1157 if (count_errors() > 0) then
1158 call store_error_filename(this%input_fname)
1159 end if
1160 call memorystore_release('KTF', this%input_mempath)
1161 call memorystore_release('RBTHCND', this%input_mempath)
1162 end subroutine sfe_read_cvs
1163
1164 !> @brief Return the sfr new volume and old volume
1165 !<
1166 subroutine sfe_get_volumes(this, icv, vnew, vold, delt)
1167 ! -- dummy
1168 class(gwesfetype) :: this
1169 integer(I4B), intent(in) :: icv
1170 real(DP), intent(inout) :: vnew, vold
1171 real(DP), intent(in) :: delt
1172 ! -- local
1173 real(DP) :: qss
1174 !
1175 ! -- get volumes
1176 vold = dzero
1177 vnew = vold
1178 if (this%idxbudsto /= 0) then
1179 qss = this%flowbudptr%budterm(this%idxbudsto)%flow(icv)
1180 vnew = this%flowbudptr%budterm(this%idxbudsto)%auxvar(1, icv)
1181 this%vnew(icv) = vnew
1182 if (qss /= dzero) then
1183 vold = vnew + qss * delt
1184 else
1185 if (vnew == dzero) then
1186 vold = dzero
1187 else
1188 vold = this%vold(icv)
1189 end if
1190 end if
1191 end if
1192 end subroutine sfe_get_volumes
1193
1194end module gwesfemodule
This module contains the base boundary package.
subroutine bnd_da(this)
Deallocate package memory.
class(bndtype) function, pointer, public getbndfromlist(list, idx)
Get boundary from package list.
subroutine bnd_ad(this)
Advance the boundary package.
This module contains simulation constants.
Definition Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition Constants.f90:45
real(dp), parameter dnodata
real no data constant
Definition Constants.f90:95
real(dp), parameter dep20
real constant 1e20
Definition Constants.f90:91
integer(i4b), parameter lenvarname
maximum length of a variable name
Definition Constants.f90:17
integer(i4b), parameter lenboundname
maximum length of a bound name
Definition Constants.f90:36
real(dp), parameter dzero
real constant zero
Definition Constants.f90:65
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
Definition Constants.f90:37
real(dp), parameter done
real constant 1
Definition Constants.f90:76
subroutine sfe_bd_obs(this, obstypeid, jj, v, found)
Calculate observation value and pass it back to APT.
Definition gwe-sfe.f90:1091
character(len= *), parameter flowtype
Definition gwe-sfe.f90:61
real(dp) function sfe_setting_value(this, itemno, key)
Value for a package-specific PERIOD setting.
Definition gwe-sfe.f90:298
subroutine sfe_df_obs(this)
Observations.
Definition gwe-sfe.f90:984
subroutine allocate_scalars(this)
Allocate scalars specific to the streamflow energy transport (SFE) package.
Definition gwe-sfe.f90:683
subroutine sfe_setup_budobj(this, idx)
Set up the budget object that stores all the sfe flows.
Definition gwe-sfe.f90:493
integer(i4b) function sfe_get_nbudterms(this)
Function to return the number of budget terms just for this package.
Definition gwe-sfe.f90:475
subroutine sfe_checkin_deprecated_names(this)
Alias deprecated SFE variable names to their current storage.
Definition gwe-sfe.f90:740
subroutine sfe_outf_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Outflow term.
Definition gwe-sfe.f90:918
subroutine sfe_iflw_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Inflow Term.
Definition gwe-sfe.f90:891
character(len=16) text
Definition gwe-sfe.f90:62
subroutine sfe_rp_obs(this, obsrv, found)
Process package specific obs.
Definition gwe-sfe.f90:1061
subroutine sfe_fill_budobj(this, idx, x, flowja, ccratin, ccratout)
Copy flow terms into thisbudobj.
Definition gwe-sfe.f90:593
subroutine sfe_sbcd_term(this, ientry, n1, igwfnode, rrate, rhsval, hcofval)
Streambed conduction term.
Definition gwe-sfe.f90:945
subroutine sfe_rain_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Rain term.
Definition gwe-sfe.f90:814
subroutine sfe_get_volumes(this, icv, vnew, vold, delt)
Return the sfr new volume and old volume.
Definition gwe-sfe.f90:1167
subroutine sfe_evap_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Evaporative term.
Definition gwe-sfe.f90:838
character(len= *), parameter ftype
Definition gwe-sfe.f90:60
subroutine sfe_solve(this)
Add terms specific to sfr to the explicit sfe solve.
Definition gwe-sfe.f90:420
subroutine, public sfe_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath, fmi, eqnsclfac, gwecommon, dvt, dvu, dvua)
Create a new sfe package.
Definition gwe-sfe.f90:117
subroutine sfe_allocate_arrays(this)
Allocate arrays specific to the streamflow energy transport (SFE) package.
Definition gwe-sfe.f90:710
subroutine sfe_roff_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
Runoff term.
Definition gwe-sfe.f90:863
subroutine sfe_read_cvs(this)
Source SFE PACKAGEDATA, including thermal conduction fields.
Definition gwe-sfe.f90:1134
subroutine sfe_fc_expanded(this, rhs, ia, idxglo, matrix_sln)
Add matrix terms related to SFE.
Definition gwe-sfe.f90:323
subroutine sfe_da(this)
Deallocate memory.
Definition gwe-sfe.f90:782
subroutine sfe_ad(this)
Advance sfe package routine.
Definition gwe-sfe.f90:762
subroutine find_sfe_package(this)
Find corresponding sfe package.
Definition gwe-sfe.f90:179
This module defines variable data types.
Definition kind.f90:8
Previous variable names checked in as deprecated aliases.
subroutine, public memorystore_release(varname, memory_path)
Release a single variable from the memory store.
This module contains the derived types ObserveType and ObsDataType.
Definition Observe.f90:15
This module contains the SFR package methods.
Definition gwf-sfr.f90:7
This module contains simulation methods.
Definition Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition Sim.f90:94
integer(i4b) function, public count_errors()
Return number of errors.
Definition Sim.f90:60
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
Definition Sim.f90:208
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
integer(i4b) iout
file unit number for simulation output
subroutine apt_checkin_deprecated_names(this)
Alias deprecated advanced transport variable names.
Definition tsp-apt.f90:1192
subroutine pak_setup_budobj(this, idx)
Set up a budget object that stores an advanced package flows.
Definition tsp-apt.f90:1982
subroutine pak_fill_budobj(this, idx, x, flowja, ccratin, ccratout)
Copy flow terms into thisbudobj, must be overridden.
Definition tsp-apt.f90:2129
subroutine pak_bd_obs(this, obstypeid, jj, v, found)
Check if observation exists in an advanced package.
Definition tsp-apt.f90:2702
subroutine pak_fc_expanded(this, rhs, ia, idxglo, matrix_sln)
Advanced package transport fill coefficient (fc) method.
Definition tsp-apt.f90:830
subroutine apt_allocate_arrays(this)
Allocate arrays.
Definition tsp-apt.f90:1130
integer(i4b) function pak_get_nbudterms(this)
Function to return the number of budget terms just for this package.
Definition tsp-apt.f90:1783
real(dp) function apt_setting_value(this, itemno, key)
Virtual hook: value for a package-specific PERIOD setting. Override in individual packages to supply ...
Definition tsp-apt.f90:649
subroutine pak_rp_obs(this, obsrv, found)
Process package specific obs.
Definition tsp-apt.f90:2329
subroutine apt_get_volumes(this, icv, vnew, vold, delt)
Return the feature new volume and old volume.
Definition tsp-apt.f90:1759
subroutine apt_source_cvs(this)
Source PACKAGEDATA feature information from the input context.
Definition tsp-apt.f90:1446
subroutine find_apt_package(this)
Find corresponding advanced package transport package.
Definition tsp-apt.f90:1292
subroutine, public apt_process_obsid(obsrv, dis, inunitobs, iout)
Process observation IDs for an advanced package.
Definition tsp-apt.f90:2721
subroutine pak_solve(this)
Add terms specific to advanced package transport features to the explicit solve routine.
Definition tsp-apt.f90:1665
subroutine pak_df_obs(this)
Define apt observation type.
Definition tsp-apt.f90:2314
subroutine, public apt_process_obsid12(obsrv, dis, inunitobs, iout)
Process observation IDs for a package.
Definition tsp-apt.f90:2764
This class is used to store a single deferred-length character string. It was designed to work in an ...
Data for sharing among multiple packages. Originally read in from.