# A-solute B-solvent
ci_f = 50 # [feed side concentration, mole/cubic m]
ci_p = 15 # [permeate side concentration, mole/cubic m]
t = 2*10**-4 # [membrane thickness, cm]
q_A = 176 # [permeability, barrer]
D = 4*10**-1 # [tube inside diameter, cm]
D_A = 5*10**-5 # [diffusuvity, square cm/s]
Re = 20000 # [reynolds number]
Sc = 450 # [Schmidt number]
mtc_p = 0.12 # [square cm/s]
#Calculation
# From equation 9.6, 1 barrer = 8.3*10**-9 square cm/s
# Therefore
q_A = q_A*8.3*10**-9 # [square cm/s]
Q_A = q_A/t # [permeance, cm/s]
# The mass-transfer coefficient on the feed side is from equation (2-75) for turbulent flow of a liquid inside a circular pipe:
Sh = 0.023*Re**0.83*Sc**(1.0/3.0)
# Now mass transfer coefficient
k_af = Sh*D_A/D # [cm/s]
# Total resistance to mass transfer
res_total = (1/k_af)+(1/Q_A)+(1/mtc_p) # [s/cm]
# Transmembrane flux of solute A
N_A = (ci_f-ci_p)/(res_total*100) # [mole/square m.s]
#Result
print"The transmembrane flux of solute A is",round(N_A,5),"mole/square m.s"
percent_mem_res = ((1/Q_A)/res_total)*100 # [%]
print"Membrane resistance is",round(percent_mem_res),"percent of the total"
import math
from scipy.optimize import fsolve
from numpy import *
# solution
# A-oxygen B-nitrogen
t = 0.2*10**-6 # [m]
qA = 3.97*10**-13 # [mole/m.s.kPa]
qB = 0.76*10**-13 # [mole/m.s.kPa]
v = 1 # [Air flow rate at STP, cubic m/s]
Pp = 0.1*10**6 # [Pa]
R = 8.314 # [cubic m.Pa/mole.K]
T = 298 # [K]
Pf = 1*10**6 # [Pa]
# Using equation 9.14
alphaA = qA/qB
QA = qA/t # [mole/square m.s.kPa]
# molar flow rate
nf = v*1000/(22.4) # [mole/s]
r = Pp/Pf # [pressure ratio]
QB = qB/t # [mole/square m.s.kPa]
alphaid = QA/QB
xFa = 0.21
xFb = 0.79
# For Q = 0.1
Q1 = 0.1
# Solution of simultaneous equation
def F(e):
f1 = e[0] - (e[2]*(1-e[1]))/((e[1]*(1-e[2])))
f2 = e[1] - (xFa - (e[2]*Q1))/(1-Q1)
f3 = e[0] - (alphaid*(e[1]*(e[0]-1)+1- (r*e[0])))/(e[1]*(e[0]-1)+1 - r)
return(f1,f2,f3)
# Initial guess
e = [4,0.13,0.4]
y = fsolve(F,e)
alpha1 = y[0]
Xa1 = y[1]
Ya1 = y[2]
Am1 = Ya1*Q1*nf/(QA*(Xa1*Pf-Ya1*Pp))*1000 # [square m]
# For Q = 0.2
Q2 = 0.2
# Solution of simultaneous equation
def F(e):
f1 = e[0] - (e[2]*(1-e[1]))/((e[1]*(1-e[2])))
f2 = e[1] - (xFa - (e[2]*Q2))/(1-Q2)
f3 = e[0] - (alphaid*(e[1]*(e[0]-1)+1- (r*e[0])))/(e[1]*(e[0]-1)+1 - r)
return(f1,f2,f3)
# Initial guess
e = [4,0.13,0.4]
y = fsolve(F,e)
alpha2 = y[0]
Xa2 = y[1]
Ya2 = y[2]
Am2 = Ya2*Q2*nf/(QA*(Xa2*Pf-Ya2*Pp))*1000 # [square m]
# For Q = 0.9
Q9 = 0.9
# Solution of simultaneous equation
def F(e):
f1 = e[0] - (e[2]*(1-e[1]))/((e[1]*(1-e[2])))
f2 = e[1] - (xFa - (e[2]*Q9))/(1-Q9)
f3 = e[0] - (alphaid*(e[1]*(e[0]-1)+1- (r*e[0])))/(e[1]*(e[0]-1)+1 - r)
return(f1,f2,f3)
# Initial guess
e = [4,0.13,0.4]
y = fsolve(F,e)
alpha9 = y[0]
Xa9 = y[1]
Ya9 = y[2]
Am9 = Ya2*Q9*nf/(QA*(Xa9*Pf-Ya9*Pp))*1000 # [square m]
# Similarly for Q =0.3......0.9, Xa, Ya, alpha and Am are calculated
# Therefore we obtained
# Solution = [Q,alpha,Xa,Ya]
Solution = zeros((9,4))
Solution =matrix([[0.1,4.112,0.181,0.475],[0.2,4.062,0.156,0.428],[0.3,4.018,0.135,0.385],[0.4,3.98,0.118,0.348],[0.5,3.949,0.105,0.315],[0.6,3.922,0.093,0.288],[0.7,3.9,0.084,0.264],[0.8,3.881,0.077,0.243],[0.9,3.864,0.07,0.226]])
Am =matrix([[8037],[17074],[26963],[37531],[48618],[60099],[71876],[83879],[96056]])
print"The maximum oxygen content of the permeate (%f percent) occurs with the smallest cut (Q = 0.1).",round(Ya1*100)
print"The maximum nitrogen content of the retentate (%f percent) occurs at the largest cut (Q = 0.9).\n\n",round((1-Xa9)*100)
print"The membrane area requirements are very large (e.g, Am = 60,100 square m for Q = 0.6) even though the volumetric flow rate of air is relatively small)"
import math
from numpy import *
Pexp = array([0.276,1.138,2.413,3.758,5.240,6.274,6.688 ]) # [MPa]
V = array([45.5,91.5,113,121,125,126,126 ]) # [cubic cm of CH4/gram carbon]
Ma = 16 # [gram/mole]
Vstp = 22.4 # [L/mole]
q = V*Ma/Vstp # [mg/g]
# Linearize data for Langmuir isotherm
y = Pexp/q
#y = array([0.0030667,0.01264,0.02681,0.0417556,0.0582,0.06971,0.07431 ])
a2=plot(Pexp,q, marker='o')
xlabel("Pexp, MPa")
ylabel("y, MPa.mg/g")
# Now qm = 1/(slope of Pexp v/s y curve)
# From graph of Pexp v/s y, the slope is
s = 0.01022
# And intercept
i = 5.4865*10**-3
qm = 1/s # [mg/g]
K = 1/(qm*i) # [1/MPa]
# Therefore
# qlp = K*qm*p/(1+Kp)
print"Data for Langmuir isotherm are K =",round(K,3),"MPa**-1 and qm =",round(qm,2)
# Linearize data for Freundlich isotherm
# y1 = log(q/(mg/g)) , x1 = log(Pexp/MPa)
y1 = numpy.log(q)
x1 = numpy.log(Pexp)
twiny()
twinx()
plot(x1,y1, linestyle='--', color='r')
plt.xticks(np.arange(min(x1), max(x1)+1, 2))
xlabel("$log(Pexp/(Mpa))$")
ylabel("$log(q/(mg/g))$")
title(' Langmuir and Freundlich isotherms fitted to data')
#plt.xlim(0,8)
#plt.ylim(20,100)
# From graph of log(q) v/s log(Pexp)
# slope = 0.31
s = 0.31
# and intercept is
i = 4
# Therefore n = 1/slope
n = 1/s
k =math.exp(i) # [(mg CH4/g of carbon.MPa**(-1/n)]
print"Data for Freundlich isotherm are n = ",round(n,2),"and k =",round(k,2)
# Therefore
# qFp = k*(p/1 Mpa)**(1/n)
print"Figure shows a q-p plot of the experimental data and the corresponding predictions of the Langmuir and Freundlich isotherms.\n It is evident from the plot that in this case, the Langmuir isotherm fits the data significantly better than the Freundlich isotherm."
#Variable declaration
# A-Na+ B-Cu+2
# Using the data from Table 9.1
KA = 1.98
KB = 3.47
import math
from scipy.optimize import fsolve
from pylab import *
from numpy import *
Q = 2.4 # [eq/L of resin]
# Charge ratio is 'n'
n = 2
C = 0.05 #[total concentration, eq/L]
# From equ 9.48
KAB = KB/KA
# From equ 9.47
# ya*(1-xa)**2/(xa*(1-ya)**2) = KAB*Q/C = T
T = KAB*Q/C
# Substituting values of xA in the range 0.1< xa <1.0, we generate the # distribution curve
ya=zeros((20))
for i in range(1,20):
def f16(ya):
return(ya*(1-i*0.05)**2/(i*0.05*(1-ya)**2)- T)
ya[i] = fsolve(f16,0.99)
xa =[0,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95]
a1=plot(xa,ya)
ylim(0,1)
xlabel("$xa,Fraction of Cu+2 in Solution$")
ylabel("$ya,Fraction of CuR2 in resin$")
plt.grid()
show(a1)
print"The curve is similar in shape to an adsorption isotherm of the very favorable type."
#Variable declaration
# From example 9.7
alpha = 0.891
# For bed length Z = 1.829
Z1 = 1.829 # [m]
#Calculation
LUB = (1-alpha)*Z1 # [length of unused bed, m]
# For this bed length
tb1 = 139.7 # [min]
# If the bed length is increased to Z2 = 3 m
Z2 = 3 # [m]
# New break through time will be given by equation 9.64
tb2 = tb1*(Z2/Z1)*(1-LUB/Z2)/(1-LUB/Z1) # [min]
#Result
print"The new time of breakthrough assuming constant LUB is",round(tb2),"minutes"
#Variable declaration
import math
F = 7 # [water flow rate, L/s]
Z = 3 # [m]
d = 2.6 # [m]
#Calculations
A = math.pi*d**2/4 # [cross sectional area, square m]
vo = 0.013 # [superficial velocity, m/s]
cf = 7*10**-3 # [Ca2+ ion concentration, eq/L]
qstar_F = 2.9 # [cation capacity, eq/kg]
rowp = 1.34 # [kg/L]
e = 0.38 # [porosity]
# From equation 9.66
t_star = Z*qstar_F*rowp*(1-e)/(vo*cf*3600) # [hour]
#Result
print"The ideal breakthrough time for the ion exchanger is",round(t_star),"hour"
#Variable declaration
mtc = 0.02 # [mass transfer coefficient, cm/min]
p = 0.03 # [permeance, cm/min]
F = 1 # [cubic m/h]
W = 1000 # [water wash rate, kg/h]
# Density of 25% H2SO4 solution at 298 K is
d1 = 1175 # [kg/cubic m]
x = 0.25 # [fraction of H2SO4 in solution]
cF = 294 # [kg/cubic m]
#Calculation
K = (1/p+1/mtc)**-1 # [overall mass transfer coefficient, cm/min]
# Flow of H2SO4 in feed
F_sul = F*d1*x # [kg/h]
import math
# For 60% recovery and rest in dialysate
yr = 0.60
yd = 0.40
# Transmembrane flow of acid
Ft = F_sul*yr # [kg/h]
# From the given water transport number, Transmembrane counterflow of water
Fw = Ft*0.8 # [kg/h]
# Now inlet and outlet concentration from material balances
# Flow of acid in dialysate
Fad = F_sul*yd # [kg/h]
# Total dialysate flow
D = F*d1-Ft+Fw # [kg/h]
x_aD = Fad/D # [mass fraction of acid in dialysate]
# Density of 10.3 wt % aqueous solution of sulfuric acid at 298K is
d2 = 1064 # [kg/cubic m]
cR = x_aD*d2 # [kg/cubic m]
# Flow of acid in diffusate
Fd = Ft # [kg/h]
# Total Diffusate flow
Di = 1000-Fw+Fd # [kg/h]
x_aDi = Fd/Di # [mass fraction acid in diffusate]
# Density of 17 wt % aqueous solution of sulfuric acid at 298 K is
d3 = 1114 # [kg/cubic m]
cP = x_aDi*d3 # [kg/cubic m]
# At the free end of dialyzer
deltaC1 = cF-cP # [kg/cubic m]
# At the dialysate end
deltaC2 = cR-0 # [kg/cubic m]
lmdf = (deltaC2-deltaC1)/(math.log(deltaC2/deltaC1)) # [math.log-mean driving force, kg/cubic m]
# Therefore
Am = Fd*100/(K*lmdf*60)
#Result
print"The membrane area required is",round(Am),"square m"
#Variable declaration
# A-NaCl
vo = 0.05 # [superficial velocity of water in the shell, m/s]
T = 298 # [K]
Pf = 70 # [bar]
Pp = 3 # [pressure at permeate side, bar]
p = 1.1*10**-5 # [water permeance, g/square cm.s.bar]
R1 = 0.97 # [salt rejection]
R = 8.314
xAf = 0.02 # [fraction of NaCl in feed side]
xAp = 0.0005 # [fraction of NaCl in permeate side]
MA = 58.5 # [gram/mole]
print"\nSolution 9.12(a)"
# Solution(a)
deltaP = Pf-Pp # [bar]
# Density of both feed and permeate is 1 g/cc
df = 1000 # [kg/cubic m]
dp = df
# Bulk feed salt concentration
csf = xAf*2*1000/MA # [kmole/cubic m]
# Bulk permeate salt concentration
csp = xAp*2*1000/MA # [kmole/cubic m]
# From equation 9.76
pif = R*T*csf/100 # [osmotic pressure at feed side, bar]
pip = R*T*csp/100 # [osmotic pressure at permeate side, bar]
deltapi = pif-pip # [bar]
Y = deltaP-deltapi # [bar]
# Transmembrane flux of water
nH2O = p*Y*10**-3/(df*(10**-4*1/(60*60*24))) # [cubic m/square m.day]
print"The transmembrane flux of water is",round(nH2O,2),"cubic m/square m.day."
print"\nSolution 9.12(b)"
# Solution(b)
# Properties of water are
dw = 1000 # [kg/cubic m]
uw = 0.9*10**-3 # [kg/m.s]
DA = 1.6*10**-9 # [Diffusivity of NaCl in water, square m/s]
d = 290*10**-6 # [outside diameter of fibres, m]
phi = 0.4
# For a superficial velocity of 5 cm/sec
Re = dw*vo*d/uw # [Renoylds number]
Sc = uw/(dw*DA) # [Schmidt number]
Sh = 8.63 # [Sherwood number]
# Therefore
ks = Sh*DA/d # [m/s]
# From equation 9.81
t = nH2O*R1/(ks)
#Since we have to find the value of 't' PER DAY...therefore we will divide by day
#.ie
t=t/(24*60*60)
#result
print"The concentration polarization factor is",round(t,3)
#variable declaration
import math
# w-water a-proteins
T = 293 # [K]
d = 2 # [diameter of tube, cm]
dw = 1 # [g/cubic cm]
uw = 0.01 # [cP]
Da = 4*10**-7 # [Diffusivity of proteins, square cm/s]
vo = 1.5*100 # [m/s]
Qm = 250*10**-3/3600*100 # [water permeance, cm/s.atm]
cR = 40 # [g/L]
print"Solution 9.13(a)\n"
# Solution(a)
v = 25*10**-3/3600*100 # [cm/s]
Re = d*vo*dw/uw # [Renoylds number]
Sc = uw/(dw*Da) # [Schmidt number]
Sh = 0.0048*Re**0.913*Sc**0.346 # [Sherwood number]
ks = Sh*Da/d
# From equation 9.87
cS = cR*math.exp(v/ks) # [g/L]
# From figure 9.12
pi1 = 2 # [osmotic pressure, atm]
# For 100% rejection deltapi = pi1 because pi2 = 0
# Therefore
deltapi = pi1 # [atm]
# From equation 9.83
deltaP = deltapi+(v/Qm)
print"The required pressure differential to produce a water transmembrane volume flux of 25 L/square m.h when the membrane is clean is",deltaP,"atm"
print"\nSolution 9.13(b)\n"
# Solution(b)
# Membrane permeance is reduced fivefold by fouling
Qm = Qm/5 # [cm/s.atm]
# Here deltaP remains same
# Equations 9.83 and 9.87, and the osmotic pressure data of Figure 9.12 must be solved simultaneously by trial and error to calculate new values for these three variables.
# The results are
cS2 = 213 # [g/L]
deltapi2 = 1.63 # [atm]
v2 = 6.53*10**-4 # [cm/s]
#Result
print"The water flux if the applied pressure differential remains the same as calculated in part (a) is",round(v2*1000*10**-2*3600,1),"L/square m.hr"