1
# demonstrate 3d postprocessing with yade
3
# 1. qt.SnapshotEngine saves images of the 3d view as it appears on the screen periodically
4
# utils.makeVideo is then used to make real movie from those images
5
# 2. VTKRecorder saves data in files which can be opened with Paraview
6
# see the User's manual for an intro to Paraview
8
# generate loose packing
9
from yade import pack, qt
11
sp.makeCloud((0,0,0),(2,2,2),rMean=.1,rRelFuzz=.6,periodic=True)
12
# add to scene, make it periodic
17
InsertionSortCollider([Bo1_Sphere_Aabb()]),
19
[Ig2_Sphere_Sphere_L3Geom()],
20
[Ip2_FrictMat_FrictMat_FrictPhys()],
21
[Law2_L3Geom_FrictPhys_ElPerfPl()]
23
NewtonIntegrator(damping=.4),
24
# save data for Paraview
25
VTKRecorder(fileName='3d-vtk-',recorders=['all'],iterPeriod=1000),
26
# save data from Yade's own 3d view
27
qt.SnapshotEngine(fileBase='3d-',iterPeriod=200,label='snapshot'),
28
# this engine will be called after 20000 steps, only once
29
PyRunner(command='finish()',iterPeriod=20000)
31
O.dt=.5*utils.PWaveTimeStep()
33
# prescribe constant-strain deformation of the cell
34
O.cell.velGrad=Matrix3(-.1,0,0, 0,-.1,0, 0,0,-.1)
36
# we must open the view explicitly (limitation of the qt.SnapshotEngine)
39
# this function is called when the simulation is finished
41
# snapshot is label of qt.SnapshotEngine
42
# the 'snapshots' attribute contains list of all saved files
43
utils.makeVideo(snapshot.snapshots,'3d.mpeg',fps=10,bps=10000)
46
# set parameters of the renderer, to show network chains rather than particles
47
# these settings are accessible from the Controller window, on the second tab ("Display") as well