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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1894 by phornby, Sat Oct 18 11:00:08 2008 UTC revision 2323 by gross, Thu Mar 19 04:23:32 2009 UTC
# Line 36  __author__="Lutz Gross, l.gross@uq.edu.a Line 36  __author__="Lutz Gross, l.gross@uq.edu.a
36  import os  import os
37    
38  import unittest  import unittest
39  from test_linearPDEs import Test_Poisson,Test_LinearPDE, Test_LinearPDE_noLumping, Test_TransportPDE  from test_linearPDEs import Test_Poisson,Test_LinearPDE, Test_LinearPDE_noLumping, Test_TransportPDE, Test_Helmholtz
40  from test_assemblage import Test_assemblage_2Do1, Test_assemblage_2Do2, Test_assemblage_3Do1, Test_assemblage_3Do2, \  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                              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  from test_pdetools import Test_pdetools, Test_pdetools_noLumping
# Line 50  try: Line 50  try:
50  except KeyError:  except KeyError:
51       FINLEY_TEST_DATA='.'       FINLEY_TEST_DATA='.'
52    
53  FINLEY_TEST_MESH_PATH=FINLEY_TEST_DATA+"/data_meshes/"  FINLEY_TEST_MESH_PATH=os.path.join(FINLEY_TEST_DATA,"data_meshes")
54    
55  NE=6 # number of element in each spatial direction (must be even)  NE=8 # number of element in each spatial direction (must be even)
56    
57  class Test_PoissonOnFinley(Test_Poisson):  class Test_PoissonOnFinley(Test_Poisson):
58     RES_TOL=1.e-7     RES_TOL=1.e-7
59     ABS_TOL=1.e-8     ABS_TOL=1.e-8
60     def setUp(self):     def setUp(self):
61          self.domain = Rectangle(NE,NE,2)          self.domain = Rectangle(NE,NE,2,useFullElementOrder=True)
62       def tearDown(self):
63            del self.domain
64    
65    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):     def tearDown(self):
71          del self.domain          del self.domain
72    
# Line 67  class Test_AssemblePDEwithFinley_2Do1_Co Line 75  class Test_AssemblePDEwithFinley_2Do1_Co
75     RES_TOL=1.e-7     RES_TOL=1.e-7
76     ABS_TOL=1.e-8     ABS_TOL=1.e-8
77     def setUp(self):     def setUp(self):
78         d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)         # d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)
79         x1 = ContinuousFunction(d1).getX()         # x1 = ContinuousFunction(d1).getX()
80         ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))         # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
81         d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)         # d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)
82         ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))         # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
83         d2.setX(d2.getX()+[0.5,0.])         # d2.setX(d2.getX()+[0.5,0.])
84         self.domain = JoinFaces([d1,d2],optimize=False)         # self.domain = JoinFaces([d1,d2],optimize=False)
85           self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_2Do1_Contact.fly"))
86     def tearDown(self):     def tearDown(self):
87          del self.domain          del self.domain
88    
# Line 81  class Test_AssemblePDEwithFinley_2Do2_Co Line 90  class Test_AssemblePDEwithFinley_2Do2_Co
90     RES_TOL=1.e-7     RES_TOL=1.e-7
91     ABS_TOL=1.e-8     ABS_TOL=1.e-8
92     def setUp(self):     def setUp(self):
93         d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)         # d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
94         x1 = ContinuousFunction(d1).getX()         # x1 = ContinuousFunction(d1).getX()
95         ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))         # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
96         d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)         # d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
97         ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))         # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
98         d2.setX(d2.getX()+[0.5,0.])         # d2.setX(d2.getX()+[0.5,0.])
99         self.domain = JoinFaces([d1,d2],optimize=False)         # self.domain = JoinFaces([d1,d2],optimize=False)
100           self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_2Do2_Contact.fly"))
101     def tearDown(self):     def tearDown(self):
102          del self.domain          del self.domain
103    
# Line 95  class Test_AssemblePDEwithFinley_3Do1_Co Line 105  class Test_AssemblePDEwithFinley_3Do1_Co
105     RES_TOL=1.e-7     RES_TOL=1.e-7
106     ABS_TOL=1.e-8     ABS_TOL=1.e-8
107     def setUp(self):     def setUp(self):
108         d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)         # d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)
109         x1 = ContinuousFunction(d1).getX()         # x1 = ContinuousFunction(d1).getX()
110         ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))         # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
111         d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)         # d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)
112         ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))         # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
113         d2.setX(d2.getX()+[0.5,0.,0.])         # d2.setX(d2.getX()+[0.5,0.,0.])
114         self.domain = JoinFaces([d1,d2],optimize=False)         # self.domain = JoinFaces([d1,d2],optimize=False)
115           self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_3Do1_Contact.fly"))
116     def tearDown(self):     def tearDown(self):
117          del self.domain          del self.domain
118    
# Line 109  class Test_AssemblePDEwithFinley_3Do2_Co Line 120  class Test_AssemblePDEwithFinley_3Do2_Co
120     RES_TOL=1.e-7     RES_TOL=1.e-7
121     ABS_TOL=1.e-8     ABS_TOL=1.e-8
122     def setUp(self):     def setUp(self):
123         d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)         # d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
124         x1 = ContinuousFunction(d1).getX()         # x1 = ContinuousFunction(d1).getX()
125         ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))         # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
126         d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)         # d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
127         ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))         # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
128         d2.setX(d2.getX()+[0.5,0.,0.])         # d2.setX(d2.getX()+[0.5,0.,0.])
129         self.domain = JoinFaces([d1,d2],optimize=False)         # self.domain = JoinFaces([d1,d2],optimize=False)
130           self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_3Do2_Contact.fly"))
131     def tearDown(self):     def tearDown(self):
132          del self.domain          del self.domain
133    
# Line 124  class Test_AssemblePDEwithFinley_2Do1_Co Line 136  class Test_AssemblePDEwithFinley_2Do1_Co
136     RES_TOL=1.e-7     RES_TOL=1.e-7
137     ABS_TOL=1.e-8     ABS_TOL=1.e-8
138     def setUp(self):     def setUp(self):
139         d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True)         # d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True)
140         x1 = ContinuousFunction(d1).getX()         # x1 = ContinuousFunction(d1).getX()
141         ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))         # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
142         d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True)         # d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True)
143         ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))         # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
144         d2.setX(d2.getX()+[0.5,0.])         # d2.setX(d2.getX()+[0.5,0.])
145         self.domain = JoinFaces([d1,d2],optimize=False)         # self.domain = JoinFaces([d1,d2],optimize=False)
146           self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_2Do1_Contact_withElementsOnFace.fly"))
147     def tearDown(self):     def tearDown(self):
148          del self.domain          del self.domain
149    
# Line 138  class Test_AssemblePDEwithFinley_2Do2_Co Line 151  class Test_AssemblePDEwithFinley_2Do2_Co
151     RES_TOL=1.e-7     RES_TOL=1.e-7
152     ABS_TOL=1.e-8     ABS_TOL=1.e-8
153     def setUp(self):     def setUp(self):
154         d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)         # d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)
155         x1 = ContinuousFunction(d1).getX()         # x1 = ContinuousFunction(d1).getX()
156         ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))         # ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
157         d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)         # d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)
158         ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))         # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
159         d2.setX(d2.getX()+[0.5,0.])         # d2.setX(d2.getX()+[0.5,0.])
160         self.domain = JoinFaces([d1,d2],optimize=False)         # self.domain = JoinFaces([d1,d2],optimize=False)
161           self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_2Do2_Contact_withElementsOnFace.fly"))
162     def tearDown(self):     def tearDown(self):
163          del self.domain          del self.domain
164    
# Line 152  class Test_AssemblePDEwithFinley_3Do1_Co Line 166  class Test_AssemblePDEwithFinley_3Do1_Co
166     RES_TOL=1.e-7     RES_TOL=1.e-7
167     ABS_TOL=1.e-8     ABS_TOL=1.e-8
168     def setUp(self):     def setUp(self):
169         d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)         # d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
170         x1 = ContinuousFunction(d1).getX()         # x1 = ContinuousFunction(d1).getX()
171         ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))         # 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)         # 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)))         # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
174         d2.setX(d2.getX()+[0.5,0.,0.])         # d2.setX(d2.getX()+[0.5,0.,0.])
175         self.domain = JoinFaces([d1,d2],optimize=False)         # self.domain = JoinFaces([d1,d2],optimize=False)
176           self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_3Do1_Contact_withElementsOnFace.fly"))
177     def tearDown(self):     def tearDown(self):
178          del self.domain          del self.domain
179    
# Line 166  class Test_AssemblePDEwithFinley_3Do2_Co Line 181  class Test_AssemblePDEwithFinley_3Do2_Co
181     RES_TOL=1.e-7     RES_TOL=1.e-7
182     ABS_TOL=1.e-8     ABS_TOL=1.e-8
183     def setUp(self):     def setUp(self):
184         d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)         # d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
185         x1 = ContinuousFunction(d1).getX()         # x1 = ContinuousFunction(d1).getX()
186         ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))         # 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)         # 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)))         # ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
189         d2.setX(d2.getX()+[0.5,0.,0.])         # d2.setX(d2.getX()+[0.5,0.,0.])
190         self.domain = JoinFaces([d1,d2],optimize=False)         # self.domain = JoinFaces([d1,d2],optimize=False)
191           self.domain=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"mesh_3Do2_Contact_withElementsOnFace.fly"))
192     def tearDown(self):     def tearDown(self):
193          del self.domain          del self.domain
194    
195  if __name__ == '__main__':  if __name__ == '__main__':
196     suite = unittest.TestSuite()     suite = unittest.TestSuite()
197     if True :     if True :
198        # These tests use JoinFaces and are not MPI parallel        suite.addTest(unittest.makeSuite(Test_PoissonOnFinley))
199        if getMPISizeWorld() == 1:        suite.addTest(unittest.makeSuite(Test_HelmholtzOnFinley))
200          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact))        suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact))
201          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact))        suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact))
202          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact))        suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact))
203          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact))        suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact))
204          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace))        suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace))
205          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace))        suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace))
206          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace))        suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace))
207          suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace))        suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace))
   
208     else:     else:
209        pass        pass
210    

Legend:
Removed from v.1894  
changed lines
  Added in v.2323

  ViewVC Help
Powered by ViewVC 1.1.26