22 real(dp),
pointer,
dimension(:),
contiguous :: uzdpst => null()
23 real(dp),
pointer,
dimension(:),
contiguous :: uzthst => null()
24 real(dp),
pointer,
dimension(:),
contiguous :: uzflst => null()
25 real(dp),
pointer,
dimension(:),
contiguous :: uzspst => null()
26 integer(I4B),
pointer :: nwavst => null()
31 real(dp),
pointer,
dimension(:),
contiguous :: thtr => null()
32 real(dp),
pointer,
dimension(:),
contiguous :: thts => null()
33 real(dp),
pointer,
dimension(:),
contiguous :: thti => null()
34 real(dp),
pointer,
dimension(:),
contiguous :: eps => null()
35 real(dp),
pointer,
dimension(:),
contiguous :: extwc => null()
36 real(dp),
pointer,
dimension(:),
contiguous :: ha => null()
37 real(dp),
pointer,
dimension(:),
contiguous :: hroot => null()
38 real(dp),
pointer,
dimension(:),
contiguous :: rootact => null()
39 real(dp),
pointer,
dimension(:),
contiguous :: etact => null()
40 real(dp),
dimension(:, :),
pointer,
contiguous :: uzspst => null()
41 real(dp),
dimension(:, :),
pointer,
contiguous :: uzthst => null()
42 real(dp),
dimension(:, :),
pointer,
contiguous :: uzflst => null()
43 real(dp),
dimension(:, :),
pointer,
contiguous :: uzdpst => null()
44 integer(I4B),
pointer,
dimension(:),
contiguous :: nwavst => null()
45 real(dp),
pointer,
dimension(:),
contiguous :: totflux => null()
46 integer(I4B),
pointer :: nwav => null()
47 integer(I4B),
pointer :: ntrail => null()
48 real(dp),
pointer,
dimension(:),
contiguous :: sinf => null()
49 real(dp),
pointer,
dimension(:),
contiguous :: finf => null()
50 real(dp),
pointer,
dimension(:),
contiguous :: pet => null()
51 real(dp),
pointer,
dimension(:),
contiguous :: petmax => null()
52 real(dp),
pointer,
dimension(:),
contiguous :: extdp => null()
53 real(dp),
pointer,
dimension(:),
contiguous :: extdpuz => null()
54 real(dp),
pointer,
dimension(:),
contiguous :: finf_rej => null()
55 real(dp),
pointer,
dimension(:),
contiguous :: gwet => null()
56 real(dp),
pointer,
dimension(:),
contiguous :: uzfarea => null()
57 real(dp),
pointer,
dimension(:),
contiguous :: cellarea => null()
58 real(dp),
pointer,
dimension(:),
contiguous :: celtop => null()
59 real(dp),
pointer,
dimension(:),
contiguous :: celbot => null()
60 real(dp),
pointer,
dimension(:),
contiguous :: landtop => null()
61 real(dp),
pointer,
dimension(:),
contiguous :: watab => null()
62 real(dp),
pointer,
dimension(:),
contiguous :: watabold => null()
63 real(dp),
pointer,
dimension(:),
contiguous :: vks => null()
64 real(dp),
pointer,
dimension(:),
contiguous :: surfdep => null()
65 real(dp),
pointer,
dimension(:),
contiguous :: surflux => null()
66 real(dp),
pointer,
dimension(:),
contiguous :: surfluxbelow => null()
67 real(dp),
pointer,
dimension(:),
contiguous :: surfseep => null()
68 real(dp),
pointer,
dimension(:),
contiguous :: gwpet => null()
69 integer(I4B),
pointer,
dimension(:),
contiguous :: landflag => null()
70 integer(I4B),
pointer,
dimension(:),
contiguous :: ivertcon => null()
77 real(dp),
pointer,
dimension(:),
contiguous :: checktime => null()
78 integer(I4B),
pointer,
dimension(:),
contiguous :: wavmore => null()
121 subroutine init(this, ncells, nwav, memory_path)
126 integer(I4B),
intent(in) :: ncells
127 integer(I4B),
intent(in) :: nwav
128 character(len=*),
intent(in) :: memory_path
130 integer(I4B) :: icell
134 call mem_allocate(this%uzdpst, nwav, ncells,
'UZDPST', memory_path)
135 call mem_allocate(this%uzthst, nwav, ncells,
'UZTHST', memory_path)
136 call mem_allocate(this%uzflst, nwav, ncells,
'UZFLST', memory_path)
137 call mem_allocate(this%uzspst, nwav, ncells,
'UZSPST', memory_path)
138 call mem_allocate(this%nwavst, ncells,
'NWAVST', memory_path)
143 call mem_allocate(this%thtr, ncells,
'THTR', memory_path)
144 call mem_allocate(this%thts, ncells,
'THTS', memory_path)
145 call mem_allocate(this%thti, ncells,
'THTI', memory_path)
148 call mem_allocate(this%hroot, ncells,
'HROOT', memory_path)
149 call mem_allocate(this%rootact, ncells,
'ROOTACT', memory_path)
150 call mem_allocate(this%extwc, ncells,
'EXTWC', memory_path)
151 call mem_allocate(this%etact, ncells,
'ETACT', memory_path)
152 call mem_allocate(this%totflux, ncells,
'TOTFLUX', memory_path)
153 call mem_allocate(this%sinf, ncells,
'SINF', memory_path)
154 call mem_allocate(this%finf, ncells,
'FINF', memory_path)
155 call mem_allocate(this%finf_rej, ncells,
'FINF_REJ', memory_path)
156 call mem_allocate(this%gwet, ncells,
'GWET', memory_path)
157 call mem_allocate(this%uzfarea, ncells,
'UZFAREA', memory_path)
158 call mem_allocate(this%cellarea, ncells,
'CELLAREA', memory_path)
159 call mem_allocate(this%celtop, ncells,
'CELTOP', memory_path)
160 call mem_allocate(this%celbot, ncells,
'CELBOT', memory_path)
161 call mem_allocate(this%landtop, ncells,
'LANDTOP', memory_path)
162 call mem_allocate(this%watab, ncells,
'WATAB', memory_path)
163 call mem_allocate(this%watabold, ncells,
'WATABOLD', memory_path)
164 call mem_allocate(this%surfdep, ncells,
'SURFDEP', memory_path)
166 call mem_allocate(this%surflux, ncells,
'SURFLUX', memory_path)
167 call mem_allocate(this%surfluxbelow, ncells,
'SURFLUXBELOW', memory_path)
168 call mem_allocate(this%surfseep, ncells,
'SURFSEEP', memory_path)
169 call mem_allocate(this%gwpet, ncells,
'GWPET', memory_path)
171 call mem_allocate(this%petmax, ncells,
'PETMAX', memory_path)
172 call mem_allocate(this%extdp, ncells,
'EXTDP', memory_path)
173 call mem_allocate(this%extdpuz, ncells,
'EXTDPUZ', memory_path)
174 call mem_allocate(this%landflag, ncells,
'LANDFLAG', memory_path)
175 call mem_allocate(this%ivertcon, ncells,
'IVERTCON', memory_path)
178 call mem_allocate(this%wavsav%uzdpst, nwav,
'SAV_UZDPST', memory_path)
179 call mem_allocate(this%wavsav%uzthst, nwav,
'SAV_UZTHST', memory_path)
180 call mem_allocate(this%wavsav%uzflst, nwav,
'SAV_UZFLST', memory_path)
181 call mem_allocate(this%wavsav%uzspst, nwav,
'SAV_UZSPST', memory_path)
182 call mem_allocate(this%wavsav%nwavst,
'SAV_NWAVST', memory_path)
183 call mem_allocate(this%etsav%uzdpst, nwav,
'ETSAV_UZDPST', memory_path)
184 call mem_allocate(this%etsav%uzthst, nwav,
'ETSAV_UZTHST', memory_path)
185 call mem_allocate(this%etsav%uzflst, nwav,
'ETSAV_UZFLST', memory_path)
186 call mem_allocate(this%etsav%uzspst, nwav,
'ETSAV_UZSPST', memory_path)
187 call mem_allocate(this%etsav%nwavst,
'ETSAV_NWAVST', memory_path)
188 call mem_allocate(this%checktime, nwav,
'CHECKTIME', memory_path)
189 call mem_allocate(this%wavmore, nwav,
'WAVMORE', memory_path)
194 this%wavsav%nwavst = 0
195 this%etsav%nwavst = 0
197 this%wavsav%uzdpst(j) =
dzero
198 this%wavsav%uzthst(j) =
dzero
199 this%wavsav%uzflst(j) =
dzero
200 this%wavsav%uzspst(j) =
dzero
201 this%etsav%uzdpst(j) =
dzero
202 this%etsav%uzthst(j) =
dzero
203 this%etsav%uzflst(j) =
dzero
204 this%etsav%uzspst(j) =
dzero
205 this%checktime(j) =
dzero
210 this%uzdpst(j, icell) =
dzero
211 this%uzthst(j, icell) =
dzero
212 this%uzflst(j, icell) =
dzero
213 this%uzspst(j, icell) =
dzero
215 this%nwavst(icell) = 1
216 this%thtr(icell) =
dzero
217 this%thts(icell) =
dzero
218 this%thti(icell) =
dzero
219 this%eps(icell) =
dzero
220 this%ha(icell) =
dzero
221 this%hroot(icell) =
dzero
222 this%rootact(icell) =
dzero
223 this%extwc(icell) =
dzero
224 this%etact(icell) =
dzero
225 this%totflux(icell) =
dzero
226 this%sinf(icell) =
dzero
227 this%finf(icell) =
dzero
228 this%finf_rej(icell) =
dzero
229 this%gwet(icell) =
dzero
230 this%uzfarea(icell) =
dzero
231 this%cellarea(icell) =
dzero
232 this%celtop(icell) =
dzero
233 this%celbot(icell) =
dzero
234 this%landtop(icell) =
dzero
235 this%watab(icell) =
dzero
236 this%watabold(icell) =
dzero
237 this%surfdep(icell) =
dzero
238 this%vks(icell) =
dzero
239 this%surflux(icell) =
dzero
240 this%surfluxbelow(icell) =
dzero
241 this%surfseep(icell) =
dzero
242 this%gwpet(icell) =
dzero
243 this%pet(icell) =
dzero
244 this%petmax(icell) =
dzero
245 this%extdp(icell) =
dzero
246 this%extdpuz(icell) =
dzero
247 this%landflag(icell) = 0
248 this%ivertcon(icell) = 0
316 subroutine setdata(this, icell, area, top, bot, surfdep, vks, thtr, thts, &
317 thti, eps, ntrail, landflag, ivertcon)
320 integer(I4B),
intent(in) :: icell
321 real(DP),
intent(in) :: area
322 real(DP),
intent(in) :: top
323 real(DP),
intent(in) :: bot
324 real(DP),
intent(in) :: surfdep
325 real(DP),
intent(in) :: vks
326 real(DP),
intent(in) :: thtr
327 real(DP),
intent(in) :: thts
328 real(DP),
intent(in) :: thti
329 real(DP),
intent(in) :: eps
330 integer(I4B),
intent(in) :: ntrail
331 integer(I4B),
intent(in) :: landflag
332 integer(I4B),
intent(in) :: ivertcon
335 this%landflag(icell) = landflag
336 this%ivertcon(icell) = ivertcon
337 this%surfdep(icell) = surfdep
338 this%uzfarea(icell) = area
339 this%cellarea(icell) = area
340 if (this%landflag(icell) == 1)
then
341 this%celtop(icell) = top -
dhalf * this%surfdep(icell)
343 this%celtop(icell) = top
345 this%celbot(icell) = bot
346 this%vks(icell) = vks
347 this%thtr(icell) = thtr
348 this%thts(icell) = thts
349 this%thti(icell) = thti
350 this%eps(icell) = eps
352 this%pet(icell) =
dzero
353 this%extdp(icell) =
dzero
354 this%extwc(icell) =
dzero
355 this%ha(icell) =
dzero
356 this%hroot(icell) =
dzero
364 integer(I4B),
intent(in) :: icell
365 real(DP),
intent(in) :: hgwf
368 this%watab(icell) = this%celbot(icell)
369 if (hgwf > this%celbot(icell)) this%watab(icell) = hgwf
370 if (this%watab(icell) > this%celtop(icell)) &
371 this%watab(icell) = this%celtop(icell)
372 this%watabold(icell) = this%watab(icell)
380 integer(I4B),
intent(in) :: icell
381 real(DP),
intent(in) :: finf
383 if (this%landflag(icell) == 1)
then
384 this%sinf(icell) = finf
385 this%finf(icell) = finf
387 this%sinf(icell) =
dzero
388 this%finf(icell) =
dzero
390 this%finf_rej(icell) =
dzero
391 this%surflux(icell) =
dzero
392 this%surfluxbelow(icell) =
dzero
400 integer(I4B),
intent(in) :: icell
401 real(DP),
intent(in) :: areamult
404 this%uzfarea(icell) = this%cellarea(icell) * areamult
412 integer(I4B),
intent(in) :: icell
413 integer(I4B),
intent(in) :: jbelow
414 real(DP),
intent(in) :: pet
415 real(DP),
intent(in) :: extdp
419 if (this%landflag(icell) == 1)
then
420 this%pet(icell) = pet
421 this%gwpet(icell) = pet
423 this%pet(icell) =
dzero
424 this%gwpet(icell) =
dzero
426 thick = this%celtop(icell) - this%celbot(icell)
427 this%extdp(icell) = extdp
428 if (this%landflag(icell) > 0)
then
429 this%landtop(icell) = this%celtop(icell)
430 this%petmax(icell) = this%pet(icell)
434 if (this%landtop(icell) - this%extdp(icell) < this%celbot(icell))
then
435 this%extdpuz(icell) = thick
437 this%extdpuz(icell) = this%celtop(icell) - &
438 (this%landtop(icell) - this%extdp(icell))
440 if (this%extdpuz(icell) <
dzero) this%extdpuz(icell) =
dzero
441 if (this%extdpuz(icell) >
dem7 .and. this%extdp(icell) <
dem7) &
442 this%extdp(icell) = this%extdpuz(icell)
446 this%landtop(jbelow) = this%landtop(icell)
447 this%petmax(jbelow) = this%petmax(icell)
458 integer(I4B),
intent(in) :: icell
465 pet = this%pet(icell) - this%etact(icell) /
delt
467 this%gwpet(icell) = pet
477 integer(I4B),
intent(in) :: icell
478 integer(I4B),
intent(in) :: jbelow
486 if (this%extdpuz(jbelow) >
dem3)
then
487 pet = this%pet(icell) - this%etact(icell) /
delt - &
488 this%gwet(icell) / this%uzfarea(icell)
491 this%pet(jbelow) = pet
499 integer(I4B),
intent(in) :: icell
500 integer(I4B),
intent(in) :: jbelow
501 real(DP),
intent(in) :: extwc
504 this%extwc(icell) = extwc
505 if (jbelow > 0) this%extwc(jbelow) = extwc
513 integer(I4B),
intent(in) :: icell
514 integer(I4B),
intent(in) :: jbelow
515 real(DP),
intent(in) :: ha
516 real(DP),
intent(in) :: hroot
517 real(DP),
intent(in) :: rootact
521 this%hroot(icell) = hroot
522 this%rootact(icell) = rootact
525 this%hroot(jbelow) = hroot
526 this%rootact(jbelow) = rootact
535 integer(I4B),
intent(in) :: icell
538 this%surfseep(icell) =
dzero
544 subroutine solve(this, jbelow, icell, totfluxtot, ietflag, &
545 issflag, iseepflag, hgwf, qfrommvr, ierr, &
546 reset_state, trhs, thcof, deriv, watercontent)
551 integer(I4B),
intent(in) :: jbelow
552 integer(I4B),
intent(in) :: icell
553 real(DP),
intent(inout) :: totfluxtot
554 integer(I4B),
intent(in) :: ietflag
555 integer(I4B),
intent(in) :: issflag
556 integer(I4B),
intent(in) :: iseepflag
557 real(DP),
intent(in) :: hgwf
558 real(DP),
intent(in) :: qfrommvr
559 integer(I4B),
intent(inout) :: ierr
560 logical,
intent(in) :: reset_state
561 real(DP),
intent(inout),
optional :: trhs
562 real(DP),
intent(inout),
optional :: thcof
563 real(DP),
intent(inout),
optional :: deriv
564 real(DP),
intent(inout),
optional :: watercontent
570 real(DP) :: derivfinf
572 real(DP) :: thcoffinf
574 real(DP) :: thcofseep
584 this%finf_rej(icell) =
dzero
585 this%surflux(icell) = this%finf(icell) + qfrommvr / this%uzfarea(icell)
586 this%watab(icell) = hgwf
587 this%surfseep(icell) =
dzero
590 this%etact(icell) =
dzero
591 this%surfluxbelow(icell) =
dzero
592 if (this%ivertcon(icell) > 0)
then
593 this%finf(jbelow) =
dzero
595 if (this%watab(icell) < this%celbot(icell)) &
596 this%watab(icell) = this%celbot(icell)
604 if (reset_state)
then
605 call this%store_waves(icell, this%wavsav)
608 if (this%watab(icell) > this%celtop(icell)) &
609 this%watab(icell) = this%celtop(icell)
612 if (this%surflux(icell) > this%vks(icell))
then
613 this%surflux(icell) = this%vks(icell)
617 if (this%landflag(icell) == 1)
then
618 call this%rejfinf(icell, deriv1, hgwf, trhsfinf, thcoffinf, finfact)
619 this%surflux(icell) = finfact
623 this%finf_rej(icell) = this%finf(icell) + &
624 (qfrommvr / this%uzfarea(icell)) - this%surflux(icell)
627 if (iseepflag > 0 .and. this%landflag(icell) == 1)
then
628 call this%gwseep(icell, deriv2, scale, hgwf, trhsseep, thcofseep, seep)
629 this%surfseep(icell) = seep
633 test = this%watab(icell)
634 if (this%watabold(icell) - test < -
dem15) test = this%watabold(icell)
635 if (this%celtop(icell) - test >
dem15)
then
636 if (issflag == 0)
then
637 call this%routewaves(totfluxtot,
delt, ietflag, icell, ierr)
640 call this%load_waves(icell, this%wavsav)
643 call this%uz_rise(icell, totfluxtot)
644 this%totflux(icell) = totfluxtot
645 if (this%ivertcon(icell) > 0)
then
646 call this%addrech(icell, jbelow, hgwf, trhsfinf, thcoffinf, &
650 this%totflux(icell) = this%surflux(icell) *
delt
651 totfluxtot = this%surflux(icell) *
delt
654 trhsfinf = this%totflux(icell) * this%uzfarea(icell) /
delt
655 if (.not. reset_state)
then
656 call this%update_wav(icell,
delt, issflag, 0)
659 this%totflux(icell) = this%surflux(icell) *
delt
660 totfluxtot = this%surflux(icell) *
delt
661 if (.not. reset_state)
then
662 call this%update_wav(icell,
delt, issflag, 1)
667 if (
present(deriv)) deriv = deriv1 + deriv2 + derivfinf
668 if (
present(trhs)) trhs = trhsfinf + trhsseep
669 if (
present(thcof)) thcof = thcoffinf + thcofseep
672 if (
present(watercontent))
then
673 watercontent = this%get_wcnew(icell)
677 if (reset_state)
then
678 call this%load_waves(icell, this%wavsav)
684 subroutine addrech(this, icell, jbelow, hgwf, trhs, thcof, deriv, delt)
687 integer(I4B),
intent(in) :: icell
688 integer(I4B),
intent(in) :: jbelow
689 real(DP),
intent(inout) :: trhs
690 real(DP),
intent(inout) :: thcof
691 real(DP),
intent(inout) :: deriv
692 real(DP),
intent(in) :: delt
693 real(DP),
intent(in) :: hgwf
696 real(DP) :: x, scale, range
702 trhs = this%uzfarea(icell) * this%totflux(icell) / delt
703 if (this%totflux(icell) <
dem14)
return
707 x = hgwf - (this%celbot(icell) - range)
708 call sscurve(x, range, deriv, scale)
709 deriv = this%uzfarea(icell) * deriv * this%totflux(icell) / delt
710 this%finf(jbelow) = (
done - scale) * this%totflux(icell) / delt
711 fcheck = this%finf(jbelow) - this%vks(jbelow)
715 this%finf(jbelow) = this%finf(jbelow) - fcheck
716 this%surfluxbelow(icell) = this%finf(jbelow)
717 this%totflux(icell) = scale * this%totflux(icell) + fcheck * delt
718 trhs = this%uzfarea(icell) * this%totflux(icell) / delt
723 subroutine rejfinf(this, icell, deriv, hgwf, trhs, thcof, finfact)
726 integer(I4B),
intent(in) :: icell
727 real(DP),
intent(inout) :: deriv
728 real(DP),
intent(inout) :: finfact
729 real(DP),
intent(inout) :: thcof
730 real(DP),
intent(inout) :: trhs
731 real(DP),
intent(in) :: hgwf
733 real(DP) :: x, range, scale, q
735 range = this%surfdep(icell)
736 q = this%surflux(icell)
738 trhs = finfact * this%uzfarea(icell)
739 x = this%celtop(icell) - hgwf
740 call slinear(x, range, deriv, scale)
741 deriv = -q * deriv * this%uzfarea(icell) * scale
742 if (scale <
done)
then
744 trhs = finfact * this%uzfarea(icell) * this%celtop(icell) / range
745 thcof = finfact * this%uzfarea(icell) / range
751 subroutine gwseep(this, icell, deriv, scale, hgwf, trhs, thcof, seep)
754 integer(I4B),
intent(in) :: icell
755 real(DP),
intent(inout) :: deriv
756 real(DP),
intent(inout) :: trhs
757 real(DP),
intent(inout) :: thcof
758 real(DP),
intent(inout) :: seep
759 real(DP),
intent(out) :: scale
760 real(DP),
intent(in) :: hgwf
762 real(DP) :: x, range, y, deriv1, d1, d2, Q
770 q = this%uzfarea(icell) * this%vks(icell)
771 range = this%surfdep(icell)
772 x = hgwf - this%celtop(icell)
775 seep = scale * q * (hgwf - this%celtop(icell)) / range
776 trhs = scale * q * this%celtop(icell) / range
777 thcof = -scale * q / range
778 d1 = -deriv1 * q * x / range
779 d2 = -scale * q / range
781 if (seep <
dzero)
then
791 subroutine simgwet(this, igwetflag, icell, hgwf, trhs, thcof, det)
794 integer(I4B),
intent(in) :: igwetflag
795 integer(I4B),
intent(in) :: icell
796 real(DP),
intent(in) :: hgwf
797 real(DP),
intent(inout) :: trhs
798 real(DP),
intent(inout) :: thcof
799 real(DP),
intent(inout) :: det
801 real(DP) :: s, x, c, b, et
803 this%gwet(icell) =
dzero
807 s = this%landtop(icell)
808 x = this%extdp(icell)
809 c = this%gwpet(icell)
810 b = this%celbot(icell)
813 if (igwetflag == 1)
then
814 et =
etfunc_lin(s, x, c, det, trhs, thcof, hgwf, &
815 this%celtop(icell), this%celbot(icell))
816 else if (igwetflag == 2)
then
820 trhs = trhs * this%uzfarea(icell)
821 thcof = thcof * this%uzfarea(icell)
822 this%gwet(icell) = trhs - (thcof * hgwf)
831 integer(I4B),
intent(in) :: icell
832 real(DP),
intent(inout) :: totfluxtot
834 real(DP) :: fm1, fm2, d1
837 if (this%watab(icell) - this%watabold(icell) >
dem30)
then
838 d1 = this%celtop(icell) - this%watabold(icell)
839 fm1 = this%unsat_stor(icell, d1)
840 d1 = this%celtop(icell) - this%watab(icell)
841 fm2 = this%unsat_stor(icell, d1)
842 totfluxtot = totfluxtot + (fm1 - fm2)
852 integer(I4B),
intent(in) :: icell
853 real(DP) :: bottom, top
858 this%totflux(icell) =
dzero
859 this%nwavst(icell) = 1
860 this%uzdpst(:, icell) =
dzero
861 thick = this%celtop(icell) - this%watab(icell)
863 this%uzthst(jk, icell) = this%thtr(icell)
867 if (thick >
dzero)
then
868 this%uzdpst(1, icell) = thick
869 this%uzthst(1, icell) = this%thti(icell)
870 top = this%uzthst(1, icell) - this%thtr(icell)
872 bottom = this%thts(icell) - this%thtr(icell)
874 this%uzflst(1, icell) = this%vks(icell) * (top / bottom)**this%eps(icell)
875 if (this%uzthst(1, icell) < this%thtr(icell)) &
876 this%uzthst(1, icell) = this%thtr(icell)
879 if (top >
dzero)
then
880 this%uzspst(1, icell) =
dzero
882 this%uzflst(1, icell) =
dzero
883 this%uzspst(1, icell) =
dzero
888 this%uzflst(1, icell) =
dzero
889 this%uzdpst(1, icell) =
dzero
890 this%uzspst(1, icell) =
dzero
891 this%uzthst(1, icell) = this%thtr(icell)
897 subroutine routewaves(this, totfluxtot, delt, ietflag, icell, ierr)
900 real(DP),
intent(inout) :: totfluxtot
901 real(DP),
intent(in) :: delt
902 integer(I4B),
intent(in) :: ietflag
903 integer(I4B),
intent(in) :: icell
904 integer(I4B),
intent(inout) :: ierr
906 real(DP) :: thick, thickold
907 integer(I4B) :: idelt, iwav, ik
910 this%totflux(icell) =
dzero
911 this%etact(icell) =
dzero
912 thick = this%celtop(icell) - this%watab(icell)
913 thickold = this%celtop(icell) - this%watabold(icell)
916 if (thickold <
dzero)
then
917 do iwav = 1, this%nwavst(icell)
918 this%uzthst(iwav, icell) = this%thtr(icell)
919 this%uzdpst(iwav, icell) =
dzero
920 this%uzspst(iwav, icell) =
dzero
921 this%uzflst(iwav, icell) =
dzero
923 this%nwavst(icell) = 1
927 call this%uzflow(thick, thickold, delt, ietflag, icell, ierr)
929 totfluxtot = totfluxtot + this%totflux(icell)
942 integer(I4B),
intent(in) :: icell
943 integer(I4B),
intent(in) :: shft
944 integer(I4B),
intent(in) :: strt
945 integer(I4B),
intent(in) :: stp
946 integer(I4B),
intent(in) :: cntr
950 do j = strt, stp, cntr
951 this%uzthst(j, icell) = this%uzthst(j + shft, icell)
952 this%uzdpst(j, icell) = this%uzdpst(j + shft, icell)
953 this%uzflst(j, icell) = this%uzflst(j + shft, icell)
954 this%uzspst(j, icell) = this%uzspst(j + shft, icell)
963 integer(I4B),
intent(in) :: icell
968 do j = 1, this%nwavst(icell)
969 store%uzthst(j) = this%uzthst(j, icell)
970 store%uzdpst(j) = this%uzdpst(j, icell)
971 store%uzflst(j) = this%uzflst(j, icell)
972 store%uzspst(j) = this%uzspst(j, icell)
974 store%nwavst = this%nwavst(icell)
982 integer(I4B),
intent(in) :: icell
987 do j = 1, store%nwavst
988 this%uzthst(j, icell) = store%uzthst(j)
989 this%uzdpst(j, icell) = store%uzdpst(j)
990 this%uzflst(j, icell) = store%uzflst(j)
991 this%uzspst(j, icell) = store%uzspst(j)
993 this%nwavst(icell) = store%nwavst
998 subroutine uzflow(this, thick, thickold, delt, ietflag, icell, ierr)
1001 real(DP),
intent(inout) :: thickold
1002 real(DP),
intent(inout) :: thick
1003 real(DP),
intent(in) :: delt
1004 integer(I4B),
intent(in) :: ietflag
1005 integer(I4B),
intent(in) :: icell
1006 integer(I4B),
intent(inout) :: ierr
1008 real(DP) :: ffcheck, time, feps1, feps2
1009 real(DP) :: thetadif, thetab, fluxb, oldsflx
1010 integer(I4B) :: itrailflg, itester
1013 this%totflux(icell) =
dzero
1015 oldsflx = this%uzflst(this%nwavst(icell), icell)
1019 if ((thick - thickold) > feps1)
then
1020 thetadif = abs(this%uzthst(1, icell) - this%thtr(icell))
1021 if (thetadif >
dem6)
then
1022 call this%shift_waves(icell, -1, &
1023 this%nwavst(icell) + 1, 2, -1)
1024 if (this%uzdpst(2, icell) <
dem30) &
1025 this%uzdpst(2, icell) = (this%ntrail +
dtwo) *
dem6
1026 if (this%uzthst(2, icell) > this%thtr(icell))
then
1027 this%uzspst(2, icell) = this%uzflst(2, icell) / &
1028 (this%uzthst(2, icell) - this%thtr(icell))
1030 this%uzspst(2, icell) =
dzero
1032 this%uzthst(1, icell) = this%thtr(icell)
1033 this%uzflst(1, icell) =
dzero
1034 this%uzspst(1, icell) =
dzero
1035 this%uzdpst(1, icell) = thick
1036 this%nwavst(icell) = this%nwavst(icell) + 1
1037 if (this%nwavst(icell) >= this%nwav)
then
1043 this%uzdpst(1, icell) = thick
1046 thetab = this%uzthst(1, icell)
1047 fluxb = this%uzflst(1, icell)
1048 this%totflux(icell) =
dzero
1050 ffcheck = (this%surflux(icell) - this%uzflst(this%nwavst(icell), icell))
1053 if (ffcheck > feps2 .OR. ffcheck < -feps2)
then
1054 this%nwavst(icell) = this%nwavst(icell) + 1
1055 if (this%nwavst(icell) >= this%nwav)
then
1061 else if (this%nwavst(icell) == 1)
then
1064 if (this%nwavst(icell) > 1)
then
1065 if (ffcheck < -feps2)
then
1066 call this%trailwav(icell, ierr)
1067 if (ierr > 0)
return
1070 call this%leadwav(time, itester, itrailflg, thetab, fluxb, ffcheck, &
1073 if (itester == 1)
then
1074 this%totflux(icell) = this%totflux(icell) + &
1075 (delt - time) * this%uzflst(1, icell)
1081 if (ietflag > 0)
call this%uzet(icell, delt, ietflag, ierr)
1082 if (ierr > 0)
return
1089 real(DP),
intent(out) :: feps1
1090 real(DP),
intent(out) :: feps2
1100 factor1 =
done / 86400.d0
1101 else if (
itmuni == 2)
then
1102 factor1 =
done / 1440.d0
1103 else if (
itmuni == 3)
then
1104 factor1 =
done / 24.0d0
1105 else if (
itmuni == 5)
then
1108 factor2 =
done / 0.3048
1109 feps1 = feps1 * factor1 * factor2
1110 feps2 = feps2 * factor1 * factor2
1118 integer(I4B),
intent(in) :: icell
1119 integer(I4B),
intent(inout) :: ierr
1121 real(DP) :: smoist, smoistinc, ftrail, eps_m1
1122 real(DP) :: thtsrinv
1123 real(DP) :: flux1, flux2, theta1, theta2
1125 integer(I4B) :: j, jj, jk, nwavstm1
1128 eps_m1 = dble(this%eps(icell)) -
done
1129 thtsrinv =
done / (this%thts(icell) - this%thtr(icell))
1130 nwavstm1 = this%nwavst(icell) - 1
1133 smoist = (((this%surflux(icell) / this%vks(icell))** &
1134 (
done / this%eps(icell))) * &
1135 (this%thts(icell) - this%thtr(icell))) + this%thtr(icell)
1136 if (this%uzthst(nwavstm1, icell) - smoist >
dem9)
then
1138 do jk = 1, this%ntrail
1139 fnuminc = fnuminc + float(jk)
1141 smoistinc = (this%uzthst(nwavstm1, icell) - smoist) / (fnuminc -
done)
1143 ftrail = dble(this%ntrail) +
done
1144 do j = this%nwavst(icell), this%nwavst(icell) + this%ntrail - 1
1145 if (j > this%nwav)
then
1150 if (j > this%nwavst(icell))
then
1151 this%uzthst(j, icell) = this%uzthst(j - 1, icell) &
1152 - ((ftrail - float(jj)) * smoistinc)
1154 this%uzthst(j, icell) = this%uzthst(j - 1, icell) -
dem9
1157 if (this%uzthst(j, icell) <= this%thtr(icell) +
dem9) &
1158 this%uzthst(j, icell) = this%thtr(icell) +
dem9
1159 this%uzflst(j, icell) = &
1160 this%vks(icell) * (((this%uzthst(j, icell) - this%thtr(icell)) * &
1161 thtsrinv)**this%eps(icell))
1162 theta2 = this%uzthst(j - 1, icell)
1163 flux2 = this%uzflst(j - 1, icell)
1164 flux1 = this%uzflst(j, icell)
1165 theta1 = this%uzthst(j, icell)
1166 this%uzspst(j, icell) =
leadspeed(theta1, theta2, flux1, flux2, &
1167 this%thts(icell), this%thtr(icell), &
1168 this%eps(icell), this%vks(icell))
1169 this%uzdpst(j, icell) =
dzero
1170 if (j == this%nwavst(icell))
then
1171 this%uzdpst(j, icell) = this%uzdpst(j, icell) + &
1172 (this%ntrail + 1) *
dem9
1174 this%uzdpst(j, icell) = this%uzdpst(j - 1, icell) -
dem9
1177 this%nwavst(icell) = this%nwavst(icell) + this%ntrail - 1
1178 if (this%nwavst(icell) >= this%nwav)
then
1184 this%uzdpst(this%nwavst(icell), icell) =
dzero
1185 this%uzflst(this%nwavst(icell), icell) = &
1186 this%vks(icell) * (((this%uzthst(this%nwavst(icell), icell) - &
1187 this%thtr(icell)) * thtsrinv)**this%eps(icell))
1188 this%uzthst(this%nwavst(icell), icell) = smoist
1189 theta2 = this%uzthst(this%nwavst(icell) - 1, icell)
1190 flux2 = this%uzflst(this%nwavst(icell) - 1, icell)
1191 flux1 = this%uzflst(this%nwavst(icell), icell)
1192 theta1 = this%uzthst(this%nwavst(icell), icell)
1193 this%uzspst(this%nwavst(icell), icell) = &
1194 leadspeed(theta1, theta2, flux1, flux2, this%thts(icell), &
1195 this%thtr(icell), this%eps(icell), this%vks(icell))
1201 subroutine leadwav(this, time, itester, itrailflg, thetab, fluxb, &
1202 ffcheck, feps2, delt, icell)
1205 real(DP),
intent(inout) :: thetab
1206 real(DP),
intent(inout) :: fluxb
1207 real(DP),
intent(in) :: feps2
1208 real(DP),
intent(inout) :: time
1209 integer(I4B),
intent(inout) :: itester
1210 integer(I4B),
intent(inout) :: itrailflg
1211 real(DP),
intent(inout) :: ffcheck
1212 real(DP),
intent(in) :: delt
1213 integer(I4B),
intent(in) :: icell
1215 real(DP) :: bottomtime, shortest, fcheck
1216 real(DP) :: eps_m1, timenew, bottom, timedt
1217 real(DP) :: thtsrinv, diff, fluxhld2
1218 real(DP) :: flux1, flux2, theta1, theta2, ftest
1219 integer(I4B) :: iflx, iremove, j, l
1220 integer(I4B) :: nwavp1, jshort
1223 eps_m1 = dble(this%eps(icell)) -
done
1224 thtsrinv =
done / (this%thts(icell) - this%thtr(icell))
1227 if (itrailflg == 0)
then
1228 if (ffcheck > feps2)
then
1229 this%uzflst(this%nwavst(icell), icell) = this%surflux(icell)
1230 if (this%uzflst(this%nwavst(icell), icell) <
dem30) &
1231 this%uzflst(this%nwavst(icell), icell) =
dzero
1232 this%uzthst(this%nwavst(icell), icell) = &
1233 (((this%uzflst(this%nwavst(icell), icell) / this%vks(icell))** &
1234 (
done / this%eps(icell))) * (this%thts(icell) - this%thtr(icell))) &
1236 theta2 = this%uzthst(this%nwavst(icell), icell)
1237 flux2 = this%uzflst(this%nwavst(icell), icell)
1238 flux1 = this%uzflst(this%nwavst(icell) - 1, icell)
1239 theta1 = this%uzthst(this%nwavst(icell) - 1, icell)
1240 this%uzspst(this%nwavst(icell), icell) = &
1241 leadspeed(theta1, theta2, flux1, flux2, this%thts(icell), &
1242 this%thtr(icell), this%eps(icell), this%vks(icell))
1243 this%uzdpst(this%nwavst(icell), icell) =
dzero
1251 fluxhld2 = this%uzflst(1, icell)
1252 if (this%nwavst(icell) == 0) itester = 1
1253 if (itester /= 1)
then
1254 do while (diff >
dem6)
1255 nwavp1 = this%nwavst(icell) + 1
1256 timedt = delt - time
1257 do j = 1, this%nwavst(icell)
1258 this%checktime(j) =
dep20
1262 if (this%nwavst(icell) > 2)
then
1266 nwavp1 = this%nwavst(icell) + 1
1267 do while (j < nwavp1)
1268 ftest = this%uzspst(j - 1, icell) - this%uzspst(j, icell)
1269 if (abs(ftest) >
dem30)
then
1270 this%checktime(j) = (this%uzdpst(j, icell) - &
1271 this%uzdpst(j - 1, icell)) / ftest
1272 if (this%checktime(j) <
dem30) this%checktime(j) =
dep20
1280 if (this%nwavst(icell) > 1)
then
1281 if (this%uzspst(2, icell) >
dzero)
then
1282 bottom = this%uzspst(2, icell)
1284 bottomtime = (this%uzdpst(1, icell) - this%uzdpst(2, icell)) / bottom
1291 do j = this%nwavst(icell), 3, -1
1292 if (shortest - this%checktime(j) > -
dem9)
then
1295 shortest = this%checktime(j)
1298 do j = 3, this%nwavst(icell)
1299 if (shortest - this%checktime(j) <
dem9)
then
1300 if (j /= jshort) this%wavmore(j) = 0
1307 fcheck = (time + shortest) - delt
1308 if (shortest <
dem7) fcheck = -
done
1309 if (bottomtime < shortest .AND. time + bottomtime < delt)
then
1311 do while (j < nwavp1)
1314 this%uzdpst(j, icell) = this%uzdpst(j, icell) + &
1315 this%uzspst(j, icell) * bottomtime
1318 fluxb = this%uzflst(2, icell)
1319 thetab = this%uzthst(2, icell)
1321 call this%shift_waves(icell, 1, 1, &
1322 this%nwavst(icell) - 1, 1)
1324 timenew = time + bottomtime
1325 this%uzspst(1, icell) =
dzero
1328 else if (fcheck <
dzero .AND. this%nwavst(icell) > 2)
then
1330 do while (j < nwavp1)
1331 this%uzdpst(j, icell) = this%uzdpst(j, icell) + &
1332 this%uzspst(j, icell) * shortest
1339 do while (j < this%nwavst(icell) + 1)
1340 if (this%wavmore(j) == 1)
then
1342 theta2 = this%uzthst(j, icell)
1343 flux2 = this%uzflst(j, icell)
1348 flux1 = this%uzflst(j - 2, icell)
1349 theta1 = this%uzthst(j - 2, icell)
1351 this%uzspst(j, icell) =
leadspeed(theta1, theta2, flux1, flux2, &
1354 this%eps(icell), this%vks(icell))
1357 call this%shift_waves(icell, 1, l - 1, &
1358 this%nwavst(icell) - 1, 1)
1359 l = this%nwavst(icell) + 1
1360 iremove = iremove + 1
1364 timenew = timenew + shortest
1369 do while (j < nwavp1)
1370 this%uzdpst(j, icell) = this%uzdpst(j, icell) + &
1371 this%uzspst(j, icell) * timedt
1376 this%totflux(icell) = this%totflux(icell) + fluxhld2 * (timenew - time)
1378 fluxhld2 = this%uzflst(1, icell)
1383 this%nwavst(icell) = this%nwavst(icell) - iremove
1386 if (this%nwavst(icell) == 1)
then
1396 function leadspeed(theta1, theta2, flux1, flux2, thts, thtr, eps, vks)
1400 real(dp),
intent(in) :: theta1
1401 real(dp),
intent(in) :: theta2
1402 real(dp),
intent(in) :: flux1
1403 real(dp),
intent(inout) :: flux2
1404 real(dp),
intent(in) :: thts
1405 real(dp),
intent(in) :: thtr
1406 real(dp),
intent(in) :: eps
1407 real(dp),
intent(in) :: vks
1409 real(dp) :: comp1, comp2, thsrinv, epsfksths
1410 real(dp) :: eps_m1, fhold, comp3
1413 thsrinv =
done / (thts - thtr)
1414 epsfksths = eps * vks * thsrinv
1415 comp1 = theta2 - theta1
1416 comp2 = abs(flux2 - flux1)
1417 comp3 = theta1 - thtr
1419 if (abs(comp1) <
dem30)
then
1421 if (comp3 >
dem30) fhold = (comp3 * thsrinv)**eps
1425 leadspeed = (flux2 - flux1) / (theta2 - theta1)
1437 integer(I4B),
intent(in) :: icell
1438 real(dp),
intent(inout) :: d1
1441 integer(I4B) :: j, k, nwavm1, jj
1444 j = this%nwavst(icell) + 1
1445 k = this%nwavst(icell)
1447 if (d1 > this%uzdpst(1, icell)) d1 = this%uzdpst(1, icell)
1451 if (this%uzdpst(k, icell) - d1 < -
dem30) j = k
1454 if (j > this%nwavst(icell))
then
1455 fm = fm + (this%uzthst(this%nwavst(icell), icell) - this%thtr(icell)) * d1
1456 elseif (this%nwavst(icell) > 1)
then
1458 fm = fm + (this%uzthst(j - 1, icell) - this%thtr(icell)) &
1459 * (d1 - this%uzdpst(j, icell))
1462 fm = fm + (this%uzthst(jj, icell) - this%thtr(icell)) &
1463 * (this%uzdpst(jj, icell) &
1464 - this%uzdpst(jj + 1, icell))
1466 fm = fm + (this%uzthst(this%nwavst(icell), icell) - this%thtr(icell)) &
1467 * (this%uzdpst(this%nwavst(icell), icell))
1469 fm = fm + (this%uzthst(1, icell) - this%thtr(icell)) * d1
1479 integer(I4B),
intent(in) :: icell
1480 integer(I4B),
intent(in) :: itest
1481 integer(I4B),
intent(in) :: iss
1482 real(DP),
intent(in) :: delt
1484 real(DP) :: bot, depthsave, top
1485 real(DP) :: thick, thtsrinv
1486 integer(I4B) :: nwavhld, k, j
1488 bot = this%watab(icell)
1489 top = this%celtop(icell)
1491 nwavhld = this%nwavst(icell)
1492 if (itest == 1)
then
1493 this%uzflst(1, icell) =
dzero
1494 this%uzthst(1, icell) = this%thtr(icell)
1498 if (this%thts(icell) - this%thtr(icell) <
dem7)
then
1501 thtsrinv =
done / (this%thts(icell) - this%thtr(icell))
1503 this%totflux(icell) = this%surflux(icell) * delt
1504 this%watabold(icell) = this%watab(icell)
1505 this%uzthst(1, icell) = this%thti(icell)
1506 this%uzflst(1, icell) = &
1507 this%vks(icell) * (((this%uzthst(1, icell) - this%thtr(icell)) &
1508 * thtsrinv)**this%eps(icell))
1509 this%uzdpst(1, icell) = thick
1510 this%uzspst(1, icell) = thick
1511 this%nwavst(icell) = 1
1515 if (this%watab(icell) - this%watabold(icell) >
dem30)
then
1516 depthsave = this%uzdpst(1, icell)
1518 k = this%nwavst(icell)
1520 if (this%uzdpst(k, icell) - thick < -
dem30) j = k
1523 this%uzdpst(1, icell) = thick
1525 this%uzspst(1, icell) =
dzero
1526 this%nwavst(icell) = this%nwavst(icell) - j + 2
1527 this%uzthst(1, icell) = this%uzthst(j - 1, icell)
1528 this%uzflst(1, icell) = this%uzflst(j - 1, icell)
1529 if (j > 2)
call this%shift_waves(icell, j - 2, 2, &
1530 nwavhld - (j - 2), 1)
1531 elseif (j == 0)
then
1532 this%uzspst(1, icell) =
dzero
1533 this%uzthst(1, icell) = this%uzthst(this%nwavst(icell), icell)
1534 this%uzflst(1, icell) = this%uzflst(this%nwavst(icell), icell)
1535 this%nwavst(icell) = 1
1540 if (thick <=
dzero)
then
1541 this%uzspst(1, icell) =
dzero
1542 this%nwavst(icell) = 1
1543 this%uzthst(1, icell) = this%thtr(icell)
1544 this%uzflst(1, icell) =
dzero
1546 this%watabold(icell) = this%watab(icell)
1552 subroutine uzet(this, icell, delt, ietflag, ierr)
1555 integer(I4B),
intent(in) :: icell
1556 real(DP),
intent(in) :: delt
1557 integer(I4B),
intent(in) :: ietflag
1558 integer(I4B),
intent(inout) :: ierr
1561 real(DP) :: thetaout
1564 real(DP) :: thtsrinv
1565 real(DP) :: epsfksthts
1580 integer(I4B) :: jhold
1584 integer(I4B) :: numadd
1587 integer(I4B) :: itest
1590 this%etact(icell) =
dzero
1591 if (this%extdpuz(icell) <
dem7)
return
1592 petsub = this%rootact(icell) * this%pet(icell) * &
1593 this%extdpuz(icell) / this%extdp(icell)
1594 thetaout = delt * petsub / this%extdp(icell)
1595 if (ietflag == 1) thetaout = delt * this%pet(icell) / this%extdp(icell)
1596 if (thetaout <
dem10)
return
1597 depth = this%uzdpst(1, icell)
1598 st = this%unsat_stor(icell, depth)
1599 if (st <
dem4)
return
1602 nwv = this%nwavst(icell)
1604 call this%store_waves(icell, this%etsav)
1606 this%etact(icell) =
dzero
1607 if (this%thts(icell) - this%thtr(icell) <
dem7)
then
1608 thtsrinv = 1.0 /
dem7
1610 thtsrinv =
done / (this%thts(icell) - this%thtr(icell))
1612 epsfksthts = this%eps(icell) * this%vks(icell) * thtsrinv
1613 this%etact(icell) =
dzero
1615 extwc1 = this%extwc(icell) - this%thtr(icell)
1622 do while (itest == 0)
1624 if (k > 1 .AND. abs(fmp - petsub) >
dem5 * petsub)
then
1625 factor = factor / (fm / petsub)
1629 if (this%nwavst(icell) == 1 .AND. &
1630 this%uzdpst(1, icell) <= this%extdpuz(icell))
then
1631 if (ietflag == 2)
then
1632 tho = this%uzthst(1, icell)
1633 fktho = this%uzflst(1, icell)
1634 hcap = this%caph(icell, tho)
1635 thetaout = this%rate_et_z(icell, factor, fktho, hcap)
1637 if ((this%uzthst(1, icell) - thetaout) > this%thtr(icell) + extwc1)
then
1638 this%uzthst(1, icell) = this%uzthst(1, icell) - thetaout
1639 this%uzflst(1, icell) = &
1640 this%vks(icell) * (((this%uzthst(1, icell) - &
1641 this%thtr(icell)) * thtsrinv)**this%eps(icell))
1642 else if (this%uzthst(1, icell) > this%thtr(icell) + extwc1)
then
1643 this%uzthst(1, icell) = this%thtr(icell) + extwc1
1644 this%uzflst(1, icell) = &
1645 this%vks(icell) * (((this%uzthst(1, icell) - &
1646 this%thtr(icell)) * thtsrinv)**this%eps(icell))
1650 else if (this%nwavst(icell) > 1 .AND. &
1651 this%uzdpst(this%nwavst(icell), icell) > this%extdpuz(icell))
then
1652 if (ietflag == 2)
then
1653 tho = this%uzthst(this%nwavst(icell), icell)
1654 fktho = this%uzflst(this%nwavst(icell), icell)
1655 hcap = this%caph(icell, tho)
1656 thetaout = this%rate_et_z(icell, factor, fktho, hcap)
1658 if (this%nwavst(icell) + 1 > this%nwav)
then
1664 if (this%uzthst(this%nwavst(icell), icell) - thetaout > &
1665 this%thtr(icell) + extwc1)
then
1666 this%uzthst(this%nwavst(icell) + 1, icell) = &
1667 this%uzthst(this%nwavst(icell), icell) - thetaout
1669 else if (this%uzthst(this%nwavst(icell), icell) > &
1670 this%thtr(icell) + extwc1)
then
1671 this%uzthst(this%nwavst(icell) + 1, icell) = this%thtr(icell) + extwc1
1674 if (numadd == 1)
then
1675 this%uzflst(this%nwavst(icell) + 1, icell) = &
1677 (((this%uzthst(this%nwavst(icell) + 1, icell) - &
1678 this%thtr(icell)) * thtsrinv)**this%eps(icell))
1679 theta2 = this%uzthst(this%nwavst(icell) + 1, icell)
1680 flux2 = this%uzflst(this%nwavst(icell) + 1, icell)
1681 flux1 = this%uzflst(this%nwavst(icell), icell)
1682 theta1 = this%uzthst(this%nwavst(icell), icell)
1683 this%uzspst(this%nwavst(icell) + 1, icell) = &
1684 leadspeed(theta1, theta2, flux1, flux2, this%thts(icell), &
1685 this%thtr(icell), this%eps(icell), this%vks(icell))
1686 this%uzdpst(this%nwavst(icell) + 1, icell) = this%extdpuz(icell)
1687 this%nwavst(icell) = this%nwavst(icell) + 1
1688 if (this%nwavst(icell) > this%nwav)
then
1699 else if (this%nwavst(icell) == 1)
then
1700 if (this%nwavst(icell) + 1 > this%nwav)
then
1706 if (ietflag == 2)
then
1707 tho = this%uzthst(1, icell)
1708 fktho = this%uzflst(1, icell)
1709 hcap = this%caph(icell, tho)
1710 thetaout = this%rate_et_z(icell, factor, fktho, hcap)
1712 if ((this%uzthst(1, icell) - thetaout) > this%thtr(icell) + extwc1)
then
1713 if (thetaout >
dem30)
then
1714 this%uzthst(2, icell) = this%uzthst(1, icell) - thetaout
1715 this%uzflst(2, icell) = &
1716 this%vks(icell) * (((this%uzthst(2, icell) - this%thtr(icell)) * &
1717 thtsrinv)**this%eps(icell))
1718 this%uzdpst(2, icell) = this%extdpuz(icell)
1719 theta2 = this%uzthst(2, icell)
1720 flux2 = this%uzflst(2, icell)
1721 flux1 = this%uzflst(1, icell)
1722 theta1 = this%uzthst(1, icell)
1723 this%uzspst(2, icell) = &
1724 leadspeed(theta1, theta2, flux1, flux2, this%thts(icell), &
1725 this%thtr(icell), this%eps(icell), this%vks(icell))
1726 this%nwavst(icell) = this%nwavst(icell) + 1
1727 if (this%nwavst(icell) > this%nwav)
then
1734 else if (this%uzthst(1, icell) > this%thtr(icell) + extwc1)
then
1735 if (thetaout >
dem30)
then
1736 this%uzthst(2, icell) = this%thtr(icell) + extwc1
1737 this%uzflst(2, icell) = &
1738 this%vks(icell) * (((this%uzthst(2, icell) - &
1739 this%thtr(icell)) * thtsrinv)**this%eps(icell))
1740 this%uzdpst(2, icell) = this%extdpuz(icell)
1741 theta2 = this%uzthst(2, icell)
1742 flux2 = this%uzflst(2, icell)
1743 flux1 = this%uzflst(1, icell)
1744 theta1 = this%uzthst(1, icell)
1745 this%uzspst(2, icell) = &
1746 leadspeed(theta1, theta2, flux1, flux2, this%thts(icell), &
1747 this%thtr(icell), this%eps(icell), this%vks(icell))
1748 this%nwavst(icell) = this%nwavst(icell) + 1
1749 if (this%nwavst(icell) > this%nwav)
then
1760 if (this%uzdpst(1, icell) - this%extdpuz(icell) >
dem7)
then
1766 diff = this%uzdpst(j, icell) - this%extdpuz(icell)
1767 if (diff >
dzero)
then
1774 if (this%uzthst(j, icell) > this%thtr(icell) + extwc1)
then
1777 if (abs(diff) >
dem5)
then
1778 if (this%nwavst(icell) + 1 > this%nwav)
then
1784 call this%shift_waves(icell, -1, &
1785 this%nwavst(icell) + 1, j, -1)
1786 this%uzdpst(j, icell) = this%extdpuz(icell)
1787 this%nwavst(icell) = this%nwavst(icell) + 1
1788 if (this%nwavst(icell) > this%nwav)
then
1797 jhold = this%nwavst(icell)
1799 do while (i < this%nwavst(icell))
1800 if (this%uzthst(i, icell) > this%thtr(icell) + extwc1)
then
1802 i = this%nwavst(icell) + 1
1814 do while (kk <= this%nwavst(icell))
1815 if (ietflag == 2)
then
1816 tho = this%uzthst(kk, icell)
1817 fktho = this%uzflst(kk, icell)
1818 hcap = this%caph(icell, tho)
1819 thetaout = this%rate_et_z(icell, factor, fktho, hcap)
1821 if (this%uzthst(kk, icell) > this%thtr(icell) + extwc1)
then
1822 if (this%uzthst(kk, icell) - thetaout > &
1823 this%thtr(icell) + extwc1)
then
1824 this%uzthst(kk, icell) = this%uzthst(kk, icell) - thetaout
1825 else if (this%uzthst(kk, icell) > this%thtr(icell) + extwc1)
then
1826 this%uzthst(kk, icell) = this%thtr(icell) + extwc1
1829 this%uzflst(kk, icell) = &
1831 (((this%uzthst(kk, icell) - &
1832 this%thtr(icell)) * thtsrinv)**this%eps(icell))
1836 this%vks(icell) * ((this%uzthst(kk - 1, icell) - &
1837 this%thtr(icell)) * thtsrinv)**this%eps(icell)
1839 this%vks(icell) * ((this%uzthst(kk, icell) - &
1840 this%thtr(icell)) * thtsrinv)**this%eps(icell)
1841 this%uzflst(kk, icell) = flux2
1842 theta2 = this%uzthst(kk, icell)
1843 theta1 = this%uzthst(kk - 1, icell)
1844 this%uzspst(kk, icell) =
leadspeed(theta1, theta2, flux1, flux2, &
1847 this%eps(icell), this%vks(icell))
1856 do while (kj <= this%nwavst(icell) - 1)
1857 if (abs(this%uzthst(kj, icell) - this%uzthst(kj + 1, icell)) <
dem6)
then
1858 call this%shift_waves(icell, 1, kj + 1, &
1859 this%nwavst(icell) - 1, 1)
1861 this%nwavst(icell) = this%nwavst(icell) - 1
1865 depth = this%uzdpst(1, icell)
1866 fm = this%unsat_stor(icell, depth)
1867 this%etact(icell) = st - fm
1868 fm = this%etact(icell) / delt
1869 if (this%etact(icell) <
dzero)
then
1870 call this%load_waves(icell, this%etsav)
1871 this%nwavst(icell) = nwv
1872 this%etact(icell) =
dzero
1873 elseif (petsub - fm < -
dem15 .AND. ietflag == 2)
then
1876 call this%load_waves(icell, this%etsav)
1877 this%nwavst(icell) = nwv
1878 this%etact(icell) =
dzero
1887 elseif (ietflag < 2)
then
1900 integer(I4B),
intent(in) :: icell
1901 real(dp),
intent(in) :: tho
1903 real(dp) ::
caph, lambda, star
1906 star = (tho - this%thtr(icell)) / (this%thts(icell) - this%thtr(icell))
1909 if (star >
dem15)
then
1910 if (tho - this%thts(icell) <
dem15)
then
1911 caph = this%ha(icell) * star**(-
done / lambda)
1924 integer(I4B),
intent(in) :: icell
1925 real(dp),
intent(in) :: factor, fktho, h
1927 rate_et_z = factor * fktho * (h - this%hroot(icell))
1939 integer(I4B),
intent(in) :: icell
1940 real(dp),
intent(in) :: depth
1942 real(dp) :: theta_at_depth
1949 if (this%watab(icell) < this%celtop(icell))
then
1950 if (this%celtop(icell) - depth > this%watab(icell))
then
1953 f1 = this%unsat_stor(icell, d1)
1954 f2 = this%unsat_stor(icell, d2)
1955 theta_at_depth = this%thtr(icell) + (f2 - f1) / (d2 - d1)
1957 theta_at_depth = this%thts(icell)
1960 theta_at_depth = this%thts(icell)
1969 integer(I4B),
intent(in) :: icell
1971 real(dp) :: watercontent
1981 hgwf = this%watab(icell)
1982 top = this%celtop(icell)
1983 bot = this%celbot(icell)
1984 thk = top - max(bot, hgwf)
1985 if (thk >
dzero)
then
1986 theta_r = this%thtr(icell)
1988 fm = this%unsat_stor(icell, d)
1989 watercontent = fm / thk
1990 watercontent = watercontent + theta_r
1992 watercontent =
dzero
This module contains simulation constants.
real(dp), parameter dem12
real constant 1e-12
real(dp), parameter dem20
real constant 1e-20
real(dp), parameter dem10
real constant 1e-10
real(dp), parameter dem7
real constant 1e-7
real(dp), parameter dep20
real constant 1e20
real(dp), parameter dem14
real constant 1e-14
real(dp), parameter dhalf
real constant 1/2
real(dp), parameter dem3
real constant 1e-3
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 dem9
real constant 1e-9
real(dp), parameter dem15
real constant 1e-15
real(dp), parameter dtwo
real constant 2
real(dp), parameter dthree
real constant 3
real(dp), parameter done
real constant 1
This module defines variable data types.
subroutine slinear(x, range, dydx, y)
@ brief sLinear
subroutine scubiclinear(x, range, dydx, y)
@ brief sCubicLinear
subroutine sscurve(x, range, dydx, y)
@ brief SCurve
integer(i4b), pointer, public itmuni
flag indicating time units
integer(i4b), pointer, public kper
current stress period number
real(dp), pointer, public delt
length of the current time step
subroutine update_wav(this, icell, delt, iss, itest)
Update to new state of uz at end of time step.
subroutine factors(feps1, feps2)
Calculate unit specific tolerances.
subroutine uzflow(this, thick, thickold, delt, ietflag, icell, ierr)
Method of Characteristics solution for kinematic wave equation.
subroutine advance(this, icell)
Set variables to advance to new time step. nothing yet.
subroutine setbelowpet(this, icell, jbelow)
Subtract aet from pet to calculate residual et for deeper cells.
subroutine gwseep(this, icell, deriv, scale, hgwf, trhs, thcof, seep)
Calculate groundwater discharge to land surface.
subroutine sethead(this, icell, hgwf)
Set initial head for uzf object.
subroutine leadwav(this, time, itester, itrailflg, thetab, fluxb, ffcheck, feps2, delt, icell)
Create a lead wave and route over time step.
real(dp) function caph(this, icell, tho)
Calculate capillary pressure head from B-C equation.
subroutine shift_waves(this, icell, shft, strt, stp, cntr)
Move waves within a cell by shft positions.
subroutine setdatauzfarea(this, icell, areamult)
Set uzfarea using cellarea and areamult.
subroutine setdataetha(this, icell, jbelow, ha, hroot, rootact)
Set variables for head-based unsaturated flow.
subroutine addrech(this, icell, jbelow, hgwf, trhs, thcof, deriv, delt)
Add recharge or infiltration to cells.
subroutine setwaves(this, icell)
Reset waves to default values at start of simulation.
subroutine setdata(this, icell, area, top, bot, surfdep, vks, thtr, thts, thti, eps, ntrail, landflag, ivertcon)
Set uzf object material properties.
real(dp) function leadspeed(theta1, theta2, flux1, flux2, thts, thtr, eps, vks)
Calculates waves speed from dflux/dtheta.
real(dp) function get_water_content_at_depth(this, icell, depth)
Determine the water content at a specific depth.
subroutine rejfinf(this, icell, deriv, hgwf, trhs, thcof, finfact)
Reject applied infiltration due to low vks.
subroutine solve(this, jbelow, icell, totfluxtot, ietflag, issflag, iseepflag, hgwf, qfrommvr, ierr, reset_state, trhs, thcof, deriv, watercontent)
Formulate the unsaturated flow object, calculate terms for gwf equation.
real(dp) function rate_et_z(this, icell, factor, fktho, h)
Calculate capillary pressure-based uz et.
subroutine simgwet(this, igwetflag, icell, hgwf, trhs, thcof, det)
Calculate gwf et using residual uzf pet.
real(dp) function get_wcnew(this, icell)
Calculate and return the cell-based water content value.
subroutine uz_rise(this, icell, totfluxtot)
Calculate recharge due to a rise in the gwf head.
subroutine uzet(this, icell, delt, ietflag, ierr)
Remove water from uz due to et.
subroutine setgwpet(this, icell)
Subtract aet from pet to calculate residual et for gw.
subroutine routewaves(this, totfluxtot, delt, ietflag, icell, ierr)
Prepare and route waves over time step.
subroutine setdataet(this, icell, jbelow, pet, extdp)
Set unsaturated ET-related variables.
subroutine dealloc(this)
Deallocate uzf object variables.
real(dp) function unsat_stor(this, icell, d1)
Sums up mobile water over depth interval.
subroutine trailwav(this, icell, ierr)
Create and set trail waves.
subroutine store_waves(this, icell, store)
Save the wave train of one cell into a snapshot.
subroutine setdataetwc(this, icell, jbelow, extwc)
Set extinction water content.
subroutine setdatafinf(this, icell, finf)
Set infiltration.
subroutine load_waves(this, icell, store)
Restore the wave train of one cell from a snapshot.
real(dp) function, public etfunc_lin(efflndsrf, extdp, resid_pet, deriv_et, trhs, thcof, hgwf, celtop, celbot)
Calculate gwf ET using linear decay ET function from mf-2005.
real(dp) function, public etfunc_nlin(efflndsrf, extdp, resid_pet, deriv_et, trhs, thcof, hgwf)
Calculate gwf ET using a square decay ET function with smoothing at the specified extinction depth.
Snapshot of one cell's wave train.