8 from __future__
import division,unicode_literals
10 from math
import radians,cos,sin,tan,pi,sqrt
11 import matplotlib.pyplot
as plt
12 from mpl_toolkits.mplot3d
import Axes3D
13 from matplotlib
import cm
14 import matplotlib.animation
as animation
15 path=
'./results/wallDrainage/' 20 data=numpy.loadtxt(path+
'filmthickness.csv')
21 time,dr,np,vt,fs,hmin,hloc,hcenter,havg=\
22 numpy.loadtxt(path+
'results_1d.csv',skiprows=1,unpack=
True)
25 for i
in range(points):
26 radius.append(dr[0]*(0.5+i))
28 radius=numpy.array(radius)
32 xran=int(len(radius)*xpart)
33 fig = plt.figure(figsize=(10.0,8.0))
34 plt.rc(
'xtick', labelsize=fontsize)
35 plt.rc(
'ytick', labelsize=fontsize)
36 for i
in range(nlines):
37 j=int((len(time)-1)/(nlines-1)*i)
39 radius[k]=dr[j]*(0.5+k)
40 line1,=plt.plot(radius[0:xran]*1e6,data[j][0:xran]*1e6,
41 label=
't={0:g} s'.format(time[j]),lw=linewidth)
44 plt.legend(loc=2, fontsize=fontsize)
45 plt.xlabel(
'Distance from center (μm)', fontsize=fontsize)
46 plt.ylabel(
'Film half thickness (μm)', fontsize=fontsize)
48 plt.savefig(
'profiles.pdf')
54 times=[0,int(len(data)/10),len(data)-1]
55 fig = plt.figure(figsize=(10.0,10.0))
56 plt.rc(
'xtick', labelsize=fontsize)
57 plt.rc(
'ytick', labelsize=fontsize)
60 radius[k]=dr[j]*(0.5+k)
62 plt.xlim(-Rc/sqrt(3.0)*1e6,Rc*1e6)
63 plt.ylim(-Rc*1e6,Rc*1e6)
64 for i,j
in enumerate(times):
67 radius[k]=dr[j]*(0.5+k)
70 y0=data[times[i]][0:xran]
73 d=(x0+a*(y0-c))/(1+a**2)
74 x1=2*d-x0+Rc+data[times[i]][-1]*tan(pi/6)
78 d=(x1+a*(y1-c))/(1+a**2)
83 x1=numpy.append(x1,x2)
84 y1=numpy.append(y1,y2)
86 line1,=plt.plot(x1*1e6,y1*1e6,color=colors[i],
87 label=
't={0:g} s'.format(time[times[i]]),lw=linewidth)
89 line1,=plt.plot(x1*1e6,y1*1e6,color=colors[i],lw=linewidth)
92 d=(x1+a*(y1-c))/(1+a**2)
96 line2,=plt.plot(x2*1e6,y2*1e6,color=colors[i],
97 label=
't={0:g} s'.format(time[times[i]]),lw=linewidth)
99 line2,=plt.plot(x2*1e6,y2*1e6,color=colors[i],lw=linewidth)
102 d=(x1+a*(y1-c))/(1+a**2)
106 line3,=plt.plot(x3*1e6,y3*1e6,color=colors[i],
107 label=
't={0:g} s'.format(time[times[i]]),lw=linewidth)
109 line3,=plt.plot(x3*1e6,y3*1e6,color=colors[i],lw=linewidth)
110 plt.legend(loc=1, fontsize=fontsize)
111 plt.xlabel(
'Dimensions in (μm)', fontsize=fontsize)
112 plt.ylabel(
'Dimensions in (μm)', fontsize=fontsize)
114 plt.savefig(
'profiles2d.pdf')
118 fig = plt.figure(figsize=(5.0,4.0))
119 ax = fig.gca(projection=
'3d')
120 radius3d, time3d = numpy.meshgrid(radius, time)
121 surf = ax.plot_surface(time3d, radius3d*1e6, data*1e6, rstride=1,
122 cstride=1, cmap=cm.coolwarm, linewidth=0, antialiased=
False)
132 plt.savefig(
'profiles3d.png')
136 for k
in range(xran):
137 radius[k]=dr[j]*(0.5+k)
138 fig,ax = plt.subplots(figsize=(10.0,8.0))
139 ax.set_xlim(radius[0]*1e6, (radius[-1]+dr[0]/2)*1e6)
140 ax.set_ylim(0, max(map(max,data))*1e6)
141 line,=ax.plot(radius[0:xran]*1e6,data[0][0:xran]*1e6,
142 label=
't={0:.1e} s'.format(time[0]),lw=linewidth)
143 plt.rc(
'xtick', labelsize=fontsize)
144 plt.rc(
'ytick', labelsize=fontsize)
145 plt.legend(loc=2, fontsize=fontsize)
146 plt.xlabel(
'position', fontsize=fontsize)
147 plt.ylabel(
'half thickness (um)', fontsize=fontsize)
153 if iii[0]>len(time)-1:
155 plt.legend([
't={0:.1e} s'.format(time[iii[0]])], loc=2, fontsize=fontsize)
156 for k
in range(xran):
157 radius[k]=dr[iii[0]]*(0.5+k)
158 line.set_xdata(radius[0:xran]*1e6)
159 line.set_ydata(data[iii[0]][0:xran]*1e6)
163 while True:
yield data[0][0:xran]*1e6
167 ani=animation.FuncAnimation(fig,update,data_gen,interval=100)
172 print 'saving of animation not implemented'