Chapter 8 - Fluid compressibility and incompressible flow

Example 1 - Pg 323

In [2]:
#calculate the initial and final volumes. Also, calculate the final temperature of the gas
#Initialization of variables
import math
pi=14.7 #psia
pf=50. #psia
cp=0.240 #Btu/lb R
cv=0.170 #Btu/lb R
J=778
T=60+459.6 #R
#calculations
R=J*(cp-cv)
k=cp/cv
gam=pi*144./(R*T)
V=1/gam
Vf=V*math.pow((pi/pf),(1/k))
Tf=T*(pf*Vf/(pi*V))
#results
print '%s %.2f %s' %("Initial volume =",V,"ft^3")
print '%s %.2f %s' %("\n Final volume =",Vf,"cu ft")
print '%s %.1f %s' %("\n Final temperature =",Tf," R")
Initial volume = 13.37 ft^3

 Final volume = 5.62 cu ft

 Final temperature = 742.6  R

Example 2 - Pg 325

In [3]:
#calculate the pressure difference across the pipe
#Initialization of variables
import math
ratio=0.99
E=3.19e5 #lb/in^2
#calculations
pd=-E*math.log(ratio)
#ersults
print '%s %d %s' %("Pressure difference =",pd,"psi")
print '%s' %("The answers are a bit different from textbook due to rounding off error")
Pressure difference = 3206 psi
The answers are a bit different from textbook due to rounding off error

Example 3 - Pg 329

In [4]:
#calculate the speed of test plane
#Initialization of variables
import math
k=1.4
g=32.2 #ft/s^2
R=53.3 #ft-lb/lb R
T=389.9 #R
Nm=2
#calculations
c=math.sqrt(k*g*R*T)
V=Nm*c*3600/5280.
#results
print '%s %.1f %s' %("Speed of test plane =",V,"mph")
Speed of test plane = 1319.9 mph

Example 4a - Pg 337

In [4]:
#calculate the velocity at section 2
#Initialization of variables
import math
T1=584.6 #R
g=32.2 #ft/s^2
k=1.4
R=53.3 #ft-lb/lb R
V1=600 #ft/s
T2=519.6 #R
#calculations
Nm1=V1/(math.sqrt(k*g*R*T1))
Nm22= ((1+ (k-1)/2 *Nm1*Nm1)/(T2/T1) -1)*(2/(k-1))
Nm2=math.sqrt(Nm22)
V2=Nm2*math.sqrt(k*g*R*T2)
#results
print '%s %d %s' %("Velocity at section 2 =",V2,"ft/s")
Velocity at section 2 = 1068 ft/s

Example 4b - Pg 337

In [5]:
#calculate the pressure difference between two stations
#Initialization of variables
import math
T1=584.6 #R
g=32.2 #ft/s^2
k=1.4
R=53.3 #ft-lb/lb R
V1=600 #ft/s
T2=519.6 #R
pa=14.7 #psi
p1=50 #psia
#calculations
Nm1=V1/(math.sqrt(k*g*R*T1))
Nm22= ((1+ (k-1)/2 *Nm1*Nm1)/(T2/T1) -1)*(2/(k-1))
Nm2=math.sqrt(Nm22)
pr=math.pow(((1+ (k-1)/2 *Nm1*Nm1)/(1+ (k-1)/2 *Nm2*Nm2)),(k/(k-1)))
p2=pr*(p1+pa)
dp=p1+pa-p2
#results
print '%s %.1f %s' %("Pressure difference between two stations =",dp,"psi")
Pressure difference between two stations = 21.9 psi

Example 4c - Pg 338

In [6]:
#calculate the area ratio
#Initialization of variables
import math
T1=584.6 #R
g=32.2 #ft/s^2
k=1.4
R=53.3 #ft-lb/lb R
V1=600 #ft/s
T2=519.6 #R
#calculations
Nm1=V1/(math.sqrt(k*g*R*T1))
Nm22= ((1+ (k-1)/2 *Nm1*Nm1)/(T2/T1) -1)*(2/(k-1))
Nm2=math.sqrt(Nm22)
Ar= Nm1/Nm2 *math.pow(((1+ (k-1)/2 *Nm2*Nm2)/(1+ (k-1)/2 *Nm1*Nm1)),((k+1)/(2*(k-1))))
#results
print '%s %.3f' %("Area ratio = ",Ar)
Area ratio =  0.754

Example 4d - Pg 338

In [7]:
#calculate the density of air at both the stations
#Initialization of variables
import math
T1=584.6 #R
g=32.2 #ft/s^2
k=1.4
R=53.3 #ft-lb/lb R
V1=600 #ft/s
T2=519.6 #R
pa=14.7 #psi
p1=50 #psia
#calculations
Nm1=V1/(math.sqrt(k*g*R*T1))
Nm22= ((1+ (k-1)/2 *Nm1*Nm1)/(T2/T1) -1)*(2/(k-1))
Nm2=math.sqrt(Nm22)
pr=math.pow(((1+ (k-1)/2 *Nm1*Nm1)/(1+ (k-1)/2 *Nm2*Nm2)),(k/(k-1)))
p2=pr*(p1+pa)
rho1=(p1+pa)*144./(g*R*T1)
rho2=p2*144./(g*R*T2)
#results
print '%s %.5f %s' %("Density of air at station 1 =",rho1,"slug/ft^3")
print '%s %.5f %s' %("\n Density of air at station 2 =",rho2,"slug/ft^3")
Density of air at station 1 = 0.00929 slug/ft^3

 Density of air at station 2 = 0.00692 slug/ft^3

Example 5 - Pg 345

In [8]:
#calculate the mass rate of air flow
#Initialization of variables
import math
p0=19.7 #psia
R=53.3 #lb-ft/lb-R
T0=539.6 #R
g=32.2 #ft/s^2
pa=14.7 #psia
d=1 #in
k=1.4
#calculations
rho0=p0*144/(g*R*T0)
pr=pa/p0
G=math.pi/4 *(d/12.)*(d/12.) *math.pow((2*k/(k-1) *p0*144*rho0),(0.5)) *math.pow((pr),(1/k)) *math.pow((1-math.pow(pr,((k-1)/k))),0.5)
#results
print '%s %.5f %s' %("Mass rate of air flow =",G,"slug/sec")
Mass rate of air flow = 0.00978 slug/sec

Example 6 - Pg 346

In [9]:
#calculate the mass rate of air flow
#Initialization of variables
import math
p0=64.7 #psia
R=53.3 #lb-ft/lb-R
T0=539.6 #R
g=32.2 #ft/s^2
pa=14.7 #psia
d=1. #in
k=1.4
#calculations
rho0=p0*144/(g*R*T0)
pr=pa/p0
G=math.pi/4 *(d/12)*d/12. *math.pow((k*p0*144*rho0),(0.5)) *math.pow((2/(k+1)),((k+1)/(2*(k-1))))
#results
print '%s %.5f %s' %("Mass rate of air flow =",G,"slug/sec")
Mass rate of air flow = 0.03616 slug/sec

Example 7a - Pg 347

In [10]:
#calculate the weight of air flow through the nozzle
#Initialization of variables
import math
k=1.4
R=53.3 #lb-ft/lb R
pe=14.7 #psia
p0=114.7 #psia
T0=524.6 #R
g=32.2 #ft/s^2
d=0.5 #in
#calculations
pr=pe/p0
prcr=0.528
pr=prcr*p0
rho0= p0*144/(g*R*T0)
G=math.pi/4 *(d/12)*d/12. *math.pow((k*p0*144*rho0),(0.5)) *math.pow((2/(k+1)),((k+1)/(2*(k-1))))
Wt=G*g
#results
print '%s %.4f %s' %("weight of air flow through the nozzle =",Wt,"lb/s")
weight of air flow through the nozzle = 0.5233 lb/s

Example 7b - Pg 348

In [11]:
#calculate the exit Mach number, exit velocity and the exit area
#Initialization of variables
import math
k=1.4
R=53.3 #lb-ft/lb R
pe=14.7 #psia
p0=114.7 #psia
T0=524.6 #R
g=32.2 #ft/s^2
d=0.5 #in
Nm1=1.
#calculations
pr=pe/p0
Nme=math.sqrt(2/(k-1) *(math.pow(1./pr,(k-1)/k) -1))
Te=T0/(1+ (k-1)/2 *Nme*Nme)
Ve=Nme*math.sqrt(k*g*R*Te)
At=math.pi/4. *(d)*d
Ae=Nm1/Nme *math.pow(((1+ (k-1)/2 *Nme*Nme)/(1+ (k-1)/2 *Nm1*Nm1)),((k+1)/(2*(k-1)))) *At
#results
print '%s %.2f' %("Mach number exit = ",Nme)
print '%s %d %s' %("\n Exit velocity =",Ve,"ft/s")
print '%s %.3f %s' %("\n Exit area =",Ae," in^2")
Mach number exit =  2.00

 Exit velocity = 1672 ft/s

 Exit area = 0.331  in^2

Example 8a - Pg 349

In [5]:
#calculate the exit mass flow rate, pressure, temperature, velocity and mach number
#Initialization of variables
import math
k=1.4
R=53.3 #lb-ft/lb R
p0=100. #psia
T0=534.6 #R
g=32.2 #ft/s^2
d=0.5 #in
Nm1=1.
A=2./144. #ft^2
#calculations
print '%s' %("Exit mach number is found using trial and error")
Nme=2.44
rho0=p0*144/(g*R*T0)
G= A*math.sqrt(k*p0*144*rho0) *math.pow((2/(k+1)),((k+1)/(2*(k-1))))
pe=p0*math.pow((1/(1+(k-1)/2 *Nme*Nme)),(k/(k-1)))
Te=T0/(1+ (k-1)/2 *Nme*Nme)
Ve=Nme*(math.sqrt(k*g*R*Te))
#results
print '%s %.3f %s' %("\n Exit mass flow rate =",G,"slug/s")
print '%s %.2f %s' %("\n Exit pressure =",pe,"psia")
print '%s %.1f %s' %("\n Exit temperature =",Te," R")
print '%s %d %s' %("\n Exit velocity =",Ve,"ft/s")
print '%s %.2f' %("\n Exit mach number = ",Nme)
print '%s' %("The answers are a bit different from textbook due to rounding off error")
Exit mach number is found using trial and error

 Exit mass flow rate = 0.143 slug/s

 Exit pressure = 6.43 psia

 Exit temperature = 244.0  R

 Exit velocity = 1868 ft/s

 Exit mach number =  2.44
The answers are a bit different from textbook due to rounding off error

Example 8b - Pg 350

In [13]:
#calculate the exit mass flow rate, pressure, temperature,velocity and mach number
#Initialization of variables
import math
k=1.4
R=53.3 #lb-ft/lb R
p0=100. #psia
T0=534.6 #R
g=32.2 #ft/s^2
d=0.5 #in
Nm1=1.
A=2./144. #ft^2
#calculations
print '%s' %("Exit mach number is found using trial and error")
Nme=0.24
rho0=p0*144/(g*R*T0)
G= A*math.sqrt(k*p0*144*rho0) *math.pow((2/(k+1)),((k+1)/(2*(k-1))))
pe=p0*math.pow((1/(1+(k-1)/2 *Nme*Nme)),(k/(k-1)))
Te=T0/(1+ (k-1)/2 *Nme*Nme)
Ve=Nme*(math.sqrt(k*g*R*Te))
#results
print '%s %.3f %s' %("\n Exit mass flow rate =",G,"slug/s")
print '%s %.2f %s' %("\n Exit pressure =",pe,"psia")
print '%s %.1f %s' %("\n Exit temperature =",Te," R")
print '%s %d %s' %("\n Exit velocity =",Ve,"ft/s")
print '%s %.2f' %("\n Exit mach number = ",Nme)
Exit mach number is found using trial and error

 Exit mass flow rate = 0.143 slug/s

 Exit pressure = 96.07 psia

 Exit temperature = 528.5  R

 Exit velocity = 270 ft/s

 Exit mach number =  0.24

Example 9 - Pg 355

In [14]:
#calculate the upstream Mach number, pressure, Temperature
#Initialization of variables
import math
k=1.4
R=53.3 #lb-ft/lb R
pu=6.43 #psia
Tu=244. #R
Nmu=2.44
#calculations
Nmd = math.sqrt(((k-1)*Nmu*Nmu +2)/(2*k*Nmu*Nmu - (k-1)))
pd=pu*(2*k*Nmu*Nmu - (k-1))/(k+1)
Td=Tu*(2*k*Nmu*Nmu - (k-1))/(k+1) *((k-1)*Nmu*Nmu +2)/((k+1)*Nmu*Nmu)
#results
print '%s %.3f' %("Mach number upstream = ",Nmd)
print '%s %.1f %s' %("\n Pressure upstream =",pd,"psia")
print '%s %.1f %s' %("\n Temperature upstream =",Td,"R")
Mach number upstream =  0.519

 Pressure upstream = 43.6 psia

 Temperature upstream = 507.2 R

Example 10 - Pg 359

In [15]:
#calculate the pressure and temperature at section 1
#Initialization of variables
import math
k=1.4
R=53.3 #lb-ft/lb R
e=0.0005 #ft
mu=3.77e-7 #lb-sec/ft^2
pe=14.7 #psia
Te=524.6 #R
g=32.2 #ft/s^2
Vi=12.5 #ft/s
l=6. #in
b=8. #in
L=100. #ft
#calculations
rhoe=pe*144/(R*g*Te)
Ve=Vi/(g*rhoe*(l*b/144.))
Nme=Ve/(math.sqrt(k*g*R*Te))
Rd=l*b/(2*(l+b)) /12.
rr=2*R/e
Nr=Ve*4*Rd*rhoe/mu
f=0.019
f2=1/(2*k) *(1/Nme*Nme -1) - (k+1)/(4*k) *math.log((1+ (k-1)/2 *Nme*Nme)/(Nme*Nme *(1+(k-1)/2)))
ff=f*L/(8*Rd) +f2
Nm1=0.305
Tr2=(1+ (k-1)/2 *Nm1*Nm1)/(1+ (k-1/2))
Tre=(1+ (k-1)/2 *Nme*Nme)/(1+ (k-1/2))
pr2=Nm1*math.pow((1+ (k-1)/2 *Nm1*Nm1),(0.5)) /math.pow((1+(k-1)/2),0.5)
pre=Nme*math.pow((1+ (k-1)/2 *Nme*Nme),(0.5)) /math.pow((1+(k-1)/2),0.5)
p1=pe/pr2 *pre
T1=Te/Tr2 *Tre
#results
print '%s %.1f %s' %("Pressure at section 1 =",p1,"psia")
print '%s %.1f %s' %("\n Tempreature at section 1 =",T1,"R")
Pressure at section 1 = 21.5 psia

 Tempreature at section 1 = 535.1 R

Example 11 - Pg 364

In [16]:
#calculate the limiting pressure and distance in both adiabatic and non-adiabatic cases
#Initialization of variables
import math
k=1.4
R=53.3 #lb-ft/lb R
g=32.2 #ft/s^2
T1=534.6 #R
V1=400. #ft/s
p1=350. #psia
f=0.02
D=6./12. #ft
#calculations
Nm1=V1/math.sqrt(k*g*R*T1)
Nm2= 1. /math.sqrt(k)
p2=p1*(Nm1)/Nm2
fl= math.log(Nm1/Nm2) + 1./(2.*k*Nm1*Nm1) *(1- Nm1*Nm1/Nm2*Nm2)
L12=fl*2*D/f
ps=p1*Nm1*math.pow((1+ (k-1)/2 *Nm1*Nm1),0.5) /math.pow((1+(k-1)/2),0.5)
Nm2=1.
fl2= -(k+1)/(4*k) *math.log((1+ (k-1)/2 *Nm1*Nm1)/(Nm1*Nm1 *(1+ (k-1)/2.))) + 1/(2*k*Nm1*Nm1) *(1- Nm1*Nm1 /Nm2*Nm2)
L2=fl2*2*D/f
#results
print '%s %.1f %s' %("Limiting pressure =",p2," psia")
print '%s %.1f %s' %("\n Distance =",L12," ft")
print '%s %.1f %s' %("\n Limiting pressure in adiabatic case =",ps," psia")
print '%s %.1f %s' %("\n Distance required =",L2,"ft")
print '%s' %("the answer is a bit different due to rounding of error in textbook")
Limiting pressure = 146.2  psia

 Distance = 81.8  ft

 Limiting pressure in adiabatic case = 114.2  psia

 Distance required = 84.2 ft
the answer is a bit different due to rounding of error in textbook