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

Contents of /trunk/doc/examples/helmholtz_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, 5 months ago) by jongui
File MIME type: text/x-python
File size: 1176 byte(s)
Upated some examples.
1 # $Id: helmholtz.py 575 2006-03-03 03:33:07Z lkettle $
2 from esys.escript import *
3 from esys.escript.linearPDEs import LinearPDE
4 from esys.finley import Rectangle
5 from esys.pyvisi import Scene, DataCollector, Map, Camera
6 from esys.pyvisi.constant import *
7
8 #... set some parameters ...
9 kappa=1.
10 omega=0.1
11 eta=10.
12 #... generate domain ...
13 mydomain = Rectangle(l0=5.,l1=1.,n0=50, n1=10)
14 #... open PDE and set coefficients ...
15 mypde=LinearPDE(mydomain)
16 mypde.setSymmetryOn()
17 n=mydomain.getNormal()
18 x=mydomain.getX()
19 mypde.setValue(A=kappa*kronecker(mydomain),D=omega,Y=omega*x[0], \
20 d=eta,y=kappa*n[0]+eta*x[0])
21 #... calculate error of the PDE solution ...
22 u=mypde.getSolution()
23 print "error is ",Lsup(u-x[0])
24 # output should be similar to "error is 1.e-7"
25 #saveVTK("x0.xml",sol=u)
26
27 s = Scene(renderer = Renderer.OFFLINE_JPG, x_size = 800, y_size = 600)
28
29 dc = DataCollector(source = Source.ESCRIPT)
30 dc.setData(sol = u)
31
32 Map(scene = s, data_collector = dc, viewport = Viewport.SOUTH_WEST,
33 lut = Lut.COLOR, cell_to_point = False, outline = True)
34
35 c = Camera(scene = s, data_collector = dc, viewport = Viewport.SOUTH_WEST)
36
37 s.render(image_name = "helmholtz.jpg")

  ViewVC Help
Powered by ViewVC 1.1.26