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)
132 if (courant > dzero)
then
133 if (courant < this%crmin(n)) this%crmin(n) = courant
134 if (courant > this%crmax(n)) this%crmax(n) = courant
135 this%crsum(n) = this%crsum(n) + courant
136 this%crcnt(n) = this%crcnt(n) + 1
139 qlat = qlat / this%length(n)
141 number_picard = this%maxsfrpicard
142 if (igwfconn == 1)
then
143 number_picard = this%maxsfrpicard
148 kinematicpicard:
do i = 1, number_picard
149 if (igwfconn == 1)
then
150 q = qu + qi + qr - qe + qro + qfrommvr
151 call this%sfr_calc_qgwf(n, d1, hgwf, qgwf)
158 qsrc = qlat - qgwf / this%length(n)
160 newton:
do j = 1, this%maxsfrit
162 call this%sfr_calc_reach_depth(n, qd2, dd2)
163 ad2 = this%calc_area_wet(n, dd2)
166 xsa_a, xsa_b, xsa_c, ad, &
167 qsrc, this%length(n), weight,
delt, &
171 xsa_a, xsa_b, xsa_c, ad2, &
172 qsrc, this%length(n), weight,
delt, &
174 qderv = (residual2 - residual) / dq
175 if (qderv > dzero)
then
176 delq = -residual / qderv
181 if (qd + delq < dem30)
then
187 call this%sfr_calc_reach_depth(n, qd, dd)
188 ad = this%calc_area_wet(n, dd)
190 xsa_a, xsa_b, xsa_c, ad, &
191 qsrc, this%length(n), weight,
delt, &
194 if (abs(delq) < qtol .and. abs(residual_final) < qtol)
then
205 dmid = (dc + dd) * dhalf
211 d1 = dhalf * (en1 + en2)
214 d1 = (dc + dd) * dhalf
218 if (i > 1 .and. abs(delh) < this%dmaxchg)
then
222 end do kinematicpicard
225 this%length(n),
delt, &
228 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