plot velocity

Asked by Rodolfo França de Lima

Hi! I am new user in yade and I would like to know if is possible build a chart from sphere velocity of script below. Thanks for helping.

from yade import pack, plot, qt

isopor=CohFrictMat(density=23)
idisopor=O.materials.append(isopor)

O.bodies.append([
   sphere(center=(0,2,100),radius=.5,material=idisopor,color=(1,1,0)),
])

h=0.0
#tampa
p1=(-15,15,h)
p2=(-15,-15,h)
p3=(15,-15,h)
p4=(15,15,h)

f1=utils.facet([p1,p2,p3],wire=False)
f2=utils.facet([p1,p3,p4],wire=False)

O.bodies.append(f1)
O.bodies.append(f2)
O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
      # handle sphere+sphere and facet+sphere collisions
      [Ig2_Sphere_Sphere_L3Geom(),Ig2_Facet_Sphere_L3Geom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_L3Geom_FrictPhys_ElPerfPl()]
   ),
   DragEngine(ids=[0],Cd=0.45, Rho=1.225),
   NewtonIntegrator(damping=0.05,gravity=(0,0,-9.81)),

]
O.dt=.05*utils.PWaveTimeStep()

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Rodolfo França de Lima
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hi Rodolfo,

> I am new user in yade

welcome :-)

> I would like to know if is possible build a chart from sphere velocity of script below.

sure. Just put a PyRunner to your O.engines and place the rest of the below code to the end of your script

#############
...
O.engines = [
   ...
   PyRunner(iterPeriod=1000,command="plotAddData()"),
]
...
def plotAddData():
   v = O.bodies[0].state.vel
   vz = v[2]
   plot.addData(
      iter = O.iter,
      time = O.time,
      vz = vz,
   )
plot.plots = {'time':('vx','vy','vz')}
plot.plot()
# push play button
#############

cheers
Jan

[1] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.PyRunner
[2] https://yade-dem.org/doc/yade.plot.html#yade.plot.addData
[3] https://yade-dem.org/doc/user.html#plotting-variables

Revision history for this message
Jan Stránský (honzik) said :
#2

sorry, the correct plot.plots line should be:
plot.plots = {'time':'vz'}
Jan

Revision history for this message
Rodolfo França de Lima (rodolfolima) said :
#3

Thanks a lot!