import math
# Variables
#for Benzene
Mb = 1000. #Kg, mass of benzene
T1 = 75. #C initial temp. of benzene
T2 = 50. #C final temp. of benzene
Cp1 = 1.88 #Kj/Kg C. specific heat of benzene
mu1 = 0.37 #cP. vismath.cosity of benzene
rho1 = 860. #kg/m**3, density
k1 = 0.154 #W/m K. thermal conductivity
#for water
Tav = 35. #C av, temp.
Cp2 = 4.187 #specific heat
mu2 = 0.8 #cP. vismath.cosity
k2 = 0.623 #W/m K. thermal conductivity
T3 = 30. #C. initial temp.
T4 = 40. #C final temp.
#Calculation and Results
#(a)
HD = Mb*Cp1*(T1-T2) #Kj/h, heat duty
WR = HD/(Cp2*(T4-T3)) #kg/h Water rate
print "the heat duty of the exchanger is %.0f kj/h"%(HD)
print "the water flow rate is %d kg/h"%(WR)
#(b)
#tube side (water) calculations
# Variables
di1 = 21. #mm, inner diameter of inner tube
do1 = 25.4 #mm, outer dia. of inner tube
t = 2.2 #mm/ wall thickness
kw = 74.5 #W/m K. thermal conductivity of the wall
di2 = 41. #mm, inner diameter of outer pipe
do2 = 48. #mm, outer diameter of outer pipe
FA1 = (math.pi/4)*(di1*10**-3)**2 #m**2, flow area
FR1 = WR/1000.
v1 = FR1/(FA1*3600) #m/s, velocity
Re1 = (di1*10**-3)*v1*1000/(mu2*10**-3) #Reynold no.
Pr1 = Cp2*1000*(mu2*10**-3)/k2 #Prandtl no.
#umath.sing dittus boelter eq.
Nu1 = 0.023*(Re1)**(0.8)*(Pr1)**(0.3) #nusslet no.
h1 = round(Nu1*k2/(di1*10**-3),-1) #W/m**2 C, heat transfer coefficient
#Outer side (benzene) calculation
FA2 = (math.pi/4)*(di2*10**-3)**2-(math.pi/4)*(do1*10**-3)**2 #flow area
wp = math.pi*(di2*10**-3+do1*10**-3) #wettwd perimeter
dh = 4*FA2/wp #hydrolic diameter
bfr = Mb/rho1 #m**3/h benzene flow rate
v2 = bfr/(FA2*3600) #m/s, velocity
Re2 = dh*v2*rho1/(mu1*10**-3) #Reynold no
Pr2 = Cp1*10**3*(mu1*10**-3)/k1 #Prandtl no.
Nu2 = 0.023*(Re2)**(0.8)*(Pr2)**(0.4) #nusslet no.
h2 = Nu2*k1/(dh) #W/m**2 C, heat transfer coefficient
print "heat transfer coefficient based on inside area is %.0f W/m**2 C "%(h1)
print "heat transfer coefficient based on outside area is %.1f W/m**2 C "%(h2)
#Calculation of clean overall heat transfer coefficient, outside area basis
#from eq. 8.28
# Variables
l = 1. #assume , length
Ao = math.pi*do1*10**-3*l
Ai = math.pi*di1*10**-3*l
Am = (do1*10**-3-di1*10**-3)*math.pi*l/(math.log(do1*10**-3/(di1*10**-3)))
#overall heat transfer coefficient
Uo = 1/((1/h2)+(Ao/Am)*((do1*10**-3-di1*10**-3)/(2*kw))+(Ao/Ai)*(1/h1))
Ui = Uo*Ao/Ai
#Calculation of LMTD
dt1 = T1-T4
dt2 = T2-T3
LMTD = (dt1-dt2)/math.log(dt1/dt2) #math.log mean temp. difference correction factor
Q = HD*1000/3600 #W, heat required
Ao_ = Q/(Uo*LMTD) #m**@, required area
len = Ao_/(math.pi*do1*10**(-3)) #m, tube length necessary
#(c)
la = 15. #m ,actual length
Aht = (math.pi*do1*10**(-3)*la)
Udo = Q/(Aht*LMTD) #W/m**2 C, overall heat transfer coefficient with dirt factor
#from eq. 8.2
Rdo = (1/Udo)-(1/Uo) #m**2 C/W
print "overall heat transfer coefficient outside area basis is %.1f W/m**2 C "%(Uo)
print "overall heat transfer coefficient inside area basis is %.1f W/m**2 C "%(Ui)
print "The fouling factor is %f m**2 C/W"%(Rdo)
# note : rounding off error. please check.
import math
# Variables
Cp = 50. #tpd, plant capacity
T1 = 135. #C, Temp.
T2 = 40. #C temp.
T3 = 30. #C temp.
dt1 = (T1-T2) #C hot end temp.
dt2 = (T2-T3) #C cold end temp.
#Properties of ethylbenzene
rho1 = 840. #kg/m**3, density
cp1 = 2.093 #kj/kg K , specific heat
T = 87.5 #C
mu1 = math.exp(-6.106+1353/(T+273)+5.112*10**-3*(T+273)-4.552*10**-6*((T+273)**2))
k1 = 0.2142-(3.44*10**-4)*(T+273)+(1.947*10**-7)*(T+273)**2
k1_ = k1*0.86 #kcal/h m K
#properties of water
rho2 = 993. #kg/m**3, density
mu2 = 8*10.**-4 #kg/m s , vismath.cosity
cp2 = 4.175 #kj/kg K , specific heat
k2 = 0.623 #W/m K, thermal conductivity
k2_ = k2*0.8603 #kcal/h m**2 K
#Calculation
#(i) Energy balance
Cp = Cp*1000./24 #kg/h, plant capacity
Cp = 2083. #approx.
HD = Cp*cp1*dt1 #kj/h, Heat duty
HD_ = HD*0.238837 #kcal/h
wfr = HD/(cp2*dt2)
#(ii)
mu1 = mu1 #cP, vismath.cosity of ethylbenzene
k1 = k1 #W/m K, thermal conductivity of ethylbenzene
#(iii)
#LMTD calculation
LMTD = (dt1-dt2)/math.log(dt1/dt2)
#assume
Udo = 350. #kcal/h m**2 C, overall coefficient
A = HD_/(Udo*LMTD) #m**2, area required
#(iv)
id_ = 15.7 #mm, internal diameter of tube
od = 19. #mm, outer diameter of tube
l = 3000. #mm, length
OSA = math.pi*(od*10**-3)*(l*10**-3) #m**2. outer surface area
n = A/OSA #no. of tubes required
fa = n*(math.pi/4)*(id_*10**-3)**2 #m**2, flow arae
lv = (wfr/1000)/(3600*fa) #m/s, linear velocity
#(v)
n1 = 44. #total no. of tubes that can be accomodated in a 10 inch shell
np = 11. #no. of tubes in each pass
#(vi)
bf = 0.15 #m, baffel spacing
#(vii)
#estimation of heat transfer coefficient
#Tube side (water)
fa1 = (math.pi/4)*(id_*10**-3)**2*np #m**2, flow area
v1 = (wfr/1000.)/(3600*fa1) #m/s, velocity
Re = (id_*10**-3)*v1*rho2/mu2 #Reynold no.
#from fig . 8.11(a)
jh = 85. #colburn factor
#jh = (hi*di)/k*(cp*mu/k)**-1/3
#assume, (cp*mu/k) = x
hi = jh*(k2_/(id_*10**-3))*(cp2*1000*mu2/k2)**(1/3) #kcal/h m**2 C
#shell side(organic)
B = bf #m, baffel spacing
p = 0.0254 #m,radius of 1 tube
Ds = 0.254 #m, inside diameter of shell
c = 0.0064
#from eq. 8.32
As = c*B*Ds/p #m**2, flow area
Gs = Cp/As #kg/m**2 h, mass flow rate of shell fluid
do = od/10 #cm, outside diameter of shell
#from eq. 8.31
Dh = 4*((0.5*p*100)*(0.86*p*100)-((math.pi*(do)**2)/8))/((math.pi*do)/2)
Dh_ = Dh*10**-2 #m, hydrolic diameter
Re1 = (Dh_*Gs)/(3600*(mu1*10**-3)) #Reynold no.
#from fig 8.11(b)
jh1 = 32 #colburn factor
ho = jh1*(k1_/Dh_)*((6)**(1./3))
#from eq. 8.28
ratio = od/id_ #ratio = Ao/Ai
Rdo = 0.21*10**-3 #outside dirt factor
Rdi = 0.35*10**-3 #inside dirt factor
Udo = 1/((1/ho)+Rdo+(ratio)*Rdi+(ratio)*(1/hi))
#SECOND TRIAL
#estimation of heat transfer coefficient
#Tube side (water)
np1 = 12 #
fa2 = (math.pi/4)*(id_*10**-3)**2*np1 #m**2, flow area
v2 = (wfr/1000)/(3600*fa2) #m/s, velocity
Re2 = (id_*10**-3)*v2*rho2/mu2 #Reynold no.
#from fig . 8.11(a)
jht = 83. #colburn factor
#jh = (hi*di)/k*(cp*mu/k)**-1/3
#assume, (cp*mu/k) = x
hit = jht*(k2_/(id_*10**-3))*(cp2*1000*mu2/k2)**(1./3) #kcal/h m**2 C
#shell side
B2 = 0.1 #m, baffel spacing
p2 = 0.0254 #m,radius of 1 tube
Ds2 = 0.254 #m, inside diameter of shell
c2 = .0064
#from eq. 8.32
As2 = c2*B2*Ds2/p2 #m**2, flow area
Gs2 = Cp/As2 #kg/m**2 h, mass flow rate of shell fluid
do2 = od/10 #cm, outside diameter of shell
#from eq. 8.30
Dh2 = 4*((p2*100)**2-((math.pi*(do2)**2)/4))/((math.pi*do2))
Dh2_ = Dh2*10**-2 #m, hydrolic diameter
Re2 = (Dh2_*Gs2)/(3600*(mu1*10**-3))
#from fig 8.11(b)
jh2 = 48 #colburn factor
ho2 = jh2*(k1_/Dh2_)*((6)**(1./3))
#from eq. 8.28
ratio = od/id_ #ratio = Ao/Ai
Rdo2 = 0.21*10**-3 #outside dirt factor
Rdi2 = 0.35*10**-3 #inside dirt factor
Udo2 = 1/((1/ho2)+Rdo+(ratio)*Rdi+(ratio)*(1/hit))
#from eq. 8.10(a)
tauc = (T2-T3)/(T1-T3) #Temprature ratio
R = (T1-T2)/(T2-T3) #Temprature ratio
Ft = 0.8 #LMTD correction ftor
Areq = HD_/(Udo2*Ft*LMTD) #area required
tubes = 48. #no. of tubes
lnt = 4.5 #length of 1 tube
Aavl = (math.pi*od*10**-3)*tubes*lnt #available area
excA = ((Aavl-Areq)/Areq)*100 #% excess area
#Pressure drop calculation
#Tube side
#from eq. 8.33
Gt = wfr/(3600*fa2) #kg/m**2 s, mass flow rate of tube fluid
n2 = 4. #tube passes
fit = 1. #dimensionless vismath.cosity ratio
g = 9.8 #gravitational consmath.tant
f = 0.0037 #friction factor
dpt = f*Gt**2*lnt*n2/(2*g*rho2*id_*10**-3*fit) #kg/m**2, tube side pressure drop
#eq.8.35
dpr = 4*n2*v2**2*rho2/(2*g) #kg/m**2, return tube pressure loss
dpr_ = dpr*9.801 #N/m**2
tpr = dpt+dpr #kg/m**2, total pressure drop
#shell side
fs = 0.052 #friction factor for shell
bf1 = 0.1 #m, baffel spacing
Nb = lnt/bf1-1 #no. of baffles
dps = fs*(Gs2/3600)**2*Ds*(Nb+1)/(2*g*rho1*Dh2_*fit) #kg/m**2, shell side pressure drop
dps_ = dps*9.81 #N/m**2, shell side pressure drop
print "Tube side Pressure drop is %1.3e N/m**2 "%(dpr_)
print "Shell side Pressure drop is %.0f N/m**2 "%(round(dps_,-1))
# note : rounding off error.
import math
# Variables
#for hot stream
Wh = 10000. #kg/h, Rate of leaving a hydrolic system by the oil
Cph = 0.454 #Kcal/Kg C, specific heat of oil
Th1 = 85. #C initial temp. of oil
Th2 = 50. #C final temp. of oil
#For cold stream
Cpc = 1. #Kcal/Kg C, specific heat of water
Tc2 = 30. #C final temp. of water
Tc1 = 38. #C initial temp. of water
# Calculations
#from heat balance eq.
#kg/h, Rate of leaving a hydrolic system by the water
Wc = Wh*Cph*(Th1-Th2)/(Cpc*(Tc1-Tc2))
#For the hot stream
Cmin = Wh*Cph #Kcal/h C.Taking hot stream as min. stream
#For cold stream
Cmax = Wc*Cpc #Kcal/h C.Taking cold stream as max. stream
Cr = Cmin/Cmax #Capacity ratio
n = (Th1-Th2)/(Th1-Tc2) #effectiveness factor
#From eq. 8.57
#No. of transfer units
NTU = -(1+(Cr)**2)**-(1./2)*math.log(((2/n)-(1+Cr)-(1+(Cr)**2)**(1./2))/((2./n)-(1+Cr)+(1+(Cr)**2)**(1./2)))
Ud = 400. #kcal/h m**2C , overall dirty heat transfer coefficient
#from eq. 8.53
A = (NTU*Cmin)/Ud #Area required
#if the water rate is increased by 20 %,
a = 20.
Wc_ = Wc+(Wc*(a/100))
Cmax_ = Wc_*Cpc
Cr_ = Cmin/Cmax_
#From eq. 8.56
n_ = 2*((1+Cr_)+(1+(Cr_)**2)**(1./2)*(1+math.exp(-(1+(Cr_)**2)**(1./2)*NTU))/(1-math.exp(-(1+(Cr_)**2)**(1./2)*NTU)))**(-1)
Th2_ = Th1-(n_*(Th1-Tc2))
q1 = Wh*Cph*(Th1-Th2) #kcal/h previous rate of heat transfer
q2 = Wh*Cph*(Th1-Th2_) #kcal/h new rate of heat transfer
#increase in rate of heat transfer
dq = (q2-q1)/q1
# Results
print "Th2 = %.1f C"%Th2_
print "The new rate of heat transfer : %d kcal/h"%q2
print "the heat teansfer rate will be affected by %.1f percent "%(dq*100 )
# note : rounding off error would be there.
import math
# Variables
p = 0.0795 #m. pitch of the coil
d1 = 0.0525 #m,coil diameter
h = 1.464 #m,height of the limpetted section
d2 = 1.5 #m,diameter of batch polymerization reactor
d3 = 0.5 #m,diameter of agitator
rpm = 150. #speed of agitator
rho = 850. #kg/m3,density of monomer
rho1 = 900. #kg/m3,density of fluid
mu = 0.7*10**-3 #poise, vismath.cosity of monomer
mu1 = 4*10.**-3 #poise, vismath.cosity of fluid
cp = 0.45 #kcal/kg C, specific heat of monomer
cp1 = 0.5 #kcal/kg C, specific heat of fluid
k = 0.15 #kcal/h mC, thermal conductivity of monomer
k1 = 0.28 #kcal/h mC, thermal conductivity of fluid
Rdi = 0.0002 #h m2 C/kcal, fouling factor for vessel
Rdc = 0.0002 #h m2 C/kcal, fouling factor for coil
Tci = 120. #C, initial temp. of coil liquid
Tvi = 25. #C, initial temp. of vessel liquid
Tvf = 80. #C, final temp. of vessel liquid
#calculation
a = math.pi*d2*h #outside area of the vessel
x = 60. #%. added of the unwetted area to the wetted area
ao = ((d1+(x/100)*(p-d1))/p)*a #m**2,effective outside heat transfer area of vessel
ai = 6.9 #m**2,inside heat transfer area of vessel
#same as outside area , if thickness is very small
#vessel side heat transfer coefficient
Re = (d3**2*(rpm/60)*rho)/mu #reynold no.
Pr = ((cp*3600)*(mu))/k
#from eq. 8.66
y = 1 #x = mu/muw = 1
Nu = 0.74*(Re**(0.67))*(Pr**(0.33))*(y**(0.14)) #Nusslet no
hi = Nu*(k/d2) #heat transfer coefficient
#coil side heat transfer coefficient
v = 1.5 #m/s, linear velocity of fluid
fa = ((math.pi/4)*d1**2) #m2, flow area of coil
fr = v*fa*3600 #m3/h , flow rate of the fluid
Wc = fr*rho #kg/h , flow rate
dh = (4*(math.pi/8)*d1**2)/(d1+(math.pi/2)*d1) #m,hydrolic diameter of limpet coil
Re1 = v*rho1*dh/mu1 #coil reynold no.
Pr1 = cp1*mu1*3600/k1 #prandtl no. of the coil fluid
#from eq. 8.68
d4 = 0.0321 #m, inside diameter of the tube
Nu1 = 0.021*(Re1**(0.85)*Pr1**(0.4)*(d4/d2)**(0.1)*y**0.14)
hc = Nu1*(k1/dh) #coil side coefficient
U = 1/((1/hi)+(ai/(hc*ao))+Rdi+Rdc) #overall heat transfer corfficient
#from eq. 8.63
beeta = math.exp(U*ai/(Wc*cp1))
Wv = 2200. #kg, mass of fluid vessel
t = (beeta/(beeta-1))*((Wv*cp)/(Wc*cp1))*math.log((Tci-Tvi)/(Tci-Tvf))
# Results
print "the time required to heat the charge %.0f min"%(t*60)