Problem 5.12.
Water is flowing in a trapezoidal channel at a rate of Q = 20 m3/s. The critical depth y for such a channel must satisfy the equation
Eq 5.12.(a)
where g = 9.81 m/s2, Ac = the cross sectional area (m2), and B = the width of the channel at the surface (m). For this case, the width and the cross sectional area can be related to the depth y by B = 3 + y and Ac = 3y + y2/2. Solve for the critical depth using the (a) graphical method (b) bisection, and (c) false position. For (b) and (c) use the initial guesses of xl = 0.5 and xu = 2.5, and iterate until the approximate error falls below 1% or the number of iterations exceeds 10. Discuss your result.
Solution:
Firstly, compute a single function that only depends on y using Eq.5.12(a) by substituting the relation for B and Ac.
Therefore, the critical depth y will be the value of y that makes f(y) = 0.
(a) Plot the graph using MATLAB. The commands are shown as follow.
>> y = linspace(0.1,2.5);
>> fy = 1- (400./(9.81*(3*y+y.^2/2).^3)).*(3+y);
>> plot(y,fy),grid,xlabel('y'),ylabel('f(y)')
>> fy = 1- (400./(9.81*(3*y+y.^2/2).^3)).*(3+y);
>> plot(y,fy),grid,xlabel('y'),ylabel('f(y)')
The graph generated is shown as above. The rough estimate of the root is about 1.5 m. The validity of the graphical method can be checked by substituting into the function f(y) to yield
>> fy = 1- (400/(9.81*(3*1.5+1.5^2/2)^3))*(3+1.5)
fy =
-0.0309
which is close to zero.
(b) The root estimate using bisection method is xr = (xl + xu)/2. Begin the iteration with guesses of xl = 0.5 and xu = 2.5.
First iteration:
xl = 0.5 f(0.5) = -32.2582
xu = 2.5 f(2.5) = 0.8130
xr = (0.5+2.5)/2 = 1.5 f(1.5) = -0.0309
f(0.5)f(1.5) = 0.9983 > 0. Therefore, the root lies in the upper interval, and xr becomes the lower limit for the next iteration, xl = 1.5.
Second iteration:
xl = 1.5 f(1.5) = -0.0309
xu = 2.5 f(2.5) = 0.8130
xr = (1.5+2.5)/2 = 2 f(2) = 0.6018
f(1.5)f(2.5) = -0.0186 < 0. Therefore, the root lies in the lower interval, and xr becomes the upper limit for the next iteration, xu = 2.
The approximate relative error is 25%.
The remainder of the iterations are displayed in the following table.
Hence, after 8 iterations, the approximate relative error falls below 1% and the computation can be terminated. The critical depth is estimated as 1.50781 m.
(c) The root estimate using false position method is xr = xu - f(xu)(xl - xu)/(f(xl) - f(xu)). Begin the iteration with guesses of xl = 0.5 and xu = 2.5.
First iteration:
xl = 0.5 f(0.5) = -32.2582
xu = 2.5 f(2.5) = 0.8130
xr = 2.45083 f(2.45083) = 0.7999
f(0.5)f(2.45803) = -25.8025 < 0. Therefore, the root lies in the lower interval, and xr becomes the upper limit for the next iteration, xu = 2.45083.
Second iteration:
xl = 0.5 f(0.5) = -32.2582
xu = 2.45803 f(2.45803) = 0.7999
xr = 2.40363 f(2.40363) = 0.7861
f(0.5)f(2.40363) = -25.3589 < 0. Therefore, the root lies in the lower interval, and xr becomes the upper limit for the next iteration, xu = 2.40363.
The approximate relative error is 1.96%.
The remainder of the iterations are displayed in the following table.
Hence, the computation is terminated after 10 iterations. The critical depth is estimated as 2.0908 m with an approximate relative error of 1.59%.
Discussion:
As we can observe, using bisection, the approximate error is reduced to less than 1% after 8 iterations. For false position, the approximate error is still above 1% after 10 iterations. This shows that in this case, bisection is more preferable compared to false position. Insight into these results can be gained by examining the plot of the function. As shown in part(a), the curve violates the premise on which false position was based - that is, if f(xu) is much closer to zero than f(xl), then the root should be much closer to xu than to xl . Because of the shape of the present function, the opposite is true.
Tips: When the function has significant curvature, false position is not preferable to solve the problem because of its one-sidedness, which leads to poor convergence.
No comments:
Post a Comment