46 character(len=LENFTYPE) ::
ftype =
'SFR'
47 character(len=LENPACKAGENAME) ::
text =
' SFR'
57 character(len=16),
dimension(:),
pointer,
contiguous :: csfrbudget => null()
58 character(len=16),
dimension(:),
pointer,
contiguous :: cauxcbc => null()
59 character(len=LENBOUNDNAME),
dimension(:),
pointer, &
60 contiguous :: sfrname => null()
62 integer(I4B),
pointer :: istorage => null()
63 integer(I4B),
pointer :: iprhed => null()
64 integer(I4B),
pointer :: istageout => null()
65 integer(I4B),
pointer :: ibudgetout => null()
66 integer(I4B),
pointer :: ibudcsv => null()
67 integer(I4B),
pointer :: ipakcsv => null()
68 integer(I4B),
pointer :: idiversions => null()
69 integer(I4B),
pointer :: nconn => null()
70 integer(I4B),
pointer :: maxsfrpicard => null()
71 integer(I4B),
pointer :: maxsfrit => null()
72 integer(I4B),
pointer :: bditems => null()
73 integer(I4B),
pointer :: cbcauxitems => null()
74 integer(I4B),
pointer :: icheck => null()
75 integer(I4B),
pointer :: iconvchk => null()
76 integer(I4B),
pointer :: gwfiss => null()
77 integer(I4B),
pointer :: ianynone => null()
79 real(dp),
pointer :: unitconv => null()
80 real(dp),
pointer :: lengthconv => null()
81 real(dp),
pointer :: timeconv => null()
82 real(dp),
pointer :: dmaxchg => null()
83 real(dp),
pointer :: deps => null()
84 real(dp),
pointer :: storage_weight => null()
86 integer(I4B),
dimension(:),
pointer,
contiguous :: isfrorder => null()
87 integer(I4B),
dimension(:),
pointer,
contiguous :: ia => null()
88 integer(I4B),
dimension(:),
pointer,
contiguous :: ja => null()
90 real(dp),
dimension(:),
pointer,
contiguous :: qoutflow => null()
91 real(dp),
dimension(:),
pointer,
contiguous :: qextoutflow => null()
92 real(dp),
dimension(:),
pointer,
contiguous :: qauxcbc => null()
93 real(dp),
dimension(:),
pointer,
contiguous :: dbuff => null()
104 integer(I4B),
dimension(:),
pointer,
contiguous :: iboundpak => null()
105 integer(I4B),
dimension(:),
pointer,
contiguous :: igwfnode => null()
106 integer(I4B),
dimension(:),
pointer,
contiguous :: igwftopnode => null()
107 real(dp),
dimension(:),
pointer,
contiguous :: length => null()
108 real(dp),
dimension(:),
pointer,
contiguous :: width => null()
109 real(dp),
dimension(:),
pointer,
contiguous :: strtop => null()
110 real(dp),
dimension(:),
pointer,
contiguous :: bthick => null()
111 real(dp),
dimension(:),
pointer,
contiguous :: hk => null()
112 real(dp),
dimension(:),
pointer,
contiguous :: slope => null()
113 integer(I4B),
dimension(:),
pointer,
contiguous :: nconnreach => null()
114 real(dp),
dimension(:),
pointer,
contiguous :: ustrf => null()
115 real(dp),
dimension(:),
pointer,
contiguous :: ftotnd => null()
116 integer(I4B),
dimension(:),
pointer,
contiguous :: ndiv => null()
117 real(dp),
dimension(:),
pointer,
contiguous :: usflow => null()
118 real(dp),
dimension(:),
pointer,
contiguous :: dsflow => null()
119 real(dp),
dimension(:),
pointer,
contiguous :: dsflowold => null()
120 real(dp),
dimension(:),
pointer,
contiguous :: usinflow => null()
121 real(dp),
dimension(:),
pointer,
contiguous :: usinflowold => null()
122 real(dp),
pointer :: ats_courant => null()
123 integer(I4B),
dimension(:),
pointer,
contiguous :: itvd_upstream => null()
124 real(dp),
dimension(:),
pointer,
contiguous :: crmin => null()
125 real(dp),
dimension(:),
pointer,
contiguous :: crmax => null()
126 real(dp),
dimension(:),
pointer,
contiguous :: crsum => null()
127 integer(I4B),
dimension(:),
pointer,
contiguous :: crcnt => null()
128 real(dp),
dimension(:),
pointer,
contiguous :: depth => null()
129 real(dp),
dimension(:),
pointer,
contiguous :: stage => null()
130 real(dp),
dimension(:),
pointer,
contiguous :: stageold => null()
131 real(dp),
dimension(:),
pointer,
contiguous :: gwflow => null()
132 real(dp),
dimension(:),
pointer,
contiguous :: simevap => null()
133 real(dp),
dimension(:),
pointer,
contiguous :: simrunoff => null()
134 real(dp),
dimension(:),
pointer,
contiguous :: stage0 => null()
135 real(dp),
dimension(:),
pointer,
contiguous :: usflow0 => null()
136 real(dp),
dimension(:),
pointer,
contiguous :: storage => null()
138 integer(I4B),
pointer :: ncrossptstot => null()
139 integer(I4B),
dimension(:),
pointer,
contiguous :: ncrosspts => null()
140 integer(I4B),
dimension(:),
pointer,
contiguous :: iacross => null()
141 real(dp),
dimension(:),
pointer,
contiguous :: station => null()
142 real(dp),
dimension(:),
pointer,
contiguous :: xsheight => null()
143 real(dp),
dimension(:),
pointer,
contiguous :: xsrough => null()
145 integer(I4B),
dimension(:),
pointer,
contiguous :: idir => null()
146 integer(I4B),
dimension(:),
pointer,
contiguous :: idiv => null()
147 real(dp),
dimension(:),
pointer,
contiguous :: qconn => null()
149 real(dp),
dimension(:),
pointer,
contiguous :: rough => null()
150 real(dp),
dimension(:),
pointer,
contiguous :: rain => null()
151 real(dp),
dimension(:),
pointer,
contiguous :: evap => null()
152 real(dp),
dimension(:),
pointer,
contiguous :: inflow => null()
153 real(dp),
dimension(:),
pointer,
contiguous :: runoff => null()
154 real(dp),
dimension(:),
pointer,
contiguous :: sstage => null()
156 real(dp),
dimension(:, :),
pointer,
contiguous :: rauxvar => null()
158 integer(I4B),
dimension(:),
pointer,
contiguous :: iadiv => null()
159 integer(I4B),
dimension(:),
pointer,
contiguous :: divreach => null()
160 character(len=10),
dimension(:),
pointer,
contiguous :: divcprior => null()
161 real(dp),
dimension(:),
pointer,
contiguous :: divflow => null()
162 real(dp),
dimension(:),
pointer,
contiguous :: divq => null()
165 integer(I4B),
pointer :: idense
166 real(dp),
dimension(:, :),
pointer,
contiguous :: denseterms => null()
169 real(dp),
dimension(:, :),
pointer,
contiguous :: viscratios => null()
201 procedure,
private :: sfr_calc_constant
202 procedure,
private :: sfr_calc_transient
203 procedure,
private :: sfr_calc_tvd
205 procedure,
private :: sfr_calc_steady
252 module subroutine sfr_calc_steady(this, n, d1, hgwf, &
253 qu, qi, qfrommvr, qr, qe, qro, &
255 class(sfrtype) :: this
256 integer(I4B),
intent(in) :: n
257 real(dp),
intent(inout) :: d1
258 real(dp),
intent(in) :: hgwf
259 real(dp),
intent(in) :: qu
260 real(dp),
intent(in) :: qi
261 real(dp),
intent(in) :: qfrommvr
262 real(dp),
intent(in) :: qr
263 real(dp),
intent(in) :: qe
264 real(dp),
intent(in) :: qro
265 real(dp),
intent(inout) :: qgwf
266 real(dp),
intent(inout) :: qd
271 module subroutine sfr_calc_transient(this, n, d1, hgwf, &
272 qu, qi, qfrommvr, qr, qe, qro, &
274 class(sfrtype) :: this
275 integer(I4B),
intent(in) :: n
276 real(dp),
intent(inout) :: d1
277 real(dp),
intent(in) :: hgwf
278 real(dp),
intent(in) :: qu
279 real(dp),
intent(in) :: qi
280 real(dp),
intent(in) :: qfrommvr
281 real(dp),
intent(in) :: qr
282 real(dp),
intent(in) :: qe
283 real(dp),
intent(in) :: qro
284 real(dp),
intent(inout) :: qgwf
285 real(dp),
intent(inout) :: qd
290 module subroutine sfr_calc_tvd(this, n, d1, hgwf, &
291 qu, qi, qfrommvr, qr, qe, qro, &
293 class(sfrtype) :: this
294 integer(I4B),
intent(in) :: n
295 real(dp),
intent(inout) :: d1
296 real(dp),
intent(in) :: hgwf
297 real(dp),
intent(in) :: qu
298 real(dp),
intent(in) :: qi
299 real(dp),
intent(in) :: qfrommvr
300 real(dp),
intent(in) :: qr
301 real(dp),
intent(in) :: qe
302 real(dp),
intent(in) :: qro
303 real(dp),
intent(inout) :: qgwf
304 real(dp),
intent(inout) :: qd
309 module subroutine sfr_calc_constant(this, n, d1, hgwf, qgwf, qd)
310 class(sfrtype) :: this
311 integer(I4B),
intent(in) :: n
312 real(dp),
intent(inout) :: d1
313 real(dp),
intent(in) :: hgwf
314 real(dp),
intent(inout) :: qgwf
315 real(dp),
intent(inout) :: qd
325 subroutine sfr_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname)
329 class(
bndtype),
pointer :: packobj
330 integer(I4B),
intent(in) :: id
331 integer(I4B),
intent(in) :: ibcnum
332 integer(I4B),
intent(in) :: inunit
333 integer(I4B),
intent(in) :: iout
334 character(len=*),
intent(in) :: namemodel
335 character(len=*),
intent(in) :: pakname
337 type(sfrtype),
pointer :: sfrobj
344 call packobj%set_names(ibcnum, namemodel, pakname, ftype)
348 call sfrobj%sfr_allocate_scalars()
351 call packobj%pack_initialize()
353 packobj%inunit = inunit
356 packobj%ibcnum = ibcnum
361 end subroutine sfr_create
368 subroutine sfr_allocate_scalars(this)
373 class(sfrtype),
intent(inout) :: this
376 call this%BndType%allocate_scalars()
379 call mem_allocate(this%ats_courant,
'ATS_COURANT', this%memoryPath)
380 call mem_allocate(this%istorage,
'ISTORAGE', this%memoryPath)
381 call mem_allocate(this%iprhed,
'IPRHED', this%memoryPath)
382 call mem_allocate(this%istageout,
'ISTAGEOUT', this%memoryPath)
383 call mem_allocate(this%ibudgetout,
'IBUDGETOUT', this%memoryPath)
384 call mem_allocate(this%ibudcsv,
'IBUDCSV', this%memoryPath)
385 call mem_allocate(this%ipakcsv,
'IPAKCSV', this%memoryPath)
386 call mem_allocate(this%idiversions,
'IDIVERSIONS', this%memoryPath)
387 call mem_allocate(this%maxsfrpicard,
'MAXSFRPICARD', this%memoryPath)
388 call mem_allocate(this%maxsfrit,
'MAXSFRIT', this%memoryPath)
389 call mem_allocate(this%bditems,
'BDITEMS', this%memoryPath)
390 call mem_allocate(this%cbcauxitems,
'CBCAUXITEMS', this%memoryPath)
391 call mem_allocate(this%unitconv,
'UNITCONV', this%memoryPath)
392 call mem_allocate(this%lengthconv,
'LENGTHCONV', this%memoryPath)
393 call mem_allocate(this%timeconv,
'TIMECONV', this%memoryPath)
394 call mem_allocate(this%dmaxchg,
'DMAXCHG', this%memoryPath)
396 call mem_allocate(this%storage_weight,
'STORAGE_WEIGHT', this%memoryPath)
398 call mem_allocate(this%icheck,
'ICHECK', this%memoryPath)
399 call mem_allocate(this%iconvchk,
'ICONVCHK', this%memoryPath)
400 call mem_allocate(this%idense,
'IDENSE', this%memoryPath)
401 call mem_allocate(this%ianynone,
'IANYNONE', this%memoryPath)
402 call mem_allocate(this%ncrossptstot,
'NCROSSPTSTOT', this%memoryPath)
415 this%maxsfrpicard = 100
423 this%deps =
dp999 * this%dmaxchg
432 this%ncrossptstot = 0
433 end subroutine sfr_allocate_scalars
439 subroutine sfr_allocate_arrays(this)
443 class(sfrtype),
intent(inout) :: this
449 allocate (this%csfrbudget(this%bditems))
451 'SFRNAME', this%memoryPath)
454 call mem_allocate(this%iboundpak, this%maxbound,
'IBOUNDPAK', &
456 call mem_allocate(this%igwfnode, this%maxbound,
'IGWFNODE', this%memoryPath)
457 call mem_allocate(this%igwftopnode, this%maxbound,
'IGWFTOPNODE', &
459 call mem_allocate(this%length, this%maxbound,
'LENGTH', this%memoryPath)
460 call mem_allocate(this%width, this%maxbound,
'WIDTH', this%memoryPath)
461 call mem_allocate(this%strtop, this%maxbound,
'STRTOP', this%memoryPath)
462 call mem_allocate(this%bthick, this%maxbound,
'BTHICK', this%memoryPath)
463 call mem_allocate(this%hk, this%maxbound,
'HK', this%memoryPath)
464 call mem_allocate(this%slope, this%maxbound,
'SLOPE', this%memoryPath)
465 call mem_allocate(this%nconnreach, this%maxbound,
'NCONNREACH', &
467 call mem_allocate(this%ustrf, this%maxbound,
'USTRF', this%memoryPath)
468 call mem_allocate(this%ftotnd, this%maxbound,
'FTOTND', this%memoryPath)
469 call mem_allocate(this%ndiv, this%maxbound,
'NDIV', this%memoryPath)
470 call mem_allocate(this%usflow, this%maxbound,
'USFLOW', this%memoryPath)
471 call mem_allocate(this%dsflow, this%maxbound,
'DSFLOW', this%memoryPath)
472 call mem_allocate(this%depth, this%maxbound,
'DEPTH', this%memoryPath)
473 call mem_allocate(this%stage, this%maxbound,
'STAGE', this%memoryPath)
474 call mem_allocate(this%gwflow, this%maxbound,
'GWFLOW', this%memoryPath)
475 call mem_allocate(this%simevap, this%maxbound,
'SIMEVAP', this%memoryPath)
476 call mem_allocate(this%simrunoff, this%maxbound,
'SIMRUNOFF', &
478 call mem_allocate(this%stage0, this%maxbound,
'STAGE0', this%memoryPath)
479 call mem_allocate(this%usflow0, this%maxbound,
'USFLOW0', this%memoryPath)
482 if (this%istorage == 1)
then
483 call mem_allocate(this%stageold, this%maxbound,
'STAGEOLD', &
485 call mem_allocate(this%usinflow, this%maxbound,
'USINFLOW', &
487 call mem_allocate(this%usinflowold, this%maxbound,
'USINFLOWOLD', &
489 call mem_allocate(this%dsflowold, this%maxbound,
'DSFLOWOLD', &
491 call mem_allocate(this%storage, this%maxbound,
'STORAGE', &
493 call mem_allocate(this%crmin, this%maxbound,
'CRMIN', this%memoryPath)
494 call mem_allocate(this%crmax, this%maxbound,
'CRMAX', this%memoryPath)
495 call mem_allocate(this%crsum, this%maxbound,
'CRSUM', this%memoryPath)
496 call mem_allocate(this%crcnt, this%maxbound,
'CRCNT', this%memoryPath)
497 if (this%ats_courant /=
dnodata)
then
499 'ITVD_UPSTREAM', this%memoryPath)
501 call mem_allocate(this%itvd_upstream, 0,
'ITVD_UPSTREAM', this%memoryPath)
506 call mem_allocate(this%isfrorder, this%maxbound,
'ISFRORDER', &
508 call mem_allocate(this%ia, this%maxbound + 1,
'IA', this%memoryPath)
510 call mem_allocate(this%idir, 0,
'IDIR', this%memoryPath)
511 call mem_allocate(this%idiv, 0,
'IDIV', this%memoryPath)
512 call mem_allocate(this%qconn, 0,
'QCONN', this%memoryPath)
515 call mem_allocate(this%rough, this%maxbound,
'ROUGH', this%memoryPath)
516 call mem_allocate(this%rain, this%maxbound,
'RAIN', this%memoryPath)
517 call mem_allocate(this%evap, this%maxbound,
'EVAP', this%memoryPath)
518 call mem_allocate(this%inflow, this%maxbound,
'INFLOW', this%memoryPath)
519 call mem_allocate(this%runoff, this%maxbound,
'RUNOFF', this%memoryPath)
520 call mem_allocate(this%sstage, this%maxbound,
'SSTAGE', this%memoryPath)
523 call mem_allocate(this%rauxvar, this%naux, this%maxbound, &
524 'RAUXVAR', this%memoryPath)
527 call mem_allocate(this%iadiv, this%maxbound + 1,
'IADIV', this%memoryPath)
528 call mem_allocate(this%divreach, 0,
'DIVREACH', this%memoryPath)
529 call mem_allocate(this%divflow, 0,
'DIVFLOW', this%memoryPath)
530 call mem_allocate(this%divq, 0,
'DIVQ', this%memoryPath)
533 call mem_allocate(this%ncrosspts, this%maxbound,
'NCROSSPTS', &
535 call mem_allocate(this%iacross, this%maxbound + 1,
'IACROSS', &
537 call mem_allocate(this%station, this%ncrossptstot,
'STATION', &
539 call mem_allocate(this%xsheight, this%ncrossptstot,
'XSHEIGHT', &
541 call mem_allocate(this%xsrough, this%ncrossptstot,
'XSROUGH', &
546 do i = 1, this%maxbound
547 this%iboundpak(i) = 1
549 this%igwftopnode(i) = 0
550 this%length(i) =
dzero
551 this%width(i) =
dzero
552 this%strtop(i) =
dzero
553 this%bthick(i) =
dzero
555 this%slope(i) =
dzero
556 this%nconnreach(i) = 0
557 this%ustrf(i) =
dzero
558 this%ftotnd(i) =
dzero
560 this%usflow(i) =
dzero
561 this%dsflow(i) =
dzero
562 this%depth(i) =
dzero
563 this%stage(i) =
dzero
564 this%gwflow(i) =
dzero
565 this%simevap(i) =
dzero
566 this%simrunoff(i) =
dzero
567 this%stage0(i) =
dzero
568 this%usflow0(i) =
dzero
571 if (this%istorage == 1)
then
572 this%stageold(i) =
dzero
573 this%usinflow(i) =
dzero
574 this%usinflowold(i) =
dzero
575 this%dsflowold(i) =
dzero
576 this%storage(i) =
dzero
577 this%crmin(i) =
dep20
578 this%crmax(i) = -
dep20
579 this%crsum(i) =
dzero
581 if (this%ats_courant /=
dnodata)
then
582 this%itvd_upstream(i) = 0
587 this%rough(i) =
dzero
590 this%inflow(i) =
dzero
591 this%runoff(i) =
dzero
592 this%sstage(i) =
dzero
596 this%rauxvar(j, i) =
dzero
600 this%ncrosspts(i) = 0
601 this%iacross(i + 1) = 0
605 do i = 1, this%ncrossptstot
606 this%station(i) =
dzero
607 this%xsheight(i) =
dzero
608 this%xsrough(i) =
dzero
612 this%csfrbudget(1) =
' RAINFALL'
613 this%csfrbudget(2) =
' EVAPORATION'
614 this%csfrbudget(3) =
' RUNOFF'
615 this%csfrbudget(4) =
' EXT-INFLOW'
616 this%csfrbudget(5) =
' GWF'
617 this%csfrbudget(6) =
' EXT-OUTFLOW'
618 this%csfrbudget(7) =
' FROM-MVR'
619 this%csfrbudget(8) =
' TO-MVR'
622 call mem_allocate(this%qoutflow, this%maxbound,
'QOUTFLOW', this%memoryPath)
623 call mem_allocate(this%qextoutflow, this%maxbound,
'QEXTOUTFLOW', &
625 do i = 1, this%maxbound
626 this%qoutflow(i) =
dzero
627 this%qextoutflow(i) =
dzero
631 if (this%istageout > 0)
then
632 call mem_allocate(this%dbuff, this%maxbound,
'DBUFF', this%memoryPath)
633 do i = 1, this%maxbound
634 this%dbuff(i) =
dzero
637 call mem_allocate(this%dbuff, 0,
'DBUFF', this%memoryPath)
641 allocate (this%cauxcbc(this%cbcauxitems))
644 call mem_allocate(this%qauxcbc, this%cbcauxitems,
'QAUXCBC', &
646 do i = 1, this%cbcauxitems
647 this%qauxcbc(i) =
dzero
651 this%cauxcbc(1) =
'FLOW-AREA '
654 call mem_allocate(this%denseterms, 3, 0,
'DENSETERMS', this%memoryPath)
657 call mem_allocate(this%viscratios, 2, 0,
'VISCRATIOS', this%memoryPath)
658 end subroutine sfr_allocate_arrays
664 subroutine sfr_read_dimensions(this)
666 class(sfrtype),
intent(inout) :: this
668 character(len=LINELENGTH) :: keyword
670 logical(LGP) :: isfound
671 logical(LGP) :: endOfBlock
677 call this%parser%GetBlock(
'DIMENSIONS', isfound, ierr, &
678 supportopenclose=.true.)
682 write (this%iout,
'(/1x,a)') &
683 'PROCESSING '//trim(adjustl(this%text))//
' DIMENSIONS'
685 call this%parser%GetNextLine(endofblock)
687 call this%parser%GetStringCaps(keyword)
688 select case (keyword)
690 this%maxbound = this%parser%GetInteger()
691 write (this%iout,
'(4x,a,i0)')
'NREACHES = ', this%maxbound
694 'Unknown '//trim(this%text)//
' dimension: ', trim(keyword)
698 write (this%iout,
'(1x,a)') &
699 'END OF '//trim(adjustl(this%text))//
' DIMENSIONS'
701 call store_error(
'Required dimensions block not found.')
705 if (this%maxbound < 1)
then
707 'NREACHES was not specified or was specified incorrectly.'
713 call this%parser%StoreErrorUnit()
718 call this%define_listlabel()
721 this%ncrossptstot = this%maxbound
724 call this%sfr_allocate_arrays()
727 call this%sfr_read_packagedata()
730 call this%sfr_read_crossection()
733 call this%sfr_read_connectiondata()
736 call this%sfr_read_diversions()
739 call this%sfr_read_initial_stages()
742 call this%sfr_setup_budobj()
745 call this%sfr_setup_tableobj()
746 end subroutine sfr_read_dimensions
752 subroutine sfr_options(this, option, found)
757 class(sfrtype),
intent(inout) :: this
758 character(len=*),
intent(inout) :: option
759 logical(LGP),
intent(inout) :: found
762 character(len=MAXCHARLEN) :: fname
763 character(len=MAXCHARLEN) :: keyword
765 character(len=*),
parameter :: fmttimeconv = &
766 &
"(4x, 'TIME CONVERSION VALUE (',g0,') SPECIFIED.')"
767 character(len=*),
parameter :: fmtlengthconv = &
768 &
"(4x, 'LENGTH CONVERSION VALUE (',g0,') SPECIFIED.')"
769 character(len=*),
parameter :: fmtpicard = &
770 &
"(4x, 'MAXIMUM SFR PICARD ITERATION VALUE (',i0,') SPECIFIED.')"
771 character(len=*),
parameter :: fmtiter = &
772 &
"(4x, 'MAXIMUM SFR ITERATION VALUE (',i0,') SPECIFIED.')"
773 character(len=*),
parameter :: fmtdmaxchg = &
774 &
"(4x, 'MAXIMUM DEPTH CHANGE VALUE (',g0,') SPECIFIED.')"
775 character(len=*),
parameter :: fmtsfrbin = &
776 "(4x, 'SFR ', 1x, a, 1x, ' WILL BE SAVED TO FILE: ', a, /4x, &
777 &'OPENED ON UNIT: ', I0)"
778 character(len=*),
parameter :: fmtstoweight = &
779 &
"(4x, 'KINEMATIC STORAGE WEIGHT (',g0,') SPECIFIED.')"
786 write (this%iout,
'(4x,a)') trim(adjustl(this%text))// &
787 ' REACH STORAGE IS ACTIVE.'
790 write (this%iout,
'(4x,a)') trim(adjustl(this%text))// &
791 ' STAGES WILL BE PRINTED TO LISTING FILE.'
793 call this%parser%GetStringCaps(keyword)
794 if (keyword ==
'FILEOUT')
then
795 call this%parser%GetString(fname)
797 call openfile(this%istageout, this%iout, fname,
'DATA(BINARY)', &
799 write (this%iout, fmtsfrbin) &
800 'STAGE', trim(adjustl(fname)), this%istageout
803 &be followed by fileout.')
806 call this%parser%GetStringCaps(keyword)
807 if (keyword ==
'FILEOUT')
then
808 call this%parser%GetString(fname)
809 call assign_iounit(this%ibudgetout, this%inunit,
"BUDGET fileout")
810 call openfile(this%ibudgetout, this%iout, fname,
'DATA(BINARY)', &
812 write (this%iout, fmtsfrbin) &
813 'BUDGET', trim(adjustl(fname)), this%ibudgetout
815 call store_error(
'Optional budget keyword must be '// &
816 'followed by fileout.')
819 call this%parser%GetStringCaps(keyword)
820 if (keyword ==
'FILEOUT')
then
821 call this%parser%GetString(fname)
822 call assign_iounit(this%ibudcsv, this%inunit,
"BUDGETCSV fileout")
823 call openfile(this%ibudcsv, this%iout, fname,
'CSV', &
824 filstat_opt=
'REPLACE')
825 write (this%iout, fmtsfrbin) &
826 'BUDGET CSV', trim(adjustl(fname)), this%ibudcsv
828 call store_error(
'OPTIONAL BUDGETCSV KEYWORD MUST BE FOLLOWED BY &
831 case (
'PACKAGE_CONVERGENCE')
832 call this%parser%GetStringCaps(keyword)
833 if (keyword ==
'FILEOUT')
then
834 call this%parser%GetString(fname)
836 call openfile(this%ipakcsv, this%iout, fname,
'CSV', &
837 filstat_opt=
'REPLACE', mode_opt=
mnormal)
838 write (this%iout, fmtsfrbin) &
839 'PACKAGE_CONVERGENCE', trim(adjustl(fname)), this%ipakcsv
841 call store_error(
'Optional package_convergence keyword must be '// &
842 'followed by fileout.')
844 case (
'UNIT_CONVERSION')
845 this%unitconv = this%parser%GetDouble()
849 'SETTING UNIT_CONVERSION DIRECTLY'
853 warnmsg, this%parser%GetUnit())
854 case (
'LENGTH_CONVERSION')
855 this%lengthconv = this%parser%GetDouble()
856 write (this%iout, fmtlengthconv) this%lengthconv
857 case (
'TIME_CONVERSION')
858 this%timeconv = this%parser%GetDouble()
859 write (this%iout, fmttimeconv) this%timeconv
860 case (
'MAXIMUM_PICARD_ITERATIONS')
861 this%maxsfrpicard = this%parser%GetInteger()
862 write (this%iout, fmtpicard) this%maxsfrpicard
863 case (
'MAXIMUM_ITERATIONS')
864 this%maxsfrit = this%parser%GetInteger()
865 write (this%iout, fmtiter) this%maxsfrit
866 case (
'MAXIMUM_DEPTH_CHANGE')
867 r = this%parser%GetDouble()
869 this%deps =
dp999 * r
870 write (this%iout, fmtdmaxchg) this%dmaxchg
873 write (this%iout,
'(4x,A)')
'MOVER OPTION ENABLED'
880 this%ats_courant = this%parser%GetDouble()
881 if (this%ats_courant <=
dzero)
then
882 write (
errmsg,
'(a,g0,a)') &
883 "ATS_COURANT SPECIFIED TO BE '", this%ats_courant, &
884 "' BUT MUST BE GREATER THAN ZERO"
887 write (this%iout,
'(4x,a,1pg15.6)') &
888 'TARGET COURANT NUMBER FOR ADAPTIVE TIME STEPS: ', &
891 case (
'DEV_NO_CHECK')
892 call this%parser%DevOpt()
894 write (this%iout,
'(4x,A)')
'SFR CHECKS OF REACH GEOMETRY '// &
895 'RELATIVE TO MODEL GRID AND '// &
896 'REASONABLE PARAMETERS WILL NOT '// &
898 case (
'DEV_NO_FINAL_CHECK')
899 call this%parser%DevOpt()
901 write (this%iout,
'(4x,a)') &
902 'A FINAL CONVERGENCE CHECK OF THE CHANGE IN STREAM FLOW ROUTING &
903 &STAGES AND FLOWS WILL NOT BE MADE'
904 case (
'DEV_STORAGE_WEIGHT')
905 call this%parser%DevOpt()
906 r = this%parser%GetDouble()
908 write (
errmsg,
'(a,g0,a)') &
909 "STORAGE_WEIGHT SPECIFIED TO BE '", r, &
910 "' BUT CANNOT BE LESS THAN 0.5 OR GREATER THAN 1.0"
913 this%storage_weight = r
914 write (this%iout, fmtstoweight) this%storage_weight
923 end subroutine sfr_options
929 subroutine sfr_ar(this)
933 class(sfrtype),
intent(inout) :: this
939 call this%obs%obs_ar()
942 call this%BndType%allocate_arrays()
945 if (this%inamedbound /= 0)
then
946 do n = 1, this%maxbound
947 this%boundname(n) = this%sfrname(n)
952 call this%copy_boundname()
955 do n = 1, this%maxbound
956 this%nodelist(n) = this%igwfnode(n)
960 call this%sfr_check_conversion()
963 call this%sfr_check_storage_weight()
966 if (this%ats_courant /=
dnodata .and. this%istorage /= 1)
then
968 'ATS_COURANT OPTION REQUIRES STORAGE OPTION TO BE ACTIVE'
975 'ATS_COURANT IS SPECIFIED IN THE SFR OPTIONS BLOCK BUT THE '// &
976 'ATS PACKAGE IS NOT ACTIVE IN TDIS, SO THE TIME STEP IS NOT '// &
977 'ADAPTED TO THE COURANT NUMBER. IF THE COURANT NUMBER EXCEEDS 1 '// &
978 'THE EXPLICIT KINEMATIC-WAVE ROUTING MAY OSCILLATE WHILE STILL '// &
979 'CLOSING THE BUDGET. ACTIVATE THE ATS PACKAGE OR USE A SMALLER '// &
985 if (this%ats_courant /=
dnodata .and. this%istorage == 1)
then
986 call this%sfr_precompute_tvd()
990 call this%sfr_check_reaches()
993 call this%sfr_check_connections()
996 if (this%idiversions /= 0)
then
997 call this%sfr_check_diversions()
1001 if (this%istorage == 1)
then
1002 call this%sfr_check_initialstages()
1008 call this%parser%StoreErrorUnit()
1012 if (this%imover /= 0)
then
1013 allocate (this%pakmvrobj)
1014 call this%pakmvrobj%ar(this%maxbound, this%maxbound, this%memoryPath)
1016 end subroutine sfr_ar
1022 subroutine sfr_read_packagedata(this)
1026 class(sfrtype),
intent(inout) :: this
1028 character(len=LINELENGTH) :: text
1029 character(len=LINELENGTH) :: cellid
1030 character(len=10) :: cnum
1031 character(len=LENBOUNDNAME) :: bndName
1032 character(len=LENBOUNDNAME) :: bndNameTemp
1033 character(len=LENBOUNDNAME) :: hkname
1034 character(len=LENBOUNDNAME) :: manningname
1035 character(len=LENBOUNDNAME) :: ustrfname
1036 character(len=50),
dimension(:),
allocatable :: caux
1037 integer(I4B) :: n, ierr, ival
1038 logical(LGP) :: isfound
1039 logical(LGP) :: endOfBlock
1043 integer(I4B) :: iaux
1044 integer(I4B) :: nconzero
1045 integer(I4B) :: ipos
1046 integer,
allocatable,
dimension(:) :: nboundchk
1047 real(DP),
pointer :: bndElem => null()
1050 allocate (nboundchk(this%maxbound))
1051 do i = 1, this%maxbound
1057 if (this%naux > 0)
then
1058 allocate (caux(this%naux))
1062 call this%parser%GetBlock(
'PACKAGEDATA', isfound, ierr, &
1063 supportopenclose=.true.)
1067 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text))// &
1070 call this%parser%GetNextLine(endofblock)
1071 if (endofblock)
exit
1073 n = this%parser%GetInteger()
1075 if (n < 1 .or. n > this%maxbound)
then
1076 write (
errmsg,
'(a,1x,a,1x,i0)') &
1077 'Reach number (rno) must be greater than 0 and less', &
1078 'than or equal to', this%maxbound
1084 nboundchk(n) = nboundchk(n) + 1
1087 call this%parser%GetCellid(this%dis%ndim, cellid, flag_string=.true.)
1088 this%igwfnode(n) = this%dis%noder_from_cellid(cellid, this%inunit, &
1090 flag_string=.true., &
1092 this%igwftopnode(n) = this%igwfnode(n)
1095 if (this%igwfnode(n) < 1)
then
1096 this%ianynone = this%ianynone + 1
1098 if (cellid ==
'NONE')
then
1099 call this%parser%GetStringCaps(cellid)
1102 write (cnum,
'(i0)') n
1103 warnmsg =
'CELLID for unconnected reach '//trim(cnum)// &
1104 ' specified to be NONE. Unconnected reaches '// &
1105 'should be specified with a zero for each grid '// &
1106 'dimension. For example, for a DIS grid a CELLID '// &
1107 'of 0 0 0 should be specified for unconnected reaches'
1111 warnmsg, this%parser%GetUnit())
1117 this%length(n) = this%parser%GetDouble()
1119 this%width(n) = this%parser%GetDouble()
1121 this%slope(n) = this%parser%GetDouble()
1123 this%strtop(n) = this%parser%GetDouble()
1125 this%bthick(n) = this%parser%GetDouble()
1127 call this%parser%GetStringCaps(hkname)
1129 call this%parser%GetStringCaps(manningname)
1131 ival = this%parser%GetInteger()
1132 this%nconnreach(n) = ival
1133 this%nconn = this%nconn + ival
1135 write (
errmsg,
'(a,1x,i0,1x,a,i0,a)') &
1136 'NCON for reach', n, &
1137 'must be greater than or equal to 0 (', ival,
').'
1139 else if (ival == 0)
then
1140 nconzero = nconzero + 1
1143 call this%parser%GetString(ustrfname)
1145 ival = this%parser%GetInteger()
1148 this%idiversions = 1
1149 else if (ival < 0)
then
1154 do iaux = 1, this%naux
1155 call this%parser%GetString(caux(iaux))
1159 write (cnum,
'(i10.10)') n
1160 bndname =
'Reach'//cnum
1163 if (this%inamedbound /= 0)
then
1164 call this%parser%GetStringCaps(bndnametemp)
1165 if (bndnametemp /=
'')
then
1166 bndname = bndnametemp
1170 this%sfrname(n) = bndname
1175 bndelem => this%hk(n)
1177 this%packName,
'BND', &
1178 this%tsManager, this%iprpak, &
1184 bndelem => this%rough(n)
1186 this%packName,
'BND', &
1187 this%tsManager, this%iprpak, &
1193 bndelem => this%ustrf(n)
1195 this%packName,
'BND', &
1196 this%tsManager, this%iprpak,
'USTRF')
1199 do jj = 1, this%naux
1202 bndelem => this%rauxvar(jj, ii)
1204 this%packName,
'AUX', &
1205 this%tsManager, this%iprpak, &
1213 this%sstage(n) = this%strtop(n)
1216 write (this%iout,
'(1x,a)') &
1217 'END OF '//trim(adjustl(this%text))//
' PACKAGEDATA'
1219 call store_error(
'REQUIRED PACKAGEDATA BLOCK NOT FOUND.')
1224 do i = 1, this%maxbound
1225 if (nboundchk(i) == 0)
then
1226 write (
errmsg,
'(a,i0,1x,a)') &
1227 'Information for reach ', i,
'not specified in packagedata block.'
1229 else if (nboundchk(i) > 1)
then
1230 write (
errmsg,
'(a,1x,i0,1x,a,1x,i0)') &
1231 'Reach information specified', nboundchk(i),
'times for reach', i
1235 deallocate (nboundchk)
1238 if (nconzero > 0)
then
1239 write (
warnmsg,
'(a,1x,a,1x,a,1x,i0,1x, a)') &
1240 'SFR Package', trim(this%packName), &
1241 'has', nconzero,
'reach(es) with zero connections.'
1247 call this%parser%StoreErrorUnit()
1252 this%iacross(1) = ipos
1253 do i = 1, this%maxbound
1254 this%ncrosspts(i) = 1
1255 this%station(ipos) = this%width(i)
1256 this%xsheight(ipos) =
dzero
1257 this%xsrough(ipos) =
done
1259 this%iacross(i + 1) = ipos
1263 if (this%naux > 0)
then
1266 end subroutine sfr_read_packagedata
1272 subroutine sfr_read_crossection(this)
1277 class(sfrtype),
intent(inout) :: this
1279 character(len=LINELENGTH) :: keyword
1280 character(len=LINELENGTH) :: line
1281 logical(LGP) :: isfound
1282 logical(LGP) :: endOfBlock
1284 integer(I4B) :: ierr
1285 integer(I4B) :: ncrossptstot
1286 integer,
allocatable,
dimension(:) :: nboundchk
1290 call this%parser%GetBlock(
'CROSSSECTIONS', isfound, ierr, &
1291 supportopenclose=.true., &
1292 blockrequired=.false.)
1296 write (this%iout,
'(/1x,a)') &
1297 'PROCESSING '//trim(adjustl(this%text))//
' CROSSSECTIONS'
1300 allocate (nboundchk(this%maxbound))
1301 do n = 1, this%maxbound
1307 call cross_data%initialize(this%ncrossptstot, this%ncrosspts, &
1309 this%station, this%xsheight, &
1314 call this%parser%GetNextLine(endofblock)
1315 if (endofblock)
exit
1318 n = this%parser%GetInteger()
1321 if (n < 1 .or. n > this%maxbound)
then
1322 write (
errmsg,
'(a,1x,a,1x,i0)') &
1323 'SFR reach in crosssections block is less than one or greater', &
1330 nboundchk(n) = nboundchk(n) + 1
1333 call this%parser%GetStringCaps(keyword)
1334 select case (keyword)
1336 call this%parser%GetStringCaps(keyword)
1337 if (trim(adjustl(keyword)) /=
'FILEIN')
then
1338 errmsg =
'TAB6 keyword must be followed by "FILEIN" '// &
1343 call this%parser%GetString(line)
1344 call cross_data%read_table(n, this%width(n), &
1345 trim(adjustl(line)))
1347 write (
errmsg,
'(a,1x,i4,1x,a)') &
1348 'CROSS-SECTION TABLE ENTRY for REACH ', n, &
1349 'MUST INCLUDE TAB6 KEYWORD'
1355 write (this%iout,
'(1x,a)') &
1356 'END OF '//trim(adjustl(this%text))//
' CROSSSECTIONS'
1360 do n = 1, this%maxbound
1361 if (nboundchk(n) > 1)
then
1362 write (
errmsg,
'(a,1x,i0,1x,a,1x,i0,1x,a)') &
1363 'Cross-section data for reach', n, &
1364 'specified', nboundchk(n),
'times.'
1371 call this%parser%StoreErrorUnit()
1375 ncrossptstot = cross_data%get_ncrossptstot()
1378 if (ncrossptstot /= this%ncrossptstot)
then
1379 this%ncrossptstot = ncrossptstot
1380 call mem_reallocate(this%station, this%ncrossptstot,
'STATION', &
1382 call mem_reallocate(this%xsheight, this%ncrossptstot,
'XSHEIGHT', &
1384 call mem_reallocate(this%xsrough, this%ncrossptstot,
'XSROUGH', &
1389 call cross_data%output(this%width, this%rough)
1392 call cross_data%pack(this%ncrossptstot, this%ncrosspts, &
1399 deallocate (nboundchk)
1400 call cross_data%destroy()
1401 deallocate (cross_data)
1402 nullify (cross_data)
1404 end subroutine sfr_read_crossection
1410 subroutine sfr_read_connectiondata(this)
1415 class(sfrtype),
intent(inout) :: this
1417 character(len=LINELENGTH) :: line
1418 logical(LGP) :: isfound
1419 logical(LGP) :: endOfBlock
1424 integer(I4B) :: jcol
1425 integer(I4B) :: jcol2
1427 integer(I4B) :: ival
1428 integer(I4B) :: idir
1429 integer(I4B) :: ierr
1430 integer(I4B) :: nconnmax
1432 integer(I4B) :: ipos
1433 integer(I4B) :: istat
1434 integer(I4B),
dimension(:),
pointer,
contiguous :: rowmaxnnz => null()
1435 integer,
allocatable,
dimension(:) :: nboundchk
1436 integer,
allocatable,
dimension(:, :) :: iconndata
1438 integer(I4B),
dimension(:),
allocatable :: iup
1439 integer(I4B),
dimension(:),
allocatable :: order
1440 type(
dag) :: sfr_dag
1443 allocate (nboundchk(this%maxbound))
1444 do n = 1, this%maxbound
1451 allocate (rowmaxnnz(this%maxbound))
1452 do n = 1, this%maxbound
1453 ival = this%nconnreach(n)
1454 if (ival < 0) ival = 0
1455 rowmaxnnz(n) = ival + 1
1456 nja = nja + ival + 1
1457 if (ival > nconnmax)
then
1472 this%qconn(n) =
dzero
1476 allocate (iconndata(nconnmax, this%maxbound))
1479 do n = 1, this%maxbound
1489 call sparse%init(this%maxbound, this%maxbound, rowmaxnnz)
1492 call this%parser%GetBlock(
'CONNECTIONDATA', isfound, ierr, &
1493 supportopenclose=.true.)
1497 write (this%iout,
'(/1x,a)') &
1498 'PROCESSING '//trim(adjustl(this%text))//
' CONNECTIONDATA'
1500 call this%parser%GetNextLine(endofblock)
1501 if (endofblock)
exit
1504 n = this%parser%GetInteger()
1507 if (n < 1 .or. n > this%maxbound)
then
1508 write (
errmsg,
'(a,1x,a,1x,i0)') &
1509 'SFR reach in connectiondata block is less than one or greater', &
1516 nboundchk(n) = nboundchk(n) + 1
1519 call sparse%addconnection(n, n, 1)
1522 do i = 1, this%nconnreach(n)
1525 ival = this%parser%GetInteger()
1528 iconndata(i, n) = ival
1534 elseif (ival == 0)
then
1535 call store_error(
'Missing or zero connection reach in line:')
1540 if (ival > this%maxbound)
then
1541 call store_error(
'Reach number exceeds NREACHES in line:')
1546 call sparse%addconnection(n, ival, 1)
1550 write (this%iout,
'(1x,a)') &
1551 'END OF '//trim(adjustl(this%text))//
' CONNECTIONDATA'
1553 do n = 1, this%maxbound
1556 if (nboundchk(n) == 0)
then
1557 write (
errmsg,
'(a,1x,i0)') &
1558 'No connection data specified for reach', n
1560 else if (nboundchk(n) > 1)
then
1561 write (
errmsg,
'(a,1x,i0,1x,a,1x,i0,1x,a)') &
1562 'Connection data for reach', n, &
1563 'specified', nboundchk(n),
'times.'
1568 call store_error(
'Required connectiondata block not found.')
1573 call this%parser%StoreErrorUnit()
1577 call sparse%filliaja(this%ia, this%ja, ierr, sort=.true.)
1581 write (
errmsg,
'(a,3(1x,a))') &
1582 'Could not fill', trim(this%packName), &
1583 'package IA and JA connection data.', &
1584 'Check connectivity data in connectiondata block.'
1589 do n = 1, this%maxbound
1590 do j = this%ia(n) + 1, this%ia(n + 1) - 1
1592 do jj = 1, this%nconnreach(n)
1593 jcol2 = iconndata(jj, n)
1594 if (abs(jcol2) == jcol)
then
1607 deallocate (rowmaxnnz)
1608 deallocate (nboundchk)
1609 deallocate (iconndata)
1612 call sparse%destroy()
1618 call sfr_dag%set_vertices(this%maxbound)
1621 fill_dag:
do n = 1, this%maxbound
1625 do j = this%ia(n) + 1, this%ia(n + 1) - 1
1626 if (this%idir(j) > 0)
then
1632 if (nup == 0) cycle fill_dag
1639 do j = this%ia(n) + 1, this%ia(n + 1) - 1
1640 if (this%idir(j) > 0)
then
1641 iup(ipos) = this%ja(j)
1647 call sfr_dag%set_edges(n, iup)
1654 call sfr_dag%toposort(order, istat)
1657 if (istat == -1)
then
1659 trim(adjustl(this%text))//
' PACKAGE ('// &
1660 trim(adjustl(this%packName))//
') cannot calculate a '// &
1661 'Directed Asyclic Graph for reach connectivity because '// &
1662 'of circular dependency. Using the reach number for '// &
1663 'solution ordering.'
1668 do n = 1, this%maxbound
1669 if (istat == 0)
then
1670 this%isfrorder(n) = order(n)
1672 this%isfrorder(n) = n
1677 call sfr_dag%destroy()
1678 if (istat == 0)
then
1681 end subroutine sfr_read_connectiondata
1687 subroutine sfr_read_diversions(this)
1691 class(sfrtype),
intent(inout) :: this
1693 character(len=10) :: cnum
1694 character(len=10) :: cval
1697 integer(I4B) :: ierr
1698 integer(I4B) :: ival
1700 integer(I4B) :: ipos
1701 integer(I4B) :: jpos
1702 integer(I4B) :: ndiv
1703 integer(I4B) :: ndiversions
1704 integer(I4B) :: idivreach
1705 logical(LGP) :: isfound
1706 logical(LGP) :: endOfBlock
1707 integer(I4B) :: idiv
1708 integer,
allocatable,
dimension(:) :: iachk
1709 integer,
allocatable,
dimension(:) :: nboundchk
1715 do n = 1, this%maxbound
1716 ndiversions = ndiversions + this%ndiv(n)
1717 i0 = i0 + this%ndiv(n)
1718 this%iadiv(n + 1) = i0
1722 if (ndiversions > 0)
then
1725 allocate (this%divcprior(ndiversions))
1726 call mem_reallocate(this%divflow, ndiversions,
'DIVFLOW', this%memoryPath)
1727 call mem_reallocate(this%divq, ndiversions,
'DIVQ', this%memoryPath)
1731 do n = 1, ndiversions
1732 this%divflow(n) =
dzero
1733 this%divq(n) =
dzero
1737 call this%parser%GetBlock(
'DIVERSIONS', isfound, ierr, &
1738 supportopenclose=.true., &
1739 blockrequired=.false.)
1743 if (this%idiversions /= 0)
then
1744 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text))// &
1749 do n = 1, this%maxbound
1750 ndiv = ndiv + this%ndiv(n)
1752 allocate (iachk(this%maxbound + 1))
1753 allocate (nboundchk(ndiv))
1755 do n = 1, this%maxbound
1756 iachk(n + 1) = iachk(n) + this%ndiv(n)
1764 call this%parser%GetNextLine(endofblock)
1765 if (endofblock)
exit
1768 n = this%parser%GetInteger()
1769 if (n < 1 .or. n > this%maxbound)
then
1770 write (cnum,
'(i0)') n
1771 errmsg =
'Reach number should be between 1 and '// &
1778 if (this%ndiv(n) < 1)
then
1779 write (cnum,
'(i0)') n
1780 errmsg =
'Diversions cannot be specified '// &
1781 'for reach '//trim(cnum)
1787 ival = this%parser%GetInteger()
1788 if (ival < 1 .or. ival > this%ndiv(n))
then
1789 write (cnum,
'(i0)') n
1790 errmsg =
'Reach '//trim(cnum)
1791 write (cnum,
'(i0)') this%ndiv(n)
1792 errmsg = trim(
errmsg)//
' diversion number should be between '// &
1793 '1 and '//trim(cnum)//
'.'
1799 ipos = iachk(n) + ival - 1
1800 nboundchk(ipos) = nboundchk(ipos) + 1
1805 ival = this%parser%GetInteger()
1806 if (ival < 1 .or. ival > this%maxbound)
then
1807 write (cnum,
'(i0)') ival
1808 errmsg =
'Diversion target reach number should be '// &
1809 'between 1 and '//trim(cnum)//
'.'
1814 jpos = this%iadiv(n) + idiv - 1
1815 this%divreach(jpos) = idivreach
1818 call this%parser%GetStringCaps(cval)
1830 errmsg =
'Invalid cprior type '//trim(cval)//
'.'
1835 this%divcprior(jpos) = cval
1838 write (this%iout,
'(1x,a)')
'END OF '//trim(adjustl(this%text))// &
1841 do n = 1, this%maxbound
1842 do j = 1, this%ndiv(n)
1843 ipos = iachk(n) + j - 1
1846 if (nboundchk(ipos) == 0)
then
1847 write (
errmsg,
'(a,1x,i0,1x,a,1x,i0)') &
1848 'No data specified for reach', n,
'diversion', j
1850 else if (nboundchk(ipos) > 1)
then
1851 write (
errmsg,
'(a,1x,i0,1x,a,1x,i0,1x,a,1x,i0,1x,a)') &
1852 'Data for reach', n,
'diversion', j, &
1853 'specified', nboundchk(ipos),
'times'
1861 deallocate (nboundchk)
1865 write (
errmsg,
'(a,1x,a)') &
1866 'A diversions block should not be', &
1867 'specified if diversions are not specified.'
1871 if (this%idiversions /= 0)
then
1872 call store_error(
'REQUIRED DIVERSIONS BLOCK NOT FOUND.')
1878 call this%parser%StoreErrorUnit()
1880 end subroutine sfr_read_diversions
1886 subroutine sfr_read_initial_stages(this)
1890 class(sfrtype),
intent(inout) :: this
1893 integer(I4B) :: ierr
1894 logical(LGP) :: isfound
1895 logical(LGP) :: endOfBlock
1898 integer,
allocatable,
dimension(:) :: nboundchk
1901 call this%parser%GetBlock(
'INITIALSTAGES', isfound, ierr, &
1902 supportopenclose=.true., &
1903 blockrequired=.false.)
1907 write (this%iout,
'(/1x,a)') &
1908 'PROCESSING '//trim(adjustl(this%text))//
' INITIALSTAGES'
1910 allocate (nboundchk(this%maxbound))
1911 do n = 1, this%maxbound
1916 call this%parser%GetNextLine(endofblock)
1917 if (endofblock)
exit
1920 n = this%parser%GetInteger()
1922 if (n < 1 .or. n > this%maxbound)
then
1923 write (
errmsg,
'(a,i0,a,1x,i0,a)') &
1924 'Reach number (', n,
') must be greater than 0 and less &
1925 &than or equal to', this%maxbound,
'.'
1931 nboundchk(n) = nboundchk(n) + 1
1933 rval = this%parser%GetDouble()
1934 this%stage(n) = rval
1935 this%depth(n) = rval - this%strtop(n)
1937 if (rval < this%strtop(n))
then
1938 write (
errmsg,
'(a,g0,a,1x,i0,1x,a,g0,a)') &
1939 'Initial stage (', rval,
') for reach', n, &
1940 'is less than the reach top (', this%strtop(n),
').'
1945 write (this%iout,
'(1x,a)') &
1946 'END OF '//trim(adjustl(this%text))//
' INITIALSTAGES'
1951 do i = 1, this%maxbound
1952 if (nboundchk(i) == 0)
then
1953 write (
errmsg,
'(a,i0,1x,a)') &
1954 'Information for reach ', i,
'not specified in initialstages block.'
1956 else if (nboundchk(i) > 1)
then
1957 write (
errmsg,
'(a,1x,i0,1x,a,1x,i0)') &
1958 'Initial stage information specified', &
1959 nboundchk(i),
'times for reach', i
1963 deallocate (nboundchk)
1966 if (this%istorage == 1)
then
1967 do n = 1, this%maxbound
1968 rval = this%strtop(n)
1969 this%stage(n) = rval
1976 call this%parser%StoreErrorUnit()
1978 end subroutine sfr_read_initial_stages
1984 subroutine sfr_rp(this)
1990 class(sfrtype),
intent(inout) :: this
1992 character(len=LINELENGTH) :: title
1993 character(len=LINELENGTH) :: line
1994 character(len=LINELENGTH) :: crossfile
1995 integer(I4B) :: ierr
1997 integer(I4B) :: ichkustrm
1998 integer(I4B) :: ichkcross
1999 integer(I4B) :: ncrossptstot
2000 logical(LGP) :: isfound
2001 logical(LGP) :: endOfBlock
2004 character(len=*),
parameter :: fmtblkerr = &
2005 &
"('Looking for BEGIN PERIOD iper. Found ', a, ' instead.')"
2006 character(len=*),
parameter :: fmtlsp = &
2007 &
"(1X,/1X,'REUSING ',A,'S FROM LAST STRESS PERIOD')"
2008 character(len=*),
parameter :: fmtnbd = &
2009 "(1X,/1X,'The number of active ',A,'S (',I6, &
2010 &') is greater than maximum (',I6,')')"
2020 this%nbound = this%maxbound
2024 if (this%ionper <
kper)
then
2027 call this%parser%GetBlock(
'PERIOD', isfound, ierr, &
2028 supportopenclose=.true., &
2029 blockrequired=.false.)
2033 call this%read_check_ionper()
2039 this%ionper =
nper + 1
2042 call this%parser%GetCurrentLine(line)
2043 write (
errmsg, fmtblkerr) adjustl(trim(line))
2045 call this%parser%StoreErrorUnit()
2051 if (this%ionper ==
kper)
then
2055 call cross_data%initialize(this%ncrossptstot, this%ncrosspts, &
2057 this%station, this%xsheight, &
2061 if (this%iprpak /= 0)
then
2064 title = trim(adjustl(this%text))//
' PACKAGE ('// &
2065 trim(adjustl(this%packName))//
') DATA FOR PERIOD'
2066 write (title,
'(a,1x,i6)') trim(adjustl(title)),
kper
2067 call table_cr(this%inputtab, this%packName, title)
2068 call this%inputtab%table_df(1, 4, this%iout, finalize=.false.)
2070 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
2072 call this%inputtab%initialize_column(text, 20, alignment=
tableft)
2074 write (text,
'(a,1x,i6)')
'VALUE', n
2075 call this%inputtab%initialize_column(text, 15, alignment=
tabcenter)
2081 call this%parser%GetNextLine(endofblock)
2082 if (endofblock)
exit
2083 n = this%parser%GetInteger()
2084 if (n < 1 .or. n > this%maxbound)
then
2085 write (
errmsg,
'(a,1x,a,1x,i0,a)') &
2086 'Reach number (RNO) must be greater than 0 and', &
2087 'less than or equal to', this%maxbound,
'.'
2093 call this%sfr_set_stressperiod(n, ichkustrm, crossfile)
2096 if (this%iprpak /= 0)
then
2097 call this%parser%GetCurrentLine(line)
2098 call this%inputtab%line_to_columns(line)
2102 if (trim(adjustl(crossfile)) /=
'NONE')
then
2103 call cross_data%read_table(n, this%width(n), &
2104 trim(adjustl(crossfile)))
2109 if (this%iprpak /= 0)
then
2110 call this%inputtab%finalize_table()
2117 ncrossptstot = cross_data%get_ncrossptstot()
2120 if (ncrossptstot /= this%ncrossptstot)
then
2121 this%ncrossptstot = ncrossptstot
2122 call mem_reallocate(this%station, this%ncrossptstot,
'STATION', &
2124 call mem_reallocate(this%xsheight, this%ncrossptstot,
'XSHEIGHT', &
2126 call mem_reallocate(this%xsrough, this%ncrossptstot,
'XSROUGH', &
2131 call cross_data%output(this%width, this%rough, kstp=1,
kper=
kper)
2134 call cross_data%pack(this%ncrossptstot, this%ncrosspts, &
2141 call cross_data%destroy()
2142 deallocate (cross_data)
2143 nullify (cross_data)
2147 write (this%iout, fmtlsp) trim(this%filtyp)
2151 if (ichkustrm /= 0)
then
2152 call this%sfr_check_ustrf()
2157 call this%parser%StoreErrorUnit()
2159 end subroutine sfr_rp
2166 subroutine sfr_ad(this)
2170 class(sfrtype) :: this
2173 integer(I4B) :: iaux
2176 if (this%istorage == 1)
then
2177 do n = 1, this%maxbound
2178 this%stageold(n) = this%stage(n)
2179 this%usinflowold(n) = this%usinflow(n)
2180 this%dsflowold(n) = this%dsflow(n)
2190 call this%TsManager%ad()
2195 call this%sfr_check_ustrf()
2201 if (this%naux > 0)
then
2202 do n = 1, this%maxbound
2203 do iaux = 1, this%naux
2204 if (this%noupdateauxvar(iaux) /= 0) cycle
2205 this%auxvar(iaux, n) = this%rauxvar(iaux, n)
2211 do n = 1, this%maxbound
2212 this%usflow(n) =
dzero
2213 if (this%iboundpak(n) < 0)
then
2214 this%stage(n) = this%sstage(n)
2219 if (this%imover == 1)
then
2220 call this%pakmvrobj%ad()
2226 call this%obs%obs_ad()
2227 end subroutine sfr_ad
2234 subroutine sfr_cf(this)
2236 class(sfrtype) :: this
2239 integer(I4B) :: igwfnode
2242 if (this%nbound == 0)
return
2245 do n = 1, this%nbound
2246 igwfnode = this%igwftopnode(n)
2247 if (igwfnode > 0)
then
2248 if (this%ibound(igwfnode) == 0)
then
2249 call this%dis%highest_active(igwfnode, this%ibound)
2252 this%igwfnode(n) = igwfnode
2253 this%nodelist(n) = igwfnode
2255 end subroutine sfr_cf
2262 subroutine sfr_fc(this, rhs, ia, idxglo, matrix_sln)
2264 class(sfrtype) :: this
2265 real(DP),
dimension(:),
intent(inout) :: rhs
2266 integer(I4B),
dimension(:),
intent(in) :: ia
2267 integer(I4B),
dimension(:),
intent(in) :: idxglo
2273 integer(I4B) :: ipos
2274 integer(I4B) :: node
2285 sfrpicard:
do i = 1, this%maxsfrpicard
2291 if (this%imover == 1)
then
2292 call this%pakmvrobj%fc()
2296 reachsolve:
do j = 1, this%nbound
2297 n = this%isfrorder(j)
2298 node = this%igwfnode(n)
2300 hgwf = this%xnew(node)
2307 this%stage0(n) = this%stage(n)
2308 this%usflow0(n) = this%usflow(n)
2315 if (this%iboundpak(n) /= 0)
then
2316 call this%sfr_solve(n, hgwf, hhcof, rrhs)
2318 this%depth(n) =
dzero
2319 this%stage(n) = this%strtop(n)
2321 call this%sfr_update_flows(n, v, v)
2327 this%hcof(n) = hhcof
2331 ds = s0 - this%stage(n)
2334 if (abs(ds) > abs(dsmax))
then
2341 if (abs(dsmax) <= this%dmaxchg)
then
2348 do n = 1, this%nbound
2349 node = this%nodelist(n)
2351 rhs(node) = rhs(node) + this%rhs(n)
2353 call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(n))
2355 end subroutine sfr_fc
2362 subroutine sfr_fn(this, rhs, ia, idxglo, matrix_sln)
2364 class(sfrtype) :: this
2365 real(DP),
dimension(:),
intent(inout) :: rhs
2366 integer(I4B),
dimension(:),
intent(in) :: ia
2367 integer(I4B),
dimension(:),
intent(in) :: idxglo
2373 integer(I4B) :: ipos
2383 do j = 1, this%nbound
2384 i = this%isfrorder(j)
2386 if (this%iboundpak(i) < 1) cycle
2388 n = this%nodelist(i)
2391 rterm = this%hcof(i) * this%xnew(n)
2393 hgwf = this%xnew(n) +
dem4
2394 call this%sfr_solve(i, hgwf, hcof1, rhs1, update=.false.)
2395 q1 = rhs1 - hcof1 * hgwf
2397 q2 = this%rhs(i) - this%hcof(i) * this%xnew(n)
2399 drterm = (q2 - q1) /
dem4
2402 call matrix_sln%add_value_pos(idxglo(ipos), drterm - this%hcof(i))
2403 rhs(n) = rhs(n) - rterm + drterm * this%xnew(n)
2405 end subroutine sfr_fn
2412 subroutine sfr_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
2416 class(sfrtype),
intent(inout) :: this
2417 integer(I4B),
intent(in) :: innertot
2418 integer(I4B),
intent(in) :: kiter
2419 integer(I4B),
intent(in) :: iend
2420 integer(I4B),
intent(in) :: icnvgmod
2421 character(len=LENPAKLOC),
intent(inout) :: cpak
2422 integer(I4B),
intent(inout) :: ipak
2423 real(DP),
intent(inout) :: dpak
2425 character(len=LENPAKLOC) :: cloc
2426 character(len=LINELENGTH) :: tag
2427 integer(I4B) :: icheck
2428 integer(I4B) :: ipakfail
2429 integer(I4B) :: locdhmax
2430 integer(I4B) :: locrmax
2431 integer(I4B) :: locdqfrommvrmax
2432 integer(I4B) :: ntabrows
2433 integer(I4B) :: ntabcols
2437 real(DP) :: qtolfact
2442 real(DP) :: dqfrommvr
2443 real(DP) :: dqfrommvrmax
2446 icheck = this%iconvchk
2454 dqfrommvrmax =
dzero
2458 if (this%ipakcsv == 0)
then
2459 if (icnvgmod == 0)
then
2467 if (.not.
associated(this%pakcsvtab))
then
2472 if (this%imover == 1)
then
2473 ntabcols = ntabcols + 2
2477 call table_cr(this%pakcsvtab, this%packName,
'')
2478 call this%pakcsvtab%table_df(ntabrows, ntabcols, this%ipakcsv, &
2479 lineseparator=.false., separator=
',', &
2483 tag =
'total_inner_iterations'
2484 call this%pakcsvtab%initialize_column(tag, 10, alignment=
tableft)
2486 call this%pakcsvtab%initialize_column(tag, 10, alignment=
tableft)
2488 call this%pakcsvtab%initialize_column(tag, 10, alignment=
tableft)
2490 call this%pakcsvtab%initialize_column(tag, 10, alignment=
tableft)
2492 call this%pakcsvtab%initialize_column(tag, 10, alignment=
tableft)
2494 call this%pakcsvtab%initialize_column(tag, 15, alignment=
tableft)
2496 call this%pakcsvtab%initialize_column(tag, 15, alignment=
tableft)
2498 call this%pakcsvtab%initialize_column(tag, 15, alignment=
tableft)
2499 tag =
'dinflowmax_loc'
2500 call this%pakcsvtab%initialize_column(tag, 15, alignment=
tableft)
2501 if (this%imover == 1)
then
2502 tag =
'dqfrommvrmax'
2503 call this%pakcsvtab%initialize_column(tag, 15, alignment=
tableft)
2504 tag =
'dqfrommvrmax_loc'
2505 call this%pakcsvtab%initialize_column(tag, 16, alignment=
tableft)
2511 if (icheck /= 0)
then
2512 final_check:
do n = 1, this%maxbound
2513 if (this%iboundpak(n) == 0) cycle
2516 qtolfact =
delt / this%calc_surface_area(n)
2519 dh = this%stage0(n) - this%stage(n)
2522 if (this%gwfiss == 0)
then
2523 r = this%usflow0(n) - this%usflow(n)
2531 if (this%imover == 1)
then
2532 q = this%pakmvrobj%get_qfrommvr(n)
2533 q0 = this%pakmvrobj%get_qfrommvr0(n)
2534 dqfrommvr = qtolfact * (q0 - q)
2543 dqfrommvrmax = dqfrommvr
2546 if (abs(dh) > abs(dhmax))
then
2550 if (abs(r) > abs(rmax))
then
2554 if (abs(dqfrommvr) > abs(dqfrommvrmax))
then
2555 dqfrommvrmax = dqfrommvr
2562 if (abs(dhmax) > abs(dpak))
then
2565 write (cloc,
"(a,'-',a)") trim(this%packName),
'stage'
2568 if (abs(rmax) > abs(dpak))
then
2571 write (cloc,
"(a,'-',a)") trim(this%packName),
'inflow'
2574 if (this%imover == 1)
then
2575 if (abs(dqfrommvrmax) > abs(dpak))
then
2576 ipak = locdqfrommvrmax
2578 write (cloc,
"(a,'-',a)") trim(this%packName),
'qfrommvr'
2584 if (this%ipakcsv /= 0)
then
2587 call this%pakcsvtab%add_term(innertot)
2588 call this%pakcsvtab%add_term(
totim)
2589 call this%pakcsvtab%add_term(
kper)
2590 call this%pakcsvtab%add_term(
kstp)
2591 call this%pakcsvtab%add_term(kiter)
2592 call this%pakcsvtab%add_term(dhmax)
2593 call this%pakcsvtab%add_term(locdhmax)
2594 call this%pakcsvtab%add_term(rmax)
2595 call this%pakcsvtab%add_term(locrmax)
2596 if (this%imover == 1)
then
2597 call this%pakcsvtab%add_term(dqfrommvrmax)
2598 call this%pakcsvtab%add_term(locdqfrommvrmax)
2603 call this%pakcsvtab%finalize_table()
2608 end subroutine sfr_cc
2614 subroutine sfr_cq(this, x, flowja, iadv)
2618 class(sfrtype),
intent(inout) :: this
2619 real(DP),
dimension(:),
intent(in) :: x
2620 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
2621 integer(I4B),
optional,
intent(in) :: iadv
2628 real(DP) :: qoutflow
2629 real(DP) :: qfrommvr
2634 call this%BndType%bnd_cq(x, flowja, iadv=1)
2637 do n = 1, this%maxbound
2642 if (this%imover == 1)
then
2643 qfrommvr = this%pakmvrobj%get_qfrommvr(n)
2644 qtomvr = this%pakmvrobj%get_qtomvr(n)
2645 if (qtomvr >
dzero)
then
2651 qext = this%dsflow(n)
2653 if (qext >
dzero)
then
2656 do i = this%ia(n) + 1, this%ia(n + 1) - 1
2657 if (this%idir(i) > 0) cycle
2659 if (this%iboundpak(n2) == 0) cycle
2665 if (qext <
dzero)
then
2666 if (qtomvr <
dzero)
then
2667 qext = qext - qtomvr
2670 qoutflow = this%dsflow(n)
2671 if (qoutflow >
dzero)
then
2672 qoutflow = -qoutflow
2678 this%qextoutflow(n) = qext
2679 this%qoutflow(n) = qoutflow
2684 call this%sfr_fill_budobj()
2685 end subroutine sfr_cq
2691 subroutine sfr_ot_package_flows(this, icbcfl, ibudfl)
2695 class(sfrtype) :: this
2696 integer(I4B),
intent(in) :: icbcfl
2697 integer(I4B),
intent(in) :: ibudfl
2699 integer(I4B) :: ibinun
2700 character(len=20),
dimension(:),
allocatable :: cellidstr
2702 integer(I4B) :: node
2706 if (this%ibudgetout /= 0)
then
2707 ibinun = this%ibudgetout
2709 if (icbcfl == 0) ibinun = 0
2710 if (ibinun > 0)
then
2711 call this%budobj%save_flows(this%dis, ibinun,
kstp,
kper,
delt, &
2716 if (ibudfl /= 0 .and. this%iprflow /= 0)
then
2722 if (this%ianynone > 0)
then
2723 allocate (cellidstr(this%maxbound))
2724 do n = 1, this%maxbound
2725 node = this%igwfnode(n)
2727 call this%dis%noder_to_string(node, cellidstr(n))
2729 cellidstr(n) =
'NONE'
2732 call this%budobj%write_flowtable(this%dis,
kstp,
kper, cellidstr)
2733 deallocate (cellidstr)
2735 call this%budobj%write_flowtable(this%dis,
kstp,
kper)
2738 end subroutine sfr_ot_package_flows
2744 subroutine sfr_ot_dv(this, idvsave, idvprint)
2749 class(sfrtype) :: this
2750 integer(I4B),
intent(in) :: idvsave
2751 integer(I4B),
intent(in) :: idvprint
2753 character(len=20) :: cellid
2754 integer(I4B) :: ibinun
2756 integer(I4B) :: node
2769 if (this%istageout /= 0)
then
2770 ibinun = this%istageout
2772 if (idvsave == 0) ibinun = 0
2775 if (ibinun > 0)
then
2776 do n = 1, this%maxbound
2779 if (this%iboundpak(n) == 0)
then
2781 else if (d ==
dzero)
then
2787 this%maxbound, 1, 1, ibinun)
2791 if (idvprint /= 0 .and. this%iprhed /= 0)
then
2794 call this%stagetab%set_kstpkper(
kstp,
kper)
2797 do n = 1, this%maxbound
2798 node = this%igwfnode(n)
2800 call this%dis%noder_to_string(node, cellid)
2801 hgwf = this%xnew(node)
2805 if (this%inamedbound == 1)
then
2806 call this%stagetab%add_term(this%boundname(n))
2808 call this%stagetab%add_term(n)
2809 call this%stagetab%add_term(cellid)
2810 if (this%iboundpak(n) /= 0)
then
2811 depth = this%depth(n)
2812 stage = this%stage(n)
2813 w = this%calc_top_width_wet(n, depth)
2814 call this%sfr_calc_cond(n, depth, cond, stage, hgwf)
2821 if (depth ==
dzero)
then
2822 call this%stagetab%add_term(
dhdry)
2824 call this%stagetab%add_term(stage)
2826 call this%stagetab%add_term(depth)
2827 call this%stagetab%add_term(w)
2829 if (this%iboundpak(n) /= 0)
then
2830 sbot = this%strtop(n) - this%bthick(n)
2831 if (hgwf < sbot)
then
2836 grad = grad / this%bthick(n)
2840 call this%stagetab%add_term(hgwf)
2841 call this%stagetab%add_term(cond)
2842 call this%stagetab%add_term(grad)
2844 call this%stagetab%add_term(
'--')
2845 call this%stagetab%add_term(
'--')
2846 call this%stagetab%add_term(
'--')
2850 end subroutine sfr_ot_dv
2856 subroutine sfr_ot_bdsummary(this, kstp, kper, iout, ibudfl)
2860 class(sfrtype) :: this
2861 integer(I4B),
intent(in) :: kstp
2862 integer(I4B),
intent(in) :: kper
2863 integer(I4B),
intent(in) :: iout
2864 integer(I4B),
intent(in) :: ibudfl
2866 call this%budobj%write_budtable(kstp, kper, iout, ibudfl,
totim,
delt)
2867 end subroutine sfr_ot_bdsummary
2871 subroutine sfr_fp(this)
2873 class(sfrtype) :: this
2878 if (this%istorage == 1)
then
2879 do n = 1, this%maxbound
2880 if (this%inamedbound == 1)
then
2881 call this%couranttab%add_term(this%boundname(n))
2883 call this%couranttab%add_term(n)
2884 if (this%crmin(n) ==
dep20)
then
2885 call this%couranttab%add_term(
'--')
2887 call this%couranttab%add_term(this%crmin(n))
2889 if (this%crmax(n) <
dzero)
then
2890 call this%couranttab%add_term(
'--')
2892 call this%couranttab%add_term(this%crmax(n))
2894 if (this%crcnt(n) > 0)
then
2895 crmean = this%crsum(n) / real(this%crcnt(n), dp)
2896 call this%couranttab%add_term(crmean)
2898 call this%couranttab%add_term(
'--')
2902 end subroutine sfr_fp
2906 subroutine sfr_dt(this)
2910 class(sfrtype) :: this
2913 integer(I4B) :: nrmin
2914 real(DP) :: celerity
2917 character(len=LINELENGTH) :: msg
2919 if (this%ats_courant ==
dnodata)
return
2920 if (this%istorage /= 1)
return
2925 do n = 1, this%maxbound
2926 call this%sfr_calc_celerity(n, this%dsflow(n), celerity)
2927 if (celerity >
dzero)
then
2928 dt_n = this%ats_courant * this%length(n) / celerity
2929 if (dt_n < dtmin)
then
2937 write (msg,
'(a,i0)') trim(this%packName)//
'-REACH-', nrmin
2938 call ats%ats_submit_delt(
kstp,
kper, dtmin, trim(msg))
2940 end subroutine sfr_dt
2944 subroutine sfr_calc_celerity(this, n, q, celerity)
2946 class(sfrtype) :: this
2947 integer(I4B),
intent(in) :: n
2948 real(DP),
intent(in) :: q
2949 real(DP),
intent(out) :: celerity
2956 call this%sfr_calc_reach_depth(n, q, d)
2958 a = this%calc_area_wet(n, d)
2959 call this%sfr_calc_reach_depth(n, q + this%deps, d)
2960 a2 = this%calc_area_wet(n, d)
2962 celerity = this%deps / (a2 - a)
2965 end subroutine sfr_calc_celerity
2971 subroutine sfr_da(this)
2975 class(sfrtype) :: this
2980 deallocate (this%csfrbudget)
2983 deallocate (this%cauxcbc)
3010 if (this%istorage == 1)
then
3045 if (
associated(this%divcprior))
then
3046 deallocate (this%divcprior)
3060 call this%budobj%budgetobject_da()
3061 deallocate (this%budobj)
3062 nullify (this%budobj)
3065 if (this%iprhed > 0)
then
3066 call this%stagetab%table_da()
3067 deallocate (this%stagetab)
3068 nullify (this%stagetab)
3072 if (
associated(this%couranttab))
then
3073 call this%couranttab%table_da()
3074 deallocate (this%couranttab)
3075 nullify (this%couranttab)
3079 if (this%ipakcsv > 0)
then
3080 if (
associated(this%pakcsvtab))
then
3081 call this%pakcsvtab%table_da()
3082 deallocate (this%pakcsvtab)
3083 nullify (this%pakcsvtab)
3112 nullify (this%gwfiss)
3115 call this%BndType%bnd_da()
3116 end subroutine sfr_da
3122 subroutine sfr_precompute_tvd(this)
3124 class(sfrtype),
intent(inout) :: this
3128 integer(I4B) :: iup_count
3131 do n = 1, this%maxbound
3134 do j = this%ia(n) + 1, this%ia(n + 1) - 1
3135 if (this%idir(j) > 0)
then
3136 iup_count = iup_count + 1
3140 if (iup_count == 1)
then
3141 this%itvd_upstream(n) = m
3143 this%itvd_upstream(n) = 0
3146 end subroutine sfr_precompute_tvd
3153 subroutine define_listlabel(this)
3155 class(sfrtype),
intent(inout) :: this
3158 this%listlabel = trim(this%filtyp)//
' NO.'
3159 if (this%dis%ndim == 3)
then
3160 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
3161 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'ROW'
3162 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'COL'
3163 elseif (this%dis%ndim == 2)
then
3164 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
3165 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'CELL2D'
3167 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'NODE'
3169 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'STRESS RATE'
3170 if (this%inamedbound == 1)
then
3171 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'BOUNDARY NAME'
3173 end subroutine define_listlabel
3185 logical function sfr_obs_supported(this)
3187 class(sfrtype) :: this
3190 sfr_obs_supported = .true.
3191 end function sfr_obs_supported
3197 subroutine sfr_df_obs(this)
3199 class(sfrtype) :: this
3201 integer(I4B) :: indx
3205 call this%obs%StoreObsType(
'stage', .false., indx)
3206 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3210 call this%obs%StoreObsType(
'inflow', .true., indx)
3211 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3215 call this%obs%StoreObsType(
'ext-inflow', .true., indx)
3216 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3220 call this%obs%StoreObsType(
'rainfall', .true., indx)
3221 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3225 call this%obs%StoreObsType(
'runoff', .true., indx)
3226 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3230 call this%obs%StoreObsType(
'evaporation', .true., indx)
3231 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3235 call this%obs%StoreObsType(
'outflow', .true., indx)
3236 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3240 call this%obs%StoreObsType(
'ext-outflow', .true., indx)
3241 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3245 call this%obs%StoreObsType(
'to-mvr', .true., indx)
3246 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3250 call this%obs%StoreObsType(
'from-mvr', .true., indx)
3251 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3255 call this%obs%StoreObsType(
'sfr', .true., indx)
3256 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3260 call this%obs%StoreObsType(
'upstream-flow', .true., indx)
3261 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3265 call this%obs%StoreObsType(
'downstream-flow', .true., indx)
3266 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3270 call this%obs%StoreObsType(
'depth', .false., indx)
3271 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3275 call this%obs%StoreObsType(
'wet-perimeter', .false., indx)
3276 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3280 call this%obs%StoreObsType(
'wet-area', .false., indx)
3281 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3285 call this%obs%StoreObsType(
'wet-width', .false., indx)
3286 this%obs%obsData(indx)%ProcessIdPtr => sfr_process_obsid
3287 end subroutine sfr_df_obs
3293 subroutine sfr_bd_obs(this)
3295 class(sfrtype) :: this
3301 character(len=100) :: msg
3305 if (this%obs%npakobs > 0)
then
3306 call this%obs%obs_bd_clear()
3307 do i = 1, this%obs%npakobs
3308 obsrv => this%obs%pakobs(i)%obsrv
3309 do j = 1, obsrv%indxbnds_count
3310 n = obsrv%indxbnds(j)
3312 select case (obsrv%ObsTypeId)
3317 if (this%imover == 1)
then
3318 v = this%pakmvrobj%get_qtomvr(n)
3325 if (this%imover == 1)
then
3326 v = this%pakmvrobj%get_qfrommvr(n)
3333 v = this%qoutflow(n)
3334 case (
'EXT-OUTFLOW')
3335 v = this%qextoutflow(n)
3337 if (this%iboundpak(n) /= 0)
then
3343 v = this%simrunoff(n)
3344 case (
'EVAPORATION')
3348 case (
'UPSTREAM-FLOW')
3350 if (this%imover == 1)
then
3351 v = v + this%pakmvrobj%get_qfrommvr(n)
3353 case (
'DOWNSTREAM-FLOW')
3360 case (
'WET-PERIMETER')
3361 v = this%calc_perimeter_wet(n, this%depth(n))
3363 v = this%calc_area_wet(n, this%depth(n))
3365 v = this%calc_top_width_wet(n, this%depth(n))
3367 msg =
'Unrecognized observation type: '//trim(obsrv%ObsTypeId)
3370 call this%obs%SaveOneSimval(obsrv, v)
3376 call this%parser%StoreErrorUnit()
3379 end subroutine sfr_bd_obs
3385 subroutine sfr_rp_obs(this)
3389 class(sfrtype),
intent(inout) :: this
3394 character(len=LENBOUNDNAME) :: bname
3395 logical(LGP) :: jfound
3398 10
format(
'Boundary "', a,
'" for observation "', a, &
3399 '" is invalid in package "', a,
'"')
3400 30
format(
'Boundary name not provided for observation "', a, &
3401 '" in package "', a,
'"')
3407 do i = 1, this%obs%npakobs
3408 obsrv => this%obs%pakobs(i)%obsrv
3411 nn1 = obsrv%NodeNumber
3413 bname = obsrv%FeatureName
3414 if (bname /=
'')
then
3419 do j = 1, this%maxbound
3420 if (this%boundname(j) == bname)
then
3422 call obsrv%AddObsIndex(j)
3425 if (.not. jfound)
then
3427 trim(bname), trim(obsrv%name), trim(this%packName)
3431 write (
errmsg, 30) trim(obsrv%name), trim(this%packName)
3434 else if (nn1 < 1 .or. nn1 > this%maxbound)
then
3435 write (
errmsg,
'(a,1x,a,1x,i0,1x,a,1x,i0,a)') &
3436 trim(adjustl(obsrv%ObsTypeId)), &
3437 'reach must be greater than 0 and less than or equal to', &
3438 this%maxbound,
'(specified value is ', nn1,
')'
3441 if (obsrv%indxbnds_count == 0)
then
3442 call obsrv%AddObsIndex(nn1)
3444 errmsg =
'Programming error in sfr_rp_obs'
3451 if (obsrv%ObsTypeId ==
'STAGE' .or. &
3452 obsrv%ObsTypeId ==
'DEPTH' .or. &
3453 obsrv%ObsTypeId ==
'WET-PERIMETER' .or. &
3454 obsrv%ObsTypeId ==
'WET-AREA' .or. &
3455 obsrv%ObsTypeId ==
'WET-WIDTH')
then
3456 nn1 = obsrv%NodeNumber
3458 if (obsrv%indxbnds_count > 1)
then
3459 write (
errmsg,
'(a,3(1x,a))') &
3460 trim(adjustl(obsrv%ObsTypeId)), &
3461 'for observation', trim(adjustl(obsrv%Name)), &
3462 ' must be assigned to a reach with a unique boundname.'
3469 do j = 1, obsrv%indxbnds_count
3470 nn1 = obsrv%indxbnds(j)
3471 if (nn1 < 1 .or. nn1 > this%maxbound)
then
3472 write (
errmsg,
'(a,1x,a,1x,i0,1x,a,1x,i0,a)') &
3473 trim(adjustl(obsrv%ObsTypeId)), &
3474 'reach must be greater than 0 and less than or equal to', &
3475 this%maxbound,
'(specified value is ', nn1,
')'
3483 call this%parser%StoreErrorUnit()
3486 end subroutine sfr_rp_obs
3495 subroutine sfr_process_obsid(obsrv, dis, inunitobs, iout)
3499 integer(I4B),
intent(in) :: inunitobs
3500 integer(I4B),
intent(in) :: iout
3503 integer(I4B) :: icol
3504 integer(I4B) :: istart
3505 integer(I4B) :: istop
3506 character(len=LINELENGTH) :: string
3507 character(len=LENBOUNDNAME) :: bndname
3510 string = obsrv%IDstring
3520 obsrv%FeatureName = bndname
3524 obsrv%NodeNumber = nn1
3525 end subroutine sfr_process_obsid
3535 subroutine sfr_set_stressperiod(this, n, ichkustrm, crossfile)
3539 class(sfrtype),
intent(inout) :: this
3540 integer(I4B),
intent(in) :: n
3541 integer(I4B),
intent(inout) :: ichkustrm
3542 character(len=LINELENGTH),
intent(inout) :: crossfile
3544 character(len=10) :: cnum
3545 character(len=LINELENGTH) :: text
3546 character(len=LINELENGTH) :: caux
3547 character(len=LINELENGTH) :: keyword
3548 integer(I4B) :: ival
3551 integer(I4B) :: idiv
3552 integer(I4B) :: ixserror
3553 character(len=10) :: cp
3555 real(DP),
pointer :: bndElem => null()
3561 call this%parser%GetStringCaps(keyword)
3562 select case (keyword)
3565 call this%parser%GetStringCaps(text)
3566 if (text ==
'INACTIVE')
then
3567 this%iboundpak(n) = 0
3568 else if (text ==
'ACTIVE')
then
3569 this%iboundpak(n) = 1
3570 else if (text ==
'SIMPLE')
then
3571 this%iboundpak(n) = -1
3574 'Unknown '//trim(this%text)//
' sfr status keyword: ', trim(text)
3578 call this%parser%GetString(text)
3580 bndelem => this%hk(n)
3582 this%packName,
'BND', &
3583 this%tsManager, this%iprpak, &
3586 call this%parser%GetString(text)
3588 bndelem => this%rough(n)
3590 this%packName,
'BND', &
3591 this%tsManager, this%iprpak, &
3594 call this%parser%GetString(text)
3596 bndelem => this%sstage(n)
3598 this%packName,
'BND', &
3599 this%tsManager, this%iprpak,
'STAGE')
3601 call this%parser%GetString(text)
3603 bndelem => this%rain(n)
3605 this%packName,
'BND', &
3606 this%tsManager, this%iprpak,
'RAIN')
3607 case (
'EVAPORATION')
3608 call this%parser%GetString(text)
3610 bndelem => this%evap(n)
3612 this%packName,
'BND', &
3613 this%tsManager, this%iprpak, &
3616 call this%parser%GetString(text)
3618 bndelem => this%runoff(n)
3620 this%packName,
'BND', &
3621 this%tsManager, this%iprpak, &
3624 call this%parser%GetString(text)
3626 bndelem => this%inflow(n)
3628 this%packName,
'BND', &
3629 this%tsManager, this%iprpak, &
3634 if (this%ndiv(n) < 1)
then
3635 write (cnum,
'(i0)') n
3636 errmsg =
'diversions cannot be specified for reach '//trim(cnum)
3641 ival = this%parser%GetInteger()
3642 if (ival < 1 .or. ival > this%ndiv(n))
then
3643 write (cnum,
'(i0)') n
3644 errmsg =
'Reach '//trim(cnum)
3645 write (cnum,
'(i0)') this%ndiv(n)
3646 errmsg = trim(
errmsg)//
' diversion number should be between 1 '// &
3647 'and '//trim(cnum)//
'.'
3653 call this%parser%GetString(text)
3654 ii = this%iadiv(n) + idiv - 1
3656 bndelem => this%divflow(ii)
3658 this%packName,
'BND', &
3659 this%tsManager, this%iprpak, &
3663 cp = this%divcprior(ii)
3664 divq = this%divflow(ii)
3665 if (cp ==
'FRACTION' .and. (divq <
dzero .or. divq >
done))
then
3666 write (
errmsg,
'(a,1x,i0,a)') &
3667 'cprior is type FRACTION for diversion no.', ii, &
3668 ', but divflow not within the range 0.0 to 1.0'
3671 case (
'UPSTREAM_FRACTION')
3673 call this%parser%GetString(text)
3675 bndelem => this%ustrf(n)
3677 this%packName,
'BND', &
3678 this%tsManager, this%iprpak,
'USTRF')
3680 case (
'CROSS_SECTION')
3684 call this%parser%GetStringCaps(keyword)
3685 select case (keyword)
3687 call this%parser%GetStringCaps(keyword)
3688 if (trim(adjustl(keyword)) /=
'FILEIN')
then
3689 errmsg =
'TAB6 keyword must be followed by "FILEIN" '// &
3694 if (ixserror == 0)
then
3695 call this%parser%GetString(crossfile)
3698 write (
errmsg,
'(a,1x,i4,1x,a)') &
3699 'CROSS-SECTION TABLE ENTRY for REACH ', n, &
3700 'MUST INCLUDE TAB6 KEYWORD'
3705 call this%parser%GetStringCaps(caux)
3706 do jj = 1, this%naux
3707 if (trim(adjustl(caux)) /= trim(adjustl(this%auxname(jj)))) cycle
3708 call this%parser%GetString(text)
3710 bndelem => this%rauxvar(jj, ii)
3712 this%packName,
'AUX', &
3713 this%tsManager, this%iprpak, &
3719 write (
errmsg,
'(a,a)') &
3720 'Unknown '//trim(this%text)//
' sfr data keyword: ', &
3724 end subroutine sfr_set_stressperiod
3730 subroutine sfr_solve(this, n, h, hcof, rhs, update)
3732 class(sfrtype) :: this
3733 integer(I4B),
intent(in) :: n
3734 real(DP),
intent(in) :: h
3735 real(DP),
intent(inout) :: hcof
3736 real(DP),
intent(inout) :: rhs
3737 logical(LGP),
intent(in),
optional :: update
3739 logical(LGP) :: lupdate
3752 real(DP) :: qfrommvr
3765 if (
present(update))
then
3775 if (this%iboundpak(n) == 0)
then
3776 this%depth(n) =
dzero
3778 this%usflow(n) =
dzero
3779 this%simevap(n) =
dzero
3780 this%simrunoff(n) =
dzero
3781 this%dsflow(n) =
dzero
3782 this%gwflow(n) =
dzero
3794 do i = this%ia(n) + 1, this%ia(n + 1) - 1
3795 if (this%idir(i) < 0) cycle
3797 do ii = this%ia(n2) + 1, this%ia(n2 + 1) - 1
3798 if (this%idir(ii) > 0) cycle
3799 if (this%ja(ii) /= n) cycle
3800 qu = qu + this%qconn(ii)
3806 sa = this%calc_surface_area(n)
3807 sa_wet = this%calc_surface_area_wet(n, this%depth(n))
3809 qr = this%rain(n) * sa
3810 qe = this%evap(n) * sa_wet
3811 qro = this%runoff(n)
3815 if (this%imover == 1)
then
3816 qfrommvr = this%pakmvrobj%get_qfrommvr(n)
3820 qsrc = qu + qi + qr - qe + qro + qfrommvr
3823 call this%sfr_adjust_ro_ev(qsrc, qu, qi, qr, qro, qe, qfrommvr)
3826 this%simevap(n) = qe
3827 this%simrunoff(n) = qro
3830 if (this%iboundpak(n) < 0)
then
3831 call this%sfr_calc_constant(n, d1, hgwf, qgwf, qd)
3833 if (this%gwfiss == 0 .and. this%istorage == 1)
then
3834 if (this%ats_courant /=
dnodata)
then
3835 call this%sfr_calc_tvd(n, d1, hgwf, qu, qi, &
3836 qfrommvr, qr, qe, qro, &
3839 call this%sfr_calc_transient(n, d1, hgwf, qu, qi, &
3840 qfrommvr, qr, qe, qro, &
3844 call this%sfr_calc_steady(n, d1, hgwf, qu, qi, &
3845 qfrommvr, qr, qe, qro, &
3852 bt = tp - this%bthick(n)
3859 this%stage(n) = hsfr
3861 call this%sfr_update_flows(n, qd, qgwf)
3867 if (this%gwfiss == 0)
then
3878 call this%sfr_calc_qgwf(n, d1, hgwf, qgwf, gwfhcof, gwfrhs)
3881 if (abs(sumleak) >
dzero)
then
3886 else if ((sumleak - qsrc) < -
dem30)
then
3887 if (this%gwfiss == 0)
then
3888 rhs = rhs + gwfrhs - sumrch
3895 if (this%gwfiss == 0)
then
3896 rhs = rhs - sumleak - sumrch
3903 else if (hgwf < bt)
then
3907 end subroutine sfr_solve
3914 subroutine sfr_update_flows(this, n, qd, qgwf)
3916 class(sfrtype),
intent(inout) :: this
3917 integer(I4B),
intent(in) :: n
3918 real(DP),
intent(inout) :: qd
3919 real(DP),
intent(in) :: qgwf
3923 integer(I4B) :: idiv
3924 integer(I4B) :: jpos
3934 this%gwflow(n) = qgwf
3937 if (qd >
dzero)
then
3940 do i = this%ia(n) + 1, this%ia(n + 1) - 1
3941 if (this%idir(i) > 0) cycle
3943 if (idiv == 0) cycle
3944 jpos = this%iadiv(n) + idiv - 1
3945 call this%sfr_calc_div(n, idiv, qd, qdiv)
3946 this%qconn(i) = qdiv
3947 this%divq(jpos) = qdiv
3953 if (this%imover == 1)
then
3954 call this%pakmvrobj%accumulate_qformvr(n, qd)
3955 qd = max(qd - this%pakmvrobj%get_qtomvr(n),
dzero)
3959 do i = this%ia(n) + 1, this%ia(n + 1) - 1
3960 if (this%idir(i) > 0) cycle
3961 if (this%idiv(i) > 0) cycle
3963 if (this%iboundpak(n2) == 0) cycle
3964 f = this%ustrf(n2) / this%ftotnd(n)
3965 this%qconn(i) = qd * f
3968 do i = this%ia(n) + 1, this%ia(n + 1) - 1
3969 if (this%idir(i) > 0) cycle
3970 this%qconn(i) =
dzero
3972 if (idiv == 0) cycle
3973 jpos = this%iadiv(n) + idiv - 1
3974 this%divq(jpos) =
dzero
3977 end subroutine sfr_update_flows
3984 subroutine sfr_adjust_ro_ev(this, qc, qu, qi, qr, qro, qe, qfrommvr)
3986 class(sfrtype) :: this
3987 real(DP),
intent(inout) :: qc
3988 real(DP),
intent(in) :: qu
3989 real(DP),
intent(in) :: qi
3990 real(DP),
intent(in) :: qr
3991 real(DP),
intent(inout) :: qro
3992 real(DP),
intent(inout) :: qe
3993 real(DP),
intent(in) :: qfrommvr
3998 if (qc <
dzero)
then
4001 qt = qu + qi + qr + qro + qfrommvr
4004 if (qt <
dzero)
then
4005 if (qro <
dzero)
then
4006 qro = -(qu + qi + qr + qfrommvr)
4012 if (qe >
dzero)
then
4013 qe = qu + qi + qr + qro + qfrommvr
4016 qc = qu + qi + qr - qe + qro + qfrommvr
4018 end subroutine sfr_adjust_ro_ev
4024 subroutine sfr_calc_qd(this, n, depth, hgwf, qgwf, qd)
4026 class(sfrtype) :: this
4027 integer(I4B),
intent(in) :: n
4028 real(DP),
intent(in) :: depth
4029 real(DP),
intent(in) :: hgwf
4030 real(DP),
intent(inout) :: qgwf
4031 real(DP),
intent(inout) :: qd
4039 call this%sfr_calc_qsource(n, depth, qsrc)
4042 call this%sfr_calc_qgwf(n, depth, hgwf, qgwf)
4043 if (-qgwf > qsrc) qgwf = -qsrc
4050 end subroutine sfr_calc_qd
4057 subroutine sfr_calc_qsource(this, n, depth, qsrc)
4059 class(sfrtype) :: this
4060 integer(I4B),
intent(in) :: n
4061 real(DP),
intent(in) :: depth
4062 real(DP),
intent(inout) :: qsrc
4069 real(DP) :: qfrommvr
4079 qro = this%runoff(n)
4082 a = this%calc_surface_area(n)
4083 ae = this%calc_surface_area_wet(n, depth)
4084 qr = this%rain(n) * a
4085 qe = this%evap(n) * ae
4089 if (this%imover == 1)
then
4090 qfrommvr = this%pakmvrobj%get_qfrommvr(n)
4094 qsrc = qu + qi + qr - qe + qro + qfrommvr
4097 call this%sfr_adjust_ro_ev(qsrc, qu, qi, qr, qro, qe, qfrommvr)
4098 end subroutine sfr_calc_qsource
4105 subroutine sfr_calc_qman(this, n, depth, qman)
4107 class(sfrtype) :: this
4108 integer(I4B),
intent(in) :: n
4109 real(DP),
intent(in) :: depth
4110 real(DP),
intent(inout) :: qman
4112 integer(I4B) :: npts
4127 if (depth >
dzero)
then
4128 npts = this%ncrosspts(n)
4139 i0 = this%iacross(n)
4140 i1 = this%iacross(n + 1) - 1
4145 this%station(i0:i1), &
4146 this%xsheight(i0:i1), &
4147 this%xsrough(i0:i1), &
4154 aw = this%calc_area_wet(n, depth)
4155 wp = this%calc_perimeter_wet(n, depth)
4156 if (wp >
dzero)
then
4161 qman = this%unitconv * aw * (rh**
dtwothirds) * sqrt(s) / r
4167 end subroutine sfr_calc_qman
4175 subroutine sfr_calc_qgwf(this, n, depth, hgwf, qgwf, gwfhcof, gwfrhs)
4177 class(sfrtype) :: this
4178 integer(I4B),
intent(in) :: n
4179 real(DP),
intent(in) :: depth
4180 real(DP),
intent(in) :: hgwf
4181 real(DP),
intent(inout) :: qgwf
4182 real(DP),
intent(inout),
optional :: gwfhcof
4183 real(DP),
intent(inout),
optional :: gwfrhs
4185 integer(I4B) :: node
4193 real(DP) :: gwfhcof0
4200 node = this%igwfnode(n)
4201 if (node < 1)
return
4204 if (this%ibound(node) == 0)
return
4211 bt = tp - this%bthick(n)
4214 if (h_temp < bt)
then
4219 call this%sfr_calc_cond(n, depth, cond, hsfr, h_temp)
4222 qgwf = sat * cond * (h_temp - hsfr)
4223 gwfrhs0 = -sat * cond * hsfr
4224 gwfhcof0 = -sat * cond
4227 if (this%idense /= 0)
then
4228 call this%sfr_calculate_density_exchange(n, hsfr, hgwf, cond, tp, &
4229 qgwf, gwfhcof0, gwfrhs0)
4233 if (
present(gwfhcof)) gwfhcof = gwfhcof0
4234 if (
present(gwfrhs)) gwfrhs = gwfrhs0
4235 end subroutine sfr_calc_qgwf
4242 function sfr_gwf_conn(this, n)
4244 integer(I4B) :: sfr_gwf_conn
4246 class(sfrtype) :: this
4247 integer(I4B),
intent(in) :: n
4249 integer(I4B) :: node
4252 node = this%igwfnode(n)
4253 if (node > 0 .and. this%hk(n) >
dzero)
then
4256 end function sfr_gwf_conn
4262 subroutine sfr_calc_cond(this, n, depth, cond, hsfr, h_temp)
4264 class(sfrtype) :: this
4265 integer(I4B),
intent(in) :: n
4266 real(DP),
intent(in) :: depth
4267 real(DP),
intent(inout) :: cond
4268 real(DP),
intent(in),
optional :: hsfr
4269 real(DP),
intent(in),
optional :: h_temp
4271 integer(I4B) :: node
4273 real(DP) :: vscratio
4283 node = this%igwfnode(n)
4285 if (this%ibound(node) > 0)
then
4288 if (this%ivsc == 1)
then
4289 if (hsfr > h_temp)
then
4291 vscratio = this%viscratios(1, n)
4293 vscratio = this%viscratios(2, n)
4296 wp = this%calc_perimeter_wet(n, depth)
4297 cond = this%hk(n) * vscratio * this%length(n) * wp / this%bthick(n)
4300 end subroutine sfr_calc_cond
4309 subroutine sfr_calc_div(this, n, i, qd, qdiv)
4311 class(sfrtype) :: this
4312 integer(I4B),
intent(in) :: n
4313 integer(I4B),
intent(in) :: i
4314 real(DP),
intent(inout) :: qd
4315 real(DP),
intent(inout) :: qdiv
4317 character(len=10) :: cp
4318 integer(I4B) :: jpos
4323 jpos = this%iadiv(n) + i - 1
4324 n2 = this%divreach(jpos)
4325 cp = this%divcprior(jpos)
4326 v = this%divflow(jpos)
4357 end subroutine sfr_calc_div
4363 subroutine sfr_calc_reach_depth(this, n, q1, d1)
4365 class(sfrtype) :: this
4366 integer(I4B),
intent(in) :: n
4367 real(DP),
intent(in) :: q1
4368 real(DP),
intent(inout) :: d1
4380 if (q1 >
dzero)
then
4381 if (this%ncrosspts(n) > 1)
then
4382 call this%sfr_calc_xs_depth(n, q1, d1)
4384 w = this%station(this%iacross(n))
4385 qconst = this%unitconv * w * sqrt(s) / r
4386 d1 = (q1 / qconst)**
dp6
4391 end subroutine sfr_calc_reach_depth
4398 subroutine sfr_calc_xs_depth(this, n, qrch, d)
4400 class(sfrtype) :: this
4401 integer(I4B),
intent(in) :: n
4402 real(DP),
intent(in) :: qrch
4403 real(DP),
intent(inout) :: d
4405 integer(I4B) :: iter
4406 real(DP) :: perturbation
4412 real(DP) :: residual
4415 perturbation = this%deps *
dtwo
4418 residual = q0 - qrch
4421 nriter:
do iter = 1, this%maxsfrit
4422 call this%sfr_calc_qman(n, d + perturbation, q1)
4424 if (dq /=
dzero)
then
4425 derv = perturbation / (q1 - q0)
4429 dd = derv * residual
4431 call this%sfr_calc_qman(n, d, q0)
4432 residual = q0 - qrch
4435 if (abs(dd) < this%dmaxchg)
then
4439 end subroutine sfr_calc_xs_depth
4446 subroutine sfr_check_conversion(this)
4448 class(sfrtype) :: this
4451 character(len=*),
parameter :: fmtunitconv_error = &
4452 &
"('SFR (',a,') UNIT_CONVERSION SPECIFIED VALUE (',g0,') AND', &
4453 &1x,'LENGTH_CONVERSION OR TIME_CONVERSION SPECIFIED.')"
4454 character(len=*),
parameter :: fmtunitconv = &
4455 &
"(1x,'SFR PACKAGE (',a,') CONVERSION DATA',&
4456 &/4x,'UNIT CONVERSION VALUE (',g0,').',/)"
4459 if (this%lengthconv /=
dnodata .or. this%timeconv /=
dnodata)
then
4460 if (this%unitconv /=
done)
then
4461 write (
errmsg, fmtunitconv_error) &
4462 trim(adjustl(this%packName)), this%unitconv
4465 if (this%lengthconv /=
dnodata)
then
4466 this%unitconv = this%unitconv * this%lengthconv**
donethird
4468 if (this%timeconv /=
dnodata)
then
4469 this%unitconv = this%unitconv * this%timeconv
4471 write (this%iout, fmtunitconv) &
4472 trim(adjustl(this%packName)), this%unitconv
4475 end subroutine sfr_check_conversion
4483 subroutine sfr_check_storage_weight(this)
4485 class(sfrtype) :: this
4487 character(len=*),
parameter :: fmtweight = &
4488 &
"(1x,'SFR PACKAGE (',a,') SETTING DEFAULT',&
4489 &/4x,'STORAGE_WEIGHT VALUE (',g0,').',/)"
4492 if (this%istorage == 1)
then
4493 if (this%storage_weight ==
dnodata)
then
4494 this%storage_weight =
done
4495 write (this%iout, fmtweight) &
4496 trim(adjustl(this%packName)), this%storage_weight
4499 end subroutine sfr_check_storage_weight
4507 subroutine sfr_check_reaches(this)
4509 class(sfrtype) :: this
4511 character(len=5) :: crch
4512 character(len=10) :: cval
4513 character(len=30) :: nodestr
4514 character(len=LINELENGTH) :: title
4515 character(len=LINELENGTH) :: text
4522 if (this%iprpak /= 0)
then
4523 title = trim(adjustl(this%text))//
' PACKAGE ('// &
4524 trim(adjustl(this%packName))//
') STATIC REACH DATA'
4525 call table_cr(this%inputtab, this%packName, title)
4526 call this%inputtab%table_df(this%maxbound, 10, this%iout)
4528 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
4530 call this%inputtab%initialize_column(text, 20, alignment=
tableft)
4532 call this%inputtab%initialize_column(text, 12, alignment=
tabcenter)
4534 call this%inputtab%initialize_column(text, 12, alignment=
tabcenter)
4536 call this%inputtab%initialize_column(text, 12, alignment=
tabcenter)
4538 call this%inputtab%initialize_column(text, 12, alignment=
tabcenter)
4540 call this%inputtab%initialize_column(text, 12, alignment=
tabcenter)
4542 call this%inputtab%initialize_column(text, 12, alignment=
tabcenter)
4544 call this%inputtab%initialize_column(text, 12, alignment=
tabcenter)
4545 text =
'UPSTREAM FRACTION'
4546 call this%inputtab%initialize_column(text, 12, alignment=
tabcenter)
4550 do n = 1, this%maxbound
4551 write (crch,
'(i5)') n
4552 nn = this%igwfnode(n)
4554 btgwf = this%dis%bot(nn)
4555 call this%dis%noder_to_string(nn, nodestr)
4560 if (this%length(n) <=
dzero)
then
4561 errmsg =
'Reach '//crch//
' length must be greater than 0.0.'
4565 if (this%width(n) <=
dzero)
then
4566 errmsg =
'Reach '//crch//
' width must be greater than 0.0.'
4570 if (this%slope(n) <=
dzero)
then
4571 errmsg =
'Reach '//crch//
' slope must be greater than 0.0.'
4576 bt = this%strtop(n) - this%bthick(n)
4577 if (bt <= btgwf .and. this%icheck /= 0)
then
4578 write (cval,
'(f10.4)') bt
4579 errmsg =
'Reach '//crch//
' bed bottom (rtp-rbth ='// &
4580 cval//
') must be greater than the bottom of cell ('// &
4582 write (cval,
'(f10.4)') btgwf
4586 if (this%hk(n) <
dzero)
then
4587 errmsg =
'Reach '//crch//
' hk must be greater than or equal to 0.0.'
4592 if (this%rough(n) <=
dzero)
then
4593 errmsg =
'Reach '//crch//
" Manning's roughness "// &
4594 'coefficient must be greater than 0.0.'
4598 if (this%ustrf(n) <
dzero)
then
4599 errmsg =
'Reach '//crch//
' upstream fraction must be greater '// &
4600 'than or equal to 0.0.'
4604 if (this%iprpak /= 0)
then
4605 call this%inputtab%add_term(n)
4606 call this%inputtab%add_term(nodestr)
4607 call this%inputtab%add_term(this%length(n))
4608 call this%inputtab%add_term(this%width(n))
4609 call this%inputtab%add_term(this%slope(n))
4610 call this%inputtab%add_term(this%strtop(n))
4611 call this%inputtab%add_term(this%bthick(n))
4612 call this%inputtab%add_term(this%hk(n))
4613 call this%inputtab%add_term(this%rough(n))
4614 call this%inputtab%add_term(this%ustrf(n))
4617 end subroutine sfr_check_reaches
4625 subroutine sfr_check_connections(this)
4627 class(sfrtype) :: this
4629 logical(LGP) :: lreorder
4630 character(len=5) :: crch
4631 character(len=5) :: crch2
4632 character(len=LINELENGTH) :: text
4633 character(len=LINELENGTH) :: title
4640 integer(I4B) :: ifound
4641 integer(I4B) :: ierr
4642 integer(I4B) :: maxconn
4643 integer(I4B) :: ntabcol
4647 do j = 1, this%MAXBOUND
4648 n = this%isfrorder(j)
4657 write (this%iout,
'(/,1x,a)') &
4658 trim(adjustl(this%text))//
' PACKAGE ('// &
4659 trim(adjustl(this%packName))//
') REACH SOLUTION HAS BEEN '// &
4660 'REORDERED USING A DAG'
4663 if (this%iprpak /= 0)
then
4667 title = trim(adjustl(this%text))//
' PACKAGE ('// &
4668 trim(adjustl(this%packName))//
') REACH SOLUTION ORDER'
4669 call table_cr(this%inputtab, this%packName, title)
4670 call this%inputtab%table_df(this%maxbound, ntabcol, this%iout)
4672 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
4674 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
4677 do j = 1, this%maxbound
4678 n = this%isfrorder(j)
4679 call this%inputtab%add_term(j)
4680 call this%inputtab%add_term(n)
4686 if (this%iprpak /= 0)
then
4690 do n = 1, this%maxbound
4691 maxconn = max(maxconn, this%nconnreach(n))
4693 ntabcol = 1 + maxconn
4696 title = trim(adjustl(this%text))//
' PACKAGE ('// &
4697 trim(adjustl(this%packName))//
') STATIC REACH CONNECTION DATA'
4698 call table_cr(this%inputtab, this%packName, title)
4699 call this%inputtab%table_df(this%maxbound, ntabcol, this%iout)
4701 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
4703 write (text,
'(a,1x,i6)')
'CONN', n
4704 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
4710 do n = 1, this%MAXBOUND
4711 write (crch,
'(i5)') n
4712 eachconn:
do i = this%ia(n) + 1, this%ia(n + 1) - 1
4714 write (crch2,
'(i5)') nn
4716 connreach:
do ii = this%ia(nn) + 1, this%ia(nn + 1) - 1
4723 if (ifound /= 1)
then
4724 errmsg =
'Reach '//crch//
' is connected to '// &
4725 'reach '//crch2//
' but reach '//crch2// &
4726 ' is not connected to reach '//crch//
'.'
4732 if (this%iprpak /= 0)
then
4733 call this%inputtab%add_term(n)
4734 do i = this%ia(n) + 1, this%ia(n + 1) - 1
4735 call this%inputtab%add_term(this%ja(i))
4737 nn = maxconn - this%nconnreach(n)
4739 call this%inputtab%add_term(
' ')
4748 do n = 1, this%maxbound
4749 write (crch,
'(i5)') n
4750 eachconnv:
do i = this%ia(n) + 1, this%ia(n + 1) - 1
4753 if (this%idir(i) < 0) cycle eachconnv
4755 write (crch2,
'(i5)') nn
4756 connreachv:
do ii = this%ia(nn) + 1, this%ia(nn + 1) - 1
4758 if (this%idir(ii) < 0) cycle connreachv
4765 errmsg =
'Reach '//crch//
' is connected to '// &
4766 'reach '//crch2//
' but streamflow from reach '// &
4767 crch//
' to reach '//crch2//
' is not permitted.'
4777 call this%parser%StoreErrorUnit()
4782 do n = 1, this%maxbound
4783 write (crch,
'(i5)') n
4784 eachconnds:
do i = this%ia(n) + 1, this%ia(n + 1) - 1
4786 if (this%idir(i) > 0) cycle eachconnds
4787 write (crch2,
'(i5)') nn
4789 connreachds:
do ii = this%ia(nn) + 1, this%ia(nn + 1) - 1
4792 if (this%idir(i) /= this%idir(ii))
then
4798 if (ifound /= 1)
then
4799 errmsg =
'Reach '//crch//
' downstream connected reach '// &
4800 'is reach '//crch2//
' but reach '//crch//
' is not'// &
4801 ' the upstream connected reach for reach '//crch2//
'.'
4808 if (this%iprpak /= 0)
then
4812 do n = 1, this%maxbound
4814 do i = this%ia(n) + 1, this%ia(n + 1) - 1
4815 if (this%idir(i) > 0)
then
4819 maxconn = max(maxconn, ii)
4821 ntabcol = 1 + maxconn
4824 title = trim(adjustl(this%text))//
' PACKAGE ('// &
4825 trim(adjustl(this%packName))//
') STATIC UPSTREAM REACH '// &
4827 call table_cr(this%inputtab, this%packName, title)
4828 call this%inputtab%table_df(this%maxbound, ntabcol, this%iout)
4830 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
4832 write (text,
'(a,1x,i6)')
'UPSTREAM CONN', n
4833 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
4837 do n = 1, this%maxbound
4838 call this%inputtab%add_term(n)
4840 do i = this%ia(n) + 1, this%ia(n + 1) - 1
4841 if (this%idir(i) > 0)
then
4842 call this%inputtab%add_term(this%ja(i))
4848 call this%inputtab%add_term(
' ')
4854 do n = 1, this%maxbound
4856 do i = this%ia(n) + 1, this%ia(n + 1) - 1
4857 if (this%idir(i) < 0)
then
4861 maxconn = max(maxconn, ii)
4863 ntabcol = 1 + maxconn
4866 title = trim(adjustl(this%text))//
' PACKAGE ('// &
4867 trim(adjustl(this%packName))//
') STATIC DOWNSTREAM '// &
4868 'REACH CONNECTION DATA'
4869 call table_cr(this%inputtab, this%packName, title)
4870 call this%inputtab%table_df(this%maxbound, ntabcol, this%iout)
4872 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
4874 write (text,
'(a,1x,i6)')
'DOWNSTREAM CONN', n
4875 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
4879 do n = 1, this%maxbound
4880 call this%inputtab%add_term(n)
4882 do i = this%ia(n) + 1, this%ia(n + 1) - 1
4883 if (this%idir(i) < 0)
then
4884 call this%inputtab%add_term(this%ja(i))
4890 call this%inputtab%add_term(
' ')
4894 end subroutine sfr_check_connections
4902 subroutine sfr_check_diversions(this)
4904 class(sfrtype) :: this
4906 character(len=LINELENGTH) :: title
4907 character(len=LINELENGTH) :: text
4908 character(len=5) :: crch
4909 character(len=5) :: cdiv
4910 character(len=5) :: crch2
4911 character(len=10) :: cprior
4912 integer(I4B) :: maxdiv
4917 integer(I4B) :: idiv
4918 integer(I4B) :: ifound
4919 integer(I4B) :: jpos
4921 10
format(
'Diversion ', i0,
' of reach ', i0, &
4922 ' is invalid or has not been defined.')
4925 if (this%iprpak /= 0)
then
4929 do n = 1, this%maxbound
4930 maxdiv = maxdiv + this%ndiv(n)
4934 title = trim(adjustl(this%text))//
' PACKAGE ('// &
4935 trim(adjustl(this%packName))//
') REACH DIVERSION DATA'
4936 call table_cr(this%inputtab, this%packName, title)
4937 call this%inputtab%table_df(maxdiv, 4, this%iout)
4939 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
4941 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
4943 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
4945 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
4949 do n = 1, this%maxbound
4950 if (this%ndiv(n) < 1) cycle
4951 write (crch,
'(i5)') n
4953 do idiv = 1, this%ndiv(n)
4956 jpos = this%iadiv(n) + idiv - 1
4959 write (cdiv,
'(i5)') idiv
4962 nn = this%divreach(jpos)
4963 write (crch2,
'(i5)') nn
4967 if (nn < 1 .or. nn > this%maxbound)
then
4968 write (
errmsg, 10) idiv, n
4972 connreach:
do ii = this%ia(nn) + 1, this%ia(nn + 1) - 1
4975 if (this%idir(ii) > 0)
then
4981 if (ifound /= 1)
then
4982 errmsg =
'Reach '//crch//
' is not a upstream reach for '// &
4983 'reach '//crch2//
' as a result diversion '//cdiv// &
4984 ' from reach '//crch//
' to reach '//crch2// &
4985 ' is not possible. Check reach connectivity.'
4989 cprior = this%divcprior(jpos)
4992 if (this%iprpak /= 0)
then
4993 call this%inputtab%add_term(n)
4994 call this%inputtab%add_term(idiv)
4995 call this%inputtab%add_term(nn)
4996 call this%inputtab%add_term(cprior)
5000 end subroutine sfr_check_diversions
5009 subroutine sfr_check_initialstages(this)
5010 class(sfrtype) :: this
5012 character(len=LINELENGTH) :: title
5013 character(len=LINELENGTH) :: text
5014 character(len=5) :: crch
5019 if (this%istorage == 0)
return
5022 if (this%iprpak /= 0)
then
5025 title = trim(adjustl(this%text))//
' PACKAGE ('// &
5026 trim(adjustl(this%packName))//
') REACH INITIAL STAGE DATA'
5027 call table_cr(this%inputtab, this%packName, title)
5028 call this%inputtab%table_df(this%maxbound, 4, this%iout)
5030 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
5031 text =
'INITIAL STAGE'
5032 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
5033 text =
'INITIAL DEPTH'
5034 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
5035 text =
'INITIAL FLOW'
5036 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
5040 do n = 1, this%maxbound
5041 write (crch,
'(i5)') n
5044 call this%sfr_calc_qman(n, this%depth(n), qman)
5045 this%usinflow(n) = qman
5046 this%dsflow(n) = qman
5049 if (this%iprpak /= 0)
then
5050 call this%inputtab%add_term(n)
5051 call this%inputtab%add_term(this%stage(n))
5052 call this%inputtab%add_term(this%depth(n))
5053 call this%inputtab%add_term(qman)
5056 end subroutine sfr_check_initialstages
5064 subroutine sfr_check_ustrf(this)
5066 class(sfrtype) :: this
5068 character(len=LINELENGTH) :: title
5069 character(len=LINELENGTH) :: text
5070 logical(LGP) :: lcycle
5071 logical(LGP) :: ladd
5072 character(len=5) :: crch
5073 character(len=5) :: crch2
5074 character(len=10) :: cval
5075 integer(I4B) :: maxcols
5076 integer(I4B) :: npairs
5077 integer(I4B) :: ipair
5081 integer(I4B) :: idiv
5084 integer(I4B) :: jpos
5090 if (this%iprpak /= 0)
then
5094 do n = 1, this%maxbound
5096 ec:
do i = this%ia(n) + 1, this%ia(n + 1) - 1
5099 if (this%idir(i) > 0) cycle ec
5103 if (this%iboundpak(n2) == 0) cycle ec
5107 npairs = max(npairs, ipair)
5110 maxcols = 1 + npairs * 2
5113 title = trim(adjustl(this%text))//
' PACKAGE ('// &
5114 trim(adjustl(this%packName))//
') CONNECTED REACH UPSTREAM '// &
5116 call table_cr(this%inputtab, this%packName, title)
5117 call this%inputtab%table_df(this%maxbound, maxcols, this%iout)
5119 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
5121 write (cval,
'(i10)') i
5122 text =
'DOWNSTREAM REACH '//trim(adjustl(cval))
5123 call this%inputtab%initialize_column(text, 10, alignment=
tabcenter)
5124 text =
'FRACTION '//trim(adjustl(cval))
5125 call this%inputtab%initialize_column(text, 12, alignment=
tabcenter)
5130 do n = 1, this%maxbound
5131 do idiv = 1, this%ndiv(n)
5133 i1 = this%iadiv(n + 1) - 1
5135 do i = this%ia(n) + 1, this%ia(n + 1) - 1
5137 if (this%divreach(jpos) == n2)
then
5138 this%idiv(i) = jpos - i0 + 1
5148 do n = 1, this%maxbound
5152 do i = this%ia(n) + 1, this%ia(n + 1) - 1
5153 if (this%idir(i) < 0)
then
5159 do idiv = 1, this%ndiv(n)
5160 jpos = this%iadiv(n) + idiv - 1
5161 n2 = this%divreach(jpos)
5163 if (f /=
dzero)
then
5164 write (
errmsg,
'(a,2(1x,i0,1x,a),1x,a,g0,a,2(1x,a))') &
5165 'Reach', n,
'is connected to reach', n2,
'by a diversion', &
5166 'but the upstream fraction is not equal to zero (', f,
'). Check', &
5167 trim(this%packName),
'package diversion and package data.'
5171 write (
warnmsg,
'(a,3(1x,a))') &
5173 'A warning instead of an error is issued because', &
5174 'the reach is only connected to the diversion reach in the ', &
5175 'downstream direction.'
5185 do n = 1, this%maxbound
5189 write (crch,
'(i5)') n
5190 if (this%iprpak /= 0)
then
5191 call this%inputtab%add_term(n)
5194 eachconn:
do i = this%ia(n) + 1, this%ia(n + 1) - 1
5198 this%qconn(i) =
dzero
5201 if (this%idir(i) > 0)
then
5207 if (this%iboundpak(n2) == 0)
then
5214 write (crch2,
'(i5)') n2
5217 f = f + this%ustrf(n2)
5218 write (cval,
'(f10.4)') this%ustrf(n2)
5221 if (this%iprpak /= 0)
then
5222 call this%inputtab%add_term(n2)
5223 call this%inputtab%add_term(this%ustrf(n2))
5225 eachdiv:
do idiv = 1, this%ndiv(n)
5226 jpos = this%iadiv(n) + idiv - 1
5227 if (this%divreach(jpos) == n2)
then
5233 rval = rval + this%ustrf(n2)
5236 this%ftotnd(n) = rval
5239 if (this%iprpak /= 0)
then
5241 do i = ipair, npairs
5242 call this%inputtab%add_term(
' ')
5243 call this%inputtab%add_term(
' ')
5251 write (
errmsg,
'(a,1x,i0,1x,a,g0,a,3(1x,a))') &
5252 'Upstream fractions for reach ', n,
'is not equal to one (', f, &
5253 '). Check', trim(this%packName),
'package reach connectivity and', &
5259 end subroutine sfr_check_ustrf
5267 subroutine sfr_setup_budobj(this)
5269 class(sfrtype) :: this
5271 integer(I4B) :: nbudterm
5276 integer(I4B) :: maxlist
5277 integer(I4B) :: naux
5280 character(len=LENBUDTXT) :: text
5281 character(len=LENBUDTXT),
dimension(1) :: auxtxt
5288 if (this%imover == 1) nbudterm = nbudterm + 2
5289 if (this%naux > 0) nbudterm = nbudterm + 1
5293 call this%budobj%budgetobject_df(this%maxbound, nbudterm, 0, 0, &
5294 ibudcsv=this%ibudcsv)
5298 text =
' FLOW-JA-FACE'
5300 maxlist = this%nconn
5302 auxtxt(1) =
' FLOW-AREA'
5303 call this%budobj%budterm(idx)%initialize(text, &
5308 maxlist, .false., .false., &
5312 call this%budobj%budterm(idx)%reset(this%nconn)
5314 do n = 1, this%maxbound
5316 do i = this%ia(n) + 1, this%ia(n + 1) - 1
5318 call this%budobj%budterm(idx)%update_term(n1, n2, q)
5325 maxlist = this%maxbound - this%ianynone
5327 auxtxt(1) =
' FLOW-AREA'
5328 call this%budobj%budterm(idx)%initialize(text, &
5333 maxlist, .false., .true., &
5335 call this%budobj%budterm(idx)%reset(maxlist)
5337 do n = 1, this%maxbound
5338 n2 = this%igwfnode(n)
5340 call this%budobj%budterm(idx)%update_term(n, n2, q)
5347 maxlist = this%maxbound
5349 call this%budobj%budterm(idx)%initialize(text, &
5354 maxlist, .false., .false., &
5358 text =
' EVAPORATION'
5360 maxlist = this%maxbound
5362 call this%budobj%budterm(idx)%initialize(text, &
5367 maxlist, .false., .false., &
5373 maxlist = this%maxbound
5375 call this%budobj%budterm(idx)%initialize(text, &
5380 maxlist, .false., .false., &
5384 text =
' EXT-INFLOW'
5386 maxlist = this%maxbound
5388 call this%budobj%budterm(idx)%initialize(text, &
5393 maxlist, .false., .false., &
5397 text =
' EXT-OUTFLOW'
5399 maxlist = this%maxbound
5401 call this%budobj%budterm(idx)%initialize(text, &
5406 maxlist, .false., .false., &
5412 maxlist = this%maxbound
5414 auxtxt(1) =
' VOLUME'
5415 call this%budobj%budterm(idx)%initialize(text, &
5420 maxlist, .false., .false., &
5424 if (this%imover == 1)
then
5429 maxlist = this%maxbound
5431 call this%budobj%budterm(idx)%initialize(text, &
5436 maxlist, .false., .false., &
5442 maxlist = this%maxbound
5444 call this%budobj%budterm(idx)%initialize(text, &
5449 maxlist, .false., .false., &
5460 maxlist = this%maxbound
5461 call this%budobj%budterm(idx)%initialize(text, &
5466 maxlist, .false., .false., &
5471 if (this%iprflow /= 0)
then
5472 call this%budobj%flowtable_df(this%iout, cellids=
'GWF')
5474 end subroutine sfr_setup_budobj
5482 subroutine sfr_fill_budobj(this)
5484 class(sfrtype) :: this
5486 integer(I4B) :: naux
5493 integer(I4B) :: idiv
5494 integer(I4B) :: jpos
5508 call this%budobj%budterm(idx)%reset(this%nconn)
5509 do n = 1, this%maxbound
5513 do i = this%ia(n) + 1, this%ia(n + 1) - 1
5515 if (this%iboundpak(n) /= 0)
then
5517 if (this%idir(i) < 0)
then
5523 do ii = this%ia(n2) + 1, this%ia(n2 + 1) - 1
5524 if (this%idir(ii) > 0) cycle
5525 if (this%ja(ii) /= n) cycle
5531 call this%sfr_calc_reach_depth(n, qt, d)
5532 ca = this%calc_area_wet(n, d)
5537 this%qauxcbc(1) = ca
5538 call this%budobj%budterm(idx)%update_term(n1, n2, q, this%qauxcbc)
5544 call this%budobj%budterm(idx)%reset(this%maxbound - this%ianynone)
5545 do n = 1, this%maxbound
5546 n2 = this%igwfnode(n)
5548 if (this%iboundpak(n) /= 0)
then
5550 if (this%depth(n) >
dzero)
then
5551 wp = this%calc_perimeter_wet(n, this%depth(n))
5560 this%qauxcbc(1) =
dzero
5563 call this%budobj%budterm(idx)%update_term(n, n2, q, this%qauxcbc)
5569 call this%budobj%budterm(idx)%reset(this%maxbound)
5570 do n = 1, this%maxbound
5571 if (this%iboundpak(n) /= 0)
then
5572 a = this%calc_surface_area(n)
5573 q = this%rain(n) * a
5577 call this%budobj%budterm(idx)%update_term(n, n, q)
5582 call this%budobj%budterm(idx)%reset(this%maxbound)
5583 do n = 1, this%maxbound
5584 if (this%iboundpak(n) /= 0)
then
5585 q = -this%simevap(n)
5589 call this%budobj%budterm(idx)%update_term(n, n, q)
5594 call this%budobj%budterm(idx)%reset(this%maxbound)
5595 do n = 1, this%maxbound
5596 if (this%iboundpak(n) /= 0)
then
5597 q = this%simrunoff(n)
5601 call this%budobj%budterm(idx)%update_term(n, n, q)
5606 call this%budobj%budterm(idx)%reset(this%maxbound)
5607 do n = 1, this%maxbound
5608 if (this%iboundpak(n) /= 0)
then
5613 call this%budobj%budterm(idx)%update_term(n, n, q)
5618 call this%budobj%budterm(idx)%reset(this%maxbound)
5619 do n = 1, this%maxbound
5621 if (this%iboundpak(n) /= 0)
then
5622 do i = this%ia(n) + 1, this%ia(n + 1) - 1
5623 if (this%idir(i) > 0) cycle
5626 jpos = this%iadiv(n) + idiv - 1
5627 q = q + this%divq(jpos)
5629 q = q + this%qconn(i)
5632 q = q - this%dsflow(n)
5633 if (this%imover == 1)
then
5634 q = q + this%pakmvrobj%get_qtomvr(n)
5637 if (this%imover == 1)
then
5638 q = this%pakmvrobj%get_qfrommvr(n)
5641 call this%budobj%budterm(idx)%update_term(n, n, q)
5646 call this%budobj%budterm(idx)%reset(this%maxbound)
5647 do n = 1, this%maxbound
5649 if (this%iboundpak(n) /= 0)
then
5651 a = this%calc_surface_area_wet(n, d)
5652 this%qauxcbc(1) = a * d
5653 if (this%gwfiss == 0 .and. this%istorage == 1)
then
5658 this%qauxcbc(1) =
dzero
5660 call this%budobj%budterm(idx)%update_term(n, n, q, this%qauxcbc)
5664 if (this%imover == 1)
then
5668 call this%budobj%budterm(idx)%reset(this%maxbound)
5669 do n = 1, this%maxbound
5671 if (this%iboundpak(n) /= 0)
then
5672 q = this%pakmvrobj%get_qfrommvr(n)
5674 call this%budobj%budterm(idx)%update_term(n, n, q)
5679 call this%budobj%budterm(idx)%reset(this%maxbound)
5680 do n = 1, this%maxbound
5681 if (this%iboundpak(n) /= 0)
then
5682 q = this%pakmvrobj%get_qtomvr(n)
5689 call this%budobj%budterm(idx)%update_term(n, n, q)
5697 call this%budobj%budterm(idx)%reset(this%maxbound)
5698 do n = 1, this%maxbound
5700 call this%budobj%budterm(idx)%update_term(n, n, q, this%auxvar(:, n))
5705 call this%budobj%accumulate_terms()
5706 end subroutine sfr_fill_budobj
5714 subroutine sfr_setup_tableobj(this)
5716 class(sfrtype) :: this
5718 integer(I4B) :: nterms
5719 character(len=LINELENGTH) :: title
5720 character(len=LINELENGTH) :: text
5723 if (this%iprhed > 0)
then
5730 if (this%inamedbound == 1)
then
5735 title = trim(adjustl(this%text))//
' PACKAGE ('// &
5736 trim(adjustl(this%packName))//
') STAGES FOR EACH CONTROL VOLUME'
5739 call table_cr(this%stagetab, this%packName, title)
5740 call this%stagetab%table_df(this%maxbound, nterms, this%iout, &
5744 if (this%inamedbound == 1)
then
5746 call this%stagetab%initialize_column(text,
lenboundname, &
5752 call this%stagetab%initialize_column(text, 10, alignment=
tabcenter)
5756 call this%stagetab%initialize_column(text, 20, alignment=
tableft)
5760 call this%stagetab%initialize_column(text, 12, alignment=
tabcenter)
5764 call this%stagetab%initialize_column(text, 12, alignment=
tabcenter)
5768 call this%stagetab%initialize_column(text, 12, alignment=
tabcenter)
5772 call this%stagetab%initialize_column(text, 12, alignment=
tabcenter)
5775 text =
'STREAMBED CONDUCTANCE'
5776 call this%stagetab%initialize_column(text, 12, alignment=
tabcenter)
5779 text =
'STREAMBED GRADIENT'
5780 call this%stagetab%initialize_column(text, 12, alignment=
tabcenter)
5784 if (this%istorage == 1)
then
5786 if (this%inamedbound == 1)
then
5791 title = trim(adjustl(this%text))//
' PACKAGE ('// &
5792 trim(adjustl(this%packName))//
') COURANT NUMBER FOR EACH REACH'
5795 call table_cr(this%couranttab, this%packName, title)
5796 call this%couranttab%table_df(this%maxbound, nterms, this%iout)
5798 if (this%inamedbound == 1)
then
5800 call this%couranttab%initialize_column(text,
lenboundname, &
5806 call this%couranttab%initialize_column(text, 10, alignment=
tabcenter)
5810 call this%couranttab%initialize_column(text, 16, alignment=
tabcenter)
5814 call this%couranttab%initialize_column(text, 16, alignment=
tabcenter)
5818 call this%couranttab%initialize_column(text, 16, alignment=
tabcenter)
5820 end subroutine sfr_setup_tableobj
5828 function calc_area_wet(this, n, depth)
5830 real(dp) :: calc_area_wet
5832 class(sfrtype) :: this
5833 integer(I4B),
intent(in) :: n
5834 real(dp),
intent(in) :: depth
5836 integer(I4B) :: npts
5841 npts = this%ncrosspts(n)
5842 i0 = this%iacross(n)
5843 i1 = this%iacross(n + 1) - 1
5846 this%xsheight(i0:i1), depth)
5848 calc_area_wet = this%station(i0) * depth
5850 end function calc_area_wet
5856 function calc_perimeter_wet(this, n, depth)
5858 real(dp) :: calc_perimeter_wet
5860 class(sfrtype) :: this
5861 integer(I4B),
intent(in) :: n
5862 real(dp),
intent(in) :: depth
5864 integer(I4B) :: npts
5869 npts = this%ncrosspts(n)
5870 i0 = this%iacross(n)
5871 i1 = this%iacross(n + 1) - 1
5874 this%xsheight(i0:i1), depth)
5876 calc_perimeter_wet = this%station(i0)
5878 end function calc_perimeter_wet
5884 function calc_surface_area(this, n)
5886 real(dp) :: calc_surface_area
5888 class(sfrtype) :: this
5889 integer(I4B),
intent(in) :: n
5891 integer(I4B) :: npts
5894 real(dp) :: top_width
5897 npts = this%ncrosspts(n)
5898 i0 = this%iacross(n)
5899 i1 = this%iacross(n + 1) - 1
5903 top_width = this%station(i0)
5905 calc_surface_area = top_width * this%length(n)
5906 end function calc_surface_area
5912 function calc_surface_area_wet(this, n, depth)
5914 real(dp) :: calc_surface_area_wet
5916 class(sfrtype) :: this
5917 integer(I4B),
intent(in) :: n
5918 real(dp),
intent(in) :: depth
5920 real(dp) :: top_width
5923 top_width = this%calc_top_width_wet(n, depth)
5924 calc_surface_area_wet = top_width * this%length(n)
5925 end function calc_surface_area_wet
5931 function calc_top_width_wet(this, n, depth)
5933 real(dp) :: calc_top_width_wet
5935 class(sfrtype) :: this
5936 integer(I4B),
intent(in) :: n
5937 real(dp),
intent(in) :: depth
5939 integer(I4B) :: npts
5945 npts = this%ncrosspts(n)
5946 i0 = this%iacross(n)
5947 i1 = this%iacross(n + 1) - 1
5951 this%station(i0:i1), &
5952 this%xsheight(i0:i1), &
5955 calc_top_width_wet = sat * this%station(i0)
5957 end function calc_top_width_wet
5963 subroutine sfr_activate_density(this)
5967 class(sfrtype),
intent(inout) :: this
5974 call mem_reallocate(this%denseterms, 3, this%MAXBOUND,
'DENSETERMS', &
5976 do i = 1, this%maxbound
5978 this%denseterms(j, i) =
dzero
5981 write (this%iout,
'(/1x,a)')
'DENSITY TERMS HAVE BEEN ACTIVATED FOR SFR &
5982 &PACKAGE: '//trim(adjustl(this%packName))
5983 end subroutine sfr_activate_density
5990 subroutine sfr_activate_viscosity(this)
5994 class(sfrtype),
intent(inout) :: this
6001 call mem_reallocate(this%viscratios, 2, this%MAXBOUND,
'VISCRATIOS', &
6003 do i = 1, this%maxbound
6005 this%viscratios(j, i) =
done
6008 write (this%iout,
'(/1x,a)')
'VISCOSITY HAS BEEN ACTIVATED FOR SFR &
6009 &PACKAGE: '//trim(adjustl(this%packName))
6010 end subroutine sfr_activate_viscosity
6023 subroutine sfr_calculate_density_exchange(this, n, stage, head, cond, &
6024 tops, flow, gwfhcof, gwfrhs)
6026 class(sfrtype),
intent(inout) :: this
6027 integer(I4B),
intent(in) :: n
6028 real(DP),
intent(in) :: stage
6029 real(DP),
intent(in) :: head
6030 real(DP),
intent(in) :: cond
6031 real(DP),
intent(in) :: tops
6032 real(DP),
intent(inout) :: flow
6033 real(DP),
intent(inout) :: gwfhcof
6034 real(DP),
intent(inout) :: gwfrhs
6039 real(DP) :: rdensesfr
6040 real(DP) :: rdensegwf
6041 real(DP) :: rdenseavg
6047 logical(LGP) :: stage_below_bot
6048 logical(LGP) :: head_below_bot
6051 if (stage >= tops)
then
6053 stage_below_bot = .false.
6054 rdensesfr = this%denseterms(1, n)
6057 stage_below_bot = .true.
6058 rdensesfr = this%denseterms(2, n)
6062 if (head >= tops)
then
6064 head_below_bot = .false.
6065 rdensegwf = this%denseterms(2, n)
6068 head_below_bot = .true.
6069 rdensegwf = this%denseterms(1, n)
6073 if (rdensegwf ==
dzero)
return
6076 if (stage_below_bot .and. head_below_bot)
then
6083 rdenseavg =
dhalf * (rdensesfr + rdensegwf)
6087 d1 = cond * (rdenseavg -
done)
6088 gwfhcof = gwfhcof - d1
6089 gwfrhs = gwfrhs - d1 * ss
6094 if (.not. stage_below_bot .and. .not. head_below_bot)
then
6098 elevgwf = this%denseterms(3, n)
6100 elevavg =
dhalf * (elevsfr + elevgwf)
6101 havg =
dhalf * (hh + ss)
6102 d2 = cond * (havg - elevavg) * (rdensegwf - rdensesfr)
6103 gwfrhs = gwfrhs + d2
6107 end subroutine sfr_calculate_density_exchange
This module contains the base boundary package.
This module contains the BudgetModule.
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
real(dp), parameter dhdry
real dry cell constant
@ tabcenter
centered table column
@ tabright
right justified table column
@ tableft
left justified table column
@ mnormal
normal output mode
real(dp), parameter dtwothirds
real constant 2/3
integer(i4b), parameter lenpackagename
maximum length of the package name
real(dp), parameter dp9
real constant 9/10
real(dp), parameter deight
real constant 8
real(dp), parameter dfivethirds
real constant 5/3
real(dp), parameter dp999
real constant 999/1000
integer(i4b), parameter namedboundflag
named bound flag
real(dp), parameter donethird
real constant 1/3
real(dp), parameter dnodata
real no data constant
real(dp), parameter d1p1
real constant 1.1
real(dp), parameter dhnoflo
real no flow constant
real(dp), parameter dhundred
real constant 100
integer(i4b), parameter lenpakloc
maximum length of a package location
integer(i4b), parameter lentimeseriesname
maximum length of a time series name
real(dp), parameter dep20
real constant 1e20
real(dp), parameter dp6
real constant 3/5
integer(i4b), parameter maxadpit
maximum advanced package Newton-Raphson iterations
real(dp), parameter dhalf
real constant 1/2
integer(i4b), parameter lenftype
maximum length of a package type (DIS, WEL, OC, etc.)
real(dp), parameter dpi
real constant
real(dp), parameter dp99
real constant 99/100
integer(i4b), parameter lenboundname
maximum length of a bound name
real(dp), parameter dem4
real constant 1e-4
real(dp), parameter dem30
real constant 1e-30
real(dp), parameter dem6
real constant 1e-6
real(dp), parameter dzero
real constant zero
real(dp), parameter dem5
real constant 1e-5
real(dp), parameter dprec
real constant machine precision
integer(i4b), parameter maxcharlen
maximum length of char string
real(dp), parameter dp7
real constant 7/10
real(dp), parameter dem2
real constant 1e-2
real(dp), parameter dtwo
real constant 2
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
real(dp), parameter done
real constant 1
This module contains stateless sfr subroutines and functions.
real(dp) function, public get_wetted_topwidth(npts, stations, heights, d)
Calculate the wetted top width for a reach.
real(dp) function, public get_wetted_perimeter(npts, stations, heights, d)
Calculate the wetted perimeter for a reach.
real(dp) function, public get_cross_section_area(npts, stations, heights, d)
Calculate the cross-sectional area for a reach.
real(dp) function, public get_saturated_topwidth(npts, stations)
Calculate the saturated top width for a reach.
real(dp) function, public get_mannings_section(npts, stations, heights, roughfracs, roughness, conv_fact, slope, d)
Calculate the manning's discharge for a reach.
This module defines variable data types.
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
This module contains the derived types ObserveType and ObsDataType.
subroutine, public cross_section_cr(this, iout, iprpak, nreaches)
Create a cross-section object.
This module contains the SFR package methods.
subroutine sfr_calc_celerity(this, n, q, celerity)
Kinematic-wave celerity from a flow perturbation (0 if dry)
real(dp) function calc_top_width_wet(this, n, depth)
Calculate wetted top width.
subroutine sfr_precompute_tvd(this)
Pre-compute the single upstream reach index for the TVD limiter.
subroutine sfr_setup_tableobj(this)
Setup stage table object for package.
subroutine sfr_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
@ brief Convergence check for package.
subroutine sfr_cq(this, x, flowja, iadv)
@ brief Calculate package flows.
subroutine sfr_ot_package_flows(this, icbcfl, ibudfl)
@ brief Output package flow terms.
subroutine sfr_activate_viscosity(this)
Activate viscosity terms.
subroutine sfr_da(this)
@ brief Deallocate package memory
subroutine sfr_read_diversions(this)
@ brief Read diversions for the package
subroutine sfr_calc_reach_depth(this, n, q1, d1)
Calculate the depth at the midpoint.
real(dp) function calc_surface_area(this, n)
Calculate maximum surface area.
subroutine sfr_check_ustrf(this)
Check upstream fraction data.
subroutine sfr_read_connectiondata(this)
@ brief Read connectiondata for the package
subroutine sfr_calc_xs_depth(this, n, qrch, d)
Calculate the depth at the midpoint of a irregular cross-section.
subroutine sfr_set_stressperiod(this, n, ichkustrm, crossfile)
Set period data.
subroutine sfr_check_diversions(this)
Check diversions data.
subroutine sfr_ot_dv(this, idvsave, idvprint)
@ brief Output package dependent-variable terms.
subroutine sfr_dt(this)
Submit the ATS time step for the most Courant-constraining reach.
subroutine sfr_fc(this, rhs, ia, idxglo, matrix_sln)
@ brief Copy hcof and rhs terms into solution.
subroutine, public sfr_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname)
@ brief Create a new package object
subroutine sfr_fn(this, rhs, ia, idxglo, matrix_sln)
@ brief Add Newton-Raphson terms for package into solution.
subroutine define_listlabel(this)
@ brief Define the list label for the package
subroutine sfr_df_obs(this)
Define the observation types available in the package.
subroutine sfr_options(this, option, found)
@ brief Read additional options for package
subroutine sfr_calc_cond(this, n, depth, cond, hsfr, h_temp)
Calculate reach-aquifer conductance.
subroutine sfr_check_connections(this)
Check connection data.
subroutine sfr_allocate_arrays(this)
@ brief Allocate arrays
subroutine sfr_bd_obs(this)
Save observations for the package.
subroutine sfr_setup_budobj(this)
Setup budget object for package.
subroutine sfr_check_initialstages(this)
Check initial stage data.
subroutine sfr_rp(this)
@ brief Read and prepare period data for package
subroutine sfr_ar(this)
@ brief Allocate and read method for package
subroutine sfr_calc_qman(this, n, depth, qman)
Calculate streamflow.
subroutine sfr_fp(this)
Write the Courant-number summary table to the listing file.
subroutine sfr_check_reaches(this)
Check reach data.
real(dp) function calc_perimeter_wet(this, n, depth)
Calculate wetted perimeter.
subroutine sfr_read_packagedata(this)
@ brief Read packagedata for the package
subroutine sfr_read_initial_stages(this)
@ brief Read initialstages data for the package
subroutine sfr_update_flows(this, n, qd, qgwf)
Update flow terms.
subroutine sfr_calc_qd(this, n, depth, hgwf, qgwf, qd)
Calculate downstream flow term.
subroutine sfr_fill_budobj(this)
Copy flow terms into budget object for package.
subroutine sfr_cf(this)
@ brief Formulate the package hcof and rhs terms.
subroutine sfr_ot_bdsummary(this, kstp, kper, iout, ibudfl)
@ brief Output advanced package budget summary.
subroutine sfr_calc_div(this, n, i, qd, qdiv)
Calculate diversion flow.
subroutine sfr_calc_qgwf(this, n, depth, hgwf, qgwf, gwfhcof, gwfrhs)
Calculate reach-aquifer exchange.
character(len=lenftype) ftype
package ftype string
subroutine sfr_calculate_density_exchange(this, n, stage, head, cond, tops, flow, gwfhcof, gwfrhs)
Calculate density terms.
character(len=lenpackagename) text
package budget string
subroutine sfr_calc_qsource(this, n, depth, qsrc)
Calculate sum of sources.
subroutine sfr_allocate_scalars(this)
@ brief Allocate scalars
logical function sfr_obs_supported(this)
Determine if observations are supported.
subroutine sfr_check_storage_weight(this)
Check storage weight.
subroutine sfr_solve(this, n, h, hcof, rhs, update)
Solve reach continuity equation.
subroutine sfr_read_dimensions(this)
@ brief Read dimensions for package
real(dp) function calc_area_wet(this, n, depth)
Calculate wetted area.
subroutine sfr_read_crossection(this)
@ brief Read crosssection block for the package
subroutine sfr_rp_obs(this)
Read and prepare observations for a package.
subroutine sfr_activate_density(this)
Activate density terms.
subroutine sfr_adjust_ro_ev(this, qc, qu, qi, qr, qro, qe, qfrommvr)
Adjust runoff and evaporation.
subroutine sfr_check_conversion(this)
Check unit conversion data.
real(dp) function calc_surface_area_wet(this, n, depth)
Calculate wetted surface area.
integer(i4b) function sfr_gwf_conn(this, n)
Determine if a reach is connected to a gwf cell.
subroutine sfr_ad(this)
@ brief Advance the package
This module contains simulation methods.
subroutine, public store_warning(msg, substring)
Store warning message.
subroutine, public store_error(msg, terminate)
Store an error message.
integer(i4b) function, public count_errors()
Return number of errors.
subroutine, public deprecation_warning(cblock, cvar, cver, endmsg, iunit)
Store deprecation warning message.
subroutine, public store_error_unit(iunit, terminate)
Store the file unit number.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
character(len=maxcharlen) warnmsg
warning message string
real(dp) function squadraticsaturation(top, bot, x, eps)
@ brief sQuadraticSaturation
real(dp) function scubicsaturation(top, bot, x, eps)
@ brief sCubicSaturation
real(dp) function squadraticsaturationderivative(top, bot, x, eps)
@ brief Derivative of the quadratic saturation function
real(dp) function sqsaturationderivative(top, bot, x, c1, c2)
@ brief sQSaturationDerivative
subroutine schsmooth(d, smooth, dwdh)
@ brief sChSmooth
real(dp) function sqsaturation(top, bot, x, c1, c2)
@ brief sQSaturation
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
class(atstype), pointer, public ats
integer(i4b), pointer, public inats
flag indicating ats active for 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
integer(i4b), pointer, public nper
number of stress period
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).
logical function, public var_timeseries(tsManager, pkgName, varName, auxOrBnd)
Determine if a timeseries link with varName is defined.
Derived type for the Budget object.