/[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 2817 by artak, Thu Dec 10 02:12:33 2009 UTC revision 3100 by gross, Mon Aug 23 09:31:09 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-2009 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 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() == 3, "initial  LevelMax is wrong.")          self.failUnless(so.getLevelMax() == 5, "initial  LevelMax is wrong.")
654          self.failUnlessRaises(ValueError,so.setLevelMax,-1)          self.failUnlessRaises(ValueError,so.setLevelMax,-1)
655          so.setLevelMax(20)          so.setLevelMax(20)
656          self.failUnless(so.getLevelMax() == 20, "LevelMax is wrong.")          self.failUnless(so.getLevelMax() == 20, "LevelMax is wrong.")
# Line 806  class Test_LinearPDE_noLumping(Test_line Line 813  class Test_LinearPDE_noLumping(Test_line
813          self.failUnless(so.getSolverMethod() == 5, "CGS is not set.")          self.failUnless(so.getSolverMethod() == 5, "CGS is not set.")
814          so.setSolverMethod(so.BICGSTAB)          so.setSolverMethod(so.BICGSTAB)
815          self.failUnless(so.getSolverMethod() == 6, "BICGSTAB is not set.")          self.failUnless(so.getSolverMethod() == 6, "BICGSTAB is not set.")
         so.setSolverMethod(so.SSOR)  
         self.failUnless(so.getSolverMethod() == 7, "SSOR is not set.")  
816          so.setSolverMethod(so.GMRES)          so.setSolverMethod(so.GMRES)
817          self.failUnless(so.getSolverMethod() == 11, "GMRES is not set.")          self.failUnless(so.getSolverMethod() == 11, "GMRES is not set.")
818          so.setSolverMethod(so.PRES20)          so.setSolverMethod(so.PRES20)
# Line 824  class Test_LinearPDE_noLumping(Test_line Line 829  class Test_LinearPDE_noLumping(Test_line
829          self.failUnless(so.getSolverMethod() == 26, "TFQMR is not set.")          self.failUnless(so.getSolverMethod() == 26, "TFQMR is not set.")
830          so.setSolverMethod(so.MINRES)          so.setSolverMethod(so.MINRES)
831          self.failUnless(so.getSolverMethod() == 27, "MINRES is not set.")          self.failUnless(so.getSolverMethod() == 27, "MINRES is not set.")
         so.setSolverMethod(so.GAUSS_SEIDEL)  
         self.failUnless(so.getSolverMethod() == 28, "GAUSS_SEIDEL is not set.")  
832          so.setSolverMethod(so.DEFAULT)          so.setSolverMethod(so.DEFAULT)
833          self.failUnless(so.getSolverMethod() == 0, "DEFAULT is not set.")          self.failUnless(so.getSolverMethod() == 0, "DEFAULT is not set.")
834    
# Line 833  class Test_LinearPDE_noLumping(Test_line Line 836  class Test_LinearPDE_noLumping(Test_line
836          self.failUnlessRaises(ValueError,so.setPreconditioner,-1)          self.failUnlessRaises(ValueError,so.setPreconditioner,-1)
837          so.setPreconditioner(so.ILU0)          so.setPreconditioner(so.ILU0)
838          self.failUnless(so.getPreconditioner() == 8, "ILU0 is not set.")          self.failUnless(so.getPreconditioner() == 8, "ILU0 is not set.")
         so.setPreconditioner(so.SSOR)  
         self.failUnless(so.getPreconditioner() == 7, "SSOR is not set.")  
839          so.setPreconditioner(so.ILUT)          so.setPreconditioner(so.ILUT)
840          self.failUnless(so.getPreconditioner() == 9, "ILUT is not set.")          self.failUnless(so.getPreconditioner() == 9, "ILUT is not set.")
841          so.setPreconditioner(so.JACOBI)          so.setPreconditioner(so.JACOBI)
# Line 1588  class Test_LinearPDE_noLumping(Test_line Line 1589  class Test_LinearPDE_noLumping(Test_line
1589      mypde.getSolverOptions().setVerbosity(self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1590          u=mypde.getSolution()          u=mypde.getSolution()
1591          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1592        def test_PCG_GAUSS_SEIDEL(self):
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.GAUSS_SEIDEL)
1597        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1598            u=mypde.getSolution()
1599            self.failUnless(self.check(u,1.),'solution is wrong.')
1600      def test_PCG_AMG(self):      def test_PCG_AMG(self):
1601          if self.order!=2:          if self.order!=2:
1602              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1636  class Test_LinearPDE_noLumping(Test_line Line 1645  class Test_LinearPDE_noLumping(Test_line
1645          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1646          u=mypde.getSolution()          u=mypde.getSolution()
1647          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1648        def test_BICGSTAB_GAUSS_SEIDEL(self):
1649            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1650        mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1651        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1652            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1653            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1654            u=mypde.getSolution()
1655            self.failUnless(self.check(u,1.),'solution is wrong.')
1656      def test_BICGSTAB_AMG(self):      def test_BICGSTAB_AMG(self):
1657          if self.order!=2:          if self.order!=2:
1658              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1677  class Test_LinearPDE_noLumping(Test_line Line 1694  class Test_LinearPDE_noLumping(Test_line
1694          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1695          u=mypde.getSolution()          u=mypde.getSolution()
1696          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1697        def test_MINRES_GAUSS_SEIDEL(self):
1698            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1699        mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1700        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1701            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1702            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1703            u=mypde.getSolution()
1704            self.failUnless(self.check(u,1.),'solution is wrong.')
1705      def test_MINRES_AMG(self):      def test_MINRES_AMG(self):
1706          if self.order!=2:          if self.order!=2:
1707              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1718  class Test_LinearPDE_noLumping(Test_line Line 1743  class Test_LinearPDE_noLumping(Test_line
1743          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1744          u=mypde.getSolution()          u=mypde.getSolution()
1745          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1746        def test_TFQMR_GAUSS_SEIDEL(self):
1747            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1748        mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1749        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1750            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1751            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1752            u=mypde.getSolution()
1753            self.failUnless(self.check(u,1.),'solution is wrong.')
1754      def test_TFQMR_AMG(self):      def test_TFQMR_AMG(self):
1755          if self.order!=2:          if self.order!=2:
1756              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1725  class Test_LinearPDE_noLumping(Test_line Line 1758  class Test_LinearPDE_noLumping(Test_line
1758              mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)              mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1759              mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)              mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1760              mypde.getSolverOptions().setVerbosity(self.VERBOSE)              mypde.getSolverOptions().setVerbosity(self.VERBOSE)
             mypde.getSolverOptions().setVerbosity(True)  
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_TFQMR_ILU0(self):      def test_TFQMR_ILU0(self):
# Line 1760  class Test_LinearPDE_noLumping(Test_line Line 1792  class Test_LinearPDE_noLumping(Test_line
1792          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1793          u=mypde.getSolution()          u=mypde.getSolution()
1794          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1795        def test_PRES20_GAUSS_SEIDEL(self):
1796            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1797            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1798        mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1799        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1800            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1801            u=mypde.getSolution()
1802            self.failUnless(self.check(u,1.),'solution is wrong.')
1803      def test_PRES20_AMG(self):      def test_PRES20_AMG(self):
1804          if self.order!=2:          if self.order!=2:
1805              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1802  class Test_LinearPDE_noLumping(Test_line Line 1842  class Test_LinearPDE_noLumping(Test_line
1842      mypde.getSolverOptions().setTruncation(50)      mypde.getSolverOptions().setTruncation(50)
1843          u=mypde.getSolution()          u=mypde.getSolution()
1844          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1845        def test_GMRESnoRestart_GAUSS_SEIDEL(self):
1846            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1847            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1848        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1849        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1850        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1851        mypde.getSolverOptions().setTruncation(50)
1852            u=mypde.getSolution()
1853            self.failUnless(self.check(u,1.),'solution is wrong.')
1854      def test_GMRESnoRestart_AMG(self):      def test_GMRESnoRestart_AMG(self):
1855          if self.order!=2:          if self.order!=2:
1856              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1847  class Test_LinearPDE_noLumping(Test_line Line 1896  class Test_LinearPDE_noLumping(Test_line
1896          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
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_GAUSS_SEIDEL(self):
1900            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1901            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1902        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1903        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1904            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1905            u=mypde.getSolution()
1906            self.failUnless(self.check(u,1.),'solution is wrong.')
1907      def test_GMRES_AMG(self):      def test_GMRES_AMG(self):
1908          if self.order!=2:          if self.order!=2:
1909              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1890  class Test_LinearPDE_noLumping(Test_line Line 1947  class Test_LinearPDE_noLumping(Test_line
1947      mypde.getSolverOptions().setRestart(20)      mypde.getSolverOptions().setRestart(20)
1948          u=mypde.getSolution()          u=mypde.getSolution()
1949          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1950        def test_GMRES_truncation_restart_GAUSS_SEIDEL(self):
1951            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1952            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1953        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1954        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1955        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1956        mypde.getSolverOptions().setTruncation(10)
1957        mypde.getSolverOptions().setRestart(20)
1958            u=mypde.getSolution()
1959            self.failUnless(self.check(u,1.),'solution is wrong.')
1960      def test_GMRES_truncation_restart_AMG(self):      def test_GMRES_truncation_restart_AMG(self):
1961          if self.order!=2:          if self.order!=2:
1962              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1976  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_PCG_GAUSS_SEIDEL_System(self):
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.PCG)
2057        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2058            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2059            u=mypde.getSolution()
2060            self.failUnless(self.check(u,1.),'solution is wrong.')
2061      def test_PCG_AMG_System(self):      def test_PCG_AMG_System(self):
2062          if self.order!=2:          if self.order!=2:
2063              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
# Line 2036  class Test_LinearPDE_noLumping(Test_line Line 2118  class Test_LinearPDE_noLumping(Test_line
2118          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2119          u=mypde.getSolution()          u=mypde.getSolution()
2120          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2121        def test_BICGSTAB_GAUSS_SEIDEL_System(self):
2122            A=Tensor4(0.,Function(self.domain))
2123            D=Tensor(1.,Function(self.domain))
2124            Y=Vector(self.domain.getDim(),Function(self.domain))
2125            for i in range(self.domain.getDim()):
2126                A[i,:,i,:]=kronecker(self.domain)
2127                D[i,i]+=i
2128                Y[i]+=i
2129            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2130            mypde.setValue(A=A,D=D,Y=Y)
2131        mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2132        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2133            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2134            u=mypde.getSolution()
2135            self.failUnless(self.check(u,1.),'solution is wrong.')
2136      def test_BICGSTAB_AMG_System(self):      def test_BICGSTAB_AMG_System(self):
2137          if self.order!=2:          if self.order!=2:
2138              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
# Line 2082  class Test_LinearPDE_noLumping(Test_line Line 2179  class Test_LinearPDE_noLumping(Test_line
2179          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2180          u=mypde.getSolution()          u=mypde.getSolution()
2181          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2182        def test_PRES20_GAUSS_SEIDEL_System(self):
2183            A=Tensor4(0.,Function(self.domain))
2184            D=Tensor(1.,Function(self.domain))
2185            Y=Vector(self.domain.getDim(),Function(self.domain))
2186            for i in range(self.domain.getDim()):
2187                A[i,:,i,:]=kronecker(self.domain)
2188                D[i,i]+=i
2189                Y[i]+=i
2190            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2191            mypde.setValue(A=A,D=D,Y=Y)
2192        mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2193        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2194            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2195            u=mypde.getSolution()
2196            self.failUnless(self.check(u,1.),'solution is wrong.')
2197      def test_PRES20_AMG_System(self):      def test_PRES20_AMG_System(self):
2198          if self.order!=2:          if self.order!=2:
2199              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
# Line 2129  class Test_LinearPDE_noLumping(Test_line Line 2241  class Test_LinearPDE_noLumping(Test_line
2241          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2242          u=mypde.getSolution()          u=mypde.getSolution()
2243          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2244        def test_GMRESnoRestart_GAUSS_SEIDEL_System(self):
2245            A=Tensor4(0.,Function(self.domain))
2246            D=Tensor(1.,Function(self.domain))
2247            Y=Vector(self.domain.getDim(),Function(self.domain))
2248            for i in range(self.domain.getDim()):
2249                A[i,:,i,:]=kronecker(self.domain)
2250                D[i,i]+=i
2251                Y[i]+=i
2252            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2253            mypde.setValue(A=A,D=D,Y=Y)
2254        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2255        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2256            # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2257            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2258            u=mypde.getSolution()
2259            self.failUnless(self.check(u,1.),'solution is wrong.')
2260      def test_GMRESnoRestart_AMG_System(self):      def test_GMRESnoRestart_AMG_System(self):
2261          if self.order!=2:          if self.order!=2:
2262              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
# Line 2177  class Test_LinearPDE_noLumping(Test_line Line 2305  class Test_LinearPDE_noLumping(Test_line
2305          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2306          u=mypde.getSolution()          u=mypde.getSolution()
2307          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2308        def test_GMRES_GAUSS_SEIDEL_System(self):
2309            A=Tensor4(0.,Function(self.domain))
2310            D=Tensor(1.,Function(self.domain))
2311            Y=Vector(self.domain.getDim(),Function(self.domain))
2312            for i in range(self.domain.getDim()):
2313                A[i,:,i,:]=kronecker(self.domain)
2314                D[i,i]+=i
2315                Y[i]+=i
2316            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2317            mypde.setValue(A=A,D=D,Y=Y)
2318        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2319        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2320            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2321            u=mypde.getSolution()
2322            self.failUnless(self.check(u,1.),'solution is wrong.')
2323      def test_GMRES_AMG_System(self):      def test_GMRES_AMG_System(self):
2324          if self.order!=2:          if self.order!=2:
2325              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
# Line 2225  class Test_LinearPDE_noLumping(Test_line Line 2368  class Test_LinearPDE_noLumping(Test_line
2368      mypde.getSolverOptions().setRestart(20)      mypde.getSolverOptions().setRestart(20)
2369          u=mypde.getSolution()          u=mypde.getSolution()
2370          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2371        def test_GMRES_truncation_restart_GAUSS_SEIDEL_System(self):
2372            A=Tensor4(0.,Function(self.domain))
2373            D=Tensor(1.,Function(self.domain))
2374            Y=Vector(self.domain.getDim(),Function(self.domain))
2375            for i in range(self.domain.getDim()):
2376                A[i,:,i,:]=kronecker(self.domain)
2377                D[i,i]+=i
2378                Y[i]+=i
2379            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2380            mypde.setValue(A=A,D=D,Y=Y)
2381        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2382        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2383            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2384        mypde.getSolverOptions().setTruncation(10)
2385        mypde.getSolverOptions().setRestart(20)
2386            u=mypde.getSolution()
2387            self.failUnless(self.check(u,1.),'solution is wrong.')
2388      def test_GMRES_truncation_restart_AMG_System(self):      def test_GMRES_truncation_restart_AMG_System(self):
2389          if self.order!=2:          if self.order!=2:
2390              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
# Line 2414  class Test_TransportPDE(Test_linearPDEs) Line 2574  class Test_TransportPDE(Test_linearPDEs)
2574          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
2575          mypde.setInitialSolution(1.)          mypde.setInitialSolution(1.)
2576    
     def test_setInitialSolution_scalar_negative(self):  
         mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)  
         self.failUnlessRaises(RuntimeError, mypde.setInitialSolution,-1.)  
   
2577      def test_setInitialSolution_scalar_WithWrongShape(self):      def test_setInitialSolution_scalar_WithWrongShape(self):
2578          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
2579          self.failUnlessRaises(ValueError,mypde.setInitialSolution,[1.,2.])          self.failUnlessRaises(ValueError,mypde.setInitialSolution,[1.,2.])
# Line 2426  class Test_TransportPDE(Test_linearPDEs) Line 2582  class Test_TransportPDE(Test_linearPDEs)
2582          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)
2583          mypde.setInitialSolution([1.,2.])          mypde.setInitialSolution([1.,2.])
2584    
     def test_setInitialSolution_system(self):  
         mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)  
         self.failUnlessRaises(RuntimeError, mypde.setInitialSolution,[-1,2.])  
   
2585      def test_setInitialSolution_system_WithWrongShape(self):      def test_setInitialSolution_system_WithWrongShape(self):
2586          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)
2587          self.failUnlessRaises(ValueError, mypde.setInitialSolution,1.)          self.failUnlessRaises(ValueError, mypde.setInitialSolution,1.)
2588    
   
2589      def test_attemptToChangeOrderAfterDefinedCoefficient(self):      def test_attemptToChangeOrderAfterDefinedCoefficient(self):
2590          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2591          mypde.setValue(D=1.)          mypde.setValue(D=1.)

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

  ViewVC Help
Powered by ViewVC 1.1.26