示例#1
0
		def generate():
			for N in [40,100,200]:
				thetas = np.linspace(0, 2*np.pi, N, endpoint=False)
				X0 = np.array([np.cos(thetas), np.sin(thetas), latitude*np.ones_like(thetas)]).T
				wm = get_wavemap(dt=.1, dx=1./N)
				Q = global_projection(X0, wm.reaction_projection, X0)
				yield wm.energy(Q, Q)
示例#2
0
		def generate():
			for N in [90,120,200, 400]:
				X, Y = np.ogrid[-bound:bound:N*1j,-bound:bound:N*1j]
				#
				## Q = blowup.get_equivariant(X, Y, blowup.quartic_spike)
				#
				rr = np.square(X) + np.square(Y)
				r = np.sqrt(rr)
				pQ = blowup.quartic_spike(r)
				#
				## pQ = np.cos(2*np.pi*X) + 0*Y
				Q = pQ[:,:,np.newaxis]
				wm = get_wavemap()
				npt.assert_allclose(wm.kinetic(Q,Q), 0.)
				## print 'q0', wavemap.directed_grad_potential(Q, 0)
				## print 'g0', wavemap.directed_grad_potential(wavemap.scatter(Q,wavemap.neumann), 0)
				## print 'g1', wavemap.directed_grad_potential(wavemap.scatter(Q,wavemap.periodic), 1)
				wm = get_wavemap(dt=.1, dx=1./N, border=wavemap.neumann)
				## print 'E', wm.energy(Q, Q)
				yield wm.energy(Q, Q)
示例#3
0
 def generate():
     for N in [90, 120, 200, 400]:
         X, Y = np.ogrid[-bound:bound:N * 1j, -bound:bound:N * 1j]
         #
         ## Q = blowup.get_equivariant(X, Y, blowup.quartic_spike)
         #
         rr = np.square(X) + np.square(Y)
         r = np.sqrt(rr)
         pQ = blowup.quartic_spike(r)
         #
         ## pQ = np.cos(2*np.pi*X) + 0*Y
         Q = pQ[:, :, np.newaxis]
         wm = get_wavemap()
         npt.assert_allclose(wm.kinetic(Q, Q), 0.)
         ## print 'q0', wavemap.directed_grad_potential(Q, 0)
         ## print 'g0', wavemap.directed_grad_potential(wavemap.scatter(Q,wavemap.neumann), 0)
         ## print 'g1', wavemap.directed_grad_potential(wavemap.scatter(Q,wavemap.periodic), 1)
         wm = get_wavemap(dt=.1, dx=1. / N, border=wavemap.neumann)
         ## print 'E', wm.energy(Q, Q)
         yield wm.energy(Q, Q)
示例#4
0
	def test_kinetic(self):
		Q0 = np.ones([5,5,4])
		Q1 = np.ones([5,5,4])
		wm = get_wavemap()
		wm.energy(Q0,Q1)
示例#5
0
	def test_grad_pot(self):
		Q = np.ones([5,5,3])
		QQ = wavemap.scatter(Q, border=wavemap.periodic)
		wm = get_wavemap()
		pot = wm.grad_potential(QQ)
		npt.assert_allclose(pot, 0.)
示例#6
0
	def setUp(self):
		self.wm = get_wavemap()
示例#7
0
def get_shake_stepper(dt=.1, dx=.1):
	wm = get_wavemap(dt,dx)
	def step(Q0, Q1):
		return multishake.shake(Q0, Q1, force=wm.force, reaction_projection=wm.reaction_projection)
	return step