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

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

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

trunk/finley/test/python/test_linearPDEsOnFinley.py revision 155 by jgs, Wed Nov 9 02:02:19 2005 UTC trunk/finley/test/python/run_linearPDEsOnFinley.py revision 859 by gross, Tue Sep 26 02:19:18 2006 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
2    
3  """  """
4  Test suite for the linearPDE test on finley  Test suite for the linearPDE  and pdetools test on finley
5    
6  @remark:  @remark:
7    
# Line 12  Test suite for the linearPDE test on fin Line 12  Test suite for the linearPDE test on fin
12  @var __date__: date of the version  @var __date__: date of the version
13  """  """
14    
15    __copyright__="""  Copyright (c) 2006 by ACcESS MNRF
16                        http://www.access.edu.au
17                    Primary Business: Queensland, Australia"""
18    __license__="""Licensed under the Open Software License version 3.0
19                 http://www.opensource.org/licenses/osl-3.0.php"""
20  __author__="Lutz Gross, l.gross@uq.edu.au"  __author__="Lutz Gross, l.gross@uq.edu.au"
 __licence__="contact: esys@access.uq.edu.au"  
21  __url__="http://www.iservo.edu.au/esys/escript"  __url__="http://www.iservo.edu.au/esys/escript"
22  __version__="$Revision$"  __version__="$Revision$"
23  __date__="$Date$"  __date__="$Date$"
24    
25    
26  import unittest  import unittest
27  from esys.escript.test_linearPDEs import Test_Poisson,Test_LinearPDE  from test_linearPDEs import Test_Poisson,Test_LinearPDE, Test_LinearPDE_noLumping
28  from esys.finley import Rectangle,Brick  from test_assemblage import Test_assemblage_2Do1, Test_assemblage_2Do2, Test_assemblage_3Do1, Test_assemblage_3Do2, \
29                                Test_assemblage_2Do1_Contact,Test_assemblage_2Do2_Contact, Test_assemblage_3Do1_Contact, Test_assemblage_3Do2_Contact
30    from test_pdetools import Test_pdetools, Test_pdetools_noLumping
31    from esys.escript import *
32    from esys.finley import Rectangle,Brick,JoinFaces, ReadMesh
33  import sys  import sys
34    
35  class Test_LinearPDEOnFinley2DOrder1(Test_LinearPDE):  
36      def setUp(self):  try:
37          self.domain = Rectangle(50,50,1)       FINLEY_TEST_DATA=os.environ['FINLEY_TEST_DATA']
38    except KeyError:
39  class Test_LinearPDEOnFinley2DOrder2(Test_LinearPDE):       FINLEY_TEST_DATA='.'
40      def setUp(self):  
41          self.domain = Rectangle(50,50,2)  FINLEY_TEST_MESH_PATH=FINLEY_TEST_DATA+"/data_meshes/"
42    
43  class Test_LinearPDEOnFinley3DOrder1(Test_LinearPDE):  NE=6 # number of element in each spatial direction (must be even)
44      def setUp(self):  
45          self.domain = Brick(20,10,10,1)  class Test_LinearPDEOnFinleyHex2DOrder1(Test_LinearPDE,Test_pdetools,Test_assemblage_2Do1):
46       RES_TOL=1.e-7
47  class Test_LinearPDEOnFinley3DOrder2(Test_LinearPDE):     ABS_TOL=1.e-8
48      def setUp(self):     def setUp(self):
49          self.domain = Brick(10,10,20,2)          self.domain = Rectangle(NE,NE,1)
50       def tearDown(self):
51            del self.domain
52    
53    class Test_LinearPDEOnFinleyHex2DOrder2(Test_LinearPDE,Test_pdetools,Test_assemblage_2Do2):
54       RES_TOL=1.e-7
55       ABS_TOL=1.e-8
56       def setUp(self):
57            self.domain = Rectangle(NE,NE,2)
58       def tearDown(self):
59            del self.domain
60    
61    class Test_LinearPDEOnFinleyHex3DOrder1(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do1):
62       RES_TOL=1.e-7
63       ABS_TOL=1.e-8
64       def setUp(self):
65            self.domain = Brick(NE,NE,NE,1)
66    
67    class Test_LinearPDEOnFinleyHex3DOrder2(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do2):
68       RES_TOL=1.e-7
69       ABS_TOL=1.e-8
70       def setUp(self):
71            self.domain = Brick(NE,NE,NE,2)
72       def tearDown(self):
73            del self.domain
74    
75    class Test_LinearPDEOnFinleyTet2DOrder1(Test_LinearPDE,Test_pdetools,Test_assemblage_2Do1):
76       RES_TOL=1.e-7
77       ABS_TOL=1.e-8
78       def setUp(self):
79            self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_2D_order1.fly")
80       def tearDown(self):
81            del self.domain
82    
83    class Test_LinearPDEOnFinleyTet2DOrder2(Test_LinearPDE_noLumping,Test_pdetools_noLumping,Test_assemblage_2Do2):
84       RES_TOL=1.e-7
85       ABS_TOL=1.e-8
86       def setUp(self):
87            self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_2D_order2.fly")
88       def tearDown(self):
89            del self.domain
90    
91    class Test_LinearPDEOnFinleyTet3DOrder1(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do1):
92       RES_TOL=1.e-7
93       ABS_TOL=1.e-8
94       def setUp(self):
95            self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_3D_order1.fly")
96    
97    class Test_LinearPDEOnFinleyTet3DOrder2(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do2):
98       RES_TOL=1.e-7
99       ABS_TOL=1.e-8
100       def setUp(self):
101            self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_3D_order2.fly")
102       def tearDown(self):
103            del self.domain
104    
105  class Test_PoissonOnFinley(Test_Poisson):  class Test_PoissonOnFinley(Test_Poisson):
106      def setUp(self):     RES_TOL=1.e-7
107          self.domain = Rectangle(20,10,2)     ABS_TOL=1.e-8
108       def setUp(self):
109            self.domain = Rectangle(NE,NE,2)
110       def tearDown(self):
111            del self.domain
112    
113    
114    class Test_AssemblePDEwithFinley_2Do1_Contact(Test_assemblage_2Do1_Contact):
115       RES_TOL=1.e-7
116       ABS_TOL=1.e-8
117       def setUp(self):
118           d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)
119           x1 = ContinuousFunction(d1).getX()
120           ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
121           d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)
122           ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
123           d2.setX(d2.getX()+[0.5,0.])
124           self.domain = JoinFaces([d1,d2])
125       def tearDown(self):
126            del self.domain
127    
128    class Test_AssemblePDEwithFinley_2Do2_Contact(Test_assemblage_2Do2_Contact):
129       RES_TOL=1.e-7
130       ABS_TOL=1.e-8
131       def setUp(self):
132           d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
133           x1 = ContinuousFunction(d1).getX()
134           ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
135           d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
136           ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
137           d2.setX(d2.getX()+[0.5,0.])
138           self.domain = JoinFaces([d1,d2])
139       def tearDown(self):
140            del self.domain
141    
142    class Test_AssemblePDEwithFinley_3Do1_Contact(Test_assemblage_3Do1_Contact):
143       RES_TOL=1.e-7
144       ABS_TOL=1.e-8
145       def setUp(self):
146           d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)
147           x1 = ContinuousFunction(d1).getX()
148           ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
149           d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)
150           ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
151           d2.setX(d2.getX()+[0.5,0.,0.])
152           self.domain = JoinFaces([d1,d2])
153       def tearDown(self):
154            del self.domain
155    
156    class Test_AssemblePDEwithFinley_3Do2_Contact(Test_assemblage_3Do2_Contact):
157       RES_TOL=1.e-7
158       ABS_TOL=1.e-8
159       def setUp(self):
160           d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
161           x1 = ContinuousFunction(d1).getX()
162           ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
163           d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
164           ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
165           d2.setX(d2.getX()+[0.5,0.,0.])
166           self.domain = JoinFaces([d1,d2])
167       def tearDown(self):
168            del self.domain
169    
170    
171    class Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace(Test_assemblage_2Do1_Contact):
172       RES_TOL=1.e-7
173       ABS_TOL=1.e-8
174       def setUp(self):
175           d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True)
176           x1 = ContinuousFunction(d1).getX()
177           ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
178           d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True)
179           ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
180           d2.setX(d2.getX()+[0.5,0.])
181           self.domain = JoinFaces([d1,d2])
182       def tearDown(self):
183            del self.domain
184    
185    class Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace(Test_assemblage_2Do2_Contact):
186       RES_TOL=1.e-7
187       ABS_TOL=1.e-8
188       def setUp(self):
189           d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)
190           x1 = ContinuousFunction(d1).getX()
191           ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
192           d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)
193           ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
194           d2.setX(d2.getX()+[0.5,0.])
195           self.domain = JoinFaces([d1,d2])
196       def tearDown(self):
197            del self.domain
198    
199    class Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace(Test_assemblage_3Do1_Contact):
200       RES_TOL=1.e-7
201       ABS_TOL=1.e-8
202       def setUp(self):
203           d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
204           x1 = ContinuousFunction(d1).getX()
205           ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
206           d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
207           ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
208           d2.setX(d2.getX()+[0.5,0.,0.])
209           self.domain = JoinFaces([d1,d2])
210       def tearDown(self):
211            del self.domain
212    
213    class Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace(Test_assemblage_3Do2_Contact):
214       RES_TOL=1.e-7
215       ABS_TOL=1.e-8
216       def setUp(self):
217           d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
218           x1 = ContinuousFunction(d1).getX()
219           ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
220           d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
221           ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
222           d2.setX(d2.getX()+[0.5,0.,0.])
223           self.domain = JoinFaces([d1,d2])
224       def tearDown(self):
225            del self.domain
226    
227  if __name__ == '__main__':  if __name__ == '__main__':
228     suite = unittest.TestSuite()     suite = unittest.TestSuite()
229     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley2DOrder1))     if True:
230     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley2DOrder2))        suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex2DOrder1))
231     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley3DOrder1))        suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex2DOrder2))
232     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley3DOrder2))        suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex3DOrder1))
233     suite.addTest(unittest.makeSuite(Test_PoissonOnFinley))        suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex3DOrder2))
234    
235          suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet2DOrder1))
236          suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet2DOrder2))
237          suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet3DOrder1))
238          suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet3DOrder2))
239    
240          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact))
241          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact))
242          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact))
243          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact))
244          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace))
245          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace))
246          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace))
247          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace))
248       else:
249          pass
250    
251     s=unittest.TextTestRunner(verbosity=2).run(suite)     s=unittest.TextTestRunner(verbosity=2).run(suite)
252     if s.wasSuccessful():     if s.wasSuccessful():
253       sys.exit(0)       sys.exit(0)

Legend:
Removed from v.155  
changed lines
  Added in v.859

  ViewVC Help
Powered by ViewVC 1.1.26