/[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 2881 by jfenwick, Thu Jan 28 02:03:15 2010 UTC
# Line 1  Line 1 
1    
2  ########################################################  ########################################################
3  #  #
4  # Copyright (c) 2003-2009 by University of Queensland  # Copyright (c) 2003-2010 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-2010 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                u=mypde.getSolution()
1736                self.failUnless(self.check(u,1.),'solution is wrong.')
1737      def test_TFQMR_ILU0(self):      def test_TFQMR_ILU0(self):
1738          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1739          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 1766  class Test_LinearPDE_noLumping(Test_line
1766          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1767          u=mypde.getSolution()          u=mypde.getSolution()
1768          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1769        def test_PRES20_AMG(self):
1770            if self.order!=2:
1771                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1772                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1773                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1774                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1775                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1776                u=mypde.getSolution()
1777                self.failUnless(self.check(u,1.),'solution is wrong.')
1778      def test_PRES20_ILU0(self):      def test_PRES20_ILU0(self):
1779          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1780          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 1808  class Test_LinearPDE_noLumping(Test_line
1808      mypde.getSolverOptions().setTruncation(50)      mypde.getSolverOptions().setTruncation(50)
1809          u=mypde.getSolution()          u=mypde.getSolution()
1810          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1811        def test_GMRESnoRestart_AMG(self):
1812            if self.order!=2:
1813                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1814                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1815                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1816                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1817                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1818                mypde.getSolverOptions().setTruncation(50)
1819                u=mypde.getSolution()
1820                self.failUnless(self.check(u,1.),'solution is wrong.')
1821      def test_GMRESnoRestart_ILU0(self):      def test_GMRESnoRestart_ILU0(self):
1822          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1823          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 1853  class Test_LinearPDE_noLumping(Test_line
1853          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1854          u=mypde.getSolution()          u=mypde.getSolution()
1855          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1856        def test_GMRES_AMG(self):
1857            if self.order!=2:
1858                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1859                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1860                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1861                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1862                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1863                u=mypde.getSolution()
1864                self.failUnless(self.check(u,1.),'solution is wrong.')        
1865      def test_GMRES_ILU0(self):      def test_GMRES_ILU0(self):
1866          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1867          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 1896  class Test_LinearPDE_noLumping(Test_line
1896      mypde.getSolverOptions().setRestart(20)      mypde.getSolverOptions().setRestart(20)
1897          u=mypde.getSolution()          u=mypde.getSolution()
1898          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1899        def test_GMRES_truncation_restart_AMG(self):
1900            if self.order!=2:
1901                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1902                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1903                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1904                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1905                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1906                mypde.getSolverOptions().setTruncation(10)
1907                mypde.getSolverOptions().setRestart(20)
1908                u=mypde.getSolution()
1909                self.failUnless(self.check(u,1.),'solution is wrong.')
1910      def test_GMRES_truncation_restart_ILU0(self):      def test_GMRES_truncation_restart_ILU0(self):
1911          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1912          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 1982  class Test_LinearPDE_noLumping(Test_line
1982          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1983          u=mypde.getSolution()          u=mypde.getSolution()
1984          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1985        def test_PCG_AMG_System(self):
1986            if self.order!=2:
1987                A=Tensor4(0.,Function(self.domain))
1988                D=Tensor(1.,Function(self.domain))
1989                Y=Vector(self.domain.getDim(),Function(self.domain))
1990                for i in range(self.domain.getDim()):
1991                    A[i,:,i,:]=kronecker(self.domain)
1992                    D[i,i]+=i
1993                    Y[i]+=i
1994                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1995                mypde.setValue(A=A,D=D,Y=Y)
1996                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1997                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1998                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1999                u=mypde.getSolution()
2000                self.failUnless(self.check(u,1.),'solution is wrong.')
2001      def test_PCG_ILU0_System(self):      def test_PCG_ILU0_System(self):
2002          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2003          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1942  class Test_LinearPDE_noLumping(Test_line Line 2042  class Test_LinearPDE_noLumping(Test_line
2042          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2043          u=mypde.getSolution()          u=mypde.getSolution()
2044          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2045        def test_BICGSTAB_AMG_System(self):
2046            if self.order!=2:
2047                A=Tensor4(0.,Function(self.domain))
2048                D=Tensor(1.,Function(self.domain))
2049                Y=Vector(self.domain.getDim(),Function(self.domain))
2050                for i in range(self.domain.getDim()):
2051                    A[i,:,i,:]=kronecker(self.domain)
2052                    D[i,i]+=i
2053                    Y[i]+=i
2054                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2055                mypde.setValue(A=A,D=D,Y=Y)
2056                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2057                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2058                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2059                u=mypde.getSolution()
2060                self.failUnless(self.check(u,1.),'solution is wrong.')
2061      def test_BICGSTAB_ILU0_System(self):      def test_BICGSTAB_ILU0_System(self):
2062          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2063          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1972  class Test_LinearPDE_noLumping(Test_line Line 2088  class Test_LinearPDE_noLumping(Test_line
2088          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2089          u=mypde.getSolution()          u=mypde.getSolution()
2090          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2091        def test_PRES20_AMG_System(self):
2092            if self.order!=2:
2093                A=Tensor4(0.,Function(self.domain))
2094                D=Tensor(1.,Function(self.domain))
2095                Y=Vector(self.domain.getDim(),Function(self.domain))
2096                for i in range(self.domain.getDim()):
2097                    A[i,:,i,:]=kronecker(self.domain)
2098                    D[i,i]+=i
2099                    Y[i]+=i
2100                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2101                mypde.setValue(A=A,D=D,Y=Y)
2102                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2103                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2104                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2105                u=mypde.getSolution()
2106                self.failUnless(self.check(u,1.),'solution is wrong.')
2107      def test_PRES20_ILU0_System(self):      def test_PRES20_ILU0_System(self):
2108          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2109          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 2003  class Test_LinearPDE_noLumping(Test_line Line 2135  class Test_LinearPDE_noLumping(Test_line
2135          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2136          u=mypde.getSolution()          u=mypde.getSolution()
2137          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2138        def test_GMRESnoRestart_AMG_System(self):
2139            if self.order!=2:
2140                A=Tensor4(0.,Function(self.domain))
2141                D=Tensor(1.,Function(self.domain))
2142                Y=Vector(self.domain.getDim(),Function(self.domain))
2143                for i in range(self.domain.getDim()):
2144                    A[i,:,i,:]=kronecker(self.domain)
2145                    D[i,i]+=i
2146                    Y[i]+=i
2147                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2148                mypde.setValue(A=A,D=D,Y=Y)
2149                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2150                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2151                # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2152                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2153                u=mypde.getSolution()
2154                self.failUnless(self.check(u,1.),'solution is wrong.')
2155      def test_GMRESnoRestart_ILU0_System(self):      def test_GMRESnoRestart_ILU0_System(self):
2156          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2157          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 2034  class Test_LinearPDE_noLumping(Test_line Line 2183  class Test_LinearPDE_noLumping(Test_line
2183          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2184          u=mypde.getSolution()          u=mypde.getSolution()
2185          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2186        def test_GMRES_AMG_System(self):
2187            if self.order!=2:
2188                A=Tensor4(0.,Function(self.domain))
2189                D=Tensor(1.,Function(self.domain))
2190                Y=Vector(self.domain.getDim(),Function(self.domain))
2191                for i in range(self.domain.getDim()):
2192                    A[i,:,i,:]=kronecker(self.domain)
2193                    D[i,i]+=i
2194                    Y[i]+=i
2195                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2196                mypde.setValue(A=A,D=D,Y=Y)
2197                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2198                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2199                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2200                u=mypde.getSolution()
2201                self.failUnless(self.check(u,1.),'solution is wrong.')
2202      def test_GMRES_ILU0_System(self):      def test_GMRES_ILU0_System(self):
2203          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2204          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 2066  class Test_LinearPDE_noLumping(Test_line Line 2231  class Test_LinearPDE_noLumping(Test_line
2231      mypde.getSolverOptions().setRestart(20)      mypde.getSolverOptions().setRestart(20)
2232          u=mypde.getSolution()          u=mypde.getSolution()
2233          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2234        def test_GMRES_truncation_restart_AMG_System(self):
2235            if self.order!=2:
2236                A=Tensor4(0.,Function(self.domain))
2237                D=Tensor(1.,Function(self.domain))
2238                Y=Vector(self.domain.getDim(),Function(self.domain))
2239                for i in range(self.domain.getDim()):
2240                    A[i,:,i,:]=kronecker(self.domain)
2241                    D[i,i]+=i
2242                    Y[i]+=i
2243                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2244                mypde.setValue(A=A,D=D,Y=Y)
2245                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2246                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2247                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2248                mypde.getSolverOptions().setTruncation(10)
2249                mypde.getSolverOptions().setRestart(20)
2250                u=mypde.getSolution()
2251                self.failUnless(self.check(u,1.),'solution is wrong.')
2252      def test_GMRES_truncation_restart_ILU0_System(self):      def test_GMRES_truncation_restart_ILU0_System(self):
2253          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2254          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))

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

  ViewVC Help
Powered by ViewVC 1.1.26