5 module procedure sfr_calc_transient
8 integer(I4B) :: igwfconn
9 integer(I4B) :: number_picard
12 real(DP) :: kinematic_residual
13 real(DP) :: kinematic_storage
43 real(DP) :: residual_final
53 weight = this%storage_weight
63 this%usinflow(n) = qu + qi + qfrommvr
65 qa = this%usinflowold(n)
66 qb = this%dsflowold(n)
67 call this%sfr_calc_reach_depth(n, qa, da)
68 call this%sfr_calc_reach_depth(n, qb, db)
71 call this%sfr_calc_reach_depth(n, qc, dc)
73 xsa_a = this%calc_area_wet(n, da)
74 xsa_b = this%calc_area_wet(n, db)
75 xsa_c = this%calc_area_wet(n, dc)
80 qd = (qc + qb) * dhalf
82 call this%sfr_calc_reach_depth(n, qd, dd)
83 ad = this%calc_area_wet(n, dd)
86 d1 = (dc + dd) * dhalf
90 igwfconn = this%sfr_gwf_conn(n)
91 if (igwfconn == 1)
then
100 en2 = hgwf - this%strtop(n)
101 if (en2 > dtwo * dem5 .and. dc < dem5)
then
104 d1 = dhalf * (en1 + en2)
106 q = qu + qi + qr - qe + qro + qfrommvr
107 call this%sfr_calc_qgwf(n, d1, hgwf, qgwf)
116 call this%sfr_calc_reach_depth(n, q, d)
117 a = this%calc_area_wet(n, d)
120 call this%sfr_calc_reach_depth(n, q2, d2)
121 a2 = this%calc_area_wet(n, d2)
122 celerity = (q2 - q) / (a2 - a)
126 courant = celerity *
delt / this%length(n)
127 if (courant > dzero)
then
128 if (courant < this%crmin(n)) this%crmin(n) = courant
129 if (courant > this%crmax(n)) this%crmax(n) = courant
130 this%crsum(n) = this%crsum(n) + courant
131 this%crcnt(n) = this%crcnt(n) + 1
134 qlat = qlat / this%length(n)
136 number_picard = this%maxsfrpicard
137 if (igwfconn == 1)
then
138 number_picard = this%maxsfrpicard
143 kinematicpicard:
do i = 1, number_picard
144 if (igwfconn == 1)
then
145 q = qu + qi + qr - qe + qro + qfrommvr
146 call this%sfr_calc_qgwf(n, d1, hgwf, qgwf)
153 qsrc = qlat - qgwf / this%length(n)
155 newton:
do j = 1, this%maxsfrit
157 call this%sfr_calc_reach_depth(n, qd2, dd2)
158 ad2 = this%calc_area_wet(n, dd2)
161 xsa_a, xsa_b, xsa_c, ad, &
162 qsrc, this%length(n), weight,
delt, &
166 xsa_a, xsa_b, xsa_c, ad2, &
167 qsrc, this%length(n), weight,
delt, &
169 qderv = (residual2 - residual) / dq
170 if (qderv > dzero)
then
171 delq = -residual / qderv
176 if (qd + delq < dem30)
then
182 call this%sfr_calc_reach_depth(n, qd, dd)
183 ad = this%calc_area_wet(n, dd)
185 xsa_a, xsa_b, xsa_c, ad, &
186 qsrc, this%length(n), weight,
delt, &
189 if (abs(delq) < qtol .and. abs(residual_final) < qtol)
then
200 dmid = (dc + dd) * dhalf
206 d1 = dhalf * (en1 + en2)
209 d1 = (dc + dd) * dhalf
213 if (i > 1 .and. abs(delh) < this%dmaxchg)
then
217 end do kinematicpicard
220 this%length(n),
delt, &
223 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