/[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 1702 by ksteube, Thu May 22 22:52:41 2008 UTC revision 1703 by artak, Thu Aug 14 05:34:25 2008 UTC
# Line 368  class SimpleSolve_Brick_Order2_SystemPDE Line 368  class SimpleSolve_Brick_Order2_SystemPDE
368          # -------- test the solution ---------------------------          # -------- test the solution ---------------------------
369          error=Lsup(u-u_ex)/Lsup(u_ex)          error=Lsup(u-u_ex)/Lsup(u_ex)
370          self.failUnless(error<REL_TOL*Lsup(u_ex), "solution error %s is too big."%error)          self.failUnless(error<REL_TOL*Lsup(u_ex), "solution error %s is too big."%error)
371    
372    class SimpleSolve_Rectangle_Order1_SinglePDE_Paso_TFQMR_Jacobi(unittest.TestCase):
373         def test_solve(self):
374            domain=Rectangle(NE0,NE1,1, optimize=OPTIMIZE)
375            x=Solution(domain).getX()
376            # --- set exact solution ----
377            u_ex=Scalar(0,Solution(domain))
378            u_ex=1.+2.*x[0]+3.*x[1]
379            # --- set exact gradient -----------
380            g_ex=Data(0.,(2,),Solution(domain))
381            g_ex[0]=2.
382            g_ex[1]=3.
383            # -------- test gradient --------------------------------
384            g=grad(u_ex)
385            self.failUnless(Lsup(g_ex-g)<REL_TOL*Lsup(g_ex))
386            # -------- set-up PDE -----------------------------------
387            pde=LinearPDE(domain,numEquations=1)
388            mask=whereZero(x[0])
389            pde.setValue(r=u_ex,q=mask)
390            pde.setValue(A=kronecker(2),y=inner(g_ex,domain.getNormal()))
391            # -------- get the solution ---------------------------
392            pde.setTolerance(SOLVER_TOL)
393            pde.setSolverMethod(pde.TFQMR,pde.JACOBI)
394            pde.setSolverPackage(pde.PASO)
395            u=pde.getSolution(verbose=SOLVER_VERBOSE)
396            # -------- test the solution ---------------------------
397            error=Lsup(u-u_ex)/Lsup(u_ex)
398            self.failUnless(error<REL_TOL*Lsup(u_ex), "solution error %s is too big."%error)
399                    
400  if __name__ == '__main__':  if __name__ == '__main__':
401     suite = unittest.TestSuite()     suite = unittest.TestSuite()
# Line 380  if __name__ == '__main__': Line 408  if __name__ == '__main__':
408     suite.addTest(unittest.makeSuite(SimpleSolve_Brick_Order1_SystemPDE_Paso_PCG_Jacobi))     suite.addTest(unittest.makeSuite(SimpleSolve_Brick_Order1_SystemPDE_Paso_PCG_Jacobi))
409     suite.addTest(unittest.makeSuite(SimpleSolve_Brick_Order2_SinglePDE_Paso_PCG_Jacobi))     suite.addTest(unittest.makeSuite(SimpleSolve_Brick_Order2_SinglePDE_Paso_PCG_Jacobi))
410     suite.addTest(unittest.makeSuite(SimpleSolve_Brick_Order2_SystemPDE_Paso_PCG_Jacobi))     suite.addTest(unittest.makeSuite(SimpleSolve_Brick_Order2_SystemPDE_Paso_PCG_Jacobi))
411       suite.addTest(unittest.makeSuite(SimpleSolve_Rectangle_Order1_SinglePDE_Paso_TFQMR_Jacobi))
412    
413     s=unittest.TextTestRunner(verbosity=2).run(suite)     s=unittest.TextTestRunner(verbosity=2).run(suite)
414     if not s.wasSuccessful(): sys.exit(1)     if not s.wasSuccessful(): sys.exit(1)

Legend:
Removed from v.1702  
changed lines
  Added in v.1703

  ViewVC Help
Powered by ViewVC 1.1.26