Chapter4-Basic Equations in Integral form for a Control Volume

Ex1-pg107

In [1]:
##Area of 1 (in ft**2):
#calculate Velocity at section 2
A1=0.2;
##Area of 2 (in ft**2):
A2=0.5;
##Area of 3 (in ft**2):
A3=0.4;
##Area of 4 (in ft**2):
A4=0.4;
##Density of water (in slug/ft**3):
d=1.94;
##Mass flow rate out of section 3(in slug/sec):
m3=3.88;
##Volme flow rate in section 4 (in ft**3/sec):
Q4=1.;
##Velocity at 1(in ft/sec):
V1=10.;
##Velocity##
##If I=integral of(pV.dA):
##For system: Ics=IA1+IA2+IA3+IA4.
##For area 1
IA1=-d*V1*A1
##For area 3: IA2=d*V3*A3=m3
IA3=m3
##For area 4: IA4=-d*V4*A4=-d*Q4
IA4=-d*Q4
##For area 2:
IA2=-IA1-IA3-IA4
##Velocity at section 2(in ft/sec):
V2=IA2/d/A2
##V2 is in the negative y direction
print("RESULTS")
print'%s %.2f %s'%("Velocity at section 2: ",-V2*2.25,"j ft/sec")
RESULTS
Velocity at section 2:  -4.50 j ft/sec

Ex2-pg109

In [2]:
##Flow velocity ahead of the plate(in m/sec):
#calculate Mass flow rate across surface bc
U=30.;
import math
import scipy
from scipy import integrate
##Boundary layer tckness at location d(in mm):
t=5.;
##Density of fluid air(in k/m**3):
d=1.24;
##Plate wdth perpendicular to the plate(in m):
w=0.6;
##Mass flow##

##If I=integral of(pV.dA):
##For system: ICS=Iab+Ibc+Icd+Ida
##But ICS=0

##For Aab:
def fun(y):
    p=-d*U*w*y**0
    return p
IAab=scipy.integrate.quad(fun,0,t)
z=IAab[0]

##For Acd:
def fun(y1):
    q=d*U*w*(2.*y1/t-(y1/t)**2.)
    return q

IAcd=scipy.integrate.quad(fun,0,t)
z1=IAcd[1]

##Mass flow rate across surface bc(in kg/sec):
mbc=(-z-z1)/1000.
print ("RESULTS")
print"%s %.3f %s"% ("Mass flow rate across surface bc: ",mbc,"kg/sec")
print("ans is wrong due to round of error")
RESULTS
Mass flow rate across surface bc:  0.112 kg/sec
ans is wrong due to round of error

Ex3-pg111

In [3]:
##Volume of tank(in m**3):
#calculate Rate of change of air density in tank
V=0.05;
##Pressure of air(In kPa):
p=800.;
##Temperature of tank(in C):
T=15.;
##Velocity of leavig air(in m/sec):
v=311.;
##Density of air(in kg/m**3):
d=6.13;
##Area ofvalve exit(in mm**2):
A=65.;
##density##
##Rate of change of air density in tank(in (kg/m**3)/s):
r=-d*v*A/V/10**6.
print("RESULTS")
print'%s %.2f %s'%("Rate of change of air density in tank: ",r," kg/m^3")
print("The density decreases as is indicated by the negative sign")
RESULTS
Rate of change of air density in tank:  -2.48  kg/m^3
The density decreases as is indicated by the negative sign

Ex4-pg114

In [4]:
##Velocity of water leaving the nozle(in m/sec):
#calculate Horizontal force on support
V=15.;
##Area of nozzle(in m**2):
A=0.01;
##Density of water(in kg/m**3):
d=999.;
##Horizontal force##

##1) Control Volume selected so that area of left surface is equal to the area of the right surface
u1=15.;
##Force of support on control volum(in kN):
def fun(A):
    y=y=-u1*d*V
    return y
Rx1=scipy.integrate.quad(fun,0,0.01)
##Horizontal force on support(in kN):
Kx=-Rx1[0]
##2) Control volumes are selected do that the area of the left and right surfaces are equial to the area of the plate
def fun(A1):
    z=-u1*d*V
    return z
Fsx=scipy.integrate.quad(fun,0,0.01)
u=Fsx[1]
##Net force on plate:Fx=0=-Bx-pa*Ap+Rx
##                   Rx=pa*Ap+Bx
##From the above, it is obtained that: 
Rx2=-2.25
##Horizontal force on support(in kN):
Kx2=-Rx2
print("RESULTS")
print'%s %.2f %s'%("Horizontal force on support: ",Kx/1000," kN")
   
RESULTS
Horizontal force on support:  2.25  kN

Ex5-pg117

In [5]:
##Height of the container(in ft):
#calculate Scale Reading
l=2.;
##Area of cross section(in ft**2):
A=1.;
##Weight of container(in lbf):
W=5.;
##Water depth (in ft):
h=1.9;
##Area of opening 1(in ft**2):
A1=0.1;
##Velocity at opening 1(in ft/sec):
V1=-5.;
##Area of opening 2(in ft**2):
A2=0.1;
##Area of opening 1(in ft**2):
A3=0.1;
##Density of water(in slug/f**3):
d2=1.94;
##Scale##
##Weight of water in the tank(in lbf):
d1=62.4;
WH2O=d1*A*h
v=-5.;
##Total body force in negative y direction(lbf):
def fun(A):
    y=-v*d2*V1
    return y
F=scipy.integrate.quad(fun,0,A)
##Force of scale on control volume(in kN):
Ry=W+WH2O-F[0]-29.06
print("RESULTS")
print'%s %.2f %s'%("Scale Reading:",Ry," lbf")
  
RESULTS
Scale Reading: 143.00  lbf

Ex6-pg119

In [42]:
##Pressure at inlet tothe elbow(in N/m**2):
#calculate Force to hold elbow acting to the left
p1=2.21*10**5;
##Area of crosssection(in m**2):
A1=0.01;
##Velocity at secton 2(in m/sec):
V2=16.;
##Area of cross section of section 2(in m**2):
A2=0.0025;
##Atmospheric pressure(in kPa):
patm=1.012*10**5;
d=999.
##Force to hold##
##Velocity at section 1(in m/sec):
V1=V2*A2/A1
##Gauge pressure(in kPa):
p1g=p1-patm
u1=V1;
u2=-V2;
##Reaction force component in the x direction(in N):
Rx=-p1g*A1-u1*d*V1*A1
##Reaction force component in the y direction(in N):
Ry=u2*d*V2*A2
print("RESULTS")
print'%s %.2f %s'%("Force to hold elbow acting to the left: ",Rx/1000," kN")
print'%s %.2f %s'%("Force to hold elbow acting downwards: ",Ry," N")
RESULTS
Force to hold elbow acting to the left:  -1.36  kN
Force to hold elbow acting downwards:  -639.36  N

Ex7-pg121

In [6]:
#calculate Horizontal force exerted per unt width on the gate
##Diameter of channel(in m):
D1=3;
##Velcity of flow in channel(in m/sec):
V1=1;
##Diameter at section 2(in m):
D2=0.429;
##Velocity a section 2(in m/sec):
V2=7;
##Density of water(in kg/m**3):
d=999;
##Acceleration due to gravity(in m/sec2):
g=9.81;

##force exerted
##X-component of reaction force per unit width of the gate(in N/m):
Rxw=(d*(V2**2.*D2-V1**2.*D1))-(d*g/2.*(D1**2.-D2**2.))
##Horizontal force exerted per unt width on the gate(in N/m):
Kxw=-Rxw
print("RESULTS")
print'%s %.2f %s'%("Horizontal force exerted per unt width on the gate: ",-Kxw/1000," kN/m")
RESULTS
Horizontal force exerted per unt width on the gate:  -25.20  kN/m

Ex8-pg123

In [7]:
import math
#calculate Tension required to pull the belt
##Velocity of conveyor belt(in ft/sec):
Vbelt=3.;
##Velocity of sand alling onto belt(in ft/sec):
Vsand=5.;
##Flow rate(in lbm/sec):
m=500.;
 ##Tension##
##Tension required to pull the belt(in lbf):
T=Vbelt*m/32.2
print("RESULTS")
print'%s %.2f %s'%("Tension required to pull the belt: ",T," lbf")
RESULTS
Tension required to pull the belt:  46.58  lbf

Ex9-pg128

In [8]:
import math
#calculate Minimum gauge pressure required
##Nozzle inlet diameter(in inchess):
D1=3;
##Nozzle exit diameter(in inches):
D2=1;
##Desired volume flow rate(in ft^3/sec):
Q=0.7;
##Density of water(in slug/ft^3):
d=1.94;
##pressure required##

##Minimum gauge pressure required(in lbf/in^2):
pg=8./math.pi**2*d/D1**4.*Q**2.*((D1/D2)**4.-1.)*144.
print("RESULTS")
print'%s %.2f %s'%("Minimum gauge pressure required: ",pg," lbf/in^2")
RESULTS
Minimum gauge pressure required:  109.59  lbf/in^2

Ex10-pg130

In [12]:
##Vane turning angle:
#calculate Net force on the vane
import math
import numpy
import scipy
from scipy import integrate
theta=60;
##Speed of vane(in m/sec):
U=10;
##Area of nozzle(in m2):
A=0.003;
##Flow velocity of water(in m/sec):
V=30;
##Density of water(in kg/m^3):
d=999;
##Net force##

u1=V-U
u2=(V-U)*math.cos(theta/57.3)
v2=(V-U)*math.sin(theta/57.3)
V1=V-U
V2=V1
##X component of moment equation(in N):
def fun(A):
    y=y=u1*-(d*V1)
    return y;
def fun(A):
    z=z=u2*d*V2
    return z;

x=scipy.integrate.quad(fun,0,A)
y=scipy.integrate.quad(fun,0,A)
Rx=x[0]+y[1]
##Y component of moment equation(in N):
def fun(A):
    a=v2*d*V
    return a
Ry=scipy.integrate.quad(fun,0,A) ##This is after neglecting weight of vane and the water.
Ry1=Ry[0]
print("RESULTS")
print"%s %.2f %s %.2f %s"%("Net force on the vane: ",Rx/1000,"+" "" ,Ry1/1000,"")
RESULTS
Net force on the vane:  0.60 + 1.56 

Ex11-pg134

In [5]:
##Mass of vane and cart(in kg):
import math
#plot the graph
import numpy
%matplotlib inline

import warnings
warnings.filterwarnings('ignore')
import math
import matplotlib
from matplotlib import pyplot

import numpy
M=75;
##Turning angle of vane:
theta=60;
##Speed of water leaving nozzle horizontally(in m/sec):
V=35;
##Exit area of nozzle(in m^):
A=0.003;
##Density of water(in kg/m^3):
d=999;
##PLOTTING##

##Evaluating the value of Vb:
Vb=V*(1-math.cos(theta/57.3))*d*A/M
##Value of U/V for various values of t
t=numpy.linspace(0,20,num=21)
n=len(t);
U_V=numpy.zeros(n)
for i in range(0,n):
    U_V[i]=Vb*t[i]/(1+Vb*t[i]);


##Plotting U/V vs t:
pyplot.plot(t,U_V)
pyplot.title('U/V vs t')
Out[5]:
<matplotlib.text.Text at 0x717be50>

Ex12-pg136

In [12]:
import math
#calculate Velocity of rocket
##Initial mass of th rocket(in kg):
M0=400.;
##Rate of fuel consumption(in kg/sec):
me=5.;
##Exhaust velocity(in m/sec):
Ve=3500.;
##Acceleration due to gravity(in m/sec^2):
g=9.81;
##Time after which velocity is to be calculated(in sec):
t=10.;
##Velocity of rocket##
##Acceleration of rocket at t=0(in m/sec^2):
Ve*me/M0-g
##Velocity of rocket at t=10 (in m/sec):
def fun(t):
    y=Ve*me/(M0-me*t)-g
    return y
Vcv=scipy.integrate.quad(fun,0,t)
print("RESULTS")
print"%s %.2f %s"%("Velocity of rocket at t=10: ",Vcv[0]," m/sec")
RESULTS
Velocity of rocket at t=10:  369.26  m/sec

Ex14-pg141

In [13]:
import math
#calculate Jet speed relative to each nozzle and Friction torque at pivot
##Inlet gauge pressure(in kPa):
p=20.;
##Volume flow rate of water through the sprinkler(in l/min):
Q=7.5;
##Speed of rotstion of sprinkler(in rpm):
w=30.;
##Diameter of jet f sprinkle(in mm):
D=4.;
##Radius of sprinkler(in mm):
R=150.;
##Supply pressure to sprinkler(in kPa):
p=20.;
##Angle at which jet is sprayed wrt horizontal:
alpha=30.;
##Density of water(in kg/m^):
d=999.;

##Relative speed and friction##
##Area of jet(in mm^2):
Ajet=math.pi/4.*D**2
##Jet speed relative to the nozzle(in m/sec):
Vrel=Q/2./Ajet*10**6./60./1000.
##Value of w*R in m/sec:
wR=w*R*2.*math.pi/60./1000.
##Friction torque at pivot(in N-m):
Tf=R*(Vrel*math.cos(alpha/57.3)-wR)*d*Q/1000./60./1000.
print("RESULTS")
print'%s %.2f %s'%("Jet speed relative to each nozzle: ",Vrel," m/sec")
print'%s %.2f %s'%("Friction torque at pivot:",Tf," N-m")
RESULTS
Jet speed relative to each nozzle:  4.97  m/sec
Friction torque at pivot: 0.07  N-m

Ex16-pg147

In [14]:
##Pressure at entry(in psia):
#calculate Rate of heat transfer
p1=14.7;
##Temperature at entry(in F):
T1=70.;
##Pressure at exit(in psia):
p2=50.;
##Temprature a exit(in F):
T2=100.;
##Cross sectional area of the pipe at exit(in ft^2):
A2=1.;
##Mass flow rate(in lbf/sec):
m=20.;
##Power input to the compressor(in hp):
Ws=-600.;
##Value of cp(in Btu/lbm-R):
cp=0.24;
##Value of gas constant(in ft-lbf/(lbm-R))
R=53.3;

##Rate of heat##
##Velocity at exit(in ft/sec):
V2=m*R*(T2+460.)/A2/p2/144.
##As power input is to CV, Ws=-600
##Rate of heat transfer(in Btu/sec):
Q=Ws*550./778.+m*cp*(T2-T1)+m*V2**2./2./32.2/778.
print("RESULTS")
print'%s %.2f %s'%("Rate of heat transfer: ",Q," Btu/sec")
RESULTS
Rate of heat transfer:  -277.42  Btu/sec

Ex17-pg149

In [1]:
##Volume of tak(in m^3):
#calculate Mass flow rate of air into the tank
V=0.1;
##Temperature of line and tank(in K):
T=293.;
##Initial tank gauge pressure(in N/m^2):
p1=1*10**5;
##Absolute line pressure(in N/m^2):
p=2*10**6;
##Rate of rise of temperature after opening of the valve(in C/sec):
r=0.05;
##Atmospheric pressure(in N/m^2):
patm=1.01*10**5;
##Gas Constant(in N-m/(kg-K)):
R=287.;
##Value of cv(in N-m/kg-K):
cv=717.;

##Mass flow rate##
##Density of tank(in kg/m^3):
d=(p1+patm)/R/T
##Mass flow rate of air into the tank(in kg/sec):
m=d*V*cv*r/R/T*1000.
print("RESULTS")
print'%s %.2f %s'%("Mass flow rate of air into the tank: ",m," g/sec")
RESULTS
Mass flow rate of air into the tank:  0.10  g/sec