Chapter 3: Process Variables

ILLUSTRATIVE EXAMPLE 3.2, Page number: 17

In [2]:
 
#Variable Declaration:
Q1 = 8.03                       #Years(part 1)
D = 365                         #Days in a year
H = 24                          #Hours in a day
M = 60                          #Minutes in an hour
S = 60                          #Seconds in a minute
Q2 = 150                        #Miles per hour(part 2)
FM = 5280                       #Feet in a mile
YF = 1.0/3.0                    #Yard in a feet
Q3 = 100                        #Meter per second square(part 3)
Cmm = 100                       #Centimeter in a meter
FC = 1.0/30.48                  #Feet in a centimeter
SsMs = 60**2                    #Second square in a minute square
Q4 = 0.03                       #Gram per centimeter cube (part 4)
PG = 1.0/454.0                  #Pound  in a gram
CF = (30.48)**3                 #Centimeter in a feet
 
#Calculation:
A1 = Q1*D*H*M*S                 #Seconds (s)
A2 = Q2*FM*YF                   #Yards per hour (yd/hr)
A3 = Q3*Cmm*FC*SsMs             #Feet per min square (ft/min^2)
A4 = Q4*PG*CF                   #Pound per feet cube (lb/ft^3)
 
#Results:
print "1. Seconds in",Q1,"year is:",round(A1/10**8,2)," x 10**8 s"
print "2. Yards per hour in",Q2,"miles per hour is:",round(A2/10**5,1)," x 10**5 yd/h"
print "3. Feets per minute square in",Q3,"meter per square is:",round(A3/10**6,3)," x 10**6 ft/min^2"
print "4. Pounds per feet cube in",Q4,"gram per centimeter cube is:",round(A4),"lb/ft^3"
1. Seconds in 8.03 year is: 2.53  x 10**8 s
2. Yards per hour in 150 miles per hour is: 2.6  x 10**5 yd/h
3. Feets per minute square in 100 meter per square is: 1.181  x 10**6 ft/min^2
4. Pounds per feet cube in 0.03 gram per centimeter cube is: 2.0 lb/ft^3

ILLUSTRATIVE EXAMPLE 3.3, Page number: 21

In [3]:
 
#Variable Declaration:
Q1 = 32.2                   #Gravitational acceleration (ft/s^2) (part 1)
CF = 32.2                   #Conversion factor (lb.ft/lbf.s^2)
M = 100                     #Mass (lb)
SA = 3                      #Surface area (in^2)
FsIs = (1.0/12.0)**2        #Feet square in a inch square
Q2 = 14.7                   #Atmospheric pressure (psi) (part 2)
GP = 35                     #Gauge Pressure (psig)
 
#Caculations:
F = M*Q1/CF                 #Force (lbf)
P = F/SA/FsIs               #Pressure at the base (lbf/ft^2)
Pa = GP+Q2                  #Absolute pressure (psia)
 
#Results:
print "1. Pressure at the base is:",round(P),"lbf/ft^2"
print "2. Absolute pressure is:",round(Pa,1),"psia"
1. Pressure at the base is: 4800.0 lbf/ft^2
2. Absolute pressure is: 49.7 psia

ILLUSTRATIVE EXAMPLE 3.4, Page number: 23

In [4]:
 
#Variable Declaration:
Q1 = 20.0                   #Mass (lb) (part 1)
MH = 1.008                  #Molecular weight of H (lb/lbmol)
MO = 15.999                 #Molecular weight of O (lb/lbmol)
Q2 = 454                    #Gram in pound (part 2)
Q3 = 6.023*10**23           #Avogadro nuber (part 3)
 
#Calculations:
Mol = 2*MH+MO               #Molecular weight of water (lb/lbmol)
A1 = Q1/Mol                 #Pound.moles of water (lbmol)
A2 = Q1*Q2/Mol              #Gram.moles of water (gmol)
A3 = A2*Q3                  #Molecules of water (molecules)
 
#Results:
print "1. Pound.moles of water is:",round(A1,2),"lbmol water"
print "2. Gram.moles of water is:",round(A2),"gmol water"
print "3. Molecules of water is:",round(A3/10**26,3)," x 10**26 molecules"
1. Pound.moles of water is: 1.11 lbmol water
2. Gram.moles of water is: 504.0 gmol water
3. Molecules of water is: 3.036  x 10**26 molecules

ILLUSTRATIVE EXAMPLE 3.5, Page number: 25

In [7]:
 
#Variable declaration:
SG = 0.92               #Specific gavity of liquid, methanol
DW = 62.4               #Density of reference substance, water (lb/ft^3)
 
#Calculation:
DM = SG*DW              #Density of methanol (lb/ft^3)
 
#Result:
print "Density of methanol is:",round(DM,1),"lb/ft^3"
Density of methanol is: 57.4 lb/ft^3

ILLUSTRATIVE EXAMPLE 3.6, Page number: 27

In [8]:
 
#Variable declaration:
SG = 0.8                    #Specific Gravity
AV = 0.02                   #Absolute Viscosity (cP)
cP = 1                      #Viscosity of centipoise (cP)
VcP = 6.72 * 10**-4         #Pound per feet.sec in a centipoise (lb/ft.s)
pR = 62.43                  #Reference density (lb/ft^3)
 
#Calculations:
u = AV*VcP/cP               #Viscosity of gas (lb/ft.s)
p = SG*pR                   #Density of gas (lb/ft^3)
v = u/p                     #Kinematic viscosity of gas (ft^2/s)
 
#Result:
print "Kinematic viscosity of gas is:",round(v/10**-7,3),"x 10**-7 ft^2/s"
Kinematic viscosity of gas is: 2.691 x 10**-7 ft^2/s

ILLUSTRATIVE EXAMPLE 3.7, Page number: 27

In [9]:
 
#Variable declaration:
X = 7.0                     #Coordinate X of H2SO4
Y = 24.8                    #Coordinate Y of H2SO4
S = 45                      #Slope
 
#Calculations:
#From the figure C.1 we found the intersection of curves mu = 12cP
mu = 12
 
#Results:
print "Absolute viscosity of a 98% sulfuric acid solution at 45° C is :",mu*10**-2," g/cm.s"
Absolute viscosity of a 98% sulfuric acid solution at 45° C is : 0.12  g/cm.s

ILLUSTRATIVE EXAMPLE 3.8, Page number: 28

In [10]:
 
#Variable declaration:
CpM = 0.61                  #Heat capacity of methanol (cal/g.°C)
G = 454                     #Grams in a pound
B = 1.0/252.0               #Btu in a calorie
C = 1.0/1.8                 #Degree celsius in a degree fahrenheit
 
#Calculation:
Cp = CpM*G*B*C              #Heat capacity in English units (Btu/lb.°F)
 
#Result:
print "Heat capacity in English units is: ",round(Cp,2)," Btu/lb.°F"
Heat capacity in English units is:  0.61  Btu/lb.°F

ILLUSTRATIVE EXAMPLE 3.9, Page number: 29

In [11]:
 
#Variable declaration:
kM = 0.0512                 #Thermal conductivity of methanol (cal/m.s°C)
B = 1.0/252.0               #Btu in a calorie
M = 0.3048                  #Meters in a feet
S = 3600                    #Seconds in an hour
C = 1.0/1.8                 #Degree celsius in a degree fahrenheit
 
#Calculation:
k = kM*B*M*S*C              #Thermal conductivity in English units (Btu/ft.h.°F)
 
#Result:
print "Thermal coductivity in English units is:",round(k,3),"Btu/ft.h.°F"
Thermal coductivity in English units is: 0.124 Btu/ft.h.°F

ILLUSTRATIVE EXAMPLE 3.11, Page number: 31

In [13]:
 
#Variable declaration:
D = 5                       #Diameter of pipe (ft)
V = 10                      #Fluid velocity (ft/s)
p = 50                      #Fluid density (lb/ft^3)
u = 0.65                    #Fluid viscosity (lb/ft.s)
F = 1.0/12.0                #Feet in an inch
VCp = 6.72*10**-4           #Viscosity of centipoise (lb/ft.s)
 
#Calculation:
A = D*V*p*F/u/VCp           #Reynolds Number
 
#Result:
if(A>2100):
    print "The Reynolds number is :",round(A,-2),"; therefore, the flow is turbulent."
elif(A<2100):
     print "The Reynolds number is :",round(A,-2),"; therefore, the flow is not turbulent."
The Reynolds number is : 477000.0 ; therefore, the flow is turbulent.

ILLUSTRATIVE EXAMPLE 3.12, Page number: 32

In [14]:
#Variable declaration:
#For the problem at hand, take as a basis 1 kilogram of water and assume the potential energy to be zero at ground level conditions.
z1 = 0                      #Intial height from ground level (m)
z2 = 10                     #Final height from ground level (m)
PE1 = 0                     #Initial potential energy at z1 (J)
m = 1                       #Mass of water (kg)
g = 9.8                     #Gravitational acceleration (m/s^2)
gc = 1                      #Conversion factor
 
#Calculations:
PE2 = m*(g/gc)*z2           #Final potential energy at z2 (J)
 
#Result:
print "The potential energy of water is :",PE2,"J "
The potential energy of water is : 98.0 J