import math
D_AB=6.75*10**-5 #in m2/s
Z=0.03 #in m
R=8314
p_A1=5.5*10**4 #in Pa
p_A2=1.5*10**4 #in Pa
T=298 #in K
N_A=D_AB*(p_A1-p_A2)/(R*T*Z);
print "flux = %f kmol/sq m s"%(N_A)
Z=0.02; #in m
p_A2=p_A1-((N_A*R*T*Z)/D_AB);
print "pressure = %f Pa"%(p_A2)
import math
Z=0.15 #in m
P=1.013*10**5 #in Pa
p_A1=1.5*10**4 #in Pa
p_A2=5*10**3 #in Pa
p_B1=P-p_A1;
p_B2=P-p_A2;
D_AB=2.30*10**-5 #in m2/s
R=8314.
T=298. #in K
p_BM=(p_B2-p_B1)/math.log (p_B2/p_B1);
print p_B1, p_B2
N_A=D_AB*(p_A1-p_A2)*P/(R*T*Z*p_BM);
print "flux = %.4e kmol/sq m s"%(N_A)
N_A=D_AB*(p_A1-p_A2)/(R*T*Z);
print "flux = %.4e kmol/sq m s"%(N_A)
import math
M_A=36.5 #molar mass of HCl
M_B=18. #molar masss of water
w_A1=12.; #weight % of HCL
w_A2=4. #weight % of HCL
x_A1=(w_A1/M_A)/((w_A1/M_A)+((100-w_A1)/M_B));
print 'x_A1 =%f'%(x_A1)
x_B1=1.-x_A1;
M1=100./((w_A1/M_A)+((100-w_A1)/M_B));
print "molar mass at point 1 = %f kg/kmol"%(M1)
x_A2=(w_A2/M_A)/((w_A2/M_A)+((100-w_A2)/M_B));
x_B2=1-x_A2;
M2=100/((w_A2/M_A)+((100-w_A2)/M_B)); #avg molecular weight at point 2
print "molar mass at point 2 = %f Kg/kmol"%(M2)
density_1=1060.7; #in kg/m3
density_2=1020.15; #in kg/m3
C_av=((density_1/M1)+(density_2/M2))/2;
print "C_av = %f kmol/cubic m"%(C_av)
x_BM=(x_B2-x_B1)/(math.log (x_B2/x_B1));
Z=0.004 #in m
D_AB=2.5*10**-9;
N_A=(D_AB*C_av*(x_A1-x_A2))/(x_BM*Z);
print "flux = %f kmol/sq m-s"%(N_A)
import math
Gs=700/22.4 #in kmol of dry air/hr
Ls=1500./18 #in kmol of dry air/hr
y1=0.05
Y1=y1/(1-y1);
Y2=0.02*Y1;
X2=0
X1=(Gs/Ls)*(Y1-Y2);
m=Gs*(Y1-Y2);
delta_Y1=Y1-1.68*X1;
delta_Y2=Y2-1.68*X2;
delta_Y=(delta_Y1-delta_Y2)/(math.log (delta_Y1/delta_Y2));
print "driving force = %f kmol acetone/kmol dry air"%(delta_Y)
K_G=0.4 #in kmol acetone/kmol dry air
A=m/(K_G*delta_Y);
print "area = %f sq m"%(A)
import math
G1=(855/22.4)*(106.6/101.3)*(273/299.7);
y1=0.02;
Y1=y1/(1-y1);
Gs=G1*(1-y1);
Y2=0.05*Y1;
x2=0.005;
X2=x2/(1-x2);
Y=0.204;
X1=0.176; #in kmol bgenzene/kmol benzene free oil
Ls_molar=(Gs*(Y1-Y2))/(X1-X2);
Ls=Ls_molar*260;
print "minimum oil circulation rate = %f kg/hr"%(Ls)
import math
P_M = 53.32 #kPa
P_W = 12.33 #in kpA
P = 40 #IN K pA
x = (P - P_W)/(P_M-P_W);
print "liquid phase composition = %f"%(x)
y = P_M*x/P;
print "vapor phase composition = %f"%(y)
import math
from matplotlib.pyplot import *
from numpy import *
%matplotlib inline
x = [1,0.69,0.40,0.192,0.045,0];
y = [1,0.932,0.78,0.538,0.1775,0];
plot(x,y)
x = linspace(0,1,10)
y = linspace(0,1,10)
plot(x,y)
x = [0.5,0.31];
y = [0.5,0.7];
plot (x,y)
xlabel("x")
ylabel("y")
suptitle("distillation curve")
Z=0.5;
y_D=0.69;
x_W=0.31;
show()
print "composition of top product = %f mole percent of hexane"%(y_D*100)
print "composition of bottom product = %f mole percent of hexane"%(x_W*100)
%matplotlib inline
import math
from numpy import *
from matplotlib.pyplot import *
F = 100. #moles
xf = 0.4;
D = 60. #moles
W = 40. #moles
x = linspace(0.2,0.45,6)
y = zeros(6)
z = zeros(6)
for i in range(6):
y[i] = 2.16*x[i]/(1+1.16*x[i]);
z[i] = (y[i]-x[i])**-1;
z = z.T / 10
plot(x,z)
suptitle('Batch Distillation Curve')
xlabel('x')
ylabel('y')
xw = 0.22; #from the graph
yd = (F*xf-W*xw)/D;
show()
print "composition of distillate = %f"%(yd)
print "composition of residue = %f"%(xw)
import math
x=0.4;
y=0.8;
x_D=y;
x_W=0.135; #bottom concentration
D=(100*x-100*x_W)/(y-x_W); #distillate amount
print "amount of distillate =%f moles/h"%(D)
alpha=6; #relative volatility
x_R=y/(y+(alpha*(1-y))); #liquid leaving partial condensor
print "liquid leaving partial condenser = %f"%(x_R)
y1=(1./3)*y+(2./3)*x;
x1=y1/(y1+(alpha*(1-y1)));
y_W = (1./3)*x_D+(2./3)*x1;
x_W=y_W/(y_W+(alpha*(1-y_W)));
D=(100*(x-x_W))/(y-x_W);
print "amount of distillate = %f moles/h"%(D)
import math
x=0.01; #% of nicotine
X0 = x/(1-x);
w=150. #weight of nicotine water solution
A0=w*(1-X0);
B0=250.; #kg keroscene
X1 = A0*X0/(A0+B0*0.798);
print "final concentration of nicotine = %f"%(X1)
c=A0*(X0-X1);
print "amount of nicotine removed = %f kg"%(c)
percentage = (c*100)/(A0*x);
print "percentage recovery = %f percent"%(percentage)
import math
x=0.01 #mole fraction of nicotine
yN = 0.0006; #mole fraction in solvent
xN = 0.001; #final mole fraction in water
X0=x/(1.-x); #in kg nicotine/kg water
YN =yN/(1.-yN); #in kg nicotine/kg keroscene
XN = xN/(1.-xN);
A0=100.*(1.-X0); #kgwater/h
B0=150.*(1.-YN); #in kg kerosene/h
Y1=((A0*(X0-XN))/B0)+YN; #in kg nicotine/kg kerosene
print "Y1 = %f kg nicotine/kg kerosene"%(Y1)
number_of_stages = 8.4;
print "numnber of stages = %f"%(number_of_stages)
import math
P = 101.3 #in kPa
pA = 3.74 #in kPa
p_AS = 7.415 #in kPa
H = (18.02/28.97)*(pA/(P-pA));
print "humidity = %f kg H2O/kg air"%(H)
Hs = (18.02/28.97)*(p_AS/(P-p_AS));
print "Saturated humidity = %f kg H2O/kg air"%(Hs)
humidity = 100*(H/Hs);
print "percentage humidity = %f percent"%(humidity)
relative_humidity = 100*(pA/p_AS);
print "percentage relative humidity = %f percent"%(relative_humidity)
import math
from numpy import *
S=425.6 #in kg/h
X1 = 0.035 #in kgwater/kg dry solid
t_s1=25. #in degree C
X2 = 0.017 #in kg H2O/kg dry air
t_s2=60. #in degree C
H2 = 0.0175 #in kg H2O/kg dry air
t_G2 = 84.2 #in degree C
t_G1= 32.8 #in degree C
C_pS = 1.465 #in kJ/kg dry solid
C_pA = 4.187 #in kg/ kg H2O K
H_G2=(1.005+1.88*H2)*(t_G2-0)+H2*2501;
H_S1 = C_pS*(t_s1-0)+X1*C_pA*(t_s1-0); #in kJ/kg
H_S2 = C_pS*(t_s2-0)+X2*C_pA*(t_s2-0); #in kJ/kg
Q=9300.; #in kJ/h
print "Latent heat of water at 0C HG2 = %f kJ/kg dryair"%(H_G2)
print "Enthalpy of entering solid HS1 = %f kJ/kg dryair"%(H_S1)
print "Enthalpy of exit solid HS2 = %f kJ/kg dryair"%(H_S2)
A = array([[0.0175, -1],[98.194, -2562.664]]);
b = array([[-14.17248],[29745.398]]);
x = linalg.solve(A,b)
G = x[0]
H1 = x[1]/G;
print "Air flow rate G = %f kg dryair/hr"%(G)
print "Humidity H1 = %f kg dryair/hr"%(H1)
import math
from numpy import *
M_Na2CO3 = 106
M_10H2O = 180.2
M_Na2CO3_10H2O = 286.2;
w_Na2CO3 = 5000. #in kg
water = 0.05 #% of water evaporated
W = water*w_Na2CO3;
A = array([[0.8230, 0.6296],[0.1769, 0.3703]])
b = array([[3500],[1250]])
x = linalg.solve(A,b);
L = x[0]
C = x[1];
print "L = %f kg solution"%(L)
print "C = %f kg of Na2CO3.10H2O crystals"%(C)
import math
from numpy import *
A = array([[0.7380, 0.5117],[0.2619, 0.4882]])
b = array([[1400],[600]])
x = linalg.solve(A,b)
L = x[0]
C = x[1];
print "L = %f kg solution"%(L)
print "C = %f kg of MgSO4.7H2O crystals"%(C)
F = 2000 #in kg/h
cv = 2.93 #in kJ/kg K
H1 = F*cv*(330-293);
print "enthalpy of feed = %f kJ"%(H1)
wt = 246.49 #molar mass MgSO4.7H2O
heat_soln = -13.31*10**3; #in kJ/kg mol
heat = heat_soln/wt;
heat_crystallization = abs(heat);
H2 = heat_crystallization*C; #total heat
q = -H1-H2;
print "heat absorbed = %f kJthus heat shall be removed"%(q)