Beispiel #1
0
 def testLaplacian(self):
     ''' Use finite differences to check the Lapalcian calculations'''
     N = 6
     h = 1E-4
     x,w = puq.trianglequadrature(5)
     for k in range(1,N):
         v = pup.DubinerTriangle(k, x).values()
         L = pup.laplacian(k)
         Lv = np.dot(v, L)
         Lhv = (sum([pup.DubinerTriangle(k, x+xh).values() for xh in ([0,h],[0,-h],[h,0],[-h,0])]) - 4*v)/(h**2)
         np.testing.assert_almost_equal(Lv, Lhv, decimal=3)
Beispiel #2
0
 def testLaplaceZero(self):
     ''' Test that the linear polynomials will have a zero laplacian'''
     L = pup.laplacian(1)
     np.testing.assert_almost_equal(L, 0, decimal=5)