/[escript]/trunk/escript/test/python/test_pdetools.py
ViewVC logotype

Diff of /trunk/escript/test/python/test_pdetools.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4083 by jfenwick, Fri Sep 21 02:47:54 2012 UTC revision 4084 by jfenwick, Tue Nov 20 06:22:07 2012 UTC
# Line 190  class Test_pdetools_noLumping(unittest.T Line 190  class Test_pdetools_noLumping(unittest.T
190      def testProjector_rank4(self):      def testProjector_rank4(self):
191        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
192        p=Projector(self.domain,reduce=False,fast=False)        p=Projector(self.domain,reduce=False,fast=False)
193        td_ref=[[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],[[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]]*(x[0]+x[1])        td_ref=[[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],
194    [[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]]*(x[0]+x[1])
195        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
196        self.assertTrue(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")        self.assertTrue(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
197    
# Line 226  class Test_pdetools_noLumping(unittest.T Line 227  class Test_pdetools_noLumping(unittest.T
227      def testProjector_rank4_reduced(self):      def testProjector_rank4_reduced(self):
228        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
229        p=Projector(self.domain,reduce=True,fast=False)        p=Projector(self.domain,reduce=True,fast=False)
230        td_ref=[[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],[[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]]*(x[0]+x[1])        td_ref=[[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],
231    [[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]]*(x[0]+x[1])
232        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
233        self.assertTrue(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")        self.assertTrue(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
234    
# Line 261  class Test_pdetools_noLumping(unittest.T Line 263  class Test_pdetools_noLumping(unittest.T
263      def testProjector_rank4_with_reduced_input(self):      def testProjector_rank4_with_reduced_input(self):
264        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
265        p=Projector(self.domain,reduce=False,fast=False)        p=Projector(self.domain,reduce=False,fast=False)
266        td_ref=[[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],[[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]]*(x[0]+x[1])        td_ref=[[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],
267    [[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]]*(x[0]+x[1])
268        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
269        self.assertTrue(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")        self.assertTrue(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
270    
# Line 297  class Test_pdetools_noLumping(unittest.T Line 300  class Test_pdetools_noLumping(unittest.T
300      def testProjector_rank4_reduced_with_reduced_input(self):      def testProjector_rank4_reduced_with_reduced_input(self):
301        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
302        p=Projector(self.domain,reduce=True,fast=False)        p=Projector(self.domain,reduce=True,fast=False)
303        td_ref=numpy.array([[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],[[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]])        td_ref=numpy.array([[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],
304    [[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]])
305        td=p(Data(td_ref,ReducedFunction(self.domain)))        td=p(Data(td_ref,ReducedFunction(self.domain)))
306        self.assertTrue(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")        self.assertTrue(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
307    
# Line 1113  class Test_pdetools_noLumping(unittest.T Line 1117  class Test_pdetools_noLumping(unittest.T
1117        ll.initialize()        ll.initialize()
1118        ll.setTolerance(tol)        ll.setTolerance(tol)
1119        # ll.setSubToleranceReductionFactor(0.1)        # ll.setSubToleranceReductionFactor(0.1)
1120        x,p=ll.solve(ll.x_ref*1.20,ll.p_ref*(-2),max_iter=20, verbose=False, usePCG=False, iter_restart=20,max_correction_steps=10)        x,p=ll.solve(ll.x_ref*1.20,ll.p_ref*(-2),max_iter=20, verbose=False, usePCG=False,
1121    iter_restart=20,max_correction_steps=10)
1122        self.assertTrue(Lsup(x-ll.x_ref)<=Lsup(ll.x_ref)*tol*10.,"wrong x solution")        self.assertTrue(Lsup(x-ll.x_ref)<=Lsup(ll.x_ref)*tol*10.,"wrong x solution")
1123        self.assertTrue(Lsup(p-ll.p_ref)<=Lsup(ll.p_ref)*tol*10.,"wrong p solution")        self.assertTrue(Lsup(p-ll.p_ref)<=Lsup(ll.p_ref)*tol*10.,"wrong p solution")
1124    
# Line 1176  class Test_pdetools(Test_pdetools_noLump Line 1181  class Test_pdetools(Test_pdetools_noLump
1181        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
1182        h=Lsup(self.domain.getSize())        h=Lsup(self.domain.getSize())
1183        p=Projector(self.domain,reduce=True,fast=True)        p=Projector(self.domain,reduce=True,fast=True)
1184        td_ref=[[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],[[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]]*(x[0]+x[1])        td_ref=[[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],
1185    [[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]]*(x[0]+x[1])
1186        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
1187        self.assertTrue(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")        self.assertTrue(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")
1188    
# Line 1216  class Test_pdetools(Test_pdetools_noLump Line 1222  class Test_pdetools(Test_pdetools_noLump
1222        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
1223        h=Lsup(self.domain.getSize())        h=Lsup(self.domain.getSize())
1224        p=Projector(self.domain,reduce=True,fast=True)        p=Projector(self.domain,reduce=True,fast=True)
1225        td_ref=numpy.array([[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],[[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]])        td_ref=numpy.array([[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],
1226    [[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]])
1227        td=p(Data(td_ref,ReducedFunction(self.domain)))        td=p(Data(td_ref,ReducedFunction(self.domain)))
1228        self.assertTrue(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")        self.assertTrue(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")
1229    

Legend:
Removed from v.4083  
changed lines
  Added in v.4084

  ViewVC Help
Powered by ViewVC 1.1.26