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

revision 117 by jgs, Fri Apr 1 05:48:57 2005 UTC revision 153 by jgs, Tue Oct 25 01:51:20 2005 UTC
# Line 15  Line 15
15  """  """
16
17  from esys.escript import *  from esys.escript import *
18  from esys.linearPDEs import *  from esys.escript.linearPDEs import *
19  import esys.finley as pdelib  import esys.finley as pdelib
20  from time import time  from time import time
21
# Line 82  def solveVector(numDim, totalNumElem, le Line 82  def solveVector(numDim, totalNumElem, le
82      mypde=LinearPDE(mesh)      mypde=LinearPDE(mesh)
83      mypde.setValue(A = A, Y = - 2 * alpha * (meshDim - 1)*ones(meshDim), q = bndryMask, r = u)      mypde.setValue(A = A, Y = - 2 * alpha * (meshDim - 1)*ones(meshDim), q = bndryMask, r = u)
84      mypde.setSolverMethod(solver_method_id)      mypde.setSolverMethod(solver_method_id)
85        # mypde.getOperator().saveMM("g.mm")
86
87      # Solve for Approximate Solution      # Solve for Approximate Solution
88      tm=time()      tm=time()
89      u_approx = mypde.getSolution(preconditioner=prec_id,iter_max=10000)      u_approx = mypde.getSolution(verbose=True,preconditioner=prec_id,iter_max=10000)
90      tm=time()-tm      tm=time()-tm
91
92      # Report Results      # Report Results
# Line 145  def solveScalar(numDim, totalNumElem, le Line 146  def solveScalar(numDim, totalNumElem, le
146
147      # Solve for Approximate Solution      # Solve for Approximate Solution
148      tm=time()      tm=time()
149      u_approx = mypde.getSolution(preconditioner=prec_id,iter_max=10000)      u_approx = mypde.getSolution(verbose=True,preconditioner=prec_id,iter_max=10000)
150      tm=time()-tm      tm=time()-tm
151
152      # Report Results      # Report Results
# Line 160  def solveScalar(numDim, totalNumElem, le Line 161  def solveScalar(numDim, totalNumElem, le
161  print "Test is started:"  print "Test is started:"
162  print "----------------"  print "----------------"
163  error=0.  error=0.
164  for numDim in [2,3]:  for numDim in [2, 3]:
165       # for totalNumElem in [51200]:
166     for totalNumElem in [100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400,204800]:     for totalNumElem in [100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400,204800]:
167        for problem in [solveScalar,solveVector]:        for problem in [solveScalar,solveVector]:
168           if totalNumElem*2**numDim*numDim< 200000: error=max([problem(numDim, totalNumElem, len_x0, alpha,"DIRECT",""),error])        #for problem in [solveVector]:
169           for solver_method in [ "PCG" ]:           error=max([problem(numDim, totalNumElem, len_x0, alpha,"PCG",""),error])
170              for prec in [ "JACOBI", "ILU0" ]:           error=max([problem(numDim, totalNumElem, len_x0, alpha,"DIRECT",""),error])
171                 error=max([problem(numDim, totalNumElem, len_x0, alpha, solver_method,prec),error])           #if totalNumElem*2**numDim*numDim< 200000: error=max([problem(numDim, totalNumElem, len_x0, alpha,"DIRECT",""),error])
172             # for solver_method in [ "PCG" ]:
173             #    for prec in [ "JACOBI", "ILU0" ]:
174             #       error=max([problem(numDim, totalNumElem, len_x0, alpha, solver_method,prec),error])
175  print "----------------"  print "----------------"
176  print "maximum error over all tests is ",error  print "maximum error over all tests is ",error
177  print "----------------"  print "----------------"

Legend:
 Removed from v.117 changed lines Added in v.153