/[escript]/branches/trilinos_from_5897/ripley/test/python/run_trilinosSolversOnMultiRes.py
ViewVC logotype

Contents of /branches/trilinos_from_5897/ripley/test/python/run_trilinosSolversOnMultiRes.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6100 - (show annotations)
Tue Mar 29 04:56:51 2016 UTC (2 years, 10 months ago) by caltinay
File MIME type: text/x-python
File size: 8348 byte(s)
Fixed node IDs for 2D multiresolution ripley domains and added trilinos tests.

1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2016 by The University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Open Software License version 3.0
9 # http://www.opensource.org/licenses/osl-3.0.php
10 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development 2012-2013 by School of Earth Sciences
13 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 #
15 ##############################################################################
16
17 from __future__ import print_function, division
18
19 __copyright__="""Copyright (c) 2003-2016 by The University of Queensland
20 http://www.uq.edu.au
21 Primary Business: Queensland, Australia"""
22 __license__="""Licensed under the Open Software License version 3.0
23 http://www.opensource.org/licenses/osl-3.0.php"""
24 __url__="https://launchpad.net/escript-finley"
25
26 """
27 Test suite for PDE solvers on ripley multiresolution domains
28 """
29
30 from test_simplesolve import SimpleSolveTestCase
31 import esys.escriptcore.utestselect as unittest
32 from esys.escriptcore.testing import *
33
34 from esys.escript import getMPISizeWorld, sqrt
35 from esys.ripley import MultiResolutionDomain
36 from esys.escript.linearPDEs import SolverOptions
37
38 # number of elements in the spatial directions
39 NE0=10
40 NE1=10
41 NE2=9
42 mpiSize=getMPISizeWorld()
43 for x in [int(sqrt(mpiSize)),2,3,5,7,1]:
44 NX=x
45 NY=mpiSize//x
46 if NX*NY == mpiSize:
47 break
48
49 for x in [(int(mpiSize**(1/3.)),int(mpiSize**(1/3.))),(2,3),(2,2),(1,2),(1,1)]:
50 NXb=x[0]
51 NYb=x[1]
52 NZb=mpiSize//(x[0]*x[1])
53 if NXb*NYb*NZb == mpiSize:
54 break
55
56 def Rectangle(**kwargs):
57 m = MultiResolutionDomain(2, **kwargs)
58 return m.getLevel(1)
59
60 def Brick(**kwargs):
61 m = MultiResolutionDomain(3, **kwargs)
62 return m.getLevel(1)
63
64 class SimpleSolveSingleOnly(SimpleSolveTestCase):
65 @unittest.skip("PDE systems not supported with Trilinos yet")
66 def test_system(self):
67 pass
68
69 ### BiCGStab + Jacobi
70
71 class Test_SimpleSolveMultiRes2D_Trilinos_BICGSTAB_Jacobi(SimpleSolveSingleOnly):
72 def setUp(self):
73 self.domain = Rectangle(n0=NE0*NX-1, n1=NE1*NY-1, d0=NX, d1=NY)
74 self.package = SolverOptions.TRILINOS
75 self.method = SolverOptions.BICGSTAB
76 self.preconditioner = SolverOptions.JACOBI
77
78 def tearDown(self):
79 del self.domain
80
81 @unittest.skipIf(mpiSize > 1, "3D Multiresolution domains require single process")
82 class Test_SimpleSolveMultiRes3D_Trilinos_BICGSTAB_Jacobi(SimpleSolveSingleOnly):
83 def setUp(self):
84 self.domain = Brick(n0=NE0*NXb-1, n1=NE1*NYb-1, n2=NE2*NZb-1, d0=NXb, d1=NYb, d2=NZb)
85 self.package = SolverOptions.TRILINOS
86 self.method = SolverOptions.BICGSTAB
87 self.preconditioner = SolverOptions.JACOBI
88
89 def tearDown(self):
90 del self.domain
91
92 ### GMRES + Jacobi
93
94 class Test_SimpleSolveMultiRes2D_Trilinos_GMRES_Jacobi(SimpleSolveSingleOnly):
95 def setUp(self):
96 self.domain = Rectangle(n0=NE0*NX-1, n1=NE1*NY-1, d0=NX, d1=NY)
97 self.package = SolverOptions.TRILINOS
98 self.method = SolverOptions.GMRES
99 self.preconditioner = SolverOptions.JACOBI
100
101 def tearDown(self):
102 del self.domain
103
104 @unittest.skipIf(mpiSize > 1, "3D Multiresolution domains require single process")
105 class Test_SimpleSolveMultiRes3D_Trilinos_GMRES_Jacobi(SimpleSolveSingleOnly):
106 def setUp(self):
107 self.domain = Brick(n0=NE0*NXb-1, n1=NE1*NYb-1, n2=NE2*NZb-1, d0=NXb, d1=NYb, d2=NZb)
108 self.package = SolverOptions.TRILINOS
109 self.method = SolverOptions.GMRES
110 self.preconditioner = SolverOptions.JACOBI
111
112 def tearDown(self):
113 del self.domain
114
115 ### PCG + Jacobi
116
117 class Test_SimpleSolveMultiRes2D_Trilinos_PCG_Jacobi(SimpleSolveSingleOnly):
118 def setUp(self):
119 self.domain = Rectangle(n0=NE0*NX-1, n1=NE1*NY-1, d0=NX, d1=NY)
120 self.package = SolverOptions.TRILINOS
121 self.method = SolverOptions.PCG
122 self.preconditioner = SolverOptions.JACOBI
123
124 def tearDown(self):
125 del self.domain
126
127 @unittest.skipIf(mpiSize > 1, "3D Multiresolution domains require single process")
128 class Test_SimpleSolveMultiRes3D_Trilinos_PCG_Jacobi(SimpleSolveSingleOnly):
129 def setUp(self):
130 self.domain = Brick(n0=NE0*NXb-1, n1=NE1*NYb-1, n2=NE2*NZb-1, d0=NXb, d1=NYb, d2=NZb)
131 self.package = SolverOptions.TRILINOS
132 self.method = SolverOptions.PCG
133 self.preconditioner = SolverOptions.JACOBI
134
135 def tearDown(self):
136 del self.domain
137
138 ### MINRES + Jacobi
139
140 class Test_SimpleSolveMultiRes2D_Trilinos_MINRES_Jacobi(SimpleSolveSingleOnly):
141 def setUp(self):
142 self.domain = Rectangle(n0=NE0*NX-1, n1=NE1*NY-1, d0=NX, d1=NY)
143 self.package = SolverOptions.TRILINOS
144 self.method = SolverOptions.MINRES
145 self.preconditioner = SolverOptions.JACOBI
146
147 def tearDown(self):
148 del self.domain
149
150 @unittest.skipIf(mpiSize > 1, "3D Multiresolution domains require single process")
151 class Test_SimpleSolveMultiRes3D_Trilinos_MINRES_Jacobi(SimpleSolveSingleOnly):
152 def setUp(self):
153 self.domain = Brick(n0=NE0*NXb-1, n1=NE1*NYb-1, n2=NE2*NZb-1, d0=NXb, d1=NYb, d2=NZb)
154 self.package = SolverOptions.TRILINOS
155 self.method = SolverOptions.MINRES
156 self.preconditioner = SolverOptions.JACOBI
157
158 def tearDown(self):
159 del self.domain
160
161 ### TFQMR + RILU
162
163 class Test_SimpleSolveMultiRes2D_Trilinos_TFQMR_RILU(SimpleSolveSingleOnly):
164 def setUp(self):
165 self.domain = Rectangle(n0=NE0*NX-1, n1=NE1*NY-1, d0=NX, d1=NY)
166 self.package = SolverOptions.TRILINOS
167 self.method = SolverOptions.TFQMR
168 self.preconditioner = SolverOptions.RILU
169
170 def tearDown(self):
171 del self.domain
172
173 @unittest.skipIf(mpiSize > 1, "3D Multiresolution domains require single process")
174 class Test_SimpleSolveMultiRes3D_Trilinos_TFQMR_RILU(SimpleSolveSingleOnly):
175 def setUp(self):
176 self.domain = Brick(n0=NE0*NXb-1, n1=NE1*NYb-1, n2=NE2*NZb-1, d0=NXb, d1=NYb, d2=NZb)
177 self.package = SolverOptions.TRILINOS
178 self.method = SolverOptions.TFQMR
179 self.preconditioner = SolverOptions.RILU
180
181 def tearDown(self):
182 del self.domain
183
184 ### LSQR + AMG
185
186 class Test_SimpleSolveMultiRes2D_Trilinos_LSQR_AMG(SimpleSolveSingleOnly):
187 def setUp(self):
188 self.domain = Rectangle(n0=NE0*NX-1, n1=NE1*NY-1, d0=NX, d1=NY)
189 self.package = SolverOptions.TRILINOS
190 self.method = SolverOptions.LSQR
191 self.preconditioner = SolverOptions.AMG
192
193 def tearDown(self):
194 del self.domain
195
196 ### PCG + AMG
197
198 class Test_SimpleSolveMultiRes2D_Trilinos_PCG_AMG(SimpleSolveSingleOnly):
199 def setUp(self):
200 self.domain = Rectangle(n0=NE0*NX-1, n1=NE1*NY-1, d0=NX, d1=NY)
201 self.package = SolverOptions.TRILINOS
202 self.method = SolverOptions.PCG
203 self.preconditioner = SolverOptions.AMG
204
205 def tearDown(self):
206 del self.domain
207
208 @unittest.skipIf(mpiSize > 1, "3D Multiresolution domains require single process")
209 class Test_SimpleSolveMultiRes3D_Trilinos_PCG_AMG(SimpleSolveSingleOnly):
210 def setUp(self):
211 self.domain = Brick(n0=NE0*NXb-1, n1=NE1*NYb-1, n2=NE2*NZb-1, d0=NXb, d1=NYb, d2=NZb)
212 self.package = SolverOptions.TRILINOS
213 self.method = SolverOptions.PCG
214 self.preconditioner = SolverOptions.AMG
215
216 def tearDown(self):
217 del self.domain
218
219 ### PCG + ILUT
220
221 class Test_SimpleSolveMultiRes2D_Trilinos_PCG_ILUT(SimpleSolveSingleOnly):
222 def setUp(self):
223 self.domain = Rectangle(n0=NE0*NX-1, n1=NE1*NY-1, d0=NX, d1=NY)
224 self.package = SolverOptions.TRILINOS
225 self.method = SolverOptions.PCG
226 self.preconditioner = SolverOptions.ILUT
227
228 def tearDown(self):
229 del self.domain
230
231 @unittest.skipIf(mpiSize > 1, "3D Multiresolution domains require single process")
232 class Test_SimpleSolveMultiRes3D_Trilinos_PCG_ILUT(SimpleSolveSingleOnly):
233 def setUp(self):
234 self.domain = Brick(n0=NE0*NXb-1, n1=NE1*NYb-1, n2=NE2*NZb-1, d0=NXb, d1=NYb, d2=NZb)
235 self.package = SolverOptions.TRILINOS
236 self.method = SolverOptions.PCG
237 self.preconditioner = SolverOptions.ILUT
238
239 def tearDown(self):
240 del self.domain
241
242
243 if __name__ == '__main__':
244 run_tests(__name__, exit_on_failure=True)
245

  ViewVC Help
Powered by ViewVC 1.1.26