extract the data from sol_check.dat
In [36]:
nom1 = open('sol_check.dat')
a=nom1.readlines()
c=[]
for i in range(len(a)-2):
A=a[i].split(" ")
while A.count('') > 0:
A.remove('')
B=[]
for i in A:
x=float(i)
B.append(x)
c.append(B) #c is now a list containing all the infro from sol_check.dat
calculating the mass fraction for each step
In [37]:
y=[]
for i in range(130):
x=c[i]
Solid_mass=x[2]+x[3]+x[5]+x[6]+x[7]+x[18]+x[21]+x[25]+x[26]+x[27]+x[28]+x[29]+x[30]+x[31]+x[32]+x[33]+x[34]+x[36]+x[37]+x[38]+x[39]+x[40]+x[41]+x[42]+x[43]+x[44]+x[45]+x[46]+x[47]+x[48]+x[49]+x[50]+x[51]+x[52]+x[53]+x[54]+x[55]+x[56]+x[57]+x[58]+x[59]+x[60]+x[61]+x[62]+x[63]+x[64]+x[65]+x[66]+x[67]+x[73]+x[74]+x[75]+x[76]+x[77]+x[78]+x[79]+x[80]+x[81]+x[82]+x[83]
Solid_fraction = Solid_mass/(sum(x)-x[0]-x[1])# x[2]+x[3]..... they are all solid during the reaction
y.append(Solid_fraction)#y is a list saving the mass fraction for each step
In [38]:
temperature_C = []
for i in range (130):
t = c[i][1]-273.15
temperature_C.append(t)# temperature for each step
In [39]:
from matplotlib import pyplot as plt
In [40]:
plt.plot(temperature_C,y)
plt.ylim( 0, 1 )
plt.show()
In [ ]:
In [ ]: