/[escript]/trunk/escript/test/python/test_linearPDEs.py
ViewVC logotype

Diff of /trunk/escript/test/python/test_linearPDEs.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 386 by gross, Fri Dec 2 06:04:06 2005 UTC revision 387 by gross, Tue Dec 20 00:37:20 2005 UTC
# Line 447  class Test_LinearPDE(Test_linearPDEs): Line 447  class Test_LinearPDE(Test_linearPDEs):
447      def test_PCG_JACOBI(self):      def test_PCG_JACOBI(self):
448          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
449          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
450          mypde.setSolverMethod(mypde.PCG)          mypde.setSolverMethod(mypde.PCG,mypde.JACOBI)
451          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.JACOBI)          u=mypde.getSolution(verbose=self.VERBOSE)
452          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
453      def test_PCG_ILU0(self):      def test_PCG_ILU0(self):
454          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
455          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
456          mypde.setSolverMethod(mypde.PCG)          mypde.setSolverMethod(mypde.PCG,mypde.ILU0)
457          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.ILU0)          u=mypde.getSolution(verbose=self.VERBOSE)
458          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
459      def test_DIRECT(self):      def test_DIRECT(self):
460          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 464  class Test_LinearPDE(Test_linearPDEs): Line 464  class Test_LinearPDE(Test_linearPDEs):
464          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
465      def test_BICGSTAB_JACOBI(self):      def test_BICGSTAB_JACOBI(self):
466          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
467      mypde.setSolverMethod(mypde.BICGSTAB)      mypde.setSolverMethod(mypde.BICGSTAB,mypde.JACOBI)
468          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
469          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.JACOBI)          u=mypde.getSolution(verbose=self.VERBOSE)
470          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
471      def test_BICGSTAB_ILU0(self):      def test_BICGSTAB_ILU0(self):
472          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
473          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
474      mypde.setSolverMethod(mypde.BICGSTAB)      mypde.setSolverMethod(mypde.BICGSTAB,mypde.ILU0)
475          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.ILU0)          u=mypde.getSolution(verbose=self.VERBOSE)
476          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
477      def test_PRES20_JACOBI(self):      def test_PRES20_JACOBI(self):
478          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
479          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
480      mypde.setSolverMethod(mypde.PRES20)      mypde.setSolverMethod(mypde.PRES20,mypde.JACOBI)
481          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.JACOBI)          u=mypde.getSolution(verbose=self.VERBOSE)
482          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
483      def test_PRES20_ILU0(self):      def test_PRES20_ILU0(self):
484          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
485          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
486      mypde.setSolverMethod(mypde.PRES20)      mypde.setSolverMethod(mypde.PRES20,mypde.ILU0)
487          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.ILU0)          u=mypde.getSolution(verbose=self.VERBOSE)
488          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
489      def test_GMRESnoRestart_JACOBI(self):      def test_GMRESnoRestart_JACOBI(self):
490          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
491          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
492      mypde.setSolverMethod(mypde.GMRES)      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)
493          # u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.JACOBI,truncation=5)          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
494          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.JACOBI)          u=mypde.getSolution(verbose=self.VERBOSE)
495          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
496      def test_GMRESnoRestart_ILU0(self):      def test_GMRESnoRestart_ILU0(self):
497          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
498          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
499      mypde.setSolverMethod(mypde.GMRES)      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)
500          # u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.ILU0,truncation=5)          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
501          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.ILU0)          u=mypde.getSolution(verbose=self.VERBOSE)
502          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
503      def test_GMRES_JACOBI(self):      def test_GMRES_JACOBI(self):
504          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
505          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
506      mypde.setSolverMethod(mypde.GMRES)      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)
507          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.JACOBI)          u=mypde.getSolution(verbose=self.VERBOSE)
508          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
509      def test_GMRES_ILU0(self):      def test_GMRES_ILU0(self):
510          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
511          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
512      mypde.setSolverMethod(mypde.GMRES)      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)
513          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.ILU0)          u=mypde.getSolution(verbose=self.VERBOSE)
514          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
515      def test_GMRES_truncation_restart_JACOBI(self):      def test_GMRES_truncation_restart_JACOBI(self):
516          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
517          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
518      mypde.setSolverMethod(mypde.GMRES)      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)
519          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.JACOBI,truncation=10,restart=20)          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)
520          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
521      def test_GMRES_truncation_restart_ILU0(self):      def test_GMRES_truncation_restart_ILU0(self):
522          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
523          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
524      mypde.setSolverMethod(mypde.GMRES)      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)
525          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.ILU0,truncation=10,restart=20)          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)
526          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
527      def test_Lumping_attemptToSetA(self):      def test_Lumping_attemptToSetA(self):
528          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 559  class Test_LinearPDE(Test_linearPDEs): Line 559  class Test_LinearPDE(Test_linearPDEs):
559          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
560      mypde.setSolverMethod(mypde.LUMPING)      mypde.setSolverMethod(mypde.LUMPING)
561          mypde.setValue(D=1.,Y=1.)          mypde.setValue(D=1.,Y=1.)
562          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.ILU0)          u=mypde.getSolution(verbose=self.VERBOSE)
563          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
564      def test_Constrained_Lumping(self):      def test_Constrained_Lumping(self):
565          x=self.domain.getX()          x=self.domain.getX()
566          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
567      mypde.setSolverMethod(mypde.LUMPING)      mypde.setSolverMethod(mypde.LUMPING)
568          mypde.setValue(D=1.,Y=1.,q=whereZero(x[0]),r=1.)          mypde.setValue(D=1.,Y=1.,q=whereZero(x[0]),r=1.)
569          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.ILU0)          u=mypde.getSolution(verbose=self.VERBOSE)
570          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
571      def test_Lumping_updateRHS(self):      def test_Lumping_updateRHS(self):
572          x=self.domain.getX()          x=self.domain.getX()
573          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
574      mypde.setSolverMethod(mypde.LUMPING)      mypde.setSolverMethod(mypde.LUMPING)
575          mypde.setValue(D=1.,Y=1.)          mypde.setValue(D=1.,Y=1.)
576          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.ILU0)          u=mypde.getSolution(verbose=self.VERBOSE)
577          self.failUnless(self.check(u,1.),'first solution is wrong.')          self.failUnless(self.check(u,1.),'first solution is wrong.')
578          mypde.setValue(Y=2.,q=whereZero(x[0]),r=2.)          mypde.setValue(Y=2.,q=whereZero(x[0]),r=2.)
579          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.ILU0)          u=mypde.getSolution(verbose=self.VERBOSE)
580          self.failUnless(self.check(u,2.),'second solution is wrong.')          self.failUnless(self.check(u,2.),'second solution is wrong.')
581      def test_Lumping_updateOperator(self):      def test_Lumping_updateOperator(self):
582          x=self.domain.getX()          x=self.domain.getX()
583          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
584      mypde.setSolverMethod(mypde.LUMPING)      mypde.setSolverMethod(mypde.LUMPING)
585          mypde.setValue(D=1.,Y=1.)          mypde.setValue(D=1.,Y=1.)
586          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.ILU0)          u=mypde.getSolution(verbose=self.VERBOSE)
587          mypde.setValue(D=2.)          mypde.setValue(D=2.)
588          u=mypde.getSolution(verbose=self.VERBOSE,preconditioner=mypde.ILU0)          u=mypde.getSolution(verbose=self.VERBOSE)
589          self.failUnless(self.check(u,0.5),'second solution is wrong.')          self.failUnless(self.check(u,0.5),'second solution is wrong.')
590    

Legend:
Removed from v.386  
changed lines
  Added in v.387

  ViewVC Help
Powered by ViewVC 1.1.26