#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate
T2=15.4+273.2 #K
T1=7.6+273.2 #K
P1=40.0 #mm of Hg
P2=60.0 #mm of Hg
T=42.2+273.2 #K
R=8.314 #J/mol.k
#Calculations and printing :
print(" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
print("let deltaHv/R = S")
S= - (T1*T2* math.log(P2/P1))/(T1-T2)
deltahv=S*R
print '%s %d' %(" \n Latent Heat of Vaporization (J/mol) =",deltahv)
B=math.log(P1) + S/T1
print '%s %.3f' %("\n B=",B)
P=math.exp(-S/T + B)
print '%s %.3f %s %.3f' %("\n P* at",T," K is (mm Hg)= ",P)
raw_input('press enter key to exit')
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate
P=760.0 #mm of Hg
Pstar=289.0 #mm of Hg
#Calculations and printing :
print(" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
y=Pstar/P
print '%s %.3f %s %.3f' %(" \n Molar composition of Water is",y," and Air is",1-y)
raw_input('press enter key to exit')
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate
T=100.0+273.2 #K
PT=5260.0 #mm of Hg
y=0.1 #by volume
basis= 100 #mol of feed gas
#Calculations and printing :
print(" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
P=y*PT
if(P<760):
print("The Vapour is Super heated")
elif(P==760):
print("The vapour is At Dew point")
else:
print("The vapour is not Super heated")
print("From tables Tdp=90 C")
print("Superheat = 100-90=10 C ")
print("Using Raoult law at the outlet")
y1=355/PT
print '%s %.3f' %("y1=",y1)
print("Balance on Dry Air")
n2=basis*(1-y)/(1-y1)
print '%s %.3f' %("n2 (mol) = ",n2)
print("Total mole balance")
n1=basis-n2
print '%s %.3f' %("n1 (mol) = ",n1)
print '%s %.3f' %(" \n Percentage condesation=",n1*100/(y*basis))
Psaturation=760/y
print '%s %.3f %s' %("\n Any increase in pressure above", Psaturation," mm of Hg must cause condensation ")
print(" \n For the next part of the problem use the same code by modifying PT to be 8500 mm of Hg")
raw_input('press enter key to exit')
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate
T=75.0 +273 #K
P75=289.0 #mm of Hg
hr=0.3
Porig=825.0 #mm of Hg
PorigBar=1.1 #bar
Vdot=1000.0 #M^3/h
R=0.0831
#Calculations and printing :
print (" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
P=hr*P75
y=P/Porig
ndot=PorigBar*Vdot/(R*T)
ndotWater=ndot*y
print '%s %.3f' %(" \n Molar flowrate of Water (Kmol/h) = ",ndotWater)
ndotBDA=ndot*(1-y)
print '%s %.3f' %(" \n Molar flowrate of Dry Air (Kmol/h) = ",ndotBDA)
ndotO2=ndotBDA*0.21
print '%s %.3f' %(" \n Molar flowrate of Oxygen (Kmol/h) = ",ndotO2)
hm=P/(Porig-P)
ha=hm*18/29
hmdot=P75/(Porig-P75)
hp=100*hm/hmdot
print '%s %.3f' %(" \n Molal Humidity (mol water/mol BDA) = ",hm)
print '%s %.3f' %(" \n Absolute Humidity (kg water/kg BDA) = ",ha)
print '%s %.3f' %(" \n Percentage Humidity=",hp)
print("\n From table B.3, Tdp=48.7 C")
raw_input('press enter key to exit')
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate
basis=100.0 #lb-mole/h
x=0.45
PH2O=31.6 #mm of Hg
PSO2=176.0 #mm of Hg
P=760.0 #mm of Hg
y=2.0
M1=64.0
M2=18.0
#Calculations and printing :
print(" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
yH2O=PH2O/P
ySO2=PSO2/P
yAir=1-yH2O-ySO2
print("Using Air balance, ")
nG2=(1-x)*basis/yAir
print '%s %.3f' %("nG2 (lbm/h) = ",nG2)
xSO2=y/102
xH2O=1-xSO2
print("Using SO2 balance, ")
nL2=(basis*x-nG2*ySO2)*M1/(xSO2)
print '%s %.3f' %("nL2 (lbm/h) = ",nL2)
print("Using H2O balance, ")
nL1=nG2*yH2O*M2 + nL2*xH2O
print '%s %.3f' %("nL1 (lbm H2O/h) = ",nL1)
SO2Absorbed=nL2*xSO2
SO2Fed=basis*x*M1
Fraction=SO2Absorbed/SO2Fed
print '%s %.3f' %(" \n Fraction SO2 absorbed (lbm SO2 absorbed/lbm SO2 fed) = ",Fraction)
raw_input('press enter key to exit')
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate
basis=100.0 #lb-mole/h
x=0.45
PH2O=31.6 #mm of Hg
PSO2=176.0 #mm of Hg
P=760.0 #mm of Hg
y=2.0
M1=64.0
M2=18.0
#Calculations and printing :
print(" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
yH2O=PH2O/P
ySO2=PSO2/P
yAir=1-yH2O-ySO2
print("Using Air balance, ")
nG2=(1-x)*basis/yAir
print '%s %.3f' %("nG2 (lbm/h) = ",nG2)
xSO2=y/102
xH2O=1-xSO2
print("Using SO2 balance, ")
nL2=(basis*x-nG2*ySO2)*M1/(xSO2)
print '%s %.3f' %("nL2 (lbm/h) = ",nL2)
print("Using H2O balance, ")
nL1=nG2*yH2O*M2 + nL2*xH2O
print '%s %.3f' %("nL1 (lbm H2O/h) = ",nL1)
SO2Absorbed=nL2*xSO2
SO2Fed=basis*x*M1
Fraction=SO2Absorbed/SO2Fed
print '%s %.3f' %(" \n Fraction SO2 absorbed (lbm SO2 absorbed/lbm SO2 fed) = ",Fraction)
raw_input('press enter key to exit')
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate
basis=150.0 #kg feed
S100=0.905 #g AgNO3/g
S20=0.689 #g AgNO3/g
inputx=0.095 #kg water/kg
outputx=0.311 #kg water/kg
#Calculations and printing :
print(" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
print("\n Composition of Filter cake,")
print("\n m2=4m3")
print("\n Water balance around the crystallizer,")
print '%s' %("\n basis*inputx* kg H2O = outputx m1 + outputx m1 \n")
print("Mass balance around crystallizer, \n")
print '%d %s' %(basis,"=m1+m2+m3")
A=([[0, 1, -4],[outputx, 0, outputx],[1, 1, 1]])
b=([[0],[basis*inputx],[basis]])
C=numpy.dot(linalg.inv(A),b)
#Here we solved two linear equations simultaneously
m1=C[0,0]
print '%s %.2f' %(" \n m1 (Kg) = ",m1)
m2=C[1,0]
print '%s %d' %(" \n m2 (Kg) = ",m2)
m3=C[2,0]
print '%s %d' %(" \n m3 (Kg) = ",m3)
print("\n Overall AgNO3 balance,")
m5=(1-inputx)*basis - (1-outputx)*m1
print '%s %d' %("\n m5 (kg AgNO3 crystals recovered) = ",m5)
percentage=m5*100/(basis*(1-inputx))
print '%s %.3f' %(" \n Percentage recovery=",percentage)
print("\n Overall mass balance")
m4=basis-m1-m5
print '%s %d' %("\n m4 (Kg water removed in the Dryer) = ",m4)
raw_input('press enter key to exit')
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate
inputx=0.6
basis=100.0 #kg Feed
S=63.0 #Kg KNO3/100 Kg H2O
#Calculations and printing :
print(" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
outputx=S/(S+100)
print '%s %.3f' %("x (Kg KNO3/Kg) = ",outputx)
print("Water balance")
m1=basis*(1-inputx)/(1-outputx)
print '%s %.3f' %(" \n m1 (Kg) = ",m1)
print("Mass balance")
m2=basis-m1
print '%s %.3f' %(" \n m2 (kg) = ",m2)
percentage=m2*100/(basis*inputx)
print '%s %.3f' %(" \n Percentage of KNO3 in the feed that crystallizes is ",percentage)
raw_input('press enter key to exit')
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate
basis=1.0 #Tonne Epsom salt produced/h
inputx=0.301 #Tonne MgSO4/tonne
outputx=0.232 #Tonne MgSO4/tonne
M=120.4
M1=246.4
#Calculations and printing :
print(" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
print("Total mass balance")
print("m1=1+m2")
print("MgSO4 balance")
print(" \n inputx m1 = bassis* M/ M1 + m2 outputx")
A=([[1, -1],[inputx, -outputx]])
b=([[1],[basis*M/M1]])
C=numpy.dot(linalg.inv(A),b)
#Here we solved two linear equations simultaneously
m1=C[0,0]
m2=C[1,0]
print '%s %.3f' %(" \n m1 (Tonne/h) = ",m1)
print '%s %.3f' %(" \n m2 (Tonne/h) = ",m2)
raw_input('press enter key to exit')
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate
m1=5.0 #g of solute
m2=100.0 #g of Water
P=1.0 #atm
Tf=100.421 #C
Ti=25.0 #C
R=8.314 #J/mol.K
#Calculations and printing :
print(" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
x=(Tf-100.)*40656./(R*373.16*373.16)
y=m2/18.016
Ms=m1*(1-x)/(y*x)
print '%s %.3f' %(" \n Ms (g/mol) =",Ms)
deltaTm=R*273.16*273.16*x/6009.5
Tms=0-deltaTm
print '%s %.3f' %(" \n Tms (C)=",Tms)
Pstar=(1-x)*23.756
print '%s %.3f' %(" \n Solvent Vapour pressure (mm Hg) = ",Pstar)
raw_input('press enter key to exit')
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate
V1=200.0 #CC Acetone
x=0.1 #Wt acetone
V2=400.0 #CC chloroform
DA=0.792 #g/cc
DC=1.489 #g/cc
DW=1.0 #g/cc
#Calculations and printing :
print(" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
Dbar=DA*DW/(x*DW + (1-x)*DA)
mass1=V1*Dbar
mass2=V2*DC
print("C balance")
m4=mass2
print '%s %.3f' %(" \n m4=",m4)
print("W balance")
m2=(1-x)*mass1
print '%s %.3f' %(" \n m2=",m2)
print("A balance")
print("m1+m3=x * mass1")
print("Distribution Cooefficient ,K=m3*(m1+m2)/m1*(m3+m4)")
print("On solving, ")
m1=2.7
m3=16.8
percentage=m3*100/(x*mass1)
print '%s %.3f' %(" \n m1=",m1)
print '%s %.3f' %(" \n m3=",m3)
print '%s %.3f' %(" \n percentage of acetone transferred to chloroform=",percentage)
raw_input('press enter key to exit')
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate
basis=1000.0 #Kg of solution
inputxA=0.3 #Wt. fraction of acetone
outputxA1=0.05
outputxM1=0.02
outputxA2=0.1
outputxM2=0.87
#Calculations and printing :
print(" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
print("Mass balance")
print("ms + basis = mE + mR")
print("acetone balance")
print("inputxA *basis = outputxA2 *mE + outputxA1* mR")
print("Water balance")
print(" \n 1-inputxA *basis = 1-outputxA2-outputxM2 *mE + 1-outputxA1-outputxM1* mR")
A=([[1, 1, -1],[outputxA2, outputxA1, 0],[1-outputxA2-outputxM2, 1-outputxA1-outputxM1, 0]])
b=([[basis],[inputxA*basis],[(1-inputxA)*basis]])
C=numpy.dot(linalg.inv(A),b)
#Here We solved three linear equations simultaneously
mE=C[0,0]
mR=C[1,0]
mS=C[2,0]
print '%s %.3f' %(" \n mE (Kg) = ",mE)
print '%s %.3f' %(" \n mR (Kg) = ",mR)
print '%s %.3f' %(" \n mS (Kg MIBK) = ",mS)
raw_input('press enter key to exit')
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate
V=50.0 #L
P=1.0 #atm
T=34.0+273.2 #K
y=0.3
xF=0.001
R=0.08206
Pstar=169.0 #mm of Hg
Pmm=760.0 #mm of Hg
#Calculations and printing :
print(" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
n=P*V/(R*T)
print '%s %.3f' %(" \n No.of moles (mol) = ",n)
y0=y*Pstar/Pmm
print '%s %.3f' %(" \n Y0= (mol CCl4/mol) = ",y0)
Pfinal=xF*Pmm
b=0.096*Pfinal
Xstar=0.794*b/(1+b)
print '%s %.3f' %(" \n Mass of CCl4 adsorbed to Carbon at equilibrium (g CCl4 ads/g C) = ",Xstar)
Mads=(y0*n- xF*n)*154
print '%s %.3f' %(" \n Mass of CCl4 adsorbed (g) = ",Mads)
Mc=Mads/Xstar
print '%s %.3f' %(" \n Mass of carbon Required (g) = ",Mc)
raw_input('press enter key to exit')