In [1]:

```
# Aim:To Find Reynolds number of oil
# Given:
# Kinematic viscosity of oil:
nu=100.0; #cS
# velocity of oil:
v=10.0; #ft/s
# Pipe diameter:
D=1.0; #in
# Solution:
# Reynolds Number,
N_R=(7740*v*D)/nu;
# Results:
print"\n Results: "
print"\n The Reynolds number of given oil is .",N_R
```

In [2]:

```
# Aim:To Find Reynolds number of oil
# Given:
# Kinematic viscosity of oil:
nu=0.001; #m^2/s
# velocity of oil:
v=5.0; #m/s
# Pipe diameter:
D=50.0; #mm
# Solution:
# Reynolds Number,
N_R=(v*(D/1000))/nu;
# Results:
print"\n Results: "
print"\n The Reynolds number of given oil is .",N_R
```

In [3]:

```
# Aim:Refer Example 4-3 for Problem Description
# Given:
# Kinematic viscosity of oil:
nu=100.0; #cS
# velocity of oil:
v=10.0; #ft/s
# Pipe diameter:
D=1.0; #in
# Length of pipe:
L=100.0; #ft
# specific gravity of oil:
SG_oil=0.9;
# Solution:
# acceleration due to gravity,
g=32.2; #ft/s**2
# Reynolds Number,
N_R=(7740*v*D)/nu;
# Head loss in pipe,
H_L=round((64*L*(v**2))/(N_R*(D/12)*2*g)); #ft ,Hagen-Poiseuille Equation
# Head loss in terms of psi,
H_L=SG_oil*0.0361*12*H_L; #psi
# Results:
print "\n Results: "
print "\n The Head Loss due to friction in pipe is psi.",round(H_L)
```

In [4]:

```
# Aim:Refer Example 4-4 for Problem Description
# Given:
# Kinematic viscosity of oil:
nu=0.001; #m**2/s
# velocity of oil:
v=5.0; #m/s
# Pipe diameter:
D=50.0; #mm
# Length of pipe:
L=50.0; #m
# specific weigth of oil:
gamma1=8800.0; #N/m**2
import math
from math import floor
# Solution:
# acceleration due to gravity,
g=9.80; #m/s**2
# Reynolds Number,
N_R=(v*(D/1000))/nu;
# Head loss in pipe,
H_L=floor((64*L*(v**2))/(N_R*(D/1000)*2*g)); #m ,Hagen-Poiseuille Equation
# Head loss in terms of kPa,
H_L1=(gamma1*H_L)/1000; #kPa
delp=H_L*gamma1/100000;
# Results:
print "\n Results: "
print "\n The Head Loss due to friction in pipe is m of oil.",H_L
print"\n The pressure drop Kpa",round(delp,1)
```

In [5]:

```
# Aim:Refer Example 4-5 for Problem Description
# Given:
# Kinematic viscosity of oil:
nu=50.0; #cS
# Pipe diameter:
D=1.0; #in
# velocity of oil:
v1=10.0; #ft/s
v2=40.0; #ft/s
# Solution:
# Reynolds Number in 1st case,
N_R1=(7740*v1*D)/nu;
# Using Moody diagram from fig 4-9,
f1=0.042 ;
# Reynolds Number in 2nd case,
N_R2=(7740*v2*D)/nu;
# relative roughness,
rr=0.0018/D;
# Using Moody diagram from fig 4-9,
f2=0.036;
# Results:
print"\n Results: "
print"\n The friction factor in 1st case is .",f1
print"\n The friction factor in 2nd case is .",rr
```

In [6]:

```
# Aim:To Find Head Loss across valve
# Given:
# Diameter of globe valve:
D=1.0; #in
# specific gravity of oil:
SG_oil=0.9;
# flow rate:
Q=30.0; #gpm
import math
from math import floor
from math import pi
# Solution:
# fluid velocity,
v=(Q/449)/((pi*((D/12)**2))/4); #ft/s
# rounding off the above answer
v=round(v)+(round(floor((v-round(v))*10))/10); #ft/s
# From table of "K factors of common valves and fittings",
K=10;
# acceleration due to gravity,
g=32.2; #ft/s**2
# Head Loss across globe valve,
H_L=(K*(v**2))/(2*g); #ft
# Pressure drop across Valve,
delp=SG_oil*0.0361*12*H_L; #psi
# Results:
print"\n Results: "
print"\n The head loss across globe valve is ft of oil.",round(H_L,1)
```

In [7]:

```
# Aim:To Find Head Loss across valve
# Given:
# Diameter of gate valve:
D=50.0; #mm
# specific weight of oil:
gamma1=8800.0; #N/m**2
# kinemativ viscosity of oil:
nu=0.001; #m**2/s
# flow rate:
Q=0.02; #m**3/s
import math
from math import pi
# Solution:
# fluid velocity,
v=Q/((pi*((D/1000)**2))/4); #m/s
# rounding off the above answer
v=round(v)+(round(round((v-round(v))*10))/10); #m/s
# From table of "K factors of common valves and fittings",
K=0.19;
# acceleration due to gravity,
g=9.80; #m/s**2
# Head Loss across globe valve,
H_L=(K*(v**2))/(2*g); #m
# Pressure drop across Valve,
delp=(gamma1*H_L)/1000; #kPa
# Results:
print"\n Results: "
print"\n The head loss across globe valve is m of oil.",round(H_L,2)
```

In [8]:

```
# Aim:Refer Example 4-8 for Problem Description
# Given:
# Kinematic viscosity of oil:
nu=100.0; #cS
# Diameter of steel pipe:
D=1.0; #in
# flow rate:
Q=30.0; #gpm
# Diameter of wide open globe valve:
D_l=1.0; #in
import math
from math import pi
from math import floor
# Solution:
# velocity through steel pipes,
v=(Q/449)/((pi*((D/12)**2))/4); #ft/s
# rounding off the above answer
v=round(v)+(round(floor((v-round(v))*10))/10); #ft/s
# Reynolds Number,
N_R=(7740*v*D)/nu;
# friction factor,
f=64/N_R;
# From table of "K factors of common valves and fittings",
K=10;
# Equivalent Length,
Le=(K*(D_l/12))/f; #ft
# Results:
print"\n Results: "
print"\n The Equivalent Length of Globe valve is ft.",round(Le,2)
```

In [9]:

```
# Aim:Refer Example 4-9 for Problem Description
# Given:
# Pump hydraulic power:
HHP=5.0; #HP
# Pump flow:
Q=30.0; #gpm
# Inside Diameter of pipe:
D=1.0; #in
# specific gravity of oil:
SG_oil=0.9;
# Kinematic viscosity of oil:
nu=100.0; #cS
# elevation between station 1 and 2:
Z=-20.0; #ft ,-ve sign indicates station 2 is above Station 1
# Pressure at oil top surface level in hydraulic tank:
p1=0.0; #psig
import math
from math import pi
from math import floor
from math import ceil
# Solution:
# specific weight of oil,
gamma1=SG_oil*62.4; #lb/ft**3
# acceleration due to gravity,
g=32.2; #ft/s**2
# Since, There is no hydraulic motor,
Hm=0; #ft
# oil in tank is at rest,
v1=0; #ft/s
# velocity head at station 1,
K1=(v1**2)/(2*g); #ft
# velocity through pipe,
v2=(Q/449)/((pi*((D/12)**2))/4); #ft/s
v2=round(v2)+(round(floor((v2-round(v2))*10))/10); #ft/s ,rounding off the answer
# velocity head at station 2,
K2=(v2**2)/(2*g); #ft
K2=round(K2)+(round(ceil((K2-round(K2))*10))/10); #ft ,rounding off the answer
# Reynolds Number,
N_R=round((7740*v2*D)/nu);
# friction factor,
f=64/N_R;
# From table of "K factors of common valves and fittings",
K=0.9;
# equivalent length of standard elbow,
Le_std_elbow=((K*(D/12))/f); #ft
# Total equivalent length,
Le_tot=21+Le_std_elbow; #ft
# head loss due to friction between Station 1 and 2,
H_L=round((f*Le_tot*K2)/(D/12)); #ft
# Pump head,
Hp=ceil((3950*HHP)/(Q*SG_oil)); #ft
# Pressure at station 2,
p2=round(Z+(p1/gamma1)+K1+Hp-Hm-H_L-K2); #ft ,Modified Bernoulli equation
p2=round((p2*gamma1)/144); #psi
# Pressure increase across the pump,
delp=ceil((gamma1*Hp)/144);
# Results:
print"\n Results: "
print"\n The Pressure available at the inlet to hydraulic motor is psi.",p2
```

In [10]:

```
# Aim:Refer Example 4-10 for Problem Description
# Given:
# Pump hydraulic power:
HHP=3.73; #kW
# Pump flow:
Q=0.00190; #m**3/s
# Inside Diameter of pipe:
D=0.0254; #m
# specific gravity of oil:
SG_oil=0.9;
# Kinematic viscosity of oil:
nu=100.0; #cS
# elevation between station 1 and 2:
Z=-6.10; #m ,-ve sign indicates station 2 is above Station 1
# Pressure at oil top surface level in hydraulic tank:
p1=0.0; #Pa Pump inlet pipe length:
L1=1.53; #m
# Pump outlet pipe length up to hydraulic motor:
L2=4.88; #m
import math
from math import pi
# Solution:
# specific weight of oil,
gamma1=SG_oil*9800; #N/m**3
# acceleration due to gravity,
g=9.80; #m/s**2
# Since, There is no hydraulic motor,
Hm=0; #m
# oil in tank is at rest,
v1=0; #m/s
# velocity head at station 1,
K1=(v1**2)/(2*g); #m
# velocity through pipe,
v2=Q/((pi*(D**2))/4); #m/s
# velocity head at station 2,
K2=(v2**2)/(2*g); #m
# Reynolds Number,
N_R=((v2*D)/(nu/1000000));
# friction factor,
f=64/N_R;
# From table of "K factors of common valves and fittings",
K=0.9;
# equivalent length of standard elbow,
Le_std_elbow=((K*(D/12))/f); #m
# Total equivalent length,
Le_tot=L1+L2+Le_std_elbow; #m
# head loss due to friction between Station 1 and 2,
H_L=((f*Le_tot*K2)/D); #m
# Pump head,
Hp=((1000*HHP)/(Q*gamma1)); #m
# Pressure at station 2,
p2=(Z+(p1/gamma1)+K1+Hp-Hm-H_L-K2); #m ,Modified Bernoulli equation
p2=((p2*gamma1)/1000); #kPa
# Results:
print"\n Results: "
print"\n The Pressure available at the inlet to hydraulic motor is kPa.",round(p2)
print"\n The answer in the program is different than that in textbook. It may be due to no.s of significant digit in data and calculation"
```

In [ ]:

```
```