Beruflich Dokumente
Kultur Dokumente
Flow in pipes
The Darcy-Weisbach equation describes the flow in a pipeline:
L V2
hf = f .
D 2g
In this equation hf = head loss, f = friction factor, L = pipe length, D = pipe diameter, V=
water velocity, g = acceleration of gravity ( = 9.806 m/s2= 32.2 ft/s2). In terms of the
discharge, Q, since V = 4Q/(D2), the Darcy-Weisbach equation becomes:
8 f L Q2
hf = 2 .
g D2
The friction factor f is a function of the relative roughness of the pipe, e/D, where e =
absolute roughness, and of the Reynolds number, Re = VD/, where = kinematic
viscosity of the fluid. The Swamee-Jain equation provides an expression for the friction
factor, namely,
1.3254
f = 2
.
e 5.74
ln 3.75 D + Re 0.9
1.3254
f = 2
e D
0.9
ln + 4.618
3.75 D Q
1
With this expression for the friction factor, the Darcy-Weisbach equation now is written
as
1.074 L Q 2
hf = 2
.
e 0.9
D
g D 5 ln + 4.618
3.75 D Q
1.074 L Q 2
f ( ) = 2
h f ,.
e D
0.9
g D ln
5 + 4.618
3.75 D Q
2
elseif gindex == 'ES'
g = 32.2;
else
error('DWSJ - wrong index for unit system');
break;
end;
if index == 'L'
DWSJEq = inline(formEquation(index,g,L,D,e,nu,hf,Q),'LL');
result = fzero(DWSJEq,L);
elseif index == 'D'
DWSJEq = inline(formEquation(index,g,L,D,e,nu,hf,Q),'DD');
result = fzero(DWSJEq,D);
elseif index == 'e'
DWSJEq = inline(formEquation(index,g,L,D,e,nu,hf,Q),'ee');
result = fzero(DWSJEq,e);
elseif index == 'nu'
DWSJEq = inline(formEquation(index,g,L,D,e,nu,hf,Q),'nnu');
result = fzero(DWSJEq,nu);
elseif index == 'hf'
DWSJEq = inline(formEquation(index,g,L,D,e,nu,hf,Q),'hhf');
result = fzero(DWSJEq,hf);
elseif index == 'Q'
DWSJEq = inline(formEquation(index,g,L,D,e,nu,hf,Q),'QQ');
result = fzero(DWSJEq,Q);
else
error('DWSJ - index must be either L, D, e, nu, hf, or Q enclosed in
quotes');
break;
end;
This function calls function formEquation to produce the expression for the required
equation to solve:
switch index
case 'L'
s = strrep(s,'L','LL');
s = strrep(s,'Q',num2str(Q));
s = strrep(s,'D',num2str(D));
s = strrep(s,'e',num2str(e));
s = strrep(s,'nu',num2str(nu));
s = strrep(s,'hf',num2str(hf));
case 'D'
s = strrep(s,'L',num2str(L));
s = strrep(s,'Q',num2str(Q));
s = strrep(s,'D','DD');
s = strrep(s,'e',num2str(e));
s = strrep(s,'nu',num2str(nu));
s = strrep(s,'hf',num2str(hf));
3
case 'e'
s = strrep(s,'L',num2str(L));
s = strrep(s,'Q',num2str(Q));
s = strrep(s,'D',num2str(D));
s = strrep(s,'e','ee');
s = strrep(s,'nu',num2str(nu));
s = strrep(s,'hf',num2str(hf));
case 'nu'
s = strrep(s,'L',num2str(L));
s = strrep(s,'Q',num2str(Q));
s = strrep(s,'D',num2str(D));
s = strrep(s,'e',num2str(e));
s = strrep(s,'nu','nnu');
s = strrep(s,'hf',num2str(hf));
case 'hf'
s = strrep(s,'L',num2str(L));
s = strrep(s,'Q',num2str(Q));
s = strrep(s,'D',num2str(D));
s = strrep(s,'e',num2str(e));
s = strrep(s,'nu',num2str(nu));
s = strrep(s,'hf','hhf');
case 'Q'
s = strrep(s,'L',num2str(L));
s = strrep(s,'Q','QQ');
s = strrep(s,'D',num2str(D));
s = strrep(s,'e',num2str(e));
s = strrep(s,'nu',num2str(nu));
s = strrep(s,'hf',num2str(hf));
end
s = strrep(s,'r','log');
Some solutions obtained by using the SI system of units are shown next:
DWSJ('L','SI',100,0.1,0.00001,1e-6,1,0.02)
Zero found in the interval: [9.4903, 164].
ans = 19.1617
EDU DWSJ('D','SI',100,0.1,0.00001,1e-6,1,0.02)
Zero found in the interval: [0.054745, 0.14525].
ans = 0.1402
EDU DWSJ('hf','SI',100,0.1,0.0000001,1e-6,1,0.02)
Zero found in the interval: [-4.12, 6.12].
ans = 4.9036
EDU DWSJ('Q','SI',100,0.1,0.0000001,1e-6,1,0.02)
Zero found in the interval: [0.0072, 0.029051].
ans = 0.0083
Please notice that the solution for the absolute roughness, e, and the kinematic viscosity,
nu, is very sensitive to the initial value given. This solution may quickly produce a
negative estimate, which in turn produces a complex number estimated, and which will
stop the search for a solution. See the following examples:
DWSJ('e','SI',20,0.1,0.00001,1e-6,1,0.02)
Zero found in the interval: [9.4903e-007, 1.64e-005].
4
ans =
2.9233e-006
EDU DWSJ('e','SI',25,0.1,0.00001,1e-6,1,0.02)
Zero found in the interval: [-2.6204e-005, 3.56e-005].
ans =
-1.8657e-005
EDU DWSJ('nu','SI',25,0.1,0.00001,1e-6,1,0.02)
Exiting fzero: aborting search for an interval containing a sign change
because complex function value encountered during search
(Function value at -2.8e-007 is -0.2253+0.16041i)
Check function or try again with a different starting value.
ans =
NaN
EDU DWSJ('nu','SI',20,0.1,0.00001,1e-6,1,0.02)
Zero found in the interval: [6.8e-007, 1.2263e-006].
ans =
7.3594e-007
Uniform open channel flow is commonly described by using the Mannings equation,
namely,
C
Q = u A R 2 / 3 S 01 / 2 ,
n
Cu A5 / 3 1 / 2
Q= S0 .
n P2/3
For the purpose of solving this equation through numerical methods, it is more
convenient to write it as:
n Q P 2 / 3 C u A 5 / 3 S 01 / 2 = 0 .
5
Expressions for the area, A, and the wetted perimeter, P, are given in terms of the
geometric properties of the cross-section. For example, for a trapezoidal channel of base
width (m or ft), b, depth of flow (m or ft), y, and side slope (dimensionless), z, as shown
in the figure below, the expressions for A and P are:
A = (b + z y ) y, P = b + 2 y 1 + z 2 .
T rapezoidal cross-section
z
1 Y
f ( ) = n Q (b + 2 y 1 + z 2 ) 2 / 3 C u ((b + z y ) y ) 5 / 3 S 01 / 2 = 0 ,
Exercise
units Q b y z So n
SI ? 0.65 0.250 1.0 0.00001 0.010
SI 0.20 ? 0.100 0.0 0.0001 0.012
SI 0.25 0.00 ? 1.5 0.001 0.015
SI 0.30 0.00 0.250 ? 0.00005 0.020
SI 0.35 0.00 0.250 1.0 ? 0.008
SI 0.50 0.00 0.100 0.0 0.0001 ?
ES ? 2.00 0.50 1.0 0.00001 0.010
ES 25 ? 0.75 0.0 0.0001 0.012
ES 50 2.50 ? 1.5 0.001 0.015
ES 75 1.50 1.00 ? 0.00005 0.020
ES 100 3.50 1.20 1.0 ? 0.008
ES 75 5.00 1.10 0.0 0.0001 ?
6
Solving a pipe-pump system
The figure below shows two reservoirs connected by a pipe of length L, diameter D, and
absolute roughness e. Water, of kinematic viscosity and specific weight , is pumped
from reservoir (1) to reservoir (2), by a pump P that provides a hydraulic head H for a
discharge Q through the pipe. The elevation of the free surface in reservoir (2) above of
that of reservoir (1) is H. Besides friction losses in the pipe, the analysis should include
minor losses at the intake, coefficient = K1, and outlet, coefficient = K2.
Applying the energy equation between free-surface points (1) and (2), namely,
p1 V12 p 2 V22
z1 + + + H = z2 + + + h f + hL ,
2g 2g
V2 e V D
H = H + f , + K L .
2g D
For the friction coefficient f, we will choose the Swamee-Jain equation presented earlier.
The centrifugal pump has its own quadratic equation (the pump equation) that relates the
pump head, H, to the pipe discharge, Q, namely:
H = a + b Q + c Q2 . (B)
7
The solution to this problem requires to solve equations (A) and (B) simultaneously for Q
and H. This can be accomplished by using function secantm (a secant method for
multiple non-linear equations), which is listed next:
if abs(dx)<epsilon
error('dx = 0, use different values');
break;
end;
[n m] = size(x0);
while (N>0)
JJ = [1,2;2,3]; xx = zeros(n,1);
for j = 1:n % Estimating
xx = xn; % Jacobian by
xx(j) = xn(j) + dx; % finite
fxx = feval(f,xx);
fxn = feval(f,xn);
JJ(:,j) = (fxx-fxn)/dx; % differences
end; % by columns
if abs(det(JJ))<epsilon
error('newtonm - Jacobian is singular - try new x0,dx');
break;
end;
xnp1 = xn - inv(JJ)*fxn;
fnp1 = feval(f,xnp1);
if abs(fnp1)<epsilon
x=xnp1;
disp(['iterations: ', num2str(100-N)]);
return;
end;
if abs(fnp1)>maxval
disp(['iterations: ', num2str(100-N)]);
error('Solution diverges');
break;
end;
N = N - 1;
xn = xnp1;
end;
error('No convergence');
break;
% end function
8
This function requires an m-file function f which takes as argument a column vector of n
elements and returns a column vector function of n elements representing the system of
linear equations:
f1(x1,x2,,xn) = 0
f2(x1,x2,,xn) = 0
fn(x1,x2,,xn) = 0
f 1 ( x)
f ( x)
f ( x) = 2 .
M
f n ( x)
For the solution of the pipe-pump system, we let x1 = Q and x2 = H, and the components
of the vector function are:
8 x12 e 4x
f1 ( x1 , x 2 ) = H + f , 1 + K L x 2 ,
2 gD 4 D D
f1 ( x1 , x 2 ) = a + b x1 + c x12 x 2 .
9
plot(QQ,HA,'r',QQ,HB,'b');xlabel('Q');ylabel('H');
legend('system','pump'); grid on;
pause
The several lines that start with s1 and s2 are used to generate the expressions for f1(x1,x2)
and f2(x1,x2) for the specific known parameters listed in the script. The statements
involving fopen, fprintf, and fclose actually create an m-file, named fPP.m, that represents
the vector function f(x) = [f1(x1,x2); f2(x1,x2)]. Thus, the script PipePump_Script.m
actually creates the function to be solved. The solution is accomplished by the call to
function secantm.
The script also includes the production of a plot of the pump head, H, vs. discharge, Q,
for equations (A) and (B). The plot shows two curves, one corresponding to the system
equation and one to the pump equation. The point of intersection of the two curves
represents the solution to the problem. This point is referred to as the operating point of
the pump-pipe system.
10
Entrance from a reservoir into a long channel
The conditions of open channel flow at the entrance from a reservoir are determined by
the simultaneous solution of the energy equation and Mannings equation. The energy
equation, for an available head of Ho at the reservoir, is written as
Q2
H0 = y + , (C)
2 g[ A( y )]2
C u [ A( y )]5 / 3
Q= S0 , (D)
n [ P( y )]2 / 3
where Cu is a coefficient that depends on the system of units used, with Cu = 1.0 for the
Systeme Internationale (S.I.) and Cu = 1.486 for the English (or Imperial) System of units
(E.S.), n is the Mannings coefficient (typically, between 0.001 and 0.3), A(y) is the
cross-sectional area, P(y) is the wetted perimeter of the cross-section (i.e., the length of
the cross-sectional boundary in contact with the water), and Q is the discharge. For a
trapezoidal cross-section of bottom width b and side slope z, the area and wetted
perimeter are given by
A( y ) = (b + zy ) y, P( y ) = b + 2 y 1 + z 2 . (E)
Typically the values of n, g, Cu, S0, and the geometry of the cross-section (b,z) are known.
The simultaneous solution of these two equations produces as a result the values of the
water depth, y, and the flow discharge, Q.
A graphical solution may be obtained by plotting the two curves of y vs. Q corresponding
to equations (C) and (D), respectively, after replacing the cross-sectional equations (E).
The figure below shows the energy equation (C) and the Manning equation (D) curves,
for cases in which the flow develops into a subcritical or a supercritical flow.
11
Notice that the energy equation curve shows a maximum value of Q = Qmax at the critical
flow depth, y = yc, for the available energy head Ho. For a subcritical or critical flows,
the operating point is the intersection of the energy equation and Manning equation
curves, which occurs for y yc, as shown in the figure to the left. However, for a
supercritical flow (y < yc), critical conditions occur at the entrance to the channel forcing
the discharge to be Q = Qmax. For supercritical flow, therefore, the flow depth in the
channel is calculated from Mannings equation alone with Q = Qmax.
V 2 T ( y) Q 2 T ( y)
Fr 2 = = ,
g A( y ) g [ A( y )]3
where T(y) is the top width of the cross-section. For a trapezoidal channel, T(y) = b+2zy.
According to the value of the Froude number, the flow is either subcritical (Fr2<1),
critical (Fr2=1), or supercritical (Fr2>1).
The critical conditions can be obtained from the expression for the discharge, namely
Q = A( y ) 2 g ( H o y ) . (F)
For critical flow, dQ/dy = 0. With dA/dy = T(y), the resulting critical conditions equation
is:
A( y ) 2 ( H 0 y ) T ( y ) = 0
(b + zy c ) y c 2 ( H 0 y c ) (b + 2 zy c ) = 0 . (G)
Exercise
[2]. Prepare a Matlab script to perform the following tasks. Use one of the set of values
in the table shown at the end of this document:
1. Plot the energy equation curve and the Mannings equation curve for a trapezoidal
channel entrance from a lake. Use equations (F) and (D).
2. Determine the critical depth for the trapezoidal cross-section for constant Ho using
equation (G). Then, calculate the critical (maximum) discharge, Qmax, with
equation (F).
12
3. Use function secantm.m to obtain the simultaneous solution of the energy and
Mannings equations at the entrance from a reservoir into an open channel. Use
x1 = Q and x2 = y, with x = [x1;x2] , f = [f1(x); f2(x)], and
x12
f1 ( x1 , x 2 ) = x 2 + H0 ,
2 g ((b + zx 2 ) x 2 ) 2
C u ((b + z x 2 ) x 2 ) 5 / 3
f 2 ( x1 , x 2 ) = S 0 x1 .
n (b + 2 x 2 1 + z 2 ) 2 / 3
System
of
Case units Ho b z n So
(a) S.I. 4.5 1.2 1.5 0.012 0.0001
(b) S.I. 3.5 0.8 0.5 0.023 0.00001
(c) S.I. 2.5 0.4 1 0.01 0.001
(d) E.S. 6 5 1 0.012 0.0001
(e) E.S. 3 3 0.5 0.018 0.00001
(f) E.S. 10 7.5 0.75 0.015 0.0001
13