%matplotlib inline
from matplotlib.pyplot import plot,title,xlabel,ylabel,show
from math import pi,exp
Cse=0.132# #in kg/kg
Cs = [0.091, 0.097 ,0.105 ,0.113 ,0.125 ,0.128, 0.132]
C=[];C1=[];C2=[]
for cc in Cs:
C.append(cc/Cse)
for cc in C:C1.append(1-cc)
for cc in C:C2.append(1-cc**2)
t = [2, 4 ,10 ,20 ,40 ,60 ,120]
plot(t,C1,t,C2)
title('1-(Cs/Cs* vs t(min)')
xlabel("1-(Cs/Cs*)")
ylabel('t(min)')
show()
#From the plot π**2Dr/ri**2 = 0.043
#For a pellet of twice the radius, that is r = 2ri
Slope = -0.043/4
print"\n Slope = %.3f"%(Slope)
#Thus, when the radius = 2ri
def equation1(t):
x = 1-(6/(pi)**2)*exp(-Slope*t)
return x
#CS/CS*=[1 − exp(−κDR/tri**2)]**0.5
#κDR/ri**2 = 0.04
#For a pellet twice the size
def equation2(t):
x1 = (1-exp(-0.01*t))**0.5
return x1
print"\n t(min) Cs(kg/kg) "
print"\n equation(i) equation(ii) "
t = [4 ,20, 60]# #t is in min
i=0
while i<=2:
print"\n %.3f %.3f %.3f "%(t[(i)],Cse*equation1(t[(i)]),Cse*equation2(t[(i)]))
i=i+1