50 |
|
|
51 |
import unittest |
import unittest |
52 |
from esys.escript import * |
from esys.escript import * |
53 |
from esys.escript.pdetools import Locator,Projector,TimeIntegrationManager,NoPDE,PCG |
from esys.escript.pdetools import Locator,Projector,TimeIntegrationManager,NoPDE,PCG, IterationHistory |
54 |
|
|
55 |
class Test_pdetools_noLumping(unittest.TestCase): |
class Test_pdetools_noLumping(unittest.TestCase): |
56 |
DEBUG=False |
DEBUG=False |
403 |
for i in xrange(size(b)): |
for i in xrange(size(b)): |
404 |
out[i]=b[i]/A[i,i] |
out[i]=b[i]/A[i,i] |
405 |
return out |
return out |
|
def norm(d): |
|
|
return sqrt(dot(d,d)) |
|
406 |
|
|
|
x=x_ref*1.5 |
|
407 |
tol=1.e-4 |
tol=1.e-4 |
408 |
x,r=PCG(b*1.,x,Ap,Ms,dot, norm, verbose=False, iter_max=12, tolerance=tol) |
x,r=PCG(b*1.,Ap,Ms,dot, IterationHistory(tol).stoppingcriterium,x=x_ref*1.5, iter_max=12) |
409 |
self.failUnless(Lsup(x-x_ref)<=Lsup(x_ref)*tol*10.,"wrong solution") |
self.failUnless(Lsup(x-x_ref)<=Lsup(x_ref)*tol*10.,"wrong solution") |
410 |
self.failUnless(Lsup(r-(b-matrixmultiply(A,x)))<=Lsup(b)*EPSILON*100.,"wrong solution") |
self.failUnless(Lsup(r-(b-matrixmultiply(A,x)))<=Lsup(b)*EPSILON*100.,"wrong solution") |
411 |
|
|