from __future__ import division
from numpy import mat
from sympy import symbols,solve
#In the leaf filter filtration is at const pressure from the start
#V**2 + 2ALV/v = 2(-deltaP)A**2t/(ruv)
#In the filter press,a volume V1 of filtrate is obtained under const rate conditions in time t1,and filtration is then carried out at constant pressure.
#V1**2 + 2ALV1/v = 2(-deltaP)A**2t1/(ruv)
#and (V**2 − V1**2 ) + 2AL/υ(V − V1) = 2(−P)A**2/rμυ(t − t1)
#for the leaf filter
t2 = 300# #t2 is in secs
V2 = 2.5*10**(-4)# #V2 is in m**3
t3 = 600# #t3 is in secs
V3 = 4*10**(-4)# #V3 is in m**3
A = 0.05# #A is in m**2
deltaP = -7.13*10**(4)# #it is in N/m**2
#putting these values in above eq
a = [[2*7.13*10**(4)*0.05**(2)*300,-2*0.05*2.5*10**(-4)],[2*7.13*10**(4)*0.05**(2)*600,-2*0.05*4*10**(-4)]]
b = [[(2.5*10**(-4))**2],[(4*10**(-4))**2]]
a=mat(a)
b=mat(b)
x=(a**-1*b)
y = [1/x[0],x[1]]
print"\n L/υ=%f*10**(-3) and rμυ = %.3f *10**(11)"%(y[1]*10**3,y[0]*10**(-11))#
#for the filter press
V1 = symbols('V1')
s = solve(V1**2 + (2.16*y[1]*V1)-(4*10**(5)*2.16**2)/y[0]*180)
print"\n the value of V1 = %.3f m**3"%(s[1])
#For a constant pressure period (t - t1)=900secs
#Calculting the total volume of filtrate
V = symbols('V')
d = solve((V**2-3.33*10**(-4))+(1.512*10**(-2)*(V-1.825*10**(-2))-5.235*10**(-6)*900))#
print"\n The value of V = %.3f m**3"%(d[1])
f = (4*10**(5)*(2.16)**2)/(7.13*10**(11)*(6.15*10**(-2) + 2.16*3.5*10**(-3)))#
print"\n The final rate of filtration is %.2f*10**(-5) m**3/sec"%(f*10**(5))#
# Assuming viscosity of the filtrate is the same as that of the wash-water
rw_400 = (0.25)*f#
print"\n Rate of washing at 400 kN/m2 = %.1f*10**(-6) m**3/sec"%(rw_400*10**(6))#
rw_275 = rw_400*(275/400)#
print"\n Rate of washing at 275 kN/m**2 = %.1f*10**(-6) m**3/sec"%(rw_275*10**6)#
print"\n Thus the amount of wash-water passing in 600s = %.3f m**3"%(600*rw_275)#
from sympy import symbols,solve
#The slurry contains 100kg whiting/m**3 of water
print"\n Volume of 100 kg whiting = %.3f m**3"%(100/3000)#
print"\n Volume of cake = %.3f m**3"%(0.0333/0.6)#
print"\n Volume of liquid in cake = %.3f m**3"%(0.05556*0.4)#
print"\n Volume of filtrate = %.3f m**3"%((1-0.0222))#
print"\n volume of cake/volume of filtrate v = %.3f "%(0.0556/0.978)#
A = 10**(-4)# #area in sq meters
deltaP = -1.65*10**(5)# #P is in pascals
l = 0.01# #length is in meters
vol_flow_rate = 2*10**(-8)# #Volume flow rate is in m**3/sec
u = 10**(-3)# #vicosity is in Ns/m**2
r = symbols('r')
r1 = solve((10**4)*(2*10**(-8)*r)-1.65*10**(5)/(10**(-5)))[0]
print"\n r = %.2f*10**(13)/m**2"%(r1*10**(-13))#
def optimum():
Lopt = 1.161*10**(-3)*(900)**(0.5)# #t = 900 secs
return Lopt
print"\n optimum frame thickness = %.1f mm"%(2*optimum()*1000)#
#total cycle time = 1.015L**2 + 900
#rate of cake production R = L/(1.015L**2 + 900)
L = symbols('L')
L1 = solve(1.025*10**(6)*L**2 + 900 - 2.050*10**(6)*L**2)
print"\n Frame thickness = %.2f mm"%(2*L1[0]*10**3)#
from sympy import symbols,solve
from numpy import mat
from sympy.mpmath import quad
V = 0.094# #volume in m**3
deltaP = -3530# #P is in kN/m**2
#At t = 1105 secs
V1 = 0.166# #V is in m**3
deltaP1 = -5890# #P is in kN/m**2
a = [[2.21*10**(6), -0.094],[6.51*10**(6),-0.166]]
b = [[0.0088],[0.0276]]
a=mat(a)
b=mat(b)
x = (a**-1)*b
y = [x[1],x[0]]
print"\n LA/v =%f A**2/rμv = %.3f *10**(-7)"%(y[0],y[1]*10**7)#
print"\n For the full size plant:"
print"\n LA/v = %.3f A**2/rμv=%f*10**(-7)"%(10*y[0],y[1]*10**8)#
#Solving LHS of the integral
LHS = quad(lambda b:b+0.154+2.31,[0,1])#
#Equating LHS = RHS
t = LHS/(3.46*10**(-3))#
print"\n t = %d secs"%(t)#
print"\n deltaP = %d kN/m**2"%((1+0.154)/(4.64*10**(-7)*857))#
from sympy import symbols,solve
from numpy import mat,sqrt,pi
a = [[2*84300*0.02**(2)*60,-2*0.02*0.0003],[2*84300*0.02**(2)*120,-2*0.02*0.00044]]
b = [[0.0003**2],[0.00044**2]]
a=mat(a)
b=mat(b)
x = (a**-1)*b
y = [x[1],1/x[0]]#
print"\n L/v = %.3f ruv = %.3f *10**(10)"%(y[0],y[1]*10**(-10))#
print"\n Area of filtering surface = %.3f m**2"%(4*(pi))#
print"\n Bulk volume of cake deposited =%.3f m**3/revolution"%(4*(pi)*0.005)#
V = sqrt(1*10**(-6)*143**2)#
print"\n V = %.3f m**3"%(V)#
t =symbols('t')
t1 = solve(0.141**2 +2*2.19*10**(-3)*0.141-2*84300*(4*(pi))**(2)*t/(3.48*10**10))[0]
print"\n t = %.3f secs"%(t1)#
print"\n time for 1 revolution =%.1f secs"%(t1/0.4)#
print"\n speed = %.3fHz"%(0.4/t1)#
print"\n rate of filtrate production w = %.2f kg/sec"%(143/67.3)
print"\n mass of slurry S =%.1f kg/sec"%(1.66*2.11)#
from sympy import symbols,solve
from numpy import mat,pi
from scipy import sqrt
V1 = 0.00025# #V is in m**3
t = 300# #t is in secs
a = mat([[7.14*10**(-6),2.86*10**(-4)],[11.42*10**(-6),2.86*10**(-4)]])
b = mat([[1.2*10**(6)],[1*10**(6)]])
x = (a**-1)*b#
#for the plate and frame filter
B1 = x[0]/(2*2.2**2*413*10**3)#
B2 = x[1]/(2.2*413*1000)#
print"\nrμv = %d\n"%(x[0])#
print"\n rμl = %d"%(x[1])#
print"\n B1= %.3f B2= %.3f "%(B1,B2)#
print"\n the filtration time for maximum throughput is:"
t1 = 21.6*10**3#
t0= t1 +B2*sqrt(t1/B1)[0]
print"\n t = %.3f secs"%abs(t0)#
V = sqrt(t1/B1)[0]
print"\n V= %.3f m**3"%abs(V)#
fr=((V/(t1+t0))/10**-6)[0,0]
print"\nMean rate of filtration is: %.2f *10**-6 m**3/s"%abs(fr)
from math import pi, sqrt,ceil
from sympy import symbols,solve
A=0.6*0.6*pi# #in m**2
rate=1.25*10**-4# # in m**3/s
v_w=0.2/(3*10**3)#
v_f=10**-3-v_w#
v=v_w/v_f#
v_rate=rate*v#
w=360*0.2#
t=v_rate*w/A#
print"\nThickness of cake produced is : %.1f mm"%(t/10**-4)#
K = symbols('K')
K1 = solve((1.25*10**(-4)*360)**2-K*(6.5*10**(4)*(0.36*(pi))**(2)*72))[0]
print"\n The value of K is %.2f*10**(-10)"%(K1*10**(10))#
#Filter press
#Using a filter press with n frames of thickness b m the total time, for one complete cycle of the press =(tf+120n+240),where tf is the time during which filtration is occurring
#overall rate of filtration = Vf/(tf + 120n + 240)
# Vf = 0.3**(2)*n*b/0.143
#tf = 2.064*10**5 b**2
b = symbols('b')
b1 = solve(b**2 - 0.0458*b - 0.001162)#
print"\n The thickness is %.4f m"%(b1[0])#
def number_of_plates():
n = (0.030 + 25.8*b1[1]**2)/(0.629*b1[1]-0.015)#
return n
n = number_of_plates()#
print"\n The minimum number of plates required is %d"%(ceil(n))#
d = symbols('d')
d1 = solve(ceil(n)*(0.629*d-0.015)-0.030-25.8*d**2)[0]
print"\n The sizes of frames which will give exactly the required rate of filtration when six are used are %.3f mm"%(d1*10**3)#
print"\n\n\n Thus any frame thickness between 47 and 99 mm will be satisfactory. In practice,50 mm (2 in) frames would probably be used."
from __future__ import division
t1 = 600/(1/4)*(11/32)#
print"\n t1 = %dsecs"%(t1)#
#Substituting gives
deltaT = (19200/3)*(784-121+34)/2048#
print"\n t -t1 = %d secs"%(deltaT)#
Cycle_time = 180+900+t1+deltaT#
print"\n cycle time = %d secs"%(Cycle_time)#
Increase = (0.000214 - 0.000196)/(0.000196)*100#
print"\n Increase in filtration rate is %.1f per cent"%(Increase)#