1 |
# $Id$ |
2 |
|
3 |
""" |
4 |
Test suite for the linearPDE and pdetools test on finley |
5 |
|
6 |
@remark: |
7 |
|
8 |
@var __author__: name of author |
9 |
@var __licence__: licence agreement |
10 |
@var __url__: url entry point on documentation |
11 |
@var __version__: version |
12 |
@var __date__: date of the version |
13 |
""" |
14 |
|
15 |
__copyright__=""" Copyright (c) 2006 by ACcESS MNRF |
16 |
http://www.access.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 |
__author__="Lutz Gross, l.gross@uq.edu.au" |
21 |
__url__="http://www.iservo.edu.au/esys/escript" |
22 |
__version__="$Revision$" |
23 |
__date__="$Date$" |
24 |
|
25 |
|
26 |
import unittest |
27 |
from test_linearPDEs import Test_Poisson,Test_LinearPDE |
28 |
from test_assemblage import Test_assemblage_2Do1, Test_assemblage_2Do2, Test_assemblage_3Do1, Test_assemblage_3Do2, \ |
29 |
Test_assemblage_2Do1_Contact,Test_assemblage_2Do2_Contact, Test_assemblage_3Do1_Contact, Test_assemblage_3Do2_Contact |
30 |
from test_pdetools import Test_pdetools |
31 |
from esys.escript import * |
32 |
from esys.finley import Rectangle,Brick,JoinFaces |
33 |
import sys |
34 |
|
35 |
|
36 |
NE=6 # number of element in each spatial direction (must be even) |
37 |
|
38 |
class Test_LinearPDEOnFinley2DOrder1(Test_LinearPDE,Test_pdetools,Test_assemblage_2Do1): |
39 |
RES_TOL=1.e-7 |
40 |
ABS_TOL=1.e-8 |
41 |
def setUp(self): |
42 |
self.domain = Rectangle(NE,NE,1) |
43 |
|
44 |
class Test_LinearPDEOnFinley2DOrder2(Test_LinearPDE,Test_pdetools,Test_assemblage_2Do2): |
45 |
RES_TOL=1.e-7 |
46 |
ABS_TOL=1.e-8 |
47 |
def setUp(self): |
48 |
self.domain = Rectangle(NE,NE,2) |
49 |
|
50 |
class Test_LinearPDEOnFinley3DOrder1(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do1): |
51 |
RES_TOL=1.e-7 |
52 |
ABS_TOL=1.e-8 |
53 |
def setUp(self): |
54 |
self.domain = Brick(NE,NE,NE,1) |
55 |
|
56 |
class Test_LinearPDEOnFinley3DOrder2(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do2): |
57 |
RES_TOL=1.e-7 |
58 |
ABS_TOL=1.e-8 |
59 |
def setUp(self): |
60 |
self.domain = Brick(NE,NE,NE,2) |
61 |
|
62 |
class Test_PoissonOnFinley(Test_Poisson): |
63 |
RES_TOL=1.e-7 |
64 |
ABS_TOL=1.e-8 |
65 |
def setUp(self): |
66 |
self.domain = Rectangle(NE,NE,2) |
67 |
|
68 |
|
69 |
class Test_AssemblePDEwithFinley_2Do1_Contact(Test_assemblage_2Do1_Contact): |
70 |
RES_TOL=1.e-7 |
71 |
ABS_TOL=1.e-8 |
72 |
def setUp(self): |
73 |
d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1) |
74 |
x1 = ContinuousFunction(d1).getX() |
75 |
ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1))) |
76 |
d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1) |
77 |
ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2))) |
78 |
d2.setX(d2.getX()+[0.5,0.]) |
79 |
self.domain = JoinFaces([d1,d2]) |
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]) |
92 |
|
93 |
class Test_AssemblePDEwithFinley_3Do1_Contact(Test_assemblage_3Do1_Contact): |
94 |
RES_TOL=1.e-7 |
95 |
ABS_TOL=1.e-8 |
96 |
def setUp(self): |
97 |
d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1) |
98 |
x1 = ContinuousFunction(d1).getX() |
99 |
ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1))) |
100 |
d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1) |
101 |
ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2))) |
102 |
d2.setX(d2.getX()+[0.5,0.,0.]) |
103 |
self.domain = JoinFaces([d1,d2]) |
104 |
|
105 |
class Test_AssemblePDEwithFinley_3Do2_Contact(Test_assemblage_3Do2_Contact): |
106 |
RES_TOL=1.e-7 |
107 |
ABS_TOL=1.e-8 |
108 |
def setUp(self): |
109 |
d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2) |
110 |
x1 = ContinuousFunction(d1).getX() |
111 |
ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1))) |
112 |
d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2) |
113 |
ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2))) |
114 |
d2.setX(d2.getX()+[0.5,0.,0.]) |
115 |
self.domain = JoinFaces([d1,d2]) |
116 |
|
117 |
|
118 |
class Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace(Test_assemblage_2Do1_Contact): |
119 |
RES_TOL=1.e-7 |
120 |
ABS_TOL=1.e-8 |
121 |
def setUp(self): |
122 |
d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True) |
123 |
x1 = ContinuousFunction(d1).getX() |
124 |
ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1))) |
125 |
d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True) |
126 |
ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2))) |
127 |
d2.setX(d2.getX()+[0.5,0.]) |
128 |
self.domain = JoinFaces([d1,d2]) |
129 |
|
130 |
class Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace(Test_assemblage_2Do2_Contact): |
131 |
RES_TOL=1.e-7 |
132 |
ABS_TOL=1.e-8 |
133 |
def setUp(self): |
134 |
d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True) |
135 |
x1 = ContinuousFunction(d1).getX() |
136 |
ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1))) |
137 |
d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True) |
138 |
ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2))) |
139 |
d2.setX(d2.getX()+[0.5,0.]) |
140 |
self.domain = JoinFaces([d1,d2]) |
141 |
|
142 |
class Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace(Test_assemblage_3Do1_Contact): |
143 |
RES_TOL=1.e-7 |
144 |
ABS_TOL=1.e-8 |
145 |
def setUp(self): |
146 |
d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True) |
147 |
x1 = ContinuousFunction(d1).getX() |
148 |
ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1))) |
149 |
d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True) |
150 |
ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2))) |
151 |
d2.setX(d2.getX()+[0.5,0.,0.]) |
152 |
self.domain = JoinFaces([d1,d2]) |
153 |
|
154 |
class Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace(Test_assemblage_3Do2_Contact): |
155 |
RES_TOL=1.e-7 |
156 |
ABS_TOL=1.e-8 |
157 |
def setUp(self): |
158 |
d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True) |
159 |
x1 = ContinuousFunction(d1).getX() |
160 |
ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1))) |
161 |
d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True) |
162 |
ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2))) |
163 |
d2.setX(d2.getX()+[0.5,0.,0.]) |
164 |
self.domain = JoinFaces([d1,d2]) |
165 |
|
166 |
if __name__ == '__main__': |
167 |
suite = unittest.TestSuite() |
168 |
suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley2DOrder1)) |
169 |
suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley2DOrder2)) |
170 |
suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley3DOrder1)) |
171 |
suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley3DOrder2)) |
172 |
|
173 |
suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact)) |
174 |
suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact)) |
175 |
suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact)) |
176 |
suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact)) |
177 |
suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace)) |
178 |
suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace)) |
179 |
suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace)) |
180 |
suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace)) |
181 |
s=unittest.TextTestRunner(verbosity=2).run(suite) |
182 |
if s.wasSuccessful(): |
183 |
sys.exit(0) |
184 |
else: |
185 |
sys.exit(1) |
186 |
|