Chapter 3 : The balance equation and mass balance

Example 3.4 page no : 88

In [2]:
import math

# variables
V=15.;                        #gal volume of gasoline
t=2.;                         #min
rho_water=62.3;               #lbm/ft^3
sg=0.72;                      #specific gravity

# calculation and Result
q=(15/2.0)*(0.1336/60)        #ft^3/s vol. flow rate
print "volumetric flow rate is %f ft^3/s"%q
m=q*sg*rho_water              #lbm/s
print "Mass flow rate is %f lbm/s"%m
d=1.;                         #in diameter of pipe
a=((math.pi)*d**2/4.0)/144.0;    #ft^2 area of pipe
v_avg=q/a                     #ft/s
print "The average velocity is %f ft/s"%v_avg
volumetric flow rate is 0.016700 ft^3/s
Mass flow rate is 0.749095 lbm/s
The average velocity is 3.061886 ft/s

Example 3.5 page no : 90

In [3]:
import math

# variables
d1=2.;                       #ft diameter of pipe at position 1
a1=(math.pi)/4*d1**2;        #ft^2
v1=50.;                      #ft/s vel of gas at position 1
rho1=2.58;                   #lbm/ft^3 density of gas at position 1
d2=3.;                       #ft diameter of pipe at position 2

# calculation
a2=(math.pi)/4*d2**2;
rho2=1.54;                   #lbm/ft^3 density at position 2
v2=(rho1/rho2)*(a1/a2)*v1    #ft/s

# result
print "Velocity is %f ft/s"%v2
m=rho1*v1*a1                 #lbm/s mass flow rate
print "The mass flow rate is %f lbm/s"%m
Velocity is 37.229437 ft/s
The mass flow rate is 405.265452 lbm/s

Example 3.6 page no : 91

In [4]:
import math

# variables
d1=0.25;                      #m diameter of pipe at position 1
v1=2.;                        #m/s velocity
rho=998.2;                    #kg/m^3  density of water
a1=(math.pi)/4*d1**2;         #m^2
d2=0.125                      #m diameter of pipe at position 2

# calculation
a2=(math.pi)/4*d2**2;         #m^2
m=rho*a1*v1                   #kg/s mass flow rate

# result
print "Mass flow rate is %f kg/s"%m
q=m/rho                       #m^3/s volumetric flow rate
print "The volumetric flow rate is %f m^3/s"%q
v2=(a1/a2)*v1                 #m/s velocity
print "Velocity of water is %f m/s"%v2
Mass flow rate is 97.998056 kg/s
The volumetric flow rate is 0.098175 m^3/s
Velocity of water is 8.000000 m/s

Example 3.7 page no : 92

In [5]:
import math

# variables
p_initial=1.;                        #atm pressure initially
p_final=0.0001;                      #atm pressure finally
V=10.;                               #ft^3 volume of system
q=1.;                                #ft^3/min vol. flow rate

# calculation
t=(V/q)*math.log(p_initial/p_final)  #min

# result
print "The time required is %f min"%t
The time required is 92.103404 min

Example 3.8 page no : 93

In [6]:
# variables
m_in=0.0001;                      #lbm/min
q_out=1.;                         #ft^3/min
rho_sys=m_in/q_out                #lbm/ft^3
rho_air=0.075;                    #lbm/ft^3
p_initial=1.;                     #atm

# calculation
p_steady=p_initial*(rho_sys/rho_air)          #atm

# result
print "The steady state pressure is %f atm"%p_steady
The steady state pressure is 0.001333 atm

Example 3.9 page no : 94

In [7]:
import math

# variables
d=3.;                          #m diameter of tank
a=(math.pi)*d**2/4;            #m^2
d_in=0.1;                      #m inner diameter of inflow pipe
d_out=0.2;                     #m
v_in=2.0;                      #m/s
v_out=1.0;                     #m/s

# calculation
q_in=((math.pi)*d_in**2/4.0)*v_in;                #m^3/s
q_out=((math.pi)*d_out**2/4.0)*v_out;             #m^3/s

#let D represent d/dt
DV=q_in-q_out;                 #m^3/s

# result
if DV>1:
    print "The water level in tank is rising"
elif DV<1:
    print "The water level in tank is falling"
else:
    print "No accumulation"
#let h be the height of water in tank
Dh=DV/a                       #m/s 
print "The rate of level of water is rising or falling in a cylindrical tank is %f m/s"%Dh
The water level in tank is falling
The rate of level of water is rising or falling in a cylindrical tank is -0.002222 m/s

Example 3.11 page no : 97

In [8]:
# variables
q=5/8.0;                     #kg/hr mass evaporation rate of benzene
c=1.3*10**(-6);              #kg/m^3 concentration of benzene

# calculation
Q=q/c/3600.0                 #m^3/s

# result
print "The flow rate of ventilation air supply is %f m^3/s"%Q
The flow rate of ventilation air supply is 133.547009 m^3/s