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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2344 - (show annotations)
Mon Mar 30 02:13:58 2009 UTC (10 years, 4 months ago) by jfenwick
File MIME type: text/x-python
File size: 2178 byte(s)
Change __url__ to launchpad site

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

  ViewVC Help
Powered by ViewVC 1.1.26