/[escript]/trunk/doc/examples/poisson.py
ViewVC logotype

Contents of /trunk/doc/examples/poisson.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2034 - (show annotations)
Thu Nov 13 03:03:42 2008 UTC (10 years, 11 months ago) by artak
File MIME type: text/x-python
File size: 2274 byte(s)
variable <set> is initilized to get rid of compiler warnning errors. finley/src/Quadrature.c
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 from esys.escript import *
23 from esys.escript.linearPDEs import Poisson
24 from esys.finley import Rectangle,Brick
25 import time
26 from optparse import OptionParser
27
28 import sys
29
30 #sys.stderr=None
31 parser = OptionParser(usage="%prog [-e [NE]]")
32 parser.add_option("-e", "--elements", dest="NE", help="number of elements in one direction.",metavar="NE", default=30)
33 (options, args) = parser.parse_args()
34 NE=int(options.NE)
35
36 # generate domain:
37 mydomain = Rectangle(l0=1.,l1=1.,n0=NE, n1=NE)
38 #mydomain = Brick(l0=1.,l1=1., l2=1.,n0=10, n1=10, n2=10)
39 # define characteristic function of Gamma^D
40 x = mydomain.getX()
41 gammaD = whereZero(x[0])+whereZero(x[1])
42 # define PDE and get its solution u
43 mypde = Poisson(domain=mydomain)
44 mypde.setValue(f=1,q=gammaD)
45
46 #mypde.setSolverMethod(mypde.PCG,mypde.JACOBI)
47 #t1 = time.time()
48 #u=mypde.getSolution(verbose=True)
49 #elapsed = time.time() - t1
50 #print "ESCRIPT Job completed","\t",NE,"\tin\t",elapsed,"\t(seconds)\t",elapsed/3600.0, " (hours)"
51 #print u
52
53 mypde.setSolverMethod(mypde.PCG,mypde.AMG)
54 t1 = time.time()
55 u=mypde.getSolution(verbose=True)
56 elapsed = time.time() - t1
57 print "AMG Job completed","\t",NE,"\tin\t",elapsed,"\t(seconds)\t",elapsed/3600.0, " (hours)"
58 print u
59
60 mypde.setSolverMethod(mypde.PCG,mypde.JACOBI)
61 t1 = time.time()
62 u=mypde.getSolution(verbose=True)
63 elapsed = time.time() - t1
64 print "ESCRIPT Job completed","\t",NE,"\tin\t",elapsed,"\t(seconds)\t",elapsed/3600.0, " (hours)"
65 print u
66 #u = mypde.getSolution()
67 # write u to an external file
68 #saveVTK("u.xml",sol=u)

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26