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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 855 - (hide annotations)
Fri Sep 22 09:30:06 2006 UTC (13 years, 6 months ago) by gross
File MIME type: text/x-python
File size: 9779 byte(s)
some tests for triangle meshes added
1 jgs 149 # $Id$
2    
3 jgs 154 """
4 gross 773 Test suite for the linearPDE and pdetools test on finley
5 jgs 154
6     @remark:
7    
8     @var __author__: name of author
9     @var __licence__: licence agreement
10     @var __url__: url entry point on documentation
11     @var __version__: version
12     @var __date__: date of the version
13     """
14    
15 elspeth 617 __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 jgs 154 __author__="Lutz Gross, l.gross@uq.edu.au"
21     __url__="http://www.iservo.edu.au/esys/escript"
22     __version__="$Revision$"
23     __date__="$Date$"
24    
25    
26 jgs 149 import unittest
27 gross 855 from test_linearPDEs import Test_Poisson,Test_LinearPDE, Test_LinearPDE_noLumping
28 gross 773 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 gross 855 from test_pdetools import Test_pdetools, Test_pdetools_noLumping
31 gross 773 from esys.escript import *
32 gross 855 from esys.finley import Rectangle,Brick,JoinFaces, ReadMesh
33 jgs 154 import sys
34 jgs 149
35    
36 gross 855 try:
37     FINLEY_TEST_DATA=os.environ['FINLEY_TEST_DATA']
38     except KeyError:
39     FINLEY_TEST_DATA='.'
40    
41     FINLEY_TEST_MESH_PATH=FINLEY_TEST_DATA+"/data_meshes/"
42    
43 gross 773 NE=6 # number of element in each spatial direction (must be even)
44 jgs 153
45 gross 855 class Test_LinearPDEOnFinleyHex2DOrder1(Test_LinearPDE,Test_pdetools,Test_assemblage_2Do1):
46 gross 773 RES_TOL=1.e-7
47     ABS_TOL=1.e-8
48     def setUp(self):
49     self.domain = Rectangle(NE,NE,1)
50 gross 798 def tearDown(self):
51     del self.domain
52 jgs 153
53 gross 855 class Test_LinearPDEOnFinleyHex2DOrder2(Test_LinearPDE,Test_pdetools,Test_assemblage_2Do2):
54 gross 773 RES_TOL=1.e-7
55     ABS_TOL=1.e-8
56     def setUp(self):
57     self.domain = Rectangle(NE,NE,2)
58 gross 798 def tearDown(self):
59     del self.domain
60 jgs 153
61 gross 855 class Test_LinearPDEOnFinleyHex3DOrder1(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do1):
62 gross 773 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 gross 855 class Test_LinearPDEOnFinleyHex3DOrder2(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do2):
68 gross 773 RES_TOL=1.e-7
69     ABS_TOL=1.e-8
70     def setUp(self):
71     self.domain = Brick(NE,NE,NE,2)
72 gross 798 def tearDown(self):
73     del self.domain
74 gross 773
75 gross 855 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 jgs 149 class Test_PoissonOnFinley(Test_Poisson):
106 gross 773 RES_TOL=1.e-7
107     ABS_TOL=1.e-8
108     def setUp(self):
109     self.domain = Rectangle(NE,NE,2)
110 gross 798 def tearDown(self):
111     del self.domain
112 jgs 149
113 gross 773
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 gross 798 def tearDown(self):
126     del self.domain
127 gross 773
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 gross 798 def tearDown(self):
140     del self.domain
141 gross 773
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 gross 798 def tearDown(self):
154     del self.domain
155 gross 773
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 gross 798 def tearDown(self):
168     del self.domain
169 gross 773
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 gross 798 def tearDown(self):
183     del self.domain
184 gross 773
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 gross 798 def tearDown(self):
197     del self.domain
198 gross 773
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 gross 798 def tearDown(self):
211     del self.domain
212 gross 773
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 gross 798 def tearDown(self):
225     del self.domain
226 gross 773
227 jgs 149 if __name__ == '__main__':
228     suite = unittest.TestSuite()
229 gross 855 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex2DOrder1))
230     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex2DOrder2))
231     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex3DOrder1))
232     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex3DOrder2))
233 gross 773
234 gross 855 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet2DOrder1))
235     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet2DOrder2))
236     # suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet3DOrder1))
237     # suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet3DOrder2))
238    
239 gross 773 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact))
240     suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact))
241     suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact))
242     suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact))
243     suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace))
244     suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace))
245     suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace))
246     suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace))
247 jgs 149 s=unittest.TextTestRunner(verbosity=2).run(suite)
248     if s.wasSuccessful():
249     sys.exit(0)
250     else:
251     sys.exit(1)
252 jgs 154

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26