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

Annotation of /trunk/doc/examples/pyvisi/helmholtz_with_pyvisi.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1150 - (hide annotations)
Thu May 17 00:42:34 2007 UTC (13 years, 4 months ago) by jongui
File MIME type: text/x-python
File size: 1332 byte(s)
Added the new images.
1 ksteube 1147 # Import the necessary moduels.
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 jongui 1148 import os
8 ksteube 1147
9 jongui 1148 PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
10 ksteube 1147 X_SIZE = 400
11     Y_SIZE = 300
12     JPG_RENDERER = Renderer.ONLINE_JPG
13    
14     #... set some parameters ...
15     kappa=1.
16     omega=0.1
17     eta=10.
18     #... generate domain ...
19     mydomain = Rectangle(l0=5.,l1=1.,n0=50, n1=10)
20     #... open PDE and set coefficients ...
21     mypde=LinearPDE(mydomain)
22     mypde.setSymmetryOn()
23     n=mydomain.getNormal()
24     x=mydomain.getX()
25     mypde.setValue(A=kappa*kronecker(mydomain),D=omega,Y=omega*x[0], \
26     d=eta,y=kappa*n[0]+eta*x[0])
27     #... calculate error of the PDE solution ...
28     u=mypde.getSolution()
29    
30     # Create a Scene.
31     s = Scene(renderer = JPG_RENDERER, x_size = X_SIZE, y_size = Y_SIZE)
32    
33     # Create a DataCollector reading directly from an escript object.
34     dc = DataCollector(source = Source.ESCRIPT)
35     dc.setData(sol = u)
36    
37     # Create a Map.
38     Map(scene = s, data_collector = dc, viewport = Viewport.SOUTH_WEST,
39     lut = Lut.COLOR, cell_to_point = False, outline = True)
40    
41     # Create a Camera.
42 jongui 1148 c = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
43 ksteube 1147
44 jongui 1148
45 ksteube 1147 # Render the object.
46 jongui 1148 s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, "helmholtz.jpg"))

  ViewVC Help
Powered by ViewVC 1.1.26