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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1099 - (show annotations)
Tue Apr 17 01:45:08 2007 UTC (12 years, 3 months ago) by jongui
File MIME type: text/x-python
File size: 976 byte(s)
Upated some examples.
1 # $Id: poisson.py 567 2006-02-28 03:58:05Z gross $
2 from esys.escript import *
3 from esys.escript.linearPDEs import Poisson
4 from esys.finley import Rectangle
5 from esys.pyvisi import Scene, DataCollector, Map, Camera
6 from esys.pyvisi.constant import *
7
8 # generate domain:
9 mydomain = Rectangle(l0=1.,l1=1.,n0=40, n1=20)
10 # define characteristic function of Gamma^D
11 x = mydomain.getX()
12 gammaD = whereZero(x[0])+whereZero(x[1])
13 # define PDE and get its solution u
14 mypde = Poisson(domain=mydomain)
15 mypde.setValue(f=1,q=gammaD)
16 u = mypde.getSolution()
17 # write u to an external file
18 #saveVTK("u.xml",sol=u)
19
20 s = Scene(renderer = Renderer.OFFLINE_JPG, x_size = 500, y_size = 500)
21
22 dc = DataCollector(source = Source.ESCRIPT)
23 dc.setData(sol = u)
24
25 Map(scene = s, data_collector = dc, viewport = Viewport.SOUTH_WEST,
26 lut = Lut.COLOR, cell_to_point = True, outline = True)
27
28 c = Camera(scene = s, data_collector = dc, viewport = Viewport.SOUTH_WEST)
29
30 s.render(image_name = "poisson.jpg")

  ViewVC Help
Powered by ViewVC 1.1.26