summaryrefslogtreecommitdiff
path: root/3785/CH9/EX9.3/Ex9_3.sce
blob: d39b27e2717d5ea5f925620ca30b89d30f1e228f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Example 9_3
clc;funcprot(0);
// Given data
dp=100;// The pressure drop in psi
rho=1*10^3;// The density of water in kg/m^3
g=9.807;// The acceleration due to gravity in m/s^2
Q=2000;// The flow rate of water in gal/min
D=4;// The next pipe size in inch
L=100;// Length in m
nu=1*10^-6;// m^2/s

// Calculation
deltah=(dp*6.895*10^3)/(rho*g);// m
printf("\nh_in-h_out=%2.2f m",deltah);
D=D*2.54*10^-2;// m
Q=Q*(3.782*10^-3)/60;// m^3/s
V=(4*Q)/(%pi*D^2);// m/s
Re_D=(V*D)/nu;// Reynolds number
epsilon=5*10^-5;// physical height
function[X]=frictionfactor(y)
    X(1)=-(2.0*log10(((epsilon/D)/3.7)+(2.51/(Re_D*sqrt(y(1))))))-(1/sqrt(y(1)));
endfunction
// Guessing a value of f=1*10^-2;
y=[1*10^-2];
f=fsolve(y,frictionfactor);
K_f=f*((L)/D);// The head loss coefficient
deltah_f=K_f*((V^2)/(2*g));// The head loss in m
printf("\nD=%0.4f m \nQ=%1.3e m^3/s \nV=%2.2f m/s \nRe_D=%1.3e \nf=%1.3e \nK_f=%2.2f \nh_in-h_out=%3.1f m",D,Q,V,Re_D,f,K_f,deltah_f)
printf("\nThe head loss of 205.9 m is greater than the allowable los s of 70.31 m.");

// If we try the next size pipe, D = 6 in,
D=6;// inch
D=D*2.54*10^-2;// m
Q=2000;// The flow rate of water in gal/min
Q=Q*(3.782*10^-3)/60;// m^3/s
V=(4*Q)/(%pi*D^2);// m/s
Re_D=(V*D)/nu;// Reynolds number
epsilon=5*10^-5;// physical height
function[X]=frictionfactor(y)
    X(1)=-(2.0*log10(((epsilon/D)/3.7)+(2.51/(Re_D*sqrt(y(1))))))-(1/sqrt(y(1)));
endfunction
// Guessing a value of f=1*10^-2;
y=[1*10^-2];
f=fsolve(y,frictionfactor);
K_f=f*((L)/D);// The head loss coefficient
deltah_f=K_f*((V^2)/(2*g));// The head loss in m
printf("\nD=%0.4f m \nQ=%1.3e m^3/s \nV=%1.3f m/s \nRe_D=%1.3e \nf=%1.3e \nK_f=%2.2f \nh_in-h_out=%2.2f m",D,Q,V,Re_D,f,K_f,deltah_f)
printf("\nThis is smaller than the allowable head loss so that a 6 in diameter pipe is acceptable.")