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

Diff of /trunk/esys2/finley/test/python/SolveTest.py

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

revision 113 by jgs, Mon Feb 28 07:06:33 2005 UTC revision 115 by jgs, Fri Mar 4 07:12:47 2005 UTC
# Line 25  len_x0=1. Line 25  len_x0=1.
25  alpha=0.1  alpha=0.1
26    
27  #############################################################################################################3  #############################################################################################################3
28  def solveVector(numDim, totalNumElem, len_x0, alpha, solver_method):  def solveVector(numDim, totalNumElem, len_x0, alpha, solver_method,prec):
29    
30      print "Vector solver:"      print "Vector solver:"
31      recDim=array([len_x0,1.,1.])      recDim=array([len_x0,1.,1.])
# Line 77  def solveVector(numDim, totalNumElem, le Line 77  def solveVector(numDim, totalNumElem, le
77      mypde.setSolverMethod(solver_method)      mypde.setSolverMethod(solver_method)
78    
79      # Solve for Approximate Solution      # Solve for Approximate Solution
80      u_approx = mypde.getSolution(iter_max=10000)      u_approx = mypde.getSolution(preconditioner=prec,iter_max=10000)
81    
82      # Report Results      # Report Results
83      error=Lsup(u - u_approx)/Lsup(u)      error=Lsup(u - u_approx)/Lsup(u)
# Line 88  def solveVector(numDim, totalNumElem, le Line 88  def solveVector(numDim, totalNumElem, le
88    
89  #################################################################################################################  #################################################################################################################
90    
91  def solveScalar(numDim, totalNumElem, len_x0, alpha, solver_method):  def solveScalar(numDim, totalNumElem, len_x0, alpha, solver_method,prec):
92    
93      print "Scalar solver:"      print "Scalar solver:"
94      recDim=array([len_x0,1.,1.])      recDim=array([len_x0,1.,1.])
# Line 131  def solveScalar(numDim, totalNumElem, le Line 131  def solveScalar(numDim, totalNumElem, le
131      mypde.setSolverMethod(solver_method)      mypde.setSolverMethod(solver_method)
132    
133      # Solve for Approximate Solution      # Solve for Approximate Solution
134      u_approx = mypde.getSolution(iter_max=10000)      u_approx = mypde.getSolution(preconditioner=prec,iter_max=10000)
135    
136      # Report Results      # Report Results
137      error=Lsup(u - u_approx)/Lsup(u)      error=Lsup(u - u_approx)/Lsup(u)
# Line 146  def solveScalar(numDim, totalNumElem, le Line 146  def solveScalar(numDim, totalNumElem, le
146  print "Test is started:"  print "Test is started:"
147  print "----------------"  print "----------------"
148  error=0.  error=0.
149  for numDim in [2,3]:  # for numDim in [2,3]:
150     for totalNumElem in [100, 200, 400, 800, 1600, 3200, 6400]:  for numDim in [3]:
151        # for totalNumElem in [100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400]:     for totalNumElem in [100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400]:
152        for problem in [solveScalar,solveVector]:        # for problem in [solveScalar,solveVector]:
153          for problem in [solveScalar]:
154           # for solver_method in [ LinearPDE.PRES20, LinearPDE.PCG, LinearPDE.DIRECT, LinearPDE.BICGSTAB]:           # for solver_method in [ LinearPDE.PRES20, LinearPDE.PCG, LinearPDE.DIRECT, LinearPDE.BICGSTAB]:
155           for solver_method in [ LinearPDE.PCG ]:           for solver_method in [ LinearPDE.PCG ]:
156              error=max([problem(numDim, totalNumElem, len_x0, alpha, solver_method),error])              # for prec in [ LinearPDE.JACOBI, LinearPDE.ILU0 ]:
157                for prec in [ LinearPDE.ILU0 ]:
158                   error=max([problem(numDim, totalNumElem, len_x0, alpha, solver_method,prec),error])
159  print "----------------"  print "----------------"
160  print "maximum error over all tests is ",error  print "maximum error over all tests is ",error
161  print "----------------"  print "----------------"

Legend:
Removed from v.113  
changed lines
  Added in v.115

  ViewVC Help
Powered by ViewVC 1.1.26