/[escript]/trunk/escriptcore/test/python/test_linearPDEs.py
ViewVC logotype

Diff of /trunk/escriptcore/test/python/test_linearPDEs.py

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

revision 2474 by gross, Tue Jun 16 06:32:15 2009 UTC revision 2548 by jfenwick, Mon Jul 20 06:20:06 2009 UTC
# Line 1  Line 1 
1    
2  ########################################################  ########################################################
3  #  #
4  # Copyright (c) 2003-2008 by University of Queensland  # Copyright (c) 2003-2009 by University of Queensland
5  # Earth Systems Science Computational Center (ESSCC)  # Earth Systems Science Computational Center (ESSCC)
6  # http://www.uq.edu.au/esscc  # http://www.uq.edu.au/esscc
7  #  #
# Line 652  class Test_LinearPDE_noLumping(Test_line Line 652  class Test_LinearPDE_noLumping(Test_line
652          self.failUnlessRaises(ValueError,so.setCoarseningThreshold,-1)          self.failUnlessRaises(ValueError,so.setCoarseningThreshold,-1)
653          so.setCoarseningThreshold(0.1)          so.setCoarseningThreshold(0.1)
654          self.failUnless(so.getCoarseningThreshold() == 0.1, "CoarseningThreshold is wrong.")          self.failUnless(so.getCoarseningThreshold() == 0.1, "CoarseningThreshold is wrong.")
655            
656            self.failUnless(so.getMinCoarseMatrixSize() == 500, "initial  Minimum Coarse Matrix Size is wrong.")
657            self.failUnlessRaises(ValueError,so.setMinCoarseMatrixSize,-1)
658            so.setMinCoarseMatrixSize(1000)
659            self.failUnless(so.getMinCoarseMatrixSize() == 1000, "Minimum Coarse Matrix Size is wrong.")
660    
661          self.failUnless(so.getNumSweeps() == 2, "initial  Sweeps is wrong.")          self.failUnless(so.getNumSweeps() == 2, "initial  Sweeps is wrong.")
662          self.failUnlessRaises(ValueError,so.setNumSweeps,-1)          self.failUnlessRaises(ValueError,so.setNumSweeps,-1)
# Line 699  class Test_LinearPDE_noLumping(Test_line Line 704  class Test_LinearPDE_noLumping(Test_line
704          self.failUnless(so.getRelaxationFactor() == 0.1, "Relaxation is wrong.")          self.failUnless(so.getRelaxationFactor() == 0.1, "Relaxation is wrong.")
705    
706    
707          self.failUnless(so.getIterMax() == 10000, "initial IterMax is wrong.")          self.failUnless(so.getIterMax() == 100000, "initial IterMax is wrong.")
708          self.failUnlessRaises(ValueError,so.setIterMax,0)          self.failUnlessRaises(ValueError,so.setIterMax,0)
709          so.setIterMax(11)          so.setIterMax(11)
710          self.failUnless(so.getIterMax() == 11, "IterMax is wrong.")          self.failUnless(so.getIterMax() == 11, "IterMax is wrong.")
# Line 1406  class Test_LinearPDE_noLumping(Test_line Line 1411  class Test_LinearPDE_noLumping(Test_line
1411          u2=mypde.getSolution()          u2=mypde.getSolution()
1412          self.failUnless(self.check(u2,2*u1),'second solution is wrong.')          self.failUnless(self.check(u2,2*u1),'second solution is wrong.')
1413    
1414        def test_Status(self):
1415            DIM=self.domain.getDim()
1416            x=self.domain.getX()
1417            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1418            mypde.getSolverOptions().setSymmetryOn()
1419            mypde.getSolverOptions().setTolerance(self.RES_TOL)
1420            mypde.setValue(A=kronecker(self.domain), q=whereZero(x[0])+whereZero(x[0]-1.), Y=2.)
1421            x1=self.domain.getX()
1422            u1_ref=x1[0]*(1.-x1[0])
1423            u1=mypde.getSolution()
1424            error1=Lsup(u1-u1_ref)/Lsup(u1_ref)
1425            self.failUnless(mypde.getDomainStatus() == mypde.getSystemStatus(), "status of first pde does not match domain status.")
1426    
1427            self.domain.setX(x*5)
1428    
1429            self.failUnless(mypde.getDomainStatus() != mypde.getSystemStatus(), "status of first pde matches updated domain status.")
1430            x2=self.domain.getX()
1431            u2_ref=x2[0]*(5.-x2[0])
1432            u2=mypde.getSolution()
1433            error2=Lsup(u2-u2_ref)/Lsup(u2_ref)
1434            self.failUnless(error2 <= max(error1,self.RES_TOL)*10., "solution of second PDE wrong.")
1435            self.failUnless(mypde.getDomainStatus() == mypde.getSystemStatus(), "status of second pde does not match domain status.")
1436    
1437      def test_symmetryCheckTrue_System(self):      def test_symmetryCheckTrue_System(self):
1438          d=self.domain.getDim()          d=self.domain.getDim()
1439          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)

Legend:
Removed from v.2474  
changed lines
  Added in v.2548

  ViewVC Help
Powered by ViewVC 1.1.26