Annotation of /trunk/doc/examples/usersguide/poisson.py

Revision 2574 - (hide annotations)
Mon Aug 3 09:09:20 2009 UTC (9 years, 8 months ago) by gross
File MIME type: text/x-python
File size: 1736 byte(s)
```matplotlib description added to usersguide
```
 1 ksteube 1811 2 ######################################################## 3 # 4 jfenwick 2548 # Copyright (c) 2003-2009 by University of Queensland 5 ksteube 1811 # Earth Systems Science Computational Center (ESSCC) 6 7 # 8 # Primary Business: Queensland, Australia 9 # Licensed under the Open Software License version 3.0 10 11 # 12 ######################################################## 13 14 jfenwick 2549 __copyright__="""Copyright (c) 2003-2009 by University of Queensland 15 ksteube 1811 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 20 jfenwick 2344 __url__= 21 ksteube 1811 22 gross 565 from esys.escript import * 23 gross 567 from esys.escript.linearPDEs import Poisson 24 jfenwick 2035 from esys.finley import Rectangle 25 gross 2574 import numpy 26 import matplotlib 27 28 import pylab 29 jgs 102 # generate domain: 30 jfenwick 2035 mydomain = Rectangle(l0=1.,l1=1.,n0=40, n1=20) 31 jgs 102 # define characteristic function of Gamma^D 32 x = mydomain.getX() 33 gross 327 gammaD = whereZero(x[0])+whereZero(x[1]) 34 jgs 102 # define PDE and get its solution u 35 gross 327 mypde = Poisson(domain=mydomain) 36 mypde.setValue(f=1,q=gammaD) 37 jfenwick 2035 u = mypde.getSolution() 38 caltinay 2534 39 gross 2574 # interpolate u to a matplotlib grid: 40 x_grid = numpy.linspace(0.,1.,50) 41 y_grid = numpy.linspace(0.,1.,50) 42 z_grid = matplotlib.mlab.griddata(x=mydomain.getX()[0].toListOfTuples(),y=mydomain.getX()[1].toListOfTuples(), 43 z=interpolate(u,mydomain.getX().getFunctionSpace()).toListOfTuples(), 44 xi=x_grid,yi=y_grid ) 45 # interpolate u to a rectangular grid: 46 matplotlib.pyplot.contourf(x_grid, y_grid, z_grid, 5) 47 matplotlib.pyplot.show() 48 matplotlib.pyplot.savefig("u.png") 49

Properties

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