/[escript]/trunk/doc/examples/wave_with_pyvisi.py
ViewVC logotype

Diff of /trunk/doc/examples/wave_with_pyvisi.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1098 by jongui, Mon Apr 16 23:03:55 2007 UTC revision 1099 by jongui, Tue Apr 17 01:45:08 2007 UTC
# Line 3  from esys.escript.pdetools import Locato Line 3  from esys.escript.pdetools import Locato
3  from esys.escript.linearPDEs import LinearPDE  from esys.escript.linearPDEs import LinearPDE
4  from esys.finley import Brick  from esys.finley import Brick
5  from numarray import identity,zeros,ones  from numarray import identity,zeros,ones
6  from esys.pyvisi import Scene, DataCollector, Velocity  from esys.pyvisi import Scene, DataCollector, Ellipsoid, Camera
7  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
8    
9  ne=32          # number of cells in x_0 and x_1 directions  ne=32          # number of cells in x_0 and x_1 directions
# Line 57  def wavePropagation(domain,h,tend,lam,mu Line 57  def wavePropagation(domain,h,tend,lam,mu
57     u_pc_data=open('./data/U_pc.out','w')     u_pc_data=open('./data/U_pc.out','w')
58     u_pc_data.write("%f %f %f %f\n"%(t,u_pc_x,u_pc_y,u_pc_z))     u_pc_data.write("%f %f %f %f\n"%(t,u_pc_x,u_pc_y,u_pc_z))
59    
60     s = Scene(renderer = Renderer.DISPLAY, x_size = 500, y_size = 500)     s = Scene(renderer = Renderer.OFFLINE_JPG, x_size = 500, y_size = 500)
61     dc = DataCollector(source = Source.ESCRIPT)     dc = DataCollector(source = Source.ESCRIPT)
62    
63     while t<tend:     while t<tend:
# Line 87  def wavePropagation(domain,h,tend,lam,mu Line 87  def wavePropagation(domain,h,tend,lam,mu
87    
88       # ... save current acceleration in units of gravity and displacements       # ... save current acceleration in units of gravity and displacements
89       if n==1 or n%10==0:       if n==1 or n%10==0:
90           #saveVTK("./data/usoln.%i.vtu"%(n/10), acceleration=length(a)/9.81,       #saveVTK("./data/usoln.%i.vtu"%(n/10), acceleration=length(a)/9.81,
91           #        displacement = u, tensor = stress, Ux = u[0])           #     displacement = u, tensor = stress, Ux = u[0])
92    
93           dc.setData(acceleration = length(a)/9.81, displacement = u,           dc.setData(acceleration = length(a)/9.81, displacement = u,
94                   tensor = stress, Ux = u[0])                   tensor = stress, Ux = u[0])
95    
96           v = Velocity(scene = s, data_collector = dc,           e = Ellipsoid(scene = s, data_collector = dc,
97                   viewport = Viewport.SOUTH_WEST, color_mode = ColorMode.VECTOR,                   viewport = Viewport.SOUTH_WEST,
98                   arrow = Arrow.THREE_D, lut = Lut.COLOR, cell_to_point = False,                   lut = Lut.COLOR, cell_to_point = True, outline = True)
99                   outline = True)           e.setScaleFactor(scale_factor = 0.7)
100           v.setScaleFactor(scale_factor = 2000)           e.setMaxScaleFactor(max_scale_factor = 1000)
101             e.setRatio(ratio = 10)
102    
103             c = Camera(scene = s, data_collector = dc,
104                     viewport = Viewport.SOUTH_WEST)
105             c.isometricView()
106    
107           s.render(image_name = "wave_%2d.jpg" % (n/10))           s.render(image_name = "wave_%02d.jpg" % (n/10))
108    
109     u_pc_data.close()     u_pc_data.close()
110        

Legend:
Removed from v.1098  
changed lines
  Added in v.1099

  ViewVC Help
Powered by ViewVC 1.1.26