/[escript]/trunk/escriptcore/test/python/test_linearPDEs.py
ViewVC logotype

Diff of /trunk/escriptcore/test/python/test_linearPDEs.py

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

revision 2548 by jfenwick, Mon Jul 20 06:20:06 2009 UTC revision 2835 by artak, Mon Jan 11 01:23:52 2010 UTC
# Line 11  Line 11 
11  #  #
12  ########################################################  ########################################################
13    
14  __copyright__="""Copyright (c) 2003-2008 by University of Queensland  __copyright__="""Copyright (c) 2003-2009 by University of Queensland
15  Earth Systems Science Computational Center (ESSCC)  Earth Systems Science Computational Center (ESSCC)
16  http://www.uq.edu.au/esscc  http://www.uq.edu.au/esscc
17  Primary Business: Queensland, Australia"""  Primary Business: Queensland, Australia"""
# Line 34  The tests must be linked with a Domain c Line 34  The tests must be linked with a Domain c
34     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley))     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley))
35     unittest.TextTestRunner(verbosity=2).run(suite)     unittest.TextTestRunner(verbosity=2).run(suite)
36    
37  @var __author__: name of author  :var __author__: name of author
38  @var __copyright__: copyrights  :var __copyright__: copyrights
39  @var __license__: licence agreement  :var __license__: licence agreement
40  @var __url__: url entry point on documentation  :var __url__: url entry point on documentation
41  @var __version__: version  :var __version__: version
42  @var __date__: date of the version  :var __date__: date of the version
43  """  """
44    
45  __author__="Lutz Gross, l.gross@uq.edu.au"  __author__="Lutz Gross, l.gross@uq.edu.au"
# Line 57  class Test_linearPDEs(unittest.TestCase) Line 57  class Test_linearPDEs(unittest.TestCase)
57      VERBOSE=False      VERBOSE=False
58      def check(self,arg,ref_arg,tol=None):      def check(self,arg,ref_arg,tol=None):
59          """          """
60          checks if arg and ref_arg are nearly identical using the L{Lsup<esys.escript.util.Lsup>}          checks if arg and ref_arg are nearly identical using the `Lsup`
61          """          """
62          if tol==None: tol=self.TOL          if tol==None: tol=self.TOL
63          return Lsup(arg-ref_arg)<=tol*Lsup(ref_arg)          return Lsup(arg-ref_arg)<=tol*Lsup(ref_arg)
# Line 642  class Test_LinearPDE_noLumping(Test_line Line 642  class Test_LinearPDE_noLumping(Test_line
642      N=4      N=4
643      def test_SolverOptions(self):      def test_SolverOptions(self):
644          so=SolverOptions()          so=SolverOptions()
645            
646            self.failUnless(so.getSmoother() == 28, "initial Smoother is wrong.")
647            self.failUnlessRaises(ValueError,so.setSmoother,-1)
648            so.setSmoother(so.GAUSS_SEIDEL)
649            self.failUnless(so.getSmoother() == 28, "Gauss-Seidel smoother is not set.")
650            so.setSmoother(so.JACOBI)
651            self.failUnless(so.getSmoother() == 10, "Jacobi smoother is not set.")
652    
653          self.failUnless(so.getLevelMax() == 10, "initial  LevelMax is wrong.")          self.failUnless(so.getLevelMax() == 3, "initial  LevelMax is wrong.")
654          self.failUnlessRaises(ValueError,so.setLevelMax,-1)          self.failUnlessRaises(ValueError,so.setLevelMax,-1)
655          so.setLevelMax(3)          so.setLevelMax(20)
656          self.failUnless(so.getLevelMax() == 3, "LevelMax is wrong.")          self.failUnless(so.getLevelMax() == 20, "LevelMax is wrong.")
657    
658          self.failUnless(so.getCoarseningThreshold() == 0.05, "initial  CoarseningThreshold is wrong.")          self.failUnless(so.getCoarseningThreshold() == 0.25, "initial  CoarseningThreshold is wrong.")
659          self.failUnlessRaises(ValueError,so.setCoarseningThreshold,-1)          self.failUnlessRaises(ValueError,so.setCoarseningThreshold,-1)
660          so.setCoarseningThreshold(0.1)          so.setCoarseningThreshold(0.1)
661          self.failUnless(so.getCoarseningThreshold() == 0.1, "CoarseningThreshold is wrong.")          self.failUnless(so.getCoarseningThreshold() == 0.1, "CoarseningThreshold is wrong.")
# Line 858  class Test_LinearPDE_noLumping(Test_line Line 865  class Test_LinearPDE_noLumping(Test_line
865          self.failUnless(so.getCoarsening() == 34, "RUGE_STUEBEN_COARSENING is not set.")          self.failUnless(so.getCoarsening() == 34, "RUGE_STUEBEN_COARSENING is not set.")
866          so.setCoarsening(so.AGGREGATION_COARSENING)          so.setCoarsening(so.AGGREGATION_COARSENING)
867          self.failUnless(so.getCoarsening() == 35, "AGREGATION_COARSENING is not set.")          self.failUnless(so.getCoarsening() == 35, "AGREGATION_COARSENING is not set.")
868            so.setCoarsening(so.STANDARD_COARSENING)
869            self.failUnless(so.getCoarsening() == 39, "STANDARD_COARSENING is not set.")
870          so.setCoarsening(so.DEFAULT)          so.setCoarsening(so.DEFAULT)
871          self.failUnless(so.getCoarsening() == 0, "DEFAULT is not set.")          self.failUnless(so.getCoarsening() == 0, "DEFAULT is not set.")
872    
# Line 1586  class Test_LinearPDE_noLumping(Test_line Line 1595  class Test_LinearPDE_noLumping(Test_line
1595      mypde.getSolverOptions().setVerbosity(self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1596          u=mypde.getSolution()          u=mypde.getSolution()
1597          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1598        def test_PCG_AMG(self):
1599            if self.order!=2:
1600                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1601                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1602                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1603                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1604                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1605                u=mypde.getSolution()
1606                self.failUnless(self.check(u,1.),'solution is wrong.')
1607      def test_PCG_ILU0(self):      def test_PCG_ILU0(self):
1608          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1609          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
# Line 1625  class Test_LinearPDE_noLumping(Test_line Line 1643  class Test_LinearPDE_noLumping(Test_line
1643          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1644          u=mypde.getSolution()          u=mypde.getSolution()
1645          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1646        def test_BICGSTAB_AMG(self):
1647            if self.order!=2:
1648                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1649                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1650                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1651                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1652                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1653                u=mypde.getSolution()
1654                self.failUnless(self.check(u,1.),'solution is wrong.')
1655      def test_BICGSTAB_ILU0(self):      def test_BICGSTAB_ILU0(self):
1656          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1657          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
# Line 1657  class Test_LinearPDE_noLumping(Test_line Line 1684  class Test_LinearPDE_noLumping(Test_line
1684          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1685          u=mypde.getSolution()          u=mypde.getSolution()
1686          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1687        def test_MINRES_AMG(self):
1688            if self.order!=2:
1689                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1690                mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1691                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1692                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1693                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1694                u=mypde.getSolution()
1695                self.failUnless(self.check(u,1.),'solution is wrong.')
1696      def test_MINRES_ILU0(self):      def test_MINRES_ILU0(self):
1697          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1698          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
# Line 1689  class Test_LinearPDE_noLumping(Test_line Line 1725  class Test_LinearPDE_noLumping(Test_line
1725          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1726          u=mypde.getSolution()          u=mypde.getSolution()
1727          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1728        def test_TFQMR_AMG(self):
1729            if self.order!=2:
1730                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1731                mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1732                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1733                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1734                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1735                mypde.getSolverOptions().setVerbosity(True)
1736                u=mypde.getSolution()
1737                self.failUnless(self.check(u,1.),'solution is wrong.')
1738      def test_TFQMR_ILU0(self):      def test_TFQMR_ILU0(self):
1739          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1740          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
# Line 1721  class Test_LinearPDE_noLumping(Test_line Line 1767  class Test_LinearPDE_noLumping(Test_line
1767          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1768          u=mypde.getSolution()          u=mypde.getSolution()
1769          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1770        def test_PRES20_AMG(self):
1771            if self.order!=2:
1772                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1773                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1774                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1775                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1776                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1777                u=mypde.getSolution()
1778                self.failUnless(self.check(u,1.),'solution is wrong.')
1779      def test_PRES20_ILU0(self):      def test_PRES20_ILU0(self):
1780          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1781          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
# Line 1754  class Test_LinearPDE_noLumping(Test_line Line 1809  class Test_LinearPDE_noLumping(Test_line
1809      mypde.getSolverOptions().setTruncation(50)      mypde.getSolverOptions().setTruncation(50)
1810          u=mypde.getSolution()          u=mypde.getSolution()
1811          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1812        def test_GMRESnoRestart_AMG(self):
1813            if self.order!=2:
1814                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1815                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1816                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1817                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1818                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1819                mypde.getSolverOptions().setTruncation(50)
1820                u=mypde.getSolution()
1821                self.failUnless(self.check(u,1.),'solution is wrong.')
1822      def test_GMRESnoRestart_ILU0(self):      def test_GMRESnoRestart_ILU0(self):
1823          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1824          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
# Line 1789  class Test_LinearPDE_noLumping(Test_line Line 1854  class Test_LinearPDE_noLumping(Test_line
1854          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1855          u=mypde.getSolution()          u=mypde.getSolution()
1856          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1857        def test_GMRES_AMG(self):
1858            if self.order!=2:
1859                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1860                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1861                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1862                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1863                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1864                u=mypde.getSolution()
1865                self.failUnless(self.check(u,1.),'solution is wrong.')        
1866      def test_GMRES_ILU0(self):      def test_GMRES_ILU0(self):
1867          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1868          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
# Line 1823  class Test_LinearPDE_noLumping(Test_line Line 1897  class Test_LinearPDE_noLumping(Test_line
1897      mypde.getSolverOptions().setRestart(20)      mypde.getSolverOptions().setRestart(20)
1898          u=mypde.getSolution()          u=mypde.getSolution()
1899          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1900        def test_GMRES_truncation_restart_AMG(self):
1901            if self.order!=2:
1902                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1903                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1904                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1905                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1906                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1907                mypde.getSolverOptions().setTruncation(10)
1908                mypde.getSolverOptions().setRestart(20)
1909                u=mypde.getSolution()
1910                self.failUnless(self.check(u,1.),'solution is wrong.')
1911      def test_GMRES_truncation_restart_ILU0(self):      def test_GMRES_truncation_restart_ILU0(self):
1912          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1913          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
# Line 1898  class Test_LinearPDE_noLumping(Test_line Line 1983  class Test_LinearPDE_noLumping(Test_line
1983          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1984          u=mypde.getSolution()          u=mypde.getSolution()
1985          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1986        def test_PCG_AMG_System(self):
1987            if self.order!=2:
1988                A=Tensor4(0.,Function(self.domain))
1989                D=Tensor(1.,Function(self.domain))
1990                Y=Vector(self.domain.getDim(),Function(self.domain))
1991                for i in range(self.domain.getDim()):
1992                    A[i,:,i,:]=kronecker(self.domain)
1993                    D[i,i]+=i
1994                    Y[i]+=i
1995                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1996                mypde.setValue(A=A,D=D,Y=Y)
1997                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1998                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1999                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2000                u=mypde.getSolution()
2001                self.failUnless(self.check(u,1.),'solution is wrong.')
2002      def test_PCG_ILU0_System(self):      def test_PCG_ILU0_System(self):
2003          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2004          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1942  class Test_LinearPDE_noLumping(Test_line Line 2043  class Test_LinearPDE_noLumping(Test_line
2043          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2044          u=mypde.getSolution()          u=mypde.getSolution()
2045          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2046        def test_BICGSTAB_AMG_System(self):
2047            if self.order!=2:
2048                A=Tensor4(0.,Function(self.domain))
2049                D=Tensor(1.,Function(self.domain))
2050                Y=Vector(self.domain.getDim(),Function(self.domain))
2051                for i in range(self.domain.getDim()):
2052                    A[i,:,i,:]=kronecker(self.domain)
2053                    D[i,i]+=i
2054                    Y[i]+=i
2055                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2056                mypde.setValue(A=A,D=D,Y=Y)
2057                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2058                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2059                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2060                u=mypde.getSolution()
2061                self.failUnless(self.check(u,1.),'solution is wrong.')
2062      def test_BICGSTAB_ILU0_System(self):      def test_BICGSTAB_ILU0_System(self):
2063          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2064          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1972  class Test_LinearPDE_noLumping(Test_line Line 2089  class Test_LinearPDE_noLumping(Test_line
2089          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2090          u=mypde.getSolution()          u=mypde.getSolution()
2091          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2092        def test_PRES20_AMG_System(self):
2093            if self.order!=2:
2094                A=Tensor4(0.,Function(self.domain))
2095                D=Tensor(1.,Function(self.domain))
2096                Y=Vector(self.domain.getDim(),Function(self.domain))
2097                for i in range(self.domain.getDim()):
2098                    A[i,:,i,:]=kronecker(self.domain)
2099                    D[i,i]+=i
2100                    Y[i]+=i
2101                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2102                mypde.setValue(A=A,D=D,Y=Y)
2103                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2104                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2105                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2106                u=mypde.getSolution()
2107                self.failUnless(self.check(u,1.),'solution is wrong.')
2108      def test_PRES20_ILU0_System(self):      def test_PRES20_ILU0_System(self):
2109          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2110          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 2003  class Test_LinearPDE_noLumping(Test_line Line 2136  class Test_LinearPDE_noLumping(Test_line
2136          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2137          u=mypde.getSolution()          u=mypde.getSolution()
2138          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2139        def test_GMRESnoRestart_AMG_System(self):
2140            if self.order!=2:
2141                A=Tensor4(0.,Function(self.domain))
2142                D=Tensor(1.,Function(self.domain))
2143                Y=Vector(self.domain.getDim(),Function(self.domain))
2144                for i in range(self.domain.getDim()):
2145                    A[i,:,i,:]=kronecker(self.domain)
2146                    D[i,i]+=i
2147                    Y[i]+=i
2148                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2149                mypde.setValue(A=A,D=D,Y=Y)
2150                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2151                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2152                # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2153                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2154                u=mypde.getSolution()
2155                self.failUnless(self.check(u,1.),'solution is wrong.')
2156      def test_GMRESnoRestart_ILU0_System(self):      def test_GMRESnoRestart_ILU0_System(self):
2157          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2158          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 2034  class Test_LinearPDE_noLumping(Test_line Line 2184  class Test_LinearPDE_noLumping(Test_line
2184          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2185          u=mypde.getSolution()          u=mypde.getSolution()
2186          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2187        def test_GMRES_AMG_System(self):
2188            if self.order!=2:
2189                A=Tensor4(0.,Function(self.domain))
2190                D=Tensor(1.,Function(self.domain))
2191                Y=Vector(self.domain.getDim(),Function(self.domain))
2192                for i in range(self.domain.getDim()):
2193                    A[i,:,i,:]=kronecker(self.domain)
2194                    D[i,i]+=i
2195                    Y[i]+=i
2196                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2197                mypde.setValue(A=A,D=D,Y=Y)
2198                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2199                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2200                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2201                u=mypde.getSolution()
2202                self.failUnless(self.check(u,1.),'solution is wrong.')
2203      def test_GMRES_ILU0_System(self):      def test_GMRES_ILU0_System(self):
2204          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2205          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 2066  class Test_LinearPDE_noLumping(Test_line Line 2232  class Test_LinearPDE_noLumping(Test_line
2232      mypde.getSolverOptions().setRestart(20)      mypde.getSolverOptions().setRestart(20)
2233          u=mypde.getSolution()          u=mypde.getSolution()
2234          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2235        def test_GMRES_truncation_restart_AMG_System(self):
2236            if self.order!=2:
2237                A=Tensor4(0.,Function(self.domain))
2238                D=Tensor(1.,Function(self.domain))
2239                Y=Vector(self.domain.getDim(),Function(self.domain))
2240                for i in range(self.domain.getDim()):
2241                    A[i,:,i,:]=kronecker(self.domain)
2242                    D[i,i]+=i
2243                    Y[i]+=i
2244                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2245                mypde.setValue(A=A,D=D,Y=Y)
2246                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2247                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2248                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2249                mypde.getSolverOptions().setTruncation(10)
2250                mypde.getSolverOptions().setRestart(20)
2251                u=mypde.getSolution()
2252                self.failUnless(self.check(u,1.),'solution is wrong.')
2253      def test_GMRES_truncation_restart_ILU0_System(self):      def test_GMRES_truncation_restart_ILU0_System(self):
2254          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2255          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))

Legend:
Removed from v.2548  
changed lines
  Added in v.2835

  ViewVC Help
Powered by ViewVC 1.1.26