/[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 3892 by jfenwick, Tue Apr 10 08:57:23 2012 UTC revision 3906 by jfenwick, Thu Jun 7 11:00:50 2012 UTC
# Line 28  Test suite for linearPDEs class Line 28  Test suite for linearPDEs class
28  __author__="Lutz Gross, l.gross@uq.edu.au"  __author__="Lutz Gross, l.gross@uq.edu.au"
29    
30  from esys.escript.util import Lsup,kronecker,interpolate,whereZero, outer, swap_axes  from esys.escript.util import Lsup,kronecker,interpolate,whereZero, outer, swap_axes
31  from esys.escript import Function,FunctionOnBoundary,FunctionOnContactZero,Solution,ReducedSolution,Vector,ContinuousFunction,Scalar, ReducedFunction,ReducedFunctionOnBoundary,ReducedFunctionOnContactZero,Data, Tensor4, Tensor  from esys.escript import Function,FunctionOnBoundary,FunctionOnContactZero,Solution,ReducedSolution,Vector,ContinuousFunction,Scalar, ReducedFunction,ReducedFunctionOnBoundary,ReducedFunctionOnContactZero,Data, Tensor4, Tensor, getEscriptParamInt
32  from esys.escript.linearPDEs import LinearPDE,IllegalCoefficientValue,Poisson, IllegalCoefficientFunctionSpace, TransportPDE, IllegalCoefficient, Helmholtz, LameEquation, SolverOptions  from esys.escript.linearPDEs import LinearPDE,IllegalCoefficientValue,Poisson, IllegalCoefficientFunctionSpace, TransportPDE, IllegalCoefficient, Helmholtz, LameEquation, SolverOptions
33  import numpy  import numpy
34  import unittest  import unittest
# Line 838  class Test_LinearPDE_noLumping(Test_line Line 838  class Test_LinearPDE_noLumping(Test_line
838          self.assertTrue(so.getPreconditioner() == 9, "ILUT is not set.")          self.assertTrue(so.getPreconditioner() == 9, "ILUT is not set.")
839          so.setPreconditioner(so.JACOBI)          so.setPreconditioner(so.JACOBI)
840          self.assertTrue(so.getPreconditioner() == 10, "JACOBI is not set.")          self.assertTrue(so.getPreconditioner() == 10, "JACOBI is not set.")
841          so.setPreconditioner(so.AMG)          if getEscriptParamInt('DISABLE_AMG', 0):
842          self.assertTrue(so.getPreconditioner() == 22, "AMG is not set.")          print("AMG test disabled on MPI build")
843        else:
844                so.setPreconditioner(so.AMG)
845                self.assertTrue(so.getPreconditioner() == 22, "AMG is not set.")
846          so.setPreconditioner(so.REC_ILU)          so.setPreconditioner(so.REC_ILU)
847          self.assertTrue(so.getPreconditioner() == 23, "REC_ILU is not set.")          self.assertTrue(so.getPreconditioner() == 23, "REC_ILU is not set.")
848          so.setPreconditioner(so.GAUSS_SEIDEL)          so.setPreconditioner(so.GAUSS_SEIDEL)
# Line 1623  class Test_LinearPDE_noLumping(Test_line Line 1626  class Test_LinearPDE_noLumping(Test_line
1626          self.assertTrue(self.check(u,1.),'solution is wrong.')          self.assertTrue(self.check(u,1.),'solution is wrong.')
1627      def test_PCG_AMG(self):      def test_PCG_AMG(self):
1628          if self.order!=2:          if self.order!=2:
1629                if getEscriptParamInt('DISABLE_AMG', 0):
1630                    print("AMG test disabled on MPI build")
1631                    return
1632              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1633              mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)              mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1634              mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)              mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
# Line 1679  class Test_LinearPDE_noLumping(Test_line Line 1685  class Test_LinearPDE_noLumping(Test_line
1685          self.assertTrue(self.check(u,1.),'solution is wrong.')          self.assertTrue(self.check(u,1.),'solution is wrong.')
1686      def test_BICGSTAB_AMG(self):      def test_BICGSTAB_AMG(self):
1687          if self.order!=2:          if self.order!=2:
1688                if getEscriptParamInt('DISABLE_AMG', 0):
1689                    print("AMG test disabled on MPI build")
1690                    return    
1691              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1692              mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)              mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1693              mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)              mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
# Line 1728  class Test_LinearPDE_noLumping(Test_line Line 1737  class Test_LinearPDE_noLumping(Test_line
1737          self.assertTrue(self.check(u,1.),'solution is wrong.')          self.assertTrue(self.check(u,1.),'solution is wrong.')
1738      def test_MINRES_AMG(self):      def test_MINRES_AMG(self):
1739          if self.order!=2:          if self.order!=2:
1740                if getEscriptParamInt('DISABLE_AMG',0):
1741                    print("AMG test disabled on MPI build")
1742                    return                
1743              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1744              mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)              mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1745              mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)              mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
# Line 1777  class Test_LinearPDE_noLumping(Test_line Line 1789  class Test_LinearPDE_noLumping(Test_line
1789          self.assertTrue(self.check(u,1.),'solution is wrong.')          self.assertTrue(self.check(u,1.),'solution is wrong.')
1790      def test_TFQMR_AMG(self):      def test_TFQMR_AMG(self):
1791          if self.order!=2:          if self.order!=2:
1792                if getEscriptParamInt('DISABLE_AMG', 0):
1793                    print("AMG test disabled on MPI build")
1794                    return
1795              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1796              mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)              mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1797              mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)              mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
# Line 1826  class Test_LinearPDE_noLumping(Test_line Line 1841  class Test_LinearPDE_noLumping(Test_line
1841          self.assertTrue(self.check(u,1.),'solution is wrong.')          self.assertTrue(self.check(u,1.),'solution is wrong.')
1842      def test_PRES20_AMG(self):      def test_PRES20_AMG(self):
1843          if self.order!=2:          if self.order!=2:
1844                if getEscriptParamInt('DISABLE_AMG', 0):
1845                    print("AMG test disabled on MPI build")
1846                    return
1847              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1848              mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)              mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1849              mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)              mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
# Line 1877  class Test_LinearPDE_noLumping(Test_line Line 1895  class Test_LinearPDE_noLumping(Test_line
1895          self.assertTrue(self.check(u,1.),'solution is wrong.')          self.assertTrue(self.check(u,1.),'solution is wrong.')
1896      def test_GMRESnoRestart_AMG(self):      def test_GMRESnoRestart_AMG(self):
1897          if self.order!=2:          if self.order!=2:
1898                if getEscriptParamInt('DISABLE_AMG', 0):
1899                    print("AMG test disabled on MPI build")
1900                    return    
1901              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1902              mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)              mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1903              mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)              mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
# Line 1930  class Test_LinearPDE_noLumping(Test_line Line 1951  class Test_LinearPDE_noLumping(Test_line
1951          self.assertTrue(self.check(u,1.),'solution is wrong.')          self.assertTrue(self.check(u,1.),'solution is wrong.')
1952      def test_GMRES_AMG(self):      def test_GMRES_AMG(self):
1953          if self.order!=2:          if self.order!=2:
1954                if getEscriptParamInt('DISABLE_AMG', 0):
1955                    print("AMG test disabled on MPI build")
1956                    return    
1957              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1958              mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)              mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1959              mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)              mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
# Line 1983  class Test_LinearPDE_noLumping(Test_line Line 2007  class Test_LinearPDE_noLumping(Test_line
2007          self.assertTrue(self.check(u,1.),'solution is wrong.')          self.assertTrue(self.check(u,1.),'solution is wrong.')
2008      def test_GMRES_truncation_restart_AMG(self):      def test_GMRES_truncation_restart_AMG(self):
2009          if self.order!=2:          if self.order!=2:
2010                if getEscriptParamInt('DISABLE_AMG', 0):
2011                    print("AMG test disabled on MPI build")
2012                    return    
2013              mypde=LinearPDE(self.domain,debug=self.DEBUG)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
2014              mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)              mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2015              mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)              mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
# Line 2084  class Test_LinearPDE_noLumping(Test_line Line 2111  class Test_LinearPDE_noLumping(Test_line
2111          self.assertTrue(self.check(u,1.),'solution is wrong.')          self.assertTrue(self.check(u,1.),'solution is wrong.')
2112      def test_PCG_AMG_System(self):      def test_PCG_AMG_System(self):
2113          if self.order!=2:          if self.order!=2:
2114                if getEscriptParamInt('DISABLE_AMG', 0):
2115                    print("AMG test disabled on MPI build")
2116                    return
2117              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
2118              D=Tensor(1.,Function(self.domain))              D=Tensor(1.,Function(self.domain))
2119              Y=Vector(self.domain.getDim(),Function(self.domain))              Y=Vector(self.domain.getDim(),Function(self.domain))
# Line 2159  class Test_LinearPDE_noLumping(Test_line Line 2189  class Test_LinearPDE_noLumping(Test_line
2189          self.assertTrue(self.check(u,1.),'solution is wrong.')          self.assertTrue(self.check(u,1.),'solution is wrong.')
2190      def test_BICGSTAB_AMG_System(self):      def test_BICGSTAB_AMG_System(self):
2191          if self.order!=2:          if self.order!=2:
2192                if getEscriptParamInt('DISABLE_AMG', 0):
2193                    print("AMG test disabled on MPI build")
2194                    return    
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))
2197              Y=Vector(self.domain.getDim(),Function(self.domain))              Y=Vector(self.domain.getDim(),Function(self.domain))
# Line 2220  class Test_LinearPDE_noLumping(Test_line Line 2253  class Test_LinearPDE_noLumping(Test_line
2253          self.assertTrue(self.check(u,1.),'solution is wrong.')          self.assertTrue(self.check(u,1.),'solution is wrong.')
2254      def test_PRES20_AMG_System(self):      def test_PRES20_AMG_System(self):
2255          if self.order!=2:          if self.order!=2:
2256                if getEscriptParamInt('DISABLE_AMG', 0):
2257                    print("AMG test disabled on MPI build")
2258                    return
2259              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
2260              D=Tensor(1.,Function(self.domain))              D=Tensor(1.,Function(self.domain))
2261              Y=Vector(self.domain.getDim(),Function(self.domain))              Y=Vector(self.domain.getDim(),Function(self.domain))
# Line 2283  class Test_LinearPDE_noLumping(Test_line Line 2319  class Test_LinearPDE_noLumping(Test_line
2319          self.assertTrue(self.check(u,1.),'solution is wrong.')          self.assertTrue(self.check(u,1.),'solution is wrong.')
2320      def test_GMRESnoRestart_AMG_System(self):      def test_GMRESnoRestart_AMG_System(self):
2321          if self.order!=2:          if self.order!=2:
2322                if getEscriptParamInt('DISABLE_AMG',0):
2323                    print("AMG test disabled on MPI build")
2324                    return        
2325              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
2326              D=Tensor(1.,Function(self.domain))              D=Tensor(1.,Function(self.domain))
2327              Y=Vector(self.domain.getDim(),Function(self.domain))              Y=Vector(self.domain.getDim(),Function(self.domain))
# Line 2346  class Test_LinearPDE_noLumping(Test_line Line 2385  class Test_LinearPDE_noLumping(Test_line
2385          self.assertTrue(self.check(u,1.),'solution is wrong.')          self.assertTrue(self.check(u,1.),'solution is wrong.')
2386      def test_GMRES_AMG_System(self):      def test_GMRES_AMG_System(self):
2387          if self.order!=2:          if self.order!=2:
2388                if getEscriptParamInt('DISABLE_AMG', 0):
2389                    print("AMG test disabled on MPI build")
2390                    return    
2391              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
2392              D=Tensor(1.,Function(self.domain))              D=Tensor(1.,Function(self.domain))
2393              Y=Vector(self.domain.getDim(),Function(self.domain))              Y=Vector(self.domain.getDim(),Function(self.domain))
# Line 2411  class Test_LinearPDE_noLumping(Test_line Line 2453  class Test_LinearPDE_noLumping(Test_line
2453          self.assertTrue(self.check(u,1.),'solution is wrong.')          self.assertTrue(self.check(u,1.),'solution is wrong.')
2454      def test_GMRES_truncation_restart_AMG_System(self):      def test_GMRES_truncation_restart_AMG_System(self):
2455          if self.order!=2:          if self.order!=2:
2456                if getEscriptParamInt('DISABLE_AMG', 0):
2457                    print("AMG test disabled on MPI build")
2458                    return    
2459              A=Tensor4(0.,Function(self.domain))              A=Tensor4(0.,Function(self.domain))
2460              D=Tensor(1.,Function(self.domain))              D=Tensor(1.,Function(self.domain))
2461              Y=Vector(self.domain.getDim(),Function(self.domain))              Y=Vector(self.domain.getDim(),Function(self.domain))

Legend:
Removed from v.3892  
changed lines
  Added in v.3906

  ViewVC Help
Powered by ViewVC 1.1.26