/[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 2315 - (show annotations)
Wed Mar 18 00:38:48 2009 UTC (10 years, 4 months ago) by gross
File MIME type: text/x-python
File size: 9019 byte(s)
fixes for MPI
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 os
37
38 import unittest
39 from test_linearPDEs import Test_Poisson,Test_LinearPDE, Test_LinearPDE_noLumping, Test_TransportPDE
40 from test_assemblage import Test_assemblage_2Do1, Test_assemblage_2Do2, Test_assemblage_3Do1, Test_assemblage_3Do2, \
41 Test_assemblage_2Do1_Contact,Test_assemblage_2Do2_Contact, Test_assemblage_3Do1_Contact, Test_assemblage_3Do2_Contact
42 from test_pdetools import Test_pdetools, Test_pdetools_noLumping
43 from esys.escript import *
44 from esys.finley import Rectangle,Brick,JoinFaces, ReadMesh
45 import sys
46
47
48 try:
49 FINLEY_TEST_DATA=os.environ['FINLEY_TEST_DATA']
50 except KeyError:
51 FINLEY_TEST_DATA='.'
52
53 FINLEY_TEST_MESH_PATH=os.path.join(FINLEY_TEST_DATA,"data_meshes")
54
55 NE=8 # number of element in each spatial direction (must be even)
56
57 class Test_PoissonOnFinley(Test_Poisson):
58 RES_TOL=1.e-7
59 ABS_TOL=1.e-8
60 def setUp(self):
61 self.domain = Rectangle(NE,NE,2,useFullElementOrder=True)
62 def tearDown(self):
63 del self.domain
64
65
66 class Test_AssemblePDEwithFinley_2Do1_Contact(Test_assemblage_2Do1_Contact):
67 RES_TOL=1.e-7
68 ABS_TOL=1.e-8
69 def setUp(self):
70 # d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)
71 # x1 = ContinuousFunction(d1).getX()
72 # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
73 # d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)
74 # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
75 # d2.setX(d2.getX()+[0.5,0.])
76 # self.domain = JoinFaces([d1,d2],optimize=False)
77 self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_2Do1_Contact.fly"))
78 def tearDown(self):
79 del self.domain
80
81 class Test_AssemblePDEwithFinley_2Do2_Contact(Test_assemblage_2Do2_Contact):
82 RES_TOL=1.e-7
83 ABS_TOL=1.e-8
84 def setUp(self):
85 # d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
86 # x1 = ContinuousFunction(d1).getX()
87 # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
88 # d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
89 # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
90 # d2.setX(d2.getX()+[0.5,0.])
91 # self.domain = JoinFaces([d1,d2],optimize=False)
92 self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_2Do2_Contact.fly"))
93 def tearDown(self):
94 del self.domain
95
96 class Test_AssemblePDEwithFinley_3Do1_Contact(Test_assemblage_3Do1_Contact):
97 RES_TOL=1.e-7
98 ABS_TOL=1.e-8
99 def setUp(self):
100 # d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)
101 # x1 = ContinuousFunction(d1).getX()
102 # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
103 # d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)
104 # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
105 # d2.setX(d2.getX()+[0.5,0.,0.])
106 # self.domain = JoinFaces([d1,d2],optimize=False)
107 self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_3Do1_Contact.fly"))
108 def tearDown(self):
109 del self.domain
110
111 class Test_AssemblePDEwithFinley_3Do2_Contact(Test_assemblage_3Do2_Contact):
112 RES_TOL=1.e-7
113 ABS_TOL=1.e-8
114 def setUp(self):
115 # d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
116 # x1 = ContinuousFunction(d1).getX()
117 # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
118 # d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
119 # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
120 # d2.setX(d2.getX()+[0.5,0.,0.])
121 # self.domain = JoinFaces([d1,d2],optimize=False)
122 self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_3Do2_Contact.fly"))
123 def tearDown(self):
124 del self.domain
125
126
127 class Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace(Test_assemblage_2Do1_Contact):
128 RES_TOL=1.e-7
129 ABS_TOL=1.e-8
130 def setUp(self):
131 # d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True)
132 # x1 = ContinuousFunction(d1).getX()
133 # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
134 # d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True)
135 # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
136 # d2.setX(d2.getX()+[0.5,0.])
137 # self.domain = JoinFaces([d1,d2],optimize=False)
138 self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_2Do1_Contact_withElementsOnFace.fly"))
139 def tearDown(self):
140 del self.domain
141
142 class Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace(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,useElementsOnFace=True)
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,useElementsOnFace=True)
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 self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_2Do2_Contact_withElementsOnFace.fly"))
154 def tearDown(self):
155 del self.domain
156
157 class Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace(Test_assemblage_3Do1_Contact):
158 RES_TOL=1.e-7
159 ABS_TOL=1.e-8
160 def setUp(self):
161 # d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
162 # x1 = ContinuousFunction(d1).getX()
163 # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
164 # d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
165 # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
166 # d2.setX(d2.getX()+[0.5,0.,0.])
167 # self.domain = JoinFaces([d1,d2],optimize=False)
168 self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_3Do1_Contact_withElementsOnFace.fly"))
169 def tearDown(self):
170 del self.domain
171
172 class Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace(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,useElementsOnFace=True)
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,useElementsOnFace=True)
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 self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_3Do2_Contact_withElementsOnFace.fly"))
184 def tearDown(self):
185 del self.domain
186
187 if __name__ == '__main__':
188 suite = unittest.TestSuite()
189 if True :
190 suite.addTest(unittest.makeSuite(Test_PoissonOnFinley))
191 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact))
192 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact))
193 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact))
194 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact))
195 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace))
196 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace))
197 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace))
198 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace))
199 else:
200 pass
201
202 s=unittest.TextTestRunner(verbosity=2).run(suite)
203 if not s.wasSuccessful(): sys.exit(1)
204

  ViewVC Help
Powered by ViewVC 1.1.26