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

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

  ViewVC Help
Powered by ViewVC 1.1.26