def test_quarticspike(self): rr = np.square(self.X) + np.square(self.Y) r = np.sqrt(rr) res = blowup.quartic_spike(r) npt.assert_allclose(res[0,0],0.) npt.assert_allclose(res[0,self.N//2], 0.) npt.assert_allclose(res[self.N//2, self.N//2],1.)
def test_quarticspike(self): rr = np.square(self.X) + np.square(self.Y) r = np.sqrt(rr) res = blowup.quartic_spike(r) npt.assert_allclose(res[0, 0], 0.) npt.assert_allclose(res[0, self.N // 2], 0.) npt.assert_allclose(res[self.N // 2, self.N // 2], 1.)
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)
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)