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 |
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: |
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 |
|
|