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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2323 - (hide annotations)
Thu Mar 19 04:23:32 2009 UTC (12 years, 4 months ago) by gross
File MIME type: text/x-python
File size: 9322 byte(s)
test for Helmholtz added
1 phornby 1894
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 gross 2323 from test_linearPDEs import Test_Poisson,Test_LinearPDE, Test_LinearPDE_noLumping, Test_TransportPDE, Test_Helmholtz
40 phornby 1894 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 gross 2315 FINLEY_TEST_MESH_PATH=os.path.join(FINLEY_TEST_DATA,"data_meshes")
54 phornby 1894
55 gross 2315 NE=8 # number of element in each spatial direction (must be even)
56 phornby 1894
57     class Test_PoissonOnFinley(Test_Poisson):
58     RES_TOL=1.e-7
59     ABS_TOL=1.e-8
60     def setUp(self):
61 gross 2315 self.domain = Rectangle(NE,NE,2,useFullElementOrder=True)
62 phornby 1894 def tearDown(self):
63     del self.domain
64    
65 gross 2323 class Test_HelmholtzOnFinley(Test_Helmholtz):
66     RES_TOL=1.e-7
67     ABS_TOL=1.e-8
68     def setUp(self):
69     self.domain = Rectangle(NE,NE,2,useFullElementOrder=True)
70     def tearDown(self):
71     del self.domain
72 phornby 1894
73 gross 2323
74 phornby 1894 class Test_AssemblePDEwithFinley_2Do1_Contact(Test_assemblage_2Do1_Contact):
75     RES_TOL=1.e-7
76     ABS_TOL=1.e-8
77     def setUp(self):
78 gross 2315 # d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)
79     # x1 = ContinuousFunction(d1).getX()
80     # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
81     # d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)
82     # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
83     # d2.setX(d2.getX()+[0.5,0.])
84     # self.domain = JoinFaces([d1,d2],optimize=False)
85     self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_2Do1_Contact.fly"))
86 phornby 1894 def tearDown(self):
87     del self.domain
88    
89     class Test_AssemblePDEwithFinley_2Do2_Contact(Test_assemblage_2Do2_Contact):
90     RES_TOL=1.e-7
91     ABS_TOL=1.e-8
92     def setUp(self):
93 gross 2315 # d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
94     # x1 = ContinuousFunction(d1).getX()
95     # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
96     # d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
97     # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
98     # d2.setX(d2.getX()+[0.5,0.])
99     # self.domain = JoinFaces([d1,d2],optimize=False)
100     self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_2Do2_Contact.fly"))
101 phornby 1894 def tearDown(self):
102     del self.domain
103    
104     class Test_AssemblePDEwithFinley_3Do1_Contact(Test_assemblage_3Do1_Contact):
105     RES_TOL=1.e-7
106     ABS_TOL=1.e-8
107     def setUp(self):
108 gross 2315 # d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)
109     # x1 = ContinuousFunction(d1).getX()
110     # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
111     # d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)
112     # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
113     # d2.setX(d2.getX()+[0.5,0.,0.])
114     # self.domain = JoinFaces([d1,d2],optimize=False)
115     self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_3Do1_Contact.fly"))
116 phornby 1894 def tearDown(self):
117     del self.domain
118    
119     class Test_AssemblePDEwithFinley_3Do2_Contact(Test_assemblage_3Do2_Contact):
120     RES_TOL=1.e-7
121     ABS_TOL=1.e-8
122     def setUp(self):
123 gross 2315 # d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
124     # x1 = ContinuousFunction(d1).getX()
125     # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
126     # d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
127     # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
128     # d2.setX(d2.getX()+[0.5,0.,0.])
129     # self.domain = JoinFaces([d1,d2],optimize=False)
130     self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_3Do2_Contact.fly"))
131 phornby 1894 def tearDown(self):
132     del self.domain
133    
134    
135     class Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace(Test_assemblage_2Do1_Contact):
136     RES_TOL=1.e-7
137     ABS_TOL=1.e-8
138     def setUp(self):
139 gross 2315 # d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True)
140     # x1 = ContinuousFunction(d1).getX()
141     # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
142     # d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True)
143     # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
144     # d2.setX(d2.getX()+[0.5,0.])
145     # self.domain = JoinFaces([d1,d2],optimize=False)
146     self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_2Do1_Contact_withElementsOnFace.fly"))
147 phornby 1894 def tearDown(self):
148     del self.domain
149    
150     class Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace(Test_assemblage_2Do2_Contact):
151     RES_TOL=1.e-7
152     ABS_TOL=1.e-8
153     def setUp(self):
154 gross 2315 # d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)
155     # x1 = ContinuousFunction(d1).getX()
156     # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
157     # d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)
158     # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
159     # d2.setX(d2.getX()+[0.5,0.])
160     # self.domain = JoinFaces([d1,d2],optimize=False)
161     self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_2Do2_Contact_withElementsOnFace.fly"))
162 phornby 1894 def tearDown(self):
163     del self.domain
164    
165     class Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace(Test_assemblage_3Do1_Contact):
166     RES_TOL=1.e-7
167     ABS_TOL=1.e-8
168     def setUp(self):
169 gross 2315 # d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,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=1,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     self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_3Do1_Contact_withElementsOnFace.fly"))
177 phornby 1894 def tearDown(self):
178     del self.domain
179    
180     class Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace(Test_assemblage_3Do2_Contact):
181     RES_TOL=1.e-7
182     ABS_TOL=1.e-8
183     def setUp(self):
184 gross 2315 # d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
185     # x1 = ContinuousFunction(d1).getX()
186     # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
187     # d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
188     # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
189     # d2.setX(d2.getX()+[0.5,0.,0.])
190     # self.domain = JoinFaces([d1,d2],optimize=False)
191     self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_3Do2_Contact_withElementsOnFace.fly"))
192 phornby 1894 def tearDown(self):
193     del self.domain
194    
195     if __name__ == '__main__':
196     suite = unittest.TestSuite()
197     if True :
198 gross 2315 suite.addTest(unittest.makeSuite(Test_PoissonOnFinley))
199 gross 2323 suite.addTest(unittest.makeSuite(Test_HelmholtzOnFinley))
200 gross 2315 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact))
201     suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact))
202     suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact))
203     suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact))
204     suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace))
205     suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace))
206     suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace))
207     suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace))
208 phornby 1894 else:
209     pass
210    
211     s=unittest.TextTestRunner(verbosity=2).run(suite)
212     if not s.wasSuccessful(): sys.exit(1)
213    

  ViewVC Help
Powered by ViewVC 1.1.26