/[escript]/trunk/finley/test/python/run_simplesolve.py
ViewVC logotype

Diff of /trunk/finley/test/python/run_simplesolve.py

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

revision 1424 by trankine, Fri Jan 11 07:45:58 2008 UTC revision 1425 by artak, Wed Feb 27 06:12:04 2008 UTC
# Line 66  REL_TOL=1.e-6 Line 66  REL_TOL=1.e-6
66  FAC_DIAG=1.  FAC_DIAG=1.
67  FAC_OFFDIAG=-0.4  FAC_OFFDIAG=-0.4
68    
69    class SimpleSolve_Rectangle_Order1_SinglePDE_Paso_BICGSTAB_Jacobi(unittest.TestCase):
70         def test_solve(self):
71            domain=Rectangle(NE0,NE1,1, optimize=OPTIMIZE)
72            x=Solution(domain).getX()
73            # --- set exact solution ----
74            u_ex=Scalar(0,Solution(domain))
75            u_ex=1.+2.*x[0]+3.*x[1]
76            # --- set exact gradient -----------
77            g_ex=Data(0.,(2,),Solution(domain))
78            g_ex[0]=2.
79            g_ex[1]=3.
80            # -------- test gradient --------------------------------
81            g=grad(u_ex)
82            self.failUnless(Lsup(g_ex-g)<REL_TOL*Lsup(g_ex))
83            # -------- set-up PDE -----------------------------------
84            pde=LinearPDE(domain,numEquations=1)
85            mask=whereZero(x[0])
86            pde.setValue(r=u_ex,q=mask)
87            pde.setValue(A=kronecker(2),y=inner(g_ex,domain.getNormal()))
88            # -------- get the solution ---------------------------
89            pde.setTolerance(SOLVER_TOL)
90            pde.setSolverMethod(pde.BICGSTAB,pde.JACOBI)
91            pde.setSolverPackage(pde.PASO)
92            u=pde.getSolution(verbose=SOLVER_VERBOSE)
93            # -------- test the solution ---------------------------
94            error=Lsup(u-u_ex)/Lsup(u_ex)
95            self.failUnless(error<REL_TOL*Lsup(u_ex), "solution error %s is too big."%error)
96  class SimpleSolve_Rectangle_Order1_SinglePDE_Paso_PCG_Jacobi(unittest.TestCase):  class SimpleSolve_Rectangle_Order1_SinglePDE_Paso_PCG_Jacobi(unittest.TestCase):
97       def test_solve(self):       def test_solve(self):
98          domain=Rectangle(NE0,NE1,1, optimize=OPTIMIZE)          domain=Rectangle(NE0,NE1,1, optimize=OPTIMIZE)
# Line 340  class SimpleSolve_Brick_Order2_SystemPDE Line 367  class SimpleSolve_Brick_Order2_SystemPDE
367                    
368  if __name__ == '__main__':  if __name__ == '__main__':
369     suite = unittest.TestSuite()     suite = unittest.TestSuite()
370       suite.addTest(unittest.makeSuite(SimpleSolve_Rectangle_Order1_SinglePDE_Paso_BICGSTAB_Jacobi))
371     suite.addTest(unittest.makeSuite(SimpleSolve_Rectangle_Order1_SinglePDE_Paso_PCG_Jacobi))     suite.addTest(unittest.makeSuite(SimpleSolve_Rectangle_Order1_SinglePDE_Paso_PCG_Jacobi))
372     suite.addTest(unittest.makeSuite(SimpleSolve_Rectangle_Order1_SystemPDE_Paso_PCG_Jacobi))     suite.addTest(unittest.makeSuite(SimpleSolve_Rectangle_Order1_SystemPDE_Paso_PCG_Jacobi))
373     suite.addTest(unittest.makeSuite(SimpleSolve_Rectangle_Order2_SinglePDE_Paso_PCG_Jacobi))     suite.addTest(unittest.makeSuite(SimpleSolve_Rectangle_Order2_SinglePDE_Paso_PCG_Jacobi))

Legend:
Removed from v.1424  
changed lines
  Added in v.1425

  ViewVC Help
Powered by ViewVC 1.1.26