38 cxs_xf, cxs_h, cxs_rf, unitconv, &
39 icalcmeth)
result(depth)
41 real(dp),
intent(in) :: qrch
42 real(dp),
intent(in) :: width
43 real(dp),
intent(in) :: rough
44 real(dp),
intent(in) :: slope
45 real(dp),
dimension(:),
intent(in) :: cxs_xf
46 real(dp),
dimension(:),
intent(in) :: cxs_h
47 real(dp),
dimension(:),
intent(in) :: cxs_rf
48 real(dp),
intent(in) :: unitconv
49 integer(I4B),
intent(in) :: icalcmeth
54 if (icalcmeth == 1)
then
57 cxs_xf, cxs_h, cxs_rf, unitconv, &
62 cxs_xf, cxs_h, cxs_rf, unitconv, &
77 cxs_xf, cxs_h, cxs_rf, unitconv, &
78 icalcmeth)
result(depth)
82 real(dp),
intent(in) :: qrch
83 real(dp),
intent(in) :: width
84 real(dp),
intent(in) :: rough
85 real(dp),
intent(in) :: slope
86 real(dp),
dimension(:),
intent(in) :: cxs_xf
87 real(dp),
dimension(:),
intent(in) :: cxs_h
88 real(dp),
dimension(:),
intent(in) :: cxs_rf
89 real(dp),
intent(in) :: unitconv
90 integer(I4B),
intent(in) :: icalcmeth
96 integer(I4B) :: maxiter = 100
98 real(dp) :: dmaxchg =
dem5
107 b = maxval(cxs_h) *
dtwo
110 bisectiter:
do iter = 1, maxiter
113 f_c =
calc_qman(c, width, rough, slope, &
114 cxs_xf, cxs_h, cxs_rf, unitconv, icalcmeth) - qrch
115 if (f_c ==
dzero .or. (b - a) /
dtwo < dmaxchg)
then
120 f_a =
calc_qman(a, width, rough, slope, &
121 cxs_xf, cxs_h, cxs_rf, unitconv, icalcmeth) - qrch
122 if (sign(
done, f_c) == sign(
done, f_a))
then
131 print *,
"bisection routine failed"
144 cxs_xf, cxs_h, cxs_rf, unitconv, &
145 icalcmeth)
result(depth)
149 real(dp),
intent(in) :: qrch
150 real(dp),
intent(in) :: width
151 real(dp),
intent(in) :: rough
152 real(dp),
intent(in) :: slope
153 real(dp),
dimension(:),
intent(in) :: cxs_xf
154 real(dp),
dimension(:),
intent(in) :: cxs_h
155 real(dp),
dimension(:),
intent(in) :: cxs_rf
156 real(dp),
intent(in) :: unitconv
157 integer(I4B),
intent(in) :: icalcmeth
163 integer(I4B) :: maxiter = 100
165 real(dp) :: dmaxchg =
dem5
167 real(dp) :: perturbation
177 perturbation = deps *
dtwo
183 nriter:
do iter = 1, maxiter
185 q1 =
calc_qman(d + perturbation, width, rough, slope, &
186 cxs_xf, cxs_h, cxs_rf, unitconv, icalcmeth)
188 if (dq /=
dzero)
then
189 derv = perturbation / (q1 - q0)
197 cxs_xf, cxs_h, cxs_rf, unitconv, icalcmeth)
201 if (abs(dd) < dmaxchg)
then
219 cxs_xf, cxs_h, cxs_rf, unitconv, icalcmeth)
result(qman)
222 real(dp),
intent(in) :: depth
223 real(dp),
intent(in) :: width
224 real(dp),
intent(in) :: rough
225 real(dp),
intent(in) :: slope
226 real(dp),
dimension(:),
intent(in) :: cxs_xf
227 real(dp),
dimension(:),
intent(in) :: cxs_h
228 real(dp),
dimension(:),
intent(in) :: cxs_rf
229 real(dp),
intent(in) :: unitconv
230 integer(I4B),
intent(in) :: icalcmeth
236 integer(I4B) :: linmeth
238 select case (icalcmeth)
242 cxs_xf, cxs_h, cxs_rf, unitconv, &
246 cxs_xf, cxs_h, cxs_rf, unitconv)
250 cxs_xf, cxs_h, cxs_rf, unitconv, &
259 cxs_xf, cxs_h, cxs_rf, unitconv, &
260 linmeth)
result(qman)
263 real(dp),
intent(in) :: depth
264 real(dp),
intent(in) :: width
265 real(dp),
intent(in) :: rough
266 real(dp),
intent(in) :: slope
267 real(dp),
dimension(:),
intent(in) :: cxs_xf
268 real(dp),
dimension(:),
intent(in) :: cxs_h
269 real(dp),
dimension(:),
intent(in) :: cxs_rf
270 real(dp),
intent(in) :: unitconv
271 integer(I4B),
intent(in) :: linmeth
283 real(dp) :: rough_composite
289 if (depth >
dzero)
then
294 cxs_xf, cxs_h, cxs_rf, &
303 qman = unitconv * aw * (rh**
dtwothirds) * sqrt(slope) / rough
313 cxs_xf, cxs_h, cxs_rf, &
316 integer(I4B),
intent(in) :: npts
317 real(dp),
intent(in) :: depth
318 real(dp),
intent(in) :: width
319 real(dp),
intent(in) :: rough
320 real(dp),
intent(in) :: slope
321 real(dp),
dimension(:),
intent(in) :: cxs_xf
322 real(dp),
dimension(:),
intent(in) :: cxs_h
323 real(dp),
dimension(:),
intent(in) :: cxs_rf
324 integer(I4B),
intent(in) :: linmeth
334 real(dp),
dimension(npts) :: stations
335 real(dp),
dimension(npts - 1) :: perimeters
339 stations(n) = cxs_xf(n) * width
343 select case (linmeth)
356 if (depth >
dzero)
then
363 rc = rc + (rough * cxs_rf(n))**exp1 * perimeters(n)
364 wp = wp + perimeters(n)
380 cxs_xf, cxs_h, cxs_rf, unitconv)
result(qman)
383 real(dp),
intent(in) :: depth
384 real(dp),
intent(in) :: width
385 real(dp),
intent(in) :: rough
386 real(dp),
intent(in) :: slope
387 real(dp),
dimension(:),
intent(in) :: cxs_xf
388 real(dp),
dimension(:),
intent(in) :: cxs_h
389 real(dp),
dimension(:),
intent(in) :: cxs_rf
390 real(dp),
intent(in) :: unitconv
407 if (depth >
dzero)
then
438 qman = unitconv * aw * (rh**
dtwothirds) * sqrt(slope) / rough
458 integer(I4B),
intent(in) :: npts
459 real(dp),
dimension(npts),
intent(in) :: stations
465 w = stations(npts) - stations(1)
483 integer(I4B),
intent(in) :: npts
484 real(dp),
dimension(npts),
intent(in) :: xfraction
485 real(dp),
dimension(npts),
intent(in) :: heights
486 real(dp),
intent(in) :: width
487 real(dp),
intent(in) :: d
491 real(dp),
dimension(npts) :: stations
492 real(dp),
dimension(npts - 1) :: widths
496 stations(n) = xfraction(n) * width
523 integer(I4B),
intent(in) :: npts
524 real(dp),
dimension(npts),
intent(in) :: xfraction
525 real(dp),
dimension(npts),
intent(in) :: heights
526 real(dp),
intent(in) :: width
527 real(dp),
intent(in) :: d
531 real(dp),
dimension(npts) :: stations
532 real(dp),
dimension(npts - 1) :: perimeters
536 stations(n) = xfraction(n) * width
547 p = p + perimeters(n)
563 integer(I4B),
intent(in) :: npts
564 real(dp),
dimension(npts),
intent(in) :: xfraction
565 real(dp),
dimension(npts),
intent(in) :: heights
566 real(dp),
intent(in) :: width
567 real(dp),
intent(in) :: d
571 real(dp),
dimension(npts) :: stations
572 real(dp),
dimension(npts - 1) :: areas
576 stations(n) = xfraction(n) * width
600 width, rough, d)
result(c)
602 integer(I4B),
intent(in) :: npts
603 real(dp),
dimension(npts),
intent(in) :: xfraction
604 real(dp),
dimension(npts),
intent(in) :: heights
605 real(dp),
dimension(:),
intent(in) :: cxs_rf
606 real(dp),
intent(in) :: width
607 real(dp),
intent(in) :: rough
608 real(dp),
intent(in) :: d
623 width, rough, d)
result(c)
625 integer(I4B),
intent(in) :: npts
626 real(dp),
dimension(npts),
intent(in) :: xfraction
627 real(dp),
dimension(npts),
intent(in) :: heights
628 real(dp),
dimension(:),
intent(in) :: cxs_rf
629 real(dp),
intent(in) :: width
630 real(dp),
intent(in) :: rough
631 real(dp),
intent(in) :: d
644 ravg = rough * cxs_rf(1)
647 xfraction, heights, cxs_rf, 0)
661 real(dp),
dimension(:),
intent(in) :: xfraction
665 if (
size(xfraction) == 4)
then
666 if (xfraction(1) == xfraction(2) .and. &
667 xfraction(3) == xfraction(4))
then
677 real(dp),
dimension(:),
intent(in) :: cxs_rf
683 rmin = minval(cxs_rf(1:3))
684 rmax = maxval(cxs_rf(1:3))
698 width, rough, d)
result(c)
700 integer(I4B),
intent(in) :: npts
701 real(dp),
dimension(npts),
intent(in) :: xfraction
702 real(dp),
dimension(npts),
intent(in) :: heights
703 real(dp),
dimension(:),
intent(in) :: cxs_rf
704 real(dp),
intent(in) :: width
705 real(dp),
intent(in) :: rough
706 real(dp),
intent(in) :: d
714 real(dp),
dimension(npts) :: stations
715 real(dp),
dimension(npts - 1) :: areas
716 real(dp),
dimension(npts - 1) :: perimeters
720 stations(n) = xfraction(n) * width
732 rc = cxs_rf(n) * rough
755 integer(I4B),
intent(in) :: npts
756 real(dp),
dimension(npts),
intent(in) :: stations
757 real(dp),
dimension(npts),
intent(in) :: heights
758 real(dp),
intent(in) :: d
764 real(dp),
dimension(npts - 1) :: areas
765 real(dp),
dimension(npts - 1) :: perimeters
777 p = p + perimeters(n)
810 integer(I4B),
intent(in) :: npts
811 real(dp),
dimension(npts),
intent(in) :: xfraction
812 real(dp),
dimension(npts),
intent(in) :: heights
813 real(dp),
intent(in) :: width
814 real(dp),
intent(in) :: d
818 real(dp),
dimension(npts) :: stations
822 stations(n) = xfraction(n) * width
841 roughness, conv_fact, width, slope, d)
result(q)
843 integer(I4B),
intent(in) :: npts
844 real(dp),
dimension(npts),
intent(in) :: xfraction
845 real(dp),
dimension(npts),
intent(in) :: heights
846 real(dp),
dimension(npts),
intent(in) :: roughfracs
847 real(dp),
intent(in) :: roughness
848 real(dp),
intent(in) :: conv_fact
849 real(dp),
intent(in) :: width
850 real(dp),
intent(in) :: slope
851 real(dp),
intent(in) :: d
859 real(dp),
dimension(npts) :: stations
860 real(dp),
dimension(npts - 1) :: areas
861 real(dp),
dimension(npts - 1) :: perimeters
872 stations(n) = xfraction(n) * width
880 p = p + perimeters(n)
892 r = roughness * roughfracs(n)
893 if (p * r >
dzero)
then
896 q = q + conv_fact * a * rh**
dtwothirds * sqrt(slope) / r
916 integer(I4B),
intent(in) :: npts
917 real(DP),
dimension(npts),
intent(in) :: stations
918 real(DP),
dimension(npts),
intent(in) :: heights
919 real(DP),
intent(in) :: d
920 real(DP),
dimension(npts - 1),
intent(inout) :: p
950 if (xlen >
dzero)
then
958 dlen = min(d, dmax) - dmin
963 p(n) = sqrt(xlen**
dtwo + dlen**
dtwo)
979 integer(I4B),
intent(in) :: npts
980 real(DP),
dimension(npts),
intent(in) :: stations
981 real(DP),
dimension(npts),
intent(in) :: heights
982 real(DP),
intent(in) :: d
983 real(DP),
dimension(npts - 1),
intent(inout) :: a
1002 x1 = stations(n + 1)
1011 if (xlen >
dzero)
then
1015 a(n) = xlen * (d - dmax)
1019 if (dmax /= dmin .and. d > dmin)
then
1021 a(n) = a(n) +
dhalf * (d - dmin) * xlen
1023 a(n) = a(n) +
dhalf * (dmax - dmin) * xlen
1042 integer(I4B),
intent(in) :: npts
1043 real(DP),
dimension(npts),
intent(in) :: stations
1044 real(DP),
dimension(npts),
intent(in) :: heights
1045 real(DP),
intent(in) :: d
1046 real(DP),
dimension(npts - 1),
intent(inout) :: w
1061 x1 = stations(n + 1)
1089 real(dp),
intent(inout) :: x0
1090 real(dp),
intent(inout) :: x1
1091 real(dp),
intent(in) :: d0
1092 real(dp),
intent(in) :: d1
1093 real(dp),
intent(inout) :: dmax
1094 real(dp),
intent(inout) :: dmin
1095 real(dp),
intent(in) :: d
1115 else if (d < dmax)
then
1118 if (abs(dlen) >
dzero)
then
1124 dx = (d - d1) * slope
1129 dx = (d - d0) * slope
This module contains simulation constants.
real(dp), parameter dtwothirds
real constant 2/3
real(dp), parameter dp999
real constant 999/1000
real(dp), parameter dhalf
real constant 1/2
real(dp), parameter dzero
real constant zero
real(dp), parameter dem5
real constant 1e-5
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 schsmooth(d, smooth, dwdh)
@ brief sChSmooth
This module contains stateless sfr subroutines and functions.
real(dp) function, public calc_qman(depth, width, rough, slope, cxs_xf, cxs_h, cxs_rf, unitconv, icalcmeth)
Calculate streamflow using Manning's equation.
real(dp) function, public get_composite_conveyance(npts, xfraction, heights, cxs_rf, width, rough, d)
Calculate composite conveyance.
real(dp) function, public get_mannings_section(npts, xfraction, heights, roughfracs, roughness, conv_fact, width, slope, d)
Calculate the manning's discharge for a reach.
real(dp) function, public get_hydraulic_radius_xf(npts, xfraction, heights, width, d)
Calculate the hydraulic radius for a reach.
subroutine get_cross_section_areas(npts, stations, heights, d, a)
Calculate the cross-sectional areas for each line segment.
logical(lgp) function has_uniform_resistance(cxs_rf)
Determine if roughness is uniform for the section.
logical(lgp) function is_rectangular(xfraction)
Determine if cross section is rectangular.
real(dp) function, public calc_composite_roughness(npts, depth, width, rough, slope, cxs_xf, cxs_h, cxs_rf, linmeth)
real(dp) function, public calc_depth_from_q(qrch, width, rough, slope, cxs_xf, cxs_h, cxs_rf, unitconv, icalcmeth)
Calculate the depth at the midpoint of a irregular cross-section.
pure subroutine get_wetted_station(x0, x1, d0, d1, dmax, dmin, d)
Calculate the station values for the wetted portion of the cross-section.
real(dp) function, public get_hydraulic_radius(npts, stations, heights, d)
Calculate the hydraulic radius for a reach.
real(dp) function calc_qman_by_section(depth, width, rough, slope, cxs_xf, cxs_h, cxs_rf, unitconv)
subroutine get_wetted_topwidths(npts, stations, heights, d, w)
Calculate the wetted top widths for each line segment.
real(dp) function, public get_cross_section_area(npts, xfraction, heights, width, d)
Calculate the cross-sectional area for a reach.
real(dp) function, public get_wetted_topwidth(npts, xfraction, heights, width, d)
Calculate the wetted top width for a reach.
real(dp) function calc_qman_composite(depth, width, rough, slope, cxs_xf, cxs_h, cxs_rf, unitconv, linmeth)
real(dp) function calc_depth_from_q_nr(qrch, width, rough, slope, cxs_xf, cxs_h, cxs_rf, unitconv, icalcmeth)
Calculate the depth at the midpoint of a irregular cross-section.
real(dp) function, public get_conveyance(npts, xfraction, heights, cxs_rf, width, rough, d)
Calculate conveyance.
subroutine get_wetted_perimeters(npts, stations, heights, d, p)
Calculate the wetted perimeters for each line segment.
real(dp) function, public get_wetted_perimeter(npts, xfraction, heights, width, d)
Calculate the wetted perimeter for a reach.
real(dp) function get_rectangular_conveyance(npts, xfraction, heights, cxs_rf, width, rough, d)
Calculate conveyance for rectangular channel.
real(dp) function, public get_saturated_topwidth(npts, stations)
Calculate the saturated top width for a reach.
real(dp) function calc_depth_from_q_bisect(qrch, width, rough, slope, cxs_xf, cxs_h, cxs_rf, unitconv, icalcmeth)
Calculate the depth at the midpoint of a irregular cross-section.