In [1]:

```
# Aim:To find minimum inside diameter of pipe
# Given:
# flow-rate through pipe:
Q=30.0; #gpm
# average fluid velocity:
v=20.0; #ft/s
import math
from math import pi
# Solution:
# flow-rate in ft**3/s,
Q_fps=Q/449; #ft**3/s
# minimum required pipe flow area,
A=(Q_fps/v)*144; #in**2
# minimum inside diameter,
D=((4*A)/(pi))**0.5; #in
# Results:
print"\n Results: "
print"\n The minimum inside diameter of pipe is in.",round(D,3)
```

In [2]:

```
# Aim:To find minimum inside diameter of pipe in Metric units
# Given:
# flow-rate through pipe:
Q=0.002; #m^3/s
# average fluid velocity:
v=6.1; #m/s
from math import pi
# Solution:
# minimum required pipe flow area,
A=(Q/v); #m^2
# minimum inside diameter,
D=(((4*A)/(pi))**0.5)*1000; #mm
# Results:
print"\n Results: "
print"\n The minimum inside diameter of pipe is mm.",round(D,1)
```

In [3]:

```
# Aim:To find safe working pressure for the tube
# Given:
# outside diameter of steel tube:
Do=1.250; #in
# inside diameter of steel tube:
Di=1.060; #in
# tensile strength of steel tube:
S=55000.0; #psi
# factor of safety:
FS=8.0;
# Solution:
# wall thickness,
t=(Do-Di)/2; #in
# burst pressure,
BP=(2*t*S)/Di; #psi
# working pressure,
WP=BP/FS/1000; #psi
# Results:
print"\n Results: "
print"\n The working pressure of steel tube is psi.",round(WP,3)
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 [4]:

```
# Aim:Refer Example 10-4 for Problem Description
# Given:
# flow-rate:
Q=30; #gpm
# operating pressure:
p=1000; #psi
# maximum velocity:
v=20; #ft/s
# tensile strength of material:
S=55000; #psi
# factor of safety:
FS=8;
from math import pi
# Solutions:
# flow-rate,
Q=Q/449; #ft^3/s
# minimum required pipe flow area,
Ai=(Q/v)*144; #in^2
# minimum inside diameter,
Di=((4*Ai)/(pi))**0.5; #in
# wall thickness,
t1=0.049; t2=0.065; #in
# tube inside diameter,
D1=0.902; D2=0.870; #in
# burst pressure,
BP1=(2*t1*S)/D1; #psi
# working pressure,
WP1=BP1/FS; #psi
print" \n The working pressure psi is not adequate (less than psi) so next case is considered,",WP1,p
# burst pressure,
BP2=(2*t2*S)/D2; #psi
# working pressure,
WP2=BP2/FS; #psi
# ratio of inner diameter to thickness,
r2=D2/t2;
print" \n The working pressure psi is greater than psi) ,",WP2,p
# Results:
print"\n Results: "
print"\n The ratio of inner diameter to length is .",round(r2,1)
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 [5]:

```
#Aim:Refer Example 10-5 for Problem Description
# Given:
# flow-rate:
Q=0.00190; #m^3/s
# operating pressure:
p=70.00000000000; #bars
# maximum velocity:
v=6.10000000000; #m/s
# tensile strength of material:
S=379.0000000; #MPa
# factor of safety:
FS=8.0000000;
from math import pi
# Solutions:
# minimum required pipe flow area,
A=(Q/v); #m^2
# minimum inside diameter,
ID=(((4*A)/(pi))**0.5)*1000; #mm
# wall thickness,
t1=1.; t2=2.; #mm
# tube inside diameter,
D1=20.; D2=24.0; #mm
# burst pressure,
BP1=(2*(t1/1000)*S)/(D1/1000); #MPa
# working pressure,
WP1=(BP1/FS)*10; #bars
print" \n The working pressure bars is not adequate (less than bars) so next case is considered,",round(WP1,1)
# burst pressure,
BP2=(2*(t2/1000)*S)/(D2/1000); #MPa
# working pressure,
WP2=(BP2/FS)*10; #MPa
# ratio of inner diameter to thickness,
r2=D2/t2;
print" \n The working pressure bars is greater than bars) ,",round(WP2)
# Results:
print"\n Results: "
print"\n The ratio of inner diameter to length is ",r2
```