/[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 temp_trunk_copy/finley/test/python/run_linearPDEsOnFinley.py revision 1384 by phornby, Fri Jan 11 02:29:38 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,Test_pdetools,Test_assemblage_2Do1):
60       RES_TOL=1.e-7
61  class Test_LinearPDEOnFinley3DOrder2(Test_LinearPDE):     ABS_TOL=1.e-8
62      def setUp(self):     def setUp(self):
63          self.domain = Brick(10,10,20,2)          self.domain = Rectangle(NE,NE,1)
64       def tearDown(self):
65            del self.domain
66    
67    class Test_LinearPDEOnFinleyHex2DOrder2(Test_LinearPDE,Test_pdetools,Test_assemblage_2Do2):
68       RES_TOL=1.e-7
69       ABS_TOL=1.e-8
70       def setUp(self):
71            self.domain = Rectangle(NE,NE,2)
72       def tearDown(self):
73            del self.domain
74    
75    class Test_LinearPDEOnFinleyHex3DOrder1(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do1):
76       RES_TOL=1.e-7
77       ABS_TOL=1.e-8
78       def setUp(self):
79            self.domain = Brick(NE,NE,NE,1)
80    
81    class Test_LinearPDEOnFinleyHex3DOrder2(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do2):
82       RES_TOL=1.e-7
83       ABS_TOL=1.e-8
84       def setUp(self):
85            self.domain = Brick(NE,NE,NE,2)
86       def tearDown(self):
87            del self.domain
88    
89    class Test_LinearPDEOnFinleyTet2DOrder1(Test_LinearPDE,Test_pdetools,Test_assemblage_2Do1):
90       RES_TOL=1.e-7
91       ABS_TOL=1.e-8
92       def setUp(self):
93            self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_2D_order1.fly",optimize=False)
94       def tearDown(self):
95            del self.domain
96    
97    class Test_LinearPDEOnFinleyTet2DOrder2(Test_LinearPDE_noLumping,Test_pdetools_noLumping,Test_assemblage_2Do2):
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_2D_order2.fly",optimize=False)
102       def tearDown(self):
103            del self.domain
104    
105    class Test_LinearPDEOnFinleyTet3DOrder1(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do1):
106       RES_TOL=1.e-7
107       ABS_TOL=1.e-8
108       def setUp(self):
109            self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_3D_order1.fly",optimize=False)
110    
111    class Test_LinearPDEOnFinleyTet3DOrder2(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do2):
112       RES_TOL=1.e-7
113       ABS_TOL=1.e-8
114       def setUp(self):
115            self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_3D_order2.fly",optimize=False)
116       def tearDown(self):
117            del self.domain
118    
119  class Test_PoissonOnFinley(Test_Poisson):  class Test_PoissonOnFinley(Test_Poisson):
120      def setUp(self):     RES_TOL=1.e-7
121          self.domain = Rectangle(20,10,2)     ABS_TOL=1.e-8
122       def setUp(self):
123            self.domain = Rectangle(NE,NE,2)
124       def tearDown(self):
125            del self.domain
126    
127    
128    class Test_AssemblePDEwithFinley_2Do1_Contact(Test_assemblage_2Do1_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=1)
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=1)
136           ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
137           d2.setX(d2.getX()+[0.5,0.])
138           self.domain = JoinFaces([d1,d2],optimize=False)
139       def tearDown(self):
140            del self.domain
141    
142    class Test_AssemblePDEwithFinley_2Do2_Contact(Test_assemblage_2Do2_Contact):
143       RES_TOL=1.e-7
144       ABS_TOL=1.e-8
145       def setUp(self):
146           d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
147           x1 = ContinuousFunction(d1).getX()
148           ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
149           d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
150           ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
151           d2.setX(d2.getX()+[0.5,0.])
152           self.domain = JoinFaces([d1,d2],optimize=False)
153       def tearDown(self):
154            del self.domain
155    
156    class Test_AssemblePDEwithFinley_3Do1_Contact(Test_assemblage_3Do1_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=1)
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=1)
164           ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
165           d2.setX(d2.getX()+[0.5,0.,0.])
166           self.domain = JoinFaces([d1,d2],optimize=False)
167       def tearDown(self):
168            del self.domain
169    
170    class Test_AssemblePDEwithFinley_3Do2_Contact(Test_assemblage_3Do2_Contact):
171       RES_TOL=1.e-7
172       ABS_TOL=1.e-8
173       def setUp(self):
174           d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
175           x1 = ContinuousFunction(d1).getX()
176           ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
177           d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
178           ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
179           d2.setX(d2.getX()+[0.5,0.,0.])
180           self.domain = JoinFaces([d1,d2],optimize=False)
181       def tearDown(self):
182            del self.domain
183    
184    
185    class Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace(Test_assemblage_2Do1_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=1,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=1,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],optimize=False)
196       def tearDown(self):
197            del self.domain
198    
199    class Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace(Test_assemblage_2Do2_Contact):
200       RES_TOL=1.e-7
201       ABS_TOL=1.e-8
202       def setUp(self):
203           d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)
204           x1 = ContinuousFunction(d1).getX()
205           ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
206           d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)
207           ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
208           d2.setX(d2.getX()+[0.5,0.])
209           self.domain = JoinFaces([d1,d2],optimize=False)
210       def tearDown(self):
211            del self.domain
212    
213    class Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace(Test_assemblage_3Do1_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=1,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=1,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],optimize=False)
224       def tearDown(self):
225            del self.domain
226    
227    class Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace(Test_assemblage_3Do2_Contact):
228       RES_TOL=1.e-7
229       ABS_TOL=1.e-8
230       def setUp(self):
231           d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
232           x1 = ContinuousFunction(d1).getX()
233           ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
234           d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
235           ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
236           d2.setX(d2.getX()+[0.5,0.,0.])
237           self.domain = JoinFaces([d1,d2],optimize=False)
238       def tearDown(self):
239            del self.domain
240    
241  if __name__ == '__main__':  if __name__ == '__main__':
242     suite = unittest.TestSuite()     suite = unittest.TestSuite()
243     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley2DOrder1))     if True:
244     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley2DOrder2))        suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex2DOrder1))
245     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley3DOrder1))        suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex2DOrder2))
246     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley3DOrder2))        suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex3DOrder1))
247     suite.addTest(unittest.makeSuite(Test_PoissonOnFinley))        suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex3DOrder2))
248     s=unittest.TextTestRunner(verbosity=2).run(suite)  
249     if s.wasSuccessful():        suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet2DOrder1))
250       sys.exit(0)        suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet2DOrder2))
251          suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet3DOrder1))
252          suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet3DOrder2))
253      
254          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact))
255          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact))
256          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact))
257          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact))
258          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace))
259          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace))
260          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace))
261          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace))
262     else:     else:
263       sys.exit(1)        pass
264      
265       s=unittest.TextTestRunner(verbosity=2).run(suite)
266       if not s.wasSuccessful(): sys.exit(1)
267    

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

  ViewVC Help
Powered by ViewVC 1.1.26