/[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 1894 - (show annotations)
Sat Oct 18 11:00:08 2008 UTC (12 years, 9 months ago) by phornby
File MIME type: text/x-python
File size: 8123 byte(s)
Break run_linearPDEsOnFinley.py into 3 separate test modules to avoid crashes on winblows
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=FINLEY_TEST_DATA+"/data_meshes/"
54
55 NE=6 # 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)
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 def tearDown(self):
78 del self.domain
79
80 class Test_AssemblePDEwithFinley_2Do2_Contact(Test_assemblage_2Do2_Contact):
81 RES_TOL=1.e-7
82 ABS_TOL=1.e-8
83 def setUp(self):
84 d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
85 x1 = ContinuousFunction(d1).getX()
86 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
87 d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
88 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
89 d2.setX(d2.getX()+[0.5,0.])
90 self.domain = JoinFaces([d1,d2],optimize=False)
91 def tearDown(self):
92 del self.domain
93
94 class Test_AssemblePDEwithFinley_3Do1_Contact(Test_assemblage_3Do1_Contact):
95 RES_TOL=1.e-7
96 ABS_TOL=1.e-8
97 def setUp(self):
98 d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)
99 x1 = ContinuousFunction(d1).getX()
100 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
101 d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)
102 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
103 d2.setX(d2.getX()+[0.5,0.,0.])
104 self.domain = JoinFaces([d1,d2],optimize=False)
105 def tearDown(self):
106 del self.domain
107
108 class Test_AssemblePDEwithFinley_3Do2_Contact(Test_assemblage_3Do2_Contact):
109 RES_TOL=1.e-7
110 ABS_TOL=1.e-8
111 def setUp(self):
112 d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
113 x1 = ContinuousFunction(d1).getX()
114 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
115 d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
116 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
117 d2.setX(d2.getX()+[0.5,0.,0.])
118 self.domain = JoinFaces([d1,d2],optimize=False)
119 def tearDown(self):
120 del self.domain
121
122
123 class Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace(Test_assemblage_2Do1_Contact):
124 RES_TOL=1.e-7
125 ABS_TOL=1.e-8
126 def setUp(self):
127 d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True)
128 x1 = ContinuousFunction(d1).getX()
129 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
130 d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True)
131 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
132 d2.setX(d2.getX()+[0.5,0.])
133 self.domain = JoinFaces([d1,d2],optimize=False)
134 def tearDown(self):
135 del self.domain
136
137 class Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace(Test_assemblage_2Do2_Contact):
138 RES_TOL=1.e-7
139 ABS_TOL=1.e-8
140 def setUp(self):
141 d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)
142 x1 = ContinuousFunction(d1).getX()
143 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
144 d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)
145 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
146 d2.setX(d2.getX()+[0.5,0.])
147 self.domain = JoinFaces([d1,d2],optimize=False)
148 def tearDown(self):
149 del self.domain
150
151 class Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace(Test_assemblage_3Do1_Contact):
152 RES_TOL=1.e-7
153 ABS_TOL=1.e-8
154 def setUp(self):
155 d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
156 x1 = ContinuousFunction(d1).getX()
157 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
158 d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
159 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
160 d2.setX(d2.getX()+[0.5,0.,0.])
161 self.domain = JoinFaces([d1,d2],optimize=False)
162 def tearDown(self):
163 del self.domain
164
165 class Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace(Test_assemblage_3Do2_Contact):
166 RES_TOL=1.e-7
167 ABS_TOL=1.e-8
168 def setUp(self):
169 d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
170 x1 = ContinuousFunction(d1).getX()
171 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
172 d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
173 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
174 d2.setX(d2.getX()+[0.5,0.,0.])
175 self.domain = JoinFaces([d1,d2],optimize=False)
176 def tearDown(self):
177 del self.domain
178
179 if __name__ == '__main__':
180 suite = unittest.TestSuite()
181 if True :
182 # These tests use JoinFaces and are not MPI parallel
183 if getMPISizeWorld() == 1:
184 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact))
185 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact))
186 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact))
187 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact))
188 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace))
189 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace))
190 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace))
191 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace))
192
193 else:
194 pass
195
196 s=unittest.TextTestRunner(verbosity=2).run(suite)
197 if not s.wasSuccessful(): sys.exit(1)
198

  ViewVC Help
Powered by ViewVC 1.1.26