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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1811 - (hide annotations)
Thu Sep 25 23:11:13 2008 UTC (10 years, 10 months ago) by ksteube
File MIME type: text/x-python
File size: 2033 byte(s)
Copyright updated in all files

1 ksteube 1811
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__="http://www.uq.edu.au/esscc/escript-finley"
21    
22 jongui 1203 """
23     Author: Lutz Gross, l.gross@uq.edu.au
24     Author: John Ngui, john.ngui@uq.edu.au
25     """
26    
27 ksteube 1147 # Import the necesary modules.
28     from esys.escript import *
29     from esys.escript.linearPDEs import Poisson
30     from esys.finley import Rectangle
31     from esys.pyvisi import Scene, DataCollector, Map, Camera
32     from esys.pyvisi.constant import *
33 jongui 1148 import os
34 ksteube 1147
35 jongui 1148 PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
36 ksteube 1147 X_SIZE = 400
37     Y_SIZE = 300
38     JPG_RENDERER = Renderer.ONLINE_JPG
39    
40     # generate domain:
41     mydomain = Rectangle(l0=1.,l1=1.,n0=40, n1=20)
42 jongui 1153 # define characteristic function of Gamma
43 ksteube 1147 x = mydomain.getX()
44     gammaD = whereZero(x[0])+whereZero(x[1])
45     # define PDE and get its solution u
46     mypde = Poisson(domain=mydomain)
47     mypde.setValue(f=1,q=gammaD)
48     u = mypde.getSolution()
49    
50     # Create a Scene.
51     s = Scene(renderer = JPG_RENDERER, x_size = X_SIZE, y_size = Y_SIZE)
52    
53     # Create a DataCollector reading directly from an escript object.
54     dc = DataCollector(source = Source.ESCRIPT)
55     dc.setData(sol = u)
56    
57     # Create a Map.
58     Map(scene = s, data_collector = dc, viewport = Viewport.SOUTH_WEST,
59     lut = Lut.COLOR, cell_to_point = False, outline = True)
60    
61     # Create a Camera.
62 jongui 1148 c = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
63 ksteube 1147
64     # Render the object.
65 jongui 1148 s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, "poisson.jpg"))

  ViewVC Help
Powered by ViewVC 1.1.26