from __future__ import division
from math import log
#For the pilot scale vessel
c = (2.5*75)/100# #in kg/m**3
cs = 2.5# #in kg/m**3
V = 1.0# #V is in m**3
t = 10# #t is in secs
#1.875 = 2.5(1-e**(-kA/b*100))
# x =kA/b
x = -log(1-1.875/2.5)/10
#For the full scale vessel
c = (500*28/100)/100
print"\n C = %.3f kg/m**3"%(c)
cs = 2.5# #cs is in kg/m**3
V = 100# #V is in m**3
t = -log(1-1.4/2.5)*(100/0.139)# #t is in secs
print"\n t = %d secs"%(t)
from __future__ import division
from scipy.optimize import fsolve
#If x1, x2, x3 are the solute: solvent ratios in thickeners 1, 2, and 3, respectively, the quantities of CaCO3. NaOH, and water in each of the streams can be calculated for every 100 kg of calcium carbonate
#Since the final underflow must contain only 1 per cent of NaOH
def F(x):
f=[]
f.append((300*x[2])/100 - 0.01)
f.append(300*(x[1]-x[2])/x[3] - x[2]) #Wf = x(4)
f.append(300*(x[0]-x[2])/x[3] - x[1])#
f.append((80-300*x[2])/(600+x[3])-x[0])
return f
#An initial guess
x = [0.1, 0.1, 0.1, 0.1]#
y = fsolve(F,x)#
print"\n x1 = %f x2 = %f x3 = %f Wf = %f "%(y[0],y[1],y[2],y[3])#
print"\n Thus the amount of water required for washing 100 kg CaCO3 is %.3f kg"%(y[3])#
print"\n The solution fed to reactor contains 0.25 kg/s Na2CO3.This isequivalent to 0.236 kg/s CaCO3,and hence the actual water required is %.2f kg/sec"%(y[3]*0.236/100)#
from __future__ import division
from math import log
#part 1
#Solvent in underflow from final washing thickener = 50 kg/s.
#The solvent in the overflow will be the same as that supplied for washing (200 kg/s).
#Solvent discharged in overflow/Solvent discharged in underflow= forthe washing thickeners.
#Liquid product from plant contains 54.9 kg of salt in 195 kg of solvent.
#This ratio will be the same in the underflow from the first thickener.
print"\n the material fed to the washing thickeners consists of 100 kg TiO2, 50 kg solvent and %d kg salt"%(50*(54.9/195))
#m =n+1
m = log(421)/log(4)
print"\n The required number of thickeners for washing are %.3f "%(m)
#Part 2
#From an inspection of the data, it is seen that Wh = 0.30 + 0.2Xh.
#Thus: Sh = WhXh = 0.30Xh + 0.2X2h= 5Wh**2− 1.5Wh
#Considering the passage of unit quantity of TiO2 through the plant, then:
Ln = 0# wn = 2# Xn = 0
#since 200 kg/s of pure solvent is used.
Sn = 0.001
Wn = 0.3007
So = 0.55
Wo = 1.00
#X1 = (Ln+1 + S0 − Sn)/(wn+1 + W0 − Wn)
X1 = (0+0.55-0.001)/(2+1-0.3007)
print"\n concentration in the first thickener is %.3f "%(X1)
W1 = 0.30+0.2*0.203
print"\n W1 = %.3f "%(W1)
S1 = (0.3406*0.203)
print"\n S1 = %.3f "%(S1)
X2 = (0.0691 - 0.001)/(1.7 + 0.3406)
print"\n X2 = %.3f "%(X2)
W2 = (0.30+0.2*0.0334)
print"\n W2 = %.3f "%(W2)
X3 = (0.01025-0.001)/(1.7+0.3067)
print"\n X3 = %.3f "%(X3)
print"\n W3 = 0.30089"
print"\n S3 = %.3f "%(0.0013)
print"\n W4 = %.3f and S4 = %.3f "%(0.30003,0.000045)
print"\n Thus S4 is less than Sn and therefore 4 thickeners are required."
from __future__ import division
#Since the seeds contain 20 per cent of oil
xAo=0.2
xBo=0.8
print"\n xAo = %.1f and xBo = %.1f"%(xAo,xBo)
#The final solution contains 50 per cent oil
yA1=0.5
yS1=0.5
print"\n yA1 = %.1f and yS1 = %.1f"%(yA1,yS1)
#The solvent which is used for extraction is pure and hence
ySn1=1
#1 kg of insoluble solid in the washed product is associated with 0.5 kg of solution and 0.025 kg oil.
xAn = 0.0167
xBn = 0.6667
xSn = 0.3166
#The mass fraction of insoluble material in the underflow is constant and equal to 0.667. The composition of the underflow is therefore represented, on the diagram Figure 10.22, by a straight line parallel to the hypotenuse of the triangle with an intercept of 0.333 on the two main axes.
#The difference point is now found by drawing in the two lines connecting x0 and y1 and xn and yn+1.
#The graphical construction described in the text is then used and it is seen from Figure 10.22 that xn lies in between x4 and x5.
print"\n Thus 5 thickeners are adequate and for the required degree of extraction"
from __future__ import division
#On the basis of 100 kg untreated solids
#In the underflow feed:
#0.35 kg oil is associated with each kg of exhausted livers.
print"\n mass of livers fed=%d kg contaning %d kg oil"%(100/(1+0.35),100-74)
xA = 0.26
print"\n xA = %.2f"%(xA)
xs = 0
#In the overflow feed, pure ether is used
ys =1.0
xs = 0
#Recovery = 90 per cent
print"\n Exhausted livers Oil Ether"
print"\n Underflow feed %d %d -"%(74,26)
print"\n Overflow feed - - %d"%(50)
print"\n Underflow product %d %d e(say)"%(74,2.6)
print"\n Overflow product - %d 50-e"%(23.4)
print"\n In the underflow product:"
print"\n the ratio(oil/exhausted livers) = %.3f kg/kg"%(2.6/74)
print"\n Ratio(ether/exhausted livers) = %.3f kg/kg"%(0.306)
print"\n e = %.1f kg"%(0.306*74)
#In the overflow product:
print"\n The mass of ether = %.1f kg"%(50-22.6)
print"\n yA = %.2f"%(23.4/(23.4+27.4))
print"\n ys = %.2f"%(1-23.4/(23.4+27.4))
print"\n "