10 module procedure sfr_calc_transient
13 integer(I4B) :: igwfconn
14 integer(I4B) :: number_picard
17 real(DP) :: kinematic_residual
18 real(DP) :: kinematic_storage
48 real(DP) :: residual_final
58 weight = this%storage_weight
68 this%usinflow(n) = qu + qi + qfrommvr
70 qa = this%usinflowold(n)
71 qb = this%dsflowold(n)
72 call this%sfr_calc_reach_depth(n, qa, da)
73 call this%sfr_calc_reach_depth(n, qb, db)
76 call this%sfr_calc_reach_depth(n, qc, dc)
78 xsa_a = this%calc_area_wet(n, da)
79 xsa_b = this%calc_area_wet(n, db)
80 xsa_c = this%calc_area_wet(n, dc)
85 qd = (qc + qb) * dhalf
87 call this%sfr_calc_reach_depth(n, qd, dd)
88 ad = this%calc_area_wet(n, dd)
91 d1 = (dc + dd) * dhalf
95 igwfconn = this%sfr_gwf_conn(n)
96 if (igwfconn == 1)
then
105 en2 = hgwf - this%strtop(n)
106 if (en2 > dtwo * dem5 .and. dc < dem5)
then
109 d1 = dhalf * (en1 + en2)
111 q = qu + qi + qr - qe + qro + qfrommvr
112 call this%sfr_calc_qgwf(n, d1, hgwf, qgwf)
121 call this%sfr_calc_reach_depth(n, q, d)
122 a = this%calc_area_wet(n, d)
125 call this%sfr_calc_reach_depth(n, q2, d2)
126 a2 = this%calc_area_wet(n, d2)
127 celerity = (q2 - q) / (a2 - a)
131 courant = celerity *
delt / this%length(n)
133 qlat = qlat / this%length(n)
135 number_picard = this%maxsfrpicard
136 if (igwfconn == 1)
then
137 number_picard = this%maxsfrpicard
142 kinematicpicard:
do i = 1, number_picard
143 if (igwfconn == 1)
then
144 q = qu + qi + qr - qe + qro + qfrommvr
145 call this%sfr_calc_qgwf(n, d1, hgwf, qgwf)
152 qsrc = qlat - qgwf / this%length(n)
154 newton:
do j = 1, this%maxsfrit
156 call this%sfr_calc_reach_depth(n, qd2, dd2)
157 ad2 = this%calc_area_wet(n, dd2)
160 xsa_a, xsa_b, xsa_c, ad, &
161 qsrc, this%length(n), weight,
delt, &
165 xsa_a, xsa_b, xsa_c, ad2, &
166 qsrc, this%length(n), weight,
delt, &
168 qderv = (residual2 - residual) / dq
169 if (qderv > dzero)
then
170 delq = -residual / qderv
175 if (qd + delq < dem30)
then
181 call this%sfr_calc_reach_depth(n, qd, dd)
182 ad = this%calc_area_wet(n, dd)
184 xsa_a, xsa_b, xsa_c, ad, &
185 qsrc, this%length(n), weight,
delt, &
188 if (abs(delq) < qtol .and. abs(residual_final) < qtol)
then
199 dmid = (dc + dd) * dhalf
205 d1 = dhalf * (en1 + en2)
208 d1 = (dc + dd) * dhalf
212 if (i > 1 .and. abs(delh) < this%dmaxchg)
then
216 end do kinematicpicard
219 this%length(n),
delt, &
222 end procedure sfr_calc_transient
real(dp) function kinematic_storage(aa, ab, ac, ad, length, delt, courant)
Kinematic routing equation storage term.
real(dp) function kinematic_residual(qa, qb, qc, qd, aa, ab, ac, ad, qsrc, length, weight, delt, courant)
Kinematic routing equation residual.
This module contains the SFR package methods.
real(dp), pointer, public delt
length of the current time step