コード例 #1
0
	def __call__(self,u,w,bx,by,bz,b2,t):
		q = 8

		map = cm.red_blue()
		if self.x == None:
			nx = u.shape[2]
			nz = u.shape[0]
			self.x,self.y = np.meshgrid(range(nx),range(nz))
		x,y = self.x,self.y

		avgu = np.average(u,1)
		avgw = np.average(w,1)
		avgbx = np.average(bx,1)
		avgby = np.average(by,1)
		avgbz = np.average(bz,1)
		avgb2 = np.average(b2,1)
		avgt = np.average(t,1)

		plt.subplot(121)
		plt.imshow(avgt,cmap=map,origin='lower')
		plt.colorbar()
		plt.quiver(x[::q,::q],y[::q,::q],avgu[::q,::q],avgw[::q,::q])
		plt.title('Tracer-Vel')
		plt.axis("tight")

		plt.subplot(122)
		plt.imshow(avgby,cmap=map,origin='lower')
		plt.colorbar()
		plt.quiver(x[::q,::q],y[::q,::q],avgbx[::q,::q],avgbz[::q,::q])
		plt.title('By-Twist')
		plt.axis("tight")
コード例 #2
0
	def __call__(self,v,w,bx,by,bz,b2):
		q = 4

		map = cm.red_blue()
		if self.x == None:
			ny = v.shape[1]
			nz = v.shape[0]
			self.x,self.y = np.meshgrid(range(ny),range(nz))
		x,y = self.x,self.y

		avgv = np.average(v,2)
		avgw = -np.average(w,2)
		avgbx = np.average(bx,2)/np.sqrt(np.max(b2))
		avgby = np.average(by,2)/np.sqrt(np.max(b2))
		avgbz = -np.average(bz,2)
		avgb2 = np.average(b2,2)

		avgbx[0,0] = -np.max(avgbx)
		avgbx[0,1] = -np.min(avgbx)
		avgby[0,0] = -np.max(avgby)
		avgby[0,1] = -np.min(avgby)
		avgbz[0,0] = -np.max(avgbz)
		avgbz[0,1] = -np.min(avgbz)

		plt.subplot(221)
		plt.imshow(avgb2,cmap=map)
		plt.colorbar()
		plt.quiver(x[::q,::q],y[::q,::q],avgv[::q,::q],avgw[::q,::q])
		plt.title('B2')
		plt.axis("tight")

		plt.subplot(222)
		plt.imshow(avgbx,cmap=map)
		plt.colorbar()
		plt.quiver(x[::q,::q],y[::q,::q],avgv[::q,::q],avgw[::q,::q])
		plt.title('Bx')
		plt.axis("tight")

		plt.subplot(223)
		plt.imshow(avgby,cmap=map)
		plt.colorbar()
		plt.quiver(x[::q,::q],y[::q,::q],avgv[::q,::q],avgw[::q,::q])
		plt.title('By')
		plt.axis("tight")

		plt.subplot(224)
		plt.imshow(avgbz,cmap=map)
		plt.colorbar()
		plt.quiver(x[::q,::q],y[::q,::q],avgv[::q,::q],avgw[::q,::q])
		plt.title('Bz')
		plt.axis("tight")
コード例 #3
0
	def __call__(self,u,w,by):
		q = self.q

		map = cm.red_blue()
		if self.x == None:
			nx = u.shape[2]
			nz = u.shape[0]
			self.x,self.y = np.meshgrid(np.array(range(nx))*self.sim.xmx/nx,np.array(range(nz))*self.sim.zmx/nz)
		x,y = self.x,self.y

		avgu = np.average(u,1)
		avgw = np.average(w,1)
		avgby = np.average(by,1)

		plt.imshow(avgby,cmap=map,origin='lower',extent=[0,self.sim.xmx,0,self.sim.zmx])
		plt.quiver(x[::q,::q],y[::q,::q],avgu[::q,::q],avgw[::q,::q])
		plt.axis("tight")
コード例 #4
0
	def __call__(self,u,w,bx,by,bz,b2):
		q = 16

		map = cm.red_blue()
		if self.x == None:
			nx = u.shape[2]
			nz = u.shape[0]
			self.x,self.y = np.meshgrid(range(nx),range(nz))
		x,y = self.x,self.y

		avgu = np.average(u,1)
		avgw = np.average(w,1)
		avgbx = np.average(bx,1)
		avgby = np.average(by,1)
		avgbz = np.average(bz,1)
		avgb2 = np.average(b2,1)

		plt.subplot(221)
		plt.imshow(avgb2,cmap=map,origin='lower')
		plt.colorbar()
		plt.quiver(x[::q,::q],y[::q,::q],avgu[::q,::q],avgw[::q,::q])
		plt.title('B2')
		plt.axis("tight")

		plt.subplot(222)
		plt.imshow(avgbx,cmap=map,origin='lower')
		plt.colorbar()
		plt.quiver(x[::q,::q],y[::q,::q],avgu[::q,::q],avgw[::q,::q])
		plt.title('Bx')
		plt.axis("tight")

		plt.subplot(223)
		plt.imshow(avgby,cmap=map,origin='lower')
		plt.colorbar()
		plt.quiver(x[::q,::q],y[::q,::q],avgu[::q,::q],avgw[::q,::q])
		plt.title('By')
		plt.axis("tight")

		plt.subplot(224)
		plt.imshow(avgbz,cmap=map,origin='lower')
		plt.colorbar()
		plt.quiver(x[::q,::q],y[::q,::q],avgu[::q,::q],avgw[::q,::q])
		plt.title('Bz')
		plt.axis("tight")
コード例 #5
0
	def __call__(self,iteration,u,w,bx,by,bz,b2,t):
		q = 8

		index = int(iteration)/self.bf - 1
		dat = self.v[index]
		datH = self.vh[index]

		norm = max([dat[8],datH[8]])

		map = cm.red_blue()
		if self.x == None:
			nx = u.shape[2]
			nz = u.shape[0]
			self.x,self.y = np.meshgrid(range(nx),range(nz))
		x,y = self.x*self.sim.xmx / self.sim.nx,self.y * self.sim.zmx / self.sim.nz

		avgu = np.average(u,1)
		avgw = np.average(w,1)
		avgbx = np.average(bx,1)
		avgby = np.average(by,1)
		avgbz = np.average(bz,1)
		avgb2 = np.average(b2,1)
		avgt = np.average(t,1)

#		plt.subplot(121)
#		plt.imshow(avgt,cmap=map,origin='lower',extent=(0,self.sim.xmx,0,self.sim.zmx))
#		plt.colorbar()
#		plt.quiver(x[::q,::q],y[::q,::q],avgu[::q,::q],avgw[::q,::q])
#		plt.title('Tracer-Vel')
#		plt.axis("tight")

#		plt.subplot(122)
		plt.imshow(avgby,cmap=map,origin='lower',extent=(0,self.sim.xmx,0,self.sim.zmx))
		plt.arrow(dat[1]+self.sim.xmx/50.,dat[2]+self.sim.zmx/50,datH[6]/norm/3,datH[7]/norm/3,width=.02,head_width=.06,head_length=.02,length_includes_head=True,color='green')
		plt.arrow(dat[1],dat[2],dat[6]/norm/3,dat[7]/norm/3,width=.02,head_width=.06,head_length=.02,length_includes_head=True,color="black")
		plt.colorbar()
		plt.title('Vortex Forces')
		plt.axis("tight")