/[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 1306 - (show annotations)
Tue Sep 18 05:51:09 2007 UTC (11 years, 11 months ago) by ksteube
File MIME type: text/x-python
File size: 1846 byte(s)
New Copyright in each .c .h .cpp and .py file

1 #
2 # $Id$
3 #
4 #######################################################
5 #
6 # Copyright 2003-2007 by ACceSS MNRF
7 # Copyright 2007 by University of Queensland
8 #
9 # http://esscc.uq.edu.au
10 # Primary Business: Queensland, Australia
11 # Licensed under the Open Software License version 3.0
12 # http://www.opensource.org/licenses/osl-3.0.php
13 #
14 #######################################################
15 #
16
17 """
18 Author: Lutz Gross, l.gross@uq.edu.au
19 Author: John Ngui, john.ngui@uq.edu.au
20 """
21
22 # Import the necessary moduels.
23 from esys.escript import *
24 from esys.escript.linearPDEs import LinearPDE
25 from esys.finley import Rectangle
26 from esys.pyvisi import Scene, DataCollector, Map, Camera
27 from esys.pyvisi.constant import *
28 import os
29
30 PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
31 X_SIZE = 400
32 Y_SIZE = 300
33 JPG_RENDERER = Renderer.ONLINE_JPG
34
35 #... set some parameters ...
36 kappa=1.
37 omega=0.1
38 eta=10.
39 #... generate domain ...
40 mydomain = Rectangle(l0=5.,l1=1.,n0=50, n1=10)
41
42 #... open PDE and set coefficients ...
43 mypde=LinearPDE(mydomain)
44 mypde.setSymmetryOn()
45 n=mydomain.getNormal()
46 x=mydomain.getX()
47 mypde.setValue(A=kappa*kronecker(mydomain),D=omega,Y=omega*x[0], \
48 d=eta,y=kappa*n[0]+eta*x[0])
49 #... calculate error of the PDE solution ...
50 u=mypde.getSolution()
51
52 # Create a Scene.
53 s = Scene(renderer = JPG_RENDERER, x_size = X_SIZE, y_size = Y_SIZE)
54
55 # Create a DataCollector reading directly from an escript object.
56 dc = DataCollector(source = Source.ESCRIPT)
57 dc.setData(sol = u)
58
59 # Create a Map.
60 Map(scene = s, data_collector = dc, viewport = Viewport.SOUTH_WEST,
61 lut = Lut.COLOR, cell_to_point = False, outline = True)
62
63 # Create a Camera.
64 c = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
65
66 # Render the object.
67 s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, "helmholtz.jpg"))

  ViewVC Help
Powered by ViewVC 1.1.26