/[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 2725 by artak, Wed Oct 21 23:44:06 2009 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 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 1586  class Test_LinearPDE_noLumping(Test_line Line 1586  class Test_LinearPDE_noLumping(Test_line
1586      mypde.getSolverOptions().setVerbosity(self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1587          u=mypde.getSolution()          u=mypde.getSolution()
1588          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1589        def test_PCG_AMG(self):
1590            if self.order!=2:
1591                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1592                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1593                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1594                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1595                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1596                u=mypde.getSolution()
1597                self.failUnless(self.check(u,1.),'solution is wrong.')
1598      def test_PCG_ILU0(self):      def test_PCG_ILU0(self):
1599          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1600          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 1634  class Test_LinearPDE_noLumping(Test_line
1634          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1635          u=mypde.getSolution()          u=mypde.getSolution()
1636          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1637        def test_BICGSTAB_AMG(self):
1638            if self.order!=2:
1639                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1640                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1641                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1642                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1643                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1644                u=mypde.getSolution()
1645                self.failUnless(self.check(u,1.),'solution is wrong.')
1646      def test_BICGSTAB_ILU0(self):      def test_BICGSTAB_ILU0(self):
1647          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1648          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 1675  class Test_LinearPDE_noLumping(Test_line
1675          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1676          u=mypde.getSolution()          u=mypde.getSolution()
1677          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1678        def test_MINRES_AMG(self):
1679            if self.order!=2:
1680                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1681                mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1682                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1683                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1684                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1685                u=mypde.getSolution()
1686                self.failUnless(self.check(u,1.),'solution is wrong.')
1687      def test_MINRES_ILU0(self):      def test_MINRES_ILU0(self):
1688          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1689          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 1716  class Test_LinearPDE_noLumping(Test_line
1716          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1717          u=mypde.getSolution()          u=mypde.getSolution()
1718          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1719        def test_TFQMR_AMG(self):
1720            if self.order!=2:
1721                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1722                mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1723                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1724                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1725                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1726                mypde.getSolverOptions().setVerbosity(True)
1727                u=mypde.getSolution()
1728                self.failUnless(self.check(u,1.),'solution is wrong.')
1729      def test_TFQMR_ILU0(self):      def test_TFQMR_ILU0(self):
1730          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1731          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 1758  class Test_LinearPDE_noLumping(Test_line
1758          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1759          u=mypde.getSolution()          u=mypde.getSolution()
1760          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1761        def test_PRES20_AMG(self):
1762            if self.order!=2:
1763                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1764                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1765                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1766                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1767                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1768                u=mypde.getSolution()
1769                self.failUnless(self.check(u,1.),'solution is wrong.')
1770      def test_PRES20_ILU0(self):      def test_PRES20_ILU0(self):
1771          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1772          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 1800  class Test_LinearPDE_noLumping(Test_line
1800      mypde.getSolverOptions().setTruncation(50)      mypde.getSolverOptions().setTruncation(50)
1801          u=mypde.getSolution()          u=mypde.getSolution()
1802          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1803        def test_GMRESnoRestart_AMG(self):
1804            if self.order!=2:
1805                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1806                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1807                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1808                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1809                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1810                mypde.getSolverOptions().setTruncation(50)
1811                u=mypde.getSolution()
1812                self.failUnless(self.check(u,1.),'solution is wrong.')
1813      def test_GMRESnoRestart_ILU0(self):      def test_GMRESnoRestart_ILU0(self):
1814          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1815          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 1845  class Test_LinearPDE_noLumping(Test_line
1845          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1846          u=mypde.getSolution()          u=mypde.getSolution()
1847          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1848        def test_GMRES_AMG(self):
1849            if self.order!=2:
1850                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1851                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1852                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1853                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1854                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1855                u=mypde.getSolution()
1856                self.failUnless(self.check(u,1.),'solution is wrong.')        
1857      def test_GMRES_ILU0(self):      def test_GMRES_ILU0(self):
1858          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1859          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 1888  class Test_LinearPDE_noLumping(Test_line
1888      mypde.getSolverOptions().setRestart(20)      mypde.getSolverOptions().setRestart(20)
1889          u=mypde.getSolution()          u=mypde.getSolution()
1890          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1891        def test_GMRES_truncation_restart_AMG(self):
1892            if self.order!=2:
1893                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1894                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1895                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1896                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1897                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1898                mypde.getSolverOptions().setTruncation(10)
1899                mypde.getSolverOptions().setRestart(20)
1900                u=mypde.getSolution()
1901                self.failUnless(self.check(u,1.),'solution is wrong.')
1902      def test_GMRES_truncation_restart_ILU0(self):      def test_GMRES_truncation_restart_ILU0(self):
1903          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1904          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 1974  class Test_LinearPDE_noLumping(Test_line
1974          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1975          u=mypde.getSolution()          u=mypde.getSolution()
1976          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1977        def test_PCG_AMG_System(self):
1978            if self.order!=2:
1979                A=Tensor4(0.,Function(self.domain))
1980                D=Tensor(1.,Function(self.domain))
1981                Y=Vector(self.domain.getDim(),Function(self.domain))
1982                for i in range(self.domain.getDim()):
1983                    A[i,:,i,:]=kronecker(self.domain)
1984                    D[i,i]+=i
1985                    Y[i]+=i
1986                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1987                mypde.setValue(A=A,D=D,Y=Y)
1988                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1989                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1990                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1991                u=mypde.getSolution()
1992                self.failUnless(self.check(u,1.),'solution is wrong.')
1993      def test_PCG_ILU0_System(self):      def test_PCG_ILU0_System(self):
1994          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
1995          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1942  class Test_LinearPDE_noLumping(Test_line Line 2034  class Test_LinearPDE_noLumping(Test_line
2034          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2035          u=mypde.getSolution()          u=mypde.getSolution()
2036          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2037        def test_BICGSTAB_AMG_System(self):
2038            if self.order!=2:
2039                A=Tensor4(0.,Function(self.domain))
2040                D=Tensor(1.,Function(self.domain))
2041                Y=Vector(self.domain.getDim(),Function(self.domain))
2042                for i in range(self.domain.getDim()):
2043                    A[i,:,i,:]=kronecker(self.domain)
2044                    D[i,i]+=i
2045                    Y[i]+=i
2046                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2047                mypde.setValue(A=A,D=D,Y=Y)
2048                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2049                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2050                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2051                u=mypde.getSolution()
2052                self.failUnless(self.check(u,1.),'solution is wrong.')
2053      def test_BICGSTAB_ILU0_System(self):      def test_BICGSTAB_ILU0_System(self):
2054          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2055          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1972  class Test_LinearPDE_noLumping(Test_line Line 2080  class Test_LinearPDE_noLumping(Test_line
2080          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2081          u=mypde.getSolution()          u=mypde.getSolution()
2082          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2083        def test_PRES20_AMG_System(self):
2084            if self.order!=2:
2085                A=Tensor4(0.,Function(self.domain))
2086                D=Tensor(1.,Function(self.domain))
2087                Y=Vector(self.domain.getDim(),Function(self.domain))
2088                for i in range(self.domain.getDim()):
2089                    A[i,:,i,:]=kronecker(self.domain)
2090                    D[i,i]+=i
2091                    Y[i]+=i
2092                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2093                mypde.setValue(A=A,D=D,Y=Y)
2094                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2095                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2096                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2097                u=mypde.getSolution()
2098                self.failUnless(self.check(u,1.),'solution is wrong.')
2099      def test_PRES20_ILU0_System(self):      def test_PRES20_ILU0_System(self):
2100          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2101          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 2003  class Test_LinearPDE_noLumping(Test_line Line 2127  class Test_LinearPDE_noLumping(Test_line
2127          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2128          u=mypde.getSolution()          u=mypde.getSolution()
2129          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2130        def test_GMRESnoRestart_AMG_System(self):
2131            if self.order!=2:
2132                A=Tensor4(0.,Function(self.domain))
2133                D=Tensor(1.,Function(self.domain))
2134                Y=Vector(self.domain.getDim(),Function(self.domain))
2135                for i in range(self.domain.getDim()):
2136                    A[i,:,i,:]=kronecker(self.domain)
2137                    D[i,i]+=i
2138                    Y[i]+=i
2139                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2140                mypde.setValue(A=A,D=D,Y=Y)
2141                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2142                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2143                # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2144                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2145                u=mypde.getSolution()
2146                self.failUnless(self.check(u,1.),'solution is wrong.')
2147      def test_GMRESnoRestart_ILU0_System(self):      def test_GMRESnoRestart_ILU0_System(self):
2148          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2149          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 2034  class Test_LinearPDE_noLumping(Test_line Line 2175  class Test_LinearPDE_noLumping(Test_line
2175          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2176          u=mypde.getSolution()          u=mypde.getSolution()
2177          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2178        def test_GMRES_AMG_System(self):
2179            if self.order!=2:
2180                A=Tensor4(0.,Function(self.domain))
2181                D=Tensor(1.,Function(self.domain))
2182                Y=Vector(self.domain.getDim(),Function(self.domain))
2183                for i in range(self.domain.getDim()):
2184                    A[i,:,i,:]=kronecker(self.domain)
2185                    D[i,i]+=i
2186                    Y[i]+=i
2187                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2188                mypde.setValue(A=A,D=D,Y=Y)
2189                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2190                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2191                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2192                u=mypde.getSolution()
2193                self.failUnless(self.check(u,1.),'solution is wrong.')
2194      def test_GMRES_ILU0_System(self):      def test_GMRES_ILU0_System(self):
2195          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2196          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 2066  class Test_LinearPDE_noLumping(Test_line Line 2223  class Test_LinearPDE_noLumping(Test_line
2223      mypde.getSolverOptions().setRestart(20)      mypde.getSolverOptions().setRestart(20)
2224          u=mypde.getSolution()          u=mypde.getSolution()
2225          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2226        def test_GMRES_truncation_restart_AMG_System(self):
2227            if self.order!=2:
2228                A=Tensor4(0.,Function(self.domain))
2229                D=Tensor(1.,Function(self.domain))
2230                Y=Vector(self.domain.getDim(),Function(self.domain))
2231                for i in range(self.domain.getDim()):
2232                    A[i,:,i,:]=kronecker(self.domain)
2233                    D[i,i]+=i
2234                    Y[i]+=i
2235                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2236                mypde.setValue(A=A,D=D,Y=Y)
2237                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2238                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2239                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2240                mypde.getSolverOptions().setTruncation(10)
2241                mypde.getSolverOptions().setRestart(20)
2242                u=mypde.getSolution()
2243                self.failUnless(self.check(u,1.),'solution is wrong.')
2244      def test_GMRES_truncation_restart_ILU0_System(self):      def test_GMRES_truncation_restart_ILU0_System(self):
2245          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2246          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))

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

  ViewVC Help
Powered by ViewVC 1.1.26