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

Annotation of /trunk/finley/test/python/testframe.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 877 - (hide annotations)
Wed Oct 25 03:06:58 2006 UTC (13 years, 9 months ago) by gross
File MIME type: text/x-python
File size: 1961 byte(s)
backtraking in the saddlepoint problem (not perfect yet)
1 gross 399 # $Id:$
2     """
3     frame to ran a single test out of the Test_util suite
4     """
5    
6 elspeth 617 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
7     http://www.access.edu.au
8     Primary Business: Queensland, Australia"""
9     __license__="""Licensed under the Open Software License version 3.0
10     http://www.opensource.org/licenses/osl-3.0.php"""
11 gross 399 import unittest
12     from esys.escript import *
13 gross 877 from esys.escript.linearPDEs import LinearPDE
14     from esys.finley import Rectangle, JoinFaces
15 gross 399 import numarray
16 gross 855 FINLEY_TEST_MESH_PATH="data_meshes/"
17 gross 399
18 gross 877 NE=6 # number of element in each spatial direction (must be even)
19 gross 399 class Test_util2(unittest.TestCase):
20 gross 877 RES_TOL=1.e-7
21     ABS_TOL=1.e-8
22     def setUp(self):
23     d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)
24     x1 = ContinuousFunction(d1).getX()
25     ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
26     d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)
27     ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
28     d2.setX(d2.getX()+[0.5,0.])
29     self.domain = JoinFaces([d1,d2])
30     def tearDown(self):
31 gross 855 del self.domain
32 gross 618
33 gross 877 #==================================================
34     def test_assemblage_2D_solO1_coeffOFull_NEqu1_d_contact_Const_typeContact(self):
35     x=self.domain.getX()
36     jump=Data(0.,(),ContinuousFunction(self.domain))
37     jump.setTaggedValue(2,1.)
38     u=((-6)+x[1]-6*x[0])*jump
39     d_contact_test=Data(4,(),FunctionOnContactZero(self.domain))
40     y_contact_test=(-24)+4*x[1]-24*x[0]
41     pde=LinearPDE(self.domain)
42     pde.setValue(d_contact=d_contact_test, y_contact=y_contact_test)
43     r=pde.getResidual(u)
44     rhs=pde.getRightHandSide()
45     self.failUnless(Lsup(rhs)>0,"right hand side is zero")
46     self.failUnless(Lsup(r)<=self.RES_TOL*Lsup(rhs),"residual is too big")
47 gross 857
48 gross 399 if __name__ == '__main__':
49     suite = unittest.TestSuite()
50     suite.addTest(unittest.makeSuite(Test_util2))
51     s=unittest.TextTestRunner(verbosity=2).run(suite)
52 gross 699
53    

  ViewVC Help
Powered by ViewVC 1.1.26