/[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 1694 - (show annotations)
Fri Aug 8 04:27:46 2008 UTC (11 years ago) by artak
File MIME type: text/x-python
File size: 10475 byte(s)
test_NoPDE_vector_variable is changed to avoid 0/0 division
1 #
2 # $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 and pdetools test on finley
19
20 @remark:
21
22 @var __author__: name of author
23 @var __licence__: licence agreement
24 @var __url__: url entry point on documentation
25 @var __version__: version
26 @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"
35 __url__="http://www.iservo.edu.au/esys/escript"
36 __version__="$Revision$"
37 __date__="$Date$"
38
39
40 import unittest
41 from test_linearPDEs import Test_Poisson,Test_LinearPDE, Test_LinearPDE_noLumping
42 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
48
49
50 try:
51 FINLEY_TEST_DATA=os.environ['FINLEY_TEST_DATA']
52 except KeyError:
53 FINLEY_TEST_DATA='.'
54
55 FINLEY_TEST_MESH_PATH=FINLEY_TEST_DATA+"/data_meshes/"
56
57 NE=6 # number of element in each spatial direction (must be even)
58
59 class Test_LinearPDEOnFinleyHex2DOrder1(Test_LinearPDE,Test_pdetools,Test_assemblage_2Do1):
60 RES_TOL=1.e-7
61 ABS_TOL=1.e-8
62 def setUp(self):
63 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 def tearDown(self):
111 del self.domain
112
113 class Test_LinearPDEOnFinleyTet3DOrder2(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do2):
114 RES_TOL=1.e-7
115 ABS_TOL=1.e-8
116 def setUp(self):
117 self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_3D_order2.fly",optimize=False)
118 def tearDown(self):
119 del self.domain
120
121 class Test_PoissonOnFinley(Test_Poisson):
122 RES_TOL=1.e-7
123 ABS_TOL=1.e-8
124 def setUp(self):
125 self.domain = Rectangle(NE,NE,2)
126 def tearDown(self):
127 del self.domain
128
129
130 class Test_AssemblePDEwithFinley_2Do1_Contact(Test_assemblage_2Do1_Contact):
131 RES_TOL=1.e-7
132 ABS_TOL=1.e-8
133 def setUp(self):
134 d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)
135 x1 = ContinuousFunction(d1).getX()
136 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
137 d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)
138 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
139 d2.setX(d2.getX()+[0.5,0.])
140 self.domain = JoinFaces([d1,d2],optimize=False)
141 def tearDown(self):
142 del self.domain
143
144 class Test_AssemblePDEwithFinley_2Do2_Contact(Test_assemblage_2Do2_Contact):
145 RES_TOL=1.e-7
146 ABS_TOL=1.e-8
147 def setUp(self):
148 d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
149 x1 = ContinuousFunction(d1).getX()
150 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
151 d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
152 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
153 d2.setX(d2.getX()+[0.5,0.])
154 self.domain = JoinFaces([d1,d2],optimize=False)
155 def tearDown(self):
156 del self.domain
157
158 class Test_AssemblePDEwithFinley_3Do1_Contact(Test_assemblage_3Do1_Contact):
159 RES_TOL=1.e-7
160 ABS_TOL=1.e-8
161 def setUp(self):
162 d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)
163 x1 = ContinuousFunction(d1).getX()
164 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
165 d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)
166 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
167 d2.setX(d2.getX()+[0.5,0.,0.])
168 self.domain = JoinFaces([d1,d2],optimize=False)
169 def tearDown(self):
170 del self.domain
171
172 class Test_AssemblePDEwithFinley_3Do2_Contact(Test_assemblage_3Do2_Contact):
173 RES_TOL=1.e-7
174 ABS_TOL=1.e-8
175 def setUp(self):
176 d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
177 x1 = ContinuousFunction(d1).getX()
178 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
179 d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
180 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
181 d2.setX(d2.getX()+[0.5,0.,0.])
182 self.domain = JoinFaces([d1,d2],optimize=False)
183 def tearDown(self):
184 del self.domain
185
186
187 class Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace(Test_assemblage_2Do1_Contact):
188 RES_TOL=1.e-7
189 ABS_TOL=1.e-8
190 def setUp(self):
191 d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True)
192 x1 = ContinuousFunction(d1).getX()
193 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
194 d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True)
195 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
196 d2.setX(d2.getX()+[0.5,0.])
197 self.domain = JoinFaces([d1,d2],optimize=False)
198 def tearDown(self):
199 del self.domain
200
201 class Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace(Test_assemblage_2Do2_Contact):
202 RES_TOL=1.e-7
203 ABS_TOL=1.e-8
204 def setUp(self):
205 d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)
206 x1 = ContinuousFunction(d1).getX()
207 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
208 d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)
209 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
210 d2.setX(d2.getX()+[0.5,0.])
211 self.domain = JoinFaces([d1,d2],optimize=False)
212 def tearDown(self):
213 del self.domain
214
215 class Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace(Test_assemblage_3Do1_Contact):
216 RES_TOL=1.e-7
217 ABS_TOL=1.e-8
218 def setUp(self):
219 d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
220 x1 = ContinuousFunction(d1).getX()
221 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
222 d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
223 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
224 d2.setX(d2.getX()+[0.5,0.,0.])
225 self.domain = JoinFaces([d1,d2],optimize=False)
226 def tearDown(self):
227 del self.domain
228
229 class Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace(Test_assemblage_3Do2_Contact):
230 RES_TOL=1.e-7
231 ABS_TOL=1.e-8
232 def setUp(self):
233 d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
234 x1 = ContinuousFunction(d1).getX()
235 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
236 d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
237 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
238 d2.setX(d2.getX()+[0.5,0.,0.])
239 self.domain = JoinFaces([d1,d2],optimize=False)
240 def tearDown(self):
241 del self.domain
242
243 if __name__ == '__main__':
244 suite = unittest.TestSuite()
245 if True:
246 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex2DOrder1))
247 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex2DOrder2))
248 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex3DOrder1))
249 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex3DOrder2))
250
251 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet2DOrder1))
252 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet2DOrder2))
253 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet3DOrder1))
254 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet3DOrder2))
255
256 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact))
257 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact))
258 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact))
259 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact))
260 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace))
261 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace))
262 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace))
263 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace))
264 else:
265 pass
266
267 s=unittest.TextTestRunner(verbosity=2).run(suite)
268 if not s.wasSuccessful(): sys.exit(1)
269

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26