# Chapter 3: Processes and Process Variables¶

## Example 3.1-1, page no. 44¶

In [1]:
#Initialization of variables
import math
import numpy
from numpy import linalg

mass=215.0 #kg

#Calculations and printing :

density=13.546*62.43
print '%s %.2f' %("density of mercury (lbm/ft^3) = ",density)
#the multiplication factor is to convert density from gm/cc to lbm/ft^3.
volume=mass/(.454*density)     #ft^3
#the division by 0.454 is to convert mass in kg to lbm.
print '%s %.2f %s %.2f' %(" \n The volume of ",mass,"kg of mercury is(ft^3) = ",volume)
raw_input('press enter key to exit')

density of mercury (lbm/ft^3) =  845.68

The volume of  215.00 kg of mercury is(ft^3) =  0.56
press enter key to exit

Out[1]:
''

## Example 3.1-2, page no. 45¶

In [2]:
#Initialization of variables
import math
import numpy
from numpy import linalg

T1=20.0                 # ˚C
T2=100.0                # ˚C
Vat20=0.560             #ft^3
D=0.0208333             #ft

#Calculations and printing :

print("we know that V(T)=Vo[1+0.math.pow(18182x10,()-3)xT +0.math.pow(0078x10,()-6)xTxT]")
Vat0=Vat20/(1+0.18182*math.pow(10,-3)*T1 +0.0078*math.pow(10,-6)*T1*T1)
#the function is defined with the variable as temperature
def volume(T):
volume=Vat0*(1+0.18182* math.pow(10,-3) *T +0.0078* math.pow(10,-6) *T*T)
return volume

print '%s %.3f' %(" vat20 (ft^3) = ",volume(T1))
print '%s %.3f' %(" \n vat100 (ft^3) =",volume(T2))
change=((volume(T2))-(volume(T1)))*4/(math.pi*D*D)
print '%s %.3f' %(" \n change in the height of mercury level (ft) = ",change)
#the answer is a bit different due to rounding off of volume(T2) in textbook
raw_input('press enter key to exit')

we know that V(T)=Vo[1+0.math.pow(18182x10,()-3)xT +0.math.pow(0078x10,()-6)xTxT]
vat20 (ft^3) =  0.560

vat100 (ft^3) = 0.568

change in the height of mercury level (ft) =  23.931
press enter key to exit

Out[2]:
''

## Example 3.3-1, page no. 48¶

In [3]:
#Initialization of variables
import math
import numpy
from numpy import linalg

mass=100.0 #g of CO2
M=44.01  #molecular weight

#Calculations and print '%s %.3f' %ing :

moles=mass/M
print '%s %.3f' %("\n no.of moles=",moles)
lbmole=moles/453.6
print '%s %.3f' %("\n no.of lb moles=",lbmole)
Cmoles=moles
print '%s %.3f' %("\n no.of moles of carbon=",Cmoles)
Omoles=2*moles
print '%s %.3f' %("\n no.of moles of oxygen=",Omoles)
O2moles=moles
print '%s %.3f' %("\n no.of moles of dioxygen=",O2moles)
gramsO=Omoles*16
print '%s %.3f' %("\n no.of grams of oxygen=",gramsO)
gramsO2=O2moles*32
print '%s %.3f' %("\n no.of grams of oxygen=",gramsO2)
moleculesCO2=moles*6.02*math.pow(10,(23))
print '%s %.3E' %("\n no.of molecules of CO2 =",moleculesCO2)
raw_input('press enter key to exit')

 no.of moles= 2.272

no.of lb moles= 0.005

no.of moles of carbon= 2.272

no.of moles of oxygen= 4.544

no.of moles of dioxygen= 2.272

no.of grams of oxygen= 72.711

no.of grams of oxygen= 72.711

no.of molecules of CO2 = 1.368E+24
press enter key to exit

Out[3]:
''

## Example 3.3-2, page no. 50¶

In [4]:
#Initialization of variables
import math
import numpy
from numpy import linalg

xA=0.15 #mass fraction
yB=0.20 #mole fraction
mass=175.0 #kg of solution
flowrate1=53.0 #lbm/h
flowrate2=1000.0 #mol/min
massofA=300.0 #lbm
molarB=28.0 #kmolB/s

#Calculations and printing :

massA=mass*xA
print '%s %d %s %.3f'%(" \n Mass of A in",mass," kg of solution (kg A) =",massA)
flowrateA=flowrate1*xA
print '%s %d %s %.3f'%(" \n Mass flow rate of A in a stream flowing at",flowrate1," lbm/h (lbm A/h)=",flowrateA )
flowrateB=flowrate2*yB
print '%s %d %s %.3f'%(" \n Molar flowrate of B in a stream flowing at",flowrate2," mol/min (molB/min)= ",flowrateB)
Totalflowrate=molarB/yB
print '%s %d %s %.3f'%(" \n Total flow rate of a solution with",molarB,"kmolB/s=",Totalflowrate)
MassSolution=massofA/xA
print '%s %d %s %.3f'%(" \n Mass of solution that contains",massofA," lbm of A =",MassSolution)
raw_input('press enter key to exit')


Mass of A in 175  kg of solution (kg A) = 26.250

Mass flow rate of A in a stream flowing at 53  lbm/h (lbm A/h)= 7.950

Molar flowrate of B in a stream flowing at 1000  mol/min (molB/min)=  200.000

Total flow rate of a solution with 28 kmolB/s= 140.000

Mass of solution that contains 300  lbm of A = 2000.000
press enter key to exit

Out[4]:
''

## Example 3.3-3, page no. 50¶

In [5]:
#Initialization of variables
import math
import numpy
from numpy import linalg

#let the total mass be 100
massO2=16.0
massCO=4.0
massCO2=17.0
massN2=63.0
MO2=32.0
MCO=28.0
MCO2=44.0
MN2=28.0

#Calculations and print '%s %.3f' %ing :

molO2=massO2/MO2
molCO=massCO/MCO
molCO2=massCO2/MCO2
molN2=massN2/MN2
TotalMol=molO2+molCO+molCO2+molN2
print '%s %.3f' %(" \n molefraction of O2=",molO2/TotalMol)
print '%s %.3f' %(" \n molefraction of CO=",molCO/TotalMol)
print '%s %.3f' %(" \n molefraction of CO2=",molCO2/TotalMol)
print '%s %.3f' %(" \n molefraction of N2=",molN2/TotalMol)
raw_input('press enter key to exit')


molefraction of O2= 0.152

molefraction of CO= 0.044

molefraction of CO2= 0.118

molefraction of N2= 0.686
press enter key to exit

Out[5]:
''

## Example 3.3-4, page no. 51¶

In [6]:
#Initialization of variables
import math
import numpy
from numpy import linalg

yN2=0.79
MN2=28.0                            #g/mol
MO2=32.0                            g/mol
xN2=0.767

#Calculations and printing :

Mbar=yN2*MN2+(1-yN2)*MO2
print '%s %.3f' %(" \n average molecular weight of air from molar composition (g/mol) = ",Mbar)
InvMbar=xN2/28 + (1-xN2)/32
print '%s %.3f' %(" \n average molecular weight of air from mass composition (g/mol) = ",1./InvMbar)
raw_input('press enter key to exit')


average molecular weight of air from molar composition (g/mol) =  28.840

average molecular weight of air from mass composition (g/mol) =  28.840
press enter key to exit

Out[6]:
''

## Example 3.3-5, page no. 52¶

In [8]:
#Initialization of variables
import math
import numpy
from numpy import linalg

conc=0.5 #molar
rate=1.25 #m^3/min
D=1.03 #no units
M=98.0

#Calculations and print '%s %.3f' %ing :

mass_conc=conc*98.
print '%s %.3f' %("mass concentration of sulfuric acid (kg/m^3) = ",mass_conc)
mass_flowrate=rate*mass_conc/60.
print '%s %.3f' %(" \n Mass flow rate of sulfuric acid (kg/s) = ",mass_flowrate)
massfraction=1/(rate*D*1000/60)
print '%s %.3f' %(" \n Mass fraction of sulfuric acid=",massfraction)
raw_input('press enter key to exit')

mass concentration of sulfuric acid (kg/m^3) =  49.000

Mass flow rate of sulfuric acid (kg/s) =  1.021

Mass fraction of sulfuric acid= 0.047
press enter key to exit

Out[8]:
''

## Example 3.4-1, page no. 55¶

In [9]:
#Initialization of variables
import math
import numpy
from numpy import linalg

Pressure=2.00*100000. #Pa

#Calculations and printing :

Pressure=Pressure*1000./(13600.*9.807)
print '%s %.3E' %("Pressure (mm of Hg) = ",Pressure)
raw_input('press enter key to exit')

Pressure (mm of Hg) =  1.500E+03
press enter key to exit

Out[9]:
''

## Example 3.4-2, page no. 55¶

In [12]:
#Initialization of variables
import math
import numpy
from numpy import linalg

P0=10.4*1.013*100000. /10.33            #m H2O
D=1000.0                                #kg/m^3
g=9.807                                 #m/s^2
h=30.0                                  #m

#Calculations and printing :

Ph=P0+D*g*h
print '%s %.3E' %("Pressure at the bottom of the lake (N/m^2) = ",Ph)
raw_input('press enter key to exit')

Pressure at the bottom of the lake (N/m^2) =  3.962E+05
press enter key to exit

Out[12]:
''

## Example 3.4-3, page no. 59¶

In [13]:
#Initilization of variables
import math
spg=1.05
h1=382. #mm of fluid
h2=374. #mm of fluid
reading= -2 #in of Hg
Patm=30. #in of Hg
#Calculations and printing:
deltaP=(spg-1)*980.7*(h1-h2)/10.
print '%s %.1f' %("Pressure drop between points 1 and 2 (dynes/cm^2) = ",deltaP)
P1=Patm+reading
print '%s %.1f' %("\n Absolute Pressure (in Hg) = ",P1)
raw_input("Press the Enter key to quit")

Pressure drop between points 1 and 2 (dynes/cm^2) =  39.2

Absolute Pressure (in Hg) =  28.0
Press the Enter key to quit

Out[13]:
''

## Example 3.5-2, page no. 62¶

In [14]:
#Initialization of variables
import math
import numpy
from numpy import linalg

T1=20.0 #F
T2=80.0 #F

#Calculations and printing :

#In this code I used a function to achieve the conversion
def conversion(fahrenheit):
conversion=(fahrenheit-32)/1.8
return conversion;

difference=conversion(T2)-conversion(T1)
print '%s %.2f %s %.2f' %("Equivalent temperature of",T2-T1," temperature in C =",difference)
deltaTF=T2-T1
deltaTC=deltaTF/1.8
print '%s %.2f' %(" \n By second method, result=",deltaTC)
raw_input('press enter key to exit')

Equivalent temperature of 60.00  temperature in C = 33.33

By second method, result= 33.33
press enter key to exit

Out[14]:
''

## Example 3.5-3, page no. 63¶

In [15]:
#Initilization of variables
import math
a=0.487
b=2.29*math.pow(10, -4)
print '%s %.2f %s %.1E %s' %("Given Cp(Btu/lbm.F) = ",a,"+",b,"T (F)")
print("\n Step 1")
af1=a+b*32
bf1=b*1.8
print("\n Step 2")
af2=af1*1.8/(454*9.486*math.pow(10, -4))
bf2=bf1*1.8/(454*9.486*math.pow(10, -4))
print '%s %.2f %s %.1E %s' %("Final Cp(J/g.C) = ",af2,"+",bf2,"T (C)")
raw_input("Press the Enter key to quit")

Given Cp(Btu/lbm.F) =  0.49 + 2.3E-04 T (F)

Step 1

Step 2
Final Cp(J/g.C) =  2.07 + 1.7E-03 T (C)
Press the Enter key to quit

Out[15]:
''