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

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 --------------------------------
385            self.failUnless(Lsup(g_ex-g)<REL_TOL*Lsup(g_ex))
386            # -------- set-up PDE -----------------------------------
387            pde=LinearPDE(domain,numEquations=1)
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__':