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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4984 - (show annotations)
Mon Jun 2 02:50:34 2014 UTC (4 years, 10 months ago) by sshaw
File MIME type: text/x-python
File size: 8695 byte(s)
revamping testrunners, now uses automated discovery and allows running specific tests without modifying files (see escriptcore/py_src/testing.py for more info/examples)

1
2 ########################################################
3 #
4 # Copyright (c) 2003-2014 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au
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-2014 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.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 __url__="https://launchpad.net/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 os
37
38 import esys.escriptcore.utestselect as unittest
39 from esys.escriptcore.testing import *
40 from test_linearPDEs import Test_Poisson,Test_LinearPDE, Test_LinearPDE_noLumping, Test_TransportPDE, Test_Helmholtz, Test_LameEquation
41 from test_assemblage import Test_assemblage_2Do1, Test_assemblage_2Do2, Test_assemblage_3Do1, Test_assemblage_3Do2, \
42 Test_assemblage_2Do1_Contact,Test_assemblage_2Do2_Contact, Test_assemblage_3Do1_Contact, Test_assemblage_3Do2_Contact
43 from test_pdetools import Test_pdetools, Test_pdetools_noLumping
44 from esys.escript import *
45 from esys.finley import Rectangle,Brick,JoinFaces, ReadMesh
46 import sys
47
48
49 try:
50 FINLEY_TEST_DATA=os.environ['FINLEY_TEST_DATA']
51 except KeyError:
52 FINLEY_TEST_DATA='.'
53
54 FINLEY_TEST_MESH_PATH=os.path.join(FINLEY_TEST_DATA,"data_meshes")
55
56 NE=8 # number of element in each spatial direction (must be even)
57
58 class Test_LameOnFinley(Test_LameEquation):
59 RES_TOL=1.e-7
60 ABS_TOL=1.e-8
61 def setUp(self):
62 self.domain = Rectangle(NE,NE,2,useElementsOnFace=0, useFullElementOrder=True)
63 def tearDown(self):
64 del self.domain
65 class Test_PoissonOnFinley(Test_Poisson):
66 RES_TOL=1.e-7
67 ABS_TOL=1.e-8
68 def setUp(self):
69 self.domain = Rectangle(NE,NE,2,useElementsOnFace=0,useFullElementOrder=True)
70 def tearDown(self):
71 del self.domain
72
73 class Test_HelmholtzOnFinley(Test_Helmholtz):
74 RES_TOL=1.e-7
75 ABS_TOL=1.e-8
76 def setUp(self):
77 self.domain = Rectangle(NE,NE,2,useElementsOnFace=0,useFullElementOrder=True)
78 def tearDown(self):
79 del self.domain
80
81
82 class Test_AssemblePDEwithFinley_2Do1_Contact(Test_assemblage_2Do1_Contact):
83 RES_TOL=1.e-7
84 ABS_TOL=1.e-8
85 def setUp(self):
86 # d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)
87 # x1 = ContinuousFunction(d1).getX()
88 # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
89 # d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)
90 # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
91 # d2.setX(d2.getX()+[0.5,0.])
92 # self.domain = JoinFaces([d1,d2],optimize=False)
93 self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_2Do1_Contact.fly"))
94 def tearDown(self):
95 del self.domain
96
97 class Test_AssemblePDEwithFinley_2Do2_Contact(Test_assemblage_2Do2_Contact):
98 RES_TOL=1.e-7
99 ABS_TOL=1.e-8
100 def setUp(self):
101 # d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
102 # x1 = ContinuousFunction(d1).getX()
103 # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
104 # d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
105 # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
106 # d2.setX(d2.getX()+[0.5,0.])
107 # self.domain = JoinFaces([d1,d2],optimize=False)
108 self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_2Do2_Contact.fly"))
109 def tearDown(self):
110 del self.domain
111
112 class Test_AssemblePDEwithFinley_3Do1_Contact(Test_assemblage_3Do1_Contact):
113 RES_TOL=1.e-7
114 ABS_TOL=1.e-8
115 def setUp(self):
116 # d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)
117 # x1 = ContinuousFunction(d1).getX()
118 # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
119 # d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)
120 # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
121 # d2.setX(d2.getX()+[0.5,0.,0.])
122 # self.domain = JoinFaces([d1,d2],optimize=False)
123 self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_3Do1_Contact.fly"))
124 def tearDown(self):
125 del self.domain
126
127 class Test_AssemblePDEwithFinley_3Do2_Contact(Test_assemblage_3Do2_Contact):
128 RES_TOL=1.e-7
129 ABS_TOL=1.e-8
130 def setUp(self):
131 # d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
132 # x1 = ContinuousFunction(d1).getX()
133 # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
134 # d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
135 # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
136 # d2.setX(d2.getX()+[0.5,0.,0.])
137 # self.domain = JoinFaces([d1,d2],optimize=False)
138 self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_3Do2_Contact.fly"))
139 def tearDown(self):
140 del self.domain
141
142
143 class Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace(Test_assemblage_2Do1_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=1,useElementsOnFace=True)
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=1,useElementsOnFace=True)
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 self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_2Do1_Contact_withElementsOnFace.fly"))
155 def tearDown(self):
156 del self.domain
157
158 class Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace(Test_assemblage_2Do2_Contact):
159 RES_TOL=1.e-7
160 ABS_TOL=1.e-8
161 def setUp(self):
162 # d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)
163 # x1 = ContinuousFunction(d1).getX()
164 # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
165 # d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)
166 # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
167 # d2.setX(d2.getX()+[0.5,0.])
168 # self.domain = JoinFaces([d1,d2],optimize=False)
169 self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_2Do2_Contact_withElementsOnFace.fly"))
170 def tearDown(self):
171 del self.domain
172
173 class Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace(Test_assemblage_3Do1_Contact):
174 RES_TOL=1.e-7
175 ABS_TOL=1.e-8
176 def setUp(self):
177 # d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
178 # x1 = ContinuousFunction(d1).getX()
179 # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
180 # d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
181 # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
182 # d2.setX(d2.getX()+[0.5,0.,0.])
183 # self.domain = JoinFaces([d1,d2],optimize=False)
184 self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_3Do1_Contact_withElementsOnFace.fly"))
185 def tearDown(self):
186 del self.domain
187
188 class Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace(Test_assemblage_3Do2_Contact):
189 RES_TOL=1.e-7
190 ABS_TOL=1.e-8
191 def setUp(self):
192 # d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
193 # x1 = ContinuousFunction(d1).getX()
194 # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
195 # d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
196 # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
197 # d2.setX(d2.getX()+[0.5,0.,0.])
198 # self.domain = JoinFaces([d1,d2],optimize=False)
199 self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_3Do2_Contact_withElementsOnFace.fly"))
200 def tearDown(self):
201 del self.domain
202
203 if __name__ == '__main__':
204 run_tests(__name__, exit_on_failure=True)
205

  ViewVC Help
Powered by ViewVC 1.1.26