/[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 2996 by artak, Tue Mar 23 06:24: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 824  class Test_LinearPDE_noLumping(Test_line Line 831  class Test_LinearPDE_noLumping(Test_line
831          self.failUnless(so.getSolverMethod() == 26, "TFQMR is not set.")          self.failUnless(so.getSolverMethod() == 26, "TFQMR is not set.")
832          so.setSolverMethod(so.MINRES)          so.setSolverMethod(so.MINRES)
833          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.")  
834          so.setSolverMethod(so.DEFAULT)          so.setSolverMethod(so.DEFAULT)
835          self.failUnless(so.getSolverMethod() == 0, "DEFAULT is not set.")          self.failUnless(so.getSolverMethod() == 0, "DEFAULT is not set.")
836    
# Line 1588  class Test_LinearPDE_noLumping(Test_line Line 1593  class Test_LinearPDE_noLumping(Test_line
1593      mypde.getSolverOptions().setVerbosity(self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1594          u=mypde.getSolution()          u=mypde.getSolution()
1595          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1596        def test_PCG_GAUSS_SEIDEL(self):
1597            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1598            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1599            mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1600        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1601        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1602            u=mypde.getSolution()
1603            self.failUnless(self.check(u,1.),'solution is wrong.')
1604      def test_PCG_AMG(self):      def test_PCG_AMG(self):
1605          if self.order!=2:          if self.order!=2:
1606              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1636  class Test_LinearPDE_noLumping(Test_line Line 1649  class Test_LinearPDE_noLumping(Test_line
1649          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1650          u=mypde.getSolution()          u=mypde.getSolution()
1651          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1652        def test_BICGSTAB_GAUSS_SEIDEL(self):
1653            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1654        mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1655        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1656            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1657            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1658            u=mypde.getSolution()
1659            self.failUnless(self.check(u,1.),'solution is wrong.')
1660      def test_BICGSTAB_AMG(self):      def test_BICGSTAB_AMG(self):
1661          if self.order!=2:          if self.order!=2:
1662              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1677  class Test_LinearPDE_noLumping(Test_line Line 1698  class Test_LinearPDE_noLumping(Test_line
1698          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1699          u=mypde.getSolution()          u=mypde.getSolution()
1700          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1701        def test_MINRES_GAUSS_SEIDEL(self):
1702            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1703        mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1704        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1705            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1706            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1707            u=mypde.getSolution()
1708            self.failUnless(self.check(u,1.),'solution is wrong.')
1709      def test_MINRES_AMG(self):      def test_MINRES_AMG(self):
1710          if self.order!=2:          if self.order!=2:
1711              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1718  class Test_LinearPDE_noLumping(Test_line Line 1747  class Test_LinearPDE_noLumping(Test_line
1747          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1748          u=mypde.getSolution()          u=mypde.getSolution()
1749          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1750        def test_TFQMR_GAUSS_SEIDEL(self):
1751            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1752        mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1753        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1754            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1755            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1756            u=mypde.getSolution()
1757            self.failUnless(self.check(u,1.),'solution is wrong.')
1758      def test_TFQMR_AMG(self):      def test_TFQMR_AMG(self):
1759          if self.order!=2:          if self.order!=2:
1760              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1725  class Test_LinearPDE_noLumping(Test_line Line 1762  class Test_LinearPDE_noLumping(Test_line
1762              mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)              mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1763              mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)              mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1764              mypde.getSolverOptions().setVerbosity(self.VERBOSE)              mypde.getSolverOptions().setVerbosity(self.VERBOSE)
             mypde.getSolverOptions().setVerbosity(True)  
1765              u=mypde.getSolution()              u=mypde.getSolution()
1766              self.failUnless(self.check(u,1.),'solution is wrong.')              self.failUnless(self.check(u,1.),'solution is wrong.')
1767      def test_TFQMR_ILU0(self):      def test_TFQMR_ILU0(self):
# Line 1760  class Test_LinearPDE_noLumping(Test_line Line 1796  class Test_LinearPDE_noLumping(Test_line
1796          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1797          u=mypde.getSolution()          u=mypde.getSolution()
1798          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1799        def test_PRES20_GAUSS_SEIDEL(self):
1800            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1801            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1802        mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1803        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1804            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1805            u=mypde.getSolution()
1806            self.failUnless(self.check(u,1.),'solution is wrong.')
1807      def test_PRES20_AMG(self):      def test_PRES20_AMG(self):
1808          if self.order!=2:          if self.order!=2:
1809              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1802  class Test_LinearPDE_noLumping(Test_line Line 1846  class Test_LinearPDE_noLumping(Test_line
1846      mypde.getSolverOptions().setTruncation(50)      mypde.getSolverOptions().setTruncation(50)
1847          u=mypde.getSolution()          u=mypde.getSolution()
1848          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1849        def test_GMRESnoRestart_GAUSS_SEIDEL(self):
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.GAUSS_SEIDEL)
1854        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1855        mypde.getSolverOptions().setTruncation(50)
1856            u=mypde.getSolution()
1857            self.failUnless(self.check(u,1.),'solution is wrong.')
1858      def test_GMRESnoRestart_AMG(self):      def test_GMRESnoRestart_AMG(self):
1859          if self.order!=2:          if self.order!=2:
1860              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1847  class Test_LinearPDE_noLumping(Test_line Line 1900  class Test_LinearPDE_noLumping(Test_line
1900          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1901          u=mypde.getSolution()          u=mypde.getSolution()
1902          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1903        def test_GMRES_GAUSS_SEIDEL(self):
1904            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1905            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1906        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1907        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1908            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1909            u=mypde.getSolution()
1910            self.failUnless(self.check(u,1.),'solution is wrong.')
1911      def test_GMRES_AMG(self):      def test_GMRES_AMG(self):
1912          if self.order!=2:          if self.order!=2:
1913              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1890  class Test_LinearPDE_noLumping(Test_line Line 1951  class Test_LinearPDE_noLumping(Test_line
1951      mypde.getSolverOptions().setRestart(20)      mypde.getSolverOptions().setRestart(20)
1952          u=mypde.getSolution()          u=mypde.getSolution()
1953          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1954        def test_GMRES_truncation_restart_GAUSS_SEIDEL(self):
1955            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1956            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1957        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1958        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1959        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1960        mypde.getSolverOptions().setTruncation(10)
1961        mypde.getSolverOptions().setRestart(20)
1962            u=mypde.getSolution()
1963            self.failUnless(self.check(u,1.),'solution is wrong.')
1964      def test_GMRES_truncation_restart_AMG(self):      def test_GMRES_truncation_restart_AMG(self):
1965          if self.order!=2:          if self.order!=2:
1966              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1976  class Test_LinearPDE_noLumping(Test_line Line 2047  class Test_LinearPDE_noLumping(Test_line
2047          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2048          u=mypde.getSolution()          u=mypde.getSolution()
2049          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2050        def test_PCG_GAUSS_SEIDEL_System(self):
2051            A=Tensor4(0.,Function(self.domain))
2052            D=Tensor(1.,Function(self.domain))
2053            Y=Vector(self.domain.getDim(),Function(self.domain))
2054            for i in range(self.domain.getDim()):
2055                A[i,:,i,:]=kronecker(self.domain)
2056                D[i,i]+=i
2057                Y[i]+=i
2058            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2059            mypde.setValue(A=A,D=D,Y=Y)
2060            mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2061        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2062            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2063            u=mypde.getSolution()
2064            self.failUnless(self.check(u,1.),'solution is wrong.')
2065      def test_PCG_AMG_System(self):      def test_PCG_AMG_System(self):
2066          if self.order!=2:          if self.order!=2:
2067              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
# Line 2036  class Test_LinearPDE_noLumping(Test_line Line 2122  class Test_LinearPDE_noLumping(Test_line
2122          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2123          u=mypde.getSolution()          u=mypde.getSolution()
2124          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2125        def test_BICGSTAB_GAUSS_SEIDEL_System(self):
2126            A=Tensor4(0.,Function(self.domain))
2127            D=Tensor(1.,Function(self.domain))
2128            Y=Vector(self.domain.getDim(),Function(self.domain))
2129            for i in range(self.domain.getDim()):
2130                A[i,:,i,:]=kronecker(self.domain)
2131                D[i,i]+=i
2132                Y[i]+=i
2133            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2134            mypde.setValue(A=A,D=D,Y=Y)
2135        mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2136        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2137            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2138            u=mypde.getSolution()
2139            self.failUnless(self.check(u,1.),'solution is wrong.')
2140      def test_BICGSTAB_AMG_System(self):      def test_BICGSTAB_AMG_System(self):
2141          if self.order!=2:          if self.order!=2:
2142              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
# Line 2082  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_PRES20_GAUSS_SEIDEL_System(self):
2187            A=Tensor4(0.,Function(self.domain))
2188            D=Tensor(1.,Function(self.domain))
2189            Y=Vector(self.domain.getDim(),Function(self.domain))
2190            for i in range(self.domain.getDim()):
2191                A[i,:,i,:]=kronecker(self.domain)
2192                D[i,i]+=i
2193                Y[i]+=i
2194            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2195            mypde.setValue(A=A,D=D,Y=Y)
2196        mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2197        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2198            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2199            u=mypde.getSolution()
2200            self.failUnless(self.check(u,1.),'solution is wrong.')
2201      def test_PRES20_AMG_System(self):      def test_PRES20_AMG_System(self):
2202          if self.order!=2:          if self.order!=2:
2203              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
# Line 2129  class Test_LinearPDE_noLumping(Test_line Line 2245  class Test_LinearPDE_noLumping(Test_line
2245          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2246          u=mypde.getSolution()          u=mypde.getSolution()
2247          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2248        def test_GMRESnoRestart_GAUSS_SEIDEL_System(self):
2249            A=Tensor4(0.,Function(self.domain))
2250            D=Tensor(1.,Function(self.domain))
2251            Y=Vector(self.domain.getDim(),Function(self.domain))
2252            for i in range(self.domain.getDim()):
2253                A[i,:,i,:]=kronecker(self.domain)
2254                D[i,i]+=i
2255                Y[i]+=i
2256            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2257            mypde.setValue(A=A,D=D,Y=Y)
2258        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2259        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2260            # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2261            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2262            u=mypde.getSolution()
2263            self.failUnless(self.check(u,1.),'solution is wrong.')
2264      def test_GMRESnoRestart_AMG_System(self):      def test_GMRESnoRestart_AMG_System(self):
2265          if self.order!=2:          if self.order!=2:
2266              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
# Line 2177  class Test_LinearPDE_noLumping(Test_line Line 2309  class Test_LinearPDE_noLumping(Test_line
2309          mypde.getSolverOptions().setVerbosity(self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2310          u=mypde.getSolution()          u=mypde.getSolution()
2311          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2312        def test_GMRES_GAUSS_SEIDEL_System(self):
2313            A=Tensor4(0.,Function(self.domain))
2314            D=Tensor(1.,Function(self.domain))
2315            Y=Vector(self.domain.getDim(),Function(self.domain))
2316            for i in range(self.domain.getDim()):
2317                A[i,:,i,:]=kronecker(self.domain)
2318                D[i,i]+=i
2319                Y[i]+=i
2320            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2321            mypde.setValue(A=A,D=D,Y=Y)
2322        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2323        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2324            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2325            u=mypde.getSolution()
2326            self.failUnless(self.check(u,1.),'solution is wrong.')
2327      def test_GMRES_AMG_System(self):      def test_GMRES_AMG_System(self):
2328          if self.order!=2:          if self.order!=2:
2329              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
# Line 2225  class Test_LinearPDE_noLumping(Test_line Line 2372  class Test_LinearPDE_noLumping(Test_line
2372      mypde.getSolverOptions().setRestart(20)      mypde.getSolverOptions().setRestart(20)
2373          u=mypde.getSolution()          u=mypde.getSolution()
2374          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2375        def test_GMRES_truncation_restart_GAUSS_SEIDEL_System(self):
2376            A=Tensor4(0.,Function(self.domain))
2377            D=Tensor(1.,Function(self.domain))
2378            Y=Vector(self.domain.getDim(),Function(self.domain))
2379            for i in range(self.domain.getDim()):
2380                A[i,:,i,:]=kronecker(self.domain)
2381                D[i,i]+=i
2382                Y[i]+=i
2383            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2384            mypde.setValue(A=A,D=D,Y=Y)
2385        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2386        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2387            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2388        mypde.getSolverOptions().setTruncation(10)
2389        mypde.getSolverOptions().setRestart(20)
2390            u=mypde.getSolution()
2391            self.failUnless(self.check(u,1.),'solution is wrong.')
2392      def test_GMRES_truncation_restart_AMG_System(self):      def test_GMRES_truncation_restart_AMG_System(self):
2393          if self.order!=2:          if self.order!=2:
2394              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
# Line 2414  class Test_TransportPDE(Test_linearPDEs) Line 2578  class Test_TransportPDE(Test_linearPDEs)
2578          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
2579          mypde.setInitialSolution(1.)          mypde.setInitialSolution(1.)
2580    
     def test_setInitialSolution_scalar_negative(self):  
         mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)  
         self.failUnlessRaises(RuntimeError, mypde.setInitialSolution,-1.)  
   
2581      def test_setInitialSolution_scalar_WithWrongShape(self):      def test_setInitialSolution_scalar_WithWrongShape(self):
2582          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
2583          self.failUnlessRaises(ValueError,mypde.setInitialSolution,[1.,2.])          self.failUnlessRaises(ValueError,mypde.setInitialSolution,[1.,2.])
# Line 2426  class Test_TransportPDE(Test_linearPDEs) Line 2586  class Test_TransportPDE(Test_linearPDEs)
2586          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)
2587          mypde.setInitialSolution([1.,2.])          mypde.setInitialSolution([1.,2.])
2588    
     def test_setInitialSolution_system(self):  
         mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)  
         self.failUnlessRaises(RuntimeError, mypde.setInitialSolution,[-1,2.])  
   
2589      def test_setInitialSolution_system_WithWrongShape(self):      def test_setInitialSolution_system_WithWrongShape(self):
2590          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)
2591          self.failUnlessRaises(ValueError, mypde.setInitialSolution,1.)          self.failUnlessRaises(ValueError, mypde.setInitialSolution,1.)
2592    
   
2593      def test_attemptToChangeOrderAfterDefinedCoefficient(self):      def test_attemptToChangeOrderAfterDefinedCoefficient(self):
2594          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2595          mypde.setValue(D=1.)          mypde.setValue(D=1.)

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

  ViewVC Help
Powered by ViewVC 1.1.26