Вы находитесь на странице: 1из 11

Hydraulics

Tutorials
Computer Programming to solve some problems
- Dr. K.N. Dulal

Program for normal depth computation


Manning’s equation:

1. Computation of normal depth of a rectangular channel


b= width of channel, y = normal depth, S= bed slope, Q = Discharge, n = Manning’s roughness,
A=by
P = b+2y
R=A/P


Trial and error procedure

Algorithm
1. Read b, n, Q, S
2.

3. Initialize y
4. A=by
5. P = b+2y
6. R=A/P
7.
8. If Abs(LHS-RHS)<0.00001, Go to step11
9. y = y+0.0001
10. Go to step 4
11. Write y
12. End

Coding (Fortran)
Read (*, 5) b, n, Q, S
5 Format (1X, F10.4, 1X, F10.4, 1X, F10.5, 1X, F10.5)
RHS = (n*Q)/S**0.5
y = 0.001
10 A = b*y
P =b+2*y
R =A/P
LHS = A*R**(2/3)
If (Abs(LHS-RHS).LE.0.00001) Go to 20
y = y+0.0001
Go to 10
20 Write (*, 25) ‘Normal depth=’, y
25 Format (1X, A, 1X, F10.5)
Stop
End

2. Computation of normal depth of a trapezoidal channel


b= bottom width of channel, Z:1 = side slope, S= bed slope, Q = Discharge, n = Manning’s roughness, y =
normal depth
A=(b+zy)y

R=A/P


Trial and error procedure

Algorithm
1. Read b, n, Q, S, Z
2.

3. Initialize y
4. A=(b+zy)y
5. √
6. R=A/P
7.
8. If Abs(LHS-RHS)<0.00001, Go to step11
9. y = y+0.0001
10. Go to step 4
11. Write y
12. End

Coding (Fortran)
Read (*, 5) b, n, Q, S, Z
5 Format (1X, F10.4, 1X, F10.4, 1X, F10.5, 1X, F10.5, 1X, F10.3)
RHS = (n*Q)/S**0.5
y = 0.001
10 A =(b+z*y)*y
P =b+2*y*(1+z**2)**0.5
R =A/P
LHS = A*R**(2/3)
If (Abs(LHS-RHS).LE.0.00001) Go to 20
y = y+0.0001
Go to 10
20 Write (*, 25) ‘Normal depth=’, y
25 Format (1X, A, 1X, F10.5)
Stop
End

3. Computation of normal depth of a circular channel


D = Diameter of circle, S= bed slope, Q = Discharge, n = Manning’s roughness, φ= Angle subtended at
center, y = normal depth
( )

R=A/P


Find φ by trial and error procedure

Algorithm
1. Read D, n, Q, S
2.

3. Initialize φ
4. ( )
5.
6. R=A/P
7.
8. If Abs(LHS-RHS)<0.00001, Go to step11
9. φ = φ +0.0001
10. Go to step 4
11. If φ>180, ( )
12. If φ<180, ( )
13 Write y
12. End

Coding (Fortran)
Read (*, 5) D, n, Q, S
5 Format (1X, F10.4, 1X, F10.4, 1X, F10.5, 1X, F10.5)
RHS = (n*Q)/S**0.5
phi = 0.01
10 A =(D**2)*(phi-sin(phi))/8
P = phi*D/2
R =A/P
LHS = A*R**(2/3)
If (Abs(LHS-RHS).LE.0.00001) Go to 20
Phi = Phi+0.0001
Go to 10
20 If (phi.LT.3.14), y = (D/2)*(1+Cos((2*3.14-phi)/2))
y = (D/2)*(1-Cos(phi/2))
Write (*, 25) ‘ Normal depth =’ y
25 Format (1X, A, 1X, F10.5)
Stop
End

Program for critical depth computation


For critical depth

Critical depth of rectangular channel

Critical depth of rectangular channel is computed directly by using equation ( )


Algorithm
1. Read b, Q
2. g = 9.81

3. ( )
4. Write yc

Coding (Fortran)
Read (*, 5) b, Q
5 Format (1X, F10.4, 1X, F10.5)
g = 9.81
yc = (Q**2/(b**2*g))**(1/3)
Write (*, 10) ‘Critical depth=’, yc
10 Format (1X, A, 1X, F10.5)
Stop
End
Critical depth of triangular channel is computed directly by using equation ( )

2. Critical depth of trapezoidal channel


b= bottom width of channel, Z:1 = side slope, Q = Discharge, yc = critical depth
A= (b+zyc)yc
T = b+2zyc

[( ) ]
( )
Find yc by trial and error approach.

Algorithm
1. Read b, z, Q
2. g = 9.81
3.
4. Initialize yc. (Take initial value = yc of rectangular channel)
5 .A= (b+zyc)yc
6. T = b+2zyc
7.
8. If Abs(LHS-RHS)<0.00001, Go to step11
9. yc = yc-0.0001
10. Go to step 4
11. Write yc
12. End

Coding (Fortran)
Read (*, 5) b, z, Q
5 Format (1X, F10.4, 1X, F10.3, 1X, F10.5)
g = 9.81
LHS = (Q**2)/g
yc = (Q**2/(b**2*g))**(1/3)
10 A =(b+z*yc)*yc
T = b+2*z*yc
RHS = (A**3)/T
If (Abs(LHS-RHS).LE.0.00001) Go to 20
yc = yc-0.0001
Go to 10
20 Write (*, 25) ‘Critical depth=’, yc
25 Format (1X, A, 1X, F10.5)
Stop
End

Program for alternate depth computation

1. Alternate depth of rectangular channel


First determine critical depth yc.

( )
For alternate depth

( )
( ) ( )

√ ( )

Algorithm
1. Read b, Q, E
2. g = 9.81

3. ( )
Computation of supercritical depth (y1) (y1< yc)
4. y1=yc
5. yca = y1 -0.001
6.
√ ( )
7. If(abs(yca-y1)<0.001 go to 9
8. Go to 5
9. Write y1
Computation of subcritical depth (y2) (y2> yc)
10. y2=yc
11. yca = y2 +0.001
12.
√ ( )
13. If(abs(yca-y2)<0.001 go to 15
14. Go to 11
15. Write y2
16. End
Coding (Fortran)
Read (*, *) b, Q, E
g = 9.81
yc = (Q**2/(b**2*g))**(1/3)
C Supercritical depth
y1=yc
10 yca = y1 -0.001
y1=Q/(b*sqrt(2*g*(E-yca))
If(abs(yca-y1).le.0.001) Go to 20
Go to 10
20 Write (*, 25) ‘Supercritical depth=’, y1
25 Format (1X, A30, 1X, F10.5)
C Subcritical depth
y2=yc
30 yca = y2 +0.001
y2=Q/(b*sqrt(2*g*(E-yca))
If(abs(yca-y2).le.0.001) Go to 40
Go to 30
40 Write (*, 45) ‘Subcritical depth=’, y2
45 Format (1X, A, 1X, F10.5)
Stop
End

2. Alternate depth computation for trapezoidal channel


(Same procedure as rectangular channel)

First determine critical depth yc (by trial and error approach as explained before)

For alternate depth

[( ) ]
( ) [( ) ]

( )√ ( )

Algorithm
1. Read b, Q, Z, E
2. g = 9.81
3. Find yc
Computation of supercritical depth (y1) (y1< yc)
4. y1=yc
5. yca = y1 -0.001
5.
( )√ ( )
5. If(abs(yca-y1)<0.001 go to
6. Go to 5
7. Write y1
Computation of subcritical depth (y2) (y2> yc)
8. y2=yc
9. yca = y2 +0.001
10.
( )√ ( )
11. If(abs(yca-y2)<0.001 go to 13
12. Go to 9
13. Write y2
14. End

Coding (Fortran)
Read (*, 5) b, z, Q, E
5 Format (1X, F10.4, 1X, F10.3, 1X, F10.5, 1X, F10.5)
g = 9.81
c Critical depth computation
LHS = (Q**2)/g
yc = (Q**2/(b**2*g))**(1/3)
10 A =(b+z*yc)*yc
T = b+2*z*yc
RHS = (A**3)/T
If (Abs(LHS-RHS).LE.0.00001) Go to 20
yc = yc-0.0001
Go to 10
20 Write (*, 25) ‘Critical depth=’, yc
25 Format (1X, A, 1X, F10.5)
C Supercritical depth
y1=yc
30 yca = y1 -0.001
y1=Q/((b+z*y)*sqrt(2*g*(E-yca))
If(abs(yca-y1).le.0.001) Go to 40
Go to 30
40 Write (*, 45) ‘Supercritical depth=’, y1
45 Format (1X, A, 1X, F10.5)
C Subcritical depth
y2=yc
50 yca = y2 +0.001
y2=Q/((b+z*y)*sqrt(2*g*(E-yca))
If(abs(yca-y2).le.0.001) Go to 60
Go to 50
60 Write (*, 65) ‘Subcritical depth=’, y2
65 Format (1X, A, 1X, F10.5)
Stop
End

Flow profile computation for rectangular channel using direct step method
R=A/P, V= Q/A, E = y +V2/2g,
̅ [( ) ( ) ]

̅̅̅̅
, x = cumulative sum of

Algorithm
1. Read b, y1(starting depth), y2(final depth), Q, n, S0
2. g = 9.81
3. x = 0.0
4. y = y1
5. dy = 0.02
6. If y1>y2, dy=-dy
7. i = 1
8. y11 = y
9. A1 = by11
10. P1 = b+2y11
11. R1 = A1/P1
12. V1 = Q/A1
13. E1 = y11+ V12/2g
14. SF1 = n2V12/R14/3
15. y22= y11+dy
16. A2 = by22
17. P2 = b+2y22
18. R2 = A2/P2
19. V2 = Q/A2
20. E2 = y22+ V22/2g
21. SF2 = n2V22/R24/3
22. SF = (SF1+SF2)/2
23. DS = S0-SF
24. DE = E2-E1
25. dx = DE/DS
26. x = x+dx
27. i = i+1
28. y = y22
30. If y = y2, go to 32
31. Go to 8
22. Write x
32. End

Coding (Fortran)
Read (*, 5) b, y1, y2, Q, n, S0
5 Format (1X, F10.4, 1X, F10.3, 1X, F10.5, 1X, F10.5, 1X, F10.5, 1X, F10.5)
g = 9.81
x = 0.0
y = y1
dy = 0.02
If (y1.gt.y2) dy=-dy
i=1
20 y11 = y
A1 = b*y11
P1 = b+2*y11
R1 = A1/P1
V1 = Q/A1
E1 = y11+ V1**2/(2*g)
SF1 = (n**2*V1**2)/(R1**(4/3))
y22= y11+dy
A2 = b*y22
P2 = b+2*y22
R2 = A2/P2
V2 = Q/A2
E2 = y22+ V2**2/(2*g)
SF2 = (n**2*V2**2)/(R1**(4/3))
SF = (SF1+SF2)/2
DS = S0-SF
DE = E2-E1
dx = DE/DS
x = x+dx
i = i+1
y = y22
If (y .eq. y2) go to 30
Go to 20
30 Write(*, 35) ‘distance between two sections=’ x
35 Format (1X, A, 1X, F10.3)
End
Newton-Raphson method to solve Colebrook-White equation

f(x)

curve

f(xi)

x
xi xi+1

Newton-Raphson formula for iteration


( ) ( )
( ) ( )

Using this equation for solving f using Colebrook-White equation


( )
√ √

( )
√ √

( ) ( )
√ √
( )
( )
( )

For the first iteration, a value of f(i) is assumed


( )
( )

Computer algorithm to compute f


1. Specify dimension (array size) for f.
Read input data: K, D (or K/D), Re (or Q or V), and L
If V or Q is given, compute Re from
2. If Re<2000, compute f from f=64/Re (laminar), else
3. Define ( ) ( )
√ √

4. Define ( )
( )

5. Give initial value of f. This is f(0).


6. i=0
( ( ))
7. Compute ( ) () ( ( ))
8. If (abs(f(i+1)-f(i))<epsilon, e.g. 0.0001 then
9. friction factor = f(i), else
10. i=i+1. Go to 7.

Вам также может понравиться