/[escript]/trunk-mpi-branch/doc/examples/pyvisi/helmholtz_with_pyvisi.py
ViewVC logotype

Contents of /trunk-mpi-branch/doc/examples/pyvisi/helmholtz_with_pyvisi.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1295 - (show annotations)
Mon Sep 10 06:07:09 2007 UTC (11 years, 7 months ago) by ksteube
File MIME type: text/x-python
File size: 1418 byte(s)
Have now merged latest trunk features into MPI branch in preparation for
ending the MPI branch.
Compiles but has run time problems in bandwith reduction.

1 """
2 Author: Lutz Gross, l.gross@uq.edu.au
3 Author: John Ngui, john.ngui@uq.edu.au
4 """
5
6 # Import the necessary moduels.
7 from esys.escript import *
8 from esys.escript.linearPDEs import LinearPDE
9 from esys.finley import Rectangle
10 from esys.pyvisi import Scene, DataCollector, Map, Camera
11 from esys.pyvisi.constant import *
12 import os
13
14 PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
15 X_SIZE = 400
16 Y_SIZE = 300
17 JPG_RENDERER = Renderer.ONLINE_JPG
18
19 #... set some parameters ...
20 kappa=1.
21 omega=0.1
22 eta=10.
23 #... generate domain ...
24 mydomain = Rectangle(l0=5.,l1=1.,n0=50, n1=10)
25
26 #... open PDE and set coefficients ...
27 mypde=LinearPDE(mydomain)
28 mypde.setSymmetryOn()
29 n=mydomain.getNormal()
30 x=mydomain.getX()
31 mypde.setValue(A=kappa*kronecker(mydomain),D=omega,Y=omega*x[0], \
32 d=eta,y=kappa*n[0]+eta*x[0])
33 #... calculate error of the PDE solution ...
34 u=mypde.getSolution()
35
36 # Create a Scene.
37 s = Scene(renderer = JPG_RENDERER, x_size = X_SIZE, y_size = Y_SIZE)
38
39 # Create a DataCollector reading directly from an escript object.
40 dc = DataCollector(source = Source.ESCRIPT)
41 dc.setData(sol = u)
42
43 # Create a Map.
44 Map(scene = s, data_collector = dc, viewport = Viewport.SOUTH_WEST,
45 lut = Lut.COLOR, cell_to_point = False, outline = True)
46
47 # Create a Camera.
48 c = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
49
50 # Render the object.
51 s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, "helmholtz.jpg"))

  ViewVC Help
Powered by ViewVC 1.1.26