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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1809 - (show annotations)
Thu Sep 25 06:43:44 2008 UTC (10 years, 9 months ago) by ksteube
File MIME type: text/x-python
File size: 10432 byte(s)
Copyright updated in all python files

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26