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

trunk/esys2/finley/test/python/SolveTest.py revision 126 by jgs, Fri Jul 22 03:53:08 2005 UTC trunk/finley/test/python/SolveTest.py revision 617 by elspeth, Wed Mar 22 02:58:17 2006 UTC
# Line 14  Line 14
14
15  """  """
16
18                        http://www.access.edu.au
22  from esys.escript import *  from esys.escript import *
23  from esys.linearPDEs import *  from esys.escript.linearPDEs import *
24  import esys.finley as pdelib  import esys.finley as pdelib
25  from time import time  from time import time
26
# Line 62  def solveVector(numDim, totalNumElem, le Line 67  def solveVector(numDim, totalNumElem, le
67      # Set Boundary Mask / pdelib Template "q" Parameter Vector      # Set Boundary Mask / pdelib Template "q" Parameter Vector
68      bndryMask = Vector(value = 0, what = contfunc)      bndryMask = Vector(value = 0, what = contfunc)
69      for i in range(meshDim):      for i in range(meshDim):
70          bndryMask += (x[i].whereZero() + (x[i]-recDim[i]).whereZero()) \          bndryMask += (whereZero(x[i]) + whereZero(x[i]-recDim[i])) \
71                  * ones((numDim,))                  * ones((numDim,))
72
73      # Set True Solution / pdelib Template "r" Parameter Vector      # Set True Solution / pdelib Template "r" Parameter Vector
# Line 86  def solveVector(numDim, totalNumElem, le Line 91  def solveVector(numDim, totalNumElem, le
91
92      # Solve for Approximate Solution      # Solve for Approximate Solution
93      tm=time()      tm=time()
94      u_approx = mypde.getSolution(preconditioner=prec_id,iter_max=10000)      u_approx = mypde.getSolution(verbose=True,preconditioner=prec_id,iter_max=10000)
95      tm=time()-tm      tm=time()-tm
96
97      # Report Results      # Report Results
# Line 132  def solveScalar(numDim, totalNumElem, le Line 137  def solveScalar(numDim, totalNumElem, le
137      # Set Boundary Mask / pdelib Template "q" Parameter Vector      # Set Boundary Mask / pdelib Template "q" Parameter Vector
138      bndryMask = Scalar(value = 0, what = contfunc)      bndryMask = Scalar(value = 0, what = contfunc)
139      for i in range(meshDim):      for i in range(meshDim):
140          bndryMask += (x[i].whereZero() + (x[i]-recDim[i]).whereZero()) * 1.0          bndryMask += (whereZero(x[i]) + whereZero(x[i]-recDim[i])) * 1.0
141
142      # Set True Solution / pdelib Template "r" Parameter Vector      # Set True Solution / pdelib Template "r" Parameter Vector
143      u = Scalar(value = 0, what = contfunc)      u = Scalar(value = 0, what = contfunc)
# Line 146  def solveScalar(numDim, totalNumElem, le Line 151  def solveScalar(numDim, totalNumElem, le
151
152      # Solve for Approximate Solution      # Solve for Approximate Solution
153      tm=time()      tm=time()
154      u_approx = mypde.getSolution(preconditioner=prec_id,iter_max=10000)      u_approx = mypde.getSolution(verbose=True,preconditioner=prec_id,iter_max=10000)
155      tm=time()-tm      tm=time()-tm
156
157      # Report Results      # Report Results
# Line 166  for numDim in [2, 3]: Line 171  for numDim in [2, 3]:
171     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]:
172        for problem in [solveScalar,solveVector]:        for problem in [solveScalar,solveVector]:
173        #for problem in [solveVector]:        #for problem in [solveVector]:
174           # error=max([problem(numDim, totalNumElem, len_x0, alpha,"PCG",""),error])           error=max([problem(numDim, totalNumElem, len_x0, alpha,"PCG",""),error])
175           error=max([problem(numDim, totalNumElem, len_x0, alpha,"DIRECT",""),error])           error=max([problem(numDim, totalNumElem, len_x0, alpha,"DIRECT",""),error])
176           #if totalNumElem*2**numDim*numDim< 200000: error=max([problem(numDim, totalNumElem, len_x0, alpha,"DIRECT",""),error])           #if totalNumElem*2**numDim*numDim< 200000: error=max([problem(numDim, totalNumElem, len_x0, alpha,"DIRECT",""),error])
177           # for solver_method in [ "PCG" ]:           # for solver_method in [ "PCG" ]:

Legend:
 Removed from v.126 changed lines Added in v.617