/[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 2535 by gross, Thu Jul 16 23:39:58 2009 UTC revision 2817 by artak, Thu Dec 10 02:12:33 2009 UTC
# Line 1  Line 1 
1    
2  ########################################################  ########################################################
3  #  #
4  # Copyright (c) 2003-2008 by University of Queensland  # Copyright (c) 2003-2009 by University of Queensland
5  # Earth Systems Science Computational Center (ESSCC)  # Earth Systems Science Computational Center (ESSCC)
6  # http://www.uq.edu.au/esscc  # http://www.uq.edu.au/esscc
7  #  #
# 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 643  class Test_LinearPDE_noLumping(Test_line Line 643  class Test_LinearPDE_noLumping(Test_line
643      def test_SolverOptions(self):      def test_SolverOptions(self):
644          so=SolverOptions()          so=SolverOptions()
645    
646          self.failUnless(so.getLevelMax() == 10, "initial  LevelMax is wrong.")          self.failUnless(so.getLevelMax() == 3, "initial  LevelMax is wrong.")
647          self.failUnlessRaises(ValueError,so.setLevelMax,-1)          self.failUnlessRaises(ValueError,so.setLevelMax,-1)
648          so.setLevelMax(3)          so.setLevelMax(20)
649          self.failUnless(so.getLevelMax() == 3, "LevelMax is wrong.")          self.failUnless(so.getLevelMax() == 20, "LevelMax is wrong.")
650    
651          self.failUnless(so.getCoarseningThreshold() == 0.05, "initial  CoarseningThreshold is wrong.")          self.failUnless(so.getCoarseningThreshold() == 0.25, "initial  CoarseningThreshold is wrong.")
652          self.failUnlessRaises(ValueError,so.setCoarseningThreshold,-1)          self.failUnlessRaises(ValueError,so.setCoarseningThreshold,-1)
653          so.setCoarseningThreshold(0.1)          so.setCoarseningThreshold(0.1)
654          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 858  class Test_LinearPDE_noLumping(Test_line
858          self.failUnless(so.getCoarsening() == 34, "RUGE_STUEBEN_COARSENING is not set.")          self.failUnless(so.getCoarsening() == 34, "RUGE_STUEBEN_COARSENING is not set.")
859          so.setCoarsening(so.AGGREGATION_COARSENING)          so.setCoarsening(so.AGGREGATION_COARSENING)
860          self.failUnless(so.getCoarsening() == 35, "AGREGATION_COARSENING is not set.")          self.failUnless(so.getCoarsening() == 35, "AGREGATION_COARSENING is not set.")
861            so.setCoarsening(so.STANDARD_COARSENING)
862            self.failUnless(so.getCoarsening() == 39, "STANDARD_COARSENING is not set.")
863          so.setCoarsening(so.DEFAULT)          so.setCoarsening(so.DEFAULT)
864          self.failUnless(so.getCoarsening() == 0, "DEFAULT is not set.")          self.failUnless(so.getCoarsening() == 0, "DEFAULT is not set.")
865    
# Line 1586  class Test_LinearPDE_noLumping(Test_line Line 1588  class Test_LinearPDE_noLumping(Test_line
1588      mypde.getSolverOptions().setVerbosity(self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1589          u=mypde.getSolution()          u=mypde.getSolution()
1590          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1591        def test_PCG_AMG(self):
1592            if self.order!=2:
1593                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1594                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1595                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1596                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1597                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1598                u=mypde.getSolution()
1599                self.failUnless(self.check(u,1.),'solution is wrong.')
1600      def test_PCG_ILU0(self):      def test_PCG_ILU0(self):
1601          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1602          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 1636  class Test_LinearPDE_noLumping(Test_line
1636          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1637          u=mypde.getSolution()          u=mypde.getSolution()
1638          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1639        def test_BICGSTAB_AMG(self):
1640            if self.order!=2:
1641                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1642                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1643                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1644                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1645                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1646                u=mypde.getSolution()
1647                self.failUnless(self.check(u,1.),'solution is wrong.')
1648      def test_BICGSTAB_ILU0(self):      def test_BICGSTAB_ILU0(self):
1649          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1650          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 1677  class Test_LinearPDE_noLumping(Test_line
1677          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1678          u=mypde.getSolution()          u=mypde.getSolution()
1679          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1680        def test_MINRES_AMG(self):
1681            if self.order!=2:
1682                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1683                mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1684                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1685                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1686                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1687                u=mypde.getSolution()
1688                self.failUnless(self.check(u,1.),'solution is wrong.')
1689      def test_MINRES_ILU0(self):      def test_MINRES_ILU0(self):
1690          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1691          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 1718  class Test_LinearPDE_noLumping(Test_line
1718          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1719          u=mypde.getSolution()          u=mypde.getSolution()
1720          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1721        def test_TFQMR_AMG(self):
1722            if self.order!=2:
1723                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1724                mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1725                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1726                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1727                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1728                mypde.getSolverOptions().setVerbosity(True)
1729                u=mypde.getSolution()
1730                self.failUnless(self.check(u,1.),'solution is wrong.')
1731      def test_TFQMR_ILU0(self):      def test_TFQMR_ILU0(self):
1732          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1733          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 1760  class Test_LinearPDE_noLumping(Test_line
1760          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1761          u=mypde.getSolution()          u=mypde.getSolution()
1762          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1763        def test_PRES20_AMG(self):
1764            if self.order!=2:
1765                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1766                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1767                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1768                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1769                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1770                u=mypde.getSolution()
1771                self.failUnless(self.check(u,1.),'solution is wrong.')
1772      def test_PRES20_ILU0(self):      def test_PRES20_ILU0(self):
1773          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1774          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 1802  class Test_LinearPDE_noLumping(Test_line
1802      mypde.getSolverOptions().setTruncation(50)      mypde.getSolverOptions().setTruncation(50)
1803          u=mypde.getSolution()          u=mypde.getSolution()
1804          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1805        def test_GMRESnoRestart_AMG(self):
1806            if self.order!=2:
1807                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1808                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1809                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1810                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1811                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1812                mypde.getSolverOptions().setTruncation(50)
1813                u=mypde.getSolution()
1814                self.failUnless(self.check(u,1.),'solution is wrong.')
1815      def test_GMRESnoRestart_ILU0(self):      def test_GMRESnoRestart_ILU0(self):
1816          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1817          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 1847  class Test_LinearPDE_noLumping(Test_line
1847          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1848          u=mypde.getSolution()          u=mypde.getSolution()
1849          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1850        def test_GMRES_AMG(self):
1851            if self.order!=2:
1852                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1853                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1854                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1855                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1856                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1857                u=mypde.getSolution()
1858                self.failUnless(self.check(u,1.),'solution is wrong.')        
1859      def test_GMRES_ILU0(self):      def test_GMRES_ILU0(self):
1860          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1861          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 1890  class Test_LinearPDE_noLumping(Test_line
1890      mypde.getSolverOptions().setRestart(20)      mypde.getSolverOptions().setRestart(20)
1891          u=mypde.getSolution()          u=mypde.getSolution()
1892          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1893        def test_GMRES_truncation_restart_AMG(self):
1894            if self.order!=2:
1895                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1896                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1897                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1898                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1899                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1900                mypde.getSolverOptions().setTruncation(10)
1901                mypde.getSolverOptions().setRestart(20)
1902                u=mypde.getSolution()
1903                self.failUnless(self.check(u,1.),'solution is wrong.')
1904      def test_GMRES_truncation_restart_ILU0(self):      def test_GMRES_truncation_restart_ILU0(self):
1905          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1906          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 1976  class Test_LinearPDE_noLumping(Test_line
1976          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1977          u=mypde.getSolution()          u=mypde.getSolution()
1978          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1979        def test_PCG_AMG_System(self):
1980            if self.order!=2:
1981                A=Tensor4(0.,Function(self.domain))
1982                D=Tensor(1.,Function(self.domain))
1983                Y=Vector(self.domain.getDim(),Function(self.domain))
1984                for i in range(self.domain.getDim()):
1985                    A[i,:,i,:]=kronecker(self.domain)
1986                    D[i,i]+=i
1987                    Y[i]+=i
1988                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1989                mypde.setValue(A=A,D=D,Y=Y)
1990                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1991                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1992                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1993                u=mypde.getSolution()
1994                self.failUnless(self.check(u,1.),'solution is wrong.')
1995      def test_PCG_ILU0_System(self):      def test_PCG_ILU0_System(self):
1996          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
1997          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1942  class Test_LinearPDE_noLumping(Test_line Line 2036  class Test_LinearPDE_noLumping(Test_line
2036          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2037          u=mypde.getSolution()          u=mypde.getSolution()
2038          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2039        def test_BICGSTAB_AMG_System(self):
2040            if self.order!=2:
2041                A=Tensor4(0.,Function(self.domain))
2042                D=Tensor(1.,Function(self.domain))
2043                Y=Vector(self.domain.getDim(),Function(self.domain))
2044                for i in range(self.domain.getDim()):
2045                    A[i,:,i,:]=kronecker(self.domain)
2046                    D[i,i]+=i
2047                    Y[i]+=i
2048                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2049                mypde.setValue(A=A,D=D,Y=Y)
2050                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2051                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2052                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2053                u=mypde.getSolution()
2054                self.failUnless(self.check(u,1.),'solution is wrong.')
2055      def test_BICGSTAB_ILU0_System(self):      def test_BICGSTAB_ILU0_System(self):
2056          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2057          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1972  class Test_LinearPDE_noLumping(Test_line Line 2082  class Test_LinearPDE_noLumping(Test_line
2082          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2083          u=mypde.getSolution()          u=mypde.getSolution()
2084          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2085        def test_PRES20_AMG_System(self):
2086            if self.order!=2:
2087                A=Tensor4(0.,Function(self.domain))
2088                D=Tensor(1.,Function(self.domain))
2089                Y=Vector(self.domain.getDim(),Function(self.domain))
2090                for i in range(self.domain.getDim()):
2091                    A[i,:,i,:]=kronecker(self.domain)
2092                    D[i,i]+=i
2093                    Y[i]+=i
2094                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2095                mypde.setValue(A=A,D=D,Y=Y)
2096                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2097                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2098                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2099                u=mypde.getSolution()
2100                self.failUnless(self.check(u,1.),'solution is wrong.')
2101      def test_PRES20_ILU0_System(self):      def test_PRES20_ILU0_System(self):
2102          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2103          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 2003  class Test_LinearPDE_noLumping(Test_line Line 2129  class Test_LinearPDE_noLumping(Test_line
2129          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2130          u=mypde.getSolution()          u=mypde.getSolution()
2131          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2132        def test_GMRESnoRestart_AMG_System(self):
2133            if self.order!=2:
2134                A=Tensor4(0.,Function(self.domain))
2135                D=Tensor(1.,Function(self.domain))
2136                Y=Vector(self.domain.getDim(),Function(self.domain))
2137                for i in range(self.domain.getDim()):
2138                    A[i,:,i,:]=kronecker(self.domain)
2139                    D[i,i]+=i
2140                    Y[i]+=i
2141                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2142                mypde.setValue(A=A,D=D,Y=Y)
2143                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2144                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2145                # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2146                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2147                u=mypde.getSolution()
2148                self.failUnless(self.check(u,1.),'solution is wrong.')
2149      def test_GMRESnoRestart_ILU0_System(self):      def test_GMRESnoRestart_ILU0_System(self):
2150          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2151          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 2034  class Test_LinearPDE_noLumping(Test_line Line 2177  class Test_LinearPDE_noLumping(Test_line
2177          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2178          u=mypde.getSolution()          u=mypde.getSolution()
2179          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2180        def test_GMRES_AMG_System(self):
2181            if self.order!=2:
2182                A=Tensor4(0.,Function(self.domain))
2183                D=Tensor(1.,Function(self.domain))
2184                Y=Vector(self.domain.getDim(),Function(self.domain))
2185                for i in range(self.domain.getDim()):
2186                    A[i,:,i,:]=kronecker(self.domain)
2187                    D[i,i]+=i
2188                    Y[i]+=i
2189                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2190                mypde.setValue(A=A,D=D,Y=Y)
2191                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2192                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2193                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2194                u=mypde.getSolution()
2195                self.failUnless(self.check(u,1.),'solution is wrong.')
2196      def test_GMRES_ILU0_System(self):      def test_GMRES_ILU0_System(self):
2197          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2198          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 2066  class Test_LinearPDE_noLumping(Test_line Line 2225  class Test_LinearPDE_noLumping(Test_line
2225      mypde.getSolverOptions().setRestart(20)      mypde.getSolverOptions().setRestart(20)
2226          u=mypde.getSolution()          u=mypde.getSolution()
2227          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2228        def test_GMRES_truncation_restart_AMG_System(self):
2229            if self.order!=2:
2230                A=Tensor4(0.,Function(self.domain))
2231                D=Tensor(1.,Function(self.domain))
2232                Y=Vector(self.domain.getDim(),Function(self.domain))
2233                for i in range(self.domain.getDim()):
2234                    A[i,:,i,:]=kronecker(self.domain)
2235                    D[i,i]+=i
2236                    Y[i]+=i
2237                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2238                mypde.setValue(A=A,D=D,Y=Y)
2239                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2240                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2241                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2242                mypde.getSolverOptions().setTruncation(10)
2243                mypde.getSolverOptions().setRestart(20)
2244                u=mypde.getSolution()
2245                self.failUnless(self.check(u,1.),'solution is wrong.')
2246      def test_GMRES_truncation_restart_ILU0_System(self):      def test_GMRES_truncation_restart_ILU0_System(self):
2247          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2248          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))

Legend:
Removed from v.2535  
changed lines
  Added in v.2817

  ViewVC Help
Powered by ViewVC 1.1.26