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

Diff of /trunk/finley/test/python/run_amg.py

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

revision 3439 by plaub, Mon Jan 10 02:06:07 2011 UTC revision 3440 by gross, Fri Jan 14 00:04:53 2011 UTC
# Line 77  class Test_AMG(unittest.TestCase): Line 77  class Test_AMG(unittest.TestCase):
77          # -------- get the solution ---------------------------          # -------- get the solution ---------------------------
78          pde.getSolverOptions().setTolerance(self.SOLVER_TOL)          pde.getSolverOptions().setTolerance(self.SOLVER_TOL)
79          pde.getSolverOptions().setSolverMethod(SolverOptions.PCG)          pde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
80            #if (USE_AMG): pde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
81            pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
82            if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
83            if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
84            if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
85    
86            u=pde.getSolution()
87            # -------- test the solution ---------------------------
88            error=Lsup(u-u_ex)/Lsup(u_ex)
89            self.assertTrue(error<self.RES_TOL, "solution error %s is too big."%error)
90    
91       def test_PoissonWithDirectInterpolation(self):
92            x=Solution(self.domain).getX()
93            # --- set exact solution ----
94            u_ex=Scalar(1,Solution(self.domain))
95            g_ex=Vector(0.,Solution(self.domain))
96            for i in xrange(self.domain.getDim()):
97               u_ex+=(i+1)*x[i]
98               g_ex[i]=(i+1)
99    
100            # create PDE:
101            pde=LinearPDE(self.domain,numEquations=1)
102            pde.setSymmetryOn()
103            mask=whereZero(x[0])
104            pde.setValue(r=u_ex,q=mask)
105            pde.setValue(A=kronecker(self.domain),y=inner(g_ex,self.domain.getNormal()))
106            # -------- get the solution ---------------------------
107            pde.getSolverOptions().setTolerance(self.SOLVER_TOL)
108            pde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
109          if (USE_AMG): pde.getSolverOptions().setPreconditioner(SolverOptions.AMG)          if (USE_AMG): pde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
110            pde.getSolverOptions().setNumPreSweeps(3)
111            pde.getSolverOptions().setNumPostSweeps(3)
112          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
113          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
114          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
115          if MAX_LEVEL!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
116            pde.getSolverOptions().setAMGInterpolation(pde.getSolverOptions().DIRECT_INTERPOLATION)
117    
118            u=pde.getSolution()
119            # -------- test the solution ---------------------------
120            error=Lsup(u-u_ex)/Lsup(u_ex)
121            self.assertTrue(error<self.RES_TOL, "solution error %s is too big."%error)
122    
123       def test_PoissonClassic(self):
124            x=Solution(self.domain).getX()
125            # --- set exact solution ----
126            u_ex=Scalar(1,Solution(self.domain))
127            g_ex=Vector(0.,Solution(self.domain))
128            for i in xrange(self.domain.getDim()):
129               u_ex+=(i+1)*x[i]
130               g_ex[i]=(i+1)
131    
132            # create PDE:
133            pde=LinearPDE(self.domain,numEquations=1)
134            pde.setSymmetryOn()
135            mask=whereZero(x[0])
136            pde.setValue(r=u_ex,q=mask)
137            pde.setValue(A=kronecker(self.domain),y=inner(g_ex,self.domain.getNormal()))
138            # -------- get the solution ---------------------------
139            pde.getSolverOptions().setTolerance(self.SOLVER_TOL)
140            pde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
141            if (USE_AMG): pde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
142            pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
143            pde.getSolverOptions().setNumPreSweeps(3)
144            pde.getSolverOptions().setNumPostSweeps(3)
145            if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
146            if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
147            if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
148            pde.getSolverOptions().setAMGInterpolation(pde.getSolverOptions().CLASSIC_INTERPOLATION)
149    
150            u=pde.getSolution()
151            # -------- test the solution ---------------------------
152            error=Lsup(u-u_ex)/Lsup(u_ex)
153            self.assertTrue(error<self.RES_TOL, "solution error %s is too big."%error)
154    
155       def test_PoissonClassicWithFFCoupling(self):
156            x=Solution(self.domain).getX()
157            # --- set exact solution ----
158            u_ex=Scalar(1,Solution(self.domain))
159            g_ex=Vector(0.,Solution(self.domain))
160            for i in xrange(self.domain.getDim()):
161               u_ex+=(i+1)*x[i]
162               g_ex[i]=(i+1)
163    
164            # create PDE:
165            pde=LinearPDE(self.domain,numEquations=1)
166            pde.setSymmetryOn()
167            mask=whereZero(x[0])
168            pde.setValue(r=u_ex,q=mask)
169            pde.setValue(A=kronecker(self.domain),y=inner(g_ex,self.domain.getNormal()))
170            # -------- get the solution ---------------------------
171            pde.getSolverOptions().setTolerance(self.SOLVER_TOL)
172            pde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
173            if (USE_AMG): pde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
174            pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
175            pde.getSolverOptions().setNumPreSweeps(3)
176            pde.getSolverOptions().setNumPostSweeps(3)
177            if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
178            if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
179            if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
180            pde.getSolverOptions().setAMGInterpolation(pde.getSolverOptions().CLASSIC_INTERPOLATION_WITH_FF_COUPLING)
181    
182          u=pde.getSolution()          u=pde.getSolution()
183          # -------- test the solution ---------------------------          # -------- test the solution ---------------------------
# Line 113  class Test_AMG(unittest.TestCase): Line 209  class Test_AMG(unittest.TestCase):
209          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
210          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
211          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
212          if MAX_LEVEL!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
213    
214          u=pde.getSolution()          u=pde.getSolution()
215          # -------- test the solution ---------------------------          # -------- test the solution ---------------------------
# Line 148  class Test_AMG(unittest.TestCase): Line 244  class Test_AMG(unittest.TestCase):
244          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
245          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
246          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
247          if MAX_LEVEL!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
248    
249          u=pde.getSolution()          u=pde.getSolution()
250          # -------- test the solution ---------------------------          # -------- test the solution ---------------------------
# Line 185  class Test_AMG(unittest.TestCase): Line 281  class Test_AMG(unittest.TestCase):
281          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
282          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
283          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
284          if MAX_LEVEL!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
285    
286          u=pde.getSolution()          u=pde.getSolution()
287          # -------- test the solution ---------------------------          # -------- test the solution ---------------------------
# Line 225  class Test_AMG(unittest.TestCase): Line 321  class Test_AMG(unittest.TestCase):
321          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
322          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
323          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
324          if MAX_LEVEL!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
325    
326            u=pde.getSolution()
327            # -------- test the solution ---------------------------
328            error=Lsup(u-u_ex)/Lsup(u_ex)
329            self.assertTrue(error<self.RES_TOL, "solution error %s is too big."%error)
330       def test_Poisson2Classic(self):
331            x=Solution(self.domain).getX()
332            # --- set exact solution ----
333            u_ex=Data(1.,(2,),Solution(self.domain))
334            g_ex=Data(0.,(2,self.domain.getDim()), Solution(self.domain))
335            A=Data(0.,(2,self.domain.getDim(),2,self.domain.getDim()), Function(self.domain))
336            for i in xrange(self.domain.getDim()):
337               u_ex[0]+= 1*(i+1) *x[i]
338               g_ex[0,i]=1*(i+1)
339               u_ex[1]+= 2*(i+1)*x[i]
340               g_ex[1,i]=2*(i+1)
341               A[0,i,0,i]=1
342               A[1,i,1,i]=1
343    
344            # create PDE:
345            pde=LinearPDE(self.domain,numEquations=2)
346            pde.setSymmetryOn()
347            mask=whereZero(x[0])*[1,1]
348            pde.setValue(r=u_ex,q=mask)
349            pde.setValue(A=A,y=matrixmult(g_ex,self.domain.getNormal()))
350            # -------- get the solution ---------------------------
351            pde.getSolverOptions().setTolerance(self.SOLVER_TOL)
352            pde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
353            if (USE_AMG): pde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
354            pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
355            if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
356            if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
357            if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
358            pde.getSolverOptions().setAMGInterpolation(pde.getSolverOptions().CLASSIC_INTERPOLATION)
359    
360            u=pde.getSolution()
361            # -------- test the solution ---------------------------
362            error=Lsup(u-u_ex)/Lsup(u_ex)
363            self.assertTrue(error<self.RES_TOL, "solution error %s is too big."%error)
364    
365       def test_Poisson3Classic(self):
366            x=Solution(self.domain).getX()
367            # --- set exact solution ----
368            u_ex=Data(1.,(3,),Solution(self.domain))
369            g_ex=Data(0.,(3,self.domain.getDim()), Solution(self.domain))
370            A=Data(0.,(3,self.domain.getDim(),3,self.domain.getDim()), Function(self.domain))
371            for i in xrange(self.domain.getDim()):
372               u_ex[0]+= 1*(i+1) *x[i]
373               g_ex[0,i]=1*(i+1)
374               u_ex[1]+= 2*(i+1)*x[i]
375               g_ex[1,i]=2*(i+1)
376               u_ex[2]+= 3*(i+1)*x[i]
377               g_ex[2,i]=3*(i+1)
378               A[0,i,0,i]=1
379               A[1,i,1,i]=1
380               A[2,i,2,i]=1
381    
382            # create PDE:
383            pde=LinearPDE(self.domain,numEquations=3)
384            pde.setSymmetryOn()
385            mask=whereZero(x[0])*[1,1,1]
386            pde.setValue(r=u_ex,q=mask)
387            pde.setValue(A=A,y=matrixmult(g_ex,self.domain.getNormal()))
388            # -------- get the solution ---------------------------
389            pde.getSolverOptions().setTolerance(self.SOLVER_TOL)
390            pde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
391            if (USE_AMG): pde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
392            pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
393            if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
394            if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
395            if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
396            pde.getSolverOptions().setAMGInterpolation(pde.getSolverOptions().CLASSIC_INTERPOLATION)
397    
398            u=pde.getSolution()
399            # -------- test the solution ---------------------------
400            error=Lsup(u-u_ex)/Lsup(u_ex)
401            self.assertTrue(error<self.RES_TOL, "solution error %s is too big."%error)
402    
403       def test_Poisson4Classic(self):
404            x=Solution(self.domain).getX()
405            # --- set exact solution ----
406            u_ex=Data(1.,(4,),Solution(self.domain))
407            g_ex=Data(0.,(4,self.domain.getDim()), Solution(self.domain))
408            A=Data(0.,(4,self.domain.getDim(),4,self.domain.getDim()), Function(self.domain))
409            for i in xrange(self.domain.getDim()):
410               u_ex[0]+= 1*(i+1) *x[i]
411               g_ex[0,i]=1*(i+1)
412               u_ex[1]+= 2*(i+1)*x[i]
413               g_ex[1,i]=2*(i+1)
414               u_ex[2]+= 3*(i+1)*x[i]
415               g_ex[2,i]=3*(i+1)
416               u_ex[3]+= 4*(i+1)*x[i]
417               g_ex[3,i]=4*(i+1)
418               A[0,i,0,i]=1
419               A[1,i,1,i]=1
420               A[2,i,2,i]=1
421               A[3,i,3,i]=1
422    
423            # create PDE:
424            pde=LinearPDE(self.domain,numEquations=4)
425            pde.setSymmetryOn()
426            mask=whereZero(x[0])*[1,1,1,1]
427            pde.setValue(r=u_ex,q=mask)
428            pde.setValue(A=A,y=matrixmult(g_ex,self.domain.getNormal()))
429            # -------- get the solution ---------------------------
430            pde.getSolverOptions().setTolerance(self.SOLVER_TOL)
431            pde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
432            if (USE_AMG): pde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
433            pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
434            if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
435            if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
436            if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
437            pde.getSolverOptions().setAMGInterpolation(pde.getSolverOptions().CLASSIC_INTERPOLATION)
438    
439          u=pde.getSolution()          u=pde.getSolution()
440          # -------- test the solution ---------------------------          # -------- test the solution ---------------------------
# Line 265  class Test_AMG(unittest.TestCase): Line 474  class Test_AMG(unittest.TestCase):
474          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
475          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
476          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
477          if MAX_LEVEL!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
478    
479          u=pde.getSolution()          u=pde.getSolution()
480          # -------- test the solution ---------------------------          # -------- test the solution ---------------------------
# Line 309  class Test_AMG(unittest.TestCase): Line 518  class Test_AMG(unittest.TestCase):
518          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
519          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
520          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
521          if MAX_LEVEL!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
   
522          u=pde.getSolution()          u=pde.getSolution()
523          # -------- test the solution ---------------------------          # -------- test the solution ---------------------------
524          error=Lsup(u-u_ex)/Lsup(u_ex)          error=Lsup(u-u_ex)/Lsup(u_ex)
# Line 357  class Test_AMG(unittest.TestCase): Line 565  class Test_AMG(unittest.TestCase):
565          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
566          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
567          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
568          if MAX_LEVEL!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
   
569          u=pde.getSolution()          u=pde.getSolution()
570          # -------- test the solution ---------------------------          # -------- test the solution ---------------------------
571          error=Lsup(u-u_ex)/Lsup(u_ex)          error=Lsup(u-u_ex)/Lsup(u_ex)
# Line 397  class Test_AMG(unittest.TestCase): Line 604  class Test_AMG(unittest.TestCase):
604          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
605          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
606          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
607          if MAX_LEVEL!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
   
608          u=pde.getSolution()          u=pde.getSolution()
609          # -------- test the solution ---------------------------          # -------- test the solution ---------------------------
610          error=Lsup(u-u_ex)/Lsup(u_ex)          error=Lsup(u-u_ex)/Lsup(u_ex)
# Line 441  class Test_AMG(unittest.TestCase): Line 647  class Test_AMG(unittest.TestCase):
647          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
648          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
649          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
650          if MAX_LEVEL!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
651    
652          u=pde.getSolution()          u=pde.getSolution()
653          # -------- test the solution ---------------------------          # -------- test the solution ---------------------------
# Line 488  class Test_AMG(unittest.TestCase): Line 694  class Test_AMG(unittest.TestCase):
694          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
695          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
696          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
697          if MAX_LEVEL!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
   
698          u=pde.getSolution()          u=pde.getSolution()
699          # -------- test the solution ---------------------------          # -------- test the solution ---------------------------
700          error=Lsup(u-u_ex)/Lsup(u_ex)          error=Lsup(u-u_ex)/Lsup(u_ex)
# Line 554  class Test_AMG(unittest.TestCase): Line 759  class Test_AMG(unittest.TestCase):
759          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)          pde.getSolverOptions().setVerbosity(SOLVER_VERBOSE)
760          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)          if MIN_MATRIX_SIZE!= None: pde.getSolverOptions().setMinCoarseMatrixSize(MIN_MATRIX_SIZE)
761          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MIN_SPARSITY!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)
762          if MAX_LEVEL!=None: pde.getSolverOptions().setMinCoarseMatrixSparsity(MIN_SPARSITY)          if MAX_LEVEL!=None: pde.getSolverOptions().setLevelMax(MAX_LEVEL)
           
763          u = pde.getSolution()          u = pde.getSolution()
764                    
765          # -------- test the solution ---------------------------          # -------- test the solution ---------------------------
# Line 584  if __name__ == '__main__': Line 788  if __name__ == '__main__':
788     suite = unittest.TestSuite()     suite = unittest.TestSuite()
789     suite.addTest(unittest.makeSuite(Test_AMGOnFinleyHex2DOrder1))     suite.addTest(unittest.makeSuite(Test_AMGOnFinleyHex2DOrder1))
790     suite.addTest(unittest.makeSuite(Test_AMGOnFinleyHex3DOrder1))     suite.addTest(unittest.makeSuite(Test_AMGOnFinleyHex3DOrder1))
    #suite.addTest(Test_AMGOnFinleyHex2DOrder1("test_PoissonSqueezedX"))  
791    
792     s=unittest.TextTestRunner(verbosity=2).run(suite)     s=unittest.TextTestRunner(verbosity=2).run(suite)
793     if not s.wasSuccessful(): sys.exit(1)     if not s.wasSuccessful(): sys.exit(1)

Legend:
Removed from v.3439  
changed lines
  Added in v.3440

  ViewVC Help
Powered by ViewVC 1.1.26